@dimina-kit/devkit 0.1.0 → 0.1.1-dev.20260513123738
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/fe/dimina-fe-container/assets/container-api.js +1 -1
- package/fe/dimina-fe-container/assets/container.css +1 -1
- package/fe/dimina-fe-container/assets/index.css +1 -1
- package/fe/dimina-fe-container/assets/index.js +5 -6
- package/fe/dimina-fe-container/assets/pageFrame.js +1 -1
- package/fe/dimina-fe-container/assets/service.js +1 -1
- package/fe/dimina-fe-container/dimina-version.json +2 -1
- package/fe/index.js +25 -6
- package/package.json +1 -1
|
@@ -3,4 +3,4 @@ var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i
|
|
|
3
3
|
msg: ${t.message}
|
|
4
4
|
stack:
|
|
5
5
|
${t.stack}
|
|
6
|
-
`;console.error(`require ${e} error: ${i}`),h(n)&&n({mod:e,errMsg:t.message})}r.exports=t.exports===void 0?i:t.exports}return h(t)&&t(r.exports),r.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=le()){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 n=this.callbacks[e];n&&h(n.callback)&&(n.callback(t),n.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 ge(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=ge(),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(){return this.stack().at(-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.at(-1);return e?e.pages:this.pushStack(Date.now()).pages}}},_e={getWindowInfo:()=>T.getSystemInfo(),getSystemInfoSync:()=>T.getSystemInfo(),getAppBaseInfo:()=>T.getSystemInfo(),getDeviceInfo:()=>T.getSystemInfo(),getMenuButtonBoundingClientRect:()=>T.getMenuRect()};function O(e,t,n=`container`){let r=_e[e];if(n===`container`&&r){let e=r();if(e)return e}let i;if(t===void 0||typeof t==`string`||Array.isArray(t))i=t;else if(h(t))i={success:w.store(t,!0)};else{let{success:e,fail:n,complete:r,keep:a,evtId:o,...s}=t;i=s,h(e)?i.success=w.store(e,a,o):i.success=e,h(n)&&(i.fail=w.store(n,a,o)),h(r)&&(i.complete=w.store(r,a,o))}let a={type:`invokeAPI`,target:n,body:{name:e,bridgeId:D.getPageInfo().id,params:i}};return n===`container`?E.invoke(a):E.send(a)}var ve=t({navigateBack:()=>Ce,navigateTo:()=>Se,reLaunch:()=>be,redirectTo:()=>xe,switchTab:()=>ye});function ye(e){e.url=y(D.getPageInfo().route,e.url),O(`switchTab`,e)}function be(e){e.url=y(D.getPageInfo().route,e.url),O(`reLaunch`,e)}function xe(e){let t=y(D.getPageInfo().route,e.url);D.getPageInfo().route!==t&&(e.url=t,O(`redirectTo`,e))}function Se(e){e.url=y(D.getPageInfo().route,e.url),O(`navigateTo`,e)}function Ce(e){O(`navigateBack`,e)}var we=t({offAppHide:()=>Ae,offAppShow:()=>ke,offError:()=>Ee,onAppHide:()=>Oe,onAppRoute:()=>Ne,onAppShow:()=>De,onError:()=>Te,onPageNotFound:()=>Me,onUnhandledRejection:()=>je});function Te(e){O(`onError`,e)}function Ee(e){O(`offError`,e)}function De(e){O(`onAppShow`,e)}function Oe(e){O(`onAppHide`,e)}function ke(e){O(`offAppShow`,e)}function Ae(e){O(`offAppHide`,e)}function je(){}function Me(){}function Ne(){}var Pe=t({canIUse:()=>Le,env:()=>Fe});function Fe(){return{USER_DATA_PATH:`difile://`}}var Ie=new Set([`nextTick`,`getUpdateManager`,`getPerformance`]);function Le(e){if(Ie.has(e))return!0;try{return O(`canIUse`,e)}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Re=t({getPerformance:()=>ze});function ze(){return Be.getInstance()}var Be=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Ve,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){let t=new He(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}},Ve=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}},He=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 Ve;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}},Ue=t({loadSubpackage:()=>Ge,preDownloadSubpackage:()=>We});function We(e){O(`preDownloadSubpackage`,e)}function Ge(e){O(`loadSubpackage`,e)}var Ke=t({getAppBaseInfo:()=>$e,getDeviceInfo:()=>et,getSystemInfo:()=>Xe,getSystemInfoAsync:()=>Qe,getSystemInfoSync:()=>Ze,getWindowInfo:()=>Je,openAppAuthorizeSetting:()=>Ye,openSystemBluetoothSetting:()=>qe});function qe(e){O(`openSystemBluetoothSetting`,e)}function Je(e){return O(`getWindowInfo`,e)}function Ye(e){O(`openAppAuthorizeSetting`,e)}function Xe(e){return new Promise(t=>{t(O(`getSystemInfo`,e))})}function Ze(){return O(`getSystemInfoSync`)}function Qe(e){O(`getSystemInfoAsync`,e)}function $e(){return O(`getAppBaseInfo`)}function et(){return O(`getDeviceInfo`)}var tt=t({getUpdateManager:()=>nt});function nt(){return rt.getInstance()}var rt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasApplyUpdate=!1,this.updateFailFlag=null,this.updateFailCbQueue=[],this.updateReadyCbQueue=[],this.updateReadyStatus=null,this.updateReadyFlag=!1,this.updateStatus=null,this.updateStatusCbQueue=[],E.on(`onUpdateStatusChange`,e=>{let{event:t,strategy:n}=e;t===`updatefail`?(this.updateFailFlag={},this.flashUpdateFailCb()):t===`updateready`?(this.updateReadyFlag=!0,this.updateReadyStatus={strategy:n},this.flushUpdateReadyCb()):t===`noupdate`?(this.updateStatus={hasUpdate:!0},this.flushUpdateStatusCb()):t===`updating`&&(this.updateStatus={hasUpdate:!1},this.flushUpdateStatusCb())}),e.#e=this}flashUpdateFailCb(){this.updateFailCbQueue.forEach(e=>{typeof e==`function`&&e()}),this.updateFailCbQueue.length=0}flushUpdateStatusCb(){this.updateStatusCbQueue.forEach(e=>{typeof e==`function`&&e(this.updateStatus)}),this.updateStatusCbQueue.length=0}flushUpdateReadyCb(){this.updateReadyCbQueue.forEach(e=>{typeof e==`function`&&e(this.updateReadyStatus)}),this.updateReadyCbQueue.length=0}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){this.updateReadyFlag&&this.hasApplyUpdate?console.error(`[applyUpdate]: applyUpdate has been called`):this.updateReadyFlag?O(`applyUpdate`):console.error(`[applyUpdate]: update is not ready`)}onCheckForUpdate(e){this.updateStatus?typeof e==`function`&&e(this.updateStatus):this.updateStatusCbQueue.push(e)}onUpdateFailed(e){this.updateFailFlag?typeof e==`function`&&e(this.updateFailFlag):this.updateFailCbQueue.push(e)}onUpdateReady(e){this.updateReadyFlag?typeof e==`function`&&e(this.updateReadyStatus):this.updateReadyCbQueue.push(e)}},it=t({createCameraContext:()=>at});function at(){return new ot}var ot=class{constructor(){this.bridgeId=D.getPageInfo().id}takePhoto(e){O(`takePhoto`,e)}startRecord(){O(`startRecord`)}stopRecord(){O(`stopRecord`)}},st=t({reportAnalytics:()=>ct,reportEvent:()=>lt});function ct(...e){O(`reportAnalytics`,e)}function lt(e,t){O(`reportAnalytics`,{eventId:e,data:t})}var ut=t({closeBluetoothAdapter:()=>xt,getBluetoothAdapterState:()=>bt,getBluetoothDevices:()=>yt,getConnectedBluetoothDevices:()=>vt,offBluetoothAdapterStateChange:()=>_t,offBluetoothDeviceFound:()=>gt,onBluetoothAdapterStateChange:()=>ht,onBluetoothDeviceFound:()=>mt,openBluetoothAdapter:()=>pt,startBluetoothDevicesDiscovery:()=>ft,stopBluetoothDevicesDiscovery:()=>dt});function dt(e){O(`stopBluetoothDevicesDiscovery`,e)}function ft(e){O(`startBluetoothDevicesDiscovery`,e)}function pt(e){O(`openBluetoothAdapter`,e)}function mt(e){O(`onBluetoothDeviceFound`,e)}function ht(e){O(`onBluetoothAdapterStateChange`,e)}function gt(){O(`offBluetoothDeviceFound`)}function _t(){O(`offBluetoothAdapterStateChange`)}function vt(e){O(`getConnectedBluetoothDevices`,e)}function yt(e){O(`getBluetoothDevices`,e)}function bt(e){O(`getBluetoothAdapterState`,e)}function xt(e){O(`closeBluetoothAdapter`,e)}var St=t({closeBLEConnection:()=>Ft,createBLEConnection:()=>Pt,getBLEDeviceCharacteristics:()=>Nt,getBLEDeviceRSSI:()=>Mt,getBLEDeviceServices:()=>jt,notifyBLECharacteristicValueChange:()=>At,offBLECharacteristicValueChange:()=>kt,offBLEConnectionStateChange:()=>Ot,onBLECharacteristicValueChange:()=>Dt,onBLEConnectionStateChange:()=>Et,readBLECharacteristicValue:()=>Tt,setBLEMTU:()=>wt,writeBLECharacteristicValue:()=>Ct});function Ct(e){O(`writeBLECharacteristicValue`,e)}function wt(e){O(`setBLEMTU`,e)}function Tt(e){O(`readBLECharacteristicValue`,e)}function Et(e){O(`onBLEConnectionStateChange`,e)}function Dt(e){O(`onBLECharacteristicValueChange`,e)}function Ot(e){O(`offBLEConnectionStateChange`,e)}function kt(){O(`offBLECharacteristicValueChange`)}function At(e){O(`notifyBLECharacteristicValueChange`,e)}function jt(e){O(`getBLEDeviceServices`,e)}function Mt(e){O(`getBLEDeviceRSSI`,e)}function Nt(e){O(`getBLEDeviceCharacteristics`,e)}function Pt(e){O(`createBLEConnection`,e)}function Ft(e){O(`closeBLEConnection`,e)}var It=t({getClipboardData:()=>Rt,setClipboardData:()=>Lt});function Lt(e){O(`setClipboardData`,e)}function Rt(e){O(`getClipboardData`,e)}var zt=t({addPhoneContact:()=>Vt,chooseContact:()=>Bt});function Bt(e){O(`chooseContact`,e)}function Vt(e){O(`addPhoneContact`,e)}var Ht=t({hideKeyboard:()=>Ut});function Ut(e){O(`hideKeyboard`,e)}var Wt=t({offMemoryWarning:()=>Kt,onMemoryWarning:()=>Gt});function Gt(e){O(`onMemoryWarning`,e)}function Kt(e){O(`offMemoryWarning`,e)}var qt=t({getNetworkType:()=>Jt});function Jt(e){O(`getNetworkType`,e)}var Yt=t({makePhoneCall:()=>Xt});function Xt(e){O(`makePhoneCall`,e)}var Zt=t({scanCode:()=>Qt});function Qt(e){O(`scanCode`,e)}var $t=t({vibrateLong:()=>tn,vibrateShort:()=>en});function en(e){O(`vibrateShort`,e)}function tn(e){O(`vibrateLong`,e)}var nn=t({extBridge:()=>rn,extOffBridge:()=>on,extOnBridge:()=>an,offLoginStatusChanged:()=>cn,onLoginStatusChanged:()=>sn});function rn({event:e,module:t,data:n={},success:r,fail:i,complete:a},o){let s,c,l;h(o)?(s=o,c=o):(s=r,c=i,l=a),O(e,{module:t,data:n,keep:n.isSustain??!0,success:s,fail:c,complete:l})}function an({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 on({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 sn(e){E.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function cn(){E.off(`notifyLoginStatusChanged`)}var ln=t({USER_DATA_PATH:()=>un,getFileSystemManager:()=>gn}),un=`difile://`,k=`not supported in simulator`,dn=class{constructor(e){this.size=e.size||0,this.mode=e.mode||438,this.lastAccessedTime=e.lastAccessedTime||0,this.lastModifiedTime=e.lastModifiedTime||0,this._isFile=e.isFile===void 0?!0:e.isFile,this._isDirectory=e.isDirectory===void 0?!1:e.isDirectory}isFile(){return this._isFile}isDirectory(){return this._isDirectory}};function A(e){throw Error(`FileSystemManager.${e} ${k}`)}function j(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${k}`}),r?.()}function fn(e){return e&&new dn(e)}function pn(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))t[n]=new dn(r);return t}var mn=class{access(e){O(`fsAccess`,e)}accessSync(){A(`accessSync`)}stat(e={}){let{success:t,recursive:n,...r}=e;O(`fsStat`,{...r,recursive:n,success:e=>{if(!t)return;let r=n?pn(e?.stats):fn(e?.stats);t({...e,stats:r})}})}statSync(){A(`statSync`)}readFile(e){O(`fsReadFile`,e)}readFileSync(){A(`readFileSync`)}writeFile(e){O(`fsWriteFile`,e)}writeFileSync(){A(`writeFileSync`)}appendFile(e){O(`fsAppendFile`,e)}appendFileSync(){A(`appendFileSync`)}copyFile(e){O(`fsCopyFile`,e)}copyFileSync(){A(`copyFileSync`)}rename(e){O(`fsRename`,e)}renameSync(){A(`renameSync`)}unlink(e){O(`fsUnlink`,e)}unlinkSync(){A(`unlinkSync`)}mkdir(e){O(`fsMkdir`,e)}mkdirSync(){A(`mkdirSync`)}rmdir(e){O(`fsRmdir`,e)}rmdirSync(){A(`rmdirSync`)}readdir(e){O(`fsReaddir`,e)}readdirSync(){A(`readdirSync`)}getFileInfo(e){O(`fsGetFileInfo`,e)}saveFile(e){O(`fsSaveFile`,e)}saveFileSync(){A(`saveFileSync`)}getSavedFileList(e){O(`fsGetSavedFileList`,e)}removeSavedFile(e){O(`fsRemoveSavedFile`,e)}truncate(e){O(`fsTruncate`,e)}truncateSync(){A(`truncateSync`)}unzip(e){O(`fsUnzip`,e)}open(e){j(`open`,e)}openSync(){A(`openSync`)}close(e){j(`close`,e)}closeSync(){A(`closeSync`)}read(e){j(`read`,e)}readSync(){A(`readSync`)}write(e){j(`write`,e)}writeSync(){A(`writeSync`)}fstat(e){j(`fstat`,e)}fstatSync(){A(`fstatSync`)}ftruncate(e){j(`ftruncate`,e)}ftruncateSync(){A(`ftruncateSync`)}readCompressedFile(e){j(`readCompressedFile`,e)}readCompressedFileSync(){A(`readCompressedFileSync`)}readZipEntry(e){j(`readZipEntry`,e)}},hn;function gn(){return hn||=new mn,hn}var _n=[`onLaunch`,`onShow`,`onHide`],vn=[`globalData`],yn=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(){_n.forEach(e=>{let t=this.appModule.moduleInfo[e];h(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)_n.includes(t)||vn.includes(t)||(h(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?.()}},bn=t({createSelectorQuery:()=>M});function M(){return new xn}var xn=class{constructor(){this.__componentId=D.getPageInfo().id,this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new N(this,this.__componentId,e,!0)}selectAll(e){return new N(this,this.__componentId,e,!1)}selectViewport(){return new N(this,D.getPageInfo().id,``,!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;O(`selectorQuery`,{tasks:this.__taskQueue,success:n=>{n.forEach((e,n)=>{let r=t.__cbQueue[n];h(r)&&r.call(t,e)}),h(e)&&e.call(t,n)}},`render`)}},N=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)}},Sn=t({createIntersectionObserver:()=>Cn});function Cn(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new wn(e,{thresholds:n,initialRatio:r,observeAll:i})}var wn=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}},P=new Map;function F(e){return P.has(e)||P.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),P.get(e)}function I(e,t){let n=(Array.isArray(t)?t:[t]).filter(h);if(n.length!==0)return w.store(()=>{n.forEach(t=>t.call(e))})}function Tn(e){let t=F(e);t.depth++}function En(e){let t=F(e);t.depth>0&&t.depth--,t.depth===0&&R(e)}function L(e,t,n,r){let i=F(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&&R(e)}))}function R(e){let t=P.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 Dn(e){let t=e.__mpxProxy?.options?.computed;if(t)for(let n of Object.keys(t))Object.hasOwn(e.data,n)||(e.data[n]=null)}function z(e){return oe(e)?e:Object.entries(e).reduce((e,[t,n])=>t.startsWith(`$`)?e:h(n)?(console.warn(`[service] 值不支持函数引用`,t),e):(Array.isArray(n)?e[t]=n.map(e=>typeof e==`object`&&e?e instanceof Date?e.getTime():z(e):e):n&&typeof n==`object`&&!Array.isArray(n)?n instanceof Date?e[t]=n.getTime():e[t]=z(n):e[t]=n,e),{})}function On(e){if(e){let t={};for(let n in e){let r=e[n];t[n]=t[n]||{};let i=B(r&&typeof r==`object`&&Object.hasOwn(r,`type`)?r.type:r),a=null;if(a=Array.isArray(i)?[...i]:[i],r&&r.optionalTypes){let e=B(r.optionalTypes);Array.isArray(e)?a=[...e]:a.push(e)}t[n].type=a,t[n].type.length>0&&(r&&h(r.value)?t[n].default=r.value():r&&(t[n].default=r.value))}return t}}var kn=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`],[Function,`f`]]);function B(e){return Array.isArray(e)?e.map(e=>B(e)):e===null||e===``?null:kn.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function An(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 jn(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 Mn(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,ue(n),de(n),r];for(let t of i)if(t&&e[t]!==void 0)return e[t]}function V(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=>{jn(r,{[i]:t},e.data,e,n[r])})}}function Nn(e,t,n){Fn(e,t,n)}function Pn(e,t,n){let r=[];for(let i of t){let t=e.__info__.properties?.[i]?.observer,a=e.data[i],o=n[i];ae(t)?r.push(()=>e[t]?.(a,o)):h(t)&&r.push(()=>t.call(e,a,o))}return r}function Fn(e,t,n){Pn(e,t,n).reverse().forEach(e=>e())}function In(e,t){if(!Array.isArray(t))return;let n=new WeakMap;function r(e,t){let n={...e};for(let e in t)if(Object.hasOwn(t,e)){let i=n[e],a=t[e];i&&typeof i==`object`&&!Array.isArray(i)&&a&&typeof a==`object`&&!Array.isArray(a)?n[e]=r(i,a):n[e]=a}return n}function i(e,t){if(typeof t==`string`){a(e,t);return}if(!t||typeof t!=`object`||n.has(t))return;n.set(t,!0),Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>i(e,t)),t.properties&&(e.properties={...t.properties,...e.properties}),t.data&&(e.data||={},e.data=r(t.data,e.data));let o=[`created`,`attached`,`ready`,`detached`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let n of o)h(t[n])&&(e.behaviorLifetimes[n]=e.behaviorLifetimes[n]||[],e.behaviorLifetimes[n].push(t[n]));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 n of[`show`,`hide`,`resize`,`routeDone`])h(t.pageLifetimes[n])&&(e.behaviorPageLifetimes[n]=e.behaviorPageLifetimes[n]||[],e.behaviorPageLifetimes[n].push(t.pageLifetimes[n]))}}function a(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=>i(e,t))}function H(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 U(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.hasOwn(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function Ln(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 Rn(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 W(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!H(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&&Ln(i,n)&&(o[r]=Rn(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 zn=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],Bn=[`show`,`hide`,`resize`,`routeDone`],Vn=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=pe(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.hasOwn(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(()=>{Dn(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__=[],L(this.bridgeId,this.__id__,{},I(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&h(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(Y.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(Y.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(Y.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,n){let r=this.__relations__.get(e)||[];if(!r.includes(t)&&(r.push(t),this.__relations__.set(e,r),h(n.linked)))try{n.linked.call(this,t)}catch(e){console.error(`[service] relation linked error:`,e)}}#l(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);if(i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),h(n.unlinked)))try{n.unlinked.call(this,t)}catch(e){console.error(`[service] relation unlinked error:`,e)}}#u(e,t,n){if(h(n.linkChanged))try{n.linkChanged.call(this,t)}catch(e){console.error(`[service] relation linkChanged error:`,e)}}setData(e,t){let n=z(e),r={};for(let e in n)r[e]=this.data[e],ce(this.data,e,n[e]);if(this.__info__.observers&&An(Object.keys(n),this.__info__.observers,this.data,this,r),V(this,Object.keys(n),r),Nn(this,Object.keys(n),r),!this.initd){h(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}if(this.__groupSetDataMode__){for(let e in n)this.__groupSetDataBuffer__[e]=n[e];h(t)&&this.__groupSetDataCallbacks__.push(t);return}let i=W(this,Y.instances[this.bridgeId],n);L(this.bridgeId,this.__id__,n,I(this,t)),i.forEach(({child:e,data:t})=>{L(this.bridgeId,e.__id__,t)})}#d(){zn.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];h(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&Bn.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];h(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)h(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 n=this.__info__.properties[t]?.observer,r=this.data[t];ae(n)?e.push(()=>this[n]?.(r,void 0)):h(n)&&e.push(()=>n.call(this,r,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.hasOwn(this.__pendingSyncedProps__,n)&&se(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(()=>jn(e,this.__info__.observers,this.data,this,t))}n.forEach(e=>e()),V(this,Object.keys(t),Object.fromEntries(Object.keys(t).map(e=>[e,void 0]))),Fn(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 M().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]),n=t.find(n=>H(n,this.__id__,t)&&U(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]);return t.filter(n=>H(n,this.__id__,t)&&U(e,n))}selectOwnerComponent(){let e=Object.values(Y.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Cn(this,e)}groupSetData(e){if(!h(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Tn(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=W(this,Y.instances[this.bridgeId],e);L(this.bridgeId,this.__id__,e,I(this,t)),n.forEach(({child:e,data:t})=>{L(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];En(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=Mn(this.__eventAttr__,r);i&&await Y.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 Y.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(Y.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,n]of t.__relations__.entries()){let r=n.indexOf(this);if(r!==-1){n.splice(r,1),t.__relations__.set(e,n);let i=t.__info__.relations?.[e];if(i&&h(i.unlinked))try{i.unlinked.call(t,this)}catch(e){console.error(`[service] relation unlinked error:`,e)}}}}componentError(e){this.error?.(e)}},G=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,In(this.moduleInfo,this.behaviors),this.noReferenceData=z(this.moduleInfo.data||{})}getProps(){let e=On(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}},Hn=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=pe(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(()=>{Dn(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__=[],L(this.bridgeId,this.__id__,{},I(this,e))}setData(e,t){let n=z(e),r={},i=this.__info__||{};for(let e in n)r[e]=this.data[e],ce(this.data,e,n[e]);if(i.observers&&An(Object.keys(n),i.observers,this.data,this,r),V(this,Object.keys(n),r),!this.initd){h(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}let a=W(this,Y.instances[this.bridgeId],n);L(this.bridgeId,this.__id__,n,I(this,t)),a.forEach(({child:e,data:t})=>{L(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return M().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]||{}),n=t.find(n=>H(n,this.__id__,t)&&U(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Y.instances[this.bridgeId]||{});return t.filter(n=>H(n,this.__id__,t)&&U(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];h(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)}},K=class e{static type=`page`;constructor(t,n){if(this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,In(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&h(t)&&(this.moduleInfo[e]=t);this.noReferenceData=z(this.moduleInfo.data||{})}},q=class{static type=`app`;constructor(e){this.moduleInfo=e}},J=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 q(e);this.staticModules[q.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===K.type){let n=new K(e,t);this.staticModules[r]=n}else if(n===G.type){let n=new G(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[q.type]}getModuleByPath(e){return this.staticModules[e]}},Y=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:n,methodName:r,event:i}){if(h(e[r]))return await e[r](i);console.warn(`[service] triggerEvent ${t} ${n}, is: ${e.is}, method: ${r} 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=J.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),this.app=new yn(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=J.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===G.type){let e=new Vn(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===K.type){let e=new Hn(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__===G.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__===G.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__===K.type?r.push(e):e.__type__===G.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__===K.type||e.__type__===G.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__===G.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__===K.type?r.push(e):e.__type__===G.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__===G.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__===K.type?e.pageResize(n):e.__type__===G.type&&(e.__isComponent__,e.pageResize(n)))})}componentError(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&r.__type__===G.type&&r.componentError()}componentRouteDone(e){let{bridgeId:t}=e,n=this.instances[t];n&&Object.values(n).forEach(e=>{e?.__type__===G.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__===G.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})}},Un=t({getEnterOptionsSync:()=>Gn,getLaunchOptionsSync:()=>Wn});function Wn(){return Y.app?.options}function Gn(){return Y.app?.options}var Kn=t({getLocation:()=>qn,offLocationChange:()=>Qn,onLocationChange:()=>Zn,openLocation:()=>Yn,startLocationUpdate:()=>Jn,stopLocationUpdate:()=>Xn});function qn(e){O(`getLocation`,e)}function Jn(e){O(`startLocationUpdate`,e)}function Yn(e){O(`openLocation`,e)}function Xn(e){O(`stopLocationUpdate`,e)}function Zn(e){e&&O(`onLocationChange`,{success:w.store(e,!0)})}function Qn(e){if(e){let t=w.store(e,!0);O(`offLocationChange`,{success:t}),w.remove(t)}else O(`offLocationChange`),w.remove()}var $n=t({createMapContext:()=>er});function er(e,t){return new tr({mapId:e,obj:t})}var tr=class{constructor(e){this.opts=e}addMarkers(e){O(`addMarkers`,e)}removeMarkers(e){O(`removeMarkers`,e)}includePoints(e){O(`includePoints`,e)}setCenterOffset(e){O(`setCenterOffset`,e)}getCenterLocation(e){O(`getCenterLocation`,e)}getScale(e){O(`getScale`,e)}moveToLocation(e){O(`moveToLocation`,e)}translateMarker(e){O(`translateMarker`,e)}addArc(e){O(`addArc`,e)}removeArc(e){O(`removeArc`,e)}},nr=t({createInnerAudioContext:()=>ar}),rr=1,ir=class{constructor(){this._audioId=rr++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._paused=!0,this._listeners={},O(`audioCreate`,{audioId:this._audioId})}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 0}get currentTime(){return 0}get paused(){return this._paused}get buffered(){return 0}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 ar(){return new ir}var or=t({chooseImage:()=>ur,compressImage:()=>lr,previewImage:()=>cr,saveImageToPhotosAlbum:()=>sr});function sr(e){O(`saveImageToPhotosAlbum`,e)}function cr(e){O(`previewImage`,e)}function lr(e){O(`compressImage`,e)}function ur(e){O(`chooseImage`,e)}var dr=t({chooseMedia:()=>pr,chooseVideo:()=>fr});function fr(e){O(`chooseVideo`,e)}function pr(e){O(`chooseMedia`,e)}var mr=t({exitMiniProgram:()=>vr,navigateBackMiniProgram:()=>_r,navigateToMiniProgram:()=>gr,restartMiniProgram:()=>hr});function hr(e){O(`restartMiniProgram`,e)}function gr(e){O(`navigateToMiniProgram`,e)}function _r(e){O(`navigateBackMiniProgram`,e)}function vr(e){O(`exitMiniProgram`,e)}var yr=t({downloadFile:()=>br});function br(e){O(`downloadFile`,e)}var xr=t({request:()=>Sr});function Sr(e){O(`request`,e)}var Cr=t({uploadFile:()=>wr});function wr(e){O(`uploadFile`,e)}var Tr=t({closeSocket:()=>Or,connectSocket:()=>Er,onSocketClose:()=>Mr,onSocketError:()=>jr,onSocketMessage:()=>Ar,onSocketOpen:()=>kr,sendSocketMessage:()=>Dr}),X=class{constructor(e){this.socketId=e,this._readyState=0}send(e={}){let{data:t,success:n,fail:r,complete:i,...a}=e,o={socketId:this.socketId,data:t,...a};return h(n)&&(o.success=w.store(n)),h(r)&&(o.fail=w.store(r)),h(i)&&(o.complete=w.store(i)),O(`sendSocketMessage`,o)}close(e={}){let{code:t=1e3,reason:n=``,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,code:t,reason:n,...o};return h(r)&&(s.success=w.store(r)),h(i)&&(s.fail=w.store(i)),h(a)&&(s.complete=w.store(a)),O(`closeSocket`,s)}onOpen(e){if(h(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(h(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(h(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(h(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 Er(e={}){let{url:t,header:n={},protocols:r=[],tcpNoDelay:i=!1,perMessageDeflate:a=!1,timeout:o,forceCellularNetwork:s=!1,success:c,fail:l,complete:u,...d}=e;if(!t){let e=Error(`url is required`);throw h(l)&&l(e),h(u)&&u(e),e}let f=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,p=new X(f),m={socketId:f,url:t,header:n,protocols:r,tcpNoDelay:i,perMessageDeflate:a,timeout:o,forceCellularNetwork:s,...d};return h(c)&&(m.success=w.store(e=>{p._readyState=X.OPEN,c(e)})),h(l)&&(m.fail=w.store(e=>{p._readyState=X.CLOSED,l(e)})),h(u)&&(m.complete=w.store(u)),O(`connectSocket`,m),p}function Dr(e){return O(`sendSocketMessage`,e)}function Or(e){return O(`closeSocket`,e)}function kr(e){return O(`onSocketOpen`,{callback:w.store(e,!0)})}function Ar(e){return O(`onSocketMessage`,{callback:w.store(e,!0)})}function jr(e){return O(`onSocketError`,{callback:w.store(e,!0)})}function Mr(e){return O(`onSocketClose`,{callback:w.store(e,!0)})}var Nr=t({getAccountInfoSync:()=>Pr});function Pr(){return O(`getAccountInfoSync`)}var Fr=t({authorize:()=>Ir});function Ir(e){O(`authorize`,e)}var Lr=t({login:()=>Rr});function Rr(e){O(`login`,e)}var zr=t({login:()=>Br});function Br(e){O(`login`,e)}var Vr=t({getPrivacySetting:()=>Hr});function Hr(e){O(`getPrivacySetting`,e)}var Ur=t({getSetting:()=>Gr,openSetting:()=>Wr});function Wr(e){O(`openSetting`,e)}function Gr(e){O(`getSetting`,e)}var Kr=t({getUserInfo:()=>qr});function qr(e){O(`getUserInfo`,e)}var Jr=t({requestPayment:()=>Yr});function Yr(e){O(`requestPayment`,e)}var Xr=t({hideShareMenu:()=>$r,showShareImageMenu:()=>Qr,showShareMenu:()=>Zr});function Zr(e){O(`shareShareMenu`,e)}function Qr(e){O(`showShareImageMenu`,e)}function $r(e){O(`hideShareMenu`,e)}var ei=t({clearStorage:()=>ci,clearStorageSync:()=>ii,getStorage:()=>oi,getStorageInfo:()=>ui,getStorageInfoSync:()=>li,getStorageSync:()=>ni,removeStorage:()=>si,removeStorageSync:()=>ri,setStorage:()=>ai,setStorageSync:()=>ti});function ti(...e){O(`setStorageSync`,e)}function ni(e){return O(`getStorageSync`,e)}function ri(e){return O(`removeStorageSync`,e)}function ii(){O(`clearStorageSync`)}function ai(e){O(`setStorage`,e)}function oi(e){O(`getStorage`,e)}function si(e){O(`removeStorage`,e)}function ci(){O(`clearStorage`)}function li(){return O(`getStorageInfoSync`)}function ui(e){O(`getStorageInfo`,e)}var di=t({createAnimation:()=>fi});function fi(e={}){return new pi(e)}var pi=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,ee=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,ee]}),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}},mi=t({setBackgroundColor:()=>gi,setBackgroundTextStyle:()=>hi});function hi(e){O(`setBackgroundTextStyle`,e)}function gi(e){O(`setBackgroundColor`,e)}var _i=t({canvasToTempFilePath:()=>xi,createCanvasContext:()=>yi,createContext:()=>vi,drawCanvas:()=>bi});function vi(){return new Si}function yi(e,t){return new Si(e,Z(t))}function bi(e={}){let t={...e,moduleId:e.moduleId||Z(e.component)};delete t.component,O(`drawCanvas`,t,`render`)}function xi(e={},t){let n={...e,moduleId:e.moduleId||Z(t||e.component)};delete n.component,O(`canvasToTempFilePath`,n,`render`)}function Z(e){return e?.__id__||D.getPageInfo()?.id}var Si=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&&(bi({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)}},Ci=t({nextTick:()=>Ei}),Q=[],wi=null;function Ti(){let e=Q;Q=[],wi=null;for(let t=0;t<e.length;t++)e[t]()}function Ei(e){h(e)&&(Q.push(e),wi||=setTimeout(Ti,0))}var Di=t({disableAlertBeforeUnload:()=>Fi,enableAlertBeforeUnload:()=>Pi,hideLoading:()=>Ni,hideToast:()=>ki,showActionSheet:()=>Mi,showLoading:()=>ji,showModal:()=>Ai,showToast:()=>Oi});function Oi(e){O(`showToast`,e)}function ki(e){O(`hideToast`,e)}function Ai(e){O(`showModal`,e)}function ji(e){O(`showLoading`,e)}function Mi(e){O(`showActionSheet`,e)}function Ni(e){O(`hideLoading`,e)}function Pi(e){O(`enableAlertBeforeUnload`,e)}function Fi(e){O(`disableAlertBeforeUnload`,e)}var Ii=t({getMenuButtonBoundingClientRect:()=>Li,offMenuButtonBoundingClientRectWeightChange:()=>zi,onMenuButtonBoundingClientRectWeightChange:()=>Ri}),$=new Set;function Li(){return O(`getMenuButtonBoundingClientRect`)}function Ri(e){h(e)&&$.add(e)}function zi(e){h(e)?$.delete(e):$.clear()}var Bi=t({hideNavigationBarLoading:()=>Wi,setNavigationBarColor:()=>Ui,setNavigationBarTitle:()=>Hi,showNavigationBarLoading:()=>Vi});function Vi(e){O(`showNavigationBarLoading`,e)}function Hi(e){O(`setNavigationBarTitle`,e)}function Ui(e){O(`setNavigationBarColor`,e)}function Wi(e){O(`hideNavigationBarLoading`,e)}var Gi=t({startPullDownRefresh:()=>qi,stopPullDownRefresh:()=>Ki});function Ki(e){O(`stopPullDownRefresh`,e)}function qi(e){O(`startPullDownRefresh`,e)}var Ji=t({pageScrollTo:()=>Yi});function Yi(e){O(`pageScrollTo`,e)}var Xi=t({onWindowResize:()=>Zi});function Zi(e){e&&O(`onWindowResize`,{success:e})}var Qi=Object.assign({"./core/base/app-event/index.js":we,"./core/base/index.js":Pe,"./core/base/performance/index.js":Re,"./core/base/subpackage/index.js":Ue,"./core/base/system/index.js":Ke,"./core/base/update/index.js":tt,"./core/camera/index.js":it,"./core/data-analysis/index.js":st,"./core/device/bluetooth/index.js":ut,"./core/device/bluetooth-ble/index.js":St,"./core/device/clipboard/index.js":It,"./core/device/contact/index.js":zt,"./core/device/keyboard/index.js":Ht,"./core/device/memory/index.js":Wt,"./core/device/network/index.js":qt,"./core/device/phone/index.js":Yt,"./core/device/scan/index.js":Zt,"./core/device/vibrate/index.js":$t,"./core/ext/index.js":nn,"./core/file/index.js":ln,"./core/life-cycle/index.js":Un,"./core/location/index.js":Kn,"./core/map/index.js":$n,"./core/media/audio/index.js":nr,"./core/media/image/index.js":or,"./core/media/video/index.js":dr,"./core/navigate/index.js":mr,"./core/network/download/index.js":yr,"./core/network/request/index.js":xr,"./core/network/upload/index.js":Cr,"./core/network/websocket/index.js":Tr,"./core/open-api/account-info/index.js":Nr,"./core/open-api/authorize/index.js":Fr,"./core/open-api/index.js":Lr,"./core/open-api/login/index.js":zr,"./core/open-api/privacy/index.js":Vr,"./core/open-api/setting/index.js":Ur,"./core/open-api/user-info/index.js":Kr,"./core/payment/index.js":Jr,"./core/route/index.js":ve,"./core/share/index.js":Xr,"./core/storage/index.js":ei,"./core/ui/animation/index.js":di,"./core/ui/background/index.js":mi,"./core/ui/canvas/index.js":_i,"./core/ui/custom-component/index.js":Ci,"./core/ui/interaction/index.js":Di,"./core/ui/menu/index.js":Ii,"./core/ui/navigation-bar/index.js":Bi,"./core/ui/pull-down-refresh/index.js":Gi,"./core/ui/scroll/index.js":Ji,"./core/ui/window/index.js":Xi,"./core/wxml/intersection-observer/index.js":Sn,"./core/wxml/selector-query/index.js":bn}),$i={};for(let e of Object.values(Qi))for(let[t,n]of Object.entries(e))$i[t]=n;var ea=new Proxy($i,{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)}}),ta=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[];if(e.length===0&&globalThis.name)try{e=JSON.parse(globalThis.name).apiNamespaces||[]}catch{}for(let t of[`dd`,`wx`,...e])globalThis[t]=ea;globalThis.modRequire=C,globalThis.modDefine=he,globalThis.global={},globalThis.App=e=>J.createAppModule(e),globalThis.Page=e=>{J.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Component=e=>{J.createModule(e,globalThis.__extraInfo,G.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>{let t=Y.app;return!t&&e?.allowDefault?{}:t},globalThis.getCurrentPages=()=>D.stack()}},na={navigateBack:Ce,navigateTo:Se,reLaunch:be,redirectTo:xe,switchTab:ye};return new class{constructor(){console.log(`[service] init`),this.env=ta,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),J.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 Y.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;Y.createApp({scene:n,pagePath:r,query:i});let o=J.getModuleByPath(r);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${r}`);return}let s=J.getPropsByPath(o.usingComponents),c=`page_${le()}`;Y.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`,()=>{Y.appShow()}),this.message.on(`appHide`,()=>{Y.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Y.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Y.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Y.createInstance(e)}),this.message.on(`mR`,e=>{Y.moduleReady(e)}),this.message.on(`mU`,e=>{Y.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Y.pageUnload(e)}),this.message.on(`pageShow`,e=>{Y.pageShow(e)}),this.message.on(`pageReady`,e=>{Y.pageReady(e)}),this.message.on(`pageHide`,e=>{Y.pageHide(e)}),this.message.on(`pagePullDownRefresh`,()=>{}),this.message.on(`pageReachBottom`,()=>{}),this.message.on(`pageShareAppMessage`,()=>{}),this.message.on(`pageScroll`,e=>{Y.pageScroll(e)}),this.message.on(`pageResize`,e=>{Y.pageResize(e)}),this.message.on(`onTabItemTap`,()=>{}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Y.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Y.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 Y.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}})}na[t]?.({url:n,...e.params})})}}})();
|
|
6
|
+
`;console.error(`require ${e} error: ${i}`),h(n)&&n({mod:e,errMsg:t.message})}r.exports=t.exports===void 0?i:t.exports}return h(t)&&t(r.exports),r.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=le()){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 n=this.callbacks[e];n&&h(n.callback)&&(n.callback(t),n.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 ge(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=ge(),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(){return this.stack().at(-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.at(-1);return e?e.pages:this.pushStack(Date.now()).pages}}},_e={getWindowInfo:()=>T.getSystemInfo(),getSystemInfoSync:()=>T.getSystemInfo(),getAppBaseInfo:()=>T.getSystemInfo(),getDeviceInfo:()=>T.getSystemInfo(),getMenuButtonBoundingClientRect:()=>T.getMenuRect()};function O(e,t,n=`container`){let r=_e[e];if(n===`container`&&r){let e=r();if(e)return e}let i;if(t===void 0||typeof t==`string`||Array.isArray(t))i=t;else if(h(t))i={success:w.store(t,!0)};else{let{success:e,fail:n,complete:r,keep:a,evtId:o,...s}=t;i=s,h(e)?i.success=w.store(e,a,o):i.success=e,h(n)&&(i.fail=w.store(n,a,o)),h(r)&&(i.complete=w.store(r,a,o))}let a={type:`invokeAPI`,target:n,body:{name:e,bridgeId:D.getPageInfo().id,params:i}};return n===`container`?E.invoke(a):E.send(a)}var ve=t({navigateBack:()=>Ce,navigateTo:()=>Se,reLaunch:()=>be,redirectTo:()=>xe,switchTab:()=>ye});function ye(e){e.url=y(D.getPageInfo().route,e.url),O(`switchTab`,e)}function be(e){e.url=y(D.getPageInfo().route,e.url),O(`reLaunch`,e)}function xe(e){let t=y(D.getPageInfo().route,e.url);D.getPageInfo().route!==t&&(e.url=t,O(`redirectTo`,e))}function Se(e){e.url=y(D.getPageInfo().route,e.url),O(`navigateTo`,e)}function Ce(e){O(`navigateBack`,e)}var we=t({offAppHide:()=>Ae,offAppShow:()=>ke,offError:()=>Ee,onAppHide:()=>Oe,onAppRoute:()=>Ne,onAppShow:()=>De,onError:()=>Te,onPageNotFound:()=>Me,onUnhandledRejection:()=>je});function Te(e){O(`onError`,e)}function Ee(e){O(`offError`,e)}function De(e){O(`onAppShow`,e)}function Oe(e){O(`onAppHide`,e)}function ke(e){O(`offAppShow`,e)}function Ae(e){O(`offAppHide`,e)}function je(){}function Me(){}function Ne(){}var Pe=t({canIUse:()=>Le,env:()=>Fe});function Fe(){return{USER_DATA_PATH:`difile://`}}var Ie=new Set([`nextTick`,`getUpdateManager`,`getPerformance`]);function Le(e){if(Ie.has(e))return!0;try{return O(`canIUse`,e)}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var Re=t({getPerformance:()=>ze});function ze(){return Be.getInstance()}var Be=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Ve,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){let t=new He(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}},Ve=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}},He=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 Ve;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}},Ue=t({loadSubpackage:()=>Ge,preDownloadSubpackage:()=>We});function We(e){O(`preDownloadSubpackage`,e)}function Ge(e){O(`loadSubpackage`,e)}var Ke=t({getAppBaseInfo:()=>$e,getDeviceInfo:()=>et,getSystemInfo:()=>Xe,getSystemInfoAsync:()=>Qe,getSystemInfoSync:()=>Ze,getWindowInfo:()=>Je,openAppAuthorizeSetting:()=>Ye,openSystemBluetoothSetting:()=>qe});function qe(e){O(`openSystemBluetoothSetting`,e)}function Je(e){return O(`getWindowInfo`,e)}function Ye(e){O(`openAppAuthorizeSetting`,e)}function Xe(e){return new Promise(t=>{t(O(`getSystemInfo`,e))})}function Ze(){return O(`getSystemInfoSync`)}function Qe(e){O(`getSystemInfoAsync`,e)}function $e(){return O(`getAppBaseInfo`)}function et(){return O(`getDeviceInfo`)}var tt=t({getUpdateManager:()=>nt});function nt(){return rt.getInstance()}var rt=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasApplyUpdate=!1,this.updateFailFlag=null,this.updateFailCbQueue=[],this.updateReadyCbQueue=[],this.updateReadyStatus=null,this.updateReadyFlag=!1,this.updateStatus=null,this.updateStatusCbQueue=[],E.on(`onUpdateStatusChange`,e=>{let{event:t,strategy:n}=e;t===`updatefail`?(this.updateFailFlag={},this.flashUpdateFailCb()):t===`updateready`?(this.updateReadyFlag=!0,this.updateReadyStatus={strategy:n},this.flushUpdateReadyCb()):t===`noupdate`?(this.updateStatus={hasUpdate:!0},this.flushUpdateStatusCb()):t===`updating`&&(this.updateStatus={hasUpdate:!1},this.flushUpdateStatusCb())}),e.#e=this}flashUpdateFailCb(){this.updateFailCbQueue.forEach(e=>{typeof e==`function`&&e()}),this.updateFailCbQueue.length=0}flushUpdateStatusCb(){this.updateStatusCbQueue.forEach(e=>{typeof e==`function`&&e(this.updateStatus)}),this.updateStatusCbQueue.length=0}flushUpdateReadyCb(){this.updateReadyCbQueue.forEach(e=>{typeof e==`function`&&e(this.updateReadyStatus)}),this.updateReadyCbQueue.length=0}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){this.updateReadyFlag&&this.hasApplyUpdate?console.error(`[applyUpdate]: applyUpdate has been called`):this.updateReadyFlag?O(`applyUpdate`):console.error(`[applyUpdate]: update is not ready`)}onCheckForUpdate(e){this.updateStatus?typeof e==`function`&&e(this.updateStatus):this.updateStatusCbQueue.push(e)}onUpdateFailed(e){this.updateFailFlag?typeof e==`function`&&e(this.updateFailFlag):this.updateFailCbQueue.push(e)}onUpdateReady(e){this.updateReadyFlag?typeof e==`function`&&e(this.updateReadyStatus):this.updateReadyCbQueue.push(e)}},it=t({createCameraContext:()=>at});function at(){return new ot}var ot=class{constructor(){this.bridgeId=D.getPageInfo().id}takePhoto(e){O(`takePhoto`,e)}startRecord(){O(`startRecord`)}stopRecord(){O(`stopRecord`)}},st=t({reportAnalytics:()=>ct,reportEvent:()=>lt});function ct(...e){O(`reportAnalytics`,e)}function lt(e,t){O(`reportAnalytics`,{eventId:e,data:t})}var ut=t({closeBluetoothAdapter:()=>xt,getBluetoothAdapterState:()=>bt,getBluetoothDevices:()=>yt,getConnectedBluetoothDevices:()=>vt,offBluetoothAdapterStateChange:()=>_t,offBluetoothDeviceFound:()=>gt,onBluetoothAdapterStateChange:()=>ht,onBluetoothDeviceFound:()=>mt,openBluetoothAdapter:()=>pt,startBluetoothDevicesDiscovery:()=>ft,stopBluetoothDevicesDiscovery:()=>dt});function dt(e){O(`stopBluetoothDevicesDiscovery`,e)}function ft(e){O(`startBluetoothDevicesDiscovery`,e)}function pt(e){O(`openBluetoothAdapter`,e)}function mt(e){O(`onBluetoothDeviceFound`,e)}function ht(e){O(`onBluetoothAdapterStateChange`,e)}function gt(){O(`offBluetoothDeviceFound`)}function _t(){O(`offBluetoothAdapterStateChange`)}function vt(e){O(`getConnectedBluetoothDevices`,e)}function yt(e){O(`getBluetoothDevices`,e)}function bt(e){O(`getBluetoothAdapterState`,e)}function xt(e){O(`closeBluetoothAdapter`,e)}var St=t({closeBLEConnection:()=>Ft,createBLEConnection:()=>Pt,getBLEDeviceCharacteristics:()=>Nt,getBLEDeviceRSSI:()=>Mt,getBLEDeviceServices:()=>jt,notifyBLECharacteristicValueChange:()=>At,offBLECharacteristicValueChange:()=>kt,offBLEConnectionStateChange:()=>Ot,onBLECharacteristicValueChange:()=>Dt,onBLEConnectionStateChange:()=>Et,readBLECharacteristicValue:()=>Tt,setBLEMTU:()=>wt,writeBLECharacteristicValue:()=>Ct});function Ct(e){O(`writeBLECharacteristicValue`,e)}function wt(e){O(`setBLEMTU`,e)}function Tt(e){O(`readBLECharacteristicValue`,e)}function Et(e){O(`onBLEConnectionStateChange`,e)}function Dt(e){O(`onBLECharacteristicValueChange`,e)}function Ot(e){O(`offBLEConnectionStateChange`,e)}function kt(){O(`offBLECharacteristicValueChange`)}function At(e){O(`notifyBLECharacteristicValueChange`,e)}function jt(e){O(`getBLEDeviceServices`,e)}function Mt(e){O(`getBLEDeviceRSSI`,e)}function Nt(e){O(`getBLEDeviceCharacteristics`,e)}function Pt(e){O(`createBLEConnection`,e)}function Ft(e){O(`closeBLEConnection`,e)}var It=t({getClipboardData:()=>Rt,setClipboardData:()=>Lt});function Lt(e){O(`setClipboardData`,e)}function Rt(e){O(`getClipboardData`,e)}var zt=t({addPhoneContact:()=>Vt,chooseContact:()=>Bt});function Bt(e){O(`chooseContact`,e)}function Vt(e){O(`addPhoneContact`,e)}var Ht=t({hideKeyboard:()=>Ut});function Ut(e){O(`hideKeyboard`,e)}var Wt=t({offMemoryWarning:()=>Kt,onMemoryWarning:()=>Gt});function Gt(e){O(`onMemoryWarning`,e)}function Kt(e){O(`offMemoryWarning`,e)}var qt=t({getNetworkType:()=>Jt});function Jt(e){O(`getNetworkType`,e)}var Yt=t({makePhoneCall:()=>Xt});function Xt(e){O(`makePhoneCall`,e)}var Zt=t({scanCode:()=>Qt});function Qt(e){O(`scanCode`,e)}var $t=t({vibrateLong:()=>tn,vibrateShort:()=>en});function en(e){O(`vibrateShort`,e)}function tn(e){O(`vibrateLong`,e)}var nn=t({extBridge:()=>rn,extOffBridge:()=>on,extOnBridge:()=>an,offLoginStatusChanged:()=>cn,onLoginStatusChanged:()=>sn});function rn({event:e,module:t,data:n={},success:r,fail:i,complete:a},o){let s,c,l;h(o)?(s=o,c=o):(s=r,c=i,l=a),O(e,{module:t,data:n,keep:n.isSustain??!0,success:s,fail:c,complete:l})}function an({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 on({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 sn(e){E.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function cn(){E.off(`notifyLoginStatusChanged`)}var ln=t({USER_DATA_PATH:()=>un,getFileSystemManager:()=>_n}),un=`difile://`,dn=`not supported in simulator`,fn=class{constructor(e){this.size=e.size||0,this.mode=e.mode||438,this.lastAccessedTime=e.lastAccessedTime||0,this.lastModifiedTime=e.lastModifiedTime||0,this._isFile=e.isFile===void 0?!0:e.isFile,this._isDirectory=e.isDirectory===void 0?!1:e.isDirectory}isFile(){return this._isFile}isDirectory(){return this._isDirectory}};function k(e){throw Error(`FileSystemManager.${e} ${dn}`)}function A(e,t={}){let{fail:n,complete:r}=t;n?.({errMsg:`${e}:fail ${dn}`}),r?.()}function pn(e){return e&&new fn(e)}function mn(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))t[n]=new fn(r);return t}var hn=class{access(e){O(`fsAccess`,e)}accessSync(){k(`accessSync`)}stat(e={}){let{success:t,recursive:n,...r}=e;O(`fsStat`,{...r,recursive:n,success:e=>{if(!t)return;let r=n?mn(e?.stats):pn(e?.stats);t({...e,stats:r})}})}statSync(){k(`statSync`)}readFile(e){O(`fsReadFile`,e)}readFileSync(){k(`readFileSync`)}writeFile(e){O(`fsWriteFile`,e)}writeFileSync(){k(`writeFileSync`)}appendFile(e){O(`fsAppendFile`,e)}appendFileSync(){k(`appendFileSync`)}copyFile(e){O(`fsCopyFile`,e)}copyFileSync(){k(`copyFileSync`)}rename(e){O(`fsRename`,e)}renameSync(){k(`renameSync`)}unlink(e){O(`fsUnlink`,e)}unlinkSync(){k(`unlinkSync`)}mkdir(e){O(`fsMkdir`,e)}mkdirSync(){k(`mkdirSync`)}rmdir(e){O(`fsRmdir`,e)}rmdirSync(){k(`rmdirSync`)}readdir(e){O(`fsReaddir`,e)}readdirSync(){k(`readdirSync`)}getFileInfo(e){O(`fsGetFileInfo`,e)}saveFile(e){O(`fsSaveFile`,e)}saveFileSync(){k(`saveFileSync`)}getSavedFileList(e){O(`fsGetSavedFileList`,e)}removeSavedFile(e){O(`fsRemoveSavedFile`,e)}truncate(e){O(`fsTruncate`,e)}truncateSync(){k(`truncateSync`)}unzip(e){O(`fsUnzip`,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)}},gn;function _n(){return gn||=new hn,gn}var vn=[`onLaunch`,`onShow`,`onHide`],yn=[`globalData`],bn=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(){vn.forEach(e=>{let t=this.appModule.moduleInfo[e];h(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)vn.includes(t)||yn.includes(t)||(h(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?.()}},xn=t({createSelectorQuery:()=>j});function j(){return new Sn}var Sn=class{constructor(){this.__componentId=D.getPageInfo().id,this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new M(this,this.__componentId,e,!0)}selectAll(e){return new M(this,this.__componentId,e,!1)}selectViewport(){return new M(this,D.getPageInfo().id,``,!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;O(`selectorQuery`,{tasks:this.__taskQueue,success:n=>{n.forEach((e,n)=>{let r=t.__cbQueue[n];h(r)&&r.call(t,e)}),h(e)&&e.call(t,n)}},`render`)}},M=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)}},Cn=t({createIntersectionObserver:()=>wn});function wn(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Tn(e,{thresholds:n,initialRatio:r,observeAll:i})}var Tn=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}},N=new Map;function P(e){return N.has(e)||N.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),N.get(e)}function F(e,t){let n=(Array.isArray(t)?t:[t]).filter(h);if(n.length!==0)return w.store(()=>{n.forEach(t=>t.call(e))})}function En(e){let t=P(e);t.depth++}function Dn(e){let t=P(e);t.depth>0&&t.depth--,t.depth===0&&On(e)}function I(e,t,n,r){let i=P(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&&On(e)}))}function On(e){let t=N.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 kn(e){let t=e.__mpxProxy?.options?.computed;if(t)for(let n of Object.keys(t))Object.hasOwn(e.data,n)||(e.data[n]=null)}function L(e){return oe(e)?e:Object.entries(e).reduce((e,[t,n])=>t.startsWith(`$`)?e:h(n)?(console.warn(`[service] 值不支持函数引用`,t),e):(Array.isArray(n)?e[t]=n.map(e=>typeof e==`object`&&e?e instanceof Date?e.getTime():L(e):e):n&&typeof n==`object`&&!Array.isArray(n)?n instanceof Date?e[t]=n.getTime():e[t]=L(n):e[t]=n,e),{})}function An(e){if(e){let t={};for(let n in e){let r=e[n];t[n]=t[n]||{};let i=R(r&&typeof r==`object`&&Object.hasOwn(r,`type`)?r.type:r),a=null;if(a=Array.isArray(i)?[...i]:[i],r&&r.optionalTypes){let e=R(r.optionalTypes);Array.isArray(e)?a=[...e]:a.push(e)}t[n].type=a,t[n].type.length>0&&(r&&h(r.value)?t[n].default=r.value():r&&(t[n].default=r.value))}return t}}var jn=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`],[Function,`f`]]);function R(e){return Array.isArray(e)?e.map(e=>R(e)):e===null||e===``?null:jn.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function Mn(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 Nn(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 Pn(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,ue(n),de(n),r];for(let t of i)if(t&&e[t]!==void 0)return e[t]}function z(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=>{Nn(r,{[i]:t},e.data,e,n[r])})}}function Fn(e,t,n){B(e,t,n)}function In(e,t,n){let r=[];for(let i of t){let t=e.__info__.properties?.[i]?.observer,a=e.data[i],o=n[i];ae(t)?r.push(()=>e[t]?.(a,o)):h(t)&&r.push(()=>t.call(e,a,o))}return r}function B(e,t,n){In(e,t,n).reverse().forEach(e=>e())}function Ln(e,t){if(!Array.isArray(t))return;let n=new WeakMap;function r(e,t){let n={...e};for(let e in t)if(Object.hasOwn(t,e)){let i=n[e],a=t[e];i&&typeof i==`object`&&!Array.isArray(i)&&a&&typeof a==`object`&&!Array.isArray(a)?n[e]=r(i,a):n[e]=a}return n}function i(e,t){if(typeof t==`string`){a(e,t);return}if(!t||typeof t!=`object`||n.has(t))return;n.set(t,!0),Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>i(e,t)),t.properties&&(e.properties={...t.properties,...e.properties}),t.data&&(e.data||={},e.data=r(t.data,e.data));let o=[`created`,`attached`,`ready`,`detached`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let n of o)h(t[n])&&(e.behaviorLifetimes[n]=e.behaviorLifetimes[n]||[],e.behaviorLifetimes[n].push(t[n]));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 n of[`show`,`hide`,`resize`,`routeDone`])h(t.pageLifetimes[n])&&(e.behaviorPageLifetimes[n]=e.behaviorPageLifetimes[n]||[],e.behaviorPageLifetimes[n].push(t.pageLifetimes[n]))}}function a(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=>i(e,t))}function V(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 H(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.hasOwn(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function Rn(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 zn(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 U(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!V(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&&Rn(i,n)&&(o[r]=zn(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 Bn=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],Vn=[`show`,`hide`,`resize`,`routeDone`],Hn=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=pe(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.hasOwn(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(()=>{kn(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__=[],I(this.bridgeId,this.__id__,{},F(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&h(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(J.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(J.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(J.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,n){let r=this.__relations__.get(e)||[];if(!r.includes(t)&&(r.push(t),this.__relations__.set(e,r),h(n.linked)))try{n.linked.call(this,t)}catch(e){console.error(`[service] relation linked error:`,e)}}#l(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);if(i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),h(n.unlinked)))try{n.unlinked.call(this,t)}catch(e){console.error(`[service] relation unlinked error:`,e)}}#u(e,t,n){if(h(n.linkChanged))try{n.linkChanged.call(this,t)}catch(e){console.error(`[service] relation linkChanged error:`,e)}}setData(e,t){let n=L(e),r={};for(let e in n)r[e]=this.data[e],ce(this.data,e,n[e]);if(this.__info__.observers&&Mn(Object.keys(n),this.__info__.observers,this.data,this,r),z(this,Object.keys(n),r),Fn(this,Object.keys(n),r),!this.initd){h(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}if(this.__groupSetDataMode__){for(let e in n)this.__groupSetDataBuffer__[e]=n[e];h(t)&&this.__groupSetDataCallbacks__.push(t);return}let i=U(this,J.instances[this.bridgeId],n);I(this.bridgeId,this.__id__,n,F(this,t)),i.forEach(({child:e,data:t})=>{I(this.bridgeId,e.__id__,t)})}#d(){Bn.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];h(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&Vn.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];h(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)h(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 n=this.__info__.properties[t]?.observer,r=this.data[t];ae(n)?e.push(()=>this[n]?.(r,void 0)):h(n)&&e.push(()=>n.call(this,r,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.hasOwn(this.__pendingSyncedProps__,n)&&se(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(()=>Nn(e,this.__info__.observers,this.data,this,t))}n.forEach(e=>e()),z(this,Object.keys(t),Object.fromEntries(Object.keys(t).map(e=>[e,void 0]))),B(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 j().in(this)}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]),n=t.find(n=>V(n,this.__id__,t)&&H(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]);return t.filter(n=>V(n,this.__id__,t)&&H(e,n))}selectOwnerComponent(){let e=Object.values(J.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return wn(this,e)}groupSetData(e){if(!h(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,En(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=U(this,J.instances[this.bridgeId],e);I(this.bridgeId,this.__id__,e,F(this,t)),n.forEach(({child:e,data:t})=>{I(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataCallbacks__=[];Dn(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=Pn(this.__eventAttr__,r);i&&await J.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 J.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(J.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,n]of t.__relations__.entries()){let r=n.indexOf(this);if(r!==-1){n.splice(r,1),t.__relations__.set(e,n);let i=t.__info__.relations?.[e];if(i&&h(i.unlinked))try{i.unlinked.call(t,this)}catch(e){console.error(`[service] relation unlinked error:`,e)}}}}componentError(e){this.error?.(e)}},W=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,Ln(this.moduleInfo,this.behaviors),this.noReferenceData=L(this.moduleInfo.data||{})}getProps(){let e=An(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}},Un=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=pe(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(()=>{kn(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__=[],I(this.bridgeId,this.__id__,{},F(this,e))}setData(e,t){let n=L(e),r={},i=this.__info__||{};for(let e in n)r[e]=this.data[e],ce(this.data,e,n[e]);if(i.observers&&Mn(Object.keys(n),i.observers,this.data,this,r),z(this,Object.keys(n),r),!this.initd){h(t)&&this.__pendingInitSetDataCallbacks__.push(t);return}let a=U(this,J.instances[this.bridgeId],n);I(this.bridgeId,this.__id__,n,F(this,t)),a.forEach(({child:e,data:t})=>{I(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return j().in(this)}selectComponent(e){let t=Object.values(J.instances[this.bridgeId]||{}),n=t.find(n=>V(n,this.__id__,t)&&H(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(J.instances[this.bridgeId]||{});return t.filter(n=>V(n,this.__id__,t)&&H(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];h(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)}},G=class e{static type=`page`;constructor(t,n){if(this.moduleInfo=t,this.extraInfo=n,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,Ln(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&h(t)&&(this.moduleInfo[e]=t);this.noReferenceData=L(this.moduleInfo.data||{})}},K=class{static type=`app`;constructor(e){this.moduleInfo=e}},q=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 K(e);this.staticModules[K.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===G.type){let n=new G(e,t);this.staticModules[r]=n}else if(n===W.type){let n=new W(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[K.type]}getModuleByPath(e){return this.staticModules[e]}},J=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:n,methodName:r,event:i}){if(h(e[r]))return await e[r](i);console.warn(`[service] triggerEvent ${t} ${n}, is: ${e.is}, method: ${r} 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=q.getAppModule();if(!i){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),this.app=new bn(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=q.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===W.type){let e=new Hn(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===G.type){let e=new Un(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__===W.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__===W.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__===G.type?r.push(e):e.__type__===W.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__===G.type||e.__type__===W.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__===W.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__===G.type?r.push(e):e.__type__===W.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__===W.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__===G.type?e.pageResize(n):e.__type__===W.type&&(e.__isComponent__,e.pageResize(n)))})}componentError(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t][n];r&&r.__type__===W.type&&r.componentError()}componentRouteDone(e){let{bridgeId:t}=e,n=this.instances[t];n&&Object.values(n).forEach(e=>{e?.__type__===W.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__===W.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})}},Wn=t({getEnterOptionsSync:()=>Kn,getLaunchOptionsSync:()=>Gn});function Gn(){return J.app?.options}function Kn(){return J.app?.options}var qn=t({getLocation:()=>Jn,offLocationChange:()=>$n,onLocationChange:()=>Qn,openLocation:()=>Xn,startLocationUpdate:()=>Yn,stopLocationUpdate:()=>Zn});function Jn(e){O(`getLocation`,e)}function Yn(e){O(`startLocationUpdate`,e)}function Xn(e){O(`openLocation`,e)}function Zn(e){O(`stopLocationUpdate`,e)}function Qn(e){e&&O(`onLocationChange`,{success:w.store(e,!0)})}function $n(e){if(e){let t=w.store(e,!0);O(`offLocationChange`,{success:t}),w.remove(t)}else O(`offLocationChange`),w.remove()}var er=t({createMapContext:()=>tr});function tr(e,t){return new nr({mapId:e,obj:t})}var nr=class{constructor(e){this.opts=e}addMarkers(e){O(`addMarkers`,e)}removeMarkers(e){O(`removeMarkers`,e)}includePoints(e){O(`includePoints`,e)}setCenterOffset(e){O(`setCenterOffset`,e)}getCenterLocation(e){O(`getCenterLocation`,e)}getScale(e){O(`getScale`,e)}moveToLocation(e){O(`moveToLocation`,e)}translateMarker(e){O(`translateMarker`,e)}addArc(e){O(`addArc`,e)}removeArc(e){O(`removeArc`,e)}},rr=t({createInnerAudioContext:()=>or}),ir=1,ar=class{constructor(){this._audioId=ir++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._paused=!0,this._listeners={},O(`audioCreate`,{audioId:this._audioId})}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 0}get currentTime(){return 0}get paused(){return this._paused}get buffered(){return 0}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 or(){return new ar}var sr=t({chooseImage:()=>dr,compressImage:()=>ur,previewImage:()=>lr,saveImageToPhotosAlbum:()=>cr});function cr(e){O(`saveImageToPhotosAlbum`,e)}function lr(e){O(`previewImage`,e)}function ur(e){O(`compressImage`,e)}function dr(e){O(`chooseImage`,e)}var fr=t({chooseMedia:()=>mr,chooseVideo:()=>pr});function pr(e){O(`chooseVideo`,e)}function mr(e){O(`chooseMedia`,e)}var hr=t({exitMiniProgram:()=>yr,navigateBackMiniProgram:()=>vr,navigateToMiniProgram:()=>_r,restartMiniProgram:()=>gr});function gr(e){O(`restartMiniProgram`,e)}function _r(e){O(`navigateToMiniProgram`,e)}function vr(e){O(`navigateBackMiniProgram`,e)}function yr(e){O(`exitMiniProgram`,e)}var br=t({downloadFile:()=>xr});function xr(e){O(`downloadFile`,e)}var Sr=t({request:()=>Cr});function Cr(e){O(`request`,e)}var wr=t({uploadFile:()=>Tr});function Tr(e){O(`uploadFile`,e)}var Er=t({closeSocket:()=>kr,connectSocket:()=>Dr,onSocketClose:()=>Nr,onSocketError:()=>Mr,onSocketMessage:()=>jr,onSocketOpen:()=>Ar,sendSocketMessage:()=>Or}),Y=class{constructor(e){this.socketId=e,this._readyState=0}send(e={}){let{data:t,success:n,fail:r,complete:i,...a}=e,o={socketId:this.socketId,data:t,...a};return h(n)&&(o.success=w.store(n)),h(r)&&(o.fail=w.store(r)),h(i)&&(o.complete=w.store(i)),O(`sendSocketMessage`,o)}close(e={}){let{code:t=1e3,reason:n=``,success:r,fail:i,complete:a,...o}=e,s={socketId:this.socketId,code:t,reason:n,...o};return h(r)&&(s.success=w.store(r)),h(i)&&(s.fail=w.store(i)),h(a)&&(s.complete=w.store(a)),O(`closeSocket`,s)}onOpen(e){if(h(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(h(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(h(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(h(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 Dr(e={}){let{url:t,header:n={},protocols:r=[],tcpNoDelay:i=!1,perMessageDeflate:a=!1,timeout:o,forceCellularNetwork:s=!1,success:c,fail:l,complete:u,...d}=e;if(!t){let e=Error(`url is required`);throw h(l)&&l(e),h(u)&&u(e),e}let f=`socket_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,p=new Y(f),m={socketId:f,url:t,header:n,protocols:r,tcpNoDelay:i,perMessageDeflate:a,timeout:o,forceCellularNetwork:s,...d};return h(c)&&(m.success=w.store(e=>{p._readyState=Y.OPEN,c(e)})),h(l)&&(m.fail=w.store(e=>{p._readyState=Y.CLOSED,l(e)})),h(u)&&(m.complete=w.store(u)),O(`connectSocket`,m),p}function Or(e){return O(`sendSocketMessage`,e)}function kr(e){return O(`closeSocket`,e)}function Ar(e){return O(`onSocketOpen`,{callback:w.store(e,!0)})}function jr(e){return O(`onSocketMessage`,{callback:w.store(e,!0)})}function Mr(e){return O(`onSocketError`,{callback:w.store(e,!0)})}function Nr(e){return O(`onSocketClose`,{callback:w.store(e,!0)})}var Pr=t({getAccountInfoSync:()=>Fr});function Fr(){return O(`getAccountInfoSync`)}var Ir=t({authorize:()=>Lr});function Lr(e){O(`authorize`,e)}var Rr=t({login:()=>zr});function zr(e){O(`login`,e)}var Br=t({login:()=>Vr});function Vr(e){O(`login`,e)}var Hr=t({getPrivacySetting:()=>Ur});function Ur(e){O(`getPrivacySetting`,e)}var Wr=t({getSetting:()=>Kr,openSetting:()=>Gr});function Gr(e){O(`openSetting`,e)}function Kr(e){O(`getSetting`,e)}var qr=t({getUserInfo:()=>Jr});function Jr(e){O(`getUserInfo`,e)}var Yr=t({requestPayment:()=>Xr});function Xr(e){O(`requestPayment`,e)}var Zr=t({hideShareMenu:()=>ei,showShareImageMenu:()=>$r,showShareMenu:()=>Qr});function Qr(e){O(`shareShareMenu`,e)}function $r(e){O(`showShareImageMenu`,e)}function ei(e){O(`hideShareMenu`,e)}var ti=t({clearStorage:()=>li,clearStorageSync:()=>ai,getStorage:()=>si,getStorageInfo:()=>di,getStorageInfoSync:()=>ui,getStorageSync:()=>ri,removeStorage:()=>ci,removeStorageSync:()=>ii,setStorage:()=>oi,setStorageSync:()=>ni});function ni(...e){O(`setStorageSync`,e)}function ri(e){return O(`getStorageSync`,e)}function ii(e){return O(`removeStorageSync`,e)}function ai(){O(`clearStorageSync`)}function oi(e){O(`setStorage`,e)}function si(e){O(`getStorage`,e)}function ci(e){O(`removeStorage`,e)}function li(){O(`clearStorage`)}function ui(){return O(`getStorageInfoSync`)}function di(e){O(`getStorageInfo`,e)}var fi=t({createAnimation:()=>pi});function pi(e={}){return new mi(e)}var mi=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,ee=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,ee]}),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}},hi=t({setBackgroundColor:()=>_i,setBackgroundTextStyle:()=>gi});function gi(e){O(`setBackgroundTextStyle`,e)}function _i(e){O(`setBackgroundColor`,e)}var vi=t({canvasToTempFilePath:()=>Si,createCanvasContext:()=>bi,createContext:()=>yi,drawCanvas:()=>xi});function yi(){return new Ci}function bi(e,t){return new Ci(e,X(t))}function xi(e={}){let t={...e,moduleId:e.moduleId||X(e.component)};delete t.component,O(`drawCanvas`,t,`render`)}function Si(e={},t){let n={...e,moduleId:e.moduleId||X(t||e.component)};delete n.component,O(`canvasToTempFilePath`,n,`render`)}function X(e){return e?.__id__||D.getPageInfo()?.id}var Ci=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&&(xi({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)}},wi=t({nextTick:()=>Di}),Z=[],Ti=null;function Ei(){let e=Z;Z=[],Ti=null;for(let t=0;t<e.length;t++)e[t]()}function Di(e){h(e)&&(Z.push(e),Ti||=setTimeout(Ei,0))}var Oi=t({disableAlertBeforeUnload:()=>Ii,enableAlertBeforeUnload:()=>Fi,hideLoading:()=>Pi,hideToast:()=>Ai,showActionSheet:()=>Ni,showLoading:()=>Mi,showModal:()=>ji,showToast:()=>ki});function ki(e){O(`showToast`,e)}function Ai(e){O(`hideToast`,e)}function ji(e){O(`showModal`,e)}function Mi(e){O(`showLoading`,e)}function Ni(e){O(`showActionSheet`,e)}function Pi(e){O(`hideLoading`,e)}function Fi(e){O(`enableAlertBeforeUnload`,e)}function Ii(e){O(`disableAlertBeforeUnload`,e)}var Li=t({getMenuButtonBoundingClientRect:()=>Ri,offMenuButtonBoundingClientRectWeightChange:()=>Bi,onMenuButtonBoundingClientRectWeightChange:()=>zi}),Q=new Set;function Ri(){return O(`getMenuButtonBoundingClientRect`)}function zi(e){h(e)&&Q.add(e)}function Bi(e){h(e)?Q.delete(e):Q.clear()}var Vi=t({hideNavigationBarLoading:()=>Gi,setNavigationBarColor:()=>Wi,setNavigationBarTitle:()=>Ui,showNavigationBarLoading:()=>Hi});function Hi(e){O(`showNavigationBarLoading`,e)}function Ui(e){O(`setNavigationBarTitle`,e)}function Wi(e){O(`setNavigationBarColor`,e)}function Gi(e){O(`hideNavigationBarLoading`,e)}var Ki=t({startPullDownRefresh:()=>Ji,stopPullDownRefresh:()=>qi});function qi(e){O(`stopPullDownRefresh`,e)}function Ji(e){O(`startPullDownRefresh`,e)}var Yi=t({pageScrollTo:()=>Xi});function Xi(e){O(`pageScrollTo`,e)}var Zi=t({hideTabBar:()=>ta,hideTabBarRedDot:()=>aa,removeTabBarBadge:()=>ra,setTabBarBadge:()=>na,setTabBarItem:()=>$i,setTabBarStyle:()=>Qi,showTabBar:()=>ea,showTabBarRedDot:()=>ia});function Qi(e){O(`setTabBarStyle`,e)}function $i(e){O(`setTabBarItem`,e)}function ea(e){O(`showTabBar`,e)}function ta(e){O(`hideTabBar`,e)}function na(e){O(`setTabBarBadge`,e)}function ra(e){O(`removeTabBarBadge`,e)}function ia(e){O(`showTabBarRedDot`,e)}function aa(e){O(`hideTabBarRedDot`,e)}var oa=t({onWindowResize:()=>sa});function sa(e){e&&O(`onWindowResize`,{success:e})}var ca=Object.assign({"./core/base/app-event/index.js":we,"./core/base/index.js":Pe,"./core/base/performance/index.js":Re,"./core/base/subpackage/index.js":Ue,"./core/base/system/index.js":Ke,"./core/base/update/index.js":tt,"./core/camera/index.js":it,"./core/data-analysis/index.js":st,"./core/device/bluetooth/index.js":ut,"./core/device/bluetooth-ble/index.js":St,"./core/device/clipboard/index.js":It,"./core/device/contact/index.js":zt,"./core/device/keyboard/index.js":Ht,"./core/device/memory/index.js":Wt,"./core/device/network/index.js":qt,"./core/device/phone/index.js":Yt,"./core/device/scan/index.js":Zt,"./core/device/vibrate/index.js":$t,"./core/ext/index.js":nn,"./core/file/index.js":ln,"./core/life-cycle/index.js":Wn,"./core/location/index.js":qn,"./core/map/index.js":er,"./core/media/audio/index.js":rr,"./core/media/image/index.js":sr,"./core/media/video/index.js":fr,"./core/navigate/index.js":hr,"./core/network/download/index.js":br,"./core/network/request/index.js":Sr,"./core/network/upload/index.js":wr,"./core/network/websocket/index.js":Er,"./core/open-api/account-info/index.js":Pr,"./core/open-api/authorize/index.js":Ir,"./core/open-api/index.js":Rr,"./core/open-api/login/index.js":Br,"./core/open-api/privacy/index.js":Hr,"./core/open-api/setting/index.js":Wr,"./core/open-api/user-info/index.js":qr,"./core/payment/index.js":Yr,"./core/route/index.js":ve,"./core/share/index.js":Zr,"./core/storage/index.js":ti,"./core/ui/animation/index.js":fi,"./core/ui/background/index.js":hi,"./core/ui/canvas/index.js":vi,"./core/ui/custom-component/index.js":wi,"./core/ui/interaction/index.js":Oi,"./core/ui/menu/index.js":Li,"./core/ui/navigation-bar/index.js":Vi,"./core/ui/pull-down-refresh/index.js":Ki,"./core/ui/scroll/index.js":Yi,"./core/ui/tab-bar/index.js":Zi,"./core/ui/window/index.js":oa,"./core/wxml/intersection-observer/index.js":Cn,"./core/wxml/selector-query/index.js":xn}),$={};for(let e of Object.values(ca))for(let[t,n]of Object.entries(e))$[t]=n;var la=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)}}),ua=new class{constructor(){this.init()}init(){let e=globalThis.__diminaApiNamespaces||[];if(e.length===0&&globalThis.name)try{e=JSON.parse(globalThis.name).apiNamespaces||[]}catch{}for(let t of[`dd`,`wx`,...e])globalThis[t]=la;globalThis.modRequire=C,globalThis.modDefine=he,globalThis.global={},globalThis.App=e=>q.createAppModule(e),globalThis.Page=e=>{q.createModule(e,globalThis.__extraInfo,G.type)},globalThis.Component=e=>{q.createModule(e,globalThis.__extraInfo,W.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>{let t=J.app;return!t&&e?.allowDefault?{}:t},globalThis.getCurrentPages=()=>D.stack()}},da={navigateBack:Ce,navigateTo:Se,reLaunch:be,redirectTo:xe,switchTab:ye};return new class{constructor(){console.log(`[service] init`),this.env=ua,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),q.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 J.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;J.createApp({scene:n,pagePath:r,query:i});let o=q.getModuleByPath(r);if(!o){console.error(`[service] resourceLoaded: module not found, pagePath: ${r}`);return}let s=q.getPropsByPath(o.usingComponents),c=`page_${le()}`;J.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`,()=>{J.appShow()}),this.message.on(`appHide`,()=>{J.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{J.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{J.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{J.createInstance(e)}),this.message.on(`mR`,e=>{J.moduleReady(e)}),this.message.on(`mU`,e=>{J.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{J.pageUnload(e)}),this.message.on(`pageShow`,e=>{J.pageShow(e)}),this.message.on(`pageReady`,e=>{J.pageReady(e)}),this.message.on(`pageHide`,e=>{J.pageHide(e)}),this.message.on(`pagePullDownRefresh`,()=>{}),this.message.on(`pageReachBottom`,()=>{}),this.message.on(`pageShareAppMessage`,()=>{}),this.message.on(`pageScroll`,e=>{J.pageScroll(e)}),this.message.on(`pageResize`,e=>{J.pageResize(e)}),this.message.on(`onTabItemTap`,()=>{}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;J.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{J.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 J.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}})}da[t]?.({url:n,...e.params})})}}})();
|
package/fe/index.js
CHANGED
|
@@ -69,18 +69,37 @@ export async function start({ port = 7788, containerDir, outputDir, simulatorDir
|
|
|
69
69
|
if (simulatorDir && fs.existsSync(simulatorDir)) {
|
|
70
70
|
app.use('/simulator', express.static(simulatorDir))
|
|
71
71
|
app.get('/simulator.html', (_req, res) => {
|
|
72
|
-
|
|
72
|
+
// `send` defaults to dotfiles: 'ignore' and rejects absolute paths whose
|
|
73
|
+
// parent segments start with '.' (git worktrees under .bare/, hidden
|
|
74
|
+
// caches, etc.) — even though the file itself is not a dotfile.
|
|
75
|
+
res.sendFile(path.join(simulatorDir, 'simulator.html'), { dotfiles: 'allow' })
|
|
73
76
|
})
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
// Load proxy server middleware (cors, json, /proxy route)
|
|
77
80
|
await import('./dimina-fe-server/index.js')
|
|
78
81
|
|
|
79
|
-
// SPA fallback: serve index.html for
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// SPA fallback: serve index.html for navigation-like unmatched routes
|
|
83
|
+
// (no extension or `.html`). Asset-like misses (`.json`, `.js`, `.wxml`,
|
|
84
|
+
// `.css`, source maps, …) must return a real 404 — never HTML. The
|
|
85
|
+
// container's runtime does
|
|
86
|
+
// fetch(url).then(r => r.text()).then(JSON.parse)
|
|
87
|
+
// for manifests like `<appId>/main/app-config.json`, and serving the SPA
|
|
88
|
+
// shell for such a miss makes `initApp()` die with
|
|
89
|
+
// `SyntaxError: Unexpected token '<', "<!doctype "…` inside an un-
|
|
90
|
+
// handled promise rejection.
|
|
91
|
+
// Express 5 requires a named wildcard parameter instead of bare '*'.
|
|
92
|
+
const spaFallback = liveReload
|
|
93
|
+
? liveReloadModule.injectScript(containerDir)
|
|
94
|
+
: (_req, res) => res.sendFile('index.html', { root: containerDir })
|
|
95
|
+
|
|
96
|
+
app.get('/{*path}', (req, res, next) => {
|
|
97
|
+
const ext = path.extname(req.path).toLowerCase()
|
|
98
|
+
if (ext && ext !== '.html') {
|
|
99
|
+
res.status(404).type('text/plain').set('cache-control', 'no-store').send('Not Found')
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
return spaFallback(req, res, next)
|
|
84
103
|
})
|
|
85
104
|
|
|
86
105
|
return new Promise((resolve, reject) => {
|