agentroam-runtime-darwin-arm64 0.2.0-preview.76 → 0.2.0-preview.77

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 (319) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-path-routes-manifest.json +1 -1
  5. package/runtime/.next/build-manifest.json +2 -2
  6. package/runtime/.next/prerender-manifest.json +1 -1
  7. package/runtime/.next/server/app/_not-found.html +1 -1
  8. package/runtime/.next/server/app/_not-found.rsc +1 -1
  9. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  10. package/runtime/.next/server/app/api/agent/abort/route.js.nft.json +1 -1
  11. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  12. package/runtime/.next/server/app/api/agent/answer/route.js.nft.json +1 -1
  13. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/harness/status/route.js.nft.json +1 -1
  16. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/model/route.js.nft.json +1 -1
  18. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/run/route.js.nft.json +1 -1
  21. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/steer/route.js.nft.json +1 -1
  24. package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
  25. package/runtime/.next/server/app/api/agent/stream/route.js.nft.json +1 -1
  26. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  27. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js.nft.json +1 -1
  28. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  29. package/runtime/.next/server/app/api/agent-workspaces/route.js.nft.json +1 -1
  30. package/runtime/.next/server/app/api/business/route.js +1 -1
  31. package/runtime/.next/server/app/api/business/route.js.nft.json +1 -1
  32. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  33. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  34. package/runtime/.next/server/app/api/collaboration/route.js +4 -4
  35. package/runtime/.next/server/app/api/collaboration/route.js.nft.json +1 -1
  36. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  37. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  38. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  39. package/runtime/.next/server/app/api/flow/v1/catalog/route.js.nft.json +1 -1
  40. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  41. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js.nft.json +1 -1
  42. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +1 -1
  43. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js.nft.json +1 -1
  44. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  45. package/runtime/.next/server/app/api/flow/v1/runs/route.js.nft.json +1 -1
  46. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -4
  47. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js.nft.json +1 -1
  48. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  49. package/runtime/.next/server/app/api/internal/todo-mcp/route.js.nft.json +1 -1
  50. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  51. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js.nft.json +1 -1
  52. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  53. package/runtime/.next/server/app/api/notifications/[id]/route.js.nft.json +1 -1
  54. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  55. package/runtime/.next/server/app/api/notifications/route.js.nft.json +1 -1
  56. package/runtime/.next/server/app/api/notifications/stream/route.js +1 -1
  57. package/runtime/.next/server/app/api/notifications/stream/route.js.nft.json +1 -1
  58. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  59. package/runtime/.next/server/app/api/plugins/load/route.js.nft.json +1 -1
  60. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  61. package/runtime/.next/server/app/api/push/subscribe/route.js.nft.json +1 -1
  62. package/runtime/.next/server/app/api/push/vapid/route.js +3 -3
  63. package/runtime/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
  64. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  65. package/runtime/.next/server/app/api/remote-tools/register/route.js.nft.json +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  67. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +3 -3
  70. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js.nft.json +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js.nft.json +1 -1
  81. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  82. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  83. package/runtime/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  84. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  85. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  86. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js.nft.json +1 -1
  87. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  88. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  89. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  90. package/runtime/.next/server/app/api/sessions/parallel/route.js.nft.json +1 -1
  91. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  92. package/runtime/.next/server/app/api/sessions/route.js.nft.json +1 -1
  93. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  94. package/runtime/.next/server/app/api/todos/[id]/commands/route.js.nft.json +1 -1
  95. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  96. package/runtime/.next/server/app/api/todos/[id]/executions/route.js.nft.json +1 -1
  97. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  98. package/runtime/.next/server/app/api/todos/[id]/route.js.nft.json +1 -1
  99. package/runtime/.next/server/app/api/todos/route.js +1 -1
  100. package/runtime/.next/server/app/api/todos/route.js.nft.json +1 -1
  101. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  102. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js.nft.json +1 -1
  103. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  104. package/runtime/.next/server/app/api/tool-policies/route.js.nft.json +1 -1
  105. package/runtime/.next/server/app/api/tools/route.js +1 -1
  106. package/runtime/.next/server/app/api/tools/route.js.nft.json +1 -1
  107. package/runtime/.next/server/app-paths-manifest.json +36 -36
  108. package/runtime/.next/server/chunks/535.js +1 -0
  109. package/runtime/.next/server/chunks/5762.js +3 -3
  110. package/runtime/.next/server/chunks/5801.js +1 -1
  111. package/runtime/.next/server/chunks/5812.js +1 -0
  112. package/runtime/.next/server/chunks/685.js +1 -0
  113. package/runtime/.next/server/chunks/9119.js +4 -4
  114. package/runtime/.next/server/chunks/9457.js +1 -4
  115. package/runtime/.next/server/pages/404.html +1 -1
  116. package/runtime/.next/server/pages/500.html +1 -1
  117. package/runtime/.next/server/server-reference-manifest.json +1 -1
  118. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  119. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  120. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  121. package/runtime/node_modules/.package-lock.json +17 -17
  122. package/runtime/node_modules/@agent/core/dist/index.js +9 -4
  123. package/runtime/node_modules/@agent/native-runtime/dist/index.js +439 -90
  124. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +81 -85
  125. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +65 -65
  126. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0vfvgmex.mjs +39 -0
  127. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-k19jejpn.mjs → core-3h0s3zzg.mjs} +2 -2
  128. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-a8ty0dnc.mjs → core-6w7w19rc.mjs} +2 -2
  129. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-8fprsbvz.mjs +42 -0
  130. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-avz7wgsg.mjs +23 -0
  131. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b9ebje8h.mjs +20 -0
  132. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-kag24kjr.mjs → core-e1h3fbg3.mjs} +3 -3
  133. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ae73vzp2.mjs → core-ge6en8c9.mjs} +4 -4
  134. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-e93r8awg.mjs → core-htcq9qj1.mjs} +2 -2
  135. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-v6sp3qjw.mjs → core-nv0a4kre.mjs} +4 -4
  136. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y4qk5bdp.mjs +17 -0
  137. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-nfa6p2rw.mjs → core-yrdmz7je.mjs} +3 -3
  138. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-z276fcqp.mjs +28 -0
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +23 -25
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +85 -85
  144. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +72 -45
  145. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +13 -13
  146. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +13 -13
  147. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +72 -45
  148. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +72 -45
  149. package/runtime/node_modules/mediabunny/dist/modules/src/input.js +6 -0
  150. package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +52 -35
  151. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +2 -0
  152. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +7 -1
  153. package/runtime/node_modules/mediabunny/dist/modules/src/source.js +7 -4
  154. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  155. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  156. package/runtime/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js +6 -6
  157. package/runtime/node_modules/mediabunny/package.json +1 -1
  158. package/runtime/node_modules/mediabunny/src/input.ts +7 -0
  159. package/runtime/node_modules/mediabunny/src/media-sink.ts +56 -37
  160. package/runtime/node_modules/mediabunny/src/media-source.ts +3 -0
  161. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +6 -1
  162. package/runtime/node_modules/mediabunny/src/source.ts +7 -4
  163. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  164. package/runtime/node_modules/mediabunny/src/wave/wave-demuxer.ts +6 -6
  165. package/runtime/node_modules/source-map-js/lib/quick-sort.js +92 -22
  166. package/runtime/node_modules/source-map-js/package.json +1 -1
  167. package/runtime/package-lock.json +41 -65
  168. package/runtime/webapp/dist/assets/{AIHubView-DF0D5qd2.js → AIHubView-CrtJMKfW.js} +1 -1
  169. package/runtime/webapp/dist/assets/{AgentManager-Ccj6ZefC.js → AgentManager-C2O-Dacy.js} +1 -1
  170. package/runtime/webapp/dist/assets/{AiHubPane-3PRSxzO0.js → AiHubPane-D2XWxc9R.js} +1 -1
  171. package/runtime/webapp/dist/assets/App-Bum2L4_E.js +63 -0
  172. package/runtime/webapp/dist/assets/{BrowserLivePanel-BZDtF0ne.js → BrowserLivePanel-DkBugqrH.js} +13 -18
  173. package/runtime/webapp/dist/assets/{CalendarPage-B8Jo-3Da.js → CalendarPage-DzYWlqoZ.js} +1 -1
  174. package/runtime/webapp/dist/assets/CalendarView-BjjC_t12.css +1 -0
  175. package/runtime/webapp/dist/assets/CalendarView-HQls5G-1.js +31 -0
  176. package/runtime/webapp/dist/assets/{CollaborationCreateDialog-CU1t0iYL.js → CollaborationCreateDialog-BwiSJbjb.js} +1 -1
  177. package/runtime/webapp/dist/assets/{CollaborationDashboard-BZhWQXzn.js → CollaborationDashboard-CNHt31kl.js} +1 -1
  178. package/runtime/webapp/dist/assets/{CollaborationPage-BwRJN55v.js → CollaborationPage-C4l-tTvn.js} +2 -2
  179. package/runtime/webapp/dist/assets/{FilePreview-Oo8sZH0t.js → FilePreview-EGUAbGpH.js} +3 -3
  180. package/runtime/webapp/dist/assets/{FileTree-qJTRdDPQ.js → FileTree-aJGl1V0W.js} +1 -1
  181. package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-D40WNAqC.js → FileWorkspaceDrawer-zpD91eB6.js} +1 -1
  182. package/runtime/webapp/dist/assets/{FlowStudioPane-C1tgSbGo.js → FlowStudioPane-K1o4pSkZ.js} +1 -1
  183. package/runtime/webapp/dist/assets/{HostProjectPicker-BEfXuqxT.js → HostProjectPicker-BvboCQ0a.js} +1 -1
  184. package/runtime/webapp/dist/assets/{LSPServerList-DQRv04aP.js → LSPServerList-BSLzGLtW.js} +1 -1
  185. package/runtime/webapp/dist/assets/{MCPServerList-BmsejJC9.js → MCPServerList-CeWTI1-m.js} +1 -1
  186. package/runtime/webapp/dist/assets/{MemoryViewer-qZMdVrli.js → MemoryViewer-YcceFawC.js} +1 -1
  187. package/runtime/webapp/dist/assets/NewSessionWindow-C_HCQQnW.js +1 -0
  188. package/runtime/webapp/dist/assets/NewSessionWindow-DOLG1XEp.css +1 -0
  189. package/runtime/webapp/dist/assets/{RemoteDesktopPage-Dz_6-rOL.js → RemoteDesktopPage-Cpzv8zH0.js} +1 -1
  190. package/runtime/webapp/dist/assets/{RunningSessionsIcon-DJxTmxZn.js → RunningSessionsIcon-DmCYwIYD.js} +1 -1
  191. package/runtime/webapp/dist/assets/{SessionDashboard-DuR9r_ZP.js → SessionDashboard-C58Mke8a.js} +1 -1
  192. package/runtime/webapp/dist/assets/{SessionDashboardBridge-BHVjvDHa.js → SessionDashboardBridge-BPsNDY5Y.js} +1 -1
  193. package/runtime/webapp/dist/assets/{SettingsPanel-B-g919uV.js → SettingsPanel-CPBIPT-Z.js} +1 -1
  194. package/runtime/webapp/dist/assets/{SkillManager-nrWIOtEO.js → SkillManager-_qaGEuOE.js} +1 -1
  195. package/runtime/webapp/dist/assets/{TerminalPane-C4HiD2IC.js → TerminalPane-mYe76Pgb.js} +1 -1
  196. package/runtime/webapp/dist/assets/TodoPage-DdF5_SkL.js +1 -0
  197. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-BXRYzdBT.js → abnfDiagram-VCTEODGH-DLd8EeCY.js} +1 -1
  198. package/runtime/webapp/dist/assets/{arc-BeG7yjCw.js → arc-D4smlqs5.js} +1 -1
  199. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-DIQbpqn7.js → architectureDiagram-5GKGNRK7-ByE3DRU4.js} +1 -1
  200. package/runtime/webapp/dist/assets/{arrow-right-B03zMFiC.js → arrow-right-BtIv2jiq.js} +1 -1
  201. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DvgKV01C.js → blockDiagram-I7D4REHJ-BvTUm5vA.js} +1 -1
  202. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DIr7nDIg.js → c4Diagram-7LVT6UL2-XKwj5RmQ.js} +1 -1
  203. package/runtime/webapp/dist/assets/{calendar-days-D1OJEOKr.js → calendar-days-BeI09qof.js} +1 -1
  204. package/runtime/webapp/dist/assets/channel-wxCRUEc2.js +1 -0
  205. package/runtime/webapp/dist/assets/{check-BDiCDSY5.js → check-BdadwkYj.js} +1 -1
  206. package/runtime/webapp/dist/assets/{chevron-down-DIt_NscV.js → chevron-down-DwzPFeq8.js} +1 -1
  207. package/runtime/webapp/dist/assets/{chevron-right-DVhYkZeF.js → chevron-right-kcIXzCMb.js} +1 -1
  208. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cykdc4to.js → chunk-2Q5K7J3B-7A6CDWIw.js} +1 -1
  209. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-DL-gBU30.js → chunk-5VM5RSS4-mkNEWbY6.js} +1 -1
  210. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-z0F9O96j.js → chunk-F27PBJKO-DKG-1HL0.js} +1 -1
  211. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-DcSgatN1.js → chunk-IMKFNOWR-kiJDyKM7.js} +1 -1
  212. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-BmG1ozp9.js → chunk-JWPE2WC7-DS7C5_M7.js} +1 -1
  213. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BK2jifSN.js → chunk-POPQ4Y6H-DvgeK_lX.js} +1 -1
  214. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DtInGjiG.js → chunk-SVP7TREG-BLo_2ua-.js} +1 -1
  215. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DWdiL4Y6.js → chunk-TICWLB2K-CJT6Qkz4.js} +1 -1
  216. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-w8UYxZUB.js → chunk-XXDRQBXY-D1OLqjNu.js} +1 -1
  217. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-Ct3Cgqrl.js +1 -0
  218. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-Ct3Cgqrl.js +1 -0
  219. package/runtime/webapp/dist/assets/{codeSyntax-Cprr1Nm9.js → codeSyntax-Dd0hAazb.js} +1 -1
  220. package/runtime/webapp/dist/assets/collaboration-CAgt9AiV.js +6 -0
  221. package/runtime/webapp/dist/assets/composer-file-routing-DSC2Eojr.js +6 -0
  222. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-BJgwy7Y5.js → cose-bilkent-JH36ORCC-CI6EKHP8.js} +1 -1
  223. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BssWa1kU.js → cynefin-OW5HDTMX-CJTXYieX.js} +1 -1
  224. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-Bv_-fuG_.js → cynefinDiagram-5FMLGOSQ-CPl1UVhy.js} +1 -1
  225. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BjA5n2Zi.js → dagre-GXQ25YYZ-Dq3ZQGTN.js} +1 -1
  226. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-CCT38L0E.js → diagram-S7CK7UJ4-DJyU-2Di.js} +1 -1
  227. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-4fLw8kje.js → diagram-UQ7AKVKN-Csg8hC8m.js} +1 -1
  228. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-43_Qj0Se.js → diagram-VSXAHHWV-B14uLH_N.js} +1 -1
  229. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-BHEXgMDZ.js → diagram-VX7I27RA-D2Ww2nHe.js} +1 -1
  230. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-BRTSiXVr.js → diagram-Z3DM3KII-D_YC6AVP.js} +1 -1
  231. package/runtime/webapp/dist/assets/{download-CuYS63Ny.js → download-COWHIKec.js} +1 -1
  232. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-B4GImY-o.js → ebnfDiagram-PWID7BFC-s66xVEGY.js} +1 -1
  233. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-EmEsAxWS.js → erDiagram-RLTQ6QDP-CgZh5cEn.js} +1 -1
  234. package/runtime/webapp/dist/assets/{external-link-Baeyco26.js → external-link-T3kil1jt.js} +1 -1
  235. package/runtime/webapp/dist/assets/{file-types-CykGmGsd.js → file-types-0e-tNIVd.js} +1 -1
  236. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-sky_wmbX.js → flowDiagram-HODETNUW-BISMKynN.js} +1 -1
  237. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-Cc71xV1j.js → ganttDiagram-EL5Y4UJY-Cbyu0NcF.js} +1 -1
  238. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-z7uQ8-8z.js → gitGraphDiagram-WWUBYQGX-Cs6IQGBz.js} +1 -1
  239. package/runtime/webapp/dist/assets/{history-C7WUwl_W.js → history-Df4LXw6L.js} +1 -1
  240. package/runtime/webapp/dist/assets/{image-plus-B2RK1ogI.js → image-plus-COHCHOpI.js} +1 -1
  241. package/runtime/webapp/dist/assets/index-CQTDnt74.css +1 -0
  242. package/runtime/webapp/dist/assets/{index-d8fS3JdV.js → index-CTJNAMck.js} +52 -52
  243. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DXLEePz0.js → infoDiagram-27XIBGKW-4f3bFqNV.js} +1 -1
  244. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-DCFXm_zQ.js → ishikawaDiagram-5VMMS53U-D-cJ9vio.js} +1 -1
  245. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-DHWCpvY6.js → journeyDiagram-3NMN7TZE-CeToS0Qx.js} +1 -1
  246. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-D_uP81aw.js → kanban-definition-UXKFOSKX-DStbIUk1.js} +1 -1
  247. package/runtime/webapp/dist/assets/{layout-Bcu83-1p.js → layout-i2D4wlYd.js} +1 -1
  248. package/runtime/webapp/dist/assets/{linear-CPim5SQa.js → linear-BcJhiCv3.js} +1 -1
  249. package/runtime/webapp/dist/assets/{list-todo-F1W4yBLx.js → list-todo-7yETOqQe.js} +1 -1
  250. package/runtime/webapp/dist/assets/{loader-circle-DesEGpVH.js → loader-circle-CZdAfU-D.js} +1 -1
  251. package/runtime/webapp/dist/assets/{locate-fixed-UXM91vCS.js → locate-fixed-ByJuEKxC.js} +1 -1
  252. package/runtime/webapp/dist/assets/{mermaid.core-CyzKk3O2.js → mermaid.core-BjNFAB9I.js} +5 -5
  253. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-0MHQpQro.js → mindmap-definition-YA3MSWOX-BUIHHUVG.js} +1 -1
  254. package/runtime/webapp/dist/assets/new-session-window-C7R76XMp.css +1 -0
  255. package/runtime/webapp/dist/assets/new-session-window-DwtkwFBQ.js +190 -0
  256. package/runtime/webapp/dist/assets/{page-C2e368Dx.js → page-9-9EC7QM.js} +3 -3
  257. package/runtime/webapp/dist/assets/{pause-_h6c8qPD.js → pause-DXyBDZlg.js} +1 -1
  258. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BNinoE-7.js → pegDiagram-XKGWAZYB-BY5Bio5e.js} +1 -1
  259. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-CfPzV9yb.js → pieDiagram-E7YTZNPT-CF8DVW3F.js} +1 -1
  260. package/runtime/webapp/dist/assets/{pin-BcXr5230.js → pin-2YlrlSJv.js} +1 -1
  261. package/runtime/webapp/dist/assets/{play-BdB0D0rZ.js → play-BxEpdvoI.js} +1 -1
  262. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-0qLb33lM.js → quadrantDiagram-AXDQQJYC-CXWHO3a-.js} +1 -1
  263. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-DNU4eRJt.js → railroadDiagram-O6MQD6OU-C20JeJZ-.js} +1 -1
  264. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-BWJRwKX8.js → requirementDiagram-BXWQKSXE-IYd9UrO9.js} +1 -1
  265. package/runtime/webapp/dist/assets/{rotate-ccw-BdZpOTYP.js → rotate-ccw-CFIRtbUD.js} +1 -1
  266. package/runtime/webapp/dist/assets/{rotate-cw-D-zPMe4i.js → rotate-cw-B_vFqNsz.js} +1 -1
  267. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-CGW9pvun.js → sankeyDiagram-P5KCCOFB-ysBhpblA.js} +1 -1
  268. package/runtime/webapp/dist/assets/{send-DCVOqOap.js → send-DUE2vBoK.js} +1 -1
  269. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-CeVAD519.js → sequenceDiagram-WJ2MYXX4-CQMmk6cu.js} +1 -1
  270. package/runtime/webapp/dist/assets/session-dashboard-DnFhQhBN.js +1 -0
  271. package/runtime/webapp/dist/assets/{shield-check-DrxVJwVC.js → shield-check-Btyos6Iv.js} +1 -1
  272. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-Dj5SukiO.js → sizeCapture-INFHLROL-DekvKUn1.js} +1 -1
  273. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-UtRSslyd.js → stateDiagram-D77RDMKH-Ds_FEmbr.js} +1 -1
  274. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DxJ1ks_8.js +1 -0
  275. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-DKbrz8SF.js → swimlanes-42K2YHIH-cjPcEO_T.js} +1 -1
  276. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-JGHIAQXy.js +8 -0
  277. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-mtVdMOBL.js → timeline-definition-24CTP7MA-CEOprVt5.js} +1 -1
  278. package/runtime/webapp/dist/assets/{trash-2-Bbhd8-xd.js → trash-2-DLDxY6J7.js} +1 -1
  279. package/runtime/webapp/dist/assets/{types-CMhUwzwJ.js → types-CFAnlTif.js} +1 -1
  280. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-ZcuGEhJx.js → vennDiagram-4TSXK5OY-D82uxYY9.js} +1 -1
  281. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CnAYI2ZE.js → wardleyDiagram-VM6X3IG4-JFt7Izt0.js} +1 -1
  282. package/runtime/webapp/dist/assets/{web-BH9JgWsL.js → web-BMqaP0jw.js} +1 -1
  283. package/runtime/webapp/dist/assets/{web-CBiaPgEe.js → web-Q9VPRftY.js} +1 -1
  284. package/runtime/webapp/dist/assets/{x-1GQMVfza.js → x-CeSbythI.js} +1 -1
  285. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-B_uJt0Bg.js → xychartDiagram-S5SC5T6Z-1WCa4SfL.js} +1 -1
  286. package/runtime/webapp/dist/assets/{zoom-out-BNKdrTFD.js → zoom-out-CRr_o1NV.js} +8 -3
  287. package/runtime/webapp/dist/index.html +2 -2
  288. package/runtime/ws-server.mjs +11 -0
  289. package/runtime/.next/server/chunks/2480.js +0 -4
  290. package/runtime/.next/server/chunks/3604.js +0 -4
  291. package/runtime/.next/server/chunks/732.js +0 -1
  292. package/runtime/.next/server/chunks/7788.js +0 -1
  293. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-25bstexa.mjs +0 -17
  294. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-4ps8vwh1.mjs +0 -42
  295. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9a7zb9bm.mjs +0 -53
  296. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dsa3p77h.mjs +0 -18
  297. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-eqz9ara6.mjs +0 -18
  298. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-esw7xtkz.mjs +0 -17
  299. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ey906mbk.mjs +0 -20
  300. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-mhczx7zp.mjs +0 -18
  301. package/runtime/webapp/dist/assets/App-HomcUet2.js +0 -63
  302. package/runtime/webapp/dist/assets/CalendarView-BD7GhA0i.js +0 -36
  303. package/runtime/webapp/dist/assets/CalendarView-DHi-mzjY.css +0 -1
  304. package/runtime/webapp/dist/assets/NewSessionWindow-BOCZ0mXT.css +0 -1
  305. package/runtime/webapp/dist/assets/NewSessionWindow-uzVK5LVS.js +0 -1
  306. package/runtime/webapp/dist/assets/TodoPage-Bn6j6kR6.js +0 -1
  307. package/runtime/webapp/dist/assets/channel-Cchxg6Fx.js +0 -1
  308. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BGv4sK1I.js +0 -1
  309. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BGv4sK1I.js +0 -1
  310. package/runtime/webapp/dist/assets/collaboration-acdqOxaY.js +0 -6
  311. package/runtime/webapp/dist/assets/composer-file-routing-BsSxfxUa.js +0 -6
  312. package/runtime/webapp/dist/assets/index-B_fTpc5K.css +0 -1
  313. package/runtime/webapp/dist/assets/new-session-window-B4BJYrds.css +0 -1
  314. package/runtime/webapp/dist/assets/new-session-window-fsYu53Ht.js +0 -188
  315. package/runtime/webapp/dist/assets/session-dashboard-BAYi5acZ.js +0 -1
  316. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Se3lznH6.js +0 -1
  317. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C-Zsmae7.js +0 -8
  318. /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_buildManifest.js +0 -0
  319. /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js","./RunningSessionsIcon-DJxTmxZn.js","./x-1GQMVfza.js","./chevron-down-DIt_NscV.js","./check-BDiCDSY5.js","./trash-2-Bbhd8-xd.js","./external-link-Baeyco26.js","./chevron-right-DVhYkZeF.js","./calendar-days-D1OJEOKr.js","./artifact-links-4m1A00GO.js","./clipboard-BvwmdR4z.js","./pin-BcXr5230.js","./CollaborationTabBridge-Dxq4G1Uk.js","./SessionDashboardBridge-BHVjvDHa.js","./RemoteDesktopTabBridge-Cp9mLtcY.js","./NewSessionWindow-uzVK5LVS.js","./new-session-window-fsYu53Ht.js","./arrow-right-B03zMFiC.js","./loader-circle-DesEGpVH.js","./file-types-CykGmGsd.js","./composer-file-routing-BsSxfxUa.js","./zoom-out-BNKdrTFD.js","./rotate-ccw-BdZpOTYP.js","./download-CuYS63Ny.js","./list-todo-F1W4yBLx.js","./play-BdB0D0rZ.js","./HostProjectPicker-BEfXuqxT.js","./new-session-window-B4BJYrds.css","./NewSessionWindow-BOCZ0mXT.css","./CollaborationPage-BwRJN55v.js","./shield-check-DrxVJwVC.js","./collaboration-acdqOxaY.js","./collaboration-DkVTQ-wS.css","./types-CMhUwzwJ.js","./history-C7WUwl_W.js","./image-plus-B2RK1ogI.js","./CollaborationDashboard-BZhWQXzn.js","./CollaborationCreateDialog-CU1t0iYL.js","./CollaborationDashboard-CCXC6JuQ.css","./SessionDashboard-DuR9r_ZP.js","./session-dashboard-BAYi5acZ.js","./session-dashboard-D3n4eFut.css","./pause-_h6c8qPD.js","./SessionDashboard-CAYVDT8Z.css","./RemoteDesktopPage-Dz_6-rOL.js","./BrowserLivePanel-BZDtF0ne.js","./CalendarPage-B8Jo-3Da.js","./CalendarView-BD7GhA0i.js","./locate-fixed-UXM91vCS.js","./CalendarView-DHi-mzjY.css","./TodoPage-Bn6j6kR6.js","./App-HomcUet2.js","./rotate-cw-D-zPMe4i.js","./App-CtLZIOFu.css"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const g of u.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function n(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=n(c);fetch(c.href,u)}})();const P3="modulepreload",L3=function(e,t){return new URL(e,t).href},fh={},Br=function(t,n,o){let c=Promise.resolve();if(n&&n.length>0){const g=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),w=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));c=Promise.allSettled(n.map(m=>{if(m=L3(m,o),m in fh)return;fh[m]=!0;const C=m.endsWith(".css"),b=C?'[rel="stylesheet"]':"";if(o)for(let T=g.length-1;T>=0;T--){const k=g[T];if(k.href===m&&(!C||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${b}`))return;const A=document.createElement("link");if(A.rel=C?"stylesheet":P3,C||(A.as="script"),A.crossOrigin="",A.href=m,w&&A.setAttribute("nonce",w),document.head.appendChild(A),C)return new Promise((T,k)=>{A.addEventListener("load",T),A.addEventListener("error",()=>k(Error(`Unable to preload CSS for ${m}`)))})}))}function u(g){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=g,window.dispatchEvent(x),!x.defaultPrevented)throw g}return c.then(g=>{for(const x of g||[])x.status==="rejected"&&u(x.reason);return t().catch(u)})};var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function I2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var T2={exports:{}},xc={},R2={exports:{}},be={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-9-9EC7QM.js","./RunningSessionsIcon-DmCYwIYD.js","./x-CeSbythI.js","./chevron-down-DwzPFeq8.js","./check-BdadwkYj.js","./trash-2-DLDxY6J7.js","./external-link-T3kil1jt.js","./chevron-right-kcIXzCMb.js","./calendar-days-BeI09qof.js","./artifact-links-4m1A00GO.js","./clipboard-BvwmdR4z.js","./pin-2YlrlSJv.js","./CollaborationTabBridge-Dxq4G1Uk.js","./SessionDashboardBridge-BPsNDY5Y.js","./RemoteDesktopTabBridge-Cp9mLtcY.js","./NewSessionWindow-C_HCQQnW.js","./new-session-window-DwtkwFBQ.js","./composer-file-routing-DSC2Eojr.js","./loader-circle-CZdAfU-D.js","./file-types-0e-tNIVd.js","./list-todo-7yETOqQe.js","./arrow-right-BtIv2jiq.js","./zoom-out-CRr_o1NV.js","./rotate-ccw-CFIRtbUD.js","./download-COWHIKec.js","./play-BxEpdvoI.js","./HostProjectPicker-BvboCQ0a.js","./new-session-window-C7R76XMp.css","./NewSessionWindow-DOLG1XEp.css","./CollaborationPage-C4l-tTvn.js","./shield-check-Btyos6Iv.js","./collaboration-CAgt9AiV.js","./collaboration-DkVTQ-wS.css","./types-CFAnlTif.js","./history-Df4LXw6L.js","./image-plus-COHCHOpI.js","./CollaborationDashboard-CNHt31kl.js","./CollaborationCreateDialog-BwiSJbjb.js","./CollaborationDashboard-CCXC6JuQ.css","./SessionDashboard-C58Mke8a.js","./session-dashboard-DnFhQhBN.js","./session-dashboard-D3n4eFut.css","./pause-DXyBDZlg.js","./SessionDashboard-CAYVDT8Z.css","./RemoteDesktopPage-Cpzv8zH0.js","./BrowserLivePanel-DkBugqrH.js","./CalendarPage-DzYWlqoZ.js","./CalendarView-HQls5G-1.js","./locate-fixed-ByJuEKxC.js","./CalendarView-BjjC_t12.css","./TodoPage-DdF5_SkL.js","./App-Bum2L4_E.js","./rotate-cw-B_vFqNsz.js","./App-CtLZIOFu.css"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function n(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=n(c);fetch(c.href,u)}})();const B3="modulepreload",F3=function(e,t){return new URL(e,t).href},fh={},Br=function(t,n,o){let c=Promise.resolve();if(n&&n.length>0){const h=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),w=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));c=Promise.allSettled(n.map(m=>{if(m=F3(m,o),m in fh)return;fh[m]=!0;const C=m.endsWith(".css"),b=C?'[rel="stylesheet"]':"";if(o)for(let T=h.length-1;T>=0;T--){const k=h[T];if(k.href===m&&(!C||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${b}`))return;const A=document.createElement("link");if(A.rel=C?"stylesheet":B3,C||(A.as="script"),A.crossOrigin="",A.href=m,w&&A.setAttribute("nonce",w),document.head.appendChild(A),C)return new Promise((T,k)=>{A.addEventListener("load",T),A.addEventListener("error",()=>k(Error(`Unable to preload CSS for ${m}`)))})}))}function u(h){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=h,window.dispatchEvent(x),!x.defaultPrevented)throw h}return c.then(h=>{for(const x of h||[])x.status==="rejected"&&u(x.reason);return t().catch(u)})};var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function T2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var R2={exports:{}},xc={},_2={exports:{}},be={};/**
3
3
  * @license React
4
4
  * react.production.min.js
5
5
  *
@@ -7,7 +7,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var na=Symbol.for("react.element"),B3=Symbol.for("react.portal"),F3=Symbol.for("react.fragment"),U3=Symbol.for("react.strict_mode"),j3=Symbol.for("react.profiler"),W3=Symbol.for("react.provider"),$3=Symbol.for("react.context"),z3=Symbol.for("react.forward_ref"),V3=Symbol.for("react.suspense"),H3=Symbol.for("react.memo"),G3=Symbol.for("react.lazy"),dh=Symbol.iterator;function X3(e){return e===null||typeof e!="object"?null:(e=dh&&e[dh]||e["@@iterator"],typeof e=="function"?e:null)}var _2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O2=Object.assign,N2={};function ks(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||_2}ks.prototype.isReactComponent={};ks.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ks.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function k2(){}k2.prototype=ks.prototype;function fd(e,t,n){this.props=e,this.context=t,this.refs=N2,this.updater=n||_2}var dd=fd.prototype=new k2;dd.constructor=fd;O2(dd,ks.prototype);dd.isPureReactComponent=!0;var hh=Array.isArray,M2=Object.prototype.hasOwnProperty,hd={current:null},D2={key:!0,ref:!0,__self:!0,__source:!0};function P2(e,t,n){var o,c={},u=null,g=null;if(t!=null)for(o in t.ref!==void 0&&(g=t.ref),t.key!==void 0&&(u=""+t.key),t)M2.call(t,o)&&!D2.hasOwnProperty(o)&&(c[o]=t[o]);var x=arguments.length-2;if(x===1)c.children=n;else if(1<x){for(var w=Array(x),m=0;m<x;m++)w[m]=arguments[m+2];c.children=w}if(e&&e.defaultProps)for(o in x=e.defaultProps,x)c[o]===void 0&&(c[o]=x[o]);return{$$typeof:na,type:e,key:u,ref:g,props:c,_owner:hd.current}}function Y3(e,t){return{$$typeof:na,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function gd(e){return typeof e=="object"&&e!==null&&e.$$typeof===na}function K3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gh=/\/+/g;function yu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?K3(""+e.key):t.toString(36)}function ll(e,t,n,o,c){var u=typeof e;(u==="undefined"||u==="boolean")&&(e=null);var g=!1;if(e===null)g=!0;else switch(u){case"string":case"number":g=!0;break;case"object":switch(e.$$typeof){case na:case B3:g=!0}}if(g)return g=e,c=c(g),e=o===""?"."+yu(g,0):o,hh(c)?(n="",e!=null&&(n=e.replace(gh,"$&/")+"/"),ll(c,t,n,"",function(m){return m})):c!=null&&(gd(c)&&(c=Y3(c,n+(!c.key||g&&g.key===c.key?"":(""+c.key).replace(gh,"$&/")+"/")+e)),t.push(c)),1;if(g=0,o=o===""?".":o+":",hh(e))for(var x=0;x<e.length;x++){u=e[x];var w=o+yu(u,x);g+=ll(u,t,n,w,c)}else if(w=X3(e),typeof w=="function")for(e=w.call(e),x=0;!(u=e.next()).done;)u=u.value,w=o+yu(u,x++),g+=ll(u,t,n,w,c);else if(u==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return g}function Ra(e,t,n){if(e==null)return e;var o=[],c=0;return ll(e,o,"","",function(u){return t.call(n,u,c++)}),o}function Z3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Yt={current:null},cl={transition:null},Q3={ReactCurrentDispatcher:Yt,ReactCurrentBatchConfig:cl,ReactCurrentOwner:hd};function L2(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:Ra,forEach:function(e,t,n){Ra(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ra(e,function(){t++}),t},toArray:function(e){return Ra(e,function(t){return t})||[]},only:function(e){if(!gd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};be.Component=ks;be.Fragment=F3;be.Profiler=j3;be.PureComponent=fd;be.StrictMode=U3;be.Suspense=V3;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q3;be.act=L2;be.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=O2({},e.props),c=e.key,u=e.ref,g=e._owner;if(t!=null){if(t.ref!==void 0&&(u=t.ref,g=hd.current),t.key!==void 0&&(c=""+t.key),e.type&&e.type.defaultProps)var x=e.type.defaultProps;for(w in t)M2.call(t,w)&&!D2.hasOwnProperty(w)&&(o[w]=t[w]===void 0&&x!==void 0?x[w]:t[w])}var w=arguments.length-2;if(w===1)o.children=n;else if(1<w){x=Array(w);for(var m=0;m<w;m++)x[m]=arguments[m+2];o.children=x}return{$$typeof:na,type:e.type,key:c,ref:u,props:o,_owner:g}};be.createContext=function(e){return e={$$typeof:$3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:W3,_context:e},e.Consumer=e};be.createElement=P2;be.createFactory=function(e){var t=P2.bind(null,e);return t.type=e,t};be.createRef=function(){return{current:null}};be.forwardRef=function(e){return{$$typeof:z3,render:e}};be.isValidElement=gd;be.lazy=function(e){return{$$typeof:G3,_payload:{_status:-1,_result:e},_init:Z3}};be.memo=function(e,t){return{$$typeof:H3,type:e,compare:t===void 0?null:t}};be.startTransition=function(e){var t=cl.transition;cl.transition={};try{e()}finally{cl.transition=t}};be.unstable_act=L2;be.useCallback=function(e,t){return Yt.current.useCallback(e,t)};be.useContext=function(e){return Yt.current.useContext(e)};be.useDebugValue=function(){};be.useDeferredValue=function(e){return Yt.current.useDeferredValue(e)};be.useEffect=function(e,t){return Yt.current.useEffect(e,t)};be.useId=function(){return Yt.current.useId()};be.useImperativeHandle=function(e,t,n){return Yt.current.useImperativeHandle(e,t,n)};be.useInsertionEffect=function(e,t){return Yt.current.useInsertionEffect(e,t)};be.useLayoutEffect=function(e,t){return Yt.current.useLayoutEffect(e,t)};be.useMemo=function(e,t){return Yt.current.useMemo(e,t)};be.useReducer=function(e,t,n){return Yt.current.useReducer(e,t,n)};be.useRef=function(e){return Yt.current.useRef(e)};be.useState=function(e){return Yt.current.useState(e)};be.useSyncExternalStore=function(e,t,n){return Yt.current.useSyncExternalStore(e,t,n)};be.useTransition=function(){return Yt.current.useTransition()};be.version="18.3.1";R2.exports=be;var ce=R2.exports;const q3=I2(ce);/**
10
+ */var ia=Symbol.for("react.element"),U3=Symbol.for("react.portal"),j3=Symbol.for("react.fragment"),W3=Symbol.for("react.strict_mode"),$3=Symbol.for("react.profiler"),z3=Symbol.for("react.provider"),V3=Symbol.for("react.context"),H3=Symbol.for("react.forward_ref"),G3=Symbol.for("react.suspense"),X3=Symbol.for("react.memo"),Y3=Symbol.for("react.lazy"),dh=Symbol.iterator;function K3(e){return e===null||typeof e!="object"?null:(e=dh&&e[dh]||e["@@iterator"],typeof e=="function"?e:null)}var O2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N2=Object.assign,k2={};function ks(e,t,n){this.props=e,this.context=t,this.refs=k2,this.updater=n||O2}ks.prototype.isReactComponent={};ks.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ks.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function M2(){}M2.prototype=ks.prototype;function fd(e,t,n){this.props=e,this.context=t,this.refs=k2,this.updater=n||O2}var dd=fd.prototype=new M2;dd.constructor=fd;N2(dd,ks.prototype);dd.isPureReactComponent=!0;var hh=Array.isArray,D2=Object.prototype.hasOwnProperty,hd={current:null},P2={key:!0,ref:!0,__self:!0,__source:!0};function L2(e,t,n){var o,c={},u=null,h=null;if(t!=null)for(o in t.ref!==void 0&&(h=t.ref),t.key!==void 0&&(u=""+t.key),t)D2.call(t,o)&&!P2.hasOwnProperty(o)&&(c[o]=t[o]);var x=arguments.length-2;if(x===1)c.children=n;else if(1<x){for(var w=Array(x),m=0;m<x;m++)w[m]=arguments[m+2];c.children=w}if(e&&e.defaultProps)for(o in x=e.defaultProps,x)c[o]===void 0&&(c[o]=x[o]);return{$$typeof:ia,type:e,key:u,ref:h,props:c,_owner:hd.current}}function Z3(e,t){return{$$typeof:ia,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function gd(e){return typeof e=="object"&&e!==null&&e.$$typeof===ia}function Q3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gh=/\/+/g;function yu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Q3(""+e.key):t.toString(36)}function cl(e,t,n,o,c){var u=typeof e;(u==="undefined"||u==="boolean")&&(e=null);var h=!1;if(e===null)h=!0;else switch(u){case"string":case"number":h=!0;break;case"object":switch(e.$$typeof){case ia:case U3:h=!0}}if(h)return h=e,c=c(h),e=o===""?"."+yu(h,0):o,hh(c)?(n="",e!=null&&(n=e.replace(gh,"$&/")+"/"),cl(c,t,n,"",function(m){return m})):c!=null&&(gd(c)&&(c=Z3(c,n+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(gh,"$&/")+"/")+e)),t.push(c)),1;if(h=0,o=o===""?".":o+":",hh(e))for(var x=0;x<e.length;x++){u=e[x];var w=o+yu(u,x);h+=cl(u,t,n,w,c)}else if(w=K3(e),typeof w=="function")for(e=w.call(e),x=0;!(u=e.next()).done;)u=u.value,w=o+yu(u,x++),h+=cl(u,t,n,w,c);else if(u==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return h}function _a(e,t,n){if(e==null)return e;var o=[],c=0;return cl(e,o,"","",function(u){return t.call(n,u,c++)}),o}function q3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Yt={current:null},ul={transition:null},J3={ReactCurrentDispatcher:Yt,ReactCurrentBatchConfig:ul,ReactCurrentOwner:hd};function B2(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:_a,forEach:function(e,t,n){_a(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _a(e,function(){t++}),t},toArray:function(e){return _a(e,function(t){return t})||[]},only:function(e){if(!gd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};be.Component=ks;be.Fragment=j3;be.Profiler=$3;be.PureComponent=fd;be.StrictMode=W3;be.Suspense=G3;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J3;be.act=B2;be.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=N2({},e.props),c=e.key,u=e.ref,h=e._owner;if(t!=null){if(t.ref!==void 0&&(u=t.ref,h=hd.current),t.key!==void 0&&(c=""+t.key),e.type&&e.type.defaultProps)var x=e.type.defaultProps;for(w in t)D2.call(t,w)&&!P2.hasOwnProperty(w)&&(o[w]=t[w]===void 0&&x!==void 0?x[w]:t[w])}var w=arguments.length-2;if(w===1)o.children=n;else if(1<w){x=Array(w);for(var m=0;m<w;m++)x[m]=arguments[m+2];o.children=x}return{$$typeof:ia,type:e.type,key:c,ref:u,props:o,_owner:h}};be.createContext=function(e){return e={$$typeof:V3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:z3,_context:e},e.Consumer=e};be.createElement=L2;be.createFactory=function(e){var t=L2.bind(null,e);return t.type=e,t};be.createRef=function(){return{current:null}};be.forwardRef=function(e){return{$$typeof:H3,render:e}};be.isValidElement=gd;be.lazy=function(e){return{$$typeof:Y3,_payload:{_status:-1,_result:e},_init:q3}};be.memo=function(e,t){return{$$typeof:X3,type:e,compare:t===void 0?null:t}};be.startTransition=function(e){var t=ul.transition;ul.transition={};try{e()}finally{ul.transition=t}};be.unstable_act=B2;be.useCallback=function(e,t){return Yt.current.useCallback(e,t)};be.useContext=function(e){return Yt.current.useContext(e)};be.useDebugValue=function(){};be.useDeferredValue=function(e){return Yt.current.useDeferredValue(e)};be.useEffect=function(e,t){return Yt.current.useEffect(e,t)};be.useId=function(){return Yt.current.useId()};be.useImperativeHandle=function(e,t,n){return Yt.current.useImperativeHandle(e,t,n)};be.useInsertionEffect=function(e,t){return Yt.current.useInsertionEffect(e,t)};be.useLayoutEffect=function(e,t){return Yt.current.useLayoutEffect(e,t)};be.useMemo=function(e,t){return Yt.current.useMemo(e,t)};be.useReducer=function(e,t,n){return Yt.current.useReducer(e,t,n)};be.useRef=function(e){return Yt.current.useRef(e)};be.useState=function(e){return Yt.current.useState(e)};be.useSyncExternalStore=function(e,t,n){return Yt.current.useSyncExternalStore(e,t,n)};be.useTransition=function(){return Yt.current.useTransition()};be.version="18.3.1";_2.exports=be;var ce=_2.exports;const ey=T2(ce);/**
11
11
  * @license React
12
12
  * react-jsx-runtime.production.min.js
13
13
  *
@@ -15,7 +15,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var J3=ce,ey=Symbol.for("react.element"),ty=Symbol.for("react.fragment"),ry=Object.prototype.hasOwnProperty,ny=J3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,iy={key:!0,ref:!0,__self:!0,__source:!0};function B2(e,t,n){var o,c={},u=null,g=null;n!==void 0&&(u=""+n),t.key!==void 0&&(u=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)ry.call(t,o)&&!iy.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)c[o]===void 0&&(c[o]=t[o]);return{$$typeof:ey,type:e,key:u,ref:g,props:c,_owner:ny.current}}xc.Fragment=ty;xc.jsx=B2;xc.jsxs=B2;T2.exports=xc;var L=T2.exports;const sy="agentroam:page-activity:v1",oy="agentroam:page-activity-request:v1";function ay(e,t,n){var o;return!n||e.source!==n||e.origin!==t||((o=e.data)==null?void 0:o.type)!==sy||typeof e.data.active!="boolean"?null:e.data.active}function ly(e){let t=e.parent===e,n=!1;const o=new Set,c=()=>t&&e.document.visibilityState!=="hidden";let u=c();const g=()=>{const m=c();m!==u&&(u=m,o.forEach(C=>C()))},x=m=>{const C=ay(m,e.location.origin,e.parent);C!==null&&(t=C,g())};return{active:c,subscribe:m=>(o.add(m),n||(n=!0,e.addEventListener("message",x),e.document.addEventListener("visibilitychange",g),e.parent!==e&&e.parent.postMessage({type:oy},e.location.origin)),()=>{o.delete(m),!o.size&&(e.removeEventListener("message",x),e.document.removeEventListener("visibilitychange",g),n=!1)})}}let cy;function F2(){return cy??(cy=ly(window))}function uy(){return typeof window<"u"&&F2().active()}function O_(){const e=typeof window>"u"?{subscribe:()=>()=>{},active:()=>!1}:F2();return ce.useSyncExternalStore(e.subscribe,e.active,()=>!1)}var Ks=function(e){return e&&e.Math===Math&&e},ft=Ks(typeof globalThis=="object"&&globalThis)||Ks(typeof window=="object"&&window)||Ks(typeof self=="object"&&self)||Ks(typeof pn=="object"&&pn)||Ks(typeof pn=="object"&&pn)||function(){return this}()||Function("return this")(),pd={},lt=function(e){try{return!!e()}catch{return!0}},fy=lt,Kt=!fy(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),dy=lt,md=!dy(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),hy=md,_a=Function.prototype.call,Sn=hy?_a.bind(_a):function(){return _a.apply(_a,arguments)},U2={},j2={}.propertyIsEnumerable,W2=Object.getOwnPropertyDescriptor,gy=W2&&!j2.call({1:2},1);U2.f=gy?function(t){var n=W2(this,t);return!!n&&n.enumerable}:j2;var ki=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},$2=md,z2=Function.prototype,Bf=z2.call,py=$2&&z2.bind.bind(Bf,Bf),dt=$2?py:function(e){return function(){return Bf.apply(e,arguments)}},V2=dt,my=V2({}.toString),xy=V2("".slice),Mi=function(e){return xy(my(e),8,-1)},wy=dt,vy=lt,yy=Mi,Eu=Object,Ey=wy("".split),H2=vy(function(){return!Eu("z").propertyIsEnumerable(0)})?function(e){return yy(e)==="String"?Ey(e,""):Eu(e)}:Eu,Ms=function(e){return e==null},Cy=Ms,by=TypeError,xd=function(e){if(Cy(e))throw new by("Can't call method on "+e);return e},Ay=H2,Sy=xd,Ds=function(e){return Ay(Sy(e))},Cu=typeof document=="object"&&document.all,Ct=typeof Cu>"u"&&Cu!==void 0?function(e){return typeof e=="function"||e===Cu}:function(e){return typeof e=="function"},Iy=Ct,xr=function(e){return typeof e=="object"?e!==null:Iy(e)},bu=ft,Ty=Ct,Ry=function(e){return Ty(e)?e:void 0},In=function(e,t){return arguments.length<2?Ry(bu[e]):bu[e]&&bu[e][t]},_y=dt,wc=_y({}.isPrototypeOf),Oy=ft,ph=Oy.navigator,mh=ph&&ph.userAgent,G2=mh?String(mh):"",X2=ft,Au=G2,xh=X2.process,wh=X2.Deno,vh=xh&&xh.versions||wh&&wh.version,yh=vh&&vh.v8,jr,kl;yh&&(jr=yh.split("."),kl=jr[0]>0&&jr[0]<4?1:+(jr[0]+jr[1]));!kl&&Au&&(jr=Au.match(/Edge\/(\d+)/),(!jr||jr[1]>=74)&&(jr=Au.match(/Chrome\/(\d+)/),jr&&(kl=+jr[1])));var Y2=kl,Eh=Y2,Ny=lt,ky=ft,My=ky.String,K2=!!Object.getOwnPropertySymbols&&!Ny(function(){var e=Symbol("symbol detection");return!My(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Eh&&Eh<41}),Dy=K2,Z2=Dy&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Py=In,Ly=Ct,By=wc,Fy=Z2,Uy=Object,wd=Fy?function(e){return typeof e=="symbol"}:function(e){var t=Py("Symbol");return Ly(t)&&By(t.prototype,Uy(e))},jy=String,vd=function(e){try{return jy(e)}catch{return"Object"}},Wy=Ct,$y=vd,zy=TypeError,yd=function(e){if(Wy(e))return e;throw new zy($y(e)+" is not a function")},Vy=yd,Hy=Ms,Ed=function(e,t){var n=e[t];return Hy(n)?void 0:Vy(n)},Su=Sn,Iu=Ct,Tu=xr,Gy=TypeError,Xy=function(e,t){var n,o;if(t==="string"&&Iu(n=e.toString)&&!Tu(o=Su(n,e))||Iu(n=e.valueOf)&&!Tu(o=Su(n,e))||t!=="string"&&Iu(n=e.toString)&&!Tu(o=Su(n,e)))return o;throw new Gy("Can't convert object to primitive value")},Q2={exports:{}},Ch=ft,Yy=Object.defineProperty,Cd=function(e,t){try{Yy(Ch,e,{value:t,configurable:!0,writable:!0})}catch{Ch[e]=t}return t},Ky=ft,Zy=Cd,bh="__core-js_shared__",Ah=Q2.exports=Ky[bh]||Zy(bh,{});(Ah.versions||(Ah.versions=[])).push({version:"3.50.0",mode:"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"});var bd=Q2.exports,Sh=bd,Qy=Object.create||Object,q2=function(e,t){return Sh[e]||(Sh[e]=t||Qy(null))},qy=xd,Jy=Object,ia=function(e){return Jy(qy(e))},eE=dt,tE=ia,rE=eE({}.hasOwnProperty),ur=Object.hasOwn||function(t,n){return rE(tE(t),n)},nE=dt,iE=0,sE=Math.random(),oE=nE(1.1.toString),vc=function(e){return"Symbol("+(e===void 0?"":e)+")_"+oE(++iE+sE,36)},aE=ft,lE=q2,Ih=ur,cE=vc,uE=K2,fE=Z2,Qi=aE.Symbol,Ru=lE("wks"),dE=fE?Qi.for||Qi:Qi&&Qi.withoutSetter||cE,Hr=function(e){return Ih(Ru,e)||(Ru[e]=uE&&Ih(Qi,e)?Qi[e]:dE("Symbol."+e)),Ru[e]},hE=Sn,Th=xr,Rh=wd,gE=Ed,pE=Xy,mE=Hr,xE=TypeError,wE=mE("toPrimitive"),vE=function(e,t){if(!Th(e)||Rh(e))return e;var n=gE(e,wE),o;if(n){if(t===void 0&&(t="default"),o=hE(n,e,t),!Th(o)||Rh(o))return o;throw new xE("Can't convert object to primitive value")}return t===void 0&&(t="number"),pE(e,t)},yE=vE,EE=wd,J2=function(e){var t=yE(e,"string");return EE(t)?t:t+""},CE=ft,_h=xr,Ff=CE.document,bE=_h(Ff)&&_h(Ff.createElement),em=function(e){return bE?Ff.createElement(e):{}},AE=Kt,SE=lt,IE=em,tm=!AE&&!SE(function(){return Object.defineProperty(IE("div"),"a",{get:function(){return 7}}).a!==7}),TE=Kt,RE=Sn,_E=U2,OE=ki,NE=Ds,kE=J2,ME=ur,DE=tm,Oh=Object.getOwnPropertyDescriptor;pd.f=TE?Oh:function(t,n){if(t=NE(t),n=kE(n),DE)try{return Oh(t,n)}catch{}if(ME(t,n))return OE(!RE(_E.f,t,n),t[n])};var wr={},PE=Kt,LE=lt,rm=PE&&LE(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),BE=xr,FE=String,UE=TypeError,Gr=function(e){if(BE(e))return e;throw new UE(FE(e)+" is not an object")},jE=Kt,WE=tm,$E=rm,Oa=Gr,Nh=J2,zE=TypeError,_u=Object.defineProperty,VE=Object.getOwnPropertyDescriptor,Ou="enumerable",Nu="configurable",ku="writable";wr.f=jE?$E?function(t,n,o){if(Oa(t),n=Nh(n),Oa(o),typeof t=="function"&&n==="prototype"&&"value"in o&&ku in o&&!o[ku]){var c=VE(t,n);c&&c[ku]&&(t[n]=o.value,o={configurable:Nu in o?o[Nu]:c[Nu],enumerable:Ou in o?o[Ou]:c[Ou],writable:!1})}return _u(t,n,o)}:_u:function(t,n,o){if(Oa(t),n=Nh(n),Oa(o),WE)try{return _u(t,n,o)}catch{}if("get"in o||"set"in o)throw new zE("Accessors not supported");return"value"in o&&(t[n]=o.value),t};var HE=Kt,GE=wr,XE=ki,yc=HE?function(e,t,n){return GE.f(e,t,XE(1,n))}:function(e,t,n){return e[t]=n,e},nm={exports:{}},Uf=Kt,YE=ur,im=Function.prototype,KE=Uf&&Object.getOwnPropertyDescriptor,sm=YE(im,"name"),ZE=sm&&(function(){}).name==="something",QE=sm&&(!Uf||Uf&&KE(im,"name").configurable),om={PROPER:ZE,CONFIGURABLE:QE},qE=dt,JE=Ct,jf=bd,e8=qE(Function.toString);JE(jf.inspectSource)||(jf.inspectSource=function(e){return e8(e)});var am=jf.inspectSource,t8=ft,r8=Ct,kh=t8.WeakMap,n8=r8(kh)&&/native code/.test(String(kh)),i8=q2,s8=vc,Mh=i8("keys"),Ad=function(e){return Mh[e]||(Mh[e]=s8(e))},Ec={},o8=n8,lm=ft,a8=xr,l8=yc,Mu=ur,Du=bd,c8=Ad,u8=Ec,Dh="Object already initialized",Wf=lm.TypeError,f8=lm.WeakMap,Ml,Mo,Dl,d8=function(e){return Dl(e)?Mo(e):Ml(e,{})},h8=function(e){return function(t){var n;if(!a8(t)||(n=Mo(t)).type!==e)throw new Wf("Incompatible receiver, "+e+" required");return n}};if(o8||Du.state){var en=Du.state||(Du.state=new f8);en.get=en.get,en.has=en.has,en.set=en.set,Ml=function(e,t){if(en.has(e))throw new Wf(Dh);return t.facade=e,en.set(e,t),t},Mo=function(e){return en.get(e)||{}},Dl=function(e){return en.has(e)}}else{var Gi=c8("state");u8[Gi]=!0,Ml=function(e,t){if(Mu(e,Gi))throw new Wf(Dh);return t.facade=e,l8(e,Gi,t),t},Mo=function(e){return Mu(e,Gi)?e[Gi]:{}},Dl=function(e){return Mu(e,Gi)}}var Cc={set:Ml,get:Mo,has:Dl,enforce:d8,getterFor:h8},Sd=dt,g8=lt,p8=Ct,Na=ur,$f=Kt,m8=om.CONFIGURABLE,x8=am,cm=Cc,w8=cm.enforce,v8=cm.get,Ph=String,ul=Object.defineProperty,y8=Sd("".slice),E8=Sd("".replace),C8=Sd([].join),b8=$f&&!g8(function(){return ul(function(){},"length",{value:8}).length!==8}),A8=String(String).split("String"),S8=nm.exports=function(e,t,n){y8(Ph(t),0,7)==="Symbol("&&(t="["+E8(Ph(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Na(e,"name")||m8&&e.name!==t)&&($f?ul(e,"name",{value:t,configurable:!0}):e.name=t),b8&&n&&Na(n,"arity")&&e.length!==n.arity&&ul(e,"length",{value:n.arity});try{n&&Na(n,"constructor")&&n.constructor?$f&&ul(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var o=w8(e);return Na(o,"source")||(o.source=C8(A8,typeof t=="string"?t:"")),e};Function.prototype.toString=S8(function(){return p8(this)&&v8(this).source||x8(this)},"toString");var um=nm.exports,I8=Ct,T8=wr,R8=um,_8=Cd,ri=function(e,t,n,o){o||(o={});var c=o.enumerable,u=o.name!==void 0?o.name:t;if(I8(n)&&R8(n,u,o),o.global)c?e[t]=n:_8(t,n);else{try{o.unsafe?e[t]&&(c=!0):delete e[t]}catch{}c?e[t]=n:T8.f(e,t,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},bc={},O8=Math.ceil,N8=Math.floor,k8=Math.trunc||function(t){var n=+t;return(n>0?N8:O8)(n)},M8=k8,Id=function(e){var t=+e;return t!==t||t===0?0:M8(t)},D8=Id,P8=Math.max,L8=Math.min,B8=function(e,t){var n=D8(e);return n<0?P8(n+t,0):L8(n,t)},F8=Id,U8=Math.min,j8=function(e){var t=F8(e);return t>0?U8(t,9007199254740991):0},W8=j8,sa=function(e){return W8(e.length)},$8=Ds,z8=B8,V8=sa,H8=function(e){return function(t,n,o){var c=$8(t),u=V8(c);if(u===0)return!e&&-1;var g=z8(o,u),x;if(e&&n!==n){for(;u>g;)if(x=c[g++],x!==x)return!0}else for(;u>g;g++)if((e||g in c)&&c[g]===n)return e||g||0;return!e&&-1}},G8={indexOf:H8(!1)},X8=dt,Pu=ur,Y8=Ds,K8=G8.indexOf,Z8=Ec,Lh=X8([].push),fm=function(e,t){var n=Y8(e),o=0,c=[],u;for(u in n)!Pu(Z8,u)&&Pu(n,u)&&Lh(c,u);for(;t.length>o;)Pu(n,u=t[o++])&&(~K8(c,u)||Lh(c,u));return c},Td=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Q8=fm,q8=Td,J8=q8.concat("length","prototype");bc.f=Object.getOwnPropertyNames||function(t){return Q8(t,J8)};var dm={};dm.f=Object.getOwnPropertySymbols;var e4=In,t4=dt,r4=bc,n4=dm,i4=Gr,s4=t4([].concat),o4=e4("Reflect","ownKeys")||function(t){var n=r4.f(i4(t)),o=n4.f;return o?s4(n,o(t)):n},Bh=ur,a4=o4,l4=pd,c4=wr,u4=function(e,t,n){for(var o=a4(t),c=c4.f,u=l4.f,g=0;g<o.length;g++){var x=o[g];!Bh(e,x)&&!(n&&Bh(n,x))&&c(e,x,u(t,x))}},f4=lt,d4=Ct,h4=/#|\.prototype\./,oa=function(e,t){var n=p4[g4(e)];return n===x4?!0:n===m4?!1:d4(t)?f4(t):!!t},g4=oa.normalize=function(e){return String(e).replace(h4,".").toLowerCase()},p4=oa.data={},m4=oa.NATIVE="N",x4=oa.POLYFILL="P",hm=oa,ka=ft,w4=pd.f,v4=yc,y4=ri,E4=Cd,C4=u4,b4=hm,cn=function(e,t){var n=e.target,o=e.global,c=e.stat,u,g,x,w,m,C;if(o?g=ka:c?g=ka[n]||E4(n,{}):g=ka[n]&&ka[n].prototype,g)for(x in t){if(m=t[x],e.dontCallGetSet?(C=w4(g,x),w=C&&C.value):w=g[x],u=b4(o?x:n+(c?".":"#")+x,e.forced),!u&&w!==void 0){if(typeof m==typeof w)continue;C4(m,w)}(e.sham||w&&w.sham)&&v4(m,"sham",!0),y4(g,x,m,e)}},gm={},A4=fm,S4=Td,pm=Object.keys||function(t){return A4(t,S4)},I4=Kt,T4=rm,R4=wr,_4=Gr,O4=Ds,N4=pm;gm.f=I4&&!T4?Object.defineProperties:function(t,n){_4(t);for(var o=O4(n),c=N4(n),u=c.length,g=0,x;u>g;)R4.f(t,x=c[g++],o[x]);return t};var k4=In,M4=k4("document","documentElement"),D4=Gr,P4=gm,Fh=Td,L4=Ec,B4=M4,F4=em,U4=Ad,Uh=">",jh="<",zf="prototype",Vf="script",mm=U4("IE_PROTO"),Lu=function(){},xm=function(e){return jh+Vf+Uh+e+jh+"/"+Vf+Uh},Wh=function(e){e.write(xm("")),e.close();var t=e.parentWindow.Object;return e=null,t},j4=function(){var e=F4("iframe"),t="java"+Vf+":",n;return e.style.display="none",B4.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(xm("document.F=Object")),n.close(),n.F},Ma,fl=function(){try{Ma=new ActiveXObject("htmlfile")}catch{}fl=typeof document<"u"?document.domain&&Ma?Wh(Ma):j4():Wh(Ma);for(var e=Fh.length;e--;)delete fl[zf][Fh[e]];return fl()};L4[mm]=!0;var Ac=Object.create||function(t,n){var o;return t!==null?(Lu[zf]=D4(t),o=new Lu,Lu[zf]=null,o[mm]=t):o=fl(),n===void 0?o:P4.f(o,n)},W4=Hr,$4=Ac,z4=wr.f,Hf=W4("unscopables"),Gf=Array.prototype;Gf[Hf]===void 0&&z4(Gf,Hf,{configurable:!0,value:$4(null)});var Sc=function(e){Gf[Hf][e]=!0},V4=cn,H4=ia,G4=sa,X4=Id,Y4=Sc;V4({target:"Array",proto:!0},{at:function(t){var n=H4(this),o=G4(n),c=X4(t),u=c>=0?c:o+c;return u<0||u>=o?void 0:n[u]}});Y4("at");var K4=ft,Z4=dt,Rd=function(e,t){return Z4(K4[e].prototype[t])},Q4=Rd;Q4("Array","at");var q4=Mi,J4=dt,eC=function(e){if(q4(e)==="Function")return J4(e)},$h=eC,tC=yd,rC=md,nC=$h($h.bind),_d=function(e,t){return tC(e),t===void 0?e:rC?nC(e,t):function(){return e.apply(t,arguments)}},iC=_d,sC=H2,oC=ia,aC=sa,zh=function(e){var t=e===1;return function(n,o,c){for(var u=oC(n),g=sC(u),x=aC(g),w=iC(o,c),m,C;x-- >0;)if(m=g[x],C=w(m,x,u),C)switch(e){case 0:return m;case 1:return x}return t?-1:void 0}},wm={findLast:zh(0),findLastIndex:zh(1)},lC=cn,cC=wm.findLast,uC=Sc;lC({target:"Array",proto:!0},{findLast:function(t){return cC(this,t,arguments.length>1?arguments[1]:void 0)}});uC("findLast");var fC=Rd;fC("Array","findLast");var dC=cn,hC=wm.findLastIndex,gC=Sc;dC({target:"Array",proto:!0},{findLastIndex:function(t){return hC(this,t,arguments.length>1?arguments[1]:void 0)}});gC("findLastIndex");var pC=Rd;pC("Array","findLastIndex");var mC=Hr,xC=mC("toStringTag"),vm={};vm[xC]="z";var Od=String(vm)==="[object z]",wC=Od,vC=Ct,dl=Mi,yC=Hr,EC=yC("toStringTag"),CC=Object,bC=dl(function(){return arguments}())==="Arguments",AC=function(e,t){try{return e[t]}catch{}},Ic=wC?dl:function(e){var t,n,o;return e===void 0?"Undefined":e===null?"Null":typeof(n=AC(t=CC(e),EC))=="string"?n:bC?dl(t):(o=dl(t))==="Object"&&vC(t.callee)?"Arguments":o},SC=Ic,IC=String,TC=function(e){if(SC(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return IC(e)},RC=TC,Nd=function(e,t){return e===void 0?arguments.length<2?"":t:RC(e)},_C=Kt,OC=lt,NC=Gr,Vh=Nd,hl=Error.prototype.toString,kC=OC(function(){if(_C){var e=Object.create(Object.defineProperty({},"name",{get:function(){return this===e}}));if(hl.call(e)!=="true")return!0}return hl.call({message:1,name:2})!=="2: 1"||hl.call({})!=="Error"}),ym=kC?function(){var t=NC(this),n=Vh(t.name,"Error"),o=Vh(t.message);return n?o?n+": "+o:n:o}:hl,MC=ri,Hh=ym,Gh=Error.prototype;Gh.toString!==Hh&&MC(Gh,"toString",Hh);var Tc=Object.create?Object.create(null):{},DC=lt,PC=!DC(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),LC=ur,BC=Ct,FC=ia,UC=Ad,jC=PC,Xh=UC("IE_PROTO"),Xf=Object,WC=Xf.prototype,Em=jC?Xf.getPrototypeOf:function(e){var t=FC(e);if(LC(t,Xh))return t[Xh];var n=t.constructor;return BC(n)&&t instanceof n?n.prototype:t instanceof Xf?WC:null},$C=lt,zC=Ct,VC=xr,Yh=Em,HC=ri,GC=Hr,Yf=GC("iterator"),Cm=!1,Si,Bu,Fu;[].keys&&(Fu=[].keys(),"next"in Fu?(Bu=Yh(Yh(Fu)),Bu!==Object.prototype&&(Si=Bu)):Cm=!0);var XC=!VC(Si)||$C(function(){var e={};return Si[Yf].call(e)!==e});XC&&(Si={});zC(Si[Yf])||HC(Si,Yf,function(){return this});var bm={IteratorPrototype:Si,BUGGY_SAFARI_ITERATORS:Cm},YC=wr.f,KC=ur,ZC=Hr,Kh=ZC("toStringTag"),Rc=function(e,t,n){e&&!n&&(e=e.prototype),e&&!KC(e,Kh)&&YC(e,Kh,{configurable:!0,value:t})},QC=bm.IteratorPrototype,qC=Ac,JC=ki,e6=Rc,t6=Tc,r6=function(){return this},n6=function(e,t,n,o){var c=t+" Iterator";return e.prototype=qC(QC,{next:JC(+!o,n)}),e6(e,c,!1),t6[c]=r6,e},i6=dt,s6=yd,o6=function(e,t,n){try{return i6(s6(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},a6=xr,l6=function(e){return a6(e)||e===null},c6=l6,u6=String,f6=TypeError,d6=function(e){if(c6(e))return e;throw new f6("Can't set "+u6(e)+" as a prototype")},h6=o6,g6=xr,p6=xd,m6=d6,Am=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},n;try{n=h6(Object.prototype,"__proto__","set"),n(t,[]),e=t instanceof Array}catch{}return function(c,u){return p6(c),m6(u),g6(c)&&(e?n(c,u):c.__proto__=u),c}}():void 0),x6=cn,w6=Sn,Sm=om,v6=Ct,y6=n6,Zh=Em,Qh=Am,E6=Rc,C6=yc,Uu=ri,b6=Hr,A6=Tc,Im=bm,S6=Sm.PROPER,I6=Sm.CONFIGURABLE,qh=Im.IteratorPrototype,Da=Im.BUGGY_SAFARI_ITERATORS,Zs=b6("iterator"),Jh="keys",Qs="values",eg="entries",T6=function(){return this},Tm=function(e,t,n,o,c,u,g){y6(n,t,o);var x=function(N){if(N===c&&A)return A;if(!Da&&N&&N in C)return C[N];switch(N){case Jh:return function(){return new n(this,N)};case Qs:return function(){return new n(this,N)};case eg:return function(){return new n(this,N)}}return function(){return new n(this)}},w=t+" Iterator",m=!1,C=e.prototype,b=C[Zs]||C["@@iterator"]||c&&C[c],A=!Da&&b||x(c),T=t==="Array"&&C.entries||b,k,M,G;if(T&&(k=Zh(T.call(new e)),k!==Object.prototype&&k.next&&(Zh(k)!==qh&&(Qh?Qh(k,qh):v6(k[Zs])||Uu(k,Zs,T6)),E6(k,w,!0))),S6&&c===Qs&&b&&b.name!==Qs&&(I6?C6(C,"name",Qs):(m=!0,A=function(){return w6(b,this)})),c)if(M={values:x(Qs),keys:u?A:x(Jh),entries:x(eg)},g)for(G in M)(Da||m||!(G in C))&&Uu(C,G,M[G]);else x6({target:t,proto:!0,forced:Da||m},M);return C[Zs]!==A&&Uu(C,Zs,A,{name:c}),A6[t]=A,M},Rm=function(e,t){return{value:e,done:t}},R6=Ds,kd=Sc,tg=Tc,_m=Cc,_6=wr.f,O6=Tm,Pa=Rm,N6=Kt,Om="Array Iterator",k6=_m.set,M6=_m.getterFor(Om);O6(Array,"Array",function(e,t){k6(this,{type:Om,target:R6(e),index:0,kind:t})},function(){var e=M6(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,Pa(void 0,!0);switch(e.kind){case"keys":return Pa(n,!1);case"values":return Pa(t[n],!1)}return Pa([n,t[n]],!1)},"values");var rg=tg.Arguments=tg.Array;kd("keys");kd("values");kd("entries");if(N6&&rg.name!=="values")try{_6(rg,"name",{value:"values"})}catch{}var D6=cn,P6=ia,Nm=pm,L6=lt,B6=L6(function(){Nm(1)});D6({target:"Object",stat:!0,forced:B6},{keys:function(t){return Nm(P6(t))}});var F6=Od,U6=Ic,j6=F6?{}.toString:function(){return"[object "+U6(this)+"]"},W6=Od,$6=ri,z6=j6;W6||$6(Object.prototype,"toString",z6,{unsafe:!0});var km={exports:{}},Mm={},V6=dt,H6=V6([].slice),G6=Mi,X6=Ds,Dm=bc.f,Y6=H6,Pm=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],K6=function(e){try{return Dm(e)}catch{return Y6(Pm)}};Mm.f=function(t){return Pm&&G6(t)==="Window"?K6(t):Dm(X6(t))};var Z6=lt,Q6=Z6(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),q6=lt,J6=xr,eb=Mi,ng=Q6,gl=Object.isExtensible,tb=q6(function(){gl(1)}),rb=tb||ng?function(t){return!J6(t)||ng&&eb(t)==="ArrayBuffer"?!1:gl?gl(t):!0}:gl,nb=lt,ib=!nb(function(){return Object.isExtensible(Object.preventExtensions({}))}),sb=cn,ob=dt,ab=Ec,lb=xr,Md=ur,cb=wr.f,ig=bc,ub=Mm,Dd=rb,fb=vc,db=ib,Lm=!1,vn=fb("meta"),hb=0,Pd=function(e){cb(e,vn,{value:{objectID:"O"+hb++,weakData:{}}})},gb=function(e,t){if(!lb(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!Md(e,vn)){if(!Dd(e))return"F";if(!t)return"E";Pd(e)}return e[vn].objectID},pb=function(e,t){if(!Md(e,vn)){if(!Dd(e))return!0;if(!t)return!1;Pd(e)}return e[vn].weakData},mb=function(e){return db&&Lm&&Dd(e)&&!Md(e,vn)&&Pd(e),e},xb=function(){wb.enable=function(){},Lm=!0;var e=ig.f,t=ob([].splice),n={};n[vn]=1,e(n).length&&(ig.f=function(o){for(var c=e(o),u=0,g=c.length;u<g;u++)if(c[u]===vn){t(c,u,1);break}return c},sb({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:ub.f}))},wb=km.exports={enable:xb,fastKey:gb,getWeakData:pb,onFreeze:mb};ab[vn]=!0;var Bm=km.exports,vb=Hr,yb=Tc,Eb=vb("iterator"),Cb=Array.prototype,bb=function(e){return e!==void 0&&(yb.Array===e||Cb[Eb]===e)},Ab=Mi,Sb=Ms,sg=Ed,Ib=Hr,og=Ib("iterator"),Tb=Array.prototype,Fm=function(e){if(!Sb(e))return sg(e,og)||sg(e,"@@iterator")||(Ab(e)==="Arguments"?Tb[og]:void 0)},Rb=Sn,_b=Ct,Ob=Gr,Nb=vd,kb=Fm,Mb=TypeError,Db=function(e,t){var n=arguments.length<2?kb(e):t;if(_b(n))return Ob(Rb(n,e));throw new Mb(Nb(e)+" is not iterable")},Pb=Sn,ag=Gr,Lb=Ed,Bb=function(e,t,n){var o,c;ag(e);try{if(o=Lb(e,"return"),!o){if(t==="throw")throw n;return n}o=Pb(o,e)}catch(u){c=!0,o=u}if(t==="throw")throw n;if(c)throw o;return ag(o),n},Fb=_d,Ub=Sn,jb=Gr,Wb=vd,$b=bb,zb=sa,lg=wc,Vb=Db,Hb=Fm,cg=Bb,Gb=TypeError,pl=function(e,t){this.stopped=e,this.result=t},ug=pl.prototype,Ld=function(e,t,n){var o=n&&n.that,c=!!(n&&n.AS_ENTRIES),u=!!(n&&n.IS_RECORD),g=!!(n&&n.IS_ITERATOR),x=!!(n&&n.INTERRUPTED),w=Fb(t,o),m,C,b,A,T,k,M,G=function(O){var B=m;return m=void 0,B&&cg(B,"normal"),new pl(!0,O)},N=function(O){return c?(jb(O),x?w(O[0],O[1],G):w(O[0],O[1])):x?w(O,G):w(O)};if(u)m=e.iterator;else if(g)m=e;else{if(C=Hb(e),!C)throw new Gb(Wb(e)+" is not iterable");if($b(C)){for(b=0,A=zb(e);A>b;b++)if(T=N(e[b]),T&&lg(ug,T))return T;return new pl(!1)}m=Vb(e,C)}for(k=u?e.next:m.next;!(M=Ub(k,m)).done;){var I=M.value;try{T=N(I)}catch(O){if(m)cg(m,"throw",O);else throw O}if(typeof T=="object"&&T&&lg(ug,T))return T}return new pl(!1)},Xb=wc,Yb=TypeError,_c=function(e,t){if(Xb(t,e))return e;throw new Yb("Incorrect invocation")},Kb=Hr,Um=Kb("iterator"),jm=!1;try{var Zb=0,fg={next:function(){return{done:!!Zb++}},return:function(){jm=!0}};fg[Um]=function(){return this},Array.from(fg,function(){throw 2})}catch{}var Qb=function(e,t){try{if(!t&&!jm)return!1}catch{return!1}var n=!1;try{var o={};o[Um]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch{}return n},qb=Ct,Jb=xr,dg=Am,Wm=function(e,t,n){var o,c;return dg&&qb(o=t.constructor)&&o!==n&&Jb(c=o.prototype)&&c!==n.prototype&&dg(e,c),e},eA=cn,tA=ft,rA=dt,hg=hm,nA=ri,iA=Bm,sA=Ld,oA=_c,aA=Ct,lA=Ms,ju=xr,Wu=lt,cA=Qb,uA=Rc,fA=Wm,$m=function(e,t,n){var o=e.indexOf("Map")!==-1,c=e.indexOf("Weak")!==-1,u=o?"set":"add",g=tA[e],x=g&&g.prototype,w=g,m={},C=function(N){var I=rA(x[N]);nA(x,N,N==="add"?function(B){return I(this,B===0?0:B),this}:N==="delete"?function(O){return c&&!ju(O)?!1:I(this,O===0?0:O)}:N==="get"?function(B){return c&&!ju(B)?void 0:I(this,B===0?0:B)}:N==="has"?function(B){return c&&!ju(B)?!1:I(this,B===0?0:B)}:function(B,j){return I(this,B===0?0:B,j),this})},b=hg(e,!aA(g)||!(c||x.forEach&&!Wu(function(){new g().entries().next()})));if(b)w=n.getConstructor(t,e,o,u),iA.enable();else if(hg(e,!0)){var A=new w,T=A[u](c?{}:-0,1)!==A,k=Wu(function(){A.has(1)}),M=cA(function(N){new g(N)}),G=!c&&Wu(function(){for(var N=new g,I=5;I--;)N[u](I,I);return!N.has(-0)});M||(w=t(function(N,I){oA(N,x);var O=fA(new g,N,w);return lA(I)||sA(I,O[u],{that:O,AS_ENTRIES:o}),O}),w.prototype=x,x.constructor=w),(k||G)&&(C("delete"),C("has"),o&&C("get")),(G||T)&&C(u),c&&x.clear&&delete x.clear}return m[e]=w,eA({global:!0,constructor:!0,forced:w!==g},m),uA(w,e),c||n.setStrong(w,e,o),w},gg=um,dA=wr,Bd=function(e,t,n){return n.get&&gg(n.get,t,{getter:!0}),n.set&&gg(n.set,t,{setter:!0}),dA.f(e,t,n)},hA=ri,gA=function(e,t,n){for(var o in t)hA(e,o,t[o],n);return e},pA=In,mA=Bd,xA=Hr,wA=Kt,pg=xA("species"),vA=function(e){var t=pA(e);wA&&t&&!t[pg]&&mA(t,pg,{configurable:!0,get:function(){return this}})},mg=Ac,yA=Bd,xg=gA,EA=_d,CA=_c,bA=Ms,AA=Ld,SA=Tm,La=Rm,IA=vA,qs=Kt,wg=Bm.fastKey,zm=Cc,vg=zm.set,$u=zm.getterFor,Vm={getConstructor:function(e,t,n,o){var c=e(function(m,C){CA(m,u),vg(m,{type:t,index:mg(null),first:null,last:null,size:0}),qs||(m.size=0),bA(C)||AA(C,m[o],{that:m,AS_ENTRIES:n})}),u=c.prototype,g=$u(t),x=function(m,C,b){var A=g(m),T=w(m,C),k,M;return T?T.value=b:(A.last=T={index:M=wg(C,!0),key:C,value:b,previous:k=A.last,next:null,removed:!1},A.first||(A.first=T),k&&(k.next=T),qs?A.size++:m.size++,M!=="F"&&(A.index[M]=T)),m},w=function(m,C){var b=g(m),A=wg(C),T;if(A!=="F")return b.index[A];for(T=b.first;T;T=T.next)if(T.key===C)return T};return xg(u,{clear:function(){for(var C=this,b=g(C),A=b.first;A;)A.removed=!0,A.previous&&(A.previous=A.previous.next=null),A=A.next;b.first=b.last=null,b.index=mg(null),qs?b.size=0:C.size=0},delete:function(m){var C=this,b=g(C),A=w(C,m);if(A){var T=A.next,k=A.previous;delete b.index[A.index],A.removed=!0,k&&(k.next=T),T&&(T.previous=k),b.first===A&&(b.first=T),b.last===A&&(b.last=k),qs?b.size--:C.size--}return!!A},forEach:function(C){for(var b=g(this),A=EA(C,arguments.length>1?arguments[1]:void 0),T;T=T?T.next:b.first;)for(A(T.value,T.key,this);T&&T.removed;)T=T.previous},has:function(C){return!!w(this,C)}}),xg(u,n?{get:function(C){var b=w(this,C);return b&&b.value},set:function(C,b){return x(this,C===0?0:C,b)}}:{add:function(C){return x(this,C=C===0?0:C,C)}}),qs&&yA(u,"size",{configurable:!0,get:function(){return g(this).size}}),c},setStrong:function(e,t,n){var o=t+" Iterator",c=$u(t),u=$u(o);SA(e,t,function(g,x){vg(this,{type:o,target:g,state:c(g),kind:x,last:null})},function(){for(var g=u(this),x=g.kind,w=g.last;w&&w.removed;)w=w.previous;return!g.target||!(g.last=w=w?w.next:g.state.first)?(g.target=null,La(void 0,!0)):La(x==="keys"?w.key:x==="values"?w.value:[w.key,w.value],!1)},n?"entries":"values",!n,!0),IA(t)}},TA=$m,RA=Vm;TA("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},RA);var _A=$m,OA=Vm;_A("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},OA);var Js=ft,NA=G2,kA=Mi,Ba=function(e){return NA.slice(0,e.length)===e},Hm=function(){return Ba("Bun/")?"BUN":Ba("Cloudflare-Workers")?"CLOUDFLARE":Ba("Deno/")?"DENO":Ba("Node.js/")?"NODE":Js.Bun&&typeof Bun.version=="string"?"BUN":Js.Deno&&typeof Deno.version=="object"?"DENO":kA(Js.process)==="process"?"NODE":Js.window&&Js.document?"BROWSER":"REST"}(),MA=Hm,DA=MA==="NODE",PA=ft,LA=DA,Gm=function(e){if(LA){try{return PA.process.getBuiltinModule(e)}catch{}try{return Function('return require("'+e+'")')()}catch{}}},Xm={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},BA=dt,Ym=Error,FA=BA("".replace),UA=function(e){return String(new Ym(e).stack)}("zxcasd"),Km=/\n\s*at [^:]*:[^\n]*/,jA=Km.test(UA),Zm=function(e,t){if(jA&&typeof e=="string"&&!Ym.prepareStackTrace)for(;t--;)e=FA(e,Km,"");return e},WA=cn,Pl=In,$A=Gm,Fd=lt,zA=Ac,Ud=ki,Ll=wr.f,VA=ri,ml=Bd,xl=ur,HA=_c,GA=Gr,Qm=ym,yg=Nd,ds=Xm,XA=Zm,qm=Cc,jd=Kt,ys="DOMException",Kf="DATA_CLONE_ERR",Oc=Pl("Error"),yn=Pl(ys)||function(){try{var e=Pl("MessageChannel")||$A("worker_threads").MessageChannel;new e().port1.postMessage(new WeakMap)}catch(t){if(t.name===Kf&&t.code===25)return t.constructor}}(),YA=yn&&yn.prototype,Jm=Oc.prototype,KA=qm.set,ZA=qm.getterFor(ys),QA="stack"in new Oc(ys),ex=function(e){return xl(ds,e)&&ds[e].m?ds[e].c:0},Wd=function(){HA(this,vo);var t=arguments.length,n=yg(t<1?void 0:arguments[0]),o=yg(t<2?void 0:arguments[1],"Error"),c=ex(o);if(KA(this,{type:ys,name:o,message:n,code:c}),jd||(this.name=o,this.message=n,this.code=c),QA){var u=new Oc(n);u.name=ys,Ll(this,"stack",Ud(1,XA(u.stack,1)))}},vo=Wd.prototype=zA(Jm),tx=function(e){return{enumerable:!0,configurable:!0,get:e}},zu=function(e){return tx(function(){return ZA(this)[e]})};jd&&(ml(vo,"code",zu("code")),ml(vo,"message",zu("message")),ml(vo,"name",zu("name")));Ll(vo,"constructor",Ud(1,Wd));var Nc=Fd(function(){return!(new yn instanceof Oc)}),qA=Nc||Fd(function(){return Jm.toString!==Qm||String(new yn(1,2))!=="2: 1"}),JA=Nc||Fd(function(){return new yn(1,"DataCloneError").code!==25});Nc||yn[Kf]!==25||YA[Kf];var Eg=Nc;WA({global:!0,constructor:!0,forced:Eg},{DOMException:Eg?Wd:yn});var Do=Pl(ys),Bl=Do.prototype;qA&&yn===Do&&VA(Bl,"toString",Qm);JA&&jd&&yn===Do&&ml(Bl,"code",tx(function(){return ex(GA(this).name)}));for(var Cg in ds)if(xl(ds,Cg)){var bg=ds[Cg],Fa=bg.s,Ag=Ud(6,bg.c);xl(Do,Fa)||Ll(Do,Fa,Ag),xl(Bl,Fa)||Ll(Bl,Fa,Ag)}var eS=cn,tS=ft,$d=In,Zf=ki,Qf=wr.f,Sg=ur,rS=_c,nS=Wm,Ig=Nd,Vu=Xm,iS=Zm,sS=Kt,aa="DOMException",rx=$d("Error"),la=$d(aa),zd=function(){rS(this,oS);var t=arguments.length,n=Ig(t<1?void 0:arguments[0]),o=Ig(t<2?void 0:arguments[1],"Error"),c=new la(n,o),u=new rx(n);return u.name=aa,Qf(c,"stack",Zf(1,iS(u.stack,1))),nS(c,this,zd),c},oS=zd.prototype=la.prototype,aS="stack"in new rx(aa),lS="stack"in new la(1,2),Hu=la&&sS&&Object.getOwnPropertyDescriptor(tS,aa),cS=!!Hu&&!(Hu.writable&&Hu.configurable),Tg=aS&&!cS&&!lS;eS({global:!0,constructor:!0,forced:Tg},{DOMException:Tg?zd:la});var uo=$d(aa),Rg=uo.prototype;if(Rg.constructor!==uo){Qf(Rg,"constructor",Zf(1,uo));for(var _g in Vu)if(Sg(Vu,_g)){var Og=Vu[_g],Ng=Og.s;Sg(uo,Ng)||Qf(uo,Ng,Zf(6,Og.c))}}var uS=In,fS=Rc,kg="DOMException";fS(uS(kg),kg);var dS=dt,hS=lt,nx=Ct,gS=Ic,pS=In,mS=am,ix=function(){},sx=pS("Reflect","construct"),Vd=/^\s*(?:class|function)\b/,xS=dS(Vd.exec),wS=!Vd.test(ix),eo=function(t){if(!nx(t))return!1;try{return sx(ix,[],t),!0}catch{return!1}},ox=function(t){if(!nx(t))return!1;switch(gS(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return wS||!!xS(Vd,mS(t))}catch{return!0}};ox.sham=!0;var vS=!sx||hS(function(){var e;return eo(eo.call)||!eo(Object)||!eo(function(){e=!0})||e})?ox:eo,yS=Kt,ES=wr,CS=ki,bS=function(e,t,n){yS?ES.f(e,t,CS(0,n)):e[t]=n},AS=TypeError,SS=function(e,t){if(e<t)throw new AS("Not enough arguments");return e},IS=ft,TS=lt,Mg=IS.RegExp,RS=!TS(function(){var e=!0;try{Mg(".","d")}catch{e=!1}var t={},n="",o=e?"dgimsy":"gimsy",c=function(w,m){Object.defineProperty(t,w,{get:function(){return n+=m,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};e&&(u.hasIndices="d");for(var g in u)c(g,u[g]);var x=Object.getOwnPropertyDescriptor(Mg.prototype,"flags").get.call(t);return x!==o||n!==o}),_S={correct:RS},OS=Gr,NS=function(){var e=OS(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},kS=Sn,MS=ur,DS=wc,Dg=_S,PS=NS,LS=RegExp.prototype,BS=Dg.correct?function(e){return e.flags}:function(e){return!Dg.correct&&DS(LS,e)&&!MS(e,"flags")?kS(PS,e):e.flags},Ua=dt,ja=Map.prototype,FS={Map,set:Ua(ja.set),get:Ua(ja.get),has:Ua(ja.has),remove:Ua(ja.delete)},Gu=dt,Wa=Set.prototype,ax={Set,add:Gu(Wa.add),has:Gu(Wa.has),remove:Gu(Wa.delete),proto:Wa},US=Sn,jS=function(e,t,n){for(var o=n?e:e.iterator,c=e.next,u,g;!(u=US(c,o)).done;)if(g=t(u.value),g!==void 0)return g},lx=dt,WS=jS,cx=ax,$S=cx.Set,ux=cx.proto,zS=lx(ux.forEach),fx=lx(ux.keys),VS=fx(new $S).next,HS=function(e,t,n){return n?WS({iterator:fx(e),next:VS},t):zS(e,t)},GS=ft,XS=lt,Xu=Y2,Yu=Hm,Pg=GS.structuredClone,dx=!!Pg&&!XS(function(){if(Yu==="DENO"&&Xu>92||Yu==="NODE"&&Xu>94||Yu==="BROWSER"&&Xu>97)return!1;var e=new ArrayBuffer(8),t=Pg(e,{transfer:[e]});return e.byteLength!==0||t.byteLength!==8}),Hd=ft,YS=Gm,KS=dx,ZS=Hd.structuredClone,Lg=Hd.ArrayBuffer,$a=Hd.MessageChannel,qf=!1,Ku,Bg,za,Zu;if(KS)qf=function(e){ZS(e,{transfer:[e]})};else if(Lg)try{$a||(Ku=YS("worker_threads"),Ku&&($a=Ku.MessageChannel)),$a&&(Bg=new $a,za=new Lg(2),Zu=function(e){Bg.port1.postMessage(null,[e])},za.byteLength===2&&(Zu(za),za.byteLength===0&&(qf=Zu)))}catch{}var QS=qf,qS=lt,JS=ki,eI=!qS(function(){var e=new Error("a");return"stack"in e?(Object.defineProperty(e,"stack",JS(1,7)),e.stack!==7):!0}),tI=cn,Pt=ft,yo=In,ca=dt,Gd=lt,rI=vc,Es=Ct,nI=vS,iI=Ms,kc=xr,sI=wd,oI=Ld,hx=Gr,Fl=Ic,aI=ur,lI=bS,Qu=yc,wl=sa,cI=SS,uI=BS,Mc=FS,Xd=ax,fI=HS,Fg=QS,dI=eI,Yd=dx,fo=Pt.Object,hI=Pt.Array,gx=Pt.Date,px=Pt.Error,gI=Pt.TypeError,pI=Pt.PerformanceMark,Ii=yo("DOMException"),Jf=Mc.Map,Kd=Mc.has,mx=Mc.get,Ul=Mc.set,xx=Xd.Set,wx=Xd.add,mI=Xd.has,xI=yo("Object","keys"),wI=ca([].push),vI=ca((!0).valueOf),yI=ca(1.1.valueOf),EI=ca("".valueOf),CI=ca(gx.prototype.getTime),e1=rI("structuredClone"),Po="DataCloneError",vl="Transferring",vx=function(e){return!Gd(function(){var t=new Pt.Set([7]),n=e(t),o=e(fo(7));return n===t||!n.has(7)||!kc(o)||+o!=7})&&e},Ug=function(e,t){return!Gd(function(){var n=new t,o=e({a:n,b:n});return!(o&&o.a===o.b&&o.a instanceof t&&o.a.stack===n.stack)})},bI=function(e){return!Gd(function(){var t=e(new Pt.AggregateError([1],e1,{cause:3}));return t.name!=="AggregateError"||t.errors[0]!==1||t.message!==e1||t.cause!==3})},Ei=Pt.structuredClone,AI=!Ug(Ei,px)||!Ug(Ei,Ii)||!bI(Ei),SI=!Ei&&vx(function(e){return new pI(e1,{detail:e}).detail}),$n=vx(Ei)||SI,qu=function(e){throw new Ii("Uncloneable type: "+e,Po)},ir=function(e,t){throw new Ii((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",Po)},Ju=function(e,t){return $n||ir(t),$n(e)},II=function(){var e;try{e=new Pt.DataTransfer}catch{try{e=new Pt.ClipboardEvent("").clipboardData}catch{}}return e&&e.items&&e.files?e:null},yx=function(e,t,n){if(Kd(t,e))return mx(t,e);var o=n||Fl(e),c,u,g,x,w,m;if(o==="SharedArrayBuffer")$n?c=$n(e):c=e;else{var C=Pt.DataView;!C&&!Es(e.slice)&&ir("ArrayBuffer");try{if(Es(e.slice)&&!e.resizable)c=e.slice(0);else for(u=e.byteLength,g=("maxByteLength"in e)?{maxByteLength:e.maxByteLength}:void 0,c=new ArrayBuffer(u,g),x=new C(e),w=new C(c),m=0;m<u;m++)w.setUint8(m,x.getUint8(m))}catch{throw new Ii("ArrayBuffer is detached",Po)}}return Ul(t,e,c),c},TI=function(e,t,n,o,c){var u=Pt[t];return kc(u)||ir(t),new u(yx(e.buffer,c),n,o)},Mt=function(e,t){if(sI(e)&&qu("Symbol"),!kc(e))return e;if(t){if(Kd(t,e))return mx(t,e)}else t=new Jf;var n=Fl(e),o,c,u,g,x,w,m,C;switch(n){case"Array":u=hI(wl(e));break;case"Object":u={};break;case"Map":u=new Jf;break;case"Set":u=new xx;break;case"RegExp":u=new RegExp(e.source,uI(e));break;case"Error":switch(c=e.name,c){case"AggregateError":u=new(yo(c))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":u=new(yo(c));break;case"CompileError":case"LinkError":case"RuntimeError":u=new(yo("WebAssembly",c));break;default:u=new px}break;case"DOMException":u=new Ii(e.message,e.name);break;case"ArrayBuffer":case"SharedArrayBuffer":u=yx(e,t,n);break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float16Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":w=n==="DataView"?e.byteLength:e.length,u=TI(e,n,e.byteOffset,w,t);break;case"DOMQuad":try{u=new DOMQuad(Mt(e.p1,t),Mt(e.p2,t),Mt(e.p3,t),Mt(e.p4,t))}catch{u=Ju(e,n)}break;case"File":if($n)try{u=$n(e),Fl(u)!==n&&(u=void 0)}catch{}if(!u)try{u=new File([e],e.name,e)}catch{}u||ir(n);break;case"FileList":if(g=II(),g){for(x=0,w=wl(e);x<w;x++)g.items.add(Mt(e[x],t));u=g.files}else u=Ju(e,n);break;case"ImageData":try{u=new ImageData(Mt(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch{u=Ju(e,n)}break;default:if($n)u=$n(e);else switch(n){case"BigInt":u=fo(e.valueOf());break;case"Boolean":u=fo(vI(e));break;case"Number":u=fo(yI(e));break;case"String":u=fo(EI(e));break;case"Date":u=new gx(CI(e));break;case"Blob":try{u=e.slice(0,e.size,e.type)}catch{ir(n)}break;case"DOMPoint":case"DOMPointReadOnly":o=Pt[n];try{u=o.fromPoint?o.fromPoint(e):new o(e.x,e.y,e.z,e.w)}catch{ir(n)}break;case"DOMRect":case"DOMRectReadOnly":o=Pt[n];try{u=o.fromRect?o.fromRect(e):new o(e.x,e.y,e.width,e.height)}catch{ir(n)}break;case"DOMMatrix":case"DOMMatrixReadOnly":o=Pt[n];try{u=o.fromMatrix?o.fromMatrix(e):new o(e)}catch{ir(n)}break;case"AudioData":case"VideoFrame":Es(e.clone)||ir(n);try{u=e.clone()}catch{qu(n)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":ir(n);default:qu(n)}}switch(Ul(t,e,u),n){case"Array":case"Object":for(m=xI(e),x=0,w=wl(m);x<w;x++)C=m[x],lI(u,C,Mt(e[C],t));break;case"Map":e.forEach(function(b,A){Ul(u,Mt(A,t),Mt(b,t))});break;case"Set":e.forEach(function(b){wx(u,Mt(b,t))});break;case"Error":Qu(u,"message",Mt(e.message,t)),aI(e,"cause")&&Qu(u,"cause",Mt(e.cause,t)),c==="AggregateError"?u.errors=Mt(e.errors,t):c==="SuppressedError"&&(u.error=Mt(e.error,t),u.suppressed=Mt(e.suppressed,t));case"DOMException":dI&&Qu(u,"stack",Mt(e.stack,t))}return u},RI=function(e,t){if(!kc(e))throw new gI("Transfer option cannot be converted to a sequence");var n=[];oI(e,function(A){wI(n,hx(A))});for(var o=0,c=wl(n),u=new xx,g,x,w,m,C,b;o<c;){if(g=n[o++],x=Fl(g),m=void 0,x==="ArrayBuffer"?mI(u,g):Kd(t,g))throw new Ii("Duplicate transferable",Po);if(x==="ArrayBuffer"){wx(u,g);continue}if(Yd)m=Ei(g,{transfer:[g]});else switch(x){case"ImageBitmap":w=Pt.OffscreenCanvas,nI(w)||ir(x,vl);try{C=new w(g.width,g.height),b=C.getContext("bitmaprenderer"),b.transferFromImageBitmap(g),m=C.transferToImageBitmap()}catch{}break;case"AudioData":case"VideoFrame":(!Es(g.clone)||!Es(g.close))&&ir(x,vl);try{m=g.clone(),g.close()}catch{}break;case"MediaSourceHandle":case"MessagePort":case"MIDIAccess":case"OffscreenCanvas":case"ReadableStream":case"RTCDataChannel":case"TransformStream":case"WebTransportReceiveStream":case"WebTransportSendStream":case"WritableStream":ir(x,vl)}if(m===void 0)throw new Ii("This object cannot be transferred: "+x,Po);Ul(t,g,m)}return u},_I=function(e){fI(e,function(t){Yd?Ei(t,{transfer:[t]}):Es(t.transfer)?t.transfer():Fg?Fg(t):ir("ArrayBuffer",vl)})};tI({global:!0,enumerable:!0,sham:!Yd,forced:AI},{structuredClone:function(t){var n=cI(arguments.length,1)>1&&!iI(arguments[1])?hx(arguments[1]):void 0,o=n?n.transfer:void 0,c,u;o!==void 0&&(c=new Jf,u=RI(o,c));var g=Mt(t,c);return u&&_I(u),g}});var OI=ft,NI=OI,kI=NI;kI.structuredClone;function MI(){typeof AbortSignal.timeout!="function"&&Object.defineProperty(AbortSignal,"timeout",{configurable:!0,writable:!0,value:e=>{const t=new AbortController;return setTimeout(()=>{t.abort(new DOMException("The operation timed out.","TimeoutError"))},e),t.signal}})}const DI=ce.createContext(null),PI=ce.createContext(null),LI={},jg=e=>{let t;const n=new Set,o=(C,b)=>{const A=typeof C=="function"?C(t):C;if(!Object.is(A,t)){const T=t;t=b??(typeof A!="object"||A===null)?A:Object.assign({},t,A),n.forEach(k=>k(t,T))}},c=()=>t,w={setState:o,getState:c,getInitialState:()=>m,subscribe:C=>(n.add(C),()=>n.delete(C)),destroy:()=>{(LI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},m=t=e(o,c,w);return w},BI=e=>e?jg(e):jg;var Ex={exports:{}},Cx={},bx={exports:{}},Ax={};/**
18
+ */var ty=ce,ry=Symbol.for("react.element"),ny=Symbol.for("react.fragment"),iy=Object.prototype.hasOwnProperty,sy=ty.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,oy={key:!0,ref:!0,__self:!0,__source:!0};function F2(e,t,n){var o,c={},u=null,h=null;n!==void 0&&(u=""+n),t.key!==void 0&&(u=""+t.key),t.ref!==void 0&&(h=t.ref);for(o in t)iy.call(t,o)&&!oy.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)c[o]===void 0&&(c[o]=t[o]);return{$$typeof:ry,type:e,key:u,ref:h,props:c,_owner:sy.current}}xc.Fragment=ny;xc.jsx=F2;xc.jsxs=F2;R2.exports=xc;var L=R2.exports;const ay="agentroam:page-activity:v1",ly="agentroam:page-activity-request:v1";function cy(e,t,n){var o;return!n||e.source!==n||e.origin!==t||((o=e.data)==null?void 0:o.type)!==ay||typeof e.data.active!="boolean"?null:e.data.active}function uy(e){let t=e.parent===e,n=!1;const o=new Set,c=()=>t&&e.document.visibilityState!=="hidden";let u=c();const h=()=>{const m=c();m!==u&&(u=m,o.forEach(C=>C()))},x=m=>{const C=cy(m,e.location.origin,e.parent);C!==null&&(t=C,h())};return{active:c,subscribe:m=>(o.add(m),n||(n=!0,e.addEventListener("message",x),e.document.addEventListener("visibilitychange",h),e.parent!==e&&e.parent.postMessage({type:ly},e.location.origin)),()=>{o.delete(m),!o.size&&(e.removeEventListener("message",x),e.document.removeEventListener("visibilitychange",h),n=!1)})}}let fy;function U2(){return fy??(fy=uy(window))}function dy(){return typeof window<"u"&&U2().active()}function U_(){const e=typeof window>"u"?{subscribe:()=>()=>{},active:()=>!1}:U2();return ce.useSyncExternalStore(e.subscribe,e.active,()=>!1)}var Ks=function(e){return e&&e.Math===Math&&e},ft=Ks(typeof globalThis=="object"&&globalThis)||Ks(typeof window=="object"&&window)||Ks(typeof self=="object"&&self)||Ks(typeof pn=="object"&&pn)||Ks(typeof pn=="object"&&pn)||function(){return this}()||Function("return this")(),pd={},lt=function(e){try{return!!e()}catch{return!0}},hy=lt,Kt=!hy(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),gy=lt,md=!gy(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),py=md,Oa=Function.prototype.call,Sn=py?Oa.bind(Oa):function(){return Oa.apply(Oa,arguments)},j2={},W2={}.propertyIsEnumerable,$2=Object.getOwnPropertyDescriptor,my=$2&&!W2.call({1:2},1);j2.f=my?function(t){var n=$2(this,t);return!!n&&n.enumerable}:W2;var ki=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},z2=md,V2=Function.prototype,Bf=V2.call,xy=z2&&V2.bind.bind(Bf,Bf),dt=z2?xy:function(e){return function(){return Bf.apply(e,arguments)}},H2=dt,wy=H2({}.toString),vy=H2("".slice),Mi=function(e){return vy(wy(e),8,-1)},yy=dt,Ey=lt,Cy=Mi,Eu=Object,by=yy("".split),G2=Ey(function(){return!Eu("z").propertyIsEnumerable(0)})?function(e){return Cy(e)==="String"?by(e,""):Eu(e)}:Eu,Ms=function(e){return e==null},Ay=Ms,Sy=TypeError,xd=function(e){if(Ay(e))throw new Sy("Can't call method on "+e);return e},Iy=G2,Ty=xd,Ds=function(e){return Iy(Ty(e))},Cu=typeof document=="object"&&document.all,Ct=typeof Cu>"u"&&Cu!==void 0?function(e){return typeof e=="function"||e===Cu}:function(e){return typeof e=="function"},Ry=Ct,xr=function(e){return typeof e=="object"?e!==null:Ry(e)},bu=ft,_y=Ct,Oy=function(e){return _y(e)?e:void 0},In=function(e,t){return arguments.length<2?Oy(bu[e]):bu[e]&&bu[e][t]},Ny=dt,wc=Ny({}.isPrototypeOf),ky=ft,ph=ky.navigator,mh=ph&&ph.userAgent,X2=mh?String(mh):"",Y2=ft,Au=X2,xh=Y2.process,wh=Y2.Deno,vh=xh&&xh.versions||wh&&wh.version,yh=vh&&vh.v8,jr,Ml;yh&&(jr=yh.split("."),Ml=jr[0]>0&&jr[0]<4?1:+(jr[0]+jr[1]));!Ml&&Au&&(jr=Au.match(/Edge\/(\d+)/),(!jr||jr[1]>=74)&&(jr=Au.match(/Chrome\/(\d+)/),jr&&(Ml=+jr[1])));var K2=Ml,Eh=K2,My=lt,Dy=ft,Py=Dy.String,Z2=!!Object.getOwnPropertySymbols&&!My(function(){var e=Symbol("symbol detection");return!Py(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Eh&&Eh<41}),Ly=Z2,Q2=Ly&&!Symbol.sham&&typeof Symbol.iterator=="symbol",By=In,Fy=Ct,Uy=wc,jy=Q2,Wy=Object,wd=jy?function(e){return typeof e=="symbol"}:function(e){var t=By("Symbol");return Fy(t)&&Uy(t.prototype,Wy(e))},$y=String,vd=function(e){try{return $y(e)}catch{return"Object"}},zy=Ct,Vy=vd,Hy=TypeError,yd=function(e){if(zy(e))return e;throw new Hy(Vy(e)+" is not a function")},Gy=yd,Xy=Ms,Ed=function(e,t){var n=e[t];return Xy(n)?void 0:Gy(n)},Su=Sn,Iu=Ct,Tu=xr,Yy=TypeError,Ky=function(e,t){var n,o;if(t==="string"&&Iu(n=e.toString)&&!Tu(o=Su(n,e))||Iu(n=e.valueOf)&&!Tu(o=Su(n,e))||t!=="string"&&Iu(n=e.toString)&&!Tu(o=Su(n,e)))return o;throw new Yy("Can't convert object to primitive value")},q2={exports:{}},Ch=ft,Zy=Object.defineProperty,Cd=function(e,t){try{Zy(Ch,e,{value:t,configurable:!0,writable:!0})}catch{Ch[e]=t}return t},Qy=ft,qy=Cd,bh="__core-js_shared__",Ah=q2.exports=Qy[bh]||qy(bh,{});(Ah.versions||(Ah.versions=[])).push({version:"3.50.0",mode:"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"});var bd=q2.exports,Sh=bd,Jy=Object.create||Object,J2=function(e,t){return Sh[e]||(Sh[e]=t||Jy(null))},eE=xd,tE=Object,sa=function(e){return tE(eE(e))},rE=dt,nE=sa,iE=rE({}.hasOwnProperty),ur=Object.hasOwn||function(t,n){return iE(nE(t),n)},sE=dt,oE=0,aE=Math.random(),lE=sE(1.1.toString),vc=function(e){return"Symbol("+(e===void 0?"":e)+")_"+lE(++oE+aE,36)},cE=ft,uE=J2,Ih=ur,fE=vc,dE=Z2,hE=Q2,Qi=cE.Symbol,Ru=uE("wks"),gE=hE?Qi.for||Qi:Qi&&Qi.withoutSetter||fE,Hr=function(e){return Ih(Ru,e)||(Ru[e]=dE&&Ih(Qi,e)?Qi[e]:gE("Symbol."+e)),Ru[e]},pE=Sn,Th=xr,Rh=wd,mE=Ed,xE=Ky,wE=Hr,vE=TypeError,yE=wE("toPrimitive"),EE=function(e,t){if(!Th(e)||Rh(e))return e;var n=mE(e,yE),o;if(n){if(t===void 0&&(t="default"),o=pE(n,e,t),!Th(o)||Rh(o))return o;throw new vE("Can't convert object to primitive value")}return t===void 0&&(t="number"),xE(e,t)},CE=EE,bE=wd,em=function(e){var t=CE(e,"string");return bE(t)?t:t+""},AE=ft,_h=xr,Ff=AE.document,SE=_h(Ff)&&_h(Ff.createElement),tm=function(e){return SE?Ff.createElement(e):{}},IE=Kt,TE=lt,RE=tm,rm=!IE&&!TE(function(){return Object.defineProperty(RE("div"),"a",{get:function(){return 7}}).a!==7}),_E=Kt,OE=Sn,NE=j2,kE=ki,ME=Ds,DE=em,PE=ur,LE=rm,Oh=Object.getOwnPropertyDescriptor;pd.f=_E?Oh:function(t,n){if(t=ME(t),n=DE(n),LE)try{return Oh(t,n)}catch{}if(PE(t,n))return kE(!OE(NE.f,t,n),t[n])};var wr={},BE=Kt,FE=lt,nm=BE&&FE(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),UE=xr,jE=String,WE=TypeError,Gr=function(e){if(UE(e))return e;throw new WE(jE(e)+" is not an object")},$E=Kt,zE=rm,VE=nm,Na=Gr,Nh=em,HE=TypeError,_u=Object.defineProperty,GE=Object.getOwnPropertyDescriptor,Ou="enumerable",Nu="configurable",ku="writable";wr.f=$E?VE?function(t,n,o){if(Na(t),n=Nh(n),Na(o),typeof t=="function"&&n==="prototype"&&"value"in o&&ku in o&&!o[ku]){var c=GE(t,n);c&&c[ku]&&(t[n]=o.value,o={configurable:Nu in o?o[Nu]:c[Nu],enumerable:Ou in o?o[Ou]:c[Ou],writable:!1})}return _u(t,n,o)}:_u:function(t,n,o){if(Na(t),n=Nh(n),Na(o),zE)try{return _u(t,n,o)}catch{}if("get"in o||"set"in o)throw new HE("Accessors not supported");return"value"in o&&(t[n]=o.value),t};var XE=Kt,YE=wr,KE=ki,yc=XE?function(e,t,n){return YE.f(e,t,KE(1,n))}:function(e,t,n){return e[t]=n,e},im={exports:{}},Uf=Kt,ZE=ur,sm=Function.prototype,QE=Uf&&Object.getOwnPropertyDescriptor,om=ZE(sm,"name"),qE=om&&(function(){}).name==="something",JE=om&&(!Uf||Uf&&QE(sm,"name").configurable),am={PROPER:qE,CONFIGURABLE:JE},e8=dt,t8=Ct,jf=bd,r8=e8(Function.toString);t8(jf.inspectSource)||(jf.inspectSource=function(e){return r8(e)});var lm=jf.inspectSource,n8=ft,i8=Ct,kh=n8.WeakMap,s8=i8(kh)&&/native code/.test(String(kh)),o8=J2,a8=vc,Mh=o8("keys"),Ad=function(e){return Mh[e]||(Mh[e]=a8(e))},Ec={},l8=s8,cm=ft,c8=xr,u8=yc,Mu=ur,Du=bd,f8=Ad,d8=Ec,Dh="Object already initialized",Wf=cm.TypeError,h8=cm.WeakMap,Dl,Mo,Pl,g8=function(e){return Pl(e)?Mo(e):Dl(e,{})},p8=function(e){return function(t){var n;if(!c8(t)||(n=Mo(t)).type!==e)throw new Wf("Incompatible receiver, "+e+" required");return n}};if(l8||Du.state){var en=Du.state||(Du.state=new h8);en.get=en.get,en.has=en.has,en.set=en.set,Dl=function(e,t){if(en.has(e))throw new Wf(Dh);return t.facade=e,en.set(e,t),t},Mo=function(e){return en.get(e)||{}},Pl=function(e){return en.has(e)}}else{var Gi=f8("state");d8[Gi]=!0,Dl=function(e,t){if(Mu(e,Gi))throw new Wf(Dh);return t.facade=e,u8(e,Gi,t),t},Mo=function(e){return Mu(e,Gi)?e[Gi]:{}},Pl=function(e){return Mu(e,Gi)}}var Cc={set:Dl,get:Mo,has:Pl,enforce:g8,getterFor:p8},Sd=dt,m8=lt,x8=Ct,ka=ur,$f=Kt,w8=am.CONFIGURABLE,v8=lm,um=Cc,y8=um.enforce,E8=um.get,Ph=String,fl=Object.defineProperty,C8=Sd("".slice),b8=Sd("".replace),A8=Sd([].join),S8=$f&&!m8(function(){return fl(function(){},"length",{value:8}).length!==8}),I8=String(String).split("String"),T8=im.exports=function(e,t,n){C8(Ph(t),0,7)==="Symbol("&&(t="["+b8(Ph(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!ka(e,"name")||w8&&e.name!==t)&&($f?fl(e,"name",{value:t,configurable:!0}):e.name=t),S8&&n&&ka(n,"arity")&&e.length!==n.arity&&fl(e,"length",{value:n.arity});try{n&&ka(n,"constructor")&&n.constructor?$f&&fl(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var o=y8(e);return ka(o,"source")||(o.source=A8(I8,typeof t=="string"?t:"")),e};Function.prototype.toString=T8(function(){return x8(this)&&E8(this).source||v8(this)},"toString");var fm=im.exports,R8=Ct,_8=wr,O8=fm,N8=Cd,ri=function(e,t,n,o){o||(o={});var c=o.enumerable,u=o.name!==void 0?o.name:t;if(R8(n)&&O8(n,u,o),o.global)c?e[t]=n:N8(t,n);else{try{o.unsafe?e[t]&&(c=!0):delete e[t]}catch{}c?e[t]=n:_8.f(e,t,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},bc={},k8=Math.ceil,M8=Math.floor,D8=Math.trunc||function(t){var n=+t;return(n>0?M8:k8)(n)},P8=D8,Id=function(e){var t=+e;return t!==t||t===0?0:P8(t)},L8=Id,B8=Math.max,F8=Math.min,U8=function(e,t){var n=L8(e);return n<0?B8(n+t,0):F8(n,t)},j8=Id,W8=Math.min,$8=function(e){var t=j8(e);return t>0?W8(t,9007199254740991):0},z8=$8,oa=function(e){return z8(e.length)},V8=Ds,H8=U8,G8=oa,X8=function(e){return function(t,n,o){var c=V8(t),u=G8(c);if(u===0)return!e&&-1;var h=H8(o,u),x;if(e&&n!==n){for(;u>h;)if(x=c[h++],x!==x)return!0}else for(;u>h;h++)if((e||h in c)&&c[h]===n)return e||h||0;return!e&&-1}},Y8={indexOf:X8(!1)},K8=dt,Pu=ur,Z8=Ds,Q8=Y8.indexOf,q8=Ec,Lh=K8([].push),dm=function(e,t){var n=Z8(e),o=0,c=[],u;for(u in n)!Pu(q8,u)&&Pu(n,u)&&Lh(c,u);for(;t.length>o;)Pu(n,u=t[o++])&&(~Q8(c,u)||Lh(c,u));return c},Td=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],J8=dm,e4=Td,t4=e4.concat("length","prototype");bc.f=Object.getOwnPropertyNames||function(t){return J8(t,t4)};var hm={};hm.f=Object.getOwnPropertySymbols;var r4=In,n4=dt,i4=bc,s4=hm,o4=Gr,a4=n4([].concat),l4=r4("Reflect","ownKeys")||function(t){var n=i4.f(o4(t)),o=s4.f;return o?a4(n,o(t)):n},Bh=ur,c4=l4,u4=pd,f4=wr,d4=function(e,t,n){for(var o=c4(t),c=f4.f,u=u4.f,h=0;h<o.length;h++){var x=o[h];!Bh(e,x)&&!(n&&Bh(n,x))&&c(e,x,u(t,x))}},h4=lt,g4=Ct,p4=/#|\.prototype\./,aa=function(e,t){var n=x4[m4(e)];return n===v4?!0:n===w4?!1:g4(t)?h4(t):!!t},m4=aa.normalize=function(e){return String(e).replace(p4,".").toLowerCase()},x4=aa.data={},w4=aa.NATIVE="N",v4=aa.POLYFILL="P",gm=aa,Ma=ft,y4=pd.f,E4=yc,C4=ri,b4=Cd,A4=d4,S4=gm,cn=function(e,t){var n=e.target,o=e.global,c=e.stat,u,h,x,w,m,C;if(o?h=Ma:c?h=Ma[n]||b4(n,{}):h=Ma[n]&&Ma[n].prototype,h)for(x in t){if(m=t[x],e.dontCallGetSet?(C=y4(h,x),w=C&&C.value):w=h[x],u=S4(o?x:n+(c?".":"#")+x,e.forced),!u&&w!==void 0){if(typeof m==typeof w)continue;A4(m,w)}(e.sham||w&&w.sham)&&E4(m,"sham",!0),C4(h,x,m,e)}},pm={},I4=dm,T4=Td,mm=Object.keys||function(t){return I4(t,T4)},R4=Kt,_4=nm,O4=wr,N4=Gr,k4=Ds,M4=mm;pm.f=R4&&!_4?Object.defineProperties:function(t,n){N4(t);for(var o=k4(n),c=M4(n),u=c.length,h=0,x;u>h;)O4.f(t,x=c[h++],o[x]);return t};var D4=In,P4=D4("document","documentElement"),L4=Gr,B4=pm,Fh=Td,F4=Ec,U4=P4,j4=tm,W4=Ad,Uh=">",jh="<",zf="prototype",Vf="script",xm=W4("IE_PROTO"),Lu=function(){},wm=function(e){return jh+Vf+Uh+e+jh+"/"+Vf+Uh},Wh=function(e){e.write(wm("")),e.close();var t=e.parentWindow.Object;return e=null,t},$4=function(){var e=j4("iframe"),t="java"+Vf+":",n;return e.style.display="none",U4.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(wm("document.F=Object")),n.close(),n.F},Da,dl=function(){try{Da=new ActiveXObject("htmlfile")}catch{}dl=typeof document<"u"?document.domain&&Da?Wh(Da):$4():Wh(Da);for(var e=Fh.length;e--;)delete dl[zf][Fh[e]];return dl()};F4[xm]=!0;var Ac=Object.create||function(t,n){var o;return t!==null?(Lu[zf]=L4(t),o=new Lu,Lu[zf]=null,o[xm]=t):o=dl(),n===void 0?o:B4.f(o,n)},z4=Hr,V4=Ac,H4=wr.f,Hf=z4("unscopables"),Gf=Array.prototype;Gf[Hf]===void 0&&H4(Gf,Hf,{configurable:!0,value:V4(null)});var Sc=function(e){Gf[Hf][e]=!0},G4=cn,X4=sa,Y4=oa,K4=Id,Z4=Sc;G4({target:"Array",proto:!0},{at:function(t){var n=X4(this),o=Y4(n),c=K4(t),u=c>=0?c:o+c;return u<0||u>=o?void 0:n[u]}});Z4("at");var Q4=ft,q4=dt,Rd=function(e,t){return q4(Q4[e].prototype[t])},J4=Rd;J4("Array","at");var eC=Mi,tC=dt,rC=function(e){if(eC(e)==="Function")return tC(e)},$h=rC,nC=yd,iC=md,sC=$h($h.bind),_d=function(e,t){return nC(e),t===void 0?e:iC?sC(e,t):function(){return e.apply(t,arguments)}},oC=_d,aC=G2,lC=sa,cC=oa,zh=function(e){var t=e===1;return function(n,o,c){for(var u=lC(n),h=aC(u),x=cC(h),w=oC(o,c),m,C;x-- >0;)if(m=h[x],C=w(m,x,u),C)switch(e){case 0:return m;case 1:return x}return t?-1:void 0}},vm={findLast:zh(0),findLastIndex:zh(1)},uC=cn,fC=vm.findLast,dC=Sc;uC({target:"Array",proto:!0},{findLast:function(t){return fC(this,t,arguments.length>1?arguments[1]:void 0)}});dC("findLast");var hC=Rd;hC("Array","findLast");var gC=cn,pC=vm.findLastIndex,mC=Sc;gC({target:"Array",proto:!0},{findLastIndex:function(t){return pC(this,t,arguments.length>1?arguments[1]:void 0)}});mC("findLastIndex");var xC=Rd;xC("Array","findLastIndex");var wC=Hr,vC=wC("toStringTag"),ym={};ym[vC]="z";var Od=String(ym)==="[object z]",yC=Od,EC=Ct,hl=Mi,CC=Hr,bC=CC("toStringTag"),AC=Object,SC=hl(function(){return arguments}())==="Arguments",IC=function(e,t){try{return e[t]}catch{}},Ic=yC?hl:function(e){var t,n,o;return e===void 0?"Undefined":e===null?"Null":typeof(n=IC(t=AC(e),bC))=="string"?n:SC?hl(t):(o=hl(t))==="Object"&&EC(t.callee)?"Arguments":o},TC=Ic,RC=String,_C=function(e){if(TC(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return RC(e)},OC=_C,Nd=function(e,t){return e===void 0?arguments.length<2?"":t:OC(e)},NC=Kt,kC=lt,MC=Gr,Vh=Nd,gl=Error.prototype.toString,DC=kC(function(){if(NC){var e=Object.create(Object.defineProperty({},"name",{get:function(){return this===e}}));if(gl.call(e)!=="true")return!0}return gl.call({message:1,name:2})!=="2: 1"||gl.call({})!=="Error"}),Em=DC?function(){var t=MC(this),n=Vh(t.name,"Error"),o=Vh(t.message);return n?o?n+": "+o:n:o}:gl,PC=ri,Hh=Em,Gh=Error.prototype;Gh.toString!==Hh&&PC(Gh,"toString",Hh);var Tc=Object.create?Object.create(null):{},LC=lt,BC=!LC(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),FC=ur,UC=Ct,jC=sa,WC=Ad,$C=BC,Xh=WC("IE_PROTO"),Xf=Object,zC=Xf.prototype,Cm=$C?Xf.getPrototypeOf:function(e){var t=jC(e);if(FC(t,Xh))return t[Xh];var n=t.constructor;return UC(n)&&t instanceof n?n.prototype:t instanceof Xf?zC:null},VC=lt,HC=Ct,GC=xr,Yh=Cm,XC=ri,YC=Hr,Yf=YC("iterator"),bm=!1,Si,Bu,Fu;[].keys&&(Fu=[].keys(),"next"in Fu?(Bu=Yh(Yh(Fu)),Bu!==Object.prototype&&(Si=Bu)):bm=!0);var KC=!GC(Si)||VC(function(){var e={};return Si[Yf].call(e)!==e});KC&&(Si={});HC(Si[Yf])||XC(Si,Yf,function(){return this});var Am={IteratorPrototype:Si,BUGGY_SAFARI_ITERATORS:bm},ZC=wr.f,QC=ur,qC=Hr,Kh=qC("toStringTag"),Rc=function(e,t,n){e&&!n&&(e=e.prototype),e&&!QC(e,Kh)&&ZC(e,Kh,{configurable:!0,value:t})},JC=Am.IteratorPrototype,eb=Ac,tb=ki,rb=Rc,nb=Tc,ib=function(){return this},sb=function(e,t,n,o){var c=t+" Iterator";return e.prototype=eb(JC,{next:tb(+!o,n)}),rb(e,c,!1),nb[c]=ib,e},ob=dt,ab=yd,lb=function(e,t,n){try{return ob(ab(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},cb=xr,ub=function(e){return cb(e)||e===null},fb=ub,db=String,hb=TypeError,gb=function(e){if(fb(e))return e;throw new hb("Can't set "+db(e)+" as a prototype")},pb=lb,mb=xr,xb=xd,wb=gb,Sm=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},n;try{n=pb(Object.prototype,"__proto__","set"),n(t,[]),e=t instanceof Array}catch{}return function(c,u){return xb(c),wb(u),mb(c)&&(e?n(c,u):c.__proto__=u),c}}():void 0),vb=cn,yb=Sn,Im=am,Eb=Ct,Cb=sb,Zh=Cm,Qh=Sm,bb=Rc,Ab=yc,Uu=ri,Sb=Hr,Ib=Tc,Tm=Am,Tb=Im.PROPER,Rb=Im.CONFIGURABLE,qh=Tm.IteratorPrototype,Pa=Tm.BUGGY_SAFARI_ITERATORS,Zs=Sb("iterator"),Jh="keys",Qs="values",eg="entries",_b=function(){return this},Rm=function(e,t,n,o,c,u,h){Cb(n,t,o);var x=function(N){if(N===c&&A)return A;if(!Pa&&N&&N in C)return C[N];switch(N){case Jh:return function(){return new n(this,N)};case Qs:return function(){return new n(this,N)};case eg:return function(){return new n(this,N)}}return function(){return new n(this)}},w=t+" Iterator",m=!1,C=e.prototype,b=C[Zs]||C["@@iterator"]||c&&C[c],A=!Pa&&b||x(c),T=t==="Array"&&C.entries||b,k,M,X;if(T&&(k=Zh(T.call(new e)),k!==Object.prototype&&k.next&&(Zh(k)!==qh&&(Qh?Qh(k,qh):Eb(k[Zs])||Uu(k,Zs,_b)),bb(k,w,!0))),Tb&&c===Qs&&b&&b.name!==Qs&&(Rb?Ab(C,"name",Qs):(m=!0,A=function(){return yb(b,this)})),c)if(M={values:x(Qs),keys:u?A:x(Jh),entries:x(eg)},h)for(X in M)(Pa||m||!(X in C))&&Uu(C,X,M[X]);else vb({target:t,proto:!0,forced:Pa||m},M);return C[Zs]!==A&&Uu(C,Zs,A,{name:c}),Ib[t]=A,M},_m=function(e,t){return{value:e,done:t}},Ob=Ds,kd=Sc,tg=Tc,Om=Cc,Nb=wr.f,kb=Rm,La=_m,Mb=Kt,Nm="Array Iterator",Db=Om.set,Pb=Om.getterFor(Nm);kb(Array,"Array",function(e,t){Db(this,{type:Nm,target:Ob(e),index:0,kind:t})},function(){var e=Pb(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,La(void 0,!0);switch(e.kind){case"keys":return La(n,!1);case"values":return La(t[n],!1)}return La([n,t[n]],!1)},"values");var rg=tg.Arguments=tg.Array;kd("keys");kd("values");kd("entries");if(Mb&&rg.name!=="values")try{Nb(rg,"name",{value:"values"})}catch{}var Lb=cn,Bb=sa,km=mm,Fb=lt,Ub=Fb(function(){km(1)});Lb({target:"Object",stat:!0,forced:Ub},{keys:function(t){return km(Bb(t))}});var jb=Od,Wb=Ic,$b=jb?{}.toString:function(){return"[object "+Wb(this)+"]"},zb=Od,Vb=ri,Hb=$b;zb||Vb(Object.prototype,"toString",Hb,{unsafe:!0});var Mm={exports:{}},Dm={},Gb=dt,Xb=Gb([].slice),Yb=Mi,Kb=Ds,Pm=bc.f,Zb=Xb,Lm=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Qb=function(e){try{return Pm(e)}catch{return Zb(Lm)}};Dm.f=function(t){return Lm&&Yb(t)==="Window"?Qb(t):Pm(Kb(t))};var qb=lt,Jb=qb(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),e6=lt,t6=xr,r6=Mi,ng=Jb,pl=Object.isExtensible,n6=e6(function(){pl(1)}),i6=n6||ng?function(t){return!t6(t)||ng&&r6(t)==="ArrayBuffer"?!1:pl?pl(t):!0}:pl,s6=lt,o6=!s6(function(){return Object.isExtensible(Object.preventExtensions({}))}),a6=cn,l6=dt,c6=Ec,u6=xr,Md=ur,f6=wr.f,ig=bc,d6=Dm,Dd=i6,h6=vc,g6=o6,Bm=!1,vn=h6("meta"),p6=0,Pd=function(e){f6(e,vn,{value:{objectID:"O"+p6++,weakData:{}}})},m6=function(e,t){if(!u6(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!Md(e,vn)){if(!Dd(e))return"F";if(!t)return"E";Pd(e)}return e[vn].objectID},x6=function(e,t){if(!Md(e,vn)){if(!Dd(e))return!0;if(!t)return!1;Pd(e)}return e[vn].weakData},w6=function(e){return g6&&Bm&&Dd(e)&&!Md(e,vn)&&Pd(e),e},v6=function(){y6.enable=function(){},Bm=!0;var e=ig.f,t=l6([].splice),n={};n[vn]=1,e(n).length&&(ig.f=function(o){for(var c=e(o),u=0,h=c.length;u<h;u++)if(c[u]===vn){t(c,u,1);break}return c},a6({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:d6.f}))},y6=Mm.exports={enable:v6,fastKey:m6,getWeakData:x6,onFreeze:w6};c6[vn]=!0;var Fm=Mm.exports,E6=Hr,C6=Tc,b6=E6("iterator"),A6=Array.prototype,S6=function(e){return e!==void 0&&(C6.Array===e||A6[b6]===e)},I6=Mi,T6=Ms,sg=Ed,R6=Hr,og=R6("iterator"),_6=Array.prototype,Um=function(e){if(!T6(e))return sg(e,og)||sg(e,"@@iterator")||(I6(e)==="Arguments"?_6[og]:void 0)},O6=Sn,N6=Ct,k6=Gr,M6=vd,D6=Um,P6=TypeError,L6=function(e,t){var n=arguments.length<2?D6(e):t;if(N6(n))return k6(O6(n,e));throw new P6(M6(e)+" is not iterable")},B6=Sn,ag=Gr,F6=Ed,U6=function(e,t,n){var o,c;ag(e);try{if(o=F6(e,"return"),!o){if(t==="throw")throw n;return n}o=B6(o,e)}catch(u){c=!0,o=u}if(t==="throw")throw n;if(c)throw o;return ag(o),n},j6=_d,W6=Sn,$6=Gr,z6=vd,V6=S6,H6=oa,lg=wc,G6=L6,X6=Um,cg=U6,Y6=TypeError,ml=function(e,t){this.stopped=e,this.result=t},ug=ml.prototype,Ld=function(e,t,n){var o=n&&n.that,c=!!(n&&n.AS_ENTRIES),u=!!(n&&n.IS_RECORD),h=!!(n&&n.IS_ITERATOR),x=!!(n&&n.INTERRUPTED),w=j6(t,o),m,C,b,A,T,k,M,X=function(O){var B=m;return m=void 0,B&&cg(B,"normal"),new ml(!0,O)},N=function(O){return c?($6(O),x?w(O[0],O[1],X):w(O[0],O[1])):x?w(O,X):w(O)};if(u)m=e.iterator;else if(h)m=e;else{if(C=X6(e),!C)throw new Y6(z6(e)+" is not iterable");if(V6(C)){for(b=0,A=H6(e);A>b;b++)if(T=N(e[b]),T&&lg(ug,T))return T;return new ml(!1)}m=G6(e,C)}for(k=u?e.next:m.next;!(M=W6(k,m)).done;){var I=M.value;try{T=N(I)}catch(O){if(m)cg(m,"throw",O);else throw O}if(typeof T=="object"&&T&&lg(ug,T))return T}return new ml(!1)},K6=wc,Z6=TypeError,_c=function(e,t){if(K6(t,e))return e;throw new Z6("Incorrect invocation")},Q6=Hr,jm=Q6("iterator"),Wm=!1;try{var q6=0,fg={next:function(){return{done:!!q6++}},return:function(){Wm=!0}};fg[jm]=function(){return this},Array.from(fg,function(){throw 2})}catch{}var J6=function(e,t){try{if(!t&&!Wm)return!1}catch{return!1}var n=!1;try{var o={};o[jm]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch{}return n},eA=Ct,tA=xr,dg=Sm,$m=function(e,t,n){var o,c;return dg&&eA(o=t.constructor)&&o!==n&&tA(c=o.prototype)&&c!==n.prototype&&dg(e,c),e},rA=cn,nA=ft,iA=dt,hg=gm,sA=ri,oA=Fm,aA=Ld,lA=_c,cA=Ct,uA=Ms,ju=xr,Wu=lt,fA=J6,dA=Rc,hA=$m,zm=function(e,t,n){var o=e.indexOf("Map")!==-1,c=e.indexOf("Weak")!==-1,u=o?"set":"add",h=nA[e],x=h&&h.prototype,w=h,m={},C=function(N){var I=iA(x[N]);sA(x,N,N==="add"?function(B){return I(this,B===0?0:B),this}:N==="delete"?function(O){return c&&!ju(O)?!1:I(this,O===0?0:O)}:N==="get"?function(B){return c&&!ju(B)?void 0:I(this,B===0?0:B)}:N==="has"?function(B){return c&&!ju(B)?!1:I(this,B===0?0:B)}:function(B,j){return I(this,B===0?0:B,j),this})},b=hg(e,!cA(h)||!(c||x.forEach&&!Wu(function(){new h().entries().next()})));if(b)w=n.getConstructor(t,e,o,u),oA.enable();else if(hg(e,!0)){var A=new w,T=A[u](c?{}:-0,1)!==A,k=Wu(function(){A.has(1)}),M=fA(function(N){new h(N)}),X=!c&&Wu(function(){for(var N=new h,I=5;I--;)N[u](I,I);return!N.has(-0)});M||(w=t(function(N,I){lA(N,x);var O=hA(new h,N,w);return uA(I)||aA(I,O[u],{that:O,AS_ENTRIES:o}),O}),w.prototype=x,x.constructor=w),(k||X)&&(C("delete"),C("has"),o&&C("get")),(X||T)&&C(u),c&&x.clear&&delete x.clear}return m[e]=w,rA({global:!0,constructor:!0,forced:w!==h},m),dA(w,e),c||n.setStrong(w,e,o),w},gg=fm,gA=wr,Bd=function(e,t,n){return n.get&&gg(n.get,t,{getter:!0}),n.set&&gg(n.set,t,{setter:!0}),gA.f(e,t,n)},pA=ri,mA=function(e,t,n){for(var o in t)pA(e,o,t[o],n);return e},xA=In,wA=Bd,vA=Hr,yA=Kt,pg=vA("species"),EA=function(e){var t=xA(e);yA&&t&&!t[pg]&&wA(t,pg,{configurable:!0,get:function(){return this}})},mg=Ac,CA=Bd,xg=mA,bA=_d,AA=_c,SA=Ms,IA=Ld,TA=Rm,Ba=_m,RA=EA,qs=Kt,wg=Fm.fastKey,Vm=Cc,vg=Vm.set,$u=Vm.getterFor,Hm={getConstructor:function(e,t,n,o){var c=e(function(m,C){AA(m,u),vg(m,{type:t,index:mg(null),first:null,last:null,size:0}),qs||(m.size=0),SA(C)||IA(C,m[o],{that:m,AS_ENTRIES:n})}),u=c.prototype,h=$u(t),x=function(m,C,b){var A=h(m),T=w(m,C),k,M;return T?T.value=b:(A.last=T={index:M=wg(C,!0),key:C,value:b,previous:k=A.last,next:null,removed:!1},A.first||(A.first=T),k&&(k.next=T),qs?A.size++:m.size++,M!=="F"&&(A.index[M]=T)),m},w=function(m,C){var b=h(m),A=wg(C),T;if(A!=="F")return b.index[A];for(T=b.first;T;T=T.next)if(T.key===C)return T};return xg(u,{clear:function(){for(var C=this,b=h(C),A=b.first;A;)A.removed=!0,A.previous&&(A.previous=A.previous.next=null),A=A.next;b.first=b.last=null,b.index=mg(null),qs?b.size=0:C.size=0},delete:function(m){var C=this,b=h(C),A=w(C,m);if(A){var T=A.next,k=A.previous;delete b.index[A.index],A.removed=!0,k&&(k.next=T),T&&(T.previous=k),b.first===A&&(b.first=T),b.last===A&&(b.last=k),qs?b.size--:C.size--}return!!A},forEach:function(C){for(var b=h(this),A=bA(C,arguments.length>1?arguments[1]:void 0),T;T=T?T.next:b.first;)for(A(T.value,T.key,this);T&&T.removed;)T=T.previous},has:function(C){return!!w(this,C)}}),xg(u,n?{get:function(C){var b=w(this,C);return b&&b.value},set:function(C,b){return x(this,C===0?0:C,b)}}:{add:function(C){return x(this,C=C===0?0:C,C)}}),qs&&CA(u,"size",{configurable:!0,get:function(){return h(this).size}}),c},setStrong:function(e,t,n){var o=t+" Iterator",c=$u(t),u=$u(o);TA(e,t,function(h,x){vg(this,{type:o,target:h,state:c(h),kind:x,last:null})},function(){for(var h=u(this),x=h.kind,w=h.last;w&&w.removed;)w=w.previous;return!h.target||!(h.last=w=w?w.next:h.state.first)?(h.target=null,Ba(void 0,!0)):Ba(x==="keys"?w.key:x==="values"?w.value:[w.key,w.value],!1)},n?"entries":"values",!n,!0),RA(t)}},_A=zm,OA=Hm;_A("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},OA);var NA=zm,kA=Hm;NA("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},kA);var Js=ft,MA=X2,DA=Mi,Fa=function(e){return MA.slice(0,e.length)===e},Gm=function(){return Fa("Bun/")?"BUN":Fa("Cloudflare-Workers")?"CLOUDFLARE":Fa("Deno/")?"DENO":Fa("Node.js/")?"NODE":Js.Bun&&typeof Bun.version=="string"?"BUN":Js.Deno&&typeof Deno.version=="object"?"DENO":DA(Js.process)==="process"?"NODE":Js.window&&Js.document?"BROWSER":"REST"}(),PA=Gm,LA=PA==="NODE",BA=ft,FA=LA,Xm=function(e){if(FA){try{return BA.process.getBuiltinModule(e)}catch{}try{return Function('return require("'+e+'")')()}catch{}}},Ym={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},UA=dt,Km=Error,jA=UA("".replace),WA=function(e){return String(new Km(e).stack)}("zxcasd"),Zm=/\n\s*at [^:]*:[^\n]*/,$A=Zm.test(WA),Qm=function(e,t){if($A&&typeof e=="string"&&!Km.prepareStackTrace)for(;t--;)e=jA(e,Zm,"");return e},zA=cn,Ll=In,VA=Xm,Fd=lt,HA=Ac,Ud=ki,Bl=wr.f,GA=ri,xl=Bd,wl=ur,XA=_c,YA=Gr,qm=Em,yg=Nd,ds=Ym,KA=Qm,Jm=Cc,jd=Kt,ys="DOMException",Kf="DATA_CLONE_ERR",Oc=Ll("Error"),yn=Ll(ys)||function(){try{var e=Ll("MessageChannel")||VA("worker_threads").MessageChannel;new e().port1.postMessage(new WeakMap)}catch(t){if(t.name===Kf&&t.code===25)return t.constructor}}(),ZA=yn&&yn.prototype,ex=Oc.prototype,QA=Jm.set,qA=Jm.getterFor(ys),JA="stack"in new Oc(ys),tx=function(e){return wl(ds,e)&&ds[e].m?ds[e].c:0},Wd=function(){XA(this,vo);var t=arguments.length,n=yg(t<1?void 0:arguments[0]),o=yg(t<2?void 0:arguments[1],"Error"),c=tx(o);if(QA(this,{type:ys,name:o,message:n,code:c}),jd||(this.name=o,this.message=n,this.code=c),JA){var u=new Oc(n);u.name=ys,Bl(this,"stack",Ud(1,KA(u.stack,1)))}},vo=Wd.prototype=HA(ex),rx=function(e){return{enumerable:!0,configurable:!0,get:e}},zu=function(e){return rx(function(){return qA(this)[e]})};jd&&(xl(vo,"code",zu("code")),xl(vo,"message",zu("message")),xl(vo,"name",zu("name")));Bl(vo,"constructor",Ud(1,Wd));var Nc=Fd(function(){return!(new yn instanceof Oc)}),eS=Nc||Fd(function(){return ex.toString!==qm||String(new yn(1,2))!=="2: 1"}),tS=Nc||Fd(function(){return new yn(1,"DataCloneError").code!==25});Nc||yn[Kf]!==25||ZA[Kf];var Eg=Nc;zA({global:!0,constructor:!0,forced:Eg},{DOMException:Eg?Wd:yn});var Do=Ll(ys),Fl=Do.prototype;eS&&yn===Do&&GA(Fl,"toString",qm);tS&&jd&&yn===Do&&xl(Fl,"code",rx(function(){return tx(YA(this).name)}));for(var Cg in ds)if(wl(ds,Cg)){var bg=ds[Cg],Ua=bg.s,Ag=Ud(6,bg.c);wl(Do,Ua)||Bl(Do,Ua,Ag),wl(Fl,Ua)||Bl(Fl,Ua,Ag)}var rS=cn,nS=ft,$d=In,Zf=ki,Qf=wr.f,Sg=ur,iS=_c,sS=$m,Ig=Nd,Vu=Ym,oS=Qm,aS=Kt,la="DOMException",nx=$d("Error"),ca=$d(la),zd=function(){iS(this,lS);var t=arguments.length,n=Ig(t<1?void 0:arguments[0]),o=Ig(t<2?void 0:arguments[1],"Error"),c=new ca(n,o),u=new nx(n);return u.name=la,Qf(c,"stack",Zf(1,oS(u.stack,1))),sS(c,this,zd),c},lS=zd.prototype=ca.prototype,cS="stack"in new nx(la),uS="stack"in new ca(1,2),Hu=ca&&aS&&Object.getOwnPropertyDescriptor(nS,la),fS=!!Hu&&!(Hu.writable&&Hu.configurable),Tg=cS&&!fS&&!uS;rS({global:!0,constructor:!0,forced:Tg},{DOMException:Tg?zd:ca});var uo=$d(la),Rg=uo.prototype;if(Rg.constructor!==uo){Qf(Rg,"constructor",Zf(1,uo));for(var _g in Vu)if(Sg(Vu,_g)){var Og=Vu[_g],Ng=Og.s;Sg(uo,Ng)||Qf(uo,Ng,Zf(6,Og.c))}}var dS=In,hS=Rc,kg="DOMException";hS(dS(kg),kg);var gS=dt,pS=lt,ix=Ct,mS=Ic,xS=In,wS=lm,sx=function(){},ox=xS("Reflect","construct"),Vd=/^\s*(?:class|function)\b/,vS=gS(Vd.exec),yS=!Vd.test(sx),eo=function(t){if(!ix(t))return!1;try{return ox(sx,[],t),!0}catch{return!1}},ax=function(t){if(!ix(t))return!1;switch(mS(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return yS||!!vS(Vd,wS(t))}catch{return!0}};ax.sham=!0;var ES=!ox||pS(function(){var e;return eo(eo.call)||!eo(Object)||!eo(function(){e=!0})||e})?ax:eo,CS=Kt,bS=wr,AS=ki,SS=function(e,t,n){CS?bS.f(e,t,AS(0,n)):e[t]=n},IS=TypeError,TS=function(e,t){if(e<t)throw new IS("Not enough arguments");return e},RS=ft,_S=lt,Mg=RS.RegExp,OS=!_S(function(){var e=!0;try{Mg(".","d")}catch{e=!1}var t={},n="",o=e?"dgimsy":"gimsy",c=function(w,m){Object.defineProperty(t,w,{get:function(){return n+=m,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};e&&(u.hasIndices="d");for(var h in u)c(h,u[h]);var x=Object.getOwnPropertyDescriptor(Mg.prototype,"flags").get.call(t);return x!==o||n!==o}),NS={correct:OS},kS=Gr,MS=function(){var e=kS(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},DS=Sn,PS=ur,LS=wc,Dg=NS,BS=MS,FS=RegExp.prototype,US=Dg.correct?function(e){return e.flags}:function(e){return!Dg.correct&&LS(FS,e)&&!PS(e,"flags")?DS(BS,e):e.flags},ja=dt,Wa=Map.prototype,jS={Map,set:ja(Wa.set),get:ja(Wa.get),has:ja(Wa.has),remove:ja(Wa.delete)},Gu=dt,$a=Set.prototype,lx={Set,add:Gu($a.add),has:Gu($a.has),remove:Gu($a.delete),proto:$a},WS=Sn,$S=function(e,t,n){for(var o=n?e:e.iterator,c=e.next,u,h;!(u=WS(c,o)).done;)if(h=t(u.value),h!==void 0)return h},cx=dt,zS=$S,ux=lx,VS=ux.Set,fx=ux.proto,HS=cx(fx.forEach),dx=cx(fx.keys),GS=dx(new VS).next,XS=function(e,t,n){return n?zS({iterator:dx(e),next:GS},t):HS(e,t)},YS=ft,KS=lt,Xu=K2,Yu=Gm,Pg=YS.structuredClone,hx=!!Pg&&!KS(function(){if(Yu==="DENO"&&Xu>92||Yu==="NODE"&&Xu>94||Yu==="BROWSER"&&Xu>97)return!1;var e=new ArrayBuffer(8),t=Pg(e,{transfer:[e]});return e.byteLength!==0||t.byteLength!==8}),Hd=ft,ZS=Xm,QS=hx,qS=Hd.structuredClone,Lg=Hd.ArrayBuffer,za=Hd.MessageChannel,qf=!1,Ku,Bg,Va,Zu;if(QS)qf=function(e){qS(e,{transfer:[e]})};else if(Lg)try{za||(Ku=ZS("worker_threads"),Ku&&(za=Ku.MessageChannel)),za&&(Bg=new za,Va=new Lg(2),Zu=function(e){Bg.port1.postMessage(null,[e])},Va.byteLength===2&&(Zu(Va),Va.byteLength===0&&(qf=Zu)))}catch{}var JS=qf,eI=lt,tI=ki,rI=!eI(function(){var e=new Error("a");return"stack"in e?(Object.defineProperty(e,"stack",tI(1,7)),e.stack!==7):!0}),nI=cn,Pt=ft,yo=In,ua=dt,Gd=lt,iI=vc,Es=Ct,sI=ES,oI=Ms,kc=xr,aI=wd,lI=Ld,gx=Gr,Ul=Ic,cI=ur,uI=SS,Qu=yc,vl=oa,fI=TS,dI=US,Mc=jS,Xd=lx,hI=XS,Fg=JS,gI=rI,Yd=hx,fo=Pt.Object,pI=Pt.Array,px=Pt.Date,mx=Pt.Error,mI=Pt.TypeError,xI=Pt.PerformanceMark,Ii=yo("DOMException"),Jf=Mc.Map,Kd=Mc.has,xx=Mc.get,jl=Mc.set,wx=Xd.Set,vx=Xd.add,wI=Xd.has,vI=yo("Object","keys"),yI=ua([].push),EI=ua((!0).valueOf),CI=ua(1.1.valueOf),bI=ua("".valueOf),AI=ua(px.prototype.getTime),e1=iI("structuredClone"),Po="DataCloneError",yl="Transferring",yx=function(e){return!Gd(function(){var t=new Pt.Set([7]),n=e(t),o=e(fo(7));return n===t||!n.has(7)||!kc(o)||+o!=7})&&e},Ug=function(e,t){return!Gd(function(){var n=new t,o=e({a:n,b:n});return!(o&&o.a===o.b&&o.a instanceof t&&o.a.stack===n.stack)})},SI=function(e){return!Gd(function(){var t=e(new Pt.AggregateError([1],e1,{cause:3}));return t.name!=="AggregateError"||t.errors[0]!==1||t.message!==e1||t.cause!==3})},Ei=Pt.structuredClone,II=!Ug(Ei,mx)||!Ug(Ei,Ii)||!SI(Ei),TI=!Ei&&yx(function(e){return new xI(e1,{detail:e}).detail}),$n=yx(Ei)||TI,qu=function(e){throw new Ii("Uncloneable type: "+e,Po)},ir=function(e,t){throw new Ii((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",Po)},Ju=function(e,t){return $n||ir(t),$n(e)},RI=function(){var e;try{e=new Pt.DataTransfer}catch{try{e=new Pt.ClipboardEvent("").clipboardData}catch{}}return e&&e.items&&e.files?e:null},Ex=function(e,t,n){if(Kd(t,e))return xx(t,e);var o=n||Ul(e),c,u,h,x,w,m;if(o==="SharedArrayBuffer")$n?c=$n(e):c=e;else{var C=Pt.DataView;!C&&!Es(e.slice)&&ir("ArrayBuffer");try{if(Es(e.slice)&&!e.resizable)c=e.slice(0);else for(u=e.byteLength,h=("maxByteLength"in e)?{maxByteLength:e.maxByteLength}:void 0,c=new ArrayBuffer(u,h),x=new C(e),w=new C(c),m=0;m<u;m++)w.setUint8(m,x.getUint8(m))}catch{throw new Ii("ArrayBuffer is detached",Po)}}return jl(t,e,c),c},_I=function(e,t,n,o,c){var u=Pt[t];return kc(u)||ir(t),new u(Ex(e.buffer,c),n,o)},Mt=function(e,t){if(aI(e)&&qu("Symbol"),!kc(e))return e;if(t){if(Kd(t,e))return xx(t,e)}else t=new Jf;var n=Ul(e),o,c,u,h,x,w,m,C;switch(n){case"Array":u=pI(vl(e));break;case"Object":u={};break;case"Map":u=new Jf;break;case"Set":u=new wx;break;case"RegExp":u=new RegExp(e.source,dI(e));break;case"Error":switch(c=e.name,c){case"AggregateError":u=new(yo(c))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":u=new(yo(c));break;case"CompileError":case"LinkError":case"RuntimeError":u=new(yo("WebAssembly",c));break;default:u=new mx}break;case"DOMException":u=new Ii(e.message,e.name);break;case"ArrayBuffer":case"SharedArrayBuffer":u=Ex(e,t,n);break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float16Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":w=n==="DataView"?e.byteLength:e.length,u=_I(e,n,e.byteOffset,w,t);break;case"DOMQuad":try{u=new DOMQuad(Mt(e.p1,t),Mt(e.p2,t),Mt(e.p3,t),Mt(e.p4,t))}catch{u=Ju(e,n)}break;case"File":if($n)try{u=$n(e),Ul(u)!==n&&(u=void 0)}catch{}if(!u)try{u=new File([e],e.name,e)}catch{}u||ir(n);break;case"FileList":if(h=RI(),h){for(x=0,w=vl(e);x<w;x++)h.items.add(Mt(e[x],t));u=h.files}else u=Ju(e,n);break;case"ImageData":try{u=new ImageData(Mt(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch{u=Ju(e,n)}break;default:if($n)u=$n(e);else switch(n){case"BigInt":u=fo(e.valueOf());break;case"Boolean":u=fo(EI(e));break;case"Number":u=fo(CI(e));break;case"String":u=fo(bI(e));break;case"Date":u=new px(AI(e));break;case"Blob":try{u=e.slice(0,e.size,e.type)}catch{ir(n)}break;case"DOMPoint":case"DOMPointReadOnly":o=Pt[n];try{u=o.fromPoint?o.fromPoint(e):new o(e.x,e.y,e.z,e.w)}catch{ir(n)}break;case"DOMRect":case"DOMRectReadOnly":o=Pt[n];try{u=o.fromRect?o.fromRect(e):new o(e.x,e.y,e.width,e.height)}catch{ir(n)}break;case"DOMMatrix":case"DOMMatrixReadOnly":o=Pt[n];try{u=o.fromMatrix?o.fromMatrix(e):new o(e)}catch{ir(n)}break;case"AudioData":case"VideoFrame":Es(e.clone)||ir(n);try{u=e.clone()}catch{qu(n)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":ir(n);default:qu(n)}}switch(jl(t,e,u),n){case"Array":case"Object":for(m=vI(e),x=0,w=vl(m);x<w;x++)C=m[x],uI(u,C,Mt(e[C],t));break;case"Map":e.forEach(function(b,A){jl(u,Mt(A,t),Mt(b,t))});break;case"Set":e.forEach(function(b){vx(u,Mt(b,t))});break;case"Error":Qu(u,"message",Mt(e.message,t)),cI(e,"cause")&&Qu(u,"cause",Mt(e.cause,t)),c==="AggregateError"?u.errors=Mt(e.errors,t):c==="SuppressedError"&&(u.error=Mt(e.error,t),u.suppressed=Mt(e.suppressed,t));case"DOMException":gI&&Qu(u,"stack",Mt(e.stack,t))}return u},OI=function(e,t){if(!kc(e))throw new mI("Transfer option cannot be converted to a sequence");var n=[];lI(e,function(A){yI(n,gx(A))});for(var o=0,c=vl(n),u=new wx,h,x,w,m,C,b;o<c;){if(h=n[o++],x=Ul(h),m=void 0,x==="ArrayBuffer"?wI(u,h):Kd(t,h))throw new Ii("Duplicate transferable",Po);if(x==="ArrayBuffer"){vx(u,h);continue}if(Yd)m=Ei(h,{transfer:[h]});else switch(x){case"ImageBitmap":w=Pt.OffscreenCanvas,sI(w)||ir(x,yl);try{C=new w(h.width,h.height),b=C.getContext("bitmaprenderer"),b.transferFromImageBitmap(h),m=C.transferToImageBitmap()}catch{}break;case"AudioData":case"VideoFrame":(!Es(h.clone)||!Es(h.close))&&ir(x,yl);try{m=h.clone(),h.close()}catch{}break;case"MediaSourceHandle":case"MessagePort":case"MIDIAccess":case"OffscreenCanvas":case"ReadableStream":case"RTCDataChannel":case"TransformStream":case"WebTransportReceiveStream":case"WebTransportSendStream":case"WritableStream":ir(x,yl)}if(m===void 0)throw new Ii("This object cannot be transferred: "+x,Po);jl(t,h,m)}return u},NI=function(e){hI(e,function(t){Yd?Ei(t,{transfer:[t]}):Es(t.transfer)?t.transfer():Fg?Fg(t):ir("ArrayBuffer",yl)})};nI({global:!0,enumerable:!0,sham:!Yd,forced:II},{structuredClone:function(t){var n=fI(arguments.length,1)>1&&!oI(arguments[1])?gx(arguments[1]):void 0,o=n?n.transfer:void 0,c,u;o!==void 0&&(c=new Jf,u=OI(o,c));var h=Mt(t,c);return u&&NI(u),h}});var kI=ft,MI=kI,DI=MI;DI.structuredClone;function PI(){typeof AbortSignal.timeout!="function"&&Object.defineProperty(AbortSignal,"timeout",{configurable:!0,writable:!0,value:e=>{const t=new AbortController;return setTimeout(()=>{t.abort(new DOMException("The operation timed out.","TimeoutError"))},e),t.signal}})}const LI=ce.createContext(null),BI=ce.createContext(null),FI={},jg=e=>{let t;const n=new Set,o=(C,b)=>{const A=typeof C=="function"?C(t):C;if(!Object.is(A,t)){const T=t;t=b??(typeof A!="object"||A===null)?A:Object.assign({},t,A),n.forEach(k=>k(t,T))}},c=()=>t,w={setState:o,getState:c,getInitialState:()=>m,subscribe:C=>(n.add(C),()=>n.delete(C)),destroy:()=>{(FI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},m=t=e(o,c,w);return w},UI=e=>e?jg(e):jg;var Cx={exports:{}},bx={},Ax={exports:{}},Sx={};/**
19
19
  * @license React
20
20
  * use-sync-external-store-shim.production.js
21
21
  *
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var Cs=ce;function FI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var UI=typeof Object.is=="function"?Object.is:FI,jI=Cs.useState,WI=Cs.useEffect,$I=Cs.useLayoutEffect,zI=Cs.useDebugValue;function VI(e,t){var n=t(),o=jI({inst:{value:n,getSnapshot:t}}),c=o[0].inst,u=o[1];return $I(function(){c.value=n,c.getSnapshot=t,ef(c)&&u({inst:c})},[e,n,t]),WI(function(){return ef(c)&&u({inst:c}),e(function(){ef(c)&&u({inst:c})})},[e]),zI(n),n}function ef(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!UI(e,n)}catch{return!0}}function HI(e,t){return t()}var GI=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?HI:VI;Ax.useSyncExternalStore=Cs.useSyncExternalStore!==void 0?Cs.useSyncExternalStore:GI;bx.exports=Ax;var XI=bx.exports;/**
26
+ */var Cs=ce;function jI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var WI=typeof Object.is=="function"?Object.is:jI,$I=Cs.useState,zI=Cs.useEffect,VI=Cs.useLayoutEffect,HI=Cs.useDebugValue;function GI(e,t){var n=t(),o=$I({inst:{value:n,getSnapshot:t}}),c=o[0].inst,u=o[1];return VI(function(){c.value=n,c.getSnapshot=t,ef(c)&&u({inst:c})},[e,n,t]),zI(function(){return ef(c)&&u({inst:c}),e(function(){ef(c)&&u({inst:c})})},[e]),HI(n),n}function ef(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!WI(e,n)}catch{return!0}}function XI(e,t){return t()}var YI=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?XI:GI;Sx.useSyncExternalStore=Cs.useSyncExternalStore!==void 0?Cs.useSyncExternalStore:YI;Ax.exports=Sx;var KI=Ax.exports;/**
27
27
  * @license React
28
28
  * use-sync-external-store-shim/with-selector.production.js
29
29
  *
@@ -31,7 +31,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var Dc=ce,YI=XI;function KI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ZI=typeof Object.is=="function"?Object.is:KI,QI=YI.useSyncExternalStore,qI=Dc.useRef,JI=Dc.useEffect,e5=Dc.useMemo,t5=Dc.useDebugValue;Cx.useSyncExternalStoreWithSelector=function(e,t,n,o,c){var u=qI(null);if(u.current===null){var g={hasValue:!1,value:null};u.current=g}else g=u.current;u=e5(function(){function w(T){if(!m){if(m=!0,C=T,T=o(T),c!==void 0&&g.hasValue){var k=g.value;if(c(k,T))return b=k}return b=T}if(k=b,ZI(C,T))return k;var M=o(T);return c!==void 0&&c(k,M)?(C=T,k):(C=T,b=M)}var m=!1,C,b,A=n===void 0?null:n;return[function(){return w(t())},A===null?void 0:function(){return w(A())}]},[t,n,o,c]);var x=QI(e,u[0],u[1]);return JI(function(){g.hasValue=!0,g.value=x},[x]),t5(x),x};Ex.exports=Cx;var r5=Ex.exports;const n5=I2(r5),Sx={},{useDebugValue:i5}=q3,{useSyncExternalStoreWithSelector:s5}=n5;let Wg=!1;const o5=e=>e;function a5(e,t=o5,n){(Sx?"production":void 0)!=="production"&&n&&!Wg&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Wg=!0);const o=s5(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return i5(o),o}const $g=e=>{(Sx?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?BI(e):e,n=(o,c)=>a5(t,o,c);return Object.assign(n,t),n},l5=e=>e?$g(e):$g,c5={};function u5(e,t){let n;try{n=e()}catch{return}return{getItem:c=>{var u;const g=w=>w===null?null:JSON.parse(w,void 0),x=(u=n.getItem(c))!=null?u:null;return x instanceof Promise?x.then(g):g(x)},setItem:(c,u)=>n.setItem(c,JSON.stringify(u,void 0)),removeItem:c=>n.removeItem(c)}}const Lo=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(o){return Lo(o)(n)},catch(o){return this}}}catch(n){return{then(o){return this},catch(o){return Lo(o)(n)}}}},f5=(e,t)=>(n,o,c)=>{let u={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:G=>G,version:0,merge:(G,N)=>({...N,...G}),...t},g=!1;const x=new Set,w=new Set;let m;try{m=u.getStorage()}catch{}if(!m)return e((...G)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),n(...G)},o,c);const C=Lo(u.serialize),b=()=>{const G=u.partialize({...o()});let N;const I=C({state:G,version:u.version}).then(O=>m.setItem(u.name,O)).catch(O=>{N=O});if(N)throw N;return I},A=c.setState;c.setState=(G,N)=>{A(G,N),b()};const T=e((...G)=>{n(...G),b()},o,c);let k;const M=()=>{var G;if(!m)return;g=!1,x.forEach(I=>I(o()));const N=((G=u.onRehydrateStorage)==null?void 0:G.call(u,o()))||void 0;return Lo(m.getItem.bind(m))(u.name).then(I=>{if(I)return u.deserialize(I)}).then(I=>{if(I)if(typeof I.version=="number"&&I.version!==u.version){if(u.migrate)return u.migrate(I.state,I.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return I.state}).then(I=>{var O;return k=u.merge(I,(O=o())!=null?O:T),n(k,!0),b()}).then(()=>{N==null||N(k,void 0),g=!0,w.forEach(I=>I(k))}).catch(I=>{N==null||N(void 0,I)})};return c.persist={setOptions:G=>{u={...u,...G},G.getStorage&&(m=G.getStorage())},clearStorage:()=>{m==null||m.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>M(),hasHydrated:()=>g,onHydrate:G=>(x.add(G),()=>{x.delete(G)}),onFinishHydration:G=>(w.add(G),()=>{w.delete(G)})},M(),k||T},d5=(e,t)=>(n,o,c)=>{let u={storage:u5(()=>localStorage),partialize:M=>M,version:0,merge:(M,G)=>({...G,...M}),...t},g=!1;const x=new Set,w=new Set;let m=u.storage;if(!m)return e((...M)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),n(...M)},o,c);const C=()=>{const M=u.partialize({...o()});return m.setItem(u.name,{state:M,version:u.version})},b=c.setState;c.setState=(M,G)=>{b(M,G),C()};const A=e((...M)=>{n(...M),C()},o,c);c.getInitialState=()=>A;let T;const k=()=>{var M,G;if(!m)return;g=!1,x.forEach(I=>{var O;return I((O=o())!=null?O:A)});const N=((G=u.onRehydrateStorage)==null?void 0:G.call(u,(M=o())!=null?M:A))||void 0;return Lo(m.getItem.bind(m))(u.name).then(I=>{if(I)if(typeof I.version=="number"&&I.version!==u.version){if(u.migrate)return[!0,u.migrate(I.state,I.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,I.state];return[!1,void 0]}).then(I=>{var O;const[B,j]=I;if(T=u.merge(j,(O=o())!=null?O:A),n(T,!0),B)return C()}).then(()=>{N==null||N(T,void 0),T=o(),g=!0,w.forEach(I=>I(T))}).catch(I=>{N==null||N(void 0,I)})};return c.persist={setOptions:M=>{u={...u,...M},M.storage&&(m=M.storage)},clearStorage:()=>{m==null||m.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>k(),hasHydrated:()=>g,onHydrate:M=>(x.add(M),()=>{x.delete(M)}),onFinishHydration:M=>(w.add(M),()=>{w.delete(M)})},u.skipHydration||k(),T||A},h5=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((c5?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),f5(e,t)):d5(e,t),g5=h5;function Ix(){return typeof document<"u"&&document.body.dataset.webShell==="1"}function Tx(){return typeof navigator>"u"?!1:Ix()||!/Electron\//i.test(navigator.userAgent)}function N_(e=900){const[t,n]=ce.useState(()=>typeof window<"u"&&window.innerWidth<e);return ce.useEffect(()=>{const o=window.matchMedia(`(max-width: ${e-1}px)`),c=u=>n(u.matches);return n(o.matches),o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[e]),t}const k_={classic:"原布局","agent-rail":"单层抬头","all-sessions":"所有会话"},p5="agent-rail",m5="agent-web-shell:navigation-layout:v1";function Rx(e){return e==="classic"||e==="agent-rail"||e==="all-sessions"}function x5(e){if(!e||typeof e!="object")return null;const t=e;return t.type===m5&&Rx(t.navigationLayout)?t.navigationLayout:null}const zg=[{id:"glass",label:"毛玻璃",preview:["#c3dbee","#357b88"]},{id:"pearl",label:"珍珠白",preview:["#f5f6fa","#4f6ef7"]},{id:"scifi",label:"科幻霓虹",preview:["#050a14","#22d3ee"]},{id:"noir",label:"暗夜黑",preview:["#0f1115","#a78bfa"]},{id:"mist",label:"雾白靛蓝",preview:["#f7f8fb","#4258c4"]},{id:"pine",label:"暖灰松绿",preview:["#f6f7f3","#356c55"]},{id:"graphite",label:"石墨夜色",preview:["#202630","#a4bad2"]}],M_=[{id:"standard",label:"标准",description:"侧边栏 + 对话区"},{id:"focus",label:"专注",description:"隐藏侧边栏,居中沉浸对话"},{id:"compact",label:"紧凑",description:"更小间距与字号,信息密度优先"}],w5=5;function _x(e){return Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))]:[]}function v5(e,t){const n=e??{};return{...n.skin!==void 0?{skin:n.skin}:{},...n.layout!==void 0?{layout:n.layout}:{},...Rx(n.navigationLayout)?{navigationLayout:n.navigationLayout}:{},...n.wakeEnabled!==void 0?{wakeEnabled:n.wakeEnabled}:{},...n.wakeWord!==void 0?{wakeWord:n.wakeWord}:{},...n.runningFirst!==void 0?{runningFirst:n.runningFirst}:{},...typeof n.dashboardSessionsMerged=="boolean"?{dashboardSessionsMerged:n.dashboardSessionsMerged}:{},pinnedSessionIds:_x(n.pinnedSessionIds),...t<4&&Tx()?{wakeEnabled:!1}:{}}}function y5(e=Tx()){return!e}const Ci=l5()(g5(e=>({skin:"pearl",layout:"standard",navigationLayout:p5,wakeEnabled:y5(),wakeWord:"小智",runningFirst:!1,dashboardSessionsMerged:!1,pinnedSessionIds:[],setSkin:t=>e({skin:t}),setLayout:t=>e({layout:t}),setNavigationLayout:t=>e({navigationLayout:t}),setWakeEnabled:t=>e({wakeEnabled:t}),setWakeWord:t=>e({wakeWord:t}),setRunningFirst:t=>e({runningFirst:t}),setDashboardSessionsMerged:t=>e({dashboardSessionsMerged:t}),togglePinnedSession:t=>e(n=>({pinnedSessionIds:n.pinnedSessionIds.includes(t)?n.pinnedSessionIds.filter(o=>o!==t):_x([...n.pinnedSessionIds,t])})),removePinnedSessions:t=>e(n=>{const o=new Set(t);return{pinnedSessionIds:n.pinnedSessionIds.filter(c=>!o.has(c))}})}),{name:"agent-ui-prefs",version:w5,migrate:v5}));var Ox={exports:{}},vr={},Nx={exports:{}},kx={};/**
34
+ */var Dc=ce,ZI=KI;function QI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qI=typeof Object.is=="function"?Object.is:QI,JI=ZI.useSyncExternalStore,e5=Dc.useRef,t5=Dc.useEffect,r5=Dc.useMemo,n5=Dc.useDebugValue;bx.useSyncExternalStoreWithSelector=function(e,t,n,o,c){var u=e5(null);if(u.current===null){var h={hasValue:!1,value:null};u.current=h}else h=u.current;u=r5(function(){function w(T){if(!m){if(m=!0,C=T,T=o(T),c!==void 0&&h.hasValue){var k=h.value;if(c(k,T))return b=k}return b=T}if(k=b,qI(C,T))return k;var M=o(T);return c!==void 0&&c(k,M)?(C=T,k):(C=T,b=M)}var m=!1,C,b,A=n===void 0?null:n;return[function(){return w(t())},A===null?void 0:function(){return w(A())}]},[t,n,o,c]);var x=JI(e,u[0],u[1]);return t5(function(){h.hasValue=!0,h.value=x},[x]),n5(x),x};Cx.exports=bx;var i5=Cx.exports;const s5=T2(i5),Ix={},{useDebugValue:o5}=ey,{useSyncExternalStoreWithSelector:a5}=s5;let Wg=!1;const l5=e=>e;function c5(e,t=l5,n){(Ix?"production":void 0)!=="production"&&n&&!Wg&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Wg=!0);const o=a5(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return o5(o),o}const $g=e=>{(Ix?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?UI(e):e,n=(o,c)=>c5(t,o,c);return Object.assign(n,t),n},u5=e=>e?$g(e):$g,f5={};function d5(e,t){let n;try{n=e()}catch{return}return{getItem:c=>{var u;const h=w=>w===null?null:JSON.parse(w,void 0),x=(u=n.getItem(c))!=null?u:null;return x instanceof Promise?x.then(h):h(x)},setItem:(c,u)=>n.setItem(c,JSON.stringify(u,void 0)),removeItem:c=>n.removeItem(c)}}const Lo=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(o){return Lo(o)(n)},catch(o){return this}}}catch(n){return{then(o){return this},catch(o){return Lo(o)(n)}}}},h5=(e,t)=>(n,o,c)=>{let u={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:X=>X,version:0,merge:(X,N)=>({...N,...X}),...t},h=!1;const x=new Set,w=new Set;let m;try{m=u.getStorage()}catch{}if(!m)return e((...X)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),n(...X)},o,c);const C=Lo(u.serialize),b=()=>{const X=u.partialize({...o()});let N;const I=C({state:X,version:u.version}).then(O=>m.setItem(u.name,O)).catch(O=>{N=O});if(N)throw N;return I},A=c.setState;c.setState=(X,N)=>{A(X,N),b()};const T=e((...X)=>{n(...X),b()},o,c);let k;const M=()=>{var X;if(!m)return;h=!1,x.forEach(I=>I(o()));const N=((X=u.onRehydrateStorage)==null?void 0:X.call(u,o()))||void 0;return Lo(m.getItem.bind(m))(u.name).then(I=>{if(I)return u.deserialize(I)}).then(I=>{if(I)if(typeof I.version=="number"&&I.version!==u.version){if(u.migrate)return u.migrate(I.state,I.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return I.state}).then(I=>{var O;return k=u.merge(I,(O=o())!=null?O:T),n(k,!0),b()}).then(()=>{N==null||N(k,void 0),h=!0,w.forEach(I=>I(k))}).catch(I=>{N==null||N(void 0,I)})};return c.persist={setOptions:X=>{u={...u,...X},X.getStorage&&(m=X.getStorage())},clearStorage:()=>{m==null||m.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>M(),hasHydrated:()=>h,onHydrate:X=>(x.add(X),()=>{x.delete(X)}),onFinishHydration:X=>(w.add(X),()=>{w.delete(X)})},M(),k||T},g5=(e,t)=>(n,o,c)=>{let u={storage:d5(()=>localStorage),partialize:M=>M,version:0,merge:(M,X)=>({...X,...M}),...t},h=!1;const x=new Set,w=new Set;let m=u.storage;if(!m)return e((...M)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),n(...M)},o,c);const C=()=>{const M=u.partialize({...o()});return m.setItem(u.name,{state:M,version:u.version})},b=c.setState;c.setState=(M,X)=>{b(M,X),C()};const A=e((...M)=>{n(...M),C()},o,c);c.getInitialState=()=>A;let T;const k=()=>{var M,X;if(!m)return;h=!1,x.forEach(I=>{var O;return I((O=o())!=null?O:A)});const N=((X=u.onRehydrateStorage)==null?void 0:X.call(u,(M=o())!=null?M:A))||void 0;return Lo(m.getItem.bind(m))(u.name).then(I=>{if(I)if(typeof I.version=="number"&&I.version!==u.version){if(u.migrate)return[!0,u.migrate(I.state,I.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,I.state];return[!1,void 0]}).then(I=>{var O;const[B,j]=I;if(T=u.merge(j,(O=o())!=null?O:A),n(T,!0),B)return C()}).then(()=>{N==null||N(T,void 0),T=o(),h=!0,w.forEach(I=>I(T))}).catch(I=>{N==null||N(void 0,I)})};return c.persist={setOptions:M=>{u={...u,...M},M.storage&&(m=M.storage)},clearStorage:()=>{m==null||m.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>k(),hasHydrated:()=>h,onHydrate:M=>(x.add(M),()=>{x.delete(M)}),onFinishHydration:M=>(w.add(M),()=>{w.delete(M)})},u.skipHydration||k(),T||A},p5=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((f5?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),h5(e,t)):g5(e,t),m5=p5;function Tx(){return typeof document<"u"&&document.body.dataset.webShell==="1"}function Rx(){return typeof navigator>"u"?!1:Tx()||!/Electron\//i.test(navigator.userAgent)}function j_(e=900){const[t,n]=ce.useState(()=>typeof window<"u"&&window.innerWidth<e);return ce.useEffect(()=>{const o=window.matchMedia(`(max-width: ${e-1}px)`),c=u=>n(u.matches);return n(o.matches),o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[e]),t}const W_={classic:"原布局","agent-rail":"单层抬头","all-sessions":"所有会话"},x5="agent-rail",w5="agent-web-shell:navigation-layout:v1";function _x(e){return e==="classic"||e==="agent-rail"||e==="all-sessions"}function v5(e){if(!e||typeof e!="object")return null;const t=e;return t.type===w5&&_x(t.navigationLayout)?t.navigationLayout:null}const zg=[{id:"glass",label:"毛玻璃",preview:["#c3dbee","#357b88"]},{id:"pearl",label:"珍珠白",preview:["#f5f6fa","#4f6ef7"]},{id:"scifi",label:"科幻霓虹",preview:["#050a14","#22d3ee"]},{id:"noir",label:"暗夜黑",preview:["#0f1115","#a78bfa"]},{id:"mist",label:"雾白靛蓝",preview:["#f7f8fb","#4258c4"]},{id:"pine",label:"暖灰松绿",preview:["#f6f7f3","#356c55"]},{id:"graphite",label:"石墨夜色",preview:["#202630","#a4bad2"]}],$_=[{id:"standard",label:"标准",description:"侧边栏 + 对话区"},{id:"focus",label:"专注",description:"隐藏侧边栏,居中沉浸对话"},{id:"compact",label:"紧凑",description:"更小间距与字号,信息密度优先"}],y5=5;function Ox(e){return Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))]:[]}function E5(e,t){const n=e??{};return{...n.skin!==void 0?{skin:n.skin}:{},...n.layout!==void 0?{layout:n.layout}:{},..._x(n.navigationLayout)?{navigationLayout:n.navigationLayout}:{},...n.wakeEnabled!==void 0?{wakeEnabled:n.wakeEnabled}:{},...n.wakeWord!==void 0?{wakeWord:n.wakeWord}:{},...n.runningFirst!==void 0?{runningFirst:n.runningFirst}:{},...typeof n.dashboardSessionsMerged=="boolean"?{dashboardSessionsMerged:n.dashboardSessionsMerged}:{},pinnedSessionIds:Ox(n.pinnedSessionIds),...t<4&&Rx()?{wakeEnabled:!1}:{}}}function C5(e=Rx()){return!e}const Ci=u5()(m5(e=>({skin:"pearl",layout:"standard",navigationLayout:x5,wakeEnabled:C5(),wakeWord:"小智",runningFirst:!1,dashboardSessionsMerged:!1,pinnedSessionIds:[],setSkin:t=>e({skin:t}),setLayout:t=>e({layout:t}),setNavigationLayout:t=>e({navigationLayout:t}),setWakeEnabled:t=>e({wakeEnabled:t}),setWakeWord:t=>e({wakeWord:t}),setRunningFirst:t=>e({runningFirst:t}),setDashboardSessionsMerged:t=>e({dashboardSessionsMerged:t}),togglePinnedSession:t=>e(n=>({pinnedSessionIds:n.pinnedSessionIds.includes(t)?n.pinnedSessionIds.filter(o=>o!==t):Ox([...n.pinnedSessionIds,t])})),removePinnedSessions:t=>e(n=>{const o=new Set(t);return{pinnedSessionIds:n.pinnedSessionIds.filter(c=>!o.has(c))}})}),{name:"agent-ui-prefs",version:y5,migrate:E5}));var Nx={exports:{}},vr={},kx={exports:{}},Mx={};/**
35
35
  * @license React
36
36
  * scheduler.production.min.js
37
37
  *
@@ -39,7 +39,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
39
39
  *
40
40
  * This source code is licensed under the MIT license found in the
41
41
  * LICENSE file in the root directory of this source tree.
42
- */(function(e){function t(te,he){var me=te.length;te.push(he);e:for(;0<me;){var Ge=me-1>>>1,Ie=te[Ge];if(0<c(Ie,he))te[Ge]=he,te[me]=Ie,me=Ge;else break e}}function n(te){return te.length===0?null:te[0]}function o(te){if(te.length===0)return null;var he=te[0],me=te.pop();if(me!==he){te[0]=me;e:for(var Ge=0,Ie=te.length,Er=Ie>>>1;Ge<Er;){var Ze=2*(Ge+1)-1,oi=te[Ze],le=Ze+1,Rn=te[le];if(0>c(oi,me))le<Ie&&0>c(Rn,oi)?(te[Ge]=Rn,te[le]=me,Ge=le):(te[Ge]=oi,te[Ze]=me,Ge=Ze);else if(le<Ie&&0>c(Rn,me))te[Ge]=Rn,te[le]=me,Ge=le;else break e}}return he}function c(te,he){var me=te.sortIndex-he.sortIndex;return me!==0?me:te.id-he.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var g=Date,x=g.now();e.unstable_now=function(){return g.now()-x}}var w=[],m=[],C=1,b=null,A=3,T=!1,k=!1,M=!1,G=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(te){for(var he=n(m);he!==null;){if(he.callback===null)o(m);else if(he.startTime<=te)o(m),he.sortIndex=he.expirationTime,t(w,he);else break;he=n(m)}}function B(te){if(M=!1,O(te),!k)if(n(w)!==null)k=!0,rt(j);else{var he=n(m);he!==null&&xe(B,he.startTime-te)}}function j(te,he){k=!1,M&&(M=!1,N(Y),Y=-1),T=!0;var me=A;try{for(O(he),b=n(w);b!==null&&(!(b.expirationTime>he)||te&&!ve());){var Ge=b.callback;if(typeof Ge=="function"){b.callback=null,A=b.priorityLevel;var Ie=Ge(b.expirationTime<=he);he=e.unstable_now(),typeof Ie=="function"?b.callback=Ie:b===n(w)&&o(w),O(he)}else o(w);b=n(w)}if(b!==null)var Er=!0;else{var Ze=n(m);Ze!==null&&xe(B,Ze.startTime-he),Er=!1}return Er}finally{b=null,A=me,T=!1}}var U=!1,F=null,Y=-1,z=5,oe=-1;function ve(){return!(e.unstable_now()-oe<z)}function ie(){if(F!==null){var te=e.unstable_now();oe=te;var he=!0;try{he=F(!0,te)}finally{he?pe():(U=!1,F=null)}}else U=!1}var pe;if(typeof I=="function")pe=function(){I(ie)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,X=Te.port2;Te.port1.onmessage=ie,pe=function(){X.postMessage(null)}}else pe=function(){G(ie,0)};function rt(te){F=te,U||(U=!0,pe())}function xe(te,he){Y=G(function(){te(e.unstable_now())},he)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(te){te.callback=null},e.unstable_continueExecution=function(){k||T||(k=!0,rt(j))},e.unstable_forceFrameRate=function(te){0>te||125<te?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<te?Math.floor(1e3/te):5},e.unstable_getCurrentPriorityLevel=function(){return A},e.unstable_getFirstCallbackNode=function(){return n(w)},e.unstable_next=function(te){switch(A){case 1:case 2:case 3:var he=3;break;default:he=A}var me=A;A=he;try{return te()}finally{A=me}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(te,he){switch(te){case 1:case 2:case 3:case 4:case 5:break;default:te=3}var me=A;A=te;try{return he()}finally{A=me}},e.unstable_scheduleCallback=function(te,he,me){var Ge=e.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Ge+me:Ge):me=Ge,te){case 1:var Ie=-1;break;case 2:Ie=250;break;case 5:Ie=1073741823;break;case 4:Ie=1e4;break;default:Ie=5e3}return Ie=me+Ie,te={id:C++,callback:he,priorityLevel:te,startTime:me,expirationTime:Ie,sortIndex:-1},me>Ge?(te.sortIndex=me,t(m,te),n(w)===null&&te===n(m)&&(M?(N(Y),Y=-1):M=!0,xe(B,me-Ge))):(te.sortIndex=Ie,t(w,te),k||T||(k=!0,rt(j))),te},e.unstable_shouldYield=ve,e.unstable_wrapCallback=function(te){var he=A;return function(){var me=A;A=he;try{return te.apply(this,arguments)}finally{A=me}}}})(kx);Nx.exports=kx;var E5=Nx.exports;/**
42
+ */(function(e){function t(te,he){var me=te.length;te.push(he);e:for(;0<me;){var Ge=me-1>>>1,Ie=te[Ge];if(0<c(Ie,he))te[Ge]=he,te[me]=Ie,me=Ge;else break e}}function n(te){return te.length===0?null:te[0]}function o(te){if(te.length===0)return null;var he=te[0],me=te.pop();if(me!==he){te[0]=me;e:for(var Ge=0,Ie=te.length,Er=Ie>>>1;Ge<Er;){var Ze=2*(Ge+1)-1,oi=te[Ze],le=Ze+1,Rn=te[le];if(0>c(oi,me))le<Ie&&0>c(Rn,oi)?(te[Ge]=Rn,te[le]=me,Ge=le):(te[Ge]=oi,te[Ze]=me,Ge=Ze);else if(le<Ie&&0>c(Rn,me))te[Ge]=Rn,te[le]=me,Ge=le;else break e}}return he}function c(te,he){var me=te.sortIndex-he.sortIndex;return me!==0?me:te.id-he.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var h=Date,x=h.now();e.unstable_now=function(){return h.now()-x}}var w=[],m=[],C=1,b=null,A=3,T=!1,k=!1,M=!1,X=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(te){for(var he=n(m);he!==null;){if(he.callback===null)o(m);else if(he.startTime<=te)o(m),he.sortIndex=he.expirationTime,t(w,he);else break;he=n(m)}}function B(te){if(M=!1,O(te),!k)if(n(w)!==null)k=!0,rt(j);else{var he=n(m);he!==null&&xe(B,he.startTime-te)}}function j(te,he){k=!1,M&&(M=!1,N(Y),Y=-1),T=!0;var me=A;try{for(O(he),b=n(w);b!==null&&(!(b.expirationTime>he)||te&&!ve());){var Ge=b.callback;if(typeof Ge=="function"){b.callback=null,A=b.priorityLevel;var Ie=Ge(b.expirationTime<=he);he=e.unstable_now(),typeof Ie=="function"?b.callback=Ie:b===n(w)&&o(w),O(he)}else o(w);b=n(w)}if(b!==null)var Er=!0;else{var Ze=n(m);Ze!==null&&xe(B,Ze.startTime-he),Er=!1}return Er}finally{b=null,A=me,T=!1}}var U=!1,F=null,Y=-1,z=5,oe=-1;function ve(){return!(e.unstable_now()-oe<z)}function ie(){if(F!==null){var te=e.unstable_now();oe=te;var he=!0;try{he=F(!0,te)}finally{he?pe():(U=!1,F=null)}}else U=!1}var pe;if(typeof I=="function")pe=function(){I(ie)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,G=Te.port2;Te.port1.onmessage=ie,pe=function(){G.postMessage(null)}}else pe=function(){X(ie,0)};function rt(te){F=te,U||(U=!0,pe())}function xe(te,he){Y=X(function(){te(e.unstable_now())},he)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(te){te.callback=null},e.unstable_continueExecution=function(){k||T||(k=!0,rt(j))},e.unstable_forceFrameRate=function(te){0>te||125<te?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<te?Math.floor(1e3/te):5},e.unstable_getCurrentPriorityLevel=function(){return A},e.unstable_getFirstCallbackNode=function(){return n(w)},e.unstable_next=function(te){switch(A){case 1:case 2:case 3:var he=3;break;default:he=A}var me=A;A=he;try{return te()}finally{A=me}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(te,he){switch(te){case 1:case 2:case 3:case 4:case 5:break;default:te=3}var me=A;A=te;try{return he()}finally{A=me}},e.unstable_scheduleCallback=function(te,he,me){var Ge=e.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Ge+me:Ge):me=Ge,te){case 1:var Ie=-1;break;case 2:Ie=250;break;case 5:Ie=1073741823;break;case 4:Ie=1e4;break;default:Ie=5e3}return Ie=me+Ie,te={id:C++,callback:he,priorityLevel:te,startTime:me,expirationTime:Ie,sortIndex:-1},me>Ge?(te.sortIndex=me,t(m,te),n(w)===null&&te===n(m)&&(M?(N(Y),Y=-1):M=!0,xe(B,me-Ge))):(te.sortIndex=Ie,t(w,te),k||T||(k=!0,rt(j))),te},e.unstable_shouldYield=ve,e.unstable_wrapCallback=function(te){var he=A;return function(){var me=A;A=he;try{return te.apply(this,arguments)}finally{A=me}}}})(Mx);kx.exports=Mx;var b5=kx.exports;/**
43
43
  * @license React
44
44
  * react-dom.production.min.js
45
45
  *
@@ -47,69 +47,69 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./page-C2e368Dx.js",".
47
47
  *
48
48
  * This source code is licensed under the MIT license found in the
49
49
  * LICENSE file in the root directory of this source tree.
50
- */var C5=ce,mr=E5;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Mx=new Set,Bo={};function Di(e,t){bs(e,t),bs(e+"Capture",t)}function bs(e,t){for(Bo[e]=t,e=0;e<t.length;e++)Mx.add(t[e])}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),t1=Object.prototype.hasOwnProperty,b5=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Vg={},Hg={};function A5(e){return t1.call(Hg,e)?!0:t1.call(Vg,e)?!1:b5.test(e)?Hg[e]=!0:(Vg[e]=!0,!1)}function S5(e,t,n,o){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function I5(e,t,n,o){if(t===null||typeof t>"u"||S5(e,t,n,o))return!0;if(o)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Zt(e,t,n,o,c,u,g){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=c,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=g}var Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bt[e]=new Zt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Bt[t]=new Zt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bt[e]=new Zt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bt[e]=new Zt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Bt[e]=new Zt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bt[e]=new Zt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bt[e]=new Zt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bt[e]=new Zt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bt[e]=new Zt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Zd=/[\-:]([a-z])/g;function Qd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bt[e]=new Zt(e,1,!1,e.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new Zt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bt[e]=new Zt(e,1,!1,e.toLowerCase(),null,!0,!0)});function qd(e,t,n,o){var c=Bt.hasOwnProperty(t)?Bt[t]:null;(c!==null?c.type!==0:o||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(I5(t,n,c,o)&&(n=null),o||c===null?A5(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):c.mustUseProperty?e[c.propertyName]=n===null?c.type===3?!1:"":n:(t=c.attributeName,o=c.attributeNamespace,n===null?e.removeAttribute(t):(c=c.type,n=c===3||c===4&&n===!0?"":""+n,o?e.setAttributeNS(o,t,n):e.setAttribute(t,n))))}var Tn=C5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Va=Symbol.for("react.element"),qi=Symbol.for("react.portal"),Ji=Symbol.for("react.fragment"),Jd=Symbol.for("react.strict_mode"),r1=Symbol.for("react.profiler"),Dx=Symbol.for("react.provider"),Px=Symbol.for("react.context"),e0=Symbol.for("react.forward_ref"),n1=Symbol.for("react.suspense"),i1=Symbol.for("react.suspense_list"),t0=Symbol.for("react.memo"),Bn=Symbol.for("react.lazy"),Lx=Symbol.for("react.offscreen"),Gg=Symbol.iterator;function to(e){return e===null||typeof e!="object"?null:(e=Gg&&e[Gg]||e["@@iterator"],typeof e=="function"?e:null)}var tt=Object.assign,tf;function ho(e){if(tf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tf=t&&t[1]||""}return`
50
+ */var A5=ce,mr=b5;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Dx=new Set,Bo={};function Di(e,t){bs(e,t),bs(e+"Capture",t)}function bs(e,t){for(Bo[e]=t,e=0;e<t.length;e++)Dx.add(t[e])}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),t1=Object.prototype.hasOwnProperty,S5=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Vg={},Hg={};function I5(e){return t1.call(Hg,e)?!0:t1.call(Vg,e)?!1:S5.test(e)?Hg[e]=!0:(Vg[e]=!0,!1)}function T5(e,t,n,o){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R5(e,t,n,o){if(t===null||typeof t>"u"||T5(e,t,n,o))return!0;if(o)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Zt(e,t,n,o,c,u,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=c,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=h}var Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bt[e]=new Zt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Bt[t]=new Zt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bt[e]=new Zt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bt[e]=new Zt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Bt[e]=new Zt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bt[e]=new Zt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bt[e]=new Zt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bt[e]=new Zt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bt[e]=new Zt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Zd=/[\-:]([a-z])/g;function Qd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Zd,Qd);Bt[t]=new Zt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bt[e]=new Zt(e,1,!1,e.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new Zt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bt[e]=new Zt(e,1,!1,e.toLowerCase(),null,!0,!0)});function qd(e,t,n,o){var c=Bt.hasOwnProperty(t)?Bt[t]:null;(c!==null?c.type!==0:o||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(R5(t,n,c,o)&&(n=null),o||c===null?I5(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):c.mustUseProperty?e[c.propertyName]=n===null?c.type===3?!1:"":n:(t=c.attributeName,o=c.attributeNamespace,n===null?e.removeAttribute(t):(c=c.type,n=c===3||c===4&&n===!0?"":""+n,o?e.setAttributeNS(o,t,n):e.setAttribute(t,n))))}var Tn=A5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ha=Symbol.for("react.element"),qi=Symbol.for("react.portal"),Ji=Symbol.for("react.fragment"),Jd=Symbol.for("react.strict_mode"),r1=Symbol.for("react.profiler"),Px=Symbol.for("react.provider"),Lx=Symbol.for("react.context"),e0=Symbol.for("react.forward_ref"),n1=Symbol.for("react.suspense"),i1=Symbol.for("react.suspense_list"),t0=Symbol.for("react.memo"),Bn=Symbol.for("react.lazy"),Bx=Symbol.for("react.offscreen"),Gg=Symbol.iterator;function to(e){return e===null||typeof e!="object"?null:(e=Gg&&e[Gg]||e["@@iterator"],typeof e=="function"?e:null)}var tt=Object.assign,tf;function ho(e){if(tf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tf=t&&t[1]||""}return`
51
51
  `+tf+e}var rf=!1;function nf(e,t){if(!e||rf)return"";rf=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(m){var o=m}Reflect.construct(e,[],t)}else{try{t.call()}catch(m){o=m}e.call(t.prototype)}else{try{throw Error()}catch(m){o=m}e()}}catch(m){if(m&&o&&typeof m.stack=="string"){for(var c=m.stack.split(`
52
52
  `),u=o.stack.split(`
53
- `),g=c.length-1,x=u.length-1;1<=g&&0<=x&&c[g]!==u[x];)x--;for(;1<=g&&0<=x;g--,x--)if(c[g]!==u[x]){if(g!==1||x!==1)do if(g--,x--,0>x||c[g]!==u[x]){var w=`
54
- `+c[g].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),w}while(1<=g&&0<=x);break}}}finally{rf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ho(e):""}function T5(e){switch(e.tag){case 5:return ho(e.type);case 16:return ho("Lazy");case 13:return ho("Suspense");case 19:return ho("SuspenseList");case 0:case 2:case 15:return e=nf(e.type,!1),e;case 11:return e=nf(e.type.render,!1),e;case 1:return e=nf(e.type,!0),e;default:return""}}function s1(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ji:return"Fragment";case qi:return"Portal";case r1:return"Profiler";case Jd:return"StrictMode";case n1:return"Suspense";case i1:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Px:return(e.displayName||"Context")+".Consumer";case Dx:return(e._context.displayName||"Context")+".Provider";case e0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case t0:return t=e.displayName||null,t!==null?t:s1(e.type)||"Memo";case Bn:t=e._payload,e=e._init;try{return s1(e(t))}catch{}}return null}function R5(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return s1(t);case 8:return t===Jd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Jn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _5(e){var t=Bx(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var c=n.get,u=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){o=""+g,u.call(this,g)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return o},setValue:function(g){o=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ha(e){e._valueTracker||(e._valueTracker=_5(e))}function Fx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=Bx(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}function jl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function o1(e,t){var n=t.checked;return tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Xg(e,t){var n=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;n=Jn(t.value!=null?t.value:n),e._wrapperState={initialChecked:o,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ux(e,t){t=t.checked,t!=null&&qd(e,"checked",t,!1)}function a1(e,t){Ux(e,t);var n=Jn(t.value),o=t.type;if(n!=null)o==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?l1(e,t.type,n):t.hasOwnProperty("defaultValue")&&l1(e,t.type,Jn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yg(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function l1(e,t,n){(t!=="number"||jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var go=Array.isArray;function hs(e,t,n,o){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&o&&(e[n].defaultSelected=!0)}else{for(n=""+Jn(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,o&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function c1(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Kg(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(go(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Jn(n)}}function jx(e,t){var n=Jn(t.value),o=Jn(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),o!=null&&(e.defaultValue=""+o)}function Zg(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Wx(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function u1(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Wx(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ga,$x=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,o,c){MSApp.execUnsafeLocalFunction(function(){return e(t,n,o,c)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ga=Ga||document.createElement("div"),Ga.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ga.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Eo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},O5=["Webkit","ms","Moz","O"];Object.keys(Eo).forEach(function(e){O5.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Eo[t]=Eo[e]})});function zx(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Eo.hasOwnProperty(e)&&Eo[e]?(""+t).trim():t+"px"}function Vx(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var o=n.indexOf("--")===0,c=zx(n,t[n],o);n==="float"&&(n="cssFloat"),o?e.setProperty(n,c):e[n]=c}}var N5=tt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function f1(e,t){if(t){if(N5[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function d1(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var h1=null;function r0(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var g1=null,gs=null,ps=null;function Qg(e){if(e=da(e)){if(typeof g1!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Uc(t),g1(e.stateNode,e.type,t))}}function Hx(e){gs?ps?ps.push(e):ps=[e]:gs=e}function Gx(){if(gs){var e=gs,t=ps;if(ps=gs=null,Qg(e),t)for(e=0;e<t.length;e++)Qg(t[e])}}function Xx(e,t){return e(t)}function Yx(){}var sf=!1;function Kx(e,t,n){if(sf)return e(t,n);sf=!0;try{return Xx(e,t,n)}finally{sf=!1,(gs!==null||ps!==null)&&(Yx(),Gx())}}function Uo(e,t){var n=e.stateNode;if(n===null)return null;var o=Uc(n);if(o===null)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var p1=!1;if(En)try{var ro={};Object.defineProperty(ro,"passive",{get:function(){p1=!0}}),window.addEventListener("test",ro,ro),window.removeEventListener("test",ro,ro)}catch{p1=!1}function k5(e,t,n,o,c,u,g,x,w){var m=Array.prototype.slice.call(arguments,3);try{t.apply(n,m)}catch(C){this.onError(C)}}var Co=!1,Wl=null,$l=!1,m1=null,M5={onError:function(e){Co=!0,Wl=e}};function D5(e,t,n,o,c,u,g,x,w){Co=!1,Wl=null,k5.apply(M5,arguments)}function P5(e,t,n,o,c,u,g,x,w){if(D5.apply(this,arguments),Co){if(Co){var m=Wl;Co=!1,Wl=null}else throw Error(Q(198));$l||($l=!0,m1=m)}}function Pi(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Zx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function qg(e){if(Pi(e)!==e)throw Error(Q(188))}function L5(e){var t=e.alternate;if(!t){if(t=Pi(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,o=t;;){var c=n.return;if(c===null)break;var u=c.alternate;if(u===null){if(o=c.return,o!==null){n=o;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===n)return qg(c),e;if(u===o)return qg(c),t;u=u.sibling}throw Error(Q(188))}if(n.return!==o.return)n=c,o=u;else{for(var g=!1,x=c.child;x;){if(x===n){g=!0,n=c,o=u;break}if(x===o){g=!0,o=c,n=u;break}x=x.sibling}if(!g){for(x=u.child;x;){if(x===n){g=!0,n=u,o=c;break}if(x===o){g=!0,o=u,n=c;break}x=x.sibling}if(!g)throw Error(Q(189))}}if(n.alternate!==o)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function Qx(e){return e=L5(e),e!==null?qx(e):null}function qx(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=qx(e);if(t!==null)return t;e=e.sibling}return null}var Jx=mr.unstable_scheduleCallback,Jg=mr.unstable_cancelCallback,B5=mr.unstable_shouldYield,F5=mr.unstable_requestPaint,ut=mr.unstable_now,U5=mr.unstable_getCurrentPriorityLevel,n0=mr.unstable_ImmediatePriority,ew=mr.unstable_UserBlockingPriority,zl=mr.unstable_NormalPriority,j5=mr.unstable_LowPriority,tw=mr.unstable_IdlePriority,Pc=null,sn=null;function W5(e){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(Pc,e,void 0,(e.current.flags&128)===128)}catch{}}var $r=Math.clz32?Math.clz32:V5,$5=Math.log,z5=Math.LN2;function V5(e){return e>>>=0,e===0?32:31-($5(e)/z5|0)|0}var Xa=64,Ya=4194304;function po(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Vl(e,t){var n=e.pendingLanes;if(n===0)return 0;var o=0,c=e.suspendedLanes,u=e.pingedLanes,g=n&268435455;if(g!==0){var x=g&~c;x!==0?o=po(x):(u&=g,u!==0&&(o=po(u)))}else g=n&~c,g!==0?o=po(g):u!==0&&(o=po(u));if(o===0)return 0;if(t!==0&&t!==o&&!(t&c)&&(c=o&-o,u=t&-t,c>=u||c===16&&(u&4194240)!==0))return t;if(o&4&&(o|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0<t;)n=31-$r(t),c=1<<n,o|=e[n],t&=~c;return o}function H5(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function G5(e,t){for(var n=e.suspendedLanes,o=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes;0<u;){var g=31-$r(u),x=1<<g,w=c[g];w===-1?(!(x&n)||x&o)&&(c[g]=H5(x,t)):w<=t&&(e.expiredLanes|=x),u&=~x}}function x1(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function rw(){var e=Xa;return Xa<<=1,!(Xa&4194240)&&(Xa=64),e}function of(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ua(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$r(t),e[t]=n}function X5(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0<n;){var c=31-$r(n),u=1<<c;t[c]=0,o[c]=-1,e[c]=-1,n&=~u}}function i0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var o=31-$r(n),c=1<<o;c&t|e[o]&t&&(e[o]|=t),n&=~c}}var Pe=0;function nw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var iw,s0,sw,ow,aw,w1=!1,Ka=[],Hn=null,Gn=null,Xn=null,jo=new Map,Wo=new Map,Un=[],Y5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ep(e,t){switch(e){case"focusin":case"focusout":Hn=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":Xn=null;break;case"pointerover":case"pointerout":jo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wo.delete(t.pointerId)}}function no(e,t,n,o,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:o,nativeEvent:u,targetContainers:[c]},t!==null&&(t=da(t),t!==null&&s0(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function K5(e,t,n,o,c){switch(t){case"focusin":return Hn=no(Hn,e,t,n,o,c),!0;case"dragenter":return Gn=no(Gn,e,t,n,o,c),!0;case"mouseover":return Xn=no(Xn,e,t,n,o,c),!0;case"pointerover":var u=c.pointerId;return jo.set(u,no(jo.get(u)||null,e,t,n,o,c)),!0;case"gotpointercapture":return u=c.pointerId,Wo.set(u,no(Wo.get(u)||null,e,t,n,o,c)),!0}return!1}function lw(e){var t=wi(e.target);if(t!==null){var n=Pi(t);if(n!==null){if(t=n.tag,t===13){if(t=Zx(n),t!==null){e.blockedOn=t,aw(e.priority,function(){sw(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=v1(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var o=new n.constructor(n.type,n);h1=o,n.target.dispatchEvent(o),h1=null}else return t=da(n),t!==null&&s0(t),e.blockedOn=n,!1;t.shift()}return!0}function tp(e,t,n){yl(e)&&n.delete(t)}function Z5(){w1=!1,Hn!==null&&yl(Hn)&&(Hn=null),Gn!==null&&yl(Gn)&&(Gn=null),Xn!==null&&yl(Xn)&&(Xn=null),jo.forEach(tp),Wo.forEach(tp)}function io(e,t){e.blockedOn===t&&(e.blockedOn=null,w1||(w1=!0,mr.unstable_scheduleCallback(mr.unstable_NormalPriority,Z5)))}function $o(e){function t(c){return io(c,e)}if(0<Ka.length){io(Ka[0],e);for(var n=1;n<Ka.length;n++){var o=Ka[n];o.blockedOn===e&&(o.blockedOn=null)}}for(Hn!==null&&io(Hn,e),Gn!==null&&io(Gn,e),Xn!==null&&io(Xn,e),jo.forEach(t),Wo.forEach(t),n=0;n<Un.length;n++)o=Un[n],o.blockedOn===e&&(o.blockedOn=null);for(;0<Un.length&&(n=Un[0],n.blockedOn===null);)lw(n),n.blockedOn===null&&Un.shift()}var ms=Tn.ReactCurrentBatchConfig,Hl=!0;function Q5(e,t,n,o){var c=Pe,u=ms.transition;ms.transition=null;try{Pe=1,o0(e,t,n,o)}finally{Pe=c,ms.transition=u}}function q5(e,t,n,o){var c=Pe,u=ms.transition;ms.transition=null;try{Pe=4,o0(e,t,n,o)}finally{Pe=c,ms.transition=u}}function o0(e,t,n,o){if(Hl){var c=v1(e,t,n,o);if(c===null)mf(e,t,o,Gl,n),ep(e,o);else if(K5(c,e,t,n,o))o.stopPropagation();else if(ep(e,o),t&4&&-1<Y5.indexOf(e)){for(;c!==null;){var u=da(c);if(u!==null&&iw(u),u=v1(e,t,n,o),u===null&&mf(e,t,o,Gl,n),u===c)break;c=u}c!==null&&o.stopPropagation()}else mf(e,t,o,null,n)}}var Gl=null;function v1(e,t,n,o){if(Gl=null,e=r0(o),e=wi(e),e!==null)if(t=Pi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Zx(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Gl=e,null}function cw(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(U5()){case n0:return 1;case ew:return 4;case zl:case j5:return 16;case tw:return 536870912;default:return 16}default:return 16}}var zn=null,a0=null,El=null;function uw(){if(El)return El;var e,t=a0,n=t.length,o,c="value"in zn?zn.value:zn.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var g=n-e;for(o=1;o<=g&&t[n-o]===c[u-o];o++);return El=c.slice(e,1<o?1-o:void 0)}function Cl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Za(){return!0}function rp(){return!1}function yr(e){function t(n,o,c,u,g){this._reactName=n,this._targetInst=c,this.type=o,this.nativeEvent=u,this.target=g,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(u):u[x]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Za:rp,this.isPropagationStopped=rp,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Za)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Za)},persist:function(){},isPersistent:Za}),t}var Ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},l0=yr(Ps),fa=tt({},Ps,{view:0,detail:0}),J5=yr(fa),af,lf,so,Lc=tt({},fa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:c0,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==so&&(so&&e.type==="mousemove"?(af=e.screenX-so.screenX,lf=e.screenY-so.screenY):lf=af=0,so=e),af)},movementY:function(e){return"movementY"in e?e.movementY:lf}}),np=yr(Lc),e7=tt({},Lc,{dataTransfer:0}),t7=yr(e7),r7=tt({},fa,{relatedTarget:0}),cf=yr(r7),n7=tt({},Ps,{animationName:0,elapsedTime:0,pseudoElement:0}),i7=yr(n7),s7=tt({},Ps,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),o7=yr(s7),a7=tt({},Ps,{data:0}),ip=yr(a7),l7={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},c7={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},u7={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f7(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=u7[e])?!!t[e]:!1}function c0(){return f7}var d7=tt({},fa,{key:function(e){if(e.key){var t=l7[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Cl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?c7[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:c0,charCode:function(e){return e.type==="keypress"?Cl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Cl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),h7=yr(d7),g7=tt({},Lc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sp=yr(g7),p7=tt({},fa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:c0}),m7=yr(p7),x7=tt({},Ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),w7=yr(x7),v7=tt({},Lc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),y7=yr(v7),E7=[9,13,27,32],u0=En&&"CompositionEvent"in window,bo=null;En&&"documentMode"in document&&(bo=document.documentMode);var C7=En&&"TextEvent"in window&&!bo,fw=En&&(!u0||bo&&8<bo&&11>=bo),op=" ",ap=!1;function dw(e,t){switch(e){case"keyup":return E7.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var es=!1;function b7(e,t){switch(e){case"compositionend":return hw(t);case"keypress":return t.which!==32?null:(ap=!0,op);case"textInput":return e=t.data,e===op&&ap?null:e;default:return null}}function A7(e,t){if(es)return e==="compositionend"||!u0&&dw(e,t)?(e=uw(),El=a0=zn=null,es=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return fw&&t.locale!=="ko"?null:t.data;default:return null}}var S7={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!S7[e.type]:t==="textarea"}function gw(e,t,n,o){Hx(o),t=Xl(t,"onChange"),0<t.length&&(n=new l0("onChange","change",null,n,o),e.push({event:n,listeners:t}))}var Ao=null,zo=null;function I7(e){Sw(e,0)}function Bc(e){var t=ns(e);if(Fx(t))return e}function T7(e,t){if(e==="change")return t}var pw=!1;if(En){var uf;if(En){var ff="oninput"in document;if(!ff){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),ff=typeof cp.oninput=="function"}uf=ff}else uf=!1;pw=uf&&(!document.documentMode||9<document.documentMode)}function up(){Ao&&(Ao.detachEvent("onpropertychange",mw),zo=Ao=null)}function mw(e){if(e.propertyName==="value"&&Bc(zo)){var t=[];gw(t,zo,e,r0(e)),Kx(I7,t)}}function R7(e,t,n){e==="focusin"?(up(),Ao=t,zo=n,Ao.attachEvent("onpropertychange",mw)):e==="focusout"&&up()}function _7(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Bc(zo)}function O7(e,t){if(e==="click")return Bc(t)}function N7(e,t){if(e==="input"||e==="change")return Bc(t)}function k7(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vr=typeof Object.is=="function"?Object.is:k7;function Vo(e,t){if(Vr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(o=0;o<n.length;o++){var c=n[o];if(!t1.call(t,c)||!Vr(e[c],t[c]))return!1}return!0}function fp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dp(e,t){var n=fp(e);e=0;for(var o;n;){if(n.nodeType===3){if(o=e+n.textContent.length,e<=t&&o>=t)return{node:n,offset:t-e};e=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=fp(n)}}function xw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ww(){for(var e=window,t=jl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=jl(e.document)}return t}function f0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function M7(e){var t=ww(),n=e.focusedElem,o=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xw(n.ownerDocument.documentElement,n)){if(o!==null&&f0(n)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=n.textContent.length,u=Math.min(o.start,c);o=o.end===void 0?u:Math.min(o.end,c),!e.extend&&u>o&&(c=o,o=u,u=c),c=dp(n,u);var g=dp(n,o);c&&g&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==g.node||e.focusOffset!==g.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),u>o?(e.addRange(t),e.extend(g.node,g.offset)):(t.setEnd(g.node,g.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var D7=En&&"documentMode"in document&&11>=document.documentMode,ts=null,y1=null,So=null,E1=!1;function hp(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;E1||ts==null||ts!==jl(o)||(o=ts,"selectionStart"in o&&f0(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),So&&Vo(So,o)||(So=o,o=Xl(y1,"onSelect"),0<o.length&&(t=new l0("onSelect","select",null,t,n),e.push({event:t,listeners:o}),t.target=ts)))}function Qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var rs={animationend:Qa("Animation","AnimationEnd"),animationiteration:Qa("Animation","AnimationIteration"),animationstart:Qa("Animation","AnimationStart"),transitionend:Qa("Transition","TransitionEnd")},df={},vw={};En&&(vw=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Fc(e){if(df[e])return df[e];if(!rs[e])return e;var t=rs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in vw)return df[e]=t[n];return e}var yw=Fc("animationend"),Ew=Fc("animationiteration"),Cw=Fc("animationstart"),bw=Fc("transitionend"),Aw=new Map,gp="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ni(e,t){Aw.set(e,t),Di(t,[e])}for(var hf=0;hf<gp.length;hf++){var gf=gp[hf],P7=gf.toLowerCase(),L7=gf[0].toUpperCase()+gf.slice(1);ni(P7,"on"+L7)}ni(yw,"onAnimationEnd");ni(Ew,"onAnimationIteration");ni(Cw,"onAnimationStart");ni("dblclick","onDoubleClick");ni("focusin","onFocus");ni("focusout","onBlur");ni(bw,"onTransitionEnd");bs("onMouseEnter",["mouseout","mouseover"]);bs("onMouseLeave",["mouseout","mouseover"]);bs("onPointerEnter",["pointerout","pointerover"]);bs("onPointerLeave",["pointerout","pointerover"]);Di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Di("onBeforeInput",["compositionend","keypress","textInput","paste"]);Di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),B7=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function pp(e,t,n){var o=e.type||"unknown-event";e.currentTarget=n,P5(o,t,void 0,e),e.currentTarget=null}function Sw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var o=e[n],c=o.event;o=o.listeners;e:{var u=void 0;if(t)for(var g=o.length-1;0<=g;g--){var x=o[g],w=x.instance,m=x.currentTarget;if(x=x.listener,w!==u&&c.isPropagationStopped())break e;pp(c,x,m),u=w}else for(g=0;g<o.length;g++){if(x=o[g],w=x.instance,m=x.currentTarget,x=x.listener,w!==u&&c.isPropagationStopped())break e;pp(c,x,m),u=w}}}if($l)throw e=m1,$l=!1,m1=null,e}function Ve(e,t){var n=t[I1];n===void 0&&(n=t[I1]=new Set);var o=e+"__bubble";n.has(o)||(Iw(t,e,2,!1),n.add(o))}function pf(e,t,n){var o=0;t&&(o|=4),Iw(n,e,o,t)}var qa="_reactListening"+Math.random().toString(36).slice(2);function Ho(e){if(!e[qa]){e[qa]=!0,Mx.forEach(function(n){n!=="selectionchange"&&(B7.has(n)||pf(n,!1,e),pf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qa]||(t[qa]=!0,pf("selectionchange",!1,t))}}function Iw(e,t,n,o){switch(cw(t)){case 1:var c=Q5;break;case 4:c=q5;break;default:c=o0}n=c.bind(null,t,n,e),c=void 0,!p1||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),o?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function mf(e,t,n,o,c){var u=o;if(!(t&1)&&!(t&2)&&o!==null)e:for(;;){if(o===null)return;var g=o.tag;if(g===3||g===4){var x=o.stateNode.containerInfo;if(x===c||x.nodeType===8&&x.parentNode===c)break;if(g===4)for(g=o.return;g!==null;){var w=g.tag;if((w===3||w===4)&&(w=g.stateNode.containerInfo,w===c||w.nodeType===8&&w.parentNode===c))return;g=g.return}for(;x!==null;){if(g=wi(x),g===null)return;if(w=g.tag,w===5||w===6){o=u=g;continue e}x=x.parentNode}}o=o.return}Kx(function(){var m=u,C=r0(n),b=[];e:{var A=Aw.get(e);if(A!==void 0){var T=l0,k=e;switch(e){case"keypress":if(Cl(n)===0)break e;case"keydown":case"keyup":T=h7;break;case"focusin":k="focus",T=cf;break;case"focusout":k="blur",T=cf;break;case"beforeblur":case"afterblur":T=cf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":T=np;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":T=t7;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":T=m7;break;case yw:case Ew:case Cw:T=i7;break;case bw:T=w7;break;case"scroll":T=J5;break;case"wheel":T=y7;break;case"copy":case"cut":case"paste":T=o7;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":T=sp}var M=(t&4)!==0,G=!M&&e==="scroll",N=M?A!==null?A+"Capture":null:A;M=[];for(var I=m,O;I!==null;){O=I;var B=O.stateNode;if(O.tag===5&&B!==null&&(O=B,N!==null&&(B=Uo(I,N),B!=null&&M.push(Go(I,B,O)))),G)break;I=I.return}0<M.length&&(A=new T(A,k,null,n,C),b.push({event:A,listeners:M}))}}if(!(t&7)){e:{if(A=e==="mouseover"||e==="pointerover",T=e==="mouseout"||e==="pointerout",A&&n!==h1&&(k=n.relatedTarget||n.fromElement)&&(wi(k)||k[Cn]))break e;if((T||A)&&(A=C.window===C?C:(A=C.ownerDocument)?A.defaultView||A.parentWindow:window,T?(k=n.relatedTarget||n.toElement,T=m,k=k?wi(k):null,k!==null&&(G=Pi(k),k!==G||k.tag!==5&&k.tag!==6)&&(k=null)):(T=null,k=m),T!==k)){if(M=np,B="onMouseLeave",N="onMouseEnter",I="mouse",(e==="pointerout"||e==="pointerover")&&(M=sp,B="onPointerLeave",N="onPointerEnter",I="pointer"),G=T==null?A:ns(T),O=k==null?A:ns(k),A=new M(B,I+"leave",T,n,C),A.target=G,A.relatedTarget=O,B=null,wi(C)===m&&(M=new M(N,I+"enter",k,n,C),M.target=O,M.relatedTarget=G,B=M),G=B,T&&k)t:{for(M=T,N=k,I=0,O=M;O;O=Xi(O))I++;for(O=0,B=N;B;B=Xi(B))O++;for(;0<I-O;)M=Xi(M),I--;for(;0<O-I;)N=Xi(N),O--;for(;I--;){if(M===N||N!==null&&M===N.alternate)break t;M=Xi(M),N=Xi(N)}M=null}else M=null;T!==null&&mp(b,A,T,M,!1),k!==null&&G!==null&&mp(b,G,k,M,!0)}}e:{if(A=m?ns(m):window,T=A.nodeName&&A.nodeName.toLowerCase(),T==="select"||T==="input"&&A.type==="file")var j=T7;else if(lp(A))if(pw)j=N7;else{j=_7;var U=R7}else(T=A.nodeName)&&T.toLowerCase()==="input"&&(A.type==="checkbox"||A.type==="radio")&&(j=O7);if(j&&(j=j(e,m))){gw(b,j,n,C);break e}U&&U(e,A,m),e==="focusout"&&(U=A._wrapperState)&&U.controlled&&A.type==="number"&&l1(A,"number",A.value)}switch(U=m?ns(m):window,e){case"focusin":(lp(U)||U.contentEditable==="true")&&(ts=U,y1=m,So=null);break;case"focusout":So=y1=ts=null;break;case"mousedown":E1=!0;break;case"contextmenu":case"mouseup":case"dragend":E1=!1,hp(b,n,C);break;case"selectionchange":if(D7)break;case"keydown":case"keyup":hp(b,n,C)}var F;if(u0)e:{switch(e){case"compositionstart":var Y="onCompositionStart";break e;case"compositionend":Y="onCompositionEnd";break e;case"compositionupdate":Y="onCompositionUpdate";break e}Y=void 0}else es?dw(e,n)&&(Y="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Y="onCompositionStart");Y&&(fw&&n.locale!=="ko"&&(es||Y!=="onCompositionStart"?Y==="onCompositionEnd"&&es&&(F=uw()):(zn=C,a0="value"in zn?zn.value:zn.textContent,es=!0)),U=Xl(m,Y),0<U.length&&(Y=new ip(Y,e,null,n,C),b.push({event:Y,listeners:U}),F?Y.data=F:(F=hw(n),F!==null&&(Y.data=F)))),(F=C7?b7(e,n):A7(e,n))&&(m=Xl(m,"onBeforeInput"),0<m.length&&(C=new ip("onBeforeInput","beforeinput",null,n,C),b.push({event:C,listeners:m}),C.data=F))}Sw(b,t)})}function Go(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Xl(e,t){for(var n=t+"Capture",o=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=Uo(e,n),u!=null&&o.unshift(Go(e,u,c)),u=Uo(e,t),u!=null&&o.push(Go(e,u,c))),e=e.return}return o}function Xi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function mp(e,t,n,o,c){for(var u=t._reactName,g=[];n!==null&&n!==o;){var x=n,w=x.alternate,m=x.stateNode;if(w!==null&&w===o)break;x.tag===5&&m!==null&&(x=m,c?(w=Uo(n,u),w!=null&&g.unshift(Go(n,w,x))):c||(w=Uo(n,u),w!=null&&g.push(Go(n,w,x)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var F7=/\r\n?/g,U7=/\u0000|\uFFFD/g;function xp(e){return(typeof e=="string"?e:""+e).replace(F7,`
55
- `).replace(U7,"")}function Ja(e,t,n){if(t=xp(t),xp(e)!==t&&n)throw Error(Q(425))}function Yl(){}var C1=null,b1=null;function A1(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var S1=typeof setTimeout=="function"?setTimeout:void 0,j7=typeof clearTimeout=="function"?clearTimeout:void 0,wp=typeof Promise=="function"?Promise:void 0,W7=typeof queueMicrotask=="function"?queueMicrotask:typeof wp<"u"?function(e){return wp.resolve(null).then(e).catch($7)}:S1;function $7(e){setTimeout(function(){throw e})}function xf(e,t){var n=t,o=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"){if(o===0){e.removeChild(c),$o(t);return}o--}else n!=="$"&&n!=="$?"&&n!=="$!"||o++;n=c}while(n);$o(t)}function Yn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function vp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ls=Math.random().toString(36).slice(2),nn="__reactFiber$"+Ls,Xo="__reactProps$"+Ls,Cn="__reactContainer$"+Ls,I1="__reactEvents$"+Ls,z7="__reactListeners$"+Ls,V7="__reactHandles$"+Ls;function wi(e){var t=e[nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cn]||n[nn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vp(e);e!==null;){if(n=e[nn])return n;e=vp(e)}return t}e=n,n=e.parentNode}return null}function da(e){return e=e[nn]||e[Cn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ns(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function Uc(e){return e[Xo]||null}var T1=[],is=-1;function ii(e){return{current:e}}function He(e){0>is||(e.current=T1[is],T1[is]=null,is--)}function $e(e,t){is++,T1[is]=e.current,e.current=t}var ei={},zt=ii(ei),ar=ii(!1),Ti=ei;function As(e,t){var n=e.type.contextTypes;if(!n)return ei;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var c={},u;for(u in n)c[u]=t[u];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function lr(e){return e=e.childContextTypes,e!=null}function Kl(){He(ar),He(zt)}function yp(e,t,n){if(zt.current!==ei)throw Error(Q(168));$e(zt,t),$e(ar,n)}function Tw(e,t,n){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var c in o)if(!(c in t))throw Error(Q(108,R5(e)||"Unknown",c));return tt({},n,o)}function Zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ei,Ti=zt.current,$e(zt,e),$e(ar,ar.current),!0}function Ep(e,t,n){var o=e.stateNode;if(!o)throw Error(Q(169));n?(e=Tw(e,t,Ti),o.__reactInternalMemoizedMergedChildContext=e,He(ar),He(zt),$e(zt,e)):He(ar),$e(ar,n)}var gn=null,jc=!1,wf=!1;function Rw(e){gn===null?gn=[e]:gn.push(e)}function H7(e){jc=!0,Rw(e)}function si(){if(!wf&&gn!==null){wf=!0;var e=0,t=Pe;try{var n=gn;for(Pe=1;e<n.length;e++){var o=n[e];do o=o(!0);while(o!==null)}gn=null,jc=!1}catch(c){throw gn!==null&&(gn=gn.slice(e+1)),Jx(n0,si),c}finally{Pe=t,wf=!1}}return null}var ss=[],os=0,Ql=null,ql=0,Ir=[],Tr=0,Ri=null,mn=1,xn="";function pi(e,t){ss[os++]=ql,ss[os++]=Ql,Ql=e,ql=t}function _w(e,t,n){Ir[Tr++]=mn,Ir[Tr++]=xn,Ir[Tr++]=Ri,Ri=e;var o=mn;e=xn;var c=32-$r(o)-1;o&=~(1<<c),n+=1;var u=32-$r(t)+c;if(30<u){var g=c-c%5;u=(o&(1<<g)-1).toString(32),o>>=g,c-=g,mn=1<<32-$r(t)+c|n<<c|o,xn=u+e}else mn=1<<u|n<<c|o,xn=e}function d0(e){e.return!==null&&(pi(e,1),_w(e,1,0))}function h0(e){for(;e===Ql;)Ql=ss[--os],ss[os]=null,ql=ss[--os],ss[os]=null;for(;e===Ri;)Ri=Ir[--Tr],Ir[Tr]=null,xn=Ir[--Tr],Ir[Tr]=null,mn=Ir[--Tr],Ir[Tr]=null}var pr=null,gr=null,Ke=!1,Wr=null;function Ow(e,t){var n=Rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Cp(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,pr=e,gr=Yn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,pr=e,gr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ri!==null?{id:mn,overflow:xn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,pr=e,gr=null,!0):!1;default:return!1}}function R1(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _1(e){if(Ke){var t=gr;if(t){var n=t;if(!Cp(e,t)){if(R1(e))throw Error(Q(418));t=Yn(n.nextSibling);var o=pr;t&&Cp(e,t)?Ow(o,n):(e.flags=e.flags&-4097|2,Ke=!1,pr=e)}}else{if(R1(e))throw Error(Q(418));e.flags=e.flags&-4097|2,Ke=!1,pr=e}}}function bp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;pr=e}function el(e){if(e!==pr)return!1;if(!Ke)return bp(e),Ke=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!A1(e.type,e.memoizedProps)),t&&(t=gr)){if(R1(e))throw Nw(),Error(Q(418));for(;t;)Ow(e,t),t=Yn(t.nextSibling)}if(bp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){gr=Yn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}gr=null}}else gr=pr?Yn(e.stateNode.nextSibling):null;return!0}function Nw(){for(var e=gr;e;)e=Yn(e.nextSibling)}function Ss(){gr=pr=null,Ke=!1}function g0(e){Wr===null?Wr=[e]:Wr.push(e)}var G7=Tn.ReactCurrentBatchConfig;function oo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var o=n.stateNode}if(!o)throw Error(Q(147,e));var c=o,u=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===u?t.ref:(t=function(g){var x=c.refs;g===null?delete x[u]:x[u]=g},t._stringRef=u,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function tl(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ap(e){var t=e._init;return t(e._payload)}function kw(e){function t(N,I){if(e){var O=N.deletions;O===null?(N.deletions=[I],N.flags|=16):O.push(I)}}function n(N,I){if(!e)return null;for(;I!==null;)t(N,I),I=I.sibling;return null}function o(N,I){for(N=new Map;I!==null;)I.key!==null?N.set(I.key,I):N.set(I.index,I),I=I.sibling;return N}function c(N,I){return N=qn(N,I),N.index=0,N.sibling=null,N}function u(N,I,O){return N.index=O,e?(O=N.alternate,O!==null?(O=O.index,O<I?(N.flags|=2,I):O):(N.flags|=2,I)):(N.flags|=1048576,I)}function g(N){return e&&N.alternate===null&&(N.flags|=2),N}function x(N,I,O,B){return I===null||I.tag!==6?(I=Sf(O,N.mode,B),I.return=N,I):(I=c(I,O),I.return=N,I)}function w(N,I,O,B){var j=O.type;return j===Ji?C(N,I,O.props.children,B,O.key):I!==null&&(I.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Bn&&Ap(j)===I.type)?(B=c(I,O.props),B.ref=oo(N,I,O),B.return=N,B):(B=_l(O.type,O.key,O.props,null,N.mode,B),B.ref=oo(N,I,O),B.return=N,B)}function m(N,I,O,B){return I===null||I.tag!==4||I.stateNode.containerInfo!==O.containerInfo||I.stateNode.implementation!==O.implementation?(I=If(O,N.mode,B),I.return=N,I):(I=c(I,O.children||[]),I.return=N,I)}function C(N,I,O,B,j){return I===null||I.tag!==7?(I=Ai(O,N.mode,B,j),I.return=N,I):(I=c(I,O),I.return=N,I)}function b(N,I,O){if(typeof I=="string"&&I!==""||typeof I=="number")return I=Sf(""+I,N.mode,O),I.return=N,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case Va:return O=_l(I.type,I.key,I.props,null,N.mode,O),O.ref=oo(N,null,I),O.return=N,O;case qi:return I=If(I,N.mode,O),I.return=N,I;case Bn:var B=I._init;return b(N,B(I._payload),O)}if(go(I)||to(I))return I=Ai(I,N.mode,O,null),I.return=N,I;tl(N,I)}return null}function A(N,I,O,B){var j=I!==null?I.key:null;if(typeof O=="string"&&O!==""||typeof O=="number")return j!==null?null:x(N,I,""+O,B);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case Va:return O.key===j?w(N,I,O,B):null;case qi:return O.key===j?m(N,I,O,B):null;case Bn:return j=O._init,A(N,I,j(O._payload),B)}if(go(O)||to(O))return j!==null?null:C(N,I,O,B,null);tl(N,O)}return null}function T(N,I,O,B,j){if(typeof B=="string"&&B!==""||typeof B=="number")return N=N.get(O)||null,x(I,N,""+B,j);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case Va:return N=N.get(B.key===null?O:B.key)||null,w(I,N,B,j);case qi:return N=N.get(B.key===null?O:B.key)||null,m(I,N,B,j);case Bn:var U=B._init;return T(N,I,O,U(B._payload),j)}if(go(B)||to(B))return N=N.get(O)||null,C(I,N,B,j,null);tl(I,B)}return null}function k(N,I,O,B){for(var j=null,U=null,F=I,Y=I=0,z=null;F!==null&&Y<O.length;Y++){F.index>Y?(z=F,F=null):z=F.sibling;var oe=A(N,F,O[Y],B);if(oe===null){F===null&&(F=z);break}e&&F&&oe.alternate===null&&t(N,F),I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe,F=z}if(Y===O.length)return n(N,F),Ke&&pi(N,Y),j;if(F===null){for(;Y<O.length;Y++)F=b(N,O[Y],B),F!==null&&(I=u(F,I,Y),U===null?j=F:U.sibling=F,U=F);return Ke&&pi(N,Y),j}for(F=o(N,F);Y<O.length;Y++)z=T(F,N,Y,O[Y],B),z!==null&&(e&&z.alternate!==null&&F.delete(z.key===null?Y:z.key),I=u(z,I,Y),U===null?j=z:U.sibling=z,U=z);return e&&F.forEach(function(ve){return t(N,ve)}),Ke&&pi(N,Y),j}function M(N,I,O,B){var j=to(O);if(typeof j!="function")throw Error(Q(150));if(O=j.call(O),O==null)throw Error(Q(151));for(var U=j=null,F=I,Y=I=0,z=null,oe=O.next();F!==null&&!oe.done;Y++,oe=O.next()){F.index>Y?(z=F,F=null):z=F.sibling;var ve=A(N,F,oe.value,B);if(ve===null){F===null&&(F=z);break}e&&F&&ve.alternate===null&&t(N,F),I=u(ve,I,Y),U===null?j=ve:U.sibling=ve,U=ve,F=z}if(oe.done)return n(N,F),Ke&&pi(N,Y),j;if(F===null){for(;!oe.done;Y++,oe=O.next())oe=b(N,oe.value,B),oe!==null&&(I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe);return Ke&&pi(N,Y),j}for(F=o(N,F);!oe.done;Y++,oe=O.next())oe=T(F,N,Y,oe.value,B),oe!==null&&(e&&oe.alternate!==null&&F.delete(oe.key===null?Y:oe.key),I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe);return e&&F.forEach(function(ie){return t(N,ie)}),Ke&&pi(N,Y),j}function G(N,I,O,B){if(typeof O=="object"&&O!==null&&O.type===Ji&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case Va:e:{for(var j=O.key,U=I;U!==null;){if(U.key===j){if(j=O.type,j===Ji){if(U.tag===7){n(N,U.sibling),I=c(U,O.props.children),I.return=N,N=I;break e}}else if(U.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Bn&&Ap(j)===U.type){n(N,U.sibling),I=c(U,O.props),I.ref=oo(N,U,O),I.return=N,N=I;break e}n(N,U);break}else t(N,U);U=U.sibling}O.type===Ji?(I=Ai(O.props.children,N.mode,B,O.key),I.return=N,N=I):(B=_l(O.type,O.key,O.props,null,N.mode,B),B.ref=oo(N,I,O),B.return=N,N=B)}return g(N);case qi:e:{for(U=O.key;I!==null;){if(I.key===U)if(I.tag===4&&I.stateNode.containerInfo===O.containerInfo&&I.stateNode.implementation===O.implementation){n(N,I.sibling),I=c(I,O.children||[]),I.return=N,N=I;break e}else{n(N,I);break}else t(N,I);I=I.sibling}I=If(O,N.mode,B),I.return=N,N=I}return g(N);case Bn:return U=O._init,G(N,I,U(O._payload),B)}if(go(O))return k(N,I,O,B);if(to(O))return M(N,I,O,B);tl(N,O)}return typeof O=="string"&&O!==""||typeof O=="number"?(O=""+O,I!==null&&I.tag===6?(n(N,I.sibling),I=c(I,O),I.return=N,N=I):(n(N,I),I=Sf(O,N.mode,B),I.return=N,N=I),g(N)):n(N,I)}return G}var Is=kw(!0),Mw=kw(!1),Jl=ii(null),ec=null,as=null,p0=null;function m0(){p0=as=ec=null}function x0(e){var t=Jl.current;He(Jl),e._currentValue=t}function O1(e,t,n){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===n)break;e=e.return}}function xs(e,t){ec=e,p0=as=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(or=!0),e.firstContext=null)}function Or(e){var t=e._currentValue;if(p0!==e)if(e={context:e,memoizedValue:t,next:null},as===null){if(ec===null)throw Error(Q(308));as=e,ec.dependencies={lanes:0,firstContext:e}}else as=as.next=e;return t}var vi=null;function w0(e){vi===null?vi=[e]:vi.push(e)}function Dw(e,t,n,o){var c=t.interleaved;return c===null?(n.next=n,w0(t)):(n.next=c.next,c.next=n),t.interleaved=n,bn(e,o)}function bn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fn=!1;function v0(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Pw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Kn(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Oe&2){var c=o.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),o.pending=t,bn(e,n)}return c=o.interleaved,c===null?(t.next=t,w0(o)):(t.next=c.next,c.next=t),o.interleaved=t,bn(e,n)}function bl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,i0(e,n)}}function Sp(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var c=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var g={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};u===null?c=u=g:u=u.next=g,n=n.next}while(n!==null);u===null?c=u=t:u=u.next=t}else c=u=t;n={baseState:o.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:o.shared,effects:o.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function tc(e,t,n,o){var c=e.updateQueue;Fn=!1;var u=c.firstBaseUpdate,g=c.lastBaseUpdate,x=c.shared.pending;if(x!==null){c.shared.pending=null;var w=x,m=w.next;w.next=null,g===null?u=m:g.next=m,g=w;var C=e.alternate;C!==null&&(C=C.updateQueue,x=C.lastBaseUpdate,x!==g&&(x===null?C.firstBaseUpdate=m:x.next=m,C.lastBaseUpdate=w))}if(u!==null){var b=c.baseState;g=0,C=m=w=null,x=u;do{var A=x.lane,T=x.eventTime;if((o&A)===A){C!==null&&(C=C.next={eventTime:T,lane:0,tag:x.tag,payload:x.payload,callback:x.callback,next:null});e:{var k=e,M=x;switch(A=t,T=n,M.tag){case 1:if(k=M.payload,typeof k=="function"){b=k.call(T,b,A);break e}b=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=M.payload,A=typeof k=="function"?k.call(T,b,A):k,A==null)break e;b=tt({},b,A);break e;case 2:Fn=!0}}x.callback!==null&&x.lane!==0&&(e.flags|=64,A=c.effects,A===null?c.effects=[x]:A.push(x))}else T={eventTime:T,lane:A,tag:x.tag,payload:x.payload,callback:x.callback,next:null},C===null?(m=C=T,w=b):C=C.next=T,g|=A;if(x=x.next,x===null){if(x=c.shared.pending,x===null)break;A=x,x=A.next,A.next=null,c.lastBaseUpdate=A,c.shared.pending=null}}while(!0);if(C===null&&(w=b),c.baseState=w,c.firstBaseUpdate=m,c.lastBaseUpdate=C,t=c.shared.interleaved,t!==null){c=t;do g|=c.lane,c=c.next;while(c!==t)}else u===null&&(c.shared.lanes=0);Oi|=g,e.lanes=g,e.memoizedState=b}}function Ip(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var o=e[t],c=o.callback;if(c!==null){if(o.callback=null,o=n,typeof c!="function")throw Error(Q(191,c));c.call(o)}}}var ha={},on=ii(ha),Yo=ii(ha),Ko=ii(ha);function yi(e){if(e===ha)throw Error(Q(174));return e}function y0(e,t){switch($e(Ko,t),$e(Yo,e),$e(on,ha),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:u1(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=u1(t,e)}He(on),$e(on,t)}function Ts(){He(on),He(Yo),He(Ko)}function Lw(e){yi(Ko.current);var t=yi(on.current),n=u1(t,e.type);t!==n&&($e(Yo,e),$e(on,n))}function E0(e){Yo.current===e&&(He(on),He(Yo))}var Je=ii(0);function rc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vf=[];function C0(){for(var e=0;e<vf.length;e++)vf[e]._workInProgressVersionPrimary=null;vf.length=0}var Al=Tn.ReactCurrentDispatcher,yf=Tn.ReactCurrentBatchConfig,_i=0,et=null,yt=null,It=null,nc=!1,Io=!1,Zo=0,X7=0;function jt(){throw Error(Q(321))}function b0(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function A0(e,t,n,o,c,u){if(_i=u,et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Al.current=e===null||e.memoizedState===null?Q7:q7,e=n(o,c),Io){u=0;do{if(Io=!1,Zo=0,25<=u)throw Error(Q(301));u+=1,It=yt=null,t.updateQueue=null,Al.current=J7,e=n(o,c)}while(Io)}if(Al.current=ic,t=yt!==null&&yt.next!==null,_i=0,It=yt=et=null,nc=!1,t)throw Error(Q(300));return e}function S0(){var e=Zo!==0;return Zo=0,e}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?et.memoizedState=It=e:It=It.next=e,It}function Nr(){if(yt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=It===null?et.memoizedState:It.next;if(t!==null)It=t,yt=e;else{if(e===null)throw Error(Q(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},It===null?et.memoizedState=It=e:It=It.next=e}return It}function Qo(e,t){return typeof t=="function"?t(e):t}function Ef(e){var t=Nr(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var o=yt,c=o.baseQueue,u=n.pending;if(u!==null){if(c!==null){var g=c.next;c.next=u.next,u.next=g}o.baseQueue=c=u,n.pending=null}if(c!==null){u=c.next,o=o.baseState;var x=g=null,w=null,m=u;do{var C=m.lane;if((_i&C)===C)w!==null&&(w=w.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),o=m.hasEagerState?m.eagerState:e(o,m.action);else{var b={lane:C,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};w===null?(x=w=b,g=o):w=w.next=b,et.lanes|=C,Oi|=C}m=m.next}while(m!==null&&m!==u);w===null?g=o:w.next=x,Vr(o,t.memoizedState)||(or=!0),t.memoizedState=o,t.baseState=g,t.baseQueue=w,n.lastRenderedState=o}if(e=n.interleaved,e!==null){c=e;do u=c.lane,et.lanes|=u,Oi|=u,c=c.next;while(c!==e)}else c===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Cf(e){var t=Nr(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var o=n.dispatch,c=n.pending,u=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do u=e(u,g.action),g=g.next;while(g!==c);Vr(u,t.memoizedState)||(or=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,o]}function Bw(){}function Fw(e,t){var n=et,o=Nr(),c=t(),u=!Vr(o.memoizedState,c);if(u&&(o.memoizedState=c,or=!0),o=o.queue,I0(Ww.bind(null,n,o,e),[e]),o.getSnapshot!==t||u||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,qo(9,jw.bind(null,n,o,c,t),void 0,null),Tt===null)throw Error(Q(349));_i&30||Uw(n,t,c)}return c}function Uw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function jw(e,t,n,o){t.value=n,t.getSnapshot=o,$w(t)&&zw(e)}function Ww(e,t,n){return n(function(){$w(t)&&zw(e)})}function $w(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function zw(e){var t=bn(e,1);t!==null&&zr(t,e,1,-1)}function Tp(e){var t=rn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:e},t.queue=e,e=e.dispatch=Z7.bind(null,et,e),[t.memoizedState,e]}function qo(e,t,n,o){return e={tag:e,create:t,destroy:n,deps:o,next:null},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(o=n.next,n.next=e,e.next=o,t.lastEffect=e)),e}function Vw(){return Nr().memoizedState}function Sl(e,t,n,o){var c=rn();et.flags|=e,c.memoizedState=qo(1|t,n,void 0,o===void 0?null:o)}function Wc(e,t,n,o){var c=Nr();o=o===void 0?null:o;var u=void 0;if(yt!==null){var g=yt.memoizedState;if(u=g.destroy,o!==null&&b0(o,g.deps)){c.memoizedState=qo(t,n,u,o);return}}et.flags|=e,c.memoizedState=qo(1|t,n,u,o)}function Rp(e,t){return Sl(8390656,8,e,t)}function I0(e,t){return Wc(2048,8,e,t)}function Hw(e,t){return Wc(4,2,e,t)}function Gw(e,t){return Wc(4,4,e,t)}function Xw(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Yw(e,t,n){return n=n!=null?n.concat([e]):null,Wc(4,4,Xw.bind(null,t,e),n)}function T0(){}function Kw(e,t){var n=Nr();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&b0(t,o[1])?o[0]:(n.memoizedState=[e,t],e)}function Zw(e,t){var n=Nr();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&b0(t,o[1])?o[0]:(e=e(),n.memoizedState=[e,t],e)}function Qw(e,t,n){return _i&21?(Vr(n,t)||(n=rw(),et.lanes|=n,Oi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,or=!0),e.memoizedState=n)}function Y7(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var o=yf.transition;yf.transition={};try{e(!1),t()}finally{Pe=n,yf.transition=o}}function qw(){return Nr().memoizedState}function K7(e,t,n){var o=Qn(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},Jw(e))ev(t,n);else if(n=Dw(e,t,n,o),n!==null){var c=Xt();zr(n,e,o,c),tv(n,t,o)}}function Z7(e,t,n){var o=Qn(e),c={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jw(e))ev(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var g=t.lastRenderedState,x=u(g,n);if(c.hasEagerState=!0,c.eagerState=x,Vr(x,g)){var w=t.interleaved;w===null?(c.next=c,w0(t)):(c.next=w.next,w.next=c),t.interleaved=c;return}}catch{}finally{}n=Dw(e,t,c,o),n!==null&&(c=Xt(),zr(n,e,o,c),tv(n,t,o))}}function Jw(e){var t=e.alternate;return e===et||t!==null&&t===et}function ev(e,t){Io=nc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tv(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,i0(e,n)}}var ic={readContext:Or,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},Q7={readContext:Or,useCallback:function(e,t){return rn().memoizedState=[e,t===void 0?null:t],e},useContext:Or,useEffect:Rp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Sl(4194308,4,Xw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sl(4,2,e,t)},useMemo:function(e,t){var n=rn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=rn();return t=n!==void 0?n(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=K7.bind(null,et,e),[o.memoizedState,e]},useRef:function(e){var t=rn();return e={current:e},t.memoizedState=e},useState:Tp,useDebugValue:T0,useDeferredValue:function(e){return rn().memoizedState=e},useTransition:function(){var e=Tp(!1),t=e[0];return e=Y7.bind(null,e[1]),rn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=et,c=rn();if(Ke){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Tt===null)throw Error(Q(349));_i&30||Uw(o,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,Rp(Ww.bind(null,o,u,e),[e]),o.flags|=2048,qo(9,jw.bind(null,o,u,n,t),void 0,null),n},useId:function(){var e=rn(),t=Tt.identifierPrefix;if(Ke){var n=xn,o=mn;n=(o&~(1<<32-$r(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=X7++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},q7={readContext:Or,useCallback:Kw,useContext:Or,useEffect:I0,useImperativeHandle:Yw,useInsertionEffect:Hw,useLayoutEffect:Gw,useMemo:Zw,useReducer:Ef,useRef:Vw,useState:function(){return Ef(Qo)},useDebugValue:T0,useDeferredValue:function(e){var t=Nr();return Qw(t,yt.memoizedState,e)},useTransition:function(){var e=Ef(Qo)[0],t=Nr().memoizedState;return[e,t]},useMutableSource:Bw,useSyncExternalStore:Fw,useId:qw,unstable_isNewReconciler:!1},J7={readContext:Or,useCallback:Kw,useContext:Or,useEffect:I0,useImperativeHandle:Yw,useInsertionEffect:Hw,useLayoutEffect:Gw,useMemo:Zw,useReducer:Cf,useRef:Vw,useState:function(){return Cf(Qo)},useDebugValue:T0,useDeferredValue:function(e){var t=Nr();return yt===null?t.memoizedState=e:Qw(t,yt.memoizedState,e)},useTransition:function(){var e=Cf(Qo)[0],t=Nr().memoizedState;return[e,t]},useMutableSource:Bw,useSyncExternalStore:Fw,useId:qw,unstable_isNewReconciler:!1};function Fr(e,t){if(e&&e.defaultProps){t=tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function N1(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n==null?t:tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $c={isMounted:function(e){return(e=e._reactInternals)?Pi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Xt(),c=Qn(e),u=wn(o,c);u.payload=t,n!=null&&(u.callback=n),t=Kn(e,u,c),t!==null&&(zr(t,e,c,o),bl(t,e,c))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Xt(),c=Qn(e),u=wn(o,c);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=Kn(e,u,c),t!==null&&(zr(t,e,c,o),bl(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xt(),o=Qn(e),c=wn(n,o);c.tag=2,t!=null&&(c.callback=t),t=Kn(e,c,o),t!==null&&(zr(t,e,o,n),bl(t,e,o))}};function _p(e,t,n,o,c,u,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,u,g):t.prototype&&t.prototype.isPureReactComponent?!Vo(n,o)||!Vo(c,u):!0}function rv(e,t,n){var o=!1,c=ei,u=t.contextType;return typeof u=="object"&&u!==null?u=Or(u):(c=lr(t)?Ti:zt.current,o=t.contextTypes,u=(o=o!=null)?As(e,c):ei),t=new t(n,u),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=$c,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Op(e,t,n,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,o),t.state!==e&&$c.enqueueReplaceState(t,t.state,null)}function k1(e,t,n,o){var c=e.stateNode;c.props=n,c.state=e.memoizedState,c.refs={},v0(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Or(u):(u=lr(t)?Ti:zt.current,c.context=As(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(N1(e,t,u,n),c.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(t=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),t!==c.state&&$c.enqueueReplaceState(c,c.state,null),tc(e,n,c,o),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Rs(e,t){try{var n="",o=t;do n+=T5(o),o=o.return;while(o);var c=n}catch(u){c=`
53
+ `),h=c.length-1,x=u.length-1;1<=h&&0<=x&&c[h]!==u[x];)x--;for(;1<=h&&0<=x;h--,x--)if(c[h]!==u[x]){if(h!==1||x!==1)do if(h--,x--,0>x||c[h]!==u[x]){var w=`
54
+ `+c[h].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),w}while(1<=h&&0<=x);break}}}finally{rf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ho(e):""}function _5(e){switch(e.tag){case 5:return ho(e.type);case 16:return ho("Lazy");case 13:return ho("Suspense");case 19:return ho("SuspenseList");case 0:case 2:case 15:return e=nf(e.type,!1),e;case 11:return e=nf(e.type.render,!1),e;case 1:return e=nf(e.type,!0),e;default:return""}}function s1(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ji:return"Fragment";case qi:return"Portal";case r1:return"Profiler";case Jd:return"StrictMode";case n1:return"Suspense";case i1:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Lx:return(e.displayName||"Context")+".Consumer";case Px:return(e._context.displayName||"Context")+".Provider";case e0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case t0:return t=e.displayName||null,t!==null?t:s1(e.type)||"Memo";case Bn:t=e._payload,e=e._init;try{return s1(e(t))}catch{}}return null}function O5(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return s1(t);case 8:return t===Jd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Jn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function N5(e){var t=Fx(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var c=n.get,u=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(h){o=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return o},setValue:function(h){o=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ga(e){e._valueTracker||(e._valueTracker=N5(e))}function Ux(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=Fx(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}function Wl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function o1(e,t){var n=t.checked;return tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Xg(e,t){var n=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;n=Jn(t.value!=null?t.value:n),e._wrapperState={initialChecked:o,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function jx(e,t){t=t.checked,t!=null&&qd(e,"checked",t,!1)}function a1(e,t){jx(e,t);var n=Jn(t.value),o=t.type;if(n!=null)o==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?l1(e,t.type,n):t.hasOwnProperty("defaultValue")&&l1(e,t.type,Jn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yg(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function l1(e,t,n){(t!=="number"||Wl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var go=Array.isArray;function hs(e,t,n,o){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&o&&(e[n].defaultSelected=!0)}else{for(n=""+Jn(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,o&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function c1(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Kg(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(go(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Jn(n)}}function Wx(e,t){var n=Jn(t.value),o=Jn(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),o!=null&&(e.defaultValue=""+o)}function Zg(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function $x(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function u1(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?$x(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Xa,zx=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,o,c){MSApp.execUnsafeLocalFunction(function(){return e(t,n,o,c)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Xa=Xa||document.createElement("div"),Xa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Xa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Eo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},k5=["Webkit","ms","Moz","O"];Object.keys(Eo).forEach(function(e){k5.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Eo[t]=Eo[e]})});function Vx(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Eo.hasOwnProperty(e)&&Eo[e]?(""+t).trim():t+"px"}function Hx(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var o=n.indexOf("--")===0,c=Vx(n,t[n],o);n==="float"&&(n="cssFloat"),o?e.setProperty(n,c):e[n]=c}}var M5=tt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function f1(e,t){if(t){if(M5[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function d1(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var h1=null;function r0(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var g1=null,gs=null,ps=null;function Qg(e){if(e=ha(e)){if(typeof g1!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Uc(t),g1(e.stateNode,e.type,t))}}function Gx(e){gs?ps?ps.push(e):ps=[e]:gs=e}function Xx(){if(gs){var e=gs,t=ps;if(ps=gs=null,Qg(e),t)for(e=0;e<t.length;e++)Qg(t[e])}}function Yx(e,t){return e(t)}function Kx(){}var sf=!1;function Zx(e,t,n){if(sf)return e(t,n);sf=!0;try{return Yx(e,t,n)}finally{sf=!1,(gs!==null||ps!==null)&&(Kx(),Xx())}}function Uo(e,t){var n=e.stateNode;if(n===null)return null;var o=Uc(n);if(o===null)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var p1=!1;if(En)try{var ro={};Object.defineProperty(ro,"passive",{get:function(){p1=!0}}),window.addEventListener("test",ro,ro),window.removeEventListener("test",ro,ro)}catch{p1=!1}function D5(e,t,n,o,c,u,h,x,w){var m=Array.prototype.slice.call(arguments,3);try{t.apply(n,m)}catch(C){this.onError(C)}}var Co=!1,$l=null,zl=!1,m1=null,P5={onError:function(e){Co=!0,$l=e}};function L5(e,t,n,o,c,u,h,x,w){Co=!1,$l=null,D5.apply(P5,arguments)}function B5(e,t,n,o,c,u,h,x,w){if(L5.apply(this,arguments),Co){if(Co){var m=$l;Co=!1,$l=null}else throw Error(Q(198));zl||(zl=!0,m1=m)}}function Pi(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Qx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function qg(e){if(Pi(e)!==e)throw Error(Q(188))}function F5(e){var t=e.alternate;if(!t){if(t=Pi(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,o=t;;){var c=n.return;if(c===null)break;var u=c.alternate;if(u===null){if(o=c.return,o!==null){n=o;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===n)return qg(c),e;if(u===o)return qg(c),t;u=u.sibling}throw Error(Q(188))}if(n.return!==o.return)n=c,o=u;else{for(var h=!1,x=c.child;x;){if(x===n){h=!0,n=c,o=u;break}if(x===o){h=!0,o=c,n=u;break}x=x.sibling}if(!h){for(x=u.child;x;){if(x===n){h=!0,n=u,o=c;break}if(x===o){h=!0,o=u,n=c;break}x=x.sibling}if(!h)throw Error(Q(189))}}if(n.alternate!==o)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function qx(e){return e=F5(e),e!==null?Jx(e):null}function Jx(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Jx(e);if(t!==null)return t;e=e.sibling}return null}var ew=mr.unstable_scheduleCallback,Jg=mr.unstable_cancelCallback,U5=mr.unstable_shouldYield,j5=mr.unstable_requestPaint,ut=mr.unstable_now,W5=mr.unstable_getCurrentPriorityLevel,n0=mr.unstable_ImmediatePriority,tw=mr.unstable_UserBlockingPriority,Vl=mr.unstable_NormalPriority,$5=mr.unstable_LowPriority,rw=mr.unstable_IdlePriority,Pc=null,sn=null;function z5(e){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(Pc,e,void 0,(e.current.flags&128)===128)}catch{}}var $r=Math.clz32?Math.clz32:G5,V5=Math.log,H5=Math.LN2;function G5(e){return e>>>=0,e===0?32:31-(V5(e)/H5|0)|0}var Ya=64,Ka=4194304;function po(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Hl(e,t){var n=e.pendingLanes;if(n===0)return 0;var o=0,c=e.suspendedLanes,u=e.pingedLanes,h=n&268435455;if(h!==0){var x=h&~c;x!==0?o=po(x):(u&=h,u!==0&&(o=po(u)))}else h=n&~c,h!==0?o=po(h):u!==0&&(o=po(u));if(o===0)return 0;if(t!==0&&t!==o&&!(t&c)&&(c=o&-o,u=t&-t,c>=u||c===16&&(u&4194240)!==0))return t;if(o&4&&(o|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0<t;)n=31-$r(t),c=1<<n,o|=e[n],t&=~c;return o}function X5(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Y5(e,t){for(var n=e.suspendedLanes,o=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes;0<u;){var h=31-$r(u),x=1<<h,w=c[h];w===-1?(!(x&n)||x&o)&&(c[h]=X5(x,t)):w<=t&&(e.expiredLanes|=x),u&=~x}}function x1(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function nw(){var e=Ya;return Ya<<=1,!(Ya&4194240)&&(Ya=64),e}function of(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function fa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$r(t),e[t]=n}function K5(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0<n;){var c=31-$r(n),u=1<<c;t[c]=0,o[c]=-1,e[c]=-1,n&=~u}}function i0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var o=31-$r(n),c=1<<o;c&t|e[o]&t&&(e[o]|=t),n&=~c}}var Pe=0;function iw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var sw,s0,ow,aw,lw,w1=!1,Za=[],Hn=null,Gn=null,Xn=null,jo=new Map,Wo=new Map,Un=[],Z5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ep(e,t){switch(e){case"focusin":case"focusout":Hn=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":Xn=null;break;case"pointerover":case"pointerout":jo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wo.delete(t.pointerId)}}function no(e,t,n,o,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:o,nativeEvent:u,targetContainers:[c]},t!==null&&(t=ha(t),t!==null&&s0(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Q5(e,t,n,o,c){switch(t){case"focusin":return Hn=no(Hn,e,t,n,o,c),!0;case"dragenter":return Gn=no(Gn,e,t,n,o,c),!0;case"mouseover":return Xn=no(Xn,e,t,n,o,c),!0;case"pointerover":var u=c.pointerId;return jo.set(u,no(jo.get(u)||null,e,t,n,o,c)),!0;case"gotpointercapture":return u=c.pointerId,Wo.set(u,no(Wo.get(u)||null,e,t,n,o,c)),!0}return!1}function cw(e){var t=wi(e.target);if(t!==null){var n=Pi(t);if(n!==null){if(t=n.tag,t===13){if(t=Qx(n),t!==null){e.blockedOn=t,lw(e.priority,function(){ow(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function El(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=v1(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var o=new n.constructor(n.type,n);h1=o,n.target.dispatchEvent(o),h1=null}else return t=ha(n),t!==null&&s0(t),e.blockedOn=n,!1;t.shift()}return!0}function tp(e,t,n){El(e)&&n.delete(t)}function q5(){w1=!1,Hn!==null&&El(Hn)&&(Hn=null),Gn!==null&&El(Gn)&&(Gn=null),Xn!==null&&El(Xn)&&(Xn=null),jo.forEach(tp),Wo.forEach(tp)}function io(e,t){e.blockedOn===t&&(e.blockedOn=null,w1||(w1=!0,mr.unstable_scheduleCallback(mr.unstable_NormalPriority,q5)))}function $o(e){function t(c){return io(c,e)}if(0<Za.length){io(Za[0],e);for(var n=1;n<Za.length;n++){var o=Za[n];o.blockedOn===e&&(o.blockedOn=null)}}for(Hn!==null&&io(Hn,e),Gn!==null&&io(Gn,e),Xn!==null&&io(Xn,e),jo.forEach(t),Wo.forEach(t),n=0;n<Un.length;n++)o=Un[n],o.blockedOn===e&&(o.blockedOn=null);for(;0<Un.length&&(n=Un[0],n.blockedOn===null);)cw(n),n.blockedOn===null&&Un.shift()}var ms=Tn.ReactCurrentBatchConfig,Gl=!0;function J5(e,t,n,o){var c=Pe,u=ms.transition;ms.transition=null;try{Pe=1,o0(e,t,n,o)}finally{Pe=c,ms.transition=u}}function e7(e,t,n,o){var c=Pe,u=ms.transition;ms.transition=null;try{Pe=4,o0(e,t,n,o)}finally{Pe=c,ms.transition=u}}function o0(e,t,n,o){if(Gl){var c=v1(e,t,n,o);if(c===null)mf(e,t,o,Xl,n),ep(e,o);else if(Q5(c,e,t,n,o))o.stopPropagation();else if(ep(e,o),t&4&&-1<Z5.indexOf(e)){for(;c!==null;){var u=ha(c);if(u!==null&&sw(u),u=v1(e,t,n,o),u===null&&mf(e,t,o,Xl,n),u===c)break;c=u}c!==null&&o.stopPropagation()}else mf(e,t,o,null,n)}}var Xl=null;function v1(e,t,n,o){if(Xl=null,e=r0(o),e=wi(e),e!==null)if(t=Pi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Qx(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Xl=e,null}function uw(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(W5()){case n0:return 1;case tw:return 4;case Vl:case $5:return 16;case rw:return 536870912;default:return 16}default:return 16}}var zn=null,a0=null,Cl=null;function fw(){if(Cl)return Cl;var e,t=a0,n=t.length,o,c="value"in zn?zn.value:zn.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var h=n-e;for(o=1;o<=h&&t[n-o]===c[u-o];o++);return Cl=c.slice(e,1<o?1-o:void 0)}function bl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Qa(){return!0}function rp(){return!1}function yr(e){function t(n,o,c,u,h){this._reactName=n,this._targetInst=c,this.type=o,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(u):u[x]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Qa:rp,this.isPropagationStopped=rp,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Qa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Qa)},persist:function(){},isPersistent:Qa}),t}var Ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},l0=yr(Ps),da=tt({},Ps,{view:0,detail:0}),t7=yr(da),af,lf,so,Lc=tt({},da,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:c0,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==so&&(so&&e.type==="mousemove"?(af=e.screenX-so.screenX,lf=e.screenY-so.screenY):lf=af=0,so=e),af)},movementY:function(e){return"movementY"in e?e.movementY:lf}}),np=yr(Lc),r7=tt({},Lc,{dataTransfer:0}),n7=yr(r7),i7=tt({},da,{relatedTarget:0}),cf=yr(i7),s7=tt({},Ps,{animationName:0,elapsedTime:0,pseudoElement:0}),o7=yr(s7),a7=tt({},Ps,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l7=yr(a7),c7=tt({},Ps,{data:0}),ip=yr(c7),u7={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f7={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},d7={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function h7(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=d7[e])?!!t[e]:!1}function c0(){return h7}var g7=tt({},da,{key:function(e){if(e.key){var t=u7[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?f7[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:c0,charCode:function(e){return e.type==="keypress"?bl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),p7=yr(g7),m7=tt({},Lc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sp=yr(m7),x7=tt({},da,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:c0}),w7=yr(x7),v7=tt({},Ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),y7=yr(v7),E7=tt({},Lc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),C7=yr(E7),b7=[9,13,27,32],u0=En&&"CompositionEvent"in window,bo=null;En&&"documentMode"in document&&(bo=document.documentMode);var A7=En&&"TextEvent"in window&&!bo,dw=En&&(!u0||bo&&8<bo&&11>=bo),op=" ",ap=!1;function hw(e,t){switch(e){case"keyup":return b7.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var es=!1;function S7(e,t){switch(e){case"compositionend":return gw(t);case"keypress":return t.which!==32?null:(ap=!0,op);case"textInput":return e=t.data,e===op&&ap?null:e;default:return null}}function I7(e,t){if(es)return e==="compositionend"||!u0&&hw(e,t)?(e=fw(),Cl=a0=zn=null,es=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return dw&&t.locale!=="ko"?null:t.data;default:return null}}var T7={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T7[e.type]:t==="textarea"}function pw(e,t,n,o){Gx(o),t=Yl(t,"onChange"),0<t.length&&(n=new l0("onChange","change",null,n,o),e.push({event:n,listeners:t}))}var Ao=null,zo=null;function R7(e){Iw(e,0)}function Bc(e){var t=ns(e);if(Ux(t))return e}function _7(e,t){if(e==="change")return t}var mw=!1;if(En){var uf;if(En){var ff="oninput"in document;if(!ff){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),ff=typeof cp.oninput=="function"}uf=ff}else uf=!1;mw=uf&&(!document.documentMode||9<document.documentMode)}function up(){Ao&&(Ao.detachEvent("onpropertychange",xw),zo=Ao=null)}function xw(e){if(e.propertyName==="value"&&Bc(zo)){var t=[];pw(t,zo,e,r0(e)),Zx(R7,t)}}function O7(e,t,n){e==="focusin"?(up(),Ao=t,zo=n,Ao.attachEvent("onpropertychange",xw)):e==="focusout"&&up()}function N7(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Bc(zo)}function k7(e,t){if(e==="click")return Bc(t)}function M7(e,t){if(e==="input"||e==="change")return Bc(t)}function D7(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vr=typeof Object.is=="function"?Object.is:D7;function Vo(e,t){if(Vr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(o=0;o<n.length;o++){var c=n[o];if(!t1.call(t,c)||!Vr(e[c],t[c]))return!1}return!0}function fp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dp(e,t){var n=fp(e);e=0;for(var o;n;){if(n.nodeType===3){if(o=e+n.textContent.length,e<=t&&o>=t)return{node:n,offset:t-e};e=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=fp(n)}}function ww(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ww(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vw(){for(var e=window,t=Wl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wl(e.document)}return t}function f0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function P7(e){var t=vw(),n=e.focusedElem,o=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ww(n.ownerDocument.documentElement,n)){if(o!==null&&f0(n)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=n.textContent.length,u=Math.min(o.start,c);o=o.end===void 0?u:Math.min(o.end,c),!e.extend&&u>o&&(c=o,o=u,u=c),c=dp(n,u);var h=dp(n,o);c&&h&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),u>o?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var L7=En&&"documentMode"in document&&11>=document.documentMode,ts=null,y1=null,So=null,E1=!1;function hp(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;E1||ts==null||ts!==Wl(o)||(o=ts,"selectionStart"in o&&f0(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),So&&Vo(So,o)||(So=o,o=Yl(y1,"onSelect"),0<o.length&&(t=new l0("onSelect","select",null,t,n),e.push({event:t,listeners:o}),t.target=ts)))}function qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var rs={animationend:qa("Animation","AnimationEnd"),animationiteration:qa("Animation","AnimationIteration"),animationstart:qa("Animation","AnimationStart"),transitionend:qa("Transition","TransitionEnd")},df={},yw={};En&&(yw=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Fc(e){if(df[e])return df[e];if(!rs[e])return e;var t=rs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in yw)return df[e]=t[n];return e}var Ew=Fc("animationend"),Cw=Fc("animationiteration"),bw=Fc("animationstart"),Aw=Fc("transitionend"),Sw=new Map,gp="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ni(e,t){Sw.set(e,t),Di(t,[e])}for(var hf=0;hf<gp.length;hf++){var gf=gp[hf],B7=gf.toLowerCase(),F7=gf[0].toUpperCase()+gf.slice(1);ni(B7,"on"+F7)}ni(Ew,"onAnimationEnd");ni(Cw,"onAnimationIteration");ni(bw,"onAnimationStart");ni("dblclick","onDoubleClick");ni("focusin","onFocus");ni("focusout","onBlur");ni(Aw,"onTransitionEnd");bs("onMouseEnter",["mouseout","mouseover"]);bs("onMouseLeave",["mouseout","mouseover"]);bs("onPointerEnter",["pointerout","pointerover"]);bs("onPointerLeave",["pointerout","pointerover"]);Di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Di("onBeforeInput",["compositionend","keypress","textInput","paste"]);Di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),U7=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function pp(e,t,n){var o=e.type||"unknown-event";e.currentTarget=n,B5(o,t,void 0,e),e.currentTarget=null}function Iw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var o=e[n],c=o.event;o=o.listeners;e:{var u=void 0;if(t)for(var h=o.length-1;0<=h;h--){var x=o[h],w=x.instance,m=x.currentTarget;if(x=x.listener,w!==u&&c.isPropagationStopped())break e;pp(c,x,m),u=w}else for(h=0;h<o.length;h++){if(x=o[h],w=x.instance,m=x.currentTarget,x=x.listener,w!==u&&c.isPropagationStopped())break e;pp(c,x,m),u=w}}}if(zl)throw e=m1,zl=!1,m1=null,e}function Ve(e,t){var n=t[I1];n===void 0&&(n=t[I1]=new Set);var o=e+"__bubble";n.has(o)||(Tw(t,e,2,!1),n.add(o))}function pf(e,t,n){var o=0;t&&(o|=4),Tw(n,e,o,t)}var Ja="_reactListening"+Math.random().toString(36).slice(2);function Ho(e){if(!e[Ja]){e[Ja]=!0,Dx.forEach(function(n){n!=="selectionchange"&&(U7.has(n)||pf(n,!1,e),pf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ja]||(t[Ja]=!0,pf("selectionchange",!1,t))}}function Tw(e,t,n,o){switch(uw(t)){case 1:var c=J5;break;case 4:c=e7;break;default:c=o0}n=c.bind(null,t,n,e),c=void 0,!p1||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),o?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function mf(e,t,n,o,c){var u=o;if(!(t&1)&&!(t&2)&&o!==null)e:for(;;){if(o===null)return;var h=o.tag;if(h===3||h===4){var x=o.stateNode.containerInfo;if(x===c||x.nodeType===8&&x.parentNode===c)break;if(h===4)for(h=o.return;h!==null;){var w=h.tag;if((w===3||w===4)&&(w=h.stateNode.containerInfo,w===c||w.nodeType===8&&w.parentNode===c))return;h=h.return}for(;x!==null;){if(h=wi(x),h===null)return;if(w=h.tag,w===5||w===6){o=u=h;continue e}x=x.parentNode}}o=o.return}Zx(function(){var m=u,C=r0(n),b=[];e:{var A=Sw.get(e);if(A!==void 0){var T=l0,k=e;switch(e){case"keypress":if(bl(n)===0)break e;case"keydown":case"keyup":T=p7;break;case"focusin":k="focus",T=cf;break;case"focusout":k="blur",T=cf;break;case"beforeblur":case"afterblur":T=cf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":T=np;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":T=n7;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":T=w7;break;case Ew:case Cw:case bw:T=o7;break;case Aw:T=y7;break;case"scroll":T=t7;break;case"wheel":T=C7;break;case"copy":case"cut":case"paste":T=l7;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":T=sp}var M=(t&4)!==0,X=!M&&e==="scroll",N=M?A!==null?A+"Capture":null:A;M=[];for(var I=m,O;I!==null;){O=I;var B=O.stateNode;if(O.tag===5&&B!==null&&(O=B,N!==null&&(B=Uo(I,N),B!=null&&M.push(Go(I,B,O)))),X)break;I=I.return}0<M.length&&(A=new T(A,k,null,n,C),b.push({event:A,listeners:M}))}}if(!(t&7)){e:{if(A=e==="mouseover"||e==="pointerover",T=e==="mouseout"||e==="pointerout",A&&n!==h1&&(k=n.relatedTarget||n.fromElement)&&(wi(k)||k[Cn]))break e;if((T||A)&&(A=C.window===C?C:(A=C.ownerDocument)?A.defaultView||A.parentWindow:window,T?(k=n.relatedTarget||n.toElement,T=m,k=k?wi(k):null,k!==null&&(X=Pi(k),k!==X||k.tag!==5&&k.tag!==6)&&(k=null)):(T=null,k=m),T!==k)){if(M=np,B="onMouseLeave",N="onMouseEnter",I="mouse",(e==="pointerout"||e==="pointerover")&&(M=sp,B="onPointerLeave",N="onPointerEnter",I="pointer"),X=T==null?A:ns(T),O=k==null?A:ns(k),A=new M(B,I+"leave",T,n,C),A.target=X,A.relatedTarget=O,B=null,wi(C)===m&&(M=new M(N,I+"enter",k,n,C),M.target=O,M.relatedTarget=X,B=M),X=B,T&&k)t:{for(M=T,N=k,I=0,O=M;O;O=Xi(O))I++;for(O=0,B=N;B;B=Xi(B))O++;for(;0<I-O;)M=Xi(M),I--;for(;0<O-I;)N=Xi(N),O--;for(;I--;){if(M===N||N!==null&&M===N.alternate)break t;M=Xi(M),N=Xi(N)}M=null}else M=null;T!==null&&mp(b,A,T,M,!1),k!==null&&X!==null&&mp(b,X,k,M,!0)}}e:{if(A=m?ns(m):window,T=A.nodeName&&A.nodeName.toLowerCase(),T==="select"||T==="input"&&A.type==="file")var j=_7;else if(lp(A))if(mw)j=M7;else{j=N7;var U=O7}else(T=A.nodeName)&&T.toLowerCase()==="input"&&(A.type==="checkbox"||A.type==="radio")&&(j=k7);if(j&&(j=j(e,m))){pw(b,j,n,C);break e}U&&U(e,A,m),e==="focusout"&&(U=A._wrapperState)&&U.controlled&&A.type==="number"&&l1(A,"number",A.value)}switch(U=m?ns(m):window,e){case"focusin":(lp(U)||U.contentEditable==="true")&&(ts=U,y1=m,So=null);break;case"focusout":So=y1=ts=null;break;case"mousedown":E1=!0;break;case"contextmenu":case"mouseup":case"dragend":E1=!1,hp(b,n,C);break;case"selectionchange":if(L7)break;case"keydown":case"keyup":hp(b,n,C)}var F;if(u0)e:{switch(e){case"compositionstart":var Y="onCompositionStart";break e;case"compositionend":Y="onCompositionEnd";break e;case"compositionupdate":Y="onCompositionUpdate";break e}Y=void 0}else es?hw(e,n)&&(Y="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Y="onCompositionStart");Y&&(dw&&n.locale!=="ko"&&(es||Y!=="onCompositionStart"?Y==="onCompositionEnd"&&es&&(F=fw()):(zn=C,a0="value"in zn?zn.value:zn.textContent,es=!0)),U=Yl(m,Y),0<U.length&&(Y=new ip(Y,e,null,n,C),b.push({event:Y,listeners:U}),F?Y.data=F:(F=gw(n),F!==null&&(Y.data=F)))),(F=A7?S7(e,n):I7(e,n))&&(m=Yl(m,"onBeforeInput"),0<m.length&&(C=new ip("onBeforeInput","beforeinput",null,n,C),b.push({event:C,listeners:m}),C.data=F))}Iw(b,t)})}function Go(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Yl(e,t){for(var n=t+"Capture",o=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=Uo(e,n),u!=null&&o.unshift(Go(e,u,c)),u=Uo(e,t),u!=null&&o.push(Go(e,u,c))),e=e.return}return o}function Xi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function mp(e,t,n,o,c){for(var u=t._reactName,h=[];n!==null&&n!==o;){var x=n,w=x.alternate,m=x.stateNode;if(w!==null&&w===o)break;x.tag===5&&m!==null&&(x=m,c?(w=Uo(n,u),w!=null&&h.unshift(Go(n,w,x))):c||(w=Uo(n,u),w!=null&&h.push(Go(n,w,x)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var j7=/\r\n?/g,W7=/\u0000|\uFFFD/g;function xp(e){return(typeof e=="string"?e:""+e).replace(j7,`
55
+ `).replace(W7,"")}function el(e,t,n){if(t=xp(t),xp(e)!==t&&n)throw Error(Q(425))}function Kl(){}var C1=null,b1=null;function A1(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var S1=typeof setTimeout=="function"?setTimeout:void 0,$7=typeof clearTimeout=="function"?clearTimeout:void 0,wp=typeof Promise=="function"?Promise:void 0,z7=typeof queueMicrotask=="function"?queueMicrotask:typeof wp<"u"?function(e){return wp.resolve(null).then(e).catch(V7)}:S1;function V7(e){setTimeout(function(){throw e})}function xf(e,t){var n=t,o=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"){if(o===0){e.removeChild(c),$o(t);return}o--}else n!=="$"&&n!=="$?"&&n!=="$!"||o++;n=c}while(n);$o(t)}function Yn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function vp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ls=Math.random().toString(36).slice(2),nn="__reactFiber$"+Ls,Xo="__reactProps$"+Ls,Cn="__reactContainer$"+Ls,I1="__reactEvents$"+Ls,H7="__reactListeners$"+Ls,G7="__reactHandles$"+Ls;function wi(e){var t=e[nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cn]||n[nn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vp(e);e!==null;){if(n=e[nn])return n;e=vp(e)}return t}e=n,n=e.parentNode}return null}function ha(e){return e=e[nn]||e[Cn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ns(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function Uc(e){return e[Xo]||null}var T1=[],is=-1;function ii(e){return{current:e}}function He(e){0>is||(e.current=T1[is],T1[is]=null,is--)}function $e(e,t){is++,T1[is]=e.current,e.current=t}var ei={},zt=ii(ei),ar=ii(!1),Ti=ei;function As(e,t){var n=e.type.contextTypes;if(!n)return ei;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var c={},u;for(u in n)c[u]=t[u];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function lr(e){return e=e.childContextTypes,e!=null}function Zl(){He(ar),He(zt)}function yp(e,t,n){if(zt.current!==ei)throw Error(Q(168));$e(zt,t),$e(ar,n)}function Rw(e,t,n){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var c in o)if(!(c in t))throw Error(Q(108,O5(e)||"Unknown",c));return tt({},n,o)}function Ql(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ei,Ti=zt.current,$e(zt,e),$e(ar,ar.current),!0}function Ep(e,t,n){var o=e.stateNode;if(!o)throw Error(Q(169));n?(e=Rw(e,t,Ti),o.__reactInternalMemoizedMergedChildContext=e,He(ar),He(zt),$e(zt,e)):He(ar),$e(ar,n)}var gn=null,jc=!1,wf=!1;function _w(e){gn===null?gn=[e]:gn.push(e)}function X7(e){jc=!0,_w(e)}function si(){if(!wf&&gn!==null){wf=!0;var e=0,t=Pe;try{var n=gn;for(Pe=1;e<n.length;e++){var o=n[e];do o=o(!0);while(o!==null)}gn=null,jc=!1}catch(c){throw gn!==null&&(gn=gn.slice(e+1)),ew(n0,si),c}finally{Pe=t,wf=!1}}return null}var ss=[],os=0,ql=null,Jl=0,Ir=[],Tr=0,Ri=null,mn=1,xn="";function pi(e,t){ss[os++]=Jl,ss[os++]=ql,ql=e,Jl=t}function Ow(e,t,n){Ir[Tr++]=mn,Ir[Tr++]=xn,Ir[Tr++]=Ri,Ri=e;var o=mn;e=xn;var c=32-$r(o)-1;o&=~(1<<c),n+=1;var u=32-$r(t)+c;if(30<u){var h=c-c%5;u=(o&(1<<h)-1).toString(32),o>>=h,c-=h,mn=1<<32-$r(t)+c|n<<c|o,xn=u+e}else mn=1<<u|n<<c|o,xn=e}function d0(e){e.return!==null&&(pi(e,1),Ow(e,1,0))}function h0(e){for(;e===ql;)ql=ss[--os],ss[os]=null,Jl=ss[--os],ss[os]=null;for(;e===Ri;)Ri=Ir[--Tr],Ir[Tr]=null,xn=Ir[--Tr],Ir[Tr]=null,mn=Ir[--Tr],Ir[Tr]=null}var pr=null,gr=null,Ke=!1,Wr=null;function Nw(e,t){var n=Rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Cp(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,pr=e,gr=Yn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,pr=e,gr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ri!==null?{id:mn,overflow:xn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,pr=e,gr=null,!0):!1;default:return!1}}function R1(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _1(e){if(Ke){var t=gr;if(t){var n=t;if(!Cp(e,t)){if(R1(e))throw Error(Q(418));t=Yn(n.nextSibling);var o=pr;t&&Cp(e,t)?Nw(o,n):(e.flags=e.flags&-4097|2,Ke=!1,pr=e)}}else{if(R1(e))throw Error(Q(418));e.flags=e.flags&-4097|2,Ke=!1,pr=e}}}function bp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;pr=e}function tl(e){if(e!==pr)return!1;if(!Ke)return bp(e),Ke=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!A1(e.type,e.memoizedProps)),t&&(t=gr)){if(R1(e))throw kw(),Error(Q(418));for(;t;)Nw(e,t),t=Yn(t.nextSibling)}if(bp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){gr=Yn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}gr=null}}else gr=pr?Yn(e.stateNode.nextSibling):null;return!0}function kw(){for(var e=gr;e;)e=Yn(e.nextSibling)}function Ss(){gr=pr=null,Ke=!1}function g0(e){Wr===null?Wr=[e]:Wr.push(e)}var Y7=Tn.ReactCurrentBatchConfig;function oo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var o=n.stateNode}if(!o)throw Error(Q(147,e));var c=o,u=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===u?t.ref:(t=function(h){var x=c.refs;h===null?delete x[u]:x[u]=h},t._stringRef=u,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function rl(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ap(e){var t=e._init;return t(e._payload)}function Mw(e){function t(N,I){if(e){var O=N.deletions;O===null?(N.deletions=[I],N.flags|=16):O.push(I)}}function n(N,I){if(!e)return null;for(;I!==null;)t(N,I),I=I.sibling;return null}function o(N,I){for(N=new Map;I!==null;)I.key!==null?N.set(I.key,I):N.set(I.index,I),I=I.sibling;return N}function c(N,I){return N=qn(N,I),N.index=0,N.sibling=null,N}function u(N,I,O){return N.index=O,e?(O=N.alternate,O!==null?(O=O.index,O<I?(N.flags|=2,I):O):(N.flags|=2,I)):(N.flags|=1048576,I)}function h(N){return e&&N.alternate===null&&(N.flags|=2),N}function x(N,I,O,B){return I===null||I.tag!==6?(I=Sf(O,N.mode,B),I.return=N,I):(I=c(I,O),I.return=N,I)}function w(N,I,O,B){var j=O.type;return j===Ji?C(N,I,O.props.children,B,O.key):I!==null&&(I.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Bn&&Ap(j)===I.type)?(B=c(I,O.props),B.ref=oo(N,I,O),B.return=N,B):(B=Ol(O.type,O.key,O.props,null,N.mode,B),B.ref=oo(N,I,O),B.return=N,B)}function m(N,I,O,B){return I===null||I.tag!==4||I.stateNode.containerInfo!==O.containerInfo||I.stateNode.implementation!==O.implementation?(I=If(O,N.mode,B),I.return=N,I):(I=c(I,O.children||[]),I.return=N,I)}function C(N,I,O,B,j){return I===null||I.tag!==7?(I=Ai(O,N.mode,B,j),I.return=N,I):(I=c(I,O),I.return=N,I)}function b(N,I,O){if(typeof I=="string"&&I!==""||typeof I=="number")return I=Sf(""+I,N.mode,O),I.return=N,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case Ha:return O=Ol(I.type,I.key,I.props,null,N.mode,O),O.ref=oo(N,null,I),O.return=N,O;case qi:return I=If(I,N.mode,O),I.return=N,I;case Bn:var B=I._init;return b(N,B(I._payload),O)}if(go(I)||to(I))return I=Ai(I,N.mode,O,null),I.return=N,I;rl(N,I)}return null}function A(N,I,O,B){var j=I!==null?I.key:null;if(typeof O=="string"&&O!==""||typeof O=="number")return j!==null?null:x(N,I,""+O,B);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case Ha:return O.key===j?w(N,I,O,B):null;case qi:return O.key===j?m(N,I,O,B):null;case Bn:return j=O._init,A(N,I,j(O._payload),B)}if(go(O)||to(O))return j!==null?null:C(N,I,O,B,null);rl(N,O)}return null}function T(N,I,O,B,j){if(typeof B=="string"&&B!==""||typeof B=="number")return N=N.get(O)||null,x(I,N,""+B,j);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case Ha:return N=N.get(B.key===null?O:B.key)||null,w(I,N,B,j);case qi:return N=N.get(B.key===null?O:B.key)||null,m(I,N,B,j);case Bn:var U=B._init;return T(N,I,O,U(B._payload),j)}if(go(B)||to(B))return N=N.get(O)||null,C(I,N,B,j,null);rl(I,B)}return null}function k(N,I,O,B){for(var j=null,U=null,F=I,Y=I=0,z=null;F!==null&&Y<O.length;Y++){F.index>Y?(z=F,F=null):z=F.sibling;var oe=A(N,F,O[Y],B);if(oe===null){F===null&&(F=z);break}e&&F&&oe.alternate===null&&t(N,F),I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe,F=z}if(Y===O.length)return n(N,F),Ke&&pi(N,Y),j;if(F===null){for(;Y<O.length;Y++)F=b(N,O[Y],B),F!==null&&(I=u(F,I,Y),U===null?j=F:U.sibling=F,U=F);return Ke&&pi(N,Y),j}for(F=o(N,F);Y<O.length;Y++)z=T(F,N,Y,O[Y],B),z!==null&&(e&&z.alternate!==null&&F.delete(z.key===null?Y:z.key),I=u(z,I,Y),U===null?j=z:U.sibling=z,U=z);return e&&F.forEach(function(ve){return t(N,ve)}),Ke&&pi(N,Y),j}function M(N,I,O,B){var j=to(O);if(typeof j!="function")throw Error(Q(150));if(O=j.call(O),O==null)throw Error(Q(151));for(var U=j=null,F=I,Y=I=0,z=null,oe=O.next();F!==null&&!oe.done;Y++,oe=O.next()){F.index>Y?(z=F,F=null):z=F.sibling;var ve=A(N,F,oe.value,B);if(ve===null){F===null&&(F=z);break}e&&F&&ve.alternate===null&&t(N,F),I=u(ve,I,Y),U===null?j=ve:U.sibling=ve,U=ve,F=z}if(oe.done)return n(N,F),Ke&&pi(N,Y),j;if(F===null){for(;!oe.done;Y++,oe=O.next())oe=b(N,oe.value,B),oe!==null&&(I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe);return Ke&&pi(N,Y),j}for(F=o(N,F);!oe.done;Y++,oe=O.next())oe=T(F,N,Y,oe.value,B),oe!==null&&(e&&oe.alternate!==null&&F.delete(oe.key===null?Y:oe.key),I=u(oe,I,Y),U===null?j=oe:U.sibling=oe,U=oe);return e&&F.forEach(function(ie){return t(N,ie)}),Ke&&pi(N,Y),j}function X(N,I,O,B){if(typeof O=="object"&&O!==null&&O.type===Ji&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case Ha:e:{for(var j=O.key,U=I;U!==null;){if(U.key===j){if(j=O.type,j===Ji){if(U.tag===7){n(N,U.sibling),I=c(U,O.props.children),I.return=N,N=I;break e}}else if(U.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Bn&&Ap(j)===U.type){n(N,U.sibling),I=c(U,O.props),I.ref=oo(N,U,O),I.return=N,N=I;break e}n(N,U);break}else t(N,U);U=U.sibling}O.type===Ji?(I=Ai(O.props.children,N.mode,B,O.key),I.return=N,N=I):(B=Ol(O.type,O.key,O.props,null,N.mode,B),B.ref=oo(N,I,O),B.return=N,N=B)}return h(N);case qi:e:{for(U=O.key;I!==null;){if(I.key===U)if(I.tag===4&&I.stateNode.containerInfo===O.containerInfo&&I.stateNode.implementation===O.implementation){n(N,I.sibling),I=c(I,O.children||[]),I.return=N,N=I;break e}else{n(N,I);break}else t(N,I);I=I.sibling}I=If(O,N.mode,B),I.return=N,N=I}return h(N);case Bn:return U=O._init,X(N,I,U(O._payload),B)}if(go(O))return k(N,I,O,B);if(to(O))return M(N,I,O,B);rl(N,O)}return typeof O=="string"&&O!==""||typeof O=="number"?(O=""+O,I!==null&&I.tag===6?(n(N,I.sibling),I=c(I,O),I.return=N,N=I):(n(N,I),I=Sf(O,N.mode,B),I.return=N,N=I),h(N)):n(N,I)}return X}var Is=Mw(!0),Dw=Mw(!1),ec=ii(null),tc=null,as=null,p0=null;function m0(){p0=as=tc=null}function x0(e){var t=ec.current;He(ec),e._currentValue=t}function O1(e,t,n){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===n)break;e=e.return}}function xs(e,t){tc=e,p0=as=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(or=!0),e.firstContext=null)}function Or(e){var t=e._currentValue;if(p0!==e)if(e={context:e,memoizedValue:t,next:null},as===null){if(tc===null)throw Error(Q(308));as=e,tc.dependencies={lanes:0,firstContext:e}}else as=as.next=e;return t}var vi=null;function w0(e){vi===null?vi=[e]:vi.push(e)}function Pw(e,t,n,o){var c=t.interleaved;return c===null?(n.next=n,w0(t)):(n.next=c.next,c.next=n),t.interleaved=n,bn(e,o)}function bn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fn=!1;function v0(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Lw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Kn(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Oe&2){var c=o.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),o.pending=t,bn(e,n)}return c=o.interleaved,c===null?(t.next=t,w0(o)):(t.next=c.next,c.next=t),o.interleaved=t,bn(e,n)}function Al(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,i0(e,n)}}function Sp(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var c=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var h={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};u===null?c=u=h:u=u.next=h,n=n.next}while(n!==null);u===null?c=u=t:u=u.next=t}else c=u=t;n={baseState:o.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:o.shared,effects:o.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function rc(e,t,n,o){var c=e.updateQueue;Fn=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,x=c.shared.pending;if(x!==null){c.shared.pending=null;var w=x,m=w.next;w.next=null,h===null?u=m:h.next=m,h=w;var C=e.alternate;C!==null&&(C=C.updateQueue,x=C.lastBaseUpdate,x!==h&&(x===null?C.firstBaseUpdate=m:x.next=m,C.lastBaseUpdate=w))}if(u!==null){var b=c.baseState;h=0,C=m=w=null,x=u;do{var A=x.lane,T=x.eventTime;if((o&A)===A){C!==null&&(C=C.next={eventTime:T,lane:0,tag:x.tag,payload:x.payload,callback:x.callback,next:null});e:{var k=e,M=x;switch(A=t,T=n,M.tag){case 1:if(k=M.payload,typeof k=="function"){b=k.call(T,b,A);break e}b=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=M.payload,A=typeof k=="function"?k.call(T,b,A):k,A==null)break e;b=tt({},b,A);break e;case 2:Fn=!0}}x.callback!==null&&x.lane!==0&&(e.flags|=64,A=c.effects,A===null?c.effects=[x]:A.push(x))}else T={eventTime:T,lane:A,tag:x.tag,payload:x.payload,callback:x.callback,next:null},C===null?(m=C=T,w=b):C=C.next=T,h|=A;if(x=x.next,x===null){if(x=c.shared.pending,x===null)break;A=x,x=A.next,A.next=null,c.lastBaseUpdate=A,c.shared.pending=null}}while(!0);if(C===null&&(w=b),c.baseState=w,c.firstBaseUpdate=m,c.lastBaseUpdate=C,t=c.shared.interleaved,t!==null){c=t;do h|=c.lane,c=c.next;while(c!==t)}else u===null&&(c.shared.lanes=0);Oi|=h,e.lanes=h,e.memoizedState=b}}function Ip(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var o=e[t],c=o.callback;if(c!==null){if(o.callback=null,o=n,typeof c!="function")throw Error(Q(191,c));c.call(o)}}}var ga={},on=ii(ga),Yo=ii(ga),Ko=ii(ga);function yi(e){if(e===ga)throw Error(Q(174));return e}function y0(e,t){switch($e(Ko,t),$e(Yo,e),$e(on,ga),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:u1(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=u1(t,e)}He(on),$e(on,t)}function Ts(){He(on),He(Yo),He(Ko)}function Bw(e){yi(Ko.current);var t=yi(on.current),n=u1(t,e.type);t!==n&&($e(Yo,e),$e(on,n))}function E0(e){Yo.current===e&&(He(on),He(Yo))}var Je=ii(0);function nc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vf=[];function C0(){for(var e=0;e<vf.length;e++)vf[e]._workInProgressVersionPrimary=null;vf.length=0}var Sl=Tn.ReactCurrentDispatcher,yf=Tn.ReactCurrentBatchConfig,_i=0,et=null,yt=null,It=null,ic=!1,Io=!1,Zo=0,K7=0;function jt(){throw Error(Q(321))}function b0(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function A0(e,t,n,o,c,u){if(_i=u,et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Sl.current=e===null||e.memoizedState===null?J7:eT,e=n(o,c),Io){u=0;do{if(Io=!1,Zo=0,25<=u)throw Error(Q(301));u+=1,It=yt=null,t.updateQueue=null,Sl.current=tT,e=n(o,c)}while(Io)}if(Sl.current=sc,t=yt!==null&&yt.next!==null,_i=0,It=yt=et=null,ic=!1,t)throw Error(Q(300));return e}function S0(){var e=Zo!==0;return Zo=0,e}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?et.memoizedState=It=e:It=It.next=e,It}function Nr(){if(yt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=It===null?et.memoizedState:It.next;if(t!==null)It=t,yt=e;else{if(e===null)throw Error(Q(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},It===null?et.memoizedState=It=e:It=It.next=e}return It}function Qo(e,t){return typeof t=="function"?t(e):t}function Ef(e){var t=Nr(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var o=yt,c=o.baseQueue,u=n.pending;if(u!==null){if(c!==null){var h=c.next;c.next=u.next,u.next=h}o.baseQueue=c=u,n.pending=null}if(c!==null){u=c.next,o=o.baseState;var x=h=null,w=null,m=u;do{var C=m.lane;if((_i&C)===C)w!==null&&(w=w.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),o=m.hasEagerState?m.eagerState:e(o,m.action);else{var b={lane:C,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};w===null?(x=w=b,h=o):w=w.next=b,et.lanes|=C,Oi|=C}m=m.next}while(m!==null&&m!==u);w===null?h=o:w.next=x,Vr(o,t.memoizedState)||(or=!0),t.memoizedState=o,t.baseState=h,t.baseQueue=w,n.lastRenderedState=o}if(e=n.interleaved,e!==null){c=e;do u=c.lane,et.lanes|=u,Oi|=u,c=c.next;while(c!==e)}else c===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Cf(e){var t=Nr(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var o=n.dispatch,c=n.pending,u=t.memoizedState;if(c!==null){n.pending=null;var h=c=c.next;do u=e(u,h.action),h=h.next;while(h!==c);Vr(u,t.memoizedState)||(or=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,o]}function Fw(){}function Uw(e,t){var n=et,o=Nr(),c=t(),u=!Vr(o.memoizedState,c);if(u&&(o.memoizedState=c,or=!0),o=o.queue,I0($w.bind(null,n,o,e),[e]),o.getSnapshot!==t||u||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,qo(9,Ww.bind(null,n,o,c,t),void 0,null),Tt===null)throw Error(Q(349));_i&30||jw(n,t,c)}return c}function jw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ww(e,t,n,o){t.value=n,t.getSnapshot=o,zw(t)&&Vw(e)}function $w(e,t,n){return n(function(){zw(t)&&Vw(e)})}function zw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function Vw(e){var t=bn(e,1);t!==null&&zr(t,e,1,-1)}function Tp(e){var t=rn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:e},t.queue=e,e=e.dispatch=q7.bind(null,et,e),[t.memoizedState,e]}function qo(e,t,n,o){return e={tag:e,create:t,destroy:n,deps:o,next:null},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(o=n.next,n.next=e,e.next=o,t.lastEffect=e)),e}function Hw(){return Nr().memoizedState}function Il(e,t,n,o){var c=rn();et.flags|=e,c.memoizedState=qo(1|t,n,void 0,o===void 0?null:o)}function Wc(e,t,n,o){var c=Nr();o=o===void 0?null:o;var u=void 0;if(yt!==null){var h=yt.memoizedState;if(u=h.destroy,o!==null&&b0(o,h.deps)){c.memoizedState=qo(t,n,u,o);return}}et.flags|=e,c.memoizedState=qo(1|t,n,u,o)}function Rp(e,t){return Il(8390656,8,e,t)}function I0(e,t){return Wc(2048,8,e,t)}function Gw(e,t){return Wc(4,2,e,t)}function Xw(e,t){return Wc(4,4,e,t)}function Yw(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Kw(e,t,n){return n=n!=null?n.concat([e]):null,Wc(4,4,Yw.bind(null,t,e),n)}function T0(){}function Zw(e,t){var n=Nr();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&b0(t,o[1])?o[0]:(n.memoizedState=[e,t],e)}function Qw(e,t){var n=Nr();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&b0(t,o[1])?o[0]:(e=e(),n.memoizedState=[e,t],e)}function qw(e,t,n){return _i&21?(Vr(n,t)||(n=nw(),et.lanes|=n,Oi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,or=!0),e.memoizedState=n)}function Z7(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var o=yf.transition;yf.transition={};try{e(!1),t()}finally{Pe=n,yf.transition=o}}function Jw(){return Nr().memoizedState}function Q7(e,t,n){var o=Qn(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},ev(e))tv(t,n);else if(n=Pw(e,t,n,o),n!==null){var c=Xt();zr(n,e,o,c),rv(n,t,o)}}function q7(e,t,n){var o=Qn(e),c={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(ev(e))tv(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,x=u(h,n);if(c.hasEagerState=!0,c.eagerState=x,Vr(x,h)){var w=t.interleaved;w===null?(c.next=c,w0(t)):(c.next=w.next,w.next=c),t.interleaved=c;return}}catch{}finally{}n=Pw(e,t,c,o),n!==null&&(c=Xt(),zr(n,e,o,c),rv(n,t,o))}}function ev(e){var t=e.alternate;return e===et||t!==null&&t===et}function tv(e,t){Io=ic=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rv(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,i0(e,n)}}var sc={readContext:Or,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},J7={readContext:Or,useCallback:function(e,t){return rn().memoizedState=[e,t===void 0?null:t],e},useContext:Or,useEffect:Rp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Il(4194308,4,Yw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Il(4194308,4,e,t)},useInsertionEffect:function(e,t){return Il(4,2,e,t)},useMemo:function(e,t){var n=rn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=rn();return t=n!==void 0?n(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=Q7.bind(null,et,e),[o.memoizedState,e]},useRef:function(e){var t=rn();return e={current:e},t.memoizedState=e},useState:Tp,useDebugValue:T0,useDeferredValue:function(e){return rn().memoizedState=e},useTransition:function(){var e=Tp(!1),t=e[0];return e=Z7.bind(null,e[1]),rn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=et,c=rn();if(Ke){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Tt===null)throw Error(Q(349));_i&30||jw(o,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,Rp($w.bind(null,o,u,e),[e]),o.flags|=2048,qo(9,Ww.bind(null,o,u,n,t),void 0,null),n},useId:function(){var e=rn(),t=Tt.identifierPrefix;if(Ke){var n=xn,o=mn;n=(o&~(1<<32-$r(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=K7++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},eT={readContext:Or,useCallback:Zw,useContext:Or,useEffect:I0,useImperativeHandle:Kw,useInsertionEffect:Gw,useLayoutEffect:Xw,useMemo:Qw,useReducer:Ef,useRef:Hw,useState:function(){return Ef(Qo)},useDebugValue:T0,useDeferredValue:function(e){var t=Nr();return qw(t,yt.memoizedState,e)},useTransition:function(){var e=Ef(Qo)[0],t=Nr().memoizedState;return[e,t]},useMutableSource:Fw,useSyncExternalStore:Uw,useId:Jw,unstable_isNewReconciler:!1},tT={readContext:Or,useCallback:Zw,useContext:Or,useEffect:I0,useImperativeHandle:Kw,useInsertionEffect:Gw,useLayoutEffect:Xw,useMemo:Qw,useReducer:Cf,useRef:Hw,useState:function(){return Cf(Qo)},useDebugValue:T0,useDeferredValue:function(e){var t=Nr();return yt===null?t.memoizedState=e:qw(t,yt.memoizedState,e)},useTransition:function(){var e=Cf(Qo)[0],t=Nr().memoizedState;return[e,t]},useMutableSource:Fw,useSyncExternalStore:Uw,useId:Jw,unstable_isNewReconciler:!1};function Fr(e,t){if(e&&e.defaultProps){t=tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function N1(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n==null?t:tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $c={isMounted:function(e){return(e=e._reactInternals)?Pi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Xt(),c=Qn(e),u=wn(o,c);u.payload=t,n!=null&&(u.callback=n),t=Kn(e,u,c),t!==null&&(zr(t,e,c,o),Al(t,e,c))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Xt(),c=Qn(e),u=wn(o,c);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=Kn(e,u,c),t!==null&&(zr(t,e,c,o),Al(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xt(),o=Qn(e),c=wn(n,o);c.tag=2,t!=null&&(c.callback=t),t=Kn(e,c,o),t!==null&&(zr(t,e,o,n),Al(t,e,o))}};function _p(e,t,n,o,c,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,u,h):t.prototype&&t.prototype.isPureReactComponent?!Vo(n,o)||!Vo(c,u):!0}function nv(e,t,n){var o=!1,c=ei,u=t.contextType;return typeof u=="object"&&u!==null?u=Or(u):(c=lr(t)?Ti:zt.current,o=t.contextTypes,u=(o=o!=null)?As(e,c):ei),t=new t(n,u),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=$c,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Op(e,t,n,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,o),t.state!==e&&$c.enqueueReplaceState(t,t.state,null)}function k1(e,t,n,o){var c=e.stateNode;c.props=n,c.state=e.memoizedState,c.refs={},v0(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Or(u):(u=lr(t)?Ti:zt.current,c.context=As(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(N1(e,t,u,n),c.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(t=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),t!==c.state&&$c.enqueueReplaceState(c,c.state,null),rc(e,n,c,o),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Rs(e,t){try{var n="",o=t;do n+=_5(o),o=o.return;while(o);var c=n}catch(u){c=`
56
56
  Error generating stack: `+u.message+`
57
- `+u.stack}return{value:e,source:t,stack:c,digest:null}}function bf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function M1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var e9=typeof WeakMap=="function"?WeakMap:Map;function nv(e,t,n){n=wn(-1,n),n.tag=3,n.payload={element:null};var o=t.value;return n.callback=function(){oc||(oc=!0,z1=o),M1(e,t)},n}function iv(e,t,n){n=wn(-1,n),n.tag=3;var o=e.type.getDerivedStateFromError;if(typeof o=="function"){var c=t.value;n.payload=function(){return o(c)},n.callback=function(){M1(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(n.callback=function(){M1(e,t),typeof o!="function"&&(Zn===null?Zn=new Set([this]):Zn.add(this));var g=t.stack;this.componentDidCatch(t.value,{componentStack:g!==null?g:""})}),n}function Np(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new e9;var c=new Set;o.set(t,c)}else c=o.get(t),c===void 0&&(c=new Set,o.set(t,c));c.has(n)||(c.add(n),e=g9.bind(null,e,t,n),t.then(e,e))}function kp(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Mp(e,t,n,o,c){return e.mode&1?(e.flags|=65536,e.lanes=c,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wn(-1,1),t.tag=2,Kn(n,t,1))),n.lanes|=1),e)}var t9=Tn.ReactCurrentOwner,or=!1;function Gt(e,t,n,o){t.child=e===null?Mw(t,null,n,o):Is(t,e.child,n,o)}function Dp(e,t,n,o,c){n=n.render;var u=t.ref;return xs(t,c),o=A0(e,t,n,o,u,c),n=S0(),e!==null&&!or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,An(e,t,c)):(Ke&&n&&d0(t),t.flags|=1,Gt(e,t,o,c),t.child)}function Pp(e,t,n,o,c){if(e===null){var u=n.type;return typeof u=="function"&&!P0(u)&&u.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=u,sv(e,t,u,o,c)):(e=_l(n.type,null,o,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!(e.lanes&c)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:Vo,n(g,o)&&e.ref===t.ref)return An(e,t,c)}return t.flags|=1,e=qn(u,o),e.ref=t.ref,e.return=t,t.child=e}function sv(e,t,n,o,c){if(e!==null){var u=e.memoizedProps;if(Vo(u,o)&&e.ref===t.ref)if(or=!1,t.pendingProps=o=u,(e.lanes&c)!==0)e.flags&131072&&(or=!0);else return t.lanes=e.lanes,An(e,t,c)}return D1(e,t,n,o,c)}function ov(e,t,n){var o=t.pendingProps,c=o.children,u=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(cs,hr),hr|=n;else{if(!(n&1073741824))return e=u!==null?u.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$e(cs,hr),hr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=u!==null?u.baseLanes:n,$e(cs,hr),hr|=o}else u!==null?(o=u.baseLanes|n,t.memoizedState=null):o=n,$e(cs,hr),hr|=o;return Gt(e,t,c,n),t.child}function av(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function D1(e,t,n,o,c){var u=lr(n)?Ti:zt.current;return u=As(t,u),xs(t,c),n=A0(e,t,n,o,u,c),o=S0(),e!==null&&!or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,An(e,t,c)):(Ke&&o&&d0(t),t.flags|=1,Gt(e,t,n,c),t.child)}function Lp(e,t,n,o,c){if(lr(n)){var u=!0;Zl(t)}else u=!1;if(xs(t,c),t.stateNode===null)Il(e,t),rv(t,n,o),k1(t,n,o,c),o=!0;else if(e===null){var g=t.stateNode,x=t.memoizedProps;g.props=x;var w=g.context,m=n.contextType;typeof m=="object"&&m!==null?m=Or(m):(m=lr(n)?Ti:zt.current,m=As(t,m));var C=n.getDerivedStateFromProps,b=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function";b||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(x!==o||w!==m)&&Op(t,g,o,m),Fn=!1;var A=t.memoizedState;g.state=A,tc(t,o,g,c),w=t.memoizedState,x!==o||A!==w||ar.current||Fn?(typeof C=="function"&&(N1(t,n,C,o),w=t.memoizedState),(x=Fn||_p(t,n,x,o,A,w,m))?(b||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(t.flags|=4194308)):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=w),g.props=o,g.state=w,g.context=m,o=x):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{g=t.stateNode,Pw(e,t),x=t.memoizedProps,m=t.type===t.elementType?x:Fr(t.type,x),g.props=m,b=t.pendingProps,A=g.context,w=n.contextType,typeof w=="object"&&w!==null?w=Or(w):(w=lr(n)?Ti:zt.current,w=As(t,w));var T=n.getDerivedStateFromProps;(C=typeof T=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(x!==b||A!==w)&&Op(t,g,o,w),Fn=!1,A=t.memoizedState,g.state=A,tc(t,o,g,c);var k=t.memoizedState;x!==b||A!==k||ar.current||Fn?(typeof T=="function"&&(N1(t,n,T,o),k=t.memoizedState),(m=Fn||_p(t,n,m,o,A,k,w)||!1)?(C||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,k,w),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,k,w)),typeof g.componentDidUpdate=="function"&&(t.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof g.componentDidUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=k),g.props=o,g.state=k,g.context=w,o=m):(typeof g.componentDidUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),o=!1)}return P1(e,t,n,o,u,c)}function P1(e,t,n,o,c,u){av(e,t);var g=(t.flags&128)!==0;if(!o&&!g)return c&&Ep(t,n,!1),An(e,t,u);o=t.stateNode,t9.current=t;var x=g&&typeof n.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&g?(t.child=Is(t,e.child,null,u),t.child=Is(t,null,x,u)):Gt(e,t,x,u),t.memoizedState=o.state,c&&Ep(t,n,!0),t.child}function lv(e){var t=e.stateNode;t.pendingContext?yp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&yp(e,t.context,!1),y0(e,t.containerInfo)}function Bp(e,t,n,o,c){return Ss(),g0(c),t.flags|=256,Gt(e,t,n,o),t.child}var L1={dehydrated:null,treeContext:null,retryLane:0};function B1(e){return{baseLanes:e,cachePool:null,transitions:null}}function cv(e,t,n){var o=t.pendingProps,c=Je.current,u=!1,g=(t.flags&128)!==0,x;if((x=g)||(x=e!==null&&e.memoizedState===null?!1:(c&2)!==0),x?(u=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),$e(Je,c&1),e===null)return _1(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(g=o.children,e=o.fallback,u?(o=t.mode,u=t.child,g={mode:"hidden",children:g},!(o&1)&&u!==null?(u.childLanes=0,u.pendingProps=g):u=Hc(g,o,0,null),e=Ai(e,o,n,null),u.return=t,e.return=t,u.sibling=e,t.child=u,t.child.memoizedState=B1(n),t.memoizedState=L1,e):R0(t,g));if(c=e.memoizedState,c!==null&&(x=c.dehydrated,x!==null))return r9(e,t,g,o,x,c,n);if(u){u=o.fallback,g=t.mode,c=e.child,x=c.sibling;var w={mode:"hidden",children:o.children};return!(g&1)&&t.child!==c?(o=t.child,o.childLanes=0,o.pendingProps=w,t.deletions=null):(o=qn(c,w),o.subtreeFlags=c.subtreeFlags&14680064),x!==null?u=qn(x,u):(u=Ai(u,g,n,null),u.flags|=2),u.return=t,o.return=t,o.sibling=u,t.child=o,o=u,u=t.child,g=e.child.memoizedState,g=g===null?B1(n):{baseLanes:g.baseLanes|n,cachePool:null,transitions:g.transitions},u.memoizedState=g,u.childLanes=e.childLanes&~n,t.memoizedState=L1,o}return u=e.child,e=u.sibling,o=qn(u,{mode:"visible",children:o.children}),!(t.mode&1)&&(o.lanes=n),o.return=t,o.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function R0(e,t){return t=Hc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rl(e,t,n,o){return o!==null&&g0(o),Is(t,e.child,null,n),e=R0(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function r9(e,t,n,o,c,u,g){if(n)return t.flags&256?(t.flags&=-257,o=bf(Error(Q(422))),rl(e,t,g,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=o.fallback,c=t.mode,o=Hc({mode:"visible",children:o.children},c,0,null),u=Ai(u,c,g,null),u.flags|=2,o.return=t,u.return=t,o.sibling=u,t.child=o,t.mode&1&&Is(t,e.child,null,g),t.child.memoizedState=B1(g),t.memoizedState=L1,u);if(!(t.mode&1))return rl(e,t,g,null);if(c.data==="$!"){if(o=c.nextSibling&&c.nextSibling.dataset,o)var x=o.dgst;return o=x,u=Error(Q(419)),o=bf(u,o,void 0),rl(e,t,g,o)}if(x=(g&e.childLanes)!==0,or||x){if(o=Tt,o!==null){switch(g&-g){case 4:c=2;break;case 16:c=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:c=32;break;case 536870912:c=268435456;break;default:c=0}c=c&(o.suspendedLanes|g)?0:c,c!==0&&c!==u.retryLane&&(u.retryLane=c,bn(e,c),zr(o,e,c,-1))}return D0(),o=bf(Error(Q(421))),rl(e,t,g,o)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=p9.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,gr=Yn(c.nextSibling),pr=t,Ke=!0,Wr=null,e!==null&&(Ir[Tr++]=mn,Ir[Tr++]=xn,Ir[Tr++]=Ri,mn=e.id,xn=e.overflow,Ri=t),t=R0(t,o.children),t.flags|=4096,t)}function Fp(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),O1(e.return,t,n)}function Af(e,t,n,o,c){var u=e.memoizedState;u===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:c}:(u.isBackwards=t,u.rendering=null,u.renderingStartTime=0,u.last=o,u.tail=n,u.tailMode=c)}function uv(e,t,n){var o=t.pendingProps,c=o.revealOrder,u=o.tail;if(Gt(e,t,o.children,n),o=Je.current,o&2)o=o&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fp(e,n,t);else if(e.tag===19)Fp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}o&=1}if($e(Je,o),!(t.mode&1))t.memoizedState=null;else switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&rc(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Af(t,!1,c,n,u);break;case"backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&rc(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Af(t,!0,n,null,u);break;case"together":Af(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Il(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function An(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Oi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=qn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function n9(e,t,n){switch(t.tag){case 3:lv(t),Ss();break;case 5:Lw(t);break;case 1:lr(t.type)&&Zl(t);break;case 4:y0(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,c=t.memoizedProps.value;$e(Jl,o._currentValue),o._currentValue=c;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?($e(Je,Je.current&1),t.flags|=128,null):n&t.child.childLanes?cv(e,t,n):($e(Je,Je.current&1),e=An(e,t,n),e!==null?e.sibling:null);$e(Je,Je.current&1);break;case 19:if(o=(n&t.childLanes)!==0,e.flags&128){if(o)return uv(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),$e(Je,Je.current),o)break;return null;case 22:case 23:return t.lanes=0,ov(e,t,n)}return An(e,t,n)}var fv,F1,dv,hv;fv=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};F1=function(){};dv=function(e,t,n,o){var c=e.memoizedProps;if(c!==o){e=t.stateNode,yi(on.current);var u=null;switch(n){case"input":c=o1(e,c),o=o1(e,o),u=[];break;case"select":c=tt({},c,{value:void 0}),o=tt({},o,{value:void 0}),u=[];break;case"textarea":c=c1(e,c),o=c1(e,o),u=[];break;default:typeof c.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=Yl)}f1(n,o);var g;n=null;for(m in c)if(!o.hasOwnProperty(m)&&c.hasOwnProperty(m)&&c[m]!=null)if(m==="style"){var x=c[m];for(g in x)x.hasOwnProperty(g)&&(n||(n={}),n[g]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(Bo.hasOwnProperty(m)?u||(u=[]):(u=u||[]).push(m,null));for(m in o){var w=o[m];if(x=c!=null?c[m]:void 0,o.hasOwnProperty(m)&&w!==x&&(w!=null||x!=null))if(m==="style")if(x){for(g in x)!x.hasOwnProperty(g)||w&&w.hasOwnProperty(g)||(n||(n={}),n[g]="");for(g in w)w.hasOwnProperty(g)&&x[g]!==w[g]&&(n||(n={}),n[g]=w[g])}else n||(u||(u=[]),u.push(m,n)),n=w;else m==="dangerouslySetInnerHTML"?(w=w?w.__html:void 0,x=x?x.__html:void 0,w!=null&&x!==w&&(u=u||[]).push(m,w)):m==="children"?typeof w!="string"&&typeof w!="number"||(u=u||[]).push(m,""+w):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(Bo.hasOwnProperty(m)?(w!=null&&m==="onScroll"&&Ve("scroll",e),u||x===w||(u=[])):(u=u||[]).push(m,w))}n&&(u=u||[]).push("style",n);var m=u;(t.updateQueue=m)&&(t.flags|=4)}};hv=function(e,t,n,o){n!==o&&(t.flags|=4)};function ao(e,t){if(!Ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,o=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags&14680064,o|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags,o|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=o,e.childLanes=n,t}function i9(e,t,n){var o=t.pendingProps;switch(h0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(t),null;case 1:return lr(t.type)&&Kl(),Wt(t),null;case 3:return o=t.stateNode,Ts(),He(ar),He(zt),C0(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(el(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wr!==null&&(G1(Wr),Wr=null))),F1(e,t),Wt(t),null;case 5:E0(t);var c=yi(Ko.current);if(n=t.type,e!==null&&t.stateNode!=null)dv(e,t,n,o,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(Q(166));return Wt(t),null}if(e=yi(on.current),el(t)){o=t.stateNode,n=t.type;var u=t.memoizedProps;switch(o[nn]=t,o[Xo]=u,e=(t.mode&1)!==0,n){case"dialog":Ve("cancel",o),Ve("close",o);break;case"iframe":case"object":case"embed":Ve("load",o);break;case"video":case"audio":for(c=0;c<mo.length;c++)Ve(mo[c],o);break;case"source":Ve("error",o);break;case"img":case"image":case"link":Ve("error",o),Ve("load",o);break;case"details":Ve("toggle",o);break;case"input":Xg(o,u),Ve("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!u.multiple},Ve("invalid",o);break;case"textarea":Kg(o,u),Ve("invalid",o)}f1(n,u),c=null;for(var g in u)if(u.hasOwnProperty(g)){var x=u[g];g==="children"?typeof x=="string"?o.textContent!==x&&(u.suppressHydrationWarning!==!0&&Ja(o.textContent,x,e),c=["children",x]):typeof x=="number"&&o.textContent!==""+x&&(u.suppressHydrationWarning!==!0&&Ja(o.textContent,x,e),c=["children",""+x]):Bo.hasOwnProperty(g)&&x!=null&&g==="onScroll"&&Ve("scroll",o)}switch(n){case"input":Ha(o),Yg(o,u,!0);break;case"textarea":Ha(o),Zg(o);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(o.onclick=Yl)}o=c,t.updateQueue=o,o!==null&&(t.flags|=4)}else{g=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Wx(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=g.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(n,{is:o.is}):(e=g.createElement(n),n==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,n),e[nn]=t,e[Xo]=o,fv(e,t,!1,!1),t.stateNode=e;e:{switch(g=d1(n,o),n){case"dialog":Ve("cancel",e),Ve("close",e),c=o;break;case"iframe":case"object":case"embed":Ve("load",e),c=o;break;case"video":case"audio":for(c=0;c<mo.length;c++)Ve(mo[c],e);c=o;break;case"source":Ve("error",e),c=o;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),c=o;break;case"details":Ve("toggle",e),c=o;break;case"input":Xg(e,o),c=o1(e,o),Ve("invalid",e);break;case"option":c=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},c=tt({},o,{value:void 0}),Ve("invalid",e);break;case"textarea":Kg(e,o),c=c1(e,o),Ve("invalid",e);break;default:c=o}f1(n,c),x=c;for(u in x)if(x.hasOwnProperty(u)){var w=x[u];u==="style"?Vx(e,w):u==="dangerouslySetInnerHTML"?(w=w?w.__html:void 0,w!=null&&$x(e,w)):u==="children"?typeof w=="string"?(n!=="textarea"||w!=="")&&Fo(e,w):typeof w=="number"&&Fo(e,""+w):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Bo.hasOwnProperty(u)?w!=null&&u==="onScroll"&&Ve("scroll",e):w!=null&&qd(e,u,w,g))}switch(n){case"input":Ha(e),Yg(e,o,!1);break;case"textarea":Ha(e),Zg(e);break;case"option":o.value!=null&&e.setAttribute("value",""+Jn(o.value));break;case"select":e.multiple=!!o.multiple,u=o.value,u!=null?hs(e,!!o.multiple,u,!1):o.defaultValue!=null&&hs(e,!!o.multiple,o.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Yl)}switch(n){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Wt(t),null;case 6:if(e&&t.stateNode!=null)hv(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(Q(166));if(n=yi(Ko.current),yi(on.current),el(t)){if(o=t.stateNode,n=t.memoizedProps,o[nn]=t,(u=o.nodeValue!==n)&&(e=pr,e!==null))switch(e.tag){case 3:Ja(o.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ja(o.nodeValue,n,(e.mode&1)!==0)}u&&(t.flags|=4)}else o=(n.nodeType===9?n:n.ownerDocument).createTextNode(o),o[nn]=t,t.stateNode=o}return Wt(t),null;case 13:if(He(Je),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ke&&gr!==null&&t.mode&1&&!(t.flags&128))Nw(),Ss(),t.flags|=98560,u=!1;else if(u=el(t),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(Q(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(Q(317));u[nn]=t}else Ss(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wt(t),u=!1}else Wr!==null&&(G1(Wr),Wr=null),u=!0;if(!u)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(o=o!==null,o!==(e!==null&&e.memoizedState!==null)&&o&&(t.child.flags|=8192,t.mode&1&&(e===null||Je.current&1?Et===0&&(Et=3):D0())),t.updateQueue!==null&&(t.flags|=4),Wt(t),null);case 4:return Ts(),F1(e,t),e===null&&Ho(t.stateNode.containerInfo),Wt(t),null;case 10:return x0(t.type._context),Wt(t),null;case 17:return lr(t.type)&&Kl(),Wt(t),null;case 19:if(He(Je),u=t.memoizedState,u===null)return Wt(t),null;if(o=(t.flags&128)!==0,g=u.rendering,g===null)if(o)ao(u,!1);else{if(Et!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(g=rc(e),g!==null){for(t.flags|=128,ao(u,!1),o=g.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=n,n=t.child;n!==null;)u=n,e=o,u.flags&=14680066,g=u.alternate,g===null?(u.childLanes=0,u.lanes=e,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=g.childLanes,u.lanes=g.lanes,u.child=g.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=g.memoizedProps,u.memoizedState=g.memoizedState,u.updateQueue=g.updateQueue,u.type=g.type,e=g.dependencies,u.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return $e(Je,Je.current&1|2),t.child}e=e.sibling}u.tail!==null&&ut()>_s&&(t.flags|=128,o=!0,ao(u,!1),t.lanes=4194304)}else{if(!o)if(e=rc(g),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ao(u,!0),u.tail===null&&u.tailMode==="hidden"&&!g.alternate&&!Ke)return Wt(t),null}else 2*ut()-u.renderingStartTime>_s&&n!==1073741824&&(t.flags|=128,o=!0,ao(u,!1),t.lanes=4194304);u.isBackwards?(g.sibling=t.child,t.child=g):(n=u.last,n!==null?n.sibling=g:t.child=g,u.last=g)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ut(),t.sibling=null,n=Je.current,$e(Je,o?n&1|2:n&1),t):(Wt(t),null);case 22:case 23:return M0(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?hr&1073741824&&(Wt(t),t.subtreeFlags&6&&(t.flags|=8192)):Wt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function s9(e,t){switch(h0(t),t.tag){case 1:return lr(t.type)&&Kl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ts(),He(ar),He(zt),C0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return E0(t),null;case 13:if(He(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He(Je),null;case 4:return Ts(),null;case 10:return x0(t.type._context),null;case 22:case 23:return M0(),null;case 24:return null;default:return null}}var nl=!1,$t=!1,o9=typeof WeakSet=="function"?WeakSet:Set,se=null;function ls(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){at(e,t,o)}else n.current=null}function U1(e,t,n){try{n()}catch(o){at(e,t,o)}}var Up=!1;function a9(e,t){if(C1=Hl,e=ww(),f0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var c=o.anchorOffset,u=o.focusNode;o=o.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var g=0,x=-1,w=-1,m=0,C=0,b=e,A=null;t:for(;;){for(var T;b!==n||c!==0&&b.nodeType!==3||(x=g+c),b!==u||o!==0&&b.nodeType!==3||(w=g+o),b.nodeType===3&&(g+=b.nodeValue.length),(T=b.firstChild)!==null;)A=b,b=T;for(;;){if(b===e)break t;if(A===n&&++m===c&&(x=g),A===u&&++C===o&&(w=g),(T=b.nextSibling)!==null)break;b=A,A=b.parentNode}b=T}n=x===-1||w===-1?null:{start:x,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(b1={focusedElem:e,selectionRange:n},Hl=!1,se=t;se!==null;)if(t=se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,se=e;else for(;se!==null;){t=se;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var M=k.memoizedProps,G=k.memoizedState,N=t.stateNode,I=N.getSnapshotBeforeUpdate(t.elementType===t.type?M:Fr(t.type,M),G);N.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var O=t.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(B){at(t,t.return,B)}if(e=t.sibling,e!==null){e.return=t.return,se=e;break}se=t.return}return k=Up,Up=!1,k}function To(e,t,n){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&e)===e){var u=c.destroy;c.destroy=void 0,u!==void 0&&U1(t,n,u)}c=c.next}while(c!==o)}}function zc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var o=n.create;n.destroy=o()}n=n.next}while(n!==t)}}function j1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function gv(e){var t=e.alternate;t!==null&&(e.alternate=null,gv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[nn],delete t[Xo],delete t[I1],delete t[z7],delete t[V7])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function pv(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function W1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yl));else if(o!==4&&(e=e.child,e!==null))for(W1(e,t,n),e=e.sibling;e!==null;)W1(e,t,n),e=e.sibling}function $1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for($1(e,t,n),e=e.sibling;e!==null;)$1(e,t,n),e=e.sibling}var Dt=null,Ur=!1;function Ln(e,t,n){for(n=n.child;n!==null;)mv(e,t,n),n=n.sibling}function mv(e,t,n){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(Pc,n)}catch{}switch(n.tag){case 5:$t||ls(n,t);case 6:var o=Dt,c=Ur;Dt=null,Ln(e,t,n),Dt=o,Ur=c,Dt!==null&&(Ur?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Ur?(e=Dt,n=n.stateNode,e.nodeType===8?xf(e.parentNode,n):e.nodeType===1&&xf(e,n),$o(e)):xf(Dt,n.stateNode));break;case 4:o=Dt,c=Ur,Dt=n.stateNode.containerInfo,Ur=!0,Ln(e,t,n),Dt=o,Ur=c;break;case 0:case 11:case 14:case 15:if(!$t&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){c=o=o.next;do{var u=c,g=u.destroy;u=u.tag,g!==void 0&&(u&2||u&4)&&U1(n,t,g),c=c.next}while(c!==o)}Ln(e,t,n);break;case 1:if(!$t&&(ls(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(x){at(n,t,x)}Ln(e,t,n);break;case 21:Ln(e,t,n);break;case 22:n.mode&1?($t=(o=$t)||n.memoizedState!==null,Ln(e,t,n),$t=o):Ln(e,t,n);break;default:Ln(e,t,n)}}function Wp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new o9),t.forEach(function(o){var c=m9.bind(null,e,o);n.has(o)||(n.add(o),o.then(c,c))})}}function Pr(e,t){var n=t.deletions;if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];try{var u=e,g=t,x=g;e:for(;x!==null;){switch(x.tag){case 5:Dt=x.stateNode,Ur=!1;break e;case 3:Dt=x.stateNode.containerInfo,Ur=!0;break e;case 4:Dt=x.stateNode.containerInfo,Ur=!0;break e}x=x.return}if(Dt===null)throw Error(Q(160));mv(u,g,c),Dt=null,Ur=!1;var w=c.alternate;w!==null&&(w.return=null),c.return=null}catch(m){at(c,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)xv(t,e),t=t.sibling}function xv(e,t){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pr(t,e),tn(e),o&4){try{To(3,e,e.return),zc(3,e)}catch(M){at(e,e.return,M)}try{To(5,e,e.return)}catch(M){at(e,e.return,M)}}break;case 1:Pr(t,e),tn(e),o&512&&n!==null&&ls(n,n.return);break;case 5:if(Pr(t,e),tn(e),o&512&&n!==null&&ls(n,n.return),e.flags&32){var c=e.stateNode;try{Fo(c,"")}catch(M){at(e,e.return,M)}}if(o&4&&(c=e.stateNode,c!=null)){var u=e.memoizedProps,g=n!==null?n.memoizedProps:u,x=e.type,w=e.updateQueue;if(e.updateQueue=null,w!==null)try{x==="input"&&u.type==="radio"&&u.name!=null&&Ux(c,u),d1(x,g);var m=d1(x,u);for(g=0;g<w.length;g+=2){var C=w[g],b=w[g+1];C==="style"?Vx(c,b):C==="dangerouslySetInnerHTML"?$x(c,b):C==="children"?Fo(c,b):qd(c,C,b,m)}switch(x){case"input":a1(c,u);break;case"textarea":jx(c,u);break;case"select":var A=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var T=u.value;T!=null?hs(c,!!u.multiple,T,!1):A!==!!u.multiple&&(u.defaultValue!=null?hs(c,!!u.multiple,u.defaultValue,!0):hs(c,!!u.multiple,u.multiple?[]:"",!1))}c[Xo]=u}catch(M){at(e,e.return,M)}}break;case 6:if(Pr(t,e),tn(e),o&4){if(e.stateNode===null)throw Error(Q(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(M){at(e,e.return,M)}}break;case 3:if(Pr(t,e),tn(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{$o(t.containerInfo)}catch(M){at(e,e.return,M)}break;case 4:Pr(t,e),tn(e);break;case 13:Pr(t,e),tn(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(N0=ut())),o&4&&Wp(e);break;case 22:if(C=n!==null&&n.memoizedState!==null,e.mode&1?($t=(m=$t)||C,Pr(t,e),$t=m):Pr(t,e),tn(e),o&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!C&&e.mode&1)for(se=e,C=e.child;C!==null;){for(b=se=C;se!==null;){switch(A=se,T=A.child,A.tag){case 0:case 11:case 14:case 15:To(4,A,A.return);break;case 1:ls(A,A.return);var k=A.stateNode;if(typeof k.componentWillUnmount=="function"){o=A,n=A.return;try{t=o,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(M){at(o,n,M)}}break;case 5:ls(A,A.return);break;case 22:if(A.memoizedState!==null){zp(b);continue}}T!==null?(T.return=A,se=T):zp(b)}C=C.sibling}e:for(C=null,b=e;;){if(b.tag===5){if(C===null){C=b;try{c=b.stateNode,m?(u=c.style,typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"):(x=b.stateNode,w=b.memoizedProps.style,g=w!=null&&w.hasOwnProperty("display")?w.display:null,x.style.display=zx("display",g))}catch(M){at(e,e.return,M)}}}else if(b.tag===6){if(C===null)try{b.stateNode.nodeValue=m?"":b.memoizedProps}catch(M){at(e,e.return,M)}}else if((b.tag!==22&&b.tag!==23||b.memoizedState===null||b===e)&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===e)break e;for(;b.sibling===null;){if(b.return===null||b.return===e)break e;C===b&&(C=null),b=b.return}C===b&&(C=null),b.sibling.return=b.return,b=b.sibling}}break;case 19:Pr(t,e),tn(e),o&4&&Wp(e);break;case 21:break;default:Pr(t,e),tn(e)}}function tn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(pv(n)){var o=n;break e}n=n.return}throw Error(Q(160))}switch(o.tag){case 5:var c=o.stateNode;o.flags&32&&(Fo(c,""),o.flags&=-33);var u=jp(e);$1(e,u,c);break;case 3:case 4:var g=o.stateNode.containerInfo,x=jp(e);W1(e,x,g);break;default:throw Error(Q(161))}}catch(w){at(e,e.return,w)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function l9(e,t,n){se=e,wv(e)}function wv(e,t,n){for(var o=(e.mode&1)!==0;se!==null;){var c=se,u=c.child;if(c.tag===22&&o){var g=c.memoizedState!==null||nl;if(!g){var x=c.alternate,w=x!==null&&x.memoizedState!==null||$t;x=nl;var m=$t;if(nl=g,($t=w)&&!m)for(se=c;se!==null;)g=se,w=g.child,g.tag===22&&g.memoizedState!==null?Vp(c):w!==null?(w.return=g,se=w):Vp(c);for(;u!==null;)se=u,wv(u),u=u.sibling;se=c,nl=x,$t=m}$p(e)}else c.subtreeFlags&8772&&u!==null?(u.return=c,se=u):$p(e)}}function $p(e){for(;se!==null;){var t=se;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$t||zc(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!$t)if(n===null)o.componentDidMount();else{var c=t.elementType===t.type?n.memoizedProps:Fr(t.type,n.memoizedProps);o.componentDidUpdate(c,n.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var u=t.updateQueue;u!==null&&Ip(t,u,o);break;case 3:var g=t.updateQueue;if(g!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Ip(t,g,n)}break;case 5:var x=t.stateNode;if(n===null&&t.flags&4){n=x;var w=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":w.autoFocus&&n.focus();break;case"img":w.src&&(n.src=w.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var C=m.memoizedState;if(C!==null){var b=C.dehydrated;b!==null&&$o(b)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}$t||t.flags&512&&j1(t)}catch(A){at(t,t.return,A)}}if(t===e){se=null;break}if(n=t.sibling,n!==null){n.return=t.return,se=n;break}se=t.return}}function zp(e){for(;se!==null;){var t=se;if(t===e){se=null;break}var n=t.sibling;if(n!==null){n.return=t.return,se=n;break}se=t.return}}function Vp(e){for(;se!==null;){var t=se;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{zc(4,t)}catch(w){at(t,n,w)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var c=t.return;try{o.componentDidMount()}catch(w){at(t,c,w)}}var u=t.return;try{j1(t)}catch(w){at(t,u,w)}break;case 5:var g=t.return;try{j1(t)}catch(w){at(t,g,w)}}}catch(w){at(t,t.return,w)}if(t===e){se=null;break}var x=t.sibling;if(x!==null){x.return=t.return,se=x;break}se=t.return}}var c9=Math.ceil,sc=Tn.ReactCurrentDispatcher,_0=Tn.ReactCurrentOwner,_r=Tn.ReactCurrentBatchConfig,Oe=0,Tt=null,pt=null,Lt=0,hr=0,cs=ii(0),Et=0,Jo=null,Oi=0,Vc=0,O0=0,Ro=null,sr=null,N0=0,_s=1/0,hn=null,oc=!1,z1=null,Zn=null,il=!1,Vn=null,ac=0,_o=0,V1=null,Tl=-1,Rl=0;function Xt(){return Oe&6?ut():Tl!==-1?Tl:Tl=ut()}function Qn(e){return e.mode&1?Oe&2&&Lt!==0?Lt&-Lt:G7.transition!==null?(Rl===0&&(Rl=rw()),Rl):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:cw(e.type)),e):1}function zr(e,t,n,o){if(50<_o)throw _o=0,V1=null,Error(Q(185));ua(e,n,o),(!(Oe&2)||e!==Tt)&&(e===Tt&&(!(Oe&2)&&(Vc|=n),Et===4&&jn(e,Lt)),cr(e,o),n===1&&Oe===0&&!(t.mode&1)&&(_s=ut()+500,jc&&si()))}function cr(e,t){var n=e.callbackNode;G5(e,t);var o=Vl(e,e===Tt?Lt:0);if(o===0)n!==null&&Jg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(n!=null&&Jg(n),t===1)e.tag===0?H7(Hp.bind(null,e)):Rw(Hp.bind(null,e)),W7(function(){!(Oe&6)&&si()}),n=null;else{switch(nw(o)){case 1:n=n0;break;case 4:n=ew;break;case 16:n=zl;break;case 536870912:n=tw;break;default:n=zl}n=Iv(n,vv.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function vv(e,t){if(Tl=-1,Rl=0,Oe&6)throw Error(Q(327));var n=e.callbackNode;if(ws()&&e.callbackNode!==n)return null;var o=Vl(e,e===Tt?Lt:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=lc(e,o);else{t=o;var c=Oe;Oe|=2;var u=Ev();(Tt!==e||Lt!==t)&&(hn=null,_s=ut()+500,bi(e,t));do try{d9();break}catch(x){yv(e,x)}while(!0);m0(),sc.current=u,Oe=c,pt!==null?t=0:(Tt=null,Lt=0,t=Et)}if(t!==0){if(t===2&&(c=x1(e),c!==0&&(o=c,t=H1(e,c))),t===1)throw n=Jo,bi(e,0),jn(e,o),cr(e,ut()),n;if(t===6)jn(e,o);else{if(c=e.current.alternate,!(o&30)&&!u9(c)&&(t=lc(e,o),t===2&&(u=x1(e),u!==0&&(o=u,t=H1(e,u))),t===1))throw n=Jo,bi(e,0),jn(e,o),cr(e,ut()),n;switch(e.finishedWork=c,e.finishedLanes=o,t){case 0:case 1:throw Error(Q(345));case 2:mi(e,sr,hn);break;case 3:if(jn(e,o),(o&130023424)===o&&(t=N0+500-ut(),10<t)){if(Vl(e,0)!==0)break;if(c=e.suspendedLanes,(c&o)!==o){Xt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=S1(mi.bind(null,e,sr,hn),t);break}mi(e,sr,hn);break;case 4:if(jn(e,o),(o&4194240)===o)break;for(t=e.eventTimes,c=-1;0<o;){var g=31-$r(o);u=1<<g,g=t[g],g>c&&(c=g),o&=~u}if(o=c,o=ut()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*c9(o/1960))-o,10<o){e.timeoutHandle=S1(mi.bind(null,e,sr,hn),o);break}mi(e,sr,hn);break;case 5:mi(e,sr,hn);break;default:throw Error(Q(329))}}}return cr(e,ut()),e.callbackNode===n?vv.bind(null,e):null}function H1(e,t){var n=Ro;return e.current.memoizedState.isDehydrated&&(bi(e,t).flags|=256),e=lc(e,t),e!==2&&(t=sr,sr=n,t!==null&&G1(t)),e}function G1(e){sr===null?sr=e:sr.push.apply(sr,e)}function u9(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var o=0;o<n.length;o++){var c=n[o],u=c.getSnapshot;c=c.value;try{if(!Vr(u(),c))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function jn(e,t){for(t&=~O0,t&=~Vc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-$r(t),o=1<<n;e[n]=-1,t&=~o}}function Hp(e){if(Oe&6)throw Error(Q(327));ws();var t=Vl(e,0);if(!(t&1))return cr(e,ut()),null;var n=lc(e,t);if(e.tag!==0&&n===2){var o=x1(e);o!==0&&(t=o,n=H1(e,o))}if(n===1)throw n=Jo,bi(e,0),jn(e,t),cr(e,ut()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,mi(e,sr,hn),cr(e,ut()),null}function k0(e,t){var n=Oe;Oe|=1;try{return e(t)}finally{Oe=n,Oe===0&&(_s=ut()+500,jc&&si())}}function Ni(e){Vn!==null&&Vn.tag===0&&!(Oe&6)&&ws();var t=Oe;Oe|=1;var n=_r.transition,o=Pe;try{if(_r.transition=null,Pe=1,e)return e()}finally{Pe=o,_r.transition=n,Oe=t,!(Oe&6)&&si()}}function M0(){hr=cs.current,He(cs)}function bi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,j7(n)),pt!==null)for(n=pt.return;n!==null;){var o=n;switch(h0(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&Kl();break;case 3:Ts(),He(ar),He(zt),C0();break;case 5:E0(o);break;case 4:Ts();break;case 13:He(Je);break;case 19:He(Je);break;case 10:x0(o.type._context);break;case 22:case 23:M0()}n=n.return}if(Tt=e,pt=e=qn(e.current,null),Lt=hr=t,Et=0,Jo=null,O0=Vc=Oi=0,sr=Ro=null,vi!==null){for(t=0;t<vi.length;t++)if(n=vi[t],o=n.interleaved,o!==null){n.interleaved=null;var c=o.next,u=n.pending;if(u!==null){var g=u.next;u.next=c,o.next=g}n.pending=o}vi=null}return e}function yv(e,t){do{var n=pt;try{if(m0(),Al.current=ic,nc){for(var o=et.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}nc=!1}if(_i=0,It=yt=et=null,Io=!1,Zo=0,_0.current=null,n===null||n.return===null){Et=1,Jo=t,pt=null;break}e:{var u=e,g=n.return,x=n,w=t;if(t=Lt,x.flags|=32768,w!==null&&typeof w=="object"&&typeof w.then=="function"){var m=w,C=x,b=C.tag;if(!(C.mode&1)&&(b===0||b===11||b===15)){var A=C.alternate;A?(C.updateQueue=A.updateQueue,C.memoizedState=A.memoizedState,C.lanes=A.lanes):(C.updateQueue=null,C.memoizedState=null)}var T=kp(g);if(T!==null){T.flags&=-257,Mp(T,g,x,u,t),T.mode&1&&Np(u,m,t),t=T,w=m;var k=t.updateQueue;if(k===null){var M=new Set;M.add(w),t.updateQueue=M}else k.add(w);break e}else{if(!(t&1)){Np(u,m,t),D0();break e}w=Error(Q(426))}}else if(Ke&&x.mode&1){var G=kp(g);if(G!==null){!(G.flags&65536)&&(G.flags|=256),Mp(G,g,x,u,t),g0(Rs(w,x));break e}}u=w=Rs(w,x),Et!==4&&(Et=2),Ro===null?Ro=[u]:Ro.push(u),u=g;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var N=nv(u,w,t);Sp(u,N);break e;case 1:x=w;var I=u.type,O=u.stateNode;if(!(u.flags&128)&&(typeof I.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(Zn===null||!Zn.has(O)))){u.flags|=65536,t&=-t,u.lanes|=t;var B=iv(u,x,t);Sp(u,B);break e}}u=u.return}while(u!==null)}bv(n)}catch(j){t=j,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function Ev(){var e=sc.current;return sc.current=ic,e===null?ic:e}function D0(){(Et===0||Et===3||Et===2)&&(Et=4),Tt===null||!(Oi&268435455)&&!(Vc&268435455)||jn(Tt,Lt)}function lc(e,t){var n=Oe;Oe|=2;var o=Ev();(Tt!==e||Lt!==t)&&(hn=null,bi(e,t));do try{f9();break}catch(c){yv(e,c)}while(!0);if(m0(),Oe=n,sc.current=o,pt!==null)throw Error(Q(261));return Tt=null,Lt=0,Et}function f9(){for(;pt!==null;)Cv(pt)}function d9(){for(;pt!==null&&!B5();)Cv(pt)}function Cv(e){var t=Sv(e.alternate,e,hr);e.memoizedProps=e.pendingProps,t===null?bv(e):pt=t,_0.current=null}function bv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=s9(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Et=6,pt=null;return}}else if(n=i9(n,t,hr),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);Et===0&&(Et=5)}function mi(e,t,n){var o=Pe,c=_r.transition;try{_r.transition=null,Pe=1,h9(e,t,n,o)}finally{_r.transition=c,Pe=o}return null}function h9(e,t,n,o){do ws();while(Vn!==null);if(Oe&6)throw Error(Q(327));n=e.finishedWork;var c=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var u=n.lanes|n.childLanes;if(X5(e,u),e===Tt&&(pt=Tt=null,Lt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||il||(il=!0,Iv(zl,function(){return ws(),null})),u=(n.flags&15990)!==0,n.subtreeFlags&15990||u){u=_r.transition,_r.transition=null;var g=Pe;Pe=1;var x=Oe;Oe|=4,_0.current=null,a9(e,n),xv(n,e),M7(b1),Hl=!!C1,b1=C1=null,e.current=n,l9(n),F5(),Oe=x,Pe=g,_r.transition=u}else e.current=n;if(il&&(il=!1,Vn=e,ac=c),u=e.pendingLanes,u===0&&(Zn=null),W5(n.stateNode),cr(e,ut()),t!==null)for(o=e.onRecoverableError,n=0;n<t.length;n++)c=t[n],o(c.value,{componentStack:c.stack,digest:c.digest});if(oc)throw oc=!1,e=z1,z1=null,e;return ac&1&&e.tag!==0&&ws(),u=e.pendingLanes,u&1?e===V1?_o++:(_o=0,V1=e):_o=0,si(),null}function ws(){if(Vn!==null){var e=nw(ac),t=_r.transition,n=Pe;try{if(_r.transition=null,Pe=16>e?16:e,Vn===null)var o=!1;else{if(e=Vn,Vn=null,ac=0,Oe&6)throw Error(Q(331));var c=Oe;for(Oe|=4,se=e.current;se!==null;){var u=se,g=u.child;if(se.flags&16){var x=u.deletions;if(x!==null){for(var w=0;w<x.length;w++){var m=x[w];for(se=m;se!==null;){var C=se;switch(C.tag){case 0:case 11:case 15:To(8,C,u)}var b=C.child;if(b!==null)b.return=C,se=b;else for(;se!==null;){C=se;var A=C.sibling,T=C.return;if(gv(C),C===m){se=null;break}if(A!==null){A.return=T,se=A;break}se=T}}}var k=u.alternate;if(k!==null){var M=k.child;if(M!==null){k.child=null;do{var G=M.sibling;M.sibling=null,M=G}while(M!==null)}}se=u}}if(u.subtreeFlags&2064&&g!==null)g.return=u,se=g;else e:for(;se!==null;){if(u=se,u.flags&2048)switch(u.tag){case 0:case 11:case 15:To(9,u,u.return)}var N=u.sibling;if(N!==null){N.return=u.return,se=N;break e}se=u.return}}var I=e.current;for(se=I;se!==null;){g=se;var O=g.child;if(g.subtreeFlags&2064&&O!==null)O.return=g,se=O;else e:for(g=I;se!==null;){if(x=se,x.flags&2048)try{switch(x.tag){case 0:case 11:case 15:zc(9,x)}}catch(j){at(x,x.return,j)}if(x===g){se=null;break e}var B=x.sibling;if(B!==null){B.return=x.return,se=B;break e}se=x.return}}if(Oe=c,si(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(Pc,e)}catch{}o=!0}return o}finally{Pe=n,_r.transition=t}}return!1}function Gp(e,t,n){t=Rs(n,t),t=nv(e,t,1),e=Kn(e,t,1),t=Xt(),e!==null&&(ua(e,1,t),cr(e,t))}function at(e,t,n){if(e.tag===3)Gp(e,e,n);else for(;t!==null;){if(t.tag===3){Gp(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Zn===null||!Zn.has(o))){e=Rs(n,e),e=iv(t,e,1),t=Kn(t,e,1),e=Xt(),t!==null&&(ua(t,1,e),cr(t,e));break}}t=t.return}}function g9(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),t=Xt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(Lt&n)===n&&(Et===4||Et===3&&(Lt&130023424)===Lt&&500>ut()-N0?bi(e,0):O0|=n),cr(e,t)}function Av(e,t){t===0&&(e.mode&1?(t=Ya,Ya<<=1,!(Ya&130023424)&&(Ya=4194304)):t=1);var n=Xt();e=bn(e,t),e!==null&&(ua(e,t,n),cr(e,n))}function p9(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Av(e,n)}function m9(e,t){var n=0;switch(e.tag){case 13:var o=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(Q(314))}o!==null&&o.delete(t),Av(e,n)}var Sv;Sv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ar.current)or=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return or=!1,n9(e,t,n);or=!!(e.flags&131072)}else or=!1,Ke&&t.flags&1048576&&_w(t,ql,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;Il(e,t),e=t.pendingProps;var c=As(t,zt.current);xs(t,n),c=A0(null,t,o,e,c,n);var u=S0();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,lr(o)?(u=!0,Zl(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,v0(t),c.updater=$c,t.stateNode=c,c._reactInternals=t,k1(t,o,e,n),t=P1(null,t,o,!0,u,n)):(t.tag=0,Ke&&u&&d0(t),Gt(null,t,c,n),t=t.child),t;case 16:o=t.elementType;e:{switch(Il(e,t),e=t.pendingProps,c=o._init,o=c(o._payload),t.type=o,c=t.tag=w9(o),e=Fr(o,e),c){case 0:t=D1(null,t,o,e,n);break e;case 1:t=Lp(null,t,o,e,n);break e;case 11:t=Dp(null,t,o,e,n);break e;case 14:t=Pp(null,t,o,Fr(o.type,e),n);break e}throw Error(Q(306,o,""))}return t;case 0:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),D1(e,t,o,c,n);case 1:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Lp(e,t,o,c,n);case 3:e:{if(lv(t),e===null)throw Error(Q(387));o=t.pendingProps,u=t.memoizedState,c=u.element,Pw(e,t),tc(t,o,null,n);var g=t.memoizedState;if(o=g.element,u.isDehydrated)if(u={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){c=Rs(Error(Q(423)),t),t=Bp(e,t,o,n,c);break e}else if(o!==c){c=Rs(Error(Q(424)),t),t=Bp(e,t,o,n,c);break e}else for(gr=Yn(t.stateNode.containerInfo.firstChild),pr=t,Ke=!0,Wr=null,n=Mw(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ss(),o===c){t=An(e,t,n);break e}Gt(e,t,o,n)}t=t.child}return t;case 5:return Lw(t),e===null&&_1(t),o=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,g=c.children,A1(o,c)?g=null:u!==null&&A1(o,u)&&(t.flags|=32),av(e,t),Gt(e,t,g,n),t.child;case 6:return e===null&&_1(t),null;case 13:return cv(e,t,n);case 4:return y0(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Is(t,null,o,n):Gt(e,t,o,n),t.child;case 11:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Dp(e,t,o,c,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,c=t.pendingProps,u=t.memoizedProps,g=c.value,$e(Jl,o._currentValue),o._currentValue=g,u!==null)if(Vr(u.value,g)){if(u.children===c.children&&!ar.current){t=An(e,t,n);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var x=u.dependencies;if(x!==null){g=u.child;for(var w=x.firstContext;w!==null;){if(w.context===o){if(u.tag===1){w=wn(-1,n&-n),w.tag=2;var m=u.updateQueue;if(m!==null){m=m.shared;var C=m.pending;C===null?w.next=w:(w.next=C.next,C.next=w),m.pending=w}}u.lanes|=n,w=u.alternate,w!==null&&(w.lanes|=n),O1(u.return,n,t),x.lanes|=n;break}w=w.next}}else if(u.tag===10)g=u.type===t.type?null:u.child;else if(u.tag===18){if(g=u.return,g===null)throw Error(Q(341));g.lanes|=n,x=g.alternate,x!==null&&(x.lanes|=n),O1(g,n,t),g=u.sibling}else g=u.child;if(g!==null)g.return=u;else for(g=u;g!==null;){if(g===t){g=null;break}if(u=g.sibling,u!==null){u.return=g.return,g=u;break}g=g.return}u=g}Gt(e,t,c.children,n),t=t.child}return t;case 9:return c=t.type,o=t.pendingProps.children,xs(t,n),c=Or(c),o=o(c),t.flags|=1,Gt(e,t,o,n),t.child;case 14:return o=t.type,c=Fr(o,t.pendingProps),c=Fr(o.type,c),Pp(e,t,o,c,n);case 15:return sv(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Il(e,t),t.tag=1,lr(o)?(e=!0,Zl(t)):e=!1,xs(t,n),rv(t,o,c),k1(t,o,c,n),P1(null,t,o,!0,e,n);case 19:return uv(e,t,n);case 22:return ov(e,t,n)}throw Error(Q(156,t.tag))};function Iv(e,t){return Jx(e,t)}function x9(e,t,n,o){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rr(e,t,n,o){return new x9(e,t,n,o)}function P0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function w9(e){if(typeof e=="function")return P0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===e0)return 11;if(e===t0)return 14}return 2}function qn(e,t){var n=e.alternate;return n===null?(n=Rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _l(e,t,n,o,c,u){var g=2;if(o=e,typeof e=="function")P0(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Ji:return Ai(n.children,c,u,t);case Jd:g=8,c|=8;break;case r1:return e=Rr(12,n,t,c|2),e.elementType=r1,e.lanes=u,e;case n1:return e=Rr(13,n,t,c),e.elementType=n1,e.lanes=u,e;case i1:return e=Rr(19,n,t,c),e.elementType=i1,e.lanes=u,e;case Lx:return Hc(n,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dx:g=10;break e;case Px:g=9;break e;case e0:g=11;break e;case t0:g=14;break e;case Bn:g=16,o=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Rr(g,n,t,c),t.elementType=e,t.type=o,t.lanes=u,t}function Ai(e,t,n,o){return e=Rr(7,e,o,t),e.lanes=n,e}function Hc(e,t,n,o){return e=Rr(22,e,o,t),e.elementType=Lx,e.lanes=n,e.stateNode={isHidden:!1},e}function Sf(e,t,n){return e=Rr(6,e,null,t),e.lanes=n,e}function If(e,t,n){return t=Rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function v9(e,t,n,o,c){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=of(0),this.expirationTimes=of(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=of(0),this.identifierPrefix=o,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function L0(e,t,n,o,c,u,g,x,w){return e=new v9(e,t,n,x,w),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Rr(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},v0(u),e}function y9(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qi,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}function Tv(e){if(!e)return ei;e=e._reactInternals;e:{if(Pi(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(lr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(lr(n))return Tw(e,n,t)}return t}function Rv(e,t,n,o,c,u,g,x,w){return e=L0(n,o,!0,e,c,u,g,x,w),e.context=Tv(null),n=e.current,o=Xt(),c=Qn(n),u=wn(o,c),u.callback=t??null,Kn(n,u,c),e.current.lanes=c,ua(e,c,o),cr(e,o),e}function Gc(e,t,n,o){var c=t.current,u=Xt(),g=Qn(c);return n=Tv(n),t.context===null?t.context=n:t.pendingContext=n,t=wn(u,g),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=Kn(c,t,g),e!==null&&(zr(e,c,g,u),bl(e,c,g)),g}function cc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Xp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function B0(e,t){Xp(e,t),(e=e.alternate)&&Xp(e,t)}function E9(){return null}var _v=typeof reportError=="function"?reportError:function(e){console.error(e)};function F0(e){this._internalRoot=e}Xc.prototype.render=F0.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Gc(e,t,null,null)};Xc.prototype.unmount=F0.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ni(function(){Gc(null,e,null,null)}),t[Cn]=null}};function Xc(e){this._internalRoot=e}Xc.prototype.unstable_scheduleHydration=function(e){if(e){var t=ow();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Un.length&&t!==0&&t<Un[n].priority;n++);Un.splice(n,0,e),n===0&&lw(e)}};function U0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Yc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yp(){}function C9(e,t,n,o,c){if(c){if(typeof o=="function"){var u=o;o=function(){var m=cc(g);u.call(m)}}var g=Rv(t,o,e,0,null,!1,!1,"",Yp);return e._reactRootContainer=g,e[Cn]=g.current,Ho(e.nodeType===8?e.parentNode:e),Ni(),g}for(;c=e.lastChild;)e.removeChild(c);if(typeof o=="function"){var x=o;o=function(){var m=cc(w);x.call(m)}}var w=L0(e,0,!1,null,null,!1,!1,"",Yp);return e._reactRootContainer=w,e[Cn]=w.current,Ho(e.nodeType===8?e.parentNode:e),Ni(function(){Gc(t,w,n,o)}),w}function Kc(e,t,n,o,c){var u=n._reactRootContainer;if(u){var g=u;if(typeof c=="function"){var x=c;c=function(){var w=cc(g);x.call(w)}}Gc(t,g,e,c)}else g=C9(n,t,e,c,o);return cc(g)}iw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=po(t.pendingLanes);n!==0&&(i0(t,n|1),cr(t,ut()),!(Oe&6)&&(_s=ut()+500,si()))}break;case 13:Ni(function(){var o=bn(e,1);if(o!==null){var c=Xt();zr(o,e,1,c)}}),B0(e,1)}};s0=function(e){if(e.tag===13){var t=bn(e,134217728);if(t!==null){var n=Xt();zr(t,e,134217728,n)}B0(e,134217728)}};sw=function(e){if(e.tag===13){var t=Qn(e),n=bn(e,t);if(n!==null){var o=Xt();zr(n,e,t,o)}B0(e,t)}};ow=function(){return Pe};aw=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}};g1=function(e,t,n){switch(t){case"input":if(a1(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var c=Uc(o);if(!c)throw Error(Q(90));Fx(o),a1(o,c)}}}break;case"textarea":jx(e,n);break;case"select":t=n.value,t!=null&&hs(e,!!n.multiple,t,!1)}};Xx=k0;Yx=Ni;var b9={usingClientEntryPoint:!1,Events:[da,ns,Uc,Hx,Gx,k0]},lo={findFiberByHostInstance:wi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},A9={bundleType:lo.bundleType,version:lo.version,rendererPackageName:lo.rendererPackageName,rendererConfig:lo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Tn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Qx(e),e===null?null:e.stateNode},findFiberByHostInstance:lo.findFiberByHostInstance||E9,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sl.isDisabled&&sl.supportsFiber)try{Pc=sl.inject(A9),sn=sl}catch{}}vr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b9;vr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!U0(t))throw Error(Q(200));return y9(e,t,null,n)};vr.createRoot=function(e,t){if(!U0(e))throw Error(Q(299));var n=!1,o="",c=_v;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=L0(e,1,!1,null,null,n,!1,o,c),e[Cn]=t.current,Ho(e.nodeType===8?e.parentNode:e),new F0(t)};vr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=Qx(t),e=e===null?null:e.stateNode,e};vr.flushSync=function(e){return Ni(e)};vr.hydrate=function(e,t,n){if(!Yc(t))throw Error(Q(200));return Kc(null,e,t,!0,n)};vr.hydrateRoot=function(e,t,n){if(!U0(e))throw Error(Q(405));var o=n!=null&&n.hydratedSources||null,c=!1,u="",g=_v;if(n!=null&&(n.unstable_strictMode===!0&&(c=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onRecoverableError!==void 0&&(g=n.onRecoverableError)),t=Rv(t,null,e,1,n??null,c,!1,u,g),e[Cn]=t.current,Ho(e),o)for(e=0;e<o.length;e++)n=o[e],c=n._getVersion,c=c(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,c]:t.mutableSourceEagerHydrationData.push(n,c);return new Xc(t)};vr.render=function(e,t,n){if(!Yc(t))throw Error(Q(200));return Kc(null,e,t,!1,n)};vr.unmountComponentAtNode=function(e){if(!Yc(e))throw Error(Q(40));return e._reactRootContainer?(Ni(function(){Kc(null,null,e,!1,function(){e._reactRootContainer=null,e[Cn]=null})}),!0):!1};vr.unstable_batchedUpdates=k0;vr.unstable_renderSubtreeIntoContainer=function(e,t,n,o){if(!Yc(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Kc(e,t,n,!1,o)};vr.version="18.3.1-next-f1338f8080-20240426";function Ov(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ov)}catch(e){console.error(e)}}Ov(),Ox.exports=vr;var uc=Ox.exports;function S9({message:e,showGuidance:t,windows:n,onClose:o}){const c=ce.useRef(null);return ce.useEffect(()=>{var u;(u=c.current)==null||u.showModal()},[]),uc.createPortal(L.jsx("dialog",{ref:c,"aria-label":"远程桌面提醒",onCancel:o,onClick:u=>{u.target===u.currentTarget&&o()},style:{margin:"auto",inset:0,width:"min(370px, calc(100vw - 32px))",maxHeight:"calc(100dvh - 32px)",overflowY:"auto",padding:0,borderRadius:12,border:"1px solid var(--border-default)",background:"var(--bg-surface, white)",color:"var(--text-primary)",fontSize:14,lineHeight:1.7},children:L.jsxs("div",{style:{padding:20},children:[L.jsx("strong",{children:"远程桌面提醒"}),L.jsx("p",{children:e}),t&&L.jsxs(L.Fragment,{children:[L.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),L.jsx("p",{children:n?"在 Windows 电脑上点击“开启共享”,并保持用户已登录、桌面未锁定。完成后此处会自动更新。":"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),L.jsx("button",{type:"button",className:"ui-quiet-button",onClick:o,autoFocus:!0,children:"知道了"})]})}),document.body)}function I9(){const[e,t]=ce.useState(null),[n,o]=ce.useState(!1),[c,u]=ce.useState(!1),[g,x]=ce.useState(""),w=["127.0.0.1","localhost","[::1]"].includes(location.hostname),m=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);ce.useEffect(()=>{let A=!0;const T=async()=>{try{const M=await fetch(m&&w?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!M.ok)return;const G=await M.json();A&&t(G)}catch{}};T();const k=setInterval(T,2e3);return()=>{A=!1,clearInterval(k)}},[m,w]);const C=(e==null?void 0:e.platform)==="win32";if(!m){if(!e||e.online&&e.accessibility)return null;const A=e.supported?e.installed?e.enabled?C&&e.locked&&e.unlock==="available"?"Windows 已锁屏。打开「远程桌面」并选择本机桌面,即可唤醒屏幕或输入密码/PIN 解锁。":C&&e.locked?"Windows 已锁屏,但远程解锁服务尚未安装。请在电脑上运行 agentroam unlock-service install。":e.locked?"macOS 已锁屏。打开「远程桌面」并选择本机桌面会自动唤醒屏幕,随后可在锁屏画面输入密码。":!e.screen||!e.accessibility?C?"Windows 桌面暂不可用,请检查 UAC 提示或登录状态。":"电脑的远程桌面授权尚未完成。":"电脑桌面正在连接,请稍候。":"电脑尚未开启桌面共享,请在电脑上完成授权并开启共享。":"电脑缺少远程桌面组件,请在电脑上升级 CLI。":"这台电脑暂不支持远程桌面。";return L.jsxs("div",{className:"remote-desktop-guidance",children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"查看远程桌面提醒","aria-haspopup":"dialog","aria-expanded":n,onClick:()=>o(!0),style:{color:"var(--warning, #d97706)",minWidth:44,minHeight:44},children:L.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[L.jsx("circle",{cx:"12",cy:"12",r:"9"}),L.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),n&&L.jsx(S9,{windows:C,message:A,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>o(!1)})]})}if(!w)return L.jsxs("div",{style:{position:"relative",marginLeft:12},children:[L.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:L.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),L.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&L.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[L.jsx("strong",{children:"远程授权"}),L.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开终端显示的本机地址,完成配对并开启桌面共享。"}),L.jsxs("p",{children:["在电脑终端运行 ",L.jsx("code",{children:"agentroam service status"})," 查看本机地址。"]}),L.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const b=async(A,T)=>{u(!0),x("");try{const k=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:A,permission:T})}),M=await k.json();if(!k.ok)throw new Error(M.error||"操作失败");t(M)}catch(k){x(k instanceof Error?k.message:"操作失败")}finally{u(!1)}};return L.jsxs("div",{style:{position:"relative",marginLeft:12},children:[L.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:L.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),L.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&L.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",color:"var(--text-primary)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[L.jsx("strong",{children:"远程授权"}),L.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:C?"开启后,已配对设备可查看桌面;接管后可使用鼠标和键盘。":"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.component&&L.jsxs("div",{"aria-label":"远控组件信息",style:{fontSize:12,lineHeight:1.6,overflowWrap:"anywhere"},children:[L.jsxs("div",{children:["组件版本:",e.component.version==="legacy"?`旧版(${e.component.fingerprint??"未记录版本"})`:e.component.version]}),L.jsxs("div",{children:[C?"组件位置":"授权应用位置",":",L.jsx("code",{children:e.component.path})]}),e.component.installed===!1&&L.jsx("p",{children:"点击“重新检测”后会安装到此位置。"}),e.component.updatePending&&L.jsx("p",{role:"status",children:"旧版组件仍在使用。结束其他 AgentRoam 的桌面共享后,点击“重新检测”更新。"})]}),e.supported?e.installed?L.jsxs(L.Fragment,{children:[!C&&["screen","accessibility"].map(A=>L.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[L.jsxs("span",{children:[A==="screen"?"屏幕录制":"辅助功能",":",e[A]?"已授权":"待授权"]}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("authorize",A),children:"去授权"})]},A)),L.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("recheck"),children:"重新检测"}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("restart"),children:"重启授权组件"})]}),C&&L.jsxs("p",{style:{fontSize:12,lineHeight:1.6},children:["远程解锁服务:",e.unlock==="available"?"已安装,可在锁屏后远程唤醒和解锁。":"未安装;在 Windows 终端运行 agentroam unlock-service install 后可启用。"]}),L.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待桌面可用或首帧画面…":"尚未开启共享。"}),L.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:C?"Windows 锁屏后直播入口会保留,可唤醒屏幕或远程解锁;UAC 安全桌面和未登录状态仍不支持控制。":"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):L.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):L.jsx("p",{children:"目前支持 Windows 10/11 x64 和 macOS 14 及以上的 Apple Silicon 电脑。"}),(g||e.error)&&L.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:g||e.error})]})]})}/**
57
+ `+u.stack}return{value:e,source:t,stack:c,digest:null}}function bf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function M1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var rT=typeof WeakMap=="function"?WeakMap:Map;function iv(e,t,n){n=wn(-1,n),n.tag=3,n.payload={element:null};var o=t.value;return n.callback=function(){ac||(ac=!0,z1=o),M1(e,t)},n}function sv(e,t,n){n=wn(-1,n),n.tag=3;var o=e.type.getDerivedStateFromError;if(typeof o=="function"){var c=t.value;n.payload=function(){return o(c)},n.callback=function(){M1(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(n.callback=function(){M1(e,t),typeof o!="function"&&(Zn===null?Zn=new Set([this]):Zn.add(this));var h=t.stack;this.componentDidCatch(t.value,{componentStack:h!==null?h:""})}),n}function Np(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new rT;var c=new Set;o.set(t,c)}else c=o.get(t),c===void 0&&(c=new Set,o.set(t,c));c.has(n)||(c.add(n),e=mT.bind(null,e,t,n),t.then(e,e))}function kp(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Mp(e,t,n,o,c){return e.mode&1?(e.flags|=65536,e.lanes=c,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wn(-1,1),t.tag=2,Kn(n,t,1))),n.lanes|=1),e)}var nT=Tn.ReactCurrentOwner,or=!1;function Gt(e,t,n,o){t.child=e===null?Dw(t,null,n,o):Is(t,e.child,n,o)}function Dp(e,t,n,o,c){n=n.render;var u=t.ref;return xs(t,c),o=A0(e,t,n,o,u,c),n=S0(),e!==null&&!or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,An(e,t,c)):(Ke&&n&&d0(t),t.flags|=1,Gt(e,t,o,c),t.child)}function Pp(e,t,n,o,c){if(e===null){var u=n.type;return typeof u=="function"&&!P0(u)&&u.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=u,ov(e,t,u,o,c)):(e=Ol(n.type,null,o,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!(e.lanes&c)){var h=u.memoizedProps;if(n=n.compare,n=n!==null?n:Vo,n(h,o)&&e.ref===t.ref)return An(e,t,c)}return t.flags|=1,e=qn(u,o),e.ref=t.ref,e.return=t,t.child=e}function ov(e,t,n,o,c){if(e!==null){var u=e.memoizedProps;if(Vo(u,o)&&e.ref===t.ref)if(or=!1,t.pendingProps=o=u,(e.lanes&c)!==0)e.flags&131072&&(or=!0);else return t.lanes=e.lanes,An(e,t,c)}return D1(e,t,n,o,c)}function av(e,t,n){var o=t.pendingProps,c=o.children,u=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(cs,hr),hr|=n;else{if(!(n&1073741824))return e=u!==null?u.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$e(cs,hr),hr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=u!==null?u.baseLanes:n,$e(cs,hr),hr|=o}else u!==null?(o=u.baseLanes|n,t.memoizedState=null):o=n,$e(cs,hr),hr|=o;return Gt(e,t,c,n),t.child}function lv(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function D1(e,t,n,o,c){var u=lr(n)?Ti:zt.current;return u=As(t,u),xs(t,c),n=A0(e,t,n,o,u,c),o=S0(),e!==null&&!or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,An(e,t,c)):(Ke&&o&&d0(t),t.flags|=1,Gt(e,t,n,c),t.child)}function Lp(e,t,n,o,c){if(lr(n)){var u=!0;Ql(t)}else u=!1;if(xs(t,c),t.stateNode===null)Tl(e,t),nv(t,n,o),k1(t,n,o,c),o=!0;else if(e===null){var h=t.stateNode,x=t.memoizedProps;h.props=x;var w=h.context,m=n.contextType;typeof m=="object"&&m!==null?m=Or(m):(m=lr(n)?Ti:zt.current,m=As(t,m));var C=n.getDerivedStateFromProps,b=typeof C=="function"||typeof h.getSnapshotBeforeUpdate=="function";b||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==o||w!==m)&&Op(t,h,o,m),Fn=!1;var A=t.memoizedState;h.state=A,rc(t,o,h,c),w=t.memoizedState,x!==o||A!==w||ar.current||Fn?(typeof C=="function"&&(N1(t,n,C,o),w=t.memoizedState),(x=Fn||_p(t,n,x,o,A,w,m))?(b||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=w),h.props=o,h.state=w,h.context=m,o=x):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{h=t.stateNode,Lw(e,t),x=t.memoizedProps,m=t.type===t.elementType?x:Fr(t.type,x),h.props=m,b=t.pendingProps,A=h.context,w=n.contextType,typeof w=="object"&&w!==null?w=Or(w):(w=lr(n)?Ti:zt.current,w=As(t,w));var T=n.getDerivedStateFromProps;(C=typeof T=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==b||A!==w)&&Op(t,h,o,w),Fn=!1,A=t.memoizedState,h.state=A,rc(t,o,h,c);var k=t.memoizedState;x!==b||A!==k||ar.current||Fn?(typeof T=="function"&&(N1(t,n,T,o),k=t.memoizedState),(m=Fn||_p(t,n,m,o,A,k,w)||!1)?(C||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,k,w),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,k,w)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=k),h.props=o,h.state=k,h.context=w,o=m):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),o=!1)}return P1(e,t,n,o,u,c)}function P1(e,t,n,o,c,u){lv(e,t);var h=(t.flags&128)!==0;if(!o&&!h)return c&&Ep(t,n,!1),An(e,t,u);o=t.stateNode,nT.current=t;var x=h&&typeof n.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&h?(t.child=Is(t,e.child,null,u),t.child=Is(t,null,x,u)):Gt(e,t,x,u),t.memoizedState=o.state,c&&Ep(t,n,!0),t.child}function cv(e){var t=e.stateNode;t.pendingContext?yp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&yp(e,t.context,!1),y0(e,t.containerInfo)}function Bp(e,t,n,o,c){return Ss(),g0(c),t.flags|=256,Gt(e,t,n,o),t.child}var L1={dehydrated:null,treeContext:null,retryLane:0};function B1(e){return{baseLanes:e,cachePool:null,transitions:null}}function uv(e,t,n){var o=t.pendingProps,c=Je.current,u=!1,h=(t.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(c&2)!==0),x?(u=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),$e(Je,c&1),e===null)return _1(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(h=o.children,e=o.fallback,u?(o=t.mode,u=t.child,h={mode:"hidden",children:h},!(o&1)&&u!==null?(u.childLanes=0,u.pendingProps=h):u=Hc(h,o,0,null),e=Ai(e,o,n,null),u.return=t,e.return=t,u.sibling=e,t.child=u,t.child.memoizedState=B1(n),t.memoizedState=L1,e):R0(t,h));if(c=e.memoizedState,c!==null&&(x=c.dehydrated,x!==null))return iT(e,t,h,o,x,c,n);if(u){u=o.fallback,h=t.mode,c=e.child,x=c.sibling;var w={mode:"hidden",children:o.children};return!(h&1)&&t.child!==c?(o=t.child,o.childLanes=0,o.pendingProps=w,t.deletions=null):(o=qn(c,w),o.subtreeFlags=c.subtreeFlags&14680064),x!==null?u=qn(x,u):(u=Ai(u,h,n,null),u.flags|=2),u.return=t,o.return=t,o.sibling=u,t.child=o,o=u,u=t.child,h=e.child.memoizedState,h=h===null?B1(n):{baseLanes:h.baseLanes|n,cachePool:null,transitions:h.transitions},u.memoizedState=h,u.childLanes=e.childLanes&~n,t.memoizedState=L1,o}return u=e.child,e=u.sibling,o=qn(u,{mode:"visible",children:o.children}),!(t.mode&1)&&(o.lanes=n),o.return=t,o.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function R0(e,t){return t=Hc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function nl(e,t,n,o){return o!==null&&g0(o),Is(t,e.child,null,n),e=R0(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function iT(e,t,n,o,c,u,h){if(n)return t.flags&256?(t.flags&=-257,o=bf(Error(Q(422))),nl(e,t,h,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=o.fallback,c=t.mode,o=Hc({mode:"visible",children:o.children},c,0,null),u=Ai(u,c,h,null),u.flags|=2,o.return=t,u.return=t,o.sibling=u,t.child=o,t.mode&1&&Is(t,e.child,null,h),t.child.memoizedState=B1(h),t.memoizedState=L1,u);if(!(t.mode&1))return nl(e,t,h,null);if(c.data==="$!"){if(o=c.nextSibling&&c.nextSibling.dataset,o)var x=o.dgst;return o=x,u=Error(Q(419)),o=bf(u,o,void 0),nl(e,t,h,o)}if(x=(h&e.childLanes)!==0,or||x){if(o=Tt,o!==null){switch(h&-h){case 4:c=2;break;case 16:c=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:c=32;break;case 536870912:c=268435456;break;default:c=0}c=c&(o.suspendedLanes|h)?0:c,c!==0&&c!==u.retryLane&&(u.retryLane=c,bn(e,c),zr(o,e,c,-1))}return D0(),o=bf(Error(Q(421))),nl(e,t,h,o)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=xT.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,gr=Yn(c.nextSibling),pr=t,Ke=!0,Wr=null,e!==null&&(Ir[Tr++]=mn,Ir[Tr++]=xn,Ir[Tr++]=Ri,mn=e.id,xn=e.overflow,Ri=t),t=R0(t,o.children),t.flags|=4096,t)}function Fp(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),O1(e.return,t,n)}function Af(e,t,n,o,c){var u=e.memoizedState;u===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:c}:(u.isBackwards=t,u.rendering=null,u.renderingStartTime=0,u.last=o,u.tail=n,u.tailMode=c)}function fv(e,t,n){var o=t.pendingProps,c=o.revealOrder,u=o.tail;if(Gt(e,t,o.children,n),o=Je.current,o&2)o=o&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fp(e,n,t);else if(e.tag===19)Fp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}o&=1}if($e(Je,o),!(t.mode&1))t.memoizedState=null;else switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&nc(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Af(t,!1,c,n,u);break;case"backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&nc(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Af(t,!0,n,null,u);break;case"together":Af(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Tl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function An(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Oi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=qn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sT(e,t,n){switch(t.tag){case 3:cv(t),Ss();break;case 5:Bw(t);break;case 1:lr(t.type)&&Ql(t);break;case 4:y0(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,c=t.memoizedProps.value;$e(ec,o._currentValue),o._currentValue=c;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?($e(Je,Je.current&1),t.flags|=128,null):n&t.child.childLanes?uv(e,t,n):($e(Je,Je.current&1),e=An(e,t,n),e!==null?e.sibling:null);$e(Je,Je.current&1);break;case 19:if(o=(n&t.childLanes)!==0,e.flags&128){if(o)return fv(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),$e(Je,Je.current),o)break;return null;case 22:case 23:return t.lanes=0,av(e,t,n)}return An(e,t,n)}var dv,F1,hv,gv;dv=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};F1=function(){};hv=function(e,t,n,o){var c=e.memoizedProps;if(c!==o){e=t.stateNode,yi(on.current);var u=null;switch(n){case"input":c=o1(e,c),o=o1(e,o),u=[];break;case"select":c=tt({},c,{value:void 0}),o=tt({},o,{value:void 0}),u=[];break;case"textarea":c=c1(e,c),o=c1(e,o),u=[];break;default:typeof c.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=Kl)}f1(n,o);var h;n=null;for(m in c)if(!o.hasOwnProperty(m)&&c.hasOwnProperty(m)&&c[m]!=null)if(m==="style"){var x=c[m];for(h in x)x.hasOwnProperty(h)&&(n||(n={}),n[h]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(Bo.hasOwnProperty(m)?u||(u=[]):(u=u||[]).push(m,null));for(m in o){var w=o[m];if(x=c!=null?c[m]:void 0,o.hasOwnProperty(m)&&w!==x&&(w!=null||x!=null))if(m==="style")if(x){for(h in x)!x.hasOwnProperty(h)||w&&w.hasOwnProperty(h)||(n||(n={}),n[h]="");for(h in w)w.hasOwnProperty(h)&&x[h]!==w[h]&&(n||(n={}),n[h]=w[h])}else n||(u||(u=[]),u.push(m,n)),n=w;else m==="dangerouslySetInnerHTML"?(w=w?w.__html:void 0,x=x?x.__html:void 0,w!=null&&x!==w&&(u=u||[]).push(m,w)):m==="children"?typeof w!="string"&&typeof w!="number"||(u=u||[]).push(m,""+w):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(Bo.hasOwnProperty(m)?(w!=null&&m==="onScroll"&&Ve("scroll",e),u||x===w||(u=[])):(u=u||[]).push(m,w))}n&&(u=u||[]).push("style",n);var m=u;(t.updateQueue=m)&&(t.flags|=4)}};gv=function(e,t,n,o){n!==o&&(t.flags|=4)};function ao(e,t){if(!Ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,o=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags&14680064,o|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags,o|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=o,e.childLanes=n,t}function oT(e,t,n){var o=t.pendingProps;switch(h0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(t),null;case 1:return lr(t.type)&&Zl(),Wt(t),null;case 3:return o=t.stateNode,Ts(),He(ar),He(zt),C0(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(tl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wr!==null&&(G1(Wr),Wr=null))),F1(e,t),Wt(t),null;case 5:E0(t);var c=yi(Ko.current);if(n=t.type,e!==null&&t.stateNode!=null)hv(e,t,n,o,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(Q(166));return Wt(t),null}if(e=yi(on.current),tl(t)){o=t.stateNode,n=t.type;var u=t.memoizedProps;switch(o[nn]=t,o[Xo]=u,e=(t.mode&1)!==0,n){case"dialog":Ve("cancel",o),Ve("close",o);break;case"iframe":case"object":case"embed":Ve("load",o);break;case"video":case"audio":for(c=0;c<mo.length;c++)Ve(mo[c],o);break;case"source":Ve("error",o);break;case"img":case"image":case"link":Ve("error",o),Ve("load",o);break;case"details":Ve("toggle",o);break;case"input":Xg(o,u),Ve("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!u.multiple},Ve("invalid",o);break;case"textarea":Kg(o,u),Ve("invalid",o)}f1(n,u),c=null;for(var h in u)if(u.hasOwnProperty(h)){var x=u[h];h==="children"?typeof x=="string"?o.textContent!==x&&(u.suppressHydrationWarning!==!0&&el(o.textContent,x,e),c=["children",x]):typeof x=="number"&&o.textContent!==""+x&&(u.suppressHydrationWarning!==!0&&el(o.textContent,x,e),c=["children",""+x]):Bo.hasOwnProperty(h)&&x!=null&&h==="onScroll"&&Ve("scroll",o)}switch(n){case"input":Ga(o),Yg(o,u,!0);break;case"textarea":Ga(o),Zg(o);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(o.onclick=Kl)}o=c,t.updateQueue=o,o!==null&&(t.flags|=4)}else{h=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=$x(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=h.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=h.createElement(n,{is:o.is}):(e=h.createElement(n),n==="select"&&(h=e,o.multiple?h.multiple=!0:o.size&&(h.size=o.size))):e=h.createElementNS(e,n),e[nn]=t,e[Xo]=o,dv(e,t,!1,!1),t.stateNode=e;e:{switch(h=d1(n,o),n){case"dialog":Ve("cancel",e),Ve("close",e),c=o;break;case"iframe":case"object":case"embed":Ve("load",e),c=o;break;case"video":case"audio":for(c=0;c<mo.length;c++)Ve(mo[c],e);c=o;break;case"source":Ve("error",e),c=o;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),c=o;break;case"details":Ve("toggle",e),c=o;break;case"input":Xg(e,o),c=o1(e,o),Ve("invalid",e);break;case"option":c=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},c=tt({},o,{value:void 0}),Ve("invalid",e);break;case"textarea":Kg(e,o),c=c1(e,o),Ve("invalid",e);break;default:c=o}f1(n,c),x=c;for(u in x)if(x.hasOwnProperty(u)){var w=x[u];u==="style"?Hx(e,w):u==="dangerouslySetInnerHTML"?(w=w?w.__html:void 0,w!=null&&zx(e,w)):u==="children"?typeof w=="string"?(n!=="textarea"||w!=="")&&Fo(e,w):typeof w=="number"&&Fo(e,""+w):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Bo.hasOwnProperty(u)?w!=null&&u==="onScroll"&&Ve("scroll",e):w!=null&&qd(e,u,w,h))}switch(n){case"input":Ga(e),Yg(e,o,!1);break;case"textarea":Ga(e),Zg(e);break;case"option":o.value!=null&&e.setAttribute("value",""+Jn(o.value));break;case"select":e.multiple=!!o.multiple,u=o.value,u!=null?hs(e,!!o.multiple,u,!1):o.defaultValue!=null&&hs(e,!!o.multiple,o.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Kl)}switch(n){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Wt(t),null;case 6:if(e&&t.stateNode!=null)gv(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(Q(166));if(n=yi(Ko.current),yi(on.current),tl(t)){if(o=t.stateNode,n=t.memoizedProps,o[nn]=t,(u=o.nodeValue!==n)&&(e=pr,e!==null))switch(e.tag){case 3:el(o.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&el(o.nodeValue,n,(e.mode&1)!==0)}u&&(t.flags|=4)}else o=(n.nodeType===9?n:n.ownerDocument).createTextNode(o),o[nn]=t,t.stateNode=o}return Wt(t),null;case 13:if(He(Je),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ke&&gr!==null&&t.mode&1&&!(t.flags&128))kw(),Ss(),t.flags|=98560,u=!1;else if(u=tl(t),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(Q(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(Q(317));u[nn]=t}else Ss(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wt(t),u=!1}else Wr!==null&&(G1(Wr),Wr=null),u=!0;if(!u)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(o=o!==null,o!==(e!==null&&e.memoizedState!==null)&&o&&(t.child.flags|=8192,t.mode&1&&(e===null||Je.current&1?Et===0&&(Et=3):D0())),t.updateQueue!==null&&(t.flags|=4),Wt(t),null);case 4:return Ts(),F1(e,t),e===null&&Ho(t.stateNode.containerInfo),Wt(t),null;case 10:return x0(t.type._context),Wt(t),null;case 17:return lr(t.type)&&Zl(),Wt(t),null;case 19:if(He(Je),u=t.memoizedState,u===null)return Wt(t),null;if(o=(t.flags&128)!==0,h=u.rendering,h===null)if(o)ao(u,!1);else{if(Et!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(h=nc(e),h!==null){for(t.flags|=128,ao(u,!1),o=h.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=n,n=t.child;n!==null;)u=n,e=o,u.flags&=14680066,h=u.alternate,h===null?(u.childLanes=0,u.lanes=e,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=h.childLanes,u.lanes=h.lanes,u.child=h.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=h.memoizedProps,u.memoizedState=h.memoizedState,u.updateQueue=h.updateQueue,u.type=h.type,e=h.dependencies,u.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return $e(Je,Je.current&1|2),t.child}e=e.sibling}u.tail!==null&&ut()>_s&&(t.flags|=128,o=!0,ao(u,!1),t.lanes=4194304)}else{if(!o)if(e=nc(h),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ao(u,!0),u.tail===null&&u.tailMode==="hidden"&&!h.alternate&&!Ke)return Wt(t),null}else 2*ut()-u.renderingStartTime>_s&&n!==1073741824&&(t.flags|=128,o=!0,ao(u,!1),t.lanes=4194304);u.isBackwards?(h.sibling=t.child,t.child=h):(n=u.last,n!==null?n.sibling=h:t.child=h,u.last=h)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ut(),t.sibling=null,n=Je.current,$e(Je,o?n&1|2:n&1),t):(Wt(t),null);case 22:case 23:return M0(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?hr&1073741824&&(Wt(t),t.subtreeFlags&6&&(t.flags|=8192)):Wt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function aT(e,t){switch(h0(t),t.tag){case 1:return lr(t.type)&&Zl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ts(),He(ar),He(zt),C0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return E0(t),null;case 13:if(He(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He(Je),null;case 4:return Ts(),null;case 10:return x0(t.type._context),null;case 22:case 23:return M0(),null;case 24:return null;default:return null}}var il=!1,$t=!1,lT=typeof WeakSet=="function"?WeakSet:Set,se=null;function ls(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){at(e,t,o)}else n.current=null}function U1(e,t,n){try{n()}catch(o){at(e,t,o)}}var Up=!1;function cT(e,t){if(C1=Gl,e=vw(),f0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var c=o.anchorOffset,u=o.focusNode;o=o.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var h=0,x=-1,w=-1,m=0,C=0,b=e,A=null;t:for(;;){for(var T;b!==n||c!==0&&b.nodeType!==3||(x=h+c),b!==u||o!==0&&b.nodeType!==3||(w=h+o),b.nodeType===3&&(h+=b.nodeValue.length),(T=b.firstChild)!==null;)A=b,b=T;for(;;){if(b===e)break t;if(A===n&&++m===c&&(x=h),A===u&&++C===o&&(w=h),(T=b.nextSibling)!==null)break;b=A,A=b.parentNode}b=T}n=x===-1||w===-1?null:{start:x,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(b1={focusedElem:e,selectionRange:n},Gl=!1,se=t;se!==null;)if(t=se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,se=e;else for(;se!==null;){t=se;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var M=k.memoizedProps,X=k.memoizedState,N=t.stateNode,I=N.getSnapshotBeforeUpdate(t.elementType===t.type?M:Fr(t.type,M),X);N.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var O=t.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(B){at(t,t.return,B)}if(e=t.sibling,e!==null){e.return=t.return,se=e;break}se=t.return}return k=Up,Up=!1,k}function To(e,t,n){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&e)===e){var u=c.destroy;c.destroy=void 0,u!==void 0&&U1(t,n,u)}c=c.next}while(c!==o)}}function zc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var o=n.create;n.destroy=o()}n=n.next}while(n!==t)}}function j1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pv(e){var t=e.alternate;t!==null&&(e.alternate=null,pv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[nn],delete t[Xo],delete t[I1],delete t[H7],delete t[G7])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mv(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function W1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kl));else if(o!==4&&(e=e.child,e!==null))for(W1(e,t,n),e=e.sibling;e!==null;)W1(e,t,n),e=e.sibling}function $1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for($1(e,t,n),e=e.sibling;e!==null;)$1(e,t,n),e=e.sibling}var Dt=null,Ur=!1;function Ln(e,t,n){for(n=n.child;n!==null;)xv(e,t,n),n=n.sibling}function xv(e,t,n){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(Pc,n)}catch{}switch(n.tag){case 5:$t||ls(n,t);case 6:var o=Dt,c=Ur;Dt=null,Ln(e,t,n),Dt=o,Ur=c,Dt!==null&&(Ur?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Ur?(e=Dt,n=n.stateNode,e.nodeType===8?xf(e.parentNode,n):e.nodeType===1&&xf(e,n),$o(e)):xf(Dt,n.stateNode));break;case 4:o=Dt,c=Ur,Dt=n.stateNode.containerInfo,Ur=!0,Ln(e,t,n),Dt=o,Ur=c;break;case 0:case 11:case 14:case 15:if(!$t&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){c=o=o.next;do{var u=c,h=u.destroy;u=u.tag,h!==void 0&&(u&2||u&4)&&U1(n,t,h),c=c.next}while(c!==o)}Ln(e,t,n);break;case 1:if(!$t&&(ls(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(x){at(n,t,x)}Ln(e,t,n);break;case 21:Ln(e,t,n);break;case 22:n.mode&1?($t=(o=$t)||n.memoizedState!==null,Ln(e,t,n),$t=o):Ln(e,t,n);break;default:Ln(e,t,n)}}function Wp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lT),t.forEach(function(o){var c=wT.bind(null,e,o);n.has(o)||(n.add(o),o.then(c,c))})}}function Pr(e,t){var n=t.deletions;if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];try{var u=e,h=t,x=h;e:for(;x!==null;){switch(x.tag){case 5:Dt=x.stateNode,Ur=!1;break e;case 3:Dt=x.stateNode.containerInfo,Ur=!0;break e;case 4:Dt=x.stateNode.containerInfo,Ur=!0;break e}x=x.return}if(Dt===null)throw Error(Q(160));xv(u,h,c),Dt=null,Ur=!1;var w=c.alternate;w!==null&&(w.return=null),c.return=null}catch(m){at(c,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)wv(t,e),t=t.sibling}function wv(e,t){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pr(t,e),tn(e),o&4){try{To(3,e,e.return),zc(3,e)}catch(M){at(e,e.return,M)}try{To(5,e,e.return)}catch(M){at(e,e.return,M)}}break;case 1:Pr(t,e),tn(e),o&512&&n!==null&&ls(n,n.return);break;case 5:if(Pr(t,e),tn(e),o&512&&n!==null&&ls(n,n.return),e.flags&32){var c=e.stateNode;try{Fo(c,"")}catch(M){at(e,e.return,M)}}if(o&4&&(c=e.stateNode,c!=null)){var u=e.memoizedProps,h=n!==null?n.memoizedProps:u,x=e.type,w=e.updateQueue;if(e.updateQueue=null,w!==null)try{x==="input"&&u.type==="radio"&&u.name!=null&&jx(c,u),d1(x,h);var m=d1(x,u);for(h=0;h<w.length;h+=2){var C=w[h],b=w[h+1];C==="style"?Hx(c,b):C==="dangerouslySetInnerHTML"?zx(c,b):C==="children"?Fo(c,b):qd(c,C,b,m)}switch(x){case"input":a1(c,u);break;case"textarea":Wx(c,u);break;case"select":var A=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var T=u.value;T!=null?hs(c,!!u.multiple,T,!1):A!==!!u.multiple&&(u.defaultValue!=null?hs(c,!!u.multiple,u.defaultValue,!0):hs(c,!!u.multiple,u.multiple?[]:"",!1))}c[Xo]=u}catch(M){at(e,e.return,M)}}break;case 6:if(Pr(t,e),tn(e),o&4){if(e.stateNode===null)throw Error(Q(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(M){at(e,e.return,M)}}break;case 3:if(Pr(t,e),tn(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{$o(t.containerInfo)}catch(M){at(e,e.return,M)}break;case 4:Pr(t,e),tn(e);break;case 13:Pr(t,e),tn(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(N0=ut())),o&4&&Wp(e);break;case 22:if(C=n!==null&&n.memoizedState!==null,e.mode&1?($t=(m=$t)||C,Pr(t,e),$t=m):Pr(t,e),tn(e),o&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!C&&e.mode&1)for(se=e,C=e.child;C!==null;){for(b=se=C;se!==null;){switch(A=se,T=A.child,A.tag){case 0:case 11:case 14:case 15:To(4,A,A.return);break;case 1:ls(A,A.return);var k=A.stateNode;if(typeof k.componentWillUnmount=="function"){o=A,n=A.return;try{t=o,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(M){at(o,n,M)}}break;case 5:ls(A,A.return);break;case 22:if(A.memoizedState!==null){zp(b);continue}}T!==null?(T.return=A,se=T):zp(b)}C=C.sibling}e:for(C=null,b=e;;){if(b.tag===5){if(C===null){C=b;try{c=b.stateNode,m?(u=c.style,typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"):(x=b.stateNode,w=b.memoizedProps.style,h=w!=null&&w.hasOwnProperty("display")?w.display:null,x.style.display=Vx("display",h))}catch(M){at(e,e.return,M)}}}else if(b.tag===6){if(C===null)try{b.stateNode.nodeValue=m?"":b.memoizedProps}catch(M){at(e,e.return,M)}}else if((b.tag!==22&&b.tag!==23||b.memoizedState===null||b===e)&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===e)break e;for(;b.sibling===null;){if(b.return===null||b.return===e)break e;C===b&&(C=null),b=b.return}C===b&&(C=null),b.sibling.return=b.return,b=b.sibling}}break;case 19:Pr(t,e),tn(e),o&4&&Wp(e);break;case 21:break;default:Pr(t,e),tn(e)}}function tn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(mv(n)){var o=n;break e}n=n.return}throw Error(Q(160))}switch(o.tag){case 5:var c=o.stateNode;o.flags&32&&(Fo(c,""),o.flags&=-33);var u=jp(e);$1(e,u,c);break;case 3:case 4:var h=o.stateNode.containerInfo,x=jp(e);W1(e,x,h);break;default:throw Error(Q(161))}}catch(w){at(e,e.return,w)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function uT(e,t,n){se=e,vv(e)}function vv(e,t,n){for(var o=(e.mode&1)!==0;se!==null;){var c=se,u=c.child;if(c.tag===22&&o){var h=c.memoizedState!==null||il;if(!h){var x=c.alternate,w=x!==null&&x.memoizedState!==null||$t;x=il;var m=$t;if(il=h,($t=w)&&!m)for(se=c;se!==null;)h=se,w=h.child,h.tag===22&&h.memoizedState!==null?Vp(c):w!==null?(w.return=h,se=w):Vp(c);for(;u!==null;)se=u,vv(u),u=u.sibling;se=c,il=x,$t=m}$p(e)}else c.subtreeFlags&8772&&u!==null?(u.return=c,se=u):$p(e)}}function $p(e){for(;se!==null;){var t=se;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$t||zc(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!$t)if(n===null)o.componentDidMount();else{var c=t.elementType===t.type?n.memoizedProps:Fr(t.type,n.memoizedProps);o.componentDidUpdate(c,n.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var u=t.updateQueue;u!==null&&Ip(t,u,o);break;case 3:var h=t.updateQueue;if(h!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Ip(t,h,n)}break;case 5:var x=t.stateNode;if(n===null&&t.flags&4){n=x;var w=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":w.autoFocus&&n.focus();break;case"img":w.src&&(n.src=w.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var C=m.memoizedState;if(C!==null){var b=C.dehydrated;b!==null&&$o(b)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}$t||t.flags&512&&j1(t)}catch(A){at(t,t.return,A)}}if(t===e){se=null;break}if(n=t.sibling,n!==null){n.return=t.return,se=n;break}se=t.return}}function zp(e){for(;se!==null;){var t=se;if(t===e){se=null;break}var n=t.sibling;if(n!==null){n.return=t.return,se=n;break}se=t.return}}function Vp(e){for(;se!==null;){var t=se;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{zc(4,t)}catch(w){at(t,n,w)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var c=t.return;try{o.componentDidMount()}catch(w){at(t,c,w)}}var u=t.return;try{j1(t)}catch(w){at(t,u,w)}break;case 5:var h=t.return;try{j1(t)}catch(w){at(t,h,w)}}}catch(w){at(t,t.return,w)}if(t===e){se=null;break}var x=t.sibling;if(x!==null){x.return=t.return,se=x;break}se=t.return}}var fT=Math.ceil,oc=Tn.ReactCurrentDispatcher,_0=Tn.ReactCurrentOwner,_r=Tn.ReactCurrentBatchConfig,Oe=0,Tt=null,pt=null,Lt=0,hr=0,cs=ii(0),Et=0,Jo=null,Oi=0,Vc=0,O0=0,Ro=null,sr=null,N0=0,_s=1/0,hn=null,ac=!1,z1=null,Zn=null,sl=!1,Vn=null,lc=0,_o=0,V1=null,Rl=-1,_l=0;function Xt(){return Oe&6?ut():Rl!==-1?Rl:Rl=ut()}function Qn(e){return e.mode&1?Oe&2&&Lt!==0?Lt&-Lt:Y7.transition!==null?(_l===0&&(_l=nw()),_l):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:uw(e.type)),e):1}function zr(e,t,n,o){if(50<_o)throw _o=0,V1=null,Error(Q(185));fa(e,n,o),(!(Oe&2)||e!==Tt)&&(e===Tt&&(!(Oe&2)&&(Vc|=n),Et===4&&jn(e,Lt)),cr(e,o),n===1&&Oe===0&&!(t.mode&1)&&(_s=ut()+500,jc&&si()))}function cr(e,t){var n=e.callbackNode;Y5(e,t);var o=Hl(e,e===Tt?Lt:0);if(o===0)n!==null&&Jg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(n!=null&&Jg(n),t===1)e.tag===0?X7(Hp.bind(null,e)):_w(Hp.bind(null,e)),z7(function(){!(Oe&6)&&si()}),n=null;else{switch(iw(o)){case 1:n=n0;break;case 4:n=tw;break;case 16:n=Vl;break;case 536870912:n=rw;break;default:n=Vl}n=Tv(n,yv.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function yv(e,t){if(Rl=-1,_l=0,Oe&6)throw Error(Q(327));var n=e.callbackNode;if(ws()&&e.callbackNode!==n)return null;var o=Hl(e,e===Tt?Lt:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=cc(e,o);else{t=o;var c=Oe;Oe|=2;var u=Cv();(Tt!==e||Lt!==t)&&(hn=null,_s=ut()+500,bi(e,t));do try{gT();break}catch(x){Ev(e,x)}while(!0);m0(),oc.current=u,Oe=c,pt!==null?t=0:(Tt=null,Lt=0,t=Et)}if(t!==0){if(t===2&&(c=x1(e),c!==0&&(o=c,t=H1(e,c))),t===1)throw n=Jo,bi(e,0),jn(e,o),cr(e,ut()),n;if(t===6)jn(e,o);else{if(c=e.current.alternate,!(o&30)&&!dT(c)&&(t=cc(e,o),t===2&&(u=x1(e),u!==0&&(o=u,t=H1(e,u))),t===1))throw n=Jo,bi(e,0),jn(e,o),cr(e,ut()),n;switch(e.finishedWork=c,e.finishedLanes=o,t){case 0:case 1:throw Error(Q(345));case 2:mi(e,sr,hn);break;case 3:if(jn(e,o),(o&130023424)===o&&(t=N0+500-ut(),10<t)){if(Hl(e,0)!==0)break;if(c=e.suspendedLanes,(c&o)!==o){Xt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=S1(mi.bind(null,e,sr,hn),t);break}mi(e,sr,hn);break;case 4:if(jn(e,o),(o&4194240)===o)break;for(t=e.eventTimes,c=-1;0<o;){var h=31-$r(o);u=1<<h,h=t[h],h>c&&(c=h),o&=~u}if(o=c,o=ut()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*fT(o/1960))-o,10<o){e.timeoutHandle=S1(mi.bind(null,e,sr,hn),o);break}mi(e,sr,hn);break;case 5:mi(e,sr,hn);break;default:throw Error(Q(329))}}}return cr(e,ut()),e.callbackNode===n?yv.bind(null,e):null}function H1(e,t){var n=Ro;return e.current.memoizedState.isDehydrated&&(bi(e,t).flags|=256),e=cc(e,t),e!==2&&(t=sr,sr=n,t!==null&&G1(t)),e}function G1(e){sr===null?sr=e:sr.push.apply(sr,e)}function dT(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var o=0;o<n.length;o++){var c=n[o],u=c.getSnapshot;c=c.value;try{if(!Vr(u(),c))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function jn(e,t){for(t&=~O0,t&=~Vc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-$r(t),o=1<<n;e[n]=-1,t&=~o}}function Hp(e){if(Oe&6)throw Error(Q(327));ws();var t=Hl(e,0);if(!(t&1))return cr(e,ut()),null;var n=cc(e,t);if(e.tag!==0&&n===2){var o=x1(e);o!==0&&(t=o,n=H1(e,o))}if(n===1)throw n=Jo,bi(e,0),jn(e,t),cr(e,ut()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,mi(e,sr,hn),cr(e,ut()),null}function k0(e,t){var n=Oe;Oe|=1;try{return e(t)}finally{Oe=n,Oe===0&&(_s=ut()+500,jc&&si())}}function Ni(e){Vn!==null&&Vn.tag===0&&!(Oe&6)&&ws();var t=Oe;Oe|=1;var n=_r.transition,o=Pe;try{if(_r.transition=null,Pe=1,e)return e()}finally{Pe=o,_r.transition=n,Oe=t,!(Oe&6)&&si()}}function M0(){hr=cs.current,He(cs)}function bi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,$7(n)),pt!==null)for(n=pt.return;n!==null;){var o=n;switch(h0(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&Zl();break;case 3:Ts(),He(ar),He(zt),C0();break;case 5:E0(o);break;case 4:Ts();break;case 13:He(Je);break;case 19:He(Je);break;case 10:x0(o.type._context);break;case 22:case 23:M0()}n=n.return}if(Tt=e,pt=e=qn(e.current,null),Lt=hr=t,Et=0,Jo=null,O0=Vc=Oi=0,sr=Ro=null,vi!==null){for(t=0;t<vi.length;t++)if(n=vi[t],o=n.interleaved,o!==null){n.interleaved=null;var c=o.next,u=n.pending;if(u!==null){var h=u.next;u.next=c,o.next=h}n.pending=o}vi=null}return e}function Ev(e,t){do{var n=pt;try{if(m0(),Sl.current=sc,ic){for(var o=et.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}ic=!1}if(_i=0,It=yt=et=null,Io=!1,Zo=0,_0.current=null,n===null||n.return===null){Et=1,Jo=t,pt=null;break}e:{var u=e,h=n.return,x=n,w=t;if(t=Lt,x.flags|=32768,w!==null&&typeof w=="object"&&typeof w.then=="function"){var m=w,C=x,b=C.tag;if(!(C.mode&1)&&(b===0||b===11||b===15)){var A=C.alternate;A?(C.updateQueue=A.updateQueue,C.memoizedState=A.memoizedState,C.lanes=A.lanes):(C.updateQueue=null,C.memoizedState=null)}var T=kp(h);if(T!==null){T.flags&=-257,Mp(T,h,x,u,t),T.mode&1&&Np(u,m,t),t=T,w=m;var k=t.updateQueue;if(k===null){var M=new Set;M.add(w),t.updateQueue=M}else k.add(w);break e}else{if(!(t&1)){Np(u,m,t),D0();break e}w=Error(Q(426))}}else if(Ke&&x.mode&1){var X=kp(h);if(X!==null){!(X.flags&65536)&&(X.flags|=256),Mp(X,h,x,u,t),g0(Rs(w,x));break e}}u=w=Rs(w,x),Et!==4&&(Et=2),Ro===null?Ro=[u]:Ro.push(u),u=h;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var N=iv(u,w,t);Sp(u,N);break e;case 1:x=w;var I=u.type,O=u.stateNode;if(!(u.flags&128)&&(typeof I.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(Zn===null||!Zn.has(O)))){u.flags|=65536,t&=-t,u.lanes|=t;var B=sv(u,x,t);Sp(u,B);break e}}u=u.return}while(u!==null)}Av(n)}catch(j){t=j,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function Cv(){var e=oc.current;return oc.current=sc,e===null?sc:e}function D0(){(Et===0||Et===3||Et===2)&&(Et=4),Tt===null||!(Oi&268435455)&&!(Vc&268435455)||jn(Tt,Lt)}function cc(e,t){var n=Oe;Oe|=2;var o=Cv();(Tt!==e||Lt!==t)&&(hn=null,bi(e,t));do try{hT();break}catch(c){Ev(e,c)}while(!0);if(m0(),Oe=n,oc.current=o,pt!==null)throw Error(Q(261));return Tt=null,Lt=0,Et}function hT(){for(;pt!==null;)bv(pt)}function gT(){for(;pt!==null&&!U5();)bv(pt)}function bv(e){var t=Iv(e.alternate,e,hr);e.memoizedProps=e.pendingProps,t===null?Av(e):pt=t,_0.current=null}function Av(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=aT(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Et=6,pt=null;return}}else if(n=oT(n,t,hr),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);Et===0&&(Et=5)}function mi(e,t,n){var o=Pe,c=_r.transition;try{_r.transition=null,Pe=1,pT(e,t,n,o)}finally{_r.transition=c,Pe=o}return null}function pT(e,t,n,o){do ws();while(Vn!==null);if(Oe&6)throw Error(Q(327));n=e.finishedWork;var c=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var u=n.lanes|n.childLanes;if(K5(e,u),e===Tt&&(pt=Tt=null,Lt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sl||(sl=!0,Tv(Vl,function(){return ws(),null})),u=(n.flags&15990)!==0,n.subtreeFlags&15990||u){u=_r.transition,_r.transition=null;var h=Pe;Pe=1;var x=Oe;Oe|=4,_0.current=null,cT(e,n),wv(n,e),P7(b1),Gl=!!C1,b1=C1=null,e.current=n,uT(n),j5(),Oe=x,Pe=h,_r.transition=u}else e.current=n;if(sl&&(sl=!1,Vn=e,lc=c),u=e.pendingLanes,u===0&&(Zn=null),z5(n.stateNode),cr(e,ut()),t!==null)for(o=e.onRecoverableError,n=0;n<t.length;n++)c=t[n],o(c.value,{componentStack:c.stack,digest:c.digest});if(ac)throw ac=!1,e=z1,z1=null,e;return lc&1&&e.tag!==0&&ws(),u=e.pendingLanes,u&1?e===V1?_o++:(_o=0,V1=e):_o=0,si(),null}function ws(){if(Vn!==null){var e=iw(lc),t=_r.transition,n=Pe;try{if(_r.transition=null,Pe=16>e?16:e,Vn===null)var o=!1;else{if(e=Vn,Vn=null,lc=0,Oe&6)throw Error(Q(331));var c=Oe;for(Oe|=4,se=e.current;se!==null;){var u=se,h=u.child;if(se.flags&16){var x=u.deletions;if(x!==null){for(var w=0;w<x.length;w++){var m=x[w];for(se=m;se!==null;){var C=se;switch(C.tag){case 0:case 11:case 15:To(8,C,u)}var b=C.child;if(b!==null)b.return=C,se=b;else for(;se!==null;){C=se;var A=C.sibling,T=C.return;if(pv(C),C===m){se=null;break}if(A!==null){A.return=T,se=A;break}se=T}}}var k=u.alternate;if(k!==null){var M=k.child;if(M!==null){k.child=null;do{var X=M.sibling;M.sibling=null,M=X}while(M!==null)}}se=u}}if(u.subtreeFlags&2064&&h!==null)h.return=u,se=h;else e:for(;se!==null;){if(u=se,u.flags&2048)switch(u.tag){case 0:case 11:case 15:To(9,u,u.return)}var N=u.sibling;if(N!==null){N.return=u.return,se=N;break e}se=u.return}}var I=e.current;for(se=I;se!==null;){h=se;var O=h.child;if(h.subtreeFlags&2064&&O!==null)O.return=h,se=O;else e:for(h=I;se!==null;){if(x=se,x.flags&2048)try{switch(x.tag){case 0:case 11:case 15:zc(9,x)}}catch(j){at(x,x.return,j)}if(x===h){se=null;break e}var B=x.sibling;if(B!==null){B.return=x.return,se=B;break e}se=x.return}}if(Oe=c,si(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(Pc,e)}catch{}o=!0}return o}finally{Pe=n,_r.transition=t}}return!1}function Gp(e,t,n){t=Rs(n,t),t=iv(e,t,1),e=Kn(e,t,1),t=Xt(),e!==null&&(fa(e,1,t),cr(e,t))}function at(e,t,n){if(e.tag===3)Gp(e,e,n);else for(;t!==null;){if(t.tag===3){Gp(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Zn===null||!Zn.has(o))){e=Rs(n,e),e=sv(t,e,1),t=Kn(t,e,1),e=Xt(),t!==null&&(fa(t,1,e),cr(t,e));break}}t=t.return}}function mT(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),t=Xt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(Lt&n)===n&&(Et===4||Et===3&&(Lt&130023424)===Lt&&500>ut()-N0?bi(e,0):O0|=n),cr(e,t)}function Sv(e,t){t===0&&(e.mode&1?(t=Ka,Ka<<=1,!(Ka&130023424)&&(Ka=4194304)):t=1);var n=Xt();e=bn(e,t),e!==null&&(fa(e,t,n),cr(e,n))}function xT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sv(e,n)}function wT(e,t){var n=0;switch(e.tag){case 13:var o=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(Q(314))}o!==null&&o.delete(t),Sv(e,n)}var Iv;Iv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ar.current)or=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return or=!1,sT(e,t,n);or=!!(e.flags&131072)}else or=!1,Ke&&t.flags&1048576&&Ow(t,Jl,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;Tl(e,t),e=t.pendingProps;var c=As(t,zt.current);xs(t,n),c=A0(null,t,o,e,c,n);var u=S0();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,lr(o)?(u=!0,Ql(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,v0(t),c.updater=$c,t.stateNode=c,c._reactInternals=t,k1(t,o,e,n),t=P1(null,t,o,!0,u,n)):(t.tag=0,Ke&&u&&d0(t),Gt(null,t,c,n),t=t.child),t;case 16:o=t.elementType;e:{switch(Tl(e,t),e=t.pendingProps,c=o._init,o=c(o._payload),t.type=o,c=t.tag=yT(o),e=Fr(o,e),c){case 0:t=D1(null,t,o,e,n);break e;case 1:t=Lp(null,t,o,e,n);break e;case 11:t=Dp(null,t,o,e,n);break e;case 14:t=Pp(null,t,o,Fr(o.type,e),n);break e}throw Error(Q(306,o,""))}return t;case 0:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),D1(e,t,o,c,n);case 1:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Lp(e,t,o,c,n);case 3:e:{if(cv(t),e===null)throw Error(Q(387));o=t.pendingProps,u=t.memoizedState,c=u.element,Lw(e,t),rc(t,o,null,n);var h=t.memoizedState;if(o=h.element,u.isDehydrated)if(u={element:o,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){c=Rs(Error(Q(423)),t),t=Bp(e,t,o,n,c);break e}else if(o!==c){c=Rs(Error(Q(424)),t),t=Bp(e,t,o,n,c);break e}else for(gr=Yn(t.stateNode.containerInfo.firstChild),pr=t,Ke=!0,Wr=null,n=Dw(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ss(),o===c){t=An(e,t,n);break e}Gt(e,t,o,n)}t=t.child}return t;case 5:return Bw(t),e===null&&_1(t),o=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,h=c.children,A1(o,c)?h=null:u!==null&&A1(o,u)&&(t.flags|=32),lv(e,t),Gt(e,t,h,n),t.child;case 6:return e===null&&_1(t),null;case 13:return uv(e,t,n);case 4:return y0(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Is(t,null,o,n):Gt(e,t,o,n),t.child;case 11:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Dp(e,t,o,c,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,c=t.pendingProps,u=t.memoizedProps,h=c.value,$e(ec,o._currentValue),o._currentValue=h,u!==null)if(Vr(u.value,h)){if(u.children===c.children&&!ar.current){t=An(e,t,n);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var x=u.dependencies;if(x!==null){h=u.child;for(var w=x.firstContext;w!==null;){if(w.context===o){if(u.tag===1){w=wn(-1,n&-n),w.tag=2;var m=u.updateQueue;if(m!==null){m=m.shared;var C=m.pending;C===null?w.next=w:(w.next=C.next,C.next=w),m.pending=w}}u.lanes|=n,w=u.alternate,w!==null&&(w.lanes|=n),O1(u.return,n,t),x.lanes|=n;break}w=w.next}}else if(u.tag===10)h=u.type===t.type?null:u.child;else if(u.tag===18){if(h=u.return,h===null)throw Error(Q(341));h.lanes|=n,x=h.alternate,x!==null&&(x.lanes|=n),O1(h,n,t),h=u.sibling}else h=u.child;if(h!==null)h.return=u;else for(h=u;h!==null;){if(h===t){h=null;break}if(u=h.sibling,u!==null){u.return=h.return,h=u;break}h=h.return}u=h}Gt(e,t,c.children,n),t=t.child}return t;case 9:return c=t.type,o=t.pendingProps.children,xs(t,n),c=Or(c),o=o(c),t.flags|=1,Gt(e,t,o,n),t.child;case 14:return o=t.type,c=Fr(o,t.pendingProps),c=Fr(o.type,c),Pp(e,t,o,c,n);case 15:return ov(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Fr(o,c),Tl(e,t),t.tag=1,lr(o)?(e=!0,Ql(t)):e=!1,xs(t,n),nv(t,o,c),k1(t,o,c,n),P1(null,t,o,!0,e,n);case 19:return fv(e,t,n);case 22:return av(e,t,n)}throw Error(Q(156,t.tag))};function Tv(e,t){return ew(e,t)}function vT(e,t,n,o){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rr(e,t,n,o){return new vT(e,t,n,o)}function P0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yT(e){if(typeof e=="function")return P0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===e0)return 11;if(e===t0)return 14}return 2}function qn(e,t){var n=e.alternate;return n===null?(n=Rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ol(e,t,n,o,c,u){var h=2;if(o=e,typeof e=="function")P0(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case Ji:return Ai(n.children,c,u,t);case Jd:h=8,c|=8;break;case r1:return e=Rr(12,n,t,c|2),e.elementType=r1,e.lanes=u,e;case n1:return e=Rr(13,n,t,c),e.elementType=n1,e.lanes=u,e;case i1:return e=Rr(19,n,t,c),e.elementType=i1,e.lanes=u,e;case Bx:return Hc(n,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Px:h=10;break e;case Lx:h=9;break e;case e0:h=11;break e;case t0:h=14;break e;case Bn:h=16,o=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Rr(h,n,t,c),t.elementType=e,t.type=o,t.lanes=u,t}function Ai(e,t,n,o){return e=Rr(7,e,o,t),e.lanes=n,e}function Hc(e,t,n,o){return e=Rr(22,e,o,t),e.elementType=Bx,e.lanes=n,e.stateNode={isHidden:!1},e}function Sf(e,t,n){return e=Rr(6,e,null,t),e.lanes=n,e}function If(e,t,n){return t=Rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ET(e,t,n,o,c){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=of(0),this.expirationTimes=of(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=of(0),this.identifierPrefix=o,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function L0(e,t,n,o,c,u,h,x,w){return e=new ET(e,t,n,x,w),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Rr(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},v0(u),e}function CT(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qi,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}function Rv(e){if(!e)return ei;e=e._reactInternals;e:{if(Pi(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(lr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(lr(n))return Rw(e,n,t)}return t}function _v(e,t,n,o,c,u,h,x,w){return e=L0(n,o,!0,e,c,u,h,x,w),e.context=Rv(null),n=e.current,o=Xt(),c=Qn(n),u=wn(o,c),u.callback=t??null,Kn(n,u,c),e.current.lanes=c,fa(e,c,o),cr(e,o),e}function Gc(e,t,n,o){var c=t.current,u=Xt(),h=Qn(c);return n=Rv(n),t.context===null?t.context=n:t.pendingContext=n,t=wn(u,h),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=Kn(c,t,h),e!==null&&(zr(e,c,h,u),Al(e,c,h)),h}function uc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Xp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function B0(e,t){Xp(e,t),(e=e.alternate)&&Xp(e,t)}function bT(){return null}var Ov=typeof reportError=="function"?reportError:function(e){console.error(e)};function F0(e){this._internalRoot=e}Xc.prototype.render=F0.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Gc(e,t,null,null)};Xc.prototype.unmount=F0.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ni(function(){Gc(null,e,null,null)}),t[Cn]=null}};function Xc(e){this._internalRoot=e}Xc.prototype.unstable_scheduleHydration=function(e){if(e){var t=aw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Un.length&&t!==0&&t<Un[n].priority;n++);Un.splice(n,0,e),n===0&&cw(e)}};function U0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Yc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yp(){}function AT(e,t,n,o,c){if(c){if(typeof o=="function"){var u=o;o=function(){var m=uc(h);u.call(m)}}var h=_v(t,o,e,0,null,!1,!1,"",Yp);return e._reactRootContainer=h,e[Cn]=h.current,Ho(e.nodeType===8?e.parentNode:e),Ni(),h}for(;c=e.lastChild;)e.removeChild(c);if(typeof o=="function"){var x=o;o=function(){var m=uc(w);x.call(m)}}var w=L0(e,0,!1,null,null,!1,!1,"",Yp);return e._reactRootContainer=w,e[Cn]=w.current,Ho(e.nodeType===8?e.parentNode:e),Ni(function(){Gc(t,w,n,o)}),w}function Kc(e,t,n,o,c){var u=n._reactRootContainer;if(u){var h=u;if(typeof c=="function"){var x=c;c=function(){var w=uc(h);x.call(w)}}Gc(t,h,e,c)}else h=AT(n,t,e,c,o);return uc(h)}sw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=po(t.pendingLanes);n!==0&&(i0(t,n|1),cr(t,ut()),!(Oe&6)&&(_s=ut()+500,si()))}break;case 13:Ni(function(){var o=bn(e,1);if(o!==null){var c=Xt();zr(o,e,1,c)}}),B0(e,1)}};s0=function(e){if(e.tag===13){var t=bn(e,134217728);if(t!==null){var n=Xt();zr(t,e,134217728,n)}B0(e,134217728)}};ow=function(e){if(e.tag===13){var t=Qn(e),n=bn(e,t);if(n!==null){var o=Xt();zr(n,e,t,o)}B0(e,t)}};aw=function(){return Pe};lw=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}};g1=function(e,t,n){switch(t){case"input":if(a1(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var c=Uc(o);if(!c)throw Error(Q(90));Ux(o),a1(o,c)}}}break;case"textarea":Wx(e,n);break;case"select":t=n.value,t!=null&&hs(e,!!n.multiple,t,!1)}};Yx=k0;Kx=Ni;var ST={usingClientEntryPoint:!1,Events:[ha,ns,Uc,Gx,Xx,k0]},lo={findFiberByHostInstance:wi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},IT={bundleType:lo.bundleType,version:lo.version,rendererPackageName:lo.rendererPackageName,rendererConfig:lo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Tn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=qx(e),e===null?null:e.stateNode},findFiberByHostInstance:lo.findFiberByHostInstance||bT,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ol.isDisabled&&ol.supportsFiber)try{Pc=ol.inject(IT),sn=ol}catch{}}vr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ST;vr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!U0(t))throw Error(Q(200));return CT(e,t,null,n)};vr.createRoot=function(e,t){if(!U0(e))throw Error(Q(299));var n=!1,o="",c=Ov;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=L0(e,1,!1,null,null,n,!1,o,c),e[Cn]=t.current,Ho(e.nodeType===8?e.parentNode:e),new F0(t)};vr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=qx(t),e=e===null?null:e.stateNode,e};vr.flushSync=function(e){return Ni(e)};vr.hydrate=function(e,t,n){if(!Yc(t))throw Error(Q(200));return Kc(null,e,t,!0,n)};vr.hydrateRoot=function(e,t,n){if(!U0(e))throw Error(Q(405));var o=n!=null&&n.hydratedSources||null,c=!1,u="",h=Ov;if(n!=null&&(n.unstable_strictMode===!0&&(c=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onRecoverableError!==void 0&&(h=n.onRecoverableError)),t=_v(t,null,e,1,n??null,c,!1,u,h),e[Cn]=t.current,Ho(e),o)for(e=0;e<o.length;e++)n=o[e],c=n._getVersion,c=c(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,c]:t.mutableSourceEagerHydrationData.push(n,c);return new Xc(t)};vr.render=function(e,t,n){if(!Yc(t))throw Error(Q(200));return Kc(null,e,t,!1,n)};vr.unmountComponentAtNode=function(e){if(!Yc(e))throw Error(Q(40));return e._reactRootContainer?(Ni(function(){Kc(null,null,e,!1,function(){e._reactRootContainer=null,e[Cn]=null})}),!0):!1};vr.unstable_batchedUpdates=k0;vr.unstable_renderSubtreeIntoContainer=function(e,t,n,o){if(!Yc(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Kc(e,t,n,!1,o)};vr.version="18.3.1-next-f1338f8080-20240426";function Nv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Nv)}catch(e){console.error(e)}}Nv(),Nx.exports=vr;var fc=Nx.exports;function TT({message:e,showGuidance:t,windows:n,onClose:o}){const c=ce.useRef(null);return ce.useEffect(()=>{var u;(u=c.current)==null||u.showModal()},[]),fc.createPortal(L.jsx("dialog",{ref:c,"aria-label":"远程桌面提醒",onCancel:o,onClick:u=>{u.target===u.currentTarget&&o()},style:{margin:"auto",inset:0,width:"min(370px, calc(100vw - 32px))",maxHeight:"calc(100dvh - 32px)",overflowY:"auto",padding:0,borderRadius:12,border:"1px solid var(--border-default)",background:"var(--bg-surface, white)",color:"var(--text-primary)",fontSize:14,lineHeight:1.7},children:L.jsxs("div",{style:{padding:20},children:[L.jsx("strong",{children:"远程桌面提醒"}),L.jsx("p",{children:e}),t&&L.jsxs(L.Fragment,{children:[L.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),L.jsx("p",{children:n?"在 Windows 电脑上点击“开启共享”,并保持用户已登录、桌面未锁定。完成后此处会自动更新。":"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),L.jsx("button",{type:"button",className:"ui-quiet-button",onClick:o,autoFocus:!0,children:"知道了"})]})}),document.body)}function RT(){const[e,t]=ce.useState(null),[n,o]=ce.useState(!1),[c,u]=ce.useState(!1),[h,x]=ce.useState(""),w=["127.0.0.1","localhost","[::1]"].includes(location.hostname),m=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);ce.useEffect(()=>{let A=!0;const T=async()=>{try{const M=await fetch(m&&w?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!M.ok)return;const X=await M.json();A&&t(X)}catch{}};T();const k=setInterval(T,2e3);return()=>{A=!1,clearInterval(k)}},[m,w]);const C=(e==null?void 0:e.platform)==="win32";if(!m){if(!e||e.online&&e.accessibility)return null;const A=e.supported?e.installed?e.enabled?C&&e.locked&&e.unlock==="available"?"Windows 已锁屏。打开「远程桌面」并选择本机桌面,即可唤醒屏幕或输入密码/PIN 解锁。":C&&e.locked?"Windows 已锁屏,但远程解锁服务尚未安装。请在电脑上运行 agentroam unlock-service install。":e.locked?"macOS 已锁屏。打开「远程桌面」并选择本机桌面会自动唤醒屏幕,随后可在锁屏画面输入密码。":!e.screen||!e.accessibility?C?"Windows 桌面暂不可用,请检查 UAC 提示或登录状态。":"电脑的远程桌面授权尚未完成。":"电脑桌面正在连接,请稍候。":"电脑尚未开启桌面共享,请在电脑上完成授权并开启共享。":"电脑缺少远程桌面组件,请在电脑上升级 CLI。":"这台电脑暂不支持远程桌面。";return L.jsxs("div",{className:"remote-desktop-guidance",children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"查看远程桌面提醒","aria-haspopup":"dialog","aria-expanded":n,onClick:()=>o(!0),style:{color:"var(--warning, #d97706)",minWidth:44,minHeight:44},children:L.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[L.jsx("circle",{cx:"12",cy:"12",r:"9"}),L.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),n&&L.jsx(TT,{windows:C,message:A,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>o(!1)})]})}if(!w)return L.jsxs("div",{style:{position:"relative",marginLeft:12},children:[L.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:L.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),L.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&L.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[L.jsx("strong",{children:"远程授权"}),L.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开终端显示的本机地址,完成配对并开启桌面共享。"}),L.jsxs("p",{children:["在电脑终端运行 ",L.jsx("code",{children:"agentroam service status"})," 查看本机地址。"]}),L.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const b=async(A,T)=>{u(!0),x("");try{const k=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:A,permission:T})}),M=await k.json();if(!k.ok)throw new Error(M.error||"操作失败");t(M)}catch(k){x(k instanceof Error?k.message:"操作失败")}finally{u(!1)}};return L.jsxs("div",{style:{position:"relative",marginLeft:12},children:[L.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:L.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),L.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&L.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",color:"var(--text-primary)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[L.jsx("strong",{children:"远程授权"}),L.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:C?"开启后,已配对设备可查看桌面;接管后可使用鼠标和键盘。":"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.component&&L.jsxs("div",{"aria-label":"远控组件信息",style:{fontSize:12,lineHeight:1.6,overflowWrap:"anywhere"},children:[L.jsxs("div",{children:["组件版本:",e.component.version==="legacy"?`旧版(${e.component.fingerprint??"未记录版本"})`:e.component.version]}),L.jsxs("div",{children:[C?"组件位置":"授权应用位置",":",L.jsx("code",{children:e.component.path})]}),e.component.installed===!1&&L.jsx("p",{children:"点击“重新检测”后会安装到此位置。"}),e.component.updatePending&&L.jsx("p",{role:"status",children:"旧版组件仍在使用。结束其他 AgentRoam 的桌面共享后,点击“重新检测”更新。"})]}),e.supported?e.installed?L.jsxs(L.Fragment,{children:[!C&&["screen","accessibility"].map(A=>L.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[L.jsxs("span",{children:[A==="screen"?"屏幕录制":"辅助功能",":",e[A]?"已授权":"待授权"]}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("authorize",A),children:"去授权"})]},A)),L.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("recheck"),children:"重新检测"}),L.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void b("restart"),children:"重启授权组件"})]}),C&&L.jsxs("p",{style:{fontSize:12,lineHeight:1.6},children:["远程解锁服务:",e.unlock==="available"?"已安装,可在锁屏后远程唤醒和解锁。":"未安装;在 Windows 终端运行 agentroam unlock-service install 后可启用。"]}),L.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待桌面可用或首帧画面…":"尚未开启共享。"}),L.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:C?"Windows 锁屏后直播入口会保留,可唤醒屏幕或远程解锁;UAC 安全桌面和未登录状态仍不支持控制。":"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):L.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):L.jsx("p",{children:"目前支持 Windows 10/11 x64 和 macOS 14 及以上的 Apple Silicon 电脑。"}),(h||e.error)&&L.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:h||e.error})]})]})}/**
58
58
  * @license lucide-react v0.468.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */const T9=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nv=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();/**
62
+ */const _T=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kv=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();/**
63
63
  * @license lucide-react v0.468.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */var R9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
67
+ */var OT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
68
68
  * @license lucide-react v0.468.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const _9=ce.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:g,...x},w)=>ce.createElement("svg",{ref:w,...R9,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Nv("lucide",c),...x},[...g.map(([m,C])=>ce.createElement(m,C)),...Array.isArray(u)?u:[u]]));/**
72
+ */const NT=ce.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:h,...x},w)=>ce.createElement("svg",{ref:w,...OT,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:kv("lucide",c),...x},[...h.map(([m,C])=>ce.createElement(m,C)),...Array.isArray(u)?u:[u]]));/**
73
73
  * @license lucide-react v0.468.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const Rt=(e,t)=>{const n=ce.forwardRef(({className:o,...c},u)=>ce.createElement(_9,{ref:u,iconNode:t,className:Nv(`lucide-${T9(e)}`,o),...c}));return n.displayName=`${e}`,n};/**
77
+ */const Rt=(e,t)=>{const n=ce.forwardRef(({className:o,...c},u)=>ce.createElement(NT,{ref:u,iconNode:t,className:kv(`lucide-${_T(e)}`,o),...c}));return n.displayName=`${e}`,n};/**
78
78
  * @license lucide-react v0.468.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const O9=Rt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
82
+ */const kT=Rt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
83
83
  * @license lucide-react v0.468.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
86
86
  * See the LICENSE file in the root directory of this source tree.
87
- */const N9=Rt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
87
+ */const MT=Rt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
88
88
  * @license lucide-react v0.468.0 - ISC
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const kv=Rt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
92
+ */const Mv=Rt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
93
93
  * @license lucide-react v0.468.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
97
- */const k9=Rt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
97
+ */const DT=Rt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
98
98
  * @license lucide-react v0.468.0 - ISC
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const M9=Rt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
102
+ */const PT=Rt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
103
103
  * @license lucide-react v0.468.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const D9=Rt("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
107
+ */const LT=Rt("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
108
108
  * @license lucide-react v0.468.0 - ISC
109
109
  *
110
110
  * This source code is licensed under the ISC license.
111
111
  * See the LICENSE file in the root directory of this source tree.
112
- */const P9=Rt("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
112
+ */const BT=Rt("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
113
113
  * @license lucide-react v0.468.0 - ISC
114
114
  *
115
115
  * This source code is licensed under the ISC license.
@@ -119,57 +119,57 @@ Error generating stack: `+u.message+`
119
119
  *
120
120
  * This source code is licensed under the ISC license.
121
121
  * See the LICENSE file in the root directory of this source tree.
122
- */const L9=Rt("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
122
+ */const FT=Rt("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
123
123
  * @license lucide-react v0.468.0 - ISC
124
124
  *
125
125
  * This source code is licensed under the ISC license.
126
126
  * See the LICENSE file in the root directory of this source tree.
127
- */const B9=Rt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
127
+ */const UT=Rt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
128
128
  * @license lucide-react v0.468.0 - ISC
129
129
  *
130
130
  * This source code is licensed under the ISC license.
131
131
  * See the LICENSE file in the root directory of this source tree.
132
- */const F9=Rt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
132
+ */const jT=Rt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
133
133
  * @license lucide-react v0.468.0 - ISC
134
134
  *
135
135
  * This source code is licensed under the ISC license.
136
136
  * See the LICENSE file in the root directory of this source tree.
137
- */const U9=Rt("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/**
137
+ */const WT=Rt("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/**
138
138
  * @license lucide-react v0.468.0 - ISC
139
139
  *
140
140
  * This source code is licensed under the ISC license.
141
141
  * See the LICENSE file in the root directory of this source tree.
142
- */const j9=Rt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
142
+ */const $T=Rt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
143
143
  * @license lucide-react v0.468.0 - ISC
144
144
  *
145
145
  * This source code is licensed under the ISC license.
146
146
  * See the LICENSE file in the root directory of this source tree.
147
- */const W9=Rt("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
147
+ */const zT=Rt("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
148
148
  * @license lucide-react v0.468.0 - ISC
149
149
  *
150
150
  * This source code is licensed under the ISC license.
151
151
  * See the LICENSE file in the root directory of this source tree.
152
- */const $9=Rt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
152
+ */const VT=Rt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
153
153
  * @license lucide-react v0.468.0 - ISC
154
154
  *
155
155
  * This source code is licensed under the ISC license.
156
156
  * See the LICENSE file in the root directory of this source tree.
157
- */const Mv=Rt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
157
+ */const Dv=Rt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
158
158
  * @license lucide-react v0.468.0 - ISC
159
159
  *
160
160
  * This source code is licensed under the ISC license.
161
161
  * See the LICENSE file in the root directory of this source tree.
162
- */const z9=Rt("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
162
+ */const HT=Rt("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
163
163
  * @license lucide-react v0.468.0 - ISC
164
164
  *
165
165
  * This source code is licensed under the ISC license.
166
166
  * See the LICENSE file in the root directory of this source tree.
167
- */const V9=Rt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function H9(){const[e,t]=ce.useState(!1);return null}var Dv,Zp=uc;Dv=Zp.createRoot,Zp.hydrateRoot;class Pv extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class G9 extends Error{constructor(t,n,o){super(n),this.status=t,this.code=o,this.name="ApiError"}}class Lv extends Error{constructor(){super("请求超时,请检查连接后重试"),this.name="RequestTimeoutError"}}class X9{constructor(t=(...o)=>fetch(...o),n=""){this.transport=t,this.baseUrl=n}setBaseUrl(t){this.baseUrl=t.replace(/\/+$/,"")}resolve(t){return this.baseUrl+t}async get(t,n){return this.request(t,{method:"GET",headers:n==null?void 0:n.headers},n==null?void 0:n.timeoutMs)}async post(t,n,o){return this.request(t,{method:"POST",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async patch(t,n,o){return this.request(t,{method:"PATCH",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async put(t,n,o){return this.request(t,{method:"PUT",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async delete(t,n){return this.request(t,{method:"DELETE",headers:n==null?void 0:n.headers},n==null?void 0:n.timeoutMs)}async request(t,n,o=3e4){const c=new AbortController;let u;const g=new Promise((x,w)=>{u=setTimeout(()=>{w(new Lv),c.abort()},o)});try{return await Promise.race([this.readResponse(t,{...n,signal:c.signal}),g])}finally{clearTimeout(u)}}async readResponse(t,n){var c;const o=await this.transport(this.resolve(t),{credentials:"same-origin",cache:"no-store",...n});if(o.status===401||o.status===423)throw window.dispatchEvent(new CustomEvent("webapp:unauthorized")),new Pv;if(!o.ok){let u=`请求失败 (${o.status})`,g;try{const x=await o.json();typeof x.error=="string"?u=x.error:(c=x.error)!=null&&c.message&&(u=x.error.message),typeof x.code=="string"&&(g=x.code)}catch{}throw new G9(o.status,u,g)}if(o.status!==204)return await o.json()}}const Y9=30,K9=20,Z9=2e3;function Qp(e){var t,n;if(e instanceof Error)return{name:e.name,message:e.message,stack:(t=e.stack)==null?void 0:t.slice(0,8e3)};if(typeof e=="string")return{name:"Error",message:e};try{return{name:"NonError",message:((n=JSON.stringify(e))==null?void 0:n.slice(0,2e3))??String(e)}}catch{return{name:"NonError",message:String(e)}}}function Q9(e={}){const t=e.source??"webapp",n=()=>((typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl)??"").replace(/\/+$/,""),o=[];let c=null,u=!1,g=!1;const x=()=>{if(g||u||o.length===0)return;const A=o.splice(0,K9);u=!0;const T=JSON.stringify({entries:A});fetch(`${n()}/api/client-logs`,{method:"POST",headers:{"content-type":"application/json"},body:T,keepalive:!0}).catch(()=>{}).finally(()=>{u=!1,o.length>0&&w()})},w=()=>{c!==null||g||(c=setTimeout(()=>{c=null,x()},Z9))},m=A=>{g||(o.length>=Y9&&o.shift(),o.push(A),w())},C=A=>{var T;m({level:"error",message:A.message||"window error",source:t,error:{name:"Error",message:A.message||"window error",stack:[A.filename?`${A.filename}:${A.lineno}:${A.colno}`:"",((T=A.error)==null?void 0:T.stack)??""].filter(Boolean).join(`
168
- `).slice(0,8e3)||void 0},data:{filename:A.filename,lineno:A.lineno,colno:A.colno}})},b=A=>{const T=Qp(A.reason);m({level:"error",message:`unhandledRejection: ${T.message}`,source:t,error:T})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",b),{reportError:(A,T)=>{const k=Qp(A);m({level:"error",message:k.message,source:t,error:k,data:T})},reportWarning:(A,T)=>{m({level:"warn",message:A,source:t,data:T})},uninstall:()=>{g=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",b)}}}const j0=["customer-agent","codex","claude-code","opencode","deepseek-harness","qoder","zcode","workbuddy","copilot"];j0.filter(e=>e!=="customer-agent");function Bv(e){return typeof e=="string"&&j0.some(t=>t===e)}function D_(e){return Bv(e)&&e!=="customer-agent"}const Tf="<think>",Rf="</think>";function qp(e,t){const n=Math.min(t.length-1,e.length);for(let o=n;o>0;o--)if(e.endsWith(t.slice(0,o)))return o;return 0}function co(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class q9{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(Rf);if(c===-1){const u=qp(this.buffer,Rf);return this.buffer=this.buffer.slice(this.buffer.length-u),n}this.buffer=this.buffer.slice(c+Rf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(Tf);if(o===-1){const c=qp(this.buffer,Tf);return n+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),n}n+=this.buffer.slice(0,o),this.buffer=this.buffer.slice(o+Tf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const J9=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,eT=50,tT=1e3,rT=2e3;function Jp(e){return e instanceof Lv||e instanceof Error&&e.name!=="AbortError"&&J9.test(e.message.trim())}class nT{constructor(t,n,o,c=x=>new EventSource(x),u,g={}){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,this.dictation=u,this.streams=new Map,this.nativeStreamCursors=new Map,this.nativeFinalAnswerSnapshots=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=new Map,this.ordinaryRunRecoveryTimers=new Map,this.ordinaryRunStreamText=new Map,this.nativeRunRecoveries=new Map,this.nativeRunIdentities=new Map,this.sessionHistoryObservationMode=g.historyObservation??"sse"}dictationStart(){var t;return((t=this.dictation)==null?void 0:t.dictationStart())??Promise.resolve({ok:!1,reason:"语音输入尚未初始化"})}dictationStop(){var t;return((t=this.dictation)==null?void 0:t.dictationStop())??Promise.resolve({ok:!0})}onDictation(t){var n;return((n=this.dictation)==null?void 0:n.onDictation(t))??(()=>{})}onDictationError(t){var n;return((n=this.dictation)==null?void 0:n.onDictationError(t))??(()=>{})}fileWorkspaceRequest(t,n={}){return t!=="fs:preview-open"&&t!=="fs:preview-close"?Promise.reject(new Error("消息区仅支持媒体预览操作")):this.requireProjectBridge().request(t,n)}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}async collaboration(t){return this.http.post("/api/collaboration",t)}async calendarOverview(t){const n=new URLSearchParams({from:t.from,to:t.to});return this.http.get(`/api/calendar?${n.toString()}`)}todoList(t={}){return this.http.get(`/api/todos?${new URLSearchParams(Object.entries(t).filter(([,n])=>n!==void 0).map(([n,o])=>[n,String(o)]))}`)}todoGet(t){return this.http.get(`/api/todos/${encodeURIComponent(t)}`)}todoCommand(t,n){return this.http.post(t.type==="create"?"/api/todos":`/api/todos/${encodeURIComponent(t.taskId)}/commands`,{command:t,requestId:n})}notificationList(){return this.http.get("/api/notifications")}notificationRead(t){return this.http.post(`/api/notifications/${encodeURIComponent(t)}/ack`,{read:!0})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,u,g){var T,k;const x=n.startsWith("runtime:"),w=this.streams.has(n),m=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);x&&!m&&this.beginNativeRunRecovery(n,void 0,!0);let b=null,A=null;try{x||await this.openStream(n,this.nativeStreamCursors.get(n)),A=m?null:new Promise(N=>{b=N,this.pendingRuns.set(n,N)}),x||this.ordinaryRunStreamText.set(n,"");const M={input:t,sessionId:n,...u!=null&&u.length?{images:u}:{},...o!=null&&o.length?{agentIds:o}:{},...!x&&(g!=null&&g.profileId)?{profileId:g.profileId}:{},...(T=g==null?void 0:g.model)!=null&&T.id?{nativeModel:g.model}:{},...g!=null&&g.reasoningEffort?{nativeReasoningEffort:g.reasoningEffort}:{}},G=x?await this.http.post("/api/agent/run",M,{timeoutMs:8e3}):await this.http.post("/api/agent/run",M);if(x||this.startOrdinaryRunRecovery(n),x){const N=this.nativeRunRecoveries.get(n);N&&(N.awaitingAdmission=!1,N.runId=typeof G.runId=="string"?G.runId:void 0);const I=typeof G.runId=="string"&&(C==null?void 0:C.runId)!==G.runId?{sequence:0,runId:G.runId}:C??{sequence:0,...typeof G.runId=="string"?{runId:G.runId}:{}};await this.openStream(n,I,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof G.runId=="string"?{_nativeRunId:G.runId}:{}}),A&&await A}catch(M){const G=!m&&x&&Jp(M)?await this.recoverNativeAdmission(n,C):null;if(G){const B=this.nativeRunRecoveries.get(n);return B&&(B.awaitingAdmission=!1,B.runId=G.runId),await this.openStream(n,G,{waitForOpen:!1}),A&&await A,[]}const N=M.code,I=typeof N=="string"?N:M.status===409?"SESSION_OCCUPIED":void 0;x&&I==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const O=w||m||I==="SESSION_ALREADY_RUNNING";if(x&&O){const B=this.nativeRunRecoveries.get(n);B&&(B.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:Jp(M)?"网络连接中断,消息未确认发送,请重试":M instanceof Error?M.message:"无法启动运行",...I?{code:I}:{},...O?{_preserveActiveRun:!0}:{}}),O?b&&this.pendingRuns.get(n)===b&&this.pendingRuns.delete(n):(this.closeStream(n),this.settle(n))}return[]}async recoverNativeAdmission(t,n){const o=this.nativeStreamCursors.get(t);if(o!=null&&o.runId&&o.runId!==(n==null?void 0:n.runId))return this.dispatchRecoveredAdmission(t,o),o;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1&view=core`,{timeoutMs:4e3}),u=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,g=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,x=!!(u&&(n!=null&&n.runId)&&u!==n.runId),w=!!(u&&!(n!=null&&n.runId)&&c.status==="running");return!x&&!w?null:(this.dispatchRecoveredAdmission(t,{runId:u,sequence:g}),{runId:u,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,n){this.dispatch(t,{type:"run_admitted",...n.runId?{_nativeRunId:n.runId}:{}})}async steer(t,n,o){return(await this.http.post("/api/agent/steer",{input:t,sessionId:n})).steered}async steerSessionMessage(t,n){const o=await this.http.post("/api/agent/steer",{sessionId:t,messageId:n});if(!o.steered)throw new Error("当前运行不支持插队消息");return o.state}async abort(t,n){var u,g,x,w;const o=t!=null&&t.startsWith("runtime:")?((u=this.nativeRunRecoveries.get(t))==null?void 0:u.runId)??((g=this.nativeStreamCursors.get(t))==null?void 0:g.runId):void 0,c=t?[t]:[...new Set([...this.pendingRuns.keys(),...this.streams.keys(),...this.nativeRunRecoveries.keys()])].filter(m=>!m.startsWith("runtime:"));await this.http.post("/api/agent/abort",{...t?{sessionId:t}:{},...o?{expectedRunId:o}:{},...n?{trigger:n}:{}});for(const m of c){const C=((x=this.nativeRunRecoveries.get(m))==null?void 0:x.runId)??((w=this.nativeStreamCursors.get(m))==null?void 0:w.runId);o&&C!==o||(this.settle(m),this.closeStream(m))}}async answerQuestion(t,n,o){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:n,selectedIndices:o}),!0}catch{return!1}}async listSessions(t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${n}`)}async listAgentWorkspaces(t,n={}){const o=new URLSearchParams({agentType:t});return n.cursor&&o.set("cursor",n.cursor),n.limit!==void 0&&o.set("limit",String(n.limit)),n.refresh&&o.set("refresh","1"),n.since&&o.set("since",n.since),this.http.get(`/api/agent-workspaces?${o.toString()}`)}async importAgentWorkspace(t,n,o){return this.http.post("/api/agent-workspaces",{agentType:t,path:n,...o?{name:o}:{}})}async removeInvalidAgentWorkspace(t,n){const o=new URLSearchParams({agentType:t,workspaceId:n});await this.http.delete(`/api/agent-workspaces?${o.toString()}`)}async listAgentWorkspaceSessions(t,n,o={}){const c=new URLSearchParams({agentType:t});return o.cursor&&c.set("cursor",o.cursor),o.limit!==void 0&&c.set("limit",String(o.limit)),o.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(n)}/sessions?${c.toString()}`)}async refreshSessions(t){const n=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${n}`)}async listChildSessions(t){return[]}async getSession(t,n,o={}){var g;const c=this.nativeRunRecoveries.get(t),u=c==null?void 0:c.runId;try{const x=new URLSearchParams;n!=null&&n.before&&x.set("before",n.before),n!=null&&n.after&&x.set("after",n.after),n!=null&&n.anchor&&x.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&x.set("limit",String(n.limit)),n!=null&&n.view&&x.set("view",n.view),n!=null&&n.revision&&x.set("revision",n.revision),n!=null&&n.turnId&&x.set("turnId",n.turnId);const w=x.size>0?`?${x.toString()}`:"",m=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${w}`);Array.isArray(m.messages)&&(m.messages=m.messages.map(A=>typeof A.content=="string"?{...A,content:co(A.content)}:A)),Array.isArray(m.events)&&(m.events=m.events.map(A=>typeof A.text=="string"&&A.text.includes("<think>")?{...A,text:co(A.text)}:typeof A.finalText=="string"&&A.finalText.includes("<think>")?{...A,finalText:co(A.finalText)}:A));const C=c===this.nativeRunRecoveries.get(t)&&u===(c==null?void 0:c.runId),b=!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace";if(t.startsWith("runtime:")&&C&&b&&typeof m.snapshotRevision=="number"){const A=typeof m.snapshotRunId=="string"?m.snapshotRunId:void 0;if(A&&((g=this.nativeRunIdentities.get(t))!=null&&g.retired.has(A)))return m;const T=m.history,k=(T==null?void 0:T.delivery)==="core"||(T==null?void 0:T.delivery)==="trace",M=this.snapshotRunMatchesHistoryTurn(m);if((T==null?void 0:T.delivery)==="core"&&!o.lifecycleOnly&&A&&M&&this.coreSnapshotContainsTailFinalAnswer(m.messages)&&this.rememberNativeFinalAnswerSnapshot(t,m.snapshotRevision,A),k||this.rememberNativeStreamCursor(t,m.snapshotRevision,A),m.status==="running"&&m.snapshotRunStatus!=="terminal"&&m.occupancy!=="owned-externally"&&(!k||M)){const G=this.nativeStreamCursors.get(t),N=k&&A&&(G==null?void 0:G.runId)!==A?{sequence:0,runId:A}:G??(k?{sequence:0,...A?{runId:A}:{}}:void 0);this.openStream(t,N).catch(()=>{})}c&&(M?await this.reconcileNativeRun(t,c,u,m):!c.awaitingAdmission&&m.snapshotRunStatus==="terminal"&&A===u&&(this.closeStream(t),this.settle(t)))}else if(!t.startsWith("runtime:")&&m.status==="active"){const A=m.activeRun;(A==null?void 0:A.running)===!0&&typeof A.eventId=="number"&&this.openStream(t,{sequence:A.eventId}).catch(()=>{})}return m}catch(x){if(x.status===404)return null;throw x}}async getSessionImage(t,n){return(await this.http.get(`/api/session-images/${encodeURIComponent(t)}?variant=${n}`)).dataUrl}async getSessionToolResult(t,n){const o=new URLSearchParams(n);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${o.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,n,o){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let u=!1;return c.onmessage=g=>{if(g.data)try{const x=JSON.parse(g.data);x.type==="session_history_changed"&&typeof x.revision=="number"&&n({type:x.type,revision:x.revision})}catch{}},c.onerror=()=>{u||(u=!0,c.close(),o==null||o())},()=>{u||(u=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:n})}async setSessionNativeMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{nativeMode:n})}async setSessionNativePermissionPreset(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{nativePermissionPreset:n})}async getSessionNativeGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/native-goal`)).goal}async listSessionBackgroundJobs(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/background-jobs`)).jobs}async getSessionBackgroundJobOutput(t,n){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/background-jobs/${encodeURIComponent(n)}`)}async stopSessionBackgroundJob(t,n){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/background-jobs/${encodeURIComponent(n)}/stop`,{})}async mutateSessionNativeGoal(t,n){return(await this.http.post(`/api/sessions/${encodeURIComponent(t)}/native-goal`,n)).goal}async getSessionGoals(t){const n=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return n.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),n}async enqueueSessionGoal(t,n,o){var u;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:n,sourceMessageId:o});return typeof((u=c.started)==null?void 0:u.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...c.started.runId?{_nativeRunId:c.started.runId}:{}}),c.state}async reorderSessionGoals(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:n})}async cancelSessionGoal(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(n)}`)}async getThreadGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).goal??null}async setThreadGoal(t,n,o){const c=await this.http.put(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{objective:n,tokenBudget:o??null});return this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),c.goal}async updateThreadGoal(t,n){return(await this.http.patch(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{action:n})).goal}async clearThreadGoal(t){return(await this.http.delete(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).cleared}async enqueueSessionMessage(t,n){var c;await this.openStream(t,this.nativeStreamCursors.get(t));const o=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:n.content,sourceMessageId:n.sourceMessageId,messagePayload:{images:n.images,agentIds:n.agentIds,agentName:n.agentName,...n.runOptions?{runOptions:n.runOptions}:{}}});return typeof((c=o.started)==null?void 0:c.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...o.started.runId?{_nativeRunId:o.started.runId}:{}}),o.state}async updateSessionMessage(t,n,o){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:n,objective:o})}async reorderSessionMessages(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:n})}async cancelSessionMessage(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(n)}`)}async createSession(t,n,o,c){const u=await this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}});return this.announceSession(u,{title:t,projectId:n,agentType:o,cwd:c}),u}async createParallelSessions(t){const n=await this.http.post("/api/sessions/parallel",t);for(const o of n.members)this.announceSession(o);return n}async getParallelSessionGroup(t){return this.http.get(`/api/sessions/parallel?sessionId=${encodeURIComponent(t)}`)}async forkSession(t,n){const o=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/${n?"fork-at":"fork"}`,n?{point:n}:{});return this.announceSession(o),o}async releaseCodexSession(t){await this.http.post(`/api/sessions/${encodeURIComponent(t)}/release`,{})}async deleteSession(t){await this.http.delete(`/api/sessions/${encodeURIComponent(t)}`)}async getRuntimeHealth(){return this.http.get("/api/agent/runtime-health")}getUpdateStatus(){return this.http.get("/api/update/status")}checkForUpdate(){return this.http.post("/api/update/check",{})}installUpdate(){return this.http.post("/api/update/install",{})}onUpdateStatus(t){return()=>{}}async listAgentModels(t){return this.http.get(`/api/agent/models?agentType=${encodeURIComponent(t)}`)}async listProjects(){return this.projectBridge?(await this.requireProjectBridge().request("project:list")).projects??[]:this.http.get("/api/projects")}async getProject(t){return this.projectBridge?(await this.requireProjectBridge().request("project:get",{projectId:t})).project??null:this.http.get(`/api/projects/${encodeURIComponent(t)}`)}async createProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:n??""})).project:this.http.post("/api/projects",{name:t,path:n??""})}async updateProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:n.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,n)}async deleteProject(t){if(!this.projectBridge){await this.http.delete(`/api/projects/${encodeURIComponent(t)}`);return}await this.requireProjectBridge().request("project:delete",{projectId:t})}async checkProjectPath(t){return this.projectBridge?(await this.requireProjectBridge().request("project:check",{path:t})).valid===!0:(await this.http.get(`/api/projects/check?path=${encodeURIComponent(t)}`)).valid===!0}async listProjectRoots(){return this.projectBridge?(await this.requireProjectBridge().request("project:roots")).roots??[]:this.http.get("/api/projects/roots")}async getProjectPickerLocation(){return this.projectBridge?this.requireProjectBridge().request("project:roots"):this.http.get("/api/projects/roots?picker=1")}async listProjectDirectories(t){return this.projectBridge?(await this.requireProjectBridge().request("project:directories",{path:t})).entries??[]:this.http.get(`/api/projects/directories?path=${encodeURIComponent(t)}`)}async setProjectWorkingDir(t){return await this.saveSettings({workingDirectory:t}),{ok:!0,path:t}}async getSettings(){return this.http.get("/api/settings")}async setSetting(t,n){const o=await this.getSettings();if(!(t in o)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof o[t]=="number"?Number(n):Array.isArray(o[t])?JSON.parse(n):n;await this.saveSettings({[t]:c,revision:o.revision})}async subscribe(){}async handoffSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/handoff`,{})}async saveSettings(t){return this.http.post("/api/settings",t)}async setActiveProfile(t){return this.http.post("/api/settings",{activeProfileId:t})}async refreshServerModel(){const t=await this.getSettings(),n=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(n))return;const o=(u,g)=>{try{return JSON.parse(localStorage.getItem(u)||"null")??g}catch{return g}},c=o("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:o("webapp.agentDefs",[]),lsp:o("webapp.lspServers",[])}]),localStorage.setItem(n,"1")}business(t,n){return this.http.post("/api/business",{method:t,args:n})}async listMemories(){return this.business("listMemories",[])}async searchMemories(t){return this.business("searchMemories",[t])}async getMemory(t){return this.business("getMemory",[t])}async setMemory(t){return this.business("setMemory",[t])}async deleteMemory(t){return this.business("deleteMemory",[t])}async mcpList(){return this.business("mcpList",[])}async mcpSave(t){return this.business("mcpSave",[t])}async mcpDelete(t){return this.business("mcpDelete",[t])}async mcpSetEnabled(t,n){return this.business("mcpSetEnabled",[t,n])}async mcpProbe(t){return this.business("mcpProbe",[t])}async listSkills(){return this.business("listSkills",[])}async saveSkill(t){return this.business("saveSkill",[t])}async deleteSkill(t){return this.business("deleteSkill",[t])}async setSkillEnabled(t,n){return this.business("setSkillEnabled",[t,n])}async listAgentDefs(){return this.business("listAgentDefs",[])}async getAgentDef(t){return this.business("getAgentDef",[t])}async createAgentDef(t){return this.business("createAgentDef",[t])}async updateAgentDef(t,n){return this.business("updateAgentDef",[t,n])}async deleteAgentDef(t){return this.business("deleteAgentDef",[t])}async setActiveAgentDef(t){return this.business("setActiveAgentDef",[t])}async lspList(){return this.business("lspList",[])}async lspSave(t){return this.business("lspSave",[t])}async lspDelete(t){return this.business("lspDelete",[t])}async lspSetEnabled(t,n){return this.business("lspSetEnabled",[t,n])}async listUploads(){return this.business("listUploads",[])}async getUpload(t){return this.business("getUpload",[t])}async saveUpload(t){return this.business("saveUpload",[t])}async deleteUpload(t){return this.business("deleteUpload",[t])}async importSkill(){return null}async cronCreate(t,n,o){return this.business("cronCreate",[t,n,o])}async cronPause(t){return this.business("cronPause",[t])}async cronResume(t){return this.business("cronResume",[t])}async cronDelete(t){return this.business("cronDelete",[t])}async cronDeleteAll(){return this.business("cronDeleteAll",[])}async cronList(){return this.business("cronList",[])}async openFileDialog(){return null}async readFile(){throw new Error("Web 端不支持直接读取本地文件")}async writeFile(){throw new Error("Web 端不支持直接写入本地文件")}async hideWindow(){}async showWindow(){}async isWindowVisible(){return!0}async wakeStop(){return{ok:!0}}async wakeConversation(t){return{ok:!0,conversation:t}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}announceSession(t,n={}){if(!t||typeof t!="object")return;const o=t;if(typeof o.id!="string")return;const c=o.agentType??n.agentType??"customer-agent";if(!Bv(c))return;const u=o.status==="active"||o.status==="running"?"running":o.status==="completed"||o.status==="failed"?o.status:"idle",g={id:o.id,agentType:c,status:u,title:typeof o.title=="string"?o.title:n.title??"未命名会话",cwd:typeof o.cwd=="string"?o.cwd:n.cwd??"",projectId:typeof o.projectId=="string"?o.projectId:n.projectId,updated:typeof o.updated=="string"?o.updated:new Date().toISOString(),canResume:o.canResume!==!1};this.dispatch(g.id,{type:"session_summary",session:g})}dispatch(t,n){const o={...n,_sid:t};for(const c of this.listeners)try{c(o)}catch{}}dispatchStreamEvent(t,n){if(!(t.startsWith("runtime:codex:")&&n.type==="text_chunk"&&n.messagePhase==="commentary"&&typeof n.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,n);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===n._nativeRunId&&c.event.turnId===n.turnId&&c.event.itemId===n.itemId){c.event={...c.event,...n,text:String(c.event.text??"")+n.text};return}this.flushBufferedStreamText(t);const g=setTimeout(()=>this.flushBufferedStreamText(t),eT);this.bufferedStreamText.set(t,{event:{...n},timer:g})}flushBufferedStreamText(t){const n=this.bufferedStreamText.get(t);n&&(this.bufferedStreamText.delete(t),clearTimeout(n.timer),this.dispatch(t,n.event))}settle(t){this.stopOrdinaryRunRecovery(t),this.stopNativeRunRecovery(t);const n=this.pendingRuns.get(t);n&&(this.pendingRuns.delete(t),n())}beginNativeRunRecovery(t,n,o=!1){this.stopNativeRunRecovery(t);const c={runId:n,awaitingAdmission:o,inFlight:!1};return this.nativeRunRecoveries.set(t,c),c}startNativeRunRecovery(t,n){let o=this.nativeRunRecoveries.get(t);if(o!=null&&o.awaitingAdmission)return;if(n){const u=this.nativeRunIdentities.get(t);if(u!=null&&u.retired.has(n))return;u&&u.current!==n?(u.retired.add(u.current),u.current=n):u||this.nativeRunIdentities.set(t,{current:n,retired:new Set})}if((!o||n&&o.runId!==n)&&(o=this.beginNativeRunRecovery(t,n)),o.timer)return;const c=o;o.timer=setInterval(()=>{this.recoverNativeRun(t,c)},rT)}stopNativeRunRecovery(t){const n=this.nativeRunRecoveries.get(t);n!=null&&n.timer&&clearInterval(n.timer),this.nativeRunRecoveries.delete(t)}async recoverNativeRun(t,n){if(!(n.inFlight||n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n)){n.inFlight=!0;try{await this.getSession(t,{limit:1,view:"core"},{lifecycleOnly:!0})}catch{}finally{n.inFlight=!1}}}async reconcileNativeRun(t,n,o,c){var k;if(n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n||n.runId!==o||!o&&this.pendingRuns.has(t)||o&&typeof c.snapshotRunId!="string"&&c.snapshotRunId!==null||!["idle","completed","failed","aborted"].includes(String(c.status)))return;let u=n,g=o;if(typeof c.snapshotRunId=="string"&&c.snapshotRunId!==o){if((k=this.nativeRunIdentities.get(t))!=null&&k.retired.has(c.snapshotRunId))return;this.startNativeRunRecovery(t,c.snapshotRunId);const M=this.nativeRunRecoveries.get(t);if(!M||M.runId!==c.snapshotRunId)return;u=M,g=c.snapshotRunId}let x=Array.isArray(c.events)?c.events:[],w=c.status,m=[...x].reverse().find(M=>M.type==="done"||M.type==="error"||M.type==="turn_aborted");if(!m&&typeof c.snapshotRunId=="string")try{const M=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`);if(M.snapshotRunId!==c.snapshotRunId||!["idle","completed","failed","aborted"].includes(String(M.status)))return;w=M.status,x=Array.isArray(M.events)?M.events:[],m=[...x].reverse().find(G=>G.type==="done"||G.type==="error"||G.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==u||u.runId!==g||u.awaitingAdmission)return;const C=(m==null?void 0:m.type)??(w==="failed"?"error":w==="aborted"?"turn_aborted":"done"),{_nativeSequence:b,_nativeRunId:A,...T}=m??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...T,type:C,...C==="error"?{message:(m==null?void 0:m.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(m==null?void 0:m.durationMs)===void 0?{}:{durationMs:m.durationMs}}:{},...g??c.snapshotRunId?{_nativeRunId:g??c.snapshotRunId}:{},_nativeRecoveredFromSnapshot:!0})}startOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n);const o=setInterval(()=>{this.recoverSettledOrdinaryRun(t)},tT);this.ordinaryRunRecoveryTimers.set(t,o)}stopOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n),this.ordinaryRunRecoveryTimers.delete(t),this.ordinaryRunStreamText.delete(t)}async recoverSettledOrdinaryRun(t){var n;if(!this.pendingRuns.has(t)){this.stopOrdinaryRunRecovery(t);return}try{const o=await this.getSession(t,{limit:50});if(!o||o.status==="active"||o.status==="running"||o.status!=="completed"&&o.status!=="failed"&&o.status!=="aborted")return;const c=o.messages??[],u=c.map(m=>m.role).lastIndexOf("user"),g=co(c.slice(u+1).filter(m=>m.role==="assistant"&&(m.content??"").trim()).map(m=>m.content.trim()).join(`
167
+ */const GT=Rt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function XT(){const[e,t]=ce.useState(!1);return null}var Pv,Zp=fc;Pv=Zp.createRoot,Zp.hydrateRoot;class Lv extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class YT extends Error{constructor(t,n,o){super(n),this.status=t,this.code=o,this.name="ApiError"}}class Bv extends Error{constructor(){super("请求超时,请检查连接后重试"),this.name="RequestTimeoutError"}}class KT{constructor(t=(...o)=>fetch(...o),n=""){this.transport=t,this.baseUrl=n}setBaseUrl(t){this.baseUrl=t.replace(/\/+$/,"")}resolve(t){return this.baseUrl+t}async get(t,n){return this.request(t,{method:"GET",headers:n==null?void 0:n.headers,signal:n==null?void 0:n.signal},n==null?void 0:n.timeoutMs)}async post(t,n,o){return this.request(t,{method:"POST",signal:o==null?void 0:o.signal,headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async patch(t,n,o){return this.request(t,{method:"PATCH",signal:o==null?void 0:o.signal,headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async put(t,n,o){return this.request(t,{method:"PUT",signal:o==null?void 0:o.signal,headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)},o==null?void 0:o.timeoutMs)}async delete(t,n){return this.request(t,{method:"DELETE",headers:n==null?void 0:n.headers,signal:n==null?void 0:n.signal},n==null?void 0:n.timeoutMs)}async request(t,n,o=3e4){const c=n.signal;c==null||c.throwIfAborted();const u=new AbortController;let h,x;const w=new Promise((m,C)=>{h=setTimeout(()=>{C(new Bv),u.abort()},o),c&&(x=()=>{C(c.reason),u.abort(c.reason)},c.addEventListener("abort",x,{once:!0}))});try{return await Promise.race([this.readResponse(t,{...n,signal:u.signal}),w])}finally{clearTimeout(h),x&&(c==null||c.removeEventListener("abort",x))}}async readResponse(t,n){var c;const o=await this.transport(this.resolve(t),{credentials:"same-origin",cache:"no-store",...n});if(o.status===401||o.status===423)throw window.dispatchEvent(new CustomEvent("webapp:unauthorized")),new Lv;if(!o.ok){let u=`请求失败 (${o.status})`,h;try{const x=await o.json();typeof x.error=="string"?u=x.error:(c=x.error)!=null&&c.message&&(u=x.error.message),typeof x.code=="string"&&(h=x.code)}catch{}throw new YT(o.status,u,h)}if(o.status!==204)return await o.json()}}const ZT=30,QT=20,qT=2e3;function Qp(e){var t,n;if(e instanceof Error)return{name:e.name,message:e.message,stack:(t=e.stack)==null?void 0:t.slice(0,8e3)};if(typeof e=="string")return{name:"Error",message:e};try{return{name:"NonError",message:((n=JSON.stringify(e))==null?void 0:n.slice(0,2e3))??String(e)}}catch{return{name:"NonError",message:String(e)}}}function JT(e={}){const t=e.source??"webapp",n=()=>((typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl)??"").replace(/\/+$/,""),o=[];let c=null,u=!1,h=!1;const x=()=>{if(h||u||o.length===0)return;const A=o.splice(0,QT);u=!0;const T=JSON.stringify({entries:A});fetch(`${n()}/api/client-logs`,{method:"POST",headers:{"content-type":"application/json"},body:T,keepalive:!0}).catch(()=>{}).finally(()=>{u=!1,o.length>0&&w()})},w=()=>{c!==null||h||(c=setTimeout(()=>{c=null,x()},qT))},m=A=>{h||(o.length>=ZT&&o.shift(),o.push(A),w())},C=A=>{var T;m({level:"error",message:A.message||"window error",source:t,error:{name:"Error",message:A.message||"window error",stack:[A.filename?`${A.filename}:${A.lineno}:${A.colno}`:"",((T=A.error)==null?void 0:T.stack)??""].filter(Boolean).join(`
168
+ `).slice(0,8e3)||void 0},data:{filename:A.filename,lineno:A.lineno,colno:A.colno}})},b=A=>{const T=Qp(A.reason);m({level:"error",message:`unhandledRejection: ${T.message}`,source:t,error:T})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",b),{reportError:(A,T)=>{const k=Qp(A);m({level:"error",message:k.message,source:t,error:k,data:T})},reportWarning:(A,T)=>{m({level:"warn",message:A,source:t,data:T})},uninstall:()=>{h=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",b)}}}const j0=["customer-agent","codex","claude-code","opencode","deepseek-harness","qoder","zcode","workbuddy","copilot"],z_=j0.filter(e=>e!=="customer-agent");function Fv(e){return typeof e=="string"&&j0.some(t=>t===e)}function V_(e){return Fv(e)&&e!=="customer-agent"}const e9=2048,Uv=384*1024,t9=.85;function r9(e,t,n=e9){const o=Math.max(e,t);if(o<=n)return{width:e,height:t};const c=n/o;return{width:Math.max(1,Math.round(e*c)),height:Math.max(1,Math.round(t*c))}}async function n9(e,t=jv){if(e.type.toLowerCase()==="image/gif")return e;let n=null;try{n=await t.decode(e);const o=r9(n.width,n.height);if(!(o.width!==n.width||o.height!==n.height)&&e.size<=Uv)return e;const u=e.type.toLowerCase()==="image/jpeg"?"image/jpeg":"image/webp",h=await t.encode(n,o.width,o.height,u,t9);return h&&h.size<e.size?h:e}catch{return e}finally{n==null||n.dispose()}}function i9(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=()=>t(o.result),o.onerror=n,o.readAsDataURL(e)})}async function qp(e,t=jv){const n=[];for(const o of e){const c=/^data:(image\/(?:png|jpe?g|webp));base64,/i.exec(o),u=c?o.length-c[0].length:0;if(!c||u*3/4<=Uv){n.push(o);continue}try{const h=Uint8Array.from(atob(o.slice(c[0].length)),m=>m.charCodeAt(0)),x=new Blob([h],{type:c[1].toLowerCase()}),w=await n9(x,t);n.push(w===x?o:await i9(w))}catch{n.push(o)}}return n}const jv={decode(e){return new Promise((t,n)=>{const o=URL.createObjectURL(e),c=new Image;let u=!1;const h=()=>URL.revokeObjectURL(o);c.onload=()=>{u=!0,t({source:c,width:c.naturalWidth,height:c.naturalHeight,dispose:h})},c.onerror=()=>{u||h(),n(new Error("无法解码图片"))},c.src=o})},encode(e,t,n,o,c){const u=document.createElement("canvas");u.width=t,u.height=n;const h=u.getContext("2d");return h?(h.drawImage(e.source,0,0,t,n),new Promise(x=>u.toBlob(x,o,c))):Promise.resolve(null)}},Tf="<think>",Rf="</think>";function Jp(e,t){const n=Math.min(t.length-1,e.length);for(let o=n;o>0;o--)if(e.endsWith(t.slice(0,o)))return o;return 0}function co(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class s9{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(Rf);if(c===-1){const u=Jp(this.buffer,Rf);return this.buffer=this.buffer.slice(this.buffer.length-u),n}this.buffer=this.buffer.slice(c+Rf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(Tf);if(o===-1){const c=Jp(this.buffer,Tf);return n+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),n}n+=this.buffer.slice(0,o),this.buffer=this.buffer.slice(o+Tf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const o9=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,a9=50,l9=1e3,c9=2e3,u9=8e3;function e2(e){return e instanceof Bv||e instanceof Error&&e.name!=="AbortError"&&o9.test(e.message.trim())}class f9{constructor(t,n,o,c=x=>new EventSource(x),u,h={}){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,this.dictation=u,this.streams=new Map,this.nativeStreamCursors=new Map,this.nativeFinalAnswerSnapshots=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=new Map,this.ordinaryRunRecoveryTimers=new Map,this.ordinaryRunStreamText=new Map,this.nativeRunRecoveries=new Map,this.nativeRunIdentities=new Map,this.sessionHistoryObservationMode=h.historyObservation??"sse"}dictationStart(){var t;return((t=this.dictation)==null?void 0:t.dictationStart())??Promise.resolve({ok:!1,reason:"语音输入尚未初始化"})}dictationStop(){var t;return((t=this.dictation)==null?void 0:t.dictationStop())??Promise.resolve({ok:!0})}onDictation(t){var n;return((n=this.dictation)==null?void 0:n.onDictation(t))??(()=>{})}onDictationError(t){var n;return((n=this.dictation)==null?void 0:n.onDictationError(t))??(()=>{})}fileWorkspaceRequest(t,n={}){return t!=="fs:preview-open"&&t!=="fs:preview-close"?Promise.reject(new Error("消息区仅支持媒体预览操作")):this.requireProjectBridge().request(t,n)}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}async collaboration(t,n){return this.http.post("/api/collaboration",t,n)}async calendarOverview(t){const n=new URLSearchParams({from:t.from,to:t.to});return this.http.get(`/api/calendar?${n.toString()}`)}todoList(t={}){return this.http.get(`/api/todos?${new URLSearchParams(Object.entries(t).filter(([,n])=>n!==void 0).map(([n,o])=>[n,String(o)]))}`)}todoGet(t){return this.http.get(`/api/todos/${encodeURIComponent(t)}`)}todoCommand(t,n){return this.http.post(t.type==="create"?"/api/todos":`/api/todos/${encodeURIComponent(t.taskId)}/commands`,{command:t,requestId:n})}notificationList(){return this.http.get("/api/notifications")}notificationRead(t){return this.http.post(`/api/notifications/${encodeURIComponent(t)}/ack`,{read:!0})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,u,h){var T,k;const x=n.startsWith("runtime:"),w=this.streams.has(n),m=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);x&&!m&&this.beginNativeRunRecovery(n,void 0,!0);let b=null,A=null;try{x||await this.openStream(n,this.nativeStreamCursors.get(n)),A=m?null:new Promise(I=>{b=I,this.pendingRuns.set(n,I)}),x||this.ordinaryRunStreamText.set(n,"");const M=u!=null&&u.length?await qp(u):void 0,X={input:t,sessionId:n,...M?{images:M}:{},...o!=null&&o.length?{agentIds:o}:{},...!x&&(h!=null&&h.profileId)?{profileId:h.profileId}:{},...(T=h==null?void 0:h.model)!=null&&T.id?{nativeModel:h.model}:{},...h!=null&&h.reasoningEffort?{nativeReasoningEffort:h.reasoningEffort}:{}},N=x&&!(u!=null&&u.length)?await this.http.post("/api/agent/run",X,{timeoutMs:u9}):await this.http.post("/api/agent/run",X);if(x||this.startOrdinaryRunRecovery(n),x){const I=this.nativeRunRecoveries.get(n);I&&(I.awaitingAdmission=!1,I.runId=typeof N.runId=="string"?N.runId:void 0);const O=typeof N.runId=="string"&&(C==null?void 0:C.runId)!==N.runId?{sequence:0,runId:N.runId}:C??{sequence:0,...typeof N.runId=="string"?{runId:N.runId}:{}};await this.openStream(n,O,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof N.runId=="string"?{_nativeRunId:N.runId}:{}}),A&&await A}catch(M){const X=!m&&x&&e2(M)?await this.recoverNativeAdmission(n,C):null;if(X){const B=this.nativeRunRecoveries.get(n);return B&&(B.awaitingAdmission=!1,B.runId=X.runId),await this.openStream(n,X,{waitForOpen:!1}),A&&await A,[]}const N=M.code,I=typeof N=="string"?N:M.status===409?"SESSION_OCCUPIED":void 0;x&&I==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const O=w||m||I==="SESSION_ALREADY_RUNNING";if(x&&O){const B=this.nativeRunRecoveries.get(n);B&&(B.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:e2(M)?"网络连接中断,消息未确认发送,请重试":M instanceof Error?M.message:"无法启动运行",...I?{code:I}:{},...O?{_preserveActiveRun:!0}:{}}),O?b&&this.pendingRuns.get(n)===b&&this.pendingRuns.delete(n):(this.closeStream(n),this.settle(n))}return[]}async recoverNativeAdmission(t,n){const o=this.nativeStreamCursors.get(t);if(o!=null&&o.runId&&o.runId!==(n==null?void 0:n.runId))return this.dispatchRecoveredAdmission(t,o),o;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1&view=core`,{timeoutMs:4e3}),u=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,h=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,x=!!(u&&(n!=null&&n.runId)&&u!==n.runId),w=!!(u&&!(n!=null&&n.runId)&&c.status==="running");return!x&&!w?null:(this.dispatchRecoveredAdmission(t,{runId:u,sequence:h}),{runId:u,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,n){this.dispatch(t,{type:"run_admitted",...n.runId?{_nativeRunId:n.runId}:{}})}async steer(t,n,o){return(await this.http.post("/api/agent/steer",{input:t,sessionId:n})).steered}async steerSessionMessage(t,n){const o=await this.http.post("/api/agent/steer",{sessionId:t,messageId:n});if(!o.steered)throw new Error("当前运行不支持插队消息");return o.state}async abort(t,n,o){var h,x,w,m;const c=t!=null&&t.startsWith("runtime:")?o||(((h=this.nativeRunRecoveries.get(t))==null?void 0:h.runId)??((x=this.nativeStreamCursors.get(t))==null?void 0:x.runId)):void 0,u=t?[t]:[...new Set([...this.pendingRuns.keys(),...this.streams.keys(),...this.nativeRunRecoveries.keys()])].filter(C=>!C.startsWith("runtime:"));await this.http.post("/api/agent/abort",{...t?{sessionId:t}:{},...c?{expectedRunId:c}:{},...n?{trigger:n}:{}});for(const C of u){const b=((w=this.nativeRunRecoveries.get(C))==null?void 0:w.runId)??((m=this.nativeStreamCursors.get(C))==null?void 0:m.runId);c&&b!==c||(this.settle(C),this.closeStream(C))}}async answerQuestion(t,n,o){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:n,selectedIndices:o}),!0}catch{return!1}}async listSessions(t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${n}`)}async listAgentWorkspaces(t,n={}){const o=new URLSearchParams({agentType:t});return n.cursor&&o.set("cursor",n.cursor),n.limit!==void 0&&o.set("limit",String(n.limit)),n.refresh&&o.set("refresh","1"),n.since&&o.set("since",n.since),this.http.get(`/api/agent-workspaces?${o.toString()}`)}async importAgentWorkspace(t,n,o){return this.http.post("/api/agent-workspaces",{agentType:t,path:n,...o?{name:o}:{}})}async removeInvalidAgentWorkspace(t,n){const o=new URLSearchParams({agentType:t,workspaceId:n});await this.http.delete(`/api/agent-workspaces?${o.toString()}`)}async listAgentWorkspaceSessions(t,n,o={}){const c=new URLSearchParams({agentType:t});return o.cursor&&c.set("cursor",o.cursor),o.limit!==void 0&&c.set("limit",String(o.limit)),o.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(n)}/sessions?${c.toString()}`)}async refreshSessions(t){const n=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${n}`)}async listChildSessions(t){return[]}async getSession(t,n,o={}){var h;const c=this.nativeRunRecoveries.get(t),u=c==null?void 0:c.runId;try{const x=new URLSearchParams;n!=null&&n.before&&x.set("before",n.before),n!=null&&n.after&&x.set("after",n.after),n!=null&&n.anchor&&x.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&x.set("limit",String(n.limit)),n!=null&&n.view&&x.set("view",n.view),n!=null&&n.revision&&x.set("revision",n.revision),n!=null&&n.turnId&&x.set("turnId",n.turnId);const w=x.size>0?`?${x.toString()}`:"",m=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${w}`,o.signal?{signal:o.signal}:void 0);Array.isArray(m.messages)&&(m.messages=m.messages.map(A=>typeof A.content=="string"?{...A,content:co(A.content)}:A)),Array.isArray(m.events)&&(m.events=m.events.map(A=>typeof A.text=="string"&&A.text.includes("<think>")?{...A,text:co(A.text)}:typeof A.finalText=="string"&&A.finalText.includes("<think>")?{...A,finalText:co(A.finalText)}:A));const C=c===this.nativeRunRecoveries.get(t)&&u===(c==null?void 0:c.runId),b=!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace";if(t.startsWith("runtime:")&&C&&b&&typeof m.snapshotRevision=="number"){const A=typeof m.snapshotRunId=="string"?m.snapshotRunId:void 0;if(A&&((h=this.nativeRunIdentities.get(t))!=null&&h.retired.has(A)))return m;const T=m.history,k=(T==null?void 0:T.delivery)==="core"||(T==null?void 0:T.delivery)==="trace",M=this.snapshotRunMatchesHistoryTurn(m);if((T==null?void 0:T.delivery)==="core"&&!o.lifecycleOnly&&A&&M&&this.coreSnapshotContainsTailFinalAnswer(m.messages)&&this.rememberNativeFinalAnswerSnapshot(t,m.snapshotRevision,A),k||this.rememberNativeStreamCursor(t,m.snapshotRevision,A),m.status==="running"&&m.snapshotRunStatus!=="terminal"&&m.occupancy!=="owned-externally"&&(!k||M)){const X=this.nativeStreamCursors.get(t),N=k&&A&&(X==null?void 0:X.runId)!==A?{sequence:0,runId:A}:X??(k?{sequence:0,...A?{runId:A}:{}}:void 0);this.openStream(t,N).catch(()=>{})}c&&(M?await this.reconcileNativeRun(t,c,u,m):!c.awaitingAdmission&&m.snapshotRunStatus==="terminal"&&A===u&&(this.closeStream(t),this.settle(t)))}else if(!t.startsWith("runtime:")&&m.status==="active"){const A=m.activeRun;(A==null?void 0:A.running)===!0&&typeof A.eventId=="number"&&this.openStream(t,{sequence:A.eventId}).catch(()=>{})}return m}catch(x){if(x.status===404)return null;throw x}}async getSessionImage(t,n){return(await this.http.get(`/api/session-images/${encodeURIComponent(t)}?variant=${n}`)).dataUrl}async getSessionToolResult(t,n){const o=new URLSearchParams(n);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${o.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,n,o){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let u=!1;return c.onmessage=h=>{if(h.data)try{const x=JSON.parse(h.data);x.type==="session_history_changed"&&typeof x.revision=="number"&&n({type:x.type,revision:x.revision})}catch{}},c.onerror=()=>{u||(u=!0,c.close(),o==null||o())},()=>{u||(u=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:n})}async setSessionNativeMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{nativeMode:n})}async setSessionNativePermissionPreset(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{nativePermissionPreset:n})}async getSessionNativeGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/native-goal`)).goal}async listSessionBackgroundJobs(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/background-jobs`)).jobs}async getSessionBackgroundJobOutput(t,n){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/background-jobs/${encodeURIComponent(n)}`)}async stopSessionBackgroundJob(t,n){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/background-jobs/${encodeURIComponent(n)}/stop`,{})}async mutateSessionNativeGoal(t,n){return(await this.http.post(`/api/sessions/${encodeURIComponent(t)}/native-goal`,n)).goal}async getSessionGoals(t){const n=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return n.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),n}async enqueueSessionGoal(t,n,o){var u;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:n,sourceMessageId:o});return typeof((u=c.started)==null?void 0:u.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...c.started.runId?{_nativeRunId:c.started.runId}:{}}),c.state}async reorderSessionGoals(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:n})}async cancelSessionGoal(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(n)}`)}async getThreadGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).goal??null}async setThreadGoal(t,n,o){const c=await this.http.put(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{objective:n,tokenBudget:o??null});return this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),c.goal}async updateThreadGoal(t,n){return(await this.http.patch(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{action:n})).goal}async clearThreadGoal(t){return(await this.http.delete(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).cleared}async enqueueSessionMessage(t,n){var u,h;await this.openStream(t,this.nativeStreamCursors.get(t));const o=(u=n.images)!=null&&u.length?await qp(n.images):n.images,c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:n.content,sourceMessageId:n.sourceMessageId,messagePayload:{images:o,agentIds:n.agentIds,agentName:n.agentName,...n.runOptions?{runOptions:n.runOptions}:{}}});return typeof((h=c.started)==null?void 0:h.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...c.started.runId?{_nativeRunId:c.started.runId}:{}}),c.state}async updateSessionMessage(t,n,o){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:n,objective:o})}async reorderSessionMessages(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:n})}async cancelSessionMessage(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(n)}`)}async createSession(t,n,o,c){const u=await this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}});return this.announceSession(u,{title:t,projectId:n,agentType:o,cwd:c}),u}async createParallelSessions(t){const n=await this.http.post("/api/sessions/parallel",t);for(const o of n.members)this.announceSession(o);return n}async getParallelSessionGroup(t){return this.http.get(`/api/sessions/parallel?sessionId=${encodeURIComponent(t)}`)}async forkSession(t,n){const o=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/${n?"fork-at":"fork"}`,n?{point:n}:{});return this.announceSession(o),o}async releaseCodexSession(t){await this.http.post(`/api/sessions/${encodeURIComponent(t)}/release`,{})}async deleteSession(t){await this.http.delete(`/api/sessions/${encodeURIComponent(t)}`)}async getRuntimeHealth(){return this.http.get("/api/agent/runtime-health")}getUpdateStatus(){return this.http.get("/api/update/status")}checkForUpdate(){return this.http.post("/api/update/check",{})}installUpdate(){return this.http.post("/api/update/install",{})}onUpdateStatus(t){return()=>{}}async listAgentModels(t){return this.http.get(`/api/agent/models?agentType=${encodeURIComponent(t)}`)}async listProjects(){return this.projectBridge?(await this.requireProjectBridge().request("project:list")).projects??[]:this.http.get("/api/projects")}async getProject(t){return this.projectBridge?(await this.requireProjectBridge().request("project:get",{projectId:t})).project??null:this.http.get(`/api/projects/${encodeURIComponent(t)}`)}async createProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:n??""})).project:this.http.post("/api/projects",{name:t,path:n??""})}async updateProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:n.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,n)}async deleteProject(t){if(!this.projectBridge){await this.http.delete(`/api/projects/${encodeURIComponent(t)}`);return}await this.requireProjectBridge().request("project:delete",{projectId:t})}async checkProjectPath(t){return this.projectBridge?(await this.requireProjectBridge().request("project:check",{path:t})).valid===!0:(await this.http.get(`/api/projects/check?path=${encodeURIComponent(t)}`)).valid===!0}async listProjectRoots(){return this.projectBridge?(await this.requireProjectBridge().request("project:roots")).roots??[]:this.http.get("/api/projects/roots")}async getProjectPickerLocation(){return this.projectBridge?this.requireProjectBridge().request("project:roots"):this.http.get("/api/projects/roots?picker=1")}async listProjectDirectories(t){return this.projectBridge?(await this.requireProjectBridge().request("project:directories",{path:t})).entries??[]:this.http.get(`/api/projects/directories?path=${encodeURIComponent(t)}`)}async setProjectWorkingDir(t){return await this.saveSettings({workingDirectory:t}),{ok:!0,path:t}}async getSettings(){return this.http.get("/api/settings")}async setSetting(t,n){const o=await this.getSettings();if(!(t in o)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof o[t]=="number"?Number(n):Array.isArray(o[t])?JSON.parse(n):n;await this.saveSettings({[t]:c,revision:o.revision})}async subscribe(){}async handoffSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/handoff`,{})}async saveSettings(t){return this.http.post("/api/settings",t)}async setActiveProfile(t){return this.http.post("/api/settings",{activeProfileId:t})}async refreshServerModel(){const t=await this.getSettings(),n=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(n))return;const o=(u,h)=>{try{return JSON.parse(localStorage.getItem(u)||"null")??h}catch{return h}},c=o("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:o("webapp.agentDefs",[]),lsp:o("webapp.lspServers",[])}]),localStorage.setItem(n,"1")}business(t,n){return this.http.post("/api/business",{method:t,args:n})}async listMemories(){return this.business("listMemories",[])}async searchMemories(t){return this.business("searchMemories",[t])}async getMemory(t){return this.business("getMemory",[t])}async setMemory(t){return this.business("setMemory",[t])}async deleteMemory(t){return this.business("deleteMemory",[t])}async mcpList(){return this.business("mcpList",[])}async mcpSave(t){return this.business("mcpSave",[t])}async mcpDelete(t){return this.business("mcpDelete",[t])}async mcpSetEnabled(t,n){return this.business("mcpSetEnabled",[t,n])}async mcpProbe(t){return this.business("mcpProbe",[t])}async listSkills(){return this.business("listSkills",[])}async saveSkill(t){return this.business("saveSkill",[t])}async deleteSkill(t){return this.business("deleteSkill",[t])}async setSkillEnabled(t,n){return this.business("setSkillEnabled",[t,n])}async listAgentDefs(){return this.business("listAgentDefs",[])}async getAgentDef(t){return this.business("getAgentDef",[t])}async createAgentDef(t){return this.business("createAgentDef",[t])}async updateAgentDef(t,n){return this.business("updateAgentDef",[t,n])}async deleteAgentDef(t){return this.business("deleteAgentDef",[t])}async setActiveAgentDef(t){return this.business("setActiveAgentDef",[t])}async lspList(){return this.business("lspList",[])}async lspSave(t){return this.business("lspSave",[t])}async lspDelete(t){return this.business("lspDelete",[t])}async lspSetEnabled(t,n){return this.business("lspSetEnabled",[t,n])}async listUploads(){return this.business("listUploads",[])}async getUpload(t){return this.business("getUpload",[t])}async saveUpload(t){return this.business("saveUpload",[t])}async deleteUpload(t){return this.business("deleteUpload",[t])}async importSkill(){return null}async cronCreate(t,n,o){return this.business("cronCreate",[t,n,o])}async cronPause(t){return this.business("cronPause",[t])}async cronResume(t){return this.business("cronResume",[t])}async cronDelete(t){return this.business("cronDelete",[t])}async cronDeleteAll(){return this.business("cronDeleteAll",[])}async cronList(){return this.business("cronList",[])}async openFileDialog(){return null}async readFile(){throw new Error("Web 端不支持直接读取本地文件")}async writeFile(){throw new Error("Web 端不支持直接写入本地文件")}async hideWindow(){}async showWindow(){}async isWindowVisible(){return!0}async wakeStop(){return{ok:!0}}async wakeConversation(t){return{ok:!0,conversation:t}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}announceSession(t,n={}){if(!t||typeof t!="object")return;const o=t;if(typeof o.id!="string")return;const c=o.agentType??n.agentType??"customer-agent";if(!Fv(c))return;const u=o.status==="active"||o.status==="running"?"running":o.status==="completed"||o.status==="failed"?o.status:"idle",h={id:o.id,agentType:c,status:u,title:typeof o.title=="string"?o.title:n.title??"未命名会话",cwd:typeof o.cwd=="string"?o.cwd:n.cwd??"",projectId:typeof o.projectId=="string"?o.projectId:n.projectId,updated:typeof o.updated=="string"?o.updated:new Date().toISOString(),canResume:o.canResume!==!1};this.dispatch(h.id,{type:"session_summary",session:h})}dispatch(t,n){const o={...n,_sid:t};for(const c of this.listeners)try{c(o)}catch{}}dispatchStreamEvent(t,n){if(!(t.startsWith("runtime:codex:")&&n.type==="text_chunk"&&n.messagePhase==="commentary"&&typeof n.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,n);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===n._nativeRunId&&c.event.turnId===n.turnId&&c.event.itemId===n.itemId){c.event={...c.event,...n,text:String(c.event.text??"")+n.text};return}this.flushBufferedStreamText(t);const h=setTimeout(()=>this.flushBufferedStreamText(t),a9);this.bufferedStreamText.set(t,{event:{...n},timer:h})}flushBufferedStreamText(t){const n=this.bufferedStreamText.get(t);n&&(this.bufferedStreamText.delete(t),clearTimeout(n.timer),this.dispatch(t,n.event))}settle(t){this.stopOrdinaryRunRecovery(t),this.stopNativeRunRecovery(t);const n=this.pendingRuns.get(t);n&&(this.pendingRuns.delete(t),n())}beginNativeRunRecovery(t,n,o=!1){this.stopNativeRunRecovery(t);const c={runId:n,awaitingAdmission:o,inFlight:!1};return this.nativeRunRecoveries.set(t,c),c}startNativeRunRecovery(t,n){let o=this.nativeRunRecoveries.get(t);if(o!=null&&o.awaitingAdmission)return;if(n){const u=this.nativeRunIdentities.get(t);if(u!=null&&u.retired.has(n))return;u&&u.current!==n?(u.retired.add(u.current),u.current=n):u||this.nativeRunIdentities.set(t,{current:n,retired:new Set})}if((!o||n&&o.runId!==n)&&(o=this.beginNativeRunRecovery(t,n)),o.timer)return;const c=o;o.timer=setInterval(()=>{this.recoverNativeRun(t,c)},c9)}stopNativeRunRecovery(t){const n=this.nativeRunRecoveries.get(t);n!=null&&n.timer&&clearInterval(n.timer),this.nativeRunRecoveries.delete(t)}async recoverNativeRun(t,n){if(!(n.inFlight||n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n)){n.inFlight=!0;try{await this.getSession(t,{limit:1,view:"core"},{lifecycleOnly:!0})}catch{}finally{n.inFlight=!1}}}async reconcileNativeRun(t,n,o,c){var k;if(n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n||n.runId!==o||!o&&this.pendingRuns.has(t)||o&&typeof c.snapshotRunId!="string"&&c.snapshotRunId!==null||!["idle","completed","failed","aborted"].includes(String(c.status)))return;let u=n,h=o;if(typeof c.snapshotRunId=="string"&&c.snapshotRunId!==o){if((k=this.nativeRunIdentities.get(t))!=null&&k.retired.has(c.snapshotRunId))return;this.startNativeRunRecovery(t,c.snapshotRunId);const M=this.nativeRunRecoveries.get(t);if(!M||M.runId!==c.snapshotRunId)return;u=M,h=c.snapshotRunId}let x=Array.isArray(c.events)?c.events:[],w=c.status,m=[...x].reverse().find(M=>M.type==="done"||M.type==="error"||M.type==="turn_aborted");if(!m&&typeof c.snapshotRunId=="string")try{const M=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`);if(M.snapshotRunId!==c.snapshotRunId||!["idle","completed","failed","aborted"].includes(String(M.status)))return;w=M.status,x=Array.isArray(M.events)?M.events:[],m=[...x].reverse().find(X=>X.type==="done"||X.type==="error"||X.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==u||u.runId!==h||u.awaitingAdmission)return;const C=(m==null?void 0:m.type)??(w==="failed"?"error":w==="aborted"?"turn_aborted":"done"),{_nativeSequence:b,_nativeRunId:A,...T}=m??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...T,type:C,...C==="error"?{message:(m==null?void 0:m.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(m==null?void 0:m.durationMs)===void 0?{}:{durationMs:m.durationMs}}:{},...h??c.snapshotRunId?{_nativeRunId:h??c.snapshotRunId}:{},_nativeRecoveredFromSnapshot:!0})}startOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n);const o=setInterval(()=>{this.recoverSettledOrdinaryRun(t)},l9);this.ordinaryRunRecoveryTimers.set(t,o)}stopOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n),this.ordinaryRunRecoveryTimers.delete(t),this.ordinaryRunStreamText.delete(t)}async recoverSettledOrdinaryRun(t){var n;if(!this.pendingRuns.has(t)){this.stopOrdinaryRunRecovery(t);return}try{const o=await this.getSession(t,{limit:50});if(!o||o.status==="active"||o.status==="running"||o.status!=="completed"&&o.status!=="failed"&&o.status!=="aborted")return;const c=o.messages??[],u=c.map(m=>m.role).lastIndexOf("user"),h=co(c.slice(u+1).filter(m=>m.role==="assistant"&&(m.content??"").trim()).map(m=>m.content.trim()).join(`
169
169
 
170
- `)),x=this.ordinaryRunStreamText.get(t)??"",w=g.startsWith(x)?g.slice(x.length):g;if(w&&this.dispatch(t,{type:"text_chunk",text:w}),o.status==="completed")this.dispatch(t,{type:"done",finalText:""});else{const m=(n=[...o.events??[]].reverse().find(C=>{var b;return C.type==="error"&&((b=C.message)==null?void 0:b.trim())}))==null?void 0:n.message;this.dispatch(t,{type:"error",message:m||(o.status==="aborted"?"运行已中止":"运行失败,但未记录具体错误")})}this.closeStream(t),this.settle(t)}catch{}}openStream(t,n,o={}){if(t.startsWith("runtime:")&&this.startNativeRunRecovery(t,n==null?void 0:n.runId),this.streams.has(t))return Promise.resolve();this.thinkFilters.set(t,new q9);const c=new URLSearchParams({sessionId:t});Number.isSafeInteger(n==null?void 0:n.sequence)&&c.set(t.startsWith("runtime:")?"afterSequence":"afterEventId",String(n.sequence)),t.startsWith("runtime:")&&(n!=null&&n.runId)&&c.set("afterRunId",n.runId);const u=this.createEventSource(`/api/agent/stream?${c.toString()}`);let g=!1;this.streams.set(t,u);const x=o.waitForOpen!==!1;let w=x,m=null,C=null,b=null;const A=x?new Promise((T,k)=>{C=T,b=k,m=setTimeout(()=>{w=!1,this.streams.get(t)===u&&this.closeStream(t),k(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return u.onopen=()=>{w&&(w=!1,m&&clearTimeout(m),C==null||C())},u.onmessage=T=>{var M,G;if(this.streams.get(t)!==u||!T.data)return;let k;try{k=JSON.parse(T.data)}catch{return}if(typeof k._nativeSequence=="number"){const N=typeof k._nativeRunId=="string"?k._nativeRunId:void 0,I=this.nativeRunRecoveries.get(t),O=k.type==="done"||k.type==="error"||k.type==="turn_aborted";if(N&&((M=this.nativeRunIdentities.get(t))!=null&&M.retired.has(N))||N&&(I!=null&&I.runId)&&I.runId!==N&&this.pendingRuns.has(t)||O&&N&&(I!=null&&I.runId)&&I.runId!==N||!this.acceptNativeStreamEvent(t,k._nativeSequence,N)||O&&(I!=null&&I.awaitingAdmission)||(this.startNativeRunRecovery(t,N),this.isNativeFinalAnswerCoveredBySnapshot(t,k,k._nativeSequence,N)))return}if(k.type==="text_chunk"&&typeof k.text=="string"&&(k.text=this.thinkFilters.get(t).push(k.text),!t.startsWith("runtime:")&&k.text&&this.ordinaryRunStreamText.set(t,(this.ordinaryRunStreamText.get(t)??"")+k.text)),k.type==="done"||k.type==="error"||k.type==="turn_aborted"){const N=((G=this.thinkFilters.get(t))==null?void 0:G.flush())??"";N&&k.type==="done"&&typeof k.finalText=="string"&&(k.finalText=k.finalText+N),g=!0}k.type==="text_chunk"&&k.text===""||(this.dispatchStreamEvent(t,k),(k.type==="done"||k.type==="error"||k.type==="turn_aborted")&&(this.closeStream(t),this.settle(t)))},u.onerror=()=>{if(this.streams.get(t)===u){if(t.startsWith("runtime:")){const T=this.nativeRunRecoveries.get(t);u.readyState===EventSource.CLOSED&&(w&&(w=!1,m&&clearTimeout(m),b==null||b(new Error("事件流连接失败"))),this.closeStream(t)),T&&this.recoverNativeRun(t,T);return}if(w&&u.readyState===EventSource.CLOSED){w=!1,m&&clearTimeout(m),b==null||b(new Error("事件流连接失败"));return}if(u.readyState===EventSource.CLOSED){if(this.closeStream(t),g){this.settle(t);return}(async()=>{let T="";for(let k=0;k<8&&!T;k++){k>0&&await new Promise(M=>setTimeout(M,750));try{const M=await this.getSession(t,{limit:50}),G=(M==null?void 0:M.messages)??[],N=G.map(O=>O.role).lastIndexOf("user"),I=G.slice(N+1).filter(O=>O.role==="assistant"&&(O.content??"").trim()).map(O=>O.content.trim()).join(`
170
+ `)),x=this.ordinaryRunStreamText.get(t)??"",w=h.startsWith(x)?h.slice(x.length):h;if(w&&this.dispatch(t,{type:"text_chunk",text:w}),o.status==="completed")this.dispatch(t,{type:"done",finalText:""});else{const m=(n=[...o.events??[]].reverse().find(C=>{var b;return C.type==="error"&&((b=C.message)==null?void 0:b.trim())}))==null?void 0:n.message;this.dispatch(t,{type:"error",message:m||(o.status==="aborted"?"运行已中止":"运行失败,但未记录具体错误")})}this.closeStream(t),this.settle(t)}catch{}}openStream(t,n,o={}){if(t.startsWith("runtime:")&&this.startNativeRunRecovery(t,n==null?void 0:n.runId),this.streams.has(t))return Promise.resolve();this.thinkFilters.set(t,new s9);const c=new URLSearchParams({sessionId:t});Number.isSafeInteger(n==null?void 0:n.sequence)&&c.set(t.startsWith("runtime:")?"afterSequence":"afterEventId",String(n.sequence)),t.startsWith("runtime:")&&(n!=null&&n.runId)&&c.set("afterRunId",n.runId);const u=this.createEventSource(`/api/agent/stream?${c.toString()}`);let h=!1;this.streams.set(t,u);const x=o.waitForOpen!==!1;let w=x,m=null,C=null,b=null;const A=x?new Promise((T,k)=>{C=T,b=k,m=setTimeout(()=>{w=!1,this.streams.get(t)===u&&this.closeStream(t),k(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return u.onopen=()=>{w&&(w=!1,m&&clearTimeout(m),C==null||C())},u.onmessage=T=>{var M,X;if(this.streams.get(t)!==u||!T.data)return;let k;try{k=JSON.parse(T.data)}catch{return}if(typeof k._nativeSequence=="number"){const N=typeof k._nativeRunId=="string"?k._nativeRunId:void 0,I=this.nativeRunRecoveries.get(t),O=k.type==="done"||k.type==="error"||k.type==="turn_aborted";if(N&&((M=this.nativeRunIdentities.get(t))!=null&&M.retired.has(N))||N&&(I!=null&&I.runId)&&I.runId!==N&&this.pendingRuns.has(t)||O&&N&&(I!=null&&I.runId)&&I.runId!==N||!this.acceptNativeStreamEvent(t,k._nativeSequence,N)||O&&(I!=null&&I.awaitingAdmission)||(this.startNativeRunRecovery(t,N),this.isNativeFinalAnswerCoveredBySnapshot(t,k,k._nativeSequence,N)))return}if(k.type==="text_chunk"&&typeof k.text=="string"&&(k.text=this.thinkFilters.get(t).push(k.text),!t.startsWith("runtime:")&&k.text&&this.ordinaryRunStreamText.set(t,(this.ordinaryRunStreamText.get(t)??"")+k.text)),k.type==="done"||k.type==="error"||k.type==="turn_aborted"){const N=((X=this.thinkFilters.get(t))==null?void 0:X.flush())??"";N&&k.type==="done"&&typeof k.finalText=="string"&&(k.finalText=k.finalText+N),h=!0}k.type==="text_chunk"&&k.text===""||(this.dispatchStreamEvent(t,k),(k.type==="done"||k.type==="error"||k.type==="turn_aborted")&&(this.closeStream(t),this.settle(t)))},u.onerror=()=>{if(this.streams.get(t)===u){if(t.startsWith("runtime:")){const T=this.nativeRunRecoveries.get(t);u.readyState===EventSource.CLOSED&&(w&&(w=!1,m&&clearTimeout(m),b==null||b(new Error("事件流连接失败"))),this.closeStream(t)),T&&this.recoverNativeRun(t,T);return}if(w&&u.readyState===EventSource.CLOSED){w=!1,m&&clearTimeout(m),b==null||b(new Error("事件流连接失败"));return}if(u.readyState===EventSource.CLOSED){if(this.closeStream(t),h){this.settle(t);return}(async()=>{let T="";for(let k=0;k<8&&!T;k++){k>0&&await new Promise(M=>setTimeout(M,750));try{const M=await this.getSession(t,{limit:50}),X=(M==null?void 0:M.messages)??[],N=X.map(O=>O.role).lastIndexOf("user"),I=X.slice(N+1).filter(O=>O.role==="assistant"&&(O.content??"").trim()).map(O=>O.content.trim()).join(`
171
171
 
172
- `);T=co(I).trim()}catch{}}T?this.dispatch(t,{type:"text_chunk",text:T}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}}},A}rememberNativeStreamCursor(t,n,o){const c=this.nativeStreamCursors.get(t);if(c&&(c.runId===o||!o)&&n<c.sequence)return;const g=o??(c==null?void 0:c.runId);this.nativeStreamCursors.set(t,{sequence:n,...g?{runId:g}:{}})}acceptNativeStreamEvent(t,n,o){const c=this.nativeStreamCursors.get(t);return c&&(c.runId===o||!o)&&n<=c.sequence?!1:(this.rememberNativeStreamCursor(t,n,o),!0)}snapshotRunMatchesHistoryTurn(t){var c,u;if(typeof t.snapshotTurnId!="string"||!t.snapshotTurnId||!Array.isArray(t.messages))return!0;const n=t.messages.slice().reverse().find(g=>(g==null?void 0:g.role)==="user"),o=(u=(c=n==null?void 0:n.presentation)==null?void 0:c.executionTrace)==null?void 0:u.turnId;return typeof o!="string"||o===t.snapshotTurnId}coreSnapshotContainsTailFinalAnswer(t){if(!Array.isArray(t))return!1;let n=-1;for(let o=t.length-1;o>=0;o-=1){const c=t[o];if(typeof c=="object"&&c!==null&&c.role==="user"){n=o;break}}return t.slice(n+1).some(o=>{var u;if(typeof o!="object"||o===null)return!1;const c=o;return c.role==="assistant"&&((u=c.presentation)==null?void 0:u.agentMessagePhase)==="final_answer"})}rememberNativeFinalAnswerSnapshot(t,n,o){const c=this.nativeFinalAnswerSnapshots.get(t);(c==null?void 0:c.runId)===o&&c.sequence>=n||this.nativeFinalAnswerSnapshots.set(t,{runId:o,sequence:n})}isNativeFinalAnswerCoveredBySnapshot(t,n,o,c){const u=this.nativeFinalAnswerSnapshots.get(t);return!u||!c?!1:n.type==="text_chunk"&&n.messagePhase==="final_answer"&&u.runId===c&&o<=u.sequence}closeStream(t){this.flushBufferedStreamText(t);const n=this.streams.get(t);n&&(n.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}async function iT(e,t){const n=new URL(e,"http://event-source.local"),o=n.searchParams.get("sessionId");if(!(o!=null&&o.startsWith("runtime:"))||n.searchParams.has("afterSequence"))return e;const c=await t(o);if(!Number.isSafeInteger(c.snapshotRevision)||Number(c.snapshotRevision)<0)throw new Error("无法确定运行事件的恢复位置,请重试");return n.searchParams.set("afterSequence",String(c.snapshotRevision)),typeof c.snapshotRunId=="string"&&c.snapshotRunId&&n.searchParams.set("afterRunId",c.snapshotRunId),e.startsWith("/")?`${n.pathname}${n.search}${n.hash}`:n.href}class sT{constructor(t){this.options=t,this.active=new Set,this.queue=[],this.maxConnections=Math.max(1,Math.floor(t.maxConnections??3)),this.leaseMs=Math.max(1,t.leaseMs??1e3),this.yieldMs=Math.max(1,t.yieldMs??25),this.timers=t.timers??globalThis}open(t,n){const o=new oT(this,t);return Promise.resolve().then(async()=>{if(!o.closed)try{o.resumeUrl=n?await n():t,o.closed||this.enqueue(o)}catch{o.fail()}}),o}enqueue(t){t.closed||this.queue.includes(t)||this.active.has(t)||(this.queue.push(t),this.schedulePump())}schedulePump(){this.pumpTimer!==void 0||!this.queue.length||(this.pumpTimer=this.timers.setTimeout(()=>{for(this.pumpTimer=void 0;this.active.size<this.maxConnections&&this.queue.length;){const t=this.queue.shift();t.closed||(this.active.add(t),t.connect(this.options.createEventSource),this.active.has(t)&&this.scheduleLease(t))}},this.yieldMs))}scheduleLease(t){t.leaseTimer=this.timers.setTimeout(()=>{t.leaseTimer=void 0,!(!this.active.has(t)||t.closed)&&(this.queue.length&&t.resumable?(this.release(t),this.enqueue(t)):this.scheduleLease(t))},this.leaseMs)}release(t){t.leaseTimer!==void 0&&this.timers.clearTimeout(t.leaseTimer),t.leaseTimer=void 0,this.active.delete(t);const n=this.queue.indexOf(t);n!==-1&&this.queue.splice(n,1),t.disconnect(),this.schedulePump(),!this.active.size&&!this.queue.length&&this.pumpTimer!==void 0&&(this.timers.clearTimeout(this.pumpTimer),this.pumpTimer=void 0)}}class oT extends EventTarget{constructor(t,n){super(),this.pool=t,this.url=n,this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,this.withCredentials=!1,this.onopen=null,this.onerror=null,this.onmessage=null,this.readyState=0,this.closed=!1,this.physical=null,this.generation=0,this.retiredRuns=new Set,this.resumeUrl=n}get resumable(){const t=new URL(this.resumeUrl,"http://event-source.local").searchParams;return t.has("afterSequence")||t.has("afterEventId")}connect(t){if(this.closed)return;const n=++this.generation;let o;try{o=t(this.resumeUrl)}catch{this.fail();return}this.physical=o;const c=()=>!this.closed&&n===this.generation&&this.physical===o;o.onopen=()=>{var u;c()&&(this.readyState=this.OPEN,(u=this.onopen)==null||u.call(this,new Event("open")),c()&&this.dispatchEvent(new Event("open")))},o.onmessage=u=>{var g;!c()||!this.rememberCursor(u.lastEventId)||((g=this.onmessage)==null||g.call(this,u),c()&&this.dispatchEvent(new MessageEvent("message",{data:u.data,lastEventId:u.lastEventId,origin:u.origin})))},o.onerror=u=>{var g;c()&&(o.readyState===this.CLOSED?(this.closed=!0,this.readyState=this.CLOSED,this.pool.release(this)):this.readyState=this.CONNECTING,(g=this.onerror)==null||g.call(this,u),this.dispatchEvent(new Event("error")))}}rememberCursor(t){var o;if(!t)return!0;const n=new URL(this.resumeUrl,"http://event-source.local");if((o=n.searchParams.get("sessionId"))!=null&&o.startsWith("runtime:")){const c=t.lastIndexOf(":"),u=c>0?t.slice(0,c):"",g=Number(c>0?t.slice(c+1):t);if(!Number.isSafeInteger(g)||g<0||u&&this.retiredRuns.has(u))return!1;const x=n.searchParams.get("afterRunId"),w=Number(n.searchParams.get("afterSequence"));if((!u||!x||u===x)&&n.searchParams.has("afterSequence")&&g<=w)return!1;u&&x&&u!==x&&this.retiredRuns.add(x),u&&n.searchParams.set("afterRunId",u),n.searchParams.set("afterSequence",String(g))}else{const c=Number(t);if(!Number.isSafeInteger(c)||c<0||n.searchParams.has("afterEventId")&&c<=Number(n.searchParams.get("afterEventId")))return!1;n.searchParams.set("afterEventId",String(c))}return this.resumeUrl=this.resumeUrl.startsWith("/")?`${n.pathname}${n.search}${n.hash}`:n.href,!0}disconnect(){++this.generation;const t=this.physical;this.physical=null,t&&(t.onopen=t.onmessage=t.onerror=null,t.close()),this.closed||(this.readyState=this.CONNECTING)}fail(){var n;if(this.closed)return;this.close();const t=new Event("error");(n=this.onerror)==null||n.call(this,t),this.dispatchEvent(t)}close(){this.closed||(this.closed=!0,this.readyState=this.CLOSED,this.pool.release(this))}}const _f="__agentroamBoundedRunSourcesV1";function aT(e=window){var n;let t=e;try{((n=e.top)==null?void 0:n.location.origin)===e.location.origin&&(t=e.top)}catch{}return t[_f]??(t[_f]=new sT({createEventSource:o=>new t.EventSource(o),timers:t}))}function Fv(e){return Number.isFinite(e.width)&&e.width>=900&&!e.nativeApp&&!e.coarsePointer&&!/Android|iPhone|iPad|iPod|IEMobile|Opera Mini|Mobile/i.test(e.userAgent)}function e2(){return typeof window<"u"&&Ix()&&Fv({width:window.innerWidth,userAgent:navigator.userAgent,coarsePointer:window.matchMedia("(pointer: coarse)").matches,nativeApp:document.body.dataset.nativeApp==="1"})}function P_(){const[e,t]=ce.useState(e2);return ce.useEffect(()=>{const n=()=>t(e2()),o=window.matchMedia("(pointer: coarse)");return n(),window.addEventListener("resize",n),o.addEventListener("change",n),()=>{window.removeEventListener("resize",n),o.removeEventListener("change",n)}},[]),e}class lT{constructor(t,n){this.emit=n,this.sum=0,this.weight=0,this.frame=new Float32Array(1600),this.offset=0,this.ratio=t/16e3}push(t){if(t.length)for(let n=0;n<t[0].length;n++){let o=0;for(const u of t)o+=u[n]/t.length;let c=1;for(;c>1e-9;){const u=Math.min(c,this.ratio-this.weight);this.sum+=o*u,this.weight+=u,c-=u,this.weight>=this.ratio-1e-9&&(this.frame[this.offset++]=this.sum/this.ratio,this.weight=0,this.sum=0,this.offset===this.frame.length&&this.flush())}}}flush(){this.offset&&(this.emit(this.frame.slice(0,this.offset).buffer),this.offset=0)}}class cT{constructor(t){this.environment=t,this.active=null,this.generation=0,this.results=new Set,this.errors=new Set,window.addEventListener("pagehide",()=>this.complete(this.active)),document.addEventListener("visibilitychange",()=>{document.hidden&&this.complete(this.active)})}onDictation(t){return this.results.add(t),()=>{this.results.delete(t)}}onDictationError(t){return this.errors.add(t),()=>{this.errors.delete(t)}}async dictationStart(){var n,o,c,u,g;if(this.active)return{ok:!1,reason:"语音输入尚未结束"};if(!window.isSecureContext||!((n=navigator.mediaDevices)!=null&&n.getUserMedia))return{ok:!1,reason:"语音输入需要 HTTPS 地址和麦克风权限"};const t={state:"starting",sessionId:crypto.randomUUID(),generation:++this.generation,committed:"",interim:"",utterances:new Set};this.active=t;try{const x=((c=(o=this.environment).createContext)==null?void 0:c.call(o))??new AudioContext;t.context=x;const w=(((g=(u=this.environment).getUserMedia)==null?void 0:g.call(u))??navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})).then(C=>{if(this.active!==t){for(const b of C.getTracks())b.stop();throw new Error("语音输入已取消")}t.stream=C}),m=Promise.all([w,this.connect(t),x.resume().then(()=>this.prepareProcessor(t))]);return await Promise.race([m,new Promise(C=>{t.cancelStartup=C}),new Promise((C,b)=>{t.startupTimer=setTimeout(()=>b(new Error("麦克风启动超时,请检查权限后重试")),1e4)})]),clearTimeout(t.startupTimer),this.active!==t?{ok:!1}:(t.source=x.createMediaStreamSource(t.stream),t.source.connect(t.node),t.node.connect(x.destination),t.state="capturing",{ok:!0})}catch(x){if(this.active!==t)return{ok:!1};const w=x instanceof Error&&x.name==="NotAllowedError"?"麦克风权限未开启,请在浏览器网站设置中允许麦克风":x instanceof Error?x.message:"无法启动语音输入";return this.release(t),{ok:!1,reason:w}}}async dictationStop(){var n,o,c;const t=this.active;if(!t)return{ok:!0};if(t.state==="starting")return this.complete(t),{ok:!0};if(t.state==="draining")return await t.stopped,{ok:!0};t.state="draining",t.stopped=new Promise(u=>{t.resolveStopped=u});for(const u of((n=t.stream)==null?void 0:n.getTracks())??[])u.stop();(o=t.source)==null||o.disconnect(),clearTimeout(t.timer),t.timer=setTimeout(()=>this.fail(t,"语音识别收尾超时,已保留当前文字"),12e3);try{await((c=t.flushAudio)==null?void 0:c.call(t)),this.releaseMicrophone(t),this.active===t&&t.socket.send(JSON.stringify({type:"finish",sessionId:t.sessionId,generation:t.generation}))}catch{this.fail(t,"语音输入收尾失败,已保留当前文字")}return await t.stopped,{ok:!0}}async prepareProcessor(t){var x,w;const n=t.context;let o;const c=n.audioWorklet&&await Promise.race([n.audioWorklet.addModule(new URL("./dictation-audio-worklet.js",location.href).href).then(()=>!0,()=>!1),new Promise(m=>{o=setTimeout(()=>m(!1),1500)})]);if(clearTimeout(o),this.active!==t)return;if(c){const m=((w=(x=this.environment).createWorklet)==null?void 0:w.call(x,n))??new AudioWorkletNode(n,"dictation-capture");t.node=m;let C;m.port.onmessage=({data:b})=>{this.active===t&&(b.type==="pcm"&&b.pcm instanceof ArrayBuffer&&this.sendPcm(t,b.pcm),b.type==="flushed"&&(C==null||C()))},t.flushAudio=()=>new Promise((b,A)=>{const T=setTimeout(()=>A(new Error("Audio flush timed out")),500);C=()=>{clearTimeout(T),b()},t.cancelFlush=C,m.port.postMessage({type:"flush"})}),m.onprocessorerror=()=>this.fail(t,"麦克风音频处理失败,请重新开始"),t.clearProcessor=()=>{m.port.onmessage=null,m.onprocessorerror=null};return}const u=n.createScriptProcessor(2048,1,1),g=new lT(n.sampleRate,m=>this.sendPcm(t,m));u.onaudioprocess=m=>{m.outputBuffer.getChannelData(0).fill(0),g.push([m.inputBuffer.getChannelData(0)])},t.node=u,t.flushAudio=async()=>{u.onaudioprocess=null,g.flush()},t.clearProcessor=()=>{u.onaudioprocess=null}}sendPcm(t,n){var o;if(this.active===t){if(((o=t.socket)==null?void 0:o.readyState)!==WebSocket.OPEN){this.fail(t,"语音连接已断开");return}if(t.socket.bufferedAmount>128*1024){this.fail(t,"网络过慢,语音输入已停止");return}t.socket.send(n)}}async connect(t){const n=await this.environment.openSocket();if(this.active!==t){n.close();return}return t.socket=n,new Promise((o,c)=>{t.ready=o,t.rejectReady=c,t.timer=setTimeout(()=>c(new Error("本机语音服务连接超时")),8e3);const u=()=>n.send(JSON.stringify({type:"start",mode:"dictation",sampleRate:16e3,sessionId:t.sessionId,generation:t.generation}));n.addEventListener("open",u,{once:!0}),n.addEventListener("message",({data:x})=>{if(this.active!==t)return;let w;try{w=JSON.parse(String(x))}catch{this.fail(t,"语音服务返回无效数据");return}if(w.type==="error"){this.fail(t,typeof w.message=="string"?w.message:"语音识别失败");return}if(!(w.sessionId!==t.sessionId||w.generation!==t.generation)){if(w.type==="ready"){clearTimeout(t.timer),o();return}(w.type==="partial"||w.type==="final")&&typeof w.text=="string"&&(w.type==="partial"?t.interim=w.text:Number.isSafeInteger(w.utteranceId)&&!t.utterances.has(Number(w.utteranceId))&&(t.utterances.add(Number(w.utteranceId)),t.committed=this.join(t.committed,w.text),t.interim=""),this.emit({text:this.join(t.committed,t.interim),isFinal:!1})),w.type==="finished"&&this.complete(t)}});const g=()=>this.fail(t,"语音连接已断开,已保留当前文字");n.addEventListener("error",g),n.addEventListener("close",g),n.readyState===WebSocket.OPEN&&u()})}join(t,n){return t+(/[a-z0-9]$/i.test(t)&&/^[a-z0-9]/i.test(n)?" ":"")+n}emit(t){for(const n of this.results)n(t)}complete(t){if(!t||this.active!==t)return;const n=this.join(t.committed,t.interim);this.release(t),this.emit({text:n,isFinal:!0})}fail(t,n){var o;if(this.active===t){(o=t.rejectReady)==null||o.call(t,new Error(n)),this.release(t);for(const c of this.errors)c(n)}}releaseMicrophone(t){var n,o,c,u,g;if(!t.microphoneReleased){if(t.microphoneReleased=!0,t.state!=="draining")for(const x of((n=t.stream)==null?void 0:n.getTracks())??[])x.stop();(o=t.clearProcessor)==null||o.call(t),(c=t.source)==null||c.disconnect(),(u=t.node)==null||u.disconnect(),(g=t.context)==null||g.close().catch(()=>{})}}release(t){var n,o,c,u,g;this.active===t&&(this.active=null),clearTimeout(t.timer),clearTimeout(t.startupTimer),(n=t.cancelStartup)==null||n.call(t),(o=t.cancelFlush)==null||o.call(t),(c=t.resolveStopped)==null||c.call(t),(u=t.ready)==null||u.call(t),this.releaseMicrophone(t),(g=t.socket)==null||g.close()}}const ol="webapp.settings.v1";class uT{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(ol)??"{}")}catch{t={}}return this.cached={...this.defaults(),...t},this.cached}save(t){const n=this.get();this.cached={...n,...t},t.profiles&&!t.activeProfileId&&(this.cached.activeProfileId=n.activeProfileId),localStorage.setItem(ol,JSON.stringify(this.cached))}setActiveProfile(t){const n=this.get();this.cached={...n,activeProfileId:t},localStorage.setItem(ol,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const n=this.get(),o=n.profiles.find(x=>x.id==="server-managed");if(!o||o.apiKey!=="managed"||o.modelId===t.modelId&&o.provider===(t.provider||"openai"))return;const c=t.modelId,u=t.provider||"openai",g=t.baseUrl||"";this.cached={...n,profiles:n.profiles.map(x=>x.id==="server-managed"?{...x,name:`服务端 · ${c}`,provider:u,modelId:c,baseUrl:g}:x),modelProvider:u,modelId:c,baseUrl:g||n.baseUrl},localStorage.setItem(ol,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),n=t.profiles.find(x=>x.id===t.activeProfileId)??null,o=(n==null?void 0:n.provider)??t.modelProvider,c=(n==null?void 0:n.apiKey)??t.apiKey,u=(n==null?void 0:n.modelId)??t.modelId,g=(n==null?void 0:n.baseUrl)??t.baseUrl;return!c||c==="managed"||!u||u==="server"?null:{provider:o,apiKey:c,modelId:u,...g?{baseUrl:g}:{},...(n==null?void 0:n.requestTimeoutSeconds)===void 0?{}:{requestTimeoutSeconds:n.requestTimeoutSeconds}}}getReasoningEffort(){const t=this.get().reasoningEffort;return["off","low","medium","high"].includes(t)?t:"off"}getRunLimits(){const t=this.get(),n=Number(t.maxIterations),o=Number.isFinite(n)&&n>=0?Math.trunc(n):10,c=Math.min(2e3,Math.max(8,Math.trunc(Number(t.contextWindow)||100)));return{maxIterations:o,maxTokens:c*1e3}}defaults(){const t={id:"server-managed",name:"服务端托管",provider:"openai",modelId:"server",apiKey:"managed",baseUrl:""};return{modelProvider:t.provider,modelId:t.modelId,apiKey:t.apiKey,baseUrl:"",maxIterations:10,contextWindow:100,workingDirectory:"/",profiles:[t],activeProfileId:t.id,reasoningEffort:"off"}}}function fT(e){return e.toString(16).padStart(2,"0")}function dT(e){const t=e.getRandomValues(new Uint8Array(16));t[6]=t[6]&15|64,t[8]=t[8]&63|128;const n=Array.from(t,fT);return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10,16).join("")].join("-")}function hT(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>dT(e)})}const Of="agent-webapp:tab-swipe:v1",gT=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(","),t2=24;function pT(e){return!e||typeof e.closest!="function"?!1:!!e.closest(gT)}function mT(e){let t=null;const n=o=>t!==null&&o.pointerType==="touch"&&o.pointerId===t.pointerId;return{pointerDown(o){o.pointerType!=="touch"||!o.isPrimary||o.interactive||!(o.clientX<=t2||o.clientX>=o.viewportWidth-t2)||(t={pointerId:o.pointerId,startX:o.clientX,startY:o.clientY,axis:"pending"})},pointerMove(o){if(!n(o)||!t)return!1;const c=o.clientX-t.startX,u=o.clientY-t.startY;if(t.axis==="pending"){if(Math.max(Math.abs(c),Math.abs(u))<=8)return!1;if(Math.abs(u)>=Math.abs(c)*1.2)return t=null,!1;t.axis="horizontal"}return e({type:Of,phase:"move",deltaX:c}),!0},pointerUp(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Of,phase:"end",deltaX:o.clientX-t.startX}),t=null,c},pointerCancel(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Of,phase:"cancel",deltaX:0}),t=null,c}}}function xT(){if(window.parent===window)return()=>{};const e=mT(g=>{window.parent.postMessage(g,window.location.origin)}),t=g=>({pointerId:g.pointerId,pointerType:g.pointerType,isPrimary:g.isPrimary,clientX:g.clientX,clientY:g.clientY,viewportWidth:window.innerWidth}),n=g=>{e.pointerDown({...t(g),interactive:pT(g.target)})},o=g=>{e.pointerMove(t(g))&&g.preventDefault()},c=g=>{e.pointerUp(t(g))&&g.preventDefault()},u=g=>{e.pointerCancel(t(g))};return document.addEventListener("pointerdown",n,{capture:!0}),document.addEventListener("pointermove",o,{capture:!0,passive:!1}),document.addEventListener("pointerup",c,{capture:!0,passive:!1}),document.addEventListener("pointercancel",u,{capture:!0}),()=>{document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",o,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",u,{capture:!0})}}const wT="agent-web-shell:skin:v1",vT=["pearl","scifi","noir","mist","pine","graphite","glass"];function yT(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const n=t.data;if(!n||typeof n!="object"||n.type!==wT||typeof n.skin!="string"||!vT.includes(n.skin))return;const o=Ci.getState();o.skin!==n.skin&&o.setSkin(n.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}function ET(){if(window.parent===window)return()=>{};const e=n=>{if(n.origin!==window.location.origin||n.source!==window.parent)return;const o=x5(n.data);if(o){document.body.dataset.webShellEmbedded="1";const c=Ci.getState();c.navigationLayout!==o&&c.setNavigationLayout(o)}},t=n=>{n.storageArea&&n.storageArea!==window.localStorage||n.key!==null&&n.key!==Ci.persist.getOptions().name||Ci.persist.rehydrate()};return window.addEventListener("message",e),window.addEventListener("storage",t),()=>{window.removeEventListener("message",e),window.removeEventListener("storage",t),delete document.body.dataset.webShellEmbedded}}const CT="agentroam:open-browser-live",X1="agent-web-shell:open-browser-live:v1";function bT(e){return!e||typeof e!="object"||e.type!==X1?null:{type:X1}}function L_(e,t,n){return e.origin!==t||e.source!==n?null:bT(e.data)}function AT(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const n=t.data;!n||typeof n!="object"||n.type!==X1||window.dispatchEvent(new CustomEvent(CT))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const ST="agent-webapp:ready:v1";function IT(){window.parent!==window&&window.parent.postMessage({type:ST},window.location.origin)}function TT(){if(window.parent!==window)try{if(window.parent.location.origin===window.location.origin){window.parent.location.reload();return}}catch{}window.location.reload()}const Uv="agent-webapp:project-request:v1",RT="agent-web-shell:project-response:v1",_T=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"],OT=new Set([..._T,"fs:preview-open","fs:preview-close"]);function NT(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==Uv||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.method!="string"||!OT.has(t.method)||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)?null:t}function B_(e,t,n){return e.origin!==t||e.source!==n?null:NT(e.data)}function kT(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==RT||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class MT{constructor(t=window,n=15e3){this.context=t,this.timeoutMs=n,this.sequence=0,this.pending=new Map,this.onMessage=o=>{if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=kT(o.data);if(!c)return;const u=this.pending.get(c.id);u&&(this.pending.delete(c.id),clearTimeout(u.timer),c.ok?u.resolve(c.result):u.reject(Object.assign(new Error(c.error||"项目操作失败"),{code:c.code})))},this.context.addEventListener("message",this.onMessage)}request(t,n={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"}));const o=++this.sequence;return new Promise((c,u)=>{const g=setTimeout(()=>{this.pending.delete(o),u(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:u,timer:g}),this.context.parent.postMessage({type:Uv,id:o,method:t,payload:n},this.context.location.origin)})}dispose(){this.context.removeEventListener("message",this.onMessage);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(Object.assign(new Error("项目桥已关闭"),{code:"WEB_SHELL_CLOSED"}));this.pending.clear()}}const jv="agent-webapp:browser-request:v1",DT="agent-web-shell:browser-response:v1",PT="agent-web-shell:browser-event:v1",LT="agent-web-shell:browser-frame:v1",BT=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc","browser:system"],FT=new Set(BT);function UT(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==jv||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.method!="string"||!FT.has(t.method)||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)?null:t}function F_(e,t,n){return e.origin!==t||e.source!==n?null:UT(e.data)}function jT(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==DT||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function WT(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==PT||!t.event||typeof t.event!="object")return null;const n=t.event;return typeof n.type!="string"||!n.type.startsWith("browser:")?null:t}function $T(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==LT||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class zT{constructor(t=window,n=15e3){this.context=t,this.timeoutMs=n,this.sequence=0,this.pending=new Map,this.listeners=new Set,this.sessionsByChannel=new Map,this.pendingFramesByChannel=new Map,this.onMessage=o=>{var w;if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=$T(o.data);if(c){const m=this.sessionsByChannel.get(c.channelId);if(!m){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,m);return}const u=WT(o.data);if(u){if(u.event.type==="browser:connection"){this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear();for(const m of this.pending.values())clearTimeout(m.timer),m.reject(Object.assign(new Error("远程连接已变化,请重新接管"),{code:"EOFFLINE"}));this.pending.clear()}for(const m of this.listeners)m(u.event);return}const g=jT(o.data);if(!g)return;const x=this.pending.get(g.id);if(x)if(this.pending.delete(g.id),clearTimeout(x.timer),g.ok){if(x.method==="browser:watch"&&g.result&&typeof g.result=="object"){const m=g.result;if(Number.isSafeInteger(m.channelId)&&typeof((w=m.session)==null?void 0:w.id)=="string"){const C=Number(m.channelId);this.sessionsByChannel.set(C,m.session.id);const b=this.pendingFramesByChannel.get(C);b&&(this.pendingFramesByChannel.delete(C),this.emitBinaryFrame(b,m.session.id))}}x.resolve(g.result)}else x.reject(Object.assign(new Error(g.error||"浏览器操作失败"),{code:g.code}))},this.context.addEventListener("message",this.onMessage)}emitBinaryFrame(t,n){for(const o of this.listeners)o({type:"browser:frame",sessionId:n,sequence:t.sequence,data:t.data,mime:"image/jpeg",timestamp:Date.now()})}request(t,n={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开浏览器直播"),{code:"WEB_SHELL_REQUIRED"}));const o=++this.sequence;return new Promise((c,u)=>{const g=setTimeout(()=>{this.pending.delete(o),u(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:u,timer:g,method:t}),this.context.parent.postMessage({type:jv,id:o,method:t,payload:n},this.context.location.origin)})}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}dispose(){this.context.removeEventListener("message",this.onMessage);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(Object.assign(new Error("浏览器桥已关闭"),{code:"WEB_SHELL_CLOSED"}));this.pending.clear(),this.listeners.clear(),this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear()}}class ln{constructor(t){this.url=t}static parse(t){const n=t.trim();if(!n)return null;const o=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?n:`http://${n}`;let c;try{c=new URL(o)}catch{return null}return c.protocol!=="http:"&&c.protocol!=="https:"||!c.hostname?null:new ln(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class VT{constructor(t,n,o){this.environment=t,this.storage=n,this.probe=o}async planStartup(){if(!this.environment.isNativeApp())return{mode:"same-origin"};const t=this.launchEndpoint();if(t)return{mode:"ready",endpoint:t};const n=this.storage.load();if(n){const o=await this.probe.probe(n);return o.ok?{mode:"ready",endpoint:n}:{mode:"setup",endpoint:n,failure:o.reason}}return{mode:"setup",endpoint:null}}async connect(t){const n=ln.parse(t);if(!n)return{ok:!1,reason:"地址无效,请输入 http(s)://host:port 形式的服务器地址"};const o=await this.probe.probe(n);return o.ok?(this.storage.save(n),{ok:!0,endpoint:n}):{ok:!1,reason:`无法连接服务器:${o.reason}`}}disconnect(){this.storage.clear()}launchEndpoint(){const t=this.environment.launchServerUrl();return t?ln.parse(t):null}}function r2(){return window.Capacitor??null}class HT{isNativeApp(){var t,n;return((n=(t=r2())==null?void 0:t.isNativePlatform)==null?void 0:n.call(t))??!1}platform(){var n,o;const t=(o=(n=r2())==null?void 0:n.getPlatform)==null?void 0:o.call(n);return t==="ios"||t==="android"?t:"web"}launchServerUrl(){const t=new URLSearchParams(window.location.search).get("server");return t&&t.trim()?t.trim():null}}const Nf="webapp.mobile.serverEndpoint.v1";class Wv{load(){try{const t=localStorage.getItem(Nf);return t?ln.parse(t):null}catch{return null}}save(t){localStorage.setItem(Nf,t.toString())}clear(){localStorage.removeItem(Nf)}}const GT=6e3;class XT{constructor(t=(...n)=>fetch(...n)){this.transport=t}async probe(t,n=GT){const o=new AbortController,c=setTimeout(()=>o.abort(),n);try{const u=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:o.signal});return u.ok?{ok:!0,modelId:(await u.json()).modelId??null}:{ok:!1,reason:u.status===401?"此 App 尚未授权,请扫描电脑上的授权二维码。":u.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":`HTTP ${u.status}`}}catch(u){return{ok:!1,reason:u instanceof DOMException&&u.name==="AbortError"?"连接超时":YT(u)}}finally{clearTimeout(c)}}}function YT(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function KT({id:e,label:t,className:n,disabled:o,children:c,onMove:u}){const[g,x]=ce.useState(null),w=ce.useRef(null),m=ce.useRef(),C=ce.useRef(0),b=()=>{clearTimeout(m.current),document.querySelectorAll(".toolbar-sort-target").forEach(A=>A.classList.remove("toolbar-sort-target")),w.current=null,x(null)};return ce.useEffect(()=>()=>{clearTimeout(m.current)},[]),L.jsx("div",{className:`${n} sortable-toolbar-action${g?" is-dragging":""}`,"data-toolbar-sort-id":e,title:`${t} · 长按拖动排序`,"aria-description":"长按拖动排序,也可按 Alt 加方向键调整顺序",style:g?{transform:`translate(${g.x}px, ${g.y}px)`}:void 0,onContextMenu:A=>A.preventDefault(),onKeyDown:A=>{var G;if(o||!A.altKey||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(A.key))return;const T=Array.from(A.currentTarget.parentElement.querySelectorAll("[data-toolbar-sort-id]")),k=A.key==="ArrowLeft"?-1:A.key==="ArrowRight"?1:A.key==="ArrowUp"?-3:3,M=(G=T[T.indexOf(A.currentTarget)+k])==null?void 0:G.dataset.toolbarSortId;M&&(A.preventDefault(),u(e,M))},onPointerDownCapture:A=>{if(o||A.button!==0||!A.isPrimary)return;const T=A.currentTarget,k={pointer:A.pointerId,x:A.clientX,y:A.clientY,active:!1,target:e,node:T};w.current=k,A.pointerType!=="mouse"&&(m.current=setTimeout(()=>{w.current===k&&(k.active=!0,T.setPointerCapture(k.pointer),x({x:0,y:0}))},260))},onPointerMove:A=>{var N;const T=w.current;if(!T||T.pointer!==A.pointerId)return;const k=A.clientX-T.x,M=A.clientY-T.y;if(!T.active&&A.pointerType==="mouse"&&Math.hypot(k,M)>=6&&(T.active=!0,T.node.setPointerCapture(T.pointer)),!T.active){Math.hypot(k,M)>=10&&b();return}A.preventDefault(),x({x:k,y:M});const G=(N=document.elementFromPoint(A.clientX,A.clientY))==null?void 0:N.closest("[data-toolbar-sort-id]");document.querySelectorAll(".toolbar-sort-target").forEach(I=>I.classList.remove("toolbar-sort-target")),T.target=(G==null?void 0:G.dataset.toolbarSortId)??e,T.target!==e&&(G==null||G.classList.add("toolbar-sort-target"))},onPointerUp:A=>{const T=w.current;!T||T.pointer!==A.pointerId||(T.active&&(C.current=Date.now()+500,T.node.hasPointerCapture(T.pointer)&&T.node.releasePointerCapture(T.pointer),T.target!==e&&u(e,T.target)),b())},onPointerCancel:b,onClickCapture:A=>{Date.now()<C.current&&(A.preventDefault(),A.stopPropagation())},children:c})}const ZT={refresh:"刷新页面",dashboard:"进行中的会话",collaboration:"群聊看板",install:"安装应用",remote:"远程桌面","ai-hub":"AI Hub",flow:"数字人",theme:"皮肤",files:"我的文件"};function QT(e){return e.map(t=>t.compactItems??[t]).filter(t=>t.length>0)}function qT(e){return QT(e).flat().filter(t=>t.id!=="files")}function JT({items:e,avatar:t,onReorder:n,sortingDisabled:o=!1}){const[c,u]=ce.useState(!1);ce.useEffect(()=>{A(!1)},[c]),ce.useEffect(()=>{const B=window.matchMedia("(max-width: 899px)"),j=()=>u(B.matches);return j(),B.addEventListener("change",j),()=>B.removeEventListener("change",j)},[]);const g=ce.useRef(null),x=ce.useRef(null),w=ce.useRef(null),[m,C]=ce.useState(null),[b,A]=ce.useState(!1),[T,k]=ce.useState({top:-1e3,left:0}),[M,G]=ce.useState(""),N=(B,j)=>{!n||o||(G(""),n(B,j).catch(U=>G(U instanceof Error?U.message:"顺序保存失败,请重试。")))},I=(B,j)=>L.jsx(KT,{id:B.id,label:ZT[B.id]??B.id,className:j,disabled:!n||o,onMove:N,children:O(B)},B.id);ce.useEffect(()=>{var B;C(((B=g.current)==null?void 0:B.closest(".web-root"))??document.body)},[]),ce.useLayoutEffect(()=>{if(!b||c)return;const B=()=>{var z,oe,ve,ie;const U=(z=w.current)==null?void 0:z.getBoundingClientRect();if(!U)return;const F=((oe=x.current)==null?void 0:oe.getBoundingClientRect().width)??Math.min(292,innerWidth-16),Y=((ie=(ve=g.current)==null?void 0:ve.closest(".terminal-tabs"))==null?void 0:ie.getBoundingClientRect().bottom)??U.bottom;k({top:Math.max(U.bottom,Y)+6,left:Math.max(8,Math.min(innerWidth-F-8,U.right-F))})};B();const j=new ResizeObserver(B);return x.current&&j.observe(x.current),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{j.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[b,c]),ce.useEffect(()=>{if(!b)return;const B=U=>{var Y,z;const F=U.target;(Y=g.current)!=null&&Y.contains(F)||(z=x.current)!=null&&z.contains(F)||F instanceof Element&&F.closest("[data-toolbar-overlay]")||A(!1)},j=U=>{var F;U.key==="Escape"&&(A(!1),(F=w.current)==null||F.focus())};return document.addEventListener("pointerdown",B),document.addEventListener("keydown",j),()=>{document.removeEventListener("pointerdown",B),document.removeEventListener("keydown",j)}},[b]);const O=B=>L.jsx("div",{className:"toolbar-slot","data-toolbar-item":B.id,onClick:B.id==="remote"?()=>A(!1):void 0,children:B.content},B.id);if(!c){const B=["files","remote"].flatMap(U=>e.filter(F=>F.id===U)),j=e.filter(U=>!["files","remote"].includes(U.id));return L.jsxs("div",{ref:g,className:"responsive-toolbar glass-desktop-toolbar",children:[L.jsxs("div",{className:"glass-desktop-actions",children:[B.map(O),j.length>0&&L.jsx("button",{ref:w,type:"button",className:"file-drawer-toggle","aria-label":"更多功能",title:"更多功能","aria-haspopup":"dialog","aria-expanded":b,onClick:()=>A(U=>!U),children:L.jsx(Kp,{size:20})})]}),L.jsx("div",{className:"toolbar-avatar",onPointerDown:()=>A(!1),children:t}),m&&uc.createPortal(L.jsxs("div",{ref:x,hidden:!b,className:"glass-desktop-menu",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,style:{position:"fixed",top:T.top,left:T.left,zIndex:200},children:[j.map(U=>I(U,"toolbar-sort-cell")),M&&L.jsx("p",{className:"toolbar-sort-error",role:"alert",children:M})]}),m)]})}{const B=L.jsx("div",{className:"glass-mobile-actions",style:{display:"flex",alignItems:"center",gap:4},children:L.jsx("button",{ref:w,type:"button",className:"file-drawer-toggle ui-icon-button","aria-haspopup":"dialog","aria-label":"更多功能","aria-expanded":b,onClick:()=>A(j=>!j),children:L.jsx(Kp,{size:20})})});return L.jsxs("div",{ref:g,className:"responsive-toolbar glass-mobile-toolbar",children:[e.filter(j=>j.id==="files").map(O),B,L.jsx("div",{className:"toolbar-avatar",children:t}),m&&uc.createPortal(L.jsx("div",{hidden:!b,className:"glass-tools-backdrop",onClick:()=>A(!1),children:L.jsxs("section",{ref:x,className:"glass-tools-sheet",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,onClick:j=>j.stopPropagation(),children:[L.jsxs("header",{children:[L.jsxs("div",{children:[L.jsx("strong",{children:"更多功能"}),L.jsx("small",{children:"长按拖动排序"})]}),L.jsx("button",{type:"button","aria-label":"关闭更多功能",onClick:()=>{var j;A(!1),(j=w.current)==null||j.focus()},children:"×"})]}),L.jsx("div",{className:"glass-tools-grid",children:qT(e).map(j=>I(j,"glass-tool-cell"))}),M&&L.jsx("p",{className:"toolbar-sort-error",role:"alert",children:M})]})}),m)]})}}function eR(e,t){return Math.max(0,Math.floor((t-e)/1e3))}function W0({ready:e=!1,error:t,onRetry:n}){const[o]=ce.useState(Date.now),[c,u]=ce.useState(Date.now);ce.useEffect(()=>{if(e||t)return;const x=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(x)},[e,t]);const g=t||"数字人核心正在就绪";return L.jsxs("main",{className:`neural-boot${e?" is-ready":""}${t?" is-error":""}`,role:t?"alert":"status","aria-live":"polite","aria-busy":!e&&!t,"aria-hidden":e,children:[L.jsx("div",{className:"neural-grid","aria-hidden":"true"}),L.jsx("div",{className:"neural-rail neural-rail-left","aria-hidden":"true"}),L.jsx("div",{className:"neural-rail neural-rail-right","aria-hidden":"true"}),L.jsxs("section",{className:"neural-content",children:[L.jsxs("div",{className:"neural-brand","aria-hidden":"true",children:[L.jsx("span",{className:"neural-brand-signal"}),L.jsx("span",{children:"AgentRoam"}),L.jsx("small",{children:"NEURAL LINK"})]}),L.jsxs("div",{className:"neural-portrait","aria-hidden":"true",children:[L.jsx("span",{className:"neural-ring neural-ring-outer"}),L.jsx("span",{className:"neural-ring neural-ring-inner"}),L.jsx("span",{className:"neural-axis neural-axis-x"}),L.jsx("span",{className:"neural-axis neural-axis-y"}),L.jsx("span",{className:"neural-node neural-node-one"}),L.jsx("span",{className:"neural-node neural-node-two"}),L.jsx("span",{className:"neural-node neural-node-three"}),L.jsx("span",{className:"neural-node neural-node-four"}),L.jsx("div",{className:"neural-avatar-frame",children:L.jsxs("div",{className:"neural-avatar",children:[L.jsx(kv,{className:"neural-avatar-icon",size:66,strokeWidth:1.3}),L.jsx("span",{className:"neural-visor"})]})})]}),L.jsxs("div",{className:"neural-copy",children:[L.jsx("strong",{children:"正在唤醒工作区"}),L.jsx("span",{children:g})]}),L.jsx("div",{className:"neural-progress","aria-hidden":"true",children:L.jsx("span",{})}),L.jsxs("div",{className:"neural-meta","aria-hidden":"true",children:[L.jsx("span",{children:"AGENT CORE"}),L.jsxs("span",{className:"neural-meta-time",children:["T+",eR(o,c).toString().padStart(2,"0"),"S"]})]}),t&&L.jsx("button",{type:"button",className:"neural-retry","aria-label":"重试连接",title:"重试连接",onClick:()=>n==null?void 0:n(),children:L.jsx(Mv,{size:18,"aria-hidden":"true"})})]})]})}const tR=`
172
+ `);T=co(I).trim()}catch{}}T?this.dispatch(t,{type:"text_chunk",text:T}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}}},A}rememberNativeStreamCursor(t,n,o){const c=this.nativeStreamCursors.get(t);if(c&&(c.runId===o||!o)&&n<c.sequence)return;const h=o??(c==null?void 0:c.runId);this.nativeStreamCursors.set(t,{sequence:n,...h?{runId:h}:{}})}acceptNativeStreamEvent(t,n,o){const c=this.nativeStreamCursors.get(t);return c&&(c.runId===o||!o)&&n<=c.sequence?!1:(this.rememberNativeStreamCursor(t,n,o),!0)}snapshotRunMatchesHistoryTurn(t){var c,u;if(typeof t.snapshotTurnId!="string"||!t.snapshotTurnId||!Array.isArray(t.messages))return!0;const n=t.messages.slice().reverse().find(h=>(h==null?void 0:h.role)==="user"),o=(u=(c=n==null?void 0:n.presentation)==null?void 0:c.executionTrace)==null?void 0:u.turnId;return typeof o!="string"||o===t.snapshotTurnId}coreSnapshotContainsTailFinalAnswer(t){if(!Array.isArray(t))return!1;let n=-1;for(let o=t.length-1;o>=0;o-=1){const c=t[o];if(typeof c=="object"&&c!==null&&c.role==="user"){n=o;break}}return t.slice(n+1).some(o=>{var u;if(typeof o!="object"||o===null)return!1;const c=o;return c.role==="assistant"&&((u=c.presentation)==null?void 0:u.agentMessagePhase)==="final_answer"})}rememberNativeFinalAnswerSnapshot(t,n,o){const c=this.nativeFinalAnswerSnapshots.get(t);(c==null?void 0:c.runId)===o&&c.sequence>=n||this.nativeFinalAnswerSnapshots.set(t,{runId:o,sequence:n})}isNativeFinalAnswerCoveredBySnapshot(t,n,o,c){const u=this.nativeFinalAnswerSnapshots.get(t);return!u||!c?!1:n.type==="text_chunk"&&n.messagePhase==="final_answer"&&u.runId===c&&o<=u.sequence}closeStream(t){this.flushBufferedStreamText(t);const n=this.streams.get(t);n&&(n.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}async function d9(e,t){const n=new URL(e,"http://event-source.local"),o=n.searchParams.get("sessionId");if(!(o!=null&&o.startsWith("runtime:"))||n.searchParams.has("afterSequence"))return e;const c=await t(o);if(!Number.isSafeInteger(c.snapshotRevision)||Number(c.snapshotRevision)<0)throw new Error("无法确定运行事件的恢复位置,请重试");return n.searchParams.set("afterSequence",String(c.snapshotRevision)),typeof c.snapshotRunId=="string"&&c.snapshotRunId&&n.searchParams.set("afterRunId",c.snapshotRunId),e.startsWith("/")?`${n.pathname}${n.search}${n.hash}`:n.href}class h9{constructor(t){this.options=t,this.active=new Set,this.queue=[],this.maxConnections=Math.max(1,Math.floor(t.maxConnections??3)),this.leaseMs=Math.max(1,t.leaseMs??1e3),this.yieldMs=Math.max(1,t.yieldMs??25),this.timers=t.timers??globalThis}open(t,n){const o=new g9(this,t);return Promise.resolve().then(async()=>{if(!o.closed)try{o.resumeUrl=n?await n():t,o.closed||this.enqueue(o)}catch{o.fail()}}),o}enqueue(t){t.closed||this.queue.includes(t)||this.active.has(t)||(this.queue.push(t),this.schedulePump())}schedulePump(){this.pumpTimer!==void 0||!this.queue.length||(this.pumpTimer=this.timers.setTimeout(()=>{for(this.pumpTimer=void 0;this.active.size<this.maxConnections&&this.queue.length;){const t=this.queue.shift();t.closed||(this.active.add(t),t.connect(this.options.createEventSource),this.active.has(t)&&this.scheduleLease(t))}},this.yieldMs))}scheduleLease(t){t.leaseTimer=this.timers.setTimeout(()=>{t.leaseTimer=void 0,!(!this.active.has(t)||t.closed)&&(this.queue.length&&t.resumable?(this.release(t),this.enqueue(t)):this.scheduleLease(t))},this.leaseMs)}release(t){t.leaseTimer!==void 0&&this.timers.clearTimeout(t.leaseTimer),t.leaseTimer=void 0,this.active.delete(t);const n=this.queue.indexOf(t);n!==-1&&this.queue.splice(n,1),t.disconnect(),this.schedulePump(),!this.active.size&&!this.queue.length&&this.pumpTimer!==void 0&&(this.timers.clearTimeout(this.pumpTimer),this.pumpTimer=void 0)}}class g9 extends EventTarget{constructor(t,n){super(),this.pool=t,this.url=n,this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,this.withCredentials=!1,this.onopen=null,this.onerror=null,this.onmessage=null,this.readyState=0,this.closed=!1,this.physical=null,this.generation=0,this.retiredRuns=new Set,this.resumeUrl=n}get resumable(){const t=new URL(this.resumeUrl,"http://event-source.local").searchParams;return t.has("afterSequence")||t.has("afterEventId")}connect(t){if(this.closed)return;const n=++this.generation;let o;try{o=t(this.resumeUrl)}catch{this.fail();return}this.physical=o;const c=()=>!this.closed&&n===this.generation&&this.physical===o;o.onopen=()=>{var u;c()&&(this.readyState=this.OPEN,(u=this.onopen)==null||u.call(this,new Event("open")),c()&&this.dispatchEvent(new Event("open")))},o.onmessage=u=>{var h;!c()||!this.rememberCursor(u.lastEventId)||((h=this.onmessage)==null||h.call(this,u),c()&&this.dispatchEvent(new MessageEvent("message",{data:u.data,lastEventId:u.lastEventId,origin:u.origin})))},o.onerror=u=>{var h;c()&&(o.readyState===this.CLOSED?(this.closed=!0,this.readyState=this.CLOSED,this.pool.release(this)):this.readyState=this.CONNECTING,(h=this.onerror)==null||h.call(this,u),this.dispatchEvent(new Event("error")))}}rememberCursor(t){var o;if(!t)return!0;const n=new URL(this.resumeUrl,"http://event-source.local");if((o=n.searchParams.get("sessionId"))!=null&&o.startsWith("runtime:")){const c=t.lastIndexOf(":"),u=c>0?t.slice(0,c):"",h=Number(c>0?t.slice(c+1):t);if(!Number.isSafeInteger(h)||h<0||u&&this.retiredRuns.has(u))return!1;const x=n.searchParams.get("afterRunId"),w=Number(n.searchParams.get("afterSequence"));if((!u||!x||u===x)&&n.searchParams.has("afterSequence")&&h<=w)return!1;u&&x&&u!==x&&this.retiredRuns.add(x),u&&n.searchParams.set("afterRunId",u),n.searchParams.set("afterSequence",String(h))}else{const c=Number(t);if(!Number.isSafeInteger(c)||c<0||n.searchParams.has("afterEventId")&&c<=Number(n.searchParams.get("afterEventId")))return!1;n.searchParams.set("afterEventId",String(c))}return this.resumeUrl=this.resumeUrl.startsWith("/")?`${n.pathname}${n.search}${n.hash}`:n.href,!0}disconnect(){++this.generation;const t=this.physical;this.physical=null,t&&(t.onopen=t.onmessage=t.onerror=null,t.close()),this.closed||(this.readyState=this.CONNECTING)}fail(){var n;if(this.closed)return;this.close();const t=new Event("error");(n=this.onerror)==null||n.call(this,t),this.dispatchEvent(t)}close(){this.closed||(this.closed=!0,this.readyState=this.CLOSED,this.pool.release(this))}}const _f="__agentroamBoundedRunSourcesV1";function p9(e=window){var n;let t=e;try{((n=e.top)==null?void 0:n.location.origin)===e.location.origin&&(t=e.top)}catch{}return t[_f]??(t[_f]=new h9({createEventSource:o=>new t.EventSource(o),timers:t}))}function Wv(e){return Number.isFinite(e.width)&&e.width>=900&&!e.nativeApp&&!e.coarsePointer&&!/Android|iPhone|iPad|iPod|IEMobile|Opera Mini|Mobile/i.test(e.userAgent)}function t2(){return typeof window<"u"&&Tx()&&Wv({width:window.innerWidth,userAgent:navigator.userAgent,coarsePointer:window.matchMedia("(pointer: coarse)").matches,nativeApp:document.body.dataset.nativeApp==="1"})}function H_(){const[e,t]=ce.useState(t2);return ce.useEffect(()=>{const n=()=>t(t2()),o=window.matchMedia("(pointer: coarse)");return n(),window.addEventListener("resize",n),o.addEventListener("change",n),()=>{window.removeEventListener("resize",n),o.removeEventListener("change",n)}},[]),e}class m9{constructor(t,n){this.emit=n,this.sum=0,this.weight=0,this.frame=new Float32Array(1600),this.offset=0,this.ratio=t/16e3}push(t){if(t.length)for(let n=0;n<t[0].length;n++){let o=0;for(const u of t)o+=u[n]/t.length;let c=1;for(;c>1e-9;){const u=Math.min(c,this.ratio-this.weight);this.sum+=o*u,this.weight+=u,c-=u,this.weight>=this.ratio-1e-9&&(this.frame[this.offset++]=this.sum/this.ratio,this.weight=0,this.sum=0,this.offset===this.frame.length&&this.flush())}}}flush(){this.offset&&(this.emit(this.frame.slice(0,this.offset).buffer),this.offset=0)}}class x9{constructor(t){this.environment=t,this.active=null,this.generation=0,this.results=new Set,this.errors=new Set,window.addEventListener("pagehide",()=>this.complete(this.active)),document.addEventListener("visibilitychange",()=>{document.hidden&&this.complete(this.active)})}onDictation(t){return this.results.add(t),()=>{this.results.delete(t)}}onDictationError(t){return this.errors.add(t),()=>{this.errors.delete(t)}}async dictationStart(){var n,o,c,u,h;if(this.active)return{ok:!1,reason:"语音输入尚未结束"};if(!window.isSecureContext||!((n=navigator.mediaDevices)!=null&&n.getUserMedia))return{ok:!1,reason:"语音输入需要 HTTPS 地址和麦克风权限"};const t={state:"starting",sessionId:crypto.randomUUID(),generation:++this.generation,committed:"",interim:"",utterances:new Set};this.active=t;try{const x=((c=(o=this.environment).createContext)==null?void 0:c.call(o))??new AudioContext;t.context=x;const w=(((h=(u=this.environment).getUserMedia)==null?void 0:h.call(u))??navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})).then(C=>{if(this.active!==t){for(const b of C.getTracks())b.stop();throw new Error("语音输入已取消")}t.stream=C}),m=Promise.all([w,this.connect(t),x.resume().then(()=>this.prepareProcessor(t))]);return await Promise.race([m,new Promise(C=>{t.cancelStartup=C}),new Promise((C,b)=>{t.startupTimer=setTimeout(()=>b(new Error("麦克风启动超时,请检查权限后重试")),1e4)})]),clearTimeout(t.startupTimer),this.active!==t?{ok:!1}:(t.source=x.createMediaStreamSource(t.stream),t.source.connect(t.node),t.node.connect(x.destination),t.state="capturing",{ok:!0})}catch(x){if(this.active!==t)return{ok:!1};const w=x instanceof Error&&x.name==="NotAllowedError"?"麦克风权限未开启,请在浏览器网站设置中允许麦克风":x instanceof Error?x.message:"无法启动语音输入";return this.release(t),{ok:!1,reason:w}}}async dictationStop(){var n,o,c;const t=this.active;if(!t)return{ok:!0};if(t.state==="starting")return this.complete(t),{ok:!0};if(t.state==="draining")return await t.stopped,{ok:!0};t.state="draining",t.stopped=new Promise(u=>{t.resolveStopped=u});for(const u of((n=t.stream)==null?void 0:n.getTracks())??[])u.stop();(o=t.source)==null||o.disconnect(),clearTimeout(t.timer),t.timer=setTimeout(()=>this.fail(t,"语音识别收尾超时,已保留当前文字"),12e3);try{await((c=t.flushAudio)==null?void 0:c.call(t)),this.releaseMicrophone(t),this.active===t&&t.socket.send(JSON.stringify({type:"finish",sessionId:t.sessionId,generation:t.generation}))}catch{this.fail(t,"语音输入收尾失败,已保留当前文字")}return await t.stopped,{ok:!0}}async prepareProcessor(t){var x,w;const n=t.context;let o;const c=n.audioWorklet&&await Promise.race([n.audioWorklet.addModule(new URL("./dictation-audio-worklet.js",location.href).href).then(()=>!0,()=>!1),new Promise(m=>{o=setTimeout(()=>m(!1),1500)})]);if(clearTimeout(o),this.active!==t)return;if(c){const m=((w=(x=this.environment).createWorklet)==null?void 0:w.call(x,n))??new AudioWorkletNode(n,"dictation-capture");t.node=m;let C;m.port.onmessage=({data:b})=>{this.active===t&&(b.type==="pcm"&&b.pcm instanceof ArrayBuffer&&this.sendPcm(t,b.pcm),b.type==="flushed"&&(C==null||C()))},t.flushAudio=()=>new Promise((b,A)=>{const T=setTimeout(()=>A(new Error("Audio flush timed out")),500);C=()=>{clearTimeout(T),b()},t.cancelFlush=C,m.port.postMessage({type:"flush"})}),m.onprocessorerror=()=>this.fail(t,"麦克风音频处理失败,请重新开始"),t.clearProcessor=()=>{m.port.onmessage=null,m.onprocessorerror=null};return}const u=n.createScriptProcessor(2048,1,1),h=new m9(n.sampleRate,m=>this.sendPcm(t,m));u.onaudioprocess=m=>{m.outputBuffer.getChannelData(0).fill(0),h.push([m.inputBuffer.getChannelData(0)])},t.node=u,t.flushAudio=async()=>{u.onaudioprocess=null,h.flush()},t.clearProcessor=()=>{u.onaudioprocess=null}}sendPcm(t,n){var o;if(this.active===t){if(((o=t.socket)==null?void 0:o.readyState)!==WebSocket.OPEN){this.fail(t,"语音连接已断开");return}if(t.socket.bufferedAmount>128*1024){this.fail(t,"网络过慢,语音输入已停止");return}t.socket.send(n)}}async connect(t){const n=await this.environment.openSocket();if(this.active!==t){n.close();return}return t.socket=n,new Promise((o,c)=>{t.ready=o,t.rejectReady=c,t.timer=setTimeout(()=>c(new Error("本机语音服务连接超时")),8e3);const u=()=>n.send(JSON.stringify({type:"start",mode:"dictation",sampleRate:16e3,sessionId:t.sessionId,generation:t.generation}));n.addEventListener("open",u,{once:!0}),n.addEventListener("message",({data:x})=>{if(this.active!==t)return;let w;try{w=JSON.parse(String(x))}catch{this.fail(t,"语音服务返回无效数据");return}if(w.type==="error"){this.fail(t,typeof w.message=="string"?w.message:"语音识别失败");return}if(!(w.sessionId!==t.sessionId||w.generation!==t.generation)){if(w.type==="ready"){clearTimeout(t.timer),o();return}(w.type==="partial"||w.type==="final")&&typeof w.text=="string"&&(w.type==="partial"?t.interim=w.text:Number.isSafeInteger(w.utteranceId)&&!t.utterances.has(Number(w.utteranceId))&&(t.utterances.add(Number(w.utteranceId)),t.committed=this.join(t.committed,w.text),t.interim=""),this.emit({text:this.join(t.committed,t.interim),isFinal:!1})),w.type==="finished"&&this.complete(t)}});const h=()=>this.fail(t,"语音连接已断开,已保留当前文字");n.addEventListener("error",h),n.addEventListener("close",h),n.readyState===WebSocket.OPEN&&u()})}join(t,n){return t+(/[a-z0-9]$/i.test(t)&&/^[a-z0-9]/i.test(n)?" ":"")+n}emit(t){for(const n of this.results)n(t)}complete(t){if(!t||this.active!==t)return;const n=this.join(t.committed,t.interim);this.release(t),this.emit({text:n,isFinal:!0})}fail(t,n){var o;if(this.active===t){(o=t.rejectReady)==null||o.call(t,new Error(n)),this.release(t);for(const c of this.errors)c(n)}}releaseMicrophone(t){var n,o,c,u,h;if(!t.microphoneReleased){if(t.microphoneReleased=!0,t.state!=="draining")for(const x of((n=t.stream)==null?void 0:n.getTracks())??[])x.stop();(o=t.clearProcessor)==null||o.call(t),(c=t.source)==null||c.disconnect(),(u=t.node)==null||u.disconnect(),(h=t.context)==null||h.close().catch(()=>{})}}release(t){var n,o,c,u,h;this.active===t&&(this.active=null),clearTimeout(t.timer),clearTimeout(t.startupTimer),(n=t.cancelStartup)==null||n.call(t),(o=t.cancelFlush)==null||o.call(t),(c=t.resolveStopped)==null||c.call(t),(u=t.ready)==null||u.call(t),this.releaseMicrophone(t),(h=t.socket)==null||h.close()}}const al="webapp.settings.v1";class w9{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(al)??"{}")}catch{t={}}return this.cached={...this.defaults(),...t},this.cached}save(t){const n=this.get();this.cached={...n,...t},t.profiles&&!t.activeProfileId&&(this.cached.activeProfileId=n.activeProfileId),localStorage.setItem(al,JSON.stringify(this.cached))}setActiveProfile(t){const n=this.get();this.cached={...n,activeProfileId:t},localStorage.setItem(al,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const n=this.get(),o=n.profiles.find(x=>x.id==="server-managed");if(!o||o.apiKey!=="managed"||o.modelId===t.modelId&&o.provider===(t.provider||"openai"))return;const c=t.modelId,u=t.provider||"openai",h=t.baseUrl||"";this.cached={...n,profiles:n.profiles.map(x=>x.id==="server-managed"?{...x,name:`服务端 · ${c}`,provider:u,modelId:c,baseUrl:h}:x),modelProvider:u,modelId:c,baseUrl:h||n.baseUrl},localStorage.setItem(al,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),n=t.profiles.find(x=>x.id===t.activeProfileId)??null,o=(n==null?void 0:n.provider)??t.modelProvider,c=(n==null?void 0:n.apiKey)??t.apiKey,u=(n==null?void 0:n.modelId)??t.modelId,h=(n==null?void 0:n.baseUrl)??t.baseUrl;return!c||c==="managed"||!u||u==="server"?null:{provider:o,apiKey:c,modelId:u,...h?{baseUrl:h}:{},...(n==null?void 0:n.requestTimeoutSeconds)===void 0?{}:{requestTimeoutSeconds:n.requestTimeoutSeconds}}}getReasoningEffort(){const t=this.get().reasoningEffort;return["off","low","medium","high"].includes(t)?t:"off"}getRunLimits(){const t=this.get(),n=Number(t.maxIterations),o=Number.isFinite(n)&&n>=0?Math.trunc(n):10,c=Math.min(2e3,Math.max(8,Math.trunc(Number(t.contextWindow)||100)));return{maxIterations:o,maxTokens:c*1e3}}defaults(){const t={id:"server-managed",name:"服务端托管",provider:"openai",modelId:"server",apiKey:"managed",baseUrl:""};return{modelProvider:t.provider,modelId:t.modelId,apiKey:t.apiKey,baseUrl:"",maxIterations:10,contextWindow:100,workingDirectory:"/",profiles:[t],activeProfileId:t.id,reasoningEffort:"off"}}}function v9(e){return e.toString(16).padStart(2,"0")}function y9(e){const t=e.getRandomValues(new Uint8Array(16));t[6]=t[6]&15|64,t[8]=t[8]&63|128;const n=Array.from(t,v9);return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10,16).join("")].join("-")}function E9(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>y9(e)})}const Of="agent-webapp:tab-swipe:v1",C9=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(","),r2=24;function b9(e){return!e||typeof e.closest!="function"?!1:!!e.closest(C9)}function A9(e){let t=null;const n=o=>t!==null&&o.pointerType==="touch"&&o.pointerId===t.pointerId;return{pointerDown(o){o.pointerType!=="touch"||!o.isPrimary||o.interactive||!(o.clientX<=r2||o.clientX>=o.viewportWidth-r2)||(t={pointerId:o.pointerId,startX:o.clientX,startY:o.clientY,axis:"pending"})},pointerMove(o){if(!n(o)||!t)return!1;const c=o.clientX-t.startX,u=o.clientY-t.startY;if(t.axis==="pending"){if(Math.max(Math.abs(c),Math.abs(u))<=8)return!1;if(Math.abs(u)>=Math.abs(c)*1.2)return t=null,!1;t.axis="horizontal"}return e({type:Of,phase:"move",deltaX:c}),!0},pointerUp(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Of,phase:"end",deltaX:o.clientX-t.startX}),t=null,c},pointerCancel(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Of,phase:"cancel",deltaX:0}),t=null,c}}}function S9(){if(window.parent===window)return()=>{};const e=A9(h=>{window.parent.postMessage(h,window.location.origin)}),t=h=>({pointerId:h.pointerId,pointerType:h.pointerType,isPrimary:h.isPrimary,clientX:h.clientX,clientY:h.clientY,viewportWidth:window.innerWidth}),n=h=>{e.pointerDown({...t(h),interactive:b9(h.target)})},o=h=>{e.pointerMove(t(h))&&h.preventDefault()},c=h=>{e.pointerUp(t(h))&&h.preventDefault()},u=h=>{e.pointerCancel(t(h))};return document.addEventListener("pointerdown",n,{capture:!0}),document.addEventListener("pointermove",o,{capture:!0,passive:!1}),document.addEventListener("pointerup",c,{capture:!0,passive:!1}),document.addEventListener("pointercancel",u,{capture:!0}),()=>{document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",o,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",u,{capture:!0})}}const I9="agent-web-shell:skin:v1",T9=["pearl","scifi","noir","mist","pine","graphite","glass"];function R9(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const n=t.data;if(!n||typeof n!="object"||n.type!==I9||typeof n.skin!="string"||!T9.includes(n.skin))return;const o=Ci.getState();o.skin!==n.skin&&o.setSkin(n.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}function _9(){if(window.parent===window)return()=>{};const e=n=>{if(n.origin!==window.location.origin||n.source!==window.parent)return;const o=v5(n.data);if(o){document.body.dataset.webShellEmbedded="1";const c=Ci.getState();c.navigationLayout!==o&&c.setNavigationLayout(o)}},t=n=>{n.storageArea&&n.storageArea!==window.localStorage||n.key!==null&&n.key!==Ci.persist.getOptions().name||Ci.persist.rehydrate()};return window.addEventListener("message",e),window.addEventListener("storage",t),()=>{window.removeEventListener("message",e),window.removeEventListener("storage",t),delete document.body.dataset.webShellEmbedded}}const O9="agentroam:open-browser-live",X1="agent-web-shell:open-browser-live:v1";function N9(e){return!e||typeof e!="object"||e.type!==X1?null:{type:X1}}function G_(e,t,n){return e.origin!==t||e.source!==n?null:N9(e.data)}function k9(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const n=t.data;!n||typeof n!="object"||n.type!==X1||window.dispatchEvent(new CustomEvent(O9))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const M9="agent-webapp:ready:v1";function D9(){window.parent!==window&&window.parent.postMessage({type:M9},window.location.origin)}function P9(){if(window.parent!==window)try{if(window.parent.location.origin===window.location.origin){window.parent.location.reload();return}}catch{}window.location.reload()}const $v="agent-webapp:project-request:v1",L9="agent-web-shell:project-response:v1",B9=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"],F9=new Set([...B9,"fs:preview-open","fs:preview-close"]);function U9(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==$v||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.method!="string"||!F9.has(t.method)||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)?null:t}function X_(e,t,n){return e.origin!==t||e.source!==n?null:U9(e.data)}function j9(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==L9||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class W9{constructor(t=window,n=15e3){this.context=t,this.timeoutMs=n,this.sequence=0,this.pending=new Map,this.onMessage=o=>{if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=j9(o.data);if(!c)return;const u=this.pending.get(c.id);u&&(this.pending.delete(c.id),clearTimeout(u.timer),c.ok?u.resolve(c.result):u.reject(Object.assign(new Error(c.error||"项目操作失败"),{code:c.code})))},this.context.addEventListener("message",this.onMessage)}request(t,n={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"}));const o=++this.sequence;return new Promise((c,u)=>{const h=setTimeout(()=>{this.pending.delete(o),u(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:u,timer:h}),this.context.parent.postMessage({type:$v,id:o,method:t,payload:n},this.context.location.origin)})}dispose(){this.context.removeEventListener("message",this.onMessage);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(Object.assign(new Error("项目桥已关闭"),{code:"WEB_SHELL_CLOSED"}));this.pending.clear()}}const zv="agent-webapp:browser-request:v1",$9="agent-web-shell:browser-response:v1",z9="agent-web-shell:browser-event:v1",V9="agent-web-shell:browser-frame:v1",H9=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc","browser:system"],G9=new Set(H9);function X9(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==zv||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.method!="string"||!G9.has(t.method)||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)?null:t}function Y_(e,t,n){return e.origin!==t||e.source!==n?null:X9(e.data)}function Y9(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==$9||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function K9(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==z9||!t.event||typeof t.event!="object")return null;const n=t.event;return typeof n.type!="string"||!n.type.startsWith("browser:")?null:t}function Z9(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==V9||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class Q9{constructor(t=window,n=15e3){this.context=t,this.timeoutMs=n,this.sequence=0,this.pending=new Map,this.listeners=new Set,this.sessionsByChannel=new Map,this.pendingFramesByChannel=new Map,this.onMessage=o=>{var w;if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=Z9(o.data);if(c){const m=this.sessionsByChannel.get(c.channelId);if(!m){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,m);return}const u=K9(o.data);if(u){if(u.event.type==="browser:connection"){this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear();for(const m of this.pending.values())clearTimeout(m.timer),m.reject(Object.assign(new Error("远程连接已变化,请重新接管"),{code:"EOFFLINE"}));this.pending.clear()}for(const m of this.listeners)m(u.event);return}const h=Y9(o.data);if(!h)return;const x=this.pending.get(h.id);if(x)if(this.pending.delete(h.id),clearTimeout(x.timer),h.ok){if(x.method==="browser:watch"&&h.result&&typeof h.result=="object"){const m=h.result;if(Number.isSafeInteger(m.channelId)&&typeof((w=m.session)==null?void 0:w.id)=="string"){const C=Number(m.channelId);this.sessionsByChannel.set(C,m.session.id);const b=this.pendingFramesByChannel.get(C);b&&(this.pendingFramesByChannel.delete(C),this.emitBinaryFrame(b,m.session.id))}}x.resolve(h.result)}else x.reject(Object.assign(new Error(h.error||"浏览器操作失败"),{code:h.code}))},this.context.addEventListener("message",this.onMessage)}emitBinaryFrame(t,n){for(const o of this.listeners)o({type:"browser:frame",sessionId:n,sequence:t.sequence,data:t.data,mime:"image/jpeg",timestamp:Date.now()})}request(t,n={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开浏览器直播"),{code:"WEB_SHELL_REQUIRED"}));const o=++this.sequence;return new Promise((c,u)=>{const h=setTimeout(()=>{this.pending.delete(o),u(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:u,timer:h,method:t}),this.context.parent.postMessage({type:zv,id:o,method:t,payload:n},this.context.location.origin)})}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}dispose(){this.context.removeEventListener("message",this.onMessage);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(Object.assign(new Error("浏览器桥已关闭"),{code:"WEB_SHELL_CLOSED"}));this.pending.clear(),this.listeners.clear(),this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear()}}class ln{constructor(t){this.url=t}static parse(t){const n=t.trim();if(!n)return null;const o=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?n:`http://${n}`;let c;try{c=new URL(o)}catch{return null}return c.protocol!=="http:"&&c.protocol!=="https:"||!c.hostname?null:new ln(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class q9{constructor(t,n,o){this.environment=t,this.storage=n,this.probe=o}async planStartup(){if(!this.environment.isNativeApp())return{mode:"same-origin"};const t=this.launchEndpoint();if(t)return{mode:"ready",endpoint:t};const n=this.storage.load();if(n){const o=await this.probe.probe(n);return o.ok?{mode:"ready",endpoint:n}:{mode:"setup",endpoint:n,failure:o.reason}}return{mode:"setup",endpoint:null}}async connect(t){const n=ln.parse(t);if(!n)return{ok:!1,reason:"地址无效,请输入 http(s)://host:port 形式的服务器地址"};const o=await this.probe.probe(n);return o.ok?(this.storage.save(n),{ok:!0,endpoint:n}):{ok:!1,reason:`无法连接服务器:${o.reason}`}}disconnect(){this.storage.clear()}launchEndpoint(){const t=this.environment.launchServerUrl();return t?ln.parse(t):null}}function n2(){return window.Capacitor??null}class J9{isNativeApp(){var t,n;return((n=(t=n2())==null?void 0:t.isNativePlatform)==null?void 0:n.call(t))??!1}platform(){var n,o;const t=(o=(n=n2())==null?void 0:n.getPlatform)==null?void 0:o.call(n);return t==="ios"||t==="android"?t:"web"}launchServerUrl(){const t=new URLSearchParams(window.location.search).get("server");return t&&t.trim()?t.trim():null}}const Nf="webapp.mobile.serverEndpoint.v1";class Vv{load(){try{const t=localStorage.getItem(Nf);return t?ln.parse(t):null}catch{return null}}save(t){localStorage.setItem(Nf,t.toString())}clear(){localStorage.removeItem(Nf)}}const eR=6e3;class tR{constructor(t=(...n)=>fetch(...n)){this.transport=t}async probe(t,n=eR){const o=new AbortController,c=setTimeout(()=>o.abort(),n);try{const u=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:o.signal});return u.ok?{ok:!0,modelId:(await u.json()).modelId??null}:{ok:!1,reason:u.status===401?"此 App 尚未授权,请扫描电脑上的授权二维码。":u.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":`HTTP ${u.status}`}}catch(u){return{ok:!1,reason:u instanceof DOMException&&u.name==="AbortError"?"连接超时":rR(u)}}finally{clearTimeout(c)}}}function rR(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function nR({id:e,label:t,className:n,disabled:o,children:c,onMove:u}){const[h,x]=ce.useState(null),w=ce.useRef(null),m=ce.useRef(),C=ce.useRef(0),b=()=>{clearTimeout(m.current),document.querySelectorAll(".toolbar-sort-target").forEach(A=>A.classList.remove("toolbar-sort-target")),w.current=null,x(null)};return ce.useEffect(()=>()=>{clearTimeout(m.current)},[]),L.jsx("div",{className:`${n} sortable-toolbar-action${h?" is-dragging":""}`,"data-toolbar-sort-id":e,title:`${t} · 长按拖动排序`,"aria-description":"长按拖动排序,也可按 Alt 加方向键调整顺序",style:h?{transform:`translate(${h.x}px, ${h.y}px)`}:void 0,onContextMenu:A=>A.preventDefault(),onKeyDown:A=>{var X;if(o||!A.altKey||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(A.key))return;const T=Array.from(A.currentTarget.parentElement.querySelectorAll("[data-toolbar-sort-id]")),k=A.key==="ArrowLeft"?-1:A.key==="ArrowRight"?1:A.key==="ArrowUp"?-3:3,M=(X=T[T.indexOf(A.currentTarget)+k])==null?void 0:X.dataset.toolbarSortId;M&&(A.preventDefault(),u(e,M))},onPointerDownCapture:A=>{if(o||A.button!==0||!A.isPrimary)return;const T=A.currentTarget,k={pointer:A.pointerId,x:A.clientX,y:A.clientY,active:!1,target:e,node:T};w.current=k,A.pointerType!=="mouse"&&(m.current=setTimeout(()=>{w.current===k&&(k.active=!0,T.setPointerCapture(k.pointer),x({x:0,y:0}))},260))},onPointerMove:A=>{var N;const T=w.current;if(!T||T.pointer!==A.pointerId)return;const k=A.clientX-T.x,M=A.clientY-T.y;if(!T.active&&A.pointerType==="mouse"&&Math.hypot(k,M)>=6&&(T.active=!0,T.node.setPointerCapture(T.pointer)),!T.active){Math.hypot(k,M)>=10&&b();return}A.preventDefault(),x({x:k,y:M});const X=(N=document.elementFromPoint(A.clientX,A.clientY))==null?void 0:N.closest("[data-toolbar-sort-id]");document.querySelectorAll(".toolbar-sort-target").forEach(I=>I.classList.remove("toolbar-sort-target")),T.target=(X==null?void 0:X.dataset.toolbarSortId)??e,T.target!==e&&(X==null||X.classList.add("toolbar-sort-target"))},onPointerUp:A=>{const T=w.current;!T||T.pointer!==A.pointerId||(T.active&&(C.current=Date.now()+500,T.node.hasPointerCapture(T.pointer)&&T.node.releasePointerCapture(T.pointer),T.target!==e&&u(e,T.target)),b())},onPointerCancel:b,onClickCapture:A=>{Date.now()<C.current&&(A.preventDefault(),A.stopPropagation())},children:c})}const iR={refresh:"刷新页面",dashboard:"进行中的会话",collaboration:"群聊看板",install:"安装应用",remote:"远程桌面","ai-hub":"AI Hub",flow:"数字人",theme:"皮肤",files:"我的文件"};function sR(e){return e.map(t=>t.compactItems??[t]).filter(t=>t.length>0)}function oR(e){return sR(e).flat().filter(t=>t.id!=="files")}function aR({items:e,avatar:t,onReorder:n,sortingDisabled:o=!1}){const[c,u]=ce.useState(!1);ce.useEffect(()=>{A(!1)},[c]),ce.useEffect(()=>{const B=window.matchMedia("(max-width: 899px)"),j=()=>u(B.matches);return j(),B.addEventListener("change",j),()=>B.removeEventListener("change",j)},[]);const h=ce.useRef(null),x=ce.useRef(null),w=ce.useRef(null),[m,C]=ce.useState(null),[b,A]=ce.useState(!1),[T,k]=ce.useState({top:-1e3,left:0}),[M,X]=ce.useState(""),N=(B,j)=>{!n||o||(X(""),n(B,j).catch(U=>X(U instanceof Error?U.message:"顺序保存失败,请重试。")))},I=(B,j)=>L.jsx(nR,{id:B.id,label:iR[B.id]??B.id,className:j,disabled:!n||o,onMove:N,children:O(B)},B.id);ce.useEffect(()=>{var B;C(((B=h.current)==null?void 0:B.closest(".web-root"))??document.body)},[]),ce.useLayoutEffect(()=>{if(!b||c)return;const B=()=>{var z,oe,ve,ie;const U=(z=w.current)==null?void 0:z.getBoundingClientRect();if(!U)return;const F=((oe=x.current)==null?void 0:oe.getBoundingClientRect().width)??Math.min(292,innerWidth-16),Y=((ie=(ve=h.current)==null?void 0:ve.closest(".terminal-tabs"))==null?void 0:ie.getBoundingClientRect().bottom)??U.bottom;k({top:Math.max(U.bottom,Y)+6,left:Math.max(8,Math.min(innerWidth-F-8,U.right-F))})};B();const j=new ResizeObserver(B);return x.current&&j.observe(x.current),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{j.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[b,c]),ce.useEffect(()=>{if(!b)return;const B=U=>{var Y,z;const F=U.target;(Y=h.current)!=null&&Y.contains(F)||(z=x.current)!=null&&z.contains(F)||F instanceof Element&&F.closest("[data-toolbar-overlay]")||A(!1)},j=U=>{var F;U.key==="Escape"&&(A(!1),(F=w.current)==null||F.focus())};return document.addEventListener("pointerdown",B),document.addEventListener("keydown",j),()=>{document.removeEventListener("pointerdown",B),document.removeEventListener("keydown",j)}},[b]);const O=B=>L.jsx("div",{className:"toolbar-slot","data-toolbar-item":B.id,onClick:B.id==="remote"?()=>A(!1):void 0,children:B.content},B.id);if(!c){const B=["files","remote"].flatMap(U=>e.filter(F=>F.id===U)),j=e.filter(U=>!["files","remote"].includes(U.id));return L.jsxs("div",{ref:h,className:"responsive-toolbar glass-desktop-toolbar",children:[L.jsxs("div",{className:"glass-desktop-actions",children:[B.map(O),j.length>0&&L.jsx("button",{ref:w,type:"button",className:"file-drawer-toggle","aria-label":"更多功能",title:"更多功能","aria-haspopup":"dialog","aria-expanded":b,onClick:()=>A(U=>!U),children:L.jsx(Kp,{size:20})})]}),L.jsx("div",{className:"toolbar-avatar",onPointerDown:()=>A(!1),children:t}),m&&fc.createPortal(L.jsxs("div",{ref:x,hidden:!b,className:"glass-desktop-menu",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,style:{position:"fixed",top:T.top,left:T.left,zIndex:200},children:[j.map(U=>I(U,"toolbar-sort-cell")),M&&L.jsx("p",{className:"toolbar-sort-error",role:"alert",children:M})]}),m)]})}{const B=L.jsx("div",{className:"glass-mobile-actions",style:{display:"flex",alignItems:"center",gap:4},children:L.jsx("button",{ref:w,type:"button",className:"file-drawer-toggle ui-icon-button","aria-haspopup":"dialog","aria-label":"更多功能","aria-expanded":b,onClick:()=>A(j=>!j),children:L.jsx(Kp,{size:20})})});return L.jsxs("div",{ref:h,className:"responsive-toolbar glass-mobile-toolbar",children:[e.filter(j=>j.id==="files").map(O),B,L.jsx("div",{className:"toolbar-avatar",children:t}),m&&fc.createPortal(L.jsx("div",{hidden:!b,className:"glass-tools-backdrop",onClick:()=>A(!1),children:L.jsxs("section",{ref:x,className:"glass-tools-sheet",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,onClick:j=>j.stopPropagation(),children:[L.jsxs("header",{children:[L.jsxs("div",{children:[L.jsx("strong",{children:"更多功能"}),L.jsx("small",{children:"长按拖动排序"})]}),L.jsx("button",{type:"button","aria-label":"关闭更多功能",onClick:()=>{var j;A(!1),(j=w.current)==null||j.focus()},children:"×"})]}),L.jsx("div",{className:"glass-tools-grid",children:oR(e).map(j=>I(j,"glass-tool-cell"))}),M&&L.jsx("p",{className:"toolbar-sort-error",role:"alert",children:M})]})}),m)]})}}function lR(e,t){return Math.max(0,Math.floor((t-e)/1e3))}function W0({ready:e=!1,error:t,onRetry:n}){const[o]=ce.useState(Date.now),[c,u]=ce.useState(Date.now);ce.useEffect(()=>{if(e||t)return;const x=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(x)},[e,t]);const h=t||"数字人核心正在就绪";return L.jsxs("main",{className:`neural-boot${e?" is-ready":""}${t?" is-error":""}`,role:t?"alert":"status","aria-live":"polite","aria-busy":!e&&!t,"aria-hidden":e,children:[L.jsx("div",{className:"neural-grid","aria-hidden":"true"}),L.jsx("div",{className:"neural-rail neural-rail-left","aria-hidden":"true"}),L.jsx("div",{className:"neural-rail neural-rail-right","aria-hidden":"true"}),L.jsxs("section",{className:"neural-content",children:[L.jsxs("div",{className:"neural-brand","aria-hidden":"true",children:[L.jsx("span",{className:"neural-brand-signal"}),L.jsx("span",{children:"AgentRoam"}),L.jsx("small",{children:"NEURAL LINK"})]}),L.jsxs("div",{className:"neural-portrait","aria-hidden":"true",children:[L.jsx("span",{className:"neural-ring neural-ring-outer"}),L.jsx("span",{className:"neural-ring neural-ring-inner"}),L.jsx("span",{className:"neural-axis neural-axis-x"}),L.jsx("span",{className:"neural-axis neural-axis-y"}),L.jsx("span",{className:"neural-node neural-node-one"}),L.jsx("span",{className:"neural-node neural-node-two"}),L.jsx("span",{className:"neural-node neural-node-three"}),L.jsx("span",{className:"neural-node neural-node-four"}),L.jsx("div",{className:"neural-avatar-frame",children:L.jsxs("div",{className:"neural-avatar",children:[L.jsx(Mv,{className:"neural-avatar-icon",size:66,strokeWidth:1.3}),L.jsx("span",{className:"neural-visor"})]})})]}),L.jsxs("div",{className:"neural-copy",children:[L.jsx("strong",{children:"正在唤醒工作区"}),L.jsx("span",{children:h})]}),L.jsx("div",{className:"neural-progress","aria-hidden":"true",children:L.jsx("span",{})}),L.jsxs("div",{className:"neural-meta","aria-hidden":"true",children:[L.jsx("span",{children:"AGENT CORE"}),L.jsxs("span",{className:"neural-meta-time",children:["T+",lR(o,c).toString().padStart(2,"0"),"S"]})]}),t&&L.jsx("button",{type:"button",className:"neural-retry","aria-label":"重试连接",title:"重试连接",onClick:()=>n==null?void 0:n(),children:L.jsx(Dv,{size:18,"aria-hidden":"true"})})]})]})}const cR=`
173
173
  .web-appearance-controls { display: flex; align-items: center; gap: 4px; }
174
174
  .web-root.is-remote-fullscreen > .terminal-tabs { display: none; }
175
175
  .web-root.is-remote-fullscreen .tree-col,
@@ -458,14 +458,14 @@ Error generating stack: `+u.message+`
458
458
  .drawer-mask { display: none; }
459
459
  }
460
460
  .web-root.is-remote-fullscreen .workspace { grid-template-columns: minmax(0, 1fr); }
461
- `,hi=e=>e,rR=[hi({id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}}),hi({id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}}),hi({id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}}),hi({id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}}),hi({id:"glass",label:"毛玻璃",swatch:"#c3dbee",preview:["#c3dbee","#357b88"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#edf3f4","--ui-text":"#263e48","--ui-tabbar-bg":"#e0ebee","--ui-tabbar-border":"#d3e1e5","--ui-tab-bg":"#e5eef1","--ui-tab-text":"#58727c","--ui-tab-active-bg":"#edf3f4","--ui-tab-active-text":"#263e48","--ui-tab-accent":"#357b88","--ui-connection-bg":"#e0ebee","--ui-connection-text":"#58727c","--ui-tree-bg":"#e5eef1","--ui-tree-border":"#d3e1e5","--ui-term-col-bg":"#edf3f4","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d3e1e5","--ui-muted-surface":"#e5eef1","--ui-muted-border":"#d3e1e5","--ui-muted-text":"#58727c","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#263e48","--ui-panel-input-border":"#d3e1e5","--ui-drawer-tab-text":"#58727c","--ui-drawer-tab-active":"#263e48","--ui-history-item-text":"#263e48","--ui-history-meta":"#58727c","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e0ebee",border:"#d3e1e5",keyBg:"#ffffff",keyBorder:"#d3e1e5",keyText:"#58727c",accent:"#357b88",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#263e48",cursor:"#357b88",selectionBackground:"#d6dcf4",black:"#263e48",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#58727c",brightBlack:"#58727c",brightWhite:"#edf3f4"}}),hi({id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}}),hi({id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}})],nR="pearl",al=Object.fromEntries(rR.map(e=>[e.id,e])),iR={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function sR(e){if(e&&e in al)return al[e];const t=e?iR[e]:void 0;return t?al[t]:al[nR]}const $0={"customer-agent":"Customer Agent",codex:"Codex","claude-code":"Claude Code",opencode:"OpenCode","deepseek-harness":"DeepSeek Harness",qoder:"Qoder",zcode:"ZCode",workbuddy:"WorkBuddy",copilot:"VS Code Copilot"},oR=[{prompt:"带我熟悉这个项目",Icon:N9},{prompt:"帮我排查一个问题",Icon:V9},{prompt:"一起实现一个新想法",Icon:B9}];function aR(e){return e>=5&&e<9?{title:"早啊。",prompt:"新的一天,想做点什么?"}:e>=9&&e<12?{title:"上午好。",prompt:"今天想一起做点什么?"}:e>=12&&e<14?{title:"中午好。",prompt:"想趁午休推进点什么?"}:e>=14&&e<18?{title:"下午好。",prompt:"这个下午,想做点什么?"}:e>=18&&e<23?{title:"晚上好。",prompt:"今晚想一起做点什么?"}:{title:"夜深了。",prompt:"注意休息,重要的事可以先留给我。"}}function lR({agentType:e,ready:t,connectionRequired:n=!1,now:o,onSelectPrompt:c}){const u=$0[e],g=aR((o??new Date).getHours());return L.jsxs("section",{className:"empty-session-welcome","aria-labelledby":"empty-session-welcome-title",children:[L.jsxs("div",{className:"empty-session-welcome__core","aria-hidden":"true",children:[L.jsx("span",{className:"empty-session-welcome__glow"}),L.jsxs("svg",{viewBox:"0 0 120 120",role:"presentation",children:[L.jsx("circle",{className:"empty-session-welcome__orbit empty-session-welcome__orbit--outer",cx:"60",cy:"60",r:"44"}),L.jsx("circle",{className:"empty-session-welcome__orbit empty-session-welcome__orbit--inner",cx:"60",cy:"60",r:"33"}),L.jsx("rect",{className:"empty-session-welcome__diamond",x:"43",y:"43",width:"34",height:"34",rx:"2"}),L.jsx("circle",{className:"empty-session-welcome__pulse",cx:"60",cy:"60",r:"3"})]})]}),L.jsxs("div",{className:"empty-session-welcome__copy",children:[L.jsx("p",{className:"empty-session-welcome__status",children:n?`${u} · 等待连接`:t?`${u} · 已准备好`:`${u} · 等待配置`}),L.jsx("h2",{id:"empty-session-welcome-title",children:g.title}),L.jsx("p",{className:"empty-session-welcome__prompt",children:n?"扫码连接电脑后,就能开始。":t?g.prompt:"配置好 API Key 后,我就能开始。"})]}),L.jsx("div",{className:"empty-session-welcome__starters","aria-label":"开始一个任务",children:oR.map(({prompt:x,Icon:w})=>L.jsxs("button",{type:"button","data-prompt":x,disabled:!t,onClick:()=>c(x),children:[L.jsx(w,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),L.jsx("span",{children:x})]},x))})]})}const cR={copilot:{src:new URL(""+new URL("copilot-7BoBRmFo.png",import.meta.url).href,import.meta.url).href,viewBox:"0 0 256 256"},qoder:{src:new URL(""+new URL("qoder-CGHn7M84.png",import.meta.url).href,import.meta.url).href,viewBox:"14 14 100 100"},zcode:{src:new URL(""+new URL("zcode-CsXrmDtX.png",import.meta.url).href,import.meta.url).href,viewBox:"12 12 104 104"},workbuddy:{src:new URL(""+new URL("workbuddy-hEyEE8dU.png",import.meta.url).href,import.meta.url).href,viewBox:"13 13 102 102"}},uR="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fR="M75.91 73.628V62.232c0-.96.36-1.68 1.199-2.16l22.912-13.194c3.119-1.8 6.838-2.639 10.676-2.639 14.394 0 23.511 11.157 23.511 23.032 0 .839 0 1.799-.12 2.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318 0L75.91 73.627Zm53.499 44.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142 69.55l9.836-5.638c.839-.48 1.559-.48 2.399 0l22.912 13.195c6.598 3.839 11.035 11.995 11.035 19.912 0 9.116-5.397 17.513-13.915 20.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834 9.837-22.55 23.152-22.55 5.039 0 9.716 1.679 13.676 4.678L70.993 55.516c-1.44.84-2.16 2.039-2.16 3.719v34.787-.002Zm21.173 12.234L75.91 98.339V81.546l14.095-7.917 14.094 7.917v16.793l-14.094 7.916Zm9.056 36.467c-5.038 0-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839 2.159-2.038 2.159-3.718V85.863l9.956 5.757c.84.48 1.2 1.2 1.2 2.16v26.389c0 12.835-9.957 22.552-23.27 22.552v.001Zm-28.43-26.75L47.72 102.778c-6.599-3.84-11.036-11.996-11.036-19.913 0-9.236 5.518-17.513 14.034-20.992v27.35c0 1.68.72 2.879 2.16 3.718l29.989 17.393-9.837 5.638c-.84.48-1.56.48-2.399 0Zm-1.318 19.673c-13.555 0-23.512-10.196-23.512-22.792 0-.959.12-1.919.24-2.879l23.63 13.675c1.44.84 2.88.84 4.32 0l30.108-17.392v11.395c0 .96-.361 1.68-1.2 2.16l-22.912 13.194c-3.119 1.8-6.837 2.639-10.675 2.639Zm29.748 14.274c14.515 0 26.63-10.316 29.39-23.991 13.434-3.479 22.071-16.074 22.071-28.91 0-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557 0-17.153-13.915-29.99-29.989-29.99-3.239 0-6.358.48-9.477 1.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515 0-26.63 10.316-29.39 23.991-13.434 3.48-22.07 16.074-22.07 28.91 0 8.396 3.598 16.553 10.075 22.431-.6 2.519-.96 5.038-.96 7.556 0 17.154 13.915 29.989 29.99 29.989 3.238 0 6.357-.479 9.476-1.559 5.397 5.278 12.835 8.637 20.992 8.637Z";function dR({agentType:e,size:t=16,className:n}){const o=cR[e];return o?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:o.viewBox,"aria-hidden":"true",children:L.jsx("image",{href:o.src,width:e==="copilot"?256:128,height:e==="copilot"?256:128})}):e==="customer-agent"?L.jsxs("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"50 48 180 180",fill:"none","aria-hidden":"true",children:[L.jsx("path",{d:"M76 187V90Q76 74 92 74H188Q204 74 204 90V187",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"}),L.jsx("path",{d:"m108 116 26 24-26 24m47 0h22M100 207h80",stroke:"currentColor",strokeWidth:"14",strokeLinecap:"round",strokeLinejoin:"round"}),L.jsx("circle",{cx:"204",cy:"207",r:"11",fill:"currentColor"})]}):e==="codex"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"29.487 29.964 121.035 119.954","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:fR})}):e==="claude-code"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:uR})}):e==="deepseek-harness"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 50 50","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:"M48.8354 10.0479C48.3232 9.79199 48.1025 10.2798 47.8032 10.5278C47.7007 10.6079 47.6143 10.7119 47.5273 10.8076C46.7793 11.624 45.9048 12.1597 44.7622 12.0957C43.0923 12 41.666 12.5356 40.4058 13.8398C40.1377 12.2319 39.2476 11.272 37.8926 10.6558C37.1836 10.3359 36.4668 10.0156 35.9702 9.31982C35.6235 8.82373 35.5293 8.27197 35.356 7.72754C35.2456 7.3999 35.1353 7.06396 34.7651 7.00781C34.3633 6.94385 34.2056 7.2876 34.0479 7.57568C33.418 8.75195 33.1733 10.0479 33.1973 11.3599C33.2524 14.312 34.4736 16.6641 36.8999 18.3359C37.1758 18.5278 37.2466 18.7197 37.1597 19C36.9946 19.5757 36.7974 20.1357 36.624 20.7119C36.5137 21.0801 36.3486 21.1597 35.9624 21C34.6309 20.4321 33.481 19.5918 32.4644 18.5757C30.7393 16.8721 29.1792 14.9917 27.2334 13.52C26.7764 13.1758 26.3193 12.856 25.8467 12.5518C23.8618 10.584 26.1069 8.96777 26.627 8.77588C27.1704 8.57568 26.8159 7.8877 25.0591 7.896C23.3022 7.90381 21.6953 8.50391 19.647 9.30371C19.3477 9.42383 19.0322 9.51172 18.7095 9.58398C16.8501 9.22363 14.9199 9.14355 12.9033 9.37598C9.10596 9.80762 6.07275 11.6396 3.84326 14.7681C1.16455 18.5278 0.53418 22.7998 1.30664 27.2559C2.11768 31.9521 4.46582 35.8398 8.07373 38.8799C11.8159 42.0322 16.1255 43.5762 21.041 43.2803C24.0269 43.104 27.3516 42.6963 31.1016 39.4561C32.0469 39.936 33.0396 40.1279 34.686 40.272C35.9546 40.3921 37.1758 40.208 38.1211 40.0078C39.6021 39.688 39.4995 38.2881 38.9639 38.0322C34.623 35.9678 35.5762 36.8081 34.71 36.1279C36.9155 33.4639 40.2402 30.6958 41.54 21.728C41.6426 21.0161 41.5557 20.5679 41.54 19.9917C41.5322 19.6396 41.6108 19.5039 42.0049 19.4639C43.0923 19.3359 44.1479 19.0317 45.1167 18.4878C47.9292 16.9199 49.064 14.3438 49.3315 11.2559C49.3711 10.7837 49.3237 10.2959 48.8354 10.0479ZM24.3262 37.8398C20.1196 34.4639 18.0791 33.3521 17.2358 33.3999C16.4482 33.4482 16.5898 34.3682 16.7632 34.9678C16.9443 35.5601 17.1812 35.9683 17.5117 36.4878C17.7402 36.832 17.8979 37.3442 17.2832 37.728C15.9282 38.584 13.5728 37.4399 13.4624 37.3838C10.7207 35.7358 8.42822 33.5601 6.81348 30.584C5.25342 27.7197 4.34766 24.6479 4.19775 21.3677C4.1582 20.5757 4.38672 20.2959 5.15869 20.1519C6.17529 19.96 7.22314 19.9199 8.23926 20.0718C12.5327 20.7119 16.1885 22.6719 19.2529 25.7759C21.002 27.5439 22.3252 29.6558 23.6885 31.7202C25.1377 33.9121 26.6978 36 28.6831 37.7119C29.3843 38.312 29.9434 38.7681 30.479 39.104C28.8643 39.2881 26.1699 39.3281 24.3262 37.8398ZM26.3433 24.6001C26.3433 24.248 26.6191 23.9678 26.9658 23.9678C27.0444 23.9678 27.1152 23.9839 27.1782 24.0078C27.2651 24.04 27.3438 24.0879 27.4067 24.1602C27.5171 24.272 27.5801 24.4321 27.5801 24.6001C27.5801 24.9521 27.3042 25.2319 26.9575 25.2319C26.6108 25.2319 26.3433 24.9521 26.3433 24.6001ZM32.6064 27.8799C32.2046 28.0479 31.8027 28.1919 31.4165 28.208C30.8179 28.2397 30.1641 27.9922 29.8096 27.688C29.2583 27.2158 28.8643 26.9521 28.6987 26.1279C28.6279 25.7759 28.6675 25.2319 28.7305 24.9199C28.8721 24.248 28.7144 23.8159 28.2495 23.4238C27.8716 23.104 27.3911 23.0161 26.8633 23.0161C26.666 23.0161 26.4849 22.9277 26.3511 22.856C26.1304 22.7441 25.9492 22.4639 26.1226 22.1201C26.1777 22.0078 26.4458 21.7358 26.5088 21.688C27.2256 21.272 28.0527 21.4077 28.8169 21.7197C29.5259 22.0161 30.0615 22.5601 30.834 23.3281C31.6216 24.2559 31.7632 24.5117 32.2124 25.208C32.5669 25.752 32.8901 26.312 33.1104 26.9521C33.2446 27.3521 33.0713 27.6802 32.6064 27.8799Z"})}):L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:"M22 24H2V0h20zM17 4.8H7v14.4h10z",fillRule:"evenodd"})})}function hR(e,t){const n=t.find(c=>c.agentType===e);if(n!=null&&n.available||e==="customer-agent"&&!n)return;const o=$0[e];return n?/not installed|not found|ENOENT|未安装|找不到/i.test(n.error??"")?`远程未安装 ${o}`:`远程 ${o} 暂不可用`:`正在检查远程 ${o},请稍后重试`}const gR=j0.map(e=>({agentType:e,label:$0[e]}));function pR({value:e,health:t,onChange:n,onUnavailable:o,vertical:c=!1,onPreview:u}){const g=ce.useRef(null),[x,w]=ce.useState(!1);return ce.useEffect(()=>{if(c)return;const m=g.current,C=()=>{const A=m==null?void 0:m.querySelector('[aria-selected="true"]');if(!m||!A)return;const T=A.offsetLeft;T<m.scrollLeft?m.scrollTo({left:T,behavior:"smooth"}):T+A.offsetWidth>m.scrollLeft+m.clientWidth&&m.scrollTo({left:T+A.offsetWidth-m.clientWidth,behavior:"smooth"})};C();const b=typeof ResizeObserver>"u"?null:new ResizeObserver(C);return m&&(b==null||b.observe(m)),()=>b==null?void 0:b.disconnect()},[e,c]),L.jsxs("div",{className:`agent-workspace-switcher${c?" is-vertical":""}`,children:[L.jsx("div",{ref:g,className:"agent-workspace-track",role:"tablist","aria-label":"切换 Agent","aria-orientation":c?"vertical":"horizontal",onScroll:m=>w(m.currentTarget.scrollLeft>1),children:gR.map(m=>{const C=hR(m.agentType,t),b=C!==void 0;return L.jsx("button",{type:"button",role:"tab","aria-selected":e===m.agentType,"aria-label":m.label,"aria-disabled":b,title:b?C:m.label,className:[e===m.agentType?"is-active":"",b?"is-unavailable":""].filter(Boolean).join(" "),onPointerEnter:A=>u==null?void 0:u(m.agentType,m.label,A.currentTarget.getBoundingClientRect(),b?C:void 0),onFocus:A=>u==null?void 0:u(m.agentType,m.label,A.currentTarget.getBoundingClientRect(),b?C:void 0),onClick:()=>{if(b){o(C);return}n(m.agentType)},children:L.jsx(dR,{agentType:m.agentType,size:22})},m.agentType)})}),L.jsx("button",{type:"button",className:"agent-workspace-more","aria-label":x?"前面的 Agent":"更多 Agent",title:`${x?"前面的 Agent":"更多 Agent"} · 手机可左右滑动`,onClick:()=>{const m=g.current;if(!m)return;const C=m.scrollWidth-m.clientWidth;m.scrollTo({left:x?0:C,behavior:"smooth"})},children:x?L.jsx(D9,{size:20,strokeWidth:1.8,"aria-hidden":"true"}):L.jsx(P9,{size:20,strokeWidth:1.8,"aria-hidden":"true"})})]})}const mR="请点击扫码按钮扫码",xR=[["刷新页面",Mv],["打开群聊看板",z9],["打开远程桌面",U9],["打开 AI Hub",L9],["打开数字人",kv],["皮肤",j9],["打开我的文件",W9]];function wR({onScan:e,initialFailure:t=""}){const[n,o]=ce.useState(!1),[c,u]=ce.useState(t),[g,x]=ce.useState(!1),w=ce.useRef();ce.useEffect(()=>{const T=setTimeout(()=>x(!0),650);return()=>{clearTimeout(T),clearTimeout(w.current)}},[]);const m=()=>{u(mR),clearTimeout(w.current),w.current=setTimeout(()=>u(""),3e3)},C=T=>{T.target.closest("[data-pairing-action]")||(T.preventDefault(),T.stopPropagation(),m())},b=async()=>{if(!n){clearTimeout(w.current),o(!0),u("");try{await e()}catch(T){u(T instanceof Error?T.message:"扫码连接失败,请重试。")}finally{o(!1)}}},A=sR("pearl");return L.jsxs("div",{className:"web-root unpaired-home",style:A.cssVars,onClickCapture:C,onKeyDownCapture:T=>{(T.key==="Enter"||T.key===" ")&&C(T)},children:[L.jsx("style",{dangerouslySetInnerHTML:{__html:tR}}),L.jsxs("div",{className:"terminal-tabs",children:[L.jsx("div",{className:"terminal-tab-list",children:L.jsx("div",{className:"terminal-tab active",role:"tab","aria-disabled":"true",children:L.jsx("span",{children:"智能助手"})})}),L.jsx("button",{type:"button",className:"terminal-add","aria-label":"新建终端页签","aria-disabled":"true",children:"+"}),L.jsx("div",{className:"terminal-connection",children:L.jsx(JT,{items:xR.map(([T,k])=>({id:T,content:L.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":T,"aria-disabled":"true",children:L.jsx(k,{size:17})})})),avatar:L.jsxs("button",{type:"button","data-pairing-action":!0,className:"unpaired-scan","aria-label":"扫码连接电脑",title:"扫码连接电脑",disabled:n,onClick:()=>void b(),children:[L.jsx(k9,{size:19}),L.jsx("span",{children:n?"连接中":"扫码"})]})})})]}),L.jsxs("main",{className:"unpaired-workspace","aria-label":"尚未连接电脑的工作区",children:[L.jsxs("header",{className:"unpaired-workspace-header",children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"会话列表","aria-disabled":"true",children:L.jsx(F9,{size:18})}),L.jsx("span",{children:"智能助手"}),L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"返回","aria-disabled":"true",children:L.jsx(M9,{size:17})})]}),L.jsx("div",{className:"unpaired-agent-switcher",children:L.jsx(pR,{value:"codex",health:[],onChange:m,onUnavailable:m})}),L.jsx("div",{className:"unpaired-welcome",children:L.jsx(lR,{agentType:"codex",ready:!0,connectionRequired:!0,onSelectPrompt:m})}),L.jsxs("div",{className:"unpaired-composer",children:[L.jsx("span",{children:"发送消息…"}),L.jsxs("div",{children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"添加附件","aria-disabled":"true",children:L.jsx($9,{size:19})}),L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"发送消息","aria-disabled":"true",children:L.jsx(O9,{size:19})})]})]})]}),c&&L.jsx("p",{className:"unpaired-notice",role:"alert",children:c}),L.jsx(W0,{ready:g})]})}let an=null;function vR(e){an=e}function U_(){return an}function yR(){return(an==null?void 0:an.origin)??location.origin}function j_(e){return(an==null?void 0:an.frameUrl(e))??e}function W_(e){return an?new URL(e,an.origin).href:e}function $_(){const e=new URL("/ws",yR());return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.href}const $v="agentroam.computers.v1",zv=20,ER=/^[A-Za-z0-9_-]{43}$/;function Vv(e){try{if(typeof e!="string"||e.length>8192)throw new Error;const t=new URL(e.trim().replace(/[,。]+$/,""));if(!["http:","https:"].includes(t.protocol)||t.username||t.password)throw new Error;return t.href}catch{throw new Error("请填写有效的 http(s) 页面地址。")}}function CR(e){if(!Array.isArray(e)||e.length>20)return[];const t=new Map;for(const n of e)if(!(!n||typeof n.id!="string"||!/^[A-Za-z0-9_-]{1,80}$/.test(n.id)||typeof n.name!="string"||!n.name.trim()||!["current","new-tab"].includes(n.openMode)))try{t.set(n.id,{id:n.id,name:n.name.trim().slice(0,60),url:Vv(n.url),openMode:n.openMode})}catch{}return[...t.values()]}function z_(e){try{const t=new URL(Vv(e)).hostname;return t==="qoder.com"||t.endsWith(".qoder.com")?"new-tab":"current"}catch{return"current"}}function Zc(e){try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.pathname!=="/"||t.search||t.hash?null:t.origin}catch{return null}}function Qc(e){if(!Array.isArray(e)||e.length>zv)return[];const t=new Map;for(const n of e){const o=n&&typeof n.origin=="string"?Zc(n.origin):null;if(!o||typeof n.name!="string")continue;const c=n.name.trim().slice(0,60)||new URL(o).hostname,u=CR(n.pages);t.set(o,{origin:o,name:c,...n.pagesMigrated===!0?{pagesMigrated:!0}:Array.isArray(n.pages)?{pages:u}:{}})}return[...t.values()]}function Hv(e=localStorage){try{return Qc(JSON.parse(e.getItem($v)||"[]"))}catch{return[]}}function bR(...e){const t=new Map;for(const n of e)for(const o of Qc(n)){const u={...t.get(o.origin),...o};u.pagesMigrated&&delete u.pages,t.set(o.origin,u)}if(t.size>zv)throw new Error("最多可添加 20 台电脑。");return[...t.values()]}function AR(e,t=localStorage){const n=Qc(e);try{t.setItem($v,JSON.stringify(n))}catch{throw new Error("浏览器无法保存电脑列表,请检查浏览器存储设置。")}return n}function SR(e,t,n=Hv()){var u;const o=Zc(e);if(!o)throw new Error("电脑地址无效。");const c=n.find(g=>g.origin===o);return bR(n,[{origin:o,name:(c==null?void 0:c.name)||new URL(o).hostname,...(u=c==null?void 0:c.pages)!=null&&u.length?{pages:c.pages}:{}}])}function IR(e){try{if(typeof e!="string"||e.length>2048)throw new Error;if(e=e.trim(),e.startsWith("{")){const n=JSON.parse(e),o=Zc(n.server);if(n.type!=="agentroam-pair"||n.version!==1||!o||!ER.test(n.grant))throw new Error;e=o+"/pair#pair="+n.grant}const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.pathname!=="/pair"||t.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(t.hash))throw new Error;return t}catch{throw new Error("这不是 AgentRoam 授权二维码,请在电脑上重新生成。")}}function Gv(e,t,n=""){const o=new URLSearchParams(e.hash.slice(1)),c=Qc(t).map(u=>{var g;return{origin:u.origin,name:u.name,...u.pagesMigrated?{pagesMigrated:!0}:{},...u.origin===e.origin&&!u.pagesMigrated&&((g=u.pages)!=null&&g.length)?{pages:u.pages}:{}}});if(o.set("computers",JSON.stringify({version:1,computers:c,name:n.trim().slice(0,60)})),o.toString().length>16383)throw new Error("电脑列表或待导入页面配置过长,请先导入旧页面后再切换电脑。");return e.hash=o.toString(),e.href}function V_(e,t,n=""){return Gv(IR(e),t,n)}function H_(e,t){const n=Zc(e);if(!n)throw new Error("电脑地址无效。");return Gv(new URL(n+"/pair"),t)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Os;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Os||(Os={}));class kf extends Error{constructor(t,n,o){super(t),this.message=t,this.code=n,this.data=o}}const TR=e=>{var t,n;return e!=null&&e.androidBridge?"android":!((n=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},RR=e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},o=n.Plugins=n.Plugins||{},c=()=>t!==null?t.name:TR(e),u=()=>c()!=="web",g=b=>{const A=m.get(b);return!!(A!=null&&A.platforms.has(c())||x(b))},x=b=>{var A;return(A=n.PluginHeaders)===null||A===void 0?void 0:A.find(T=>T.name===b)},w=b=>e.console.error(b),m=new Map,C=(b,A={})=>{const T=m.get(b);if(T)return console.warn(`Capacitor plugin "${b}" already registered. Cannot register plugins twice.`),T.proxy;const k=c(),M=x(b);let G;const N=async()=>(!G&&k in A?G=typeof A[k]=="function"?G=await A[k]():G=A[k]:t!==null&&!G&&"web"in A&&(G=typeof A.web=="function"?G=await A.web():G=A.web),G),I=(Y,z)=>{var oe,ve;if(M){const ie=M==null?void 0:M.methods.find(pe=>z===pe.name);if(ie)return ie.rtype==="promise"?pe=>n.nativePromise(b,z.toString(),pe):(pe,Te)=>n.nativeCallback(b,z.toString(),pe,Te);if(Y)return(oe=Y[z])===null||oe===void 0?void 0:oe.bind(Y)}else{if(Y)return(ve=Y[z])===null||ve===void 0?void 0:ve.bind(Y);throw new kf(`"${b}" plugin is not implemented on ${k}`,Os.Unimplemented)}},O=Y=>{let z;const oe=(...ve)=>{const ie=N().then(pe=>{const Te=I(pe,Y);if(Te){const X=Te(...ve);return z=X==null?void 0:X.remove,X}else throw new kf(`"${b}.${Y}()" is not implemented on ${k}`,Os.Unimplemented)});return Y==="addListener"&&(ie.remove=async()=>z()),ie};return oe.toString=()=>`${Y.toString()}() { [capacitor code] }`,Object.defineProperty(oe,"name",{value:Y,writable:!1,configurable:!1}),oe},B=O("addListener"),j=O("removeListener"),U=(Y,z)=>{const oe=B({eventName:Y},z),ve=async()=>{const pe=await oe;j({eventName:Y,callbackId:pe},z)},ie=new Promise(pe=>oe.then(()=>pe({remove:ve})));return ie.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ve()},ie},F=new Proxy({},{get(Y,z){switch(z){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?U:B;case"removeListener":return j;default:return O(z)}}});return o[b]=F,m.set(b,{name:b,proxy:F,platforms:new Set([...Object.keys(A),...M?[k]:[]])}),F};return n.convertFileSrc||(n.convertFileSrc=b=>b),n.getPlatform=c,n.handleError=w,n.isNativePlatform=u,n.isPluginAvailable=g,n.registerPlugin=C,n.Exception=kf,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},_R=e=>e.Capacitor=RR(e),Ns=_R(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ga=Ns.registerPlugin;class Xv{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,n){let o=!1;this.listeners[t]||(this.listeners[t]=[],o=!0),this.listeners[t].push(n);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),o&&this.sendRetainedArgumentsForEvent(t);const g=async()=>this.removeListener(t,n);return Promise.resolve({remove:g})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,n,o){const c=this.listeners[t];if(!c){if(o){let u=this.retainedEventArguments[t];u||(u=[]),u.push(n),this.retainedEventArguments[t]=u}return}c.forEach(u=>u(n))}hasListeners(t){var n;return!!(!((n=this.listeners[t])===null||n===void 0)&&n.length)}registerWindowListener(t,n){this.windowListeners[n]={registered:!1,windowEventName:t,pluginEventName:n,handler:o=>{this.notifyListeners(n,o)}}}unimplemented(t="not implemented"){return new Ns.Exception(t,Os.Unimplemented)}unavailable(t="not available"){return new Ns.Exception(t,Os.Unavailable)}async removeListener(t,n){const o=this.listeners[t];if(!o)return;const c=o.indexOf(n);this.listeners[t].splice(c,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const n=this.retainedEventArguments[t];n&&(delete this.retainedEventArguments[t],n.forEach(o=>{this.notifyListeners(t,o)}))}}const n2=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),i2=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class OR extends Xv{async getCookies(){const t=document.cookie,n={};return t.split(";").forEach(o=>{if(o.length<=0)return;let[c,u]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=i2(c).trim(),u=i2(u).trim(),n[c]=u}),n}async setCookie(t){try{const n=n2(t.key),o=n2(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),g=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${n}=${o||""}${c}; path=${u}; ${g};`}catch(n){return Promise.reject(n)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const n of t)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}ga("CapacitorCookies",{web:()=>new OR});const NR=async e=>new Promise((t,n)=>{const o=new FileReader;o.onload=()=>{const c=o.result;t(c.indexOf(",")>=0?c.split(",")[1]:c)},o.onerror=c=>n(c),o.readAsDataURL(e)}),kR=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,u,g)=>(c[u]=e[t[g]],c),{})},MR=(e,t=!0)=>e?Object.entries(e).reduce((o,c)=>{const[u,g]=c;let x,w;return Array.isArray(g)?(w="",g.forEach(m=>{x=t?encodeURIComponent(m):m,w+=`${u}=${x}&`}),w.slice(0,-1)):(x=t?encodeURIComponent(g):g,w=`${u}=${x}`),`${o}&${w}`},"").substr(1):null,DR=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),c=kR(e.headers)["content-type"]||"";if(typeof e.data=="string")n.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[g,x]of Object.entries(e.data||{}))u.set(g,x);n.body=u.toString()}else if(c.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((x,w)=>{u.append(w,x)});else for(const x of Object.keys(e.data))u.append(x,e.data[x]);n.body=u;const g=new Headers(n.headers);g.delete("content-type"),n.headers=g}else(c.includes("application/json")||typeof e.data=="object")&&(n.body=JSON.stringify(e.data));return n};class PR extends Xv{async request(t){const n=DR(t,t.webFetchExtra),o=MR(t.params,t.shouldEncodeUrlParams),c=o?`${t.url}?${o}`:t.url,u=await fetch(c,n),g=u.headers.get("content-type")||"";let{responseType:x="text"}=u.ok?t:{};g.includes("application/json")&&(x="json");let w,m;switch(x){case"arraybuffer":case"blob":m=await u.blob(),w=await NR(m);break;case"json":w=await u.json();break;case"document":case"text":default:w=await u.text()}const C={};return u.headers.forEach((b,A)=>{C[A]=b}),{data:w,headers:C,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}ga("CapacitorHttp",{web:()=>new PR});var re;(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(re||(re={}));var s2=new Map([[re.QR_CODE,"QR_CODE"],[re.AZTEC,"AZTEC"],[re.CODABAR,"CODABAR"],[re.CODE_39,"CODE_39"],[re.CODE_93,"CODE_93"],[re.CODE_128,"CODE_128"],[re.DATA_MATRIX,"DATA_MATRIX"],[re.MAXICODE,"MAXICODE"],[re.ITF,"ITF"],[re.EAN_13,"EAN_13"],[re.EAN_8,"EAN_8"],[re.PDF_417,"PDF_417"],[re.RSS_14,"RSS_14"],[re.RSS_EXPANDED,"RSS_EXPANDED"],[re.UPC_A,"UPC_A"],[re.UPC_E,"UPC_E"],[re.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),o2;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(o2||(o2={}));function LR(e){return Object.values(re).includes(e)}var fc;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(fc||(fc={}));var BR=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[fc.SCAN_TYPE_CAMERA,fc.SCAN_TYPE_FILE],e}(),Yv=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!s2.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,s2.get(t))},e}(),a2=function(){function e(){}return e.createFromText=function(t){var n={text:t};return{decodedText:t,result:n}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),Y1;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Y1||(Y1={}));var FR=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:Y1.UNKWOWN_ERROR}},e}(),UR=function(){function e(t){this.verbose=t}return e.prototype.log=function(t){this.verbose&&console.log(t)},e.prototype.warn=function(t){this.verbose&&console.warn(t)},e.prototype.logError=function(t,n){(this.verbose||n===!0)&&console.error(t)},e.prototype.logErrors=function(t){if(t.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},e}();function fn(e){return typeof e>"u"||e===null}var us=function(){function e(){}return e.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},e.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),Kv=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,n){if(typeof t!="object"){var o=typeof t;return n.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(o,"."),!0),!1}for(var c=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],u=new Set(c),g=Object.keys(t),x=0,w=g;x<w.length;x++){var m=w[x];if(u.has(m))return n.logError("".concat(m," is not supported videoConstaints."),!0),!1}return!0},e}(),K1={exports:{}};(function(e,t){(function(n,o){o(t)})(pn,function(n){function o(y){return y==null}var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,r){y.__proto__=r}||function(y,r){for(var i in r)r.hasOwnProperty(i)&&(y[i]=r[i])};function u(y,r){c(y,r);function i(){this.constructor=y}y.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}function g(y,r){var i=Object.setPrototypeOf;i?i(y,r):y.__proto__=r}function x(y,r){r===void 0&&(r=y.constructor);var i=Error.captureStackTrace;i&&i(y,r)}var w=function(y){u(r,y);function r(i){var s=this.constructor,a=y.call(this,i)||this;return Object.defineProperty(a,"name",{value:s.name,enumerable:!1}),g(a,s.prototype),x(a),a}return r}(Error);class m extends w{constructor(r=void 0){super(r),this.message=r}getKind(){return this.constructor.kind}}m.kind="Exception";class C extends m{}C.kind="ArgumentException";class b extends m{}b.kind="IllegalArgumentException";class A{constructor(r){if(this.binarizer=r,r===null)throw new b("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(r,i){return this.binarizer.getBlackRow(r,i)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(r,i,s,a){const l=this.binarizer.getLuminanceSource().crop(r,i,s,a);return new A(this.binarizer.createBinarizer(l))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new A(this.binarizer.createBinarizer(r))}rotateCounterClockwise45(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new A(this.binarizer.createBinarizer(r))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class T extends m{static getChecksumInstance(){return new T}}T.kind="ChecksumException";class k{constructor(r){this.source=r}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class M{static arraycopy(r,i,s,a,l){for(;l--;)s[a++]=r[i++]}static currentTimeMillis(){return Date.now()}}class G extends m{}G.kind="IndexOutOfBoundsException";class N extends G{constructor(r=void 0,i=void 0){super(i),this.index=r,this.message=i}}N.kind="ArrayIndexOutOfBoundsException";class I{static fill(r,i){for(let s=0,a=r.length;s<a;s++)r[s]=i}static fillWithin(r,i,s,a){I.rangeCheck(r.length,i,s);for(let l=i;l<s;l++)r[l]=a}static rangeCheck(r,i,s){if(i>s)throw new b("fromIndex("+i+") > toIndex("+s+")");if(i<0)throw new N(i);if(s>r)throw new N(s)}static asList(...r){return r}static create(r,i,s){return Array.from({length:r}).map(l=>Array.from({length:i}).fill(s))}static createInt32Array(r,i,s){return Array.from({length:r}).map(l=>Int32Array.from({length:i}).fill(s))}static equals(r,i){if(!r||!i||!r.length||!i.length||r.length!==i.length)return!1;for(let s=0,a=r.length;s<a;s++)if(r[s]!==i[s])return!1;return!0}static hashCode(r){if(r===null)return 0;let i=1;for(const s of r)i=31*i+s;return i}static fillUint8Array(r,i){for(let s=0;s!==r.length;s++)r[s]=i}static copyOf(r,i){return r.slice(0,i)}static copyOfUint8Array(r,i){if(r.length<=i){const s=new Uint8Array(i);return s.set(r),s}return r.slice(0,i)}static copyOfRange(r,i,s){const a=s-i,l=new Int32Array(a);return M.arraycopy(r,i,l,0,a),l}static binarySearch(r,i,s){s===void 0&&(s=I.numberComparator);let a=0,l=r.length-1;for(;a<=l;){const f=l+a>>1,d=s(i,r[f]);if(d>0)a=f+1;else if(d<0)l=f-1;else return f}return-a-1}static numberComparator(r,i){return r-i}}class O{static numberOfTrailingZeros(r){let i;if(r===0)return 32;let s=31;return i=r<<16,i!==0&&(s-=16,r=i),i=r<<8,i!==0&&(s-=8,r=i),i=r<<4,i!==0&&(s-=4,r=i),i=r<<2,i!==0&&(s-=2,r=i),s-(r<<1>>>31)}static numberOfLeadingZeros(r){if(r===0)return 32;let i=1;return r>>>16||(i+=16,r<<=16),r>>>24||(i+=8,r<<=8),r>>>28||(i+=4,r<<=4),r>>>30||(i+=2,r<<=2),i-=r>>>31,i}static toHexString(r){return r.toString(16)}static toBinaryString(r){return String(parseInt(String(r),2))}static bitCount(r){return r=r-(r>>>1&1431655765),r=(r&858993459)+(r>>>2&858993459),r=r+(r>>>4)&252645135,r=r+(r>>>8),r=r+(r>>>16),r&63}static truncDivision(r,i){return Math.trunc(r/i)}static parseInt(r,i=void 0){return parseInt(r,i)}}O.MIN_VALUE_32_BITS=-2147483648,O.MAX_VALUE=Number.MAX_SAFE_INTEGER;class B{constructor(r,i){r===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=r,i==null?this.bits=B.makeArray(r):this.bits=i)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(r){if(r>this.bits.length*32){const i=B.makeArray(r);M.arraycopy(this.bits,0,i,0,this.bits.length),this.bits=i}}get(r){return(this.bits[Math.floor(r/32)]&1<<(r&31))!==0}set(r){this.bits[Math.floor(r/32)]|=1<<(r&31)}flip(r){this.bits[Math.floor(r/32)]^=1<<(r&31)}getNextSet(r){const i=this.size;if(r>=i)return i;const s=this.bits;let a=Math.floor(r/32),l=s[a];l&=~((1<<(r&31))-1);const f=s.length;for(;l===0;){if(++a===f)return i;l=s[a]}const d=a*32+O.numberOfTrailingZeros(l);return d>i?i:d}getNextUnset(r){const i=this.size;if(r>=i)return i;const s=this.bits;let a=Math.floor(r/32),l=~s[a];l&=~((1<<(r&31))-1);const f=s.length;for(;l===0;){if(++a===f)return i;l=~s[a]}const d=a*32+O.numberOfTrailingZeros(l);return d>i?i:d}setBulk(r,i){this.bits[Math.floor(r/32)]=i}setRange(r,i){if(i<r||r<0||i>this.size)throw new b;if(i===r)return;i--;const s=Math.floor(r/32),a=Math.floor(i/32),l=this.bits;for(let f=s;f<=a;f++){const d=f>s?0:r&31,p=(2<<(f<a?31:i&31))-(1<<d);l[f]|=p}}clear(){const r=this.bits.length,i=this.bits;for(let s=0;s<r;s++)i[s]=0}isRange(r,i,s){if(i<r||r<0||i>this.size)throw new b;if(i===r)return!0;i--;const a=Math.floor(r/32),l=Math.floor(i/32),f=this.bits;for(let d=a;d<=l;d++){const h=d>a?0:r&31,v=(2<<(d<l?31:i&31))-(1<<h)&4294967295;if((f[d]&v)!==(s?v:0))return!1}return!0}appendBit(r){this.ensureCapacity(this.size+1),r&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(r,i){if(i<0||i>32)throw new b("Num bits must be between 0 and 32");this.ensureCapacity(this.size+i);for(let s=i;s>0;s--)this.appendBit((r>>s-1&1)===1)}appendBitArray(r){const i=r.size;this.ensureCapacity(this.size+i);for(let s=0;s<i;s++)this.appendBit(r.get(s))}xor(r){if(this.size!==r.size)throw new b("Sizes don't match");const i=this.bits;for(let s=0,a=i.length;s<a;s++)i[s]^=r.bits[s]}toBytes(r,i,s,a){for(let l=0;l<a;l++){let f=0;for(let d=0;d<8;d++)this.get(r)&&(f|=1<<7-d),r++;i[s+l]=f}}getBitArray(){return this.bits}reverse(){const r=new Int32Array(this.bits.length),i=Math.floor((this.size-1)/32),s=i+1,a=this.bits;for(let l=0;l<s;l++){let f=a[l];f=f>>1&1431655765|(f&1431655765)<<1,f=f>>2&858993459|(f&858993459)<<2,f=f>>4&252645135|(f&252645135)<<4,f=f>>8&16711935|(f&16711935)<<8,f=f>>16&65535|(f&65535)<<16,r[i-l]=f}if(this.size!==s*32){const l=s*32-this.size;let f=r[0]>>>l;for(let d=1;d<s;d++){const h=r[d];f|=h<<32-l,r[d-1]=f,f=h>>>l}r[s-1]=f}this.bits=r}static makeArray(r){return new Int32Array(Math.floor((r+31)/32))}equals(r){if(!(r instanceof B))return!1;const i=r;return this.size===i.size&&I.equals(this.bits,i.bits)}hashCode(){return 31*this.size+I.hashCode(this.bits)}toString(){let r="";for(let i=0,s=this.size;i<s;i++)i&7||(r+=" "),r+=this.get(i)?"X":".";return r}clone(){return new B(this.size,this.bits.slice())}}var j;(function(y){y[y.OTHER=0]="OTHER",y[y.PURE_BARCODE=1]="PURE_BARCODE",y[y.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",y[y.TRY_HARDER=3]="TRY_HARDER",y[y.CHARACTER_SET=4]="CHARACTER_SET",y[y.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",y[y.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",y[y.ASSUME_GS1=7]="ASSUME_GS1",y[y.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",y[y.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",y[y.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(j||(j={}));var U=j;class F extends m{static getFormatInstance(){return new F}}F.kind="FormatException";var Y;(function(y){y[y.Cp437=0]="Cp437",y[y.ISO8859_1=1]="ISO8859_1",y[y.ISO8859_2=2]="ISO8859_2",y[y.ISO8859_3=3]="ISO8859_3",y[y.ISO8859_4=4]="ISO8859_4",y[y.ISO8859_5=5]="ISO8859_5",y[y.ISO8859_6=6]="ISO8859_6",y[y.ISO8859_7=7]="ISO8859_7",y[y.ISO8859_8=8]="ISO8859_8",y[y.ISO8859_9=9]="ISO8859_9",y[y.ISO8859_10=10]="ISO8859_10",y[y.ISO8859_11=11]="ISO8859_11",y[y.ISO8859_13=12]="ISO8859_13",y[y.ISO8859_14=13]="ISO8859_14",y[y.ISO8859_15=14]="ISO8859_15",y[y.ISO8859_16=15]="ISO8859_16",y[y.SJIS=16]="SJIS",y[y.Cp1250=17]="Cp1250",y[y.Cp1251=18]="Cp1251",y[y.Cp1252=19]="Cp1252",y[y.Cp1256=20]="Cp1256",y[y.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",y[y.UTF8=22]="UTF8",y[y.ASCII=23]="ASCII",y[y.Big5=24]="Big5",y[y.GB18030=25]="GB18030",y[y.EUC_KR=26]="EUC_KR"})(Y||(Y={}));class z{constructor(r,i,s,...a){this.valueIdentifier=r,this.name=s,typeof i=="number"?this.values=Int32Array.from([i]):this.values=i,this.otherEncodingNames=a,z.VALUE_IDENTIFIER_TO_ECI.set(r,this),z.NAME_TO_ECI.set(s,this);const l=this.values;for(let f=0,d=l.length;f!==d;f++){const h=l[f];z.VALUES_TO_ECI.set(h,this)}for(const f of a)z.NAME_TO_ECI.set(f,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(r){if(r<0||r>=900)throw new F("incorect value");const i=z.VALUES_TO_ECI.get(r);if(i===void 0)throw new F("incorect value");return i}static getCharacterSetECIByName(r){const i=z.NAME_TO_ECI.get(r);if(i===void 0)throw new F("incorect value");return i}equals(r){if(!(r instanceof z))return!1;const i=r;return this.getName()===i.getName()}}z.VALUE_IDENTIFIER_TO_ECI=new Map,z.VALUES_TO_ECI=new Map,z.NAME_TO_ECI=new Map,z.Cp437=new z(Y.Cp437,Int32Array.from([0,2]),"Cp437"),z.ISO8859_1=new z(Y.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),z.ISO8859_2=new z(Y.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),z.ISO8859_3=new z(Y.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),z.ISO8859_4=new z(Y.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),z.ISO8859_5=new z(Y.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),z.ISO8859_6=new z(Y.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),z.ISO8859_7=new z(Y.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),z.ISO8859_8=new z(Y.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),z.ISO8859_9=new z(Y.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),z.ISO8859_10=new z(Y.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),z.ISO8859_11=new z(Y.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),z.ISO8859_13=new z(Y.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),z.ISO8859_14=new z(Y.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),z.ISO8859_15=new z(Y.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),z.ISO8859_16=new z(Y.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),z.SJIS=new z(Y.SJIS,20,"SJIS","Shift_JIS"),z.Cp1250=new z(Y.Cp1250,21,"Cp1250","windows-1250"),z.Cp1251=new z(Y.Cp1251,22,"Cp1251","windows-1251"),z.Cp1252=new z(Y.Cp1252,23,"Cp1252","windows-1252"),z.Cp1256=new z(Y.Cp1256,24,"Cp1256","windows-1256"),z.UnicodeBigUnmarked=new z(Y.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),z.UTF8=new z(Y.UTF8,26,"UTF8","UTF-8"),z.ASCII=new z(Y.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),z.Big5=new z(Y.Big5,28,"Big5"),z.GB18030=new z(Y.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),z.EUC_KR=new z(Y.EUC_KR,30,"EUC_KR","EUC-KR");class oe extends m{}oe.kind="UnsupportedOperationException";class ve{static decode(r,i){const s=this.encodingName(i);return this.customDecoder?this.customDecoder(r,s):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(s)?this.decodeFallback(r,s):new TextDecoder(s).decode(r)}static shouldDecodeOnFallback(r){return!ve.isBrowser()&&r==="ISO-8859-1"}static encode(r,i){const s=this.encodingName(i);return this.customEncoder?this.customEncoder(r,s):typeof TextEncoder>"u"?this.encodeFallback(r):new TextEncoder().encode(r)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(r){return typeof r=="string"?r:r.getName()}static encodingCharacterSet(r){return r instanceof z?r:z.getCharacterSetECIByName(r)}static decodeFallback(r,i){const s=this.encodingCharacterSet(i);if(ve.isDecodeFallbackSupported(s)){let a="";for(let l=0,f=r.length;l<f;l++){let d=r[l].toString(16);d.length<2&&(d="0"+d),a+="%"+d}return decodeURIComponent(a)}if(s.equals(z.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(r.buffer));throw new oe(`Encoding ${this.encodingName(i)} not supported by fallback.`)}static isDecodeFallbackSupported(r){return r.equals(z.UTF8)||r.equals(z.ISO8859_1)||r.equals(z.ASCII)}static encodeFallback(r){const s=btoa(unescape(encodeURIComponent(r))).split(""),a=[];for(let l=0;l<s.length;l++)a.push(s[l].charCodeAt(0));return new Uint8Array(a)}}class ie{static castAsNonUtf8Char(r,i=null){const s=i?i.getName():this.ISO88591;return ve.decode(new Uint8Array([r]),s)}static guessEncoding(r,i){if(i!=null&&i.get(U.CHARACTER_SET)!==void 0)return i.get(U.CHARACTER_SET).toString();const s=r.length;let a=!0,l=!0,f=!0,d=0,h=0,p=0,v=0,E=0,S=0,_=0,D=0,P=0,W=0,H=0;const q=r.length>3&&r[0]===239&&r[1]===187&&r[2]===191;for(let J=0;J<s&&(a||l||f);J++){const Z=r[J]&255;f&&(d>0?Z&128?d--:f=!1:Z&128&&(Z&64?(d++,Z&32?(d++,Z&16?(d++,Z&8?f=!1:v++):p++):h++):f=!1)),a&&(Z>127&&Z<160?a=!1:Z>159&&(Z<192||Z===215||Z===247)&&H++),l&&(E>0?Z<64||Z===127||Z>252?l=!1:E--:Z===128||Z===160||Z>239?l=!1:Z>160&&Z<224?(S++,D=0,_++,_>P&&(P=_)):Z>127?(E++,_=0,D++,D>W&&(W=D)):(_=0,D=0))}return f&&d>0&&(f=!1),l&&E>0&&(l=!1),f&&(q||h+p+v>0)?ie.UTF8:l&&(ie.ASSUME_SHIFT_JIS||P>=3||W>=3)?ie.SHIFT_JIS:a&&l?P===2&&S===2||H*10>=s?ie.SHIFT_JIS:ie.ISO88591:a?ie.ISO88591:l?ie.SHIFT_JIS:f?ie.UTF8:ie.PLATFORM_DEFAULT_ENCODING}static format(r,...i){let s=-1;function a(f,d,h,p,v,E){if(f==="%%")return"%";if(i[++s]===void 0)return;f=p?parseInt(p.substr(1)):void 0;let S=v?parseInt(v.substr(1)):void 0,_;switch(E){case"s":_=i[s];break;case"c":_=i[s][0];break;case"f":_=parseFloat(i[s]).toFixed(f);break;case"p":_=parseFloat(i[s]).toPrecision(f);break;case"e":_=parseFloat(i[s]).toExponential(f);break;case"x":_=parseInt(i[s]).toString(S||16);break;case"d":_=parseFloat(parseInt(i[s],S||10).toPrecision(f)).toFixed(0);break}_=typeof _=="object"?JSON.stringify(_):(+_).toString(S);let D=parseInt(h),P=h&&h[0]+""=="0"?"0":" ";for(;_.length<D;)_=d!==void 0?_+P:P+_;return _}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}static getBytes(r,i){return ve.encode(r,i)}static getCharCode(r,i=0){return r.charCodeAt(i)}static getCharAt(r){return String.fromCharCode(r)}}ie.SHIFT_JIS=z.SJIS.getName(),ie.GB2312="GB2312",ie.ISO88591=z.ISO8859_1.getName(),ie.EUC_JP="EUC_JP",ie.UTF8=z.UTF8.getName(),ie.PLATFORM_DEFAULT_ENCODING=ie.UTF8,ie.ASSUME_SHIFT_JIS=!1;class pe{constructor(r=""){this.value=r}enableDecoding(r){return this.encoding=r,this}append(r){return typeof r=="string"?this.value+=r.toString():this.encoding?this.value+=ie.castAsNonUtf8Char(r,this.encoding):this.value+=String.fromCharCode(r),this}appendChars(r,i,s){for(let a=i;i<i+s;a++)this.append(r[a]);return this}length(){return this.value.length}charAt(r){return this.value.charAt(r)}deleteCharAt(r){this.value=this.value.substr(0,r)+this.value.substring(r+1)}setCharAt(r,i){this.value=this.value.substr(0,r)+i+this.value.substr(r+1)}substring(r,i){return this.value.substring(r,i)}setLengthToZero(){this.value=""}toString(){return this.value}insert(r,i){this.value=this.value.substr(0,r)+i+this.value.substr(r+i.length)}}class Te{constructor(r,i,s,a){if(this.width=r,this.height=i,this.rowSize=s,this.bits=a,i==null&&(i=r),this.height=i,r<1||i<1)throw new b("Both dimensions must be greater than 0");s==null&&(s=Math.floor((r+31)/32)),this.rowSize=s,a==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(r){const i=r.length,s=r[0].length,a=new Te(s,i);for(let l=0;l<i;l++){const f=r[l];for(let d=0;d<s;d++)f[d]&&a.set(d,l)}return a}static parseFromString(r,i,s){if(r===null)throw new b("stringRepresentation cannot be null");const a=new Array(r.length);let l=0,f=0,d=-1,h=0,p=0;for(;p<r.length;)if(r.charAt(p)===`
462
- `||r.charAt(p)==="\r"){if(l>f){if(d===-1)d=l-f;else if(l-f!==d)throw new b("row lengths do not match");f=l,h++}p++}else if(r.substring(p,p+i.length)===i)p+=i.length,a[l]=!0,l++;else if(r.substring(p,p+s.length)===s)p+=s.length,a[l]=!1,l++;else throw new b("illegal character encountered: "+r.substring(p));if(l>f){if(d===-1)d=l-f;else if(l-f!==d)throw new b("row lengths do not match");h++}const v=new Te(d,h);for(let E=0;E<l;E++)a[E]&&v.set(Math.floor(E%d),Math.floor(E/d));return v}get(r,i){const s=i*this.rowSize+Math.floor(r/32);return(this.bits[s]>>>(r&31)&1)!==0}set(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]|=1<<(r&31)&4294967295}unset(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]&=~(1<<(r&31)&4294967295)}flip(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]^=1<<(r&31)&4294967295}xor(r){if(this.width!==r.getWidth()||this.height!==r.getHeight()||this.rowSize!==r.getRowSize())throw new b("input matrix dimensions do not match");const i=new B(Math.floor(this.width/32)+1),s=this.rowSize,a=this.bits;for(let l=0,f=this.height;l<f;l++){const d=l*s,h=r.getRow(l,i).getBitArray();for(let p=0;p<s;p++)a[d+p]^=h[p]}}clear(){const r=this.bits,i=r.length;for(let s=0;s<i;s++)r[s]=0}setRegion(r,i,s,a){if(i<0||r<0)throw new b("Left and top must be nonnegative");if(a<1||s<1)throw new b("Height and width must be at least 1");const l=r+s,f=i+a;if(f>this.height||l>this.width)throw new b("The region must fit inside the matrix");const d=this.rowSize,h=this.bits;for(let p=i;p<f;p++){const v=p*d;for(let E=r;E<l;E++)h[v+Math.floor(E/32)]|=1<<(E&31)&4294967295}}getRow(r,i){i==null||i.getSize()<this.width?i=new B(this.width):i.clear();const s=this.rowSize,a=this.bits,l=r*s;for(let f=0;f<s;f++)i.setBulk(f*32,a[l+f]);return i}setRow(r,i){M.arraycopy(i.getBitArray(),0,this.bits,r*this.rowSize,this.rowSize)}rotate180(){const r=this.getWidth(),i=this.getHeight();let s=new B(r),a=new B(r);for(let l=0,f=Math.floor((i+1)/2);l<f;l++)s=this.getRow(l,s),a=this.getRow(i-1-l,a),s.reverse(),a.reverse(),this.setRow(l,a),this.setRow(i-1-l,s)}getEnclosingRectangle(){const r=this.width,i=this.height,s=this.rowSize,a=this.bits;let l=r,f=i,d=-1,h=-1;for(let p=0;p<i;p++)for(let v=0;v<s;v++){const E=a[p*s+v];if(E!==0){if(p<f&&(f=p),p>h&&(h=p),v*32<l){let S=0;for(;!(E<<31-S&4294967295);)S++;v*32+S<l&&(l=v*32+S)}if(v*32+31>d){let S=31;for(;!(E>>>S);)S--;v*32+S>d&&(d=v*32+S)}}}return d<l||h<f?null:Int32Array.from([l,f,d-l+1,h-f+1])}getTopLeftOnBit(){const r=this.rowSize,i=this.bits;let s=0;for(;s<i.length&&i[s]===0;)s++;if(s===i.length)return null;const a=s/r;let l=s%r*32;const f=i[s];let d=0;for(;!(f<<31-d&4294967295);)d++;return l+=d,Int32Array.from([l,a])}getBottomRightOnBit(){const r=this.rowSize,i=this.bits;let s=i.length-1;for(;s>=0&&i[s]===0;)s--;if(s<0)return null;const a=Math.floor(s/r);let l=Math.floor(s%r)*32;const f=i[s];let d=31;for(;!(f>>>d);)d--;return l+=d,Int32Array.from([l,a])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(r){if(!(r instanceof Te))return!1;const i=r;return this.width===i.width&&this.height===i.height&&this.rowSize===i.rowSize&&I.equals(this.bits,i.bits)}hashCode(){let r=this.width;return r=31*r+this.width,r=31*r+this.height,r=31*r+this.rowSize,r=31*r+I.hashCode(this.bits),r}toString(r="X ",i=" ",s=`
463
- `){return this.buildToString(r,i,s)}buildToString(r,i,s){let a=new pe;for(let l=0,f=this.height;l<f;l++){for(let d=0,h=this.width;d<h;d++)a.append(this.get(d,l)?r:i);a.append(s)}return a.toString()}clone(){return new Te(this.width,this.height,this.rowSize,this.bits.slice())}}class X extends m{static getNotFoundInstance(){return new X}}X.kind="NotFoundException";class rt extends k{constructor(r){super(r),this.luminances=rt.EMPTY,this.buckets=new Int32Array(rt.LUMINANCE_BUCKETS)}getBlackRow(r,i){const s=this.getLuminanceSource(),a=s.getWidth();i==null||i.getSize()<a?i=new B(a):i.clear(),this.initArrays(a);const l=s.getRow(r,this.luminances),f=this.buckets;for(let h=0;h<a;h++)f[(l[h]&255)>>rt.LUMINANCE_SHIFT]++;const d=rt.estimateBlackPoint(f);if(a<3)for(let h=0;h<a;h++)(l[h]&255)<d&&i.set(h);else{let h=l[0]&255,p=l[1]&255;for(let v=1;v<a-1;v++){const E=l[v+1]&255;(p*4-h-E)/2<d&&i.set(v),h=p,p=E}}return i}getBlackMatrix(){const r=this.getLuminanceSource(),i=r.getWidth(),s=r.getHeight(),a=new Te(i,s);this.initArrays(i);const l=this.buckets;for(let h=1;h<5;h++){const p=Math.floor(s*h/5),v=r.getRow(p,this.luminances),E=Math.floor(i*4/5);for(let S=Math.floor(i/5);S<E;S++){const _=v[S]&255;l[_>>rt.LUMINANCE_SHIFT]++}}const f=rt.estimateBlackPoint(l),d=r.getMatrix();for(let h=0;h<s;h++){const p=h*i;for(let v=0;v<i;v++)(d[p+v]&255)<f&&a.set(v,h)}return a}createBinarizer(r){return new rt(r)}initArrays(r){this.luminances.length<r&&(this.luminances=new Uint8ClampedArray(r));const i=this.buckets;for(let s=0;s<rt.LUMINANCE_BUCKETS;s++)i[s]=0}static estimateBlackPoint(r){const i=r.length;let s=0,a=0,l=0;for(let v=0;v<i;v++)r[v]>l&&(a=v,l=r[v]),r[v]>s&&(s=r[v]);let f=0,d=0;for(let v=0;v<i;v++){const E=v-a,S=r[v]*E*E;S>d&&(f=v,d=S)}if(a>f){const v=a;a=f,f=v}if(f-a<=i/16)throw new X;let h=f-1,p=-1;for(let v=f-1;v>a;v--){const E=v-a,S=E*E*(f-v)*(s-r[v]);S>p&&(h=v,p=S)}return h<<rt.LUMINANCE_SHIFT}}rt.LUMINANCE_BITS=5,rt.LUMINANCE_SHIFT=8-rt.LUMINANCE_BITS,rt.LUMINANCE_BUCKETS=1<<rt.LUMINANCE_BITS,rt.EMPTY=Uint8ClampedArray.from([0]);class xe extends rt{constructor(r){super(r),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const r=this.getLuminanceSource(),i=r.getWidth(),s=r.getHeight();if(i>=xe.MINIMUM_DIMENSION&&s>=xe.MINIMUM_DIMENSION){const a=r.getMatrix();let l=i>>xe.BLOCK_SIZE_POWER;i&xe.BLOCK_SIZE_MASK&&l++;let f=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&f++;const d=xe.calculateBlackPoints(a,l,f,i,s),h=new Te(i,s);xe.calculateThresholdForBlock(a,l,f,i,s,d,h),this.matrix=h}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(r){return new xe(r)}static calculateThresholdForBlock(r,i,s,a,l,f,d){const h=l-xe.BLOCK_SIZE,p=a-xe.BLOCK_SIZE;for(let v=0;v<s;v++){let E=v<<xe.BLOCK_SIZE_POWER;E>h&&(E=h);const S=xe.cap(v,2,s-3);for(let _=0;_<i;_++){let D=_<<xe.BLOCK_SIZE_POWER;D>p&&(D=p);const P=xe.cap(_,2,i-3);let W=0;for(let q=-2;q<=2;q++){const J=f[S+q];W+=J[P-2]+J[P-1]+J[P]+J[P+1]+J[P+2]}const H=W/25;xe.thresholdBlock(r,D,E,H,a,d)}}}static cap(r,i,s){return r<i?i:r>s?s:r}static thresholdBlock(r,i,s,a,l,f){for(let d=0,h=s*l+i;d<xe.BLOCK_SIZE;d++,h+=l)for(let p=0;p<xe.BLOCK_SIZE;p++)(r[h+p]&255)<=a&&f.set(i+p,s+d)}static calculateBlackPoints(r,i,s,a,l){const f=l-xe.BLOCK_SIZE,d=a-xe.BLOCK_SIZE,h=new Array(s);for(let p=0;p<s;p++){h[p]=new Int32Array(i);let v=p<<xe.BLOCK_SIZE_POWER;v>f&&(v=f);for(let E=0;E<i;E++){let S=E<<xe.BLOCK_SIZE_POWER;S>d&&(S=d);let _=0,D=255,P=0;for(let H=0,q=v*a+S;H<xe.BLOCK_SIZE;H++,q+=a){for(let J=0;J<xe.BLOCK_SIZE;J++){const Z=r[q+J]&255;_+=Z,Z<D&&(D=Z),Z>P&&(P=Z)}if(P-D>xe.MIN_DYNAMIC_RANGE)for(H++,q+=a;H<xe.BLOCK_SIZE;H++,q+=a)for(let J=0;J<xe.BLOCK_SIZE;J++)_+=r[q+J]&255}let W=_>>xe.BLOCK_SIZE_POWER*2;if(P-D<=xe.MIN_DYNAMIC_RANGE&&(W=D/2,p>0&&E>0)){const H=(h[p-1][E]+2*h[p][E-1]+h[p-1][E-1])/4;D<H&&(W=H)}h[p][E]=W}}return h}}xe.BLOCK_SIZE_POWER=3,xe.BLOCK_SIZE=1<<xe.BLOCK_SIZE_POWER,xe.BLOCK_SIZE_MASK=xe.BLOCK_SIZE-1,xe.MINIMUM_DIMENSION=xe.BLOCK_SIZE*5,xe.MIN_DYNAMIC_RANGE=24;class te{constructor(r,i){this.width=r,this.height=i}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(r,i,s,a){throw new oe("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new oe("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new oe("This luminance source does not support rotation by 45 degrees.")}toString(){const r=new Uint8ClampedArray(this.width);let i=new pe;for(let s=0;s<this.height;s++){const a=this.getRow(s,r);for(let l=0;l<this.width;l++){const f=a[l]&255;let d;f<64?d="#":f<128?d="+":f<192?d=".":d=" ",i.append(d)}i.append(`
464
- `)}return i.toString()}}class he extends te{constructor(r){super(r.getWidth(),r.getHeight()),this.delegate=r}getRow(r,i){const s=this.delegate.getRow(r,i),a=this.getWidth();for(let l=0;l<a;l++)s[l]=255-(s[l]&255);return s}getMatrix(){const r=this.delegate.getMatrix(),i=this.getWidth()*this.getHeight(),s=new Uint8ClampedArray(i);for(let a=0;a<i;a++)s[a]=255-(r[a]&255);return s}isCropSupported(){return this.delegate.isCropSupported()}crop(r,i,s,a){return new he(this.delegate.crop(r,i,s,a))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new he(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new he(this.delegate.rotateCounterClockwise45())}}class me extends te{constructor(r){super(r.width,r.height),this.canvas=r,this.tempCanvasElement=null,this.buffer=me.makeBufferFromCanvasImageData(r)}static makeBufferFromCanvasImageData(r){const i=r.getContext("2d").getImageData(0,0,r.width,r.height);return me.toGrayscaleBuffer(i.data,r.width,r.height)}static toGrayscaleBuffer(r,i,s){const a=new Uint8ClampedArray(i*s);for(let l=0,f=0,d=r.length;l<d;l+=4,f++){let h;if(r[l+3]===0)h=255;else{const v=r[l],E=r[l+1],S=r[l+2];h=306*v+601*E+117*S+512>>10}a[f]=h}return a}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth(),a=r*s;return i===null?i=this.buffer.slice(a,a+s):(i.length<s&&(i=new Uint8ClampedArray(s)),i.set(this.buffer.slice(a,a+s))),i}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(r,i,s,a){return super.crop(r,i,s,a),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const r=this.canvas.ownerDocument.createElement("canvas");r.width=this.canvas.width,r.height=this.canvas.height,this.tempCanvasElement=r}return this.tempCanvasElement}rotate(r){const i=this.getTempCanvasElement(),s=i.getContext("2d"),a=r*me.DEGREE_TO_RADIANS,l=this.canvas.width,f=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(a))*l+Math.abs(Math.sin(a))*f),h=Math.ceil(Math.abs(Math.sin(a))*l+Math.abs(Math.cos(a))*f);return i.width=d,i.height=h,s.translate(d/2,h/2),s.rotate(a),s.drawImage(this.canvas,l/-2,f/-2),this.buffer=me.makeBufferFromCanvasImageData(i),this}invert(){return new he(this)}}me.DEGREE_TO_RADIANS=Math.PI/180;class Ge{constructor(r,i,s){this.deviceId=r,this.label=i,this.kind="videoinput",this.groupId=s||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var Ie=(globalThis||pn||self||window||void 0)&&(globalThis||pn||self||window||void 0).__awaiter||function(y,r,i,s){function a(l){return l instanceof i?l:new i(function(f){f(l)})}return new(i||(i=Promise))(function(l,f){function d(v){try{p(s.next(v))}catch(E){f(E)}}function h(v){try{p(s.throw(v))}catch(E){f(E)}}function p(v){v.done?l(v.value):a(v.value).then(d,h)}p((s=s.apply(y,r||[])).next())})};class Er{constructor(r,i=500,s){this.reader=r,this.timeBetweenScansMillis=i,this._hints=s,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(r){this._timeBetweenDecodingAttempts=r<0?0:r}set hints(r){this._hints=r||null}get hints(){return this._hints}listVideoInputDevices(){return Ie(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const r=yield navigator.mediaDevices.enumerateDevices(),i=[];for(const s of r){const a=s.kind==="video"?"videoinput":s.kind;if(a!=="videoinput")continue;const l=s.deviceId||s.id,f=s.label||`Video device ${i.length+1}`,d=s.groupId,h={deviceId:l,label:f,kind:a,groupId:d};i.push(h)}return i})}getVideoInputDevices(){return Ie(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(i=>new Ge(i.deviceId,i.label))})}findDeviceById(r){return Ie(this,void 0,void 0,function*(){const i=yield this.listVideoInputDevices();return i?i.find(s=>s.deviceId===r):null})}decodeFromInputVideoDevice(r,i){return Ie(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(r,i)})}decodeOnceFromVideoDevice(r,i){return Ie(this,void 0,void 0,function*(){this.reset();let s;r?s={deviceId:{exact:r}}:s={facingMode:"environment"};const a={video:s};return yield this.decodeOnceFromConstraints(a,i)})}decodeOnceFromConstraints(r,i){return Ie(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(r);return yield this.decodeOnceFromStream(s,i)})}decodeOnceFromStream(r,i){return Ie(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(r,i);return yield this.decodeOnce(s)})}decodeFromInputVideoDeviceContinuously(r,i,s){return Ie(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(r,i,s)})}decodeFromVideoDevice(r,i,s){return Ie(this,void 0,void 0,function*(){let a;r?a={deviceId:{exact:r}}:a={facingMode:"environment"};const l={video:a};return yield this.decodeFromConstraints(l,i,s)})}decodeFromConstraints(r,i,s){return Ie(this,void 0,void 0,function*(){const a=yield navigator.mediaDevices.getUserMedia(r);return yield this.decodeFromStream(a,i,s)})}decodeFromStream(r,i,s){return Ie(this,void 0,void 0,function*(){this.reset();const a=yield this.attachStreamToVideo(r,i);return yield this.decodeContinuously(a,s)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(r,i){return Ie(this,void 0,void 0,function*(){const s=this.prepareVideoElement(i);return this.addVideoSource(s,r),this.videoElement=s,this.stream=r,yield this.playVideoOnLoadAsync(s),s})}playVideoOnLoadAsync(r){return new Promise((i,s)=>this.playVideoOnLoad(r,()=>i()))}playVideoOnLoad(r,i){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(r),r.addEventListener("ended",this.videoEndedListener),r.addEventListener("canplay",this.videoCanPlayListener),r.addEventListener("playing",i),this.tryPlayVideo(r)}isVideoPlaying(r){return r.currentTime>0&&!r.paused&&!r.ended&&r.readyState>2}tryPlayVideo(r){return Ie(this,void 0,void 0,function*(){if(this.isVideoPlaying(r)){console.warn("Trying to play video that is already playing.");return}try{yield r.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(r,i){const s=document.getElementById(r);if(!s)throw new C(`element with id '${r}' not found`);if(s.nodeName.toLowerCase()!==i.toLowerCase())throw new C(`element with id '${r}' must be an ${i} element`);return s}decodeFromImage(r,i){if(!r&&!i)throw new C("either imageElement with a src set or an url must be provided");return i&&!r?this.decodeFromImageUrl(i):this.decodeFromImageElement(r)}decodeFromVideo(r,i){if(!r&&!i)throw new C("Either an element with a src set or an URL must be provided");return i&&!r?this.decodeFromVideoUrl(i):this.decodeFromVideoElement(r)}decodeFromVideoContinuously(r,i,s){if(r===void 0&&i===void 0)throw new C("Either an element with a src set or an URL must be provided");return i&&!r?this.decodeFromVideoUrlContinuously(i,s):this.decodeFromVideoElementContinuously(r,s)}decodeFromImageElement(r){if(!r)throw new C("An image element must be provided.");this.reset();const i=this.prepareImageElement(r);this.imageElement=i;let s;return this.isImageLoaded(i)?s=this.decodeOnce(i,!1,!0):s=this._decodeOnLoadImage(i),s}decodeFromVideoElement(r){const i=this._decodeFromVideoElementSetup(r);return this._decodeOnLoadVideo(i)}decodeFromVideoElementContinuously(r,i){const s=this._decodeFromVideoElementSetup(r);return this._decodeOnLoadVideoContinuously(s,i)}_decodeFromVideoElementSetup(r){if(!r)throw new C("A video element must be provided.");this.reset();const i=this.prepareVideoElement(r);return this.videoElement=i,i}decodeFromImageUrl(r){if(!r)throw new C("An URL must be provided.");this.reset();const i=this.prepareImageElement();this.imageElement=i;const s=this._decodeOnLoadImage(i);return i.src=r,s}decodeFromVideoUrl(r){if(!r)throw new C("An URL must be provided.");this.reset();const i=this.prepareVideoElement(),s=this.decodeFromVideoElement(i);return i.src=r,s}decodeFromVideoUrlContinuously(r,i){if(!r)throw new C("An URL must be provided.");this.reset();const s=this.prepareVideoElement(),a=this.decodeFromVideoElementContinuously(s,i);return s.src=r,a}_decodeOnLoadImage(r){return new Promise((i,s)=>{this.imageLoadedListener=()=>this.decodeOnce(r,!1,!0).then(i,s),r.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(r){return Ie(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(r),yield this.decodeOnce(r)})}_decodeOnLoadVideoContinuously(r,i){return Ie(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(r),this.decodeContinuously(r,i)})}isImageLoaded(r){return!(!r.complete||r.naturalWidth===0)}prepareImageElement(r){let i;return typeof r>"u"&&(i=document.createElement("img"),i.width=200,i.height=200),typeof r=="string"&&(i=this.getMediaElement(r,"img")),r instanceof HTMLImageElement&&(i=r),i}prepareVideoElement(r){let i;return!r&&typeof document<"u"&&(i=document.createElement("video"),i.width=200,i.height=200),typeof r=="string"&&(i=this.getMediaElement(r,"video")),r instanceof HTMLVideoElement&&(i=r),i.setAttribute("autoplay","true"),i.setAttribute("muted","true"),i.setAttribute("playsinline","true"),i}decodeOnce(r,i=!0,s=!0){this._stopAsyncDecode=!1;const a=(l,f)=>{if(this._stopAsyncDecode){f(new X("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(r);l(d)}catch(d){const h=i&&d instanceof X,v=(d instanceof T||d instanceof F)&&s;if(h||v)return setTimeout(a,this._timeBetweenDecodingAttempts,l,f);f(d)}};return new Promise((l,f)=>a(l,f))}decodeContinuously(r,i){this._stopContinuousDecode=!1;const s=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const a=this.decode(r);i(a,null),setTimeout(s,this.timeBetweenScansMillis)}catch(a){i(null,a);const l=a instanceof T||a instanceof F,f=a instanceof X;(l||f)&&setTimeout(s,this._timeBetweenDecodingAttempts)}};s()}decode(r){const i=this.createBinaryBitmap(r);return this.decodeBitmap(i)}_isHTMLVideoElement(r){return r.videoWidth!==0}drawFrameOnCanvas(r,i,s){i||(i={sx:0,sy:0,sWidth:r.videoWidth,sHeight:r.videoHeight,dx:0,dy:0,dWidth:r.videoWidth,dHeight:r.videoHeight}),s||(s=this.captureCanvasContext),s.drawImage(r,i.sx,i.sy,i.sWidth,i.sHeight,i.dx,i.dy,i.dWidth,i.dHeight)}drawImageOnCanvas(r,i,s=this.captureCanvasContext){i||(i={sx:0,sy:0,sWidth:r.naturalWidth,sHeight:r.naturalHeight,dx:0,dy:0,dWidth:r.naturalWidth,dHeight:r.naturalHeight}),s||(s=this.captureCanvasContext),s.drawImage(r,i.sx,i.sy,i.sWidth,i.sHeight,i.dx,i.dy,i.dWidth,i.dHeight)}createBinaryBitmap(r){this.getCaptureCanvasContext(r),this._isHTMLVideoElement(r)?this.drawFrameOnCanvas(r):this.drawImageOnCanvas(r);const i=this.getCaptureCanvas(r),s=new me(i),a=new xe(s);return new A(a)}getCaptureCanvasContext(r){if(!this.captureCanvasContext){const s=this.getCaptureCanvas(r).getContext("2d");this.captureCanvasContext=s}return this.captureCanvasContext}getCaptureCanvas(r){if(!this.captureCanvas){const i=this.createCaptureCanvas(r);this.captureCanvas=i}return this.captureCanvas}decodeBitmap(r){return this.reader.decode(r,this._hints)}createCaptureCanvas(r){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const i=document.createElement("canvas");let s,a;return typeof r<"u"&&(r instanceof HTMLVideoElement?(s=r.videoWidth,a=r.videoHeight):r instanceof HTMLImageElement&&(s=r.naturalWidth||r.width,a=r.naturalHeight||r.height)),i.style.width=s+"px",i.style.height=a+"px",i.width=s,i.height=a,i}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(r=>r.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(r,i){try{r.srcObject=i}catch{r.src=URL.createObjectURL(i)}}cleanVideoSource(r){try{r.srcObject=null}catch{r.src=""}this.videoElement.removeAttribute("src")}}class Ze{constructor(r,i,s=i==null?0:8*i.length,a,l,f=M.currentTimeMillis()){this.text=r,this.rawBytes=i,this.numBits=s,this.resultPoints=a,this.format=l,this.timestamp=f,this.text=r,this.rawBytes=i,s==null?this.numBits=i==null?0:8*i.length:this.numBits=s,this.resultPoints=a,this.format=l,this.resultMetadata=null,f==null?this.timestamp=M.currentTimeMillis():this.timestamp=f}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(r,i){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(r,i)}putAllMetadata(r){r!==null&&(this.resultMetadata===null?this.resultMetadata=r:this.resultMetadata=new Map(r))}addResultPoints(r){const i=this.resultPoints;if(i===null)this.resultPoints=r;else if(r!==null&&r.length>0){const s=new Array(i.length+r.length);M.arraycopy(i,0,s,0,i.length),M.arraycopy(r,0,s,i.length,r.length),this.resultPoints=s}}getTimestamp(){return this.timestamp}toString(){return this.text}}var oi;(function(y){y[y.AZTEC=0]="AZTEC",y[y.CODABAR=1]="CODABAR",y[y.CODE_39=2]="CODE_39",y[y.CODE_93=3]="CODE_93",y[y.CODE_128=4]="CODE_128",y[y.DATA_MATRIX=5]="DATA_MATRIX",y[y.EAN_8=6]="EAN_8",y[y.EAN_13=7]="EAN_13",y[y.ITF=8]="ITF",y[y.MAXICODE=9]="MAXICODE",y[y.PDF_417=10]="PDF_417",y[y.QR_CODE=11]="QR_CODE",y[y.RSS_14=12]="RSS_14",y[y.RSS_EXPANDED=13]="RSS_EXPANDED",y[y.UPC_A=14]="UPC_A",y[y.UPC_E=15]="UPC_E",y[y.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(oi||(oi={}));var le=oi,Rn;(function(y){y[y.OTHER=0]="OTHER",y[y.ORIENTATION=1]="ORIENTATION",y[y.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",y[y.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",y[y.ISSUE_NUMBER=4]="ISSUE_NUMBER",y[y.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",y[y.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",y[y.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",y[y.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",y[y.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",y[y.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Rn||(Rn={}));var bt=Rn;class Bs{constructor(r,i,s,a,l=-1,f=-1){this.rawBytes=r,this.text=i,this.byteSegments=s,this.ecLevel=a,this.structuredAppendSequenceNumber=l,this.structuredAppendParity=f,this.numBits=r==null?0:8*r.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(r){this.numBits=r}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(r){this.errorsCorrected=r}getErasures(){return this.erasures}setErasures(r){this.erasures=r}getOther(){return this.other}setOther(r){this.other=r}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Fs{exp(r){return this.expTable[r]}log(r){if(r===0)throw new b;return this.logTable[r]}static addOrSubtract(r,i){return r^i}}class Qt{constructor(r,i){if(i.length===0)throw new b;this.field=r;const s=i.length;if(s>1&&i[0]===0){let a=1;for(;a<s&&i[a]===0;)a++;a===s?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(s-a),M.arraycopy(i,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=i}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(r){return this.coefficients[this.coefficients.length-1-r]}evaluateAt(r){if(r===0)return this.getCoefficient(0);const i=this.coefficients;let s;if(r===1){s=0;for(let f=0,d=i.length;f!==d;f++){const h=i[f];s=Fs.addOrSubtract(s,h)}return s}s=i[0];const a=i.length,l=this.field;for(let f=1;f<a;f++)s=Fs.addOrSubtract(l.multiply(r,s),i[f]);return s}addOrSubtract(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(this.isZero())return r;if(r.isZero())return this;let i=this.coefficients,s=r.coefficients;if(i.length>s.length){const f=i;i=s,s=f}let a=new Int32Array(s.length);const l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let f=l;f<s.length;f++)a[f]=Fs.addOrSubtract(i[f-l],s[f]);return new Qt(this.field,a)}multiply(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(this.isZero()||r.isZero())return this.field.getZero();const i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,f=new Int32Array(s+l-1),d=this.field;for(let h=0;h<s;h++){const p=i[h];for(let v=0;v<l;v++)f[h+v]=Fs.addOrSubtract(f[h+v],d.multiply(p,a[v]))}return new Qt(d,f)}multiplyScalar(r){if(r===0)return this.field.getZero();if(r===1)return this;const i=this.coefficients.length,s=this.field,a=new Int32Array(i),l=this.coefficients;for(let f=0;f<i;f++)a[f]=s.multiply(l[f],r);return new Qt(s,a)}multiplyByMonomial(r,i){if(r<0)throw new b;if(i===0)return this.field.getZero();const s=this.coefficients,a=s.length,l=new Int32Array(a+r),f=this.field;for(let d=0;d<a;d++)l[d]=f.multiply(s[d],i);return new Qt(f,l)}divide(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(r.isZero())throw new b("Divide by 0");const i=this.field;let s=i.getZero(),a=this;const l=r.getCoefficient(r.getDegree()),f=i.inverse(l);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){const d=a.getDegree()-r.getDegree(),h=i.multiply(a.getCoefficient(a.getDegree()),f),p=r.multiplyByMonomial(d,h),v=i.buildMonomial(d,h);s=s.addOrSubtract(v),a=a.addOrSubtract(p)}return[s,a]}toString(){let r="";for(let i=this.getDegree();i>=0;i--){let s=this.getCoefficient(i);if(s!==0){if(s<0?(r+=" - ",s=-s):r.length>0&&(r+=" + "),i===0||s!==1){const a=this.field.log(s);a===0?r+="1":a===1?r+="a":(r+="a^",r+=a)}i!==0&&(i===1?r+="x":(r+="x^",r+=i))}}return r}}class pa extends m{}pa.kind="ArithmeticException";class Ne extends Fs{constructor(r,i,s){super(),this.primitive=r,this.size=i,this.generatorBase=s;const a=new Int32Array(i);let l=1;for(let d=0;d<i;d++)a[d]=l,l*=2,l>=i&&(l^=r,l&=i-1);this.expTable=a;const f=new Int32Array(i);for(let d=0;d<i-1;d++)f[a[d]]=d;this.logTable=f,this.zero=new Qt(this,Int32Array.from([0])),this.one=new Qt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new b;if(i===0)return this.zero;const s=new Int32Array(r+1);return s[0]=i,new Qt(this,s)}inverse(r){if(r===0)throw new pa;return this.expTable[this.size-this.logTable[r]-1]}multiply(r,i){return r===0||i===0?0:this.expTable[(this.logTable[r]+this.logTable[i])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+O.toHexString(this.primitive)+","+this.size+")"}equals(r){return r===this}}Ne.AZTEC_DATA_12=new Ne(4201,4096,1),Ne.AZTEC_DATA_10=new Ne(1033,1024,1),Ne.AZTEC_DATA_6=new Ne(67,64,1),Ne.AZTEC_PARAM=new Ne(19,16,1),Ne.QR_CODE_FIELD_256=new Ne(285,256,0),Ne.DATA_MATRIX_FIELD_256=new Ne(301,256,1),Ne.AZTEC_DATA_8=Ne.DATA_MATRIX_FIELD_256,Ne.MAXICODE_FIELD_64=Ne.AZTEC_DATA_6;class Li extends m{}Li.kind="ReedSolomonException";class Xr extends m{}Xr.kind="IllegalStateException";class Us{constructor(r){this.field=r}decode(r,i){const s=this.field,a=new Qt(s,r),l=new Int32Array(i);let f=!0;for(let _=0;_<i;_++){const D=a.evaluateAt(s.exp(_+s.getGeneratorBase()));l[l.length-1-_]=D,D!==0&&(f=!1)}if(f)return;const d=new Qt(s,l),h=this.runEuclideanAlgorithm(s.buildMonomial(i,1),d,i),p=h[0],v=h[1],E=this.findErrorLocations(p),S=this.findErrorMagnitudes(v,E);for(let _=0;_<E.length;_++){const D=r.length-1-s.log(E[_]);if(D<0)throw new Li("Bad error location");r[D]=Ne.addOrSubtract(r[D],S[_])}}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){const _=r;r=i,i=_}const a=this.field;let l=r,f=i,d=a.getZero(),h=a.getOne();for(;f.getDegree()>=(s/2|0);){let _=l,D=d;if(l=f,d=h,l.isZero())throw new Li("r_{i-1} was zero");f=_;let P=a.getZero();const W=l.getCoefficient(l.getDegree()),H=a.inverse(W);for(;f.getDegree()>=l.getDegree()&&!f.isZero();){const q=f.getDegree()-l.getDegree(),J=a.multiply(f.getCoefficient(f.getDegree()),H);P=P.addOrSubtract(a.buildMonomial(q,J)),f=f.addOrSubtract(l.multiplyByMonomial(q,J))}if(h=P.multiply(d).addOrSubtract(D),f.getDegree()>=l.getDegree())throw new Xr("Division algorithm failed to reduce polynomial?")}const p=h.getCoefficient(0);if(p===0)throw new Li("sigmaTilde(0) was zero");const v=a.inverse(p),E=h.multiplyScalar(v),S=f.multiplyScalar(v);return[E,S]}findErrorLocations(r){const i=r.getDegree();if(i===1)return Int32Array.from([r.getCoefficient(1)]);const s=new Int32Array(i);let a=0;const l=this.field;for(let f=1;f<l.getSize()&&a<i;f++)r.evaluateAt(f)===0&&(s[a]=l.inverse(f),a++);if(a!==i)throw new Li("Error locator degree does not match number of roots");return s}findErrorMagnitudes(r,i){const s=i.length,a=new Int32Array(s),l=this.field;for(let f=0;f<s;f++){const d=l.inverse(i[f]);let h=1;for(let p=0;p<s;p++)if(f!==p){const v=l.multiply(i[p],d),E=v&1?v&-2:v|1;h=l.multiply(h,E)}a[f]=l.multiply(r.evaluateAt(d),l.inverse(h)),l.getGeneratorBase()!==0&&(a[f]=l.multiply(a[f],d))}return a}}var _t;(function(y){y[y.UPPER=0]="UPPER",y[y.LOWER=1]="LOWER",y[y.MIXED=2]="MIXED",y[y.DIGIT=3]="DIGIT",y[y.PUNCT=4]="PUNCT",y[y.BINARY=5]="BINARY"})(_t||(_t={}));class je{decode(r){this.ddata=r;let i=r.getBits(),s=this.extractBits(i),a=this.correctBits(s),l=je.convertBoolArrayToByteArray(a),f=je.getEncodedData(a),d=new Bs(l,f,null,null);return d.setNumBits(a.length),d}static highLevelDecode(r){return this.getEncodedData(r)}static getEncodedData(r){let i=r.length,s=_t.UPPER,a=_t.UPPER,l="",f=0;for(;f<i;)if(a===_t.BINARY){if(i-f<5)break;let d=je.readCode(r,f,5);if(f+=5,d===0){if(i-f<11)break;d=je.readCode(r,f,11)+31,f+=11}for(let h=0;h<d;h++){if(i-f<8){f=i;break}const p=je.readCode(r,f,8);l+=ie.castAsNonUtf8Char(p),f+=8}a=s}else{let d=a===_t.DIGIT?4:5;if(i-f<d)break;let h=je.readCode(r,f,d);f+=d;let p=je.getCharacter(a,h);p.startsWith("CTRL_")?(s=a,a=je.getTable(p.charAt(5)),p.charAt(6)==="L"&&(s=a)):(l+=p,a=s)}return l}static getTable(r){switch(r){case"L":return _t.LOWER;case"P":return _t.PUNCT;case"M":return _t.MIXED;case"D":return _t.DIGIT;case"B":return _t.BINARY;case"U":default:return _t.UPPER}}static getCharacter(r,i){switch(r){case _t.UPPER:return je.UPPER_TABLE[i];case _t.LOWER:return je.LOWER_TABLE[i];case _t.MIXED:return je.MIXED_TABLE[i];case _t.PUNCT:return je.PUNCT_TABLE[i];case _t.DIGIT:return je.DIGIT_TABLE[i];default:throw new Xr("Bad table")}}correctBits(r){let i,s;this.ddata.getNbLayers()<=2?(s=6,i=Ne.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,i=Ne.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,i=Ne.AZTEC_DATA_10):(s=12,i=Ne.AZTEC_DATA_12);let a=this.ddata.getNbDatablocks(),l=r.length/s;if(l<a)throw new F;let f=r.length%s,d=new Int32Array(l);for(let S=0;S<l;S++,f+=s)d[S]=je.readCode(r,f,s);try{new Us(i).decode(d,l-a)}catch(S){throw new F(S)}let h=(1<<s)-1,p=0;for(let S=0;S<a;S++){let _=d[S];if(_===0||_===h)throw new F;(_===1||_===h-1)&&p++}let v=new Array(a*s-p),E=0;for(let S=0;S<a;S++){let _=d[S];if(_===1||_===h-1)v.fill(_>1,E,E+s-1),E+=s-1;else for(let D=s-1;D>=0;--D)v[E++]=(_&1<<D)!==0}return v}extractBits(r){let i=this.ddata.isCompact(),s=this.ddata.getNbLayers(),a=(i?11:14)+s*4,l=new Int32Array(a),f=new Array(this.totalBitsInLayer(s,i));if(i)for(let d=0;d<l.length;d++)l[d]=d;else{let d=a+1+2*O.truncDivision(O.truncDivision(a,2)-1,15),h=a/2,p=O.truncDivision(d,2);for(let v=0;v<h;v++){let E=v+O.truncDivision(v,15);l[h-v-1]=p-E-1,l[h+v]=p+E+1}}for(let d=0,h=0;d<s;d++){let p=(s-d)*4+(i?9:12),v=d*2,E=a-1-v;for(let S=0;S<p;S++){let _=S*2;for(let D=0;D<2;D++)f[h+_+D]=r.get(l[v+D],l[v+S]),f[h+2*p+_+D]=r.get(l[v+S],l[E-D]),f[h+4*p+_+D]=r.get(l[E-D],l[E-S]),f[h+6*p+_+D]=r.get(l[E-S],l[v+D])}h+=p*8}return f}static readCode(r,i,s){let a=0;for(let l=i;l<i+s;l++)a<<=1,r[l]&&(a|=1);return a}static readByte(r,i){let s=r.length-i;return s>=8?je.readCode(r,i,8):je.readCode(r,i,s)<<8-s}static convertBoolArrayToByteArray(r){let i=new Uint8Array((r.length+7)/8);for(let s=0;s<i.length;s++)i[s]=je.readByte(r,8*s);return i}totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}je.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],je.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],je.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
461
+ `,hi=e=>e,uR=[hi({id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}}),hi({id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}}),hi({id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}}),hi({id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}}),hi({id:"glass",label:"毛玻璃",swatch:"#c3dbee",preview:["#c3dbee","#357b88"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#edf3f4","--ui-text":"#263e48","--ui-tabbar-bg":"#e0ebee","--ui-tabbar-border":"#d3e1e5","--ui-tab-bg":"#e5eef1","--ui-tab-text":"#58727c","--ui-tab-active-bg":"#edf3f4","--ui-tab-active-text":"#263e48","--ui-tab-accent":"#357b88","--ui-connection-bg":"#e0ebee","--ui-connection-text":"#58727c","--ui-tree-bg":"#e5eef1","--ui-tree-border":"#d3e1e5","--ui-term-col-bg":"#edf3f4","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d3e1e5","--ui-muted-surface":"#e5eef1","--ui-muted-border":"#d3e1e5","--ui-muted-text":"#58727c","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#263e48","--ui-panel-input-border":"#d3e1e5","--ui-drawer-tab-text":"#58727c","--ui-drawer-tab-active":"#263e48","--ui-history-item-text":"#263e48","--ui-history-meta":"#58727c","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e0ebee",border:"#d3e1e5",keyBg:"#ffffff",keyBorder:"#d3e1e5",keyText:"#58727c",accent:"#357b88",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#263e48",cursor:"#357b88",selectionBackground:"#d6dcf4",black:"#263e48",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#58727c",brightBlack:"#58727c",brightWhite:"#edf3f4"}}),hi({id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}}),hi({id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}})],fR="pearl",ll=Object.fromEntries(uR.map(e=>[e.id,e])),dR={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function hR(e){if(e&&e in ll)return ll[e];const t=e?dR[e]:void 0;return t?ll[t]:ll[fR]}const $0={"customer-agent":"Customer Agent",codex:"Codex","claude-code":"Claude Code",opencode:"OpenCode","deepseek-harness":"DeepSeek Harness",qoder:"Qoder",zcode:"ZCode",workbuddy:"WorkBuddy",copilot:"VS Code Copilot"},gR=[{prompt:"带我熟悉这个项目",Icon:MT},{prompt:"帮我排查一个问题",Icon:GT},{prompt:"一起实现一个新想法",Icon:UT}];function pR(e){return e>=5&&e<9?{title:"早啊。",prompt:"新的一天,想做点什么?"}:e>=9&&e<12?{title:"上午好。",prompt:"今天想一起做点什么?"}:e>=12&&e<14?{title:"中午好。",prompt:"想趁午休推进点什么?"}:e>=14&&e<18?{title:"下午好。",prompt:"这个下午,想做点什么?"}:e>=18&&e<23?{title:"晚上好。",prompt:"今晚想一起做点什么?"}:{title:"夜深了。",prompt:"注意休息,重要的事可以先留给我。"}}function mR({agentType:e,ready:t,connectionRequired:n=!1,now:o,onSelectPrompt:c}){const u=$0[e],h=pR((o??new Date).getHours());return L.jsxs("section",{className:"empty-session-welcome","aria-labelledby":"empty-session-welcome-title",children:[L.jsxs("div",{className:"empty-session-welcome__core","aria-hidden":"true",children:[L.jsx("span",{className:"empty-session-welcome__glow"}),L.jsxs("svg",{viewBox:"0 0 120 120",role:"presentation",children:[L.jsx("circle",{className:"empty-session-welcome__orbit empty-session-welcome__orbit--outer",cx:"60",cy:"60",r:"44"}),L.jsx("circle",{className:"empty-session-welcome__orbit empty-session-welcome__orbit--inner",cx:"60",cy:"60",r:"33"}),L.jsx("rect",{className:"empty-session-welcome__diamond",x:"43",y:"43",width:"34",height:"34",rx:"2"}),L.jsx("circle",{className:"empty-session-welcome__pulse",cx:"60",cy:"60",r:"3"})]})]}),L.jsxs("div",{className:"empty-session-welcome__copy",children:[L.jsx("p",{className:"empty-session-welcome__status",children:n?`${u} · 等待连接`:t?`${u} · 已准备好`:`${u} · 等待配置`}),L.jsx("h2",{id:"empty-session-welcome-title",children:h.title}),L.jsx("p",{className:"empty-session-welcome__prompt",children:n?"扫码连接电脑后,就能开始。":t?h.prompt:"配置好 API Key 后,我就能开始。"})]}),L.jsx("div",{className:"empty-session-welcome__starters","aria-label":"开始一个任务",children:gR.map(({prompt:x,Icon:w})=>L.jsxs("button",{type:"button","data-prompt":x,disabled:!t,onClick:()=>c(x),children:[L.jsx(w,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),L.jsx("span",{children:x})]},x))})]})}const xR={copilot:{src:new URL(""+new URL("copilot-7BoBRmFo.png",import.meta.url).href,import.meta.url).href,viewBox:"0 0 256 256"},qoder:{src:new URL(""+new URL("qoder-CGHn7M84.png",import.meta.url).href,import.meta.url).href,viewBox:"14 14 100 100"},zcode:{src:new URL(""+new URL("zcode-CsXrmDtX.png",import.meta.url).href,import.meta.url).href,viewBox:"12 12 104 104"},workbuddy:{src:new URL(""+new URL("workbuddy-hEyEE8dU.png",import.meta.url).href,import.meta.url).href,viewBox:"13 13 102 102"}},wR="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",vR="M75.91 73.628V62.232c0-.96.36-1.68 1.199-2.16l22.912-13.194c3.119-1.8 6.838-2.639 10.676-2.639 14.394 0 23.511 11.157 23.511 23.032 0 .839 0 1.799-.12 2.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318 0L75.91 73.627Zm53.499 44.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142 69.55l9.836-5.638c.839-.48 1.559-.48 2.399 0l22.912 13.195c6.598 3.839 11.035 11.995 11.035 19.912 0 9.116-5.397 17.513-13.915 20.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834 9.837-22.55 23.152-22.55 5.039 0 9.716 1.679 13.676 4.678L70.993 55.516c-1.44.84-2.16 2.039-2.16 3.719v34.787-.002Zm21.173 12.234L75.91 98.339V81.546l14.095-7.917 14.094 7.917v16.793l-14.094 7.916Zm9.056 36.467c-5.038 0-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839 2.159-2.038 2.159-3.718V85.863l9.956 5.757c.84.48 1.2 1.2 1.2 2.16v26.389c0 12.835-9.957 22.552-23.27 22.552v.001Zm-28.43-26.75L47.72 102.778c-6.599-3.84-11.036-11.996-11.036-19.913 0-9.236 5.518-17.513 14.034-20.992v27.35c0 1.68.72 2.879 2.16 3.718l29.989 17.393-9.837 5.638c-.84.48-1.56.48-2.399 0Zm-1.318 19.673c-13.555 0-23.512-10.196-23.512-22.792 0-.959.12-1.919.24-2.879l23.63 13.675c1.44.84 2.88.84 4.32 0l30.108-17.392v11.395c0 .96-.361 1.68-1.2 2.16l-22.912 13.194c-3.119 1.8-6.837 2.639-10.675 2.639Zm29.748 14.274c14.515 0 26.63-10.316 29.39-23.991 13.434-3.479 22.071-16.074 22.071-28.91 0-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557 0-17.153-13.915-29.99-29.989-29.99-3.239 0-6.358.48-9.477 1.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515 0-26.63 10.316-29.39 23.991-13.434 3.48-22.07 16.074-22.07 28.91 0 8.396 3.598 16.553 10.075 22.431-.6 2.519-.96 5.038-.96 7.556 0 17.154 13.915 29.989 29.99 29.989 3.238 0 6.357-.479 9.476-1.559 5.397 5.278 12.835 8.637 20.992 8.637Z";function yR({agentType:e,size:t=16,className:n}){const o=xR[e];return o?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:o.viewBox,"aria-hidden":"true",children:L.jsx("image",{href:o.src,width:e==="copilot"?256:128,height:e==="copilot"?256:128})}):e==="customer-agent"?L.jsxs("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"50 48 180 180",fill:"none","aria-hidden":"true",children:[L.jsx("path",{d:"M76 187V90Q76 74 92 74H188Q204 74 204 90V187",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"}),L.jsx("path",{d:"m108 116 26 24-26 24m47 0h22M100 207h80",stroke:"currentColor",strokeWidth:"14",strokeLinecap:"round",strokeLinejoin:"round"}),L.jsx("circle",{cx:"204",cy:"207",r:"11",fill:"currentColor"})]}):e==="codex"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"29.487 29.964 121.035 119.954","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:vR})}):e==="claude-code"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:wR})}):e==="deepseek-harness"?L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 50 50","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:"M48.8354 10.0479C48.3232 9.79199 48.1025 10.2798 47.8032 10.5278C47.7007 10.6079 47.6143 10.7119 47.5273 10.8076C46.7793 11.624 45.9048 12.1597 44.7622 12.0957C43.0923 12 41.666 12.5356 40.4058 13.8398C40.1377 12.2319 39.2476 11.272 37.8926 10.6558C37.1836 10.3359 36.4668 10.0156 35.9702 9.31982C35.6235 8.82373 35.5293 8.27197 35.356 7.72754C35.2456 7.3999 35.1353 7.06396 34.7651 7.00781C34.3633 6.94385 34.2056 7.2876 34.0479 7.57568C33.418 8.75195 33.1733 10.0479 33.1973 11.3599C33.2524 14.312 34.4736 16.6641 36.8999 18.3359C37.1758 18.5278 37.2466 18.7197 37.1597 19C36.9946 19.5757 36.7974 20.1357 36.624 20.7119C36.5137 21.0801 36.3486 21.1597 35.9624 21C34.6309 20.4321 33.481 19.5918 32.4644 18.5757C30.7393 16.8721 29.1792 14.9917 27.2334 13.52C26.7764 13.1758 26.3193 12.856 25.8467 12.5518C23.8618 10.584 26.1069 8.96777 26.627 8.77588C27.1704 8.57568 26.8159 7.8877 25.0591 7.896C23.3022 7.90381 21.6953 8.50391 19.647 9.30371C19.3477 9.42383 19.0322 9.51172 18.7095 9.58398C16.8501 9.22363 14.9199 9.14355 12.9033 9.37598C9.10596 9.80762 6.07275 11.6396 3.84326 14.7681C1.16455 18.5278 0.53418 22.7998 1.30664 27.2559C2.11768 31.9521 4.46582 35.8398 8.07373 38.8799C11.8159 42.0322 16.1255 43.5762 21.041 43.2803C24.0269 43.104 27.3516 42.6963 31.1016 39.4561C32.0469 39.936 33.0396 40.1279 34.686 40.272C35.9546 40.3921 37.1758 40.208 38.1211 40.0078C39.6021 39.688 39.4995 38.2881 38.9639 38.0322C34.623 35.9678 35.5762 36.8081 34.71 36.1279C36.9155 33.4639 40.2402 30.6958 41.54 21.728C41.6426 21.0161 41.5557 20.5679 41.54 19.9917C41.5322 19.6396 41.6108 19.5039 42.0049 19.4639C43.0923 19.3359 44.1479 19.0317 45.1167 18.4878C47.9292 16.9199 49.064 14.3438 49.3315 11.2559C49.3711 10.7837 49.3237 10.2959 48.8354 10.0479ZM24.3262 37.8398C20.1196 34.4639 18.0791 33.3521 17.2358 33.3999C16.4482 33.4482 16.5898 34.3682 16.7632 34.9678C16.9443 35.5601 17.1812 35.9683 17.5117 36.4878C17.7402 36.832 17.8979 37.3442 17.2832 37.728C15.9282 38.584 13.5728 37.4399 13.4624 37.3838C10.7207 35.7358 8.42822 33.5601 6.81348 30.584C5.25342 27.7197 4.34766 24.6479 4.19775 21.3677C4.1582 20.5757 4.38672 20.2959 5.15869 20.1519C6.17529 19.96 7.22314 19.9199 8.23926 20.0718C12.5327 20.7119 16.1885 22.6719 19.2529 25.7759C21.002 27.5439 22.3252 29.6558 23.6885 31.7202C25.1377 33.9121 26.6978 36 28.6831 37.7119C29.3843 38.312 29.9434 38.7681 30.479 39.104C28.8643 39.2881 26.1699 39.3281 24.3262 37.8398ZM26.3433 24.6001C26.3433 24.248 26.6191 23.9678 26.9658 23.9678C27.0444 23.9678 27.1152 23.9839 27.1782 24.0078C27.2651 24.04 27.3438 24.0879 27.4067 24.1602C27.5171 24.272 27.5801 24.4321 27.5801 24.6001C27.5801 24.9521 27.3042 25.2319 26.9575 25.2319C26.6108 25.2319 26.3433 24.9521 26.3433 24.6001ZM32.6064 27.8799C32.2046 28.0479 31.8027 28.1919 31.4165 28.208C30.8179 28.2397 30.1641 27.9922 29.8096 27.688C29.2583 27.2158 28.8643 26.9521 28.6987 26.1279C28.6279 25.7759 28.6675 25.2319 28.7305 24.9199C28.8721 24.248 28.7144 23.8159 28.2495 23.4238C27.8716 23.104 27.3911 23.0161 26.8633 23.0161C26.666 23.0161 26.4849 22.9277 26.3511 22.856C26.1304 22.7441 25.9492 22.4639 26.1226 22.1201C26.1777 22.0078 26.4458 21.7358 26.5088 21.688C27.2256 21.272 28.0527 21.4077 28.8169 21.7197C29.5259 22.0161 30.0615 22.5601 30.834 23.3281C31.6216 24.2559 31.7632 24.5117 32.2124 25.208C32.5669 25.752 32.8901 26.312 33.1104 26.9521C33.2446 27.3521 33.0713 27.6802 32.6064 27.8799Z"})}):L.jsx("svg",{className:n,"data-agent-icon":e,width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{fill:"currentColor",d:"M22 24H2V0h20zM17 4.8H7v14.4h10z",fillRule:"evenodd"})})}function ER(e,t){const n=t.find(c=>c.agentType===e);if(n!=null&&n.available||e==="customer-agent"&&!n)return;const o=$0[e];return n?/not installed|not found|ENOENT|未安装|找不到/i.test(n.error??"")?`远程未安装 ${o}`:`远程 ${o} 暂不可用`:`正在检查远程 ${o},请稍后重试`}const CR=j0.map(e=>({agentType:e,label:$0[e]}));function bR({value:e,health:t,onChange:n,onUnavailable:o,vertical:c=!1,onPreview:u}){const h=ce.useRef(null),[x,w]=ce.useState(!1);return ce.useEffect(()=>{if(c)return;const m=h.current,C=()=>{const A=m==null?void 0:m.querySelector('[aria-selected="true"]');if(!m||!A)return;const T=A.offsetLeft;T<m.scrollLeft?m.scrollTo({left:T,behavior:"smooth"}):T+A.offsetWidth>m.scrollLeft+m.clientWidth&&m.scrollTo({left:T+A.offsetWidth-m.clientWidth,behavior:"smooth"})};C();const b=typeof ResizeObserver>"u"?null:new ResizeObserver(C);return m&&(b==null||b.observe(m)),()=>b==null?void 0:b.disconnect()},[e,c]),L.jsxs("div",{className:`agent-workspace-switcher${c?" is-vertical":""}`,children:[L.jsx("div",{ref:h,className:"agent-workspace-track",role:"tablist","aria-label":"切换 Agent","aria-orientation":c?"vertical":"horizontal",onScroll:m=>w(m.currentTarget.scrollLeft>1),children:CR.map(m=>{const C=ER(m.agentType,t),b=C!==void 0;return L.jsx("button",{type:"button",role:"tab","aria-selected":e===m.agentType,"aria-label":m.label,"aria-disabled":b,title:b?C:m.label,className:[e===m.agentType?"is-active":"",b?"is-unavailable":""].filter(Boolean).join(" "),onPointerEnter:A=>u==null?void 0:u(m.agentType,m.label,A.currentTarget.getBoundingClientRect(),b?C:void 0),onFocus:A=>u==null?void 0:u(m.agentType,m.label,A.currentTarget.getBoundingClientRect(),b?C:void 0),onClick:()=>{if(b){o(C);return}n(m.agentType)},children:L.jsx(yR,{agentType:m.agentType,size:22})},m.agentType)})}),L.jsx("button",{type:"button",className:"agent-workspace-more","aria-label":x?"前面的 Agent":"更多 Agent",title:`${x?"前面的 Agent":"更多 Agent"} · 手机可左右滑动`,onClick:()=>{const m=h.current;if(!m)return;const C=m.scrollWidth-m.clientWidth;m.scrollTo({left:x?0:C,behavior:"smooth"})},children:x?L.jsx(LT,{size:20,strokeWidth:1.8,"aria-hidden":"true"}):L.jsx(BT,{size:20,strokeWidth:1.8,"aria-hidden":"true"})})]})}const AR="请点击扫码按钮扫码",SR=[["刷新页面",Dv],["打开群聊看板",HT],["打开远程桌面",WT],["打开 AI Hub",FT],["打开数字人",Mv],["皮肤",$T],["打开我的文件",zT]];function IR({onScan:e,initialFailure:t=""}){const[n,o]=ce.useState(!1),[c,u]=ce.useState(t),[h,x]=ce.useState(!1),w=ce.useRef();ce.useEffect(()=>{const T=setTimeout(()=>x(!0),650);return()=>{clearTimeout(T),clearTimeout(w.current)}},[]);const m=()=>{u(AR),clearTimeout(w.current),w.current=setTimeout(()=>u(""),3e3)},C=T=>{T.target.closest("[data-pairing-action]")||(T.preventDefault(),T.stopPropagation(),m())},b=async()=>{if(!n){clearTimeout(w.current),o(!0),u("");try{await e()}catch(T){u(T instanceof Error?T.message:"扫码连接失败,请重试。")}finally{o(!1)}}},A=hR("pearl");return L.jsxs("div",{className:"web-root unpaired-home",style:A.cssVars,onClickCapture:C,onKeyDownCapture:T=>{(T.key==="Enter"||T.key===" ")&&C(T)},children:[L.jsx("style",{dangerouslySetInnerHTML:{__html:cR}}),L.jsxs("div",{className:"terminal-tabs",children:[L.jsx("div",{className:"terminal-tab-list",children:L.jsx("div",{className:"terminal-tab active",role:"tab","aria-disabled":"true",children:L.jsx("span",{children:"智能助手"})})}),L.jsx("button",{type:"button",className:"terminal-add","aria-label":"新建终端页签","aria-disabled":"true",children:"+"}),L.jsx("div",{className:"terminal-connection",children:L.jsx(aR,{items:SR.map(([T,k])=>({id:T,content:L.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":T,"aria-disabled":"true",children:L.jsx(k,{size:17})})})),avatar:L.jsxs("button",{type:"button","data-pairing-action":!0,className:"unpaired-scan","aria-label":"扫码连接电脑",title:"扫码连接电脑",disabled:n,onClick:()=>void b(),children:[L.jsx(DT,{size:19}),L.jsx("span",{children:n?"连接中":"扫码"})]})})})]}),L.jsxs("main",{className:"unpaired-workspace","aria-label":"尚未连接电脑的工作区",children:[L.jsxs("header",{className:"unpaired-workspace-header",children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"会话列表","aria-disabled":"true",children:L.jsx(jT,{size:18})}),L.jsx("span",{children:"智能助手"}),L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"返回","aria-disabled":"true",children:L.jsx(PT,{size:17})})]}),L.jsx("div",{className:"unpaired-agent-switcher",children:L.jsx(bR,{value:"codex",health:[],onChange:m,onUnavailable:m})}),L.jsx("div",{className:"unpaired-welcome",children:L.jsx(mR,{agentType:"codex",ready:!0,connectionRequired:!0,onSelectPrompt:m})}),L.jsxs("div",{className:"unpaired-composer",children:[L.jsx("span",{children:"发送消息…"}),L.jsxs("div",{children:[L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"添加附件","aria-disabled":"true",children:L.jsx(VT,{size:19})}),L.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"发送消息","aria-disabled":"true",children:L.jsx(kT,{size:19})})]})]})]}),c&&L.jsx("p",{className:"unpaired-notice",role:"alert",children:c}),L.jsx(W0,{ready:h})]})}let an=null;function TR(e){an=e}function K_(){return an}function RR(){return(an==null?void 0:an.origin)??location.origin}function Z_(e){return(an==null?void 0:an.frameUrl(e))??e}function Q_(e){return an?new URL(e,an.origin).href:e}function q_(){const e=new URL("/ws",RR());return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.href}const Hv="agentroam.computers.v1",Gv=20,_R=/^[A-Za-z0-9_-]{43}$/;function Xv(e){try{if(typeof e!="string"||e.length>8192)throw new Error;const t=new URL(e.trim().replace(/[,。]+$/,""));if(!["http:","https:"].includes(t.protocol)||t.username||t.password)throw new Error;return t.href}catch{throw new Error("请填写有效的 http(s) 页面地址。")}}function OR(e){if(!Array.isArray(e)||e.length>20)return[];const t=new Map;for(const n of e)if(!(!n||typeof n.id!="string"||!/^[A-Za-z0-9_-]{1,80}$/.test(n.id)||typeof n.name!="string"||!n.name.trim()||!["current","new-tab"].includes(n.openMode)))try{t.set(n.id,{id:n.id,name:n.name.trim().slice(0,60),url:Xv(n.url),openMode:n.openMode})}catch{}return[...t.values()]}function J_(e){try{const t=new URL(Xv(e)).hostname;return t==="qoder.com"||t.endsWith(".qoder.com")?"new-tab":"current"}catch{return"current"}}function Zc(e){try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.pathname!=="/"||t.search||t.hash?null:t.origin}catch{return null}}function Qc(e){if(!Array.isArray(e)||e.length>Gv)return[];const t=new Map;for(const n of e){const o=n&&typeof n.origin=="string"?Zc(n.origin):null;if(!o||typeof n.name!="string")continue;const c=n.name.trim().slice(0,60)||new URL(o).hostname,u=OR(n.pages);t.set(o,{origin:o,name:c,...n.pagesMigrated===!0?{pagesMigrated:!0}:Array.isArray(n.pages)?{pages:u}:{}})}return[...t.values()]}function Yv(e=localStorage){try{return Qc(JSON.parse(e.getItem(Hv)||"[]"))}catch{return[]}}function NR(...e){const t=new Map;for(const n of e)for(const o of Qc(n)){const u={...t.get(o.origin),...o};u.pagesMigrated&&delete u.pages,t.set(o.origin,u)}if(t.size>Gv)throw new Error("最多可添加 20 台电脑。");return[...t.values()]}function kR(e,t=localStorage){const n=Qc(e);try{t.setItem(Hv,JSON.stringify(n))}catch{throw new Error("浏览器无法保存电脑列表,请检查浏览器存储设置。")}return n}function MR(e,t,n=Yv()){var u;const o=Zc(e);if(!o)throw new Error("电脑地址无效。");const c=n.find(h=>h.origin===o);return NR(n,[{origin:o,name:(c==null?void 0:c.name)||new URL(o).hostname,...(u=c==null?void 0:c.pages)!=null&&u.length?{pages:c.pages}:{}}])}function DR(e){try{if(typeof e!="string"||e.length>2048)throw new Error;if(e=e.trim(),e.startsWith("{")){const n=JSON.parse(e),o=Zc(n.server);if(n.type!=="agentroam-pair"||n.version!==1||!o||!_R.test(n.grant))throw new Error;e=o+"/pair#pair="+n.grant}const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.pathname!=="/pair"||t.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(t.hash))throw new Error;return t}catch{throw new Error("这不是 AgentRoam 授权二维码,请在电脑上重新生成。")}}function Kv(e,t,n=""){const o=new URLSearchParams(e.hash.slice(1)),c=Qc(t).map(u=>{var h;return{origin:u.origin,name:u.name,...u.pagesMigrated?{pagesMigrated:!0}:{},...u.origin===e.origin&&!u.pagesMigrated&&((h=u.pages)!=null&&h.length)?{pages:u.pages}:{}}});if(o.set("computers",JSON.stringify({version:1,computers:c,name:n.trim().slice(0,60)})),o.toString().length>16383)throw new Error("电脑列表或待导入页面配置过长,请先导入旧页面后再切换电脑。");return e.hash=o.toString(),e.href}function eO(e,t,n=""){return Kv(DR(e),t,n)}function tO(e,t){const n=Zc(e);if(!n)throw new Error("电脑地址无效。");return Kv(new URL(n+"/pair"),t)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Os;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Os||(Os={}));class kf extends Error{constructor(t,n,o){super(t),this.message=t,this.code=n,this.data=o}}const PR=e=>{var t,n;return e!=null&&e.androidBridge?"android":!((n=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},LR=e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},o=n.Plugins=n.Plugins||{},c=()=>t!==null?t.name:PR(e),u=()=>c()!=="web",h=b=>{const A=m.get(b);return!!(A!=null&&A.platforms.has(c())||x(b))},x=b=>{var A;return(A=n.PluginHeaders)===null||A===void 0?void 0:A.find(T=>T.name===b)},w=b=>e.console.error(b),m=new Map,C=(b,A={})=>{const T=m.get(b);if(T)return console.warn(`Capacitor plugin "${b}" already registered. Cannot register plugins twice.`),T.proxy;const k=c(),M=x(b);let X;const N=async()=>(!X&&k in A?X=typeof A[k]=="function"?X=await A[k]():X=A[k]:t!==null&&!X&&"web"in A&&(X=typeof A.web=="function"?X=await A.web():X=A.web),X),I=(Y,z)=>{var oe,ve;if(M){const ie=M==null?void 0:M.methods.find(pe=>z===pe.name);if(ie)return ie.rtype==="promise"?pe=>n.nativePromise(b,z.toString(),pe):(pe,Te)=>n.nativeCallback(b,z.toString(),pe,Te);if(Y)return(oe=Y[z])===null||oe===void 0?void 0:oe.bind(Y)}else{if(Y)return(ve=Y[z])===null||ve===void 0?void 0:ve.bind(Y);throw new kf(`"${b}" plugin is not implemented on ${k}`,Os.Unimplemented)}},O=Y=>{let z;const oe=(...ve)=>{const ie=N().then(pe=>{const Te=I(pe,Y);if(Te){const G=Te(...ve);return z=G==null?void 0:G.remove,G}else throw new kf(`"${b}.${Y}()" is not implemented on ${k}`,Os.Unimplemented)});return Y==="addListener"&&(ie.remove=async()=>z()),ie};return oe.toString=()=>`${Y.toString()}() { [capacitor code] }`,Object.defineProperty(oe,"name",{value:Y,writable:!1,configurable:!1}),oe},B=O("addListener"),j=O("removeListener"),U=(Y,z)=>{const oe=B({eventName:Y},z),ve=async()=>{const pe=await oe;j({eventName:Y,callbackId:pe},z)},ie=new Promise(pe=>oe.then(()=>pe({remove:ve})));return ie.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ve()},ie},F=new Proxy({},{get(Y,z){switch(z){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?U:B;case"removeListener":return j;default:return O(z)}}});return o[b]=F,m.set(b,{name:b,proxy:F,platforms:new Set([...Object.keys(A),...M?[k]:[]])}),F};return n.convertFileSrc||(n.convertFileSrc=b=>b),n.getPlatform=c,n.handleError=w,n.isNativePlatform=u,n.isPluginAvailable=h,n.registerPlugin=C,n.Exception=kf,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},BR=e=>e.Capacitor=LR(e),Ns=BR(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),pa=Ns.registerPlugin;class Zv{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,n){let o=!1;this.listeners[t]||(this.listeners[t]=[],o=!0),this.listeners[t].push(n);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),o&&this.sendRetainedArgumentsForEvent(t);const h=async()=>this.removeListener(t,n);return Promise.resolve({remove:h})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,n,o){const c=this.listeners[t];if(!c){if(o){let u=this.retainedEventArguments[t];u||(u=[]),u.push(n),this.retainedEventArguments[t]=u}return}c.forEach(u=>u(n))}hasListeners(t){var n;return!!(!((n=this.listeners[t])===null||n===void 0)&&n.length)}registerWindowListener(t,n){this.windowListeners[n]={registered:!1,windowEventName:t,pluginEventName:n,handler:o=>{this.notifyListeners(n,o)}}}unimplemented(t="not implemented"){return new Ns.Exception(t,Os.Unimplemented)}unavailable(t="not available"){return new Ns.Exception(t,Os.Unavailable)}async removeListener(t,n){const o=this.listeners[t];if(!o)return;const c=o.indexOf(n);this.listeners[t].splice(c,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const n=this.retainedEventArguments[t];n&&(delete this.retainedEventArguments[t],n.forEach(o=>{this.notifyListeners(t,o)}))}}const i2=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),s2=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class FR extends Zv{async getCookies(){const t=document.cookie,n={};return t.split(";").forEach(o=>{if(o.length<=0)return;let[c,u]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=s2(c).trim(),u=s2(u).trim(),n[c]=u}),n}async setCookie(t){try{const n=i2(t.key),o=i2(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),h=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${n}=${o||""}${c}; path=${u}; ${h};`}catch(n){return Promise.reject(n)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const n of t)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}pa("CapacitorCookies",{web:()=>new FR});const UR=async e=>new Promise((t,n)=>{const o=new FileReader;o.onload=()=>{const c=o.result;t(c.indexOf(",")>=0?c.split(",")[1]:c)},o.onerror=c=>n(c),o.readAsDataURL(e)}),jR=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,u,h)=>(c[u]=e[t[h]],c),{})},WR=(e,t=!0)=>e?Object.entries(e).reduce((o,c)=>{const[u,h]=c;let x,w;return Array.isArray(h)?(w="",h.forEach(m=>{x=t?encodeURIComponent(m):m,w+=`${u}=${x}&`}),w.slice(0,-1)):(x=t?encodeURIComponent(h):h,w=`${u}=${x}`),`${o}&${w}`},"").substr(1):null,$R=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),c=jR(e.headers)["content-type"]||"";if(typeof e.data=="string")n.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[h,x]of Object.entries(e.data||{}))u.set(h,x);n.body=u.toString()}else if(c.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((x,w)=>{u.append(w,x)});else for(const x of Object.keys(e.data))u.append(x,e.data[x]);n.body=u;const h=new Headers(n.headers);h.delete("content-type"),n.headers=h}else(c.includes("application/json")||typeof e.data=="object")&&(n.body=JSON.stringify(e.data));return n};class zR extends Zv{async request(t){const n=$R(t,t.webFetchExtra),o=WR(t.params,t.shouldEncodeUrlParams),c=o?`${t.url}?${o}`:t.url,u=await fetch(c,n),h=u.headers.get("content-type")||"";let{responseType:x="text"}=u.ok?t:{};h.includes("application/json")&&(x="json");let w,m;switch(x){case"arraybuffer":case"blob":m=await u.blob(),w=await UR(m);break;case"json":w=await u.json();break;case"document":case"text":default:w=await u.text()}const C={};return u.headers.forEach((b,A)=>{C[A]=b}),{data:w,headers:C,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}pa("CapacitorHttp",{web:()=>new zR});var re;(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(re||(re={}));var o2=new Map([[re.QR_CODE,"QR_CODE"],[re.AZTEC,"AZTEC"],[re.CODABAR,"CODABAR"],[re.CODE_39,"CODE_39"],[re.CODE_93,"CODE_93"],[re.CODE_128,"CODE_128"],[re.DATA_MATRIX,"DATA_MATRIX"],[re.MAXICODE,"MAXICODE"],[re.ITF,"ITF"],[re.EAN_13,"EAN_13"],[re.EAN_8,"EAN_8"],[re.PDF_417,"PDF_417"],[re.RSS_14,"RSS_14"],[re.RSS_EXPANDED,"RSS_EXPANDED"],[re.UPC_A,"UPC_A"],[re.UPC_E,"UPC_E"],[re.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),a2;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(a2||(a2={}));function VR(e){return Object.values(re).includes(e)}var dc;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(dc||(dc={}));var HR=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[dc.SCAN_TYPE_CAMERA,dc.SCAN_TYPE_FILE],e}(),Qv=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!o2.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,o2.get(t))},e}(),l2=function(){function e(){}return e.createFromText=function(t){var n={text:t};return{decodedText:t,result:n}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),Y1;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Y1||(Y1={}));var GR=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:Y1.UNKWOWN_ERROR}},e}(),XR=function(){function e(t){this.verbose=t}return e.prototype.log=function(t){this.verbose&&console.log(t)},e.prototype.warn=function(t){this.verbose&&console.warn(t)},e.prototype.logError=function(t,n){(this.verbose||n===!0)&&console.error(t)},e.prototype.logErrors=function(t){if(t.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},e}();function fn(e){return typeof e>"u"||e===null}var us=function(){function e(){}return e.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},e.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),qv=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,n){if(typeof t!="object"){var o=typeof t;return n.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(o,"."),!0),!1}for(var c=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],u=new Set(c),h=Object.keys(t),x=0,w=h;x<w.length;x++){var m=w[x];if(u.has(m))return n.logError("".concat(m," is not supported videoConstaints."),!0),!1}return!0},e}(),K1={exports:{}};(function(e,t){(function(n,o){o(t)})(pn,function(n){function o(y){return y==null}var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,r){y.__proto__=r}||function(y,r){for(var i in r)r.hasOwnProperty(i)&&(y[i]=r[i])};function u(y,r){c(y,r);function i(){this.constructor=y}y.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}function h(y,r){var i=Object.setPrototypeOf;i?i(y,r):y.__proto__=r}function x(y,r){r===void 0&&(r=y.constructor);var i=Error.captureStackTrace;i&&i(y,r)}var w=function(y){u(r,y);function r(i){var s=this.constructor,a=y.call(this,i)||this;return Object.defineProperty(a,"name",{value:s.name,enumerable:!1}),h(a,s.prototype),x(a),a}return r}(Error);class m extends w{constructor(r=void 0){super(r),this.message=r}getKind(){return this.constructor.kind}}m.kind="Exception";class C extends m{}C.kind="ArgumentException";class b extends m{}b.kind="IllegalArgumentException";class A{constructor(r){if(this.binarizer=r,r===null)throw new b("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(r,i){return this.binarizer.getBlackRow(r,i)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(r,i,s,a){const l=this.binarizer.getLuminanceSource().crop(r,i,s,a);return new A(this.binarizer.createBinarizer(l))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new A(this.binarizer.createBinarizer(r))}rotateCounterClockwise45(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new A(this.binarizer.createBinarizer(r))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class T extends m{static getChecksumInstance(){return new T}}T.kind="ChecksumException";class k{constructor(r){this.source=r}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class M{static arraycopy(r,i,s,a,l){for(;l--;)s[a++]=r[i++]}static currentTimeMillis(){return Date.now()}}class X extends m{}X.kind="IndexOutOfBoundsException";class N extends X{constructor(r=void 0,i=void 0){super(i),this.index=r,this.message=i}}N.kind="ArrayIndexOutOfBoundsException";class I{static fill(r,i){for(let s=0,a=r.length;s<a;s++)r[s]=i}static fillWithin(r,i,s,a){I.rangeCheck(r.length,i,s);for(let l=i;l<s;l++)r[l]=a}static rangeCheck(r,i,s){if(i>s)throw new b("fromIndex("+i+") > toIndex("+s+")");if(i<0)throw new N(i);if(s>r)throw new N(s)}static asList(...r){return r}static create(r,i,s){return Array.from({length:r}).map(l=>Array.from({length:i}).fill(s))}static createInt32Array(r,i,s){return Array.from({length:r}).map(l=>Int32Array.from({length:i}).fill(s))}static equals(r,i){if(!r||!i||!r.length||!i.length||r.length!==i.length)return!1;for(let s=0,a=r.length;s<a;s++)if(r[s]!==i[s])return!1;return!0}static hashCode(r){if(r===null)return 0;let i=1;for(const s of r)i=31*i+s;return i}static fillUint8Array(r,i){for(let s=0;s!==r.length;s++)r[s]=i}static copyOf(r,i){return r.slice(0,i)}static copyOfUint8Array(r,i){if(r.length<=i){const s=new Uint8Array(i);return s.set(r),s}return r.slice(0,i)}static copyOfRange(r,i,s){const a=s-i,l=new Int32Array(a);return M.arraycopy(r,i,l,0,a),l}static binarySearch(r,i,s){s===void 0&&(s=I.numberComparator);let a=0,l=r.length-1;for(;a<=l;){const f=l+a>>1,d=s(i,r[f]);if(d>0)a=f+1;else if(d<0)l=f-1;else return f}return-a-1}static numberComparator(r,i){return r-i}}class O{static numberOfTrailingZeros(r){let i;if(r===0)return 32;let s=31;return i=r<<16,i!==0&&(s-=16,r=i),i=r<<8,i!==0&&(s-=8,r=i),i=r<<4,i!==0&&(s-=4,r=i),i=r<<2,i!==0&&(s-=2,r=i),s-(r<<1>>>31)}static numberOfLeadingZeros(r){if(r===0)return 32;let i=1;return r>>>16||(i+=16,r<<=16),r>>>24||(i+=8,r<<=8),r>>>28||(i+=4,r<<=4),r>>>30||(i+=2,r<<=2),i-=r>>>31,i}static toHexString(r){return r.toString(16)}static toBinaryString(r){return String(parseInt(String(r),2))}static bitCount(r){return r=r-(r>>>1&1431655765),r=(r&858993459)+(r>>>2&858993459),r=r+(r>>>4)&252645135,r=r+(r>>>8),r=r+(r>>>16),r&63}static truncDivision(r,i){return Math.trunc(r/i)}static parseInt(r,i=void 0){return parseInt(r,i)}}O.MIN_VALUE_32_BITS=-2147483648,O.MAX_VALUE=Number.MAX_SAFE_INTEGER;class B{constructor(r,i){r===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=r,i==null?this.bits=B.makeArray(r):this.bits=i)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(r){if(r>this.bits.length*32){const i=B.makeArray(r);M.arraycopy(this.bits,0,i,0,this.bits.length),this.bits=i}}get(r){return(this.bits[Math.floor(r/32)]&1<<(r&31))!==0}set(r){this.bits[Math.floor(r/32)]|=1<<(r&31)}flip(r){this.bits[Math.floor(r/32)]^=1<<(r&31)}getNextSet(r){const i=this.size;if(r>=i)return i;const s=this.bits;let a=Math.floor(r/32),l=s[a];l&=~((1<<(r&31))-1);const f=s.length;for(;l===0;){if(++a===f)return i;l=s[a]}const d=a*32+O.numberOfTrailingZeros(l);return d>i?i:d}getNextUnset(r){const i=this.size;if(r>=i)return i;const s=this.bits;let a=Math.floor(r/32),l=~s[a];l&=~((1<<(r&31))-1);const f=s.length;for(;l===0;){if(++a===f)return i;l=~s[a]}const d=a*32+O.numberOfTrailingZeros(l);return d>i?i:d}setBulk(r,i){this.bits[Math.floor(r/32)]=i}setRange(r,i){if(i<r||r<0||i>this.size)throw new b;if(i===r)return;i--;const s=Math.floor(r/32),a=Math.floor(i/32),l=this.bits;for(let f=s;f<=a;f++){const d=f>s?0:r&31,p=(2<<(f<a?31:i&31))-(1<<d);l[f]|=p}}clear(){const r=this.bits.length,i=this.bits;for(let s=0;s<r;s++)i[s]=0}isRange(r,i,s){if(i<r||r<0||i>this.size)throw new b;if(i===r)return!0;i--;const a=Math.floor(r/32),l=Math.floor(i/32),f=this.bits;for(let d=a;d<=l;d++){const g=d>a?0:r&31,v=(2<<(d<l?31:i&31))-(1<<g)&4294967295;if((f[d]&v)!==(s?v:0))return!1}return!0}appendBit(r){this.ensureCapacity(this.size+1),r&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(r,i){if(i<0||i>32)throw new b("Num bits must be between 0 and 32");this.ensureCapacity(this.size+i);for(let s=i;s>0;s--)this.appendBit((r>>s-1&1)===1)}appendBitArray(r){const i=r.size;this.ensureCapacity(this.size+i);for(let s=0;s<i;s++)this.appendBit(r.get(s))}xor(r){if(this.size!==r.size)throw new b("Sizes don't match");const i=this.bits;for(let s=0,a=i.length;s<a;s++)i[s]^=r.bits[s]}toBytes(r,i,s,a){for(let l=0;l<a;l++){let f=0;for(let d=0;d<8;d++)this.get(r)&&(f|=1<<7-d),r++;i[s+l]=f}}getBitArray(){return this.bits}reverse(){const r=new Int32Array(this.bits.length),i=Math.floor((this.size-1)/32),s=i+1,a=this.bits;for(let l=0;l<s;l++){let f=a[l];f=f>>1&1431655765|(f&1431655765)<<1,f=f>>2&858993459|(f&858993459)<<2,f=f>>4&252645135|(f&252645135)<<4,f=f>>8&16711935|(f&16711935)<<8,f=f>>16&65535|(f&65535)<<16,r[i-l]=f}if(this.size!==s*32){const l=s*32-this.size;let f=r[0]>>>l;for(let d=1;d<s;d++){const g=r[d];f|=g<<32-l,r[d-1]=f,f=g>>>l}r[s-1]=f}this.bits=r}static makeArray(r){return new Int32Array(Math.floor((r+31)/32))}equals(r){if(!(r instanceof B))return!1;const i=r;return this.size===i.size&&I.equals(this.bits,i.bits)}hashCode(){return 31*this.size+I.hashCode(this.bits)}toString(){let r="";for(let i=0,s=this.size;i<s;i++)i&7||(r+=" "),r+=this.get(i)?"X":".";return r}clone(){return new B(this.size,this.bits.slice())}}var j;(function(y){y[y.OTHER=0]="OTHER",y[y.PURE_BARCODE=1]="PURE_BARCODE",y[y.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",y[y.TRY_HARDER=3]="TRY_HARDER",y[y.CHARACTER_SET=4]="CHARACTER_SET",y[y.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",y[y.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",y[y.ASSUME_GS1=7]="ASSUME_GS1",y[y.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",y[y.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",y[y.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(j||(j={}));var U=j;class F extends m{static getFormatInstance(){return new F}}F.kind="FormatException";var Y;(function(y){y[y.Cp437=0]="Cp437",y[y.ISO8859_1=1]="ISO8859_1",y[y.ISO8859_2=2]="ISO8859_2",y[y.ISO8859_3=3]="ISO8859_3",y[y.ISO8859_4=4]="ISO8859_4",y[y.ISO8859_5=5]="ISO8859_5",y[y.ISO8859_6=6]="ISO8859_6",y[y.ISO8859_7=7]="ISO8859_7",y[y.ISO8859_8=8]="ISO8859_8",y[y.ISO8859_9=9]="ISO8859_9",y[y.ISO8859_10=10]="ISO8859_10",y[y.ISO8859_11=11]="ISO8859_11",y[y.ISO8859_13=12]="ISO8859_13",y[y.ISO8859_14=13]="ISO8859_14",y[y.ISO8859_15=14]="ISO8859_15",y[y.ISO8859_16=15]="ISO8859_16",y[y.SJIS=16]="SJIS",y[y.Cp1250=17]="Cp1250",y[y.Cp1251=18]="Cp1251",y[y.Cp1252=19]="Cp1252",y[y.Cp1256=20]="Cp1256",y[y.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",y[y.UTF8=22]="UTF8",y[y.ASCII=23]="ASCII",y[y.Big5=24]="Big5",y[y.GB18030=25]="GB18030",y[y.EUC_KR=26]="EUC_KR"})(Y||(Y={}));class z{constructor(r,i,s,...a){this.valueIdentifier=r,this.name=s,typeof i=="number"?this.values=Int32Array.from([i]):this.values=i,this.otherEncodingNames=a,z.VALUE_IDENTIFIER_TO_ECI.set(r,this),z.NAME_TO_ECI.set(s,this);const l=this.values;for(let f=0,d=l.length;f!==d;f++){const g=l[f];z.VALUES_TO_ECI.set(g,this)}for(const f of a)z.NAME_TO_ECI.set(f,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(r){if(r<0||r>=900)throw new F("incorect value");const i=z.VALUES_TO_ECI.get(r);if(i===void 0)throw new F("incorect value");return i}static getCharacterSetECIByName(r){const i=z.NAME_TO_ECI.get(r);if(i===void 0)throw new F("incorect value");return i}equals(r){if(!(r instanceof z))return!1;const i=r;return this.getName()===i.getName()}}z.VALUE_IDENTIFIER_TO_ECI=new Map,z.VALUES_TO_ECI=new Map,z.NAME_TO_ECI=new Map,z.Cp437=new z(Y.Cp437,Int32Array.from([0,2]),"Cp437"),z.ISO8859_1=new z(Y.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),z.ISO8859_2=new z(Y.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),z.ISO8859_3=new z(Y.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),z.ISO8859_4=new z(Y.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),z.ISO8859_5=new z(Y.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),z.ISO8859_6=new z(Y.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),z.ISO8859_7=new z(Y.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),z.ISO8859_8=new z(Y.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),z.ISO8859_9=new z(Y.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),z.ISO8859_10=new z(Y.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),z.ISO8859_11=new z(Y.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),z.ISO8859_13=new z(Y.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),z.ISO8859_14=new z(Y.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),z.ISO8859_15=new z(Y.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),z.ISO8859_16=new z(Y.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),z.SJIS=new z(Y.SJIS,20,"SJIS","Shift_JIS"),z.Cp1250=new z(Y.Cp1250,21,"Cp1250","windows-1250"),z.Cp1251=new z(Y.Cp1251,22,"Cp1251","windows-1251"),z.Cp1252=new z(Y.Cp1252,23,"Cp1252","windows-1252"),z.Cp1256=new z(Y.Cp1256,24,"Cp1256","windows-1256"),z.UnicodeBigUnmarked=new z(Y.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),z.UTF8=new z(Y.UTF8,26,"UTF8","UTF-8"),z.ASCII=new z(Y.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),z.Big5=new z(Y.Big5,28,"Big5"),z.GB18030=new z(Y.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),z.EUC_KR=new z(Y.EUC_KR,30,"EUC_KR","EUC-KR");class oe extends m{}oe.kind="UnsupportedOperationException";class ve{static decode(r,i){const s=this.encodingName(i);return this.customDecoder?this.customDecoder(r,s):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(s)?this.decodeFallback(r,s):new TextDecoder(s).decode(r)}static shouldDecodeOnFallback(r){return!ve.isBrowser()&&r==="ISO-8859-1"}static encode(r,i){const s=this.encodingName(i);return this.customEncoder?this.customEncoder(r,s):typeof TextEncoder>"u"?this.encodeFallback(r):new TextEncoder().encode(r)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(r){return typeof r=="string"?r:r.getName()}static encodingCharacterSet(r){return r instanceof z?r:z.getCharacterSetECIByName(r)}static decodeFallback(r,i){const s=this.encodingCharacterSet(i);if(ve.isDecodeFallbackSupported(s)){let a="";for(let l=0,f=r.length;l<f;l++){let d=r[l].toString(16);d.length<2&&(d="0"+d),a+="%"+d}return decodeURIComponent(a)}if(s.equals(z.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(r.buffer));throw new oe(`Encoding ${this.encodingName(i)} not supported by fallback.`)}static isDecodeFallbackSupported(r){return r.equals(z.UTF8)||r.equals(z.ISO8859_1)||r.equals(z.ASCII)}static encodeFallback(r){const s=btoa(unescape(encodeURIComponent(r))).split(""),a=[];for(let l=0;l<s.length;l++)a.push(s[l].charCodeAt(0));return new Uint8Array(a)}}class ie{static castAsNonUtf8Char(r,i=null){const s=i?i.getName():this.ISO88591;return ve.decode(new Uint8Array([r]),s)}static guessEncoding(r,i){if(i!=null&&i.get(U.CHARACTER_SET)!==void 0)return i.get(U.CHARACTER_SET).toString();const s=r.length;let a=!0,l=!0,f=!0,d=0,g=0,p=0,v=0,E=0,S=0,_=0,D=0,P=0,W=0,H=0;const q=r.length>3&&r[0]===239&&r[1]===187&&r[2]===191;for(let J=0;J<s&&(a||l||f);J++){const Z=r[J]&255;f&&(d>0?Z&128?d--:f=!1:Z&128&&(Z&64?(d++,Z&32?(d++,Z&16?(d++,Z&8?f=!1:v++):p++):g++):f=!1)),a&&(Z>127&&Z<160?a=!1:Z>159&&(Z<192||Z===215||Z===247)&&H++),l&&(E>0?Z<64||Z===127||Z>252?l=!1:E--:Z===128||Z===160||Z>239?l=!1:Z>160&&Z<224?(S++,D=0,_++,_>P&&(P=_)):Z>127?(E++,_=0,D++,D>W&&(W=D)):(_=0,D=0))}return f&&d>0&&(f=!1),l&&E>0&&(l=!1),f&&(q||g+p+v>0)?ie.UTF8:l&&(ie.ASSUME_SHIFT_JIS||P>=3||W>=3)?ie.SHIFT_JIS:a&&l?P===2&&S===2||H*10>=s?ie.SHIFT_JIS:ie.ISO88591:a?ie.ISO88591:l?ie.SHIFT_JIS:f?ie.UTF8:ie.PLATFORM_DEFAULT_ENCODING}static format(r,...i){let s=-1;function a(f,d,g,p,v,E){if(f==="%%")return"%";if(i[++s]===void 0)return;f=p?parseInt(p.substr(1)):void 0;let S=v?parseInt(v.substr(1)):void 0,_;switch(E){case"s":_=i[s];break;case"c":_=i[s][0];break;case"f":_=parseFloat(i[s]).toFixed(f);break;case"p":_=parseFloat(i[s]).toPrecision(f);break;case"e":_=parseFloat(i[s]).toExponential(f);break;case"x":_=parseInt(i[s]).toString(S||16);break;case"d":_=parseFloat(parseInt(i[s],S||10).toPrecision(f)).toFixed(0);break}_=typeof _=="object"?JSON.stringify(_):(+_).toString(S);let D=parseInt(g),P=g&&g[0]+""=="0"?"0":" ";for(;_.length<D;)_=d!==void 0?_+P:P+_;return _}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}static getBytes(r,i){return ve.encode(r,i)}static getCharCode(r,i=0){return r.charCodeAt(i)}static getCharAt(r){return String.fromCharCode(r)}}ie.SHIFT_JIS=z.SJIS.getName(),ie.GB2312="GB2312",ie.ISO88591=z.ISO8859_1.getName(),ie.EUC_JP="EUC_JP",ie.UTF8=z.UTF8.getName(),ie.PLATFORM_DEFAULT_ENCODING=ie.UTF8,ie.ASSUME_SHIFT_JIS=!1;class pe{constructor(r=""){this.value=r}enableDecoding(r){return this.encoding=r,this}append(r){return typeof r=="string"?this.value+=r.toString():this.encoding?this.value+=ie.castAsNonUtf8Char(r,this.encoding):this.value+=String.fromCharCode(r),this}appendChars(r,i,s){for(let a=i;i<i+s;a++)this.append(r[a]);return this}length(){return this.value.length}charAt(r){return this.value.charAt(r)}deleteCharAt(r){this.value=this.value.substr(0,r)+this.value.substring(r+1)}setCharAt(r,i){this.value=this.value.substr(0,r)+i+this.value.substr(r+1)}substring(r,i){return this.value.substring(r,i)}setLengthToZero(){this.value=""}toString(){return this.value}insert(r,i){this.value=this.value.substr(0,r)+i+this.value.substr(r+i.length)}}class Te{constructor(r,i,s,a){if(this.width=r,this.height=i,this.rowSize=s,this.bits=a,i==null&&(i=r),this.height=i,r<1||i<1)throw new b("Both dimensions must be greater than 0");s==null&&(s=Math.floor((r+31)/32)),this.rowSize=s,a==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(r){const i=r.length,s=r[0].length,a=new Te(s,i);for(let l=0;l<i;l++){const f=r[l];for(let d=0;d<s;d++)f[d]&&a.set(d,l)}return a}static parseFromString(r,i,s){if(r===null)throw new b("stringRepresentation cannot be null");const a=new Array(r.length);let l=0,f=0,d=-1,g=0,p=0;for(;p<r.length;)if(r.charAt(p)===`
462
+ `||r.charAt(p)==="\r"){if(l>f){if(d===-1)d=l-f;else if(l-f!==d)throw new b("row lengths do not match");f=l,g++}p++}else if(r.substring(p,p+i.length)===i)p+=i.length,a[l]=!0,l++;else if(r.substring(p,p+s.length)===s)p+=s.length,a[l]=!1,l++;else throw new b("illegal character encountered: "+r.substring(p));if(l>f){if(d===-1)d=l-f;else if(l-f!==d)throw new b("row lengths do not match");g++}const v=new Te(d,g);for(let E=0;E<l;E++)a[E]&&v.set(Math.floor(E%d),Math.floor(E/d));return v}get(r,i){const s=i*this.rowSize+Math.floor(r/32);return(this.bits[s]>>>(r&31)&1)!==0}set(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]|=1<<(r&31)&4294967295}unset(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]&=~(1<<(r&31)&4294967295)}flip(r,i){const s=i*this.rowSize+Math.floor(r/32);this.bits[s]^=1<<(r&31)&4294967295}xor(r){if(this.width!==r.getWidth()||this.height!==r.getHeight()||this.rowSize!==r.getRowSize())throw new b("input matrix dimensions do not match");const i=new B(Math.floor(this.width/32)+1),s=this.rowSize,a=this.bits;for(let l=0,f=this.height;l<f;l++){const d=l*s,g=r.getRow(l,i).getBitArray();for(let p=0;p<s;p++)a[d+p]^=g[p]}}clear(){const r=this.bits,i=r.length;for(let s=0;s<i;s++)r[s]=0}setRegion(r,i,s,a){if(i<0||r<0)throw new b("Left and top must be nonnegative");if(a<1||s<1)throw new b("Height and width must be at least 1");const l=r+s,f=i+a;if(f>this.height||l>this.width)throw new b("The region must fit inside the matrix");const d=this.rowSize,g=this.bits;for(let p=i;p<f;p++){const v=p*d;for(let E=r;E<l;E++)g[v+Math.floor(E/32)]|=1<<(E&31)&4294967295}}getRow(r,i){i==null||i.getSize()<this.width?i=new B(this.width):i.clear();const s=this.rowSize,a=this.bits,l=r*s;for(let f=0;f<s;f++)i.setBulk(f*32,a[l+f]);return i}setRow(r,i){M.arraycopy(i.getBitArray(),0,this.bits,r*this.rowSize,this.rowSize)}rotate180(){const r=this.getWidth(),i=this.getHeight();let s=new B(r),a=new B(r);for(let l=0,f=Math.floor((i+1)/2);l<f;l++)s=this.getRow(l,s),a=this.getRow(i-1-l,a),s.reverse(),a.reverse(),this.setRow(l,a),this.setRow(i-1-l,s)}getEnclosingRectangle(){const r=this.width,i=this.height,s=this.rowSize,a=this.bits;let l=r,f=i,d=-1,g=-1;for(let p=0;p<i;p++)for(let v=0;v<s;v++){const E=a[p*s+v];if(E!==0){if(p<f&&(f=p),p>g&&(g=p),v*32<l){let S=0;for(;!(E<<31-S&4294967295);)S++;v*32+S<l&&(l=v*32+S)}if(v*32+31>d){let S=31;for(;!(E>>>S);)S--;v*32+S>d&&(d=v*32+S)}}}return d<l||g<f?null:Int32Array.from([l,f,d-l+1,g-f+1])}getTopLeftOnBit(){const r=this.rowSize,i=this.bits;let s=0;for(;s<i.length&&i[s]===0;)s++;if(s===i.length)return null;const a=s/r;let l=s%r*32;const f=i[s];let d=0;for(;!(f<<31-d&4294967295);)d++;return l+=d,Int32Array.from([l,a])}getBottomRightOnBit(){const r=this.rowSize,i=this.bits;let s=i.length-1;for(;s>=0&&i[s]===0;)s--;if(s<0)return null;const a=Math.floor(s/r);let l=Math.floor(s%r)*32;const f=i[s];let d=31;for(;!(f>>>d);)d--;return l+=d,Int32Array.from([l,a])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(r){if(!(r instanceof Te))return!1;const i=r;return this.width===i.width&&this.height===i.height&&this.rowSize===i.rowSize&&I.equals(this.bits,i.bits)}hashCode(){let r=this.width;return r=31*r+this.width,r=31*r+this.height,r=31*r+this.rowSize,r=31*r+I.hashCode(this.bits),r}toString(r="X ",i=" ",s=`
463
+ `){return this.buildToString(r,i,s)}buildToString(r,i,s){let a=new pe;for(let l=0,f=this.height;l<f;l++){for(let d=0,g=this.width;d<g;d++)a.append(this.get(d,l)?r:i);a.append(s)}return a.toString()}clone(){return new Te(this.width,this.height,this.rowSize,this.bits.slice())}}class G extends m{static getNotFoundInstance(){return new G}}G.kind="NotFoundException";class rt extends k{constructor(r){super(r),this.luminances=rt.EMPTY,this.buckets=new Int32Array(rt.LUMINANCE_BUCKETS)}getBlackRow(r,i){const s=this.getLuminanceSource(),a=s.getWidth();i==null||i.getSize()<a?i=new B(a):i.clear(),this.initArrays(a);const l=s.getRow(r,this.luminances),f=this.buckets;for(let g=0;g<a;g++)f[(l[g]&255)>>rt.LUMINANCE_SHIFT]++;const d=rt.estimateBlackPoint(f);if(a<3)for(let g=0;g<a;g++)(l[g]&255)<d&&i.set(g);else{let g=l[0]&255,p=l[1]&255;for(let v=1;v<a-1;v++){const E=l[v+1]&255;(p*4-g-E)/2<d&&i.set(v),g=p,p=E}}return i}getBlackMatrix(){const r=this.getLuminanceSource(),i=r.getWidth(),s=r.getHeight(),a=new Te(i,s);this.initArrays(i);const l=this.buckets;for(let g=1;g<5;g++){const p=Math.floor(s*g/5),v=r.getRow(p,this.luminances),E=Math.floor(i*4/5);for(let S=Math.floor(i/5);S<E;S++){const _=v[S]&255;l[_>>rt.LUMINANCE_SHIFT]++}}const f=rt.estimateBlackPoint(l),d=r.getMatrix();for(let g=0;g<s;g++){const p=g*i;for(let v=0;v<i;v++)(d[p+v]&255)<f&&a.set(v,g)}return a}createBinarizer(r){return new rt(r)}initArrays(r){this.luminances.length<r&&(this.luminances=new Uint8ClampedArray(r));const i=this.buckets;for(let s=0;s<rt.LUMINANCE_BUCKETS;s++)i[s]=0}static estimateBlackPoint(r){const i=r.length;let s=0,a=0,l=0;for(let v=0;v<i;v++)r[v]>l&&(a=v,l=r[v]),r[v]>s&&(s=r[v]);let f=0,d=0;for(let v=0;v<i;v++){const E=v-a,S=r[v]*E*E;S>d&&(f=v,d=S)}if(a>f){const v=a;a=f,f=v}if(f-a<=i/16)throw new G;let g=f-1,p=-1;for(let v=f-1;v>a;v--){const E=v-a,S=E*E*(f-v)*(s-r[v]);S>p&&(g=v,p=S)}return g<<rt.LUMINANCE_SHIFT}}rt.LUMINANCE_BITS=5,rt.LUMINANCE_SHIFT=8-rt.LUMINANCE_BITS,rt.LUMINANCE_BUCKETS=1<<rt.LUMINANCE_BITS,rt.EMPTY=Uint8ClampedArray.from([0]);class xe extends rt{constructor(r){super(r),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const r=this.getLuminanceSource(),i=r.getWidth(),s=r.getHeight();if(i>=xe.MINIMUM_DIMENSION&&s>=xe.MINIMUM_DIMENSION){const a=r.getMatrix();let l=i>>xe.BLOCK_SIZE_POWER;i&xe.BLOCK_SIZE_MASK&&l++;let f=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&f++;const d=xe.calculateBlackPoints(a,l,f,i,s),g=new Te(i,s);xe.calculateThresholdForBlock(a,l,f,i,s,d,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(r){return new xe(r)}static calculateThresholdForBlock(r,i,s,a,l,f,d){const g=l-xe.BLOCK_SIZE,p=a-xe.BLOCK_SIZE;for(let v=0;v<s;v++){let E=v<<xe.BLOCK_SIZE_POWER;E>g&&(E=g);const S=xe.cap(v,2,s-3);for(let _=0;_<i;_++){let D=_<<xe.BLOCK_SIZE_POWER;D>p&&(D=p);const P=xe.cap(_,2,i-3);let W=0;for(let q=-2;q<=2;q++){const J=f[S+q];W+=J[P-2]+J[P-1]+J[P]+J[P+1]+J[P+2]}const H=W/25;xe.thresholdBlock(r,D,E,H,a,d)}}}static cap(r,i,s){return r<i?i:r>s?s:r}static thresholdBlock(r,i,s,a,l,f){for(let d=0,g=s*l+i;d<xe.BLOCK_SIZE;d++,g+=l)for(let p=0;p<xe.BLOCK_SIZE;p++)(r[g+p]&255)<=a&&f.set(i+p,s+d)}static calculateBlackPoints(r,i,s,a,l){const f=l-xe.BLOCK_SIZE,d=a-xe.BLOCK_SIZE,g=new Array(s);for(let p=0;p<s;p++){g[p]=new Int32Array(i);let v=p<<xe.BLOCK_SIZE_POWER;v>f&&(v=f);for(let E=0;E<i;E++){let S=E<<xe.BLOCK_SIZE_POWER;S>d&&(S=d);let _=0,D=255,P=0;for(let H=0,q=v*a+S;H<xe.BLOCK_SIZE;H++,q+=a){for(let J=0;J<xe.BLOCK_SIZE;J++){const Z=r[q+J]&255;_+=Z,Z<D&&(D=Z),Z>P&&(P=Z)}if(P-D>xe.MIN_DYNAMIC_RANGE)for(H++,q+=a;H<xe.BLOCK_SIZE;H++,q+=a)for(let J=0;J<xe.BLOCK_SIZE;J++)_+=r[q+J]&255}let W=_>>xe.BLOCK_SIZE_POWER*2;if(P-D<=xe.MIN_DYNAMIC_RANGE&&(W=D/2,p>0&&E>0)){const H=(g[p-1][E]+2*g[p][E-1]+g[p-1][E-1])/4;D<H&&(W=H)}g[p][E]=W}}return g}}xe.BLOCK_SIZE_POWER=3,xe.BLOCK_SIZE=1<<xe.BLOCK_SIZE_POWER,xe.BLOCK_SIZE_MASK=xe.BLOCK_SIZE-1,xe.MINIMUM_DIMENSION=xe.BLOCK_SIZE*5,xe.MIN_DYNAMIC_RANGE=24;class te{constructor(r,i){this.width=r,this.height=i}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(r,i,s,a){throw new oe("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new oe("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new oe("This luminance source does not support rotation by 45 degrees.")}toString(){const r=new Uint8ClampedArray(this.width);let i=new pe;for(let s=0;s<this.height;s++){const a=this.getRow(s,r);for(let l=0;l<this.width;l++){const f=a[l]&255;let d;f<64?d="#":f<128?d="+":f<192?d=".":d=" ",i.append(d)}i.append(`
464
+ `)}return i.toString()}}class he extends te{constructor(r){super(r.getWidth(),r.getHeight()),this.delegate=r}getRow(r,i){const s=this.delegate.getRow(r,i),a=this.getWidth();for(let l=0;l<a;l++)s[l]=255-(s[l]&255);return s}getMatrix(){const r=this.delegate.getMatrix(),i=this.getWidth()*this.getHeight(),s=new Uint8ClampedArray(i);for(let a=0;a<i;a++)s[a]=255-(r[a]&255);return s}isCropSupported(){return this.delegate.isCropSupported()}crop(r,i,s,a){return new he(this.delegate.crop(r,i,s,a))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new he(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new he(this.delegate.rotateCounterClockwise45())}}class me extends te{constructor(r){super(r.width,r.height),this.canvas=r,this.tempCanvasElement=null,this.buffer=me.makeBufferFromCanvasImageData(r)}static makeBufferFromCanvasImageData(r){const i=r.getContext("2d").getImageData(0,0,r.width,r.height);return me.toGrayscaleBuffer(i.data,r.width,r.height)}static toGrayscaleBuffer(r,i,s){const a=new Uint8ClampedArray(i*s);for(let l=0,f=0,d=r.length;l<d;l+=4,f++){let g;if(r[l+3]===0)g=255;else{const v=r[l],E=r[l+1],S=r[l+2];g=306*v+601*E+117*S+512>>10}a[f]=g}return a}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth(),a=r*s;return i===null?i=this.buffer.slice(a,a+s):(i.length<s&&(i=new Uint8ClampedArray(s)),i.set(this.buffer.slice(a,a+s))),i}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(r,i,s,a){return super.crop(r,i,s,a),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const r=this.canvas.ownerDocument.createElement("canvas");r.width=this.canvas.width,r.height=this.canvas.height,this.tempCanvasElement=r}return this.tempCanvasElement}rotate(r){const i=this.getTempCanvasElement(),s=i.getContext("2d"),a=r*me.DEGREE_TO_RADIANS,l=this.canvas.width,f=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(a))*l+Math.abs(Math.sin(a))*f),g=Math.ceil(Math.abs(Math.sin(a))*l+Math.abs(Math.cos(a))*f);return i.width=d,i.height=g,s.translate(d/2,g/2),s.rotate(a),s.drawImage(this.canvas,l/-2,f/-2),this.buffer=me.makeBufferFromCanvasImageData(i),this}invert(){return new he(this)}}me.DEGREE_TO_RADIANS=Math.PI/180;class Ge{constructor(r,i,s){this.deviceId=r,this.label=i,this.kind="videoinput",this.groupId=s||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var Ie=(globalThis||pn||self||window||void 0)&&(globalThis||pn||self||window||void 0).__awaiter||function(y,r,i,s){function a(l){return l instanceof i?l:new i(function(f){f(l)})}return new(i||(i=Promise))(function(l,f){function d(v){try{p(s.next(v))}catch(E){f(E)}}function g(v){try{p(s.throw(v))}catch(E){f(E)}}function p(v){v.done?l(v.value):a(v.value).then(d,g)}p((s=s.apply(y,r||[])).next())})};class Er{constructor(r,i=500,s){this.reader=r,this.timeBetweenScansMillis=i,this._hints=s,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(r){this._timeBetweenDecodingAttempts=r<0?0:r}set hints(r){this._hints=r||null}get hints(){return this._hints}listVideoInputDevices(){return Ie(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const r=yield navigator.mediaDevices.enumerateDevices(),i=[];for(const s of r){const a=s.kind==="video"?"videoinput":s.kind;if(a!=="videoinput")continue;const l=s.deviceId||s.id,f=s.label||`Video device ${i.length+1}`,d=s.groupId,g={deviceId:l,label:f,kind:a,groupId:d};i.push(g)}return i})}getVideoInputDevices(){return Ie(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(i=>new Ge(i.deviceId,i.label))})}findDeviceById(r){return Ie(this,void 0,void 0,function*(){const i=yield this.listVideoInputDevices();return i?i.find(s=>s.deviceId===r):null})}decodeFromInputVideoDevice(r,i){return Ie(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(r,i)})}decodeOnceFromVideoDevice(r,i){return Ie(this,void 0,void 0,function*(){this.reset();let s;r?s={deviceId:{exact:r}}:s={facingMode:"environment"};const a={video:s};return yield this.decodeOnceFromConstraints(a,i)})}decodeOnceFromConstraints(r,i){return Ie(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(r);return yield this.decodeOnceFromStream(s,i)})}decodeOnceFromStream(r,i){return Ie(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(r,i);return yield this.decodeOnce(s)})}decodeFromInputVideoDeviceContinuously(r,i,s){return Ie(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(r,i,s)})}decodeFromVideoDevice(r,i,s){return Ie(this,void 0,void 0,function*(){let a;r?a={deviceId:{exact:r}}:a={facingMode:"environment"};const l={video:a};return yield this.decodeFromConstraints(l,i,s)})}decodeFromConstraints(r,i,s){return Ie(this,void 0,void 0,function*(){const a=yield navigator.mediaDevices.getUserMedia(r);return yield this.decodeFromStream(a,i,s)})}decodeFromStream(r,i,s){return Ie(this,void 0,void 0,function*(){this.reset();const a=yield this.attachStreamToVideo(r,i);return yield this.decodeContinuously(a,s)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(r,i){return Ie(this,void 0,void 0,function*(){const s=this.prepareVideoElement(i);return this.addVideoSource(s,r),this.videoElement=s,this.stream=r,yield this.playVideoOnLoadAsync(s),s})}playVideoOnLoadAsync(r){return new Promise((i,s)=>this.playVideoOnLoad(r,()=>i()))}playVideoOnLoad(r,i){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(r),r.addEventListener("ended",this.videoEndedListener),r.addEventListener("canplay",this.videoCanPlayListener),r.addEventListener("playing",i),this.tryPlayVideo(r)}isVideoPlaying(r){return r.currentTime>0&&!r.paused&&!r.ended&&r.readyState>2}tryPlayVideo(r){return Ie(this,void 0,void 0,function*(){if(this.isVideoPlaying(r)){console.warn("Trying to play video that is already playing.");return}try{yield r.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(r,i){const s=document.getElementById(r);if(!s)throw new C(`element with id '${r}' not found`);if(s.nodeName.toLowerCase()!==i.toLowerCase())throw new C(`element with id '${r}' must be an ${i} element`);return s}decodeFromImage(r,i){if(!r&&!i)throw new C("either imageElement with a src set or an url must be provided");return i&&!r?this.decodeFromImageUrl(i):this.decodeFromImageElement(r)}decodeFromVideo(r,i){if(!r&&!i)throw new C("Either an element with a src set or an URL must be provided");return i&&!r?this.decodeFromVideoUrl(i):this.decodeFromVideoElement(r)}decodeFromVideoContinuously(r,i,s){if(r===void 0&&i===void 0)throw new C("Either an element with a src set or an URL must be provided");return i&&!r?this.decodeFromVideoUrlContinuously(i,s):this.decodeFromVideoElementContinuously(r,s)}decodeFromImageElement(r){if(!r)throw new C("An image element must be provided.");this.reset();const i=this.prepareImageElement(r);this.imageElement=i;let s;return this.isImageLoaded(i)?s=this.decodeOnce(i,!1,!0):s=this._decodeOnLoadImage(i),s}decodeFromVideoElement(r){const i=this._decodeFromVideoElementSetup(r);return this._decodeOnLoadVideo(i)}decodeFromVideoElementContinuously(r,i){const s=this._decodeFromVideoElementSetup(r);return this._decodeOnLoadVideoContinuously(s,i)}_decodeFromVideoElementSetup(r){if(!r)throw new C("A video element must be provided.");this.reset();const i=this.prepareVideoElement(r);return this.videoElement=i,i}decodeFromImageUrl(r){if(!r)throw new C("An URL must be provided.");this.reset();const i=this.prepareImageElement();this.imageElement=i;const s=this._decodeOnLoadImage(i);return i.src=r,s}decodeFromVideoUrl(r){if(!r)throw new C("An URL must be provided.");this.reset();const i=this.prepareVideoElement(),s=this.decodeFromVideoElement(i);return i.src=r,s}decodeFromVideoUrlContinuously(r,i){if(!r)throw new C("An URL must be provided.");this.reset();const s=this.prepareVideoElement(),a=this.decodeFromVideoElementContinuously(s,i);return s.src=r,a}_decodeOnLoadImage(r){return new Promise((i,s)=>{this.imageLoadedListener=()=>this.decodeOnce(r,!1,!0).then(i,s),r.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(r){return Ie(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(r),yield this.decodeOnce(r)})}_decodeOnLoadVideoContinuously(r,i){return Ie(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(r),this.decodeContinuously(r,i)})}isImageLoaded(r){return!(!r.complete||r.naturalWidth===0)}prepareImageElement(r){let i;return typeof r>"u"&&(i=document.createElement("img"),i.width=200,i.height=200),typeof r=="string"&&(i=this.getMediaElement(r,"img")),r instanceof HTMLImageElement&&(i=r),i}prepareVideoElement(r){let i;return!r&&typeof document<"u"&&(i=document.createElement("video"),i.width=200,i.height=200),typeof r=="string"&&(i=this.getMediaElement(r,"video")),r instanceof HTMLVideoElement&&(i=r),i.setAttribute("autoplay","true"),i.setAttribute("muted","true"),i.setAttribute("playsinline","true"),i}decodeOnce(r,i=!0,s=!0){this._stopAsyncDecode=!1;const a=(l,f)=>{if(this._stopAsyncDecode){f(new G("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(r);l(d)}catch(d){const g=i&&d instanceof G,v=(d instanceof T||d instanceof F)&&s;if(g||v)return setTimeout(a,this._timeBetweenDecodingAttempts,l,f);f(d)}};return new Promise((l,f)=>a(l,f))}decodeContinuously(r,i){this._stopContinuousDecode=!1;const s=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const a=this.decode(r);i(a,null),setTimeout(s,this.timeBetweenScansMillis)}catch(a){i(null,a);const l=a instanceof T||a instanceof F,f=a instanceof G;(l||f)&&setTimeout(s,this._timeBetweenDecodingAttempts)}};s()}decode(r){const i=this.createBinaryBitmap(r);return this.decodeBitmap(i)}_isHTMLVideoElement(r){return r.videoWidth!==0}drawFrameOnCanvas(r,i,s){i||(i={sx:0,sy:0,sWidth:r.videoWidth,sHeight:r.videoHeight,dx:0,dy:0,dWidth:r.videoWidth,dHeight:r.videoHeight}),s||(s=this.captureCanvasContext),s.drawImage(r,i.sx,i.sy,i.sWidth,i.sHeight,i.dx,i.dy,i.dWidth,i.dHeight)}drawImageOnCanvas(r,i,s=this.captureCanvasContext){i||(i={sx:0,sy:0,sWidth:r.naturalWidth,sHeight:r.naturalHeight,dx:0,dy:0,dWidth:r.naturalWidth,dHeight:r.naturalHeight}),s||(s=this.captureCanvasContext),s.drawImage(r,i.sx,i.sy,i.sWidth,i.sHeight,i.dx,i.dy,i.dWidth,i.dHeight)}createBinaryBitmap(r){this.getCaptureCanvasContext(r),this._isHTMLVideoElement(r)?this.drawFrameOnCanvas(r):this.drawImageOnCanvas(r);const i=this.getCaptureCanvas(r),s=new me(i),a=new xe(s);return new A(a)}getCaptureCanvasContext(r){if(!this.captureCanvasContext){const s=this.getCaptureCanvas(r).getContext("2d");this.captureCanvasContext=s}return this.captureCanvasContext}getCaptureCanvas(r){if(!this.captureCanvas){const i=this.createCaptureCanvas(r);this.captureCanvas=i}return this.captureCanvas}decodeBitmap(r){return this.reader.decode(r,this._hints)}createCaptureCanvas(r){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const i=document.createElement("canvas");let s,a;return typeof r<"u"&&(r instanceof HTMLVideoElement?(s=r.videoWidth,a=r.videoHeight):r instanceof HTMLImageElement&&(s=r.naturalWidth||r.width,a=r.naturalHeight||r.height)),i.style.width=s+"px",i.style.height=a+"px",i.width=s,i.height=a,i}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(r=>r.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(r,i){try{r.srcObject=i}catch{r.src=URL.createObjectURL(i)}}cleanVideoSource(r){try{r.srcObject=null}catch{r.src=""}this.videoElement.removeAttribute("src")}}class Ze{constructor(r,i,s=i==null?0:8*i.length,a,l,f=M.currentTimeMillis()){this.text=r,this.rawBytes=i,this.numBits=s,this.resultPoints=a,this.format=l,this.timestamp=f,this.text=r,this.rawBytes=i,s==null?this.numBits=i==null?0:8*i.length:this.numBits=s,this.resultPoints=a,this.format=l,this.resultMetadata=null,f==null?this.timestamp=M.currentTimeMillis():this.timestamp=f}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(r,i){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(r,i)}putAllMetadata(r){r!==null&&(this.resultMetadata===null?this.resultMetadata=r:this.resultMetadata=new Map(r))}addResultPoints(r){const i=this.resultPoints;if(i===null)this.resultPoints=r;else if(r!==null&&r.length>0){const s=new Array(i.length+r.length);M.arraycopy(i,0,s,0,i.length),M.arraycopy(r,0,s,i.length,r.length),this.resultPoints=s}}getTimestamp(){return this.timestamp}toString(){return this.text}}var oi;(function(y){y[y.AZTEC=0]="AZTEC",y[y.CODABAR=1]="CODABAR",y[y.CODE_39=2]="CODE_39",y[y.CODE_93=3]="CODE_93",y[y.CODE_128=4]="CODE_128",y[y.DATA_MATRIX=5]="DATA_MATRIX",y[y.EAN_8=6]="EAN_8",y[y.EAN_13=7]="EAN_13",y[y.ITF=8]="ITF",y[y.MAXICODE=9]="MAXICODE",y[y.PDF_417=10]="PDF_417",y[y.QR_CODE=11]="QR_CODE",y[y.RSS_14=12]="RSS_14",y[y.RSS_EXPANDED=13]="RSS_EXPANDED",y[y.UPC_A=14]="UPC_A",y[y.UPC_E=15]="UPC_E",y[y.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(oi||(oi={}));var le=oi,Rn;(function(y){y[y.OTHER=0]="OTHER",y[y.ORIENTATION=1]="ORIENTATION",y[y.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",y[y.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",y[y.ISSUE_NUMBER=4]="ISSUE_NUMBER",y[y.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",y[y.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",y[y.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",y[y.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",y[y.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",y[y.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Rn||(Rn={}));var bt=Rn;class Bs{constructor(r,i,s,a,l=-1,f=-1){this.rawBytes=r,this.text=i,this.byteSegments=s,this.ecLevel=a,this.structuredAppendSequenceNumber=l,this.structuredAppendParity=f,this.numBits=r==null?0:8*r.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(r){this.numBits=r}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(r){this.errorsCorrected=r}getErasures(){return this.erasures}setErasures(r){this.erasures=r}getOther(){return this.other}setOther(r){this.other=r}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Fs{exp(r){return this.expTable[r]}log(r){if(r===0)throw new b;return this.logTable[r]}static addOrSubtract(r,i){return r^i}}class Qt{constructor(r,i){if(i.length===0)throw new b;this.field=r;const s=i.length;if(s>1&&i[0]===0){let a=1;for(;a<s&&i[a]===0;)a++;a===s?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(s-a),M.arraycopy(i,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=i}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(r){return this.coefficients[this.coefficients.length-1-r]}evaluateAt(r){if(r===0)return this.getCoefficient(0);const i=this.coefficients;let s;if(r===1){s=0;for(let f=0,d=i.length;f!==d;f++){const g=i[f];s=Fs.addOrSubtract(s,g)}return s}s=i[0];const a=i.length,l=this.field;for(let f=1;f<a;f++)s=Fs.addOrSubtract(l.multiply(r,s),i[f]);return s}addOrSubtract(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(this.isZero())return r;if(r.isZero())return this;let i=this.coefficients,s=r.coefficients;if(i.length>s.length){const f=i;i=s,s=f}let a=new Int32Array(s.length);const l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let f=l;f<s.length;f++)a[f]=Fs.addOrSubtract(i[f-l],s[f]);return new Qt(this.field,a)}multiply(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(this.isZero()||r.isZero())return this.field.getZero();const i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,f=new Int32Array(s+l-1),d=this.field;for(let g=0;g<s;g++){const p=i[g];for(let v=0;v<l;v++)f[g+v]=Fs.addOrSubtract(f[g+v],d.multiply(p,a[v]))}return new Qt(d,f)}multiplyScalar(r){if(r===0)return this.field.getZero();if(r===1)return this;const i=this.coefficients.length,s=this.field,a=new Int32Array(i),l=this.coefficients;for(let f=0;f<i;f++)a[f]=s.multiply(l[f],r);return new Qt(s,a)}multiplyByMonomial(r,i){if(r<0)throw new b;if(i===0)return this.field.getZero();const s=this.coefficients,a=s.length,l=new Int32Array(a+r),f=this.field;for(let d=0;d<a;d++)l[d]=f.multiply(s[d],i);return new Qt(f,l)}divide(r){if(!this.field.equals(r.field))throw new b("GenericGFPolys do not have same GenericGF field");if(r.isZero())throw new b("Divide by 0");const i=this.field;let s=i.getZero(),a=this;const l=r.getCoefficient(r.getDegree()),f=i.inverse(l);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){const d=a.getDegree()-r.getDegree(),g=i.multiply(a.getCoefficient(a.getDegree()),f),p=r.multiplyByMonomial(d,g),v=i.buildMonomial(d,g);s=s.addOrSubtract(v),a=a.addOrSubtract(p)}return[s,a]}toString(){let r="";for(let i=this.getDegree();i>=0;i--){let s=this.getCoefficient(i);if(s!==0){if(s<0?(r+=" - ",s=-s):r.length>0&&(r+=" + "),i===0||s!==1){const a=this.field.log(s);a===0?r+="1":a===1?r+="a":(r+="a^",r+=a)}i!==0&&(i===1?r+="x":(r+="x^",r+=i))}}return r}}class ma extends m{}ma.kind="ArithmeticException";class Ne extends Fs{constructor(r,i,s){super(),this.primitive=r,this.size=i,this.generatorBase=s;const a=new Int32Array(i);let l=1;for(let d=0;d<i;d++)a[d]=l,l*=2,l>=i&&(l^=r,l&=i-1);this.expTable=a;const f=new Int32Array(i);for(let d=0;d<i-1;d++)f[a[d]]=d;this.logTable=f,this.zero=new Qt(this,Int32Array.from([0])),this.one=new Qt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new b;if(i===0)return this.zero;const s=new Int32Array(r+1);return s[0]=i,new Qt(this,s)}inverse(r){if(r===0)throw new ma;return this.expTable[this.size-this.logTable[r]-1]}multiply(r,i){return r===0||i===0?0:this.expTable[(this.logTable[r]+this.logTable[i])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+O.toHexString(this.primitive)+","+this.size+")"}equals(r){return r===this}}Ne.AZTEC_DATA_12=new Ne(4201,4096,1),Ne.AZTEC_DATA_10=new Ne(1033,1024,1),Ne.AZTEC_DATA_6=new Ne(67,64,1),Ne.AZTEC_PARAM=new Ne(19,16,1),Ne.QR_CODE_FIELD_256=new Ne(285,256,0),Ne.DATA_MATRIX_FIELD_256=new Ne(301,256,1),Ne.AZTEC_DATA_8=Ne.DATA_MATRIX_FIELD_256,Ne.MAXICODE_FIELD_64=Ne.AZTEC_DATA_6;class Li extends m{}Li.kind="ReedSolomonException";class Xr extends m{}Xr.kind="IllegalStateException";class Us{constructor(r){this.field=r}decode(r,i){const s=this.field,a=new Qt(s,r),l=new Int32Array(i);let f=!0;for(let _=0;_<i;_++){const D=a.evaluateAt(s.exp(_+s.getGeneratorBase()));l[l.length-1-_]=D,D!==0&&(f=!1)}if(f)return;const d=new Qt(s,l),g=this.runEuclideanAlgorithm(s.buildMonomial(i,1),d,i),p=g[0],v=g[1],E=this.findErrorLocations(p),S=this.findErrorMagnitudes(v,E);for(let _=0;_<E.length;_++){const D=r.length-1-s.log(E[_]);if(D<0)throw new Li("Bad error location");r[D]=Ne.addOrSubtract(r[D],S[_])}}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){const _=r;r=i,i=_}const a=this.field;let l=r,f=i,d=a.getZero(),g=a.getOne();for(;f.getDegree()>=(s/2|0);){let _=l,D=d;if(l=f,d=g,l.isZero())throw new Li("r_{i-1} was zero");f=_;let P=a.getZero();const W=l.getCoefficient(l.getDegree()),H=a.inverse(W);for(;f.getDegree()>=l.getDegree()&&!f.isZero();){const q=f.getDegree()-l.getDegree(),J=a.multiply(f.getCoefficient(f.getDegree()),H);P=P.addOrSubtract(a.buildMonomial(q,J)),f=f.addOrSubtract(l.multiplyByMonomial(q,J))}if(g=P.multiply(d).addOrSubtract(D),f.getDegree()>=l.getDegree())throw new Xr("Division algorithm failed to reduce polynomial?")}const p=g.getCoefficient(0);if(p===0)throw new Li("sigmaTilde(0) was zero");const v=a.inverse(p),E=g.multiplyScalar(v),S=f.multiplyScalar(v);return[E,S]}findErrorLocations(r){const i=r.getDegree();if(i===1)return Int32Array.from([r.getCoefficient(1)]);const s=new Int32Array(i);let a=0;const l=this.field;for(let f=1;f<l.getSize()&&a<i;f++)r.evaluateAt(f)===0&&(s[a]=l.inverse(f),a++);if(a!==i)throw new Li("Error locator degree does not match number of roots");return s}findErrorMagnitudes(r,i){const s=i.length,a=new Int32Array(s),l=this.field;for(let f=0;f<s;f++){const d=l.inverse(i[f]);let g=1;for(let p=0;p<s;p++)if(f!==p){const v=l.multiply(i[p],d),E=v&1?v&-2:v|1;g=l.multiply(g,E)}a[f]=l.multiply(r.evaluateAt(d),l.inverse(g)),l.getGeneratorBase()!==0&&(a[f]=l.multiply(a[f],d))}return a}}var _t;(function(y){y[y.UPPER=0]="UPPER",y[y.LOWER=1]="LOWER",y[y.MIXED=2]="MIXED",y[y.DIGIT=3]="DIGIT",y[y.PUNCT=4]="PUNCT",y[y.BINARY=5]="BINARY"})(_t||(_t={}));class je{decode(r){this.ddata=r;let i=r.getBits(),s=this.extractBits(i),a=this.correctBits(s),l=je.convertBoolArrayToByteArray(a),f=je.getEncodedData(a),d=new Bs(l,f,null,null);return d.setNumBits(a.length),d}static highLevelDecode(r){return this.getEncodedData(r)}static getEncodedData(r){let i=r.length,s=_t.UPPER,a=_t.UPPER,l="",f=0;for(;f<i;)if(a===_t.BINARY){if(i-f<5)break;let d=je.readCode(r,f,5);if(f+=5,d===0){if(i-f<11)break;d=je.readCode(r,f,11)+31,f+=11}for(let g=0;g<d;g++){if(i-f<8){f=i;break}const p=je.readCode(r,f,8);l+=ie.castAsNonUtf8Char(p),f+=8}a=s}else{let d=a===_t.DIGIT?4:5;if(i-f<d)break;let g=je.readCode(r,f,d);f+=d;let p=je.getCharacter(a,g);p.startsWith("CTRL_")?(s=a,a=je.getTable(p.charAt(5)),p.charAt(6)==="L"&&(s=a)):(l+=p,a=s)}return l}static getTable(r){switch(r){case"L":return _t.LOWER;case"P":return _t.PUNCT;case"M":return _t.MIXED;case"D":return _t.DIGIT;case"B":return _t.BINARY;case"U":default:return _t.UPPER}}static getCharacter(r,i){switch(r){case _t.UPPER:return je.UPPER_TABLE[i];case _t.LOWER:return je.LOWER_TABLE[i];case _t.MIXED:return je.MIXED_TABLE[i];case _t.PUNCT:return je.PUNCT_TABLE[i];case _t.DIGIT:return je.DIGIT_TABLE[i];default:throw new Xr("Bad table")}}correctBits(r){let i,s;this.ddata.getNbLayers()<=2?(s=6,i=Ne.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,i=Ne.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,i=Ne.AZTEC_DATA_10):(s=12,i=Ne.AZTEC_DATA_12);let a=this.ddata.getNbDatablocks(),l=r.length/s;if(l<a)throw new F;let f=r.length%s,d=new Int32Array(l);for(let S=0;S<l;S++,f+=s)d[S]=je.readCode(r,f,s);try{new Us(i).decode(d,l-a)}catch(S){throw new F(S)}let g=(1<<s)-1,p=0;for(let S=0;S<a;S++){let _=d[S];if(_===0||_===g)throw new F;(_===1||_===g-1)&&p++}let v=new Array(a*s-p),E=0;for(let S=0;S<a;S++){let _=d[S];if(_===1||_===g-1)v.fill(_>1,E,E+s-1),E+=s-1;else for(let D=s-1;D>=0;--D)v[E++]=(_&1<<D)!==0}return v}extractBits(r){let i=this.ddata.isCompact(),s=this.ddata.getNbLayers(),a=(i?11:14)+s*4,l=new Int32Array(a),f=new Array(this.totalBitsInLayer(s,i));if(i)for(let d=0;d<l.length;d++)l[d]=d;else{let d=a+1+2*O.truncDivision(O.truncDivision(a,2)-1,15),g=a/2,p=O.truncDivision(d,2);for(let v=0;v<g;v++){let E=v+O.truncDivision(v,15);l[g-v-1]=p-E-1,l[g+v]=p+E+1}}for(let d=0,g=0;d<s;d++){let p=(s-d)*4+(i?9:12),v=d*2,E=a-1-v;for(let S=0;S<p;S++){let _=S*2;for(let D=0;D<2;D++)f[g+_+D]=r.get(l[v+D],l[v+S]),f[g+2*p+_+D]=r.get(l[v+S],l[E-D]),f[g+4*p+_+D]=r.get(l[E-D],l[E-S]),f[g+6*p+_+D]=r.get(l[E-S],l[v+D])}g+=p*8}return f}static readCode(r,i,s){let a=0;for(let l=i;l<i+s;l++)a<<=1,r[l]&&(a|=1);return a}static readByte(r,i){let s=r.length-i;return s>=8?je.readCode(r,i,8):je.readCode(r,i,s)<<8-s}static convertBoolArrayToByteArray(r){let i=new Uint8Array((r.length+7)/8);for(let s=0;s<i.length;s++)i[s]=je.readByte(r,8*s);return i}totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}je.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],je.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],je.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
465
465
  `,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],je.PUNCT_TABLE=["","\r",`\r
466
- `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],je.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Re{constructor(){}static round(r){return r===NaN?0:r<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:r>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r+(r<0?-.5:.5)|0}static distance(r,i,s,a){const l=r-s,f=i-a;return Math.sqrt(l*l+f*f)}static sum(r){let i=0;for(let s=0,a=r.length;s!==a;s++){const l=r[s];i+=l}return i}}class ma{static floatToIntBits(r){return r}}ma.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ae{constructor(r,i){this.x=r,this.y=i}getX(){return this.x}getY(){return this.y}equals(r){if(r instanceof ae){const i=r;return this.x===i.x&&this.y===i.y}return!1}hashCode(){return 31*ma.floatToIntBits(this.x)+ma.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(r){const i=this.distance(r[0],r[1]),s=this.distance(r[1],r[2]),a=this.distance(r[0],r[2]);let l,f,d;if(s>=i&&s>=a?(f=r[0],l=r[1],d=r[2]):a>=s&&a>=i?(f=r[1],l=r[0],d=r[2]):(f=r[2],l=r[0],d=r[1]),this.crossProductZ(l,f,d)<0){const h=l;l=d,d=h}r[0]=l,r[1]=f,r[2]=d}static distance(r,i){return Re.distance(r.x,r.y,i.x,i.y)}static crossProductZ(r,i,s){const a=i.x,l=i.y;return(s.x-a)*(r.y-l)-(s.y-l)*(r.x-a)}}class xa{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class H0 extends xa{constructor(r,i,s,a,l){super(r,i),this.compact=s,this.nbDatablocks=a,this.nbLayers=l}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class un{constructor(r,i,s,a){this.image=r,this.height=r.getHeight(),this.width=r.getWidth(),i==null&&(i=un.INIT_SIZE),s==null&&(s=r.getWidth()/2|0),a==null&&(a=r.getHeight()/2|0);const l=i/2|0;if(this.leftInit=s-l,this.rightInit=s+l,this.upInit=a-l,this.downInit=a+l,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new X}detect(){let r=this.leftInit,i=this.rightInit,s=this.upInit,a=this.downInit,l=!1,f=!0,d=!1,h=!1,p=!1,v=!1,E=!1;const S=this.width,_=this.height;for(;f;){f=!1;let D=!0;for(;(D||!h)&&i<S;)D=this.containsBlackPoint(s,a,i,!1),D?(i++,f=!0,h=!0):h||i++;if(i>=S){l=!0;break}let P=!0;for(;(P||!p)&&a<_;)P=this.containsBlackPoint(r,i,a,!0),P?(a++,f=!0,p=!0):p||a++;if(a>=_){l=!0;break}let W=!0;for(;(W||!v)&&r>=0;)W=this.containsBlackPoint(s,a,r,!1),W?(r--,f=!0,v=!0):v||r--;if(r<0){l=!0;break}let H=!0;for(;(H||!E)&&s>=0;)H=this.containsBlackPoint(r,i,s,!0),H?(s--,f=!0,E=!0):E||s--;if(s<0){l=!0;break}f&&(d=!0)}if(!l&&d){const D=i-r;let P=null;for(let J=1;P===null&&J<D;J++)P=this.getBlackPointOnSegment(r,a-J,r+J,a);if(P==null)throw new X;let W=null;for(let J=1;W===null&&J<D;J++)W=this.getBlackPointOnSegment(r,s+J,r+J,s);if(W==null)throw new X;let H=null;for(let J=1;H===null&&J<D;J++)H=this.getBlackPointOnSegment(i,s+J,i-J,s);if(H==null)throw new X;let q=null;for(let J=1;q===null&&J<D;J++)q=this.getBlackPointOnSegment(i,a-J,i-J,a);if(q==null)throw new X;return this.centerEdges(q,P,H,W)}else throw new X}getBlackPointOnSegment(r,i,s,a){const l=Re.round(Re.distance(r,i,s,a)),f=(s-r)/l,d=(a-i)/l,h=this.image;for(let p=0;p<l;p++){const v=Re.round(r+p*f),E=Re.round(i+p*d);if(h.get(v,E))return new ae(v,E)}return null}centerEdges(r,i,s,a){const l=r.getX(),f=r.getY(),d=i.getX(),h=i.getY(),p=s.getX(),v=s.getY(),E=a.getX(),S=a.getY(),_=un.CORR;return l<this.width/2?[new ae(E-_,S+_),new ae(d+_,h+_),new ae(p-_,v-_),new ae(l+_,f-_)]:[new ae(E+_,S+_),new ae(d+_,h-_),new ae(p-_,v+_),new ae(l-_,f-_)]}containsBlackPoint(r,i,s,a){const l=this.image;if(a){for(let f=r;f<=i;f++)if(l.get(f,s))return!0}else for(let f=r;f<=i;f++)if(l.get(s,f))return!0;return!1}}un.INIT_SIZE=10,un.CORR=1;class eu{static checkAndNudgePoints(r,i){const s=r.getWidth(),a=r.getHeight();let l=!0;for(let f=0;f<i.length&&l;f+=2){const d=Math.floor(i[f]),h=Math.floor(i[f+1]);if(d<-1||d>s||h<-1||h>a)throw new X;l=!1,d===-1?(i[f]=0,l=!0):d===s&&(i[f]=s-1,l=!0),h===-1?(i[f+1]=0,l=!0):h===a&&(i[f+1]=a-1,l=!0)}l=!0;for(let f=i.length-2;f>=0&&l;f-=2){const d=Math.floor(i[f]),h=Math.floor(i[f+1]);if(d<-1||d>s||h<-1||h>a)throw new X;l=!1,d===-1?(i[f]=0,l=!0):d===s&&(i[f]=s-1,l=!0),h===-1?(i[f+1]=0,l=!0):h===a&&(i[f+1]=a-1,l=!0)}}}class kr{constructor(r,i,s,a,l,f,d,h,p){this.a11=r,this.a21=i,this.a31=s,this.a12=a,this.a22=l,this.a32=f,this.a13=d,this.a23=h,this.a33=p}static quadrilateralToQuadrilateral(r,i,s,a,l,f,d,h,p,v,E,S,_,D,P,W){const H=kr.quadrilateralToSquare(r,i,s,a,l,f,d,h);return kr.squareToQuadrilateral(p,v,E,S,_,D,P,W).times(H)}transformPoints(r){const i=r.length,s=this.a11,a=this.a12,l=this.a13,f=this.a21,d=this.a22,h=this.a23,p=this.a31,v=this.a32,E=this.a33;for(let S=0;S<i;S+=2){const _=r[S],D=r[S+1],P=l*_+h*D+E;r[S]=(s*_+f*D+p)/P,r[S+1]=(a*_+d*D+v)/P}}transformPointsWithValues(r,i){const s=this.a11,a=this.a12,l=this.a13,f=this.a21,d=this.a22,h=this.a23,p=this.a31,v=this.a32,E=this.a33,S=r.length;for(let _=0;_<S;_++){const D=r[_],P=i[_],W=l*D+h*P+E;r[_]=(s*D+f*P+p)/W,i[_]=(a*D+d*P+v)/W}}static squareToQuadrilateral(r,i,s,a,l,f,d,h){const p=r-s+l-d,v=i-a+f-h;if(p===0&&v===0)return new kr(s-r,l-s,r,a-i,f-a,i,0,0,1);{const E=s-l,S=d-l,_=a-f,D=h-f,P=E*D-S*_,W=(p*D-S*v)/P,H=(E*v-p*_)/P;return new kr(s-r+W*s,d-r+H*d,r,a-i+W*a,h-i+H*h,i,W,H,1)}}static quadrilateralToSquare(r,i,s,a,l,f,d,h){return kr.squareToQuadrilateral(r,i,s,a,l,f,d,h).buildAdjoint()}buildAdjoint(){return new kr(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(r){return new kr(this.a11*r.a11+this.a21*r.a12+this.a31*r.a13,this.a11*r.a21+this.a21*r.a22+this.a31*r.a23,this.a11*r.a31+this.a21*r.a32+this.a31*r.a33,this.a12*r.a11+this.a22*r.a12+this.a32*r.a13,this.a12*r.a21+this.a22*r.a22+this.a32*r.a23,this.a12*r.a31+this.a22*r.a32+this.a32*r.a33,this.a13*r.a11+this.a23*r.a12+this.a33*r.a13,this.a13*r.a21+this.a23*r.a22+this.a33*r.a23,this.a13*r.a31+this.a23*r.a32+this.a33*r.a33)}}class G0 extends eu{sampleGrid(r,i,s,a,l,f,d,h,p,v,E,S,_,D,P,W,H,q,J){const Z=kr.quadrilateralToQuadrilateral(a,l,f,d,h,p,v,E,S,_,D,P,W,H,q,J);return this.sampleGridWithTransform(r,i,s,Z)}sampleGridWithTransform(r,i,s,a){if(i<=0||s<=0)throw new X;const l=new Te(i,s),f=new Float32Array(2*i);for(let d=0;d<s;d++){const h=f.length,p=d+.5;for(let v=0;v<h;v+=2)f[v]=v/2+.5,f[v+1]=p;a.transformPoints(f),eu.checkAndNudgePoints(r,f);try{for(let v=0;v<h;v+=2)r.get(Math.floor(f[v]),Math.floor(f[v+1]))&&l.set(v/2,d)}catch{throw new X}}return l}}class _n{static setGridSampler(r){_n.gridSampler=r}static getInstance(){return _n.gridSampler}}_n.gridSampler=new G0;class Vt{constructor(r,i){this.x=r,this.y=i}toResultPoint(){return new ae(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class X0{constructor(r){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=r}detect(){return this.detectMirror(!1)}detectMirror(r){let i=this.getMatrixCenter(),s=this.getBullsEyeCorners(i);if(r){let f=s[0];s[0]=s[2],s[2]=f}this.extractParameters(s);let a=this.sampleGrid(this.image,s[this.shift%4],s[(this.shift+1)%4],s[(this.shift+2)%4],s[(this.shift+3)%4]),l=this.getMatrixCornerPoints(s);return new H0(a,l,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(r){if(!this.isValidPoint(r[0])||!this.isValidPoint(r[1])||!this.isValidPoint(r[2])||!this.isValidPoint(r[3]))throw new X;let i=2*this.nbCenterLayers,s=new Int32Array([this.sampleLine(r[0],r[1],i),this.sampleLine(r[1],r[2],i),this.sampleLine(r[2],r[3],i),this.sampleLine(r[3],r[0],i)]);this.shift=this.getRotation(s,i);let a=0;for(let f=0;f<4;f++){let d=s[(this.shift+f)%4];this.compact?(a<<=7,a+=d>>1&127):(a<<=10,a+=(d>>2&992)+(d>>1&31))}let l=this.getCorrectedParameterData(a,this.compact);this.compact?(this.nbLayers=(l>>6)+1,this.nbDataBlocks=(l&63)+1):(this.nbLayers=(l>>11)+1,this.nbDataBlocks=(l&2047)+1)}getRotation(r,i){let s=0;r.forEach((a,l,f)=>{let d=(a>>i-2<<1)+(a&1);s=(s<<3)+d}),s=((s&1)<<11)+(s>>1);for(let a=0;a<4;a++)if(O.bitCount(s^this.EXPECTED_CORNER_BITS[a])<=2)return a;throw new X}getCorrectedParameterData(r,i){let s,a;i?(s=7,a=2):(s=10,a=4);let l=s-a,f=new Int32Array(s);for(let h=s-1;h>=0;--h)f[h]=r&15,r>>=4;try{new Us(Ne.AZTEC_PARAM).decode(f,l)}catch{throw new X}let d=0;for(let h=0;h<a;h++)d=(d<<4)+f[h];return d}getBullsEyeCorners(r){let i=r,s=r,a=r,l=r,f=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(i,f,1,-1),S=this.getFirstDifferent(s,f,1,1),_=this.getFirstDifferent(a,f,-1,1),D=this.getFirstDifferent(l,f,-1,-1);if(this.nbCenterLayers>2){let P=this.distancePoint(D,E)*this.nbCenterLayers/(this.distancePoint(l,i)*(this.nbCenterLayers+2));if(P<.75||P>1.25||!this.isWhiteOrBlackRectangle(E,S,_,D))break}i=E,s=S,a=_,l=D,f=!f}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new X;this.compact=this.nbCenterLayers===5;let d=new ae(i.getX()+.5,i.getY()-.5),h=new ae(s.getX()+.5,s.getY()+.5),p=new ae(a.getX()-.5,a.getY()+.5),v=new ae(l.getX()-.5,l.getY()-.5);return this.expandSquare([d,h,p,v],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let r,i,s,a;try{let d=new un(this.image).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{let h=this.image.getWidth()/2,p=this.image.getHeight()/2;r=this.getFirstDifferent(new Vt(h+7,p-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(h+7,p+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(h-7,p+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(h-7,p-7),!1,-1,-1).toResultPoint()}let l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),f=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4);try{let d=new un(this.image,15,l,f).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{r=this.getFirstDifferent(new Vt(l+7,f-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(l+7,f+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(l-7,f+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(l-7,f-7),!1,-1,-1).toResultPoint()}return l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),f=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4),new Vt(l,f)}getMatrixCornerPoints(r){return this.expandSquare(r,2*this.nbCenterLayers,this.getDimension())}sampleGrid(r,i,s,a,l){let f=_n.getInstance(),d=this.getDimension(),h=d/2-this.nbCenterLayers,p=d/2+this.nbCenterLayers;return f.sampleGrid(r,d,d,h,h,p,h,p,p,h,p,i.getX(),i.getY(),s.getX(),s.getY(),a.getX(),a.getY(),l.getX(),l.getY())}sampleLine(r,i,s){let a=0,l=this.distanceResultPoint(r,i),f=l/s,d=r.getX(),h=r.getY(),p=f*(i.getX()-r.getX())/l,v=f*(i.getY()-r.getY())/l;for(let E=0;E<s;E++)this.image.get(Re.round(d+E*p),Re.round(h+E*v))&&(a|=1<<s-E-1);return a}isWhiteOrBlackRectangle(r,i,s,a){let l=3;r=new Vt(r.getX()-l,r.getY()+l),i=new Vt(i.getX()-l,i.getY()-l),s=new Vt(s.getX()+l,s.getY()-l),a=new Vt(a.getX()+l,a.getY()+l);let f=this.getColor(a,r);if(f===0)return!1;let d=this.getColor(r,i);return d!==f||(d=this.getColor(i,s),d!==f)?!1:(d=this.getColor(s,a),d===f)}getColor(r,i){let s=this.distancePoint(r,i),a=(i.getX()-r.getX())/s,l=(i.getY()-r.getY())/s,f=0,d=r.getX(),h=r.getY(),p=this.image.get(r.getX(),r.getY()),v=Math.ceil(s);for(let S=0;S<v;S++)d+=a,h+=l,this.image.get(Re.round(d),Re.round(h))!==p&&f++;let E=f/s;return E>.1&&E<.9?0:E<=.1===p?1:-1}getFirstDifferent(r,i,s,a){let l=r.getX()+s,f=r.getY()+a;for(;this.isValid(l,f)&&this.image.get(l,f)===i;)l+=s,f+=a;for(l-=s,f-=a;this.isValid(l,f)&&this.image.get(l,f)===i;)l+=s;for(l-=s;this.isValid(l,f)&&this.image.get(l,f)===i;)f+=a;return f-=a,new Vt(l,f)}expandSquare(r,i,s){let a=s/(2*i),l=r[0].getX()-r[2].getX(),f=r[0].getY()-r[2].getY(),d=(r[0].getX()+r[2].getX())/2,h=(r[0].getY()+r[2].getY())/2,p=new ae(d+a*l,h+a*f),v=new ae(d-a*l,h-a*f);l=r[1].getX()-r[3].getX(),f=r[1].getY()-r[3].getY(),d=(r[1].getX()+r[3].getX())/2,h=(r[1].getY()+r[3].getY())/2;let E=new ae(d+a*l,h+a*f),S=new ae(d-a*l,h-a*f);return[p,E,v,S]}isValid(r,i){return r>=0&&r<this.image.getWidth()&&i>0&&i<this.image.getHeight()}isValidPoint(r){let i=Re.round(r.getX()),s=Re.round(r.getY());return this.isValid(i,s)}distancePoint(r,i){return Re.distance(r.getX(),r.getY(),i.getX(),i.getY())}distanceResultPoint(r,i){return Re.distance(r.getX(),r.getY(),i.getX(),i.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(O.truncDivision(this.nbLayers-4,8)+1)+15}}class wa{decode(r,i=null){let s=null,a=new X0(r.getBlackMatrix()),l=null,f=null;try{let v=a.detectMirror(!1);l=v.getPoints(),this.reportFoundResultPoints(i,l),f=new je().decode(v)}catch(v){s=v}if(f==null)try{let v=a.detectMirror(!0);l=v.getPoints(),this.reportFoundResultPoints(i,l),f=new je().decode(v)}catch(v){throw s??v}let d=new Ze(f.getText(),f.getRawBytes(),f.getNumBits(),l,le.AZTEC,M.currentTimeMillis()),h=f.getByteSegments();h!=null&&d.putMetadata(bt.BYTE_SEGMENTS,h);let p=f.getECLevel();return p!=null&&d.putMetadata(bt.ERROR_CORRECTION_LEVEL,p),d}reportFoundResultPoints(r,i){if(r!=null){let s=r.get(U.NEED_RESULT_POINT_CALLBACK);s!=null&&i.forEach((a,l,f)=>{s.foundPossibleResultPoint(a)})}}reset(){}}class i3 extends Er{constructor(r=500){super(new wa,r)}}class ht{decode(r,i){try{return this.doDecode(r,i)}catch{if(i&&i.get(U.TRY_HARDER)===!0&&r.isRotateSupported()){const l=r.rotateCounterClockwise(),f=this.doDecode(l,i),d=f.getResultMetadata();let h=270;d!==null&&d.get(bt.ORIENTATION)===!0&&(h=h+d.get(bt.ORIENTATION)%360),f.putMetadata(bt.ORIENTATION,h);const p=f.getResultPoints();if(p!==null){const v=l.getHeight();for(let E=0;E<p.length;E++)p[E]=new ae(v-p[E].getY()-1,p[E].getX())}return f}else throw new X}}reset(){}doDecode(r,i){const s=r.getWidth(),a=r.getHeight();let l=new B(s);const f=i&&i.get(U.TRY_HARDER)===!0,d=Math.max(1,a>>(f?8:5));let h;f?h=a:h=15;const p=Math.trunc(a/2);for(let v=0;v<h;v++){const E=Math.trunc((v+1)/2),S=(v&1)===0,_=p+d*(S?E:-E);if(_<0||_>=a)break;try{l=r.getBlackRow(_,l)}catch{continue}for(let D=0;D<2;D++){if(D===1&&(l.reverse(),i&&i.get(U.NEED_RESULT_POINT_CALLBACK)===!0)){const P=new Map;i.forEach((W,H)=>P.set(H,W)),P.delete(U.NEED_RESULT_POINT_CALLBACK),i=P}try{const P=this.decodeRow(_,l,i);if(D===1){P.putMetadata(bt.ORIENTATION,180);const W=P.getResultPoints();W!==null&&(W[0]=new ae(s-W[0].getX()-1,W[0].getY()),W[1]=new ae(s-W[1].getX()-1,W[1].getY()))}return P}catch{}}}throw new X}static recordPattern(r,i,s){const a=s.length;for(let p=0;p<a;p++)s[p]=0;const l=r.getSize();if(i>=l)throw new X;let f=!r.get(i),d=0,h=i;for(;h<l;){if(r.get(h)!==f)s[d]++;else{if(++d===a)break;s[d]=1,f=!f}h++}if(!(d===a||d===a-1&&h===l))throw new X}static recordPatternInReverse(r,i,s){let a=s.length,l=r.get(i);for(;i>0&&a>=0;)r.get(--i)!==l&&(a--,l=!l);if(a>=0)throw new X;ht.recordPattern(r,i+1,s)}static patternMatchVariance(r,i,s){const a=r.length;let l=0,f=0;for(let p=0;p<a;p++)l+=r[p],f+=i[p];if(l<f)return Number.POSITIVE_INFINITY;const d=l/f;s*=d;let h=0;for(let p=0;p<a;p++){const v=r[p],E=i[p]*d,S=v>E?v-E:E-v;if(S>s)return Number.POSITIVE_INFINITY;h+=S}return h/l}}class ee extends ht{static findStartPattern(r){const i=r.getSize(),s=r.getNextSet(0);let a=0,l=Int32Array.from([0,0,0,0,0,0]),f=s,d=!1;const h=6;for(let p=s;p<i;p++)if(r.get(p)!==d)l[a]++;else{if(a===h-1){let v=ee.MAX_AVG_VARIANCE,E=-1;for(let S=ee.CODE_START_A;S<=ee.CODE_START_C;S++){const _=ht.patternMatchVariance(l,ee.CODE_PATTERNS[S],ee.MAX_INDIVIDUAL_VARIANCE);_<v&&(v=_,E=S)}if(E>=0&&r.isRange(Math.max(0,f-(p-f)/2),f,!1))return Int32Array.from([f,p,E]);f+=l[0]+l[1],l=l.slice(2,l.length-1),l[a-1]=0,l[a]=0,a--}else a++;l[a]=1,d=!d}throw new X}static decodeCode(r,i,s){ht.recordPattern(r,s,i);let a=ee.MAX_AVG_VARIANCE,l=-1;for(let f=0;f<ee.CODE_PATTERNS.length;f++){const d=ee.CODE_PATTERNS[f],h=this.patternMatchVariance(i,d,ee.MAX_INDIVIDUAL_VARIANCE);h<a&&(a=h,l=f)}if(l>=0)return l;throw new X}decodeRow(r,i,s){const a=s&&s.get(U.ASSUME_GS1)===!0,l=ee.findStartPattern(i),f=l[2];let d=0;const h=new Uint8Array(20);h[d++]=f;let p;switch(f){case ee.CODE_START_A:p=ee.CODE_CODE_A;break;case ee.CODE_START_B:p=ee.CODE_CODE_B;break;case ee.CODE_START_C:p=ee.CODE_CODE_C;break;default:throw new F}let v=!1,E=!1,S="",_=l[0],D=l[1];const P=Int32Array.from([0,0,0,0,0,0]);let W=0,H=0,q=f,J=0,Z=!0,Ae=!1,we=!1;for(;!v;){const Hi=E;switch(E=!1,W=H,H=ee.decodeCode(i,P,D),h[d++]=H,H!==ee.CODE_STOP&&(Z=!0),H!==ee.CODE_STOP&&(J++,q+=J*H),_=D,D+=P.reduce((M3,D3)=>M3+D3,0),H){case ee.CODE_START_A:case ee.CODE_START_B:case ee.CODE_START_C:throw new F}switch(p){case ee.CODE_CODE_A:if(H<64)we===Ae?S+=String.fromCharCode(32+H):S+=String.fromCharCode(32+H+128),we=!1;else if(H<96)we===Ae?S+=String.fromCharCode(H-64):S+=String.fromCharCode(H+64),we=!1;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_A:!Ae&&we?(Ae=!0,we=!1):Ae&&we?(Ae=!1,we=!1):we=!0;break;case ee.CODE_SHIFT:E=!0,p=ee.CODE_CODE_B;break;case ee.CODE_CODE_B:p=ee.CODE_CODE_B;break;case ee.CODE_CODE_C:p=ee.CODE_CODE_C;break;case ee.CODE_STOP:v=!0;break}break;case ee.CODE_CODE_B:if(H<96)we===Ae?S+=String.fromCharCode(32+H):S+=String.fromCharCode(32+H+128),we=!1;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_B:!Ae&&we?(Ae=!0,we=!1):Ae&&we?(Ae=!1,we=!1):we=!0;break;case ee.CODE_SHIFT:E=!0,p=ee.CODE_CODE_A;break;case ee.CODE_CODE_A:p=ee.CODE_CODE_A;break;case ee.CODE_CODE_C:p=ee.CODE_CODE_C;break;case ee.CODE_STOP:v=!0;break}break;case ee.CODE_CODE_C:if(H<100)H<10&&(S+="0"),S+=H;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_CODE_A:p=ee.CODE_CODE_A;break;case ee.CODE_CODE_B:p=ee.CODE_CODE_B;break;case ee.CODE_STOP:v=!0;break}break}Hi&&(p=p===ee.CODE_CODE_A?ee.CODE_CODE_B:ee.CODE_CODE_A)}const tr=D-_;if(D=i.getNextUnset(D),!i.isRange(D,Math.min(i.getSize(),D+(D-_)/2),!1))throw new X;if(q-=J*W,q%103!==W)throw new T;const Dr=S.length;if(Dr===0)throw new X;Dr>0&&Z&&(p===ee.CODE_CODE_C?S=S.substring(0,Dr-2):S=S.substring(0,Dr-1));const rr=(l[1]+l[0])/2,Ue=_+tr/2,kt=h.length,fr=new Uint8Array(kt);for(let Hi=0;Hi<kt;Hi++)fr[Hi]=h[Hi];const Vi=[new ae(rr,r),new ae(Ue,r)];return new Ze(S,fr,0,Vi,le.CODE_128,new Date().getTime())}}ee.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],ee.MAX_AVG_VARIANCE=.25,ee.MAX_INDIVIDUAL_VARIANCE=.7,ee.CODE_SHIFT=98,ee.CODE_CODE_C=99,ee.CODE_CODE_B=100,ee.CODE_CODE_A=101,ee.CODE_FNC_1=102,ee.CODE_FNC_2=97,ee.CODE_FNC_3=96,ee.CODE_FNC_4_A=101,ee.CODE_FNC_4_B=100,ee.CODE_START_A=103,ee.CODE_START_B=104,ee.CODE_START_C=105,ee.CODE_STOP=106;class mt extends ht{constructor(r=!1,i=!1){super(),this.usingCheckDigit=r,this.extendedMode=i,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(r,i,s){let a=this.counters;a.fill(0),this.decodeRowResult="";let l=mt.findAsteriskPattern(i,a),f=i.getNextSet(l[1]),d=i.getSize(),h,p;do{mt.recordPattern(i,f,a);let P=mt.toNarrowWidePattern(a);if(P<0)throw new X;h=mt.patternToChar(P),this.decodeRowResult+=h,p=f;for(let W of a)f+=W;f=i.getNextSet(f)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let v=0;for(let P of a)v+=P;let E=f-p-v;if(f!==d&&E*2<v)throw new X;if(this.usingCheckDigit){let P=this.decodeRowResult.length-1,W=0;for(let H=0;H<P;H++)W+=mt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(H));if(this.decodeRowResult.charAt(P)!==mt.ALPHABET_STRING.charAt(W%43))throw new T;this.decodeRowResult=this.decodeRowResult.substring(0,P)}if(this.decodeRowResult.length===0)throw new X;let S;this.extendedMode?S=mt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let _=(l[1]+l[0])/2,D=p+v/2;return new Ze(S,null,0,[new ae(_,r),new ae(D,r)],le.CODE_39,new Date().getTime())}static findAsteriskPattern(r,i){let s=r.getSize(),a=r.getNextSet(0),l=0,f=a,d=!1,h=i.length;for(let p=a;p<s;p++)if(r.get(p)!==d)i[l]++;else{if(l===h-1){if(this.toNarrowWidePattern(i)===mt.ASTERISK_ENCODING&&r.isRange(Math.max(0,f-Math.floor((p-f)/2)),f,!1))return[f,p];f+=i[0]+i[1],i.copyWithin(0,2,2+l-1),i[l-1]=0,i[l]=0,l--}else l++;i[l]=1,d=!d}throw new X}static toNarrowWidePattern(r){let i=r.length,s=0,a;do{let l=2147483647;for(let h of r)h<l&&h>s&&(l=h);s=l,a=0;let f=0,d=0;for(let h=0;h<i;h++){let p=r[h];p>s&&(d|=1<<i-1-h,a++,f+=p)}if(a===3){for(let h=0;h<i&&a>0;h++){let p=r[h];if(p>s&&(a--,p*2>=f))return-1}return d}}while(a>3);return-1}static patternToChar(r){for(let i=0;i<mt.CHARACTER_ENCODINGS.length;i++)if(mt.CHARACTER_ENCODINGS[i]===r)return mt.ALPHABET_STRING.charAt(i);if(r===mt.ASTERISK_ENCODING)return"*";throw new X}static decodeExtended(r){let i=r.length,s="";for(let a=0;a<i;a++){let l=r.charAt(a);if(l==="+"||l==="$"||l==="%"||l==="/"){let f=r.charAt(a+1),d="\0";switch(l){case"+":if(f>="A"&&f<="Z")d=String.fromCharCode(f.charCodeAt(0)+32);else throw new F;break;case"$":if(f>="A"&&f<="Z")d=String.fromCharCode(f.charCodeAt(0)-64);else throw new F;break;case"%":if(f>="A"&&f<="E")d=String.fromCharCode(f.charCodeAt(0)-38);else if(f>="F"&&f<="J")d=String.fromCharCode(f.charCodeAt(0)-11);else if(f>="K"&&f<="O")d=String.fromCharCode(f.charCodeAt(0)+16);else if(f>="P"&&f<="T")d=String.fromCharCode(f.charCodeAt(0)+43);else if(f==="U")d="\0";else if(f==="V")d="@";else if(f==="W")d="`";else if(f==="X"||f==="Y"||f==="Z")d="";else throw new F;break;case"/":if(f>="A"&&f<="O")d=String.fromCharCode(f.charCodeAt(0)-32);else if(f==="Z")d=":";else throw new F;break}s+=d,a++}else s+=l}return s}}mt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",mt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],mt.ASTERISK_ENCODING=148;class Be extends ht{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(r,i,s){let a=this.decodeStart(i),l=this.decodeEnd(i),f=new pe;Be.decodeMiddle(i,a[1],l[0],f);let d=f.toString(),h=null;s!=null&&(h=s.get(U.ALLOWED_LENGTHS)),h==null&&(h=Be.DEFAULT_ALLOWED_LENGTHS);let p=d.length,v=!1,E=0;for(let D of h){if(p===D){v=!0;break}D>E&&(E=D)}if(!v&&p>E&&(v=!0),!v)throw new F;const S=[new ae(a[1],r),new ae(l[0],r)];return new Ze(d,null,0,S,le.ITF,new Date().getTime())}static decodeMiddle(r,i,s,a){let l=new Int32Array(10),f=new Int32Array(5),d=new Int32Array(5);for(l.fill(0),f.fill(0),d.fill(0);i<s;){ht.recordPattern(r,i,l);for(let p=0;p<5;p++){let v=2*p;f[p]=l[v],d[p]=l[v+1]}let h=Be.decodeDigit(f);a.append(h.toString()),h=this.decodeDigit(d),a.append(h.toString()),l.forEach(function(p){i+=p})}}decodeStart(r){let i=Be.skipWhiteSpace(r),s=Be.findGuardPattern(r,i,Be.START_PATTERN);return this.narrowLineWidth=(s[1]-s[0])/4,this.validateQuietZone(r,s[0]),s}validateQuietZone(r,i){let s=this.narrowLineWidth*10;s=s<i?s:i;for(let a=i-1;s>0&&a>=0&&!r.get(a);a--)s--;if(s!==0)throw new X}static skipWhiteSpace(r){const i=r.getSize(),s=r.getNextSet(0);if(s===i)throw new X;return s}decodeEnd(r){r.reverse();try{let i=Be.skipWhiteSpace(r),s;try{s=Be.findGuardPattern(r,i,Be.END_PATTERN_REVERSED[0])}catch(l){l instanceof X&&(s=Be.findGuardPattern(r,i,Be.END_PATTERN_REVERSED[1]))}this.validateQuietZone(r,s[0]);let a=s[0];return s[0]=r.getSize()-s[1],s[1]=r.getSize()-a,s}finally{r.reverse()}}static findGuardPattern(r,i,s){let a=s.length,l=new Int32Array(a),f=r.getSize(),d=!1,h=0,p=i;l.fill(0);for(let v=i;v<f;v++)if(r.get(v)!==d)l[h]++;else{if(h===a-1){if(ht.patternMatchVariance(l,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[p,v];p+=l[0]+l[1],M.arraycopy(l,2,l,0,h-1),l[h-1]=0,l[h]=0,h--}else h++;l[h]=1,d=!d}throw new X}static decodeDigit(r){let i=Be.MAX_AVG_VARIANCE,s=-1,a=Be.PATTERNS.length;for(let l=0;l<a;l++){let f=Be.PATTERNS[l],d=ht.patternMatchVariance(r,f,Be.MAX_INDIVIDUAL_VARIANCE);d<i?(i=d,s=l):d===i&&(s=-1)}if(s>=0)return s%10;throw new X}}Be.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Be.MAX_AVG_VARIANCE=.38,Be.MAX_INDIVIDUAL_VARIANCE=.5,Be.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Be.START_PATTERN=Int32Array.from([1,1,1,1]),Be.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class nt extends ht{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(r){let i=!1,s,a=0,l=Int32Array.from([0,0,0]);for(;!i;){l=Int32Array.from([0,0,0]),s=nt.findGuardPattern(r,a,!1,this.START_END_PATTERN,l);let f=s[0];a=s[1];let d=f-(a-f);d>=0&&(i=r.isRange(d,f,!1))}return s}static checkChecksum(r){return nt.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return nt.getStandardUPCEANChecksum(r.substring(0,i-1))===s}static getStandardUPCEANChecksum(r){let i=r.length,s=0;for(let a=i-1;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}s*=3;for(let a=i-2;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}return(1e3-s)%10}static decodeEnd(r,i){return nt.findGuardPattern(r,i,!1,nt.START_END_PATTERN,new Int32Array(nt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(r,i,s,a){return this.findGuardPattern(r,i,s,a,new Int32Array(a.length))}static findGuardPattern(r,i,s,a,l){let f=r.getSize();i=s?r.getNextUnset(i):r.getNextSet(i);let d=0,h=i,p=a.length,v=s;for(let E=i;E<f;E++)if(r.get(E)!==v)l[d]++;else{if(d===p-1){if(ht.patternMatchVariance(l,a,nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return Int32Array.from([h,E]);h+=l[0]+l[1];let S=l.slice(2,l.length-1);for(let _=0;_<d-1;_++)l[_]=S[_];l[d-1]=0,l[d]=0,d--}else d++;l[d]=1,v=!v}throw new X}static decodeDigit(r,i,s,a){this.recordPattern(r,s,i);let l=this.MAX_AVG_VARIANCE,f=-1,d=a.length;for(let h=0;h<d;h++){let p=a[h],v=ht.patternMatchVariance(i,p,nt.MAX_INDIVIDUAL_VARIANCE);v<l&&(l=v,f=h)}if(f>=0)return f;throw new X}}nt.MAX_AVG_VARIANCE=.48,nt.MAX_INDIVIDUAL_VARIANCE=.7,nt.START_END_PATTERN=Int32Array.from([1,1,1]),nt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),nt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),nt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class js{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(r,i,s){let a=this.decodeRowStringBuffer,l=this.decodeMiddle(i,s,a),f=a.toString(),d=js.parseExtensionString(f),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ze(f,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&p.putAllMetadata(d),p}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let p=0;p<5&&f<l;p++){let v=nt.decodeDigit(r,a,f,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<4-p),p!==4&&(f=r.getNextSet(f),f=r.getNextUnset(f))}if(s.length!==5)throw new X;let h=this.determineCheckDigit(d);if(js.extensionChecksum(s.toString())!==h)throw new X;return f}static extensionChecksum(r){let i=r.length,s=0;for(let a=i-2;a>=0;a-=2)s+=r.charAt(a).charCodeAt(0)-48;s*=3;for(let a=i-1;a>=0;a-=2)s+=r.charAt(a).charCodeAt(0)-48;return s*=3,s%10}determineCheckDigit(r){for(let i=0;i<10;i++)if(r===this.CHECK_DIGIT_ENCODINGS[i])return i;throw new X}static parseExtensionString(r){if(r.length!==5)return null;let i=js.parseExtension5String(r);return i==null?null:new Map([[bt.SUGGESTED_PRICE,i]])}static parseExtension5String(r){let i;switch(r.charAt(0)){case"0":i="£";break;case"5":i="$";break;case"9":switch(r){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}i="";break;default:i="";break}let s=parseInt(r.substring(1)),a=(s/100).toString(),l=s%100,f=l<10?"0"+l:l.toString();return i+a+"."+f}}class tu{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(r,i,s){let a=this.decodeRowStringBuffer,l=this.decodeMiddle(i,s,a),f=a.toString(),d=tu.parseExtensionString(f),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ze(f,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&p.putAllMetadata(d),p}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let h=0;h<2&&f<l;h++){let p=nt.decodeDigit(r,a,f,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+p%10);for(let v of a)f+=v;p>=10&&(d|=1<<1-h),h!==1&&(f=r.getNextSet(f),f=r.getNextUnset(f))}if(s.length!==2)throw new X;if(parseInt(s.toString())%4!==d)throw new X;return f}static parseExtensionString(r){return r.length!==2?null:new Map([[bt.ISSUE_NUMBER,parseInt(r)]])}}class Y0{static decodeRow(r,i,s){let a=nt.findGuardPattern(i,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new js().decodeRow(r,i,a)}catch{return new tu().decodeRow(r,i,a)}}}Y0.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ke extends nt{constructor(){super(),this.decodeRowStringBuffer="",ke.L_AND_G_PATTERNS=ke.L_PATTERNS.map(r=>Int32Array.from(r));for(let r=10;r<20;r++){let i=ke.L_PATTERNS[r-10],s=new Int32Array(i.length);for(let a=0;a<i.length;a++)s[a]=i[i.length-a-1];ke.L_AND_G_PATTERNS[r]=s}}decodeRow(r,i,s){let a=ke.findStartGuardPattern(i),l=s==null?null:s.get(U.NEED_RESULT_POINT_CALLBACK);if(l!=null){const Z=new ae((a[0]+a[1])/2,r);l.foundPossibleResultPoint(Z)}let f=this.decodeMiddle(i,a,this.decodeRowStringBuffer),d=f.rowOffset,h=f.resultString;if(l!=null){const Z=new ae(d,r);l.foundPossibleResultPoint(Z)}let p=this.decodeEnd(i,d);if(l!=null){const Z=new ae((p[0]+p[1])/2,r);l.foundPossibleResultPoint(Z)}let v=p[1],E=v+(v-p[0]);if(E>=i.getSize()||!i.isRange(v,E,!1))throw new X;let S=h.toString();if(S.length<8)throw new F;if(!ke.checkChecksum(S))throw new T;let _=(a[1]+a[0])/2,D=(p[1]+p[0])/2,P=this.getBarcodeFormat(),W=[new ae(_,r),new ae(D,r)],H=new Ze(S,null,0,W,P,new Date().getTime()),q=0;try{let Z=Y0.decodeRow(r,i,p[1]);H.putMetadata(bt.UPC_EAN_EXTENSION,Z.getText()),H.putAllMetadata(Z.getResultMetadata()),H.addResultPoints(Z.getResultPoints()),q=Z.getText().length}catch{}let J=s==null?null:s.get(U.ALLOWED_EAN_EXTENSIONS);if(J!=null){let Z=!1;for(let Ae in J)if(q.toString()===Ae){Z=!0;break}if(!Z)throw new X}return H}decodeEnd(r,i){return ke.findGuardPattern(r,i,!1,ke.START_END_PATTERN,new Int32Array(ke.START_END_PATTERN.length).fill(0))}static checkChecksum(r){return ke.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return ke.getStandardUPCEANChecksum(r.substring(0,i-1))===s}static getStandardUPCEANChecksum(r){let i=r.length,s=0;for(let a=i-1;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}s*=3;for(let a=i-2;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}return(1e3-s)%10}}class ai extends ke{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let p=0;p<6&&f<l;p++){let v=ke.decodeDigit(r,a,f,ke.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<5-p)}s=ai.determineFirstDigit(s,d),f=ke.findGuardPattern(r,f,!0,ke.MIDDLE_PATTERN,new Int32Array(ke.MIDDLE_PATTERN.length).fill(0))[1];for(let p=0;p<6&&f<l;p++){let v=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+v);for(let E of a)f+=E}return{rowOffset:f,resultString:s}}getBarcodeFormat(){return le.EAN_13}static determineFirstDigit(r,i){for(let s=0;s<10;s++)if(i===this.FIRST_DIGIT_ENCODINGS[s])return r=String.fromCharCode(48+s)+r,r;throw new X}}ai.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class K0 extends ke{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(r,i,s){const a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1];for(let h=0;h<4&&f<l;h++){let p=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+p);for(let v of a)f+=v}f=ke.findGuardPattern(r,f,!0,ke.MIDDLE_PATTERN,new Int32Array(ke.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<4&&f<l;h++){let p=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+p);for(let v of a)f+=v}return{rowOffset:f,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class Z0 extends ke{constructor(){super(...arguments),this.ean13Reader=new ai}getBarcodeFormat(){return le.UPC_A}decode(r,i){return this.maybeReturnResult(this.ean13Reader.decode(r))}decodeRow(r,i,s){return this.maybeReturnResult(this.ean13Reader.decodeRow(r,i,s))}decodeMiddle(r,i,s){return this.ean13Reader.decodeMiddle(r,i,s)}maybeReturnResult(r){let i=r.getText();if(i.charAt(0)==="0"){let s=new Ze(i.substring(1),null,null,r.getResultPoints(),le.UPC_A);return r.getResultMetadata()!=null&&s.putAllMetadata(r.getResultMetadata()),s}else throw new X}reset(){this.ean13Reader.reset()}}class Mr extends ke{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(r,i,s){const a=this.decodeMiddleCounters.map(p=>p);a[0]=0,a[1]=0,a[2]=0,a[3]=0;const l=r.getSize();let f=i[1],d=0;for(let p=0;p<6&&f<l;p++){const v=Mr.decodeDigit(r,a,f,Mr.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<5-p)}let h=Mr.determineNumSysAndCheckDigit(s,d);return{rowOffset:f,resultString:h}}decodeEnd(r,i){return Mr.findGuardPatternWithoutCounters(r,i,!0,Mr.MIDDLE_END_PATTERN)}checkChecksum(r){return ke.checkChecksum(Mr.convertUPCEtoUPCA(r))}static determineNumSysAndCheckDigit(r,i){for(let s=0;s<=1;s++)for(let a=0;a<10;a++)if(i===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[s][a]){let l=String.fromCharCode(48+s),f=String.fromCharCode(48+a);return l+r+f}throw X.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(r){const i=r.slice(1,7).split("").map(l=>l.charCodeAt(0)),s=new pe;s.append(r.charAt(0));let a=i[5];switch(a){case 0:case 1:case 2:s.appendChars(i,0,2),s.append(a),s.append("0000"),s.appendChars(i,2,3);break;case 3:s.appendChars(i,0,3),s.append("00000"),s.appendChars(i,3,2);break;case 4:s.appendChars(i,0,4),s.append("00000"),s.append(i[4]);break;default:s.appendChars(i,0,5),s.append("0000"),s.append(a);break}return r.length>=8&&s.append(r.charAt(7)),s.toString()}}Mr.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Mr.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class ru extends ht{constructor(r){super();let i=r==null?null:r.get(U.POSSIBLE_FORMATS),s=[];o(i)?(s.push(new ai),s.push(new Z0),s.push(new K0),s.push(new Mr)):(i.indexOf(le.EAN_13)>-1&&s.push(new ai),i.indexOf(le.UPC_A)>-1&&s.push(new Z0),i.indexOf(le.EAN_8)>-1&&s.push(new K0),i.indexOf(le.UPC_E)>-1&&s.push(new Mr)),this.readers=s}decodeRow(r,i,s){for(let a of this.readers)try{const l=a.decodeRow(r,i,s),f=l.getBarcodeFormat()===le.EAN_13&&l.getText().charAt(0)==="0",d=s==null?null:s.get(U.POSSIBLE_FORMATS),h=d==null||d.includes(le.UPC_A);if(f&&h){const p=l.getRawBytes(),v=new Ze(l.getText().substring(1),p,p?p.length:null,l.getResultPoints(),le.UPC_A);return v.putAllMetadata(l.getResultMetadata()),v}return l}catch{}throw new X}reset(){for(let r of this.readers)r.reset()}}class Ft extends ht{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(r,i){for(let s=0;s<i.length;s++)if(ht.patternMatchVariance(r,i[s],Ft.MAX_INDIVIDUAL_VARIANCE)<Ft.MAX_AVG_VARIANCE)return s;throw new X}static count(r){return Re.sum(new Int32Array(r))}static increment(r,i){let s=0,a=i[0];for(let l=1;l<r.length;l++)i[l]>a&&(a=i[l],s=l);r[s]++}static decrement(r,i){let s=0,a=i[0];for(let l=1;l<r.length;l++)i[l]<a&&(a=i[l],s=l);r[s]--}static isFinderPattern(r){let i=r[0]+r[1],s=i+r[2]+r[3],a=i/s;if(a>=Ft.MIN_FINDER_PATTERN_RATIO&&a<=Ft.MAX_FINDER_PATTERN_RATIO){let l=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;for(let d of r)d>f&&(f=d),d<l&&(l=d);return f<10*l}return!1}}Ft.MAX_AVG_VARIANCE=.2,Ft.MAX_INDIVIDUAL_VARIANCE=.45,Ft.MIN_FINDER_PATTERN_RATIO=9.5/12,Ft.MAX_FINDER_PATTERN_RATIO=12.5/14;class Bi{constructor(r,i){this.value=r,this.checksumPortion=i}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(r){if(!(r instanceof Bi))return!1;const i=r;return this.value===i.value&&this.checksumPortion===i.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class va{constructor(r,i,s,a,l){this.value=r,this.startEnd=i,this.value=r,this.startEnd=i,this.resultPoints=new Array,this.resultPoints.push(new ae(s,l)),this.resultPoints.push(new ae(a,l))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(r){if(!(r instanceof va))return!1;const i=r;return this.value===i.value}hashCode(){return this.value}}class Yr{constructor(){}static getRSSvalue(r,i,s){let a=0;for(let h of r)a+=h;let l=0,f=0,d=r.length;for(let h=0;h<d-1;h++){let p;for(p=1,f|=1<<h;p<r[h];p++,f&=~(1<<h)){let v=Yr.combins(a-p-1,d-h-2);if(s&&f===0&&a-p-(d-h-1)>=d-h-1&&(v-=Yr.combins(a-p-(d-h),d-h-2)),d-h-1>1){let E=0;for(let S=a-p-(d-h-2);S>i;S--)E+=Yr.combins(a-p-S-1,d-h-3);v-=E*(d-1-h)}else a-p>i&&v--;l+=v}a-=p}return l}static combins(r,i){let s,a;r-i>i?(a=i,s=r-i):(a=r-i,s=i);let l=1,f=1;for(let d=r;d>s;d--)l*=d,f<=a&&(l/=f,f++);for(;f<=a;)l/=f,f++;return l}}class s3{static buildBitArray(r){let i=r.length*2-1;r[r.length-1].getRightChar()==null&&(i-=1);let s=12*i,a=new B(s),l=0,d=r[0].getRightChar().getValue();for(let h=11;h>=0;--h)d&1<<h&&a.set(l),l++;for(let h=1;h<r.length;++h){let p=r[h],v=p.getLeftChar().getValue();for(let E=11;E>=0;--E)v&1<<E&&a.set(l),l++;if(p.getRightChar()!=null){let E=p.getRightChar().getValue();for(let S=11;S>=0;--S)E&1<<S&&a.set(l),l++}}return a}}class li{constructor(r,i){i?this.decodedInformation=null:(this.finished=r,this.decodedInformation=i)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class nu{constructor(r){this.newPosition=r}getNewPosition(){return this.newPosition}}class qt extends nu{constructor(r,i){super(r),this.value=i}getValue(){return this.value}isFNC1(){return this.value===qt.FNC1}}qt.FNC1="$";class ci extends nu{constructor(r,i,s){super(r),s?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=i}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Cr extends nu{constructor(r,i,s){if(super(r),i<0||i>10||s<0||s>10)throw new F;this.firstDigit=i,this.secondDigit=s}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Cr.FNC1}isSecondDigitFNC1(){return this.secondDigit===Cr.FNC1}isAnyFNC1(){return this.firstDigit===Cr.FNC1||this.secondDigit===Cr.FNC1}}Cr.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(r){if(!r)return null;if(r.length<2)throw new X;let i=r.substring(0,2);for(let l of ne.TWO_DIGIT_DATA_LENGTH)if(l[0]===i)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(2,l[2],r):ne.processFixedAI(2,l[1],r);if(r.length<3)throw new X;let s=r.substring(0,3);for(let l of ne.THREE_DIGIT_DATA_LENGTH)if(l[0]===s)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(3,l[2],r):ne.processFixedAI(3,l[1],r);for(let l of ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(l[0]===s)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,l[2],r):ne.processFixedAI(4,l[1],r);if(r.length<4)throw new X;let a=r.substring(0,4);for(let l of ne.FOUR_DIGIT_DATA_LENGTH)if(l[0]===a)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,l[2],r):ne.processFixedAI(4,l[1],r);throw new X}static processFixedAI(r,i,s){if(s.length<r)throw new X;let a=s.substring(0,r);if(s.length<r+i)throw new X;let l=s.substring(r,r+i),f=s.substring(r+i),d="("+a+")"+l,h=ne.parseFieldsInGeneralPurpose(f);return h==null?d:d+h}static processVariableAI(r,i,s){let a=s.substring(0,r),l;s.length<r+i?l=s.length:l=r+i;let f=s.substring(r,l),d=s.substring(l),h="("+a+")"+f,p=ne.parseFieldsInGeneralPurpose(d);return p==null?h:h+p}}ne.VARIABLE_LENGTH=[],ne.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ne.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ne.VARIABLE_LENGTH,20],["22",ne.VARIABLE_LENGTH,29],["30",ne.VARIABLE_LENGTH,8],["37",ne.VARIABLE_LENGTH,8],["90",ne.VARIABLE_LENGTH,30],["91",ne.VARIABLE_LENGTH,30],["92",ne.VARIABLE_LENGTH,30],["93",ne.VARIABLE_LENGTH,30],["94",ne.VARIABLE_LENGTH,30],["95",ne.VARIABLE_LENGTH,30],["96",ne.VARIABLE_LENGTH,30],["97",ne.VARIABLE_LENGTH,3],["98",ne.VARIABLE_LENGTH,30],["99",ne.VARIABLE_LENGTH,30]],ne.THREE_DIGIT_DATA_LENGTH=[["240",ne.VARIABLE_LENGTH,30],["241",ne.VARIABLE_LENGTH,30],["242",ne.VARIABLE_LENGTH,6],["250",ne.VARIABLE_LENGTH,30],["251",ne.VARIABLE_LENGTH,30],["253",ne.VARIABLE_LENGTH,17],["254",ne.VARIABLE_LENGTH,20],["400",ne.VARIABLE_LENGTH,30],["401",ne.VARIABLE_LENGTH,30],["402",17],["403",ne.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ne.VARIABLE_LENGTH,20],["421",ne.VARIABLE_LENGTH,15],["422",3],["423",ne.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",ne.VARIABLE_LENGTH,15],["391",ne.VARIABLE_LENGTH,18],["392",ne.VARIABLE_LENGTH,15],["393",ne.VARIABLE_LENGTH,18],["703",ne.VARIABLE_LENGTH,30]],ne.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ne.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ne.VARIABLE_LENGTH,20],["8003",ne.VARIABLE_LENGTH,30],["8004",ne.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ne.VARIABLE_LENGTH,30],["8008",ne.VARIABLE_LENGTH,12],["8018",18],["8020",ne.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ne.VARIABLE_LENGTH,70],["8200",ne.VARIABLE_LENGTH,70]];class Fi{constructor(r){this.buffer=new pe,this.information=r}decodeAllCodes(r,i){let s=i,a=null;do{let l=this.decodeGeneralPurposeField(s,a),f=ne.parseFieldsInGeneralPurpose(l.getNewString());if(f!=null&&r.append(f),l.isRemaining()?a=""+l.getRemainingValue():a=null,s===l.getNewPosition())break;s=l.getNewPosition()}while(!0);return r.toString()}isStillNumeric(r){if(r+7>this.information.getSize())return r+4<=this.information.getSize();for(let i=r;i<r+3;++i)if(this.information.get(i))return!0;return this.information.get(r+3)}decodeNumeric(r){if(r+7>this.information.getSize()){let l=this.extractNumericValueFromBitArray(r,4);return l===0?new Cr(this.information.getSize(),Cr.FNC1,Cr.FNC1):new Cr(this.information.getSize(),l-1,Cr.FNC1)}let i=this.extractNumericValueFromBitArray(r,7),s=(i-8)/11,a=(i-8)%11;return new Cr(r+7,s,a)}extractNumericValueFromBitArray(r,i){return Fi.extractNumericValueFromBitArray(this.information,r,i)}static extractNumericValueFromBitArray(r,i,s){let a=0;for(let l=0;l<s;++l)r.get(i+l)&&(a|=1<<s-l-1);return a}decodeGeneralPurposeField(r,i){this.buffer.setLengthToZero(),i!=null&&this.buffer.append(i),this.current.setPosition(r);let s=this.parseBlocks();return s!=null&&s.isRemaining()?new ci(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new ci(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let r,i;do{let s=this.current.getPosition();if(this.current.isAlpha()?(i=this.parseAlphaBlock(),r=i.isFinished()):this.current.isIsoIec646()?(i=this.parseIsoIec646Block(),r=i.isFinished()):(i=this.parseNumericBlock(),r=i.isFinished()),!(s!==this.current.getPosition())&&!r)break}while(!r);return i.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let r=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFirstDigitFNC1()){let i;return r.isSecondDigitFNC1()?i=new ci(this.current.getPosition(),this.buffer.toString()):i=new ci(this.current.getPosition(),this.buffer.toString(),r.getSecondDigit()),new li(!0,i)}if(this.buffer.append(r.getFirstDigit()),r.isSecondDigitFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new li(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let r=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new li(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let r=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new li(!1)}isStillIsoIec646(r){if(r+5>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(r,5);if(i>=5&&i<16)return!0;if(r+7>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(r,7);if(s>=64&&s<116)return!0;if(r+8>this.information.getSize())return!1;let a=this.extractNumericValueFromBitArray(r,8);return a>=232&&a<253}decodeIsoIec646(r){let i=this.extractNumericValueFromBitArray(r,5);if(i===15)return new qt(r+5,qt.FNC1);if(i>=5&&i<15)return new qt(r+5,"0"+(i-5));let s=this.extractNumericValueFromBitArray(r,7);if(s>=64&&s<90)return new qt(r+7,""+(s+1));if(s>=90&&s<116)return new qt(r+7,""+(s+7));let a=this.extractNumericValueFromBitArray(r,8),l;switch(a){case 232:l="!";break;case 233:l='"';break;case 234:l="%";break;case 235:l="&";break;case 236:l="'";break;case 237:l="(";break;case 238:l=")";break;case 239:l="*";break;case 240:l="+";break;case 241:l=",";break;case 242:l="-";break;case 243:l=".";break;case 244:l="/";break;case 245:l=":";break;case 246:l=";";break;case 247:l="<";break;case 248:l="=";break;case 249:l=">";break;case 250:l="?";break;case 251:l="_";break;case 252:l=" ";break;default:throw new F}return new qt(r+8,l)}isStillAlpha(r){if(r+5>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(r,5);if(i>=5&&i<16)return!0;if(r+6>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(r,6);return s>=16&&s<63}decodeAlphanumeric(r){let i=this.extractNumericValueFromBitArray(r,5);if(i===15)return new qt(r+5,qt.FNC1);if(i>=5&&i<15)return new qt(r+5,"0"+(i-5));let s=this.extractNumericValueFromBitArray(r,6);if(s>=32&&s<58)return new qt(r+6,""+(s+33));let a;switch(s){case 58:a="*";break;case 59:a=",";break;case 60:a="-";break;case 61:a=".";break;case 62:a="/";break;default:throw new Xr("Decoding invalid alphanumeric value: "+s)}return new qt(r+6,a)}isAlphaTo646ToAlphaLatch(r){if(r+1>this.information.getSize())return!1;for(let i=0;i<5&&i+r<this.information.getSize();++i)if(i===2){if(!this.information.get(r+2))return!1}else if(this.information.get(r+i))return!1;return!0}isAlphaOr646ToNumericLatch(r){if(r+3>this.information.getSize())return!1;for(let i=r;i<r+3;++i)if(this.information.get(i))return!1;return!0}isNumericToAlphaNumericLatch(r){if(r+1>this.information.getSize())return!1;for(let i=0;i<4&&i+r<this.information.getSize();++i)if(this.information.get(r+i))return!1;return!0}}class iu{constructor(r){this.information=r,this.generalDecoder=new Fi(r)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Jt extends iu{constructor(r){super(r)}encodeCompressedGtin(r,i){r.append("(01)");let s=r.length();r.append("9"),this.encodeCompressedGtinWithoutAI(r,i,s)}encodeCompressedGtinWithoutAI(r,i,s){for(let a=0;a<4;++a){let l=this.getGeneralDecoder().extractNumericValueFromBitArray(i+10*a,10);l/100===0&&r.append("0"),l/10===0&&r.append("0"),r.append(l)}Jt.appendCheckDigit(r,s)}static appendCheckDigit(r,i){let s=0;for(let a=0;a<13;a++){let l=r.charAt(a+i).charCodeAt(0)-48;s+=a&1?l:3*l}s=10-s%10,s===10&&(s=0),r.append(s)}}Jt.GTIN_SIZE=40;class Ui extends Jt{constructor(r){super(r)}parseInformation(){let r=new pe;r.append("(01)");let i=r.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ui.HEADER_SIZE,4);return r.append(s),this.encodeCompressedGtinWithoutAI(r,Ui.HEADER_SIZE+4,i),this.getGeneralDecoder().decodeAllCodes(r,Ui.HEADER_SIZE+44)}}Ui.HEADER_SIZE=4;class ya extends iu{constructor(r){super(r)}parseInformation(){let r=new pe;return this.getGeneralDecoder().decodeAllCodes(r,ya.HEADER_SIZE)}}ya.HEADER_SIZE=5;class Ea extends Jt{constructor(r){super(r)}encodeCompressedWeight(r,i,s){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(i,s);this.addWeightCode(r,a);let l=this.checkWeight(a),f=1e5;for(let d=0;d<5;++d)l/f===0&&r.append("0"),f/=10;r.append(l)}}class Kr extends Ea{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()!=Kr.HEADER_SIZE+Ea.GTIN_SIZE+Kr.WEIGHT_SIZE)throw new X;let r=new pe;return this.encodeCompressedGtin(r,Kr.HEADER_SIZE),this.encodeCompressedWeight(r,Kr.HEADER_SIZE+Ea.GTIN_SIZE,Kr.WEIGHT_SIZE),r.toString()}}Kr.HEADER_SIZE=5,Kr.WEIGHT_SIZE=15;class o3 extends Kr{constructor(r){super(r)}addWeightCode(r,i){r.append("(3103)")}checkWeight(r){return r}}class a3 extends Kr{constructor(r){super(r)}addWeightCode(r,i){i<1e4?r.append("(3202)"):r.append("(3203)")}checkWeight(r){return r<1e4?r:r-1e4}}class Zr extends Jt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Zr.HEADER_SIZE+Jt.GTIN_SIZE)throw new X;let r=new pe;this.encodeCompressedGtin(r,Zr.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Zr.HEADER_SIZE+Jt.GTIN_SIZE,Zr.LAST_DIGIT_SIZE);r.append("(392"),r.append(i),r.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Zr.HEADER_SIZE+Jt.GTIN_SIZE+Zr.LAST_DIGIT_SIZE,null);return r.append(s.getNewString()),r.toString()}}Zr.HEADER_SIZE=8,Zr.LAST_DIGIT_SIZE=2;class Ht extends Jt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Ht.HEADER_SIZE+Jt.GTIN_SIZE)throw new X;let r=new pe;this.encodeCompressedGtin(r,Ht.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Jt.GTIN_SIZE,Ht.LAST_DIGIT_SIZE);r.append("(393"),r.append(i),r.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Jt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE,Ht.FIRST_THREE_DIGITS_SIZE);s/100==0&&r.append("0"),s/10==0&&r.append("0"),r.append(s);let a=this.getGeneralDecoder().decodeGeneralPurposeField(Ht.HEADER_SIZE+Jt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE+Ht.FIRST_THREE_DIGITS_SIZE,null);return r.append(a.getNewString()),r.toString()}}Ht.HEADER_SIZE=8,Ht.LAST_DIGIT_SIZE=2,Ht.FIRST_THREE_DIGITS_SIZE=10;class Xe extends Ea{constructor(r,i,s){super(r),this.dateCode=s,this.firstAIdigits=i}parseInformation(){if(this.getInformation().getSize()!=Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE+Xe.DATE_SIZE)throw new X;let r=new pe;return this.encodeCompressedGtin(r,Xe.HEADER_SIZE),this.encodeCompressedWeight(r,Xe.HEADER_SIZE+Xe.GTIN_SIZE,Xe.WEIGHT_SIZE),this.encodeCompressedDate(r,Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE),r.toString()}encodeCompressedDate(r,i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(i,Xe.DATE_SIZE);if(s==38400)return;r.append("("),r.append(this.dateCode),r.append(")");let a=s%32;s/=32;let l=s%12+1;s/=12;let f=s;f/10==0&&r.append("0"),r.append(f),l/10==0&&r.append("0"),r.append(l),a/10==0&&r.append("0"),r.append(a)}addWeightCode(r,i){r.append("("),r.append(this.firstAIdigits),r.append(i/1e5),r.append(")")}checkWeight(r){return r%1e5}}Xe.HEADER_SIZE=8,Xe.WEIGHT_SIZE=20,Xe.DATE_SIZE=16;function Q0(y){try{if(y.get(1))return new Ui(y);if(!y.get(2))return new ya(y);switch(Fi.extractNumericValueFromBitArray(y,1,4)){case 4:return new o3(y);case 5:return new a3(y)}switch(Fi.extractNumericValueFromBitArray(y,1,5)){case 12:return new Zr(y);case 13:return new Ht(y)}switch(Fi.extractNumericValueFromBitArray(y,1,7)){case 56:return new Xe(y,"310","11");case 57:return new Xe(y,"320","11");case 58:return new Xe(y,"310","13");case 59:return new Xe(y,"320","13");case 60:return new Xe(y,"310","15");case 61:return new Xe(y,"320","15");case 62:return new Xe(y,"310","17");case 63:return new Xe(y,"320","17")}}catch(r){throw console.log(r),new Xr("unknown decoder: "+y)}}class On{constructor(r,i,s,a){this.leftchar=r,this.rightchar=i,this.finderpattern=s,this.maybeLast=a}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(r,i){return r instanceof On?On.equalsOrNull(r.leftchar,i.leftchar)&&On.equalsOrNull(r.rightchar,i.rightchar)&&On.equalsOrNull(r.finderpattern,i.finderpattern):!1}static equalsOrNull(r,i){return r===null?i===null:On.equals(r,i)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class su{constructor(r,i,s){this.pairs=r,this.rowNumber=i,this.wasReversed=s}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(r){return this.checkEqualitity(this,r)}toString(){return"{ "+this.pairs+" }"}equals(r,i){return r instanceof su?this.checkEqualitity(r,i)&&r.wasReversed===i.wasReversed:!1}checkEqualitity(r,i){if(!r||!i)return;let s;return r.forEach((a,l)=>{i.forEach(f=>{a.getLeftChar().getValue()===f.getLeftChar().getValue()&&a.getRightChar().getValue()===f.getRightChar().getValue()&&a.getFinderPatter().getValue()===f.getFinderPatter().getValue()&&(s=!0)})}),s}}class K extends Ft{constructor(r){super(...arguments),this.pairs=new Array(K.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=r===!0}decodeRow(r,i,s){this.pairs.length=0,this.startFromEven=!1;try{return K.constructResult(this.decodeRow2pairs(r,i))}catch(a){this.verbose&&console.log(a)}return this.pairs.length=0,this.startFromEven=!0,K.constructResult(this.decodeRow2pairs(r,i))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(r,i){let s=!1;for(;!s;)try{this.pairs.push(this.retrieveNextPair(i,this.pairs,r))}catch(l){if(l instanceof X){if(!this.pairs.length)throw new X;s=!0}}if(this.checkChecksum())return this.pairs;let a;if(this.rows.length?a=!0:a=!1,this.storeRow(r,!1),a){let l=this.checkRowsBoolean(!1);if(l!=null||(l=this.checkRowsBoolean(!0),l!=null))return l}throw new X}checkRowsBoolean(r){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,r&&(this.rows=this.rows.reverse());let i=null;try{i=this.checkRows(new Array,0)}catch(s){this.verbose&&console.log(s)}return r&&(this.rows=this.rows.reverse()),i}checkRows(r,i){for(let s=i;s<this.rows.length;s++){let a=this.rows[s];this.pairs.length=0;for(let f of r)this.pairs.push(f.getPairs());if(this.pairs.push(a.getPairs()),!K.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let l=new Array(r);l.push(a);try{return this.checkRows(l,s+1)}catch(f){this.verbose&&console.log(f)}}throw new X}static isValidSequence(r){for(let i of K.FINDER_PATTERN_SEQUENCES){if(r.length>i.length)continue;let s=!0;for(let a=0;a<r.length;a++)if(r[a].getFinderPattern().getValue()!=i[a]){s=!1;break}if(s)return!0}return!1}storeRow(r,i){let s=0,a=!1,l=!1;for(;s<this.rows.length;){let f=this.rows[s];if(f.getRowNumber()>r){l=f.isEquivalent(this.pairs);break}a=f.isEquivalent(this.pairs),s++}l||a||K.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new su(this.pairs,r,i)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(r,i){for(let s of i)if(s.getPairs().length!==r.length){for(let a of s.getPairs())for(let l of r)if(On.equals(a,l))break}}static isPartialRow(r,i){for(let s of i){let a=!0;for(let l of r){let f=!1;for(let d of s.getPairs())if(l.equals(d)){f=!0;break}if(!f){a=!1;break}}if(a)return!0}return!1}getRows(){return this.rows}static constructResult(r){let i=s3.buildBitArray(r),a=Q0(i).parseInformation(),l=r[0].getFinderPattern().getResultPoints(),f=r[r.length-1].getFinderPattern().getResultPoints(),d=[l[0],l[1],f[0],f[1]];return new Ze(a,null,null,d,le.RSS_EXPANDED,null)}checkChecksum(){let r=this.pairs.get(0),i=r.getLeftChar(),s=r.getRightChar();if(s==null)return!1;let a=s.getChecksumPortion(),l=2;for(let d=1;d<this.pairs.size();++d){let h=this.pairs.get(d);a+=h.getLeftChar().getChecksumPortion(),l++;let p=h.getRightChar();p!=null&&(a+=p.getChecksumPortion(),l++)}return a%=211,211*(l-4)+a==i.getValue()}static getNextSecondBar(r,i){let s;return r.get(i)?(s=r.getNextUnset(i),s=r.getNextSet(s)):(s=r.getNextSet(i),s=r.getNextUnset(s)),s}retrieveNextPair(r,i,s){let a=i.length%2==0;this.startFromEven&&(a=!a);let l,f=!0,d=-1;do this.findNextPair(r,i,d),l=this.parseFoundFinderPattern(r,s,a),l==null?d=K.getNextSecondBar(r,this.startEnd[0]):f=!1;while(f);let h=this.decodeDataCharacter(r,l,a,!0);if(!this.isEmptyPair(i)&&i[i.length-1].mustBeLast())throw new X;let p;try{p=this.decodeDataCharacter(r,l,a,!1)}catch(v){p=null,this.verbose&&console.log(v)}return new On(h,p,l,!0)}isEmptyPair(r){return r.length===0}findNextPair(r,i,s){let a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f;s>=0?f=s:this.isEmptyPair(i)?f=0:f=i[i.length-1].getFinderPattern().getStartEnd()[1];let d=i.length%2!=0;this.startFromEven&&(d=!d);let h=!1;for(;f<l&&(h=!r.get(f),!!h);)f++;let p=0,v=f;for(let E=f;E<l;E++)if(r.get(E)!=h)a[p]++;else{if(p==3){if(d&&K.reverseCounters(a),K.isFinderPattern(a)){this.startEnd[0]=v,this.startEnd[1]=E;return}d&&K.reverseCounters(a),v+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,p--}else p++;a[p]=1,h=!h}throw new X}static reverseCounters(r){let i=r.length;for(let s=0;s<i/2;++s){let a=r[s];r[s]=r[i-s-1],r[i-s-1]=a}}parseFoundFinderPattern(r,i,s){let a,l,f;if(s){let p=this.startEnd[0]-1;for(;p>=0&&!r.get(p);)p--;p++,a=this.startEnd[0]-p,l=p,f=this.startEnd[1]}else l=this.startEnd[0],f=r.getNextUnset(this.startEnd[1]+1),a=f-this.startEnd[1];let d=this.getDecodeFinderCounters();M.arraycopy(d,0,d,1,d.length-1),d[0]=a;let h;try{h=this.parseFinderValue(d,K.FINDER_PATTERNS)}catch{return null}return new va(h,[l,f],l,f,i)}decodeDataCharacter(r,i,s,a){let l=this.getDataCharacterCounters();for(let Ue=0;Ue<l.length;Ue++)l[Ue]=0;if(a)K.recordPatternInReverse(r,i.getStartEnd()[0],l);else{K.recordPattern(r,i.getStartEnd()[1],l);for(let Ue=0,kt=l.length-1;Ue<kt;Ue++,kt--){let fr=l[Ue];l[Ue]=l[kt],l[kt]=fr}}let f=17,d=Re.sum(new Int32Array(l))/f,h=(i.getStartEnd()[1]-i.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new X;let p=this.getOddCounts(),v=this.getEvenCounts(),E=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let Ue=0;Ue<l.length;Ue++){let kt=1*l[Ue]/d,fr=kt+.5;if(fr<1){if(kt<.3)throw new X;fr=1}else if(fr>8){if(kt>8.7)throw new X;fr=8}let Vi=Ue/2;Ue&1?(v[Vi]=fr,S[Vi]=kt-fr):(p[Vi]=fr,E[Vi]=kt-fr)}this.adjustOddEvenCounts(f);let _=4*i.getValue()+(s?0:2)+(a?0:1)-1,D=0,P=0;for(let Ue=p.length-1;Ue>=0;Ue--){if(K.isNotA1left(i,s,a)){let kt=K.WEIGHTS[_][2*Ue];P+=p[Ue]*kt}D+=p[Ue]}let W=0;for(let Ue=v.length-1;Ue>=0;Ue--)if(K.isNotA1left(i,s,a)){let kt=K.WEIGHTS[_][2*Ue+1];W+=v[Ue]*kt}let H=P+W;if(D&1||D>13||D<4)throw new X;let q=(13-D)/2,J=K.SYMBOL_WIDEST[q],Z=9-J,Ae=Yr.getRSSvalue(p,J,!0),we=Yr.getRSSvalue(v,Z,!1),tr=K.EVEN_TOTAL_SUBSET[q],Dr=K.GSUM[q],rr=Ae*tr+we+Dr;return new Bi(rr,H)}static isNotA1left(r,i,s){return!(r.getValue()==0&&i&&s)}adjustOddEvenCounts(r){let i=Re.sum(new Int32Array(this.getOddCounts())),s=Re.sum(new Int32Array(this.getEvenCounts())),a=!1,l=!1;i>13?l=!0:i<4&&(a=!0);let f=!1,d=!1;s>13?d=!0:s<4&&(f=!0);let h=i+s-r,p=(i&1)==1,v=(s&1)==0;if(h==1)if(p){if(v)throw new X;l=!0}else{if(!v)throw new X;d=!0}else if(h==-1)if(p){if(v)throw new X;a=!0}else{if(!v)throw new X;f=!0}else if(h==0){if(p){if(!v)throw new X;i<s?(a=!0,d=!0):(l=!0,f=!0)}else if(v)throw new X}else throw new X;if(a){if(l)throw new X;K.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&K.decrement(this.getOddCounts(),this.getOddRoundingErrors()),f){if(d)throw new X;K.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&K.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}K.SYMBOL_WIDEST=[7,5,4,3,1],K.EVEN_TOTAL_SUBSET=[4,20,52,104,204],K.GSUM=[0,348,1388,2948,3988],K.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],K.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],K.FINDER_PAT_A=0,K.FINDER_PAT_B=1,K.FINDER_PAT_C=2,K.FINDER_PAT_D=3,K.FINDER_PAT_E=4,K.FINDER_PAT_F=5,K.FINDER_PATTERN_SEQUENCES=[[K.FINDER_PAT_A,K.FINDER_PAT_A],[K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B],[K.FINDER_PAT_A,K.FINDER_PAT_C,K.FINDER_PAT_B,K.FINDER_PAT_D],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_C],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_D,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_D],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_E],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F]],K.MAX_PAIRS=11;class l3 extends Bi{constructor(r,i,s){super(r,i),this.count=0,this.finderPattern=s}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class it extends Ft{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(r,i,s){const a=this.decodePair(i,!1,r,s);it.addOrTally(this.possibleLeftPairs,a),i.reverse();let l=this.decodePair(i,!0,r,s);it.addOrTally(this.possibleRightPairs,l),i.reverse();for(let f of this.possibleLeftPairs)if(f.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&it.checkChecksum(f,d))return it.constructResult(f,d)}throw new X}static addOrTally(r,i){if(i==null)return;let s=!1;for(let a of r)if(a.getValue()===i.getValue()){a.incrementCount(),s=!0;break}s||r.push(i)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(r,i){let s=4537077*r.getValue()+i.getValue(),a=new String(s).toString(),l=new pe;for(let p=13-a.length;p>0;p--)l.append("0");l.append(a);let f=0;for(let p=0;p<13;p++){let v=l.charAt(p).charCodeAt(0)-48;f+=p&1?v:3*v}f=10-f%10,f===10&&(f=0),l.append(f.toString());let d=r.getFinderPattern().getResultPoints(),h=i.getFinderPattern().getResultPoints();return new Ze(l.toString(),null,0,[d[0],d[1],h[0],h[1]],le.RSS_14,new Date().getTime())}static checkChecksum(r,i){let s=(r.getChecksumPortion()+16*i.getChecksumPortion())%79,a=9*r.getFinderPattern().getValue()+i.getFinderPattern().getValue();return a>72&&a--,a>8&&a--,s===a}decodePair(r,i,s,a){try{let l=this.findFinderPattern(r,i),f=this.parseFoundFinderPattern(r,s,i,l),d=a==null?null:a.get(U.NEED_RESULT_POINT_CALLBACK);if(d!=null){let v=(l[0]+l[1])/2;i&&(v=r.getSize()-1-v),d.foundPossibleResultPoint(new ae(v,s))}let h=this.decodeDataCharacter(r,f,!0),p=this.decodeDataCharacter(r,f,!1);return new l3(1597*h.getValue()+p.getValue(),h.getChecksumPortion()+4*p.getChecksumPortion(),f)}catch{return null}}decodeDataCharacter(r,i,s){let a=this.getDataCharacterCounters();for(let W=0;W<a.length;W++)a[W]=0;if(s)ht.recordPatternInReverse(r,i.getStartEnd()[0],a);else{ht.recordPattern(r,i.getStartEnd()[1]+1,a);for(let W=0,H=a.length-1;W<H;W++,H--){let q=a[W];a[W]=a[H],a[H]=q}}let l=s?16:15,f=Re.sum(new Int32Array(a))/l,d=this.getOddCounts(),h=this.getEvenCounts(),p=this.getOddRoundingErrors(),v=this.getEvenRoundingErrors();for(let W=0;W<a.length;W++){let H=a[W]/f,q=Math.floor(H+.5);q<1?q=1:q>8&&(q=8);let J=Math.floor(W/2);W&1?(h[J]=q,v[J]=H-q):(d[J]=q,p[J]=H-q)}this.adjustOddEvenCounts(s,l);let E=0,S=0;for(let W=d.length-1;W>=0;W--)S*=9,S+=d[W],E+=d[W];let _=0,D=0;for(let W=h.length-1;W>=0;W--)_*=9,_+=h[W],D+=h[W];let P=S+3*_;if(s){if(E&1||E>12||E<4)throw new X;let W=(12-E)/2,H=it.OUTSIDE_ODD_WIDEST[W],q=9-H,J=Yr.getRSSvalue(d,H,!1),Z=Yr.getRSSvalue(h,q,!0),Ae=it.OUTSIDE_EVEN_TOTAL_SUBSET[W],we=it.OUTSIDE_GSUM[W];return new Bi(J*Ae+Z+we,P)}else{if(D&1||D>10||D<4)throw new X;let W=(10-D)/2,H=it.INSIDE_ODD_WIDEST[W],q=9-H,J=Yr.getRSSvalue(d,H,!0),Z=Yr.getRSSvalue(h,q,!1),Ae=it.INSIDE_ODD_TOTAL_SUBSET[W],we=it.INSIDE_GSUM[W];return new Bi(Z*Ae+J+we,P)}}findFinderPattern(r,i){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let a=r.getSize(),l=!1,f=0;for(;f<a&&(l=!r.get(f),i!==l);)f++;let d=0,h=f;for(let p=f;p<a;p++)if(r.get(p)!==l)s[d]++;else{if(d===3){if(Ft.isFinderPattern(s))return[h,p];h+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,d--}else d++;s[d]=1,l=!l}throw new X}parseFoundFinderPattern(r,i,s,a){let l=r.get(a[0]),f=a[0]-1;for(;f>=0&&l!==r.get(f);)f--;f++;const d=a[0]-f,h=this.getDecodeFinderCounters(),p=new Int32Array(h.length);M.arraycopy(h,0,p,1,h.length-1),p[0]=d;const v=this.parseFinderValue(p,it.FINDER_PATTERNS);let E=f,S=a[1];return s&&(E=r.getSize()-1-E,S=r.getSize()-1-S),new va(v,[f,a[1]],E,S,i)}adjustOddEvenCounts(r,i){let s=Re.sum(new Int32Array(this.getOddCounts())),a=Re.sum(new Int32Array(this.getEvenCounts())),l=!1,f=!1,d=!1,h=!1;r?(s>12?f=!0:s<4&&(l=!0),a>12?h=!0:a<4&&(d=!0)):(s>11?f=!0:s<5&&(l=!0),a>10?h=!0:a<4&&(d=!0));let p=s+a-i,v=(s&1)===(r?1:0),E=(a&1)===1;if(p===1)if(v){if(E)throw new X;f=!0}else{if(!E)throw new X;h=!0}else if(p===-1)if(v){if(E)throw new X;l=!0}else{if(!E)throw new X;d=!0}else if(p===0){if(v){if(!E)throw new X;s<a?(l=!0,h=!0):(f=!0,d=!0)}else if(E)throw new X}else throw new X;if(l){if(f)throw new X;Ft.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(f&&Ft.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new X;Ft.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&Ft.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],it.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],it.OUTSIDE_GSUM=[0,161,961,2015,2715],it.INSIDE_GSUM=[0,336,1036,1516],it.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],it.INSIDE_ODD_WIDEST=[2,4,6,8],it.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ji extends ht{constructor(r,i){super(),this.readers=[],this.verbose=i===!0;const s=r?r.get(U.POSSIBLE_FORMATS):null,a=r&&r.get(U.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;s?((s.includes(le.EAN_13)||s.includes(le.UPC_A)||s.includes(le.EAN_8)||s.includes(le.UPC_E))&&this.readers.push(new ru(r)),s.includes(le.CODE_39)&&this.readers.push(new mt(a)),s.includes(le.CODE_128)&&this.readers.push(new ee),s.includes(le.ITF)&&this.readers.push(new Be),s.includes(le.RSS_14)&&this.readers.push(new it),s.includes(le.RSS_EXPANDED)&&this.readers.push(new K(this.verbose))):(this.readers.push(new ru(r)),this.readers.push(new mt),this.readers.push(new ru(r)),this.readers.push(new ee),this.readers.push(new Be),this.readers.push(new it),this.readers.push(new K(this.verbose)))}decodeRow(r,i,s){for(let a=0;a<this.readers.length;a++)try{return this.readers[a].decodeRow(r,i,s)}catch{}throw new X}reset(){this.readers.forEach(r=>r.reset())}}class c3 extends Er{constructor(r=500,i){super(new ji(i),r,i)}}class De{constructor(r,i,s){this.ecCodewords=r,this.ecBlocks=[i],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Me{constructor(r,i){this.count=r,this.dataCodewords=i}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Se{constructor(r,i,s,a,l,f){this.versionNumber=r,this.symbolSizeRows=i,this.symbolSizeColumns=s,this.dataRegionSizeRows=a,this.dataRegionSizeColumns=l,this.ecBlocks=f;let d=0;const h=f.getECCodewords(),p=f.getECBlocks();for(let v of p)d+=v.getCount()*(v.getDataCodewords()+h);this.totalCodewords=d}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(r,i){if(r&1||i&1)throw new F;for(let s of Se.VERSIONS)if(s.symbolSizeRows===r&&s.symbolSizeColumns===i)return s;throw new F}toString(){return""+this.versionNumber}static buildVersions(){return[new Se(1,10,10,8,8,new De(5,new Me(1,3))),new Se(2,12,12,10,10,new De(7,new Me(1,5))),new Se(3,14,14,12,12,new De(10,new Me(1,8))),new Se(4,16,16,14,14,new De(12,new Me(1,12))),new Se(5,18,18,16,16,new De(14,new Me(1,18))),new Se(6,20,20,18,18,new De(18,new Me(1,22))),new Se(7,22,22,20,20,new De(20,new Me(1,30))),new Se(8,24,24,22,22,new De(24,new Me(1,36))),new Se(9,26,26,24,24,new De(28,new Me(1,44))),new Se(10,32,32,14,14,new De(36,new Me(1,62))),new Se(11,36,36,16,16,new De(42,new Me(1,86))),new Se(12,40,40,18,18,new De(48,new Me(1,114))),new Se(13,44,44,20,20,new De(56,new Me(1,144))),new Se(14,48,48,22,22,new De(68,new Me(1,174))),new Se(15,52,52,24,24,new De(42,new Me(2,102))),new Se(16,64,64,14,14,new De(56,new Me(2,140))),new Se(17,72,72,16,16,new De(36,new Me(4,92))),new Se(18,80,80,18,18,new De(48,new Me(4,114))),new Se(19,88,88,20,20,new De(56,new Me(4,144))),new Se(20,96,96,22,22,new De(68,new Me(4,174))),new Se(21,104,104,24,24,new De(56,new Me(6,136))),new Se(22,120,120,18,18,new De(68,new Me(6,175))),new Se(23,132,132,20,20,new De(62,new Me(8,163))),new Se(24,144,144,22,22,new De(62,new Me(8,156),new Me(2,155))),new Se(25,8,18,6,16,new De(7,new Me(1,5))),new Se(26,8,32,6,14,new De(11,new Me(1,10))),new Se(27,12,26,10,24,new De(14,new Me(1,16))),new Se(28,12,36,10,16,new De(18,new Me(1,22))),new Se(29,16,36,14,16,new De(24,new Me(1,32))),new Se(30,16,48,14,22,new De(28,new Me(1,49)))]}}Se.VERSIONS=Se.buildVersions();class ou{constructor(r){const i=r.getHeight();if(i<8||i>144||i&1)throw new F;this.version=ou.readVersion(r),this.mappingBitMatrix=this.extractDataRegion(r),this.readMappingMatrix=new Te(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(r){const i=r.getHeight(),s=r.getWidth();return Se.getVersionForDimensions(i,s)}readCodewords(){const r=new Int8Array(this.version.getTotalCodewords());let i=0,s=4,a=0;const l=this.mappingBitMatrix.getHeight(),f=this.mappingBitMatrix.getWidth();let d=!1,h=!1,p=!1,v=!1;do if(s===l&&a===0&&!d)r[i++]=this.readCorner1(l,f)&255,s-=2,a+=2,d=!0;else if(s===l-2&&a===0&&f&3&&!h)r[i++]=this.readCorner2(l,f)&255,s-=2,a+=2,h=!0;else if(s===l+4&&a===2&&!(f&7)&&!p)r[i++]=this.readCorner3(l,f)&255,s-=2,a+=2,p=!0;else if(s===l-2&&a===0&&(f&7)===4&&!v)r[i++]=this.readCorner4(l,f)&255,s-=2,a+=2,v=!0;else{do s<l&&a>=0&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,f)&255),s-=2,a+=2;while(s>=0&&a<f);s+=1,a+=3;do s>=0&&a<f&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,f)&255),s+=2,a-=2;while(s<l&&a>=0);s+=3,a+=1}while(s<l||a<f);if(i!==this.version.getTotalCodewords())throw new F;return r}readModule(r,i,s,a){return r<0&&(r+=s,i+=4-(s+4&7)),i<0&&(i+=a,r+=4-(a+4&7)),this.readMappingMatrix.set(i,r),this.mappingBitMatrix.get(i,r)}readUtah(r,i,s,a){let l=0;return this.readModule(r-2,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r-2,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i,s,a)&&(l|=1),l<<=1,this.readModule(r,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r,i,s,a)&&(l|=1),l}readCorner1(r,i){let s=0;return this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,1,r,i)&&(s|=1),s<<=1,this.readModule(r-1,2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(2,i-1,r,i)&&(s|=1),s<<=1,this.readModule(3,i-1,r,i)&&(s|=1),s}readCorner2(r,i){let s=0;return this.readModule(r-3,0,r,i)&&(s|=1),s<<=1,this.readModule(r-2,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(0,i-4,r,i)&&(s|=1),s<<=1,this.readModule(0,i-3,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s}readCorner3(r,i){let s=0;return this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(0,i-3,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-3,r,i)&&(s|=1),s<<=1,this.readModule(1,i-2,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s}readCorner4(r,i){let s=0;return this.readModule(r-3,0,r,i)&&(s|=1),s<<=1,this.readModule(r-2,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(2,i-1,r,i)&&(s|=1),s<<=1,this.readModule(3,i-1,r,i)&&(s|=1),s}extractDataRegion(r){const i=this.version.getSymbolSizeRows(),s=this.version.getSymbolSizeColumns();if(r.getHeight()!==i)throw new b("Dimension of bitMatrix must match the version size");const a=this.version.getDataRegionSizeRows(),l=this.version.getDataRegionSizeColumns(),f=i/a|0,d=s/l|0,h=f*a,p=d*l,v=new Te(p,h);for(let E=0;E<f;++E){const S=E*a;for(let _=0;_<d;++_){const D=_*l;for(let P=0;P<a;++P){const W=E*(a+2)+1+P,H=S+P;for(let q=0;q<l;++q){const J=_*(l+2)+1+q;if(r.get(J,W)){const Z=D+q;v.set(Z,H)}}}}}return v}}class au{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i){const s=i.getECBlocks();let a=0;const l=s.getECBlocks();for(let P of l)a+=P.getCount();const f=new Array(a);let d=0;for(let P of l)for(let W=0;W<P.getCount();W++){const H=P.getDataCodewords(),q=s.getECCodewords()+H;f[d++]=new au(H,new Uint8Array(q))}const p=f[0].codewords.length-s.getECCodewords(),v=p-1;let E=0;for(let P=0;P<v;P++)for(let W=0;W<d;W++)f[W].codewords[P]=r[E++];const S=i.getVersionNumber()===24,_=S?8:d;for(let P=0;P<_;P++)f[P].codewords[p-1]=r[E++];const D=f[0].codewords.length;for(let P=p;P<D;P++)for(let W=0;W<d;W++){const H=S?(W+8)%d:W,q=S&&H>7?P-1:P;f[H].codewords[q]=r[E++]}if(E!==r.length)throw new b;return f}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class lu{constructor(r){this.bytes=r,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(r){if(r<1||r>32||r>this.available())throw new b(""+r);let i=0,s=this.bitOffset,a=this.byteOffset;const l=this.bytes;if(s>0){const f=8-s,d=r<f?r:f,h=f-d,p=255>>8-d<<h;i=(l[a]&p)>>h,r-=d,s+=d,s===8&&(s=0,a++)}if(r>0){for(;r>=8;)i=i<<8|l[a]&255,a++,r-=8;if(r>0){const f=8-r,d=255>>f<<f;i=i<<r|(l[a]&d)>>f,s+=r}}return this.bitOffset=s,this.byteOffset=a,i}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var xt;(function(y){y[y.PAD_ENCODE=0]="PAD_ENCODE",y[y.ASCII_ENCODE=1]="ASCII_ENCODE",y[y.C40_ENCODE=2]="C40_ENCODE",y[y.TEXT_ENCODE=3]="TEXT_ENCODE",y[y.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",y[y.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",y[y.BASE256_ENCODE=6]="BASE256_ENCODE"})(xt||(xt={}));class Nn{static decode(r){const i=new lu(r),s=new pe,a=new pe,l=new Array;let f=xt.ASCII_ENCODE;do if(f===xt.ASCII_ENCODE)f=this.decodeAsciiSegment(i,s,a);else{switch(f){case xt.C40_ENCODE:this.decodeC40Segment(i,s);break;case xt.TEXT_ENCODE:this.decodeTextSegment(i,s);break;case xt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(i,s);break;case xt.EDIFACT_ENCODE:this.decodeEdifactSegment(i,s);break;case xt.BASE256_ENCODE:this.decodeBase256Segment(i,s,l);break;default:throw new F}f=xt.ASCII_ENCODE}while(f!==xt.PAD_ENCODE&&i.available()>0);return a.length()>0&&s.append(a.toString()),new Bs(r,s.toString(),l.length===0?null:l,null)}static decodeAsciiSegment(r,i,s){let a=!1;do{let l=r.readBits(8);if(l===0)throw new F;if(l<=128)return a&&(l+=128),i.append(String.fromCharCode(l-1)),xt.ASCII_ENCODE;if(l===129)return xt.PAD_ENCODE;if(l<=229){const f=l-130;f<10&&i.append("0"),i.append(""+f)}else switch(l){case 230:return xt.C40_ENCODE;case 231:return xt.BASE256_ENCODE;case 232:i.append("");break;case 233:case 234:break;case 235:a=!0;break;case 236:i.append("[)>05"),s.insert(0,"");break;case 237:i.append("[)>06"),s.insert(0,"");break;case 238:return xt.ANSIX12_ENCODE;case 239:return xt.TEXT_ENCODE;case 240:return xt.EDIFACT_ENCODE;case 241:break;default:if(l!==254||r.available()!==0)throw new F;break}}while(r.available()>0);return xt.ASCII_ENCODE}static decodeC40Segment(r,i){let s=!1;const a=[];let l=0;do{if(r.available()===8)return;const f=r.readBits(8);if(f===254)return;this.parseTwoBytes(f,r.readBits(8),a);for(let d=0;d<3;d++){const h=a[d];switch(l){case 0:if(h<3)l=h+1;else if(h<this.C40_BASIC_SET_CHARS.length){const p=this.C40_BASIC_SET_CHARS[h];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else throw new F;break;case 1:s?(i.append(String.fromCharCode(h+128)),s=!1):i.append(String.fromCharCode(h)),l=0;break;case 2:if(h<this.C40_SHIFT2_SET_CHARS.length){const p=this.C40_SHIFT2_SET_CHARS[h];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else switch(h){case 27:i.append("");break;case 30:s=!0;break;default:throw new F}l=0;break;case 3:s?(i.append(String.fromCharCode(h+224)),s=!1):i.append(String.fromCharCode(h+96)),l=0;break;default:throw new F}}}while(r.available()>0)}static decodeTextSegment(r,i){let s=!1,a=[],l=0;do{if(r.available()===8)return;const f=r.readBits(8);if(f===254)return;this.parseTwoBytes(f,r.readBits(8),a);for(let d=0;d<3;d++){const h=a[d];switch(l){case 0:if(h<3)l=h+1;else if(h<this.TEXT_BASIC_SET_CHARS.length){const p=this.TEXT_BASIC_SET_CHARS[h];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else throw new F;break;case 1:s?(i.append(String.fromCharCode(h+128)),s=!1):i.append(String.fromCharCode(h)),l=0;break;case 2:if(h<this.TEXT_SHIFT2_SET_CHARS.length){const p=this.TEXT_SHIFT2_SET_CHARS[h];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else switch(h){case 27:i.append("");break;case 30:s=!0;break;default:throw new F}l=0;break;case 3:if(h<this.TEXT_SHIFT3_SET_CHARS.length){const p=this.TEXT_SHIFT3_SET_CHARS[h];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p),l=0}else throw new F;break;default:throw new F}}}while(r.available()>0)}static decodeAnsiX12Segment(r,i){const s=[];do{if(r.available()===8)return;const a=r.readBits(8);if(a===254)return;this.parseTwoBytes(a,r.readBits(8),s);for(let l=0;l<3;l++){const f=s[l];switch(f){case 0:i.append("\r");break;case 1:i.append("*");break;case 2:i.append(">");break;case 3:i.append(" ");break;default:if(f<14)i.append(String.fromCharCode(f+44));else if(f<40)i.append(String.fromCharCode(f+51));else throw new F;break}}}while(r.available()>0)}static parseTwoBytes(r,i,s){let a=(r<<8)+i-1,l=Math.floor(a/1600);s[0]=l,a-=l*1600,l=Math.floor(a/40),s[1]=l,s[2]=a-l*40}static decodeEdifactSegment(r,i){do{if(r.available()<=16)return;for(let s=0;s<4;s++){let a=r.readBits(6);if(a===31){const l=8-r.getBitOffset();l!==8&&r.readBits(l);return}a&32||(a|=64),i.append(String.fromCharCode(a))}}while(r.available()>0)}static decodeBase256Segment(r,i,s){let a=1+r.getByteOffset();const l=this.unrandomize255State(r.readBits(8),a++);let f;if(l===0?f=r.available()/8|0:l<250?f=l:f=250*(l-249)+this.unrandomize255State(r.readBits(8),a++),f<0)throw new F;const d=new Uint8Array(f);for(let h=0;h<f;h++){if(r.available()<8)throw new F;d[h]=this.unrandomize255State(r.readBits(8),a++)}s.push(d);try{i.append(ve.decode(d,ie.ISO88591))}catch(h){throw new Xr("Platform does not support required encoding: "+h.message)}}static unrandomize255State(r,i){const s=149*i%255+1,a=r-s;return a>=0?a:a+256}}Nn.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Nn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Nn.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Nn.TEXT_SHIFT2_SET_CHARS=Nn.C40_SHIFT2_SET_CHARS,Nn.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class u3{constructor(){this.rsDecoder=new Us(Ne.DATA_MATRIX_FIELD_256)}decode(r){const i=new ou(r),s=i.getVersion(),a=i.readCodewords(),l=au.getDataBlocks(a,s);let f=0;for(let p of l)f+=p.getNumDataCodewords();const d=new Uint8Array(f),h=l.length;for(let p=0;p<h;p++){const v=l[p],E=v.getCodewords(),S=v.getNumDataCodewords();this.correctErrors(E,S);for(let _=0;_<S;_++)d[_*h+p]=E[_]}return Nn.decode(d)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new T}for(let a=0;a<i;a++)r[a]=s[a]}}class ct{constructor(r){this.image=r,this.rectangleDetector=new un(this.image)}detect(){const r=this.rectangleDetector.detect();let i=this.detectSolid1(r);if(i=this.detectSolid2(i),i[3]=this.correctTopRight(i),!i[3])throw new X;i=this.shiftToModuleCenter(i);const s=i[0],a=i[1],l=i[2],f=i[3];let d=this.transitionsBetween(s,f)+1,h=this.transitionsBetween(l,f)+1;(d&1)===1&&(d+=1),(h&1)===1&&(h+=1),4*d<7*h&&4*h<7*d&&(d=h=Math.max(d,h));let p=ct.sampleGrid(this.image,s,a,l,f,d,h);return new xa(p,[s,a,l,f])}static shiftPoint(r,i,s){let a=(i.getX()-r.getX())/(s+1),l=(i.getY()-r.getY())/(s+1);return new ae(r.getX()+a,r.getY()+l)}static moveAway(r,i,s){let a=r.getX(),l=r.getY();return a<i?a-=1:a+=1,l<s?l-=1:l+=1,new ae(a,l)}detectSolid1(r){let i=r[0],s=r[1],a=r[3],l=r[2],f=this.transitionsBetween(i,s),d=this.transitionsBetween(s,a),h=this.transitionsBetween(a,l),p=this.transitionsBetween(l,i),v=f,E=[l,i,s,a];return v>d&&(v=d,E[0]=i,E[1]=s,E[2]=a,E[3]=l),v>h&&(v=h,E[0]=s,E[1]=a,E[2]=l,E[3]=i),v>p&&(E[0]=a,E[1]=l,E[2]=i,E[3]=s),E}detectSolid2(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l),d=ct.shiftPoint(s,a,(f+1)*4),h=ct.shiftPoint(a,s,(f+1)*4),p=this.transitionsBetween(d,i),v=this.transitionsBetween(h,l);return p<v?(r[0]=i,r[1]=s,r[2]=a,r[3]=l):(r[0]=s,r[1]=a,r[2]=l,r[3]=i),r}correctTopRight(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l),d=this.transitionsBetween(s,l),h=ct.shiftPoint(i,s,(d+1)*4),p=ct.shiftPoint(a,s,(f+1)*4);f=this.transitionsBetween(h,l),d=this.transitionsBetween(p,l);let v=new ae(l.getX()+(a.getX()-s.getX())/(f+1),l.getY()+(a.getY()-s.getY())/(f+1)),E=new ae(l.getX()+(i.getX()-s.getX())/(d+1),l.getY()+(i.getY()-s.getY())/(d+1));if(!this.isValid(v))return this.isValid(E)?E:null;if(!this.isValid(E))return v;let S=this.transitionsBetween(h,v)+this.transitionsBetween(p,v),_=this.transitionsBetween(h,E)+this.transitionsBetween(p,E);return S>_?v:E}shiftToModuleCenter(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l)+1,d=this.transitionsBetween(a,l)+1,h=ct.shiftPoint(i,s,d*4),p=ct.shiftPoint(a,s,f*4);f=this.transitionsBetween(h,l)+1,d=this.transitionsBetween(p,l)+1,(f&1)===1&&(f+=1),(d&1)===1&&(d+=1);let v=(i.getX()+s.getX()+a.getX()+l.getX())/4,E=(i.getY()+s.getY()+a.getY()+l.getY())/4;i=ct.moveAway(i,v,E),s=ct.moveAway(s,v,E),a=ct.moveAway(a,v,E),l=ct.moveAway(l,v,E);let S,_;return h=ct.shiftPoint(i,s,d*4),h=ct.shiftPoint(h,l,f*4),S=ct.shiftPoint(s,i,d*4),S=ct.shiftPoint(S,a,f*4),p=ct.shiftPoint(a,l,d*4),p=ct.shiftPoint(p,s,f*4),_=ct.shiftPoint(l,a,d*4),_=ct.shiftPoint(_,i,f*4),[h,S,p,_]}isValid(r){return r.getX()>=0&&r.getX()<this.image.getWidth()&&r.getY()>0&&r.getY()<this.image.getHeight()}static sampleGrid(r,i,s,a,l,f,d){return _n.getInstance().sampleGrid(r,f,d,.5,.5,f-.5,.5,f-.5,d-.5,.5,d-.5,i.getX(),i.getY(),l.getX(),l.getY(),a.getX(),a.getY(),s.getX(),s.getY())}transitionsBetween(r,i){let s=Math.trunc(r.getX()),a=Math.trunc(r.getY()),l=Math.trunc(i.getX()),f=Math.trunc(i.getY()),d=Math.abs(f-a)>Math.abs(l-s);if(d){let P=s;s=a,a=P,P=l,l=f,f=P}let h=Math.abs(l-s),p=Math.abs(f-a),v=-h/2,E=a<f?1:-1,S=s<l?1:-1,_=0,D=this.image.get(d?a:s,d?s:a);for(let P=s,W=a;P!==l;P+=S){let H=this.image.get(d?W:P,d?P:W);if(H!==D&&(_++,D=H),v+=p,v>0){if(W===f)break;W+=E,v-=h}}return _}}class kn{constructor(){this.decoder=new u3}decode(r,i=null){let s,a;if(i!=null&&i.has(U.PURE_BARCODE)){const p=kn.extractPureBits(r.getBlackMatrix());s=this.decoder.decode(p),a=kn.NO_POINTS}else{const p=new ct(r.getBlackMatrix()).detect();s=this.decoder.decode(p.getBits()),a=p.getPoints()}const l=s.getRawBytes(),f=new Ze(s.getText(),l,8*l.length,a,le.DATA_MATRIX,M.currentTimeMillis()),d=s.getByteSegments();d!=null&&f.putMetadata(bt.BYTE_SEGMENTS,d);const h=s.getECLevel();return h!=null&&f.putMetadata(bt.ERROR_CORRECTION_LEVEL,h),f}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i==null||s==null)throw new X;const a=this.moduleSize(i,r);let l=i[1];const f=s[1];let d=i[0];const p=(s[0]-d+1)/a,v=(f-l+1)/a;if(p<=0||v<=0)throw new X;const E=a/2;l+=E,d+=E;const S=new Te(p,v);for(let _=0;_<v;_++){const D=l+_*a;for(let P=0;P<p;P++)r.get(d+P*a,D)&&S.set(P,_)}return S}static moduleSize(r,i){const s=i.getWidth();let a=r[0];const l=r[1];for(;a<s&&i.get(a,l);)a++;if(a===s)throw new X;const f=a-r[0];if(f===0)throw new X;return f}}kn.NO_POINTS=[];class f3 extends Er{constructor(r=500){super(new kn,r)}}var Wi;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(Wi||(Wi={}));class We{constructor(r,i,s){this.value=r,this.stringValue=i,this.bits=s,We.FOR_BITS.set(s,this),We.FOR_VALUE.set(r,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(r){switch(r){case"L":return We.L;case"M":return We.M;case"Q":return We.Q;case"H":return We.H;default:throw new C(r+"not available")}}toString(){return this.stringValue}equals(r){if(!(r instanceof We))return!1;const i=r;return this.value===i.value}static forBits(r){if(r<0||r>=We.FOR_BITS.size)throw new b;return We.FOR_BITS.get(r)}}We.FOR_BITS=new Map,We.FOR_VALUE=new Map,We.L=new We(Wi.L,"L",1),We.M=new We(Wi.M,"M",0),We.Q=new We(Wi.Q,"Q",3),We.H=new We(Wi.H,"H",2);class Ut{constructor(r){this.errorCorrectionLevel=We.forBits(r>>3&3),this.dataMask=r&7}static numBitsDiffering(r,i){return O.bitCount(r^i)}static decodeFormatInformation(r,i){const s=Ut.doDecodeFormatInformation(r,i);return s!==null?s:Ut.doDecodeFormatInformation(r^Ut.FORMAT_INFO_MASK_QR,i^Ut.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(r,i){let s=Number.MAX_SAFE_INTEGER,a=0;for(const l of Ut.FORMAT_INFO_DECODE_LOOKUP){const f=l[0];if(f===r||f===i)return new Ut(l[1]);let d=Ut.numBitsDiffering(r,f);d<s&&(a=l[1],s=d),r!==i&&(d=Ut.numBitsDiffering(i,f),d<s&&(a=l[1],s=d))}return s<=3?new Ut(a):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(r){if(!(r instanceof Ut))return!1;const i=r;return this.errorCorrectionLevel===i.errorCorrectionLevel&&this.dataMask===i.dataMask}}Ut.FORMAT_INFO_MASK_QR=21522,Ut.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class ${constructor(r,...i){this.ecCodewordsPerBlock=r,this.ecBlocks=i}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let r=0;const i=this.ecBlocks;for(const s of i)r+=s.getCount();return r}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class R{constructor(r,i){this.count=r,this.dataCodewords=i}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ue{constructor(r,i,...s){this.versionNumber=r,this.alignmentPatternCenters=i,this.ecBlocks=s;let a=0;const l=s[0].getECCodewordsPerBlock(),f=s[0].getECBlocks();for(const d of f)a+=d.getCount()*(d.getDataCodewords()+l);this.totalCodewords=a}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(r){return this.ecBlocks[r.getValue()]}static getProvisionalVersionForDimension(r){if(r%4!==1)throw new F;try{return this.getVersionForNumber((r-17)/4)}catch{throw new F}}static getVersionForNumber(r){if(r<1||r>40)throw new b;return ue.VERSIONS[r-1]}static decodeVersionInformation(r){let i=Number.MAX_SAFE_INTEGER,s=0;for(let a=0;a<ue.VERSION_DECODE_INFO.length;a++){const l=ue.VERSION_DECODE_INFO[a];if(l===r)return ue.getVersionForNumber(a+7);const f=Ut.numBitsDiffering(r,l);f<i&&(s=a+7,i=f)}return i<=3?ue.getVersionForNumber(s):null}buildFunctionPattern(){const r=this.getDimensionForVersion(),i=new Te(r);i.setRegion(0,0,9,9),i.setRegion(r-8,0,8,9),i.setRegion(0,r-8,9,8);const s=this.alignmentPatternCenters.length;for(let a=0;a<s;a++){const l=this.alignmentPatternCenters[a]-2;for(let f=0;f<s;f++)a===0&&(f===0||f===s-1)||a===s-1&&f===0||i.setRegion(this.alignmentPatternCenters[f]-2,l,5,5)}return i.setRegion(6,9,1,r-17),i.setRegion(9,6,r-17,1),this.versionNumber>6&&(i.setRegion(r-11,0,3,6),i.setRegion(0,r-11,6,3)),i}toString(){return""+this.versionNumber}}ue.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),ue.VERSIONS=[new ue(1,new Int32Array(0),new $(7,new R(1,19)),new $(10,new R(1,16)),new $(13,new R(1,13)),new $(17,new R(1,9))),new ue(2,Int32Array.from([6,18]),new $(10,new R(1,34)),new $(16,new R(1,28)),new $(22,new R(1,22)),new $(28,new R(1,16))),new ue(3,Int32Array.from([6,22]),new $(15,new R(1,55)),new $(26,new R(1,44)),new $(18,new R(2,17)),new $(22,new R(2,13))),new ue(4,Int32Array.from([6,26]),new $(20,new R(1,80)),new $(18,new R(2,32)),new $(26,new R(2,24)),new $(16,new R(4,9))),new ue(5,Int32Array.from([6,30]),new $(26,new R(1,108)),new $(24,new R(2,43)),new $(18,new R(2,15),new R(2,16)),new $(22,new R(2,11),new R(2,12))),new ue(6,Int32Array.from([6,34]),new $(18,new R(2,68)),new $(16,new R(4,27)),new $(24,new R(4,19)),new $(28,new R(4,15))),new ue(7,Int32Array.from([6,22,38]),new $(20,new R(2,78)),new $(18,new R(4,31)),new $(18,new R(2,14),new R(4,15)),new $(26,new R(4,13),new R(1,14))),new ue(8,Int32Array.from([6,24,42]),new $(24,new R(2,97)),new $(22,new R(2,38),new R(2,39)),new $(22,new R(4,18),new R(2,19)),new $(26,new R(4,14),new R(2,15))),new ue(9,Int32Array.from([6,26,46]),new $(30,new R(2,116)),new $(22,new R(3,36),new R(2,37)),new $(20,new R(4,16),new R(4,17)),new $(24,new R(4,12),new R(4,13))),new ue(10,Int32Array.from([6,28,50]),new $(18,new R(2,68),new R(2,69)),new $(26,new R(4,43),new R(1,44)),new $(24,new R(6,19),new R(2,20)),new $(28,new R(6,15),new R(2,16))),new ue(11,Int32Array.from([6,30,54]),new $(20,new R(4,81)),new $(30,new R(1,50),new R(4,51)),new $(28,new R(4,22),new R(4,23)),new $(24,new R(3,12),new R(8,13))),new ue(12,Int32Array.from([6,32,58]),new $(24,new R(2,92),new R(2,93)),new $(22,new R(6,36),new R(2,37)),new $(26,new R(4,20),new R(6,21)),new $(28,new R(7,14),new R(4,15))),new ue(13,Int32Array.from([6,34,62]),new $(26,new R(4,107)),new $(22,new R(8,37),new R(1,38)),new $(24,new R(8,20),new R(4,21)),new $(22,new R(12,11),new R(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new $(30,new R(3,115),new R(1,116)),new $(24,new R(4,40),new R(5,41)),new $(20,new R(11,16),new R(5,17)),new $(24,new R(11,12),new R(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new $(22,new R(5,87),new R(1,88)),new $(24,new R(5,41),new R(5,42)),new $(30,new R(5,24),new R(7,25)),new $(24,new R(11,12),new R(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new $(24,new R(5,98),new R(1,99)),new $(28,new R(7,45),new R(3,46)),new $(24,new R(15,19),new R(2,20)),new $(30,new R(3,15),new R(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new $(28,new R(1,107),new R(5,108)),new $(28,new R(10,46),new R(1,47)),new $(28,new R(1,22),new R(15,23)),new $(28,new R(2,14),new R(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new $(30,new R(5,120),new R(1,121)),new $(26,new R(9,43),new R(4,44)),new $(28,new R(17,22),new R(1,23)),new $(28,new R(2,14),new R(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new $(28,new R(3,113),new R(4,114)),new $(26,new R(3,44),new R(11,45)),new $(26,new R(17,21),new R(4,22)),new $(26,new R(9,13),new R(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new $(28,new R(3,107),new R(5,108)),new $(26,new R(3,41),new R(13,42)),new $(30,new R(15,24),new R(5,25)),new $(28,new R(15,15),new R(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new $(28,new R(4,116),new R(4,117)),new $(26,new R(17,42)),new $(28,new R(17,22),new R(6,23)),new $(30,new R(19,16),new R(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new $(28,new R(2,111),new R(7,112)),new $(28,new R(17,46)),new $(30,new R(7,24),new R(16,25)),new $(24,new R(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new $(30,new R(4,121),new R(5,122)),new $(28,new R(4,47),new R(14,48)),new $(30,new R(11,24),new R(14,25)),new $(30,new R(16,15),new R(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new $(30,new R(6,117),new R(4,118)),new $(28,new R(6,45),new R(14,46)),new $(30,new R(11,24),new R(16,25)),new $(30,new R(30,16),new R(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new $(26,new R(8,106),new R(4,107)),new $(28,new R(8,47),new R(13,48)),new $(30,new R(7,24),new R(22,25)),new $(30,new R(22,15),new R(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new $(28,new R(10,114),new R(2,115)),new $(28,new R(19,46),new R(4,47)),new $(28,new R(28,22),new R(6,23)),new $(30,new R(33,16),new R(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new $(30,new R(8,122),new R(4,123)),new $(28,new R(22,45),new R(3,46)),new $(30,new R(8,23),new R(26,24)),new $(30,new R(12,15),new R(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new $(30,new R(3,117),new R(10,118)),new $(28,new R(3,45),new R(23,46)),new $(30,new R(4,24),new R(31,25)),new $(30,new R(11,15),new R(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new $(30,new R(7,116),new R(7,117)),new $(28,new R(21,45),new R(7,46)),new $(30,new R(1,23),new R(37,24)),new $(30,new R(19,15),new R(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new $(30,new R(5,115),new R(10,116)),new $(28,new R(19,47),new R(10,48)),new $(30,new R(15,24),new R(25,25)),new $(30,new R(23,15),new R(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new $(30,new R(13,115),new R(3,116)),new $(28,new R(2,46),new R(29,47)),new $(30,new R(42,24),new R(1,25)),new $(30,new R(23,15),new R(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new $(30,new R(17,115)),new $(28,new R(10,46),new R(23,47)),new $(30,new R(10,24),new R(35,25)),new $(30,new R(19,15),new R(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new $(30,new R(17,115),new R(1,116)),new $(28,new R(14,46),new R(21,47)),new $(30,new R(29,24),new R(19,25)),new $(30,new R(11,15),new R(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new $(30,new R(13,115),new R(6,116)),new $(28,new R(14,46),new R(23,47)),new $(30,new R(44,24),new R(7,25)),new $(30,new R(59,16),new R(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new $(30,new R(12,121),new R(7,122)),new $(28,new R(12,47),new R(26,48)),new $(30,new R(39,24),new R(14,25)),new $(30,new R(22,15),new R(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new $(30,new R(6,121),new R(14,122)),new $(28,new R(6,47),new R(34,48)),new $(30,new R(46,24),new R(10,25)),new $(30,new R(2,15),new R(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new $(30,new R(17,122),new R(4,123)),new $(28,new R(29,46),new R(14,47)),new $(30,new R(49,24),new R(10,25)),new $(30,new R(24,15),new R(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new $(30,new R(4,122),new R(18,123)),new $(28,new R(13,46),new R(32,47)),new $(30,new R(48,24),new R(14,25)),new $(30,new R(42,15),new R(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new $(30,new R(20,117),new R(4,118)),new $(28,new R(40,47),new R(7,48)),new $(30,new R(43,24),new R(22,25)),new $(30,new R(10,15),new R(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new $(30,new R(19,118),new R(6,119)),new $(28,new R(18,47),new R(31,48)),new $(30,new R(34,24),new R(34,25)),new $(30,new R(20,15),new R(61,16)))];var At;(function(y){y[y.DATA_MASK_000=0]="DATA_MASK_000",y[y.DATA_MASK_001=1]="DATA_MASK_001",y[y.DATA_MASK_010=2]="DATA_MASK_010",y[y.DATA_MASK_011=3]="DATA_MASK_011",y[y.DATA_MASK_100=4]="DATA_MASK_100",y[y.DATA_MASK_101=5]="DATA_MASK_101",y[y.DATA_MASK_110=6]="DATA_MASK_110",y[y.DATA_MASK_111=7]="DATA_MASK_111"})(At||(At={}));class br{constructor(r,i){this.value=r,this.isMasked=i}unmaskBitMatrix(r,i){for(let s=0;s<i;s++)for(let a=0;a<i;a++)this.isMasked(s,a)&&r.flip(a,s)}}br.values=new Map([[At.DATA_MASK_000,new br(At.DATA_MASK_000,(y,r)=>(y+r&1)===0)],[At.DATA_MASK_001,new br(At.DATA_MASK_001,(y,r)=>(y&1)===0)],[At.DATA_MASK_010,new br(At.DATA_MASK_010,(y,r)=>r%3===0)],[At.DATA_MASK_011,new br(At.DATA_MASK_011,(y,r)=>(y+r)%3===0)],[At.DATA_MASK_100,new br(At.DATA_MASK_100,(y,r)=>(Math.floor(y/2)+Math.floor(r/3)&1)===0)],[At.DATA_MASK_101,new br(At.DATA_MASK_101,(y,r)=>y*r%6===0)],[At.DATA_MASK_110,new br(At.DATA_MASK_110,(y,r)=>y*r%6<3)],[At.DATA_MASK_111,new br(At.DATA_MASK_111,(y,r)=>(y+r+y*r%3&1)===0)]]);class d3{constructor(r){const i=r.getHeight();if(i<21||(i&3)!==1)throw new F;this.bitMatrix=r}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let r=0;for(let l=0;l<6;l++)r=this.copyBit(l,8,r);r=this.copyBit(7,8,r),r=this.copyBit(8,8,r),r=this.copyBit(8,7,r);for(let l=5;l>=0;l--)r=this.copyBit(8,l,r);const i=this.bitMatrix.getHeight();let s=0;const a=i-7;for(let l=i-1;l>=a;l--)s=this.copyBit(8,l,s);for(let l=i-8;l<i;l++)s=this.copyBit(l,8,s);if(this.parsedFormatInfo=Ut.decodeFormatInformation(r,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const r=this.bitMatrix.getHeight(),i=Math.floor((r-17)/4);if(i<=6)return ue.getVersionForNumber(i);let s=0;const a=r-11;for(let f=5;f>=0;f--)for(let d=r-9;d>=a;d--)s=this.copyBit(d,f,s);let l=ue.decodeVersionInformation(s);if(l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;s=0;for(let f=5;f>=0;f--)for(let d=r-9;d>=a;d--)s=this.copyBit(f,d,s);if(l=ue.decodeVersionInformation(s),l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;throw new F}copyBit(r,i,s){return(this.isMirror?this.bitMatrix.get(i,r):this.bitMatrix.get(r,i))?s<<1|1:s<<1}readCodewords(){const r=this.readFormatInformation(),i=this.readVersion(),s=br.values.get(r.getDataMask()),a=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,a);const l=i.buildFunctionPattern();let f=!0;const d=new Uint8Array(i.getTotalCodewords());let h=0,p=0,v=0;for(let E=a-1;E>0;E-=2){E===6&&E--;for(let S=0;S<a;S++){const _=f?a-1-S:S;for(let D=0;D<2;D++)l.get(E-D,_)||(v++,p<<=1,this.bitMatrix.get(E-D,_)&&(p|=1),v===8&&(d[h++]=p,v=0,p=0))}f=!f}if(h!==i.getTotalCodewords())throw new F;return d}remask(){if(this.parsedFormatInfo===null)return;const r=br.values[this.parsedFormatInfo.getDataMask()],i=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,i)}setMirror(r){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=r}mirror(){const r=this.bitMatrix;for(let i=0,s=r.getWidth();i<s;i++)for(let a=i+1,l=r.getHeight();a<l;a++)r.get(i,a)!==r.get(a,i)&&(r.flip(a,i),r.flip(i,a))}}class cu{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i,s){if(r.length!==i.getTotalCodewords())throw new b;const a=i.getECBlocksForLevel(s);let l=0;const f=a.getECBlocks();for(const D of f)l+=D.getCount();const d=new Array(l);let h=0;for(const D of f)for(let P=0;P<D.getCount();P++){const W=D.getDataCodewords(),H=a.getECCodewordsPerBlock()+W;d[h++]=new cu(W,new Uint8Array(H))}const p=d[0].codewords.length;let v=d.length-1;for(;v>=0&&d[v].codewords.length!==p;)v--;v++;const E=p-a.getECCodewordsPerBlock();let S=0;for(let D=0;D<E;D++)for(let P=0;P<h;P++)d[P].codewords[D]=r[S++];for(let D=v;D<h;D++)d[D].codewords[E]=r[S++];const _=d[0].codewords.length;for(let D=E;D<_;D++)for(let P=0;P<h;P++){const W=P<v?D:D+1;d[P].codewords[W]=r[S++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var Ar;(function(y){y[y.TERMINATOR=0]="TERMINATOR",y[y.NUMERIC=1]="NUMERIC",y[y.ALPHANUMERIC=2]="ALPHANUMERIC",y[y.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",y[y.BYTE=4]="BYTE",y[y.ECI=5]="ECI",y[y.KANJI=6]="KANJI",y[y.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",y[y.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",y[y.HANZI=9]="HANZI"})(Ar||(Ar={}));class fe{constructor(r,i,s,a){this.value=r,this.stringValue=i,this.characterCountBitsForVersions=s,this.bits=a,fe.FOR_BITS.set(a,this),fe.FOR_VALUE.set(r,this)}static forBits(r){const i=fe.FOR_BITS.get(r);if(i===void 0)throw new b;return i}getCharacterCountBits(r){const i=r.getVersionNumber();let s;return i<=9?s=0:i<=26?s=1:s=2,this.characterCountBitsForVersions[s]}getValue(){return this.value}getBits(){return this.bits}equals(r){if(!(r instanceof fe))return!1;const i=r;return this.value===i.value}toString(){return this.stringValue}}fe.FOR_BITS=new Map,fe.FOR_VALUE=new Map,fe.TERMINATOR=new fe(Ar.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),fe.NUMERIC=new fe(Ar.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),fe.ALPHANUMERIC=new fe(Ar.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),fe.STRUCTURED_APPEND=new fe(Ar.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),fe.BYTE=new fe(Ar.BYTE,"BYTE",Int32Array.from([8,16,16]),4),fe.ECI=new fe(Ar.ECI,"ECI",Int32Array.from([0,0,0]),7),fe.KANJI=new fe(Ar.KANJI,"KANJI",Int32Array.from([8,10,12]),8),fe.FNC1_FIRST_POSITION=new fe(Ar.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),fe.FNC1_SECOND_POSITION=new fe(Ar.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),fe.HANZI=new fe(Ar.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Qe{static decode(r,i,s,a){const l=new lu(r);let f=new pe;const d=new Array;let h=-1,p=-1;try{let v=null,E=!1,S;do{if(l.available()<4)S=fe.TERMINATOR;else{const _=l.readBits(4);S=fe.forBits(_)}switch(S){case fe.TERMINATOR:break;case fe.FNC1_FIRST_POSITION:case fe.FNC1_SECOND_POSITION:E=!0;break;case fe.STRUCTURED_APPEND:if(l.available()<16)throw new F;h=l.readBits(8),p=l.readBits(8);break;case fe.ECI:const _=Qe.parseECIValue(l);if(v=z.getCharacterSetECIByValue(_),v===null)throw new F;break;case fe.HANZI:const D=l.readBits(4),P=l.readBits(S.getCharacterCountBits(i));D===Qe.GB2312_SUBSET&&Qe.decodeHanziSegment(l,f,P);break;default:const W=l.readBits(S.getCharacterCountBits(i));switch(S){case fe.NUMERIC:Qe.decodeNumericSegment(l,f,W);break;case fe.ALPHANUMERIC:Qe.decodeAlphanumericSegment(l,f,W,E);break;case fe.BYTE:Qe.decodeByteSegment(l,f,W,v,d,a);break;case fe.KANJI:Qe.decodeKanjiSegment(l,f,W);break;default:throw new F}break}}while(S!==fe.TERMINATOR)}catch{throw new F}return new Bs(r,f.toString(),d.length===0?null:d,s===null?null:s.toString(),h,p)}static decodeHanziSegment(r,i,s){if(s*13>r.available())throw new F;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const f=r.readBits(13);let d=f/96<<8&4294967295|f%96;d<959?d+=41377:d+=42657,a[l]=d>>8&255,a[l+1]=d&255,l+=2,s--}try{i.append(ve.decode(a,ie.GB2312))}catch(f){throw new F(f)}}static decodeKanjiSegment(r,i,s){if(s*13>r.available())throw new F;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const f=r.readBits(13);let d=f/192<<8&4294967295|f%192;d<7936?d+=33088:d+=49472,a[l]=d>>8,a[l+1]=d,l+=2,s--}try{i.append(ve.decode(a,ie.SHIFT_JIS))}catch(f){throw new F(f)}}static decodeByteSegment(r,i,s,a,l,f){if(8*s>r.available())throw new F;const d=new Uint8Array(s);for(let p=0;p<s;p++)d[p]=r.readBits(8);let h;a===null?h=ie.guessEncoding(d,f):h=a.getName();try{i.append(ve.decode(d,h))}catch(p){throw new F(p)}l.push(d)}static toAlphaNumericChar(r){if(r>=Qe.ALPHANUMERIC_CHARS.length)throw new F;return Qe.ALPHANUMERIC_CHARS[r]}static decodeAlphanumericSegment(r,i,s,a){const l=i.length();for(;s>1;){if(r.available()<11)throw new F;const f=r.readBits(11);i.append(Qe.toAlphaNumericChar(Math.floor(f/45))),i.append(Qe.toAlphaNumericChar(f%45)),s-=2}if(s===1){if(r.available()<6)throw new F;i.append(Qe.toAlphaNumericChar(r.readBits(6)))}if(a)for(let f=l;f<i.length();f++)i.charAt(f)==="%"&&(f<i.length()-1&&i.charAt(f+1)==="%"?i.deleteCharAt(f+1):i.setCharAt(f,""))}static decodeNumericSegment(r,i,s){for(;s>=3;){if(r.available()<10)throw new F;const a=r.readBits(10);if(a>=1e3)throw new F;i.append(Qe.toAlphaNumericChar(Math.floor(a/100))),i.append(Qe.toAlphaNumericChar(Math.floor(a/10)%10)),i.append(Qe.toAlphaNumericChar(a%10)),s-=3}if(s===2){if(r.available()<7)throw new F;const a=r.readBits(7);if(a>=100)throw new F;i.append(Qe.toAlphaNumericChar(Math.floor(a/10))),i.append(Qe.toAlphaNumericChar(a%10))}else if(s===1){if(r.available()<4)throw new F;const a=r.readBits(4);if(a>=10)throw new F;i.append(Qe.toAlphaNumericChar(a))}}static parseECIValue(r){const i=r.readBits(8);if(!(i&128))return i&127;if((i&192)===128){const s=r.readBits(8);return(i&63)<<8&4294967295|s}if((i&224)===192){const s=r.readBits(16);return(i&31)<<16&4294967295|s}throw new F}}Qe.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Qe.GB2312_SUBSET=1;class q0{constructor(r){this.mirrored=r}isMirrored(){return this.mirrored}applyMirroredCorrection(r){if(!this.mirrored||r===null||r.length<3)return;const i=r[0];r[0]=r[2],r[2]=i}}class h3{constructor(){this.rsDecoder=new Us(Ne.QR_CODE_FIELD_256)}decodeBooleanArray(r,i){return this.decodeBitMatrix(Te.parseFromBooleanArray(r),i)}decodeBitMatrix(r,i){const s=new d3(r);let a=null;try{return this.decodeBitMatrixParser(s,i)}catch(l){a=l}try{s.remask(),s.setMirror(!0),s.readVersion(),s.readFormatInformation(),s.mirror();const l=this.decodeBitMatrixParser(s,i);return l.setOther(new q0(!0)),l}catch(l){throw a!==null?a:l}}decodeBitMatrixParser(r,i){const s=r.readVersion(),a=r.readFormatInformation().getErrorCorrectionLevel(),l=r.readCodewords(),f=cu.getDataBlocks(l,s,a);let d=0;for(const v of f)d+=v.getNumDataCodewords();const h=new Uint8Array(d);let p=0;for(const v of f){const E=v.getCodewords(),S=v.getNumDataCodewords();this.correctErrors(E,S);for(let _=0;_<S;_++)h[p++]=E[_]}return Qe.decode(h,s,a,i)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new T}for(let a=0;a<i;a++)r[a]=s[a]}}class uu extends ae{constructor(r,i,s){super(r,i),this.estimatedModuleSize=s}aboutEquals(r,i,s){if(Math.abs(i-this.getY())<=r&&Math.abs(s-this.getX())<=r){const a=Math.abs(r-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1}combineEstimate(r,i,s){const a=(this.getX()+i)/2,l=(this.getY()+r)/2,f=(this.estimatedModuleSize+s)/2;return new uu(a,l,f)}}class Ca{constructor(r,i,s,a,l,f,d){this.image=r,this.startX=i,this.startY=s,this.width=a,this.height=l,this.moduleSize=f,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const r=this.startX,i=this.height,s=this.width,a=r+s,l=this.startY+i/2,f=new Int32Array(3),d=this.image;for(let h=0;h<i;h++){const p=l+(h&1?-Math.floor((h+1)/2):Math.floor((h+1)/2));f[0]=0,f[1]=0,f[2]=0;let v=r;for(;v<a&&!d.get(v,p);)v++;let E=0;for(;v<a;){if(d.get(v,p))if(E===1)f[1]++;else if(E===2){if(this.foundPatternCross(f)){const S=this.handlePossibleCenter(f,p,v);if(S!==null)return S}f[0]=f[2],f[1]=1,f[2]=0,E=1}else f[++E]++;else E===1&&E++,f[E]++;v++}if(this.foundPatternCross(f)){const S=this.handlePossibleCenter(f,p,a);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new X}static centerFromEnd(r,i){return i-r[2]-r[1]/2}foundPatternCross(r){const i=this.moduleSize,s=i/2;for(let a=0;a<3;a++)if(Math.abs(i-r[a])>=s)return!1;return!0}crossCheckVertical(r,i,s,a){const l=this.image,f=l.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let h=r;for(;h>=0&&l.get(i,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&!l.get(i,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=r+1;h<f&&l.get(i,h)&&d[1]<=s;)d[1]++,h++;if(h===f||d[1]>s)return NaN;for(;h<f&&!l.get(i,h)&&d[2]<=s;)d[2]++,h++;if(d[2]>s)return NaN;const p=d[0]+d[1]+d[2];return 5*Math.abs(p-a)>=2*a?NaN:this.foundPatternCross(d)?Ca.centerFromEnd(d,h):NaN}handlePossibleCenter(r,i,s){const a=r[0]+r[1]+r[2],l=Ca.centerFromEnd(r,s),f=this.crossCheckVertical(i,l,2*r[1],a);if(!isNaN(f)){const d=(r[0]+r[1]+r[2])/3;for(const p of this.possibleCenters)if(p.aboutEquals(d,f,l))return p.combineEstimate(f,l,d);const h=new uu(l,f,d);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null}}class fu extends ae{constructor(r,i,s,a){super(r,i),this.estimatedModuleSize=s,this.count=a,a===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(r,i,s){if(Math.abs(i-this.getY())<=r&&Math.abs(s-this.getX())<=r){const a=Math.abs(r-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1}combineEstimate(r,i,s){const a=this.count+1,l=(this.count*this.getX()+i)/a,f=(this.count*this.getY()+r)/a,d=(this.count*this.estimatedModuleSize+s)/a;return new fu(l,f,d,a)}}class g3{constructor(r){this.bottomLeft=r[0],this.topLeft=r[1],this.topRight=r[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class St{constructor(r,i){this.image=r,this.resultPointCallback=i,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=i}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(r){const i=r!=null&&r.get(U.TRY_HARDER)!==void 0,s=r!=null&&r.get(U.PURE_BARCODE)!==void 0,a=this.image,l=a.getHeight(),f=a.getWidth();let d=Math.floor(3*l/(4*St.MAX_MODULES));(d<St.MIN_SKIP||i)&&(d=St.MIN_SKIP);let h=!1;const p=new Int32Array(5);for(let E=d-1;E<l&&!h;E+=d){p[0]=0,p[1]=0,p[2]=0,p[3]=0,p[4]=0;let S=0;for(let _=0;_<f;_++)if(a.get(_,E))(S&1)===1&&S++,p[S]++;else if(S&1)p[S]++;else if(S===4)if(St.foundPatternCross(p)){if(this.handlePossibleCenter(p,E,_,s)===!0)if(d=2,this.hasSkipped===!0)h=this.haveMultiplyConfirmedCenters();else{const P=this.findRowSkip();P>p[2]&&(E+=P-p[2]-d,_=f-1)}else{p[0]=p[2],p[1]=p[3],p[2]=p[4],p[3]=1,p[4]=0,S=3;continue}S=0,p[0]=0,p[1]=0,p[2]=0,p[3]=0,p[4]=0}else p[0]=p[2],p[1]=p[3],p[2]=p[4],p[3]=1,p[4]=0,S=3;else p[++S]++;St.foundPatternCross(p)&&this.handlePossibleCenter(p,E,f,s)===!0&&(d=p[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}const v=this.selectBestPatterns();return ae.orderBestPatterns(v),new g3(v)}static centerFromEnd(r,i){return i-r[4]-r[3]-r[2]/2}static foundPatternCross(r){let i=0;for(let l=0;l<5;l++){const f=r[l];if(f===0)return!1;i+=f}if(i<7)return!1;const s=i/7,a=s/2;return Math.abs(s-r[0])<a&&Math.abs(s-r[1])<a&&Math.abs(3*s-r[2])<3*a&&Math.abs(s-r[3])<a&&Math.abs(s-r[4])<a}getCrossCheckStateCount(){const r=this.crossCheckStateCount;return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r}crossCheckDiagonal(r,i,s,a){const l=this.getCrossCheckStateCount();let f=0;const d=this.image;for(;r>=f&&i>=f&&d.get(i-f,r-f);)l[2]++,f++;if(r<f||i<f)return!1;for(;r>=f&&i>=f&&!d.get(i-f,r-f)&&l[1]<=s;)l[1]++,f++;if(r<f||i<f||l[1]>s)return!1;for(;r>=f&&i>=f&&d.get(i-f,r-f)&&l[0]<=s;)l[0]++,f++;if(l[0]>s)return!1;const h=d.getHeight(),p=d.getWidth();for(f=1;r+f<h&&i+f<p&&d.get(i+f,r+f);)l[2]++,f++;if(r+f>=h||i+f>=p)return!1;for(;r+f<h&&i+f<p&&!d.get(i+f,r+f)&&l[3]<s;)l[3]++,f++;if(r+f>=h||i+f>=p||l[3]>=s)return!1;for(;r+f<h&&i+f<p&&d.get(i+f,r+f)&&l[4]<s;)l[4]++,f++;if(l[4]>=s)return!1;const v=l[0]+l[1]+l[2]+l[3]+l[4];return Math.abs(v-a)<2*a&&St.foundPatternCross(l)}crossCheckVertical(r,i,s,a){const l=this.image,f=l.getHeight(),d=this.getCrossCheckStateCount();let h=r;for(;h>=0&&l.get(i,h);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!l.get(i,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&l.get(i,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=r+1;h<f&&l.get(i,h);)d[2]++,h++;if(h===f)return NaN;for(;h<f&&!l.get(i,h)&&d[3]<s;)d[3]++,h++;if(h===f||d[3]>=s)return NaN;for(;h<f&&l.get(i,h)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const p=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(p-a)>=2*a?NaN:St.foundPatternCross(d)?St.centerFromEnd(d,h):NaN}crossCheckHorizontal(r,i,s,a){const l=this.image,f=l.getWidth(),d=this.getCrossCheckStateCount();let h=r;for(;h>=0&&l.get(h,i);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!l.get(h,i)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&l.get(h,i)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=r+1;h<f&&l.get(h,i);)d[2]++,h++;if(h===f)return NaN;for(;h<f&&!l.get(h,i)&&d[3]<s;)d[3]++,h++;if(h===f||d[3]>=s)return NaN;for(;h<f&&l.get(h,i)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const p=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(p-a)>=a?NaN:St.foundPatternCross(d)?St.centerFromEnd(d,h):NaN}handlePossibleCenter(r,i,s,a){const l=r[0]+r[1]+r[2]+r[3]+r[4];let f=St.centerFromEnd(r,s),d=this.crossCheckVertical(i,Math.floor(f),r[2],l);if(!isNaN(d)&&(f=this.crossCheckHorizontal(Math.floor(f),Math.floor(d),r[2],l),!isNaN(f)&&(!a||this.crossCheckDiagonal(Math.floor(d),Math.floor(f),r[2],l)))){const h=l/7;let p=!1;const v=this.possibleCenters;for(let E=0,S=v.length;E<S;E++){const _=v[E];if(_.aboutEquals(h,d,f)){v[E]=_.combineEstimate(d,f,h),p=!0;break}}if(!p){const E=new fu(f,d,h);v.push(E),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(E)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let i=null;for(const s of this.possibleCenters)if(s.getCount()>=St.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let r=0,i=0;const s=this.possibleCenters.length;for(const f of this.possibleCenters)f.getCount()>=St.CENTER_QUORUM&&(r++,i+=f.getEstimatedModuleSize());if(r<3)return!1;const a=i/s;let l=0;for(const f of this.possibleCenters)l+=Math.abs(f.getEstimatedModuleSize()-a);return l<=.05*i}selectBestPatterns(){const r=this.possibleCenters.length;if(r<3)throw new X;const i=this.possibleCenters;let s;if(r>3){let a=0,l=0;for(const h of this.possibleCenters){const p=h.getEstimatedModuleSize();a+=p,l+=p*p}s=a/r;let f=Math.sqrt(l/r-s*s);i.sort((h,p)=>{const v=Math.abs(p.getEstimatedModuleSize()-s),E=Math.abs(h.getEstimatedModuleSize()-s);return v<E?-1:v>E?1:0});const d=Math.max(.2*s,f);for(let h=0;h<i.length&&i.length>3;h++){const p=i[h];Math.abs(p.getEstimatedModuleSize()-s)>d&&(i.splice(h,1),h--)}}if(i.length>3){let a=0;for(const l of i)a+=l.getEstimatedModuleSize();s=a/i.length,i.sort((l,f)=>{if(f.getCount()===l.getCount()){const d=Math.abs(f.getEstimatedModuleSize()-s),h=Math.abs(l.getEstimatedModuleSize()-s);return d<h?1:d>h?-1:0}else return f.getCount()-l.getCount()}),i.splice(3)}return[i[0],i[1],i[2]]}}St.CENTER_QUORUM=2,St.MIN_SKIP=3,St.MAX_MODULES=57;class Ws{constructor(r){this.image=r}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(r){this.resultPointCallback=r==null?null:r.get(U.NEED_RESULT_POINT_CALLBACK);const s=new St(this.image,this.resultPointCallback).find(r);return this.processFinderPatternInfo(s)}processFinderPatternInfo(r){const i=r.getTopLeft(),s=r.getTopRight(),a=r.getBottomLeft(),l=this.calculateModuleSize(i,s,a);if(l<1)throw new X("No pattern found in proccess finder.");const f=Ws.computeDimension(i,s,a,l),d=ue.getProvisionalVersionForDimension(f),h=d.getDimensionForVersion()-7;let p=null;if(d.getAlignmentPatternCenters().length>0){const _=s.getX()-i.getX()+a.getX(),D=s.getY()-i.getY()+a.getY(),P=1-3/h,W=Math.floor(i.getX()+P*(_-i.getX())),H=Math.floor(i.getY()+P*(D-i.getY()));for(let q=4;q<=16;q<<=1)try{p=this.findAlignmentInRegion(l,W,H,q);break}catch(J){if(!(J instanceof X))throw J}}const v=Ws.createTransform(i,s,a,p,f),E=Ws.sampleGrid(this.image,v,f);let S;return p===null?S=[a,i,s]:S=[a,i,s,p],new xa(E,S)}static createTransform(r,i,s,a,l){const f=l-3.5;let d,h,p,v;return a!==null?(d=a.getX(),h=a.getY(),p=f-3,v=p):(d=i.getX()-r.getX()+s.getX(),h=i.getY()-r.getY()+s.getY(),p=f,v=f),kr.quadrilateralToQuadrilateral(3.5,3.5,f,3.5,p,v,3.5,f,r.getX(),r.getY(),i.getX(),i.getY(),d,h,s.getX(),s.getY())}static sampleGrid(r,i,s){return _n.getInstance().sampleGridWithTransform(r,s,s,i)}static computeDimension(r,i,s,a){const l=Re.round(ae.distance(r,i)/a),f=Re.round(ae.distance(r,s)/a);let d=Math.floor((l+f)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new X("Dimensions could be not found.")}return d}calculateModuleSize(r,i,s){return(this.calculateModuleSizeOneWay(r,i)+this.calculateModuleSizeOneWay(r,s))/2}calculateModuleSizeOneWay(r,i){const s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(r.getX()),Math.floor(r.getY()),Math.floor(i.getX()),Math.floor(i.getY())),a=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(i.getX()),Math.floor(i.getY()),Math.floor(r.getX()),Math.floor(r.getY()));return isNaN(s)?a/7:isNaN(a)?s/7:(s+a)/14}sizeOfBlackWhiteBlackRunBothWays(r,i,s,a){let l=this.sizeOfBlackWhiteBlackRun(r,i,s,a),f=1,d=r-(s-r);d<0?(f=r/(r-d),d=0):d>=this.image.getWidth()&&(f=(this.image.getWidth()-1-r)/(d-r),d=this.image.getWidth()-1);let h=Math.floor(i-(a-i)*f);return f=1,h<0?(f=i/(i-h),h=0):h>=this.image.getHeight()&&(f=(this.image.getHeight()-1-i)/(h-i),h=this.image.getHeight()-1),d=Math.floor(r+(d-r)*f),l+=this.sizeOfBlackWhiteBlackRun(r,i,d,h),l-1}sizeOfBlackWhiteBlackRun(r,i,s,a){const l=Math.abs(a-i)>Math.abs(s-r);if(l){let _=r;r=i,i=_,_=s,s=a,a=_}const f=Math.abs(s-r),d=Math.abs(a-i);let h=-f/2;const p=r<s?1:-1,v=i<a?1:-1;let E=0;const S=s+p;for(let _=r,D=i;_!==S;_+=p){const P=l?D:_,W=l?_:D;if(E===1===this.image.get(P,W)){if(E===2)return Re.distance(_,D,r,i);E++}if(h+=d,h>0){if(D===a)break;D+=v,h-=f}}return E===2?Re.distance(s+p,a,r,i):NaN}findAlignmentInRegion(r,i,s,a){const l=Math.floor(a*r),f=Math.max(0,i-l),d=Math.min(this.image.getWidth()-1,i+l);if(d-f<r*3)throw new X("Alignment top exceeds estimated module size.");const h=Math.max(0,s-l),p=Math.min(this.image.getHeight()-1,s+l);if(p-h<r*3)throw new X("Alignment bottom exceeds estimated module size.");return new Ca(this.image,f,h,d-f,p-h,r,this.resultPointCallback).find()}}class Mn{constructor(){this.decoder=new h3}getDecoder(){return this.decoder}decode(r,i){let s,a;if(i!=null&&i.get(U.PURE_BARCODE)!==void 0){const h=Mn.extractPureBits(r.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,i),a=Mn.NO_POINTS}else{const h=new Ws(r.getBlackMatrix()).detect(i);s=this.decoder.decodeBitMatrix(h.getBits(),i),a=h.getPoints()}s.getOther()instanceof q0&&s.getOther().applyMirroredCorrection(a);const l=new Ze(s.getText(),s.getRawBytes(),void 0,a,le.QR_CODE,void 0),f=s.getByteSegments();f!==null&&l.putMetadata(bt.BYTE_SEGMENTS,f);const d=s.getECLevel();return d!==null&&l.putMetadata(bt.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(l.putMetadata(bt.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),l.putMetadata(bt.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),l}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i===null||s===null)throw new X;const a=this.moduleSize(i,r);let l=i[1],f=s[1],d=i[0],h=s[0];if(d>=h||l>=f)throw new X;if(f-l!==h-d&&(h=d+(f-l),h>=r.getWidth()))throw new X;const p=Math.round((h-d+1)/a),v=Math.round((f-l+1)/a);if(p<=0||v<=0)throw new X;if(v!==p)throw new X;const E=Math.floor(a/2);l+=E,d+=E;const S=d+Math.floor((p-1)*a)-h;if(S>0){if(S>E)throw new X;d-=S}const _=l+Math.floor((v-1)*a)-f;if(_>0){if(_>E)throw new X;l-=_}const D=new Te(p,v);for(let P=0;P<v;P++){const W=l+Math.floor(P*a);for(let H=0;H<p;H++)r.get(d+Math.floor(H*a),W)&&D.set(H,P)}return D}static moduleSize(r,i){const s=i.getHeight(),a=i.getWidth();let l=r[0],f=r[1],d=!0,h=0;for(;l<a&&f<s;){if(d!==i.get(l,f)){if(++h===5)break;d=!d}l++,f++}if(l===a||f===s)throw new X;return(l-r[0])/7}}Mn.NO_POINTS=new Array;class ge{PDF417Common(){}static getBitCountSum(r){return Re.sum(r)}static toIntArray(r){if(r==null||!r.length)return ge.EMPTY_INT_ARRAY;const i=new Int32Array(r.length);let s=0;for(const a of r)i[s++]=a;return i}static getCodeword(r){const i=I.binarySearch(ge.SYMBOL_TABLE,r&262143);return i<0?-1:(ge.CODEWORD_TABLE[i]-1)%ge.NUMBER_OF_CODEWORDS}}ge.NUMBER_OF_CODEWORDS=929,ge.MAX_CODEWORDS_IN_BARCODE=ge.NUMBER_OF_CODEWORDS-1,ge.MIN_ROWS_IN_BARCODE=3,ge.MAX_ROWS_IN_BARCODE=90,ge.MODULES_IN_CODEWORD=17,ge.MODULES_IN_STOP_PATTERN=18,ge.BARS_IN_MODULE=8,ge.EMPTY_INT_ARRAY=new Int32Array([]),ge.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),ge.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class p3{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class ye{static detectMultiple(r,i,s){let a=r.getBlackMatrix(),l=ye.detect(s,a);return l.length||(a=a.clone(),a.rotate180(),l=ye.detect(s,a)),new p3(a,l)}static detect(r,i){const s=new Array;let a=0,l=0,f=!1;for(;a<i.getHeight();){const d=ye.findVertices(i,a,l);if(d[0]==null&&d[3]==null){if(!f)break;f=!1,l=0;for(const h of s)h[1]!=null&&(a=Math.trunc(Math.max(a,h[1].getY()))),h[3]!=null&&(a=Math.max(a,Math.trunc(h[3].getY())));a+=ye.ROW_STEP;continue}if(f=!0,s.push(d),!r)break;d[2]!=null?(l=Math.trunc(d[2].getX()),a=Math.trunc(d[2].getY())):(l=Math.trunc(d[4].getX()),a=Math.trunc(d[4].getY()))}return s}static findVertices(r,i,s){const a=r.getHeight(),l=r.getWidth(),f=new Array(8);return ye.copyToResult(f,ye.findRowsWithPattern(r,a,l,i,s,ye.START_PATTERN),ye.INDEXES_START_PATTERN),f[4]!=null&&(s=Math.trunc(f[4].getX()),i=Math.trunc(f[4].getY())),ye.copyToResult(f,ye.findRowsWithPattern(r,a,l,i,s,ye.STOP_PATTERN),ye.INDEXES_STOP_PATTERN),f}static copyToResult(r,i,s){for(let a=0;a<s.length;a++)r[s[a]]=i[a]}static findRowsWithPattern(r,i,s,a,l,f){const d=new Array(4);let h=!1;const p=new Int32Array(f.length);for(;a<i;a+=ye.ROW_STEP){let E=ye.findGuardPattern(r,l,a,s,!1,f,p);if(E!=null){for(;a>0;){const S=ye.findGuardPattern(r,l,--a,s,!1,f,p);if(S!=null)E=S;else{a++;break}}d[0]=new ae(E[0],a),d[1]=new ae(E[1],a),h=!0;break}}let v=a+1;if(h){let E=0,S=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;v<i;v++){const _=ye.findGuardPattern(r,S[0],v,s,!1,f,p);if(_!=null&&Math.abs(S[0]-_[0])<ye.MAX_PATTERN_DRIFT&&Math.abs(S[1]-_[1])<ye.MAX_PATTERN_DRIFT)S=_,E=0;else{if(E>ye.SKIPPED_ROW_COUNT_MAX)break;E++}}v-=E+1,d[2]=new ae(S[0],v),d[3]=new ae(S[1],v)}return v-a<ye.BARCODE_MIN_HEIGHT&&I.fill(d,null),d}static findGuardPattern(r,i,s,a,l,f,d){I.fillWithin(d,0,d.length,0);let h=i,p=0;for(;r.get(h,s)&&h>0&&p++<ye.MAX_PIXEL_DRIFT;)h--;let v=h,E=0,S=f.length;for(let _=l;v<a;v++)if(r.get(v,s)!==_)d[E]++;else{if(E===S-1){if(ye.patternMatchVariance(d,f,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE)return new Int32Array([h,v]);h+=d[0]+d[1],M.arraycopy(d,2,d,0,E-1),d[E-1]=0,d[E]=0,E--}else E++;d[E]=1,_=!_}return E===S-1&&ye.patternMatchVariance(d,f,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE?new Int32Array([h,v-1]):null}static patternMatchVariance(r,i,s){let a=r.length,l=0,f=0;for(let p=0;p<a;p++)l+=r[p],f+=i[p];if(l<f)return 1/0;let d=l/f;s*=d;let h=0;for(let p=0;p<a;p++){let v=r[p],E=i[p]*d,S=v>E?v-E:E-v;if(S>s)return 1/0;h+=S}return h/l}}ye.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ye.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ye.MAX_AVG_VARIANCE=.42,ye.MAX_INDIVIDUAL_VARIANCE=.8,ye.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ye.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ye.MAX_PIXEL_DRIFT=3,ye.MAX_PATTERN_DRIFT=5,ye.SKIPPED_ROW_COUNT_MAX=25,ye.ROW_STEP=5,ye.BARCODE_MIN_HEIGHT=10;class Ot{constructor(r,i){if(i.length===0)throw new b;this.field=r;let s=i.length;if(s>1&&i[0]===0){let a=1;for(;a<s&&i[a]===0;)a++;a===s?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(s-a),M.arraycopy(i,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=i}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(r){return this.coefficients[this.coefficients.length-1-r]}evaluateAt(r){if(r===0)return this.getCoefficient(0);if(r===1){let a=0;for(let l of this.coefficients)a=this.field.add(a,l);return a}let i=this.coefficients[0],s=this.coefficients.length;for(let a=1;a<s;a++)i=this.field.add(this.field.multiply(r,i),this.coefficients[a]);return i}add(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");if(this.isZero())return r;if(r.isZero())return this;let i=this.coefficients,s=r.coefficients;if(i.length>s.length){let f=i;i=s,s=f}let a=new Int32Array(s.length),l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let f=l;f<s.length;f++)a[f]=this.field.add(i[f-l],s[f]);return new Ot(this.field,a)}subtract(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");return r.isZero()?this:this.add(r.negative())}multiply(r){return r instanceof Ot?this.multiplyOther(r):this.multiplyScalar(r)}multiplyOther(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");if(this.isZero()||r.isZero())return new Ot(this.field,new Int32Array([0]));let i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,f=new Int32Array(s+l-1);for(let d=0;d<s;d++){let h=i[d];for(let p=0;p<l;p++)f[d+p]=this.field.add(f[d+p],this.field.multiply(h,a[p]))}return new Ot(this.field,f)}negative(){let r=this.coefficients.length,i=new Int32Array(r);for(let s=0;s<r;s++)i[s]=this.field.subtract(0,this.coefficients[s]);return new Ot(this.field,i)}multiplyScalar(r){if(r===0)return new Ot(this.field,new Int32Array([0]));if(r===1)return this;let i=this.coefficients.length,s=new Int32Array(i);for(let a=0;a<i;a++)s[a]=this.field.multiply(this.coefficients[a],r);return new Ot(this.field,s)}multiplyByMonomial(r,i){if(r<0)throw new b;if(i===0)return new Ot(this.field,new Int32Array([0]));let s=this.coefficients.length,a=new Int32Array(s+r);for(let l=0;l<s;l++)a[l]=this.field.multiply(this.coefficients[l],i);return new Ot(this.field,a)}toString(){let r=new pe;for(let i=this.getDegree();i>=0;i--){let s=this.getCoefficient(i);s!==0&&(s<0?(r.append(" - "),s=-s):r.length()>0&&r.append(" + "),(i===0||s!==1)&&r.append(s),i!==0&&(i===1?r.append("x"):(r.append("x^"),r.append(i))))}return r.toString()}}class m3{add(r,i){return(r+i)%this.modulus}subtract(r,i){return(this.modulus+r-i)%this.modulus}exp(r){return this.expTable[r]}log(r){if(r===0)throw new b;return this.logTable[r]}inverse(r){if(r===0)throw new pa;return this.expTable[this.modulus-this.logTable[r]-1]}multiply(r,i){return r===0||i===0?0:this.expTable[(this.logTable[r]+this.logTable[i])%(this.modulus-1)]}getSize(){return this.modulus}equals(r){return r===this}}class du extends m3{constructor(r,i){super(),this.modulus=r,this.expTable=new Int32Array(r),this.logTable=new Int32Array(r);let s=1;for(let a=0;a<r;a++)this.expTable[a]=s,s=s*i%r;for(let a=0;a<r-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new Ot(this,new Int32Array([0])),this.one=new Ot(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new b;if(i===0)return this.zero;let s=new Int32Array(r+1);return s[0]=i,new Ot(this,s)}}du.PDF417_GF=new du(ge.NUMBER_OF_CODEWORDS,3);class J0{constructor(){this.field=du.PDF417_GF}decode(r,i,s){let a=new Ot(this.field,r),l=new Int32Array(i),f=!1;for(let D=i;D>0;D--){let P=a.evaluateAt(this.field.exp(D));l[i-D]=P,P!==0&&(f=!0)}if(!f)return 0;let d=this.field.getOne();if(s!=null)for(const D of s){let P=this.field.exp(r.length-1-D),W=new Ot(this.field,new Int32Array([this.field.subtract(0,P),1]));d=d.multiply(W)}let h=new Ot(this.field,l),p=this.runEuclideanAlgorithm(this.field.buildMonomial(i,1),h,i),v=p[0],E=p[1],S=this.findErrorLocations(v),_=this.findErrorMagnitudes(E,v,S);for(let D=0;D<S.length;D++){let P=r.length-1-this.field.log(S[D]);if(P<0)throw T.getChecksumInstance();r[P]=this.field.subtract(r[P],_[D])}return S.length}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){let S=r;r=i,i=S}let a=r,l=i,f=this.field.getZero(),d=this.field.getOne();for(;l.getDegree()>=Math.round(s/2);){let S=a,_=f;if(a=l,f=d,a.isZero())throw T.getChecksumInstance();l=S;let D=this.field.getZero(),P=a.getCoefficient(a.getDegree()),W=this.field.inverse(P);for(;l.getDegree()>=a.getDegree()&&!l.isZero();){let H=l.getDegree()-a.getDegree(),q=this.field.multiply(l.getCoefficient(l.getDegree()),W);D=D.add(this.field.buildMonomial(H,q)),l=l.subtract(a.multiplyByMonomial(H,q))}d=D.multiply(f).subtract(_).negative()}let h=d.getCoefficient(0);if(h===0)throw T.getChecksumInstance();let p=this.field.inverse(h),v=d.multiply(p),E=l.multiply(p);return[v,E]}findErrorLocations(r){let i=r.getDegree(),s=new Int32Array(i),a=0;for(let l=1;l<this.field.getSize()&&a<i;l++)r.evaluateAt(l)===0&&(s[a]=this.field.inverse(l),a++);if(a!==i)throw T.getChecksumInstance();return s}findErrorMagnitudes(r,i,s){let a=i.getDegree(),l=new Int32Array(a);for(let p=1;p<=a;p++)l[a-p]=this.field.multiply(p,i.getCoefficient(p));let f=new Ot(this.field,l),d=s.length,h=new Int32Array(d);for(let p=0;p<d;p++){let v=this.field.inverse(s[p]),E=this.field.subtract(0,r.evaluateAt(v)),S=this.field.inverse(f.evaluateAt(v));h[p]=this.field.multiply(E,S)}return h}}class ui{constructor(r,i,s,a,l){r instanceof ui?this.constructor_2(r):this.constructor_1(r,i,s,a,l)}constructor_1(r,i,s,a,l){const f=i==null||s==null,d=a==null||l==null;if(f&&d)throw new X;f?(i=new ae(0,a.getY()),s=new ae(0,l.getY())):d&&(a=new ae(r.getWidth()-1,i.getY()),l=new ae(r.getWidth()-1,s.getY())),this.image=r,this.topLeft=i,this.bottomLeft=s,this.topRight=a,this.bottomRight=l,this.minX=Math.trunc(Math.min(i.getX(),s.getX())),this.maxX=Math.trunc(Math.max(a.getX(),l.getX())),this.minY=Math.trunc(Math.min(i.getY(),a.getY())),this.maxY=Math.trunc(Math.max(s.getY(),l.getY()))}constructor_2(r){this.image=r.image,this.topLeft=r.getTopLeft(),this.bottomLeft=r.getBottomLeft(),this.topRight=r.getTopRight(),this.bottomRight=r.getBottomRight(),this.minX=r.getMinX(),this.maxX=r.getMaxX(),this.minY=r.getMinY(),this.maxY=r.getMaxY()}static merge(r,i){return r==null?i:i==null?r:new ui(r.image,r.topLeft,r.bottomLeft,i.topRight,i.bottomRight)}addMissingRows(r,i,s){let a=this.topLeft,l=this.bottomLeft,f=this.topRight,d=this.bottomRight;if(r>0){let h=s?this.topLeft:this.topRight,p=Math.trunc(h.getY()-r);p<0&&(p=0);let v=new ae(h.getX(),p);s?a=v:f=v}if(i>0){let h=s?this.bottomLeft:this.bottomRight,p=Math.trunc(h.getY()+i);p>=this.image.getHeight()&&(p=this.image.getHeight()-1);let v=new ae(h.getX(),p);s?l=v:d=v}return new ui(this.image,a,l,f,d)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class x3{constructor(r,i,s,a){this.columnCount=r,this.errorCorrectionLevel=a,this.rowCountUpperPart=i,this.rowCountLowerPart=s,this.rowCount=i+s}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class $s{constructor(){this.buffer=""}static form(r,i){let s=-1;function a(f,d,h,p,v,E){if(f==="%%")return"%";if(i[++s]===void 0)return;f=p?parseInt(p.substr(1)):void 0;let S=v?parseInt(v.substr(1)):void 0,_;switch(E){case"s":_=i[s];break;case"c":_=i[s][0];break;case"f":_=parseFloat(i[s]).toFixed(f);break;case"p":_=parseFloat(i[s]).toPrecision(f);break;case"e":_=parseFloat(i[s]).toExponential(f);break;case"x":_=parseInt(i[s]).toString(S||16);break;case"d":_=parseFloat(parseInt(i[s],S||10).toPrecision(f)).toFixed(0);break}_=typeof _=="object"?JSON.stringify(_):(+_).toString(S);let D=parseInt(h),P=h&&h[0]+""=="0"?"0":" ";for(;_.length<D;)_=d!==void 0?_+P:P+_;return _}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}format(r,...i){this.buffer+=$s.form(r,i)}toString(){return this.buffer}}class zs{constructor(r){this.boundingBox=new ui(r),this.codewords=new Array(r.getMaxY()-r.getMinY()+1)}getCodewordNearby(r){let i=this.getCodeword(r);if(i!=null)return i;for(let s=1;s<zs.MAX_NEARBY_DISTANCE;s++){let a=this.imageRowToCodewordIndex(r)-s;if(a>=0&&(i=this.codewords[a],i!=null)||(a=this.imageRowToCodewordIndex(r)+s,a<this.codewords.length&&(i=this.codewords[a],i!=null)))return i}return null}imageRowToCodewordIndex(r){return r-this.boundingBox.getMinY()}setCodeword(r,i){this.codewords[this.imageRowToCodewordIndex(r)]=i}getCodeword(r){return this.codewords[this.imageRowToCodewordIndex(r)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const r=new $s;let i=0;for(const s of this.codewords){if(s==null){r.format("%3d: | %n",i++);continue}r.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}return r.toString()}}zs.MAX_NEARBY_DISTANCE=5;class Vs{constructor(){this.values=new Map}setValue(r){r=Math.trunc(r);let i=this.values.get(r);i==null&&(i=0),i++,this.values.set(r,i)}getValue(){let r=-1,i=new Array;for(const[s,a]of this.values.entries()){const l={getKey:()=>s,getValue:()=>a};l.getValue()>r?(r=l.getValue(),i=[],i.push(l.getKey())):l.getValue()===r&&i.push(l.getKey())}return ge.toIntArray(i)}getConfidence(r){return this.values.get(r)}}class eh extends zs{constructor(r,i){super(r),this._isLeft=i}setRowNumbers(){for(let r of this.getCodewords())r!=null&&r.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(r){let i=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(i,r);let s=this.getBoundingBox(),a=this._isLeft?s.getTopLeft():s.getTopRight(),l=this._isLeft?s.getBottomLeft():s.getBottomRight(),f=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.imageRowToCodewordIndex(Math.trunc(l.getY())),h=-1,p=1,v=0;for(let E=f;E<d;E++){if(i[E]==null)continue;let S=i[E],_=S.getRowNumber()-h;if(_===0)v++;else if(_===1)p=Math.max(p,v),v=1,h=S.getRowNumber();else if(_<0||S.getRowNumber()>=r.getRowCount()||_>E)i[E]=null;else{let D;p>2?D=(p-2)*_:D=_;let P=D>=E;for(let W=1;W<=D&&!P;W++)P=i[E-W]!=null;P?i[E]=null:(h=S.getRowNumber(),v=1)}}}getRowHeights(){let r=this.getBarcodeMetadata();if(r==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(r);let i=new Int32Array(r.getRowCount());for(let s of this.getCodewords())if(s!=null){let a=s.getRowNumber();if(a>=i.length)continue;i[a]++}return i}adjustIncompleteIndicatorColumnRowNumbers(r){let i=this.getBoundingBox(),s=this._isLeft?i.getTopLeft():i.getTopRight(),a=this._isLeft?i.getBottomLeft():i.getBottomRight(),l=this.imageRowToCodewordIndex(Math.trunc(s.getY())),f=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.getCodewords(),h=-1;for(let p=l;p<f;p++){if(d[p]==null)continue;let v=d[p];v.setRowNumberAsRowIndicatorColumn();let E=v.getRowNumber()-h;E===0||(E===1?h=v.getRowNumber():v.getRowNumber()>=r.getRowCount()?d[p]=null:h=v.getRowNumber())}}getBarcodeMetadata(){let r=this.getCodewords(),i=new Vs,s=new Vs,a=new Vs,l=new Vs;for(let d of r){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let h=d.getValue()%30,p=d.getRowNumber();switch(this._isLeft||(p+=2),p%3){case 0:s.setValue(h*3+1);break;case 1:l.setValue(h/3),a.setValue(h%3);break;case 2:i.setValue(h+1);break}}if(i.getValue().length===0||s.getValue().length===0||a.getValue().length===0||l.getValue().length===0||i.getValue()[0]<1||s.getValue()[0]+a.getValue()[0]<ge.MIN_ROWS_IN_BARCODE||s.getValue()[0]+a.getValue()[0]>ge.MAX_ROWS_IN_BARCODE)return null;let f=new x3(i.getValue()[0],s.getValue()[0],a.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(r,f),f}removeIncorrectCodewords(r,i){for(let s=0;s<r.length;s++){let a=r[s];if(r[s]==null)continue;let l=a.getValue()%30,f=a.getRowNumber();if(f>i.getRowCount()){r[s]=null;continue}switch(this._isLeft||(f+=2),f%3){case 0:l*3+1!==i.getRowCountUpperPart()&&(r[s]=null);break;case 1:(Math.trunc(l/3)!==i.getErrorCorrectionLevel()||l%3!==i.getRowCountLowerPart())&&(r[s]=null);break;case 2:l+1!==i.getColumnCount()&&(r[s]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
467
- `+super.toString()}}class Hs{constructor(r,i){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=r,this.barcodeColumnCount=r.getColumnCount(),this.boundingBox=i,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let r=ge.MAX_CODEWORDS_IN_BARCODE,i;do i=r,r=this.adjustRowNumbersAndGetCount();while(r>0&&r<i);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(r){r!=null&&r.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let r=this.adjustRowNumbersByRow();if(r===0)return 0;for(let i=1;i<this.barcodeColumnCount+1;i++){let s=this.detectionResultColumns[i].getCodewords();for(let a=0;a<s.length;a++)s[a]!=null&&(s[a].hasValidRowNumber()||this.adjustRowNumbers(i,a,s))}return r}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let r=this.detectionResultColumns[0].getCodewords(),i=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<r.length;s++)if(r[s]!=null&&i[s]!=null&&r[s].getRowNumber()===i[s].getRowNumber())for(let a=1;a<=this.barcodeColumnCount;a++){let l=this.detectionResultColumns[a].getCodewords()[s];l!=null&&(l.setRowNumber(r[s].getRowNumber()),l.hasValidRowNumber()||(this.detectionResultColumns[a].getCodewords()[s]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let r=0,i=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<i.length;s++){if(i[s]==null)continue;let a=i[s].getRowNumber(),l=0;for(let f=this.barcodeColumnCount+1;f>0&&l<this.ADJUST_ROW_NUMBER_SKIP;f--){let d=this.detectionResultColumns[f].getCodewords()[s];d!=null&&(l=Hs.adjustRowNumberIfValid(a,l,d),d.hasValidRowNumber()||r++)}}return r}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let r=0,i=this.detectionResultColumns[0].getCodewords();for(let s=0;s<i.length;s++){if(i[s]==null)continue;let a=i[s].getRowNumber(),l=0;for(let f=1;f<this.barcodeColumnCount+1&&l<this.ADJUST_ROW_NUMBER_SKIP;f++){let d=this.detectionResultColumns[f].getCodewords()[s];d!=null&&(l=Hs.adjustRowNumberIfValid(a,l,d),d.hasValidRowNumber()||r++)}}return r}static adjustRowNumberIfValid(r,i,s){return s==null||s.hasValidRowNumber()||(s.isValidRowNumber(r)?(s.setRowNumber(r),i=0):++i),i}adjustRowNumbers(r,i,s){if(!this.detectionResultColumns[r-1])return;let a=s[i],l=this.detectionResultColumns[r-1].getCodewords(),f=l;this.detectionResultColumns[r+1]!=null&&(f=this.detectionResultColumns[r+1].getCodewords());let d=new Array(14);d[2]=l[i],d[3]=f[i],i>0&&(d[0]=s[i-1],d[4]=l[i-1],d[5]=f[i-1]),i>1&&(d[8]=s[i-2],d[10]=l[i-2],d[11]=f[i-2]),i<s.length-1&&(d[1]=s[i+1],d[6]=l[i+1],d[7]=f[i+1]),i<s.length-2&&(d[9]=s[i+2],d[12]=l[i+2],d[13]=f[i+2]);for(let h of d)if(Hs.adjustRowNumber(a,h))return}static adjustRowNumber(r,i){return i==null?!1:i.hasValidRowNumber()&&i.getBucket()===r.getBucket()?(r.setRowNumber(i.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(r){this.boundingBox=r}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(r,i){this.detectionResultColumns[r]=i}getDetectionResultColumn(r){return this.detectionResultColumns[r]}toString(){let r=this.detectionResultColumns[0];r==null&&(r=this.detectionResultColumns[this.barcodeColumnCount+1]);let i=new $s;for(let s=0;s<r.getCodewords().length;s++){i.format("CW %3d:",s);for(let a=0;a<this.barcodeColumnCount+2;a++){if(this.detectionResultColumns[a]==null){i.format(" | ");continue}let l=this.detectionResultColumns[a].getCodewords()[s];if(l==null){i.format(" | ");continue}i.format(" %3d|%3d",l.getRowNumber(),l.getValue())}i.format("%n")}return i.toString()}}class Gs{constructor(r,i,s,a){this.rowNumber=Gs.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(r),this.endX=Math.trunc(i),this.bucket=Math.trunc(s),this.value=Math.trunc(a)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(r){return r!==Gs.BARCODE_ROW_UNKNOWN&&this.bucket===r%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(r){this.rowNumber=r}toString(){return this.rowNumber+"|"+this.value}}Gs.BARCODE_ROW_UNKNOWN=-1;class er{static initialize(){for(let r=0;r<ge.SYMBOL_TABLE.length;r++){let i=ge.SYMBOL_TABLE[r],s=i&1;for(let a=0;a<ge.BARS_IN_MODULE;a++){let l=0;for(;(i&1)===s;)l+=1,i>>=1;s=i&1,er.RATIOS_TABLE[r]||(er.RATIOS_TABLE[r]=new Array(ge.BARS_IN_MODULE)),er.RATIOS_TABLE[r][ge.BARS_IN_MODULE-a-1]=Math.fround(l/ge.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(r){let i=er.getDecodedCodewordValue(er.sampleBitCounts(r));return i!==-1?i:er.getClosestDecodedValue(r)}static sampleBitCounts(r){let i=Re.sum(r),s=new Int32Array(ge.BARS_IN_MODULE),a=0,l=0;for(let f=0;f<ge.MODULES_IN_CODEWORD;f++){let d=i/(2*ge.MODULES_IN_CODEWORD)+f*i/ge.MODULES_IN_CODEWORD;l+r[a]<=d&&(l+=r[a],a++),s[a]++}return s}static getDecodedCodewordValue(r){let i=er.getBitValue(r);return ge.getCodeword(i)===-1?-1:i}static getBitValue(r){let i=0;for(let s=0;s<r.length;s++)for(let a=0;a<r[s];a++)i=i<<1|(s%2===0?1:0);return Math.trunc(i)}static getClosestDecodedValue(r){let i=Re.sum(r),s=new Array(ge.BARS_IN_MODULE);if(i>1)for(let f=0;f<s.length;f++)s[f]=Math.fround(r[f]/i);let a=ma.MAX_VALUE,l=-1;this.bSymbolTableReady||er.initialize();for(let f=0;f<er.RATIOS_TABLE.length;f++){let d=0,h=er.RATIOS_TABLE[f];for(let p=0;p<ge.BARS_IN_MODULE;p++){let v=Math.fround(h[p]-s[p]);if(d+=Math.fround(v*v),d>=a)break}d<a&&(a=d,l=ge.SYMBOL_TABLE[f])}return l}}er.bSymbolTableReady=!1,er.RATIOS_TABLE=new Array(ge.SYMBOL_TABLE.length).map(y=>new Array(ge.BARS_IN_MODULE));class th{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(r){this.segmentIndex=r}getFileId(){return this.fileId}setFileId(r){this.fileId=r}getOptionalData(){return this.optionalData}setOptionalData(r){this.optionalData=r}isLastSegment(){return this.lastSegment}setLastSegment(r){this.lastSegment=r}getSegmentCount(){return this.segmentCount}setSegmentCount(r){this.segmentCount=r}getSender(){return this.sender||null}setSender(r){this.sender=r}getAddressee(){return this.addressee||null}setAddressee(r){this.addressee=r}getFileName(){return this.fileName}setFileName(r){this.fileName=r}getFileSize(){return this.fileSize}setFileSize(r){this.fileSize=r}getChecksum(){return this.checksum}setChecksum(r){this.checksum=r}getTimestamp(){return this.timestamp}setTimestamp(r){this.timestamp=r}}class rh{static parseLong(r,i=void 0){return parseInt(r,i)}}class nh extends m{}nh.kind="NullPointerException";class w3{writeBytes(r){this.writeBytesOffset(r,0,r.length)}writeBytesOffset(r,i,s){if(r==null)throw new nh;if(i<0||i>r.length||s<0||i+s>r.length||i+s<0)throw new G;if(s===0)return;for(let a=0;a<s;a++)this.write(r[i+a])}flush(){}close(){}}class v3 extends m{}class y3 extends w3{constructor(r=32){if(super(),this.count=0,r<0)throw new b("Negative initial size: "+r);this.buf=new Uint8Array(r)}ensureCapacity(r){r-this.buf.length>0&&this.grow(r)}grow(r){let s=this.buf.length<<1;if(s-r<0&&(s=r),s<0){if(r<0)throw new v3;s=O.MAX_VALUE}this.buf=I.copyOfUint8Array(this.buf,s)}write(r){this.ensureCapacity(this.count+1),this.buf[this.count]=r,this.count+=1}writeBytesOffset(r,i,s){if(i<0||i>r.length||s<0||i+s-r.length>0)throw new G;this.ensureCapacity(this.count+s),M.arraycopy(r,i,this.buf,this.count,s),this.count+=s}writeTo(r){r.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return I.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(r){return r?typeof r=="string"?this.toString_string(r):this.toString_number(r):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(r){return new String(this.buf).toString()}toString_number(r){return new String(this.buf).toString()}close(){}}var Le;(function(y){y[y.ALPHA=0]="ALPHA",y[y.LOWER=1]="LOWER",y[y.MIXED=2]="MIXED",y[y.PUNCT=3]="PUNCT",y[y.ALPHA_SHIFT=4]="ALPHA_SHIFT",y[y.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Le||(Le={}));function ih(){if(typeof window<"u")return window.BigInt||null;if(typeof pn<"u")return pn.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ba;function Dn(y){if(typeof ba>"u"&&(ba=ih()),ba===null)throw new Error("BigInt is not supported!");return ba(y)}function E3(){let y=[];y[0]=Dn(1);let r=Dn(900);y[1]=r;for(let i=2;i<16;i++)y[i]=y[i-1]*r;return y}class V{static decode(r,i){let s=new pe(""),a=z.ISO8859_1;s.enableDecoding(a);let l=1,f=r[l++],d=new th;for(;l<r[0];){switch(f){case V.TEXT_COMPACTION_MODE_LATCH:l=V.textCompaction(r,l,s);break;case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:l=V.byteCompaction(f,r,a,l,s);break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(r[l++]);break;case V.NUMERIC_COMPACTION_MODE_LATCH:l=V.numericCompaction(r,l,s);break;case V.ECI_CHARSET:z.getCharacterSetECIByValue(r[l++]);break;case V.ECI_GENERAL_PURPOSE:l+=2;break;case V.ECI_USER_DEFINED:l++;break;case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:l=V.decodeMacroBlock(r,l,d);break;case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:throw new F;default:l--,l=V.textCompaction(r,l,s);break}if(l<r.length)f=r[l++];else throw F.getFormatInstance()}if(s.length()===0)throw F.getFormatInstance();let h=new Bs(null,s.toString(),null,i);return h.setOther(d),h}static decodeMacroBlock(r,i,s){if(i+V.NUMBER_OF_SEQUENCE_CODEWORDS>r[0])throw F.getFormatInstance();let a=new Int32Array(V.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<V.NUMBER_OF_SEQUENCE_CODEWORDS;d++,i++)a[d]=r[i];s.setSegmentIndex(O.parseInt(V.decodeBase900toBase10(a,V.NUMBER_OF_SEQUENCE_CODEWORDS)));let l=new pe;i=V.textCompaction(r,i,l),s.setFileId(l.toString());let f=-1;for(r[i]===V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(f=i+1);i<r[0];)switch(r[i]){case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(i++,r[i]){case V.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new pe;i=V.textCompaction(r,i+1,d),s.setFileName(d.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let h=new pe;i=V.textCompaction(r,i+1,h),s.setSender(h.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let p=new pe;i=V.textCompaction(r,i+1,p),s.setAddressee(p.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let v=new pe;i=V.numericCompaction(r,i+1,v),s.setSegmentCount(O.parseInt(v.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new pe;i=V.numericCompaction(r,i+1,E),s.setTimestamp(rh.parseLong(E.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new pe;i=V.numericCompaction(r,i+1,S),s.setChecksum(O.parseInt(S.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let _=new pe;i=V.numericCompaction(r,i+1,_),s.setFileSize(rh.parseLong(_.toString()));break;default:throw F.getFormatInstance()}break;case V.MACRO_PDF417_TERMINATOR:i++,s.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(f!==-1){let d=i-f;s.isLastSegment()&&d--,s.setOptionalData(I.copyOfRange(r,f,f+d))}return i}static textCompaction(r,i,s){let a=new Int32Array((r[0]-i)*2),l=new Int32Array((r[0]-i)*2),f=0,d=!1;for(;i<r[0]&&!d;){let h=r[i++];if(h<V.TEXT_COMPACTION_MODE_LATCH)a[f]=h/30,a[f+1]=h%30,f+=2;else switch(h){case V.TEXT_COMPACTION_MODE_LATCH:a[f++]=V.TEXT_COMPACTION_MODE_LATCH;break;case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:i--,d=!0;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a[f]=V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,h=r[i++],l[f]=h,f++;break}}return V.decodeTextCompaction(a,l,f,s),i}static decodeTextCompaction(r,i,s,a){let l=Le.ALPHA,f=Le.ALPHA,d=0;for(;d<s;){let h=r[d],p="";switch(l){case Le.ALPHA:if(h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case V.LL:l=Le.LOWER;break;case V.ML:l=Le.MIXED;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.LOWER:if(h<26)p=String.fromCharCode(97+h);else switch(h){case 26:p=" ";break;case V.AS:f=l,l=Le.ALPHA_SHIFT;break;case V.ML:l=Le.MIXED;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.MIXED:if(h<V.PL)p=V.MIXED_CHARS[h];else switch(h){case V.PL:l=Le.PUNCT;break;case 26:p=" ";break;case V.LL:l=Le.LOWER;break;case V.AL:l=Le.ALPHA;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.PUNCT:if(h<V.PAL)p=V.PUNCT_CHARS[h];else switch(h){case V.PAL:l=Le.ALPHA;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.ALPHA_SHIFT:if(l=f,h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.PUNCT_SHIFT:if(l=f,h<V.PAL)p=V.PUNCT_CHARS[h];else switch(h){case V.PAL:l=Le.ALPHA;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break}p!==""&&a.append(p),d++}}static byteCompaction(r,i,s,a,l){let f=new y3,d=0,h=0,p=!1;switch(r){case V.BYTE_COMPACTION_MODE_LATCH:let v=new Int32Array(6),E=i[a++];for(;a<i[0]&&!p;)switch(v[d++]=E,h=900*h+E,E=i[a++],E){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:a--,p=!0;break;default:if(d%5===0&&d>0){for(let S=0;S<6;++S)f.write(Number(Dn(h)>>Dn(8*(5-S))));h=0,d=0}break}a===i[0]&&E<V.TEXT_COMPACTION_MODE_LATCH&&(v[d++]=E);for(let S=0;S<d;S++)f.write(v[S]);break;case V.BYTE_COMPACTION_MODE_LATCH_6:for(;a<i[0]&&!p;){let S=i[a++];if(S<V.TEXT_COMPACTION_MODE_LATCH)d++,h=900*h+S;else switch(S){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:a--,p=!0;break}if(d%5===0&&d>0){for(let _=0;_<6;++_)f.write(Number(Dn(h)>>Dn(8*(5-_))));h=0,d=0}}break}return l.append(ve.decode(f.toByteArray(),s)),a}static numericCompaction(r,i,s){let a=0,l=!1,f=new Int32Array(V.MAX_NUMERIC_CODEWORDS);for(;i<r[0]&&!l;){let d=r[i++];if(i===r[0]&&(l=!0),d<V.TEXT_COMPACTION_MODE_LATCH)f[a]=d,a++;else switch(d){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:i--,l=!0;break}(a%V.MAX_NUMERIC_CODEWORDS===0||d===V.NUMERIC_COMPACTION_MODE_LATCH||l)&&a>0&&(s.append(V.decodeBase900toBase10(f,a)),a=0)}return i}static decodeBase900toBase10(r,i){let s=Dn(0);for(let l=0;l<i;l++)s+=V.EXP900[i-l-1]*Dn(r[l]);let a=s.toString();if(a.charAt(0)!=="1")throw new F;return a.substring(1)}}V.TEXT_COMPACTION_MODE_LATCH=900,V.BYTE_COMPACTION_MODE_LATCH=901,V.NUMERIC_COMPACTION_MODE_LATCH=902,V.BYTE_COMPACTION_MODE_LATCH_6=924,V.ECI_USER_DEFINED=925,V.ECI_GENERAL_PURPOSE=926,V.ECI_CHARSET=927,V.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,V.MACRO_PDF417_TERMINATOR=922,V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,V.MAX_NUMERIC_CODEWORDS=15,V.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,V.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,V.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,V.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,V.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,V.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,V.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,V.PL=25,V.LL=27,V.AS=27,V.ML=28,V.AL=28,V.PS=29,V.PAL=29,V.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
468
- -.$/"|*()?{}'`,V.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",V.EXP900=ih()?E3():[],V.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ee{constructor(){}static decode(r,i,s,a,l,f,d){let h=new ui(r,i,s,a,l),p=null,v=null,E;for(let D=!0;;D=!1){if(i!=null&&(p=Ee.getRowIndicatorColumn(r,h,i,!0,f,d)),a!=null&&(v=Ee.getRowIndicatorColumn(r,h,a,!1,f,d)),E=Ee.merge(p,v),E==null)throw X.getNotFoundInstance();let P=E.getBoundingBox();if(D&&P!=null&&(P.getMinY()<h.getMinY()||P.getMaxY()>h.getMaxY()))h=P;else break}E.setBoundingBox(h);let S=E.getBarcodeColumnCount()+1;E.setDetectionResultColumn(0,p),E.setDetectionResultColumn(S,v);let _=p!=null;for(let D=1;D<=S;D++){let P=_?D:S-D;if(E.getDetectionResultColumn(P)!==void 0)continue;let W;P===0||P===S?W=new eh(h,P===0):W=new zs(h),E.setDetectionResultColumn(P,W);let H=-1,q=H;for(let J=h.getMinY();J<=h.getMaxY();J++){if(H=Ee.getStartColumn(E,P,J,_),H<0||H>h.getMaxX()){if(q===-1)continue;H=q}let Z=Ee.detectCodeword(r,h.getMinX(),h.getMaxX(),_,H,J,f,d);Z!=null&&(W.setCodeword(J,Z),q=H,f=Math.min(f,Z.getWidth()),d=Math.max(d,Z.getWidth()))}}return Ee.createDecoderResult(E)}static merge(r,i){if(r==null&&i==null)return null;let s=Ee.getBarcodeMetadata(r,i);if(s==null)return null;let a=ui.merge(Ee.adjustBoundingBox(r),Ee.adjustBoundingBox(i));return new Hs(s,a)}static adjustBoundingBox(r){if(r==null)return null;let i=r.getRowHeights();if(i==null)return null;let s=Ee.getMax(i),a=0;for(let d of i)if(a+=s-d,d>0)break;let l=r.getCodewords();for(let d=0;a>0&&l[d]==null;d++)a--;let f=0;for(let d=i.length-1;d>=0&&(f+=s-i[d],!(i[d]>0));d--);for(let d=l.length-1;f>0&&l[d]==null;d--)f--;return r.getBoundingBox().addMissingRows(a,f,r.isLeft())}static getMax(r){let i=-1;for(let s of r)i=Math.max(i,s);return i}static getBarcodeMetadata(r,i){let s;if(r==null||(s=r.getBarcodeMetadata())==null)return i==null?null:i.getBarcodeMetadata();let a;return i==null||(a=i.getBarcodeMetadata())==null?s:s.getColumnCount()!==a.getColumnCount()&&s.getErrorCorrectionLevel()!==a.getErrorCorrectionLevel()&&s.getRowCount()!==a.getRowCount()?null:s}static getRowIndicatorColumn(r,i,s,a,l,f){let d=new eh(i,a);for(let h=0;h<2;h++){let p=h===0?1:-1,v=Math.trunc(Math.trunc(s.getX()));for(let E=Math.trunc(Math.trunc(s.getY()));E<=i.getMaxY()&&E>=i.getMinY();E+=p){let S=Ee.detectCodeword(r,0,r.getWidth(),a,v,E,l,f);S!=null&&(d.setCodeword(E,S),a?v=S.getStartX():v=S.getEndX())}}return d}static adjustCodewordCount(r,i){let s=i[0][1],a=s.getValue(),l=r.getBarcodeColumnCount()*r.getBarcodeRowCount()-Ee.getNumberOfECCodeWords(r.getBarcodeECLevel());if(a.length===0){if(l<1||l>ge.MAX_CODEWORDS_IN_BARCODE)throw X.getNotFoundInstance();s.setValue(l)}else a[0]!==l&&s.setValue(l)}static createDecoderResult(r){let i=Ee.createBarcodeMatrix(r);Ee.adjustCodewordCount(r,i);let s=new Array,a=new Int32Array(r.getBarcodeRowCount()*r.getBarcodeColumnCount()),l=[],f=new Array;for(let h=0;h<r.getBarcodeRowCount();h++)for(let p=0;p<r.getBarcodeColumnCount();p++){let v=i[h][p+1].getValue(),E=h*r.getBarcodeColumnCount()+p;v.length===0?s.push(E):v.length===1?a[E]=v[0]:(f.push(E),l.push(v))}let d=new Array(l.length);for(let h=0;h<d.length;h++)d[h]=l[h];return Ee.createDecoderResultFromAmbiguousValues(r.getBarcodeECLevel(),a,ge.toIntArray(s),ge.toIntArray(f),d)}static createDecoderResultFromAmbiguousValues(r,i,s,a,l){let f=new Int32Array(a.length),d=100;for(;d-- >0;){for(let h=0;h<f.length;h++)i[a[h]]=l[h][f[h]];try{return Ee.decodeCodewords(i,r,s)}catch(h){if(!(h instanceof T))throw h}if(f.length===0)throw T.getChecksumInstance();for(let h=0;h<f.length;h++)if(f[h]<l[h].length-1){f[h]++;break}else if(f[h]=0,h===f.length-1)throw T.getChecksumInstance()}throw T.getChecksumInstance()}static createBarcodeMatrix(r){let i=Array.from({length:r.getBarcodeRowCount()},()=>new Array(r.getBarcodeColumnCount()+2));for(let a=0;a<i.length;a++)for(let l=0;l<i[a].length;l++)i[a][l]=new Vs;let s=0;for(let a of r.getDetectionResultColumns()){if(a!=null){for(let l of a.getCodewords())if(l!=null){let f=l.getRowNumber();if(f>=0){if(f>=i.length)continue;i[f][s].setValue(l.getValue())}}}s++}return i}static isValidBarcodeColumn(r,i){return i>=0&&i<=r.getBarcodeColumnCount()+1}static getStartColumn(r,i,s,a){let l=a?1:-1,f=null;if(Ee.isValidBarcodeColumn(r,i-l)&&(f=r.getDetectionResultColumn(i-l).getCodeword(s)),f!=null)return a?f.getEndX():f.getStartX();if(f=r.getDetectionResultColumn(i).getCodewordNearby(s),f!=null)return a?f.getStartX():f.getEndX();if(Ee.isValidBarcodeColumn(r,i-l)&&(f=r.getDetectionResultColumn(i-l).getCodewordNearby(s)),f!=null)return a?f.getEndX():f.getStartX();let d=0;for(;Ee.isValidBarcodeColumn(r,i-l);){i-=l;for(let h of r.getDetectionResultColumn(i).getCodewords())if(h!=null)return(a?h.getEndX():h.getStartX())+l*d*(h.getEndX()-h.getStartX());d++}return a?r.getBoundingBox().getMinX():r.getBoundingBox().getMaxX()}static detectCodeword(r,i,s,a,l,f,d,h){l=Ee.adjustCodewordStartColumn(r,i,s,a,l,f);let p=Ee.getModuleBitCount(r,i,s,a,l,f);if(p==null)return null;let v,E=Re.sum(p);if(a)v=l+E;else{for(let D=0;D<p.length/2;D++){let P=p[D];p[D]=p[p.length-1-D],p[p.length-1-D]=P}v=l,l=v-E}if(!Ee.checkCodewordSkew(E,d,h))return null;let S=er.getDecodedValue(p),_=ge.getCodeword(S);return _===-1?null:new Gs(l,v,Ee.getCodewordBucketNumber(S),_)}static getModuleBitCount(r,i,s,a,l,f){let d=l,h=new Int32Array(8),p=0,v=a?1:-1,E=a;for(;(a?d<s:d>=i)&&p<h.length;)r.get(d,f)===E?(h[p]++,d+=v):(p++,E=!E);return p===h.length||d===(a?s:i)&&p===h.length-1?h:null}static getNumberOfECCodeWords(r){return 2<<r}static adjustCodewordStartColumn(r,i,s,a,l,f){let d=l,h=a?-1:1;for(let p=0;p<2;p++){for(;(a?d>=i:d<s)&&a===r.get(d,f);){if(Math.abs(l-d)>Ee.CODEWORD_SKEW_SIZE)return l;d+=h}h=-h,a=!a}return d}static checkCodewordSkew(r,i,s){return i-Ee.CODEWORD_SKEW_SIZE<=r&&r<=s+Ee.CODEWORD_SKEW_SIZE}static decodeCodewords(r,i,s){if(r.length===0)throw F.getFormatInstance();let a=1<<i+1,l=Ee.correctErrors(r,s,a);Ee.verifyCodewordCount(r,a);let f=V.decode(r,""+i);return f.setErrorsCorrected(l),f.setErasures(s.length),f}static correctErrors(r,i,s){if(i!=null&&i.length>s/2+Ee.MAX_ERRORS||s<0||s>Ee.MAX_EC_CODEWORDS)throw T.getChecksumInstance();return Ee.errorCorrection.decode(r,s,i)}static verifyCodewordCount(r,i){if(r.length<4)throw F.getFormatInstance();let s=r[0];if(s>r.length)throw F.getFormatInstance();if(s===0)if(i<r.length)r[0]=r.length-i;else throw F.getFormatInstance()}static getBitCountForCodeword(r){let i=new Int32Array(8),s=0,a=i.length-1;for(;!((r&1)!==s&&(s=r&1,a--,a<0));)i[a]++,r>>=1;return i}static getCodewordBucketNumber(r){return r instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(r):this.getCodewordBucketNumber_number(r)}static getCodewordBucketNumber_number(r){return Ee.getCodewordBucketNumber(Ee.getBitCountForCodeword(r))}static getCodewordBucketNumber_Int32Array(r){return(r[0]-r[2]+r[4]-r[6]+9)%9}static toString(r){let i=new $s;for(let s=0;s<r.length;s++){i.format("Row %2d: ",s);for(let a=0;a<r[s].length;a++){let l=r[s][a];l.getValue().length===0?i.format(" ",null):i.format("%4d(%2d)",l.getValue()[0],l.getConfidence(l.getValue()[0]))}i.format("%n")}return i.toString()}}Ee.CODEWORD_SKEW_SIZE=2,Ee.MAX_ERRORS=3,Ee.MAX_EC_CODEWORDS=512,Ee.errorCorrection=new J0;class Nt{decode(r,i=null){let s=Nt.decode(r,i,!1);if(s==null||s.length===0||s[0]==null)throw X.getNotFoundInstance();return s[0]}decodeMultiple(r,i=null){try{return Nt.decode(r,i,!0)}catch(s){throw s instanceof F||s instanceof T?X.getNotFoundInstance():s}}static decode(r,i,s){const a=new Array,l=ye.detectMultiple(r,i,s);for(const f of l.getPoints()){const d=Ee.decode(l.getBits(),f[4],f[5],f[6],f[7],Nt.getMinCodewordWidth(f),Nt.getMaxCodewordWidth(f)),h=new Ze(d.getText(),d.getRawBytes(),void 0,f,le.PDF_417);h.putMetadata(bt.ERROR_CORRECTION_LEVEL,d.getECLevel());const p=d.getOther();p!=null&&h.putMetadata(bt.PDF417_EXTRA_METADATA,p),a.push(h)}return a.map(f=>f)}static getMaxWidth(r,i){return r==null||i==null?0:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMinWidth(r,i){return r==null||i==null?O.MAX_VALUE:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMaxCodewordWidth(r){return Math.floor(Math.max(Math.max(Nt.getMaxWidth(r[0],r[4]),Nt.getMaxWidth(r[6],r[2])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN),Math.max(Nt.getMaxWidth(r[1],r[5]),Nt.getMaxWidth(r[7],r[3])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(r){return Math.floor(Math.min(Math.min(Nt.getMinWidth(r[0],r[4]),Nt.getMinWidth(r[6],r[2])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN),Math.min(Nt.getMinWidth(r[1],r[5]),Nt.getMinWidth(r[7],r[3])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN)))}reset(){}}class Aa extends m{}Aa.kind="ReaderException";class sh{constructor(r,i){this.verbose=r===!0,i&&this.setHints(i)}decode(r,i){return i&&this.setHints(i),this.decodeInternal(r)}decodeWithState(r){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(r)}setHints(r){this.hints=r;const i=!o(r)&&r.get(U.TRY_HARDER)===!0,s=o(r)?null:r.get(U.POSSIBLE_FORMATS),a=new Array;if(!o(s)){const l=s.some(f=>f===le.UPC_A||f===le.UPC_E||f===le.EAN_13||f===le.EAN_8||f===le.CODABAR||f===le.CODE_39||f===le.CODE_93||f===le.CODE_128||f===le.ITF||f===le.RSS_14||f===le.RSS_EXPANDED);l&&!i&&a.push(new ji(r,this.verbose)),s.includes(le.QR_CODE)&&a.push(new Mn),s.includes(le.DATA_MATRIX)&&a.push(new kn),s.includes(le.AZTEC)&&a.push(new wa),s.includes(le.PDF_417)&&a.push(new Nt),l&&i&&a.push(new ji(r,this.verbose))}a.length===0&&(i||a.push(new ji(r,this.verbose)),a.push(new Mn),a.push(new kn),a.push(new wa),a.push(new Nt),i&&a.push(new ji(r,this.verbose))),this.readers=a}reset(){if(this.readers!==null)for(const r of this.readers)r.reset()}decodeInternal(r){if(this.readers===null)throw new Aa("No readers where selected, nothing can be read.");for(const i of this.readers)try{return i.decode(r,this.hints)}catch(s){if(s instanceof Aa)continue}throw new X("No MultiFormat Readers were able to detect the code.")}}class C3 extends Er{constructor(r=null,i=500){const s=new sh;s.setHints(r),super(s,i)}decodeBitmap(r){return this.reader.decodeWithState(r)}}class b3 extends Er{constructor(r=500){super(new Nt,r)}}class A3 extends Er{constructor(r=500){super(new Mn,r)}}var hu;(function(y){y[y.ERROR_CORRECTION=0]="ERROR_CORRECTION",y[y.CHARACTER_SET=1]="CHARACTER_SET",y[y.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",y[y.MIN_SIZE=3]="MIN_SIZE",y[y.MAX_SIZE=4]="MAX_SIZE",y[y.MARGIN=5]="MARGIN",y[y.PDF417_COMPACT=6]="PDF417_COMPACT",y[y.PDF417_COMPACTION=7]="PDF417_COMPACTION",y[y.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",y[y.AZTEC_LAYERS=9]="AZTEC_LAYERS",y[y.QR_VERSION=10]="QR_VERSION"})(hu||(hu={}));var wt=hu;class gu{constructor(r){this.field=r,this.cachedGenerators=[],this.cachedGenerators.push(new Qt(r,Int32Array.from([1])))}buildGenerator(r){const i=this.cachedGenerators;if(r>=i.length){let s=i[i.length-1];const a=this.field;for(let l=i.length;l<=r;l++){const f=s.multiply(new Qt(a,Int32Array.from([1,a.exp(l-1+a.getGeneratorBase())])));i.push(f),s=f}}return i[r]}encode(r,i){if(i===0)throw new b("No error correction bytes");const s=r.length-i;if(s<=0)throw new b("No data bytes provided");const a=this.buildGenerator(i),l=new Int32Array(s);M.arraycopy(r,0,l,0,s);let f=new Qt(this.field,l);f=f.multiplyByMonomial(i,1);const h=f.divide(a)[1].getCoefficients(),p=i-h.length;for(let v=0;v<p;v++)r[s+v]=0;M.arraycopy(h,0,r,s+p,h.length)}}class st{constructor(){}static applyMaskPenaltyRule1(r){return st.applyMaskPenaltyRule1Internal(r,!0)+st.applyMaskPenaltyRule1Internal(r,!1)}static applyMaskPenaltyRule2(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let f=0;f<l-1;f++){const d=s[f];for(let h=0;h<a-1;h++){const p=d[h];p===d[h+1]&&p===s[f+1][h]&&p===s[f+1][h+1]&&i++}}return st.N2*i}static applyMaskPenaltyRule3(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let f=0;f<l;f++)for(let d=0;d<a;d++){const h=s[f];d+6<a&&h[d]===1&&h[d+1]===0&&h[d+2]===1&&h[d+3]===1&&h[d+4]===1&&h[d+5]===0&&h[d+6]===1&&(st.isWhiteHorizontal(h,d-4,d)||st.isWhiteHorizontal(h,d+7,d+11))&&i++,f+6<l&&s[f][d]===1&&s[f+1][d]===0&&s[f+2][d]===1&&s[f+3][d]===1&&s[f+4][d]===1&&s[f+5][d]===0&&s[f+6][d]===1&&(st.isWhiteVertical(s,d,f-4,f)||st.isWhiteVertical(s,d,f+7,f+11))&&i++}return i*st.N3}static isWhiteHorizontal(r,i,s){i=Math.max(i,0),s=Math.min(s,r.length);for(let a=i;a<s;a++)if(r[a]===1)return!1;return!0}static isWhiteVertical(r,i,s,a){s=Math.max(s,0),a=Math.min(a,r.length);for(let l=s;l<a;l++)if(r[l][i]===1)return!1;return!0}static applyMaskPenaltyRule4(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let h=0;h<l;h++){const p=s[h];for(let v=0;v<a;v++)p[v]===1&&i++}const f=r.getHeight()*r.getWidth();return Math.floor(Math.abs(i*2-f)*10/f)*st.N4}static getDataMaskBit(r,i,s){let a,l;switch(r){case 0:a=s+i&1;break;case 1:a=s&1;break;case 2:a=i%3;break;case 3:a=(s+i)%3;break;case 4:a=Math.floor(s/2)+Math.floor(i/3)&1;break;case 5:l=s*i,a=(l&1)+l%3;break;case 6:l=s*i,a=(l&1)+l%3&1;break;case 7:l=s*i,a=l%3+(s+i&1)&1;break;default:throw new b("Invalid mask pattern: "+r)}return a===0}static applyMaskPenaltyRule1Internal(r,i){let s=0;const a=i?r.getHeight():r.getWidth(),l=i?r.getWidth():r.getHeight(),f=r.getArray();for(let d=0;d<a;d++){let h=0,p=-1;for(let v=0;v<l;v++){const E=i?f[d][v]:f[v][d];E===p?h++:(h>=5&&(s+=st.N1+(h-5)),h=1,p=E)}h>=5&&(s+=st.N1+(h-5))}return s}}st.N1=3,st.N2=3,st.N3=40,st.N4=10;class Sa{constructor(r,i){this.width=r,this.height=i;const s=new Array(i);for(let a=0;a!==i;a++)s[a]=new Uint8Array(r);this.bytes=s}getHeight(){return this.height}getWidth(){return this.width}get(r,i){return this.bytes[i][r]}getArray(){return this.bytes}setNumber(r,i,s){this.bytes[i][r]=s}setBoolean(r,i,s){this.bytes[i][r]=s?1:0}clear(r){for(const i of this.bytes)I.fill(i,r)}equals(r){if(!(r instanceof Sa))return!1;const i=r;if(this.width!==i.width||this.height!==i.height)return!1;for(let s=0,a=this.height;s<a;++s){const l=this.bytes[s],f=i.bytes[s];for(let d=0,h=this.width;d<h;++d)if(l[d]!==f[d])return!1}return!0}toString(){const r=new pe;for(let i=0,s=this.height;i<s;++i){const a=this.bytes[i];for(let l=0,f=this.width;l<f;++l)switch(a[l]){case 0:r.append(" 0");break;case 1:r.append(" 1");break;default:r.append(" ");break}r.append(`
466
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],je.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Re{constructor(){}static round(r){return r===NaN?0:r<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:r>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r+(r<0?-.5:.5)|0}static distance(r,i,s,a){const l=r-s,f=i-a;return Math.sqrt(l*l+f*f)}static sum(r){let i=0;for(let s=0,a=r.length;s!==a;s++){const l=r[s];i+=l}return i}}class xa{static floatToIntBits(r){return r}}xa.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ae{constructor(r,i){this.x=r,this.y=i}getX(){return this.x}getY(){return this.y}equals(r){if(r instanceof ae){const i=r;return this.x===i.x&&this.y===i.y}return!1}hashCode(){return 31*xa.floatToIntBits(this.x)+xa.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(r){const i=this.distance(r[0],r[1]),s=this.distance(r[1],r[2]),a=this.distance(r[0],r[2]);let l,f,d;if(s>=i&&s>=a?(f=r[0],l=r[1],d=r[2]):a>=s&&a>=i?(f=r[1],l=r[0],d=r[2]):(f=r[2],l=r[0],d=r[1]),this.crossProductZ(l,f,d)<0){const g=l;l=d,d=g}r[0]=l,r[1]=f,r[2]=d}static distance(r,i){return Re.distance(r.x,r.y,i.x,i.y)}static crossProductZ(r,i,s){const a=i.x,l=i.y;return(s.x-a)*(r.y-l)-(s.y-l)*(r.x-a)}}class wa{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class H0 extends wa{constructor(r,i,s,a,l){super(r,i),this.compact=s,this.nbDatablocks=a,this.nbLayers=l}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class un{constructor(r,i,s,a){this.image=r,this.height=r.getHeight(),this.width=r.getWidth(),i==null&&(i=un.INIT_SIZE),s==null&&(s=r.getWidth()/2|0),a==null&&(a=r.getHeight()/2|0);const l=i/2|0;if(this.leftInit=s-l,this.rightInit=s+l,this.upInit=a-l,this.downInit=a+l,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new G}detect(){let r=this.leftInit,i=this.rightInit,s=this.upInit,a=this.downInit,l=!1,f=!0,d=!1,g=!1,p=!1,v=!1,E=!1;const S=this.width,_=this.height;for(;f;){f=!1;let D=!0;for(;(D||!g)&&i<S;)D=this.containsBlackPoint(s,a,i,!1),D?(i++,f=!0,g=!0):g||i++;if(i>=S){l=!0;break}let P=!0;for(;(P||!p)&&a<_;)P=this.containsBlackPoint(r,i,a,!0),P?(a++,f=!0,p=!0):p||a++;if(a>=_){l=!0;break}let W=!0;for(;(W||!v)&&r>=0;)W=this.containsBlackPoint(s,a,r,!1),W?(r--,f=!0,v=!0):v||r--;if(r<0){l=!0;break}let H=!0;for(;(H||!E)&&s>=0;)H=this.containsBlackPoint(r,i,s,!0),H?(s--,f=!0,E=!0):E||s--;if(s<0){l=!0;break}f&&(d=!0)}if(!l&&d){const D=i-r;let P=null;for(let J=1;P===null&&J<D;J++)P=this.getBlackPointOnSegment(r,a-J,r+J,a);if(P==null)throw new G;let W=null;for(let J=1;W===null&&J<D;J++)W=this.getBlackPointOnSegment(r,s+J,r+J,s);if(W==null)throw new G;let H=null;for(let J=1;H===null&&J<D;J++)H=this.getBlackPointOnSegment(i,s+J,i-J,s);if(H==null)throw new G;let q=null;for(let J=1;q===null&&J<D;J++)q=this.getBlackPointOnSegment(i,a-J,i-J,a);if(q==null)throw new G;return this.centerEdges(q,P,H,W)}else throw new G}getBlackPointOnSegment(r,i,s,a){const l=Re.round(Re.distance(r,i,s,a)),f=(s-r)/l,d=(a-i)/l,g=this.image;for(let p=0;p<l;p++){const v=Re.round(r+p*f),E=Re.round(i+p*d);if(g.get(v,E))return new ae(v,E)}return null}centerEdges(r,i,s,a){const l=r.getX(),f=r.getY(),d=i.getX(),g=i.getY(),p=s.getX(),v=s.getY(),E=a.getX(),S=a.getY(),_=un.CORR;return l<this.width/2?[new ae(E-_,S+_),new ae(d+_,g+_),new ae(p-_,v-_),new ae(l+_,f-_)]:[new ae(E+_,S+_),new ae(d+_,g-_),new ae(p-_,v+_),new ae(l-_,f-_)]}containsBlackPoint(r,i,s,a){const l=this.image;if(a){for(let f=r;f<=i;f++)if(l.get(f,s))return!0}else for(let f=r;f<=i;f++)if(l.get(s,f))return!0;return!1}}un.INIT_SIZE=10,un.CORR=1;class eu{static checkAndNudgePoints(r,i){const s=r.getWidth(),a=r.getHeight();let l=!0;for(let f=0;f<i.length&&l;f+=2){const d=Math.floor(i[f]),g=Math.floor(i[f+1]);if(d<-1||d>s||g<-1||g>a)throw new G;l=!1,d===-1?(i[f]=0,l=!0):d===s&&(i[f]=s-1,l=!0),g===-1?(i[f+1]=0,l=!0):g===a&&(i[f+1]=a-1,l=!0)}l=!0;for(let f=i.length-2;f>=0&&l;f-=2){const d=Math.floor(i[f]),g=Math.floor(i[f+1]);if(d<-1||d>s||g<-1||g>a)throw new G;l=!1,d===-1?(i[f]=0,l=!0):d===s&&(i[f]=s-1,l=!0),g===-1?(i[f+1]=0,l=!0):g===a&&(i[f+1]=a-1,l=!0)}}}class kr{constructor(r,i,s,a,l,f,d,g,p){this.a11=r,this.a21=i,this.a31=s,this.a12=a,this.a22=l,this.a32=f,this.a13=d,this.a23=g,this.a33=p}static quadrilateralToQuadrilateral(r,i,s,a,l,f,d,g,p,v,E,S,_,D,P,W){const H=kr.quadrilateralToSquare(r,i,s,a,l,f,d,g);return kr.squareToQuadrilateral(p,v,E,S,_,D,P,W).times(H)}transformPoints(r){const i=r.length,s=this.a11,a=this.a12,l=this.a13,f=this.a21,d=this.a22,g=this.a23,p=this.a31,v=this.a32,E=this.a33;for(let S=0;S<i;S+=2){const _=r[S],D=r[S+1],P=l*_+g*D+E;r[S]=(s*_+f*D+p)/P,r[S+1]=(a*_+d*D+v)/P}}transformPointsWithValues(r,i){const s=this.a11,a=this.a12,l=this.a13,f=this.a21,d=this.a22,g=this.a23,p=this.a31,v=this.a32,E=this.a33,S=r.length;for(let _=0;_<S;_++){const D=r[_],P=i[_],W=l*D+g*P+E;r[_]=(s*D+f*P+p)/W,i[_]=(a*D+d*P+v)/W}}static squareToQuadrilateral(r,i,s,a,l,f,d,g){const p=r-s+l-d,v=i-a+f-g;if(p===0&&v===0)return new kr(s-r,l-s,r,a-i,f-a,i,0,0,1);{const E=s-l,S=d-l,_=a-f,D=g-f,P=E*D-S*_,W=(p*D-S*v)/P,H=(E*v-p*_)/P;return new kr(s-r+W*s,d-r+H*d,r,a-i+W*a,g-i+H*g,i,W,H,1)}}static quadrilateralToSquare(r,i,s,a,l,f,d,g){return kr.squareToQuadrilateral(r,i,s,a,l,f,d,g).buildAdjoint()}buildAdjoint(){return new kr(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(r){return new kr(this.a11*r.a11+this.a21*r.a12+this.a31*r.a13,this.a11*r.a21+this.a21*r.a22+this.a31*r.a23,this.a11*r.a31+this.a21*r.a32+this.a31*r.a33,this.a12*r.a11+this.a22*r.a12+this.a32*r.a13,this.a12*r.a21+this.a22*r.a22+this.a32*r.a23,this.a12*r.a31+this.a22*r.a32+this.a32*r.a33,this.a13*r.a11+this.a23*r.a12+this.a33*r.a13,this.a13*r.a21+this.a23*r.a22+this.a33*r.a23,this.a13*r.a31+this.a23*r.a32+this.a33*r.a33)}}class G0 extends eu{sampleGrid(r,i,s,a,l,f,d,g,p,v,E,S,_,D,P,W,H,q,J){const Z=kr.quadrilateralToQuadrilateral(a,l,f,d,g,p,v,E,S,_,D,P,W,H,q,J);return this.sampleGridWithTransform(r,i,s,Z)}sampleGridWithTransform(r,i,s,a){if(i<=0||s<=0)throw new G;const l=new Te(i,s),f=new Float32Array(2*i);for(let d=0;d<s;d++){const g=f.length,p=d+.5;for(let v=0;v<g;v+=2)f[v]=v/2+.5,f[v+1]=p;a.transformPoints(f),eu.checkAndNudgePoints(r,f);try{for(let v=0;v<g;v+=2)r.get(Math.floor(f[v]),Math.floor(f[v+1]))&&l.set(v/2,d)}catch{throw new G}}return l}}class _n{static setGridSampler(r){_n.gridSampler=r}static getInstance(){return _n.gridSampler}}_n.gridSampler=new G0;class Vt{constructor(r,i){this.x=r,this.y=i}toResultPoint(){return new ae(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class X0{constructor(r){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=r}detect(){return this.detectMirror(!1)}detectMirror(r){let i=this.getMatrixCenter(),s=this.getBullsEyeCorners(i);if(r){let f=s[0];s[0]=s[2],s[2]=f}this.extractParameters(s);let a=this.sampleGrid(this.image,s[this.shift%4],s[(this.shift+1)%4],s[(this.shift+2)%4],s[(this.shift+3)%4]),l=this.getMatrixCornerPoints(s);return new H0(a,l,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(r){if(!this.isValidPoint(r[0])||!this.isValidPoint(r[1])||!this.isValidPoint(r[2])||!this.isValidPoint(r[3]))throw new G;let i=2*this.nbCenterLayers,s=new Int32Array([this.sampleLine(r[0],r[1],i),this.sampleLine(r[1],r[2],i),this.sampleLine(r[2],r[3],i),this.sampleLine(r[3],r[0],i)]);this.shift=this.getRotation(s,i);let a=0;for(let f=0;f<4;f++){let d=s[(this.shift+f)%4];this.compact?(a<<=7,a+=d>>1&127):(a<<=10,a+=(d>>2&992)+(d>>1&31))}let l=this.getCorrectedParameterData(a,this.compact);this.compact?(this.nbLayers=(l>>6)+1,this.nbDataBlocks=(l&63)+1):(this.nbLayers=(l>>11)+1,this.nbDataBlocks=(l&2047)+1)}getRotation(r,i){let s=0;r.forEach((a,l,f)=>{let d=(a>>i-2<<1)+(a&1);s=(s<<3)+d}),s=((s&1)<<11)+(s>>1);for(let a=0;a<4;a++)if(O.bitCount(s^this.EXPECTED_CORNER_BITS[a])<=2)return a;throw new G}getCorrectedParameterData(r,i){let s,a;i?(s=7,a=2):(s=10,a=4);let l=s-a,f=new Int32Array(s);for(let g=s-1;g>=0;--g)f[g]=r&15,r>>=4;try{new Us(Ne.AZTEC_PARAM).decode(f,l)}catch{throw new G}let d=0;for(let g=0;g<a;g++)d=(d<<4)+f[g];return d}getBullsEyeCorners(r){let i=r,s=r,a=r,l=r,f=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(i,f,1,-1),S=this.getFirstDifferent(s,f,1,1),_=this.getFirstDifferent(a,f,-1,1),D=this.getFirstDifferent(l,f,-1,-1);if(this.nbCenterLayers>2){let P=this.distancePoint(D,E)*this.nbCenterLayers/(this.distancePoint(l,i)*(this.nbCenterLayers+2));if(P<.75||P>1.25||!this.isWhiteOrBlackRectangle(E,S,_,D))break}i=E,s=S,a=_,l=D,f=!f}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new G;this.compact=this.nbCenterLayers===5;let d=new ae(i.getX()+.5,i.getY()-.5),g=new ae(s.getX()+.5,s.getY()+.5),p=new ae(a.getX()-.5,a.getY()+.5),v=new ae(l.getX()-.5,l.getY()-.5);return this.expandSquare([d,g,p,v],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let r,i,s,a;try{let d=new un(this.image).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{let g=this.image.getWidth()/2,p=this.image.getHeight()/2;r=this.getFirstDifferent(new Vt(g+7,p-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(g+7,p+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(g-7,p+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(g-7,p-7),!1,-1,-1).toResultPoint()}let l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),f=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4);try{let d=new un(this.image,15,l,f).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{r=this.getFirstDifferent(new Vt(l+7,f-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(l+7,f+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(l-7,f+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(l-7,f-7),!1,-1,-1).toResultPoint()}return l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),f=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4),new Vt(l,f)}getMatrixCornerPoints(r){return this.expandSquare(r,2*this.nbCenterLayers,this.getDimension())}sampleGrid(r,i,s,a,l){let f=_n.getInstance(),d=this.getDimension(),g=d/2-this.nbCenterLayers,p=d/2+this.nbCenterLayers;return f.sampleGrid(r,d,d,g,g,p,g,p,p,g,p,i.getX(),i.getY(),s.getX(),s.getY(),a.getX(),a.getY(),l.getX(),l.getY())}sampleLine(r,i,s){let a=0,l=this.distanceResultPoint(r,i),f=l/s,d=r.getX(),g=r.getY(),p=f*(i.getX()-r.getX())/l,v=f*(i.getY()-r.getY())/l;for(let E=0;E<s;E++)this.image.get(Re.round(d+E*p),Re.round(g+E*v))&&(a|=1<<s-E-1);return a}isWhiteOrBlackRectangle(r,i,s,a){let l=3;r=new Vt(r.getX()-l,r.getY()+l),i=new Vt(i.getX()-l,i.getY()-l),s=new Vt(s.getX()+l,s.getY()-l),a=new Vt(a.getX()+l,a.getY()+l);let f=this.getColor(a,r);if(f===0)return!1;let d=this.getColor(r,i);return d!==f||(d=this.getColor(i,s),d!==f)?!1:(d=this.getColor(s,a),d===f)}getColor(r,i){let s=this.distancePoint(r,i),a=(i.getX()-r.getX())/s,l=(i.getY()-r.getY())/s,f=0,d=r.getX(),g=r.getY(),p=this.image.get(r.getX(),r.getY()),v=Math.ceil(s);for(let S=0;S<v;S++)d+=a,g+=l,this.image.get(Re.round(d),Re.round(g))!==p&&f++;let E=f/s;return E>.1&&E<.9?0:E<=.1===p?1:-1}getFirstDifferent(r,i,s,a){let l=r.getX()+s,f=r.getY()+a;for(;this.isValid(l,f)&&this.image.get(l,f)===i;)l+=s,f+=a;for(l-=s,f-=a;this.isValid(l,f)&&this.image.get(l,f)===i;)l+=s;for(l-=s;this.isValid(l,f)&&this.image.get(l,f)===i;)f+=a;return f-=a,new Vt(l,f)}expandSquare(r,i,s){let a=s/(2*i),l=r[0].getX()-r[2].getX(),f=r[0].getY()-r[2].getY(),d=(r[0].getX()+r[2].getX())/2,g=(r[0].getY()+r[2].getY())/2,p=new ae(d+a*l,g+a*f),v=new ae(d-a*l,g-a*f);l=r[1].getX()-r[3].getX(),f=r[1].getY()-r[3].getY(),d=(r[1].getX()+r[3].getX())/2,g=(r[1].getY()+r[3].getY())/2;let E=new ae(d+a*l,g+a*f),S=new ae(d-a*l,g-a*f);return[p,E,v,S]}isValid(r,i){return r>=0&&r<this.image.getWidth()&&i>0&&i<this.image.getHeight()}isValidPoint(r){let i=Re.round(r.getX()),s=Re.round(r.getY());return this.isValid(i,s)}distancePoint(r,i){return Re.distance(r.getX(),r.getY(),i.getX(),i.getY())}distanceResultPoint(r,i){return Re.distance(r.getX(),r.getY(),i.getX(),i.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(O.truncDivision(this.nbLayers-4,8)+1)+15}}class va{decode(r,i=null){let s=null,a=new X0(r.getBlackMatrix()),l=null,f=null;try{let v=a.detectMirror(!1);l=v.getPoints(),this.reportFoundResultPoints(i,l),f=new je().decode(v)}catch(v){s=v}if(f==null)try{let v=a.detectMirror(!0);l=v.getPoints(),this.reportFoundResultPoints(i,l),f=new je().decode(v)}catch(v){throw s??v}let d=new Ze(f.getText(),f.getRawBytes(),f.getNumBits(),l,le.AZTEC,M.currentTimeMillis()),g=f.getByteSegments();g!=null&&d.putMetadata(bt.BYTE_SEGMENTS,g);let p=f.getECLevel();return p!=null&&d.putMetadata(bt.ERROR_CORRECTION_LEVEL,p),d}reportFoundResultPoints(r,i){if(r!=null){let s=r.get(U.NEED_RESULT_POINT_CALLBACK);s!=null&&i.forEach((a,l,f)=>{s.foundPossibleResultPoint(a)})}}reset(){}}class o3 extends Er{constructor(r=500){super(new va,r)}}class ht{decode(r,i){try{return this.doDecode(r,i)}catch{if(i&&i.get(U.TRY_HARDER)===!0&&r.isRotateSupported()){const l=r.rotateCounterClockwise(),f=this.doDecode(l,i),d=f.getResultMetadata();let g=270;d!==null&&d.get(bt.ORIENTATION)===!0&&(g=g+d.get(bt.ORIENTATION)%360),f.putMetadata(bt.ORIENTATION,g);const p=f.getResultPoints();if(p!==null){const v=l.getHeight();for(let E=0;E<p.length;E++)p[E]=new ae(v-p[E].getY()-1,p[E].getX())}return f}else throw new G}}reset(){}doDecode(r,i){const s=r.getWidth(),a=r.getHeight();let l=new B(s);const f=i&&i.get(U.TRY_HARDER)===!0,d=Math.max(1,a>>(f?8:5));let g;f?g=a:g=15;const p=Math.trunc(a/2);for(let v=0;v<g;v++){const E=Math.trunc((v+1)/2),S=(v&1)===0,_=p+d*(S?E:-E);if(_<0||_>=a)break;try{l=r.getBlackRow(_,l)}catch{continue}for(let D=0;D<2;D++){if(D===1&&(l.reverse(),i&&i.get(U.NEED_RESULT_POINT_CALLBACK)===!0)){const P=new Map;i.forEach((W,H)=>P.set(H,W)),P.delete(U.NEED_RESULT_POINT_CALLBACK),i=P}try{const P=this.decodeRow(_,l,i);if(D===1){P.putMetadata(bt.ORIENTATION,180);const W=P.getResultPoints();W!==null&&(W[0]=new ae(s-W[0].getX()-1,W[0].getY()),W[1]=new ae(s-W[1].getX()-1,W[1].getY()))}return P}catch{}}}throw new G}static recordPattern(r,i,s){const a=s.length;for(let p=0;p<a;p++)s[p]=0;const l=r.getSize();if(i>=l)throw new G;let f=!r.get(i),d=0,g=i;for(;g<l;){if(r.get(g)!==f)s[d]++;else{if(++d===a)break;s[d]=1,f=!f}g++}if(!(d===a||d===a-1&&g===l))throw new G}static recordPatternInReverse(r,i,s){let a=s.length,l=r.get(i);for(;i>0&&a>=0;)r.get(--i)!==l&&(a--,l=!l);if(a>=0)throw new G;ht.recordPattern(r,i+1,s)}static patternMatchVariance(r,i,s){const a=r.length;let l=0,f=0;for(let p=0;p<a;p++)l+=r[p],f+=i[p];if(l<f)return Number.POSITIVE_INFINITY;const d=l/f;s*=d;let g=0;for(let p=0;p<a;p++){const v=r[p],E=i[p]*d,S=v>E?v-E:E-v;if(S>s)return Number.POSITIVE_INFINITY;g+=S}return g/l}}class ee extends ht{static findStartPattern(r){const i=r.getSize(),s=r.getNextSet(0);let a=0,l=Int32Array.from([0,0,0,0,0,0]),f=s,d=!1;const g=6;for(let p=s;p<i;p++)if(r.get(p)!==d)l[a]++;else{if(a===g-1){let v=ee.MAX_AVG_VARIANCE,E=-1;for(let S=ee.CODE_START_A;S<=ee.CODE_START_C;S++){const _=ht.patternMatchVariance(l,ee.CODE_PATTERNS[S],ee.MAX_INDIVIDUAL_VARIANCE);_<v&&(v=_,E=S)}if(E>=0&&r.isRange(Math.max(0,f-(p-f)/2),f,!1))return Int32Array.from([f,p,E]);f+=l[0]+l[1],l=l.slice(2,l.length-1),l[a-1]=0,l[a]=0,a--}else a++;l[a]=1,d=!d}throw new G}static decodeCode(r,i,s){ht.recordPattern(r,s,i);let a=ee.MAX_AVG_VARIANCE,l=-1;for(let f=0;f<ee.CODE_PATTERNS.length;f++){const d=ee.CODE_PATTERNS[f],g=this.patternMatchVariance(i,d,ee.MAX_INDIVIDUAL_VARIANCE);g<a&&(a=g,l=f)}if(l>=0)return l;throw new G}decodeRow(r,i,s){const a=s&&s.get(U.ASSUME_GS1)===!0,l=ee.findStartPattern(i),f=l[2];let d=0;const g=new Uint8Array(20);g[d++]=f;let p;switch(f){case ee.CODE_START_A:p=ee.CODE_CODE_A;break;case ee.CODE_START_B:p=ee.CODE_CODE_B;break;case ee.CODE_START_C:p=ee.CODE_CODE_C;break;default:throw new F}let v=!1,E=!1,S="",_=l[0],D=l[1];const P=Int32Array.from([0,0,0,0,0,0]);let W=0,H=0,q=f,J=0,Z=!0,Ae=!1,we=!1;for(;!v;){const Hi=E;switch(E=!1,W=H,H=ee.decodeCode(i,P,D),g[d++]=H,H!==ee.CODE_STOP&&(Z=!0),H!==ee.CODE_STOP&&(J++,q+=J*H),_=D,D+=P.reduce((P3,L3)=>P3+L3,0),H){case ee.CODE_START_A:case ee.CODE_START_B:case ee.CODE_START_C:throw new F}switch(p){case ee.CODE_CODE_A:if(H<64)we===Ae?S+=String.fromCharCode(32+H):S+=String.fromCharCode(32+H+128),we=!1;else if(H<96)we===Ae?S+=String.fromCharCode(H-64):S+=String.fromCharCode(H+64),we=!1;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_A:!Ae&&we?(Ae=!0,we=!1):Ae&&we?(Ae=!1,we=!1):we=!0;break;case ee.CODE_SHIFT:E=!0,p=ee.CODE_CODE_B;break;case ee.CODE_CODE_B:p=ee.CODE_CODE_B;break;case ee.CODE_CODE_C:p=ee.CODE_CODE_C;break;case ee.CODE_STOP:v=!0;break}break;case ee.CODE_CODE_B:if(H<96)we===Ae?S+=String.fromCharCode(32+H):S+=String.fromCharCode(32+H+128),we=!1;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_B:!Ae&&we?(Ae=!0,we=!1):Ae&&we?(Ae=!1,we=!1):we=!0;break;case ee.CODE_SHIFT:E=!0,p=ee.CODE_CODE_A;break;case ee.CODE_CODE_A:p=ee.CODE_CODE_A;break;case ee.CODE_CODE_C:p=ee.CODE_CODE_C;break;case ee.CODE_STOP:v=!0;break}break;case ee.CODE_CODE_C:if(H<100)H<10&&(S+="0"),S+=H;else switch(H!==ee.CODE_STOP&&(Z=!1),H){case ee.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case ee.CODE_CODE_A:p=ee.CODE_CODE_A;break;case ee.CODE_CODE_B:p=ee.CODE_CODE_B;break;case ee.CODE_STOP:v=!0;break}break}Hi&&(p=p===ee.CODE_CODE_A?ee.CODE_CODE_B:ee.CODE_CODE_A)}const tr=D-_;if(D=i.getNextUnset(D),!i.isRange(D,Math.min(i.getSize(),D+(D-_)/2),!1))throw new G;if(q-=J*W,q%103!==W)throw new T;const Dr=S.length;if(Dr===0)throw new G;Dr>0&&Z&&(p===ee.CODE_CODE_C?S=S.substring(0,Dr-2):S=S.substring(0,Dr-1));const rr=(l[1]+l[0])/2,Ue=_+tr/2,kt=g.length,fr=new Uint8Array(kt);for(let Hi=0;Hi<kt;Hi++)fr[Hi]=g[Hi];const Vi=[new ae(rr,r),new ae(Ue,r)];return new Ze(S,fr,0,Vi,le.CODE_128,new Date().getTime())}}ee.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],ee.MAX_AVG_VARIANCE=.25,ee.MAX_INDIVIDUAL_VARIANCE=.7,ee.CODE_SHIFT=98,ee.CODE_CODE_C=99,ee.CODE_CODE_B=100,ee.CODE_CODE_A=101,ee.CODE_FNC_1=102,ee.CODE_FNC_2=97,ee.CODE_FNC_3=96,ee.CODE_FNC_4_A=101,ee.CODE_FNC_4_B=100,ee.CODE_START_A=103,ee.CODE_START_B=104,ee.CODE_START_C=105,ee.CODE_STOP=106;class mt extends ht{constructor(r=!1,i=!1){super(),this.usingCheckDigit=r,this.extendedMode=i,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(r,i,s){let a=this.counters;a.fill(0),this.decodeRowResult="";let l=mt.findAsteriskPattern(i,a),f=i.getNextSet(l[1]),d=i.getSize(),g,p;do{mt.recordPattern(i,f,a);let P=mt.toNarrowWidePattern(a);if(P<0)throw new G;g=mt.patternToChar(P),this.decodeRowResult+=g,p=f;for(let W of a)f+=W;f=i.getNextSet(f)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let v=0;for(let P of a)v+=P;let E=f-p-v;if(f!==d&&E*2<v)throw new G;if(this.usingCheckDigit){let P=this.decodeRowResult.length-1,W=0;for(let H=0;H<P;H++)W+=mt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(H));if(this.decodeRowResult.charAt(P)!==mt.ALPHABET_STRING.charAt(W%43))throw new T;this.decodeRowResult=this.decodeRowResult.substring(0,P)}if(this.decodeRowResult.length===0)throw new G;let S;this.extendedMode?S=mt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let _=(l[1]+l[0])/2,D=p+v/2;return new Ze(S,null,0,[new ae(_,r),new ae(D,r)],le.CODE_39,new Date().getTime())}static findAsteriskPattern(r,i){let s=r.getSize(),a=r.getNextSet(0),l=0,f=a,d=!1,g=i.length;for(let p=a;p<s;p++)if(r.get(p)!==d)i[l]++;else{if(l===g-1){if(this.toNarrowWidePattern(i)===mt.ASTERISK_ENCODING&&r.isRange(Math.max(0,f-Math.floor((p-f)/2)),f,!1))return[f,p];f+=i[0]+i[1],i.copyWithin(0,2,2+l-1),i[l-1]=0,i[l]=0,l--}else l++;i[l]=1,d=!d}throw new G}static toNarrowWidePattern(r){let i=r.length,s=0,a;do{let l=2147483647;for(let g of r)g<l&&g>s&&(l=g);s=l,a=0;let f=0,d=0;for(let g=0;g<i;g++){let p=r[g];p>s&&(d|=1<<i-1-g,a++,f+=p)}if(a===3){for(let g=0;g<i&&a>0;g++){let p=r[g];if(p>s&&(a--,p*2>=f))return-1}return d}}while(a>3);return-1}static patternToChar(r){for(let i=0;i<mt.CHARACTER_ENCODINGS.length;i++)if(mt.CHARACTER_ENCODINGS[i]===r)return mt.ALPHABET_STRING.charAt(i);if(r===mt.ASTERISK_ENCODING)return"*";throw new G}static decodeExtended(r){let i=r.length,s="";for(let a=0;a<i;a++){let l=r.charAt(a);if(l==="+"||l==="$"||l==="%"||l==="/"){let f=r.charAt(a+1),d="\0";switch(l){case"+":if(f>="A"&&f<="Z")d=String.fromCharCode(f.charCodeAt(0)+32);else throw new F;break;case"$":if(f>="A"&&f<="Z")d=String.fromCharCode(f.charCodeAt(0)-64);else throw new F;break;case"%":if(f>="A"&&f<="E")d=String.fromCharCode(f.charCodeAt(0)-38);else if(f>="F"&&f<="J")d=String.fromCharCode(f.charCodeAt(0)-11);else if(f>="K"&&f<="O")d=String.fromCharCode(f.charCodeAt(0)+16);else if(f>="P"&&f<="T")d=String.fromCharCode(f.charCodeAt(0)+43);else if(f==="U")d="\0";else if(f==="V")d="@";else if(f==="W")d="`";else if(f==="X"||f==="Y"||f==="Z")d="";else throw new F;break;case"/":if(f>="A"&&f<="O")d=String.fromCharCode(f.charCodeAt(0)-32);else if(f==="Z")d=":";else throw new F;break}s+=d,a++}else s+=l}return s}}mt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",mt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],mt.ASTERISK_ENCODING=148;class Be extends ht{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(r,i,s){let a=this.decodeStart(i),l=this.decodeEnd(i),f=new pe;Be.decodeMiddle(i,a[1],l[0],f);let d=f.toString(),g=null;s!=null&&(g=s.get(U.ALLOWED_LENGTHS)),g==null&&(g=Be.DEFAULT_ALLOWED_LENGTHS);let p=d.length,v=!1,E=0;for(let D of g){if(p===D){v=!0;break}D>E&&(E=D)}if(!v&&p>E&&(v=!0),!v)throw new F;const S=[new ae(a[1],r),new ae(l[0],r)];return new Ze(d,null,0,S,le.ITF,new Date().getTime())}static decodeMiddle(r,i,s,a){let l=new Int32Array(10),f=new Int32Array(5),d=new Int32Array(5);for(l.fill(0),f.fill(0),d.fill(0);i<s;){ht.recordPattern(r,i,l);for(let p=0;p<5;p++){let v=2*p;f[p]=l[v],d[p]=l[v+1]}let g=Be.decodeDigit(f);a.append(g.toString()),g=this.decodeDigit(d),a.append(g.toString()),l.forEach(function(p){i+=p})}}decodeStart(r){let i=Be.skipWhiteSpace(r),s=Be.findGuardPattern(r,i,Be.START_PATTERN);return this.narrowLineWidth=(s[1]-s[0])/4,this.validateQuietZone(r,s[0]),s}validateQuietZone(r,i){let s=this.narrowLineWidth*10;s=s<i?s:i;for(let a=i-1;s>0&&a>=0&&!r.get(a);a--)s--;if(s!==0)throw new G}static skipWhiteSpace(r){const i=r.getSize(),s=r.getNextSet(0);if(s===i)throw new G;return s}decodeEnd(r){r.reverse();try{let i=Be.skipWhiteSpace(r),s;try{s=Be.findGuardPattern(r,i,Be.END_PATTERN_REVERSED[0])}catch(l){l instanceof G&&(s=Be.findGuardPattern(r,i,Be.END_PATTERN_REVERSED[1]))}this.validateQuietZone(r,s[0]);let a=s[0];return s[0]=r.getSize()-s[1],s[1]=r.getSize()-a,s}finally{r.reverse()}}static findGuardPattern(r,i,s){let a=s.length,l=new Int32Array(a),f=r.getSize(),d=!1,g=0,p=i;l.fill(0);for(let v=i;v<f;v++)if(r.get(v)!==d)l[g]++;else{if(g===a-1){if(ht.patternMatchVariance(l,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[p,v];p+=l[0]+l[1],M.arraycopy(l,2,l,0,g-1),l[g-1]=0,l[g]=0,g--}else g++;l[g]=1,d=!d}throw new G}static decodeDigit(r){let i=Be.MAX_AVG_VARIANCE,s=-1,a=Be.PATTERNS.length;for(let l=0;l<a;l++){let f=Be.PATTERNS[l],d=ht.patternMatchVariance(r,f,Be.MAX_INDIVIDUAL_VARIANCE);d<i?(i=d,s=l):d===i&&(s=-1)}if(s>=0)return s%10;throw new G}}Be.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Be.MAX_AVG_VARIANCE=.38,Be.MAX_INDIVIDUAL_VARIANCE=.5,Be.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Be.START_PATTERN=Int32Array.from([1,1,1,1]),Be.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class nt extends ht{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(r){let i=!1,s,a=0,l=Int32Array.from([0,0,0]);for(;!i;){l=Int32Array.from([0,0,0]),s=nt.findGuardPattern(r,a,!1,this.START_END_PATTERN,l);let f=s[0];a=s[1];let d=f-(a-f);d>=0&&(i=r.isRange(d,f,!1))}return s}static checkChecksum(r){return nt.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return nt.getStandardUPCEANChecksum(r.substring(0,i-1))===s}static getStandardUPCEANChecksum(r){let i=r.length,s=0;for(let a=i-1;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}s*=3;for(let a=i-2;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}return(1e3-s)%10}static decodeEnd(r,i){return nt.findGuardPattern(r,i,!1,nt.START_END_PATTERN,new Int32Array(nt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(r,i,s,a){return this.findGuardPattern(r,i,s,a,new Int32Array(a.length))}static findGuardPattern(r,i,s,a,l){let f=r.getSize();i=s?r.getNextUnset(i):r.getNextSet(i);let d=0,g=i,p=a.length,v=s;for(let E=i;E<f;E++)if(r.get(E)!==v)l[d]++;else{if(d===p-1){if(ht.patternMatchVariance(l,a,nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return Int32Array.from([g,E]);g+=l[0]+l[1];let S=l.slice(2,l.length-1);for(let _=0;_<d-1;_++)l[_]=S[_];l[d-1]=0,l[d]=0,d--}else d++;l[d]=1,v=!v}throw new G}static decodeDigit(r,i,s,a){this.recordPattern(r,s,i);let l=this.MAX_AVG_VARIANCE,f=-1,d=a.length;for(let g=0;g<d;g++){let p=a[g],v=ht.patternMatchVariance(i,p,nt.MAX_INDIVIDUAL_VARIANCE);v<l&&(l=v,f=g)}if(f>=0)return f;throw new G}}nt.MAX_AVG_VARIANCE=.48,nt.MAX_INDIVIDUAL_VARIANCE=.7,nt.START_END_PATTERN=Int32Array.from([1,1,1]),nt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),nt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),nt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class js{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(r,i,s){let a=this.decodeRowStringBuffer,l=this.decodeMiddle(i,s,a),f=a.toString(),d=js.parseExtensionString(f),g=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ze(f,null,0,g,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&p.putAllMetadata(d),p}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let p=0;p<5&&f<l;p++){let v=nt.decodeDigit(r,a,f,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<4-p),p!==4&&(f=r.getNextSet(f),f=r.getNextUnset(f))}if(s.length!==5)throw new G;let g=this.determineCheckDigit(d);if(js.extensionChecksum(s.toString())!==g)throw new G;return f}static extensionChecksum(r){let i=r.length,s=0;for(let a=i-2;a>=0;a-=2)s+=r.charAt(a).charCodeAt(0)-48;s*=3;for(let a=i-1;a>=0;a-=2)s+=r.charAt(a).charCodeAt(0)-48;return s*=3,s%10}determineCheckDigit(r){for(let i=0;i<10;i++)if(r===this.CHECK_DIGIT_ENCODINGS[i])return i;throw new G}static parseExtensionString(r){if(r.length!==5)return null;let i=js.parseExtension5String(r);return i==null?null:new Map([[bt.SUGGESTED_PRICE,i]])}static parseExtension5String(r){let i;switch(r.charAt(0)){case"0":i="£";break;case"5":i="$";break;case"9":switch(r){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}i="";break;default:i="";break}let s=parseInt(r.substring(1)),a=(s/100).toString(),l=s%100,f=l<10?"0"+l:l.toString();return i+a+"."+f}}class tu{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(r,i,s){let a=this.decodeRowStringBuffer,l=this.decodeMiddle(i,s,a),f=a.toString(),d=tu.parseExtensionString(f),g=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ze(f,null,0,g,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&p.putAllMetadata(d),p}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let g=0;g<2&&f<l;g++){let p=nt.decodeDigit(r,a,f,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+p%10);for(let v of a)f+=v;p>=10&&(d|=1<<1-g),g!==1&&(f=r.getNextSet(f),f=r.getNextUnset(f))}if(s.length!==2)throw new G;if(parseInt(s.toString())%4!==d)throw new G;return f}static parseExtensionString(r){return r.length!==2?null:new Map([[bt.ISSUE_NUMBER,parseInt(r)]])}}class Y0{static decodeRow(r,i,s){let a=nt.findGuardPattern(i,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new js().decodeRow(r,i,a)}catch{return new tu().decodeRow(r,i,a)}}}Y0.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ke extends nt{constructor(){super(),this.decodeRowStringBuffer="",ke.L_AND_G_PATTERNS=ke.L_PATTERNS.map(r=>Int32Array.from(r));for(let r=10;r<20;r++){let i=ke.L_PATTERNS[r-10],s=new Int32Array(i.length);for(let a=0;a<i.length;a++)s[a]=i[i.length-a-1];ke.L_AND_G_PATTERNS[r]=s}}decodeRow(r,i,s){let a=ke.findStartGuardPattern(i),l=s==null?null:s.get(U.NEED_RESULT_POINT_CALLBACK);if(l!=null){const Z=new ae((a[0]+a[1])/2,r);l.foundPossibleResultPoint(Z)}let f=this.decodeMiddle(i,a,this.decodeRowStringBuffer),d=f.rowOffset,g=f.resultString;if(l!=null){const Z=new ae(d,r);l.foundPossibleResultPoint(Z)}let p=this.decodeEnd(i,d);if(l!=null){const Z=new ae((p[0]+p[1])/2,r);l.foundPossibleResultPoint(Z)}let v=p[1],E=v+(v-p[0]);if(E>=i.getSize()||!i.isRange(v,E,!1))throw new G;let S=g.toString();if(S.length<8)throw new F;if(!ke.checkChecksum(S))throw new T;let _=(a[1]+a[0])/2,D=(p[1]+p[0])/2,P=this.getBarcodeFormat(),W=[new ae(_,r),new ae(D,r)],H=new Ze(S,null,0,W,P,new Date().getTime()),q=0;try{let Z=Y0.decodeRow(r,i,p[1]);H.putMetadata(bt.UPC_EAN_EXTENSION,Z.getText()),H.putAllMetadata(Z.getResultMetadata()),H.addResultPoints(Z.getResultPoints()),q=Z.getText().length}catch{}let J=s==null?null:s.get(U.ALLOWED_EAN_EXTENSIONS);if(J!=null){let Z=!1;for(let Ae in J)if(q.toString()===Ae){Z=!0;break}if(!Z)throw new G}return H}decodeEnd(r,i){return ke.findGuardPattern(r,i,!1,ke.START_END_PATTERN,new Int32Array(ke.START_END_PATTERN.length).fill(0))}static checkChecksum(r){return ke.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return ke.getStandardUPCEANChecksum(r.substring(0,i-1))===s}static getStandardUPCEANChecksum(r){let i=r.length,s=0;for(let a=i-1;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}s*=3;for(let a=i-2;a>=0;a-=2){let l=r.charAt(a).charCodeAt(0)-48;if(l<0||l>9)throw new F;s+=l}return(1e3-s)%10}}class ai extends ke{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(r,i,s){let a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1],d=0;for(let p=0;p<6&&f<l;p++){let v=ke.decodeDigit(r,a,f,ke.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<5-p)}s=ai.determineFirstDigit(s,d),f=ke.findGuardPattern(r,f,!0,ke.MIDDLE_PATTERN,new Int32Array(ke.MIDDLE_PATTERN.length).fill(0))[1];for(let p=0;p<6&&f<l;p++){let v=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+v);for(let E of a)f+=E}return{rowOffset:f,resultString:s}}getBarcodeFormat(){return le.EAN_13}static determineFirstDigit(r,i){for(let s=0;s<10;s++)if(i===this.FIRST_DIGIT_ENCODINGS[s])return r=String.fromCharCode(48+s)+r,r;throw new G}}ai.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class K0 extends ke{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(r,i,s){const a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f=i[1];for(let g=0;g<4&&f<l;g++){let p=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+p);for(let v of a)f+=v}f=ke.findGuardPattern(r,f,!0,ke.MIDDLE_PATTERN,new Int32Array(ke.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&f<l;g++){let p=ke.decodeDigit(r,a,f,ke.L_PATTERNS);s+=String.fromCharCode(48+p);for(let v of a)f+=v}return{rowOffset:f,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class Z0 extends ke{constructor(){super(...arguments),this.ean13Reader=new ai}getBarcodeFormat(){return le.UPC_A}decode(r,i){return this.maybeReturnResult(this.ean13Reader.decode(r))}decodeRow(r,i,s){return this.maybeReturnResult(this.ean13Reader.decodeRow(r,i,s))}decodeMiddle(r,i,s){return this.ean13Reader.decodeMiddle(r,i,s)}maybeReturnResult(r){let i=r.getText();if(i.charAt(0)==="0"){let s=new Ze(i.substring(1),null,null,r.getResultPoints(),le.UPC_A);return r.getResultMetadata()!=null&&s.putAllMetadata(r.getResultMetadata()),s}else throw new G}reset(){this.ean13Reader.reset()}}class Mr extends ke{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(r,i,s){const a=this.decodeMiddleCounters.map(p=>p);a[0]=0,a[1]=0,a[2]=0,a[3]=0;const l=r.getSize();let f=i[1],d=0;for(let p=0;p<6&&f<l;p++){const v=Mr.decodeDigit(r,a,f,Mr.L_AND_G_PATTERNS);s+=String.fromCharCode(48+v%10);for(let E of a)f+=E;v>=10&&(d|=1<<5-p)}let g=Mr.determineNumSysAndCheckDigit(s,d);return{rowOffset:f,resultString:g}}decodeEnd(r,i){return Mr.findGuardPatternWithoutCounters(r,i,!0,Mr.MIDDLE_END_PATTERN)}checkChecksum(r){return ke.checkChecksum(Mr.convertUPCEtoUPCA(r))}static determineNumSysAndCheckDigit(r,i){for(let s=0;s<=1;s++)for(let a=0;a<10;a++)if(i===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[s][a]){let l=String.fromCharCode(48+s),f=String.fromCharCode(48+a);return l+r+f}throw G.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(r){const i=r.slice(1,7).split("").map(l=>l.charCodeAt(0)),s=new pe;s.append(r.charAt(0));let a=i[5];switch(a){case 0:case 1:case 2:s.appendChars(i,0,2),s.append(a),s.append("0000"),s.appendChars(i,2,3);break;case 3:s.appendChars(i,0,3),s.append("00000"),s.appendChars(i,3,2);break;case 4:s.appendChars(i,0,4),s.append("00000"),s.append(i[4]);break;default:s.appendChars(i,0,5),s.append("0000"),s.append(a);break}return r.length>=8&&s.append(r.charAt(7)),s.toString()}}Mr.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Mr.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class ru extends ht{constructor(r){super();let i=r==null?null:r.get(U.POSSIBLE_FORMATS),s=[];o(i)?(s.push(new ai),s.push(new Z0),s.push(new K0),s.push(new Mr)):(i.indexOf(le.EAN_13)>-1&&s.push(new ai),i.indexOf(le.UPC_A)>-1&&s.push(new Z0),i.indexOf(le.EAN_8)>-1&&s.push(new K0),i.indexOf(le.UPC_E)>-1&&s.push(new Mr)),this.readers=s}decodeRow(r,i,s){for(let a of this.readers)try{const l=a.decodeRow(r,i,s),f=l.getBarcodeFormat()===le.EAN_13&&l.getText().charAt(0)==="0",d=s==null?null:s.get(U.POSSIBLE_FORMATS),g=d==null||d.includes(le.UPC_A);if(f&&g){const p=l.getRawBytes(),v=new Ze(l.getText().substring(1),p,p?p.length:null,l.getResultPoints(),le.UPC_A);return v.putAllMetadata(l.getResultMetadata()),v}return l}catch{}throw new G}reset(){for(let r of this.readers)r.reset()}}class Ft extends ht{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(r,i){for(let s=0;s<i.length;s++)if(ht.patternMatchVariance(r,i[s],Ft.MAX_INDIVIDUAL_VARIANCE)<Ft.MAX_AVG_VARIANCE)return s;throw new G}static count(r){return Re.sum(new Int32Array(r))}static increment(r,i){let s=0,a=i[0];for(let l=1;l<r.length;l++)i[l]>a&&(a=i[l],s=l);r[s]++}static decrement(r,i){let s=0,a=i[0];for(let l=1;l<r.length;l++)i[l]<a&&(a=i[l],s=l);r[s]--}static isFinderPattern(r){let i=r[0]+r[1],s=i+r[2]+r[3],a=i/s;if(a>=Ft.MIN_FINDER_PATTERN_RATIO&&a<=Ft.MAX_FINDER_PATTERN_RATIO){let l=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;for(let d of r)d>f&&(f=d),d<l&&(l=d);return f<10*l}return!1}}Ft.MAX_AVG_VARIANCE=.2,Ft.MAX_INDIVIDUAL_VARIANCE=.45,Ft.MIN_FINDER_PATTERN_RATIO=9.5/12,Ft.MAX_FINDER_PATTERN_RATIO=12.5/14;class Bi{constructor(r,i){this.value=r,this.checksumPortion=i}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(r){if(!(r instanceof Bi))return!1;const i=r;return this.value===i.value&&this.checksumPortion===i.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ya{constructor(r,i,s,a,l){this.value=r,this.startEnd=i,this.value=r,this.startEnd=i,this.resultPoints=new Array,this.resultPoints.push(new ae(s,l)),this.resultPoints.push(new ae(a,l))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(r){if(!(r instanceof ya))return!1;const i=r;return this.value===i.value}hashCode(){return this.value}}class Yr{constructor(){}static getRSSvalue(r,i,s){let a=0;for(let g of r)a+=g;let l=0,f=0,d=r.length;for(let g=0;g<d-1;g++){let p;for(p=1,f|=1<<g;p<r[g];p++,f&=~(1<<g)){let v=Yr.combins(a-p-1,d-g-2);if(s&&f===0&&a-p-(d-g-1)>=d-g-1&&(v-=Yr.combins(a-p-(d-g),d-g-2)),d-g-1>1){let E=0;for(let S=a-p-(d-g-2);S>i;S--)E+=Yr.combins(a-p-S-1,d-g-3);v-=E*(d-1-g)}else a-p>i&&v--;l+=v}a-=p}return l}static combins(r,i){let s,a;r-i>i?(a=i,s=r-i):(a=r-i,s=i);let l=1,f=1;for(let d=r;d>s;d--)l*=d,f<=a&&(l/=f,f++);for(;f<=a;)l/=f,f++;return l}}class a3{static buildBitArray(r){let i=r.length*2-1;r[r.length-1].getRightChar()==null&&(i-=1);let s=12*i,a=new B(s),l=0,d=r[0].getRightChar().getValue();for(let g=11;g>=0;--g)d&1<<g&&a.set(l),l++;for(let g=1;g<r.length;++g){let p=r[g],v=p.getLeftChar().getValue();for(let E=11;E>=0;--E)v&1<<E&&a.set(l),l++;if(p.getRightChar()!=null){let E=p.getRightChar().getValue();for(let S=11;S>=0;--S)E&1<<S&&a.set(l),l++}}return a}}class li{constructor(r,i){i?this.decodedInformation=null:(this.finished=r,this.decodedInformation=i)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class nu{constructor(r){this.newPosition=r}getNewPosition(){return this.newPosition}}class qt extends nu{constructor(r,i){super(r),this.value=i}getValue(){return this.value}isFNC1(){return this.value===qt.FNC1}}qt.FNC1="$";class ci extends nu{constructor(r,i,s){super(r),s?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=i}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Cr extends nu{constructor(r,i,s){if(super(r),i<0||i>10||s<0||s>10)throw new F;this.firstDigit=i,this.secondDigit=s}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Cr.FNC1}isSecondDigitFNC1(){return this.secondDigit===Cr.FNC1}isAnyFNC1(){return this.firstDigit===Cr.FNC1||this.secondDigit===Cr.FNC1}}Cr.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(r){if(!r)return null;if(r.length<2)throw new G;let i=r.substring(0,2);for(let l of ne.TWO_DIGIT_DATA_LENGTH)if(l[0]===i)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(2,l[2],r):ne.processFixedAI(2,l[1],r);if(r.length<3)throw new G;let s=r.substring(0,3);for(let l of ne.THREE_DIGIT_DATA_LENGTH)if(l[0]===s)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(3,l[2],r):ne.processFixedAI(3,l[1],r);for(let l of ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(l[0]===s)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,l[2],r):ne.processFixedAI(4,l[1],r);if(r.length<4)throw new G;let a=r.substring(0,4);for(let l of ne.FOUR_DIGIT_DATA_LENGTH)if(l[0]===a)return l[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,l[2],r):ne.processFixedAI(4,l[1],r);throw new G}static processFixedAI(r,i,s){if(s.length<r)throw new G;let a=s.substring(0,r);if(s.length<r+i)throw new G;let l=s.substring(r,r+i),f=s.substring(r+i),d="("+a+")"+l,g=ne.parseFieldsInGeneralPurpose(f);return g==null?d:d+g}static processVariableAI(r,i,s){let a=s.substring(0,r),l;s.length<r+i?l=s.length:l=r+i;let f=s.substring(r,l),d=s.substring(l),g="("+a+")"+f,p=ne.parseFieldsInGeneralPurpose(d);return p==null?g:g+p}}ne.VARIABLE_LENGTH=[],ne.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ne.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ne.VARIABLE_LENGTH,20],["22",ne.VARIABLE_LENGTH,29],["30",ne.VARIABLE_LENGTH,8],["37",ne.VARIABLE_LENGTH,8],["90",ne.VARIABLE_LENGTH,30],["91",ne.VARIABLE_LENGTH,30],["92",ne.VARIABLE_LENGTH,30],["93",ne.VARIABLE_LENGTH,30],["94",ne.VARIABLE_LENGTH,30],["95",ne.VARIABLE_LENGTH,30],["96",ne.VARIABLE_LENGTH,30],["97",ne.VARIABLE_LENGTH,3],["98",ne.VARIABLE_LENGTH,30],["99",ne.VARIABLE_LENGTH,30]],ne.THREE_DIGIT_DATA_LENGTH=[["240",ne.VARIABLE_LENGTH,30],["241",ne.VARIABLE_LENGTH,30],["242",ne.VARIABLE_LENGTH,6],["250",ne.VARIABLE_LENGTH,30],["251",ne.VARIABLE_LENGTH,30],["253",ne.VARIABLE_LENGTH,17],["254",ne.VARIABLE_LENGTH,20],["400",ne.VARIABLE_LENGTH,30],["401",ne.VARIABLE_LENGTH,30],["402",17],["403",ne.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ne.VARIABLE_LENGTH,20],["421",ne.VARIABLE_LENGTH,15],["422",3],["423",ne.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",ne.VARIABLE_LENGTH,15],["391",ne.VARIABLE_LENGTH,18],["392",ne.VARIABLE_LENGTH,15],["393",ne.VARIABLE_LENGTH,18],["703",ne.VARIABLE_LENGTH,30]],ne.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ne.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ne.VARIABLE_LENGTH,20],["8003",ne.VARIABLE_LENGTH,30],["8004",ne.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ne.VARIABLE_LENGTH,30],["8008",ne.VARIABLE_LENGTH,12],["8018",18],["8020",ne.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ne.VARIABLE_LENGTH,70],["8200",ne.VARIABLE_LENGTH,70]];class Fi{constructor(r){this.buffer=new pe,this.information=r}decodeAllCodes(r,i){let s=i,a=null;do{let l=this.decodeGeneralPurposeField(s,a),f=ne.parseFieldsInGeneralPurpose(l.getNewString());if(f!=null&&r.append(f),l.isRemaining()?a=""+l.getRemainingValue():a=null,s===l.getNewPosition())break;s=l.getNewPosition()}while(!0);return r.toString()}isStillNumeric(r){if(r+7>this.information.getSize())return r+4<=this.information.getSize();for(let i=r;i<r+3;++i)if(this.information.get(i))return!0;return this.information.get(r+3)}decodeNumeric(r){if(r+7>this.information.getSize()){let l=this.extractNumericValueFromBitArray(r,4);return l===0?new Cr(this.information.getSize(),Cr.FNC1,Cr.FNC1):new Cr(this.information.getSize(),l-1,Cr.FNC1)}let i=this.extractNumericValueFromBitArray(r,7),s=(i-8)/11,a=(i-8)%11;return new Cr(r+7,s,a)}extractNumericValueFromBitArray(r,i){return Fi.extractNumericValueFromBitArray(this.information,r,i)}static extractNumericValueFromBitArray(r,i,s){let a=0;for(let l=0;l<s;++l)r.get(i+l)&&(a|=1<<s-l-1);return a}decodeGeneralPurposeField(r,i){this.buffer.setLengthToZero(),i!=null&&this.buffer.append(i),this.current.setPosition(r);let s=this.parseBlocks();return s!=null&&s.isRemaining()?new ci(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new ci(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let r,i;do{let s=this.current.getPosition();if(this.current.isAlpha()?(i=this.parseAlphaBlock(),r=i.isFinished()):this.current.isIsoIec646()?(i=this.parseIsoIec646Block(),r=i.isFinished()):(i=this.parseNumericBlock(),r=i.isFinished()),!(s!==this.current.getPosition())&&!r)break}while(!r);return i.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let r=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFirstDigitFNC1()){let i;return r.isSecondDigitFNC1()?i=new ci(this.current.getPosition(),this.buffer.toString()):i=new ci(this.current.getPosition(),this.buffer.toString(),r.getSecondDigit()),new li(!0,i)}if(this.buffer.append(r.getFirstDigit()),r.isSecondDigitFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new li(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let r=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new li(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let r=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(r.getNewPosition()),r.isFNC1()){let i=new ci(this.current.getPosition(),this.buffer.toString());return new li(!0,i)}this.buffer.append(r.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new li(!1)}isStillIsoIec646(r){if(r+5>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(r,5);if(i>=5&&i<16)return!0;if(r+7>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(r,7);if(s>=64&&s<116)return!0;if(r+8>this.information.getSize())return!1;let a=this.extractNumericValueFromBitArray(r,8);return a>=232&&a<253}decodeIsoIec646(r){let i=this.extractNumericValueFromBitArray(r,5);if(i===15)return new qt(r+5,qt.FNC1);if(i>=5&&i<15)return new qt(r+5,"0"+(i-5));let s=this.extractNumericValueFromBitArray(r,7);if(s>=64&&s<90)return new qt(r+7,""+(s+1));if(s>=90&&s<116)return new qt(r+7,""+(s+7));let a=this.extractNumericValueFromBitArray(r,8),l;switch(a){case 232:l="!";break;case 233:l='"';break;case 234:l="%";break;case 235:l="&";break;case 236:l="'";break;case 237:l="(";break;case 238:l=")";break;case 239:l="*";break;case 240:l="+";break;case 241:l=",";break;case 242:l="-";break;case 243:l=".";break;case 244:l="/";break;case 245:l=":";break;case 246:l=";";break;case 247:l="<";break;case 248:l="=";break;case 249:l=">";break;case 250:l="?";break;case 251:l="_";break;case 252:l=" ";break;default:throw new F}return new qt(r+8,l)}isStillAlpha(r){if(r+5>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(r,5);if(i>=5&&i<16)return!0;if(r+6>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(r,6);return s>=16&&s<63}decodeAlphanumeric(r){let i=this.extractNumericValueFromBitArray(r,5);if(i===15)return new qt(r+5,qt.FNC1);if(i>=5&&i<15)return new qt(r+5,"0"+(i-5));let s=this.extractNumericValueFromBitArray(r,6);if(s>=32&&s<58)return new qt(r+6,""+(s+33));let a;switch(s){case 58:a="*";break;case 59:a=",";break;case 60:a="-";break;case 61:a=".";break;case 62:a="/";break;default:throw new Xr("Decoding invalid alphanumeric value: "+s)}return new qt(r+6,a)}isAlphaTo646ToAlphaLatch(r){if(r+1>this.information.getSize())return!1;for(let i=0;i<5&&i+r<this.information.getSize();++i)if(i===2){if(!this.information.get(r+2))return!1}else if(this.information.get(r+i))return!1;return!0}isAlphaOr646ToNumericLatch(r){if(r+3>this.information.getSize())return!1;for(let i=r;i<r+3;++i)if(this.information.get(i))return!1;return!0}isNumericToAlphaNumericLatch(r){if(r+1>this.information.getSize())return!1;for(let i=0;i<4&&i+r<this.information.getSize();++i)if(this.information.get(r+i))return!1;return!0}}class iu{constructor(r){this.information=r,this.generalDecoder=new Fi(r)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Jt extends iu{constructor(r){super(r)}encodeCompressedGtin(r,i){r.append("(01)");let s=r.length();r.append("9"),this.encodeCompressedGtinWithoutAI(r,i,s)}encodeCompressedGtinWithoutAI(r,i,s){for(let a=0;a<4;++a){let l=this.getGeneralDecoder().extractNumericValueFromBitArray(i+10*a,10);l/100===0&&r.append("0"),l/10===0&&r.append("0"),r.append(l)}Jt.appendCheckDigit(r,s)}static appendCheckDigit(r,i){let s=0;for(let a=0;a<13;a++){let l=r.charAt(a+i).charCodeAt(0)-48;s+=a&1?l:3*l}s=10-s%10,s===10&&(s=0),r.append(s)}}Jt.GTIN_SIZE=40;class Ui extends Jt{constructor(r){super(r)}parseInformation(){let r=new pe;r.append("(01)");let i=r.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ui.HEADER_SIZE,4);return r.append(s),this.encodeCompressedGtinWithoutAI(r,Ui.HEADER_SIZE+4,i),this.getGeneralDecoder().decodeAllCodes(r,Ui.HEADER_SIZE+44)}}Ui.HEADER_SIZE=4;class Ea extends iu{constructor(r){super(r)}parseInformation(){let r=new pe;return this.getGeneralDecoder().decodeAllCodes(r,Ea.HEADER_SIZE)}}Ea.HEADER_SIZE=5;class Ca extends Jt{constructor(r){super(r)}encodeCompressedWeight(r,i,s){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(i,s);this.addWeightCode(r,a);let l=this.checkWeight(a),f=1e5;for(let d=0;d<5;++d)l/f===0&&r.append("0"),f/=10;r.append(l)}}class Kr extends Ca{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()!=Kr.HEADER_SIZE+Ca.GTIN_SIZE+Kr.WEIGHT_SIZE)throw new G;let r=new pe;return this.encodeCompressedGtin(r,Kr.HEADER_SIZE),this.encodeCompressedWeight(r,Kr.HEADER_SIZE+Ca.GTIN_SIZE,Kr.WEIGHT_SIZE),r.toString()}}Kr.HEADER_SIZE=5,Kr.WEIGHT_SIZE=15;class l3 extends Kr{constructor(r){super(r)}addWeightCode(r,i){r.append("(3103)")}checkWeight(r){return r}}class c3 extends Kr{constructor(r){super(r)}addWeightCode(r,i){i<1e4?r.append("(3202)"):r.append("(3203)")}checkWeight(r){return r<1e4?r:r-1e4}}class Zr extends Jt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Zr.HEADER_SIZE+Jt.GTIN_SIZE)throw new G;let r=new pe;this.encodeCompressedGtin(r,Zr.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Zr.HEADER_SIZE+Jt.GTIN_SIZE,Zr.LAST_DIGIT_SIZE);r.append("(392"),r.append(i),r.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Zr.HEADER_SIZE+Jt.GTIN_SIZE+Zr.LAST_DIGIT_SIZE,null);return r.append(s.getNewString()),r.toString()}}Zr.HEADER_SIZE=8,Zr.LAST_DIGIT_SIZE=2;class Ht extends Jt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Ht.HEADER_SIZE+Jt.GTIN_SIZE)throw new G;let r=new pe;this.encodeCompressedGtin(r,Ht.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Jt.GTIN_SIZE,Ht.LAST_DIGIT_SIZE);r.append("(393"),r.append(i),r.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Jt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE,Ht.FIRST_THREE_DIGITS_SIZE);s/100==0&&r.append("0"),s/10==0&&r.append("0"),r.append(s);let a=this.getGeneralDecoder().decodeGeneralPurposeField(Ht.HEADER_SIZE+Jt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE+Ht.FIRST_THREE_DIGITS_SIZE,null);return r.append(a.getNewString()),r.toString()}}Ht.HEADER_SIZE=8,Ht.LAST_DIGIT_SIZE=2,Ht.FIRST_THREE_DIGITS_SIZE=10;class Xe extends Ca{constructor(r,i,s){super(r),this.dateCode=s,this.firstAIdigits=i}parseInformation(){if(this.getInformation().getSize()!=Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE+Xe.DATE_SIZE)throw new G;let r=new pe;return this.encodeCompressedGtin(r,Xe.HEADER_SIZE),this.encodeCompressedWeight(r,Xe.HEADER_SIZE+Xe.GTIN_SIZE,Xe.WEIGHT_SIZE),this.encodeCompressedDate(r,Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE),r.toString()}encodeCompressedDate(r,i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(i,Xe.DATE_SIZE);if(s==38400)return;r.append("("),r.append(this.dateCode),r.append(")");let a=s%32;s/=32;let l=s%12+1;s/=12;let f=s;f/10==0&&r.append("0"),r.append(f),l/10==0&&r.append("0"),r.append(l),a/10==0&&r.append("0"),r.append(a)}addWeightCode(r,i){r.append("("),r.append(this.firstAIdigits),r.append(i/1e5),r.append(")")}checkWeight(r){return r%1e5}}Xe.HEADER_SIZE=8,Xe.WEIGHT_SIZE=20,Xe.DATE_SIZE=16;function Q0(y){try{if(y.get(1))return new Ui(y);if(!y.get(2))return new Ea(y);switch(Fi.extractNumericValueFromBitArray(y,1,4)){case 4:return new l3(y);case 5:return new c3(y)}switch(Fi.extractNumericValueFromBitArray(y,1,5)){case 12:return new Zr(y);case 13:return new Ht(y)}switch(Fi.extractNumericValueFromBitArray(y,1,7)){case 56:return new Xe(y,"310","11");case 57:return new Xe(y,"320","11");case 58:return new Xe(y,"310","13");case 59:return new Xe(y,"320","13");case 60:return new Xe(y,"310","15");case 61:return new Xe(y,"320","15");case 62:return new Xe(y,"310","17");case 63:return new Xe(y,"320","17")}}catch(r){throw console.log(r),new Xr("unknown decoder: "+y)}}class On{constructor(r,i,s,a){this.leftchar=r,this.rightchar=i,this.finderpattern=s,this.maybeLast=a}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(r,i){return r instanceof On?On.equalsOrNull(r.leftchar,i.leftchar)&&On.equalsOrNull(r.rightchar,i.rightchar)&&On.equalsOrNull(r.finderpattern,i.finderpattern):!1}static equalsOrNull(r,i){return r===null?i===null:On.equals(r,i)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class su{constructor(r,i,s){this.pairs=r,this.rowNumber=i,this.wasReversed=s}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(r){return this.checkEqualitity(this,r)}toString(){return"{ "+this.pairs+" }"}equals(r,i){return r instanceof su?this.checkEqualitity(r,i)&&r.wasReversed===i.wasReversed:!1}checkEqualitity(r,i){if(!r||!i)return;let s;return r.forEach((a,l)=>{i.forEach(f=>{a.getLeftChar().getValue()===f.getLeftChar().getValue()&&a.getRightChar().getValue()===f.getRightChar().getValue()&&a.getFinderPatter().getValue()===f.getFinderPatter().getValue()&&(s=!0)})}),s}}class K extends Ft{constructor(r){super(...arguments),this.pairs=new Array(K.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=r===!0}decodeRow(r,i,s){this.pairs.length=0,this.startFromEven=!1;try{return K.constructResult(this.decodeRow2pairs(r,i))}catch(a){this.verbose&&console.log(a)}return this.pairs.length=0,this.startFromEven=!0,K.constructResult(this.decodeRow2pairs(r,i))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(r,i){let s=!1;for(;!s;)try{this.pairs.push(this.retrieveNextPair(i,this.pairs,r))}catch(l){if(l instanceof G){if(!this.pairs.length)throw new G;s=!0}}if(this.checkChecksum())return this.pairs;let a;if(this.rows.length?a=!0:a=!1,this.storeRow(r,!1),a){let l=this.checkRowsBoolean(!1);if(l!=null||(l=this.checkRowsBoolean(!0),l!=null))return l}throw new G}checkRowsBoolean(r){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,r&&(this.rows=this.rows.reverse());let i=null;try{i=this.checkRows(new Array,0)}catch(s){this.verbose&&console.log(s)}return r&&(this.rows=this.rows.reverse()),i}checkRows(r,i){for(let s=i;s<this.rows.length;s++){let a=this.rows[s];this.pairs.length=0;for(let f of r)this.pairs.push(f.getPairs());if(this.pairs.push(a.getPairs()),!K.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let l=new Array(r);l.push(a);try{return this.checkRows(l,s+1)}catch(f){this.verbose&&console.log(f)}}throw new G}static isValidSequence(r){for(let i of K.FINDER_PATTERN_SEQUENCES){if(r.length>i.length)continue;let s=!0;for(let a=0;a<r.length;a++)if(r[a].getFinderPattern().getValue()!=i[a]){s=!1;break}if(s)return!0}return!1}storeRow(r,i){let s=0,a=!1,l=!1;for(;s<this.rows.length;){let f=this.rows[s];if(f.getRowNumber()>r){l=f.isEquivalent(this.pairs);break}a=f.isEquivalent(this.pairs),s++}l||a||K.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new su(this.pairs,r,i)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(r,i){for(let s of i)if(s.getPairs().length!==r.length){for(let a of s.getPairs())for(let l of r)if(On.equals(a,l))break}}static isPartialRow(r,i){for(let s of i){let a=!0;for(let l of r){let f=!1;for(let d of s.getPairs())if(l.equals(d)){f=!0;break}if(!f){a=!1;break}}if(a)return!0}return!1}getRows(){return this.rows}static constructResult(r){let i=a3.buildBitArray(r),a=Q0(i).parseInformation(),l=r[0].getFinderPattern().getResultPoints(),f=r[r.length-1].getFinderPattern().getResultPoints(),d=[l[0],l[1],f[0],f[1]];return new Ze(a,null,null,d,le.RSS_EXPANDED,null)}checkChecksum(){let r=this.pairs.get(0),i=r.getLeftChar(),s=r.getRightChar();if(s==null)return!1;let a=s.getChecksumPortion(),l=2;for(let d=1;d<this.pairs.size();++d){let g=this.pairs.get(d);a+=g.getLeftChar().getChecksumPortion(),l++;let p=g.getRightChar();p!=null&&(a+=p.getChecksumPortion(),l++)}return a%=211,211*(l-4)+a==i.getValue()}static getNextSecondBar(r,i){let s;return r.get(i)?(s=r.getNextUnset(i),s=r.getNextSet(s)):(s=r.getNextSet(i),s=r.getNextUnset(s)),s}retrieveNextPair(r,i,s){let a=i.length%2==0;this.startFromEven&&(a=!a);let l,f=!0,d=-1;do this.findNextPair(r,i,d),l=this.parseFoundFinderPattern(r,s,a),l==null?d=K.getNextSecondBar(r,this.startEnd[0]):f=!1;while(f);let g=this.decodeDataCharacter(r,l,a,!0);if(!this.isEmptyPair(i)&&i[i.length-1].mustBeLast())throw new G;let p;try{p=this.decodeDataCharacter(r,l,a,!1)}catch(v){p=null,this.verbose&&console.log(v)}return new On(g,p,l,!0)}isEmptyPair(r){return r.length===0}findNextPair(r,i,s){let a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;let l=r.getSize(),f;s>=0?f=s:this.isEmptyPair(i)?f=0:f=i[i.length-1].getFinderPattern().getStartEnd()[1];let d=i.length%2!=0;this.startFromEven&&(d=!d);let g=!1;for(;f<l&&(g=!r.get(f),!!g);)f++;let p=0,v=f;for(let E=f;E<l;E++)if(r.get(E)!=g)a[p]++;else{if(p==3){if(d&&K.reverseCounters(a),K.isFinderPattern(a)){this.startEnd[0]=v,this.startEnd[1]=E;return}d&&K.reverseCounters(a),v+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,p--}else p++;a[p]=1,g=!g}throw new G}static reverseCounters(r){let i=r.length;for(let s=0;s<i/2;++s){let a=r[s];r[s]=r[i-s-1],r[i-s-1]=a}}parseFoundFinderPattern(r,i,s){let a,l,f;if(s){let p=this.startEnd[0]-1;for(;p>=0&&!r.get(p);)p--;p++,a=this.startEnd[0]-p,l=p,f=this.startEnd[1]}else l=this.startEnd[0],f=r.getNextUnset(this.startEnd[1]+1),a=f-this.startEnd[1];let d=this.getDecodeFinderCounters();M.arraycopy(d,0,d,1,d.length-1),d[0]=a;let g;try{g=this.parseFinderValue(d,K.FINDER_PATTERNS)}catch{return null}return new ya(g,[l,f],l,f,i)}decodeDataCharacter(r,i,s,a){let l=this.getDataCharacterCounters();for(let Ue=0;Ue<l.length;Ue++)l[Ue]=0;if(a)K.recordPatternInReverse(r,i.getStartEnd()[0],l);else{K.recordPattern(r,i.getStartEnd()[1],l);for(let Ue=0,kt=l.length-1;Ue<kt;Ue++,kt--){let fr=l[Ue];l[Ue]=l[kt],l[kt]=fr}}let f=17,d=Re.sum(new Int32Array(l))/f,g=(i.getStartEnd()[1]-i.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new G;let p=this.getOddCounts(),v=this.getEvenCounts(),E=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let Ue=0;Ue<l.length;Ue++){let kt=1*l[Ue]/d,fr=kt+.5;if(fr<1){if(kt<.3)throw new G;fr=1}else if(fr>8){if(kt>8.7)throw new G;fr=8}let Vi=Ue/2;Ue&1?(v[Vi]=fr,S[Vi]=kt-fr):(p[Vi]=fr,E[Vi]=kt-fr)}this.adjustOddEvenCounts(f);let _=4*i.getValue()+(s?0:2)+(a?0:1)-1,D=0,P=0;for(let Ue=p.length-1;Ue>=0;Ue--){if(K.isNotA1left(i,s,a)){let kt=K.WEIGHTS[_][2*Ue];P+=p[Ue]*kt}D+=p[Ue]}let W=0;for(let Ue=v.length-1;Ue>=0;Ue--)if(K.isNotA1left(i,s,a)){let kt=K.WEIGHTS[_][2*Ue+1];W+=v[Ue]*kt}let H=P+W;if(D&1||D>13||D<4)throw new G;let q=(13-D)/2,J=K.SYMBOL_WIDEST[q],Z=9-J,Ae=Yr.getRSSvalue(p,J,!0),we=Yr.getRSSvalue(v,Z,!1),tr=K.EVEN_TOTAL_SUBSET[q],Dr=K.GSUM[q],rr=Ae*tr+we+Dr;return new Bi(rr,H)}static isNotA1left(r,i,s){return!(r.getValue()==0&&i&&s)}adjustOddEvenCounts(r){let i=Re.sum(new Int32Array(this.getOddCounts())),s=Re.sum(new Int32Array(this.getEvenCounts())),a=!1,l=!1;i>13?l=!0:i<4&&(a=!0);let f=!1,d=!1;s>13?d=!0:s<4&&(f=!0);let g=i+s-r,p=(i&1)==1,v=(s&1)==0;if(g==1)if(p){if(v)throw new G;l=!0}else{if(!v)throw new G;d=!0}else if(g==-1)if(p){if(v)throw new G;a=!0}else{if(!v)throw new G;f=!0}else if(g==0){if(p){if(!v)throw new G;i<s?(a=!0,d=!0):(l=!0,f=!0)}else if(v)throw new G}else throw new G;if(a){if(l)throw new G;K.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&K.decrement(this.getOddCounts(),this.getOddRoundingErrors()),f){if(d)throw new G;K.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&K.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}K.SYMBOL_WIDEST=[7,5,4,3,1],K.EVEN_TOTAL_SUBSET=[4,20,52,104,204],K.GSUM=[0,348,1388,2948,3988],K.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],K.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],K.FINDER_PAT_A=0,K.FINDER_PAT_B=1,K.FINDER_PAT_C=2,K.FINDER_PAT_D=3,K.FINDER_PAT_E=4,K.FINDER_PAT_F=5,K.FINDER_PATTERN_SEQUENCES=[[K.FINDER_PAT_A,K.FINDER_PAT_A],[K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B],[K.FINDER_PAT_A,K.FINDER_PAT_C,K.FINDER_PAT_B,K.FINDER_PAT_D],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_C],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_D,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_E,K.FINDER_PAT_B,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_D],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_E],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F],[K.FINDER_PAT_A,K.FINDER_PAT_A,K.FINDER_PAT_B,K.FINDER_PAT_B,K.FINDER_PAT_C,K.FINDER_PAT_D,K.FINDER_PAT_D,K.FINDER_PAT_E,K.FINDER_PAT_E,K.FINDER_PAT_F,K.FINDER_PAT_F]],K.MAX_PAIRS=11;class u3 extends Bi{constructor(r,i,s){super(r,i),this.count=0,this.finderPattern=s}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class it extends Ft{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(r,i,s){const a=this.decodePair(i,!1,r,s);it.addOrTally(this.possibleLeftPairs,a),i.reverse();let l=this.decodePair(i,!0,r,s);it.addOrTally(this.possibleRightPairs,l),i.reverse();for(let f of this.possibleLeftPairs)if(f.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&it.checkChecksum(f,d))return it.constructResult(f,d)}throw new G}static addOrTally(r,i){if(i==null)return;let s=!1;for(let a of r)if(a.getValue()===i.getValue()){a.incrementCount(),s=!0;break}s||r.push(i)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(r,i){let s=4537077*r.getValue()+i.getValue(),a=new String(s).toString(),l=new pe;for(let p=13-a.length;p>0;p--)l.append("0");l.append(a);let f=0;for(let p=0;p<13;p++){let v=l.charAt(p).charCodeAt(0)-48;f+=p&1?v:3*v}f=10-f%10,f===10&&(f=0),l.append(f.toString());let d=r.getFinderPattern().getResultPoints(),g=i.getFinderPattern().getResultPoints();return new Ze(l.toString(),null,0,[d[0],d[1],g[0],g[1]],le.RSS_14,new Date().getTime())}static checkChecksum(r,i){let s=(r.getChecksumPortion()+16*i.getChecksumPortion())%79,a=9*r.getFinderPattern().getValue()+i.getFinderPattern().getValue();return a>72&&a--,a>8&&a--,s===a}decodePair(r,i,s,a){try{let l=this.findFinderPattern(r,i),f=this.parseFoundFinderPattern(r,s,i,l),d=a==null?null:a.get(U.NEED_RESULT_POINT_CALLBACK);if(d!=null){let v=(l[0]+l[1])/2;i&&(v=r.getSize()-1-v),d.foundPossibleResultPoint(new ae(v,s))}let g=this.decodeDataCharacter(r,f,!0),p=this.decodeDataCharacter(r,f,!1);return new u3(1597*g.getValue()+p.getValue(),g.getChecksumPortion()+4*p.getChecksumPortion(),f)}catch{return null}}decodeDataCharacter(r,i,s){let a=this.getDataCharacterCounters();for(let W=0;W<a.length;W++)a[W]=0;if(s)ht.recordPatternInReverse(r,i.getStartEnd()[0],a);else{ht.recordPattern(r,i.getStartEnd()[1]+1,a);for(let W=0,H=a.length-1;W<H;W++,H--){let q=a[W];a[W]=a[H],a[H]=q}}let l=s?16:15,f=Re.sum(new Int32Array(a))/l,d=this.getOddCounts(),g=this.getEvenCounts(),p=this.getOddRoundingErrors(),v=this.getEvenRoundingErrors();for(let W=0;W<a.length;W++){let H=a[W]/f,q=Math.floor(H+.5);q<1?q=1:q>8&&(q=8);let J=Math.floor(W/2);W&1?(g[J]=q,v[J]=H-q):(d[J]=q,p[J]=H-q)}this.adjustOddEvenCounts(s,l);let E=0,S=0;for(let W=d.length-1;W>=0;W--)S*=9,S+=d[W],E+=d[W];let _=0,D=0;for(let W=g.length-1;W>=0;W--)_*=9,_+=g[W],D+=g[W];let P=S+3*_;if(s){if(E&1||E>12||E<4)throw new G;let W=(12-E)/2,H=it.OUTSIDE_ODD_WIDEST[W],q=9-H,J=Yr.getRSSvalue(d,H,!1),Z=Yr.getRSSvalue(g,q,!0),Ae=it.OUTSIDE_EVEN_TOTAL_SUBSET[W],we=it.OUTSIDE_GSUM[W];return new Bi(J*Ae+Z+we,P)}else{if(D&1||D>10||D<4)throw new G;let W=(10-D)/2,H=it.INSIDE_ODD_WIDEST[W],q=9-H,J=Yr.getRSSvalue(d,H,!0),Z=Yr.getRSSvalue(g,q,!1),Ae=it.INSIDE_ODD_TOTAL_SUBSET[W],we=it.INSIDE_GSUM[W];return new Bi(Z*Ae+J+we,P)}}findFinderPattern(r,i){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let a=r.getSize(),l=!1,f=0;for(;f<a&&(l=!r.get(f),i!==l);)f++;let d=0,g=f;for(let p=f;p<a;p++)if(r.get(p)!==l)s[d]++;else{if(d===3){if(Ft.isFinderPattern(s))return[g,p];g+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,d--}else d++;s[d]=1,l=!l}throw new G}parseFoundFinderPattern(r,i,s,a){let l=r.get(a[0]),f=a[0]-1;for(;f>=0&&l!==r.get(f);)f--;f++;const d=a[0]-f,g=this.getDecodeFinderCounters(),p=new Int32Array(g.length);M.arraycopy(g,0,p,1,g.length-1),p[0]=d;const v=this.parseFinderValue(p,it.FINDER_PATTERNS);let E=f,S=a[1];return s&&(E=r.getSize()-1-E,S=r.getSize()-1-S),new ya(v,[f,a[1]],E,S,i)}adjustOddEvenCounts(r,i){let s=Re.sum(new Int32Array(this.getOddCounts())),a=Re.sum(new Int32Array(this.getEvenCounts())),l=!1,f=!1,d=!1,g=!1;r?(s>12?f=!0:s<4&&(l=!0),a>12?g=!0:a<4&&(d=!0)):(s>11?f=!0:s<5&&(l=!0),a>10?g=!0:a<4&&(d=!0));let p=s+a-i,v=(s&1)===(r?1:0),E=(a&1)===1;if(p===1)if(v){if(E)throw new G;f=!0}else{if(!E)throw new G;g=!0}else if(p===-1)if(v){if(E)throw new G;l=!0}else{if(!E)throw new G;d=!0}else if(p===0){if(v){if(!E)throw new G;s<a?(l=!0,g=!0):(f=!0,d=!0)}else if(E)throw new G}else throw new G;if(l){if(f)throw new G;Ft.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(f&&Ft.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new G;Ft.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Ft.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],it.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],it.OUTSIDE_GSUM=[0,161,961,2015,2715],it.INSIDE_GSUM=[0,336,1036,1516],it.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],it.INSIDE_ODD_WIDEST=[2,4,6,8],it.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ji extends ht{constructor(r,i){super(),this.readers=[],this.verbose=i===!0;const s=r?r.get(U.POSSIBLE_FORMATS):null,a=r&&r.get(U.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;s?((s.includes(le.EAN_13)||s.includes(le.UPC_A)||s.includes(le.EAN_8)||s.includes(le.UPC_E))&&this.readers.push(new ru(r)),s.includes(le.CODE_39)&&this.readers.push(new mt(a)),s.includes(le.CODE_128)&&this.readers.push(new ee),s.includes(le.ITF)&&this.readers.push(new Be),s.includes(le.RSS_14)&&this.readers.push(new it),s.includes(le.RSS_EXPANDED)&&this.readers.push(new K(this.verbose))):(this.readers.push(new ru(r)),this.readers.push(new mt),this.readers.push(new ru(r)),this.readers.push(new ee),this.readers.push(new Be),this.readers.push(new it),this.readers.push(new K(this.verbose)))}decodeRow(r,i,s){for(let a=0;a<this.readers.length;a++)try{return this.readers[a].decodeRow(r,i,s)}catch{}throw new G}reset(){this.readers.forEach(r=>r.reset())}}class f3 extends Er{constructor(r=500,i){super(new ji(i),r,i)}}class De{constructor(r,i,s){this.ecCodewords=r,this.ecBlocks=[i],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Me{constructor(r,i){this.count=r,this.dataCodewords=i}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Se{constructor(r,i,s,a,l,f){this.versionNumber=r,this.symbolSizeRows=i,this.symbolSizeColumns=s,this.dataRegionSizeRows=a,this.dataRegionSizeColumns=l,this.ecBlocks=f;let d=0;const g=f.getECCodewords(),p=f.getECBlocks();for(let v of p)d+=v.getCount()*(v.getDataCodewords()+g);this.totalCodewords=d}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(r,i){if(r&1||i&1)throw new F;for(let s of Se.VERSIONS)if(s.symbolSizeRows===r&&s.symbolSizeColumns===i)return s;throw new F}toString(){return""+this.versionNumber}static buildVersions(){return[new Se(1,10,10,8,8,new De(5,new Me(1,3))),new Se(2,12,12,10,10,new De(7,new Me(1,5))),new Se(3,14,14,12,12,new De(10,new Me(1,8))),new Se(4,16,16,14,14,new De(12,new Me(1,12))),new Se(5,18,18,16,16,new De(14,new Me(1,18))),new Se(6,20,20,18,18,new De(18,new Me(1,22))),new Se(7,22,22,20,20,new De(20,new Me(1,30))),new Se(8,24,24,22,22,new De(24,new Me(1,36))),new Se(9,26,26,24,24,new De(28,new Me(1,44))),new Se(10,32,32,14,14,new De(36,new Me(1,62))),new Se(11,36,36,16,16,new De(42,new Me(1,86))),new Se(12,40,40,18,18,new De(48,new Me(1,114))),new Se(13,44,44,20,20,new De(56,new Me(1,144))),new Se(14,48,48,22,22,new De(68,new Me(1,174))),new Se(15,52,52,24,24,new De(42,new Me(2,102))),new Se(16,64,64,14,14,new De(56,new Me(2,140))),new Se(17,72,72,16,16,new De(36,new Me(4,92))),new Se(18,80,80,18,18,new De(48,new Me(4,114))),new Se(19,88,88,20,20,new De(56,new Me(4,144))),new Se(20,96,96,22,22,new De(68,new Me(4,174))),new Se(21,104,104,24,24,new De(56,new Me(6,136))),new Se(22,120,120,18,18,new De(68,new Me(6,175))),new Se(23,132,132,20,20,new De(62,new Me(8,163))),new Se(24,144,144,22,22,new De(62,new Me(8,156),new Me(2,155))),new Se(25,8,18,6,16,new De(7,new Me(1,5))),new Se(26,8,32,6,14,new De(11,new Me(1,10))),new Se(27,12,26,10,24,new De(14,new Me(1,16))),new Se(28,12,36,10,16,new De(18,new Me(1,22))),new Se(29,16,36,14,16,new De(24,new Me(1,32))),new Se(30,16,48,14,22,new De(28,new Me(1,49)))]}}Se.VERSIONS=Se.buildVersions();class ou{constructor(r){const i=r.getHeight();if(i<8||i>144||i&1)throw new F;this.version=ou.readVersion(r),this.mappingBitMatrix=this.extractDataRegion(r),this.readMappingMatrix=new Te(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(r){const i=r.getHeight(),s=r.getWidth();return Se.getVersionForDimensions(i,s)}readCodewords(){const r=new Int8Array(this.version.getTotalCodewords());let i=0,s=4,a=0;const l=this.mappingBitMatrix.getHeight(),f=this.mappingBitMatrix.getWidth();let d=!1,g=!1,p=!1,v=!1;do if(s===l&&a===0&&!d)r[i++]=this.readCorner1(l,f)&255,s-=2,a+=2,d=!0;else if(s===l-2&&a===0&&f&3&&!g)r[i++]=this.readCorner2(l,f)&255,s-=2,a+=2,g=!0;else if(s===l+4&&a===2&&!(f&7)&&!p)r[i++]=this.readCorner3(l,f)&255,s-=2,a+=2,p=!0;else if(s===l-2&&a===0&&(f&7)===4&&!v)r[i++]=this.readCorner4(l,f)&255,s-=2,a+=2,v=!0;else{do s<l&&a>=0&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,f)&255),s-=2,a+=2;while(s>=0&&a<f);s+=1,a+=3;do s>=0&&a<f&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,f)&255),s+=2,a-=2;while(s<l&&a>=0);s+=3,a+=1}while(s<l||a<f);if(i!==this.version.getTotalCodewords())throw new F;return r}readModule(r,i,s,a){return r<0&&(r+=s,i+=4-(s+4&7)),i<0&&(i+=a,r+=4-(a+4&7)),this.readMappingMatrix.set(i,r),this.mappingBitMatrix.get(i,r)}readUtah(r,i,s,a){let l=0;return this.readModule(r-2,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r-2,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r-1,i,s,a)&&(l|=1),l<<=1,this.readModule(r,i-2,s,a)&&(l|=1),l<<=1,this.readModule(r,i-1,s,a)&&(l|=1),l<<=1,this.readModule(r,i,s,a)&&(l|=1),l}readCorner1(r,i){let s=0;return this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,1,r,i)&&(s|=1),s<<=1,this.readModule(r-1,2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(2,i-1,r,i)&&(s|=1),s<<=1,this.readModule(3,i-1,r,i)&&(s|=1),s}readCorner2(r,i){let s=0;return this.readModule(r-3,0,r,i)&&(s|=1),s<<=1,this.readModule(r-2,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(0,i-4,r,i)&&(s|=1),s<<=1,this.readModule(0,i-3,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s}readCorner3(r,i){let s=0;return this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(0,i-3,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-3,r,i)&&(s|=1),s<<=1,this.readModule(1,i-2,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s}readCorner4(r,i){let s=0;return this.readModule(r-3,0,r,i)&&(s|=1),s<<=1,this.readModule(r-2,0,r,i)&&(s|=1),s<<=1,this.readModule(r-1,0,r,i)&&(s|=1),s<<=1,this.readModule(0,i-2,r,i)&&(s|=1),s<<=1,this.readModule(0,i-1,r,i)&&(s|=1),s<<=1,this.readModule(1,i-1,r,i)&&(s|=1),s<<=1,this.readModule(2,i-1,r,i)&&(s|=1),s<<=1,this.readModule(3,i-1,r,i)&&(s|=1),s}extractDataRegion(r){const i=this.version.getSymbolSizeRows(),s=this.version.getSymbolSizeColumns();if(r.getHeight()!==i)throw new b("Dimension of bitMatrix must match the version size");const a=this.version.getDataRegionSizeRows(),l=this.version.getDataRegionSizeColumns(),f=i/a|0,d=s/l|0,g=f*a,p=d*l,v=new Te(p,g);for(let E=0;E<f;++E){const S=E*a;for(let _=0;_<d;++_){const D=_*l;for(let P=0;P<a;++P){const W=E*(a+2)+1+P,H=S+P;for(let q=0;q<l;++q){const J=_*(l+2)+1+q;if(r.get(J,W)){const Z=D+q;v.set(Z,H)}}}}}return v}}class au{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i){const s=i.getECBlocks();let a=0;const l=s.getECBlocks();for(let P of l)a+=P.getCount();const f=new Array(a);let d=0;for(let P of l)for(let W=0;W<P.getCount();W++){const H=P.getDataCodewords(),q=s.getECCodewords()+H;f[d++]=new au(H,new Uint8Array(q))}const p=f[0].codewords.length-s.getECCodewords(),v=p-1;let E=0;for(let P=0;P<v;P++)for(let W=0;W<d;W++)f[W].codewords[P]=r[E++];const S=i.getVersionNumber()===24,_=S?8:d;for(let P=0;P<_;P++)f[P].codewords[p-1]=r[E++];const D=f[0].codewords.length;for(let P=p;P<D;P++)for(let W=0;W<d;W++){const H=S?(W+8)%d:W,q=S&&H>7?P-1:P;f[H].codewords[q]=r[E++]}if(E!==r.length)throw new b;return f}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class lu{constructor(r){this.bytes=r,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(r){if(r<1||r>32||r>this.available())throw new b(""+r);let i=0,s=this.bitOffset,a=this.byteOffset;const l=this.bytes;if(s>0){const f=8-s,d=r<f?r:f,g=f-d,p=255>>8-d<<g;i=(l[a]&p)>>g,r-=d,s+=d,s===8&&(s=0,a++)}if(r>0){for(;r>=8;)i=i<<8|l[a]&255,a++,r-=8;if(r>0){const f=8-r,d=255>>f<<f;i=i<<r|(l[a]&d)>>f,s+=r}}return this.bitOffset=s,this.byteOffset=a,i}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var xt;(function(y){y[y.PAD_ENCODE=0]="PAD_ENCODE",y[y.ASCII_ENCODE=1]="ASCII_ENCODE",y[y.C40_ENCODE=2]="C40_ENCODE",y[y.TEXT_ENCODE=3]="TEXT_ENCODE",y[y.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",y[y.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",y[y.BASE256_ENCODE=6]="BASE256_ENCODE"})(xt||(xt={}));class Nn{static decode(r){const i=new lu(r),s=new pe,a=new pe,l=new Array;let f=xt.ASCII_ENCODE;do if(f===xt.ASCII_ENCODE)f=this.decodeAsciiSegment(i,s,a);else{switch(f){case xt.C40_ENCODE:this.decodeC40Segment(i,s);break;case xt.TEXT_ENCODE:this.decodeTextSegment(i,s);break;case xt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(i,s);break;case xt.EDIFACT_ENCODE:this.decodeEdifactSegment(i,s);break;case xt.BASE256_ENCODE:this.decodeBase256Segment(i,s,l);break;default:throw new F}f=xt.ASCII_ENCODE}while(f!==xt.PAD_ENCODE&&i.available()>0);return a.length()>0&&s.append(a.toString()),new Bs(r,s.toString(),l.length===0?null:l,null)}static decodeAsciiSegment(r,i,s){let a=!1;do{let l=r.readBits(8);if(l===0)throw new F;if(l<=128)return a&&(l+=128),i.append(String.fromCharCode(l-1)),xt.ASCII_ENCODE;if(l===129)return xt.PAD_ENCODE;if(l<=229){const f=l-130;f<10&&i.append("0"),i.append(""+f)}else switch(l){case 230:return xt.C40_ENCODE;case 231:return xt.BASE256_ENCODE;case 232:i.append("");break;case 233:case 234:break;case 235:a=!0;break;case 236:i.append("[)>05"),s.insert(0,"");break;case 237:i.append("[)>06"),s.insert(0,"");break;case 238:return xt.ANSIX12_ENCODE;case 239:return xt.TEXT_ENCODE;case 240:return xt.EDIFACT_ENCODE;case 241:break;default:if(l!==254||r.available()!==0)throw new F;break}}while(r.available()>0);return xt.ASCII_ENCODE}static decodeC40Segment(r,i){let s=!1;const a=[];let l=0;do{if(r.available()===8)return;const f=r.readBits(8);if(f===254)return;this.parseTwoBytes(f,r.readBits(8),a);for(let d=0;d<3;d++){const g=a[d];switch(l){case 0:if(g<3)l=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const p=this.C40_BASIC_SET_CHARS[g];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else throw new F;break;case 1:s?(i.append(String.fromCharCode(g+128)),s=!1):i.append(String.fromCharCode(g)),l=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const p=this.C40_SHIFT2_SET_CHARS[g];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else switch(g){case 27:i.append("");break;case 30:s=!0;break;default:throw new F}l=0;break;case 3:s?(i.append(String.fromCharCode(g+224)),s=!1):i.append(String.fromCharCode(g+96)),l=0;break;default:throw new F}}}while(r.available()>0)}static decodeTextSegment(r,i){let s=!1,a=[],l=0;do{if(r.available()===8)return;const f=r.readBits(8);if(f===254)return;this.parseTwoBytes(f,r.readBits(8),a);for(let d=0;d<3;d++){const g=a[d];switch(l){case 0:if(g<3)l=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const p=this.TEXT_BASIC_SET_CHARS[g];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else throw new F;break;case 1:s?(i.append(String.fromCharCode(g+128)),s=!1):i.append(String.fromCharCode(g)),l=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const p=this.TEXT_SHIFT2_SET_CHARS[g];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p)}else switch(g){case 27:i.append("");break;case 30:s=!0;break;default:throw new F}l=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const p=this.TEXT_SHIFT3_SET_CHARS[g];s?(i.append(String.fromCharCode(p.charCodeAt(0)+128)),s=!1):i.append(p),l=0}else throw new F;break;default:throw new F}}}while(r.available()>0)}static decodeAnsiX12Segment(r,i){const s=[];do{if(r.available()===8)return;const a=r.readBits(8);if(a===254)return;this.parseTwoBytes(a,r.readBits(8),s);for(let l=0;l<3;l++){const f=s[l];switch(f){case 0:i.append("\r");break;case 1:i.append("*");break;case 2:i.append(">");break;case 3:i.append(" ");break;default:if(f<14)i.append(String.fromCharCode(f+44));else if(f<40)i.append(String.fromCharCode(f+51));else throw new F;break}}}while(r.available()>0)}static parseTwoBytes(r,i,s){let a=(r<<8)+i-1,l=Math.floor(a/1600);s[0]=l,a-=l*1600,l=Math.floor(a/40),s[1]=l,s[2]=a-l*40}static decodeEdifactSegment(r,i){do{if(r.available()<=16)return;for(let s=0;s<4;s++){let a=r.readBits(6);if(a===31){const l=8-r.getBitOffset();l!==8&&r.readBits(l);return}a&32||(a|=64),i.append(String.fromCharCode(a))}}while(r.available()>0)}static decodeBase256Segment(r,i,s){let a=1+r.getByteOffset();const l=this.unrandomize255State(r.readBits(8),a++);let f;if(l===0?f=r.available()/8|0:l<250?f=l:f=250*(l-249)+this.unrandomize255State(r.readBits(8),a++),f<0)throw new F;const d=new Uint8Array(f);for(let g=0;g<f;g++){if(r.available()<8)throw new F;d[g]=this.unrandomize255State(r.readBits(8),a++)}s.push(d);try{i.append(ve.decode(d,ie.ISO88591))}catch(g){throw new Xr("Platform does not support required encoding: "+g.message)}}static unrandomize255State(r,i){const s=149*i%255+1,a=r-s;return a>=0?a:a+256}}Nn.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Nn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Nn.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Nn.TEXT_SHIFT2_SET_CHARS=Nn.C40_SHIFT2_SET_CHARS,Nn.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class d3{constructor(){this.rsDecoder=new Us(Ne.DATA_MATRIX_FIELD_256)}decode(r){const i=new ou(r),s=i.getVersion(),a=i.readCodewords(),l=au.getDataBlocks(a,s);let f=0;for(let p of l)f+=p.getNumDataCodewords();const d=new Uint8Array(f),g=l.length;for(let p=0;p<g;p++){const v=l[p],E=v.getCodewords(),S=v.getNumDataCodewords();this.correctErrors(E,S);for(let _=0;_<S;_++)d[_*g+p]=E[_]}return Nn.decode(d)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new T}for(let a=0;a<i;a++)r[a]=s[a]}}class ct{constructor(r){this.image=r,this.rectangleDetector=new un(this.image)}detect(){const r=this.rectangleDetector.detect();let i=this.detectSolid1(r);if(i=this.detectSolid2(i),i[3]=this.correctTopRight(i),!i[3])throw new G;i=this.shiftToModuleCenter(i);const s=i[0],a=i[1],l=i[2],f=i[3];let d=this.transitionsBetween(s,f)+1,g=this.transitionsBetween(l,f)+1;(d&1)===1&&(d+=1),(g&1)===1&&(g+=1),4*d<7*g&&4*g<7*d&&(d=g=Math.max(d,g));let p=ct.sampleGrid(this.image,s,a,l,f,d,g);return new wa(p,[s,a,l,f])}static shiftPoint(r,i,s){let a=(i.getX()-r.getX())/(s+1),l=(i.getY()-r.getY())/(s+1);return new ae(r.getX()+a,r.getY()+l)}static moveAway(r,i,s){let a=r.getX(),l=r.getY();return a<i?a-=1:a+=1,l<s?l-=1:l+=1,new ae(a,l)}detectSolid1(r){let i=r[0],s=r[1],a=r[3],l=r[2],f=this.transitionsBetween(i,s),d=this.transitionsBetween(s,a),g=this.transitionsBetween(a,l),p=this.transitionsBetween(l,i),v=f,E=[l,i,s,a];return v>d&&(v=d,E[0]=i,E[1]=s,E[2]=a,E[3]=l),v>g&&(v=g,E[0]=s,E[1]=a,E[2]=l,E[3]=i),v>p&&(E[0]=a,E[1]=l,E[2]=i,E[3]=s),E}detectSolid2(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l),d=ct.shiftPoint(s,a,(f+1)*4),g=ct.shiftPoint(a,s,(f+1)*4),p=this.transitionsBetween(d,i),v=this.transitionsBetween(g,l);return p<v?(r[0]=i,r[1]=s,r[2]=a,r[3]=l):(r[0]=s,r[1]=a,r[2]=l,r[3]=i),r}correctTopRight(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l),d=this.transitionsBetween(s,l),g=ct.shiftPoint(i,s,(d+1)*4),p=ct.shiftPoint(a,s,(f+1)*4);f=this.transitionsBetween(g,l),d=this.transitionsBetween(p,l);let v=new ae(l.getX()+(a.getX()-s.getX())/(f+1),l.getY()+(a.getY()-s.getY())/(f+1)),E=new ae(l.getX()+(i.getX()-s.getX())/(d+1),l.getY()+(i.getY()-s.getY())/(d+1));if(!this.isValid(v))return this.isValid(E)?E:null;if(!this.isValid(E))return v;let S=this.transitionsBetween(g,v)+this.transitionsBetween(p,v),_=this.transitionsBetween(g,E)+this.transitionsBetween(p,E);return S>_?v:E}shiftToModuleCenter(r){let i=r[0],s=r[1],a=r[2],l=r[3],f=this.transitionsBetween(i,l)+1,d=this.transitionsBetween(a,l)+1,g=ct.shiftPoint(i,s,d*4),p=ct.shiftPoint(a,s,f*4);f=this.transitionsBetween(g,l)+1,d=this.transitionsBetween(p,l)+1,(f&1)===1&&(f+=1),(d&1)===1&&(d+=1);let v=(i.getX()+s.getX()+a.getX()+l.getX())/4,E=(i.getY()+s.getY()+a.getY()+l.getY())/4;i=ct.moveAway(i,v,E),s=ct.moveAway(s,v,E),a=ct.moveAway(a,v,E),l=ct.moveAway(l,v,E);let S,_;return g=ct.shiftPoint(i,s,d*4),g=ct.shiftPoint(g,l,f*4),S=ct.shiftPoint(s,i,d*4),S=ct.shiftPoint(S,a,f*4),p=ct.shiftPoint(a,l,d*4),p=ct.shiftPoint(p,s,f*4),_=ct.shiftPoint(l,a,d*4),_=ct.shiftPoint(_,i,f*4),[g,S,p,_]}isValid(r){return r.getX()>=0&&r.getX()<this.image.getWidth()&&r.getY()>0&&r.getY()<this.image.getHeight()}static sampleGrid(r,i,s,a,l,f,d){return _n.getInstance().sampleGrid(r,f,d,.5,.5,f-.5,.5,f-.5,d-.5,.5,d-.5,i.getX(),i.getY(),l.getX(),l.getY(),a.getX(),a.getY(),s.getX(),s.getY())}transitionsBetween(r,i){let s=Math.trunc(r.getX()),a=Math.trunc(r.getY()),l=Math.trunc(i.getX()),f=Math.trunc(i.getY()),d=Math.abs(f-a)>Math.abs(l-s);if(d){let P=s;s=a,a=P,P=l,l=f,f=P}let g=Math.abs(l-s),p=Math.abs(f-a),v=-g/2,E=a<f?1:-1,S=s<l?1:-1,_=0,D=this.image.get(d?a:s,d?s:a);for(let P=s,W=a;P!==l;P+=S){let H=this.image.get(d?W:P,d?P:W);if(H!==D&&(_++,D=H),v+=p,v>0){if(W===f)break;W+=E,v-=g}}return _}}class kn{constructor(){this.decoder=new d3}decode(r,i=null){let s,a;if(i!=null&&i.has(U.PURE_BARCODE)){const p=kn.extractPureBits(r.getBlackMatrix());s=this.decoder.decode(p),a=kn.NO_POINTS}else{const p=new ct(r.getBlackMatrix()).detect();s=this.decoder.decode(p.getBits()),a=p.getPoints()}const l=s.getRawBytes(),f=new Ze(s.getText(),l,8*l.length,a,le.DATA_MATRIX,M.currentTimeMillis()),d=s.getByteSegments();d!=null&&f.putMetadata(bt.BYTE_SEGMENTS,d);const g=s.getECLevel();return g!=null&&f.putMetadata(bt.ERROR_CORRECTION_LEVEL,g),f}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i==null||s==null)throw new G;const a=this.moduleSize(i,r);let l=i[1];const f=s[1];let d=i[0];const p=(s[0]-d+1)/a,v=(f-l+1)/a;if(p<=0||v<=0)throw new G;const E=a/2;l+=E,d+=E;const S=new Te(p,v);for(let _=0;_<v;_++){const D=l+_*a;for(let P=0;P<p;P++)r.get(d+P*a,D)&&S.set(P,_)}return S}static moduleSize(r,i){const s=i.getWidth();let a=r[0];const l=r[1];for(;a<s&&i.get(a,l);)a++;if(a===s)throw new G;const f=a-r[0];if(f===0)throw new G;return f}}kn.NO_POINTS=[];class h3 extends Er{constructor(r=500){super(new kn,r)}}var Wi;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(Wi||(Wi={}));class We{constructor(r,i,s){this.value=r,this.stringValue=i,this.bits=s,We.FOR_BITS.set(s,this),We.FOR_VALUE.set(r,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(r){switch(r){case"L":return We.L;case"M":return We.M;case"Q":return We.Q;case"H":return We.H;default:throw new C(r+"not available")}}toString(){return this.stringValue}equals(r){if(!(r instanceof We))return!1;const i=r;return this.value===i.value}static forBits(r){if(r<0||r>=We.FOR_BITS.size)throw new b;return We.FOR_BITS.get(r)}}We.FOR_BITS=new Map,We.FOR_VALUE=new Map,We.L=new We(Wi.L,"L",1),We.M=new We(Wi.M,"M",0),We.Q=new We(Wi.Q,"Q",3),We.H=new We(Wi.H,"H",2);class Ut{constructor(r){this.errorCorrectionLevel=We.forBits(r>>3&3),this.dataMask=r&7}static numBitsDiffering(r,i){return O.bitCount(r^i)}static decodeFormatInformation(r,i){const s=Ut.doDecodeFormatInformation(r,i);return s!==null?s:Ut.doDecodeFormatInformation(r^Ut.FORMAT_INFO_MASK_QR,i^Ut.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(r,i){let s=Number.MAX_SAFE_INTEGER,a=0;for(const l of Ut.FORMAT_INFO_DECODE_LOOKUP){const f=l[0];if(f===r||f===i)return new Ut(l[1]);let d=Ut.numBitsDiffering(r,f);d<s&&(a=l[1],s=d),r!==i&&(d=Ut.numBitsDiffering(i,f),d<s&&(a=l[1],s=d))}return s<=3?new Ut(a):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(r){if(!(r instanceof Ut))return!1;const i=r;return this.errorCorrectionLevel===i.errorCorrectionLevel&&this.dataMask===i.dataMask}}Ut.FORMAT_INFO_MASK_QR=21522,Ut.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class ${constructor(r,...i){this.ecCodewordsPerBlock=r,this.ecBlocks=i}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let r=0;const i=this.ecBlocks;for(const s of i)r+=s.getCount();return r}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class R{constructor(r,i){this.count=r,this.dataCodewords=i}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ue{constructor(r,i,...s){this.versionNumber=r,this.alignmentPatternCenters=i,this.ecBlocks=s;let a=0;const l=s[0].getECCodewordsPerBlock(),f=s[0].getECBlocks();for(const d of f)a+=d.getCount()*(d.getDataCodewords()+l);this.totalCodewords=a}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(r){return this.ecBlocks[r.getValue()]}static getProvisionalVersionForDimension(r){if(r%4!==1)throw new F;try{return this.getVersionForNumber((r-17)/4)}catch{throw new F}}static getVersionForNumber(r){if(r<1||r>40)throw new b;return ue.VERSIONS[r-1]}static decodeVersionInformation(r){let i=Number.MAX_SAFE_INTEGER,s=0;for(let a=0;a<ue.VERSION_DECODE_INFO.length;a++){const l=ue.VERSION_DECODE_INFO[a];if(l===r)return ue.getVersionForNumber(a+7);const f=Ut.numBitsDiffering(r,l);f<i&&(s=a+7,i=f)}return i<=3?ue.getVersionForNumber(s):null}buildFunctionPattern(){const r=this.getDimensionForVersion(),i=new Te(r);i.setRegion(0,0,9,9),i.setRegion(r-8,0,8,9),i.setRegion(0,r-8,9,8);const s=this.alignmentPatternCenters.length;for(let a=0;a<s;a++){const l=this.alignmentPatternCenters[a]-2;for(let f=0;f<s;f++)a===0&&(f===0||f===s-1)||a===s-1&&f===0||i.setRegion(this.alignmentPatternCenters[f]-2,l,5,5)}return i.setRegion(6,9,1,r-17),i.setRegion(9,6,r-17,1),this.versionNumber>6&&(i.setRegion(r-11,0,3,6),i.setRegion(0,r-11,6,3)),i}toString(){return""+this.versionNumber}}ue.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),ue.VERSIONS=[new ue(1,new Int32Array(0),new $(7,new R(1,19)),new $(10,new R(1,16)),new $(13,new R(1,13)),new $(17,new R(1,9))),new ue(2,Int32Array.from([6,18]),new $(10,new R(1,34)),new $(16,new R(1,28)),new $(22,new R(1,22)),new $(28,new R(1,16))),new ue(3,Int32Array.from([6,22]),new $(15,new R(1,55)),new $(26,new R(1,44)),new $(18,new R(2,17)),new $(22,new R(2,13))),new ue(4,Int32Array.from([6,26]),new $(20,new R(1,80)),new $(18,new R(2,32)),new $(26,new R(2,24)),new $(16,new R(4,9))),new ue(5,Int32Array.from([6,30]),new $(26,new R(1,108)),new $(24,new R(2,43)),new $(18,new R(2,15),new R(2,16)),new $(22,new R(2,11),new R(2,12))),new ue(6,Int32Array.from([6,34]),new $(18,new R(2,68)),new $(16,new R(4,27)),new $(24,new R(4,19)),new $(28,new R(4,15))),new ue(7,Int32Array.from([6,22,38]),new $(20,new R(2,78)),new $(18,new R(4,31)),new $(18,new R(2,14),new R(4,15)),new $(26,new R(4,13),new R(1,14))),new ue(8,Int32Array.from([6,24,42]),new $(24,new R(2,97)),new $(22,new R(2,38),new R(2,39)),new $(22,new R(4,18),new R(2,19)),new $(26,new R(4,14),new R(2,15))),new ue(9,Int32Array.from([6,26,46]),new $(30,new R(2,116)),new $(22,new R(3,36),new R(2,37)),new $(20,new R(4,16),new R(4,17)),new $(24,new R(4,12),new R(4,13))),new ue(10,Int32Array.from([6,28,50]),new $(18,new R(2,68),new R(2,69)),new $(26,new R(4,43),new R(1,44)),new $(24,new R(6,19),new R(2,20)),new $(28,new R(6,15),new R(2,16))),new ue(11,Int32Array.from([6,30,54]),new $(20,new R(4,81)),new $(30,new R(1,50),new R(4,51)),new $(28,new R(4,22),new R(4,23)),new $(24,new R(3,12),new R(8,13))),new ue(12,Int32Array.from([6,32,58]),new $(24,new R(2,92),new R(2,93)),new $(22,new R(6,36),new R(2,37)),new $(26,new R(4,20),new R(6,21)),new $(28,new R(7,14),new R(4,15))),new ue(13,Int32Array.from([6,34,62]),new $(26,new R(4,107)),new $(22,new R(8,37),new R(1,38)),new $(24,new R(8,20),new R(4,21)),new $(22,new R(12,11),new R(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new $(30,new R(3,115),new R(1,116)),new $(24,new R(4,40),new R(5,41)),new $(20,new R(11,16),new R(5,17)),new $(24,new R(11,12),new R(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new $(22,new R(5,87),new R(1,88)),new $(24,new R(5,41),new R(5,42)),new $(30,new R(5,24),new R(7,25)),new $(24,new R(11,12),new R(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new $(24,new R(5,98),new R(1,99)),new $(28,new R(7,45),new R(3,46)),new $(24,new R(15,19),new R(2,20)),new $(30,new R(3,15),new R(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new $(28,new R(1,107),new R(5,108)),new $(28,new R(10,46),new R(1,47)),new $(28,new R(1,22),new R(15,23)),new $(28,new R(2,14),new R(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new $(30,new R(5,120),new R(1,121)),new $(26,new R(9,43),new R(4,44)),new $(28,new R(17,22),new R(1,23)),new $(28,new R(2,14),new R(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new $(28,new R(3,113),new R(4,114)),new $(26,new R(3,44),new R(11,45)),new $(26,new R(17,21),new R(4,22)),new $(26,new R(9,13),new R(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new $(28,new R(3,107),new R(5,108)),new $(26,new R(3,41),new R(13,42)),new $(30,new R(15,24),new R(5,25)),new $(28,new R(15,15),new R(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new $(28,new R(4,116),new R(4,117)),new $(26,new R(17,42)),new $(28,new R(17,22),new R(6,23)),new $(30,new R(19,16),new R(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new $(28,new R(2,111),new R(7,112)),new $(28,new R(17,46)),new $(30,new R(7,24),new R(16,25)),new $(24,new R(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new $(30,new R(4,121),new R(5,122)),new $(28,new R(4,47),new R(14,48)),new $(30,new R(11,24),new R(14,25)),new $(30,new R(16,15),new R(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new $(30,new R(6,117),new R(4,118)),new $(28,new R(6,45),new R(14,46)),new $(30,new R(11,24),new R(16,25)),new $(30,new R(30,16),new R(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new $(26,new R(8,106),new R(4,107)),new $(28,new R(8,47),new R(13,48)),new $(30,new R(7,24),new R(22,25)),new $(30,new R(22,15),new R(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new $(28,new R(10,114),new R(2,115)),new $(28,new R(19,46),new R(4,47)),new $(28,new R(28,22),new R(6,23)),new $(30,new R(33,16),new R(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new $(30,new R(8,122),new R(4,123)),new $(28,new R(22,45),new R(3,46)),new $(30,new R(8,23),new R(26,24)),new $(30,new R(12,15),new R(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new $(30,new R(3,117),new R(10,118)),new $(28,new R(3,45),new R(23,46)),new $(30,new R(4,24),new R(31,25)),new $(30,new R(11,15),new R(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new $(30,new R(7,116),new R(7,117)),new $(28,new R(21,45),new R(7,46)),new $(30,new R(1,23),new R(37,24)),new $(30,new R(19,15),new R(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new $(30,new R(5,115),new R(10,116)),new $(28,new R(19,47),new R(10,48)),new $(30,new R(15,24),new R(25,25)),new $(30,new R(23,15),new R(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new $(30,new R(13,115),new R(3,116)),new $(28,new R(2,46),new R(29,47)),new $(30,new R(42,24),new R(1,25)),new $(30,new R(23,15),new R(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new $(30,new R(17,115)),new $(28,new R(10,46),new R(23,47)),new $(30,new R(10,24),new R(35,25)),new $(30,new R(19,15),new R(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new $(30,new R(17,115),new R(1,116)),new $(28,new R(14,46),new R(21,47)),new $(30,new R(29,24),new R(19,25)),new $(30,new R(11,15),new R(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new $(30,new R(13,115),new R(6,116)),new $(28,new R(14,46),new R(23,47)),new $(30,new R(44,24),new R(7,25)),new $(30,new R(59,16),new R(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new $(30,new R(12,121),new R(7,122)),new $(28,new R(12,47),new R(26,48)),new $(30,new R(39,24),new R(14,25)),new $(30,new R(22,15),new R(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new $(30,new R(6,121),new R(14,122)),new $(28,new R(6,47),new R(34,48)),new $(30,new R(46,24),new R(10,25)),new $(30,new R(2,15),new R(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new $(30,new R(17,122),new R(4,123)),new $(28,new R(29,46),new R(14,47)),new $(30,new R(49,24),new R(10,25)),new $(30,new R(24,15),new R(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new $(30,new R(4,122),new R(18,123)),new $(28,new R(13,46),new R(32,47)),new $(30,new R(48,24),new R(14,25)),new $(30,new R(42,15),new R(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new $(30,new R(20,117),new R(4,118)),new $(28,new R(40,47),new R(7,48)),new $(30,new R(43,24),new R(22,25)),new $(30,new R(10,15),new R(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new $(30,new R(19,118),new R(6,119)),new $(28,new R(18,47),new R(31,48)),new $(30,new R(34,24),new R(34,25)),new $(30,new R(20,15),new R(61,16)))];var At;(function(y){y[y.DATA_MASK_000=0]="DATA_MASK_000",y[y.DATA_MASK_001=1]="DATA_MASK_001",y[y.DATA_MASK_010=2]="DATA_MASK_010",y[y.DATA_MASK_011=3]="DATA_MASK_011",y[y.DATA_MASK_100=4]="DATA_MASK_100",y[y.DATA_MASK_101=5]="DATA_MASK_101",y[y.DATA_MASK_110=6]="DATA_MASK_110",y[y.DATA_MASK_111=7]="DATA_MASK_111"})(At||(At={}));class br{constructor(r,i){this.value=r,this.isMasked=i}unmaskBitMatrix(r,i){for(let s=0;s<i;s++)for(let a=0;a<i;a++)this.isMasked(s,a)&&r.flip(a,s)}}br.values=new Map([[At.DATA_MASK_000,new br(At.DATA_MASK_000,(y,r)=>(y+r&1)===0)],[At.DATA_MASK_001,new br(At.DATA_MASK_001,(y,r)=>(y&1)===0)],[At.DATA_MASK_010,new br(At.DATA_MASK_010,(y,r)=>r%3===0)],[At.DATA_MASK_011,new br(At.DATA_MASK_011,(y,r)=>(y+r)%3===0)],[At.DATA_MASK_100,new br(At.DATA_MASK_100,(y,r)=>(Math.floor(y/2)+Math.floor(r/3)&1)===0)],[At.DATA_MASK_101,new br(At.DATA_MASK_101,(y,r)=>y*r%6===0)],[At.DATA_MASK_110,new br(At.DATA_MASK_110,(y,r)=>y*r%6<3)],[At.DATA_MASK_111,new br(At.DATA_MASK_111,(y,r)=>(y+r+y*r%3&1)===0)]]);class g3{constructor(r){const i=r.getHeight();if(i<21||(i&3)!==1)throw new F;this.bitMatrix=r}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let r=0;for(let l=0;l<6;l++)r=this.copyBit(l,8,r);r=this.copyBit(7,8,r),r=this.copyBit(8,8,r),r=this.copyBit(8,7,r);for(let l=5;l>=0;l--)r=this.copyBit(8,l,r);const i=this.bitMatrix.getHeight();let s=0;const a=i-7;for(let l=i-1;l>=a;l--)s=this.copyBit(8,l,s);for(let l=i-8;l<i;l++)s=this.copyBit(l,8,s);if(this.parsedFormatInfo=Ut.decodeFormatInformation(r,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const r=this.bitMatrix.getHeight(),i=Math.floor((r-17)/4);if(i<=6)return ue.getVersionForNumber(i);let s=0;const a=r-11;for(let f=5;f>=0;f--)for(let d=r-9;d>=a;d--)s=this.copyBit(d,f,s);let l=ue.decodeVersionInformation(s);if(l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;s=0;for(let f=5;f>=0;f--)for(let d=r-9;d>=a;d--)s=this.copyBit(f,d,s);if(l=ue.decodeVersionInformation(s),l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;throw new F}copyBit(r,i,s){return(this.isMirror?this.bitMatrix.get(i,r):this.bitMatrix.get(r,i))?s<<1|1:s<<1}readCodewords(){const r=this.readFormatInformation(),i=this.readVersion(),s=br.values.get(r.getDataMask()),a=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,a);const l=i.buildFunctionPattern();let f=!0;const d=new Uint8Array(i.getTotalCodewords());let g=0,p=0,v=0;for(let E=a-1;E>0;E-=2){E===6&&E--;for(let S=0;S<a;S++){const _=f?a-1-S:S;for(let D=0;D<2;D++)l.get(E-D,_)||(v++,p<<=1,this.bitMatrix.get(E-D,_)&&(p|=1),v===8&&(d[g++]=p,v=0,p=0))}f=!f}if(g!==i.getTotalCodewords())throw new F;return d}remask(){if(this.parsedFormatInfo===null)return;const r=br.values[this.parsedFormatInfo.getDataMask()],i=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,i)}setMirror(r){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=r}mirror(){const r=this.bitMatrix;for(let i=0,s=r.getWidth();i<s;i++)for(let a=i+1,l=r.getHeight();a<l;a++)r.get(i,a)!==r.get(a,i)&&(r.flip(a,i),r.flip(i,a))}}class cu{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i,s){if(r.length!==i.getTotalCodewords())throw new b;const a=i.getECBlocksForLevel(s);let l=0;const f=a.getECBlocks();for(const D of f)l+=D.getCount();const d=new Array(l);let g=0;for(const D of f)for(let P=0;P<D.getCount();P++){const W=D.getDataCodewords(),H=a.getECCodewordsPerBlock()+W;d[g++]=new cu(W,new Uint8Array(H))}const p=d[0].codewords.length;let v=d.length-1;for(;v>=0&&d[v].codewords.length!==p;)v--;v++;const E=p-a.getECCodewordsPerBlock();let S=0;for(let D=0;D<E;D++)for(let P=0;P<g;P++)d[P].codewords[D]=r[S++];for(let D=v;D<g;D++)d[D].codewords[E]=r[S++];const _=d[0].codewords.length;for(let D=E;D<_;D++)for(let P=0;P<g;P++){const W=P<v?D:D+1;d[P].codewords[W]=r[S++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var Ar;(function(y){y[y.TERMINATOR=0]="TERMINATOR",y[y.NUMERIC=1]="NUMERIC",y[y.ALPHANUMERIC=2]="ALPHANUMERIC",y[y.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",y[y.BYTE=4]="BYTE",y[y.ECI=5]="ECI",y[y.KANJI=6]="KANJI",y[y.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",y[y.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",y[y.HANZI=9]="HANZI"})(Ar||(Ar={}));class fe{constructor(r,i,s,a){this.value=r,this.stringValue=i,this.characterCountBitsForVersions=s,this.bits=a,fe.FOR_BITS.set(a,this),fe.FOR_VALUE.set(r,this)}static forBits(r){const i=fe.FOR_BITS.get(r);if(i===void 0)throw new b;return i}getCharacterCountBits(r){const i=r.getVersionNumber();let s;return i<=9?s=0:i<=26?s=1:s=2,this.characterCountBitsForVersions[s]}getValue(){return this.value}getBits(){return this.bits}equals(r){if(!(r instanceof fe))return!1;const i=r;return this.value===i.value}toString(){return this.stringValue}}fe.FOR_BITS=new Map,fe.FOR_VALUE=new Map,fe.TERMINATOR=new fe(Ar.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),fe.NUMERIC=new fe(Ar.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),fe.ALPHANUMERIC=new fe(Ar.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),fe.STRUCTURED_APPEND=new fe(Ar.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),fe.BYTE=new fe(Ar.BYTE,"BYTE",Int32Array.from([8,16,16]),4),fe.ECI=new fe(Ar.ECI,"ECI",Int32Array.from([0,0,0]),7),fe.KANJI=new fe(Ar.KANJI,"KANJI",Int32Array.from([8,10,12]),8),fe.FNC1_FIRST_POSITION=new fe(Ar.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),fe.FNC1_SECOND_POSITION=new fe(Ar.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),fe.HANZI=new fe(Ar.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Qe{static decode(r,i,s,a){const l=new lu(r);let f=new pe;const d=new Array;let g=-1,p=-1;try{let v=null,E=!1,S;do{if(l.available()<4)S=fe.TERMINATOR;else{const _=l.readBits(4);S=fe.forBits(_)}switch(S){case fe.TERMINATOR:break;case fe.FNC1_FIRST_POSITION:case fe.FNC1_SECOND_POSITION:E=!0;break;case fe.STRUCTURED_APPEND:if(l.available()<16)throw new F;g=l.readBits(8),p=l.readBits(8);break;case fe.ECI:const _=Qe.parseECIValue(l);if(v=z.getCharacterSetECIByValue(_),v===null)throw new F;break;case fe.HANZI:const D=l.readBits(4),P=l.readBits(S.getCharacterCountBits(i));D===Qe.GB2312_SUBSET&&Qe.decodeHanziSegment(l,f,P);break;default:const W=l.readBits(S.getCharacterCountBits(i));switch(S){case fe.NUMERIC:Qe.decodeNumericSegment(l,f,W);break;case fe.ALPHANUMERIC:Qe.decodeAlphanumericSegment(l,f,W,E);break;case fe.BYTE:Qe.decodeByteSegment(l,f,W,v,d,a);break;case fe.KANJI:Qe.decodeKanjiSegment(l,f,W);break;default:throw new F}break}}while(S!==fe.TERMINATOR)}catch{throw new F}return new Bs(r,f.toString(),d.length===0?null:d,s===null?null:s.toString(),g,p)}static decodeHanziSegment(r,i,s){if(s*13>r.available())throw new F;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const f=r.readBits(13);let d=f/96<<8&4294967295|f%96;d<959?d+=41377:d+=42657,a[l]=d>>8&255,a[l+1]=d&255,l+=2,s--}try{i.append(ve.decode(a,ie.GB2312))}catch(f){throw new F(f)}}static decodeKanjiSegment(r,i,s){if(s*13>r.available())throw new F;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const f=r.readBits(13);let d=f/192<<8&4294967295|f%192;d<7936?d+=33088:d+=49472,a[l]=d>>8,a[l+1]=d,l+=2,s--}try{i.append(ve.decode(a,ie.SHIFT_JIS))}catch(f){throw new F(f)}}static decodeByteSegment(r,i,s,a,l,f){if(8*s>r.available())throw new F;const d=new Uint8Array(s);for(let p=0;p<s;p++)d[p]=r.readBits(8);let g;a===null?g=ie.guessEncoding(d,f):g=a.getName();try{i.append(ve.decode(d,g))}catch(p){throw new F(p)}l.push(d)}static toAlphaNumericChar(r){if(r>=Qe.ALPHANUMERIC_CHARS.length)throw new F;return Qe.ALPHANUMERIC_CHARS[r]}static decodeAlphanumericSegment(r,i,s,a){const l=i.length();for(;s>1;){if(r.available()<11)throw new F;const f=r.readBits(11);i.append(Qe.toAlphaNumericChar(Math.floor(f/45))),i.append(Qe.toAlphaNumericChar(f%45)),s-=2}if(s===1){if(r.available()<6)throw new F;i.append(Qe.toAlphaNumericChar(r.readBits(6)))}if(a)for(let f=l;f<i.length();f++)i.charAt(f)==="%"&&(f<i.length()-1&&i.charAt(f+1)==="%"?i.deleteCharAt(f+1):i.setCharAt(f,""))}static decodeNumericSegment(r,i,s){for(;s>=3;){if(r.available()<10)throw new F;const a=r.readBits(10);if(a>=1e3)throw new F;i.append(Qe.toAlphaNumericChar(Math.floor(a/100))),i.append(Qe.toAlphaNumericChar(Math.floor(a/10)%10)),i.append(Qe.toAlphaNumericChar(a%10)),s-=3}if(s===2){if(r.available()<7)throw new F;const a=r.readBits(7);if(a>=100)throw new F;i.append(Qe.toAlphaNumericChar(Math.floor(a/10))),i.append(Qe.toAlphaNumericChar(a%10))}else if(s===1){if(r.available()<4)throw new F;const a=r.readBits(4);if(a>=10)throw new F;i.append(Qe.toAlphaNumericChar(a))}}static parseECIValue(r){const i=r.readBits(8);if(!(i&128))return i&127;if((i&192)===128){const s=r.readBits(8);return(i&63)<<8&4294967295|s}if((i&224)===192){const s=r.readBits(16);return(i&31)<<16&4294967295|s}throw new F}}Qe.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Qe.GB2312_SUBSET=1;class q0{constructor(r){this.mirrored=r}isMirrored(){return this.mirrored}applyMirroredCorrection(r){if(!this.mirrored||r===null||r.length<3)return;const i=r[0];r[0]=r[2],r[2]=i}}class p3{constructor(){this.rsDecoder=new Us(Ne.QR_CODE_FIELD_256)}decodeBooleanArray(r,i){return this.decodeBitMatrix(Te.parseFromBooleanArray(r),i)}decodeBitMatrix(r,i){const s=new g3(r);let a=null;try{return this.decodeBitMatrixParser(s,i)}catch(l){a=l}try{s.remask(),s.setMirror(!0),s.readVersion(),s.readFormatInformation(),s.mirror();const l=this.decodeBitMatrixParser(s,i);return l.setOther(new q0(!0)),l}catch(l){throw a!==null?a:l}}decodeBitMatrixParser(r,i){const s=r.readVersion(),a=r.readFormatInformation().getErrorCorrectionLevel(),l=r.readCodewords(),f=cu.getDataBlocks(l,s,a);let d=0;for(const v of f)d+=v.getNumDataCodewords();const g=new Uint8Array(d);let p=0;for(const v of f){const E=v.getCodewords(),S=v.getNumDataCodewords();this.correctErrors(E,S);for(let _=0;_<S;_++)g[p++]=E[_]}return Qe.decode(g,s,a,i)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new T}for(let a=0;a<i;a++)r[a]=s[a]}}class uu extends ae{constructor(r,i,s){super(r,i),this.estimatedModuleSize=s}aboutEquals(r,i,s){if(Math.abs(i-this.getY())<=r&&Math.abs(s-this.getX())<=r){const a=Math.abs(r-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1}combineEstimate(r,i,s){const a=(this.getX()+i)/2,l=(this.getY()+r)/2,f=(this.estimatedModuleSize+s)/2;return new uu(a,l,f)}}class ba{constructor(r,i,s,a,l,f,d){this.image=r,this.startX=i,this.startY=s,this.width=a,this.height=l,this.moduleSize=f,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const r=this.startX,i=this.height,s=this.width,a=r+s,l=this.startY+i/2,f=new Int32Array(3),d=this.image;for(let g=0;g<i;g++){const p=l+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));f[0]=0,f[1]=0,f[2]=0;let v=r;for(;v<a&&!d.get(v,p);)v++;let E=0;for(;v<a;){if(d.get(v,p))if(E===1)f[1]++;else if(E===2){if(this.foundPatternCross(f)){const S=this.handlePossibleCenter(f,p,v);if(S!==null)return S}f[0]=f[2],f[1]=1,f[2]=0,E=1}else f[++E]++;else E===1&&E++,f[E]++;v++}if(this.foundPatternCross(f)){const S=this.handlePossibleCenter(f,p,a);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new G}static centerFromEnd(r,i){return i-r[2]-r[1]/2}foundPatternCross(r){const i=this.moduleSize,s=i/2;for(let a=0;a<3;a++)if(Math.abs(i-r[a])>=s)return!1;return!0}crossCheckVertical(r,i,s,a){const l=this.image,f=l.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let g=r;for(;g>=0&&l.get(i,g)&&d[1]<=s;)d[1]++,g--;if(g<0||d[1]>s)return NaN;for(;g>=0&&!l.get(i,g)&&d[0]<=s;)d[0]++,g--;if(d[0]>s)return NaN;for(g=r+1;g<f&&l.get(i,g)&&d[1]<=s;)d[1]++,g++;if(g===f||d[1]>s)return NaN;for(;g<f&&!l.get(i,g)&&d[2]<=s;)d[2]++,g++;if(d[2]>s)return NaN;const p=d[0]+d[1]+d[2];return 5*Math.abs(p-a)>=2*a?NaN:this.foundPatternCross(d)?ba.centerFromEnd(d,g):NaN}handlePossibleCenter(r,i,s){const a=r[0]+r[1]+r[2],l=ba.centerFromEnd(r,s),f=this.crossCheckVertical(i,l,2*r[1],a);if(!isNaN(f)){const d=(r[0]+r[1]+r[2])/3;for(const p of this.possibleCenters)if(p.aboutEquals(d,f,l))return p.combineEstimate(f,l,d);const g=new uu(l,f,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class fu extends ae{constructor(r,i,s,a){super(r,i),this.estimatedModuleSize=s,this.count=a,a===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(r,i,s){if(Math.abs(i-this.getY())<=r&&Math.abs(s-this.getX())<=r){const a=Math.abs(r-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1}combineEstimate(r,i,s){const a=this.count+1,l=(this.count*this.getX()+i)/a,f=(this.count*this.getY()+r)/a,d=(this.count*this.estimatedModuleSize+s)/a;return new fu(l,f,d,a)}}class m3{constructor(r){this.bottomLeft=r[0],this.topLeft=r[1],this.topRight=r[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class St{constructor(r,i){this.image=r,this.resultPointCallback=i,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=i}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(r){const i=r!=null&&r.get(U.TRY_HARDER)!==void 0,s=r!=null&&r.get(U.PURE_BARCODE)!==void 0,a=this.image,l=a.getHeight(),f=a.getWidth();let d=Math.floor(3*l/(4*St.MAX_MODULES));(d<St.MIN_SKIP||i)&&(d=St.MIN_SKIP);let g=!1;const p=new Int32Array(5);for(let E=d-1;E<l&&!g;E+=d){p[0]=0,p[1]=0,p[2]=0,p[3]=0,p[4]=0;let S=0;for(let _=0;_<f;_++)if(a.get(_,E))(S&1)===1&&S++,p[S]++;else if(S&1)p[S]++;else if(S===4)if(St.foundPatternCross(p)){if(this.handlePossibleCenter(p,E,_,s)===!0)if(d=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const P=this.findRowSkip();P>p[2]&&(E+=P-p[2]-d,_=f-1)}else{p[0]=p[2],p[1]=p[3],p[2]=p[4],p[3]=1,p[4]=0,S=3;continue}S=0,p[0]=0,p[1]=0,p[2]=0,p[3]=0,p[4]=0}else p[0]=p[2],p[1]=p[3],p[2]=p[4],p[3]=1,p[4]=0,S=3;else p[++S]++;St.foundPatternCross(p)&&this.handlePossibleCenter(p,E,f,s)===!0&&(d=p[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const v=this.selectBestPatterns();return ae.orderBestPatterns(v),new m3(v)}static centerFromEnd(r,i){return i-r[4]-r[3]-r[2]/2}static foundPatternCross(r){let i=0;for(let l=0;l<5;l++){const f=r[l];if(f===0)return!1;i+=f}if(i<7)return!1;const s=i/7,a=s/2;return Math.abs(s-r[0])<a&&Math.abs(s-r[1])<a&&Math.abs(3*s-r[2])<3*a&&Math.abs(s-r[3])<a&&Math.abs(s-r[4])<a}getCrossCheckStateCount(){const r=this.crossCheckStateCount;return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r}crossCheckDiagonal(r,i,s,a){const l=this.getCrossCheckStateCount();let f=0;const d=this.image;for(;r>=f&&i>=f&&d.get(i-f,r-f);)l[2]++,f++;if(r<f||i<f)return!1;for(;r>=f&&i>=f&&!d.get(i-f,r-f)&&l[1]<=s;)l[1]++,f++;if(r<f||i<f||l[1]>s)return!1;for(;r>=f&&i>=f&&d.get(i-f,r-f)&&l[0]<=s;)l[0]++,f++;if(l[0]>s)return!1;const g=d.getHeight(),p=d.getWidth();for(f=1;r+f<g&&i+f<p&&d.get(i+f,r+f);)l[2]++,f++;if(r+f>=g||i+f>=p)return!1;for(;r+f<g&&i+f<p&&!d.get(i+f,r+f)&&l[3]<s;)l[3]++,f++;if(r+f>=g||i+f>=p||l[3]>=s)return!1;for(;r+f<g&&i+f<p&&d.get(i+f,r+f)&&l[4]<s;)l[4]++,f++;if(l[4]>=s)return!1;const v=l[0]+l[1]+l[2]+l[3]+l[4];return Math.abs(v-a)<2*a&&St.foundPatternCross(l)}crossCheckVertical(r,i,s,a){const l=this.image,f=l.getHeight(),d=this.getCrossCheckStateCount();let g=r;for(;g>=0&&l.get(i,g);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!l.get(i,g)&&d[1]<=s;)d[1]++,g--;if(g<0||d[1]>s)return NaN;for(;g>=0&&l.get(i,g)&&d[0]<=s;)d[0]++,g--;if(d[0]>s)return NaN;for(g=r+1;g<f&&l.get(i,g);)d[2]++,g++;if(g===f)return NaN;for(;g<f&&!l.get(i,g)&&d[3]<s;)d[3]++,g++;if(g===f||d[3]>=s)return NaN;for(;g<f&&l.get(i,g)&&d[4]<s;)d[4]++,g++;if(d[4]>=s)return NaN;const p=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(p-a)>=2*a?NaN:St.foundPatternCross(d)?St.centerFromEnd(d,g):NaN}crossCheckHorizontal(r,i,s,a){const l=this.image,f=l.getWidth(),d=this.getCrossCheckStateCount();let g=r;for(;g>=0&&l.get(g,i);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!l.get(g,i)&&d[1]<=s;)d[1]++,g--;if(g<0||d[1]>s)return NaN;for(;g>=0&&l.get(g,i)&&d[0]<=s;)d[0]++,g--;if(d[0]>s)return NaN;for(g=r+1;g<f&&l.get(g,i);)d[2]++,g++;if(g===f)return NaN;for(;g<f&&!l.get(g,i)&&d[3]<s;)d[3]++,g++;if(g===f||d[3]>=s)return NaN;for(;g<f&&l.get(g,i)&&d[4]<s;)d[4]++,g++;if(d[4]>=s)return NaN;const p=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(p-a)>=a?NaN:St.foundPatternCross(d)?St.centerFromEnd(d,g):NaN}handlePossibleCenter(r,i,s,a){const l=r[0]+r[1]+r[2]+r[3]+r[4];let f=St.centerFromEnd(r,s),d=this.crossCheckVertical(i,Math.floor(f),r[2],l);if(!isNaN(d)&&(f=this.crossCheckHorizontal(Math.floor(f),Math.floor(d),r[2],l),!isNaN(f)&&(!a||this.crossCheckDiagonal(Math.floor(d),Math.floor(f),r[2],l)))){const g=l/7;let p=!1;const v=this.possibleCenters;for(let E=0,S=v.length;E<S;E++){const _=v[E];if(_.aboutEquals(g,d,f)){v[E]=_.combineEstimate(d,f,g),p=!0;break}}if(!p){const E=new fu(f,d,g);v.push(E),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(E)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let i=null;for(const s of this.possibleCenters)if(s.getCount()>=St.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let r=0,i=0;const s=this.possibleCenters.length;for(const f of this.possibleCenters)f.getCount()>=St.CENTER_QUORUM&&(r++,i+=f.getEstimatedModuleSize());if(r<3)return!1;const a=i/s;let l=0;for(const f of this.possibleCenters)l+=Math.abs(f.getEstimatedModuleSize()-a);return l<=.05*i}selectBestPatterns(){const r=this.possibleCenters.length;if(r<3)throw new G;const i=this.possibleCenters;let s;if(r>3){let a=0,l=0;for(const g of this.possibleCenters){const p=g.getEstimatedModuleSize();a+=p,l+=p*p}s=a/r;let f=Math.sqrt(l/r-s*s);i.sort((g,p)=>{const v=Math.abs(p.getEstimatedModuleSize()-s),E=Math.abs(g.getEstimatedModuleSize()-s);return v<E?-1:v>E?1:0});const d=Math.max(.2*s,f);for(let g=0;g<i.length&&i.length>3;g++){const p=i[g];Math.abs(p.getEstimatedModuleSize()-s)>d&&(i.splice(g,1),g--)}}if(i.length>3){let a=0;for(const l of i)a+=l.getEstimatedModuleSize();s=a/i.length,i.sort((l,f)=>{if(f.getCount()===l.getCount()){const d=Math.abs(f.getEstimatedModuleSize()-s),g=Math.abs(l.getEstimatedModuleSize()-s);return d<g?1:d>g?-1:0}else return f.getCount()-l.getCount()}),i.splice(3)}return[i[0],i[1],i[2]]}}St.CENTER_QUORUM=2,St.MIN_SKIP=3,St.MAX_MODULES=57;class Ws{constructor(r){this.image=r}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(r){this.resultPointCallback=r==null?null:r.get(U.NEED_RESULT_POINT_CALLBACK);const s=new St(this.image,this.resultPointCallback).find(r);return this.processFinderPatternInfo(s)}processFinderPatternInfo(r){const i=r.getTopLeft(),s=r.getTopRight(),a=r.getBottomLeft(),l=this.calculateModuleSize(i,s,a);if(l<1)throw new G("No pattern found in proccess finder.");const f=Ws.computeDimension(i,s,a,l),d=ue.getProvisionalVersionForDimension(f),g=d.getDimensionForVersion()-7;let p=null;if(d.getAlignmentPatternCenters().length>0){const _=s.getX()-i.getX()+a.getX(),D=s.getY()-i.getY()+a.getY(),P=1-3/g,W=Math.floor(i.getX()+P*(_-i.getX())),H=Math.floor(i.getY()+P*(D-i.getY()));for(let q=4;q<=16;q<<=1)try{p=this.findAlignmentInRegion(l,W,H,q);break}catch(J){if(!(J instanceof G))throw J}}const v=Ws.createTransform(i,s,a,p,f),E=Ws.sampleGrid(this.image,v,f);let S;return p===null?S=[a,i,s]:S=[a,i,s,p],new wa(E,S)}static createTransform(r,i,s,a,l){const f=l-3.5;let d,g,p,v;return a!==null?(d=a.getX(),g=a.getY(),p=f-3,v=p):(d=i.getX()-r.getX()+s.getX(),g=i.getY()-r.getY()+s.getY(),p=f,v=f),kr.quadrilateralToQuadrilateral(3.5,3.5,f,3.5,p,v,3.5,f,r.getX(),r.getY(),i.getX(),i.getY(),d,g,s.getX(),s.getY())}static sampleGrid(r,i,s){return _n.getInstance().sampleGridWithTransform(r,s,s,i)}static computeDimension(r,i,s,a){const l=Re.round(ae.distance(r,i)/a),f=Re.round(ae.distance(r,s)/a);let d=Math.floor((l+f)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new G("Dimensions could be not found.")}return d}calculateModuleSize(r,i,s){return(this.calculateModuleSizeOneWay(r,i)+this.calculateModuleSizeOneWay(r,s))/2}calculateModuleSizeOneWay(r,i){const s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(r.getX()),Math.floor(r.getY()),Math.floor(i.getX()),Math.floor(i.getY())),a=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(i.getX()),Math.floor(i.getY()),Math.floor(r.getX()),Math.floor(r.getY()));return isNaN(s)?a/7:isNaN(a)?s/7:(s+a)/14}sizeOfBlackWhiteBlackRunBothWays(r,i,s,a){let l=this.sizeOfBlackWhiteBlackRun(r,i,s,a),f=1,d=r-(s-r);d<0?(f=r/(r-d),d=0):d>=this.image.getWidth()&&(f=(this.image.getWidth()-1-r)/(d-r),d=this.image.getWidth()-1);let g=Math.floor(i-(a-i)*f);return f=1,g<0?(f=i/(i-g),g=0):g>=this.image.getHeight()&&(f=(this.image.getHeight()-1-i)/(g-i),g=this.image.getHeight()-1),d=Math.floor(r+(d-r)*f),l+=this.sizeOfBlackWhiteBlackRun(r,i,d,g),l-1}sizeOfBlackWhiteBlackRun(r,i,s,a){const l=Math.abs(a-i)>Math.abs(s-r);if(l){let _=r;r=i,i=_,_=s,s=a,a=_}const f=Math.abs(s-r),d=Math.abs(a-i);let g=-f/2;const p=r<s?1:-1,v=i<a?1:-1;let E=0;const S=s+p;for(let _=r,D=i;_!==S;_+=p){const P=l?D:_,W=l?_:D;if(E===1===this.image.get(P,W)){if(E===2)return Re.distance(_,D,r,i);E++}if(g+=d,g>0){if(D===a)break;D+=v,g-=f}}return E===2?Re.distance(s+p,a,r,i):NaN}findAlignmentInRegion(r,i,s,a){const l=Math.floor(a*r),f=Math.max(0,i-l),d=Math.min(this.image.getWidth()-1,i+l);if(d-f<r*3)throw new G("Alignment top exceeds estimated module size.");const g=Math.max(0,s-l),p=Math.min(this.image.getHeight()-1,s+l);if(p-g<r*3)throw new G("Alignment bottom exceeds estimated module size.");return new ba(this.image,f,g,d-f,p-g,r,this.resultPointCallback).find()}}class Mn{constructor(){this.decoder=new p3}getDecoder(){return this.decoder}decode(r,i){let s,a;if(i!=null&&i.get(U.PURE_BARCODE)!==void 0){const g=Mn.extractPureBits(r.getBlackMatrix());s=this.decoder.decodeBitMatrix(g,i),a=Mn.NO_POINTS}else{const g=new Ws(r.getBlackMatrix()).detect(i);s=this.decoder.decodeBitMatrix(g.getBits(),i),a=g.getPoints()}s.getOther()instanceof q0&&s.getOther().applyMirroredCorrection(a);const l=new Ze(s.getText(),s.getRawBytes(),void 0,a,le.QR_CODE,void 0),f=s.getByteSegments();f!==null&&l.putMetadata(bt.BYTE_SEGMENTS,f);const d=s.getECLevel();return d!==null&&l.putMetadata(bt.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(l.putMetadata(bt.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),l.putMetadata(bt.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),l}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i===null||s===null)throw new G;const a=this.moduleSize(i,r);let l=i[1],f=s[1],d=i[0],g=s[0];if(d>=g||l>=f)throw new G;if(f-l!==g-d&&(g=d+(f-l),g>=r.getWidth()))throw new G;const p=Math.round((g-d+1)/a),v=Math.round((f-l+1)/a);if(p<=0||v<=0)throw new G;if(v!==p)throw new G;const E=Math.floor(a/2);l+=E,d+=E;const S=d+Math.floor((p-1)*a)-g;if(S>0){if(S>E)throw new G;d-=S}const _=l+Math.floor((v-1)*a)-f;if(_>0){if(_>E)throw new G;l-=_}const D=new Te(p,v);for(let P=0;P<v;P++){const W=l+Math.floor(P*a);for(let H=0;H<p;H++)r.get(d+Math.floor(H*a),W)&&D.set(H,P)}return D}static moduleSize(r,i){const s=i.getHeight(),a=i.getWidth();let l=r[0],f=r[1],d=!0,g=0;for(;l<a&&f<s;){if(d!==i.get(l,f)){if(++g===5)break;d=!d}l++,f++}if(l===a||f===s)throw new G;return(l-r[0])/7}}Mn.NO_POINTS=new Array;class ge{PDF417Common(){}static getBitCountSum(r){return Re.sum(r)}static toIntArray(r){if(r==null||!r.length)return ge.EMPTY_INT_ARRAY;const i=new Int32Array(r.length);let s=0;for(const a of r)i[s++]=a;return i}static getCodeword(r){const i=I.binarySearch(ge.SYMBOL_TABLE,r&262143);return i<0?-1:(ge.CODEWORD_TABLE[i]-1)%ge.NUMBER_OF_CODEWORDS}}ge.NUMBER_OF_CODEWORDS=929,ge.MAX_CODEWORDS_IN_BARCODE=ge.NUMBER_OF_CODEWORDS-1,ge.MIN_ROWS_IN_BARCODE=3,ge.MAX_ROWS_IN_BARCODE=90,ge.MODULES_IN_CODEWORD=17,ge.MODULES_IN_STOP_PATTERN=18,ge.BARS_IN_MODULE=8,ge.EMPTY_INT_ARRAY=new Int32Array([]),ge.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),ge.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class x3{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class ye{static detectMultiple(r,i,s){let a=r.getBlackMatrix(),l=ye.detect(s,a);return l.length||(a=a.clone(),a.rotate180(),l=ye.detect(s,a)),new x3(a,l)}static detect(r,i){const s=new Array;let a=0,l=0,f=!1;for(;a<i.getHeight();){const d=ye.findVertices(i,a,l);if(d[0]==null&&d[3]==null){if(!f)break;f=!1,l=0;for(const g of s)g[1]!=null&&(a=Math.trunc(Math.max(a,g[1].getY()))),g[3]!=null&&(a=Math.max(a,Math.trunc(g[3].getY())));a+=ye.ROW_STEP;continue}if(f=!0,s.push(d),!r)break;d[2]!=null?(l=Math.trunc(d[2].getX()),a=Math.trunc(d[2].getY())):(l=Math.trunc(d[4].getX()),a=Math.trunc(d[4].getY()))}return s}static findVertices(r,i,s){const a=r.getHeight(),l=r.getWidth(),f=new Array(8);return ye.copyToResult(f,ye.findRowsWithPattern(r,a,l,i,s,ye.START_PATTERN),ye.INDEXES_START_PATTERN),f[4]!=null&&(s=Math.trunc(f[4].getX()),i=Math.trunc(f[4].getY())),ye.copyToResult(f,ye.findRowsWithPattern(r,a,l,i,s,ye.STOP_PATTERN),ye.INDEXES_STOP_PATTERN),f}static copyToResult(r,i,s){for(let a=0;a<s.length;a++)r[s[a]]=i[a]}static findRowsWithPattern(r,i,s,a,l,f){const d=new Array(4);let g=!1;const p=new Int32Array(f.length);for(;a<i;a+=ye.ROW_STEP){let E=ye.findGuardPattern(r,l,a,s,!1,f,p);if(E!=null){for(;a>0;){const S=ye.findGuardPattern(r,l,--a,s,!1,f,p);if(S!=null)E=S;else{a++;break}}d[0]=new ae(E[0],a),d[1]=new ae(E[1],a),g=!0;break}}let v=a+1;if(g){let E=0,S=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;v<i;v++){const _=ye.findGuardPattern(r,S[0],v,s,!1,f,p);if(_!=null&&Math.abs(S[0]-_[0])<ye.MAX_PATTERN_DRIFT&&Math.abs(S[1]-_[1])<ye.MAX_PATTERN_DRIFT)S=_,E=0;else{if(E>ye.SKIPPED_ROW_COUNT_MAX)break;E++}}v-=E+1,d[2]=new ae(S[0],v),d[3]=new ae(S[1],v)}return v-a<ye.BARCODE_MIN_HEIGHT&&I.fill(d,null),d}static findGuardPattern(r,i,s,a,l,f,d){I.fillWithin(d,0,d.length,0);let g=i,p=0;for(;r.get(g,s)&&g>0&&p++<ye.MAX_PIXEL_DRIFT;)g--;let v=g,E=0,S=f.length;for(let _=l;v<a;v++)if(r.get(v,s)!==_)d[E]++;else{if(E===S-1){if(ye.patternMatchVariance(d,f,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE)return new Int32Array([g,v]);g+=d[0]+d[1],M.arraycopy(d,2,d,0,E-1),d[E-1]=0,d[E]=0,E--}else E++;d[E]=1,_=!_}return E===S-1&&ye.patternMatchVariance(d,f,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE?new Int32Array([g,v-1]):null}static patternMatchVariance(r,i,s){let a=r.length,l=0,f=0;for(let p=0;p<a;p++)l+=r[p],f+=i[p];if(l<f)return 1/0;let d=l/f;s*=d;let g=0;for(let p=0;p<a;p++){let v=r[p],E=i[p]*d,S=v>E?v-E:E-v;if(S>s)return 1/0;g+=S}return g/l}}ye.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ye.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ye.MAX_AVG_VARIANCE=.42,ye.MAX_INDIVIDUAL_VARIANCE=.8,ye.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ye.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ye.MAX_PIXEL_DRIFT=3,ye.MAX_PATTERN_DRIFT=5,ye.SKIPPED_ROW_COUNT_MAX=25,ye.ROW_STEP=5,ye.BARCODE_MIN_HEIGHT=10;class Ot{constructor(r,i){if(i.length===0)throw new b;this.field=r;let s=i.length;if(s>1&&i[0]===0){let a=1;for(;a<s&&i[a]===0;)a++;a===s?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(s-a),M.arraycopy(i,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=i}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(r){return this.coefficients[this.coefficients.length-1-r]}evaluateAt(r){if(r===0)return this.getCoefficient(0);if(r===1){let a=0;for(let l of this.coefficients)a=this.field.add(a,l);return a}let i=this.coefficients[0],s=this.coefficients.length;for(let a=1;a<s;a++)i=this.field.add(this.field.multiply(r,i),this.coefficients[a]);return i}add(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");if(this.isZero())return r;if(r.isZero())return this;let i=this.coefficients,s=r.coefficients;if(i.length>s.length){let f=i;i=s,s=f}let a=new Int32Array(s.length),l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let f=l;f<s.length;f++)a[f]=this.field.add(i[f-l],s[f]);return new Ot(this.field,a)}subtract(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");return r.isZero()?this:this.add(r.negative())}multiply(r){return r instanceof Ot?this.multiplyOther(r):this.multiplyScalar(r)}multiplyOther(r){if(!this.field.equals(r.field))throw new b("ModulusPolys do not have same ModulusGF field");if(this.isZero()||r.isZero())return new Ot(this.field,new Int32Array([0]));let i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,f=new Int32Array(s+l-1);for(let d=0;d<s;d++){let g=i[d];for(let p=0;p<l;p++)f[d+p]=this.field.add(f[d+p],this.field.multiply(g,a[p]))}return new Ot(this.field,f)}negative(){let r=this.coefficients.length,i=new Int32Array(r);for(let s=0;s<r;s++)i[s]=this.field.subtract(0,this.coefficients[s]);return new Ot(this.field,i)}multiplyScalar(r){if(r===0)return new Ot(this.field,new Int32Array([0]));if(r===1)return this;let i=this.coefficients.length,s=new Int32Array(i);for(let a=0;a<i;a++)s[a]=this.field.multiply(this.coefficients[a],r);return new Ot(this.field,s)}multiplyByMonomial(r,i){if(r<0)throw new b;if(i===0)return new Ot(this.field,new Int32Array([0]));let s=this.coefficients.length,a=new Int32Array(s+r);for(let l=0;l<s;l++)a[l]=this.field.multiply(this.coefficients[l],i);return new Ot(this.field,a)}toString(){let r=new pe;for(let i=this.getDegree();i>=0;i--){let s=this.getCoefficient(i);s!==0&&(s<0?(r.append(" - "),s=-s):r.length()>0&&r.append(" + "),(i===0||s!==1)&&r.append(s),i!==0&&(i===1?r.append("x"):(r.append("x^"),r.append(i))))}return r.toString()}}class w3{add(r,i){return(r+i)%this.modulus}subtract(r,i){return(this.modulus+r-i)%this.modulus}exp(r){return this.expTable[r]}log(r){if(r===0)throw new b;return this.logTable[r]}inverse(r){if(r===0)throw new ma;return this.expTable[this.modulus-this.logTable[r]-1]}multiply(r,i){return r===0||i===0?0:this.expTable[(this.logTable[r]+this.logTable[i])%(this.modulus-1)]}getSize(){return this.modulus}equals(r){return r===this}}class du extends w3{constructor(r,i){super(),this.modulus=r,this.expTable=new Int32Array(r),this.logTable=new Int32Array(r);let s=1;for(let a=0;a<r;a++)this.expTable[a]=s,s=s*i%r;for(let a=0;a<r-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new Ot(this,new Int32Array([0])),this.one=new Ot(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new b;if(i===0)return this.zero;let s=new Int32Array(r+1);return s[0]=i,new Ot(this,s)}}du.PDF417_GF=new du(ge.NUMBER_OF_CODEWORDS,3);class J0{constructor(){this.field=du.PDF417_GF}decode(r,i,s){let a=new Ot(this.field,r),l=new Int32Array(i),f=!1;for(let D=i;D>0;D--){let P=a.evaluateAt(this.field.exp(D));l[i-D]=P,P!==0&&(f=!0)}if(!f)return 0;let d=this.field.getOne();if(s!=null)for(const D of s){let P=this.field.exp(r.length-1-D),W=new Ot(this.field,new Int32Array([this.field.subtract(0,P),1]));d=d.multiply(W)}let g=new Ot(this.field,l),p=this.runEuclideanAlgorithm(this.field.buildMonomial(i,1),g,i),v=p[0],E=p[1],S=this.findErrorLocations(v),_=this.findErrorMagnitudes(E,v,S);for(let D=0;D<S.length;D++){let P=r.length-1-this.field.log(S[D]);if(P<0)throw T.getChecksumInstance();r[P]=this.field.subtract(r[P],_[D])}return S.length}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){let S=r;r=i,i=S}let a=r,l=i,f=this.field.getZero(),d=this.field.getOne();for(;l.getDegree()>=Math.round(s/2);){let S=a,_=f;if(a=l,f=d,a.isZero())throw T.getChecksumInstance();l=S;let D=this.field.getZero(),P=a.getCoefficient(a.getDegree()),W=this.field.inverse(P);for(;l.getDegree()>=a.getDegree()&&!l.isZero();){let H=l.getDegree()-a.getDegree(),q=this.field.multiply(l.getCoefficient(l.getDegree()),W);D=D.add(this.field.buildMonomial(H,q)),l=l.subtract(a.multiplyByMonomial(H,q))}d=D.multiply(f).subtract(_).negative()}let g=d.getCoefficient(0);if(g===0)throw T.getChecksumInstance();let p=this.field.inverse(g),v=d.multiply(p),E=l.multiply(p);return[v,E]}findErrorLocations(r){let i=r.getDegree(),s=new Int32Array(i),a=0;for(let l=1;l<this.field.getSize()&&a<i;l++)r.evaluateAt(l)===0&&(s[a]=this.field.inverse(l),a++);if(a!==i)throw T.getChecksumInstance();return s}findErrorMagnitudes(r,i,s){let a=i.getDegree(),l=new Int32Array(a);for(let p=1;p<=a;p++)l[a-p]=this.field.multiply(p,i.getCoefficient(p));let f=new Ot(this.field,l),d=s.length,g=new Int32Array(d);for(let p=0;p<d;p++){let v=this.field.inverse(s[p]),E=this.field.subtract(0,r.evaluateAt(v)),S=this.field.inverse(f.evaluateAt(v));g[p]=this.field.multiply(E,S)}return g}}class ui{constructor(r,i,s,a,l){r instanceof ui?this.constructor_2(r):this.constructor_1(r,i,s,a,l)}constructor_1(r,i,s,a,l){const f=i==null||s==null,d=a==null||l==null;if(f&&d)throw new G;f?(i=new ae(0,a.getY()),s=new ae(0,l.getY())):d&&(a=new ae(r.getWidth()-1,i.getY()),l=new ae(r.getWidth()-1,s.getY())),this.image=r,this.topLeft=i,this.bottomLeft=s,this.topRight=a,this.bottomRight=l,this.minX=Math.trunc(Math.min(i.getX(),s.getX())),this.maxX=Math.trunc(Math.max(a.getX(),l.getX())),this.minY=Math.trunc(Math.min(i.getY(),a.getY())),this.maxY=Math.trunc(Math.max(s.getY(),l.getY()))}constructor_2(r){this.image=r.image,this.topLeft=r.getTopLeft(),this.bottomLeft=r.getBottomLeft(),this.topRight=r.getTopRight(),this.bottomRight=r.getBottomRight(),this.minX=r.getMinX(),this.maxX=r.getMaxX(),this.minY=r.getMinY(),this.maxY=r.getMaxY()}static merge(r,i){return r==null?i:i==null?r:new ui(r.image,r.topLeft,r.bottomLeft,i.topRight,i.bottomRight)}addMissingRows(r,i,s){let a=this.topLeft,l=this.bottomLeft,f=this.topRight,d=this.bottomRight;if(r>0){let g=s?this.topLeft:this.topRight,p=Math.trunc(g.getY()-r);p<0&&(p=0);let v=new ae(g.getX(),p);s?a=v:f=v}if(i>0){let g=s?this.bottomLeft:this.bottomRight,p=Math.trunc(g.getY()+i);p>=this.image.getHeight()&&(p=this.image.getHeight()-1);let v=new ae(g.getX(),p);s?l=v:d=v}return new ui(this.image,a,l,f,d)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class v3{constructor(r,i,s,a){this.columnCount=r,this.errorCorrectionLevel=a,this.rowCountUpperPart=i,this.rowCountLowerPart=s,this.rowCount=i+s}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class $s{constructor(){this.buffer=""}static form(r,i){let s=-1;function a(f,d,g,p,v,E){if(f==="%%")return"%";if(i[++s]===void 0)return;f=p?parseInt(p.substr(1)):void 0;let S=v?parseInt(v.substr(1)):void 0,_;switch(E){case"s":_=i[s];break;case"c":_=i[s][0];break;case"f":_=parseFloat(i[s]).toFixed(f);break;case"p":_=parseFloat(i[s]).toPrecision(f);break;case"e":_=parseFloat(i[s]).toExponential(f);break;case"x":_=parseInt(i[s]).toString(S||16);break;case"d":_=parseFloat(parseInt(i[s],S||10).toPrecision(f)).toFixed(0);break}_=typeof _=="object"?JSON.stringify(_):(+_).toString(S);let D=parseInt(g),P=g&&g[0]+""=="0"?"0":" ";for(;_.length<D;)_=d!==void 0?_+P:P+_;return _}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}format(r,...i){this.buffer+=$s.form(r,i)}toString(){return this.buffer}}class zs{constructor(r){this.boundingBox=new ui(r),this.codewords=new Array(r.getMaxY()-r.getMinY()+1)}getCodewordNearby(r){let i=this.getCodeword(r);if(i!=null)return i;for(let s=1;s<zs.MAX_NEARBY_DISTANCE;s++){let a=this.imageRowToCodewordIndex(r)-s;if(a>=0&&(i=this.codewords[a],i!=null)||(a=this.imageRowToCodewordIndex(r)+s,a<this.codewords.length&&(i=this.codewords[a],i!=null)))return i}return null}imageRowToCodewordIndex(r){return r-this.boundingBox.getMinY()}setCodeword(r,i){this.codewords[this.imageRowToCodewordIndex(r)]=i}getCodeword(r){return this.codewords[this.imageRowToCodewordIndex(r)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const r=new $s;let i=0;for(const s of this.codewords){if(s==null){r.format("%3d: | %n",i++);continue}r.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}return r.toString()}}zs.MAX_NEARBY_DISTANCE=5;class Vs{constructor(){this.values=new Map}setValue(r){r=Math.trunc(r);let i=this.values.get(r);i==null&&(i=0),i++,this.values.set(r,i)}getValue(){let r=-1,i=new Array;for(const[s,a]of this.values.entries()){const l={getKey:()=>s,getValue:()=>a};l.getValue()>r?(r=l.getValue(),i=[],i.push(l.getKey())):l.getValue()===r&&i.push(l.getKey())}return ge.toIntArray(i)}getConfidence(r){return this.values.get(r)}}class eh extends zs{constructor(r,i){super(r),this._isLeft=i}setRowNumbers(){for(let r of this.getCodewords())r!=null&&r.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(r){let i=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(i,r);let s=this.getBoundingBox(),a=this._isLeft?s.getTopLeft():s.getTopRight(),l=this._isLeft?s.getBottomLeft():s.getBottomRight(),f=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.imageRowToCodewordIndex(Math.trunc(l.getY())),g=-1,p=1,v=0;for(let E=f;E<d;E++){if(i[E]==null)continue;let S=i[E],_=S.getRowNumber()-g;if(_===0)v++;else if(_===1)p=Math.max(p,v),v=1,g=S.getRowNumber();else if(_<0||S.getRowNumber()>=r.getRowCount()||_>E)i[E]=null;else{let D;p>2?D=(p-2)*_:D=_;let P=D>=E;for(let W=1;W<=D&&!P;W++)P=i[E-W]!=null;P?i[E]=null:(g=S.getRowNumber(),v=1)}}}getRowHeights(){let r=this.getBarcodeMetadata();if(r==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(r);let i=new Int32Array(r.getRowCount());for(let s of this.getCodewords())if(s!=null){let a=s.getRowNumber();if(a>=i.length)continue;i[a]++}return i}adjustIncompleteIndicatorColumnRowNumbers(r){let i=this.getBoundingBox(),s=this._isLeft?i.getTopLeft():i.getTopRight(),a=this._isLeft?i.getBottomLeft():i.getBottomRight(),l=this.imageRowToCodewordIndex(Math.trunc(s.getY())),f=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.getCodewords(),g=-1;for(let p=l;p<f;p++){if(d[p]==null)continue;let v=d[p];v.setRowNumberAsRowIndicatorColumn();let E=v.getRowNumber()-g;E===0||(E===1?g=v.getRowNumber():v.getRowNumber()>=r.getRowCount()?d[p]=null:g=v.getRowNumber())}}getBarcodeMetadata(){let r=this.getCodewords(),i=new Vs,s=new Vs,a=new Vs,l=new Vs;for(let d of r){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let g=d.getValue()%30,p=d.getRowNumber();switch(this._isLeft||(p+=2),p%3){case 0:s.setValue(g*3+1);break;case 1:l.setValue(g/3),a.setValue(g%3);break;case 2:i.setValue(g+1);break}}if(i.getValue().length===0||s.getValue().length===0||a.getValue().length===0||l.getValue().length===0||i.getValue()[0]<1||s.getValue()[0]+a.getValue()[0]<ge.MIN_ROWS_IN_BARCODE||s.getValue()[0]+a.getValue()[0]>ge.MAX_ROWS_IN_BARCODE)return null;let f=new v3(i.getValue()[0],s.getValue()[0],a.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(r,f),f}removeIncorrectCodewords(r,i){for(let s=0;s<r.length;s++){let a=r[s];if(r[s]==null)continue;let l=a.getValue()%30,f=a.getRowNumber();if(f>i.getRowCount()){r[s]=null;continue}switch(this._isLeft||(f+=2),f%3){case 0:l*3+1!==i.getRowCountUpperPart()&&(r[s]=null);break;case 1:(Math.trunc(l/3)!==i.getErrorCorrectionLevel()||l%3!==i.getRowCountLowerPart())&&(r[s]=null);break;case 2:l+1!==i.getColumnCount()&&(r[s]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
467
+ `+super.toString()}}class Hs{constructor(r,i){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=r,this.barcodeColumnCount=r.getColumnCount(),this.boundingBox=i,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let r=ge.MAX_CODEWORDS_IN_BARCODE,i;do i=r,r=this.adjustRowNumbersAndGetCount();while(r>0&&r<i);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(r){r!=null&&r.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let r=this.adjustRowNumbersByRow();if(r===0)return 0;for(let i=1;i<this.barcodeColumnCount+1;i++){let s=this.detectionResultColumns[i].getCodewords();for(let a=0;a<s.length;a++)s[a]!=null&&(s[a].hasValidRowNumber()||this.adjustRowNumbers(i,a,s))}return r}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let r=this.detectionResultColumns[0].getCodewords(),i=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<r.length;s++)if(r[s]!=null&&i[s]!=null&&r[s].getRowNumber()===i[s].getRowNumber())for(let a=1;a<=this.barcodeColumnCount;a++){let l=this.detectionResultColumns[a].getCodewords()[s];l!=null&&(l.setRowNumber(r[s].getRowNumber()),l.hasValidRowNumber()||(this.detectionResultColumns[a].getCodewords()[s]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let r=0,i=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<i.length;s++){if(i[s]==null)continue;let a=i[s].getRowNumber(),l=0;for(let f=this.barcodeColumnCount+1;f>0&&l<this.ADJUST_ROW_NUMBER_SKIP;f--){let d=this.detectionResultColumns[f].getCodewords()[s];d!=null&&(l=Hs.adjustRowNumberIfValid(a,l,d),d.hasValidRowNumber()||r++)}}return r}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let r=0,i=this.detectionResultColumns[0].getCodewords();for(let s=0;s<i.length;s++){if(i[s]==null)continue;let a=i[s].getRowNumber(),l=0;for(let f=1;f<this.barcodeColumnCount+1&&l<this.ADJUST_ROW_NUMBER_SKIP;f++){let d=this.detectionResultColumns[f].getCodewords()[s];d!=null&&(l=Hs.adjustRowNumberIfValid(a,l,d),d.hasValidRowNumber()||r++)}}return r}static adjustRowNumberIfValid(r,i,s){return s==null||s.hasValidRowNumber()||(s.isValidRowNumber(r)?(s.setRowNumber(r),i=0):++i),i}adjustRowNumbers(r,i,s){if(!this.detectionResultColumns[r-1])return;let a=s[i],l=this.detectionResultColumns[r-1].getCodewords(),f=l;this.detectionResultColumns[r+1]!=null&&(f=this.detectionResultColumns[r+1].getCodewords());let d=new Array(14);d[2]=l[i],d[3]=f[i],i>0&&(d[0]=s[i-1],d[4]=l[i-1],d[5]=f[i-1]),i>1&&(d[8]=s[i-2],d[10]=l[i-2],d[11]=f[i-2]),i<s.length-1&&(d[1]=s[i+1],d[6]=l[i+1],d[7]=f[i+1]),i<s.length-2&&(d[9]=s[i+2],d[12]=l[i+2],d[13]=f[i+2]);for(let g of d)if(Hs.adjustRowNumber(a,g))return}static adjustRowNumber(r,i){return i==null?!1:i.hasValidRowNumber()&&i.getBucket()===r.getBucket()?(r.setRowNumber(i.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(r){this.boundingBox=r}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(r,i){this.detectionResultColumns[r]=i}getDetectionResultColumn(r){return this.detectionResultColumns[r]}toString(){let r=this.detectionResultColumns[0];r==null&&(r=this.detectionResultColumns[this.barcodeColumnCount+1]);let i=new $s;for(let s=0;s<r.getCodewords().length;s++){i.format("CW %3d:",s);for(let a=0;a<this.barcodeColumnCount+2;a++){if(this.detectionResultColumns[a]==null){i.format(" | ");continue}let l=this.detectionResultColumns[a].getCodewords()[s];if(l==null){i.format(" | ");continue}i.format(" %3d|%3d",l.getRowNumber(),l.getValue())}i.format("%n")}return i.toString()}}class Gs{constructor(r,i,s,a){this.rowNumber=Gs.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(r),this.endX=Math.trunc(i),this.bucket=Math.trunc(s),this.value=Math.trunc(a)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(r){return r!==Gs.BARCODE_ROW_UNKNOWN&&this.bucket===r%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(r){this.rowNumber=r}toString(){return this.rowNumber+"|"+this.value}}Gs.BARCODE_ROW_UNKNOWN=-1;class er{static initialize(){for(let r=0;r<ge.SYMBOL_TABLE.length;r++){let i=ge.SYMBOL_TABLE[r],s=i&1;for(let a=0;a<ge.BARS_IN_MODULE;a++){let l=0;for(;(i&1)===s;)l+=1,i>>=1;s=i&1,er.RATIOS_TABLE[r]||(er.RATIOS_TABLE[r]=new Array(ge.BARS_IN_MODULE)),er.RATIOS_TABLE[r][ge.BARS_IN_MODULE-a-1]=Math.fround(l/ge.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(r){let i=er.getDecodedCodewordValue(er.sampleBitCounts(r));return i!==-1?i:er.getClosestDecodedValue(r)}static sampleBitCounts(r){let i=Re.sum(r),s=new Int32Array(ge.BARS_IN_MODULE),a=0,l=0;for(let f=0;f<ge.MODULES_IN_CODEWORD;f++){let d=i/(2*ge.MODULES_IN_CODEWORD)+f*i/ge.MODULES_IN_CODEWORD;l+r[a]<=d&&(l+=r[a],a++),s[a]++}return s}static getDecodedCodewordValue(r){let i=er.getBitValue(r);return ge.getCodeword(i)===-1?-1:i}static getBitValue(r){let i=0;for(let s=0;s<r.length;s++)for(let a=0;a<r[s];a++)i=i<<1|(s%2===0?1:0);return Math.trunc(i)}static getClosestDecodedValue(r){let i=Re.sum(r),s=new Array(ge.BARS_IN_MODULE);if(i>1)for(let f=0;f<s.length;f++)s[f]=Math.fround(r[f]/i);let a=xa.MAX_VALUE,l=-1;this.bSymbolTableReady||er.initialize();for(let f=0;f<er.RATIOS_TABLE.length;f++){let d=0,g=er.RATIOS_TABLE[f];for(let p=0;p<ge.BARS_IN_MODULE;p++){let v=Math.fround(g[p]-s[p]);if(d+=Math.fround(v*v),d>=a)break}d<a&&(a=d,l=ge.SYMBOL_TABLE[f])}return l}}er.bSymbolTableReady=!1,er.RATIOS_TABLE=new Array(ge.SYMBOL_TABLE.length).map(y=>new Array(ge.BARS_IN_MODULE));class th{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(r){this.segmentIndex=r}getFileId(){return this.fileId}setFileId(r){this.fileId=r}getOptionalData(){return this.optionalData}setOptionalData(r){this.optionalData=r}isLastSegment(){return this.lastSegment}setLastSegment(r){this.lastSegment=r}getSegmentCount(){return this.segmentCount}setSegmentCount(r){this.segmentCount=r}getSender(){return this.sender||null}setSender(r){this.sender=r}getAddressee(){return this.addressee||null}setAddressee(r){this.addressee=r}getFileName(){return this.fileName}setFileName(r){this.fileName=r}getFileSize(){return this.fileSize}setFileSize(r){this.fileSize=r}getChecksum(){return this.checksum}setChecksum(r){this.checksum=r}getTimestamp(){return this.timestamp}setTimestamp(r){this.timestamp=r}}class rh{static parseLong(r,i=void 0){return parseInt(r,i)}}class nh extends m{}nh.kind="NullPointerException";class y3{writeBytes(r){this.writeBytesOffset(r,0,r.length)}writeBytesOffset(r,i,s){if(r==null)throw new nh;if(i<0||i>r.length||s<0||i+s>r.length||i+s<0)throw new X;if(s===0)return;for(let a=0;a<s;a++)this.write(r[i+a])}flush(){}close(){}}class E3 extends m{}class C3 extends y3{constructor(r=32){if(super(),this.count=0,r<0)throw new b("Negative initial size: "+r);this.buf=new Uint8Array(r)}ensureCapacity(r){r-this.buf.length>0&&this.grow(r)}grow(r){let s=this.buf.length<<1;if(s-r<0&&(s=r),s<0){if(r<0)throw new E3;s=O.MAX_VALUE}this.buf=I.copyOfUint8Array(this.buf,s)}write(r){this.ensureCapacity(this.count+1),this.buf[this.count]=r,this.count+=1}writeBytesOffset(r,i,s){if(i<0||i>r.length||s<0||i+s-r.length>0)throw new X;this.ensureCapacity(this.count+s),M.arraycopy(r,i,this.buf,this.count,s),this.count+=s}writeTo(r){r.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return I.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(r){return r?typeof r=="string"?this.toString_string(r):this.toString_number(r):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(r){return new String(this.buf).toString()}toString_number(r){return new String(this.buf).toString()}close(){}}var Le;(function(y){y[y.ALPHA=0]="ALPHA",y[y.LOWER=1]="LOWER",y[y.MIXED=2]="MIXED",y[y.PUNCT=3]="PUNCT",y[y.ALPHA_SHIFT=4]="ALPHA_SHIFT",y[y.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Le||(Le={}));function ih(){if(typeof window<"u")return window.BigInt||null;if(typeof pn<"u")return pn.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Aa;function Dn(y){if(typeof Aa>"u"&&(Aa=ih()),Aa===null)throw new Error("BigInt is not supported!");return Aa(y)}function b3(){let y=[];y[0]=Dn(1);let r=Dn(900);y[1]=r;for(let i=2;i<16;i++)y[i]=y[i-1]*r;return y}class V{static decode(r,i){let s=new pe(""),a=z.ISO8859_1;s.enableDecoding(a);let l=1,f=r[l++],d=new th;for(;l<r[0];){switch(f){case V.TEXT_COMPACTION_MODE_LATCH:l=V.textCompaction(r,l,s);break;case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:l=V.byteCompaction(f,r,a,l,s);break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(r[l++]);break;case V.NUMERIC_COMPACTION_MODE_LATCH:l=V.numericCompaction(r,l,s);break;case V.ECI_CHARSET:z.getCharacterSetECIByValue(r[l++]);break;case V.ECI_GENERAL_PURPOSE:l+=2;break;case V.ECI_USER_DEFINED:l++;break;case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:l=V.decodeMacroBlock(r,l,d);break;case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:throw new F;default:l--,l=V.textCompaction(r,l,s);break}if(l<r.length)f=r[l++];else throw F.getFormatInstance()}if(s.length()===0)throw F.getFormatInstance();let g=new Bs(null,s.toString(),null,i);return g.setOther(d),g}static decodeMacroBlock(r,i,s){if(i+V.NUMBER_OF_SEQUENCE_CODEWORDS>r[0])throw F.getFormatInstance();let a=new Int32Array(V.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<V.NUMBER_OF_SEQUENCE_CODEWORDS;d++,i++)a[d]=r[i];s.setSegmentIndex(O.parseInt(V.decodeBase900toBase10(a,V.NUMBER_OF_SEQUENCE_CODEWORDS)));let l=new pe;i=V.textCompaction(r,i,l),s.setFileId(l.toString());let f=-1;for(r[i]===V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(f=i+1);i<r[0];)switch(r[i]){case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(i++,r[i]){case V.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new pe;i=V.textCompaction(r,i+1,d),s.setFileName(d.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new pe;i=V.textCompaction(r,i+1,g),s.setSender(g.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let p=new pe;i=V.textCompaction(r,i+1,p),s.setAddressee(p.toString());break;case V.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let v=new pe;i=V.numericCompaction(r,i+1,v),s.setSegmentCount(O.parseInt(v.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new pe;i=V.numericCompaction(r,i+1,E),s.setTimestamp(rh.parseLong(E.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new pe;i=V.numericCompaction(r,i+1,S),s.setChecksum(O.parseInt(S.toString()));break;case V.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let _=new pe;i=V.numericCompaction(r,i+1,_),s.setFileSize(rh.parseLong(_.toString()));break;default:throw F.getFormatInstance()}break;case V.MACRO_PDF417_TERMINATOR:i++,s.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(f!==-1){let d=i-f;s.isLastSegment()&&d--,s.setOptionalData(I.copyOfRange(r,f,f+d))}return i}static textCompaction(r,i,s){let a=new Int32Array((r[0]-i)*2),l=new Int32Array((r[0]-i)*2),f=0,d=!1;for(;i<r[0]&&!d;){let g=r[i++];if(g<V.TEXT_COMPACTION_MODE_LATCH)a[f]=g/30,a[f+1]=g%30,f+=2;else switch(g){case V.TEXT_COMPACTION_MODE_LATCH:a[f++]=V.TEXT_COMPACTION_MODE_LATCH;break;case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:i--,d=!0;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a[f]=V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=r[i++],l[f]=g,f++;break}}return V.decodeTextCompaction(a,l,f,s),i}static decodeTextCompaction(r,i,s,a){let l=Le.ALPHA,f=Le.ALPHA,d=0;for(;d<s;){let g=r[d],p="";switch(l){case Le.ALPHA:if(g<26)p=String.fromCharCode(65+g);else switch(g){case 26:p=" ";break;case V.LL:l=Le.LOWER;break;case V.ML:l=Le.MIXED;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.LOWER:if(g<26)p=String.fromCharCode(97+g);else switch(g){case 26:p=" ";break;case V.AS:f=l,l=Le.ALPHA_SHIFT;break;case V.ML:l=Le.MIXED;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.MIXED:if(g<V.PL)p=V.MIXED_CHARS[g];else switch(g){case V.PL:l=Le.PUNCT;break;case 26:p=" ";break;case V.LL:l=Le.LOWER;break;case V.AL:l=Le.ALPHA;break;case V.PS:f=l,l=Le.PUNCT_SHIFT;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.PUNCT:if(g<V.PAL)p=V.PUNCT_CHARS[g];else switch(g){case V.PAL:l=Le.ALPHA;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.ALPHA_SHIFT:if(l=f,g<26)p=String.fromCharCode(65+g);else switch(g){case 26:p=" ";break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break;case Le.PUNCT_SHIFT:if(l=f,g<V.PAL)p=V.PUNCT_CHARS[g];else switch(g){case V.PAL:l=Le.ALPHA;break;case V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case V.TEXT_COMPACTION_MODE_LATCH:l=Le.ALPHA;break}break}p!==""&&a.append(p),d++}}static byteCompaction(r,i,s,a,l){let f=new C3,d=0,g=0,p=!1;switch(r){case V.BYTE_COMPACTION_MODE_LATCH:let v=new Int32Array(6),E=i[a++];for(;a<i[0]&&!p;)switch(v[d++]=E,g=900*g+E,E=i[a++],E){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:a--,p=!0;break;default:if(d%5===0&&d>0){for(let S=0;S<6;++S)f.write(Number(Dn(g)>>Dn(8*(5-S))));g=0,d=0}break}a===i[0]&&E<V.TEXT_COMPACTION_MODE_LATCH&&(v[d++]=E);for(let S=0;S<d;S++)f.write(v[S]);break;case V.BYTE_COMPACTION_MODE_LATCH_6:for(;a<i[0]&&!p;){let S=i[a++];if(S<V.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+S;else switch(S){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.NUMERIC_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:a--,p=!0;break}if(d%5===0&&d>0){for(let _=0;_<6;++_)f.write(Number(Dn(g)>>Dn(8*(5-_))));g=0,d=0}}break}return l.append(ve.decode(f.toByteArray(),s)),a}static numericCompaction(r,i,s){let a=0,l=!1,f=new Int32Array(V.MAX_NUMERIC_CODEWORDS);for(;i<r[0]&&!l;){let d=r[i++];if(i===r[0]&&(l=!0),d<V.TEXT_COMPACTION_MODE_LATCH)f[a]=d,a++;else switch(d){case V.TEXT_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH:case V.BYTE_COMPACTION_MODE_LATCH_6:case V.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case V.MACRO_PDF417_TERMINATOR:i--,l=!0;break}(a%V.MAX_NUMERIC_CODEWORDS===0||d===V.NUMERIC_COMPACTION_MODE_LATCH||l)&&a>0&&(s.append(V.decodeBase900toBase10(f,a)),a=0)}return i}static decodeBase900toBase10(r,i){let s=Dn(0);for(let l=0;l<i;l++)s+=V.EXP900[i-l-1]*Dn(r[l]);let a=s.toString();if(a.charAt(0)!=="1")throw new F;return a.substring(1)}}V.TEXT_COMPACTION_MODE_LATCH=900,V.BYTE_COMPACTION_MODE_LATCH=901,V.NUMERIC_COMPACTION_MODE_LATCH=902,V.BYTE_COMPACTION_MODE_LATCH_6=924,V.ECI_USER_DEFINED=925,V.ECI_GENERAL_PURPOSE=926,V.ECI_CHARSET=927,V.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,V.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,V.MACRO_PDF417_TERMINATOR=922,V.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,V.MAX_NUMERIC_CODEWORDS=15,V.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,V.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,V.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,V.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,V.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,V.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,V.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,V.PL=25,V.LL=27,V.AS=27,V.ML=28,V.AL=28,V.PS=29,V.PAL=29,V.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
468
+ -.$/"|*()?{}'`,V.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",V.EXP900=ih()?b3():[],V.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ee{constructor(){}static decode(r,i,s,a,l,f,d){let g=new ui(r,i,s,a,l),p=null,v=null,E;for(let D=!0;;D=!1){if(i!=null&&(p=Ee.getRowIndicatorColumn(r,g,i,!0,f,d)),a!=null&&(v=Ee.getRowIndicatorColumn(r,g,a,!1,f,d)),E=Ee.merge(p,v),E==null)throw G.getNotFoundInstance();let P=E.getBoundingBox();if(D&&P!=null&&(P.getMinY()<g.getMinY()||P.getMaxY()>g.getMaxY()))g=P;else break}E.setBoundingBox(g);let S=E.getBarcodeColumnCount()+1;E.setDetectionResultColumn(0,p),E.setDetectionResultColumn(S,v);let _=p!=null;for(let D=1;D<=S;D++){let P=_?D:S-D;if(E.getDetectionResultColumn(P)!==void 0)continue;let W;P===0||P===S?W=new eh(g,P===0):W=new zs(g),E.setDetectionResultColumn(P,W);let H=-1,q=H;for(let J=g.getMinY();J<=g.getMaxY();J++){if(H=Ee.getStartColumn(E,P,J,_),H<0||H>g.getMaxX()){if(q===-1)continue;H=q}let Z=Ee.detectCodeword(r,g.getMinX(),g.getMaxX(),_,H,J,f,d);Z!=null&&(W.setCodeword(J,Z),q=H,f=Math.min(f,Z.getWidth()),d=Math.max(d,Z.getWidth()))}}return Ee.createDecoderResult(E)}static merge(r,i){if(r==null&&i==null)return null;let s=Ee.getBarcodeMetadata(r,i);if(s==null)return null;let a=ui.merge(Ee.adjustBoundingBox(r),Ee.adjustBoundingBox(i));return new Hs(s,a)}static adjustBoundingBox(r){if(r==null)return null;let i=r.getRowHeights();if(i==null)return null;let s=Ee.getMax(i),a=0;for(let d of i)if(a+=s-d,d>0)break;let l=r.getCodewords();for(let d=0;a>0&&l[d]==null;d++)a--;let f=0;for(let d=i.length-1;d>=0&&(f+=s-i[d],!(i[d]>0));d--);for(let d=l.length-1;f>0&&l[d]==null;d--)f--;return r.getBoundingBox().addMissingRows(a,f,r.isLeft())}static getMax(r){let i=-1;for(let s of r)i=Math.max(i,s);return i}static getBarcodeMetadata(r,i){let s;if(r==null||(s=r.getBarcodeMetadata())==null)return i==null?null:i.getBarcodeMetadata();let a;return i==null||(a=i.getBarcodeMetadata())==null?s:s.getColumnCount()!==a.getColumnCount()&&s.getErrorCorrectionLevel()!==a.getErrorCorrectionLevel()&&s.getRowCount()!==a.getRowCount()?null:s}static getRowIndicatorColumn(r,i,s,a,l,f){let d=new eh(i,a);for(let g=0;g<2;g++){let p=g===0?1:-1,v=Math.trunc(Math.trunc(s.getX()));for(let E=Math.trunc(Math.trunc(s.getY()));E<=i.getMaxY()&&E>=i.getMinY();E+=p){let S=Ee.detectCodeword(r,0,r.getWidth(),a,v,E,l,f);S!=null&&(d.setCodeword(E,S),a?v=S.getStartX():v=S.getEndX())}}return d}static adjustCodewordCount(r,i){let s=i[0][1],a=s.getValue(),l=r.getBarcodeColumnCount()*r.getBarcodeRowCount()-Ee.getNumberOfECCodeWords(r.getBarcodeECLevel());if(a.length===0){if(l<1||l>ge.MAX_CODEWORDS_IN_BARCODE)throw G.getNotFoundInstance();s.setValue(l)}else a[0]!==l&&s.setValue(l)}static createDecoderResult(r){let i=Ee.createBarcodeMatrix(r);Ee.adjustCodewordCount(r,i);let s=new Array,a=new Int32Array(r.getBarcodeRowCount()*r.getBarcodeColumnCount()),l=[],f=new Array;for(let g=0;g<r.getBarcodeRowCount();g++)for(let p=0;p<r.getBarcodeColumnCount();p++){let v=i[g][p+1].getValue(),E=g*r.getBarcodeColumnCount()+p;v.length===0?s.push(E):v.length===1?a[E]=v[0]:(f.push(E),l.push(v))}let d=new Array(l.length);for(let g=0;g<d.length;g++)d[g]=l[g];return Ee.createDecoderResultFromAmbiguousValues(r.getBarcodeECLevel(),a,ge.toIntArray(s),ge.toIntArray(f),d)}static createDecoderResultFromAmbiguousValues(r,i,s,a,l){let f=new Int32Array(a.length),d=100;for(;d-- >0;){for(let g=0;g<f.length;g++)i[a[g]]=l[g][f[g]];try{return Ee.decodeCodewords(i,r,s)}catch(g){if(!(g instanceof T))throw g}if(f.length===0)throw T.getChecksumInstance();for(let g=0;g<f.length;g++)if(f[g]<l[g].length-1){f[g]++;break}else if(f[g]=0,g===f.length-1)throw T.getChecksumInstance()}throw T.getChecksumInstance()}static createBarcodeMatrix(r){let i=Array.from({length:r.getBarcodeRowCount()},()=>new Array(r.getBarcodeColumnCount()+2));for(let a=0;a<i.length;a++)for(let l=0;l<i[a].length;l++)i[a][l]=new Vs;let s=0;for(let a of r.getDetectionResultColumns()){if(a!=null){for(let l of a.getCodewords())if(l!=null){let f=l.getRowNumber();if(f>=0){if(f>=i.length)continue;i[f][s].setValue(l.getValue())}}}s++}return i}static isValidBarcodeColumn(r,i){return i>=0&&i<=r.getBarcodeColumnCount()+1}static getStartColumn(r,i,s,a){let l=a?1:-1,f=null;if(Ee.isValidBarcodeColumn(r,i-l)&&(f=r.getDetectionResultColumn(i-l).getCodeword(s)),f!=null)return a?f.getEndX():f.getStartX();if(f=r.getDetectionResultColumn(i).getCodewordNearby(s),f!=null)return a?f.getStartX():f.getEndX();if(Ee.isValidBarcodeColumn(r,i-l)&&(f=r.getDetectionResultColumn(i-l).getCodewordNearby(s)),f!=null)return a?f.getEndX():f.getStartX();let d=0;for(;Ee.isValidBarcodeColumn(r,i-l);){i-=l;for(let g of r.getDetectionResultColumn(i).getCodewords())if(g!=null)return(a?g.getEndX():g.getStartX())+l*d*(g.getEndX()-g.getStartX());d++}return a?r.getBoundingBox().getMinX():r.getBoundingBox().getMaxX()}static detectCodeword(r,i,s,a,l,f,d,g){l=Ee.adjustCodewordStartColumn(r,i,s,a,l,f);let p=Ee.getModuleBitCount(r,i,s,a,l,f);if(p==null)return null;let v,E=Re.sum(p);if(a)v=l+E;else{for(let D=0;D<p.length/2;D++){let P=p[D];p[D]=p[p.length-1-D],p[p.length-1-D]=P}v=l,l=v-E}if(!Ee.checkCodewordSkew(E,d,g))return null;let S=er.getDecodedValue(p),_=ge.getCodeword(S);return _===-1?null:new Gs(l,v,Ee.getCodewordBucketNumber(S),_)}static getModuleBitCount(r,i,s,a,l,f){let d=l,g=new Int32Array(8),p=0,v=a?1:-1,E=a;for(;(a?d<s:d>=i)&&p<g.length;)r.get(d,f)===E?(g[p]++,d+=v):(p++,E=!E);return p===g.length||d===(a?s:i)&&p===g.length-1?g:null}static getNumberOfECCodeWords(r){return 2<<r}static adjustCodewordStartColumn(r,i,s,a,l,f){let d=l,g=a?-1:1;for(let p=0;p<2;p++){for(;(a?d>=i:d<s)&&a===r.get(d,f);){if(Math.abs(l-d)>Ee.CODEWORD_SKEW_SIZE)return l;d+=g}g=-g,a=!a}return d}static checkCodewordSkew(r,i,s){return i-Ee.CODEWORD_SKEW_SIZE<=r&&r<=s+Ee.CODEWORD_SKEW_SIZE}static decodeCodewords(r,i,s){if(r.length===0)throw F.getFormatInstance();let a=1<<i+1,l=Ee.correctErrors(r,s,a);Ee.verifyCodewordCount(r,a);let f=V.decode(r,""+i);return f.setErrorsCorrected(l),f.setErasures(s.length),f}static correctErrors(r,i,s){if(i!=null&&i.length>s/2+Ee.MAX_ERRORS||s<0||s>Ee.MAX_EC_CODEWORDS)throw T.getChecksumInstance();return Ee.errorCorrection.decode(r,s,i)}static verifyCodewordCount(r,i){if(r.length<4)throw F.getFormatInstance();let s=r[0];if(s>r.length)throw F.getFormatInstance();if(s===0)if(i<r.length)r[0]=r.length-i;else throw F.getFormatInstance()}static getBitCountForCodeword(r){let i=new Int32Array(8),s=0,a=i.length-1;for(;!((r&1)!==s&&(s=r&1,a--,a<0));)i[a]++,r>>=1;return i}static getCodewordBucketNumber(r){return r instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(r):this.getCodewordBucketNumber_number(r)}static getCodewordBucketNumber_number(r){return Ee.getCodewordBucketNumber(Ee.getBitCountForCodeword(r))}static getCodewordBucketNumber_Int32Array(r){return(r[0]-r[2]+r[4]-r[6]+9)%9}static toString(r){let i=new $s;for(let s=0;s<r.length;s++){i.format("Row %2d: ",s);for(let a=0;a<r[s].length;a++){let l=r[s][a];l.getValue().length===0?i.format(" ",null):i.format("%4d(%2d)",l.getValue()[0],l.getConfidence(l.getValue()[0]))}i.format("%n")}return i.toString()}}Ee.CODEWORD_SKEW_SIZE=2,Ee.MAX_ERRORS=3,Ee.MAX_EC_CODEWORDS=512,Ee.errorCorrection=new J0;class Nt{decode(r,i=null){let s=Nt.decode(r,i,!1);if(s==null||s.length===0||s[0]==null)throw G.getNotFoundInstance();return s[0]}decodeMultiple(r,i=null){try{return Nt.decode(r,i,!0)}catch(s){throw s instanceof F||s instanceof T?G.getNotFoundInstance():s}}static decode(r,i,s){const a=new Array,l=ye.detectMultiple(r,i,s);for(const f of l.getPoints()){const d=Ee.decode(l.getBits(),f[4],f[5],f[6],f[7],Nt.getMinCodewordWidth(f),Nt.getMaxCodewordWidth(f)),g=new Ze(d.getText(),d.getRawBytes(),void 0,f,le.PDF_417);g.putMetadata(bt.ERROR_CORRECTION_LEVEL,d.getECLevel());const p=d.getOther();p!=null&&g.putMetadata(bt.PDF417_EXTRA_METADATA,p),a.push(g)}return a.map(f=>f)}static getMaxWidth(r,i){return r==null||i==null?0:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMinWidth(r,i){return r==null||i==null?O.MAX_VALUE:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMaxCodewordWidth(r){return Math.floor(Math.max(Math.max(Nt.getMaxWidth(r[0],r[4]),Nt.getMaxWidth(r[6],r[2])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN),Math.max(Nt.getMaxWidth(r[1],r[5]),Nt.getMaxWidth(r[7],r[3])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(r){return Math.floor(Math.min(Math.min(Nt.getMinWidth(r[0],r[4]),Nt.getMinWidth(r[6],r[2])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN),Math.min(Nt.getMinWidth(r[1],r[5]),Nt.getMinWidth(r[7],r[3])*ge.MODULES_IN_CODEWORD/ge.MODULES_IN_STOP_PATTERN)))}reset(){}}class Sa extends m{}Sa.kind="ReaderException";class sh{constructor(r,i){this.verbose=r===!0,i&&this.setHints(i)}decode(r,i){return i&&this.setHints(i),this.decodeInternal(r)}decodeWithState(r){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(r)}setHints(r){this.hints=r;const i=!o(r)&&r.get(U.TRY_HARDER)===!0,s=o(r)?null:r.get(U.POSSIBLE_FORMATS),a=new Array;if(!o(s)){const l=s.some(f=>f===le.UPC_A||f===le.UPC_E||f===le.EAN_13||f===le.EAN_8||f===le.CODABAR||f===le.CODE_39||f===le.CODE_93||f===le.CODE_128||f===le.ITF||f===le.RSS_14||f===le.RSS_EXPANDED);l&&!i&&a.push(new ji(r,this.verbose)),s.includes(le.QR_CODE)&&a.push(new Mn),s.includes(le.DATA_MATRIX)&&a.push(new kn),s.includes(le.AZTEC)&&a.push(new va),s.includes(le.PDF_417)&&a.push(new Nt),l&&i&&a.push(new ji(r,this.verbose))}a.length===0&&(i||a.push(new ji(r,this.verbose)),a.push(new Mn),a.push(new kn),a.push(new va),a.push(new Nt),i&&a.push(new ji(r,this.verbose))),this.readers=a}reset(){if(this.readers!==null)for(const r of this.readers)r.reset()}decodeInternal(r){if(this.readers===null)throw new Sa("No readers where selected, nothing can be read.");for(const i of this.readers)try{return i.decode(r,this.hints)}catch(s){if(s instanceof Sa)continue}throw new G("No MultiFormat Readers were able to detect the code.")}}class A3 extends Er{constructor(r=null,i=500){const s=new sh;s.setHints(r),super(s,i)}decodeBitmap(r){return this.reader.decodeWithState(r)}}class S3 extends Er{constructor(r=500){super(new Nt,r)}}class I3 extends Er{constructor(r=500){super(new Mn,r)}}var hu;(function(y){y[y.ERROR_CORRECTION=0]="ERROR_CORRECTION",y[y.CHARACTER_SET=1]="CHARACTER_SET",y[y.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",y[y.MIN_SIZE=3]="MIN_SIZE",y[y.MAX_SIZE=4]="MAX_SIZE",y[y.MARGIN=5]="MARGIN",y[y.PDF417_COMPACT=6]="PDF417_COMPACT",y[y.PDF417_COMPACTION=7]="PDF417_COMPACTION",y[y.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",y[y.AZTEC_LAYERS=9]="AZTEC_LAYERS",y[y.QR_VERSION=10]="QR_VERSION"})(hu||(hu={}));var wt=hu;class gu{constructor(r){this.field=r,this.cachedGenerators=[],this.cachedGenerators.push(new Qt(r,Int32Array.from([1])))}buildGenerator(r){const i=this.cachedGenerators;if(r>=i.length){let s=i[i.length-1];const a=this.field;for(let l=i.length;l<=r;l++){const f=s.multiply(new Qt(a,Int32Array.from([1,a.exp(l-1+a.getGeneratorBase())])));i.push(f),s=f}}return i[r]}encode(r,i){if(i===0)throw new b("No error correction bytes");const s=r.length-i;if(s<=0)throw new b("No data bytes provided");const a=this.buildGenerator(i),l=new Int32Array(s);M.arraycopy(r,0,l,0,s);let f=new Qt(this.field,l);f=f.multiplyByMonomial(i,1);const g=f.divide(a)[1].getCoefficients(),p=i-g.length;for(let v=0;v<p;v++)r[s+v]=0;M.arraycopy(g,0,r,s+p,g.length)}}class st{constructor(){}static applyMaskPenaltyRule1(r){return st.applyMaskPenaltyRule1Internal(r,!0)+st.applyMaskPenaltyRule1Internal(r,!1)}static applyMaskPenaltyRule2(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let f=0;f<l-1;f++){const d=s[f];for(let g=0;g<a-1;g++){const p=d[g];p===d[g+1]&&p===s[f+1][g]&&p===s[f+1][g+1]&&i++}}return st.N2*i}static applyMaskPenaltyRule3(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let f=0;f<l;f++)for(let d=0;d<a;d++){const g=s[f];d+6<a&&g[d]===1&&g[d+1]===0&&g[d+2]===1&&g[d+3]===1&&g[d+4]===1&&g[d+5]===0&&g[d+6]===1&&(st.isWhiteHorizontal(g,d-4,d)||st.isWhiteHorizontal(g,d+7,d+11))&&i++,f+6<l&&s[f][d]===1&&s[f+1][d]===0&&s[f+2][d]===1&&s[f+3][d]===1&&s[f+4][d]===1&&s[f+5][d]===0&&s[f+6][d]===1&&(st.isWhiteVertical(s,d,f-4,f)||st.isWhiteVertical(s,d,f+7,f+11))&&i++}return i*st.N3}static isWhiteHorizontal(r,i,s){i=Math.max(i,0),s=Math.min(s,r.length);for(let a=i;a<s;a++)if(r[a]===1)return!1;return!0}static isWhiteVertical(r,i,s,a){s=Math.max(s,0),a=Math.min(a,r.length);for(let l=s;l<a;l++)if(r[l][i]===1)return!1;return!0}static applyMaskPenaltyRule4(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let g=0;g<l;g++){const p=s[g];for(let v=0;v<a;v++)p[v]===1&&i++}const f=r.getHeight()*r.getWidth();return Math.floor(Math.abs(i*2-f)*10/f)*st.N4}static getDataMaskBit(r,i,s){let a,l;switch(r){case 0:a=s+i&1;break;case 1:a=s&1;break;case 2:a=i%3;break;case 3:a=(s+i)%3;break;case 4:a=Math.floor(s/2)+Math.floor(i/3)&1;break;case 5:l=s*i,a=(l&1)+l%3;break;case 6:l=s*i,a=(l&1)+l%3&1;break;case 7:l=s*i,a=l%3+(s+i&1)&1;break;default:throw new b("Invalid mask pattern: "+r)}return a===0}static applyMaskPenaltyRule1Internal(r,i){let s=0;const a=i?r.getHeight():r.getWidth(),l=i?r.getWidth():r.getHeight(),f=r.getArray();for(let d=0;d<a;d++){let g=0,p=-1;for(let v=0;v<l;v++){const E=i?f[d][v]:f[v][d];E===p?g++:(g>=5&&(s+=st.N1+(g-5)),g=1,p=E)}g>=5&&(s+=st.N1+(g-5))}return s}}st.N1=3,st.N2=3,st.N3=40,st.N4=10;class Ia{constructor(r,i){this.width=r,this.height=i;const s=new Array(i);for(let a=0;a!==i;a++)s[a]=new Uint8Array(r);this.bytes=s}getHeight(){return this.height}getWidth(){return this.width}get(r,i){return this.bytes[i][r]}getArray(){return this.bytes}setNumber(r,i,s){this.bytes[i][r]=s}setBoolean(r,i,s){this.bytes[i][r]=s?1:0}clear(r){for(const i of this.bytes)I.fill(i,r)}equals(r){if(!(r instanceof Ia))return!1;const i=r;if(this.width!==i.width||this.height!==i.height)return!1;for(let s=0,a=this.height;s<a;++s){const l=this.bytes[s],f=i.bytes[s];for(let d=0,g=this.width;d<g;++d)if(l[d]!==f[d])return!1}return!0}toString(){const r=new pe;for(let i=0,s=this.height;i<s;++i){const a=this.bytes[i];for(let l=0,f=this.width;l<f;++l)switch(a[l]){case 0:r.append(" 0");break;case 1:r.append(" 1");break;default:r.append(" ");break}r.append(`
469
469
  `)}return r.toString()}}class fi{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const r=new pe;return r.append(`<<
470
470
  `),r.append(" mode: "),r.append(this.mode?this.mode.toString():"null"),r.append(`
471
471
  ecLevel: `),r.append(this.ecLevel?this.ecLevel.toString():"null"),r.append(`
@@ -475,15 +475,15 @@ Error generating stack: `+u.message+`
475
475
  `),r.append(this.matrix.toString())):r.append(`
476
476
  matrix: null
477
477
  `),r.append(`>>
478
- `),r.toString()}setMode(r){this.mode=r}setECLevel(r){this.ecLevel=r}setVersion(r){this.version=r}setMaskPattern(r){this.maskPattern=r}setMatrix(r){this.matrix=r}static isValidMaskPattern(r){return r>=0&&r<fi.NUM_MASK_PATTERNS}}fi.NUM_MASK_PATTERNS=8;class Fe extends m{}Fe.kind="WriterException";class de{constructor(){}static clearMatrix(r){r.clear(255)}static buildMatrix(r,i,s,a,l){de.clearMatrix(l),de.embedBasicPatterns(s,l),de.embedTypeInfo(i,a,l),de.maybeEmbedVersionInfo(s,l),de.embedDataBits(r,a,l)}static embedBasicPatterns(r,i){de.embedPositionDetectionPatternsAndSeparators(i),de.embedDarkDotAtLeftBottomCorner(i),de.maybeEmbedPositionAdjustmentPatterns(r,i),de.embedTimingPatterns(i)}static embedTypeInfo(r,i,s){const a=new B;de.makeTypeInfoBits(r,i,a);for(let l=0,f=a.getSize();l<f;++l){const d=a.get(a.getSize()-1-l),h=de.TYPE_INFO_COORDINATES[l],p=h[0],v=h[1];if(s.setBoolean(p,v,d),l<8){const E=s.getWidth()-l-1;s.setBoolean(E,8,d)}else{const S=s.getHeight()-7+(l-8);s.setBoolean(8,S,d)}}}static maybeEmbedVersionInfo(r,i){if(r.getVersionNumber()<7)return;const s=new B;de.makeVersionInfoBits(r,s);let a=6*3-1;for(let l=0;l<6;++l)for(let f=0;f<3;++f){const d=s.get(a);a--,i.setBoolean(l,i.getHeight()-11+f,d),i.setBoolean(i.getHeight()-11+f,l,d)}}static embedDataBits(r,i,s){let a=0,l=-1,f=s.getWidth()-1,d=s.getHeight()-1;for(;f>0;){for(f===6&&(f-=1);d>=0&&d<s.getHeight();){for(let h=0;h<2;++h){const p=f-h;if(!de.isEmpty(s.get(p,d)))continue;let v;a<r.getSize()?(v=r.get(a),++a):v=!1,i!==255&&st.getDataMaskBit(i,p,d)&&(v=!v),s.setBoolean(p,d,v)}d+=l}l=-l,d+=l,f-=2}if(a!==r.getSize())throw new Fe("Not all bits consumed: "+a+"/"+r.getSize())}static findMSBSet(r){return 32-O.numberOfLeadingZeros(r)}static calculateBCHCode(r,i){if(i===0)throw new b("0 polynomial");const s=de.findMSBSet(i);for(r<<=s-1;de.findMSBSet(r)>=s;)r^=i<<de.findMSBSet(r)-s;return r}static makeTypeInfoBits(r,i,s){if(!fi.isValidMaskPattern(i))throw new Fe("Invalid mask pattern");const a=r.getBits()<<3|i;s.appendBits(a,5);const l=de.calculateBCHCode(a,de.TYPE_INFO_POLY);s.appendBits(l,10);const f=new B;if(f.appendBits(de.TYPE_INFO_MASK_PATTERN,15),s.xor(f),s.getSize()!==15)throw new Fe("should not happen but we got: "+s.getSize())}static makeVersionInfoBits(r,i){i.appendBits(r.getVersionNumber(),6);const s=de.calculateBCHCode(r.getVersionNumber(),de.VERSION_INFO_POLY);if(i.appendBits(s,12),i.getSize()!==18)throw new Fe("should not happen but we got: "+i.getSize())}static isEmpty(r){return r===255}static embedTimingPatterns(r){for(let i=8;i<r.getWidth()-8;++i){const s=(i+1)%2;de.isEmpty(r.get(i,6))&&r.setNumber(i,6,s),de.isEmpty(r.get(6,i))&&r.setNumber(6,i,s)}}static embedDarkDotAtLeftBottomCorner(r){if(r.get(8,r.getHeight()-8)===0)throw new Fe;r.setNumber(8,r.getHeight()-8,1)}static embedHorizontalSeparationPattern(r,i,s){for(let a=0;a<8;++a){if(!de.isEmpty(s.get(r+a,i)))throw new Fe;s.setNumber(r+a,i,0)}}static embedVerticalSeparationPattern(r,i,s){for(let a=0;a<7;++a){if(!de.isEmpty(s.get(r,i+a)))throw new Fe;s.setNumber(r,i+a,0)}}static embedPositionAdjustmentPattern(r,i,s){for(let a=0;a<5;++a){const l=de.POSITION_ADJUSTMENT_PATTERN[a];for(let f=0;f<5;++f)s.setNumber(r+f,i+a,l[f])}}static embedPositionDetectionPattern(r,i,s){for(let a=0;a<7;++a){const l=de.POSITION_DETECTION_PATTERN[a];for(let f=0;f<7;++f)s.setNumber(r+f,i+a,l[f])}}static embedPositionDetectionPatternsAndSeparators(r){const i=de.POSITION_DETECTION_PATTERN[0].length;de.embedPositionDetectionPattern(0,0,r),de.embedPositionDetectionPattern(r.getWidth()-i,0,r),de.embedPositionDetectionPattern(0,r.getWidth()-i,r);const s=8;de.embedHorizontalSeparationPattern(0,s-1,r),de.embedHorizontalSeparationPattern(r.getWidth()-s,s-1,r),de.embedHorizontalSeparationPattern(0,r.getWidth()-s,r);const a=7;de.embedVerticalSeparationPattern(a,0,r),de.embedVerticalSeparationPattern(r.getHeight()-a-1,0,r),de.embedVerticalSeparationPattern(a,r.getHeight()-a,r)}static maybeEmbedPositionAdjustmentPatterns(r,i){if(r.getVersionNumber()<2)return;const s=r.getVersionNumber()-1,a=de.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let l=0,f=a.length;l!==f;l++){const d=a[l];if(d>=0)for(let h=0;h!==f;h++){const p=a[h];p>=0&&de.isEmpty(i.get(p,d))&&de.embedPositionAdjustmentPattern(p-2,d-2,i)}}}}de.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),de.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),de.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),de.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),de.VERSION_INFO_POLY=7973,de.TYPE_INFO_POLY=1335,de.TYPE_INFO_MASK_PATTERN=21522;class S3{constructor(r,i){this.dataBytes=r,this.errorCorrectionBytes=i}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ze{constructor(){}static calculateMaskPenalty(r){return st.applyMaskPenaltyRule1(r)+st.applyMaskPenaltyRule2(r)+st.applyMaskPenaltyRule3(r)+st.applyMaskPenaltyRule4(r)}static encode(r,i,s=null){let a=ze.DEFAULT_BYTE_MODE_ENCODING;const l=s!==null&&s.get(wt.CHARACTER_SET)!==void 0;l&&(a=s.get(wt.CHARACTER_SET).toString());const f=this.chooseMode(r,a),d=new B;if(f===fe.BYTE&&(l||ze.DEFAULT_BYTE_MODE_ENCODING!==a)){const J=z.getCharacterSetECIByName(a);J!==void 0&&this.appendECI(J,d)}this.appendModeInfo(f,d);const h=new B;this.appendBytes(r,f,h,a);let p;if(s!==null&&s.get(wt.QR_VERSION)!==void 0){const J=Number.parseInt(s.get(wt.QR_VERSION).toString(),10);p=ue.getVersionForNumber(J);const Z=this.calculateBitsNeeded(f,d,h,p);if(!this.willFit(Z,p,i))throw new Fe("Data too big for requested version")}else p=this.recommendVersion(i,f,d,h);const v=new B;v.appendBitArray(d);const E=f===fe.BYTE?h.getSizeInBytes():r.length;this.appendLengthInfo(E,p,f,v),v.appendBitArray(h);const S=p.getECBlocksForLevel(i),_=p.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(_,v);const D=this.interleaveWithECBytes(v,p.getTotalCodewords(),_,S.getNumBlocks()),P=new fi;P.setECLevel(i),P.setMode(f),P.setVersion(p);const W=p.getDimensionForVersion(),H=new Sa(W,W),q=this.chooseMaskPattern(D,i,p,H);return P.setMaskPattern(q),de.buildMatrix(D,i,p,q,H),P.setMatrix(H),P}static recommendVersion(r,i,s,a){const l=this.calculateBitsNeeded(i,s,a,ue.getVersionForNumber(1)),f=this.chooseVersion(l,r),d=this.calculateBitsNeeded(i,s,a,f);return this.chooseVersion(d,r)}static calculateBitsNeeded(r,i,s,a){return i.getSize()+r.getCharacterCountBits(a)+s.getSize()}static getAlphanumericCode(r){return r<ze.ALPHANUMERIC_TABLE.length?ze.ALPHANUMERIC_TABLE[r]:-1}static chooseMode(r,i=null){if(z.SJIS.getName()===i&&this.isOnlyDoubleByteKanji(r))return fe.KANJI;let s=!1,a=!1;for(let l=0,f=r.length;l<f;++l){const d=r.charAt(l);if(ze.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)a=!0;else return fe.BYTE}return a?fe.ALPHANUMERIC:s?fe.NUMERIC:fe.BYTE}static isOnlyDoubleByteKanji(r){let i;try{i=ve.encode(r,z.SJIS)}catch{return!1}const s=i.length;if(s%2!==0)return!1;for(let a=0;a<s;a+=2){const l=i[a]&255;if((l<129||l>159)&&(l<224||l>235))return!1}return!0}static chooseMaskPattern(r,i,s,a){let l=Number.MAX_SAFE_INTEGER,f=-1;for(let d=0;d<fi.NUM_MASK_PATTERNS;d++){de.buildMatrix(r,i,s,d,a);let h=this.calculateMaskPenalty(a);h<l&&(l=h,f=d)}return f}static chooseVersion(r,i){for(let s=1;s<=40;s++){const a=ue.getVersionForNumber(s);if(ze.willFit(r,a,i))return a}throw new Fe("Data too big")}static willFit(r,i,s){const a=i.getTotalCodewords(),f=i.getECBlocksForLevel(s).getTotalECCodewords(),d=a-f,h=(r+7)/8;return d>=h}static terminateBits(r,i){const s=r*8;if(i.getSize()>s)throw new Fe("data bits cannot fit in the QR Code"+i.getSize()+" > "+s);for(let f=0;f<4&&i.getSize()<s;++f)i.appendBit(!1);const a=i.getSize()&7;if(a>0)for(let f=a;f<8;f++)i.appendBit(!1);const l=r-i.getSizeInBytes();for(let f=0;f<l;++f)i.appendBits(f&1?17:236,8);if(i.getSize()!==s)throw new Fe("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(r,i,s,a,l,f){if(a>=s)throw new Fe("Block ID too large");const d=r%s,h=s-d,p=Math.floor(r/s),v=p+1,E=Math.floor(i/s),S=E+1,_=p-E,D=v-S;if(_!==D)throw new Fe("EC bytes mismatch");if(s!==h+d)throw new Fe("RS blocks mismatch");if(r!==(E+_)*h+(S+D)*d)throw new Fe("Total bytes mismatch");a<h?(l[0]=E,f[0]=_):(l[0]=S,f[0]=D)}static interleaveWithECBytes(r,i,s,a){if(r.getSizeInBytes()!==s)throw new Fe("Number of bits and data bytes does not match");let l=0,f=0,d=0;const h=new Array;for(let v=0;v<a;++v){const E=new Int32Array(1),S=new Int32Array(1);ze.getNumDataBytesAndNumECBytesForBlockID(i,s,a,v,E,S);const _=E[0],D=new Uint8Array(_);r.toBytes(8*l,D,0,_);const P=ze.generateECBytes(D,S[0]);h.push(new S3(D,P)),f=Math.max(f,_),d=Math.max(d,P.length),l+=E[0]}if(s!==l)throw new Fe("Data bytes does not match offset");const p=new B;for(let v=0;v<f;++v)for(const E of h){const S=E.getDataBytes();v<S.length&&p.appendBits(S[v],8)}for(let v=0;v<d;++v)for(const E of h){const S=E.getErrorCorrectionBytes();v<S.length&&p.appendBits(S[v],8)}if(i!==p.getSizeInBytes())throw new Fe("Interleaving error: "+i+" and "+p.getSizeInBytes()+" differ.");return p}static generateECBytes(r,i){const s=r.length,a=new Int32Array(s+i);for(let f=0;f<s;f++)a[f]=r[f]&255;new gu(Ne.QR_CODE_FIELD_256).encode(a,i);const l=new Uint8Array(i);for(let f=0;f<i;f++)l[f]=a[s+f];return l}static appendModeInfo(r,i){i.appendBits(r.getBits(),4)}static appendLengthInfo(r,i,s,a){const l=s.getCharacterCountBits(i);if(r>=1<<l)throw new Fe(r+" is bigger than "+((1<<l)-1));a.appendBits(r,l)}static appendBytes(r,i,s,a){switch(i){case fe.NUMERIC:ze.appendNumericBytes(r,s);break;case fe.ALPHANUMERIC:ze.appendAlphanumericBytes(r,s);break;case fe.BYTE:ze.append8BitBytes(r,s,a);break;case fe.KANJI:ze.appendKanjiBytes(r,s);break;default:throw new Fe("Invalid mode: "+i)}}static getDigit(r){return r.charCodeAt(0)-48}static isDigit(r){const i=ze.getDigit(r);return i>=0&&i<=9}static appendNumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=ze.getDigit(r.charAt(a));if(a+2<s){const f=ze.getDigit(r.charAt(a+1)),d=ze.getDigit(r.charAt(a+2));i.appendBits(l*100+f*10+d,10),a+=3}else if(a+1<s){const f=ze.getDigit(r.charAt(a+1));i.appendBits(l*10+f,7),a+=2}else i.appendBits(l,4),a++}}static appendAlphanumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=ze.getAlphanumericCode(r.charCodeAt(a));if(l===-1)throw new Fe;if(a+1<s){const f=ze.getAlphanumericCode(r.charCodeAt(a+1));if(f===-1)throw new Fe;i.appendBits(l*45+f,11),a+=2}else i.appendBits(l,6),a++}}static append8BitBytes(r,i,s){let a;try{a=ve.encode(r,s)}catch(l){throw new Fe(l)}for(let l=0,f=a.length;l!==f;l++){const d=a[l];i.appendBits(d,8)}}static appendKanjiBytes(r,i){let s;try{s=ve.encode(r,z.SJIS)}catch(l){throw new Fe(l)}const a=s.length;for(let l=0;l<a;l+=2){const f=s[l]&255,d=s[l+1]&255,h=f<<8&4294967295|d;let p=-1;if(h>=33088&&h<=40956?p=h-33088:h>=57408&&h<=60351&&(p=h-49472),p===-1)throw new Fe("Invalid byte sequence");const v=(p>>8)*192+(p&255);i.appendBits(v,13)}}static appendECI(r,i){i.appendBits(fe.ECI.getBits(),4),i.appendBits(r.getValue(),8)}}ze.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),ze.DEFAULT_BYTE_MODE_ENCODING=z.UTF8.getName();class di{write(r,i,s,a=null){if(r.length===0)throw new b("Found empty contents");if(i<0||s<0)throw new b("Requested dimensions are too small: "+i+"x"+s);let l=We.L,f=di.QUIET_ZONE_SIZE;a!==null&&(a.get(wt.ERROR_CORRECTION)!==void 0&&(l=We.fromString(a.get(wt.ERROR_CORRECTION).toString())),a.get(wt.MARGIN)!==void 0&&(f=Number.parseInt(a.get(wt.MARGIN).toString(),10)));const d=ze.encode(r,l,a);return this.renderResult(d,i,s,f)}writeToDom(r,i,s,a,l=null){typeof r=="string"&&(r=document.querySelector(r));const f=this.write(i,s,a,l);r&&r.appendChild(f)}renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Xr;const f=l.getWidth(),d=l.getHeight(),h=f+a*2,p=d+a*2,v=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(v/h),Math.floor(E/p)),_=Math.floor((v-f*S)/2),D=Math.floor((E-d*S)/2),P=this.createSVGElement(v,E);for(let W=0,H=D;W<d;W++,H+=S)for(let q=0,J=_;q<f;q++,J+=S)if(l.get(q,W)===1){const Z=this.createSvgRectElement(J,H,S,S);P.appendChild(Z)}return P}createSVGElement(r,i){const s=document.createElementNS(di.SVG_NS,"svg");return s.setAttributeNS(null,"height",r.toString()),s.setAttributeNS(null,"width",i.toString()),s}createSvgRectElement(r,i,s,a){const l=document.createElementNS(di.SVG_NS,"rect");return l.setAttributeNS(null,"x",r.toString()),l.setAttributeNS(null,"y",i.toString()),l.setAttributeNS(null,"height",s.toString()),l.setAttributeNS(null,"width",a.toString()),l.setAttributeNS(null,"fill","#000000"),l}}di.QUIET_ZONE_SIZE=4,di.SVG_NS="http://www.w3.org/2000/svg";class $i{encode(r,i,s,a,l){if(r.length===0)throw new b("Found empty contents");if(i!==le.QR_CODE)throw new b("Can only encode QR_CODE, but got "+i);if(s<0||a<0)throw new b(`Requested dimensions are too small: ${s}x${a}`);let f=We.L,d=$i.QUIET_ZONE_SIZE;l!==null&&(l.get(wt.ERROR_CORRECTION)!==void 0&&(f=We.fromString(l.get(wt.ERROR_CORRECTION).toString())),l.get(wt.MARGIN)!==void 0&&(d=Number.parseInt(l.get(wt.MARGIN).toString(),10)));const h=ze.encode(r,f,l);return $i.renderResult(h,s,a,d)}static renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Xr;const f=l.getWidth(),d=l.getHeight(),h=f+a*2,p=d+a*2,v=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(v/h),Math.floor(E/p)),_=Math.floor((v-f*S)/2),D=Math.floor((E-d*S)/2),P=new Te(v,E);for(let W=0,H=D;W<d;W++,H+=S)for(let q=0,J=_;q<f;q++,J+=S)l.get(q,W)===1&&P.setRegion(J,H,S,S);return P}}$i.QUIET_ZONE_SIZE=4;class I3{encode(r,i,s,a,l){let f;switch(i){case le.QR_CODE:f=new $i;break;default:throw new b("No encoder available for format "+i)}return f.encode(r,i,s,a,l)}}class Qr extends te{constructor(r,i,s,a,l,f,d,h){if(super(f,d),this.yuvData=r,this.dataWidth=i,this.dataHeight=s,this.left=a,this.top=l,a+f>i||l+d>s)throw new b("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(f,d)}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.yuvData,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.yuvData;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.yuvData,l,a,0,s),a;for(let f=0;f<i;f++){const d=f*r;M.arraycopy(this.yuvData,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new Qr(this.yuvData,this.dataWidth,this.dataHeight,this.left+r,this.top+i,s,a,!1)}renderThumbnail(){const r=this.getWidth()/Qr.THUMBNAIL_SCALE_FACTOR,i=this.getHeight()/Qr.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(r*i),a=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let f=0;f<i;f++){const d=f*r;for(let h=0;h<r;h++){const p=a[l+h*Qr.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|p*65793}l+=this.dataWidth*Qr.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Qr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Qr.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(r,i){const s=this.yuvData;for(let a=0,l=this.top*this.dataWidth+this.left;a<i;a++,l+=this.dataWidth){const f=l+r/2;for(let d=l,h=l+r-1;d<f;d++,h--){const p=s[d];s[d]=s[h],s[h]=p}}}invert(){return new he(this)}}Qr.THUMBNAIL_SCALE_FACTOR=2;class pu extends te{constructor(r,i,s,a,l,f,d){if(super(i,s),this.dataWidth=a,this.dataHeight=l,this.left=f,this.top=d,r.BYTES_PER_ELEMENT===4){const h=i*s,p=new Uint8ClampedArray(h);for(let v=0;v<h;v++){const E=r[v],S=E>>16&255,_=E>>7&510,D=E&255;p[v]=(S+_+D)/4&255}this.luminances=p}else this.luminances=r;if(a===void 0&&(this.dataWidth=i),l===void 0&&(this.dataHeight=s),f===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+i>this.dataWidth||this.top+s>this.dataHeight)throw new b("Crop rectangle does not fit within image data.")}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.luminances,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.luminances;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.luminances,l,a,0,s),a;for(let f=0;f<i;f++){const d=f*r;M.arraycopy(this.luminances,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new pu(this.luminances,s,a,this.dataWidth,this.dataHeight,this.left+r,this.top+i)}invert(){return new he(this)}}class oh extends z{static forName(r){return this.getCharacterSetECIByName(r)}}class mu{}mu.ISO_8859_1=z.ISO8859_1;class ah{isCompact(){return this.compact}setCompact(r){this.compact=r}getSize(){return this.size}setSize(r){this.size=r}getLayers(){return this.layers}setLayers(r){this.layers=r}getCodeWords(){return this.codeWords}setCodeWords(r){this.codeWords=r}getMatrix(){return this.matrix}setMatrix(r){this.matrix=r}}class lh{static singletonList(r){return[r]}static min(r,i){return r.sort(i)[0]}}class T3{constructor(r){this.previous=r}getPrevious(){return this.previous}}class zi extends T3{constructor(r,i,s){super(r),this.value=i,this.bitCount=s}appendTo(r,i){r.appendBits(this.value,this.bitCount)}add(r,i){return new zi(this,r,i)}addBinaryShift(r,i){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new zi(this,r,i)}toString(){let r=this.value&(1<<this.bitCount)-1;return r|=1<<this.bitCount,"<"+O.toBinaryString(r|1<<this.bitCount).substring(1)+">"}}class xu extends zi{constructor(r,i,s){super(r,0,0),this.binaryShiftStart=i,this.binaryShiftByteCount=s}appendTo(r,i){for(let s=0;s<this.binaryShiftByteCount;s++)(s===0||s===31&&this.binaryShiftByteCount<=62)&&(r.appendBits(31,5),this.binaryShiftByteCount>62?r.appendBits(this.binaryShiftByteCount-31,16):s===0?r.appendBits(Math.min(this.binaryShiftByteCount,31),5):r.appendBits(this.binaryShiftByteCount-31,5)),r.appendBits(i[this.binaryShiftStart+s],8)}addBinaryShift(r,i){return new xu(this,r,i)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function R3(y,r,i){return new xu(y,r,i)}function Xs(y,r,i){return new zi(y,r,i)}const _3=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Pn=0,Ia=1,Sr=2,ch=3,qr=4,O3=new zi(null,0,0),wu=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function N3(y){for(let r of y)I.fill(r,-1);return y[Pn][qr]=0,y[Ia][qr]=0,y[Ia][Pn]=28,y[ch][qr]=0,y[Sr][qr]=0,y[Sr][Pn]=15,y}const uh=N3(I.createInt32Array(6,6));class Jr{constructor(r,i,s,a){this.token=r,this.mode=i,this.binaryShiftByteCount=s,this.bitCount=a}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(r,i){let s=this.bitCount,a=this.token;if(r!==this.mode){let f=wu[this.mode][r];a=Xs(a,f&65535,f>>16),s+=f>>16}let l=r===Sr?4:5;return a=Xs(a,i,l),new Jr(a,r,0,s+l)}shiftAndAppend(r,i){let s=this.token,a=this.mode===Sr?4:5;return s=Xs(s,uh[this.mode][r],a),s=Xs(s,i,5),new Jr(s,this.mode,0,this.bitCount+a+5)}addBinaryShiftChar(r){let i=this.token,s=this.mode,a=this.bitCount;if(this.mode===qr||this.mode===Sr){let d=wu[s][Pn];i=Xs(i,d&65535,d>>16),a+=d>>16,s=Pn}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,f=new Jr(i,s,this.binaryShiftByteCount+1,a+l);return f.binaryShiftByteCount===2078&&(f=f.endBinaryShift(r+1)),f}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let i=this.token;return i=R3(i,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Jr(i,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let i=this.bitCount+(wu[this.mode][r.mode]>>16);return this.binaryShiftByteCount<r.binaryShiftByteCount?i+=Jr.calculateBinaryShiftCost(r)-Jr.calculateBinaryShiftCost(this):this.binaryShiftByteCount>r.binaryShiftByteCount&&r.binaryShiftByteCount>0&&(i+=10),i<=r.bitCount}toBitArray(r){let i=[];for(let a=this.endBinaryShift(r.length).token;a!==null;a=a.getPrevious())i.unshift(a);let s=new B;for(const a of i)a.appendTo(s,r);return s}toString(){return ie.format("%s bits=%d bytes=%d",_3[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Jr.INITIAL_STATE=new Jr(O3,Pn,0,0);function k3(y){const r=ie.getCharCode(" "),i=ie.getCharCode("."),s=ie.getCharCode(",");y[Pn][r]=1;const a=ie.getCharCode("Z"),l=ie.getCharCode("A");for(let S=l;S<=a;S++)y[Pn][S]=S-l+2;y[Ia][r]=1;const f=ie.getCharCode("z"),d=ie.getCharCode("a");for(let S=d;S<=f;S++)y[Ia][S]=S-d+2;y[Sr][r]=1;const h=ie.getCharCode("9"),p=ie.getCharCode("0");for(let S=p;S<=h;S++)y[Sr][S]=S-p+2;y[Sr][s]=12,y[Sr][i]=13;const v=["\0"," ","","","","","","","\x07","\b"," ",`
479
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<v.length;S++)y[ch][ie.getCharCode(v[S])]=S;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<E.length;S++)ie.getCharCode(E[S])>0&&(y[qr][ie.getCharCode(E[S])]=S);return y}const vu=k3(I.createInt32Array(5,256));class Ys{constructor(r){this.text=r}encode(){const r=ie.getCharCode(" "),i=ie.getCharCode(`
480
- `);let s=lh.singletonList(Jr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let f,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case ie.getCharCode("\r"):f=d===i?2:0;break;case ie.getCharCode("."):f=d===r?3:0;break;case ie.getCharCode(","):f=d===r?4:0;break;case ie.getCharCode(":"):f=d===r?5:0;break;default:f=0}f>0?(s=Ys.updateStateListForPair(s,l,f),l++):s=this.updateStateListForChar(s,l)}return lh.min(s,(l,f)=>l.getBitCount()-f.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Ys.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=vu[r.getMode()][a]>0,f=null;for(let d=0;d<=qr;d++){let h=vu[d][a];if(h>0){if(f==null&&(f=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=f.latchAndAppend(d,h);s.push(p)}if(!l&&uh[r.getMode()][d]>=0){const p=f.shiftAndAppend(d,h);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||vu[r.getMode()][a]===0){let d=r.addBinaryShiftChar(i);s.push(d)}}static updateStateListForPair(r,i,s){const a=[];for(let l of r)this.updateStateForPair(l,i,s,a);return this.simplifyStates(a)}static updateStateForPair(r,i,s,a){let l=r.endBinaryShift(i);if(a.push(l.latchAndAppend(qr,s)),r.getMode()!==qr&&a.push(l.shiftAndAppend(qr,s)),s===3||s===4){let f=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(f)}if(r.getBinaryShiftByteCount()>0){let f=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(f)}}static simplifyStates(r){let i=[];for(const s of r){let a=!0;for(const l of i){if(l.isBetterThanOrEqualTo(s)){a=!1;break}s.isBetterThanOrEqualTo(l)&&(i=i.filter(f=>f!==l))}a&&i.push(s)}return i}}class _e{constructor(){}static encodeBytes(r){return _e.encode(r,_e.DEFAULT_EC_PERCENT,_e.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Ys(r).encode(),l=O.truncDivision(a.getSize()*i,100)+11,f=a.getSize()+l,d,h,p,v,E;if(s!==_e.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?_e.MAX_NB_BITS_COMPACT:_e.MAX_NB_BITS))throw new b(ie.format("Illegal value %s for layers",s));p=_e.totalBitsInLayer(h,d),v=_e.WORD_SIZE[h];let Z=p-p%v;if(E=_e.stuffBits(a,v),E.getSize()+l>Z)throw new b("Data to large for user specified layer");if(d&&E.getSize()>v*64)throw new b("Data to large for user specified layer")}else{v=0,E=null;for(let Z=0;;Z++){if(Z>_e.MAX_NB_BITS)throw new b("Data too large for an Aztec code");if(d=Z<=3,h=d?Z+1:Z,p=_e.totalBitsInLayer(h,d),f>p)continue;(E==null||v!==_e.WORD_SIZE[h])&&(v=_e.WORD_SIZE[h],E=_e.stuffBits(a,v));let Ae=p-p%v;if(!(d&&E.getSize()>v*64)&&E.getSize()+l<=Ae)break}}let S=_e.generateCheckWords(E,p,v),_=E.getSize()/v,D=_e.generateModeMessage(d,h,_),P=(d?11:14)+h*4,W=new Int32Array(P),H;if(d){H=P;for(let Z=0;Z<W.length;Z++)W[Z]=Z}else{H=P+1+2*O.truncDivision(O.truncDivision(P,2)-1,15);let Z=O.truncDivision(P,2),Ae=O.truncDivision(H,2);for(let we=0;we<Z;we++){let tr=we+O.truncDivision(we,15);W[Z-we-1]=Ae-tr-1,W[Z+we]=Ae+tr+1}}let q=new Te(H);for(let Z=0,Ae=0;Z<h;Z++){let we=(h-Z)*4+(d?9:12);for(let tr=0;tr<we;tr++){let Dr=tr*2;for(let rr=0;rr<2;rr++)S.get(Ae+Dr+rr)&&q.set(W[Z*2+rr],W[Z*2+tr]),S.get(Ae+we*2+Dr+rr)&&q.set(W[Z*2+tr],W[P-1-Z*2-rr]),S.get(Ae+we*4+Dr+rr)&&q.set(W[P-1-Z*2-rr],W[P-1-Z*2-tr]),S.get(Ae+we*6+Dr+rr)&&q.set(W[P-1-Z*2-tr],W[Z*2+rr])}Ae+=we*8}if(_e.drawModeMessage(q,d,H,D),d)_e.drawBullsEye(q,O.truncDivision(H,2),5);else{_e.drawBullsEye(q,O.truncDivision(H,2),7);for(let Z=0,Ae=0;Z<O.truncDivision(P,2)-1;Z+=15,Ae+=16)for(let we=O.truncDivision(H,2)&1;we<H;we+=2)q.set(O.truncDivision(H,2)-Ae,we),q.set(O.truncDivision(H,2)+Ae,we),q.set(we,O.truncDivision(H,2)-Ae),q.set(we,O.truncDivision(H,2)+Ae)}let J=new ah;return J.setCompact(d),J.setSize(H),J.setLayers(h),J.setCodeWords(_),J.setMatrix(q),J}static drawBullsEye(r,i,s){for(let a=0;a<s;a+=2)for(let l=i-a;l<=i+a;l++)r.set(l,i-a),r.set(l,i+a),r.set(i-a,l),r.set(i+a,l);r.set(i-s,i-s),r.set(i-s+1,i-s),r.set(i-s,i-s+1),r.set(i+s,i-s),r.set(i+s,i-s+1),r.set(i+s,i+s-1)}static generateModeMessage(r,i,s){let a=new B;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=_e.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=_e.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=O.truncDivision(s,2);if(i)for(let f=0;f<7;f++){let d=l-3+f;a.get(f)&&r.set(d,l-5),a.get(f+7)&&r.set(l+5,d),a.get(20-f)&&r.set(d,l+5),a.get(27-f)&&r.set(l-5,d)}else for(let f=0;f<10;f++){let d=l-5+f+O.truncDivision(f,5);a.get(f)&&r.set(d,l-7),a.get(f+10)&&r.set(l+7,d),a.get(29-f)&&r.set(d,l+7),a.get(39-f)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new gu(_e.getGF(s)),f=O.truncDivision(i,s),d=_e.bitsToWords(r,s,f);l.encode(d,f-a);let h=i%s,p=new B;p.appendBits(0,h);for(const v of Array.from(d))p.appendBits(v,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,f;for(l=0,f=r.getSize()/i;l<f;l++){let d=0;for(let h=0;h<i;h++)d|=r.get(l*i+h)?1<<i-h-1:0;a[l]=d}return a}static getGF(r){switch(r){case 4:return Ne.AZTEC_PARAM;case 6:return Ne.AZTEC_DATA_6;case 8:return Ne.AZTEC_DATA_8;case 10:return Ne.AZTEC_DATA_10;case 12:return Ne.AZTEC_DATA_12;default:throw new b("Unsupported word size "+r)}}static stuffBits(r,i){let s=new B,a=r.getSize(),l=(1<<i)-2;for(let f=0;f<a;f+=i){let d=0;for(let h=0;h<i;h++)(f+h>=a||r.get(f+h))&&(d|=1<<i-1-h);(d&l)===l?(s.appendBits(d&l,i),f--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),f--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}_e.DEFAULT_EC_PERCENT=33,_e.DEFAULT_AZTEC_LAYERS=0,_e.MAX_NB_BITS=32,_e.MAX_NB_BITS_COMPACT=4,_e.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Ta{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let f=mu.ISO_8859_1,d=_e.DEFAULT_EC_PERCENT,h=_e.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(wt.CHARACTER_SET)&&(f=oh.forName(l.get(wt.CHARACTER_SET).toString())),l.has(wt.ERROR_CORRECTION)&&(d=O.parseInt(l.get(wt.ERROR_CORRECTION).toString())),l.has(wt.AZTEC_LAYERS)&&(h=O.parseInt(l.get(wt.AZTEC_LAYERS).toString()))),Ta.encodeLayers(r,i,s,a,f,d,h)}static encodeLayers(r,i,s,a,l,f,d){if(i!==le.AZTEC)throw new b("Can only encode AZTEC, but got "+i);let h=_e.encode(ie.getBytes(r,l),f,d);return Ta.renderResult(h,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Xr;let l=a.getWidth(),f=a.getHeight(),d=Math.max(i,l),h=Math.max(s,f),p=Math.min(d/l,h/f),v=(d-l*p)/2,E=(h-f*p)/2,S=new Te(d,h);for(let _=0,D=E;_<f;_++,D+=p)for(let P=0,W=v;P<l;P++,W+=p)a.get(P,_)&&S.setRegion(W,D,p,p);return S}}n.AbstractExpandedDecoder=iu,n.ArgumentException=C,n.ArithmeticException=pa,n.AztecCode=ah,n.AztecCodeReader=wa,n.AztecCodeWriter=Ta,n.AztecDecoder=je,n.AztecDetector=X0,n.AztecDetectorResult=H0,n.AztecEncoder=_e,n.AztecHighLevelEncoder=Ys,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=A,n.BitArray=B,n.BitMatrix=Te,n.BitSource=lu,n.BrowserAztecCodeReader=i3,n.BrowserBarcodeReader=c3,n.BrowserCodeReader=Er,n.BrowserDatamatrixCodeReader=f3,n.BrowserMultiFormatReader=C3,n.BrowserPDF417Reader=b3,n.BrowserQRCodeReader=A3,n.BrowserQRCodeSvgWriter=di,n.CharacterSetECI=z,n.ChecksumException=T,n.Code128Reader=ee,n.Code39Reader=mt,n.DataMatrixDecodedBitStreamParser=Nn,n.DataMatrixReader=kn,n.DecodeHintType=U,n.DecoderResult=Bs,n.DefaultGridSampler=G0,n.DetectorResult=xa,n.EAN13Reader=ai,n.EncodeHintType=wt,n.Exception=m,n.FormatException=F,n.GenericGF=Ne,n.GenericGFPoly=Qt,n.GlobalHistogramBinarizer=rt,n.GridSampler=eu,n.GridSamplerInstance=_n,n.HTMLCanvasElementLuminanceSource=me,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=b,n.IllegalStateException=Xr,n.InvertedLuminanceSource=he,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ji,n.MultiFormatReader=sh,n.MultiFormatWriter=I3,n.NotFoundException=X,n.OneDReader=ht,n.PDF417DecodedBitStreamParser=V,n.PDF417DecoderErrorCorrection=J0,n.PDF417Reader=Nt,n.PDF417ResultMetadata=th,n.PerspectiveTransform=kr,n.PlanarYUVLuminanceSource=Qr,n.QRCodeByteMatrix=Sa,n.QRCodeDataMask=br,n.QRCodeDecodedBitStreamParser=Qe,n.QRCodeDecoderErrorCorrectionLevel=We,n.QRCodeDecoderFormatInformation=Ut,n.QRCodeEncoder=ze,n.QRCodeEncoderQRCode=fi,n.QRCodeMaskUtil=st,n.QRCodeMatrixUtil=de,n.QRCodeMode=fe,n.QRCodeReader=Mn,n.QRCodeVersion=ue,n.QRCodeWriter=$i,n.RGBLuminanceSource=pu,n.RSS14Reader=it,n.RSSExpandedReader=K,n.ReaderException=Aa,n.ReedSolomonDecoder=Us,n.ReedSolomonEncoder=gu,n.ReedSolomonException=Li,n.Result=Ze,n.ResultMetadataType=bt,n.ResultPoint=ae,n.StringUtils=ie,n.UnsupportedOperationException=oe,n.VideoInputDevice=Ge,n.WhiteRectangleDetector=un,n.WriterException=Fe,n.ZXingArrays=I,n.ZXingCharset=oh,n.ZXingInteger=O,n.ZXingStandardCharsets=mu,n.ZXingStringBuilder=pe,n.ZXingStringEncoding=ve,n.ZXingSystem=M,n.createAbstractExpandedDecoder=Q0,Object.defineProperty(n,"__esModule",{value:!0})})})(K1,K1.exports);var qe=K1.exports;const jR=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var l2=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,qe.BarcodeFormat.QR_CODE],[re.AZTEC,qe.BarcodeFormat.AZTEC],[re.CODABAR,qe.BarcodeFormat.CODABAR],[re.CODE_39,qe.BarcodeFormat.CODE_39],[re.CODE_93,qe.BarcodeFormat.CODE_93],[re.CODE_128,qe.BarcodeFormat.CODE_128],[re.DATA_MATRIX,qe.BarcodeFormat.DATA_MATRIX],[re.MAXICODE,qe.BarcodeFormat.MAXICODE],[re.ITF,qe.BarcodeFormat.ITF],[re.EAN_13,qe.BarcodeFormat.EAN_13],[re.EAN_8,qe.BarcodeFormat.EAN_8],[re.PDF_417,qe.BarcodeFormat.PDF_417],[re.RSS_14,qe.BarcodeFormat.RSS_14],[re.RSS_EXPANDED,qe.BarcodeFormat.RSS_EXPANDED],[re.UPC_A,qe.BarcodeFormat.UPC_A],[re.UPC_E,qe.BarcodeFormat.UPC_E],[re.UPC_EAN_EXTENSION,qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!jR)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),u=new Map;u.set(qe.DecodeHintType.POSSIBLE_FORMATS,c),u.set(qe.DecodeHintType.TRY_HARDER,!1),this.hints=u}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(u){c(u)}})},e.prototype.decode=function(t){var n=new qe.MultiFormatReader(this.verbose,this.hints),o=new qe.HTMLCanvasElementLuminanceSource(t),c=new qe.BinaryBitmap(new qe.HybridBinarizer(o)),u=n.decode(c);return{text:u.text,format:Yv.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createZXingFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var u=c[o];this.formatMap.has(u)?n.push(this.formatMap.get(u)):this.logger.logError("".concat(u," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),WR=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(g){g(u)})}return new(n||(n=Promise))(function(u,g){function x(C){try{m(o.next(C))}catch(b){g(b)}}function w(C){try{m(o.throw(C))}catch(b){g(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},$R=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,g;return g={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},c2=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,"qr_code"],[re.AZTEC,"aztec"],[re.CODABAR,"codabar"],[re.CODE_39,"code_39"],[re.CODE_93,"code_93"],[re.CODE_128,"code_128"],[re.DATA_MATRIX,"data_matrix"],[re.ITF,"itf"],[re.EAN_13,"ean_13"],[re.EAN_8,"ean_8"],[re.PDF_417,"pdf417"],[re.UPC_A,"upc_a"],[re.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=o;var c=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(c),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var t=new BarcodeDetector({formats:["qr_code"]});return typeof t<"u"},e.prototype.decodeAsync=function(t){return WR(this,void 0,void 0,function(){var n,o;return $R(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(n=c.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return o=this.selectLargestBarcode(n),[2,{text:o.rawValue,format:Yv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,u=t;c<u.length;c++){var g=u[c],x=g.boundingBox.width*g.boundingBox.height;x>o&&(o=x,n=g)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var u=c[o];this.formatMap.has(u)?n.push(this.formatMap.get(u)):this.logger.warn("".concat(u," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),u2=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(g){g(u)})}return new(n||(n=Promise))(function(u,g){function x(C){try{m(o.next(C))}catch(b){g(b)}}function w(C){try{m(o.throw(C))}catch(b){g(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},f2=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,g;return g={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},zR=function(){function e(t,n,o,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=o,n&&c2.isSupported()?(this.primaryDecoder=new c2(t,o,c),this.secondaryDecoder=new l2(t,o,c)):this.primaryDecoder=new l2(t,o,c)}return e.prototype.decodeAsync=function(t){return u2(this,void 0,void 0,function(){var n;return f2(this,function(o){switch(o.label){case 0:n=performance.now(),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,o.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return u2(this,void 0,void 0,function(){var n,o;return f2(this,function(c){switch(c.label){case 0:n=performance.now(),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,c.sent()];case 3:if(o=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw o;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(t){if(this.verbose){var n=performance.now()-t;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,n=0,o=this.executionResults;n<o.length;n++){var c=o[n];t+=c}var u=t/this.executionResults.length;console.log("".concat(u," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),z0=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(o[u]=c[u])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),dc=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(g){g(u)})}return new(n||(n=Promise))(function(u,g){function x(C){try{m(o.next(C))}catch(b){g(b)}}function w(C){try{m(o.throw(C))}catch(b){g(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},hc=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,g;return g={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Zv=function(){function e(t,n){this.name=t,this.track=n}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var n={};n[this.name]=t;var o={advanced:[n]};return this.track.applyConstraints(o)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var n=t[this.name];return n}return null},e}(),VR=function(e){z0(t,e);function t(n,o){return e.call(this,n,o)||this}return t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(n){var o={};o[this.name]=n;var c={advanced:[o]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),o=n[this.name];return{min:o.min,max:o.max,step:o.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Zv),HR=function(e){z0(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}(VR),GR=function(e){z0(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(Zv),XR=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new HR(this.track)},e.prototype.torchFeature=function(){return new GR(this.track)},e}(),YR=function(){function e(t,n,o){this.isClosed=!1,this.parentElement=t,this.mediaStream=n,this.callbacks=o,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width="".concat(t,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var o=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(o,c),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,o,c){return dc(this,void 0,void 0,function(){var u,g;return hc(this,function(x){switch(x.label){case 0:return u=new e(t,n,c),o.aspectRatio?(g={aspectRatio:o.aspectRatio},[4,u.getFirstTrackOrFail().applyConstraints(g)]):[3,2];case 1:x.sent(),x.label=2;case 2:return u.setupSurface(),[2,u]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(t){this.failIfClosed();var n=this,o=function(){setTimeout(t,200),n.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(t){return dc(this,void 0,void 0,function(){return hc(this,function(n){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(n,o){var c=t.mediaStream.getVideoTracks(),u=c.length,g=0;t.mediaStream.getVideoTracks().forEach(function(x){t.mediaStream.removeTrack(x),x.stop(),++g,g>=u&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new XR(this.getFirstTrackOrFail())},e}(),KR=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return dc(this,void 0,void 0,function(){return hc(this,function(c){return[2,YR.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return dc(this,void 0,void 0,function(){var n,o;return hc(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return o=c.sent(),[2,new e(o)]}})})},e}(),d2=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(g){g(u)})}return new(n||(n=Promise))(function(u,g){function x(C){try{m(o.next(C))}catch(b){g(b)}}function w(C){try{m(o.throw(C))}catch(b){g(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},h2=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,g;return g={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},ZR=function(){function e(){}return e.failIfNotSupported=function(){return d2(this,void 0,void 0,function(){return h2(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return d2(this,void 0,void 0,function(){return h2(this,function(n){return[2,KR.create(t)]})})},e}(),QR=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(g){g(u)})}return new(n||(n=Promise))(function(u,g){function x(C){try{m(o.next(C))}catch(b){g(b)}}function w(C){try{m(o.throw(C))}catch(b){g(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},qR=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,g;return g={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},JR=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=us.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=us.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var t=location.host.split(":")[0];return t==="127.0.0.1"||t==="localhost"},e.getCamerasFromMediaDevices=function(){return QR(this,void 0,void 0,function(){var t,n,o,c,u,g,x;return qR(this,function(w){switch(w.label){case 0:return t=function(m){for(var C=m.getVideoTracks(),b=0,A=C;b<A.length;b++){var T=A[b];T.enabled=!1,T.stop(),m.removeTrack(T)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=w.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=w.sent(),c=[],u=0,g=o;u<g.length;u++)x=g[u],x.kind==="videoinput"&&c.push({id:x.deviceId,label:x.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(u){for(var g=[],x=0,w=u;x<w.length;x++){var m=w[x];m.kind==="video"&&g.push({id:m.id,label:m.label})}t(g)},c=MediaStreamTrack;c.getSources(o)})},e}(),ot;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(ot||(ot={}));var e_=function(){function e(){this.state=ot.NOT_STARTED,this.onGoingTransactionNewState=ot.UNKNOWN}return e.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},e.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=ot.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=ot.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==ot.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case ot.UNKNOWN:throw"Transition from unknown is not allowed";case ot.NOT_STARTED:this.failIfNewStateIs(t,[ot.PAUSED]);break;case ot.SCANNING:break;case ot.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var u=c[o];if(t===u)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),t_=function(){function e(t){this.stateManager=t}return e.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},e.prototype.directTransition=function(t){this.stateManager.directTransition(t)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===ot.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==ot.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===ot.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===ot.PAUSED},e}(),r_=function(){function e(){}return e.create=function(){return new t_(new e_)},e}(),n_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(o[u]=c[u])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),dr=function(e){n_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(BR),i_=function(){function e(t,n){this.logger=n,this.fps=dr.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=t.disableFlip===!0,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=dr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Kv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!fn(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),G_=function(){function e(t,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");this.elementId=t,this.verbose=!1;var o;typeof n=="boolean"?this.verbose=n===!0:n&&(o=n,this.verbose=o.verbose===!0,o.experimentalFeatures),this.logger=new UR(this.verbose),this.qrcode=new zR(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=r_.create()}return e.prototype.start=function(t,n,o,c){var u=this;if(!t)throw"cameraIdOrConfig is required";if(!o||typeof o!="function")throw"qrCodeSuccessCallback is required and should be a function.";var g;c?g=c:g=this.verbose?this.logger.log:function(){};var x=i_.create(n,this.logger);this.clearElement();var w=!1;x.videoConstraints&&(x.isMediaStreamConstraintsValid()?w=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var m=w,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:dr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var b=this,A=this.stateManagerProxy.startTransition(ot.SCANNING);return new Promise(function(T,k){var M=m?x.videoConstraints:b.createVideoConstraints(t);if(!M){A.cancel(),k("videoConstraints should be defined");return}var G={};(!m||x.aspectRatio)&&(G.aspectRatio=x.aspectRatio);var N={onRenderSurfaceReady:function(I,O){b.setupUi(I,O,x),b.isScanning=!0,b.foreverScan(x,o,g)}};ZR.failIfNotSupported().then(function(I){I.create(M).then(function(O){return O.render(u.element,G,N).then(function(B){b.renderedCamera=B,A.execute(),T(null)}).catch(function(B){A.cancel(),k(B)})}).catch(function(O){A.cancel(),k(us.errorGettingUserMedia(O))})}).catch(function(I){A.cancel(),k(us.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(ot.PAUSED),this.showPausedState(),(fn(t)||t!==!0)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,n=function(){t.stateManagerProxy.directTransition(ot.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(ot.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var u=document.getElementById(dr.SHADED_REGION_ELEMENT_ID);u&&t.element.removeChild(u)}},c=this;return this.renderedCamera.close().then(function(){return c.renderedCamera=null,c.element&&(c.element.removeChild(c.canvasElement),c.canvasElement=null),o(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),n.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(fn(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,u){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var g=new Image;g.onload=function(){var x=g.width,w=g.height,m=document.getElementById(o.elementId),C=m.clientWidth?m.clientWidth:dr.DEFAULT_WIDTH,b=Math.max(m.clientHeight?m.clientHeight:w,dr.FILE_SCAN_MIN_HEIGHT),A=o.computeCanvasDrawConfig(x,w,C,b);if(n){var T=o.createCanvasElement(C,b,"qr-canvas-visible");T.style.display="inline-block",m.appendChild(T);var k=T.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=b,k.drawImage(g,0,0,x,w,A.x,A.y,A.width,A.height)}var M=dr.FILE_SCAN_HIDDEN_CANVAS_PADDING,G=Math.max(g.width,A.width),N=Math.max(g.height,A.height),I=G+2*M,O=N+2*M,B=o.createCanvasElement(I,O);m.appendChild(B);var j=B.getContext("2d");if(!j)throw"Unable to get 2d context from canvas";j.canvas.width=I,j.canvas.height=O,j.drawImage(g,0,0,x,w,M,M,G,N);try{o.qrcode.decodeRobustlyAsync(B).then(function(U){c(a2.createFromQrcodeResult(U))}).catch(u)}catch(U){u("QR code parse error, error = ".concat(U))}},g.onerror=u,g.onabort=u,g.onstalled=u,g.onsuspend=u,g.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return JR.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(t){if(t){if(!Kv.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(t){var n=[re.QR_CODE,re.AZTEC,re.CODABAR,re.CODE_39,re.CODE_93,re.CODE_128,re.DATA_MATRIX,re.MAXICODE,re.ITF,re.EAN_13,re.EAN_8,re.PDF_417,re.RSS_14,re.RSS_EXPANDED,re.UPC_A,re.UPC_E,re.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return n;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(t.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var o=[],c=0,u=t.formatsToSupport;c<u.length;c++){var g=u[c];LR(g)?o.push(g):this.logger.warn("Invalid format: ".concat(g," passed in config, ignoring."))}if(o.length===0)throw"None of formatsToSupport match supported values.";return o},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(fn(t))return!0;if(!fn(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(fn(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return fn(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,u=o.qrbox;this.validateQrboxConfig(u);var g=this.toQrdimensions(t,n,u),x=function(m){if(m<dr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(dr.MIN_QR_BOX_SIZE,"px.")},w=function(m){return m>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),m=t),m};x(g.width),x(g.height),g.width=w(g.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var c=fn(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var u=this.toQrdimensions(t,n,c);u.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var g=o.isShadedBoxEnabled()&&u.height<=n,x={x:0,y:0,width:t,height:n},w=g?this.getShadedRegionBounds(t,n,u):x,m=this.createCanvasElement(w.width,w.height),C={willReadFrequently:!0},b=m.getContext("2d",C);b.canvas.width=w.width,b.canvas.height=w.height,this.element.append(m),g&&this.possiblyInsertShadingElement(this.element,t,n,u),this.createScannerPausedUiElement(this.element),this.qrRegion=w,this.context=b,this.canvasElement=m},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=us.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,a2.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var u=us.codeParseError(c);return n(u,FR.createFrom(u)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var u=this.renderedCamera.getSurface(),g=u.videoWidth/u.clientWidth,x=u.videoHeight/u.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var w=this.qrRegion.width*g,m=this.qrRegion.height*x,C=this.qrRegion.x*g,b=this.qrRegion.y*x;this.context.drawImage(u,C,b,w,m,0,0,this.qrRegion.width,this.qrRegion.height);var A=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(T){!T&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){A()})):A()}).catch(function(T){c.logger.logError("Error happend while scanning context",T),A()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",c={user:!0,environment:!0},u="exact",g=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},x=Object.keys(t);if(x.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(x.length," keys");var w=Object.keys(t)[0];if(w!==n&&w!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(w===n){var m=t.facingMode;if(typeof m=="string"){if(g(m))return{facingMode:m}}else if(typeof m=="object")if(u in m){if(g(m["".concat(u)]))return{facingMode:{exact:m["".concat(u)]}}}else throw"'facingMode' should be string or object with"+" ".concat(u," as key.");else{var C=typeof m;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var b=t.deviceId;if(typeof b=="string")return{deviceId:b};if(typeof b=="object"){if(u in b)return{deviceId:{exact:b["".concat(u)]}};throw"'deviceId' should be string or object with"+" ".concat(u," as key.")}else{var A=typeof b;throw"Invalid type of 'deviceId' = ".concat(A)}}}var T=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(T)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var u=(o-t)/2,g=(c-n)/2;return{x:u,y:g,width:t,height:n}}else{var x=t,w=n;return t>o&&(n=o/t*n,t=o),n>c&&(t=c/n*t,n=c),this.logger.log("Image downsampled from "+"".concat(x,"X").concat(w)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,o,c)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?dr.BORDER_SHADER_MATCH_COLOR:dr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var c=t,u=n,g=document.createElement("canvas");return g.style.width="".concat(c,"px"),g.style.height="".concat(u,"px"),g.style.display="none",g.id=fn(o)?"qr-canvas":o,g},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,c){if(!(n-c.width<1||o-c.height<1)){var u=document.createElement("div");u.style.position="absolute";var g=(n-c.width)/2,x=(o-c.height)/2;if(u.style.borderLeft="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderRight="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderTop="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderBottom="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),u.style.boxSizing="border-box",u.style.top="0px",u.style.bottom="0px",u.style.left="0px",u.style.right="0px",u.id="".concat(dr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var w=5,m=40;this.insertShaderBorders(u,m,w,-w,null,0,!0),this.insertShaderBorders(u,m,w,-w,null,0,!1),this.insertShaderBorders(u,m,w,null,-w,0,!0),this.insertShaderBorders(u,m,w,null,-w,0,!1),this.insertShaderBorders(u,w,m+w,-w,null,-w,!0),this.insertShaderBorders(u,w,m+w,null,-w,-w,!0),this.insertShaderBorders(u,w,m+w,-w,null,-w,!1),this.insertShaderBorders(u,w,m+w,null,-w,-w,!1),this.hasBorderShaders=!0}t.append(u)}},e.prototype.insertShaderBorders=function(t,n,o,c,u,g,x){var w=document.createElement("div");w.style.position="absolute",w.style.backgroundColor=dr.BORDER_SHADER_DEFAULT_COLOR,w.style.width="".concat(n,"px"),w.style.height="".concat(o,"px"),c!==null&&(w.style.top="".concat(c,"px")),u!==null&&(w.style.bottom="".concat(u,"px")),x?w.style.left="".concat(g,"px"):w.style.right="".concat(g,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(w),t.appendChild(w)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),g2;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(g2||(g2={}));var Z1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(Z1||(Z1={}));var Q1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(Q1||(Q1={}));var q1;(function(e){e[e.ALL=17]="ALL"})(q1||(q1={}));const s_=Object.assign(Object.assign({},re),q1);var p2;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(p2||(p2={}));const o_=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function a_(e){const t="custom-style-os-cap-barcode";let n=document.getElementById(t);if(n||(n=document.createElement("style"),n.type="text/css",n.id=t,document.head.appendChild(n)),n.sheet){for(;n.sheet.cssRules.length;)n.sheet.deleteRule(0);for(const{selector:o,css:c}of e)n.sheet.insertRule(`${o} { ${c} }`)}else{n.textContent="";for(const{selector:o,css:c}of e)n.textContent+=`${o} { ${c} }`}}const l_=ga("CapacitorBarcodeScanner",{web:()=>(a_(o_),Br(()=>import("./web-CBiaPgEe.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class c_{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||Z1.BACK,t.scanOrientation=t.scanOrientation||Q1.ADAPTIVE,l_.scanBarcode(t)}}const Mf=ga("SecureStoragePlugin",{web:()=>Br(()=>import("./web-BH9JgWsL.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function u_(e){try{if(e.length>2048)throw new Error;if(!e.startsWith("{")){const c=new URL(e);if(!["http:","https:"].includes(c.protocol)||c.username||c.password||c.pathname!=="/pair"||c.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(c.hash))throw new Error;const u=ln.parse(c.origin);if(!u)throw new Error;return{endpoint:u,grant:c.hash.slice(6)}}const t=JSON.parse(e);if(t.type!=="agentroam-pair"||t.version!==1||typeof t.server!="string"||typeof t.grant!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t.grant))throw new Error;const n=new URL(t.server);if(n.username||n.password||n.search||n.hash||n.pathname!=="/")throw new Error;const o=ln.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class Qv{ready(){if(!Ns.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await Mf.get({key:`agentroam-device:${t}`})).value}catch(n){if(String(n).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,n){this.ready(),await Mf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await Mf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function qv(){if(!Ns.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await c_.scanBarcode({hint:s_.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class Jv{constructor(t,n=(...c)=>fetch(...c),o=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=n,this.onRevoked=o,this.session=null,this.fetch=async(c,u={})=>{const g=this.session,x=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),w=new Headers(u.headers??(c instanceof Request?c.headers:void 0));g&&x.origin===g.origin&&w.set("authorization",`Bearer ${g.token}`);const m=await this.transport(c,{...u,headers:w,credentials:"omit",redirect:"error"});if(g&&this.session===g&&x.origin===g.origin&&(m.status===401||m.status===423)){this.session=null;try{await this.storage.remove(g.origin)}finally{this.onRevoked()}}return m}}async resume(t){const n=await this.storage.get(t.url);this.session=n?{origin:t.url,token:n}:null}async pair(t){const{endpoint:n,grant:o}=u_(t),c=new AbortController,u=setTimeout(()=>c.abort(),3e4);let g=null;try{let x;try{x=await this.transport(n.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:o,name:"我的 App"}),credentials:"omit",redirect:"error",signal:c.signal}),x.ok&&(g=await x.json())}catch(w){if(w instanceof SyntaxError)throw new Error("服务器返回了无效的设备凭证。");const m=c.signal.aborted||w instanceof Error&&(w.name==="TimeoutError"||w.name==="AbortError"),C=n.url.startsWith("http://")?"请确认手机与电脑在同一网络,并检查电脑防火墙是否允许 AgentRoam 连接。":"请检查手机网络和电脑的远程连接是否可用。";throw new Error(`${m?"连接电脑超时":"无法连接电脑"}(${n.url})。${C}请在电脑上刷新二维码后重新扫码。`)}if(!x.ok)throw new Error(x.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":x.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。")}finally{clearTimeout(u)}if(!g||typeof g.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(g.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,g.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${g.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:g.token},n}async checkAuthorization(){const t=this.session;if(!t)return;const n=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!n.ok)return;const o=await n.json();if(this.session===t&&(o.locked||o.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}function e3(e,t,n,o){const c=new URL(t);return(u,g)=>{const x=typeof u=="string"?u:u instanceof URL?u.href:u.url,w=new URL(x,c),m=w.protocol===c.protocol&&w.host===c.host;if(w.pathname.startsWith("/api/")&&(m||w.origin===e)){const C=new URL(w.pathname+w.search,e);return n.fetch(u instanceof Request?new Request(C,u):C,g)}return o(u,g)}}function f_(e,t){const n=new URL(e,"https://agentroam.local");if(n.pathname!=="/app/")throw new Error("Invalid workspace frame path");const o=new URL(t);return o.search=n.search,o.searchParams.set("workspace","1"),o.hash="",o.href}function J1(e){AR(SR(e.url,void 0,Hv())),new Wv().save(e)}async function d_(e,t,n,o){e.render(L.jsx(W0,{})),window.__agentroamNativeFrame={origin:t.url,fetch:n.fetch},globalThis.fetch=e3(t.url,location.href,n,o);const c=async g=>{const x=await n.pair(g);J1(x),location.reload()};vR({origin:t.url,frameUrl:g=>f_(g,location.href),pair:c,scan:async()=>{const g=await qv();g&&await c(g)},switchComputer:async g=>{const x=ln.parse(g);if(!x)throw new Error("电脑地址无效,请重新扫码。");const w=new Jv(new Qv,o,()=>{});await w.resume(x);const m=await w.fetch(x.api("/api/web-auth/status"),{signal:AbortSignal.timeout(5e3)}),C=m.ok?await m.json():null;if(!(C!=null&&C.authenticated)||C.locked)throw new Error("这台电脑需要重新授权,请点击扫码添加电脑。");J1(x),location.reload()}});const{default:u}=await Br(async()=>{const{default:g}=await import("./page-C2e368Dx.js").then(x=>x.p);return{default:g}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url);e.render(L.jsx(ce.StrictMode,{children:L.jsx(u,{})}))}function h_(){if(window.parent===window||new URLSearchParams(location.search).get("workspace")!=="1")return null;try{const e=new URL(window.parent.location.href);return e.protocol!==location.protocol||e.host!==location.host?null:window.parent.__agentroamNativeFrame??null}catch{return null}}function g_(e){return async(t,n)=>{const o=new Request(t,n);return e.fetch(o.url,{method:o.method,headers:Object.fromEntries(o.headers),body:o.method==="GET"||o.method==="HEAD"?void 0:await o.arrayBuffer(),signal:o.signal,cache:o.cache})}}var gc;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(gc||(gc={}));var m2;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(m2||(m2={}));const Df=ga("StatusBar");function p_(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const u=parseInt(t[1].slice(c,c+2),16)/255;return u<=.04045?u/12.92:((u+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?gc.Light:gc.Dark}}function m_(){if(Ns.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Ci.getState().skin;let t=!1,n=Df.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const g=p_(getComputedStyle(e).getPropertyValue("--bg-deepest"));g&&(n=n.then(async()=>{t||(await Df.setBackgroundColor({color:g.color}),await Df.setStyle({style:g.style}))}).catch(()=>{console.warn("Unable to update the Android status bar.")}))},c=new MutationObserver(o);c.observe(e,{attributes:!0,attributeFilter:["data-skin"]});const u=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",u),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",u),window.removeEventListener("focus",o)}}const x_="/service-worker.js";function w_(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function v_(e){const t="=".repeat((4-e.length%4)%4),n=`${e}${t}`.replace(/-/g,"+").replace(/_/g,"/"),o=atob(n),c=new Uint8Array(new ArrayBuffer(o.length));for(let u=0;u<o.length;u+=1)c[u]=o.charCodeAt(u);return c}async function x2(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(x_),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:v_(t)});await e.post("/api/push/subscribe",c.toJSON())}function y_(e){w_()&&(async()=>{try{if(Notification.permission==="granted"){await x2(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await x2(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Pf extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const w2=10,E_=13,gi=32;function Lf(e){}function C_(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=Lf,onError:n=Lf,onRetry:o=Lf,onComment:c,maxBufferSize:u}=e,g=[];let x=0,w=!0,m,C="",b=0,A,T=!1;function k(j){if(T)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(w&&(w=!1,j.charCodeAt(0)===239&&j.charCodeAt(1)===187&&j.charCodeAt(2)===191&&(j=j.slice(3))),g.length===0){const Y=G(j);Y!==""&&(g.push(Y),x=Y.length),M();return}if(j.indexOf(`
481
- `)===-1&&j.indexOf("\r")===-1){g.push(j),x+=j.length,M();return}g.push(j);const U=g.join("");g.length=0,x=0;const F=G(U);F!==""&&(g.push(F),x=F.length),M()}function M(){u!==void 0&&(x+C.length<=u||(T=!0,g.length=0,x=0,m=void 0,C="",b=0,A=void 0,n(new Pf(`Buffered data exceeded max buffer size of ${u} characters`,{type:"max-buffer-size-exceeded"}))))}function G(j){let U=0;if(j.indexOf("\r")===-1){let F=j.indexOf(`
478
+ `),r.toString()}setMode(r){this.mode=r}setECLevel(r){this.ecLevel=r}setVersion(r){this.version=r}setMaskPattern(r){this.maskPattern=r}setMatrix(r){this.matrix=r}static isValidMaskPattern(r){return r>=0&&r<fi.NUM_MASK_PATTERNS}}fi.NUM_MASK_PATTERNS=8;class Fe extends m{}Fe.kind="WriterException";class de{constructor(){}static clearMatrix(r){r.clear(255)}static buildMatrix(r,i,s,a,l){de.clearMatrix(l),de.embedBasicPatterns(s,l),de.embedTypeInfo(i,a,l),de.maybeEmbedVersionInfo(s,l),de.embedDataBits(r,a,l)}static embedBasicPatterns(r,i){de.embedPositionDetectionPatternsAndSeparators(i),de.embedDarkDotAtLeftBottomCorner(i),de.maybeEmbedPositionAdjustmentPatterns(r,i),de.embedTimingPatterns(i)}static embedTypeInfo(r,i,s){const a=new B;de.makeTypeInfoBits(r,i,a);for(let l=0,f=a.getSize();l<f;++l){const d=a.get(a.getSize()-1-l),g=de.TYPE_INFO_COORDINATES[l],p=g[0],v=g[1];if(s.setBoolean(p,v,d),l<8){const E=s.getWidth()-l-1;s.setBoolean(E,8,d)}else{const S=s.getHeight()-7+(l-8);s.setBoolean(8,S,d)}}}static maybeEmbedVersionInfo(r,i){if(r.getVersionNumber()<7)return;const s=new B;de.makeVersionInfoBits(r,s);let a=6*3-1;for(let l=0;l<6;++l)for(let f=0;f<3;++f){const d=s.get(a);a--,i.setBoolean(l,i.getHeight()-11+f,d),i.setBoolean(i.getHeight()-11+f,l,d)}}static embedDataBits(r,i,s){let a=0,l=-1,f=s.getWidth()-1,d=s.getHeight()-1;for(;f>0;){for(f===6&&(f-=1);d>=0&&d<s.getHeight();){for(let g=0;g<2;++g){const p=f-g;if(!de.isEmpty(s.get(p,d)))continue;let v;a<r.getSize()?(v=r.get(a),++a):v=!1,i!==255&&st.getDataMaskBit(i,p,d)&&(v=!v),s.setBoolean(p,d,v)}d+=l}l=-l,d+=l,f-=2}if(a!==r.getSize())throw new Fe("Not all bits consumed: "+a+"/"+r.getSize())}static findMSBSet(r){return 32-O.numberOfLeadingZeros(r)}static calculateBCHCode(r,i){if(i===0)throw new b("0 polynomial");const s=de.findMSBSet(i);for(r<<=s-1;de.findMSBSet(r)>=s;)r^=i<<de.findMSBSet(r)-s;return r}static makeTypeInfoBits(r,i,s){if(!fi.isValidMaskPattern(i))throw new Fe("Invalid mask pattern");const a=r.getBits()<<3|i;s.appendBits(a,5);const l=de.calculateBCHCode(a,de.TYPE_INFO_POLY);s.appendBits(l,10);const f=new B;if(f.appendBits(de.TYPE_INFO_MASK_PATTERN,15),s.xor(f),s.getSize()!==15)throw new Fe("should not happen but we got: "+s.getSize())}static makeVersionInfoBits(r,i){i.appendBits(r.getVersionNumber(),6);const s=de.calculateBCHCode(r.getVersionNumber(),de.VERSION_INFO_POLY);if(i.appendBits(s,12),i.getSize()!==18)throw new Fe("should not happen but we got: "+i.getSize())}static isEmpty(r){return r===255}static embedTimingPatterns(r){for(let i=8;i<r.getWidth()-8;++i){const s=(i+1)%2;de.isEmpty(r.get(i,6))&&r.setNumber(i,6,s),de.isEmpty(r.get(6,i))&&r.setNumber(6,i,s)}}static embedDarkDotAtLeftBottomCorner(r){if(r.get(8,r.getHeight()-8)===0)throw new Fe;r.setNumber(8,r.getHeight()-8,1)}static embedHorizontalSeparationPattern(r,i,s){for(let a=0;a<8;++a){if(!de.isEmpty(s.get(r+a,i)))throw new Fe;s.setNumber(r+a,i,0)}}static embedVerticalSeparationPattern(r,i,s){for(let a=0;a<7;++a){if(!de.isEmpty(s.get(r,i+a)))throw new Fe;s.setNumber(r,i+a,0)}}static embedPositionAdjustmentPattern(r,i,s){for(let a=0;a<5;++a){const l=de.POSITION_ADJUSTMENT_PATTERN[a];for(let f=0;f<5;++f)s.setNumber(r+f,i+a,l[f])}}static embedPositionDetectionPattern(r,i,s){for(let a=0;a<7;++a){const l=de.POSITION_DETECTION_PATTERN[a];for(let f=0;f<7;++f)s.setNumber(r+f,i+a,l[f])}}static embedPositionDetectionPatternsAndSeparators(r){const i=de.POSITION_DETECTION_PATTERN[0].length;de.embedPositionDetectionPattern(0,0,r),de.embedPositionDetectionPattern(r.getWidth()-i,0,r),de.embedPositionDetectionPattern(0,r.getWidth()-i,r);const s=8;de.embedHorizontalSeparationPattern(0,s-1,r),de.embedHorizontalSeparationPattern(r.getWidth()-s,s-1,r),de.embedHorizontalSeparationPattern(0,r.getWidth()-s,r);const a=7;de.embedVerticalSeparationPattern(a,0,r),de.embedVerticalSeparationPattern(r.getHeight()-a-1,0,r),de.embedVerticalSeparationPattern(a,r.getHeight()-a,r)}static maybeEmbedPositionAdjustmentPatterns(r,i){if(r.getVersionNumber()<2)return;const s=r.getVersionNumber()-1,a=de.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let l=0,f=a.length;l!==f;l++){const d=a[l];if(d>=0)for(let g=0;g!==f;g++){const p=a[g];p>=0&&de.isEmpty(i.get(p,d))&&de.embedPositionAdjustmentPattern(p-2,d-2,i)}}}}de.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),de.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),de.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),de.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),de.VERSION_INFO_POLY=7973,de.TYPE_INFO_POLY=1335,de.TYPE_INFO_MASK_PATTERN=21522;class T3{constructor(r,i){this.dataBytes=r,this.errorCorrectionBytes=i}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ze{constructor(){}static calculateMaskPenalty(r){return st.applyMaskPenaltyRule1(r)+st.applyMaskPenaltyRule2(r)+st.applyMaskPenaltyRule3(r)+st.applyMaskPenaltyRule4(r)}static encode(r,i,s=null){let a=ze.DEFAULT_BYTE_MODE_ENCODING;const l=s!==null&&s.get(wt.CHARACTER_SET)!==void 0;l&&(a=s.get(wt.CHARACTER_SET).toString());const f=this.chooseMode(r,a),d=new B;if(f===fe.BYTE&&(l||ze.DEFAULT_BYTE_MODE_ENCODING!==a)){const J=z.getCharacterSetECIByName(a);J!==void 0&&this.appendECI(J,d)}this.appendModeInfo(f,d);const g=new B;this.appendBytes(r,f,g,a);let p;if(s!==null&&s.get(wt.QR_VERSION)!==void 0){const J=Number.parseInt(s.get(wt.QR_VERSION).toString(),10);p=ue.getVersionForNumber(J);const Z=this.calculateBitsNeeded(f,d,g,p);if(!this.willFit(Z,p,i))throw new Fe("Data too big for requested version")}else p=this.recommendVersion(i,f,d,g);const v=new B;v.appendBitArray(d);const E=f===fe.BYTE?g.getSizeInBytes():r.length;this.appendLengthInfo(E,p,f,v),v.appendBitArray(g);const S=p.getECBlocksForLevel(i),_=p.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(_,v);const D=this.interleaveWithECBytes(v,p.getTotalCodewords(),_,S.getNumBlocks()),P=new fi;P.setECLevel(i),P.setMode(f),P.setVersion(p);const W=p.getDimensionForVersion(),H=new Ia(W,W),q=this.chooseMaskPattern(D,i,p,H);return P.setMaskPattern(q),de.buildMatrix(D,i,p,q,H),P.setMatrix(H),P}static recommendVersion(r,i,s,a){const l=this.calculateBitsNeeded(i,s,a,ue.getVersionForNumber(1)),f=this.chooseVersion(l,r),d=this.calculateBitsNeeded(i,s,a,f);return this.chooseVersion(d,r)}static calculateBitsNeeded(r,i,s,a){return i.getSize()+r.getCharacterCountBits(a)+s.getSize()}static getAlphanumericCode(r){return r<ze.ALPHANUMERIC_TABLE.length?ze.ALPHANUMERIC_TABLE[r]:-1}static chooseMode(r,i=null){if(z.SJIS.getName()===i&&this.isOnlyDoubleByteKanji(r))return fe.KANJI;let s=!1,a=!1;for(let l=0,f=r.length;l<f;++l){const d=r.charAt(l);if(ze.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)a=!0;else return fe.BYTE}return a?fe.ALPHANUMERIC:s?fe.NUMERIC:fe.BYTE}static isOnlyDoubleByteKanji(r){let i;try{i=ve.encode(r,z.SJIS)}catch{return!1}const s=i.length;if(s%2!==0)return!1;for(let a=0;a<s;a+=2){const l=i[a]&255;if((l<129||l>159)&&(l<224||l>235))return!1}return!0}static chooseMaskPattern(r,i,s,a){let l=Number.MAX_SAFE_INTEGER,f=-1;for(let d=0;d<fi.NUM_MASK_PATTERNS;d++){de.buildMatrix(r,i,s,d,a);let g=this.calculateMaskPenalty(a);g<l&&(l=g,f=d)}return f}static chooseVersion(r,i){for(let s=1;s<=40;s++){const a=ue.getVersionForNumber(s);if(ze.willFit(r,a,i))return a}throw new Fe("Data too big")}static willFit(r,i,s){const a=i.getTotalCodewords(),f=i.getECBlocksForLevel(s).getTotalECCodewords(),d=a-f,g=(r+7)/8;return d>=g}static terminateBits(r,i){const s=r*8;if(i.getSize()>s)throw new Fe("data bits cannot fit in the QR Code"+i.getSize()+" > "+s);for(let f=0;f<4&&i.getSize()<s;++f)i.appendBit(!1);const a=i.getSize()&7;if(a>0)for(let f=a;f<8;f++)i.appendBit(!1);const l=r-i.getSizeInBytes();for(let f=0;f<l;++f)i.appendBits(f&1?17:236,8);if(i.getSize()!==s)throw new Fe("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(r,i,s,a,l,f){if(a>=s)throw new Fe("Block ID too large");const d=r%s,g=s-d,p=Math.floor(r/s),v=p+1,E=Math.floor(i/s),S=E+1,_=p-E,D=v-S;if(_!==D)throw new Fe("EC bytes mismatch");if(s!==g+d)throw new Fe("RS blocks mismatch");if(r!==(E+_)*g+(S+D)*d)throw new Fe("Total bytes mismatch");a<g?(l[0]=E,f[0]=_):(l[0]=S,f[0]=D)}static interleaveWithECBytes(r,i,s,a){if(r.getSizeInBytes()!==s)throw new Fe("Number of bits and data bytes does not match");let l=0,f=0,d=0;const g=new Array;for(let v=0;v<a;++v){const E=new Int32Array(1),S=new Int32Array(1);ze.getNumDataBytesAndNumECBytesForBlockID(i,s,a,v,E,S);const _=E[0],D=new Uint8Array(_);r.toBytes(8*l,D,0,_);const P=ze.generateECBytes(D,S[0]);g.push(new T3(D,P)),f=Math.max(f,_),d=Math.max(d,P.length),l+=E[0]}if(s!==l)throw new Fe("Data bytes does not match offset");const p=new B;for(let v=0;v<f;++v)for(const E of g){const S=E.getDataBytes();v<S.length&&p.appendBits(S[v],8)}for(let v=0;v<d;++v)for(const E of g){const S=E.getErrorCorrectionBytes();v<S.length&&p.appendBits(S[v],8)}if(i!==p.getSizeInBytes())throw new Fe("Interleaving error: "+i+" and "+p.getSizeInBytes()+" differ.");return p}static generateECBytes(r,i){const s=r.length,a=new Int32Array(s+i);for(let f=0;f<s;f++)a[f]=r[f]&255;new gu(Ne.QR_CODE_FIELD_256).encode(a,i);const l=new Uint8Array(i);for(let f=0;f<i;f++)l[f]=a[s+f];return l}static appendModeInfo(r,i){i.appendBits(r.getBits(),4)}static appendLengthInfo(r,i,s,a){const l=s.getCharacterCountBits(i);if(r>=1<<l)throw new Fe(r+" is bigger than "+((1<<l)-1));a.appendBits(r,l)}static appendBytes(r,i,s,a){switch(i){case fe.NUMERIC:ze.appendNumericBytes(r,s);break;case fe.ALPHANUMERIC:ze.appendAlphanumericBytes(r,s);break;case fe.BYTE:ze.append8BitBytes(r,s,a);break;case fe.KANJI:ze.appendKanjiBytes(r,s);break;default:throw new Fe("Invalid mode: "+i)}}static getDigit(r){return r.charCodeAt(0)-48}static isDigit(r){const i=ze.getDigit(r);return i>=0&&i<=9}static appendNumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=ze.getDigit(r.charAt(a));if(a+2<s){const f=ze.getDigit(r.charAt(a+1)),d=ze.getDigit(r.charAt(a+2));i.appendBits(l*100+f*10+d,10),a+=3}else if(a+1<s){const f=ze.getDigit(r.charAt(a+1));i.appendBits(l*10+f,7),a+=2}else i.appendBits(l,4),a++}}static appendAlphanumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=ze.getAlphanumericCode(r.charCodeAt(a));if(l===-1)throw new Fe;if(a+1<s){const f=ze.getAlphanumericCode(r.charCodeAt(a+1));if(f===-1)throw new Fe;i.appendBits(l*45+f,11),a+=2}else i.appendBits(l,6),a++}}static append8BitBytes(r,i,s){let a;try{a=ve.encode(r,s)}catch(l){throw new Fe(l)}for(let l=0,f=a.length;l!==f;l++){const d=a[l];i.appendBits(d,8)}}static appendKanjiBytes(r,i){let s;try{s=ve.encode(r,z.SJIS)}catch(l){throw new Fe(l)}const a=s.length;for(let l=0;l<a;l+=2){const f=s[l]&255,d=s[l+1]&255,g=f<<8&4294967295|d;let p=-1;if(g>=33088&&g<=40956?p=g-33088:g>=57408&&g<=60351&&(p=g-49472),p===-1)throw new Fe("Invalid byte sequence");const v=(p>>8)*192+(p&255);i.appendBits(v,13)}}static appendECI(r,i){i.appendBits(fe.ECI.getBits(),4),i.appendBits(r.getValue(),8)}}ze.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),ze.DEFAULT_BYTE_MODE_ENCODING=z.UTF8.getName();class di{write(r,i,s,a=null){if(r.length===0)throw new b("Found empty contents");if(i<0||s<0)throw new b("Requested dimensions are too small: "+i+"x"+s);let l=We.L,f=di.QUIET_ZONE_SIZE;a!==null&&(a.get(wt.ERROR_CORRECTION)!==void 0&&(l=We.fromString(a.get(wt.ERROR_CORRECTION).toString())),a.get(wt.MARGIN)!==void 0&&(f=Number.parseInt(a.get(wt.MARGIN).toString(),10)));const d=ze.encode(r,l,a);return this.renderResult(d,i,s,f)}writeToDom(r,i,s,a,l=null){typeof r=="string"&&(r=document.querySelector(r));const f=this.write(i,s,a,l);r&&r.appendChild(f)}renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Xr;const f=l.getWidth(),d=l.getHeight(),g=f+a*2,p=d+a*2,v=Math.max(i,g),E=Math.max(s,p),S=Math.min(Math.floor(v/g),Math.floor(E/p)),_=Math.floor((v-f*S)/2),D=Math.floor((E-d*S)/2),P=this.createSVGElement(v,E);for(let W=0,H=D;W<d;W++,H+=S)for(let q=0,J=_;q<f;q++,J+=S)if(l.get(q,W)===1){const Z=this.createSvgRectElement(J,H,S,S);P.appendChild(Z)}return P}createSVGElement(r,i){const s=document.createElementNS(di.SVG_NS,"svg");return s.setAttributeNS(null,"height",r.toString()),s.setAttributeNS(null,"width",i.toString()),s}createSvgRectElement(r,i,s,a){const l=document.createElementNS(di.SVG_NS,"rect");return l.setAttributeNS(null,"x",r.toString()),l.setAttributeNS(null,"y",i.toString()),l.setAttributeNS(null,"height",s.toString()),l.setAttributeNS(null,"width",a.toString()),l.setAttributeNS(null,"fill","#000000"),l}}di.QUIET_ZONE_SIZE=4,di.SVG_NS="http://www.w3.org/2000/svg";class $i{encode(r,i,s,a,l){if(r.length===0)throw new b("Found empty contents");if(i!==le.QR_CODE)throw new b("Can only encode QR_CODE, but got "+i);if(s<0||a<0)throw new b(`Requested dimensions are too small: ${s}x${a}`);let f=We.L,d=$i.QUIET_ZONE_SIZE;l!==null&&(l.get(wt.ERROR_CORRECTION)!==void 0&&(f=We.fromString(l.get(wt.ERROR_CORRECTION).toString())),l.get(wt.MARGIN)!==void 0&&(d=Number.parseInt(l.get(wt.MARGIN).toString(),10)));const g=ze.encode(r,f,l);return $i.renderResult(g,s,a,d)}static renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Xr;const f=l.getWidth(),d=l.getHeight(),g=f+a*2,p=d+a*2,v=Math.max(i,g),E=Math.max(s,p),S=Math.min(Math.floor(v/g),Math.floor(E/p)),_=Math.floor((v-f*S)/2),D=Math.floor((E-d*S)/2),P=new Te(v,E);for(let W=0,H=D;W<d;W++,H+=S)for(let q=0,J=_;q<f;q++,J+=S)l.get(q,W)===1&&P.setRegion(J,H,S,S);return P}}$i.QUIET_ZONE_SIZE=4;class R3{encode(r,i,s,a,l){let f;switch(i){case le.QR_CODE:f=new $i;break;default:throw new b("No encoder available for format "+i)}return f.encode(r,i,s,a,l)}}class Qr extends te{constructor(r,i,s,a,l,f,d,g){if(super(f,d),this.yuvData=r,this.dataWidth=i,this.dataHeight=s,this.left=a,this.top=l,a+f>i||l+d>s)throw new b("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(f,d)}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.yuvData,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.yuvData;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.yuvData,l,a,0,s),a;for(let f=0;f<i;f++){const d=f*r;M.arraycopy(this.yuvData,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new Qr(this.yuvData,this.dataWidth,this.dataHeight,this.left+r,this.top+i,s,a,!1)}renderThumbnail(){const r=this.getWidth()/Qr.THUMBNAIL_SCALE_FACTOR,i=this.getHeight()/Qr.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(r*i),a=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let f=0;f<i;f++){const d=f*r;for(let g=0;g<r;g++){const p=a[l+g*Qr.THUMBNAIL_SCALE_FACTOR]&255;s[d+g]=4278190080|p*65793}l+=this.dataWidth*Qr.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Qr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Qr.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(r,i){const s=this.yuvData;for(let a=0,l=this.top*this.dataWidth+this.left;a<i;a++,l+=this.dataWidth){const f=l+r/2;for(let d=l,g=l+r-1;d<f;d++,g--){const p=s[d];s[d]=s[g],s[g]=p}}}invert(){return new he(this)}}Qr.THUMBNAIL_SCALE_FACTOR=2;class pu extends te{constructor(r,i,s,a,l,f,d){if(super(i,s),this.dataWidth=a,this.dataHeight=l,this.left=f,this.top=d,r.BYTES_PER_ELEMENT===4){const g=i*s,p=new Uint8ClampedArray(g);for(let v=0;v<g;v++){const E=r[v],S=E>>16&255,_=E>>7&510,D=E&255;p[v]=(S+_+D)/4&255}this.luminances=p}else this.luminances=r;if(a===void 0&&(this.dataWidth=i),l===void 0&&(this.dataHeight=s),f===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+i>this.dataWidth||this.top+s>this.dataHeight)throw new b("Crop rectangle does not fit within image data.")}getRow(r,i){if(r<0||r>=this.getHeight())throw new b("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.luminances,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.luminances;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.luminances,l,a,0,s),a;for(let f=0;f<i;f++){const d=f*r;M.arraycopy(this.luminances,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new pu(this.luminances,s,a,this.dataWidth,this.dataHeight,this.left+r,this.top+i)}invert(){return new he(this)}}class oh extends z{static forName(r){return this.getCharacterSetECIByName(r)}}class mu{}mu.ISO_8859_1=z.ISO8859_1;class ah{isCompact(){return this.compact}setCompact(r){this.compact=r}getSize(){return this.size}setSize(r){this.size=r}getLayers(){return this.layers}setLayers(r){this.layers=r}getCodeWords(){return this.codeWords}setCodeWords(r){this.codeWords=r}getMatrix(){return this.matrix}setMatrix(r){this.matrix=r}}class lh{static singletonList(r){return[r]}static min(r,i){return r.sort(i)[0]}}class _3{constructor(r){this.previous=r}getPrevious(){return this.previous}}class zi extends _3{constructor(r,i,s){super(r),this.value=i,this.bitCount=s}appendTo(r,i){r.appendBits(this.value,this.bitCount)}add(r,i){return new zi(this,r,i)}addBinaryShift(r,i){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new zi(this,r,i)}toString(){let r=this.value&(1<<this.bitCount)-1;return r|=1<<this.bitCount,"<"+O.toBinaryString(r|1<<this.bitCount).substring(1)+">"}}class xu extends zi{constructor(r,i,s){super(r,0,0),this.binaryShiftStart=i,this.binaryShiftByteCount=s}appendTo(r,i){for(let s=0;s<this.binaryShiftByteCount;s++)(s===0||s===31&&this.binaryShiftByteCount<=62)&&(r.appendBits(31,5),this.binaryShiftByteCount>62?r.appendBits(this.binaryShiftByteCount-31,16):s===0?r.appendBits(Math.min(this.binaryShiftByteCount,31),5):r.appendBits(this.binaryShiftByteCount-31,5)),r.appendBits(i[this.binaryShiftStart+s],8)}addBinaryShift(r,i){return new xu(this,r,i)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function O3(y,r,i){return new xu(y,r,i)}function Xs(y,r,i){return new zi(y,r,i)}const N3=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Pn=0,Ta=1,Sr=2,ch=3,qr=4,k3=new zi(null,0,0),wu=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function M3(y){for(let r of y)I.fill(r,-1);return y[Pn][qr]=0,y[Ta][qr]=0,y[Ta][Pn]=28,y[ch][qr]=0,y[Sr][qr]=0,y[Sr][Pn]=15,y}const uh=M3(I.createInt32Array(6,6));class Jr{constructor(r,i,s,a){this.token=r,this.mode=i,this.binaryShiftByteCount=s,this.bitCount=a}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(r,i){let s=this.bitCount,a=this.token;if(r!==this.mode){let f=wu[this.mode][r];a=Xs(a,f&65535,f>>16),s+=f>>16}let l=r===Sr?4:5;return a=Xs(a,i,l),new Jr(a,r,0,s+l)}shiftAndAppend(r,i){let s=this.token,a=this.mode===Sr?4:5;return s=Xs(s,uh[this.mode][r],a),s=Xs(s,i,5),new Jr(s,this.mode,0,this.bitCount+a+5)}addBinaryShiftChar(r){let i=this.token,s=this.mode,a=this.bitCount;if(this.mode===qr||this.mode===Sr){let d=wu[s][Pn];i=Xs(i,d&65535,d>>16),a+=d>>16,s=Pn}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,f=new Jr(i,s,this.binaryShiftByteCount+1,a+l);return f.binaryShiftByteCount===2078&&(f=f.endBinaryShift(r+1)),f}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let i=this.token;return i=O3(i,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Jr(i,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let i=this.bitCount+(wu[this.mode][r.mode]>>16);return this.binaryShiftByteCount<r.binaryShiftByteCount?i+=Jr.calculateBinaryShiftCost(r)-Jr.calculateBinaryShiftCost(this):this.binaryShiftByteCount>r.binaryShiftByteCount&&r.binaryShiftByteCount>0&&(i+=10),i<=r.bitCount}toBitArray(r){let i=[];for(let a=this.endBinaryShift(r.length).token;a!==null;a=a.getPrevious())i.unshift(a);let s=new B;for(const a of i)a.appendTo(s,r);return s}toString(){return ie.format("%s bits=%d bytes=%d",N3[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Jr.INITIAL_STATE=new Jr(k3,Pn,0,0);function D3(y){const r=ie.getCharCode(" "),i=ie.getCharCode("."),s=ie.getCharCode(",");y[Pn][r]=1;const a=ie.getCharCode("Z"),l=ie.getCharCode("A");for(let S=l;S<=a;S++)y[Pn][S]=S-l+2;y[Ta][r]=1;const f=ie.getCharCode("z"),d=ie.getCharCode("a");for(let S=d;S<=f;S++)y[Ta][S]=S-d+2;y[Sr][r]=1;const g=ie.getCharCode("9"),p=ie.getCharCode("0");for(let S=p;S<=g;S++)y[Sr][S]=S-p+2;y[Sr][s]=12,y[Sr][i]=13;const v=["\0"," ","","","","","","","\x07","\b"," ",`
479
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<v.length;S++)y[ch][ie.getCharCode(v[S])]=S;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<E.length;S++)ie.getCharCode(E[S])>0&&(y[qr][ie.getCharCode(E[S])]=S);return y}const vu=D3(I.createInt32Array(5,256));class Ys{constructor(r){this.text=r}encode(){const r=ie.getCharCode(" "),i=ie.getCharCode(`
480
+ `);let s=lh.singletonList(Jr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let f,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case ie.getCharCode("\r"):f=d===i?2:0;break;case ie.getCharCode("."):f=d===r?3:0;break;case ie.getCharCode(","):f=d===r?4:0;break;case ie.getCharCode(":"):f=d===r?5:0;break;default:f=0}f>0?(s=Ys.updateStateListForPair(s,l,f),l++):s=this.updateStateListForChar(s,l)}return lh.min(s,(l,f)=>l.getBitCount()-f.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Ys.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=vu[r.getMode()][a]>0,f=null;for(let d=0;d<=qr;d++){let g=vu[d][a];if(g>0){if(f==null&&(f=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=f.latchAndAppend(d,g);s.push(p)}if(!l&&uh[r.getMode()][d]>=0){const p=f.shiftAndAppend(d,g);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||vu[r.getMode()][a]===0){let d=r.addBinaryShiftChar(i);s.push(d)}}static updateStateListForPair(r,i,s){const a=[];for(let l of r)this.updateStateForPair(l,i,s,a);return this.simplifyStates(a)}static updateStateForPair(r,i,s,a){let l=r.endBinaryShift(i);if(a.push(l.latchAndAppend(qr,s)),r.getMode()!==qr&&a.push(l.shiftAndAppend(qr,s)),s===3||s===4){let f=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(f)}if(r.getBinaryShiftByteCount()>0){let f=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(f)}}static simplifyStates(r){let i=[];for(const s of r){let a=!0;for(const l of i){if(l.isBetterThanOrEqualTo(s)){a=!1;break}s.isBetterThanOrEqualTo(l)&&(i=i.filter(f=>f!==l))}a&&i.push(s)}return i}}class _e{constructor(){}static encodeBytes(r){return _e.encode(r,_e.DEFAULT_EC_PERCENT,_e.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Ys(r).encode(),l=O.truncDivision(a.getSize()*i,100)+11,f=a.getSize()+l,d,g,p,v,E;if(s!==_e.DEFAULT_AZTEC_LAYERS){if(d=s<0,g=Math.abs(s),g>(d?_e.MAX_NB_BITS_COMPACT:_e.MAX_NB_BITS))throw new b(ie.format("Illegal value %s for layers",s));p=_e.totalBitsInLayer(g,d),v=_e.WORD_SIZE[g];let Z=p-p%v;if(E=_e.stuffBits(a,v),E.getSize()+l>Z)throw new b("Data to large for user specified layer");if(d&&E.getSize()>v*64)throw new b("Data to large for user specified layer")}else{v=0,E=null;for(let Z=0;;Z++){if(Z>_e.MAX_NB_BITS)throw new b("Data too large for an Aztec code");if(d=Z<=3,g=d?Z+1:Z,p=_e.totalBitsInLayer(g,d),f>p)continue;(E==null||v!==_e.WORD_SIZE[g])&&(v=_e.WORD_SIZE[g],E=_e.stuffBits(a,v));let Ae=p-p%v;if(!(d&&E.getSize()>v*64)&&E.getSize()+l<=Ae)break}}let S=_e.generateCheckWords(E,p,v),_=E.getSize()/v,D=_e.generateModeMessage(d,g,_),P=(d?11:14)+g*4,W=new Int32Array(P),H;if(d){H=P;for(let Z=0;Z<W.length;Z++)W[Z]=Z}else{H=P+1+2*O.truncDivision(O.truncDivision(P,2)-1,15);let Z=O.truncDivision(P,2),Ae=O.truncDivision(H,2);for(let we=0;we<Z;we++){let tr=we+O.truncDivision(we,15);W[Z-we-1]=Ae-tr-1,W[Z+we]=Ae+tr+1}}let q=new Te(H);for(let Z=0,Ae=0;Z<g;Z++){let we=(g-Z)*4+(d?9:12);for(let tr=0;tr<we;tr++){let Dr=tr*2;for(let rr=0;rr<2;rr++)S.get(Ae+Dr+rr)&&q.set(W[Z*2+rr],W[Z*2+tr]),S.get(Ae+we*2+Dr+rr)&&q.set(W[Z*2+tr],W[P-1-Z*2-rr]),S.get(Ae+we*4+Dr+rr)&&q.set(W[P-1-Z*2-rr],W[P-1-Z*2-tr]),S.get(Ae+we*6+Dr+rr)&&q.set(W[P-1-Z*2-tr],W[Z*2+rr])}Ae+=we*8}if(_e.drawModeMessage(q,d,H,D),d)_e.drawBullsEye(q,O.truncDivision(H,2),5);else{_e.drawBullsEye(q,O.truncDivision(H,2),7);for(let Z=0,Ae=0;Z<O.truncDivision(P,2)-1;Z+=15,Ae+=16)for(let we=O.truncDivision(H,2)&1;we<H;we+=2)q.set(O.truncDivision(H,2)-Ae,we),q.set(O.truncDivision(H,2)+Ae,we),q.set(we,O.truncDivision(H,2)-Ae),q.set(we,O.truncDivision(H,2)+Ae)}let J=new ah;return J.setCompact(d),J.setSize(H),J.setLayers(g),J.setCodeWords(_),J.setMatrix(q),J}static drawBullsEye(r,i,s){for(let a=0;a<s;a+=2)for(let l=i-a;l<=i+a;l++)r.set(l,i-a),r.set(l,i+a),r.set(i-a,l),r.set(i+a,l);r.set(i-s,i-s),r.set(i-s+1,i-s),r.set(i-s,i-s+1),r.set(i+s,i-s),r.set(i+s,i-s+1),r.set(i+s,i+s-1)}static generateModeMessage(r,i,s){let a=new B;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=_e.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=_e.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=O.truncDivision(s,2);if(i)for(let f=0;f<7;f++){let d=l-3+f;a.get(f)&&r.set(d,l-5),a.get(f+7)&&r.set(l+5,d),a.get(20-f)&&r.set(d,l+5),a.get(27-f)&&r.set(l-5,d)}else for(let f=0;f<10;f++){let d=l-5+f+O.truncDivision(f,5);a.get(f)&&r.set(d,l-7),a.get(f+10)&&r.set(l+7,d),a.get(29-f)&&r.set(d,l+7),a.get(39-f)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new gu(_e.getGF(s)),f=O.truncDivision(i,s),d=_e.bitsToWords(r,s,f);l.encode(d,f-a);let g=i%s,p=new B;p.appendBits(0,g);for(const v of Array.from(d))p.appendBits(v,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,f;for(l=0,f=r.getSize()/i;l<f;l++){let d=0;for(let g=0;g<i;g++)d|=r.get(l*i+g)?1<<i-g-1:0;a[l]=d}return a}static getGF(r){switch(r){case 4:return Ne.AZTEC_PARAM;case 6:return Ne.AZTEC_DATA_6;case 8:return Ne.AZTEC_DATA_8;case 10:return Ne.AZTEC_DATA_10;case 12:return Ne.AZTEC_DATA_12;default:throw new b("Unsupported word size "+r)}}static stuffBits(r,i){let s=new B,a=r.getSize(),l=(1<<i)-2;for(let f=0;f<a;f+=i){let d=0;for(let g=0;g<i;g++)(f+g>=a||r.get(f+g))&&(d|=1<<i-1-g);(d&l)===l?(s.appendBits(d&l,i),f--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),f--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}_e.DEFAULT_EC_PERCENT=33,_e.DEFAULT_AZTEC_LAYERS=0,_e.MAX_NB_BITS=32,_e.MAX_NB_BITS_COMPACT=4,_e.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Ra{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let f=mu.ISO_8859_1,d=_e.DEFAULT_EC_PERCENT,g=_e.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(wt.CHARACTER_SET)&&(f=oh.forName(l.get(wt.CHARACTER_SET).toString())),l.has(wt.ERROR_CORRECTION)&&(d=O.parseInt(l.get(wt.ERROR_CORRECTION).toString())),l.has(wt.AZTEC_LAYERS)&&(g=O.parseInt(l.get(wt.AZTEC_LAYERS).toString()))),Ra.encodeLayers(r,i,s,a,f,d,g)}static encodeLayers(r,i,s,a,l,f,d){if(i!==le.AZTEC)throw new b("Can only encode AZTEC, but got "+i);let g=_e.encode(ie.getBytes(r,l),f,d);return Ra.renderResult(g,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Xr;let l=a.getWidth(),f=a.getHeight(),d=Math.max(i,l),g=Math.max(s,f),p=Math.min(d/l,g/f),v=(d-l*p)/2,E=(g-f*p)/2,S=new Te(d,g);for(let _=0,D=E;_<f;_++,D+=p)for(let P=0,W=v;P<l;P++,W+=p)a.get(P,_)&&S.setRegion(W,D,p,p);return S}}n.AbstractExpandedDecoder=iu,n.ArgumentException=C,n.ArithmeticException=ma,n.AztecCode=ah,n.AztecCodeReader=va,n.AztecCodeWriter=Ra,n.AztecDecoder=je,n.AztecDetector=X0,n.AztecDetectorResult=H0,n.AztecEncoder=_e,n.AztecHighLevelEncoder=Ys,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=A,n.BitArray=B,n.BitMatrix=Te,n.BitSource=lu,n.BrowserAztecCodeReader=o3,n.BrowserBarcodeReader=f3,n.BrowserCodeReader=Er,n.BrowserDatamatrixCodeReader=h3,n.BrowserMultiFormatReader=A3,n.BrowserPDF417Reader=S3,n.BrowserQRCodeReader=I3,n.BrowserQRCodeSvgWriter=di,n.CharacterSetECI=z,n.ChecksumException=T,n.Code128Reader=ee,n.Code39Reader=mt,n.DataMatrixDecodedBitStreamParser=Nn,n.DataMatrixReader=kn,n.DecodeHintType=U,n.DecoderResult=Bs,n.DefaultGridSampler=G0,n.DetectorResult=wa,n.EAN13Reader=ai,n.EncodeHintType=wt,n.Exception=m,n.FormatException=F,n.GenericGF=Ne,n.GenericGFPoly=Qt,n.GlobalHistogramBinarizer=rt,n.GridSampler=eu,n.GridSamplerInstance=_n,n.HTMLCanvasElementLuminanceSource=me,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=b,n.IllegalStateException=Xr,n.InvertedLuminanceSource=he,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ji,n.MultiFormatReader=sh,n.MultiFormatWriter=R3,n.NotFoundException=G,n.OneDReader=ht,n.PDF417DecodedBitStreamParser=V,n.PDF417DecoderErrorCorrection=J0,n.PDF417Reader=Nt,n.PDF417ResultMetadata=th,n.PerspectiveTransform=kr,n.PlanarYUVLuminanceSource=Qr,n.QRCodeByteMatrix=Ia,n.QRCodeDataMask=br,n.QRCodeDecodedBitStreamParser=Qe,n.QRCodeDecoderErrorCorrectionLevel=We,n.QRCodeDecoderFormatInformation=Ut,n.QRCodeEncoder=ze,n.QRCodeEncoderQRCode=fi,n.QRCodeMaskUtil=st,n.QRCodeMatrixUtil=de,n.QRCodeMode=fe,n.QRCodeReader=Mn,n.QRCodeVersion=ue,n.QRCodeWriter=$i,n.RGBLuminanceSource=pu,n.RSS14Reader=it,n.RSSExpandedReader=K,n.ReaderException=Sa,n.ReedSolomonDecoder=Us,n.ReedSolomonEncoder=gu,n.ReedSolomonException=Li,n.Result=Ze,n.ResultMetadataType=bt,n.ResultPoint=ae,n.StringUtils=ie,n.UnsupportedOperationException=oe,n.VideoInputDevice=Ge,n.WhiteRectangleDetector=un,n.WriterException=Fe,n.ZXingArrays=I,n.ZXingCharset=oh,n.ZXingInteger=O,n.ZXingStandardCharsets=mu,n.ZXingStringBuilder=pe,n.ZXingStringEncoding=ve,n.ZXingSystem=M,n.createAbstractExpandedDecoder=Q0,Object.defineProperty(n,"__esModule",{value:!0})})})(K1,K1.exports);var qe=K1.exports;const YR=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var c2=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,qe.BarcodeFormat.QR_CODE],[re.AZTEC,qe.BarcodeFormat.AZTEC],[re.CODABAR,qe.BarcodeFormat.CODABAR],[re.CODE_39,qe.BarcodeFormat.CODE_39],[re.CODE_93,qe.BarcodeFormat.CODE_93],[re.CODE_128,qe.BarcodeFormat.CODE_128],[re.DATA_MATRIX,qe.BarcodeFormat.DATA_MATRIX],[re.MAXICODE,qe.BarcodeFormat.MAXICODE],[re.ITF,qe.BarcodeFormat.ITF],[re.EAN_13,qe.BarcodeFormat.EAN_13],[re.EAN_8,qe.BarcodeFormat.EAN_8],[re.PDF_417,qe.BarcodeFormat.PDF_417],[re.RSS_14,qe.BarcodeFormat.RSS_14],[re.RSS_EXPANDED,qe.BarcodeFormat.RSS_EXPANDED],[re.UPC_A,qe.BarcodeFormat.UPC_A],[re.UPC_E,qe.BarcodeFormat.UPC_E],[re.UPC_EAN_EXTENSION,qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!YR)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),u=new Map;u.set(qe.DecodeHintType.POSSIBLE_FORMATS,c),u.set(qe.DecodeHintType.TRY_HARDER,!1),this.hints=u}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(u){c(u)}})},e.prototype.decode=function(t){var n=new qe.MultiFormatReader(this.verbose,this.hints),o=new qe.HTMLCanvasElementLuminanceSource(t),c=new qe.BinaryBitmap(new qe.HybridBinarizer(o)),u=n.decode(c);return{text:u.text,format:Qv.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createZXingFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var u=c[o];this.formatMap.has(u)?n.push(this.formatMap.get(u)):this.logger.logError("".concat(u," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),KR=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(h){h(u)})}return new(n||(n=Promise))(function(u,h){function x(C){try{m(o.next(C))}catch(b){h(b)}}function w(C){try{m(o.throw(C))}catch(b){h(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},ZR=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,h;return h={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},u2=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,"qr_code"],[re.AZTEC,"aztec"],[re.CODABAR,"codabar"],[re.CODE_39,"code_39"],[re.CODE_93,"code_93"],[re.CODE_128,"code_128"],[re.DATA_MATRIX,"data_matrix"],[re.ITF,"itf"],[re.EAN_13,"ean_13"],[re.EAN_8,"ean_8"],[re.PDF_417,"pdf417"],[re.UPC_A,"upc_a"],[re.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=o;var c=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(c),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var t=new BarcodeDetector({formats:["qr_code"]});return typeof t<"u"},e.prototype.decodeAsync=function(t){return KR(this,void 0,void 0,function(){var n,o;return ZR(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(n=c.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return o=this.selectLargestBarcode(n),[2,{text:o.rawValue,format:Qv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,u=t;c<u.length;c++){var h=u[c],x=h.boundingBox.width*h.boundingBox.height;x>o&&(o=x,n=h)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var u=c[o];this.formatMap.has(u)?n.push(this.formatMap.get(u)):this.logger.warn("".concat(u," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),f2=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(h){h(u)})}return new(n||(n=Promise))(function(u,h){function x(C){try{m(o.next(C))}catch(b){h(b)}}function w(C){try{m(o.throw(C))}catch(b){h(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},d2=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,h;return h={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},QR=function(){function e(t,n,o,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=o,n&&u2.isSupported()?(this.primaryDecoder=new u2(t,o,c),this.secondaryDecoder=new c2(t,o,c)):this.primaryDecoder=new c2(t,o,c)}return e.prototype.decodeAsync=function(t){return f2(this,void 0,void 0,function(){var n;return d2(this,function(o){switch(o.label){case 0:n=performance.now(),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,o.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return f2(this,void 0,void 0,function(){var n,o;return d2(this,function(c){switch(c.label){case 0:n=performance.now(),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,c.sent()];case 3:if(o=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw o;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(t){if(this.verbose){var n=performance.now()-t;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,n=0,o=this.executionResults;n<o.length;n++){var c=o[n];t+=c}var u=t/this.executionResults.length;console.log("".concat(u," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),z0=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(o[u]=c[u])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),hc=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(h){h(u)})}return new(n||(n=Promise))(function(u,h){function x(C){try{m(o.next(C))}catch(b){h(b)}}function w(C){try{m(o.throw(C))}catch(b){h(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},gc=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,h;return h={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Jv=function(){function e(t,n){this.name=t,this.track=n}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var n={};n[this.name]=t;var o={advanced:[n]};return this.track.applyConstraints(o)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var n=t[this.name];return n}return null},e}(),qR=function(e){z0(t,e);function t(n,o){return e.call(this,n,o)||this}return t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(n){var o={};o[this.name]=n;var c={advanced:[o]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),o=n[this.name];return{min:o.min,max:o.max,step:o.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Jv),JR=function(e){z0(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}(qR),e_=function(e){z0(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(Jv),t_=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new JR(this.track)},e.prototype.torchFeature=function(){return new e_(this.track)},e}(),r_=function(){function e(t,n,o){this.isClosed=!1,this.parentElement=t,this.mediaStream=n,this.callbacks=o,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width="".concat(t,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var o=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(o,c),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,o,c){return hc(this,void 0,void 0,function(){var u,h;return gc(this,function(x){switch(x.label){case 0:return u=new e(t,n,c),o.aspectRatio?(h={aspectRatio:o.aspectRatio},[4,u.getFirstTrackOrFail().applyConstraints(h)]):[3,2];case 1:x.sent(),x.label=2;case 2:return u.setupSurface(),[2,u]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(t){this.failIfClosed();var n=this,o=function(){setTimeout(t,200),n.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(t){return hc(this,void 0,void 0,function(){return gc(this,function(n){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(n,o){var c=t.mediaStream.getVideoTracks(),u=c.length,h=0;t.mediaStream.getVideoTracks().forEach(function(x){t.mediaStream.removeTrack(x),x.stop(),++h,h>=u&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new t_(this.getFirstTrackOrFail())},e}(),n_=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return hc(this,void 0,void 0,function(){return gc(this,function(c){return[2,r_.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return hc(this,void 0,void 0,function(){var n,o;return gc(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return o=c.sent(),[2,new e(o)]}})})},e}(),h2=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(h){h(u)})}return new(n||(n=Promise))(function(u,h){function x(C){try{m(o.next(C))}catch(b){h(b)}}function w(C){try{m(o.throw(C))}catch(b){h(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},g2=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,h;return h={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},i_=function(){function e(){}return e.failIfNotSupported=function(){return h2(this,void 0,void 0,function(){return g2(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return h2(this,void 0,void 0,function(){return g2(this,function(n){return[2,n_.create(t)]})})},e}(),s_=function(e,t,n,o){function c(u){return u instanceof n?u:new n(function(h){h(u)})}return new(n||(n=Promise))(function(u,h){function x(C){try{m(o.next(C))}catch(b){h(b)}}function w(C){try{m(o.throw(C))}catch(b){h(b)}}function m(C){C.done?u(C.value):c(C.value).then(x,w)}m((o=o.apply(e,t||[])).next())})},o_=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,c,u,h;return h={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function x(m){return function(C){return w([m,C])}}function w(m){if(o)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(n=0)),n;)try{if(o=1,c&&(u=m[0]&2?c.return:m[0]?c.throw||((u=c.return)&&u.call(c),0):c.next)&&!(u=u.call(c,m[1])).done)return u;switch(c=0,u&&(m=[m[0]&2,u.value]),m[0]){case 0:case 1:u=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,c=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!u||m[1]>u[0]&&m[1]<u[3])){n.label=m[1];break}if(m[0]===6&&n.label<u[1]){n.label=u[1],u=m;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(m);break}u[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(e,n)}catch(C){m=[6,C],c=0}finally{o=u=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},a_=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=us.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=us.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var t=location.host.split(":")[0];return t==="127.0.0.1"||t==="localhost"},e.getCamerasFromMediaDevices=function(){return s_(this,void 0,void 0,function(){var t,n,o,c,u,h,x;return o_(this,function(w){switch(w.label){case 0:return t=function(m){for(var C=m.getVideoTracks(),b=0,A=C;b<A.length;b++){var T=A[b];T.enabled=!1,T.stop(),m.removeTrack(T)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=w.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=w.sent(),c=[],u=0,h=o;u<h.length;u++)x=h[u],x.kind==="videoinput"&&c.push({id:x.deviceId,label:x.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(u){for(var h=[],x=0,w=u;x<w.length;x++){var m=w[x];m.kind==="video"&&h.push({id:m.id,label:m.label})}t(h)},c=MediaStreamTrack;c.getSources(o)})},e}(),ot;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(ot||(ot={}));var l_=function(){function e(){this.state=ot.NOT_STARTED,this.onGoingTransactionNewState=ot.UNKNOWN}return e.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},e.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=ot.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=ot.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==ot.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case ot.UNKNOWN:throw"Transition from unknown is not allowed";case ot.NOT_STARTED:this.failIfNewStateIs(t,[ot.PAUSED]);break;case ot.SCANNING:break;case ot.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var u=c[o];if(t===u)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),c_=function(){function e(t){this.stateManager=t}return e.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},e.prototype.directTransition=function(t){this.stateManager.directTransition(t)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===ot.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==ot.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===ot.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===ot.PAUSED},e}(),u_=function(){function e(){}return e.create=function(){return new c_(new l_)},e}(),f_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(o[u]=c[u])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),dr=function(e){f_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(HR),d_=function(){function e(t,n){this.logger=n,this.fps=dr.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=t.disableFlip===!0,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=dr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?qv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!fn(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),rO=function(){function e(t,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");this.elementId=t,this.verbose=!1;var o;typeof n=="boolean"?this.verbose=n===!0:n&&(o=n,this.verbose=o.verbose===!0,o.experimentalFeatures),this.logger=new XR(this.verbose),this.qrcode=new QR(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=u_.create()}return e.prototype.start=function(t,n,o,c){var u=this;if(!t)throw"cameraIdOrConfig is required";if(!o||typeof o!="function")throw"qrCodeSuccessCallback is required and should be a function.";var h;c?h=c:h=this.verbose?this.logger.log:function(){};var x=d_.create(n,this.logger);this.clearElement();var w=!1;x.videoConstraints&&(x.isMediaStreamConstraintsValid()?w=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var m=w,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:dr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var b=this,A=this.stateManagerProxy.startTransition(ot.SCANNING);return new Promise(function(T,k){var M=m?x.videoConstraints:b.createVideoConstraints(t);if(!M){A.cancel(),k("videoConstraints should be defined");return}var X={};(!m||x.aspectRatio)&&(X.aspectRatio=x.aspectRatio);var N={onRenderSurfaceReady:function(I,O){b.setupUi(I,O,x),b.isScanning=!0,b.foreverScan(x,o,h)}};i_.failIfNotSupported().then(function(I){I.create(M).then(function(O){return O.render(u.element,X,N).then(function(B){b.renderedCamera=B,A.execute(),T(null)}).catch(function(B){A.cancel(),k(B)})}).catch(function(O){A.cancel(),k(us.errorGettingUserMedia(O))})}).catch(function(I){A.cancel(),k(us.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(ot.PAUSED),this.showPausedState(),(fn(t)||t!==!0)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,n=function(){t.stateManagerProxy.directTransition(ot.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(ot.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var u=document.getElementById(dr.SHADED_REGION_ELEMENT_ID);u&&t.element.removeChild(u)}},c=this;return this.renderedCamera.close().then(function(){return c.renderedCamera=null,c.element&&(c.element.removeChild(c.canvasElement),c.canvasElement=null),o(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),n.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(fn(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,u){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var h=new Image;h.onload=function(){var x=h.width,w=h.height,m=document.getElementById(o.elementId),C=m.clientWidth?m.clientWidth:dr.DEFAULT_WIDTH,b=Math.max(m.clientHeight?m.clientHeight:w,dr.FILE_SCAN_MIN_HEIGHT),A=o.computeCanvasDrawConfig(x,w,C,b);if(n){var T=o.createCanvasElement(C,b,"qr-canvas-visible");T.style.display="inline-block",m.appendChild(T);var k=T.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=b,k.drawImage(h,0,0,x,w,A.x,A.y,A.width,A.height)}var M=dr.FILE_SCAN_HIDDEN_CANVAS_PADDING,X=Math.max(h.width,A.width),N=Math.max(h.height,A.height),I=X+2*M,O=N+2*M,B=o.createCanvasElement(I,O);m.appendChild(B);var j=B.getContext("2d");if(!j)throw"Unable to get 2d context from canvas";j.canvas.width=I,j.canvas.height=O,j.drawImage(h,0,0,x,w,M,M,X,N);try{o.qrcode.decodeRobustlyAsync(B).then(function(U){c(l2.createFromQrcodeResult(U))}).catch(u)}catch(U){u("QR code parse error, error = ".concat(U))}},h.onerror=u,h.onabort=u,h.onstalled=u,h.onsuspend=u,h.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return a_.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(t){if(t){if(!qv.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(t){var n=[re.QR_CODE,re.AZTEC,re.CODABAR,re.CODE_39,re.CODE_93,re.CODE_128,re.DATA_MATRIX,re.MAXICODE,re.ITF,re.EAN_13,re.EAN_8,re.PDF_417,re.RSS_14,re.RSS_EXPANDED,re.UPC_A,re.UPC_E,re.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return n;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(t.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var o=[],c=0,u=t.formatsToSupport;c<u.length;c++){var h=u[c];VR(h)?o.push(h):this.logger.warn("Invalid format: ".concat(h," passed in config, ignoring."))}if(o.length===0)throw"None of formatsToSupport match supported values.";return o},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(fn(t))return!0;if(!fn(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(fn(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return fn(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,u=o.qrbox;this.validateQrboxConfig(u);var h=this.toQrdimensions(t,n,u),x=function(m){if(m<dr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(dr.MIN_QR_BOX_SIZE,"px.")},w=function(m){return m>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),m=t),m};x(h.width),x(h.height),h.width=w(h.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var c=fn(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var u=this.toQrdimensions(t,n,c);u.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var h=o.isShadedBoxEnabled()&&u.height<=n,x={x:0,y:0,width:t,height:n},w=h?this.getShadedRegionBounds(t,n,u):x,m=this.createCanvasElement(w.width,w.height),C={willReadFrequently:!0},b=m.getContext("2d",C);b.canvas.width=w.width,b.canvas.height=w.height,this.element.append(m),h&&this.possiblyInsertShadingElement(this.element,t,n,u),this.createScannerPausedUiElement(this.element),this.qrRegion=w,this.context=b,this.canvasElement=m},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=us.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,l2.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var u=us.codeParseError(c);return n(u,GR.createFrom(u)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var u=this.renderedCamera.getSurface(),h=u.videoWidth/u.clientWidth,x=u.videoHeight/u.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var w=this.qrRegion.width*h,m=this.qrRegion.height*x,C=this.qrRegion.x*h,b=this.qrRegion.y*x;this.context.drawImage(u,C,b,w,m,0,0,this.qrRegion.width,this.qrRegion.height);var A=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(T){!T&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){A()})):A()}).catch(function(T){c.logger.logError("Error happend while scanning context",T),A()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",c={user:!0,environment:!0},u="exact",h=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},x=Object.keys(t);if(x.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(x.length," keys");var w=Object.keys(t)[0];if(w!==n&&w!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(w===n){var m=t.facingMode;if(typeof m=="string"){if(h(m))return{facingMode:m}}else if(typeof m=="object")if(u in m){if(h(m["".concat(u)]))return{facingMode:{exact:m["".concat(u)]}}}else throw"'facingMode' should be string or object with"+" ".concat(u," as key.");else{var C=typeof m;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var b=t.deviceId;if(typeof b=="string")return{deviceId:b};if(typeof b=="object"){if(u in b)return{deviceId:{exact:b["".concat(u)]}};throw"'deviceId' should be string or object with"+" ".concat(u," as key.")}else{var A=typeof b;throw"Invalid type of 'deviceId' = ".concat(A)}}}var T=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(T)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var u=(o-t)/2,h=(c-n)/2;return{x:u,y:h,width:t,height:n}}else{var x=t,w=n;return t>o&&(n=o/t*n,t=o),n>c&&(t=c/n*t,n=c),this.logger.log("Image downsampled from "+"".concat(x,"X").concat(w)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,o,c)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?dr.BORDER_SHADER_MATCH_COLOR:dr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var c=t,u=n,h=document.createElement("canvas");return h.style.width="".concat(c,"px"),h.style.height="".concat(u,"px"),h.style.display="none",h.id=fn(o)?"qr-canvas":o,h},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,c){if(!(n-c.width<1||o-c.height<1)){var u=document.createElement("div");u.style.position="absolute";var h=(n-c.width)/2,x=(o-c.height)/2;if(u.style.borderLeft="".concat(h,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderRight="".concat(h,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderTop="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),u.style.borderBottom="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),u.style.boxSizing="border-box",u.style.top="0px",u.style.bottom="0px",u.style.left="0px",u.style.right="0px",u.id="".concat(dr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var w=5,m=40;this.insertShaderBorders(u,m,w,-w,null,0,!0),this.insertShaderBorders(u,m,w,-w,null,0,!1),this.insertShaderBorders(u,m,w,null,-w,0,!0),this.insertShaderBorders(u,m,w,null,-w,0,!1),this.insertShaderBorders(u,w,m+w,-w,null,-w,!0),this.insertShaderBorders(u,w,m+w,null,-w,-w,!0),this.insertShaderBorders(u,w,m+w,-w,null,-w,!1),this.insertShaderBorders(u,w,m+w,null,-w,-w,!1),this.hasBorderShaders=!0}t.append(u)}},e.prototype.insertShaderBorders=function(t,n,o,c,u,h,x){var w=document.createElement("div");w.style.position="absolute",w.style.backgroundColor=dr.BORDER_SHADER_DEFAULT_COLOR,w.style.width="".concat(n,"px"),w.style.height="".concat(o,"px"),c!==null&&(w.style.top="".concat(c,"px")),u!==null&&(w.style.bottom="".concat(u,"px")),x?w.style.left="".concat(h,"px"):w.style.right="".concat(h,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(w),t.appendChild(w)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),p2;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(p2||(p2={}));var Z1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(Z1||(Z1={}));var Q1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(Q1||(Q1={}));var q1;(function(e){e[e.ALL=17]="ALL"})(q1||(q1={}));const h_=Object.assign(Object.assign({},re),q1);var m2;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(m2||(m2={}));const g_=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function p_(e){const t="custom-style-os-cap-barcode";let n=document.getElementById(t);if(n||(n=document.createElement("style"),n.type="text/css",n.id=t,document.head.appendChild(n)),n.sheet){for(;n.sheet.cssRules.length;)n.sheet.deleteRule(0);for(const{selector:o,css:c}of e)n.sheet.insertRule(`${o} { ${c} }`)}else{n.textContent="";for(const{selector:o,css:c}of e)n.textContent+=`${o} { ${c} }`}}const m_=pa("CapacitorBarcodeScanner",{web:()=>(p_(g_),Br(()=>import("./web-Q9VPRftY.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class x_{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||Z1.BACK,t.scanOrientation=t.scanOrientation||Q1.ADAPTIVE,m_.scanBarcode(t)}}const Mf=pa("SecureStoragePlugin",{web:()=>Br(()=>import("./web-BMqaP0jw.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function w_(e){try{if(e.length>2048)throw new Error;if(!e.startsWith("{")){const c=new URL(e);if(!["http:","https:"].includes(c.protocol)||c.username||c.password||c.pathname!=="/pair"||c.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(c.hash))throw new Error;const u=ln.parse(c.origin);if(!u)throw new Error;return{endpoint:u,grant:c.hash.slice(6)}}const t=JSON.parse(e);if(t.type!=="agentroam-pair"||t.version!==1||typeof t.server!="string"||typeof t.grant!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t.grant))throw new Error;const n=new URL(t.server);if(n.username||n.password||n.search||n.hash||n.pathname!=="/")throw new Error;const o=ln.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class e3{ready(){if(!Ns.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await Mf.get({key:`agentroam-device:${t}`})).value}catch(n){if(String(n).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,n){this.ready(),await Mf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await Mf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function t3(){if(!Ns.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await x_.scanBarcode({hint:h_.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class r3{constructor(t,n=(...c)=>fetch(...c),o=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=n,this.onRevoked=o,this.session=null,this.fetch=async(c,u={})=>{const h=this.session,x=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),w=new Headers(u.headers??(c instanceof Request?c.headers:void 0));h&&x.origin===h.origin&&w.set("authorization",`Bearer ${h.token}`);const m=await this.transport(c,{...u,headers:w,credentials:"omit",redirect:"error"});if(h&&this.session===h&&x.origin===h.origin&&(m.status===401||m.status===423)){this.session=null;try{await this.storage.remove(h.origin)}finally{this.onRevoked()}}return m}}async resume(t){const n=await this.storage.get(t.url);this.session=n?{origin:t.url,token:n}:null}async pair(t){const{endpoint:n,grant:o}=w_(t),c=new AbortController,u=setTimeout(()=>c.abort(),3e4);let h=null;try{let x;try{x=await this.transport(n.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:o,name:"我的 App"}),credentials:"omit",redirect:"error",signal:c.signal}),x.ok&&(h=await x.json())}catch(w){if(w instanceof SyntaxError)throw new Error("服务器返回了无效的设备凭证。");const m=c.signal.aborted||w instanceof Error&&(w.name==="TimeoutError"||w.name==="AbortError"),C=n.url.startsWith("http://")?"请确认手机与电脑在同一网络,并检查电脑防火墙是否允许 AgentRoam 连接。":"请检查手机网络和电脑的远程连接是否可用。";throw new Error(`${m?"连接电脑超时":"无法连接电脑"}(${n.url})。${C}请在电脑上刷新二维码后重新扫码。`)}if(!x.ok)throw new Error(x.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":x.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。")}finally{clearTimeout(u)}if(!h||typeof h.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(h.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,h.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${h.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:h.token},n}async checkAuthorization(){const t=this.session;if(!t)return;const n=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!n.ok)return;const o=await n.json();if(this.session===t&&(o.locked||o.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}function n3(e,t,n,o){const c=new URL(t);return(u,h)=>{const x=typeof u=="string"?u:u instanceof URL?u.href:u.url,w=new URL(x,c),m=w.protocol===c.protocol&&w.host===c.host;if(w.pathname.startsWith("/api/")&&(m||w.origin===e)){const C=new URL(w.pathname+w.search,e);return n.fetch(u instanceof Request?new Request(C,u):C,h)}return o(u,h)}}function v_(e,t){const n=new URL(e,"https://agentroam.local");if(n.pathname!=="/app/")throw new Error("Invalid workspace frame path");const o=new URL(t);return o.search=n.search,o.searchParams.set("workspace","1"),o.hash="",o.href}function J1(e){kR(MR(e.url,void 0,Yv())),new Vv().save(e)}async function y_(e,t,n,o){e.render(L.jsx(W0,{})),window.__agentroamNativeFrame={origin:t.url,fetch:n.fetch},globalThis.fetch=n3(t.url,location.href,n,o);const c=async h=>{const x=await n.pair(h);J1(x),location.reload()};TR({origin:t.url,frameUrl:h=>v_(h,location.href),pair:c,scan:async()=>{const h=await t3();h&&await c(h)},switchComputer:async h=>{const x=ln.parse(h);if(!x)throw new Error("电脑地址无效,请重新扫码。");const w=new r3(new e3,o,()=>{});await w.resume(x);const m=await w.fetch(x.api("/api/web-auth/status"),{signal:AbortSignal.timeout(5e3)}),C=m.ok?await m.json():null;if(!(C!=null&&C.authenticated)||C.locked)throw new Error("这台电脑需要重新授权,请点击扫码添加电脑。");J1(x),location.reload()}});const{default:u}=await Br(async()=>{const{default:h}=await import("./page-9-9EC7QM.js").then(x=>x.p);return{default:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url);e.render(L.jsx(ce.StrictMode,{children:L.jsx(u,{})}))}function E_(){if(window.parent===window||new URLSearchParams(location.search).get("workspace")!=="1")return null;try{const e=new URL(window.parent.location.href);return e.protocol!==location.protocol||e.host!==location.host?null:window.parent.__agentroamNativeFrame??null}catch{return null}}function C_(e){return async(t,n)=>{const o=new Request(t,n);return e.fetch(o.url,{method:o.method,headers:Object.fromEntries(o.headers),body:o.method==="GET"||o.method==="HEAD"?void 0:await o.arrayBuffer(),signal:o.signal,cache:o.cache})}}var pc;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(pc||(pc={}));var x2;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(x2||(x2={}));const Df=pa("StatusBar");function b_(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const u=parseInt(t[1].slice(c,c+2),16)/255;return u<=.04045?u/12.92:((u+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?pc.Light:pc.Dark}}function A_(){if(Ns.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Ci.getState().skin;let t=!1,n=Df.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const h=b_(getComputedStyle(e).getPropertyValue("--bg-deepest"));h&&(n=n.then(async()=>{t||(await Df.setBackgroundColor({color:h.color}),await Df.setStyle({style:h.style}))}).catch(()=>{console.warn("Unable to update the Android status bar.")}))},c=new MutationObserver(o);c.observe(e,{attributes:!0,attributeFilter:["data-skin"]});const u=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",u),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",u),window.removeEventListener("focus",o)}}const S_="/service-worker.js";function I_(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function T_(e){const t="=".repeat((4-e.length%4)%4),n=`${e}${t}`.replace(/-/g,"+").replace(/_/g,"/"),o=atob(n),c=new Uint8Array(new ArrayBuffer(o.length));for(let u=0;u<o.length;u+=1)c[u]=o.charCodeAt(u);return c}async function w2(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(S_),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:T_(t)});await e.post("/api/push/subscribe",c.toJSON())}function R_(e){I_()&&(async()=>{try{if(Notification.permission==="granted"){await w2(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await w2(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Pf extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const v2=10,__=13,gi=32;function Lf(e){}function O_(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=Lf,onError:n=Lf,onRetry:o=Lf,onComment:c,maxBufferSize:u}=e,h=[];let x=0,w=!0,m,C="",b=0,A,T=!1;function k(j){if(T)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(w&&(w=!1,j.charCodeAt(0)===239&&j.charCodeAt(1)===187&&j.charCodeAt(2)===191&&(j=j.slice(3))),h.length===0){const Y=X(j);Y!==""&&(h.push(Y),x=Y.length),M();return}if(j.indexOf(`
481
+ `)===-1&&j.indexOf("\r")===-1){h.push(j),x+=j.length,M();return}h.push(j);const U=h.join("");h.length=0,x=0;const F=X(U);F!==""&&(h.push(F),x=F.length),M()}function M(){u!==void 0&&(x+C.length<=u||(T=!0,h.length=0,x=0,m=void 0,C="",b=0,A=void 0,n(new Pf(`Buffered data exceeded max buffer size of ${u} characters`,{type:"max-buffer-size-exceeded"}))))}function X(j){let U=0;if(j.indexOf("\r")===-1){let F=j.indexOf(`
482
482
  `,U);for(;F!==-1;){if(U===F){b>0&&t({id:m,event:A,data:C}),m=void 0,C="",b=0,A=void 0,U=F+1,F=j.indexOf(`
483
- `,U);continue}const Y=j.charCodeAt(U);if(v2(j,U,Y)){const z=j.charCodeAt(U+5)===gi?U+6:U+5,oe=j.slice(z,F);if(b===0&&j.charCodeAt(F+1)===w2){t({id:m,event:A,data:oe}),m=void 0,C="",A=void 0,U=F+2,F=j.indexOf(`
483
+ `,U);continue}const Y=j.charCodeAt(U);if(y2(j,U,Y)){const z=j.charCodeAt(U+5)===gi?U+6:U+5,oe=j.slice(z,F);if(b===0&&j.charCodeAt(F+1)===v2){t({id:m,event:A,data:oe}),m=void 0,C="",A=void 0,U=F+2,F=j.indexOf(`
484
484
  `,U);continue}C=b===0?oe:`${C}
485
- ${oe}`,b++}else y2(j,U,Y)?A=j.slice(j.charCodeAt(U+6)===gi?U+7:U+6,F)||void 0:N(j,U,F);U=F+1,F=j.indexOf(`
485
+ ${oe}`,b++}else E2(j,U,Y)?A=j.slice(j.charCodeAt(U+6)===gi?U+7:U+6,F)||void 0:N(j,U,F);U=F+1,F=j.indexOf(`
486
486
  `,U)}return j.slice(U)}for(;U<j.length;){const F=j.indexOf("\r",U),Y=j.indexOf(`
487
- `,U);let z=-1;if(F!==-1&&Y!==-1?z=F<Y?F:Y:F!==-1?F===j.length-1?z=-1:z=F:Y!==-1&&(z=Y),z===-1)break;N(j,U,z),U=z+1,j.charCodeAt(U-1)===E_&&j.charCodeAt(U)===w2&&U++}return j.slice(U)}function N(j,U,F){if(U===F){O();return}const Y=j.charCodeAt(U);if(v2(j,U,Y)){const Te=j.charCodeAt(U+5)===gi?U+6:U+5,X=j.slice(Te,F);C=b===0?X:`${C}
488
- ${X}`,b++;return}if(y2(j,U,Y)){A=j.slice(j.charCodeAt(U+6)===gi?U+7:U+6,F)||void 0;return}if(Y===105&&j.charCodeAt(U+1)===100&&j.charCodeAt(U+2)===58){const Te=j.slice(j.charCodeAt(U+3)===gi?U+4:U+3,F);Te.includes("\0")||(m=Te);return}if(Y===58){if(c){const Te=j.slice(U,F);c(Te.slice(j.charCodeAt(U+1)===gi?2:1))}return}const z=j.slice(U,F),oe=z.indexOf(":");if(oe===-1){I(z,"",z);return}const ve=z.slice(0,oe),ie=z.charCodeAt(oe+1)===gi?2:1,pe=z.slice(oe+ie);I(ve,pe,z)}function I(j,U,F){switch(j){case"event":A=U||void 0;break;case"data":C=b===0?U:`${C}
489
- ${U}`,b++;break;case"id":U.includes("\0")||(m=U);break;case"retry":/^\d+$/.test(U)?o(parseInt(U,10)):n(new Pf(`Invalid \`retry\` value: "${U}"`,{type:"invalid-retry",value:U,line:F}));break;default:n(new Pf(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:U,line:F}));break}}function O(){b>0&&t({id:m,event:A,data:C}),m=void 0,C="",b=0,A=void 0}function B(j={}){if(j.consume&&g.length>0){const U=g.join("");N(U,0,U.length)}w=!0,m=void 0,C="",b=0,A=void 0,g.length=0,x=0,T=!1}return{feed:k,reset:B}}function v2(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function y2(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class E2 extends Event{constructor(t,n){var o,c;super(t),this.code=(o=n==null?void 0:n.code)!=null?o:void 0,this.message=(c=n==null?void 0:n.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,o){return o(C2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(C2(this),n)}}function b_(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ed(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ed).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ed(e.cause)}`:e.message:`${e}`}function C2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var t3=e=>{throw TypeError(e)},V0=(e,t,n)=>t.has(e)||t3("Cannot "+n),Ce=(e,t,n)=>(V0(e,t,"read from private field"),n?n.call(e):t.get(e)),vt=(e,t,n)=>t.has(e)?t3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ye=(e,t,n,o)=>(V0(e,t,"write to private field"),t.set(e,n),n),dn=(e,t,n)=>(V0(e,t,"access private method"),n),nr,xi,Yi,Ol,pc,Oo,fs,No,Wn,Ki,vs,Zi,xo,Lr,td,rd,nd,b2,id,sd,wo,od,ad;let Nl=class extends EventTarget{constructor(t,n){var o,c;super(),vt(this,Lr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,vt(this,nr),vt(this,xi),vt(this,Yi),vt(this,Ol),vt(this,pc),vt(this,Oo),vt(this,fs),vt(this,No,null),vt(this,Wn),vt(this,Ki),vt(this,vs,null),vt(this,Zi,null),vt(this,xo,null),vt(this,rd,async u=>{var g;Ce(this,Ki).reset();const{body:x,redirected:w,status:m,headers:C}=u;if(m===204){dn(this,Lr,wo).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(w?Ye(this,Yi,new URL(u.url)):Ye(this,Yi,void 0),m!==200){dn(this,Lr,wo).call(this,`Non-200 status code (${m})`,m);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){dn(this,Lr,wo).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(Ce(this,nr)===this.CLOSED)return;Ye(this,nr,this.OPEN);const b=new Event("open");if((g=Ce(this,xo))==null||g.call(this,b),this.dispatchEvent(b),typeof x!="object"||!x||!("getReader"in x)){dn(this,Lr,wo).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const A=new TextDecoder,T=x.getReader();let k=!0;do{const{done:M,value:G}=await T.read();G&&Ce(this,Ki).feed(A.decode(G,{stream:!M})),M&&(k=!1,Ce(this,Ki).reset(),dn(this,Lr,od).call(this))}while(k)}),vt(this,nd,u=>{Ye(this,Wn,void 0),!(u.name==="AbortError"||u.type==="aborted")&&dn(this,Lr,od).call(this,ed(u))}),vt(this,id,u=>{typeof u.id=="string"&&Ye(this,No,u.id);const g=new MessageEvent(u.event||"message",{data:u.data,origin:Ce(this,Yi)?Ce(this,Yi).origin:Ce(this,xi).origin,lastEventId:u.id||""});Ce(this,Zi)&&(!u.event||u.event==="message")&&Ce(this,Zi).call(this,g),this.dispatchEvent(g)}),vt(this,sd,u=>{Ye(this,Oo,u)}),vt(this,ad,()=>{Ye(this,fs,void 0),Ce(this,nr)===this.CONNECTING&&dn(this,Lr,td).call(this)});try{if(t instanceof URL)Ye(this,xi,t);else if(typeof t=="string")Ye(this,xi,new URL(t,A_()));else throw new Error("Invalid URL")}catch{throw b_("An invalid or illegal string was specified")}Ye(this,Ki,C_({onEvent:Ce(this,id),onRetry:Ce(this,sd)})),Ye(this,nr,this.CONNECTING),Ye(this,Oo,3e3),Ye(this,pc,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Ye(this,Ol,(c=n==null?void 0:n.withCredentials)!=null?c:!1),dn(this,Lr,td).call(this)}get readyState(){return Ce(this,nr)}get url(){return Ce(this,xi).href}get withCredentials(){return Ce(this,Ol)}get onerror(){return Ce(this,vs)}set onerror(t){Ye(this,vs,t)}get onmessage(){return Ce(this,Zi)}set onmessage(t){Ye(this,Zi,t)}get onopen(){return Ce(this,xo)}set onopen(t){Ye(this,xo,t)}addEventListener(t,n,o){const c=n;super.addEventListener(t,c,o)}removeEventListener(t,n,o){const c=n;super.removeEventListener(t,c,o)}close(){Ce(this,fs)&&clearTimeout(Ce(this,fs)),Ce(this,nr)!==this.CLOSED&&(Ce(this,Wn)&&Ce(this,Wn).abort(),Ye(this,nr,this.CLOSED),Ye(this,Wn,void 0))}};nr=new WeakMap,xi=new WeakMap,Yi=new WeakMap,Ol=new WeakMap,pc=new WeakMap,Oo=new WeakMap,fs=new WeakMap,No=new WeakMap,Wn=new WeakMap,Ki=new WeakMap,vs=new WeakMap,Zi=new WeakMap,xo=new WeakMap,Lr=new WeakSet,td=function(){Ye(this,nr,this.CONNECTING),Ye(this,Wn,new AbortController),Ce(this,pc)(Ce(this,xi),dn(this,Lr,b2).call(this)).then(Ce(this,rd)).catch(Ce(this,nd))},rd=new WeakMap,nd=new WeakMap,b2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ce(this,No)?{"Last-Event-ID":Ce(this,No)}:void 0},cache:"no-store",signal:(e=Ce(this,Wn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},id=new WeakMap,sd=new WeakMap,wo=function(e,t){var n;Ce(this,nr)!==this.CLOSED&&Ye(this,nr,this.CLOSED);const o=new E2("error",{code:t,message:e});(n=Ce(this,vs))==null||n.call(this,o),this.dispatchEvent(o)},od=function(e,t){var n;if(Ce(this,nr)===this.CLOSED)return;Ye(this,nr,this.CONNECTING);const o=new E2("error",{code:t,message:e});(n=Ce(this,vs))==null||n.call(this,o),this.dispatchEvent(o),Ye(this,fs,setTimeout(Ce(this,ad),Ce(this,Oo)))},ad=new WeakMap,Nl.CONNECTING=0,Nl.OPEN=1,Nl.CLOSED=2;function A_(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}MI();hT();xT();yT();ET();AT();Q9({baseUrl:()=>ra,source:"webapp"});document.body.dataset.webShell="1";const qc=new HT,ti=h_(),mc=qc.isNativeApp()||!!ti;mc&&(document.body.dataset.nativeApp="1");m_();if(!qc.isNativeApp()&&window.parent===window){const e=document.createElement("link");e.rel="manifest",e.href="/manifest.webmanifest",document.head.append(e);const t=document.querySelector('link[rel="apple-touch-icon"]');t&&(t.href="/pwa/icon-192.png");const n=document.createElement("script");n.src="/pwa/install.js",document.head.append(n)}if(window.parent===window){const e=()=>{const t=zg.find(o=>o.id===Ci.getState().skin)??zg[0];document.body.style.background=t.preview[0];let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.append(n)),n.content=t.preview[0]};e(),Ci.subscribe(e)}const Jc=globalThis.fetch.bind(globalThis),gt=qc.isNativeApp()&&!ti?new Jv(new Qv,Jc):null,ea=ti?g_(ti):gt==null?void 0:gt.fetch;ti&&ea&&(globalThis.fetch=e3(ti.origin,location.href,{fetch:ea},Jc));const ta=new X9(ea),S_=window.parent===window?void 0:new MT,I_=window.parent===window?void 0:new zT,r3=Fv({width:900,userAgent:navigator.userAgent,coarsePointer:window.matchMedia("(pointer: coarse)").matches,nativeApp:mc}),A2=r3?aT():null,ld=new Set;window.addEventListener("pagehide",e=>{if(!e.persisted)for(const t of ld)t.close()});let ra="";async function T_(e){const{wsNonce:t}=await ta.get("/api/web-console/bootstrap"),n=new URL(e,ra||location.href);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.searchParams.set("nonce",t),new WebSocket(n)}const S2=new nT(ta,new uT,S_,e=>{if(!A2||!e.startsWith("/api/agent/stream?"))return ea?new Nl(ra+e,{fetch:ea}):new EventSource(ra+e);const t=A2.open(e,()=>iT(e,o=>ta.get(`/api/sessions/${encodeURIComponent(o)}?limit=1&view=core`)));ld.add(t);const n=t.close.bind(t);return t.close=()=>{ld.delete(t),n()},t},new cT({openSocket:()=>T_("/ws/voice")}),{historyObservation:r3?"polling":"sse"});window.browserLiveApi=I_;const n3=document.getElementById("root");if(!n3)throw new Error("#root missing");const ko=Dv(n3);gt&&window.parent===window&&ko.render(L.jsx(W0,{}));function R_(){return ce.useEffect(()=>{IT()},[]),null}(async()=>{gt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new VT(qc,new Wv,new XT(gt?async(n,o)=>{const c=ln.parse(String(n));return c&&await gt.resume(c),gt.fetch(n,o)}:void 0));if(ti){await ud(ln.parse(ti.origin));return}const t=await e.planStartup();if(t.mode==="setup"){cd(t.failure);return}await ud(t.mode==="ready"?t.endpoint:null)})().catch(e=>{gt&&cd(e instanceof Error?e.message:"连接失败,请重新扫码。")});function cd(e=""){globalThis.fetch=Jc,delete window.__agentroamNativeFrame,ko.render(L.jsx(wR,{initialFailure:e,onScan:async()=>{const t=await qv();if(!t||!gt)return;const n=await gt.pair(t);J1(n),await ud(n)}}))}async function ud(e){try{if(e&&(await(gt==null?void 0:gt.resume(e)),ta.setBaseUrl(e.url),ra=e.url),gt&&e&&window.parent===window){await d_(ko,e,gt,Jc),setInterval(()=>{gt.checkAuthorization().catch(()=>{})},1e4);return}window.agentApi=S2;const t=new URLSearchParams(location.search).get("view"),n=new URLSearchParams(location.search).get("newSessionWindow")==="1",o=n?Br(()=>import("./NewSessionWindow-uzVK5LVS.js"),__vite__mapDeps([15,16,9,1,3,2,17,18,19,5,20,10,4,21,22,23,24,7,25,26,27,28]),import.meta.url):t==="collaboration"?Br(()=>import("./CollaborationPage-BwRJN55v.js"),__vite__mapDeps([29,9,20,18,2,13,30,31,32,33,12,34,35,4]),import.meta.url):t==="collaboration-dashboard"?Br(()=>import("./CollaborationDashboard-BZhWQXzn.js"),__vite__mapDeps([36,12,37,33,26,19,2,5,7,31,32,3,13,17,38]),import.meta.url):t==="session-dashboard"?Br(()=>import("./SessionDashboard-DuR9r_ZP.js"),__vite__mapDeps([39,13,40,31,32,41,2,17,3,30,25,42,43]),import.meta.url):t==="remote-desktop"?Br(()=>import("./RemoteDesktopPage-Dz_6-rOL.js"),__vite__mapDeps([44,45,18,3,10,22,2,21,6,14]),import.meta.url):t==="calendar"?Br(()=>import("./CalendarPage-B8Jo-3Da.js"),__vite__mapDeps([46,47,8,2,7,48,4,42,24,3,49]),import.meta.url):t==="todo"?Br(()=>import("./TodoPage-Bn6j6kR6.js"),__vite__mapDeps([50,46,47,8,2,7,48,4,42,24,3,49]),import.meta.url):Br(()=>import("./App-HomcUet2.js").then(u=>u.a),__vite__mapDeps([51,16,9,1,3,2,17,18,19,5,20,10,4,21,22,23,24,7,25,26,27,31,32,40,13,41,8,52,6,11,37,33,12,34,53]),import.meta.url),[,{default:c}]=await Promise.all([S2.refreshServerModel(),o]);!n&&!mc&&window.parent===window&&y_(ta),ko.render(L.jsxs(ce.StrictMode,{children:[L.jsx(PI.Provider,{value:L.jsx(H9,{}),children:L.jsx(DI.Provider,{value:L.jsx(I9,{}),children:L.jsx(c,{})})}),L.jsx(R_,{})]})),gt&&setInterval(()=>{gt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),__())}catch(t){if(t instanceof Pv&&!mc&&window.parent===window){location.replace("/pair");return}if(gt&&window.parent===window){cd(t instanceof Error?t.message:"连接失败,请重新扫码。");return}ko.render(L.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:L.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[L.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),L.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),L.jsx("button",{type:"button",onClick:()=>location.reload(),style:{padding:"8px 20px",fontSize:14,borderRadius:8,border:"1px solid #d6d9e0",background:"#fff",cursor:"pointer"},children:"重试"})]})}))}}function __(){const e=[...document.scripts].map(n=>n.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{if(uy())try{const n=await fetch("/api/agent/model",{credentials:"same-origin",cache:"no-store"});if(n.status===401||n.status===423){location.reload();return}const c=((await n.json()).buildId||"").replace(/^index-|\.js$/g,"");c&&c!==t&&TT()}catch{}},6e4)}export{sR as $,dR as A,DI as B,Q1 as C,bR as D,H_ as E,W9 as F,kv as G,G_ as H,k9 as I,B_ as J,RT as K,L9 as L,F9 as M,W_ as N,$_ as O,j9 as P,oy as Q,Mv as R,sy as S,W0 as T,z9 as U,rR as V,Xv as W,p5 as X,Rx as Y,j_ as Z,LT as _,uc as a,m5 as a0,PT as a1,tR as a2,JT as a3,nR as a4,L_ as a5,F_ as a6,DT as a7,Br as a8,q3 as a9,$0 as aa,k_ as ab,pR as ac,N_ as ad,P_ as ae,hR as af,Tx as ag,zg as ah,M_ as ai,D_ as aj,l5 as ak,V9 as al,Kp as am,PI as an,CT as ao,lR as ap,X1 as aq,s_ as b,Rt as c,yR as d,$9 as e,Ix as f,j0 as g,O_ as h,Bv as i,L as j,pn as k,I2 as l,uy as m,M9 as n,O9 as o,U9 as p,z_ as q,ce as r,Vv as s,Hv as t,Ci as u,AR as v,SR as w,U_ as x,IR as y,V_ as z};
487
+ `,U);let z=-1;if(F!==-1&&Y!==-1?z=F<Y?F:Y:F!==-1?F===j.length-1?z=-1:z=F:Y!==-1&&(z=Y),z===-1)break;N(j,U,z),U=z+1,j.charCodeAt(U-1)===__&&j.charCodeAt(U)===v2&&U++}return j.slice(U)}function N(j,U,F){if(U===F){O();return}const Y=j.charCodeAt(U);if(y2(j,U,Y)){const Te=j.charCodeAt(U+5)===gi?U+6:U+5,G=j.slice(Te,F);C=b===0?G:`${C}
488
+ ${G}`,b++;return}if(E2(j,U,Y)){A=j.slice(j.charCodeAt(U+6)===gi?U+7:U+6,F)||void 0;return}if(Y===105&&j.charCodeAt(U+1)===100&&j.charCodeAt(U+2)===58){const Te=j.slice(j.charCodeAt(U+3)===gi?U+4:U+3,F);Te.includes("\0")||(m=Te);return}if(Y===58){if(c){const Te=j.slice(U,F);c(Te.slice(j.charCodeAt(U+1)===gi?2:1))}return}const z=j.slice(U,F),oe=z.indexOf(":");if(oe===-1){I(z,"",z);return}const ve=z.slice(0,oe),ie=z.charCodeAt(oe+1)===gi?2:1,pe=z.slice(oe+ie);I(ve,pe,z)}function I(j,U,F){switch(j){case"event":A=U||void 0;break;case"data":C=b===0?U:`${C}
489
+ ${U}`,b++;break;case"id":U.includes("\0")||(m=U);break;case"retry":/^\d+$/.test(U)?o(parseInt(U,10)):n(new Pf(`Invalid \`retry\` value: "${U}"`,{type:"invalid-retry",value:U,line:F}));break;default:n(new Pf(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:U,line:F}));break}}function O(){b>0&&t({id:m,event:A,data:C}),m=void 0,C="",b=0,A=void 0}function B(j={}){if(j.consume&&h.length>0){const U=h.join("");N(U,0,U.length)}w=!0,m=void 0,C="",b=0,A=void 0,h.length=0,x=0,T=!1}return{feed:k,reset:B}}function y2(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function E2(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class C2 extends Event{constructor(t,n){var o,c;super(t),this.code=(o=n==null?void 0:n.code)!=null?o:void 0,this.message=(c=n==null?void 0:n.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,o){return o(b2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(b2(this),n)}}function N_(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ed(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ed).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ed(e.cause)}`:e.message:`${e}`}function b2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var i3=e=>{throw TypeError(e)},V0=(e,t,n)=>t.has(e)||i3("Cannot "+n),Ce=(e,t,n)=>(V0(e,t,"read from private field"),n?n.call(e):t.get(e)),vt=(e,t,n)=>t.has(e)?i3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ye=(e,t,n,o)=>(V0(e,t,"write to private field"),t.set(e,n),n),dn=(e,t,n)=>(V0(e,t,"access private method"),n),nr,xi,Yi,Nl,mc,Oo,fs,No,Wn,Ki,vs,Zi,xo,Lr,td,rd,nd,A2,id,sd,wo,od,ad;let kl=class extends EventTarget{constructor(t,n){var o,c;super(),vt(this,Lr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,vt(this,nr),vt(this,xi),vt(this,Yi),vt(this,Nl),vt(this,mc),vt(this,Oo),vt(this,fs),vt(this,No,null),vt(this,Wn),vt(this,Ki),vt(this,vs,null),vt(this,Zi,null),vt(this,xo,null),vt(this,rd,async u=>{var h;Ce(this,Ki).reset();const{body:x,redirected:w,status:m,headers:C}=u;if(m===204){dn(this,Lr,wo).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(w?Ye(this,Yi,new URL(u.url)):Ye(this,Yi,void 0),m!==200){dn(this,Lr,wo).call(this,`Non-200 status code (${m})`,m);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){dn(this,Lr,wo).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(Ce(this,nr)===this.CLOSED)return;Ye(this,nr,this.OPEN);const b=new Event("open");if((h=Ce(this,xo))==null||h.call(this,b),this.dispatchEvent(b),typeof x!="object"||!x||!("getReader"in x)){dn(this,Lr,wo).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const A=new TextDecoder,T=x.getReader();let k=!0;do{const{done:M,value:X}=await T.read();X&&Ce(this,Ki).feed(A.decode(X,{stream:!M})),M&&(k=!1,Ce(this,Ki).reset(),dn(this,Lr,od).call(this))}while(k)}),vt(this,nd,u=>{Ye(this,Wn,void 0),!(u.name==="AbortError"||u.type==="aborted")&&dn(this,Lr,od).call(this,ed(u))}),vt(this,id,u=>{typeof u.id=="string"&&Ye(this,No,u.id);const h=new MessageEvent(u.event||"message",{data:u.data,origin:Ce(this,Yi)?Ce(this,Yi).origin:Ce(this,xi).origin,lastEventId:u.id||""});Ce(this,Zi)&&(!u.event||u.event==="message")&&Ce(this,Zi).call(this,h),this.dispatchEvent(h)}),vt(this,sd,u=>{Ye(this,Oo,u)}),vt(this,ad,()=>{Ye(this,fs,void 0),Ce(this,nr)===this.CONNECTING&&dn(this,Lr,td).call(this)});try{if(t instanceof URL)Ye(this,xi,t);else if(typeof t=="string")Ye(this,xi,new URL(t,k_()));else throw new Error("Invalid URL")}catch{throw N_("An invalid or illegal string was specified")}Ye(this,Ki,O_({onEvent:Ce(this,id),onRetry:Ce(this,sd)})),Ye(this,nr,this.CONNECTING),Ye(this,Oo,3e3),Ye(this,mc,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Ye(this,Nl,(c=n==null?void 0:n.withCredentials)!=null?c:!1),dn(this,Lr,td).call(this)}get readyState(){return Ce(this,nr)}get url(){return Ce(this,xi).href}get withCredentials(){return Ce(this,Nl)}get onerror(){return Ce(this,vs)}set onerror(t){Ye(this,vs,t)}get onmessage(){return Ce(this,Zi)}set onmessage(t){Ye(this,Zi,t)}get onopen(){return Ce(this,xo)}set onopen(t){Ye(this,xo,t)}addEventListener(t,n,o){const c=n;super.addEventListener(t,c,o)}removeEventListener(t,n,o){const c=n;super.removeEventListener(t,c,o)}close(){Ce(this,fs)&&clearTimeout(Ce(this,fs)),Ce(this,nr)!==this.CLOSED&&(Ce(this,Wn)&&Ce(this,Wn).abort(),Ye(this,nr,this.CLOSED),Ye(this,Wn,void 0))}};nr=new WeakMap,xi=new WeakMap,Yi=new WeakMap,Nl=new WeakMap,mc=new WeakMap,Oo=new WeakMap,fs=new WeakMap,No=new WeakMap,Wn=new WeakMap,Ki=new WeakMap,vs=new WeakMap,Zi=new WeakMap,xo=new WeakMap,Lr=new WeakSet,td=function(){Ye(this,nr,this.CONNECTING),Ye(this,Wn,new AbortController),Ce(this,mc)(Ce(this,xi),dn(this,Lr,A2).call(this)).then(Ce(this,rd)).catch(Ce(this,nd))},rd=new WeakMap,nd=new WeakMap,A2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ce(this,No)?{"Last-Event-ID":Ce(this,No)}:void 0},cache:"no-store",signal:(e=Ce(this,Wn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},id=new WeakMap,sd=new WeakMap,wo=function(e,t){var n;Ce(this,nr)!==this.CLOSED&&Ye(this,nr,this.CLOSED);const o=new C2("error",{code:t,message:e});(n=Ce(this,vs))==null||n.call(this,o),this.dispatchEvent(o)},od=function(e,t){var n;if(Ce(this,nr)===this.CLOSED)return;Ye(this,nr,this.CONNECTING);const o=new C2("error",{code:t,message:e});(n=Ce(this,vs))==null||n.call(this,o),this.dispatchEvent(o),Ye(this,fs,setTimeout(Ce(this,ad),Ce(this,Oo)))},ad=new WeakMap,kl.CONNECTING=0,kl.OPEN=1,kl.CLOSED=2;function k_(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}PI();E9();S9();R9();_9();k9();JT({baseUrl:()=>na,source:"webapp"});document.body.dataset.webShell="1";const qc=new J9,ti=E_(),ea=qc.isNativeApp()||!!ti;ea&&(document.body.dataset.nativeApp="1");A_();if(!qc.isNativeApp()&&window.parent===window){const e=document.createElement("link");e.rel="manifest",e.href="/manifest.webmanifest",document.head.append(e);const t=document.querySelector('link[rel="apple-touch-icon"]');t&&(t.href="/pwa/icon-192.png");const n=document.createElement("script");n.src="/pwa/install.js",document.head.append(n)}if(window.parent===window){const e=()=>{const t=zg.find(o=>o.id===Ci.getState().skin)??zg[0];document.body.style.background=t.preview[0];let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.append(n)),n.content=t.preview[0]};e(),Ci.subscribe(e)}const Jc=globalThis.fetch.bind(globalThis),gt=qc.isNativeApp()&&!ti?new r3(new e3,Jc):null,ta=ti?C_(ti):gt==null?void 0:gt.fetch;ti&&ta&&(globalThis.fetch=n3(ti.origin,location.href,{fetch:ta},Jc));const ra=new KT(ta),M_=window.parent===window?void 0:new W9,D_=window.parent===window?void 0:new Q9,P_=Wv({width:900,userAgent:navigator.userAgent,coarsePointer:window.matchMedia("(pointer: coarse)").matches,nativeApp:ea}),S2=ea?null:p9(),ld=new Set;window.addEventListener("pagehide",e=>{if(!e.persisted)for(const t of ld)t.close()});let na="";async function L_(e){const{wsNonce:t}=await ra.get("/api/web-console/bootstrap"),n=new URL(e,na||location.href);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.searchParams.set("nonce",t),new WebSocket(n)}const I2=new f9(ra,new w9,M_,e=>{if(!S2||!e.startsWith("/api/agent/stream?"))return ta?new kl(na+e,{fetch:ta}):new EventSource(na+e);const t=S2.open(e,()=>d9(e,o=>ra.get(`/api/sessions/${encodeURIComponent(o)}?limit=1&view=core`)));ld.add(t);const n=t.close.bind(t);return t.close=()=>{ld.delete(t),n()},t},new x9({openSocket:()=>L_("/ws/voice")}),{historyObservation:P_?"polling":"sse"});window.browserLiveApi=D_;const s3=document.getElementById("root");if(!s3)throw new Error("#root missing");const ko=Pv(s3);gt&&window.parent===window&&ko.render(L.jsx(W0,{}));function B_(){return ce.useEffect(()=>{D9()},[]),null}(async()=>{gt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new q9(qc,new Vv,new tR(gt?async(n,o)=>{const c=ln.parse(String(n));return c&&await gt.resume(c),gt.fetch(n,o)}:void 0));if(ti){await ud(ln.parse(ti.origin));return}const t=await e.planStartup();if(t.mode==="setup"){cd(t.failure);return}await ud(t.mode==="ready"?t.endpoint:null)})().catch(e=>{gt&&cd(e instanceof Error?e.message:"连接失败,请重新扫码。")});function cd(e=""){globalThis.fetch=Jc,delete window.__agentroamNativeFrame,ko.render(L.jsx(IR,{initialFailure:e,onScan:async()=>{const t=await t3();if(!t||!gt)return;const n=await gt.pair(t);J1(n),await ud(n)}}))}async function ud(e){try{if(e&&(await(gt==null?void 0:gt.resume(e)),ra.setBaseUrl(e.url),na=e.url),gt&&e&&window.parent===window){await y_(ko,e,gt,Jc),setInterval(()=>{gt.checkAuthorization().catch(()=>{})},1e4);return}window.agentApi=I2;const t=new URLSearchParams(location.search).get("view"),n=new URLSearchParams(location.search).get("newSessionWindow")==="1",o=n?Br(()=>import("./NewSessionWindow-C_HCQQnW.js"),__vite__mapDeps([15,16,9,17,18,2,10,4,1,19,5,20,7,3,21,22,23,24,25,26,27,28]),import.meta.url):t==="collaboration"?Br(()=>import("./CollaborationPage-C4l-tTvn.js"),__vite__mapDeps([29,9,17,18,2,13,30,31,32,33,12,34,35,4]),import.meta.url):t==="collaboration-dashboard"?Br(()=>import("./CollaborationDashboard-CNHt31kl.js"),__vite__mapDeps([36,12,37,33,26,19,2,5,7,31,32,3,13,21,38]),import.meta.url):t==="session-dashboard"?Br(()=>import("./SessionDashboard-C58Mke8a.js"),__vite__mapDeps([39,13,40,31,32,41,2,21,3,30,25,42,43]),import.meta.url):t==="remote-desktop"?Br(()=>import("./RemoteDesktopPage-Cpzv8zH0.js"),__vite__mapDeps([44,45,18,3,10,22,23,2,6,14]),import.meta.url):t==="calendar"?Br(()=>import("./CalendarPage-DzYWlqoZ.js"),__vite__mapDeps([46,47,8,2,7,48,20,3,4,42,49]),import.meta.url):t==="todo"?Br(()=>import("./TodoPage-DdF5_SkL.js"),__vite__mapDeps([50,46,47,8,2,7,48,20,3,4,42,49]),import.meta.url):Br(()=>import("./App-Bum2L4_E.js").then(u=>u.a),__vite__mapDeps([51,16,9,17,18,2,10,4,1,19,5,20,7,3,21,22,23,24,25,26,27,31,32,40,13,41,8,52,6,11,37,33,12,34,53]),import.meta.url),[,{default:c}]=await Promise.all([I2.refreshServerModel(),o]);!n&&!ea&&window.parent===window&&R_(ra),ko.render(L.jsxs(ce.StrictMode,{children:[L.jsx(BI.Provider,{value:L.jsx(XT,{}),children:L.jsx(LI.Provider,{value:L.jsx(RT,{}),children:L.jsx(c,{})})}),L.jsx(B_,{})]})),gt&&setInterval(()=>{gt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),F_())}catch(t){if(t instanceof Lv&&!ea&&window.parent===window){location.replace("/pair");return}if(gt&&window.parent===window){cd(t instanceof Error?t.message:"连接失败,请重新扫码。");return}ko.render(L.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:L.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[L.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),L.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),L.jsx("button",{type:"button",onClick:()=>location.reload(),style:{padding:"8px 20px",fontSize:14,borderRadius:8,border:"1px solid #d6d9e0",background:"#fff",cursor:"pointer"},children:"重试"})]})}))}}function F_(){const e=[...document.scripts].map(n=>n.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{if(dy())try{const n=await fetch("/api/agent/model",{credentials:"same-origin",cache:"no-store"});if(n.status===401||n.status===423){location.reload();return}const c=((await n.json()).buildId||"").replace(/^index-|\.js$/g,"");c&&c!==t&&P9()}catch{}},6e4)}export{x5 as $,yR as A,LI as B,Q1 as C,K_ as D,DR as E,eO as F,NR as G,rO as H,tO as I,zT as J,Mv as K,FT as L,jT as M,z_ as N,DT as O,$T as P,X_ as Q,Dv as R,L9 as S,Q_ as T,HT as U,q_ as V,Zv as W,ly as X,ay as Y,W0 as Z,uR as _,fc as a,_x as a0,Z_ as a1,V9 as a2,hR as a3,w5 as a4,z9 as a5,cR as a6,aR as a7,fR as a8,G_ as a9,Y_ as aa,$9 as ab,Br as ac,ey as ad,W_ as ae,bR as af,j_ as ag,H_ as ah,ER as ai,Rx as aj,zg as ak,$_ as al,u5 as am,GT as an,Kp as ao,BI as ap,O9 as aq,mR as ar,X1 as as,i9 as at,h_ as b,Rt as c,RR as d,VT as e,Tx as f,j0 as g,U_ as h,Fv as i,L as j,pn as k,T2 as l,dy as m,V_ as n,$0 as o,PT as p,n9 as q,ce as r,kT as s,WT as t,Ci as u,J_ as v,Xv as w,Yv as x,kR as y,MR as z};