agentroam-runtime-darwin-arm64 0.2.0-preview.41 → 0.2.0-preview.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +14 -14
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +8 -8
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/react-loadable-manifest.json +4 -4
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/routes-manifest.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +2 -2
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +6 -6
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +3 -3
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid.body +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +3 -3
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -0
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -0
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +55 -11
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +31 -29
- package/runtime/.next/server/chunks/1322.js +79 -71
- package/runtime/.next/server/chunks/1773.js +197 -45
- package/runtime/.next/server/chunks/2293.js +1 -1
- package/runtime/.next/server/chunks/366.js +1 -1
- package/runtime/.next/server/chunks/5303.js +2 -2
- package/runtime/.next/server/chunks/6244.js +1 -1
- package/runtime/.next/server/chunks/6703.js +2 -2
- package/runtime/.next/server/chunks/8532.js +1 -1
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/20.7bd5212774091396.js +1 -0
- package/runtime/.next/static/chunks/623.58dd1ca3ac3436a6.js +1 -0
- package/runtime/.next/static/chunks/784.0a0b664e7440b5c7.js +1 -0
- package/runtime/.next/static/chunks/798-ed5787fe9c4dda16.js +1 -0
- package/runtime/.next/static/chunks/app/web/{error-eea6b6c270ef86cb.js → error-c63a36c2158ad9c1.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-d51d73e7a7ca7e43.js +1 -0
- package/runtime/.next/static/chunks/app/web/page-8a5e4b21d74fdee9.js +1 -0
- package/runtime/.next/static/chunks/{main-161a855daf7c5a06.js → main-3b6443d34e818b51.js} +1 -1
- package/runtime/.next/static/chunks/{main-app-9aaee005b4835e70.js → main-app-1161125ed7e04f09.js} +1 -1
- package/runtime/.next/static/chunks/webpack-0f87c4f7f499edcd.js +1 -0
- package/runtime/lib/pairing-page.mjs +29 -8
- package/runtime/lib/pwa-assets.mjs +2 -0
- package/runtime/node_modules/.package-lock.json +61 -61
- package/runtime/node_modules/@agent/core/dist/index.js +131 -5
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +9512 -707
- package/runtime/node_modules/@peculiar/asn1-cms/package.json +4 -4
- package/runtime/node_modules/@peculiar/asn1-csr/package.json +3 -3
- package/runtime/node_modules/@peculiar/asn1-ecc/package.json +3 -3
- package/runtime/node_modules/@peculiar/asn1-pfx/package.json +5 -5
- package/runtime/node_modules/@peculiar/asn1-pkcs8/package.json +3 -3
- package/runtime/node_modules/@peculiar/asn1-pkcs9/package.json +7 -7
- package/runtime/node_modules/@peculiar/asn1-rsa/package.json +3 -3
- package/runtime/node_modules/@peculiar/asn1-schema/build/cjs/converters.js +1 -1
- package/runtime/node_modules/@peculiar/asn1-schema/build/es2015/converters.js +1 -1
- package/runtime/node_modules/@peculiar/asn1-schema/package.json +1 -1
- package/runtime/node_modules/@peculiar/asn1-x509/package.json +2 -2
- package/runtime/node_modules/@peculiar/asn1-x509-attr/package.json +3 -3
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +19 -5
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +4 -4
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +4 -4
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +19 -5
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +19 -5
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -4
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +25 -4
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/node_modules/sanitize-html/node_modules/postcss/lib/processor.js +1 -1
- package/runtime/node_modules/sanitize-html/node_modules/postcss/lib/stringify.js +4 -2
- package/runtime/node_modules/sanitize-html/node_modules/postcss/package.json +2 -2
- package/runtime/package-lock.json +61 -61
- package/runtime/public/pwa/computer-directory.js +135 -0
- package/runtime/public/pwa/install.js +4 -4
- package/runtime/public/pwa/offline-computers.js +15 -0
- package/runtime/public/pwa/offline.html +1 -1
- package/runtime/public/pwa/pairing-scan.js +74 -50
- package/runtime/public/pwa/service-worker.js +8 -2
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/App-CMPASrR3.js +372 -0
- package/runtime/webapp/dist/assets/BrowserLivePanel-Ds-vjnbz.js +126 -0
- package/runtime/webapp/dist/assets/RemoteDesktopPage-xxhqLNgm.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-CyHhjdFC.js → abnfDiagram-VCTEODGH-CwvKLRQ1.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-YykeV-yA.js → arc-DXkkTI-b.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-CPXGrnO0.js → architectureDiagram-5GKGNRK7-B0avmMJZ.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DY5fPlHV.js → blockDiagram-I7D4REHJ-Bb2b6dIF.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-D9IqQaEZ.js → c4Diagram-7LVT6UL2-CRE0k0L3.js} +1 -1
- package/runtime/webapp/dist/assets/channel-CRJ0jWgl.js +1 -0
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Dq03q8Ff.js → chunk-2Q5K7J3B-DI1wj_tf.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-V40WX1nt.js → chunk-5VM5RSS4-_aGhowrQ.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-CiCQWcQf.js → chunk-F27PBJKO-udH8FZZf.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-EJT0DATb.js → chunk-IMKFNOWR-S71r1fV3.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-B0T3KRl6.js → chunk-JWPE2WC7-CAH0hDxP.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-CBoqnL3A.js → chunk-POPQ4Y6H-CahoLGF8.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-vc6mvklc.js → chunk-SVP7TREG-gclZEabW.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Co7ACWND.js → chunk-TICWLB2K-BU-hl1dd.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CvByXr6J.js → chunk-XXDRQBXY-ByYA2c8-.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-DBG4ghIp.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-DBG4ghIp.js +1 -0
- package/runtime/webapp/dist/assets/{codeSyntax-CEVVRDzr.js → codeSyntax-DyRN-GXB.js} +3 -3
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-B6ijVOa6.js → cose-bilkent-JH36ORCC-BwB42Zu6.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-DNC_aald.js → cynefin-OW5HDTMX-CFnmFmXO.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-DMwAVRmf.js → cynefinDiagram-5FMLGOSQ-CkssATsB.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DtA0NmZw.js → dagre-GXQ25YYZ-fIF_tqGN.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-B7SEmc9A.js → diagram-S7CK7UJ4-DX2W7FZW.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CP_Xy1AP.js → diagram-UQ7AKVKN-DnRMrmip.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CMq6cPW9.js → diagram-VSXAHHWV-C7TJzLhG.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-KIUvVPO4.js → diagram-VX7I27RA-BSs1h2p-.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-UiMEplzj.js → diagram-Z3DM3KII-BNDUeEXx.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-D221JIeM.js → ebnfDiagram-PWID7BFC-CgYMCKx3.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-XKInLFA3.js → erDiagram-RLTQ6QDP-BOxl_4UZ.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BeT9GYtM.js → flowDiagram-HODETNUW-du8mM9rP.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-Dk8Uwf7E.js → ganttDiagram-EL5Y4UJY-CJLgXkz6.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-DiVf0w01.js → gitGraphDiagram-WWUBYQGX-BplG6yCN.js} +1 -1
- package/runtime/webapp/dist/assets/index-Cw31yAgB.css +1 -0
- package/runtime/webapp/dist/assets/{index-D1I5RKVk.js → index-CzIpMVPy.js} +26 -26
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DpVFXIO9.js → infoDiagram-27XIBGKW-B2QTuOS-.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-ChWOHTzh.js → ishikawaDiagram-5VMMS53U-ZuHBoPQo.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-CTm0xDi4.js → journeyDiagram-3NMN7TZE-DokUlBxp.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-zVtWbTTX.js → kanban-definition-UXKFOSKX-D1WW8NLx.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-C8tlpprW.js → layout-BiHCZ9Zu.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-CArf8t7h.js → linear-CxHO_GAG.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-BVUH1a8m.js → mermaid.core-D6Nb0RBZ.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-Cx7RFt-X.js → mindmap-definition-YA3MSWOX-BBKYQuhW.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BvEhVZgX.js → pegDiagram-XKGWAZYB-thA9baIL.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-U0qmhh14.js → pieDiagram-E7YTZNPT-XaMeMwPN.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-BbUHWejy.js → quadrantDiagram-AXDQQJYC-BhH4phC3.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-SXZBMND2.js → railroadDiagram-O6MQD6OU-3TlF12h3.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-Cv9h1clg.js → requirementDiagram-BXWQKSXE-DR0xcD9B.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-CSWUhEDJ.js → sankeyDiagram-P5KCCOFB-cmZimRgm.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-Cy7gfOPU.js → sequenceDiagram-WJ2MYXX4-BcEIk86C.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-DEJ8653D.js → sizeCapture-INFHLROL-D2L1eYDc.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-C9znHj1A.js → stateDiagram-D77RDMKH-0QGzS1bZ.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-UiX6EIee.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-D-1OGDuC.js → swimlanes-42K2YHIH-CkAALbJl.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C5VOUXkb.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-fmk9SWID.js → timeline-definition-24CTP7MA-BGg7daAV.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CoJrdpIF.js → vennDiagram-4TSXK5OY-B7u_4XkM.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CQd2ig95.js → wardleyDiagram-VM6X3IG4-BleJ8ztR.js} +1 -1
- package/runtime/webapp/dist/assets/{web-CICIlrjx.js → web-BVftZoWS.js} +1 -1
- package/runtime/webapp/dist/assets/{web-DdNvGACS.js → web-tEd182N3.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-Slg0Vzat.js → xychartDiagram-S5SC5T6Z-CK34SO-0.js} +1 -1
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/.next/static/chunks/20.b1b61df1a3c1499c.js +0 -1
- package/runtime/.next/static/chunks/33.4372b0479992e5e4.js +0 -1
- package/runtime/.next/static/chunks/693-41d7c8e27a8513d1.js +0 -1
- package/runtime/.next/static/chunks/784.1394d774230a5516.js +0 -1
- package/runtime/.next/static/chunks/app/web/layout-0991128047cc5e14.js +0 -1
- package/runtime/.next/static/chunks/app/web/page-d615bce909fdda0b.js +0 -1
- package/runtime/.next/static/chunks/webpack-d4e32619d2ce6d30.js +0 -1
- package/runtime/webapp/dist/assets/App-Bnv7-jUZ.js +0 -487
- package/runtime/webapp/dist/assets/channel-DQNFzknQ.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-DjmQeVYo.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-DjmQeVYo.js +0 -1
- package/runtime/webapp/dist/assets/index-CtJgsVah.css +0 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-D4PTr_9g.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BnGs6oif.js +0 -8
- /package/runtime/.next/static/{rwWTikOeChITsRklIaUDw → 7p7Pz-eNsNs8-scLZm3JY}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{rwWTikOeChITsRklIaUDw → 7p7Pz-eNsNs8-scLZm3JY}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./
|
|
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 f of c)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function n(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=n(c);fetch(c.href,f)}})();const Yv="modulepreload",Kv=function(e,t){return new URL(e,t).href},Gd={},
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RemoteDesktopPage-xxhqLNgm.js","./BrowserLivePanel-Ds-vjnbz.js","./App-CMPASrR3.js","./App-iUeP1CBo.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 f of c)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function n(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=n(c);fetch(c.href,f)}})();const Yv="modulepreload",Kv=function(e,t){return new URL(e,t).href},Gd={},Cl=function(t,n,o){let c=Promise.resolve();if(n&&n.length>0){const g=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),v=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=Promise.allSettled(n.map(x=>{if(x=Kv(x,o),x in Gd)return;Gd[x]=!0;const C=x.endsWith(".css"),A=C?'[rel="stylesheet"]':"";if(o)for(let O=g.length-1;O>=0;O--){const k=g[O];if(k.href===x&&(!C||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${A}`))return;const I=document.createElement("link");if(I.rel=C?"stylesheet":Yv,C||(I.as="script"),I.crossOrigin="",I.href=x,v&&I.setAttribute("nonce",v),document.head.appendChild(I),C)return new Promise((O,k)=>{I.addEventListener("load",O),I.addEventListener("error",()=>k(Error(`Unable to preload CSS for ${x}`)))})}))}function f(g){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=g,window.dispatchEvent(m),!m.defaultPrevented)throw g}return c.then(g=>{for(const m of g||[])m.status==="rejected"&&f(m.reason);return t().catch(f)})};var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a2={exports:{}},lu={},l2={exports:{}},Ce={};/**
|
|
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=["./App-Bnv7-jUZ.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 Yo=Symbol.for("react.element"),Zv=Symbol.for("react.portal"),Qv=Symbol.for("react.fragment"),qv=Symbol.for("react.strict_mode"),Jv=Symbol.for("react.profiler"),ey=Symbol.for("react.provider"),ty=Symbol.for("react.context"),ry=Symbol.for("react.forward_ref"),ny=Symbol.for("react.suspense"),iy=Symbol.for("react.memo"),sy=Symbol.for("react.lazy"),Xd=Symbol.iterator;function oy(e){return e===null||typeof e!="object"?null:(e=Xd&&e[Xd]||e["@@iterator"],typeof e=="function"?e:null)}var u2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},c2=Object.assign,f2={};function Rs(e,t,n){this.props=e,this.context=t,this.refs=f2,this.updater=n||u2}Rs.prototype.isReactComponent={};Rs.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")};Rs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function d2(){}d2.prototype=Rs.prototype;function K1(e,t,n){this.props=e,this.context=t,this.refs=f2,this.updater=n||u2}var Z1=K1.prototype=new d2;Z1.constructor=K1;c2(Z1,Rs.prototype);Z1.isPureReactComponent=!0;var Yd=Array.isArray,h2=Object.prototype.hasOwnProperty,Q1={current:null},g2={key:!0,ref:!0,__self:!0,__source:!0};function p2(e,t,n){var o,c={},f=null,g=null;if(t!=null)for(o in t.ref!==void 0&&(g=t.ref),t.key!==void 0&&(f=""+t.key),t)h2.call(t,o)&&!g2.hasOwnProperty(o)&&(c[o]=t[o]);var m=arguments.length-2;if(m===1)c.children=n;else if(1<m){for(var v=Array(m),x=0;x<m;x++)v[x]=arguments[x+2];c.children=v}if(e&&e.defaultProps)for(o in m=e.defaultProps,m)c[o]===void 0&&(c[o]=m[o]);return{$$typeof:Yo,type:e,key:f,ref:g,props:c,_owner:Q1.current}}function ay(e,t){return{$$typeof:Yo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function q1(e){return typeof e=="object"&&e!==null&&e.$$typeof===Yo}function ly(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Kd=/\/+/g;function
|
|
10
|
+
*/var Yo=Symbol.for("react.element"),Zv=Symbol.for("react.portal"),Qv=Symbol.for("react.fragment"),qv=Symbol.for("react.strict_mode"),Jv=Symbol.for("react.profiler"),ey=Symbol.for("react.provider"),ty=Symbol.for("react.context"),ry=Symbol.for("react.forward_ref"),ny=Symbol.for("react.suspense"),iy=Symbol.for("react.memo"),sy=Symbol.for("react.lazy"),Xd=Symbol.iterator;function oy(e){return e===null||typeof e!="object"?null:(e=Xd&&e[Xd]||e["@@iterator"],typeof e=="function"?e:null)}var u2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},c2=Object.assign,f2={};function Rs(e,t,n){this.props=e,this.context=t,this.refs=f2,this.updater=n||u2}Rs.prototype.isReactComponent={};Rs.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")};Rs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function d2(){}d2.prototype=Rs.prototype;function K1(e,t,n){this.props=e,this.context=t,this.refs=f2,this.updater=n||u2}var Z1=K1.prototype=new d2;Z1.constructor=K1;c2(Z1,Rs.prototype);Z1.isPureReactComponent=!0;var Yd=Array.isArray,h2=Object.prototype.hasOwnProperty,Q1={current:null},g2={key:!0,ref:!0,__self:!0,__source:!0};function p2(e,t,n){var o,c={},f=null,g=null;if(t!=null)for(o in t.ref!==void 0&&(g=t.ref),t.key!==void 0&&(f=""+t.key),t)h2.call(t,o)&&!g2.hasOwnProperty(o)&&(c[o]=t[o]);var m=arguments.length-2;if(m===1)c.children=n;else if(1<m){for(var v=Array(m),x=0;x<m;x++)v[x]=arguments[x+2];c.children=v}if(e&&e.defaultProps)for(o in m=e.defaultProps,m)c[o]===void 0&&(c[o]=m[o]);return{$$typeof:Yo,type:e,key:f,ref:g,props:c,_owner:Q1.current}}function ay(e,t){return{$$typeof:Yo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function q1(e){return typeof e=="object"&&e!==null&&e.$$typeof===Yo}function ly(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Kd=/\/+/g;function lc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ly(""+e.key):t.toString(36)}function qa(e,t,n,o,c){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var g=!1;if(e===null)g=!0;else switch(f){case"string":case"number":g=!0;break;case"object":switch(e.$$typeof){case Yo:case Zv:g=!0}}if(g)return g=e,c=c(g),e=o===""?"."+lc(g,0):o,Yd(c)?(n="",e!=null&&(n=e.replace(Kd,"$&/")+"/"),qa(c,t,n,"",function(x){return x})):c!=null&&(q1(c)&&(c=ay(c,n+(!c.key||g&&g.key===c.key?"":(""+c.key).replace(Kd,"$&/")+"/")+e)),t.push(c)),1;if(g=0,o=o===""?".":o+":",Yd(e))for(var m=0;m<e.length;m++){f=e[m];var v=o+lc(f,m);g+=qa(f,t,n,v,c)}else if(v=oy(e),typeof v=="function")for(e=v.call(e),m=0;!(f=e.next()).done;)f=f.value,v=o+lc(f,m++),g+=qa(f,t,n,v,c);else if(f==="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 va(e,t,n){if(e==null)return e;var o=[],c=0;return qa(e,o,"","",function(f){return t.call(n,f,c++)}),o}function uy(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 Xt={current:null},Ja={transition:null},cy={ReactCurrentDispatcher:Xt,ReactCurrentBatchConfig:Ja,ReactCurrentOwner:Q1};function x2(){throw Error("act(...) is not supported in production builds of React.")}Ce.Children={map:va,forEach:function(e,t,n){va(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return va(e,function(){t++}),t},toArray:function(e){return va(e,function(t){return t})||[]},only:function(e){if(!q1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ce.Component=Rs;Ce.Fragment=Qv;Ce.Profiler=Jv;Ce.PureComponent=K1;Ce.StrictMode=qv;Ce.Suspense=ny;Ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cy;Ce.act=x2;Ce.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=c2({},e.props),c=e.key,f=e.ref,g=e._owner;if(t!=null){if(t.ref!==void 0&&(f=t.ref,g=Q1.current),t.key!==void 0&&(c=""+t.key),e.type&&e.type.defaultProps)var m=e.type.defaultProps;for(v in t)h2.call(t,v)&&!g2.hasOwnProperty(v)&&(o[v]=t[v]===void 0&&m!==void 0?m[v]:t[v])}var v=arguments.length-2;if(v===1)o.children=n;else if(1<v){m=Array(v);for(var x=0;x<v;x++)m[x]=arguments[x+2];o.children=m}return{$$typeof:Yo,type:e.type,key:c,ref:f,props:o,_owner:g}};Ce.createContext=function(e){return e={$$typeof:ty,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ey,_context:e},e.Consumer=e};Ce.createElement=p2;Ce.createFactory=function(e){var t=p2.bind(null,e);return t.type=e,t};Ce.createRef=function(){return{current:null}};Ce.forwardRef=function(e){return{$$typeof:ry,render:e}};Ce.isValidElement=q1;Ce.lazy=function(e){return{$$typeof:sy,_payload:{_status:-1,_result:e},_init:uy}};Ce.memo=function(e,t){return{$$typeof:iy,type:e,compare:t===void 0?null:t}};Ce.startTransition=function(e){var t=Ja.transition;Ja.transition={};try{e()}finally{Ja.transition=t}};Ce.unstable_act=x2;Ce.useCallback=function(e,t){return Xt.current.useCallback(e,t)};Ce.useContext=function(e){return Xt.current.useContext(e)};Ce.useDebugValue=function(){};Ce.useDeferredValue=function(e){return Xt.current.useDeferredValue(e)};Ce.useEffect=function(e,t){return Xt.current.useEffect(e,t)};Ce.useId=function(){return Xt.current.useId()};Ce.useImperativeHandle=function(e,t,n){return Xt.current.useImperativeHandle(e,t,n)};Ce.useInsertionEffect=function(e,t){return Xt.current.useInsertionEffect(e,t)};Ce.useLayoutEffect=function(e,t){return Xt.current.useLayoutEffect(e,t)};Ce.useMemo=function(e,t){return Xt.current.useMemo(e,t)};Ce.useReducer=function(e,t,n){return Xt.current.useReducer(e,t,n)};Ce.useRef=function(e){return Xt.current.useRef(e)};Ce.useState=function(e){return Xt.current.useState(e)};Ce.useSyncExternalStore=function(e,t,n){return Xt.current.useSyncExternalStore(e,t,n)};Ce.useTransition=function(){return Xt.current.useTransition()};Ce.version="18.3.1";l2.exports=Ce;var ht=l2.exports;const fy=o2(ht);/**
|
|
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=["./App-Bnv7-jUZ.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 dy=ht,hy=Symbol.for("react.element"),gy=Symbol.for("react.fragment"),py=Object.prototype.hasOwnProperty,xy=dy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,my={key:!0,ref:!0,__self:!0,__source:!0};function m2(e,t,n){var o,c={},f=null,g=null;n!==void 0&&(f=""+n),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)py.call(t,o)&&!my.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:hy,type:e,key:f,ref:g,props:c,_owner:xy.current}}au.Fragment=gy;au.jsx=m2;au.jsxs=m2;a2.exports=au;var ee=a2.exports,zs=function(e){return e&&e.Math===Math&&e},ct=zs(typeof globalThis=="object"&&globalThis)||zs(typeof window=="object"&&window)||zs(typeof self=="object"&&self)||zs(typeof dn=="object"&&dn)||zs(typeof dn=="object"&&dn)||function(){return this}()||Function("return this")(),J1={},at=function(e){try{return!!e()}catch{return!0}},wy=at,Yt=!wy(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),vy=at,e0=!vy(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),yy=e0,ya=Function.prototype.call,Cn=yy?ya.bind(ya):function(){return ya.apply(ya,arguments)},w2={},v2={}.propertyIsEnumerable,y2=Object.getOwnPropertyDescriptor,Ey=y2&&!v2.call({1:2},1);w2.f=Ey?function(t){var n=y2(this,t);return!!n&&n.enumerable}:v2;var Ri=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},E2=e0,C2=Function.prototype,Af=C2.call,Cy=E2&&C2.bind.bind(Af,Af),ft=E2?Cy:function(e){return function(){return Af.apply(e,arguments)}},A2=ft,Ay=A2({}.toString),Sy=A2("".slice),bi=function(e){return Sy(Ay(e),8,-1)},Iy=ft,Ty=at,Ry=bi,lc=Object,by=Iy("".split),S2=Ty(function(){return!lc("z").propertyIsEnumerable(0)})?function(e){return Ry(e)==="String"?by(e,""):lc(e)}:lc,bs=function(e){return e==null},_y=bs,Oy=TypeError,t0=function(e){if(_y(e))throw new Oy("Can't call method on "+e);return e},Ny=S2,Dy=t0,_s=function(e){return Ny(Dy(e))},uc=typeof document=="object"&&document.all,Et=typeof uc>"u"&&uc!==void 0?function(e){return typeof e=="function"||e===uc}:function(e){return typeof e=="function"},My=Et,xr=function(e){return typeof e=="object"?e!==null:My(e)},cc=ct,Py=Et,ky=function(e){return Py(e)?e:void 0},An=function(e,t){return arguments.length<2?ky(cc[e]):cc[e]&&cc[e][t]},By=ft,lu=By({}.isPrototypeOf),Ly=ct,Zd=Ly.navigator,Qd=Zd&&Zd.userAgent,I2=Qd?String(Qd):"",T2=ct,fc=I2,qd=T2.process,Jd=T2.Deno,eh=qd&&qd.versions||Jd&&Jd.version,th=eh&&eh.v8,Fr,Cl;th&&(Fr=th.split("."),Cl=Fr[0]>0&&Fr[0]<4?1:+(Fr[0]+Fr[1]));!Cl&&fc&&(Fr=fc.match(/Edge\/(\d+)/),(!Fr||Fr[1]>=74)&&(Fr=fc.match(/Chrome\/(\d+)/),Fr&&(Cl=+Fr[1])));var R2=Cl,rh=R2,Fy=at,Uy=ct,jy=Uy.String,b2=!!Object.getOwnPropertySymbols&&!Fy(function(){var e=Symbol("symbol detection");return!jy(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&rh&&rh<41}),Wy=b2,_2=Wy&&!Symbol.sham&&typeof Symbol.iterator=="symbol",$y=An,Vy=Et,zy=lu,Hy=_2,Gy=Object,r0=Hy?function(e){return typeof e=="symbol"}:function(e){var t=$y("Symbol");return Vy(t)&&zy(t.prototype,Gy(e))},Xy=String,n0=function(e){try{return Xy(e)}catch{return"Object"}},Yy=Et,Ky=n0,Zy=TypeError,i0=function(e){if(Yy(e))return e;throw new Zy(Ky(e)+" is not a function")},Qy=i0,qy=bs,s0=function(e,t){var n=e[t];return qy(n)?void 0:Qy(n)},dc=Cn,hc=Et,gc=xr,Jy=TypeError,eE=function(e,t){var n,o;if(t==="string"&&hc(n=e.toString)&&!gc(o=dc(n,e))||hc(n=e.valueOf)&&!gc(o=dc(n,e))||t!=="string"&&hc(n=e.toString)&&!gc(o=dc(n,e)))return o;throw new Jy("Can't convert object to primitive value")},O2={exports:{}},nh=ct,tE=Object.defineProperty,o0=function(e,t){try{tE(nh,e,{value:t,configurable:!0,writable:!0})}catch{nh[e]=t}return t},rE=ct,nE=o0,ih="__core-js_shared__",sh=O2.exports=rE[ih]||nE(ih,{});(sh.versions||(sh.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 a0=O2.exports,oh=a0,iE=Object.create||Object,N2=function(e,t){return oh[e]||(oh[e]=t||iE(null))},sE=t0,oE=Object,Ko=function(e){return oE(sE(e))},aE=ft,lE=Ko,uE=aE({}.hasOwnProperty),ur=Object.hasOwn||function(t,n){return uE(lE(t),n)},cE=ft,fE=0,dE=Math.random(),hE=cE(1.1.toString),uu=function(e){return"Symbol("+(e===void 0?"":e)+")_"+hE(++fE+dE,36)},gE=ct,pE=N2,ah=ur,xE=uu,mE=b2,wE=_2,Gi=gE.Symbol,pc=pE("wks"),vE=wE?Gi.for||Gi:Gi&&Gi.withoutSetter||xE,Vr=function(e){return ah(pc,e)||(pc[e]=mE&&ah(Gi,e)?Gi[e]:vE("Symbol."+e)),pc[e]},yE=Cn,lh=xr,uh=r0,EE=s0,CE=eE,AE=Vr,SE=TypeError,IE=AE("toPrimitive"),TE=function(e,t){if(!lh(e)||uh(e))return e;var n=EE(e,IE),o;if(n){if(t===void 0&&(t="default"),o=yE(n,e,t),!lh(o)||uh(o))return o;throw new SE("Can't convert object to primitive value")}return t===void 0&&(t="number"),CE(e,t)},RE=TE,bE=r0,D2=function(e){var t=RE(e,"string");return bE(t)?t:t+""},_E=ct,ch=xr,Sf=_E.document,OE=ch(Sf)&&ch(Sf.createElement),M2=function(e){return OE?Sf.createElement(e):{}},NE=Yt,DE=at,ME=M2,P2=!NE&&!DE(function(){return Object.defineProperty(ME("div"),"a",{get:function(){return 7}}).a!==7}),PE=Yt,kE=Cn,BE=w2,LE=Ri,FE=_s,UE=D2,jE=ur,WE=P2,fh=Object.getOwnPropertyDescriptor;J1.f=PE?fh:function(t,n){if(t=FE(t),n=UE(n),WE)try{return fh(t,n)}catch{}if(jE(t,n))return LE(!kE(BE.f,t,n),t[n])};var mr={},$E=Yt,VE=at,k2=$E&&VE(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),zE=xr,HE=String,GE=TypeError,zr=function(e){if(zE(e))return e;throw new GE(HE(e)+" is not an object")},XE=Yt,YE=P2,KE=k2,Ea=zr,dh=D2,ZE=TypeError,xc=Object.defineProperty,QE=Object.getOwnPropertyDescriptor,mc="enumerable",wc="configurable",vc="writable";mr.f=XE?KE?function(t,n,o){if(Ea(t),n=dh(n),Ea(o),typeof t=="function"&&n==="prototype"&&"value"in o&&vc in o&&!o[vc]){var c=QE(t,n);c&&c[vc]&&(t[n]=o.value,o={configurable:wc in o?o[wc]:c[wc],enumerable:mc in o?o[mc]:c[mc],writable:!1})}return xc(t,n,o)}:xc:function(t,n,o){if(Ea(t),n=dh(n),Ea(o),YE)try{return xc(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 qE=Yt,JE=mr,e3=Ri,cu=qE?function(e,t,n){return JE.f(e,t,e3(1,n))}:function(e,t,n){return e[t]=n,e},B2={exports:{}},If=Yt,t3=ur,L2=Function.prototype,r3=If&&Object.getOwnPropertyDescriptor,F2=t3(L2,"name"),n3=F2&&(function(){}).name==="something",i3=F2&&(!If||If&&r3(L2,"name").configurable),U2={PROPER:n3,CONFIGURABLE:i3},s3=ft,o3=Et,Tf=a0,a3=s3(Function.toString);o3(Tf.inspectSource)||(Tf.inspectSource=function(e){return a3(e)});var j2=Tf.inspectSource,l3=ct,u3=Et,hh=l3.WeakMap,c3=u3(hh)&&/native code/.test(String(hh)),f3=N2,d3=uu,gh=f3("keys"),l0=function(e){return gh[e]||(gh[e]=d3(e))},fu={},h3=c3,W2=ct,g3=xr,p3=cu,yc=ur,Ec=a0,x3=l0,m3=fu,ph="Object already initialized",Rf=W2.TypeError,w3=W2.WeakMap,Al,Ro,Sl,v3=function(e){return Sl(e)?Ro(e):Al(e,{})},y3=function(e){return function(t){var n;if(!g3(t)||(n=Ro(t)).type!==e)throw new Rf("Incompatible receiver, "+e+" required");return n}};if(h3||Ec.state){var qr=Ec.state||(Ec.state=new w3);qr.get=qr.get,qr.has=qr.has,qr.set=qr.set,Al=function(e,t){if(qr.has(e))throw new Rf(ph);return t.facade=e,qr.set(e,t),t},Ro=function(e){return qr.get(e)||{}},Sl=function(e){return qr.has(e)}}else{var Wi=x3("state");m3[Wi]=!0,Al=function(e,t){if(yc(e,Wi))throw new Rf(ph);return t.facade=e,p3(e,Wi,t),t},Ro=function(e){return yc(e,Wi)?e[Wi]:{}},Sl=function(e){return yc(e,Wi)}}var du={set:Al,get:Ro,has:Sl,enforce:v3,getterFor:y3},u0=ft,E3=at,C3=Et,Ca=ur,bf=Yt,A3=U2.CONFIGURABLE,S3=j2,$2=du,I3=$2.enforce,T3=$2.get,xh=String,el=Object.defineProperty,R3=u0("".slice),b3=u0("".replace),_3=u0([].join),O3=bf&&!E3(function(){return el(function(){},"length",{value:8}).length!==8}),N3=String(String).split("String"),D3=B2.exports=function(e,t,n){R3(xh(t),0,7)==="Symbol("&&(t="["+b3(xh(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Ca(e,"name")||A3&&e.name!==t)&&(bf?el(e,"name",{value:t,configurable:!0}):e.name=t),O3&&n&&Ca(n,"arity")&&e.length!==n.arity&&el(e,"length",{value:n.arity});try{n&&Ca(n,"constructor")&&n.constructor?bf&&el(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var o=I3(e);return Ca(o,"source")||(o.source=_3(N3,typeof t=="string"?t:"")),e};Function.prototype.toString=D3(function(){return C3(this)&&T3(this).source||S3(this)},"toString");var V2=B2.exports,M3=Et,P3=mr,k3=V2,B3=o0,Jn=function(e,t,n,o){o||(o={});var c=o.enumerable,f=o.name!==void 0?o.name:t;if(M3(n)&&k3(n,f,o),o.global)c?e[t]=n:B3(t,n);else{try{o.unsafe?e[t]&&(c=!0):delete e[t]}catch{}c?e[t]=n:P3.f(e,t,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},hu={},L3=Math.ceil,F3=Math.floor,U3=Math.trunc||function(t){var n=+t;return(n>0?F3:L3)(n)},j3=U3,c0=function(e){var t=+e;return t!==t||t===0?0:j3(t)},W3=c0,$3=Math.max,V3=Math.min,z3=function(e,t){var n=W3(e);return n<0?$3(n+t,0):V3(n,t)},H3=c0,G3=Math.min,X3=function(e){var t=H3(e);return t>0?G3(t,9007199254740991):0},Y3=X3,Zo=function(e){return Y3(e.length)},K3=_s,Z3=z3,Q3=Zo,q3=function(e){return function(t,n,o){var c=K3(t),f=Q3(c);if(f===0)return!e&&-1;var g=Z3(o,f),m;if(e&&n!==n){for(;f>g;)if(m=c[g++],m!==m)return!0}else for(;f>g;g++)if((e||g in c)&&c[g]===n)return e||g||0;return!e&&-1}},J3={indexOf:q3(!1)},eC=ft,Cc=ur,tC=_s,rC=J3.indexOf,nC=fu,mh=eC([].push),z2=function(e,t){var n=tC(e),o=0,c=[],f;for(f in n)!Cc(nC,f)&&Cc(n,f)&&mh(c,f);for(;t.length>o;)Cc(n,f=t[o++])&&(~rC(c,f)||mh(c,f));return c},f0=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],iC=z2,sC=f0,oC=sC.concat("length","prototype");hu.f=Object.getOwnPropertyNames||function(t){return iC(t,oC)};var H2={};H2.f=Object.getOwnPropertySymbols;var aC=An,lC=ft,uC=hu,cC=H2,fC=zr,dC=lC([].concat),hC=aC("Reflect","ownKeys")||function(t){var n=uC.f(fC(t)),o=cC.f;return o?dC(n,o(t)):n},wh=ur,gC=hC,pC=J1,xC=mr,mC=function(e,t,n){for(var o=gC(t),c=xC.f,f=pC.f,g=0;g<o.length;g++){var m=o[g];!wh(e,m)&&!(n&&wh(n,m))&&c(e,m,f(t,m))}},wC=at,vC=Et,yC=/#|\.prototype\./,Qo=function(e,t){var n=CC[EC(e)];return n===SC?!0:n===AC?!1:vC(t)?wC(t):!!t},EC=Qo.normalize=function(e){return String(e).replace(yC,".").toLowerCase()},CC=Qo.data={},AC=Qo.NATIVE="N",SC=Qo.POLYFILL="P",G2=Qo,Aa=ct,IC=J1.f,TC=cu,RC=Jn,bC=o0,_C=mC,OC=G2,on=function(e,t){var n=e.target,o=e.global,c=e.stat,f,g,m,v,x,C;if(o?g=Aa:c?g=Aa[n]||bC(n,{}):g=Aa[n]&&Aa[n].prototype,g)for(m in t){if(x=t[m],e.dontCallGetSet?(C=IC(g,m),v=C&&C.value):v=g[m],f=OC(o?m:n+(c?".":"#")+m,e.forced),!f&&v!==void 0){if(typeof x==typeof v)continue;_C(x,v)}(e.sham||v&&v.sham)&&TC(x,"sham",!0),RC(g,m,x,e)}},X2={},NC=z2,DC=f0,Y2=Object.keys||function(t){return NC(t,DC)},MC=Yt,PC=k2,kC=mr,BC=zr,LC=_s,FC=Y2;X2.f=MC&&!PC?Object.defineProperties:function(t,n){BC(t);for(var o=LC(n),c=FC(n),f=c.length,g=0,m;f>g;)kC.f(t,m=c[g++],o[m]);return t};var UC=An,jC=UC("document","documentElement"),WC=zr,$C=X2,vh=f0,VC=fu,zC=jC,HC=M2,GC=l0,yh=">",Eh="<",_f="prototype",Of="script",K2=GC("IE_PROTO"),Ac=function(){},Z2=function(e){return Eh+Of+yh+e+Eh+"/"+Of+yh},Ch=function(e){e.write(Z2("")),e.close();var t=e.parentWindow.Object;return e=null,t},XC=function(){var e=HC("iframe"),t="java"+Of+":",n;return e.style.display="none",zC.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(Z2("document.F=Object")),n.close(),n.F},Sa,tl=function(){try{Sa=new ActiveXObject("htmlfile")}catch{}tl=typeof document<"u"?document.domain&&Sa?Ch(Sa):XC():Ch(Sa);for(var e=vh.length;e--;)delete tl[_f][vh[e]];return tl()};VC[K2]=!0;var gu=Object.create||function(t,n){var o;return t!==null?(Ac[_f]=WC(t),o=new Ac,Ac[_f]=null,o[K2]=t):o=tl(),n===void 0?o:$C.f(o,n)},YC=Vr,KC=gu,ZC=mr.f,Nf=YC("unscopables"),Df=Array.prototype;Df[Nf]===void 0&&ZC(Df,Nf,{configurable:!0,value:KC(null)});var pu=function(e){Df[Nf][e]=!0},QC=on,qC=Ko,JC=Zo,eA=c0,tA=pu;QC({target:"Array",proto:!0},{at:function(t){var n=qC(this),o=JC(n),c=eA(t),f=c>=0?c:o+c;return f<0||f>=o?void 0:n[f]}});tA("at");var rA=ct,nA=ft,d0=function(e,t){return nA(rA[e].prototype[t])},iA=d0;iA("Array","at");var sA=bi,oA=ft,aA=function(e){if(sA(e)==="Function")return oA(e)},Ah=aA,lA=i0,uA=e0,cA=Ah(Ah.bind),h0=function(e,t){return lA(e),t===void 0?e:uA?cA(e,t):function(){return e.apply(t,arguments)}},fA=h0,dA=S2,hA=Ko,gA=Zo,Sh=function(e){var t=e===1;return function(n,o,c){for(var f=hA(n),g=dA(f),m=gA(g),v=fA(o,c),x,C;m-- >0;)if(x=g[m],C=v(x,m,f),C)switch(e){case 0:return x;case 1:return m}return t?-1:void 0}},Q2={findLast:Sh(0),findLastIndex:Sh(1)},pA=on,xA=Q2.findLast,mA=pu;pA({target:"Array",proto:!0},{findLast:function(t){return xA(this,t,arguments.length>1?arguments[1]:void 0)}});mA("findLast");var wA=d0;wA("Array","findLast");var vA=on,yA=Q2.findLastIndex,EA=pu;vA({target:"Array",proto:!0},{findLastIndex:function(t){return yA(this,t,arguments.length>1?arguments[1]:void 0)}});EA("findLastIndex");var CA=d0;CA("Array","findLastIndex");var AA=Vr,SA=AA("toStringTag"),q2={};q2[SA]="z";var g0=String(q2)==="[object z]",IA=g0,TA=Et,rl=bi,RA=Vr,bA=RA("toStringTag"),_A=Object,OA=rl(function(){return arguments}())==="Arguments",NA=function(e,t){try{return e[t]}catch{}},xu=IA?rl:function(e){var t,n,o;return e===void 0?"Undefined":e===null?"Null":typeof(n=NA(t=_A(e),bA))=="string"?n:OA?rl(t):(o=rl(t))==="Object"&&TA(t.callee)?"Arguments":o},DA=xu,MA=String,PA=function(e){if(DA(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return MA(e)},kA=PA,p0=function(e,t){return e===void 0?arguments.length<2?"":t:kA(e)},BA=Yt,LA=at,FA=zr,Ih=p0,nl=Error.prototype.toString,UA=LA(function(){if(BA){var e=Object.create(Object.defineProperty({},"name",{get:function(){return this===e}}));if(nl.call(e)!=="true")return!0}return nl.call({message:1,name:2})!=="2: 1"||nl.call({})!=="Error"}),J2=UA?function(){var t=FA(this),n=Ih(t.name,"Error"),o=Ih(t.message);return n?o?n+": "+o:n:o}:nl,jA=Jn,Th=J2,Rh=Error.prototype;Rh.toString!==Th&&jA(Rh,"toString",Th);var mu=Object.create?Object.create(null):{},WA=at,$A=!WA(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),VA=ur,zA=Et,HA=Ko,GA=l0,XA=$A,bh=GA("IE_PROTO"),Mf=Object,YA=Mf.prototype,ex=XA?Mf.getPrototypeOf:function(e){var t=HA(e);if(VA(t,bh))return t[bh];var n=t.constructor;return zA(n)&&t instanceof n?n.prototype:t instanceof Mf?YA:null},KA=at,ZA=Et,QA=xr,_h=ex,qA=Jn,JA=Vr,Pf=JA("iterator"),tx=!1,yi,Sc,Ic;[].keys&&(Ic=[].keys(),"next"in Ic?(Sc=_h(_h(Ic)),Sc!==Object.prototype&&(yi=Sc)):tx=!0);var eS=!QA(yi)||KA(function(){var e={};return yi[Pf].call(e)!==e});eS&&(yi={});ZA(yi[Pf])||qA(yi,Pf,function(){return this});var rx={IteratorPrototype:yi,BUGGY_SAFARI_ITERATORS:tx},tS=mr.f,rS=ur,nS=Vr,Oh=nS("toStringTag"),wu=function(e,t,n){e&&!n&&(e=e.prototype),e&&!rS(e,Oh)&&tS(e,Oh,{configurable:!0,value:t})},iS=rx.IteratorPrototype,sS=gu,oS=Ri,aS=wu,lS=mu,uS=function(){return this},cS=function(e,t,n,o){var c=t+" Iterator";return e.prototype=sS(iS,{next:oS(+!o,n)}),aS(e,c,!1),lS[c]=uS,e},fS=ft,dS=i0,hS=function(e,t,n){try{return fS(dS(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},gS=xr,pS=function(e){return gS(e)||e===null},xS=pS,mS=String,wS=TypeError,vS=function(e){if(xS(e))return e;throw new wS("Can't set "+mS(e)+" as a prototype")},yS=hS,ES=xr,CS=t0,AS=vS,nx=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},n;try{n=yS(Object.prototype,"__proto__","set"),n(t,[]),e=t instanceof Array}catch{}return function(c,f){return CS(c),AS(f),ES(c)&&(e?n(c,f):c.__proto__=f),c}}():void 0),SS=on,IS=Cn,ix=U2,TS=Et,RS=cS,Nh=ex,Dh=nx,bS=wu,_S=cu,Tc=Jn,OS=Vr,NS=mu,sx=rx,DS=ix.PROPER,MS=ix.CONFIGURABLE,Mh=sx.IteratorPrototype,Ia=sx.BUGGY_SAFARI_ITERATORS,Hs=OS("iterator"),Ph="keys",Gs="values",kh="entries",PS=function(){return this},ox=function(e,t,n,o,c,f,g){RS(n,t,o);var m=function(N){if(N===c&&I)return I;if(!Ia&&N&&N in C)return C[N];switch(N){case Ph:return function(){return new n(this,N)};case Gs:return function(){return new n(this,N)};case kh:return function(){return new n(this,N)}}return function(){return new n(this)}},v=t+" Iterator",x=!1,C=e.prototype,A=C[Hs]||C["@@iterator"]||c&&C[c],I=!Ia&&A||m(c),O=t==="Array"&&C.entries||A,k,M,G;if(O&&(k=Nh(O.call(new e)),k!==Object.prototype&&k.next&&(Nh(k)!==Mh&&(Dh?Dh(k,Mh):TS(k[Hs])||Tc(k,Hs,PS)),bS(k,v,!0))),DS&&c===Gs&&A&&A.name!==Gs&&(MS?_S(C,"name",Gs):(x=!0,I=function(){return IS(A,this)})),c)if(M={values:m(Gs),keys:f?I:m(Ph),entries:m(kh)},g)for(G in M)(Ia||x||!(G in C))&&Tc(C,G,M[G]);else SS({target:t,proto:!0,forced:Ia||x},M);return C[Hs]!==I&&Tc(C,Hs,I,{name:c}),NS[t]=I,M},ax=function(e,t){return{value:e,done:t}},kS=_s,x0=pu,Bh=mu,lx=du,BS=mr.f,LS=ox,Ta=ax,FS=Yt,ux="Array Iterator",US=lx.set,jS=lx.getterFor(ux);LS(Array,"Array",function(e,t){US(this,{type:ux,target:kS(e),index:0,kind:t})},function(){var e=jS(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,Ta(void 0,!0);switch(e.kind){case"keys":return Ta(n,!1);case"values":return Ta(t[n],!1)}return Ta([n,t[n]],!1)},"values");var Lh=Bh.Arguments=Bh.Array;x0("keys");x0("values");x0("entries");if(FS&&Lh.name!=="values")try{BS(Lh,"name",{value:"values"})}catch{}var WS=on,$S=Ko,cx=Y2,VS=at,zS=VS(function(){cx(1)});WS({target:"Object",stat:!0,forced:zS},{keys:function(t){return cx($S(t))}});var HS=g0,GS=xu,XS=HS?{}.toString:function(){return"[object "+GS(this)+"]"},YS=g0,KS=Jn,ZS=XS;YS||KS(Object.prototype,"toString",ZS,{unsafe:!0});var fx={exports:{}},dx={},QS=ft,qS=QS([].slice),JS=bi,e8=_s,hx=hu.f,t8=qS,gx=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],r8=function(e){try{return hx(e)}catch{return t8(gx)}};dx.f=function(t){return gx&&JS(t)==="Window"?r8(t):hx(e8(t))};var n8=at,i8=n8(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),s8=at,o8=xr,a8=bi,Fh=i8,il=Object.isExtensible,l8=s8(function(){il(1)}),u8=l8||Fh?function(t){return!o8(t)||Fh&&a8(t)==="ArrayBuffer"?!1:il?il(t):!0}:il,c8=at,f8=!c8(function(){return Object.isExtensible(Object.preventExtensions({}))}),d8=on,h8=ft,g8=fu,p8=xr,m0=ur,x8=mr.f,Uh=hu,m8=dx,w0=u8,w8=uu,v8=f8,px=!1,xn=w8("meta"),y8=0,v0=function(e){x8(e,xn,{value:{objectID:"O"+y8++,weakData:{}}})},E8=function(e,t){if(!p8(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!m0(e,xn)){if(!w0(e))return"F";if(!t)return"E";v0(e)}return e[xn].objectID},C8=function(e,t){if(!m0(e,xn)){if(!w0(e))return!0;if(!t)return!1;v0(e)}return e[xn].weakData},A8=function(e){return v8&&px&&w0(e)&&!m0(e,xn)&&v0(e),e},S8=function(){I8.enable=function(){},px=!0;var e=Uh.f,t=h8([].splice),n={};n[xn]=1,e(n).length&&(Uh.f=function(o){for(var c=e(o),f=0,g=c.length;f<g;f++)if(c[f]===xn){t(c,f,1);break}return c},d8({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:m8.f}))},I8=fx.exports={enable:S8,fastKey:E8,getWeakData:C8,onFreeze:A8};g8[xn]=!0;var xx=fx.exports,T8=Vr,R8=mu,b8=T8("iterator"),_8=Array.prototype,O8=function(e){return e!==void 0&&(R8.Array===e||_8[b8]===e)},N8=bi,D8=bs,jh=s0,M8=Vr,Wh=M8("iterator"),P8=Array.prototype,mx=function(e){if(!D8(e))return jh(e,Wh)||jh(e,"@@iterator")||(N8(e)==="Arguments"?P8[Wh]:void 0)},k8=Cn,B8=Et,L8=zr,F8=n0,U8=mx,j8=TypeError,W8=function(e,t){var n=arguments.length<2?U8(e):t;if(B8(n))return L8(k8(n,e));throw new j8(F8(e)+" is not iterable")},$8=Cn,$h=zr,V8=s0,z8=function(e,t,n){var o,c;$h(e);try{if(o=V8(e,"return"),!o){if(t==="throw")throw n;return n}o=$8(o,e)}catch(f){c=!0,o=f}if(t==="throw")throw n;if(c)throw o;return $h(o),n},H8=h0,G8=Cn,X8=zr,Y8=n0,K8=O8,Z8=Zo,Vh=lu,Q8=W8,q8=mx,zh=z8,J8=TypeError,sl=function(e,t){this.stopped=e,this.result=t},Hh=sl.prototype,y0=function(e,t,n){var o=n&&n.that,c=!!(n&&n.AS_ENTRIES),f=!!(n&&n.IS_RECORD),g=!!(n&&n.IS_ITERATOR),m=!!(n&&n.INTERRUPTED),v=H8(t,o),x,C,A,I,O,k,M,G=function(_){var U=x;return x=void 0,U&&zh(U,"normal"),new sl(!0,_)},N=function(_){return c?(X8(_),m?v(_[0],_[1],G):v(_[0],_[1])):m?v(_,G):v(_)};if(f)x=e.iterator;else if(g)x=e;else{if(C=q8(e),!C)throw new J8(Y8(e)+" is not iterable");if(K8(C)){for(A=0,I=Z8(e);I>A;A++)if(O=N(e[A]),O&&Vh(Hh,O))return O;return new sl(!1)}x=Q8(e,C)}for(k=f?e.next:x.next;!(M=G8(k,x)).done;){var T=M.value;try{O=N(T)}catch(_){if(x)zh(x,"throw",_);else throw _}if(typeof O=="object"&&O&&Vh(Hh,O))return O}return new sl(!1)},e4=lu,t4=TypeError,vu=function(e,t){if(e4(t,e))return e;throw new t4("Incorrect invocation")},r4=Vr,wx=r4("iterator"),vx=!1;try{var n4=0,Gh={next:function(){return{done:!!n4++}},return:function(){vx=!0}};Gh[wx]=function(){return this},Array.from(Gh,function(){throw 2})}catch{}var i4=function(e,t){try{if(!t&&!vx)return!1}catch{return!1}var n=!1;try{var o={};o[wx]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch{}return n},s4=Et,o4=xr,Xh=nx,yx=function(e,t,n){var o,c;return Xh&&s4(o=t.constructor)&&o!==n&&o4(c=o.prototype)&&c!==n.prototype&&Xh(e,c),e},a4=on,l4=ct,u4=ft,Yh=G2,c4=Jn,f4=xx,d4=y0,h4=vu,g4=Et,p4=bs,Rc=xr,bc=at,x4=i4,m4=wu,w4=yx,Ex=function(e,t,n){var o=e.indexOf("Map")!==-1,c=e.indexOf("Weak")!==-1,f=o?"set":"add",g=l4[e],m=g&&g.prototype,v=g,x={},C=function(N){var T=u4(m[N]);c4(m,N,N==="add"?function(U){return T(this,U===0?0:U),this}:N==="delete"?function(_){return c&&!Rc(_)?!1:T(this,_===0?0:_)}:N==="get"?function(U){return c&&!Rc(U)?void 0:T(this,U===0?0:U)}:N==="has"?function(U){return c&&!Rc(U)?!1:T(this,U===0?0:U)}:function(U,z){return T(this,U===0?0:U,z),this})},A=Yh(e,!g4(g)||!(c||m.forEach&&!bc(function(){new g().entries().next()})));if(A)v=n.getConstructor(t,e,o,f),f4.enable();else if(Yh(e,!0)){var I=new v,O=I[f](c?{}:-0,1)!==I,k=bc(function(){I.has(1)}),M=x4(function(N){new g(N)}),G=!c&&bc(function(){for(var N=new g,T=5;T--;)N[f](T,T);return!N.has(-0)});M||(v=t(function(N,T){h4(N,m);var _=w4(new g,N,v);return p4(T)||d4(T,_[f],{that:_,AS_ENTRIES:o}),_}),v.prototype=m,m.constructor=v),(k||G)&&(C("delete"),C("has"),o&&C("get")),(G||O)&&C(f),c&&m.clear&&delete m.clear}return x[e]=v,a4({global:!0,constructor:!0,forced:v!==g},x),m4(v,e),c||n.setStrong(v,e,o),v},Kh=V2,v4=mr,E0=function(e,t,n){return n.get&&Kh(n.get,t,{getter:!0}),n.set&&Kh(n.set,t,{setter:!0}),v4.f(e,t,n)},y4=Jn,E4=function(e,t,n){for(var o in t)y4(e,o,t[o],n);return e},C4=An,A4=E0,S4=Vr,I4=Yt,Zh=S4("species"),T4=function(e){var t=C4(e);I4&&t&&!t[Zh]&&A4(t,Zh,{configurable:!0,get:function(){return this}})},Qh=gu,R4=E0,qh=E4,b4=h0,_4=vu,O4=bs,N4=y0,D4=ox,Ra=ax,M4=T4,Xs=Yt,Jh=xx.fastKey,Cx=du,eg=Cx.set,_c=Cx.getterFor,Ax={getConstructor:function(e,t,n,o){var c=e(function(x,C){_4(x,f),eg(x,{type:t,index:Qh(null),first:null,last:null,size:0}),Xs||(x.size=0),O4(C)||N4(C,x[o],{that:x,AS_ENTRIES:n})}),f=c.prototype,g=_c(t),m=function(x,C,A){var I=g(x),O=v(x,C),k,M;return O?O.value=A:(I.last=O={index:M=Jh(C,!0),key:C,value:A,previous:k=I.last,next:null,removed:!1},I.first||(I.first=O),k&&(k.next=O),Xs?I.size++:x.size++,M!=="F"&&(I.index[M]=O)),x},v=function(x,C){var A=g(x),I=Jh(C),O;if(I!=="F")return A.index[I];for(O=A.first;O;O=O.next)if(O.key===C)return O};return qh(f,{clear:function(){for(var C=this,A=g(C),I=A.first;I;)I.removed=!0,I.previous&&(I.previous=I.previous.next=null),I=I.next;A.first=A.last=null,A.index=Qh(null),Xs?A.size=0:C.size=0},delete:function(x){var C=this,A=g(C),I=v(C,x);if(I){var O=I.next,k=I.previous;delete A.index[I.index],I.removed=!0,k&&(k.next=O),O&&(O.previous=k),A.first===I&&(A.first=O),A.last===I&&(A.last=k),Xs?A.size--:C.size--}return!!I},forEach:function(C){for(var A=g(this),I=b4(C,arguments.length>1?arguments[1]:void 0),O;O=O?O.next:A.first;)for(I(O.value,O.key,this);O&&O.removed;)O=O.previous},has:function(C){return!!v(this,C)}}),qh(f,n?{get:function(C){var A=v(this,C);return A&&A.value},set:function(C,A){return m(this,C===0?0:C,A)}}:{add:function(C){return m(this,C=C===0?0:C,C)}}),Xs&&R4(f,"size",{configurable:!0,get:function(){return g(this).size}}),c},setStrong:function(e,t,n){var o=t+" Iterator",c=_c(t),f=_c(o);D4(e,t,function(g,m){eg(this,{type:o,target:g,state:c(g),kind:m,last:null})},function(){for(var g=f(this),m=g.kind,v=g.last;v&&v.removed;)v=v.previous;return!g.target||!(g.last=v=v?v.next:g.state.first)?(g.target=null,Ra(void 0,!0)):Ra(m==="keys"?v.key:m==="values"?v.value:[v.key,v.value],!1)},n?"entries":"values",!n,!0),M4(t)}},P4=Ex,k4=Ax;P4("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},k4);var B4=Ex,L4=Ax;B4("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},L4);var Ys=ct,F4=I2,U4=bi,ba=function(e){return F4.slice(0,e.length)===e},Sx=function(){return ba("Bun/")?"BUN":ba("Cloudflare-Workers")?"CLOUDFLARE":ba("Deno/")?"DENO":ba("Node.js/")?"NODE":Ys.Bun&&typeof Bun.version=="string"?"BUN":Ys.Deno&&typeof Deno.version=="object"?"DENO":U4(Ys.process)==="process"?"NODE":Ys.window&&Ys.document?"BROWSER":"REST"}(),j4=Sx,W4=j4==="NODE",$4=ct,V4=W4,Ix=function(e){if(V4){try{return $4.process.getBuiltinModule(e)}catch{}try{return Function('return require("'+e+'")')()}catch{}}},Tx={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}},z4=ft,Rx=Error,H4=z4("".replace),G4=function(e){return String(new Rx(e).stack)}("zxcasd"),bx=/\n\s*at [^:]*:[^\n]*/,X4=bx.test(G4),_x=function(e,t){if(X4&&typeof e=="string"&&!Rx.prepareStackTrace)for(;t--;)e=H4(e,bx,"");return e},Y4=on,Il=An,K4=Ix,C0=at,Z4=gu,A0=Ri,Tl=mr.f,Q4=Jn,ol=E0,al=ur,q4=vu,J4=zr,Ox=J2,tg=p0,as=Tx,eI=_x,Nx=du,S0=Yt,ps="DOMException",kf="DATA_CLONE_ERR",yu=Il("Error"),mn=Il(ps)||function(){try{var e=Il("MessageChannel")||K4("worker_threads").MessageChannel;new e().port1.postMessage(new WeakMap)}catch(t){if(t.name===kf&&t.code===25)return t.constructor}}(),tI=mn&&mn.prototype,Dx=yu.prototype,rI=Nx.set,nI=Nx.getterFor(ps),iI="stack"in new yu(ps),Mx=function(e){return al(as,e)&&as[e].m?as[e].c:0},I0=function(){q4(this,go);var t=arguments.length,n=tg(t<1?void 0:arguments[0]),o=tg(t<2?void 0:arguments[1],"Error"),c=Mx(o);if(rI(this,{type:ps,name:o,message:n,code:c}),S0||(this.name=o,this.message=n,this.code=c),iI){var f=new yu(n);f.name=ps,Tl(this,"stack",A0(1,eI(f.stack,1)))}},go=I0.prototype=Z4(Dx),Px=function(e){return{enumerable:!0,configurable:!0,get:e}},Oc=function(e){return Px(function(){return nI(this)[e]})};S0&&(ol(go,"code",Oc("code")),ol(go,"message",Oc("message")),ol(go,"name",Oc("name")));Tl(go,"constructor",A0(1,I0));var Eu=C0(function(){return!(new mn instanceof yu)}),sI=Eu||C0(function(){return Dx.toString!==Ox||String(new mn(1,2))!=="2: 1"}),oI=Eu||C0(function(){return new mn(1,"DataCloneError").code!==25});Eu||mn[kf]!==25||tI[kf];var rg=Eu;Y4({global:!0,constructor:!0,forced:rg},{DOMException:rg?I0:mn});var bo=Il(ps),Rl=bo.prototype;sI&&mn===bo&&Q4(Rl,"toString",Ox);oI&&S0&&mn===bo&&ol(Rl,"code",Px(function(){return Mx(J4(this).name)}));for(var ng in as)if(al(as,ng)){var ig=as[ng],_a=ig.s,sg=A0(6,ig.c);al(bo,_a)||Tl(bo,_a,sg),al(Rl,_a)||Tl(Rl,_a,sg)}var aI=on,lI=ct,T0=An,Bf=Ri,Lf=mr.f,og=ur,uI=vu,cI=yx,ag=p0,Nc=Tx,fI=_x,dI=Yt,qo="DOMException",kx=T0("Error"),Jo=T0(qo),R0=function(){uI(this,hI);var t=arguments.length,n=ag(t<1?void 0:arguments[0]),o=ag(t<2?void 0:arguments[1],"Error"),c=new Jo(n,o),f=new kx(n);return f.name=qo,Lf(c,"stack",Bf(1,fI(f.stack,1))),cI(c,this,R0),c},hI=R0.prototype=Jo.prototype,gI="stack"in new kx(qo),pI="stack"in new Jo(1,2),Dc=Jo&&dI&&Object.getOwnPropertyDescriptor(lI,qo),xI=!!Dc&&!(Dc.writable&&Dc.configurable),lg=gI&&!xI&&!pI;aI({global:!0,constructor:!0,forced:lg},{DOMException:lg?R0:Jo});var so=T0(qo),ug=so.prototype;if(ug.constructor!==so){Lf(ug,"constructor",Bf(1,so));for(var cg in Nc)if(og(Nc,cg)){var fg=Nc[cg],dg=fg.s;og(so,dg)||Lf(so,dg,Bf(6,fg.c))}}var mI=An,wI=wu,hg="DOMException";wI(mI(hg),hg);var vI=ft,yI=at,Bx=Et,EI=xu,CI=An,AI=j2,Lx=function(){},Fx=CI("Reflect","construct"),b0=/^\s*(?:class|function)\b/,SI=vI(b0.exec),II=!b0.test(Lx),Ks=function(t){if(!Bx(t))return!1;try{return Fx(Lx,[],t),!0}catch{return!1}},Ux=function(t){if(!Bx(t))return!1;switch(EI(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return II||!!SI(b0,AI(t))}catch{return!0}};Ux.sham=!0;var TI=!Fx||yI(function(){var e;return Ks(Ks.call)||!Ks(Object)||!Ks(function(){e=!0})||e})?Ux:Ks,RI=Yt,bI=mr,_I=Ri,OI=function(e,t,n){RI?bI.f(e,t,_I(0,n)):e[t]=n},NI=TypeError,DI=function(e,t){if(e<t)throw new NI("Not enough arguments");return e},MI=ct,PI=at,gg=MI.RegExp,kI=!PI(function(){var e=!0;try{gg(".","d")}catch{e=!1}var t={},n="",o=e?"dgimsy":"gimsy",c=function(v,x){Object.defineProperty(t,v,{get:function(){return n+=x,!0}})},f={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};e&&(f.hasIndices="d");for(var g in f)c(g,f[g]);var m=Object.getOwnPropertyDescriptor(gg.prototype,"flags").get.call(t);return m!==o||n!==o}),BI={correct:kI},LI=zr,FI=function(){var e=LI(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},UI=Cn,jI=ur,WI=lu,pg=BI,$I=FI,VI=RegExp.prototype,zI=pg.correct?function(e){return e.flags}:function(e){return!pg.correct&&WI(VI,e)&&!jI(e,"flags")?UI($I,e):e.flags},Oa=ft,Na=Map.prototype,HI={Map,set:Oa(Na.set),get:Oa(Na.get),has:Oa(Na.has),remove:Oa(Na.delete)},Mc=ft,Da=Set.prototype,jx={Set,add:Mc(Da.add),has:Mc(Da.has),remove:Mc(Da.delete),proto:Da},GI=Cn,XI=function(e,t,n){for(var o=n?e:e.iterator,c=e.next,f,g;!(f=GI(c,o)).done;)if(g=t(f.value),g!==void 0)return g},Wx=ft,YI=XI,$x=jx,KI=$x.Set,Vx=$x.proto,ZI=Wx(Vx.forEach),zx=Wx(Vx.keys),QI=zx(new KI).next,qI=function(e,t,n){return n?YI({iterator:zx(e),next:QI},t):ZI(e,t)},JI=ct,e6=at,Pc=R2,kc=Sx,xg=JI.structuredClone,Hx=!!xg&&!e6(function(){if(kc==="DENO"&&Pc>92||kc==="NODE"&&Pc>94||kc==="BROWSER"&&Pc>97)return!1;var e=new ArrayBuffer(8),t=xg(e,{transfer:[e]});return e.byteLength!==0||t.byteLength!==8}),_0=ct,t6=Ix,r6=Hx,n6=_0.structuredClone,mg=_0.ArrayBuffer,Ma=_0.MessageChannel,Ff=!1,Bc,wg,Pa,Lc;if(r6)Ff=function(e){n6(e,{transfer:[e]})};else if(mg)try{Ma||(Bc=t6("worker_threads"),Bc&&(Ma=Bc.MessageChannel)),Ma&&(wg=new Ma,Pa=new mg(2),Lc=function(e){wg.port1.postMessage(null,[e])},Pa.byteLength===2&&(Lc(Pa),Pa.byteLength===0&&(Ff=Lc)))}catch{}var i6=Ff,s6=at,o6=Ri,a6=!s6(function(){var e=new Error("a");return"stack"in e?(Object.defineProperty(e,"stack",o6(1,7)),e.stack!==7):!0}),l6=on,Pt=ct,po=An,ea=ft,O0=at,u6=uu,xs=Et,c6=TI,f6=bs,Cu=xr,d6=r0,h6=y0,Gx=zr,bl=xu,g6=ur,p6=OI,Fc=cu,ll=Zo,x6=DI,m6=zI,Au=HI,N0=jx,w6=qI,vg=i6,v6=a6,D0=Hx,oo=Pt.Object,y6=Pt.Array,Xx=Pt.Date,Yx=Pt.Error,E6=Pt.TypeError,C6=Pt.PerformanceMark,Ei=po("DOMException"),Uf=Au.Map,M0=Au.has,Kx=Au.get,_l=Au.set,Zx=N0.Set,Qx=N0.add,A6=N0.has,S6=po("Object","keys"),I6=ea([].push),T6=ea((!0).valueOf),R6=ea(1.1.valueOf),b6=ea("".valueOf),_6=ea(Xx.prototype.getTime),jf=u6("structuredClone"),_o="DataCloneError",ul="Transferring",qx=function(e){return!O0(function(){var t=new Pt.Set([7]),n=e(t),o=e(oo(7));return n===t||!n.has(7)||!Cu(o)||+o!=7})&&e},yg=function(e,t){return!O0(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)})},O6=function(e){return!O0(function(){var t=e(new Pt.AggregateError([1],jf,{cause:3}));return t.name!=="AggregateError"||t.errors[0]!==1||t.message!==jf||t.cause!==3})},mi=Pt.structuredClone,N6=!yg(mi,Yx)||!yg(mi,Ei)||!O6(mi),D6=!mi&&qx(function(e){return new C6(jf,{detail:e}).detail}),Un=qx(mi)||D6,Uc=function(e){throw new Ei("Uncloneable type: "+e,_o)},nr=function(e,t){throw new Ei((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",_o)},jc=function(e,t){return Un||nr(t),Un(e)},M6=function(){var e;try{e=new Pt.DataTransfer}catch{try{e=new Pt.ClipboardEvent("").clipboardData}catch{}}return e&&e.items&&e.files?e:null},Jx=function(e,t,n){if(M0(t,e))return Kx(t,e);var o=n||bl(e),c,f,g,m,v,x;if(o==="SharedArrayBuffer")Un?c=Un(e):c=e;else{var C=Pt.DataView;!C&&!xs(e.slice)&&nr("ArrayBuffer");try{if(xs(e.slice)&&!e.resizable)c=e.slice(0);else for(f=e.byteLength,g=("maxByteLength"in e)?{maxByteLength:e.maxByteLength}:void 0,c=new ArrayBuffer(f,g),m=new C(e),v=new C(c),x=0;x<f;x++)v.setUint8(x,m.getUint8(x))}catch{throw new Ei("ArrayBuffer is detached",_o)}}return _l(t,e,c),c},P6=function(e,t,n,o,c){var f=Pt[t];return Cu(f)||nr(t),new f(Jx(e.buffer,c),n,o)},Nt=function(e,t){if(d6(e)&&Uc("Symbol"),!Cu(e))return e;if(t){if(M0(t,e))return Kx(t,e)}else t=new Uf;var n=bl(e),o,c,f,g,m,v,x,C;switch(n){case"Array":f=y6(ll(e));break;case"Object":f={};break;case"Map":f=new Uf;break;case"Set":f=new Zx;break;case"RegExp":f=new RegExp(e.source,m6(e));break;case"Error":switch(c=e.name,c){case"AggregateError":f=new(po(c))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":f=new(po(c));break;case"CompileError":case"LinkError":case"RuntimeError":f=new(po("WebAssembly",c));break;default:f=new Yx}break;case"DOMException":f=new Ei(e.message,e.name);break;case"ArrayBuffer":case"SharedArrayBuffer":f=Jx(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":v=n==="DataView"?e.byteLength:e.length,f=P6(e,n,e.byteOffset,v,t);break;case"DOMQuad":try{f=new DOMQuad(Nt(e.p1,t),Nt(e.p2,t),Nt(e.p3,t),Nt(e.p4,t))}catch{f=jc(e,n)}break;case"File":if(Un)try{f=Un(e),bl(f)!==n&&(f=void 0)}catch{}if(!f)try{f=new File([e],e.name,e)}catch{}f||nr(n);break;case"FileList":if(g=M6(),g){for(m=0,v=ll(e);m<v;m++)g.items.add(Nt(e[m],t));f=g.files}else f=jc(e,n);break;case"ImageData":try{f=new ImageData(Nt(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch{f=jc(e,n)}break;default:if(Un)f=Un(e);else switch(n){case"BigInt":f=oo(e.valueOf());break;case"Boolean":f=oo(T6(e));break;case"Number":f=oo(R6(e));break;case"String":f=oo(b6(e));break;case"Date":f=new Xx(_6(e));break;case"Blob":try{f=e.slice(0,e.size,e.type)}catch{nr(n)}break;case"DOMPoint":case"DOMPointReadOnly":o=Pt[n];try{f=o.fromPoint?o.fromPoint(e):new o(e.x,e.y,e.z,e.w)}catch{nr(n)}break;case"DOMRect":case"DOMRectReadOnly":o=Pt[n];try{f=o.fromRect?o.fromRect(e):new o(e.x,e.y,e.width,e.height)}catch{nr(n)}break;case"DOMMatrix":case"DOMMatrixReadOnly":o=Pt[n];try{f=o.fromMatrix?o.fromMatrix(e):new o(e)}catch{nr(n)}break;case"AudioData":case"VideoFrame":xs(e.clone)||nr(n);try{f=e.clone()}catch{Uc(n)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":nr(n);default:Uc(n)}}switch(_l(t,e,f),n){case"Array":case"Object":for(x=S6(e),m=0,v=ll(x);m<v;m++)C=x[m],p6(f,C,Nt(e[C],t));break;case"Map":e.forEach(function(A,I){_l(f,Nt(I,t),Nt(A,t))});break;case"Set":e.forEach(function(A){Qx(f,Nt(A,t))});break;case"Error":Fc(f,"message",Nt(e.message,t)),g6(e,"cause")&&Fc(f,"cause",Nt(e.cause,t)),c==="AggregateError"?f.errors=Nt(e.errors,t):c==="SuppressedError"&&(f.error=Nt(e.error,t),f.suppressed=Nt(e.suppressed,t));case"DOMException":v6&&Fc(f,"stack",Nt(e.stack,t))}return f},k6=function(e,t){if(!Cu(e))throw new E6("Transfer option cannot be converted to a sequence");var n=[];h6(e,function(I){I6(n,Gx(I))});for(var o=0,c=ll(n),f=new Zx,g,m,v,x,C,A;o<c;){if(g=n[o++],m=bl(g),x=void 0,m==="ArrayBuffer"?A6(f,g):M0(t,g))throw new Ei("Duplicate transferable",_o);if(m==="ArrayBuffer"){Qx(f,g);continue}if(D0)x=mi(g,{transfer:[g]});else switch(m){case"ImageBitmap":v=Pt.OffscreenCanvas,c6(v)||nr(m,ul);try{C=new v(g.width,g.height),A=C.getContext("bitmaprenderer"),A.transferFromImageBitmap(g),x=C.transferToImageBitmap()}catch{}break;case"AudioData":case"VideoFrame":(!xs(g.clone)||!xs(g.close))&&nr(m,ul);try{x=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":nr(m,ul)}if(x===void 0)throw new Ei("This object cannot be transferred: "+m,_o);_l(t,g,x)}return f},B6=function(e){w6(e,function(t){D0?mi(t,{transfer:[t]}):xs(t.transfer)?t.transfer():vg?vg(t):nr("ArrayBuffer",ul)})};l6({global:!0,enumerable:!0,sham:!D0,forced:N6},{structuredClone:function(t){var n=x6(arguments.length,1)>1&&!f6(arguments[1])?Gx(arguments[1]):void 0,o=n?n.transfer:void 0,c,f;o!==void 0&&(c=new Uf,f=k6(o,c));var g=Nt(t,c);return f&&B6(f),g}});var L6=ct,F6=L6,U6=F6;U6.structuredClone;function j6(){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 W6=ht.createContext(null),$6={},Eg=e=>{let t;const n=new Set,o=(C,A)=>{const I=typeof C=="function"?C(t):C;if(!Object.is(I,t)){const O=t;t=A??(typeof I!="object"||I===null)?I:Object.assign({},t,I),n.forEach(k=>k(t,O))}},c=()=>t,v={setState:o,getState:c,getInitialState:()=>x,subscribe:C=>(n.add(C),()=>n.delete(C)),destroy:()=>{($6?"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()}},x=t=e(o,c,v);return v},V6=e=>e?Eg(e):Eg;var em={exports:{}},tm={},rm={exports:{}},nm={};/**
|
|
18
|
+
*/var dy=ht,hy=Symbol.for("react.element"),gy=Symbol.for("react.fragment"),py=Object.prototype.hasOwnProperty,xy=dy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,my={key:!0,ref:!0,__self:!0,__source:!0};function m2(e,t,n){var o,c={},f=null,g=null;n!==void 0&&(f=""+n),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)py.call(t,o)&&!my.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:hy,type:e,key:f,ref:g,props:c,_owner:xy.current}}lu.Fragment=gy;lu.jsx=m2;lu.jsxs=m2;a2.exports=lu;var ee=a2.exports,zs=function(e){return e&&e.Math===Math&&e},ct=zs(typeof globalThis=="object"&&globalThis)||zs(typeof window=="object"&&window)||zs(typeof self=="object"&&self)||zs(typeof dn=="object"&&dn)||zs(typeof dn=="object"&&dn)||function(){return this}()||Function("return this")(),J1={},at=function(e){try{return!!e()}catch{return!0}},wy=at,Yt=!wy(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),vy=at,e0=!vy(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),yy=e0,ya=Function.prototype.call,Cn=yy?ya.bind(ya):function(){return ya.apply(ya,arguments)},w2={},v2={}.propertyIsEnumerable,y2=Object.getOwnPropertyDescriptor,Ey=y2&&!v2.call({1:2},1);w2.f=Ey?function(t){var n=y2(this,t);return!!n&&n.enumerable}:v2;var Ri=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},E2=e0,C2=Function.prototype,Sf=C2.call,Cy=E2&&C2.bind.bind(Sf,Sf),ft=E2?Cy:function(e){return function(){return Sf.apply(e,arguments)}},A2=ft,Ay=A2({}.toString),Sy=A2("".slice),bi=function(e){return Sy(Ay(e),8,-1)},Iy=ft,Ty=at,Ry=bi,uc=Object,by=Iy("".split),S2=Ty(function(){return!uc("z").propertyIsEnumerable(0)})?function(e){return Ry(e)==="String"?by(e,""):uc(e)}:uc,bs=function(e){return e==null},_y=bs,Oy=TypeError,t0=function(e){if(_y(e))throw new Oy("Can't call method on "+e);return e},Ny=S2,Dy=t0,_s=function(e){return Ny(Dy(e))},cc=typeof document=="object"&&document.all,Et=typeof cc>"u"&&cc!==void 0?function(e){return typeof e=="function"||e===cc}:function(e){return typeof e=="function"},Py=Et,xr=function(e){return typeof e=="object"?e!==null:Py(e)},fc=ct,My=Et,ky=function(e){return My(e)?e:void 0},An=function(e,t){return arguments.length<2?ky(fc[e]):fc[e]&&fc[e][t]},By=ft,uu=By({}.isPrototypeOf),Ly=ct,Zd=Ly.navigator,Qd=Zd&&Zd.userAgent,I2=Qd?String(Qd):"",T2=ct,dc=I2,qd=T2.process,Jd=T2.Deno,eh=qd&&qd.versions||Jd&&Jd.version,th=eh&&eh.v8,Fr,Al;th&&(Fr=th.split("."),Al=Fr[0]>0&&Fr[0]<4?1:+(Fr[0]+Fr[1]));!Al&&dc&&(Fr=dc.match(/Edge\/(\d+)/),(!Fr||Fr[1]>=74)&&(Fr=dc.match(/Chrome\/(\d+)/),Fr&&(Al=+Fr[1])));var R2=Al,rh=R2,Fy=at,Uy=ct,jy=Uy.String,b2=!!Object.getOwnPropertySymbols&&!Fy(function(){var e=Symbol("symbol detection");return!jy(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&rh&&rh<41}),Wy=b2,_2=Wy&&!Symbol.sham&&typeof Symbol.iterator=="symbol",$y=An,Vy=Et,zy=uu,Hy=_2,Gy=Object,r0=Hy?function(e){return typeof e=="symbol"}:function(e){var t=$y("Symbol");return Vy(t)&&zy(t.prototype,Gy(e))},Xy=String,n0=function(e){try{return Xy(e)}catch{return"Object"}},Yy=Et,Ky=n0,Zy=TypeError,i0=function(e){if(Yy(e))return e;throw new Zy(Ky(e)+" is not a function")},Qy=i0,qy=bs,s0=function(e,t){var n=e[t];return qy(n)?void 0:Qy(n)},hc=Cn,gc=Et,pc=xr,Jy=TypeError,eE=function(e,t){var n,o;if(t==="string"&&gc(n=e.toString)&&!pc(o=hc(n,e))||gc(n=e.valueOf)&&!pc(o=hc(n,e))||t!=="string"&&gc(n=e.toString)&&!pc(o=hc(n,e)))return o;throw new Jy("Can't convert object to primitive value")},O2={exports:{}},nh=ct,tE=Object.defineProperty,o0=function(e,t){try{tE(nh,e,{value:t,configurable:!0,writable:!0})}catch{nh[e]=t}return t},rE=ct,nE=o0,ih="__core-js_shared__",sh=O2.exports=rE[ih]||nE(ih,{});(sh.versions||(sh.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 a0=O2.exports,oh=a0,iE=Object.create||Object,N2=function(e,t){return oh[e]||(oh[e]=t||iE(null))},sE=t0,oE=Object,Ko=function(e){return oE(sE(e))},aE=ft,lE=Ko,uE=aE({}.hasOwnProperty),ur=Object.hasOwn||function(t,n){return uE(lE(t),n)},cE=ft,fE=0,dE=Math.random(),hE=cE(1.1.toString),cu=function(e){return"Symbol("+(e===void 0?"":e)+")_"+hE(++fE+dE,36)},gE=ct,pE=N2,ah=ur,xE=cu,mE=b2,wE=_2,Gi=gE.Symbol,xc=pE("wks"),vE=wE?Gi.for||Gi:Gi&&Gi.withoutSetter||xE,Vr=function(e){return ah(xc,e)||(xc[e]=mE&&ah(Gi,e)?Gi[e]:vE("Symbol."+e)),xc[e]},yE=Cn,lh=xr,uh=r0,EE=s0,CE=eE,AE=Vr,SE=TypeError,IE=AE("toPrimitive"),TE=function(e,t){if(!lh(e)||uh(e))return e;var n=EE(e,IE),o;if(n){if(t===void 0&&(t="default"),o=yE(n,e,t),!lh(o)||uh(o))return o;throw new SE("Can't convert object to primitive value")}return t===void 0&&(t="number"),CE(e,t)},RE=TE,bE=r0,D2=function(e){var t=RE(e,"string");return bE(t)?t:t+""},_E=ct,ch=xr,If=_E.document,OE=ch(If)&&ch(If.createElement),P2=function(e){return OE?If.createElement(e):{}},NE=Yt,DE=at,PE=P2,M2=!NE&&!DE(function(){return Object.defineProperty(PE("div"),"a",{get:function(){return 7}}).a!==7}),ME=Yt,kE=Cn,BE=w2,LE=Ri,FE=_s,UE=D2,jE=ur,WE=M2,fh=Object.getOwnPropertyDescriptor;J1.f=ME?fh:function(t,n){if(t=FE(t),n=UE(n),WE)try{return fh(t,n)}catch{}if(jE(t,n))return LE(!kE(BE.f,t,n),t[n])};var mr={},$E=Yt,VE=at,k2=$E&&VE(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),zE=xr,HE=String,GE=TypeError,zr=function(e){if(zE(e))return e;throw new GE(HE(e)+" is not an object")},XE=Yt,YE=M2,KE=k2,Ea=zr,dh=D2,ZE=TypeError,mc=Object.defineProperty,QE=Object.getOwnPropertyDescriptor,wc="enumerable",vc="configurable",yc="writable";mr.f=XE?KE?function(t,n,o){if(Ea(t),n=dh(n),Ea(o),typeof t=="function"&&n==="prototype"&&"value"in o&&yc in o&&!o[yc]){var c=QE(t,n);c&&c[yc]&&(t[n]=o.value,o={configurable:vc in o?o[vc]:c[vc],enumerable:wc in o?o[wc]:c[wc],writable:!1})}return mc(t,n,o)}:mc:function(t,n,o){if(Ea(t),n=dh(n),Ea(o),YE)try{return mc(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 qE=Yt,JE=mr,e3=Ri,fu=qE?function(e,t,n){return JE.f(e,t,e3(1,n))}:function(e,t,n){return e[t]=n,e},B2={exports:{}},Tf=Yt,t3=ur,L2=Function.prototype,r3=Tf&&Object.getOwnPropertyDescriptor,F2=t3(L2,"name"),n3=F2&&(function(){}).name==="something",i3=F2&&(!Tf||Tf&&r3(L2,"name").configurable),U2={PROPER:n3,CONFIGURABLE:i3},s3=ft,o3=Et,Rf=a0,a3=s3(Function.toString);o3(Rf.inspectSource)||(Rf.inspectSource=function(e){return a3(e)});var j2=Rf.inspectSource,l3=ct,u3=Et,hh=l3.WeakMap,c3=u3(hh)&&/native code/.test(String(hh)),f3=N2,d3=cu,gh=f3("keys"),l0=function(e){return gh[e]||(gh[e]=d3(e))},du={},h3=c3,W2=ct,g3=xr,p3=fu,Ec=ur,Cc=a0,x3=l0,m3=du,ph="Object already initialized",bf=W2.TypeError,w3=W2.WeakMap,Sl,Ro,Il,v3=function(e){return Il(e)?Ro(e):Sl(e,{})},y3=function(e){return function(t){var n;if(!g3(t)||(n=Ro(t)).type!==e)throw new bf("Incompatible receiver, "+e+" required");return n}};if(h3||Cc.state){var qr=Cc.state||(Cc.state=new w3);qr.get=qr.get,qr.has=qr.has,qr.set=qr.set,Sl=function(e,t){if(qr.has(e))throw new bf(ph);return t.facade=e,qr.set(e,t),t},Ro=function(e){return qr.get(e)||{}},Il=function(e){return qr.has(e)}}else{var Wi=x3("state");m3[Wi]=!0,Sl=function(e,t){if(Ec(e,Wi))throw new bf(ph);return t.facade=e,p3(e,Wi,t),t},Ro=function(e){return Ec(e,Wi)?e[Wi]:{}},Il=function(e){return Ec(e,Wi)}}var hu={set:Sl,get:Ro,has:Il,enforce:v3,getterFor:y3},u0=ft,E3=at,C3=Et,Ca=ur,_f=Yt,A3=U2.CONFIGURABLE,S3=j2,$2=hu,I3=$2.enforce,T3=$2.get,xh=String,el=Object.defineProperty,R3=u0("".slice),b3=u0("".replace),_3=u0([].join),O3=_f&&!E3(function(){return el(function(){},"length",{value:8}).length!==8}),N3=String(String).split("String"),D3=B2.exports=function(e,t,n){R3(xh(t),0,7)==="Symbol("&&(t="["+b3(xh(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Ca(e,"name")||A3&&e.name!==t)&&(_f?el(e,"name",{value:t,configurable:!0}):e.name=t),O3&&n&&Ca(n,"arity")&&e.length!==n.arity&&el(e,"length",{value:n.arity});try{n&&Ca(n,"constructor")&&n.constructor?_f&&el(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var o=I3(e);return Ca(o,"source")||(o.source=_3(N3,typeof t=="string"?t:"")),e};Function.prototype.toString=D3(function(){return C3(this)&&T3(this).source||S3(this)},"toString");var V2=B2.exports,P3=Et,M3=mr,k3=V2,B3=o0,Jn=function(e,t,n,o){o||(o={});var c=o.enumerable,f=o.name!==void 0?o.name:t;if(P3(n)&&k3(n,f,o),o.global)c?e[t]=n:B3(t,n);else{try{o.unsafe?e[t]&&(c=!0):delete e[t]}catch{}c?e[t]=n:M3.f(e,t,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},gu={},L3=Math.ceil,F3=Math.floor,U3=Math.trunc||function(t){var n=+t;return(n>0?F3:L3)(n)},j3=U3,c0=function(e){var t=+e;return t!==t||t===0?0:j3(t)},W3=c0,$3=Math.max,V3=Math.min,z3=function(e,t){var n=W3(e);return n<0?$3(n+t,0):V3(n,t)},H3=c0,G3=Math.min,X3=function(e){var t=H3(e);return t>0?G3(t,9007199254740991):0},Y3=X3,Zo=function(e){return Y3(e.length)},K3=_s,Z3=z3,Q3=Zo,q3=function(e){return function(t,n,o){var c=K3(t),f=Q3(c);if(f===0)return!e&&-1;var g=Z3(o,f),m;if(e&&n!==n){for(;f>g;)if(m=c[g++],m!==m)return!0}else for(;f>g;g++)if((e||g in c)&&c[g]===n)return e||g||0;return!e&&-1}},J3={indexOf:q3(!1)},eC=ft,Ac=ur,tC=_s,rC=J3.indexOf,nC=du,mh=eC([].push),z2=function(e,t){var n=tC(e),o=0,c=[],f;for(f in n)!Ac(nC,f)&&Ac(n,f)&&mh(c,f);for(;t.length>o;)Ac(n,f=t[o++])&&(~rC(c,f)||mh(c,f));return c},f0=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],iC=z2,sC=f0,oC=sC.concat("length","prototype");gu.f=Object.getOwnPropertyNames||function(t){return iC(t,oC)};var H2={};H2.f=Object.getOwnPropertySymbols;var aC=An,lC=ft,uC=gu,cC=H2,fC=zr,dC=lC([].concat),hC=aC("Reflect","ownKeys")||function(t){var n=uC.f(fC(t)),o=cC.f;return o?dC(n,o(t)):n},wh=ur,gC=hC,pC=J1,xC=mr,mC=function(e,t,n){for(var o=gC(t),c=xC.f,f=pC.f,g=0;g<o.length;g++){var m=o[g];!wh(e,m)&&!(n&&wh(n,m))&&c(e,m,f(t,m))}},wC=at,vC=Et,yC=/#|\.prototype\./,Qo=function(e,t){var n=CC[EC(e)];return n===SC?!0:n===AC?!1:vC(t)?wC(t):!!t},EC=Qo.normalize=function(e){return String(e).replace(yC,".").toLowerCase()},CC=Qo.data={},AC=Qo.NATIVE="N",SC=Qo.POLYFILL="P",G2=Qo,Aa=ct,IC=J1.f,TC=fu,RC=Jn,bC=o0,_C=mC,OC=G2,on=function(e,t){var n=e.target,o=e.global,c=e.stat,f,g,m,v,x,C;if(o?g=Aa:c?g=Aa[n]||bC(n,{}):g=Aa[n]&&Aa[n].prototype,g)for(m in t){if(x=t[m],e.dontCallGetSet?(C=IC(g,m),v=C&&C.value):v=g[m],f=OC(o?m:n+(c?".":"#")+m,e.forced),!f&&v!==void 0){if(typeof x==typeof v)continue;_C(x,v)}(e.sham||v&&v.sham)&&TC(x,"sham",!0),RC(g,m,x,e)}},X2={},NC=z2,DC=f0,Y2=Object.keys||function(t){return NC(t,DC)},PC=Yt,MC=k2,kC=mr,BC=zr,LC=_s,FC=Y2;X2.f=PC&&!MC?Object.defineProperties:function(t,n){BC(t);for(var o=LC(n),c=FC(n),f=c.length,g=0,m;f>g;)kC.f(t,m=c[g++],o[m]);return t};var UC=An,jC=UC("document","documentElement"),WC=zr,$C=X2,vh=f0,VC=du,zC=jC,HC=P2,GC=l0,yh=">",Eh="<",Of="prototype",Nf="script",K2=GC("IE_PROTO"),Sc=function(){},Z2=function(e){return Eh+Nf+yh+e+Eh+"/"+Nf+yh},Ch=function(e){e.write(Z2("")),e.close();var t=e.parentWindow.Object;return e=null,t},XC=function(){var e=HC("iframe"),t="java"+Nf+":",n;return e.style.display="none",zC.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(Z2("document.F=Object")),n.close(),n.F},Sa,tl=function(){try{Sa=new ActiveXObject("htmlfile")}catch{}tl=typeof document<"u"?document.domain&&Sa?Ch(Sa):XC():Ch(Sa);for(var e=vh.length;e--;)delete tl[Of][vh[e]];return tl()};VC[K2]=!0;var pu=Object.create||function(t,n){var o;return t!==null?(Sc[Of]=WC(t),o=new Sc,Sc[Of]=null,o[K2]=t):o=tl(),n===void 0?o:$C.f(o,n)},YC=Vr,KC=pu,ZC=mr.f,Df=YC("unscopables"),Pf=Array.prototype;Pf[Df]===void 0&&ZC(Pf,Df,{configurable:!0,value:KC(null)});var xu=function(e){Pf[Df][e]=!0},QC=on,qC=Ko,JC=Zo,eA=c0,tA=xu;QC({target:"Array",proto:!0},{at:function(t){var n=qC(this),o=JC(n),c=eA(t),f=c>=0?c:o+c;return f<0||f>=o?void 0:n[f]}});tA("at");var rA=ct,nA=ft,d0=function(e,t){return nA(rA[e].prototype[t])},iA=d0;iA("Array","at");var sA=bi,oA=ft,aA=function(e){if(sA(e)==="Function")return oA(e)},Ah=aA,lA=i0,uA=e0,cA=Ah(Ah.bind),h0=function(e,t){return lA(e),t===void 0?e:uA?cA(e,t):function(){return e.apply(t,arguments)}},fA=h0,dA=S2,hA=Ko,gA=Zo,Sh=function(e){var t=e===1;return function(n,o,c){for(var f=hA(n),g=dA(f),m=gA(g),v=fA(o,c),x,C;m-- >0;)if(x=g[m],C=v(x,m,f),C)switch(e){case 0:return x;case 1:return m}return t?-1:void 0}},Q2={findLast:Sh(0),findLastIndex:Sh(1)},pA=on,xA=Q2.findLast,mA=xu;pA({target:"Array",proto:!0},{findLast:function(t){return xA(this,t,arguments.length>1?arguments[1]:void 0)}});mA("findLast");var wA=d0;wA("Array","findLast");var vA=on,yA=Q2.findLastIndex,EA=xu;vA({target:"Array",proto:!0},{findLastIndex:function(t){return yA(this,t,arguments.length>1?arguments[1]:void 0)}});EA("findLastIndex");var CA=d0;CA("Array","findLastIndex");var AA=Vr,SA=AA("toStringTag"),q2={};q2[SA]="z";var g0=String(q2)==="[object z]",IA=g0,TA=Et,rl=bi,RA=Vr,bA=RA("toStringTag"),_A=Object,OA=rl(function(){return arguments}())==="Arguments",NA=function(e,t){try{return e[t]}catch{}},mu=IA?rl:function(e){var t,n,o;return e===void 0?"Undefined":e===null?"Null":typeof(n=NA(t=_A(e),bA))=="string"?n:OA?rl(t):(o=rl(t))==="Object"&&TA(t.callee)?"Arguments":o},DA=mu,PA=String,MA=function(e){if(DA(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return PA(e)},kA=MA,p0=function(e,t){return e===void 0?arguments.length<2?"":t:kA(e)},BA=Yt,LA=at,FA=zr,Ih=p0,nl=Error.prototype.toString,UA=LA(function(){if(BA){var e=Object.create(Object.defineProperty({},"name",{get:function(){return this===e}}));if(nl.call(e)!=="true")return!0}return nl.call({message:1,name:2})!=="2: 1"||nl.call({})!=="Error"}),J2=UA?function(){var t=FA(this),n=Ih(t.name,"Error"),o=Ih(t.message);return n?o?n+": "+o:n:o}:nl,jA=Jn,Th=J2,Rh=Error.prototype;Rh.toString!==Th&&jA(Rh,"toString",Th);var wu=Object.create?Object.create(null):{},WA=at,$A=!WA(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),VA=ur,zA=Et,HA=Ko,GA=l0,XA=$A,bh=GA("IE_PROTO"),Mf=Object,YA=Mf.prototype,ex=XA?Mf.getPrototypeOf:function(e){var t=HA(e);if(VA(t,bh))return t[bh];var n=t.constructor;return zA(n)&&t instanceof n?n.prototype:t instanceof Mf?YA:null},KA=at,ZA=Et,QA=xr,_h=ex,qA=Jn,JA=Vr,kf=JA("iterator"),tx=!1,yi,Ic,Tc;[].keys&&(Tc=[].keys(),"next"in Tc?(Ic=_h(_h(Tc)),Ic!==Object.prototype&&(yi=Ic)):tx=!0);var eS=!QA(yi)||KA(function(){var e={};return yi[kf].call(e)!==e});eS&&(yi={});ZA(yi[kf])||qA(yi,kf,function(){return this});var rx={IteratorPrototype:yi,BUGGY_SAFARI_ITERATORS:tx},tS=mr.f,rS=ur,nS=Vr,Oh=nS("toStringTag"),vu=function(e,t,n){e&&!n&&(e=e.prototype),e&&!rS(e,Oh)&&tS(e,Oh,{configurable:!0,value:t})},iS=rx.IteratorPrototype,sS=pu,oS=Ri,aS=vu,lS=wu,uS=function(){return this},cS=function(e,t,n,o){var c=t+" Iterator";return e.prototype=sS(iS,{next:oS(+!o,n)}),aS(e,c,!1),lS[c]=uS,e},fS=ft,dS=i0,hS=function(e,t,n){try{return fS(dS(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},gS=xr,pS=function(e){return gS(e)||e===null},xS=pS,mS=String,wS=TypeError,vS=function(e){if(xS(e))return e;throw new wS("Can't set "+mS(e)+" as a prototype")},yS=hS,ES=xr,CS=t0,AS=vS,nx=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},n;try{n=yS(Object.prototype,"__proto__","set"),n(t,[]),e=t instanceof Array}catch{}return function(c,f){return CS(c),AS(f),ES(c)&&(e?n(c,f):c.__proto__=f),c}}():void 0),SS=on,IS=Cn,ix=U2,TS=Et,RS=cS,Nh=ex,Dh=nx,bS=vu,_S=fu,Rc=Jn,OS=Vr,NS=wu,sx=rx,DS=ix.PROPER,PS=ix.CONFIGURABLE,Ph=sx.IteratorPrototype,Ia=sx.BUGGY_SAFARI_ITERATORS,Hs=OS("iterator"),Mh="keys",Gs="values",kh="entries",MS=function(){return this},ox=function(e,t,n,o,c,f,g){RS(n,t,o);var m=function(N){if(N===c&&I)return I;if(!Ia&&N&&N in C)return C[N];switch(N){case Mh:return function(){return new n(this,N)};case Gs:return function(){return new n(this,N)};case kh:return function(){return new n(this,N)}}return function(){return new n(this)}},v=t+" Iterator",x=!1,C=e.prototype,A=C[Hs]||C["@@iterator"]||c&&C[c],I=!Ia&&A||m(c),O=t==="Array"&&C.entries||A,k,P,G;if(O&&(k=Nh(O.call(new e)),k!==Object.prototype&&k.next&&(Nh(k)!==Ph&&(Dh?Dh(k,Ph):TS(k[Hs])||Rc(k,Hs,MS)),bS(k,v,!0))),DS&&c===Gs&&A&&A.name!==Gs&&(PS?_S(C,"name",Gs):(x=!0,I=function(){return IS(A,this)})),c)if(P={values:m(Gs),keys:f?I:m(Mh),entries:m(kh)},g)for(G in P)(Ia||x||!(G in C))&&Rc(C,G,P[G]);else SS({target:t,proto:!0,forced:Ia||x},P);return C[Hs]!==I&&Rc(C,Hs,I,{name:c}),NS[t]=I,P},ax=function(e,t){return{value:e,done:t}},kS=_s,x0=xu,Bh=wu,lx=hu,BS=mr.f,LS=ox,Ta=ax,FS=Yt,ux="Array Iterator",US=lx.set,jS=lx.getterFor(ux);LS(Array,"Array",function(e,t){US(this,{type:ux,target:kS(e),index:0,kind:t})},function(){var e=jS(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,Ta(void 0,!0);switch(e.kind){case"keys":return Ta(n,!1);case"values":return Ta(t[n],!1)}return Ta([n,t[n]],!1)},"values");var Lh=Bh.Arguments=Bh.Array;x0("keys");x0("values");x0("entries");if(FS&&Lh.name!=="values")try{BS(Lh,"name",{value:"values"})}catch{}var WS=on,$S=Ko,cx=Y2,VS=at,zS=VS(function(){cx(1)});WS({target:"Object",stat:!0,forced:zS},{keys:function(t){return cx($S(t))}});var HS=g0,GS=mu,XS=HS?{}.toString:function(){return"[object "+GS(this)+"]"},YS=g0,KS=Jn,ZS=XS;YS||KS(Object.prototype,"toString",ZS,{unsafe:!0});var fx={exports:{}},dx={},QS=ft,qS=QS([].slice),JS=bi,e8=_s,hx=gu.f,t8=qS,gx=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],r8=function(e){try{return hx(e)}catch{return t8(gx)}};dx.f=function(t){return gx&&JS(t)==="Window"?r8(t):hx(e8(t))};var n8=at,i8=n8(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),s8=at,o8=xr,a8=bi,Fh=i8,il=Object.isExtensible,l8=s8(function(){il(1)}),u8=l8||Fh?function(t){return!o8(t)||Fh&&a8(t)==="ArrayBuffer"?!1:il?il(t):!0}:il,c8=at,f8=!c8(function(){return Object.isExtensible(Object.preventExtensions({}))}),d8=on,h8=ft,g8=du,p8=xr,m0=ur,x8=mr.f,Uh=gu,m8=dx,w0=u8,w8=cu,v8=f8,px=!1,xn=w8("meta"),y8=0,v0=function(e){x8(e,xn,{value:{objectID:"O"+y8++,weakData:{}}})},E8=function(e,t){if(!p8(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!m0(e,xn)){if(!w0(e))return"F";if(!t)return"E";v0(e)}return e[xn].objectID},C8=function(e,t){if(!m0(e,xn)){if(!w0(e))return!0;if(!t)return!1;v0(e)}return e[xn].weakData},A8=function(e){return v8&&px&&w0(e)&&!m0(e,xn)&&v0(e),e},S8=function(){I8.enable=function(){},px=!0;var e=Uh.f,t=h8([].splice),n={};n[xn]=1,e(n).length&&(Uh.f=function(o){for(var c=e(o),f=0,g=c.length;f<g;f++)if(c[f]===xn){t(c,f,1);break}return c},d8({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:m8.f}))},I8=fx.exports={enable:S8,fastKey:E8,getWeakData:C8,onFreeze:A8};g8[xn]=!0;var xx=fx.exports,T8=Vr,R8=wu,b8=T8("iterator"),_8=Array.prototype,O8=function(e){return e!==void 0&&(R8.Array===e||_8[b8]===e)},N8=bi,D8=bs,jh=s0,P8=Vr,Wh=P8("iterator"),M8=Array.prototype,mx=function(e){if(!D8(e))return jh(e,Wh)||jh(e,"@@iterator")||(N8(e)==="Arguments"?M8[Wh]:void 0)},k8=Cn,B8=Et,L8=zr,F8=n0,U8=mx,j8=TypeError,W8=function(e,t){var n=arguments.length<2?U8(e):t;if(B8(n))return L8(k8(n,e));throw new j8(F8(e)+" is not iterable")},$8=Cn,$h=zr,V8=s0,z8=function(e,t,n){var o,c;$h(e);try{if(o=V8(e,"return"),!o){if(t==="throw")throw n;return n}o=$8(o,e)}catch(f){c=!0,o=f}if(t==="throw")throw n;if(c)throw o;return $h(o),n},H8=h0,G8=Cn,X8=zr,Y8=n0,K8=O8,Z8=Zo,Vh=uu,Q8=W8,q8=mx,zh=z8,J8=TypeError,sl=function(e,t){this.stopped=e,this.result=t},Hh=sl.prototype,y0=function(e,t,n){var o=n&&n.that,c=!!(n&&n.AS_ENTRIES),f=!!(n&&n.IS_RECORD),g=!!(n&&n.IS_ITERATOR),m=!!(n&&n.INTERRUPTED),v=H8(t,o),x,C,A,I,O,k,P,G=function(_){var U=x;return x=void 0,U&&zh(U,"normal"),new sl(!0,_)},N=function(_){return c?(X8(_),m?v(_[0],_[1],G):v(_[0],_[1])):m?v(_,G):v(_)};if(f)x=e.iterator;else if(g)x=e;else{if(C=q8(e),!C)throw new J8(Y8(e)+" is not iterable");if(K8(C)){for(A=0,I=Z8(e);I>A;A++)if(O=N(e[A]),O&&Vh(Hh,O))return O;return new sl(!1)}x=Q8(e,C)}for(k=f?e.next:x.next;!(P=G8(k,x)).done;){var T=P.value;try{O=N(T)}catch(_){if(x)zh(x,"throw",_);else throw _}if(typeof O=="object"&&O&&Vh(Hh,O))return O}return new sl(!1)},e4=uu,t4=TypeError,yu=function(e,t){if(e4(t,e))return e;throw new t4("Incorrect invocation")},r4=Vr,wx=r4("iterator"),vx=!1;try{var n4=0,Gh={next:function(){return{done:!!n4++}},return:function(){vx=!0}};Gh[wx]=function(){return this},Array.from(Gh,function(){throw 2})}catch{}var i4=function(e,t){try{if(!t&&!vx)return!1}catch{return!1}var n=!1;try{var o={};o[wx]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch{}return n},s4=Et,o4=xr,Xh=nx,yx=function(e,t,n){var o,c;return Xh&&s4(o=t.constructor)&&o!==n&&o4(c=o.prototype)&&c!==n.prototype&&Xh(e,c),e},a4=on,l4=ct,u4=ft,Yh=G2,c4=Jn,f4=xx,d4=y0,h4=yu,g4=Et,p4=bs,bc=xr,_c=at,x4=i4,m4=vu,w4=yx,Ex=function(e,t,n){var o=e.indexOf("Map")!==-1,c=e.indexOf("Weak")!==-1,f=o?"set":"add",g=l4[e],m=g&&g.prototype,v=g,x={},C=function(N){var T=u4(m[N]);c4(m,N,N==="add"?function(U){return T(this,U===0?0:U),this}:N==="delete"?function(_){return c&&!bc(_)?!1:T(this,_===0?0:_)}:N==="get"?function(U){return c&&!bc(U)?void 0:T(this,U===0?0:U)}:N==="has"?function(U){return c&&!bc(U)?!1:T(this,U===0?0:U)}:function(U,z){return T(this,U===0?0:U,z),this})},A=Yh(e,!g4(g)||!(c||m.forEach&&!_c(function(){new g().entries().next()})));if(A)v=n.getConstructor(t,e,o,f),f4.enable();else if(Yh(e,!0)){var I=new v,O=I[f](c?{}:-0,1)!==I,k=_c(function(){I.has(1)}),P=x4(function(N){new g(N)}),G=!c&&_c(function(){for(var N=new g,T=5;T--;)N[f](T,T);return!N.has(-0)});P||(v=t(function(N,T){h4(N,m);var _=w4(new g,N,v);return p4(T)||d4(T,_[f],{that:_,AS_ENTRIES:o}),_}),v.prototype=m,m.constructor=v),(k||G)&&(C("delete"),C("has"),o&&C("get")),(G||O)&&C(f),c&&m.clear&&delete m.clear}return x[e]=v,a4({global:!0,constructor:!0,forced:v!==g},x),m4(v,e),c||n.setStrong(v,e,o),v},Kh=V2,v4=mr,E0=function(e,t,n){return n.get&&Kh(n.get,t,{getter:!0}),n.set&&Kh(n.set,t,{setter:!0}),v4.f(e,t,n)},y4=Jn,E4=function(e,t,n){for(var o in t)y4(e,o,t[o],n);return e},C4=An,A4=E0,S4=Vr,I4=Yt,Zh=S4("species"),T4=function(e){var t=C4(e);I4&&t&&!t[Zh]&&A4(t,Zh,{configurable:!0,get:function(){return this}})},Qh=pu,R4=E0,qh=E4,b4=h0,_4=yu,O4=bs,N4=y0,D4=ox,Ra=ax,P4=T4,Xs=Yt,Jh=xx.fastKey,Cx=hu,eg=Cx.set,Oc=Cx.getterFor,Ax={getConstructor:function(e,t,n,o){var c=e(function(x,C){_4(x,f),eg(x,{type:t,index:Qh(null),first:null,last:null,size:0}),Xs||(x.size=0),O4(C)||N4(C,x[o],{that:x,AS_ENTRIES:n})}),f=c.prototype,g=Oc(t),m=function(x,C,A){var I=g(x),O=v(x,C),k,P;return O?O.value=A:(I.last=O={index:P=Jh(C,!0),key:C,value:A,previous:k=I.last,next:null,removed:!1},I.first||(I.first=O),k&&(k.next=O),Xs?I.size++:x.size++,P!=="F"&&(I.index[P]=O)),x},v=function(x,C){var A=g(x),I=Jh(C),O;if(I!=="F")return A.index[I];for(O=A.first;O;O=O.next)if(O.key===C)return O};return qh(f,{clear:function(){for(var C=this,A=g(C),I=A.first;I;)I.removed=!0,I.previous&&(I.previous=I.previous.next=null),I=I.next;A.first=A.last=null,A.index=Qh(null),Xs?A.size=0:C.size=0},delete:function(x){var C=this,A=g(C),I=v(C,x);if(I){var O=I.next,k=I.previous;delete A.index[I.index],I.removed=!0,k&&(k.next=O),O&&(O.previous=k),A.first===I&&(A.first=O),A.last===I&&(A.last=k),Xs?A.size--:C.size--}return!!I},forEach:function(C){for(var A=g(this),I=b4(C,arguments.length>1?arguments[1]:void 0),O;O=O?O.next:A.first;)for(I(O.value,O.key,this);O&&O.removed;)O=O.previous},has:function(C){return!!v(this,C)}}),qh(f,n?{get:function(C){var A=v(this,C);return A&&A.value},set:function(C,A){return m(this,C===0?0:C,A)}}:{add:function(C){return m(this,C=C===0?0:C,C)}}),Xs&&R4(f,"size",{configurable:!0,get:function(){return g(this).size}}),c},setStrong:function(e,t,n){var o=t+" Iterator",c=Oc(t),f=Oc(o);D4(e,t,function(g,m){eg(this,{type:o,target:g,state:c(g),kind:m,last:null})},function(){for(var g=f(this),m=g.kind,v=g.last;v&&v.removed;)v=v.previous;return!g.target||!(g.last=v=v?v.next:g.state.first)?(g.target=null,Ra(void 0,!0)):Ra(m==="keys"?v.key:m==="values"?v.value:[v.key,v.value],!1)},n?"entries":"values",!n,!0),P4(t)}},M4=Ex,k4=Ax;M4("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},k4);var B4=Ex,L4=Ax;B4("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},L4);var Ys=ct,F4=I2,U4=bi,ba=function(e){return F4.slice(0,e.length)===e},Sx=function(){return ba("Bun/")?"BUN":ba("Cloudflare-Workers")?"CLOUDFLARE":ba("Deno/")?"DENO":ba("Node.js/")?"NODE":Ys.Bun&&typeof Bun.version=="string"?"BUN":Ys.Deno&&typeof Deno.version=="object"?"DENO":U4(Ys.process)==="process"?"NODE":Ys.window&&Ys.document?"BROWSER":"REST"}(),j4=Sx,W4=j4==="NODE",$4=ct,V4=W4,Ix=function(e){if(V4){try{return $4.process.getBuiltinModule(e)}catch{}try{return Function('return require("'+e+'")')()}catch{}}},Tx={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}},z4=ft,Rx=Error,H4=z4("".replace),G4=function(e){return String(new Rx(e).stack)}("zxcasd"),bx=/\n\s*at [^:]*:[^\n]*/,X4=bx.test(G4),_x=function(e,t){if(X4&&typeof e=="string"&&!Rx.prepareStackTrace)for(;t--;)e=H4(e,bx,"");return e},Y4=on,Tl=An,K4=Ix,C0=at,Z4=pu,A0=Ri,Rl=mr.f,Q4=Jn,ol=E0,al=ur,q4=yu,J4=zr,Ox=J2,tg=p0,as=Tx,eI=_x,Nx=hu,S0=Yt,ps="DOMException",Bf="DATA_CLONE_ERR",Eu=Tl("Error"),mn=Tl(ps)||function(){try{var e=Tl("MessageChannel")||K4("worker_threads").MessageChannel;new e().port1.postMessage(new WeakMap)}catch(t){if(t.name===Bf&&t.code===25)return t.constructor}}(),tI=mn&&mn.prototype,Dx=Eu.prototype,rI=Nx.set,nI=Nx.getterFor(ps),iI="stack"in new Eu(ps),Px=function(e){return al(as,e)&&as[e].m?as[e].c:0},I0=function(){q4(this,go);var t=arguments.length,n=tg(t<1?void 0:arguments[0]),o=tg(t<2?void 0:arguments[1],"Error"),c=Px(o);if(rI(this,{type:ps,name:o,message:n,code:c}),S0||(this.name=o,this.message=n,this.code=c),iI){var f=new Eu(n);f.name=ps,Rl(this,"stack",A0(1,eI(f.stack,1)))}},go=I0.prototype=Z4(Dx),Mx=function(e){return{enumerable:!0,configurable:!0,get:e}},Nc=function(e){return Mx(function(){return nI(this)[e]})};S0&&(ol(go,"code",Nc("code")),ol(go,"message",Nc("message")),ol(go,"name",Nc("name")));Rl(go,"constructor",A0(1,I0));var Cu=C0(function(){return!(new mn instanceof Eu)}),sI=Cu||C0(function(){return Dx.toString!==Ox||String(new mn(1,2))!=="2: 1"}),oI=Cu||C0(function(){return new mn(1,"DataCloneError").code!==25});Cu||mn[Bf]!==25||tI[Bf];var rg=Cu;Y4({global:!0,constructor:!0,forced:rg},{DOMException:rg?I0:mn});var bo=Tl(ps),bl=bo.prototype;sI&&mn===bo&&Q4(bl,"toString",Ox);oI&&S0&&mn===bo&&ol(bl,"code",Mx(function(){return Px(J4(this).name)}));for(var ng in as)if(al(as,ng)){var ig=as[ng],_a=ig.s,sg=A0(6,ig.c);al(bo,_a)||Rl(bo,_a,sg),al(bl,_a)||Rl(bl,_a,sg)}var aI=on,lI=ct,T0=An,Lf=Ri,Ff=mr.f,og=ur,uI=yu,cI=yx,ag=p0,Dc=Tx,fI=_x,dI=Yt,qo="DOMException",kx=T0("Error"),Jo=T0(qo),R0=function(){uI(this,hI);var t=arguments.length,n=ag(t<1?void 0:arguments[0]),o=ag(t<2?void 0:arguments[1],"Error"),c=new Jo(n,o),f=new kx(n);return f.name=qo,Ff(c,"stack",Lf(1,fI(f.stack,1))),cI(c,this,R0),c},hI=R0.prototype=Jo.prototype,gI="stack"in new kx(qo),pI="stack"in new Jo(1,2),Pc=Jo&&dI&&Object.getOwnPropertyDescriptor(lI,qo),xI=!!Pc&&!(Pc.writable&&Pc.configurable),lg=gI&&!xI&&!pI;aI({global:!0,constructor:!0,forced:lg},{DOMException:lg?R0:Jo});var so=T0(qo),ug=so.prototype;if(ug.constructor!==so){Ff(ug,"constructor",Lf(1,so));for(var cg in Dc)if(og(Dc,cg)){var fg=Dc[cg],dg=fg.s;og(so,dg)||Ff(so,dg,Lf(6,fg.c))}}var mI=An,wI=vu,hg="DOMException";wI(mI(hg),hg);var vI=ft,yI=at,Bx=Et,EI=mu,CI=An,AI=j2,Lx=function(){},Fx=CI("Reflect","construct"),b0=/^\s*(?:class|function)\b/,SI=vI(b0.exec),II=!b0.test(Lx),Ks=function(t){if(!Bx(t))return!1;try{return Fx(Lx,[],t),!0}catch{return!1}},Ux=function(t){if(!Bx(t))return!1;switch(EI(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return II||!!SI(b0,AI(t))}catch{return!0}};Ux.sham=!0;var TI=!Fx||yI(function(){var e;return Ks(Ks.call)||!Ks(Object)||!Ks(function(){e=!0})||e})?Ux:Ks,RI=Yt,bI=mr,_I=Ri,OI=function(e,t,n){RI?bI.f(e,t,_I(0,n)):e[t]=n},NI=TypeError,DI=function(e,t){if(e<t)throw new NI("Not enough arguments");return e},PI=ct,MI=at,gg=PI.RegExp,kI=!MI(function(){var e=!0;try{gg(".","d")}catch{e=!1}var t={},n="",o=e?"dgimsy":"gimsy",c=function(v,x){Object.defineProperty(t,v,{get:function(){return n+=x,!0}})},f={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};e&&(f.hasIndices="d");for(var g in f)c(g,f[g]);var m=Object.getOwnPropertyDescriptor(gg.prototype,"flags").get.call(t);return m!==o||n!==o}),BI={correct:kI},LI=zr,FI=function(){var e=LI(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},UI=Cn,jI=ur,WI=uu,pg=BI,$I=FI,VI=RegExp.prototype,zI=pg.correct?function(e){return e.flags}:function(e){return!pg.correct&&WI(VI,e)&&!jI(e,"flags")?UI($I,e):e.flags},Oa=ft,Na=Map.prototype,HI={Map,set:Oa(Na.set),get:Oa(Na.get),has:Oa(Na.has),remove:Oa(Na.delete)},Mc=ft,Da=Set.prototype,jx={Set,add:Mc(Da.add),has:Mc(Da.has),remove:Mc(Da.delete),proto:Da},GI=Cn,XI=function(e,t,n){for(var o=n?e:e.iterator,c=e.next,f,g;!(f=GI(c,o)).done;)if(g=t(f.value),g!==void 0)return g},Wx=ft,YI=XI,$x=jx,KI=$x.Set,Vx=$x.proto,ZI=Wx(Vx.forEach),zx=Wx(Vx.keys),QI=zx(new KI).next,qI=function(e,t,n){return n?YI({iterator:zx(e),next:QI},t):ZI(e,t)},JI=ct,e6=at,kc=R2,Bc=Sx,xg=JI.structuredClone,Hx=!!xg&&!e6(function(){if(Bc==="DENO"&&kc>92||Bc==="NODE"&&kc>94||Bc==="BROWSER"&&kc>97)return!1;var e=new ArrayBuffer(8),t=xg(e,{transfer:[e]});return e.byteLength!==0||t.byteLength!==8}),_0=ct,t6=Ix,r6=Hx,n6=_0.structuredClone,mg=_0.ArrayBuffer,Pa=_0.MessageChannel,Uf=!1,Lc,wg,Ma,Fc;if(r6)Uf=function(e){n6(e,{transfer:[e]})};else if(mg)try{Pa||(Lc=t6("worker_threads"),Lc&&(Pa=Lc.MessageChannel)),Pa&&(wg=new Pa,Ma=new mg(2),Fc=function(e){wg.port1.postMessage(null,[e])},Ma.byteLength===2&&(Fc(Ma),Ma.byteLength===0&&(Uf=Fc)))}catch{}var i6=Uf,s6=at,o6=Ri,a6=!s6(function(){var e=new Error("a");return"stack"in e?(Object.defineProperty(e,"stack",o6(1,7)),e.stack!==7):!0}),l6=on,Mt=ct,po=An,ea=ft,O0=at,u6=cu,xs=Et,c6=TI,f6=bs,Au=xr,d6=r0,h6=y0,Gx=zr,_l=mu,g6=ur,p6=OI,Uc=fu,ll=Zo,x6=DI,m6=zI,Su=HI,N0=jx,w6=qI,vg=i6,v6=a6,D0=Hx,oo=Mt.Object,y6=Mt.Array,Xx=Mt.Date,Yx=Mt.Error,E6=Mt.TypeError,C6=Mt.PerformanceMark,Ei=po("DOMException"),jf=Su.Map,P0=Su.has,Kx=Su.get,Ol=Su.set,Zx=N0.Set,Qx=N0.add,A6=N0.has,S6=po("Object","keys"),I6=ea([].push),T6=ea((!0).valueOf),R6=ea(1.1.valueOf),b6=ea("".valueOf),_6=ea(Xx.prototype.getTime),Wf=u6("structuredClone"),_o="DataCloneError",ul="Transferring",qx=function(e){return!O0(function(){var t=new Mt.Set([7]),n=e(t),o=e(oo(7));return n===t||!n.has(7)||!Au(o)||+o!=7})&&e},yg=function(e,t){return!O0(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)})},O6=function(e){return!O0(function(){var t=e(new Mt.AggregateError([1],Wf,{cause:3}));return t.name!=="AggregateError"||t.errors[0]!==1||t.message!==Wf||t.cause!==3})},mi=Mt.structuredClone,N6=!yg(mi,Yx)||!yg(mi,Ei)||!O6(mi),D6=!mi&&qx(function(e){return new C6(Wf,{detail:e}).detail}),Un=qx(mi)||D6,jc=function(e){throw new Ei("Uncloneable type: "+e,_o)},nr=function(e,t){throw new Ei((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",_o)},Wc=function(e,t){return Un||nr(t),Un(e)},P6=function(){var e;try{e=new Mt.DataTransfer}catch{try{e=new Mt.ClipboardEvent("").clipboardData}catch{}}return e&&e.items&&e.files?e:null},Jx=function(e,t,n){if(P0(t,e))return Kx(t,e);var o=n||_l(e),c,f,g,m,v,x;if(o==="SharedArrayBuffer")Un?c=Un(e):c=e;else{var C=Mt.DataView;!C&&!xs(e.slice)&&nr("ArrayBuffer");try{if(xs(e.slice)&&!e.resizable)c=e.slice(0);else for(f=e.byteLength,g=("maxByteLength"in e)?{maxByteLength:e.maxByteLength}:void 0,c=new ArrayBuffer(f,g),m=new C(e),v=new C(c),x=0;x<f;x++)v.setUint8(x,m.getUint8(x))}catch{throw new Ei("ArrayBuffer is detached",_o)}}return Ol(t,e,c),c},M6=function(e,t,n,o,c){var f=Mt[t];return Au(f)||nr(t),new f(Jx(e.buffer,c),n,o)},Nt=function(e,t){if(d6(e)&&jc("Symbol"),!Au(e))return e;if(t){if(P0(t,e))return Kx(t,e)}else t=new jf;var n=_l(e),o,c,f,g,m,v,x,C;switch(n){case"Array":f=y6(ll(e));break;case"Object":f={};break;case"Map":f=new jf;break;case"Set":f=new Zx;break;case"RegExp":f=new RegExp(e.source,m6(e));break;case"Error":switch(c=e.name,c){case"AggregateError":f=new(po(c))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":f=new(po(c));break;case"CompileError":case"LinkError":case"RuntimeError":f=new(po("WebAssembly",c));break;default:f=new Yx}break;case"DOMException":f=new Ei(e.message,e.name);break;case"ArrayBuffer":case"SharedArrayBuffer":f=Jx(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":v=n==="DataView"?e.byteLength:e.length,f=M6(e,n,e.byteOffset,v,t);break;case"DOMQuad":try{f=new DOMQuad(Nt(e.p1,t),Nt(e.p2,t),Nt(e.p3,t),Nt(e.p4,t))}catch{f=Wc(e,n)}break;case"File":if(Un)try{f=Un(e),_l(f)!==n&&(f=void 0)}catch{}if(!f)try{f=new File([e],e.name,e)}catch{}f||nr(n);break;case"FileList":if(g=P6(),g){for(m=0,v=ll(e);m<v;m++)g.items.add(Nt(e[m],t));f=g.files}else f=Wc(e,n);break;case"ImageData":try{f=new ImageData(Nt(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch{f=Wc(e,n)}break;default:if(Un)f=Un(e);else switch(n){case"BigInt":f=oo(e.valueOf());break;case"Boolean":f=oo(T6(e));break;case"Number":f=oo(R6(e));break;case"String":f=oo(b6(e));break;case"Date":f=new Xx(_6(e));break;case"Blob":try{f=e.slice(0,e.size,e.type)}catch{nr(n)}break;case"DOMPoint":case"DOMPointReadOnly":o=Mt[n];try{f=o.fromPoint?o.fromPoint(e):new o(e.x,e.y,e.z,e.w)}catch{nr(n)}break;case"DOMRect":case"DOMRectReadOnly":o=Mt[n];try{f=o.fromRect?o.fromRect(e):new o(e.x,e.y,e.width,e.height)}catch{nr(n)}break;case"DOMMatrix":case"DOMMatrixReadOnly":o=Mt[n];try{f=o.fromMatrix?o.fromMatrix(e):new o(e)}catch{nr(n)}break;case"AudioData":case"VideoFrame":xs(e.clone)||nr(n);try{f=e.clone()}catch{jc(n)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":nr(n);default:jc(n)}}switch(Ol(t,e,f),n){case"Array":case"Object":for(x=S6(e),m=0,v=ll(x);m<v;m++)C=x[m],p6(f,C,Nt(e[C],t));break;case"Map":e.forEach(function(A,I){Ol(f,Nt(I,t),Nt(A,t))});break;case"Set":e.forEach(function(A){Qx(f,Nt(A,t))});break;case"Error":Uc(f,"message",Nt(e.message,t)),g6(e,"cause")&&Uc(f,"cause",Nt(e.cause,t)),c==="AggregateError"?f.errors=Nt(e.errors,t):c==="SuppressedError"&&(f.error=Nt(e.error,t),f.suppressed=Nt(e.suppressed,t));case"DOMException":v6&&Uc(f,"stack",Nt(e.stack,t))}return f},k6=function(e,t){if(!Au(e))throw new E6("Transfer option cannot be converted to a sequence");var n=[];h6(e,function(I){I6(n,Gx(I))});for(var o=0,c=ll(n),f=new Zx,g,m,v,x,C,A;o<c;){if(g=n[o++],m=_l(g),x=void 0,m==="ArrayBuffer"?A6(f,g):P0(t,g))throw new Ei("Duplicate transferable",_o);if(m==="ArrayBuffer"){Qx(f,g);continue}if(D0)x=mi(g,{transfer:[g]});else switch(m){case"ImageBitmap":v=Mt.OffscreenCanvas,c6(v)||nr(m,ul);try{C=new v(g.width,g.height),A=C.getContext("bitmaprenderer"),A.transferFromImageBitmap(g),x=C.transferToImageBitmap()}catch{}break;case"AudioData":case"VideoFrame":(!xs(g.clone)||!xs(g.close))&&nr(m,ul);try{x=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":nr(m,ul)}if(x===void 0)throw new Ei("This object cannot be transferred: "+m,_o);Ol(t,g,x)}return f},B6=function(e){w6(e,function(t){D0?mi(t,{transfer:[t]}):xs(t.transfer)?t.transfer():vg?vg(t):nr("ArrayBuffer",ul)})};l6({global:!0,enumerable:!0,sham:!D0,forced:N6},{structuredClone:function(t){var n=x6(arguments.length,1)>1&&!f6(arguments[1])?Gx(arguments[1]):void 0,o=n?n.transfer:void 0,c,f;o!==void 0&&(c=new jf,f=k6(o,c));var g=Nt(t,c);return f&&B6(f),g}});var L6=ct,F6=L6,U6=F6;U6.structuredClone;function j6(){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 W6=ht.createContext(null),$6={},Eg=e=>{let t;const n=new Set,o=(C,A)=>{const I=typeof C=="function"?C(t):C;if(!Object.is(I,t)){const O=t;t=A??(typeof I!="object"||I===null)?I:Object.assign({},t,I),n.forEach(k=>k(t,O))}},c=()=>t,v={setState:o,getState:c,getInitialState:()=>x,subscribe:C=>(n.add(C),()=>n.delete(C)),destroy:()=>{($6?"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()}},x=t=e(o,c,v);return v},V6=e=>e?Eg(e):Eg;var em={exports:{}},tm={},rm={exports:{}},nm={};/**
|
|
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=["./App-Bnv7-jUZ.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 ms=ht;function z6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var H6=typeof Object.is=="function"?Object.is:z6,G6=ms.useState,X6=ms.useEffect,Y6=ms.useLayoutEffect,K6=ms.useDebugValue;function Z6(e,t){var n=t(),o=G6({inst:{value:n,getSnapshot:t}}),c=o[0].inst,f=o[1];return Y6(function(){c.value=n,c.getSnapshot=t
|
|
26
|
+
*/var ms=ht;function z6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var H6=typeof Object.is=="function"?Object.is:z6,G6=ms.useState,X6=ms.useEffect,Y6=ms.useLayoutEffect,K6=ms.useDebugValue;function Z6(e,t){var n=t(),o=G6({inst:{value:n,getSnapshot:t}}),c=o[0].inst,f=o[1];return Y6(function(){c.value=n,c.getSnapshot=t,$c(c)&&f({inst:c})},[e,n,t]),X6(function(){return $c(c)&&f({inst:c}),e(function(){$c(c)&&f({inst:c})})},[e]),K6(n),n}function $c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!H6(e,n)}catch{return!0}}function Q6(e,t){return t()}var q6=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Q6:Z6;nm.useSyncExternalStore=ms.useSyncExternalStore!==void 0?ms.useSyncExternalStore:q6;rm.exports=nm;var J6=rm.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=["./App-Bnv7-jUZ.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
|
|
34
|
+
*/var Iu=ht,eT=J6;function tT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rT=typeof Object.is=="function"?Object.is:tT,nT=eT.useSyncExternalStore,iT=Iu.useRef,sT=Iu.useEffect,oT=Iu.useMemo,aT=Iu.useDebugValue;tm.useSyncExternalStoreWithSelector=function(e,t,n,o,c){var f=iT(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=oT(function(){function v(O){if(!x){if(x=!0,C=O,O=o(O),c!==void 0&&g.hasValue){var k=g.value;if(c(k,O))return A=k}return A=O}if(k=A,rT(C,O))return k;var P=o(O);return c!==void 0&&c(k,P)?(C=O,k):(C=O,A=P)}var x=!1,C,A,I=n===void 0?null:n;return[function(){return v(t())},I===null?void 0:function(){return v(I())}]},[t,n,o,c]);var m=nT(e,f[0],f[1]);return sT(function(){g.hasValue=!0,g.value=m},[m]),aT(m),m};em.exports=tm;var lT=em.exports;const uT=o2(lT),im={},{useDebugValue:cT}=fy,{useSyncExternalStoreWithSelector:fT}=uT;let Cg=!1;const dT=e=>e;function hT(e,t=dT,n){(im?"production":void 0)!=="production"&&n&&!Cg&&(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"),Cg=!0);const o=fT(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cT(o),o}const Ag=e=>{(im?"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"?V6(e):e,n=(o,c)=>hT(t,o,c);return Object.assign(n,t),n},gT=e=>e?Ag(e):Ag,pT={};function xT(e,t){let n;try{n=e()}catch{return}return{getItem:c=>{var f;const g=v=>v===null?null:JSON.parse(v,void 0),m=(f=n.getItem(c))!=null?f:null;return m instanceof Promise?m.then(g):g(m)},setItem:(c,f)=>n.setItem(c,JSON.stringify(f,void 0)),removeItem:c=>n.removeItem(c)}}const Oo=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(o){return Oo(o)(n)},catch(o){return this}}}catch(n){return{then(o){return this},catch(o){return Oo(o)(n)}}}},mT=(e,t)=>(n,o,c)=>{let f={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:G=>G,version:0,merge:(G,N)=>({...N,...G}),...t},g=!1;const m=new Set,v=new Set;let x;try{x=f.getStorage()}catch{}if(!x)return e((...G)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),n(...G)},o,c);const C=Oo(f.serialize),A=()=>{const G=f.partialize({...o()});let N;const T=C({state:G,version:f.version}).then(_=>x.setItem(f.name,_)).catch(_=>{N=_});if(N)throw N;return T},I=c.setState;c.setState=(G,N)=>{I(G,N),A()};const O=e((...G)=>{n(...G),A()},o,c);let k;const P=()=>{var G;if(!x)return;g=!1,m.forEach(T=>T(o()));const N=((G=f.onRehydrateStorage)==null?void 0:G.call(f,o()))||void 0;return Oo(x.getItem.bind(x))(f.name).then(T=>{if(T)return f.deserialize(T)}).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==f.version){if(f.migrate)return f.migrate(T.state,T.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return T.state}).then(T=>{var _;return k=f.merge(T,(_=o())!=null?_:O),n(k,!0),A()}).then(()=>{N==null||N(k,void 0),g=!0,v.forEach(T=>T(k))}).catch(T=>{N==null||N(void 0,T)})};return c.persist={setOptions:G=>{f={...f,...G},G.getStorage&&(x=G.getStorage())},clearStorage:()=>{x==null||x.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>P(),hasHydrated:()=>g,onHydrate:G=>(m.add(G),()=>{m.delete(G)}),onFinishHydration:G=>(v.add(G),()=>{v.delete(G)})},P(),k||O},wT=(e,t)=>(n,o,c)=>{let f={storage:xT(()=>localStorage),partialize:P=>P,version:0,merge:(P,G)=>({...G,...P}),...t},g=!1;const m=new Set,v=new Set;let x=f.storage;if(!x)return e((...P)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),n(...P)},o,c);const C=()=>{const P=f.partialize({...o()});return x.setItem(f.name,{state:P,version:f.version})},A=c.setState;c.setState=(P,G)=>{A(P,G),C()};const I=e((...P)=>{n(...P),C()},o,c);c.getInitialState=()=>I;let O;const k=()=>{var P,G;if(!x)return;g=!1,m.forEach(T=>{var _;return T((_=o())!=null?_:I)});const N=((G=f.onRehydrateStorage)==null?void 0:G.call(f,(P=o())!=null?P:I))||void 0;return Oo(x.getItem.bind(x))(f.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==f.version){if(f.migrate)return[!0,f.migrate(T.state,T.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var _;const[U,z]=T;if(O=f.merge(z,(_=o())!=null?_:I),n(O,!0),U)return C()}).then(()=>{N==null||N(O,void 0),O=o(),g=!0,v.forEach(T=>T(O))}).catch(T=>{N==null||N(void 0,T)})};return c.persist={setOptions:P=>{f={...f,...P},P.storage&&(x=P.storage)},clearStorage:()=>{x==null||x.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>k(),hasHydrated:()=>g,onHydrate:P=>(m.add(P),()=>{m.delete(P)}),onFinishHydration:P=>(v.add(P),()=>{v.delete(P)})},f.skipHydration||k(),O||I},vT=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((pT?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),mT(e,t)):wT(e,t),yT=vT;function ET(){return typeof document<"u"&&document.body.dataset.webShell==="1"}function sm(){return typeof navigator>"u"?!1:ET()||!/Electron\//i.test(navigator.userAgent)}function TO(e=900){const[t,n]=ht.useState(()=>typeof window<"u"&&window.innerWidth<e);return ht.useEffect(()=>{const o=window.matchMedia(`(max-width: ${e-1}px)`),c=f=>n(f.matches);return n(o.matches),o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[e]),t}const Sg=[{id:"pearl",label:"珍珠白",preview:["#f5f6fa","#4f6ef7"]},{id:"scifi",label:"科幻霓虹",preview:["#050a14","#22d3ee"]},{id:"noir",label:"暗夜黑",preview:["#0f1115","#a78bfa"]}],RO=[{id:"standard",label:"标准",description:"侧边栏 + 对话区"},{id:"focus",label:"专注",description:"隐藏侧边栏,居中沉浸对话"},{id:"compact",label:"紧凑",description:"更小间距与字号,信息密度优先"}],om=4;function am(e){return Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))]:[]}function CT(e,t){const n=e??{};return{...n.skin!==void 0?{skin:n.skin}:{},...n.layout!==void 0?{layout:n.layout}:{},...n.autoSpeak!==void 0?{autoSpeak:n.autoSpeak}:{},...n.wakeEnabled!==void 0?{wakeEnabled:n.wakeEnabled}:{},...n.wakeWord!==void 0?{wakeWord:n.wakeWord}:{},...n.runningFirst!==void 0?{runningFirst:n.runningFirst}:{},pinnedSessionIds:am(n.pinnedSessionIds),...t<om&&sm()?{wakeEnabled:!1}:{}}}function AT(e=sm()){return!e}const Nl=gT()(yT(e=>({skin:"pearl",layout:"standard",autoSpeak:!1,wakeEnabled:AT(),wakeWord:"小智",runningFirst:!1,pinnedSessionIds:[],setSkin:t=>e({skin:t}),setLayout:t=>e({layout:t}),setAutoSpeak:t=>e({autoSpeak:t}),setWakeEnabled:t=>e({wakeEnabled:t}),setWakeWord:t=>e({wakeWord:t}),setRunningFirst:t=>e({runningFirst:t}),togglePinnedSession:t=>e(n=>({pinnedSessionIds:n.pinnedSessionIds.includes(t)?n.pinnedSessionIds.filter(o=>o!==t):am([...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:om,migrate:CT}));var lm={exports:{}},wr={},um={exports:{}},cm={};/**
|
|
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=["./App-Bnv7-jUZ.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,de){var pe=te.length;te.push(de);e:for(;0<pe;){var He=pe-1>>>1,Ie=te[He];if(0<c(Ie,de))te[He]=de,te[pe]=Ie,pe=He;else break e}}function n(te){return te.length===0?null:te[0]}function o(te){if(te.length===0)return null;var de=te[0],pe=te.pop();if(pe!==de){te[0]=pe;e:for(var He=0,Ie=te.length,yr=Ie>>>1;He<yr;){var Ke=2*(He+1)-1,ni=te[Ke],le=Ke+1,In=te[le];if(0>c(ni,pe))le<Ie&&0>c(In,ni)?(te[He]=In,te[le]=pe,He=le):(te[He]=ni,te[Ke]=pe,He=Ke);else if(le<Ie&&0>c(In,pe))te[He]=In,te[le]=pe,He=le;else break e}}return de}function c(te,de){var pe=te.sortIndex-de.sortIndex;return pe!==0?pe:te.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,m=g.now();e.unstable_now=function(){return g.now()-m}}var v=[],x=[],C=1,A=null,I=3,O=!1,k=!1,
|
|
42
|
+
*/(function(e){function t(te,de){var pe=te.length;te.push(de);e:for(;0<pe;){var He=pe-1>>>1,Ie=te[He];if(0<c(Ie,de))te[He]=de,te[pe]=Ie,pe=He;else break e}}function n(te){return te.length===0?null:te[0]}function o(te){if(te.length===0)return null;var de=te[0],pe=te.pop();if(pe!==de){te[0]=pe;e:for(var He=0,Ie=te.length,yr=Ie>>>1;He<yr;){var Ke=2*(He+1)-1,ni=te[Ke],le=Ke+1,In=te[le];if(0>c(ni,pe))le<Ie&&0>c(In,ni)?(te[He]=In,te[le]=pe,He=le):(te[He]=ni,te[Ke]=pe,He=Ke);else if(le<Ie&&0>c(In,pe))te[He]=In,te[le]=pe,He=le;else break e}}return de}function c(te,de){var pe=te.sortIndex-de.sortIndex;return pe!==0?pe:te.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,m=g.now();e.unstable_now=function(){return g.now()-m}}var v=[],x=[],C=1,A=null,I=3,O=!1,k=!1,P=!1,G=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(te){for(var de=n(x);de!==null;){if(de.callback===null)o(x);else if(de.startTime<=te)o(x),de.sortIndex=de.expirationTime,t(v,de);else break;de=n(x)}}function U(te){if(P=!1,_(te),!k)if(n(v)!==null)k=!0,tt(z);else{var de=n(x);de!==null&&xe(U,de.startTime-te)}}function z(te,de){k=!1,P&&(P=!1,N(X),X=-1),O=!0;var pe=I;try{for(_(de),A=n(v);A!==null&&(!(A.expirationTime>de)||te&&!ye());){var He=A.callback;if(typeof He=="function"){A.callback=null,I=A.priorityLevel;var Ie=He(A.expirationTime<=de);de=e.unstable_now(),typeof Ie=="function"?A.callback=Ie:A===n(v)&&o(v),_(de)}else o(v);A=n(v)}if(A!==null)var yr=!0;else{var Ke=n(x);Ke!==null&&xe(U,Ke.startTime-de),yr=!1}return yr}finally{A=null,I=pe,O=!1}}var j=!1,B=null,X=-1,V=5,oe=-1;function ye(){return!(e.unstable_now()-oe<V)}function se(){if(B!==null){var te=e.unstable_now();oe=te;var de=!0;try{de=B(!0,te)}finally{de?ge():(j=!1,B=null)}}else j=!1}var ge;if(typeof T=="function")ge=function(){T(se)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,H=Te.port2;Te.port1.onmessage=se,ge=function(){H.postMessage(null)}}else ge=function(){G(se,0)};function tt(te){B=te,j||(j=!0,ge())}function xe(te,de){X=G(function(){te(e.unstable_now())},de)}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||O||(k=!0,tt(z))},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"):V=0<te?Math.floor(1e3/te):5},e.unstable_getCurrentPriorityLevel=function(){return I},e.unstable_getFirstCallbackNode=function(){return n(v)},e.unstable_next=function(te){switch(I){case 1:case 2:case 3:var de=3;break;default:de=I}var pe=I;I=de;try{return te()}finally{I=pe}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(te,de){switch(te){case 1:case 2:case 3:case 4:case 5:break;default:te=3}var pe=I;I=te;try{return de()}finally{I=pe}},e.unstable_scheduleCallback=function(te,de,pe){var He=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?He+pe:He):pe=He,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=pe+Ie,te={id:C++,callback:de,priorityLevel:te,startTime:pe,expirationTime:Ie,sortIndex:-1},pe>He?(te.sortIndex=pe,t(x,te),n(v)===null&&te===n(x)&&(P?(N(X),X=-1):P=!0,xe(U,pe-He))):(te.sortIndex=Ie,t(v,te),k||O||(k=!0,tt(z))),te},e.unstable_shouldYield=ye,e.unstable_wrapCallback=function(te){var de=I;return function(){var pe=I;I=de;try{return te.apply(this,arguments)}finally{I=pe}}}})(cm);um.exports=cm;var ST=um.exports;/**
|
|
43
43
|
* @license React
|
|
44
44
|
* react-dom.production.min.js
|
|
45
45
|
*
|
|
@@ -47,26 +47,26 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-Bnv7-jUZ.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 IT=ht,pr=ST;function Z(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 fm=new Set,No={};function _i(e,t){ws(e,t),ws(e+"Capture",t)}function ws(e,t){for(No[e]=t,e=0;e<t.length;e++)fm.add(t[e])}var wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u")
|
|
51
|
-
|
|
50
|
+
*/var IT=ht,pr=ST;function Z(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 fm=new Set,No={};function _i(e,t){ws(e,t),ws(e+"Capture",t)}function ws(e,t){for(No[e]=t,e=0;e<t.length;e++)fm.add(t[e])}var wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$f=Object.prototype.hasOwnProperty,TT=/^[: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]*$/,Ig={},Tg={};function RT(e){return $f.call(Tg,e)?!0:$f.call(Ig,e)?!1:TT.test(e)?Tg[e]=!0:(Ig[e]=!0,!1)}function bT(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 _T(e,t,n,o){if(t===null||typeof t>"u"||bT(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 Kt(e,t,n,o,c,f,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=f,this.removeEmptyString=g}var Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bt[e]=new Kt(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 Kt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bt[e]=new Kt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bt[e]=new Kt(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 Kt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bt[e]=new Kt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bt[e]=new Kt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bt[e]=new Kt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bt[e]=new Kt(e,5,!1,e.toLowerCase(),null,!1,!1)});var M0=/[\-:]([a-z])/g;function k0(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(M0,k0);Bt[t]=new Kt(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(M0,k0);Bt[t]=new Kt(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(M0,k0);Bt[t]=new Kt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new Kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bt[e]=new Kt(e,1,!1,e.toLowerCase(),null,!0,!0)});function B0(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")&&(_T(t,n,c,o)&&(n=null),o||c===null?RT(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 Sn=IT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ka=Symbol.for("react.element"),Xi=Symbol.for("react.portal"),Yi=Symbol.for("react.fragment"),L0=Symbol.for("react.strict_mode"),Vf=Symbol.for("react.profiler"),dm=Symbol.for("react.provider"),hm=Symbol.for("react.context"),F0=Symbol.for("react.forward_ref"),zf=Symbol.for("react.suspense"),Hf=Symbol.for("react.suspense_list"),U0=Symbol.for("react.memo"),Mn=Symbol.for("react.lazy"),gm=Symbol.for("react.offscreen"),Rg=Symbol.iterator;function Zs(e){return e===null||typeof e!="object"?null:(e=Rg&&e[Rg]||e["@@iterator"],typeof e=="function"?e:null)}var et=Object.assign,Vc;function ao(e){if(Vc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Vc=t&&t[1]||""}return`
|
|
51
|
+
`+Vc+e}var zc=!1;function Hc(e,t){if(!e||zc)return"";zc=!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(x){var o=x}Reflect.construct(e,[],t)}else{try{t.call()}catch(x){o=x}e.call(t.prototype)}else{try{throw Error()}catch(x){o=x}e()}}catch(x){if(x&&o&&typeof x.stack=="string"){for(var c=x.stack.split(`
|
|
52
52
|
`),f=o.stack.split(`
|
|
53
53
|
`),g=c.length-1,m=f.length-1;1<=g&&0<=m&&c[g]!==f[m];)m--;for(;1<=g&&0<=m;g--,m--)if(c[g]!==f[m]){if(g!==1||m!==1)do if(g--,m--,0>m||c[g]!==f[m]){var v=`
|
|
54
|
-
`+c[g].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=g&&0<=m);break}}}finally{Vc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ao(e):""}function OT(e){switch(e.tag){case 5:return ao(e.type);case 16:return ao("Lazy");case 13:return ao("Suspense");case 19:return ao("SuspenseList");case 0:case 2:case 15:return e=zc(e.type,!1),e;case 11:return e=zc(e.type.render,!1),e;case 1:return e=zc(e.type,!0),e;default:return""}}function Hf(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 Yi:return"Fragment";case Xi:return"Portal";case $f:return"Profiler";case L0:return"StrictMode";case Vf:return"Suspense";case zf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hm:return(e.displayName||"Context")+".Consumer";case dm:return(e._context.displayName||"Context")+".Provider";case F0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U0:return t=e.displayName||null,t!==null?t:Hf(e.type)||"Memo";case Pn:t=e._payload,e=e._init;try{return Hf(e(t))}catch{}}return null}function NT(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 Hf(t);case 8:return t===L0?"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 Zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function DT(e){var t=pm(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,f=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){o=""+g,f.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 Ba(e){e._valueTracker||(e._valueTracker=DT(e))}function xm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=pm(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}function Nl(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 Gf(e,t){var n=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bg(e,t){var n=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;n=Zn(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 mm(e,t){t=t.checked,t!=null&&B0(e,"checked",t,!1)}function Xf(e,t){mm(e,t);var n=Zn(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")?Yf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Yf(e,t.type,Zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _g(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 Yf(e,t,n){(t!=="number"||Nl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var lo=Array.isArray;function ls(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=""+Zn(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 Kf(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Z(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Og(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Z(92));if(lo(n)){if(1<n.length)throw Error(Z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Zn(n)}}function wm(e,t){var n=Zn(t.value),o=Zn(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 Ng(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vm(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 Zf(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vm(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var La,ym=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(La=La||document.createElement("div"),La.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=La.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Do(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xo={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},MT=["Webkit","ms","Moz","O"];Object.keys(xo).forEach(function(e){MT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xo[t]=xo[e]})});function Em(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xo.hasOwnProperty(e)&&xo[e]?(""+t).trim():t+"px"}function Cm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var o=n.indexOf("--")===0,c=Em(n,t[n],o);n==="float"&&(n="cssFloat"),o?e.setProperty(n,c):e[n]=c}}var PT=et({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 Qf(e,t){if(t){if(PT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function qf(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 Jf=null;function j0(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var e1=null,us=null,cs=null;function Dg(e){if(e=na(e)){if(typeof e1!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=_u(t),e1(e.stateNode,e.type,t))}}function Am(e){us?cs?cs.push(e):cs=[e]:us=e}function Sm(){if(us){var e=us,t=cs;if(cs=us=null,Dg(e),t)for(e=0;e<t.length;e++)Dg(t[e])}}function Im(e,t){return e(t)}function Tm(){}var Hc=!1;function Rm(e,t,n){if(Hc)return e(t,n);Hc=!0;try{return Im(e,t,n)}finally{Hc=!1,(us!==null||cs!==null)&&(Tm(),Sm())}}function Mo(e,t){var n=e.stateNode;if(n===null)return null;var o=_u(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(Z(231,t,typeof n));return n}var t1=!1;if(wn)try{var Qs={};Object.defineProperty(Qs,"passive",{get:function(){t1=!0}}),window.addEventListener("test",Qs,Qs),window.removeEventListener("test",Qs,Qs)}catch{t1=!1}function kT(e,t,n,o,c,f,g,m,v){var x=Array.prototype.slice.call(arguments,3);try{t.apply(n,x)}catch(C){this.onError(C)}}var mo=!1,Dl=null,Ml=!1,r1=null,BT={onError:function(e){mo=!0,Dl=e}};function LT(e,t,n,o,c,f,g,m,v){mo=!1,Dl=null,kT.apply(BT,arguments)}function FT(e,t,n,o,c,f,g,m,v){if(LT.apply(this,arguments),mo){if(mo){var x=Dl;mo=!1,Dl=null}else throw Error(Z(198));Ml||(Ml=!0,r1=x)}}function Oi(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 bm(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 Mg(e){if(Oi(e)!==e)throw Error(Z(188))}function UT(e){var t=e.alternate;if(!t){if(t=Oi(e),t===null)throw Error(Z(188));return t!==e?null:e}for(var n=e,o=t;;){var c=n.return;if(c===null)break;var f=c.alternate;if(f===null){if(o=c.return,o!==null){n=o;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===n)return Mg(c),e;if(f===o)return Mg(c),t;f=f.sibling}throw Error(Z(188))}if(n.return!==o.return)n=c,o=f;else{for(var g=!1,m=c.child;m;){if(m===n){g=!0,n=c,o=f;break}if(m===o){g=!0,o=c,n=f;break}m=m.sibling}if(!g){for(m=f.child;m;){if(m===n){g=!0,n=f,o=c;break}if(m===o){g=!0,o=f,n=c;break}m=m.sibling}if(!g)throw Error(Z(189))}}if(n.alternate!==o)throw Error(Z(190))}if(n.tag!==3)throw Error(Z(188));return n.stateNode.current===n?e:t}function _m(e){return e=UT(e),e!==null?Om(e):null}function Om(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Om(e);if(t!==null)return t;e=e.sibling}return null}var Nm=pr.unstable_scheduleCallback,Pg=pr.unstable_cancelCallback,jT=pr.unstable_shouldYield,WT=pr.unstable_requestPaint,ut=pr.unstable_now,$T=pr.unstable_getCurrentPriorityLevel,W0=pr.unstable_ImmediatePriority,Dm=pr.unstable_UserBlockingPriority,Pl=pr.unstable_NormalPriority,VT=pr.unstable_LowPriority,Mm=pr.unstable_IdlePriority,Iu=null,nn=null;function zT(e){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(Iu,e,void 0,(e.current.flags&128)===128)}catch{}}var jr=Math.clz32?Math.clz32:XT,HT=Math.log,GT=Math.LN2;function XT(e){return e>>>=0,e===0?32:31-(HT(e)/GT|0)|0}var Fa=64,Ua=4194304;function uo(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 kl(e,t){var n=e.pendingLanes;if(n===0)return 0;var o=0,c=e.suspendedLanes,f=e.pingedLanes,g=n&268435455;if(g!==0){var m=g&~c;m!==0?o=uo(m):(f&=g,f!==0&&(o=uo(f)))}else g=n&~c,g!==0?o=uo(g):f!==0&&(o=uo(f));if(o===0)return 0;if(t!==0&&t!==o&&!(t&c)&&(c=o&-o,f=t&-t,c>=f||c===16&&(f&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-jr(t),c=1<<n,o|=e[n],t&=~c;return o}function YT(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 KT(e,t){for(var n=e.suspendedLanes,o=e.pingedLanes,c=e.expirationTimes,f=e.pendingLanes;0<f;){var g=31-jr(f),m=1<<g,v=c[g];v===-1?(!(m&n)||m&o)&&(c[g]=YT(m,t)):v<=t&&(e.expiredLanes|=m),f&=~m}}function n1(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Pm(){var e=Fa;return Fa<<=1,!(Fa&4194240)&&(Fa=64),e}function Gc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ta(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-jr(t),e[t]=n}function ZT(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-jr(n),f=1<<c;t[c]=0,o[c]=-1,e[c]=-1,n&=~f}}function $0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var o=31-jr(n),c=1<<o;c&t|e[o]&t&&(e[o]|=t),n&=~c}}var Pe=0;function km(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bm,V0,Lm,Fm,Um,i1=!1,ja=[],$n=null,Vn=null,zn=null,Po=new Map,ko=new Map,Bn=[],QT="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 kg(e,t){switch(e){case"focusin":case"focusout":$n=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":Po.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ko.delete(t.pointerId)}}function qs(e,t,n,o,c,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:o,nativeEvent:f,targetContainers:[c]},t!==null&&(t=na(t),t!==null&&V0(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function qT(e,t,n,o,c){switch(t){case"focusin":return $n=qs($n,e,t,n,o,c),!0;case"dragenter":return Vn=qs(Vn,e,t,n,o,c),!0;case"mouseover":return zn=qs(zn,e,t,n,o,c),!0;case"pointerover":var f=c.pointerId;return Po.set(f,qs(Po.get(f)||null,e,t,n,o,c)),!0;case"gotpointercapture":return f=c.pointerId,ko.set(f,qs(ko.get(f)||null,e,t,n,o,c)),!0}return!1}function jm(e){var t=gi(e.target);if(t!==null){var n=Oi(t);if(n!==null){if(t=n.tag,t===13){if(t=bm(n),t!==null){e.blockedOn=t,Um(e.priority,function(){Lm(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 cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=s1(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var o=new n.constructor(n.type,n);Jf=o,n.target.dispatchEvent(o),Jf=null}else return t=na(n),t!==null&&V0(t),e.blockedOn=n,!1;t.shift()}return!0}function Bg(e,t,n){cl(e)&&n.delete(t)}function JT(){i1=!1,$n!==null&&cl($n)&&($n=null),Vn!==null&&cl(Vn)&&(Vn=null),zn!==null&&cl(zn)&&(zn=null),Po.forEach(Bg),ko.forEach(Bg)}function Js(e,t){e.blockedOn===t&&(e.blockedOn=null,i1||(i1=!0,pr.unstable_scheduleCallback(pr.unstable_NormalPriority,JT)))}function Bo(e){function t(c){return Js(c,e)}if(0<ja.length){Js(ja[0],e);for(var n=1;n<ja.length;n++){var o=ja[n];o.blockedOn===e&&(o.blockedOn=null)}}for($n!==null&&Js($n,e),Vn!==null&&Js(Vn,e),zn!==null&&Js(zn,e),Po.forEach(t),ko.forEach(t),n=0;n<Bn.length;n++)o=Bn[n],o.blockedOn===e&&(o.blockedOn=null);for(;0<Bn.length&&(n=Bn[0],n.blockedOn===null);)jm(n),n.blockedOn===null&&Bn.shift()}var fs=Sn.ReactCurrentBatchConfig,Bl=!0;function eR(e,t,n,o){var c=Pe,f=fs.transition;fs.transition=null;try{Pe=1,z0(e,t,n,o)}finally{Pe=c,fs.transition=f}}function tR(e,t,n,o){var c=Pe,f=fs.transition;fs.transition=null;try{Pe=4,z0(e,t,n,o)}finally{Pe=c,fs.transition=f}}function z0(e,t,n,o){if(Bl){var c=s1(e,t,n,o);if(c===null)rf(e,t,o,Ll,n),kg(e,o);else if(qT(c,e,t,n,o))o.stopPropagation();else if(kg(e,o),t&4&&-1<QT.indexOf(e)){for(;c!==null;){var f=na(c);if(f!==null&&Bm(f),f=s1(e,t,n,o),f===null&&rf(e,t,o,Ll,n),f===c)break;c=f}c!==null&&o.stopPropagation()}else rf(e,t,o,null,n)}}var Ll=null;function s1(e,t,n,o){if(Ll=null,e=j0(o),e=gi(e),e!==null)if(t=Oi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=bm(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 Ll=e,null}function Wm(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($T()){case W0:return 1;case Dm:return 4;case Pl:case VT:return 16;case Mm:return 536870912;default:return 16}default:return 16}}var jn=null,H0=null,fl=null;function $m(){if(fl)return fl;var e,t=H0,n=t.length,o,c="value"in jn?jn.value:jn.textContent,f=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[f-o];o++);return fl=c.slice(e,1<o?1-o:void 0)}function dl(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 Wa(){return!0}function Lg(){return!1}function vr(e){function t(n,o,c,f,g){this._reactName=n,this._targetInst=c,this.type=o,this.nativeEvent=f,this.target=g,this.currentTarget=null;for(var m in e)e.hasOwnProperty(m)&&(n=e[m],this[m]=n?n(f):f[m]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Wa:Lg,this.isPropagationStopped=Lg,this}return et(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=Wa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wa)},persist:function(){},isPersistent:Wa}),t}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},G0=vr(Os),ra=et({},Os,{view:0,detail:0}),rR=vr(ra),Xc,Yc,eo,Tu=et({},ra,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:X0,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!==eo&&(eo&&e.type==="mousemove"?(Xc=e.screenX-eo.screenX,Yc=e.screenY-eo.screenY):Yc=Xc=0,eo=e),Xc)},movementY:function(e){return"movementY"in e?e.movementY:Yc}}),Fg=vr(Tu),nR=et({},Tu,{dataTransfer:0}),iR=vr(nR),sR=et({},ra,{relatedTarget:0}),Kc=vr(sR),oR=et({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),aR=vr(oR),lR=et({},Os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uR=vr(lR),cR=et({},Os,{data:0}),Ug=vr(cR),fR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dR={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"},hR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=hR[e])?!!t[e]:!1}function X0(){return gR}var pR=et({},ra,{key:function(e){if(e.key){var t=fR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:X0,charCode:function(e){return e.type==="keypress"?dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xR=vr(pR),mR=et({},Tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jg=vr(mR),wR=et({},ra,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:X0}),vR=vr(wR),yR=et({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),ER=vr(yR),CR=et({},Tu,{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}),AR=vr(CR),SR=[9,13,27,32],Y0=wn&&"CompositionEvent"in window,wo=null;wn&&"documentMode"in document&&(wo=document.documentMode);var IR=wn&&"TextEvent"in window&&!wo,Vm=wn&&(!Y0||wo&&8<wo&&11>=wo),Wg=" ",$g=!1;function zm(e,t){switch(e){case"keyup":return SR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ki=!1;function TR(e,t){switch(e){case"compositionend":return Hm(t);case"keypress":return t.which!==32?null:($g=!0,Wg);case"textInput":return e=t.data,e===Wg&&$g?null:e;default:return null}}function RR(e,t){if(Ki)return e==="compositionend"||!Y0&&zm(e,t)?(e=$m(),fl=H0=jn=null,Ki=!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 Vm&&t.locale!=="ko"?null:t.data;default:return null}}var bR={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 Vg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!bR[e.type]:t==="textarea"}function Gm(e,t,n,o){Am(o),t=Fl(t,"onChange"),0<t.length&&(n=new G0("onChange","change",null,n,o),e.push({event:n,listeners:t}))}var vo=null,Lo=null;function _R(e){nw(e,0)}function Ru(e){var t=qi(e);if(xm(t))return e}function OR(e,t){if(e==="change")return t}var Xm=!1;if(wn){var Zc;if(wn){var Qc="oninput"in document;if(!Qc){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),Qc=typeof zg.oninput=="function"}Zc=Qc}else Zc=!1;Xm=Zc&&(!document.documentMode||9<document.documentMode)}function Hg(){vo&&(vo.detachEvent("onpropertychange",Ym),Lo=vo=null)}function Ym(e){if(e.propertyName==="value"&&Ru(Lo)){var t=[];Gm(t,Lo,e,j0(e)),Rm(_R,t)}}function NR(e,t,n){e==="focusin"?(Hg(),vo=t,Lo=n,vo.attachEvent("onpropertychange",Ym)):e==="focusout"&&Hg()}function DR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ru(Lo)}function MR(e,t){if(e==="click")return Ru(t)}function PR(e,t){if(e==="input"||e==="change")return Ru(t)}function kR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $r=typeof Object.is=="function"?Object.is:kR;function Fo(e,t){if($r(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(!Wf.call(t,c)||!$r(e[c],t[c]))return!1}return!0}function Gg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xg(e,t){var n=Gg(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=Gg(n)}}function Km(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Km(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zm(){for(var e=window,t=Nl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nl(e.document)}return t}function K0(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 BR(e){var t=Zm(),n=e.focusedElem,o=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Km(n.ownerDocument.documentElement,n)){if(o!==null&&K0(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,f=Math.min(o.start,c);o=o.end===void 0?f:Math.min(o.end,c),!e.extend&&f>o&&(c=o,o=f,f=c),c=Xg(n,f);var g=Xg(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(),f>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 LR=wn&&"documentMode"in document&&11>=document.documentMode,Zi=null,o1=null,yo=null,a1=!1;function Yg(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;a1||Zi==null||Zi!==Nl(o)||(o=Zi,"selectionStart"in o&&K0(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}),yo&&Fo(yo,o)||(yo=o,o=Fl(o1,"onSelect"),0<o.length&&(t=new G0("onSelect","select",null,t,n),e.push({event:t,listeners:o}),t.target=Zi)))}function $a(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Qi={animationend:$a("Animation","AnimationEnd"),animationiteration:$a("Animation","AnimationIteration"),animationstart:$a("Animation","AnimationStart"),transitionend:$a("Transition","TransitionEnd")},qc={},Qm={};wn&&(Qm=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function bu(e){if(qc[e])return qc[e];if(!Qi[e])return e;var t=Qi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qm)return qc[e]=t[n];return e}var qm=bu("animationend"),Jm=bu("animationiteration"),ew=bu("animationstart"),tw=bu("transitionend"),rw=new Map,Kg="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 ei(e,t){rw.set(e,t),_i(t,[e])}for(var Jc=0;Jc<Kg.length;Jc++){var ef=Kg[Jc],FR=ef.toLowerCase(),UR=ef[0].toUpperCase()+ef.slice(1);ei(FR,"on"+UR)}ei(qm,"onAnimationEnd");ei(Jm,"onAnimationIteration");ei(ew,"onAnimationStart");ei("dblclick","onDoubleClick");ei("focusin","onFocus");ei("focusout","onBlur");ei(tw,"onTransitionEnd");ws("onMouseEnter",["mouseout","mouseover"]);ws("onMouseLeave",["mouseout","mouseover"]);ws("onPointerEnter",["pointerout","pointerover"]);ws("onPointerLeave",["pointerout","pointerover"]);_i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_i("onBeforeInput",["compositionend","keypress","textInput","paste"]);_i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var co="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(" "),jR=new Set("cancel close invalid load scroll toggle".split(" ").concat(co));function Zg(e,t,n){var o=e.type||"unknown-event";e.currentTarget=n,FT(o,t,void 0,e),e.currentTarget=null}function nw(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 f=void 0;if(t)for(var g=o.length-1;0<=g;g--){var m=o[g],v=m.instance,x=m.currentTarget;if(m=m.listener,v!==f&&c.isPropagationStopped())break e;Zg(c,m,x),f=v}else for(g=0;g<o.length;g++){if(m=o[g],v=m.instance,x=m.currentTarget,m=m.listener,v!==f&&c.isPropagationStopped())break e;Zg(c,m,x),f=v}}}if(Ml)throw e=r1,Ml=!1,r1=null,e}function Ve(e,t){var n=t[d1];n===void 0&&(n=t[d1]=new Set);var o=e+"__bubble";n.has(o)||(iw(t,e,2,!1),n.add(o))}function tf(e,t,n){var o=0;t&&(o|=4),iw(n,e,o,t)}var Va="_reactListening"+Math.random().toString(36).slice(2);function Uo(e){if(!e[Va]){e[Va]=!0,fm.forEach(function(n){n!=="selectionchange"&&(jR.has(n)||tf(n,!1,e),tf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Va]||(t[Va]=!0,tf("selectionchange",!1,t))}}function iw(e,t,n,o){switch(Wm(t)){case 1:var c=eR;break;case 4:c=tR;break;default:c=z0}n=c.bind(null,t,n,e),c=void 0,!t1||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 rf(e,t,n,o,c){var f=o;if(!(t&1)&&!(t&2)&&o!==null)e:for(;;){if(o===null)return;var g=o.tag;if(g===3||g===4){var m=o.stateNode.containerInfo;if(m===c||m.nodeType===8&&m.parentNode===c)break;if(g===4)for(g=o.return;g!==null;){var v=g.tag;if((v===3||v===4)&&(v=g.stateNode.containerInfo,v===c||v.nodeType===8&&v.parentNode===c))return;g=g.return}for(;m!==null;){if(g=gi(m),g===null)return;if(v=g.tag,v===5||v===6){o=f=g;continue e}m=m.parentNode}}o=o.return}Rm(function(){var x=f,C=j0(n),A=[];e:{var I=rw.get(e);if(I!==void 0){var O=G0,k=e;switch(e){case"keypress":if(dl(n)===0)break e;case"keydown":case"keyup":O=xR;break;case"focusin":k="focus",O=Kc;break;case"focusout":k="blur",O=Kc;break;case"beforeblur":case"afterblur":O=Kc;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":O=Fg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":O=iR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":O=vR;break;case qm:case Jm:case ew:O=aR;break;case tw:O=ER;break;case"scroll":O=rR;break;case"wheel":O=AR;break;case"copy":case"cut":case"paste":O=uR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":O=jg}var M=(t&4)!==0,G=!M&&e==="scroll",N=M?I!==null?I+"Capture":null:I;M=[];for(var T=x,_;T!==null;){_=T;var U=_.stateNode;if(_.tag===5&&U!==null&&(_=U,N!==null&&(U=Mo(T,N),U!=null&&M.push(jo(T,U,_)))),G)break;T=T.return}0<M.length&&(I=new O(I,k,null,n,C),A.push({event:I,listeners:M}))}}if(!(t&7)){e:{if(I=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",I&&n!==Jf&&(k=n.relatedTarget||n.fromElement)&&(gi(k)||k[vn]))break e;if((O||I)&&(I=C.window===C?C:(I=C.ownerDocument)?I.defaultView||I.parentWindow:window,O?(k=n.relatedTarget||n.toElement,O=x,k=k?gi(k):null,k!==null&&(G=Oi(k),k!==G||k.tag!==5&&k.tag!==6)&&(k=null)):(O=null,k=x),O!==k)){if(M=Fg,U="onMouseLeave",N="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(M=jg,U="onPointerLeave",N="onPointerEnter",T="pointer"),G=O==null?I:qi(O),_=k==null?I:qi(k),I=new M(U,T+"leave",O,n,C),I.target=G,I.relatedTarget=_,U=null,gi(C)===x&&(M=new M(N,T+"enter",k,n,C),M.target=_,M.relatedTarget=G,U=M),G=U,O&&k)t:{for(M=O,N=k,T=0,_=M;_;_=$i(_))T++;for(_=0,U=N;U;U=$i(U))_++;for(;0<T-_;)M=$i(M),T--;for(;0<_-T;)N=$i(N),_--;for(;T--;){if(M===N||N!==null&&M===N.alternate)break t;M=$i(M),N=$i(N)}M=null}else M=null;O!==null&&Qg(A,I,O,M,!1),k!==null&&G!==null&&Qg(A,G,k,M,!0)}}e:{if(I=x?qi(x):window,O=I.nodeName&&I.nodeName.toLowerCase(),O==="select"||O==="input"&&I.type==="file")var z=OR;else if(Vg(I))if(Xm)z=PR;else{z=DR;var j=NR}else(O=I.nodeName)&&O.toLowerCase()==="input"&&(I.type==="checkbox"||I.type==="radio")&&(z=MR);if(z&&(z=z(e,x))){Gm(A,z,n,C);break e}j&&j(e,I,x),e==="focusout"&&(j=I._wrapperState)&&j.controlled&&I.type==="number"&&Yf(I,"number",I.value)}switch(j=x?qi(x):window,e){case"focusin":(Vg(j)||j.contentEditable==="true")&&(Zi=j,o1=x,yo=null);break;case"focusout":yo=o1=Zi=null;break;case"mousedown":a1=!0;break;case"contextmenu":case"mouseup":case"dragend":a1=!1,Yg(A,n,C);break;case"selectionchange":if(LR)break;case"keydown":case"keyup":Yg(A,n,C)}var B;if(Y0)e:{switch(e){case"compositionstart":var X="onCompositionStart";break e;case"compositionend":X="onCompositionEnd";break e;case"compositionupdate":X="onCompositionUpdate";break e}X=void 0}else Ki?zm(e,n)&&(X="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(X="onCompositionStart");X&&(Vm&&n.locale!=="ko"&&(Ki||X!=="onCompositionStart"?X==="onCompositionEnd"&&Ki&&(B=$m()):(jn=C,H0="value"in jn?jn.value:jn.textContent,Ki=!0)),j=Fl(x,X),0<j.length&&(X=new Ug(X,e,null,n,C),A.push({event:X,listeners:j}),B?X.data=B:(B=Hm(n),B!==null&&(X.data=B)))),(B=IR?TR(e,n):RR(e,n))&&(x=Fl(x,"onBeforeInput"),0<x.length&&(C=new Ug("onBeforeInput","beforeinput",null,n,C),A.push({event:C,listeners:x}),C.data=B))}nw(A,t)})}function jo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fl(e,t){for(var n=t+"Capture",o=[];e!==null;){var c=e,f=c.stateNode;c.tag===5&&f!==null&&(c=f,f=Mo(e,n),f!=null&&o.unshift(jo(e,f,c)),f=Mo(e,t),f!=null&&o.push(jo(e,f,c))),e=e.return}return o}function $i(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qg(e,t,n,o,c){for(var f=t._reactName,g=[];n!==null&&n!==o;){var m=n,v=m.alternate,x=m.stateNode;if(v!==null&&v===o)break;m.tag===5&&x!==null&&(m=x,c?(v=Mo(n,f),v!=null&&g.unshift(jo(n,v,m))):c||(v=Mo(n,f),v!=null&&g.push(jo(n,v,m)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var WR=/\r\n?/g,$R=/\u0000|\uFFFD/g;function qg(e){return(typeof e=="string"?e:""+e).replace(WR,`
|
|
55
|
-
`).replace($R,"")}function za(e,t,n){if(t=qg(t),qg(e)!==t&&n)throw Error(Z(425))}function Ul(){}var l1=null,u1=null;function c1(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 f1=typeof setTimeout=="function"?setTimeout:void 0,VR=typeof clearTimeout=="function"?clearTimeout:void 0,Jg=typeof Promise=="function"?Promise:void 0,zR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jg<"u"?function(e){return Jg.resolve(null).then(e).catch(HR)}:f1;function HR(e){setTimeout(function(){throw e})}function nf(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),Bo(t);return}o--}else n!=="$"&&n!=="$?"&&n!=="$!"||o++;n=c}while(n);Bo(t)}function Hn(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 ep(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 Ns=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ns,Wo="__reactProps$"+Ns,vn="__reactContainer$"+Ns,d1="__reactEvents$"+Ns,GR="__reactListeners$"+Ns,XR="__reactHandles$"+Ns;function gi(e){var t=e[rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[vn]||n[rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ep(e);e!==null;){if(n=e[rn])return n;e=ep(e)}return t}e=n,n=e.parentNode}return null}function na(e){return e=e[rn]||e[vn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Z(33))}function _u(e){return e[Wo]||null}var h1=[],Ji=-1;function ti(e){return{current:e}}function ze(e){0>Ji||(e.current=h1[Ji],h1[Ji]=null,Ji--)}function We(e,t){Ji++,h1[Ji]=e.current,e.current=t}var Qn={},$t=ti(Qn),or=ti(!1),Ci=Qn;function vs(e,t){var n=e.type.contextTypes;if(!n)return Qn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var c={},f;for(f in n)c[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function ar(e){return e=e.childContextTypes,e!=null}function jl(){ze(or),ze($t)}function tp(e,t,n){if($t.current!==Qn)throw Error(Z(168));We($t,t),We(or,n)}function sw(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(Z(108,NT(e)||"Unknown",c));return et({},n,o)}function Wl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qn,Ci=$t.current,We($t,e),We(or,or.current),!0}function rp(e,t,n){var o=e.stateNode;if(!o)throw Error(Z(169));n?(e=sw(e,t,Ci),o.__reactInternalMemoizedMergedChildContext=e,ze(or),ze($t),We($t,e)):ze(or),We(or,n)}var fn=null,Ou=!1,sf=!1;function ow(e){fn===null?fn=[e]:fn.push(e)}function YR(e){Ou=!0,ow(e)}function ri(){if(!sf&&fn!==null){sf=!0;var e=0,t=Pe;try{var n=fn;for(Pe=1;e<n.length;e++){var o=n[e];do o=o(!0);while(o!==null)}fn=null,Ou=!1}catch(c){throw fn!==null&&(fn=fn.slice(e+1)),Nm(W0,ri),c}finally{Pe=t,sf=!1}}return null}var es=[],ts=0,$l=null,Vl=0,Ir=[],Tr=0,Ai=null,hn=1,gn="";function fi(e,t){es[ts++]=Vl,es[ts++]=$l,$l=e,Vl=t}function aw(e,t,n){Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,Ai=e;var o=hn;e=gn;var c=32-jr(o)-1;o&=~(1<<c),n+=1;var f=32-jr(t)+c;if(30<f){var g=c-c%5;f=(o&(1<<g)-1).toString(32),o>>=g,c-=g,hn=1<<32-jr(t)+c|n<<c|o,gn=f+e}else hn=1<<f|n<<c|o,gn=e}function Z0(e){e.return!==null&&(fi(e,1),aw(e,1,0))}function Q0(e){for(;e===$l;)$l=es[--ts],es[ts]=null,Vl=es[--ts],es[ts]=null;for(;e===Ai;)Ai=Ir[--Tr],Ir[Tr]=null,gn=Ir[--Tr],Ir[Tr]=null,hn=Ir[--Tr],Ir[Tr]=null}var gr=null,hr=null,Ye=!1,Ur=null;function lw(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 np(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,gr=e,hr=Hn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,gr=e,hr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ai!==null?{id:hn,overflow:gn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,gr=e,hr=null,!0):!1;default:return!1}}function g1(e){return(e.mode&1)!==0&&(e.flags&128)===0}function p1(e){if(Ye){var t=hr;if(t){var n=t;if(!np(e,t)){if(g1(e))throw Error(Z(418));t=Hn(n.nextSibling);var o=gr;t&&np(e,t)?lw(o,n):(e.flags=e.flags&-4097|2,Ye=!1,gr=e)}}else{if(g1(e))throw Error(Z(418));e.flags=e.flags&-4097|2,Ye=!1,gr=e}}}function ip(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;gr=e}function Ha(e){if(e!==gr)return!1;if(!Ye)return ip(e),Ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!c1(e.type,e.memoizedProps)),t&&(t=hr)){if(g1(e))throw uw(),Error(Z(418));for(;t;)lw(e,t),t=Hn(t.nextSibling)}if(ip(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){hr=Hn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}hr=null}}else hr=gr?Hn(e.stateNode.nextSibling):null;return!0}function uw(){for(var e=hr;e;)e=Hn(e.nextSibling)}function ys(){hr=gr=null,Ye=!1}function q0(e){Ur===null?Ur=[e]:Ur.push(e)}var KR=Sn.ReactCurrentBatchConfig;function to(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(Z(309));var o=n.stateNode}if(!o)throw Error(Z(147,e));var c=o,f=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===f?t.ref:(t=function(g){var m=c.refs;g===null?delete m[f]:m[f]=g},t._stringRef=f,t)}if(typeof e!="string")throw Error(Z(284));if(!n._owner)throw Error(Z(290,e))}return e}function Ga(e,t){throw e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function sp(e){var t=e._init;return t(e._payload)}function cw(e){function t(N,T){if(e){var _=N.deletions;_===null?(N.deletions=[T],N.flags|=16):_.push(T)}}function n(N,T){if(!e)return null;for(;T!==null;)t(N,T),T=T.sibling;return null}function o(N,T){for(N=new Map;T!==null;)T.key!==null?N.set(T.key,T):N.set(T.index,T),T=T.sibling;return N}function c(N,T){return N=Kn(N,T),N.index=0,N.sibling=null,N}function f(N,T,_){return N.index=_,e?(_=N.alternate,_!==null?(_=_.index,_<T?(N.flags|=2,T):_):(N.flags|=2,T)):(N.flags|=1048576,T)}function g(N){return e&&N.alternate===null&&(N.flags|=2),N}function m(N,T,_,U){return T===null||T.tag!==6?(T=df(_,N.mode,U),T.return=N,T):(T=c(T,_),T.return=N,T)}function v(N,T,_,U){var z=_.type;return z===Yi?C(N,T,_.props.children,U,_.key):T!==null&&(T.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Pn&&sp(z)===T.type)?(U=c(T,_.props),U.ref=to(N,T,_),U.return=N,U):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,U)}function x(N,T,_,U){return T===null||T.tag!==4||T.stateNode.containerInfo!==_.containerInfo||T.stateNode.implementation!==_.implementation?(T=hf(_,N.mode,U),T.return=N,T):(T=c(T,_.children||[]),T.return=N,T)}function C(N,T,_,U,z){return T===null||T.tag!==7?(T=vi(_,N.mode,U,z),T.return=N,T):(T=c(T,_),T.return=N,T)}function A(N,T,_){if(typeof T=="string"&&T!==""||typeof T=="number")return T=df(""+T,N.mode,_),T.return=N,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case ka:return _=vl(T.type,T.key,T.props,null,N.mode,_),_.ref=to(N,null,T),_.return=N,_;case Xi:return T=hf(T,N.mode,_),T.return=N,T;case Pn:var U=T._init;return A(N,U(T._payload),_)}if(lo(T)||Zs(T))return T=vi(T,N.mode,_,null),T.return=N,T;Ga(N,T)}return null}function I(N,T,_,U){var z=T!==null?T.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return z!==null?null:m(N,T,""+_,U);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:return _.key===z?v(N,T,_,U):null;case Xi:return _.key===z?x(N,T,_,U):null;case Pn:return z=_._init,I(N,T,z(_._payload),U)}if(lo(_)||Zs(_))return z!==null?null:C(N,T,_,U,null);Ga(N,_)}return null}function O(N,T,_,U,z){if(typeof U=="string"&&U!==""||typeof U=="number")return N=N.get(_)||null,m(T,N,""+U,z);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case ka:return N=N.get(U.key===null?_:U.key)||null,v(T,N,U,z);case Xi:return N=N.get(U.key===null?_:U.key)||null,x(T,N,U,z);case Pn:var j=U._init;return O(N,T,_,j(U._payload),z)}if(lo(U)||Zs(U))return N=N.get(_)||null,C(T,N,U,z,null);Ga(T,U)}return null}function k(N,T,_,U){for(var z=null,j=null,B=T,X=T=0,V=null;B!==null&&X<_.length;X++){B.index>X?(V=B,B=null):V=B.sibling;var oe=I(N,B,_[X],U);if(oe===null){B===null&&(B=V);break}e&&B&&oe.alternate===null&&t(N,B),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe,B=V}if(X===_.length)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;X<_.length;X++)B=A(N,_[X],U),B!==null&&(T=f(B,T,X),j===null?z=B:j.sibling=B,j=B);return Ye&&fi(N,X),z}for(B=o(N,B);X<_.length;X++)V=O(B,N,X,_[X],U),V!==null&&(e&&V.alternate!==null&&B.delete(V.key===null?X:V.key),T=f(V,T,X),j===null?z=V:j.sibling=V,j=V);return e&&B.forEach(function(ye){return t(N,ye)}),Ye&&fi(N,X),z}function M(N,T,_,U){var z=Zs(_);if(typeof z!="function")throw Error(Z(150));if(_=z.call(_),_==null)throw Error(Z(151));for(var j=z=null,B=T,X=T=0,V=null,oe=_.next();B!==null&&!oe.done;X++,oe=_.next()){B.index>X?(V=B,B=null):V=B.sibling;var ye=I(N,B,oe.value,U);if(ye===null){B===null&&(B=V);break}e&&B&&ye.alternate===null&&t(N,B),T=f(ye,T,X),j===null?z=ye:j.sibling=ye,j=ye,B=V}if(oe.done)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;!oe.done;X++,oe=_.next())oe=A(N,oe.value,U),oe!==null&&(T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return Ye&&fi(N,X),z}for(B=o(N,B);!oe.done;X++,oe=_.next())oe=O(B,N,X,oe.value,U),oe!==null&&(e&&oe.alternate!==null&&B.delete(oe.key===null?X:oe.key),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return e&&B.forEach(function(se){return t(N,se)}),Ye&&fi(N,X),z}function G(N,T,_,U){if(typeof _=="object"&&_!==null&&_.type===Yi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:e:{for(var z=_.key,j=T;j!==null;){if(j.key===z){if(z=_.type,z===Yi){if(j.tag===7){n(N,j.sibling),T=c(j,_.props.children),T.return=N,N=T;break e}}else if(j.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Pn&&sp(z)===j.type){n(N,j.sibling),T=c(j,_.props),T.ref=to(N,j,_),T.return=N,N=T;break e}n(N,j);break}else t(N,j);j=j.sibling}_.type===Yi?(T=vi(_.props.children,N.mode,U,_.key),T.return=N,N=T):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,N=U)}return g(N);case Xi:e:{for(j=_.key;T!==null;){if(T.key===j)if(T.tag===4&&T.stateNode.containerInfo===_.containerInfo&&T.stateNode.implementation===_.implementation){n(N,T.sibling),T=c(T,_.children||[]),T.return=N,N=T;break e}else{n(N,T);break}else t(N,T);T=T.sibling}T=hf(_,N.mode,U),T.return=N,N=T}return g(N);case Pn:return j=_._init,G(N,T,j(_._payload),U)}if(lo(_))return k(N,T,_,U);if(Zs(_))return M(N,T,_,U);Ga(N,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,T!==null&&T.tag===6?(n(N,T.sibling),T=c(T,_),T.return=N,N=T):(n(N,T),T=df(_,N.mode,U),T.return=N,N=T),g(N)):n(N,T)}return G}var Es=cw(!0),fw=cw(!1),zl=ti(null),Hl=null,rs=null,J0=null;function ed(){J0=rs=Hl=null}function td(e){var t=zl.current;ze(zl),e._currentValue=t}function x1(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 ds(e,t){Hl=e,J0=rs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(sr=!0),e.firstContext=null)}function _r(e){var t=e._currentValue;if(J0!==e)if(e={context:e,memoizedValue:t,next:null},rs===null){if(Hl===null)throw Error(Z(308));rs=e,Hl.dependencies={lanes:0,firstContext:e}}else rs=rs.next=e;return t}var pi=null;function rd(e){pi===null?pi=[e]:pi.push(e)}function dw(e,t,n,o){var c=t.interleaved;return c===null?(n.next=n,rd(t)):(n.next=c.next,c.next=n),t.interleaved=n,yn(e,o)}function yn(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 kn=!1;function nd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hw(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 pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,_e&2){var c=o.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),o.pending=t,yn(e,n)}return c=o.interleaved,c===null?(t.next=t,rd(o)):(t.next=c.next,c.next=t),o.interleaved=t,yn(e,n)}function hl(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,$0(e,n)}}function op(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var c=null,f=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};f===null?c=f=g:f=f.next=g,n=n.next}while(n!==null);f===null?c=f=t:f=f.next=t}else c=f=t;n={baseState:o.baseState,firstBaseUpdate:c,lastBaseUpdate:f,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 Gl(e,t,n,o){var c=e.updateQueue;kn=!1;var f=c.firstBaseUpdate,g=c.lastBaseUpdate,m=c.shared.pending;if(m!==null){c.shared.pending=null;var v=m,x=v.next;v.next=null,g===null?f=x:g.next=x,g=v;var C=e.alternate;C!==null&&(C=C.updateQueue,m=C.lastBaseUpdate,m!==g&&(m===null?C.firstBaseUpdate=x:m.next=x,C.lastBaseUpdate=v))}if(f!==null){var A=c.baseState;g=0,C=x=v=null,m=f;do{var I=m.lane,O=m.eventTime;if((o&I)===I){C!==null&&(C=C.next={eventTime:O,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var k=e,M=m;switch(I=t,O=n,M.tag){case 1:if(k=M.payload,typeof k=="function"){A=k.call(O,A,I);break e}A=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=M.payload,I=typeof k=="function"?k.call(O,A,I):k,I==null)break e;A=et({},A,I);break e;case 2:kn=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,I=c.effects,I===null?c.effects=[m]:I.push(m))}else O={eventTime:O,lane:I,tag:m.tag,payload:m.payload,callback:m.callback,next:null},C===null?(x=C=O,v=A):C=C.next=O,g|=I;if(m=m.next,m===null){if(m=c.shared.pending,m===null)break;I=m,m=I.next,I.next=null,c.lastBaseUpdate=I,c.shared.pending=null}}while(!0);if(C===null&&(v=A),c.baseState=v,c.firstBaseUpdate=x,c.lastBaseUpdate=C,t=c.shared.interleaved,t!==null){c=t;do g|=c.lane,c=c.next;while(c!==t)}else f===null&&(c.shared.lanes=0);Ii|=g,e.lanes=g,e.memoizedState=A}}function ap(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(Z(191,c));c.call(o)}}}var ia={},sn=ti(ia),$o=ti(ia),Vo=ti(ia);function xi(e){if(e===ia)throw Error(Z(174));return e}function id(e,t){switch(We(Vo,t),We($o,e),We(sn,ia),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Zf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Zf(t,e)}ze(sn),We(sn,t)}function Cs(){ze(sn),ze($o),ze(Vo)}function gw(e){xi(Vo.current);var t=xi(sn.current),n=Zf(t,e.type);t!==n&&(We($o,e),We(sn,n))}function sd(e){$o.current===e&&(ze(sn),ze($o))}var qe=ti(0);function Xl(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 of=[];function od(){for(var e=0;e<of.length;e++)of[e]._workInProgressVersionPrimary=null;of.length=0}var gl=Sn.ReactCurrentDispatcher,af=Sn.ReactCurrentBatchConfig,Si=0,Je=null,vt=null,It=null,Yl=!1,Eo=!1,zo=0,ZR=0;function Ut(){throw Error(Z(321))}function ad(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$r(e[n],t[n]))return!1;return!0}function ld(e,t,n,o,c,f){if(Si=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,gl.current=e===null||e.memoizedState===null?eb:tb,e=n(o,c),Eo){f=0;do{if(Eo=!1,zo=0,25<=f)throw Error(Z(301));f+=1,It=vt=null,t.updateQueue=null,gl.current=rb,e=n(o,c)}while(Eo)}if(gl.current=Kl,t=vt!==null&&vt.next!==null,Si=0,It=vt=Je=null,Yl=!1,t)throw Error(Z(300));return e}function ud(){var e=zo!==0;return zo=0,e}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Je.memoizedState=It=e:It=It.next=e,It}function Or(){if(vt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var t=It===null?Je.memoizedState:It.next;if(t!==null)It=t,vt=e;else{if(e===null)throw Error(Z(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},It===null?Je.memoizedState=It=e:It=It.next=e}return It}function Ho(e,t){return typeof t=="function"?t(e):t}function lf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=vt,c=o.baseQueue,f=n.pending;if(f!==null){if(c!==null){var g=c.next;c.next=f.next,f.next=g}o.baseQueue=c=f,n.pending=null}if(c!==null){f=c.next,o=o.baseState;var m=g=null,v=null,x=f;do{var C=x.lane;if((Si&C)===C)v!==null&&(v=v.next={lane:0,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null}),o=x.hasEagerState?x.eagerState:e(o,x.action);else{var A={lane:C,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null};v===null?(m=v=A,g=o):v=v.next=A,Je.lanes|=C,Ii|=C}x=x.next}while(x!==null&&x!==f);v===null?g=o:v.next=m,$r(o,t.memoizedState)||(sr=!0),t.memoizedState=o,t.baseState=g,t.baseQueue=v,n.lastRenderedState=o}if(e=n.interleaved,e!==null){c=e;do f=c.lane,Je.lanes|=f,Ii|=f,c=c.next;while(c!==e)}else c===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function uf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=n.dispatch,c=n.pending,f=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do f=e(f,g.action),g=g.next;while(g!==c);$r(f,t.memoizedState)||(sr=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,o]}function pw(){}function xw(e,t){var n=Je,o=Or(),c=t(),f=!$r(o.memoizedState,c);if(f&&(o.memoizedState=c,sr=!0),o=o.queue,cd(vw.bind(null,n,o,e),[e]),o.getSnapshot!==t||f||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,Go(9,ww.bind(null,n,o,c,t),void 0,null),Tt===null)throw Error(Z(349));Si&30||mw(n,t,c)}return c}function mw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.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,yw(t)&&Ew(e)}function vw(e,t,n){return n(function(){yw(t)&&Ew(e)})}function yw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$r(e,n)}catch{return!0}}function Ew(e){var t=yn(e,1);t!==null&&Wr(t,e,1,-1)}function lp(e){var t=tn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t.queue=e,e=e.dispatch=JR.bind(null,Je,e),[t.memoizedState,e]}function Go(e,t,n,o){return e={tag:e,create:t,destroy:n,deps:o,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.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 Cw(){return Or().memoizedState}function pl(e,t,n,o){var c=tn();Je.flags|=e,c.memoizedState=Go(1|t,n,void 0,o===void 0?null:o)}function Nu(e,t,n,o){var c=Or();o=o===void 0?null:o;var f=void 0;if(vt!==null){var g=vt.memoizedState;if(f=g.destroy,o!==null&&ad(o,g.deps)){c.memoizedState=Go(t,n,f,o);return}}Je.flags|=e,c.memoizedState=Go(1|t,n,f,o)}function up(e,t){return pl(8390656,8,e,t)}function cd(e,t){return Nu(2048,8,e,t)}function Aw(e,t){return Nu(4,2,e,t)}function Sw(e,t){return Nu(4,4,e,t)}function Iw(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 Tw(e,t,n){return n=n!=null?n.concat([e]):null,Nu(4,4,Iw.bind(null,t,e),n)}function fd(){}function Rw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(n.memoizedState=[e,t],e)}function bw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(e=e(),n.memoizedState=[e,t],e)}function _w(e,t,n){return Si&21?($r(n,t)||(n=Pm(),Je.lanes|=n,Ii|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,sr=!0),e.memoizedState=n)}function QR(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var o=af.transition;af.transition={};try{e(!1),t()}finally{Pe=n,af.transition=o}}function Ow(){return Or().memoizedState}function qR(e,t,n){var o=Yn(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},Nw(e))Dw(t,n);else if(n=dw(e,t,n,o),n!==null){var c=Gt();Wr(n,e,o,c),Mw(n,t,o)}}function JR(e,t,n){var o=Yn(e),c={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(Nw(e))Dw(t,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,m=f(g,n);if(c.hasEagerState=!0,c.eagerState=m,$r(m,g)){var v=t.interleaved;v===null?(c.next=c,rd(t)):(c.next=v.next,v.next=c),t.interleaved=c;return}}catch{}finally{}n=dw(e,t,c,o),n!==null&&(c=Gt(),Wr(n,e,o,c),Mw(n,t,o))}}function Nw(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Dw(e,t){Eo=Yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Mw(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,$0(e,n)}}var Kl={readContext:_r,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},eb={readContext:_r,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:_r,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pl(4194308,4,Iw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var n=tn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=tn();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=qR.bind(null,Je,e),[o.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:lp,useDebugValue:fd,useDeferredValue:function(e){return tn().memoizedState=e},useTransition:function(){var e=lp(!1),t=e[0];return e=QR.bind(null,e[1]),tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=Je,c=tn();if(Ye){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),Tt===null)throw Error(Z(349));Si&30||mw(o,t,n)}c.memoizedState=n;var f={value:n,getSnapshot:t};return c.queue=f,up(vw.bind(null,o,f,e),[e]),o.flags|=2048,Go(9,ww.bind(null,o,f,n,t),void 0,null),n},useId:function(){var e=tn(),t=Tt.identifierPrefix;if(Ye){var n=gn,o=hn;n=(o&~(1<<32-jr(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=zo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ZR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},tb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:lf,useRef:Cw,useState:function(){return lf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return _w(t,vt.memoizedState,e)},useTransition:function(){var e=lf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1},rb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:uf,useRef:Cw,useState:function(){return uf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return vt===null?t.memoizedState=e:_w(t,vt.memoizedState,e)},useTransition:function(){var e=uf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1};function Br(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function m1(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n==null?t:et({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Du={isMounted:function(e){return(e=e._reactInternals)?Oi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.tag=1,f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gt(),o=Yn(e),c=pn(n,o);c.tag=2,t!=null&&(c.callback=t),t=Gn(e,c,o),t!==null&&(Wr(t,e,o,n),hl(t,e,o))}};function cp(e,t,n,o,c,f,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,g):t.prototype&&t.prototype.isPureReactComponent?!Fo(n,o)||!Fo(c,f):!0}function Pw(e,t,n){var o=!1,c=Qn,f=t.contextType;return typeof f=="object"&&f!==null?f=_r(f):(c=ar(t)?Ci:$t.current,o=t.contextTypes,f=(o=o!=null)?vs(e,c):Qn),t=new t(n,f),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Du,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=f),t}function fp(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&&Du.enqueueReplaceState(t,t.state,null)}function w1(e,t,n,o){var c=e.stateNode;c.props=n,c.state=e.memoizedState,c.refs={},nd(e);var f=t.contextType;typeof f=="object"&&f!==null?c.context=_r(f):(f=ar(t)?Ci:$t.current,c.context=vs(e,f)),c.state=e.memoizedState,f=t.getDerivedStateFromProps,typeof f=="function"&&(m1(e,t,f,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&&Du.enqueueReplaceState(c,c.state,null),Gl(e,n,c,o),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function As(e,t){try{var n="",o=t;do n+=OT(o),o=o.return;while(o);var c=n}catch(f){c=`
|
|
54
|
+
`+c[g].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=g&&0<=m);break}}}finally{zc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ao(e):""}function OT(e){switch(e.tag){case 5:return ao(e.type);case 16:return ao("Lazy");case 13:return ao("Suspense");case 19:return ao("SuspenseList");case 0:case 2:case 15:return e=Hc(e.type,!1),e;case 11:return e=Hc(e.type.render,!1),e;case 1:return e=Hc(e.type,!0),e;default:return""}}function Gf(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 Yi:return"Fragment";case Xi:return"Portal";case Vf:return"Profiler";case L0:return"StrictMode";case zf:return"Suspense";case Hf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hm:return(e.displayName||"Context")+".Consumer";case dm:return(e._context.displayName||"Context")+".Provider";case F0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U0:return t=e.displayName||null,t!==null?t:Gf(e.type)||"Memo";case Mn:t=e._payload,e=e._init;try{return Gf(e(t))}catch{}}return null}function NT(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 Gf(t);case 8:return t===L0?"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 Zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function DT(e){var t=pm(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,f=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){o=""+g,f.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 Ba(e){e._valueTracker||(e._valueTracker=DT(e))}function xm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=pm(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}function Dl(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 Xf(e,t){var n=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bg(e,t){var n=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;n=Zn(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 mm(e,t){t=t.checked,t!=null&&B0(e,"checked",t,!1)}function Yf(e,t){mm(e,t);var n=Zn(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")?Kf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Kf(e,t.type,Zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _g(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 Kf(e,t,n){(t!=="number"||Dl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var lo=Array.isArray;function ls(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=""+Zn(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 Zf(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Z(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Og(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Z(92));if(lo(n)){if(1<n.length)throw Error(Z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Zn(n)}}function wm(e,t){var n=Zn(t.value),o=Zn(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 Ng(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vm(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 Qf(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vm(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var La,ym=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(La=La||document.createElement("div"),La.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=La.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Do(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xo={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},PT=["Webkit","ms","Moz","O"];Object.keys(xo).forEach(function(e){PT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xo[t]=xo[e]})});function Em(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xo.hasOwnProperty(e)&&xo[e]?(""+t).trim():t+"px"}function Cm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var o=n.indexOf("--")===0,c=Em(n,t[n],o);n==="float"&&(n="cssFloat"),o?e.setProperty(n,c):e[n]=c}}var MT=et({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 qf(e,t){if(t){if(MT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function Jf(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 e1=null;function j0(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var t1=null,us=null,cs=null;function Dg(e){if(e=na(e)){if(typeof t1!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=Ou(t),t1(e.stateNode,e.type,t))}}function Am(e){us?cs?cs.push(e):cs=[e]:us=e}function Sm(){if(us){var e=us,t=cs;if(cs=us=null,Dg(e),t)for(e=0;e<t.length;e++)Dg(t[e])}}function Im(e,t){return e(t)}function Tm(){}var Gc=!1;function Rm(e,t,n){if(Gc)return e(t,n);Gc=!0;try{return Im(e,t,n)}finally{Gc=!1,(us!==null||cs!==null)&&(Tm(),Sm())}}function Po(e,t){var n=e.stateNode;if(n===null)return null;var o=Ou(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(Z(231,t,typeof n));return n}var r1=!1;if(wn)try{var Qs={};Object.defineProperty(Qs,"passive",{get:function(){r1=!0}}),window.addEventListener("test",Qs,Qs),window.removeEventListener("test",Qs,Qs)}catch{r1=!1}function kT(e,t,n,o,c,f,g,m,v){var x=Array.prototype.slice.call(arguments,3);try{t.apply(n,x)}catch(C){this.onError(C)}}var mo=!1,Pl=null,Ml=!1,n1=null,BT={onError:function(e){mo=!0,Pl=e}};function LT(e,t,n,o,c,f,g,m,v){mo=!1,Pl=null,kT.apply(BT,arguments)}function FT(e,t,n,o,c,f,g,m,v){if(LT.apply(this,arguments),mo){if(mo){var x=Pl;mo=!1,Pl=null}else throw Error(Z(198));Ml||(Ml=!0,n1=x)}}function Oi(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 bm(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 Pg(e){if(Oi(e)!==e)throw Error(Z(188))}function UT(e){var t=e.alternate;if(!t){if(t=Oi(e),t===null)throw Error(Z(188));return t!==e?null:e}for(var n=e,o=t;;){var c=n.return;if(c===null)break;var f=c.alternate;if(f===null){if(o=c.return,o!==null){n=o;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===n)return Pg(c),e;if(f===o)return Pg(c),t;f=f.sibling}throw Error(Z(188))}if(n.return!==o.return)n=c,o=f;else{for(var g=!1,m=c.child;m;){if(m===n){g=!0,n=c,o=f;break}if(m===o){g=!0,o=c,n=f;break}m=m.sibling}if(!g){for(m=f.child;m;){if(m===n){g=!0,n=f,o=c;break}if(m===o){g=!0,o=f,n=c;break}m=m.sibling}if(!g)throw Error(Z(189))}}if(n.alternate!==o)throw Error(Z(190))}if(n.tag!==3)throw Error(Z(188));return n.stateNode.current===n?e:t}function _m(e){return e=UT(e),e!==null?Om(e):null}function Om(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Om(e);if(t!==null)return t;e=e.sibling}return null}var Nm=pr.unstable_scheduleCallback,Mg=pr.unstable_cancelCallback,jT=pr.unstable_shouldYield,WT=pr.unstable_requestPaint,ut=pr.unstable_now,$T=pr.unstable_getCurrentPriorityLevel,W0=pr.unstable_ImmediatePriority,Dm=pr.unstable_UserBlockingPriority,kl=pr.unstable_NormalPriority,VT=pr.unstable_LowPriority,Pm=pr.unstable_IdlePriority,Tu=null,nn=null;function zT(e){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(Tu,e,void 0,(e.current.flags&128)===128)}catch{}}var jr=Math.clz32?Math.clz32:XT,HT=Math.log,GT=Math.LN2;function XT(e){return e>>>=0,e===0?32:31-(HT(e)/GT|0)|0}var Fa=64,Ua=4194304;function uo(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 Bl(e,t){var n=e.pendingLanes;if(n===0)return 0;var o=0,c=e.suspendedLanes,f=e.pingedLanes,g=n&268435455;if(g!==0){var m=g&~c;m!==0?o=uo(m):(f&=g,f!==0&&(o=uo(f)))}else g=n&~c,g!==0?o=uo(g):f!==0&&(o=uo(f));if(o===0)return 0;if(t!==0&&t!==o&&!(t&c)&&(c=o&-o,f=t&-t,c>=f||c===16&&(f&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-jr(t),c=1<<n,o|=e[n],t&=~c;return o}function YT(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 KT(e,t){for(var n=e.suspendedLanes,o=e.pingedLanes,c=e.expirationTimes,f=e.pendingLanes;0<f;){var g=31-jr(f),m=1<<g,v=c[g];v===-1?(!(m&n)||m&o)&&(c[g]=YT(m,t)):v<=t&&(e.expiredLanes|=m),f&=~m}}function i1(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Mm(){var e=Fa;return Fa<<=1,!(Fa&4194240)&&(Fa=64),e}function Xc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ta(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-jr(t),e[t]=n}function ZT(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-jr(n),f=1<<c;t[c]=0,o[c]=-1,e[c]=-1,n&=~f}}function $0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var o=31-jr(n),c=1<<o;c&t|e[o]&t&&(e[o]|=t),n&=~c}}var Me=0;function km(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bm,V0,Lm,Fm,Um,s1=!1,ja=[],$n=null,Vn=null,zn=null,Mo=new Map,ko=new Map,Bn=[],QT="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 kg(e,t){switch(e){case"focusin":case"focusout":$n=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":Mo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ko.delete(t.pointerId)}}function qs(e,t,n,o,c,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:o,nativeEvent:f,targetContainers:[c]},t!==null&&(t=na(t),t!==null&&V0(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function qT(e,t,n,o,c){switch(t){case"focusin":return $n=qs($n,e,t,n,o,c),!0;case"dragenter":return Vn=qs(Vn,e,t,n,o,c),!0;case"mouseover":return zn=qs(zn,e,t,n,o,c),!0;case"pointerover":var f=c.pointerId;return Mo.set(f,qs(Mo.get(f)||null,e,t,n,o,c)),!0;case"gotpointercapture":return f=c.pointerId,ko.set(f,qs(ko.get(f)||null,e,t,n,o,c)),!0}return!1}function jm(e){var t=gi(e.target);if(t!==null){var n=Oi(t);if(n!==null){if(t=n.tag,t===13){if(t=bm(n),t!==null){e.blockedOn=t,Um(e.priority,function(){Lm(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 cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=o1(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var o=new n.constructor(n.type,n);e1=o,n.target.dispatchEvent(o),e1=null}else return t=na(n),t!==null&&V0(t),e.blockedOn=n,!1;t.shift()}return!0}function Bg(e,t,n){cl(e)&&n.delete(t)}function JT(){s1=!1,$n!==null&&cl($n)&&($n=null),Vn!==null&&cl(Vn)&&(Vn=null),zn!==null&&cl(zn)&&(zn=null),Mo.forEach(Bg),ko.forEach(Bg)}function Js(e,t){e.blockedOn===t&&(e.blockedOn=null,s1||(s1=!0,pr.unstable_scheduleCallback(pr.unstable_NormalPriority,JT)))}function Bo(e){function t(c){return Js(c,e)}if(0<ja.length){Js(ja[0],e);for(var n=1;n<ja.length;n++){var o=ja[n];o.blockedOn===e&&(o.blockedOn=null)}}for($n!==null&&Js($n,e),Vn!==null&&Js(Vn,e),zn!==null&&Js(zn,e),Mo.forEach(t),ko.forEach(t),n=0;n<Bn.length;n++)o=Bn[n],o.blockedOn===e&&(o.blockedOn=null);for(;0<Bn.length&&(n=Bn[0],n.blockedOn===null);)jm(n),n.blockedOn===null&&Bn.shift()}var fs=Sn.ReactCurrentBatchConfig,Ll=!0;function eR(e,t,n,o){var c=Me,f=fs.transition;fs.transition=null;try{Me=1,z0(e,t,n,o)}finally{Me=c,fs.transition=f}}function tR(e,t,n,o){var c=Me,f=fs.transition;fs.transition=null;try{Me=4,z0(e,t,n,o)}finally{Me=c,fs.transition=f}}function z0(e,t,n,o){if(Ll){var c=o1(e,t,n,o);if(c===null)nf(e,t,o,Fl,n),kg(e,o);else if(qT(c,e,t,n,o))o.stopPropagation();else if(kg(e,o),t&4&&-1<QT.indexOf(e)){for(;c!==null;){var f=na(c);if(f!==null&&Bm(f),f=o1(e,t,n,o),f===null&&nf(e,t,o,Fl,n),f===c)break;c=f}c!==null&&o.stopPropagation()}else nf(e,t,o,null,n)}}var Fl=null;function o1(e,t,n,o){if(Fl=null,e=j0(o),e=gi(e),e!==null)if(t=Oi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=bm(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 Fl=e,null}function Wm(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($T()){case W0:return 1;case Dm:return 4;case kl:case VT:return 16;case Pm:return 536870912;default:return 16}default:return 16}}var jn=null,H0=null,fl=null;function $m(){if(fl)return fl;var e,t=H0,n=t.length,o,c="value"in jn?jn.value:jn.textContent,f=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[f-o];o++);return fl=c.slice(e,1<o?1-o:void 0)}function dl(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 Wa(){return!0}function Lg(){return!1}function vr(e){function t(n,o,c,f,g){this._reactName=n,this._targetInst=c,this.type=o,this.nativeEvent=f,this.target=g,this.currentTarget=null;for(var m in e)e.hasOwnProperty(m)&&(n=e[m],this[m]=n?n(f):f[m]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Wa:Lg,this.isPropagationStopped=Lg,this}return et(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=Wa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wa)},persist:function(){},isPersistent:Wa}),t}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},G0=vr(Os),ra=et({},Os,{view:0,detail:0}),rR=vr(ra),Yc,Kc,eo,Ru=et({},ra,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:X0,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!==eo&&(eo&&e.type==="mousemove"?(Yc=e.screenX-eo.screenX,Kc=e.screenY-eo.screenY):Kc=Yc=0,eo=e),Yc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Fg=vr(Ru),nR=et({},Ru,{dataTransfer:0}),iR=vr(nR),sR=et({},ra,{relatedTarget:0}),Zc=vr(sR),oR=et({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),aR=vr(oR),lR=et({},Os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uR=vr(lR),cR=et({},Os,{data:0}),Ug=vr(cR),fR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dR={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"},hR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=hR[e])?!!t[e]:!1}function X0(){return gR}var pR=et({},ra,{key:function(e){if(e.key){var t=fR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:X0,charCode:function(e){return e.type==="keypress"?dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xR=vr(pR),mR=et({},Ru,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jg=vr(mR),wR=et({},ra,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:X0}),vR=vr(wR),yR=et({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),ER=vr(yR),CR=et({},Ru,{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}),AR=vr(CR),SR=[9,13,27,32],Y0=wn&&"CompositionEvent"in window,wo=null;wn&&"documentMode"in document&&(wo=document.documentMode);var IR=wn&&"TextEvent"in window&&!wo,Vm=wn&&(!Y0||wo&&8<wo&&11>=wo),Wg=" ",$g=!1;function zm(e,t){switch(e){case"keyup":return SR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ki=!1;function TR(e,t){switch(e){case"compositionend":return Hm(t);case"keypress":return t.which!==32?null:($g=!0,Wg);case"textInput":return e=t.data,e===Wg&&$g?null:e;default:return null}}function RR(e,t){if(Ki)return e==="compositionend"||!Y0&&zm(e,t)?(e=$m(),fl=H0=jn=null,Ki=!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 Vm&&t.locale!=="ko"?null:t.data;default:return null}}var bR={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 Vg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!bR[e.type]:t==="textarea"}function Gm(e,t,n,o){Am(o),t=Ul(t,"onChange"),0<t.length&&(n=new G0("onChange","change",null,n,o),e.push({event:n,listeners:t}))}var vo=null,Lo=null;function _R(e){nw(e,0)}function bu(e){var t=qi(e);if(xm(t))return e}function OR(e,t){if(e==="change")return t}var Xm=!1;if(wn){var Qc;if(wn){var qc="oninput"in document;if(!qc){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),qc=typeof zg.oninput=="function"}Qc=qc}else Qc=!1;Xm=Qc&&(!document.documentMode||9<document.documentMode)}function Hg(){vo&&(vo.detachEvent("onpropertychange",Ym),Lo=vo=null)}function Ym(e){if(e.propertyName==="value"&&bu(Lo)){var t=[];Gm(t,Lo,e,j0(e)),Rm(_R,t)}}function NR(e,t,n){e==="focusin"?(Hg(),vo=t,Lo=n,vo.attachEvent("onpropertychange",Ym)):e==="focusout"&&Hg()}function DR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bu(Lo)}function PR(e,t){if(e==="click")return bu(t)}function MR(e,t){if(e==="input"||e==="change")return bu(t)}function kR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $r=typeof Object.is=="function"?Object.is:kR;function Fo(e,t){if($r(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(!$f.call(t,c)||!$r(e[c],t[c]))return!1}return!0}function Gg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xg(e,t){var n=Gg(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=Gg(n)}}function Km(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Km(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zm(){for(var e=window,t=Dl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dl(e.document)}return t}function K0(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 BR(e){var t=Zm(),n=e.focusedElem,o=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Km(n.ownerDocument.documentElement,n)){if(o!==null&&K0(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,f=Math.min(o.start,c);o=o.end===void 0?f:Math.min(o.end,c),!e.extend&&f>o&&(c=o,o=f,f=c),c=Xg(n,f);var g=Xg(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(),f>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 LR=wn&&"documentMode"in document&&11>=document.documentMode,Zi=null,a1=null,yo=null,l1=!1;function Yg(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;l1||Zi==null||Zi!==Dl(o)||(o=Zi,"selectionStart"in o&&K0(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}),yo&&Fo(yo,o)||(yo=o,o=Ul(a1,"onSelect"),0<o.length&&(t=new G0("onSelect","select",null,t,n),e.push({event:t,listeners:o}),t.target=Zi)))}function $a(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Qi={animationend:$a("Animation","AnimationEnd"),animationiteration:$a("Animation","AnimationIteration"),animationstart:$a("Animation","AnimationStart"),transitionend:$a("Transition","TransitionEnd")},Jc={},Qm={};wn&&(Qm=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function _u(e){if(Jc[e])return Jc[e];if(!Qi[e])return e;var t=Qi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qm)return Jc[e]=t[n];return e}var qm=_u("animationend"),Jm=_u("animationiteration"),ew=_u("animationstart"),tw=_u("transitionend"),rw=new Map,Kg="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 ei(e,t){rw.set(e,t),_i(t,[e])}for(var ef=0;ef<Kg.length;ef++){var tf=Kg[ef],FR=tf.toLowerCase(),UR=tf[0].toUpperCase()+tf.slice(1);ei(FR,"on"+UR)}ei(qm,"onAnimationEnd");ei(Jm,"onAnimationIteration");ei(ew,"onAnimationStart");ei("dblclick","onDoubleClick");ei("focusin","onFocus");ei("focusout","onBlur");ei(tw,"onTransitionEnd");ws("onMouseEnter",["mouseout","mouseover"]);ws("onMouseLeave",["mouseout","mouseover"]);ws("onPointerEnter",["pointerout","pointerover"]);ws("onPointerLeave",["pointerout","pointerover"]);_i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_i("onBeforeInput",["compositionend","keypress","textInput","paste"]);_i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var co="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(" "),jR=new Set("cancel close invalid load scroll toggle".split(" ").concat(co));function Zg(e,t,n){var o=e.type||"unknown-event";e.currentTarget=n,FT(o,t,void 0,e),e.currentTarget=null}function nw(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 f=void 0;if(t)for(var g=o.length-1;0<=g;g--){var m=o[g],v=m.instance,x=m.currentTarget;if(m=m.listener,v!==f&&c.isPropagationStopped())break e;Zg(c,m,x),f=v}else for(g=0;g<o.length;g++){if(m=o[g],v=m.instance,x=m.currentTarget,m=m.listener,v!==f&&c.isPropagationStopped())break e;Zg(c,m,x),f=v}}}if(Ml)throw e=n1,Ml=!1,n1=null,e}function Ve(e,t){var n=t[h1];n===void 0&&(n=t[h1]=new Set);var o=e+"__bubble";n.has(o)||(iw(t,e,2,!1),n.add(o))}function rf(e,t,n){var o=0;t&&(o|=4),iw(n,e,o,t)}var Va="_reactListening"+Math.random().toString(36).slice(2);function Uo(e){if(!e[Va]){e[Va]=!0,fm.forEach(function(n){n!=="selectionchange"&&(jR.has(n)||rf(n,!1,e),rf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Va]||(t[Va]=!0,rf("selectionchange",!1,t))}}function iw(e,t,n,o){switch(Wm(t)){case 1:var c=eR;break;case 4:c=tR;break;default:c=z0}n=c.bind(null,t,n,e),c=void 0,!r1||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 nf(e,t,n,o,c){var f=o;if(!(t&1)&&!(t&2)&&o!==null)e:for(;;){if(o===null)return;var g=o.tag;if(g===3||g===4){var m=o.stateNode.containerInfo;if(m===c||m.nodeType===8&&m.parentNode===c)break;if(g===4)for(g=o.return;g!==null;){var v=g.tag;if((v===3||v===4)&&(v=g.stateNode.containerInfo,v===c||v.nodeType===8&&v.parentNode===c))return;g=g.return}for(;m!==null;){if(g=gi(m),g===null)return;if(v=g.tag,v===5||v===6){o=f=g;continue e}m=m.parentNode}}o=o.return}Rm(function(){var x=f,C=j0(n),A=[];e:{var I=rw.get(e);if(I!==void 0){var O=G0,k=e;switch(e){case"keypress":if(dl(n)===0)break e;case"keydown":case"keyup":O=xR;break;case"focusin":k="focus",O=Zc;break;case"focusout":k="blur",O=Zc;break;case"beforeblur":case"afterblur":O=Zc;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":O=Fg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":O=iR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":O=vR;break;case qm:case Jm:case ew:O=aR;break;case tw:O=ER;break;case"scroll":O=rR;break;case"wheel":O=AR;break;case"copy":case"cut":case"paste":O=uR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":O=jg}var P=(t&4)!==0,G=!P&&e==="scroll",N=P?I!==null?I+"Capture":null:I;P=[];for(var T=x,_;T!==null;){_=T;var U=_.stateNode;if(_.tag===5&&U!==null&&(_=U,N!==null&&(U=Po(T,N),U!=null&&P.push(jo(T,U,_)))),G)break;T=T.return}0<P.length&&(I=new O(I,k,null,n,C),A.push({event:I,listeners:P}))}}if(!(t&7)){e:{if(I=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",I&&n!==e1&&(k=n.relatedTarget||n.fromElement)&&(gi(k)||k[vn]))break e;if((O||I)&&(I=C.window===C?C:(I=C.ownerDocument)?I.defaultView||I.parentWindow:window,O?(k=n.relatedTarget||n.toElement,O=x,k=k?gi(k):null,k!==null&&(G=Oi(k),k!==G||k.tag!==5&&k.tag!==6)&&(k=null)):(O=null,k=x),O!==k)){if(P=Fg,U="onMouseLeave",N="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(P=jg,U="onPointerLeave",N="onPointerEnter",T="pointer"),G=O==null?I:qi(O),_=k==null?I:qi(k),I=new P(U,T+"leave",O,n,C),I.target=G,I.relatedTarget=_,U=null,gi(C)===x&&(P=new P(N,T+"enter",k,n,C),P.target=_,P.relatedTarget=G,U=P),G=U,O&&k)t:{for(P=O,N=k,T=0,_=P;_;_=$i(_))T++;for(_=0,U=N;U;U=$i(U))_++;for(;0<T-_;)P=$i(P),T--;for(;0<_-T;)N=$i(N),_--;for(;T--;){if(P===N||N!==null&&P===N.alternate)break t;P=$i(P),N=$i(N)}P=null}else P=null;O!==null&&Qg(A,I,O,P,!1),k!==null&&G!==null&&Qg(A,G,k,P,!0)}}e:{if(I=x?qi(x):window,O=I.nodeName&&I.nodeName.toLowerCase(),O==="select"||O==="input"&&I.type==="file")var z=OR;else if(Vg(I))if(Xm)z=MR;else{z=DR;var j=NR}else(O=I.nodeName)&&O.toLowerCase()==="input"&&(I.type==="checkbox"||I.type==="radio")&&(z=PR);if(z&&(z=z(e,x))){Gm(A,z,n,C);break e}j&&j(e,I,x),e==="focusout"&&(j=I._wrapperState)&&j.controlled&&I.type==="number"&&Kf(I,"number",I.value)}switch(j=x?qi(x):window,e){case"focusin":(Vg(j)||j.contentEditable==="true")&&(Zi=j,a1=x,yo=null);break;case"focusout":yo=a1=Zi=null;break;case"mousedown":l1=!0;break;case"contextmenu":case"mouseup":case"dragend":l1=!1,Yg(A,n,C);break;case"selectionchange":if(LR)break;case"keydown":case"keyup":Yg(A,n,C)}var B;if(Y0)e:{switch(e){case"compositionstart":var X="onCompositionStart";break e;case"compositionend":X="onCompositionEnd";break e;case"compositionupdate":X="onCompositionUpdate";break e}X=void 0}else Ki?zm(e,n)&&(X="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(X="onCompositionStart");X&&(Vm&&n.locale!=="ko"&&(Ki||X!=="onCompositionStart"?X==="onCompositionEnd"&&Ki&&(B=$m()):(jn=C,H0="value"in jn?jn.value:jn.textContent,Ki=!0)),j=Ul(x,X),0<j.length&&(X=new Ug(X,e,null,n,C),A.push({event:X,listeners:j}),B?X.data=B:(B=Hm(n),B!==null&&(X.data=B)))),(B=IR?TR(e,n):RR(e,n))&&(x=Ul(x,"onBeforeInput"),0<x.length&&(C=new Ug("onBeforeInput","beforeinput",null,n,C),A.push({event:C,listeners:x}),C.data=B))}nw(A,t)})}function jo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ul(e,t){for(var n=t+"Capture",o=[];e!==null;){var c=e,f=c.stateNode;c.tag===5&&f!==null&&(c=f,f=Po(e,n),f!=null&&o.unshift(jo(e,f,c)),f=Po(e,t),f!=null&&o.push(jo(e,f,c))),e=e.return}return o}function $i(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qg(e,t,n,o,c){for(var f=t._reactName,g=[];n!==null&&n!==o;){var m=n,v=m.alternate,x=m.stateNode;if(v!==null&&v===o)break;m.tag===5&&x!==null&&(m=x,c?(v=Po(n,f),v!=null&&g.unshift(jo(n,v,m))):c||(v=Po(n,f),v!=null&&g.push(jo(n,v,m)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var WR=/\r\n?/g,$R=/\u0000|\uFFFD/g;function qg(e){return(typeof e=="string"?e:""+e).replace(WR,`
|
|
55
|
+
`).replace($R,"")}function za(e,t,n){if(t=qg(t),qg(e)!==t&&n)throw Error(Z(425))}function jl(){}var u1=null,c1=null;function f1(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 d1=typeof setTimeout=="function"?setTimeout:void 0,VR=typeof clearTimeout=="function"?clearTimeout:void 0,Jg=typeof Promise=="function"?Promise:void 0,zR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jg<"u"?function(e){return Jg.resolve(null).then(e).catch(HR)}:d1;function HR(e){setTimeout(function(){throw e})}function sf(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),Bo(t);return}o--}else n!=="$"&&n!=="$?"&&n!=="$!"||o++;n=c}while(n);Bo(t)}function Hn(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 ep(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 Ns=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ns,Wo="__reactProps$"+Ns,vn="__reactContainer$"+Ns,h1="__reactEvents$"+Ns,GR="__reactListeners$"+Ns,XR="__reactHandles$"+Ns;function gi(e){var t=e[rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[vn]||n[rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ep(e);e!==null;){if(n=e[rn])return n;e=ep(e)}return t}e=n,n=e.parentNode}return null}function na(e){return e=e[rn]||e[vn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Z(33))}function Ou(e){return e[Wo]||null}var g1=[],Ji=-1;function ti(e){return{current:e}}function ze(e){0>Ji||(e.current=g1[Ji],g1[Ji]=null,Ji--)}function We(e,t){Ji++,g1[Ji]=e.current,e.current=t}var Qn={},$t=ti(Qn),or=ti(!1),Ci=Qn;function vs(e,t){var n=e.type.contextTypes;if(!n)return Qn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var c={},f;for(f in n)c[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function ar(e){return e=e.childContextTypes,e!=null}function Wl(){ze(or),ze($t)}function tp(e,t,n){if($t.current!==Qn)throw Error(Z(168));We($t,t),We(or,n)}function sw(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(Z(108,NT(e)||"Unknown",c));return et({},n,o)}function $l(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qn,Ci=$t.current,We($t,e),We(or,or.current),!0}function rp(e,t,n){var o=e.stateNode;if(!o)throw Error(Z(169));n?(e=sw(e,t,Ci),o.__reactInternalMemoizedMergedChildContext=e,ze(or),ze($t),We($t,e)):ze(or),We(or,n)}var fn=null,Nu=!1,of=!1;function ow(e){fn===null?fn=[e]:fn.push(e)}function YR(e){Nu=!0,ow(e)}function ri(){if(!of&&fn!==null){of=!0;var e=0,t=Me;try{var n=fn;for(Me=1;e<n.length;e++){var o=n[e];do o=o(!0);while(o!==null)}fn=null,Nu=!1}catch(c){throw fn!==null&&(fn=fn.slice(e+1)),Nm(W0,ri),c}finally{Me=t,of=!1}}return null}var es=[],ts=0,Vl=null,zl=0,Ir=[],Tr=0,Ai=null,hn=1,gn="";function fi(e,t){es[ts++]=zl,es[ts++]=Vl,Vl=e,zl=t}function aw(e,t,n){Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,Ai=e;var o=hn;e=gn;var c=32-jr(o)-1;o&=~(1<<c),n+=1;var f=32-jr(t)+c;if(30<f){var g=c-c%5;f=(o&(1<<g)-1).toString(32),o>>=g,c-=g,hn=1<<32-jr(t)+c|n<<c|o,gn=f+e}else hn=1<<f|n<<c|o,gn=e}function Z0(e){e.return!==null&&(fi(e,1),aw(e,1,0))}function Q0(e){for(;e===Vl;)Vl=es[--ts],es[ts]=null,zl=es[--ts],es[ts]=null;for(;e===Ai;)Ai=Ir[--Tr],Ir[Tr]=null,gn=Ir[--Tr],Ir[Tr]=null,hn=Ir[--Tr],Ir[Tr]=null}var gr=null,hr=null,Ye=!1,Ur=null;function lw(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 np(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,gr=e,hr=Hn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,gr=e,hr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ai!==null?{id:hn,overflow:gn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,gr=e,hr=null,!0):!1;default:return!1}}function p1(e){return(e.mode&1)!==0&&(e.flags&128)===0}function x1(e){if(Ye){var t=hr;if(t){var n=t;if(!np(e,t)){if(p1(e))throw Error(Z(418));t=Hn(n.nextSibling);var o=gr;t&&np(e,t)?lw(o,n):(e.flags=e.flags&-4097|2,Ye=!1,gr=e)}}else{if(p1(e))throw Error(Z(418));e.flags=e.flags&-4097|2,Ye=!1,gr=e}}}function ip(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;gr=e}function Ha(e){if(e!==gr)return!1;if(!Ye)return ip(e),Ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!f1(e.type,e.memoizedProps)),t&&(t=hr)){if(p1(e))throw uw(),Error(Z(418));for(;t;)lw(e,t),t=Hn(t.nextSibling)}if(ip(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){hr=Hn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}hr=null}}else hr=gr?Hn(e.stateNode.nextSibling):null;return!0}function uw(){for(var e=hr;e;)e=Hn(e.nextSibling)}function ys(){hr=gr=null,Ye=!1}function q0(e){Ur===null?Ur=[e]:Ur.push(e)}var KR=Sn.ReactCurrentBatchConfig;function to(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(Z(309));var o=n.stateNode}if(!o)throw Error(Z(147,e));var c=o,f=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===f?t.ref:(t=function(g){var m=c.refs;g===null?delete m[f]:m[f]=g},t._stringRef=f,t)}if(typeof e!="string")throw Error(Z(284));if(!n._owner)throw Error(Z(290,e))}return e}function Ga(e,t){throw e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function sp(e){var t=e._init;return t(e._payload)}function cw(e){function t(N,T){if(e){var _=N.deletions;_===null?(N.deletions=[T],N.flags|=16):_.push(T)}}function n(N,T){if(!e)return null;for(;T!==null;)t(N,T),T=T.sibling;return null}function o(N,T){for(N=new Map;T!==null;)T.key!==null?N.set(T.key,T):N.set(T.index,T),T=T.sibling;return N}function c(N,T){return N=Kn(N,T),N.index=0,N.sibling=null,N}function f(N,T,_){return N.index=_,e?(_=N.alternate,_!==null?(_=_.index,_<T?(N.flags|=2,T):_):(N.flags|=2,T)):(N.flags|=1048576,T)}function g(N){return e&&N.alternate===null&&(N.flags|=2),N}function m(N,T,_,U){return T===null||T.tag!==6?(T=hf(_,N.mode,U),T.return=N,T):(T=c(T,_),T.return=N,T)}function v(N,T,_,U){var z=_.type;return z===Yi?C(N,T,_.props.children,U,_.key):T!==null&&(T.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Mn&&sp(z)===T.type)?(U=c(T,_.props),U.ref=to(N,T,_),U.return=N,U):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,U)}function x(N,T,_,U){return T===null||T.tag!==4||T.stateNode.containerInfo!==_.containerInfo||T.stateNode.implementation!==_.implementation?(T=gf(_,N.mode,U),T.return=N,T):(T=c(T,_.children||[]),T.return=N,T)}function C(N,T,_,U,z){return T===null||T.tag!==7?(T=vi(_,N.mode,U,z),T.return=N,T):(T=c(T,_),T.return=N,T)}function A(N,T,_){if(typeof T=="string"&&T!==""||typeof T=="number")return T=hf(""+T,N.mode,_),T.return=N,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case ka:return _=vl(T.type,T.key,T.props,null,N.mode,_),_.ref=to(N,null,T),_.return=N,_;case Xi:return T=gf(T,N.mode,_),T.return=N,T;case Mn:var U=T._init;return A(N,U(T._payload),_)}if(lo(T)||Zs(T))return T=vi(T,N.mode,_,null),T.return=N,T;Ga(N,T)}return null}function I(N,T,_,U){var z=T!==null?T.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return z!==null?null:m(N,T,""+_,U);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:return _.key===z?v(N,T,_,U):null;case Xi:return _.key===z?x(N,T,_,U):null;case Mn:return z=_._init,I(N,T,z(_._payload),U)}if(lo(_)||Zs(_))return z!==null?null:C(N,T,_,U,null);Ga(N,_)}return null}function O(N,T,_,U,z){if(typeof U=="string"&&U!==""||typeof U=="number")return N=N.get(_)||null,m(T,N,""+U,z);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case ka:return N=N.get(U.key===null?_:U.key)||null,v(T,N,U,z);case Xi:return N=N.get(U.key===null?_:U.key)||null,x(T,N,U,z);case Mn:var j=U._init;return O(N,T,_,j(U._payload),z)}if(lo(U)||Zs(U))return N=N.get(_)||null,C(T,N,U,z,null);Ga(T,U)}return null}function k(N,T,_,U){for(var z=null,j=null,B=T,X=T=0,V=null;B!==null&&X<_.length;X++){B.index>X?(V=B,B=null):V=B.sibling;var oe=I(N,B,_[X],U);if(oe===null){B===null&&(B=V);break}e&&B&&oe.alternate===null&&t(N,B),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe,B=V}if(X===_.length)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;X<_.length;X++)B=A(N,_[X],U),B!==null&&(T=f(B,T,X),j===null?z=B:j.sibling=B,j=B);return Ye&&fi(N,X),z}for(B=o(N,B);X<_.length;X++)V=O(B,N,X,_[X],U),V!==null&&(e&&V.alternate!==null&&B.delete(V.key===null?X:V.key),T=f(V,T,X),j===null?z=V:j.sibling=V,j=V);return e&&B.forEach(function(ye){return t(N,ye)}),Ye&&fi(N,X),z}function P(N,T,_,U){var z=Zs(_);if(typeof z!="function")throw Error(Z(150));if(_=z.call(_),_==null)throw Error(Z(151));for(var j=z=null,B=T,X=T=0,V=null,oe=_.next();B!==null&&!oe.done;X++,oe=_.next()){B.index>X?(V=B,B=null):V=B.sibling;var ye=I(N,B,oe.value,U);if(ye===null){B===null&&(B=V);break}e&&B&&ye.alternate===null&&t(N,B),T=f(ye,T,X),j===null?z=ye:j.sibling=ye,j=ye,B=V}if(oe.done)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;!oe.done;X++,oe=_.next())oe=A(N,oe.value,U),oe!==null&&(T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return Ye&&fi(N,X),z}for(B=o(N,B);!oe.done;X++,oe=_.next())oe=O(B,N,X,oe.value,U),oe!==null&&(e&&oe.alternate!==null&&B.delete(oe.key===null?X:oe.key),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return e&&B.forEach(function(se){return t(N,se)}),Ye&&fi(N,X),z}function G(N,T,_,U){if(typeof _=="object"&&_!==null&&_.type===Yi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:e:{for(var z=_.key,j=T;j!==null;){if(j.key===z){if(z=_.type,z===Yi){if(j.tag===7){n(N,j.sibling),T=c(j,_.props.children),T.return=N,N=T;break e}}else if(j.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Mn&&sp(z)===j.type){n(N,j.sibling),T=c(j,_.props),T.ref=to(N,j,_),T.return=N,N=T;break e}n(N,j);break}else t(N,j);j=j.sibling}_.type===Yi?(T=vi(_.props.children,N.mode,U,_.key),T.return=N,N=T):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,N=U)}return g(N);case Xi:e:{for(j=_.key;T!==null;){if(T.key===j)if(T.tag===4&&T.stateNode.containerInfo===_.containerInfo&&T.stateNode.implementation===_.implementation){n(N,T.sibling),T=c(T,_.children||[]),T.return=N,N=T;break e}else{n(N,T);break}else t(N,T);T=T.sibling}T=gf(_,N.mode,U),T.return=N,N=T}return g(N);case Mn:return j=_._init,G(N,T,j(_._payload),U)}if(lo(_))return k(N,T,_,U);if(Zs(_))return P(N,T,_,U);Ga(N,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,T!==null&&T.tag===6?(n(N,T.sibling),T=c(T,_),T.return=N,N=T):(n(N,T),T=hf(_,N.mode,U),T.return=N,N=T),g(N)):n(N,T)}return G}var Es=cw(!0),fw=cw(!1),Hl=ti(null),Gl=null,rs=null,J0=null;function ed(){J0=rs=Gl=null}function td(e){var t=Hl.current;ze(Hl),e._currentValue=t}function m1(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 ds(e,t){Gl=e,J0=rs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(sr=!0),e.firstContext=null)}function _r(e){var t=e._currentValue;if(J0!==e)if(e={context:e,memoizedValue:t,next:null},rs===null){if(Gl===null)throw Error(Z(308));rs=e,Gl.dependencies={lanes:0,firstContext:e}}else rs=rs.next=e;return t}var pi=null;function rd(e){pi===null?pi=[e]:pi.push(e)}function dw(e,t,n,o){var c=t.interleaved;return c===null?(n.next=n,rd(t)):(n.next=c.next,c.next=n),t.interleaved=n,yn(e,o)}function yn(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 kn=!1;function nd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hw(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 pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,_e&2){var c=o.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),o.pending=t,yn(e,n)}return c=o.interleaved,c===null?(t.next=t,rd(o)):(t.next=c.next,c.next=t),o.interleaved=t,yn(e,n)}function hl(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,$0(e,n)}}function op(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var c=null,f=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};f===null?c=f=g:f=f.next=g,n=n.next}while(n!==null);f===null?c=f=t:f=f.next=t}else c=f=t;n={baseState:o.baseState,firstBaseUpdate:c,lastBaseUpdate:f,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 Xl(e,t,n,o){var c=e.updateQueue;kn=!1;var f=c.firstBaseUpdate,g=c.lastBaseUpdate,m=c.shared.pending;if(m!==null){c.shared.pending=null;var v=m,x=v.next;v.next=null,g===null?f=x:g.next=x,g=v;var C=e.alternate;C!==null&&(C=C.updateQueue,m=C.lastBaseUpdate,m!==g&&(m===null?C.firstBaseUpdate=x:m.next=x,C.lastBaseUpdate=v))}if(f!==null){var A=c.baseState;g=0,C=x=v=null,m=f;do{var I=m.lane,O=m.eventTime;if((o&I)===I){C!==null&&(C=C.next={eventTime:O,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var k=e,P=m;switch(I=t,O=n,P.tag){case 1:if(k=P.payload,typeof k=="function"){A=k.call(O,A,I);break e}A=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=P.payload,I=typeof k=="function"?k.call(O,A,I):k,I==null)break e;A=et({},A,I);break e;case 2:kn=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,I=c.effects,I===null?c.effects=[m]:I.push(m))}else O={eventTime:O,lane:I,tag:m.tag,payload:m.payload,callback:m.callback,next:null},C===null?(x=C=O,v=A):C=C.next=O,g|=I;if(m=m.next,m===null){if(m=c.shared.pending,m===null)break;I=m,m=I.next,I.next=null,c.lastBaseUpdate=I,c.shared.pending=null}}while(!0);if(C===null&&(v=A),c.baseState=v,c.firstBaseUpdate=x,c.lastBaseUpdate=C,t=c.shared.interleaved,t!==null){c=t;do g|=c.lane,c=c.next;while(c!==t)}else f===null&&(c.shared.lanes=0);Ii|=g,e.lanes=g,e.memoizedState=A}}function ap(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(Z(191,c));c.call(o)}}}var ia={},sn=ti(ia),$o=ti(ia),Vo=ti(ia);function xi(e){if(e===ia)throw Error(Z(174));return e}function id(e,t){switch(We(Vo,t),We($o,e),We(sn,ia),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Qf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Qf(t,e)}ze(sn),We(sn,t)}function Cs(){ze(sn),ze($o),ze(Vo)}function gw(e){xi(Vo.current);var t=xi(sn.current),n=Qf(t,e.type);t!==n&&(We($o,e),We(sn,n))}function sd(e){$o.current===e&&(ze(sn),ze($o))}var qe=ti(0);function Yl(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 af=[];function od(){for(var e=0;e<af.length;e++)af[e]._workInProgressVersionPrimary=null;af.length=0}var gl=Sn.ReactCurrentDispatcher,lf=Sn.ReactCurrentBatchConfig,Si=0,Je=null,vt=null,It=null,Kl=!1,Eo=!1,zo=0,ZR=0;function Ut(){throw Error(Z(321))}function ad(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$r(e[n],t[n]))return!1;return!0}function ld(e,t,n,o,c,f){if(Si=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,gl.current=e===null||e.memoizedState===null?eb:tb,e=n(o,c),Eo){f=0;do{if(Eo=!1,zo=0,25<=f)throw Error(Z(301));f+=1,It=vt=null,t.updateQueue=null,gl.current=rb,e=n(o,c)}while(Eo)}if(gl.current=Zl,t=vt!==null&&vt.next!==null,Si=0,It=vt=Je=null,Kl=!1,t)throw Error(Z(300));return e}function ud(){var e=zo!==0;return zo=0,e}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Je.memoizedState=It=e:It=It.next=e,It}function Or(){if(vt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var t=It===null?Je.memoizedState:It.next;if(t!==null)It=t,vt=e;else{if(e===null)throw Error(Z(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},It===null?Je.memoizedState=It=e:It=It.next=e}return It}function Ho(e,t){return typeof t=="function"?t(e):t}function uf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=vt,c=o.baseQueue,f=n.pending;if(f!==null){if(c!==null){var g=c.next;c.next=f.next,f.next=g}o.baseQueue=c=f,n.pending=null}if(c!==null){f=c.next,o=o.baseState;var m=g=null,v=null,x=f;do{var C=x.lane;if((Si&C)===C)v!==null&&(v=v.next={lane:0,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null}),o=x.hasEagerState?x.eagerState:e(o,x.action);else{var A={lane:C,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null};v===null?(m=v=A,g=o):v=v.next=A,Je.lanes|=C,Ii|=C}x=x.next}while(x!==null&&x!==f);v===null?g=o:v.next=m,$r(o,t.memoizedState)||(sr=!0),t.memoizedState=o,t.baseState=g,t.baseQueue=v,n.lastRenderedState=o}if(e=n.interleaved,e!==null){c=e;do f=c.lane,Je.lanes|=f,Ii|=f,c=c.next;while(c!==e)}else c===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function cf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=n.dispatch,c=n.pending,f=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do f=e(f,g.action),g=g.next;while(g!==c);$r(f,t.memoizedState)||(sr=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,o]}function pw(){}function xw(e,t){var n=Je,o=Or(),c=t(),f=!$r(o.memoizedState,c);if(f&&(o.memoizedState=c,sr=!0),o=o.queue,cd(vw.bind(null,n,o,e),[e]),o.getSnapshot!==t||f||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,Go(9,ww.bind(null,n,o,c,t),void 0,null),Tt===null)throw Error(Z(349));Si&30||mw(n,t,c)}return c}function mw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.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,yw(t)&&Ew(e)}function vw(e,t,n){return n(function(){yw(t)&&Ew(e)})}function yw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$r(e,n)}catch{return!0}}function Ew(e){var t=yn(e,1);t!==null&&Wr(t,e,1,-1)}function lp(e){var t=tn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t.queue=e,e=e.dispatch=JR.bind(null,Je,e),[t.memoizedState,e]}function Go(e,t,n,o){return e={tag:e,create:t,destroy:n,deps:o,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.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 Cw(){return Or().memoizedState}function pl(e,t,n,o){var c=tn();Je.flags|=e,c.memoizedState=Go(1|t,n,void 0,o===void 0?null:o)}function Du(e,t,n,o){var c=Or();o=o===void 0?null:o;var f=void 0;if(vt!==null){var g=vt.memoizedState;if(f=g.destroy,o!==null&&ad(o,g.deps)){c.memoizedState=Go(t,n,f,o);return}}Je.flags|=e,c.memoizedState=Go(1|t,n,f,o)}function up(e,t){return pl(8390656,8,e,t)}function cd(e,t){return Du(2048,8,e,t)}function Aw(e,t){return Du(4,2,e,t)}function Sw(e,t){return Du(4,4,e,t)}function Iw(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 Tw(e,t,n){return n=n!=null?n.concat([e]):null,Du(4,4,Iw.bind(null,t,e),n)}function fd(){}function Rw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(n.memoizedState=[e,t],e)}function bw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(e=e(),n.memoizedState=[e,t],e)}function _w(e,t,n){return Si&21?($r(n,t)||(n=Mm(),Je.lanes|=n,Ii|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,sr=!0),e.memoizedState=n)}function QR(e,t){var n=Me;Me=n!==0&&4>n?n:4,e(!0);var o=lf.transition;lf.transition={};try{e(!1),t()}finally{Me=n,lf.transition=o}}function Ow(){return Or().memoizedState}function qR(e,t,n){var o=Yn(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},Nw(e))Dw(t,n);else if(n=dw(e,t,n,o),n!==null){var c=Gt();Wr(n,e,o,c),Pw(n,t,o)}}function JR(e,t,n){var o=Yn(e),c={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(Nw(e))Dw(t,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,m=f(g,n);if(c.hasEagerState=!0,c.eagerState=m,$r(m,g)){var v=t.interleaved;v===null?(c.next=c,rd(t)):(c.next=v.next,v.next=c),t.interleaved=c;return}}catch{}finally{}n=dw(e,t,c,o),n!==null&&(c=Gt(),Wr(n,e,o,c),Pw(n,t,o))}}function Nw(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Dw(e,t){Eo=Kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Pw(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,$0(e,n)}}var Zl={readContext:_r,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},eb={readContext:_r,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:_r,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pl(4194308,4,Iw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var n=tn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=tn();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=qR.bind(null,Je,e),[o.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:lp,useDebugValue:fd,useDeferredValue:function(e){return tn().memoizedState=e},useTransition:function(){var e=lp(!1),t=e[0];return e=QR.bind(null,e[1]),tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=Je,c=tn();if(Ye){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),Tt===null)throw Error(Z(349));Si&30||mw(o,t,n)}c.memoizedState=n;var f={value:n,getSnapshot:t};return c.queue=f,up(vw.bind(null,o,f,e),[e]),o.flags|=2048,Go(9,ww.bind(null,o,f,n,t),void 0,null),n},useId:function(){var e=tn(),t=Tt.identifierPrefix;if(Ye){var n=gn,o=hn;n=(o&~(1<<32-jr(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=zo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ZR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},tb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:uf,useRef:Cw,useState:function(){return uf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return _w(t,vt.memoizedState,e)},useTransition:function(){var e=uf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1},rb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:cf,useRef:Cw,useState:function(){return cf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return vt===null?t.memoizedState=e:_w(t,vt.memoizedState,e)},useTransition:function(){var e=cf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1};function Br(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function w1(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n==null?t:et({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Pu={isMounted:function(e){return(e=e._reactInternals)?Oi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.tag=1,f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gt(),o=Yn(e),c=pn(n,o);c.tag=2,t!=null&&(c.callback=t),t=Gn(e,c,o),t!==null&&(Wr(t,e,o,n),hl(t,e,o))}};function cp(e,t,n,o,c,f,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,g):t.prototype&&t.prototype.isPureReactComponent?!Fo(n,o)||!Fo(c,f):!0}function Mw(e,t,n){var o=!1,c=Qn,f=t.contextType;return typeof f=="object"&&f!==null?f=_r(f):(c=ar(t)?Ci:$t.current,o=t.contextTypes,f=(o=o!=null)?vs(e,c):Qn),t=new t(n,f),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Pu,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=f),t}function fp(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&&Pu.enqueueReplaceState(t,t.state,null)}function v1(e,t,n,o){var c=e.stateNode;c.props=n,c.state=e.memoizedState,c.refs={},nd(e);var f=t.contextType;typeof f=="object"&&f!==null?c.context=_r(f):(f=ar(t)?Ci:$t.current,c.context=vs(e,f)),c.state=e.memoizedState,f=t.getDerivedStateFromProps,typeof f=="function"&&(w1(e,t,f,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&&Pu.enqueueReplaceState(c,c.state,null),Xl(e,n,c,o),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function As(e,t){try{var n="",o=t;do n+=OT(o),o=o.return;while(o);var c=n}catch(f){c=`
|
|
56
56
|
Error generating stack: `+f.message+`
|
|
57
|
-
`+f.stack}return{value:e,source:t,stack:c,digest:null}}function cf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function v1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var nb=typeof WeakMap=="function"?WeakMap:Map;function kw(e,t,n){n=pn(-1,n),n.tag=3,n.payload={element:null};var o=t.value;return n.callback=function(){Ql||(Ql=!0,_1=o),v1(e,t)},n}function Bw(e,t,n){n=pn(-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(){v1(e,t)}}var f=e.stateNode;return f!==null&&typeof f.componentDidCatch=="function"&&(n.callback=function(){v1(e,t),typeof o!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var g=t.stack;this.componentDidCatch(t.value,{componentStack:g!==null?g:""})}),n}function dp(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new nb;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=mb.bind(null,e,t,n),t.then(e,e))}function hp(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 gp(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=pn(-1,1),t.tag=2,Gn(n,t,1))),n.lanes|=1),e)}var ib=Sn.ReactCurrentOwner,sr=!1;function Ht(e,t,n,o){t.child=e===null?fw(t,null,n,o):Es(t,e.child,n,o)}function pp(e,t,n,o,c){n=n.render;var f=t.ref;return ds(t,c),o=ld(e,t,n,o,f,c),n=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&n&&Z0(t),t.flags|=1,Ht(e,t,o,c),t.child)}function xp(e,t,n,o,c){if(e===null){var f=n.type;return typeof f=="function"&&!vd(f)&&f.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=f,Lw(e,t,f,o,c)):(e=vl(n.type,null,o,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!(e.lanes&c)){var g=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fo,n(g,o)&&e.ref===t.ref)return En(e,t,c)}return t.flags|=1,e=Kn(f,o),e.ref=t.ref,e.return=t,t.child=e}function Lw(e,t,n,o,c){if(e!==null){var f=e.memoizedProps;if(Fo(f,o)&&e.ref===t.ref)if(sr=!1,t.pendingProps=o=f,(e.lanes&c)!==0)e.flags&131072&&(sr=!0);else return t.lanes=e.lanes,En(e,t,c)}return y1(e,t,n,o,c)}function Fw(e,t,n){var o=t.pendingProps,c=o.children,f=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},We(is,dr),dr|=n;else{if(!(n&1073741824))return e=f!==null?f.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,We(is,dr),dr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=f!==null?f.baseLanes:n,We(is,dr),dr|=o}else f!==null?(o=f.baseLanes|n,t.memoizedState=null):o=n,We(is,dr),dr|=o;return Ht(e,t,c,n),t.child}function Uw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function y1(e,t,n,o,c){var f=ar(n)?Ci:$t.current;return f=vs(t,f),ds(t,c),n=ld(e,t,n,o,f,c),o=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&o&&Z0(t),t.flags|=1,Ht(e,t,n,c),t.child)}function mp(e,t,n,o,c){if(ar(n)){var f=!0;Wl(t)}else f=!1;if(ds(t,c),t.stateNode===null)xl(e,t),Pw(t,n,o),w1(t,n,o,c),o=!0;else if(e===null){var g=t.stateNode,m=t.memoizedProps;g.props=m;var v=g.context,x=n.contextType;typeof x=="object"&&x!==null?x=_r(x):(x=ar(n)?Ci:$t.current,x=vs(t,x));var C=n.getDerivedStateFromProps,A=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function";A||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==o||v!==x)&&fp(t,g,o,x),kn=!1;var I=t.memoizedState;g.state=I,Gl(t,o,g,c),v=t.memoizedState,m!==o||I!==v||or.current||kn?(typeof C=="function"&&(m1(t,n,C,o),v=t.memoizedState),(m=kn||cp(t,n,m,o,I,v,x))?(A||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=v),g.props=o,g.state=v,g.context=x,o=m):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{g=t.stateNode,hw(e,t),m=t.memoizedProps,x=t.type===t.elementType?m:Br(t.type,m),g.props=x,A=t.pendingProps,I=g.context,v=n.contextType,typeof v=="object"&&v!==null?v=_r(v):(v=ar(n)?Ci:$t.current,v=vs(t,v));var O=n.getDerivedStateFromProps;(C=typeof O=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==A||I!==v)&&fp(t,g,o,v),kn=!1,I=t.memoizedState,g.state=I,Gl(t,o,g,c);var k=t.memoizedState;m!==A||I!==k||or.current||kn?(typeof O=="function"&&(m1(t,n,O,o),k=t.memoizedState),(x=kn||cp(t,n,x,o,I,k,v)||!1)?(C||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,k,v),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,k,v)),typeof g.componentDidUpdate=="function"&&(t.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=k),g.props=o,g.state=k,g.context=v,o=x):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),o=!1)}return E1(e,t,n,o,f,c)}function E1(e,t,n,o,c,f){Uw(e,t);var g=(t.flags&128)!==0;if(!o&&!g)return c&&rp(t,n,!1),En(e,t,f);o=t.stateNode,ib.current=t;var m=g&&typeof n.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&g?(t.child=Es(t,e.child,null,f),t.child=Es(t,null,m,f)):Ht(e,t,m,f),t.memoizedState=o.state,c&&rp(t,n,!0),t.child}function jw(e){var t=e.stateNode;t.pendingContext?tp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tp(e,t.context,!1),id(e,t.containerInfo)}function wp(e,t,n,o,c){return ys(),q0(c),t.flags|=256,Ht(e,t,n,o),t.child}var C1={dehydrated:null,treeContext:null,retryLane:0};function A1(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ww(e,t,n){var o=t.pendingProps,c=qe.current,f=!1,g=(t.flags&128)!==0,m;if((m=g)||(m=e!==null&&e.memoizedState===null?!1:(c&2)!==0),m?(f=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),We(qe,c&1),e===null)return p1(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,f?(o=t.mode,f=t.child,g={mode:"hidden",children:g},!(o&1)&&f!==null?(f.childLanes=0,f.pendingProps=g):f=ku(g,o,0,null),e=vi(e,o,n,null),f.return=t,e.return=t,f.sibling=e,t.child=f,t.child.memoizedState=A1(n),t.memoizedState=C1,e):dd(t,g));if(c=e.memoizedState,c!==null&&(m=c.dehydrated,m!==null))return sb(e,t,g,o,m,c,n);if(f){f=o.fallback,g=t.mode,c=e.child,m=c.sibling;var v={mode:"hidden",children:o.children};return!(g&1)&&t.child!==c?(o=t.child,o.childLanes=0,o.pendingProps=v,t.deletions=null):(o=Kn(c,v),o.subtreeFlags=c.subtreeFlags&14680064),m!==null?f=Kn(m,f):(f=vi(f,g,n,null),f.flags|=2),f.return=t,o.return=t,o.sibling=f,t.child=o,o=f,f=t.child,g=e.child.memoizedState,g=g===null?A1(n):{baseLanes:g.baseLanes|n,cachePool:null,transitions:g.transitions},f.memoizedState=g,f.childLanes=e.childLanes&~n,t.memoizedState=C1,o}return f=e.child,e=f.sibling,o=Kn(f,{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 dd(e,t){return t=ku({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Xa(e,t,n,o){return o!==null&&q0(o),Es(t,e.child,null,n),e=dd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sb(e,t,n,o,c,f,g){if(n)return t.flags&256?(t.flags&=-257,o=cf(Error(Z(422))),Xa(e,t,g,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(f=o.fallback,c=t.mode,o=ku({mode:"visible",children:o.children},c,0,null),f=vi(f,c,g,null),f.flags|=2,o.return=t,f.return=t,o.sibling=f,t.child=o,t.mode&1&&Es(t,e.child,null,g),t.child.memoizedState=A1(g),t.memoizedState=C1,f);if(!(t.mode&1))return Xa(e,t,g,null);if(c.data==="$!"){if(o=c.nextSibling&&c.nextSibling.dataset,o)var m=o.dgst;return o=m,f=Error(Z(419)),o=cf(f,o,void 0),Xa(e,t,g,o)}if(m=(g&e.childLanes)!==0,sr||m){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!==f.retryLane&&(f.retryLane=c,yn(e,c),Wr(o,e,c,-1))}return wd(),o=cf(Error(Z(421))),Xa(e,t,g,o)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=wb.bind(null,e),c._reactRetry=t,null):(e=f.treeContext,hr=Hn(c.nextSibling),gr=t,Ye=!0,Ur=null,e!==null&&(Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,hn=e.id,gn=e.overflow,Ai=t),t=dd(t,o.children),t.flags|=4096,t)}function vp(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),x1(e.return,t,n)}function ff(e,t,n,o,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=o,f.tail=n,f.tailMode=c)}function $w(e,t,n){var o=t.pendingProps,c=o.revealOrder,f=o.tail;if(Ht(e,t,o.children,n),o=qe.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&&vp(e,n,t);else if(e.tag===19)vp(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(We(qe,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&&Xl(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),ff(t,!1,c,n,f);break;case"backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Xl(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}ff(t,!0,n,null,f);break;case"together":ff(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ii|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=Kn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Kn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ob(e,t,n){switch(t.tag){case 3:jw(t),ys();break;case 5:gw(t);break;case 1:ar(t.type)&&Wl(t);break;case 4:id(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,c=t.memoizedProps.value;We(zl,o._currentValue),o._currentValue=c;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?(We(qe,qe.current&1),t.flags|=128,null):n&t.child.childLanes?Ww(e,t,n):(We(qe,qe.current&1),e=En(e,t,n),e!==null?e.sibling:null);We(qe,qe.current&1);break;case 19:if(o=(n&t.childLanes)!==0,e.flags&128){if(o)return $w(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),We(qe,qe.current),o)break;return null;case 22:case 23:return t.lanes=0,Fw(e,t,n)}return En(e,t,n)}var Vw,S1,zw,Hw;Vw=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}};S1=function(){};zw=function(e,t,n,o){var c=e.memoizedProps;if(c!==o){e=t.stateNode,xi(sn.current);var f=null;switch(n){case"input":c=Gf(e,c),o=Gf(e,o),f=[];break;case"select":c=et({},c,{value:void 0}),o=et({},o,{value:void 0}),f=[];break;case"textarea":c=Kf(e,c),o=Kf(e,o),f=[];break;default:typeof c.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=Ul)}Qf(n,o);var g;n=null;for(x in c)if(!o.hasOwnProperty(x)&&c.hasOwnProperty(x)&&c[x]!=null)if(x==="style"){var m=c[x];for(g in m)m.hasOwnProperty(g)&&(n||(n={}),n[g]="")}else x!=="dangerouslySetInnerHTML"&&x!=="children"&&x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(No.hasOwnProperty(x)?f||(f=[]):(f=f||[]).push(x,null));for(x in o){var v=o[x];if(m=c!=null?c[x]:void 0,o.hasOwnProperty(x)&&v!==m&&(v!=null||m!=null))if(x==="style")if(m){for(g in m)!m.hasOwnProperty(g)||v&&v.hasOwnProperty(g)||(n||(n={}),n[g]="");for(g in v)v.hasOwnProperty(g)&&m[g]!==v[g]&&(n||(n={}),n[g]=v[g])}else n||(f||(f=[]),f.push(x,n)),n=v;else x==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,m=m?m.__html:void 0,v!=null&&m!==v&&(f=f||[]).push(x,v)):x==="children"?typeof v!="string"&&typeof v!="number"||(f=f||[]).push(x,""+v):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&(No.hasOwnProperty(x)?(v!=null&&x==="onScroll"&&Ve("scroll",e),f||m===v||(f=[])):(f=f||[]).push(x,v))}n&&(f=f||[]).push("style",n);var x=f;(t.updateQueue=x)&&(t.flags|=4)}};Hw=function(e,t,n,o){n!==o&&(t.flags|=4)};function ro(e,t){if(!Ye)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 jt(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 ab(e,t,n){var o=t.pendingProps;switch(Q0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(t),null;case 1:return ar(t.type)&&jl(),jt(t),null;case 3:return o=t.stateNode,Cs(),ze(or),ze($t),od(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(Ha(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ur!==null&&(D1(Ur),Ur=null))),S1(e,t),jt(t),null;case 5:sd(t);var c=xi(Vo.current);if(n=t.type,e!==null&&t.stateNode!=null)zw(e,t,n,o,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(Z(166));return jt(t),null}if(e=xi(sn.current),Ha(t)){o=t.stateNode,n=t.type;var f=t.memoizedProps;switch(o[rn]=t,o[Wo]=f,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<co.length;c++)Ve(co[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":bg(o,f),Ve("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!f.multiple},Ve("invalid",o);break;case"textarea":Og(o,f),Ve("invalid",o)}Qf(n,f),c=null;for(var g in f)if(f.hasOwnProperty(g)){var m=f[g];g==="children"?typeof m=="string"?o.textContent!==m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",m]):typeof m=="number"&&o.textContent!==""+m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",""+m]):No.hasOwnProperty(g)&&m!=null&&g==="onScroll"&&Ve("scroll",o)}switch(n){case"input":Ba(o),_g(o,f,!0);break;case"textarea":Ba(o),Ng(o);break;case"select":case"option":break;default:typeof f.onClick=="function"&&(o.onclick=Ul)}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=vm(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[rn]=t,e[Wo]=o,Vw(e,t,!1,!1),t.stateNode=e;e:{switch(g=qf(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<co.length;c++)Ve(co[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":bg(e,o),c=Gf(e,o),Ve("invalid",e);break;case"option":c=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},c=et({},o,{value:void 0}),Ve("invalid",e);break;case"textarea":Og(e,o),c=Kf(e,o),Ve("invalid",e);break;default:c=o}Qf(n,c),m=c;for(f in m)if(m.hasOwnProperty(f)){var v=m[f];f==="style"?Cm(e,v):f==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,v!=null&&ym(e,v)):f==="children"?typeof v=="string"?(n!=="textarea"||v!=="")&&Do(e,v):typeof v=="number"&&Do(e,""+v):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(No.hasOwnProperty(f)?v!=null&&f==="onScroll"&&Ve("scroll",e):v!=null&&B0(e,f,v,g))}switch(n){case"input":Ba(e),_g(e,o,!1);break;case"textarea":Ba(e),Ng(e);break;case"option":o.value!=null&&e.setAttribute("value",""+Zn(o.value));break;case"select":e.multiple=!!o.multiple,f=o.value,f!=null?ls(e,!!o.multiple,f,!1):o.defaultValue!=null&&ls(e,!!o.multiple,o.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Ul)}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 jt(t),null;case 6:if(e&&t.stateNode!=null)Hw(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(Z(166));if(n=xi(Vo.current),xi(sn.current),Ha(t)){if(o=t.stateNode,n=t.memoizedProps,o[rn]=t,(f=o.nodeValue!==n)&&(e=gr,e!==null))switch(e.tag){case 3:za(o.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&za(o.nodeValue,n,(e.mode&1)!==0)}f&&(t.flags|=4)}else o=(n.nodeType===9?n:n.ownerDocument).createTextNode(o),o[rn]=t,t.stateNode=o}return jt(t),null;case 13:if(ze(qe),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ye&&hr!==null&&t.mode&1&&!(t.flags&128))uw(),ys(),t.flags|=98560,f=!1;else if(f=Ha(t),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(Z(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(Z(317));f[rn]=t}else ys(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jt(t),f=!1}else Ur!==null&&(D1(Ur),Ur=null),f=!0;if(!f)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||qe.current&1?yt===0&&(yt=3):wd())),t.updateQueue!==null&&(t.flags|=4),jt(t),null);case 4:return Cs(),S1(e,t),e===null&&Uo(t.stateNode.containerInfo),jt(t),null;case 10:return td(t.type._context),jt(t),null;case 17:return ar(t.type)&&jl(),jt(t),null;case 19:if(ze(qe),f=t.memoizedState,f===null)return jt(t),null;if(o=(t.flags&128)!==0,g=f.rendering,g===null)if(o)ro(f,!1);else{if(yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(g=Xl(e),g!==null){for(t.flags|=128,ro(f,!1),o=g.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=n,n=t.child;n!==null;)f=n,e=o,f.flags&=14680066,g=f.alternate,g===null?(f.childLanes=0,f.lanes=e,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,e=g.dependencies,f.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return We(qe,qe.current&1|2),t.child}e=e.sibling}f.tail!==null&&ut()>Ss&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304)}else{if(!o)if(e=Xl(g),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ro(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!Ye)return jt(t),null}else 2*ut()-f.renderingStartTime>Ss&&n!==1073741824&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(n=f.last,n!==null?n.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=ut(),t.sibling=null,n=qe.current,We(qe,o?n&1|2:n&1),t):(jt(t),null);case 22:case 23:return md(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?dr&1073741824&&(jt(t),t.subtreeFlags&6&&(t.flags|=8192)):jt(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function lb(e,t){switch(Q0(t),t.tag){case 1:return ar(t.type)&&jl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cs(),ze(or),ze($t),od(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sd(t),null;case 13:if(ze(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ze(qe),null;case 4:return Cs(),null;case 10:return td(t.type._context),null;case 22:case 23:return md(),null;case 24:return null;default:return null}}var Ya=!1,Wt=!1,ub=typeof WeakSet=="function"?WeakSet:Set,ie=null;function ns(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){ot(e,t,o)}else n.current=null}function I1(e,t,n){try{n()}catch(o){ot(e,t,o)}}var yp=!1;function cb(e,t){if(l1=Bl,e=Zm(),K0(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,f=o.focusNode;o=o.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var g=0,m=-1,v=-1,x=0,C=0,A=e,I=null;t:for(;;){for(var O;A!==n||c!==0&&A.nodeType!==3||(m=g+c),A!==f||o!==0&&A.nodeType!==3||(v=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(O=A.firstChild)!==null;)I=A,A=O;for(;;){if(A===e)break t;if(I===n&&++x===c&&(m=g),I===f&&++C===o&&(v=g),(O=A.nextSibling)!==null)break;A=I,I=A.parentNode}A=O}n=m===-1||v===-1?null:{start:m,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(u1={focusedElem:e,selectionRange:n},Bl=!1,ie=t;ie!==null;)if(t=ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ie=e;else for(;ie!==null;){t=ie;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,T=N.getSnapshotBeforeUpdate(t.elementType===t.type?M:Br(t.type,M),G);N.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(U){ot(t,t.return,U)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return k=yp,yp=!1,k}function Co(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 f=c.destroy;c.destroy=void 0,f!==void 0&&I1(t,n,f)}c=c.next}while(c!==o)}}function Mu(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 T1(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 Gw(e){var t=e.alternate;t!==null&&(e.alternate=null,Gw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[rn],delete t[Wo],delete t[d1],delete t[GR],delete t[XR])),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 Xw(e){return e.tag===5||e.tag===3||e.tag===4}function Ep(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xw(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 R1(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=Ul));else if(o!==4&&(e=e.child,e!==null))for(R1(e,t,n),e=e.sibling;e!==null;)R1(e,t,n),e=e.sibling}function b1(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(b1(e,t,n),e=e.sibling;e!==null;)b1(e,t,n),e=e.sibling}var Dt=null,Lr=!1;function Mn(e,t,n){for(n=n.child;n!==null;)Yw(e,t,n),n=n.sibling}function Yw(e,t,n){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Iu,n)}catch{}switch(n.tag){case 5:Wt||ns(n,t);case 6:var o=Dt,c=Lr;Dt=null,Mn(e,t,n),Dt=o,Lr=c,Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?nf(e.parentNode,n):e.nodeType===1&&nf(e,n),Bo(e)):nf(Dt,n.stateNode));break;case 4:o=Dt,c=Lr,Dt=n.stateNode.containerInfo,Lr=!0,Mn(e,t,n),Dt=o,Lr=c;break;case 0:case 11:case 14:case 15:if(!Wt&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){c=o=o.next;do{var f=c,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&I1(n,t,g),c=c.next}while(c!==o)}Mn(e,t,n);break;case 1:if(!Wt&&(ns(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(m){ot(n,t,m)}Mn(e,t,n);break;case 21:Mn(e,t,n);break;case 22:n.mode&1?(Wt=(o=Wt)||n.memoizedState!==null,Mn(e,t,n),Wt=o):Mn(e,t,n);break;default:Mn(e,t,n)}}function Cp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ub),t.forEach(function(o){var c=vb.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 f=e,g=t,m=g;e:for(;m!==null;){switch(m.tag){case 5:Dt=m.stateNode,Lr=!1;break e;case 3:Dt=m.stateNode.containerInfo,Lr=!0;break e;case 4:Dt=m.stateNode.containerInfo,Lr=!0;break e}m=m.return}if(Dt===null)throw Error(Z(160));Yw(f,g,c),Dt=null,Lr=!1;var v=c.alternate;v!==null&&(v.return=null),c.return=null}catch(x){ot(c,t,x)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kw(t,e),t=t.sibling}function Kw(e,t){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pr(t,e),Jr(e),o&4){try{Co(3,e,e.return),Mu(3,e)}catch(M){ot(e,e.return,M)}try{Co(5,e,e.return)}catch(M){ot(e,e.return,M)}}break;case 1:Pr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return);break;case 5:if(Pr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return),e.flags&32){var c=e.stateNode;try{Do(c,"")}catch(M){ot(e,e.return,M)}}if(o&4&&(c=e.stateNode,c!=null)){var f=e.memoizedProps,g=n!==null?n.memoizedProps:f,m=e.type,v=e.updateQueue;if(e.updateQueue=null,v!==null)try{m==="input"&&f.type==="radio"&&f.name!=null&&mm(c,f),qf(m,g);var x=qf(m,f);for(g=0;g<v.length;g+=2){var C=v[g],A=v[g+1];C==="style"?Cm(c,A):C==="dangerouslySetInnerHTML"?ym(c,A):C==="children"?Do(c,A):B0(c,C,A,x)}switch(m){case"input":Xf(c,f);break;case"textarea":wm(c,f);break;case"select":var I=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!f.multiple;var O=f.value;O!=null?ls(c,!!f.multiple,O,!1):I!==!!f.multiple&&(f.defaultValue!=null?ls(c,!!f.multiple,f.defaultValue,!0):ls(c,!!f.multiple,f.multiple?[]:"",!1))}c[Wo]=f}catch(M){ot(e,e.return,M)}}break;case 6:if(Pr(t,e),Jr(e),o&4){if(e.stateNode===null)throw Error(Z(162));c=e.stateNode,f=e.memoizedProps;try{c.nodeValue=f}catch(M){ot(e,e.return,M)}}break;case 3:if(Pr(t,e),Jr(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{Bo(t.containerInfo)}catch(M){ot(e,e.return,M)}break;case 4:Pr(t,e),Jr(e);break;case 13:Pr(t,e),Jr(e),c=e.child,c.flags&8192&&(f=c.memoizedState!==null,c.stateNode.isHidden=f,!f||c.alternate!==null&&c.alternate.memoizedState!==null||(pd=ut())),o&4&&Cp(e);break;case 22:if(C=n!==null&&n.memoizedState!==null,e.mode&1?(Wt=(x=Wt)||C,Pr(t,e),Wt=x):Pr(t,e),Jr(e),o&8192){if(x=e.memoizedState!==null,(e.stateNode.isHidden=x)&&!C&&e.mode&1)for(ie=e,C=e.child;C!==null;){for(A=ie=C;ie!==null;){switch(I=ie,O=I.child,I.tag){case 0:case 11:case 14:case 15:Co(4,I,I.return);break;case 1:ns(I,I.return);var k=I.stateNode;if(typeof k.componentWillUnmount=="function"){o=I,n=I.return;try{t=o,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(M){ot(o,n,M)}}break;case 5:ns(I,I.return);break;case 22:if(I.memoizedState!==null){Sp(A);continue}}O!==null?(O.return=I,ie=O):Sp(A)}C=C.sibling}e:for(C=null,A=e;;){if(A.tag===5){if(C===null){C=A;try{c=A.stateNode,x?(f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none"):(m=A.stateNode,v=A.memoizedProps.style,g=v!=null&&v.hasOwnProperty("display")?v.display:null,m.style.display=Em("display",g))}catch(M){ot(e,e.return,M)}}}else if(A.tag===6){if(C===null)try{A.stateNode.nodeValue=x?"":A.memoizedProps}catch(M){ot(e,e.return,M)}}else if((A.tag!==22&&A.tag!==23||A.memoizedState===null||A===e)&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===e)break e;for(;A.sibling===null;){if(A.return===null||A.return===e)break e;C===A&&(C=null),A=A.return}C===A&&(C=null),A.sibling.return=A.return,A=A.sibling}}break;case 19:Pr(t,e),Jr(e),o&4&&Cp(e);break;case 21:break;default:Pr(t,e),Jr(e)}}function Jr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Xw(n)){var o=n;break e}n=n.return}throw Error(Z(160))}switch(o.tag){case 5:var c=o.stateNode;o.flags&32&&(Do(c,""),o.flags&=-33);var f=Ep(e);b1(e,f,c);break;case 3:case 4:var g=o.stateNode.containerInfo,m=Ep(e);R1(e,m,g);break;default:throw Error(Z(161))}}catch(v){ot(e,e.return,v)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fb(e,t,n){ie=e,Zw(e)}function Zw(e,t,n){for(var o=(e.mode&1)!==0;ie!==null;){var c=ie,f=c.child;if(c.tag===22&&o){var g=c.memoizedState!==null||Ya;if(!g){var m=c.alternate,v=m!==null&&m.memoizedState!==null||Wt;m=Ya;var x=Wt;if(Ya=g,(Wt=v)&&!x)for(ie=c;ie!==null;)g=ie,v=g.child,g.tag===22&&g.memoizedState!==null?Ip(c):v!==null?(v.return=g,ie=v):Ip(c);for(;f!==null;)ie=f,Zw(f),f=f.sibling;ie=c,Ya=m,Wt=x}Ap(e)}else c.subtreeFlags&8772&&f!==null?(f.return=c,ie=f):Ap(e)}}function Ap(e){for(;ie!==null;){var t=ie;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Wt||Mu(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!Wt)if(n===null)o.componentDidMount();else{var c=t.elementType===t.type?n.memoizedProps:Br(t.type,n.memoizedProps);o.componentDidUpdate(c,n.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var f=t.updateQueue;f!==null&&ap(t,f,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}ap(t,g,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var v=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":v.autoFocus&&n.focus();break;case"img":v.src&&(n.src=v.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var x=t.alternate;if(x!==null){var C=x.memoizedState;if(C!==null){var A=C.dehydrated;A!==null&&Bo(A)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Z(163))}Wt||t.flags&512&&T1(t)}catch(I){ot(t,t.return,I)}}if(t===e){ie=null;break}if(n=t.sibling,n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Sp(e){for(;ie!==null;){var t=ie;if(t===e){ie=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Ip(e){for(;ie!==null;){var t=ie;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Mu(4,t)}catch(v){ot(t,n,v)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var c=t.return;try{o.componentDidMount()}catch(v){ot(t,c,v)}}var f=t.return;try{T1(t)}catch(v){ot(t,f,v)}break;case 5:var g=t.return;try{T1(t)}catch(v){ot(t,g,v)}}}catch(v){ot(t,t.return,v)}if(t===e){ie=null;break}var m=t.sibling;if(m!==null){m.return=t.return,ie=m;break}ie=t.return}}var db=Math.ceil,Zl=Sn.ReactCurrentDispatcher,hd=Sn.ReactCurrentOwner,br=Sn.ReactCurrentBatchConfig,_e=0,Tt=null,gt=null,kt=0,dr=0,is=ti(0),yt=0,Xo=null,Ii=0,Pu=0,gd=0,Ao=null,ir=null,pd=0,Ss=1/0,cn=null,Ql=!1,_1=null,Xn=null,Ka=!1,Wn=null,ql=0,So=0,O1=null,ml=-1,wl=0;function Gt(){return _e&6?ut():ml!==-1?ml:ml=ut()}function Yn(e){return e.mode&1?_e&2&&kt!==0?kt&-kt:KR.transition!==null?(wl===0&&(wl=Pm()),wl):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:Wm(e.type)),e):1}function Wr(e,t,n,o){if(50<So)throw So=0,O1=null,Error(Z(185));ta(e,n,o),(!(_e&2)||e!==Tt)&&(e===Tt&&(!(_e&2)&&(Pu|=n),yt===4&&Ln(e,kt)),lr(e,o),n===1&&_e===0&&!(t.mode&1)&&(Ss=ut()+500,Ou&&ri()))}function lr(e,t){var n=e.callbackNode;KT(e,t);var o=kl(e,e===Tt?kt:0);if(o===0)n!==null&&Pg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(n!=null&&Pg(n),t===1)e.tag===0?YR(Tp.bind(null,e)):ow(Tp.bind(null,e)),zR(function(){!(_e&6)&&ri()}),n=null;else{switch(km(o)){case 1:n=W0;break;case 4:n=Dm;break;case 16:n=Pl;break;case 536870912:n=Mm;break;default:n=Pl}n=iv(n,Qw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Qw(e,t){if(ml=-1,wl=0,_e&6)throw Error(Z(327));var n=e.callbackNode;if(hs()&&e.callbackNode!==n)return null;var o=kl(e,e===Tt?kt:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=Jl(e,o);else{t=o;var c=_e;_e|=2;var f=Jw();(Tt!==e||kt!==t)&&(cn=null,Ss=ut()+500,wi(e,t));do try{pb();break}catch(m){qw(e,m)}while(!0);ed(),Zl.current=f,_e=c,gt!==null?t=0:(Tt=null,kt=0,t=yt)}if(t!==0){if(t===2&&(c=n1(e),c!==0&&(o=c,t=N1(e,c))),t===1)throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;if(t===6)Ln(e,o);else{if(c=e.current.alternate,!(o&30)&&!hb(c)&&(t=Jl(e,o),t===2&&(f=n1(e),f!==0&&(o=f,t=N1(e,f))),t===1))throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;switch(e.finishedWork=c,e.finishedLanes=o,t){case 0:case 1:throw Error(Z(345));case 2:di(e,ir,cn);break;case 3:if(Ln(e,o),(o&130023424)===o&&(t=pd+500-ut(),10<t)){if(kl(e,0)!==0)break;if(c=e.suspendedLanes,(c&o)!==o){Gt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=f1(di.bind(null,e,ir,cn),t);break}di(e,ir,cn);break;case 4:if(Ln(e,o),(o&4194240)===o)break;for(t=e.eventTimes,c=-1;0<o;){var g=31-jr(o);f=1<<g,g=t[g],g>c&&(c=g),o&=~f}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*db(o/1960))-o,10<o){e.timeoutHandle=f1(di.bind(null,e,ir,cn),o);break}di(e,ir,cn);break;case 5:di(e,ir,cn);break;default:throw Error(Z(329))}}}return lr(e,ut()),e.callbackNode===n?Qw.bind(null,e):null}function N1(e,t){var n=Ao;return e.current.memoizedState.isDehydrated&&(wi(e,t).flags|=256),e=Jl(e,t),e!==2&&(t=ir,ir=n,t!==null&&D1(t)),e}function D1(e){ir===null?ir=e:ir.push.apply(ir,e)}function hb(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],f=c.getSnapshot;c=c.value;try{if(!$r(f(),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 Ln(e,t){for(t&=~gd,t&=~Pu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-jr(t),o=1<<n;e[n]=-1,t&=~o}}function Tp(e){if(_e&6)throw Error(Z(327));hs();var t=kl(e,0);if(!(t&1))return lr(e,ut()),null;var n=Jl(e,t);if(e.tag!==0&&n===2){var o=n1(e);o!==0&&(t=o,n=N1(e,o))}if(n===1)throw n=Xo,wi(e,0),Ln(e,t),lr(e,ut()),n;if(n===6)throw Error(Z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,di(e,ir,cn),lr(e,ut()),null}function xd(e,t){var n=_e;_e|=1;try{return e(t)}finally{_e=n,_e===0&&(Ss=ut()+500,Ou&&ri())}}function Ti(e){Wn!==null&&Wn.tag===0&&!(_e&6)&&hs();var t=_e;_e|=1;var n=br.transition,o=Pe;try{if(br.transition=null,Pe=1,e)return e()}finally{Pe=o,br.transition=n,_e=t,!(_e&6)&&ri()}}function md(){dr=is.current,ze(is)}function wi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,VR(n)),gt!==null)for(n=gt.return;n!==null;){var o=n;switch(Q0(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&jl();break;case 3:Cs(),ze(or),ze($t),od();break;case 5:sd(o);break;case 4:Cs();break;case 13:ze(qe);break;case 19:ze(qe);break;case 10:td(o.type._context);break;case 22:case 23:md()}n=n.return}if(Tt=e,gt=e=Kn(e.current,null),kt=dr=t,yt=0,Xo=null,gd=Pu=Ii=0,ir=Ao=null,pi!==null){for(t=0;t<pi.length;t++)if(n=pi[t],o=n.interleaved,o!==null){n.interleaved=null;var c=o.next,f=n.pending;if(f!==null){var g=f.next;f.next=c,o.next=g}n.pending=o}pi=null}return e}function qw(e,t){do{var n=gt;try{if(ed(),gl.current=Kl,Yl){for(var o=Je.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}Yl=!1}if(Si=0,It=vt=Je=null,Eo=!1,zo=0,hd.current=null,n===null||n.return===null){yt=1,Xo=t,gt=null;break}e:{var f=e,g=n.return,m=n,v=t;if(t=kt,m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){var x=v,C=m,A=C.tag;if(!(C.mode&1)&&(A===0||A===11||A===15)){var I=C.alternate;I?(C.updateQueue=I.updateQueue,C.memoizedState=I.memoizedState,C.lanes=I.lanes):(C.updateQueue=null,C.memoizedState=null)}var O=hp(g);if(O!==null){O.flags&=-257,gp(O,g,m,f,t),O.mode&1&&dp(f,x,t),t=O,v=x;var k=t.updateQueue;if(k===null){var M=new Set;M.add(v),t.updateQueue=M}else k.add(v);break e}else{if(!(t&1)){dp(f,x,t),wd();break e}v=Error(Z(426))}}else if(Ye&&m.mode&1){var G=hp(g);if(G!==null){!(G.flags&65536)&&(G.flags|=256),gp(G,g,m,f,t),q0(As(v,m));break e}}f=v=As(v,m),yt!==4&&(yt=2),Ao===null?Ao=[f]:Ao.push(f),f=g;do{switch(f.tag){case 3:f.flags|=65536,t&=-t,f.lanes|=t;var N=kw(f,v,t);op(f,N);break e;case 1:m=v;var T=f.type,_=f.stateNode;if(!(f.flags&128)&&(typeof T.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Xn===null||!Xn.has(_)))){f.flags|=65536,t&=-t,f.lanes|=t;var U=Bw(f,m,t);op(f,U);break e}}f=f.return}while(f!==null)}tv(n)}catch(z){t=z,gt===n&&n!==null&&(gt=n=n.return);continue}break}while(!0)}function Jw(){var e=Zl.current;return Zl.current=Kl,e===null?Kl:e}function wd(){(yt===0||yt===3||yt===2)&&(yt=4),Tt===null||!(Ii&268435455)&&!(Pu&268435455)||Ln(Tt,kt)}function Jl(e,t){var n=_e;_e|=2;var o=Jw();(Tt!==e||kt!==t)&&(cn=null,wi(e,t));do try{gb();break}catch(c){qw(e,c)}while(!0);if(ed(),_e=n,Zl.current=o,gt!==null)throw Error(Z(261));return Tt=null,kt=0,yt}function gb(){for(;gt!==null;)ev(gt)}function pb(){for(;gt!==null&&!jT();)ev(gt)}function ev(e){var t=nv(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?tv(e):gt=t,hd.current=null}function tv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lb(n,t),n!==null){n.flags&=32767,gt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{yt=6,gt=null;return}}else if(n=ab(n,t,dr),n!==null){gt=n;return}if(t=t.sibling,t!==null){gt=t;return}gt=t=e}while(t!==null);yt===0&&(yt=5)}function di(e,t,n){var o=Pe,c=br.transition;try{br.transition=null,Pe=1,xb(e,t,n,o)}finally{br.transition=c,Pe=o}return null}function xb(e,t,n,o){do hs();while(Wn!==null);if(_e&6)throw Error(Z(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(Z(177));e.callbackNode=null,e.callbackPriority=0;var f=n.lanes|n.childLanes;if(ZT(e,f),e===Tt&&(gt=Tt=null,kt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ka||(Ka=!0,iv(Pl,function(){return hs(),null})),f=(n.flags&15990)!==0,n.subtreeFlags&15990||f){f=br.transition,br.transition=null;var g=Pe;Pe=1;var m=_e;_e|=4,hd.current=null,cb(e,n),Kw(n,e),BR(u1),Bl=!!l1,u1=l1=null,e.current=n,fb(n),WT(),_e=m,Pe=g,br.transition=f}else e.current=n;if(Ka&&(Ka=!1,Wn=e,ql=c),f=e.pendingLanes,f===0&&(Xn=null),zT(n.stateNode),lr(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(Ql)throw Ql=!1,e=_1,_1=null,e;return ql&1&&e.tag!==0&&hs(),f=e.pendingLanes,f&1?e===O1?So++:(So=0,O1=e):So=0,ri(),null}function hs(){if(Wn!==null){var e=km(ql),t=br.transition,n=Pe;try{if(br.transition=null,Pe=16>e?16:e,Wn===null)var o=!1;else{if(e=Wn,Wn=null,ql=0,_e&6)throw Error(Z(331));var c=_e;for(_e|=4,ie=e.current;ie!==null;){var f=ie,g=f.child;if(ie.flags&16){var m=f.deletions;if(m!==null){for(var v=0;v<m.length;v++){var x=m[v];for(ie=x;ie!==null;){var C=ie;switch(C.tag){case 0:case 11:case 15:Co(8,C,f)}var A=C.child;if(A!==null)A.return=C,ie=A;else for(;ie!==null;){C=ie;var I=C.sibling,O=C.return;if(Gw(C),C===x){ie=null;break}if(I!==null){I.return=O,ie=I;break}ie=O}}}var k=f.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)}}ie=f}}if(f.subtreeFlags&2064&&g!==null)g.return=f,ie=g;else e:for(;ie!==null;){if(f=ie,f.flags&2048)switch(f.tag){case 0:case 11:case 15:Co(9,f,f.return)}var N=f.sibling;if(N!==null){N.return=f.return,ie=N;break e}ie=f.return}}var T=e.current;for(ie=T;ie!==null;){g=ie;var _=g.child;if(g.subtreeFlags&2064&&_!==null)_.return=g,ie=_;else e:for(g=T;ie!==null;){if(m=ie,m.flags&2048)try{switch(m.tag){case 0:case 11:case 15:Mu(9,m)}}catch(z){ot(m,m.return,z)}if(m===g){ie=null;break e}var U=m.sibling;if(U!==null){U.return=m.return,ie=U;break e}ie=m.return}}if(_e=c,ri(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Iu,e)}catch{}o=!0}return o}finally{Pe=n,br.transition=t}}return!1}function Rp(e,t,n){t=As(n,t),t=kw(e,t,1),e=Gn(e,t,1),t=Gt(),e!==null&&(ta(e,1,t),lr(e,t))}function ot(e,t,n){if(e.tag===3)Rp(e,e,n);else for(;t!==null;){if(t.tag===3){Rp(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Xn===null||!Xn.has(o))){e=As(n,e),e=Bw(t,e,1),t=Gn(t,e,1),e=Gt(),t!==null&&(ta(t,1,e),lr(t,e));break}}t=t.return}}function mb(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),t=Gt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(kt&n)===n&&(yt===4||yt===3&&(kt&130023424)===kt&&500>ut()-pd?wi(e,0):gd|=n),lr(e,t)}function rv(e,t){t===0&&(e.mode&1?(t=Ua,Ua<<=1,!(Ua&130023424)&&(Ua=4194304)):t=1);var n=Gt();e=yn(e,t),e!==null&&(ta(e,t,n),lr(e,n))}function wb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rv(e,n)}function vb(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(Z(314))}o!==null&&o.delete(t),rv(e,n)}var nv;nv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||or.current)sr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return sr=!1,ob(e,t,n);sr=!!(e.flags&131072)}else sr=!1,Ye&&t.flags&1048576&&aw(t,Vl,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;xl(e,t),e=t.pendingProps;var c=vs(t,$t.current);ds(t,n),c=ld(null,t,o,e,c,n);var f=ud();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,ar(o)?(f=!0,Wl(t)):f=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,nd(t),c.updater=Du,t.stateNode=c,c._reactInternals=t,w1(t,o,e,n),t=E1(null,t,o,!0,f,n)):(t.tag=0,Ye&&f&&Z0(t),Ht(null,t,c,n),t=t.child),t;case 16:o=t.elementType;e:{switch(xl(e,t),e=t.pendingProps,c=o._init,o=c(o._payload),t.type=o,c=t.tag=Eb(o),e=Br(o,e),c){case 0:t=y1(null,t,o,e,n);break e;case 1:t=mp(null,t,o,e,n);break e;case 11:t=pp(null,t,o,e,n);break e;case 14:t=xp(null,t,o,Br(o.type,e),n);break e}throw Error(Z(306,o,""))}return t;case 0:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),y1(e,t,o,c,n);case 1:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),mp(e,t,o,c,n);case 3:e:{if(jw(t),e===null)throw Error(Z(387));o=t.pendingProps,f=t.memoizedState,c=f.element,hw(e,t),Gl(t,o,null,n);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){c=As(Error(Z(423)),t),t=wp(e,t,o,n,c);break e}else if(o!==c){c=As(Error(Z(424)),t),t=wp(e,t,o,n,c);break e}else for(hr=Hn(t.stateNode.containerInfo.firstChild),gr=t,Ye=!0,Ur=null,n=fw(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ys(),o===c){t=En(e,t,n);break e}Ht(e,t,o,n)}t=t.child}return t;case 5:return gw(t),e===null&&p1(t),o=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,g=c.children,c1(o,c)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),Uw(e,t),Ht(e,t,g,n),t.child;case 6:return e===null&&p1(t),null;case 13:return Ww(e,t,n);case 4:return id(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Es(t,null,o,n):Ht(e,t,o,n),t.child;case 11:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),pp(e,t,o,c,n);case 7:return Ht(e,t,t.pendingProps,n),t.child;case 8:return Ht(e,t,t.pendingProps.children,n),t.child;case 12:return Ht(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,c=t.pendingProps,f=t.memoizedProps,g=c.value,We(zl,o._currentValue),o._currentValue=g,f!==null)if($r(f.value,g)){if(f.children===c.children&&!or.current){t=En(e,t,n);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){g=f.child;for(var v=m.firstContext;v!==null;){if(v.context===o){if(f.tag===1){v=pn(-1,n&-n),v.tag=2;var x=f.updateQueue;if(x!==null){x=x.shared;var C=x.pending;C===null?v.next=v:(v.next=C.next,C.next=v),x.pending=v}}f.lanes|=n,v=f.alternate,v!==null&&(v.lanes|=n),x1(f.return,n,t),m.lanes|=n;break}v=v.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(Z(341));g.lanes|=n,m=g.alternate,m!==null&&(m.lanes|=n),x1(g,n,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ht(e,t,c.children,n),t=t.child}return t;case 9:return c=t.type,o=t.pendingProps.children,ds(t,n),c=_r(c),o=o(c),t.flags|=1,Ht(e,t,o,n),t.child;case 14:return o=t.type,c=Br(o,t.pendingProps),c=Br(o.type,c),xp(e,t,o,c,n);case 15:return Lw(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),xl(e,t),t.tag=1,ar(o)?(e=!0,Wl(t)):e=!1,ds(t,n),Pw(t,o,c),w1(t,o,c,n),E1(null,t,o,!0,e,n);case 19:return $w(e,t,n);case 22:return Fw(e,t,n)}throw Error(Z(156,t.tag))};function iv(e,t){return Nm(e,t)}function yb(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 yb(e,t,n,o)}function vd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Eb(e){if(typeof e=="function")return vd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===F0)return 11;if(e===U0)return 14}return 2}function Kn(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 vl(e,t,n,o,c,f){var g=2;if(o=e,typeof e=="function")vd(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Yi:return vi(n.children,c,f,t);case L0:g=8,c|=8;break;case $f:return e=Rr(12,n,t,c|2),e.elementType=$f,e.lanes=f,e;case Vf:return e=Rr(13,n,t,c),e.elementType=Vf,e.lanes=f,e;case zf:return e=Rr(19,n,t,c),e.elementType=zf,e.lanes=f,e;case gm:return ku(n,c,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dm:g=10;break e;case hm:g=9;break e;case F0:g=11;break e;case U0:g=14;break e;case Pn:g=16,o=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=Rr(g,n,t,c),t.elementType=e,t.type=o,t.lanes=f,t}function vi(e,t,n,o){return e=Rr(7,e,o,t),e.lanes=n,e}function ku(e,t,n,o){return e=Rr(22,e,o,t),e.elementType=gm,e.lanes=n,e.stateNode={isHidden:!1},e}function df(e,t,n){return e=Rr(6,e,null,t),e.lanes=n,e}function hf(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 Cb(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=Gc(0),this.expirationTimes=Gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gc(0),this.identifierPrefix=o,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function yd(e,t,n,o,c,f,g,m,v){return e=new Cb(e,t,n,m,v),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Rr(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nd(f),e}function Ab(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xi,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}function sv(e){if(!e)return Qn;e=e._reactInternals;e:{if(Oi(e)!==e||e.tag!==1)throw Error(Z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Z(171))}if(e.tag===1){var n=e.type;if(ar(n))return sw(e,n,t)}return t}function ov(e,t,n,o,c,f,g,m,v){return e=yd(n,o,!0,e,c,f,g,m,v),e.context=sv(null),n=e.current,o=Gt(),c=Yn(n),f=pn(o,c),f.callback=t??null,Gn(n,f,c),e.current.lanes=c,ta(e,c,o),lr(e,o),e}function Bu(e,t,n,o){var c=t.current,f=Gt(),g=Yn(c);return n=sv(n),t.context===null?t.context=n:t.pendingContext=n,t=pn(f,g),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=Gn(c,t,g),e!==null&&(Wr(e,c,g,f),hl(e,c,g)),g}function eu(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 bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ed(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function Sb(){return null}var av=typeof reportError=="function"?reportError:function(e){console.error(e)};function Cd(e){this._internalRoot=e}Lu.prototype.render=Cd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));Bu(e,t,null,null)};Lu.prototype.unmount=Cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ti(function(){Bu(null,e,null,null)}),t[vn]=null}};function Lu(e){this._internalRoot=e}Lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fm();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Bn.length&&t!==0&&t<Bn[n].priority;n++);Bn.splice(n,0,e),n===0&&jm(e)}};function Ad(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _p(){}function Ib(e,t,n,o,c){if(c){if(typeof o=="function"){var f=o;o=function(){var x=eu(g);f.call(x)}}var g=ov(t,o,e,0,null,!1,!1,"",_p);return e._reactRootContainer=g,e[vn]=g.current,Uo(e.nodeType===8?e.parentNode:e),Ti(),g}for(;c=e.lastChild;)e.removeChild(c);if(typeof o=="function"){var m=o;o=function(){var x=eu(v);m.call(x)}}var v=yd(e,0,!1,null,null,!1,!1,"",_p);return e._reactRootContainer=v,e[vn]=v.current,Uo(e.nodeType===8?e.parentNode:e),Ti(function(){Bu(t,v,n,o)}),v}function Uu(e,t,n,o,c){var f=n._reactRootContainer;if(f){var g=f;if(typeof c=="function"){var m=c;c=function(){var v=eu(g);m.call(v)}}Bu(t,g,e,c)}else g=Ib(n,t,e,c,o);return eu(g)}Bm=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=uo(t.pendingLanes);n!==0&&($0(t,n|1),lr(t,ut()),!(_e&6)&&(Ss=ut()+500,ri()))}break;case 13:Ti(function(){var o=yn(e,1);if(o!==null){var c=Gt();Wr(o,e,1,c)}}),Ed(e,1)}};V0=function(e){if(e.tag===13){var t=yn(e,134217728);if(t!==null){var n=Gt();Wr(t,e,134217728,n)}Ed(e,134217728)}};Lm=function(e){if(e.tag===13){var t=Yn(e),n=yn(e,t);if(n!==null){var o=Gt();Wr(n,e,t,o)}Ed(e,t)}};Fm=function(){return Pe};Um=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}};e1=function(e,t,n){switch(t){case"input":if(Xf(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=_u(o);if(!c)throw Error(Z(90));xm(o),Xf(o,c)}}}break;case"textarea":wm(e,n);break;case"select":t=n.value,t!=null&&ls(e,!!n.multiple,t,!1)}};Im=xd;Tm=Ti;var Tb={usingClientEntryPoint:!1,Events:[na,qi,_u,Am,Sm,xd]},no={findFiberByHostInstance:gi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Rb={bundleType:no.bundleType,version:no.version,rendererPackageName:no.rendererPackageName,rendererConfig:no.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=_m(e),e===null?null:e.stateNode},findFiberByHostInstance:no.findFiberByHostInstance||Sb,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 Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{Iu=Za.inject(Rb),nn=Za}catch{}}wr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tb;wr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ad(t))throw Error(Z(200));return Ab(e,t,null,n)};wr.createRoot=function(e,t){if(!Ad(e))throw Error(Z(299));var n=!1,o="",c=av;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=yd(e,1,!1,null,null,n,!1,o,c),e[vn]=t.current,Uo(e.nodeType===8?e.parentNode:e),new Cd(t)};wr.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(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=_m(t),e=e===null?null:e.stateNode,e};wr.flushSync=function(e){return Ti(e)};wr.hydrate=function(e,t,n){if(!Fu(t))throw Error(Z(200));return Uu(null,e,t,!0,n)};wr.hydrateRoot=function(e,t,n){if(!Ad(e))throw Error(Z(405));var o=n!=null&&n.hydratedSources||null,c=!1,f="",g=av;if(n!=null&&(n.unstable_strictMode===!0&&(c=!0),n.identifierPrefix!==void 0&&(f=n.identifierPrefix),n.onRecoverableError!==void 0&&(g=n.onRecoverableError)),t=ov(t,null,e,1,n??null,c,!1,f,g),e[vn]=t.current,Uo(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 Lu(t)};wr.render=function(e,t,n){if(!Fu(t))throw Error(Z(200));return Uu(null,e,t,!1,n)};wr.unmountComponentAtNode=function(e){if(!Fu(e))throw Error(Z(40));return e._reactRootContainer?(Ti(function(){Uu(null,null,e,!1,function(){e._reactRootContainer=null,e[vn]=null})}),!0):!1};wr.unstable_batchedUpdates=xd;wr.unstable_renderSubtreeIntoContainer=function(e,t,n,o){if(!Fu(n))throw Error(Z(200));if(e==null||e._reactInternals===void 0)throw Error(Z(38));return Uu(e,t,n,!1,o)};wr.version="18.3.1-next-f1338f8080-20240426";function lv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lv)}catch(e){console.error(e)}}lv(),lm.exports=wr;var uv=lm.exports;function bb({message:e,showGuidance:t,windows:n,onClose:o}){const c=ht.useRef(null);return ht.useEffect(()=>{var f;(f=c.current)==null||f.showModal()},[]),uv.createPortal(ee.jsx("dialog",{ref:c,"aria-label":"远程桌面提醒",onCancel:o,onClick:f=>{f.target===f.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:ee.jsxs("div",{style:{padding:20},children:[ee.jsx("strong",{children:"远程桌面提醒"}),ee.jsx("p",{children:e}),t&&ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),ee.jsx("p",{children:n?"在 Windows 电脑上点击“开启共享”,并保持用户已登录、桌面未锁定。完成后此处会自动更新。":"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),ee.jsx("button",{type:"button",className:"ui-quiet-button",onClick:o,autoFocus:!0,children:"知道了"})]})}),document.body)}function _b(){const[e,t]=ht.useState(null),[n,o]=ht.useState(!1),[c,f]=ht.useState(!1),[g,m]=ht.useState(""),v=["127.0.0.1","localhost","[::1]"].includes(location.hostname),x=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);ht.useEffect(()=>{let I=!0;const O=async()=>{try{const M=await fetch(x&&v?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!M.ok)return;const G=await M.json();I&&t(G)}catch{}};O();const k=setInterval(O,2e3);return()=>{I=!1,clearInterval(k)}},[x,v]);const C=(e==null?void 0:e.platform)==="win32";if(!x){if(!e||e.online&&e.accessibility)return null;const I=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 ee.jsxs("div",{className:"remote-desktop-guidance",children:[ee.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:ee.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ee.jsx("circle",{cx:"12",cy:"12",r:"9"}),ee.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),n&&ee.jsx(bb,{windows:C,message:I,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>o(!1)})]})}if(!v)return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.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:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.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:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开终端显示的本机地址,完成配对并开启桌面共享。"}),ee.jsxs("p",{children:["在电脑终端运行 ",ee.jsx("code",{children:"agentroam service status"})," 查看本机地址。"]}),ee.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const A=async(I,O)=>{f(!0),m("");try{const k=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:I,permission:O})}),M=await k.json();if(!k.ok)throw new Error(M.error||"操作失败");t(M)}catch(k){m(k instanceof Error?k.message:"操作失败")}finally{f(!1)}};return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.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:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.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:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:C?"开启后,已配对设备可查看桌面;接管后可使用鼠标和键盘。":"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.supported?e.installed?ee.jsxs(ee.Fragment,{children:[!C&&["screen","accessibility"].map(I=>ee.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[ee.jsxs("span",{children:[I==="screen"?"屏幕录制":"辅助功能",":",e[I]?"已授权":"待授权"]}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("authorize",I),children:"去授权"})]},I)),ee.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("recheck"),children:"重新检测"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("restart"),children:"重启授权组件"})]}),C&&ee.jsxs("p",{style:{fontSize:12,lineHeight:1.6},children:["远程解锁服务:",e.unlock==="available"?"已安装,可在锁屏后远程唤醒和解锁。":"未安装;在 Windows 终端运行 agentroam unlock-service install 后可启用。"]}),ee.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待桌面可用或首帧画面…":"尚未开启共享。"}),ee.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:C?"Windows 锁屏后直播入口会保留,可唤醒屏幕或远程解锁;UAC 安全桌面和未登录状态仍不支持控制。":"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):ee.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):ee.jsx("p",{children:"目前支持 Windows 10/11 x64 和 macOS 14 及以上的 Apple Silicon 电脑。"}),(g||e.error)&&ee.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:g||e.error})]})]})}var cv,Op=uv;cv=Op.createRoot,Op.hydrateRoot;class Ob extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class Nb extends Error{constructor(t,n,o){super(n),this.status=t,this.code=o,this.name="ApiError"}}class Db{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})}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)})}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)})}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)})}async delete(t,n){return this.request(t,{method:"DELETE",headers:n==null?void 0:n.headers})}async request(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 Ob;if(!o.ok){let f=`请求失败 (${o.status})`,g;try{const m=await o.json();typeof m.error=="string"?f=m.error:(c=m.error)!=null&&c.message&&(f=m.error.message),typeof m.code=="string"&&(g=m.code)}catch{}throw new Nb(o.status,f,g)}if(o.status!==204)return await o.json()}}const Mb=30,Pb=20,kb=2e3;function Np(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 Bb(e={}){const t=e.source??"webapp",n=()=>((typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl)??"").replace(/\/+$/,""),o=[];let c=null,f=!1,g=!1;const m=()=>{if(g||f||o.length===0)return;const I=o.splice(0,Pb);f=!0;const O=JSON.stringify({entries:I});fetch(`${n()}/api/client-logs`,{method:"POST",headers:{"content-type":"application/json"},body:O,keepalive:!0}).catch(()=>{}).finally(()=>{f=!1,o.length>0&&v()})},v=()=>{c!==null||g||(c=setTimeout(()=>{c=null,m()},kb))},x=I=>{g||(o.length>=Mb&&o.shift(),o.push(I),v())},C=I=>{var O;x({level:"error",message:I.message||"window error",source:t,error:{name:"Error",message:I.message||"window error",stack:[I.filename?`${I.filename}:${I.lineno}:${I.colno}`:"",((O=I.error)==null?void 0:O.stack)??""].filter(Boolean).join(`
|
|
58
|
-
`).slice(0,8e3)||void 0},data:{filename:I.filename,lineno:I.lineno,colno:I.colno}})},A=I=>{const O=Np(I.reason);x({level:"error",message:`unhandledRejection: ${O.message}`,source:t,error:O})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",A),{reportError:(I,O)=>{const k=Np(I);x({level:"error",message:k.message,source:t,error:k,data:O})},reportWarning:(I,O)=>{x({level:"warn",message:I,source:t,data:O})},uninstall:()=>{g=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",A)}}}const gf="<think>",pf="</think>";function Dp(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 io(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class Lb{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(pf);if(c===-1){const f=Dp(this.buffer,pf);return this.buffer=this.buffer.slice(this.buffer.length-f),n}this.buffer=this.buffer.slice(c+pf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(gf);if(o===-1){const c=Dp(this.buffer,gf);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+gf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const Fb=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,Ub=50,jb=1e3,Wb=2e3;function Mp(e){return e instanceof Error&&e.name!=="AbortError"&&Fb.test(e.message.trim())}class $b{constructor(t,n,o,c=f=>new EventSource(f)){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,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}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,f,g){var O,k;const m=n.startsWith("runtime:"),v=this.streams.has(n),x=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);m&&!x&&this.beginNativeRunRecovery(n,void 0,!0);let A=null,I=null;try{m||await this.openStream(n,this.nativeStreamCursors.get(n)),I=x?null:new Promise(G=>{A=G,this.pendingRuns.set(n,G)}),m||this.ordinaryRunStreamText.set(n,"");const M=await this.http.post("/api/agent/run",{input:t,sessionId:n,...f!=null&&f.length?{images:f}:{},...o!=null&&o.length?{agentIds:o}:{},...!m&&(g!=null&&g.profileId)?{profileId:g.profileId}:{},...(O=g==null?void 0:g.model)!=null&&O.id?{nativeModel:g.model}:{},...g!=null&&g.reasoningEffort?{nativeReasoningEffort:g.reasoningEffort}:{}});if(m||this.startOrdinaryRunRecovery(n),m){const G=this.nativeRunRecoveries.get(n);G&&(G.awaitingAdmission=!1,G.runId=typeof M.runId=="string"?M.runId:void 0);const N=typeof M.runId=="string"&&(C==null?void 0:C.runId)!==M.runId?{sequence:0,runId:M.runId}:C??{sequence:0,...typeof M.runId=="string"?{runId:M.runId}:{}};await this.openStream(n,N,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof M.runId=="string"?{_nativeRunId:M.runId}:{}}),I&&await I}catch(M){const G=!x&&m&&Mp(M)?await this.recoverNativeAdmission(n,C):null;if(G){const U=this.nativeRunRecoveries.get(n);return U&&(U.awaitingAdmission=!1,U.runId=G.runId),await this.openStream(n,G,{waitForOpen:!1}),I&&await I,[]}const N=M.code,T=typeof N=="string"?N:M.status===409?"SESSION_OCCUPIED":void 0;m&&T==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const _=v||x||T==="SESSION_ALREADY_RUNNING";if(m&&_){const U=this.nativeRunRecoveries.get(n);U&&(U.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:Mp(M)?"网络连接中断,消息未确认发送,请重试":M instanceof Error?M.message:"无法启动运行",...T?{code:T}:{},..._?{_preserveActiveRun:!0}:{}}),_?A&&this.pendingRuns.get(n)===A&&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`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,g=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,m=!!(f&&(n!=null&&n.runId)&&f!==n.runId),v=!!(f&&!(n!=null&&n.runId)&&c.status==="running");return!m&&!v?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:g}),{runId:f,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||this.run(t,n).catch(()=>{}),!0}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){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const n of[...this.pendingRuns.keys()])this.settle(n);for(const n of[...this.streams.keys()])this.closeStream(n);for(const n of[...this.nativeRunRecoveries.keys()])this.stopNativeRunRecovery(n)}}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 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){var f;const o=this.nativeRunRecoveries.get(t),c=o==null?void 0:o.runId;try{const g=new URLSearchParams;n!=null&&n.before&&g.set("before",n.before),n!=null&&n.after&&g.set("after",n.after),n!=null&&n.anchor&&g.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&g.set("limit",String(n.limit)),n!=null&&n.view&&g.set("view",n.view),n!=null&&n.revision&&g.set("revision",n.revision),n!=null&&n.turnId&&g.set("turnId",n.turnId);const m=g.size>0?`?${g.toString()}`:"",v=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${m}`);Array.isArray(v.messages)&&(v.messages=v.messages.map(C=>typeof C.content=="string"?{...C,content:io(C.content)}:C)),Array.isArray(v.events)&&(v.events=v.events.map(C=>typeof C.text=="string"&&C.text.includes("<think>")?{...C,text:io(C.text)}:typeof C.finalText=="string"&&C.finalText.includes("<think>")?{...C,finalText:io(C.finalText)}:C));const x=o===this.nativeRunRecoveries.get(t)&&c===(o==null?void 0:o.runId);if(t.startsWith("runtime:")&&x&&typeof v.snapshotRevision=="number"){const C=typeof v.snapshotRunId=="string"?v.snapshotRunId:void 0;if(C&&((f=this.nativeRunIdentities.get(t))!=null&&f.retired.has(C)))return v;const A=v.history,I=(A==null?void 0:A.delivery)==="core"||(A==null?void 0:A.delivery)==="trace";if((A==null?void 0:A.delivery)==="core"&&C&&this.coreSnapshotContainsTailFinalAnswer(v.messages)&&this.rememberNativeFinalAnswerSnapshot(t,v.snapshotRevision,C),I||this.rememberNativeStreamCursor(t,v.snapshotRevision,C),v.status==="running"&&v.occupancy!=="owned-externally"){const O=this.nativeStreamCursors.get(t),k=I&&C&&(O==null?void 0:O.runId)!==C?{sequence:0,runId:C}:O??(I?{sequence:0,...C?{runId:C}:{}}:void 0);this.openStream(t,k).catch(()=>{})}o&&!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace"&&await this.reconcileNativeRun(t,o,c,v)}else if(!t.startsWith("runtime:")&&v.status==="active"){const C=v.activeRun;(C==null?void 0:C.running)===!0&&typeof C.eventId=="number"&&this.openStream(t,{sequence:C.eventId}).catch(()=>{})}return v}catch(g){if(g.status===404)return null;throw g}}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 f=!1;return c.onmessage=g=>{if(g.data)try{const m=JSON.parse(g.data);m.type==="session_history_changed"&&typeof m.revision=="number"&&n({type:m.type,revision:m.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),o==null||o())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:n})}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 f;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((f=c.started)==null?void 0:f.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}});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){return this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}})}async forkSession(t,n){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/${n?"fork-at":"fork"}`,n?{point:n}:{})}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 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=(f,g)=>{try{return JSON.parse(localStorage.getItem(f)||"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}}async ttsSpeak(){return{ok:!1}}async ttsStop(){return{ok:!0}}async ttsPlaybackEnded(){return{ok:!0}}onTtsStart(){return()=>{}}onTtsPcm(){return()=>{}}onTtsStreamEnd(){return()=>{}}onTtsFlush(){return()=>{}}onTtsEnd(){return()=>{}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}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),Ub);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 f=this.nativeRunIdentities.get(t);if(f!=null&&f.retired.has(n))return;f&&f.current!==n?(f.retired.add(f.current),f.current=n):f||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)},Wb)}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"})}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 f=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;f=M,g=c.snapshotRunId}let m=Array.isArray(c.events)?c.events:[],v=c.status,x=[...m].reverse().find(M=>M.type==="done"||M.type==="error"||M.type==="turn_aborted");if(!x&&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;v=M.status,m=Array.isArray(M.events)?M.events:[],x=[...m].reverse().find(G=>G.type==="done"||G.type==="error"||G.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==f||f.runId!==g||f.awaitingAdmission)return;const C=(x==null?void 0:x.type)??(v==="failed"?"error":v==="aborted"?"turn_aborted":"done"),{_nativeSequence:A,_nativeRunId:I,...O}=x??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...O,type:C,...C==="error"?{message:(x==null?void 0:x.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(x==null?void 0:x.durationMs)===void 0?{}:{durationMs:x.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)},jb);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??[],f=c.map(x=>x.role).lastIndexOf("user"),g=io(c.slice(f+1).filter(x=>x.role==="assistant"&&(x.content??"").trim()).map(x=>x.content.trim()).join(`
|
|
57
|
+
`+f.stack}return{value:e,source:t,stack:c,digest:null}}function ff(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function y1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var nb=typeof WeakMap=="function"?WeakMap:Map;function kw(e,t,n){n=pn(-1,n),n.tag=3,n.payload={element:null};var o=t.value;return n.callback=function(){ql||(ql=!0,O1=o),y1(e,t)},n}function Bw(e,t,n){n=pn(-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(){y1(e,t)}}var f=e.stateNode;return f!==null&&typeof f.componentDidCatch=="function"&&(n.callback=function(){y1(e,t),typeof o!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var g=t.stack;this.componentDidCatch(t.value,{componentStack:g!==null?g:""})}),n}function dp(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new nb;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=mb.bind(null,e,t,n),t.then(e,e))}function hp(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 gp(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=pn(-1,1),t.tag=2,Gn(n,t,1))),n.lanes|=1),e)}var ib=Sn.ReactCurrentOwner,sr=!1;function Ht(e,t,n,o){t.child=e===null?fw(t,null,n,o):Es(t,e.child,n,o)}function pp(e,t,n,o,c){n=n.render;var f=t.ref;return ds(t,c),o=ld(e,t,n,o,f,c),n=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&n&&Z0(t),t.flags|=1,Ht(e,t,o,c),t.child)}function xp(e,t,n,o,c){if(e===null){var f=n.type;return typeof f=="function"&&!vd(f)&&f.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=f,Lw(e,t,f,o,c)):(e=vl(n.type,null,o,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!(e.lanes&c)){var g=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fo,n(g,o)&&e.ref===t.ref)return En(e,t,c)}return t.flags|=1,e=Kn(f,o),e.ref=t.ref,e.return=t,t.child=e}function Lw(e,t,n,o,c){if(e!==null){var f=e.memoizedProps;if(Fo(f,o)&&e.ref===t.ref)if(sr=!1,t.pendingProps=o=f,(e.lanes&c)!==0)e.flags&131072&&(sr=!0);else return t.lanes=e.lanes,En(e,t,c)}return E1(e,t,n,o,c)}function Fw(e,t,n){var o=t.pendingProps,c=o.children,f=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},We(is,dr),dr|=n;else{if(!(n&1073741824))return e=f!==null?f.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,We(is,dr),dr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=f!==null?f.baseLanes:n,We(is,dr),dr|=o}else f!==null?(o=f.baseLanes|n,t.memoizedState=null):o=n,We(is,dr),dr|=o;return Ht(e,t,c,n),t.child}function Uw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function E1(e,t,n,o,c){var f=ar(n)?Ci:$t.current;return f=vs(t,f),ds(t,c),n=ld(e,t,n,o,f,c),o=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&o&&Z0(t),t.flags|=1,Ht(e,t,n,c),t.child)}function mp(e,t,n,o,c){if(ar(n)){var f=!0;$l(t)}else f=!1;if(ds(t,c),t.stateNode===null)xl(e,t),Mw(t,n,o),v1(t,n,o,c),o=!0;else if(e===null){var g=t.stateNode,m=t.memoizedProps;g.props=m;var v=g.context,x=n.contextType;typeof x=="object"&&x!==null?x=_r(x):(x=ar(n)?Ci:$t.current,x=vs(t,x));var C=n.getDerivedStateFromProps,A=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function";A||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==o||v!==x)&&fp(t,g,o,x),kn=!1;var I=t.memoizedState;g.state=I,Xl(t,o,g,c),v=t.memoizedState,m!==o||I!==v||or.current||kn?(typeof C=="function"&&(w1(t,n,C,o),v=t.memoizedState),(m=kn||cp(t,n,m,o,I,v,x))?(A||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=v),g.props=o,g.state=v,g.context=x,o=m):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{g=t.stateNode,hw(e,t),m=t.memoizedProps,x=t.type===t.elementType?m:Br(t.type,m),g.props=x,A=t.pendingProps,I=g.context,v=n.contextType,typeof v=="object"&&v!==null?v=_r(v):(v=ar(n)?Ci:$t.current,v=vs(t,v));var O=n.getDerivedStateFromProps;(C=typeof O=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==A||I!==v)&&fp(t,g,o,v),kn=!1,I=t.memoizedState,g.state=I,Xl(t,o,g,c);var k=t.memoizedState;m!==A||I!==k||or.current||kn?(typeof O=="function"&&(w1(t,n,O,o),k=t.memoizedState),(x=kn||cp(t,n,x,o,I,k,v)||!1)?(C||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,k,v),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,k,v)),typeof g.componentDidUpdate=="function"&&(t.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=k),g.props=o,g.state=k,g.context=v,o=x):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),o=!1)}return C1(e,t,n,o,f,c)}function C1(e,t,n,o,c,f){Uw(e,t);var g=(t.flags&128)!==0;if(!o&&!g)return c&&rp(t,n,!1),En(e,t,f);o=t.stateNode,ib.current=t;var m=g&&typeof n.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&g?(t.child=Es(t,e.child,null,f),t.child=Es(t,null,m,f)):Ht(e,t,m,f),t.memoizedState=o.state,c&&rp(t,n,!0),t.child}function jw(e){var t=e.stateNode;t.pendingContext?tp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tp(e,t.context,!1),id(e,t.containerInfo)}function wp(e,t,n,o,c){return ys(),q0(c),t.flags|=256,Ht(e,t,n,o),t.child}var A1={dehydrated:null,treeContext:null,retryLane:0};function S1(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ww(e,t,n){var o=t.pendingProps,c=qe.current,f=!1,g=(t.flags&128)!==0,m;if((m=g)||(m=e!==null&&e.memoizedState===null?!1:(c&2)!==0),m?(f=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),We(qe,c&1),e===null)return x1(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,f?(o=t.mode,f=t.child,g={mode:"hidden",children:g},!(o&1)&&f!==null?(f.childLanes=0,f.pendingProps=g):f=Bu(g,o,0,null),e=vi(e,o,n,null),f.return=t,e.return=t,f.sibling=e,t.child=f,t.child.memoizedState=S1(n),t.memoizedState=A1,e):dd(t,g));if(c=e.memoizedState,c!==null&&(m=c.dehydrated,m!==null))return sb(e,t,g,o,m,c,n);if(f){f=o.fallback,g=t.mode,c=e.child,m=c.sibling;var v={mode:"hidden",children:o.children};return!(g&1)&&t.child!==c?(o=t.child,o.childLanes=0,o.pendingProps=v,t.deletions=null):(o=Kn(c,v),o.subtreeFlags=c.subtreeFlags&14680064),m!==null?f=Kn(m,f):(f=vi(f,g,n,null),f.flags|=2),f.return=t,o.return=t,o.sibling=f,t.child=o,o=f,f=t.child,g=e.child.memoizedState,g=g===null?S1(n):{baseLanes:g.baseLanes|n,cachePool:null,transitions:g.transitions},f.memoizedState=g,f.childLanes=e.childLanes&~n,t.memoizedState=A1,o}return f=e.child,e=f.sibling,o=Kn(f,{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 dd(e,t){return t=Bu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Xa(e,t,n,o){return o!==null&&q0(o),Es(t,e.child,null,n),e=dd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sb(e,t,n,o,c,f,g){if(n)return t.flags&256?(t.flags&=-257,o=ff(Error(Z(422))),Xa(e,t,g,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(f=o.fallback,c=t.mode,o=Bu({mode:"visible",children:o.children},c,0,null),f=vi(f,c,g,null),f.flags|=2,o.return=t,f.return=t,o.sibling=f,t.child=o,t.mode&1&&Es(t,e.child,null,g),t.child.memoizedState=S1(g),t.memoizedState=A1,f);if(!(t.mode&1))return Xa(e,t,g,null);if(c.data==="$!"){if(o=c.nextSibling&&c.nextSibling.dataset,o)var m=o.dgst;return o=m,f=Error(Z(419)),o=ff(f,o,void 0),Xa(e,t,g,o)}if(m=(g&e.childLanes)!==0,sr||m){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!==f.retryLane&&(f.retryLane=c,yn(e,c),Wr(o,e,c,-1))}return wd(),o=ff(Error(Z(421))),Xa(e,t,g,o)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=wb.bind(null,e),c._reactRetry=t,null):(e=f.treeContext,hr=Hn(c.nextSibling),gr=t,Ye=!0,Ur=null,e!==null&&(Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,hn=e.id,gn=e.overflow,Ai=t),t=dd(t,o.children),t.flags|=4096,t)}function vp(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),m1(e.return,t,n)}function df(e,t,n,o,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=o,f.tail=n,f.tailMode=c)}function $w(e,t,n){var o=t.pendingProps,c=o.revealOrder,f=o.tail;if(Ht(e,t,o.children,n),o=qe.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&&vp(e,n,t);else if(e.tag===19)vp(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(We(qe,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&&Yl(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),df(t,!1,c,n,f);break;case"backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Yl(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}df(t,!0,n,null,f);break;case"together":df(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ii|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=Kn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Kn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ob(e,t,n){switch(t.tag){case 3:jw(t),ys();break;case 5:gw(t);break;case 1:ar(t.type)&&$l(t);break;case 4:id(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,c=t.memoizedProps.value;We(Hl,o._currentValue),o._currentValue=c;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?(We(qe,qe.current&1),t.flags|=128,null):n&t.child.childLanes?Ww(e,t,n):(We(qe,qe.current&1),e=En(e,t,n),e!==null?e.sibling:null);We(qe,qe.current&1);break;case 19:if(o=(n&t.childLanes)!==0,e.flags&128){if(o)return $w(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),We(qe,qe.current),o)break;return null;case 22:case 23:return t.lanes=0,Fw(e,t,n)}return En(e,t,n)}var Vw,I1,zw,Hw;Vw=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}};I1=function(){};zw=function(e,t,n,o){var c=e.memoizedProps;if(c!==o){e=t.stateNode,xi(sn.current);var f=null;switch(n){case"input":c=Xf(e,c),o=Xf(e,o),f=[];break;case"select":c=et({},c,{value:void 0}),o=et({},o,{value:void 0}),f=[];break;case"textarea":c=Zf(e,c),o=Zf(e,o),f=[];break;default:typeof c.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=jl)}qf(n,o);var g;n=null;for(x in c)if(!o.hasOwnProperty(x)&&c.hasOwnProperty(x)&&c[x]!=null)if(x==="style"){var m=c[x];for(g in m)m.hasOwnProperty(g)&&(n||(n={}),n[g]="")}else x!=="dangerouslySetInnerHTML"&&x!=="children"&&x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(No.hasOwnProperty(x)?f||(f=[]):(f=f||[]).push(x,null));for(x in o){var v=o[x];if(m=c!=null?c[x]:void 0,o.hasOwnProperty(x)&&v!==m&&(v!=null||m!=null))if(x==="style")if(m){for(g in m)!m.hasOwnProperty(g)||v&&v.hasOwnProperty(g)||(n||(n={}),n[g]="");for(g in v)v.hasOwnProperty(g)&&m[g]!==v[g]&&(n||(n={}),n[g]=v[g])}else n||(f||(f=[]),f.push(x,n)),n=v;else x==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,m=m?m.__html:void 0,v!=null&&m!==v&&(f=f||[]).push(x,v)):x==="children"?typeof v!="string"&&typeof v!="number"||(f=f||[]).push(x,""+v):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&(No.hasOwnProperty(x)?(v!=null&&x==="onScroll"&&Ve("scroll",e),f||m===v||(f=[])):(f=f||[]).push(x,v))}n&&(f=f||[]).push("style",n);var x=f;(t.updateQueue=x)&&(t.flags|=4)}};Hw=function(e,t,n,o){n!==o&&(t.flags|=4)};function ro(e,t){if(!Ye)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 jt(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 ab(e,t,n){var o=t.pendingProps;switch(Q0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(t),null;case 1:return ar(t.type)&&Wl(),jt(t),null;case 3:return o=t.stateNode,Cs(),ze(or),ze($t),od(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(Ha(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ur!==null&&(P1(Ur),Ur=null))),I1(e,t),jt(t),null;case 5:sd(t);var c=xi(Vo.current);if(n=t.type,e!==null&&t.stateNode!=null)zw(e,t,n,o,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(Z(166));return jt(t),null}if(e=xi(sn.current),Ha(t)){o=t.stateNode,n=t.type;var f=t.memoizedProps;switch(o[rn]=t,o[Wo]=f,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<co.length;c++)Ve(co[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":bg(o,f),Ve("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!f.multiple},Ve("invalid",o);break;case"textarea":Og(o,f),Ve("invalid",o)}qf(n,f),c=null;for(var g in f)if(f.hasOwnProperty(g)){var m=f[g];g==="children"?typeof m=="string"?o.textContent!==m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",m]):typeof m=="number"&&o.textContent!==""+m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",""+m]):No.hasOwnProperty(g)&&m!=null&&g==="onScroll"&&Ve("scroll",o)}switch(n){case"input":Ba(o),_g(o,f,!0);break;case"textarea":Ba(o),Ng(o);break;case"select":case"option":break;default:typeof f.onClick=="function"&&(o.onclick=jl)}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=vm(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[rn]=t,e[Wo]=o,Vw(e,t,!1,!1),t.stateNode=e;e:{switch(g=Jf(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<co.length;c++)Ve(co[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":bg(e,o),c=Xf(e,o),Ve("invalid",e);break;case"option":c=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},c=et({},o,{value:void 0}),Ve("invalid",e);break;case"textarea":Og(e,o),c=Zf(e,o),Ve("invalid",e);break;default:c=o}qf(n,c),m=c;for(f in m)if(m.hasOwnProperty(f)){var v=m[f];f==="style"?Cm(e,v):f==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,v!=null&&ym(e,v)):f==="children"?typeof v=="string"?(n!=="textarea"||v!=="")&&Do(e,v):typeof v=="number"&&Do(e,""+v):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(No.hasOwnProperty(f)?v!=null&&f==="onScroll"&&Ve("scroll",e):v!=null&&B0(e,f,v,g))}switch(n){case"input":Ba(e),_g(e,o,!1);break;case"textarea":Ba(e),Ng(e);break;case"option":o.value!=null&&e.setAttribute("value",""+Zn(o.value));break;case"select":e.multiple=!!o.multiple,f=o.value,f!=null?ls(e,!!o.multiple,f,!1):o.defaultValue!=null&&ls(e,!!o.multiple,o.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=jl)}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 jt(t),null;case 6:if(e&&t.stateNode!=null)Hw(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(Z(166));if(n=xi(Vo.current),xi(sn.current),Ha(t)){if(o=t.stateNode,n=t.memoizedProps,o[rn]=t,(f=o.nodeValue!==n)&&(e=gr,e!==null))switch(e.tag){case 3:za(o.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&za(o.nodeValue,n,(e.mode&1)!==0)}f&&(t.flags|=4)}else o=(n.nodeType===9?n:n.ownerDocument).createTextNode(o),o[rn]=t,t.stateNode=o}return jt(t),null;case 13:if(ze(qe),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ye&&hr!==null&&t.mode&1&&!(t.flags&128))uw(),ys(),t.flags|=98560,f=!1;else if(f=Ha(t),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(Z(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(Z(317));f[rn]=t}else ys(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jt(t),f=!1}else Ur!==null&&(P1(Ur),Ur=null),f=!0;if(!f)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||qe.current&1?yt===0&&(yt=3):wd())),t.updateQueue!==null&&(t.flags|=4),jt(t),null);case 4:return Cs(),I1(e,t),e===null&&Uo(t.stateNode.containerInfo),jt(t),null;case 10:return td(t.type._context),jt(t),null;case 17:return ar(t.type)&&Wl(),jt(t),null;case 19:if(ze(qe),f=t.memoizedState,f===null)return jt(t),null;if(o=(t.flags&128)!==0,g=f.rendering,g===null)if(o)ro(f,!1);else{if(yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(g=Yl(e),g!==null){for(t.flags|=128,ro(f,!1),o=g.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=n,n=t.child;n!==null;)f=n,e=o,f.flags&=14680066,g=f.alternate,g===null?(f.childLanes=0,f.lanes=e,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,e=g.dependencies,f.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return We(qe,qe.current&1|2),t.child}e=e.sibling}f.tail!==null&&ut()>Ss&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304)}else{if(!o)if(e=Yl(g),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ro(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!Ye)return jt(t),null}else 2*ut()-f.renderingStartTime>Ss&&n!==1073741824&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(n=f.last,n!==null?n.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=ut(),t.sibling=null,n=qe.current,We(qe,o?n&1|2:n&1),t):(jt(t),null);case 22:case 23:return md(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?dr&1073741824&&(jt(t),t.subtreeFlags&6&&(t.flags|=8192)):jt(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function lb(e,t){switch(Q0(t),t.tag){case 1:return ar(t.type)&&Wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cs(),ze(or),ze($t),od(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sd(t),null;case 13:if(ze(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ze(qe),null;case 4:return Cs(),null;case 10:return td(t.type._context),null;case 22:case 23:return md(),null;case 24:return null;default:return null}}var Ya=!1,Wt=!1,ub=typeof WeakSet=="function"?WeakSet:Set,ie=null;function ns(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){ot(e,t,o)}else n.current=null}function T1(e,t,n){try{n()}catch(o){ot(e,t,o)}}var yp=!1;function cb(e,t){if(u1=Ll,e=Zm(),K0(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,f=o.focusNode;o=o.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var g=0,m=-1,v=-1,x=0,C=0,A=e,I=null;t:for(;;){for(var O;A!==n||c!==0&&A.nodeType!==3||(m=g+c),A!==f||o!==0&&A.nodeType!==3||(v=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(O=A.firstChild)!==null;)I=A,A=O;for(;;){if(A===e)break t;if(I===n&&++x===c&&(m=g),I===f&&++C===o&&(v=g),(O=A.nextSibling)!==null)break;A=I,I=A.parentNode}A=O}n=m===-1||v===-1?null:{start:m,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(c1={focusedElem:e,selectionRange:n},Ll=!1,ie=t;ie!==null;)if(t=ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ie=e;else for(;ie!==null;){t=ie;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 P=k.memoizedProps,G=k.memoizedState,N=t.stateNode,T=N.getSnapshotBeforeUpdate(t.elementType===t.type?P:Br(t.type,P),G);N.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(U){ot(t,t.return,U)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return k=yp,yp=!1,k}function Co(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 f=c.destroy;c.destroy=void 0,f!==void 0&&T1(t,n,f)}c=c.next}while(c!==o)}}function Mu(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 R1(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 Gw(e){var t=e.alternate;t!==null&&(e.alternate=null,Gw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[rn],delete t[Wo],delete t[h1],delete t[GR],delete t[XR])),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 Xw(e){return e.tag===5||e.tag===3||e.tag===4}function Ep(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xw(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 b1(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=jl));else if(o!==4&&(e=e.child,e!==null))for(b1(e,t,n),e=e.sibling;e!==null;)b1(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,Lr=!1;function Pn(e,t,n){for(n=n.child;n!==null;)Yw(e,t,n),n=n.sibling}function Yw(e,t,n){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Tu,n)}catch{}switch(n.tag){case 5:Wt||ns(n,t);case 6:var o=Dt,c=Lr;Dt=null,Pn(e,t,n),Dt=o,Lr=c,Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?sf(e.parentNode,n):e.nodeType===1&&sf(e,n),Bo(e)):sf(Dt,n.stateNode));break;case 4:o=Dt,c=Lr,Dt=n.stateNode.containerInfo,Lr=!0,Pn(e,t,n),Dt=o,Lr=c;break;case 0:case 11:case 14:case 15:if(!Wt&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){c=o=o.next;do{var f=c,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&T1(n,t,g),c=c.next}while(c!==o)}Pn(e,t,n);break;case 1:if(!Wt&&(ns(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(m){ot(n,t,m)}Pn(e,t,n);break;case 21:Pn(e,t,n);break;case 22:n.mode&1?(Wt=(o=Wt)||n.memoizedState!==null,Pn(e,t,n),Wt=o):Pn(e,t,n);break;default:Pn(e,t,n)}}function Cp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ub),t.forEach(function(o){var c=vb.bind(null,e,o);n.has(o)||(n.add(o),o.then(c,c))})}}function Mr(e,t){var n=t.deletions;if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];try{var f=e,g=t,m=g;e:for(;m!==null;){switch(m.tag){case 5:Dt=m.stateNode,Lr=!1;break e;case 3:Dt=m.stateNode.containerInfo,Lr=!0;break e;case 4:Dt=m.stateNode.containerInfo,Lr=!0;break e}m=m.return}if(Dt===null)throw Error(Z(160));Yw(f,g,c),Dt=null,Lr=!1;var v=c.alternate;v!==null&&(v.return=null),c.return=null}catch(x){ot(c,t,x)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kw(t,e),t=t.sibling}function Kw(e,t){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Mr(t,e),Jr(e),o&4){try{Co(3,e,e.return),Mu(3,e)}catch(P){ot(e,e.return,P)}try{Co(5,e,e.return)}catch(P){ot(e,e.return,P)}}break;case 1:Mr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return);break;case 5:if(Mr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return),e.flags&32){var c=e.stateNode;try{Do(c,"")}catch(P){ot(e,e.return,P)}}if(o&4&&(c=e.stateNode,c!=null)){var f=e.memoizedProps,g=n!==null?n.memoizedProps:f,m=e.type,v=e.updateQueue;if(e.updateQueue=null,v!==null)try{m==="input"&&f.type==="radio"&&f.name!=null&&mm(c,f),Jf(m,g);var x=Jf(m,f);for(g=0;g<v.length;g+=2){var C=v[g],A=v[g+1];C==="style"?Cm(c,A):C==="dangerouslySetInnerHTML"?ym(c,A):C==="children"?Do(c,A):B0(c,C,A,x)}switch(m){case"input":Yf(c,f);break;case"textarea":wm(c,f);break;case"select":var I=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!f.multiple;var O=f.value;O!=null?ls(c,!!f.multiple,O,!1):I!==!!f.multiple&&(f.defaultValue!=null?ls(c,!!f.multiple,f.defaultValue,!0):ls(c,!!f.multiple,f.multiple?[]:"",!1))}c[Wo]=f}catch(P){ot(e,e.return,P)}}break;case 6:if(Mr(t,e),Jr(e),o&4){if(e.stateNode===null)throw Error(Z(162));c=e.stateNode,f=e.memoizedProps;try{c.nodeValue=f}catch(P){ot(e,e.return,P)}}break;case 3:if(Mr(t,e),Jr(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{Bo(t.containerInfo)}catch(P){ot(e,e.return,P)}break;case 4:Mr(t,e),Jr(e);break;case 13:Mr(t,e),Jr(e),c=e.child,c.flags&8192&&(f=c.memoizedState!==null,c.stateNode.isHidden=f,!f||c.alternate!==null&&c.alternate.memoizedState!==null||(pd=ut())),o&4&&Cp(e);break;case 22:if(C=n!==null&&n.memoizedState!==null,e.mode&1?(Wt=(x=Wt)||C,Mr(t,e),Wt=x):Mr(t,e),Jr(e),o&8192){if(x=e.memoizedState!==null,(e.stateNode.isHidden=x)&&!C&&e.mode&1)for(ie=e,C=e.child;C!==null;){for(A=ie=C;ie!==null;){switch(I=ie,O=I.child,I.tag){case 0:case 11:case 14:case 15:Co(4,I,I.return);break;case 1:ns(I,I.return);var k=I.stateNode;if(typeof k.componentWillUnmount=="function"){o=I,n=I.return;try{t=o,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(P){ot(o,n,P)}}break;case 5:ns(I,I.return);break;case 22:if(I.memoizedState!==null){Sp(A);continue}}O!==null?(O.return=I,ie=O):Sp(A)}C=C.sibling}e:for(C=null,A=e;;){if(A.tag===5){if(C===null){C=A;try{c=A.stateNode,x?(f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none"):(m=A.stateNode,v=A.memoizedProps.style,g=v!=null&&v.hasOwnProperty("display")?v.display:null,m.style.display=Em("display",g))}catch(P){ot(e,e.return,P)}}}else if(A.tag===6){if(C===null)try{A.stateNode.nodeValue=x?"":A.memoizedProps}catch(P){ot(e,e.return,P)}}else if((A.tag!==22&&A.tag!==23||A.memoizedState===null||A===e)&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===e)break e;for(;A.sibling===null;){if(A.return===null||A.return===e)break e;C===A&&(C=null),A=A.return}C===A&&(C=null),A.sibling.return=A.return,A=A.sibling}}break;case 19:Mr(t,e),Jr(e),o&4&&Cp(e);break;case 21:break;default:Mr(t,e),Jr(e)}}function Jr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Xw(n)){var o=n;break e}n=n.return}throw Error(Z(160))}switch(o.tag){case 5:var c=o.stateNode;o.flags&32&&(Do(c,""),o.flags&=-33);var f=Ep(e);_1(e,f,c);break;case 3:case 4:var g=o.stateNode.containerInfo,m=Ep(e);b1(e,m,g);break;default:throw Error(Z(161))}}catch(v){ot(e,e.return,v)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fb(e,t,n){ie=e,Zw(e)}function Zw(e,t,n){for(var o=(e.mode&1)!==0;ie!==null;){var c=ie,f=c.child;if(c.tag===22&&o){var g=c.memoizedState!==null||Ya;if(!g){var m=c.alternate,v=m!==null&&m.memoizedState!==null||Wt;m=Ya;var x=Wt;if(Ya=g,(Wt=v)&&!x)for(ie=c;ie!==null;)g=ie,v=g.child,g.tag===22&&g.memoizedState!==null?Ip(c):v!==null?(v.return=g,ie=v):Ip(c);for(;f!==null;)ie=f,Zw(f),f=f.sibling;ie=c,Ya=m,Wt=x}Ap(e)}else c.subtreeFlags&8772&&f!==null?(f.return=c,ie=f):Ap(e)}}function Ap(e){for(;ie!==null;){var t=ie;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Wt||Mu(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!Wt)if(n===null)o.componentDidMount();else{var c=t.elementType===t.type?n.memoizedProps:Br(t.type,n.memoizedProps);o.componentDidUpdate(c,n.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var f=t.updateQueue;f!==null&&ap(t,f,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}ap(t,g,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var v=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":v.autoFocus&&n.focus();break;case"img":v.src&&(n.src=v.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var x=t.alternate;if(x!==null){var C=x.memoizedState;if(C!==null){var A=C.dehydrated;A!==null&&Bo(A)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Z(163))}Wt||t.flags&512&&R1(t)}catch(I){ot(t,t.return,I)}}if(t===e){ie=null;break}if(n=t.sibling,n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Sp(e){for(;ie!==null;){var t=ie;if(t===e){ie=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Ip(e){for(;ie!==null;){var t=ie;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Mu(4,t)}catch(v){ot(t,n,v)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var c=t.return;try{o.componentDidMount()}catch(v){ot(t,c,v)}}var f=t.return;try{R1(t)}catch(v){ot(t,f,v)}break;case 5:var g=t.return;try{R1(t)}catch(v){ot(t,g,v)}}}catch(v){ot(t,t.return,v)}if(t===e){ie=null;break}var m=t.sibling;if(m!==null){m.return=t.return,ie=m;break}ie=t.return}}var db=Math.ceil,Ql=Sn.ReactCurrentDispatcher,hd=Sn.ReactCurrentOwner,br=Sn.ReactCurrentBatchConfig,_e=0,Tt=null,gt=null,kt=0,dr=0,is=ti(0),yt=0,Xo=null,Ii=0,ku=0,gd=0,Ao=null,ir=null,pd=0,Ss=1/0,cn=null,ql=!1,O1=null,Xn=null,Ka=!1,Wn=null,Jl=0,So=0,N1=null,ml=-1,wl=0;function Gt(){return _e&6?ut():ml!==-1?ml:ml=ut()}function Yn(e){return e.mode&1?_e&2&&kt!==0?kt&-kt:KR.transition!==null?(wl===0&&(wl=Mm()),wl):(e=Me,e!==0||(e=window.event,e=e===void 0?16:Wm(e.type)),e):1}function Wr(e,t,n,o){if(50<So)throw So=0,N1=null,Error(Z(185));ta(e,n,o),(!(_e&2)||e!==Tt)&&(e===Tt&&(!(_e&2)&&(ku|=n),yt===4&&Ln(e,kt)),lr(e,o),n===1&&_e===0&&!(t.mode&1)&&(Ss=ut()+500,Nu&&ri()))}function lr(e,t){var n=e.callbackNode;KT(e,t);var o=Bl(e,e===Tt?kt:0);if(o===0)n!==null&&Mg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(n!=null&&Mg(n),t===1)e.tag===0?YR(Tp.bind(null,e)):ow(Tp.bind(null,e)),zR(function(){!(_e&6)&&ri()}),n=null;else{switch(km(o)){case 1:n=W0;break;case 4:n=Dm;break;case 16:n=kl;break;case 536870912:n=Pm;break;default:n=kl}n=iv(n,Qw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Qw(e,t){if(ml=-1,wl=0,_e&6)throw Error(Z(327));var n=e.callbackNode;if(hs()&&e.callbackNode!==n)return null;var o=Bl(e,e===Tt?kt:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=eu(e,o);else{t=o;var c=_e;_e|=2;var f=Jw();(Tt!==e||kt!==t)&&(cn=null,Ss=ut()+500,wi(e,t));do try{pb();break}catch(m){qw(e,m)}while(!0);ed(),Ql.current=f,_e=c,gt!==null?t=0:(Tt=null,kt=0,t=yt)}if(t!==0){if(t===2&&(c=i1(e),c!==0&&(o=c,t=D1(e,c))),t===1)throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;if(t===6)Ln(e,o);else{if(c=e.current.alternate,!(o&30)&&!hb(c)&&(t=eu(e,o),t===2&&(f=i1(e),f!==0&&(o=f,t=D1(e,f))),t===1))throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;switch(e.finishedWork=c,e.finishedLanes=o,t){case 0:case 1:throw Error(Z(345));case 2:di(e,ir,cn);break;case 3:if(Ln(e,o),(o&130023424)===o&&(t=pd+500-ut(),10<t)){if(Bl(e,0)!==0)break;if(c=e.suspendedLanes,(c&o)!==o){Gt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=d1(di.bind(null,e,ir,cn),t);break}di(e,ir,cn);break;case 4:if(Ln(e,o),(o&4194240)===o)break;for(t=e.eventTimes,c=-1;0<o;){var g=31-jr(o);f=1<<g,g=t[g],g>c&&(c=g),o&=~f}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*db(o/1960))-o,10<o){e.timeoutHandle=d1(di.bind(null,e,ir,cn),o);break}di(e,ir,cn);break;case 5:di(e,ir,cn);break;default:throw Error(Z(329))}}}return lr(e,ut()),e.callbackNode===n?Qw.bind(null,e):null}function D1(e,t){var n=Ao;return e.current.memoizedState.isDehydrated&&(wi(e,t).flags|=256),e=eu(e,t),e!==2&&(t=ir,ir=n,t!==null&&P1(t)),e}function P1(e){ir===null?ir=e:ir.push.apply(ir,e)}function hb(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],f=c.getSnapshot;c=c.value;try{if(!$r(f(),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 Ln(e,t){for(t&=~gd,t&=~ku,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-jr(t),o=1<<n;e[n]=-1,t&=~o}}function Tp(e){if(_e&6)throw Error(Z(327));hs();var t=Bl(e,0);if(!(t&1))return lr(e,ut()),null;var n=eu(e,t);if(e.tag!==0&&n===2){var o=i1(e);o!==0&&(t=o,n=D1(e,o))}if(n===1)throw n=Xo,wi(e,0),Ln(e,t),lr(e,ut()),n;if(n===6)throw Error(Z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,di(e,ir,cn),lr(e,ut()),null}function xd(e,t){var n=_e;_e|=1;try{return e(t)}finally{_e=n,_e===0&&(Ss=ut()+500,Nu&&ri())}}function Ti(e){Wn!==null&&Wn.tag===0&&!(_e&6)&&hs();var t=_e;_e|=1;var n=br.transition,o=Me;try{if(br.transition=null,Me=1,e)return e()}finally{Me=o,br.transition=n,_e=t,!(_e&6)&&ri()}}function md(){dr=is.current,ze(is)}function wi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,VR(n)),gt!==null)for(n=gt.return;n!==null;){var o=n;switch(Q0(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&Wl();break;case 3:Cs(),ze(or),ze($t),od();break;case 5:sd(o);break;case 4:Cs();break;case 13:ze(qe);break;case 19:ze(qe);break;case 10:td(o.type._context);break;case 22:case 23:md()}n=n.return}if(Tt=e,gt=e=Kn(e.current,null),kt=dr=t,yt=0,Xo=null,gd=ku=Ii=0,ir=Ao=null,pi!==null){for(t=0;t<pi.length;t++)if(n=pi[t],o=n.interleaved,o!==null){n.interleaved=null;var c=o.next,f=n.pending;if(f!==null){var g=f.next;f.next=c,o.next=g}n.pending=o}pi=null}return e}function qw(e,t){do{var n=gt;try{if(ed(),gl.current=Zl,Kl){for(var o=Je.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}Kl=!1}if(Si=0,It=vt=Je=null,Eo=!1,zo=0,hd.current=null,n===null||n.return===null){yt=1,Xo=t,gt=null;break}e:{var f=e,g=n.return,m=n,v=t;if(t=kt,m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){var x=v,C=m,A=C.tag;if(!(C.mode&1)&&(A===0||A===11||A===15)){var I=C.alternate;I?(C.updateQueue=I.updateQueue,C.memoizedState=I.memoizedState,C.lanes=I.lanes):(C.updateQueue=null,C.memoizedState=null)}var O=hp(g);if(O!==null){O.flags&=-257,gp(O,g,m,f,t),O.mode&1&&dp(f,x,t),t=O,v=x;var k=t.updateQueue;if(k===null){var P=new Set;P.add(v),t.updateQueue=P}else k.add(v);break e}else{if(!(t&1)){dp(f,x,t),wd();break e}v=Error(Z(426))}}else if(Ye&&m.mode&1){var G=hp(g);if(G!==null){!(G.flags&65536)&&(G.flags|=256),gp(G,g,m,f,t),q0(As(v,m));break e}}f=v=As(v,m),yt!==4&&(yt=2),Ao===null?Ao=[f]:Ao.push(f),f=g;do{switch(f.tag){case 3:f.flags|=65536,t&=-t,f.lanes|=t;var N=kw(f,v,t);op(f,N);break e;case 1:m=v;var T=f.type,_=f.stateNode;if(!(f.flags&128)&&(typeof T.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Xn===null||!Xn.has(_)))){f.flags|=65536,t&=-t,f.lanes|=t;var U=Bw(f,m,t);op(f,U);break e}}f=f.return}while(f!==null)}tv(n)}catch(z){t=z,gt===n&&n!==null&&(gt=n=n.return);continue}break}while(!0)}function Jw(){var e=Ql.current;return Ql.current=Zl,e===null?Zl:e}function wd(){(yt===0||yt===3||yt===2)&&(yt=4),Tt===null||!(Ii&268435455)&&!(ku&268435455)||Ln(Tt,kt)}function eu(e,t){var n=_e;_e|=2;var o=Jw();(Tt!==e||kt!==t)&&(cn=null,wi(e,t));do try{gb();break}catch(c){qw(e,c)}while(!0);if(ed(),_e=n,Ql.current=o,gt!==null)throw Error(Z(261));return Tt=null,kt=0,yt}function gb(){for(;gt!==null;)ev(gt)}function pb(){for(;gt!==null&&!jT();)ev(gt)}function ev(e){var t=nv(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?tv(e):gt=t,hd.current=null}function tv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lb(n,t),n!==null){n.flags&=32767,gt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{yt=6,gt=null;return}}else if(n=ab(n,t,dr),n!==null){gt=n;return}if(t=t.sibling,t!==null){gt=t;return}gt=t=e}while(t!==null);yt===0&&(yt=5)}function di(e,t,n){var o=Me,c=br.transition;try{br.transition=null,Me=1,xb(e,t,n,o)}finally{br.transition=c,Me=o}return null}function xb(e,t,n,o){do hs();while(Wn!==null);if(_e&6)throw Error(Z(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(Z(177));e.callbackNode=null,e.callbackPriority=0;var f=n.lanes|n.childLanes;if(ZT(e,f),e===Tt&&(gt=Tt=null,kt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ka||(Ka=!0,iv(kl,function(){return hs(),null})),f=(n.flags&15990)!==0,n.subtreeFlags&15990||f){f=br.transition,br.transition=null;var g=Me;Me=1;var m=_e;_e|=4,hd.current=null,cb(e,n),Kw(n,e),BR(c1),Ll=!!u1,c1=u1=null,e.current=n,fb(n),WT(),_e=m,Me=g,br.transition=f}else e.current=n;if(Ka&&(Ka=!1,Wn=e,Jl=c),f=e.pendingLanes,f===0&&(Xn=null),zT(n.stateNode),lr(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(ql)throw ql=!1,e=O1,O1=null,e;return Jl&1&&e.tag!==0&&hs(),f=e.pendingLanes,f&1?e===N1?So++:(So=0,N1=e):So=0,ri(),null}function hs(){if(Wn!==null){var e=km(Jl),t=br.transition,n=Me;try{if(br.transition=null,Me=16>e?16:e,Wn===null)var o=!1;else{if(e=Wn,Wn=null,Jl=0,_e&6)throw Error(Z(331));var c=_e;for(_e|=4,ie=e.current;ie!==null;){var f=ie,g=f.child;if(ie.flags&16){var m=f.deletions;if(m!==null){for(var v=0;v<m.length;v++){var x=m[v];for(ie=x;ie!==null;){var C=ie;switch(C.tag){case 0:case 11:case 15:Co(8,C,f)}var A=C.child;if(A!==null)A.return=C,ie=A;else for(;ie!==null;){C=ie;var I=C.sibling,O=C.return;if(Gw(C),C===x){ie=null;break}if(I!==null){I.return=O,ie=I;break}ie=O}}}var k=f.alternate;if(k!==null){var P=k.child;if(P!==null){k.child=null;do{var G=P.sibling;P.sibling=null,P=G}while(P!==null)}}ie=f}}if(f.subtreeFlags&2064&&g!==null)g.return=f,ie=g;else e:for(;ie!==null;){if(f=ie,f.flags&2048)switch(f.tag){case 0:case 11:case 15:Co(9,f,f.return)}var N=f.sibling;if(N!==null){N.return=f.return,ie=N;break e}ie=f.return}}var T=e.current;for(ie=T;ie!==null;){g=ie;var _=g.child;if(g.subtreeFlags&2064&&_!==null)_.return=g,ie=_;else e:for(g=T;ie!==null;){if(m=ie,m.flags&2048)try{switch(m.tag){case 0:case 11:case 15:Mu(9,m)}}catch(z){ot(m,m.return,z)}if(m===g){ie=null;break e}var U=m.sibling;if(U!==null){U.return=m.return,ie=U;break e}ie=m.return}}if(_e=c,ri(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Tu,e)}catch{}o=!0}return o}finally{Me=n,br.transition=t}}return!1}function Rp(e,t,n){t=As(n,t),t=kw(e,t,1),e=Gn(e,t,1),t=Gt(),e!==null&&(ta(e,1,t),lr(e,t))}function ot(e,t,n){if(e.tag===3)Rp(e,e,n);else for(;t!==null;){if(t.tag===3){Rp(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Xn===null||!Xn.has(o))){e=As(n,e),e=Bw(t,e,1),t=Gn(t,e,1),e=Gt(),t!==null&&(ta(t,1,e),lr(t,e));break}}t=t.return}}function mb(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),t=Gt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(kt&n)===n&&(yt===4||yt===3&&(kt&130023424)===kt&&500>ut()-pd?wi(e,0):gd|=n),lr(e,t)}function rv(e,t){t===0&&(e.mode&1?(t=Ua,Ua<<=1,!(Ua&130023424)&&(Ua=4194304)):t=1);var n=Gt();e=yn(e,t),e!==null&&(ta(e,t,n),lr(e,n))}function wb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rv(e,n)}function vb(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(Z(314))}o!==null&&o.delete(t),rv(e,n)}var nv;nv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||or.current)sr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return sr=!1,ob(e,t,n);sr=!!(e.flags&131072)}else sr=!1,Ye&&t.flags&1048576&&aw(t,zl,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;xl(e,t),e=t.pendingProps;var c=vs(t,$t.current);ds(t,n),c=ld(null,t,o,e,c,n);var f=ud();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,ar(o)?(f=!0,$l(t)):f=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,nd(t),c.updater=Pu,t.stateNode=c,c._reactInternals=t,v1(t,o,e,n),t=C1(null,t,o,!0,f,n)):(t.tag=0,Ye&&f&&Z0(t),Ht(null,t,c,n),t=t.child),t;case 16:o=t.elementType;e:{switch(xl(e,t),e=t.pendingProps,c=o._init,o=c(o._payload),t.type=o,c=t.tag=Eb(o),e=Br(o,e),c){case 0:t=E1(null,t,o,e,n);break e;case 1:t=mp(null,t,o,e,n);break e;case 11:t=pp(null,t,o,e,n);break e;case 14:t=xp(null,t,o,Br(o.type,e),n);break e}throw Error(Z(306,o,""))}return t;case 0:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),E1(e,t,o,c,n);case 1:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),mp(e,t,o,c,n);case 3:e:{if(jw(t),e===null)throw Error(Z(387));o=t.pendingProps,f=t.memoizedState,c=f.element,hw(e,t),Xl(t,o,null,n);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){c=As(Error(Z(423)),t),t=wp(e,t,o,n,c);break e}else if(o!==c){c=As(Error(Z(424)),t),t=wp(e,t,o,n,c);break e}else for(hr=Hn(t.stateNode.containerInfo.firstChild),gr=t,Ye=!0,Ur=null,n=fw(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ys(),o===c){t=En(e,t,n);break e}Ht(e,t,o,n)}t=t.child}return t;case 5:return gw(t),e===null&&x1(t),o=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,g=c.children,f1(o,c)?g=null:f!==null&&f1(o,f)&&(t.flags|=32),Uw(e,t),Ht(e,t,g,n),t.child;case 6:return e===null&&x1(t),null;case 13:return Ww(e,t,n);case 4:return id(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Es(t,null,o,n):Ht(e,t,o,n),t.child;case 11:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),pp(e,t,o,c,n);case 7:return Ht(e,t,t.pendingProps,n),t.child;case 8:return Ht(e,t,t.pendingProps.children,n),t.child;case 12:return Ht(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,c=t.pendingProps,f=t.memoizedProps,g=c.value,We(Hl,o._currentValue),o._currentValue=g,f!==null)if($r(f.value,g)){if(f.children===c.children&&!or.current){t=En(e,t,n);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){g=f.child;for(var v=m.firstContext;v!==null;){if(v.context===o){if(f.tag===1){v=pn(-1,n&-n),v.tag=2;var x=f.updateQueue;if(x!==null){x=x.shared;var C=x.pending;C===null?v.next=v:(v.next=C.next,C.next=v),x.pending=v}}f.lanes|=n,v=f.alternate,v!==null&&(v.lanes|=n),m1(f.return,n,t),m.lanes|=n;break}v=v.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(Z(341));g.lanes|=n,m=g.alternate,m!==null&&(m.lanes|=n),m1(g,n,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ht(e,t,c.children,n),t=t.child}return t;case 9:return c=t.type,o=t.pendingProps.children,ds(t,n),c=_r(c),o=o(c),t.flags|=1,Ht(e,t,o,n),t.child;case 14:return o=t.type,c=Br(o,t.pendingProps),c=Br(o.type,c),xp(e,t,o,c,n);case 15:return Lw(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),xl(e,t),t.tag=1,ar(o)?(e=!0,$l(t)):e=!1,ds(t,n),Mw(t,o,c),v1(t,o,c,n),C1(null,t,o,!0,e,n);case 19:return $w(e,t,n);case 22:return Fw(e,t,n)}throw Error(Z(156,t.tag))};function iv(e,t){return Nm(e,t)}function yb(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 yb(e,t,n,o)}function vd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Eb(e){if(typeof e=="function")return vd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===F0)return 11;if(e===U0)return 14}return 2}function Kn(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 vl(e,t,n,o,c,f){var g=2;if(o=e,typeof e=="function")vd(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Yi:return vi(n.children,c,f,t);case L0:g=8,c|=8;break;case Vf:return e=Rr(12,n,t,c|2),e.elementType=Vf,e.lanes=f,e;case zf:return e=Rr(13,n,t,c),e.elementType=zf,e.lanes=f,e;case Hf:return e=Rr(19,n,t,c),e.elementType=Hf,e.lanes=f,e;case gm:return Bu(n,c,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dm:g=10;break e;case hm:g=9;break e;case F0:g=11;break e;case U0:g=14;break e;case Mn:g=16,o=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=Rr(g,n,t,c),t.elementType=e,t.type=o,t.lanes=f,t}function vi(e,t,n,o){return e=Rr(7,e,o,t),e.lanes=n,e}function Bu(e,t,n,o){return e=Rr(22,e,o,t),e.elementType=gm,e.lanes=n,e.stateNode={isHidden:!1},e}function hf(e,t,n){return e=Rr(6,e,null,t),e.lanes=n,e}function gf(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 Cb(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=Xc(0),this.expirationTimes=Xc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xc(0),this.identifierPrefix=o,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function yd(e,t,n,o,c,f,g,m,v){return e=new Cb(e,t,n,m,v),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Rr(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nd(f),e}function Ab(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xi,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}function sv(e){if(!e)return Qn;e=e._reactInternals;e:{if(Oi(e)!==e||e.tag!==1)throw Error(Z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Z(171))}if(e.tag===1){var n=e.type;if(ar(n))return sw(e,n,t)}return t}function ov(e,t,n,o,c,f,g,m,v){return e=yd(n,o,!0,e,c,f,g,m,v),e.context=sv(null),n=e.current,o=Gt(),c=Yn(n),f=pn(o,c),f.callback=t??null,Gn(n,f,c),e.current.lanes=c,ta(e,c,o),lr(e,o),e}function Lu(e,t,n,o){var c=t.current,f=Gt(),g=Yn(c);return n=sv(n),t.context===null?t.context=n:t.pendingContext=n,t=pn(f,g),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=Gn(c,t,g),e!==null&&(Wr(e,c,g,f),hl(e,c,g)),g}function tu(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 bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ed(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function Sb(){return null}var av=typeof reportError=="function"?reportError:function(e){console.error(e)};function Cd(e){this._internalRoot=e}Fu.prototype.render=Cd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));Lu(e,t,null,null)};Fu.prototype.unmount=Cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ti(function(){Lu(null,e,null,null)}),t[vn]=null}};function Fu(e){this._internalRoot=e}Fu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fm();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Bn.length&&t!==0&&t<Bn[n].priority;n++);Bn.splice(n,0,e),n===0&&jm(e)}};function Ad(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Uu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _p(){}function Ib(e,t,n,o,c){if(c){if(typeof o=="function"){var f=o;o=function(){var x=tu(g);f.call(x)}}var g=ov(t,o,e,0,null,!1,!1,"",_p);return e._reactRootContainer=g,e[vn]=g.current,Uo(e.nodeType===8?e.parentNode:e),Ti(),g}for(;c=e.lastChild;)e.removeChild(c);if(typeof o=="function"){var m=o;o=function(){var x=tu(v);m.call(x)}}var v=yd(e,0,!1,null,null,!1,!1,"",_p);return e._reactRootContainer=v,e[vn]=v.current,Uo(e.nodeType===8?e.parentNode:e),Ti(function(){Lu(t,v,n,o)}),v}function ju(e,t,n,o,c){var f=n._reactRootContainer;if(f){var g=f;if(typeof c=="function"){var m=c;c=function(){var v=tu(g);m.call(v)}}Lu(t,g,e,c)}else g=Ib(n,t,e,c,o);return tu(g)}Bm=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=uo(t.pendingLanes);n!==0&&($0(t,n|1),lr(t,ut()),!(_e&6)&&(Ss=ut()+500,ri()))}break;case 13:Ti(function(){var o=yn(e,1);if(o!==null){var c=Gt();Wr(o,e,1,c)}}),Ed(e,1)}};V0=function(e){if(e.tag===13){var t=yn(e,134217728);if(t!==null){var n=Gt();Wr(t,e,134217728,n)}Ed(e,134217728)}};Lm=function(e){if(e.tag===13){var t=Yn(e),n=yn(e,t);if(n!==null){var o=Gt();Wr(n,e,t,o)}Ed(e,t)}};Fm=function(){return Me};Um=function(e,t){var n=Me;try{return Me=e,t()}finally{Me=n}};t1=function(e,t,n){switch(t){case"input":if(Yf(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=Ou(o);if(!c)throw Error(Z(90));xm(o),Yf(o,c)}}}break;case"textarea":wm(e,n);break;case"select":t=n.value,t!=null&&ls(e,!!n.multiple,t,!1)}};Im=xd;Tm=Ti;var Tb={usingClientEntryPoint:!1,Events:[na,qi,Ou,Am,Sm,xd]},no={findFiberByHostInstance:gi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Rb={bundleType:no.bundleType,version:no.version,rendererPackageName:no.rendererPackageName,rendererConfig:no.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=_m(e),e===null?null:e.stateNode},findFiberByHostInstance:no.findFiberByHostInstance||Sb,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 Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{Tu=Za.inject(Rb),nn=Za}catch{}}wr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tb;wr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ad(t))throw Error(Z(200));return Ab(e,t,null,n)};wr.createRoot=function(e,t){if(!Ad(e))throw Error(Z(299));var n=!1,o="",c=av;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=yd(e,1,!1,null,null,n,!1,o,c),e[vn]=t.current,Uo(e.nodeType===8?e.parentNode:e),new Cd(t)};wr.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(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=_m(t),e=e===null?null:e.stateNode,e};wr.flushSync=function(e){return Ti(e)};wr.hydrate=function(e,t,n){if(!Uu(t))throw Error(Z(200));return ju(null,e,t,!0,n)};wr.hydrateRoot=function(e,t,n){if(!Ad(e))throw Error(Z(405));var o=n!=null&&n.hydratedSources||null,c=!1,f="",g=av;if(n!=null&&(n.unstable_strictMode===!0&&(c=!0),n.identifierPrefix!==void 0&&(f=n.identifierPrefix),n.onRecoverableError!==void 0&&(g=n.onRecoverableError)),t=ov(t,null,e,1,n??null,c,!1,f,g),e[vn]=t.current,Uo(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 Fu(t)};wr.render=function(e,t,n){if(!Uu(t))throw Error(Z(200));return ju(null,e,t,!1,n)};wr.unmountComponentAtNode=function(e){if(!Uu(e))throw Error(Z(40));return e._reactRootContainer?(Ti(function(){ju(null,null,e,!1,function(){e._reactRootContainer=null,e[vn]=null})}),!0):!1};wr.unstable_batchedUpdates=xd;wr.unstable_renderSubtreeIntoContainer=function(e,t,n,o){if(!Uu(n))throw Error(Z(200));if(e==null||e._reactInternals===void 0)throw Error(Z(38));return ju(e,t,n,!1,o)};wr.version="18.3.1-next-f1338f8080-20240426";function lv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lv)}catch(e){console.error(e)}}lv(),lm.exports=wr;var uv=lm.exports;function bb({message:e,showGuidance:t,windows:n,onClose:o}){const c=ht.useRef(null);return ht.useEffect(()=>{var f;(f=c.current)==null||f.showModal()},[]),uv.createPortal(ee.jsx("dialog",{ref:c,"aria-label":"远程桌面提醒",onCancel:o,onClick:f=>{f.target===f.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:ee.jsxs("div",{style:{padding:20},children:[ee.jsx("strong",{children:"远程桌面提醒"}),ee.jsx("p",{children:e}),t&&ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),ee.jsx("p",{children:n?"在 Windows 电脑上点击“开启共享”,并保持用户已登录、桌面未锁定。完成后此处会自动更新。":"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),ee.jsx("button",{type:"button",className:"ui-quiet-button",onClick:o,autoFocus:!0,children:"知道了"})]})}),document.body)}function _b(){const[e,t]=ht.useState(null),[n,o]=ht.useState(!1),[c,f]=ht.useState(!1),[g,m]=ht.useState(""),v=["127.0.0.1","localhost","[::1]"].includes(location.hostname),x=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);ht.useEffect(()=>{let I=!0;const O=async()=>{try{const P=await fetch(x&&v?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!P.ok)return;const G=await P.json();I&&t(G)}catch{}};O();const k=setInterval(O,2e3);return()=>{I=!1,clearInterval(k)}},[x,v]);const C=(e==null?void 0:e.platform)==="win32";if(!x){if(!e||e.online&&e.accessibility)return null;const I=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 ee.jsxs("div",{className:"remote-desktop-guidance",children:[ee.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:ee.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ee.jsx("circle",{cx:"12",cy:"12",r:"9"}),ee.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),n&&ee.jsx(bb,{windows:C,message:I,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>o(!1)})]})}if(!v)return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.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:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.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:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开终端显示的本机地址,完成配对并开启桌面共享。"}),ee.jsxs("p",{children:["在电脑终端运行 ",ee.jsx("code",{children:"agentroam service status"})," 查看本机地址。"]}),ee.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const A=async(I,O)=>{f(!0),m("");try{const k=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:I,permission:O})}),P=await k.json();if(!k.ok)throw new Error(P.error||"操作失败");t(P)}catch(k){m(k instanceof Error?k.message:"操作失败")}finally{f(!1)}};return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.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:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.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:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:C?"开启后,已配对设备可查看桌面;接管后可使用鼠标和键盘。":"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.supported?e.installed?ee.jsxs(ee.Fragment,{children:[!C&&["screen","accessibility"].map(I=>ee.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[ee.jsxs("span",{children:[I==="screen"?"屏幕录制":"辅助功能",":",e[I]?"已授权":"待授权"]}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("authorize",I),children:"去授权"})]},I)),ee.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("recheck"),children:"重新检测"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("restart"),children:"重启授权组件"})]}),C&&ee.jsxs("p",{style:{fontSize:12,lineHeight:1.6},children:["远程解锁服务:",e.unlock==="available"?"已安装,可在锁屏后远程唤醒和解锁。":"未安装;在 Windows 终端运行 agentroam unlock-service install 后可启用。"]}),ee.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待桌面可用或首帧画面…":"尚未开启共享。"}),ee.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:C?"Windows 锁屏后直播入口会保留,可唤醒屏幕或远程解锁;UAC 安全桌面和未登录状态仍不支持控制。":"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):ee.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):ee.jsx("p",{children:"目前支持 Windows 10/11 x64 和 macOS 14 及以上的 Apple Silicon 电脑。"}),(g||e.error)&&ee.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:g||e.error})]})]})}var cv,Op=uv;cv=Op.createRoot,Op.hydrateRoot;class Ob extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class Nb extends Error{constructor(t,n,o){super(n),this.status=t,this.code=o,this.name="ApiError"}}class Db{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})}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)})}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)})}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)})}async delete(t,n){return this.request(t,{method:"DELETE",headers:n==null?void 0:n.headers})}async request(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 Ob;if(!o.ok){let f=`请求失败 (${o.status})`,g;try{const m=await o.json();typeof m.error=="string"?f=m.error:(c=m.error)!=null&&c.message&&(f=m.error.message),typeof m.code=="string"&&(g=m.code)}catch{}throw new Nb(o.status,f,g)}if(o.status!==204)return await o.json()}}const Pb=30,Mb=20,kb=2e3;function Np(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 Bb(e={}){const t=e.source??"webapp",n=()=>((typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl)??"").replace(/\/+$/,""),o=[];let c=null,f=!1,g=!1;const m=()=>{if(g||f||o.length===0)return;const I=o.splice(0,Mb);f=!0;const O=JSON.stringify({entries:I});fetch(`${n()}/api/client-logs`,{method:"POST",headers:{"content-type":"application/json"},body:O,keepalive:!0}).catch(()=>{}).finally(()=>{f=!1,o.length>0&&v()})},v=()=>{c!==null||g||(c=setTimeout(()=>{c=null,m()},kb))},x=I=>{g||(o.length>=Pb&&o.shift(),o.push(I),v())},C=I=>{var O;x({level:"error",message:I.message||"window error",source:t,error:{name:"Error",message:I.message||"window error",stack:[I.filename?`${I.filename}:${I.lineno}:${I.colno}`:"",((O=I.error)==null?void 0:O.stack)??""].filter(Boolean).join(`
|
|
58
|
+
`).slice(0,8e3)||void 0},data:{filename:I.filename,lineno:I.lineno,colno:I.colno}})},A=I=>{const O=Np(I.reason);x({level:"error",message:`unhandledRejection: ${O.message}`,source:t,error:O})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",A),{reportError:(I,O)=>{const k=Np(I);x({level:"error",message:k.message,source:t,error:k,data:O})},reportWarning:(I,O)=>{x({level:"warn",message:I,source:t,data:O})},uninstall:()=>{g=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",A)}}}const pf="<think>",xf="</think>";function Dp(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 io(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class Lb{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(xf);if(c===-1){const f=Dp(this.buffer,xf);return this.buffer=this.buffer.slice(this.buffer.length-f),n}this.buffer=this.buffer.slice(c+xf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(pf);if(o===-1){const c=Dp(this.buffer,pf);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+pf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const Fb=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,Ub=50,jb=1e3,Wb=2e3;function Pp(e){return e instanceof Error&&e.name!=="AbortError"&&Fb.test(e.message.trim())}class $b{constructor(t,n,o,c=f=>new EventSource(f)){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,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}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,f,g){var O,k;const m=n.startsWith("runtime:"),v=this.streams.has(n),x=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);m&&!x&&this.beginNativeRunRecovery(n,void 0,!0);let A=null,I=null;try{m||await this.openStream(n,this.nativeStreamCursors.get(n)),I=x?null:new Promise(G=>{A=G,this.pendingRuns.set(n,G)}),m||this.ordinaryRunStreamText.set(n,"");const P=await this.http.post("/api/agent/run",{input:t,sessionId:n,...f!=null&&f.length?{images:f}:{},...o!=null&&o.length?{agentIds:o}:{},...!m&&(g!=null&&g.profileId)?{profileId:g.profileId}:{},...(O=g==null?void 0:g.model)!=null&&O.id?{nativeModel:g.model}:{},...g!=null&&g.reasoningEffort?{nativeReasoningEffort:g.reasoningEffort}:{}});if(m||this.startOrdinaryRunRecovery(n),m){const G=this.nativeRunRecoveries.get(n);G&&(G.awaitingAdmission=!1,G.runId=typeof P.runId=="string"?P.runId:void 0);const N=typeof P.runId=="string"&&(C==null?void 0:C.runId)!==P.runId?{sequence:0,runId:P.runId}:C??{sequence:0,...typeof P.runId=="string"?{runId:P.runId}:{}};await this.openStream(n,N,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof P.runId=="string"?{_nativeRunId:P.runId}:{}}),I&&await I}catch(P){const G=!x&&m&&Pp(P)?await this.recoverNativeAdmission(n,C):null;if(G){const U=this.nativeRunRecoveries.get(n);return U&&(U.awaitingAdmission=!1,U.runId=G.runId),await this.openStream(n,G,{waitForOpen:!1}),I&&await I,[]}const N=P.code,T=typeof N=="string"?N:P.status===409?"SESSION_OCCUPIED":void 0;m&&T==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const _=v||x||T==="SESSION_ALREADY_RUNNING";if(m&&_){const U=this.nativeRunRecoveries.get(n);U&&(U.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:Pp(P)?"网络连接中断,消息未确认发送,请重试":P instanceof Error?P.message:"无法启动运行",...T?{code:T}:{},..._?{_preserveActiveRun:!0}:{}}),_?A&&this.pendingRuns.get(n)===A&&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`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,g=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,m=!!(f&&(n!=null&&n.runId)&&f!==n.runId),v=!!(f&&!(n!=null&&n.runId)&&c.status==="running");return!m&&!v?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:g}),{runId:f,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||this.run(t,n).catch(()=>{}),!0}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){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const n of[...this.pendingRuns.keys()])this.settle(n);for(const n of[...this.streams.keys()])this.closeStream(n);for(const n of[...this.nativeRunRecoveries.keys()])this.stopNativeRunRecovery(n)}}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 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){var f;const o=this.nativeRunRecoveries.get(t),c=o==null?void 0:o.runId;try{const g=new URLSearchParams;n!=null&&n.before&&g.set("before",n.before),n!=null&&n.after&&g.set("after",n.after),n!=null&&n.anchor&&g.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&g.set("limit",String(n.limit)),n!=null&&n.view&&g.set("view",n.view),n!=null&&n.revision&&g.set("revision",n.revision),n!=null&&n.turnId&&g.set("turnId",n.turnId);const m=g.size>0?`?${g.toString()}`:"",v=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${m}`);Array.isArray(v.messages)&&(v.messages=v.messages.map(C=>typeof C.content=="string"?{...C,content:io(C.content)}:C)),Array.isArray(v.events)&&(v.events=v.events.map(C=>typeof C.text=="string"&&C.text.includes("<think>")?{...C,text:io(C.text)}:typeof C.finalText=="string"&&C.finalText.includes("<think>")?{...C,finalText:io(C.finalText)}:C));const x=o===this.nativeRunRecoveries.get(t)&&c===(o==null?void 0:o.runId);if(t.startsWith("runtime:")&&x&&typeof v.snapshotRevision=="number"){const C=typeof v.snapshotRunId=="string"?v.snapshotRunId:void 0;if(C&&((f=this.nativeRunIdentities.get(t))!=null&&f.retired.has(C)))return v;const A=v.history,I=(A==null?void 0:A.delivery)==="core"||(A==null?void 0:A.delivery)==="trace";if((A==null?void 0:A.delivery)==="core"&&C&&this.coreSnapshotContainsTailFinalAnswer(v.messages)&&this.rememberNativeFinalAnswerSnapshot(t,v.snapshotRevision,C),I||this.rememberNativeStreamCursor(t,v.snapshotRevision,C),v.status==="running"&&v.occupancy!=="owned-externally"){const O=this.nativeStreamCursors.get(t),k=I&&C&&(O==null?void 0:O.runId)!==C?{sequence:0,runId:C}:O??(I?{sequence:0,...C?{runId:C}:{}}:void 0);this.openStream(t,k).catch(()=>{})}o&&!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace"&&await this.reconcileNativeRun(t,o,c,v)}else if(!t.startsWith("runtime:")&&v.status==="active"){const C=v.activeRun;(C==null?void 0:C.running)===!0&&typeof C.eventId=="number"&&this.openStream(t,{sequence:C.eventId}).catch(()=>{})}return v}catch(g){if(g.status===404)return null;throw g}}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 f=!1;return c.onmessage=g=>{if(g.data)try{const m=JSON.parse(g.data);m.type==="session_history_changed"&&typeof m.revision=="number"&&n({type:m.type,revision:m.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),o==null||o())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode: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 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 f;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((f=c.started)==null?void 0:f.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}});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){return this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}})}async forkSession(t,n){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/${n?"fork-at":"fork"}`,n?{point:n}:{})}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 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=(f,g)=>{try{return JSON.parse(localStorage.getItem(f)||"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}}async ttsSpeak(){return{ok:!1}}async ttsStop(){return{ok:!0}}async ttsPlaybackEnded(){return{ok:!0}}onTtsStart(){return()=>{}}onTtsPcm(){return()=>{}}onTtsStreamEnd(){return()=>{}}onTtsFlush(){return()=>{}}onTtsEnd(){return()=>{}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}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),Ub);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 f=this.nativeRunIdentities.get(t);if(f!=null&&f.retired.has(n))return;f&&f.current!==n?(f.retired.add(f.current),f.current=n):f||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)},Wb)}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"})}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 f=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 P=this.nativeRunRecoveries.get(t);if(!P||P.runId!==c.snapshotRunId)return;f=P,g=c.snapshotRunId}let m=Array.isArray(c.events)?c.events:[],v=c.status,x=[...m].reverse().find(P=>P.type==="done"||P.type==="error"||P.type==="turn_aborted");if(!x&&typeof c.snapshotRunId=="string")try{const P=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`);if(P.snapshotRunId!==c.snapshotRunId||!["idle","completed","failed","aborted"].includes(String(P.status)))return;v=P.status,m=Array.isArray(P.events)?P.events:[],x=[...m].reverse().find(G=>G.type==="done"||G.type==="error"||G.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==f||f.runId!==g||f.awaitingAdmission)return;const C=(x==null?void 0:x.type)??(v==="failed"?"error":v==="aborted"?"turn_aborted":"done"),{_nativeSequence:A,_nativeRunId:I,...O}=x??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...O,type:C,...C==="error"?{message:(x==null?void 0:x.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(x==null?void 0:x.durationMs)===void 0?{}:{durationMs:x.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)},jb);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??[],f=c.map(x=>x.role).lastIndexOf("user"),g=io(c.slice(f+1).filter(x=>x.role==="assistant"&&(x.content??"").trim()).map(x=>x.content.trim()).join(`
|
|
59
59
|
|
|
60
|
-
`)),m=this.ordinaryRunStreamText.get(t)??"",v=g.startsWith(m)?g.slice(m.length):g;if(v&&this.dispatch(t,{type:"text_chunk",text:v}),o.status==="completed")this.dispatch(t,{type:"done",finalText:""});else{const x=(n=[...o.events??[]].reverse().find(C=>{var A;return C.type==="error"&&((A=C.message)==null?void 0:A.trim())}))==null?void 0:n.message;this.dispatch(t,{type:"error",message:x||(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 Lb);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 f=this.createEventSource(`/api/agent/stream?${c.toString()}`);let g=!1;this.streams.set(t,f);const m=o.waitForOpen!==!1;let v=m,x=null,C=null,A=null;const I=m?new Promise((O,k)=>{C=O,A=k,x=setTimeout(()=>{v=!1,k(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return f.onopen=()=>{v&&(v=!1,x&&clearTimeout(x),C==null||C())},f.onmessage=O=>{var
|
|
60
|
+
`)),m=this.ordinaryRunStreamText.get(t)??"",v=g.startsWith(m)?g.slice(m.length):g;if(v&&this.dispatch(t,{type:"text_chunk",text:v}),o.status==="completed")this.dispatch(t,{type:"done",finalText:""});else{const x=(n=[...o.events??[]].reverse().find(C=>{var A;return C.type==="error"&&((A=C.message)==null?void 0:A.trim())}))==null?void 0:n.message;this.dispatch(t,{type:"error",message:x||(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 Lb);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 f=this.createEventSource(`/api/agent/stream?${c.toString()}`);let g=!1;this.streams.set(t,f);const m=o.waitForOpen!==!1;let v=m,x=null,C=null,A=null;const I=m?new Promise((O,k)=>{C=O,A=k,x=setTimeout(()=>{v=!1,k(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return f.onopen=()=>{v&&(v=!1,x&&clearTimeout(x),C==null||C())},f.onmessage=O=>{var P,G;if(this.streams.get(t)!==f||!O.data)return;let k;try{k=JSON.parse(O.data)}catch{return}if(typeof k._nativeSequence=="number"){const N=typeof k._nativeRunId=="string"?k._nativeRunId:void 0,T=this.nativeRunRecoveries.get(t),_=k.type==="done"||k.type==="error"||k.type==="turn_aborted";if(N&&((P=this.nativeRunIdentities.get(t))!=null&&P.retired.has(N))||N&&(T!=null&&T.runId)&&T.runId!==N&&this.pendingRuns.has(t)||_&&N&&(T!=null&&T.runId)&&T.runId!==N||!this.acceptNativeStreamEvent(t,k._nativeSequence,N)||_&&(T!=null&&T.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)))},f.onerror=()=>{if(this.streams.get(t)===f){if(t.startsWith("runtime:")){const O=this.nativeRunRecoveries.get(t);f.readyState===EventSource.CLOSED&&(v&&(v=!1,x&&clearTimeout(x),A==null||A(new Error("事件流连接失败"))),this.closeStream(t)),O&&this.recoverNativeRun(t,O);return}if(v&&f.readyState===EventSource.CLOSED){v=!1,x&&clearTimeout(x),A==null||A(new Error("事件流连接失败"));return}if(f.readyState===EventSource.CLOSED){if(this.closeStream(t),g){this.settle(t);return}(async()=>{let O="";for(let k=0;k<8&&!O;k++){k>0&&await new Promise(P=>setTimeout(P,750));try{const P=await this.getSession(t,{limit:50}),G=(P==null?void 0:P.messages)??[],N=G.map(_=>_.role).lastIndexOf("user"),T=G.slice(N+1).filter(_=>_.role==="assistant"&&(_.content??"").trim()).map(_=>_.content.trim()).join(`
|
|
61
61
|
|
|
62
|
-
`);O=io(T).trim()}catch{}}O?this.dispatch(t,{type:"text_chunk",text:O}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}}},I}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)}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 f;if(typeof o!="object"||o===null)return!1;const c=o;return c.role==="assistant"&&((f=c.presentation)==null?void 0:f.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 f=this.nativeFinalAnswerSnapshots.get(t);return!f||!c?!1:n.type==="text_chunk"&&n.messagePhase==="final_answer"&&f.runId===c&&o<=f.sequence}closeStream(t){this.flushBufferedStreamText(t);const n=this.streams.get(t);n&&(n.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}const Qa="webapp.settings.v1";class Vb{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(Qa)??"{}")}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(Qa,JSON.stringify(this.cached))}setActiveProfile(t){const n=this.get();this.cached={...n,activeProfileId:t},localStorage.setItem(Qa,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const n=this.get(),o=n.profiles.find(m=>m.id==="server-managed");if(!o||o.apiKey!=="managed"||o.modelId===t.modelId&&o.provider===(t.provider||"openai"))return;const c=t.modelId,f=t.provider||"openai",g=t.baseUrl||"";this.cached={...n,profiles:n.profiles.map(m=>m.id==="server-managed"?{...m,name:`服务端 · ${c}`,provider:f,modelId:c,baseUrl:g}:m),modelProvider:f,modelId:c,baseUrl:g||n.baseUrl},localStorage.setItem(Qa,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),n=t.profiles.find(m=>m.id===t.activeProfileId)??null,o=(n==null?void 0:n.provider)??t.modelProvider,c=(n==null?void 0:n.apiKey)??t.apiKey,f=(n==null?void 0:n.modelId)??t.modelId,g=(n==null?void 0:n.baseUrl)??t.baseUrl;return!c||c==="managed"||!f||f==="server"?null:{provider:o,apiKey:c,modelId:f,...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 zb(e){return e.toString(16).padStart(2,"0")}function Hb(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,zb);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 Gb(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>Hb(e)})}const xf="agent-webapp:tab-swipe:v1",Xb=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(","),Pp=24;function Yb(e){return!e||typeof e.closest!="function"?!1:!!e.closest(Xb)}function Kb(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<=Pp||o.clientX>=o.viewportWidth-Pp)||(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,f=o.clientY-t.startY;if(t.axis==="pending"){if(Math.max(Math.abs(c),Math.abs(f))<=8)return!1;if(Math.abs(f)>=Math.abs(c)*1.2)return t=null,!1;t.axis="horizontal"}return e({type:xf,phase:"move",deltaX:c}),!0},pointerUp(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:xf,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:xf,phase:"cancel",deltaX:0}),t=null,c}}}function Zb(){if(window.parent===window)return()=>{};const e=Kb(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:Yb(g.target)})},o=g=>{e.pointerMove(t(g))&&g.preventDefault()},c=g=>{e.pointerUp(t(g))&&g.preventDefault()},f=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",f,{capture:!0}),()=>{document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",o,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",f,{capture:!0})}}const Qb="agent-web-shell:skin:v1",qb=["pearl","scifi","noir"];function Jb(){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!==Qb||typeof n.skin!="string"||!qb.includes(n.skin)||Ol.getState().setSkin(n.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const e_="agentroam:open-browser-live",t_="agent-web-shell:open-browser-live:v1";function r_(){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!==t_||window.dispatchEvent(new CustomEvent(e_))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const n_="agent-webapp:ready:v1";function i_(){window.parent!==window&&window.parent.postMessage({type:n_},window.location.origin)}const s_="agent-webapp:project-request:v1",o_="agent-web-shell:project-response:v1",a_=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"];new Set(a_);function l_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==o_||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class u_{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=l_(o.data);if(!c)return;const f=this.pending.get(c.id);f&&(this.pending.delete(c.id),clearTimeout(f.timer),c.ok?f.resolve(c.result):f.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,f)=>{const g=setTimeout(()=>{this.pending.delete(o),f(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:f,timer:g}),this.context.parent.postMessage({type:s_,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 c_="agent-webapp:browser-request:v1",f_="agent-web-shell:browser-response:v1",d_="agent-web-shell:browser-event:v1",h_="agent-web-shell:browser-frame:v1",g_=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc","browser:system"];new Set(g_);function p_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==f_||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function x_(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==d_||!t.event||typeof t.event!="object")return null;const n=t.event;return typeof n.type!="string"||!n.type.startsWith("browser:")?null:t}function m_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==h_||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class w_{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 v;if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=m_(o.data);if(c){const x=this.sessionsByChannel.get(c.channelId);if(!x){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,x);return}const f=x_(o.data);if(f){if(f.event.type==="browser:connection"){this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear();for(const x of this.pending.values())clearTimeout(x.timer),x.reject(Object.assign(new Error("远程连接已变化,请重新接管"),{code:"EOFFLINE"}));this.pending.clear()}for(const x of this.listeners)x(f.event);return}const g=p_(o.data);if(!g)return;const m=this.pending.get(g.id);if(m)if(this.pending.delete(g.id),clearTimeout(m.timer),g.ok){if(m.method==="browser:watch"&&g.result&&typeof g.result=="object"){const x=g.result;if(Number.isSafeInteger(x.channelId)&&typeof((v=x.session)==null?void 0:v.id)=="string"){const C=Number(x.channelId);this.sessionsByChannel.set(C,x.session.id);const A=this.pendingFramesByChannel.get(C);A&&(this.pendingFramesByChannel.delete(C),this.emitBinaryFrame(A,x.session.id))}}m.resolve(g.result)}else m.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,f)=>{const g=setTimeout(()=>{this.pending.delete(o),f(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:f,timer:g,method:t}),this.context.parent.postMessage({type:c_,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 qn{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 qn(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class v_{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=qn.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?qn.parse(t):null}}function kp(){return window.Capacitor??null}class y_{isNativeApp(){var t,n;return((n=(t=kp())==null?void 0:t.isNativePlatform)==null?void 0:n.call(t))??!1}platform(){var n,o;const t=(o=(n=kp())==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 mf="webapp.mobile.serverEndpoint.v1";class Bp{load(){try{const t=localStorage.getItem(mf);return t?qn.parse(t):null}catch{return null}}save(t){localStorage.setItem(mf,t.toString())}clear(){localStorage.removeItem(mf)}}const E_=6e3;class C_{constructor(t=(...n)=>fetch(...n)){this.transport=t}async probe(t,n=E_){const o=new AbortController,c=setTimeout(()=>o.abort(),n);try{const f=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:o.signal});return f.ok?{ok:!0,modelId:(await f.json()).modelId??null}:{ok:!1,reason:f.status===401?"此 App 尚未授权,请扫描电脑上的授权二维码。":f.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":`HTTP ${f.status}`}}catch(f){return{ok:!1,reason:f instanceof DOMException&&f.name==="AbortError"?"连接超时":A_(f)}}finally{clearTimeout(c)}}}function A_(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function S_({service:e,savedEndpoint:t,initialFailure:n,onConnected:o,onScan:c}){const[f,g]=ht.useState((t==null?void 0:t.toString())??""),[m,v]=ht.useState(n??""),[x,C]=ht.useState(!1);async function A(){if(!(x||!c)){C(!0),v("");try{const O=await c();O&&o(O)}catch(O){v(O instanceof Error?O.message:"扫码连接失败,请重试。")}finally{C(!1)}}}async function I(){if(!x){C(!0),v("");try{const O=await e.connect(f);O.ok?o(O.endpoint):v(O.reason)}catch{v("连接失败,请检查网络或重新扫码授权。")}finally{C(!1)}}}return ee.jsx("div",{style:en.page,children:ee.jsxs("div",{style:en.card,children:[ee.jsx("div",{style:en.icon,children:"🛰️"}),ee.jsx("h1",{style:en.title,children:"连接服务器"}),c?ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{style:en.hint,children:"扫描电脑终端上的授权二维码,直接连接,无需再次确认。"}),ee.jsx("button",{type:"button",style:{...en.button,marginBottom:20},disabled:x,onClick:()=>void A(),children:x?"正在连接…":"扫码连接"})]}):null,ee.jsx("p",{style:en.hint,children:"也可以输入已授权的服务器地址。使用局域网地址时,手机与电脑需在同一网络。"}),ee.jsx("input",{style:en.input,value:f,inputMode:"url",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,placeholder:"http://192.168.1.10:3000",onChange:O=>g(O.target.value),onKeyDown:O=>{O.key==="Enter"&&I()}}),m?ee.jsx("p",{style:en.error,children:m}):null,ee.jsx("button",{style:{...en.button,opacity:x||!f.trim()?.6:1},disabled:x,onClick:()=>void I(),children:x?"正在连接…":"连接"})]})})}const en={page:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",background:"#f5f6fa",padding:24,boxSizing:"border-box"},card:{width:"100%",maxWidth:420,background:"#fff",borderRadius:16,padding:"32px 24px",boxShadow:"0 8px 32px rgba(0,0,0,0.08)",textAlign:"center"},icon:{fontSize:40,marginBottom:8},title:{fontSize:20,margin:"0 0 8px",color:"#1c1e26"},hint:{fontSize:13,lineHeight:1.6,color:"#6b7280",margin:"0 0 20px"},input:{width:"100%",boxSizing:"border-box",padding:"12px 14px",fontSize:16,borderRadius:10,border:"1px solid #d6d9e0",outline:"none",marginBottom:12},error:{fontSize:13,color:"#dc2626",margin:"0 0 12px",textAlign:"left"},button:{width:"100%",padding:"12px 0",fontSize:16,fontWeight:600,color:"#fff",background:"#4f6ef7",border:"none",borderRadius:10,cursor:"pointer"}};/*! Capacitor: https://capacitorjs.com/ - MIT License */var Is;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Is||(Is={}));class wf extends Error{constructor(t,n,o){super(t),this.message=t,this.code=n,this.data=o}}const I_=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"},T_=e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},o=n.Plugins=n.Plugins||{},c=()=>t!==null?t.name:I_(e),f=()=>c()!=="web",g=A=>{const I=x.get(A);return!!(I!=null&&I.platforms.has(c())||m(A))},m=A=>{var I;return(I=n.PluginHeaders)===null||I===void 0?void 0:I.find(O=>O.name===A)},v=A=>e.console.error(A),x=new Map,C=(A,I={})=>{const O=x.get(A);if(O)return console.warn(`Capacitor plugin "${A}" already registered. Cannot register plugins twice.`),O.proxy;const k=c(),M=m(A);let G;const N=async()=>(!G&&k in I?G=typeof I[k]=="function"?G=await I[k]():G=I[k]:t!==null&&!G&&"web"in I&&(G=typeof I.web=="function"?G=await I.web():G=I.web),G),T=(X,V)=>{var oe,ye;if(M){const se=M==null?void 0:M.methods.find(ge=>V===ge.name);if(se)return se.rtype==="promise"?ge=>n.nativePromise(A,V.toString(),ge):(ge,Te)=>n.nativeCallback(A,V.toString(),ge,Te);if(X)return(oe=X[V])===null||oe===void 0?void 0:oe.bind(X)}else{if(X)return(ye=X[V])===null||ye===void 0?void 0:ye.bind(X);throw new wf(`"${A}" plugin is not implemented on ${k}`,Is.Unimplemented)}},_=X=>{let V;const oe=(...ye)=>{const se=N().then(ge=>{const Te=T(ge,X);if(Te){const H=Te(...ye);return V=H==null?void 0:H.remove,H}else throw new wf(`"${A}.${X}()" is not implemented on ${k}`,Is.Unimplemented)});return X==="addListener"&&(se.remove=async()=>V()),se};return oe.toString=()=>`${X.toString()}() { [capacitor code] }`,Object.defineProperty(oe,"name",{value:X,writable:!1,configurable:!1}),oe},U=_("addListener"),z=_("removeListener"),j=(X,V)=>{const oe=U({eventName:X},V),ye=async()=>{const ge=await oe;z({eventName:X,callbackId:ge},V)},se=new Promise(ge=>oe.then(()=>ge({remove:ye})));return se.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ye()},se},B=new Proxy({},{get(X,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?j:U;case"removeListener":return z;default:return _(V)}}});return o[A]=B,x.set(A,{name:A,proxy:B,platforms:new Set([...Object.keys(I),...M?[k]:[]])}),B};return n.convertFileSrc||(n.convertFileSrc=A=>A),n.getPlatform=c,n.handleError=v,n.isNativePlatform=f,n.isPluginAvailable=g,n.registerPlugin=C,n.Exception=wf,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},R_=e=>e.Capacitor=T_(e),Ts=R_(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),sa=Ts.registerPlugin;class fv{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 f=this.windowListeners[t];f&&!f.registered&&this.addWindowListener(f),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 f=this.retainedEventArguments[t];f||(f=[]),f.push(n),this.retainedEventArguments[t]=f}return}c.forEach(f=>f(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 Ts.Exception(t,Is.Unimplemented)}unavailable(t="not available"){return new Ts.Exception(t,Is.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 Lp=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Fp=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class b_ extends fv{async getCookies(){const t=document.cookie,n={};return t.split(";").forEach(o=>{if(o.length<=0)return;let[c,f]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=Fp(c).trim(),f=Fp(f).trim(),n[c]=f}),n}async setCookie(t){try{const n=Lp(t.key),o=Lp(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",f=(t.path||"/").replace("path=",""),g=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${n}=${o||""}${c}; path=${f}; ${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)}}}sa("CapacitorCookies",{web:()=>new b_});const __=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)}),O_=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,f,g)=>(c[f]=e[t[g]],c),{})},N_=(e,t=!0)=>e?Object.entries(e).reduce((o,c)=>{const[f,g]=c;let m,v;return Array.isArray(g)?(v="",g.forEach(x=>{m=t?encodeURIComponent(x):x,v+=`${f}=${m}&`}),v.slice(0,-1)):(m=t?encodeURIComponent(g):g,v=`${f}=${m}`),`${o}&${v}`},"").substr(1):null,D_=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),c=O_(e.headers)["content-type"]||"";if(typeof e.data=="string")n.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const f=new URLSearchParams;for(const[g,m]of Object.entries(e.data||{}))f.set(g,m);n.body=f.toString()}else if(c.includes("multipart/form-data")||e.data instanceof FormData){const f=new FormData;if(e.data instanceof FormData)e.data.forEach((m,v)=>{f.append(v,m)});else for(const m of Object.keys(e.data))f.append(m,e.data[m]);n.body=f;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 M_ extends fv{async request(t){const n=D_(t,t.webFetchExtra),o=N_(t.params,t.shouldEncodeUrlParams),c=o?`${t.url}?${o}`:t.url,f=await fetch(c,n),g=f.headers.get("content-type")||"";let{responseType:m="text"}=f.ok?t:{};g.includes("application/json")&&(m="json");let v,x;switch(m){case"arraybuffer":case"blob":x=await f.blob(),v=await __(x);break;case"json":v=await f.json();break;case"document":case"text":default:v=await f.text()}const C={};return f.headers.forEach((A,I)=>{C[I]=A}),{data:v,headers:C,status:f.status,url:f.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"}))}}sa("CapacitorHttp",{web:()=>new M_});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 Up=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"]]),jp;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(jp||(jp={}));function P_(e){return Object.values(re).includes(e)}var tu;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(tu||(tu={}));var k_=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=[tu.SCAN_TYPE_CAMERA,tu.SCAN_TYPE_FILE],e}(),dv=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Up.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Up.get(t))},e}(),Wp=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}(),M1;(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"})(M1||(M1={}));var B_=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:M1.UNKWOWN_ERROR}},e}(),L_=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 ln(e){return typeof e>"u"||e===null}var ss=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}(),hv=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"],f=new Set(c),g=Object.keys(t),m=0,v=g;m<v.length;m++){var x=v[m];if(f.has(x))return n.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},e}(),P1={exports:{}};(function(e,t){(function(n,o){o(t)})(dn,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 f(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 m(y,r){r===void 0&&(r=y.constructor);var i=Error.captureStackTrace;i&&i(y,r)}var v=function(y){f(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),m(a),a}return r}(Error);class x extends v{constructor(r=void 0){super(r),this.message=r}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class A extends x{}A.kind="IllegalArgumentException";class I{constructor(r){if(this.binarizer=r,r===null)throw new A("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 I(this.binarizer.createBinarizer(l))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new I(this.binarizer.createBinarizer(r))}rotateCounterClockwise45(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new I(this.binarizer.createBinarizer(r))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.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 x{}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 T{static fill(r,i){for(let s=0,a=r.length;s<a;s++)r[s]=i}static fillWithin(r,i,s,a){T.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 A("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=T.numberComparator);let a=0,l=r.length-1;for(;a<=l;){const u=l+a>>1,d=s(i,r[u]);if(d>0)a=u+1;else if(d<0)l=u-1;else return u}return-a-1}static numberComparator(r,i){return r-i}}class _{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)}}_.MIN_VALUE_32_BITS=-2147483648,_.MAX_VALUE=Number.MAX_SAFE_INTEGER;class U{constructor(r,i){r===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=r,i==null?this.bits=U.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=U.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 u=s.length;for(;l===0;){if(++a===u)return i;l=s[a]}const d=a*32+_.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 u=s.length;for(;l===0;){if(++a===u)return i;l=~s[a]}const d=a*32+_.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 A;if(i===r)return;i--;const s=Math.floor(r/32),a=Math.floor(i/32),l=this.bits;for(let u=s;u<=a;u++){const d=u>s?0:r&31,p=(2<<(u<a?31:i&31))-(1<<d);l[u]|=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 A;if(i===r)return!0;i--;const a=Math.floor(r/32),l=Math.floor(i/32),u=this.bits;for(let d=a;d<=l;d++){const h=d>a?0:r&31,w=(2<<(d<l?31:i&31))-(1<<h)&4294967295;if((u[d]&w)!==(s?w: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 A("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 A("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 u=0;for(let d=0;d<8;d++)this.get(r)&&(u|=1<<7-d),r++;i[s+l]=u}}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 u=a[l];u=u>>1&1431655765|(u&1431655765)<<1,u=u>>2&858993459|(u&858993459)<<2,u=u>>4&252645135|(u&252645135)<<4,u=u>>8&16711935|(u&16711935)<<8,u=u>>16&65535|(u&65535)<<16,r[i-l]=u}if(this.size!==s*32){const l=s*32-this.size;let u=r[0]>>>l;for(let d=1;d<s;d++){const h=r[d];u|=h<<32-l,r[d-1]=u,u=h>>>l}r[s-1]=u}this.bits=r}static makeArray(r){return new Int32Array(Math.floor((r+31)/32))}equals(r){if(!(r instanceof U))return!1;const i=r;return this.size===i.size&&T.equals(this.bits,i.bits)}hashCode(){return 31*this.size+T.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 U(this.size,this.bits.slice())}}var z;(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"})(z||(z={}));var j=z;class B extends x{static getFormatInstance(){return new B}}B.kind="FormatException";var X;(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"})(X||(X={}));class V{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,V.VALUE_IDENTIFIER_TO_ECI.set(r,this),V.NAME_TO_ECI.set(s,this);const l=this.values;for(let u=0,d=l.length;u!==d;u++){const h=l[u];V.VALUES_TO_ECI.set(h,this)}for(const u of a)V.NAME_TO_ECI.set(u,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(r){if(r<0||r>=900)throw new B("incorect value");const i=V.VALUES_TO_ECI.get(r);if(i===void 0)throw new B("incorect value");return i}static getCharacterSetECIByName(r){const i=V.NAME_TO_ECI.get(r);if(i===void 0)throw new B("incorect value");return i}equals(r){if(!(r instanceof V))return!1;const i=r;return this.getName()===i.getName()}}V.VALUE_IDENTIFIER_TO_ECI=new Map,V.VALUES_TO_ECI=new Map,V.NAME_TO_ECI=new Map,V.Cp437=new V(X.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(X.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(X.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(X.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4=new V(X.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(X.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(X.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(X.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(X.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(X.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(X.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(X.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(X.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(X.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(X.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(X.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(X.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(X.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(X.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(X.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(X.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(X.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(X.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(X.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(X.Big5,28,"Big5"),V.GB18030=new V(X.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(X.EUC_KR,30,"EUC_KR","EUC-KR");class oe extends x{}oe.kind="UnsupportedOperationException";class ye{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!ye.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 V?r:V.getCharacterSetECIByName(r)}static decodeFallback(r,i){const s=this.encodingCharacterSet(i);if(ye.isDecodeFallbackSupported(s)){let a="";for(let l=0,u=r.length;l<u;l++){let d=r[l].toString(16);d.length<2&&(d="0"+d),a+="%"+d}return decodeURIComponent(a)}if(s.equals(V.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(V.UTF8)||r.equals(V.ISO8859_1)||r.equals(V.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 se{static castAsNonUtf8Char(r,i=null){const s=i?i.getName():this.ISO88591;return ye.decode(new Uint8Array([r]),s)}static guessEncoding(r,i){if(i!=null&&i.get(j.CHARACTER_SET)!==void 0)return i.get(j.CHARACTER_SET).toString();const s=r.length;let a=!0,l=!0,u=!0,d=0,h=0,p=0,w=0,E=0,S=0,b=0,D=0,P=0,L=0,$=0;const Q=r.length>3&&r[0]===239&&r[1]===187&&r[2]===191;for(let q=0;q<s&&(a||l||u);q++){const K=r[q]&255;u&&(d>0?K&128?d--:u=!1:K&128&&(K&64?(d++,K&32?(d++,K&16?(d++,K&8?u=!1:w++):p++):h++):u=!1)),a&&(K>127&&K<160?a=!1:K>159&&(K<192||K===215||K===247)&&$++),l&&(E>0?K<64||K===127||K>252?l=!1:E--:K===128||K===160||K>239?l=!1:K>160&&K<224?(S++,D=0,b++,b>P&&(P=b)):K>127?(E++,b=0,D++,D>L&&(L=D)):(b=0,D=0))}return u&&d>0&&(u=!1),l&&E>0&&(l=!1),u&&(Q||h+p+w>0)?se.UTF8:l&&(se.ASSUME_SHIFT_JIS||P>=3||L>=3)?se.SHIFT_JIS:a&&l?P===2&&S===2||$*10>=s?se.SHIFT_JIS:se.ISO88591:a?se.ISO88591:l?se.SHIFT_JIS:u?se.UTF8:se.PLATFORM_DEFAULT_ENCODING}static format(r,...i){let s=-1;function a(u,d,h,p,w,E){if(u==="%%")return"%";if(i[++s]===void 0)return;u=p?parseInt(p.substr(1)):void 0;let S=w?parseInt(w.substr(1)):void 0,b;switch(E){case"s":b=i[s];break;case"c":b=i[s][0];break;case"f":b=parseFloat(i[s]).toFixed(u);break;case"p":b=parseFloat(i[s]).toPrecision(u);break;case"e":b=parseFloat(i[s]).toExponential(u);break;case"x":b=parseInt(i[s]).toString(S||16);break;case"d":b=parseFloat(parseInt(i[s],S||10).toPrecision(u)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(S);let D=parseInt(h),P=h&&h[0]+""=="0"?"0":" ";for(;b.length<D;)b=d!==void 0?b+P:P+b;return b}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}static getBytes(r,i){return ye.encode(r,i)}static getCharCode(r,i=0){return r.charCodeAt(i)}static getCharAt(r){return String.fromCharCode(r)}}se.SHIFT_JIS=V.SJIS.getName(),se.GB2312="GB2312",se.ISO88591=V.ISO8859_1.getName(),se.EUC_JP="EUC_JP",se.UTF8=V.UTF8.getName(),se.PLATFORM_DEFAULT_ENCODING=se.UTF8,se.ASSUME_SHIFT_JIS=!1;class ge{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+=se.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 A("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 u=r[l];for(let d=0;d<s;d++)u[d]&&a.set(d,l)}return a}static parseFromString(r,i,s){if(r===null)throw new A("stringRepresentation cannot be null");const a=new Array(r.length);let l=0,u=0,d=-1,h=0,p=0;for(;p<r.length;)if(r.charAt(p)===`
|
|
63
|
-
`||r.charAt(p)==="\r"){if(l>u){if(d===-1)d=l-u;else if(l-u!==d)throw new A("row lengths do not match");u=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 A("illegal character encountered: "+r.substring(p));if(l>u){if(d===-1)d=l-u;else if(l-u!==d)throw new A("row lengths do not match");h++}const w=new Te(d,h);for(let E=0;E<l;E++)a[E]&&w.set(Math.floor(E%d),Math.floor(E/d));return w}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 A("input matrix dimensions do not match");const i=new U(Math.floor(this.width/32)+1),s=this.rowSize,a=this.bits;for(let l=0,u=this.height;l<u;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 A("Left and top must be nonnegative");if(a<1||s<1)throw new A("Height and width must be at least 1");const l=r+s,u=i+a;if(u>this.height||l>this.width)throw new A("The region must fit inside the matrix");const d=this.rowSize,h=this.bits;for(let p=i;p<u;p++){const w=p*d;for(let E=r;E<l;E++)h[w+Math.floor(E/32)]|=1<<(E&31)&4294967295}}getRow(r,i){i==null||i.getSize()<this.width?i=new U(this.width):i.clear();const s=this.rowSize,a=this.bits,l=r*s;for(let u=0;u<s;u++)i.setBulk(u*32,a[l+u]);return i}setRow(r,i){
|
|
64
|
-
`){return this.buildToString(r,i,s)}buildToString(r,i,s){let a=new ge;for(let l=0,u=this.height;l<u;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 H extends x{static getNotFoundInstance(){return new H}}H.kind="NotFoundException";class tt extends k{constructor(r){super(r),this.luminances=tt.EMPTY,this.buckets=new Int32Array(tt.LUMINANCE_BUCKETS)}getBlackRow(r,i){const s=this.getLuminanceSource(),a=s.getWidth();i==null||i.getSize()<a?i=new U(a):i.clear(),this.initArrays(a);const l=s.getRow(r,this.luminances),u=this.buckets;for(let h=0;h<a;h++)u[(l[h]&255)>>tt.LUMINANCE_SHIFT]++;const d=tt.estimateBlackPoint(u);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 w=1;w<a-1;w++){const E=l[w+1]&255;(p*4-h-E)/2<d&&i.set(w),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),w=r.getRow(p,this.luminances),E=Math.floor(i*4/5);for(let S=Math.floor(i/5);S<E;S++){const b=w[S]&255;l[b>>tt.LUMINANCE_SHIFT]++}}const u=tt.estimateBlackPoint(l),d=r.getMatrix();for(let h=0;h<s;h++){const p=h*i;for(let w=0;w<i;w++)(d[p+w]&255)<u&&a.set(w,h)}return a}createBinarizer(r){return new tt(r)}initArrays(r){this.luminances.length<r&&(this.luminances=new Uint8ClampedArray(r));const i=this.buckets;for(let s=0;s<tt.LUMINANCE_BUCKETS;s++)i[s]=0}static estimateBlackPoint(r){const i=r.length;let s=0,a=0,l=0;for(let w=0;w<i;w++)r[w]>l&&(a=w,l=r[w]),r[w]>s&&(s=r[w]);let u=0,d=0;for(let w=0;w<i;w++){const E=w-a,S=r[w]*E*E;S>d&&(u=w,d=S)}if(a>u){const w=a;a=u,u=w}if(u-a<=i/16)throw new H;let h=u-1,p=-1;for(let w=u-1;w>a;w--){const E=w-a,S=E*E*(u-w)*(s-r[w]);S>p&&(h=w,p=S)}return h<<tt.LUMINANCE_SHIFT}}tt.LUMINANCE_BITS=5,tt.LUMINANCE_SHIFT=8-tt.LUMINANCE_BITS,tt.LUMINANCE_BUCKETS=1<<tt.LUMINANCE_BITS,tt.EMPTY=Uint8ClampedArray.from([0]);class xe extends tt{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 u=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&u++;const d=xe.calculateBlackPoints(a,l,u,i,s),h=new Te(i,s);xe.calculateThresholdForBlock(a,l,u,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,u,d){const h=l-xe.BLOCK_SIZE,p=a-xe.BLOCK_SIZE;for(let w=0;w<s;w++){let E=w<<xe.BLOCK_SIZE_POWER;E>h&&(E=h);const S=xe.cap(w,2,s-3);for(let b=0;b<i;b++){let D=b<<xe.BLOCK_SIZE_POWER;D>p&&(D=p);const
|
|
65
|
-
`)}return i.toString()}}class de 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 de(this.delegate.crop(r,i,s,a))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new de(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new de(this.delegate.rotateCounterClockwise45())}}class pe extends te{constructor(r){super(r.width,r.height),this.canvas=r,this.tempCanvasElement=null,this.buffer=pe.makeBufferFromCanvasImageData(r)}static makeBufferFromCanvasImageData(r){const i=r.getContext("2d").getImageData(0,0,r.width,r.height);return pe.toGrayscaleBuffer(i.data,r.width,r.height)}static toGrayscaleBuffer(r,i,s){const a=new Uint8ClampedArray(i*s);for(let l=0,u=0,d=r.length;l<d;l+=4,u++){let h;if(r[l+3]===0)h=255;else{const w=r[l],E=r[l+1],S=r[l+2];h=306*w+601*E+117*S+512>>10}a[u]=h}return a}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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*pe.DEGREE_TO_RADIANS,l=this.canvas.width,u=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(a))*l+Math.abs(Math.sin(a))*u),h=Math.ceil(Math.abs(Math.sin(a))*l+Math.abs(Math.cos(a))*u);return i.width=d,i.height=h,s.translate(d/2,h/2),s.rotate(a),s.drawImage(this.canvas,l/-2,u/-2),this.buffer=pe.makeBufferFromCanvasImageData(i),this}invert(){return new de(this)}}pe.DEGREE_TO_RADIANS=Math.PI/180;class He{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||dn||self||window||void 0)&&(globalThis||dn||self||window||void 0).__awaiter||function(y,r,i,s){function a(l){return l instanceof i?l:new i(function(u){u(l)})}return new(i||(i=Promise))(function(l,u){function d(w){try{p(s.next(w))}catch(E){u(E)}}function h(w){try{p(s.throw(w))}catch(E){u(E)}}function p(w){w.done?l(w.value):a(w.value).then(d,h)}p((s=s.apply(y,r||[])).next())})};class yr{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,u=s.label||`Video device ${i.length+1}`,d=s.groupId,h={deviceId:l,label:u,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 He(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,u)=>{if(this._stopAsyncDecode){u(new H("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 H,w=(d instanceof O||d instanceof B)&&s;if(h||w)return setTimeout(a,this._timeBetweenDecodingAttempts,l,u);u(d)}};return new Promise((l,u)=>a(l,u))}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 O||a instanceof B,u=a instanceof H;(l||u)&&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 pe(i),a=new xe(s);return new I(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 Ke{constructor(r,i,s=i==null?0:8*i.length,a,l,u=M.currentTimeMillis()){this.text=r,this.rawBytes=i,this.numBits=s,this.resultPoints=a,this.format=l,this.timestamp=u,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,u==null?this.timestamp=M.currentTimeMillis():this.timestamp=u}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 ni;(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"})(ni||(ni={}));var le=ni,In;(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"})(In||(In={}));var Ct=In;class Ds{constructor(r,i,s,a,l=-1,u=-1){this.rawBytes=r,this.text=i,this.byteSegments=s,this.ecLevel=a,this.structuredAppendSequenceNumber=l,this.structuredAppendParity=u,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 Ms{exp(r){return this.expTable[r]}log(r){if(r===0)throw new A;return this.logTable[r]}static addOrSubtract(r,i){return r^i}}class Zt{constructor(r,i){if(i.length===0)throw new A;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 u=0,d=i.length;u!==d;u++){const h=i[u];s=Ms.addOrSubtract(s,h)}return s}s=i[0];const a=i.length,l=this.field;for(let u=1;u<a;u++)s=Ms.addOrSubtract(l.multiply(r,s),i[u]);return s}addOrSubtract(r){if(!this.field.equals(r.field))throw new A("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 u=i;i=s,s=u}let a=new Int32Array(s.length);const l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let u=l;u<s.length;u++)a[u]=Ms.addOrSubtract(i[u-l],s[u]);return new Zt(this.field,a)}multiply(r){if(!this.field.equals(r.field))throw new A("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,u=new Int32Array(s+l-1),d=this.field;for(let h=0;h<s;h++){const p=i[h];for(let w=0;w<l;w++)u[h+w]=Ms.addOrSubtract(u[h+w],d.multiply(p,a[w]))}return new Zt(d,u)}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 u=0;u<i;u++)a[u]=s.multiply(l[u],r);return new Zt(s,a)}multiplyByMonomial(r,i){if(r<0)throw new A;if(i===0)return this.field.getZero();const s=this.coefficients,a=s.length,l=new Int32Array(a+r),u=this.field;for(let d=0;d<a;d++)l[d]=u.multiply(s[d],i);return new Zt(u,l)}divide(r){if(!this.field.equals(r.field))throw new A("GenericGFPolys do not have same GenericGF field");if(r.isZero())throw new A("Divide by 0");const i=this.field;let s=i.getZero(),a=this;const l=r.getCoefficient(r.getDegree()),u=i.inverse(l);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){const d=a.getDegree()-r.getDegree(),h=i.multiply(a.getCoefficient(a.getDegree()),u),p=r.multiplyByMonomial(d,h),w=i.buildMonomial(d,h);s=s.addOrSubtract(w),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 oa extends x{}oa.kind="ArithmeticException";class Oe extends Ms{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 u=new Int32Array(i);for(let d=0;d<i-1;d++)u[a[d]]=d;this.logTable=u,this.zero=new Zt(this,Int32Array.from([0])),this.one=new Zt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new A;if(i===0)return this.zero;const s=new Int32Array(r+1);return s[0]=i,new Zt(this,s)}inverse(r){if(r===0)throw new oa;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"+_.toHexString(this.primitive)+","+this.size+")"}equals(r){return r===this}}Oe.AZTEC_DATA_12=new Oe(4201,4096,1),Oe.AZTEC_DATA_10=new Oe(1033,1024,1),Oe.AZTEC_DATA_6=new Oe(67,64,1),Oe.AZTEC_PARAM=new Oe(19,16,1),Oe.QR_CODE_FIELD_256=new Oe(285,256,0),Oe.DATA_MATRIX_FIELD_256=new Oe(301,256,1),Oe.AZTEC_DATA_8=Oe.DATA_MATRIX_FIELD_256,Oe.MAXICODE_FIELD_64=Oe.AZTEC_DATA_6;class Ni extends x{}Ni.kind="ReedSolomonException";class Hr extends x{}Hr.kind="IllegalStateException";class Ps{constructor(r){this.field=r}decode(r,i){const s=this.field,a=new Zt(s,r),l=new Int32Array(i);let u=!0;for(let b=0;b<i;b++){const D=a.evaluateAt(s.exp(b+s.getGeneratorBase()));l[l.length-1-b]=D,D!==0&&(u=!1)}if(u)return;const d=new Zt(s,l),h=this.runEuclideanAlgorithm(s.buildMonomial(i,1),d,i),p=h[0],w=h[1],E=this.findErrorLocations(p),S=this.findErrorMagnitudes(w,E);for(let b=0;b<E.length;b++){const D=r.length-1-s.log(E[b]);if(D<0)throw new Ni("Bad error location");r[D]=Oe.addOrSubtract(r[D],S[b])}}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){const b=r;r=i,i=b}const a=this.field;let l=r,u=i,d=a.getZero(),h=a.getOne();for(;u.getDegree()>=(s/2|0);){let b=l,D=d;if(l=u,d=h,l.isZero())throw new Ni("r_{i-1} was zero");u=b;let P=a.getZero();const L=l.getCoefficient(l.getDegree()),$=a.inverse(L);for(;u.getDegree()>=l.getDegree()&&!u.isZero();){const Q=u.getDegree()-l.getDegree(),q=a.multiply(u.getCoefficient(u.getDegree()),$);P=P.addOrSubtract(a.buildMonomial(Q,q)),u=u.addOrSubtract(l.multiplyByMonomial(Q,q))}if(h=P.multiply(d).addOrSubtract(D),u.getDegree()>=l.getDegree())throw new Hr("Division algorithm failed to reduce polynomial?")}const p=h.getCoefficient(0);if(p===0)throw new Ni("sigmaTilde(0) was zero");const w=a.inverse(p),E=h.multiplyScalar(w),S=u.multiplyScalar(w);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 u=1;u<l.getSize()&&a<i;u++)r.evaluateAt(u)===0&&(s[a]=l.inverse(u),a++);if(a!==i)throw new Ni("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 u=0;u<s;u++){const d=l.inverse(i[u]);let h=1;for(let p=0;p<s;p++)if(u!==p){const w=l.multiply(i[p],d),E=w&1?w&-2:w|1;h=l.multiply(h,E)}a[u]=l.multiply(r.evaluateAt(d),l.inverse(h)),l.getGeneratorBase()!==0&&(a[u]=l.multiply(a[u],d))}return a}}var Rt;(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"})(Rt||(Rt={}));class Ue{decode(r){this.ddata=r;let i=r.getBits(),s=this.extractBits(i),a=this.correctBits(s),l=Ue.convertBoolArrayToByteArray(a),u=Ue.getEncodedData(a),d=new Ds(l,u,null,null);return d.setNumBits(a.length),d}static highLevelDecode(r){return this.getEncodedData(r)}static getEncodedData(r){let i=r.length,s=Rt.UPPER,a=Rt.UPPER,l="",u=0;for(;u<i;)if(a===Rt.BINARY){if(i-u<5)break;let d=Ue.readCode(r,u,5);if(u+=5,d===0){if(i-u<11)break;d=Ue.readCode(r,u,11)+31,u+=11}for(let h=0;h<d;h++){if(i-u<8){u=i;break}const p=Ue.readCode(r,u,8);l+=se.castAsNonUtf8Char(p),u+=8}a=s}else{let d=a===Rt.DIGIT?4:5;if(i-u<d)break;let h=Ue.readCode(r,u,d);u+=d;let p=Ue.getCharacter(a,h);p.startsWith("CTRL_")?(s=a,a=Ue.getTable(p.charAt(5)),p.charAt(6)==="L"&&(s=a)):(l+=p,a=s)}return l}static getTable(r){switch(r){case"L":return Rt.LOWER;case"P":return Rt.PUNCT;case"M":return Rt.MIXED;case"D":return Rt.DIGIT;case"B":return Rt.BINARY;case"U":default:return Rt.UPPER}}static getCharacter(r,i){switch(r){case Rt.UPPER:return Ue.UPPER_TABLE[i];case Rt.LOWER:return Ue.LOWER_TABLE[i];case Rt.MIXED:return Ue.MIXED_TABLE[i];case Rt.PUNCT:return Ue.PUNCT_TABLE[i];case Rt.DIGIT:return Ue.DIGIT_TABLE[i];default:throw new Hr("Bad table")}}correctBits(r){let i,s;this.ddata.getNbLayers()<=2?(s=6,i=Oe.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,i=Oe.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,i=Oe.AZTEC_DATA_10):(s=12,i=Oe.AZTEC_DATA_12);let a=this.ddata.getNbDatablocks(),l=r.length/s;if(l<a)throw new B;let u=r.length%s,d=new Int32Array(l);for(let S=0;S<l;S++,u+=s)d[S]=Ue.readCode(r,u,s);try{new Ps(i).decode(d,l-a)}catch(S){throw new B(S)}let h=(1<<s)-1,p=0;for(let S=0;S<a;S++){let b=d[S];if(b===0||b===h)throw new B;(b===1||b===h-1)&&p++}let w=new Array(a*s-p),E=0;for(let S=0;S<a;S++){let b=d[S];if(b===1||b===h-1)w.fill(b>1,E,E+s-1),E+=s-1;else for(let D=s-1;D>=0;--D)w[E++]=(b&1<<D)!==0}return w}extractBits(r){let i=this.ddata.isCompact(),s=this.ddata.getNbLayers(),a=(i?11:14)+s*4,l=new Int32Array(a),u=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*_.truncDivision(_.truncDivision(a,2)-1,15),h=a/2,p=_.truncDivision(d,2);for(let w=0;w<h;w++){let E=w+_.truncDivision(w,15);l[h-w-1]=p-E-1,l[h+w]=p+E+1}}for(let d=0,h=0;d<s;d++){let p=(s-d)*4+(i?9:12),w=d*2,E=a-1-w;for(let S=0;S<p;S++){let b=S*2;for(let D=0;D<2;D++)u[h+b+D]=r.get(l[w+D],l[w+S]),u[h+2*p+b+D]=r.get(l[w+S],l[E-D]),u[h+4*p+b+D]=r.get(l[E-D],l[E-S]),u[h+6*p+b+D]=r.get(l[E-S],l[w+D])}h+=p*8}return u}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?Ue.readCode(r,i,8):Ue.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]=Ue.readByte(r,8*s);return i}totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}Ue.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"],Ue.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"],Ue.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
62
|
+
`);O=io(T).trim()}catch{}}O?this.dispatch(t,{type:"text_chunk",text:O}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}}},I}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)}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 f;if(typeof o!="object"||o===null)return!1;const c=o;return c.role==="assistant"&&((f=c.presentation)==null?void 0:f.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 f=this.nativeFinalAnswerSnapshots.get(t);return!f||!c?!1:n.type==="text_chunk"&&n.messagePhase==="final_answer"&&f.runId===c&&o<=f.sequence}closeStream(t){this.flushBufferedStreamText(t);const n=this.streams.get(t);n&&(n.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}const Qa="webapp.settings.v1";class Vb{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(Qa)??"{}")}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(Qa,JSON.stringify(this.cached))}setActiveProfile(t){const n=this.get();this.cached={...n,activeProfileId:t},localStorage.setItem(Qa,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const n=this.get(),o=n.profiles.find(m=>m.id==="server-managed");if(!o||o.apiKey!=="managed"||o.modelId===t.modelId&&o.provider===(t.provider||"openai"))return;const c=t.modelId,f=t.provider||"openai",g=t.baseUrl||"";this.cached={...n,profiles:n.profiles.map(m=>m.id==="server-managed"?{...m,name:`服务端 · ${c}`,provider:f,modelId:c,baseUrl:g}:m),modelProvider:f,modelId:c,baseUrl:g||n.baseUrl},localStorage.setItem(Qa,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),n=t.profiles.find(m=>m.id===t.activeProfileId)??null,o=(n==null?void 0:n.provider)??t.modelProvider,c=(n==null?void 0:n.apiKey)??t.apiKey,f=(n==null?void 0:n.modelId)??t.modelId,g=(n==null?void 0:n.baseUrl)??t.baseUrl;return!c||c==="managed"||!f||f==="server"?null:{provider:o,apiKey:c,modelId:f,...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 zb(e){return e.toString(16).padStart(2,"0")}function Hb(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,zb);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 Gb(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>Hb(e)})}const mf="agent-webapp:tab-swipe:v1",Xb=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(","),Mp=24;function Yb(e){return!e||typeof e.closest!="function"?!1:!!e.closest(Xb)}function Kb(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<=Mp||o.clientX>=o.viewportWidth-Mp)||(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,f=o.clientY-t.startY;if(t.axis==="pending"){if(Math.max(Math.abs(c),Math.abs(f))<=8)return!1;if(Math.abs(f)>=Math.abs(c)*1.2)return t=null,!1;t.axis="horizontal"}return e({type:mf,phase:"move",deltaX:c}),!0},pointerUp(o){if(!n(o)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:mf,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:mf,phase:"cancel",deltaX:0}),t=null,c}}}function Zb(){if(window.parent===window)return()=>{};const e=Kb(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:Yb(g.target)})},o=g=>{e.pointerMove(t(g))&&g.preventDefault()},c=g=>{e.pointerUp(t(g))&&g.preventDefault()},f=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",f,{capture:!0}),()=>{document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",o,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",f,{capture:!0})}}const Qb="agent-web-shell:skin:v1",qb=["pearl","scifi","noir"];function Jb(){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!==Qb||typeof n.skin!="string"||!qb.includes(n.skin)||Nl.getState().setSkin(n.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const e_="agentroam:open-browser-live",t_="agent-web-shell:open-browser-live:v1";function r_(){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!==t_||window.dispatchEvent(new CustomEvent(e_))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const n_="agent-webapp:ready:v1";function i_(){window.parent!==window&&window.parent.postMessage({type:n_},window.location.origin)}const s_="agent-webapp:project-request:v1",o_="agent-web-shell:project-response:v1",a_=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"];new Set(a_);function l_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==o_||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class u_{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=l_(o.data);if(!c)return;const f=this.pending.get(c.id);f&&(this.pending.delete(c.id),clearTimeout(f.timer),c.ok?f.resolve(c.result):f.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,f)=>{const g=setTimeout(()=>{this.pending.delete(o),f(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:f,timer:g}),this.context.parent.postMessage({type:s_,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 c_="agent-webapp:browser-request:v1",f_="agent-web-shell:browser-response:v1",d_="agent-web-shell:browser-event:v1",h_="agent-web-shell:browser-frame:v1",g_=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc","browser:system"];new Set(g_);function p_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==f_||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function x_(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==d_||!t.event||typeof t.event!="object")return null;const n=t.event;return typeof n.type!="string"||!n.type.startsWith("browser:")?null:t}function m_(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==h_||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class w_{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 v;if(o.origin!==this.context.location.origin||o.source!==this.context.parent)return;const c=m_(o.data);if(c){const x=this.sessionsByChannel.get(c.channelId);if(!x){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,x);return}const f=x_(o.data);if(f){if(f.event.type==="browser:connection"){this.sessionsByChannel.clear(),this.pendingFramesByChannel.clear();for(const x of this.pending.values())clearTimeout(x.timer),x.reject(Object.assign(new Error("远程连接已变化,请重新接管"),{code:"EOFFLINE"}));this.pending.clear()}for(const x of this.listeners)x(f.event);return}const g=p_(o.data);if(!g)return;const m=this.pending.get(g.id);if(m)if(this.pending.delete(g.id),clearTimeout(m.timer),g.ok){if(m.method==="browser:watch"&&g.result&&typeof g.result=="object"){const x=g.result;if(Number.isSafeInteger(x.channelId)&&typeof((v=x.session)==null?void 0:v.id)=="string"){const C=Number(x.channelId);this.sessionsByChannel.set(C,x.session.id);const A=this.pendingFramesByChannel.get(C);A&&(this.pendingFramesByChannel.delete(C),this.emitBinaryFrame(A,x.session.id))}}m.resolve(g.result)}else m.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,f)=>{const g=setTimeout(()=>{this.pending.delete(o),f(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(o,{resolve:c,reject:f,timer:g,method:t}),this.context.parent.postMessage({type:c_,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 qn{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 qn(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class v_{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=qn.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?qn.parse(t):null}}function kp(){return window.Capacitor??null}class y_{isNativeApp(){var t,n;return((n=(t=kp())==null?void 0:t.isNativePlatform)==null?void 0:n.call(t))??!1}platform(){var n,o;const t=(o=(n=kp())==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 wf="webapp.mobile.serverEndpoint.v1";class Bp{load(){try{const t=localStorage.getItem(wf);return t?qn.parse(t):null}catch{return null}}save(t){localStorage.setItem(wf,t.toString())}clear(){localStorage.removeItem(wf)}}const E_=6e3;class C_{constructor(t=(...n)=>fetch(...n)){this.transport=t}async probe(t,n=E_){const o=new AbortController,c=setTimeout(()=>o.abort(),n);try{const f=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:o.signal});return f.ok?{ok:!0,modelId:(await f.json()).modelId??null}:{ok:!1,reason:f.status===401?"此 App 尚未授权,请扫描电脑上的授权二维码。":f.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":`HTTP ${f.status}`}}catch(f){return{ok:!1,reason:f instanceof DOMException&&f.name==="AbortError"?"连接超时":A_(f)}}finally{clearTimeout(c)}}}function A_(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function S_({service:e,savedEndpoint:t,initialFailure:n,onConnected:o,onScan:c}){const[f,g]=ht.useState((t==null?void 0:t.toString())??""),[m,v]=ht.useState(n??""),[x,C]=ht.useState(!1);async function A(){if(!(x||!c)){C(!0),v("");try{const O=await c();O&&o(O)}catch(O){v(O instanceof Error?O.message:"扫码连接失败,请重试。")}finally{C(!1)}}}async function I(){if(!x){C(!0),v("");try{const O=await e.connect(f);O.ok?o(O.endpoint):v(O.reason)}catch{v("连接失败,请检查网络或重新扫码授权。")}finally{C(!1)}}}return ee.jsx("div",{style:en.page,children:ee.jsxs("div",{style:en.card,children:[ee.jsx("div",{style:en.icon,children:"🛰️"}),ee.jsx("h1",{style:en.title,children:"连接服务器"}),c?ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{style:en.hint,children:"扫描电脑终端上的授权二维码,直接连接,无需再次确认。"}),ee.jsx("button",{type:"button",style:{...en.button,marginBottom:20},disabled:x,onClick:()=>void A(),children:x?"正在连接…":"扫码连接"})]}):null,ee.jsx("p",{style:en.hint,children:"也可以输入已授权的服务器地址。使用局域网地址时,手机与电脑需在同一网络。"}),ee.jsx("input",{style:en.input,value:f,inputMode:"url",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,placeholder:"http://192.168.1.10:3000",onChange:O=>g(O.target.value),onKeyDown:O=>{O.key==="Enter"&&I()}}),m?ee.jsx("p",{style:en.error,children:m}):null,ee.jsx("button",{style:{...en.button,opacity:x||!f.trim()?.6:1},disabled:x,onClick:()=>void I(),children:x?"正在连接…":"连接"})]})})}const en={page:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",background:"#f5f6fa",padding:24,boxSizing:"border-box"},card:{width:"100%",maxWidth:420,background:"#fff",borderRadius:16,padding:"32px 24px",boxShadow:"0 8px 32px rgba(0,0,0,0.08)",textAlign:"center"},icon:{fontSize:40,marginBottom:8},title:{fontSize:20,margin:"0 0 8px",color:"#1c1e26"},hint:{fontSize:13,lineHeight:1.6,color:"#6b7280",margin:"0 0 20px"},input:{width:"100%",boxSizing:"border-box",padding:"12px 14px",fontSize:16,borderRadius:10,border:"1px solid #d6d9e0",outline:"none",marginBottom:12},error:{fontSize:13,color:"#dc2626",margin:"0 0 12px",textAlign:"left"},button:{width:"100%",padding:"12px 0",fontSize:16,fontWeight:600,color:"#fff",background:"#4f6ef7",border:"none",borderRadius:10,cursor:"pointer"}};/*! Capacitor: https://capacitorjs.com/ - MIT License */var Is;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Is||(Is={}));class vf extends Error{constructor(t,n,o){super(t),this.message=t,this.code=n,this.data=o}}const I_=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"},T_=e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},o=n.Plugins=n.Plugins||{},c=()=>t!==null?t.name:I_(e),f=()=>c()!=="web",g=A=>{const I=x.get(A);return!!(I!=null&&I.platforms.has(c())||m(A))},m=A=>{var I;return(I=n.PluginHeaders)===null||I===void 0?void 0:I.find(O=>O.name===A)},v=A=>e.console.error(A),x=new Map,C=(A,I={})=>{const O=x.get(A);if(O)return console.warn(`Capacitor plugin "${A}" already registered. Cannot register plugins twice.`),O.proxy;const k=c(),P=m(A);let G;const N=async()=>(!G&&k in I?G=typeof I[k]=="function"?G=await I[k]():G=I[k]:t!==null&&!G&&"web"in I&&(G=typeof I.web=="function"?G=await I.web():G=I.web),G),T=(X,V)=>{var oe,ye;if(P){const se=P==null?void 0:P.methods.find(ge=>V===ge.name);if(se)return se.rtype==="promise"?ge=>n.nativePromise(A,V.toString(),ge):(ge,Te)=>n.nativeCallback(A,V.toString(),ge,Te);if(X)return(oe=X[V])===null||oe===void 0?void 0:oe.bind(X)}else{if(X)return(ye=X[V])===null||ye===void 0?void 0:ye.bind(X);throw new vf(`"${A}" plugin is not implemented on ${k}`,Is.Unimplemented)}},_=X=>{let V;const oe=(...ye)=>{const se=N().then(ge=>{const Te=T(ge,X);if(Te){const H=Te(...ye);return V=H==null?void 0:H.remove,H}else throw new vf(`"${A}.${X}()" is not implemented on ${k}`,Is.Unimplemented)});return X==="addListener"&&(se.remove=async()=>V()),se};return oe.toString=()=>`${X.toString()}() { [capacitor code] }`,Object.defineProperty(oe,"name",{value:X,writable:!1,configurable:!1}),oe},U=_("addListener"),z=_("removeListener"),j=(X,V)=>{const oe=U({eventName:X},V),ye=async()=>{const ge=await oe;z({eventName:X,callbackId:ge},V)},se=new Promise(ge=>oe.then(()=>ge({remove:ye})));return se.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ye()},se},B=new Proxy({},{get(X,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return P?j:U;case"removeListener":return z;default:return _(V)}}});return o[A]=B,x.set(A,{name:A,proxy:B,platforms:new Set([...Object.keys(I),...P?[k]:[]])}),B};return n.convertFileSrc||(n.convertFileSrc=A=>A),n.getPlatform=c,n.handleError=v,n.isNativePlatform=f,n.isPluginAvailable=g,n.registerPlugin=C,n.Exception=vf,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},R_=e=>e.Capacitor=T_(e),Ts=R_(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),sa=Ts.registerPlugin;class fv{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 f=this.windowListeners[t];f&&!f.registered&&this.addWindowListener(f),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 f=this.retainedEventArguments[t];f||(f=[]),f.push(n),this.retainedEventArguments[t]=f}return}c.forEach(f=>f(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 Ts.Exception(t,Is.Unimplemented)}unavailable(t="not available"){return new Ts.Exception(t,Is.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 Lp=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Fp=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class b_ extends fv{async getCookies(){const t=document.cookie,n={};return t.split(";").forEach(o=>{if(o.length<=0)return;let[c,f]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=Fp(c).trim(),f=Fp(f).trim(),n[c]=f}),n}async setCookie(t){try{const n=Lp(t.key),o=Lp(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",f=(t.path||"/").replace("path=",""),g=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${n}=${o||""}${c}; path=${f}; ${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)}}}sa("CapacitorCookies",{web:()=>new b_});const __=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)}),O_=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,f,g)=>(c[f]=e[t[g]],c),{})},N_=(e,t=!0)=>e?Object.entries(e).reduce((o,c)=>{const[f,g]=c;let m,v;return Array.isArray(g)?(v="",g.forEach(x=>{m=t?encodeURIComponent(x):x,v+=`${f}=${m}&`}),v.slice(0,-1)):(m=t?encodeURIComponent(g):g,v=`${f}=${m}`),`${o}&${v}`},"").substr(1):null,D_=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),c=O_(e.headers)["content-type"]||"";if(typeof e.data=="string")n.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const f=new URLSearchParams;for(const[g,m]of Object.entries(e.data||{}))f.set(g,m);n.body=f.toString()}else if(c.includes("multipart/form-data")||e.data instanceof FormData){const f=new FormData;if(e.data instanceof FormData)e.data.forEach((m,v)=>{f.append(v,m)});else for(const m of Object.keys(e.data))f.append(m,e.data[m]);n.body=f;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 P_ extends fv{async request(t){const n=D_(t,t.webFetchExtra),o=N_(t.params,t.shouldEncodeUrlParams),c=o?`${t.url}?${o}`:t.url,f=await fetch(c,n),g=f.headers.get("content-type")||"";let{responseType:m="text"}=f.ok?t:{};g.includes("application/json")&&(m="json");let v,x;switch(m){case"arraybuffer":case"blob":x=await f.blob(),v=await __(x);break;case"json":v=await f.json();break;case"document":case"text":default:v=await f.text()}const C={};return f.headers.forEach((A,I)=>{C[I]=A}),{data:v,headers:C,status:f.status,url:f.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"}))}}sa("CapacitorHttp",{web:()=>new P_});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 Up=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"]]),jp;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(jp||(jp={}));function M_(e){return Object.values(re).includes(e)}var ru;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(ru||(ru={}));var k_=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=[ru.SCAN_TYPE_CAMERA,ru.SCAN_TYPE_FILE],e}(),dv=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Up.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Up.get(t))},e}(),Wp=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}(),M1;(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"})(M1||(M1={}));var B_=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:M1.UNKWOWN_ERROR}},e}(),L_=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 ln(e){return typeof e>"u"||e===null}var ss=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}(),hv=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"],f=new Set(c),g=Object.keys(t),m=0,v=g;m<v.length;m++){var x=v[m];if(f.has(x))return n.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},e}(),k1={exports:{}};(function(e,t){(function(n,o){o(t)})(dn,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 f(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 m(y,r){r===void 0&&(r=y.constructor);var i=Error.captureStackTrace;i&&i(y,r)}var v=function(y){f(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),m(a),a}return r}(Error);class x extends v{constructor(r=void 0){super(r),this.message=r}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class A extends x{}A.kind="IllegalArgumentException";class I{constructor(r){if(this.binarizer=r,r===null)throw new A("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 I(this.binarizer.createBinarizer(l))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new I(this.binarizer.createBinarizer(r))}rotateCounterClockwise45(){const r=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new I(this.binarizer.createBinarizer(r))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class k{constructor(r){this.source=r}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(r,i,s,a,l){for(;l--;)s[a++]=r[i++]}static currentTimeMillis(){return Date.now()}}class G extends x{}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 T{static fill(r,i){for(let s=0,a=r.length;s<a;s++)r[s]=i}static fillWithin(r,i,s,a){T.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 A("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 P.arraycopy(r,i,l,0,a),l}static binarySearch(r,i,s){s===void 0&&(s=T.numberComparator);let a=0,l=r.length-1;for(;a<=l;){const u=l+a>>1,d=s(i,r[u]);if(d>0)a=u+1;else if(d<0)l=u-1;else return u}return-a-1}static numberComparator(r,i){return r-i}}class _{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)}}_.MIN_VALUE_32_BITS=-2147483648,_.MAX_VALUE=Number.MAX_SAFE_INTEGER;class U{constructor(r,i){r===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=r,i==null?this.bits=U.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=U.makeArray(r);P.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 u=s.length;for(;l===0;){if(++a===u)return i;l=s[a]}const d=a*32+_.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 u=s.length;for(;l===0;){if(++a===u)return i;l=~s[a]}const d=a*32+_.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 A;if(i===r)return;i--;const s=Math.floor(r/32),a=Math.floor(i/32),l=this.bits;for(let u=s;u<=a;u++){const d=u>s?0:r&31,p=(2<<(u<a?31:i&31))-(1<<d);l[u]|=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 A;if(i===r)return!0;i--;const a=Math.floor(r/32),l=Math.floor(i/32),u=this.bits;for(let d=a;d<=l;d++){const h=d>a?0:r&31,w=(2<<(d<l?31:i&31))-(1<<h)&4294967295;if((u[d]&w)!==(s?w: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 A("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 A("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 u=0;for(let d=0;d<8;d++)this.get(r)&&(u|=1<<7-d),r++;i[s+l]=u}}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 u=a[l];u=u>>1&1431655765|(u&1431655765)<<1,u=u>>2&858993459|(u&858993459)<<2,u=u>>4&252645135|(u&252645135)<<4,u=u>>8&16711935|(u&16711935)<<8,u=u>>16&65535|(u&65535)<<16,r[i-l]=u}if(this.size!==s*32){const l=s*32-this.size;let u=r[0]>>>l;for(let d=1;d<s;d++){const h=r[d];u|=h<<32-l,r[d-1]=u,u=h>>>l}r[s-1]=u}this.bits=r}static makeArray(r){return new Int32Array(Math.floor((r+31)/32))}equals(r){if(!(r instanceof U))return!1;const i=r;return this.size===i.size&&T.equals(this.bits,i.bits)}hashCode(){return 31*this.size+T.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 U(this.size,this.bits.slice())}}var z;(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"})(z||(z={}));var j=z;class B extends x{static getFormatInstance(){return new B}}B.kind="FormatException";var X;(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"})(X||(X={}));class V{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,V.VALUE_IDENTIFIER_TO_ECI.set(r,this),V.NAME_TO_ECI.set(s,this);const l=this.values;for(let u=0,d=l.length;u!==d;u++){const h=l[u];V.VALUES_TO_ECI.set(h,this)}for(const u of a)V.NAME_TO_ECI.set(u,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(r){if(r<0||r>=900)throw new B("incorect value");const i=V.VALUES_TO_ECI.get(r);if(i===void 0)throw new B("incorect value");return i}static getCharacterSetECIByName(r){const i=V.NAME_TO_ECI.get(r);if(i===void 0)throw new B("incorect value");return i}equals(r){if(!(r instanceof V))return!1;const i=r;return this.getName()===i.getName()}}V.VALUE_IDENTIFIER_TO_ECI=new Map,V.VALUES_TO_ECI=new Map,V.NAME_TO_ECI=new Map,V.Cp437=new V(X.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(X.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(X.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(X.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4=new V(X.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(X.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(X.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(X.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(X.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(X.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(X.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(X.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(X.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(X.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(X.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(X.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(X.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(X.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(X.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(X.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(X.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(X.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(X.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(X.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(X.Big5,28,"Big5"),V.GB18030=new V(X.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(X.EUC_KR,30,"EUC_KR","EUC-KR");class oe extends x{}oe.kind="UnsupportedOperationException";class ye{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!ye.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 V?r:V.getCharacterSetECIByName(r)}static decodeFallback(r,i){const s=this.encodingCharacterSet(i);if(ye.isDecodeFallbackSupported(s)){let a="";for(let l=0,u=r.length;l<u;l++){let d=r[l].toString(16);d.length<2&&(d="0"+d),a+="%"+d}return decodeURIComponent(a)}if(s.equals(V.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(V.UTF8)||r.equals(V.ISO8859_1)||r.equals(V.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 se{static castAsNonUtf8Char(r,i=null){const s=i?i.getName():this.ISO88591;return ye.decode(new Uint8Array([r]),s)}static guessEncoding(r,i){if(i!=null&&i.get(j.CHARACTER_SET)!==void 0)return i.get(j.CHARACTER_SET).toString();const s=r.length;let a=!0,l=!0,u=!0,d=0,h=0,p=0,w=0,E=0,S=0,b=0,D=0,M=0,L=0,$=0;const Q=r.length>3&&r[0]===239&&r[1]===187&&r[2]===191;for(let q=0;q<s&&(a||l||u);q++){const K=r[q]&255;u&&(d>0?K&128?d--:u=!1:K&128&&(K&64?(d++,K&32?(d++,K&16?(d++,K&8?u=!1:w++):p++):h++):u=!1)),a&&(K>127&&K<160?a=!1:K>159&&(K<192||K===215||K===247)&&$++),l&&(E>0?K<64||K===127||K>252?l=!1:E--:K===128||K===160||K>239?l=!1:K>160&&K<224?(S++,D=0,b++,b>M&&(M=b)):K>127?(E++,b=0,D++,D>L&&(L=D)):(b=0,D=0))}return u&&d>0&&(u=!1),l&&E>0&&(l=!1),u&&(Q||h+p+w>0)?se.UTF8:l&&(se.ASSUME_SHIFT_JIS||M>=3||L>=3)?se.SHIFT_JIS:a&&l?M===2&&S===2||$*10>=s?se.SHIFT_JIS:se.ISO88591:a?se.ISO88591:l?se.SHIFT_JIS:u?se.UTF8:se.PLATFORM_DEFAULT_ENCODING}static format(r,...i){let s=-1;function a(u,d,h,p,w,E){if(u==="%%")return"%";if(i[++s]===void 0)return;u=p?parseInt(p.substr(1)):void 0;let S=w?parseInt(w.substr(1)):void 0,b;switch(E){case"s":b=i[s];break;case"c":b=i[s][0];break;case"f":b=parseFloat(i[s]).toFixed(u);break;case"p":b=parseFloat(i[s]).toPrecision(u);break;case"e":b=parseFloat(i[s]).toExponential(u);break;case"x":b=parseInt(i[s]).toString(S||16);break;case"d":b=parseFloat(parseInt(i[s],S||10).toPrecision(u)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(S);let D=parseInt(h),M=h&&h[0]+""=="0"?"0":" ";for(;b.length<D;)b=d!==void 0?b+M:M+b;return b}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}static getBytes(r,i){return ye.encode(r,i)}static getCharCode(r,i=0){return r.charCodeAt(i)}static getCharAt(r){return String.fromCharCode(r)}}se.SHIFT_JIS=V.SJIS.getName(),se.GB2312="GB2312",se.ISO88591=V.ISO8859_1.getName(),se.EUC_JP="EUC_JP",se.UTF8=V.UTF8.getName(),se.PLATFORM_DEFAULT_ENCODING=se.UTF8,se.ASSUME_SHIFT_JIS=!1;class ge{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+=se.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 A("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 u=r[l];for(let d=0;d<s;d++)u[d]&&a.set(d,l)}return a}static parseFromString(r,i,s){if(r===null)throw new A("stringRepresentation cannot be null");const a=new Array(r.length);let l=0,u=0,d=-1,h=0,p=0;for(;p<r.length;)if(r.charAt(p)===`
|
|
63
|
+
`||r.charAt(p)==="\r"){if(l>u){if(d===-1)d=l-u;else if(l-u!==d)throw new A("row lengths do not match");u=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 A("illegal character encountered: "+r.substring(p));if(l>u){if(d===-1)d=l-u;else if(l-u!==d)throw new A("row lengths do not match");h++}const w=new Te(d,h);for(let E=0;E<l;E++)a[E]&&w.set(Math.floor(E%d),Math.floor(E/d));return w}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 A("input matrix dimensions do not match");const i=new U(Math.floor(this.width/32)+1),s=this.rowSize,a=this.bits;for(let l=0,u=this.height;l<u;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 A("Left and top must be nonnegative");if(a<1||s<1)throw new A("Height and width must be at least 1");const l=r+s,u=i+a;if(u>this.height||l>this.width)throw new A("The region must fit inside the matrix");const d=this.rowSize,h=this.bits;for(let p=i;p<u;p++){const w=p*d;for(let E=r;E<l;E++)h[w+Math.floor(E/32)]|=1<<(E&31)&4294967295}}getRow(r,i){i==null||i.getSize()<this.width?i=new U(this.width):i.clear();const s=this.rowSize,a=this.bits,l=r*s;for(let u=0;u<s;u++)i.setBulk(u*32,a[l+u]);return i}setRow(r,i){P.arraycopy(i.getBitArray(),0,this.bits,r*this.rowSize,this.rowSize)}rotate180(){const r=this.getWidth(),i=this.getHeight();let s=new U(r),a=new U(r);for(let l=0,u=Math.floor((i+1)/2);l<u;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,u=i,d=-1,h=-1;for(let p=0;p<i;p++)for(let w=0;w<s;w++){const E=a[p*s+w];if(E!==0){if(p<u&&(u=p),p>h&&(h=p),w*32<l){let S=0;for(;!(E<<31-S&4294967295);)S++;w*32+S<l&&(l=w*32+S)}if(w*32+31>d){let S=31;for(;!(E>>>S);)S--;w*32+S>d&&(d=w*32+S)}}}return d<l||h<u?null:Int32Array.from([l,u,d-l+1,h-u+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 u=i[s];let d=0;for(;!(u<<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 u=i[s];let d=31;for(;!(u>>>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&&T.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+T.hashCode(this.bits),r}toString(r="X ",i=" ",s=`
|
|
64
|
+
`){return this.buildToString(r,i,s)}buildToString(r,i,s){let a=new ge;for(let l=0,u=this.height;l<u;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 H extends x{static getNotFoundInstance(){return new H}}H.kind="NotFoundException";class tt extends k{constructor(r){super(r),this.luminances=tt.EMPTY,this.buckets=new Int32Array(tt.LUMINANCE_BUCKETS)}getBlackRow(r,i){const s=this.getLuminanceSource(),a=s.getWidth();i==null||i.getSize()<a?i=new U(a):i.clear(),this.initArrays(a);const l=s.getRow(r,this.luminances),u=this.buckets;for(let h=0;h<a;h++)u[(l[h]&255)>>tt.LUMINANCE_SHIFT]++;const d=tt.estimateBlackPoint(u);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 w=1;w<a-1;w++){const E=l[w+1]&255;(p*4-h-E)/2<d&&i.set(w),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),w=r.getRow(p,this.luminances),E=Math.floor(i*4/5);for(let S=Math.floor(i/5);S<E;S++){const b=w[S]&255;l[b>>tt.LUMINANCE_SHIFT]++}}const u=tt.estimateBlackPoint(l),d=r.getMatrix();for(let h=0;h<s;h++){const p=h*i;for(let w=0;w<i;w++)(d[p+w]&255)<u&&a.set(w,h)}return a}createBinarizer(r){return new tt(r)}initArrays(r){this.luminances.length<r&&(this.luminances=new Uint8ClampedArray(r));const i=this.buckets;for(let s=0;s<tt.LUMINANCE_BUCKETS;s++)i[s]=0}static estimateBlackPoint(r){const i=r.length;let s=0,a=0,l=0;for(let w=0;w<i;w++)r[w]>l&&(a=w,l=r[w]),r[w]>s&&(s=r[w]);let u=0,d=0;for(let w=0;w<i;w++){const E=w-a,S=r[w]*E*E;S>d&&(u=w,d=S)}if(a>u){const w=a;a=u,u=w}if(u-a<=i/16)throw new H;let h=u-1,p=-1;for(let w=u-1;w>a;w--){const E=w-a,S=E*E*(u-w)*(s-r[w]);S>p&&(h=w,p=S)}return h<<tt.LUMINANCE_SHIFT}}tt.LUMINANCE_BITS=5,tt.LUMINANCE_SHIFT=8-tt.LUMINANCE_BITS,tt.LUMINANCE_BUCKETS=1<<tt.LUMINANCE_BITS,tt.EMPTY=Uint8ClampedArray.from([0]);class xe extends tt{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 u=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&u++;const d=xe.calculateBlackPoints(a,l,u,i,s),h=new Te(i,s);xe.calculateThresholdForBlock(a,l,u,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,u,d){const h=l-xe.BLOCK_SIZE,p=a-xe.BLOCK_SIZE;for(let w=0;w<s;w++){let E=w<<xe.BLOCK_SIZE_POWER;E>h&&(E=h);const S=xe.cap(w,2,s-3);for(let b=0;b<i;b++){let D=b<<xe.BLOCK_SIZE_POWER;D>p&&(D=p);const M=xe.cap(b,2,i-3);let L=0;for(let Q=-2;Q<=2;Q++){const q=u[S+Q];L+=q[M-2]+q[M-1]+q[M]+q[M+1]+q[M+2]}const $=L/25;xe.thresholdBlock(r,D,E,$,a,d)}}}static cap(r,i,s){return r<i?i:r>s?s:r}static thresholdBlock(r,i,s,a,l,u){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&&u.set(i+p,s+d)}static calculateBlackPoints(r,i,s,a,l){const u=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 w=p<<xe.BLOCK_SIZE_POWER;w>u&&(w=u);for(let E=0;E<i;E++){let S=E<<xe.BLOCK_SIZE_POWER;S>d&&(S=d);let b=0,D=255,M=0;for(let $=0,Q=w*a+S;$<xe.BLOCK_SIZE;$++,Q+=a){for(let q=0;q<xe.BLOCK_SIZE;q++){const K=r[Q+q]&255;b+=K,K<D&&(D=K),K>M&&(M=K)}if(M-D>xe.MIN_DYNAMIC_RANGE)for($++,Q+=a;$<xe.BLOCK_SIZE;$++,Q+=a)for(let q=0;q<xe.BLOCK_SIZE;q++)b+=r[Q+q]&255}let L=b>>xe.BLOCK_SIZE_POWER*2;if(M-D<=xe.MIN_DYNAMIC_RANGE&&(L=D/2,p>0&&E>0)){const $=(h[p-1][E]+2*h[p][E-1]+h[p-1][E-1])/4;D<$&&(L=$)}h[p][E]=L}}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 ge;for(let s=0;s<this.height;s++){const a=this.getRow(s,r);for(let l=0;l<this.width;l++){const u=a[l]&255;let d;u<64?d="#":u<128?d="+":u<192?d=".":d=" ",i.append(d)}i.append(`
|
|
65
|
+
`)}return i.toString()}}class de 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 de(this.delegate.crop(r,i,s,a))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new de(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new de(this.delegate.rotateCounterClockwise45())}}class pe extends te{constructor(r){super(r.width,r.height),this.canvas=r,this.tempCanvasElement=null,this.buffer=pe.makeBufferFromCanvasImageData(r)}static makeBufferFromCanvasImageData(r){const i=r.getContext("2d").getImageData(0,0,r.width,r.height);return pe.toGrayscaleBuffer(i.data,r.width,r.height)}static toGrayscaleBuffer(r,i,s){const a=new Uint8ClampedArray(i*s);for(let l=0,u=0,d=r.length;l<d;l+=4,u++){let h;if(r[l+3]===0)h=255;else{const w=r[l],E=r[l+1],S=r[l+2];h=306*w+601*E+117*S+512>>10}a[u]=h}return a}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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*pe.DEGREE_TO_RADIANS,l=this.canvas.width,u=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(a))*l+Math.abs(Math.sin(a))*u),h=Math.ceil(Math.abs(Math.sin(a))*l+Math.abs(Math.cos(a))*u);return i.width=d,i.height=h,s.translate(d/2,h/2),s.rotate(a),s.drawImage(this.canvas,l/-2,u/-2),this.buffer=pe.makeBufferFromCanvasImageData(i),this}invert(){return new de(this)}}pe.DEGREE_TO_RADIANS=Math.PI/180;class He{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||dn||self||window||void 0)&&(globalThis||dn||self||window||void 0).__awaiter||function(y,r,i,s){function a(l){return l instanceof i?l:new i(function(u){u(l)})}return new(i||(i=Promise))(function(l,u){function d(w){try{p(s.next(w))}catch(E){u(E)}}function h(w){try{p(s.throw(w))}catch(E){u(E)}}function p(w){w.done?l(w.value):a(w.value).then(d,h)}p((s=s.apply(y,r||[])).next())})};class yr{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,u=s.label||`Video device ${i.length+1}`,d=s.groupId,h={deviceId:l,label:u,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 He(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,u)=>{if(this._stopAsyncDecode){u(new H("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 H,w=(d instanceof O||d instanceof B)&&s;if(h||w)return setTimeout(a,this._timeBetweenDecodingAttempts,l,u);u(d)}};return new Promise((l,u)=>a(l,u))}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 O||a instanceof B,u=a instanceof H;(l||u)&&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 pe(i),a=new xe(s);return new I(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 Ke{constructor(r,i,s=i==null?0:8*i.length,a,l,u=P.currentTimeMillis()){this.text=r,this.rawBytes=i,this.numBits=s,this.resultPoints=a,this.format=l,this.timestamp=u,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,u==null?this.timestamp=P.currentTimeMillis():this.timestamp=u}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);P.arraycopy(i,0,s,0,i.length),P.arraycopy(r,0,s,i.length,r.length),this.resultPoints=s}}getTimestamp(){return this.timestamp}toString(){return this.text}}var ni;(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"})(ni||(ni={}));var le=ni,In;(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"})(In||(In={}));var Ct=In;class Ds{constructor(r,i,s,a,l=-1,u=-1){this.rawBytes=r,this.text=i,this.byteSegments=s,this.ecLevel=a,this.structuredAppendSequenceNumber=l,this.structuredAppendParity=u,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 Ps{exp(r){return this.expTable[r]}log(r){if(r===0)throw new A;return this.logTable[r]}static addOrSubtract(r,i){return r^i}}class Zt{constructor(r,i){if(i.length===0)throw new A;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),P.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 u=0,d=i.length;u!==d;u++){const h=i[u];s=Ps.addOrSubtract(s,h)}return s}s=i[0];const a=i.length,l=this.field;for(let u=1;u<a;u++)s=Ps.addOrSubtract(l.multiply(r,s),i[u]);return s}addOrSubtract(r){if(!this.field.equals(r.field))throw new A("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 u=i;i=s,s=u}let a=new Int32Array(s.length);const l=s.length-i.length;P.arraycopy(s,0,a,0,l);for(let u=l;u<s.length;u++)a[u]=Ps.addOrSubtract(i[u-l],s[u]);return new Zt(this.field,a)}multiply(r){if(!this.field.equals(r.field))throw new A("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,u=new Int32Array(s+l-1),d=this.field;for(let h=0;h<s;h++){const p=i[h];for(let w=0;w<l;w++)u[h+w]=Ps.addOrSubtract(u[h+w],d.multiply(p,a[w]))}return new Zt(d,u)}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 u=0;u<i;u++)a[u]=s.multiply(l[u],r);return new Zt(s,a)}multiplyByMonomial(r,i){if(r<0)throw new A;if(i===0)return this.field.getZero();const s=this.coefficients,a=s.length,l=new Int32Array(a+r),u=this.field;for(let d=0;d<a;d++)l[d]=u.multiply(s[d],i);return new Zt(u,l)}divide(r){if(!this.field.equals(r.field))throw new A("GenericGFPolys do not have same GenericGF field");if(r.isZero())throw new A("Divide by 0");const i=this.field;let s=i.getZero(),a=this;const l=r.getCoefficient(r.getDegree()),u=i.inverse(l);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){const d=a.getDegree()-r.getDegree(),h=i.multiply(a.getCoefficient(a.getDegree()),u),p=r.multiplyByMonomial(d,h),w=i.buildMonomial(d,h);s=s.addOrSubtract(w),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 oa extends x{}oa.kind="ArithmeticException";class Oe extends Ps{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 u=new Int32Array(i);for(let d=0;d<i-1;d++)u[a[d]]=d;this.logTable=u,this.zero=new Zt(this,Int32Array.from([0])),this.one=new Zt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new A;if(i===0)return this.zero;const s=new Int32Array(r+1);return s[0]=i,new Zt(this,s)}inverse(r){if(r===0)throw new oa;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"+_.toHexString(this.primitive)+","+this.size+")"}equals(r){return r===this}}Oe.AZTEC_DATA_12=new Oe(4201,4096,1),Oe.AZTEC_DATA_10=new Oe(1033,1024,1),Oe.AZTEC_DATA_6=new Oe(67,64,1),Oe.AZTEC_PARAM=new Oe(19,16,1),Oe.QR_CODE_FIELD_256=new Oe(285,256,0),Oe.DATA_MATRIX_FIELD_256=new Oe(301,256,1),Oe.AZTEC_DATA_8=Oe.DATA_MATRIX_FIELD_256,Oe.MAXICODE_FIELD_64=Oe.AZTEC_DATA_6;class Ni extends x{}Ni.kind="ReedSolomonException";class Hr extends x{}Hr.kind="IllegalStateException";class Ms{constructor(r){this.field=r}decode(r,i){const s=this.field,a=new Zt(s,r),l=new Int32Array(i);let u=!0;for(let b=0;b<i;b++){const D=a.evaluateAt(s.exp(b+s.getGeneratorBase()));l[l.length-1-b]=D,D!==0&&(u=!1)}if(u)return;const d=new Zt(s,l),h=this.runEuclideanAlgorithm(s.buildMonomial(i,1),d,i),p=h[0],w=h[1],E=this.findErrorLocations(p),S=this.findErrorMagnitudes(w,E);for(let b=0;b<E.length;b++){const D=r.length-1-s.log(E[b]);if(D<0)throw new Ni("Bad error location");r[D]=Oe.addOrSubtract(r[D],S[b])}}runEuclideanAlgorithm(r,i,s){if(r.getDegree()<i.getDegree()){const b=r;r=i,i=b}const a=this.field;let l=r,u=i,d=a.getZero(),h=a.getOne();for(;u.getDegree()>=(s/2|0);){let b=l,D=d;if(l=u,d=h,l.isZero())throw new Ni("r_{i-1} was zero");u=b;let M=a.getZero();const L=l.getCoefficient(l.getDegree()),$=a.inverse(L);for(;u.getDegree()>=l.getDegree()&&!u.isZero();){const Q=u.getDegree()-l.getDegree(),q=a.multiply(u.getCoefficient(u.getDegree()),$);M=M.addOrSubtract(a.buildMonomial(Q,q)),u=u.addOrSubtract(l.multiplyByMonomial(Q,q))}if(h=M.multiply(d).addOrSubtract(D),u.getDegree()>=l.getDegree())throw new Hr("Division algorithm failed to reduce polynomial?")}const p=h.getCoefficient(0);if(p===0)throw new Ni("sigmaTilde(0) was zero");const w=a.inverse(p),E=h.multiplyScalar(w),S=u.multiplyScalar(w);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 u=1;u<l.getSize()&&a<i;u++)r.evaluateAt(u)===0&&(s[a]=l.inverse(u),a++);if(a!==i)throw new Ni("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 u=0;u<s;u++){const d=l.inverse(i[u]);let h=1;for(let p=0;p<s;p++)if(u!==p){const w=l.multiply(i[p],d),E=w&1?w&-2:w|1;h=l.multiply(h,E)}a[u]=l.multiply(r.evaluateAt(d),l.inverse(h)),l.getGeneratorBase()!==0&&(a[u]=l.multiply(a[u],d))}return a}}var Rt;(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"})(Rt||(Rt={}));class Ue{decode(r){this.ddata=r;let i=r.getBits(),s=this.extractBits(i),a=this.correctBits(s),l=Ue.convertBoolArrayToByteArray(a),u=Ue.getEncodedData(a),d=new Ds(l,u,null,null);return d.setNumBits(a.length),d}static highLevelDecode(r){return this.getEncodedData(r)}static getEncodedData(r){let i=r.length,s=Rt.UPPER,a=Rt.UPPER,l="",u=0;for(;u<i;)if(a===Rt.BINARY){if(i-u<5)break;let d=Ue.readCode(r,u,5);if(u+=5,d===0){if(i-u<11)break;d=Ue.readCode(r,u,11)+31,u+=11}for(let h=0;h<d;h++){if(i-u<8){u=i;break}const p=Ue.readCode(r,u,8);l+=se.castAsNonUtf8Char(p),u+=8}a=s}else{let d=a===Rt.DIGIT?4:5;if(i-u<d)break;let h=Ue.readCode(r,u,d);u+=d;let p=Ue.getCharacter(a,h);p.startsWith("CTRL_")?(s=a,a=Ue.getTable(p.charAt(5)),p.charAt(6)==="L"&&(s=a)):(l+=p,a=s)}return l}static getTable(r){switch(r){case"L":return Rt.LOWER;case"P":return Rt.PUNCT;case"M":return Rt.MIXED;case"D":return Rt.DIGIT;case"B":return Rt.BINARY;case"U":default:return Rt.UPPER}}static getCharacter(r,i){switch(r){case Rt.UPPER:return Ue.UPPER_TABLE[i];case Rt.LOWER:return Ue.LOWER_TABLE[i];case Rt.MIXED:return Ue.MIXED_TABLE[i];case Rt.PUNCT:return Ue.PUNCT_TABLE[i];case Rt.DIGIT:return Ue.DIGIT_TABLE[i];default:throw new Hr("Bad table")}}correctBits(r){let i,s;this.ddata.getNbLayers()<=2?(s=6,i=Oe.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,i=Oe.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,i=Oe.AZTEC_DATA_10):(s=12,i=Oe.AZTEC_DATA_12);let a=this.ddata.getNbDatablocks(),l=r.length/s;if(l<a)throw new B;let u=r.length%s,d=new Int32Array(l);for(let S=0;S<l;S++,u+=s)d[S]=Ue.readCode(r,u,s);try{new Ms(i).decode(d,l-a)}catch(S){throw new B(S)}let h=(1<<s)-1,p=0;for(let S=0;S<a;S++){let b=d[S];if(b===0||b===h)throw new B;(b===1||b===h-1)&&p++}let w=new Array(a*s-p),E=0;for(let S=0;S<a;S++){let b=d[S];if(b===1||b===h-1)w.fill(b>1,E,E+s-1),E+=s-1;else for(let D=s-1;D>=0;--D)w[E++]=(b&1<<D)!==0}return w}extractBits(r){let i=this.ddata.isCompact(),s=this.ddata.getNbLayers(),a=(i?11:14)+s*4,l=new Int32Array(a),u=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*_.truncDivision(_.truncDivision(a,2)-1,15),h=a/2,p=_.truncDivision(d,2);for(let w=0;w<h;w++){let E=w+_.truncDivision(w,15);l[h-w-1]=p-E-1,l[h+w]=p+E+1}}for(let d=0,h=0;d<s;d++){let p=(s-d)*4+(i?9:12),w=d*2,E=a-1-w;for(let S=0;S<p;S++){let b=S*2;for(let D=0;D<2;D++)u[h+b+D]=r.get(l[w+D],l[w+S]),u[h+2*p+b+D]=r.get(l[w+S],l[E-D]),u[h+4*p+b+D]=r.get(l[E-D],l[E-S]),u[h+6*p+b+D]=r.get(l[E-S],l[w+D])}h+=p*8}return u}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?Ue.readCode(r,i,8):Ue.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]=Ue.readByte(r,8*s);return i}totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}Ue.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"],Ue.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"],Ue.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
66
66
|
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Ue.PUNCT_TABLE=["","\r",`\r
|
|
67
|
-
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ue.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,u=i-a;return Math.sqrt(l*l+u*u)}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 aa{static floatToIntBits(r){return r}}aa.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*aa.floatToIntBits(this.x)+aa.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,u,d;if(s>=i&&s>=a?(u=r[0],l=r[1],d=r[2]):a>=s&&a>=i?(u=r[1],l=r[0],d=r[2]):(u=r[2],l=r[0],d=r[1]),this.crossProductZ(l,u,d)<0){const h=l;l=d,d=h}r[0]=l,r[1]=u,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 la{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class Td extends la{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 an{constructor(r,i,s,a){this.image=r,this.height=r.getHeight(),this.width=r.getWidth(),i==null&&(i=an.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 H}detect(){let r=this.leftInit,i=this.rightInit,s=this.upInit,a=this.downInit,l=!1,u=!0,d=!1,h=!1,p=!1,w=!1,E=!1;const S=this.width,b=this.height;for(;u;){u=!1;let D=!0;for(;(D||!h)&&i<S;)D=this.containsBlackPoint(s,a,i,!1),D?(i++,u=!0,h=!0):h||i++;if(i>=S){l=!0;break}let P=!0;for(;(P||!p)&&a<b;)P=this.containsBlackPoint(r,i,a,!0),P?(a++,u=!0,p=!0):p||a++;if(a>=b){l=!0;break}let L=!0;for(;(L||!w)&&r>=0;)L=this.containsBlackPoint(s,a,r,!1),L?(r--,u=!0,w=!0):w||r--;if(r<0){l=!0;break}let $=!0;for(;($||!E)&&s>=0;)$=this.containsBlackPoint(r,i,s,!0),$?(s--,u=!0,E=!0):E||s--;if(s<0){l=!0;break}u&&(d=!0)}if(!l&&d){const D=i-r;let P=null;for(let q=1;P===null&&q<D;q++)P=this.getBlackPointOnSegment(r,a-q,r+q,a);if(P==null)throw new H;let L=null;for(let q=1;L===null&&q<D;q++)L=this.getBlackPointOnSegment(r,s+q,r+q,s);if(L==null)throw new H;let $=null;for(let q=1;$===null&&q<D;q++)$=this.getBlackPointOnSegment(i,s+q,i-q,s);if($==null)throw new H;let Q=null;for(let q=1;Q===null&&q<D;q++)Q=this.getBlackPointOnSegment(i,a-q,i-q,a);if(Q==null)throw new H;return this.centerEdges(Q,P,$,L)}else throw new H}getBlackPointOnSegment(r,i,s,a){const l=Re.round(Re.distance(r,i,s,a)),u=(s-r)/l,d=(a-i)/l,h=this.image;for(let p=0;p<l;p++){const w=Re.round(r+p*u),E=Re.round(i+p*d);if(h.get(w,E))return new ae(w,E)}return null}centerEdges(r,i,s,a){const l=r.getX(),u=r.getY(),d=i.getX(),h=i.getY(),p=s.getX(),w=s.getY(),E=a.getX(),S=a.getY(),b=an.CORR;return l<this.width/2?[new ae(E-b,S+b),new ae(d+b,h+b),new ae(p-b,w-b),new ae(l+b,u-b)]:[new ae(E+b,S+b),new ae(d+b,h-b),new ae(p-b,w+b),new ae(l-b,u-b)]}containsBlackPoint(r,i,s,a){const l=this.image;if(a){for(let u=r;u<=i;u++)if(l.get(u,s))return!0}else for(let u=r;u<=i;u++)if(l.get(s,u))return!0;return!1}}an.INIT_SIZE=10,an.CORR=1;class Wu{static checkAndNudgePoints(r,i){const s=r.getWidth(),a=r.getHeight();let l=!0;for(let u=0;u<i.length&&l;u+=2){const d=Math.floor(i[u]),h=Math.floor(i[u+1]);if(d<-1||d>s||h<-1||h>a)throw new H;l=!1,d===-1?(i[u]=0,l=!0):d===s&&(i[u]=s-1,l=!0),h===-1?(i[u+1]=0,l=!0):h===a&&(i[u+1]=a-1,l=!0)}l=!0;for(let u=i.length-2;u>=0&&l;u-=2){const d=Math.floor(i[u]),h=Math.floor(i[u+1]);if(d<-1||d>s||h<-1||h>a)throw new H;l=!1,d===-1?(i[u]=0,l=!0):d===s&&(i[u]=s-1,l=!0),h===-1?(i[u+1]=0,l=!0):h===a&&(i[u+1]=a-1,l=!0)}}}class Nr{constructor(r,i,s,a,l,u,d,h,p){this.a11=r,this.a21=i,this.a31=s,this.a12=a,this.a22=l,this.a32=u,this.a13=d,this.a23=h,this.a33=p}static quadrilateralToQuadrilateral(r,i,s,a,l,u,d,h,p,w,E,S,b,D,P,L){const $=Nr.quadrilateralToSquare(r,i,s,a,l,u,d,h);return Nr.squareToQuadrilateral(p,w,E,S,b,D,P,L).times($)}transformPoints(r){const i=r.length,s=this.a11,a=this.a12,l=this.a13,u=this.a21,d=this.a22,h=this.a23,p=this.a31,w=this.a32,E=this.a33;for(let S=0;S<i;S+=2){const b=r[S],D=r[S+1],P=l*b+h*D+E;r[S]=(s*b+u*D+p)/P,r[S+1]=(a*b+d*D+w)/P}}transformPointsWithValues(r,i){const s=this.a11,a=this.a12,l=this.a13,u=this.a21,d=this.a22,h=this.a23,p=this.a31,w=this.a32,E=this.a33,S=r.length;for(let b=0;b<S;b++){const D=r[b],P=i[b],L=l*D+h*P+E;r[b]=(s*D+u*P+p)/L,i[b]=(a*D+d*P+w)/L}}static squareToQuadrilateral(r,i,s,a,l,u,d,h){const p=r-s+l-d,w=i-a+u-h;if(p===0&&w===0)return new Nr(s-r,l-s,r,a-i,u-a,i,0,0,1);{const E=s-l,S=d-l,b=a-u,D=h-u,P=E*D-S*b,L=(p*D-S*w)/P,$=(E*w-p*b)/P;return new Nr(s-r+L*s,d-r+$*d,r,a-i+L*a,h-i+$*h,i,L,$,1)}}static quadrilateralToSquare(r,i,s,a,l,u,d,h){return Nr.squareToQuadrilateral(r,i,s,a,l,u,d,h).buildAdjoint()}buildAdjoint(){return new Nr(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 Nr(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 Rd extends Wu{sampleGrid(r,i,s,a,l,u,d,h,p,w,E,S,b,D,P,L,$,Q,q){const K=Nr.quadrilateralToQuadrilateral(a,l,u,d,h,p,w,E,S,b,D,P,L,$,Q,q);return this.sampleGridWithTransform(r,i,s,K)}sampleGridWithTransform(r,i,s,a){if(i<=0||s<=0)throw new H;const l=new Te(i,s),u=new Float32Array(2*i);for(let d=0;d<s;d++){const h=u.length,p=d+.5;for(let w=0;w<h;w+=2)u[w]=w/2+.5,u[w+1]=p;a.transformPoints(u),Wu.checkAndNudgePoints(r,u);try{for(let w=0;w<h;w+=2)r.get(Math.floor(u[w]),Math.floor(u[w+1]))&&l.set(w/2,d)}catch{throw new H}}return l}}class Tn{static setGridSampler(r){Tn.gridSampler=r}static getInstance(){return Tn.gridSampler}}Tn.gridSampler=new Rd;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 bd{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 u=s[0];s[0]=s[2],s[2]=u}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 Td(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 H;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 u=0;u<4;u++){let d=s[(this.shift+u)%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,u)=>{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(_.bitCount(s^this.EXPECTED_CORNER_BITS[a])<=2)return a;throw new H}getCorrectedParameterData(r,i){let s,a;i?(s=7,a=2):(s=10,a=4);let l=s-a,u=new Int32Array(s);for(let h=s-1;h>=0;--h)u[h]=r&15,r>>=4;try{new Ps(Oe.AZTEC_PARAM).decode(u,l)}catch{throw new H}let d=0;for(let h=0;h<a;h++)d=(d<<4)+u[h];return d}getBullsEyeCorners(r){let i=r,s=r,a=r,l=r,u=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(i,u,1,-1),S=this.getFirstDifferent(s,u,1,1),b=this.getFirstDifferent(a,u,-1,1),D=this.getFirstDifferent(l,u,-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,b,D))break}i=E,s=S,a=b,l=D,u=!u}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new H;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),w=new ae(l.getX()-.5,l.getY()-.5);return this.expandSquare([d,h,p,w],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let r,i,s,a;try{let d=new an(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),u=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4);try{let d=new an(this.image,15,l,u).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{r=this.getFirstDifferent(new Vt(l+7,u-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(l+7,u+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(l-7,u+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(l-7,u-7),!1,-1,-1).toResultPoint()}return l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),u=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4),new Vt(l,u)}getMatrixCornerPoints(r){return this.expandSquare(r,2*this.nbCenterLayers,this.getDimension())}sampleGrid(r,i,s,a,l){let u=Tn.getInstance(),d=this.getDimension(),h=d/2-this.nbCenterLayers,p=d/2+this.nbCenterLayers;return u.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),u=l/s,d=r.getX(),h=r.getY(),p=u*(i.getX()-r.getX())/l,w=u*(i.getY()-r.getY())/l;for(let E=0;E<s;E++)this.image.get(Re.round(d+E*p),Re.round(h+E*w))&&(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 u=this.getColor(a,r);if(u===0)return!1;let d=this.getColor(r,i);return d!==u||(d=this.getColor(i,s),d!==u)?!1:(d=this.getColor(s,a),d===u)}getColor(r,i){let s=this.distancePoint(r,i),a=(i.getX()-r.getX())/s,l=(i.getY()-r.getY())/s,u=0,d=r.getX(),h=r.getY(),p=this.image.get(r.getX(),r.getY()),w=Math.ceil(s);for(let S=0;S<w;S++)d+=a,h+=l,this.image.get(Re.round(d),Re.round(h))!==p&&u++;let E=u/s;return E>.1&&E<.9?0:E<=.1===p?1:-1}getFirstDifferent(r,i,s,a){let l=r.getX()+s,u=r.getY()+a;for(;this.isValid(l,u)&&this.image.get(l,u)===i;)l+=s,u+=a;for(l-=s,u-=a;this.isValid(l,u)&&this.image.get(l,u)===i;)l+=s;for(l-=s;this.isValid(l,u)&&this.image.get(l,u)===i;)u+=a;return u-=a,new Vt(l,u)}expandSquare(r,i,s){let a=s/(2*i),l=r[0].getX()-r[2].getX(),u=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*u),w=new ae(d-a*l,h-a*u);l=r[1].getX()-r[3].getX(),u=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*u),S=new ae(d-a*l,h-a*u);return[p,E,w,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*(_.truncDivision(this.nbLayers-4,8)+1)+15}}class ua{decode(r,i=null){let s=null,a=new bd(r.getBlackMatrix()),l=null,u=null;try{let w=a.detectMirror(!1);l=w.getPoints(),this.reportFoundResultPoints(i,l),u=new Ue().decode(w)}catch(w){s=w}if(u==null)try{let w=a.detectMirror(!0);l=w.getPoints(),this.reportFoundResultPoints(i,l),u=new Ue().decode(w)}catch(w){throw s??w}let d=new Ke(u.getText(),u.getRawBytes(),u.getNumBits(),l,le.AZTEC,M.currentTimeMillis()),h=u.getByteSegments();h!=null&&d.putMetadata(Ct.BYTE_SEGMENTS,h);let p=u.getECLevel();return p!=null&&d.putMetadata(Ct.ERROR_CORRECTION_LEVEL,p),d}reportFoundResultPoints(r,i){if(r!=null){let s=r.get(j.NEED_RESULT_POINT_CALLBACK);s!=null&&i.forEach((a,l,u)=>{s.foundPossibleResultPoint(a)})}}reset(){}}class mv extends yr{constructor(r=500){super(new ua,r)}}class dt{decode(r,i){try{return this.doDecode(r,i)}catch{if(i&&i.get(j.TRY_HARDER)===!0&&r.isRotateSupported()){const l=r.rotateCounterClockwise(),u=this.doDecode(l,i),d=u.getResultMetadata();let h=270;d!==null&&d.get(Ct.ORIENTATION)===!0&&(h=h+d.get(Ct.ORIENTATION)%360),u.putMetadata(Ct.ORIENTATION,h);const p=u.getResultPoints();if(p!==null){const w=l.getHeight();for(let E=0;E<p.length;E++)p[E]=new ae(w-p[E].getY()-1,p[E].getX())}return u}else throw new H}}reset(){}doDecode(r,i){const s=r.getWidth(),a=r.getHeight();let l=new U(s);const u=i&&i.get(j.TRY_HARDER)===!0,d=Math.max(1,a>>(u?8:5));let h;u?h=a:h=15;const p=Math.trunc(a/2);for(let w=0;w<h;w++){const E=Math.trunc((w+1)/2),S=(w&1)===0,b=p+d*(S?E:-E);if(b<0||b>=a)break;try{l=r.getBlackRow(b,l)}catch{continue}for(let D=0;D<2;D++){if(D===1&&(l.reverse(),i&&i.get(j.NEED_RESULT_POINT_CALLBACK)===!0)){const P=new Map;i.forEach((L,$)=>P.set($,L)),P.delete(j.NEED_RESULT_POINT_CALLBACK),i=P}try{const P=this.decodeRow(b,l,i);if(D===1){P.putMetadata(Ct.ORIENTATION,180);const L=P.getResultPoints();L!==null&&(L[0]=new ae(s-L[0].getX()-1,L[0].getY()),L[1]=new ae(s-L[1].getX()-1,L[1].getY()))}return P}catch{}}}throw new H}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 H;let u=!r.get(i),d=0,h=i;for(;h<l;){if(r.get(h)!==u)s[d]++;else{if(++d===a)break;s[d]=1,u=!u}h++}if(!(d===a||d===a-1&&h===l))throw new H}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 H;dt.recordPattern(r,i+1,s)}static patternMatchVariance(r,i,s){const a=r.length;let l=0,u=0;for(let p=0;p<a;p++)l+=r[p],u+=i[p];if(l<u)return Number.POSITIVE_INFINITY;const d=l/u;s*=d;let h=0;for(let p=0;p<a;p++){const w=r[p],E=i[p]*d,S=w>E?w-E:E-w;if(S>s)return Number.POSITIVE_INFINITY;h+=S}return h/l}}class J extends dt{static findStartPattern(r){const i=r.getSize(),s=r.getNextSet(0);let a=0,l=Int32Array.from([0,0,0,0,0,0]),u=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 w=J.MAX_AVG_VARIANCE,E=-1;for(let S=J.CODE_START_A;S<=J.CODE_START_C;S++){const b=dt.patternMatchVariance(l,J.CODE_PATTERNS[S],J.MAX_INDIVIDUAL_VARIANCE);b<w&&(w=b,E=S)}if(E>=0&&r.isRange(Math.max(0,u-(p-u)/2),u,!1))return Int32Array.from([u,p,E]);u+=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 H}static decodeCode(r,i,s){dt.recordPattern(r,s,i);let a=J.MAX_AVG_VARIANCE,l=-1;for(let u=0;u<J.CODE_PATTERNS.length;u++){const d=J.CODE_PATTERNS[u],h=this.patternMatchVariance(i,d,J.MAX_INDIVIDUAL_VARIANCE);h<a&&(a=h,l=u)}if(l>=0)return l;throw new H}decodeRow(r,i,s){const a=s&&s.get(j.ASSUME_GS1)===!0,l=J.findStartPattern(i),u=l[2];let d=0;const h=new Uint8Array(20);h[d++]=u;let p;switch(u){case J.CODE_START_A:p=J.CODE_CODE_A;break;case J.CODE_START_B:p=J.CODE_CODE_B;break;case J.CODE_START_C:p=J.CODE_CODE_C;break;default:throw new B}let w=!1,E=!1,S="",b=l[0],D=l[1];const P=Int32Array.from([0,0,0,0,0,0]);let L=0,$=0,Q=u,q=0,K=!0,Ae=!1,me=!1;for(;!w;){const ji=E;switch(E=!1,L=$,$=J.decodeCode(i,P,D),h[d++]=$,$!==J.CODE_STOP&&(K=!0),$!==J.CODE_STOP&&(q++,Q+=q*$),b=D,D+=P.reduce((Gv,Xv)=>Gv+Xv,0),$){case J.CODE_START_A:case J.CODE_START_B:case J.CODE_START_C:throw new B}switch(p){case J.CODE_CODE_A:if($<64)me===Ae?S+=String.fromCharCode(32+$):S+=String.fromCharCode(32+$+128),me=!1;else if($<96)me===Ae?S+=String.fromCharCode($-64):S+=String.fromCharCode($+64),me=!1;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_A:!Ae&&me?(Ae=!0,me=!1):Ae&&me?(Ae=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,p=J.CODE_CODE_B;break;case J.CODE_CODE_B:p=J.CODE_CODE_B;break;case J.CODE_CODE_C:p=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_B:if($<96)me===Ae?S+=String.fromCharCode(32+$):S+=String.fromCharCode(32+$+128),me=!1;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_B:!Ae&&me?(Ae=!0,me=!1):Ae&&me?(Ae=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,p=J.CODE_CODE_A;break;case J.CODE_CODE_A:p=J.CODE_CODE_A;break;case J.CODE_CODE_C:p=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_C:if($<100)$<10&&(S+="0"),S+=$;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_CODE_A:p=J.CODE_CODE_A;break;case J.CODE_CODE_B:p=J.CODE_CODE_B;break;case J.CODE_STOP:w=!0;break}break}ji&&(p=p===J.CODE_CODE_A?J.CODE_CODE_B:J.CODE_CODE_A)}const er=D-b;if(D=i.getNextUnset(D),!i.isRange(D,Math.min(i.getSize(),D+(D-b)/2),!1))throw new H;if(Q-=q*L,Q%103!==L)throw new O;const Mr=S.length;if(Mr===0)throw new H;Mr>0&&K&&(p===J.CODE_CODE_C?S=S.substring(0,Mr-2):S=S.substring(0,Mr-1));const tr=(l[1]+l[0])/2,Fe=b+er/2,Ot=h.length,cr=new Uint8Array(Ot);for(let ji=0;ji<Ot;ji++)cr[ji]=h[ji];const Ui=[new ae(tr,r),new ae(Fe,r)];return new Ke(S,cr,0,Ui,le.CODE_128,new Date().getTime())}}J.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])],J.MAX_AVG_VARIANCE=.25,J.MAX_INDIVIDUAL_VARIANCE=.7,J.CODE_SHIFT=98,J.CODE_CODE_C=99,J.CODE_CODE_B=100,J.CODE_CODE_A=101,J.CODE_FNC_1=102,J.CODE_FNC_2=97,J.CODE_FNC_3=96,J.CODE_FNC_4_A=101,J.CODE_FNC_4_B=100,J.CODE_START_A=103,J.CODE_START_B=104,J.CODE_START_C=105,J.CODE_STOP=106;class pt extends dt{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=pt.findAsteriskPattern(i,a),u=i.getNextSet(l[1]),d=i.getSize(),h,p;do{pt.recordPattern(i,u,a);let P=pt.toNarrowWidePattern(a);if(P<0)throw new H;h=pt.patternToChar(P),this.decodeRowResult+=h,p=u;for(let L of a)u+=L;u=i.getNextSet(u)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let w=0;for(let P of a)w+=P;let E=u-p-w;if(u!==d&&E*2<w)throw new H;if(this.usingCheckDigit){let P=this.decodeRowResult.length-1,L=0;for(let $=0;$<P;$++)L+=pt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt($));if(this.decodeRowResult.charAt(P)!==pt.ALPHABET_STRING.charAt(L%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,P)}if(this.decodeRowResult.length===0)throw new H;let S;this.extendedMode?S=pt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let b=(l[1]+l[0])/2,D=p+w/2;return new Ke(S,null,0,[new ae(b,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,u=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)===pt.ASTERISK_ENCODING&&r.isRange(Math.max(0,u-Math.floor((p-u)/2)),u,!1))return[u,p];u+=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 H}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 u=0,d=0;for(let h=0;h<i;h++){let p=r[h];p>s&&(d|=1<<i-1-h,a++,u+=p)}if(a===3){for(let h=0;h<i&&a>0;h++){let p=r[h];if(p>s&&(a--,p*2>=u))return-1}return d}}while(a>3);return-1}static patternToChar(r){for(let i=0;i<pt.CHARACTER_ENCODINGS.length;i++)if(pt.CHARACTER_ENCODINGS[i]===r)return pt.ALPHABET_STRING.charAt(i);if(r===pt.ASTERISK_ENCODING)return"*";throw new H}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 u=r.charAt(a+1),d="\0";switch(l){case"+":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)+32);else throw new B;break;case"$":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)-64);else throw new B;break;case"%":if(u>="A"&&u<="E")d=String.fromCharCode(u.charCodeAt(0)-38);else if(u>="F"&&u<="J")d=String.fromCharCode(u.charCodeAt(0)-11);else if(u>="K"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)+16);else if(u>="P"&&u<="T")d=String.fromCharCode(u.charCodeAt(0)+43);else if(u==="U")d="\0";else if(u==="V")d="@";else if(u==="W")d="`";else if(u==="X"||u==="Y"||u==="Z")d="";else throw new B;break;case"/":if(u>="A"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)-32);else if(u==="Z")d=":";else throw new B;break}s+=d,a++}else s+=l}return s}}pt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",pt.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],pt.ASTERISK_ENCODING=148;class Be extends dt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(r,i,s){let a=this.decodeStart(i),l=this.decodeEnd(i),u=new ge;Be.decodeMiddle(i,a[1],l[0],u);let d=u.toString(),h=null;s!=null&&(h=s.get(j.ALLOWED_LENGTHS)),h==null&&(h=Be.DEFAULT_ALLOWED_LENGTHS);let p=d.length,w=!1,E=0;for(let D of h){if(p===D){w=!0;break}D>E&&(E=D)}if(!w&&p>E&&(w=!0),!w)throw new B;const S=[new ae(a[1],r),new ae(l[0],r)];return new Ke(d,null,0,S,le.ITF,new Date().getTime())}static decodeMiddle(r,i,s,a){let l=new Int32Array(10),u=new Int32Array(5),d=new Int32Array(5);for(l.fill(0),u.fill(0),d.fill(0);i<s;){dt.recordPattern(r,i,l);for(let p=0;p<5;p++){let w=2*p;u[p]=l[w],d[p]=l[w+1]}let h=Be.decodeDigit(u);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 H}static skipWhiteSpace(r){const i=r.getSize(),s=r.getNextSet(0);if(s===i)throw new H;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 H&&(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),u=r.getSize(),d=!1,h=0,p=i;l.fill(0);for(let w=i;w<u;w++)if(r.get(w)!==d)l[h]++;else{if(h===a-1){if(dt.patternMatchVariance(l,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[p,w];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 H}static decodeDigit(r){let i=Be.MAX_AVG_VARIANCE,s=-1,a=Be.PATTERNS.length;for(let l=0;l<a;l++){let u=Be.PATTERNS[l],d=dt.patternMatchVariance(r,u,Be.MAX_INDIVIDUAL_VARIANCE);d<i?(i=d,s=l):d===i&&(s=-1)}if(s>=0)return s%10;throw new H}}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 rt extends dt{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=rt.findGuardPattern(r,a,!1,this.START_END_PATTERN,l);let u=s[0];a=s[1];let d=u-(a-u);d>=0&&(i=r.isRange(d,u,!1))}return s}static checkChecksum(r){return rt.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return rt.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 B;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 B;s+=l}return(1e3-s)%10}static decodeEnd(r,i){return rt.findGuardPattern(r,i,!1,rt.START_END_PATTERN,new Int32Array(rt.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 u=r.getSize();i=s?r.getNextUnset(i):r.getNextSet(i);let d=0,h=i,p=a.length,w=s;for(let E=i;E<u;E++)if(r.get(E)!==w)l[d]++;else{if(d===p-1){if(dt.patternMatchVariance(l,a,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([h,E]);h+=l[0]+l[1];let S=l.slice(2,l.length-1);for(let b=0;b<d-1;b++)l[b]=S[b];l[d-1]=0,l[d]=0,d--}else d++;l[d]=1,w=!w}throw new H}static decodeDigit(r,i,s,a){this.recordPattern(r,s,i);let l=this.MAX_AVG_VARIANCE,u=-1,d=a.length;for(let h=0;h<d;h++){let p=a[h],w=dt.patternMatchVariance(i,p,rt.MAX_INDIVIDUAL_VARIANCE);w<l&&(l=w,u=h)}if(u>=0)return u;throw new H}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 ks{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),u=a.toString(),d=ks.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ke(u,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(),u=i[1],d=0;for(let p=0;p<5&&u<l;p++){let w=rt.decodeDigit(r,a,u,rt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<4-p),p!==4&&(u=r.getNextSet(u),u=r.getNextUnset(u))}if(s.length!==5)throw new H;let h=this.determineCheckDigit(d);if(ks.extensionChecksum(s.toString())!==h)throw new H;return u}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 H}static parseExtensionString(r){if(r.length!==5)return null;let i=ks.parseExtension5String(r);return i==null?null:new Map([[Ct.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,u=l<10?"0"+l:l.toString();return i+a+"."+u}}class $u{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),u=a.toString(),d=$u.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ke(u,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(),u=i[1],d=0;for(let h=0;h<2&&u<l;h++){let p=rt.decodeDigit(r,a,u,rt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+p%10);for(let w of a)u+=w;p>=10&&(d|=1<<1-h),h!==1&&(u=r.getNextSet(u),u=r.getNextUnset(u))}if(s.length!==2)throw new H;if(parseInt(s.toString())%4!==d)throw new H;return u}static parseExtensionString(r){return r.length!==2?null:new Map([[Ct.ISSUE_NUMBER,parseInt(r)]])}}class _d{static decodeRow(r,i,s){let a=rt.findGuardPattern(i,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ks().decodeRow(r,i,a)}catch{return new $u().decodeRow(r,i,a)}}}_d.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ne extends rt{constructor(){super(),this.decodeRowStringBuffer="",Ne.L_AND_G_PATTERNS=Ne.L_PATTERNS.map(r=>Int32Array.from(r));for(let r=10;r<20;r++){let i=Ne.L_PATTERNS[r-10],s=new Int32Array(i.length);for(let a=0;a<i.length;a++)s[a]=i[i.length-a-1];Ne.L_AND_G_PATTERNS[r]=s}}decodeRow(r,i,s){let a=Ne.findStartGuardPattern(i),l=s==null?null:s.get(j.NEED_RESULT_POINT_CALLBACK);if(l!=null){const K=new ae((a[0]+a[1])/2,r);l.foundPossibleResultPoint(K)}let u=this.decodeMiddle(i,a,this.decodeRowStringBuffer),d=u.rowOffset,h=u.resultString;if(l!=null){const K=new ae(d,r);l.foundPossibleResultPoint(K)}let p=this.decodeEnd(i,d);if(l!=null){const K=new ae((p[0]+p[1])/2,r);l.foundPossibleResultPoint(K)}let w=p[1],E=w+(w-p[0]);if(E>=i.getSize()||!i.isRange(w,E,!1))throw new H;let S=h.toString();if(S.length<8)throw new B;if(!Ne.checkChecksum(S))throw new O;let b=(a[1]+a[0])/2,D=(p[1]+p[0])/2,P=this.getBarcodeFormat(),L=[new ae(b,r),new ae(D,r)],$=new Ke(S,null,0,L,P,new Date().getTime()),Q=0;try{let K=_d.decodeRow(r,i,p[1]);$.putMetadata(Ct.UPC_EAN_EXTENSION,K.getText()),$.putAllMetadata(K.getResultMetadata()),$.addResultPoints(K.getResultPoints()),Q=K.getText().length}catch{}let q=s==null?null:s.get(j.ALLOWED_EAN_EXTENSIONS);if(q!=null){let K=!1;for(let Ae in q)if(Q.toString()===Ae){K=!0;break}if(!K)throw new H}return $}decodeEnd(r,i){return Ne.findGuardPattern(r,i,!1,Ne.START_END_PATTERN,new Int32Array(Ne.START_END_PATTERN.length).fill(0))}static checkChecksum(r){return Ne.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return Ne.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 B;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 B;s+=l}return(1e3-s)%10}}class ii extends Ne{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(),u=i[1],d=0;for(let p=0;p<6&&u<l;p++){let w=Ne.decodeDigit(r,a,u,Ne.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<5-p)}s=ii.determineFirstDigit(s,d),u=Ne.findGuardPattern(r,u,!0,Ne.MIDDLE_PATTERN,new Int32Array(Ne.MIDDLE_PATTERN.length).fill(0))[1];for(let p=0;p<6&&u<l;p++){let w=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+w);for(let E of a)u+=E}return{rowOffset:u,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 H}}ii.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Od extends Ne{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(),u=i[1];for(let h=0;h<4&&u<l;h++){let p=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+p);for(let w of a)u+=w}u=Ne.findGuardPattern(r,u,!0,Ne.MIDDLE_PATTERN,new Int32Array(Ne.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<4&&u<l;h++){let p=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+p);for(let w of a)u+=w}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class Nd extends Ne{constructor(){super(...arguments),this.ean13Reader=new ii}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 Ke(i.substring(1),null,null,r.getResultPoints(),le.UPC_A);return r.getResultMetadata()!=null&&s.putAllMetadata(r.getResultMetadata()),s}else throw new H}reset(){this.ean13Reader.reset()}}class Dr extends Ne{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 u=i[1],d=0;for(let p=0;p<6&&u<l;p++){const w=Dr.decodeDigit(r,a,u,Dr.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<5-p)}let h=Dr.determineNumSysAndCheckDigit(s,d);return{rowOffset:u,resultString:h}}decodeEnd(r,i){return Dr.findGuardPatternWithoutCounters(r,i,!0,Dr.MIDDLE_END_PATTERN)}checkChecksum(r){return Ne.checkChecksum(Dr.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),u=String.fromCharCode(48+a);return l+r+u}throw H.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(r){const i=r.slice(1,7).split("").map(l=>l.charCodeAt(0)),s=new ge;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()}}Dr.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Dr.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 Vu extends dt{constructor(r){super();let i=r==null?null:r.get(j.POSSIBLE_FORMATS),s=[];o(i)?(s.push(new ii),s.push(new Nd),s.push(new Od),s.push(new Dr)):(i.indexOf(le.EAN_13)>-1&&s.push(new ii),i.indexOf(le.UPC_A)>-1&&s.push(new Nd),i.indexOf(le.EAN_8)>-1&&s.push(new Od),i.indexOf(le.UPC_E)>-1&&s.push(new Dr)),this.readers=s}decodeRow(r,i,s){for(let a of this.readers)try{const l=a.decodeRow(r,i,s),u=l.getBarcodeFormat()===le.EAN_13&&l.getText().charAt(0)==="0",d=s==null?null:s.get(j.POSSIBLE_FORMATS),h=d==null||d.includes(le.UPC_A);if(u&&h){const p=l.getRawBytes(),w=new Ke(l.getText().substring(1),p,p?p.length:null,l.getResultPoints(),le.UPC_A);return w.putAllMetadata(l.getResultMetadata()),w}return l}catch{}throw new H}reset(){for(let r of this.readers)r.reset()}}class Lt extends dt{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(dt.patternMatchVariance(r,i[s],Lt.MAX_INDIVIDUAL_VARIANCE)<Lt.MAX_AVG_VARIANCE)return s;throw new H}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>=Lt.MIN_FINDER_PATTERN_RATIO&&a<=Lt.MAX_FINDER_PATTERN_RATIO){let l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;for(let d of r)d>u&&(u=d),d<l&&(l=d);return u<10*l}return!1}}Lt.MAX_AVG_VARIANCE=.2,Lt.MAX_INDIVIDUAL_VARIANCE=.45,Lt.MIN_FINDER_PATTERN_RATIO=9.5/12,Lt.MAX_FINDER_PATTERN_RATIO=12.5/14;class Di{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 Di))return!1;const i=r;return this.value===i.value&&this.checksumPortion===i.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ca{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 ca))return!1;const i=r;return this.value===i.value}hashCode(){return this.value}}class Gr{constructor(){}static getRSSvalue(r,i,s){let a=0;for(let h of r)a+=h;let l=0,u=0,d=r.length;for(let h=0;h<d-1;h++){let p;for(p=1,u|=1<<h;p<r[h];p++,u&=~(1<<h)){let w=Gr.combins(a-p-1,d-h-2);if(s&&u===0&&a-p-(d-h-1)>=d-h-1&&(w-=Gr.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+=Gr.combins(a-p-S-1,d-h-3);w-=E*(d-1-h)}else a-p>i&&w--;l+=w}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,u=1;for(let d=r;d>s;d--)l*=d,u<=a&&(l/=u,u++);for(;u<=a;)l/=u,u++;return l}}class wv{static buildBitArray(r){let i=r.length*2-1;r[r.length-1].getRightChar()==null&&(i-=1);let s=12*i,a=new U(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],w=p.getLeftChar().getValue();for(let E=11;E>=0;--E)w&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 si{constructor(r,i){i?this.decodedInformation=null:(this.finished=r,this.decodedInformation=i)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class zu{constructor(r){this.newPosition=r}getNewPosition(){return this.newPosition}}class Qt extends zu{constructor(r,i){super(r),this.value=i}getValue(){return this.value}isFNC1(){return this.value===Qt.FNC1}}Qt.FNC1="$";class oi extends zu{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 Er extends zu{constructor(r,i,s){if(super(r),i<0||i>10||s<0||s>10)throw new B;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===Er.FNC1}isSecondDigitFNC1(){return this.secondDigit===Er.FNC1}isAnyFNC1(){return this.firstDigit===Er.FNC1||this.secondDigit===Er.FNC1}}Er.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(r){if(!r)return null;if(r.length<2)throw new H;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 H;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 H;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 H}static processFixedAI(r,i,s){if(s.length<r)throw new H;let a=s.substring(0,r);if(s.length<r+i)throw new H;let l=s.substring(r,r+i),u=s.substring(r+i),d="("+a+")"+l,h=ne.parseFieldsInGeneralPurpose(u);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 u=s.substring(r,l),d=s.substring(l),h="("+a+")"+u,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 Mi{constructor(r){this.buffer=new ge,this.information=r}decodeAllCodes(r,i){let s=i,a=null;do{let l=this.decodeGeneralPurposeField(s,a),u=ne.parseFieldsInGeneralPurpose(l.getNewString());if(u!=null&&r.append(u),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 Er(this.information.getSize(),Er.FNC1,Er.FNC1):new Er(this.information.getSize(),l-1,Er.FNC1)}let i=this.extractNumericValueFromBitArray(r,7),s=(i-8)/11,a=(i-8)%11;return new Er(r+7,s,a)}extractNumericValueFromBitArray(r,i){return Mi.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 oi(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new oi(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 oi(this.current.getPosition(),this.buffer.toString()):i=new oi(this.current.getPosition(),this.buffer.toString(),r.getSecondDigit()),new si(!0,i)}if(this.buffer.append(r.getFirstDigit()),r.isSecondDigitFNC1()){let i=new oi(this.current.getPosition(),this.buffer.toString());return new si(!0,i)}this.buffer.append(r.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new si(!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 oi(this.current.getPosition(),this.buffer.toString());return new si(!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 si(!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 oi(this.current.getPosition(),this.buffer.toString());return new si(!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 si(!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 B}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 Hr("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 Hu{constructor(r){this.information=r,this.generalDecoder=new Mi(r)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class qt extends Hu{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)}qt.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)}}qt.GTIN_SIZE=40;class Pi extends qt{constructor(r){super(r)}parseInformation(){let r=new ge;r.append("(01)");let i=r.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(Pi.HEADER_SIZE,4);return r.append(s),this.encodeCompressedGtinWithoutAI(r,Pi.HEADER_SIZE+4,i),this.getGeneralDecoder().decodeAllCodes(r,Pi.HEADER_SIZE+44)}}Pi.HEADER_SIZE=4;class fa extends Hu{constructor(r){super(r)}parseInformation(){let r=new ge;return this.getGeneralDecoder().decodeAllCodes(r,fa.HEADER_SIZE)}}fa.HEADER_SIZE=5;class da extends qt{constructor(r){super(r)}encodeCompressedWeight(r,i,s){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(i,s);this.addWeightCode(r,a);let l=this.checkWeight(a),u=1e5;for(let d=0;d<5;++d)l/u===0&&r.append("0"),u/=10;r.append(l)}}class Xr extends da{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()!=Xr.HEADER_SIZE+da.GTIN_SIZE+Xr.WEIGHT_SIZE)throw new H;let r=new ge;return this.encodeCompressedGtin(r,Xr.HEADER_SIZE),this.encodeCompressedWeight(r,Xr.HEADER_SIZE+da.GTIN_SIZE,Xr.WEIGHT_SIZE),r.toString()}}Xr.HEADER_SIZE=5,Xr.WEIGHT_SIZE=15;class vv extends Xr{constructor(r){super(r)}addWeightCode(r,i){r.append("(3103)")}checkWeight(r){return r}}class yv extends Xr{constructor(r){super(r)}addWeightCode(r,i){i<1e4?r.append("(3202)"):r.append("(3203)")}checkWeight(r){return r<1e4?r:r-1e4}}class Yr extends qt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Yr.HEADER_SIZE+qt.GTIN_SIZE)throw new H;let r=new ge;this.encodeCompressedGtin(r,Yr.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Yr.HEADER_SIZE+qt.GTIN_SIZE,Yr.LAST_DIGIT_SIZE);r.append("(392"),r.append(i),r.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Yr.HEADER_SIZE+qt.GTIN_SIZE+Yr.LAST_DIGIT_SIZE,null);return r.append(s.getNewString()),r.toString()}}Yr.HEADER_SIZE=8,Yr.LAST_DIGIT_SIZE=2;class zt extends qt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<zt.HEADER_SIZE+qt.GTIN_SIZE)throw new H;let r=new ge;this.encodeCompressedGtin(r,zt.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(zt.HEADER_SIZE+qt.GTIN_SIZE,zt.LAST_DIGIT_SIZE);r.append("(393"),r.append(i),r.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(zt.HEADER_SIZE+qt.GTIN_SIZE+zt.LAST_DIGIT_SIZE,zt.FIRST_THREE_DIGITS_SIZE);s/100==0&&r.append("0"),s/10==0&&r.append("0"),r.append(s);let a=this.getGeneralDecoder().decodeGeneralPurposeField(zt.HEADER_SIZE+qt.GTIN_SIZE+zt.LAST_DIGIT_SIZE+zt.FIRST_THREE_DIGITS_SIZE,null);return r.append(a.getNewString()),r.toString()}}zt.HEADER_SIZE=8,zt.LAST_DIGIT_SIZE=2,zt.FIRST_THREE_DIGITS_SIZE=10;class Ge extends da{constructor(r,i,s){super(r),this.dateCode=s,this.firstAIdigits=i}parseInformation(){if(this.getInformation().getSize()!=Ge.HEADER_SIZE+Ge.GTIN_SIZE+Ge.WEIGHT_SIZE+Ge.DATE_SIZE)throw new H;let r=new ge;return this.encodeCompressedGtin(r,Ge.HEADER_SIZE),this.encodeCompressedWeight(r,Ge.HEADER_SIZE+Ge.GTIN_SIZE,Ge.WEIGHT_SIZE),this.encodeCompressedDate(r,Ge.HEADER_SIZE+Ge.GTIN_SIZE+Ge.WEIGHT_SIZE),r.toString()}encodeCompressedDate(r,i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(i,Ge.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 u=s;u/10==0&&r.append("0"),r.append(u),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}}Ge.HEADER_SIZE=8,Ge.WEIGHT_SIZE=20,Ge.DATE_SIZE=16;function Dd(y){try{if(y.get(1))return new Pi(y);if(!y.get(2))return new fa(y);switch(Mi.extractNumericValueFromBitArray(y,1,4)){case 4:return new vv(y);case 5:return new yv(y)}switch(Mi.extractNumericValueFromBitArray(y,1,5)){case 12:return new Yr(y);case 13:return new zt(y)}switch(Mi.extractNumericValueFromBitArray(y,1,7)){case 56:return new Ge(y,"310","11");case 57:return new Ge(y,"320","11");case 58:return new Ge(y,"310","13");case 59:return new Ge(y,"320","13");case 60:return new Ge(y,"310","15");case 61:return new Ge(y,"320","15");case 62:return new Ge(y,"310","17");case 63:return new Ge(y,"320","17")}}catch(r){throw console.log(r),new Hr("unknown decoder: "+y)}}class Rn{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 Rn?Rn.equalsOrNull(r.leftchar,i.leftchar)&&Rn.equalsOrNull(r.rightchar,i.rightchar)&&Rn.equalsOrNull(r.finderpattern,i.finderpattern):!1}static equalsOrNull(r,i){return r===null?i===null:Rn.equals(r,i)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Gu{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 Gu?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(u=>{a.getLeftChar().getValue()===u.getLeftChar().getValue()&&a.getRightChar().getValue()===u.getRightChar().getValue()&&a.getFinderPatter().getValue()===u.getFinderPatter().getValue()&&(s=!0)})}),s}}class Y extends Lt{constructor(r){super(...arguments),this.pairs=new Array(Y.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 Y.constructResult(this.decodeRow2pairs(r,i))}catch(a){this.verbose&&console.log(a)}return this.pairs.length=0,this.startFromEven=!0,Y.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 H){if(!this.pairs.length)throw new H;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 H}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 u of r)this.pairs.push(u.getPairs());if(this.pairs.push(a.getPairs()),!Y.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(u){this.verbose&&console.log(u)}}throw new H}static isValidSequence(r){for(let i of Y.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 u=this.rows[s];if(u.getRowNumber()>r){l=u.isEquivalent(this.pairs);break}a=u.isEquivalent(this.pairs),s++}l||a||Y.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new Gu(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(Rn.equals(a,l))break}}static isPartialRow(r,i){for(let s of i){let a=!0;for(let l of r){let u=!1;for(let d of s.getPairs())if(l.equals(d)){u=!0;break}if(!u){a=!1;break}}if(a)return!0}return!1}getRows(){return this.rows}static constructResult(r){let i=wv.buildBitArray(r),a=Dd(i).parseInformation(),l=r[0].getFinderPattern().getResultPoints(),u=r[r.length-1].getFinderPattern().getResultPoints(),d=[l[0],l[1],u[0],u[1]];return new Ke(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,u=!0,d=-1;do this.findNextPair(r,i,d),l=this.parseFoundFinderPattern(r,s,a),l==null?d=Y.getNextSecondBar(r,this.startEnd[0]):u=!1;while(u);let h=this.decodeDataCharacter(r,l,a,!0);if(!this.isEmptyPair(i)&&i[i.length-1].mustBeLast())throw new H;let p;try{p=this.decodeDataCharacter(r,l,a,!1)}catch(w){p=null,this.verbose&&console.log(w)}return new Rn(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(),u;s>=0?u=s:this.isEmptyPair(i)?u=0:u=i[i.length-1].getFinderPattern().getStartEnd()[1];let d=i.length%2!=0;this.startFromEven&&(d=!d);let h=!1;for(;u<l&&(h=!r.get(u),!!h);)u++;let p=0,w=u;for(let E=u;E<l;E++)if(r.get(E)!=h)a[p]++;else{if(p==3){if(d&&Y.reverseCounters(a),Y.isFinderPattern(a)){this.startEnd[0]=w,this.startEnd[1]=E;return}d&&Y.reverseCounters(a),w+=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 H}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,u;if(s){let p=this.startEnd[0]-1;for(;p>=0&&!r.get(p);)p--;p++,a=this.startEnd[0]-p,l=p,u=this.startEnd[1]}else l=this.startEnd[0],u=r.getNextUnset(this.startEnd[1]+1),a=u-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,Y.FINDER_PATTERNS)}catch{return null}return new ca(h,[l,u],l,u,i)}decodeDataCharacter(r,i,s,a){let l=this.getDataCharacterCounters();for(let Fe=0;Fe<l.length;Fe++)l[Fe]=0;if(a)Y.recordPatternInReverse(r,i.getStartEnd()[0],l);else{Y.recordPattern(r,i.getStartEnd()[1],l);for(let Fe=0,Ot=l.length-1;Fe<Ot;Fe++,Ot--){let cr=l[Fe];l[Fe]=l[Ot],l[Ot]=cr}}let u=17,d=Re.sum(new Int32Array(l))/u,h=(i.getStartEnd()[1]-i.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new H;let p=this.getOddCounts(),w=this.getEvenCounts(),E=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let Fe=0;Fe<l.length;Fe++){let Ot=1*l[Fe]/d,cr=Ot+.5;if(cr<1){if(Ot<.3)throw new H;cr=1}else if(cr>8){if(Ot>8.7)throw new H;cr=8}let Ui=Fe/2;Fe&1?(w[Ui]=cr,S[Ui]=Ot-cr):(p[Ui]=cr,E[Ui]=Ot-cr)}this.adjustOddEvenCounts(u);let b=4*i.getValue()+(s?0:2)+(a?0:1)-1,D=0,P=0;for(let Fe=p.length-1;Fe>=0;Fe--){if(Y.isNotA1left(i,s,a)){let Ot=Y.WEIGHTS[b][2*Fe];P+=p[Fe]*Ot}D+=p[Fe]}let L=0;for(let Fe=w.length-1;Fe>=0;Fe--)if(Y.isNotA1left(i,s,a)){let Ot=Y.WEIGHTS[b][2*Fe+1];L+=w[Fe]*Ot}let $=P+L;if(D&1||D>13||D<4)throw new H;let Q=(13-D)/2,q=Y.SYMBOL_WIDEST[Q],K=9-q,Ae=Gr.getRSSvalue(p,q,!0),me=Gr.getRSSvalue(w,K,!1),er=Y.EVEN_TOTAL_SUBSET[Q],Mr=Y.GSUM[Q],tr=Ae*er+me+Mr;return new Di(tr,$)}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 u=!1,d=!1;s>13?d=!0:s<4&&(u=!0);let h=i+s-r,p=(i&1)==1,w=(s&1)==0;if(h==1)if(p){if(w)throw new H;l=!0}else{if(!w)throw new H;d=!0}else if(h==-1)if(p){if(w)throw new H;a=!0}else{if(!w)throw new H;u=!0}else if(h==0){if(p){if(!w)throw new H;i<s?(a=!0,d=!0):(l=!0,u=!0)}else if(w)throw new H}else throw new H;if(a){if(l)throw new H;Y.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&Y.decrement(this.getOddCounts(),this.getOddRoundingErrors()),u){if(d)throw new H;Y.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&Y.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Y.SYMBOL_WIDEST=[7,5,4,3,1],Y.EVEN_TOTAL_SUBSET=[4,20,52,104,204],Y.GSUM=[0,348,1388,2948,3988],Y.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])],Y.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]],Y.FINDER_PAT_A=0,Y.FINDER_PAT_B=1,Y.FINDER_PAT_C=2,Y.FINDER_PAT_D=3,Y.FINDER_PAT_E=4,Y.FINDER_PAT_F=5,Y.FINDER_PATTERN_SEQUENCES=[[Y.FINDER_PAT_A,Y.FINDER_PAT_A],[Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B],[Y.FINDER_PAT_A,Y.FINDER_PAT_C,Y.FINDER_PAT_B,Y.FINDER_PAT_D],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_C],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_D,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_D],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_E],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F]],Y.MAX_PAIRS=11;class Ev extends Di{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 nt extends Lt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(r,i,s){const a=this.decodePair(i,!1,r,s);nt.addOrTally(this.possibleLeftPairs,a),i.reverse();let l=this.decodePair(i,!0,r,s);nt.addOrTally(this.possibleRightPairs,l),i.reverse();for(let u of this.possibleLeftPairs)if(u.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&nt.checkChecksum(u,d))return nt.constructResult(u,d)}throw new H}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 ge;for(let p=13-a.length;p>0;p--)l.append("0");l.append(a);let u=0;for(let p=0;p<13;p++){let w=l.charAt(p).charCodeAt(0)-48;u+=p&1?w:3*w}u=10-u%10,u===10&&(u=0),l.append(u.toString());let d=r.getFinderPattern().getResultPoints(),h=i.getFinderPattern().getResultPoints();return new Ke(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),u=this.parseFoundFinderPattern(r,s,i,l),d=a==null?null:a.get(j.NEED_RESULT_POINT_CALLBACK);if(d!=null){let w=(l[0]+l[1])/2;i&&(w=r.getSize()-1-w),d.foundPossibleResultPoint(new ae(w,s))}let h=this.decodeDataCharacter(r,u,!0),p=this.decodeDataCharacter(r,u,!1);return new Ev(1597*h.getValue()+p.getValue(),h.getChecksumPortion()+4*p.getChecksumPortion(),u)}catch{return null}}decodeDataCharacter(r,i,s){let a=this.getDataCharacterCounters();for(let L=0;L<a.length;L++)a[L]=0;if(s)dt.recordPatternInReverse(r,i.getStartEnd()[0],a);else{dt.recordPattern(r,i.getStartEnd()[1]+1,a);for(let L=0,$=a.length-1;L<$;L++,$--){let Q=a[L];a[L]=a[$],a[$]=Q}}let l=s?16:15,u=Re.sum(new Int32Array(a))/l,d=this.getOddCounts(),h=this.getEvenCounts(),p=this.getOddRoundingErrors(),w=this.getEvenRoundingErrors();for(let L=0;L<a.length;L++){let $=a[L]/u,Q=Math.floor($+.5);Q<1?Q=1:Q>8&&(Q=8);let q=Math.floor(L/2);L&1?(h[q]=Q,w[q]=$-Q):(d[q]=Q,p[q]=$-Q)}this.adjustOddEvenCounts(s,l);let E=0,S=0;for(let L=d.length-1;L>=0;L--)S*=9,S+=d[L],E+=d[L];let b=0,D=0;for(let L=h.length-1;L>=0;L--)b*=9,b+=h[L],D+=h[L];let P=S+3*b;if(s){if(E&1||E>12||E<4)throw new H;let L=(12-E)/2,$=nt.OUTSIDE_ODD_WIDEST[L],Q=9-$,q=Gr.getRSSvalue(d,$,!1),K=Gr.getRSSvalue(h,Q,!0),Ae=nt.OUTSIDE_EVEN_TOTAL_SUBSET[L],me=nt.OUTSIDE_GSUM[L];return new Di(q*Ae+K+me,P)}else{if(D&1||D>10||D<4)throw new H;let L=(10-D)/2,$=nt.INSIDE_ODD_WIDEST[L],Q=9-$,q=Gr.getRSSvalue(d,$,!0),K=Gr.getRSSvalue(h,Q,!1),Ae=nt.INSIDE_ODD_TOTAL_SUBSET[L],me=nt.INSIDE_GSUM[L];return new Di(K*Ae+q+me,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,u=0;for(;u<a&&(l=!r.get(u),i!==l);)u++;let d=0,h=u;for(let p=u;p<a;p++)if(r.get(p)!==l)s[d]++;else{if(d===3){if(Lt.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 H}parseFoundFinderPattern(r,i,s,a){let l=r.get(a[0]),u=a[0]-1;for(;u>=0&&l!==r.get(u);)u--;u++;const d=a[0]-u,h=this.getDecodeFinderCounters(),p=new Int32Array(h.length);M.arraycopy(h,0,p,1,h.length-1),p[0]=d;const w=this.parseFinderValue(p,nt.FINDER_PATTERNS);let E=u,S=a[1];return s&&(E=r.getSize()-1-E,S=r.getSize()-1-S),new ca(w,[u,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,u=!1,d=!1,h=!1;r?(s>12?u=!0:s<4&&(l=!0),a>12?h=!0:a<4&&(d=!0)):(s>11?u=!0:s<5&&(l=!0),a>10?h=!0:a<4&&(d=!0));let p=s+a-i,w=(s&1)===(r?1:0),E=(a&1)===1;if(p===1)if(w){if(E)throw new H;u=!0}else{if(!E)throw new H;h=!0}else if(p===-1)if(w){if(E)throw new H;l=!0}else{if(!E)throw new H;d=!0}else if(p===0){if(w){if(!E)throw new H;s<a?(l=!0,h=!0):(u=!0,d=!0)}else if(E)throw new H}else throw new H;if(l){if(u)throw new H;Lt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(u&&Lt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new H;Lt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&Lt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}nt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],nt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],nt.OUTSIDE_GSUM=[0,161,961,2015,2715],nt.INSIDE_GSUM=[0,336,1036,1516],nt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],nt.INSIDE_ODD_WIDEST=[2,4,6,8],nt.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 ki extends dt{constructor(r,i){super(),this.readers=[],this.verbose=i===!0;const s=r?r.get(j.POSSIBLE_FORMATS):null,a=r&&r.get(j.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 Vu(r)),s.includes(le.CODE_39)&&this.readers.push(new pt(a)),s.includes(le.CODE_128)&&this.readers.push(new J),s.includes(le.ITF)&&this.readers.push(new Be),s.includes(le.RSS_14)&&this.readers.push(new nt),s.includes(le.RSS_EXPANDED)&&this.readers.push(new Y(this.verbose))):(this.readers.push(new Vu(r)),this.readers.push(new pt),this.readers.push(new Vu(r)),this.readers.push(new J),this.readers.push(new Be),this.readers.push(new nt),this.readers.push(new Y(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 H}reset(){this.readers.forEach(r=>r.reset())}}class Cv extends yr{constructor(r=500,i){super(new ki(i),r,i)}}class Me{constructor(r,i,s){this.ecCodewords=r,this.ecBlocks=[i],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class De{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,u){this.versionNumber=r,this.symbolSizeRows=i,this.symbolSizeColumns=s,this.dataRegionSizeRows=a,this.dataRegionSizeColumns=l,this.ecBlocks=u;let d=0;const h=u.getECCodewords(),p=u.getECBlocks();for(let w of p)d+=w.getCount()*(w.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 B;for(let s of Se.VERSIONS)if(s.symbolSizeRows===r&&s.symbolSizeColumns===i)return s;throw new B}toString(){return""+this.versionNumber}static buildVersions(){return[new Se(1,10,10,8,8,new Me(5,new De(1,3))),new Se(2,12,12,10,10,new Me(7,new De(1,5))),new Se(3,14,14,12,12,new Me(10,new De(1,8))),new Se(4,16,16,14,14,new Me(12,new De(1,12))),new Se(5,18,18,16,16,new Me(14,new De(1,18))),new Se(6,20,20,18,18,new Me(18,new De(1,22))),new Se(7,22,22,20,20,new Me(20,new De(1,30))),new Se(8,24,24,22,22,new Me(24,new De(1,36))),new Se(9,26,26,24,24,new Me(28,new De(1,44))),new Se(10,32,32,14,14,new Me(36,new De(1,62))),new Se(11,36,36,16,16,new Me(42,new De(1,86))),new Se(12,40,40,18,18,new Me(48,new De(1,114))),new Se(13,44,44,20,20,new Me(56,new De(1,144))),new Se(14,48,48,22,22,new Me(68,new De(1,174))),new Se(15,52,52,24,24,new Me(42,new De(2,102))),new Se(16,64,64,14,14,new Me(56,new De(2,140))),new Se(17,72,72,16,16,new Me(36,new De(4,92))),new Se(18,80,80,18,18,new Me(48,new De(4,114))),new Se(19,88,88,20,20,new Me(56,new De(4,144))),new Se(20,96,96,22,22,new Me(68,new De(4,174))),new Se(21,104,104,24,24,new Me(56,new De(6,136))),new Se(22,120,120,18,18,new Me(68,new De(6,175))),new Se(23,132,132,20,20,new Me(62,new De(8,163))),new Se(24,144,144,22,22,new Me(62,new De(8,156),new De(2,155))),new Se(25,8,18,6,16,new Me(7,new De(1,5))),new Se(26,8,32,6,14,new Me(11,new De(1,10))),new Se(27,12,26,10,24,new Me(14,new De(1,16))),new Se(28,12,36,10,16,new Me(18,new De(1,22))),new Se(29,16,36,14,16,new Me(24,new De(1,32))),new Se(30,16,48,14,22,new Me(28,new De(1,49)))]}}Se.VERSIONS=Se.buildVersions();class Xu{constructor(r){const i=r.getHeight();if(i<8||i>144||i&1)throw new B;this.version=Xu.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(),u=this.mappingBitMatrix.getWidth();let d=!1,h=!1,p=!1,w=!1;do if(s===l&&a===0&&!d)r[i++]=this.readCorner1(l,u)&255,s-=2,a+=2,d=!0;else if(s===l-2&&a===0&&u&3&&!h)r[i++]=this.readCorner2(l,u)&255,s-=2,a+=2,h=!0;else if(s===l+4&&a===2&&!(u&7)&&!p)r[i++]=this.readCorner3(l,u)&255,s-=2,a+=2,p=!0;else if(s===l-2&&a===0&&(u&7)===4&&!w)r[i++]=this.readCorner4(l,u)&255,s-=2,a+=2,w=!0;else{do s<l&&a>=0&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,u)&255),s-=2,a+=2;while(s>=0&&a<u);s+=1,a+=3;do s>=0&&a<u&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,u)&255),s+=2,a-=2;while(s<l&&a>=0);s+=3,a+=1}while(s<l||a<u);if(i!==this.version.getTotalCodewords())throw new B;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 A("Dimension of bitMatrix must match the version size");const a=this.version.getDataRegionSizeRows(),l=this.version.getDataRegionSizeColumns(),u=i/a|0,d=s/l|0,h=u*a,p=d*l,w=new Te(p,h);for(let E=0;E<u;++E){const S=E*a;for(let b=0;b<d;++b){const D=b*l;for(let P=0;P<a;++P){const L=E*(a+2)+1+P,$=S+P;for(let Q=0;Q<l;++Q){const q=b*(l+2)+1+Q;if(r.get(q,L)){const K=D+Q;w.set(K,$)}}}}}return w}}class Yu{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 u=new Array(a);let d=0;for(let P of l)for(let L=0;L<P.getCount();L++){const $=P.getDataCodewords(),Q=s.getECCodewords()+$;u[d++]=new Yu($,new Uint8Array(Q))}const p=u[0].codewords.length-s.getECCodewords(),w=p-1;let E=0;for(let P=0;P<w;P++)for(let L=0;L<d;L++)u[L].codewords[P]=r[E++];const S=i.getVersionNumber()===24,b=S?8:d;for(let P=0;P<b;P++)u[P].codewords[p-1]=r[E++];const D=u[0].codewords.length;for(let P=p;P<D;P++)for(let L=0;L<d;L++){const $=S?(L+8)%d:L,Q=S&&$>7?P-1:P;u[$].codewords[Q]=r[E++]}if(E!==r.length)throw new A;return u}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Ku{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 A(""+r);let i=0,s=this.bitOffset,a=this.byteOffset;const l=this.bytes;if(s>0){const u=8-s,d=r<u?r:u,h=u-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 u=8-r,d=255>>u<<u;i=i<<r|(l[a]&d)>>u,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 bn{static decode(r){const i=new Ku(r),s=new ge,a=new ge,l=new Array;let u=xt.ASCII_ENCODE;do if(u===xt.ASCII_ENCODE)u=this.decodeAsciiSegment(i,s,a);else{switch(u){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 B}u=xt.ASCII_ENCODE}while(u!==xt.PAD_ENCODE&&i.available()>0);return a.length()>0&&s.append(a.toString()),new Ds(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 B;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 u=l-130;u<10&&i.append("0"),i.append(""+u)}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 B;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 u=r.readBits(8);if(u===254)return;this.parseTwoBytes(u,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 B;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 B}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 B}}}while(r.available()>0)}static decodeTextSegment(r,i){let s=!1,a=[],l=0;do{if(r.available()===8)return;const u=r.readBits(8);if(u===254)return;this.parseTwoBytes(u,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 B;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 B}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 B;break;default:throw new B}}}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 u=s[l];switch(u){case 0:i.append("\r");break;case 1:i.append("*");break;case 2:i.append(">");break;case 3:i.append(" ");break;default:if(u<14)i.append(String.fromCharCode(u+44));else if(u<40)i.append(String.fromCharCode(u+51));else throw new B;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 u;if(l===0?u=r.available()/8|0:l<250?u=l:u=250*(l-249)+this.unrandomize255State(r.readBits(8),a++),u<0)throw new B;const d=new Uint8Array(u);for(let h=0;h<u;h++){if(r.available()<8)throw new B;d[h]=this.unrandomize255State(r.readBits(8),a++)}s.push(d);try{i.append(ye.decode(d,se.ISO88591))}catch(h){throw new Hr("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}}bn.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"],bn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],bn.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"],bn.TEXT_SHIFT2_SET_CHARS=bn.C40_SHIFT2_SET_CHARS,bn.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 Av{constructor(){this.rsDecoder=new Ps(Oe.DATA_MATRIX_FIELD_256)}decode(r){const i=new Xu(r),s=i.getVersion(),a=i.readCodewords(),l=Yu.getDataBlocks(a,s);let u=0;for(let p of l)u+=p.getNumDataCodewords();const d=new Uint8Array(u),h=l.length;for(let p=0;p<h;p++){const w=l[p],E=w.getCodewords(),S=w.getNumDataCodewords();this.correctErrors(E,S);for(let b=0;b<S;b++)d[b*h+p]=E[b]}return bn.decode(d)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new O}for(let a=0;a<i;a++)r[a]=s[a]}}class lt{constructor(r){this.image=r,this.rectangleDetector=new an(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 H;i=this.shiftToModuleCenter(i);const s=i[0],a=i[1],l=i[2],u=i[3];let d=this.transitionsBetween(s,u)+1,h=this.transitionsBetween(l,u)+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=lt.sampleGrid(this.image,s,a,l,u,d,h);return new la(p,[s,a,l,u])}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],u=this.transitionsBetween(i,s),d=this.transitionsBetween(s,a),h=this.transitionsBetween(a,l),p=this.transitionsBetween(l,i),w=u,E=[l,i,s,a];return w>d&&(w=d,E[0]=i,E[1]=s,E[2]=a,E[3]=l),w>h&&(w=h,E[0]=s,E[1]=a,E[2]=l,E[3]=i),w>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],u=this.transitionsBetween(i,l),d=lt.shiftPoint(s,a,(u+1)*4),h=lt.shiftPoint(a,s,(u+1)*4),p=this.transitionsBetween(d,i),w=this.transitionsBetween(h,l);return p<w?(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],u=this.transitionsBetween(i,l),d=this.transitionsBetween(s,l),h=lt.shiftPoint(i,s,(d+1)*4),p=lt.shiftPoint(a,s,(u+1)*4);u=this.transitionsBetween(h,l),d=this.transitionsBetween(p,l);let w=new ae(l.getX()+(a.getX()-s.getX())/(u+1),l.getY()+(a.getY()-s.getY())/(u+1)),E=new ae(l.getX()+(i.getX()-s.getX())/(d+1),l.getY()+(i.getY()-s.getY())/(d+1));if(!this.isValid(w))return this.isValid(E)?E:null;if(!this.isValid(E))return w;let S=this.transitionsBetween(h,w)+this.transitionsBetween(p,w),b=this.transitionsBetween(h,E)+this.transitionsBetween(p,E);return S>b?w:E}shiftToModuleCenter(r){let i=r[0],s=r[1],a=r[2],l=r[3],u=this.transitionsBetween(i,l)+1,d=this.transitionsBetween(a,l)+1,h=lt.shiftPoint(i,s,d*4),p=lt.shiftPoint(a,s,u*4);u=this.transitionsBetween(h,l)+1,d=this.transitionsBetween(p,l)+1,(u&1)===1&&(u+=1),(d&1)===1&&(d+=1);let w=(i.getX()+s.getX()+a.getX()+l.getX())/4,E=(i.getY()+s.getY()+a.getY()+l.getY())/4;i=lt.moveAway(i,w,E),s=lt.moveAway(s,w,E),a=lt.moveAway(a,w,E),l=lt.moveAway(l,w,E);let S,b;return h=lt.shiftPoint(i,s,d*4),h=lt.shiftPoint(h,l,u*4),S=lt.shiftPoint(s,i,d*4),S=lt.shiftPoint(S,a,u*4),p=lt.shiftPoint(a,l,d*4),p=lt.shiftPoint(p,s,u*4),b=lt.shiftPoint(l,a,d*4),b=lt.shiftPoint(b,i,u*4),[h,S,p,b]}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,u,d){return Tn.getInstance().sampleGrid(r,u,d,.5,.5,u-.5,.5,u-.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()),u=Math.trunc(i.getY()),d=Math.abs(u-a)>Math.abs(l-s);if(d){let P=s;s=a,a=P,P=l,l=u,u=P}let h=Math.abs(l-s),p=Math.abs(u-a),w=-h/2,E=a<u?1:-1,S=s<l?1:-1,b=0,D=this.image.get(d?a:s,d?s:a);for(let P=s,L=a;P!==l;P+=S){let $=this.image.get(d?L:P,d?P:L);if($!==D&&(b++,D=$),w+=p,w>0){if(L===u)break;L+=E,w-=h}}return b}}class _n{constructor(){this.decoder=new Av}decode(r,i=null){let s,a;if(i!=null&&i.has(j.PURE_BARCODE)){const p=_n.extractPureBits(r.getBlackMatrix());s=this.decoder.decode(p),a=_n.NO_POINTS}else{const p=new lt(r.getBlackMatrix()).detect();s=this.decoder.decode(p.getBits()),a=p.getPoints()}const l=s.getRawBytes(),u=new Ke(s.getText(),l,8*l.length,a,le.DATA_MATRIX,M.currentTimeMillis()),d=s.getByteSegments();d!=null&&u.putMetadata(Ct.BYTE_SEGMENTS,d);const h=s.getECLevel();return h!=null&&u.putMetadata(Ct.ERROR_CORRECTION_LEVEL,h),u}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i==null||s==null)throw new H;const a=this.moduleSize(i,r);let l=i[1];const u=s[1];let d=i[0];const p=(s[0]-d+1)/a,w=(u-l+1)/a;if(p<=0||w<=0)throw new H;const E=a/2;l+=E,d+=E;const S=new Te(p,w);for(let b=0;b<w;b++){const D=l+b*a;for(let P=0;P<p;P++)r.get(d+P*a,D)&&S.set(P,b)}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 H;const u=a-r[0];if(u===0)throw new H;return u}}_n.NO_POINTS=[];class Sv extends yr{constructor(r=500){super(new _n,r)}}var Bi;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(Bi||(Bi={}));class je{constructor(r,i,s){this.value=r,this.stringValue=i,this.bits=s,je.FOR_BITS.set(s,this),je.FOR_VALUE.set(r,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(r){switch(r){case"L":return je.L;case"M":return je.M;case"Q":return je.Q;case"H":return je.H;default:throw new C(r+"not available")}}toString(){return this.stringValue}equals(r){if(!(r instanceof je))return!1;const i=r;return this.value===i.value}static forBits(r){if(r<0||r>=je.FOR_BITS.size)throw new A;return je.FOR_BITS.get(r)}}je.FOR_BITS=new Map,je.FOR_VALUE=new Map,je.L=new je(Bi.L,"L",1),je.M=new je(Bi.M,"M",0),je.Q=new je(Bi.Q,"Q",3),je.H=new je(Bi.H,"H",2);class Ft{constructor(r){this.errorCorrectionLevel=je.forBits(r>>3&3),this.dataMask=r&7}static numBitsDiffering(r,i){return _.bitCount(r^i)}static decodeFormatInformation(r,i){const s=Ft.doDecodeFormatInformation(r,i);return s!==null?s:Ft.doDecodeFormatInformation(r^Ft.FORMAT_INFO_MASK_QR,i^Ft.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(r,i){let s=Number.MAX_SAFE_INTEGER,a=0;for(const l of Ft.FORMAT_INFO_DECODE_LOOKUP){const u=l[0];if(u===r||u===i)return new Ft(l[1]);let d=Ft.numBitsDiffering(r,u);d<s&&(a=l[1],s=d),r!==i&&(d=Ft.numBitsDiffering(i,u),d<s&&(a=l[1],s=d))}return s<=3?new Ft(a):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(r){if(!(r instanceof Ft))return!1;const i=r;return this.errorCorrectionLevel===i.errorCorrectionLevel&&this.dataMask===i.dataMask}}Ft.FORMAT_INFO_MASK_QR=21522,Ft.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 F{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(),u=s[0].getECBlocks();for(const d of u)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 B;try{return this.getVersionForNumber((r-17)/4)}catch{throw new B}}static getVersionForNumber(r){if(r<1||r>40)throw new A;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 u=Ft.numBitsDiffering(r,l);u<i&&(s=a+7,i=u)}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 u=0;u<s;u++)a===0&&(u===0||u===s-1)||a===s-1&&u===0||i.setRegion(this.alignmentPatternCenters[u]-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 F(7,new R(1,19)),new F(10,new R(1,16)),new F(13,new R(1,13)),new F(17,new R(1,9))),new ue(2,Int32Array.from([6,18]),new F(10,new R(1,34)),new F(16,new R(1,28)),new F(22,new R(1,22)),new F(28,new R(1,16))),new ue(3,Int32Array.from([6,22]),new F(15,new R(1,55)),new F(26,new R(1,44)),new F(18,new R(2,17)),new F(22,new R(2,13))),new ue(4,Int32Array.from([6,26]),new F(20,new R(1,80)),new F(18,new R(2,32)),new F(26,new R(2,24)),new F(16,new R(4,9))),new ue(5,Int32Array.from([6,30]),new F(26,new R(1,108)),new F(24,new R(2,43)),new F(18,new R(2,15),new R(2,16)),new F(22,new R(2,11),new R(2,12))),new ue(6,Int32Array.from([6,34]),new F(18,new R(2,68)),new F(16,new R(4,27)),new F(24,new R(4,19)),new F(28,new R(4,15))),new ue(7,Int32Array.from([6,22,38]),new F(20,new R(2,78)),new F(18,new R(4,31)),new F(18,new R(2,14),new R(4,15)),new F(26,new R(4,13),new R(1,14))),new ue(8,Int32Array.from([6,24,42]),new F(24,new R(2,97)),new F(22,new R(2,38),new R(2,39)),new F(22,new R(4,18),new R(2,19)),new F(26,new R(4,14),new R(2,15))),new ue(9,Int32Array.from([6,26,46]),new F(30,new R(2,116)),new F(22,new R(3,36),new R(2,37)),new F(20,new R(4,16),new R(4,17)),new F(24,new R(4,12),new R(4,13))),new ue(10,Int32Array.from([6,28,50]),new F(18,new R(2,68),new R(2,69)),new F(26,new R(4,43),new R(1,44)),new F(24,new R(6,19),new R(2,20)),new F(28,new R(6,15),new R(2,16))),new ue(11,Int32Array.from([6,30,54]),new F(20,new R(4,81)),new F(30,new R(1,50),new R(4,51)),new F(28,new R(4,22),new R(4,23)),new F(24,new R(3,12),new R(8,13))),new ue(12,Int32Array.from([6,32,58]),new F(24,new R(2,92),new R(2,93)),new F(22,new R(6,36),new R(2,37)),new F(26,new R(4,20),new R(6,21)),new F(28,new R(7,14),new R(4,15))),new ue(13,Int32Array.from([6,34,62]),new F(26,new R(4,107)),new F(22,new R(8,37),new R(1,38)),new F(24,new R(8,20),new R(4,21)),new F(22,new R(12,11),new R(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new F(30,new R(3,115),new R(1,116)),new F(24,new R(4,40),new R(5,41)),new F(20,new R(11,16),new R(5,17)),new F(24,new R(11,12),new R(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new F(22,new R(5,87),new R(1,88)),new F(24,new R(5,41),new R(5,42)),new F(30,new R(5,24),new R(7,25)),new F(24,new R(11,12),new R(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new F(24,new R(5,98),new R(1,99)),new F(28,new R(7,45),new R(3,46)),new F(24,new R(15,19),new R(2,20)),new F(30,new R(3,15),new R(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new F(28,new R(1,107),new R(5,108)),new F(28,new R(10,46),new R(1,47)),new F(28,new R(1,22),new R(15,23)),new F(28,new R(2,14),new R(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new F(30,new R(5,120),new R(1,121)),new F(26,new R(9,43),new R(4,44)),new F(28,new R(17,22),new R(1,23)),new F(28,new R(2,14),new R(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new F(28,new R(3,113),new R(4,114)),new F(26,new R(3,44),new R(11,45)),new F(26,new R(17,21),new R(4,22)),new F(26,new R(9,13),new R(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new F(28,new R(3,107),new R(5,108)),new F(26,new R(3,41),new R(13,42)),new F(30,new R(15,24),new R(5,25)),new F(28,new R(15,15),new R(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new F(28,new R(4,116),new R(4,117)),new F(26,new R(17,42)),new F(28,new R(17,22),new R(6,23)),new F(30,new R(19,16),new R(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new F(28,new R(2,111),new R(7,112)),new F(28,new R(17,46)),new F(30,new R(7,24),new R(16,25)),new F(24,new R(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new F(30,new R(4,121),new R(5,122)),new F(28,new R(4,47),new R(14,48)),new F(30,new R(11,24),new R(14,25)),new F(30,new R(16,15),new R(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new F(30,new R(6,117),new R(4,118)),new F(28,new R(6,45),new R(14,46)),new F(30,new R(11,24),new R(16,25)),new F(30,new R(30,16),new R(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new F(26,new R(8,106),new R(4,107)),new F(28,new R(8,47),new R(13,48)),new F(30,new R(7,24),new R(22,25)),new F(30,new R(22,15),new R(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new F(28,new R(10,114),new R(2,115)),new F(28,new R(19,46),new R(4,47)),new F(28,new R(28,22),new R(6,23)),new F(30,new R(33,16),new R(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new F(30,new R(8,122),new R(4,123)),new F(28,new R(22,45),new R(3,46)),new F(30,new R(8,23),new R(26,24)),new F(30,new R(12,15),new R(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new F(30,new R(3,117),new R(10,118)),new F(28,new R(3,45),new R(23,46)),new F(30,new R(4,24),new R(31,25)),new F(30,new R(11,15),new R(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new F(30,new R(7,116),new R(7,117)),new F(28,new R(21,45),new R(7,46)),new F(30,new R(1,23),new R(37,24)),new F(30,new R(19,15),new R(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new F(30,new R(5,115),new R(10,116)),new F(28,new R(19,47),new R(10,48)),new F(30,new R(15,24),new R(25,25)),new F(30,new R(23,15),new R(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new F(30,new R(13,115),new R(3,116)),new F(28,new R(2,46),new R(29,47)),new F(30,new R(42,24),new R(1,25)),new F(30,new R(23,15),new R(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new F(30,new R(17,115)),new F(28,new R(10,46),new R(23,47)),new F(30,new R(10,24),new R(35,25)),new F(30,new R(19,15),new R(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new F(30,new R(17,115),new R(1,116)),new F(28,new R(14,46),new R(21,47)),new F(30,new R(29,24),new R(19,25)),new F(30,new R(11,15),new R(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new F(30,new R(13,115),new R(6,116)),new F(28,new R(14,46),new R(23,47)),new F(30,new R(44,24),new R(7,25)),new F(30,new R(59,16),new R(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new F(30,new R(12,121),new R(7,122)),new F(28,new R(12,47),new R(26,48)),new F(30,new R(39,24),new R(14,25)),new F(30,new R(22,15),new R(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new F(30,new R(6,121),new R(14,122)),new F(28,new R(6,47),new R(34,48)),new F(30,new R(46,24),new R(10,25)),new F(30,new R(2,15),new R(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new F(30,new R(17,122),new R(4,123)),new F(28,new R(29,46),new R(14,47)),new F(30,new R(49,24),new R(10,25)),new F(30,new R(24,15),new R(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new F(30,new R(4,122),new R(18,123)),new F(28,new R(13,46),new R(32,47)),new F(30,new R(48,24),new R(14,25)),new F(30,new R(42,15),new R(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new F(30,new R(20,117),new R(4,118)),new F(28,new R(40,47),new R(7,48)),new F(30,new R(43,24),new R(22,25)),new F(30,new R(10,15),new R(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new F(30,new R(19,118),new R(6,119)),new F(28,new R(18,47),new R(31,48)),new F(30,new R(34,24),new R(34,25)),new F(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 Cr{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)}}Cr.values=new Map([[At.DATA_MASK_000,new Cr(At.DATA_MASK_000,(y,r)=>(y+r&1)===0)],[At.DATA_MASK_001,new Cr(At.DATA_MASK_001,(y,r)=>(y&1)===0)],[At.DATA_MASK_010,new Cr(At.DATA_MASK_010,(y,r)=>r%3===0)],[At.DATA_MASK_011,new Cr(At.DATA_MASK_011,(y,r)=>(y+r)%3===0)],[At.DATA_MASK_100,new Cr(At.DATA_MASK_100,(y,r)=>(Math.floor(y/2)+Math.floor(r/3)&1)===0)],[At.DATA_MASK_101,new Cr(At.DATA_MASK_101,(y,r)=>y*r%6===0)],[At.DATA_MASK_110,new Cr(At.DATA_MASK_110,(y,r)=>y*r%6<3)],[At.DATA_MASK_111,new Cr(At.DATA_MASK_111,(y,r)=>(y+r+y*r%3&1)===0)]]);class Iv{constructor(r){const i=r.getHeight();if(i<21||(i&3)!==1)throw new B;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=Ft.decodeFormatInformation(r,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new B}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 u=5;u>=0;u--)for(let d=r-9;d>=a;d--)s=this.copyBit(d,u,s);let l=ue.decodeVersionInformation(s);if(l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;s=0;for(let u=5;u>=0;u--)for(let d=r-9;d>=a;d--)s=this.copyBit(u,d,s);if(l=ue.decodeVersionInformation(s),l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;throw new B}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=Cr.values.get(r.getDataMask()),a=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,a);const l=i.buildFunctionPattern();let u=!0;const d=new Uint8Array(i.getTotalCodewords());let h=0,p=0,w=0;for(let E=a-1;E>0;E-=2){E===6&&E--;for(let S=0;S<a;S++){const b=u?a-1-S:S;for(let D=0;D<2;D++)l.get(E-D,b)||(w++,p<<=1,this.bitMatrix.get(E-D,b)&&(p|=1),w===8&&(d[h++]=p,w=0,p=0))}u=!u}if(h!==i.getTotalCodewords())throw new B;return d}remask(){if(this.parsedFormatInfo===null)return;const r=Cr.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 Zu{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i,s){if(r.length!==i.getTotalCodewords())throw new A;const a=i.getECBlocksForLevel(s);let l=0;const u=a.getECBlocks();for(const D of u)l+=D.getCount();const d=new Array(l);let h=0;for(const D of u)for(let P=0;P<D.getCount();P++){const L=D.getDataCodewords(),$=a.getECCodewordsPerBlock()+L;d[h++]=new Zu(L,new Uint8Array($))}const p=d[0].codewords.length;let w=d.length-1;for(;w>=0&&d[w].codewords.length!==p;)w--;w++;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=w;D<h;D++)d[D].codewords[E]=r[S++];const b=d[0].codewords.length;for(let D=E;D<b;D++)for(let P=0;P<h;P++){const L=P<w?D:D+1;d[P].codewords[L]=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 ce{constructor(r,i,s,a){this.value=r,this.stringValue=i,this.characterCountBitsForVersions=s,this.bits=a,ce.FOR_BITS.set(a,this),ce.FOR_VALUE.set(r,this)}static forBits(r){const i=ce.FOR_BITS.get(r);if(i===void 0)throw new A;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 ce))return!1;const i=r;return this.value===i.value}toString(){return this.stringValue}}ce.FOR_BITS=new Map,ce.FOR_VALUE=new Map,ce.TERMINATOR=new ce(Ar.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ce.NUMERIC=new ce(Ar.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ce.ALPHANUMERIC=new ce(Ar.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ce.STRUCTURED_APPEND=new ce(Ar.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ce.BYTE=new ce(Ar.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ce.ECI=new ce(Ar.ECI,"ECI",Int32Array.from([0,0,0]),7),ce.KANJI=new ce(Ar.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ce.FNC1_FIRST_POSITION=new ce(Ar.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ce.FNC1_SECOND_POSITION=new ce(Ar.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ce.HANZI=new ce(Ar.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Ze{static decode(r,i,s,a){const l=new Ku(r);let u=new ge;const d=new Array;let h=-1,p=-1;try{let w=null,E=!1,S;do{if(l.available()<4)S=ce.TERMINATOR;else{const b=l.readBits(4);S=ce.forBits(b)}switch(S){case ce.TERMINATOR:break;case ce.FNC1_FIRST_POSITION:case ce.FNC1_SECOND_POSITION:E=!0;break;case ce.STRUCTURED_APPEND:if(l.available()<16)throw new B;h=l.readBits(8),p=l.readBits(8);break;case ce.ECI:const b=Ze.parseECIValue(l);if(w=V.getCharacterSetECIByValue(b),w===null)throw new B;break;case ce.HANZI:const D=l.readBits(4),P=l.readBits(S.getCharacterCountBits(i));D===Ze.GB2312_SUBSET&&Ze.decodeHanziSegment(l,u,P);break;default:const L=l.readBits(S.getCharacterCountBits(i));switch(S){case ce.NUMERIC:Ze.decodeNumericSegment(l,u,L);break;case ce.ALPHANUMERIC:Ze.decodeAlphanumericSegment(l,u,L,E);break;case ce.BYTE:Ze.decodeByteSegment(l,u,L,w,d,a);break;case ce.KANJI:Ze.decodeKanjiSegment(l,u,L);break;default:throw new B}break}}while(S!==ce.TERMINATOR)}catch{throw new B}return new Ds(r,u.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 B;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const u=r.readBits(13);let d=u/96<<8&4294967295|u%96;d<959?d+=41377:d+=42657,a[l]=d>>8&255,a[l+1]=d&255,l+=2,s--}try{i.append(ye.decode(a,se.GB2312))}catch(u){throw new B(u)}}static decodeKanjiSegment(r,i,s){if(s*13>r.available())throw new B;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const u=r.readBits(13);let d=u/192<<8&4294967295|u%192;d<7936?d+=33088:d+=49472,a[l]=d>>8,a[l+1]=d,l+=2,s--}try{i.append(ye.decode(a,se.SHIFT_JIS))}catch(u){throw new B(u)}}static decodeByteSegment(r,i,s,a,l,u){if(8*s>r.available())throw new B;const d=new Uint8Array(s);for(let p=0;p<s;p++)d[p]=r.readBits(8);let h;a===null?h=se.guessEncoding(d,u):h=a.getName();try{i.append(ye.decode(d,h))}catch(p){throw new B(p)}l.push(d)}static toAlphaNumericChar(r){if(r>=Ze.ALPHANUMERIC_CHARS.length)throw new B;return Ze.ALPHANUMERIC_CHARS[r]}static decodeAlphanumericSegment(r,i,s,a){const l=i.length();for(;s>1;){if(r.available()<11)throw new B;const u=r.readBits(11);i.append(Ze.toAlphaNumericChar(Math.floor(u/45))),i.append(Ze.toAlphaNumericChar(u%45)),s-=2}if(s===1){if(r.available()<6)throw new B;i.append(Ze.toAlphaNumericChar(r.readBits(6)))}if(a)for(let u=l;u<i.length();u++)i.charAt(u)==="%"&&(u<i.length()-1&&i.charAt(u+1)==="%"?i.deleteCharAt(u+1):i.setCharAt(u,""))}static decodeNumericSegment(r,i,s){for(;s>=3;){if(r.available()<10)throw new B;const a=r.readBits(10);if(a>=1e3)throw new B;i.append(Ze.toAlphaNumericChar(Math.floor(a/100))),i.append(Ze.toAlphaNumericChar(Math.floor(a/10)%10)),i.append(Ze.toAlphaNumericChar(a%10)),s-=3}if(s===2){if(r.available()<7)throw new B;const a=r.readBits(7);if(a>=100)throw new B;i.append(Ze.toAlphaNumericChar(Math.floor(a/10))),i.append(Ze.toAlphaNumericChar(a%10))}else if(s===1){if(r.available()<4)throw new B;const a=r.readBits(4);if(a>=10)throw new B;i.append(Ze.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 B}}Ze.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ze.GB2312_SUBSET=1;class Md{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 Tv{constructor(){this.rsDecoder=new Ps(Oe.QR_CODE_FIELD_256)}decodeBooleanArray(r,i){return this.decodeBitMatrix(Te.parseFromBooleanArray(r),i)}decodeBitMatrix(r,i){const s=new Iv(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 Md(!0)),l}catch(l){throw a!==null?a:l}}decodeBitMatrixParser(r,i){const s=r.readVersion(),a=r.readFormatInformation().getErrorCorrectionLevel(),l=r.readCodewords(),u=Zu.getDataBlocks(l,s,a);let d=0;for(const w of u)d+=w.getNumDataCodewords();const h=new Uint8Array(d);let p=0;for(const w of u){const E=w.getCodewords(),S=w.getNumDataCodewords();this.correctErrors(E,S);for(let b=0;b<S;b++)h[p++]=E[b]}return Ze.decode(h,s,a,i)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new O}for(let a=0;a<i;a++)r[a]=s[a]}}class Qu 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,u=(this.estimatedModuleSize+s)/2;return new Qu(a,l,u)}}class ha{constructor(r,i,s,a,l,u,d){this.image=r,this.startX=i,this.startY=s,this.width=a,this.height=l,this.moduleSize=u,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,u=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));u[0]=0,u[1]=0,u[2]=0;let w=r;for(;w<a&&!d.get(w,p);)w++;let E=0;for(;w<a;){if(d.get(w,p))if(E===1)u[1]++;else if(E===2){if(this.foundPatternCross(u)){const S=this.handlePossibleCenter(u,p,w);if(S!==null)return S}u[0]=u[2],u[1]=1,u[2]=0,E=1}else u[++E]++;else E===1&&E++,u[E]++;w++}if(this.foundPatternCross(u)){const S=this.handlePossibleCenter(u,p,a);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new H}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,u=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<u&&l.get(i,h)&&d[1]<=s;)d[1]++,h++;if(h===u||d[1]>s)return NaN;for(;h<u&&!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)?ha.centerFromEnd(d,h):NaN}handlePossibleCenter(r,i,s){const a=r[0]+r[1]+r[2],l=ha.centerFromEnd(r,s),u=this.crossCheckVertical(i,l,2*r[1],a);if(!isNaN(u)){const d=(r[0]+r[1]+r[2])/3;for(const p of this.possibleCenters)if(p.aboutEquals(d,u,l))return p.combineEstimate(u,l,d);const h=new Qu(l,u,d);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null}}class qu 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,u=(this.count*this.getY()+r)/a,d=(this.count*this.estimatedModuleSize+s)/a;return new qu(l,u,d,a)}}class Rv{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(j.TRY_HARDER)!==void 0,s=r!=null&&r.get(j.PURE_BARCODE)!==void 0,a=this.image,l=a.getHeight(),u=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 b=0;b<u;b++)if(a.get(b,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,b,s)===!0)if(d=2,this.hasSkipped===!0)h=this.haveMultiplyConfirmedCenters();else{const P=this.findRowSkip();P>p[2]&&(E+=P-p[2]-d,b=u-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,u,s)===!0&&(d=p[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}const w=this.selectBestPatterns();return ae.orderBestPatterns(w),new Rv(w)}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 u=r[l];if(u===0)return!1;i+=u}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 u=0;const d=this.image;for(;r>=u&&i>=u&&d.get(i-u,r-u);)l[2]++,u++;if(r<u||i<u)return!1;for(;r>=u&&i>=u&&!d.get(i-u,r-u)&&l[1]<=s;)l[1]++,u++;if(r<u||i<u||l[1]>s)return!1;for(;r>=u&&i>=u&&d.get(i-u,r-u)&&l[0]<=s;)l[0]++,u++;if(l[0]>s)return!1;const h=d.getHeight(),p=d.getWidth();for(u=1;r+u<h&&i+u<p&&d.get(i+u,r+u);)l[2]++,u++;if(r+u>=h||i+u>=p)return!1;for(;r+u<h&&i+u<p&&!d.get(i+u,r+u)&&l[3]<s;)l[3]++,u++;if(r+u>=h||i+u>=p||l[3]>=s)return!1;for(;r+u<h&&i+u<p&&d.get(i+u,r+u)&&l[4]<s;)l[4]++,u++;if(l[4]>=s)return!1;const w=l[0]+l[1]+l[2]+l[3]+l[4];return Math.abs(w-a)<2*a&&St.foundPatternCross(l)}crossCheckVertical(r,i,s,a){const l=this.image,u=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<u&&l.get(i,h);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!l.get(i,h)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&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,u=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<u&&l.get(h,i);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!l.get(h,i)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&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 u=St.centerFromEnd(r,s),d=this.crossCheckVertical(i,Math.floor(u),r[2],l);if(!isNaN(d)&&(u=this.crossCheckHorizontal(Math.floor(u),Math.floor(d),r[2],l),!isNaN(u)&&(!a||this.crossCheckDiagonal(Math.floor(d),Math.floor(u),r[2],l)))){const h=l/7;let p=!1;const w=this.possibleCenters;for(let E=0,S=w.length;E<S;E++){const b=w[E];if(b.aboutEquals(h,d,u)){w[E]=b.combineEstimate(d,u,h),p=!0;break}}if(!p){const E=new qu(u,d,h);w.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 u of this.possibleCenters)u.getCount()>=St.CENTER_QUORUM&&(r++,i+=u.getEstimatedModuleSize());if(r<3)return!1;const a=i/s;let l=0;for(const u of this.possibleCenters)l+=Math.abs(u.getEstimatedModuleSize()-a);return l<=.05*i}selectBestPatterns(){const r=this.possibleCenters.length;if(r<3)throw new H;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 u=Math.sqrt(l/r-s*s);i.sort((h,p)=>{const w=Math.abs(p.getEstimatedModuleSize()-s),E=Math.abs(h.getEstimatedModuleSize()-s);return w<E?-1:w>E?1:0});const d=Math.max(.2*s,u);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,u)=>{if(u.getCount()===l.getCount()){const d=Math.abs(u.getEstimatedModuleSize()-s),h=Math.abs(l.getEstimatedModuleSize()-s);return d<h?1:d>h?-1:0}else return u.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 Bs{constructor(r){this.image=r}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(r){this.resultPointCallback=r==null?null:r.get(j.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 H("No pattern found in proccess finder.");const u=Bs.computeDimension(i,s,a,l),d=ue.getProvisionalVersionForDimension(u),h=d.getDimensionForVersion()-7;let p=null;if(d.getAlignmentPatternCenters().length>0){const b=s.getX()-i.getX()+a.getX(),D=s.getY()-i.getY()+a.getY(),P=1-3/h,L=Math.floor(i.getX()+P*(b-i.getX())),$=Math.floor(i.getY()+P*(D-i.getY()));for(let Q=4;Q<=16;Q<<=1)try{p=this.findAlignmentInRegion(l,L,$,Q);break}catch(q){if(!(q instanceof H))throw q}}const w=Bs.createTransform(i,s,a,p,u),E=Bs.sampleGrid(this.image,w,u);let S;return p===null?S=[a,i,s]:S=[a,i,s,p],new la(E,S)}static createTransform(r,i,s,a,l){const u=l-3.5;let d,h,p,w;return a!==null?(d=a.getX(),h=a.getY(),p=u-3,w=p):(d=i.getX()-r.getX()+s.getX(),h=i.getY()-r.getY()+s.getY(),p=u,w=u),Nr.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,p,w,3.5,u,r.getX(),r.getY(),i.getX(),i.getY(),d,h,s.getX(),s.getY())}static sampleGrid(r,i,s){return Tn.getInstance().sampleGridWithTransform(r,s,s,i)}static computeDimension(r,i,s,a){const l=Re.round(ae.distance(r,i)/a),u=Re.round(ae.distance(r,s)/a);let d=Math.floor((l+u)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new H("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),u=1,d=r-(s-r);d<0?(u=r/(r-d),d=0):d>=this.image.getWidth()&&(u=(this.image.getWidth()-1-r)/(d-r),d=this.image.getWidth()-1);let h=Math.floor(i-(a-i)*u);return u=1,h<0?(u=i/(i-h),h=0):h>=this.image.getHeight()&&(u=(this.image.getHeight()-1-i)/(h-i),h=this.image.getHeight()-1),d=Math.floor(r+(d-r)*u),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 b=r;r=i,i=b,b=s,s=a,a=b}const u=Math.abs(s-r),d=Math.abs(a-i);let h=-u/2;const p=r<s?1:-1,w=i<a?1:-1;let E=0;const S=s+p;for(let b=r,D=i;b!==S;b+=p){const P=l?D:b,L=l?b:D;if(E===1===this.image.get(P,L)){if(E===2)return Re.distance(b,D,r,i);E++}if(h+=d,h>0){if(D===a)break;D+=w,h-=u}}return E===2?Re.distance(s+p,a,r,i):NaN}findAlignmentInRegion(r,i,s,a){const l=Math.floor(a*r),u=Math.max(0,i-l),d=Math.min(this.image.getWidth()-1,i+l);if(d-u<r*3)throw new H("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 H("Alignment bottom exceeds estimated module size.");return new ha(this.image,u,h,d-u,p-h,r,this.resultPointCallback).find()}}class On{constructor(){this.decoder=new Tv}getDecoder(){return this.decoder}decode(r,i){let s,a;if(i!=null&&i.get(j.PURE_BARCODE)!==void 0){const h=On.extractPureBits(r.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,i),a=On.NO_POINTS}else{const h=new Bs(r.getBlackMatrix()).detect(i);s=this.decoder.decodeBitMatrix(h.getBits(),i),a=h.getPoints()}s.getOther()instanceof Md&&s.getOther().applyMirroredCorrection(a);const l=new Ke(s.getText(),s.getRawBytes(),void 0,a,le.QR_CODE,void 0),u=s.getByteSegments();u!==null&&l.putMetadata(Ct.BYTE_SEGMENTS,u);const d=s.getECLevel();return d!==null&&l.putMetadata(Ct.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(l.putMetadata(Ct.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),l.putMetadata(Ct.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),l}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i===null||s===null)throw new H;const a=this.moduleSize(i,r);let l=i[1],u=s[1],d=i[0],h=s[0];if(d>=h||l>=u)throw new H;if(u-l!==h-d&&(h=d+(u-l),h>=r.getWidth()))throw new H;const p=Math.round((h-d+1)/a),w=Math.round((u-l+1)/a);if(p<=0||w<=0)throw new H;if(w!==p)throw new H;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 H;d-=S}const b=l+Math.floor((w-1)*a)-u;if(b>0){if(b>E)throw new H;l-=b}const D=new Te(p,w);for(let P=0;P<w;P++){const L=l+Math.floor(P*a);for(let $=0;$<p;$++)r.get(d+Math.floor($*a),L)&&D.set($,P)}return D}static moduleSize(r,i){const s=i.getHeight(),a=i.getWidth();let l=r[0],u=r[1],d=!0,h=0;for(;l<a&&u<s;){if(d!==i.get(l,u)){if(++h===5)break;d=!d}l++,u++}if(l===a||u===s)throw new H;return(l-r[0])/7}}On.NO_POINTS=new Array;class he{PDF417Common(){}static getBitCountSum(r){return Re.sum(r)}static toIntArray(r){if(r==null||!r.length)return he.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=T.binarySearch(he.SYMBOL_TABLE,r&262143);return i<0?-1:(he.CODEWORD_TABLE[i]-1)%he.NUMBER_OF_CODEWORDS}}he.NUMBER_OF_CODEWORDS=929,he.MAX_CODEWORDS_IN_BARCODE=he.NUMBER_OF_CODEWORDS-1,he.MIN_ROWS_IN_BARCODE=3,he.MAX_ROWS_IN_BARCODE=90,he.MODULES_IN_CODEWORD=17,he.MODULES_IN_STOP_PATTERN=18,he.BARS_IN_MODULE=8,he.EMPTY_INT_ARRAY=new Int32Array([]),he.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]),he.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 bv{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class we{static detectMultiple(r,i,s){let a=r.getBlackMatrix(),l=we.detect(s,a);return l.length||(a=a.clone(),a.rotate180(),l=we.detect(s,a)),new bv(a,l)}static detect(r,i){const s=new Array;let a=0,l=0,u=!1;for(;a<i.getHeight();){const d=we.findVertices(i,a,l);if(d[0]==null&&d[3]==null){if(!u)break;u=!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+=we.ROW_STEP;continue}if(u=!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(),u=new Array(8);return we.copyToResult(u,we.findRowsWithPattern(r,a,l,i,s,we.START_PATTERN),we.INDEXES_START_PATTERN),u[4]!=null&&(s=Math.trunc(u[4].getX()),i=Math.trunc(u[4].getY())),we.copyToResult(u,we.findRowsWithPattern(r,a,l,i,s,we.STOP_PATTERN),we.INDEXES_STOP_PATTERN),u}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,u){const d=new Array(4);let h=!1;const p=new Int32Array(u.length);for(;a<i;a+=we.ROW_STEP){let E=we.findGuardPattern(r,l,a,s,!1,u,p);if(E!=null){for(;a>0;){const S=we.findGuardPattern(r,l,--a,s,!1,u,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 w=a+1;if(h){let E=0,S=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;w<i;w++){const b=we.findGuardPattern(r,S[0],w,s,!1,u,p);if(b!=null&&Math.abs(S[0]-b[0])<we.MAX_PATTERN_DRIFT&&Math.abs(S[1]-b[1])<we.MAX_PATTERN_DRIFT)S=b,E=0;else{if(E>we.SKIPPED_ROW_COUNT_MAX)break;E++}}w-=E+1,d[2]=new ae(S[0],w),d[3]=new ae(S[1],w)}return w-a<we.BARCODE_MIN_HEIGHT&&T.fill(d,null),d}static findGuardPattern(r,i,s,a,l,u,d){T.fillWithin(d,0,d.length,0);let h=i,p=0;for(;r.get(h,s)&&h>0&&p++<we.MAX_PIXEL_DRIFT;)h--;let w=h,E=0,S=u.length;for(let b=l;w<a;w++)if(r.get(w,s)!==b)d[E]++;else{if(E===S-1){if(we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE)return new Int32Array([h,w]);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,b=!b}return E===S-1&&we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE?new Int32Array([h,w-1]):null}static patternMatchVariance(r,i,s){let a=r.length,l=0,u=0;for(let p=0;p<a;p++)l+=r[p],u+=i[p];if(l<u)return 1/0;let d=l/u;s*=d;let h=0;for(let p=0;p<a;p++){let w=r[p],E=i[p]*d,S=w>E?w-E:E-w;if(S>s)return 1/0;h+=S}return h/l}}we.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),we.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),we.MAX_AVG_VARIANCE=.42,we.MAX_INDIVIDUAL_VARIANCE=.8,we.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),we.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),we.MAX_PIXEL_DRIFT=3,we.MAX_PATTERN_DRIFT=5,we.SKIPPED_ROW_COUNT_MAX=25,we.ROW_STEP=5,we.BARCODE_MIN_HEIGHT=10;class bt{constructor(r,i){if(i.length===0)throw new A;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 A("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 u=i;i=s,s=u}let a=new Int32Array(s.length),l=s.length-i.length;M.arraycopy(s,0,a,0,l);for(let u=l;u<s.length;u++)a[u]=this.field.add(i[u-l],s[u]);return new bt(this.field,a)}subtract(r){if(!this.field.equals(r.field))throw new A("ModulusPolys do not have same ModulusGF field");return r.isZero()?this:this.add(r.negative())}multiply(r){return r instanceof bt?this.multiplyOther(r):this.multiplyScalar(r)}multiplyOther(r){if(!this.field.equals(r.field))throw new A("ModulusPolys do not have same ModulusGF field");if(this.isZero()||r.isZero())return new bt(this.field,new Int32Array([0]));let i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,u=new Int32Array(s+l-1);for(let d=0;d<s;d++){let h=i[d];for(let p=0;p<l;p++)u[d+p]=this.field.add(u[d+p],this.field.multiply(h,a[p]))}return new bt(this.field,u)}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 bt(this.field,i)}multiplyScalar(r){if(r===0)return new bt(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 bt(this.field,s)}multiplyByMonomial(r,i){if(r<0)throw new A;if(i===0)return new bt(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 bt(this.field,a)}toString(){let r=new ge;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 _v{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 A;return this.logTable[r]}inverse(r){if(r===0)throw new oa;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 Ju extends _v{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 bt(this,new Int32Array([0])),this.one=new bt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new A;if(i===0)return this.zero;let s=new Int32Array(r+1);return s[0]=i,new bt(this,s)}}Ju.PDF417_GF=new Ju(he.NUMBER_OF_CODEWORDS,3);class Pd{constructor(){this.field=Ju.PDF417_GF}decode(r,i,s){let a=new bt(this.field,r),l=new Int32Array(i),u=!1;for(let D=i;D>0;D--){let P=a.evaluateAt(this.field.exp(D));l[i-D]=P,P!==0&&(u=!0)}if(!u)return 0;let d=this.field.getOne();if(s!=null)for(const D of s){let P=this.field.exp(r.length-1-D),L=new bt(this.field,new Int32Array([this.field.subtract(0,P),1]));d=d.multiply(L)}let h=new bt(this.field,l),p=this.runEuclideanAlgorithm(this.field.buildMonomial(i,1),h,i),w=p[0],E=p[1],S=this.findErrorLocations(w),b=this.findErrorMagnitudes(E,w,S);for(let D=0;D<S.length;D++){let P=r.length-1-this.field.log(S[D]);if(P<0)throw O.getChecksumInstance();r[P]=this.field.subtract(r[P],b[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,u=this.field.getZero(),d=this.field.getOne();for(;l.getDegree()>=Math.round(s/2);){let S=a,b=u;if(a=l,u=d,a.isZero())throw O.getChecksumInstance();l=S;let D=this.field.getZero(),P=a.getCoefficient(a.getDegree()),L=this.field.inverse(P);for(;l.getDegree()>=a.getDegree()&&!l.isZero();){let $=l.getDegree()-a.getDegree(),Q=this.field.multiply(l.getCoefficient(l.getDegree()),L);D=D.add(this.field.buildMonomial($,Q)),l=l.subtract(a.multiplyByMonomial($,Q))}d=D.multiply(u).subtract(b).negative()}let h=d.getCoefficient(0);if(h===0)throw O.getChecksumInstance();let p=this.field.inverse(h),w=d.multiply(p),E=l.multiply(p);return[w,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 O.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 u=new bt(this.field,l),d=s.length,h=new Int32Array(d);for(let p=0;p<d;p++){let w=this.field.inverse(s[p]),E=this.field.subtract(0,r.evaluateAt(w)),S=this.field.inverse(u.evaluateAt(w));h[p]=this.field.multiply(E,S)}return h}}class ai{constructor(r,i,s,a,l){r instanceof ai?this.constructor_2(r):this.constructor_1(r,i,s,a,l)}constructor_1(r,i,s,a,l){const u=i==null||s==null,d=a==null||l==null;if(u&&d)throw new H;u?(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 ai(r.image,r.topLeft,r.bottomLeft,i.topRight,i.bottomRight)}addMissingRows(r,i,s){let a=this.topLeft,l=this.bottomLeft,u=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 w=new ae(h.getX(),p);s?a=w:u=w}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 w=new ae(h.getX(),p);s?l=w:d=w}return new ai(this.image,a,l,u,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 Ov{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 Ls{constructor(){this.buffer=""}static form(r,i){let s=-1;function a(u,d,h,p,w,E){if(u==="%%")return"%";if(i[++s]===void 0)return;u=p?parseInt(p.substr(1)):void 0;let S=w?parseInt(w.substr(1)):void 0,b;switch(E){case"s":b=i[s];break;case"c":b=i[s][0];break;case"f":b=parseFloat(i[s]).toFixed(u);break;case"p":b=parseFloat(i[s]).toPrecision(u);break;case"e":b=parseFloat(i[s]).toExponential(u);break;case"x":b=parseInt(i[s]).toString(S||16);break;case"d":b=parseFloat(parseInt(i[s],S||10).toPrecision(u)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(S);let D=parseInt(h),P=h&&h[0]+""=="0"?"0":" ";for(;b.length<D;)b=d!==void 0?b+P:P+b;return b}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}format(r,...i){this.buffer+=Ls.form(r,i)}toString(){return this.buffer}}class Fs{constructor(r){this.boundingBox=new ai(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<Fs.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 Ls;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()}}Fs.MAX_NEARBY_DISTANCE=5;class Us{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 he.toIntArray(i)}getConfidence(r){return this.values.get(r)}}class kd extends Fs{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(),u=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.imageRowToCodewordIndex(Math.trunc(l.getY())),h=-1,p=1,w=0;for(let E=u;E<d;E++){if(i[E]==null)continue;let S=i[E],b=S.getRowNumber()-h;if(b===0)w++;else if(b===1)p=Math.max(p,w),w=1,h=S.getRowNumber();else if(b<0||S.getRowNumber()>=r.getRowCount()||b>E)i[E]=null;else{let D;p>2?D=(p-2)*b:D=b;let P=D>=E;for(let L=1;L<=D&&!P;L++)P=i[E-L]!=null;P?i[E]=null:(h=S.getRowNumber(),w=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())),u=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.getCodewords(),h=-1;for(let p=l;p<u;p++){if(d[p]==null)continue;let w=d[p];w.setRowNumberAsRowIndicatorColumn();let E=w.getRowNumber()-h;E===0||(E===1?h=w.getRowNumber():w.getRowNumber()>=r.getRowCount()?d[p]=null:h=w.getRowNumber())}}getBarcodeMetadata(){let r=this.getCodewords(),i=new Us,s=new Us,a=new Us,l=new Us;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]<he.MIN_ROWS_IN_BARCODE||s.getValue()[0]+a.getValue()[0]>he.MAX_ROWS_IN_BARCODE)return null;let u=new Ov(i.getValue()[0],s.getValue()[0],a.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(r,u),u}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,u=a.getRowNumber();if(u>i.getRowCount()){r[s]=null;continue}switch(this._isLeft||(u+=2),u%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+`
|
|
68
|
-
`+super.toString()}}class js{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=he.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 u=this.barcodeColumnCount+1;u>0&&l<this.ADJUST_ROW_NUMBER_SKIP;u--){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(l=js.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 u=1;u<this.barcodeColumnCount+1&&l<this.ADJUST_ROW_NUMBER_SKIP;u++){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(l=js.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(),u=l;this.detectionResultColumns[r+1]!=null&&(u=this.detectionResultColumns[r+1].getCodewords());let d=new Array(14);d[2]=l[i],d[3]=u[i],i>0&&(d[0]=s[i-1],d[4]=l[i-1],d[5]=u[i-1]),i>1&&(d[8]=s[i-2],d[10]=l[i-2],d[11]=u[i-2]),i<s.length-1&&(d[1]=s[i+1],d[6]=l[i+1],d[7]=u[i+1]),i<s.length-2&&(d[9]=s[i+2],d[12]=l[i+2],d[13]=u[i+2]);for(let h of d)if(js.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 Ls;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 Ws{constructor(r,i,s,a){this.rowNumber=Ws.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!==Ws.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}}Ws.BARCODE_ROW_UNKNOWN=-1;class Jt{static initialize(){for(let r=0;r<he.SYMBOL_TABLE.length;r++){let i=he.SYMBOL_TABLE[r],s=i&1;for(let a=0;a<he.BARS_IN_MODULE;a++){let l=0;for(;(i&1)===s;)l+=1,i>>=1;s=i&1,Jt.RATIOS_TABLE[r]||(Jt.RATIOS_TABLE[r]=new Array(he.BARS_IN_MODULE)),Jt.RATIOS_TABLE[r][he.BARS_IN_MODULE-a-1]=Math.fround(l/he.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(r){let i=Jt.getDecodedCodewordValue(Jt.sampleBitCounts(r));return i!==-1?i:Jt.getClosestDecodedValue(r)}static sampleBitCounts(r){let i=Re.sum(r),s=new Int32Array(he.BARS_IN_MODULE),a=0,l=0;for(let u=0;u<he.MODULES_IN_CODEWORD;u++){let d=i/(2*he.MODULES_IN_CODEWORD)+u*i/he.MODULES_IN_CODEWORD;l+r[a]<=d&&(l+=r[a],a++),s[a]++}return s}static getDecodedCodewordValue(r){let i=Jt.getBitValue(r);return he.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(he.BARS_IN_MODULE);if(i>1)for(let u=0;u<s.length;u++)s[u]=Math.fround(r[u]/i);let a=aa.MAX_VALUE,l=-1;this.bSymbolTableReady||Jt.initialize();for(let u=0;u<Jt.RATIOS_TABLE.length;u++){let d=0,h=Jt.RATIOS_TABLE[u];for(let p=0;p<he.BARS_IN_MODULE;p++){let w=Math.fround(h[p]-s[p]);if(d+=Math.fround(w*w),d>=a)break}d<a&&(a=d,l=he.SYMBOL_TABLE[u])}return l}}Jt.bSymbolTableReady=!1,Jt.RATIOS_TABLE=new Array(he.SYMBOL_TABLE.length).map(y=>new Array(he.BARS_IN_MODULE));class Bd{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 Ld{static parseLong(r,i=void 0){return parseInt(r,i)}}class Fd extends x{}Fd.kind="NullPointerException";class Nv{writeBytes(r){this.writeBytesOffset(r,0,r.length)}writeBytesOffset(r,i,s){if(r==null)throw new Fd;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 Dv extends x{}class Mv extends Nv{constructor(r=32){if(super(),this.count=0,r<0)throw new A("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 Dv;s=_.MAX_VALUE}this.buf=T.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 T.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 ke;(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"})(ke||(ke={}));function Ud(){if(typeof window<"u")return window.BigInt||null;if(typeof dn<"u")return dn.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ga;function Nn(y){if(typeof ga>"u"&&(ga=Ud()),ga===null)throw new Error("BigInt is not supported!");return ga(y)}function Pv(){let y=[];y[0]=Nn(1);let r=Nn(900);y[1]=r;for(let i=2;i<16;i++)y[i]=y[i-1]*r;return y}class W{static decode(r,i){let s=new ge(""),a=V.ISO8859_1;s.enableDecoding(a);let l=1,u=r[l++],d=new Bd;for(;l<r[0];){switch(u){case W.TEXT_COMPACTION_MODE_LATCH:l=W.textCompaction(r,l,s);break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:l=W.byteCompaction(u,r,a,l,s);break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(r[l++]);break;case W.NUMERIC_COMPACTION_MODE_LATCH:l=W.numericCompaction(r,l,s);break;case W.ECI_CHARSET:V.getCharacterSetECIByValue(r[l++]);break;case W.ECI_GENERAL_PURPOSE:l+=2;break;case W.ECI_USER_DEFINED:l++;break;case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:l=W.decodeMacroBlock(r,l,d);break;case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:throw new B;default:l--,l=W.textCompaction(r,l,s);break}if(l<r.length)u=r[l++];else throw B.getFormatInstance()}if(s.length()===0)throw B.getFormatInstance();let h=new Ds(null,s.toString(),null,i);return h.setOther(d),h}static decodeMacroBlock(r,i,s){if(i+W.NUMBER_OF_SEQUENCE_CODEWORDS>r[0])throw B.getFormatInstance();let a=new Int32Array(W.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<W.NUMBER_OF_SEQUENCE_CODEWORDS;d++,i++)a[d]=r[i];s.setSegmentIndex(_.parseInt(W.decodeBase900toBase10(a,W.NUMBER_OF_SEQUENCE_CODEWORDS)));let l=new ge;i=W.textCompaction(r,i,l),s.setFileId(l.toString());let u=-1;for(r[i]===W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(u=i+1);i<r[0];)switch(r[i]){case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(i++,r[i]){case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new ge;i=W.textCompaction(r,i+1,d),s.setFileName(d.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let h=new ge;i=W.textCompaction(r,i+1,h),s.setSender(h.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let p=new ge;i=W.textCompaction(r,i+1,p),s.setAddressee(p.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let w=new ge;i=W.numericCompaction(r,i+1,w),s.setSegmentCount(_.parseInt(w.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new ge;i=W.numericCompaction(r,i+1,E),s.setTimestamp(Ld.parseLong(E.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new ge;i=W.numericCompaction(r,i+1,S),s.setChecksum(_.parseInt(S.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let b=new ge;i=W.numericCompaction(r,i+1,b),s.setFileSize(Ld.parseLong(b.toString()));break;default:throw B.getFormatInstance()}break;case W.MACRO_PDF417_TERMINATOR:i++,s.setLastSegment(!0);break;default:throw B.getFormatInstance()}if(u!==-1){let d=i-u;s.isLastSegment()&&d--,s.setOptionalData(T.copyOfRange(r,u,u+d))}return i}static textCompaction(r,i,s){let a=new Int32Array((r[0]-i)*2),l=new Int32Array((r[0]-i)*2),u=0,d=!1;for(;i<r[0]&&!d;){let h=r[i++];if(h<W.TEXT_COMPACTION_MODE_LATCH)a[u]=h/30,a[u+1]=h%30,u+=2;else switch(h){case W.TEXT_COMPACTION_MODE_LATCH:a[u++]=W.TEXT_COMPACTION_MODE_LATCH;break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:i--,d=!0;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a[u]=W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,h=r[i++],l[u]=h,u++;break}}return W.decodeTextCompaction(a,l,u,s),i}static decodeTextCompaction(r,i,s,a){let l=ke.ALPHA,u=ke.ALPHA,d=0;for(;d<s;){let h=r[d],p="";switch(l){case ke.ALPHA:if(h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case W.LL:l=ke.LOWER;break;case W.ML:l=ke.MIXED;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.LOWER:if(h<26)p=String.fromCharCode(97+h);else switch(h){case 26:p=" ";break;case W.AS:u=l,l=ke.ALPHA_SHIFT;break;case W.ML:l=ke.MIXED;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.MIXED:if(h<W.PL)p=W.MIXED_CHARS[h];else switch(h){case W.PL:l=ke.PUNCT;break;case 26:p=" ";break;case W.LL:l=ke.LOWER;break;case W.AL:l=ke.ALPHA;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.PUNCT:if(h<W.PAL)p=W.PUNCT_CHARS[h];else switch(h){case W.PAL:l=ke.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.ALPHA_SHIFT:if(l=u,h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.PUNCT_SHIFT:if(l=u,h<W.PAL)p=W.PUNCT_CHARS[h];else switch(h){case W.PAL:l=ke.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break}p!==""&&a.append(p),d++}}static byteCompaction(r,i,s,a,l){let u=new Mv,d=0,h=0,p=!1;switch(r){case W.BYTE_COMPACTION_MODE_LATCH:let w=new Int32Array(6),E=i[a++];for(;a<i[0]&&!p;)switch(w[d++]=E,h=900*h+E,E=i[a++],E){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:a--,p=!0;break;default:if(d%5===0&&d>0){for(let S=0;S<6;++S)u.write(Number(Nn(h)>>Nn(8*(5-S))));h=0,d=0}break}a===i[0]&&E<W.TEXT_COMPACTION_MODE_LATCH&&(w[d++]=E);for(let S=0;S<d;S++)u.write(w[S]);break;case W.BYTE_COMPACTION_MODE_LATCH_6:for(;a<i[0]&&!p;){let S=i[a++];if(S<W.TEXT_COMPACTION_MODE_LATCH)d++,h=900*h+S;else switch(S){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:a--,p=!0;break}if(d%5===0&&d>0){for(let b=0;b<6;++b)u.write(Number(Nn(h)>>Nn(8*(5-b))));h=0,d=0}}break}return l.append(ye.decode(u.toByteArray(),s)),a}static numericCompaction(r,i,s){let a=0,l=!1,u=new Int32Array(W.MAX_NUMERIC_CODEWORDS);for(;i<r[0]&&!l;){let d=r[i++];if(i===r[0]&&(l=!0),d<W.TEXT_COMPACTION_MODE_LATCH)u[a]=d,a++;else switch(d){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:i--,l=!0;break}(a%W.MAX_NUMERIC_CODEWORDS===0||d===W.NUMERIC_COMPACTION_MODE_LATCH||l)&&a>0&&(s.append(W.decodeBase900toBase10(u,a)),a=0)}return i}static decodeBase900toBase10(r,i){let s=Nn(0);for(let l=0;l<i;l++)s+=W.EXP900[i-l-1]*Nn(r[l]);let a=s.toString();if(a.charAt(0)!=="1")throw new B;return a.substring(1)}}W.TEXT_COMPACTION_MODE_LATCH=900,W.BYTE_COMPACTION_MODE_LATCH=901,W.NUMERIC_COMPACTION_MODE_LATCH=902,W.BYTE_COMPACTION_MODE_LATCH_6=924,W.ECI_USER_DEFINED=925,W.ECI_GENERAL_PURPOSE=926,W.ECI_CHARSET=927,W.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,W.MACRO_PDF417_TERMINATOR=922,W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,W.MAX_NUMERIC_CODEWORDS=15,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,W.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,W.PL=25,W.LL=27,W.AS=27,W.ML=28,W.AL=28,W.PS=29,W.PAL=29,W.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
69
|
-
-.$/"|*()?{}'`,W.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",W.EXP900=Ud()?Pv():[],W.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ve{constructor(){}static decode(r,i,s,a,l,u,d){let h=new ai(r,i,s,a,l),p=null,w=null,E;for(let D=!0;;D=!1){if(i!=null&&(p=ve.getRowIndicatorColumn(r,h,i,!0,u,d)),a!=null&&(w=ve.getRowIndicatorColumn(r,h,a,!1,u,d)),E=ve.merge(p,w),E==null)throw H.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,w);let b=p!=null;for(let D=1;D<=S;D++){let P=b?D:S-D;if(E.getDetectionResultColumn(P)!==void 0)continue;let L;P===0||P===S?L=new kd(h,P===0):L=new Fs(h),E.setDetectionResultColumn(P,L);let $=-1,Q=$;for(let q=h.getMinY();q<=h.getMaxY();q++){if($=ve.getStartColumn(E,P,q,b),$<0||$>h.getMaxX()){if(Q===-1)continue;$=Q}let K=ve.detectCodeword(r,h.getMinX(),h.getMaxX(),b,$,q,u,d);K!=null&&(L.setCodeword(q,K),Q=$,u=Math.min(u,K.getWidth()),d=Math.max(d,K.getWidth()))}}return ve.createDecoderResult(E)}static merge(r,i){if(r==null&&i==null)return null;let s=ve.getBarcodeMetadata(r,i);if(s==null)return null;let a=ai.merge(ve.adjustBoundingBox(r),ve.adjustBoundingBox(i));return new js(s,a)}static adjustBoundingBox(r){if(r==null)return null;let i=r.getRowHeights();if(i==null)return null;let s=ve.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 u=0;for(let d=i.length-1;d>=0&&(u+=s-i[d],!(i[d]>0));d--);for(let d=l.length-1;u>0&&l[d]==null;d--)u--;return r.getBoundingBox().addMissingRows(a,u,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,u){let d=new kd(i,a);for(let h=0;h<2;h++){let p=h===0?1:-1,w=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=ve.detectCodeword(r,0,r.getWidth(),a,w,E,l,u);S!=null&&(d.setCodeword(E,S),a?w=S.getStartX():w=S.getEndX())}}return d}static adjustCodewordCount(r,i){let s=i[0][1],a=s.getValue(),l=r.getBarcodeColumnCount()*r.getBarcodeRowCount()-ve.getNumberOfECCodeWords(r.getBarcodeECLevel());if(a.length===0){if(l<1||l>he.MAX_CODEWORDS_IN_BARCODE)throw H.getNotFoundInstance();s.setValue(l)}else a[0]!==l&&s.setValue(l)}static createDecoderResult(r){let i=ve.createBarcodeMatrix(r);ve.adjustCodewordCount(r,i);let s=new Array,a=new Int32Array(r.getBarcodeRowCount()*r.getBarcodeColumnCount()),l=[],u=new Array;for(let h=0;h<r.getBarcodeRowCount();h++)for(let p=0;p<r.getBarcodeColumnCount();p++){let w=i[h][p+1].getValue(),E=h*r.getBarcodeColumnCount()+p;w.length===0?s.push(E):w.length===1?a[E]=w[0]:(u.push(E),l.push(w))}let d=new Array(l.length);for(let h=0;h<d.length;h++)d[h]=l[h];return ve.createDecoderResultFromAmbiguousValues(r.getBarcodeECLevel(),a,he.toIntArray(s),he.toIntArray(u),d)}static createDecoderResultFromAmbiguousValues(r,i,s,a,l){let u=new Int32Array(a.length),d=100;for(;d-- >0;){for(let h=0;h<u.length;h++)i[a[h]]=l[h][u[h]];try{return ve.decodeCodewords(i,r,s)}catch(h){if(!(h instanceof O))throw h}if(u.length===0)throw O.getChecksumInstance();for(let h=0;h<u.length;h++)if(u[h]<l[h].length-1){u[h]++;break}else if(u[h]=0,h===u.length-1)throw O.getChecksumInstance()}throw O.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 Us;let s=0;for(let a of r.getDetectionResultColumns()){if(a!=null){for(let l of a.getCodewords())if(l!=null){let u=l.getRowNumber();if(u>=0){if(u>=i.length)continue;i[u][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,u=null;if(ve.isValidBarcodeColumn(r,i-l)&&(u=r.getDetectionResultColumn(i-l).getCodeword(s)),u!=null)return a?u.getEndX():u.getStartX();if(u=r.getDetectionResultColumn(i).getCodewordNearby(s),u!=null)return a?u.getStartX():u.getEndX();if(ve.isValidBarcodeColumn(r,i-l)&&(u=r.getDetectionResultColumn(i-l).getCodewordNearby(s)),u!=null)return a?u.getEndX():u.getStartX();let d=0;for(;ve.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,u,d,h){l=ve.adjustCodewordStartColumn(r,i,s,a,l,u);let p=ve.getModuleBitCount(r,i,s,a,l,u);if(p==null)return null;let w,E=Re.sum(p);if(a)w=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}w=l,l=w-E}if(!ve.checkCodewordSkew(E,d,h))return null;let S=Jt.getDecodedValue(p),b=he.getCodeword(S);return b===-1?null:new Ws(l,w,ve.getCodewordBucketNumber(S),b)}static getModuleBitCount(r,i,s,a,l,u){let d=l,h=new Int32Array(8),p=0,w=a?1:-1,E=a;for(;(a?d<s:d>=i)&&p<h.length;)r.get(d,u)===E?(h[p]++,d+=w):(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,u){let d=l,h=a?-1:1;for(let p=0;p<2;p++){for(;(a?d>=i:d<s)&&a===r.get(d,u);){if(Math.abs(l-d)>ve.CODEWORD_SKEW_SIZE)return l;d+=h}h=-h,a=!a}return d}static checkCodewordSkew(r,i,s){return i-ve.CODEWORD_SKEW_SIZE<=r&&r<=s+ve.CODEWORD_SKEW_SIZE}static decodeCodewords(r,i,s){if(r.length===0)throw B.getFormatInstance();let a=1<<i+1,l=ve.correctErrors(r,s,a);ve.verifyCodewordCount(r,a);let u=W.decode(r,""+i);return u.setErrorsCorrected(l),u.setErasures(s.length),u}static correctErrors(r,i,s){if(i!=null&&i.length>s/2+ve.MAX_ERRORS||s<0||s>ve.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return ve.errorCorrection.decode(r,s,i)}static verifyCodewordCount(r,i){if(r.length<4)throw B.getFormatInstance();let s=r[0];if(s>r.length)throw B.getFormatInstance();if(s===0)if(i<r.length)r[0]=r.length-i;else throw B.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 ve.getCodewordBucketNumber(ve.getBitCountForCodeword(r))}static getCodewordBucketNumber_Int32Array(r){return(r[0]-r[2]+r[4]-r[6]+9)%9}static toString(r){let i=new Ls;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()}}ve.CODEWORD_SKEW_SIZE=2,ve.MAX_ERRORS=3,ve.MAX_EC_CODEWORDS=512,ve.errorCorrection=new Pd;class _t{decode(r,i=null){let s=_t.decode(r,i,!1);if(s==null||s.length===0||s[0]==null)throw H.getNotFoundInstance();return s[0]}decodeMultiple(r,i=null){try{return _t.decode(r,i,!0)}catch(s){throw s instanceof B||s instanceof O?H.getNotFoundInstance():s}}static decode(r,i,s){const a=new Array,l=we.detectMultiple(r,i,s);for(const u of l.getPoints()){const d=ve.decode(l.getBits(),u[4],u[5],u[6],u[7],_t.getMinCodewordWidth(u),_t.getMaxCodewordWidth(u)),h=new Ke(d.getText(),d.getRawBytes(),void 0,u,le.PDF_417);h.putMetadata(Ct.ERROR_CORRECTION_LEVEL,d.getECLevel());const p=d.getOther();p!=null&&h.putMetadata(Ct.PDF417_EXTRA_METADATA,p),a.push(h)}return a.map(u=>u)}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?_.MAX_VALUE:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMaxCodewordWidth(r){return Math.floor(Math.max(Math.max(_t.getMaxWidth(r[0],r[4]),_t.getMaxWidth(r[6],r[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.max(_t.getMaxWidth(r[1],r[5]),_t.getMaxWidth(r[7],r[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(r){return Math.floor(Math.min(Math.min(_t.getMinWidth(r[0],r[4]),_t.getMinWidth(r[6],r[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.min(_t.getMinWidth(r[1],r[5]),_t.getMinWidth(r[7],r[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}reset(){}}class pa extends x{}pa.kind="ReaderException";class jd{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(j.TRY_HARDER)===!0,s=o(r)?null:r.get(j.POSSIBLE_FORMATS),a=new Array;if(!o(s)){const l=s.some(u=>u===le.UPC_A||u===le.UPC_E||u===le.EAN_13||u===le.EAN_8||u===le.CODABAR||u===le.CODE_39||u===le.CODE_93||u===le.CODE_128||u===le.ITF||u===le.RSS_14||u===le.RSS_EXPANDED);l&&!i&&a.push(new ki(r,this.verbose)),s.includes(le.QR_CODE)&&a.push(new On),s.includes(le.DATA_MATRIX)&&a.push(new _n),s.includes(le.AZTEC)&&a.push(new ua),s.includes(le.PDF_417)&&a.push(new _t),l&&i&&a.push(new ki(r,this.verbose))}a.length===0&&(i||a.push(new ki(r,this.verbose)),a.push(new On),a.push(new _n),a.push(new ua),a.push(new _t),i&&a.push(new ki(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 pa("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 pa)continue}throw new H("No MultiFormat Readers were able to detect the code.")}}class kv extends yr{constructor(r=null,i=500){const s=new jd;s.setHints(r),super(s,i)}decodeBitmap(r){return this.reader.decodeWithState(r)}}class Bv extends yr{constructor(r=500){super(new _t,r)}}class Lv extends yr{constructor(r=500){super(new On,r)}}var ec;(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"})(ec||(ec={}));var mt=ec;class tc{constructor(r){this.field=r,this.cachedGenerators=[],this.cachedGenerators.push(new Zt(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 u=s.multiply(new Zt(a,Int32Array.from([1,a.exp(l-1+a.getGeneratorBase())])));i.push(u),s=u}}return i[r]}encode(r,i){if(i===0)throw new A("No error correction bytes");const s=r.length-i;if(s<=0)throw new A("No data bytes provided");const a=this.buildGenerator(i),l=new Int32Array(s);M.arraycopy(r,0,l,0,s);let u=new Zt(this.field,l);u=u.multiplyByMonomial(i,1);const h=u.divide(a)[1].getCoefficients(),p=i-h.length;for(let w=0;w<p;w++)r[s+w]=0;M.arraycopy(h,0,r,s+p,h.length)}}class it{constructor(){}static applyMaskPenaltyRule1(r){return it.applyMaskPenaltyRule1Internal(r,!0)+it.applyMaskPenaltyRule1Internal(r,!1)}static applyMaskPenaltyRule2(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let u=0;u<l-1;u++){const d=s[u];for(let h=0;h<a-1;h++){const p=d[h];p===d[h+1]&&p===s[u+1][h]&&p===s[u+1][h+1]&&i++}}return it.N2*i}static applyMaskPenaltyRule3(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let u=0;u<l;u++)for(let d=0;d<a;d++){const h=s[u];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&&(it.isWhiteHorizontal(h,d-4,d)||it.isWhiteHorizontal(h,d+7,d+11))&&i++,u+6<l&&s[u][d]===1&&s[u+1][d]===0&&s[u+2][d]===1&&s[u+3][d]===1&&s[u+4][d]===1&&s[u+5][d]===0&&s[u+6][d]===1&&(it.isWhiteVertical(s,d,u-4,u)||it.isWhiteVertical(s,d,u+7,u+11))&&i++}return i*it.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 w=0;w<a;w++)p[w]===1&&i++}const u=r.getHeight()*r.getWidth();return Math.floor(Math.abs(i*2-u)*10/u)*it.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 A("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(),u=r.getArray();for(let d=0;d<a;d++){let h=0,p=-1;for(let w=0;w<l;w++){const E=i?u[d][w]:u[w][d];E===p?h++:(h>=5&&(s+=it.N1+(h-5)),h=1,p=E)}h>=5&&(s+=it.N1+(h-5))}return s}}it.N1=3,it.N2=3,it.N3=40,it.N4=10;class xa{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)T.fill(i,r)}equals(r){if(!(r instanceof xa))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],u=i.bytes[s];for(let d=0,h=this.width;d<h;++d)if(l[d]!==u[d])return!1}return!0}toString(){const r=new ge;for(let i=0,s=this.height;i<s;++i){const a=this.bytes[i];for(let l=0,u=this.width;l<u;++l)switch(a[l]){case 0:r.append(" 0");break;case 1:r.append(" 1");break;default:r.append(" ");break}r.append(`
|
|
67
|
+
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ue.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,u=i-a;return Math.sqrt(l*l+u*u)}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 aa{static floatToIntBits(r){return r}}aa.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*aa.floatToIntBits(this.x)+aa.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,u,d;if(s>=i&&s>=a?(u=r[0],l=r[1],d=r[2]):a>=s&&a>=i?(u=r[1],l=r[0],d=r[2]):(u=r[2],l=r[0],d=r[1]),this.crossProductZ(l,u,d)<0){const h=l;l=d,d=h}r[0]=l,r[1]=u,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 la{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class Td extends la{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 an{constructor(r,i,s,a){this.image=r,this.height=r.getHeight(),this.width=r.getWidth(),i==null&&(i=an.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 H}detect(){let r=this.leftInit,i=this.rightInit,s=this.upInit,a=this.downInit,l=!1,u=!0,d=!1,h=!1,p=!1,w=!1,E=!1;const S=this.width,b=this.height;for(;u;){u=!1;let D=!0;for(;(D||!h)&&i<S;)D=this.containsBlackPoint(s,a,i,!1),D?(i++,u=!0,h=!0):h||i++;if(i>=S){l=!0;break}let M=!0;for(;(M||!p)&&a<b;)M=this.containsBlackPoint(r,i,a,!0),M?(a++,u=!0,p=!0):p||a++;if(a>=b){l=!0;break}let L=!0;for(;(L||!w)&&r>=0;)L=this.containsBlackPoint(s,a,r,!1),L?(r--,u=!0,w=!0):w||r--;if(r<0){l=!0;break}let $=!0;for(;($||!E)&&s>=0;)$=this.containsBlackPoint(r,i,s,!0),$?(s--,u=!0,E=!0):E||s--;if(s<0){l=!0;break}u&&(d=!0)}if(!l&&d){const D=i-r;let M=null;for(let q=1;M===null&&q<D;q++)M=this.getBlackPointOnSegment(r,a-q,r+q,a);if(M==null)throw new H;let L=null;for(let q=1;L===null&&q<D;q++)L=this.getBlackPointOnSegment(r,s+q,r+q,s);if(L==null)throw new H;let $=null;for(let q=1;$===null&&q<D;q++)$=this.getBlackPointOnSegment(i,s+q,i-q,s);if($==null)throw new H;let Q=null;for(let q=1;Q===null&&q<D;q++)Q=this.getBlackPointOnSegment(i,a-q,i-q,a);if(Q==null)throw new H;return this.centerEdges(Q,M,$,L)}else throw new H}getBlackPointOnSegment(r,i,s,a){const l=Re.round(Re.distance(r,i,s,a)),u=(s-r)/l,d=(a-i)/l,h=this.image;for(let p=0;p<l;p++){const w=Re.round(r+p*u),E=Re.round(i+p*d);if(h.get(w,E))return new ae(w,E)}return null}centerEdges(r,i,s,a){const l=r.getX(),u=r.getY(),d=i.getX(),h=i.getY(),p=s.getX(),w=s.getY(),E=a.getX(),S=a.getY(),b=an.CORR;return l<this.width/2?[new ae(E-b,S+b),new ae(d+b,h+b),new ae(p-b,w-b),new ae(l+b,u-b)]:[new ae(E+b,S+b),new ae(d+b,h-b),new ae(p-b,w+b),new ae(l-b,u-b)]}containsBlackPoint(r,i,s,a){const l=this.image;if(a){for(let u=r;u<=i;u++)if(l.get(u,s))return!0}else for(let u=r;u<=i;u++)if(l.get(s,u))return!0;return!1}}an.INIT_SIZE=10,an.CORR=1;class $u{static checkAndNudgePoints(r,i){const s=r.getWidth(),a=r.getHeight();let l=!0;for(let u=0;u<i.length&&l;u+=2){const d=Math.floor(i[u]),h=Math.floor(i[u+1]);if(d<-1||d>s||h<-1||h>a)throw new H;l=!1,d===-1?(i[u]=0,l=!0):d===s&&(i[u]=s-1,l=!0),h===-1?(i[u+1]=0,l=!0):h===a&&(i[u+1]=a-1,l=!0)}l=!0;for(let u=i.length-2;u>=0&&l;u-=2){const d=Math.floor(i[u]),h=Math.floor(i[u+1]);if(d<-1||d>s||h<-1||h>a)throw new H;l=!1,d===-1?(i[u]=0,l=!0):d===s&&(i[u]=s-1,l=!0),h===-1?(i[u+1]=0,l=!0):h===a&&(i[u+1]=a-1,l=!0)}}}class Nr{constructor(r,i,s,a,l,u,d,h,p){this.a11=r,this.a21=i,this.a31=s,this.a12=a,this.a22=l,this.a32=u,this.a13=d,this.a23=h,this.a33=p}static quadrilateralToQuadrilateral(r,i,s,a,l,u,d,h,p,w,E,S,b,D,M,L){const $=Nr.quadrilateralToSquare(r,i,s,a,l,u,d,h);return Nr.squareToQuadrilateral(p,w,E,S,b,D,M,L).times($)}transformPoints(r){const i=r.length,s=this.a11,a=this.a12,l=this.a13,u=this.a21,d=this.a22,h=this.a23,p=this.a31,w=this.a32,E=this.a33;for(let S=0;S<i;S+=2){const b=r[S],D=r[S+1],M=l*b+h*D+E;r[S]=(s*b+u*D+p)/M,r[S+1]=(a*b+d*D+w)/M}}transformPointsWithValues(r,i){const s=this.a11,a=this.a12,l=this.a13,u=this.a21,d=this.a22,h=this.a23,p=this.a31,w=this.a32,E=this.a33,S=r.length;for(let b=0;b<S;b++){const D=r[b],M=i[b],L=l*D+h*M+E;r[b]=(s*D+u*M+p)/L,i[b]=(a*D+d*M+w)/L}}static squareToQuadrilateral(r,i,s,a,l,u,d,h){const p=r-s+l-d,w=i-a+u-h;if(p===0&&w===0)return new Nr(s-r,l-s,r,a-i,u-a,i,0,0,1);{const E=s-l,S=d-l,b=a-u,D=h-u,M=E*D-S*b,L=(p*D-S*w)/M,$=(E*w-p*b)/M;return new Nr(s-r+L*s,d-r+$*d,r,a-i+L*a,h-i+$*h,i,L,$,1)}}static quadrilateralToSquare(r,i,s,a,l,u,d,h){return Nr.squareToQuadrilateral(r,i,s,a,l,u,d,h).buildAdjoint()}buildAdjoint(){return new Nr(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 Nr(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 Rd extends $u{sampleGrid(r,i,s,a,l,u,d,h,p,w,E,S,b,D,M,L,$,Q,q){const K=Nr.quadrilateralToQuadrilateral(a,l,u,d,h,p,w,E,S,b,D,M,L,$,Q,q);return this.sampleGridWithTransform(r,i,s,K)}sampleGridWithTransform(r,i,s,a){if(i<=0||s<=0)throw new H;const l=new Te(i,s),u=new Float32Array(2*i);for(let d=0;d<s;d++){const h=u.length,p=d+.5;for(let w=0;w<h;w+=2)u[w]=w/2+.5,u[w+1]=p;a.transformPoints(u),$u.checkAndNudgePoints(r,u);try{for(let w=0;w<h;w+=2)r.get(Math.floor(u[w]),Math.floor(u[w+1]))&&l.set(w/2,d)}catch{throw new H}}return l}}class Tn{static setGridSampler(r){Tn.gridSampler=r}static getInstance(){return Tn.gridSampler}}Tn.gridSampler=new Rd;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 bd{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 u=s[0];s[0]=s[2],s[2]=u}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 Td(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 H;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 u=0;u<4;u++){let d=s[(this.shift+u)%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,u)=>{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(_.bitCount(s^this.EXPECTED_CORNER_BITS[a])<=2)return a;throw new H}getCorrectedParameterData(r,i){let s,a;i?(s=7,a=2):(s=10,a=4);let l=s-a,u=new Int32Array(s);for(let h=s-1;h>=0;--h)u[h]=r&15,r>>=4;try{new Ms(Oe.AZTEC_PARAM).decode(u,l)}catch{throw new H}let d=0;for(let h=0;h<a;h++)d=(d<<4)+u[h];return d}getBullsEyeCorners(r){let i=r,s=r,a=r,l=r,u=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(i,u,1,-1),S=this.getFirstDifferent(s,u,1,1),b=this.getFirstDifferent(a,u,-1,1),D=this.getFirstDifferent(l,u,-1,-1);if(this.nbCenterLayers>2){let M=this.distancePoint(D,E)*this.nbCenterLayers/(this.distancePoint(l,i)*(this.nbCenterLayers+2));if(M<.75||M>1.25||!this.isWhiteOrBlackRectangle(E,S,b,D))break}i=E,s=S,a=b,l=D,u=!u}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new H;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),w=new ae(l.getX()-.5,l.getY()-.5);return this.expandSquare([d,h,p,w],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let r,i,s,a;try{let d=new an(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),u=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4);try{let d=new an(this.image,15,l,u).detect();r=d[0],i=d[1],s=d[2],a=d[3]}catch{r=this.getFirstDifferent(new Vt(l+7,u-7),!1,1,-1).toResultPoint(),i=this.getFirstDifferent(new Vt(l+7,u+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Vt(l-7,u+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new Vt(l-7,u-7),!1,-1,-1).toResultPoint()}return l=Re.round((r.getX()+a.getX()+i.getX()+s.getX())/4),u=Re.round((r.getY()+a.getY()+i.getY()+s.getY())/4),new Vt(l,u)}getMatrixCornerPoints(r){return this.expandSquare(r,2*this.nbCenterLayers,this.getDimension())}sampleGrid(r,i,s,a,l){let u=Tn.getInstance(),d=this.getDimension(),h=d/2-this.nbCenterLayers,p=d/2+this.nbCenterLayers;return u.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),u=l/s,d=r.getX(),h=r.getY(),p=u*(i.getX()-r.getX())/l,w=u*(i.getY()-r.getY())/l;for(let E=0;E<s;E++)this.image.get(Re.round(d+E*p),Re.round(h+E*w))&&(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 u=this.getColor(a,r);if(u===0)return!1;let d=this.getColor(r,i);return d!==u||(d=this.getColor(i,s),d!==u)?!1:(d=this.getColor(s,a),d===u)}getColor(r,i){let s=this.distancePoint(r,i),a=(i.getX()-r.getX())/s,l=(i.getY()-r.getY())/s,u=0,d=r.getX(),h=r.getY(),p=this.image.get(r.getX(),r.getY()),w=Math.ceil(s);for(let S=0;S<w;S++)d+=a,h+=l,this.image.get(Re.round(d),Re.round(h))!==p&&u++;let E=u/s;return E>.1&&E<.9?0:E<=.1===p?1:-1}getFirstDifferent(r,i,s,a){let l=r.getX()+s,u=r.getY()+a;for(;this.isValid(l,u)&&this.image.get(l,u)===i;)l+=s,u+=a;for(l-=s,u-=a;this.isValid(l,u)&&this.image.get(l,u)===i;)l+=s;for(l-=s;this.isValid(l,u)&&this.image.get(l,u)===i;)u+=a;return u-=a,new Vt(l,u)}expandSquare(r,i,s){let a=s/(2*i),l=r[0].getX()-r[2].getX(),u=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*u),w=new ae(d-a*l,h-a*u);l=r[1].getX()-r[3].getX(),u=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*u),S=new ae(d-a*l,h-a*u);return[p,E,w,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*(_.truncDivision(this.nbLayers-4,8)+1)+15}}class ua{decode(r,i=null){let s=null,a=new bd(r.getBlackMatrix()),l=null,u=null;try{let w=a.detectMirror(!1);l=w.getPoints(),this.reportFoundResultPoints(i,l),u=new Ue().decode(w)}catch(w){s=w}if(u==null)try{let w=a.detectMirror(!0);l=w.getPoints(),this.reportFoundResultPoints(i,l),u=new Ue().decode(w)}catch(w){throw s??w}let d=new Ke(u.getText(),u.getRawBytes(),u.getNumBits(),l,le.AZTEC,P.currentTimeMillis()),h=u.getByteSegments();h!=null&&d.putMetadata(Ct.BYTE_SEGMENTS,h);let p=u.getECLevel();return p!=null&&d.putMetadata(Ct.ERROR_CORRECTION_LEVEL,p),d}reportFoundResultPoints(r,i){if(r!=null){let s=r.get(j.NEED_RESULT_POINT_CALLBACK);s!=null&&i.forEach((a,l,u)=>{s.foundPossibleResultPoint(a)})}}reset(){}}class mv extends yr{constructor(r=500){super(new ua,r)}}class dt{decode(r,i){try{return this.doDecode(r,i)}catch{if(i&&i.get(j.TRY_HARDER)===!0&&r.isRotateSupported()){const l=r.rotateCounterClockwise(),u=this.doDecode(l,i),d=u.getResultMetadata();let h=270;d!==null&&d.get(Ct.ORIENTATION)===!0&&(h=h+d.get(Ct.ORIENTATION)%360),u.putMetadata(Ct.ORIENTATION,h);const p=u.getResultPoints();if(p!==null){const w=l.getHeight();for(let E=0;E<p.length;E++)p[E]=new ae(w-p[E].getY()-1,p[E].getX())}return u}else throw new H}}reset(){}doDecode(r,i){const s=r.getWidth(),a=r.getHeight();let l=new U(s);const u=i&&i.get(j.TRY_HARDER)===!0,d=Math.max(1,a>>(u?8:5));let h;u?h=a:h=15;const p=Math.trunc(a/2);for(let w=0;w<h;w++){const E=Math.trunc((w+1)/2),S=(w&1)===0,b=p+d*(S?E:-E);if(b<0||b>=a)break;try{l=r.getBlackRow(b,l)}catch{continue}for(let D=0;D<2;D++){if(D===1&&(l.reverse(),i&&i.get(j.NEED_RESULT_POINT_CALLBACK)===!0)){const M=new Map;i.forEach((L,$)=>M.set($,L)),M.delete(j.NEED_RESULT_POINT_CALLBACK),i=M}try{const M=this.decodeRow(b,l,i);if(D===1){M.putMetadata(Ct.ORIENTATION,180);const L=M.getResultPoints();L!==null&&(L[0]=new ae(s-L[0].getX()-1,L[0].getY()),L[1]=new ae(s-L[1].getX()-1,L[1].getY()))}return M}catch{}}}throw new H}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 H;let u=!r.get(i),d=0,h=i;for(;h<l;){if(r.get(h)!==u)s[d]++;else{if(++d===a)break;s[d]=1,u=!u}h++}if(!(d===a||d===a-1&&h===l))throw new H}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 H;dt.recordPattern(r,i+1,s)}static patternMatchVariance(r,i,s){const a=r.length;let l=0,u=0;for(let p=0;p<a;p++)l+=r[p],u+=i[p];if(l<u)return Number.POSITIVE_INFINITY;const d=l/u;s*=d;let h=0;for(let p=0;p<a;p++){const w=r[p],E=i[p]*d,S=w>E?w-E:E-w;if(S>s)return Number.POSITIVE_INFINITY;h+=S}return h/l}}class J extends dt{static findStartPattern(r){const i=r.getSize(),s=r.getNextSet(0);let a=0,l=Int32Array.from([0,0,0,0,0,0]),u=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 w=J.MAX_AVG_VARIANCE,E=-1;for(let S=J.CODE_START_A;S<=J.CODE_START_C;S++){const b=dt.patternMatchVariance(l,J.CODE_PATTERNS[S],J.MAX_INDIVIDUAL_VARIANCE);b<w&&(w=b,E=S)}if(E>=0&&r.isRange(Math.max(0,u-(p-u)/2),u,!1))return Int32Array.from([u,p,E]);u+=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 H}static decodeCode(r,i,s){dt.recordPattern(r,s,i);let a=J.MAX_AVG_VARIANCE,l=-1;for(let u=0;u<J.CODE_PATTERNS.length;u++){const d=J.CODE_PATTERNS[u],h=this.patternMatchVariance(i,d,J.MAX_INDIVIDUAL_VARIANCE);h<a&&(a=h,l=u)}if(l>=0)return l;throw new H}decodeRow(r,i,s){const a=s&&s.get(j.ASSUME_GS1)===!0,l=J.findStartPattern(i),u=l[2];let d=0;const h=new Uint8Array(20);h[d++]=u;let p;switch(u){case J.CODE_START_A:p=J.CODE_CODE_A;break;case J.CODE_START_B:p=J.CODE_CODE_B;break;case J.CODE_START_C:p=J.CODE_CODE_C;break;default:throw new B}let w=!1,E=!1,S="",b=l[0],D=l[1];const M=Int32Array.from([0,0,0,0,0,0]);let L=0,$=0,Q=u,q=0,K=!0,Ae=!1,me=!1;for(;!w;){const ji=E;switch(E=!1,L=$,$=J.decodeCode(i,M,D),h[d++]=$,$!==J.CODE_STOP&&(K=!0),$!==J.CODE_STOP&&(q++,Q+=q*$),b=D,D+=M.reduce((Gv,Xv)=>Gv+Xv,0),$){case J.CODE_START_A:case J.CODE_START_B:case J.CODE_START_C:throw new B}switch(p){case J.CODE_CODE_A:if($<64)me===Ae?S+=String.fromCharCode(32+$):S+=String.fromCharCode(32+$+128),me=!1;else if($<96)me===Ae?S+=String.fromCharCode($-64):S+=String.fromCharCode($+64),me=!1;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_A:!Ae&&me?(Ae=!0,me=!1):Ae&&me?(Ae=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,p=J.CODE_CODE_B;break;case J.CODE_CODE_B:p=J.CODE_CODE_B;break;case J.CODE_CODE_C:p=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_B:if($<96)me===Ae?S+=String.fromCharCode(32+$):S+=String.fromCharCode(32+$+128),me=!1;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_B:!Ae&&me?(Ae=!0,me=!1):Ae&&me?(Ae=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,p=J.CODE_CODE_A;break;case J.CODE_CODE_A:p=J.CODE_CODE_A;break;case J.CODE_CODE_C:p=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_C:if($<100)$<10&&(S+="0"),S+=$;else switch($!==J.CODE_STOP&&(K=!1),$){case J.CODE_FNC_1:a&&(S.length===0?S+="]C1":S+="");break;case J.CODE_CODE_A:p=J.CODE_CODE_A;break;case J.CODE_CODE_B:p=J.CODE_CODE_B;break;case J.CODE_STOP:w=!0;break}break}ji&&(p=p===J.CODE_CODE_A?J.CODE_CODE_B:J.CODE_CODE_A)}const er=D-b;if(D=i.getNextUnset(D),!i.isRange(D,Math.min(i.getSize(),D+(D-b)/2),!1))throw new H;if(Q-=q*L,Q%103!==L)throw new O;const Pr=S.length;if(Pr===0)throw new H;Pr>0&&K&&(p===J.CODE_CODE_C?S=S.substring(0,Pr-2):S=S.substring(0,Pr-1));const tr=(l[1]+l[0])/2,Fe=b+er/2,Ot=h.length,cr=new Uint8Array(Ot);for(let ji=0;ji<Ot;ji++)cr[ji]=h[ji];const Ui=[new ae(tr,r),new ae(Fe,r)];return new Ke(S,cr,0,Ui,le.CODE_128,new Date().getTime())}}J.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])],J.MAX_AVG_VARIANCE=.25,J.MAX_INDIVIDUAL_VARIANCE=.7,J.CODE_SHIFT=98,J.CODE_CODE_C=99,J.CODE_CODE_B=100,J.CODE_CODE_A=101,J.CODE_FNC_1=102,J.CODE_FNC_2=97,J.CODE_FNC_3=96,J.CODE_FNC_4_A=101,J.CODE_FNC_4_B=100,J.CODE_START_A=103,J.CODE_START_B=104,J.CODE_START_C=105,J.CODE_STOP=106;class pt extends dt{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=pt.findAsteriskPattern(i,a),u=i.getNextSet(l[1]),d=i.getSize(),h,p;do{pt.recordPattern(i,u,a);let M=pt.toNarrowWidePattern(a);if(M<0)throw new H;h=pt.patternToChar(M),this.decodeRowResult+=h,p=u;for(let L of a)u+=L;u=i.getNextSet(u)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let w=0;for(let M of a)w+=M;let E=u-p-w;if(u!==d&&E*2<w)throw new H;if(this.usingCheckDigit){let M=this.decodeRowResult.length-1,L=0;for(let $=0;$<M;$++)L+=pt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt($));if(this.decodeRowResult.charAt(M)!==pt.ALPHABET_STRING.charAt(L%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,M)}if(this.decodeRowResult.length===0)throw new H;let S;this.extendedMode?S=pt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let b=(l[1]+l[0])/2,D=p+w/2;return new Ke(S,null,0,[new ae(b,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,u=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)===pt.ASTERISK_ENCODING&&r.isRange(Math.max(0,u-Math.floor((p-u)/2)),u,!1))return[u,p];u+=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 H}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 u=0,d=0;for(let h=0;h<i;h++){let p=r[h];p>s&&(d|=1<<i-1-h,a++,u+=p)}if(a===3){for(let h=0;h<i&&a>0;h++){let p=r[h];if(p>s&&(a--,p*2>=u))return-1}return d}}while(a>3);return-1}static patternToChar(r){for(let i=0;i<pt.CHARACTER_ENCODINGS.length;i++)if(pt.CHARACTER_ENCODINGS[i]===r)return pt.ALPHABET_STRING.charAt(i);if(r===pt.ASTERISK_ENCODING)return"*";throw new H}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 u=r.charAt(a+1),d="\0";switch(l){case"+":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)+32);else throw new B;break;case"$":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)-64);else throw new B;break;case"%":if(u>="A"&&u<="E")d=String.fromCharCode(u.charCodeAt(0)-38);else if(u>="F"&&u<="J")d=String.fromCharCode(u.charCodeAt(0)-11);else if(u>="K"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)+16);else if(u>="P"&&u<="T")d=String.fromCharCode(u.charCodeAt(0)+43);else if(u==="U")d="\0";else if(u==="V")d="@";else if(u==="W")d="`";else if(u==="X"||u==="Y"||u==="Z")d="";else throw new B;break;case"/":if(u>="A"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)-32);else if(u==="Z")d=":";else throw new B;break}s+=d,a++}else s+=l}return s}}pt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",pt.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],pt.ASTERISK_ENCODING=148;class Be extends dt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(r,i,s){let a=this.decodeStart(i),l=this.decodeEnd(i),u=new ge;Be.decodeMiddle(i,a[1],l[0],u);let d=u.toString(),h=null;s!=null&&(h=s.get(j.ALLOWED_LENGTHS)),h==null&&(h=Be.DEFAULT_ALLOWED_LENGTHS);let p=d.length,w=!1,E=0;for(let D of h){if(p===D){w=!0;break}D>E&&(E=D)}if(!w&&p>E&&(w=!0),!w)throw new B;const S=[new ae(a[1],r),new ae(l[0],r)];return new Ke(d,null,0,S,le.ITF,new Date().getTime())}static decodeMiddle(r,i,s,a){let l=new Int32Array(10),u=new Int32Array(5),d=new Int32Array(5);for(l.fill(0),u.fill(0),d.fill(0);i<s;){dt.recordPattern(r,i,l);for(let p=0;p<5;p++){let w=2*p;u[p]=l[w],d[p]=l[w+1]}let h=Be.decodeDigit(u);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 H}static skipWhiteSpace(r){const i=r.getSize(),s=r.getNextSet(0);if(s===i)throw new H;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 H&&(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),u=r.getSize(),d=!1,h=0,p=i;l.fill(0);for(let w=i;w<u;w++)if(r.get(w)!==d)l[h]++;else{if(h===a-1){if(dt.patternMatchVariance(l,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[p,w];p+=l[0]+l[1],P.arraycopy(l,2,l,0,h-1),l[h-1]=0,l[h]=0,h--}else h++;l[h]=1,d=!d}throw new H}static decodeDigit(r){let i=Be.MAX_AVG_VARIANCE,s=-1,a=Be.PATTERNS.length;for(let l=0;l<a;l++){let u=Be.PATTERNS[l],d=dt.patternMatchVariance(r,u,Be.MAX_INDIVIDUAL_VARIANCE);d<i?(i=d,s=l):d===i&&(s=-1)}if(s>=0)return s%10;throw new H}}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 rt extends dt{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=rt.findGuardPattern(r,a,!1,this.START_END_PATTERN,l);let u=s[0];a=s[1];let d=u-(a-u);d>=0&&(i=r.isRange(d,u,!1))}return s}static checkChecksum(r){return rt.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return rt.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 B;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 B;s+=l}return(1e3-s)%10}static decodeEnd(r,i){return rt.findGuardPattern(r,i,!1,rt.START_END_PATTERN,new Int32Array(rt.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 u=r.getSize();i=s?r.getNextUnset(i):r.getNextSet(i);let d=0,h=i,p=a.length,w=s;for(let E=i;E<u;E++)if(r.get(E)!==w)l[d]++;else{if(d===p-1){if(dt.patternMatchVariance(l,a,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([h,E]);h+=l[0]+l[1];let S=l.slice(2,l.length-1);for(let b=0;b<d-1;b++)l[b]=S[b];l[d-1]=0,l[d]=0,d--}else d++;l[d]=1,w=!w}throw new H}static decodeDigit(r,i,s,a){this.recordPattern(r,s,i);let l=this.MAX_AVG_VARIANCE,u=-1,d=a.length;for(let h=0;h<d;h++){let p=a[h],w=dt.patternMatchVariance(i,p,rt.MAX_INDIVIDUAL_VARIANCE);w<l&&(l=w,u=h)}if(u>=0)return u;throw new H}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 ks{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),u=a.toString(),d=ks.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ke(u,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(),u=i[1],d=0;for(let p=0;p<5&&u<l;p++){let w=rt.decodeDigit(r,a,u,rt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<4-p),p!==4&&(u=r.getNextSet(u),u=r.getNextUnset(u))}if(s.length!==5)throw new H;let h=this.determineCheckDigit(d);if(ks.extensionChecksum(s.toString())!==h)throw new H;return u}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 H}static parseExtensionString(r){if(r.length!==5)return null;let i=ks.parseExtension5String(r);return i==null?null:new Map([[Ct.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,u=l<10?"0"+l:l.toString();return i+a+"."+u}}class Vu{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),u=a.toString(),d=Vu.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,r),new ae(l,r)],p=new Ke(u,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(),u=i[1],d=0;for(let h=0;h<2&&u<l;h++){let p=rt.decodeDigit(r,a,u,rt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+p%10);for(let w of a)u+=w;p>=10&&(d|=1<<1-h),h!==1&&(u=r.getNextSet(u),u=r.getNextUnset(u))}if(s.length!==2)throw new H;if(parseInt(s.toString())%4!==d)throw new H;return u}static parseExtensionString(r){return r.length!==2?null:new Map([[Ct.ISSUE_NUMBER,parseInt(r)]])}}class _d{static decodeRow(r,i,s){let a=rt.findGuardPattern(i,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ks().decodeRow(r,i,a)}catch{return new Vu().decodeRow(r,i,a)}}}_d.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ne extends rt{constructor(){super(),this.decodeRowStringBuffer="",Ne.L_AND_G_PATTERNS=Ne.L_PATTERNS.map(r=>Int32Array.from(r));for(let r=10;r<20;r++){let i=Ne.L_PATTERNS[r-10],s=new Int32Array(i.length);for(let a=0;a<i.length;a++)s[a]=i[i.length-a-1];Ne.L_AND_G_PATTERNS[r]=s}}decodeRow(r,i,s){let a=Ne.findStartGuardPattern(i),l=s==null?null:s.get(j.NEED_RESULT_POINT_CALLBACK);if(l!=null){const K=new ae((a[0]+a[1])/2,r);l.foundPossibleResultPoint(K)}let u=this.decodeMiddle(i,a,this.decodeRowStringBuffer),d=u.rowOffset,h=u.resultString;if(l!=null){const K=new ae(d,r);l.foundPossibleResultPoint(K)}let p=this.decodeEnd(i,d);if(l!=null){const K=new ae((p[0]+p[1])/2,r);l.foundPossibleResultPoint(K)}let w=p[1],E=w+(w-p[0]);if(E>=i.getSize()||!i.isRange(w,E,!1))throw new H;let S=h.toString();if(S.length<8)throw new B;if(!Ne.checkChecksum(S))throw new O;let b=(a[1]+a[0])/2,D=(p[1]+p[0])/2,M=this.getBarcodeFormat(),L=[new ae(b,r),new ae(D,r)],$=new Ke(S,null,0,L,M,new Date().getTime()),Q=0;try{let K=_d.decodeRow(r,i,p[1]);$.putMetadata(Ct.UPC_EAN_EXTENSION,K.getText()),$.putAllMetadata(K.getResultMetadata()),$.addResultPoints(K.getResultPoints()),Q=K.getText().length}catch{}let q=s==null?null:s.get(j.ALLOWED_EAN_EXTENSIONS);if(q!=null){let K=!1;for(let Ae in q)if(Q.toString()===Ae){K=!0;break}if(!K)throw new H}return $}decodeEnd(r,i){return Ne.findGuardPattern(r,i,!1,Ne.START_END_PATTERN,new Int32Array(Ne.START_END_PATTERN.length).fill(0))}static checkChecksum(r){return Ne.checkStandardUPCEANChecksum(r)}static checkStandardUPCEANChecksum(r){let i=r.length;if(i===0)return!1;let s=parseInt(r.charAt(i-1),10);return Ne.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 B;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 B;s+=l}return(1e3-s)%10}}class ii extends Ne{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(),u=i[1],d=0;for(let p=0;p<6&&u<l;p++){let w=Ne.decodeDigit(r,a,u,Ne.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<5-p)}s=ii.determineFirstDigit(s,d),u=Ne.findGuardPattern(r,u,!0,Ne.MIDDLE_PATTERN,new Int32Array(Ne.MIDDLE_PATTERN.length).fill(0))[1];for(let p=0;p<6&&u<l;p++){let w=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+w);for(let E of a)u+=E}return{rowOffset:u,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 H}}ii.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Od extends Ne{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(),u=i[1];for(let h=0;h<4&&u<l;h++){let p=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+p);for(let w of a)u+=w}u=Ne.findGuardPattern(r,u,!0,Ne.MIDDLE_PATTERN,new Int32Array(Ne.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<4&&u<l;h++){let p=Ne.decodeDigit(r,a,u,Ne.L_PATTERNS);s+=String.fromCharCode(48+p);for(let w of a)u+=w}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class Nd extends Ne{constructor(){super(...arguments),this.ean13Reader=new ii}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 Ke(i.substring(1),null,null,r.getResultPoints(),le.UPC_A);return r.getResultMetadata()!=null&&s.putAllMetadata(r.getResultMetadata()),s}else throw new H}reset(){this.ean13Reader.reset()}}class Dr extends Ne{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 u=i[1],d=0;for(let p=0;p<6&&u<l;p++){const w=Dr.decodeDigit(r,a,u,Dr.L_AND_G_PATTERNS);s+=String.fromCharCode(48+w%10);for(let E of a)u+=E;w>=10&&(d|=1<<5-p)}let h=Dr.determineNumSysAndCheckDigit(s,d);return{rowOffset:u,resultString:h}}decodeEnd(r,i){return Dr.findGuardPatternWithoutCounters(r,i,!0,Dr.MIDDLE_END_PATTERN)}checkChecksum(r){return Ne.checkChecksum(Dr.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),u=String.fromCharCode(48+a);return l+r+u}throw H.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(r){const i=r.slice(1,7).split("").map(l=>l.charCodeAt(0)),s=new ge;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()}}Dr.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Dr.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 zu extends dt{constructor(r){super();let i=r==null?null:r.get(j.POSSIBLE_FORMATS),s=[];o(i)?(s.push(new ii),s.push(new Nd),s.push(new Od),s.push(new Dr)):(i.indexOf(le.EAN_13)>-1&&s.push(new ii),i.indexOf(le.UPC_A)>-1&&s.push(new Nd),i.indexOf(le.EAN_8)>-1&&s.push(new Od),i.indexOf(le.UPC_E)>-1&&s.push(new Dr)),this.readers=s}decodeRow(r,i,s){for(let a of this.readers)try{const l=a.decodeRow(r,i,s),u=l.getBarcodeFormat()===le.EAN_13&&l.getText().charAt(0)==="0",d=s==null?null:s.get(j.POSSIBLE_FORMATS),h=d==null||d.includes(le.UPC_A);if(u&&h){const p=l.getRawBytes(),w=new Ke(l.getText().substring(1),p,p?p.length:null,l.getResultPoints(),le.UPC_A);return w.putAllMetadata(l.getResultMetadata()),w}return l}catch{}throw new H}reset(){for(let r of this.readers)r.reset()}}class Lt extends dt{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(dt.patternMatchVariance(r,i[s],Lt.MAX_INDIVIDUAL_VARIANCE)<Lt.MAX_AVG_VARIANCE)return s;throw new H}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>=Lt.MIN_FINDER_PATTERN_RATIO&&a<=Lt.MAX_FINDER_PATTERN_RATIO){let l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;for(let d of r)d>u&&(u=d),d<l&&(l=d);return u<10*l}return!1}}Lt.MAX_AVG_VARIANCE=.2,Lt.MAX_INDIVIDUAL_VARIANCE=.45,Lt.MIN_FINDER_PATTERN_RATIO=9.5/12,Lt.MAX_FINDER_PATTERN_RATIO=12.5/14;class Di{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 Di))return!1;const i=r;return this.value===i.value&&this.checksumPortion===i.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ca{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 ca))return!1;const i=r;return this.value===i.value}hashCode(){return this.value}}class Gr{constructor(){}static getRSSvalue(r,i,s){let a=0;for(let h of r)a+=h;let l=0,u=0,d=r.length;for(let h=0;h<d-1;h++){let p;for(p=1,u|=1<<h;p<r[h];p++,u&=~(1<<h)){let w=Gr.combins(a-p-1,d-h-2);if(s&&u===0&&a-p-(d-h-1)>=d-h-1&&(w-=Gr.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+=Gr.combins(a-p-S-1,d-h-3);w-=E*(d-1-h)}else a-p>i&&w--;l+=w}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,u=1;for(let d=r;d>s;d--)l*=d,u<=a&&(l/=u,u++);for(;u<=a;)l/=u,u++;return l}}class wv{static buildBitArray(r){let i=r.length*2-1;r[r.length-1].getRightChar()==null&&(i-=1);let s=12*i,a=new U(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],w=p.getLeftChar().getValue();for(let E=11;E>=0;--E)w&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 si{constructor(r,i){i?this.decodedInformation=null:(this.finished=r,this.decodedInformation=i)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Hu{constructor(r){this.newPosition=r}getNewPosition(){return this.newPosition}}class Qt extends Hu{constructor(r,i){super(r),this.value=i}getValue(){return this.value}isFNC1(){return this.value===Qt.FNC1}}Qt.FNC1="$";class oi extends Hu{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 Er extends Hu{constructor(r,i,s){if(super(r),i<0||i>10||s<0||s>10)throw new B;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===Er.FNC1}isSecondDigitFNC1(){return this.secondDigit===Er.FNC1}isAnyFNC1(){return this.firstDigit===Er.FNC1||this.secondDigit===Er.FNC1}}Er.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(r){if(!r)return null;if(r.length<2)throw new H;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 H;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 H;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 H}static processFixedAI(r,i,s){if(s.length<r)throw new H;let a=s.substring(0,r);if(s.length<r+i)throw new H;let l=s.substring(r,r+i),u=s.substring(r+i),d="("+a+")"+l,h=ne.parseFieldsInGeneralPurpose(u);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 u=s.substring(r,l),d=s.substring(l),h="("+a+")"+u,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 Pi{constructor(r){this.buffer=new ge,this.information=r}decodeAllCodes(r,i){let s=i,a=null;do{let l=this.decodeGeneralPurposeField(s,a),u=ne.parseFieldsInGeneralPurpose(l.getNewString());if(u!=null&&r.append(u),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 Er(this.information.getSize(),Er.FNC1,Er.FNC1):new Er(this.information.getSize(),l-1,Er.FNC1)}let i=this.extractNumericValueFromBitArray(r,7),s=(i-8)/11,a=(i-8)%11;return new Er(r+7,s,a)}extractNumericValueFromBitArray(r,i){return Pi.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 oi(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new oi(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 oi(this.current.getPosition(),this.buffer.toString()):i=new oi(this.current.getPosition(),this.buffer.toString(),r.getSecondDigit()),new si(!0,i)}if(this.buffer.append(r.getFirstDigit()),r.isSecondDigitFNC1()){let i=new oi(this.current.getPosition(),this.buffer.toString());return new si(!0,i)}this.buffer.append(r.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new si(!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 oi(this.current.getPosition(),this.buffer.toString());return new si(!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 si(!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 oi(this.current.getPosition(),this.buffer.toString());return new si(!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 si(!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 B}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 Hr("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 Gu{constructor(r){this.information=r,this.generalDecoder=new Pi(r)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class qt extends Gu{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)}qt.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)}}qt.GTIN_SIZE=40;class Mi extends qt{constructor(r){super(r)}parseInformation(){let r=new ge;r.append("(01)");let i=r.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(Mi.HEADER_SIZE,4);return r.append(s),this.encodeCompressedGtinWithoutAI(r,Mi.HEADER_SIZE+4,i),this.getGeneralDecoder().decodeAllCodes(r,Mi.HEADER_SIZE+44)}}Mi.HEADER_SIZE=4;class fa extends Gu{constructor(r){super(r)}parseInformation(){let r=new ge;return this.getGeneralDecoder().decodeAllCodes(r,fa.HEADER_SIZE)}}fa.HEADER_SIZE=5;class da extends qt{constructor(r){super(r)}encodeCompressedWeight(r,i,s){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(i,s);this.addWeightCode(r,a);let l=this.checkWeight(a),u=1e5;for(let d=0;d<5;++d)l/u===0&&r.append("0"),u/=10;r.append(l)}}class Xr extends da{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()!=Xr.HEADER_SIZE+da.GTIN_SIZE+Xr.WEIGHT_SIZE)throw new H;let r=new ge;return this.encodeCompressedGtin(r,Xr.HEADER_SIZE),this.encodeCompressedWeight(r,Xr.HEADER_SIZE+da.GTIN_SIZE,Xr.WEIGHT_SIZE),r.toString()}}Xr.HEADER_SIZE=5,Xr.WEIGHT_SIZE=15;class vv extends Xr{constructor(r){super(r)}addWeightCode(r,i){r.append("(3103)")}checkWeight(r){return r}}class yv extends Xr{constructor(r){super(r)}addWeightCode(r,i){i<1e4?r.append("(3202)"):r.append("(3203)")}checkWeight(r){return r<1e4?r:r-1e4}}class Yr extends qt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<Yr.HEADER_SIZE+qt.GTIN_SIZE)throw new H;let r=new ge;this.encodeCompressedGtin(r,Yr.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(Yr.HEADER_SIZE+qt.GTIN_SIZE,Yr.LAST_DIGIT_SIZE);r.append("(392"),r.append(i),r.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Yr.HEADER_SIZE+qt.GTIN_SIZE+Yr.LAST_DIGIT_SIZE,null);return r.append(s.getNewString()),r.toString()}}Yr.HEADER_SIZE=8,Yr.LAST_DIGIT_SIZE=2;class zt extends qt{constructor(r){super(r)}parseInformation(){if(this.getInformation().getSize()<zt.HEADER_SIZE+qt.GTIN_SIZE)throw new H;let r=new ge;this.encodeCompressedGtin(r,zt.HEADER_SIZE);let i=this.getGeneralDecoder().extractNumericValueFromBitArray(zt.HEADER_SIZE+qt.GTIN_SIZE,zt.LAST_DIGIT_SIZE);r.append("(393"),r.append(i),r.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(zt.HEADER_SIZE+qt.GTIN_SIZE+zt.LAST_DIGIT_SIZE,zt.FIRST_THREE_DIGITS_SIZE);s/100==0&&r.append("0"),s/10==0&&r.append("0"),r.append(s);let a=this.getGeneralDecoder().decodeGeneralPurposeField(zt.HEADER_SIZE+qt.GTIN_SIZE+zt.LAST_DIGIT_SIZE+zt.FIRST_THREE_DIGITS_SIZE,null);return r.append(a.getNewString()),r.toString()}}zt.HEADER_SIZE=8,zt.LAST_DIGIT_SIZE=2,zt.FIRST_THREE_DIGITS_SIZE=10;class Ge extends da{constructor(r,i,s){super(r),this.dateCode=s,this.firstAIdigits=i}parseInformation(){if(this.getInformation().getSize()!=Ge.HEADER_SIZE+Ge.GTIN_SIZE+Ge.WEIGHT_SIZE+Ge.DATE_SIZE)throw new H;let r=new ge;return this.encodeCompressedGtin(r,Ge.HEADER_SIZE),this.encodeCompressedWeight(r,Ge.HEADER_SIZE+Ge.GTIN_SIZE,Ge.WEIGHT_SIZE),this.encodeCompressedDate(r,Ge.HEADER_SIZE+Ge.GTIN_SIZE+Ge.WEIGHT_SIZE),r.toString()}encodeCompressedDate(r,i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(i,Ge.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 u=s;u/10==0&&r.append("0"),r.append(u),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}}Ge.HEADER_SIZE=8,Ge.WEIGHT_SIZE=20,Ge.DATE_SIZE=16;function Dd(y){try{if(y.get(1))return new Mi(y);if(!y.get(2))return new fa(y);switch(Pi.extractNumericValueFromBitArray(y,1,4)){case 4:return new vv(y);case 5:return new yv(y)}switch(Pi.extractNumericValueFromBitArray(y,1,5)){case 12:return new Yr(y);case 13:return new zt(y)}switch(Pi.extractNumericValueFromBitArray(y,1,7)){case 56:return new Ge(y,"310","11");case 57:return new Ge(y,"320","11");case 58:return new Ge(y,"310","13");case 59:return new Ge(y,"320","13");case 60:return new Ge(y,"310","15");case 61:return new Ge(y,"320","15");case 62:return new Ge(y,"310","17");case 63:return new Ge(y,"320","17")}}catch(r){throw console.log(r),new Hr("unknown decoder: "+y)}}class Rn{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 Rn?Rn.equalsOrNull(r.leftchar,i.leftchar)&&Rn.equalsOrNull(r.rightchar,i.rightchar)&&Rn.equalsOrNull(r.finderpattern,i.finderpattern):!1}static equalsOrNull(r,i){return r===null?i===null:Rn.equals(r,i)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Xu{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 Xu?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(u=>{a.getLeftChar().getValue()===u.getLeftChar().getValue()&&a.getRightChar().getValue()===u.getRightChar().getValue()&&a.getFinderPatter().getValue()===u.getFinderPatter().getValue()&&(s=!0)})}),s}}class Y extends Lt{constructor(r){super(...arguments),this.pairs=new Array(Y.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 Y.constructResult(this.decodeRow2pairs(r,i))}catch(a){this.verbose&&console.log(a)}return this.pairs.length=0,this.startFromEven=!0,Y.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 H){if(!this.pairs.length)throw new H;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 H}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 u of r)this.pairs.push(u.getPairs());if(this.pairs.push(a.getPairs()),!Y.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(u){this.verbose&&console.log(u)}}throw new H}static isValidSequence(r){for(let i of Y.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 u=this.rows[s];if(u.getRowNumber()>r){l=u.isEquivalent(this.pairs);break}a=u.isEquivalent(this.pairs),s++}l||a||Y.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new Xu(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(Rn.equals(a,l))break}}static isPartialRow(r,i){for(let s of i){let a=!0;for(let l of r){let u=!1;for(let d of s.getPairs())if(l.equals(d)){u=!0;break}if(!u){a=!1;break}}if(a)return!0}return!1}getRows(){return this.rows}static constructResult(r){let i=wv.buildBitArray(r),a=Dd(i).parseInformation(),l=r[0].getFinderPattern().getResultPoints(),u=r[r.length-1].getFinderPattern().getResultPoints(),d=[l[0],l[1],u[0],u[1]];return new Ke(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,u=!0,d=-1;do this.findNextPair(r,i,d),l=this.parseFoundFinderPattern(r,s,a),l==null?d=Y.getNextSecondBar(r,this.startEnd[0]):u=!1;while(u);let h=this.decodeDataCharacter(r,l,a,!0);if(!this.isEmptyPair(i)&&i[i.length-1].mustBeLast())throw new H;let p;try{p=this.decodeDataCharacter(r,l,a,!1)}catch(w){p=null,this.verbose&&console.log(w)}return new Rn(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(),u;s>=0?u=s:this.isEmptyPair(i)?u=0:u=i[i.length-1].getFinderPattern().getStartEnd()[1];let d=i.length%2!=0;this.startFromEven&&(d=!d);let h=!1;for(;u<l&&(h=!r.get(u),!!h);)u++;let p=0,w=u;for(let E=u;E<l;E++)if(r.get(E)!=h)a[p]++;else{if(p==3){if(d&&Y.reverseCounters(a),Y.isFinderPattern(a)){this.startEnd[0]=w,this.startEnd[1]=E;return}d&&Y.reverseCounters(a),w+=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 H}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,u;if(s){let p=this.startEnd[0]-1;for(;p>=0&&!r.get(p);)p--;p++,a=this.startEnd[0]-p,l=p,u=this.startEnd[1]}else l=this.startEnd[0],u=r.getNextUnset(this.startEnd[1]+1),a=u-this.startEnd[1];let d=this.getDecodeFinderCounters();P.arraycopy(d,0,d,1,d.length-1),d[0]=a;let h;try{h=this.parseFinderValue(d,Y.FINDER_PATTERNS)}catch{return null}return new ca(h,[l,u],l,u,i)}decodeDataCharacter(r,i,s,a){let l=this.getDataCharacterCounters();for(let Fe=0;Fe<l.length;Fe++)l[Fe]=0;if(a)Y.recordPatternInReverse(r,i.getStartEnd()[0],l);else{Y.recordPattern(r,i.getStartEnd()[1],l);for(let Fe=0,Ot=l.length-1;Fe<Ot;Fe++,Ot--){let cr=l[Fe];l[Fe]=l[Ot],l[Ot]=cr}}let u=17,d=Re.sum(new Int32Array(l))/u,h=(i.getStartEnd()[1]-i.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new H;let p=this.getOddCounts(),w=this.getEvenCounts(),E=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let Fe=0;Fe<l.length;Fe++){let Ot=1*l[Fe]/d,cr=Ot+.5;if(cr<1){if(Ot<.3)throw new H;cr=1}else if(cr>8){if(Ot>8.7)throw new H;cr=8}let Ui=Fe/2;Fe&1?(w[Ui]=cr,S[Ui]=Ot-cr):(p[Ui]=cr,E[Ui]=Ot-cr)}this.adjustOddEvenCounts(u);let b=4*i.getValue()+(s?0:2)+(a?0:1)-1,D=0,M=0;for(let Fe=p.length-1;Fe>=0;Fe--){if(Y.isNotA1left(i,s,a)){let Ot=Y.WEIGHTS[b][2*Fe];M+=p[Fe]*Ot}D+=p[Fe]}let L=0;for(let Fe=w.length-1;Fe>=0;Fe--)if(Y.isNotA1left(i,s,a)){let Ot=Y.WEIGHTS[b][2*Fe+1];L+=w[Fe]*Ot}let $=M+L;if(D&1||D>13||D<4)throw new H;let Q=(13-D)/2,q=Y.SYMBOL_WIDEST[Q],K=9-q,Ae=Gr.getRSSvalue(p,q,!0),me=Gr.getRSSvalue(w,K,!1),er=Y.EVEN_TOTAL_SUBSET[Q],Pr=Y.GSUM[Q],tr=Ae*er+me+Pr;return new Di(tr,$)}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 u=!1,d=!1;s>13?d=!0:s<4&&(u=!0);let h=i+s-r,p=(i&1)==1,w=(s&1)==0;if(h==1)if(p){if(w)throw new H;l=!0}else{if(!w)throw new H;d=!0}else if(h==-1)if(p){if(w)throw new H;a=!0}else{if(!w)throw new H;u=!0}else if(h==0){if(p){if(!w)throw new H;i<s?(a=!0,d=!0):(l=!0,u=!0)}else if(w)throw new H}else throw new H;if(a){if(l)throw new H;Y.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&Y.decrement(this.getOddCounts(),this.getOddRoundingErrors()),u){if(d)throw new H;Y.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&Y.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Y.SYMBOL_WIDEST=[7,5,4,3,1],Y.EVEN_TOTAL_SUBSET=[4,20,52,104,204],Y.GSUM=[0,348,1388,2948,3988],Y.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])],Y.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]],Y.FINDER_PAT_A=0,Y.FINDER_PAT_B=1,Y.FINDER_PAT_C=2,Y.FINDER_PAT_D=3,Y.FINDER_PAT_E=4,Y.FINDER_PAT_F=5,Y.FINDER_PATTERN_SEQUENCES=[[Y.FINDER_PAT_A,Y.FINDER_PAT_A],[Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B],[Y.FINDER_PAT_A,Y.FINDER_PAT_C,Y.FINDER_PAT_B,Y.FINDER_PAT_D],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_C],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_D,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_E,Y.FINDER_PAT_B,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_D],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_E],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F],[Y.FINDER_PAT_A,Y.FINDER_PAT_A,Y.FINDER_PAT_B,Y.FINDER_PAT_B,Y.FINDER_PAT_C,Y.FINDER_PAT_D,Y.FINDER_PAT_D,Y.FINDER_PAT_E,Y.FINDER_PAT_E,Y.FINDER_PAT_F,Y.FINDER_PAT_F]],Y.MAX_PAIRS=11;class Ev extends Di{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 nt extends Lt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(r,i,s){const a=this.decodePair(i,!1,r,s);nt.addOrTally(this.possibleLeftPairs,a),i.reverse();let l=this.decodePair(i,!0,r,s);nt.addOrTally(this.possibleRightPairs,l),i.reverse();for(let u of this.possibleLeftPairs)if(u.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&nt.checkChecksum(u,d))return nt.constructResult(u,d)}throw new H}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 ge;for(let p=13-a.length;p>0;p--)l.append("0");l.append(a);let u=0;for(let p=0;p<13;p++){let w=l.charAt(p).charCodeAt(0)-48;u+=p&1?w:3*w}u=10-u%10,u===10&&(u=0),l.append(u.toString());let d=r.getFinderPattern().getResultPoints(),h=i.getFinderPattern().getResultPoints();return new Ke(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),u=this.parseFoundFinderPattern(r,s,i,l),d=a==null?null:a.get(j.NEED_RESULT_POINT_CALLBACK);if(d!=null){let w=(l[0]+l[1])/2;i&&(w=r.getSize()-1-w),d.foundPossibleResultPoint(new ae(w,s))}let h=this.decodeDataCharacter(r,u,!0),p=this.decodeDataCharacter(r,u,!1);return new Ev(1597*h.getValue()+p.getValue(),h.getChecksumPortion()+4*p.getChecksumPortion(),u)}catch{return null}}decodeDataCharacter(r,i,s){let a=this.getDataCharacterCounters();for(let L=0;L<a.length;L++)a[L]=0;if(s)dt.recordPatternInReverse(r,i.getStartEnd()[0],a);else{dt.recordPattern(r,i.getStartEnd()[1]+1,a);for(let L=0,$=a.length-1;L<$;L++,$--){let Q=a[L];a[L]=a[$],a[$]=Q}}let l=s?16:15,u=Re.sum(new Int32Array(a))/l,d=this.getOddCounts(),h=this.getEvenCounts(),p=this.getOddRoundingErrors(),w=this.getEvenRoundingErrors();for(let L=0;L<a.length;L++){let $=a[L]/u,Q=Math.floor($+.5);Q<1?Q=1:Q>8&&(Q=8);let q=Math.floor(L/2);L&1?(h[q]=Q,w[q]=$-Q):(d[q]=Q,p[q]=$-Q)}this.adjustOddEvenCounts(s,l);let E=0,S=0;for(let L=d.length-1;L>=0;L--)S*=9,S+=d[L],E+=d[L];let b=0,D=0;for(let L=h.length-1;L>=0;L--)b*=9,b+=h[L],D+=h[L];let M=S+3*b;if(s){if(E&1||E>12||E<4)throw new H;let L=(12-E)/2,$=nt.OUTSIDE_ODD_WIDEST[L],Q=9-$,q=Gr.getRSSvalue(d,$,!1),K=Gr.getRSSvalue(h,Q,!0),Ae=nt.OUTSIDE_EVEN_TOTAL_SUBSET[L],me=nt.OUTSIDE_GSUM[L];return new Di(q*Ae+K+me,M)}else{if(D&1||D>10||D<4)throw new H;let L=(10-D)/2,$=nt.INSIDE_ODD_WIDEST[L],Q=9-$,q=Gr.getRSSvalue(d,$,!0),K=Gr.getRSSvalue(h,Q,!1),Ae=nt.INSIDE_ODD_TOTAL_SUBSET[L],me=nt.INSIDE_GSUM[L];return new Di(K*Ae+q+me,M)}}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,u=0;for(;u<a&&(l=!r.get(u),i!==l);)u++;let d=0,h=u;for(let p=u;p<a;p++)if(r.get(p)!==l)s[d]++;else{if(d===3){if(Lt.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 H}parseFoundFinderPattern(r,i,s,a){let l=r.get(a[0]),u=a[0]-1;for(;u>=0&&l!==r.get(u);)u--;u++;const d=a[0]-u,h=this.getDecodeFinderCounters(),p=new Int32Array(h.length);P.arraycopy(h,0,p,1,h.length-1),p[0]=d;const w=this.parseFinderValue(p,nt.FINDER_PATTERNS);let E=u,S=a[1];return s&&(E=r.getSize()-1-E,S=r.getSize()-1-S),new ca(w,[u,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,u=!1,d=!1,h=!1;r?(s>12?u=!0:s<4&&(l=!0),a>12?h=!0:a<4&&(d=!0)):(s>11?u=!0:s<5&&(l=!0),a>10?h=!0:a<4&&(d=!0));let p=s+a-i,w=(s&1)===(r?1:0),E=(a&1)===1;if(p===1)if(w){if(E)throw new H;u=!0}else{if(!E)throw new H;h=!0}else if(p===-1)if(w){if(E)throw new H;l=!0}else{if(!E)throw new H;d=!0}else if(p===0){if(w){if(!E)throw new H;s<a?(l=!0,h=!0):(u=!0,d=!0)}else if(E)throw new H}else throw new H;if(l){if(u)throw new H;Lt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(u&&Lt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new H;Lt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&Lt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}nt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],nt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],nt.OUTSIDE_GSUM=[0,161,961,2015,2715],nt.INSIDE_GSUM=[0,336,1036,1516],nt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],nt.INSIDE_ODD_WIDEST=[2,4,6,8],nt.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 ki extends dt{constructor(r,i){super(),this.readers=[],this.verbose=i===!0;const s=r?r.get(j.POSSIBLE_FORMATS):null,a=r&&r.get(j.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 zu(r)),s.includes(le.CODE_39)&&this.readers.push(new pt(a)),s.includes(le.CODE_128)&&this.readers.push(new J),s.includes(le.ITF)&&this.readers.push(new Be),s.includes(le.RSS_14)&&this.readers.push(new nt),s.includes(le.RSS_EXPANDED)&&this.readers.push(new Y(this.verbose))):(this.readers.push(new zu(r)),this.readers.push(new pt),this.readers.push(new zu(r)),this.readers.push(new J),this.readers.push(new Be),this.readers.push(new nt),this.readers.push(new Y(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 H}reset(){this.readers.forEach(r=>r.reset())}}class Cv extends yr{constructor(r=500,i){super(new ki(i),r,i)}}class Pe{constructor(r,i,s){this.ecCodewords=r,this.ecBlocks=[i],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class De{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,u){this.versionNumber=r,this.symbolSizeRows=i,this.symbolSizeColumns=s,this.dataRegionSizeRows=a,this.dataRegionSizeColumns=l,this.ecBlocks=u;let d=0;const h=u.getECCodewords(),p=u.getECBlocks();for(let w of p)d+=w.getCount()*(w.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 B;for(let s of Se.VERSIONS)if(s.symbolSizeRows===r&&s.symbolSizeColumns===i)return s;throw new B}toString(){return""+this.versionNumber}static buildVersions(){return[new Se(1,10,10,8,8,new Pe(5,new De(1,3))),new Se(2,12,12,10,10,new Pe(7,new De(1,5))),new Se(3,14,14,12,12,new Pe(10,new De(1,8))),new Se(4,16,16,14,14,new Pe(12,new De(1,12))),new Se(5,18,18,16,16,new Pe(14,new De(1,18))),new Se(6,20,20,18,18,new Pe(18,new De(1,22))),new Se(7,22,22,20,20,new Pe(20,new De(1,30))),new Se(8,24,24,22,22,new Pe(24,new De(1,36))),new Se(9,26,26,24,24,new Pe(28,new De(1,44))),new Se(10,32,32,14,14,new Pe(36,new De(1,62))),new Se(11,36,36,16,16,new Pe(42,new De(1,86))),new Se(12,40,40,18,18,new Pe(48,new De(1,114))),new Se(13,44,44,20,20,new Pe(56,new De(1,144))),new Se(14,48,48,22,22,new Pe(68,new De(1,174))),new Se(15,52,52,24,24,new Pe(42,new De(2,102))),new Se(16,64,64,14,14,new Pe(56,new De(2,140))),new Se(17,72,72,16,16,new Pe(36,new De(4,92))),new Se(18,80,80,18,18,new Pe(48,new De(4,114))),new Se(19,88,88,20,20,new Pe(56,new De(4,144))),new Se(20,96,96,22,22,new Pe(68,new De(4,174))),new Se(21,104,104,24,24,new Pe(56,new De(6,136))),new Se(22,120,120,18,18,new Pe(68,new De(6,175))),new Se(23,132,132,20,20,new Pe(62,new De(8,163))),new Se(24,144,144,22,22,new Pe(62,new De(8,156),new De(2,155))),new Se(25,8,18,6,16,new Pe(7,new De(1,5))),new Se(26,8,32,6,14,new Pe(11,new De(1,10))),new Se(27,12,26,10,24,new Pe(14,new De(1,16))),new Se(28,12,36,10,16,new Pe(18,new De(1,22))),new Se(29,16,36,14,16,new Pe(24,new De(1,32))),new Se(30,16,48,14,22,new Pe(28,new De(1,49)))]}}Se.VERSIONS=Se.buildVersions();class Yu{constructor(r){const i=r.getHeight();if(i<8||i>144||i&1)throw new B;this.version=Yu.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(),u=this.mappingBitMatrix.getWidth();let d=!1,h=!1,p=!1,w=!1;do if(s===l&&a===0&&!d)r[i++]=this.readCorner1(l,u)&255,s-=2,a+=2,d=!0;else if(s===l-2&&a===0&&u&3&&!h)r[i++]=this.readCorner2(l,u)&255,s-=2,a+=2,h=!0;else if(s===l+4&&a===2&&!(u&7)&&!p)r[i++]=this.readCorner3(l,u)&255,s-=2,a+=2,p=!0;else if(s===l-2&&a===0&&(u&7)===4&&!w)r[i++]=this.readCorner4(l,u)&255,s-=2,a+=2,w=!0;else{do s<l&&a>=0&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,u)&255),s-=2,a+=2;while(s>=0&&a<u);s+=1,a+=3;do s>=0&&a<u&&!this.readMappingMatrix.get(a,s)&&(r[i++]=this.readUtah(s,a,l,u)&255),s+=2,a-=2;while(s<l&&a>=0);s+=3,a+=1}while(s<l||a<u);if(i!==this.version.getTotalCodewords())throw new B;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 A("Dimension of bitMatrix must match the version size");const a=this.version.getDataRegionSizeRows(),l=this.version.getDataRegionSizeColumns(),u=i/a|0,d=s/l|0,h=u*a,p=d*l,w=new Te(p,h);for(let E=0;E<u;++E){const S=E*a;for(let b=0;b<d;++b){const D=b*l;for(let M=0;M<a;++M){const L=E*(a+2)+1+M,$=S+M;for(let Q=0;Q<l;++Q){const q=b*(l+2)+1+Q;if(r.get(q,L)){const K=D+Q;w.set(K,$)}}}}}return w}}class Ku{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 M of l)a+=M.getCount();const u=new Array(a);let d=0;for(let M of l)for(let L=0;L<M.getCount();L++){const $=M.getDataCodewords(),Q=s.getECCodewords()+$;u[d++]=new Ku($,new Uint8Array(Q))}const p=u[0].codewords.length-s.getECCodewords(),w=p-1;let E=0;for(let M=0;M<w;M++)for(let L=0;L<d;L++)u[L].codewords[M]=r[E++];const S=i.getVersionNumber()===24,b=S?8:d;for(let M=0;M<b;M++)u[M].codewords[p-1]=r[E++];const D=u[0].codewords.length;for(let M=p;M<D;M++)for(let L=0;L<d;L++){const $=S?(L+8)%d:L,Q=S&&$>7?M-1:M;u[$].codewords[Q]=r[E++]}if(E!==r.length)throw new A;return u}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Zu{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 A(""+r);let i=0,s=this.bitOffset,a=this.byteOffset;const l=this.bytes;if(s>0){const u=8-s,d=r<u?r:u,h=u-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 u=8-r,d=255>>u<<u;i=i<<r|(l[a]&d)>>u,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 bn{static decode(r){const i=new Zu(r),s=new ge,a=new ge,l=new Array;let u=xt.ASCII_ENCODE;do if(u===xt.ASCII_ENCODE)u=this.decodeAsciiSegment(i,s,a);else{switch(u){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 B}u=xt.ASCII_ENCODE}while(u!==xt.PAD_ENCODE&&i.available()>0);return a.length()>0&&s.append(a.toString()),new Ds(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 B;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 u=l-130;u<10&&i.append("0"),i.append(""+u)}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 B;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 u=r.readBits(8);if(u===254)return;this.parseTwoBytes(u,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 B;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 B}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 B}}}while(r.available()>0)}static decodeTextSegment(r,i){let s=!1,a=[],l=0;do{if(r.available()===8)return;const u=r.readBits(8);if(u===254)return;this.parseTwoBytes(u,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 B;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 B}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 B;break;default:throw new B}}}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 u=s[l];switch(u){case 0:i.append("\r");break;case 1:i.append("*");break;case 2:i.append(">");break;case 3:i.append(" ");break;default:if(u<14)i.append(String.fromCharCode(u+44));else if(u<40)i.append(String.fromCharCode(u+51));else throw new B;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 u;if(l===0?u=r.available()/8|0:l<250?u=l:u=250*(l-249)+this.unrandomize255State(r.readBits(8),a++),u<0)throw new B;const d=new Uint8Array(u);for(let h=0;h<u;h++){if(r.available()<8)throw new B;d[h]=this.unrandomize255State(r.readBits(8),a++)}s.push(d);try{i.append(ye.decode(d,se.ISO88591))}catch(h){throw new Hr("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}}bn.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"],bn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],bn.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"],bn.TEXT_SHIFT2_SET_CHARS=bn.C40_SHIFT2_SET_CHARS,bn.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 Av{constructor(){this.rsDecoder=new Ms(Oe.DATA_MATRIX_FIELD_256)}decode(r){const i=new Yu(r),s=i.getVersion(),a=i.readCodewords(),l=Ku.getDataBlocks(a,s);let u=0;for(let p of l)u+=p.getNumDataCodewords();const d=new Uint8Array(u),h=l.length;for(let p=0;p<h;p++){const w=l[p],E=w.getCodewords(),S=w.getNumDataCodewords();this.correctErrors(E,S);for(let b=0;b<S;b++)d[b*h+p]=E[b]}return bn.decode(d)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new O}for(let a=0;a<i;a++)r[a]=s[a]}}class lt{constructor(r){this.image=r,this.rectangleDetector=new an(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 H;i=this.shiftToModuleCenter(i);const s=i[0],a=i[1],l=i[2],u=i[3];let d=this.transitionsBetween(s,u)+1,h=this.transitionsBetween(l,u)+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=lt.sampleGrid(this.image,s,a,l,u,d,h);return new la(p,[s,a,l,u])}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],u=this.transitionsBetween(i,s),d=this.transitionsBetween(s,a),h=this.transitionsBetween(a,l),p=this.transitionsBetween(l,i),w=u,E=[l,i,s,a];return w>d&&(w=d,E[0]=i,E[1]=s,E[2]=a,E[3]=l),w>h&&(w=h,E[0]=s,E[1]=a,E[2]=l,E[3]=i),w>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],u=this.transitionsBetween(i,l),d=lt.shiftPoint(s,a,(u+1)*4),h=lt.shiftPoint(a,s,(u+1)*4),p=this.transitionsBetween(d,i),w=this.transitionsBetween(h,l);return p<w?(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],u=this.transitionsBetween(i,l),d=this.transitionsBetween(s,l),h=lt.shiftPoint(i,s,(d+1)*4),p=lt.shiftPoint(a,s,(u+1)*4);u=this.transitionsBetween(h,l),d=this.transitionsBetween(p,l);let w=new ae(l.getX()+(a.getX()-s.getX())/(u+1),l.getY()+(a.getY()-s.getY())/(u+1)),E=new ae(l.getX()+(i.getX()-s.getX())/(d+1),l.getY()+(i.getY()-s.getY())/(d+1));if(!this.isValid(w))return this.isValid(E)?E:null;if(!this.isValid(E))return w;let S=this.transitionsBetween(h,w)+this.transitionsBetween(p,w),b=this.transitionsBetween(h,E)+this.transitionsBetween(p,E);return S>b?w:E}shiftToModuleCenter(r){let i=r[0],s=r[1],a=r[2],l=r[3],u=this.transitionsBetween(i,l)+1,d=this.transitionsBetween(a,l)+1,h=lt.shiftPoint(i,s,d*4),p=lt.shiftPoint(a,s,u*4);u=this.transitionsBetween(h,l)+1,d=this.transitionsBetween(p,l)+1,(u&1)===1&&(u+=1),(d&1)===1&&(d+=1);let w=(i.getX()+s.getX()+a.getX()+l.getX())/4,E=(i.getY()+s.getY()+a.getY()+l.getY())/4;i=lt.moveAway(i,w,E),s=lt.moveAway(s,w,E),a=lt.moveAway(a,w,E),l=lt.moveAway(l,w,E);let S,b;return h=lt.shiftPoint(i,s,d*4),h=lt.shiftPoint(h,l,u*4),S=lt.shiftPoint(s,i,d*4),S=lt.shiftPoint(S,a,u*4),p=lt.shiftPoint(a,l,d*4),p=lt.shiftPoint(p,s,u*4),b=lt.shiftPoint(l,a,d*4),b=lt.shiftPoint(b,i,u*4),[h,S,p,b]}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,u,d){return Tn.getInstance().sampleGrid(r,u,d,.5,.5,u-.5,.5,u-.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()),u=Math.trunc(i.getY()),d=Math.abs(u-a)>Math.abs(l-s);if(d){let M=s;s=a,a=M,M=l,l=u,u=M}let h=Math.abs(l-s),p=Math.abs(u-a),w=-h/2,E=a<u?1:-1,S=s<l?1:-1,b=0,D=this.image.get(d?a:s,d?s:a);for(let M=s,L=a;M!==l;M+=S){let $=this.image.get(d?L:M,d?M:L);if($!==D&&(b++,D=$),w+=p,w>0){if(L===u)break;L+=E,w-=h}}return b}}class _n{constructor(){this.decoder=new Av}decode(r,i=null){let s,a;if(i!=null&&i.has(j.PURE_BARCODE)){const p=_n.extractPureBits(r.getBlackMatrix());s=this.decoder.decode(p),a=_n.NO_POINTS}else{const p=new lt(r.getBlackMatrix()).detect();s=this.decoder.decode(p.getBits()),a=p.getPoints()}const l=s.getRawBytes(),u=new Ke(s.getText(),l,8*l.length,a,le.DATA_MATRIX,P.currentTimeMillis()),d=s.getByteSegments();d!=null&&u.putMetadata(Ct.BYTE_SEGMENTS,d);const h=s.getECLevel();return h!=null&&u.putMetadata(Ct.ERROR_CORRECTION_LEVEL,h),u}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i==null||s==null)throw new H;const a=this.moduleSize(i,r);let l=i[1];const u=s[1];let d=i[0];const p=(s[0]-d+1)/a,w=(u-l+1)/a;if(p<=0||w<=0)throw new H;const E=a/2;l+=E,d+=E;const S=new Te(p,w);for(let b=0;b<w;b++){const D=l+b*a;for(let M=0;M<p;M++)r.get(d+M*a,D)&&S.set(M,b)}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 H;const u=a-r[0];if(u===0)throw new H;return u}}_n.NO_POINTS=[];class Sv extends yr{constructor(r=500){super(new _n,r)}}var Bi;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(Bi||(Bi={}));class je{constructor(r,i,s){this.value=r,this.stringValue=i,this.bits=s,je.FOR_BITS.set(s,this),je.FOR_VALUE.set(r,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(r){switch(r){case"L":return je.L;case"M":return je.M;case"Q":return je.Q;case"H":return je.H;default:throw new C(r+"not available")}}toString(){return this.stringValue}equals(r){if(!(r instanceof je))return!1;const i=r;return this.value===i.value}static forBits(r){if(r<0||r>=je.FOR_BITS.size)throw new A;return je.FOR_BITS.get(r)}}je.FOR_BITS=new Map,je.FOR_VALUE=new Map,je.L=new je(Bi.L,"L",1),je.M=new je(Bi.M,"M",0),je.Q=new je(Bi.Q,"Q",3),je.H=new je(Bi.H,"H",2);class Ft{constructor(r){this.errorCorrectionLevel=je.forBits(r>>3&3),this.dataMask=r&7}static numBitsDiffering(r,i){return _.bitCount(r^i)}static decodeFormatInformation(r,i){const s=Ft.doDecodeFormatInformation(r,i);return s!==null?s:Ft.doDecodeFormatInformation(r^Ft.FORMAT_INFO_MASK_QR,i^Ft.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(r,i){let s=Number.MAX_SAFE_INTEGER,a=0;for(const l of Ft.FORMAT_INFO_DECODE_LOOKUP){const u=l[0];if(u===r||u===i)return new Ft(l[1]);let d=Ft.numBitsDiffering(r,u);d<s&&(a=l[1],s=d),r!==i&&(d=Ft.numBitsDiffering(i,u),d<s&&(a=l[1],s=d))}return s<=3?new Ft(a):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(r){if(!(r instanceof Ft))return!1;const i=r;return this.errorCorrectionLevel===i.errorCorrectionLevel&&this.dataMask===i.dataMask}}Ft.FORMAT_INFO_MASK_QR=21522,Ft.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 F{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(),u=s[0].getECBlocks();for(const d of u)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 B;try{return this.getVersionForNumber((r-17)/4)}catch{throw new B}}static getVersionForNumber(r){if(r<1||r>40)throw new A;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 u=Ft.numBitsDiffering(r,l);u<i&&(s=a+7,i=u)}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 u=0;u<s;u++)a===0&&(u===0||u===s-1)||a===s-1&&u===0||i.setRegion(this.alignmentPatternCenters[u]-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 F(7,new R(1,19)),new F(10,new R(1,16)),new F(13,new R(1,13)),new F(17,new R(1,9))),new ue(2,Int32Array.from([6,18]),new F(10,new R(1,34)),new F(16,new R(1,28)),new F(22,new R(1,22)),new F(28,new R(1,16))),new ue(3,Int32Array.from([6,22]),new F(15,new R(1,55)),new F(26,new R(1,44)),new F(18,new R(2,17)),new F(22,new R(2,13))),new ue(4,Int32Array.from([6,26]),new F(20,new R(1,80)),new F(18,new R(2,32)),new F(26,new R(2,24)),new F(16,new R(4,9))),new ue(5,Int32Array.from([6,30]),new F(26,new R(1,108)),new F(24,new R(2,43)),new F(18,new R(2,15),new R(2,16)),new F(22,new R(2,11),new R(2,12))),new ue(6,Int32Array.from([6,34]),new F(18,new R(2,68)),new F(16,new R(4,27)),new F(24,new R(4,19)),new F(28,new R(4,15))),new ue(7,Int32Array.from([6,22,38]),new F(20,new R(2,78)),new F(18,new R(4,31)),new F(18,new R(2,14),new R(4,15)),new F(26,new R(4,13),new R(1,14))),new ue(8,Int32Array.from([6,24,42]),new F(24,new R(2,97)),new F(22,new R(2,38),new R(2,39)),new F(22,new R(4,18),new R(2,19)),new F(26,new R(4,14),new R(2,15))),new ue(9,Int32Array.from([6,26,46]),new F(30,new R(2,116)),new F(22,new R(3,36),new R(2,37)),new F(20,new R(4,16),new R(4,17)),new F(24,new R(4,12),new R(4,13))),new ue(10,Int32Array.from([6,28,50]),new F(18,new R(2,68),new R(2,69)),new F(26,new R(4,43),new R(1,44)),new F(24,new R(6,19),new R(2,20)),new F(28,new R(6,15),new R(2,16))),new ue(11,Int32Array.from([6,30,54]),new F(20,new R(4,81)),new F(30,new R(1,50),new R(4,51)),new F(28,new R(4,22),new R(4,23)),new F(24,new R(3,12),new R(8,13))),new ue(12,Int32Array.from([6,32,58]),new F(24,new R(2,92),new R(2,93)),new F(22,new R(6,36),new R(2,37)),new F(26,new R(4,20),new R(6,21)),new F(28,new R(7,14),new R(4,15))),new ue(13,Int32Array.from([6,34,62]),new F(26,new R(4,107)),new F(22,new R(8,37),new R(1,38)),new F(24,new R(8,20),new R(4,21)),new F(22,new R(12,11),new R(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new F(30,new R(3,115),new R(1,116)),new F(24,new R(4,40),new R(5,41)),new F(20,new R(11,16),new R(5,17)),new F(24,new R(11,12),new R(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new F(22,new R(5,87),new R(1,88)),new F(24,new R(5,41),new R(5,42)),new F(30,new R(5,24),new R(7,25)),new F(24,new R(11,12),new R(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new F(24,new R(5,98),new R(1,99)),new F(28,new R(7,45),new R(3,46)),new F(24,new R(15,19),new R(2,20)),new F(30,new R(3,15),new R(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new F(28,new R(1,107),new R(5,108)),new F(28,new R(10,46),new R(1,47)),new F(28,new R(1,22),new R(15,23)),new F(28,new R(2,14),new R(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new F(30,new R(5,120),new R(1,121)),new F(26,new R(9,43),new R(4,44)),new F(28,new R(17,22),new R(1,23)),new F(28,new R(2,14),new R(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new F(28,new R(3,113),new R(4,114)),new F(26,new R(3,44),new R(11,45)),new F(26,new R(17,21),new R(4,22)),new F(26,new R(9,13),new R(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new F(28,new R(3,107),new R(5,108)),new F(26,new R(3,41),new R(13,42)),new F(30,new R(15,24),new R(5,25)),new F(28,new R(15,15),new R(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new F(28,new R(4,116),new R(4,117)),new F(26,new R(17,42)),new F(28,new R(17,22),new R(6,23)),new F(30,new R(19,16),new R(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new F(28,new R(2,111),new R(7,112)),new F(28,new R(17,46)),new F(30,new R(7,24),new R(16,25)),new F(24,new R(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new F(30,new R(4,121),new R(5,122)),new F(28,new R(4,47),new R(14,48)),new F(30,new R(11,24),new R(14,25)),new F(30,new R(16,15),new R(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new F(30,new R(6,117),new R(4,118)),new F(28,new R(6,45),new R(14,46)),new F(30,new R(11,24),new R(16,25)),new F(30,new R(30,16),new R(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new F(26,new R(8,106),new R(4,107)),new F(28,new R(8,47),new R(13,48)),new F(30,new R(7,24),new R(22,25)),new F(30,new R(22,15),new R(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new F(28,new R(10,114),new R(2,115)),new F(28,new R(19,46),new R(4,47)),new F(28,new R(28,22),new R(6,23)),new F(30,new R(33,16),new R(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new F(30,new R(8,122),new R(4,123)),new F(28,new R(22,45),new R(3,46)),new F(30,new R(8,23),new R(26,24)),new F(30,new R(12,15),new R(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new F(30,new R(3,117),new R(10,118)),new F(28,new R(3,45),new R(23,46)),new F(30,new R(4,24),new R(31,25)),new F(30,new R(11,15),new R(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new F(30,new R(7,116),new R(7,117)),new F(28,new R(21,45),new R(7,46)),new F(30,new R(1,23),new R(37,24)),new F(30,new R(19,15),new R(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new F(30,new R(5,115),new R(10,116)),new F(28,new R(19,47),new R(10,48)),new F(30,new R(15,24),new R(25,25)),new F(30,new R(23,15),new R(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new F(30,new R(13,115),new R(3,116)),new F(28,new R(2,46),new R(29,47)),new F(30,new R(42,24),new R(1,25)),new F(30,new R(23,15),new R(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new F(30,new R(17,115)),new F(28,new R(10,46),new R(23,47)),new F(30,new R(10,24),new R(35,25)),new F(30,new R(19,15),new R(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new F(30,new R(17,115),new R(1,116)),new F(28,new R(14,46),new R(21,47)),new F(30,new R(29,24),new R(19,25)),new F(30,new R(11,15),new R(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new F(30,new R(13,115),new R(6,116)),new F(28,new R(14,46),new R(23,47)),new F(30,new R(44,24),new R(7,25)),new F(30,new R(59,16),new R(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new F(30,new R(12,121),new R(7,122)),new F(28,new R(12,47),new R(26,48)),new F(30,new R(39,24),new R(14,25)),new F(30,new R(22,15),new R(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new F(30,new R(6,121),new R(14,122)),new F(28,new R(6,47),new R(34,48)),new F(30,new R(46,24),new R(10,25)),new F(30,new R(2,15),new R(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new F(30,new R(17,122),new R(4,123)),new F(28,new R(29,46),new R(14,47)),new F(30,new R(49,24),new R(10,25)),new F(30,new R(24,15),new R(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new F(30,new R(4,122),new R(18,123)),new F(28,new R(13,46),new R(32,47)),new F(30,new R(48,24),new R(14,25)),new F(30,new R(42,15),new R(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new F(30,new R(20,117),new R(4,118)),new F(28,new R(40,47),new R(7,48)),new F(30,new R(43,24),new R(22,25)),new F(30,new R(10,15),new R(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new F(30,new R(19,118),new R(6,119)),new F(28,new R(18,47),new R(31,48)),new F(30,new R(34,24),new R(34,25)),new F(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 Cr{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)}}Cr.values=new Map([[At.DATA_MASK_000,new Cr(At.DATA_MASK_000,(y,r)=>(y+r&1)===0)],[At.DATA_MASK_001,new Cr(At.DATA_MASK_001,(y,r)=>(y&1)===0)],[At.DATA_MASK_010,new Cr(At.DATA_MASK_010,(y,r)=>r%3===0)],[At.DATA_MASK_011,new Cr(At.DATA_MASK_011,(y,r)=>(y+r)%3===0)],[At.DATA_MASK_100,new Cr(At.DATA_MASK_100,(y,r)=>(Math.floor(y/2)+Math.floor(r/3)&1)===0)],[At.DATA_MASK_101,new Cr(At.DATA_MASK_101,(y,r)=>y*r%6===0)],[At.DATA_MASK_110,new Cr(At.DATA_MASK_110,(y,r)=>y*r%6<3)],[At.DATA_MASK_111,new Cr(At.DATA_MASK_111,(y,r)=>(y+r+y*r%3&1)===0)]]);class Iv{constructor(r){const i=r.getHeight();if(i<21||(i&3)!==1)throw new B;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=Ft.decodeFormatInformation(r,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new B}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 u=5;u>=0;u--)for(let d=r-9;d>=a;d--)s=this.copyBit(d,u,s);let l=ue.decodeVersionInformation(s);if(l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;s=0;for(let u=5;u>=0;u--)for(let d=r-9;d>=a;d--)s=this.copyBit(u,d,s);if(l=ue.decodeVersionInformation(s),l!==null&&l.getDimensionForVersion()===r)return this.parsedVersion=l,l;throw new B}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=Cr.values.get(r.getDataMask()),a=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,a);const l=i.buildFunctionPattern();let u=!0;const d=new Uint8Array(i.getTotalCodewords());let h=0,p=0,w=0;for(let E=a-1;E>0;E-=2){E===6&&E--;for(let S=0;S<a;S++){const b=u?a-1-S:S;for(let D=0;D<2;D++)l.get(E-D,b)||(w++,p<<=1,this.bitMatrix.get(E-D,b)&&(p|=1),w===8&&(d[h++]=p,w=0,p=0))}u=!u}if(h!==i.getTotalCodewords())throw new B;return d}remask(){if(this.parsedFormatInfo===null)return;const r=Cr.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 Qu{constructor(r,i){this.numDataCodewords=r,this.codewords=i}static getDataBlocks(r,i,s){if(r.length!==i.getTotalCodewords())throw new A;const a=i.getECBlocksForLevel(s);let l=0;const u=a.getECBlocks();for(const D of u)l+=D.getCount();const d=new Array(l);let h=0;for(const D of u)for(let M=0;M<D.getCount();M++){const L=D.getDataCodewords(),$=a.getECCodewordsPerBlock()+L;d[h++]=new Qu(L,new Uint8Array($))}const p=d[0].codewords.length;let w=d.length-1;for(;w>=0&&d[w].codewords.length!==p;)w--;w++;const E=p-a.getECCodewordsPerBlock();let S=0;for(let D=0;D<E;D++)for(let M=0;M<h;M++)d[M].codewords[D]=r[S++];for(let D=w;D<h;D++)d[D].codewords[E]=r[S++];const b=d[0].codewords.length;for(let D=E;D<b;D++)for(let M=0;M<h;M++){const L=M<w?D:D+1;d[M].codewords[L]=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 ce{constructor(r,i,s,a){this.value=r,this.stringValue=i,this.characterCountBitsForVersions=s,this.bits=a,ce.FOR_BITS.set(a,this),ce.FOR_VALUE.set(r,this)}static forBits(r){const i=ce.FOR_BITS.get(r);if(i===void 0)throw new A;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 ce))return!1;const i=r;return this.value===i.value}toString(){return this.stringValue}}ce.FOR_BITS=new Map,ce.FOR_VALUE=new Map,ce.TERMINATOR=new ce(Ar.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ce.NUMERIC=new ce(Ar.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ce.ALPHANUMERIC=new ce(Ar.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ce.STRUCTURED_APPEND=new ce(Ar.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ce.BYTE=new ce(Ar.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ce.ECI=new ce(Ar.ECI,"ECI",Int32Array.from([0,0,0]),7),ce.KANJI=new ce(Ar.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ce.FNC1_FIRST_POSITION=new ce(Ar.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ce.FNC1_SECOND_POSITION=new ce(Ar.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ce.HANZI=new ce(Ar.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Ze{static decode(r,i,s,a){const l=new Zu(r);let u=new ge;const d=new Array;let h=-1,p=-1;try{let w=null,E=!1,S;do{if(l.available()<4)S=ce.TERMINATOR;else{const b=l.readBits(4);S=ce.forBits(b)}switch(S){case ce.TERMINATOR:break;case ce.FNC1_FIRST_POSITION:case ce.FNC1_SECOND_POSITION:E=!0;break;case ce.STRUCTURED_APPEND:if(l.available()<16)throw new B;h=l.readBits(8),p=l.readBits(8);break;case ce.ECI:const b=Ze.parseECIValue(l);if(w=V.getCharacterSetECIByValue(b),w===null)throw new B;break;case ce.HANZI:const D=l.readBits(4),M=l.readBits(S.getCharacterCountBits(i));D===Ze.GB2312_SUBSET&&Ze.decodeHanziSegment(l,u,M);break;default:const L=l.readBits(S.getCharacterCountBits(i));switch(S){case ce.NUMERIC:Ze.decodeNumericSegment(l,u,L);break;case ce.ALPHANUMERIC:Ze.decodeAlphanumericSegment(l,u,L,E);break;case ce.BYTE:Ze.decodeByteSegment(l,u,L,w,d,a);break;case ce.KANJI:Ze.decodeKanjiSegment(l,u,L);break;default:throw new B}break}}while(S!==ce.TERMINATOR)}catch{throw new B}return new Ds(r,u.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 B;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const u=r.readBits(13);let d=u/96<<8&4294967295|u%96;d<959?d+=41377:d+=42657,a[l]=d>>8&255,a[l+1]=d&255,l+=2,s--}try{i.append(ye.decode(a,se.GB2312))}catch(u){throw new B(u)}}static decodeKanjiSegment(r,i,s){if(s*13>r.available())throw new B;const a=new Uint8Array(2*s);let l=0;for(;s>0;){const u=r.readBits(13);let d=u/192<<8&4294967295|u%192;d<7936?d+=33088:d+=49472,a[l]=d>>8,a[l+1]=d,l+=2,s--}try{i.append(ye.decode(a,se.SHIFT_JIS))}catch(u){throw new B(u)}}static decodeByteSegment(r,i,s,a,l,u){if(8*s>r.available())throw new B;const d=new Uint8Array(s);for(let p=0;p<s;p++)d[p]=r.readBits(8);let h;a===null?h=se.guessEncoding(d,u):h=a.getName();try{i.append(ye.decode(d,h))}catch(p){throw new B(p)}l.push(d)}static toAlphaNumericChar(r){if(r>=Ze.ALPHANUMERIC_CHARS.length)throw new B;return Ze.ALPHANUMERIC_CHARS[r]}static decodeAlphanumericSegment(r,i,s,a){const l=i.length();for(;s>1;){if(r.available()<11)throw new B;const u=r.readBits(11);i.append(Ze.toAlphaNumericChar(Math.floor(u/45))),i.append(Ze.toAlphaNumericChar(u%45)),s-=2}if(s===1){if(r.available()<6)throw new B;i.append(Ze.toAlphaNumericChar(r.readBits(6)))}if(a)for(let u=l;u<i.length();u++)i.charAt(u)==="%"&&(u<i.length()-1&&i.charAt(u+1)==="%"?i.deleteCharAt(u+1):i.setCharAt(u,""))}static decodeNumericSegment(r,i,s){for(;s>=3;){if(r.available()<10)throw new B;const a=r.readBits(10);if(a>=1e3)throw new B;i.append(Ze.toAlphaNumericChar(Math.floor(a/100))),i.append(Ze.toAlphaNumericChar(Math.floor(a/10)%10)),i.append(Ze.toAlphaNumericChar(a%10)),s-=3}if(s===2){if(r.available()<7)throw new B;const a=r.readBits(7);if(a>=100)throw new B;i.append(Ze.toAlphaNumericChar(Math.floor(a/10))),i.append(Ze.toAlphaNumericChar(a%10))}else if(s===1){if(r.available()<4)throw new B;const a=r.readBits(4);if(a>=10)throw new B;i.append(Ze.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 B}}Ze.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ze.GB2312_SUBSET=1;class Pd{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 Tv{constructor(){this.rsDecoder=new Ms(Oe.QR_CODE_FIELD_256)}decodeBooleanArray(r,i){return this.decodeBitMatrix(Te.parseFromBooleanArray(r),i)}decodeBitMatrix(r,i){const s=new Iv(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 Pd(!0)),l}catch(l){throw a!==null?a:l}}decodeBitMatrixParser(r,i){const s=r.readVersion(),a=r.readFormatInformation().getErrorCorrectionLevel(),l=r.readCodewords(),u=Qu.getDataBlocks(l,s,a);let d=0;for(const w of u)d+=w.getNumDataCodewords();const h=new Uint8Array(d);let p=0;for(const w of u){const E=w.getCodewords(),S=w.getNumDataCodewords();this.correctErrors(E,S);for(let b=0;b<S;b++)h[p++]=E[b]}return Ze.decode(h,s,a,i)}correctErrors(r,i){const s=new Int32Array(r);try{this.rsDecoder.decode(s,r.length-i)}catch{throw new O}for(let a=0;a<i;a++)r[a]=s[a]}}class qu 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,u=(this.estimatedModuleSize+s)/2;return new qu(a,l,u)}}class ha{constructor(r,i,s,a,l,u,d){this.image=r,this.startX=i,this.startY=s,this.width=a,this.height=l,this.moduleSize=u,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,u=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));u[0]=0,u[1]=0,u[2]=0;let w=r;for(;w<a&&!d.get(w,p);)w++;let E=0;for(;w<a;){if(d.get(w,p))if(E===1)u[1]++;else if(E===2){if(this.foundPatternCross(u)){const S=this.handlePossibleCenter(u,p,w);if(S!==null)return S}u[0]=u[2],u[1]=1,u[2]=0,E=1}else u[++E]++;else E===1&&E++,u[E]++;w++}if(this.foundPatternCross(u)){const S=this.handlePossibleCenter(u,p,a);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new H}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,u=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<u&&l.get(i,h)&&d[1]<=s;)d[1]++,h++;if(h===u||d[1]>s)return NaN;for(;h<u&&!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)?ha.centerFromEnd(d,h):NaN}handlePossibleCenter(r,i,s){const a=r[0]+r[1]+r[2],l=ha.centerFromEnd(r,s),u=this.crossCheckVertical(i,l,2*r[1],a);if(!isNaN(u)){const d=(r[0]+r[1]+r[2])/3;for(const p of this.possibleCenters)if(p.aboutEquals(d,u,l))return p.combineEstimate(u,l,d);const h=new qu(l,u,d);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null}}class Ju 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,u=(this.count*this.getY()+r)/a,d=(this.count*this.estimatedModuleSize+s)/a;return new Ju(l,u,d,a)}}class Rv{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(j.TRY_HARDER)!==void 0,s=r!=null&&r.get(j.PURE_BARCODE)!==void 0,a=this.image,l=a.getHeight(),u=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 b=0;b<u;b++)if(a.get(b,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,b,s)===!0)if(d=2,this.hasSkipped===!0)h=this.haveMultiplyConfirmedCenters();else{const M=this.findRowSkip();M>p[2]&&(E+=M-p[2]-d,b=u-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,u,s)===!0&&(d=p[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}const w=this.selectBestPatterns();return ae.orderBestPatterns(w),new Rv(w)}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 u=r[l];if(u===0)return!1;i+=u}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 u=0;const d=this.image;for(;r>=u&&i>=u&&d.get(i-u,r-u);)l[2]++,u++;if(r<u||i<u)return!1;for(;r>=u&&i>=u&&!d.get(i-u,r-u)&&l[1]<=s;)l[1]++,u++;if(r<u||i<u||l[1]>s)return!1;for(;r>=u&&i>=u&&d.get(i-u,r-u)&&l[0]<=s;)l[0]++,u++;if(l[0]>s)return!1;const h=d.getHeight(),p=d.getWidth();for(u=1;r+u<h&&i+u<p&&d.get(i+u,r+u);)l[2]++,u++;if(r+u>=h||i+u>=p)return!1;for(;r+u<h&&i+u<p&&!d.get(i+u,r+u)&&l[3]<s;)l[3]++,u++;if(r+u>=h||i+u>=p||l[3]>=s)return!1;for(;r+u<h&&i+u<p&&d.get(i+u,r+u)&&l[4]<s;)l[4]++,u++;if(l[4]>=s)return!1;const w=l[0]+l[1]+l[2]+l[3]+l[4];return Math.abs(w-a)<2*a&&St.foundPatternCross(l)}crossCheckVertical(r,i,s,a){const l=this.image,u=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<u&&l.get(i,h);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!l.get(i,h)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&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,u=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<u&&l.get(h,i);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!l.get(h,i)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&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 u=St.centerFromEnd(r,s),d=this.crossCheckVertical(i,Math.floor(u),r[2],l);if(!isNaN(d)&&(u=this.crossCheckHorizontal(Math.floor(u),Math.floor(d),r[2],l),!isNaN(u)&&(!a||this.crossCheckDiagonal(Math.floor(d),Math.floor(u),r[2],l)))){const h=l/7;let p=!1;const w=this.possibleCenters;for(let E=0,S=w.length;E<S;E++){const b=w[E];if(b.aboutEquals(h,d,u)){w[E]=b.combineEstimate(d,u,h),p=!0;break}}if(!p){const E=new Ju(u,d,h);w.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 u of this.possibleCenters)u.getCount()>=St.CENTER_QUORUM&&(r++,i+=u.getEstimatedModuleSize());if(r<3)return!1;const a=i/s;let l=0;for(const u of this.possibleCenters)l+=Math.abs(u.getEstimatedModuleSize()-a);return l<=.05*i}selectBestPatterns(){const r=this.possibleCenters.length;if(r<3)throw new H;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 u=Math.sqrt(l/r-s*s);i.sort((h,p)=>{const w=Math.abs(p.getEstimatedModuleSize()-s),E=Math.abs(h.getEstimatedModuleSize()-s);return w<E?-1:w>E?1:0});const d=Math.max(.2*s,u);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,u)=>{if(u.getCount()===l.getCount()){const d=Math.abs(u.getEstimatedModuleSize()-s),h=Math.abs(l.getEstimatedModuleSize()-s);return d<h?1:d>h?-1:0}else return u.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 Bs{constructor(r){this.image=r}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(r){this.resultPointCallback=r==null?null:r.get(j.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 H("No pattern found in proccess finder.");const u=Bs.computeDimension(i,s,a,l),d=ue.getProvisionalVersionForDimension(u),h=d.getDimensionForVersion()-7;let p=null;if(d.getAlignmentPatternCenters().length>0){const b=s.getX()-i.getX()+a.getX(),D=s.getY()-i.getY()+a.getY(),M=1-3/h,L=Math.floor(i.getX()+M*(b-i.getX())),$=Math.floor(i.getY()+M*(D-i.getY()));for(let Q=4;Q<=16;Q<<=1)try{p=this.findAlignmentInRegion(l,L,$,Q);break}catch(q){if(!(q instanceof H))throw q}}const w=Bs.createTransform(i,s,a,p,u),E=Bs.sampleGrid(this.image,w,u);let S;return p===null?S=[a,i,s]:S=[a,i,s,p],new la(E,S)}static createTransform(r,i,s,a,l){const u=l-3.5;let d,h,p,w;return a!==null?(d=a.getX(),h=a.getY(),p=u-3,w=p):(d=i.getX()-r.getX()+s.getX(),h=i.getY()-r.getY()+s.getY(),p=u,w=u),Nr.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,p,w,3.5,u,r.getX(),r.getY(),i.getX(),i.getY(),d,h,s.getX(),s.getY())}static sampleGrid(r,i,s){return Tn.getInstance().sampleGridWithTransform(r,s,s,i)}static computeDimension(r,i,s,a){const l=Re.round(ae.distance(r,i)/a),u=Re.round(ae.distance(r,s)/a);let d=Math.floor((l+u)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new H("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),u=1,d=r-(s-r);d<0?(u=r/(r-d),d=0):d>=this.image.getWidth()&&(u=(this.image.getWidth()-1-r)/(d-r),d=this.image.getWidth()-1);let h=Math.floor(i-(a-i)*u);return u=1,h<0?(u=i/(i-h),h=0):h>=this.image.getHeight()&&(u=(this.image.getHeight()-1-i)/(h-i),h=this.image.getHeight()-1),d=Math.floor(r+(d-r)*u),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 b=r;r=i,i=b,b=s,s=a,a=b}const u=Math.abs(s-r),d=Math.abs(a-i);let h=-u/2;const p=r<s?1:-1,w=i<a?1:-1;let E=0;const S=s+p;for(let b=r,D=i;b!==S;b+=p){const M=l?D:b,L=l?b:D;if(E===1===this.image.get(M,L)){if(E===2)return Re.distance(b,D,r,i);E++}if(h+=d,h>0){if(D===a)break;D+=w,h-=u}}return E===2?Re.distance(s+p,a,r,i):NaN}findAlignmentInRegion(r,i,s,a){const l=Math.floor(a*r),u=Math.max(0,i-l),d=Math.min(this.image.getWidth()-1,i+l);if(d-u<r*3)throw new H("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 H("Alignment bottom exceeds estimated module size.");return new ha(this.image,u,h,d-u,p-h,r,this.resultPointCallback).find()}}class On{constructor(){this.decoder=new Tv}getDecoder(){return this.decoder}decode(r,i){let s,a;if(i!=null&&i.get(j.PURE_BARCODE)!==void 0){const h=On.extractPureBits(r.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,i),a=On.NO_POINTS}else{const h=new Bs(r.getBlackMatrix()).detect(i);s=this.decoder.decodeBitMatrix(h.getBits(),i),a=h.getPoints()}s.getOther()instanceof Pd&&s.getOther().applyMirroredCorrection(a);const l=new Ke(s.getText(),s.getRawBytes(),void 0,a,le.QR_CODE,void 0),u=s.getByteSegments();u!==null&&l.putMetadata(Ct.BYTE_SEGMENTS,u);const d=s.getECLevel();return d!==null&&l.putMetadata(Ct.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(l.putMetadata(Ct.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),l.putMetadata(Ct.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),l}reset(){}static extractPureBits(r){const i=r.getTopLeftOnBit(),s=r.getBottomRightOnBit();if(i===null||s===null)throw new H;const a=this.moduleSize(i,r);let l=i[1],u=s[1],d=i[0],h=s[0];if(d>=h||l>=u)throw new H;if(u-l!==h-d&&(h=d+(u-l),h>=r.getWidth()))throw new H;const p=Math.round((h-d+1)/a),w=Math.round((u-l+1)/a);if(p<=0||w<=0)throw new H;if(w!==p)throw new H;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 H;d-=S}const b=l+Math.floor((w-1)*a)-u;if(b>0){if(b>E)throw new H;l-=b}const D=new Te(p,w);for(let M=0;M<w;M++){const L=l+Math.floor(M*a);for(let $=0;$<p;$++)r.get(d+Math.floor($*a),L)&&D.set($,M)}return D}static moduleSize(r,i){const s=i.getHeight(),a=i.getWidth();let l=r[0],u=r[1],d=!0,h=0;for(;l<a&&u<s;){if(d!==i.get(l,u)){if(++h===5)break;d=!d}l++,u++}if(l===a||u===s)throw new H;return(l-r[0])/7}}On.NO_POINTS=new Array;class he{PDF417Common(){}static getBitCountSum(r){return Re.sum(r)}static toIntArray(r){if(r==null||!r.length)return he.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=T.binarySearch(he.SYMBOL_TABLE,r&262143);return i<0?-1:(he.CODEWORD_TABLE[i]-1)%he.NUMBER_OF_CODEWORDS}}he.NUMBER_OF_CODEWORDS=929,he.MAX_CODEWORDS_IN_BARCODE=he.NUMBER_OF_CODEWORDS-1,he.MIN_ROWS_IN_BARCODE=3,he.MAX_ROWS_IN_BARCODE=90,he.MODULES_IN_CODEWORD=17,he.MODULES_IN_STOP_PATTERN=18,he.BARS_IN_MODULE=8,he.EMPTY_INT_ARRAY=new Int32Array([]),he.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]),he.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 bv{constructor(r,i){this.bits=r,this.points=i}getBits(){return this.bits}getPoints(){return this.points}}class we{static detectMultiple(r,i,s){let a=r.getBlackMatrix(),l=we.detect(s,a);return l.length||(a=a.clone(),a.rotate180(),l=we.detect(s,a)),new bv(a,l)}static detect(r,i){const s=new Array;let a=0,l=0,u=!1;for(;a<i.getHeight();){const d=we.findVertices(i,a,l);if(d[0]==null&&d[3]==null){if(!u)break;u=!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+=we.ROW_STEP;continue}if(u=!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(),u=new Array(8);return we.copyToResult(u,we.findRowsWithPattern(r,a,l,i,s,we.START_PATTERN),we.INDEXES_START_PATTERN),u[4]!=null&&(s=Math.trunc(u[4].getX()),i=Math.trunc(u[4].getY())),we.copyToResult(u,we.findRowsWithPattern(r,a,l,i,s,we.STOP_PATTERN),we.INDEXES_STOP_PATTERN),u}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,u){const d=new Array(4);let h=!1;const p=new Int32Array(u.length);for(;a<i;a+=we.ROW_STEP){let E=we.findGuardPattern(r,l,a,s,!1,u,p);if(E!=null){for(;a>0;){const S=we.findGuardPattern(r,l,--a,s,!1,u,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 w=a+1;if(h){let E=0,S=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;w<i;w++){const b=we.findGuardPattern(r,S[0],w,s,!1,u,p);if(b!=null&&Math.abs(S[0]-b[0])<we.MAX_PATTERN_DRIFT&&Math.abs(S[1]-b[1])<we.MAX_PATTERN_DRIFT)S=b,E=0;else{if(E>we.SKIPPED_ROW_COUNT_MAX)break;E++}}w-=E+1,d[2]=new ae(S[0],w),d[3]=new ae(S[1],w)}return w-a<we.BARCODE_MIN_HEIGHT&&T.fill(d,null),d}static findGuardPattern(r,i,s,a,l,u,d){T.fillWithin(d,0,d.length,0);let h=i,p=0;for(;r.get(h,s)&&h>0&&p++<we.MAX_PIXEL_DRIFT;)h--;let w=h,E=0,S=u.length;for(let b=l;w<a;w++)if(r.get(w,s)!==b)d[E]++;else{if(E===S-1){if(we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE)return new Int32Array([h,w]);h+=d[0]+d[1],P.arraycopy(d,2,d,0,E-1),d[E-1]=0,d[E]=0,E--}else E++;d[E]=1,b=!b}return E===S-1&&we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE?new Int32Array([h,w-1]):null}static patternMatchVariance(r,i,s){let a=r.length,l=0,u=0;for(let p=0;p<a;p++)l+=r[p],u+=i[p];if(l<u)return 1/0;let d=l/u;s*=d;let h=0;for(let p=0;p<a;p++){let w=r[p],E=i[p]*d,S=w>E?w-E:E-w;if(S>s)return 1/0;h+=S}return h/l}}we.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),we.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),we.MAX_AVG_VARIANCE=.42,we.MAX_INDIVIDUAL_VARIANCE=.8,we.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),we.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),we.MAX_PIXEL_DRIFT=3,we.MAX_PATTERN_DRIFT=5,we.SKIPPED_ROW_COUNT_MAX=25,we.ROW_STEP=5,we.BARCODE_MIN_HEIGHT=10;class bt{constructor(r,i){if(i.length===0)throw new A;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),P.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 A("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 u=i;i=s,s=u}let a=new Int32Array(s.length),l=s.length-i.length;P.arraycopy(s,0,a,0,l);for(let u=l;u<s.length;u++)a[u]=this.field.add(i[u-l],s[u]);return new bt(this.field,a)}subtract(r){if(!this.field.equals(r.field))throw new A("ModulusPolys do not have same ModulusGF field");return r.isZero()?this:this.add(r.negative())}multiply(r){return r instanceof bt?this.multiplyOther(r):this.multiplyScalar(r)}multiplyOther(r){if(!this.field.equals(r.field))throw new A("ModulusPolys do not have same ModulusGF field");if(this.isZero()||r.isZero())return new bt(this.field,new Int32Array([0]));let i=this.coefficients,s=i.length,a=r.coefficients,l=a.length,u=new Int32Array(s+l-1);for(let d=0;d<s;d++){let h=i[d];for(let p=0;p<l;p++)u[d+p]=this.field.add(u[d+p],this.field.multiply(h,a[p]))}return new bt(this.field,u)}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 bt(this.field,i)}multiplyScalar(r){if(r===0)return new bt(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 bt(this.field,s)}multiplyByMonomial(r,i){if(r<0)throw new A;if(i===0)return new bt(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 bt(this.field,a)}toString(){let r=new ge;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 _v{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 A;return this.logTable[r]}inverse(r){if(r===0)throw new oa;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 ec extends _v{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 bt(this,new Int32Array([0])),this.one=new bt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(r,i){if(r<0)throw new A;if(i===0)return this.zero;let s=new Int32Array(r+1);return s[0]=i,new bt(this,s)}}ec.PDF417_GF=new ec(he.NUMBER_OF_CODEWORDS,3);class Md{constructor(){this.field=ec.PDF417_GF}decode(r,i,s){let a=new bt(this.field,r),l=new Int32Array(i),u=!1;for(let D=i;D>0;D--){let M=a.evaluateAt(this.field.exp(D));l[i-D]=M,M!==0&&(u=!0)}if(!u)return 0;let d=this.field.getOne();if(s!=null)for(const D of s){let M=this.field.exp(r.length-1-D),L=new bt(this.field,new Int32Array([this.field.subtract(0,M),1]));d=d.multiply(L)}let h=new bt(this.field,l),p=this.runEuclideanAlgorithm(this.field.buildMonomial(i,1),h,i),w=p[0],E=p[1],S=this.findErrorLocations(w),b=this.findErrorMagnitudes(E,w,S);for(let D=0;D<S.length;D++){let M=r.length-1-this.field.log(S[D]);if(M<0)throw O.getChecksumInstance();r[M]=this.field.subtract(r[M],b[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,u=this.field.getZero(),d=this.field.getOne();for(;l.getDegree()>=Math.round(s/2);){let S=a,b=u;if(a=l,u=d,a.isZero())throw O.getChecksumInstance();l=S;let D=this.field.getZero(),M=a.getCoefficient(a.getDegree()),L=this.field.inverse(M);for(;l.getDegree()>=a.getDegree()&&!l.isZero();){let $=l.getDegree()-a.getDegree(),Q=this.field.multiply(l.getCoefficient(l.getDegree()),L);D=D.add(this.field.buildMonomial($,Q)),l=l.subtract(a.multiplyByMonomial($,Q))}d=D.multiply(u).subtract(b).negative()}let h=d.getCoefficient(0);if(h===0)throw O.getChecksumInstance();let p=this.field.inverse(h),w=d.multiply(p),E=l.multiply(p);return[w,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 O.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 u=new bt(this.field,l),d=s.length,h=new Int32Array(d);for(let p=0;p<d;p++){let w=this.field.inverse(s[p]),E=this.field.subtract(0,r.evaluateAt(w)),S=this.field.inverse(u.evaluateAt(w));h[p]=this.field.multiply(E,S)}return h}}class ai{constructor(r,i,s,a,l){r instanceof ai?this.constructor_2(r):this.constructor_1(r,i,s,a,l)}constructor_1(r,i,s,a,l){const u=i==null||s==null,d=a==null||l==null;if(u&&d)throw new H;u?(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 ai(r.image,r.topLeft,r.bottomLeft,i.topRight,i.bottomRight)}addMissingRows(r,i,s){let a=this.topLeft,l=this.bottomLeft,u=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 w=new ae(h.getX(),p);s?a=w:u=w}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 w=new ae(h.getX(),p);s?l=w:d=w}return new ai(this.image,a,l,u,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 Ov{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 Ls{constructor(){this.buffer=""}static form(r,i){let s=-1;function a(u,d,h,p,w,E){if(u==="%%")return"%";if(i[++s]===void 0)return;u=p?parseInt(p.substr(1)):void 0;let S=w?parseInt(w.substr(1)):void 0,b;switch(E){case"s":b=i[s];break;case"c":b=i[s][0];break;case"f":b=parseFloat(i[s]).toFixed(u);break;case"p":b=parseFloat(i[s]).toPrecision(u);break;case"e":b=parseFloat(i[s]).toExponential(u);break;case"x":b=parseInt(i[s]).toString(S||16);break;case"d":b=parseFloat(parseInt(i[s],S||10).toPrecision(u)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(S);let D=parseInt(h),M=h&&h[0]+""=="0"?"0":" ";for(;b.length<D;)b=d!==void 0?b+M:M+b;return b}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return r.replace(l,a)}format(r,...i){this.buffer+=Ls.form(r,i)}toString(){return this.buffer}}class Fs{constructor(r){this.boundingBox=new ai(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<Fs.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 Ls;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()}}Fs.MAX_NEARBY_DISTANCE=5;class Us{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 he.toIntArray(i)}getConfidence(r){return this.values.get(r)}}class kd extends Fs{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(),u=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.imageRowToCodewordIndex(Math.trunc(l.getY())),h=-1,p=1,w=0;for(let E=u;E<d;E++){if(i[E]==null)continue;let S=i[E],b=S.getRowNumber()-h;if(b===0)w++;else if(b===1)p=Math.max(p,w),w=1,h=S.getRowNumber();else if(b<0||S.getRowNumber()>=r.getRowCount()||b>E)i[E]=null;else{let D;p>2?D=(p-2)*b:D=b;let M=D>=E;for(let L=1;L<=D&&!M;L++)M=i[E-L]!=null;M?i[E]=null:(h=S.getRowNumber(),w=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())),u=this.imageRowToCodewordIndex(Math.trunc(a.getY())),d=this.getCodewords(),h=-1;for(let p=l;p<u;p++){if(d[p]==null)continue;let w=d[p];w.setRowNumberAsRowIndicatorColumn();let E=w.getRowNumber()-h;E===0||(E===1?h=w.getRowNumber():w.getRowNumber()>=r.getRowCount()?d[p]=null:h=w.getRowNumber())}}getBarcodeMetadata(){let r=this.getCodewords(),i=new Us,s=new Us,a=new Us,l=new Us;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]<he.MIN_ROWS_IN_BARCODE||s.getValue()[0]+a.getValue()[0]>he.MAX_ROWS_IN_BARCODE)return null;let u=new Ov(i.getValue()[0],s.getValue()[0],a.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(r,u),u}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,u=a.getRowNumber();if(u>i.getRowCount()){r[s]=null;continue}switch(this._isLeft||(u+=2),u%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+`
|
|
68
|
+
`+super.toString()}}class js{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=he.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 u=this.barcodeColumnCount+1;u>0&&l<this.ADJUST_ROW_NUMBER_SKIP;u--){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(l=js.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 u=1;u<this.barcodeColumnCount+1&&l<this.ADJUST_ROW_NUMBER_SKIP;u++){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(l=js.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(),u=l;this.detectionResultColumns[r+1]!=null&&(u=this.detectionResultColumns[r+1].getCodewords());let d=new Array(14);d[2]=l[i],d[3]=u[i],i>0&&(d[0]=s[i-1],d[4]=l[i-1],d[5]=u[i-1]),i>1&&(d[8]=s[i-2],d[10]=l[i-2],d[11]=u[i-2]),i<s.length-1&&(d[1]=s[i+1],d[6]=l[i+1],d[7]=u[i+1]),i<s.length-2&&(d[9]=s[i+2],d[12]=l[i+2],d[13]=u[i+2]);for(let h of d)if(js.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 Ls;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 Ws{constructor(r,i,s,a){this.rowNumber=Ws.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!==Ws.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}}Ws.BARCODE_ROW_UNKNOWN=-1;class Jt{static initialize(){for(let r=0;r<he.SYMBOL_TABLE.length;r++){let i=he.SYMBOL_TABLE[r],s=i&1;for(let a=0;a<he.BARS_IN_MODULE;a++){let l=0;for(;(i&1)===s;)l+=1,i>>=1;s=i&1,Jt.RATIOS_TABLE[r]||(Jt.RATIOS_TABLE[r]=new Array(he.BARS_IN_MODULE)),Jt.RATIOS_TABLE[r][he.BARS_IN_MODULE-a-1]=Math.fround(l/he.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(r){let i=Jt.getDecodedCodewordValue(Jt.sampleBitCounts(r));return i!==-1?i:Jt.getClosestDecodedValue(r)}static sampleBitCounts(r){let i=Re.sum(r),s=new Int32Array(he.BARS_IN_MODULE),a=0,l=0;for(let u=0;u<he.MODULES_IN_CODEWORD;u++){let d=i/(2*he.MODULES_IN_CODEWORD)+u*i/he.MODULES_IN_CODEWORD;l+r[a]<=d&&(l+=r[a],a++),s[a]++}return s}static getDecodedCodewordValue(r){let i=Jt.getBitValue(r);return he.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(he.BARS_IN_MODULE);if(i>1)for(let u=0;u<s.length;u++)s[u]=Math.fround(r[u]/i);let a=aa.MAX_VALUE,l=-1;this.bSymbolTableReady||Jt.initialize();for(let u=0;u<Jt.RATIOS_TABLE.length;u++){let d=0,h=Jt.RATIOS_TABLE[u];for(let p=0;p<he.BARS_IN_MODULE;p++){let w=Math.fround(h[p]-s[p]);if(d+=Math.fround(w*w),d>=a)break}d<a&&(a=d,l=he.SYMBOL_TABLE[u])}return l}}Jt.bSymbolTableReady=!1,Jt.RATIOS_TABLE=new Array(he.SYMBOL_TABLE.length).map(y=>new Array(he.BARS_IN_MODULE));class Bd{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 Ld{static parseLong(r,i=void 0){return parseInt(r,i)}}class Fd extends x{}Fd.kind="NullPointerException";class Nv{writeBytes(r){this.writeBytesOffset(r,0,r.length)}writeBytesOffset(r,i,s){if(r==null)throw new Fd;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 Dv extends x{}class Pv extends Nv{constructor(r=32){if(super(),this.count=0,r<0)throw new A("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 Dv;s=_.MAX_VALUE}this.buf=T.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),P.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 T.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 ke;(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"})(ke||(ke={}));function Ud(){if(typeof window<"u")return window.BigInt||null;if(typeof dn<"u")return dn.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ga;function Nn(y){if(typeof ga>"u"&&(ga=Ud()),ga===null)throw new Error("BigInt is not supported!");return ga(y)}function Mv(){let y=[];y[0]=Nn(1);let r=Nn(900);y[1]=r;for(let i=2;i<16;i++)y[i]=y[i-1]*r;return y}class W{static decode(r,i){let s=new ge(""),a=V.ISO8859_1;s.enableDecoding(a);let l=1,u=r[l++],d=new Bd;for(;l<r[0];){switch(u){case W.TEXT_COMPACTION_MODE_LATCH:l=W.textCompaction(r,l,s);break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:l=W.byteCompaction(u,r,a,l,s);break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(r[l++]);break;case W.NUMERIC_COMPACTION_MODE_LATCH:l=W.numericCompaction(r,l,s);break;case W.ECI_CHARSET:V.getCharacterSetECIByValue(r[l++]);break;case W.ECI_GENERAL_PURPOSE:l+=2;break;case W.ECI_USER_DEFINED:l++;break;case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:l=W.decodeMacroBlock(r,l,d);break;case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:throw new B;default:l--,l=W.textCompaction(r,l,s);break}if(l<r.length)u=r[l++];else throw B.getFormatInstance()}if(s.length()===0)throw B.getFormatInstance();let h=new Ds(null,s.toString(),null,i);return h.setOther(d),h}static decodeMacroBlock(r,i,s){if(i+W.NUMBER_OF_SEQUENCE_CODEWORDS>r[0])throw B.getFormatInstance();let a=new Int32Array(W.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<W.NUMBER_OF_SEQUENCE_CODEWORDS;d++,i++)a[d]=r[i];s.setSegmentIndex(_.parseInt(W.decodeBase900toBase10(a,W.NUMBER_OF_SEQUENCE_CODEWORDS)));let l=new ge;i=W.textCompaction(r,i,l),s.setFileId(l.toString());let u=-1;for(r[i]===W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(u=i+1);i<r[0];)switch(r[i]){case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(i++,r[i]){case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new ge;i=W.textCompaction(r,i+1,d),s.setFileName(d.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let h=new ge;i=W.textCompaction(r,i+1,h),s.setSender(h.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let p=new ge;i=W.textCompaction(r,i+1,p),s.setAddressee(p.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let w=new ge;i=W.numericCompaction(r,i+1,w),s.setSegmentCount(_.parseInt(w.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new ge;i=W.numericCompaction(r,i+1,E),s.setTimestamp(Ld.parseLong(E.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new ge;i=W.numericCompaction(r,i+1,S),s.setChecksum(_.parseInt(S.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let b=new ge;i=W.numericCompaction(r,i+1,b),s.setFileSize(Ld.parseLong(b.toString()));break;default:throw B.getFormatInstance()}break;case W.MACRO_PDF417_TERMINATOR:i++,s.setLastSegment(!0);break;default:throw B.getFormatInstance()}if(u!==-1){let d=i-u;s.isLastSegment()&&d--,s.setOptionalData(T.copyOfRange(r,u,u+d))}return i}static textCompaction(r,i,s){let a=new Int32Array((r[0]-i)*2),l=new Int32Array((r[0]-i)*2),u=0,d=!1;for(;i<r[0]&&!d;){let h=r[i++];if(h<W.TEXT_COMPACTION_MODE_LATCH)a[u]=h/30,a[u+1]=h%30,u+=2;else switch(h){case W.TEXT_COMPACTION_MODE_LATCH:a[u++]=W.TEXT_COMPACTION_MODE_LATCH;break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:i--,d=!0;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a[u]=W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,h=r[i++],l[u]=h,u++;break}}return W.decodeTextCompaction(a,l,u,s),i}static decodeTextCompaction(r,i,s,a){let l=ke.ALPHA,u=ke.ALPHA,d=0;for(;d<s;){let h=r[d],p="";switch(l){case ke.ALPHA:if(h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case W.LL:l=ke.LOWER;break;case W.ML:l=ke.MIXED;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.LOWER:if(h<26)p=String.fromCharCode(97+h);else switch(h){case 26:p=" ";break;case W.AS:u=l,l=ke.ALPHA_SHIFT;break;case W.ML:l=ke.MIXED;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.MIXED:if(h<W.PL)p=W.MIXED_CHARS[h];else switch(h){case W.PL:l=ke.PUNCT;break;case 26:p=" ";break;case W.LL:l=ke.LOWER;break;case W.AL:l=ke.ALPHA;break;case W.PS:u=l,l=ke.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.PUNCT:if(h<W.PAL)p=W.PUNCT_CHARS[h];else switch(h){case W.PAL:l=ke.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.ALPHA_SHIFT:if(l=u,h<26)p=String.fromCharCode(65+h);else switch(h){case 26:p=" ";break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break;case ke.PUNCT_SHIFT:if(l=u,h<W.PAL)p=W.PUNCT_CHARS[h];else switch(h){case W.PAL:l=ke.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(i[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=ke.ALPHA;break}break}p!==""&&a.append(p),d++}}static byteCompaction(r,i,s,a,l){let u=new Pv,d=0,h=0,p=!1;switch(r){case W.BYTE_COMPACTION_MODE_LATCH:let w=new Int32Array(6),E=i[a++];for(;a<i[0]&&!p;)switch(w[d++]=E,h=900*h+E,E=i[a++],E){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:a--,p=!0;break;default:if(d%5===0&&d>0){for(let S=0;S<6;++S)u.write(Number(Nn(h)>>Nn(8*(5-S))));h=0,d=0}break}a===i[0]&&E<W.TEXT_COMPACTION_MODE_LATCH&&(w[d++]=E);for(let S=0;S<d;S++)u.write(w[S]);break;case W.BYTE_COMPACTION_MODE_LATCH_6:for(;a<i[0]&&!p;){let S=i[a++];if(S<W.TEXT_COMPACTION_MODE_LATCH)d++,h=900*h+S;else switch(S){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:a--,p=!0;break}if(d%5===0&&d>0){for(let b=0;b<6;++b)u.write(Number(Nn(h)>>Nn(8*(5-b))));h=0,d=0}}break}return l.append(ye.decode(u.toByteArray(),s)),a}static numericCompaction(r,i,s){let a=0,l=!1,u=new Int32Array(W.MAX_NUMERIC_CODEWORDS);for(;i<r[0]&&!l;){let d=r[i++];if(i===r[0]&&(l=!0),d<W.TEXT_COMPACTION_MODE_LATCH)u[a]=d,a++;else switch(d){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:i--,l=!0;break}(a%W.MAX_NUMERIC_CODEWORDS===0||d===W.NUMERIC_COMPACTION_MODE_LATCH||l)&&a>0&&(s.append(W.decodeBase900toBase10(u,a)),a=0)}return i}static decodeBase900toBase10(r,i){let s=Nn(0);for(let l=0;l<i;l++)s+=W.EXP900[i-l-1]*Nn(r[l]);let a=s.toString();if(a.charAt(0)!=="1")throw new B;return a.substring(1)}}W.TEXT_COMPACTION_MODE_LATCH=900,W.BYTE_COMPACTION_MODE_LATCH=901,W.NUMERIC_COMPACTION_MODE_LATCH=902,W.BYTE_COMPACTION_MODE_LATCH_6=924,W.ECI_USER_DEFINED=925,W.ECI_GENERAL_PURPOSE=926,W.ECI_CHARSET=927,W.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,W.MACRO_PDF417_TERMINATOR=922,W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,W.MAX_NUMERIC_CODEWORDS=15,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,W.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,W.PL=25,W.LL=27,W.AS=27,W.ML=28,W.AL=28,W.PS=29,W.PAL=29,W.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
69
|
+
-.$/"|*()?{}'`,W.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",W.EXP900=Ud()?Mv():[],W.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ve{constructor(){}static decode(r,i,s,a,l,u,d){let h=new ai(r,i,s,a,l),p=null,w=null,E;for(let D=!0;;D=!1){if(i!=null&&(p=ve.getRowIndicatorColumn(r,h,i,!0,u,d)),a!=null&&(w=ve.getRowIndicatorColumn(r,h,a,!1,u,d)),E=ve.merge(p,w),E==null)throw H.getNotFoundInstance();let M=E.getBoundingBox();if(D&&M!=null&&(M.getMinY()<h.getMinY()||M.getMaxY()>h.getMaxY()))h=M;else break}E.setBoundingBox(h);let S=E.getBarcodeColumnCount()+1;E.setDetectionResultColumn(0,p),E.setDetectionResultColumn(S,w);let b=p!=null;for(let D=1;D<=S;D++){let M=b?D:S-D;if(E.getDetectionResultColumn(M)!==void 0)continue;let L;M===0||M===S?L=new kd(h,M===0):L=new Fs(h),E.setDetectionResultColumn(M,L);let $=-1,Q=$;for(let q=h.getMinY();q<=h.getMaxY();q++){if($=ve.getStartColumn(E,M,q,b),$<0||$>h.getMaxX()){if(Q===-1)continue;$=Q}let K=ve.detectCodeword(r,h.getMinX(),h.getMaxX(),b,$,q,u,d);K!=null&&(L.setCodeword(q,K),Q=$,u=Math.min(u,K.getWidth()),d=Math.max(d,K.getWidth()))}}return ve.createDecoderResult(E)}static merge(r,i){if(r==null&&i==null)return null;let s=ve.getBarcodeMetadata(r,i);if(s==null)return null;let a=ai.merge(ve.adjustBoundingBox(r),ve.adjustBoundingBox(i));return new js(s,a)}static adjustBoundingBox(r){if(r==null)return null;let i=r.getRowHeights();if(i==null)return null;let s=ve.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 u=0;for(let d=i.length-1;d>=0&&(u+=s-i[d],!(i[d]>0));d--);for(let d=l.length-1;u>0&&l[d]==null;d--)u--;return r.getBoundingBox().addMissingRows(a,u,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,u){let d=new kd(i,a);for(let h=0;h<2;h++){let p=h===0?1:-1,w=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=ve.detectCodeword(r,0,r.getWidth(),a,w,E,l,u);S!=null&&(d.setCodeword(E,S),a?w=S.getStartX():w=S.getEndX())}}return d}static adjustCodewordCount(r,i){let s=i[0][1],a=s.getValue(),l=r.getBarcodeColumnCount()*r.getBarcodeRowCount()-ve.getNumberOfECCodeWords(r.getBarcodeECLevel());if(a.length===0){if(l<1||l>he.MAX_CODEWORDS_IN_BARCODE)throw H.getNotFoundInstance();s.setValue(l)}else a[0]!==l&&s.setValue(l)}static createDecoderResult(r){let i=ve.createBarcodeMatrix(r);ve.adjustCodewordCount(r,i);let s=new Array,a=new Int32Array(r.getBarcodeRowCount()*r.getBarcodeColumnCount()),l=[],u=new Array;for(let h=0;h<r.getBarcodeRowCount();h++)for(let p=0;p<r.getBarcodeColumnCount();p++){let w=i[h][p+1].getValue(),E=h*r.getBarcodeColumnCount()+p;w.length===0?s.push(E):w.length===1?a[E]=w[0]:(u.push(E),l.push(w))}let d=new Array(l.length);for(let h=0;h<d.length;h++)d[h]=l[h];return ve.createDecoderResultFromAmbiguousValues(r.getBarcodeECLevel(),a,he.toIntArray(s),he.toIntArray(u),d)}static createDecoderResultFromAmbiguousValues(r,i,s,a,l){let u=new Int32Array(a.length),d=100;for(;d-- >0;){for(let h=0;h<u.length;h++)i[a[h]]=l[h][u[h]];try{return ve.decodeCodewords(i,r,s)}catch(h){if(!(h instanceof O))throw h}if(u.length===0)throw O.getChecksumInstance();for(let h=0;h<u.length;h++)if(u[h]<l[h].length-1){u[h]++;break}else if(u[h]=0,h===u.length-1)throw O.getChecksumInstance()}throw O.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 Us;let s=0;for(let a of r.getDetectionResultColumns()){if(a!=null){for(let l of a.getCodewords())if(l!=null){let u=l.getRowNumber();if(u>=0){if(u>=i.length)continue;i[u][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,u=null;if(ve.isValidBarcodeColumn(r,i-l)&&(u=r.getDetectionResultColumn(i-l).getCodeword(s)),u!=null)return a?u.getEndX():u.getStartX();if(u=r.getDetectionResultColumn(i).getCodewordNearby(s),u!=null)return a?u.getStartX():u.getEndX();if(ve.isValidBarcodeColumn(r,i-l)&&(u=r.getDetectionResultColumn(i-l).getCodewordNearby(s)),u!=null)return a?u.getEndX():u.getStartX();let d=0;for(;ve.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,u,d,h){l=ve.adjustCodewordStartColumn(r,i,s,a,l,u);let p=ve.getModuleBitCount(r,i,s,a,l,u);if(p==null)return null;let w,E=Re.sum(p);if(a)w=l+E;else{for(let D=0;D<p.length/2;D++){let M=p[D];p[D]=p[p.length-1-D],p[p.length-1-D]=M}w=l,l=w-E}if(!ve.checkCodewordSkew(E,d,h))return null;let S=Jt.getDecodedValue(p),b=he.getCodeword(S);return b===-1?null:new Ws(l,w,ve.getCodewordBucketNumber(S),b)}static getModuleBitCount(r,i,s,a,l,u){let d=l,h=new Int32Array(8),p=0,w=a?1:-1,E=a;for(;(a?d<s:d>=i)&&p<h.length;)r.get(d,u)===E?(h[p]++,d+=w):(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,u){let d=l,h=a?-1:1;for(let p=0;p<2;p++){for(;(a?d>=i:d<s)&&a===r.get(d,u);){if(Math.abs(l-d)>ve.CODEWORD_SKEW_SIZE)return l;d+=h}h=-h,a=!a}return d}static checkCodewordSkew(r,i,s){return i-ve.CODEWORD_SKEW_SIZE<=r&&r<=s+ve.CODEWORD_SKEW_SIZE}static decodeCodewords(r,i,s){if(r.length===0)throw B.getFormatInstance();let a=1<<i+1,l=ve.correctErrors(r,s,a);ve.verifyCodewordCount(r,a);let u=W.decode(r,""+i);return u.setErrorsCorrected(l),u.setErasures(s.length),u}static correctErrors(r,i,s){if(i!=null&&i.length>s/2+ve.MAX_ERRORS||s<0||s>ve.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return ve.errorCorrection.decode(r,s,i)}static verifyCodewordCount(r,i){if(r.length<4)throw B.getFormatInstance();let s=r[0];if(s>r.length)throw B.getFormatInstance();if(s===0)if(i<r.length)r[0]=r.length-i;else throw B.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 ve.getCodewordBucketNumber(ve.getBitCountForCodeword(r))}static getCodewordBucketNumber_Int32Array(r){return(r[0]-r[2]+r[4]-r[6]+9)%9}static toString(r){let i=new Ls;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()}}ve.CODEWORD_SKEW_SIZE=2,ve.MAX_ERRORS=3,ve.MAX_EC_CODEWORDS=512,ve.errorCorrection=new Md;class _t{decode(r,i=null){let s=_t.decode(r,i,!1);if(s==null||s.length===0||s[0]==null)throw H.getNotFoundInstance();return s[0]}decodeMultiple(r,i=null){try{return _t.decode(r,i,!0)}catch(s){throw s instanceof B||s instanceof O?H.getNotFoundInstance():s}}static decode(r,i,s){const a=new Array,l=we.detectMultiple(r,i,s);for(const u of l.getPoints()){const d=ve.decode(l.getBits(),u[4],u[5],u[6],u[7],_t.getMinCodewordWidth(u),_t.getMaxCodewordWidth(u)),h=new Ke(d.getText(),d.getRawBytes(),void 0,u,le.PDF_417);h.putMetadata(Ct.ERROR_CORRECTION_LEVEL,d.getECLevel());const p=d.getOther();p!=null&&h.putMetadata(Ct.PDF417_EXTRA_METADATA,p),a.push(h)}return a.map(u=>u)}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?_.MAX_VALUE:Math.trunc(Math.abs(r.getX()-i.getX()))}static getMaxCodewordWidth(r){return Math.floor(Math.max(Math.max(_t.getMaxWidth(r[0],r[4]),_t.getMaxWidth(r[6],r[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.max(_t.getMaxWidth(r[1],r[5]),_t.getMaxWidth(r[7],r[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(r){return Math.floor(Math.min(Math.min(_t.getMinWidth(r[0],r[4]),_t.getMinWidth(r[6],r[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.min(_t.getMinWidth(r[1],r[5]),_t.getMinWidth(r[7],r[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}reset(){}}class pa extends x{}pa.kind="ReaderException";class jd{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(j.TRY_HARDER)===!0,s=o(r)?null:r.get(j.POSSIBLE_FORMATS),a=new Array;if(!o(s)){const l=s.some(u=>u===le.UPC_A||u===le.UPC_E||u===le.EAN_13||u===le.EAN_8||u===le.CODABAR||u===le.CODE_39||u===le.CODE_93||u===le.CODE_128||u===le.ITF||u===le.RSS_14||u===le.RSS_EXPANDED);l&&!i&&a.push(new ki(r,this.verbose)),s.includes(le.QR_CODE)&&a.push(new On),s.includes(le.DATA_MATRIX)&&a.push(new _n),s.includes(le.AZTEC)&&a.push(new ua),s.includes(le.PDF_417)&&a.push(new _t),l&&i&&a.push(new ki(r,this.verbose))}a.length===0&&(i||a.push(new ki(r,this.verbose)),a.push(new On),a.push(new _n),a.push(new ua),a.push(new _t),i&&a.push(new ki(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 pa("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 pa)continue}throw new H("No MultiFormat Readers were able to detect the code.")}}class kv extends yr{constructor(r=null,i=500){const s=new jd;s.setHints(r),super(s,i)}decodeBitmap(r){return this.reader.decodeWithState(r)}}class Bv extends yr{constructor(r=500){super(new _t,r)}}class Lv extends yr{constructor(r=500){super(new On,r)}}var tc;(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"})(tc||(tc={}));var mt=tc;class rc{constructor(r){this.field=r,this.cachedGenerators=[],this.cachedGenerators.push(new Zt(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 u=s.multiply(new Zt(a,Int32Array.from([1,a.exp(l-1+a.getGeneratorBase())])));i.push(u),s=u}}return i[r]}encode(r,i){if(i===0)throw new A("No error correction bytes");const s=r.length-i;if(s<=0)throw new A("No data bytes provided");const a=this.buildGenerator(i),l=new Int32Array(s);P.arraycopy(r,0,l,0,s);let u=new Zt(this.field,l);u=u.multiplyByMonomial(i,1);const h=u.divide(a)[1].getCoefficients(),p=i-h.length;for(let w=0;w<p;w++)r[s+w]=0;P.arraycopy(h,0,r,s+p,h.length)}}class it{constructor(){}static applyMaskPenaltyRule1(r){return it.applyMaskPenaltyRule1Internal(r,!0)+it.applyMaskPenaltyRule1Internal(r,!1)}static applyMaskPenaltyRule2(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let u=0;u<l-1;u++){const d=s[u];for(let h=0;h<a-1;h++){const p=d[h];p===d[h+1]&&p===s[u+1][h]&&p===s[u+1][h+1]&&i++}}return it.N2*i}static applyMaskPenaltyRule3(r){let i=0;const s=r.getArray(),a=r.getWidth(),l=r.getHeight();for(let u=0;u<l;u++)for(let d=0;d<a;d++){const h=s[u];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&&(it.isWhiteHorizontal(h,d-4,d)||it.isWhiteHorizontal(h,d+7,d+11))&&i++,u+6<l&&s[u][d]===1&&s[u+1][d]===0&&s[u+2][d]===1&&s[u+3][d]===1&&s[u+4][d]===1&&s[u+5][d]===0&&s[u+6][d]===1&&(it.isWhiteVertical(s,d,u-4,u)||it.isWhiteVertical(s,d,u+7,u+11))&&i++}return i*it.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 w=0;w<a;w++)p[w]===1&&i++}const u=r.getHeight()*r.getWidth();return Math.floor(Math.abs(i*2-u)*10/u)*it.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 A("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(),u=r.getArray();for(let d=0;d<a;d++){let h=0,p=-1;for(let w=0;w<l;w++){const E=i?u[d][w]:u[w][d];E===p?h++:(h>=5&&(s+=it.N1+(h-5)),h=1,p=E)}h>=5&&(s+=it.N1+(h-5))}return s}}it.N1=3,it.N2=3,it.N3=40,it.N4=10;class xa{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)T.fill(i,r)}equals(r){if(!(r instanceof xa))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],u=i.bytes[s];for(let d=0,h=this.width;d<h;++d)if(l[d]!==u[d])return!1}return!0}toString(){const r=new ge;for(let i=0,s=this.height;i<s;++i){const a=this.bytes[i];for(let l=0,u=this.width;l<u;++l)switch(a[l]){case 0:r.append(" 0");break;case 1:r.append(" 1");break;default:r.append(" ");break}r.append(`
|
|
70
70
|
`)}return r.toString()}}class li{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 ge;return r.append(`<<
|
|
71
71
|
`),r.append(" mode: "),r.append(this.mode?this.mode.toString():"null"),r.append(`
|
|
72
72
|
ecLevel: `),r.append(this.ecLevel?this.ecLevel.toString():"null"),r.append(`
|
|
@@ -76,10 +76,10 @@ Error generating stack: `+f.message+`
|
|
|
76
76
|
`),r.append(this.matrix.toString())):r.append(`
|
|
77
77
|
matrix: null
|
|
78
78
|
`),r.append(`>>
|
|
79
|
-
`),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<li.NUM_MASK_PATTERNS}}li.NUM_MASK_PATTERNS=8;class Le extends x{}Le.kind="WriterException";class fe{constructor(){}static clearMatrix(r){r.clear(255)}static buildMatrix(r,i,s,a,l){fe.clearMatrix(l),fe.embedBasicPatterns(s,l),fe.embedTypeInfo(i,a,l),fe.maybeEmbedVersionInfo(s,l),fe.embedDataBits(r,a,l)}static embedBasicPatterns(r,i){fe.embedPositionDetectionPatternsAndSeparators(i),fe.embedDarkDotAtLeftBottomCorner(i),fe.maybeEmbedPositionAdjustmentPatterns(r,i),fe.embedTimingPatterns(i)}static embedTypeInfo(r,i,s){const a=new U;fe.makeTypeInfoBits(r,i,a);for(let l=0,u=a.getSize();l<u;++l){const d=a.get(a.getSize()-1-l),h=fe.TYPE_INFO_COORDINATES[l],p=h[0],w=h[1];if(s.setBoolean(p,w,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 U;fe.makeVersionInfoBits(r,s);let a=6*3-1;for(let l=0;l<6;++l)for(let u=0;u<3;++u){const d=s.get(a);a--,i.setBoolean(l,i.getHeight()-11+u,d),i.setBoolean(i.getHeight()-11+u,l,d)}}static embedDataBits(r,i,s){let a=0,l=-1,u=s.getWidth()-1,d=s.getHeight()-1;for(;u>0;){for(u===6&&(u-=1);d>=0&&d<s.getHeight();){for(let h=0;h<2;++h){const p=u-h;if(!fe.isEmpty(s.get(p,d)))continue;let w;a<r.getSize()?(w=r.get(a),++a):w=!1,i!==255&&it.getDataMaskBit(i,p,d)&&(w=!w),s.setBoolean(p,d,w)}d+=l}l=-l,d+=l,u-=2}if(a!==r.getSize())throw new Le("Not all bits consumed: "+a+"/"+r.getSize())}static findMSBSet(r){return 32-_.numberOfLeadingZeros(r)}static calculateBCHCode(r,i){if(i===0)throw new A("0 polynomial");const s=fe.findMSBSet(i);for(r<<=s-1;fe.findMSBSet(r)>=s;)r^=i<<fe.findMSBSet(r)-s;return r}static makeTypeInfoBits(r,i,s){if(!li.isValidMaskPattern(i))throw new Le("Invalid mask pattern");const a=r.getBits()<<3|i;s.appendBits(a,5);const l=fe.calculateBCHCode(a,fe.TYPE_INFO_POLY);s.appendBits(l,10);const u=new U;if(u.appendBits(fe.TYPE_INFO_MASK_PATTERN,15),s.xor(u),s.getSize()!==15)throw new Le("should not happen but we got: "+s.getSize())}static makeVersionInfoBits(r,i){i.appendBits(r.getVersionNumber(),6);const s=fe.calculateBCHCode(r.getVersionNumber(),fe.VERSION_INFO_POLY);if(i.appendBits(s,12),i.getSize()!==18)throw new Le("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;fe.isEmpty(r.get(i,6))&&r.setNumber(i,6,s),fe.isEmpty(r.get(6,i))&&r.setNumber(6,i,s)}}static embedDarkDotAtLeftBottomCorner(r){if(r.get(8,r.getHeight()-8)===0)throw new Le;r.setNumber(8,r.getHeight()-8,1)}static embedHorizontalSeparationPattern(r,i,s){for(let a=0;a<8;++a){if(!fe.isEmpty(s.get(r+a,i)))throw new Le;s.setNumber(r+a,i,0)}}static embedVerticalSeparationPattern(r,i,s){for(let a=0;a<7;++a){if(!fe.isEmpty(s.get(r,i+a)))throw new Le;s.setNumber(r,i+a,0)}}static embedPositionAdjustmentPattern(r,i,s){for(let a=0;a<5;++a){const l=fe.POSITION_ADJUSTMENT_PATTERN[a];for(let u=0;u<5;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPattern(r,i,s){for(let a=0;a<7;++a){const l=fe.POSITION_DETECTION_PATTERN[a];for(let u=0;u<7;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPatternsAndSeparators(r){const i=fe.POSITION_DETECTION_PATTERN[0].length;fe.embedPositionDetectionPattern(0,0,r),fe.embedPositionDetectionPattern(r.getWidth()-i,0,r),fe.embedPositionDetectionPattern(0,r.getWidth()-i,r);const s=8;fe.embedHorizontalSeparationPattern(0,s-1,r),fe.embedHorizontalSeparationPattern(r.getWidth()-s,s-1,r),fe.embedHorizontalSeparationPattern(0,r.getWidth()-s,r);const a=7;fe.embedVerticalSeparationPattern(a,0,r),fe.embedVerticalSeparationPattern(r.getHeight()-a-1,0,r),fe.embedVerticalSeparationPattern(a,r.getHeight()-a,r)}static maybeEmbedPositionAdjustmentPatterns(r,i){if(r.getVersionNumber()<2)return;const s=r.getVersionNumber()-1,a=fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let l=0,u=a.length;l!==u;l++){const d=a[l];if(d>=0)for(let h=0;h!==u;h++){const p=a[h];p>=0&&fe.isEmpty(i.get(p,d))&&fe.embedPositionAdjustmentPattern(p-2,d-2,i)}}}}fe.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])]),fe.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])]),fe.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])]),fe.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])]),fe.VERSION_INFO_POLY=7973,fe.TYPE_INFO_POLY=1335,fe.TYPE_INFO_MASK_PATTERN=21522;class Fv{constructor(r,i){this.dataBytes=r,this.errorCorrectionBytes=i}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class $e{constructor(){}static calculateMaskPenalty(r){return it.applyMaskPenaltyRule1(r)+it.applyMaskPenaltyRule2(r)+it.applyMaskPenaltyRule3(r)+it.applyMaskPenaltyRule4(r)}static encode(r,i,s=null){let a=$e.DEFAULT_BYTE_MODE_ENCODING;const l=s!==null&&s.get(mt.CHARACTER_SET)!==void 0;l&&(a=s.get(mt.CHARACTER_SET).toString());const u=this.chooseMode(r,a),d=new U;if(u===ce.BYTE&&(l||$e.DEFAULT_BYTE_MODE_ENCODING!==a)){const q=V.getCharacterSetECIByName(a);q!==void 0&&this.appendECI(q,d)}this.appendModeInfo(u,d);const h=new U;this.appendBytes(r,u,h,a);let p;if(s!==null&&s.get(mt.QR_VERSION)!==void 0){const q=Number.parseInt(s.get(mt.QR_VERSION).toString(),10);p=ue.getVersionForNumber(q);const K=this.calculateBitsNeeded(u,d,h,p);if(!this.willFit(K,p,i))throw new Le("Data too big for requested version")}else p=this.recommendVersion(i,u,d,h);const w=new U;w.appendBitArray(d);const E=u===ce.BYTE?h.getSizeInBytes():r.length;this.appendLengthInfo(E,p,u,w),w.appendBitArray(h);const S=p.getECBlocksForLevel(i),b=p.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(b,w);const D=this.interleaveWithECBytes(w,p.getTotalCodewords(),b,S.getNumBlocks()),P=new li;P.setECLevel(i),P.setMode(u),P.setVersion(p);const L=p.getDimensionForVersion(),$=new xa(L,L),Q=this.chooseMaskPattern(D,i,p,$);return P.setMaskPattern(Q),fe.buildMatrix(D,i,p,Q,$),P.setMatrix($),P}static recommendVersion(r,i,s,a){const l=this.calculateBitsNeeded(i,s,a,ue.getVersionForNumber(1)),u=this.chooseVersion(l,r),d=this.calculateBitsNeeded(i,s,a,u);return this.chooseVersion(d,r)}static calculateBitsNeeded(r,i,s,a){return i.getSize()+r.getCharacterCountBits(a)+s.getSize()}static getAlphanumericCode(r){return r<$e.ALPHANUMERIC_TABLE.length?$e.ALPHANUMERIC_TABLE[r]:-1}static chooseMode(r,i=null){if(V.SJIS.getName()===i&&this.isOnlyDoubleByteKanji(r))return ce.KANJI;let s=!1,a=!1;for(let l=0,u=r.length;l<u;++l){const d=r.charAt(l);if($e.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)a=!0;else return ce.BYTE}return a?ce.ALPHANUMERIC:s?ce.NUMERIC:ce.BYTE}static isOnlyDoubleByteKanji(r){let i;try{i=ye.encode(r,V.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,u=-1;for(let d=0;d<li.NUM_MASK_PATTERNS;d++){fe.buildMatrix(r,i,s,d,a);let h=this.calculateMaskPenalty(a);h<l&&(l=h,u=d)}return u}static chooseVersion(r,i){for(let s=1;s<=40;s++){const a=ue.getVersionForNumber(s);if($e.willFit(r,a,i))return a}throw new Le("Data too big")}static willFit(r,i,s){const a=i.getTotalCodewords(),u=i.getECBlocksForLevel(s).getTotalECCodewords(),d=a-u,h=(r+7)/8;return d>=h}static terminateBits(r,i){const s=r*8;if(i.getSize()>s)throw new Le("data bits cannot fit in the QR Code"+i.getSize()+" > "+s);for(let u=0;u<4&&i.getSize()<s;++u)i.appendBit(!1);const a=i.getSize()&7;if(a>0)for(let u=a;u<8;u++)i.appendBit(!1);const l=r-i.getSizeInBytes();for(let u=0;u<l;++u)i.appendBits(u&1?17:236,8);if(i.getSize()!==s)throw new Le("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(r,i,s,a,l,u){if(a>=s)throw new Le("Block ID too large");const d=r%s,h=s-d,p=Math.floor(r/s),w=p+1,E=Math.floor(i/s),S=E+1,b=p-E,D=w-S;if(b!==D)throw new Le("EC bytes mismatch");if(s!==h+d)throw new Le("RS blocks mismatch");if(r!==(E+b)*h+(S+D)*d)throw new Le("Total bytes mismatch");a<h?(l[0]=E,u[0]=b):(l[0]=S,u[0]=D)}static interleaveWithECBytes(r,i,s,a){if(r.getSizeInBytes()!==s)throw new Le("Number of bits and data bytes does not match");let l=0,u=0,d=0;const h=new Array;for(let w=0;w<a;++w){const E=new Int32Array(1),S=new Int32Array(1);$e.getNumDataBytesAndNumECBytesForBlockID(i,s,a,w,E,S);const b=E[0],D=new Uint8Array(b);r.toBytes(8*l,D,0,b);const P=$e.generateECBytes(D,S[0]);h.push(new Fv(D,P)),u=Math.max(u,b),d=Math.max(d,P.length),l+=E[0]}if(s!==l)throw new Le("Data bytes does not match offset");const p=new U;for(let w=0;w<u;++w)for(const E of h){const S=E.getDataBytes();w<S.length&&p.appendBits(S[w],8)}for(let w=0;w<d;++w)for(const E of h){const S=E.getErrorCorrectionBytes();w<S.length&&p.appendBits(S[w],8)}if(i!==p.getSizeInBytes())throw new Le("Interleaving error: "+i+" and "+p.getSizeInBytes()+" differ.");return p}static generateECBytes(r,i){const s=r.length,a=new Int32Array(s+i);for(let u=0;u<s;u++)a[u]=r[u]&255;new tc(Oe.QR_CODE_FIELD_256).encode(a,i);const l=new Uint8Array(i);for(let u=0;u<i;u++)l[u]=a[s+u];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 Le(r+" is bigger than "+((1<<l)-1));a.appendBits(r,l)}static appendBytes(r,i,s,a){switch(i){case ce.NUMERIC:$e.appendNumericBytes(r,s);break;case ce.ALPHANUMERIC:$e.appendAlphanumericBytes(r,s);break;case ce.BYTE:$e.append8BitBytes(r,s,a);break;case ce.KANJI:$e.appendKanjiBytes(r,s);break;default:throw new Le("Invalid mode: "+i)}}static getDigit(r){return r.charCodeAt(0)-48}static isDigit(r){const i=$e.getDigit(r);return i>=0&&i<=9}static appendNumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=$e.getDigit(r.charAt(a));if(a+2<s){const u=$e.getDigit(r.charAt(a+1)),d=$e.getDigit(r.charAt(a+2));i.appendBits(l*100+u*10+d,10),a+=3}else if(a+1<s){const u=$e.getDigit(r.charAt(a+1));i.appendBits(l*10+u,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=$e.getAlphanumericCode(r.charCodeAt(a));if(l===-1)throw new Le;if(a+1<s){const u=$e.getAlphanumericCode(r.charCodeAt(a+1));if(u===-1)throw new Le;i.appendBits(l*45+u,11),a+=2}else i.appendBits(l,6),a++}}static append8BitBytes(r,i,s){let a;try{a=ye.encode(r,s)}catch(l){throw new Le(l)}for(let l=0,u=a.length;l!==u;l++){const d=a[l];i.appendBits(d,8)}}static appendKanjiBytes(r,i){let s;try{s=ye.encode(r,V.SJIS)}catch(l){throw new Le(l)}const a=s.length;for(let l=0;l<a;l+=2){const u=s[l]&255,d=s[l+1]&255,h=u<<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 Le("Invalid byte sequence");const w=(p>>8)*192+(p&255);i.appendBits(w,13)}}static appendECI(r,i){i.appendBits(ce.ECI.getBits(),4),i.appendBits(r.getValue(),8)}}$e.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]),$e.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ui{write(r,i,s,a=null){if(r.length===0)throw new A("Found empty contents");if(i<0||s<0)throw new A("Requested dimensions are too small: "+i+"x"+s);let l=je.L,u=ui.QUIET_ZONE_SIZE;a!==null&&(a.get(mt.ERROR_CORRECTION)!==void 0&&(l=je.fromString(a.get(mt.ERROR_CORRECTION).toString())),a.get(mt.MARGIN)!==void 0&&(u=Number.parseInt(a.get(mt.MARGIN).toString(),10)));const d=$e.encode(r,l,a);return this.renderResult(d,i,s,u)}writeToDom(r,i,s,a,l=null){typeof r=="string"&&(r=document.querySelector(r));const u=this.write(i,s,a,l);r&&r.appendChild(u)}renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),P=this.createSVGElement(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)if(l.get(Q,L)===1){const K=this.createSvgRectElement(q,$,S,S);P.appendChild(K)}return P}createSVGElement(r,i){const s=document.createElementNS(ui.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(ui.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}}ui.QUIET_ZONE_SIZE=4,ui.SVG_NS="http://www.w3.org/2000/svg";class Li{encode(r,i,s,a,l){if(r.length===0)throw new A("Found empty contents");if(i!==le.QR_CODE)throw new A("Can only encode QR_CODE, but got "+i);if(s<0||a<0)throw new A(`Requested dimensions are too small: ${s}x${a}`);let u=je.L,d=Li.QUIET_ZONE_SIZE;l!==null&&(l.get(mt.ERROR_CORRECTION)!==void 0&&(u=je.fromString(l.get(mt.ERROR_CORRECTION).toString())),l.get(mt.MARGIN)!==void 0&&(d=Number.parseInt(l.get(mt.MARGIN).toString(),10)));const h=$e.encode(r,u,l);return Li.renderResult(h,s,a,d)}static renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),P=new Te(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)l.get(Q,L)===1&&P.setRegion(q,$,S,S);return P}}Li.QUIET_ZONE_SIZE=4;class Uv{encode(r,i,s,a,l){let u;switch(i){case le.QR_CODE:u=new Li;break;default:throw new A("No encoder available for format "+i)}return u.encode(r,i,s,a,l)}}class Kr extends te{constructor(r,i,s,a,l,u,d,h){if(super(u,d),this.yuvData=r,this.dataWidth=i,this.dataHeight=s,this.left=a,this.top=l,a+u>i||l+d>s)throw new A("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(u,d)}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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 u=0;u<i;u++){const d=u*r;M.arraycopy(this.yuvData,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new Kr(this.yuvData,this.dataWidth,this.dataHeight,this.left+r,this.top+i,s,a,!1)}renderThumbnail(){const r=this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR,i=this.getHeight()/Kr.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(r*i),a=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let u=0;u<i;u++){const d=u*r;for(let h=0;h<r;h++){const p=a[l+h*Kr.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|p*65793}l+=this.dataWidth*Kr.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Kr.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 u=l+r/2;for(let d=l,h=l+r-1;d<u;d++,h--){const p=s[d];s[d]=s[h],s[h]=p}}}invert(){return new de(this)}}Kr.THUMBNAIL_SCALE_FACTOR=2;class rc extends te{constructor(r,i,s,a,l,u,d){if(super(i,s),this.dataWidth=a,this.dataHeight=l,this.left=u,this.top=d,r.BYTES_PER_ELEMENT===4){const h=i*s,p=new Uint8ClampedArray(h);for(let w=0;w<h;w++){const E=r[w],S=E>>16&255,b=E>>7&510,D=E&255;p[w]=(S+b+D)/4&255}this.luminances=p}else this.luminances=r;if(a===void 0&&(this.dataWidth=i),l===void 0&&(this.dataHeight=s),u===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+i>this.dataWidth||this.top+s>this.dataHeight)throw new A("Crop rectangle does not fit within image data.")}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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 u=0;u<i;u++){const d=u*r;M.arraycopy(this.luminances,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new rc(this.luminances,s,a,this.dataWidth,this.dataHeight,this.left+r,this.top+i)}invert(){return new de(this)}}class Wd extends V{static forName(r){return this.getCharacterSetECIByName(r)}}class nc{}nc.ISO_8859_1=V.ISO8859_1;class $d{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 Vd{static singletonList(r){return[r]}static min(r,i){return r.sort(i)[0]}}class jv{constructor(r){this.previous=r}getPrevious(){return this.previous}}class Fi extends jv{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 Fi(this,r,i)}addBinaryShift(r,i){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Fi(this,r,i)}toString(){let r=this.value&(1<<this.bitCount)-1;return r|=1<<this.bitCount,"<"+_.toBinaryString(r|1<<this.bitCount).substring(1)+">"}}class ic extends Fi{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 ic(this,r,i)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Wv(y,r,i){return new ic(y,r,i)}function $s(y,r,i){return new Fi(y,r,i)}const $v=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Dn=0,ma=1,Sr=2,zd=3,Zr=4,Vv=new Fi(null,0,0),sc=[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 zv(y){for(let r of y)T.fill(r,-1);return y[Dn][Zr]=0,y[ma][Zr]=0,y[ma][Dn]=28,y[zd][Zr]=0,y[Sr][Zr]=0,y[Sr][Dn]=15,y}const Hd=zv(T.createInt32Array(6,6));class Qr{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 u=sc[this.mode][r];a=$s(a,u&65535,u>>16),s+=u>>16}let l=r===Sr?4:5;return a=$s(a,i,l),new Qr(a,r,0,s+l)}shiftAndAppend(r,i){let s=this.token,a=this.mode===Sr?4:5;return s=$s(s,Hd[this.mode][r],a),s=$s(s,i,5),new Qr(s,this.mode,0,this.bitCount+a+5)}addBinaryShiftChar(r){let i=this.token,s=this.mode,a=this.bitCount;if(this.mode===Zr||this.mode===Sr){let d=sc[s][Dn];i=$s(i,d&65535,d>>16),a+=d>>16,s=Dn}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,u=new Qr(i,s,this.binaryShiftByteCount+1,a+l);return u.binaryShiftByteCount===2078&&(u=u.endBinaryShift(r+1)),u}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let i=this.token;return i=Wv(i,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Qr(i,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let i=this.bitCount+(sc[this.mode][r.mode]>>16);return this.binaryShiftByteCount<r.binaryShiftByteCount?i+=Qr.calculateBinaryShiftCost(r)-Qr.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 U;for(const a of i)a.appendTo(s,r);return s}toString(){return se.format("%s bits=%d bytes=%d",$v[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Qr.INITIAL_STATE=new Qr(Vv,Dn,0,0);function Hv(y){const r=se.getCharCode(" "),i=se.getCharCode("."),s=se.getCharCode(",");y[Dn][r]=1;const a=se.getCharCode("Z"),l=se.getCharCode("A");for(let S=l;S<=a;S++)y[Dn][S]=S-l+2;y[ma][r]=1;const u=se.getCharCode("z"),d=se.getCharCode("a");for(let S=d;S<=u;S++)y[ma][S]=S-d+2;y[Sr][r]=1;const h=se.getCharCode("9"),p=se.getCharCode("0");for(let S=p;S<=h;S++)y[Sr][S]=S-p+2;y[Sr][s]=12,y[Sr][i]=13;const w=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
80
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<w.length;S++)y[zd][se.getCharCode(w[S])]=S;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<E.length;S++)se.getCharCode(E[S])>0&&(y[Zr][se.getCharCode(E[S])]=S);return y}const
|
|
81
|
-
`);let s=Vd.singletonList(Qr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let u,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case se.getCharCode("\r"):u=d===i?2:0;break;case se.getCharCode("."):u=d===r?3:0;break;case se.getCharCode(","):u=d===r?4:0;break;case se.getCharCode(":"):u=d===r?5:0;break;default:u=0}u>0?(s=Vs.updateStateListForPair(s,l,u),l++):s=this.updateStateListForChar(s,l)}return Vd.min(s,(l,u)=>l.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Vs.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=oc[r.getMode()][a]>0,u=null;for(let d=0;d<=Zr;d++){let h=oc[d][a];if(h>0){if(u==null&&(u=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=u.latchAndAppend(d,h);s.push(p)}if(!l&&Hd[r.getMode()][d]>=0){const p=u.shiftAndAppend(d,h);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||oc[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(Zr,s)),r.getMode()!==Zr&&a.push(l.shiftAndAppend(Zr,s)),s===3||s===4){let u=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(u)}if(r.getBinaryShiftByteCount()>0){let u=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(u)}}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(u=>u!==l))}a&&i.push(s)}return i}}class be{constructor(){}static encodeBytes(r){return be.encode(r,be.DEFAULT_EC_PERCENT,be.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Vs(r).encode(),l=_.truncDivision(a.getSize()*i,100)+11,u=a.getSize()+l,d,h,p,w,E;if(s!==be.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?be.MAX_NB_BITS_COMPACT:be.MAX_NB_BITS))throw new A(se.format("Illegal value %s for layers",s));p=be.totalBitsInLayer(h,d),w=be.WORD_SIZE[h];let K=p-p%w;if(E=be.stuffBits(a,w),E.getSize()+l>K)throw new A("Data to large for user specified layer");if(d&&E.getSize()>w*64)throw new A("Data to large for user specified layer")}else{w=0,E=null;for(let K=0;;K++){if(K>be.MAX_NB_BITS)throw new A("Data too large for an Aztec code");if(d=K<=3,h=d?K+1:K,p=be.totalBitsInLayer(h,d),u>p)continue;(E==null||w!==be.WORD_SIZE[h])&&(w=be.WORD_SIZE[h],E=be.stuffBits(a,w));let Ae=p-p%w;if(!(d&&E.getSize()>w*64)&&E.getSize()+l<=Ae)break}}let S=be.generateCheckWords(E,p,w),b=E.getSize()/w,D=be.generateModeMessage(d,h,b),P=(d?11:14)+h*4,L=new Int32Array(P),$;if(d){$=P;for(let K=0;K<L.length;K++)L[K]=K}else{$=P+1+2*_.truncDivision(_.truncDivision(P,2)-1,15);let K=_.truncDivision(P,2),Ae=_.truncDivision($,2);for(let me=0;me<K;me++){let er=me+_.truncDivision(me,15);L[K-me-1]=Ae-er-1,L[K+me]=Ae+er+1}}let Q=new Te($);for(let K=0,Ae=0;K<h;K++){let me=(h-K)*4+(d?9:12);for(let er=0;er<me;er++){let Mr=er*2;for(let tr=0;tr<2;tr++)S.get(Ae+Mr+tr)&&Q.set(L[K*2+tr],L[K*2+er]),S.get(Ae+me*2+Mr+tr)&&Q.set(L[K*2+er],L[P-1-K*2-tr]),S.get(Ae+me*4+Mr+tr)&&Q.set(L[P-1-K*2-tr],L[P-1-K*2-er]),S.get(Ae+me*6+Mr+tr)&&Q.set(L[P-1-K*2-er],L[K*2+tr])}Ae+=me*8}if(be.drawModeMessage(Q,d,$,D),d)be.drawBullsEye(Q,_.truncDivision($,2),5);else{be.drawBullsEye(Q,_.truncDivision($,2),7);for(let K=0,Ae=0;K<_.truncDivision(P,2)-1;K+=15,Ae+=16)for(let me=_.truncDivision($,2)&1;me<$;me+=2)Q.set(_.truncDivision($,2)-Ae,me),Q.set(_.truncDivision($,2)+Ae,me),Q.set(me,_.truncDivision($,2)-Ae),Q.set(me,_.truncDivision($,2)+Ae)}let q=new $d;return q.setCompact(d),q.setSize($),q.setLayers(h),q.setCodeWords(b),q.setMatrix(Q),q}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 U;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=be.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=be.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=_.truncDivision(s,2);if(i)for(let u=0;u<7;u++){let d=l-3+u;a.get(u)&&r.set(d,l-5),a.get(u+7)&&r.set(l+5,d),a.get(20-u)&&r.set(d,l+5),a.get(27-u)&&r.set(l-5,d)}else for(let u=0;u<10;u++){let d=l-5+u+_.truncDivision(u,5);a.get(u)&&r.set(d,l-7),a.get(u+10)&&r.set(l+7,d),a.get(29-u)&&r.set(d,l+7),a.get(39-u)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new tc(be.getGF(s)),u=_.truncDivision(i,s),d=be.bitsToWords(r,s,u);l.encode(d,u-a);let h=i%s,p=new U;p.appendBits(0,h);for(const w of Array.from(d))p.appendBits(w,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,u;for(l=0,u=r.getSize()/i;l<u;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 Oe.AZTEC_PARAM;case 6:return Oe.AZTEC_DATA_6;case 8:return Oe.AZTEC_DATA_8;case 10:return Oe.AZTEC_DATA_10;case 12:return Oe.AZTEC_DATA_12;default:throw new A("Unsupported word size "+r)}}static stuffBits(r,i){let s=new U,a=r.getSize(),l=(1<<i)-2;for(let u=0;u<a;u+=i){let d=0;for(let h=0;h<i;h++)(u+h>=a||r.get(u+h))&&(d|=1<<i-1-h);(d&l)===l?(s.appendBits(d&l,i),u--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),u--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}be.DEFAULT_EC_PERCENT=33,be.DEFAULT_AZTEC_LAYERS=0,be.MAX_NB_BITS=32,be.MAX_NB_BITS_COMPACT=4,be.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 wa{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let u=nc.ISO_8859_1,d=be.DEFAULT_EC_PERCENT,h=be.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(mt.CHARACTER_SET)&&(u=Wd.forName(l.get(mt.CHARACTER_SET).toString())),l.has(mt.ERROR_CORRECTION)&&(d=_.parseInt(l.get(mt.ERROR_CORRECTION).toString())),l.has(mt.AZTEC_LAYERS)&&(h=_.parseInt(l.get(mt.AZTEC_LAYERS).toString()))),wa.encodeLayers(r,i,s,a,u,d,h)}static encodeLayers(r,i,s,a,l,u,d){if(i!==le.AZTEC)throw new A("Can only encode AZTEC, but got "+i);let h=be.encode(se.getBytes(r,l),u,d);return wa.renderResult(h,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Hr;let l=a.getWidth(),u=a.getHeight(),d=Math.max(i,l),h=Math.max(s,u),p=Math.min(d/l,h/u),w=(d-l*p)/2,E=(h-u*p)/2,S=new Te(d,h);for(let b=0,D=E;b<u;b++,D+=p)for(let P=0,L=w;P<l;P++,L+=p)a.get(P,b)&&S.setRegion(L,D,p,p);return S}}n.AbstractExpandedDecoder=Hu,n.ArgumentException=C,n.ArithmeticException=oa,n.AztecCode=$d,n.AztecCodeReader=ua,n.AztecCodeWriter=wa,n.AztecDecoder=Ue,n.AztecDetector=bd,n.AztecDetectorResult=Td,n.AztecEncoder=be,n.AztecHighLevelEncoder=Vs,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=I,n.BitArray=U,n.BitMatrix=Te,n.BitSource=Ku,n.BrowserAztecCodeReader=mv,n.BrowserBarcodeReader=Cv,n.BrowserCodeReader=yr,n.BrowserDatamatrixCodeReader=Sv,n.BrowserMultiFormatReader=kv,n.BrowserPDF417Reader=Bv,n.BrowserQRCodeReader=Lv,n.BrowserQRCodeSvgWriter=ui,n.CharacterSetECI=V,n.ChecksumException=O,n.Code128Reader=J,n.Code39Reader=pt,n.DataMatrixDecodedBitStreamParser=bn,n.DataMatrixReader=_n,n.DecodeHintType=j,n.DecoderResult=Ds,n.DefaultGridSampler=Rd,n.DetectorResult=la,n.EAN13Reader=ii,n.EncodeHintType=mt,n.Exception=x,n.FormatException=B,n.GenericGF=Oe,n.GenericGFPoly=Zt,n.GlobalHistogramBinarizer=tt,n.GridSampler=Wu,n.GridSamplerInstance=Tn,n.HTMLCanvasElementLuminanceSource=pe,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=A,n.IllegalStateException=Hr,n.InvertedLuminanceSource=de,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ki,n.MultiFormatReader=jd,n.MultiFormatWriter=Uv,n.NotFoundException=H,n.OneDReader=dt,n.PDF417DecodedBitStreamParser=W,n.PDF417DecoderErrorCorrection=Pd,n.PDF417Reader=_t,n.PDF417ResultMetadata=Bd,n.PerspectiveTransform=Nr,n.PlanarYUVLuminanceSource=Kr,n.QRCodeByteMatrix=xa,n.QRCodeDataMask=Cr,n.QRCodeDecodedBitStreamParser=Ze,n.QRCodeDecoderErrorCorrectionLevel=je,n.QRCodeDecoderFormatInformation=Ft,n.QRCodeEncoder=$e,n.QRCodeEncoderQRCode=li,n.QRCodeMaskUtil=it,n.QRCodeMatrixUtil=fe,n.QRCodeMode=ce,n.QRCodeReader=On,n.QRCodeVersion=ue,n.QRCodeWriter=Li,n.RGBLuminanceSource=rc,n.RSS14Reader=nt,n.RSSExpandedReader=Y,n.ReaderException=pa,n.ReedSolomonDecoder=Ps,n.ReedSolomonEncoder=tc,n.ReedSolomonException=Ni,n.Result=Ke,n.ResultMetadataType=Ct,n.ResultPoint=ae,n.StringUtils=se,n.UnsupportedOperationException=oe,n.VideoInputDevice=He,n.WhiteRectangleDetector=an,n.WriterException=Le,n.ZXingArrays=T,n.ZXingCharset=Wd,n.ZXingInteger=_,n.ZXingStandardCharsets=nc,n.ZXingStringBuilder=ge,n.ZXingStringEncoding=ye,n.ZXingSystem=M,n.createAbstractExpandedDecoder=Dd,Object.defineProperty(n,"__esModule",{value:!0})})})(P1,P1.exports);var Qe=P1.exports;const F_=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var $p=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(),!F_)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),f=new Map;f.set(Qe.DecodeHintType.POSSIBLE_FORMATS,c),f.set(Qe.DecodeHintType.TRY_HARDER,!1),this.hints=f}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(f){c(f)}})},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)),f=n.decode(c);return{text:f.text,format:dv.create(this.toHtml5QrcodeSupportedFormats(f.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 f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),U_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},j_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Vp=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 U_(this,void 0,void 0,function(){var n,o;return j_(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:dv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,f=t;c<f.length;c++){var g=f[c],m=g.boundingBox.width*g.boundingBox.height;m>o&&(o=m,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 f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.warn("".concat(f," 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}(),zp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Hp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},W_=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&&Vp.isSupported()?(this.primaryDecoder=new Vp(t,o,c),this.secondaryDecoder=new $p(t,o,c)):this.primaryDecoder=new $p(t,o,c)}return e.prototype.decodeAsync=function(t){return zp(this,void 0,void 0,function(){var n;return Hp(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 zp(this,void 0,void 0,function(){var n,o;return Hp(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 f=t/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),Sd=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},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)}}(),ru=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},nu=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gv=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}(),$_=function(e){Sd(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}(gv),V_=function(e){Sd(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}($_),z_=function(e){Sd(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(gv),H_=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new V_(this.track)},e.prototype.torchFeature=function(){return new z_(this.track)},e}(),G_=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 ru(this,void 0,void 0,function(){var f,g;return nu(this,function(m){switch(m.label){case 0:return f=new e(t,n,c),o.aspectRatio?(g={aspectRatio:o.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(g)]):[3,2];case 1:m.sent(),m.label=2;case 2:return f.setupSurface(),[2,f]}})})},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 ru(this,void 0,void 0,function(){return nu(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(),f=c.length,g=0;t.mediaStream.getVideoTracks().forEach(function(m){t.mediaStream.removeTrack(m),m.stop(),++g,g>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new H_(this.getFirstTrackOrFail())},e}(),X_=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return ru(this,void 0,void 0,function(){return nu(this,function(c){return[2,G_.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return ru(this,void 0,void 0,function(){var n,o;return nu(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}(),Gp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Xp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Y_=function(){function e(){}return e.failIfNotSupported=function(){return Gp(this,void 0,void 0,function(){return Xp(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return Gp(this,void 0,void 0,function(){return Xp(this,function(n){return[2,X_.create(t)]})})},e}(),K_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Z_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Q_=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=ss.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=ss.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 K_(this,void 0,void 0,function(){var t,n,o,c,f,g,m;return Z_(this,function(v){switch(v.label){case 0:return t=function(x){for(var C=x.getVideoTracks(),A=0,I=C;A<I.length;A++){var O=I[A];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=v.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=v.sent(),c=[],f=0,g=o;f<g.length;f++)m=g[f],m.kind==="videoinput"&&c.push({id:m.deviceId,label:m.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(f){for(var g=[],m=0,v=f;m<v.length;m++){var x=v[m];x.kind==="video"&&g.push({id:x.id,label:x.label})}t(g)},c=MediaStreamTrack;c.getSources(o)})},e}(),st;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(st||(st={}));var q_=function(){function e(){this.state=st.NOT_STARTED,this.onGoingTransactionNewState=st.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===st.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=st.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=st.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==st.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case st.UNKNOWN:throw"Transition from unknown is not allowed";case st.NOT_STARTED:this.failIfNewStateIs(t,[st.PAUSED]);break;case st.SCANNING:break;case st.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var f=c[o];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),J_=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()===st.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==st.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===st.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===st.PAUSED},e}(),eO=function(){function e(){}return e.create=function(){return new J_(new q_)},e}(),tO=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},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)}}(),fr=function(e){tO(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}(k_),rO=function(){function e(t,n){this.logger=n,this.fps=fr.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=fr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?hv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!ln(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),bO=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 L_(this.verbose),this.qrcode=new W_(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=eO.create()}return e.prototype.start=function(t,n,o,c){var f=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 m=rO.create(n,this.logger);this.clearElement();var v=!1;m.videoConstraints&&(m.isMediaStreamConstraintsValid()?v=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=v,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:fr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var A=this,I=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(O,k){var M=x?m.videoConstraints:A.createVideoConstraints(t);if(!M){I.cancel(),k("videoConstraints should be defined");return}var G={};(!x||m.aspectRatio)&&(G.aspectRatio=m.aspectRatio);var N={onRenderSurfaceReady:function(T,_){A.setupUi(T,_,m),A.isScanning=!0,A.foreverScan(m,o,g)}};Y_.failIfNotSupported().then(function(T){T.create(M).then(function(_){return _.render(f.element,G,N).then(function(U){A.renderedCamera=U,I.execute(),O(null)}).catch(function(U){I.cancel(),k(U)})}).catch(function(_){I.cancel(),k(ss.errorGettingUserMedia(_))})}).catch(function(T){I.cancel(),k(ss.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(ln(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(st.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(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var f=document.getElementById(fr.SHADED_REGION_ELEMENT_ID);f&&t.element.removeChild(f)}},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(ln(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var g=new Image;g.onload=function(){var m=g.width,v=g.height,x=document.getElementById(o.elementId),C=x.clientWidth?x.clientWidth:fr.DEFAULT_WIDTH,A=Math.max(x.clientHeight?x.clientHeight:v,fr.FILE_SCAN_MIN_HEIGHT),I=o.computeCanvasDrawConfig(m,v,C,A);if(n){var O=o.createCanvasElement(C,A,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var k=O.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=A,k.drawImage(g,0,0,m,v,I.x,I.y,I.width,I.height)}var M=fr.FILE_SCAN_HIDDEN_CANVAS_PADDING,G=Math.max(g.width,I.width),N=Math.max(g.height,I.height),T=G+2*M,_=N+2*M,U=o.createCanvasElement(T,_);x.appendChild(U);var z=U.getContext("2d");if(!z)throw"Unable to get 2d context from canvas";z.canvas.width=T,z.canvas.height=_,z.drawImage(g,0,0,m,v,M,M,G,N);try{o.qrcode.decodeRobustlyAsync(U).then(function(j){c(Wp.createFromQrcodeResult(j))}).catch(f)}catch(j){f("QR code parse error, error = ".concat(j))}},g.onerror=f,g.onabort=f,g.onstalled=f,g.onsuspend=f,g.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Q_.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(!hv.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,f=t.formatsToSupport;c<f.length;c++){var g=f[c];P_(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(ln(t))return!0;if(!ln(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(ln(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return ln(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,f=o.qrbox;this.validateQrboxConfig(f);var g=this.toQrdimensions(t,n,f),m=function(x){if(x<fr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(fr.MIN_QR_BOX_SIZE,"px.")},v=function(x){return x>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."),x=t),x};m(g.width),m(g.height),g.width=v(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=ln(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,n,c);f.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()&&f.height<=n,m={x:0,y:0,width:t,height:n},v=g?this.getShadedRegionBounds(t,n,f):m,x=this.createCanvasElement(v.width,v.height),C={willReadFrequently:!0},A=x.getContext("2d",C);A.canvas.width=v.width,A.canvas.height=v.height,this.element.append(x),g&&this.possiblyInsertShadingElement(this.element,t,n,f),this.createScannerPausedUiElement(this.element),this.qrRegion=v,this.context=A,this.canvasElement=x},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=ss.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,Wp.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var f=ss.codeParseError(c);return n(f,B_.createFrom(f)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),g=f.videoWidth/f.clientWidth,m=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var v=this.qrRegion.width*g,x=this.qrRegion.height*m,C=this.qrRegion.x*g,A=this.qrRegion.y*m;this.context.drawImage(f,C,A,v,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(O){!O&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){I()})):I()}).catch(function(O){c.logger.logError("Error happend while scanning context",O),I()})}},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},f="exact",g=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},m=Object.keys(t);if(m.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(m.length," keys");var v=Object.keys(t)[0];if(v!==n&&v!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(v===n){var x=t.facingMode;if(typeof x=="string"){if(g(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(g(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var A=t.deviceId;if(typeof A=="string")return{deviceId:A};if(typeof A=="object"){if(f in A)return{deviceId:{exact:A["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof A;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var f=(o-t)/2,g=(c-n)/2;return{x:f,y:g,width:t,height:n}}else{var m=t,v=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(m,"X").concat(v)+" 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?fr.BORDER_SHADER_MATCH_COLOR:fr.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,f=n,g=document.createElement("canvas");return g.style.width="".concat(c,"px"),g.style.height="".concat(f,"px"),g.style.display="none",g.id=ln(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 f=document.createElement("div");f.style.position="absolute";var g=(n-c.width)/2,m=(o-c.height)/2;if(f.style.borderLeft="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(fr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var v=5,x=40;this.insertShaderBorders(f,x,v,-v,null,0,!0),this.insertShaderBorders(f,x,v,-v,null,0,!1),this.insertShaderBorders(f,x,v,null,-v,0,!0),this.insertShaderBorders(f,x,v,null,-v,0,!1),this.insertShaderBorders(f,v,x+v,-v,null,-v,!0),this.insertShaderBorders(f,v,x+v,null,-v,-v,!0),this.insertShaderBorders(f,v,x+v,-v,null,-v,!1),this.insertShaderBorders(f,v,x+v,null,-v,-v,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,n,o,c,f,g,m){var v=document.createElement("div");v.style.position="absolute",v.style.backgroundColor=fr.BORDER_SHADER_DEFAULT_COLOR,v.style.width="".concat(n,"px"),v.style.height="".concat(o,"px"),c!==null&&(v.style.top="".concat(c,"px")),f!==null&&(v.style.bottom="".concat(f,"px")),m?v.style.left="".concat(g,"px"):v.style.right="".concat(g,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(v),t.appendChild(v)},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}(),Yp;(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"})(Yp||(Yp={}));var k1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(k1||(k1={}));var B1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(B1||(B1={}));var L1;(function(e){e[e.ALL=17]="ALL"})(L1||(L1={}));const nO=Object.assign(Object.assign({},re),L1);var Kp;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(Kp||(Kp={}));const iO=[{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 sO(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 oO=sa("CapacitorBarcodeScanner",{web:()=>(sO(iO),Y1(()=>import("./web-CICIlrjx.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class aO{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||k1.BACK,t.scanOrientation=t.scanOrientation||B1.ADAPTIVE,oO.scanBarcode(t)}}const vf=sa("SecureStoragePlugin",{web:()=>Y1(()=>import("./web-DdNvGACS.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function lO(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 f=qn.parse(c.origin);if(!f)throw new Error;return{endpoint:f,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=qn.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class uO{ready(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await vf.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 vf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await vf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function cO(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await aO.scanBarcode({hint:nO.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class fO{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,f={})=>{const g=this.session,m=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),v=new Headers(f.headers??(c instanceof Request?c.headers:void 0));g&&m.origin===g.origin&&v.set("authorization",`Bearer ${g.token}`);const x=await this.transport(c,{...f,headers:v,credentials:"omit",redirect:"error"});if(g&&this.session===g&&m.origin===g.origin&&(x.status===401||x.status===423)){this.session=null;try{await this.storage.remove(g.origin)}finally{this.onRevoked()}}return x}}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}=lO(t),c=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:AbortSignal.timeout(1e4)});if(!c.ok)throw new Error(c.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":c.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。");const f=await c.json();if(typeof f.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(f.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,f.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${f.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:f.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()}}}}var iu;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(iu||(iu={}));var Zp;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(Zp||(Zp={}));const yf=sa("StatusBar");function dO(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const f=parseInt(t[1].slice(c,c+2),16)/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?iu.Light:iu.Dark}}function hO(){if(Ts.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Ol.getState().skin;let t=!1,n=yf.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const g=dO(getComputedStyle(e).getPropertyValue("--bg-deepest"));g&&(n=n.then(async()=>{t||(await yf.setBackgroundColor({color:g.color}),await yf.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 f=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",f),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",f),window.removeEventListener("focus",o)}}const gO="/service-worker.js";function pO(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function xO(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 f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}async function Qp(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(gO),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:xO(t)});await e.post("/api/push/subscribe",c.toJSON())}function mO(e){pO()&&(async()=>{try{if(Notification.permission==="granted"){await Qp(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await Qp(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Ef 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 qp=10,wO=13,ci=32;function Cf(e){}function vO(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=Cf,onError:n=Cf,onRetry:o=Cf,onComment:c,maxBufferSize:f}=e,g=[];let m=0,v=!0,x,C="",A=0,I,O=!1;function k(z){if(O)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(v&&(v=!1,z.charCodeAt(0)===239&&z.charCodeAt(1)===187&&z.charCodeAt(2)===191&&(z=z.slice(3))),g.length===0){const X=G(z);X!==""&&(g.push(X),m=X.length),M();return}if(z.indexOf(`
|
|
82
|
-
`)===-1&&z.indexOf("\r")===-1){g.push(z),m+=z.length,
|
|
79
|
+
`),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<li.NUM_MASK_PATTERNS}}li.NUM_MASK_PATTERNS=8;class Le extends x{}Le.kind="WriterException";class fe{constructor(){}static clearMatrix(r){r.clear(255)}static buildMatrix(r,i,s,a,l){fe.clearMatrix(l),fe.embedBasicPatterns(s,l),fe.embedTypeInfo(i,a,l),fe.maybeEmbedVersionInfo(s,l),fe.embedDataBits(r,a,l)}static embedBasicPatterns(r,i){fe.embedPositionDetectionPatternsAndSeparators(i),fe.embedDarkDotAtLeftBottomCorner(i),fe.maybeEmbedPositionAdjustmentPatterns(r,i),fe.embedTimingPatterns(i)}static embedTypeInfo(r,i,s){const a=new U;fe.makeTypeInfoBits(r,i,a);for(let l=0,u=a.getSize();l<u;++l){const d=a.get(a.getSize()-1-l),h=fe.TYPE_INFO_COORDINATES[l],p=h[0],w=h[1];if(s.setBoolean(p,w,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 U;fe.makeVersionInfoBits(r,s);let a=6*3-1;for(let l=0;l<6;++l)for(let u=0;u<3;++u){const d=s.get(a);a--,i.setBoolean(l,i.getHeight()-11+u,d),i.setBoolean(i.getHeight()-11+u,l,d)}}static embedDataBits(r,i,s){let a=0,l=-1,u=s.getWidth()-1,d=s.getHeight()-1;for(;u>0;){for(u===6&&(u-=1);d>=0&&d<s.getHeight();){for(let h=0;h<2;++h){const p=u-h;if(!fe.isEmpty(s.get(p,d)))continue;let w;a<r.getSize()?(w=r.get(a),++a):w=!1,i!==255&&it.getDataMaskBit(i,p,d)&&(w=!w),s.setBoolean(p,d,w)}d+=l}l=-l,d+=l,u-=2}if(a!==r.getSize())throw new Le("Not all bits consumed: "+a+"/"+r.getSize())}static findMSBSet(r){return 32-_.numberOfLeadingZeros(r)}static calculateBCHCode(r,i){if(i===0)throw new A("0 polynomial");const s=fe.findMSBSet(i);for(r<<=s-1;fe.findMSBSet(r)>=s;)r^=i<<fe.findMSBSet(r)-s;return r}static makeTypeInfoBits(r,i,s){if(!li.isValidMaskPattern(i))throw new Le("Invalid mask pattern");const a=r.getBits()<<3|i;s.appendBits(a,5);const l=fe.calculateBCHCode(a,fe.TYPE_INFO_POLY);s.appendBits(l,10);const u=new U;if(u.appendBits(fe.TYPE_INFO_MASK_PATTERN,15),s.xor(u),s.getSize()!==15)throw new Le("should not happen but we got: "+s.getSize())}static makeVersionInfoBits(r,i){i.appendBits(r.getVersionNumber(),6);const s=fe.calculateBCHCode(r.getVersionNumber(),fe.VERSION_INFO_POLY);if(i.appendBits(s,12),i.getSize()!==18)throw new Le("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;fe.isEmpty(r.get(i,6))&&r.setNumber(i,6,s),fe.isEmpty(r.get(6,i))&&r.setNumber(6,i,s)}}static embedDarkDotAtLeftBottomCorner(r){if(r.get(8,r.getHeight()-8)===0)throw new Le;r.setNumber(8,r.getHeight()-8,1)}static embedHorizontalSeparationPattern(r,i,s){for(let a=0;a<8;++a){if(!fe.isEmpty(s.get(r+a,i)))throw new Le;s.setNumber(r+a,i,0)}}static embedVerticalSeparationPattern(r,i,s){for(let a=0;a<7;++a){if(!fe.isEmpty(s.get(r,i+a)))throw new Le;s.setNumber(r,i+a,0)}}static embedPositionAdjustmentPattern(r,i,s){for(let a=0;a<5;++a){const l=fe.POSITION_ADJUSTMENT_PATTERN[a];for(let u=0;u<5;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPattern(r,i,s){for(let a=0;a<7;++a){const l=fe.POSITION_DETECTION_PATTERN[a];for(let u=0;u<7;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPatternsAndSeparators(r){const i=fe.POSITION_DETECTION_PATTERN[0].length;fe.embedPositionDetectionPattern(0,0,r),fe.embedPositionDetectionPattern(r.getWidth()-i,0,r),fe.embedPositionDetectionPattern(0,r.getWidth()-i,r);const s=8;fe.embedHorizontalSeparationPattern(0,s-1,r),fe.embedHorizontalSeparationPattern(r.getWidth()-s,s-1,r),fe.embedHorizontalSeparationPattern(0,r.getWidth()-s,r);const a=7;fe.embedVerticalSeparationPattern(a,0,r),fe.embedVerticalSeparationPattern(r.getHeight()-a-1,0,r),fe.embedVerticalSeparationPattern(a,r.getHeight()-a,r)}static maybeEmbedPositionAdjustmentPatterns(r,i){if(r.getVersionNumber()<2)return;const s=r.getVersionNumber()-1,a=fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let l=0,u=a.length;l!==u;l++){const d=a[l];if(d>=0)for(let h=0;h!==u;h++){const p=a[h];p>=0&&fe.isEmpty(i.get(p,d))&&fe.embedPositionAdjustmentPattern(p-2,d-2,i)}}}}fe.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])]),fe.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])]),fe.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])]),fe.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])]),fe.VERSION_INFO_POLY=7973,fe.TYPE_INFO_POLY=1335,fe.TYPE_INFO_MASK_PATTERN=21522;class Fv{constructor(r,i){this.dataBytes=r,this.errorCorrectionBytes=i}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class $e{constructor(){}static calculateMaskPenalty(r){return it.applyMaskPenaltyRule1(r)+it.applyMaskPenaltyRule2(r)+it.applyMaskPenaltyRule3(r)+it.applyMaskPenaltyRule4(r)}static encode(r,i,s=null){let a=$e.DEFAULT_BYTE_MODE_ENCODING;const l=s!==null&&s.get(mt.CHARACTER_SET)!==void 0;l&&(a=s.get(mt.CHARACTER_SET).toString());const u=this.chooseMode(r,a),d=new U;if(u===ce.BYTE&&(l||$e.DEFAULT_BYTE_MODE_ENCODING!==a)){const q=V.getCharacterSetECIByName(a);q!==void 0&&this.appendECI(q,d)}this.appendModeInfo(u,d);const h=new U;this.appendBytes(r,u,h,a);let p;if(s!==null&&s.get(mt.QR_VERSION)!==void 0){const q=Number.parseInt(s.get(mt.QR_VERSION).toString(),10);p=ue.getVersionForNumber(q);const K=this.calculateBitsNeeded(u,d,h,p);if(!this.willFit(K,p,i))throw new Le("Data too big for requested version")}else p=this.recommendVersion(i,u,d,h);const w=new U;w.appendBitArray(d);const E=u===ce.BYTE?h.getSizeInBytes():r.length;this.appendLengthInfo(E,p,u,w),w.appendBitArray(h);const S=p.getECBlocksForLevel(i),b=p.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(b,w);const D=this.interleaveWithECBytes(w,p.getTotalCodewords(),b,S.getNumBlocks()),M=new li;M.setECLevel(i),M.setMode(u),M.setVersion(p);const L=p.getDimensionForVersion(),$=new xa(L,L),Q=this.chooseMaskPattern(D,i,p,$);return M.setMaskPattern(Q),fe.buildMatrix(D,i,p,Q,$),M.setMatrix($),M}static recommendVersion(r,i,s,a){const l=this.calculateBitsNeeded(i,s,a,ue.getVersionForNumber(1)),u=this.chooseVersion(l,r),d=this.calculateBitsNeeded(i,s,a,u);return this.chooseVersion(d,r)}static calculateBitsNeeded(r,i,s,a){return i.getSize()+r.getCharacterCountBits(a)+s.getSize()}static getAlphanumericCode(r){return r<$e.ALPHANUMERIC_TABLE.length?$e.ALPHANUMERIC_TABLE[r]:-1}static chooseMode(r,i=null){if(V.SJIS.getName()===i&&this.isOnlyDoubleByteKanji(r))return ce.KANJI;let s=!1,a=!1;for(let l=0,u=r.length;l<u;++l){const d=r.charAt(l);if($e.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)a=!0;else return ce.BYTE}return a?ce.ALPHANUMERIC:s?ce.NUMERIC:ce.BYTE}static isOnlyDoubleByteKanji(r){let i;try{i=ye.encode(r,V.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,u=-1;for(let d=0;d<li.NUM_MASK_PATTERNS;d++){fe.buildMatrix(r,i,s,d,a);let h=this.calculateMaskPenalty(a);h<l&&(l=h,u=d)}return u}static chooseVersion(r,i){for(let s=1;s<=40;s++){const a=ue.getVersionForNumber(s);if($e.willFit(r,a,i))return a}throw new Le("Data too big")}static willFit(r,i,s){const a=i.getTotalCodewords(),u=i.getECBlocksForLevel(s).getTotalECCodewords(),d=a-u,h=(r+7)/8;return d>=h}static terminateBits(r,i){const s=r*8;if(i.getSize()>s)throw new Le("data bits cannot fit in the QR Code"+i.getSize()+" > "+s);for(let u=0;u<4&&i.getSize()<s;++u)i.appendBit(!1);const a=i.getSize()&7;if(a>0)for(let u=a;u<8;u++)i.appendBit(!1);const l=r-i.getSizeInBytes();for(let u=0;u<l;++u)i.appendBits(u&1?17:236,8);if(i.getSize()!==s)throw new Le("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(r,i,s,a,l,u){if(a>=s)throw new Le("Block ID too large");const d=r%s,h=s-d,p=Math.floor(r/s),w=p+1,E=Math.floor(i/s),S=E+1,b=p-E,D=w-S;if(b!==D)throw new Le("EC bytes mismatch");if(s!==h+d)throw new Le("RS blocks mismatch");if(r!==(E+b)*h+(S+D)*d)throw new Le("Total bytes mismatch");a<h?(l[0]=E,u[0]=b):(l[0]=S,u[0]=D)}static interleaveWithECBytes(r,i,s,a){if(r.getSizeInBytes()!==s)throw new Le("Number of bits and data bytes does not match");let l=0,u=0,d=0;const h=new Array;for(let w=0;w<a;++w){const E=new Int32Array(1),S=new Int32Array(1);$e.getNumDataBytesAndNumECBytesForBlockID(i,s,a,w,E,S);const b=E[0],D=new Uint8Array(b);r.toBytes(8*l,D,0,b);const M=$e.generateECBytes(D,S[0]);h.push(new Fv(D,M)),u=Math.max(u,b),d=Math.max(d,M.length),l+=E[0]}if(s!==l)throw new Le("Data bytes does not match offset");const p=new U;for(let w=0;w<u;++w)for(const E of h){const S=E.getDataBytes();w<S.length&&p.appendBits(S[w],8)}for(let w=0;w<d;++w)for(const E of h){const S=E.getErrorCorrectionBytes();w<S.length&&p.appendBits(S[w],8)}if(i!==p.getSizeInBytes())throw new Le("Interleaving error: "+i+" and "+p.getSizeInBytes()+" differ.");return p}static generateECBytes(r,i){const s=r.length,a=new Int32Array(s+i);for(let u=0;u<s;u++)a[u]=r[u]&255;new rc(Oe.QR_CODE_FIELD_256).encode(a,i);const l=new Uint8Array(i);for(let u=0;u<i;u++)l[u]=a[s+u];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 Le(r+" is bigger than "+((1<<l)-1));a.appendBits(r,l)}static appendBytes(r,i,s,a){switch(i){case ce.NUMERIC:$e.appendNumericBytes(r,s);break;case ce.ALPHANUMERIC:$e.appendAlphanumericBytes(r,s);break;case ce.BYTE:$e.append8BitBytes(r,s,a);break;case ce.KANJI:$e.appendKanjiBytes(r,s);break;default:throw new Le("Invalid mode: "+i)}}static getDigit(r){return r.charCodeAt(0)-48}static isDigit(r){const i=$e.getDigit(r);return i>=0&&i<=9}static appendNumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=$e.getDigit(r.charAt(a));if(a+2<s){const u=$e.getDigit(r.charAt(a+1)),d=$e.getDigit(r.charAt(a+2));i.appendBits(l*100+u*10+d,10),a+=3}else if(a+1<s){const u=$e.getDigit(r.charAt(a+1));i.appendBits(l*10+u,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=$e.getAlphanumericCode(r.charCodeAt(a));if(l===-1)throw new Le;if(a+1<s){const u=$e.getAlphanumericCode(r.charCodeAt(a+1));if(u===-1)throw new Le;i.appendBits(l*45+u,11),a+=2}else i.appendBits(l,6),a++}}static append8BitBytes(r,i,s){let a;try{a=ye.encode(r,s)}catch(l){throw new Le(l)}for(let l=0,u=a.length;l!==u;l++){const d=a[l];i.appendBits(d,8)}}static appendKanjiBytes(r,i){let s;try{s=ye.encode(r,V.SJIS)}catch(l){throw new Le(l)}const a=s.length;for(let l=0;l<a;l+=2){const u=s[l]&255,d=s[l+1]&255,h=u<<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 Le("Invalid byte sequence");const w=(p>>8)*192+(p&255);i.appendBits(w,13)}}static appendECI(r,i){i.appendBits(ce.ECI.getBits(),4),i.appendBits(r.getValue(),8)}}$e.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]),$e.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ui{write(r,i,s,a=null){if(r.length===0)throw new A("Found empty contents");if(i<0||s<0)throw new A("Requested dimensions are too small: "+i+"x"+s);let l=je.L,u=ui.QUIET_ZONE_SIZE;a!==null&&(a.get(mt.ERROR_CORRECTION)!==void 0&&(l=je.fromString(a.get(mt.ERROR_CORRECTION).toString())),a.get(mt.MARGIN)!==void 0&&(u=Number.parseInt(a.get(mt.MARGIN).toString(),10)));const d=$e.encode(r,l,a);return this.renderResult(d,i,s,u)}writeToDom(r,i,s,a,l=null){typeof r=="string"&&(r=document.querySelector(r));const u=this.write(i,s,a,l);r&&r.appendChild(u)}renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),M=this.createSVGElement(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)if(l.get(Q,L)===1){const K=this.createSvgRectElement(q,$,S,S);M.appendChild(K)}return M}createSVGElement(r,i){const s=document.createElementNS(ui.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(ui.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}}ui.QUIET_ZONE_SIZE=4,ui.SVG_NS="http://www.w3.org/2000/svg";class Li{encode(r,i,s,a,l){if(r.length===0)throw new A("Found empty contents");if(i!==le.QR_CODE)throw new A("Can only encode QR_CODE, but got "+i);if(s<0||a<0)throw new A(`Requested dimensions are too small: ${s}x${a}`);let u=je.L,d=Li.QUIET_ZONE_SIZE;l!==null&&(l.get(mt.ERROR_CORRECTION)!==void 0&&(u=je.fromString(l.get(mt.ERROR_CORRECTION).toString())),l.get(mt.MARGIN)!==void 0&&(d=Number.parseInt(l.get(mt.MARGIN).toString(),10)));const h=$e.encode(r,u,l);return Li.renderResult(h,s,a,d)}static renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),M=new Te(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)l.get(Q,L)===1&&M.setRegion(q,$,S,S);return M}}Li.QUIET_ZONE_SIZE=4;class Uv{encode(r,i,s,a,l){let u;switch(i){case le.QR_CODE:u=new Li;break;default:throw new A("No encoder available for format "+i)}return u.encode(r,i,s,a,l)}}class Kr extends te{constructor(r,i,s,a,l,u,d,h){if(super(u,d),this.yuvData=r,this.dataWidth=i,this.dataHeight=s,this.left=a,this.top=l,a+u>i||l+d>s)throw new A("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(u,d)}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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 P.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 P.arraycopy(this.yuvData,l,a,0,s),a;for(let u=0;u<i;u++){const d=u*r;P.arraycopy(this.yuvData,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new Kr(this.yuvData,this.dataWidth,this.dataHeight,this.left+r,this.top+i,s,a,!1)}renderThumbnail(){const r=this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR,i=this.getHeight()/Kr.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(r*i),a=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let u=0;u<i;u++){const d=u*r;for(let h=0;h<r;h++){const p=a[l+h*Kr.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|p*65793}l+=this.dataWidth*Kr.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Kr.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 u=l+r/2;for(let d=l,h=l+r-1;d<u;d++,h--){const p=s[d];s[d]=s[h],s[h]=p}}}invert(){return new de(this)}}Kr.THUMBNAIL_SCALE_FACTOR=2;class nc extends te{constructor(r,i,s,a,l,u,d){if(super(i,s),this.dataWidth=a,this.dataHeight=l,this.left=u,this.top=d,r.BYTES_PER_ELEMENT===4){const h=i*s,p=new Uint8ClampedArray(h);for(let w=0;w<h;w++){const E=r[w],S=E>>16&255,b=E>>7&510,D=E&255;p[w]=(S+b+D)/4&255}this.luminances=p}else this.luminances=r;if(a===void 0&&(this.dataWidth=i),l===void 0&&(this.dataHeight=s),u===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+i>this.dataWidth||this.top+s>this.dataHeight)throw new A("Crop rectangle does not fit within image data.")}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("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 P.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 P.arraycopy(this.luminances,l,a,0,s),a;for(let u=0;u<i;u++){const d=u*r;P.arraycopy(this.luminances,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new nc(this.luminances,s,a,this.dataWidth,this.dataHeight,this.left+r,this.top+i)}invert(){return new de(this)}}class Wd extends V{static forName(r){return this.getCharacterSetECIByName(r)}}class ic{}ic.ISO_8859_1=V.ISO8859_1;class $d{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 Vd{static singletonList(r){return[r]}static min(r,i){return r.sort(i)[0]}}class jv{constructor(r){this.previous=r}getPrevious(){return this.previous}}class Fi extends jv{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 Fi(this,r,i)}addBinaryShift(r,i){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Fi(this,r,i)}toString(){let r=this.value&(1<<this.bitCount)-1;return r|=1<<this.bitCount,"<"+_.toBinaryString(r|1<<this.bitCount).substring(1)+">"}}class sc extends Fi{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 sc(this,r,i)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Wv(y,r,i){return new sc(y,r,i)}function $s(y,r,i){return new Fi(y,r,i)}const $v=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Dn=0,ma=1,Sr=2,zd=3,Zr=4,Vv=new Fi(null,0,0),oc=[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 zv(y){for(let r of y)T.fill(r,-1);return y[Dn][Zr]=0,y[ma][Zr]=0,y[ma][Dn]=28,y[zd][Zr]=0,y[Sr][Zr]=0,y[Sr][Dn]=15,y}const Hd=zv(T.createInt32Array(6,6));class Qr{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 u=oc[this.mode][r];a=$s(a,u&65535,u>>16),s+=u>>16}let l=r===Sr?4:5;return a=$s(a,i,l),new Qr(a,r,0,s+l)}shiftAndAppend(r,i){let s=this.token,a=this.mode===Sr?4:5;return s=$s(s,Hd[this.mode][r],a),s=$s(s,i,5),new Qr(s,this.mode,0,this.bitCount+a+5)}addBinaryShiftChar(r){let i=this.token,s=this.mode,a=this.bitCount;if(this.mode===Zr||this.mode===Sr){let d=oc[s][Dn];i=$s(i,d&65535,d>>16),a+=d>>16,s=Dn}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,u=new Qr(i,s,this.binaryShiftByteCount+1,a+l);return u.binaryShiftByteCount===2078&&(u=u.endBinaryShift(r+1)),u}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let i=this.token;return i=Wv(i,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Qr(i,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let i=this.bitCount+(oc[this.mode][r.mode]>>16);return this.binaryShiftByteCount<r.binaryShiftByteCount?i+=Qr.calculateBinaryShiftCost(r)-Qr.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 U;for(const a of i)a.appendTo(s,r);return s}toString(){return se.format("%s bits=%d bytes=%d",$v[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Qr.INITIAL_STATE=new Qr(Vv,Dn,0,0);function Hv(y){const r=se.getCharCode(" "),i=se.getCharCode("."),s=se.getCharCode(",");y[Dn][r]=1;const a=se.getCharCode("Z"),l=se.getCharCode("A");for(let S=l;S<=a;S++)y[Dn][S]=S-l+2;y[ma][r]=1;const u=se.getCharCode("z"),d=se.getCharCode("a");for(let S=d;S<=u;S++)y[ma][S]=S-d+2;y[Sr][r]=1;const h=se.getCharCode("9"),p=se.getCharCode("0");for(let S=p;S<=h;S++)y[Sr][S]=S-p+2;y[Sr][s]=12,y[Sr][i]=13;const w=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
80
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<w.length;S++)y[zd][se.getCharCode(w[S])]=S;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<E.length;S++)se.getCharCode(E[S])>0&&(y[Zr][se.getCharCode(E[S])]=S);return y}const ac=Hv(T.createInt32Array(5,256));class Vs{constructor(r){this.text=r}encode(){const r=se.getCharCode(" "),i=se.getCharCode(`
|
|
81
|
+
`);let s=Vd.singletonList(Qr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let u,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case se.getCharCode("\r"):u=d===i?2:0;break;case se.getCharCode("."):u=d===r?3:0;break;case se.getCharCode(","):u=d===r?4:0;break;case se.getCharCode(":"):u=d===r?5:0;break;default:u=0}u>0?(s=Vs.updateStateListForPair(s,l,u),l++):s=this.updateStateListForChar(s,l)}return Vd.min(s,(l,u)=>l.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Vs.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=ac[r.getMode()][a]>0,u=null;for(let d=0;d<=Zr;d++){let h=ac[d][a];if(h>0){if(u==null&&(u=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=u.latchAndAppend(d,h);s.push(p)}if(!l&&Hd[r.getMode()][d]>=0){const p=u.shiftAndAppend(d,h);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||ac[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(Zr,s)),r.getMode()!==Zr&&a.push(l.shiftAndAppend(Zr,s)),s===3||s===4){let u=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(u)}if(r.getBinaryShiftByteCount()>0){let u=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(u)}}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(u=>u!==l))}a&&i.push(s)}return i}}class be{constructor(){}static encodeBytes(r){return be.encode(r,be.DEFAULT_EC_PERCENT,be.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Vs(r).encode(),l=_.truncDivision(a.getSize()*i,100)+11,u=a.getSize()+l,d,h,p,w,E;if(s!==be.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?be.MAX_NB_BITS_COMPACT:be.MAX_NB_BITS))throw new A(se.format("Illegal value %s for layers",s));p=be.totalBitsInLayer(h,d),w=be.WORD_SIZE[h];let K=p-p%w;if(E=be.stuffBits(a,w),E.getSize()+l>K)throw new A("Data to large for user specified layer");if(d&&E.getSize()>w*64)throw new A("Data to large for user specified layer")}else{w=0,E=null;for(let K=0;;K++){if(K>be.MAX_NB_BITS)throw new A("Data too large for an Aztec code");if(d=K<=3,h=d?K+1:K,p=be.totalBitsInLayer(h,d),u>p)continue;(E==null||w!==be.WORD_SIZE[h])&&(w=be.WORD_SIZE[h],E=be.stuffBits(a,w));let Ae=p-p%w;if(!(d&&E.getSize()>w*64)&&E.getSize()+l<=Ae)break}}let S=be.generateCheckWords(E,p,w),b=E.getSize()/w,D=be.generateModeMessage(d,h,b),M=(d?11:14)+h*4,L=new Int32Array(M),$;if(d){$=M;for(let K=0;K<L.length;K++)L[K]=K}else{$=M+1+2*_.truncDivision(_.truncDivision(M,2)-1,15);let K=_.truncDivision(M,2),Ae=_.truncDivision($,2);for(let me=0;me<K;me++){let er=me+_.truncDivision(me,15);L[K-me-1]=Ae-er-1,L[K+me]=Ae+er+1}}let Q=new Te($);for(let K=0,Ae=0;K<h;K++){let me=(h-K)*4+(d?9:12);for(let er=0;er<me;er++){let Pr=er*2;for(let tr=0;tr<2;tr++)S.get(Ae+Pr+tr)&&Q.set(L[K*2+tr],L[K*2+er]),S.get(Ae+me*2+Pr+tr)&&Q.set(L[K*2+er],L[M-1-K*2-tr]),S.get(Ae+me*4+Pr+tr)&&Q.set(L[M-1-K*2-tr],L[M-1-K*2-er]),S.get(Ae+me*6+Pr+tr)&&Q.set(L[M-1-K*2-er],L[K*2+tr])}Ae+=me*8}if(be.drawModeMessage(Q,d,$,D),d)be.drawBullsEye(Q,_.truncDivision($,2),5);else{be.drawBullsEye(Q,_.truncDivision($,2),7);for(let K=0,Ae=0;K<_.truncDivision(M,2)-1;K+=15,Ae+=16)for(let me=_.truncDivision($,2)&1;me<$;me+=2)Q.set(_.truncDivision($,2)-Ae,me),Q.set(_.truncDivision($,2)+Ae,me),Q.set(me,_.truncDivision($,2)-Ae),Q.set(me,_.truncDivision($,2)+Ae)}let q=new $d;return q.setCompact(d),q.setSize($),q.setLayers(h),q.setCodeWords(b),q.setMatrix(Q),q}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 U;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=be.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=be.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=_.truncDivision(s,2);if(i)for(let u=0;u<7;u++){let d=l-3+u;a.get(u)&&r.set(d,l-5),a.get(u+7)&&r.set(l+5,d),a.get(20-u)&&r.set(d,l+5),a.get(27-u)&&r.set(l-5,d)}else for(let u=0;u<10;u++){let d=l-5+u+_.truncDivision(u,5);a.get(u)&&r.set(d,l-7),a.get(u+10)&&r.set(l+7,d),a.get(29-u)&&r.set(d,l+7),a.get(39-u)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new rc(be.getGF(s)),u=_.truncDivision(i,s),d=be.bitsToWords(r,s,u);l.encode(d,u-a);let h=i%s,p=new U;p.appendBits(0,h);for(const w of Array.from(d))p.appendBits(w,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,u;for(l=0,u=r.getSize()/i;l<u;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 Oe.AZTEC_PARAM;case 6:return Oe.AZTEC_DATA_6;case 8:return Oe.AZTEC_DATA_8;case 10:return Oe.AZTEC_DATA_10;case 12:return Oe.AZTEC_DATA_12;default:throw new A("Unsupported word size "+r)}}static stuffBits(r,i){let s=new U,a=r.getSize(),l=(1<<i)-2;for(let u=0;u<a;u+=i){let d=0;for(let h=0;h<i;h++)(u+h>=a||r.get(u+h))&&(d|=1<<i-1-h);(d&l)===l?(s.appendBits(d&l,i),u--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),u--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}be.DEFAULT_EC_PERCENT=33,be.DEFAULT_AZTEC_LAYERS=0,be.MAX_NB_BITS=32,be.MAX_NB_BITS_COMPACT=4,be.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 wa{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let u=ic.ISO_8859_1,d=be.DEFAULT_EC_PERCENT,h=be.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(mt.CHARACTER_SET)&&(u=Wd.forName(l.get(mt.CHARACTER_SET).toString())),l.has(mt.ERROR_CORRECTION)&&(d=_.parseInt(l.get(mt.ERROR_CORRECTION).toString())),l.has(mt.AZTEC_LAYERS)&&(h=_.parseInt(l.get(mt.AZTEC_LAYERS).toString()))),wa.encodeLayers(r,i,s,a,u,d,h)}static encodeLayers(r,i,s,a,l,u,d){if(i!==le.AZTEC)throw new A("Can only encode AZTEC, but got "+i);let h=be.encode(se.getBytes(r,l),u,d);return wa.renderResult(h,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Hr;let l=a.getWidth(),u=a.getHeight(),d=Math.max(i,l),h=Math.max(s,u),p=Math.min(d/l,h/u),w=(d-l*p)/2,E=(h-u*p)/2,S=new Te(d,h);for(let b=0,D=E;b<u;b++,D+=p)for(let M=0,L=w;M<l;M++,L+=p)a.get(M,b)&&S.setRegion(L,D,p,p);return S}}n.AbstractExpandedDecoder=Gu,n.ArgumentException=C,n.ArithmeticException=oa,n.AztecCode=$d,n.AztecCodeReader=ua,n.AztecCodeWriter=wa,n.AztecDecoder=Ue,n.AztecDetector=bd,n.AztecDetectorResult=Td,n.AztecEncoder=be,n.AztecHighLevelEncoder=Vs,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=I,n.BitArray=U,n.BitMatrix=Te,n.BitSource=Zu,n.BrowserAztecCodeReader=mv,n.BrowserBarcodeReader=Cv,n.BrowserCodeReader=yr,n.BrowserDatamatrixCodeReader=Sv,n.BrowserMultiFormatReader=kv,n.BrowserPDF417Reader=Bv,n.BrowserQRCodeReader=Lv,n.BrowserQRCodeSvgWriter=ui,n.CharacterSetECI=V,n.ChecksumException=O,n.Code128Reader=J,n.Code39Reader=pt,n.DataMatrixDecodedBitStreamParser=bn,n.DataMatrixReader=_n,n.DecodeHintType=j,n.DecoderResult=Ds,n.DefaultGridSampler=Rd,n.DetectorResult=la,n.EAN13Reader=ii,n.EncodeHintType=mt,n.Exception=x,n.FormatException=B,n.GenericGF=Oe,n.GenericGFPoly=Zt,n.GlobalHistogramBinarizer=tt,n.GridSampler=$u,n.GridSamplerInstance=Tn,n.HTMLCanvasElementLuminanceSource=pe,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=A,n.IllegalStateException=Hr,n.InvertedLuminanceSource=de,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ki,n.MultiFormatReader=jd,n.MultiFormatWriter=Uv,n.NotFoundException=H,n.OneDReader=dt,n.PDF417DecodedBitStreamParser=W,n.PDF417DecoderErrorCorrection=Md,n.PDF417Reader=_t,n.PDF417ResultMetadata=Bd,n.PerspectiveTransform=Nr,n.PlanarYUVLuminanceSource=Kr,n.QRCodeByteMatrix=xa,n.QRCodeDataMask=Cr,n.QRCodeDecodedBitStreamParser=Ze,n.QRCodeDecoderErrorCorrectionLevel=je,n.QRCodeDecoderFormatInformation=Ft,n.QRCodeEncoder=$e,n.QRCodeEncoderQRCode=li,n.QRCodeMaskUtil=it,n.QRCodeMatrixUtil=fe,n.QRCodeMode=ce,n.QRCodeReader=On,n.QRCodeVersion=ue,n.QRCodeWriter=Li,n.RGBLuminanceSource=nc,n.RSS14Reader=nt,n.RSSExpandedReader=Y,n.ReaderException=pa,n.ReedSolomonDecoder=Ms,n.ReedSolomonEncoder=rc,n.ReedSolomonException=Ni,n.Result=Ke,n.ResultMetadataType=Ct,n.ResultPoint=ae,n.StringUtils=se,n.UnsupportedOperationException=oe,n.VideoInputDevice=He,n.WhiteRectangleDetector=an,n.WriterException=Le,n.ZXingArrays=T,n.ZXingCharset=Wd,n.ZXingInteger=_,n.ZXingStandardCharsets=ic,n.ZXingStringBuilder=ge,n.ZXingStringEncoding=ye,n.ZXingSystem=P,n.createAbstractExpandedDecoder=Dd,Object.defineProperty(n,"__esModule",{value:!0})})})(k1,k1.exports);var Qe=k1.exports;const F_=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var $p=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(),!F_)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),f=new Map;f.set(Qe.DecodeHintType.POSSIBLE_FORMATS,c),f.set(Qe.DecodeHintType.TRY_HARDER,!1),this.hints=f}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(f){c(f)}})},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)),f=n.decode(c);return{text:f.text,format:dv.create(this.toHtml5QrcodeSupportedFormats(f.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 f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),U_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},j_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Vp=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 U_(this,void 0,void 0,function(){var n,o;return j_(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:dv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,f=t;c<f.length;c++){var g=f[c],m=g.boundingBox.width*g.boundingBox.height;m>o&&(o=m,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 f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.warn("".concat(f," 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}(),zp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Hp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},W_=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&&Vp.isSupported()?(this.primaryDecoder=new Vp(t,o,c),this.secondaryDecoder=new $p(t,o,c)):this.primaryDecoder=new $p(t,o,c)}return e.prototype.decodeAsync=function(t){return zp(this,void 0,void 0,function(){var n;return Hp(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 zp(this,void 0,void 0,function(){var n,o;return Hp(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 f=t/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),Sd=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},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)}}(),nu=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},iu=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gv=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}(),$_=function(e){Sd(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}(gv),V_=function(e){Sd(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}($_),z_=function(e){Sd(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(gv),H_=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new V_(this.track)},e.prototype.torchFeature=function(){return new z_(this.track)},e}(),G_=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 nu(this,void 0,void 0,function(){var f,g;return iu(this,function(m){switch(m.label){case 0:return f=new e(t,n,c),o.aspectRatio?(g={aspectRatio:o.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(g)]):[3,2];case 1:m.sent(),m.label=2;case 2:return f.setupSurface(),[2,f]}})})},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 nu(this,void 0,void 0,function(){return iu(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(),f=c.length,g=0;t.mediaStream.getVideoTracks().forEach(function(m){t.mediaStream.removeTrack(m),m.stop(),++g,g>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new H_(this.getFirstTrackOrFail())},e}(),X_=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return nu(this,void 0,void 0,function(){return iu(this,function(c){return[2,G_.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return nu(this,void 0,void 0,function(){var n,o;return iu(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}(),Gp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Xp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Y_=function(){function e(){}return e.failIfNotSupported=function(){return Gp(this,void 0,void 0,function(){return Xp(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return Gp(this,void 0,void 0,function(){return Xp(this,function(n){return[2,X_.create(t)]})})},e}(),K_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Z_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Q_=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=ss.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=ss.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 K_(this,void 0,void 0,function(){var t,n,o,c,f,g,m;return Z_(this,function(v){switch(v.label){case 0:return t=function(x){for(var C=x.getVideoTracks(),A=0,I=C;A<I.length;A++){var O=I[A];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=v.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=v.sent(),c=[],f=0,g=o;f<g.length;f++)m=g[f],m.kind==="videoinput"&&c.push({id:m.deviceId,label:m.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(f){for(var g=[],m=0,v=f;m<v.length;m++){var x=v[m];x.kind==="video"&&g.push({id:x.id,label:x.label})}t(g)},c=MediaStreamTrack;c.getSources(o)})},e}(),st;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(st||(st={}));var q_=function(){function e(){this.state=st.NOT_STARTED,this.onGoingTransactionNewState=st.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===st.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=st.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=st.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==st.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case st.UNKNOWN:throw"Transition from unknown is not allowed";case st.NOT_STARTED:this.failIfNewStateIs(t,[st.PAUSED]);break;case st.SCANNING:break;case st.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var f=c[o];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),J_=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()===st.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==st.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===st.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===st.PAUSED},e}(),eO=function(){function e(){}return e.create=function(){return new J_(new q_)},e}(),tO=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},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)}}(),fr=function(e){tO(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}(k_),rO=function(){function e(t,n){this.logger=n,this.fps=fr.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=fr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?hv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!ln(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),bO=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 L_(this.verbose),this.qrcode=new W_(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=eO.create()}return e.prototype.start=function(t,n,o,c){var f=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 m=rO.create(n,this.logger);this.clearElement();var v=!1;m.videoConstraints&&(m.isMediaStreamConstraintsValid()?v=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=v,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:fr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var A=this,I=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(O,k){var P=x?m.videoConstraints:A.createVideoConstraints(t);if(!P){I.cancel(),k("videoConstraints should be defined");return}var G={};(!x||m.aspectRatio)&&(G.aspectRatio=m.aspectRatio);var N={onRenderSurfaceReady:function(T,_){A.setupUi(T,_,m),A.isScanning=!0,A.foreverScan(m,o,g)}};Y_.failIfNotSupported().then(function(T){T.create(P).then(function(_){return _.render(f.element,G,N).then(function(U){A.renderedCamera=U,I.execute(),O(null)}).catch(function(U){I.cancel(),k(U)})}).catch(function(_){I.cancel(),k(ss.errorGettingUserMedia(_))})}).catch(function(T){I.cancel(),k(ss.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(ln(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(st.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(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var f=document.getElementById(fr.SHADED_REGION_ELEMENT_ID);f&&t.element.removeChild(f)}},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(ln(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var g=new Image;g.onload=function(){var m=g.width,v=g.height,x=document.getElementById(o.elementId),C=x.clientWidth?x.clientWidth:fr.DEFAULT_WIDTH,A=Math.max(x.clientHeight?x.clientHeight:v,fr.FILE_SCAN_MIN_HEIGHT),I=o.computeCanvasDrawConfig(m,v,C,A);if(n){var O=o.createCanvasElement(C,A,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var k=O.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=A,k.drawImage(g,0,0,m,v,I.x,I.y,I.width,I.height)}var P=fr.FILE_SCAN_HIDDEN_CANVAS_PADDING,G=Math.max(g.width,I.width),N=Math.max(g.height,I.height),T=G+2*P,_=N+2*P,U=o.createCanvasElement(T,_);x.appendChild(U);var z=U.getContext("2d");if(!z)throw"Unable to get 2d context from canvas";z.canvas.width=T,z.canvas.height=_,z.drawImage(g,0,0,m,v,P,P,G,N);try{o.qrcode.decodeRobustlyAsync(U).then(function(j){c(Wp.createFromQrcodeResult(j))}).catch(f)}catch(j){f("QR code parse error, error = ".concat(j))}},g.onerror=f,g.onabort=f,g.onstalled=f,g.onsuspend=f,g.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Q_.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(!hv.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,f=t.formatsToSupport;c<f.length;c++){var g=f[c];M_(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(ln(t))return!0;if(!ln(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(ln(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return ln(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,f=o.qrbox;this.validateQrboxConfig(f);var g=this.toQrdimensions(t,n,f),m=function(x){if(x<fr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(fr.MIN_QR_BOX_SIZE,"px.")},v=function(x){return x>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."),x=t),x};m(g.width),m(g.height),g.width=v(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=ln(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,n,c);f.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()&&f.height<=n,m={x:0,y:0,width:t,height:n},v=g?this.getShadedRegionBounds(t,n,f):m,x=this.createCanvasElement(v.width,v.height),C={willReadFrequently:!0},A=x.getContext("2d",C);A.canvas.width=v.width,A.canvas.height=v.height,this.element.append(x),g&&this.possiblyInsertShadingElement(this.element,t,n,f),this.createScannerPausedUiElement(this.element),this.qrRegion=v,this.context=A,this.canvasElement=x},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=ss.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,Wp.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var f=ss.codeParseError(c);return n(f,B_.createFrom(f)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),g=f.videoWidth/f.clientWidth,m=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var v=this.qrRegion.width*g,x=this.qrRegion.height*m,C=this.qrRegion.x*g,A=this.qrRegion.y*m;this.context.drawImage(f,C,A,v,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(O){!O&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){I()})):I()}).catch(function(O){c.logger.logError("Error happend while scanning context",O),I()})}},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},f="exact",g=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},m=Object.keys(t);if(m.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(m.length," keys");var v=Object.keys(t)[0];if(v!==n&&v!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(v===n){var x=t.facingMode;if(typeof x=="string"){if(g(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(g(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var A=t.deviceId;if(typeof A=="string")return{deviceId:A};if(typeof A=="object"){if(f in A)return{deviceId:{exact:A["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof A;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var f=(o-t)/2,g=(c-n)/2;return{x:f,y:g,width:t,height:n}}else{var m=t,v=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(m,"X").concat(v)+" 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?fr.BORDER_SHADER_MATCH_COLOR:fr.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,f=n,g=document.createElement("canvas");return g.style.width="".concat(c,"px"),g.style.height="".concat(f,"px"),g.style.display="none",g.id=ln(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 f=document.createElement("div");f.style.position="absolute";var g=(n-c.width)/2,m=(o-c.height)/2;if(f.style.borderLeft="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(fr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var v=5,x=40;this.insertShaderBorders(f,x,v,-v,null,0,!0),this.insertShaderBorders(f,x,v,-v,null,0,!1),this.insertShaderBorders(f,x,v,null,-v,0,!0),this.insertShaderBorders(f,x,v,null,-v,0,!1),this.insertShaderBorders(f,v,x+v,-v,null,-v,!0),this.insertShaderBorders(f,v,x+v,null,-v,-v,!0),this.insertShaderBorders(f,v,x+v,-v,null,-v,!1),this.insertShaderBorders(f,v,x+v,null,-v,-v,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,n,o,c,f,g,m){var v=document.createElement("div");v.style.position="absolute",v.style.backgroundColor=fr.BORDER_SHADER_DEFAULT_COLOR,v.style.width="".concat(n,"px"),v.style.height="".concat(o,"px"),c!==null&&(v.style.top="".concat(c,"px")),f!==null&&(v.style.bottom="".concat(f,"px")),m?v.style.left="".concat(g,"px"):v.style.right="".concat(g,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(v),t.appendChild(v)},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}(),Yp;(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"})(Yp||(Yp={}));var B1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(B1||(B1={}));var L1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(L1||(L1={}));var F1;(function(e){e[e.ALL=17]="ALL"})(F1||(F1={}));const nO=Object.assign(Object.assign({},re),F1);var Kp;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(Kp||(Kp={}));const iO=[{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 sO(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 oO=sa("CapacitorBarcodeScanner",{web:()=>(sO(iO),Cl(()=>import("./web-BVftZoWS.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class aO{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||B1.BACK,t.scanOrientation=t.scanOrientation||L1.ADAPTIVE,oO.scanBarcode(t)}}const yf=sa("SecureStoragePlugin",{web:()=>Cl(()=>import("./web-tEd182N3.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function lO(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 f=qn.parse(c.origin);if(!f)throw new Error;return{endpoint:f,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=qn.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class uO{ready(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await yf.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 yf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await yf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function cO(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await aO.scanBarcode({hint:nO.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class fO{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,f={})=>{const g=this.session,m=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),v=new Headers(f.headers??(c instanceof Request?c.headers:void 0));g&&m.origin===g.origin&&v.set("authorization",`Bearer ${g.token}`);const x=await this.transport(c,{...f,headers:v,credentials:"omit",redirect:"error"});if(g&&this.session===g&&m.origin===g.origin&&(x.status===401||x.status===423)){this.session=null;try{await this.storage.remove(g.origin)}finally{this.onRevoked()}}return x}}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}=lO(t),c=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:AbortSignal.timeout(1e4)});if(!c.ok)throw new Error(c.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":c.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。");const f=await c.json();if(typeof f.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(f.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,f.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${f.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:f.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()}}}}var su;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(su||(su={}));var Zp;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(Zp||(Zp={}));const Ef=sa("StatusBar");function dO(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const f=parseInt(t[1].slice(c,c+2),16)/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?su.Light:su.Dark}}function hO(){if(Ts.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Nl.getState().skin;let t=!1,n=Ef.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const g=dO(getComputedStyle(e).getPropertyValue("--bg-deepest"));g&&(n=n.then(async()=>{t||(await Ef.setBackgroundColor({color:g.color}),await Ef.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 f=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",f),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",f),window.removeEventListener("focus",o)}}const gO="/service-worker.js";function pO(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function xO(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 f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}async function Qp(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(gO),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:xO(t)});await e.post("/api/push/subscribe",c.toJSON())}function mO(e){pO()&&(async()=>{try{if(Notification.permission==="granted"){await Qp(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await Qp(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Cf 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 qp=10,wO=13,ci=32;function Af(e){}function vO(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=Af,onError:n=Af,onRetry:o=Af,onComment:c,maxBufferSize:f}=e,g=[];let m=0,v=!0,x,C="",A=0,I,O=!1;function k(z){if(O)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(v&&(v=!1,z.charCodeAt(0)===239&&z.charCodeAt(1)===187&&z.charCodeAt(2)===191&&(z=z.slice(3))),g.length===0){const X=G(z);X!==""&&(g.push(X),m=X.length),P();return}if(z.indexOf(`
|
|
82
|
+
`)===-1&&z.indexOf("\r")===-1){g.push(z),m+=z.length,P();return}g.push(z);const j=g.join("");g.length=0,m=0;const B=G(j);B!==""&&(g.push(B),m=B.length),P()}function P(){f!==void 0&&(m+C.length<=f||(O=!0,g.length=0,m=0,x=void 0,C="",A=0,I=void 0,n(new Cf(`Buffered data exceeded max buffer size of ${f} characters`,{type:"max-buffer-size-exceeded"}))))}function G(z){let j=0;if(z.indexOf("\r")===-1){let B=z.indexOf(`
|
|
83
83
|
`,j);for(;B!==-1;){if(j===B){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0,j=B+1,B=z.indexOf(`
|
|
84
84
|
`,j);continue}const X=z.charCodeAt(j);if(Jp(z,j,X)){const V=z.charCodeAt(j+5)===ci?j+6:j+5,oe=z.slice(V,B);if(A===0&&z.charCodeAt(B+1)===qp){t({id:x,event:I,data:oe}),x=void 0,C="",I=void 0,j=B+2,B=z.indexOf(`
|
|
85
85
|
`,j);continue}C=A===0?oe:`${C}
|
|
@@ -87,4 +87,4 @@ ${oe}`,A++}else e2(z,j,X)?I=z.slice(z.charCodeAt(j+6)===ci?j+7:j+6,B)||void 0:N(
|
|
|
87
87
|
`,j)}return z.slice(j)}for(;j<z.length;){const B=z.indexOf("\r",j),X=z.indexOf(`
|
|
88
88
|
`,j);let V=-1;if(B!==-1&&X!==-1?V=B<X?B:X:B!==-1?B===z.length-1?V=-1:V=B:X!==-1&&(V=X),V===-1)break;N(z,j,V),j=V+1,z.charCodeAt(j-1)===wO&&z.charCodeAt(j)===qp&&j++}return z.slice(j)}function N(z,j,B){if(j===B){_();return}const X=z.charCodeAt(j);if(Jp(z,j,X)){const Te=z.charCodeAt(j+5)===ci?j+6:j+5,H=z.slice(Te,B);C=A===0?H:`${C}
|
|
89
89
|
${H}`,A++;return}if(e2(z,j,X)){I=z.slice(z.charCodeAt(j+6)===ci?j+7:j+6,B)||void 0;return}if(X===105&&z.charCodeAt(j+1)===100&&z.charCodeAt(j+2)===58){const Te=z.slice(z.charCodeAt(j+3)===ci?j+4:j+3,B);Te.includes("\0")||(x=Te);return}if(X===58){if(c){const Te=z.slice(j,B);c(Te.slice(z.charCodeAt(j+1)===ci?2:1))}return}const V=z.slice(j,B),oe=V.indexOf(":");if(oe===-1){T(V,"",V);return}const ye=V.slice(0,oe),se=V.charCodeAt(oe+1)===ci?2:1,ge=V.slice(oe+se);T(ye,ge,V)}function T(z,j,B){switch(z){case"event":I=j||void 0;break;case"data":C=A===0?j:`${C}
|
|
90
|
-
${j}`,A++;break;case"id":j.includes("\0")||(x=j);break;case"retry":/^\d+$/.test(j)?o(parseInt(j,10)):n(new Ef(`Invalid \`retry\` value: "${j}"`,{type:"invalid-retry",value:j,line:B}));break;default:n(new Ef(`Unknown field "${z.length>20?`${z.slice(0,20)}…`:z}"`,{type:"unknown-field",field:z,value:j,line:B}));break}}function _(){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0}function U(z={}){if(z.consume&&g.length>0){const j=g.join("");N(j,0,j.length)}v=!0,x=void 0,C="",A=0,I=void 0,g.length=0,m=0,O=!1}return{feed:k,reset:U}}function Jp(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 t2 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(r2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(r2(this),n)}}function yO(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function F1(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(F1).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${F1(e.cause)}`:e.message:`${e}`}function r2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var pv=e=>{throw TypeError(e)},Id=(e,t,n)=>t.has(e)||pv("Cannot "+n),Ee=(e,t,n)=>(Id(e,t,"read from private field"),n?n.call(e):t.get(e)),wt=(e,t,n)=>t.has(e)?pv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xe=(e,t,n,o)=>(Id(e,t,"write to private field"),t.set(e,n),n),un=(e,t,n)=>(Id(e,t,"access private method"),n),rr,hi,Vi,yl,su,Io,os,To,Fn,zi,gs,Hi,fo,kr,U1,j1,W1,n2,$1,V1,ho,z1,H1;let El=class extends EventTarget{constructor(t,n){var o,c;super(),wt(this,kr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,wt(this,rr),wt(this,hi),wt(this,Vi),wt(this,yl),wt(this,su),wt(this,Io),wt(this,os),wt(this,To,null),wt(this,Fn),wt(this,zi),wt(this,gs,null),wt(this,Hi,null),wt(this,fo,null),wt(this,j1,async f=>{var g;Ee(this,zi).reset();const{body:m,redirected:v,status:x,headers:C}=f;if(x===204){un(this,kr,ho).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(v?Xe(this,Vi,new URL(f.url)):Xe(this,Vi,void 0),x!==200){un(this,kr,ho).call(this,`Non-200 status code (${x})`,x);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){un(this,kr,ho).call(this,'Invalid content type, expected "text/event-stream"',x);return}if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.OPEN);const A=new Event("open");if((g=Ee(this,fo))==null||g.call(this,A),this.dispatchEvent(A),typeof m!="object"||!m||!("getReader"in m)){un(this,kr,ho).call(this,"Invalid response body, expected a web ReadableStream",x),this.close();return}const I=new TextDecoder,O=m.getReader();let k=!0;do{const{done:M,value:G}=await O.read();G&&Ee(this,zi).feed(I.decode(G,{stream:!M})),M&&(k=!1,Ee(this,zi).reset(),un(this,kr,z1).call(this))}while(k)}),wt(this,W1,f=>{Xe(this,Fn,void 0),!(f.name==="AbortError"||f.type==="aborted")&&un(this,kr,z1).call(this,F1(f))}),wt(this,$1,f=>{typeof f.id=="string"&&Xe(this,To,f.id);const g=new MessageEvent(f.event||"message",{data:f.data,origin:Ee(this,Vi)?Ee(this,Vi).origin:Ee(this,hi).origin,lastEventId:f.id||""});Ee(this,Hi)&&(!f.event||f.event==="message")&&Ee(this,Hi).call(this,g),this.dispatchEvent(g)}),wt(this,V1,f=>{Xe(this,Io,f)}),wt(this,H1,()=>{Xe(this,os,void 0),Ee(this,rr)===this.CONNECTING&&un(this,kr,U1).call(this)});try{if(t instanceof URL)Xe(this,hi,t);else if(typeof t=="string")Xe(this,hi,new URL(t,EO()));else throw new Error("Invalid URL")}catch{throw yO("An invalid or illegal string was specified")}Xe(this,zi,vO({onEvent:Ee(this,$1),onRetry:Ee(this,V1)})),Xe(this,rr,this.CONNECTING),Xe(this,Io,3e3),Xe(this,su,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Xe(this,yl,(c=n==null?void 0:n.withCredentials)!=null?c:!1),un(this,kr,U1).call(this)}get readyState(){return Ee(this,rr)}get url(){return Ee(this,hi).href}get withCredentials(){return Ee(this,yl)}get onerror(){return Ee(this,gs)}set onerror(t){Xe(this,gs,t)}get onmessage(){return Ee(this,Hi)}set onmessage(t){Xe(this,Hi,t)}get onopen(){return Ee(this,fo)}set onopen(t){Xe(this,fo,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(){Ee(this,os)&&clearTimeout(Ee(this,os)),Ee(this,rr)!==this.CLOSED&&(Ee(this,Fn)&&Ee(this,Fn).abort(),Xe(this,rr,this.CLOSED),Xe(this,Fn,void 0))}};rr=new WeakMap,hi=new WeakMap,Vi=new WeakMap,yl=new WeakMap,su=new WeakMap,Io=new WeakMap,os=new WeakMap,To=new WeakMap,Fn=new WeakMap,zi=new WeakMap,gs=new WeakMap,Hi=new WeakMap,fo=new WeakMap,kr=new WeakSet,U1=function(){Xe(this,rr,this.CONNECTING),Xe(this,Fn,new AbortController),Ee(this,su)(Ee(this,hi),un(this,kr,n2).call(this)).then(Ee(this,j1)).catch(Ee(this,W1))},j1=new WeakMap,W1=new WeakMap,n2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ee(this,To)?{"Last-Event-ID":Ee(this,To)}:void 0},cache:"no-store",signal:(e=Ee(this,Fn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},$1=new WeakMap,V1=new WeakMap,ho=function(e,t){var n;Ee(this,rr)!==this.CLOSED&&Xe(this,rr,this.CLOSED);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o)},z1=function(e,t){var n;if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.CONNECTING);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o),Xe(this,os,setTimeout(Ee(this,H1),Ee(this,Io)))},H1=new WeakMap,El.CONNECTING=0,El.OPEN=1,El.CLOSED=2;function EO(){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}j6();Gb();Zb();Jb();r_();Bb({baseUrl:()=>ou,source:"webapp"});document.body.dataset.webShell="1";const ju=new y_;ju.isNativeApp()&&(document.body.dataset.nativeApp="1");hO();if(!ju.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=Sg.find(o=>o.id===Ol.getState().skin)??Sg[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(),Ol.subscribe(e)}const Mt=ju.isNativeApp()?new fO(new uO):null,G1=new Db(Mt==null?void 0:Mt.fetch),CO=window.parent===window?void 0:new u_,AO=window.parent===window?void 0:new w_;let ou="";const i2=new $b(G1,new Vb,CO,e=>Mt?new El(ou+e,{fetch:Mt.fetch}):new EventSource(ou+e));window.browserLiveApi=AO;const xv=document.getElementById("root");if(!xv)throw new Error("#root missing");const X1=cv(xv);function SO(){return ht.useEffect(()=>{i_()},[]),null}(async()=>{Mt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new v_(ju,new Bp,new C_(Mt?async(n,o)=>{const c=qn.parse(String(n));return c&&await Mt.resume(c),Mt.fetch(n,o)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){X1.render(ee.jsx(S_,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Mt?async()=>{const n=await cO();if(!n)return null;const o=await Mt.pair(n);return new Bp().save(o),o}:void 0,onConnected:n=>void s2(n)}));return}await s2(t.mode==="ready"?t.endpoint:null)})();async function s2(e){try{e&&(await(Mt==null?void 0:Mt.resume(e)),G1.setBaseUrl(e.url),ou=e.url),window.agentApi=i2,await i2.refreshServerModel(),!Mt&&window.parent===window&&mO(G1);const{default:t}=await Y1(async()=>{const{default:n}=await import("./App-Bnv7-jUZ.js").then(o=>o.A);return{default:n}},__vite__mapDeps([0,1]),import.meta.url);X1.render(ee.jsxs(ht.StrictMode,{children:[ee.jsx(W6.Provider,{value:ee.jsx(_b,{}),children:ee.jsx(t,{})}),ee.jsx(SO,{})]})),Mt&&setInterval(()=>{Mt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),IO())}catch(t){X1.render(ee.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:ee.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[ee.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),ee.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),ee.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 IO(){const e=[...document.scripts].map(n=>n.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{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&&location.reload()}catch{}},6e4)}export{W6 as B,B1 as C,bO as H,RO as L,e_ as O,fy as R,Sg as S,fv as W,Y1 as _,nO as a,uv as b,dn as c,gT as d,TO as e,o2 as g,ET as i,ee as j,ht as r,Ol as u};
|
|
90
|
+
${j}`,A++;break;case"id":j.includes("\0")||(x=j);break;case"retry":/^\d+$/.test(j)?o(parseInt(j,10)):n(new Cf(`Invalid \`retry\` value: "${j}"`,{type:"invalid-retry",value:j,line:B}));break;default:n(new Cf(`Unknown field "${z.length>20?`${z.slice(0,20)}…`:z}"`,{type:"unknown-field",field:z,value:j,line:B}));break}}function _(){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0}function U(z={}){if(z.consume&&g.length>0){const j=g.join("");N(j,0,j.length)}v=!0,x=void 0,C="",A=0,I=void 0,g.length=0,m=0,O=!1}return{feed:k,reset:U}}function Jp(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 t2 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(r2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(r2(this),n)}}function yO(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function U1(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(U1).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${U1(e.cause)}`:e.message:`${e}`}function r2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var pv=e=>{throw TypeError(e)},Id=(e,t,n)=>t.has(e)||pv("Cannot "+n),Ee=(e,t,n)=>(Id(e,t,"read from private field"),n?n.call(e):t.get(e)),wt=(e,t,n)=>t.has(e)?pv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xe=(e,t,n,o)=>(Id(e,t,"write to private field"),t.set(e,n),n),un=(e,t,n)=>(Id(e,t,"access private method"),n),rr,hi,Vi,yl,ou,Io,os,To,Fn,zi,gs,Hi,fo,kr,j1,W1,$1,n2,V1,z1,ho,H1,G1;let El=class extends EventTarget{constructor(t,n){var o,c;super(),wt(this,kr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,wt(this,rr),wt(this,hi),wt(this,Vi),wt(this,yl),wt(this,ou),wt(this,Io),wt(this,os),wt(this,To,null),wt(this,Fn),wt(this,zi),wt(this,gs,null),wt(this,Hi,null),wt(this,fo,null),wt(this,W1,async f=>{var g;Ee(this,zi).reset();const{body:m,redirected:v,status:x,headers:C}=f;if(x===204){un(this,kr,ho).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(v?Xe(this,Vi,new URL(f.url)):Xe(this,Vi,void 0),x!==200){un(this,kr,ho).call(this,`Non-200 status code (${x})`,x);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){un(this,kr,ho).call(this,'Invalid content type, expected "text/event-stream"',x);return}if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.OPEN);const A=new Event("open");if((g=Ee(this,fo))==null||g.call(this,A),this.dispatchEvent(A),typeof m!="object"||!m||!("getReader"in m)){un(this,kr,ho).call(this,"Invalid response body, expected a web ReadableStream",x),this.close();return}const I=new TextDecoder,O=m.getReader();let k=!0;do{const{done:P,value:G}=await O.read();G&&Ee(this,zi).feed(I.decode(G,{stream:!P})),P&&(k=!1,Ee(this,zi).reset(),un(this,kr,H1).call(this))}while(k)}),wt(this,$1,f=>{Xe(this,Fn,void 0),!(f.name==="AbortError"||f.type==="aborted")&&un(this,kr,H1).call(this,U1(f))}),wt(this,V1,f=>{typeof f.id=="string"&&Xe(this,To,f.id);const g=new MessageEvent(f.event||"message",{data:f.data,origin:Ee(this,Vi)?Ee(this,Vi).origin:Ee(this,hi).origin,lastEventId:f.id||""});Ee(this,Hi)&&(!f.event||f.event==="message")&&Ee(this,Hi).call(this,g),this.dispatchEvent(g)}),wt(this,z1,f=>{Xe(this,Io,f)}),wt(this,G1,()=>{Xe(this,os,void 0),Ee(this,rr)===this.CONNECTING&&un(this,kr,j1).call(this)});try{if(t instanceof URL)Xe(this,hi,t);else if(typeof t=="string")Xe(this,hi,new URL(t,EO()));else throw new Error("Invalid URL")}catch{throw yO("An invalid or illegal string was specified")}Xe(this,zi,vO({onEvent:Ee(this,V1),onRetry:Ee(this,z1)})),Xe(this,rr,this.CONNECTING),Xe(this,Io,3e3),Xe(this,ou,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Xe(this,yl,(c=n==null?void 0:n.withCredentials)!=null?c:!1),un(this,kr,j1).call(this)}get readyState(){return Ee(this,rr)}get url(){return Ee(this,hi).href}get withCredentials(){return Ee(this,yl)}get onerror(){return Ee(this,gs)}set onerror(t){Xe(this,gs,t)}get onmessage(){return Ee(this,Hi)}set onmessage(t){Xe(this,Hi,t)}get onopen(){return Ee(this,fo)}set onopen(t){Xe(this,fo,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(){Ee(this,os)&&clearTimeout(Ee(this,os)),Ee(this,rr)!==this.CLOSED&&(Ee(this,Fn)&&Ee(this,Fn).abort(),Xe(this,rr,this.CLOSED),Xe(this,Fn,void 0))}};rr=new WeakMap,hi=new WeakMap,Vi=new WeakMap,yl=new WeakMap,ou=new WeakMap,Io=new WeakMap,os=new WeakMap,To=new WeakMap,Fn=new WeakMap,zi=new WeakMap,gs=new WeakMap,Hi=new WeakMap,fo=new WeakMap,kr=new WeakSet,j1=function(){Xe(this,rr,this.CONNECTING),Xe(this,Fn,new AbortController),Ee(this,ou)(Ee(this,hi),un(this,kr,n2).call(this)).then(Ee(this,W1)).catch(Ee(this,$1))},W1=new WeakMap,$1=new WeakMap,n2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ee(this,To)?{"Last-Event-ID":Ee(this,To)}:void 0},cache:"no-store",signal:(e=Ee(this,Fn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},V1=new WeakMap,z1=new WeakMap,ho=function(e,t){var n;Ee(this,rr)!==this.CLOSED&&Xe(this,rr,this.CLOSED);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o)},H1=function(e,t){var n;if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.CONNECTING);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o),Xe(this,os,setTimeout(Ee(this,G1),Ee(this,Io)))},G1=new WeakMap,El.CONNECTING=0,El.OPEN=1,El.CLOSED=2;function EO(){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}j6();Gb();Zb();Jb();r_();Bb({baseUrl:()=>au,source:"webapp"});document.body.dataset.webShell="1";const Wu=new y_;Wu.isNativeApp()&&(document.body.dataset.nativeApp="1");hO();if(!Wu.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=Sg.find(o=>o.id===Nl.getState().skin)??Sg[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(),Nl.subscribe(e)}const Pt=Wu.isNativeApp()?new fO(new uO):null,X1=new Db(Pt==null?void 0:Pt.fetch),CO=window.parent===window?void 0:new u_,AO=window.parent===window?void 0:new w_;let au="";const i2=new $b(X1,new Vb,CO,e=>Pt?new El(au+e,{fetch:Pt.fetch}):new EventSource(au+e));window.browserLiveApi=AO;const xv=document.getElementById("root");if(!xv)throw new Error("#root missing");const Y1=cv(xv);function SO(){return ht.useEffect(()=>{i_()},[]),null}(async()=>{Pt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new v_(Wu,new Bp,new C_(Pt?async(n,o)=>{const c=qn.parse(String(n));return c&&await Pt.resume(c),Pt.fetch(n,o)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){Y1.render(ee.jsx(S_,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Pt?async()=>{const n=await cO();if(!n)return null;const o=await Pt.pair(n);return new Bp().save(o),o}:void 0,onConnected:n=>void s2(n)}));return}await s2(t.mode==="ready"?t.endpoint:null)})();async function s2(e){try{e&&(await(Pt==null?void 0:Pt.resume(e)),X1.setBaseUrl(e.url),au=e.url),window.agentApi=i2,await i2.refreshServerModel(),!Pt&&window.parent===window&&mO(X1);const{default:t}=new URLSearchParams(location.search).get("view")==="remote-desktop"?await Cl(()=>import("./RemoteDesktopPage-xxhqLNgm.js"),__vite__mapDeps([0,1]),import.meta.url):await Cl(()=>import("./App-CMPASrR3.js").then(n=>n.A),__vite__mapDeps([2,1,3]),import.meta.url);Y1.render(ee.jsxs(ht.StrictMode,{children:[ee.jsx(W6.Provider,{value:ee.jsx(_b,{}),children:ee.jsx(t,{})}),ee.jsx(SO,{})]})),Pt&&setInterval(()=>{Pt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),IO())}catch(t){Y1.render(ee.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:ee.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[ee.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),ee.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),ee.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 IO(){const e=[...document.scripts].map(n=>n.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{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&&location.reload()}catch{}},6e4)}export{W6 as B,L1 as C,bO as H,RO as L,e_ as O,fy as R,Sg as S,fv as W,Cl as _,nO as a,uv as b,dn as c,gT as d,t_ as e,TO as f,o2 as g,ET as i,ee as j,ht as r,Nl as u};
|