@dimina-kit/devtools 0.4.0-dev.20260828161241 → 0.4.0-dev.20260907055341

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.
Files changed (277) hide show
  1. package/README.md +52 -729
  2. package/dist/main/app/app.d.ts +27 -7
  3. package/dist/main/app/app.js +285 -681
  4. package/dist/main/app/editor-view.d.ts +21 -0
  5. package/dist/main/app/editor-view.js +71 -0
  6. package/dist/main/app/global-mirrors.d.ts +23 -0
  7. package/dist/main/app/global-mirrors.js +37 -0
  8. package/dist/main/app/host-sidebar-default.d.ts +19 -0
  9. package/dist/main/app/host-sidebar-default.js +44 -0
  10. package/dist/main/app/menu-setup.d.ts +13 -0
  11. package/dist/main/app/menu-setup.js +49 -0
  12. package/dist/main/app/open-project-ipc.d.ts +13 -0
  13. package/dist/main/app/open-project-ipc.js +21 -0
  14. package/dist/main/app/project-list-surface.d.ts +31 -0
  15. package/dist/main/app/project-list-surface.js +20 -0
  16. package/dist/main/app/project-window.d.ts +36 -0
  17. package/dist/main/app/project-window.js +93 -0
  18. package/dist/main/app/servers.d.ts +17 -0
  19. package/dist/main/app/servers.js +60 -0
  20. package/dist/main/app/ui-extension-targets.d.ts +42 -0
  21. package/dist/main/app/ui-extension-targets.js +101 -0
  22. package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
  23. package/dist/main/app/window-close-reveal.harness.js +65 -0
  24. package/dist/main/app/window-events.d.ts +15 -0
  25. package/dist/main/app/window-events.js +45 -0
  26. package/dist/main/app/window-runtime-services.d.ts +41 -0
  27. package/dist/main/app/window-runtime-services.js +178 -0
  28. package/dist/main/app/workbench-modules.d.ts +24 -0
  29. package/dist/main/app/workbench-modules.js +51 -0
  30. package/dist/main/app/workbench-window.d.ts +85 -0
  31. package/dist/main/app/workbench-window.js +310 -0
  32. package/dist/main/index.bundle.js +10669 -9096
  33. package/dist/main/ipc/app.d.ts +4 -1
  34. package/dist/main/ipc/app.js +4 -3
  35. package/dist/main/ipc/device-picker.d.ts +16 -0
  36. package/dist/main/ipc/device-picker.js +27 -0
  37. package/dist/main/ipc/index.d.ts +1 -0
  38. package/dist/main/ipc/index.js +1 -0
  39. package/dist/main/ipc/internal-devtools.d.ts +2 -1
  40. package/dist/main/ipc/internal-devtools.js +4 -3
  41. package/dist/main/ipc/popover.d.ts +4 -1
  42. package/dist/main/ipc/popover.js +25 -9
  43. package/dist/main/ipc/project-create.d.ts +2 -1
  44. package/dist/main/ipc/project-create.js +6 -5
  45. package/dist/main/ipc/project-fs.d.ts +3 -1
  46. package/dist/main/ipc/project-fs.js +17 -17
  47. package/dist/main/ipc/projects.d.ts +3 -3
  48. package/dist/main/ipc/projects.js +13 -12
  49. package/dist/main/ipc/session.d.ts +4 -1
  50. package/dist/main/ipc/session.js +16 -11
  51. package/dist/main/ipc/settings.d.ts +4 -1
  52. package/dist/main/ipc/settings.js +12 -19
  53. package/dist/main/ipc/simulator-module.d.ts +5 -0
  54. package/dist/main/ipc/simulator-module.js +9 -5
  55. package/dist/main/ipc/simulator.d.ts +4 -1
  56. package/dist/main/ipc/simulator.js +12 -18
  57. package/dist/main/ipc/tooltip.d.ts +2 -1
  58. package/dist/main/ipc/tooltip.js +8 -7
  59. package/dist/main/ipc/views.d.ts +4 -1
  60. package/dist/main/ipc/views.js +20 -9
  61. package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +2 -20
  62. package/dist/main/runtime/devtools-backend-before-quit.harness.js +14 -283
  63. package/dist/main/runtime/devtools-backend.js +14 -3
  64. package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
  65. package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
  66. package/dist/main/services/app-services.d.ts +62 -0
  67. package/dist/main/services/app-services.js +64 -0
  68. package/dist/main/services/automation/connection-target.d.ts +36 -0
  69. package/dist/main/services/automation/connection-target.js +29 -0
  70. package/dist/main/services/automation/console-bridge.d.ts +28 -0
  71. package/dist/main/services/automation/console-bridge.js +91 -0
  72. package/dist/main/services/automation/handlers/app.js +4 -4
  73. package/dist/main/services/automation/handlers/element.js +55 -21
  74. package/dist/main/services/automation/index.d.ts +12 -1
  75. package/dist/main/services/automation/index.js +54 -133
  76. package/dist/main/services/default-adapter.js +1 -1
  77. package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
  78. package/dist/main/services/fs-bridge-protocol.js +34 -0
  79. package/dist/main/services/fs-watch-sse.d.ts +8 -1
  80. package/dist/main/services/fs-watch-sse.js +19 -5
  81. package/dist/main/services/mcp/connection-owner.d.ts +38 -0
  82. package/dist/main/services/mcp/connection-owner.js +79 -0
  83. package/dist/main/services/mcp/index.d.ts +3 -1
  84. package/dist/main/services/mcp/index.js +4 -3
  85. package/dist/main/services/mcp/opened-project.d.ts +88 -0
  86. package/dist/main/services/mcp/opened-project.js +60 -0
  87. package/dist/main/services/mcp/target-manager.d.ts +71 -23
  88. package/dist/main/services/mcp/target-manager.js +269 -142
  89. package/dist/main/services/mcp/target-selection.d.ts +47 -0
  90. package/dist/main/services/mcp/target-selection.js +71 -0
  91. package/dist/main/services/mcp/tools/context-tools.js +20 -5
  92. package/dist/main/services/mcp/tools/project-tools.d.ts +29 -6
  93. package/dist/main/services/mcp/tools/project-tools.js +37 -25
  94. package/dist/main/services/module.d.ts +13 -5
  95. package/dist/main/services/notifications/renderer-notifier.d.ts +28 -4
  96. package/dist/main/services/notifications/renderer-notifier.js +15 -3
  97. package/dist/main/services/projects/local-provider.js +2 -0
  98. package/dist/main/services/projects/project-repository.d.ts +31 -1
  99. package/dist/main/services/projects/project-repository.js +144 -20
  100. package/dist/main/services/projects/types.d.ts +31 -8
  101. package/dist/main/services/safe-area/index.d.ts +19 -5
  102. package/dist/main/services/safe-area/index.js +38 -13
  103. package/dist/main/services/simulator/ui-extensions.d.ts +8 -0
  104. package/dist/main/services/simulator/ui-extensions.js +16 -6
  105. package/dist/main/services/simulator-storage/index.d.ts +12 -1
  106. package/dist/main/services/simulator-storage/index.js +22 -7
  107. package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
  108. package/dist/main/services/simulator-storage/window-scope.js +20 -0
  109. package/dist/main/services/views/host-slot-port-channel.d.ts +20 -3
  110. package/dist/main/services/views/host-slot-port-channel.js +33 -5
  111. package/dist/main/services/views/managed-web-contents-view.js +21 -1
  112. package/dist/main/services/views/native-simulator-view.js +13 -16
  113. package/dist/main/services/views/overlay-panels-view.d.ts +13 -0
  114. package/dist/main/services/views/overlay-panels-view.js +31 -0
  115. package/dist/main/services/views/view-manager.d.ts +1 -1
  116. package/dist/main/services/views/view-manager.js +3 -0
  117. package/dist/main/services/window-contexts/context-router.d.ts +36 -0
  118. package/dist/main/services/window-contexts/context-router.js +55 -0
  119. package/dist/main/services/workbench-coi-host.d.ts +52 -0
  120. package/dist/main/services/workbench-coi-host.js +227 -0
  121. package/dist/main/services/workbench-coi-server.js +75 -133
  122. package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
  123. package/dist/main/services/workbench-coi-shutdown.js +69 -0
  124. package/dist/main/services/workbench-coi-static.d.ts +23 -0
  125. package/dist/main/services/workbench-coi-static.js +87 -0
  126. package/dist/main/services/workbench-context.d.ts +27 -3
  127. package/dist/main/services/workbench-context.js +10 -5
  128. package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
  129. package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
  130. package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
  131. package/dist/main/services/workspace/compile-mode-store.js +71 -0
  132. package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
  133. package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
  134. package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
  135. package/dist/main/services/workspace/workspace-referer.js +26 -0
  136. package/dist/main/services/workspace/workspace-service.d.ts +4 -0
  137. package/dist/main/services/workspace/workspace-service.js +51 -84
  138. package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
  139. package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
  140. package/dist/main/utils/ipc-context-source.d.ts +40 -0
  141. package/dist/main/utils/ipc-context-source.js +23 -0
  142. package/dist/main/utils/ipc-registry.d.ts +42 -36
  143. package/dist/main/utils/ipc-registry.js +117 -50
  144. package/dist/main/utils/sender-policy.d.ts +9 -0
  145. package/dist/main/utils/sender-policy.js +26 -3
  146. package/dist/main/utils/theme.d.ts +3 -2
  147. package/dist/main/utils/theme.js +3 -2
  148. package/dist/main/windows/main-window/create.d.ts +16 -0
  149. package/dist/main/windows/main-window/create.js +19 -11
  150. package/dist/main/windows/main-window/events.d.ts +1 -1
  151. package/dist/main/windows/main-window/events.js +26 -13
  152. package/dist/main/windows/main-window/index.d.ts +1 -1
  153. package/dist/main/windows/main-window/index.js +1 -1
  154. package/dist/native-host/common/common.js +94 -73
  155. package/dist/native-host/render/render.js +4079 -3171
  156. package/dist/native-host/service/service.js +2 -2
  157. package/dist/preload/runtime/native-host.d.ts +4 -0
  158. package/dist/preload/runtime/temp-files.js +9 -2
  159. package/dist/preload/runtime/wait-for-slot-root.d.ts +7 -4
  160. package/dist/preload/runtime/wait-for-slot-root.js +36 -8
  161. package/dist/preload/windows/host-dialog-runtime.cjs +10 -3
  162. package/dist/preload/windows/host-dialog-runtime.cjs.map +2 -2
  163. package/dist/preload/windows/host-sidebar-runtime.cjs +10 -3
  164. package/dist/preload/windows/host-sidebar-runtime.cjs.map +2 -2
  165. package/dist/preload/windows/host-toolbar-runtime.cjs +10 -3
  166. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  167. package/dist/preload/windows/main.cjs +181 -4
  168. package/dist/preload/windows/main.cjs.map +4 -4
  169. package/dist/preload/windows/simulator.cjs +10 -0
  170. package/dist/preload/windows/simulator.cjs.map +2 -2
  171. package/dist/preload/windows/simulator.js +10 -0
  172. package/dist/render-host/pageFrame.html +1 -1
  173. package/dist/render-host/preload.cjs +16 -4
  174. package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
  175. package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
  176. package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
  177. package/dist/renderer/assets/{createLucideIcon-Bqi8hpdi.js → createLucideIcon-cZ9FlZZw.js} +2 -2
  178. package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
  179. package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
  180. package/dist/renderer/assets/dist-B5HADirS.js +2 -0
  181. package/dist/renderer/assets/{dist-DKWdE1TK.js → dist-DIFlRMKe.js} +2 -2
  182. package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
  183. package/dist/renderer/assets/index-CEL_XFge.js +2 -0
  184. package/dist/renderer/assets/{input-Ct3alvkq.js → input-CAObw95L.js} +2 -2
  185. package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
  186. package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
  187. package/dist/renderer/assets/{jsx-runtime-DGLHmmOq.js → jsx-runtime-DIw5wnYl.js} +1 -1
  188. package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
  189. package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
  190. package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
  191. package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
  192. package/dist/renderer/assets/{projectCreateDialog-Bbjz75bP.js → projectCreateDialog-BmLqiYxn.js} +2 -2
  193. package/dist/renderer/assets/search-BMvuYF48.js +2 -0
  194. package/dist/renderer/assets/select-nFP95TxM.js +2 -0
  195. package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
  196. package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
  197. package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
  198. package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
  199. package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
  200. package/dist/renderer/assets/{tooltip-B_-_YVbw.js → tooltip-D6AxXRk5.js} +2 -2
  201. package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
  202. package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
  203. package/dist/renderer/assets/{utils-kfQov6Pa.js → utils-sEB5OZEQ.js} +2 -2
  204. package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
  205. package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
  206. package/dist/renderer/assets/workbench-BLJ0wKsg.js +5 -0
  207. package/dist/renderer/assets/{workbenchSettings-CV4LVA9b.js → workbenchSettings-YD0Ctbm_.js} +3 -3
  208. package/dist/renderer/entries/device-picker/index.html +28 -0
  209. package/dist/renderer/entries/host-sidebar-default/index.html +6 -5
  210. package/dist/renderer/entries/main/index.html +16 -17
  211. package/dist/renderer/entries/popover/index.html +16 -10
  212. package/dist/renderer/entries/project-create-dialog/index.html +12 -12
  213. package/dist/renderer/entries/settings/index.html +10 -10
  214. package/dist/renderer/entries/tooltip/index.html +5 -5
  215. package/dist/renderer/entries/update-dialog/index.html +10 -10
  216. package/dist/renderer/entries/workbench/index.html +49 -0
  217. package/dist/renderer/entries/workbench-settings/index.html +12 -11
  218. package/dist/service-host/host-env-update.cjs +23 -0
  219. package/dist/service-host/preload.cjs +24 -49
  220. package/dist/service-host/service-message-queue.cjs +71 -0
  221. package/dist/service-host/sync-impls/system-info.js +31 -9
  222. package/dist/shared/compile-mode-state.d.ts +73 -0
  223. package/dist/shared/compile-mode-state.js +100 -0
  224. package/dist/shared/compile-modes.d.ts +152 -0
  225. package/dist/shared/compile-modes.js +237 -0
  226. package/dist/shared/ipc-channels-overlays.d.ts +8 -2
  227. package/dist/shared/ipc-channels-overlays.js +19 -2
  228. package/dist/shared/ipc-channels.d.ts +5 -10
  229. package/dist/shared/ipc-channels.js +17 -14
  230. package/dist/shared/ipc-schemas.d.ts +76 -24
  231. package/dist/shared/ipc-schemas.js +55 -10
  232. package/dist/shared/project-window-types.d.ts +42 -0
  233. package/dist/shared/project-window-types.js +2 -0
  234. package/dist/shared/types.d.ts +43 -17
  235. package/dist/shared/view-ids.d.ts +1 -0
  236. package/dist/shared/view-ids.js +3 -1
  237. package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
  238. package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
  239. package/dist/simulator/assets/device-shell-pxnZZp10.js +431 -0
  240. package/dist/simulator/assets/simulator-Dwp7lnvu.js +10 -0
  241. package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
  242. package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +2 -0
  243. package/dist/simulator/simulator.html +3 -3
  244. package/dist/simulator/temp-files.d.ts +6 -0
  245. package/dist/simulator/temp-files.js +46 -4
  246. package/dist/simulator/types.d.ts +7 -0
  247. package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
  248. package/dist/vscode-workbench/assets/{dist-CMfmHflW.js → dist-CXG-u1VB.js} +3 -3
  249. package/dist/vscode-workbench/assets/{iconv-lite-umd-Bx8CgaZq.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
  250. package/dist/vscode-workbench/assets/{index-CdG6YWhW.js → index-6VJMsaWj.js} +460 -460
  251. package/dist/vscode-workbench/assets/{jschardet-M0qgd2lN.js → jschardet-Ba3D16vt.js} +1 -1
  252. package/dist/vscode-workbench/index.html +1 -1
  253. package/package.json +11 -8
  254. package/dist/renderer/assets/button-D5Q2wkXq.js +0 -2
  255. package/dist/renderer/assets/constants-D7DfVqMp.js +0 -2
  256. package/dist/renderer/assets/constants-D8zsejFq.js +0 -2
  257. package/dist/renderer/assets/dialog-e1TecTOY.js +0 -46
  258. package/dist/renderer/assets/hostSidebarDefault-B3yLfy8j.js +0 -2
  259. package/dist/renderer/assets/index-CsPD68N_.js +0 -5
  260. package/dist/renderer/assets/ipc-channels-overlays-LsDzGAtV.js +0 -2
  261. package/dist/renderer/assets/jsx-runtime-2vXHouwr.css +0 -1
  262. package/dist/renderer/assets/popover-Dix5cm_b.js +0 -2
  263. package/dist/renderer/assets/project-api-k7Oq9iaq.js +0 -2
  264. package/dist/renderer/assets/select-acGb0AmJ.js +0 -2
  265. package/dist/renderer/assets/settings-CQrTMr43.js +0 -2
  266. package/dist/renderer/assets/settings-api-CrUQ9rYV.js +0 -2
  267. package/dist/renderer/assets/settings-tab-bar-Cw1kVIf2.js +0 -2
  268. package/dist/renderer/assets/types-CsEKtFyr.js +0 -2
  269. package/dist/renderer/assets/updateDialog-NsF8223A.js +0 -2
  270. package/dist/renderer/assets/view-api-CLn3rcQE.js +0 -2
  271. package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
  272. package/dist/simulator/assets/device-shell-CmtM1QxP.js +0 -2
  273. package/dist/simulator/assets/device-shell-iFZo1igL.css +0 -1
  274. package/dist/simulator/assets/simulator-CIobn3Mh.js +0 -10
  275. package/dist/simulator/assets/simulator-mini-app-CRe6n9br.js +0 -2
  276. package/dist/simulator/assets/simulator-ui-C_cP602X.js +0 -2
  277. package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +0 -1
@@ -1,6 +1,6 @@
1
- var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>a(e[n],t[n]))}function o(e){return e===`__proto__`}function s(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function c(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function l(e){if(Array.isArray(e))return e.map(c);if(typeof e==`symbol`)return[e];e=u(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function u(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(u).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function d(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||o(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function f(e,t){if(e!=null)switch(typeof t){case`string`:{if(o(t))return;let n=e[t];return n===void 0?s(t)?f(e,l(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=c(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return d(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),o(t))return;let n=e[t];return n===void 0?void 0:n}}}function p(){return Math.random().toString(36).slice(2,7)}function m(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function h(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var g=typeof window<`u`&&typeof navigator<`u`;g&&/Android/i.test(navigator.userAgent),g&&/iPad|iPhone|iPod/.test(navigator.userAgent),g&&/OpenHarmony|harmony/.test(navigator.userAgent),g&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var _=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function ee(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function te(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=ee(n,i);return a&&(o+=`?${a}`),o}function v(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function y(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var ne={},re=1,ie=2;function ae(e,t){ne[e]||(ne[e]={factory:t,status:re,exports:void 0})}function oe(e){return Object.prototype.hasOwnProperty.call(ne,e)}function b(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ne[e];if(!i)throw Error(`module ${e} not found`);if(i.status===re){i.status=ie;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,b,t,t.exports))}catch(t){i.status=re;let a=`
1
+ var service=(function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){return typeof e==`function`}function r(e){return typeof e==`string`}function i(e){return e==null}function a(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>a(e[n],t[n]))}function o(e){return e===`__proto__`}function s(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function c(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function l(e){if(Array.isArray(e))return e.map(c);if(typeof e==`symbol`)return[e];e=u(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function u(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(u).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function d(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||o(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function f(e,t){if(e!=null)switch(typeof t){case`string`:{if(o(t))return;let n=e[t];return n===void 0?s(t)?f(e,l(t)):void 0:n}case`number`:case`symbol`:{typeof t==`number`&&(t=c(t));let n=e[t];return n===void 0?void 0:n}default:{if(Array.isArray(t))return d(e,t);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),o(t))return;let n=e[t];return n===void 0?void 0:n}}}function p(){return Math.random().toString(36).slice(2,7)}function m(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function h(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}var ee=typeof window<`u`&&typeof navigator<`u`;ee&&/Android/i.test(navigator.userAgent),ee&&/iPad|iPhone|iPod/.test(navigator.userAgent),ee&&/OpenHarmony|harmony/.test(navigator.userAgent),ee&&/Android|iPad|iPhone|iPod|OpenHarmony|harmony|Mobile/.test(navigator.userAgent);var g=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function te(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e.split(`/`),r=t.split(`/`);for(let e of r){let t=e;t===`..`?n.length>0&&n.pop():t!==`.`&&t!==``&&n.push(t)}return n.join(`/`)}function ne(e,t){let n=e.split(`/`).slice(0,-1).join(`/`),r=t.split(`?`),i=r[0],a=r[1],o=te(n,i);return a&&(o+=`?${a}`),o}function re(e){return typeof e==`number`&&Number.isFinite(e)&&!Number.isNaN(e)?`${e}px`:e}function ie(e){if(typeof e!=`object`||!e)return e;let t=new WeakMap;function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];return t.set(e,r),r.push(...e.map(n)),r}if(t.has(e))return t.get(e);let r=Object.create(Object.getPrototypeOf(e));return t.set(e,r),Object.assign(r,...Object.keys(e).map(t=>({[t]:n(e[t])})))}return n(e)}var ae={},oe=1,se=2;function ce(e,t){ae[e]||(ae[e]={factory:t,status:oe,exports:void 0})}function le(e){return Object.prototype.hasOwnProperty.call(ae,e)}function _(e,t,r){if(typeof e!=`string`)throw TypeError(`require args must be a string`);let i=ae[e];if(!i)throw Error(`module ${e} not found`);if(i.status===oe){i.status=se;let t={exports:{}},a;try{i.factory&&(a=i.factory.call(null,_,t,t.exports))}catch(t){i.status=oe;let a=`
2
2
  name: ${t.name}
3
3
  msg: ${t.message}
4
4
  stack:
5
5
  ${t.stack}
6
- `;console.error(`require ${e} error: ${a}`),n(globalThis.__diminaReportError)&&globalThis.__diminaReportError(t),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}b.async=async e=>new Promise((t,n)=>{try{t(b(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var x=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.callback(t),r.keep||delete this.callbacks[e])}remove(e){e?Object.keys(this.callbacks).forEach(t=>{e===t&&delete this.callbacks[t]}):Object.entries(this.callbacks).forEach(([e,t])=>{t.keep&&delete this.callbacks[e]})}},se=`__dimina_data_function_reference__`,ce=1;function le(e){return{[se]:e,version:ce}}function ue(e){return typeof e==`object`&&!!e&&e.version===ce&&typeof e[se]==`string`&&Object.keys(e).length===2}function de(e){return ue(e)?e[se]:void 0}function fe(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(ue(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=fe(e[a],{mapFunction:t,mapReference:n},r);return i}var pe=new Set([String,Number,Boolean,Object,Array,null]);function me(e){return pe.has(e)}function he(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function ge(e){return Array.isArray(e)?e.filter(me):[]}function _e(e){let t,n=[],r;return me(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=ge(e.optionalTypes),r=e.value),me(t)||(t=n[0]??null),r===void 0&&(r=he(t)),{type:t,optionalTypes:n,value:y(r)}}function ve(e){return Array.isArray(e)}function ye(e){return ve(e)&&e?.constructor?.name===Array.name}function be(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?ye(t):t!==void 0}function xe(e,t){typeof e==`function`&&e(t)}function Se(e,t,{absent:n=!1,warn:r}={}){if(n)return y(e.value);for(let n of e.optionalTypes||[])if(be(n,t))return t;let i=e.type;if(i===String)return t==null?(xe(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&xe(r,`property received type-uncompatible value: expected <String> but got object-typed value. Forcely converted.`),String(t));if(i===Number){try{if(Number.isFinite(Number(t)))return Number(t)}catch{}return xe(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?ve(t)?t:(xe(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(xe(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var S=new class{constructor(){this.listeners=new Set,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},this.listeners.forEach(t=>t(e,this.snapshot))}onUpdate(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function Ce(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 we={error:[],show:[],hide:[]},Te,Ee=!1,De=!1;function Oe(e,t){return`${t}${e===`error`?`Error`:e===`show`?`AppShow`:`AppHide`}`}function ke(e,t){if(typeof t!=`function`){console.error(`${Oe(e,`on`)} should accept a function instead of ${typeof t}`);return}we[e].push(t)}function Ae(e,t){if(!t){we[e]=[];return}if(typeof t!=`function`){console.error(`${Oe(e,`off`)} should accept a function instead of ${typeof t}`);return}we[e]=we[e].filter(e=>e!==t)}function je(e,t,n){try{e(...t)}catch(e){Ee||C(e),console.error(`[service] ${n} error:`,e)}}function Me(e,t,n){for(let r of[...we[e]])je(r,t,n)}function Ne(e){ke(`error`,e)}function Pe(e){Ae(`error`,e)}function Fe(e){ke(`show`,e)}function Ie(e){Ae(`show`,e)}function Le(e){ke(`hide`,e)}function Re(e){Ae(`hide`,e)}function ze(e){Me(`show`,[e],`wx.onAppShow`)}function Be(){Me(`hide`,[],`wx.onAppHide`)}function Ve(e){Te=typeof e==`function`?e:void 0}function He(e){if(typeof e==`string`)return e;if(e?.stack)return String(e.stack);if(e?.message)return String(e.message);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function C(e){let t=He(e);if(Ee)return console.error(`[service] error handler error:`,e),t;Ee=!0;try{Te&&je(Te,[t],`App.onError`),Me(`error`,[t],`wx.onError`)}finally{Ee=!1}return t}function Ue(){if(De)return;De=!0;let e=e=>{C(e?.error||e?.message||e)};if(typeof globalThis.addEventListener==`function`){globalThis.addEventListener(`error`,e);return}let t=globalThis.onerror;globalThis.onerror=function(n,r,i,a,o){return e(o||n),typeof t==`function`&&t.call(this,n,r,i,a,o)}}var We=new WeakMap,Ge=new Map;function Ke(e){let t=We.get(e);if(t)return Ge.set(t,e),t;let n;do n=`data-function-${p()}`;while(Ge.has(n));return We.set(e,n),Ge.set(n,e),n}function qe(e){return Ge.get(e)}function Je(e){return fe(e,{mapFunction(e){return le(Ke(e))}})}function Ye(e){return fe(e,{mapReference(e){return qe(de(e))||e}})}var w=new class e{constructor(){this.event=Ce(),this.init()}init(){_?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){try{let t=Ye(e);console.log(`[service] receive msg: `,_?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}catch(e){C(e),console.error(`[service] message handler error:`,e)}}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return _?e.prototype.send=function(e){let t=Je(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=Je(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return _?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},T=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()}remove(e){for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t].pages,r=n.findIndex(t=>t.id===e);if(r!==-1){n.splice(r,1);return}}}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function Xe(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var Ze={getWindowInfo:()=>Xe(S.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>S.getSystemInfo(),getAppBaseInfo:()=>Xe(S.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>Xe(S.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>S.getMenuRect()},Qe=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),$e=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,exitMiniProgram,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,navigateBackMiniProgram,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function et(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function tt(e,t){return Qe.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||$e.has(e)}function nt(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:T.getPageInfo().id,params:t}};return n===`container`?w.invoke(r):w.send(r)}function rt(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{x.remove(a),x.remove(o)};a=x.store(e=>{s(),r(e)}),o=x.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{nt(e,t,n)}catch(e){s(),i(e)}})}function it(e,t,r){let i,a,o=()=>{x.remove(i),x.remove(a)};i=x.store(e=>{o(),n(t)&&t(e)}),a=x.store(e=>{o(),n(r)&&r(e)}),e.success=i,e.fail=a}function at(e){return i(e)||e===``}function ot({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||at(e))&&(n(t)||at(t))}function E(e,t,r=`container`,i=!0){let a=Ze[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&tt(e,t))return rt(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:x.store(t,!0)};else if(et(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;if(o=l,c!==void 0&&(o.evtId=c),ot({success:e,fail:r,keep:a,evtId:c}))it(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=x.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=x.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=x.store(i,a,c),!a&&c===void 0&&s.push(o.complete)):o.complete=i}else{let{keep:n,...a}=t;if(delete a.evtId,!n&&i&&tt(e,t))return o={...a},rt(e,o,r);o=a}try{return nt(e,o,r)}catch(e){for(let e of s)x.remove(e);throw e}}function st(e,t,n=`container`){return E(e,t,n,!1)}var ct=t({navigateBack:()=>pt,navigateTo:()=>ft,reLaunch:()=>ut,redirectTo:()=>dt,switchTab:()=>lt});function lt(e){return e.url=te(T.getPageInfo().route,e.url),E(`switchTab`,e)}function ut(e){return e.url=te(T.getPageInfo().route,e.url),E(`reLaunch`,e)}function dt(e){let t=te(T.getPageInfo().route,e.url);if(T.getPageInfo().route!==t)return e.url=t,E(`redirectTo`,e)}function ft(e){return e.url=te(T.getPageInfo().route,e.url),E(`navigateTo`,e)}function pt(e){return E(`navigateBack`,e)}var mt=t({offAppHide:()=>bt,offAppShow:()=>yt,offError:()=>gt,offHide:()=>wt,offShow:()=>St,onAppHide:()=>vt,onAppShow:()=>_t,onError:()=>ht,onHide:()=>Ct,onShow:()=>xt});function ht(e){Ne(e)}function gt(e){Pe(e)}function _t(e){Fe(e)}function vt(e){Le(e)}function yt(e){Ie(e)}function bt(e){Re(e)}function xt(e){Fe(e)}function St(e){Ie(e)}function Ct(e){Le(e)}function wt(e){Re(e)}var Tt=`__diminaArrayBufferBase64`,Et=`__diminaFileDataBase64`,Dt=`__diminaFileDataType`,D=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ot=(()=>{let e={};for(let t=0;t<64;t++)e[D[t]]=t;return e})();function kt(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function At(e){return e&&e.buffer&&kt(e.buffer)}function jt(e){return kt(e)?e:At(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Mt(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=D[t[r]>>2],n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=D[(t[r+1]&15)<<2|t[r+2]>>6],n+=D[t[r+2]&63];return r<t.length&&(n+=D[t[r]>>2],r+1<t.length?(n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=D[(t[r+1]&15)<<2],n+=`=`):(n+=D[(t[r]&3)<<4],n+=`==`)),n}function Nt(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=Ot[t[e]],o=Ot[t[e+1]],s=t[e+2]===`=`?0:Ot[t[e+2]],c=t[e+3]===`=`?0:Ot[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function Pt(e){let t=jt(e);return t?{[Dt]:`base64`,[Et]:Mt(t)}:e}function Ft(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=Pt(n[e]));return n}function It(e){return e&&typeof e==`object`&&e[Tt]!==void 0?Nt(e[Tt]):e}function Lt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:It(e.data)}:e}function Rt(e){if(!e||typeof e!=`object`||!e.entries||typeof e.entries!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.entries))t[n]=r&&typeof r==`object`&&r.data!==void 0?{...r,data:It(r.data)}:r;return{...e,entries:t}}function zt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[Tt]===void 0)return e;let r=new Uint8Array(Nt(e[Tt]));new Uint8Array(t).set(r,n);let{[Tt]:i,...a}=e;return{...a,arrayBuffer:t}}function Bt(e){let t={...e},n=jt(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var Vt=class{constructor(e={}){this.mode=e.mode,this.size=e.size,this.lastAccessedTime=e.lastAccessedTime,this.lastModifiedTime=e.lastModifiedTime,this._isDirectory=!!e.isDirectory,this._isFile=!!e.isFile}isDirectory(){return this._isDirectory}isFile(){return this._isFile}};function Ht(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function Ut(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if(Ht(e))return new Vt(e);if(Array.isArray(e))return e.map(e=>Ut(e));let t={};for(let[n,r]of Object.entries(e))t[n]=Ut(r);return t}function Wt(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:Ut(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:Ut(e.statsMap)}}return Ut(e)}function Gt(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function O(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=E(e,r(Gt(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function Kt(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return O(e,t,{prepare:Bt,transform:e=>zt(e,n,r)})}var qt=class{access(e){return O(`FileSystemManager.access`,e)}accessSync(e){return E(`FileSystemManager.accessSync`,e)}appendFile(e){return O(`FileSystemManager.appendFile`,e,{prepare:Ft})}appendFileSync(e,t,n){return E(`FileSystemManager.appendFileSync`,Ft({filePath:e,data:t,encoding:n}))}close(e){return O(`FileSystemManager.close`,e)}closeSync(e){return E(`FileSystemManager.closeSync`,e)}copyFile(e){return O(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return E(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return O(`FileSystemManager.fstat`,e,{transform:Wt})}fstatSync(e){return Wt(E(`FileSystemManager.fstatSync`,e))}ftruncate(e){return O(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return E(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return O(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return O(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return O(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return E(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return O(`FileSystemManager.open`,e)}openSync(e){return E(`FileSystemManager.openSync`,e)}read(e){return Kt(`FileSystemManager.read`,e)}readSync(e){return zt(E(`FileSystemManager.readSync`,Bt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return O(`FileSystemManager.readCompressedFile`,e,{transform:Lt})}readCompressedFileSync(e){return It(E(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return O(`FileSystemManager.readdir`,e)}readdirSync(e){return E(`FileSystemManager.readdirSync`,e)}readFile(e){return O(`FileSystemManager.readFile`,e,{transform:Lt})}readFileSync(e,t,n,r){return It(E(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return O(`FileSystemManager.readZipEntry`,e,{transform:Rt})}removeSavedFile(e){return O(`FileSystemManager.removeSavedFile`,e)}rename(e){return O(`FileSystemManager.rename`,e)}renameSync(e,t){return E(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return O(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return E(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return O(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return E(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return O(`FileSystemManager.stat`,e,{transform:Wt})}statSync(e,t){return Wt(E(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return O(`FileSystemManager.truncate`,e)}truncateSync(e,t){return E(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return O(`FileSystemManager.unlink`,e)}unlinkSync(e){return E(`FileSystemManager.unlinkSync`,e)}unzip(e){return O(`FileSystemManager.unzip`,e)}write(e){return O(`FileSystemManager.write`,e,{prepare:e=>Ft(e,[`arrayBuffer`,`data`])})}writeSync(e){return E(`FileSystemManager.writeSync`,Ft(e,[`arrayBuffer`,`data`]))}writeFile(e){return O(`FileSystemManager.writeFile`,e,{prepare:Ft})}writeFileSync(e,t,n){return E(`FileSystemManager.writeFileSync`,Ft({filePath:e,data:t,encoding:n}))}};Object.getOwnPropertyNames(qt.prototype).filter(e=>e!==`constructor`);var Jt=null;function Yt(){return Jt||=new qt,Jt}var Xt=t({USER_DATA_PATH:()=>Zt,fileSystemManagerAPINames:()=>Qt,getFileSystemManager:()=>on}),Zt=`difile://usr`,Qt=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],$t=`is not supported by the devtools simulator: the service thread talks to the container over an asynchronous postMessage bridge, so a synchronous return value is impossible — use the async variant`,en=`not supported by the devtools simulator (no container backend)`;function tn(e){return function(){throw Error(`FileSystemManager.${e} ${$t}`)}}function nn(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${en}`}),t.complete?.()}}function rn(e){let t=Object.getPrototypeOf(e),n=new Set(Qt);for(let e of Object.getOwnPropertyNames(t))e===`constructor`||n.has(e)||(t[e]=e.endsWith(`Sync`)?tn(e):nn(e));return e}var an;function on(){return an||=rn(Yt()),an}var sn=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],cn=t({canIUse:()=>fn,env:()=>ln}),ln={USER_DATA_PATH:`difile://usr`},un=new Set([`nextTick`,`onError`,`offError`,`onAppShow`,`onAppHide`,`offAppShow`,`offAppHide`,`onShow`,`offShow`,`onHide`,`offHide`,`createCanvas`,`createImage`,`onTouchStart`,`offTouchStart`,`onTouchMove`,`offTouchMove`,`onTouchEnd`,`offTouchEnd`,`onTouchCancel`,`offTouchCancel`,`getUpdateManager`,`UpdateManager`,...sn.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...Qt.map(e=>`FileSystemManager.${e}`)]),dn={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function fn(e){if(un.has(e))return!0;try{return E(`canIUse`,Object.hasOwn(dn,e)?dn[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var pn=t({getPerformance:()=>mn});function mn(){return hn.getInstance()}var hn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new gn,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new _n(this,e)}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}},gn=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}},_n=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=x.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){E(`removePerformanceObserver`,{observerId:e.observerId},`render`),x.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),E(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new gn;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})),typeof this.callback==`function`&&this.callback(t)}}disconnect(){this.connected=!1,this.observerId&&E(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&x.remove(this.callbackId),this.observerId=null,this.callbackId=null}},vn=t({loadSubpackage:()=>bn,preDownloadSubpackage:()=>yn});function yn(e){return E(`preDownloadSubpackage`,e)}function bn(e){return E(`loadSubpackage`,e)}var xn=t({getAppBaseInfo:()=>kn,getDeviceInfo:()=>An,getSystemInfo:()=>En,getSystemInfoAsync:()=>On,getSystemInfoSync:()=>Dn,getWindowInfo:()=>wn,offThemeChange:()=>Mn,onThemeChange:()=>jn,openAppAuthorizeSetting:()=>Tn,openSystemBluetoothSetting:()=>Cn}),Sn=new Set;S.onUpdate(e=>{let t=e.systemInfo?.theme;t&&Sn.forEach(e=>e({theme:t}))});function Cn(e){return E(`openSystemBluetoothSetting`,e)}function wn(e){return E(`getWindowInfo`,e)}function Tn(e){return E(`openAppAuthorizeSetting`,e)}function En(e){return new Promise(t=>{t(E(`getSystemInfo`,e))})}function Dn(){return E(`getSystemInfoSync`)}function On(e){return E(`getSystemInfoAsync`,e)}function kn(){return E(`getAppBaseInfo`)}function An(){return E(`getDeviceInfo`)}function jn(e){n(e)&&Sn.add(e)}function Mn(e){n(e)?Sn.delete(e):Sn.clear()}var Nn=t({getUpdateManager:()=>zn}),Pn=`onUpdateStatusChange`,Fn=`updatefail`,In=`updateready`,Ln=`noupdate`,Rn=`updating`;function zn(){return Bn.getInstance()}var Bn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],w.on(Pn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===Fn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===In){let e=this.checkForUpdateResult?.hasUpdate!==!0,t=!this.updateReady;this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},e&&this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),t&&this.emit(this.updateReadyListeners);return}if(t===Rn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Ln){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,E(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};Bn.getInstance();var Vn=t({createCameraContext:()=>Hn});function Hn(){return new Un}var Un=class{takePhoto(e={}){return E(`takePhoto`,e)}startRecord(e={}){return E(`startRecordCamera`,e)}stopRecord(e={}){return E(`stopRecordCamera`,e)}},Wn=t({reportAnalytics:()=>Gn,reportEvent:()=>Kn});function Gn(...e){return E(`reportAnalytics`,e)}function Kn(e,t){return E(`reportAnalytics`,{eventId:e,data:t})}var qn=`__diminaArrayBufferBase64`,k=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Jn=(()=>{let e={};for(let t=0;t<64;t++)e[k[t]]=t;return e})();function Yn(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Xn(e){return Yn(e)?e:e&&e.buffer&&Yn(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function Zn(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=k[t[r]>>2],n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=k[(t[r+1]&15)<<2|t[r+2]>>6],n+=k[t[r+2]&63];return r<t.length&&(n+=k[t[r]>>2],r+1<t.length?(n+=k[(t[r]&3)<<4|t[r+1]>>4],n+=`${k[(t[r+1]&15)<<2]}=`):n+=`${k[(t[r]&3)<<4]}==`),n}function Qn(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=Jn[t[e]],o=Jn[t[e+1]],s=t[e+2]===`=`?0:Jn[t[e+2]],c=t[e+3]===`=`?0:Jn[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function $n(e){let t=Xn(e);return t?{[qn]:Zn(t)}:e}function er(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?Qn(e[qn]):e}function tr(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=er(r);return{...e,advertisData:er(e.advertisData),serviceData:t}}function nr(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(tr)}}function rr(e){return!e||typeof e!=`object`?e:{...e,value:er(e.value)}}function ir(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function ar(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=E(e,n(ir(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function A(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=x.store(e=>t(n(e)),!0);return r.set(t,i),E(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),x.remove(n),E(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())x.remove(e);return r.clear(),E(t)}}}var or=t({closeBluetoothAdapter:()=>yr,getBluetoothAdapterState:()=>vr,getBluetoothDevices:()=>_r,getConnectedBluetoothDevices:()=>gr,isBluetoothDevicePaired:()=>br,makeBluetoothPair:()=>xr,offBluetoothAdapterStateChange:()=>hr,offBluetoothDeviceFound:()=>mr,onBluetoothAdapterStateChange:()=>pr,onBluetoothDeviceFound:()=>fr,openBluetoothAdapter:()=>dr,startBluetoothDevicesDiscovery:()=>ur,stopBluetoothDevicesDiscovery:()=>lr}),sr=A(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,nr),cr=A(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function lr(e){return E(`stopBluetoothDevicesDiscovery`,e)}function ur(e){return E(`startBluetoothDevicesDiscovery`,e)}function dr(e){return E(`openBluetoothAdapter`,e)}function fr(e){return sr.on(e)}function pr(e){return cr.on(e)}function mr(e){return sr.off(e)}function hr(e){return cr.off(e)}function gr(e){return ar(`getConnectedBluetoothDevices`,e,{transform:nr})}function _r(e){return ar(`getBluetoothDevices`,e,{transform:nr})}function vr(e){return E(`getBluetoothAdapterState`,e)}function yr(e){return E(`closeBluetoothAdapter`,e)}function br(e){return E(`isBluetoothDevicePaired`,e)}function xr(e){return E(`makeBluetoothPair`,e)}var Sr=t({closeBLEConnection:()=>Rr,createBLEConnection:()=>Lr,getBLEDeviceCharacteristics:()=>Ir,getBLEDeviceRSSI:()=>Fr,getBLEDeviceServices:()=>Pr,getBLEMTU:()=>zr,notifyBLECharacteristicValueChange:()=>Nr,offBLECharacteristicValueChange:()=>Mr,offBLEConnectionStateChange:()=>jr,offBLEMTUChange:()=>Vr,onBLECharacteristicValueChange:()=>Ar,onBLEConnectionStateChange:()=>kr,onBLEMTUChange:()=>Br,readBLECharacteristicValue:()=>Or,setBLEMTU:()=>Dr,writeBLECharacteristicValue:()=>Er}),Cr=A(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),wr=A(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,rr),Tr=A(`onBLEMTUChange`,`offBLEMTUChange`);function Er(e){return ar(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:$n(e.value)}:e}})}function Dr(e){return E(`setBLEMTU`,e)}function Or(e){return E(`readBLECharacteristicValue`,e)}function kr(e){return Cr.on(e)}function Ar(e){return wr.on(e)}function jr(e){return Cr.off(e)}function Mr(e){return wr.off(e)}function Nr(e){return E(`notifyBLECharacteristicValueChange`,e)}function Pr(e){return E(`getBLEDeviceServices`,e)}function Fr(e){return E(`getBLEDeviceRSSI`,e)}function Ir(e){return E(`getBLEDeviceCharacteristics`,e)}function Lr(e){return E(`createBLEConnection`,e)}function Rr(e){return E(`closeBLEConnection`,e)}function zr(e){return E(`getBLEMTU`,e)}function Br(e){return Tr.on(e)}function Vr(e){return Tr.off(e)}var Hr=t({getClipboardData:()=>Wr,setClipboardData:()=>Ur});function Ur(e){return E(`setClipboardData`,e)}function Wr(e){return E(`getClipboardData`,e)}var Gr=t({addPhoneContact:()=>qr,chooseContact:()=>Kr});function Kr(e){return E(`chooseContact`,e)}function qr(e){return E(`addPhoneContact`,e)}var Jr=t({hideKeyboard:()=>Yr});function Yr(e){return E(`hideKeyboard`,e)}var Xr=t({offMemoryWarning:()=>Qr,onMemoryWarning:()=>Zr});function Zr(e){return E(`onMemoryWarning`,e)}function Qr(e){return E(`offMemoryWarning`,e)}var $r=`__diminaArrayBufferBase64`,j=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ei=Object.fromEntries([...j].map((e,t)=>[e,t]));function ti(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function ni(e){if(ti(e))return e;if(ArrayBuffer.isView(e)){let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Uint8Array(t.length);return n.set(t),n.buffer}return null}function ri(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=j[t[r]>>2],n+=j[(t[r]&3)<<4|t[r+1]>>4],n+=j[(t[r+1]&15)<<2|t[r+2]>>6],n+=j[t[r+2]&63];return r<t.length&&(n+=j[t[r]>>2],r+1<t.length?(n+=j[(t[r]&3)<<4|t[r+1]>>4],n+=`${j[(t[r+1]&15)<<2]}=`):n+=`${j[(t[r]&3)<<4]}==`),n}function ii(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=ei[t[e]],o=ei[t[e+1]],s=t[e+2]===`=`?0:ei[t[e+2]],c=t[e+3]===`=`?0:ei[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function ai(e){let t=ni(e);return t?{[$r]:ri(t)}:e}function oi(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:ii(t[$r])}}function si(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function M(e,t,n={}){return E(e,{socketId:t,...n,keep:!0})}function N(e,t,n={},r=e=>e){let i=new Set,a,o,s;function c(){if(!a)return;let e=a;a=void 0,x.remove(e),o&&x.remove(o),o=void 0,E(t,{...n,callbackId:e,keep:!0})}return{on(t){if(typeof t!=`function`||(i.add(t),a))return;let c=x.store(e=>{o&&x.remove(o),o=void 0;let t=r(e);for(let e of[...i])e(t);s?.()},!0);a=c,o=x.store(()=>{a===c&&(x.remove(c),o&&x.remove(o),a=void 0,o=void 0)});try{return E(e,{...n,callbackId:c,success:c,fail:o,keep:!0})}catch(e){throw x.remove(c),o&&x.remove(o),a=void 0,o=void 0,e}},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return c()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return c();a&&x.remove(a),o&&x.remove(o),a=void 0,o=void 0},hasListeners(){return i.size>0},setAfterEmit(e){s=e}}}var ci=t({getNetworkType:()=>ui,offNetworkStatusChange:()=>fi,onNetworkStatusChange:()=>di}),li=N(`onNetworkStatusChange`,`offNetworkStatusChange`);function ui(e){return E(`getNetworkType`,e)}function di(e){return li.on(e)}function fi(e){return li.off(e)}var pi=t({makePhoneCall:()=>mi});function mi(e){return E(`makePhoneCall`,e)}var hi=t({scanCode:()=>gi});function gi(e){return E(`scanCode`,e)}var _i=t({offUserCaptureScreen:()=>bi,onUserCaptureScreen:()=>yi,setKeepScreenOn:()=>xi}),vi=A(`onUserCaptureScreen`,`offUserCaptureScreen`),P;function yi(e){if(typeof e==`function`)return P&&P!==e&&vi.off(P),P=e,vi.on(e)}function bi(e){if(typeof e!=`function`||e===P)return P=void 0,vi.off(e)}function xi(e){return E(`setKeepScreenOn`,e)}var F={touchstart:[],touchmove:[],touchend:[],touchcancel:[]};function Si(e,t){!F[e]||typeof t!=`function`||F[e].push(t)}function Ci(e,t){if(F[e]){if(!t){F[e]=[];return}F[e]=F[e].filter(e=>e!==t)}}function wi(e,t={}){if(F[e])for(let n of[...F[e]])try{n(t)}catch(e){C(e)}}var Ti=t({offTouchCancel:()=>Ni,offTouchEnd:()=>ji,offTouchMove:()=>ki,offTouchStart:()=>Di,onTouchCancel:()=>Mi,onTouchEnd:()=>Ai,onTouchMove:()=>Oi,onTouchStart:()=>Ei});function Ei(e){Si(`touchstart`,e)}function Di(e){Ci(`touchstart`,e)}function Oi(e){Si(`touchmove`,e)}function ki(e){Ci(`touchmove`,e)}function Ai(e){Si(`touchend`,e)}function ji(e){Ci(`touchend`,e)}function Mi(e){Si(`touchcancel`,e)}function Ni(e){Ci(`touchcancel`,e)}var Pi=t({vibrateLong:()=>Ii,vibrateShort:()=>Fi});function Fi(e){return E(`vibrateShort`,e)}function Ii(e){return E(`vibrateLong`,e)}var Li=t({extBridge:()=>Ri,extOffBridge:()=>Bi,extOnBridge:()=>zi,offLoginStatusChanged:()=>Hi,onLoginStatusChanged:()=>Vi});function Ri({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),E(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function zi({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}`;E(i,{evtId:i,keep:r,success:n})}function Bi({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}let r=`${t}_${e}`;E(r,{evtId:r,success:n})}function Vi(e){w.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function Hi(){w.off(`notifyLoginStatusChanged`)}var Ui=new WeakSet;function Wi(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!Ui.has(e)){Ui.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{Ui.delete(e)}}C(t),console.error(`[service] ${r} error:`,t)}function I(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?Wi(e,t,i):(C(t),console.error(`[service] ${i} error:`,t));return}}function L(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])I(e,a,n,r,i)}var Gi=[`onLaunch`,`onShow`,`onHide`,`onError`],Ki=[`globalData`],qi=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),Ve(this.onError),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){Gi.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)Gi.includes(t)||Ki.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){I(this,this.onLaunch,[this.options],`onLaunch`),I(this,this.onShow,[this.options],`onShow`),ze(this.options)}appShow(e=this.options){I(this,this.onShow,[e],`onShow`),ze(e)}appHide(){I(this,this.onHide,[],`onHide`),Be()}},Ji=new Set([`2d`]),Yi=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Xi=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Zi=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),Qi=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),$i=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),ea=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),ta={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},na=new Map,R=null,ra=null,z={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function ia(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function aa(e,t){!e||!t||na.set(e,t)}function oa(e){return na.get(e)||null}function sa(e,t){return e&&e[ia(t)]||null}function B(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>B(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}let t={};for(let[n,r]of Object.entries(e))t[n]=B(r);return t}w.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{aa(e,t)}),w.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{aa(e,t)});var ca=1,la=1;function ua(){let e=T.getPageInfo();return e?.bridgeId||e?.id||``}function V(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)&&n>=0?Math.floor(n):t}function da(e,t,n){w.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function fa(e){Promise.resolve().then(e)}function pa(e){return Object.prototype.toString.call(e)===`[object Object]`}function ma(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function H(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};let t=ma(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>H(e));if(pa(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=H(r);return t}return e}function U(e){return Array.from(e).map(e=>H(e))}function W(e=`canvas_resource`){return`${e}_${p()}`}var G=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=ca++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:U(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},ha=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e;let t=x.store((e={})=>{this.width=e.width||this.width,this.height=e.height||this.height,n(this.onload)&&this.onload(e)}),r=x.store((e={})=>{n(this.onerror)&&this.onerror(e)});this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,onload:t,onerror:r})}},ga=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.state={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,globalAlpha:1,lineWidth:1},new Proxy(this,{get(e,t){if(t in e)return e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.state[n]=r,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:H(r)}),!0}})}async getImageData(e,t,n,r){return await this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){if(e===`measureText`)return{width:String(t[0]??``).length*10};if(e===`createImageData`){let e=t[0],n=t[1];return{width:e,height:n,data:new Uint8ClampedArray(e*n*4)}}let n=Xi.has(e)?W():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:U(t),resultId:n}),n)return new G(this.canvas,n)}},_a=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=W(`webgl_extension_resource`),n=new G(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof G)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:U(t),resultId:r}),n}},va=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...ta,...pa(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(z,t))return z[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:H(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(z.VIEWPORT,[0,0,e,t]),this.state.set(z.SCISSOR_BOX,[0,0,e,t]),this.state.set(z.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(z.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(z.DEPTH_CLEAR_VALUE,1),this.state.set(z.DEPTH_WRITEMASK,!0),this.state.set(z.DEPTH_FUNC,z.LESS),this.state.set(z.STENCIL_CLEAR_VALUE,0),this.state.set(z.LINE_WIDTH,1),this.state.set(z.CULL_FACE_MODE,z.BACK),this.state.set(z.FRONT_FACE,z.CCW),this.state.set(z.ACTIVE_TEXTURE,z.TEXTURE0),this.state.set(z.PACK_ALIGNMENT,4),this.state.set(z.UNPACK_ALIGNMENT,4),this.state.set(z.CURRENT_PROGRAM,null),this.state.set(z.ARRAY_BUFFER_BINDING,null),this.state.set(z.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(z.TEXTURE_BINDING_2D,null),this.state.set(z.FRAMEBUFFER_BINDING,null),this.state.set(z.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=B(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(B(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return B(e)}queueError(e){e&&e!==z.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(U(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:U(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=W(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new G(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:U(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),z.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,z.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t)}let n=Zi.get(e)||Qi.get(e);if(n)return this.createResource(e,t,n);if(ea.has(e)){let n=t[0];return n instanceof G&&n.resourceType===ea.get(e)&&!n.deleted}$i.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:U(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(z.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(z.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(z.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(z.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(z.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(z.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(z.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(z.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(z.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(z.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(z.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(z.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(z.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===z.ARRAY_BUFFER?this.state.set(z.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===z.ELEMENT_ARRAY_BUFFER&&this.state.set(z.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===z.TEXTURE_2D&&this.state.set(z.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(z.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(z.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?B(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof G)||e.resourceType!==`shader`)return null;switch(t){case z.DELETE_STATUS:return e.deleted;case z.SHADER_TYPE:return e.metadata.shaderType;case z.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof G)||e.resourceType!==`program`)return null;switch(t){case z.DELETE_STATUS:return e.deleted;case z.LINK_STATUS:return!!e.metadata.linkStatus;case z.VALIDATE_STATUS:return!!e.metadata.validateStatus;case z.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=W(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new _a(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},ya=class{constructor({nodeId:e,bridgeId:t=ua(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1,webglCapabilities:o}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.webglCapabilities=o||oa(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingOperations=[],this.flushScheduled=!1,this._width=V(n,300),this._height=V(r,150)}get width(){return this._width}set width(e){this._width=V(e,300),this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width})}get height(){return this._height}set height(e){this._height=V(e,150),this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height})}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=ia(n),i=Yi.has(n);if(!Ji.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?sa(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=W(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:H(t)});let s=i?new va(this,o,r,t,a):new ga(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=W(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=B(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new ha(this,W(`canvas_image`))}requestAnimationFrame(e){let t=la++,r=x.store(t=>{n(e)&&e(t)});return da(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r}),t}cancelAnimationFrame(e){da(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){return new Promise((a,o)=>{let s=x.store(e=>{a(e)});this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s})})}toDataURL(e=`image/png`,t){return new Promise(n=>{let r=x.store(e=>{n(e)});this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:r})})}enqueueOperation(e){this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,fa(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback||e.typedArrayUpdateId)?x.store(e=>this.applyFlushFeedback(e)):void 0;da(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:t})}};function ba(e,t=ua()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(aa(t,e.webglCapabilities),new ya({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function xa(e,t=ua()){return Array.isArray(e)?e.map(e=>xa(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:ba(e.node,t)}:e}function Sa(e={}){let t=V(e.width,300),n=V(e.height,150),r=e.type||`2d`,i=W(`offscreen_canvas`),a=ua();return da(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new ya({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:oa(a)})}function Ca(e={}){if(R)return Sa(e);let t=S.getSystemInfo()||{},n=V(e.width,t.windowWidth||300),r=V(e.height,t.windowHeight||150),i=e.type||`2d`,a=W(`game_canvas`),o=ua();return da(o,`createGameCanvas`,{nodeId:a,width:n,height:r,type:i}),R=new ya({nodeId:a,bridgeId:o,width:n,height:r,type:i,webglCapabilities:oa(o)}),R}function wa(){return ra||=Sa({width:1,height:1,type:`2d`}),ra.createImage()}function Ta(){globalThis.GameGlobal=globalThis,globalThis.global=globalThis,globalThis.requestAnimationFrame=e=>{if(!R)throw Error(`requestAnimationFrame requires wx.createCanvas() first`);return R.requestAnimationFrame(e)},globalThis.cancelAnimationFrame=e=>{R?.cancelAnimationFrame(e)}}var Ea=t({createSelectorQuery:()=>Da});function Da(){return new ja}function Oa(){return T.getPageInfo()}function ka(){let e=Oa();return e?.__id__||e?.id}function Aa(){let e=Oa();return e?.bridgeId||e?.id}var ja=class{constructor(){this.__componentId=ka(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Ma(this,this.__componentId,e,!0)}selectAll(e){return new Ma(this,this.__componentId,e,!1)}selectViewport(){return new Ma(this,ka(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=Aa();E(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=xa(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Ma=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)}},Na=t({createIntersectionObserver:()=>Pa});function Pa(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new Fa(e,{thresholds:n,initialRatio:r,observeAll:i})}var Fa=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=x.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);E(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){E(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Ia=t({createMediaQueryObserver:()=>Ra});function La(e={}){let t={};for(let n of[`minWidth`,`maxWidth`,`width`,`minHeight`,`maxHeight`,`height`]){let r=Number(e[n]);Number.isFinite(r)&&r>=0&&(t[n]=r)}return typeof e.orientation==`string`&&/^[-_a-z0-9]+$/i.test(e.orientation)&&(t.orientation=e.orientation),t}function Ra(e,t={}){return new za(e,t)}var za=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=x.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){E(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),x.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),E(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:La(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,E(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(x.remove(this._callbackId),this._callbackId=null)}};function Ba(e){if(typeof e!=`string`||e.length===0)return null;let t=[],n=``,r=0,i=()=>{n.length>0&&(t.push(n),n=``)};for(;r<e.length;){let a=e[r];if(a===`\\`){let t=e[r+1];if(t===`.`||t===`[`||t===`]`||t===`\\`){n+=t,r+=2;continue}n+=a,r++;continue}if(a===`.`){i(),r++;continue}if(a===`[`){if(t.length===0&&n.length===0)return null;i();let a=e.indexOf(`]`,r+1);if(a===-1)return null;let o=e.slice(r+1,a);if(!/^\d+$/.test(o))return null;t.push(Number(o)),r=a+1;continue}if(a===`]`)return null;n+=a,r++}return i(),t.length>0?t:null}function Va(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1],a=Object.prototype.hasOwnProperty.call(r,n);typeof i==`number`?(!a||!Array.isArray(r[n]))&&(r[n]=[]):(!a||r[n]===null||typeof r[n]!=`object`||Array.isArray(r[n]))&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Ha(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Ua(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){if(e===`**`){n.push({path:[],wildcard:!0});continue}let t=e.endsWith(`.**`),r=Ba(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Wa(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Ha(e.path,t)||Ha(t,e.path)}function Ga(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:Ua(e.expression)}))}function Ka(e,t,r=e.data,i=e.__info__||{}){for(let a of Ga(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Wa(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));I(e,a.observer,i,`data observer`)}}function qa(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Ja(e,t){let n=e.__info__?.properties||{};return t.flatMap(e=>{let t=e.path[0];return typeof t!=`string`||!Object.prototype.hasOwnProperty.call(n,t)?[]:[{propertyName:t,oldValue:e.path.length===1?e.oldValue:void 0,path:e.path,value:e.value}]})}function Ya(e,t,r){if(!t||typeof t!=`object`||Array.isArray(t))return console.warn(`[service] setData data must be an object`),null;let i=!e.__dataUpdateTransaction__,a=e.__dataUpdateTransaction__||{changes:[],pendingPaths:[],callbacks:[]};e.__dataUpdateTransaction__=a,n(r)&&a.callbacks.push(r);for(let r of Object.keys(t)){let i=Ba(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=y(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;Va(e.data,i,o),a.changes.push({key:r,path:i,oldValue:s,value:o}),a.pendingPaths.push(i)}if(!i)return null;try{for(;a.pendingPaths.length>0;){let t=a.pendingPaths;a.pendingPaths=[],Ka(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:qa(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Ja(e,a.changes)}}function Xa(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);s.length===1&&c===a.oldValue&&!t?.observeAssignments||(r(o)?I(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&I(e,o,[c,a.oldValue,s],`property observer`))}}var Za=new Map;function Qa(e){return Za.has(e)||Za.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Za.get(e)}function $a(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return x.store(()=>{r.forEach(t=>I(e,t,[],`setData callback`))})}function eo(e){let t=Qa(e);t.depth++}function to(e){let t=Qa(e);t.depth>0&&t.depth--,t.depth===0&&ro(e)}function no(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Ba(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(Je({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function K(e,t,n,r,i=[]){let a=Qa(e),o=a.byModuleId.get(t),s=no(n,i);if(o)Object.assign(o.data,s.data),o.changes.push(...s.changes);else{let e={moduleId:t,data:s.data,changes:s.changes};a.byModuleId.set(t,e),a.updates.push(e)}r&&a.callbackIds.push(r),a.depth===0&&!a.scheduled&&(a.scheduled=!0,Promise.resolve().then(()=>{a.scheduled=!1,a.depth===0&&ro(e)}))}function ro(e){let t=Za.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,w.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function io(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>io(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=io(n)),e),{}):e}function ao(e){if(e){let t={};for(let n in e){let r=_e(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(so),default:r.value}}return t}}var oo=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function so(e){return Array.isArray(e)?e.map(e=>so(e)):e===null||e===``?null:oo.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function co(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,m(n),h(n),r];for(let t of i)if(t&&e[t]!==void 0){let n=e[t];if(typeof n==`string`)return{bind:n};if(n&&typeof n==`object`)return n}}function lo(e,t){if(!Array.isArray(t))return;let r=new WeakMap,i=new WeakSet,a=e.properties,o=e.data,s=e.methods,c=e.relations,l=Object.prototype.hasOwnProperty.call(e,`export`),u=e.export,d,f,p,m,h;function g(e,t){let n=Array.isArray(e)?[...e]:{...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],i=t[e];n[e]=typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?g(r,i):i}return n}function _(e,t){if(typeof t==`string`){ee(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>_(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=g(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function ee(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>_(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=g(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function q(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 uo(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function fo(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 po(e,t){if(!(!e||!e.expression)){if(e.isSimple)return f(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function mo(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!q(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&&fo(i,n)&&(o[r]=y(po(i,e.data)))}if(Object.keys(o).length>0){let e=t.normalizePropertyValues?.(o,{applyFilter:!1})||o,n=t.tO?.(e)||t.normalizePropertyValues?.(e)||e;t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,e),i.push({child:t,data:n})}}return i}var ho=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],go=[`show`,`hide`,`resize`,`routeDone`],_o=class e{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=y(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.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,_e(t)]))}init({deferInitialData:e=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=Se(n,void 0,{absent:!0});if(this.data[t]=r,this.__initialPropertyNames__.has(t)){let n=this.normalizePropertyValue(t,e[t],{applyFilter:!1});this.__initialPropertyValues__[t]=n,this.__initialPropertyChanges__.push({propertyName:t,oldValue:void 0,path:[t],value:n})}}}this.#u(),this.#t(),this.#e(),this.#m(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,w.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__=[],K(this.bridgeId,this.__id__,{},$a(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(!(!e||typeof e!=`object`))for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}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(`/`)}return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(Z.instances[this.bridgeId]||{}).filter(e=>e===this||!e.__isComponent__||e.__componentAttached__||e.__componentAttaching__);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.#a(t,e));for(let e of o)this.#s(n,e,r)}this.#i()}#i(){let e=Object.values(Z.instances[this.bridgeId]||{});for(let t of e)t!==this&&t._checkRelationsWithTarget&&t._checkRelationsWithTarget(this)}_checkRelationsWithTarget(e){let t=this.__info__.relations;if(t)for(let[n,r]of Object.entries(t)){let{type:t,target:i}=r,a=this.__relationPaths__.get(n),o=!1;o=i?e.hasBehavior&&e.hasBehavior(i):e.is===a||e.is.endsWith(`/${a}`),o&&this.#a(e,t)&&this.#s(n,e,r)}}#a(e,t){let n=Object.values(Z.instances[this.bridgeId]||{});switch(t){case`parent`:return e.__id__===this.__parentId__;case`child`:return e.__parentId__===this.__id__;case`ancestor`:return this.#o(e.__id__,this.__id__,n);case`descendant`:return this.#o(this.__id__,e.__id__,n);default:return!1}}#o(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}#s(e,t,n){let r=this.__relations__.get(e)||[];r.includes(t)||(r.push(t),this.__relations__.set(e,r),I(this,n.linked,[t],`relation linked callback`))}#c(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),I(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){I(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=Ya(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Xa(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),Xa(this,n.propertyChanges);return}let r=mo(this,Z.instances[this.bridgeId],n.changedData);K(this.bridgeId,this.__id__,n.changedData,$a(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{K(this.bridgeId,e.__id__,t)}),Xa(this,n.propertyChanges)}#u(){ho.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&go.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#d(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#f(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=this.__initialPropertyChanges__.map(e=>e.path);e.length>0&&(Ka(this,e),Xa(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),I(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return Ka(this,o),Xa(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=Se(s,t,{absent:r});if(r||!i||!this.hasPropertyFilter(e))return c;let l=this.__info__.properties[e],u=n(l.filter)?l.filter:this.__info__.methods?.[l.filter];if(!n(u))return c;let d=I(this,u,[c,a,o],`property filter`);return d===void 0?c:d}normalizePropertyValues(e,{applyFilter:t=!0}={}){let n={};for(let[r,i]of Object.entries(e||{}))n[r]=this.normalizePropertyValue(r,i,{applyFilter:t});return n}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 Da().in(this)}selectComponent(e){let t=Object.values(Z.instances[this.bridgeId]),n=t.find(n=>q(n,this.__id__,t)&&uo(e,n));return n?n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Z.instances[this.bridgeId]);return t.filter(n=>q(n,this.__id__,t)&&uo(e,n))}selectOwnerComponent(){let e=Object.values(Z.instances[this.bridgeId]);for(let t of e)if(t.id===this.__parentId__)return t;return null}createIntersectionObserver(e){return Pa(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,eo(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{I(this,e,[],`groupSetData callback`)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__,n=this.__groupSetDataChanges__;this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];let r=mo(this,Z.instances[this.bridgeId],e);K(this.bridgeId,this.__id__,e,$a(this,t),n),r.forEach(({child:e,data:t})=>{K(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];to(this.bridgeId)}}createMediaQueryObserver(e){return Ra(this,e)}getRelationNodes(e){let t=this.__relations__.get(e);return t?[...t]:null}animate(e,t,r,i,a){n(i)&&(a=i,i=void 0),E(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),E(`componentClearAnimation`,{moduleId:this.__id__,selector:e,options:t||{},success:r},`render`)}async triggerEvent(t,n,r={}){if(!t)return;let i=t.trim();if(!i)return;let a={bubbles:r.bubbles===!0,composed:r.composed===!0,capturePhase:r.capturePhase===!0},o={id:this.id,dataset:this.dataset||{}},s=!1,c=!1,l={type:i,timeStamp:Date.now(),detail:n,bubbles:a.bubbles,composed:a.composed,currentTarget:null,target:o,preventDefault(){c=!0},stopPropagation(){s=!0}};Object.defineProperty(l,"defaultPrevented",{enumerable:!0,get:()=>c});let u=e.prototype.getCustomEventPath.call(this,a.composed),d=async(e,t)=>{let n=co(e.eventAttr,i);if(!n)return;let r=t?n.captureCatch??n.captureBind:n.catch??n.bind;if(!r)return;l.currentTarget=e.currentTarget;let a=await Z.triggerEvent({bridgeId:this.bridgeId,moduleId:e.moduleId,methodName:r,event:l});(t?n.captureCatch:n.catch)&&l.stopPropagation(),a===!1&&(l.preventDefault(),l.stopPropagation())};if(a.capturePhase)for(let e=u.length-1;e>=0&&!s;e--)await d(u[e],!0);if(s)return;let f=a.bubbles?u:u.slice(0,1);for(let e of f)if(await d(e,!1),s)break}getCustomEventPath(e){let t=[{moduleId:this.__pageId__,eventAttr:this.__eventAttr__||{},currentTarget:{id:this.id,dataset:this.dataset||{}}}];if(Array.isArray(this.__eventPath__)){let n=this.__eventPath__.filter(e=>e?.moduleId).map(e=>{let t=e.isComponentHost&&e.nodeModuleId?Z.instances[this.bridgeId]?.[e.nodeModuleId]:null;return{moduleId:e.moduleId,nodeModuleId:e.nodeModuleId,isComponentHost:e.isComponentHost===!0,eventAttr:e.eventAttr||{},currentTarget:{id:t?.id??e.targetInfo?.id,dataset:t?.dataset||e.targetInfo?.dataset||{}}}}),r=Z.instances[this.bridgeId]||{},i=new Set([this.__id__]),a=0,o=r[this.__parentId__];for(;o?.__isComponent__&&!i.has(o.__id__);){i.add(o.__id__);let e=n.findIndex(e=>e.isComponentHost&&e.nodeModuleId===o.__id__);if(e>=0)a=Math.max(a,e+1);else if(Object.keys(o.__eventAttr__||{}).length>0){let e=-1;for(let t=0;t<n.length;t++)n[t].moduleId===o.__id__&&(e=t);let t=Math.max(a,e+1);n.splice(t,0,{moduleId:o.__pageId__,nodeModuleId:o.__id__,isComponentHost:!0,eventAttr:o.__eventAttr__,currentTarget:{id:o.id,dataset:o.dataset||{}}}),a=t+1}o=r[o.__parentId__]}for(let r of n)(e||r.moduleId===this.__pageId__)&&t.push(r);return t}let n=Z.instances[this.bridgeId]||{},r=new Set([this.__id__]),i=n[this.__parentId__];for(;i?.__isComponent__&&!r.has(i.__id__);)r.add(i.__id__),(e||i.__pageId__===this.__pageId__)&&t.push({moduleId:i.__pageId__,eventAttr:i.__eventAttr__||{},currentTarget:{id:i.id,dataset:i.dataset||{}}}),i=n[i.__parentId__];return t}pageReady(){this.__isComponent__||I(this,this.ready,[],`ready lifetime`)}pageUnload(){this.__isComponent__||I(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;I(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||I(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||I(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return I(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||I(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){L(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),I(this,this.onShow,[],`page show lifetime`)}pageHide(){L(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),I(this,this.onHide,[],`page hide lifetime`)}pageResize(e){L(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),I(this,this.resize,[e],`page resize lifetime`)}componentRouteDone(){L(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),I(this,this.routeDone,[],`page routeDone lifetime`)}componentCreated(){L(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),I(this,this.created,[],`created lifetime`)}componentAttached(){L(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),I(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){L(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),I(this,this.ready,[],`ready lifetime`)}componentMoved(){L(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),I(this,this.moved,[],`moved lifetime`);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)}}componentDetached(){this.__componentAttached__=!1,L(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),I(this,this.detached,[],`detached lifetime`);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.#c(t,r,n)}this.#h(),this.initd=!1}#h(){let e=Object.values(Z.instances[this.bridgeId]||{});for(let t of e)if(!(t===this||!t.__relations__))for(let[e,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];I(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){L(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),I(this,this.error,[e],`error lifetime`,!1)}},J=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,lo(this.moduleInfo,this.behaviors),this.noReferenceData=io(this.moduleInfo.data||{})}getProps(){let e=ao(this.moduleInfo.properties),t=Array.isArray(this.behaviors)?this.behaviors.filter(e=>typeof e==`string`&&e.startsWith(`wx://`)):[];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 t.length&&(e||={},e.__diminaMeta={builtinBehaviors:t}),e}},vo=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=y(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1}={}){this.#e(),this.#t(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,w.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__=[],K(this.bridgeId,this.__id__,{},$a(this,e))}setData(e,t){let n=Ya(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=mo(this,Z.instances[this.bridgeId],n.changedData);K(this.bridgeId,this.__id__,n.changedData,$a(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{K(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return Da().in(this)}getTabBar(){let e=Object.values(Z.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&q(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(Z.instances[this.bridgeId]||{}),n=t.find(n=>q(n,this.__id__,t)&&uo(e,n));return n?n.hasBehavior&&n.hasBehavior(`wx://component-export`)&&n.export?n.export():n:null}selectAllComponents(e){let t=Object.values(Z.instances[this.bridgeId]||{});return t.filter(n=>q(n,this.__id__,t)&&uo(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];this[e]=n(t)?t.bind(this):t}}#t(){L(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),I(this,this.created,[],`created lifetime`),L(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),I(this,this.attached,[],`attached lifetime`),I(this,this.onLoad,[this.opts.query||{}],`onLoad`),this.initd=!0}pageShow(){L(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),I(this,this.onShow,[],`onShow`)}pageHide(){L(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),I(this,this.onHide,[],`onHide`)}pageReady(){L(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),I(this,this.ready,[],`ready lifetime`),I(this,this.onReady,[],`onReady`)}pageUnload(){L(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),I(this,this.detached,[],`detached lifetime`),I(this,this.onUnload,[],`onUnload`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;I(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){I(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){I(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return I(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){I(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){L(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),I(this,this.onResize,[e],`onResize`)}},Y=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,lo(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=io(this.moduleInfo.data||{})}},yo=class{static type=`app`;constructor(e){this.moduleInfo=e}},X=new class{constructor(){this.staticModules={}}loadResource(e){let{appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:o,runtimeType:s}=e;if(_&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}return T.setInitId(n),s===`game`?(Ta(),b(r),w.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0):(oe(`app`)&&b(`app`),b(r),w.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0)}createAppModule(e){let t=new yo(e);this.staticModules[yo.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))b(e);if(n===Y.type){let n=new Y(e,t);this.staticModules[r]=n}else if(n===J.type){let n=new J(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[yo.type]}getModuleByPath(e){return this.staticModules[e]}},Z=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.appEnterOptions={},this.instances={},this.pageStates=new Map,this.runtimeType=`miniProgram`,this.gameLaunched=!1}setRuntimeType(e){this.runtimeType=e===`game`?`game`:`miniProgram`}isMiniGame(){return this.runtimeType===`game`}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=this.normalizeAppOptions(e),this.appEnterOptions=this.appLaunchOptions)}normalizeAppOptions(e={}){let{pagePath:t,path:n=t,...r}=e||{},i={...r,path:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];return i}getAppLaunchOptions(){return this.appLaunchOptions}getAppEnterOptions(){return this.appEnterOptions}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i])){let t=I(e,e[i],[a],`event ${i}`);try{return await t}catch(t){n(e.componentError)&&e.componentError(t),C(t),console.error(`[service] event ${i} error:`,t);return}}console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let t=this.normalizeAppOptions(e),n=X.getAppModule();if(!n){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(n.moduleInfo,this.defaultApp),this.defaultApp={},this.appLaunchOptions=t,this.appEnterOptions=t,this.app=new qi(n,t)}appShow(e){e&&Object.keys(e).length>0&&(this.appEnterOptions=this.normalizeAppOptions(e)),this.app?this.app.appShow(this.appEnterOptions):this.isMiniGame()&&this.gameLaunched&&ze(this.appEnterOptions)}appHide(){this.app?this.app.appHide():this.isMiniGame()&&this.gameLaunched&&Be()}gameLaunch(){!this.isMiniGame()||this.gameLaunched||(this.gameLaunched=!0,ze(this.appEnterOptions))}stackShow(e){T.pushStack(e)}stackHide(e){T.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u,stackId:d,isCustomTabBar:f=!1,deferInitialData:p=!1}=e,m=X.getModuleByPath(r);if(!m){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},m.type===J.type){let e=new _o(m,{bridgeId:t,moduleId:n,path:r,isCustomTabBar:f,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u});this.instances[t][n]=e,m.isComponent||T.push(e,d),e.init({deferInitialData:p});let h=this.getPageState(t);return!m.isComponent&&h.pendingShow&&!h.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(m.type===Y.type){let e=new vo(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,T.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${m.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==J.type||!i.__isComponent__||i.__componentAttached__||i.__componentAttaching__)return;r&&this.instances[t]?.[r]&&(i.__parentId__=r);let a=this.instances[t]?.[i.__parentId__];if(a?.__isComponent__&&!a.__componentAttached__){i.__componentAttachPending__=!0;return}i.__componentAttachPending__=!1,i.__componentAttaching__=!0;try{i.__componentAttached__=!0,i.componentAttached(),i.__componentAttaching__=!1,this.getPageState(t).shown&&!i.__pageShown__&&(i.__pageShown__=!0,i.pageShow());let e=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let n of e)this.moduleAttached({bridgeId:t,moduleId:n.__id__});if(i.__pendingReadyOpts__){let e=i.__pendingReadyOpts__;delete i.__pendingReadyOpts__,this.moduleReady(e)}}finally{i.__componentAttaching__=!1}}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r,eventPath:i}=e,a=this.instances[t]?.[n];if(a){if(Array.isArray(i)&&(a.__eventPath__=i),r&&a.__parentId__){let e=this.instances[t]?.[a.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(a.__type__===J.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;if(Object.values(this.instances[t]||{}).some(e=>e?.__isComponent__&&e.__componentAttached__&&!e.__componentReadied__&&this.isDescendantInstance(e,a,t))){a.__pendingReadyOpts__=e;return}a.__componentReadied__=!0,a.componentReadied(),this.flushPendingEvents(a),a.flushInitSetDataCallbacks?.();let n=this.getPageInstance(t);n&&this.checkAndCallPageReady(t,n.__id__);let r=this.instances[t]?.[a.__parentId__];for(;r?.__isComponent__;){if(r.__pendingReadyOpts__){let e=r.__pendingReadyOpts__;delete r.__pendingReadyOpts__,this.moduleReady(e)}r=this.instances[t]?.[r.__parentId__]}}}}isDescendantInstance(e,t,n){let r=e;for(;r?.__parentId__;){if(r.__parentId__===t.__id__)return!0;r=this.instances[n]?.[r.__parentId__]}return!1}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t]?.[n];r&&(r.__type__===J.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.componentDetached(),r.__componentDetached__=!0),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!1,n.pendingShow=!0,!this.instances[t])return;let r=this.getPageInstance(t);if(!r?.initd)return;if(n.shown){n.pendingShow=!1;return}n.shown=!0,n.pendingShow=!1;let i=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===Y.type?i.push(e):e.__type__===J.type&&(e.__isComponent__?e.__componentAttached__&&!e.__pageShown__&&(e.__pageShown__=!0,e.pageShow()):i.push(e)))}),i.forEach(e=>{e.pageShow()}),n.pendingReady&&this.pageReady({...e,moduleId:r.__id__})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.getPageState(t);r.pendingReady=!0;let i=this.instances[t]?.[n];i&&(r.hidden||!r.shown||r.ready||(i.__pageReadyPending__=!0,i.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n)))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===Y.type||e.__type__===J.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.getPageState(e),r=this.instances[e]?.[t];if(!r||!r.__pageReadyPending__||!n.shown||n.ready)return;let i=this.instances[e];if(!i){r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady();return}Object.values(i).filter(e=>e&&e.__type__===J.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!0,n.pendingShow=!1,!n.shown||(n.shown=!1,!this.instances[t]))return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===Y.type?r.push(e):e.__type__===J.type&&(e.__isComponent__?e.__componentAttached__&&e.__pageShown__&&(e.__pageShown__=!1,e.pageHide()):r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e;if(!this.instances[t])return;let n=this.getInstancesInTreeOrder(t);this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===J.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===J.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),T.remove(t),delete this.instances[t],this.pageStates.delete(t)}getInstancesInTreeOrder(e,{postOrder:t=!1}={}){let n=Object.values(this.instances[e]||{}).filter(Boolean),r=new Map(n.map(e=>[e.__id__,e])),i=new Map,a=[];for(let e of n)if(e.__parentId__&&r.has(e.__parentId__)){let t=i.get(e.__parentId__)||[];t.push(e),i.set(e.__parentId__,t)}else a.push(e);let o=[],s=new Set,c=e=>{if(!(!e||s.has(e))){s.add(e),t||o.push(e);for(let t of i.get(e.__id__)||[])c(t);t&&o.push(e)}};return a.forEach(c),n.forEach(c),o}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t]?.[n];i&&i.pageScrollTop({scrollTop:r})}pagePullDownRefresh({bridgeId:e}){this.getPageInstance(e)?.pagePullDownRefresh()}pageReachBottom({bridgeId:e}){this.getPageInstance(e)?.pageReachBottom()}pageShareAppMessage({bridgeId:e,...t}){return this.getPageInstance(e)?.pageShareAppMessage(t)}pageTabItemTap({bridgeId:e,...t}){this.getPageInstance(e)?.pageTabItemTap(t)}pageResize(e){let{bridgeId:t,size:n}=e;if(!this.instances[t])return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===Y.type?r.push(e):e.__type__===J.type&&(e.__isComponent__?e.__componentAttached__&&e.pageResize(n):r.push(e)))}),r.forEach(e=>e.pageResize(n))}componentError(e){let{bridgeId:t,moduleId:n,error:r}=e,i=this.instances[t]?.[n];i&&(i.__type__===J.type&&i.componentError(r),C(r))}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===J.type&&(!e.__isComponent__||e.__componentAttached__)&&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__===J.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})}},bo=t({getEnterOptionsSync:()=>So,getLaunchOptionsSync:()=>xo});function xo(){return Z.getAppLaunchOptions()}function So(){return Z.getAppEnterOptions()}var Co=t({getLocation:()=>wo,offLocationChange:()=>ko,onLocationChange:()=>Oo,openLocation:()=>Eo,startLocationUpdate:()=>To,stopLocationUpdate:()=>Do});function wo(e){return E(`getLocation`,e)}function To(e){return E(`startLocationUpdate`,e)}function Eo(e){return E(`openLocation`,e)}function Do(e){return E(`stopLocationUpdate`,e)}function Oo(e){e&&E(`onLocationChange`,{success:x.store(e,!0)})}function ko(e){if(e){let t=x.store(e,!0);E(`offLocationChange`,{success:t}),x.remove(t)}else E(`offLocationChange`),x.remove()}var Ao=t({createMapContext:()=>jo});function jo(e,t){return new Mo({mapId:e,obj:t})}var Mo=class{constructor(e){this.opts=e}addMarkers(e){return this.invoke(`addMarkers`,e)}removeMarkers(e){return this.invoke(`removeMarkers`,e)}includePoints(e){return this.invoke(`includePoints`,e)}setCenterOffset(e){return this.invoke(`setCenterOffset`,e)}getCenterLocation(e){return this.invoke(`getCenterLocation`,e)}getScale(e){return this.invoke(`getScale`,e)}moveToLocation(e){return this.invoke(`moveToLocation`,e)}translateMarker(e){return this.invoke(`translateMarker`,e)}addArc(e){return this.invoke(`addArc`,e)}removeArc(e){return this.invoke(`removeArc`,e)}invoke(e,t={}){return E(e,{mapId:this.opts.mapId,...t})}},No=t({createInnerAudioContext:()=>Io}),Po=1,Fo=class{constructor(){this._audioId=Po++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},E(`audioCreate`,{audioId:this._audioId}),E(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,E(`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,E(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,E(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,E(`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)),E(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,E(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,E(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,E(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,E(`audioStop`,{audioId:this._audioId})}seek(e){E(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){E(`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 Io(){return new Fo}var Lo=t({chooseImage:()=>Wo,chooseMessageFile:()=>Go,compressImage:()=>Uo,createImage:()=>Ro,getImageInfo:()=>Vo,previewImage:()=>Bo,previewMedia:()=>Ho,saveImageToPhotosAlbum:()=>zo});function Ro(){return wa()}function zo(e){return E(`saveImageToPhotosAlbum`,e)}function Bo(e){return E(`previewImage`,e)}function Vo(e){return E(`getImageInfo`,e)}function Ho(e){return E(`previewMedia`,e)}function Uo(e){return E(`compressImage`,e)}function Wo(e){return E(`chooseImage`,e)}function Go(e){return E(`chooseMessageFile`,e)}var Ko=t({chooseMedia:()=>Yo,chooseVideo:()=>Jo,compressVideo:()=>Qo,createVideoContext:()=>qo,getVideoInfo:()=>Xo,saveVideoToPhotosAlbum:()=>Zo});function qo(e,t){return new $o({videoId:e,obj:t})}function Jo(e){return E(`chooseVideo`,e)}function Yo(e){return E(`chooseMedia`,e)}function Xo(e){return E(`getVideoInfo`,e)}function Zo(e){return E(`saveVideoToPhotosAlbum`,e)}function Qo(e){return E(`compressVideo`,e)}var $o=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){E(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},es=t({exitMiniProgram:()=>is,navigateBackMiniProgram:()=>rs,navigateToMiniProgram:()=>ns,restartMiniProgram:()=>ts});function ts(e){return E(`restartMiniProgram`,e)}function ns(e){return E(`navigateToMiniProgram`,e)}function rs(e){return E(`navigateBackMiniProgram`,e)}function is(e){return E(`exitMiniProgram`,e)}var as=t({downloadFile:()=>os});function os(e){return E(`downloadFile`,e)}var ss=t({offLocalServiceDiscoveryStop:()=>hs,offLocalServiceFound:()=>_s,offLocalServiceLost:()=>ys,offLocalServiceResolveFail:()=>xs,onLocalServiceDiscoveryStop:()=>ms,onLocalServiceFound:()=>gs,onLocalServiceLost:()=>vs,onLocalServiceResolveFail:()=>bs,startLocalServiceDiscovery:()=>fs,stopLocalServiceDiscovery:()=>ps}),cs=N(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),ls=N(`onLocalServiceFound`,`offLocalServiceFound`),us=N(`onLocalServiceLost`,`offLocalServiceLost`),ds=N(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function fs(e={}){return E(`startLocalServiceDiscovery`,e)}function ps(e={}){return E(`stopLocalServiceDiscovery`,e)}function ms(e){return cs.on(e)}function hs(e){return cs.off(e)}function gs(e){return ls.on(e)}function _s(e){return ls.off(e)}function vs(e){return us.on(e)}function ys(e){return us.off(e)}function bs(e){return ds.on(e)}function xs(e){return ds.off(e)}var Ss=t({request:()=>Cs});function Cs(e){return E(`request`,e)}var ws=t({createTCPSocket:()=>Es}),Ts=class{constructor(e){this.socketId=e,this.events={bindWifi:N(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:N(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:N(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:N(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:N(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},oi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return M(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=M(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return M(`TCPSocket.connect`,this.socketId,e)}write(e){return M(`TCPSocket.write`,this.socketId,{data:ai(e)})}onBindWifi(e){return this.events.bindWifi.on(e)}offBindWifi(e){return this.events.bindWifi.off(e)}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onConnect(e){return this.events.connect.on(e)}offConnect(e){return this.events.connect.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}};function Es(){return new Ts(si(`tcp`))}var Ds=t({createUDPSocket:()=>ks}),Os=class{constructor(e){this.socketId=e,this.events={close:N(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:N(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:N(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:N(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},oi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return M(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=M(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return M(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return M(`UDPSocket.setTTL`,this.socketId,{ttl:e})}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onListening(e){return this.events.listening.on(e)}offListening(e){return this.events.listening.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}sendWithName(e,t){return M(e,this.socketId,{...t,message:ai(t.message)})}};function ks(){return new Os(si(`udp`))}var As=t({uploadFile:()=>Ps}),js=1;function Ms(){return`upload_${Date.now()}_${js++}`}function Ns(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function Ps(e={}){let t=Ms(),n=Ns(),r=Ns(),i=x.store(e=>n.dispatch(e),!0,`${t}_progress`),a=x.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,x.remove(i),x.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{E(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||E(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var Fs=t({closeSocket:()=>Sc,connectSocket:()=>bc,onSocketClose:()=>Ac,onSocketError:()=>kc,onSocketMessage:()=>Oc,onSocketOpen:()=>Dc,sendSocketMessage:()=>xc}),Is=0,Ls=1,Rs=3,zs=5,Bs=/^wss:\/\/.*/i,Vs={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Hs={...Vs,open:[`header`]};function Us(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:ri(e),isBuffer:!0}:{data:e}}function Ws(e,t){let n=Us(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function Gs(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n];t[n]=typeof r==`string`?r:typeof r==`number`?String(r):Object.prototype.toString.apply(r)}return t}function Ks(e,t){let n={};if(!e||typeof e!=`object`)return n;for(let r of t)r in e&&(n[r]=e[r]);return n}function qs(e){let t=Ks(e,Vs.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=ii(e.data)),t}function Js(e){return Number.isFinite(e)?e:1e3}function Ys(e){return Number.isFinite(e)&&e>=1?e:0}function Xs(e){return Object.prototype.toString.call(e).slice(8,-1)}function Zs(e){return!!e&&typeof e==`object`}function Qs(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function $s(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function ec(e){return Ks(e,[`errMsg`])}function tc(){let e;function t(t){return e=ec(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function nc(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var rc=new Set,Q,ic={open:void 0,message:void 0,error:void 0,close:void 0},ac=[],oc=!1;function sc(){oc=!1;let e=ac.splice(0,ac.length);for(let t of e)t()}function cc(e,{defer:t=!1}={}){if(!t&&ac.length===0){e();return}ac.push(e),!oc&&(oc=!0,setTimeout(sc,0))}function lc(e,t,r){let i=ic[t];if(!e||!n(i))return;let a=t===`message`?r:Ks(r,Hs[t]);L(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function uc(e,t,r,i){let a=new Set,o,s=!1;function c(e){if(!o)return;let n=o;e&&E(t,{...r,callback:n,keep:!0}),o=void 0,x.remove(n)}return{add(e){return!n(e)||a.has(e)?!1:(a.add(e),!0)},remove(e){a.delete(e)},activate(){if(o||s)return;let t=x.store(e=>i(e,[...a]),!0);o=t;try{E(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,x.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var dc=new WeakMap,fc=Symbol(`SocketTask constructor token`);function $(e){let t=dc.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function pc(e){if(rc.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function mc(e){e.connectionState=Rs,e.terminalEvent=!0}function hc(e){mc(e),pc(e)}function gc(e){if(e.activated||e.terminal)return;e.activated=!0;let t=[];try{for(let n of Object.values(e.events)){if(e.terminal)break;n.activate(),t.push(n)}}catch(n){e.activated=!1;for(let e of t.reverse())try{e.rollback()}catch{}throw n}}function _c(e,t,n){let r=$(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||gc(r)}catch(e){throw i.remove(n),e}}function vc(e,t,n){L(void 0,t,[n],`SocketTask.${e}`,!1)}var yc=class{constructor(e,t){if(e!==fc)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Is,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:uc(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=Ls,r.opened=!0;let i=n===Q;cc(()=>{vc(`onOpen`,t,Ks(e,Vs.open)),lc(i,`open`,e)})}),message:uc(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===Q,i=qs(e);cc(()=>{vc(`onMessage`,t,i),lc(r,`message`,i)})}),error:uc(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===Q;r.opened?mc(r):hc(r),cc(()=>{vc(`onError`,t,Ks(e,Vs.error)),lc(i,`error`,e)},{defer:!0})}),close:uc(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===Q;hc(r),cc(()=>{vc(`onClose`,t,Ks(e,Vs.close)),lc(i,`close`,e)})})},dc.set(this,r)}send(e={}){let t=$(this),n=Zs(e)?e:{};if(t.connectionState!==Ls){$s(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Ws({socketId:t.socketId},n.data);nc(r,n,tc()),st(`sendSocketMessage`,r)}close(e={}){let t=$(this),n=Zs(e)?e:{},r={socketId:t.socketId,code:Js(n.code)};n.reason!==void 0&&(r.reason=n.reason),nc(r,n,tc()),st(`closeSocket`,r)}onOpen(e){_c(this,`open`,e)}onMessage(e){_c(this,`message`,e)}onError(e){_c(this,`error`,e)}onClose(e){_c(this,`close`,e)}};function bc(e){if(!Zs(e))return;let{url:t}=e;if(typeof t!=`string`){$s(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${Xs(t)};`});return}if(!Bs.test(t)){$s(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new yc(fc,r),a=$(i),o=Q;if((!Q||$(Q).connectionState===Rs)&&(Q=i),rc.size>=zs)return a.connectionState=Rs,pc(a),$s(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${zs}`}),i;rc.add(i);let s=tc(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Ys(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?Gs(a):{});for(let t of[`protocols`,`tcpNoDelay`,`perMessageDeflate`,`forceCellularNetwork`]){let n=e[t];n!==void 0&&(c[t]=n)}let o=e.success;l=e.fail;let u=e.complete;n(o)&&(c.success=s.wrap(`success`,o)),n(u)&&(c.complete=s.wrap(`complete`,u))}catch(e){throw hc(a),Q===i&&(Q=o),e}c.fail=e=>{hc(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{E(`connectSocket`,c),u=!0,gc(a)}catch(t){if(u)try{st(`closeSocket`,{socketId:r,code:1e3})}catch{}hc(a),Q===i&&(Q=o),$s(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function xc(e){let t=Zs(e)?e:{},n=Qs(t);return!Q||$(Q).connectionState!==Ls?Tc(`sendSocketMessage:fail WebSocket is not connected`,t,n):wc(`sendSocketMessage`,Ws({socketId:$(Q).socketId},t.data),t,n)}function Sc(e){let t=Zs(e)?e:{},n=Qs(t),r;if(Q&&$(Q).connectionState===Ls){let e=$(Q),i=Cc(e);try{let a=Js(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=wc(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=Tc(`closeSocket:fail WebSocket is not connected`,t,n);return r}function Cc(e){let t=e.connectionState;return e.connectionState=Rs,()=>{e.terminalEvent||(e.connectionState=t)}}function wc(e,t,r,i,a){if(!i)return E(e,t).then(e=>ec(e),e=>{throw a?.(e),ec(e)});let o=tc();for(let e of[`success`,`complete`])Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=n(r[e])?o.wrap(e,r[e]):void 0);let s=n(r.fail)?r.fail:void 0;a||s?t.fail=e=>{a?.(e);let t=o.settle(e);s?.(t)}:Object.prototype.hasOwnProperty.call(r,`fail`)&&(t.fail=void 0);try{E(e,t)}catch(e){throw a?.(e),e}}function Tc(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));$s(t,r)}function Ec(e,t){n(t)&&(ic[e]=t)}function Dc(e){Ec(`open`,e)}function Oc(e){Ec(`message`,e)}function kc(e){Ec(`error`,e)}function Ac(e){Ec(`close`,e)}var jc=t({getAccountInfoSync:()=>Mc});function Mc(){return E(`getAccountInfoSync`)}var Nc=t({authorize:()=>Pc});function Pc(e){return E(`authorize`,e)}var Fc=t({login:()=>Ic});function Ic(e){return E(`login`,e)}var Lc=t({login:()=>Rc});function Rc(e){return E(`login`,e)}var zc=t({getPrivacySetting:()=>Bc});function Bc(e){return E(`getPrivacySetting`,e)}var Vc=t({getSetting:()=>Uc,openSetting:()=>Hc});function Hc(e){return E(`openSetting`,e)}function Uc(e){return E(`getSetting`,e)}var Wc=t({getUserInfo:()=>Gc});function Gc(e){return E(`getUserInfo`,e)}var Kc=t({requestPayment:()=>qc});function qc(e){return E(`requestPayment`,e)}var Jc=t({hideShareMenu:()=>Zc,showShareImageMenu:()=>Xc,showShareMenu:()=>Yc});function Yc(e){return E(`shareShareMenu`,e)}function Xc(e){return E(`showShareImageMenu`,e)}function Zc(e){return E(`hideShareMenu`,e)}var Qc=t({clearStorage:()=>ol,clearStorageSync:()=>nl,getStorage:()=>il,getStorageInfo:()=>cl,getStorageInfoSync:()=>sl,getStorageSync:()=>el,removeStorage:()=>al,removeStorageSync:()=>tl,setStorage:()=>rl,setStorageSync:()=>$c});function $c(...e){return E(`setStorageSync`,e)}function el(e){return E(`getStorageSync`,e)}function tl(e){return E(`removeStorageSync`,e)}function nl(){return E(`clearStorageSync`)}function rl(e){return E(`setStorage`,e)}function il(e){return E(`getStorage`,e)}function al(e){return E(`removeStorage`,e)}function ol(){return E(`clearStorage`)}function sl(){return E(`getStorageInfoSync`)}function cl(e){return E(`getStorageInfo`,e)}var ll=t({createAnimation:()=>ul});function ul(e={}){return new dl(e)}var dl=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`,v(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,v(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,v(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,v(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`,v(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`,v(e)]}),this}},fl=t({setBackgroundColor:()=>ml,setBackgroundTextStyle:()=>pl});function pl(e){return E(`setBackgroundTextStyle`,e)}function ml(e){return E(`setBackgroundColor`,e)}var hl=t({canvasToTempFilePath:()=>yl,createCanvas:()=>Ca,createCanvasContext:()=>_l,createContext:()=>gl,createOffscreenCanvas:()=>Sa,drawCanvas:()=>vl});function gl(){return new xl}function _l(e,t){return new xl(e,bl(t))}function vl(e={}){let t={...e,moduleId:e.moduleId||bl(e.component)};delete t.component,E(`drawCanvas`,t,`render`)}function yl(e={},t){let n={...e,moduleId:e.moduleId||bl(t||e.component)};return delete n.component,E(`canvasToTempFilePath`,n,`render`)}function bl(e){return e?.__id__||T.getPageInfo()?.id}var xl=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&&(vl({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)}},Sl=t({nextTick:()=>El}),Cl=[],wl=null;function Tl(){let e=Cl;Cl=[],wl=null;for(let t=0;t<e.length;t++)e[t]()}function El(e){n(e)&&(Cl.push(e),wl||=setTimeout(Tl,0))}var Dl=t({disableAlertBeforeUnload:()=>Fl,enableAlertBeforeUnload:()=>Pl,hideLoading:()=>Nl,hideToast:()=>kl,showActionSheet:()=>Ml,showLoading:()=>jl,showModal:()=>Al,showToast:()=>Ol});function Ol(e){return E(`showToast`,e)}function kl(e){return E(`hideToast`,e)}function Al(e){return E(`showModal`,e)}function jl(e){return E(`showLoading`,e)}function Ml(e){return E(`showActionSheet`,e)}function Nl(e){return E(`hideLoading`,e)}function Pl(e){return E(`enableAlertBeforeUnload`,e)}function Fl(e){return E(`disableAlertBeforeUnload`,e)}var Il=t({getMenuButtonBoundingClientRect:()=>Rl,offMenuButtonBoundingClientRectWeightChange:()=>Bl,onMenuButtonBoundingClientRectWeightChange:()=>zl}),Ll=new Set;S.onUpdate(e=>{e.menuRect&&Ll.forEach(t=>t(e.menuRect))});function Rl(){return E(`getMenuButtonBoundingClientRect`)}function zl(e){n(e)&&Ll.add(e)}function Bl(e){n(e)?Ll.delete(e):Ll.clear()}var Vl=t({hideHomeButton:()=>Kl,hideNavigationBarLoading:()=>Gl,setNavigationBarColor:()=>Wl,setNavigationBarTitle:()=>Ul,showNavigationBarLoading:()=>Hl});function Hl(e){return E(`showNavigationBarLoading`,e)}function Ul(e){return E(`setNavigationBarTitle`,e)}function Wl(e){return E(`setNavigationBarColor`,e)}function Gl(e){return E(`hideNavigationBarLoading`,e)}function Kl(e){return E(`hideHomeButton`,e)}var ql=t({startPullDownRefresh:()=>Yl,stopPullDownRefresh:()=>Jl});function Jl(e){return E(`stopPullDownRefresh`,e)}function Yl(e){return E(`startPullDownRefresh`,e)}var Xl=t({pageScrollTo:()=>Zl});function Zl(e){return E(`pageScrollTo`,e)}var Ql=t({hideTabBar:()=>nu,hideTabBarRedDot:()=>ou,removeTabBarBadge:()=>iu,setTabBarBadge:()=>ru,setTabBarItem:()=>eu,setTabBarStyle:()=>$l,showTabBar:()=>tu,showTabBarRedDot:()=>au});function $l(e){return E(`setTabBarStyle`,e)}function eu(e){return E(`setTabBarItem`,e)}function tu(e){return E(`showTabBar`,e)}function nu(e){return E(`hideTabBar`,e)}function ru(e){return E(`setTabBarBadge`,e)}function iu(e){return E(`removeTabBarBadge`,e)}function au(e){return E(`showTabBarRedDot`,e)}function ou(e){return E(`hideTabBarRedDot`,e)}var su=t({onWindowResize:()=>cu});function cu(e){e&&E(`onWindowResize`,{success:e})}var lu=Object.assign({"./core/base/app-event/index.js":mt,"./core/base/index.js":cn,"./core/base/performance/index.js":pn,"./core/base/subpackage/index.js":vn,"./core/base/system/index.js":xn,"./core/base/update/index.js":Nn,"./core/camera/index.js":Vn,"./core/data-analysis/index.js":Wn,"./core/device/bluetooth/index.js":or,"./core/device/bluetooth-ble/index.js":Sr,"./core/device/clipboard/index.js":Hr,"./core/device/contact/index.js":Gr,"./core/device/keyboard/index.js":Jr,"./core/device/memory/index.js":Xr,"./core/device/network/index.js":ci,"./core/device/phone/index.js":pi,"./core/device/scan/index.js":hi,"./core/device/screen/index.js":_i,"./core/device/touch/index.js":Ti,"./core/device/vibrate/index.js":Pi,"./core/ext/index.js":Li,"./core/file/index.js":Xt,"./core/life-cycle/index.js":bo,"./core/location/index.js":Co,"./core/map/index.js":Ao,"./core/media/audio/index.js":No,"./core/media/image/index.js":Lo,"./core/media/video/index.js":Ko,"./core/navigate/index.js":es,"./core/network/download/index.js":as,"./core/network/mdns/index.js":ss,"./core/network/request/index.js":Ss,"./core/network/tcp/index.js":ws,"./core/network/udp/index.js":Ds,"./core/network/upload/index.js":As,"./core/network/websocket/index.js":Fs,"./core/open-api/account-info/index.js":jc,"./core/open-api/authorize/index.js":Nc,"./core/open-api/index.js":Fc,"./core/open-api/login/index.js":Lc,"./core/open-api/privacy/index.js":zc,"./core/open-api/setting/index.js":Vc,"./core/open-api/user-info/index.js":Wc,"./core/payment/index.js":Kc,"./core/route/index.js":ct,"./core/share/index.js":Jc,"./core/storage/index.js":Qc,"./core/ui/animation/index.js":ll,"./core/ui/background/index.js":fl,"./core/ui/canvas/index.js":hl,"./core/ui/custom-component/index.js":Sl,"./core/ui/interaction/index.js":Dl,"./core/ui/menu/index.js":Il,"./core/ui/navigation-bar/index.js":Vl,"./core/ui/pull-down-refresh/index.js":ql,"./core/ui/scroll/index.js":Xl,"./core/ui/tab-bar/index.js":Ql,"./core/ui/window/index.js":su,"./core/wxml/intersection-observer/index.js":Na,"./core/wxml/media-query-observer/index.js":Ia,"./core/wxml/selector-query/index.js":Ea}),uu={},du=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`,`onUnhandledRejection`,`onPageNotFound`,`onAppRoute`]);for(let e of Object.values(lu))for(let[t,n]of Object.entries(e))uu[t]=n;function fu(e){for(let t of e||[])typeof t!=`string`||du.has(t)||Object.prototype.hasOwnProperty.call(uu,t)||t in Object.prototype||Object.defineProperty(uu,t,{value:(...e)=>E(t,...e),writable:!0,enumerable:!0,configurable:!0})}var pu=new Proxy(uu,{get(e,t,n){return du.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),mu=new class{constructor(){this.init()}init(){globalThis.__diminaReportError=C,Ue();let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}fu(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=pu;globalThis.modRequire=b,globalThis.modDefine=ae,globalThis.global={},globalThis.App=(e={})=>{X.createAppModule(e),Z.createApp()},globalThis.Page=e=>{X.createModule(e,globalThis.__extraInfo,Y.type)},globalThis.Component=e=>{X.createModule(e,globalThis.__extraInfo,J.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>Z.getApp(e),globalThis.getCurrentPages=()=>T.stack()}},hu={navigateBack:pt,navigateTo:ft,reLaunch:ut,redirectTo:dt,switchTab:lt};return new class{constructor(){console.log(`[service] init`),this.env=mu,this.message=w,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,runtimeType:l,scene:u,referrerInfo:d}=e;o&&S.init(o),Z.setRuntimeType(l),Z.setAppLaunchOptions({scene:u,pagePath:r,query:s,referrerInfo:d}),X.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c,runtimeType:l})&&Z.isMiniGame()&&Z.gameLaunch()}),this.message.on(`hostEnvUpdate`,e=>{S.update(e)}),this.message.on(`gameTouch`,({eventType:e,...t})=>{wi(e,t)}),this.message.on(`t`,async e=>{let{bridgeId:t,moduleId:n,methodName:r,event:i,success:a}=e;if(r===void 0)return;let o=await Z.triggerEvent({bridgeId:t,moduleId:n,methodName:r,event:i});o!==void 0&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:t,moduleId:n,success:a,data:o}})}),this.message.on(`triggerCallback`,e=>{let{id:t,args:n}=e;x.invoke(t,n)}),this.message.on(`flushCallbacks`,({requestId:e})=>{this.message.invoke({type:`callbacksFlushed`,target:`container`,body:{requestId:e}})}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=x.store(e=>s(r.success,e))),r.fail&&(o=x.store(e=>s(r.fail,e)));let c=x.store(e=>{s(r.complete,e),x.remove(a),x.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e;if(Z.isMiniGame())return;let a=X.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=X.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=Z.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});w.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,e=>{Z.appShow(e)}),this.message.on(`appHide`,()=>{Z.appHide()}),this.message.on(`stackShow`,({stackId:e})=>{Z.stackShow(e)}),this.message.on(`stackHide`,({stackId:e})=>{Z.stackHide(e)})}onModuleMsg(){this.message.on(`mC`,e=>{Z.createInstance(e)}),this.message.on(`mA`,e=>{Z.moduleAttached(e)}),this.message.on(`mR`,e=>{Z.moduleReady(e)}),this.message.on(`mU`,e=>{Z.moduleUnmounted(e)}),this.message.on(`pageUnload`,e=>{Z.pageUnload(e)}),this.message.on(`pageShow`,e=>{Z.pageShow(e)}),this.message.on(`pageReady`,e=>{Z.pageReady(e)}),this.message.on(`pageHide`,e=>{Z.pageHide(e)}),this.message.on(`pagePullDownRefresh`,e=>{Z.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{Z.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=Z.pageShareAppMessage(e);e?.success&&this.message.send({type:`triggerCallback`,target:`container`,body:{bridgeId:e.bridgeId,id:e.success,args:[t],data:t}})}),this.message.on(`pageScroll`,e=>{Z.pageScroll(e)}),this.message.on(`pageResize`,e=>{Z.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{Z.pageTabItemTap(e)}),this.message.on(`pageRouteDone`,e=>{let{bridgeId:t}=e;Z.componentRouteDone({bridgeId:t})}),this.message.on(`componentError`,e=>{Z.componentError(e)}),this.message.on(`h5SdkAction`,async(e={})=>{let t=e?.name?.replace(/h5/i,``),{url:n}=e?.params?.data?.params||{};if(e.params&&(e.params.data={...e.params?.data,...e.params?.data?.params||{}}),t===`postMessage`&&e.parentWebViewId){let{moduleId:t,attrs:n,params:r}=e,i={detail:{data:[r?.data?.params?.data]}},a=n.message,o=e.parentWebViewId,s=await Z.triggerEvent({bridgeId:o,moduleId:t,methodName:a,event:i});s!==void 0&&this.message.send({type:`triggerCallback`,target:`service`,body:{bridgeId:o,moduleId:t,success:r?.success,data:s}})}hu[t]?.({url:n,...e.params})})}}})();
6
+ `;console.error(`require ${e} error: ${a}`),n(globalThis.__diminaReportError)&&globalThis.__diminaReportError(t),n(r)&&r({mod:e,errMsg:t.message})}i.exports=t.exports===void 0?a:t.exports}return n(t)&&t(i.exports),i.exports}_.async=async e=>new Promise((t,n)=>{try{t(_(e))}catch(t){n(Error(`${t.message}: Failed to initialize asynchronous loading for module '${e}'`))}});var v=new class{constructor(){this.callbacks={}}store(e,t,n=p()){if(t){for(let[t,n]of Object.entries(this.callbacks))if(n.callback===e)return t}return this.callbacks[n]={callback:e,keep:t},n}invoke(e,t){if(e===void 0)return;let r=this.callbacks[e];r&&n(r.callback)&&(r.keep||delete this.callbacks[e],r.callback(t))}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]})}},ue=33554432;ue/4;var de=Math.floor(ue/4/4);function fe(e){let t=Number(e);if(!Number.isFinite(t))return null;let n=Math.abs(Math.trunc(t));return Number.isSafeInteger(n)?n:null}function pe(e,t,{allowZero:n=!1,transferable:r=!1}={}){let i=fe(e),a=fe(t);return i===null||a===null?`pixel dimensions must be finite non-zero safe integers`:i>4096||a>4096?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:i===0||a===0?n?null:`pixel dimensions must be finite non-zero safe integers`:i>Math.floor((r?de:8388608)/a)?r?`pixel dimensions exceed the maximum transferable pixel data`:`pixel dimensions exceed the maximum canvas bitmap`:null}function y(e,t){if(e===void 0)return t;let n=Number(e);if(!Number.isFinite(n)||n<0)return t;let r=Math.floor(n);if(!Number.isSafeInteger(r)||r>4096)throw RangeError(`canvas dimensions exceed the maximum canvas bitmap`);return r}var me=`__dimina_data_function_reference__`,he=1;function ge(e){return{[me]:e,version:he}}function _e(e){return typeof e==`object`&&!!e&&e.version===he&&typeof e[me]==`string`&&Object.keys(e).length===2}function ve(e){return _e(e)?e[me]:void 0}function ye(e,{mapFunction:t,mapReference:n}={},r=new WeakMap){if(typeof e==`function`)return t?t(e):e;if(typeof e!=`object`||!e)return e;if(_e(e))return n?n(e):e;if(e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Array.isArray(e)){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e}if(r.has(e))return r.get(e);let i=Array.isArray(e)?[]:{};r.set(e,i);for(let a of Object.keys(e))i[a]=ye(e[a],{mapFunction:t,mapReference:n},r);return i}var be=new Set([String,Number,Boolean,Object,Array,null]);function xe(e){return be.has(e)}function Se(e){return e===String?``:e===Number?0:e===Boolean?!1:e===Array?[]:null}function Ce(e){return Array.isArray(e)?e.filter(xe):[]}function we(e){let t,n=[],r;return xe(e)?t=e:e&&typeof e==`object`&&(t=e.type,n=Ce(e.optionalTypes),r=e.value),xe(t)||(t=n[0]??null),r===void 0&&(r=Se(t)),{type:t,optionalTypes:n,value:ie(r)}}function Te(e){return Array.isArray(e)}function Ee(e){return Te(e)&&e?.constructor?.name===Array.name}function De(e,t){return e===String?typeof t==`string`:e===Number?Number.isFinite(t):e===Boolean?typeof t==`boolean`:e===Object?t!==null&&t?.constructor===Object:e===Array?Ee(t):t!==void 0}function Oe(e,t){typeof e==`function`&&e(t)}function ke(e,t,{absent:n=!1,warn:r}={}){if(n)return ie(e.value);for(let n of e.optionalTypes||[])if(De(n,t))return t;let i=e.type;if(i===String)return t==null?(Oe(r,`property received type-uncompatible value: expected <String> but get null value. Used empty string instead.`),``):(typeof t==`object`&&Oe(r,`property received type-uncompatible value: expected <String> but got object-typed value. Forcely converted.`),String(t));if(i===Number){try{if(Number.isFinite(Number(t)))return Number(t)}catch{}return Oe(r,`property received type-uncompatible value: expected <Number> but ${typeof t==`number`?`got NaN or Infinity`:`got non-number value`}. Used 0 instead.`),0}return i===Boolean?!!t:i===Array?Te(t)?t:(Oe(r,`property received type-uncompatible value: expected <Array> but got non-array value. Used empty array instead.`),[]):i===Object?typeof t==`object`?t:(Oe(r,`property received type-uncompatible value: expected <Object> but got non-object value. Used null instead.`),null):t===void 0?null:t}var b=new class{constructor(){this.listeners=new Set,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},this.listeners.forEach(t=>t(e,this.snapshot))}onUpdate(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get(e){return this.active?this.snapshot[e]??null:null}getSystemInfo(){return this.get(`systemInfo`)}getMenuRect(){return this.get(`menuRect`)}};function Ae(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 je={error:[],show:[],hide:[]},Me,Ne=!1,Pe=!1;function Fe(e,t){return`${t}${e===`error`?`Error`:e===`show`?`AppShow`:`AppHide`}`}function Ie(e,t){if(typeof t!=`function`){console.error(`${Fe(e,`on`)} should accept a function instead of ${typeof t}`);return}je[e].push(t)}function Le(e,t){if(!t){je[e]=[];return}if(typeof t!=`function`){console.error(`${Fe(e,`off`)} should accept a function instead of ${typeof t}`);return}je[e]=je[e].filter(e=>e!==t)}function Re(e,t,n){try{e(...t)}catch(e){Ne||x(e),console.error(`[service] ${n} error:`,e)}}function ze(e,t,n){for(let r of[...je[e]])Re(r,t,n)}function Be(e){Ie(`error`,e)}function Ve(e){Le(`error`,e)}function He(e){Ie(`show`,e)}function Ue(e){Le(`show`,e)}function We(e){Ie(`hide`,e)}function Ge(e){Le(`hide`,e)}function Ke(e){ze(`show`,[e],`wx.onAppShow`)}function qe(){ze(`hide`,[],`wx.onAppHide`)}function Je(e){Me=typeof e==`function`?e:void 0}function Ye(e){if(typeof e==`string`)return e;if(e?.stack)return String(e.stack);if(e?.message)return String(e.message);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function x(e){let t=Ye(e);if(Ne)return console.error(`[service] error handler error:`,e),t;Ne=!0;try{Me&&Re(Me,[t],`App.onError`),ze(`error`,[t],`wx.onError`)}finally{Ne=!1}return t}function Xe(){if(Pe)return;Pe=!0;let e=e=>{x(e?.error||e?.message||e)};if(typeof globalThis.addEventListener==`function`){globalThis.addEventListener(`error`,e);return}let t=globalThis.onerror;globalThis.onerror=function(n,r,i,a,o){return e(o||n),typeof t==`function`&&t.call(this,n,r,i,a,o)}}var Ze=new WeakMap,Qe=new Map;function $e(e){let t=Ze.get(e);if(t)return Qe.set(t,e),t;let n;do n=`data-function-${p()}`;while(Qe.has(n));return Ze.set(e,n),Qe.set(n,e),n}function et(e){return Qe.get(e)}function tt(e){return ye(e,{mapFunction(e){return ge($e(e))}})}function nt(e){return ye(e,{mapReference(e){return et(ve(e))||e}})}var S=new class e{constructor(){this.event=Ae(),this.init()}init(){g?globalThis.onmessage=e=>{this.handleMsg(e.data)}:DiminaServiceBridge.onMessage=this.handleMsg.bind(this)}handleMsg(e){try{let t=nt(e);console.log(`[service] receive msg: `,g?t:JSON.stringify(t));let{type:n,body:r}=t;this.event.emit(n,r)}catch(e){x(e),console.error(`[service] message handler error:`,e)}}on(e,t){this.event.on(e,t)}off(e){this.event.off(e)}send(t){return g?e.prototype.send=function(e){let t=tt(e);t.method=`publish`,globalThis.postMessage(t)}:e.prototype.send=function(e){let t=tt(e);return DiminaServiceBridge.publish(t.body.bridgeId||``,t)},this.send(t)}invoke(t){return g?e.prototype.invoke=function(e){e.method=`invoke`,globalThis.postMessage(e)}:e.prototype.invoke=function(e){return DiminaServiceBridge.invoke(e)},this.invoke(t)}},C=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()}remove(e){for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t].pages,r=n.findIndex(t=>t.id===e);if(r!==-1){n.splice(r,1);return}}}getPageInfo(){let e=this.stack();return e[e.length-1]||{id:this.#t}}pushStack(e){let t={id:e,pages:[]};return this.#e.push(t),t}popStack(e){if(e){let t=this.#e.findIndex(t=>t.id===e);t!==-1&&this.#e.splice(t,1)}else this.#e.length>0&&this.#e.pop()}stack(e){if(e){let t=this.#e.find(t=>t.id===e);return t||=this.pushStack(e),t.pages}{let e=this.#e[this.#e.length-1];return e?e.pages:this.pushStack(Date.now()).pages}}};function rt(e,t){if(!e)return e;let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}var it={getWindowInfo:()=>rt(b.getSystemInfo(),[`pixelRatio`,`screenWidth`,`screenHeight`,`windowWidth`,`windowHeight`,`statusBarHeight`,`safeArea`,`screenTop`]),getSystemInfoSync:()=>b.getSystemInfo(),getAppBaseInfo:()=>rt(b.getSystemInfo(),[`SDKVersion`,`enableDebug`,`host`,`language`,`version`,`theme`,`fontSizeScaleFactor`,`fontSizeSetting`]),getDeviceInfo:()=>rt(b.getSystemInfo(),[`abi`,`benchmarkLevel`,`brand`,`model`,`platform`,`system`]),getMenuButtonBoundingClientRect:()=>b.getMenuRect()},at=new Set([`connectSocket`,`downloadFile`,`loadSubpackage`,`preDownloadSubpackage`,`request`,`uploadFile`]),ot=new Set(`FileSystemManager.getSavedFileList,clearStorage,closeSocket,chooseImage,chooseMedia,chooseVideo,closeBluetoothAdapter,exitMiniProgram,getClipboardData,getBluetoothAdapterState,getBluetoothDevices,getLocation,getNetworkType,getPrivacySetting,getStorageInfo,getSystemInfo,getSystemInfoAsync,getUserInfo,hideKeyboard,hideLoading,hideShareMenu,hideTabBar,hideToast,login,navigateBack,navigateBackMiniProgram,openAppAuthorizeSetting,openBluetoothAdapter,openSetting,openSystemBluetoothSetting,showNavigationBarLoading,showShareMenu,showTabBar,startPullDownRefresh,startRecord,stopPullDownRefresh,stopBluetoothDevicesDiscovery,stopLocationUpdate,stopRecord,vibrateLong,vibrateShort`.split(`,`));function st(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function ct(e,t){return at.has(e)||typeof e==`string`&&e.endsWith(`Sync`)?!1:t!==void 0||ot.has(e)}function lt(e,t,n){let r={type:`invokeAPI`,target:n,body:{name:e,bridgeId:C.getPageInfo().id,params:t}};return n===`container`?S.invoke(r):S.send(r)}function ut(e,t,n){return new Promise((r,i)=>{let a,o,s=()=>{v.remove(a),v.remove(o)};a=v.store(e=>{s(),r(e)}),o=v.store(e=>{s(),i(e)}),t.success=a,t.fail=o;try{lt(e,t,n)}catch(e){s(),i(e)}})}function dt(e,t,r){let i,a,o,s=()=>{v.remove(i),v.remove(a)},c=()=>{v.remove(o),queueMicrotask(s)};return i=v.store(e=>{s(),n(t)&&t(e)}),a=v.store(e=>{s(),n(r)&&r(e)}),e.success=i,e.fail=a,{registerComplete(t,n,r){return o=v.store(e=>{c(),t(e)},n,r),e.complete=o,o}}}function ft(e){return i(e)||e===``}function pt({success:e,fail:t,keep:r,evtId:i}){return r||i!==void 0||!n(e)&&!n(t)?!1:(n(e)||ft(e))&&(n(t)||ft(t))}function w(e,t,r=`container`,i=!0){let a=it[e];if(r===`container`&&a){let e=a();if(e)return e}let o,s=[];if(t===void 0){if(i&&ct(e,t))return ut(e,{},r);o=t}else if(typeof t==`string`||Array.isArray(t))o=t;else if(n(t))o={success:v.store(t,!0)};else if(st(t)){let{success:e,fail:r,complete:i,keep:a,evtId:c,...l}=t;o=l,c!==void 0&&(o.evtId=c);let u;if(pt({success:e,fail:r,keep:a,evtId:c}))u=dt(o,e,r),s.push(o.success,o.fail);else{let t=!a&&c===void 0;n(e)?(o.success=v.store(e,a,c),t&&s.push(o.success)):o.success=e,n(r)?(o.fail=v.store(r,a,c),t&&s.push(o.fail)):o.fail=r}n(i)?(o.complete=u?u.registerComplete(i,a,c):v.store(i,a,c),!a&&c===void 0&&s.push(o.complete)):o.complete=i}else{let{keep:n,...a}=t;if(delete a.evtId,!n&&i&&ct(e,t))return o={...a},ut(e,o,r);o=a}try{return lt(e,o,r)}catch(e){for(let e of s)v.remove(e);throw e}}function mt(e,t,n=`container`){return w(e,t,n,!1)}var ht=t({navigateBack:()=>bt,navigateTo:()=>yt,reLaunch:()=>_t,redirectTo:()=>vt,switchTab:()=>gt});function gt(e){return e.url=ne(C.getPageInfo().route,e.url),w(`switchTab`,e)}function _t(e){return e.url=ne(C.getPageInfo().route,e.url),w(`reLaunch`,e)}function vt(e){let t=ne(C.getPageInfo().route,e.url);if(C.getPageInfo().route!==t)return e.url=t,w(`redirectTo`,e)}function yt(e){return e.url=ne(C.getPageInfo().route,e.url),w(`navigateTo`,e)}function bt(e){return w(`navigateBack`,e)}var xt=t({offAppHide:()=>Dt,offAppShow:()=>Et,offError:()=>Ct,offHide:()=>jt,offShow:()=>kt,onAppHide:()=>Tt,onAppShow:()=>wt,onError:()=>St,onHide:()=>At,onShow:()=>Ot});function St(e){Be(e)}function Ct(e){Ve(e)}function wt(e){He(e)}function Tt(e){We(e)}function Et(e){Ue(e)}function Dt(e){Ge(e)}function Ot(e){He(e)}function kt(e){Ue(e)}function At(e){We(e)}function jt(e){Ge(e)}var Mt=`__diminaArrayBufferBase64`,Nt=`__diminaFileDataBase64`,Pt=`__diminaFileDataType`,T=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ft=(()=>{let e={};for(let t=0;t<64;t++)e[T[t]]=t;return e})();function It(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function Lt(e){return e&&e.buffer&&It(e.buffer)}function Rt(e){return It(e)?e:Lt(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function zt(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=T[t[r]>>2],n+=T[(t[r]&3)<<4|t[r+1]>>4],n+=T[(t[r+1]&15)<<2|t[r+2]>>6],n+=T[t[r+2]&63];return r<t.length&&(n+=T[t[r]>>2],r+1<t.length?(n+=T[(t[r]&3)<<4|t[r+1]>>4],n+=T[(t[r+1]&15)<<2],n+=`=`):(n+=T[(t[r]&3)<<4],n+=`==`)),n}function Bt(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=Ft[t[e]],o=Ft[t[e+1]],s=t[e+2]===`=`?0:Ft[t[e+2]],c=t[e+3]===`=`?0:Ft[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function Vt(e){let t=Rt(e);return t?{[Pt]:`base64`,[Nt]:zt(t)}:e}function Ht(e,t=[`data`,`arrayBuffer`]){if(!e||typeof e!=`object`)return e;let n={...e};for(let e of t)e in n&&(n[e]=Vt(n[e]));return n}function Ut(e){return e&&typeof e==`object`&&e[Mt]!==void 0?Bt(e[Mt]):e}function Wt(e){return e&&typeof e==`object`&&e.data!==void 0?{...e,data:Ut(e.data)}:e}function Gt(e){if(!e||typeof e!=`object`||!e.entries||typeof e.entries!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.entries))t[n]=r&&typeof r==`object`&&r.data!==void 0?{...r,data:Ut(r.data)}:r;return{...e,entries:t}}function Kt(e,t,n=0){if(!e||typeof e!=`object`||!t||e[Mt]===void 0)return e;let r=new Uint8Array(Bt(e[Mt]));new Uint8Array(t).set(r,n);let{[Mt]:i,...a}=e;return{...a,arrayBuffer:t}}function qt(e){let t={...e},n=Rt(e?.arrayBuffer);return n&&(t.arrayBufferLength=n.byteLength,delete t.arrayBuffer),t}var Jt=class{constructor(e={}){this.mode=e.mode,this.size=e.size,this.lastAccessedTime=e.lastAccessedTime,this.lastModifiedTime=e.lastModifiedTime,this._isDirectory=!!e.isDirectory,this._isFile=!!e.isFile}isDirectory(){return this._isDirectory}isFile(){return this._isFile}};function Yt(e){return e&&typeof e==`object`&&typeof e.size==`number`&&Object.prototype.hasOwnProperty.call(e,`isDirectory`)&&Object.prototype.hasOwnProperty.call(e,`isFile`)}function Xt(e){if(!e||typeof e!=`object`||typeof e.isDirectory==`function`&&typeof e.isFile==`function`)return e;if(Yt(e))return new Jt(e);if(Array.isArray(e))return e.map(e=>Xt(e));let t={};for(let[n,r]of Object.entries(e))t[n]=Xt(r);return t}function Zt(e){if(e&&typeof e==`object`){if(e.stats!==void 0)return{...e,stats:Xt(e.stats)};if(e.statsMap!==void 0)return{...e,statsMap:Xt(e.statsMap)}}return Xt(e)}function Qt(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function E(e,t,{transform:n=e=>e,prepare:r=e=>e}={}){let i=w(e,r(Qt(t,n)));return i&&typeof i.then==`function`?i.then(n):i}function $t(e,t){let n=t?.arrayBuffer,r=t?.offset||0;return E(e,t,{prepare:qt,transform:e=>Kt(e,n,r)})}var en=class{access(e){return E(`FileSystemManager.access`,e)}accessSync(e){return w(`FileSystemManager.accessSync`,e)}appendFile(e){return E(`FileSystemManager.appendFile`,e,{prepare:Ht})}appendFileSync(e,t,n){return w(`FileSystemManager.appendFileSync`,Ht({filePath:e,data:t,encoding:n}))}close(e){return E(`FileSystemManager.close`,e)}closeSync(e){return w(`FileSystemManager.closeSync`,e)}copyFile(e){return E(`FileSystemManager.copyFile`,e)}copyFileSync(e,t){return w(`FileSystemManager.copyFileSync`,{srcPath:e,destPath:t})}fstat(e){return E(`FileSystemManager.fstat`,e,{transform:Zt})}fstatSync(e){return Zt(w(`FileSystemManager.fstatSync`,e))}ftruncate(e){return E(`FileSystemManager.ftruncate`,e)}ftruncateSync(e){return w(`FileSystemManager.ftruncateSync`,e)}getFileInfo(e){return E(`FileSystemManager.getFileInfo`,e)}getSavedFileList(e){return E(`FileSystemManager.getSavedFileList`,e||{})}mkdir(e){return E(`FileSystemManager.mkdir`,e)}mkdirSync(e,t){return w(`FileSystemManager.mkdirSync`,{dirPath:e,recursive:t})}open(e){return E(`FileSystemManager.open`,e)}openSync(e){return w(`FileSystemManager.openSync`,e)}read(e){return $t(`FileSystemManager.read`,e)}readSync(e){return Kt(w(`FileSystemManager.readSync`,qt(e)),e?.arrayBuffer,e?.offset||0)}readCompressedFile(e){return E(`FileSystemManager.readCompressedFile`,e,{transform:Wt})}readCompressedFileSync(e){return Ut(w(`FileSystemManager.readCompressedFileSync`,e))}readdir(e){return E(`FileSystemManager.readdir`,e)}readdirSync(e){return w(`FileSystemManager.readdirSync`,e)}readFile(e){return E(`FileSystemManager.readFile`,e,{transform:Wt})}readFileSync(e,t,n,r){return Ut(w(`FileSystemManager.readFileSync`,{filePath:e,encoding:t,position:n,length:r}))}readZipEntry(e){return E(`FileSystemManager.readZipEntry`,e,{transform:Gt})}removeSavedFile(e){return E(`FileSystemManager.removeSavedFile`,e)}rename(e){return E(`FileSystemManager.rename`,e)}renameSync(e,t){return w(`FileSystemManager.renameSync`,{oldPath:e,newPath:t})}rmdir(e){return E(`FileSystemManager.rmdir`,e)}rmdirSync(e,t){return w(`FileSystemManager.rmdirSync`,{dirPath:e,recursive:t})}saveFile(e){return E(`FileSystemManager.saveFile`,e)}saveFileSync(e,t){return w(`FileSystemManager.saveFileSync`,{tempFilePath:e,filePath:t})}stat(e){return E(`FileSystemManager.stat`,e,{transform:Zt})}statSync(e,t){return Zt(w(`FileSystemManager.statSync`,{path:e,recursive:t}))}truncate(e){return E(`FileSystemManager.truncate`,e)}truncateSync(e,t){return w(`FileSystemManager.truncateSync`,{filePath:e,length:t})}unlink(e){return E(`FileSystemManager.unlink`,e)}unlinkSync(e){return w(`FileSystemManager.unlinkSync`,e)}unzip(e){return E(`FileSystemManager.unzip`,e)}write(e){return E(`FileSystemManager.write`,e,{prepare:e=>Ht(e,[`arrayBuffer`,`data`])})}writeSync(e){return w(`FileSystemManager.writeSync`,Ht(e,[`arrayBuffer`,`data`]))}writeFile(e){return E(`FileSystemManager.writeFile`,e,{prepare:Ht})}writeFileSync(e,t,n){return w(`FileSystemManager.writeFileSync`,Ht({filePath:e,data:t,encoding:n}))}};Object.getOwnPropertyNames(en.prototype).filter(e=>e!==`constructor`);var tn=null;function nn(){return tn||=new en,tn}var rn=t({USER_DATA_PATH:()=>an,fileSystemManagerAPINames:()=>on,getFileSystemManager:()=>pn}),an=`difile://usr`,on=[`access`,`stat`,`readFile`,`writeFile`,`appendFile`,`copyFile`,`rename`,`unlink`,`mkdir`,`rmdir`,`readdir`,`getFileInfo`,`saveFile`,`getSavedFileList`,`removeSavedFile`,`truncate`],sn=`is not supported by the devtools simulator: the service thread talks to the container over an asynchronous postMessage bridge, so a synchronous return value is impossible — use the async variant`,cn=`not supported by the devtools simulator (no container backend)`;function ln(e){return function(){throw Error(`FileSystemManager.${e} ${sn}`)}}function un(e){return function(t={}){t.fail?.({errMsg:`${e}:fail ${cn}`}),t.complete?.()}}function dn(e){let t=Object.getPrototypeOf(e),n=new Set(on);for(let e of Object.getOwnPropertyNames(t))e===`constructor`||n.has(e)||(t[e]=e.endsWith(`Sync`)?ln(e):un(e));return e}var fn;function pn(){return fn||=dn(nn()),fn}var mn=[`applyUpdate`,`onCheckForUpdate`,`onUpdateFailed`,`onUpdateReady`],hn=t({canIUse:()=>yn,env:()=>gn}),gn={USER_DATA_PATH:`difile://usr`},_n=new Set([`nextTick`,`onError`,`offError`,`onAppShow`,`onAppHide`,`offAppShow`,`offAppHide`,`onShow`,`offShow`,`onHide`,`offHide`,`createCanvas`,`createImage`,`onTouchStart`,`offTouchStart`,`onTouchMove`,`offTouchMove`,`onTouchEnd`,`offTouchEnd`,`onTouchCancel`,`offTouchCancel`,`getUpdateManager`,`UpdateManager`,...mn.map(e=>`UpdateManager.${e}`),`getPerformance`,`getFileSystemManager`,`FileSystemManager`,...on.map(e=>`FileSystemManager.${e}`)]),vn={createUDPSocket:`UDPSocket.bind`,UDPSocket:`UDPSocket.bind`,createTCPSocket:`TCPSocket.connect`,TCPSocket:`TCPSocket.connect`};function yn(e){if(_n.has(e))return!0;try{return w(`canIUse`,Object.hasOwn(vn,e)?vn[e]:e)===!0}catch(t){return console.warn(`[canIUse] check ${e} error:`,t),!1}}var bn=t({getPerformance:()=>xn});function xn(){return Sn.getInstance()}var Sn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one Performance instance.`);this.entryList=new Cn,e.#e=this}static getInstance(){return e.#e||=new e,e.#e}createObserver(e){return new wn(this,e)}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}},Cn=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}},wn=class{constructor(e,t){this.performance=e,this.entryTypes=[],this.callback=t,this.observerId=null,this.callbackId=null,this.connected=!1}observe(e={}){this.disconnect(),this.connected=!0,this.entryTypes=Array.isArray(e.entryTypes)?e.entryTypes:[],this.callbackId=v.store((e={})=>{if(e.observerId&&(this.observerId=e.observerId,!this.connected)){w(`removePerformanceObserver`,{observerId:e.observerId},`render`),v.remove(this.callbackId),this.callbackId=null;return}let t=e?.data?.entryList?JSON.parse(e.data.entryList):[];this.connected&&t.length>0&&(this.performance.entryList.push(t),this.notify(t))},!0),w(`addPerformanceObserver`,{entryTypes:this.entryTypes,success:this.callbackId},`render`)}notify(e){if(this.connected){let t=new Cn;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})),typeof this.callback==`function`&&this.callback(t)}}disconnect(){this.connected=!1,this.observerId&&w(`removePerformanceObserver`,{observerId:this.observerId},`render`),this.callbackId&&this.observerId&&v.remove(this.callbackId),this.observerId=null,this.callbackId=null}},Tn=t({loadSubpackage:()=>Dn,preDownloadSubpackage:()=>En});function En(e){return w(`preDownloadSubpackage`,e)}function Dn(e){return w(`loadSubpackage`,e)}var On=t({getAppBaseInfo:()=>In,getDeviceInfo:()=>Ln,getSystemInfo:()=>Nn,getSystemInfoAsync:()=>Fn,getSystemInfoSync:()=>Pn,getWindowInfo:()=>jn,offThemeChange:()=>zn,onThemeChange:()=>Rn,openAppAuthorizeSetting:()=>Mn,openSystemBluetoothSetting:()=>An}),kn=new Set;b.onUpdate(e=>{let t=e.systemInfo?.theme;t&&kn.forEach(e=>e({theme:t}))});function An(e){return w(`openSystemBluetoothSetting`,e)}function jn(e){return w(`getWindowInfo`,e)}function Mn(e){return w(`openAppAuthorizeSetting`,e)}function Nn(e){return new Promise(t=>{t(w(`getSystemInfo`,e))})}function Pn(){return w(`getSystemInfoSync`)}function Fn(e){return w(`getSystemInfoAsync`,e)}function In(){return w(`getAppBaseInfo`)}function Ln(){return w(`getDeviceInfo`)}function Rn(e){n(e)&&kn.add(e)}function zn(e){n(e)?kn.delete(e):kn.clear()}var Bn=t({getUpdateManager:()=>Kn}),Vn=`onUpdateStatusChange`,Hn=`updatefail`,Un=`updateready`,Wn=`noupdate`,Gn=`updating`;function Kn(){return qn.getInstance()}var qn=class e{static#e=null;constructor(){if(e.#e)throw Error(`Cannot instantiate more than one UpdateManager instance.`);this.hasAppliedUpdate=!1,this.updateFailed=!1,this.updateReady=!1,this.checkForUpdateResult=null,this.updateFailedListeners=[],this.updateReadyListeners=[],this.checkForUpdateListeners=[],S.on(Vn,e=>this.handleUpdateStatusChange(e)),e.#e=this}handleUpdateStatusChange(e={}){let{event:t}=e;if(t===Hn){this.updateFailed=!0,this.emit(this.updateFailedListeners);return}if(t===Un){let e=this.checkForUpdateResult?.hasUpdate!==!0,t=!this.updateReady;this.updateReady=!0,this.checkForUpdateResult={hasUpdate:!0},e&&this.emit(this.checkForUpdateListeners,this.checkForUpdateResult),t&&this.emit(this.updateReadyListeners);return}if(t===Gn){this.checkForUpdateResult={hasUpdate:!0},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}if(t===Wn){this.checkForUpdateResult={hasUpdate:!1},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult);return}typeof e.hasUpdate==`boolean`&&(this.checkForUpdateResult={hasUpdate:e.hasUpdate},this.emit(this.checkForUpdateListeners,this.checkForUpdateResult))}emit(e,...t){e.slice().forEach(e=>{e(...t)})}static getInstance(){return e.#e||=new e,e.#e}applyUpdate(){if(!this.updateReady)console.error(`[applyUpdate]: update is not ready`);else if(this.hasAppliedUpdate)console.error(`[applyUpdate]: applyUpdate has been called`);else return this.hasAppliedUpdate=!0,w(`applyUpdate`)}onCheckForUpdate(e){typeof e==`function`&&(this.checkForUpdateListeners.push(e),this.checkForUpdateResult&&e(this.checkForUpdateResult))}onUpdateFailed(e){typeof e==`function`&&(this.updateFailedListeners.push(e),this.updateFailed&&e())}onUpdateReady(e){typeof e==`function`&&(this.updateReadyListeners.push(e),this.updateReady&&e())}};qn.getInstance();var Jn=t({createCameraContext:()=>Yn});function Yn(){return new Xn}var Xn=class{takePhoto(e={}){return w(`takePhoto`,e)}startRecord(e={}){return w(`startRecordCamera`,e)}stopRecord(e={}){return w(`stopRecordCamera`,e)}},Zn=t({reportAnalytics:()=>Qn,reportEvent:()=>$n});function Qn(...e){return w(`reportAnalytics`,e)}function $n(e,t){return w(`reportAnalytics`,{eventId:e,data:t})}var er=`__diminaArrayBufferBase64`,D=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,tr=(()=>{let e={};for(let t=0;t<64;t++)e[D[t]]=t;return e})();function nr(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function rr(e){return nr(e)?e:e&&e.buffer&&nr(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):null}function ir(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=D[t[r]>>2],n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=D[(t[r+1]&15)<<2|t[r+2]>>6],n+=D[t[r+2]&63];return r<t.length&&(n+=D[t[r]>>2],r+1<t.length?(n+=D[(t[r]&3)<<4|t[r+1]>>4],n+=`${D[(t[r+1]&15)<<2]}=`):n+=`${D[(t[r]&3)<<4]}==`),n}function ar(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=tr[t[e]],o=tr[t[e+1]],s=t[e+2]===`=`?0:tr[t[e+2]],c=t[e+3]===`=`?0:tr[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function or(e){let t=rr(e);return t?{[er]:ir(t)}:e}function sr(e){return e&&typeof e==`object`&&e.__diminaArrayBufferBase64!==void 0?ar(e[er]):e}function cr(e){if(!e||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e.serviceData||{}))t[n]=sr(r);return{...e,advertisData:sr(e.advertisData),serviceData:t}}function lr(e){return!e||!Array.isArray(e.devices)?e:{...e,devices:e.devices.map(cr)}}function ur(e){return!e||typeof e!=`object`?e:{...e,value:sr(e.value)}}function dr(e,t){if(!e||typeof e!=`object`)return e;let n={...e};return typeof e.success==`function`&&(n.success=n=>e.success(t(n))),typeof e.complete==`function`&&(n.complete=n=>e.complete(t(n))),n}function fr(e,t,{prepare:n=e=>e,transform:r=e=>e}={}){let i=w(e,n(dr(t,r)));return i&&typeof i.then==`function`?i.then(r):i}function pr(e,t,n=e=>e){let r=new Map;return{on(t){if(typeof t!=`function`||r.has(t))return;let i=v.store(e=>t(n(e)),!0);return r.set(t,i),w(e,{callbackId:i,success:i,keep:!0})},off(e){if(typeof e==`function`){let n=r.get(e);return n?(r.delete(e),v.remove(n),w(t,{callbackId:n,keep:!0})):void 0}for(let e of r.values())v.remove(e);return r.clear(),w(t)}}}var mr=t({closeBluetoothAdapter:()=>Dr,getBluetoothAdapterState:()=>Er,getBluetoothDevices:()=>Tr,getConnectedBluetoothDevices:()=>wr,isBluetoothDevicePaired:()=>Or,makeBluetoothPair:()=>kr,offBluetoothAdapterStateChange:()=>Cr,offBluetoothDeviceFound:()=>Sr,onBluetoothAdapterStateChange:()=>xr,onBluetoothDeviceFound:()=>br,openBluetoothAdapter:()=>yr,startBluetoothDevicesDiscovery:()=>vr,stopBluetoothDevicesDiscovery:()=>_r}),hr=pr(`onBluetoothDeviceFound`,`offBluetoothDeviceFound`,lr),gr=pr(`onBluetoothAdapterStateChange`,`offBluetoothAdapterStateChange`);function _r(e){return w(`stopBluetoothDevicesDiscovery`,e)}function vr(e){return w(`startBluetoothDevicesDiscovery`,e)}function yr(e){return w(`openBluetoothAdapter`,e)}function br(e){return hr.on(e)}function xr(e){return gr.on(e)}function Sr(e){return hr.off(e)}function Cr(e){return gr.off(e)}function wr(e){return fr(`getConnectedBluetoothDevices`,e,{transform:lr})}function Tr(e){return fr(`getBluetoothDevices`,e,{transform:lr})}function Er(e){return w(`getBluetoothAdapterState`,e)}function Dr(e){return w(`closeBluetoothAdapter`,e)}function Or(e){return w(`isBluetoothDevicePaired`,e)}function kr(e){return w(`makeBluetoothPair`,e)}var Ar=t({closeBLEConnection:()=>Kr,createBLEConnection:()=>Gr,getBLEDeviceCharacteristics:()=>Wr,getBLEDeviceRSSI:()=>Ur,getBLEDeviceServices:()=>Hr,getBLEMTU:()=>qr,notifyBLECharacteristicValueChange:()=>Vr,offBLECharacteristicValueChange:()=>Br,offBLEConnectionStateChange:()=>zr,offBLEMTUChange:()=>Yr,onBLECharacteristicValueChange:()=>Rr,onBLEConnectionStateChange:()=>Lr,onBLEMTUChange:()=>Jr,readBLECharacteristicValue:()=>Ir,setBLEMTU:()=>Fr,writeBLECharacteristicValue:()=>Pr}),jr=pr(`onBLEConnectionStateChange`,`offBLEConnectionStateChange`),Mr=pr(`onBLECharacteristicValueChange`,`offBLECharacteristicValueChange`,ur),Nr=pr(`onBLEMTUChange`,`offBLEMTUChange`);function Pr(e){return fr(`writeBLECharacteristicValue`,e,{prepare(e){return e&&typeof e==`object`?{...e,value:or(e.value)}:e}})}function Fr(e){return w(`setBLEMTU`,e)}function Ir(e){return w(`readBLECharacteristicValue`,e)}function Lr(e){return jr.on(e)}function Rr(e){return Mr.on(e)}function zr(e){return jr.off(e)}function Br(e){return Mr.off(e)}function Vr(e){return w(`notifyBLECharacteristicValueChange`,e)}function Hr(e){return w(`getBLEDeviceServices`,e)}function Ur(e){return w(`getBLEDeviceRSSI`,e)}function Wr(e){return w(`getBLEDeviceCharacteristics`,e)}function Gr(e){return w(`createBLEConnection`,e)}function Kr(e){return w(`closeBLEConnection`,e)}function qr(e){return w(`getBLEMTU`,e)}function Jr(e){return Nr.on(e)}function Yr(e){return Nr.off(e)}var Xr=t({getClipboardData:()=>Qr,setClipboardData:()=>Zr});function Zr(e){return w(`setClipboardData`,e)}function Qr(e){return w(`getClipboardData`,e)}var $r=t({addPhoneContact:()=>ti,chooseContact:()=>ei});function ei(e){return w(`chooseContact`,e)}function ti(e){return w(`addPhoneContact`,e)}var ni=t({hideKeyboard:()=>ri});function ri(e){return w(`hideKeyboard`,e)}var ii=t({offMemoryWarning:()=>oi,onMemoryWarning:()=>ai});function ai(e){return w(`onMemoryWarning`,e)}function oi(e){return w(`offMemoryWarning`,e)}var si=`__diminaArrayBufferBase64`,O=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ci=Object.fromEntries([...O].map((e,t)=>[e,t]));function li(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function ui(e){if(li(e))return e;if(ArrayBuffer.isView(e)){let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Uint8Array(t.length);return n.set(t),n.buffer}return null}function di(e){let t=new Uint8Array(e),n=``,r=0;for(;r+2<t.length;r+=3)n+=O[t[r]>>2],n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=O[(t[r+1]&15)<<2|t[r+2]>>6],n+=O[t[r+2]&63];return r<t.length&&(n+=O[t[r]>>2],r+1<t.length?(n+=O[(t[r]&3)<<4|t[r+1]>>4],n+=`${O[(t[r+1]&15)<<2]}=`):n+=`${O[(t[r]&3)<<4]}==`),n}function fi(e){let t=String(e||``).replace(/[\r\n\s]/g,``);if(!t)return new ArrayBuffer(0);let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=t.length*3/4-n,i=new Uint8Array(r),a=0;for(let e=0;e<t.length;e+=4){let n=ci[t[e]],o=ci[t[e+1]],s=t[e+2]===`=`?0:ci[t[e+2]],c=t[e+3]===`=`?0:ci[t[e+3]];a<r&&(i[a++]=n<<2|o>>4),a<r&&(i[a++]=(o&15)<<4|s>>2),a<r&&(i[a++]=(s&3)<<6|c)}return i.buffer}function pi(e){let t=ui(e);return t?{[si]:di(t)}:e}function mi(e){if(!e||typeof e!=`object`)return e;let t=e.message;return!t||typeof t!=`object`||t.__diminaArrayBufferBase64===void 0?e:{...e,message:fi(t[si])}}function hi(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function k(e,t,n={}){return w(e,{socketId:t,...n,keep:!0})}function A(e,t,n={},r=e=>e){let i=new Set,a,o,s;function c(){if(!a)return;let e=a;a=void 0,v.remove(e),o&&v.remove(o),o=void 0,w(t,{...n,callbackId:e,keep:!0})}return{on(t){if(typeof t!=`function`||(i.add(t),a))return;let c=v.store(e=>{o&&v.remove(o),o=void 0;let t=r(e);for(let e of[...i])e(t);s?.()},!0);a=c,o=v.store(()=>{a===c&&(v.remove(c),o&&v.remove(o),a=void 0,o=void 0)});try{return w(e,{...n,callbackId:c,success:c,fail:o,keep:!0})}catch(e){throw v.remove(c),o&&v.remove(o),a=void 0,o=void 0,e}},off(e){if(typeof e==`function`?i.delete(e):i.clear(),i.size===0)return c()},dispose({notifyNative:e=!1}={}){if(i.clear(),e)return c();a&&v.remove(a),o&&v.remove(o),a=void 0,o=void 0},hasListeners(){return i.size>0},setAfterEmit(e){s=e}}}var gi=t({getNetworkType:()=>vi,offNetworkStatusChange:()=>bi,onNetworkStatusChange:()=>yi}),_i=A(`onNetworkStatusChange`,`offNetworkStatusChange`);function vi(e){return w(`getNetworkType`,e)}function yi(e){return _i.on(e)}function bi(e){return _i.off(e)}var xi=t({makePhoneCall:()=>Si});function Si(e){return w(`makePhoneCall`,e)}var Ci=t({scanCode:()=>wi});function wi(e){return w(`scanCode`,e)}var Ti=t({offUserCaptureScreen:()=>ki,onUserCaptureScreen:()=>Oi,setKeepScreenOn:()=>Ai}),Ei=pr(`onUserCaptureScreen`,`offUserCaptureScreen`),Di;function Oi(e){if(typeof e==`function`)return Di&&Di!==e&&Ei.off(Di),Di=e,Ei.on(e)}function ki(e){if(typeof e!=`function`||e===Di)return Di=void 0,Ei.off(e)}function Ai(e){return w(`setKeepScreenOn`,e)}var j={touchstart:[],touchmove:[],touchend:[],touchcancel:[]};function ji(e,t){j[e]&&typeof t==`function`&&j[e].push(t)}function Mi(e,t){if(j[e]){if(!t){j[e]=[];return}j[e]=j[e].filter(e=>e!==t)}}function Ni(e,t={}){if(j[e])for(let n of[...j[e]])try{n(t)}catch(e){x(e)}}var Pi=t({offTouchCancel:()=>Hi,offTouchEnd:()=>Bi,offTouchMove:()=>Ri,offTouchStart:()=>Ii,onTouchCancel:()=>Vi,onTouchEnd:()=>zi,onTouchMove:()=>Li,onTouchStart:()=>Fi});function Fi(e){ji(`touchstart`,e)}function Ii(e){Mi(`touchstart`,e)}function Li(e){ji(`touchmove`,e)}function Ri(e){Mi(`touchmove`,e)}function zi(e){ji(`touchend`,e)}function Bi(e){Mi(`touchend`,e)}function Vi(e){ji(`touchcancel`,e)}function Hi(e){Mi(`touchcancel`,e)}var Ui=t({vibrateLong:()=>Gi,vibrateShort:()=>Wi});function Wi(e){return w(`vibrateShort`,e)}function Gi(e){return w(`vibrateLong`,e)}var Ki=t({extBridge:()=>qi,extOffBridge:()=>Yi,extOnBridge:()=>Ji,offLoginStatusChanged:()=>Zi,onLoginStatusChanged:()=>Xi});function qi({event:e,module:t,data:r={},success:i,fail:a,complete:o},s){let c,l,u;return n(s)?(c=s,l=s):(c=i,l=a,u=o),w(e,{module:t,data:r,keep:r.isSustain??!0,success:c,fail:l,complete:u})}function Ji({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}`;w(i,{evtId:i,keep:r,success:n})}function Yi({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}let r=`${t}_${e}`;w(r,{evtId:r,success:n})}function Xi(e){S.on(`notifyLoginStatusChanged`,t=>{e?.(t)})}function Zi(){S.off(`notifyLoginStatusChanged`)}var Qi=new WeakSet;function $i(e,t,r){if(e&&(typeof e==`object`||typeof e==`function`)&&!Qi.has(e)){Qi.add(e);try{n(e.componentError)&&e.componentError(t)}catch(e){console.error(`[service] error lifetime error:`,e)}finally{Qi.delete(e)}}x(t),console.error(`[service] ${r} error:`,t)}function M(e,t,r=[],i=`callback`,a=!0){if(n(t))try{return t.apply(e,r)}catch(t){a?$i(e,t,i):(x(t),console.error(`[service] ${i} error:`,t));return}}function N(e,t,n=[],r=`callback`,i=!0){for(let a of t||[])M(e,a,n,r,i)}var ea=[`onLaunch`,`onShow`,`onHide`,`onError`],ta=[`globalData`],na=class{constructor(e,t){this.appModule=e,this.options=t,this.init()}init(){this.initGlobalData(),this.initLifecycle(),this.initCustomMethods(),Je(this.onError),this.invokeSomeLifecycle()}initGlobalData(){this.globalData=this.appModule.moduleInfo.globalData}initLifecycle(){ea.forEach(e=>{let t=this.appModule.moduleInfo[e];n(t)&&(this[e]=t.bind(this))})}initCustomMethods(){let e=this.appModule.moduleInfo;for(let t in e)ea.includes(t)||ta.includes(t)||(this[t]=n(e[t])?e[t].bind(this):e[t])}invokeSomeLifecycle(){M(this,this.onLaunch,[this.options],`onLaunch`),M(this,this.onShow,[this.options],`onShow`),Ke(this.options)}appShow(e=this.options){M(this,this.onShow,[e],`onShow`),Ke(e)}appHide(){M(this,this.onHide,[],`onHide`),qe()}},ra={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in ra)Object.freeze(ra[e]);var ia=Object.freeze(ra),aa=[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],oa=/^(([\w-]+\s)*)(\d+r?px)(\/(\d+\.?\d*(r?px)?))?\s+(.*)/,sa=/\d+\.?\d*px/,ca=/[ᄀ-ᅟ⺀-꓏가-힣豈-﫿︐-︙︰-﹯＀-⦆¢-₩]/,la=class{constructor(e,t){this.type=e,this.data=t,this.colorStop=[]}addColorStop(e,t){this.colorStop.push([e,t])}},ua=class{constructor(e,t){this.image=e,this.repetition=t}};function da(e){return typeof e==`string`?e:e?.src??e?._src??e}function fa(e,t,n,r){return new la(`linear`,[e,t,n,r])}function pa(e,t,n){return new la(`radial`,[e,t,n])}function ma(e,t){if(t===void 0){console.error(`Failed to execute 'createPattern' on 'CanvasContext': 2 arguments required, but only 1 present.`);return}if(!aa.includes(t)){console.error(`Failed to execute 'createPattern' on 'CanvasContext': The provided type ('${t}') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.`);return}return new ua(da(e),t)}function ha(e){return e instanceof la?{__canvasStyle:`gradient`,type:e.type,data:[...e.data],colorStop:e.colorStop.map(([e,t])=>[e,t])}:e instanceof ua?{__canvasStyle:`pattern`,image:e.image,repetition:e.repetition}:e}function ga(e){let t=String(e).match(oa);if(!t)return null;let n=t[1].trim().split(/\s/),r=Number.parseFloat(t[3]),i=t[7],a=[],o=`normal`,s=`normal`,c=()=>{a.push(`normal`),s=`normal`};return n.forEach((e,t)=>{[`italic`,`oblique`,`normal`].includes(e)?(a.push(e),o=e):[`bold`,`normal`].includes(e)?(a.push(e),s=e):t===0?(a.push(`normal`),o=`normal`):t===1&&c()}),n.length===1&&c(),{font:`${a.join(` `)} ${r}px ${i}`,fontStyle:o,fontWeight:s,fontSize:r,fontFamily:i}}function _a(e,t){return String(e).replace(sa,`${t}px`)}function va(){try{if(typeof OffscreenCanvas==`function`)return new OffscreenCanvas(0,0).getContext(`2d`);if(typeof document<`u`&&typeof document.createElement==`function`)return document.createElement(`canvas`).getContext(`2d`)}catch{}return null}function ya(e,t,n,r){let i=String(t);if(e)try{e.font=n;let t=e.measureText(i)?.width;if(typeof t==`number`&&!Number.isNaN(t))return t}catch{}let a=typeof r==`number`&&r>0?r:10,o=0;for(let e of i)o+=ca.test(e)?1:.5;return o*a}var ba=new Set([`2d`]),xa=new Set([`webgl`,`experimental-webgl`,`webgl2`]),Sa=new Set([`createLinearGradient`,`createPattern`,`createRadialGradient`]),Ca=new Map([[`createBuffer`,`buffer`],[`createFramebuffer`,`framebuffer`],[`createProgram`,`program`],[`createQuery`,`query`],[`createRenderbuffer`,`renderbuffer`],[`createSampler`,`sampler`],[`createShader`,`shader`],[`createTexture`,`texture`],[`createTransformFeedback`,`transformFeedback`],[`createVertexArray`,`vertexArray`],[`fenceSync`,`sync`]]),wa=new Map([[`getAttribLocation`,`attribLocation`],[`getUniformLocation`,`uniformLocation`]]),Ta=new Map([[`deleteBuffer`,`buffer`],[`deleteFramebuffer`,`framebuffer`],[`deleteProgram`,`program`],[`deleteQuery`,`query`],[`deleteRenderbuffer`,`renderbuffer`],[`deleteSampler`,`sampler`],[`deleteShader`,`shader`],[`deleteSync`,`sync`],[`deleteTexture`,`texture`],[`deleteTransformFeedback`,`transformFeedback`],[`deleteVertexArray`,`vertexArray`]]),Ea=new Map([[`isBuffer`,`buffer`],[`isFramebuffer`,`framebuffer`],[`isProgram`,`program`],[`isQuery`,`query`],[`isRenderbuffer`,`renderbuffer`],[`isSampler`,`sampler`],[`isShader`,`shader`],[`isSync`,`sync`],[`isTexture`,`texture`],[`isTransformFeedback`,`transformFeedback`],[`isVertexArray`,`vertexArray`]]),Da={alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`,failIfMajorPerformanceCaveat:!1,desynchronized:!1},Oa=new Map,P=new Map,F=null,ka=null,I={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,FALSE:0,TRUE:1,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPILE_STATUS:35713};function Aa(e){let t=String(e).toLowerCase();return t===`experimental-webgl`?`webgl`:t}function ja(e,t){e&&t&&Oa.set(e,t)}function Ma(e){return Oa.get(e)||null}function Na(e,t){return e&&e[Aa(t)]||null}function L(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>L(e));if(typeof e!=`object`)return e;if(e.__canvasTypedArray){if(e.__canvasTypedArray===`DataView`)return new DataView(new Uint8Array(e.data||[]).buffer);let t=globalThis[e.__canvasTypedArray];return typeof t==`function`?new t(e.data||[]):e.data||[]}if(e.__canvasImageData)return Ra(e.width,e.height,new Uint8ClampedArray(e.data||[]));let t={};for(let[n,r]of Object.entries(e))t[n]=L(r);return t}S.on(`canvasCapabilities`,({bridgeId:e,capabilities:t})=>{ja(e,t)}),S.on(`resourceLoaded`,({bridgeId:e,canvasCapabilities:t})=>{ja(e,t)}),S.on(`pageUnload`,({bridgeId:e})=>{yo(e)});var Pa=1,Fa=1;function Ia(){let e=C.getPageInfo();return e?.bridgeId||e?.id||``}function R(e,t,n){let r=pe(e,t,n);if(r)throw RangeError(r)}var La=class{constructor(e,t,n){this.data=e,this.width=t,this.height=n,Object.defineProperty(this,"__diminaCanvasImageData",{value:!0})}get[Symbol.toStringTag](){return`ImageData`}};function Ra(e,t,n){let r=Math.abs(Math.trunc(Number(e))),i=Math.abs(Math.trunc(Number(t)));R(r,i);let a=n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n||r*i*4);if(a.length!==r*i*4)throw RangeError(`ImageData data length does not match its dimensions`);if(typeof globalThis.ImageData==`function`)try{return new globalThis.ImageData(a,r,i)}catch{}return new La(a,r,i)}function z(e,t,n){S.send({type:`invokeAPI`,target:`render`,body:{bridgeId:e,name:t,params:n}})}function za(e){Promise.resolve().then(e)}function Ba(e){return Object.prototype.toString.call(e)===`[object Object]`}function Va(e){return typeof ArrayBuffer>`u`||!ArrayBuffer.isView(e)?null:e instanceof DataView?{__canvasTypedArray:`DataView`,data:Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}:{__canvasTypedArray:e.constructor.name,data:Array.from(e)}}function B(e){if(e==null)return e;if(e.__canvasResourceId)return{__canvasResourceId:e.__canvasResourceId};if(e.__diminaCanvasNode)return{__canvasNodeId:e.nodeId};if(e.__diminaCanvasImageData||Object.prototype.toString.call(e)===`[object ImageData]`&&e.data instanceof Uint8ClampedArray)return R(e.width,e.height,{transferable:!0}),{__canvasImageData:!0,width:e.width,height:e.height,data:Array.from(e.data)};let t=Va(e);if(t)return t;if(typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer)return{__canvasArrayBuffer:!0,data:Array.from(new Uint8Array(e))};if(Array.isArray(e))return e.map(e=>B(e));if(Ba(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=B(r);return t}return e}function V(e){return Array.from(e).map(e=>B(e))}function H(e=`canvas_resource`){return`${e}_${p()}`}var U=class{constructor(e,t,n=`resource`,r={}){return this.__canvasResourceId=t,this.__canvasProxyValue=Pa++,this.canvas=e,this.resourceType=n,this.metadata=r,this.deleted=!1,new Proxy(this,{get(e,n){if(n in e){let t=e[n];return typeof t==`function`?t.bind(e):t}if(typeof n!=`symbol`)return(...r)=>{e.canvas.enqueueOperation({op:`resourceCall`,resourceId:t,method:n,args:V(r)})}}})}valueOf(){return this.__canvasProxyValue}toString(){return String(this.__canvasProxyValue)}markDeleted(){this.deleted=!0}updateMetadata(e={}){Object.assign(this.metadata,e)}},Ha=class{constructor(e,t){this.__canvasResourceId=t,this.canvas=e,this.imageId=t,this.onload=null,this.onerror=null,this.width=0,this.height=0,this._src=``,this._pendingCallback=null,this.canvas.enqueueOperation({op:`createImage`,imageId:t})}get src(){return this._src}set src(e){this._src=e,this.canvas.removeCallback(this._pendingCallback);let t=this.canvas.storeCallback((e={})=>{this._pendingCallback===t&&(this._pendingCallback=null);let r=e.value||{};e.ok?(this.width=r.width||this.width,this.height=r.height||this.height,n(this.onload)&&this.onload(r)):n(this.onerror)&&this.onerror(r)});this._pendingCallback=t;try{this.canvas.enqueueOperation({op:`imageSetSrc`,imageId:this.imageId,src:e,callback:t})}catch(e){throw this.canvas.removeCallback(t,e),this._pendingCallback=null,e}}},W=Symbol(`invalid canvas 2d state`),Ua={direction:new Set([`inherit`,`ltr`,`rtl`]),fontKerning:new Set([`auto`,`normal`,`none`]),fontStretch:new Set([`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`]),fontVariantCaps:new Set([`normal`,`small-caps`,`all-small-caps`,`petite-caps`,`all-petite-caps`,`unicase`,`titling-caps`]),globalCompositeOperation:new Set(`source-over.source-in.source-out.source-atop.destination-over.destination-in.destination-out.destination-atop.lighter.copy.xor.multiply.screen.overlay.darken.lighten.color-dodge.color-burn.hard-light.soft-light.difference.exclusion.hue.saturation.color.luminosity.plus-lighter`.split(`.`)),imageSmoothingQuality:new Set([`low`,`medium`,`high`]),lineCap:new Set([`butt`,`round`,`square`]),lineJoin:new Set([`round`,`bevel`,`miter`]),textAlign:new Set([`start`,`end`,`left`,`right`,`center`]),textBaseline:new Set([`top`,`hanging`,`middle`,`alphabetic`,`ideographic`,`bottom`]),textRendering:new Set([`auto`,`optimizeSpeed`,`optimizeLegibility`,`geometricPrecision`])},Wa=new Set([`lineWidth`,`miterLimit`]),Ga=new Set([`shadowBlur`]),Ka=new Set([`lineDashOffset`,`shadowOffsetX`,`shadowOffsetY`]),qa=new Set([`accentcolor`,`accentcolortext`,`activetext`,`buttonborder`,`buttonface`,`buttontext`,`canvas`,`canvastext`,`field`,`fieldtext`,`graytext`,`highlight`,`highlighttext`,`linktext`,`mark`,`marktext`,`selecteditem`,`selecteditemtext`,`visitedtext`]),Ja=new Set([`caption`,`icon`,`menu`,`message-box`,`small-caption`,`status-bar`]),Ya=`[-+]?(?:\\d*\\.?\\d+)(?:[eE][-+]?\\d+)?`,Xa=`(?:%|cap|ch|cm|dvh|dvw|em|ex|ic|in|lh|mm|pc|pt|px|q|rcap|rch|rem|rex|ric|rlh|svh|svw|vmax|vmin|vh|vi|vb|vw)`,Za=RegExp(`(?:^|\\s)(?:(?:xx?-small|small|medium|large|xx?-large|xxx-large|smaller|larger)|${Ya}${Xa})(?:\\s*\\/[^\\s]+)?\\s+.+$`,`i`),Qa=RegExp(`^(?:normal|0|${Ya}${Xa})$`,`i`),$a=RegExp(`^${Ya}[a-z%]*$`,`i`);function eo(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function to(e,t){let n=1,r=``;for(let i=t+1;i<e.length;i++){let t=e[i];if(r){t===r&&!eo(e,i)&&(r=``);continue}if(t===`"`||t===`'`)r=t;else if(t===`(`)n++;else if(t===`)`&&--n===0)return i+1}return-1}function no(e){let t=0,n=``;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===n&&!eo(e,r)&&(n=``);continue}if(i===`"`||i===`'`)n=i;else if(i===`(`)t++;else if(i===`)`&&--t<0)return!1}return t===0&&!n}function ro(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&!eo(e,n)&&(t=``);continue}if(r===`"`||r===`'`)t=r;else if(/^var\s*\(/i.test(e.slice(n)))return!0}return!1}function io(e){if(typeof e!=`string`)return!1;let t=e.trim();if(!t||t.includes(`\0`)||ro(t))return!1;let n=t.toLowerCase();return n===`transparent`||n===`currentcolor`||Object.prototype.hasOwnProperty.call(ia,n)||qa.has(n)||/^#[\da-f]{3,4}(?:[\da-f]{3,4})?$/i.test(t)?!0:t.includes(`(`)&&no(t)}function ao(e,t){let n=String(t).trim();if(!n||n.includes(`\0`)||ro(n))return W;if(e===`font`){let e=Ja.has(n.toLowerCase())||Za.test(n);for(let t of n.matchAll(/\b(calc|clamp|max|min)\s*\(/gi)){let r=to(n,t.index+t[0].lastIndexOf(`(`));r>0&&/^(?:\s*\/[^\s]+)?\s+.+$/.test(n.slice(r))&&(e=!0)}return e||=no(n)&&/\s/.test(n),e?n:W}return e===`filter`?n===`none`||n.includes(`(`)&&no(n)?n:W:Qa.test(n)||$a.test(n)||n.includes(`(`)&&no(n)?n:W}function oo(e,t){if(e===`globalCompositeOperation`&&String(t)===`normal`)return`source-over`;if(Ua[e]){let n=String(t);return Ua[e].has(n)?n:W}if(Wa.has(e)){let e=Number(t);return Number.isFinite(e)&&e>0?e:W}if(Ga.has(e)){let e=Number(t);return Number.isFinite(e)&&e>=0?e:W}if(Ka.has(e)){let e=Number(t);return Number.isFinite(e)?e:W}if(e===`globalAlpha`){let e=Number(t);return Number.isFinite(e)&&e>=0&&e<=1?e:W}return e===`imageSmoothingEnabled`?!!t:[`font`,`filter`,`letterSpacing`,`wordSpacing`].includes(e)?ao(e,t):e===`shadowColor`?io(t)?t:W:e===`fillStyle`||e===`strokeStyle`?typeof t==`string`&&io(t)||t?.__canvasResourceId?t:W:t}var so=Object.freeze({direction:`inherit`,fillStyle:`#000000`,filter:`none`,font:`10px sans-serif`,fontKerning:`auto`,fontStretch:`normal`,fontVariantCaps:`normal`,globalAlpha:1,globalCompositeOperation:`source-over`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`,letterSpacing:`0px`,lineCap:`butt`,lineDashOffset:0,lineJoin:`miter`,lineWidth:1,miterLimit:10,shadowBlur:0,shadowColor:`rgba(0, 0, 0, 0)`,shadowOffsetX:0,shadowOffsetY:0,strokeStyle:`#000000`,textAlign:`start`,textBaseline:`alphabetic`,textRendering:`auto`,wordSpacing:`0px`}),co=class{constructor(e,t){return this.canvas=e,this.contextId=t,this.measureContext=void 0,this.stateSequences=Object.create(null),this.state={...so},this.confirmedState={...so},this.confirmedStateSequences=Object.create(null),this.stateStack=[],new Proxy(this,{get(e,t){if(t in e)return typeof e[t]==`function`?e[t].bind(e):e[t];if(t in e.state)return e.state[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){if(typeof n==`symbol`||!(n in e.state))return Reflect.set(e,n,r);let i=e.confirmedState[n],a=oo(n,r);if(a===W)return!0;e.state[n]=a;let o=(e.stateSequences[n]||0)+1;return e.stateSequences[n]=o,e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:B(a),previousValue:B(i),feedback:`state`,sequence:o}),!0}})}applyFeedback(e={}){for(let t of e.state||[]){let e=L(t.value);(this.confirmedStateSequences[t.prop]||0)<=t.sequence&&(this.confirmedState[t.prop]=e,this.confirmedStateSequences[t.prop]=t.sequence),this.stateSequences[t.prop]===t.sequence&&(this.state[t.prop]=e);for(let n of this.stateStack)n.sequences[t.prop]===t.sequence&&(n.state[t.prop]=e)}}stateSequenceSnapshot(){return Object.fromEntries(Object.keys(this.state).map(e=>[e,this.stateSequences[e]||0]))}replaceState(e,{clearStack:t=!1}={}){for(let e of Object.keys(this.state))this.stateSequences[e]=(this.stateSequences[e]||0)+1;this.state={...e},t&&(this.stateStack=[])}resetStateForBitmapResize(){return this.replaceState(so,{clearStack:!0}),this.confirmedState={...so},this.confirmedStateSequences={...this.stateSequenceSnapshot()},this.stateSequenceSnapshot()}getImageData(e,t,n,r){return this.canvas.getImageData({contextId:this.contextId,x:e,y:t,width:n,height:r})}toDataURL(e,t){return this.canvas.toDataURL(e,t)}call(e,t){let n=e===`save`||e===`restore`||e===`reset`;if(e===`save`?this.stateStack.push({state:{...this.state},sequences:this.stateSequenceSnapshot()}):e===`restore`&&this.stateStack.length>0?this.replaceState(this.stateStack.pop().state):e===`reset`&&this.resetStateForBitmapResize(),e===`measureText`){this.measureContext??=va();let e=ga(this.state.font)?.fontSize||10;return{width:ya(this.measureContext,t[0],this.state.font,e)}}if(e===`createImageData`)return t.length===1&&t[0]?.data instanceof Uint8ClampedArray?Ra(t[0].width,t[0].height):Ra(t[0],t[1]);let r=Sa.has(e)?H():void 0;if(this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:V(t),resultId:r,feedback:n?`stateSnapshot`:void 0,stateSequences:n?this.stateSequenceSnapshot():void 0}),r)return new U(this.canvas,r)}},lo=class{constructor(e,t,n,r={}){return this.context=e,this.name=t,this.__canvasResourceId=n,this.constants=r.constants||{},new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e.constants,t))return e.constants[t];if(typeof t!=`symbol`)return(...n)=>e.call(t,n)}})}call(e,t){let n,r;if(e.startsWith(`create`))r=H(`webgl_extension_resource`),n=new U(this.context.canvas,r,`${this.name}:${e}`),this.context.resources.set(r,n);else if(e.startsWith(`delete`)&&t[0]?.markDeleted)t[0].markDeleted();else if(e.startsWith(`is`)&&t[0]instanceof U)return!t[0].deleted;return this.context.canvas.enqueueOperation({op:`extensionCall`,contextId:this.context.contextId,extensionId:this.__canvasResourceId,method:e,args:V(t),resultId:r}),n}},uo=class{constructor(e,t,n,r,i){return this.canvas=e,this.contextId=t,this.contextType=n,this.requestedAttributes={...Da,...Ba(r)?r:{}},this.capabilities=null,this.resources=new Map,this.extensions=new Map,this.properties=new Map,this.state=new Map,this.enabledCapabilities=new Set,this.errors=[],this.queryResults=new Map,this.contextLost=!1,this.creationFailed=!1,this.hasActualCapabilities=!1,this.initializeState(),this.updateCapabilities(i),new Proxy(this,{get(e,t){if(t in e){let n=e[t];return typeof n==`function`?n.bind(e):n}if(e.properties.has(t))return e.properties.get(t);if(Object.prototype.hasOwnProperty.call(e.capabilities?.constants||{},t))return e.capabilities.constants[t];if(Object.prototype.hasOwnProperty.call(I,t))return I[t];if(t===`drawingBufferWidth`)return e.canvas.width;if(t===`drawingBufferHeight`)return e.canvas.height;if(typeof t!=`symbol`)return(...n)=>e.call(t,n)},set(e,n,r){return e.properties.set(n,r),e.canvas.enqueueOperation({op:`contextSetProperty`,contextId:t,prop:n,value:B(r)}),!0}})}initializeState(){let{width:e,height:t}=this.canvas;this.state.set(I.VIEWPORT,[0,0,e,t]),this.state.set(I.SCISSOR_BOX,[0,0,e,t]),this.state.set(I.COLOR_CLEAR_VALUE,new Float32Array([0,0,0,0])),this.state.set(I.COLOR_WRITEMASK,[!0,!0,!0,!0]),this.state.set(I.DEPTH_CLEAR_VALUE,1),this.state.set(I.DEPTH_WRITEMASK,!0),this.state.set(I.DEPTH_FUNC,I.LESS),this.state.set(I.STENCIL_CLEAR_VALUE,0),this.state.set(I.LINE_WIDTH,1),this.state.set(I.CULL_FACE_MODE,I.BACK),this.state.set(I.FRONT_FACE,I.CCW),this.state.set(I.ACTIVE_TEXTURE,I.TEXTURE0),this.state.set(I.PACK_ALIGNMENT,4),this.state.set(I.UNPACK_ALIGNMENT,4),this.state.set(I.CURRENT_PROGRAM,null),this.state.set(I.ARRAY_BUFFER_BINDING,null),this.state.set(I.ELEMENT_ARRAY_BUFFER_BINDING,null),this.state.set(I.TEXTURE_BINDING_2D,null),this.state.set(I.FRAMEBUFFER_BINDING,null),this.state.set(I.RENDERBUFFER_BINDING,null)}updateCapabilities(e,t=!1){if(!e)return;let n=L(e),r={...this.capabilities?.extensions||{}};for(let[e,t]of Object.entries(n.extensions||{}))r[e]={...r[e]||{},...t,constants:{...r[e]?.constants||{},...t.constants||{}}};this.capabilities={...this.capabilities||{},...n,constants:{...this.capabilities?.constants||{},...n.constants||{}},parameters:{...this.capabilities?.parameters||{},...n.parameters||{}},extensions:r,shaderPrecisionFormats:{...this.capabilities?.shaderPrecisionFormats||{},...n.shaderPrecisionFormats||{}}},this.hasActualCapabilities||=t,typeof this.capabilities.contextLost==`boolean`&&(this.contextLost=this.capabilities.contextLost)}applyFeedback(e={}){e.success===!1?(this.creationFailed=!0,this.contextLost=!0,this.canvas.handleContextCreationFailure(this.contextId,this.contextType,e.statusMessage)):e.capabilities&&this.updateCapabilities(e.capabilities,!0),typeof e.contextLost==`boolean`&&(this.contextLost=e.contextLost);for(let t of e.errors||[])this.queueError(t);for(let t of e.resources||[])this.resources.get(t.resourceId)?.updateMetadata(L(t.metadata));for(let t of e.queries||[])this.queryResults.set(t.key,this.deserializeFeedbackValue(t.value))}deserializeFeedbackValue(e){if(e?.__canvasResourceId)return this.resources.get(e.__canvasResourceId)||null;if(Array.isArray(e))return e.map(e=>this.deserializeFeedbackValue(e));if(e&&typeof e==`object`&&!e.__canvasTypedArray){let t={};for(let[n,r]of Object.entries(e))t[n]=this.deserializeFeedbackValue(r);return t}return L(e)}queueError(e){e&&e!==I.NO_ERROR&&!this.errors.includes(e)&&this.errors.push(e)}queryKey(e,t){return`${e}:${JSON.stringify(V(t))}`}requestQuery(e,t,n=null){let r=this.queryKey(e,t);return this.canvas.enqueueOperation({op:`contextQuery`,contextId:this.contextId,method:e,args:V(t),key:r}),this.queryResults.has(r)?this.queryResults.get(r):n}createResource(e,t,n){let r=H(`webgl_${n}`),i={};n===`shader`?(i.shaderType=t[0],i.source=``,i.compileStatus=!1,i.infoLog=``):n===`program`&&(i.attachedShaders=[],i.linkStatus=!1,i.validateStatus=!1,i.infoLog=``);let a=new U(this.canvas,r,n,i);return this.resources.set(r,a),this.canvas.enqueueOperation({op:`contextCall`,contextId:this.contextId,method:e,args:V(t),resultId:r}),a}call(e,t){switch(e){case`getParameter`:return this.getParameter(t[0]);case`getShaderParameter`:return this.getShaderParameter(t[0],t[1]);case`getProgramParameter`:return this.getProgramParameter(t[0],t[1]);case`getShaderInfoLog`:return t[0]?.metadata?.infoLog||``;case`getProgramInfoLog`:return t[0]?.metadata?.infoLog||``;case`getShaderSource`:return t[0]?.metadata?.source||null;case`getAttachedShaders`:return t[0]?.metadata?.attachedShaders?.slice()||[];case`getError`:return this.errors.shift()||(this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),I.NO_ERROR);case`isContextLost`:return this.canvas.enqueueOperation({op:`contextFeedback`,contextId:this.contextId}),this.contextLost;case`isEnabled`:return this.enabledCapabilities.has(t[0]);case`checkFramebufferStatus`:return this.requestQuery(e,t,I.FRAMEBUFFER_COMPLETE);case`getContextAttributes`:return{...this.hasActualCapabilities&&this.capabilities?.contextAttributes?this.capabilities.contextAttributes:this.requestedAttributes};case`getSupportedExtensions`:return(this.capabilities?.supportedExtensions||[]).slice();case`getExtension`:return this.getExtension(t[0]);case`getShaderPrecisionFormat`:return this.getShaderPrecisionFormat(t[0],t[1]);case`getActiveAttrib`:case`getActiveUniform`:case`getBufferParameter`:case`getFramebufferAttachmentParameter`:case`getRenderbufferParameter`:case`getTexParameter`:case`getUniform`:case`getVertexAttrib`:case`getVertexAttribOffset`:return this.requestQuery(e,t)}let n=Ca.get(e)||wa.get(e);if(n)return this.createResource(e,t,n);if(Ea.has(e)){let n=t[0];return n instanceof U&&n.resourceType===Ea.get(e)&&!n.deleted}Ta.has(e)&&t[0]?.markDeleted&&t[0].markDeleted(),this.updateState(e,t);let r={op:`contextCall`,contextId:this.contextId,method:e,args:V(t)};e===`compileShader`?(t[0]?.updateMetadata({compileStatus:!0}),r.feedback=`shader`):e===`linkProgram`||e===`validateProgram`?(t[0]?.updateMetadata(e===`linkProgram`?{linkStatus:!0}:{validateStatus:!0}),r.feedback=`program`):e===`readPixels`&&ArrayBuffer.isView(t[6])?(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[6]),r.typedArrayArgIndex=6):e===`getBufferSubData`&&ArrayBuffer.isView(t[2])&&(r.typedArrayUpdateId=this.canvas.registerTypedArrayUpdate(t[2]),r.typedArrayArgIndex=2),this.canvas.enqueueOperation(r)}updateState(e,t){switch(e){case`viewport`:this.state.set(I.VIEWPORT,t.slice(0,4));break;case`scissor`:this.state.set(I.SCISSOR_BOX,t.slice(0,4));break;case`clearColor`:this.state.set(I.COLOR_CLEAR_VALUE,new Float32Array(t.slice(0,4)));break;case`colorMask`:this.state.set(I.COLOR_WRITEMASK,t.slice(0,4).map(Boolean));break;case`clearDepth`:this.state.set(I.DEPTH_CLEAR_VALUE,t[0]);break;case`depthMask`:this.state.set(I.DEPTH_WRITEMASK,!!t[0]);break;case`depthFunc`:this.state.set(I.DEPTH_FUNC,t[0]);break;case`clearStencil`:this.state.set(I.STENCIL_CLEAR_VALUE,t[0]);break;case`lineWidth`:this.state.set(I.LINE_WIDTH,t[0]);break;case`cullFace`:this.state.set(I.CULL_FACE_MODE,t[0]);break;case`frontFace`:this.state.set(I.FRONT_FACE,t[0]);break;case`activeTexture`:this.state.set(I.ACTIVE_TEXTURE,t[0]);break;case`pixelStorei`:this.state.set(t[0],t[1]);break;case`enable`:this.enabledCapabilities.add(t[0]);break;case`disable`:this.enabledCapabilities.delete(t[0]);break;case`useProgram`:this.state.set(I.CURRENT_PROGRAM,t[0]||null);break;case`bindBuffer`:t[0]===I.ARRAY_BUFFER?this.state.set(I.ARRAY_BUFFER_BINDING,t[1]||null):t[0]===I.ELEMENT_ARRAY_BUFFER&&this.state.set(I.ELEMENT_ARRAY_BUFFER_BINDING,t[1]||null);break;case`bindTexture`:t[0]===I.TEXTURE_2D&&this.state.set(I.TEXTURE_BINDING_2D,t[1]||null);break;case`bindFramebuffer`:this.state.set(I.FRAMEBUFFER_BINDING,t[1]||null);break;case`bindRenderbuffer`:this.state.set(I.RENDERBUFFER_BINDING,t[1]||null);break;case`shaderSource`:t[0]?.updateMetadata({source:String(t[1]??``)});break;case`attachShader`:{let e=t[0]?.metadata?.attachedShaders;e&&t[1]&&!e.includes(t[1])&&e.push(t[1]);break}case`detachShader`:{let e=t[0]?.metadata?.attachedShaders,n=e?.indexOf(t[1])??-1;n>=0&&e.splice(n,1);break}}}getParameter(e){if(this.state.has(e)){let t=this.state.get(e);return ArrayBuffer.isView(t)||Array.isArray(t)?t.slice():t}let t=this.capabilities?.parameters||{};return Object.prototype.hasOwnProperty.call(t,e)?L(t[e]):this.requestQuery(`getParameter`,[e])}getShaderParameter(e,t){if(!(e instanceof U)||e.resourceType!==`shader`)return null;switch(t){case I.DELETE_STATUS:return e.deleted;case I.SHADER_TYPE:return e.metadata.shaderType;case I.COMPILE_STATUS:return!!e.metadata.compileStatus;default:return this.requestQuery(`getShaderParameter`,[e,t])}}getProgramParameter(e,t){if(!(e instanceof U)||e.resourceType!==`program`)return null;switch(t){case I.DELETE_STATUS:return e.deleted;case I.LINK_STATUS:return!!e.metadata.linkStatus;case I.VALIDATE_STATUS:return!!e.metadata.validateStatus;case I.ATTACHED_SHADERS:return e.metadata.attachedShaders.length;default:return this.requestQuery(`getProgramParameter`,[e,t])}}getShaderPrecisionFormat(e,t){let n=`${e}:${t}`,r=this.capabilities?.shaderPrecisionFormats?.[n];return r?{...r}:this.requestQuery(`getShaderPrecisionFormat`,[e,t])}getExtension(e){let t=String(e||``),n=(this.capabilities?.supportedExtensions||[]).find(e=>e.toLowerCase()===t.toLowerCase());if(!n)return null;if(this.extensions.has(n))return this.extensions.get(n);let r=H(`webgl_extension`),i=this.capabilities?.extensions?.[n]||{},a=new lo(this,n,r,i);return this.extensions.set(n,a),this.canvas.enqueueOperation({op:`getExtension`,contextId:this.contextId,extensionId:r,name:n}),a}},fo=class{constructor({nodeId:e,bridgeId:t=Ia(),width:n=300,height:r=150,type:i=`2d`,offscreen:a=!1,webglCapabilities:o}){this.__diminaCanvasNode=!0,this.nodeId=e,this.bridgeId=t,this.type=i,this.offscreen=a,this.webglCapabilities=o||Ma(t),this.contexts=new Map,this.contextsById=new Map,this.activeContextType=null,this.eventListeners=new Map,this.pendingTypedArrayUpdates=new Map,this.pendingCallbacks=new Map,this.pendingStateFeedbacks=new Map,this.stateFeedbackByProperty=new Map,this.rafCallbacks=new Map,this.pendingOperations=[],this.flushScheduled=!1,this.disposed=!1,this._width=y(n,300),this._height=y(r,150),R(this._width,this._height,{allowZero:!0}),P.has(t)||P.set(t,new Set),P.get(t).add(this)}get width(){return this._width}reset2DStateAfterBitmapResize(){for(let[e,t]of this.contextsById){let n=t.resetStateForBitmapResize?.();n&&this.enqueueOperation({op:`contextStateSnapshot`,contextId:e,feedback:`stateSnapshot`,stateSequences:n})}}set width(e){let t=y(e,300);R(t,this._height,{allowZero:!0}),this._width=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`width`,value:this._width}),this.reset2DStateAfterBitmapResize()}get height(){return this._height}set height(e){let t=y(e,150);R(this._width,t,{allowZero:!0}),this._height=t,this.enqueueOperation({op:`setCanvasProperty`,prop:`height`,value:this._height}),this.reset2DStateAfterBitmapResize()}getContext(e=`2d`,t){let n=String(e).toLowerCase(),r=Aa(n),i=xa.has(n);if(!ba.has(r)&&!i||this.activeContextType&&this.activeContextType!==r)return null;if(this.contexts.has(r))return this.contexts.get(r);let a=i?Na(this.webglCapabilities,r):null;if(i&&a?.supported===!1)return null;let o=H(`canvas_context`);this.enqueueOperation({op:`getContext`,contextId:o,contextType:n,attributes:B(t)});let s=i?new uo(this,o,r,t,a):new co(this,o);return this.activeContextType=r,this.contexts.set(r,s),this.contextsById.set(o,s),s}addEventListener(e,t){n(t)&&(this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t))}removeEventListener(e,t){this.eventListeners.get(e)?.delete(t)}dispatchEvent(e){if(!e?.type)return!0;let t=!1,r={...e,target:this,currentTarget:this,preventDefault(){t=!0,this.defaultPrevented=!0}};for(let t of this.eventListeners.get(e.type)||[])t.call(this,r);let i=this[`on${e.type}`];return n(i)&&i.call(this,r),!t}notifyContextCreationError(e=`WebGL context creation failed`){this.dispatchEvent({type:`webglcontextcreationerror`,statusMessage:e})}handleContextCreationFailure(e,t,n){let r=this.contextsById.get(e);this.contexts.get(t)===r&&(this.contexts.delete(t),this.activeContextType=null),this.contextsById.delete(e),this.notifyContextCreationError(n)}registerTypedArrayUpdate(e){let t=H(`canvas_typed_array_update`);return this.pendingTypedArrayUpdates.set(t,e),t}applyFlushFeedback(e={}){for(let[t,n]of Object.entries(e.contexts||{}))this.contextsById.get(t)?.applyFeedback?.(n);for(let t of e.typedArrays||[]){let e=this.pendingTypedArrayUpdates.get(t.id);if(e&&ArrayBuffer.isView(e)){let n=L(t.value);ArrayBuffer.isView(n)?e.set(n.subarray(0,e.length)):Array.isArray(n)&&e.set(n.slice(0,e.length))}this.pendingTypedArrayUpdates.delete(t.id)}}createImage(){return new Ha(this,H(`canvas_image`))}storeCallback(e,t){if(this.disposed)throw Error(`canvas node is disposed`);let n;return n=v.store(t=>{this.pendingCallbacks.delete(n),e(t)}),this.pendingCallbacks.set(n,t),n}releaseStateFeedback(e){let t=this.pendingStateFeedbacks.get(e);if(t){this.pendingStateFeedbacks.delete(e);for(let n of t)this.stateFeedbackByProperty.get(n)===e&&this.stateFeedbackByProperty.delete(n)}}removeCallback(e,t){if(!e||!this.pendingCallbacks.has(e))return;let n=this.pendingCallbacks.get(e);this.pendingCallbacks.delete(e),this.releaseStateFeedback(e),v.remove(e),n?.(t)}requestAnimationFrame(e){let t=Fa++,r=this.storeCallback(r=>{this.rafCallbacks.delete(t),n(e)&&e(r)});this.rafCallbacks.set(t,r);try{z(this.bridgeId,`canvasNodeRequestAnimationFrame`,{nodeId:this.nodeId,requestId:t,callback:r})}catch(e){throw this.removeCallback(r,e),this.rafCallbacks.delete(t),e}return t}cancelAnimationFrame(e){this.removeCallback(this.rafCallbacks.get(e)),this.rafCallbacks.delete(e),z(this.bridgeId,`canvasNodeCancelAnimationFrame`,{nodeId:this.nodeId,requestId:e})}getImageData({contextId:e,x:t,y:n,width:r,height:i}){let a=pe(r,i,{transferable:!0});return a?Promise.reject(RangeError(a)):new Promise((a,o)=>{let s=this.storeCallback((e={})=>{if(!e.ok){o(Error(e.error||`canvas pixel read failed`));return}a(L(e.value))},e=>o(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`getImageData`,contextId:e,x:t,y:n,width:r,height:i,callback:s,resultEnvelope:!0})}catch(e){this.removeCallback(s,e)}})}toDataURL(e=`image/png`,t){return R(this._width,this._height,{allowZero:!0}),new Promise((n,r)=>{let i=this.storeCallback((e={})=>{if(!e.ok){r(Error(e.error||`canvas export failed`));return}n(e.value)},e=>r(e||Error(`canvas node disposed`)));try{this.enqueueOperation({op:`toDataURL`,mimeType:e,quality:t,callback:i,resultEnvelope:!0})}catch(e){this.removeCallback(i,e)}})}dispose({notifyRender:e=!0}={}){if(this.disposed)return;this.disposed=!0;let t=Error(`canvas node disposed`);for(let e of[...this.pendingCallbacks.keys()])this.removeCallback(e,t);this.rafCallbacks.clear(),this.pendingOperations=[],this.pendingTypedArrayUpdates.clear(),this.pendingStateFeedbacks.clear(),this.stateFeedbackByProperty.clear(),this.eventListeners.clear();let n=P.get(this.bridgeId);if(n?.delete(this),n?.size===0&&P.delete(this.bridgeId),e)try{z(this.bridgeId,`disposeCanvasNodes`,{nodeIds:[this.nodeId]})}catch{}}enqueueOperation(e){if(this.disposed)throw Error(`canvas node is disposed`);this.pendingOperations.push(e),!this.flushScheduled&&(this.flushScheduled=!0,za(()=>this.flushOperations()))}flushOperations(){if(this.flushScheduled=!1,this.pendingOperations.length===0)return;let e=this.pendingOperations;this.pendingOperations=[];let t=e.flatMap(e=>e.feedback===`state`?[`${e.contextId}:${e.prop}`]:e.feedback===`stateSnapshot`?Object.keys(e.stateSequences||{}).map(t=>`${e.contextId}:${t}`):[]),n=e.some(e=>e.op===`getContext`||e.op===`contextQuery`||e.op===`contextFeedback`||e.feedback&&e.feedback!==`state`&&e.feedback!==`stateSnapshot`||e.typedArrayUpdateId),r;if(n||t.length>0){if(!n)for(let e of t){let t=this.stateFeedbackByProperty.get(e),n=this.pendingStateFeedbacks.get(t);n&&(n.delete(e),this.stateFeedbackByProperty.delete(e),n.size===0&&this.removeCallback(t))}if(r=this.storeCallback(e=>{this.releaseStateFeedback(r),this.applyFlushFeedback(e)}),!n){let e=new Set(t);this.pendingStateFeedbacks.set(r,e);for(let t of e)this.stateFeedbackByProperty.set(t,r)}}try{z(this.bridgeId,`canvasNodeFlush`,{nodeId:this.nodeId,operations:e,feedback:r})}catch(t){this.removeCallback(r,t);for(let n of e)this.removeCallback(n.callback,t);throw t}}};function po(e,t=Ia()){return!e||e.__diminaNodeType!==`dimina-canvas-node`?e:(ja(t,e.webglCapabilities),new fo({nodeId:e.nodeId,bridgeId:t,width:e.width,height:e.height,type:e.type,webglCapabilities:e.webglCapabilities}))}function mo(e,t=Ia()){return Array.isArray(e)?e.map(e=>mo(e,t)):!e||typeof e!=`object`?e:e.node?{...e,node:po(e.node,t)}:e}function ho(e={}){let t=y(e.width,300),n=y(e.height,150);R(t,n,{allowZero:!0});let r=e.type||`2d`,i=H(`offscreen_canvas`),a=Ia();return z(a,`createOffscreenCanvas`,{nodeId:i,width:t,height:n,type:r}),new fo({nodeId:i,bridgeId:a,width:t,height:n,type:r,offscreen:!0,webglCapabilities:Ma(a)})}function go(e={}){if(F)return ho(e);let t=b.getSystemInfo()||{},n=y(e.width,t.windowWidth||300),r=y(e.height,t.windowHeight||150);R(n,r,{allowZero:!0});let i=e.type||`2d`,a=H(`game_canvas`),o=Ia();return z(o,`createGameCanvas`,{nodeId:a,width:n,height:r,type:i}),F=new fo({nodeId:a,bridgeId:o,width:n,height:r,type:i,webglCapabilities:Ma(o)}),F}function _o(){return ka||=ho({width:1,height:1,type:`2d`}),ka.createImage()}function vo(){globalThis.GameGlobal=globalThis,globalThis.global=globalThis,globalThis.requestAnimationFrame=e=>{if(!F)throw Error(`requestAnimationFrame requires wx.createCanvas() first`);return F.requestAnimationFrame(e)},globalThis.cancelAnimationFrame=e=>{F?.cancelAnimationFrame(e)}}function yo(e){let t=[...P.get(e)||[]],n=t.map(e=>e.nodeId);for(let e of t)e.dispose({notifyRender:!1});if(n.length>0)try{z(e,`disposeCanvasNodes`,{nodeIds:n})}catch{}P.delete(e),Oa.delete(e),F?.bridgeId===e&&(F=null),ka?.bridgeId===e&&(ka=null)}var bo=t({createSelectorQuery:()=>xo});function xo(){return new To}function So(){return C.getPageInfo()}function Co(){let e=So();return e?.__id__||e?.id}function wo(){let e=So();return e?.bridgeId||e?.id}var To=class{constructor(){this.__componentId=Co(),this.__taskQueue=[],this.__cbQueue=[]}in(e){return this.__componentId=e.__id__,this}select(e){return new Eo(this,this.__componentId,e,!0)}selectAll(e){return new Eo(this,this.__componentId,e,!1)}selectViewport(){return new Eo(this,Co(),``,!0)}__push(e,t,n,r,i){this.__taskQueue.push({moduleId:t,selector:e,single:n,fields:r}),this.__cbQueue.push(i)}exec(e){let t=this,r=wo();w(`selectorQuery`,{tasks:this.__taskQueue,success:i=>{let a=mo(i,r)||[];a.forEach((e,r)=>{let i=t.__cbQueue[r];n(i)&&i.call(t,e)}),n(e)&&e.call(t,a)}},`render`)}},Eo=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)}},Do=t({createIntersectionObserver:()=>Oo});function Oo(e,t={}){let{thresholds:n=[0],initialRatio:r=0,observeAll:i=!1}=t;return new ko(e,{thresholds:n,initialRatio:r,observeAll:i})}var ko=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=v.store(e=>{n._disconnected||(n._observerId=e.observerId),e.info&&t.call(n,e.info)},!0);w(`addIntersectionObserver`,{moduleId:this._component.__id__,targetSelector:e,relativeInfo:this._relativeInfo,options:this._options,success:r},`render`)}disconnect(){w(`removeIntersectionObserver`,{observerId:this._observerId},`render`),this._disconnected=!0}},Ao=t({createMediaQueryObserver:()=>Mo});function jo(e={}){let t={};for(let n of[`minWidth`,`maxWidth`,`width`,`minHeight`,`maxHeight`,`height`]){let r=Number(e[n]);Number.isFinite(r)&&r>=0&&(t[n]=r)}return typeof e.orientation==`string`&&/^[-_a-z0-9]+$/i.test(e.orientation)&&(t.orientation=e.orientation),t}function Mo(e,t={}){return new No(e,t)}var No=class{constructor(e,t){this._component=e,this._options=t,this._observerId=null,this._callbackId=null,this._disconnected=!1}observe(e,t){if(!n(t))throw TypeError(`MediaQueryObserver.observe listener must be a function`);if(this._observerId!==null)throw Error(`MediaQueryObserver.observe can only be called once`);this._disconnected=!1,this._callbackId=v.store((e={})=>{if(e.observerId&&(this._observerId=e.observerId,this._disconnected)){w(`removeMediaQueryObserver`,{observerId:e.observerId},`render`),v.remove(this._callbackId),this._callbackId=null;return}!this._disconnected&&typeof e.matches==`boolean`&&t.call(this,{matches:e.matches})},!0),w(`addMediaQueryObserver`,{moduleId:this._component.__id__,condition:jo(e),options:this._options,success:this._callbackId},`render`)}disconnect(){this._disconnected=!0,w(`removeMediaQueryObserver`,{observerId:this._observerId},`render`),this._callbackId&&this._observerId&&(v.remove(this._callbackId),this._callbackId=null)}};function Po(e){if(typeof e!=`string`||e.length===0)return null;let t=[],n=``,r=0,i=()=>{n.length>0&&(t.push(n),n=``)};for(;r<e.length;){let a=e[r];if(a===`\\`){let t=e[r+1];if(t===`.`||t===`[`||t===`]`||t===`\\`){n+=t,r+=2;continue}n+=a,r++;continue}if(a===`.`){i(),r++;continue}if(a===`[`){if(t.length===0&&n.length===0)return null;i();let a=e.indexOf(`]`,r+1);if(a===-1)return null;let o=e.slice(r+1,a);if(!/^\d+$/.test(o))return null;t.push(Number(o)),r=a+1;continue}if(a===`]`)return null;n+=a,r++}return i(),t.length>0?t:null}function Fo(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1],a=Object.prototype.hasOwnProperty.call(r,n);typeof i==`number`?(!a||!Array.isArray(r[n]))&&(r[n]=[]):(!a||r[n]===null||typeof r[n]!=`object`||Array.isArray(r[n]))&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Io(e,t){return e.length<=t.length&&e.every((e,n)=>e===t[n])}function Lo(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){if(e===`**`){n.push({path:[],wildcard:!0});continue}let t=e.endsWith(`.**`),r=Po(t?e.slice(0,-3):e);r&&n.push({path:r,wildcard:t})}return n}function Ro(e,t){return e.wildcard&&e.path.length===0?!0:e.wildcard&&Io(e.path,t)||Io(t,e.path)}function zo(e){let t=[];if(Array.isArray(e.behaviorObserverList)&&e.behaviorObserverList.length>0)for(let{key:n,observer:r}of e.behaviorObserverList)t.push({expression:n,observer:r});else for(let[n,r]of Object.entries(e.behaviorObservers||{}))for(let e of r||[])t.push({expression:n,observer:e});for(let[n,r]of Object.entries(e.observers||{}))t.push({expression:n,observer:r});return t.map(e=>({...e,paths:Lo(e.expression)}))}function Bo(e,t,r=e.data,i=e.__info__||{}){for(let a of zo(i)){if(!n(a.observer)||!a.paths.some(e=>t.some(t=>Ro(e,t))))continue;let i=a.paths.map(({path:e})=>e.length===0?r:f(r,e));M(e,a.observer,i,`data observer`)}}function Vo(e,t){let n={};for(let r of t)n[r.key]=f(e.data,r.path);return n}function Ho(e,t){let n=e.__info__?.properties||{};return t.flatMap(e=>{let t=e.path[0];return typeof t!=`string`||!Object.prototype.hasOwnProperty.call(n,t)?[]:[{propertyName:t,oldValue:e.path.length===1?e.oldValue:void 0,path:e.path,value:e.value}]})}function Uo(e,t,r){if(!t||typeof t!=`object`||Array.isArray(t))return console.warn(`[service] setData data must be an object`),null;let i=!e.__dataUpdateTransaction__,a=e.__dataUpdateTransaction__||{changes:[],pendingPaths:[],callbacks:[]};e.__dataUpdateTransaction__=a,n(r)&&a.callbacks.push(r);for(let r of Object.keys(t)){let i=Po(r);if(!i){console.warn(`[service] invalid setData path: ${r}`);continue}let o=ie(t[r]);i.length===1&&e.__propertySchemas__?.[i[0]]&&n(e.normalizePropertyValues)&&(o=e.normalizePropertyValues({[i[0]]:o})[i[0]]);let s=i.length===1?e.data[i[0]]:void 0;Fo(e.data,i,o),a.changes.push({key:r,path:i,oldValue:s,value:o}),a.pendingPaths.push(i)}if(!i)return null;try{for(;a.pendingPaths.length>0;){let t=a.pendingPaths;a.pendingPaths=[],Bo(e,t)}}finally{delete e.__dataUpdateTransaction__}return{callbacks:a.callbacks,changedData:Vo(e,a.changes),changes:a.changes.map(e=>({path:e.path,value:e.value})),propertyChanges:Ho(e,a.changes)}}function Wo(e,t){let i=e.__info__?.properties||{};for(let a of t){let t=i[a.propertyName],o=t?.observer,s=a.path,c=Object.prototype.hasOwnProperty.call(a,`value`)?a.value:s.length===1?e.data[a.propertyName]:f(e.data,s);(s.length!==1||c!==a.oldValue||t?.observeAssignments)&&(r(o)?M(e,e[o],[c,a.oldValue,s],`property observer`):n(o)&&M(e,o,[c,a.oldValue,s],`property observer`))}}var Go=new Map;function Ko(e){return Go.has(e)||Go.set(e,{depth:0,scheduled:!1,updates:[],byModuleId:new Map,callbackIds:[]}),Go.get(e)}function qo(e,t){let r=(Array.isArray(t)?t:[t]).filter(n);if(r.length!==0)return v.store(()=>{r.forEach(t=>M(e,t,[],`setData callback`))})}function Jo(e){let t=Ko(e);t.depth++}function Yo(e){let t=Ko(e);t.depth>0&&t.depth--,t.depth===0&&Zo(e)}function Xo(e,t=[]){let n=t.length>0?t:Object.entries(e).flatMap(([e,t])=>{let n=Po(e);return n?[{path:n,value:t}]:[]}),r=JSON.parse(JSON.stringify(tt({data:e,changes:n})));return{data:r.data||{},changes:(r.changes||[]).filter(e=>Object.prototype.hasOwnProperty.call(e,`value`))}}function G(e,t,n,r,i=[]){let a=Ko(e),o=a.byModuleId.get(t),s=Xo(n,i);if(o)Object.assign(o.data,s.data),o.changes.push(...s.changes);else{let e={moduleId:t,data:s.data,changes:s.changes};a.byModuleId.set(t,e),a.updates.push(e)}r&&a.callbackIds.push(r),a.depth===0&&!a.scheduled&&(a.scheduled=!0,Promise.resolve().then(()=>{a.scheduled=!1,a.depth===0&&Zo(e)}))}function Zo(e){let t=Go.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,S.send({type:`ub`,target:`render`,body:{bridgeId:e,updates:n,callbackIds:r}})}function Qo(e){return i(e)||n(e)?e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>Qo(e)):typeof e==`object`?Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`$`)||(e[t]=Qo(n)),e),{}):e}function $o(e){if(e){let t={};for(let n in e){let r=we(e[n]);t[n]={type:[r.type,...r.optionalTypes].map(ts),default:r.value}}return t}}var es=new Map([[String,`s`],[Number,`n`],[Boolean,`b`],[Object,`o`],[Array,`a`]]);function ts(e){return Array.isArray(e)?e.map(e=>ts(e)):e===null||e===``?null:es.get(e)||(console.warn(`[service] ignore unknown props type ${e}`),null)}function ns(e={},t=``){let n=t.trim();if(!n)return;let r=n.replace(/-/g,``).toLowerCase(),i=[n,m(n),h(n),r];for(let t of i)if(t&&e[t]!==void 0){let n=e[t];if(typeof n==`string`)return{bind:n};if(n&&typeof n==`object`)return n}}function rs(e,t){if(!Array.isArray(t))return;let r=new WeakMap,i=new WeakSet,a=e.properties,o=e.data,s=e.methods,c=e.relations,l=Object.prototype.hasOwnProperty.call(e,`export`),u=e.export,d,f,p,m,h;function ee(e,t){let n=Array.isArray(e)?[...e]:{...e};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],i=t[e];n[e]=typeof r==`object`&&typeof i==`object`&&i&&!Array.isArray(i)?ee(r,i):i}return n}function g(e,t){if(typeof t==`string`){te(e,t);return}if(!t||typeof t!=`object`||i.has(t))return;i.add(t);let a=r.has(t);if(Array.isArray(t.behaviors)&&t.behaviors.forEach(t=>g(e,t)),t.properties&&(d={...d,...t.properties}),t.data&&(f=ee(f||{},t.data)),!a){r.set(t,!0);let i=[`created`,`attached`,`ready`,`moved`,`detached`,`error`];e.behaviorLifetimes=e.behaviorLifetimes||{};for(let r of i){let i=t.lifetimes?.[r]||t[r];n(i)&&(e.behaviorLifetimes[r]=e.behaviorLifetimes[r]||[],e.behaviorLifetimes[r].push(i))}if(t.observers){e.behaviorObservers=e.behaviorObservers||{},e.behaviorObserverList=e.behaviorObserverList||[];for(let n in t.observers)e.behaviorObservers[n]||(e.behaviorObservers[n]=[]),e.behaviorObservers[n].push(t.observers[n]),e.behaviorObserverList.push({key:n,observer:t.observers[n]})}}if(t.methods&&(p={...p,...t.methods}),t.relations&&(m={...m,...t.relations}),t.export&&(h=t.export),!a&&t.pageLifetimes){e.behaviorPageLifetimes=e.behaviorPageLifetimes||{};for(let r of[`show`,`hide`,`resize`,`routeDone`])n(t.pageLifetimes[r])&&(e.behaviorPageLifetimes[r]=e.behaviorPageLifetimes[r]||[],e.behaviorPageLifetimes[r].push(t.pageLifetimes[r]))}i.delete(t)}function te(e,t){switch(t){case`wx://component-export`:break;case`wx://form-field`:d={...d,name:{type:String},value:{type:null}};break;case`wx://form-field-group`:case`wx://form-field-button`:case`wx://label-target`:case`wx://style-filter`:case`wx://request-filter`:break;default:console.warn(`[service] 未知的内置 behavior: ${t}`)}}t.forEach(t=>g(e,t)),(d||a)&&(e.properties={...d,...a}),(f||o)&&(e.data=ee(f||{},o||{})),(p||s)&&(e.methods={...p,...s}),(m||c)&&(e.relations={...m,...c}),l?e.export=u:h&&(e.export=h)}function is(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 as(e,t){if(!e||!t)return!1;if(e.startsWith(`#`)){let n=e.slice(1);return t.id===n}if(e.startsWith(`.`)){let n=e.slice(1);return t.__targetInfo__?.class&&t.__targetInfo__.class.split(` `).includes(n)}if(e.startsWith(`[`)&&e.endsWith(`]`)){let n=e.slice(1,-1).match(/^(\w+)(?:=["']?([^"']*)["']?)?$/);if(n){let[,e,r]=n,i=t.__targetInfo__?.dataset||{};return r===void 0?Object.prototype.hasOwnProperty.call(i,e):i[e]===r}return!1}return t.is?t.is.split(`/`).pop()===e||t.is===e:!1}function os(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 ss(e,t){if(e&&e.expression){if(e.isSimple)return f(t,e.expression);try{return Function(`data`,`with(data) { return ${e.expression} }`)(t)}catch(t){console.warn(`[service] 计算表达式失败:`,e.expression,t);return}}}function cs(e,t,n){let r=Object.values(t||{}),i=[];for(let t of r){if(!is(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&&os(i,n)&&(o[r]=ie(ss(i,e.data)))}if(Object.keys(o).length>0){let e=t.normalizePropertyValues?.(o,{applyFilter:!1})||o,n=t.tO?.(e)||t.normalizePropertyValues?.(e)||e;t.__pendingSyncedProps__=t.__pendingSyncedProps__||{},Object.assign(t.__pendingSyncedProps__,e),i.push({child:t,data:n})}}return i}var ls=[`created`,`attached`,`ready`,`moved`,`detached`,`error`],us=[`show`,`hide`,`resize`,`routeDone`],ds=class e{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=ie(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.__eventPath__=null,this.__pageId__=t.pageId,this.__parentId__=t.parentId,this.__isCustomTabBar__=t.isCustomTabBar===!0,this.__relations__=new Map,this.__relationPaths__=new Map,this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[],this.__pendingInitSetDataCallbacks__=[],this.__childPropsBindings__={},this.__pendingSyncedProps__={},this.__initialPropertyObserversInvoked__=!1,this.__initialPropertyNames__=new Set(t.propertyNames||Object.keys(t.properties||{})),this.__initialPropertyChanges__=[],this.__initialPropertyValues__={},this.__propertySchemas__=Object.fromEntries(Object.entries(this.__info__.properties||{}).map(([e,t])=>[e,we(t)]))}init({deferInitialData:e=!1}={}){if(this.#d(),this.__isComponent__){let e=this.opts.properties||{};for(let[t,n]of Object.entries(this.__propertySchemas__)){let r=ke(n,void 0,{absent:!0});if(this.data[t]=r,this.__initialPropertyNames__.has(t)){let n=this.normalizePropertyValue(t,e[t],{applyFilter:!1});this.__initialPropertyValues__[t]=n,this.__initialPropertyChanges__.push({propertyName:t,oldValue:void 0,path:[t],value:n})}}}this.#u(),this.#t(),this.#e(),this.#m(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,S.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__=[],G(this.bridgeId,this.__id__,{},qo(this,e))}#e(){this.hasBehavior(`wx://component-export`)&&this.__info__.export&&n(this.__info__.export)&&(this.export=this.__info__.export.bind(this))}#t(){let e=this.__info__.relations;if(e&&typeof e==`object`)for(let[t]of Object.entries(e)){let e=this.#n(t);this.__relationPaths__.set(t,e),this.__relations__.has(t)||this.__relations__.set(t,[])}}#n(e){if(e.startsWith(`./`)){let t=this.is.lastIndexOf(`/`);return t===-1?e.substring(2):`${this.is.substring(0,t)}/${e.substring(2)}`}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(`/`)}return e}#r(){let e=this.__info__.relations;if(!e)return;let t=Object.values(Y.instances[this.bridgeId]||{}).filter(e=>e===this||!e.__isComponent__||e.__componentAttached__||e.__componentAttaching__);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.#a(t,e));for(let e of o)this.#s(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}`),o&&this.#a(e,t)&&this.#s(n,e,r)}}#a(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.#o(e.__id__,this.__id__,n);case`descendant`:return this.#o(this.__id__,e.__id__,n);default:return!1}}#o(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}#s(e,t,n){let r=this.__relations__.get(e)||[];r.includes(t)||(r.push(t),this.__relations__.set(e,r),M(this,n.linked,[t],`relation linked callback`))}#c(e,t,n){let r=this.__relations__.get(e)||[],i=r.indexOf(t);i!==-1&&(r.splice(i,1),this.__relations__.set(e,r),M(this,n.unlinked,[t],`relation unlinked callback`))}#l(e,t,n){M(this,n.linkChanged,[t],`relation linkChanged callback`)}setData(e,t){let n=Uo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks),Wo(this,n.propertyChanges);return}if(this.__groupSetDataMode__){for(let e of Object.keys(n.changedData))this.__groupSetDataBuffer__[e]=n.changedData[e];this.__groupSetDataChanges__.push(...n.changes),this.__groupSetDataCallbacks__.push(...n.callbacks),Wo(this,n.propertyChanges);return}let r=cs(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,qo(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)}),Wo(this,n.propertyChanges)}#u(){ls.forEach(e=>{let t=this.__info__.lifetimes?.[e]||this.__info__[e];n(t)&&(this[e]=t.bind(this))}),this.__isComponent__&&us.forEach(e=>{let t=this.__info__.pageLifetimes?.[e];n(t)&&(e===`show`?e=`onShow`:e===`hide`&&(e=`onHide`),this[e]=t.bind(this))})}#d(){let e=this.__info__.methods;for(let t in e)n(e[t])&&(this[t]=e[t].bind(this))}#f(){if(!this.__isComponent__||!this.__info__.properties||this.__initialPropertyObserversInvoked__)return;let e=this.__initialPropertyChanges__.map(e=>e.path);e.length>0&&(Bo(this,e),Wo(this,this.__initialPropertyChanges__)),this.__initialPropertyObserversInvoked__=!0}#p(){for(let[e,t]of Object.entries(this.__initialPropertyValues__)){let n=this.data[e],r=this.normalizePropertyValue(e,t,{oldValue:n});this.data[e]=r;let i=this.__initialPropertyChanges__.find(t=>t.propertyName===e);i&&(i.oldValue=n,i.value=r)}}#m(){this.__isComponent__?(this.componentCreated(),this.#p(),this.#f()):(this.componentCreated(),this.componentAttached(),M(this,this.onLoad,[this.opts.query||{}],`onLoad`)),this.initd=!0}tO(e){let t=typeof this.normalizePropertyValues==`function`?this.normalizePropertyValues(e,{applyFilter:!1}):e,n={},r={};for(let[e,i]of Object.entries(t)){if(this.__pendingSyncedProps__&&Object.prototype.hasOwnProperty.call(this.__pendingSyncedProps__,e)&&a(this.__pendingSyncedProps__[e],i)){this.hasPropertyFilter?.(e)||(this.data[e]=i),r[e]=this.data[e],delete this.__pendingSyncedProps__[e];continue}let t=typeof this.normalizePropertyValue==`function`?this.normalizePropertyValue(e,i):i;n[e]=t,r[e]=t}if(Object.keys(n).length===0)return r;let i=[],o=[];for(let[e,t]of Object.entries(n)){let n=this.data[e];this.data[e]=t,o.push([e]),i.push({propertyName:e,oldValue:n,path:[e],value:t})}return Bo(this,o),Wo(this,i),r}hasPropertyFilter(e){let t=this.__info__.properties?.[e];return!!t&&typeof t==`object`&&t.filter!=null}normalizePropertyValue(e,t,{absent:r=!1,applyFilter:i=!0,oldValue:a=this.data[e],path:o=[e]}={}){let s=this.__propertySchemas__[e];if(!s)return t;let c=ke(s,t,{absent:r});if(r||!i||!this.hasPropertyFilter(e))return c;let l=this.__info__.properties[e],u=n(l.filter)?l.filter:this.__info__.methods?.[l.filter];if(!n(u))return c;let d=M(this,u,[c,a,o],`property filter`);return d===void 0?c:d}normalizePropertyValues(e,{applyFilter:t=!0}={}){let n={};for(let[r,i]of Object.entries(e||{}))n[r]=this.normalizePropertyValue(r,i,{applyFilter:t});return n}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 xo().in(this)}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]),n=t.find(n=>is(n,this.__id__,t)&&as(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=>is(n,this.__id__,t)&&as(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 Oo(this,e)}groupSetData(e){if(!n(e)){console.warn(`[service] groupSetData callback must be a function`);return}this.__groupSetDataMode__=!0,Jo(this.bridgeId),this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];try{M(this,e,[],`groupSetData callback`)}finally{if(this.__groupSetDataMode__=!1,this.__groupSetDataBuffer__&&Object.keys(this.__groupSetDataBuffer__).length>0){let e=this.__groupSetDataBuffer__,t=this.__groupSetDataCallbacks__,n=this.__groupSetDataChanges__;this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];let r=cs(this,Y.instances[this.bridgeId],e);G(this.bridgeId,this.__id__,e,qo(this,t),n),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}else this.__groupSetDataBuffer__={},this.__groupSetDataChanges__=[],this.__groupSetDataCallbacks__=[];Yo(this.bridgeId)}}createMediaQueryObserver(e){return Mo(this,e)}getRelationNodes(e){let t=this.__relations__.get(e);return t?[...t]:null}animate(e,t,r,i,a){n(i)&&(a=i,i=void 0),w(`componentAnimate`,{moduleId:this.__id__,selector:e,keyframes:t,duration:r,timeline:i,success:a},`render`)}clearAnimation(e,t,r){n(t)&&(r=t,t={}),w(`componentClearAnimation`,{moduleId:this.__id__,selector:e,options:t||{},success:r},`render`)}async triggerEvent(t,n,r={}){if(!t)return;let i=t.trim();if(!i)return;let a={bubbles:r.bubbles===!0,composed:r.composed===!0,capturePhase:r.capturePhase===!0},o={id:this.id,dataset:this.dataset||{}},s=!1,c=!1,l={type:i,timeStamp:Date.now(),detail:n,bubbles:a.bubbles,composed:a.composed,currentTarget:null,target:o,preventDefault(){c=!0},stopPropagation(){s=!0}};Object.defineProperty(l,"defaultPrevented",{enumerable:!0,get:()=>c});let u=e.prototype.getCustomEventPath.call(this,a.composed),d=async(e,t)=>{let n=ns(e.eventAttr,i);if(!n)return;let r=t?n.captureCatch??n.captureBind:n.catch??n.bind;if(!r)return;l.currentTarget=e.currentTarget;let a=await Y.triggerEvent({bridgeId:this.bridgeId,moduleId:e.moduleId,methodName:r,event:l});(t?n.captureCatch:n.catch)&&l.stopPropagation(),a===!1&&(l.preventDefault(),l.stopPropagation())};if(a.capturePhase)for(let e=u.length-1;e>=0&&!s;e--)await d(u[e],!0);if(s)return;let f=a.bubbles?u:u.slice(0,1);for(let e of f)if(await d(e,!1),s)break}getCustomEventPath(e){let t=[{moduleId:this.__pageId__,eventAttr:this.__eventAttr__||{},currentTarget:{id:this.id,dataset:this.dataset||{}}}];if(Array.isArray(this.__eventPath__)){let n=this.__eventPath__.filter(e=>e?.moduleId).map(e=>{let t=e.isComponentHost&&e.nodeModuleId?Y.instances[this.bridgeId]?.[e.nodeModuleId]:null;return{moduleId:e.moduleId,nodeModuleId:e.nodeModuleId,isComponentHost:e.isComponentHost===!0,eventAttr:e.eventAttr||{},currentTarget:{id:t?.id??e.targetInfo?.id,dataset:t?.dataset||e.targetInfo?.dataset||{}}}}),r=Y.instances[this.bridgeId]||{},i=new Set([this.__id__]),a=0,o=r[this.__parentId__];for(;o?.__isComponent__&&!i.has(o.__id__);){i.add(o.__id__);let e=n.findIndex(e=>e.isComponentHost&&e.nodeModuleId===o.__id__);if(e>=0)a=Math.max(a,e+1);else if(Object.keys(o.__eventAttr__||{}).length>0){let e=-1;for(let t=0;t<n.length;t++)n[t].moduleId===o.__id__&&(e=t);let t=Math.max(a,e+1);n.splice(t,0,{moduleId:o.__pageId__,nodeModuleId:o.__id__,isComponentHost:!0,eventAttr:o.__eventAttr__,currentTarget:{id:o.id,dataset:o.dataset||{}}}),a=t+1}o=r[o.__parentId__]}for(let r of n)(e||r.moduleId===this.__pageId__)&&t.push(r);return t}let n=Y.instances[this.bridgeId]||{},r=new Set([this.__id__]),i=n[this.__parentId__];for(;i?.__isComponent__&&!r.has(i.__id__);)r.add(i.__id__),(e||i.__pageId__===this.__pageId__)&&t.push({moduleId:i.__pageId__,eventAttr:i.__eventAttr__||{},currentTarget:{id:i.id,dataset:i.dataset||{}}}),i=n[i.__parentId__];return t}pageReady(){this.__isComponent__||M(this,this.ready,[],`ready lifetime`)}pageUnload(){this.__isComponent__||M(this,this.onUnload,[],`onUnload`)}pageScrollTop(e){if(!this.__isComponent__){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}}pagePullDownRefresh(){this.__isComponent__||M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){this.__isComponent__||M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){if(!this.__isComponent__)return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){this.__isComponent__||M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`page show lifetime`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`page hide lifetime`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.resize,[e],`page resize lifetime`)}componentRouteDone(){N(this,this.__info__.behaviorPageLifetimes?.routeDone,[],`page routeDone lifetime`),M(this,this.routeDone,[],`page routeDone lifetime`)}componentCreated(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`)}componentAttached(){N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),this.#r()}componentReadied(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`)}componentMoved(){N(this,this.__info__.behaviorLifetimes?.moved,[],`moved lifetime`),M(this,this.moved,[],`moved lifetime`);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)}}componentDetached(){this.__componentAttached__=!1,N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`);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.#c(t,r,n)}this.#h(),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];M(t,i?.unlinked,[this],`relation unlinked callback`)}}}componentError(e){N(this,this.__info__.behaviorLifetimes?.error,[e],`error lifetime`,!1),M(this,this.error,[e],`error lifetime`,!1)}},K=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,rs(this.moduleInfo,this.behaviors),this.noReferenceData=Qo(this.moduleInfo.data||{})}getProps(){let e=$o(this.moduleInfo.properties),t=Array.isArray(this.behaviors)?this.behaviors.filter(e=>typeof e==`string`&&e.startsWith(`wx://`)):[];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 t.length&&(e||={},e.__diminaMeta={builtinBehaviors:t}),e}},fs=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=ie(e.noReferenceData),this.__type__=e.type,this.__id__=t.moduleId,this.__info__=e.moduleInfo,this.__childPropsBindings__={},this.__pendingInitSetDataCallbacks__=[]}init({deferInitialData:e=!1}={}){this.#e(),this.#t(),e||this.sendInitialData()}sendInitialData(){this.__initialDataSent__||(this.__initialDataSent__=!0,S.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__=[],G(this.bridgeId,this.__id__,{},qo(this,e))}setData(e,t){let n=Uo(this,e,t);if(!n)return;if(!this.initd){this.__pendingInitSetDataCallbacks__.push(...n.callbacks);return}let r=cs(this,Y.instances[this.bridgeId],n.changedData);G(this.bridgeId,this.__id__,n.changedData,qo(this,n.callbacks),n.changes),r.forEach(({child:e,data:t})=>{G(this.bridgeId,e.__id__,t)})}createSelectorQuery(){return xo().in(this)}getTabBar(){let e=Object.values(Y.instances[this.bridgeId]||{});return e.find(t=>t?.__isComponent__&&t.__isCustomTabBar__&&is(t,this.__id__,e))||null}selectComponent(e){let t=Object.values(Y.instances[this.bridgeId]||{}),n=t.find(n=>is(n,this.__id__,t)&&as(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=>is(n,this.__id__,t)&&as(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];this[e]=n(t)?t.bind(this):t}}#t(){N(this,this.__info__.behaviorLifetimes?.created,[],`created lifetime`),M(this,this.created,[],`created lifetime`),N(this,this.__info__.behaviorLifetimes?.attached,[],`attached lifetime`),M(this,this.attached,[],`attached lifetime`),M(this,this.onLoad,[this.opts.query||{}],`onLoad`),this.initd=!0}pageShow(){N(this,this.__info__.behaviorPageLifetimes?.show,[],`page show lifetime`),M(this,this.onShow,[],`onShow`)}pageHide(){N(this,this.__info__.behaviorPageLifetimes?.hide,[],`page hide lifetime`),M(this,this.onHide,[],`onHide`)}pageReady(){N(this,this.__info__.behaviorLifetimes?.ready,[],`ready lifetime`),M(this,this.ready,[],`ready lifetime`),M(this,this.onReady,[],`onReady`)}pageUnload(){N(this,this.__info__.behaviorLifetimes?.detached,[],`detached lifetime`),M(this,this.detached,[],`detached lifetime`),M(this,this.onUnload,[],`onUnload`),this.initd=!1}pageScrollTop(e){let{scrollTop:t}=e;M(this,this.onPageScroll,[{scrollTop:t}],`onPageScroll`)}pagePullDownRefresh(){M(this,this.onPullDownRefresh,[],`onPullDownRefresh`)}pageReachBottom(){M(this,this.onReachBottom,[],`onReachBottom`)}pageShareAppMessage(e={}){return M(this,this.onShareAppMessage,[e],`onShareAppMessage`)}pageTabItemTap(e={}){M(this,this.onTabItemTap,[e],`onTabItemTap`)}pageResize(e){N(this,this.__info__.behaviorPageLifetimes?.resize,[e],`page resize lifetime`),M(this,this.onResize,[e],`onResize`)}},q=class e{static type=`page`;constructor(t,r){if(this.moduleInfo=t,this.extraInfo=r,this.type=e.type,this.behaviors=this.moduleInfo.behaviors,this.usingComponents=this.extraInfo.usingComponents,rs(this.moduleInfo,this.behaviors),this.moduleInfo.methods)for(let[e,t]of Object.entries(this.moduleInfo.methods))!(e in this.moduleInfo)&&n(t)&&(this.moduleInfo[e]=t);this.noReferenceData=Qo(this.moduleInfo.data||{})}},ps=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,resourceLoadId:o,runtimeType:s}=e;if(g&&(this.isScriptLoaded=this.isScriptLoaded||{},!this.isScriptLoaded[i])){let e=`${a}${t}/${i}/logic.js`;globalThis.importScripts(e),this.isScriptLoaded[i]=!0}return C.setInitId(n),s===`game`?(yo(n),vo(),_(r),S.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0):(le(`app`)&&_(`app`),_(r),S.invoke({type:`serviceResourceLoaded`,target:`service`,body:{bridgeId:n,resourceLoadId:o}}),!0)}createAppModule(e){let t=new ps(e);this.staticModules[ps.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))_(e);if(n===q.type){let n=new q(e,t);this.staticModules[r]=n}else if(n===K.type){let n=new K(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[ps.type]}getModuleByPath(e){return this.staticModules[e]}},Y=new class{constructor(){this.app=void 0,this.defaultApp={},this.appLaunchOptions={},this.appEnterOptions={},this.instances={},this.pageStates=new Map,this.runtimeType=`miniProgram`,this.gameLaunched=!1}setRuntimeType(e){this.runtimeType=e===`game`?`game`:`miniProgram`}isMiniGame(){return this.runtimeType===`game`}setAppLaunchOptions(e){this.app||(this.appLaunchOptions=this.normalizeAppOptions(e),this.appEnterOptions=this.appLaunchOptions)}normalizeAppOptions(e={}){let{pagePath:t,path:n=t,...r}=e||{},i={...r,path:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];return i}getAppLaunchOptions(){return this.appLaunchOptions}getAppEnterOptions(){return this.appEnterOptions}getApp(e={}){return e.allowDefault?this.app||this.defaultApp:this.app}getPageState(e){return this.pageStates.has(e)||this.pageStates.set(e,{hidden:!1,pendingReady:!1,pendingShow:!1,ready:!1,shown:!1}),this.pageStates.get(e)}queuePendingEvent(e,t){return e.__pendingRuntimeEvents__=e.__pendingRuntimeEvents__||[],new Promise((n,r)=>{e.__pendingRuntimeEvents__.push({...t,resolve:n,reject:r})})}async flushPendingEvents(e){let t=e?.__pendingRuntimeEvents__||[];e.__pendingRuntimeEvents__=[];for(let e of t)try{let t=await this.dispatchEvent(e);e.resolve(t)}catch(t){e.reject(t)}}async dispatchEvent({instance:e,bridgeId:t,moduleId:r,methodName:i,event:a}){if(n(e[i])){let t=M(e,e[i],[a],`event ${i}`);try{return await t}catch(t){n(e.componentError)&&e.componentError(t),x(t),console.error(`[service] event ${i} error:`,t);return}}console.warn(`[service] triggerEvent ${t} ${r}, is: ${e.is}, method: ${i} is not exist`)}createApp(e=this.appLaunchOptions){if(this.app){console.log(`[service] app instance already existed`);return}let t=this.normalizeAppOptions(e),n=J.getAppModule();if(!n){console.log(`[service] app instance is not exist`);return}console.log(`[service] create app instance`),Object.assign(n.moduleInfo,this.defaultApp),this.defaultApp={},this.appLaunchOptions=t,this.appEnterOptions=t,this.app=new na(n,t)}appShow(e){e&&Object.keys(e).length>0&&(this.appEnterOptions=this.normalizeAppOptions(e)),this.app?this.app.appShow(this.appEnterOptions):this.isMiniGame()&&this.gameLaunched&&Ke(this.appEnterOptions)}appHide(){this.app?this.app.appHide():this.isMiniGame()&&this.gameLaunched&&qe()}gameLaunch(){this.isMiniGame()&&!this.gameLaunched&&(this.gameLaunched=!0,Ke(this.appEnterOptions))}stackShow(e){C.pushStack(e)}stackHide(e){C.popStack(e)}createInstance(e){let{bridgeId:t,moduleId:n,path:r,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u,stackId:d,isCustomTabBar:f=!1,deferInitialData:p=!1}=e,m=J.getModuleByPath(r);if(!m){console.error(`[service] ${r} not exist`);return}if(console.log(`[service] create instance ${r}`),this.instances[t]=this.instances[t]||{},m.type===K.type){let e=new ds(m,{bridgeId:t,moduleId:n,path:r,isCustomTabBar:f,query:i,eventAttr:a,pageId:o,parentId:s,properties:c,propertyNames:l,targetInfo:u});this.instances[t][n]=e,m.isComponent||C.push(e,d),e.init({deferInitialData:p});let h=this.getPageState(t);return!m.isComponent&&h.pendingShow&&!h.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}if(m.type===q.type){let e=new fs(m,{bridgeId:t,moduleId:n,path:r,query:i});this.instances[t][n]=e,C.push(e,d),e.init({deferInitialData:p});let a=this.getPageState(t);return a.pendingShow&&!a.hidden&&this.pageShow({bridgeId:t,moduleId:n}),e}console.error(`[service] ${m.type} instance is not exist.`)}moduleAttached(e){let{bridgeId:t,moduleId:n,parentId:r}=e,i=this.instances[t]?.[n];if(!i||i.__type__!==K.type||!i.__isComponent__||i.__componentAttached__||i.__componentAttaching__)return;r&&this.instances[t]?.[r]&&(i.__parentId__=r);let a=this.instances[t]?.[i.__parentId__];if(a?.__isComponent__&&!a.__componentAttached__){i.__componentAttachPending__=!0;return}i.__componentAttachPending__=!1,i.__componentAttaching__=!0;try{i.__componentAttached__=!0,i.componentAttached(),i.__componentAttaching__=!1,this.getPageState(t).shown&&!i.__pageShown__&&(i.__pageShown__=!0,i.pageShow());let e=Object.values(this.instances[t]||{}).filter(e=>e?.__parentId__===n&&e.__componentAttachPending__);for(let n of e)this.moduleAttached({bridgeId:t,moduleId:n.__id__});if(i.__pendingReadyOpts__){let e=i.__pendingReadyOpts__;delete i.__pendingReadyOpts__,this.moduleReady(e)}}finally{i.__componentAttaching__=!1}}moduleReady(e){let{bridgeId:t,moduleId:n,propBindings:r,eventPath:i}=e,a=this.instances[t]?.[n];if(a){if(Array.isArray(i)&&(a.__eventPath__=i),r&&a.__parentId__){let e=this.instances[t]?.[a.__parentId__];e&&(e.__childPropsBindings__||={},e.__childPropsBindings__[n]=r)}if(a.__type__===K.type){if(a.__isComponent__&&!a.__componentAttached__){a.__pendingReadyOpts__=e;return}if(a.__componentReadied__)return;if(Object.values(this.instances[t]||{}).some(e=>e?.__isComponent__&&e.__componentAttached__&&!e.__componentReadied__&&this.isDescendantInstance(e,a,t))){a.__pendingReadyOpts__=e;return}a.__componentReadied__=!0,a.componentReadied(),this.flushPendingEvents(a),a.flushInitSetDataCallbacks?.();let n=this.getPageInstance(t);n&&this.checkAndCallPageReady(t,n.__id__);let r=this.instances[t]?.[a.__parentId__];for(;r?.__isComponent__;){if(r.__pendingReadyOpts__){let e=r.__pendingReadyOpts__;delete r.__pendingReadyOpts__,this.moduleReady(e)}r=this.instances[t]?.[r.__parentId__]}}}}isDescendantInstance(e,t,n){let r=e;for(;r?.__parentId__;){if(r.__parentId__===t.__id__)return!0;r=this.instances[n]?.[r.__parentId__]}return!1}moduleUnmounted(e){let{bridgeId:t,moduleId:n}=e,r=this.instances[t]?.[n];r&&(r.__type__===K.type&&(!r.__isComponent__||r.__componentAttached__)&&!r.__componentDetached__&&(r.componentDetached(),r.__componentDetached__=!0),delete this.instances[t][n])}pageShow(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!1,n.pendingShow=!0,!this.instances[t])return;let r=this.getPageInstance(t);if(!r?.initd)return;if(n.shown){n.pendingShow=!1;return}n.shown=!0,n.pendingShow=!1;let i=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?i.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&!e.__pageShown__&&(e.__pageShown__=!0,e.pageShow()):i.push(e)))}),i.forEach(e=>{e.pageShow()}),n.pendingReady&&this.pageReady({...e,moduleId:r.__id__})}pageReady(e){let{bridgeId:t,moduleId:n}=e,r=this.getPageState(t);r.pendingReady=!0;let i=this.instances[t]?.[n];i&&(r.hidden||!r.shown||r.ready||(i.__pageReadyPending__=!0,i.flushInitSetDataCallbacks?.(),this.checkAndCallPageReady(t,n)))}getPageInstance(e){let t=this.instances[e];return t?Object.values(t).find(e=>e&&(e.__type__===q.type||e.__type__===K.type&&!e.__isComponent__)):null}checkAndCallPageReady(e,t){let n=this.getPageState(e),r=this.instances[e]?.[t];if(!r||!r.__pageReadyPending__||!n.shown||n.ready)return;let i=this.instances[e];if(!i){r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady();return}Object.values(i).filter(e=>e&&e.__type__===K.type&&e.__isComponent__&&e.initd&&!e.__componentReadied__).length===0&&(r.__pageReadyPending__=!1,n.pendingReady=!1,n.ready=!0,r.pageReady())}pageHide(e){let{bridgeId:t}=e,n=this.getPageState(t);if(n.hidden=!0,n.pendingShow=!1,!n.shown||(n.shown=!1,!this.instances[t]))return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?r.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&e.__pageShown__&&(e.__pageShown__=!1,e.pageHide()):r.push(e)))}),r.forEach(e=>{e&&e.pageHide()})}pageUnload(e){let{bridgeId:t}=e;if(!this.instances[t])return;let n=this.getInstancesInTreeOrder(t);this.getInstancesInTreeOrder(t,{postOrder:!0}).filter(e=>e?.__type__===K.type&&e.__isComponent__).forEach(e=>{e.__componentAttached__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0)}),n.forEach(e=>{e&&(e.__type__===K.type&&!e.__isComponent__&&!e.__componentDetached__&&(e.componentDetached(),e.__componentDetached__=!0),e.pageUnload())}),C.remove(t),delete this.instances[t],this.pageStates.delete(t)}getInstancesInTreeOrder(e,{postOrder:t=!1}={}){let n=Object.values(this.instances[e]||{}).filter(Boolean),r=new Map(n.map(e=>[e.__id__,e])),i=new Map,a=[];for(let e of n)if(e.__parentId__&&r.has(e.__parentId__)){let t=i.get(e.__parentId__)||[];t.push(e),i.set(e.__parentId__,t)}else a.push(e);let o=[],s=new Set,c=e=>{if(e&&!s.has(e)){s.add(e),t||o.push(e);for(let t of i.get(e.__id__)||[])c(t);t&&o.push(e)}};return a.forEach(c),n.forEach(c),o}pageScroll(e){let{bridgeId:t,moduleId:n,scrollTop:r}=e,i=this.instances[t]?.[n];i&&i.pageScrollTop({scrollTop:r})}pagePullDownRefresh({bridgeId:e}){this.getPageInstance(e)?.pagePullDownRefresh()}pageReachBottom({bridgeId:e}){this.getPageInstance(e)?.pageReachBottom()}pageShareAppMessage({bridgeId:e,...t}){return this.getPageInstance(e)?.pageShareAppMessage(t)}pageTabItemTap({bridgeId:e,...t}){this.getPageInstance(e)?.pageTabItemTap(t)}pageResize(e){let{bridgeId:t,size:n}=e;if(!this.instances[t])return;let r=[];this.getInstancesInTreeOrder(t).forEach(e=>{e&&(e.__type__===q.type?r.push(e):e.__type__===K.type&&(e.__isComponent__?e.__componentAttached__&&e.pageResize(n):r.push(e)))}),r.forEach(e=>e.pageResize(n))}componentError(e){let{bridgeId:t,moduleId:n,error:r}=e,i=this.instances[t]?.[n];i&&(i.__type__===K.type&&i.componentError(r),x(r))}componentRouteDone(e){let{bridgeId:t}=e;this.instances[t]&&this.getInstancesInTreeOrder(t).forEach(e=>{e?.__type__===K.type&&(!e.__isComponent__||e.__componentAttached__)&&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__===K.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})}},ms=t({getEnterOptionsSync:()=>gs,getLaunchOptionsSync:()=>hs});function hs(){return Y.getAppLaunchOptions()}function gs(){return Y.getAppEnterOptions()}var _s=t({getLocation:()=>vs,offLocationChange:()=>Cs,onLocationChange:()=>Ss,openLocation:()=>bs,startLocationUpdate:()=>ys,stopLocationUpdate:()=>xs});function vs(e){return w(`getLocation`,e)}function ys(e){return w(`startLocationUpdate`,e)}function bs(e){return w(`openLocation`,e)}function xs(e){return w(`stopLocationUpdate`,e)}function Ss(e){e&&w(`onLocationChange`,{success:v.store(e,!0)})}function Cs(e){if(e){let t=v.store(e,!0);w(`offLocationChange`,{success:t}),v.remove(t)}else w(`offLocationChange`),v.remove()}var ws=t({createMapContext:()=>Ts});function Ts(e,t){return new Es({mapId:e,obj:t})}var Es=class{constructor(e){this.opts=e}addMarkers(e){return this.invoke(`addMarkers`,e)}removeMarkers(e){return this.invoke(`removeMarkers`,e)}includePoints(e){return this.invoke(`includePoints`,e)}setCenterOffset(e){return this.invoke(`setCenterOffset`,e)}getCenterLocation(e){return this.invoke(`getCenterLocation`,e)}getScale(e){return this.invoke(`getScale`,e)}moveToLocation(e){return this.invoke(`moveToLocation`,e)}translateMarker(e){return this.invoke(`translateMarker`,e)}addArc(e){return this.invoke(`addArc`,e)}removeArc(e){return this.invoke(`removeArc`,e)}invoke(e,t={}){return w(e,{mapId:this.opts.mapId,...t})}},Ds=t({createInnerAudioContext:()=>As}),Os=1,ks=class{constructor(){this._audioId=Os++,this._src=``,this._startTime=0,this._autoplay=!1,this._loop=!1,this._volume=1,this._playbackRate=1,this._currentTime=0,this._duration=0,this._buffered=0,this._paused=!0,this._listeners={},w(`audioCreate`,{audioId:this._audioId}),w(`audioListen`,{audioId:this._audioId,evtId:`audio_${this._audioId}`,keep:!0,success:e=>this._dispatch(e)})}_dispatch(e){if(!e||typeof e!=`object`)return;this._currentTime=e.currentTime||0,this._duration=e.duration||0,this._buffered=e.buffered||0,this._paused=!!e.paused;let t=this._listeners[e.event];if(t)for(let n of t.slice())n(e)}get src(){return this._src}set src(e){this._src=e,w(`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,w(`audioSetProp`,{audioId:this._audioId,prop:`startTime`,value:this._startTime})}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=!!e,w(`audioSetProp`,{audioId:this._audioId,prop:`autoplay`,value:this._autoplay})}get loop(){return this._loop}set loop(e){this._loop=!!e,w(`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)),w(`audioSetProp`,{audioId:this._audioId,prop:`volume`,value:this._volume})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=Number(e)||1,w(`audioSetProp`,{audioId:this._audioId,prop:`playbackRate`,value:this._playbackRate})}get duration(){return this._duration}get currentTime(){return this._currentTime}get paused(){return this._paused}get buffered(){return this._buffered}play(){this._paused=!1,w(`audioPlay`,{audioId:this._audioId,src:this._src})}pause(){this._paused=!0,w(`audioPause`,{audioId:this._audioId})}stop(){this._paused=!0,w(`audioStop`,{audioId:this._audioId})}seek(e){w(`audioSeek`,{audioId:this._audioId,position:Number(e)||0})}destroy(){w(`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 As(){return new ks}var js=t({chooseImage:()=>Rs,chooseMessageFile:()=>zs,compressImage:()=>Ls,createImage:()=>Ms,getImageInfo:()=>Fs,previewImage:()=>Ps,previewMedia:()=>Is,saveImageToPhotosAlbum:()=>Ns});function Ms(){return _o()}function Ns(e){return w(`saveImageToPhotosAlbum`,e)}function Ps(e){return w(`previewImage`,e)}function Fs(e){return w(`getImageInfo`,e)}function Is(e){return w(`previewMedia`,e)}function Ls(e){return w(`compressImage`,e)}function Rs(e){return w(`chooseImage`,e)}function zs(e){return w(`chooseMessageFile`,e)}var Bs=t({chooseMedia:()=>Us,chooseVideo:()=>Hs,compressVideo:()=>Ks,createVideoContext:()=>Vs,getVideoInfo:()=>Ws,saveVideoToPhotosAlbum:()=>Gs});function Vs(e,t){return new qs({videoId:e,obj:t})}function Hs(e){return w(`chooseVideo`,e)}function Us(e){return w(`chooseMedia`,e)}function Ws(e){return w(`getVideoInfo`,e)}function Gs(e){return w(`saveVideoToPhotosAlbum`,e)}function Ks(e){return w(`compressVideo`,e)}var qs=class{constructor(e){this.opts=e}play(){this.invoke(`play`)}pause(){this.invoke(`pause`)}stop(){this.invoke(`stop`)}seek(e){this.invoke(`seek`,{position:e})}playbackRate(e){this.invoke(`playbackRate`,{rate:e})}requestFullScreen(e={}){this.invoke(`requestFullScreen`,e)}exitFullScreen(){this.invoke(`exitFullScreen`)}requestBackgroundPlayback(e={}){this.invoke(`requestBackgroundPlayback`,e)}exitBackgroundPlayback(){this.invoke(`exitBackgroundPlayback`)}exitPictureInPicture(e={}){this.invoke(`exitPictureInPicture`,e)}showStatusBar(){this.invoke(`showStatusBar`)}hideStatusBar(){this.invoke(`hideStatusBar`)}invoke(e,t={}){w(`videoContext`,{type:`native/video`,id:this.opts.videoId,command:e,...t},`render`)}},Js=t({exitMiniProgram:()=>Qs,navigateBackMiniProgram:()=>Zs,navigateToMiniProgram:()=>Xs,restartMiniProgram:()=>Ys});function Ys(e){return w(`restartMiniProgram`,e)}function Xs(e){return w(`navigateToMiniProgram`,e)}function Zs(e){return w(`navigateBackMiniProgram`,e)}function Qs(e){return w(`exitMiniProgram`,e)}var $s=t({downloadFile:()=>ec});function ec(e){return w(`downloadFile`,e)}var tc=t({offLocalServiceDiscoveryStop:()=>lc,offLocalServiceFound:()=>dc,offLocalServiceLost:()=>pc,offLocalServiceResolveFail:()=>hc,onLocalServiceDiscoveryStop:()=>cc,onLocalServiceFound:()=>uc,onLocalServiceLost:()=>fc,onLocalServiceResolveFail:()=>mc,startLocalServiceDiscovery:()=>oc,stopLocalServiceDiscovery:()=>sc}),nc=A(`onLocalServiceDiscoveryStop`,`offLocalServiceDiscoveryStop`),rc=A(`onLocalServiceFound`,`offLocalServiceFound`),ic=A(`onLocalServiceLost`,`offLocalServiceLost`),ac=A(`onLocalServiceResolveFail`,`offLocalServiceResolveFail`);function oc(e={}){return w(`startLocalServiceDiscovery`,e)}function sc(e={}){return w(`stopLocalServiceDiscovery`,e)}function cc(e){return nc.on(e)}function lc(e){return nc.off(e)}function uc(e){return rc.on(e)}function dc(e){return rc.off(e)}function fc(e){return ic.on(e)}function pc(e){return ic.off(e)}function mc(e){return ac.on(e)}function hc(e){return ac.off(e)}var gc=t({request:()=>_c});function _c(e){return w(`request`,e)}var vc=t({createTCPSocket:()=>bc}),yc=class{constructor(e){this.socketId=e,this.events={bindWifi:A(`TCPSocket.onBindWifi`,`TCPSocket.offBindWifi`,{socketId:e}),close:A(`TCPSocket.onClose`,`TCPSocket.offClose`,{socketId:e}),connect:A(`TCPSocket.onConnect`,`TCPSocket.offConnect`,{socketId:e}),error:A(`TCPSocket.onError`,`TCPSocket.offError`,{socketId:e}),message:A(`TCPSocket.onMessage`,`TCPSocket.offMessage`,{socketId:e},mi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bindWifi(e={}){return k(`TCPSocket.bindWifi`,this.socketId,e)}close(){let e=k(`TCPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return k(`TCPSocket.connect`,this.socketId,e)}write(e){return k(`TCPSocket.write`,this.socketId,{data:pi(e)})}onBindWifi(e){return this.events.bindWifi.on(e)}offBindWifi(e){return this.events.bindWifi.off(e)}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onConnect(e){return this.events.connect.on(e)}offConnect(e){return this.events.connect.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}};function bc(){return new yc(hi(`tcp`))}var xc=t({createUDPSocket:()=>Cc}),Sc=class{constructor(e){this.socketId=e,this.events={close:A(`UDPSocket.onClose`,`UDPSocket.offClose`,{socketId:e}),error:A(`UDPSocket.onError`,`UDPSocket.offError`,{socketId:e}),listening:A(`UDPSocket.onListening`,`UDPSocket.offListening`,{socketId:e}),message:A(`UDPSocket.onMessage`,`UDPSocket.offMessage`,{socketId:e},mi)},this.events.close.setAfterEmit(()=>{for(let e of Object.values(this.events))e.dispose()})}bind(e=0){return k(`UDPSocket.bind`,this.socketId,{port:e})}close(){let e=k(`UDPSocket.close`,this.socketId);for(let[e,t]of Object.entries(this.events))(e!==`close`||!t.hasListeners())&&t.dispose();return e}connect(e={}){return k(`UDPSocket.connect`,this.socketId,e)}send(e={}){return this.sendWithName(`UDPSocket.send`,e)}write(e={}){return this.sendWithName(`UDPSocket.write`,e)}setTTL(e){return k(`UDPSocket.setTTL`,this.socketId,{ttl:e})}onClose(e){return this.events.close.on(e)}offClose(e){return this.events.close.off(e)}onError(e){return this.events.error.on(e)}offError(e){return this.events.error.off(e)}onListening(e){return this.events.listening.on(e)}offListening(e){return this.events.listening.off(e)}onMessage(e){return this.events.message.on(e)}offMessage(e){return this.events.message.off(e)}sendWithName(e,t){return k(e,this.socketId,{...t,message:pi(t.message)})}};function Cc(){return new Sc(hi(`udp`))}var wc=t({uploadFile:()=>Oc}),Tc=1;function Ec(){return`upload_${Date.now()}_${Tc++}`}function Dc(){let e=[];return{add(t){typeof t==`function`&&e.push(t)},remove(t){e=typeof t==`function`?e.filter(e=>e!==t):[]},dispatch(t){for(let n of e.slice())n(t)}}}function Oc(e={}){let t=Ec(),n=Dc(),r=Dc(),i=v.store(e=>n.dispatch(e),!0,`${t}_progress`),a=v.store(e=>r.dispatch(e),!0,`${t}_headers`),o=e.complete,s=!1,c=e=>{s||(s=!0,v.remove(i),v.remove(a),n.remove(),r.remove(),typeof o==`function`&&o(e))};try{w(`uploadFile`,{...e,uploadId:t,progress:i,headersReceived:a,complete:c})}catch(e){throw c({errMsg:`uploadFile:fail ${e&&e.message?e.message:e}`}),e}return{abort(){s||w(`uploadFileAbort`,{uploadId:t})},onProgressUpdate(e){n.add(e)},offProgressUpdate(e){n.remove(e)},onHeadersReceived(e){r.add(e)},offHeadersReceived(e){r.remove(e)}}}var kc=t({closeSocket:()=>gl,connectSocket:()=>ml,onSocketClose:()=>wl,onSocketError:()=>Cl,onSocketMessage:()=>Sl,onSocketOpen:()=>xl,sendSocketMessage:()=>hl}),Ac=0,jc=1,Mc=3,Nc=5,Pc=/^wss:\/\/.*/i,Fc={open:[`header`,`profile`],message:[`data`],error:[`errMsg`],close:[`code`,`reason`]},Ic={...Fc,open:[`header`]};function Lc(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`?{data:di(e),isBuffer:!0}:{data:e}}function Rc(e,t){let n=Lc(t);return e.data=n.data,n.isBuffer?e.isBuffer=!0:delete e.isBuffer,e}function zc(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n];t[n]=typeof r==`string`?r:typeof r==`number`?String(r):Object.prototype.toString.apply(r)}return t}function Bc(e,t){let n={};if(!e||typeof e!=`object`)return n;for(let r of t)r in e&&(n[r]=e[r]);return n}function Vc(e){let t=Bc(e,Fc.message);return e&&typeof e==`object`&&e.isBuffer&&(t.data=fi(e.data)),t}function Hc(e){return Number.isFinite(e)?e:1e3}function Uc(e){return Number.isFinite(e)&&e>=1?e:0}function Wc(e){return Object.prototype.toString.call(e).slice(8,-1)}function Gc(e){return!!e&&typeof e==`object`}function Kc(e){return Object.prototype.hasOwnProperty.call(e,`success`)||Object.prototype.hasOwnProperty.call(e,`fail`)||Object.prototype.hasOwnProperty.call(e,`complete`)}function qc(e,t){n(e.fail)&&e.fail(t),n(e.complete)&&e.complete(t)}function Jc(e){return Bc(e,[`errMsg`])}function Yc(){let e;function t(t){return e=Jc(t),e}return{settle:t,wrap(n,r){return n===`complete`?n=>r(e??t(n)):e=>r(t(e))}}}function Xc(e,t,r){for(let i of[`success`,`fail`,`complete`])n(t[i])&&(e[i]=r.wrap(i,t[i]))}var Zc=new Set,X,Qc={open:void 0,message:void 0,error:void 0,close:void 0},$c=[],el=!1;function tl(){el=!1;let e=$c.splice(0,$c.length);for(let t of e)t()}function nl(e,{defer:t=!1}={}){if(!t&&$c.length===0){e();return}$c.push(e),!el&&(el=!0,setTimeout(tl,0))}function rl(e,t,r){let i=Qc[t];if(!e||!n(i))return;let a=t===`message`?r:Bc(r,Ic[t]);N(void 0,[i],[a],`wx.onSocket-${t}`,!1)}function il(e,t,r,i){let a=new Set,o,s=!1;function c(e){if(!o)return;let n=o;e&&w(t,{...r,callback:n,keep:!0}),o=void 0,v.remove(n)}return{add(e){return!n(e)||a.has(e)?!1:(a.add(e),!0)},remove(e){a.delete(e)},activate(){if(o||s)return;let t=v.store(e=>i(e,[...a]),!0);o=t;try{w(e,{...r,callback:t,keep:!0})}catch(e){throw o=void 0,v.remove(t),e}},rollback(){c(!0)},seal(){c(!1),a.clear(),s=!0}}}var al=new WeakMap,ol=Symbol(`SocketTask constructor token`);function Z(e){let t=al.get(e);if(!t)throw TypeError(`Illegal invocation`);return t}function sl(e){if(Zc.delete(e.task),!e.terminal){e.terminal=!0;for(let t of Object.values(e.events))t.seal()}}function cl(e){e.connectionState=Mc,e.terminalEvent=!0}function ll(e){cl(e),sl(e)}function ul(e){if(e.activated||e.terminal)return;e.activated=!0;let t=[];try{for(let n of Object.values(e.events)){if(e.terminal)break;n.activate(),t.push(n)}}catch(n){e.activated=!1;for(let e of t.reverse())try{e.rollback()}catch{}throw n}}function dl(e,t,n){let r=Z(e),i=r.events[t];if(!r.terminal&&i.add(n))try{r.activated||ul(r)}catch(e){throw i.remove(n),e}}function fl(e,t,n){N(void 0,t,[n],`SocketTask.${e}`,!1)}var pl=class{constructor(e,t){if(e!==ol)throw TypeError(`Illegal constructor`);let n=this,r={task:n,socketId:t,connectionState:Ac,opened:!1,terminalEvent:!1,terminal:!1,activated:!1,events:{}};r.events={open:il(`onSocketOpen`,`offSocketOpen`,{socketId:t},(e,t)=>{r.connectionState=jc,r.opened=!0;let i=n===X;nl(()=>{fl(`onOpen`,t,Bc(e,Fc.open)),rl(i,`open`,e)})}),message:il(`onSocketMessage`,`offSocketMessage`,{socketId:t},(e,t)=>{let r=n===X,i=Vc(e);nl(()=>{fl(`onMessage`,t,i),rl(r,`message`,i)})}),error:il(`onSocketError`,`offSocketError`,{socketId:t},(e,t)=>{let i=n===X;r.opened?cl(r):ll(r),nl(()=>{fl(`onError`,t,Bc(e,Fc.error)),rl(i,`error`,e)},{defer:!0})}),close:il(`onSocketClose`,`offSocketClose`,{socketId:t},(e,t)=>{let i=n===X;ll(r),nl(()=>{fl(`onClose`,t,Bc(e,Fc.close)),rl(i,`close`,e)})})},al.set(this,r)}send(e={}){let t=Z(this),n=Gc(e)?e:{};if(t.connectionState!==jc){qc(n,{errMsg:`SocketTask.send:fail WebSocket is not connected`});return}let r=Rc({socketId:t.socketId},n.data);Xc(r,n,Yc()),mt(`sendSocketMessage`,r)}close(e={}){let t=Z(this),n=Gc(e)?e:{},r={socketId:t.socketId,code:Hc(n.code)};n.reason!==void 0&&(r.reason=n.reason),Xc(r,n,Yc()),mt(`closeSocket`,r)}onOpen(e){dl(this,`open`,e)}onMessage(e){dl(this,`message`,e)}onError(e){dl(this,`error`,e)}onClose(e){dl(this,`close`,e)}};function ml(e){if(!Gc(e))return;let{url:t}=e;if(typeof t!=`string`){qc(e,{errMsg:`connectSocket:fail parameter error: parameter.url should be String instead of ${Wc(t)};`});return}if(!Pc.test(t)){qc(e,{errMsg:`connectSocket:fail invalid url "${t}"`});return}let r=`socket_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,i=new pl(ol,r),a=Z(i),o=X;if((!X||Z(X).connectionState===Mc)&&(X=i),Zc.size>=Nc)return a.connectionState=Mc,sl(a),qc(e,{errMsg:`connectSocket:fail fail reach max websocket connect count ${Nc}`}),i;Zc.add(i);let s=Yc(),c,l;try{let i=e.timeout;c={socketId:r,url:t,timeout:Uc(i)};let a=e.header;a!==void 0&&typeof a==`object`&&(c.header=a?zc(a):{});for(let t of[`protocols`,`tcpNoDelay`,`perMessageDeflate`,`forceCellularNetwork`]){let n=e[t];n!==void 0&&(c[t]=n)}let o=e.success;l=e.fail;let u=e.complete;n(o)&&(c.success=s.wrap(`success`,o)),n(u)&&(c.complete=s.wrap(`complete`,u))}catch(e){throw ll(a),X===i&&(X=o),e}c.fail=e=>{ll(a);let t=s.settle(e);n(l)&&l(t)};let u=!1;try{w(`connectSocket`,c),u=!0,ul(a)}catch(t){if(u)try{mt(`closeSocket`,{socketId:r,code:1e3})}catch{}ll(a),X===i&&(X=o),qc(e,{errMsg:`connectSocket:fail ${t?.message??t}`});return}return i}function hl(e){let t=Gc(e)?e:{},n=Kc(t);return!X||Z(X).connectionState!==jc?yl(`sendSocketMessage:fail WebSocket is not connected`,t,n):vl(`sendSocketMessage`,Rc({socketId:Z(X).socketId},t.data),t,n)}function gl(e){let t=Gc(e)?e:{},n=Kc(t),r;if(X&&Z(X).connectionState===jc){let e=Z(X),i=_l(e);try{let a=Hc(t.code),o=t.reason,s={socketId:e.socketId,code:a};o!==void 0&&(s.reason=o),r=vl(`closeSocket`,s,t,n,i)}catch(e){throw i(),e}}else r=yl(`closeSocket:fail WebSocket is not connected`,t,n);return r}function _l(e){let t=e.connectionState;return e.connectionState=Mc,()=>{e.terminalEvent||(e.connectionState=t)}}function vl(e,t,r,i,a){if(!i)return w(e,t).then(e=>Jc(e),e=>{throw a?.(e),Jc(e)});let o=Yc();for(let e of[`success`,`complete`])Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=n(r[e])?o.wrap(e,r[e]):void 0);let s=n(r.fail)?r.fail:void 0;a||s?t.fail=e=>{a?.(e);let t=o.settle(e);s?.(t)}:Object.prototype.hasOwnProperty.call(r,`fail`)&&(t.fail=void 0);try{w(e,t)}catch(e){throw a?.(e),e}}function yl(e,t,n){let r={errMsg:e};if(!n)return new Promise((e,t)=>t(r));qc(t,r)}function bl(e,t){n(t)&&(Qc[e]=t)}function xl(e){bl(`open`,e)}function Sl(e){bl(`message`,e)}function Cl(e){bl(`error`,e)}function wl(e){bl(`close`,e)}var Tl=t({getAccountInfoSync:()=>El});function El(){return w(`getAccountInfoSync`)}var Dl=t({authorize:()=>Ol});function Ol(e){return w(`authorize`,e)}var kl=t({login:()=>Al});function Al(e){return w(`login`,e)}var jl=t({login:()=>Ml});function Ml(e){return w(`login`,e)}var Nl=t({getPrivacySetting:()=>Pl});function Pl(e){return w(`getPrivacySetting`,e)}var Fl=t({getSetting:()=>Ll,openSetting:()=>Il});function Il(e){return w(`openSetting`,e)}function Ll(e){return w(`getSetting`,e)}var Rl=t({getUserInfo:()=>zl});function zl(e){return w(`getUserInfo`,e)}var Bl=t({requestPayment:()=>Vl});function Vl(e){return w(`requestPayment`,e)}var Hl=t({hideShareMenu:()=>Gl,showShareImageMenu:()=>Wl,showShareMenu:()=>Ul});function Ul(e){return w(`shareShareMenu`,e)}function Wl(e){return w(`showShareImageMenu`,e)}function Gl(e){return w(`hideShareMenu`,e)}var Kl=t({clearStorage:()=>eu,clearStorageSync:()=>Xl,getStorage:()=>Ql,getStorageInfo:()=>nu,getStorageInfoSync:()=>tu,getStorageSync:()=>Jl,removeStorage:()=>$l,removeStorageSync:()=>Yl,setStorage:()=>Zl,setStorageSync:()=>ql});function ql(...e){return w(`setStorageSync`,e)}function Jl(e){return w(`getStorageSync`,e)}function Yl(e){return w(`removeStorageSync`,e)}function Xl(){return w(`clearStorageSync`)}function Zl(e){return w(`setStorage`,e)}function Ql(e){return w(`getStorage`,e)}function $l(e){return w(`removeStorage`,e)}function eu(){return w(`clearStorage`)}function tu(){return w(`getStorageInfoSync`)}function nu(e){return w(`getStorageInfo`,e)}var ru=t({createAnimation:()=>iu});function iu(e={}){return new au(e)}var au=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`,re(e)]}),this}height(e){return this.currentStepAnimates.push({type:`style`,args:[`height`,re(e)]}),this}left(e){return this.currentStepAnimates.push({type:`style`,args:[`left`,re(e)]}),this}matrix(e=1,t=0,n=0,r=1,i=1,a=1){return this.currentStepAnimates.push({type:`matrix`,args:[e,t,n,r,i,a]}),this}matrix3d(e=1,t=0,n=0,r=0,i=0,a=1,o=0,s=0,c=0,l=0,u=1,d=0,f=0,p=0,m=0,h=1){return this.currentStepAnimates.push({type:`matrix3d`,args:[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}),this}opacity(e){return this.currentStepAnimates.push({type:`style`,args:[`opacity`,e]}),this}right(e){return this.currentStepAnimates.push({type:`style`,args:[`right`,re(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`,re(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`,re(e)]}),this}},ou=t({setBackgroundColor:()=>cu,setBackgroundTextStyle:()=>su});function su(e){return w(`setBackgroundTextStyle`,e)}function cu(e){return w(`setBackgroundColor`,e)}var lu=`10px sans-serif`;function uu(){return{lineDash:[0,0],lineDashOffset:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:`#000000`,font:lu,fontSize:10,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`}}function du(e){if(Array.isArray(e))return e.map(du);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e))t[n]=du(e[n]);return t}return e}function fu(e){return Array.isArray(e)?e.some(fu):typeof e==`object`&&e?Object.values(e).some(fu):e===void 0||typeof e==`number`&&!Number.isFinite(e)}function Q(e){return e.some(fu)}var pu=class{constructor(e=``,t=null){this.canvasId=e,this.moduleId=t,this.actions=[],this.path=[],this.state=uu(),this.drawingState=[],this._transform={a:1,b:0,c:0,d:1,e:0,f:0}}pushAction(e,...t){return Q(t)||this.actions.push({type:e,args:t}),this}getActions(){let e=this.actions.map(du).filter(e=>!Q(e.args));return this.actions=[],this.path=[],e}clearActions(){this.actions=[],this.path=[]}pushPathAction(e,...t){return Q(t)||this.path.push({type:e,args:t}),this}pushPathSnapshot(e){return this.pushAction(e,this.path.map(du))}draw(e=!1,t){let n=t;n!=null&&typeof n!=`function`&&(console.warn(`CanvasContext.draw callback is not a function, got ${typeof n}`),n=void 0);let r=this.getActions();this.canvasId&&w(`drawCanvas`,{canvasId:this.canvasId,moduleId:this.moduleId,actions:r,reserve:e,complete:n},`render`)}beginPath(){return this.path=[],this}closePath(){return this.pushPathAction(`closePath`)}moveTo(e,t){return this.pushPathAction(`moveTo`,e,t)}lineTo(e,t){return this.pushPathAction(this.path.length===0?`moveTo`:`lineTo`,e,t)}rect(e,t,n,r){return this.pushPathAction(`rect`,e,t,n,r)}arcTo(e,t,n,r,i){return this.pushPathAction(`arcTo`,e,t,n,r,i)}quadraticCurveTo(e,t,n,r){return this.pushPathAction(`quadraticCurveTo`,e,t,n,r)}bezierCurveTo(e,t,n,r,i,a){return this.pushPathAction(`bezierCurveTo`,e,t,n,r,i,a)}arc(e,t,n,r,i,a=!1){return this.pushPathAction(`arc`,e,t,n,r,i,a)}fill(){return this.pushPathSnapshot(`fillPath`)}stroke(){return this.pushPathSnapshot(`strokePath`)}clip(){return this.pushPathSnapshot(`clip`)}clearRect(e,t,n,r){return this.pushAction(`clearRect`,e,t,n,r)}fillRect(e,t,n,r){return this.pushAction(`fillPath`,[{type:`rect`,args:[e,t,n,r]}])}strokeRect(e,t,n,r){return this.pushAction(`strokePath`,[{type:`rect`,args:[e,t,n,r]}])}fillText(e,t,n,r){return this._pushText(`fillText`,e,t,n,r)}strokeText(e,t,n,r){return this._pushText(`strokeText`,e,t,n,r)}_pushText(e,t,n,r,i){if(i!=null){let a=Number(i);if(Number.isFinite(a))return this.pushAction(e,String(t),n,r,a)}return this.pushAction(e,String(t),n,r)}drawImage(e,...t){let n=da(e),[r,i,a,o,s,c,l,u]=t;u===void 0&&([s,c,l,u]=[r,i,a,o],r=void 0,i=void 0,a=void 0,o=void 0);let d=e=>Number.isFinite(e);return d(r)&&d(i)&&d(a)&&d(o)?this.pushAction(`drawImage`,n,r,i,a,o,s,c,l,u):d(l)&&d(u)?this.pushAction(`drawImage`,n,s,c,l,u):this.pushAction(`drawImage`,n,s,c)}rotate(e){return this.pushAction(`rotate`,e)}translate(e,t){return this.pushAction(`translate`,e,t)}scale(e,t){if(Q([e,t]))return this;let n=this._transform;return this._transform={a:n.a*e,b:n.b*e,c:n.c*t,d:n.d*t,e:n.e,f:n.f},this.pushAction(`scale`,e,t)}transform(e,t,n,r,i,a){if(Q([e,t,n,r,i,a]))return this;let o=this._transform;return this._transform={a:e*o.a+t*o.c,b:e*o.b+t*o.d,c:n*o.a+r*o.c,d:n*o.b+r*o.d,e:i*o.a+a*o.c+o.e,f:i*o.b+a*o.d+o.f},this.pushAction(`transform`,e,t,n,r,i,a)}setTransform(e,t,n,r,i,a){return Q([e,t,n,r,i,a])?this:(this._transform={a:e,b:t,c:n,d:r,e:i,f:a},this.pushAction(`setTransform`,e,t,n,r,i,a))}getTransform(){return this._transform}save(){return this.drawingState.push(this.state),this.pushAction(`save`)}restore(){return this.state=this.drawingState.pop()||uu(),this.pushAction(`restore`)}setFillStyle(e){return this.pushAction(`setFillStyle`,ha(e))}setStrokeStyle(e){return this.pushAction(`setStrokeStyle`,ha(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)}setTextAlign(e){return this.pushAction(`setTextAlign`,e)}setTextBaseline(e){return this.pushAction(`setTextBaseline`,e)}setShadow(e,t,n,r){return Q([e,t,n])?this:(this.state.shadowOffsetX=e,this.state.shadowOffsetY=t,this.state.shadowBlur=n,this.state.shadowColor=r,this.pushAction(`setShadow`,e,t,n,r))}setFontSize(e){let t=Number(e);return Number.isFinite(t)?(this.state.font=_a(this.state.font,t),this.state.fontSize=t,this.pushAction(`setFontSize`,t)):this}setLineDash(e,t){let n=Array.isArray(e)&&e.length?e:[0,0],r=t??0;return Q([n,r])?this:(this.state.lineDash=n,this.state.lineDashOffset=r,this.pushAction(`setLineDash`,n,r))}getLineDash(){return this.state.lineDash}set fillStyle(e){this.setFillStyle(e)}set strokeStyle(e){this.setStrokeStyle(e)}set globalAlpha(e){this.setGlobalAlpha(e)}set lineCap(e){this.setLineCap(e)}set lineJoin(e){this.setLineJoin(e)}set lineWidth(e){this.setLineWidth(e)}set miterLimit(e){this.setMiterLimit(e)}set textAlign(e){this.setTextAlign(e)}set textBaseline(e){this.setTextBaseline(e)}set globalCompositeOperation(e){this.pushAction(`setGlobalCompositeOperation`,e)}set lineDashOffset(e){Q([e])||(this.state.lineDashOffset=e,this.pushAction(`setLineDashOffset`,e))}set shadowBlur(e){Q([e])||(this.state.shadowBlur=e,this.pushAction(`setShadowBlur`,e))}set shadowColor(e){this.state.shadowColor=e,this.pushAction(`setShadowColor`,e)}set shadowOffsetX(e){Q([e])||(this.state.shadowOffsetX=e,this.pushAction(`setShadowOffsetX`,e))}set shadowOffsetY(e){Q([e])||(this.state.shadowOffsetY=e,this.pushAction(`setShadowOffsetY`,e))}set font(e){this.state.font=e;let t=ga(e);if(!t){console.warn(`Failed to set 'font' on 'CanvasContext': invalid format.`);return}this.state.fontStyle=t.fontStyle,this.state.fontWeight=t.fontWeight,this.state.fontSize=t.fontSize,this.state.fontFamily=t.fontFamily,this.pushAction(`setFont`,t.font)}get font(){return this.state.font}createLinearGradient(e,t,n,r){return fa(e,t,n,r)}createCircularGradient(e,t,n){return pa(e,t,n)}createPattern(e,t){return ma(e,t)}measureText(e){return this._measureContext===void 0&&(this._measureContext=va()),{width:ya(this._measureContext,e,this.state.font,this.state.fontSize)}}},mu=t({canvasGetImageData:()=>yu,canvasPutImageData:()=>bu,canvasToTempFilePath:()=>vu,createCanvas:()=>go,createCanvasContext:()=>gu,createContext:()=>hu,createOffscreenCanvas:()=>ho,drawCanvas:()=>_u});function hu(){return new pu}function gu(e,t){return new pu(e,Tu(t))}function _u(e={}){let t={...e,moduleId:e.moduleId||Tu(e.component)};delete t.component,Array.isArray(t.actions)&&(t.actions=t.actions.filter(e=>!e||typeof e!=`object`?!1:e.args===void 0||Array.isArray(e.args)&&!Q(e.args))),w(`drawCanvas`,t,`render`)}function vu(e={},t){let n=xu(e,t);delete n.pixelRatio;let r=Number(b.getSystemInfo()?.pixelRatio);Number.isFinite(r)&&r>0&&(n.pixelRatio=r);for(let e of[`x`,`y`,`width`,`height`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&delete n[e];for(let e of[`destWidth`,`destHeight`])typeof n[e]==`number`&&!Number.isFinite(n[e])&&(delete n[e],$(n,`${e} must be finite`));return w(`canvasToTempFilePath`,n,`render`)}function yu(e={},t){let n=e.success,r=e.complete,i=xu(e,t);Su(i,`x`),Su(i,`y`),Cu(i,`width`),Cu(i,`height`);let a=pe(i.width,i.height,{transferable:!0});a&&$(i,a),typeof n==`function`&&(i.success=e=>n(wu(e))),typeof r==`function`&&(i.complete=e=>r(wu(e)));let o=w(`canvasGetImageData`,i,`render`);return o?.then?o.then(wu):o}function bu(e={},t){let n=xu(e,t);Su(n,`x`),Su(n,`y`),(typeof n.width!=`number`||!Number.isFinite(n.width))&&$(n,`invalid width argument`),Object.prototype.toString.call(n.data)!==`[object Uint8ClampedArray]`&&$(n,`data argument must be an Uint8ClampedArray`);let r=n.data?.length,i=typeof n.height==`number`?n.height:Math.floor(r/n.width/4);n.height=i,(!Number.isFinite(i)||n.width*i*4!==r)&&$(n,`invalid data format`);let a=pe(n.width,i,{transferable:!0});return a&&$(n,a),n.canvasValidationError||(n.data=Array.from(n.data)),w(`canvasPutImageData`,n,`render`)}function xu(e,t){let n={...e,moduleId:e.moduleId||Tu(t||e.component)};return delete n.component,n}function Su(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n}function Cu(e,t){let n=Number(e[t])||0;if(!Number.isFinite(n)){$(e,`${t} must be finite`),e[t]=0;return}e[t]=n,n===0&&$(e,`the source ${t} is 0`)}function $(e,t){e.canvasValidationError||=t}function wu(e){let t=Array.isArray(e)&&e.length===1?e[0]:e;return!t||!Object.prototype.hasOwnProperty.call(t,`data`)||t.data instanceof Uint8ClampedArray?t:{...t,data:new Uint8ClampedArray(t.data)}}function Tu(e){return e?.__id__||C.getPageInfo()?.id}var Eu=t({nextTick:()=>Au}),Du=[],Ou=null;function ku(){let e=Du;Du=[],Ou=null;for(let t=0;t<e.length;t++)e[t]()}function Au(e){n(e)&&(Du.push(e),Ou||=setTimeout(ku,0))}var ju=t({disableAlertBeforeUnload:()=>zu,enableAlertBeforeUnload:()=>Ru,hideLoading:()=>Lu,hideToast:()=>Nu,showActionSheet:()=>Iu,showLoading:()=>Fu,showModal:()=>Pu,showToast:()=>Mu});function Mu(e){return w(`showToast`,e)}function Nu(e){return w(`hideToast`,e)}function Pu(e){return w(`showModal`,e)}function Fu(e){return w(`showLoading`,e)}function Iu(e){return w(`showActionSheet`,e)}function Lu(e){return w(`hideLoading`,e)}function Ru(e){return w(`enableAlertBeforeUnload`,e)}function zu(e){return w(`disableAlertBeforeUnload`,e)}var Bu=t({getMenuButtonBoundingClientRect:()=>Hu,offMenuButtonBoundingClientRectWeightChange:()=>Wu,onMenuButtonBoundingClientRectWeightChange:()=>Uu}),Vu=new Set;b.onUpdate(e=>{e.menuRect&&Vu.forEach(t=>t(e.menuRect))});function Hu(){return w(`getMenuButtonBoundingClientRect`)}function Uu(e){n(e)&&Vu.add(e)}function Wu(e){n(e)?Vu.delete(e):Vu.clear()}var Gu=t({hideHomeButton:()=>Xu,hideNavigationBarLoading:()=>Yu,setNavigationBarColor:()=>Ju,setNavigationBarTitle:()=>qu,showNavigationBarLoading:()=>Ku});function Ku(e){return w(`showNavigationBarLoading`,e)}function qu(e){return w(`setNavigationBarTitle`,e)}function Ju(e){return w(`setNavigationBarColor`,e)}function Yu(e){return w(`hideNavigationBarLoading`,e)}function Xu(e){return w(`hideHomeButton`,e)}var Zu=t({startPullDownRefresh:()=>$u,stopPullDownRefresh:()=>Qu});function Qu(e){return w(`stopPullDownRefresh`,e)}function $u(e){return w(`startPullDownRefresh`,e)}var ed=t({pageScrollTo:()=>td});function td(e){return w(`pageScrollTo`,e)}var nd=t({hideTabBar:()=>od,hideTabBarRedDot:()=>ud,removeTabBarBadge:()=>cd,setTabBarBadge:()=>sd,setTabBarItem:()=>id,setTabBarStyle:()=>rd,showTabBar:()=>ad,showTabBarRedDot:()=>ld});function rd(e){return w(`setTabBarStyle`,e)}function id(e){return w(`setTabBarItem`,e)}function ad(e){return w(`showTabBar`,e)}function od(e){return w(`hideTabBar`,e)}function sd(e){return w(`setTabBarBadge`,e)}function cd(e){return w(`removeTabBarBadge`,e)}function ld(e){return w(`showTabBarRedDot`,e)}function ud(e){return w(`hideTabBarRedDot`,e)}var dd=t({onWindowResize:()=>fd});function fd(e){e&&w(`onWindowResize`,{success:e})}var pd=Object.assign({"./core/base/app-event/index.js":xt,"./core/base/index.js":hn,"./core/base/performance/index.js":bn,"./core/base/subpackage/index.js":Tn,"./core/base/system/index.js":On,"./core/base/update/index.js":Bn,"./core/camera/index.js":Jn,"./core/data-analysis/index.js":Zn,"./core/device/bluetooth/index.js":mr,"./core/device/bluetooth-ble/index.js":Ar,"./core/device/clipboard/index.js":Xr,"./core/device/contact/index.js":$r,"./core/device/keyboard/index.js":ni,"./core/device/memory/index.js":ii,"./core/device/network/index.js":gi,"./core/device/phone/index.js":xi,"./core/device/scan/index.js":Ci,"./core/device/screen/index.js":Ti,"./core/device/touch/index.js":Pi,"./core/device/vibrate/index.js":Ui,"./core/ext/index.js":Ki,"./core/file/index.js":rn,"./core/life-cycle/index.js":ms,"./core/location/index.js":_s,"./core/map/index.js":ws,"./core/media/audio/index.js":Ds,"./core/media/image/index.js":js,"./core/media/video/index.js":Bs,"./core/navigate/index.js":Js,"./core/network/download/index.js":$s,"./core/network/mdns/index.js":tc,"./core/network/request/index.js":gc,"./core/network/tcp/index.js":vc,"./core/network/udp/index.js":xc,"./core/network/upload/index.js":wc,"./core/network/websocket/index.js":kc,"./core/open-api/account-info/index.js":Tl,"./core/open-api/authorize/index.js":Dl,"./core/open-api/index.js":kl,"./core/open-api/login/index.js":jl,"./core/open-api/privacy/index.js":Nl,"./core/open-api/setting/index.js":Fl,"./core/open-api/user-info/index.js":Rl,"./core/payment/index.js":Bl,"./core/route/index.js":ht,"./core/share/index.js":Hl,"./core/storage/index.js":Kl,"./core/ui/animation/index.js":ru,"./core/ui/background/index.js":ou,"./core/ui/canvas/index.js":mu,"./core/ui/custom-component/index.js":Eu,"./core/ui/interaction/index.js":ju,"./core/ui/menu/index.js":Bu,"./core/ui/navigation-bar/index.js":Gu,"./core/ui/pull-down-refresh/index.js":Zu,"./core/ui/scroll/index.js":ed,"./core/ui/tab-bar/index.js":nd,"./core/ui/window/index.js":dd,"./core/wxml/intersection-observer/index.js":Do,"./core/wxml/media-query-observer/index.js":Ao,"./core/wxml/selector-query/index.js":bo}),md={},hd=new Set([`SocketTask`,`readyState`,`offSocketOpen`,`offSocketMessage`,`offSocketError`,`offSocketClose`,`onUnhandledRejection`,`onPageNotFound`,`onAppRoute`]);for(let e of Object.values(pd))for(let[t,n]of Object.entries(e))md[t]=n;function gd(e){for(let t of e||[])typeof t!=`string`||hd.has(t)||Object.prototype.hasOwnProperty.call(md,t)||t in Object.prototype||Object.defineProperty(md,t,{value:(...e)=>w(t,...e),writable:!0,enumerable:!0,configurable:!0})}var _d=new Proxy(md,{get(e,t,n){return hd.has(t)?void 0:Reflect.get(e,t,n)},set(e,t,n,r){return Reflect.set(e,t,n,r)}}),vd=new class{constructor(){this.init()}init(){globalThis.__diminaReportError=x,Xe();let e=globalThis.__diminaApiNamespaces||[],t=globalThis.__diminaRegisteredApis||[];if(globalThis.name)try{let n=JSON.parse(globalThis.name);e.length===0&&(e=n.apiNamespaces||[]),t.length===0&&(t=n.registeredApis||[])}catch{}gd(t);for(let t of[`dd`,`wx`,...e])globalThis[t]=_d;globalThis.modRequire=_,globalThis.modDefine=ce,globalThis.global={},globalThis.App=(e={})=>{J.createAppModule(e),Y.createApp()},globalThis.Page=e=>{J.createModule(e,globalThis.__extraInfo,q.type)},globalThis.Component=e=>{J.createModule(e,globalThis.__extraInfo,K.type)},globalThis.Behavior=e=>e,globalThis.getApp=e=>Y.getApp(e),globalThis.getCurrentPages=()=>C.stack()}},yd={navigateBack:bt,navigateTo:yt,reLaunch:_t,redirectTo:vt,switchTab:gt};return new class{constructor(){console.log(`[service] init`),this.env=vd,this.message=S,this.init()}init(){this.message.on(`loadResource`,e=>{let{appId:t,bridgeId:n,pagePath:r,root:i=`.`,baseUrl:a=`/`,hostEnv:o,query:s,resourceLoadId:c,runtimeType:l,scene:u,referrerInfo:d}=e;o&&b.init(o),Y.setRuntimeType(l),Y.setAppLaunchOptions({scene:u,pagePath:r,query:s,referrerInfo:d}),J.loadResource({appId:t,bridgeId:n,pagePath:r,root:i,baseUrl:a,resourceLoadId:c,runtimeType:l})&&Y.isMiniGame()&&Y.gameLaunch()}),this.message.on(`hostEnvUpdate`,e=>{b.update(e)}),this.message.on(`gameTouch`,({eventType:e,...t})=>{Ni(e,t)}),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;v.invoke(t,n)}),this.message.on(`flushCallbacks`,({requestId:e})=>{this.message.invoke({type:`callbacksFlushed`,target:`container`,body:{requestId:e}})}),this.message.on(`componentInvokeAPI`,e=>{let{apiName:t,bridgeId:n,callbacks:r={},params:i={}}=e,a,o,s=(e,t)=>{e&&this.message.send({type:`triggerCallback`,target:`render`,body:{bridgeId:n,data:t,success:e}})};r.success&&(a=v.store(e=>s(r.success,e))),r.fail&&(o=v.store(e=>s(r.fail,e)));let c=v.store(e=>{s(r.complete,e),v.remove(a),v.remove(o)});this.message.invoke({type:`invokeAPI`,target:`container`,body:{name:t,bridgeId:n,params:{...i,complete:c,fail:o,success:a}}})}),this.message.on(`resourceLoadFailed`,({bridgeId:e,pagePath:t,errors:n=[]})=>{console.error(`[service] resourceLoadFailed: bridgeId: ${e}, pagePath: ${t}, errors: ${n.join(`; `)}`)}),this.onAppMsg(),this.onModuleMsg()}onAppMsg(){this.message.on(`resourceLoaded`,e=>{let{bridgeId:t,pagePath:n,query:r,stackId:i}=e;if(Y.isMiniGame())return;let a=J.getModuleByPath(n);if(!a){console.error(`[service] resourceLoaded: module not found, pagePath: ${n}`);return}let o=J.getPropsByPath(a.usingComponents),s=`page_${p()}`,c=Y.createInstance({bridgeId:t,moduleId:s,path:n,query:r,stackId:i,deferInitialData:!0});S.send({type:`firstRender`,target:`render`,body:{bridgeId:t,pageId:s,pagePath:n,initialProps:o,query:r}}),c?.sendInitialData()}),this.message.on(`appShow`,e=>{Y.appShow(e)}),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(`mA`,e=>{Y.moduleAttached(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`,e=>{Y.pagePullDownRefresh(e)}),this.message.on(`pageReachBottom`,e=>{Y.pageReachBottom(e)}),this.message.on(`pageShareAppMessage`,e=>{let t=Y.pageShareAppMessage(e);e?.success&&this.message.send({type:`triggerCallback`,target:`container`,body:{bridgeId:e.bridgeId,id:e.success,args:[t],data:t}})}),this.message.on(`pageScroll`,e=>{Y.pageScroll(e)}),this.message.on(`pageResize`,e=>{Y.pageResize(e)}),this.message.on(`onTabItemTap`,e=>{Y.pageTabItemTap(e)}),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}})}yd[t]?.({url:n,...e.params})})}}})();