@dimina-kit/devtools 0.3.2-dev.20260601115343 → 0.3.2-dev.20260610114009
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -59
- package/dist/main/api.d.ts +1 -2
- package/dist/main/api.js +5 -1
- package/dist/main/app/app.d.ts +15 -5
- package/dist/main/app/app.js +249 -122
- package/dist/main/app/bootstrap.d.ts +16 -0
- package/dist/main/app/bootstrap.js +20 -0
- package/dist/main/app/launch.d.ts +8 -4
- package/dist/main/app/launch.js +9 -4
- package/dist/main/index.bundle.js +6071 -1863
- package/dist/main/index.js +9 -1
- package/dist/main/ipc/app.d.ts +1 -1
- package/dist/main/ipc/bridge-router.d.ts +61 -0
- package/dist/main/ipc/bridge-router.js +1333 -0
- package/dist/main/ipc/panels.d.ts +1 -1
- package/dist/main/ipc/panels.js +6 -2
- package/dist/main/ipc/popover.d.ts +1 -1
- package/dist/main/ipc/project-fs.d.ts +1 -1
- package/dist/main/ipc/projects.d.ts +1 -1
- package/dist/main/ipc/session.d.ts +1 -1
- package/dist/main/ipc/settings.d.ts +1 -1
- package/dist/main/ipc/simulator-module.d.ts +6 -0
- package/dist/main/ipc/simulator-module.js +9 -1
- package/dist/main/ipc/simulator.d.ts +2 -2
- package/dist/main/ipc/simulator.js +29 -5
- package/dist/main/ipc/toolbar.d.ts +1 -1
- package/dist/main/ipc/views.d.ts +1 -1
- package/dist/main/ipc/views.js +40 -2
- package/dist/main/runtime/devtools-backend.d.ts +17 -0
- package/dist/main/runtime/devtools-backend.js +49 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +39 -0
- package/dist/main/runtime/miniapp-runtime.js +17 -0
- package/dist/main/services/automation/exec.d.ts +27 -2
- package/dist/main/services/automation/exec.js +37 -3
- package/dist/main/services/automation/handlers/app.js +127 -11
- package/dist/main/services/automation/handlers/page.js +36 -19
- package/dist/main/services/automation/index.js +40 -13
- package/dist/main/services/automation/wait-active-page.d.ts +56 -0
- package/dist/main/services/automation/wait-active-page.js +71 -0
- package/dist/main/services/console-forward/index.d.ts +36 -0
- package/dist/main/services/console-forward/index.js +81 -0
- package/dist/main/services/dimina-resource-server.d.ts +7 -0
- package/dist/main/services/dimina-resource-server.js +99 -0
- package/dist/main/services/elements-forward/index.d.ts +66 -0
- package/dist/main/services/elements-forward/index.js +583 -0
- package/dist/main/services/layout/index.d.ts +22 -0
- package/dist/main/services/layout/index.js +25 -0
- package/dist/main/services/mcp/index.d.ts +1 -0
- package/dist/main/services/mcp/index.js +3 -0
- package/dist/main/services/mcp/server.d.ts +1 -1
- package/dist/main/services/mcp/server.js +1 -1
- package/dist/main/services/mcp/target-manager.d.ts +35 -0
- package/dist/main/services/mcp/target-manager.js +63 -1
- package/dist/main/services/mcp/tools/context-tools.js +15 -1
- package/dist/main/services/module.d.ts +1 -1
- package/dist/main/services/network-forward/index.d.ts +190 -0
- package/dist/main/services/network-forward/index.js +765 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +11 -0
- package/dist/main/services/notifications/renderer-notifier.js +7 -1
- package/dist/main/services/render-inspect/index.d.ts +41 -0
- package/dist/main/services/render-inspect/index.js +88 -0
- package/dist/main/services/safe-area/index.d.ts +17 -0
- package/dist/main/services/safe-area/index.js +59 -0
- package/dist/main/services/service-host-pool/pool.d.ts +197 -0
- package/dist/main/services/service-host-pool/pool.js +364 -0
- package/dist/main/services/simulator/custom-apis.d.ts +34 -0
- package/dist/main/services/simulator/custom-apis.js +22 -0
- package/dist/main/services/simulator-appdata/index.d.ts +35 -0
- package/dist/main/services/simulator-appdata/index.js +71 -0
- package/dist/main/services/simulator-current-page/index.d.ts +24 -0
- package/dist/main/services/simulator-current-page/index.js +19 -0
- package/dist/main/services/simulator-storage/index.d.ts +37 -2
- package/dist/main/services/simulator-storage/index.js +209 -32
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +40 -0
- package/dist/main/services/simulator-storage/service-storage-ops.js +67 -0
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -1
- package/dist/main/services/simulator-temp-files/index.js +39 -17
- package/dist/main/services/simulator-wxml/index.d.ts +29 -0
- package/dist/main/services/simulator-wxml/index.js +28 -0
- package/dist/main/services/toolbar/toolbar-store.d.ts +3 -3
- package/dist/main/services/toolbar/toolbar-store.js +1 -18
- package/dist/main/services/views/devtools-tabs.d.ts +47 -0
- package/dist/main/services/views/devtools-tabs.js +95 -0
- package/dist/main/services/views/miniapp-partition.d.ts +80 -0
- package/dist/main/services/views/miniapp-partition.js +138 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +28 -0
- package/dist/main/services/views/simulator-session-policy.js +82 -0
- package/dist/main/services/views/view-manager.d.ts +125 -0
- package/dist/main/services/views/view-manager.js +852 -4
- package/dist/main/services/workbench-context.d.ts +67 -7
- package/dist/main/services/workbench-context.js +6 -1
- package/dist/main/services/workspace/workspace-service.js +7 -13
- package/dist/main/utils/ipc-registry.d.ts +1 -1
- package/dist/main/utils/ipc-registry.js +21 -4
- package/dist/main/utils/paths.d.ts +15 -0
- package/dist/main/utils/paths.js +19 -0
- package/dist/main/utils/sender-policy.d.ts +9 -3
- package/dist/main/utils/sender-policy.js +18 -4
- package/dist/main/utils/theme.d.ts +1 -1
- package/dist/main/utils/theme.js +1 -1
- package/dist/main/windows/main-window/create.d.ts +0 -6
- package/dist/main/windows/main-window/create.js +6 -80
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +67 -0
- package/dist/main/windows/service-host-window/create.js +138 -0
- package/dist/native-host/common/common.js +368 -0
- package/dist/native-host/container/pageFrame.css +1 -0
- package/dist/native-host/render/render.js +9334 -0
- package/dist/native-host/service/service.js +6 -0
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +6 -0
- package/dist/preload/instrumentation/app-data.d.ts +18 -20
- package/dist/preload/instrumentation/app-data.js +23 -160
- package/dist/preload/instrumentation/wxml-extract.d.ts +1 -1
- package/dist/preload/instrumentation/wxml-extract.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -8
- package/dist/preload/runtime/bridge.js +2 -32
- package/dist/preload/runtime/custom-apis.js +20 -17
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +27 -0
- package/dist/preload/runtime/host-toolbar-advertiser.js +55 -0
- package/dist/preload/runtime/main-api-runner.d.ts +9 -0
- package/dist/preload/runtime/main-api-runner.js +85 -0
- package/dist/preload/runtime/native-host.d.ts +43 -0
- package/dist/preload/runtime/native-host.js +83 -0
- package/dist/preload/shared/expose.d.ts +10 -5
- package/dist/preload/shared/expose.js +30 -12
- package/dist/preload/shared/sid-registry.d.ts +11 -0
- package/dist/preload/shared/sid-registry.js +38 -0
- package/dist/preload/windows/host-toolbar.cjs +161 -0
- package/dist/preload/windows/host-toolbar.cjs.map +7 -0
- package/dist/preload/windows/host-toolbar.d.ts +2 -0
- package/dist/preload/windows/host-toolbar.js +12 -0
- package/dist/preload/windows/main.cjs +1935 -0
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/simulator.cjs +925 -0
- package/dist/preload/windows/simulator.cjs.map +7 -0
- package/dist/preload/windows/simulator.js +244 -574
- package/dist/render-host/pageFrame.html +29 -0
- package/dist/render-host/preload.cjs +154 -0
- package/dist/render-host/render-inspect.js +295 -0
- package/dist/renderer/assets/index-CcJKzatF.js +50 -0
- package/dist/renderer/assets/{input-CCYS8Ave.js → input-QGx6FFX1.js} +2 -2
- package/dist/renderer/assets/ipc-transport-BT4QYQqu.css +1 -0
- package/dist/renderer/assets/{ipc-transport-Bn4KXvhu.js → ipc-transport-DvZvwK-Z.js} +2 -2
- package/dist/renderer/assets/{popover-CH4rwpdt.js → popover-BOH1If1J.js} +2 -2
- package/dist/renderer/assets/select-C7JQ8G5N.js +2 -0
- package/dist/renderer/assets/{settings-CMTB-t0x.js → settings-DpAbTJyF.js} +2 -2
- package/dist/renderer/assets/{settings-api-Csdngf9Z.js → settings-api-RD2IZF53.js} +2 -2
- package/dist/renderer/assets/{workbenchSettings-CODFCzOg.js → workbenchSettings-CNJX4Qna.js} +2 -2
- package/dist/renderer/entries/main/index.html +5 -5
- package/dist/renderer/entries/popover/index.html +5 -5
- package/dist/renderer/entries/settings/index.html +5 -5
- package/dist/renderer/entries/workbench-settings/index.html +4 -4
- package/dist/service-host/preload.cjs +254 -0
- package/dist/service-host/service.html +10 -0
- package/dist/service-host/sourcemap-rewrite.cjs +58 -0
- package/dist/service-host/sync-api-patch.js +20 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +8 -0
- package/dist/service-host/sync-impls/menu-button.js +16 -0
- package/dist/service-host/sync-impls/storage.js +50 -0
- package/dist/service-host/sync-impls/system-info.js +54 -0
- package/dist/shared/appdata-accumulator.d.ts +95 -0
- package/dist/shared/appdata-accumulator.js +213 -0
- package/dist/shared/bridge-channels.d.ts +378 -0
- package/dist/shared/bridge-channels.js +81 -0
- package/dist/shared/ipc-channels.d.ts +84 -1
- package/dist/shared/ipc-channels.js +90 -10
- package/dist/shared/ipc-schemas.d.ts +59 -2
- package/dist/shared/ipc-schemas.js +64 -3
- package/dist/shared/open-in-editor.d.ts +71 -0
- package/dist/shared/open-in-editor.js +138 -0
- package/dist/shared/simulator-api-metadata.d.ts +21 -0
- package/dist/shared/simulator-api-metadata.js +23 -0
- package/dist/shared/types.d.ts +2 -39
- package/dist/simulator/assets/device-shell-DsdcNEkt.css +1 -0
- package/dist/simulator/assets/device-shell-fH2cI-3q.js +2 -0
- package/dist/simulator/assets/jsx-runtime-P6ZegaOf.js +2 -0
- package/dist/simulator/assets/simulator-DHylZf9Z.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-BDNu5n26.js +2 -0
- package/dist/simulator/device-shell/menu-button-geometry.js +8 -0
- package/dist/simulator/simulator.html +2 -112
- package/package.json +12 -12
- package/dist/main/utils/disposable.d.ts +0 -18
- package/dist/main/utils/disposable.js +0 -67
- package/dist/renderer/assets/index-BDMxXUfn.js +0 -50
- package/dist/renderer/assets/ipc-transport-Cu7tubyg.css +0 -1
- package/dist/renderer/assets/select-Ct4-sijm.js +0 -2
- package/dist/simulator/assets/simulator-B4e3c6_O.js +0 -9
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>a(e[n],t[n])):!1}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e){return e===`__proto__`}function c(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function l(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return/^(?:0|[1-9]\d*)$/.test(e)}}function u(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function d(e){return typeof e==`symbol`||Object.prototype.toString.call(e)===`[object Symbol]`}function f(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function p(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function m(e){if(Array.isArray(e))return e.map(p);if(typeof e==`symbol`)return[e];e=h(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function h(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(h).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function ee(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||d(e)?!0:typeof e==`string`&&(/^\w*$/.test(e)||!/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/.test(e))||t!=null&&o(t,e)}function te(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||s(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function g(e,t){if(e!=null)switch(typeof t){case`string`:{if(s(t))return;let n=e[t];return n===void 0?c(t)?g(e,m(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=p(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return te(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),s(t))return;let n=e[t];return n===void 0?void 0:n}}}function ne(e,t,n){re(e,t,()=>n,()=>void 0)}function re(e,t,n,r){if(e==null&&!u(e))return e;let i;i=ee(t,e)?[t]:Array.isArray(t)?t:m(t);let a=n(g(e,i)),o=e;for(let t=0;t<i.length&&o!=null;t++){let n=p(i[t]);if(s(n))continue;let c;if(t===i.length-1)c=a;else{let a=o[n],s=r?.(a,n,e);c=s===void 0?u(a)?a:l(i[t+1])?[]:{}:s}ie(o,n,c),o=o[n]}return e}function ie(e,t,n){let r=e[t];(!(o(e,t)&&f(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function ae(){return Math.random().toString(36).slice(2,7)}function oe(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function se(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var _=typeof window<`u`&&typeof navigator<`u`;_&&/Android/i.test(navigator.userAgent),_&&/iPad|iPhone|iPod/.test(navigator.userAgent),_&&/OpenHarmony|harmony/.test(navigator.userAgent),_&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var v=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function ce(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function y(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=ce(n,i);return a&&(o+=`?${a}`),o}function b(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function le(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var x={},S=1,ue=2;function de(e,t){x[e]||(x[e]={factory:t,status:S,exports:void 0})}function C(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=x[e];if(!i)throw Error(`module ${e} not found`);if(i.status===S){i.status=ue;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,C,t,t.exports))}catch(t){i.status=S;let a=`
|
|
2
|
+
name: ${t.name}
|
|
3
|
+
msg: ${t.message}
|
|
4
|
+
stack:
|
|
5
|
+
${t.stack}
|
|
6
|
+
`;console.error(`require ${e} error: ${a}`),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}C.async=async e=>new Promise((t,n)=>{try{t(C(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var w=new class{constructor(){this.callbacks={}}store(e,t,n=ae()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},T=new class{constructor(){this.reset()}reset(){this.active=!1,this.snapshot={systemInfo:null,menuRect:null}}init(e={}){this.active=!0,this.snapshot={...this.snapshot,...e}}update(e={}){this.snapshot={...this.snapshot,...e}}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function fe(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var E=new class e{constructor(){this.event=fe(),this.init()}init(){v?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){console.log(`[service] receive msg: `,v?e:JSON.stringify(e));let{type:t,body:n}=e;this.event.emit(t,n)}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return v?e.prototype.send=function(e){e.method=`publish`,globalThis.postMessage(e)}:e.prototype.send=function(e){return DiminaServiceBridge.publish(e.body.bridgeId||``,e)},this.send(t)}invoke(t){return v?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},D=new class{#e=[];#t=``;setInitId(e){this.#t=e}push(e,t){this.stack(t).push(e)}pop(){this.stack().length>0&&this.stack().pop()}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}else{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}},pe={getWindowInfo:()=>T.getSystemInfo(),getSystemInfoSync:()=>T.getSystemInfo(),getAppBaseInfo:()=>T.getSystemInfo(),getDeviceInfo:()=>T.getSystemInfo(),getMenuButtonBoundingClientRect:()=>T.getMenuRect()},me=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),he=new Set(`FileSystemManager.getSavedFileList,clearStorage,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function ge(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function _e(e,t){return me.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t===void 0?he.has(e):!0}function ve(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:D.getPageInfo().id,params:t}};return n===`container`?E.invoke(r):E.send(r)}function ye(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{w.remove(a),w.remove(o)};a=w.store(e=>{s(),r(e)}),o=w.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{ve(e,t,n)}catch(e){s(),i(e)}})}function O(e,t,r=`container`){let i=pe[e];if(r===`container`&&i){let e=i();if(e)return e}let a;if(t===void 0){if(_e(e,t))return ye(e,{},r);a=t}else if(typeof t==`string`||Array.isArray(t))a=t;else if(n(t))a={success:w.store(t,!0)};else if(ge(t)){let{success:e,fail:r,complete:i,keep:o,evtId:s,...c}=t;a=c,n(e)?a.success=w.store(e,o,s):a.success=e,n(r)&&(a.fail=w.store(r,o,s)),n(i)&&(a.complete=w.store(i,o,s))}else{let{keep:n,...i}=t;if(delete i.evtId,!n&&_e(e,t))return a={...i},ye(e,a,r);a=i}return ve(e,a,r)}var be=t({navigateBack:()=>Te,navigateTo:()=>we,reLaunch:()=>Se,redirectTo:()=>Ce,switchTab:()=>xe});function xe(e){return e.url=y(D.getPageInfo().route,e.url),O(`switchTab`,e)}function Se(e){return e.url=y(D.getPageInfo().route,e.url),O(`reLaunch`,e)}function Ce(e){let t=y(D.getPageInfo().route,e.url);if(D.getPageInfo().route!==t)return e.url=t,O(`redirectTo`,e)}function we(e){return e.url=y(D.getPageInfo().route,e.url),O(`navigateTo`,e)}function Te(e){return O(`navigateBack`,e)}var Ee=t({offAppHide:()=>Me,offAppShow:()=>je,offError:()=>Oe,onAppHide:()=>Ae,onAppRoute:()=>Fe,onAppShow:()=>ke,onError:()=>De,onPageNotFound:()=>Pe,onUnhandledRejection:()=>Ne});function De(e){return O(`onError`,e)}function Oe(e){return O(`offError`,e)}function ke(e){return O(`onAppShow`,e)}function Ae(e){return O(`onAppHide`,e)}function je(e){return O(`offAppShow`,e)}function Me(e){return O(`offAppHide`,e)}function Ne(){}function Pe(){}function Fe(){}var Ie=t({canIUse:()=>ze,env:()=>Le});function Le(){return{USER_DATA_PATH:`difile://`}}var Re=new Set([`nextTick`,`getUpdateManager`,`UpdateManager`,`UpdateManager.applyUpdate`,`UpdateManager.onCheckForUpdate`,`UpdateManager.onUpdateFailed`,`UpdateManager.onUpdateReady`,`getPerformance`]);function ze(e){if(Re.has(e))return!0;try{return O(`canIUse`,e)}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Be=t({getPerformance:()=>Ve});function Ve(){return He.getInstance()}var He=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Ue,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){let t=new We(e);return e&&O(`addPerformanceObserver`,{success:w.store(e=>{let n=e?.data?.entryList&&JSON.parse(e?.data?.entryList)||[];n&&(this.entryList.push(n),t.notify(n))},!0)},`render`),t}getEntries(){return this.entryList.getEntries()}getEntriesByName(e,t){return this.entryList.getEntriesByName(e,t)}getEntriesByType(e){return this.entryList.getEntriesByType(e)}setBufferSize(e){this.entryList.maxEntrySize=e}},Ue=class{constructor(){this._list=[],this.maxEntrySize=30}push(e){for(let t of e)this._list.length>=this.maxEntrySize&&this._list.shift(),this._list.push(t)}getEntriesByName(e,t){return this._entryFilter(e,t)}getEntriesByType(e){return this._entryFilter(null,e)}_entryFilter(e,t){return this._list.filter(n=>!(e&&e!==n.name||t&&t!==n.entryType))}getEntries(){return this._list}},We=class{constructor(e){this.entryTypes=[],this.callback=e}observe(e){this.connected=!0,this.entryTypes=e.entryTypes}notify(e){if(this.connected){let t=new Ue;t.push(e.filter(e=>{let t=!1;return this.entryTypes&&this.entryTypes.length>0&&this.entryTypes.forEach(n=>{e.entryType===n&&(t=!0)}),t})),this.callback(t)}}disconnect(){this.connected=!1}},Ge=t({loadSubpackage:()=>qe,preDownloadSubpackage:()=>Ke});function Ke(e){return O(`preDownloadSubpackage`,e)}function qe(e){return O(`loadSubpackage`,e)}var Je=t({getAppBaseInfo:()=>tt,getDeviceInfo:()=>nt,getSystemInfo:()=>Qe,getSystemInfoAsync:()=>et,getSystemInfoSync:()=>$e,getWindowInfo:()=>Xe,openAppAuthorizeSetting:()=>Ze,openSystemBluetoothSetting:()=>Ye});function Ye(e){return O(`openSystemBluetoothSetting`,e)}function Xe(e){return O(`getWindowInfo`,e)}function Ze(e){return O(`openAppAuthorizeSetting`,e)}function Qe(e){return new Promise(t=>{t(O(`getSystemInfo`,e))})}function $e(){return O(`getSystemInfoSync`)}function et(e){return O(`getSystemInfoAsync`,e)}function tt(){return O(`getAppBaseInfo`)}function nt(){return O(`getDeviceInfo`)}var rt=t({getUpdateManager:()=>lt}),it=`onUpdateStatusChange`,at=`updatefail`,ot=`updateready`,st=`noupdate`,ct=`updating`;function lt(){return ut.getInstance()}var ut=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],E.on(it,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===at){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===ot){this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),this.emit(this.updateReadyListeners);return}if(t===ct){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===st){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,O(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};ut.getInstance();var dt=t({createCameraContext:()=>ft});function ft(){return new pt}var pt=class{constructor(){this.bridgeId=D.getPageInfo().id}takePhoto(e){return O(`takePhoto`,e)}startRecord(){return O(`startRecord`)}stopRecord(){return O(`stopRecord`)}},mt=t({reportAnalytics:()=>ht,reportEvent:()=>gt});function ht(...e){return O(`reportAnalytics`,e)}function gt(e,t){return O(`reportAnalytics`,{eventId:e,data:t})}var _t=t({closeBluetoothAdapter:()=>Ot,getBluetoothAdapterState:()=>Dt,getBluetoothDevices:()=>Et,getConnectedBluetoothDevices:()=>Tt,offBluetoothAdapterStateChange:()=>wt,offBluetoothDeviceFound:()=>Ct,onBluetoothAdapterStateChange:()=>St,onBluetoothDeviceFound:()=>xt,openBluetoothAdapter:()=>bt,startBluetoothDevicesDiscovery:()=>yt,stopBluetoothDevicesDiscovery:()=>vt});function vt(e){return O(`stopBluetoothDevicesDiscovery`,e)}function yt(e){return O(`startBluetoothDevicesDiscovery`,e)}function bt(e){return O(`openBluetoothAdapter`,e)}function xt(e){return O(`onBluetoothDeviceFound`,e)}function St(e){return O(`onBluetoothAdapterStateChange`,e)}function Ct(){return O(`offBluetoothDeviceFound`)}function wt(){return O(`offBluetoothAdapterStateChange`)}function Tt(e){return O(`getConnectedBluetoothDevices`,e)}function Et(e){return O(`getBluetoothDevices`,e)}function Dt(e){return O(`getBluetoothAdapterState`,e)}function Ot(e){return O(`closeBluetoothAdapter`,e)}var kt=t({closeBLEConnection:()=>Ht,createBLEConnection:()=>Vt,getBLEDeviceCharacteristics:()=>Bt,getBLEDeviceRSSI:()=>zt,getBLEDeviceServices:()=>Rt,notifyBLECharacteristicValueChange:()=>Lt,offBLECharacteristicValueChange:()=>It,offBLEConnectionStateChange:()=>Ft,onBLECharacteristicValueChange:()=>Pt,onBLEConnectionStateChange:()=>Nt,readBLECharacteristicValue:()=>Mt,setBLEMTU:()=>jt,writeBLECharacteristicValue:()=>At});function At(e){return O(`writeBLECharacteristicValue`,e)}function jt(e){return O(`setBLEMTU`,e)}function Mt(e){return O(`readBLECharacteristicValue`,e)}function Nt(e){return O(`onBLEConnectionStateChange`,e)}function Pt(e){return O(`onBLECharacteristicValueChange`,e)}function Ft(e){return O(`offBLEConnectionStateChange`,e)}function It(){return O(`offBLECharacteristicValueChange`)}function Lt(e){return O(`notifyBLECharacteristicValueChange`,e)}function Rt(e){return O(`getBLEDeviceServices`,e)}function zt(e){return O(`getBLEDeviceRSSI`,e)}function Bt(e){return O(`getBLEDeviceCharacteristics`,e)}function Vt(e){return O(`createBLEConnection`,e)}function Ht(e){return O(`closeBLEConnection`,e)}var Ut=t({getClipboardData:()=>Gt,setClipboardData:()=>Wt});function Wt(e){return O(`setClipboardData`,e)}function Gt(e){return O(`getClipboardData`,e)}var Kt=t({addPhoneContact:()=>Jt,chooseContact:()=>qt});function qt(e){return O(`chooseContact`,e)}function Jt(e){return O(`addPhoneContact`,e)}var Yt=t({hideKeyboard:()=>Xt});function Xt(e){return O(`hideKeyboard`,e)}var Zt=t({offMemoryWarning:()=>$t,onMemoryWarning:()=>Qt});function Qt(e){return O(`onMemoryWarning`,e)}function $t(e){return O(`offMemoryWarning`,e)}var en=t({getNetworkType:()=>tn});function tn(e){return O(`getNetworkType`,e)}var nn=t({makePhoneCall:()=>rn});function rn(e){return O(`makePhoneCall`,e)}var an=t({scanCode:()=>on});function on(e){return O(`scanCode`,e)}var sn=t({vibrateLong:()=>ln,vibrateShort:()=>cn});function cn(e){return O(`vibrateShort`,e)}function ln(e){return O(`vibrateLong`,e)}var un=t({extBridge:()=>dn,extOffBridge:()=>pn,extOnBridge:()=>fn,offLoginStatusChanged:()=>hn,onLoginStatusChanged:()=>mn});function dn({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),O(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function fn({event:e,module:t,callBack:n,isSustain:r=!0}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOnBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOnBridge 参数 event 为空`);return}if(!n){console.error(`[ERROR]: extOnBridge 参数 callBack 为空`);return}let i=`${t}_${e}`;O(i,{evtId:i,keep:r,success:n})}function pn({event:e,module:t,callBack:n}){if(!t||t===`DMServiceBridgeModule`){console.error(`[ERROR]: extOffBridge \u53C2\u6570 module ${t?`\u503C${t}\u4E0D\u5408\u6CD5`:`为空`}`);return}if(!e){console.error(`[ERROR]: extOffBridge 参数 event 为空`);return}O(`${t}_${e}`,{success:n})}function mn(e){E.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function hn(){E.off(`notifyLoginStatusChanged`)}var gn=t({USER_DATA_PATH:()=>_n,getFileSystemManager:()=>xn}),_n=`difile://`,vn=`not supported by the dimina runtime`;function k(e){throw Error(`FileSystemManager.${e} ${vn}`)}function A(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${vn}`}),r?.()}var yn=class{access(e){A(`access`,e)}accessSync(){k(`accessSync`)}stat(e){A(`stat`,e)}statSync(){k(`statSync`)}readFile(e){A(`readFile`,e)}readFileSync(){k(`readFileSync`)}writeFile(e){A(`writeFile`,e)}writeFileSync(){k(`writeFileSync`)}appendFile(e){A(`appendFile`,e)}appendFileSync(){k(`appendFileSync`)}copyFile(e){A(`copyFile`,e)}copyFileSync(){k(`copyFileSync`)}rename(e){A(`rename`,e)}renameSync(){k(`renameSync`)}unlink(e){A(`unlink`,e)}unlinkSync(){k(`unlinkSync`)}mkdir(e){A(`mkdir`,e)}mkdirSync(){k(`mkdirSync`)}rmdir(e){A(`rmdir`,e)}rmdirSync(){k(`rmdirSync`)}readdir(e){A(`readdir`,e)}readdirSync(){k(`readdirSync`)}getFileInfo(e){A(`getFileInfo`,e)}saveFile(e){A(`saveFile`,e)}saveFileSync(){k(`saveFileSync`)}getSavedFileList(e){A(`getSavedFileList`,e)}removeSavedFile(e){A(`removeSavedFile`,e)}truncate(e){A(`truncate`,e)}truncateSync(){k(`truncateSync`)}unzip(e){A(`unzip`,e)}open(e){A(`open`,e)}openSync(){k(`openSync`)}close(e){A(`close`,e)}closeSync(){k(`closeSync`)}read(e){A(`read`,e)}readSync(){k(`readSync`)}write(e){A(`write`,e)}writeSync(){k(`writeSync`)}fstat(e){A(`fstat`,e)}fstatSync(){k(`fstatSync`)}ftruncate(e){A(`ftruncate`,e)}ftruncateSync(){k(`ftruncateSync`)}readCompressedFile(e){A(`readCompressedFile`,e)}readCompressedFileSync(){k(`readCompressedFileSync`)}readZipEntry(e){A(`readZipEntry`,e)}},bn;function xn(){return bn||=new yn,bn}var Sn=[`onLaunch`,`onShow`,`onHide`],Cn=[`globalData`],wn=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){Sn.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)Sn.includes(t)||Cn.includes(t)||(n(e[t])?this[t]=e[t].bind(this):this[t]=e[t])}invokeSomeLifecycle(){this.onLaunch?.(this.options),this.onShow?.(this.options)}appShow(){this.onShow?.(this.options)}appHide(){this.onHide?.()}},Tn=new Set([`2d`]),En=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Dn=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),On=new Set([`createBuffer`,`createFramebuffer`,`createProgram`,`createRenderbuffer`,`createShader`,`createTexture`]),kn=new Set([`getAttribLocation`,`getUniformLocation`]),j={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713},An=1,jn=1;function M(){let e=D.getPageInfo();return e?.bridgeId||e?.id||``}function N(e,t,n){E.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function Mn(e){Promise.resolve().then(e)}function Nn(e){return Object.prototype.toString.call(e)===`[object Object]`}function Pn(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function P(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=Pn(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>P(e));if(Nn(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=P(r);return t}return e}function F(e){return Array.from(e).map(e=>P(e))}function I(e=`canvas_resource`){return`${e}_${ae()}`}var Fn=class{constructor(e,t){return this.__canvasResourceId=t,this.__canvasProxyValue=An++,this.canvas=e,new Proxy(this,{get(e,n){if(n in e)return e[n];if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:F(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}},In=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=w.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=w.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},Ln=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:P(r)}),!0}})}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};let n=Dn.has(e)?I():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:F(t),resultId:n}),n)return new Fn(this.canvas,n)}},Rn=class{constructor(e,t,n){return this.canvas=e,this.contextId=t,this.contextType=n,new Proxy(this,{get(e,t){if(t in e)return e[t];if(Object.prototype.hasOwnProperty.call(j,t))return j[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:case`getProgramParameter`:return!0;case`getShaderInfoLog`:case`getProgramInfoLog`:return``;case`getError`:return j.NO_ERROR;case`isContextLost`:return!1;case`checkFramebufferStatus`:return j.FRAMEBUFFER_COMPLETE;case`getContextAttributes`:return{};case`getSupportedExtensions`:return[];case`getExtension`:return null;default:break}let n=On.has(e)||kn.has(e)?I(`webgl_resource`):void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:F(t),resultId:n}),n)return new Fn(this.canvas,n)}getParameter(e){let{width:t,height:n}=this.canvas;switch(e){case j.VERSION:return`WebGL 1.0`;case j.SHADING_LANGUAGE_VERSION:return`WebGL GLSL ES 1.0`;case j.VENDOR:return`Dimina`;case j.RENDERER:return`Dimina WebGL Proxy`;case j.VIEWPORT:return[0,0,t,n];case j.MAX_VIEWPORT_DIMS:return[t||4096,n||4096];case j.ALIASED_POINT_SIZE_RANGE:return[1,64];case j.ALIASED_LINE_WIDTH_RANGE:return[1,1];case j.COLOR_CLEAR_VALUE:return[0,0,0,0];case j.COLOR_WRITEMASK:case j.DEPTH_WRITEMASK:return!0;case j.COMPRESSED_TEXTURE_FORMATS:return[];case j.MAX_TEXTURE_SIZE:case j.MAX_CUBE_MAP_TEXTURE_SIZE:case j.MAX_RENDERBUFFER_SIZE:return 4096;case j.MAX_VERTEX_ATTRIBS:return 16;case j.MAX_TEXTURE_IMAGE_UNITS:case j.MAX_VERTEX_TEXTURE_IMAGE_UNITS:case j.MAX_COMBINED_TEXTURE_IMAGE_UNITS:return 8;case j.MAX_VERTEX_UNIFORM_VECTORS:case j.MAX_FRAGMENT_UNIFORM_VECTORS:case j.MAX_VARYING_VECTORS:return 128;default:return 0}}},zn=class{constructor({nodeId:e,bridgeId:t=M(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.contexts=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=n,this._height=r}get width(){return this._width}set width(e){this._width=e,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:e})}get height(){return this._height}set height(e){this._height=e,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:e})}getContext(e=`2d`,t){let n=String(e).toLowerCase();if(!Tn.has(n)&&!En.has(n))return null;if(this.contexts.has(n))return this.contexts.get(n);let r=I(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:r,contextType:n,attributes:P(t)});let i=En.has(n)?new Rn(this,r,n):new Ln(this,r);return this.contexts.set(n,i),i}createImage(){return new In(this,I(`canvas_image`))}requestAnimationFrame(e){let t=jn++,r=w.store(t=>{n(e)&&e(t)});return N(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){N(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,Mn(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[],N(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e})}};function Bn(e,t=M()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:new zn({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type})}function Vn(e,t=M()){return Array.isArray(e)?e.map(e=>Vn(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:Bn(e.node,t)}:e}function Hn(e={}){let t=Number(e.width)||300,n=Number(e.height)||150,r=e.type||`2d`,i=I(`offscreen_canvas`),a=M();return N(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new zn({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0})}var Un=t({createSelectorQuery:()=>Wn});function Wn(){return new Jn}function Gn(){return D.getPageInfo()}function Kn(){let e=Gn();return e?.__id__||e?.id}function qn(){let e=Gn();return e?.bridgeId||e?.id}var Jn=class{constructor(){this.__componentId=Kn(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new L(this,this.__componentId,e,!0)}selectAll(e){return new L(this,this.__componentId,e,!1)}selectViewport(){return new L(this,Kn(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=qn();O(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=Vn(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},L=class{constructor(e,t,n,r){this.__selectorQuery=e,this.__moduleId=t,this.__selector=n,this.__single=r}fields(e,t){return this.__selectorQuery.__push(this.__selector,this.__moduleId,this.__single,e,t),this.__selectorQuery}boundingClientRect(e){return this.fields({id:!0,dataset:!0,rect:!0,size:!0},e)}context(e){return this.fields({context:!0},e)}node(e){return this.fields({node:!0},e)}scrollOffset(e){return this.fields({id:!0,dataset:!0,scrollOffset:!0},e)}},Yn=t({createIntersectionObserver:()=>Xn});function Xn(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Zn(e,{thresholds:n,initialRatio:r,observeAll:i})}var Zn=class{constructor(e,t){this._component=e,this._options=t,this._relativeInfo=[],this._observerId=null,this._disconnected=!1}relativeTo(e,t={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:e,margins:[`left`,`right`,`top`,`bottom`].map(e=>`${t[e]===void 0?0:t[e]}px`).join(` `)}),this}relativeToViewport(e={left:0,right:0,top:0,bottom:0}){if(this._observerId!==null)throw Error(`Relative nodes cannot be added after "observe" call in IntersectionObserver`);return this._relativeInfo.push({selector:null,margins:[`left`,`right`,`top`,`bottom`].map(t=>`${e[t]===void 0?0:e[t]}px`).join(` `)}),this}observe(e,t){let n=this,r=w.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);O(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){O(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},R=new Map;function z(e){return R.has(e)||R.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),R.get(e)}function B(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return w.store(()=>{r.forEach(t=>t.call(e))})}function Qn(e){let t=z(e);t.depth++}function $n(e){let t=z(e);t.depth>0&&t.depth--,t.depth===0&&er(e)}function V(e,t,n,r){let i=z(e),a=i.byModuleId.get(t);if(a)Object.assign(a.data,n);else{let e={moduleId:t,data:{...n}};i.byModuleId.set(t,e),i.updates.push(e)}r&&i.callbackIds.push(r),i.depth===0&&!i.scheduled&&(i.scheduled=!0,Promise.resolve().then(()=>{i.scheduled=!1,i.depth===0&&er(e)}))}function er(e){let t=R.get(e);if(!t||t.updates.length===0)return;let n=t.updates,r=t.callbackIds;t.updates=[],t.byModuleId=new Map,t.callbackIds=[],t.scheduled=!1,E.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function tr(e){let t=e.__mpxProxy?.options?.computed;if(t)for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e.data,n)||(e.data[n]=null)}function H(e){return i(e)?e:Object.entries(e).reduce((e,[t,r])=>t.startsWith(`$`)?e:n(r)?(console.warn(`[service] 值不支持函数引用`,t),e):(Array.isArray(r)?e[t]=r.map(e=>typeof e==`object`&&e?e instanceof Date?e.getTime():H(e):e):r&&typeof r==`object`&&!Array.isArray(r)?r instanceof Date?e[t]=r.getTime():e[t]=H(r):e[t]=r,e),{})}function nr(e){if(e){let t={};for(let r in e){let i=e[r];t[r]=t[r]||{};let a=i&&typeof i==`object`&&Object.prototype.hasOwnProperty.call(i,`type`)?U(i.type):U(i),o=null;if(o=Array.isArray(a)?[...a]:[a],i&&i.optionalTypes){let e=U(i.optionalTypes);Array.isArray(e)?o=[...e]:o.push(e)}t[r].type=o,t[r].type.length>0&&(i&&n(i.value)?t[r].default=i.value():i&&(t[r].default=i.value))}return t}}var rr=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`],[Function,`f`]]);function U(e){return Array.isArray(e)?e.map(e=>U(e)):e===null||e===``?null:rr.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function ir(e,t,n,r,i){let a=new Set;for(let o of e)for(let e in t){if(a.has(e))continue;let s=e.split(`,`).map(e=>e.trim());if(s.includes(o)){a.add(e);let c=t[e],l=s.map(e=>g(n,e));s.length===1?c.call(r,...l,i[o]):c.call(r,...l);continue}if(e===`**`){a.add(e),t[e].call(r,n);continue}let c=e.split(`.`),l=o.split(`.`),u=!0;for(let e=0;e<c.length&&!(c[e]===`**`||l[e]===void 0);e++)if(c[e]!==l[e]){u=!1;break}if(u&&c.length>1){a.add(e);let s=n;for(let e of c)e!==`**`&&(s=s?.[e]);e===o?t[e].call(r,s,i[o]):t[e].call(r,s)}}}function ar(e,t,n,r,i){for(let a in t){let o=t[a],s=a.split(`,`).map(e=>e.trim());if(s.includes(e)){let t=s.map(e=>g(n,e));s.length===1&&s[0]===e?o.call(r,...t,i):o.call(r,...t);continue}if(a===`**`){o.call(r,n);continue}let c=a.split(`.`),l=e.split(`.`),u=!0;for(let e=0;e<c.length&&!(c[e]===`**`||l[e]===void 0);e++)if(c[e]!==l[e]){u=!1;break}if(u){let t=n;for(let e of c)e!==`**`&&(t=t[e]);a===e?o.call(r,t,i):o.call(r,t);continue}let d=a.match(/^(.+)\[(\d+)\]$/);if(d){let t=d[1],i=Number.parseInt(d[2],10);if(t===e.split(`[`)[0]&&n[t]&&n[t][i]!==void 0){o.call(r,n[t][i]);continue}}if(e.startsWith(a)){let e=a.split(`.`).reduce((e,t)=>e&&e[t],n);if(e!==void 0){o.call(r,e);continue}}}}function or(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,oe(n),se(n),r];for(let t of i)if(t&&e[t]!==void 0)return e[t]}function sr(e,t,n){let r=e.__info__||{};if(r.behaviorObservers)for(let i in r.behaviorObservers){let a=r.behaviorObservers[i];if(!(!Array.isArray(a)||a.length===0))for(let r of t)a.forEach(t=>{ar(r,{[i]:t},e.data,e,n[r])})}}function cr(e,t,n){ur(e,t,n)}function lr(e,t,i){let a=[];for(let o of t){let t=e.__info__.properties?.[o]?.observer,s=e.data[o],c=i[o];r(t)?a.push(()=>e[t]?.(s,c)):n(t)&&a.push(()=>t.call(e,s,c))}return a}function ur(e,t,n){lr(e,t,n).reverse().forEach(e=>e())}function dr(e,t){if(!Array.isArray(t))return;let r=new WeakMap;function i(e,t){let n={...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],a=t[e];r&&typeof r==`object`&&!Array.isArray(r)&&a&&typeof a==`object`&&!Array.isArray(a)?n[e]=i(r,a):n[e]=a}return n}function a(e,t){if(typeof t==`string`){o(e,t);return}if(!t||typeof t!=`object`||r.has(t))return;r.set(t,!0),Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>a(e,t)),t.properties&&(e.properties={...t.properties,...e.properties}),t.data&&(e.data||={},e.data=i(t.data,e.data));let s=[`created`,`attached`,`ready`,`detached`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of s)n(t[r])&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(t[r]));if(t.observers){e.behaviorObservers=e.behaviorObservers||{};for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n])}if(t.methods&&(e.methods={...t.methods,...e.methods}),t.relations&&(e.relations={...e.relations,...t.relations}),t.export&&(e.export=t.export),t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}}function o(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:break;case`wx://form-field-button`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>a(e,t))}function W(e,t,n){let r=e;for(;r&&r.__parentId__;){if(r.__parentId__===t)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}function G(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function fr(e,t){if(!e||!Array.isArray(e.dependencies))return!1;for(let n of e.dependencies){if(n in t)return!0;for(let e of Object.keys(t))if(e.startsWith(n+`.`)||e.startsWith(n+`[`)||n.startsWith(e+`.`)||n.startsWith(e+`[`))return!0}return!1}function pr(e,t){if(!(!e||!e.expression)){if(e.isSimple)return g(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function K(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!W(t,e.__id__,r)||t.__parentId__!==e.__id__)continue;let a=t.__info__?.properties||{},o={};for(let r in a){let i=e.__childPropsBindings__?.[t.__id__]?.[r];i&&fr(i,n)&&(o[r]=pr(i,e.data))}Object.keys(o).length>0&&(t.tO?.(o),t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,o),i.push({child:t,data:o}))}return i}var mr=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],hr=[`show`,`hide`,`resize`,`routeDone`],gr=class{constructor(e,t){this.initd=!1,this.opts=t,t.targetInfo&&(this.id=t.targetInfo.id,this.dataset=t.targetInfo.dataset,this.__targetInfo__=t.targetInfo),this.is=t.path,this.route=t.path,this.query=t.query,this.renderer=`webview`,this.bridgeId=t.bridgeId,this.id||=t.bridgeId,this.behaviors=e.behaviors,this.data=le(e.noReferenceData),Object.defineProperty(this,"properties",{get(){return this.data},enumerable:!0,configurable:!1}),this.__isComponent__=e.isComponent,this.__type__=e.type,this.__id__=this.opts.moduleId,this.__info__=e.moduleInfo,this.__eventAttr__=t.eventAttr,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1}init(){if(this.__isComponent__)for(let e in this.__info__.properties)!Object.prototype.hasOwnProperty.call(this.opts.properties,e)||this.opts.properties[e]===void 0?this.data[e]=this.__info__.properties[e]?.value??null:this.data[e]=this.opts.properties[e];return this.#d(),this.#f(),this.#t(),this.#e(),this.#m().then(()=>{tr(this),E.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}})})}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],V(this.bridgeId,this.__id__,{},B(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(!(!e||typeof e!=`object`))for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}else if(e.startsWith(`../`)){let t=this.is.split(`/`),n=e.split(`/`),r=t.slice(0,-1);for(let e of n)e===`..`?r.pop():e!==`.`&&r.push(e);return r.join(`/`)}else return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(Z.instances[this.bridgeId]||{});for(let[n,r]of Object.entries(e)){let{type:e,target:i}=r,a=this.__relationPaths__.get(n),o=t.filter(e=>i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`)).filter(t=>this.#o(t,e)||this.#a(t,e));for(let e of o)this.#c(n,e,r)}this.#i()}#i(){let e=Object.values(Z.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`);let s=this.#o(e,t),c=this.#a(e,t);o&&(s||c)&&this.#c(n,e,r)}}#a(e,t){if(t!==`descendant`&&t!==`ancestor`)return!1;let n=t===`descendant`?`ancestor`:`descendant`,r=e.__info__?.relations;return r?Object.entries(r).some(([t,r])=>{let i=e.__relationPaths__?.get(t);return r.type===n&&(this.is===i||this.is.endsWith(`/${i}`))}):!1}#o(e,t){let n=Object.values(Z.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#s(e.__id__,this.__id__,n);case`descendant`:return this.#s(this.__id__,e.__id__,n);default:return!1}}#s(e,t,n){let r=n.find(e=>e.__id__===t);for(;r&&r.__parentId__;){if(r.__parentId__===e)return!0;r=n.find(e=>e.__id__===r.__parentId__)}return!1}#c(e,t,r){let i=this.__relations__.get(e)||[];if(!i.includes(t)&&(i.push(t),this.__relations__.set(e,i),n(r.linked)))try{r.linked.call(this,t)}catch(e){console.error(`[service] relation linked error:`,e)}}#l(e,t,r){let i=this.__relations__.get(e)||[],a=i.indexOf(t);if(a!==-1&&(i.splice(a,1),this.__relations__.set(e,i),n(r.unlinked)))try{r.unlinked.call(this,t)}catch(e){console.error(`[service] relation unlinked error:`,e)}}#u(e,t,r){if(n(r.linkChanged))try{r.linkChanged.call(this,t)}catch(e){console.error(`[service] relation linkChanged error:`,e)}}setData(e,t){let r=H(e),i={};for(let e in r)i[e]=this.data[e],ne(this.data,e,r[e]);if(this.__info__.observers&&ir(Object.keys(r),this.__info__.observers,this.data,this,i),sr(this,Object.keys(r),i),cr(this,Object.keys(r),i),!this.initd){n(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}if(this.__groupSetDataMode__){for(let e in r)this.__groupSetDataBuffer__[e]=r[e];n(t)&&this.__groupSetDataCallbacks__.push(t);return}let a=K(this,Z.instances[this.bridgeId],r);V(this.bridgeId,this.__id__,r,B(this,t)),a.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)})}#d(){mr.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&hr.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#f(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#p(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=[];for(let t of Object.keys(this.__info__.properties)){let i=this.__info__.properties[t]?.observer,a=this.data[t];r(i)?e.push(()=>this[i]?.(a,void 0)):n(i)&&e.push(()=>i.call(this,a,void 0))}e.forEach(e=>e()),this.__initialPropertyObserversInvoked__=!0}async#m(){this.__isComponent__?(await this.componentCreated(),await this.componentAttached()):(await this.componentCreated(),await this.componentAttached(),await this.onLoad?.(this.opts.query||{})),this.initd=!0}tO(e){let t={};for(let[n,r]of Object.entries(e)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,n)&&a(this.__pendingSyncedProps__[n],r)){this.data[n]=r,delete this.__pendingSyncedProps__[n];continue}t[n]=r}if(Object.keys(t).length===0)return;let n=[],r={};for(let[e,i]of Object.entries(t)){let t=this.data[e];r[e]=t,this.data[e]=i,this.__info__.observers&&n.push(()=>ar(e,this.__info__.observers,this.data,this,t))}n.forEach(e=>e()),sr(this,Object.keys(t),Object.fromEntries(Object.keys(t).map(e=>[e,void 0]))),ur(this,Object.keys(t),r)}getPageId(){return this.__id__}hasBehavior(e){let t=function(n){if(!Array.isArray(n))return!1;if(n.includes(e))return!0;for(let e of n)if(e&&e.behaviors&&t(e.behaviors))return!0;return!1};return t(this.behaviors)}createSelectorQuery(){return Wn().in(this)}selectComponent(e){let t=Object.values(Z.instances[this.bridgeId]),n=t.find(n=>W(n,this.__id__,t)&&G(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Z.instances[this.bridgeId]);return t.filter(n=>W(n,this.__id__,t)&&G(e,n))}selectOwnerComponent(){let e=Object.values(Z.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Xn(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Qn(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];try{e.call(this)}catch(e){console.error(`[service] groupSetData callback error:`,e)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__;this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];let n=K(this,Z.instances[this.bridgeId],e);V(this.bridgeId,this.__id__,e,B(this,t)),n.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];$n(this.bridgeId)}}createMediaQueryObserver(){console.warn(`[service] 暂不支持 createMediaQueryObserver`)}getRelationNodes(e){return e?[...this.__relations__.get(e)||[]]:(console.warn(`[service] getRelationNodes 需要传入关系路径参数`),[])}animate(){console.warn(`[service] 暂不支持 animate`)}clearAnimation(){console.warn(`[service] 暂不支持 clearAnimation`)}async triggerEvent(e,t,n={}){if(!e)return;let r=e.trim(),i=or(this.__eventAttr__,r);i&&await Z.triggerEvent({bridgeId:this.bridgeId,moduleId:this.__pageId__,methodName:i,event:{type:r,detail:t,currentTarget:{id:this.id,dataset:this.dataset},target:{id:this.id,dataset:this.dataset}}}),n.bubbles&&await Z.instances[this.bridgeId][this.__parentId__]?.triggerEvent(e,t),n.composed,n.capturePhase}pageReady(){this.__isComponent__||this.ready?.()}pageUnload(){this.__isComponent__||this.onUnload?.()}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;this.onPageScroll?.({scrollTop:t})}}pageShow(){this.__info__.behaviorPageLifetimes?.show?.forEach(e=>e.call(this)),this.onShow?.()}pageHide(){this.__info__.behaviorPageLifetimes?.hide?.forEach(e=>e.call(this)),this.onHide?.()}pageResize(e){this.__info__.behaviorPageLifetimes?.resize?.forEach(t=>t.call(this,e)),this.resize?.(e)}componentRouteDone(){this.__info__.behaviorPageLifetimes?.routeDone?.forEach(e=>e.call(this)),this.routeDone?.()}async componentCreated(){this.__info__.behaviorLifetimes?.created?.forEach(e=>e.call(this)),await this.created?.()}async componentAttached(){this.__info__.behaviorLifetimes?.attached?.forEach(e=>e.call(this)),await this.attached?.(),this.#r()}componentReadied(){this.#p(),this.__info__.behaviorLifetimes?.ready?.forEach(e=>e.call(this)),this.ready?.()}componentMoved(){this.moved?.();let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=this.__relations__.get(t)||[];for(let r of e)this.#u(t,r,n)}}componentDetached(){let e=this.__info__.relations;if(e)for(let[t,n]of Object.entries(e)){let e=[...this.__relations__.get(t)||[]];for(let r of e)this.#l(t,r,n)}this.#h(),this.__info__.behaviorLifetimes?.detached?.forEach(e=>e.call(this)),this.detached?.(),this.initd=!1}#h(){let e=Object.values(Z.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,r]of t.__relations__.entries()){let i=r.indexOf(this);if(i!==-1){r.splice(i,1),t.__relations__.set(e,r);let a=t.__info__.relations?.[e];if(a&&n(a.unlinked))try{a.unlinked.call(t,this)}catch(e){console.error(`[service] relation unlinked error:`,e)}}}}componentError(e){this.error?.(e)}},q=class e{static type=`component`;constructor(t,n){this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.isComponent=this.extraInfo.component,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,dr(this.moduleInfo,this.behaviors),this.noReferenceData=H(this.moduleInfo.data||{})}getProps(){let e=nr(this.moduleInfo.properties);if(Array.isArray(this.moduleInfo.externalClasses)&&this.moduleInfo.externalClasses.length>0){e||={};for(let t of this.moduleInfo.externalClasses)e[t]={type:[`s`],cls:!0}}return e}},_r=class{constructor(e,t){this.initd=!1,this.opts=t,this.is=t.path,this.route=t.path,this.bridgeId=t.bridgeId,this.id=t.bridgeId,this.query=t.query,this.data=le(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init(){return this.#e(),this.#t().then(()=>{tr(this),E.send({type:this.__id__,target:`render`,body:{bridgeId:this.bridgeId,path:this.is,data:this.data}})})}flushInitSetDataCallbacks(){if(this.__pendingInitSetDataCallbacks__.length===0)return;let e=this.__pendingInitSetDataCallbacks__;this.__pendingInitSetDataCallbacks__=[],V(this.bridgeId,this.__id__,{},B(this,e))}setData(e,t){let r=H(e),i={},a=this.__info__||{};for(let e in r)i[e]=this.data[e],ne(this.data,e,r[e]);if(a.observers&&ir(Object.keys(r),a.observers,this.data,this,i),sr(this,Object.keys(r),i),!this.initd){n(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}let o=K(this,Z.instances[this.bridgeId],r);V(this.bridgeId,this.__id__,r,B(this,t)),o.forEach(({child:e,data:t})=>{V(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Wn().in(this)}selectComponent(e){let t=Object.values(Z.instances[this.bridgeId]||{}),n=t.find(n=>W(n,this.__id__,t)&&G(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Z.instances[this.bridgeId]||{});return t.filter(n=>W(n,this.__id__,t)&&G(e,n)).map(e=>e.hasBehavior&&e.hasBehavior(`wx://component-export`)&&e.export?e.export():e)}#e(){for(let e in this.__info__){let t=this.__info__[e];n(t)?this[e]=t.bind(this):this[e]=t}}async#t(){this.__info__.behaviorLifetimes?.created?.forEach(e=>e.call(this)),await this.created?.(),this.__info__.behaviorLifetimes?.attached?.forEach(e=>e.call(this)),await this.attached?.(),await this.onLoad?.(this.opts.query||{}),this.initd=!0}pageShow(){this.__info__.behaviorPageLifetimes?.show?.forEach(e=>e.call(this)),this.onShow?.()}pageHide(){this.__info__.behaviorPageLifetimes?.hide?.forEach(e=>e.call(this)),this.onHide?.()}pageReady(){this.__info__.behaviorLifetimes?.ready?.forEach(e=>e.call(this)),this.ready?.(),this.onReady?.()}pageUnload(){this.__info__.behaviorLifetimes?.detached?.forEach(e=>e.call(this)),this.detached?.(),this.onUnload?.(),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;this.onPageScroll?.({scrollTop:t})}pageResize(e){this.__info__.behaviorPageLifetimes?.resize?.forEach(t=>t.call(this,e)),this.onResize?.(e)}},J=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,dr(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=H(this.moduleInfo.data||{})}},Y=class{static type=`app`;constructor(e){this.moduleInfo=e}},X=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a}=e;if(v&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}D.setInitId(n),C(`app`),C(r),E.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n}})}createAppModule(e){let t=new Y(e);this.staticModules[Y.type]=t}createModule(e,t,n){let{path:r,usingComponents:i}=t;if(!this.staticModules[r]){if(i)for(let e of Object.values(i))C(e);if(n===J.type){let n=new J(e,t);this.staticModules[r]=n}else if(n===q.type){let n=new q(e,t);this.staticModules[r]=n}else console.error(`[service] createModule ${n} error`)}}getPropsByPath(e){let t={};return this.getComponentProps(t,e),t}getComponentProps(e,t){if(t)for(let n of Object.values(t)){let t=this.staticModules[n];!t||e[n]||(e[n]=t.getProps(),this.getComponentProps(e,t.usingComponents))}}getAppModule(){return this.staticModules[Y.type]}getModuleByPath(e){return this.staticModules[e]}},Z=new class{constructor(){this.app=null,this.instances={}}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i]))return await e[i](a);console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e){if(this.app){console.log(`[service] app instance already existed`);return}let{scene:t,pagePath:n,query:r}=e,i=X.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),this.app=new wn(i,{scene:t,path:n,query:r})}appShow(){this.app?.appShow()}appHide(){this.app?.appHide()}stackShow(e){D.pushStack(e)}stackHide(e){D.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,targetInfo:l,stackId:u}=e,d=X.getModuleByPath(r);if(!d){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},d.type===q.type){let e=new gr(d,{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,targetInfo:l});return this.instances[t][n]=e,d.isComponent||D.push(e,u),e.init(),e}else if(d.type===J.type){let e=new _r(d,{bridgeId:t,moduleId:n,path:r,query:i});return this.instances[t][n]=e,D.push(e,u),e.init(),e}else console.error(`[service] ${d.type} instance is not exist.`)}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r}=e,i=this.instances[t][n];if(i){if(r&&i.__parentId__){let e=this.instances[t]?.[i.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(i.__type__===q.type){i.componentReadied(),i.__componentReadied__=!0,this.flushPendingEvents(i),i.flushInitSetDataCallbacks?.();let e=this.getPageInstance(t);e&&this.checkAndCallPageReady(t,e.__id__)}}}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&(r.__type__===q.type&&r.componentDetached(),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.instances[t];if(!n)return;let r=[];Object.values(n).forEach(e=>{e&&(e.__type__===J.type?r.push(e):e.__type__===q.type&&(e.__isComponent__?e.pageShow():r.push(e)))}),r.forEach(e=>{e.pageShow()})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&(this.pageShow(e),r.__pageReadyPending__=!0,r.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===J.type||e.__type__===q.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.instances[e][t];if(!n||!n.__pageReadyPending__)return;let r=this.instances[e];if(!r){n.__pageReadyPending__=!1,n.pageReady();return}Object.values(r).filter(e=>e&&e.__type__===q.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(n.__pageReadyPending__=!1,n.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.instances[t],r=[];Object.values(n).forEach(e=>{e&&(e.__type__===J.type?r.push(e):e.__type__===q.type&&(e.__isComponent__?e.pageHide():r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e,n=this.instances[t];n&&(Object.values(n).forEach(e=>{e&&(e.__type__===q.type&&e.componentDetached(),e.pageUnload())}),D.pop(),delete this.instances[t])}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t][n];i&&i.pageScrollTop({scrollTop:r})}pageResize(e){let{bridgeId:t,size:n}=e,r=this.instances[t];r&&Object.values(r).forEach(e=>{e&&(e.__type__===J.type?e.pageResize(n):e.__type__===q.type&&(e.__isComponent__,e.pageResize(n)))})}componentError(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&r.__type__===q.type&&r.componentError()}componentRouteDone(e){let{bridgeId:t}=e,n=this.instances[t];n&&Object.values(n).forEach(e=>{e?.__type__===q.type&&e.componentRouteDone()})}async triggerEvent(e){let{bridgeId:t,moduleId:n,methodName:r,event:i}=e;if(r===void 0)return;let a=this.instances[t];if(!a){console.warn(`[service] No instances found for bridgeId: ${t}`);return}let o=a[n];if(!o){console.warn(`[service] triggerEvent ${t} ${n} ${r}, instance is not exist`);return}return o.__type__===q.type&&o.__isComponent__&&!o.__componentReadied__?this.queuePendingEvent(o,{instance:o,bridgeId:t,moduleId:n,methodName:r,event:i}):this.dispatchEvent({instance:o,bridgeId:t,moduleId:n,methodName:r,event:i})}},vr=t({getEnterOptionsSync:()=>br,getLaunchOptionsSync:()=>yr});function yr(){return Z.app?.options}function br(){return Z.app?.options}var xr=t({getLocation:()=>Sr,offLocationChange:()=>Dr,onLocationChange:()=>Er,openLocation:()=>wr,startLocationUpdate:()=>Cr,stopLocationUpdate:()=>Tr});function Sr(e){return O(`getLocation`,e)}function Cr(e){return O(`startLocationUpdate`,e)}function wr(e){return O(`openLocation`,e)}function Tr(e){return O(`stopLocationUpdate`,e)}function Er(e){e&&O(`onLocationChange`,{success:w.store(e,!0)})}function Dr(e){if(e){let t=w.store(e,!0);O(`offLocationChange`,{success:t}),w.remove(t)}else O(`offLocationChange`),w.remove()}var Or=t({createMapContext:()=>kr});function kr(e,t){return new Ar({mapId:e,obj:t})}var Ar=class{constructor(e){this.opts=e}addMarkers(e){return O(`addMarkers`,e)}removeMarkers(e){return O(`removeMarkers`,e)}includePoints(e){return O(`includePoints`,e)}setCenterOffset(e){return O(`setCenterOffset`,e)}getCenterLocation(e){return O(`getCenterLocation`,e)}getScale(e){return O(`getScale`,e)}moveToLocation(e){return O(`moveToLocation`,e)}translateMarker(e){return O(`translateMarker`,e)}addArc(e){return O(`addArc`,e)}removeArc(e){return O(`removeArc`,e)}},jr=t({createInnerAudioContext:()=>Pr}),Mr=1,Nr=class{constructor(){this._audioId=Mr++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},O(`audioCreate`,{audioId:this._audioId}),O(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,O(`audioSetProp`,{audioId:this._audioId,prop:`src`,value:e,startTime:this._startTime,loop:this._loop,volume:this._volume,playbackRate:this._playbackRate,autoplay:this._autoplay})}get startTime(){return this._startTime}set startTime(e){this._startTime=Number(e)||0,O(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,O(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,O(`audioSetProp`,{audioId:this._audioId,prop:`loop`,value:this._loop})}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),O(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,O(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,O(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,O(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,O(`audioStop`,{audioId:this._audioId})}seek(e){O(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){O(`audioDestroy`,{audioId:this._audioId}),this._listeners={}}_on(e,t){typeof t==`function`&&(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t))}_off(e,t){this._listeners[e]&&(t?this._listeners[e]=this._listeners[e].filter(e=>e!==t):this._listeners[e]=[])}onPlay(e){this._on(`play`,e)}onPause(e){this._on(`pause`,e)}onStop(e){this._on(`stop`,e)}onEnded(e){this._on(`ended`,e)}onError(e){this._on(`error`,e)}onTimeUpdate(e){this._on(`timeUpdate`,e)}onWaiting(e){this._on(`waiting`,e)}onSeeking(e){this._on(`seeking`,e)}onSeeked(e){this._on(`seeked`,e)}onCanplay(e){this._on(`canplay`,e)}offPlay(e){this._off(`play`,e)}offPause(e){this._off(`pause`,e)}offStop(e){this._off(`stop`,e)}offEnded(e){this._off(`ended`,e)}offError(e){this._off(`error`,e)}offTimeUpdate(e){this._off(`timeUpdate`,e)}offWaiting(e){this._off(`waiting`,e)}offSeeking(e){this._off(`seeking`,e)}offSeeked(e){this._off(`seeked`,e)}offCanplay(e){this._off(`canplay`,e)}};function Pr(){return new Nr}var Fr=t({chooseImage:()=>zr,compressImage:()=>Rr,previewImage:()=>Lr,saveImageToPhotosAlbum:()=>Ir});function Ir(e){return O(`saveImageToPhotosAlbum`,e)}function Lr(e){return O(`previewImage`,e)}function Rr(e){return O(`compressImage`,e)}function zr(e){return O(`chooseImage`,e)}var Br=t({chooseMedia:()=>Ur,chooseVideo:()=>Hr,createVideoContext:()=>Vr});function Vr(e,t){return new Wr({videoId:e,obj:t})}function Hr(e){return O(`chooseVideo`,e)}function Ur(e){return O(`chooseMedia`,e)}var Wr=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){O(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Gr=t({exitMiniProgram:()=>Yr,navigateBackMiniProgram:()=>Jr,navigateToMiniProgram:()=>qr,restartMiniProgram:()=>Kr});function Kr(e){return O(`restartMiniProgram`,e)}function qr(e){return O(`navigateToMiniProgram`,e)}function Jr(e){return O(`navigateBackMiniProgram`,e)}function Yr(e){return O(`exitMiniProgram`,e)}var Xr=t({downloadFile:()=>Zr});function Zr(e){return O(`downloadFile`,e)}var Qr=t({request:()=>$r});function $r(e){return O(`request`,e)}var ei=t({uploadFile:()=>ii}),ti=1;function ni(){return`upload_${Date.now()}_${ti++}`}function ri(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function ii(e={}){let t=ni(),n=ri(),r=ri(),i=w.store(e=>n.dispatch(e),!0,`${t}_progress`),a=w.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,w.remove(i),w.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{O(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||O(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var ai=t({closeSocket:()=>ci,connectSocket:()=>oi,onSocketClose:()=>fi,onSocketError:()=>di,onSocketMessage:()=>ui,onSocketOpen:()=>li,sendSocketMessage:()=>si}),Q=class{constructor(e){this.socketId=e,this._readyState=0}send(e={}){let{data:t,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,data:t,...o};return n(r)&&(s.success=w.store(r)),n(i)&&(s.fail=w.store(i)),n(a)&&(s.complete=w.store(a)),O(`sendSocketMessage`,s)}close(e={}){let{code:t=1e3,reason:r=``,success:i,fail:a,complete:o,...s}=e,c={socketId:this.socketId,code:t,reason:r,...s};return n(i)&&(c.success=w.store(i)),n(a)&&(c.fail=w.store(a)),n(o)&&(c.complete=w.store(o)),O(`closeSocket`,c)}onOpen(e){if(n(e))return O(`onSocketOpen`,{socketId:this.socketId,callback:w.store(e,!0)})}offOpen(e){return O(`offSocketOpen`,{socketId:this.socketId,callback:e})}onMessage(e){if(n(e))return O(`onSocketMessage`,{socketId:this.socketId,callback:w.store(e,!0)})}offMessage(e){return O(`offSocketMessage`,{socketId:this.socketId,callback:e})}onError(e){if(n(e))return O(`onSocketError`,{socketId:this.socketId,callback:w.store(e,!0)})}offError(e){return O(`offSocketError`,{socketId:this.socketId,callback:e})}onClose(e){if(n(e))return O(`onSocketClose`,{socketId:this.socketId,callback:w.store(e,!0)})}offClose(e){return O(`offSocketClose`,{socketId:this.socketId,callback:e})}get readyState(){return this._readyState}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}};function oi(e={}){let{url:t,header:r={},protocols:i=[],tcpNoDelay:a=!1,perMessageDeflate:o=!1,timeout:s,forceCellularNetwork:c=!1,success:l,fail:u,complete:d,...f}=e;if(!t){let e=Error(`url is required`);throw n(u)&&u(e),n(d)&&d(e),e}let p=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,m=new Q(p),h={socketId:p,url:t,header:r,protocols:i,tcpNoDelay:a,perMessageDeflate:o,timeout:s,forceCellularNetwork:c,...f};return n(l)&&(h.success=w.store(e=>{m._readyState=Q.OPEN,l(e)})),n(u)&&(h.fail=w.store(e=>{m._readyState=Q.CLOSED,u(e)})),n(d)&&(h.complete=w.store(d)),O(`connectSocket`,h),m}function si(e){return O(`sendSocketMessage`,e)}function ci(e){return O(`closeSocket`,e)}function li(e){return O(`onSocketOpen`,{callback:w.store(e,!0)})}function ui(e){return O(`onSocketMessage`,{callback:w.store(e,!0)})}function di(e){return O(`onSocketError`,{callback:w.store(e,!0)})}function fi(e){return O(`onSocketClose`,{callback:w.store(e,!0)})}var pi=t({getAccountInfoSync:()=>mi});function mi(){return O(`getAccountInfoSync`)}var hi=t({authorize:()=>gi});function gi(e){return O(`authorize`,e)}var _i=t({login:()=>vi});function vi(e){return O(`login`,e)}var yi=t({login:()=>bi});function bi(e){return O(`login`,e)}var xi=t({getPrivacySetting:()=>Si});function Si(e){return O(`getPrivacySetting`,e)}var Ci=t({getSetting:()=>Ti,openSetting:()=>wi});function wi(e){return O(`openSetting`,e)}function Ti(e){return O(`getSetting`,e)}var Ei=t({getUserInfo:()=>Di});function Di(e){return O(`getUserInfo`,e)}var Oi=t({requestPayment:()=>ki});function ki(e){return O(`requestPayment`,e)}var Ai=t({hideShareMenu:()=>Ni,showShareImageMenu:()=>Mi,showShareMenu:()=>ji});function ji(e){return O(`shareShareMenu`,e)}function Mi(e){return O(`showShareImageMenu`,e)}function Ni(e){return O(`hideShareMenu`,e)}var Pi=t({clearStorage:()=>Hi,clearStorageSync:()=>Ri,getStorage:()=>Bi,getStorageInfo:()=>Wi,getStorageInfoSync:()=>Ui,getStorageSync:()=>Ii,removeStorage:()=>Vi,removeStorageSync:()=>Li,setStorage:()=>zi,setStorageSync:()=>Fi});function Fi(...e){return O(`setStorageSync`,e)}function Ii(e){return O(`getStorageSync`,e)}function Li(e){return O(`removeStorageSync`,e)}function Ri(){return O(`clearStorageSync`)}function zi(e){return O(`setStorage`,e)}function Bi(e){return O(`getStorage`,e)}function Vi(e){return O(`removeStorage`,e)}function Hi(){return O(`clearStorage`)}function Ui(){return O(`getStorageInfoSync`)}function Wi(e){return O(`getStorageInfo`,e)}var Gi=t({createAnimation:()=>Ki});function Ki(e={}){return new qi(e)}var qi=class{constructor({duration:e=400,timingFunction:t=`linear`,delay:n=0,transformOrigin:r=`50% 50% 0`}={}){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option={transition:{duration:e,timingFunction:t,delay:n},transformOrigin:r}}export(){let e=this.actions;return this.actions=[],{actions:e}}step(e={}){for(let e of this.currentStepAnimates)e.type===`style`?this.currentTransform[`${e.type}.${e.args[0]}`]=e:this.currentTransform[e.type]=e;return this.actions.push({animates:Object.keys(this.currentTransform).reduce((e,t)=>[].concat(...e,[this.currentTransform[t]]),[]),option:{transformOrigin:e.transformOrigin===void 0?this.option.transformOrigin:e.transformOrigin,transition:{duration:e.duration===void 0?this.option.transition.duration:e.duration,timingFunction:e.timingFunction===void 0?this.option.transition.timingFunction:e.timingFunction,delay:e.delay===void 0?this.option.transition.delay:e.delay}}}),this.currentStepAnimates=[],this}backgroundColor(e){return this.currentStepAnimates.push({type:`style`,args:[`background-color`,e]}),this}bottom(e){return this.currentStepAnimates.push({type:`style`,args:[`bottom`,b(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,b(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,b(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,b(e)]}),this}rotate(e=0){return this.currentStepAnimates.push({type:`rotate`,args:[e]}),this}rotate3d(e=0,t=0,n=0,r=0){return this.currentStepAnimates.push({type:`rotate3d`,args:[e,t,n,r]}),this}rotateX(e){return this.currentStepAnimates.push({type:`rotateX`,args:[e]}),this}rotateY(e){return this.currentStepAnimates.push({type:`rotateY`,args:[e]}),this}rotateZ(e){return this.currentStepAnimates.push({type:`rotateZ`,args:[e]}),this}scale(e=1,t=1){return this.currentStepAnimates.push({type:`scale`,args:[e,t]}),this}scale3d(e=1,t=1,n=1){return this.currentStepAnimates.push({type:`scale3d`,args:[e,t,n]}),this}scaleX(e=1){return this.currentStepAnimates.push({type:`scaleX`,args:[e]}),this}scaleY(e=1){return this.currentStepAnimates.push({type:`scaleY`,args:[e]}),this}scaleZ(e=1){return this.currentStepAnimates.push({type:`scaleZ`,args:[e]}),this}skew(e=0,t=0){return this.currentStepAnimates.push({type:`skew`,args:[e,t]}),this}skewX(e=0){return this.currentStepAnimates.push({type:`skewX`,args:[e]}),this}skewY(e=0){return this.currentStepAnimates.push({type:`skewY`,args:[e]}),this}top(e){return this.currentStepAnimates.push({type:`style`,args:[`top`,b(e)]}),this}translate(e=0,t=0){return this.currentStepAnimates.push({type:`translate`,args:[e,t]}),this}translate3d(e=0,t=0,n=0){return this.currentStepAnimates.push({type:`translate3d`,args:[e,t,n]}),this}translateX(e=0){return this.currentStepAnimates.push({type:`translateX`,args:[e]}),this}translateY(e=0){return this.currentStepAnimates.push({type:`translateY`,args:[e]}),this}width(e){return this.currentStepAnimates.push({type:`style`,args:[`width`,b(e)]}),this}},Ji=t({setBackgroundColor:()=>Xi,setBackgroundTextStyle:()=>Yi});function Yi(e){return O(`setBackgroundTextStyle`,e)}function Xi(e){return O(`setBackgroundColor`,e)}var Zi=t({canvasToTempFilePath:()=>ta,createCanvasContext:()=>$i,createContext:()=>Qi,createOffscreenCanvas:()=>Hn,drawCanvas:()=>ea});function Qi(){return new ra}function $i(e,t){return new ra(e,na(t))}function ea(e={}){let t={...e,moduleId:e.moduleId||na(e.component)};delete t.component,O(`drawCanvas`,t,`render`)}function ta(e={},t){let n={...e,moduleId:e.moduleId||na(t||e.component)};return delete n.component,O(`canvasToTempFilePath`,n,`render`)}function na(e){return e?.__id__||D.getPageInfo()?.id}var ra=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[]}pushAction(e,...t){return this.actions.push({type:e,args:t}),this}getActions(){return this.actions.slice()}draw(e=!1,t){this.canvasId&&(ea({canvasId:this.canvasId,moduleId:this.moduleId,actions:this.getActions(),reserve:e,success:t}),this.actions=[])}beginPath(){return this.pushAction(`beginPath`)}closePath(){return this.pushAction(`closePath`)}moveTo(e,t){return this.pushAction(`moveTo`,e,t)}lineTo(e,t){return this.pushAction(`lineTo`,e,t)}rect(e,t,n,r){return this.pushAction(`rect`,e,t,n,r)}arc(e,t,n,r,i,a=!1){return this.pushAction(`arc`,e,t,n,r,i,a)}quadraticCurveTo(e,t,n,r){return this.pushAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushAction(`bezierCurveTo`,e,t,n,r,i,a)}fill(){return this.pushAction(`fill`)}stroke(){return this.pushAction(`stroke`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillText(e,t,n,r){return this.pushAction(`fillText`,e,t,n,r)}drawImage(e,...t){return this.pushAction(`drawImage`,e,...t)}save(){return this.pushAction(`save`)}restore(){return this.pushAction(`restore`)}translate(e,t){return this.pushAction(`translate`,e,t)}rotate(e){return this.pushAction(`rotate`,e)}scale(e,t){return this.pushAction(`scale`,e,t)}setShadow(e,t,n,r){return this.pushAction(`setShadow`,e,t,n,r)}setFillStyle(e){return this.pushAction(`setFillStyle`,e)}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,e)}setGlobalAlpha(e){return this.pushAction(`setGlobalAlpha`,e)}setLineCap(e){return this.pushAction(`setLineCap`,e)}setLineJoin(e){return this.pushAction(`setLineJoin`,e)}setLineWidth(e){return this.pushAction(`setLineWidth`,e)}setMiterLimit(e){return this.pushAction(`setMiterLimit`,e)}setFontSize(e){return this.pushAction(`setFontSize`,e)}},ia=t({nextTick:()=>ca}),aa=[],oa=null;function sa(){let e=aa;aa=[],oa=null;for(let t=0;t<e.length;t++)e[t]()}function ca(e){n(e)&&(aa.push(e),oa||=setTimeout(sa,0))}var la=t({disableAlertBeforeUnload:()=>_a,enableAlertBeforeUnload:()=>ga,hideLoading:()=>ha,hideToast:()=>da,showActionSheet:()=>ma,showLoading:()=>pa,showModal:()=>fa,showToast:()=>ua});function ua(e){return O(`showToast`,e)}function da(e){return O(`hideToast`,e)}function fa(e){return O(`showModal`,e)}function pa(e){return O(`showLoading`,e)}function ma(e){return O(`showActionSheet`,e)}function ha(e){return O(`hideLoading`,e)}function ga(e){return O(`enableAlertBeforeUnload`,e)}function _a(e){return O(`disableAlertBeforeUnload`,e)}var va=t({getMenuButtonBoundingClientRect:()=>ba,offMenuButtonBoundingClientRectWeightChange:()=>Sa,onMenuButtonBoundingClientRectWeightChange:()=>xa}),ya=new Set;function ba(){return O(`getMenuButtonBoundingClientRect`)}function xa(e){n(e)&&ya.add(e)}function Sa(e){n(e)?ya.delete(e):ya.clear()}var Ca=t({hideNavigationBarLoading:()=>Da,setNavigationBarColor:()=>Ea,setNavigationBarTitle:()=>Ta,showNavigationBarLoading:()=>wa});function wa(e){return O(`showNavigationBarLoading`,e)}function Ta(e){return O(`setNavigationBarTitle`,e)}function Ea(e){return O(`setNavigationBarColor`,e)}function Da(e){return O(`hideNavigationBarLoading`,e)}var Oa=t({startPullDownRefresh:()=>Aa,stopPullDownRefresh:()=>ka});function ka(e){return O(`stopPullDownRefresh`,e)}function Aa(e){return O(`startPullDownRefresh`,e)}var ja=t({pageScrollTo:()=>Ma});function Ma(e){return O(`pageScrollTo`,e)}var Na=t({hideTabBar:()=>La,hideTabBarRedDot:()=>Va,removeTabBarBadge:()=>za,setTabBarBadge:()=>Ra,setTabBarItem:()=>Fa,setTabBarStyle:()=>Pa,showTabBar:()=>Ia,showTabBarRedDot:()=>Ba});function Pa(e){return O(`setTabBarStyle`,e)}function Fa(e){return O(`setTabBarItem`,e)}function Ia(e){return O(`showTabBar`,e)}function La(e){return O(`hideTabBar`,e)}function Ra(e){return O(`setTabBarBadge`,e)}function za(e){return O(`removeTabBarBadge`,e)}function Ba(e){return O(`showTabBarRedDot`,e)}function Va(e){return O(`hideTabBarRedDot`,e)}var Ha=t({onWindowResize:()=>Ua});function Ua(e){e&&O(`onWindowResize`,{success:e})}var Wa=Object.assign({"./core/base/app-event/index.js":Ee,"./core/base/index.js":Ie,"./core/base/performance/index.js":Be,"./core/base/subpackage/index.js":Ge,"./core/base/system/index.js":Je,"./core/base/update/index.js":rt,"./core/camera/index.js":dt,"./core/data-analysis/index.js":mt,"./core/device/bluetooth/index.js":_t,"./core/device/bluetooth-ble/index.js":kt,"./core/device/clipboard/index.js":Ut,"./core/device/contact/index.js":Kt,"./core/device/keyboard/index.js":Yt,"./core/device/memory/index.js":Zt,"./core/device/network/index.js":en,"./core/device/phone/index.js":nn,"./core/device/scan/index.js":an,"./core/device/vibrate/index.js":sn,"./core/ext/index.js":un,"./core/file/index.js":gn,"./core/life-cycle/index.js":vr,"./core/location/index.js":xr,"./core/map/index.js":Or,"./core/media/audio/index.js":jr,"./core/media/image/index.js":Fr,"./core/media/video/index.js":Br,"./core/navigate/index.js":Gr,"./core/network/download/index.js":Xr,"./core/network/request/index.js":Qr,"./core/network/upload/index.js":ei,"./core/network/websocket/index.js":ai,"./core/open-api/account-info/index.js":pi,"./core/open-api/authorize/index.js":hi,"./core/open-api/index.js":_i,"./core/open-api/login/index.js":yi,"./core/open-api/privacy/index.js":xi,"./core/open-api/setting/index.js":Ci,"./core/open-api/user-info/index.js":Ei,"./core/payment/index.js":Oi,"./core/route/index.js":be,"./core/share/index.js":Ai,"./core/storage/index.js":Pi,"./core/ui/animation/index.js":Gi,"./core/ui/background/index.js":Ji,"./core/ui/canvas/index.js":Zi,"./core/ui/custom-component/index.js":ia,"./core/ui/interaction/index.js":la,"./core/ui/menu/index.js":va,"./core/ui/navigation-bar/index.js":Ca,"./core/ui/pull-down-refresh/index.js":Oa,"./core/ui/scroll/index.js":ja,"./core/ui/tab-bar/index.js":Na,"./core/ui/window/index.js":Ha,"./core/wxml/intersection-observer/index.js":Yn,"./core/wxml/selector-query/index.js":Un}),$={};for(let e of Object.values(Wa))for(let[t,n]of Object.entries(e))$[t]=n;function Ga(e){for(let t of e||[])typeof t!=`string`||Object.prototype.hasOwnProperty.call($,t)||t in Object.prototype||Object.defineProperty($,t,{value:(...e)=>O(t,...e),writable:!0,enumerable:!0,configurable:!0})}var Ka=new Proxy($,{get(e,t,n){let r=Reflect.get(e,t,n);return typeof r==`function`||r!==void 0||t===`webpackJsonp`?r:(...e)=>O(t,...e)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),qa=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}Ga(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=Ka;globalThis.modRequire=C,globalThis.modDefine=de,globalThis.global={},globalThis.App=e=>X.createAppModule(e),globalThis.Page=e=>{X.createModule(e,globalThis.__extraInfo,J.type)},globalThis.Component=e=>{X.createModule(e,globalThis.__extraInfo,q.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>{let t=Z.app;return!t&&e?.allowDefault?{}:t},globalThis.getCurrentPages=()=>D.stack()}},Ja={navigateBack:Te,navigateTo:we,reLaunch:Se,redirectTo:Ce,switchTab:xe};return new class{constructor(){console.log(`[service] init`),this.env=qa,this.message=E,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o}=e;o&&T.init(o),X.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a})}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await Z.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;w.invoke(t,n)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,scene:n,pagePath:r,query:i,stackId:a}=e;Z.createApp({scene:n,pagePath:r,query:i});let o=X.getModuleByPath(r);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${r}`);return}let s=X.getPropsByPath(o.usingComponents),c=`page_${ae()}`;Z.createInstance({bridgeId:t,moduleId:c,path:r,query:i,stackId:a}),E.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:c,pagePath:r,initialProps:s,query:i}})}),this.message.on(`appShow`,()=>{Z.appShow()}),this.message.on(`appHide`,()=>{Z.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Z.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Z.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Z.createInstance(e)}),this.message.on(`mR`,e=>{Z.moduleReady(e)}),this.message.on(`mU`,e=>{Z.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Z.pageUnload(e)}),this.message.on(`pageShow`,e=>{Z.pageShow(e)}),this.message.on(`pageReady`,e=>{Z.pageReady(e)}),this.message.on(`pageHide`,e=>{Z.pageHide(e)}),this.message.on(`pagePullDownRefresh`,()=>{}),this.message.on(`pageReachBottom`,()=>{}),this.message.on(`pageShareAppMessage`,()=>{}),this.message.on(`pageScroll`,e=>{Z.pageScroll(e)}),this.message.on(`pageResize`,e=>{Z.pageResize(e)}),this.message.on(`onTabItemTap`,()=>{}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Z.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Z.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await Z.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}Ja[t]?.({url:n,...e.params})})}}})();
|
package/dist/preload/index.d.ts
CHANGED
|
@@ -18,5 +18,7 @@ export type { MiniappSnapshotHost, MiniappSnapshotSource, SnapshotEnvelope, Snap
|
|
|
18
18
|
export { installSimulatorBridge } from './runtime/bridge.js';
|
|
19
19
|
export { installCustomApisBridge } from './runtime/custom-apis.js';
|
|
20
20
|
export type { DiminaCustomApisBridge } from './runtime/custom-apis.js';
|
|
21
|
+
export { installNativeHostBridge } from './runtime/native-host.js';
|
|
22
|
+
export type { DiminaNativeHostBridge } from './runtime/native-host.js';
|
|
21
23
|
export { setupApiCompatHook } from './shared/api-compat.js';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/preload/index.js
CHANGED
|
@@ -15,5 +15,11 @@ export { createWxmlSource } from './instrumentation/wxml.js';
|
|
|
15
15
|
export { createMiniappSnapshotHost } from './miniapp-snapshot/host.js';
|
|
16
16
|
export { installSimulatorBridge } from './runtime/bridge.js';
|
|
17
17
|
export { installCustomApisBridge } from './runtime/custom-apis.js';
|
|
18
|
+
// NATIVE-HOST: lets a custom simulator preload opt into the native-host bridge
|
|
19
|
+
// (DeviceShell render path) the same way the built-in `windows/simulator.ts`
|
|
20
|
+
// does. Self-gating — a no-op disposer when native-host is off. Required so
|
|
21
|
+
// external/composed preloads aren't stranded once native-host becomes the sole
|
|
22
|
+
// runtime. (Stage-0 prerequisite for decommissioning the default path.)
|
|
23
|
+
export { installNativeHostBridge } from './runtime/native-host.js';
|
|
18
24
|
export { setupApiCompatHook } from './shared/api-compat.js';
|
|
19
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import type { MiniappSnapshotSource } from '../miniapp-snapshot/types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* - `bridges` lists every page bridge in chronological (insertion) order, each
|
|
6
|
-
* carrying its page route (`pagePath`), so renderer tabs render in a stable
|
|
7
|
-
* sequence.
|
|
8
|
-
* - `entries` maps `bridgeId → (componentPath | moduleId) → setData state`.
|
|
9
|
-
*/
|
|
10
|
-
export interface AppDataSnapshot {
|
|
11
|
-
bridges: Array<{
|
|
12
|
-
id: string;
|
|
13
|
-
pagePath: string | null;
|
|
14
|
-
}>;
|
|
15
|
-
entries: Record<string, Record<string, unknown>>;
|
|
16
|
-
}
|
|
2
|
+
import { type AppDataSnapshot } from '../../shared/appdata-accumulator.js';
|
|
3
|
+
export type { AppDataSnapshot } from '../../shared/appdata-accumulator.js';
|
|
17
4
|
/**
|
|
18
5
|
* The AppData snapshot data source.
|
|
19
6
|
*
|
|
7
|
+
* Under native-host (the sole runtime) this is registered in the simulator top
|
|
8
|
+
* frame purely for its `start()` side effects — it installs
|
|
9
|
+
* `window.__simulatorHook.appData` and mirrors the flat cache into the
|
|
10
|
+
* `window.__simulatorData.getAppdata()` automation surface still read by
|
|
11
|
+
* automation `getData` (handlers/page.ts), the MCP context overview
|
|
12
|
+
* (mcp/tools/context-tools.ts) and the e2e automator. Its iframe/Worker-based
|
|
13
|
+
* snapshot publishing is inert there (no mini-app Worker runs in the top frame).
|
|
14
|
+
*
|
|
20
15
|
* Instruments `window.Worker` (incoming `message` decoding + outgoing
|
|
21
16
|
* `postMessage` interception) and installs `window.__simulatorHook.appData`,
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `
|
|
25
|
-
*
|
|
26
|
-
* the host owns push, pull and the install-time publish.
|
|
17
|
+
* feeding the shared `AppDataAccumulator`. Every accepted mutation — an
|
|
18
|
+
* `ub`/`page_*` worker message, or a `pageUnload` evicting a bridge — calls
|
|
19
|
+
* `emit()` so the `miniappSnapshot` host republishes. The source itself never
|
|
20
|
+
* touches IPC: the host owns push, pull and the install-time publish.
|
|
27
21
|
*
|
|
28
22
|
* It keeps the `__simulatorData.getAppdata()` automation surface working by
|
|
29
23
|
* mirroring the flat cache into the simulator bridge via `setAppDataSnapshot`
|
|
30
24
|
* / `clearAppDataSnapshot`.
|
|
25
|
+
*
|
|
26
|
+
* Under native-host this source is replaced by the main-process
|
|
27
|
+
* simulator-appdata service, which feeds the SAME accumulator from the
|
|
28
|
+
* service→render message stream — see shared/appdata-accumulator.ts.
|
|
31
29
|
*/
|
|
32
30
|
export declare function createAppDataSource(): MiniappSnapshotSource<AppDataSnapshot>;
|
|
33
31
|
//# sourceMappingURL=app-data.d.ts.map
|
|
@@ -1,188 +1,53 @@
|
|
|
1
1
|
import { clearAppDataSnapshot, setAppDataSnapshot, } from '../runtime/bridge.js';
|
|
2
|
-
|
|
3
|
-
// AppData panel:
|
|
4
|
-
// • update batches `{type:'ub', body:{bridgeId, updates:[{moduleId,data}]}}`
|
|
5
|
-
// where each `data` is a partial setData patch.
|
|
6
|
-
// • instance init: type === instance id (prefixed `page_`/`component_`),
|
|
7
|
-
// body `{bridgeId, path, data}` with the COMPLETE initial state.
|
|
8
|
-
//
|
|
9
|
-
// Policy: surface PAGE entries only. Component entries are dropped — they
|
|
10
|
-
// sometimes flow on a bridge id distinct from their owning page's and never
|
|
11
|
-
// receive pageUnload, which would manifest as ghost tabs in the panel.
|
|
12
|
-
function decodeWorkerMessage(message) {
|
|
13
|
-
let payload = message;
|
|
14
|
-
if (typeof payload === 'string') {
|
|
15
|
-
try {
|
|
16
|
-
payload = JSON.parse(payload);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (!payload || typeof payload !== 'object')
|
|
23
|
-
return null;
|
|
24
|
-
const record = payload;
|
|
25
|
-
if (record.type === 'ub') {
|
|
26
|
-
const body = record.body;
|
|
27
|
-
if (!body || typeof body !== 'object')
|
|
28
|
-
return null;
|
|
29
|
-
if (typeof body.bridgeId !== 'string' || !Array.isArray(body.updates))
|
|
30
|
-
return null;
|
|
31
|
-
const out = [];
|
|
32
|
-
for (const u of body.updates) {
|
|
33
|
-
if (!u || typeof u.moduleId !== 'string')
|
|
34
|
-
continue;
|
|
35
|
-
if (!u.moduleId.startsWith('page_'))
|
|
36
|
-
continue;
|
|
37
|
-
out.push({ mode: 'patch', bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
|
|
38
|
-
}
|
|
39
|
-
return out.length > 0 ? out : null;
|
|
40
|
-
}
|
|
41
|
-
if (typeof record.type === 'string' && record.type.startsWith('page_')) {
|
|
42
|
-
const body = record.body;
|
|
43
|
-
if (!body || typeof body !== 'object')
|
|
44
|
-
return null;
|
|
45
|
-
if (typeof body.bridgeId !== 'string' || typeof body.path !== 'string')
|
|
46
|
-
return null;
|
|
47
|
-
if (!body.data || typeof body.data !== 'object')
|
|
48
|
-
return null;
|
|
49
|
-
return [{
|
|
50
|
-
mode: 'init',
|
|
51
|
-
bridgeId: body.bridgeId,
|
|
52
|
-
moduleId: record.type,
|
|
53
|
-
componentPath: body.path,
|
|
54
|
-
data: body.data,
|
|
55
|
-
}];
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
// main→worker direction: container signals page teardown so cache can evict.
|
|
60
|
-
function decodeOutgoingMessage(message) {
|
|
61
|
-
let payload = message;
|
|
62
|
-
if (typeof payload === 'string') {
|
|
63
|
-
try {
|
|
64
|
-
payload = JSON.parse(payload);
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!payload || typeof payload !== 'object')
|
|
71
|
-
return null;
|
|
72
|
-
const r = payload;
|
|
73
|
-
if (typeof r.type !== 'string')
|
|
74
|
-
return null;
|
|
75
|
-
return {
|
|
76
|
-
type: r.type,
|
|
77
|
-
bridgeId: typeof r.body?.bridgeId === 'string' ? r.body.bridgeId : undefined,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
2
|
+
import { AppDataAccumulator, decodeOutgoingMessage, decodeWorkerMessage, } from '../../shared/appdata-accumulator.js';
|
|
80
3
|
/**
|
|
81
4
|
* The AppData snapshot data source.
|
|
82
5
|
*
|
|
6
|
+
* Under native-host (the sole runtime) this is registered in the simulator top
|
|
7
|
+
* frame purely for its `start()` side effects — it installs
|
|
8
|
+
* `window.__simulatorHook.appData` and mirrors the flat cache into the
|
|
9
|
+
* `window.__simulatorData.getAppdata()` automation surface still read by
|
|
10
|
+
* automation `getData` (handlers/page.ts), the MCP context overview
|
|
11
|
+
* (mcp/tools/context-tools.ts) and the e2e automator. Its iframe/Worker-based
|
|
12
|
+
* snapshot publishing is inert there (no mini-app Worker runs in the top frame).
|
|
13
|
+
*
|
|
83
14
|
* Instruments `window.Worker` (incoming `message` decoding + outgoing
|
|
84
15
|
* `postMessage` interception) and installs `window.__simulatorHook.appData`,
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* `
|
|
88
|
-
*
|
|
89
|
-
* the host owns push, pull and the install-time publish.
|
|
16
|
+
* feeding the shared `AppDataAccumulator`. Every accepted mutation — an
|
|
17
|
+
* `ub`/`page_*` worker message, or a `pageUnload` evicting a bridge — calls
|
|
18
|
+
* `emit()` so the `miniappSnapshot` host republishes. The source itself never
|
|
19
|
+
* touches IPC: the host owns push, pull and the install-time publish.
|
|
90
20
|
*
|
|
91
21
|
* It keeps the `__simulatorData.getAppdata()` automation surface working by
|
|
92
22
|
* mirroring the flat cache into the simulator bridge via `setAppDataSnapshot`
|
|
93
23
|
* / `clearAppDataSnapshot`.
|
|
24
|
+
*
|
|
25
|
+
* Under native-host this source is replaced by the main-process
|
|
26
|
+
* simulator-appdata service, which feeds the SAME accumulator from the
|
|
27
|
+
* service→render message stream — see shared/appdata-accumulator.ts.
|
|
94
28
|
*/
|
|
95
29
|
export function createAppDataSource() {
|
|
96
|
-
const
|
|
97
|
-
// Bridges in insertion order — drives the `bridges` array in snapshots so
|
|
98
|
-
// renderer tabs render in a stable, chronological sequence.
|
|
99
|
-
const bridgeOrder = [];
|
|
100
|
-
// Page path per bridge: set from `page_*` init's body.path. Component init
|
|
101
|
-
// also carries a path but it's the component's own path, not the page route.
|
|
102
|
-
const bridgePagePath = new Map();
|
|
30
|
+
const accumulator = new AppDataAccumulator();
|
|
103
31
|
let emit = null;
|
|
104
32
|
let installed = false;
|
|
105
33
|
let originalHook;
|
|
106
34
|
let originalDescriptor;
|
|
107
35
|
let OriginalWorker;
|
|
108
|
-
function recordBridge(bridgeId) {
|
|
109
|
-
if (!bridgeOrder.includes(bridgeId))
|
|
110
|
-
bridgeOrder.push(bridgeId);
|
|
111
|
-
}
|
|
112
|
-
function buildSnapshot() {
|
|
113
|
-
const bridges = [];
|
|
114
|
-
for (const id of bridgeOrder) {
|
|
115
|
-
bridges.push({ id, pagePath: bridgePagePath.get(id) ?? null });
|
|
116
|
-
}
|
|
117
|
-
const entries = {};
|
|
118
|
-
for (const [key, entry] of appDataCache) {
|
|
119
|
-
const slash = key.indexOf('/');
|
|
120
|
-
if (slash < 0)
|
|
121
|
-
continue;
|
|
122
|
-
const bridgeId = key.slice(0, slash);
|
|
123
|
-
const moduleId = key.slice(slash + 1);
|
|
124
|
-
if (!entries[bridgeId])
|
|
125
|
-
entries[bridgeId] = {};
|
|
126
|
-
const displayKey = entry.componentPath ?? moduleId;
|
|
127
|
-
entries[bridgeId][displayKey] = entry.data;
|
|
128
|
-
}
|
|
129
|
-
return { bridges, entries };
|
|
130
|
-
}
|
|
131
36
|
// Mirror the flat cache into the `__simulatorData.getAppdata()` automation
|
|
132
37
|
// surface so MCP / e2e reads keep working after the snapshot migration.
|
|
133
38
|
function publishSnapshot() {
|
|
134
|
-
|
|
135
|
-
for (const [key, entry] of appDataCache) {
|
|
136
|
-
data[key] = entry.data;
|
|
137
|
-
}
|
|
138
|
-
setAppDataSnapshot(data);
|
|
39
|
+
setAppDataSnapshot(accumulator.flat());
|
|
139
40
|
}
|
|
140
41
|
function clearBridge(bridgeId) {
|
|
141
|
-
|
|
142
|
-
for (const key of [...appDataCache.keys()]) {
|
|
143
|
-
if (key.startsWith(prefix))
|
|
144
|
-
appDataCache.delete(key);
|
|
145
|
-
}
|
|
146
|
-
const idx = bridgeOrder.indexOf(bridgeId);
|
|
147
|
-
if (idx >= 0)
|
|
148
|
-
bridgeOrder.splice(idx, 1);
|
|
149
|
-
bridgePagePath.delete(bridgeId);
|
|
42
|
+
accumulator.clearBridge(bridgeId);
|
|
150
43
|
publishSnapshot();
|
|
151
44
|
// The eviction is a cache mutation — notify the host so the renderer can
|
|
152
45
|
// drop the evicted bridge's tab immediately.
|
|
153
46
|
emit?.();
|
|
154
47
|
}
|
|
155
48
|
function applyAppData(body) {
|
|
156
|
-
|
|
157
|
-
if (!record?.bridgeId || !record?.moduleId)
|
|
49
|
+
if (!accumulator.apply(body))
|
|
158
50
|
return;
|
|
159
|
-
// R6: drop ub patches whose bridge has never been initialised. dimina
|
|
160
|
-
// dispatches pageUnload to the service worker, which fires onUnload —
|
|
161
|
-
// and onUnload's setData (e.g. console-test's stopTimer) produces a
|
|
162
|
-
// late `ub` that arrives AFTER our clearBridge. Without this gate the
|
|
163
|
-
// late patch would resurrect the unloaded bridge as a ghost tab.
|
|
164
|
-
if (record.mode !== 'init' && !bridgePagePath.has(record.bridgeId))
|
|
165
|
-
return;
|
|
166
|
-
const key = `${record.bridgeId}/${record.moduleId}`;
|
|
167
|
-
const prev = appDataCache.get(key);
|
|
168
|
-
const incoming = (record.data && typeof record.data === 'object'
|
|
169
|
-
? record.data
|
|
170
|
-
: {});
|
|
171
|
-
// init = full-state replace; patch = merge into previous (setData semantics)
|
|
172
|
-
const merged = record.mode === 'init'
|
|
173
|
-
? { ...incoming }
|
|
174
|
-
: { ...(prev?.data ?? {}), ...incoming };
|
|
175
|
-
const componentPath = record.componentPath ?? prev?.componentPath;
|
|
176
|
-
const next = componentPath !== undefined
|
|
177
|
-
? { componentPath, data: merged }
|
|
178
|
-
: { data: merged };
|
|
179
|
-
appDataCache.set(key, next);
|
|
180
|
-
recordBridge(record.bridgeId);
|
|
181
|
-
if (record.mode === 'init'
|
|
182
|
-
&& record.moduleId.startsWith('page_')
|
|
183
|
-
&& record.componentPath) {
|
|
184
|
-
bridgePagePath.set(record.bridgeId, record.componentPath);
|
|
185
|
-
}
|
|
186
51
|
publishSnapshot();
|
|
187
52
|
emit?.();
|
|
188
53
|
}
|
|
@@ -229,7 +94,7 @@ export function createAppDataSource() {
|
|
|
229
94
|
}
|
|
230
95
|
return {
|
|
231
96
|
id: 'appdata',
|
|
232
|
-
snapshot: () =>
|
|
97
|
+
snapshot: () => accumulator.snapshot(),
|
|
233
98
|
start(onChange) {
|
|
234
99
|
if (installed)
|
|
235
100
|
return;
|
|
@@ -266,9 +131,7 @@ export function createAppDataSource() {
|
|
|
266
131
|
originalDescriptor = undefined;
|
|
267
132
|
OriginalWorker = undefined;
|
|
268
133
|
originalHook = undefined;
|
|
269
|
-
|
|
270
|
-
bridgeOrder.length = 0;
|
|
271
|
-
bridgePagePath.clear();
|
|
134
|
+
accumulator.clear();
|
|
272
135
|
clearAppDataSnapshot();
|
|
273
136
|
emit = null;
|
|
274
137
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerSyntheticSid } from '../
|
|
1
|
+
import { registerSyntheticSid } from '../shared/sid-registry.js';
|
|
2
2
|
const INTERNAL_CLASSES = new Set([
|
|
3
3
|
'dd-swiper-wrapper', 'dd-swiper-slides', 'dd-swiper-slide-frame', 'dd-swiper-dots',
|
|
4
4
|
'dd-picker-overlay', 'dd-picker-container', 'dd-picker-header', 'dd-picker-body',
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { ElementInspection } from '../../shared/ipc-channels.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
children: WxmlNode[];
|
|
6
|
-
text?: string;
|
|
7
|
-
sid?: string;
|
|
8
|
-
}
|
|
2
|
+
import { type WxmlNode } from '../shared/sid-registry.js';
|
|
3
|
+
export type { WxmlNode } from '../shared/sid-registry.js';
|
|
4
|
+
export { registerSyntheticSid } from '../shared/sid-registry.js';
|
|
9
5
|
export interface Snapshot<T> {
|
|
10
6
|
gen: number;
|
|
11
7
|
ready: boolean;
|
|
@@ -21,7 +17,6 @@ interface SimulatorBridgeState {
|
|
|
21
17
|
wxml: Snapshot<WxmlNode | WxmlNode[] | null>;
|
|
22
18
|
refreshHandler: ((type: RefreshTarget) => void) | null;
|
|
23
19
|
}
|
|
24
|
-
export declare function registerSyntheticSid(el: HTMLElement): string;
|
|
25
20
|
declare function highlightElement(sid: string): ElementInspection | null;
|
|
26
21
|
declare function unhighlightElement(): void;
|
|
27
22
|
export { highlightElement, unhighlightElement };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { exposeOnMainWorld } from '../shared/expose.js';
|
|
2
2
|
import { getActivePageIframe } from '../shared/page-iframe.js';
|
|
3
|
+
import { findElementBySid } from '../shared/sid-registry.js';
|
|
4
|
+
export { registerSyntheticSid } from '../shared/sid-registry.js';
|
|
3
5
|
const state = {
|
|
4
6
|
appdata: { gen: 0, ready: true, data: {} },
|
|
5
7
|
storage: { gen: 0, ready: false, namespace: null, data: {} },
|
|
@@ -8,38 +10,6 @@ const state = {
|
|
|
8
10
|
};
|
|
9
11
|
let highlightOverlay = null;
|
|
10
12
|
let exposedApi = null;
|
|
11
|
-
// 合成 sid 注册表:用 WeakMap 把元素 ↔ sid 双向绑定,避免在源 DOM 上写
|
|
12
|
-
// `data-*` 属性(提取本应只读,且属性形式会污染用户的快照/选择器)。
|
|
13
|
-
// elBySyntheticSid 为反向查找用 WeakRef,元素被 GC 后下次 lookup 自动清理。
|
|
14
|
-
const SYNTHETIC_SID_PREFIX = 'devtools-';
|
|
15
|
-
const syntheticSidByEl = new WeakMap();
|
|
16
|
-
const elBySyntheticSid = new Map();
|
|
17
|
-
let nextSyntheticSid = 1;
|
|
18
|
-
export function registerSyntheticSid(el) {
|
|
19
|
-
const existing = syntheticSidByEl.get(el);
|
|
20
|
-
if (existing)
|
|
21
|
-
return existing;
|
|
22
|
-
const synthetic = `${SYNTHETIC_SID_PREFIX}${nextSyntheticSid++}`;
|
|
23
|
-
syntheticSidByEl.set(el, synthetic);
|
|
24
|
-
elBySyntheticSid.set(synthetic, new WeakRef(el));
|
|
25
|
-
return synthetic;
|
|
26
|
-
}
|
|
27
|
-
function findElementBySid(doc, sid) {
|
|
28
|
-
if (sid.startsWith(SYNTHETIC_SID_PREFIX)) {
|
|
29
|
-
const ref = elBySyntheticSid.get(sid);
|
|
30
|
-
if (!ref)
|
|
31
|
-
return null;
|
|
32
|
-
const el = ref.deref();
|
|
33
|
-
if (!el || !el.isConnected) {
|
|
34
|
-
elBySyntheticSid.delete(sid);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
if (el.ownerDocument !== doc)
|
|
38
|
-
return null;
|
|
39
|
-
return el;
|
|
40
|
-
}
|
|
41
|
-
return doc.querySelector(`[data-sid="${CSS.escape(sid)}"]`);
|
|
42
|
-
}
|
|
43
13
|
function clone(value) {
|
|
44
14
|
try {
|
|
45
15
|
return JSON.parse(JSON.stringify(value));
|