agentroam-runtime-darwin-arm64 0.2.0-preview.21 → 0.2.0-preview.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +6 -6
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +3 -3
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/server/app/_not-found/page.js +1 -1
  10. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/runtime/.next/server/app/_not-found.html +1 -1
  12. package/runtime/.next/server/app/_not-found.rsc +1 -1
  13. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  18. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
  22. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  24. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  25. package/runtime/.next/server/app/api/business/route.js +1 -1
  26. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  27. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  28. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  29. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  30. package/runtime/.next/server/app/api/memory/route.js +1 -1
  31. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  32. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  33. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  34. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  35. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  36. package/runtime/.next/server/app/api/projects/route.js +1 -1
  37. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  38. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  39. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  40. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  41. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  42. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  43. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  44. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  45. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  46. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  47. package/runtime/.next/server/app/api/settings/route.js +1 -1
  48. package/runtime/.next/server/app/api/skills/route.js +1 -1
  49. package/runtime/.next/server/app/api/tools/route.js +1 -1
  50. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  51. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  52. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  53. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  54. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  55. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  56. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  57. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  58. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  59. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  60. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  61. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  62. package/runtime/.next/server/app/web/page.js +2 -2
  63. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  64. package/runtime/.next/server/app/web.html +1 -1
  65. package/runtime/.next/server/app/web.rsc +3 -3
  66. package/runtime/.next/server/app-paths-manifest.json +19 -19
  67. package/runtime/.next/server/chunks/1322.js +1 -1
  68. package/runtime/.next/server/chunks/2083.js +1 -1
  69. package/runtime/.next/server/chunks/5303.js +1 -1
  70. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  71. package/runtime/.next/server/pages/404.html +1 -1
  72. package/runtime/.next/server/pages/500.html +1 -1
  73. package/runtime/.next/server/pages-manifest.json +1 -1
  74. package/runtime/.next/server/server-reference-manifest.json +1 -1
  75. package/runtime/.next/static/chunks/app/web/{error-9b5f82c29dc27335.js → error-828d278147a0619d.js} +1 -1
  76. package/runtime/.next/static/chunks/app/web/{page-16895961b998f8df.js → page-93b87fd495171494.js} +1 -1
  77. package/runtime/.next/static/chunks/{main-app-e3fd18ce9c4c0d03.js → main-app-07d67f2d4e96ecb8.js} +1 -1
  78. package/runtime/lib/remote-control/remote-authorization.mjs +65 -12
  79. package/runtime/lib/remote-control/webrtc-video.mjs +12 -3
  80. package/runtime/native/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  81. package/runtime/node_modules/.package-lock.json +84 -84
  82. package/runtime/node_modules/@agent/core/dist/domain/browser-live/BrowserLiveRegistry.d.ts +43 -0
  83. package/runtime/node_modules/@agent/core/dist/domain/browser-live/BrowserLiveRegistry.test.d.ts +2 -0
  84. package/runtime/node_modules/@agent/core/dist/domain/browser-live/entities.d.ts +57 -0
  85. package/runtime/node_modules/@agent/core/dist/domain/live-view/live-view-registry.d.ts.map +1 -1
  86. package/runtime/node_modules/@agent/core/dist/index.js +4 -2
  87. package/runtime/node_modules/@agent/core/dist/index.js.map +3 -3
  88. package/runtime/package-lock.json +189 -189
  89. package/runtime/webapp/dist/assets/App-C0GaUX7E.js +381 -0
  90. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-BNxk5qEZ.js → abnfDiagram-VCTEODGH-DFIVS5-b.js} +1 -1
  91. package/runtime/webapp/dist/assets/{arc-7MQbjMvc.js → arc-BR_jY5YA.js} +1 -1
  92. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-Dhg4Rz1D.js → architectureDiagram-5GKGNRK7-B_RjH8A7.js} +1 -1
  93. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DeJHr92S.js → blockDiagram-I7D4REHJ-BS7yaS6P.js} +1 -1
  94. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-RA8xRbEK.js → c4Diagram-7LVT6UL2-CSFzzphk.js} +1 -1
  95. package/runtime/webapp/dist/assets/channel-D_GjJ9-f.js +1 -0
  96. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-CzoEDy2v.js → chunk-2Q5K7J3B-lxf-31fr.js} +1 -1
  97. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-IasmnKPT.js → chunk-5VM5RSS4-CealgGAH.js} +1 -1
  98. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-ClQmWB2a.js → chunk-F27PBJKO-BVUWtnPQ.js} +1 -1
  99. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BeWBx5Wn.js → chunk-IMKFNOWR-C9CDXZmG.js} +1 -1
  100. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-TcEEZ4Dp.js → chunk-JWPE2WC7-CBIKc-82.js} +1 -1
  101. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-DuWXzzSb.js → chunk-POPQ4Y6H-H46jF2zC.js} +1 -1
  102. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-D2X9Pa1W.js → chunk-SVP7TREG-BWLkgj_W.js} +1 -1
  103. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-D_-XYQ_R.js → chunk-TICWLB2K-D4lbsBHo.js} +1 -1
  104. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-B2mHmyk9.js → chunk-XXDRQBXY-DixiVi8X.js} +1 -1
  105. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BbKxNRrL.js +1 -0
  106. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BbKxNRrL.js +1 -0
  107. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-OmMALi3i.js → cose-bilkent-JH36ORCC-DApgY-7v.js} +1 -1
  108. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BVhxjnGZ.js → cynefin-OW5HDTMX-wPkyEnRo.js} +1 -1
  109. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-8EafeZWa.js → cynefinDiagram-5FMLGOSQ-BL3nX8zr.js} +1 -1
  110. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BlMjveyN.js → dagre-GXQ25YYZ-C-ST5Gq6.js} +1 -1
  111. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-BTgDeYAz.js → diagram-S7CK7UJ4-1Uf0VNoU.js} +1 -1
  112. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-9m-QUpEs.js → diagram-UQ7AKVKN-BqQU5Gdv.js} +1 -1
  113. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-BYWenf8W.js → diagram-VSXAHHWV-C59hTOGw.js} +1 -1
  114. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DQ-PRQyX.js → diagram-VX7I27RA-9Q55OM5Y.js} +1 -1
  115. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-BFCpyvaL.js → diagram-Z3DM3KII-CynlxwLb.js} +1 -1
  116. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-Ds9oV_wz.js → ebnfDiagram-PWID7BFC-Clg7fTnt.js} +1 -1
  117. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-ncaaStop.js → erDiagram-RLTQ6QDP-BRtMTjkq.js} +1 -1
  118. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-wL7U3M2L.js → flowDiagram-HODETNUW-1NtZ9wGO.js} +1 -1
  119. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-CVZIk8qz.js → ganttDiagram-EL5Y4UJY-BqtMVkoY.js} +1 -1
  120. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-CGjtUEFY.js → gitGraphDiagram-WWUBYQGX-D-ugp1Bz.js} +1 -1
  121. package/runtime/webapp/dist/assets/{index-CixxJ3A7.js → index-Cg-anTNr.js} +29 -29
  122. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BqTzY6Bv.js → infoDiagram-27XIBGKW-BbmiUqFV.js} +1 -1
  123. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-9AARy1zU.js → ishikawaDiagram-5VMMS53U-DvsCcWwa.js} +1 -1
  124. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-D3w-levY.js → journeyDiagram-3NMN7TZE-yNHLBbVt.js} +1 -1
  125. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-CNvdBbcg.js → kanban-definition-UXKFOSKX-C17XKWBo.js} +1 -1
  126. package/runtime/webapp/dist/assets/{layout-l0aDluv6.js → layout-Dhqc3tGq.js} +1 -1
  127. package/runtime/webapp/dist/assets/{linear-BlLgYv8s.js → linear-C2_mlhLl.js} +1 -1
  128. package/runtime/webapp/dist/assets/{mermaid.core-UNYsT27K.js → mermaid.core-CjC7QuvE.js} +5 -5
  129. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-BiVsBQL9.js → mindmap-definition-YA3MSWOX-D7AKW2qI.js} +1 -1
  130. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-kr19ZOFB.js → pegDiagram-XKGWAZYB-BAI26fj8.js} +1 -1
  131. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BKWCGLlM.js → pieDiagram-E7YTZNPT-C_4G2czx.js} +1 -1
  132. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-B1oUT2Jo.js → quadrantDiagram-AXDQQJYC-BhOZnXFN.js} +1 -1
  133. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-HSe2vXxQ.js → railroadDiagram-O6MQD6OU-760zGjdr.js} +1 -1
  134. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-Cy8adj_C.js → requirementDiagram-BXWQKSXE-D0-agCrc.js} +1 -1
  135. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-tnBEmP5l.js → sankeyDiagram-P5KCCOFB-CsHjbmcp.js} +1 -1
  136. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-DvOTKmyz.js → sequenceDiagram-WJ2MYXX4-Ccp7FnLK.js} +1 -1
  137. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-Da7A6hqr.js → sizeCapture-INFHLROL-DFCk9Vjd.js} +1 -1
  138. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-BU17k_M-.js → stateDiagram-D77RDMKH-tFA-WlZT.js} +1 -1
  139. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-CA4qjX_b.js +1 -0
  140. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-DZZPRxnW.js → swimlanes-42K2YHIH-Bh-owCha.js} +1 -1
  141. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DrldJDwD.js +8 -0
  142. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-26Xh93Et.js → timeline-definition-24CTP7MA-D5CQ3vgW.js} +1 -1
  143. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-Q4-BkJH1.js → vennDiagram-4TSXK5OY-1m-k4Zip.js} +1 -1
  144. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-DlUP-PlT.js → wardleyDiagram-VM6X3IG4-C5agAk3M.js} +1 -1
  145. package/runtime/webapp/dist/assets/{web-DWyw2SAG.js → web-CzXjoC1h.js} +1 -1
  146. package/runtime/webapp/dist/assets/{web-ueoOhAeL.js → web-DseRebF6.js} +1 -1
  147. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-BQZRjKtR.js → xychartDiagram-S5SC5T6Z-EEKnPDSd.js} +1 -1
  148. package/runtime/webapp/dist/index.html +1 -1
  149. package/runtime/webapp/dist/assets/App-Cso_5v1O.js +0 -381
  150. package/runtime/webapp/dist/assets/channel-AsHr5ZE0.js +0 -1
  151. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BZj1pbnq.js +0 -1
  152. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BZj1pbnq.js +0 -1
  153. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-BROH63Ny.js +0 -1
  154. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-B4lr9wuD.js +0 -8
  155. /package/runtime/.next/static/{6OR2fRy79-A-DrqiN3FNa → ZqeC5NkIDDyPiS-mzOs28}/_buildManifest.js +0 -0
  156. /package/runtime/.next/static/{6OR2fRy79-A-DrqiN3FNa → ZqeC5NkIDDyPiS-mzOs28}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-Cso_5v1O.js","./App-CMOzoP5A.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"]'))l(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&l(p)}).observe(document,{childList:!0,subtree:!0});function i(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 l(c){if(c.ep)return;c.ep=!0;const f=i(c);fetch(c.href,f)}})();const og="modulepreload",ag=function(e,t){return new URL(e,t).href},p1={},qu=function(t,i,l){let c=Promise.resolve();if(i&&i.length>0){const p=document.getElementsByTagName("link"),w=document.querySelector("meta[property=csp-nonce]"),C=(w==null?void 0:w.nonce)||(w==null?void 0:w.getAttribute("nonce"));c=Promise.allSettled(i.map(m=>{if(m=ag(m,l),m in p1)return;p1[m]=!0;const _=m.endsWith(".css"),v=_?'[rel="stylesheet"]':"";if(l)for(let M=p.length-1;M>=0;M--){const P=p[M];if(P.href===m&&(!_||P.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${v}`))return;const R=document.createElement("link");if(R.rel=_?"stylesheet":og,_||(R.as="script"),R.crossOrigin="",R.href=m,C&&R.setAttribute("nonce",C),document.head.appendChild(R),_)return new Promise((M,P)=>{R.addEventListener("load",M),R.addEventListener("error",()=>P(Error(`Unable to preload CSS for ${m}`)))})}))}function f(p){const w=new Event("vite:preloadError",{cancelable:!0});if(w.payload=p,window.dispatchEvent(w),!w.defaultPrevented)throw p}return c.then(p=>{for(const w of p||[])w.status==="rejected"&&f(w.reason);return t().catch(f)})};var ls=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ef={exports:{}},Ia={},tf={exports:{}},Ae={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-C0GaUX7E.js","./App-CMOzoP5A.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"]'))l(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&l(p)}).observe(document,{childList:!0,subtree:!0});function i(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 l(c){if(c.ep)return;c.ep=!0;const f=i(c);fetch(c.href,f)}})();const ag="modulepreload",lg=function(e,t){return new URL(e,t).href},p1={},qu=function(t,i,l){let c=Promise.resolve();if(i&&i.length>0){const p=document.getElementsByTagName("link"),w=document.querySelector("meta[property=csp-nonce]"),C=(w==null?void 0:w.nonce)||(w==null?void 0:w.getAttribute("nonce"));c=Promise.allSettled(i.map(m=>{if(m=lg(m,l),m in p1)return;p1[m]=!0;const _=m.endsWith(".css"),v=_?'[rel="stylesheet"]':"";if(l)for(let M=p.length-1;M>=0;M--){const P=p[M];if(P.href===m&&(!_||P.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${v}`))return;const R=document.createElement("link");if(R.rel=_?"stylesheet":ag,_||(R.as="script"),R.crossOrigin="",R.href=m,C&&R.setAttribute("nonce",C),document.head.appendChild(R),_)return new Promise((M,P)=>{R.addEventListener("load",M),R.addEventListener("error",()=>P(Error(`Unable to preload CSS for ${m}`)))})}))}function f(p){const w=new Event("vite:preloadError",{cancelable:!0});if(w.payload=p,window.dispatchEvent(w),!w.defaultPrevented)throw p}return c.then(p=>{for(const w of p||[])w.status==="rejected"&&f(w.reason);return t().catch(f)})};var ls=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ef={exports:{}},Ia={},tf={exports:{}},Ae={};/**
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-Cso_5v1O.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 Js=Symbol.for("react.element"),lg=Symbol.for("react.portal"),ug=Symbol.for("react.fragment"),cg=Symbol.for("react.strict_mode"),fg=Symbol.for("react.profiler"),dg=Symbol.for("react.provider"),hg=Symbol.for("react.context"),gg=Symbol.for("react.forward_ref"),pg=Symbol.for("react.suspense"),xg=Symbol.for("react.memo"),mg=Symbol.for("react.lazy"),x1=Symbol.iterator;function wg(e){return e===null||typeof e!="object"?null:(e=x1&&e[x1]||e["@@iterator"],typeof e=="function"?e:null)}var nf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rf=Object.assign,sf={};function Yi(e,t,i){this.props=e,this.context=t,this.refs=sf,this.updater=i||nf}Yi.prototype.isReactComponent={};Yi.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")};Yi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function of(){}of.prototype=Yi.prototype;function $u(e,t,i){this.props=e,this.context=t,this.refs=sf,this.updater=i||nf}var Ju=$u.prototype=new of;Ju.constructor=$u;rf(Ju,Yi.prototype);Ju.isPureReactComponent=!0;var m1=Array.isArray,af=Object.prototype.hasOwnProperty,ec={current:null},lf={key:!0,ref:!0,__self:!0,__source:!0};function uf(e,t,i){var l,c={},f=null,p=null;if(t!=null)for(l in t.ref!==void 0&&(p=t.ref),t.key!==void 0&&(f=""+t.key),t)af.call(t,l)&&!lf.hasOwnProperty(l)&&(c[l]=t[l]);var w=arguments.length-2;if(w===1)c.children=i;else if(1<w){for(var C=Array(w),m=0;m<w;m++)C[m]=arguments[m+2];c.children=C}if(e&&e.defaultProps)for(l in w=e.defaultProps,w)c[l]===void 0&&(c[l]=w[l]);return{$$typeof:Js,type:e,key:f,ref:p,props:c,_owner:ec.current}}function yg(e,t){return{$$typeof:Js,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function tc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Js}function Eg(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var w1=/\/+/g;function ul(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Eg(""+e.key):t.toString(36)}function Lo(e,t,i,l,c){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var p=!1;if(e===null)p=!0;else switch(f){case"string":case"number":p=!0;break;case"object":switch(e.$$typeof){case Js:case lg:p=!0}}if(p)return p=e,c=c(p),e=l===""?"."+ul(p,0):l,m1(c)?(i="",e!=null&&(i=e.replace(w1,"$&/")+"/"),Lo(c,t,i,"",function(m){return m})):c!=null&&(tc(c)&&(c=yg(c,i+(!c.key||p&&p.key===c.key?"":(""+c.key).replace(w1,"$&/")+"/")+e)),t.push(c)),1;if(p=0,l=l===""?".":l+":",m1(e))for(var w=0;w<e.length;w++){f=e[w];var C=l+ul(f,w);p+=Lo(f,t,i,C,c)}else if(C=wg(e),typeof C=="function")for(e=C.call(e),w=0;!(f=e.next()).done;)f=f.value,C=l+ul(f,w++),p+=Lo(f,t,i,C,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 p}function wo(e,t,i){if(e==null)return e;var l=[],c=0;return Lo(e,l,"","",function(f){return t.call(i,f,c++)}),l}function Cg(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(i){(e._status===0||e._status===-1)&&(e._status=1,e._result=i)},function(i){(e._status===0||e._status===-1)&&(e._status=2,e._result=i)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var zt={current:null},Fo={transition:null},Ag={ReactCurrentDispatcher:zt,ReactCurrentBatchConfig:Fo,ReactCurrentOwner:ec};function cf(){throw Error("act(...) is not supported in production builds of React.")}Ae.Children={map:wo,forEach:function(e,t,i){wo(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return wo(e,function(){t++}),t},toArray:function(e){return wo(e,function(t){return t})||[]},only:function(e){if(!tc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Component=Yi;Ae.Fragment=ug;Ae.Profiler=fg;Ae.PureComponent=$u;Ae.StrictMode=cg;Ae.Suspense=pg;Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ag;Ae.act=cf;Ae.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var l=rf({},e.props),c=e.key,f=e.ref,p=e._owner;if(t!=null){if(t.ref!==void 0&&(f=t.ref,p=ec.current),t.key!==void 0&&(c=""+t.key),e.type&&e.type.defaultProps)var w=e.type.defaultProps;for(C in t)af.call(t,C)&&!lf.hasOwnProperty(C)&&(l[C]=t[C]===void 0&&w!==void 0?w[C]:t[C])}var C=arguments.length-2;if(C===1)l.children=i;else if(1<C){w=Array(C);for(var m=0;m<C;m++)w[m]=arguments[m+2];l.children=w}return{$$typeof:Js,type:e.type,key:c,ref:f,props:l,_owner:p}};Ae.createContext=function(e){return e={$$typeof:hg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:dg,_context:e},e.Consumer=e};Ae.createElement=uf;Ae.createFactory=function(e){var t=uf.bind(null,e);return t.type=e,t};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:gg,render:e}};Ae.isValidElement=tc;Ae.lazy=function(e){return{$$typeof:mg,_payload:{_status:-1,_result:e},_init:Cg}};Ae.memo=function(e,t){return{$$typeof:xg,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=Fo.transition;Fo.transition={};try{e()}finally{Fo.transition=t}};Ae.unstable_act=cf;Ae.useCallback=function(e,t){return zt.current.useCallback(e,t)};Ae.useContext=function(e){return zt.current.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e){return zt.current.useDeferredValue(e)};Ae.useEffect=function(e,t){return zt.current.useEffect(e,t)};Ae.useId=function(){return zt.current.useId()};Ae.useImperativeHandle=function(e,t,i){return zt.current.useImperativeHandle(e,t,i)};Ae.useInsertionEffect=function(e,t){return zt.current.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return zt.current.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return zt.current.useMemo(e,t)};Ae.useReducer=function(e,t,i){return zt.current.useReducer(e,t,i)};Ae.useRef=function(e){return zt.current.useRef(e)};Ae.useState=function(e){return zt.current.useState(e)};Ae.useSyncExternalStore=function(e,t,i){return zt.current.useSyncExternalStore(e,t,i)};Ae.useTransition=function(){return zt.current.useTransition()};Ae.version="18.3.1";tf.exports=Ae;var Ct=tf.exports;const vg=J0(Ct);/**
10
+ */var Js=Symbol.for("react.element"),ug=Symbol.for("react.portal"),cg=Symbol.for("react.fragment"),fg=Symbol.for("react.strict_mode"),dg=Symbol.for("react.profiler"),hg=Symbol.for("react.provider"),gg=Symbol.for("react.context"),pg=Symbol.for("react.forward_ref"),xg=Symbol.for("react.suspense"),mg=Symbol.for("react.memo"),wg=Symbol.for("react.lazy"),x1=Symbol.iterator;function yg(e){return e===null||typeof e!="object"?null:(e=x1&&e[x1]||e["@@iterator"],typeof e=="function"?e:null)}var nf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rf=Object.assign,sf={};function Yi(e,t,i){this.props=e,this.context=t,this.refs=sf,this.updater=i||nf}Yi.prototype.isReactComponent={};Yi.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")};Yi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function of(){}of.prototype=Yi.prototype;function $u(e,t,i){this.props=e,this.context=t,this.refs=sf,this.updater=i||nf}var Ju=$u.prototype=new of;Ju.constructor=$u;rf(Ju,Yi.prototype);Ju.isPureReactComponent=!0;var m1=Array.isArray,af=Object.prototype.hasOwnProperty,ec={current:null},lf={key:!0,ref:!0,__self:!0,__source:!0};function uf(e,t,i){var l,c={},f=null,p=null;if(t!=null)for(l in t.ref!==void 0&&(p=t.ref),t.key!==void 0&&(f=""+t.key),t)af.call(t,l)&&!lf.hasOwnProperty(l)&&(c[l]=t[l]);var w=arguments.length-2;if(w===1)c.children=i;else if(1<w){for(var C=Array(w),m=0;m<w;m++)C[m]=arguments[m+2];c.children=C}if(e&&e.defaultProps)for(l in w=e.defaultProps,w)c[l]===void 0&&(c[l]=w[l]);return{$$typeof:Js,type:e,key:f,ref:p,props:c,_owner:ec.current}}function Eg(e,t){return{$$typeof:Js,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function tc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Js}function Cg(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var w1=/\/+/g;function ul(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Cg(""+e.key):t.toString(36)}function Lo(e,t,i,l,c){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var p=!1;if(e===null)p=!0;else switch(f){case"string":case"number":p=!0;break;case"object":switch(e.$$typeof){case Js:case ug:p=!0}}if(p)return p=e,c=c(p),e=l===""?"."+ul(p,0):l,m1(c)?(i="",e!=null&&(i=e.replace(w1,"$&/")+"/"),Lo(c,t,i,"",function(m){return m})):c!=null&&(tc(c)&&(c=Eg(c,i+(!c.key||p&&p.key===c.key?"":(""+c.key).replace(w1,"$&/")+"/")+e)),t.push(c)),1;if(p=0,l=l===""?".":l+":",m1(e))for(var w=0;w<e.length;w++){f=e[w];var C=l+ul(f,w);p+=Lo(f,t,i,C,c)}else if(C=yg(e),typeof C=="function")for(e=C.call(e),w=0;!(f=e.next()).done;)f=f.value,C=l+ul(f,w++),p+=Lo(f,t,i,C,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 p}function wo(e,t,i){if(e==null)return e;var l=[],c=0;return Lo(e,l,"","",function(f){return t.call(i,f,c++)}),l}function Ag(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(i){(e._status===0||e._status===-1)&&(e._status=1,e._result=i)},function(i){(e._status===0||e._status===-1)&&(e._status=2,e._result=i)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var zt={current:null},Fo={transition:null},vg={ReactCurrentDispatcher:zt,ReactCurrentBatchConfig:Fo,ReactCurrentOwner:ec};function cf(){throw Error("act(...) is not supported in production builds of React.")}Ae.Children={map:wo,forEach:function(e,t,i){wo(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return wo(e,function(){t++}),t},toArray:function(e){return wo(e,function(t){return t})||[]},only:function(e){if(!tc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Component=Yi;Ae.Fragment=cg;Ae.Profiler=dg;Ae.PureComponent=$u;Ae.StrictMode=fg;Ae.Suspense=xg;Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vg;Ae.act=cf;Ae.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var l=rf({},e.props),c=e.key,f=e.ref,p=e._owner;if(t!=null){if(t.ref!==void 0&&(f=t.ref,p=ec.current),t.key!==void 0&&(c=""+t.key),e.type&&e.type.defaultProps)var w=e.type.defaultProps;for(C in t)af.call(t,C)&&!lf.hasOwnProperty(C)&&(l[C]=t[C]===void 0&&w!==void 0?w[C]:t[C])}var C=arguments.length-2;if(C===1)l.children=i;else if(1<C){w=Array(C);for(var m=0;m<C;m++)w[m]=arguments[m+2];l.children=w}return{$$typeof:Js,type:e.type,key:c,ref:f,props:l,_owner:p}};Ae.createContext=function(e){return e={$$typeof:gg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:hg,_context:e},e.Consumer=e};Ae.createElement=uf;Ae.createFactory=function(e){var t=uf.bind(null,e);return t.type=e,t};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:pg,render:e}};Ae.isValidElement=tc;Ae.lazy=function(e){return{$$typeof:wg,_payload:{_status:-1,_result:e},_init:Ag}};Ae.memo=function(e,t){return{$$typeof:mg,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=Fo.transition;Fo.transition={};try{e()}finally{Fo.transition=t}};Ae.unstable_act=cf;Ae.useCallback=function(e,t){return zt.current.useCallback(e,t)};Ae.useContext=function(e){return zt.current.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e){return zt.current.useDeferredValue(e)};Ae.useEffect=function(e,t){return zt.current.useEffect(e,t)};Ae.useId=function(){return zt.current.useId()};Ae.useImperativeHandle=function(e,t,i){return zt.current.useImperativeHandle(e,t,i)};Ae.useInsertionEffect=function(e,t){return zt.current.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return zt.current.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return zt.current.useMemo(e,t)};Ae.useReducer=function(e,t,i){return zt.current.useReducer(e,t,i)};Ae.useRef=function(e){return zt.current.useRef(e)};Ae.useState=function(e){return zt.current.useState(e)};Ae.useSyncExternalStore=function(e,t,i){return zt.current.useSyncExternalStore(e,t,i)};Ae.useTransition=function(){return zt.current.useTransition()};Ae.version="18.3.1";tf.exports=Ae;var ct=tf.exports;const Sg=J0(ct);/**
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-Cso_5v1O.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 Sg=Ct,Ig=Symbol.for("react.element"),_g=Symbol.for("react.fragment"),Tg=Object.prototype.hasOwnProperty,Ng=Sg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Rg={key:!0,ref:!0,__self:!0,__source:!0};function ff(e,t,i){var l,c={},f=null,p=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(p=t.ref);for(l in t)Tg.call(t,l)&&!Rg.hasOwnProperty(l)&&(c[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps,t)c[l]===void 0&&(c[l]=t[l]);return{$$typeof:Ig,type:e,key:f,ref:p,props:c,_owner:Ng.current}}Ia.Fragment=_g;Ia.jsx=ff;Ia.jsxs=ff;ef.exports=Ia;var ae=ef.exports;const bg=Ct.createContext(null);function Og(){const[e,t]=Ct.useState(null),[i,l]=Ct.useState(!1),[c,f]=Ct.useState(!1),[p,w]=Ct.useState(""),C=["127.0.0.1","localhost","[::1]"].includes(location.hostname),m=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);if(Ct.useEffect(()=>{let v=!0;const R=async()=>{try{const P=await fetch(m&&C?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!P.ok)return;const B=await P.json();v&&t(B)}catch{}};R();const M=setInterval(R,2e3);return()=>{v=!1,clearInterval(M)}},[m,C]),!m){if(!e||e.online&&e.accessibility)return null;const v=e.supported?e.installed?e.enabled?!e.screen||!e.accessibility?"电脑的远程桌面授权尚未完成。":"电脑桌面正在连接,请稍候。":"电脑尚未开启桌面共享,请在电脑上完成授权并开启共享。":"电脑缺少远程桌面组件,请在电脑上升级 CLI。":"这台电脑暂不支持远程桌面。";return ae.jsxs("div",{className:"remote-desktop-guidance",role:"status",style:{maxWidth:"100%",fontSize:12,lineHeight:1.6,overflowWrap:"anywhere"},children:[ae.jsx("strong",{children:v}),e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility)&&ae.jsxs("details",{children:[ae.jsx("summary",{children:"如何在电脑上授权"}),ae.jsx("p",{children:"在运行 CLI 的电脑上,打开安装提示中的“远程桌面授权地址”,完成配对后点击“远程授权”(盾牌图标)。"}),ae.jsx("p",{children:"在系统设置中为 AgentRoam Remote Desktop 授予“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]})]})}if(!C)return ae.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ae.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>l(!i),"aria-expanded":i,"aria-label":"远程授权",title:"远程授权",children:ae.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:[ae.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ae.jsx("path",{d:"m9 12 2 2 4-4"})]})}),i&&ae.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:[ae.jsx("strong",{children:"远程授权"}),ae.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开本机页面,完成配对后设置屏幕录制和辅助功能权限。"}),ae.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",style:{padding:"10px 16px",background:"var(--accent, #5264ff)",color:"#fff",borderRadius:8},onClick:()=>window.open(`http://127.0.0.1:${location.port||"3000"}/web`,"_blank","noopener,noreferrer"),children:"打开本机授权页面"}),ae.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const _=async(v,R)=>{f(!0),w("");try{const M=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:v,permission:R})}),P=await M.json();if(!M.ok)throw new Error(P.error||"操作失败");t(P)}catch(M){w(M instanceof Error?M.message:"操作失败")}finally{f(!1)}};return ae.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ae.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>l(!i),"aria-expanded":i,"aria-label":"远程授权",title:"远程授权",children:ae.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:[ae.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ae.jsx("path",{d:"m9 12 2 2 4-4"})]})}),i&&ae.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:[ae.jsx("strong",{children:"远程授权"}),ae.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.supported?e.installed?ae.jsxs(ae.Fragment,{children:[["screen","accessibility"].map(v=>ae.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[ae.jsxs("span",{children:[v==="screen"?"屏幕录制":"辅助功能",":",e[v]?"已授权":"待授权"]}),ae.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("authorize",v),children:"去授权"})]},v)),ae.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ae.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),ae.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("recheck"),children:"重新检测"}),ae.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("restart"),children:"重启授权组件"})]}),ae.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待系统授权或首帧画面…":"尚未开启共享。"}),ae.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):ae.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):ae.jsx("p",{children:"目前支持 macOS 14 及以上的 Apple Silicon 电脑。"}),(p||e.error)&&ae.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:p||e.error})]})]})}var df={exports:{}},ln={},hf={exports:{}},gf={};/**
18
+ */var Ig=ct,_g=Symbol.for("react.element"),Tg=Symbol.for("react.fragment"),Ng=Object.prototype.hasOwnProperty,Rg=Ig.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,bg={key:!0,ref:!0,__self:!0,__source:!0};function ff(e,t,i){var l,c={},f=null,p=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(p=t.ref);for(l in t)Ng.call(t,l)&&!bg.hasOwnProperty(l)&&(c[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps,t)c[l]===void 0&&(c[l]=t[l]);return{$$typeof:_g,type:e,key:f,ref:p,props:c,_owner:Rg.current}}Ia.Fragment=Tg;Ia.jsx=ff;Ia.jsxs=ff;ef.exports=Ia;var te=ef.exports;const Og=ct.createContext(null);var df={exports:{}},ln={},hf={exports:{}},gf={};/**
19
19
  * @license React
20
20
  * scheduler.production.min.js
21
21
  *
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-Cso_5v1O.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
- */(function(e){function t(ee,de){var pe=ee.length;ee.push(de);e:for(;0<pe;){var Ge=pe-1>>>1,Ie=ee[Ge];if(0<c(Ie,de))ee[Ge]=de,ee[pe]=Ie,pe=Ge;else break e}}function i(ee){return ee.length===0?null:ee[0]}function l(ee){if(ee.length===0)return null;var de=ee[0],pe=ee.pop();if(pe!==de){ee[0]=pe;e:for(var Ge=0,Ie=ee.length,cn=Ie>>>1;Ge<cn;){var Ke=2*(Ge+1)-1,kr=ee[Ke],le=Ke+1,ir=ee[le];if(0>c(kr,pe))le<Ie&&0>c(ir,kr)?(ee[Ge]=ir,ee[le]=pe,Ge=le):(ee[Ge]=kr,ee[Ke]=pe,Ge=Ke);else if(le<Ie&&0>c(ir,pe))ee[Ge]=ir,ee[le]=pe,Ge=le;else break e}}return de}function c(ee,de){var pe=ee.sortIndex-de.sortIndex;return pe!==0?pe:ee.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var p=Date,w=p.now();e.unstable_now=function(){return p.now()-w}}var C=[],m=[],_=1,v=null,R=3,M=!1,P=!1,B=!1,K=typeof setTimeout=="function"?setTimeout:null,O=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 N(ee){for(var de=i(m);de!==null;){if(de.callback===null)l(m);else if(de.startTime<=ee)l(m),de.sortIndex=de.expirationTime,t(C,de);else break;de=i(m)}}function G(ee){if(B=!1,N(ee),!P)if(i(C)!==null)P=!0,tt(H);else{var de=i(m);de!==null&&xe(G,de.startTime-ee)}}function H(ee,de){P=!1,B&&(B=!1,O(X),X=-1),M=!0;var pe=R;try{for(N(de),v=i(C);v!==null&&(!(v.expirationTime>de)||ee&&!Ee());){var Ge=v.callback;if(typeof Ge=="function"){v.callback=null,R=v.priorityLevel;var Ie=Ge(v.expirationTime<=de);de=e.unstable_now(),typeof Ie=="function"?v.callback=Ie:v===i(C)&&l(C),N(de)}else l(C);v=i(C)}if(v!==null)var cn=!0;else{var Ke=i(m);Ke!==null&&xe(G,Ke.startTime-de),cn=!1}return cn}finally{v=null,R=pe,M=!1}}var U=!1,k=null,X=-1,V=5,se=-1;function Ee(){return!(e.unstable_now()-se<V)}function ie(){if(k!==null){var ee=e.unstable_now();se=ee;var de=!0;try{de=k(!0,ee)}finally{de?ge():(U=!1,k=null)}}else U=!1}var ge;if(typeof T=="function")ge=function(){T(ie)};else if(typeof MessageChannel<"u"){var _e=new MessageChannel,j=_e.port2;_e.port1.onmessage=ie,ge=function(){j.postMessage(null)}}else ge=function(){K(ie,0)};function tt(ee){k=ee,U||(U=!0,ge())}function xe(ee,de){X=K(function(){ee(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(ee){ee.callback=null},e.unstable_continueExecution=function(){P||M||(P=!0,tt(H))},e.unstable_forceFrameRate=function(ee){0>ee||125<ee?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<ee?Math.floor(1e3/ee):5},e.unstable_getCurrentPriorityLevel=function(){return R},e.unstable_getFirstCallbackNode=function(){return i(C)},e.unstable_next=function(ee){switch(R){case 1:case 2:case 3:var de=3;break;default:de=R}var pe=R;R=de;try{return ee()}finally{R=pe}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(ee,de){switch(ee){case 1:case 2:case 3:case 4:case 5:break;default:ee=3}var pe=R;R=ee;try{return de()}finally{R=pe}},e.unstable_scheduleCallback=function(ee,de,pe){var Ge=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?Ge+pe:Ge):pe=Ge,ee){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,ee={id:_++,callback:de,priorityLevel:ee,startTime:pe,expirationTime:Ie,sortIndex:-1},pe>Ge?(ee.sortIndex=pe,t(m,ee),i(C)===null&&ee===i(m)&&(B?(O(X),X=-1):B=!0,xe(G,pe-Ge))):(ee.sortIndex=Ie,t(C,ee),P||M||(P=!0,tt(H))),ee},e.unstable_shouldYield=Ee,e.unstable_wrapCallback=function(ee){var de=R;return function(){var pe=R;R=de;try{return ee.apply(this,arguments)}finally{R=pe}}}})(gf);hf.exports=gf;var Dg=hf.exports;/**
26
+ */(function(e){function t(ee,de){var pe=ee.length;ee.push(de);e:for(;0<pe;){var Ge=pe-1>>>1,Ie=ee[Ge];if(0<c(Ie,de))ee[Ge]=de,ee[pe]=Ie,pe=Ge;else break e}}function i(ee){return ee.length===0?null:ee[0]}function l(ee){if(ee.length===0)return null;var de=ee[0],pe=ee.pop();if(pe!==de){ee[0]=pe;e:for(var Ge=0,Ie=ee.length,cn=Ie>>>1;Ge<cn;){var Ke=2*(Ge+1)-1,kr=ee[Ke],le=Ke+1,ir=ee[le];if(0>c(kr,pe))le<Ie&&0>c(ir,kr)?(ee[Ge]=ir,ee[le]=pe,Ge=le):(ee[Ge]=kr,ee[Ke]=pe,Ge=Ke);else if(le<Ie&&0>c(ir,pe))ee[Ge]=ir,ee[le]=pe,Ge=le;else break e}}return de}function c(ee,de){var pe=ee.sortIndex-de.sortIndex;return pe!==0?pe:ee.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var p=Date,w=p.now();e.unstable_now=function(){return p.now()-w}}var C=[],m=[],_=1,v=null,R=3,M=!1,P=!1,B=!1,K=typeof setTimeout=="function"?setTimeout:null,O=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 N(ee){for(var de=i(m);de!==null;){if(de.callback===null)l(m);else if(de.startTime<=ee)l(m),de.sortIndex=de.expirationTime,t(C,de);else break;de=i(m)}}function G(ee){if(B=!1,N(ee),!P)if(i(C)!==null)P=!0,tt(j);else{var de=i(m);de!==null&&xe(G,de.startTime-ee)}}function j(ee,de){P=!1,B&&(B=!1,O(X),X=-1),M=!0;var pe=R;try{for(N(de),v=i(C);v!==null&&(!(v.expirationTime>de)||ee&&!Ee());){var Ge=v.callback;if(typeof Ge=="function"){v.callback=null,R=v.priorityLevel;var Ie=Ge(v.expirationTime<=de);de=e.unstable_now(),typeof Ie=="function"?v.callback=Ie:v===i(C)&&l(C),N(de)}else l(C);v=i(C)}if(v!==null)var cn=!0;else{var Ke=i(m);Ke!==null&&xe(G,Ke.startTime-de),cn=!1}return cn}finally{v=null,R=pe,M=!1}}var U=!1,k=null,X=-1,V=5,oe=-1;function Ee(){return!(e.unstable_now()-oe<V)}function se(){if(k!==null){var ee=e.unstable_now();oe=ee;var de=!0;try{de=k(!0,ee)}finally{de?ge():(U=!1,k=null)}}else U=!1}var ge;if(typeof T=="function")ge=function(){T(se)};else if(typeof MessageChannel<"u"){var _e=new MessageChannel,H=_e.port2;_e.port1.onmessage=se,ge=function(){H.postMessage(null)}}else ge=function(){K(se,0)};function tt(ee){k=ee,U||(U=!0,ge())}function xe(ee,de){X=K(function(){ee(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(ee){ee.callback=null},e.unstable_continueExecution=function(){P||M||(P=!0,tt(j))},e.unstable_forceFrameRate=function(ee){0>ee||125<ee?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<ee?Math.floor(1e3/ee):5},e.unstable_getCurrentPriorityLevel=function(){return R},e.unstable_getFirstCallbackNode=function(){return i(C)},e.unstable_next=function(ee){switch(R){case 1:case 2:case 3:var de=3;break;default:de=R}var pe=R;R=de;try{return ee()}finally{R=pe}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(ee,de){switch(ee){case 1:case 2:case 3:case 4:case 5:break;default:ee=3}var pe=R;R=ee;try{return de()}finally{R=pe}},e.unstable_scheduleCallback=function(ee,de,pe){var Ge=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?Ge+pe:Ge):pe=Ge,ee){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,ee={id:_++,callback:de,priorityLevel:ee,startTime:pe,expirationTime:Ie,sortIndex:-1},pe>Ge?(ee.sortIndex=pe,t(m,ee),i(C)===null&&ee===i(m)&&(B?(O(X),X=-1):B=!0,xe(G,pe-Ge))):(ee.sortIndex=Ie,t(C,ee),P||M||(P=!0,tt(j))),ee},e.unstable_shouldYield=Ee,e.unstable_wrapCallback=function(ee){var de=R;return function(){var pe=R;R=de;try{return ee.apply(this,arguments)}finally{R=pe}}}})(gf);hf.exports=gf;var Dg=hf.exports;/**
27
27
  * @license React
28
28
  * react-dom.production.min.js
29
29
  *
@@ -31,16 +31,16 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-Cso_5v1O.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 Mg=Ct,an=Dg;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);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 pf=new Set,ks={};function ti(e,t){Fi(e,t),Fi(e+"Capture",t)}function Fi(e,t){for(ks[e]=t,e=0;e<t.length;e++)pf.add(t[e])}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jl=Object.prototype.hasOwnProperty,kg=/^[: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]*$/,y1={},E1={};function Pg(e){return jl.call(E1,e)?!0:jl.call(y1,e)?!1:kg.test(e)?E1[e]=!0:(y1[e]=!0,!1)}function Bg(e,t,i,l){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Lg(e,t,i,l){if(t===null||typeof t>"u"||Bg(e,t,i,l))return!0;if(l)return!1;if(i!==null)switch(i.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 Vt(e,t,i,l,c,f,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=c,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=f,this.removeEmptyString=p}var Rt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Rt[e]=new Vt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Rt[t]=new Vt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Rt[e]=new Vt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Rt[e]=new Vt(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){Rt[e]=new Vt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Rt[e]=new Vt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Rt[e]=new Vt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Rt[e]=new Vt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Rt[e]=new Vt(e,5,!1,e.toLowerCase(),null,!1,!1)});var nc=/[\-:]([a-z])/g;function rc(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(nc,rc);Rt[t]=new Vt(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(nc,rc);Rt[t]=new Vt(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(nc,rc);Rt[t]=new Vt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!1,!1)});Rt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ic(e,t,i,l){var c=Rt.hasOwnProperty(t)?Rt[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Lg(t,i,c,l)&&(i=null),l||c===null?Pg(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):c.mustUseProperty?e[c.propertyName]=i===null?c.type===3?!1:"":i:(t=c.attributeName,l=c.attributeNamespace,i===null?e.removeAttribute(t):(c=c.type,i=c===3||c===4&&i===!0?"":""+i,l?e.setAttributeNS(l,t,i):e.setAttribute(t,i))))}var rr=Mg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,yo=Symbol.for("react.element"),mi=Symbol.for("react.portal"),wi=Symbol.for("react.fragment"),sc=Symbol.for("react.strict_mode"),Gl=Symbol.for("react.profiler"),xf=Symbol.for("react.provider"),mf=Symbol.for("react.context"),oc=Symbol.for("react.forward_ref"),Xl=Symbol.for("react.suspense"),Yl=Symbol.for("react.suspense_list"),ac=Symbol.for("react.memo"),hr=Symbol.for("react.lazy"),wf=Symbol.for("react.offscreen"),C1=Symbol.iterator;function us(e){return e===null||typeof e!="object"?null:(e=C1&&e[C1]||e["@@iterator"],typeof e=="function"?e:null)}var et=Object.assign,cl;function ms(e){if(cl===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);cl=t&&t[1]||""}return`
34
+ */var Mg=ct,an=Dg;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);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 pf=new Set,ks={};function ti(e,t){Fi(e,t),Fi(e+"Capture",t)}function Fi(e,t){for(ks[e]=t,e=0;e<t.length;e++)pf.add(t[e])}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hl=Object.prototype.hasOwnProperty,kg=/^[: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]*$/,y1={},E1={};function Pg(e){return Hl.call(E1,e)?!0:Hl.call(y1,e)?!1:kg.test(e)?E1[e]=!0:(y1[e]=!0,!1)}function Bg(e,t,i,l){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Lg(e,t,i,l){if(t===null||typeof t>"u"||Bg(e,t,i,l))return!0;if(l)return!1;if(i!==null)switch(i.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 Vt(e,t,i,l,c,f,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=c,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=f,this.removeEmptyString=p}var Rt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Rt[e]=new Vt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Rt[t]=new Vt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Rt[e]=new Vt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Rt[e]=new Vt(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){Rt[e]=new Vt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Rt[e]=new Vt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Rt[e]=new Vt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Rt[e]=new Vt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Rt[e]=new Vt(e,5,!1,e.toLowerCase(),null,!1,!1)});var nc=/[\-:]([a-z])/g;function rc(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(nc,rc);Rt[t]=new Vt(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(nc,rc);Rt[t]=new Vt(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(nc,rc);Rt[t]=new Vt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!1,!1)});Rt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ic(e,t,i,l){var c=Rt.hasOwnProperty(t)?Rt[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Lg(t,i,c,l)&&(i=null),l||c===null?Pg(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):c.mustUseProperty?e[c.propertyName]=i===null?c.type===3?!1:"":i:(t=c.attributeName,l=c.attributeNamespace,i===null?e.removeAttribute(t):(c=c.type,i=c===3||c===4&&i===!0?"":""+i,l?e.setAttributeNS(l,t,i):e.setAttribute(t,i))))}var rr=Mg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,yo=Symbol.for("react.element"),mi=Symbol.for("react.portal"),wi=Symbol.for("react.fragment"),sc=Symbol.for("react.strict_mode"),Gl=Symbol.for("react.profiler"),xf=Symbol.for("react.provider"),mf=Symbol.for("react.context"),oc=Symbol.for("react.forward_ref"),Xl=Symbol.for("react.suspense"),Yl=Symbol.for("react.suspense_list"),ac=Symbol.for("react.memo"),hr=Symbol.for("react.lazy"),wf=Symbol.for("react.offscreen"),C1=Symbol.iterator;function us(e){return e===null||typeof e!="object"?null:(e=C1&&e[C1]||e["@@iterator"],typeof e=="function"?e:null)}var et=Object.assign,cl;function ms(e){if(cl===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);cl=t&&t[1]||""}return`
35
35
  `+cl+e}var fl=!1;function dl(e,t){if(!e||fl)return"";fl=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(m){var l=m}Reflect.construct(e,[],t)}else{try{t.call()}catch(m){l=m}e.call(t.prototype)}else{try{throw Error()}catch(m){l=m}e()}}catch(m){if(m&&l&&typeof m.stack=="string"){for(var c=m.stack.split(`
36
36
  `),f=l.stack.split(`
37
37
  `),p=c.length-1,w=f.length-1;1<=p&&0<=w&&c[p]!==f[w];)w--;for(;1<=p&&0<=w;p--,w--)if(c[p]!==f[w]){if(p!==1||w!==1)do if(p--,w--,0>w||c[p]!==f[w]){var C=`
38
- `+c[p].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),C}while(1<=p&&0<=w);break}}}finally{fl=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?ms(e):""}function Fg(e){switch(e.tag){case 5:return ms(e.type);case 16:return ms("Lazy");case 13:return ms("Suspense");case 19:return ms("SuspenseList");case 0:case 2:case 15:return e=dl(e.type,!1),e;case 11:return e=dl(e.type.render,!1),e;case 1:return e=dl(e.type,!0),e;default:return""}}function Zl(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 wi:return"Fragment";case mi:return"Portal";case Gl:return"Profiler";case sc:return"StrictMode";case Xl:return"Suspense";case Yl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case mf:return(e.displayName||"Context")+".Consumer";case xf:return(e._context.displayName||"Context")+".Provider";case oc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ac:return t=e.displayName||null,t!==null?t:Zl(e.type)||"Memo";case hr:t=e._payload,e=e._init;try{return Zl(e(t))}catch{}}return null}function Ug(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 Zl(t);case 8:return t===sc?"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 Nr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wg(e){var t=yf(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var c=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){l=""+p,f.call(this,p)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Eo(e){e._valueTracker||(e._valueTracker=Wg(e))}function Ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=yf(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function qo(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 Kl(e,t){var i=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function A1(e,t){var i=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;i=Nr(t.value!=null?t.value:i),e._wrapperState={initialChecked:l,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Cf(e,t){t=t.checked,t!=null&&ic(e,"checked",t,!1)}function Ql(e,t){Cf(e,t);var i=Nr(t.value),l=t.type;if(i!=null)l==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ql(e,t.type,i):t.hasOwnProperty("defaultValue")&&ql(e,t.type,Nr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function v1(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function ql(e,t,i){(t!=="number"||qo(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var ws=Array.isArray;function Oi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Nr(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function $l(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function S1(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(Q(92));if(ws(i)){if(1<i.length)throw Error(Q(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Nr(i)}}function Af(e,t){var i=Nr(t.value),l=Nr(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),l!=null&&(e.defaultValue=""+l)}function I1(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vf(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 Jl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Co,Sf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,l,c){MSApp.execUnsafeLocalFunction(function(){return e(t,i,l,c)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Co=Co||document.createElement("div"),Co.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Co.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ps(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var vs={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},zg=["Webkit","ms","Moz","O"];Object.keys(vs).forEach(function(e){zg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vs[t]=vs[e]})});function If(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||vs.hasOwnProperty(e)&&vs[e]?(""+t).trim():t+"px"}function _f(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var l=i.indexOf("--")===0,c=If(i,t[i],l);i==="float"&&(i="cssFloat"),l?e.setProperty(i,c):e[i]=c}}var Vg=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 eu(e,t){if(t){if(Vg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function tu(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 nu=null;function lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ru=null,Di=null,Mi=null;function _1(e){if(e=no(e)){if(typeof ru!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=ba(t),ru(e.stateNode,e.type,t))}}function Tf(e){Di?Mi?Mi.push(e):Mi=[e]:Di=e}function Nf(){if(Di){var e=Di,t=Mi;if(Mi=Di=null,_1(e),t)for(e=0;e<t.length;e++)_1(t[e])}}function Rf(e,t){return e(t)}function bf(){}var hl=!1;function Of(e,t,i){if(hl)return e(t,i);hl=!0;try{return Rf(e,t,i)}finally{hl=!1,(Di!==null||Mi!==null)&&(bf(),Nf())}}function Bs(e,t){var i=e.stateNode;if(i===null)return null;var l=ba(i);if(l===null)return null;i=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(Q(231,t,typeof i));return i}var iu=!1;if(Jn)try{var cs={};Object.defineProperty(cs,"passive",{get:function(){iu=!0}}),window.addEventListener("test",cs,cs),window.removeEventListener("test",cs,cs)}catch{iu=!1}function Hg(e,t,i,l,c,f,p,w,C){var m=Array.prototype.slice.call(arguments,3);try{t.apply(i,m)}catch(_){this.onError(_)}}var Ss=!1,$o=null,Jo=!1,su=null,jg={onError:function(e){Ss=!0,$o=e}};function Gg(e,t,i,l,c,f,p,w,C){Ss=!1,$o=null,Hg.apply(jg,arguments)}function Xg(e,t,i,l,c,f,p,w,C){if(Gg.apply(this,arguments),Ss){if(Ss){var m=$o;Ss=!1,$o=null}else throw Error(Q(198));Jo||(Jo=!0,su=m)}}function ni(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Df(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 T1(e){if(ni(e)!==e)throw Error(Q(188))}function Yg(e){var t=e.alternate;if(!t){if(t=ni(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var f=c.alternate;if(f===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===i)return T1(c),e;if(f===l)return T1(c),t;f=f.sibling}throw Error(Q(188))}if(i.return!==l.return)i=c,l=f;else{for(var p=!1,w=c.child;w;){if(w===i){p=!0,i=c,l=f;break}if(w===l){p=!0,l=c,i=f;break}w=w.sibling}if(!p){for(w=f.child;w;){if(w===i){p=!0,i=f,l=c;break}if(w===l){p=!0,l=f,i=c;break}w=w.sibling}if(!p)throw Error(Q(189))}}if(i.alternate!==l)throw Error(Q(190))}if(i.tag!==3)throw Error(Q(188));return i.stateNode.current===i?e:t}function Mf(e){return e=Yg(e),e!==null?kf(e):null}function kf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=kf(e);if(t!==null)return t;e=e.sibling}return null}var Pf=an.unstable_scheduleCallback,N1=an.unstable_cancelCallback,Zg=an.unstable_shouldYield,Kg=an.unstable_requestPaint,lt=an.unstable_now,Qg=an.unstable_getCurrentPriorityLevel,uc=an.unstable_ImmediatePriority,Bf=an.unstable_UserBlockingPriority,ea=an.unstable_NormalPriority,qg=an.unstable_LowPriority,Lf=an.unstable_IdlePriority,_a=null,Hn=null;function $g(e){if(Hn&&typeof Hn.onCommitFiberRoot=="function")try{Hn.onCommitFiberRoot(_a,e,void 0,(e.current.flags&128)===128)}catch{}}var Rn=Math.clz32?Math.clz32:t2,Jg=Math.log,e2=Math.LN2;function t2(e){return e>>>=0,e===0?32:31-(Jg(e)/e2|0)|0}var Ao=64,vo=4194304;function ys(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 ta(e,t){var i=e.pendingLanes;if(i===0)return 0;var l=0,c=e.suspendedLanes,f=e.pingedLanes,p=i&268435455;if(p!==0){var w=p&~c;w!==0?l=ys(w):(f&=p,f!==0&&(l=ys(f)))}else p=i&~c,p!==0?l=ys(p):f!==0&&(l=ys(f));if(l===0)return 0;if(t!==0&&t!==l&&!(t&c)&&(c=l&-l,f=t&-t,c>=f||c===16&&(f&4194240)!==0))return t;if(l&4&&(l|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)i=31-Rn(t),c=1<<i,l|=e[i],t&=~c;return l}function n2(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 r2(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,f=e.pendingLanes;0<f;){var p=31-Rn(f),w=1<<p,C=c[p];C===-1?(!(w&i)||w&l)&&(c[p]=n2(w,t)):C<=t&&(e.expiredLanes|=w),f&=~w}}function ou(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ff(){var e=Ao;return Ao<<=1,!(Ao&4194240)&&(Ao=64),e}function gl(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function eo(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rn(t),e[t]=i}function i2(e,t){var i=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 l=e.eventTimes;for(e=e.expirationTimes;0<i;){var c=31-Rn(i),f=1<<c;t[c]=0,l[c]=-1,e[c]=-1,i&=~f}}function cc(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Rn(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}var ke=0;function Uf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Wf,fc,zf,Vf,Hf,au=!1,So=[],Er=null,Cr=null,Ar=null,Ls=new Map,Fs=new Map,pr=[],s2="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 R1(e,t){switch(e){case"focusin":case"focusout":Er=null;break;case"dragenter":case"dragleave":Cr=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":Ls.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fs.delete(t.pointerId)}}function fs(e,t,i,l,c,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:f,targetContainers:[c]},t!==null&&(t=no(t),t!==null&&fc(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function o2(e,t,i,l,c){switch(t){case"focusin":return Er=fs(Er,e,t,i,l,c),!0;case"dragenter":return Cr=fs(Cr,e,t,i,l,c),!0;case"mouseover":return Ar=fs(Ar,e,t,i,l,c),!0;case"pointerover":var f=c.pointerId;return Ls.set(f,fs(Ls.get(f)||null,e,t,i,l,c)),!0;case"gotpointercapture":return f=c.pointerId,Fs.set(f,fs(Fs.get(f)||null,e,t,i,l,c)),!0}return!1}function jf(e){var t=Gr(e.target);if(t!==null){var i=ni(t);if(i!==null){if(t=i.tag,t===13){if(t=Df(i),t!==null){e.blockedOn=t,Hf(e.priority,function(){zf(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Uo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=lu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nu=l,i.target.dispatchEvent(l),nu=null}else return t=no(i),t!==null&&fc(t),e.blockedOn=i,!1;t.shift()}return!0}function b1(e,t,i){Uo(e)&&i.delete(t)}function a2(){au=!1,Er!==null&&Uo(Er)&&(Er=null),Cr!==null&&Uo(Cr)&&(Cr=null),Ar!==null&&Uo(Ar)&&(Ar=null),Ls.forEach(b1),Fs.forEach(b1)}function ds(e,t){e.blockedOn===t&&(e.blockedOn=null,au||(au=!0,an.unstable_scheduleCallback(an.unstable_NormalPriority,a2)))}function Us(e){function t(c){return ds(c,e)}if(0<So.length){ds(So[0],e);for(var i=1;i<So.length;i++){var l=So[i];l.blockedOn===e&&(l.blockedOn=null)}}for(Er!==null&&ds(Er,e),Cr!==null&&ds(Cr,e),Ar!==null&&ds(Ar,e),Ls.forEach(t),Fs.forEach(t),i=0;i<pr.length;i++)l=pr[i],l.blockedOn===e&&(l.blockedOn=null);for(;0<pr.length&&(i=pr[0],i.blockedOn===null);)jf(i),i.blockedOn===null&&pr.shift()}var ki=rr.ReactCurrentBatchConfig,na=!0;function l2(e,t,i,l){var c=ke,f=ki.transition;ki.transition=null;try{ke=1,dc(e,t,i,l)}finally{ke=c,ki.transition=f}}function u2(e,t,i,l){var c=ke,f=ki.transition;ki.transition=null;try{ke=4,dc(e,t,i,l)}finally{ke=c,ki.transition=f}}function dc(e,t,i,l){if(na){var c=lu(e,t,i,l);if(c===null)Sl(e,t,l,ra,i),R1(e,l);else if(o2(c,e,t,i,l))l.stopPropagation();else if(R1(e,l),t&4&&-1<s2.indexOf(e)){for(;c!==null;){var f=no(c);if(f!==null&&Wf(f),f=lu(e,t,i,l),f===null&&Sl(e,t,l,ra,i),f===c)break;c=f}c!==null&&l.stopPropagation()}else Sl(e,t,l,null,i)}}var ra=null;function lu(e,t,i,l){if(ra=null,e=lc(l),e=Gr(e),e!==null)if(t=ni(e),t===null)e=null;else if(i=t.tag,i===13){if(e=Df(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ra=e,null}function Gf(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(Qg()){case uc:return 1;case Bf:return 4;case ea:case qg:return 16;case Lf:return 536870912;default:return 16}default:return 16}}var wr=null,hc=null,Wo=null;function Xf(){if(Wo)return Wo;var e,t=hc,i=t.length,l,c="value"in wr?wr.value:wr.textContent,f=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[f-l];l++);return Wo=c.slice(e,1<l?1-l:void 0)}function zo(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 Io(){return!0}function O1(){return!1}function un(e){function t(i,l,c,f,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Io:O1,this.isPropagationStopped=O1,this}return et(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Io)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Io)},persist:function(){},isPersistent:Io}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gc=un(Zi),to=et({},Zi,{view:0,detail:0}),c2=un(to),pl,xl,hs,Ta=et({},to,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,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!==hs&&(hs&&e.type==="mousemove"?(pl=e.screenX-hs.screenX,xl=e.screenY-hs.screenY):xl=pl=0,hs=e),pl)},movementY:function(e){return"movementY"in e?e.movementY:xl}}),D1=un(Ta),f2=et({},Ta,{dataTransfer:0}),d2=un(f2),h2=et({},to,{relatedTarget:0}),ml=un(h2),g2=et({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),p2=un(g2),x2=et({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),m2=un(x2),w2=et({},Zi,{data:0}),M1=un(w2),y2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E2={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"},C2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function A2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=C2[e])?!!t[e]:!1}function pc(){return A2}var v2=et({},to,{key:function(e){if(e.key){var t=y2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?E2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,charCode:function(e){return e.type==="keypress"?zo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),S2=un(v2),I2=et({},Ta,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),k1=un(I2),_2=et({},to,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),T2=un(_2),N2=et({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),R2=un(N2),b2=et({},Ta,{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}),O2=un(b2),D2=[9,13,27,32],xc=Jn&&"CompositionEvent"in window,Is=null;Jn&&"documentMode"in document&&(Is=document.documentMode);var M2=Jn&&"TextEvent"in window&&!Is,Yf=Jn&&(!xc||Is&&8<Is&&11>=Is),P1=" ",B1=!1;function Zf(e,t){switch(e){case"keyup":return D2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yi=!1;function k2(e,t){switch(e){case"compositionend":return Kf(t);case"keypress":return t.which!==32?null:(B1=!0,P1);case"textInput":return e=t.data,e===P1&&B1?null:e;default:return null}}function P2(e,t){if(yi)return e==="compositionend"||!xc&&Zf(e,t)?(e=Xf(),Wo=hc=wr=null,yi=!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 Yf&&t.locale!=="ko"?null:t.data;default:return null}}var B2={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 L1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!B2[e.type]:t==="textarea"}function Qf(e,t,i,l){Tf(l),t=ia(t,"onChange"),0<t.length&&(i=new gc("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var _s=null,Ws=null;function L2(e){ad(e,0)}function Na(e){var t=Ai(e);if(Ef(t))return e}function F2(e,t){if(e==="change")return t}var qf=!1;if(Jn){var wl;if(Jn){var yl="oninput"in document;if(!yl){var F1=document.createElement("div");F1.setAttribute("oninput","return;"),yl=typeof F1.oninput=="function"}wl=yl}else wl=!1;qf=wl&&(!document.documentMode||9<document.documentMode)}function U1(){_s&&(_s.detachEvent("onpropertychange",$f),Ws=_s=null)}function $f(e){if(e.propertyName==="value"&&Na(Ws)){var t=[];Qf(t,Ws,e,lc(e)),Of(L2,t)}}function U2(e,t,i){e==="focusin"?(U1(),_s=t,Ws=i,_s.attachEvent("onpropertychange",$f)):e==="focusout"&&U1()}function W2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Na(Ws)}function z2(e,t){if(e==="click")return Na(t)}function V2(e,t){if(e==="input"||e==="change")return Na(t)}function H2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var On=typeof Object.is=="function"?Object.is:H2;function zs(e,t){if(On(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!jl.call(t,c)||!On(e[c],t[c]))return!1}return!0}function W1(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function z1(e,t){var i=W1(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=W1(i)}}function Jf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ed(){for(var e=window,t=qo();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=qo(e.document)}return t}function mc(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 j2(e){var t=ed(),i=e.focusedElem,l=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&Jf(i.ownerDocument.documentElement,i)){if(l!==null&&mc(i)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=i.textContent.length,f=Math.min(l.start,c);l=l.end===void 0?f:Math.min(l.end,c),!e.extend&&f>l&&(c=l,l=f,f=c),c=z1(i,f);var p=z1(i,l);c&&p&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),f>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var G2=Jn&&"documentMode"in document&&11>=document.documentMode,Ei=null,uu=null,Ts=null,cu=!1;function V1(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;cu||Ei==null||Ei!==qo(l)||(l=Ei,"selectionStart"in l&&mc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ts&&zs(Ts,l)||(Ts=l,l=ia(uu,"onSelect"),0<l.length&&(t=new gc("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Ei)))}function _o(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ci={animationend:_o("Animation","AnimationEnd"),animationiteration:_o("Animation","AnimationIteration"),animationstart:_o("Animation","AnimationStart"),transitionend:_o("Transition","TransitionEnd")},El={},td={};Jn&&(td=document.createElement("div").style,"AnimationEvent"in window||(delete Ci.animationend.animation,delete Ci.animationiteration.animation,delete Ci.animationstart.animation),"TransitionEvent"in window||delete Ci.transitionend.transition);function Ra(e){if(El[e])return El[e];if(!Ci[e])return e;var t=Ci[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in td)return El[e]=t[i];return e}var nd=Ra("animationend"),rd=Ra("animationiteration"),id=Ra("animationstart"),sd=Ra("transitionend"),od=new Map,H1="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 Or(e,t){od.set(e,t),ti(t,[e])}for(var Cl=0;Cl<H1.length;Cl++){var Al=H1[Cl],X2=Al.toLowerCase(),Y2=Al[0].toUpperCase()+Al.slice(1);Or(X2,"on"+Y2)}Or(nd,"onAnimationEnd");Or(rd,"onAnimationIteration");Or(id,"onAnimationStart");Or("dblclick","onDoubleClick");Or("focusin","onFocus");Or("focusout","onBlur");Or(sd,"onTransitionEnd");Fi("onMouseEnter",["mouseout","mouseover"]);Fi("onMouseLeave",["mouseout","mouseover"]);Fi("onPointerEnter",["pointerout","pointerover"]);Fi("onPointerLeave",["pointerout","pointerover"]);ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ti("onBeforeInput",["compositionend","keypress","textInput","paste"]);ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Es="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(" "),Z2=new Set("cancel close invalid load scroll toggle".split(" ").concat(Es));function j1(e,t,i){var l=e.type||"unknown-event";e.currentTarget=i,Xg(l,t,void 0,e),e.currentTarget=null}function ad(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var f=void 0;if(t)for(var p=l.length-1;0<=p;p--){var w=l[p],C=w.instance,m=w.currentTarget;if(w=w.listener,C!==f&&c.isPropagationStopped())break e;j1(c,w,m),f=C}else for(p=0;p<l.length;p++){if(w=l[p],C=w.instance,m=w.currentTarget,w=w.listener,C!==f&&c.isPropagationStopped())break e;j1(c,w,m),f=C}}}if(Jo)throw e=su,Jo=!1,su=null,e}function He(e,t){var i=t[pu];i===void 0&&(i=t[pu]=new Set);var l=e+"__bubble";i.has(l)||(ld(t,e,2,!1),i.add(l))}function vl(e,t,i){var l=0;t&&(l|=4),ld(i,e,l,t)}var To="_reactListening"+Math.random().toString(36).slice(2);function Vs(e){if(!e[To]){e[To]=!0,pf.forEach(function(i){i!=="selectionchange"&&(Z2.has(i)||vl(i,!1,e),vl(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[To]||(t[To]=!0,vl("selectionchange",!1,t))}}function ld(e,t,i,l){switch(Gf(t)){case 1:var c=l2;break;case 4:c=u2;break;default:c=dc}i=c.bind(null,t,i,e),c=void 0,!iu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Sl(e,t,i,l,c){var f=l;if(!(t&1)&&!(t&2)&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var w=l.stateNode.containerInfo;if(w===c||w.nodeType===8&&w.parentNode===c)break;if(p===4)for(p=l.return;p!==null;){var C=p.tag;if((C===3||C===4)&&(C=p.stateNode.containerInfo,C===c||C.nodeType===8&&C.parentNode===c))return;p=p.return}for(;w!==null;){if(p=Gr(w),p===null)return;if(C=p.tag,C===5||C===6){l=f=p;continue e}w=w.parentNode}}l=l.return}Of(function(){var m=f,_=lc(i),v=[];e:{var R=od.get(e);if(R!==void 0){var M=gc,P=e;switch(e){case"keypress":if(zo(i)===0)break e;case"keydown":case"keyup":M=S2;break;case"focusin":P="focus",M=ml;break;case"focusout":P="blur",M=ml;break;case"beforeblur":case"afterblur":M=ml;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":M=D1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":M=d2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":M=T2;break;case nd:case rd:case id:M=p2;break;case sd:M=R2;break;case"scroll":M=c2;break;case"wheel":M=O2;break;case"copy":case"cut":case"paste":M=m2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":M=k1}var B=(t&4)!==0,K=!B&&e==="scroll",O=B?R!==null?R+"Capture":null:R;B=[];for(var T=m,N;T!==null;){N=T;var G=N.stateNode;if(N.tag===5&&G!==null&&(N=G,O!==null&&(G=Bs(T,O),G!=null&&B.push(Hs(T,G,N)))),K)break;T=T.return}0<B.length&&(R=new M(R,P,null,i,_),v.push({event:R,listeners:B}))}}if(!(t&7)){e:{if(R=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",R&&i!==nu&&(P=i.relatedTarget||i.fromElement)&&(Gr(P)||P[er]))break e;if((M||R)&&(R=_.window===_?_:(R=_.ownerDocument)?R.defaultView||R.parentWindow:window,M?(P=i.relatedTarget||i.toElement,M=m,P=P?Gr(P):null,P!==null&&(K=ni(P),P!==K||P.tag!==5&&P.tag!==6)&&(P=null)):(M=null,P=m),M!==P)){if(B=D1,G="onMouseLeave",O="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(B=k1,G="onPointerLeave",O="onPointerEnter",T="pointer"),K=M==null?R:Ai(M),N=P==null?R:Ai(P),R=new B(G,T+"leave",M,i,_),R.target=K,R.relatedTarget=N,G=null,Gr(_)===m&&(B=new B(O,T+"enter",P,i,_),B.target=N,B.relatedTarget=K,G=B),K=G,M&&P)t:{for(B=M,O=P,T=0,N=B;N;N=hi(N))T++;for(N=0,G=O;G;G=hi(G))N++;for(;0<T-N;)B=hi(B),T--;for(;0<N-T;)O=hi(O),N--;for(;T--;){if(B===O||O!==null&&B===O.alternate)break t;B=hi(B),O=hi(O)}B=null}else B=null;M!==null&&G1(v,R,M,B,!1),P!==null&&K!==null&&G1(v,K,P,B,!0)}}e:{if(R=m?Ai(m):window,M=R.nodeName&&R.nodeName.toLowerCase(),M==="select"||M==="input"&&R.type==="file")var H=F2;else if(L1(R))if(qf)H=V2;else{H=W2;var U=U2}else(M=R.nodeName)&&M.toLowerCase()==="input"&&(R.type==="checkbox"||R.type==="radio")&&(H=z2);if(H&&(H=H(e,m))){Qf(v,H,i,_);break e}U&&U(e,R,m),e==="focusout"&&(U=R._wrapperState)&&U.controlled&&R.type==="number"&&ql(R,"number",R.value)}switch(U=m?Ai(m):window,e){case"focusin":(L1(U)||U.contentEditable==="true")&&(Ei=U,uu=m,Ts=null);break;case"focusout":Ts=uu=Ei=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,V1(v,i,_);break;case"selectionchange":if(G2)break;case"keydown":case"keyup":V1(v,i,_)}var k;if(xc)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 yi?Zf(e,i)&&(X="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(X="onCompositionStart");X&&(Yf&&i.locale!=="ko"&&(yi||X!=="onCompositionStart"?X==="onCompositionEnd"&&yi&&(k=Xf()):(wr=_,hc="value"in wr?wr.value:wr.textContent,yi=!0)),U=ia(m,X),0<U.length&&(X=new M1(X,e,null,i,_),v.push({event:X,listeners:U}),k?X.data=k:(k=Kf(i),k!==null&&(X.data=k)))),(k=M2?k2(e,i):P2(e,i))&&(m=ia(m,"onBeforeInput"),0<m.length&&(_=new M1("onBeforeInput","beforeinput",null,i,_),v.push({event:_,listeners:m}),_.data=k))}ad(v,t)})}function Hs(e,t,i){return{instance:e,listener:t,currentTarget:i}}function ia(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,f=c.stateNode;c.tag===5&&f!==null&&(c=f,f=Bs(e,i),f!=null&&l.unshift(Hs(e,f,c)),f=Bs(e,t),f!=null&&l.push(Hs(e,f,c))),e=e.return}return l}function hi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function G1(e,t,i,l,c){for(var f=t._reactName,p=[];i!==null&&i!==l;){var w=i,C=w.alternate,m=w.stateNode;if(C!==null&&C===l)break;w.tag===5&&m!==null&&(w=m,c?(C=Bs(i,f),C!=null&&p.unshift(Hs(i,C,w))):c||(C=Bs(i,f),C!=null&&p.push(Hs(i,C,w)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var K2=/\r\n?/g,Q2=/\u0000|\uFFFD/g;function X1(e){return(typeof e=="string"?e:""+e).replace(K2,`
39
- `).replace(Q2,"")}function No(e,t,i){if(t=X1(t),X1(e)!==t&&i)throw Error(Q(425))}function sa(){}var fu=null,du=null;function hu(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 gu=typeof setTimeout=="function"?setTimeout:void 0,q2=typeof clearTimeout=="function"?clearTimeout:void 0,Y1=typeof Promise=="function"?Promise:void 0,$2=typeof queueMicrotask=="function"?queueMicrotask:typeof Y1<"u"?function(e){return Y1.resolve(null).then(e).catch(J2)}:gu;function J2(e){setTimeout(function(){throw e})}function Il(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(l===0){e.removeChild(c),Us(t);return}l--}else i!=="$"&&i!=="$?"&&i!=="$!"||l++;i=c}while(i);Us(t)}function vr(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 Z1(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Ki=Math.random().toString(36).slice(2),Vn="__reactFiber$"+Ki,js="__reactProps$"+Ki,er="__reactContainer$"+Ki,pu="__reactEvents$"+Ki,ep="__reactListeners$"+Ki,tp="__reactHandles$"+Ki;function Gr(e){var t=e[Vn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[er]||i[Vn]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Z1(e);e!==null;){if(i=e[Vn])return i;e=Z1(e)}return t}e=i,i=e.parentNode}return null}function no(e){return e=e[Vn]||e[er],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function ba(e){return e[js]||null}var xu=[],vi=-1;function Dr(e){return{current:e}}function je(e){0>vi||(e.current=xu[vi],xu[vi]=null,vi--)}function ze(e,t){vi++,xu[vi]=e.current,e.current=t}var Rr={},Bt=Dr(Rr),$t=Dr(!1),Qr=Rr;function Ui(e,t){var i=e.type.contextTypes;if(!i)return Rr;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var c={},f;for(f in i)c[f]=t[f];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function Jt(e){return e=e.childContextTypes,e!=null}function oa(){je($t),je(Bt)}function K1(e,t,i){if(Bt.current!==Rr)throw Error(Q(168));ze(Bt,t),ze($t,i)}function ud(e,t,i){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return i;l=l.getChildContext();for(var c in l)if(!(c in t))throw Error(Q(108,Ug(e)||"Unknown",c));return et({},i,l)}function aa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Rr,Qr=Bt.current,ze(Bt,e),ze($t,$t.current),!0}function Q1(e,t,i){var l=e.stateNode;if(!l)throw Error(Q(169));i?(e=ud(e,t,Qr),l.__reactInternalMemoizedMergedChildContext=e,je($t),je(Bt),ze(Bt,e)):je($t),ze($t,i)}var Kn=null,Oa=!1,_l=!1;function cd(e){Kn===null?Kn=[e]:Kn.push(e)}function np(e){Oa=!0,cd(e)}function Mr(){if(!_l&&Kn!==null){_l=!0;var e=0,t=ke;try{var i=Kn;for(ke=1;e<i.length;e++){var l=i[e];do l=l(!0);while(l!==null)}Kn=null,Oa=!1}catch(c){throw Kn!==null&&(Kn=Kn.slice(e+1)),Pf(uc,Mr),c}finally{ke=t,_l=!1}}return null}var Si=[],Ii=0,la=null,ua=0,pn=[],xn=0,qr=null,Qn=1,qn="";function Vr(e,t){Si[Ii++]=ua,Si[Ii++]=la,la=e,ua=t}function fd(e,t,i){pn[xn++]=Qn,pn[xn++]=qn,pn[xn++]=qr,qr=e;var l=Qn;e=qn;var c=32-Rn(l)-1;l&=~(1<<c),i+=1;var f=32-Rn(t)+c;if(30<f){var p=c-c%5;f=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Qn=1<<32-Rn(t)+c|i<<c|l,qn=f+e}else Qn=1<<f|i<<c|l,qn=e}function wc(e){e.return!==null&&(Vr(e,1),fd(e,1,0))}function yc(e){for(;e===la;)la=Si[--Ii],Si[Ii]=null,ua=Si[--Ii],Si[Ii]=null;for(;e===qr;)qr=pn[--xn],pn[xn]=null,qn=pn[--xn],pn[xn]=null,Qn=pn[--xn],pn[xn]=null}var on=null,sn=null,Ze=!1,Nn=null;function dd(e,t){var i=mn(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function q1(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,on=e,sn=vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,on=e,sn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=qr!==null?{id:Qn,overflow:qn}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=mn(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,on=e,sn=null,!0):!1;default:return!1}}function mu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wu(e){if(Ze){var t=sn;if(t){var i=t;if(!q1(e,t)){if(mu(e))throw Error(Q(418));t=vr(i.nextSibling);var l=on;t&&q1(e,t)?dd(l,i):(e.flags=e.flags&-4097|2,Ze=!1,on=e)}}else{if(mu(e))throw Error(Q(418));e.flags=e.flags&-4097|2,Ze=!1,on=e}}}function $1(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;on=e}function Ro(e){if(e!==on)return!1;if(!Ze)return $1(e),Ze=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!hu(e.type,e.memoizedProps)),t&&(t=sn)){if(mu(e))throw hd(),Error(Q(418));for(;t;)dd(e,t),t=vr(t.nextSibling)}if($1(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){sn=vr(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}sn=null}}else sn=on?vr(e.stateNode.nextSibling):null;return!0}function hd(){for(var e=sn;e;)e=vr(e.nextSibling)}function Wi(){sn=on=null,Ze=!1}function Ec(e){Nn===null?Nn=[e]:Nn.push(e)}var rp=rr.ReactCurrentBatchConfig;function gs(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(Q(309));var l=i.stateNode}if(!l)throw Error(Q(147,e));var c=l,f=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===f?t.ref:(t=function(p){var w=c.refs;p===null?delete w[f]:w[f]=p},t._stringRef=f,t)}if(typeof e!="string")throw Error(Q(284));if(!i._owner)throw Error(Q(290,e))}return e}function bo(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function J1(e){var t=e._init;return t(e._payload)}function gd(e){function t(O,T){if(e){var N=O.deletions;N===null?(O.deletions=[T],O.flags|=16):N.push(T)}}function i(O,T){if(!e)return null;for(;T!==null;)t(O,T),T=T.sibling;return null}function l(O,T){for(O=new Map;T!==null;)T.key!==null?O.set(T.key,T):O.set(T.index,T),T=T.sibling;return O}function c(O,T){return O=Tr(O,T),O.index=0,O.sibling=null,O}function f(O,T,N){return O.index=N,e?(N=O.alternate,N!==null?(N=N.index,N<T?(O.flags|=2,T):N):(O.flags|=2,T)):(O.flags|=1048576,T)}function p(O){return e&&O.alternate===null&&(O.flags|=2),O}function w(O,T,N,G){return T===null||T.tag!==6?(T=Ml(N,O.mode,G),T.return=O,T):(T=c(T,N),T.return=O,T)}function C(O,T,N,G){var H=N.type;return H===wi?_(O,T,N.props.children,G,N.key):T!==null&&(T.elementType===H||typeof H=="object"&&H!==null&&H.$$typeof===hr&&J1(H)===T.type)?(G=c(T,N.props),G.ref=gs(O,T,N),G.return=O,G):(G=Zo(N.type,N.key,N.props,null,O.mode,G),G.ref=gs(O,T,N),G.return=O,G)}function m(O,T,N,G){return T===null||T.tag!==4||T.stateNode.containerInfo!==N.containerInfo||T.stateNode.implementation!==N.implementation?(T=kl(N,O.mode,G),T.return=O,T):(T=c(T,N.children||[]),T.return=O,T)}function _(O,T,N,G,H){return T===null||T.tag!==7?(T=Kr(N,O.mode,G,H),T.return=O,T):(T=c(T,N),T.return=O,T)}function v(O,T,N){if(typeof T=="string"&&T!==""||typeof T=="number")return T=Ml(""+T,O.mode,N),T.return=O,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case yo:return N=Zo(T.type,T.key,T.props,null,O.mode,N),N.ref=gs(O,null,T),N.return=O,N;case mi:return T=kl(T,O.mode,N),T.return=O,T;case hr:var G=T._init;return v(O,G(T._payload),N)}if(ws(T)||us(T))return T=Kr(T,O.mode,N,null),T.return=O,T;bo(O,T)}return null}function R(O,T,N,G){var H=T!==null?T.key:null;if(typeof N=="string"&&N!==""||typeof N=="number")return H!==null?null:w(O,T,""+N,G);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case yo:return N.key===H?C(O,T,N,G):null;case mi:return N.key===H?m(O,T,N,G):null;case hr:return H=N._init,R(O,T,H(N._payload),G)}if(ws(N)||us(N))return H!==null?null:_(O,T,N,G,null);bo(O,N)}return null}function M(O,T,N,G,H){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(N)||null,w(T,O,""+G,H);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case yo:return O=O.get(G.key===null?N:G.key)||null,C(T,O,G,H);case mi:return O=O.get(G.key===null?N:G.key)||null,m(T,O,G,H);case hr:var U=G._init;return M(O,T,N,U(G._payload),H)}if(ws(G)||us(G))return O=O.get(N)||null,_(T,O,G,H,null);bo(T,G)}return null}function P(O,T,N,G){for(var H=null,U=null,k=T,X=T=0,V=null;k!==null&&X<N.length;X++){k.index>X?(V=k,k=null):V=k.sibling;var se=R(O,k,N[X],G);if(se===null){k===null&&(k=V);break}e&&k&&se.alternate===null&&t(O,k),T=f(se,T,X),U===null?H=se:U.sibling=se,U=se,k=V}if(X===N.length)return i(O,k),Ze&&Vr(O,X),H;if(k===null){for(;X<N.length;X++)k=v(O,N[X],G),k!==null&&(T=f(k,T,X),U===null?H=k:U.sibling=k,U=k);return Ze&&Vr(O,X),H}for(k=l(O,k);X<N.length;X++)V=M(k,O,X,N[X],G),V!==null&&(e&&V.alternate!==null&&k.delete(V.key===null?X:V.key),T=f(V,T,X),U===null?H=V:U.sibling=V,U=V);return e&&k.forEach(function(Ee){return t(O,Ee)}),Ze&&Vr(O,X),H}function B(O,T,N,G){var H=us(N);if(typeof H!="function")throw Error(Q(150));if(N=H.call(N),N==null)throw Error(Q(151));for(var U=H=null,k=T,X=T=0,V=null,se=N.next();k!==null&&!se.done;X++,se=N.next()){k.index>X?(V=k,k=null):V=k.sibling;var Ee=R(O,k,se.value,G);if(Ee===null){k===null&&(k=V);break}e&&k&&Ee.alternate===null&&t(O,k),T=f(Ee,T,X),U===null?H=Ee:U.sibling=Ee,U=Ee,k=V}if(se.done)return i(O,k),Ze&&Vr(O,X),H;if(k===null){for(;!se.done;X++,se=N.next())se=v(O,se.value,G),se!==null&&(T=f(se,T,X),U===null?H=se:U.sibling=se,U=se);return Ze&&Vr(O,X),H}for(k=l(O,k);!se.done;X++,se=N.next())se=M(k,O,X,se.value,G),se!==null&&(e&&se.alternate!==null&&k.delete(se.key===null?X:se.key),T=f(se,T,X),U===null?H=se:U.sibling=se,U=se);return e&&k.forEach(function(ie){return t(O,ie)}),Ze&&Vr(O,X),H}function K(O,T,N,G){if(typeof N=="object"&&N!==null&&N.type===wi&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case yo:e:{for(var H=N.key,U=T;U!==null;){if(U.key===H){if(H=N.type,H===wi){if(U.tag===7){i(O,U.sibling),T=c(U,N.props.children),T.return=O,O=T;break e}}else if(U.elementType===H||typeof H=="object"&&H!==null&&H.$$typeof===hr&&J1(H)===U.type){i(O,U.sibling),T=c(U,N.props),T.ref=gs(O,U,N),T.return=O,O=T;break e}i(O,U);break}else t(O,U);U=U.sibling}N.type===wi?(T=Kr(N.props.children,O.mode,G,N.key),T.return=O,O=T):(G=Zo(N.type,N.key,N.props,null,O.mode,G),G.ref=gs(O,T,N),G.return=O,O=G)}return p(O);case mi:e:{for(U=N.key;T!==null;){if(T.key===U)if(T.tag===4&&T.stateNode.containerInfo===N.containerInfo&&T.stateNode.implementation===N.implementation){i(O,T.sibling),T=c(T,N.children||[]),T.return=O,O=T;break e}else{i(O,T);break}else t(O,T);T=T.sibling}T=kl(N,O.mode,G),T.return=O,O=T}return p(O);case hr:return U=N._init,K(O,T,U(N._payload),G)}if(ws(N))return P(O,T,N,G);if(us(N))return B(O,T,N,G);bo(O,N)}return typeof N=="string"&&N!==""||typeof N=="number"?(N=""+N,T!==null&&T.tag===6?(i(O,T.sibling),T=c(T,N),T.return=O,O=T):(i(O,T),T=Ml(N,O.mode,G),T.return=O,O=T),p(O)):i(O,T)}return K}var zi=gd(!0),pd=gd(!1),ca=Dr(null),fa=null,_i=null,Cc=null;function Ac(){Cc=_i=fa=null}function vc(e){var t=ca.current;je(ca),e._currentValue=t}function yu(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Pi(e,t){fa=e,Cc=_i=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function yn(e){var t=e._currentValue;if(Cc!==e)if(e={context:e,memoizedValue:t,next:null},_i===null){if(fa===null)throw Error(Q(308));_i=e,fa.dependencies={lanes:0,firstContext:e}}else _i=_i.next=e;return t}var Xr=null;function Sc(e){Xr===null?Xr=[e]:Xr.push(e)}function xd(e,t,i,l){var c=t.interleaved;return c===null?(i.next=i,Sc(t)):(i.next=c.next,c.next=i),t.interleaved=i,tr(e,l)}function tr(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var gr=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function md(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 $n(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Sr(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,Re&2){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,tr(e,i)}return c=l.interleaved,c===null?(t.next=t,Sc(l)):(t.next=c.next,c.next=t),l.interleaved=t,tr(e,i)}function Vo(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,cc(e,i)}}function e0(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var p={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};f===null?c=f=p:f=f.next=p,i=i.next}while(i!==null);f===null?c=f=t:f=f.next=t}else c=f=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:f,shared:l.shared,effects:l.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function da(e,t,i,l){var c=e.updateQueue;gr=!1;var f=c.firstBaseUpdate,p=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var C=w,m=C.next;C.next=null,p===null?f=m:p.next=m,p=C;var _=e.alternate;_!==null&&(_=_.updateQueue,w=_.lastBaseUpdate,w!==p&&(w===null?_.firstBaseUpdate=m:w.next=m,_.lastBaseUpdate=C))}if(f!==null){var v=c.baseState;p=0,_=m=C=null,w=f;do{var R=w.lane,M=w.eventTime;if((l&R)===R){_!==null&&(_=_.next={eventTime:M,lane:0,tag:w.tag,payload:w.payload,callback:w.callback,next:null});e:{var P=e,B=w;switch(R=t,M=i,B.tag){case 1:if(P=B.payload,typeof P=="function"){v=P.call(M,v,R);break e}v=P;break e;case 3:P.flags=P.flags&-65537|128;case 0:if(P=B.payload,R=typeof P=="function"?P.call(M,v,R):P,R==null)break e;v=et({},v,R);break e;case 2:gr=!0}}w.callback!==null&&w.lane!==0&&(e.flags|=64,R=c.effects,R===null?c.effects=[w]:R.push(w))}else M={eventTime:M,lane:R,tag:w.tag,payload:w.payload,callback:w.callback,next:null},_===null?(m=_=M,C=v):_=_.next=M,p|=R;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;R=w,w=R.next,R.next=null,c.lastBaseUpdate=R,c.shared.pending=null}}while(!0);if(_===null&&(C=v),c.baseState=C,c.firstBaseUpdate=m,c.lastBaseUpdate=_,t=c.shared.interleaved,t!==null){c=t;do p|=c.lane,c=c.next;while(c!==t)}else f===null&&(c.shared.lanes=0);Jr|=p,e.lanes=p,e.memoizedState=v}}function t0(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],c=l.callback;if(c!==null){if(l.callback=null,l=i,typeof c!="function")throw Error(Q(191,c));c.call(l)}}}var ro={},jn=Dr(ro),Gs=Dr(ro),Xs=Dr(ro);function Yr(e){if(e===ro)throw Error(Q(174));return e}function _c(e,t){switch(ze(Xs,t),ze(Gs,e),ze(jn,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Jl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Jl(t,e)}je(jn),ze(jn,t)}function Vi(){je(jn),je(Gs),je(Xs)}function wd(e){Yr(Xs.current);var t=Yr(jn.current),i=Jl(t,e.type);t!==i&&(ze(Gs,e),ze(jn,i))}function Tc(e){Gs.current===e&&(je(jn),je(Gs))}var $e=Dr(0);function ha(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.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 Tl=[];function Nc(){for(var e=0;e<Tl.length;e++)Tl[e]._workInProgressVersionPrimary=null;Tl.length=0}var Ho=rr.ReactCurrentDispatcher,Nl=rr.ReactCurrentBatchConfig,$r=0,Je=null,pt=null,Et=null,ga=!1,Ns=!1,Ys=0,ip=0;function Dt(){throw Error(Q(321))}function Rc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!On(e[i],t[i]))return!1;return!0}function bc(e,t,i,l,c,f){if($r=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ho.current=e===null||e.memoizedState===null?lp:up,e=i(l,c),Ns){f=0;do{if(Ns=!1,Ys=0,25<=f)throw Error(Q(301));f+=1,Et=pt=null,t.updateQueue=null,Ho.current=cp,e=i(l,c)}while(Ns)}if(Ho.current=pa,t=pt!==null&&pt.next!==null,$r=0,Et=pt=Je=null,ga=!1,t)throw Error(Q(300));return e}function Oc(){var e=Ys!==0;return Ys=0,e}function zn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Et===null?Je.memoizedState=Et=e:Et=Et.next=e,Et}function En(){if(pt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=pt.next;var t=Et===null?Je.memoizedState:Et.next;if(t!==null)Et=t,pt=e;else{if(e===null)throw Error(Q(310));pt=e,e={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Et===null?Je.memoizedState=Et=e:Et=Et.next=e}return Et}function Zs(e,t){return typeof t=="function"?t(e):t}function Rl(e){var t=En(),i=t.queue;if(i===null)throw Error(Q(311));i.lastRenderedReducer=e;var l=pt,c=l.baseQueue,f=i.pending;if(f!==null){if(c!==null){var p=c.next;c.next=f.next,f.next=p}l.baseQueue=c=f,i.pending=null}if(c!==null){f=c.next,l=l.baseState;var w=p=null,C=null,m=f;do{var _=m.lane;if(($r&_)===_)C!==null&&(C=C.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),l=m.hasEagerState?m.eagerState:e(l,m.action);else{var v={lane:_,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};C===null?(w=C=v,p=l):C=C.next=v,Je.lanes|=_,Jr|=_}m=m.next}while(m!==null&&m!==f);C===null?p=l:C.next=w,On(l,t.memoizedState)||(qt=!0),t.memoizedState=l,t.baseState=p,t.baseQueue=C,i.lastRenderedState=l}if(e=i.interleaved,e!==null){c=e;do f=c.lane,Je.lanes|=f,Jr|=f,c=c.next;while(c!==e)}else c===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function bl(e){var t=En(),i=t.queue;if(i===null)throw Error(Q(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,f=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do f=e(f,p.action),p=p.next;while(p!==c);On(f,t.memoizedState)||(qt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),i.lastRenderedState=f}return[f,l]}function yd(){}function Ed(e,t){var i=Je,l=En(),c=t(),f=!On(l.memoizedState,c);if(f&&(l.memoizedState=c,qt=!0),l=l.queue,Dc(vd.bind(null,i,l,e),[e]),l.getSnapshot!==t||f||Et!==null&&Et.memoizedState.tag&1){if(i.flags|=2048,Ks(9,Ad.bind(null,i,l,c,t),void 0,null),At===null)throw Error(Q(349));$r&30||Cd(i,t,c)}return c}function Cd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ad(e,t,i,l){t.value=i,t.getSnapshot=l,Sd(t)&&Id(e)}function vd(e,t,i){return i(function(){Sd(t)&&Id(e)})}function Sd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!On(e,i)}catch{return!0}}function Id(e){var t=tr(e,1);t!==null&&bn(t,e,1,-1)}function n0(e){var t=zn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:e},t.queue=e,e=e.dispatch=ap.bind(null,Je,e),[t.memoizedState,e]}function Ks(e,t,i,l){return e={tag:e,create:t,destroy:i,deps:l,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e)),e}function _d(){return En().memoizedState}function jo(e,t,i,l){var c=zn();Je.flags|=e,c.memoizedState=Ks(1|t,i,void 0,l===void 0?null:l)}function Da(e,t,i,l){var c=En();l=l===void 0?null:l;var f=void 0;if(pt!==null){var p=pt.memoizedState;if(f=p.destroy,l!==null&&Rc(l,p.deps)){c.memoizedState=Ks(t,i,f,l);return}}Je.flags|=e,c.memoizedState=Ks(1|t,i,f,l)}function r0(e,t){return jo(8390656,8,e,t)}function Dc(e,t){return Da(2048,8,e,t)}function Td(e,t){return Da(4,2,e,t)}function Nd(e,t){return Da(4,4,e,t)}function Rd(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 bd(e,t,i){return i=i!=null?i.concat([e]):null,Da(4,4,Rd.bind(null,t,e),i)}function Mc(){}function Od(e,t){var i=En();t=t===void 0?null:t;var l=i.memoizedState;return l!==null&&t!==null&&Rc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Dd(e,t){var i=En();t=t===void 0?null:t;var l=i.memoizedState;return l!==null&&t!==null&&Rc(t,l[1])?l[0]:(e=e(),i.memoizedState=[e,t],e)}function Md(e,t,i){return $r&21?(On(i,t)||(i=Ff(),Je.lanes|=i,Jr|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qt=!0),e.memoizedState=i)}function sp(e,t){var i=ke;ke=i!==0&&4>i?i:4,e(!0);var l=Nl.transition;Nl.transition={};try{e(!1),t()}finally{ke=i,Nl.transition=l}}function kd(){return En().memoizedState}function op(e,t,i){var l=_r(e);if(i={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null},Pd(e))Bd(t,i);else if(i=xd(e,t,i,l),i!==null){var c=Wt();bn(i,e,l,c),Ld(i,t,l)}}function ap(e,t,i){var l=_r(e),c={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null};if(Pd(e))Bd(t,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var p=t.lastRenderedState,w=f(p,i);if(c.hasEagerState=!0,c.eagerState=w,On(w,p)){var C=t.interleaved;C===null?(c.next=c,Sc(t)):(c.next=C.next,C.next=c),t.interleaved=c;return}}catch{}finally{}i=xd(e,t,c,l),i!==null&&(c=Wt(),bn(i,e,l,c),Ld(i,t,l))}}function Pd(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Bd(e,t){Ns=ga=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Ld(e,t,i){if(i&4194240){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,cc(e,i)}}var pa={readContext:yn,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},lp={readContext:yn,useCallback:function(e,t){return zn().memoizedState=[e,t===void 0?null:t],e},useContext:yn,useEffect:r0,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,jo(4194308,4,Rd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return jo(4194308,4,e,t)},useInsertionEffect:function(e,t){return jo(4,2,e,t)},useMemo:function(e,t){var i=zn();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var l=zn();return t=i!==void 0?i(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=op.bind(null,Je,e),[l.memoizedState,e]},useRef:function(e){var t=zn();return e={current:e},t.memoizedState=e},useState:n0,useDebugValue:Mc,useDeferredValue:function(e){return zn().memoizedState=e},useTransition:function(){var e=n0(!1),t=e[0];return e=sp.bind(null,e[1]),zn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var l=Je,c=zn();if(Ze){if(i===void 0)throw Error(Q(407));i=i()}else{if(i=t(),At===null)throw Error(Q(349));$r&30||Cd(l,t,i)}c.memoizedState=i;var f={value:i,getSnapshot:t};return c.queue=f,r0(vd.bind(null,l,f,e),[e]),l.flags|=2048,Ks(9,Ad.bind(null,l,f,i,t),void 0,null),i},useId:function(){var e=zn(),t=At.identifierPrefix;if(Ze){var i=qn,l=Qn;i=(l&~(1<<32-Rn(l)-1)).toString(32)+i,t=":"+t+"R"+i,i=Ys++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=ip++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},up={readContext:yn,useCallback:Od,useContext:yn,useEffect:Dc,useImperativeHandle:bd,useInsertionEffect:Td,useLayoutEffect:Nd,useMemo:Dd,useReducer:Rl,useRef:_d,useState:function(){return Rl(Zs)},useDebugValue:Mc,useDeferredValue:function(e){var t=En();return Md(t,pt.memoizedState,e)},useTransition:function(){var e=Rl(Zs)[0],t=En().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:Ed,useId:kd,unstable_isNewReconciler:!1},cp={readContext:yn,useCallback:Od,useContext:yn,useEffect:Dc,useImperativeHandle:bd,useInsertionEffect:Td,useLayoutEffect:Nd,useMemo:Dd,useReducer:bl,useRef:_d,useState:function(){return bl(Zs)},useDebugValue:Mc,useDeferredValue:function(e){var t=En();return pt===null?t.memoizedState=e:Md(t,pt.memoizedState,e)},useTransition:function(){var e=bl(Zs)[0],t=En().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:Ed,useId:kd,unstable_isNewReconciler:!1};function _n(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function Eu(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:et({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Ma={isMounted:function(e){return(e=e._reactInternals)?ni(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Wt(),c=_r(e),f=$n(l,c);f.payload=t,i!=null&&(f.callback=i),t=Sr(e,f,c),t!==null&&(bn(t,e,c,l),Vo(t,e,c))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Wt(),c=_r(e),f=$n(l,c);f.tag=1,f.payload=t,i!=null&&(f.callback=i),t=Sr(e,f,c),t!==null&&(bn(t,e,c,l),Vo(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Wt(),l=_r(e),c=$n(i,l);c.tag=2,t!=null&&(c.callback=t),t=Sr(e,c,l),t!==null&&(bn(t,e,l,i),Vo(t,e,l))}};function i0(e,t,i,l,c,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,f,p):t.prototype&&t.prototype.isPureReactComponent?!zs(i,l)||!zs(c,f):!0}function Fd(e,t,i){var l=!1,c=Rr,f=t.contextType;return typeof f=="object"&&f!==null?f=yn(f):(c=Jt(t)?Qr:Bt.current,l=t.contextTypes,f=(l=l!=null)?Ui(e,c):Rr),t=new t(i,f),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ma,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=f),t}function s0(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&Ma.enqueueReplaceState(t,t.state,null)}function Cu(e,t,i,l){var c=e.stateNode;c.props=i,c.state=e.memoizedState,c.refs={},Ic(e);var f=t.contextType;typeof f=="object"&&f!==null?c.context=yn(f):(f=Jt(t)?Qr:Bt.current,c.context=Ui(e,f)),c.state=e.memoizedState,f=t.getDerivedStateFromProps,typeof f=="function"&&(Eu(e,t,f,i),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&&Ma.enqueueReplaceState(c,c.state,null),da(e,i,c,l),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Hi(e,t){try{var i="",l=t;do i+=Fg(l),l=l.return;while(l);var c=i}catch(f){c=`
38
+ `+c[p].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),C}while(1<=p&&0<=w);break}}}finally{fl=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?ms(e):""}function Fg(e){switch(e.tag){case 5:return ms(e.type);case 16:return ms("Lazy");case 13:return ms("Suspense");case 19:return ms("SuspenseList");case 0:case 2:case 15:return e=dl(e.type,!1),e;case 11:return e=dl(e.type.render,!1),e;case 1:return e=dl(e.type,!0),e;default:return""}}function Zl(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 wi:return"Fragment";case mi:return"Portal";case Gl:return"Profiler";case sc:return"StrictMode";case Xl:return"Suspense";case Yl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case mf:return(e.displayName||"Context")+".Consumer";case xf:return(e._context.displayName||"Context")+".Provider";case oc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ac:return t=e.displayName||null,t!==null?t:Zl(e.type)||"Memo";case hr:t=e._payload,e=e._init;try{return Zl(e(t))}catch{}}return null}function Ug(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 Zl(t);case 8:return t===sc?"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 Nr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wg(e){var t=yf(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var c=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){l=""+p,f.call(this,p)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Eo(e){e._valueTracker||(e._valueTracker=Wg(e))}function Ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=yf(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function qo(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 Kl(e,t){var i=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function A1(e,t){var i=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;i=Nr(t.value!=null?t.value:i),e._wrapperState={initialChecked:l,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Cf(e,t){t=t.checked,t!=null&&ic(e,"checked",t,!1)}function Ql(e,t){Cf(e,t);var i=Nr(t.value),l=t.type;if(i!=null)l==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ql(e,t.type,i):t.hasOwnProperty("defaultValue")&&ql(e,t.type,Nr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function v1(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function ql(e,t,i){(t!=="number"||qo(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var ws=Array.isArray;function Oi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Nr(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function $l(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function S1(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(Q(92));if(ws(i)){if(1<i.length)throw Error(Q(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Nr(i)}}function Af(e,t){var i=Nr(t.value),l=Nr(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),l!=null&&(e.defaultValue=""+l)}function I1(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vf(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 Jl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Co,Sf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,l,c){MSApp.execUnsafeLocalFunction(function(){return e(t,i,l,c)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Co=Co||document.createElement("div"),Co.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Co.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ps(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var vs={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},zg=["Webkit","ms","Moz","O"];Object.keys(vs).forEach(function(e){zg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vs[t]=vs[e]})});function If(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||vs.hasOwnProperty(e)&&vs[e]?(""+t).trim():t+"px"}function _f(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var l=i.indexOf("--")===0,c=If(i,t[i],l);i==="float"&&(i="cssFloat"),l?e.setProperty(i,c):e[i]=c}}var Vg=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 eu(e,t){if(t){if(Vg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function tu(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 nu=null;function lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ru=null,Di=null,Mi=null;function _1(e){if(e=no(e)){if(typeof ru!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=ba(t),ru(e.stateNode,e.type,t))}}function Tf(e){Di?Mi?Mi.push(e):Mi=[e]:Di=e}function Nf(){if(Di){var e=Di,t=Mi;if(Mi=Di=null,_1(e),t)for(e=0;e<t.length;e++)_1(t[e])}}function Rf(e,t){return e(t)}function bf(){}var hl=!1;function Of(e,t,i){if(hl)return e(t,i);hl=!0;try{return Rf(e,t,i)}finally{hl=!1,(Di!==null||Mi!==null)&&(bf(),Nf())}}function Bs(e,t){var i=e.stateNode;if(i===null)return null;var l=ba(i);if(l===null)return null;i=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(Q(231,t,typeof i));return i}var iu=!1;if(Jn)try{var cs={};Object.defineProperty(cs,"passive",{get:function(){iu=!0}}),window.addEventListener("test",cs,cs),window.removeEventListener("test",cs,cs)}catch{iu=!1}function jg(e,t,i,l,c,f,p,w,C){var m=Array.prototype.slice.call(arguments,3);try{t.apply(i,m)}catch(_){this.onError(_)}}var Ss=!1,$o=null,Jo=!1,su=null,Hg={onError:function(e){Ss=!0,$o=e}};function Gg(e,t,i,l,c,f,p,w,C){Ss=!1,$o=null,jg.apply(Hg,arguments)}function Xg(e,t,i,l,c,f,p,w,C){if(Gg.apply(this,arguments),Ss){if(Ss){var m=$o;Ss=!1,$o=null}else throw Error(Q(198));Jo||(Jo=!0,su=m)}}function ni(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Df(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 T1(e){if(ni(e)!==e)throw Error(Q(188))}function Yg(e){var t=e.alternate;if(!t){if(t=ni(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var f=c.alternate;if(f===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===i)return T1(c),e;if(f===l)return T1(c),t;f=f.sibling}throw Error(Q(188))}if(i.return!==l.return)i=c,l=f;else{for(var p=!1,w=c.child;w;){if(w===i){p=!0,i=c,l=f;break}if(w===l){p=!0,l=c,i=f;break}w=w.sibling}if(!p){for(w=f.child;w;){if(w===i){p=!0,i=f,l=c;break}if(w===l){p=!0,l=f,i=c;break}w=w.sibling}if(!p)throw Error(Q(189))}}if(i.alternate!==l)throw Error(Q(190))}if(i.tag!==3)throw Error(Q(188));return i.stateNode.current===i?e:t}function Mf(e){return e=Yg(e),e!==null?kf(e):null}function kf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=kf(e);if(t!==null)return t;e=e.sibling}return null}var Pf=an.unstable_scheduleCallback,N1=an.unstable_cancelCallback,Zg=an.unstable_shouldYield,Kg=an.unstable_requestPaint,lt=an.unstable_now,Qg=an.unstable_getCurrentPriorityLevel,uc=an.unstable_ImmediatePriority,Bf=an.unstable_UserBlockingPriority,ea=an.unstable_NormalPriority,qg=an.unstable_LowPriority,Lf=an.unstable_IdlePriority,_a=null,jn=null;function $g(e){if(jn&&typeof jn.onCommitFiberRoot=="function")try{jn.onCommitFiberRoot(_a,e,void 0,(e.current.flags&128)===128)}catch{}}var Rn=Math.clz32?Math.clz32:t2,Jg=Math.log,e2=Math.LN2;function t2(e){return e>>>=0,e===0?32:31-(Jg(e)/e2|0)|0}var Ao=64,vo=4194304;function ys(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 ta(e,t){var i=e.pendingLanes;if(i===0)return 0;var l=0,c=e.suspendedLanes,f=e.pingedLanes,p=i&268435455;if(p!==0){var w=p&~c;w!==0?l=ys(w):(f&=p,f!==0&&(l=ys(f)))}else p=i&~c,p!==0?l=ys(p):f!==0&&(l=ys(f));if(l===0)return 0;if(t!==0&&t!==l&&!(t&c)&&(c=l&-l,f=t&-t,c>=f||c===16&&(f&4194240)!==0))return t;if(l&4&&(l|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)i=31-Rn(t),c=1<<i,l|=e[i],t&=~c;return l}function n2(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 r2(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,f=e.pendingLanes;0<f;){var p=31-Rn(f),w=1<<p,C=c[p];C===-1?(!(w&i)||w&l)&&(c[p]=n2(w,t)):C<=t&&(e.expiredLanes|=w),f&=~w}}function ou(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ff(){var e=Ao;return Ao<<=1,!(Ao&4194240)&&(Ao=64),e}function gl(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function eo(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rn(t),e[t]=i}function i2(e,t){var i=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 l=e.eventTimes;for(e=e.expirationTimes;0<i;){var c=31-Rn(i),f=1<<c;t[c]=0,l[c]=-1,e[c]=-1,i&=~f}}function cc(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Rn(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}var ke=0;function Uf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Wf,fc,zf,Vf,jf,au=!1,So=[],Er=null,Cr=null,Ar=null,Ls=new Map,Fs=new Map,pr=[],s2="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 R1(e,t){switch(e){case"focusin":case"focusout":Er=null;break;case"dragenter":case"dragleave":Cr=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":Ls.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fs.delete(t.pointerId)}}function fs(e,t,i,l,c,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:f,targetContainers:[c]},t!==null&&(t=no(t),t!==null&&fc(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function o2(e,t,i,l,c){switch(t){case"focusin":return Er=fs(Er,e,t,i,l,c),!0;case"dragenter":return Cr=fs(Cr,e,t,i,l,c),!0;case"mouseover":return Ar=fs(Ar,e,t,i,l,c),!0;case"pointerover":var f=c.pointerId;return Ls.set(f,fs(Ls.get(f)||null,e,t,i,l,c)),!0;case"gotpointercapture":return f=c.pointerId,Fs.set(f,fs(Fs.get(f)||null,e,t,i,l,c)),!0}return!1}function Hf(e){var t=Gr(e.target);if(t!==null){var i=ni(t);if(i!==null){if(t=i.tag,t===13){if(t=Df(i),t!==null){e.blockedOn=t,jf(e.priority,function(){zf(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Uo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=lu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nu=l,i.target.dispatchEvent(l),nu=null}else return t=no(i),t!==null&&fc(t),e.blockedOn=i,!1;t.shift()}return!0}function b1(e,t,i){Uo(e)&&i.delete(t)}function a2(){au=!1,Er!==null&&Uo(Er)&&(Er=null),Cr!==null&&Uo(Cr)&&(Cr=null),Ar!==null&&Uo(Ar)&&(Ar=null),Ls.forEach(b1),Fs.forEach(b1)}function ds(e,t){e.blockedOn===t&&(e.blockedOn=null,au||(au=!0,an.unstable_scheduleCallback(an.unstable_NormalPriority,a2)))}function Us(e){function t(c){return ds(c,e)}if(0<So.length){ds(So[0],e);for(var i=1;i<So.length;i++){var l=So[i];l.blockedOn===e&&(l.blockedOn=null)}}for(Er!==null&&ds(Er,e),Cr!==null&&ds(Cr,e),Ar!==null&&ds(Ar,e),Ls.forEach(t),Fs.forEach(t),i=0;i<pr.length;i++)l=pr[i],l.blockedOn===e&&(l.blockedOn=null);for(;0<pr.length&&(i=pr[0],i.blockedOn===null);)Hf(i),i.blockedOn===null&&pr.shift()}var ki=rr.ReactCurrentBatchConfig,na=!0;function l2(e,t,i,l){var c=ke,f=ki.transition;ki.transition=null;try{ke=1,dc(e,t,i,l)}finally{ke=c,ki.transition=f}}function u2(e,t,i,l){var c=ke,f=ki.transition;ki.transition=null;try{ke=4,dc(e,t,i,l)}finally{ke=c,ki.transition=f}}function dc(e,t,i,l){if(na){var c=lu(e,t,i,l);if(c===null)Sl(e,t,l,ra,i),R1(e,l);else if(o2(c,e,t,i,l))l.stopPropagation();else if(R1(e,l),t&4&&-1<s2.indexOf(e)){for(;c!==null;){var f=no(c);if(f!==null&&Wf(f),f=lu(e,t,i,l),f===null&&Sl(e,t,l,ra,i),f===c)break;c=f}c!==null&&l.stopPropagation()}else Sl(e,t,l,null,i)}}var ra=null;function lu(e,t,i,l){if(ra=null,e=lc(l),e=Gr(e),e!==null)if(t=ni(e),t===null)e=null;else if(i=t.tag,i===13){if(e=Df(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ra=e,null}function Gf(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(Qg()){case uc:return 1;case Bf:return 4;case ea:case qg:return 16;case Lf:return 536870912;default:return 16}default:return 16}}var wr=null,hc=null,Wo=null;function Xf(){if(Wo)return Wo;var e,t=hc,i=t.length,l,c="value"in wr?wr.value:wr.textContent,f=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[f-l];l++);return Wo=c.slice(e,1<l?1-l:void 0)}function zo(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 Io(){return!0}function O1(){return!1}function un(e){function t(i,l,c,f,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Io:O1,this.isPropagationStopped=O1,this}return et(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Io)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Io)},persist:function(){},isPersistent:Io}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gc=un(Zi),to=et({},Zi,{view:0,detail:0}),c2=un(to),pl,xl,hs,Ta=et({},to,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,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!==hs&&(hs&&e.type==="mousemove"?(pl=e.screenX-hs.screenX,xl=e.screenY-hs.screenY):xl=pl=0,hs=e),pl)},movementY:function(e){return"movementY"in e?e.movementY:xl}}),D1=un(Ta),f2=et({},Ta,{dataTransfer:0}),d2=un(f2),h2=et({},to,{relatedTarget:0}),ml=un(h2),g2=et({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),p2=un(g2),x2=et({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),m2=un(x2),w2=et({},Zi,{data:0}),M1=un(w2),y2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E2={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"},C2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function A2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=C2[e])?!!t[e]:!1}function pc(){return A2}var v2=et({},to,{key:function(e){if(e.key){var t=y2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?E2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,charCode:function(e){return e.type==="keypress"?zo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),S2=un(v2),I2=et({},Ta,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),k1=un(I2),_2=et({},to,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),T2=un(_2),N2=et({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),R2=un(N2),b2=et({},Ta,{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}),O2=un(b2),D2=[9,13,27,32],xc=Jn&&"CompositionEvent"in window,Is=null;Jn&&"documentMode"in document&&(Is=document.documentMode);var M2=Jn&&"TextEvent"in window&&!Is,Yf=Jn&&(!xc||Is&&8<Is&&11>=Is),P1=" ",B1=!1;function Zf(e,t){switch(e){case"keyup":return D2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yi=!1;function k2(e,t){switch(e){case"compositionend":return Kf(t);case"keypress":return t.which!==32?null:(B1=!0,P1);case"textInput":return e=t.data,e===P1&&B1?null:e;default:return null}}function P2(e,t){if(yi)return e==="compositionend"||!xc&&Zf(e,t)?(e=Xf(),Wo=hc=wr=null,yi=!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 Yf&&t.locale!=="ko"?null:t.data;default:return null}}var B2={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 L1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!B2[e.type]:t==="textarea"}function Qf(e,t,i,l){Tf(l),t=ia(t,"onChange"),0<t.length&&(i=new gc("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var _s=null,Ws=null;function L2(e){ad(e,0)}function Na(e){var t=Ai(e);if(Ef(t))return e}function F2(e,t){if(e==="change")return t}var qf=!1;if(Jn){var wl;if(Jn){var yl="oninput"in document;if(!yl){var F1=document.createElement("div");F1.setAttribute("oninput","return;"),yl=typeof F1.oninput=="function"}wl=yl}else wl=!1;qf=wl&&(!document.documentMode||9<document.documentMode)}function U1(){_s&&(_s.detachEvent("onpropertychange",$f),Ws=_s=null)}function $f(e){if(e.propertyName==="value"&&Na(Ws)){var t=[];Qf(t,Ws,e,lc(e)),Of(L2,t)}}function U2(e,t,i){e==="focusin"?(U1(),_s=t,Ws=i,_s.attachEvent("onpropertychange",$f)):e==="focusout"&&U1()}function W2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Na(Ws)}function z2(e,t){if(e==="click")return Na(t)}function V2(e,t){if(e==="input"||e==="change")return Na(t)}function j2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var On=typeof Object.is=="function"?Object.is:j2;function zs(e,t){if(On(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Hl.call(t,c)||!On(e[c],t[c]))return!1}return!0}function W1(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function z1(e,t){var i=W1(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=W1(i)}}function Jf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ed(){for(var e=window,t=qo();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=qo(e.document)}return t}function mc(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 H2(e){var t=ed(),i=e.focusedElem,l=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&Jf(i.ownerDocument.documentElement,i)){if(l!==null&&mc(i)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=i.textContent.length,f=Math.min(l.start,c);l=l.end===void 0?f:Math.min(l.end,c),!e.extend&&f>l&&(c=l,l=f,f=c),c=z1(i,f);var p=z1(i,l);c&&p&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),f>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var G2=Jn&&"documentMode"in document&&11>=document.documentMode,Ei=null,uu=null,Ts=null,cu=!1;function V1(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;cu||Ei==null||Ei!==qo(l)||(l=Ei,"selectionStart"in l&&mc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ts&&zs(Ts,l)||(Ts=l,l=ia(uu,"onSelect"),0<l.length&&(t=new gc("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Ei)))}function _o(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ci={animationend:_o("Animation","AnimationEnd"),animationiteration:_o("Animation","AnimationIteration"),animationstart:_o("Animation","AnimationStart"),transitionend:_o("Transition","TransitionEnd")},El={},td={};Jn&&(td=document.createElement("div").style,"AnimationEvent"in window||(delete Ci.animationend.animation,delete Ci.animationiteration.animation,delete Ci.animationstart.animation),"TransitionEvent"in window||delete Ci.transitionend.transition);function Ra(e){if(El[e])return El[e];if(!Ci[e])return e;var t=Ci[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in td)return El[e]=t[i];return e}var nd=Ra("animationend"),rd=Ra("animationiteration"),id=Ra("animationstart"),sd=Ra("transitionend"),od=new Map,j1="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 Or(e,t){od.set(e,t),ti(t,[e])}for(var Cl=0;Cl<j1.length;Cl++){var Al=j1[Cl],X2=Al.toLowerCase(),Y2=Al[0].toUpperCase()+Al.slice(1);Or(X2,"on"+Y2)}Or(nd,"onAnimationEnd");Or(rd,"onAnimationIteration");Or(id,"onAnimationStart");Or("dblclick","onDoubleClick");Or("focusin","onFocus");Or("focusout","onBlur");Or(sd,"onTransitionEnd");Fi("onMouseEnter",["mouseout","mouseover"]);Fi("onMouseLeave",["mouseout","mouseover"]);Fi("onPointerEnter",["pointerout","pointerover"]);Fi("onPointerLeave",["pointerout","pointerover"]);ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ti("onBeforeInput",["compositionend","keypress","textInput","paste"]);ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Es="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(" "),Z2=new Set("cancel close invalid load scroll toggle".split(" ").concat(Es));function H1(e,t,i){var l=e.type||"unknown-event";e.currentTarget=i,Xg(l,t,void 0,e),e.currentTarget=null}function ad(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var f=void 0;if(t)for(var p=l.length-1;0<=p;p--){var w=l[p],C=w.instance,m=w.currentTarget;if(w=w.listener,C!==f&&c.isPropagationStopped())break e;H1(c,w,m),f=C}else for(p=0;p<l.length;p++){if(w=l[p],C=w.instance,m=w.currentTarget,w=w.listener,C!==f&&c.isPropagationStopped())break e;H1(c,w,m),f=C}}}if(Jo)throw e=su,Jo=!1,su=null,e}function je(e,t){var i=t[pu];i===void 0&&(i=t[pu]=new Set);var l=e+"__bubble";i.has(l)||(ld(t,e,2,!1),i.add(l))}function vl(e,t,i){var l=0;t&&(l|=4),ld(i,e,l,t)}var To="_reactListening"+Math.random().toString(36).slice(2);function Vs(e){if(!e[To]){e[To]=!0,pf.forEach(function(i){i!=="selectionchange"&&(Z2.has(i)||vl(i,!1,e),vl(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[To]||(t[To]=!0,vl("selectionchange",!1,t))}}function ld(e,t,i,l){switch(Gf(t)){case 1:var c=l2;break;case 4:c=u2;break;default:c=dc}i=c.bind(null,t,i,e),c=void 0,!iu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Sl(e,t,i,l,c){var f=l;if(!(t&1)&&!(t&2)&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var w=l.stateNode.containerInfo;if(w===c||w.nodeType===8&&w.parentNode===c)break;if(p===4)for(p=l.return;p!==null;){var C=p.tag;if((C===3||C===4)&&(C=p.stateNode.containerInfo,C===c||C.nodeType===8&&C.parentNode===c))return;p=p.return}for(;w!==null;){if(p=Gr(w),p===null)return;if(C=p.tag,C===5||C===6){l=f=p;continue e}w=w.parentNode}}l=l.return}Of(function(){var m=f,_=lc(i),v=[];e:{var R=od.get(e);if(R!==void 0){var M=gc,P=e;switch(e){case"keypress":if(zo(i)===0)break e;case"keydown":case"keyup":M=S2;break;case"focusin":P="focus",M=ml;break;case"focusout":P="blur",M=ml;break;case"beforeblur":case"afterblur":M=ml;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":M=D1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":M=d2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":M=T2;break;case nd:case rd:case id:M=p2;break;case sd:M=R2;break;case"scroll":M=c2;break;case"wheel":M=O2;break;case"copy":case"cut":case"paste":M=m2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":M=k1}var B=(t&4)!==0,K=!B&&e==="scroll",O=B?R!==null?R+"Capture":null:R;B=[];for(var T=m,N;T!==null;){N=T;var G=N.stateNode;if(N.tag===5&&G!==null&&(N=G,O!==null&&(G=Bs(T,O),G!=null&&B.push(js(T,G,N)))),K)break;T=T.return}0<B.length&&(R=new M(R,P,null,i,_),v.push({event:R,listeners:B}))}}if(!(t&7)){e:{if(R=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",R&&i!==nu&&(P=i.relatedTarget||i.fromElement)&&(Gr(P)||P[er]))break e;if((M||R)&&(R=_.window===_?_:(R=_.ownerDocument)?R.defaultView||R.parentWindow:window,M?(P=i.relatedTarget||i.toElement,M=m,P=P?Gr(P):null,P!==null&&(K=ni(P),P!==K||P.tag!==5&&P.tag!==6)&&(P=null)):(M=null,P=m),M!==P)){if(B=D1,G="onMouseLeave",O="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(B=k1,G="onPointerLeave",O="onPointerEnter",T="pointer"),K=M==null?R:Ai(M),N=P==null?R:Ai(P),R=new B(G,T+"leave",M,i,_),R.target=K,R.relatedTarget=N,G=null,Gr(_)===m&&(B=new B(O,T+"enter",P,i,_),B.target=N,B.relatedTarget=K,G=B),K=G,M&&P)t:{for(B=M,O=P,T=0,N=B;N;N=hi(N))T++;for(N=0,G=O;G;G=hi(G))N++;for(;0<T-N;)B=hi(B),T--;for(;0<N-T;)O=hi(O),N--;for(;T--;){if(B===O||O!==null&&B===O.alternate)break t;B=hi(B),O=hi(O)}B=null}else B=null;M!==null&&G1(v,R,M,B,!1),P!==null&&K!==null&&G1(v,K,P,B,!0)}}e:{if(R=m?Ai(m):window,M=R.nodeName&&R.nodeName.toLowerCase(),M==="select"||M==="input"&&R.type==="file")var j=F2;else if(L1(R))if(qf)j=V2;else{j=W2;var U=U2}else(M=R.nodeName)&&M.toLowerCase()==="input"&&(R.type==="checkbox"||R.type==="radio")&&(j=z2);if(j&&(j=j(e,m))){Qf(v,j,i,_);break e}U&&U(e,R,m),e==="focusout"&&(U=R._wrapperState)&&U.controlled&&R.type==="number"&&ql(R,"number",R.value)}switch(U=m?Ai(m):window,e){case"focusin":(L1(U)||U.contentEditable==="true")&&(Ei=U,uu=m,Ts=null);break;case"focusout":Ts=uu=Ei=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,V1(v,i,_);break;case"selectionchange":if(G2)break;case"keydown":case"keyup":V1(v,i,_)}var k;if(xc)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 yi?Zf(e,i)&&(X="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(X="onCompositionStart");X&&(Yf&&i.locale!=="ko"&&(yi||X!=="onCompositionStart"?X==="onCompositionEnd"&&yi&&(k=Xf()):(wr=_,hc="value"in wr?wr.value:wr.textContent,yi=!0)),U=ia(m,X),0<U.length&&(X=new M1(X,e,null,i,_),v.push({event:X,listeners:U}),k?X.data=k:(k=Kf(i),k!==null&&(X.data=k)))),(k=M2?k2(e,i):P2(e,i))&&(m=ia(m,"onBeforeInput"),0<m.length&&(_=new M1("onBeforeInput","beforeinput",null,i,_),v.push({event:_,listeners:m}),_.data=k))}ad(v,t)})}function js(e,t,i){return{instance:e,listener:t,currentTarget:i}}function ia(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,f=c.stateNode;c.tag===5&&f!==null&&(c=f,f=Bs(e,i),f!=null&&l.unshift(js(e,f,c)),f=Bs(e,t),f!=null&&l.push(js(e,f,c))),e=e.return}return l}function hi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function G1(e,t,i,l,c){for(var f=t._reactName,p=[];i!==null&&i!==l;){var w=i,C=w.alternate,m=w.stateNode;if(C!==null&&C===l)break;w.tag===5&&m!==null&&(w=m,c?(C=Bs(i,f),C!=null&&p.unshift(js(i,C,w))):c||(C=Bs(i,f),C!=null&&p.push(js(i,C,w)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var K2=/\r\n?/g,Q2=/\u0000|\uFFFD/g;function X1(e){return(typeof e=="string"?e:""+e).replace(K2,`
39
+ `).replace(Q2,"")}function No(e,t,i){if(t=X1(t),X1(e)!==t&&i)throw Error(Q(425))}function sa(){}var fu=null,du=null;function hu(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 gu=typeof setTimeout=="function"?setTimeout:void 0,q2=typeof clearTimeout=="function"?clearTimeout:void 0,Y1=typeof Promise=="function"?Promise:void 0,$2=typeof queueMicrotask=="function"?queueMicrotask:typeof Y1<"u"?function(e){return Y1.resolve(null).then(e).catch(J2)}:gu;function J2(e){setTimeout(function(){throw e})}function Il(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(l===0){e.removeChild(c),Us(t);return}l--}else i!=="$"&&i!=="$?"&&i!=="$!"||l++;i=c}while(i);Us(t)}function vr(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 Z1(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Ki=Math.random().toString(36).slice(2),Vn="__reactFiber$"+Ki,Hs="__reactProps$"+Ki,er="__reactContainer$"+Ki,pu="__reactEvents$"+Ki,ep="__reactListeners$"+Ki,tp="__reactHandles$"+Ki;function Gr(e){var t=e[Vn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[er]||i[Vn]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Z1(e);e!==null;){if(i=e[Vn])return i;e=Z1(e)}return t}e=i,i=e.parentNode}return null}function no(e){return e=e[Vn]||e[er],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function ba(e){return e[Hs]||null}var xu=[],vi=-1;function Dr(e){return{current:e}}function He(e){0>vi||(e.current=xu[vi],xu[vi]=null,vi--)}function ze(e,t){vi++,xu[vi]=e.current,e.current=t}var Rr={},Bt=Dr(Rr),$t=Dr(!1),Qr=Rr;function Ui(e,t){var i=e.type.contextTypes;if(!i)return Rr;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var c={},f;for(f in i)c[f]=t[f];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function Jt(e){return e=e.childContextTypes,e!=null}function oa(){He($t),He(Bt)}function K1(e,t,i){if(Bt.current!==Rr)throw Error(Q(168));ze(Bt,t),ze($t,i)}function ud(e,t,i){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return i;l=l.getChildContext();for(var c in l)if(!(c in t))throw Error(Q(108,Ug(e)||"Unknown",c));return et({},i,l)}function aa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Rr,Qr=Bt.current,ze(Bt,e),ze($t,$t.current),!0}function Q1(e,t,i){var l=e.stateNode;if(!l)throw Error(Q(169));i?(e=ud(e,t,Qr),l.__reactInternalMemoizedMergedChildContext=e,He($t),He(Bt),ze(Bt,e)):He($t),ze($t,i)}var Kn=null,Oa=!1,_l=!1;function cd(e){Kn===null?Kn=[e]:Kn.push(e)}function np(e){Oa=!0,cd(e)}function Mr(){if(!_l&&Kn!==null){_l=!0;var e=0,t=ke;try{var i=Kn;for(ke=1;e<i.length;e++){var l=i[e];do l=l(!0);while(l!==null)}Kn=null,Oa=!1}catch(c){throw Kn!==null&&(Kn=Kn.slice(e+1)),Pf(uc,Mr),c}finally{ke=t,_l=!1}}return null}var Si=[],Ii=0,la=null,ua=0,pn=[],xn=0,qr=null,Qn=1,qn="";function Vr(e,t){Si[Ii++]=ua,Si[Ii++]=la,la=e,ua=t}function fd(e,t,i){pn[xn++]=Qn,pn[xn++]=qn,pn[xn++]=qr,qr=e;var l=Qn;e=qn;var c=32-Rn(l)-1;l&=~(1<<c),i+=1;var f=32-Rn(t)+c;if(30<f){var p=c-c%5;f=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Qn=1<<32-Rn(t)+c|i<<c|l,qn=f+e}else Qn=1<<f|i<<c|l,qn=e}function wc(e){e.return!==null&&(Vr(e,1),fd(e,1,0))}function yc(e){for(;e===la;)la=Si[--Ii],Si[Ii]=null,ua=Si[--Ii],Si[Ii]=null;for(;e===qr;)qr=pn[--xn],pn[xn]=null,qn=pn[--xn],pn[xn]=null,Qn=pn[--xn],pn[xn]=null}var on=null,sn=null,Ze=!1,Nn=null;function dd(e,t){var i=mn(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function q1(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,on=e,sn=vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,on=e,sn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=qr!==null?{id:Qn,overflow:qn}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=mn(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,on=e,sn=null,!0):!1;default:return!1}}function mu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wu(e){if(Ze){var t=sn;if(t){var i=t;if(!q1(e,t)){if(mu(e))throw Error(Q(418));t=vr(i.nextSibling);var l=on;t&&q1(e,t)?dd(l,i):(e.flags=e.flags&-4097|2,Ze=!1,on=e)}}else{if(mu(e))throw Error(Q(418));e.flags=e.flags&-4097|2,Ze=!1,on=e}}}function $1(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;on=e}function Ro(e){if(e!==on)return!1;if(!Ze)return $1(e),Ze=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!hu(e.type,e.memoizedProps)),t&&(t=sn)){if(mu(e))throw hd(),Error(Q(418));for(;t;)dd(e,t),t=vr(t.nextSibling)}if($1(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){sn=vr(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}sn=null}}else sn=on?vr(e.stateNode.nextSibling):null;return!0}function hd(){for(var e=sn;e;)e=vr(e.nextSibling)}function Wi(){sn=on=null,Ze=!1}function Ec(e){Nn===null?Nn=[e]:Nn.push(e)}var rp=rr.ReactCurrentBatchConfig;function gs(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(Q(309));var l=i.stateNode}if(!l)throw Error(Q(147,e));var c=l,f=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===f?t.ref:(t=function(p){var w=c.refs;p===null?delete w[f]:w[f]=p},t._stringRef=f,t)}if(typeof e!="string")throw Error(Q(284));if(!i._owner)throw Error(Q(290,e))}return e}function bo(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function J1(e){var t=e._init;return t(e._payload)}function gd(e){function t(O,T){if(e){var N=O.deletions;N===null?(O.deletions=[T],O.flags|=16):N.push(T)}}function i(O,T){if(!e)return null;for(;T!==null;)t(O,T),T=T.sibling;return null}function l(O,T){for(O=new Map;T!==null;)T.key!==null?O.set(T.key,T):O.set(T.index,T),T=T.sibling;return O}function c(O,T){return O=Tr(O,T),O.index=0,O.sibling=null,O}function f(O,T,N){return O.index=N,e?(N=O.alternate,N!==null?(N=N.index,N<T?(O.flags|=2,T):N):(O.flags|=2,T)):(O.flags|=1048576,T)}function p(O){return e&&O.alternate===null&&(O.flags|=2),O}function w(O,T,N,G){return T===null||T.tag!==6?(T=Ml(N,O.mode,G),T.return=O,T):(T=c(T,N),T.return=O,T)}function C(O,T,N,G){var j=N.type;return j===wi?_(O,T,N.props.children,G,N.key):T!==null&&(T.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===hr&&J1(j)===T.type)?(G=c(T,N.props),G.ref=gs(O,T,N),G.return=O,G):(G=Zo(N.type,N.key,N.props,null,O.mode,G),G.ref=gs(O,T,N),G.return=O,G)}function m(O,T,N,G){return T===null||T.tag!==4||T.stateNode.containerInfo!==N.containerInfo||T.stateNode.implementation!==N.implementation?(T=kl(N,O.mode,G),T.return=O,T):(T=c(T,N.children||[]),T.return=O,T)}function _(O,T,N,G,j){return T===null||T.tag!==7?(T=Kr(N,O.mode,G,j),T.return=O,T):(T=c(T,N),T.return=O,T)}function v(O,T,N){if(typeof T=="string"&&T!==""||typeof T=="number")return T=Ml(""+T,O.mode,N),T.return=O,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case yo:return N=Zo(T.type,T.key,T.props,null,O.mode,N),N.ref=gs(O,null,T),N.return=O,N;case mi:return T=kl(T,O.mode,N),T.return=O,T;case hr:var G=T._init;return v(O,G(T._payload),N)}if(ws(T)||us(T))return T=Kr(T,O.mode,N,null),T.return=O,T;bo(O,T)}return null}function R(O,T,N,G){var j=T!==null?T.key:null;if(typeof N=="string"&&N!==""||typeof N=="number")return j!==null?null:w(O,T,""+N,G);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case yo:return N.key===j?C(O,T,N,G):null;case mi:return N.key===j?m(O,T,N,G):null;case hr:return j=N._init,R(O,T,j(N._payload),G)}if(ws(N)||us(N))return j!==null?null:_(O,T,N,G,null);bo(O,N)}return null}function M(O,T,N,G,j){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(N)||null,w(T,O,""+G,j);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case yo:return O=O.get(G.key===null?N:G.key)||null,C(T,O,G,j);case mi:return O=O.get(G.key===null?N:G.key)||null,m(T,O,G,j);case hr:var U=G._init;return M(O,T,N,U(G._payload),j)}if(ws(G)||us(G))return O=O.get(N)||null,_(T,O,G,j,null);bo(T,G)}return null}function P(O,T,N,G){for(var j=null,U=null,k=T,X=T=0,V=null;k!==null&&X<N.length;X++){k.index>X?(V=k,k=null):V=k.sibling;var oe=R(O,k,N[X],G);if(oe===null){k===null&&(k=V);break}e&&k&&oe.alternate===null&&t(O,k),T=f(oe,T,X),U===null?j=oe:U.sibling=oe,U=oe,k=V}if(X===N.length)return i(O,k),Ze&&Vr(O,X),j;if(k===null){for(;X<N.length;X++)k=v(O,N[X],G),k!==null&&(T=f(k,T,X),U===null?j=k:U.sibling=k,U=k);return Ze&&Vr(O,X),j}for(k=l(O,k);X<N.length;X++)V=M(k,O,X,N[X],G),V!==null&&(e&&V.alternate!==null&&k.delete(V.key===null?X:V.key),T=f(V,T,X),U===null?j=V:U.sibling=V,U=V);return e&&k.forEach(function(Ee){return t(O,Ee)}),Ze&&Vr(O,X),j}function B(O,T,N,G){var j=us(N);if(typeof j!="function")throw Error(Q(150));if(N=j.call(N),N==null)throw Error(Q(151));for(var U=j=null,k=T,X=T=0,V=null,oe=N.next();k!==null&&!oe.done;X++,oe=N.next()){k.index>X?(V=k,k=null):V=k.sibling;var Ee=R(O,k,oe.value,G);if(Ee===null){k===null&&(k=V);break}e&&k&&Ee.alternate===null&&t(O,k),T=f(Ee,T,X),U===null?j=Ee:U.sibling=Ee,U=Ee,k=V}if(oe.done)return i(O,k),Ze&&Vr(O,X),j;if(k===null){for(;!oe.done;X++,oe=N.next())oe=v(O,oe.value,G),oe!==null&&(T=f(oe,T,X),U===null?j=oe:U.sibling=oe,U=oe);return Ze&&Vr(O,X),j}for(k=l(O,k);!oe.done;X++,oe=N.next())oe=M(k,O,X,oe.value,G),oe!==null&&(e&&oe.alternate!==null&&k.delete(oe.key===null?X:oe.key),T=f(oe,T,X),U===null?j=oe:U.sibling=oe,U=oe);return e&&k.forEach(function(se){return t(O,se)}),Ze&&Vr(O,X),j}function K(O,T,N,G){if(typeof N=="object"&&N!==null&&N.type===wi&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case yo:e:{for(var j=N.key,U=T;U!==null;){if(U.key===j){if(j=N.type,j===wi){if(U.tag===7){i(O,U.sibling),T=c(U,N.props.children),T.return=O,O=T;break e}}else if(U.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===hr&&J1(j)===U.type){i(O,U.sibling),T=c(U,N.props),T.ref=gs(O,U,N),T.return=O,O=T;break e}i(O,U);break}else t(O,U);U=U.sibling}N.type===wi?(T=Kr(N.props.children,O.mode,G,N.key),T.return=O,O=T):(G=Zo(N.type,N.key,N.props,null,O.mode,G),G.ref=gs(O,T,N),G.return=O,O=G)}return p(O);case mi:e:{for(U=N.key;T!==null;){if(T.key===U)if(T.tag===4&&T.stateNode.containerInfo===N.containerInfo&&T.stateNode.implementation===N.implementation){i(O,T.sibling),T=c(T,N.children||[]),T.return=O,O=T;break e}else{i(O,T);break}else t(O,T);T=T.sibling}T=kl(N,O.mode,G),T.return=O,O=T}return p(O);case hr:return U=N._init,K(O,T,U(N._payload),G)}if(ws(N))return P(O,T,N,G);if(us(N))return B(O,T,N,G);bo(O,N)}return typeof N=="string"&&N!==""||typeof N=="number"?(N=""+N,T!==null&&T.tag===6?(i(O,T.sibling),T=c(T,N),T.return=O,O=T):(i(O,T),T=Ml(N,O.mode,G),T.return=O,O=T),p(O)):i(O,T)}return K}var zi=gd(!0),pd=gd(!1),ca=Dr(null),fa=null,_i=null,Cc=null;function Ac(){Cc=_i=fa=null}function vc(e){var t=ca.current;He(ca),e._currentValue=t}function yu(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Pi(e,t){fa=e,Cc=_i=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function yn(e){var t=e._currentValue;if(Cc!==e)if(e={context:e,memoizedValue:t,next:null},_i===null){if(fa===null)throw Error(Q(308));_i=e,fa.dependencies={lanes:0,firstContext:e}}else _i=_i.next=e;return t}var Xr=null;function Sc(e){Xr===null?Xr=[e]:Xr.push(e)}function xd(e,t,i,l){var c=t.interleaved;return c===null?(i.next=i,Sc(t)):(i.next=c.next,c.next=i),t.interleaved=i,tr(e,l)}function tr(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var gr=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function md(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 $n(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Sr(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,Re&2){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,tr(e,i)}return c=l.interleaved,c===null?(t.next=t,Sc(l)):(t.next=c.next,c.next=t),l.interleaved=t,tr(e,i)}function Vo(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,cc(e,i)}}function e0(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var p={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};f===null?c=f=p:f=f.next=p,i=i.next}while(i!==null);f===null?c=f=t:f=f.next=t}else c=f=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:f,shared:l.shared,effects:l.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function da(e,t,i,l){var c=e.updateQueue;gr=!1;var f=c.firstBaseUpdate,p=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var C=w,m=C.next;C.next=null,p===null?f=m:p.next=m,p=C;var _=e.alternate;_!==null&&(_=_.updateQueue,w=_.lastBaseUpdate,w!==p&&(w===null?_.firstBaseUpdate=m:w.next=m,_.lastBaseUpdate=C))}if(f!==null){var v=c.baseState;p=0,_=m=C=null,w=f;do{var R=w.lane,M=w.eventTime;if((l&R)===R){_!==null&&(_=_.next={eventTime:M,lane:0,tag:w.tag,payload:w.payload,callback:w.callback,next:null});e:{var P=e,B=w;switch(R=t,M=i,B.tag){case 1:if(P=B.payload,typeof P=="function"){v=P.call(M,v,R);break e}v=P;break e;case 3:P.flags=P.flags&-65537|128;case 0:if(P=B.payload,R=typeof P=="function"?P.call(M,v,R):P,R==null)break e;v=et({},v,R);break e;case 2:gr=!0}}w.callback!==null&&w.lane!==0&&(e.flags|=64,R=c.effects,R===null?c.effects=[w]:R.push(w))}else M={eventTime:M,lane:R,tag:w.tag,payload:w.payload,callback:w.callback,next:null},_===null?(m=_=M,C=v):_=_.next=M,p|=R;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;R=w,w=R.next,R.next=null,c.lastBaseUpdate=R,c.shared.pending=null}}while(!0);if(_===null&&(C=v),c.baseState=C,c.firstBaseUpdate=m,c.lastBaseUpdate=_,t=c.shared.interleaved,t!==null){c=t;do p|=c.lane,c=c.next;while(c!==t)}else f===null&&(c.shared.lanes=0);Jr|=p,e.lanes=p,e.memoizedState=v}}function t0(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],c=l.callback;if(c!==null){if(l.callback=null,l=i,typeof c!="function")throw Error(Q(191,c));c.call(l)}}}var ro={},Hn=Dr(ro),Gs=Dr(ro),Xs=Dr(ro);function Yr(e){if(e===ro)throw Error(Q(174));return e}function _c(e,t){switch(ze(Xs,t),ze(Gs,e),ze(Hn,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Jl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Jl(t,e)}He(Hn),ze(Hn,t)}function Vi(){He(Hn),He(Gs),He(Xs)}function wd(e){Yr(Xs.current);var t=Yr(Hn.current),i=Jl(t,e.type);t!==i&&(ze(Gs,e),ze(Hn,i))}function Tc(e){Gs.current===e&&(He(Hn),He(Gs))}var $e=Dr(0);function ha(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.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 Tl=[];function Nc(){for(var e=0;e<Tl.length;e++)Tl[e]._workInProgressVersionPrimary=null;Tl.length=0}var jo=rr.ReactCurrentDispatcher,Nl=rr.ReactCurrentBatchConfig,$r=0,Je=null,xt=null,Ct=null,ga=!1,Ns=!1,Ys=0,ip=0;function Dt(){throw Error(Q(321))}function Rc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!On(e[i],t[i]))return!1;return!0}function bc(e,t,i,l,c,f){if($r=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,jo.current=e===null||e.memoizedState===null?lp:up,e=i(l,c),Ns){f=0;do{if(Ns=!1,Ys=0,25<=f)throw Error(Q(301));f+=1,Ct=xt=null,t.updateQueue=null,jo.current=cp,e=i(l,c)}while(Ns)}if(jo.current=pa,t=xt!==null&&xt.next!==null,$r=0,Ct=xt=Je=null,ga=!1,t)throw Error(Q(300));return e}function Oc(){var e=Ys!==0;return Ys=0,e}function zn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?Je.memoizedState=Ct=e:Ct=Ct.next=e,Ct}function En(){if(xt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=xt.next;var t=Ct===null?Je.memoizedState:Ct.next;if(t!==null)Ct=t,xt=e;else{if(e===null)throw Error(Q(310));xt=e,e={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Ct===null?Je.memoizedState=Ct=e:Ct=Ct.next=e}return Ct}function Zs(e,t){return typeof t=="function"?t(e):t}function Rl(e){var t=En(),i=t.queue;if(i===null)throw Error(Q(311));i.lastRenderedReducer=e;var l=xt,c=l.baseQueue,f=i.pending;if(f!==null){if(c!==null){var p=c.next;c.next=f.next,f.next=p}l.baseQueue=c=f,i.pending=null}if(c!==null){f=c.next,l=l.baseState;var w=p=null,C=null,m=f;do{var _=m.lane;if(($r&_)===_)C!==null&&(C=C.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),l=m.hasEagerState?m.eagerState:e(l,m.action);else{var v={lane:_,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};C===null?(w=C=v,p=l):C=C.next=v,Je.lanes|=_,Jr|=_}m=m.next}while(m!==null&&m!==f);C===null?p=l:C.next=w,On(l,t.memoizedState)||(qt=!0),t.memoizedState=l,t.baseState=p,t.baseQueue=C,i.lastRenderedState=l}if(e=i.interleaved,e!==null){c=e;do f=c.lane,Je.lanes|=f,Jr|=f,c=c.next;while(c!==e)}else c===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function bl(e){var t=En(),i=t.queue;if(i===null)throw Error(Q(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,f=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do f=e(f,p.action),p=p.next;while(p!==c);On(f,t.memoizedState)||(qt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),i.lastRenderedState=f}return[f,l]}function yd(){}function Ed(e,t){var i=Je,l=En(),c=t(),f=!On(l.memoizedState,c);if(f&&(l.memoizedState=c,qt=!0),l=l.queue,Dc(vd.bind(null,i,l,e),[e]),l.getSnapshot!==t||f||Ct!==null&&Ct.memoizedState.tag&1){if(i.flags|=2048,Ks(9,Ad.bind(null,i,l,c,t),void 0,null),At===null)throw Error(Q(349));$r&30||Cd(i,t,c)}return c}function Cd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ad(e,t,i,l){t.value=i,t.getSnapshot=l,Sd(t)&&Id(e)}function vd(e,t,i){return i(function(){Sd(t)&&Id(e)})}function Sd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!On(e,i)}catch{return!0}}function Id(e){var t=tr(e,1);t!==null&&bn(t,e,1,-1)}function n0(e){var t=zn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:e},t.queue=e,e=e.dispatch=ap.bind(null,Je,e),[t.memoizedState,e]}function Ks(e,t,i,l){return e={tag:e,create:t,destroy:i,deps:l,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e)),e}function _d(){return En().memoizedState}function Ho(e,t,i,l){var c=zn();Je.flags|=e,c.memoizedState=Ks(1|t,i,void 0,l===void 0?null:l)}function Da(e,t,i,l){var c=En();l=l===void 0?null:l;var f=void 0;if(xt!==null){var p=xt.memoizedState;if(f=p.destroy,l!==null&&Rc(l,p.deps)){c.memoizedState=Ks(t,i,f,l);return}}Je.flags|=e,c.memoizedState=Ks(1|t,i,f,l)}function r0(e,t){return Ho(8390656,8,e,t)}function Dc(e,t){return Da(2048,8,e,t)}function Td(e,t){return Da(4,2,e,t)}function Nd(e,t){return Da(4,4,e,t)}function Rd(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 bd(e,t,i){return i=i!=null?i.concat([e]):null,Da(4,4,Rd.bind(null,t,e),i)}function Mc(){}function Od(e,t){var i=En();t=t===void 0?null:t;var l=i.memoizedState;return l!==null&&t!==null&&Rc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Dd(e,t){var i=En();t=t===void 0?null:t;var l=i.memoizedState;return l!==null&&t!==null&&Rc(t,l[1])?l[0]:(e=e(),i.memoizedState=[e,t],e)}function Md(e,t,i){return $r&21?(On(i,t)||(i=Ff(),Je.lanes|=i,Jr|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qt=!0),e.memoizedState=i)}function sp(e,t){var i=ke;ke=i!==0&&4>i?i:4,e(!0);var l=Nl.transition;Nl.transition={};try{e(!1),t()}finally{ke=i,Nl.transition=l}}function kd(){return En().memoizedState}function op(e,t,i){var l=_r(e);if(i={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null},Pd(e))Bd(t,i);else if(i=xd(e,t,i,l),i!==null){var c=Wt();bn(i,e,l,c),Ld(i,t,l)}}function ap(e,t,i){var l=_r(e),c={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null};if(Pd(e))Bd(t,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var p=t.lastRenderedState,w=f(p,i);if(c.hasEagerState=!0,c.eagerState=w,On(w,p)){var C=t.interleaved;C===null?(c.next=c,Sc(t)):(c.next=C.next,C.next=c),t.interleaved=c;return}}catch{}finally{}i=xd(e,t,c,l),i!==null&&(c=Wt(),bn(i,e,l,c),Ld(i,t,l))}}function Pd(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Bd(e,t){Ns=ga=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Ld(e,t,i){if(i&4194240){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,cc(e,i)}}var pa={readContext:yn,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},lp={readContext:yn,useCallback:function(e,t){return zn().memoizedState=[e,t===void 0?null:t],e},useContext:yn,useEffect:r0,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Ho(4194308,4,Rd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ho(4,2,e,t)},useMemo:function(e,t){var i=zn();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var l=zn();return t=i!==void 0?i(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=op.bind(null,Je,e),[l.memoizedState,e]},useRef:function(e){var t=zn();return e={current:e},t.memoizedState=e},useState:n0,useDebugValue:Mc,useDeferredValue:function(e){return zn().memoizedState=e},useTransition:function(){var e=n0(!1),t=e[0];return e=sp.bind(null,e[1]),zn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var l=Je,c=zn();if(Ze){if(i===void 0)throw Error(Q(407));i=i()}else{if(i=t(),At===null)throw Error(Q(349));$r&30||Cd(l,t,i)}c.memoizedState=i;var f={value:i,getSnapshot:t};return c.queue=f,r0(vd.bind(null,l,f,e),[e]),l.flags|=2048,Ks(9,Ad.bind(null,l,f,i,t),void 0,null),i},useId:function(){var e=zn(),t=At.identifierPrefix;if(Ze){var i=qn,l=Qn;i=(l&~(1<<32-Rn(l)-1)).toString(32)+i,t=":"+t+"R"+i,i=Ys++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=ip++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},up={readContext:yn,useCallback:Od,useContext:yn,useEffect:Dc,useImperativeHandle:bd,useInsertionEffect:Td,useLayoutEffect:Nd,useMemo:Dd,useReducer:Rl,useRef:_d,useState:function(){return Rl(Zs)},useDebugValue:Mc,useDeferredValue:function(e){var t=En();return Md(t,xt.memoizedState,e)},useTransition:function(){var e=Rl(Zs)[0],t=En().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:Ed,useId:kd,unstable_isNewReconciler:!1},cp={readContext:yn,useCallback:Od,useContext:yn,useEffect:Dc,useImperativeHandle:bd,useInsertionEffect:Td,useLayoutEffect:Nd,useMemo:Dd,useReducer:bl,useRef:_d,useState:function(){return bl(Zs)},useDebugValue:Mc,useDeferredValue:function(e){var t=En();return xt===null?t.memoizedState=e:Md(t,xt.memoizedState,e)},useTransition:function(){var e=bl(Zs)[0],t=En().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:Ed,useId:kd,unstable_isNewReconciler:!1};function _n(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function Eu(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:et({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Ma={isMounted:function(e){return(e=e._reactInternals)?ni(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Wt(),c=_r(e),f=$n(l,c);f.payload=t,i!=null&&(f.callback=i),t=Sr(e,f,c),t!==null&&(bn(t,e,c,l),Vo(t,e,c))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Wt(),c=_r(e),f=$n(l,c);f.tag=1,f.payload=t,i!=null&&(f.callback=i),t=Sr(e,f,c),t!==null&&(bn(t,e,c,l),Vo(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Wt(),l=_r(e),c=$n(i,l);c.tag=2,t!=null&&(c.callback=t),t=Sr(e,c,l),t!==null&&(bn(t,e,l,i),Vo(t,e,l))}};function i0(e,t,i,l,c,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,f,p):t.prototype&&t.prototype.isPureReactComponent?!zs(i,l)||!zs(c,f):!0}function Fd(e,t,i){var l=!1,c=Rr,f=t.contextType;return typeof f=="object"&&f!==null?f=yn(f):(c=Jt(t)?Qr:Bt.current,l=t.contextTypes,f=(l=l!=null)?Ui(e,c):Rr),t=new t(i,f),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ma,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=f),t}function s0(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&Ma.enqueueReplaceState(t,t.state,null)}function Cu(e,t,i,l){var c=e.stateNode;c.props=i,c.state=e.memoizedState,c.refs={},Ic(e);var f=t.contextType;typeof f=="object"&&f!==null?c.context=yn(f):(f=Jt(t)?Qr:Bt.current,c.context=Ui(e,f)),c.state=e.memoizedState,f=t.getDerivedStateFromProps,typeof f=="function"&&(Eu(e,t,f,i),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&&Ma.enqueueReplaceState(c,c.state,null),da(e,i,c,l),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function ji(e,t){try{var i="",l=t;do i+=Fg(l),l=l.return;while(l);var c=i}catch(f){c=`
40
40
  Error generating stack: `+f.message+`
41
- `+f.stack}return{value:e,source:t,stack:c,digest:null}}function Ol(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function Au(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var fp=typeof WeakMap=="function"?WeakMap:Map;function Ud(e,t,i){i=$n(-1,i),i.tag=3,i.payload={element:null};var l=t.value;return i.callback=function(){ma||(ma=!0,Du=l),Au(e,t)},i}function Wd(e,t,i){i=$n(-1,i),i.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var c=t.value;i.payload=function(){return l(c)},i.callback=function(){Au(e,t)}}var f=e.stateNode;return f!==null&&typeof f.componentDidCatch=="function"&&(i.callback=function(){Au(e,t),typeof l!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var p=t.stack;this.componentDidCatch(t.value,{componentStack:p!==null?p:""})}),i}function o0(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new fp;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(c.add(i),e=Ip.bind(null,e,t,i),t.then(e,e))}function a0(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 l0(e,t,i,l,c){return e.mode&1?(e.flags|=65536,e.lanes=c,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=$n(-1,1),t.tag=2,Sr(i,t,1))),i.lanes|=1),e)}var dp=rr.ReactCurrentOwner,qt=!1;function Ut(e,t,i,l){t.child=e===null?pd(t,null,i,l):zi(t,e.child,i,l)}function u0(e,t,i,l,c){i=i.render;var f=t.ref;return Pi(t,c),l=bc(e,t,i,l,f,c),i=Oc(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,nr(e,t,c)):(Ze&&i&&wc(t),t.flags|=1,Ut(e,t,l,c),t.child)}function c0(e,t,i,l,c){if(e===null){var f=i.type;return typeof f=="function"&&!zc(f)&&f.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=f,zd(e,t,f,l,c)):(e=Zo(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!(e.lanes&c)){var p=f.memoizedProps;if(i=i.compare,i=i!==null?i:zs,i(p,l)&&e.ref===t.ref)return nr(e,t,c)}return t.flags|=1,e=Tr(f,l),e.ref=t.ref,e.return=t,t.child=e}function zd(e,t,i,l,c){if(e!==null){var f=e.memoizedProps;if(zs(f,l)&&e.ref===t.ref)if(qt=!1,t.pendingProps=l=f,(e.lanes&c)!==0)e.flags&131072&&(qt=!0);else return t.lanes=e.lanes,nr(e,t,c)}return vu(e,t,i,l,c)}function Vd(e,t,i){var l=t.pendingProps,c=l.children,f=e!==null?e.memoizedState:null;if(l.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(Ni,rn),rn|=i;else{if(!(i&1073741824))return e=f!==null?f.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(Ni,rn),rn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=f!==null?f.baseLanes:i,ze(Ni,rn),rn|=l}else f!==null?(l=f.baseLanes|i,t.memoizedState=null):l=i,ze(Ni,rn),rn|=l;return Ut(e,t,c,i),t.child}function Hd(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function vu(e,t,i,l,c){var f=Jt(i)?Qr:Bt.current;return f=Ui(t,f),Pi(t,c),i=bc(e,t,i,l,f,c),l=Oc(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,nr(e,t,c)):(Ze&&l&&wc(t),t.flags|=1,Ut(e,t,i,c),t.child)}function f0(e,t,i,l,c){if(Jt(i)){var f=!0;aa(t)}else f=!1;if(Pi(t,c),t.stateNode===null)Go(e,t),Fd(t,i,l),Cu(t,i,l,c),l=!0;else if(e===null){var p=t.stateNode,w=t.memoizedProps;p.props=w;var C=p.context,m=i.contextType;typeof m=="object"&&m!==null?m=yn(m):(m=Jt(i)?Qr:Bt.current,m=Ui(t,m));var _=i.getDerivedStateFromProps,v=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function";v||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==l||C!==m)&&s0(t,p,l,m),gr=!1;var R=t.memoizedState;p.state=R,da(t,l,p,c),C=t.memoizedState,w!==l||R!==C||$t.current||gr?(typeof _=="function"&&(Eu(t,i,_,l),C=t.memoizedState),(w=gr||i0(t,i,w,l,R,C,m))?(v||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=C),p.props=l,p.state=C,p.context=m,l=w):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{p=t.stateNode,md(e,t),w=t.memoizedProps,m=t.type===t.elementType?w:_n(t.type,w),p.props=m,v=t.pendingProps,R=p.context,C=i.contextType,typeof C=="object"&&C!==null?C=yn(C):(C=Jt(i)?Qr:Bt.current,C=Ui(t,C));var M=i.getDerivedStateFromProps;(_=typeof M=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==v||R!==C)&&s0(t,p,l,C),gr=!1,R=t.memoizedState,p.state=R,da(t,l,p,c);var P=t.memoizedState;w!==v||R!==P||$t.current||gr?(typeof M=="function"&&(Eu(t,i,M,l),P=t.memoizedState),(m=gr||i0(t,i,m,l,R,P,C)||!1)?(_||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,P,C),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,P,C)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),p.props=l,p.state=P,p.context=C,l=m):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),l=!1)}return Su(e,t,i,l,f,c)}function Su(e,t,i,l,c,f){Hd(e,t);var p=(t.flags&128)!==0;if(!l&&!p)return c&&Q1(t,i,!1),nr(e,t,f);l=t.stateNode,dp.current=t;var w=p&&typeof i.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&p?(t.child=zi(t,e.child,null,f),t.child=zi(t,null,w,f)):Ut(e,t,w,f),t.memoizedState=l.state,c&&Q1(t,i,!0),t.child}function jd(e){var t=e.stateNode;t.pendingContext?K1(e,t.pendingContext,t.pendingContext!==t.context):t.context&&K1(e,t.context,!1),_c(e,t.containerInfo)}function d0(e,t,i,l,c){return Wi(),Ec(c),t.flags|=256,Ut(e,t,i,l),t.child}var Iu={dehydrated:null,treeContext:null,retryLane:0};function _u(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gd(e,t,i){var l=t.pendingProps,c=$e.current,f=!1,p=(t.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(c&2)!==0),w?(f=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),ze($e,c&1),e===null)return wu(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):(p=l.children,e=l.fallback,f?(l=t.mode,f=t.child,p={mode:"hidden",children:p},!(l&1)&&f!==null?(f.childLanes=0,f.pendingProps=p):f=Ba(p,l,0,null),e=Kr(e,l,i,null),f.return=t,e.return=t,f.sibling=e,t.child=f,t.child.memoizedState=_u(i),t.memoizedState=Iu,e):kc(t,p));if(c=e.memoizedState,c!==null&&(w=c.dehydrated,w!==null))return hp(e,t,p,l,w,c,i);if(f){f=l.fallback,p=t.mode,c=e.child,w=c.sibling;var C={mode:"hidden",children:l.children};return!(p&1)&&t.child!==c?(l=t.child,l.childLanes=0,l.pendingProps=C,t.deletions=null):(l=Tr(c,C),l.subtreeFlags=c.subtreeFlags&14680064),w!==null?f=Tr(w,f):(f=Kr(f,p,i,null),f.flags|=2),f.return=t,l.return=t,l.sibling=f,t.child=l,l=f,f=t.child,p=e.child.memoizedState,p=p===null?_u(i):{baseLanes:p.baseLanes|i,cachePool:null,transitions:p.transitions},f.memoizedState=p,f.childLanes=e.childLanes&~i,t.memoizedState=Iu,l}return f=e.child,e=f.sibling,l=Tr(f,{mode:"visible",children:l.children}),!(t.mode&1)&&(l.lanes=i),l.return=t,l.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=l,t.memoizedState=null,l}function kc(e,t){return t=Ba({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Oo(e,t,i,l){return l!==null&&Ec(l),zi(t,e.child,null,i),e=kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hp(e,t,i,l,c,f,p){if(i)return t.flags&256?(t.flags&=-257,l=Ol(Error(Q(422))),Oo(e,t,p,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(f=l.fallback,c=t.mode,l=Ba({mode:"visible",children:l.children},c,0,null),f=Kr(f,c,p,null),f.flags|=2,l.return=t,f.return=t,l.sibling=f,t.child=l,t.mode&1&&zi(t,e.child,null,p),t.child.memoizedState=_u(p),t.memoizedState=Iu,f);if(!(t.mode&1))return Oo(e,t,p,null);if(c.data==="$!"){if(l=c.nextSibling&&c.nextSibling.dataset,l)var w=l.dgst;return l=w,f=Error(Q(419)),l=Ol(f,l,void 0),Oo(e,t,p,l)}if(w=(p&e.childLanes)!==0,qt||w){if(l=At,l!==null){switch(p&-p){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&(l.suspendedLanes|p)?0:c,c!==0&&c!==f.retryLane&&(f.retryLane=c,tr(e,c),bn(l,e,c,-1))}return Wc(),l=Ol(Error(Q(421))),Oo(e,t,p,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=_p.bind(null,e),c._reactRetry=t,null):(e=f.treeContext,sn=vr(c.nextSibling),on=t,Ze=!0,Nn=null,e!==null&&(pn[xn++]=Qn,pn[xn++]=qn,pn[xn++]=qr,Qn=e.id,qn=e.overflow,qr=t),t=kc(t,l.children),t.flags|=4096,t)}function h0(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),yu(e.return,t,i)}function Dl(e,t,i,l,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=l,f.tail=i,f.tailMode=c)}function Xd(e,t,i){var l=t.pendingProps,c=l.revealOrder,f=l.tail;if(Ut(e,t,l.children,i),l=$e.current,l&2)l=l&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&&h0(e,i,t);else if(e.tag===19)h0(e,i,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}l&=1}if(ze($e,l),!(t.mode&1))t.memoizedState=null;else switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&ha(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),Dl(t,!1,c,i,f);break;case"backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ha(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}Dl(t,!0,i,null,f);break;case"together":Dl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Go(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function nr(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Jr|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,i=Tr(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Tr(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gp(e,t,i){switch(t.tag){case 3:jd(t),Wi();break;case 5:wd(t);break;case 1:Jt(t.type)&&aa(t);break;case 4:_c(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;ze(ca,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(ze($e,$e.current&1),t.flags|=128,null):i&t.child.childLanes?Gd(e,t,i):(ze($e,$e.current&1),e=nr(e,t,i),e!==null?e.sibling:null);ze($e,$e.current&1);break;case 19:if(l=(i&t.childLanes)!==0,e.flags&128){if(l)return Xd(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ze($e,$e.current),l)break;return null;case 22:case 23:return t.lanes=0,Vd(e,t,i)}return nr(e,t,i)}var Yd,Tu,Zd,Kd;Yd=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Tu=function(){};Zd=function(e,t,i,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,Yr(jn.current);var f=null;switch(i){case"input":c=Kl(e,c),l=Kl(e,l),f=[];break;case"select":c=et({},c,{value:void 0}),l=et({},l,{value:void 0}),f=[];break;case"textarea":c=$l(e,c),l=$l(e,l),f=[];break;default:typeof c.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=sa)}eu(i,l);var p;i=null;for(m in c)if(!l.hasOwnProperty(m)&&c.hasOwnProperty(m)&&c[m]!=null)if(m==="style"){var w=c[m];for(p in w)w.hasOwnProperty(p)&&(i||(i={}),i[p]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(ks.hasOwnProperty(m)?f||(f=[]):(f=f||[]).push(m,null));for(m in l){var C=l[m];if(w=c!=null?c[m]:void 0,l.hasOwnProperty(m)&&C!==w&&(C!=null||w!=null))if(m==="style")if(w){for(p in w)!w.hasOwnProperty(p)||C&&C.hasOwnProperty(p)||(i||(i={}),i[p]="");for(p in C)C.hasOwnProperty(p)&&w[p]!==C[p]&&(i||(i={}),i[p]=C[p])}else i||(f||(f=[]),f.push(m,i)),i=C;else m==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,w=w?w.__html:void 0,C!=null&&w!==C&&(f=f||[]).push(m,C)):m==="children"?typeof C!="string"&&typeof C!="number"||(f=f||[]).push(m,""+C):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(ks.hasOwnProperty(m)?(C!=null&&m==="onScroll"&&He("scroll",e),f||w===C||(f=[])):(f=f||[]).push(m,C))}i&&(f=f||[]).push("style",i);var m=f;(t.updateQueue=m)&&(t.flags|=4)}};Kd=function(e,t,i,l){i!==l&&(t.flags|=4)};function ps(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&14680064,l|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function pp(e,t,i){var l=t.pendingProps;switch(yc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(t),null;case 1:return Jt(t.type)&&oa(),Mt(t),null;case 3:return l=t.stateNode,Vi(),je($t),je(Bt),Nc(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Ro(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Nn!==null&&(Pu(Nn),Nn=null))),Tu(e,t),Mt(t),null;case 5:Tc(t);var c=Yr(Xs.current);if(i=t.type,e!==null&&t.stateNode!=null)Zd(e,t,i,l,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(Q(166));return Mt(t),null}if(e=Yr(jn.current),Ro(t)){l=t.stateNode,i=t.type;var f=t.memoizedProps;switch(l[Vn]=t,l[js]=f,e=(t.mode&1)!==0,i){case"dialog":He("cancel",l),He("close",l);break;case"iframe":case"object":case"embed":He("load",l);break;case"video":case"audio":for(c=0;c<Es.length;c++)He(Es[c],l);break;case"source":He("error",l);break;case"img":case"image":case"link":He("error",l),He("load",l);break;case"details":He("toggle",l);break;case"input":A1(l,f),He("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!f.multiple},He("invalid",l);break;case"textarea":S1(l,f),He("invalid",l)}eu(i,f),c=null;for(var p in f)if(f.hasOwnProperty(p)){var w=f[p];p==="children"?typeof w=="string"?l.textContent!==w&&(f.suppressHydrationWarning!==!0&&No(l.textContent,w,e),c=["children",w]):typeof w=="number"&&l.textContent!==""+w&&(f.suppressHydrationWarning!==!0&&No(l.textContent,w,e),c=["children",""+w]):ks.hasOwnProperty(p)&&w!=null&&p==="onScroll"&&He("scroll",l)}switch(i){case"input":Eo(l),v1(l,f,!0);break;case"textarea":Eo(l),I1(l);break;case"select":case"option":break;default:typeof f.onClick=="function"&&(l.onclick=sa)}l=c,t.updateQueue=l,l!==null&&(t.flags|=4)}else{p=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vf(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=p.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(i,{is:l.is}):(e=p.createElement(i),i==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,i),e[Vn]=t,e[js]=l,Yd(e,t,!1,!1),t.stateNode=e;e:{switch(p=tu(i,l),i){case"dialog":He("cancel",e),He("close",e),c=l;break;case"iframe":case"object":case"embed":He("load",e),c=l;break;case"video":case"audio":for(c=0;c<Es.length;c++)He(Es[c],e);c=l;break;case"source":He("error",e),c=l;break;case"img":case"image":case"link":He("error",e),He("load",e),c=l;break;case"details":He("toggle",e),c=l;break;case"input":A1(e,l),c=Kl(e,l),He("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=et({},l,{value:void 0}),He("invalid",e);break;case"textarea":S1(e,l),c=$l(e,l),He("invalid",e);break;default:c=l}eu(i,c),w=c;for(f in w)if(w.hasOwnProperty(f)){var C=w[f];f==="style"?_f(e,C):f==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&Sf(e,C)):f==="children"?typeof C=="string"?(i!=="textarea"||C!=="")&&Ps(e,C):typeof C=="number"&&Ps(e,""+C):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(ks.hasOwnProperty(f)?C!=null&&f==="onScroll"&&He("scroll",e):C!=null&&ic(e,f,C,p))}switch(i){case"input":Eo(e),v1(e,l,!1);break;case"textarea":Eo(e),I1(e);break;case"option":l.value!=null&&e.setAttribute("value",""+Nr(l.value));break;case"select":e.multiple=!!l.multiple,f=l.value,f!=null?Oi(e,!!l.multiple,f,!1):l.defaultValue!=null&&Oi(e,!!l.multiple,l.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=sa)}switch(i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Mt(t),null;case 6:if(e&&t.stateNode!=null)Kd(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(Q(166));if(i=Yr(Xs.current),Yr(jn.current),Ro(t)){if(l=t.stateNode,i=t.memoizedProps,l[Vn]=t,(f=l.nodeValue!==i)&&(e=on,e!==null))switch(e.tag){case 3:No(l.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&No(l.nodeValue,i,(e.mode&1)!==0)}f&&(t.flags|=4)}else l=(i.nodeType===9?i:i.ownerDocument).createTextNode(l),l[Vn]=t,t.stateNode=l}return Mt(t),null;case 13:if(je($e),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ze&&sn!==null&&t.mode&1&&!(t.flags&128))hd(),Wi(),t.flags|=98560,f=!1;else if(f=Ro(t),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(Q(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(Q(317));f[Vn]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mt(t),f=!1}else Nn!==null&&(Pu(Nn),Nn=null),f=!0;if(!f)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,t.mode&1&&(e===null||$e.current&1?xt===0&&(xt=3):Wc())),t.updateQueue!==null&&(t.flags|=4),Mt(t),null);case 4:return Vi(),Tu(e,t),e===null&&Vs(t.stateNode.containerInfo),Mt(t),null;case 10:return vc(t.type._context),Mt(t),null;case 17:return Jt(t.type)&&oa(),Mt(t),null;case 19:if(je($e),f=t.memoizedState,f===null)return Mt(t),null;if(l=(t.flags&128)!==0,p=f.rendering,p===null)if(l)ps(f,!1);else{if(xt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(p=ha(e),p!==null){for(t.flags|=128,ps(f,!1),l=p.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=i,i=t.child;i!==null;)f=i,e=l,f.flags&=14680066,p=f.alternate,p===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=p.childLanes,f.lanes=p.lanes,f.child=p.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=p.memoizedProps,f.memoizedState=p.memoizedState,f.updateQueue=p.updateQueue,f.type=p.type,e=p.dependencies,f.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ze($e,$e.current&1|2),t.child}e=e.sibling}f.tail!==null&&lt()>ji&&(t.flags|=128,l=!0,ps(f,!1),t.lanes=4194304)}else{if(!l)if(e=ha(p),e!==null){if(t.flags|=128,l=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),ps(f,!0),f.tail===null&&f.tailMode==="hidden"&&!p.alternate&&!Ze)return Mt(t),null}else 2*lt()-f.renderingStartTime>ji&&i!==1073741824&&(t.flags|=128,l=!0,ps(f,!1),t.lanes=4194304);f.isBackwards?(p.sibling=t.child,t.child=p):(i=f.last,i!==null?i.sibling=p:t.child=p,f.last=p)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=lt(),t.sibling=null,i=$e.current,ze($e,l?i&1|2:i&1),t):(Mt(t),null);case 22:case 23:return Uc(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&t.mode&1?rn&1073741824&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function xp(e,t){switch(yc(t),t.tag){case 1:return Jt(t.type)&&oa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),je($t),je(Bt),Nc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Tc(t),null;case 13:if(je($e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je($e),null;case 4:return Vi(),null;case 10:return vc(t.type._context),null;case 22:case 23:return Uc(),null;case 24:return null;default:return null}}var Do=!1,kt=!1,mp=typeof WeakSet=="function"?WeakSet:Set,re=null;function Ti(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(l){ot(e,t,l)}else i.current=null}function Nu(e,t,i){try{i()}catch(l){ot(e,t,l)}}var g0=!1;function wp(e,t){if(fu=na,e=ed(),mc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,f=l.focusNode;l=l.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var p=0,w=-1,C=-1,m=0,_=0,v=e,R=null;t:for(;;){for(var M;v!==i||c!==0&&v.nodeType!==3||(w=p+c),v!==f||l!==0&&v.nodeType!==3||(C=p+l),v.nodeType===3&&(p+=v.nodeValue.length),(M=v.firstChild)!==null;)R=v,v=M;for(;;){if(v===e)break t;if(R===i&&++m===c&&(w=p),R===f&&++_===l&&(C=p),(M=v.nextSibling)!==null)break;v=R,R=v.parentNode}v=M}i=w===-1||C===-1?null:{start:w,end:C}}else i=null}i=i||{start:0,end:0}}else i=null;for(du={focusedElem:e,selectionRange:i},na=!1,re=t;re!==null;)if(t=re,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,re=e;else for(;re!==null;){t=re;try{var P=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(P!==null){var B=P.memoizedProps,K=P.memoizedState,O=t.stateNode,T=O.getSnapshotBeforeUpdate(t.elementType===t.type?B:_n(t.type,B),K);O.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var N=t.stateNode.containerInfo;N.nodeType===1?N.textContent="":N.nodeType===9&&N.documentElement&&N.removeChild(N.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(G){ot(t,t.return,G)}if(e=t.sibling,e!==null){e.return=t.return,re=e;break}re=t.return}return P=g0,g0=!1,P}function Rs(e,t,i){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var c=l=l.next;do{if((c.tag&e)===e){var f=c.destroy;c.destroy=void 0,f!==void 0&&Nu(t,i,f)}c=c.next}while(c!==l)}}function ka(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var l=i.create;i.destroy=l()}i=i.next}while(i!==t)}}function Ru(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function Qd(e){var t=e.alternate;t!==null&&(e.alternate=null,Qd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vn],delete t[js],delete t[pu],delete t[ep],delete t[tp])),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 qd(e){return e.tag===5||e.tag===3||e.tag===4}function p0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qd(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 bu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=sa));else if(l!==4&&(e=e.child,e!==null))for(bu(e,t,i),e=e.sibling;e!==null;)bu(e,t,i),e=e.sibling}function Ou(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(Ou(e,t,i),e=e.sibling;e!==null;)Ou(e,t,i),e=e.sibling}var Tt=null,Tn=!1;function dr(e,t,i){for(i=i.child;i!==null;)$d(e,t,i),i=i.sibling}function $d(e,t,i){if(Hn&&typeof Hn.onCommitFiberUnmount=="function")try{Hn.onCommitFiberUnmount(_a,i)}catch{}switch(i.tag){case 5:kt||Ti(i,t);case 6:var l=Tt,c=Tn;Tt=null,dr(e,t,i),Tt=l,Tn=c,Tt!==null&&(Tn?(e=Tt,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):Tt.removeChild(i.stateNode));break;case 18:Tt!==null&&(Tn?(e=Tt,i=i.stateNode,e.nodeType===8?Il(e.parentNode,i):e.nodeType===1&&Il(e,i),Us(e)):Il(Tt,i.stateNode));break;case 4:l=Tt,c=Tn,Tt=i.stateNode.containerInfo,Tn=!0,dr(e,t,i),Tt=l,Tn=c;break;case 0:case 11:case 14:case 15:if(!kt&&(l=i.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){c=l=l.next;do{var f=c,p=f.destroy;f=f.tag,p!==void 0&&(f&2||f&4)&&Nu(i,t,p),c=c.next}while(c!==l)}dr(e,t,i);break;case 1:if(!kt&&(Ti(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=i.memoizedProps,l.state=i.memoizedState,l.componentWillUnmount()}catch(w){ot(i,t,w)}dr(e,t,i);break;case 21:dr(e,t,i);break;case 22:i.mode&1?(kt=(l=kt)||i.memoizedState!==null,dr(e,t,i),kt=l):dr(e,t,i);break;default:dr(e,t,i)}}function x0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new mp),t.forEach(function(l){var c=Tp.bind(null,e,l);i.has(l)||(i.add(l),l.then(c,c))})}}function Sn(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l];try{var f=e,p=t,w=p;e:for(;w!==null;){switch(w.tag){case 5:Tt=w.stateNode,Tn=!1;break e;case 3:Tt=w.stateNode.containerInfo,Tn=!0;break e;case 4:Tt=w.stateNode.containerInfo,Tn=!0;break e}w=w.return}if(Tt===null)throw Error(Q(160));$d(f,p,c),Tt=null,Tn=!1;var C=c.alternate;C!==null&&(C.return=null),c.return=null}catch(m){ot(c,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Jd(t,e),t=t.sibling}function Jd(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Sn(t,e),Un(e),l&4){try{Rs(3,e,e.return),ka(3,e)}catch(B){ot(e,e.return,B)}try{Rs(5,e,e.return)}catch(B){ot(e,e.return,B)}}break;case 1:Sn(t,e),Un(e),l&512&&i!==null&&Ti(i,i.return);break;case 5:if(Sn(t,e),Un(e),l&512&&i!==null&&Ti(i,i.return),e.flags&32){var c=e.stateNode;try{Ps(c,"")}catch(B){ot(e,e.return,B)}}if(l&4&&(c=e.stateNode,c!=null)){var f=e.memoizedProps,p=i!==null?i.memoizedProps:f,w=e.type,C=e.updateQueue;if(e.updateQueue=null,C!==null)try{w==="input"&&f.type==="radio"&&f.name!=null&&Cf(c,f),tu(w,p);var m=tu(w,f);for(p=0;p<C.length;p+=2){var _=C[p],v=C[p+1];_==="style"?_f(c,v):_==="dangerouslySetInnerHTML"?Sf(c,v):_==="children"?Ps(c,v):ic(c,_,v,m)}switch(w){case"input":Ql(c,f);break;case"textarea":Af(c,f);break;case"select":var R=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!f.multiple;var M=f.value;M!=null?Oi(c,!!f.multiple,M,!1):R!==!!f.multiple&&(f.defaultValue!=null?Oi(c,!!f.multiple,f.defaultValue,!0):Oi(c,!!f.multiple,f.multiple?[]:"",!1))}c[js]=f}catch(B){ot(e,e.return,B)}}break;case 6:if(Sn(t,e),Un(e),l&4){if(e.stateNode===null)throw Error(Q(162));c=e.stateNode,f=e.memoizedProps;try{c.nodeValue=f}catch(B){ot(e,e.return,B)}}break;case 3:if(Sn(t,e),Un(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{Us(t.containerInfo)}catch(B){ot(e,e.return,B)}break;case 4:Sn(t,e),Un(e);break;case 13:Sn(t,e),Un(e),c=e.child,c.flags&8192&&(f=c.memoizedState!==null,c.stateNode.isHidden=f,!f||c.alternate!==null&&c.alternate.memoizedState!==null||(Lc=lt())),l&4&&x0(e);break;case 22:if(_=i!==null&&i.memoizedState!==null,e.mode&1?(kt=(m=kt)||_,Sn(t,e),kt=m):Sn(t,e),Un(e),l&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!_&&e.mode&1)for(re=e,_=e.child;_!==null;){for(v=re=_;re!==null;){switch(R=re,M=R.child,R.tag){case 0:case 11:case 14:case 15:Rs(4,R,R.return);break;case 1:Ti(R,R.return);var P=R.stateNode;if(typeof P.componentWillUnmount=="function"){l=R,i=R.return;try{t=l,P.props=t.memoizedProps,P.state=t.memoizedState,P.componentWillUnmount()}catch(B){ot(l,i,B)}}break;case 5:Ti(R,R.return);break;case 22:if(R.memoizedState!==null){w0(v);continue}}M!==null?(M.return=R,re=M):w0(v)}_=_.sibling}e:for(_=null,v=e;;){if(v.tag===5){if(_===null){_=v;try{c=v.stateNode,m?(f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none"):(w=v.stateNode,C=v.memoizedProps.style,p=C!=null&&C.hasOwnProperty("display")?C.display:null,w.style.display=If("display",p))}catch(B){ot(e,e.return,B)}}}else if(v.tag===6){if(_===null)try{v.stateNode.nodeValue=m?"":v.memoizedProps}catch(B){ot(e,e.return,B)}}else if((v.tag!==22&&v.tag!==23||v.memoizedState===null||v===e)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===e)break e;for(;v.sibling===null;){if(v.return===null||v.return===e)break e;_===v&&(_=null),v=v.return}_===v&&(_=null),v.sibling.return=v.return,v=v.sibling}}break;case 19:Sn(t,e),Un(e),l&4&&x0(e);break;case 21:break;default:Sn(t,e),Un(e)}}function Un(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(qd(i)){var l=i;break e}i=i.return}throw Error(Q(160))}switch(l.tag){case 5:var c=l.stateNode;l.flags&32&&(Ps(c,""),l.flags&=-33);var f=p0(e);Ou(e,f,c);break;case 3:case 4:var p=l.stateNode.containerInfo,w=p0(e);bu(e,w,p);break;default:throw Error(Q(161))}}catch(C){ot(e,e.return,C)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yp(e,t,i){re=e,eh(e)}function eh(e,t,i){for(var l=(e.mode&1)!==0;re!==null;){var c=re,f=c.child;if(c.tag===22&&l){var p=c.memoizedState!==null||Do;if(!p){var w=c.alternate,C=w!==null&&w.memoizedState!==null||kt;w=Do;var m=kt;if(Do=p,(kt=C)&&!m)for(re=c;re!==null;)p=re,C=p.child,p.tag===22&&p.memoizedState!==null?y0(c):C!==null?(C.return=p,re=C):y0(c);for(;f!==null;)re=f,eh(f),f=f.sibling;re=c,Do=w,kt=m}m0(e)}else c.subtreeFlags&8772&&f!==null?(f.return=c,re=f):m0(e)}}function m0(e){for(;re!==null;){var t=re;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:kt||ka(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!kt)if(i===null)l.componentDidMount();else{var c=t.elementType===t.type?i.memoizedProps:_n(t.type,i.memoizedProps);l.componentDidUpdate(c,i.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var f=t.updateQueue;f!==null&&t0(t,f,l);break;case 3:var p=t.updateQueue;if(p!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}t0(t,p,i)}break;case 5:var w=t.stateNode;if(i===null&&t.flags&4){i=w;var C=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&i.focus();break;case"img":C.src&&(i.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var _=m.memoizedState;if(_!==null){var v=_.dehydrated;v!==null&&Us(v)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}kt||t.flags&512&&Ru(t)}catch(R){ot(t,t.return,R)}}if(t===e){re=null;break}if(i=t.sibling,i!==null){i.return=t.return,re=i;break}re=t.return}}function w0(e){for(;re!==null;){var t=re;if(t===e){re=null;break}var i=t.sibling;if(i!==null){i.return=t.return,re=i;break}re=t.return}}function y0(e){for(;re!==null;){var t=re;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{ka(4,t)}catch(C){ot(t,i,C)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var c=t.return;try{l.componentDidMount()}catch(C){ot(t,c,C)}}var f=t.return;try{Ru(t)}catch(C){ot(t,f,C)}break;case 5:var p=t.return;try{Ru(t)}catch(C){ot(t,p,C)}}}catch(C){ot(t,t.return,C)}if(t===e){re=null;break}var w=t.sibling;if(w!==null){w.return=t.return,re=w;break}re=t.return}}var Ep=Math.ceil,xa=rr.ReactCurrentDispatcher,Pc=rr.ReactCurrentOwner,wn=rr.ReactCurrentBatchConfig,Re=0,At=null,ct=null,Nt=0,rn=0,Ni=Dr(0),xt=0,Qs=null,Jr=0,Pa=0,Bc=0,bs=null,Qt=null,Lc=0,ji=1/0,Zn=null,ma=!1,Du=null,Ir=null,Mo=!1,yr=null,wa=0,Os=0,Mu=null,Xo=-1,Yo=0;function Wt(){return Re&6?lt():Xo!==-1?Xo:Xo=lt()}function _r(e){return e.mode&1?Re&2&&Nt!==0?Nt&-Nt:rp.transition!==null?(Yo===0&&(Yo=Ff()),Yo):(e=ke,e!==0||(e=window.event,e=e===void 0?16:Gf(e.type)),e):1}function bn(e,t,i,l){if(50<Os)throw Os=0,Mu=null,Error(Q(185));eo(e,i,l),(!(Re&2)||e!==At)&&(e===At&&(!(Re&2)&&(Pa|=i),xt===4&&xr(e,Nt)),en(e,l),i===1&&Re===0&&!(t.mode&1)&&(ji=lt()+500,Oa&&Mr()))}function en(e,t){var i=e.callbackNode;r2(e,t);var l=ta(e,e===At?Nt:0);if(l===0)i!==null&&N1(i),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(i!=null&&N1(i),t===1)e.tag===0?np(E0.bind(null,e)):cd(E0.bind(null,e)),$2(function(){!(Re&6)&&Mr()}),i=null;else{switch(Uf(l)){case 1:i=uc;break;case 4:i=Bf;break;case 16:i=ea;break;case 536870912:i=Lf;break;default:i=ea}i=lh(i,th.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function th(e,t){if(Xo=-1,Yo=0,Re&6)throw Error(Q(327));var i=e.callbackNode;if(Bi()&&e.callbackNode!==i)return null;var l=ta(e,e===At?Nt:0);if(l===0)return null;if(l&30||l&e.expiredLanes||t)t=ya(e,l);else{t=l;var c=Re;Re|=2;var f=rh();(At!==e||Nt!==t)&&(Zn=null,ji=lt()+500,Zr(e,t));do try{vp();break}catch(w){nh(e,w)}while(!0);Ac(),xa.current=f,Re=c,ct!==null?t=0:(At=null,Nt=0,t=xt)}if(t!==0){if(t===2&&(c=ou(e),c!==0&&(l=c,t=ku(e,c))),t===1)throw i=Qs,Zr(e,0),xr(e,l),en(e,lt()),i;if(t===6)xr(e,l);else{if(c=e.current.alternate,!(l&30)&&!Cp(c)&&(t=ya(e,l),t===2&&(f=ou(e),f!==0&&(l=f,t=ku(e,f))),t===1))throw i=Qs,Zr(e,0),xr(e,l),en(e,lt()),i;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(Q(345));case 2:Hr(e,Qt,Zn);break;case 3:if(xr(e,l),(l&130023424)===l&&(t=Lc+500-lt(),10<t)){if(ta(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){Wt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=gu(Hr.bind(null,e,Qt,Zn),t);break}Hr(e,Qt,Zn);break;case 4:if(xr(e,l),(l&4194240)===l)break;for(t=e.eventTimes,c=-1;0<l;){var p=31-Rn(l);f=1<<p,p=t[p],p>c&&(c=p),l&=~f}if(l=c,l=lt()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Ep(l/1960))-l,10<l){e.timeoutHandle=gu(Hr.bind(null,e,Qt,Zn),l);break}Hr(e,Qt,Zn);break;case 5:Hr(e,Qt,Zn);break;default:throw Error(Q(329))}}}return en(e,lt()),e.callbackNode===i?th.bind(null,e):null}function ku(e,t){var i=bs;return e.current.memoizedState.isDehydrated&&(Zr(e,t).flags|=256),e=ya(e,t),e!==2&&(t=Qt,Qt=i,t!==null&&Pu(t)),e}function Pu(e){Qt===null?Qt=e:Qt.push.apply(Qt,e)}function Cp(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var l=0;l<i.length;l++){var c=i[l],f=c.getSnapshot;c=c.value;try{if(!On(f(),c))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 xr(e,t){for(t&=~Bc,t&=~Pa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Rn(t),l=1<<i;e[i]=-1,t&=~l}}function E0(e){if(Re&6)throw Error(Q(327));Bi();var t=ta(e,0);if(!(t&1))return en(e,lt()),null;var i=ya(e,t);if(e.tag!==0&&i===2){var l=ou(e);l!==0&&(t=l,i=ku(e,l))}if(i===1)throw i=Qs,Zr(e,0),xr(e,t),en(e,lt()),i;if(i===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Hr(e,Qt,Zn),en(e,lt()),null}function Fc(e,t){var i=Re;Re|=1;try{return e(t)}finally{Re=i,Re===0&&(ji=lt()+500,Oa&&Mr())}}function ei(e){yr!==null&&yr.tag===0&&!(Re&6)&&Bi();var t=Re;Re|=1;var i=wn.transition,l=ke;try{if(wn.transition=null,ke=1,e)return e()}finally{ke=l,wn.transition=i,Re=t,!(Re&6)&&Mr()}}function Uc(){rn=Ni.current,je(Ni)}function Zr(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,q2(i)),ct!==null)for(i=ct.return;i!==null;){var l=i;switch(yc(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&oa();break;case 3:Vi(),je($t),je(Bt),Nc();break;case 5:Tc(l);break;case 4:Vi();break;case 13:je($e);break;case 19:je($e);break;case 10:vc(l.type._context);break;case 22:case 23:Uc()}i=i.return}if(At=e,ct=e=Tr(e.current,null),Nt=rn=t,xt=0,Qs=null,Bc=Pa=Jr=0,Qt=bs=null,Xr!==null){for(t=0;t<Xr.length;t++)if(i=Xr[t],l=i.interleaved,l!==null){i.interleaved=null;var c=l.next,f=i.pending;if(f!==null){var p=f.next;f.next=c,l.next=p}i.pending=l}Xr=null}return e}function nh(e,t){do{var i=ct;try{if(Ac(),Ho.current=pa,ga){for(var l=Je.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}ga=!1}if($r=0,Et=pt=Je=null,Ns=!1,Ys=0,Pc.current=null,i===null||i.return===null){xt=1,Qs=t,ct=null;break}e:{var f=e,p=i.return,w=i,C=t;if(t=Nt,w.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var m=C,_=w,v=_.tag;if(!(_.mode&1)&&(v===0||v===11||v===15)){var R=_.alternate;R?(_.updateQueue=R.updateQueue,_.memoizedState=R.memoizedState,_.lanes=R.lanes):(_.updateQueue=null,_.memoizedState=null)}var M=a0(p);if(M!==null){M.flags&=-257,l0(M,p,w,f,t),M.mode&1&&o0(f,m,t),t=M,C=m;var P=t.updateQueue;if(P===null){var B=new Set;B.add(C),t.updateQueue=B}else P.add(C);break e}else{if(!(t&1)){o0(f,m,t),Wc();break e}C=Error(Q(426))}}else if(Ze&&w.mode&1){var K=a0(p);if(K!==null){!(K.flags&65536)&&(K.flags|=256),l0(K,p,w,f,t),Ec(Hi(C,w));break e}}f=C=Hi(C,w),xt!==4&&(xt=2),bs===null?bs=[f]:bs.push(f),f=p;do{switch(f.tag){case 3:f.flags|=65536,t&=-t,f.lanes|=t;var O=Ud(f,C,t);e0(f,O);break e;case 1:w=C;var T=f.type,N=f.stateNode;if(!(f.flags&128)&&(typeof T.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Ir===null||!Ir.has(N)))){f.flags|=65536,t&=-t,f.lanes|=t;var G=Wd(f,w,t);e0(f,G);break e}}f=f.return}while(f!==null)}sh(i)}catch(H){t=H,ct===i&&i!==null&&(ct=i=i.return);continue}break}while(!0)}function rh(){var e=xa.current;return xa.current=pa,e===null?pa:e}function Wc(){(xt===0||xt===3||xt===2)&&(xt=4),At===null||!(Jr&268435455)&&!(Pa&268435455)||xr(At,Nt)}function ya(e,t){var i=Re;Re|=2;var l=rh();(At!==e||Nt!==t)&&(Zn=null,Zr(e,t));do try{Ap();break}catch(c){nh(e,c)}while(!0);if(Ac(),Re=i,xa.current=l,ct!==null)throw Error(Q(261));return At=null,Nt=0,xt}function Ap(){for(;ct!==null;)ih(ct)}function vp(){for(;ct!==null&&!Zg();)ih(ct)}function ih(e){var t=ah(e.alternate,e,rn);e.memoizedProps=e.pendingProps,t===null?sh(e):ct=t,Pc.current=null}function sh(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=xp(i,t),i!==null){i.flags&=32767,ct=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xt=6,ct=null;return}}else if(i=pp(i,t,rn),i!==null){ct=i;return}if(t=t.sibling,t!==null){ct=t;return}ct=t=e}while(t!==null);xt===0&&(xt=5)}function Hr(e,t,i){var l=ke,c=wn.transition;try{wn.transition=null,ke=1,Sp(e,t,i,l)}finally{wn.transition=c,ke=l}return null}function Sp(e,t,i,l){do Bi();while(yr!==null);if(Re&6)throw Error(Q(327));i=e.finishedWork;var c=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var f=i.lanes|i.childLanes;if(i2(e,f),e===At&&(ct=At=null,Nt=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||Mo||(Mo=!0,lh(ea,function(){return Bi(),null})),f=(i.flags&15990)!==0,i.subtreeFlags&15990||f){f=wn.transition,wn.transition=null;var p=ke;ke=1;var w=Re;Re|=4,Pc.current=null,wp(e,i),Jd(i,e),j2(du),na=!!fu,du=fu=null,e.current=i,yp(i),Kg(),Re=w,ke=p,wn.transition=f}else e.current=i;if(Mo&&(Mo=!1,yr=e,wa=c),f=e.pendingLanes,f===0&&(Ir=null),$g(i.stateNode),en(e,lt()),t!==null)for(l=e.onRecoverableError,i=0;i<t.length;i++)c=t[i],l(c.value,{componentStack:c.stack,digest:c.digest});if(ma)throw ma=!1,e=Du,Du=null,e;return wa&1&&e.tag!==0&&Bi(),f=e.pendingLanes,f&1?e===Mu?Os++:(Os=0,Mu=e):Os=0,Mr(),null}function Bi(){if(yr!==null){var e=Uf(wa),t=wn.transition,i=ke;try{if(wn.transition=null,ke=16>e?16:e,yr===null)var l=!1;else{if(e=yr,yr=null,wa=0,Re&6)throw Error(Q(331));var c=Re;for(Re|=4,re=e.current;re!==null;){var f=re,p=f.child;if(re.flags&16){var w=f.deletions;if(w!==null){for(var C=0;C<w.length;C++){var m=w[C];for(re=m;re!==null;){var _=re;switch(_.tag){case 0:case 11:case 15:Rs(8,_,f)}var v=_.child;if(v!==null)v.return=_,re=v;else for(;re!==null;){_=re;var R=_.sibling,M=_.return;if(Qd(_),_===m){re=null;break}if(R!==null){R.return=M,re=R;break}re=M}}}var P=f.alternate;if(P!==null){var B=P.child;if(B!==null){P.child=null;do{var K=B.sibling;B.sibling=null,B=K}while(B!==null)}}re=f}}if(f.subtreeFlags&2064&&p!==null)p.return=f,re=p;else e:for(;re!==null;){if(f=re,f.flags&2048)switch(f.tag){case 0:case 11:case 15:Rs(9,f,f.return)}var O=f.sibling;if(O!==null){O.return=f.return,re=O;break e}re=f.return}}var T=e.current;for(re=T;re!==null;){p=re;var N=p.child;if(p.subtreeFlags&2064&&N!==null)N.return=p,re=N;else e:for(p=T;re!==null;){if(w=re,w.flags&2048)try{switch(w.tag){case 0:case 11:case 15:ka(9,w)}}catch(H){ot(w,w.return,H)}if(w===p){re=null;break e}var G=w.sibling;if(G!==null){G.return=w.return,re=G;break e}re=w.return}}if(Re=c,Mr(),Hn&&typeof Hn.onPostCommitFiberRoot=="function")try{Hn.onPostCommitFiberRoot(_a,e)}catch{}l=!0}return l}finally{ke=i,wn.transition=t}}return!1}function C0(e,t,i){t=Hi(i,t),t=Ud(e,t,1),e=Sr(e,t,1),t=Wt(),e!==null&&(eo(e,1,t),en(e,t))}function ot(e,t,i){if(e.tag===3)C0(e,e,i);else for(;t!==null;){if(t.tag===3){C0(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ir===null||!Ir.has(l))){e=Hi(i,e),e=Wd(t,e,1),t=Sr(t,e,1),e=Wt(),t!==null&&(eo(t,1,e),en(t,e));break}}t=t.return}}function Ip(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&i,At===e&&(Nt&i)===i&&(xt===4||xt===3&&(Nt&130023424)===Nt&&500>lt()-Lc?Zr(e,0):Bc|=i),en(e,t)}function oh(e,t){t===0&&(e.mode&1?(t=vo,vo<<=1,!(vo&130023424)&&(vo=4194304)):t=1);var i=Wt();e=tr(e,t),e!==null&&(eo(e,t,i),en(e,i))}function _p(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),oh(e,i)}function Tp(e,t){var i=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(Q(314))}l!==null&&l.delete(t),oh(e,i)}var ah;ah=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||$t.current)qt=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return qt=!1,gp(e,t,i);qt=!!(e.flags&131072)}else qt=!1,Ze&&t.flags&1048576&&fd(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Go(e,t),e=t.pendingProps;var c=Ui(t,Bt.current);Pi(t,i),c=bc(null,t,l,e,c,i);var f=Oc();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,Jt(l)?(f=!0,aa(t)):f=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Ic(t),c.updater=Ma,t.stateNode=c,c._reactInternals=t,Cu(t,l,e,i),t=Su(null,t,l,!0,f,i)):(t.tag=0,Ze&&f&&wc(t),Ut(null,t,c,i),t=t.child),t;case 16:l=t.elementType;e:{switch(Go(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=Rp(l),e=_n(l,e),c){case 0:t=vu(null,t,l,e,i);break e;case 1:t=f0(null,t,l,e,i);break e;case 11:t=u0(null,t,l,e,i);break e;case 14:t=c0(null,t,l,_n(l.type,e),i);break e}throw Error(Q(306,l,""))}return t;case 0:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),vu(e,t,l,c,i);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),f0(e,t,l,c,i);case 3:e:{if(jd(t),e===null)throw Error(Q(387));l=t.pendingProps,f=t.memoizedState,c=f.element,md(e,t),da(t,l,null,i);var p=t.memoizedState;if(l=p.element,f.isDehydrated)if(f={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){c=Hi(Error(Q(423)),t),t=d0(e,t,l,i,c);break e}else if(l!==c){c=Hi(Error(Q(424)),t),t=d0(e,t,l,i,c);break e}else for(sn=vr(t.stateNode.containerInfo.firstChild),on=t,Ze=!0,Nn=null,i=pd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Wi(),l===c){t=nr(e,t,i);break e}Ut(e,t,l,i)}t=t.child}return t;case 5:return wd(t),e===null&&wu(t),l=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,p=c.children,hu(l,c)?p=null:f!==null&&hu(l,f)&&(t.flags|=32),Hd(e,t),Ut(e,t,p,i),t.child;case 6:return e===null&&wu(t),null;case 13:return Gd(e,t,i);case 4:return _c(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=zi(t,null,l,i):Ut(e,t,l,i),t.child;case 11:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),u0(e,t,l,c,i);case 7:return Ut(e,t,t.pendingProps,i),t.child;case 8:return Ut(e,t,t.pendingProps.children,i),t.child;case 12:return Ut(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(l=t.type._context,c=t.pendingProps,f=t.memoizedProps,p=c.value,ze(ca,l._currentValue),l._currentValue=p,f!==null)if(On(f.value,p)){if(f.children===c.children&&!$t.current){t=nr(e,t,i);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var w=f.dependencies;if(w!==null){p=f.child;for(var C=w.firstContext;C!==null;){if(C.context===l){if(f.tag===1){C=$n(-1,i&-i),C.tag=2;var m=f.updateQueue;if(m!==null){m=m.shared;var _=m.pending;_===null?C.next=C:(C.next=_.next,_.next=C),m.pending=C}}f.lanes|=i,C=f.alternate,C!==null&&(C.lanes|=i),yu(f.return,i,t),w.lanes|=i;break}C=C.next}}else if(f.tag===10)p=f.type===t.type?null:f.child;else if(f.tag===18){if(p=f.return,p===null)throw Error(Q(341));p.lanes|=i,w=p.alternate,w!==null&&(w.lanes|=i),yu(p,i,t),p=f.sibling}else p=f.child;if(p!==null)p.return=f;else for(p=f;p!==null;){if(p===t){p=null;break}if(f=p.sibling,f!==null){f.return=p.return,p=f;break}p=p.return}f=p}Ut(e,t,c.children,i),t=t.child}return t;case 9:return c=t.type,l=t.pendingProps.children,Pi(t,i),c=yn(c),l=l(c),t.flags|=1,Ut(e,t,l,i),t.child;case 14:return l=t.type,c=_n(l,t.pendingProps),c=_n(l.type,c),c0(e,t,l,c,i);case 15:return zd(e,t,t.type,t.pendingProps,i);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),Go(e,t),t.tag=1,Jt(l)?(e=!0,aa(t)):e=!1,Pi(t,i),Fd(t,l,c),Cu(t,l,c,i),Su(null,t,l,!0,e,i);case 19:return Xd(e,t,i);case 22:return Vd(e,t,i)}throw Error(Q(156,t.tag))};function lh(e,t){return Pf(e,t)}function Np(e,t,i,l){this.tag=e,this.key=i,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,t,i,l){return new Np(e,t,i,l)}function zc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Rp(e){if(typeof e=="function")return zc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===oc)return 11;if(e===ac)return 14}return 2}function Tr(e,t){var i=e.alternate;return i===null?(i=mn(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Zo(e,t,i,l,c,f){var p=2;if(l=e,typeof e=="function")zc(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case wi:return Kr(i.children,c,f,t);case sc:p=8,c|=8;break;case Gl:return e=mn(12,i,t,c|2),e.elementType=Gl,e.lanes=f,e;case Xl:return e=mn(13,i,t,c),e.elementType=Xl,e.lanes=f,e;case Yl:return e=mn(19,i,t,c),e.elementType=Yl,e.lanes=f,e;case wf:return Ba(i,c,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xf:p=10;break e;case mf:p=9;break e;case oc:p=11;break e;case ac:p=14;break e;case hr:p=16,l=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=mn(p,i,t,c),t.elementType=e,t.type=l,t.lanes=f,t}function Kr(e,t,i,l){return e=mn(7,e,l,t),e.lanes=i,e}function Ba(e,t,i,l){return e=mn(22,e,l,t),e.elementType=wf,e.lanes=i,e.stateNode={isHidden:!1},e}function Ml(e,t,i){return e=mn(6,e,null,t),e.lanes=i,e}function kl(e,t,i){return t=mn(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bp(e,t,i,l,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=gl(0),this.expirationTimes=gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gl(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function Vc(e,t,i,l,c,f,p,w,C){return e=new bp(e,t,i,w,C),t===1?(t=1,f===!0&&(t|=8)):t=0,f=mn(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:l,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ic(f),e}function Op(e,t,i){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:mi,key:l==null?null:""+l,children:e,containerInfo:t,implementation:i}}function uh(e){if(!e)return Rr;e=e._reactInternals;e:{if(ni(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var i=e.type;if(Jt(i))return ud(e,i,t)}return t}function ch(e,t,i,l,c,f,p,w,C){return e=Vc(i,l,!0,e,c,f,p,w,C),e.context=uh(null),i=e.current,l=Wt(),c=_r(i),f=$n(l,c),f.callback=t??null,Sr(i,f,c),e.current.lanes=c,eo(e,c,l),en(e,l),e}function La(e,t,i,l){var c=t.current,f=Wt(),p=_r(c);return i=uh(i),t.context===null?t.context=i:t.pendingContext=i,t=$n(f,p),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=Sr(c,t,p),e!==null&&(bn(e,c,p,f),Vo(e,c,p)),p}function Ea(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 A0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Hc(e,t){A0(e,t),(e=e.alternate)&&A0(e,t)}function Dp(){return null}var fh=typeof reportError=="function"?reportError:function(e){console.error(e)};function jc(e){this._internalRoot=e}Fa.prototype.render=jc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));La(e,t,null,null)};Fa.prototype.unmount=jc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ei(function(){La(null,e,null,null)}),t[er]=null}};function Fa(e){this._internalRoot=e}Fa.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vf();e={blockedOn:null,target:e,priority:t};for(var i=0;i<pr.length&&t!==0&&t<pr[i].priority;i++);pr.splice(i,0,e),i===0&&jf(e)}};function Gc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ua(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function v0(){}function Mp(e,t,i,l,c){if(c){if(typeof l=="function"){var f=l;l=function(){var m=Ea(p);f.call(m)}}var p=ch(t,l,e,0,null,!1,!1,"",v0);return e._reactRootContainer=p,e[er]=p.current,Vs(e.nodeType===8?e.parentNode:e),ei(),p}for(;c=e.lastChild;)e.removeChild(c);if(typeof l=="function"){var w=l;l=function(){var m=Ea(C);w.call(m)}}var C=Vc(e,0,!1,null,null,!1,!1,"",v0);return e._reactRootContainer=C,e[er]=C.current,Vs(e.nodeType===8?e.parentNode:e),ei(function(){La(t,C,i,l)}),C}function Wa(e,t,i,l,c){var f=i._reactRootContainer;if(f){var p=f;if(typeof c=="function"){var w=c;c=function(){var C=Ea(p);w.call(C)}}La(t,p,e,c)}else p=Mp(i,t,e,c,l);return Ea(p)}Wf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=ys(t.pendingLanes);i!==0&&(cc(t,i|1),en(t,lt()),!(Re&6)&&(ji=lt()+500,Mr()))}break;case 13:ei(function(){var l=tr(e,1);if(l!==null){var c=Wt();bn(l,e,1,c)}}),Hc(e,1)}};fc=function(e){if(e.tag===13){var t=tr(e,134217728);if(t!==null){var i=Wt();bn(t,e,134217728,i)}Hc(e,134217728)}};zf=function(e){if(e.tag===13){var t=_r(e),i=tr(e,t);if(i!==null){var l=Wt();bn(i,e,t,l)}Hc(e,t)}};Vf=function(){return ke};Hf=function(e,t){var i=ke;try{return ke=e,t()}finally{ke=i}};ru=function(e,t,i){switch(t){case"input":if(Ql(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=ba(l);if(!c)throw Error(Q(90));Ef(l),Ql(l,c)}}}break;case"textarea":Af(e,i);break;case"select":t=i.value,t!=null&&Oi(e,!!i.multiple,t,!1)}};Rf=Fc;bf=ei;var kp={usingClientEntryPoint:!1,Events:[no,Ai,ba,Tf,Nf,Fc]},xs={findFiberByHostInstance:Gr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Pp={bundleType:xs.bundleType,version:xs.version,rendererPackageName:xs.rendererPackageName,rendererConfig:xs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:rr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Mf(e),e===null?null:e.stateNode},findFiberByHostInstance:xs.findFiberByHostInstance||Dp,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 ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ko.isDisabled&&ko.supportsFiber)try{_a=ko.inject(Pp),Hn=ko}catch{}}ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kp;ln.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gc(t))throw Error(Q(200));return Op(e,t,null,i)};ln.createRoot=function(e,t){if(!Gc(e))throw Error(Q(299));var i=!1,l="",c=fh;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Vc(e,1,!1,null,null,i,!1,l,c),e[er]=t.current,Vs(e.nodeType===8?e.parentNode:e),new jc(t)};ln.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=Mf(t),e=e===null?null:e.stateNode,e};ln.flushSync=function(e){return ei(e)};ln.hydrate=function(e,t,i){if(!Ua(t))throw Error(Q(200));return Wa(null,e,t,!0,i)};ln.hydrateRoot=function(e,t,i){if(!Gc(e))throw Error(Q(405));var l=i!=null&&i.hydratedSources||null,c=!1,f="",p=fh;if(i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onRecoverableError!==void 0&&(p=i.onRecoverableError)),t=ch(t,null,e,1,i??null,c,!1,f,p),e[er]=t.current,Vs(e),l)for(e=0;e<l.length;e++)i=l[e],c=i._getVersion,c=c(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,c]:t.mutableSourceEagerHydrationData.push(i,c);return new Fa(t)};ln.render=function(e,t,i){if(!Ua(t))throw Error(Q(200));return Wa(null,e,t,!1,i)};ln.unmountComponentAtNode=function(e){if(!Ua(e))throw Error(Q(40));return e._reactRootContainer?(ei(function(){Wa(null,null,e,!1,function(){e._reactRootContainer=null,e[er]=null})}),!0):!1};ln.unstable_batchedUpdates=Fc;ln.unstable_renderSubtreeIntoContainer=function(e,t,i,l){if(!Ua(i))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Wa(e,t,i,!1,l)};ln.version="18.3.1-next-f1338f8080-20240426";function dh(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dh)}catch(e){console.error(e)}}dh(),df.exports=ln;var Bp=df.exports,hh,S0=Bp;hh=S0.createRoot,S0.hydrateRoot;class Lp extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class Fp extends Error{constructor(t,i,l){super(i),this.status=t,this.code=l,this.name="ApiError"}}class Up{constructor(t=(...l)=>fetch(...l),i=""){this.transport=t,this.baseUrl=i}setBaseUrl(t){this.baseUrl=t.replace(/\/+$/,"")}resolve(t){return this.baseUrl+t}async get(t,i){return this.request(t,{method:"GET",headers:i==null?void 0:i.headers})}async post(t,i,l){return this.request(t,{method:"POST",headers:{"content-type":"application/json",...l==null?void 0:l.headers},body:i===void 0?void 0:JSON.stringify(i)})}async patch(t,i,l){return this.request(t,{method:"PATCH",headers:{"content-type":"application/json",...l==null?void 0:l.headers},body:i===void 0?void 0:JSON.stringify(i)})}async delete(t,i){return this.request(t,{method:"DELETE",headers:i==null?void 0:i.headers})}async request(t,i){var c;const l=await this.transport(this.resolve(t),{credentials:"same-origin",cache:"no-store",...i});if(l.status===401||l.status===423)throw window.dispatchEvent(new CustomEvent("webapp:unauthorized")),new Lp;if(!l.ok){let f=`请求失败 (${l.status})`,p;try{const w=await l.json();typeof w.error=="string"?f=w.error:(c=w.error)!=null&&c.message&&(f=w.error.message),typeof w.code=="string"&&(p=w.code)}catch{}throw new Fp(l.status,f,p)}if(l.status!==204)return await l.json()}}const Pl="<think>",Bl="</think>";function I0(e,t){const i=Math.min(t.length-1,e.length);for(let l=i;l>0;l--)if(e.endsWith(t.slice(0,l)))return l;return 0}function Po(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class Wp{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let i="";for(;;){if(this.dropping){const c=this.buffer.indexOf(Bl);if(c===-1){const f=I0(this.buffer,Bl);return this.buffer=this.buffer.slice(this.buffer.length-f),i}this.buffer=this.buffer.slice(c+Bl.length),this.dropping=!1;continue}const l=this.buffer.indexOf(Pl);if(l===-1){const c=I0(this.buffer,Pl);return i+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),i}i+=this.buffer.slice(0,l),this.buffer=this.buffer.slice(l+Pl.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const zp=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,Vp=50;function _0(e){return e instanceof Error&&e.name!=="AbortError"&&zp.test(e.message.trim())}class Hp{constructor(t,i,l,c=f=>new EventSource(f)){this.http=t,this.settings=i,this.projectBridge=l,this.createEventSource=c,this.streams=new Map,this.nativeStreamCursors=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=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,i,l,c,f,p){var M;const w=i.startsWith("runtime:"),C=this.streams.has(i),m=this.pendingRuns.has(i),_=this.nativeStreamCursors.get(i);let v=null,R=null;try{w||await this.openStream(i,this.nativeStreamCursors.get(i)),R=m?null:new Promise(B=>{v=B,this.pendingRuns.set(i,B)});const P=await this.http.post("/api/agent/run",{input:t,sessionId:i,...f!=null&&f.length?{images:f}:{},...l!=null&&l.length?{agentIds:l}:{},...(M=p==null?void 0:p.model)!=null&&M.id?{nativeModel:p.model}:{},...p!=null&&p.reasoningEffort?{nativeReasoningEffort:p.reasoningEffort}:{}});if(w){const B=typeof P.runId=="string"&&(_==null?void 0:_.runId)!==P.runId?{sequence:0,runId:P.runId}:_??{sequence:0,...typeof P.runId=="string"?{runId:P.runId}:{}};await this.openStream(i,B,{waitForOpen:!1})}this.dispatch(i,{type:"run_admitted",...typeof P.runId=="string"?{_nativeRunId:P.runId}:{}}),R&&await R}catch(P){const B=!m&&w&&_0(P)?await this.recoverNativeAdmission(i,_):null;if(B)return await this.openStream(i,B,{waitForOpen:!1}),R&&await R,[];const K=P.code,O=typeof K=="string"?K:P.status===409?"SESSION_OCCUPIED":void 0;w&&O==="SESSION_ALREADY_RUNNING"&&await this.openStream(i,_??{sequence:0},{waitForOpen:!1});const T=C||m||O==="SESSION_ALREADY_RUNNING";this.dispatch(i,{type:"error",message:_0(P)?"网络连接中断,消息未确认发送,请重试":P instanceof Error?P.message:"无法启动运行",...O?{code:O}:{},...T?{_preserveActiveRun:!0}:{}}),T?v&&this.pendingRuns.get(i)===v&&this.pendingRuns.delete(i):(this.closeStream(i),this.settle(i))}return[]}async recoverNativeAdmission(t,i){const l=this.nativeStreamCursors.get(t);if(l!=null&&l.runId&&l.runId!==(i==null?void 0:i.runId))return this.dispatchRecoveredAdmission(t,l),l;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,p=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,w=!!(f&&(i!=null&&i.runId)&&f!==i.runId),C=!!(f&&!(i!=null&&i.runId)&&c.status==="running");return!w&&!C?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:p}),{runId:f,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,i){this.dispatch(t,{type:"run_admitted",...i.runId?{_nativeRunId:i.runId}:{}})}async steer(t,i,l){return(await this.http.post("/api/agent/steer",{input:t,sessionId:i})).steered||this.run(t,i).catch(()=>{}),!0}async steerSessionMessage(t,i){const l=await this.http.post("/api/agent/steer",{sessionId:t,messageId:i});if(!l.steered)throw new Error("当前运行不支持插队消息");return l.state}async abort(t){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const i of[...this.pendingRuns.keys()])this.settle(i);for(const i of[...this.streams.keys()])this.closeStream(i)}}async answerQuestion(t,i,l){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:i,selectedIndices:l}),!0}catch{return!1}}async listSessions(t){const i=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${i}`)}async listAgentWorkspaces(t,i={}){const l=new URLSearchParams({agentType:t});return i.cursor&&l.set("cursor",i.cursor),i.limit!==void 0&&l.set("limit",String(i.limit)),i.refresh&&l.set("refresh","1"),i.since&&l.set("since",i.since),this.http.get(`/api/agent-workspaces?${l.toString()}`)}async importAgentWorkspace(t,i,l){return this.http.post("/api/agent-workspaces",{agentType:t,path:i,...l?{name:l}:{}})}async listAgentWorkspaceSessions(t,i,l={}){const c=new URLSearchParams({agentType:t});return l.cursor&&c.set("cursor",l.cursor),l.limit!==void 0&&c.set("limit",String(l.limit)),l.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(i)}/sessions?${c.toString()}`)}async refreshSessions(t){const i=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${i}`)}async listChildSessions(t){return[]}async getSession(t,i){try{const l=new URLSearchParams;i!=null&&i.before&&l.set("before",i.before),i!=null&&i.after&&l.set("after",i.after),i!=null&&i.anchor&&l.set("anchor",i.anchor),(i==null?void 0:i.limit)!==void 0&&l.set("limit",String(i.limit)),i!=null&&i.view&&l.set("view",i.view),i!=null&&i.revision&&l.set("revision",i.revision),i!=null&&i.turnId&&l.set("turnId",i.turnId);const c=l.size>0?`?${l.toString()}`:"",f=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${c}`);if(Array.isArray(f.messages)&&(f.messages=f.messages.map(p=>typeof p.content=="string"?{...p,content:Po(p.content)}:p)),Array.isArray(f.events)&&(f.events=f.events.map(p=>typeof p.text=="string"&&p.text.includes("<think>")?{...p,text:Po(p.text)}:typeof p.finalText=="string"&&p.finalText.includes("<think>")?{...p,finalText:Po(p.finalText)}:p)),t.startsWith("runtime:")&&typeof f.snapshotRevision=="number"){const p=typeof f.snapshotRunId=="string"?f.snapshotRunId:void 0,w=f.history,C=(w==null?void 0:w.delivery)==="core"||(w==null?void 0:w.delivery)==="trace";if(C||this.rememberNativeStreamCursor(t,f.snapshotRevision,p),f.status==="running"&&f.occupancy!=="owned-externally"){const m=this.nativeStreamCursors.get(t),_=C&&p&&(m==null?void 0:m.runId)!==p?{sequence:0,runId:p}:m??(C?{sequence:0,...p?{runId:p}:{}}:void 0);this.openStream(t,_).catch(()=>{})}}else if(!t.startsWith("runtime:")&&f.status==="active"){const p=f.activeRun;(p==null?void 0:p.running)===!0&&typeof p.eventId=="number"&&this.openStream(t,{sequence:p.eventId}).catch(()=>{})}return f}catch(l){if(l.status===404)return null;throw l}}async getSessionToolResult(t,i){const l=new URLSearchParams(i);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${l.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,i,l){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let f=!1;return c.onmessage=p=>{if(p.data)try{const w=JSON.parse(p.data);w.type==="session_history_changed"&&typeof w.revision=="number"&&i({type:w.type,revision:w.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),l==null||l())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:i})}async getSessionGoals(t){const i=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return i.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),i}async enqueueSessionGoal(t,i,l){var f;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:i,sourceMessageId:l});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,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:i})}async cancelSessionGoal(t,i){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(i)}`)}async enqueueSessionMessage(t,i){var c;await this.openStream(t,this.nativeStreamCursors.get(t));const l=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:i.content,sourceMessageId:i.sourceMessageId,messagePayload:{images:i.images,agentIds:i.agentIds,agentName:i.agentName}});return typeof((c=l.started)==null?void 0:c.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...l.started.runId?{_nativeRunId:l.started.runId}:{}}),l.state}async updateSessionMessage(t,i,l){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:i,objective:l})}async reorderSessionMessages(t,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:i})}async cancelSessionMessage(t,i){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(i)}`)}async createSession(t,i,l,c){return this.http.post("/api/sessions",{title:t,...i?{projectId:i}:{},...l&&l!=="customer-agent"?{agentType:l}:{},...c?{cwd:c}:{}})}async forkSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/fork`,{})}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,i){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:i??""})).project:this.http.post("/api/projects",{name:t,path:i??""})}async updateProject(t,i){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:i.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,i)}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,i){const l=await this.getSettings();if(!(t in l)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof l[t]=="number"?Number(i):Array.isArray(l[t])?JSON.parse(i):i;await this.saveSettings({[t]:c,revision:l.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(),i=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(i))return;const l=(f,p)=>{try{return JSON.parse(localStorage.getItem(f)||"null")??p}catch{return p}},c=l("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:l("webapp.agentDefs",[]),lsp:l("webapp.lspServers",[])}]),localStorage.setItem(i,"1")}business(t,i){return this.http.post("/api/business",{method:t,args:i})}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,i){return this.business("mcpSetEnabled",[t,i])}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,i){return this.business("setSkillEnabled",[t,i])}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,i){return this.business("updateAgentDef",[t,i])}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,i){return this.business("lspSetEnabled",[t,i])}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,i,l){return this.business("cronCreate",[t,i,l])}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,i){const l={...i,_sid:t};for(const c of this.listeners)try{c(l)}catch{}}dispatchStreamEvent(t,i){if(!(t.startsWith("runtime:codex:")&&i.type==="text_chunk"&&i.messagePhase==="commentary"&&typeof i.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,i);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===i._nativeRunId&&c.event.turnId===i.turnId&&c.event.itemId===i.itemId){c.event={...c.event,...i,text:String(c.event.text??"")+i.text};return}this.flushBufferedStreamText(t);const p=setTimeout(()=>this.flushBufferedStreamText(t),Vp);this.bufferedStreamText.set(t,{event:{...i},timer:p})}flushBufferedStreamText(t){const i=this.bufferedStreamText.get(t);i&&(this.bufferedStreamText.delete(t),clearTimeout(i.timer),this.dispatch(t,i.event))}settle(t){const i=this.pendingRuns.get(t);i&&(this.pendingRuns.delete(t),i())}openStream(t,i,l={}){if(this.streams.has(t))return Promise.resolve();this.thinkFilters.set(t,new Wp);const c=new URLSearchParams({sessionId:t});Number.isSafeInteger(i==null?void 0:i.sequence)&&c.set(t.startsWith("runtime:")?"afterSequence":"afterEventId",String(i.sequence)),t.startsWith("runtime:")&&(i!=null&&i.runId)&&c.set("afterRunId",i.runId);const f=this.createEventSource(`/api/agent/stream?${c.toString()}`);let p=!1;this.streams.set(t,f);const w=l.waitForOpen!==!1;let C=w,m=null,_=null,v=null;const R=w?new Promise((M,P)=>{_=M,v=P,m=setTimeout(()=>{C=!1,P(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return f.onopen=()=>{C&&(C=!1,m&&clearTimeout(m),_==null||_())},f.onmessage=M=>{var B;if(!M.data)return;let P;try{P=JSON.parse(M.data)}catch{return}if(typeof P._nativeSequence=="number"){const K=typeof P._nativeRunId=="string"?P._nativeRunId:void 0;if(!this.acceptNativeStreamEvent(t,P._nativeSequence,K))return}if(P.type==="text_chunk"&&typeof P.text=="string"&&(P.text=this.thinkFilters.get(t).push(P.text)),P.type==="done"||P.type==="error"||P.type==="turn_aborted"){const K=((B=this.thinkFilters.get(t))==null?void 0:B.flush())??"";K&&P.type==="done"&&typeof P.finalText=="string"&&(P.finalText=P.finalText+K),p=!0}P.type==="text_chunk"&&P.text===""||(this.dispatchStreamEvent(t,P),(P.type==="done"||P.type==="error"||P.type==="turn_aborted")&&(this.closeStream(t),this.settle(t)))},f.onerror=()=>{if(C&&f.readyState===EventSource.CLOSED){C=!1,m&&clearTimeout(m),v==null||v(new Error("事件流连接失败"));return}if(f.readyState===EventSource.CLOSED){if(this.closeStream(t),p){this.settle(t);return}(async()=>{let M="";for(let P=0;P<8&&!M;P++){P>0&&await new Promise(B=>setTimeout(B,750));try{const B=await this.getSession(t,{limit:50}),K=(B==null?void 0:B.messages)??[],O=K.map(N=>N.role).lastIndexOf("user"),T=K.slice(O+1).filter(N=>N.role==="assistant"&&(N.content??"").trim()).map(N=>N.content.trim()).join(`
41
+ `+f.stack}return{value:e,source:t,stack:c,digest:null}}function Ol(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function Au(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var fp=typeof WeakMap=="function"?WeakMap:Map;function Ud(e,t,i){i=$n(-1,i),i.tag=3,i.payload={element:null};var l=t.value;return i.callback=function(){ma||(ma=!0,Du=l),Au(e,t)},i}function Wd(e,t,i){i=$n(-1,i),i.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var c=t.value;i.payload=function(){return l(c)},i.callback=function(){Au(e,t)}}var f=e.stateNode;return f!==null&&typeof f.componentDidCatch=="function"&&(i.callback=function(){Au(e,t),typeof l!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var p=t.stack;this.componentDidCatch(t.value,{componentStack:p!==null?p:""})}),i}function o0(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new fp;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(c.add(i),e=Ip.bind(null,e,t,i),t.then(e,e))}function a0(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 l0(e,t,i,l,c){return e.mode&1?(e.flags|=65536,e.lanes=c,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=$n(-1,1),t.tag=2,Sr(i,t,1))),i.lanes|=1),e)}var dp=rr.ReactCurrentOwner,qt=!1;function Ut(e,t,i,l){t.child=e===null?pd(t,null,i,l):zi(t,e.child,i,l)}function u0(e,t,i,l,c){i=i.render;var f=t.ref;return Pi(t,c),l=bc(e,t,i,l,f,c),i=Oc(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,nr(e,t,c)):(Ze&&i&&wc(t),t.flags|=1,Ut(e,t,l,c),t.child)}function c0(e,t,i,l,c){if(e===null){var f=i.type;return typeof f=="function"&&!zc(f)&&f.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=f,zd(e,t,f,l,c)):(e=Zo(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!(e.lanes&c)){var p=f.memoizedProps;if(i=i.compare,i=i!==null?i:zs,i(p,l)&&e.ref===t.ref)return nr(e,t,c)}return t.flags|=1,e=Tr(f,l),e.ref=t.ref,e.return=t,t.child=e}function zd(e,t,i,l,c){if(e!==null){var f=e.memoizedProps;if(zs(f,l)&&e.ref===t.ref)if(qt=!1,t.pendingProps=l=f,(e.lanes&c)!==0)e.flags&131072&&(qt=!0);else return t.lanes=e.lanes,nr(e,t,c)}return vu(e,t,i,l,c)}function Vd(e,t,i){var l=t.pendingProps,c=l.children,f=e!==null?e.memoizedState:null;if(l.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(Ni,rn),rn|=i;else{if(!(i&1073741824))return e=f!==null?f.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(Ni,rn),rn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=f!==null?f.baseLanes:i,ze(Ni,rn),rn|=l}else f!==null?(l=f.baseLanes|i,t.memoizedState=null):l=i,ze(Ni,rn),rn|=l;return Ut(e,t,c,i),t.child}function jd(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function vu(e,t,i,l,c){var f=Jt(i)?Qr:Bt.current;return f=Ui(t,f),Pi(t,c),i=bc(e,t,i,l,f,c),l=Oc(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,nr(e,t,c)):(Ze&&l&&wc(t),t.flags|=1,Ut(e,t,i,c),t.child)}function f0(e,t,i,l,c){if(Jt(i)){var f=!0;aa(t)}else f=!1;if(Pi(t,c),t.stateNode===null)Go(e,t),Fd(t,i,l),Cu(t,i,l,c),l=!0;else if(e===null){var p=t.stateNode,w=t.memoizedProps;p.props=w;var C=p.context,m=i.contextType;typeof m=="object"&&m!==null?m=yn(m):(m=Jt(i)?Qr:Bt.current,m=Ui(t,m));var _=i.getDerivedStateFromProps,v=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function";v||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==l||C!==m)&&s0(t,p,l,m),gr=!1;var R=t.memoizedState;p.state=R,da(t,l,p,c),C=t.memoizedState,w!==l||R!==C||$t.current||gr?(typeof _=="function"&&(Eu(t,i,_,l),C=t.memoizedState),(w=gr||i0(t,i,w,l,R,C,m))?(v||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=C),p.props=l,p.state=C,p.context=m,l=w):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{p=t.stateNode,md(e,t),w=t.memoizedProps,m=t.type===t.elementType?w:_n(t.type,w),p.props=m,v=t.pendingProps,R=p.context,C=i.contextType,typeof C=="object"&&C!==null?C=yn(C):(C=Jt(i)?Qr:Bt.current,C=Ui(t,C));var M=i.getDerivedStateFromProps;(_=typeof M=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==v||R!==C)&&s0(t,p,l,C),gr=!1,R=t.memoizedState,p.state=R,da(t,l,p,c);var P=t.memoizedState;w!==v||R!==P||$t.current||gr?(typeof M=="function"&&(Eu(t,i,M,l),P=t.memoizedState),(m=gr||i0(t,i,m,l,R,P,C)||!1)?(_||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,P,C),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,P,C)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),p.props=l,p.state=P,p.context=C,l=m):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),l=!1)}return Su(e,t,i,l,f,c)}function Su(e,t,i,l,c,f){jd(e,t);var p=(t.flags&128)!==0;if(!l&&!p)return c&&Q1(t,i,!1),nr(e,t,f);l=t.stateNode,dp.current=t;var w=p&&typeof i.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&p?(t.child=zi(t,e.child,null,f),t.child=zi(t,null,w,f)):Ut(e,t,w,f),t.memoizedState=l.state,c&&Q1(t,i,!0),t.child}function Hd(e){var t=e.stateNode;t.pendingContext?K1(e,t.pendingContext,t.pendingContext!==t.context):t.context&&K1(e,t.context,!1),_c(e,t.containerInfo)}function d0(e,t,i,l,c){return Wi(),Ec(c),t.flags|=256,Ut(e,t,i,l),t.child}var Iu={dehydrated:null,treeContext:null,retryLane:0};function _u(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gd(e,t,i){var l=t.pendingProps,c=$e.current,f=!1,p=(t.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(c&2)!==0),w?(f=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),ze($e,c&1),e===null)return wu(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):(p=l.children,e=l.fallback,f?(l=t.mode,f=t.child,p={mode:"hidden",children:p},!(l&1)&&f!==null?(f.childLanes=0,f.pendingProps=p):f=Ba(p,l,0,null),e=Kr(e,l,i,null),f.return=t,e.return=t,f.sibling=e,t.child=f,t.child.memoizedState=_u(i),t.memoizedState=Iu,e):kc(t,p));if(c=e.memoizedState,c!==null&&(w=c.dehydrated,w!==null))return hp(e,t,p,l,w,c,i);if(f){f=l.fallback,p=t.mode,c=e.child,w=c.sibling;var C={mode:"hidden",children:l.children};return!(p&1)&&t.child!==c?(l=t.child,l.childLanes=0,l.pendingProps=C,t.deletions=null):(l=Tr(c,C),l.subtreeFlags=c.subtreeFlags&14680064),w!==null?f=Tr(w,f):(f=Kr(f,p,i,null),f.flags|=2),f.return=t,l.return=t,l.sibling=f,t.child=l,l=f,f=t.child,p=e.child.memoizedState,p=p===null?_u(i):{baseLanes:p.baseLanes|i,cachePool:null,transitions:p.transitions},f.memoizedState=p,f.childLanes=e.childLanes&~i,t.memoizedState=Iu,l}return f=e.child,e=f.sibling,l=Tr(f,{mode:"visible",children:l.children}),!(t.mode&1)&&(l.lanes=i),l.return=t,l.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=l,t.memoizedState=null,l}function kc(e,t){return t=Ba({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Oo(e,t,i,l){return l!==null&&Ec(l),zi(t,e.child,null,i),e=kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hp(e,t,i,l,c,f,p){if(i)return t.flags&256?(t.flags&=-257,l=Ol(Error(Q(422))),Oo(e,t,p,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(f=l.fallback,c=t.mode,l=Ba({mode:"visible",children:l.children},c,0,null),f=Kr(f,c,p,null),f.flags|=2,l.return=t,f.return=t,l.sibling=f,t.child=l,t.mode&1&&zi(t,e.child,null,p),t.child.memoizedState=_u(p),t.memoizedState=Iu,f);if(!(t.mode&1))return Oo(e,t,p,null);if(c.data==="$!"){if(l=c.nextSibling&&c.nextSibling.dataset,l)var w=l.dgst;return l=w,f=Error(Q(419)),l=Ol(f,l,void 0),Oo(e,t,p,l)}if(w=(p&e.childLanes)!==0,qt||w){if(l=At,l!==null){switch(p&-p){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&(l.suspendedLanes|p)?0:c,c!==0&&c!==f.retryLane&&(f.retryLane=c,tr(e,c),bn(l,e,c,-1))}return Wc(),l=Ol(Error(Q(421))),Oo(e,t,p,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=_p.bind(null,e),c._reactRetry=t,null):(e=f.treeContext,sn=vr(c.nextSibling),on=t,Ze=!0,Nn=null,e!==null&&(pn[xn++]=Qn,pn[xn++]=qn,pn[xn++]=qr,Qn=e.id,qn=e.overflow,qr=t),t=kc(t,l.children),t.flags|=4096,t)}function h0(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),yu(e.return,t,i)}function Dl(e,t,i,l,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=l,f.tail=i,f.tailMode=c)}function Xd(e,t,i){var l=t.pendingProps,c=l.revealOrder,f=l.tail;if(Ut(e,t,l.children,i),l=$e.current,l&2)l=l&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&&h0(e,i,t);else if(e.tag===19)h0(e,i,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}l&=1}if(ze($e,l),!(t.mode&1))t.memoizedState=null;else switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&ha(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),Dl(t,!1,c,i,f);break;case"backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ha(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}Dl(t,!0,i,null,f);break;case"together":Dl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Go(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function nr(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Jr|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,i=Tr(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Tr(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gp(e,t,i){switch(t.tag){case 3:Hd(t),Wi();break;case 5:wd(t);break;case 1:Jt(t.type)&&aa(t);break;case 4:_c(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;ze(ca,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(ze($e,$e.current&1),t.flags|=128,null):i&t.child.childLanes?Gd(e,t,i):(ze($e,$e.current&1),e=nr(e,t,i),e!==null?e.sibling:null);ze($e,$e.current&1);break;case 19:if(l=(i&t.childLanes)!==0,e.flags&128){if(l)return Xd(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ze($e,$e.current),l)break;return null;case 22:case 23:return t.lanes=0,Vd(e,t,i)}return nr(e,t,i)}var Yd,Tu,Zd,Kd;Yd=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Tu=function(){};Zd=function(e,t,i,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,Yr(Hn.current);var f=null;switch(i){case"input":c=Kl(e,c),l=Kl(e,l),f=[];break;case"select":c=et({},c,{value:void 0}),l=et({},l,{value:void 0}),f=[];break;case"textarea":c=$l(e,c),l=$l(e,l),f=[];break;default:typeof c.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=sa)}eu(i,l);var p;i=null;for(m in c)if(!l.hasOwnProperty(m)&&c.hasOwnProperty(m)&&c[m]!=null)if(m==="style"){var w=c[m];for(p in w)w.hasOwnProperty(p)&&(i||(i={}),i[p]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(ks.hasOwnProperty(m)?f||(f=[]):(f=f||[]).push(m,null));for(m in l){var C=l[m];if(w=c!=null?c[m]:void 0,l.hasOwnProperty(m)&&C!==w&&(C!=null||w!=null))if(m==="style")if(w){for(p in w)!w.hasOwnProperty(p)||C&&C.hasOwnProperty(p)||(i||(i={}),i[p]="");for(p in C)C.hasOwnProperty(p)&&w[p]!==C[p]&&(i||(i={}),i[p]=C[p])}else i||(f||(f=[]),f.push(m,i)),i=C;else m==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,w=w?w.__html:void 0,C!=null&&w!==C&&(f=f||[]).push(m,C)):m==="children"?typeof C!="string"&&typeof C!="number"||(f=f||[]).push(m,""+C):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(ks.hasOwnProperty(m)?(C!=null&&m==="onScroll"&&je("scroll",e),f||w===C||(f=[])):(f=f||[]).push(m,C))}i&&(f=f||[]).push("style",i);var m=f;(t.updateQueue=m)&&(t.flags|=4)}};Kd=function(e,t,i,l){i!==l&&(t.flags|=4)};function ps(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&14680064,l|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function pp(e,t,i){var l=t.pendingProps;switch(yc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(t),null;case 1:return Jt(t.type)&&oa(),Mt(t),null;case 3:return l=t.stateNode,Vi(),He($t),He(Bt),Nc(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Ro(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Nn!==null&&(Pu(Nn),Nn=null))),Tu(e,t),Mt(t),null;case 5:Tc(t);var c=Yr(Xs.current);if(i=t.type,e!==null&&t.stateNode!=null)Zd(e,t,i,l,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(Q(166));return Mt(t),null}if(e=Yr(Hn.current),Ro(t)){l=t.stateNode,i=t.type;var f=t.memoizedProps;switch(l[Vn]=t,l[Hs]=f,e=(t.mode&1)!==0,i){case"dialog":je("cancel",l),je("close",l);break;case"iframe":case"object":case"embed":je("load",l);break;case"video":case"audio":for(c=0;c<Es.length;c++)je(Es[c],l);break;case"source":je("error",l);break;case"img":case"image":case"link":je("error",l),je("load",l);break;case"details":je("toggle",l);break;case"input":A1(l,f),je("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!f.multiple},je("invalid",l);break;case"textarea":S1(l,f),je("invalid",l)}eu(i,f),c=null;for(var p in f)if(f.hasOwnProperty(p)){var w=f[p];p==="children"?typeof w=="string"?l.textContent!==w&&(f.suppressHydrationWarning!==!0&&No(l.textContent,w,e),c=["children",w]):typeof w=="number"&&l.textContent!==""+w&&(f.suppressHydrationWarning!==!0&&No(l.textContent,w,e),c=["children",""+w]):ks.hasOwnProperty(p)&&w!=null&&p==="onScroll"&&je("scroll",l)}switch(i){case"input":Eo(l),v1(l,f,!0);break;case"textarea":Eo(l),I1(l);break;case"select":case"option":break;default:typeof f.onClick=="function"&&(l.onclick=sa)}l=c,t.updateQueue=l,l!==null&&(t.flags|=4)}else{p=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vf(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=p.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(i,{is:l.is}):(e=p.createElement(i),i==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,i),e[Vn]=t,e[Hs]=l,Yd(e,t,!1,!1),t.stateNode=e;e:{switch(p=tu(i,l),i){case"dialog":je("cancel",e),je("close",e),c=l;break;case"iframe":case"object":case"embed":je("load",e),c=l;break;case"video":case"audio":for(c=0;c<Es.length;c++)je(Es[c],e);c=l;break;case"source":je("error",e),c=l;break;case"img":case"image":case"link":je("error",e),je("load",e),c=l;break;case"details":je("toggle",e),c=l;break;case"input":A1(e,l),c=Kl(e,l),je("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=et({},l,{value:void 0}),je("invalid",e);break;case"textarea":S1(e,l),c=$l(e,l),je("invalid",e);break;default:c=l}eu(i,c),w=c;for(f in w)if(w.hasOwnProperty(f)){var C=w[f];f==="style"?_f(e,C):f==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&Sf(e,C)):f==="children"?typeof C=="string"?(i!=="textarea"||C!=="")&&Ps(e,C):typeof C=="number"&&Ps(e,""+C):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(ks.hasOwnProperty(f)?C!=null&&f==="onScroll"&&je("scroll",e):C!=null&&ic(e,f,C,p))}switch(i){case"input":Eo(e),v1(e,l,!1);break;case"textarea":Eo(e),I1(e);break;case"option":l.value!=null&&e.setAttribute("value",""+Nr(l.value));break;case"select":e.multiple=!!l.multiple,f=l.value,f!=null?Oi(e,!!l.multiple,f,!1):l.defaultValue!=null&&Oi(e,!!l.multiple,l.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=sa)}switch(i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Mt(t),null;case 6:if(e&&t.stateNode!=null)Kd(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(Q(166));if(i=Yr(Xs.current),Yr(Hn.current),Ro(t)){if(l=t.stateNode,i=t.memoizedProps,l[Vn]=t,(f=l.nodeValue!==i)&&(e=on,e!==null))switch(e.tag){case 3:No(l.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&No(l.nodeValue,i,(e.mode&1)!==0)}f&&(t.flags|=4)}else l=(i.nodeType===9?i:i.ownerDocument).createTextNode(l),l[Vn]=t,t.stateNode=l}return Mt(t),null;case 13:if(He($e),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ze&&sn!==null&&t.mode&1&&!(t.flags&128))hd(),Wi(),t.flags|=98560,f=!1;else if(f=Ro(t),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(Q(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(Q(317));f[Vn]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mt(t),f=!1}else Nn!==null&&(Pu(Nn),Nn=null),f=!0;if(!f)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,t.mode&1&&(e===null||$e.current&1?mt===0&&(mt=3):Wc())),t.updateQueue!==null&&(t.flags|=4),Mt(t),null);case 4:return Vi(),Tu(e,t),e===null&&Vs(t.stateNode.containerInfo),Mt(t),null;case 10:return vc(t.type._context),Mt(t),null;case 17:return Jt(t.type)&&oa(),Mt(t),null;case 19:if(He($e),f=t.memoizedState,f===null)return Mt(t),null;if(l=(t.flags&128)!==0,p=f.rendering,p===null)if(l)ps(f,!1);else{if(mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(p=ha(e),p!==null){for(t.flags|=128,ps(f,!1),l=p.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=i,i=t.child;i!==null;)f=i,e=l,f.flags&=14680066,p=f.alternate,p===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=p.childLanes,f.lanes=p.lanes,f.child=p.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=p.memoizedProps,f.memoizedState=p.memoizedState,f.updateQueue=p.updateQueue,f.type=p.type,e=p.dependencies,f.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ze($e,$e.current&1|2),t.child}e=e.sibling}f.tail!==null&&lt()>Hi&&(t.flags|=128,l=!0,ps(f,!1),t.lanes=4194304)}else{if(!l)if(e=ha(p),e!==null){if(t.flags|=128,l=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),ps(f,!0),f.tail===null&&f.tailMode==="hidden"&&!p.alternate&&!Ze)return Mt(t),null}else 2*lt()-f.renderingStartTime>Hi&&i!==1073741824&&(t.flags|=128,l=!0,ps(f,!1),t.lanes=4194304);f.isBackwards?(p.sibling=t.child,t.child=p):(i=f.last,i!==null?i.sibling=p:t.child=p,f.last=p)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=lt(),t.sibling=null,i=$e.current,ze($e,l?i&1|2:i&1),t):(Mt(t),null);case 22:case 23:return Uc(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&t.mode&1?rn&1073741824&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function xp(e,t){switch(yc(t),t.tag){case 1:return Jt(t.type)&&oa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),He($t),He(Bt),Nc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Tc(t),null;case 13:if(He($e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He($e),null;case 4:return Vi(),null;case 10:return vc(t.type._context),null;case 22:case 23:return Uc(),null;case 24:return null;default:return null}}var Do=!1,kt=!1,mp=typeof WeakSet=="function"?WeakSet:Set,ie=null;function Ti(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(l){ot(e,t,l)}else i.current=null}function Nu(e,t,i){try{i()}catch(l){ot(e,t,l)}}var g0=!1;function wp(e,t){if(fu=na,e=ed(),mc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,f=l.focusNode;l=l.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var p=0,w=-1,C=-1,m=0,_=0,v=e,R=null;t:for(;;){for(var M;v!==i||c!==0&&v.nodeType!==3||(w=p+c),v!==f||l!==0&&v.nodeType!==3||(C=p+l),v.nodeType===3&&(p+=v.nodeValue.length),(M=v.firstChild)!==null;)R=v,v=M;for(;;){if(v===e)break t;if(R===i&&++m===c&&(w=p),R===f&&++_===l&&(C=p),(M=v.nextSibling)!==null)break;v=R,R=v.parentNode}v=M}i=w===-1||C===-1?null:{start:w,end:C}}else i=null}i=i||{start:0,end:0}}else i=null;for(du={focusedElem:e,selectionRange:i},na=!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 P=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(P!==null){var B=P.memoizedProps,K=P.memoizedState,O=t.stateNode,T=O.getSnapshotBeforeUpdate(t.elementType===t.type?B:_n(t.type,B),K);O.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var N=t.stateNode.containerInfo;N.nodeType===1?N.textContent="":N.nodeType===9&&N.documentElement&&N.removeChild(N.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(G){ot(t,t.return,G)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return P=g0,g0=!1,P}function Rs(e,t,i){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var c=l=l.next;do{if((c.tag&e)===e){var f=c.destroy;c.destroy=void 0,f!==void 0&&Nu(t,i,f)}c=c.next}while(c!==l)}}function ka(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var l=i.create;i.destroy=l()}i=i.next}while(i!==t)}}function Ru(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function Qd(e){var t=e.alternate;t!==null&&(e.alternate=null,Qd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vn],delete t[Hs],delete t[pu],delete t[ep],delete t[tp])),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 qd(e){return e.tag===5||e.tag===3||e.tag===4}function p0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qd(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 bu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=sa));else if(l!==4&&(e=e.child,e!==null))for(bu(e,t,i),e=e.sibling;e!==null;)bu(e,t,i),e=e.sibling}function Ou(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(Ou(e,t,i),e=e.sibling;e!==null;)Ou(e,t,i),e=e.sibling}var Tt=null,Tn=!1;function dr(e,t,i){for(i=i.child;i!==null;)$d(e,t,i),i=i.sibling}function $d(e,t,i){if(jn&&typeof jn.onCommitFiberUnmount=="function")try{jn.onCommitFiberUnmount(_a,i)}catch{}switch(i.tag){case 5:kt||Ti(i,t);case 6:var l=Tt,c=Tn;Tt=null,dr(e,t,i),Tt=l,Tn=c,Tt!==null&&(Tn?(e=Tt,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):Tt.removeChild(i.stateNode));break;case 18:Tt!==null&&(Tn?(e=Tt,i=i.stateNode,e.nodeType===8?Il(e.parentNode,i):e.nodeType===1&&Il(e,i),Us(e)):Il(Tt,i.stateNode));break;case 4:l=Tt,c=Tn,Tt=i.stateNode.containerInfo,Tn=!0,dr(e,t,i),Tt=l,Tn=c;break;case 0:case 11:case 14:case 15:if(!kt&&(l=i.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){c=l=l.next;do{var f=c,p=f.destroy;f=f.tag,p!==void 0&&(f&2||f&4)&&Nu(i,t,p),c=c.next}while(c!==l)}dr(e,t,i);break;case 1:if(!kt&&(Ti(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=i.memoizedProps,l.state=i.memoizedState,l.componentWillUnmount()}catch(w){ot(i,t,w)}dr(e,t,i);break;case 21:dr(e,t,i);break;case 22:i.mode&1?(kt=(l=kt)||i.memoizedState!==null,dr(e,t,i),kt=l):dr(e,t,i);break;default:dr(e,t,i)}}function x0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new mp),t.forEach(function(l){var c=Tp.bind(null,e,l);i.has(l)||(i.add(l),l.then(c,c))})}}function Sn(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l];try{var f=e,p=t,w=p;e:for(;w!==null;){switch(w.tag){case 5:Tt=w.stateNode,Tn=!1;break e;case 3:Tt=w.stateNode.containerInfo,Tn=!0;break e;case 4:Tt=w.stateNode.containerInfo,Tn=!0;break e}w=w.return}if(Tt===null)throw Error(Q(160));$d(f,p,c),Tt=null,Tn=!1;var C=c.alternate;C!==null&&(C.return=null),c.return=null}catch(m){ot(c,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Jd(t,e),t=t.sibling}function Jd(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Sn(t,e),Un(e),l&4){try{Rs(3,e,e.return),ka(3,e)}catch(B){ot(e,e.return,B)}try{Rs(5,e,e.return)}catch(B){ot(e,e.return,B)}}break;case 1:Sn(t,e),Un(e),l&512&&i!==null&&Ti(i,i.return);break;case 5:if(Sn(t,e),Un(e),l&512&&i!==null&&Ti(i,i.return),e.flags&32){var c=e.stateNode;try{Ps(c,"")}catch(B){ot(e,e.return,B)}}if(l&4&&(c=e.stateNode,c!=null)){var f=e.memoizedProps,p=i!==null?i.memoizedProps:f,w=e.type,C=e.updateQueue;if(e.updateQueue=null,C!==null)try{w==="input"&&f.type==="radio"&&f.name!=null&&Cf(c,f),tu(w,p);var m=tu(w,f);for(p=0;p<C.length;p+=2){var _=C[p],v=C[p+1];_==="style"?_f(c,v):_==="dangerouslySetInnerHTML"?Sf(c,v):_==="children"?Ps(c,v):ic(c,_,v,m)}switch(w){case"input":Ql(c,f);break;case"textarea":Af(c,f);break;case"select":var R=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!f.multiple;var M=f.value;M!=null?Oi(c,!!f.multiple,M,!1):R!==!!f.multiple&&(f.defaultValue!=null?Oi(c,!!f.multiple,f.defaultValue,!0):Oi(c,!!f.multiple,f.multiple?[]:"",!1))}c[Hs]=f}catch(B){ot(e,e.return,B)}}break;case 6:if(Sn(t,e),Un(e),l&4){if(e.stateNode===null)throw Error(Q(162));c=e.stateNode,f=e.memoizedProps;try{c.nodeValue=f}catch(B){ot(e,e.return,B)}}break;case 3:if(Sn(t,e),Un(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{Us(t.containerInfo)}catch(B){ot(e,e.return,B)}break;case 4:Sn(t,e),Un(e);break;case 13:Sn(t,e),Un(e),c=e.child,c.flags&8192&&(f=c.memoizedState!==null,c.stateNode.isHidden=f,!f||c.alternate!==null&&c.alternate.memoizedState!==null||(Lc=lt())),l&4&&x0(e);break;case 22:if(_=i!==null&&i.memoizedState!==null,e.mode&1?(kt=(m=kt)||_,Sn(t,e),kt=m):Sn(t,e),Un(e),l&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!_&&e.mode&1)for(ie=e,_=e.child;_!==null;){for(v=ie=_;ie!==null;){switch(R=ie,M=R.child,R.tag){case 0:case 11:case 14:case 15:Rs(4,R,R.return);break;case 1:Ti(R,R.return);var P=R.stateNode;if(typeof P.componentWillUnmount=="function"){l=R,i=R.return;try{t=l,P.props=t.memoizedProps,P.state=t.memoizedState,P.componentWillUnmount()}catch(B){ot(l,i,B)}}break;case 5:Ti(R,R.return);break;case 22:if(R.memoizedState!==null){w0(v);continue}}M!==null?(M.return=R,ie=M):w0(v)}_=_.sibling}e:for(_=null,v=e;;){if(v.tag===5){if(_===null){_=v;try{c=v.stateNode,m?(f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none"):(w=v.stateNode,C=v.memoizedProps.style,p=C!=null&&C.hasOwnProperty("display")?C.display:null,w.style.display=If("display",p))}catch(B){ot(e,e.return,B)}}}else if(v.tag===6){if(_===null)try{v.stateNode.nodeValue=m?"":v.memoizedProps}catch(B){ot(e,e.return,B)}}else if((v.tag!==22&&v.tag!==23||v.memoizedState===null||v===e)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===e)break e;for(;v.sibling===null;){if(v.return===null||v.return===e)break e;_===v&&(_=null),v=v.return}_===v&&(_=null),v.sibling.return=v.return,v=v.sibling}}break;case 19:Sn(t,e),Un(e),l&4&&x0(e);break;case 21:break;default:Sn(t,e),Un(e)}}function Un(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(qd(i)){var l=i;break e}i=i.return}throw Error(Q(160))}switch(l.tag){case 5:var c=l.stateNode;l.flags&32&&(Ps(c,""),l.flags&=-33);var f=p0(e);Ou(e,f,c);break;case 3:case 4:var p=l.stateNode.containerInfo,w=p0(e);bu(e,w,p);break;default:throw Error(Q(161))}}catch(C){ot(e,e.return,C)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yp(e,t,i){ie=e,eh(e)}function eh(e,t,i){for(var l=(e.mode&1)!==0;ie!==null;){var c=ie,f=c.child;if(c.tag===22&&l){var p=c.memoizedState!==null||Do;if(!p){var w=c.alternate,C=w!==null&&w.memoizedState!==null||kt;w=Do;var m=kt;if(Do=p,(kt=C)&&!m)for(ie=c;ie!==null;)p=ie,C=p.child,p.tag===22&&p.memoizedState!==null?y0(c):C!==null?(C.return=p,ie=C):y0(c);for(;f!==null;)ie=f,eh(f),f=f.sibling;ie=c,Do=w,kt=m}m0(e)}else c.subtreeFlags&8772&&f!==null?(f.return=c,ie=f):m0(e)}}function m0(e){for(;ie!==null;){var t=ie;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:kt||ka(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!kt)if(i===null)l.componentDidMount();else{var c=t.elementType===t.type?i.memoizedProps:_n(t.type,i.memoizedProps);l.componentDidUpdate(c,i.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var f=t.updateQueue;f!==null&&t0(t,f,l);break;case 3:var p=t.updateQueue;if(p!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}t0(t,p,i)}break;case 5:var w=t.stateNode;if(i===null&&t.flags&4){i=w;var C=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&i.focus();break;case"img":C.src&&(i.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var _=m.memoizedState;if(_!==null){var v=_.dehydrated;v!==null&&Us(v)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}kt||t.flags&512&&Ru(t)}catch(R){ot(t,t.return,R)}}if(t===e){ie=null;break}if(i=t.sibling,i!==null){i.return=t.return,ie=i;break}ie=t.return}}function w0(e){for(;ie!==null;){var t=ie;if(t===e){ie=null;break}var i=t.sibling;if(i!==null){i.return=t.return,ie=i;break}ie=t.return}}function y0(e){for(;ie!==null;){var t=ie;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{ka(4,t)}catch(C){ot(t,i,C)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var c=t.return;try{l.componentDidMount()}catch(C){ot(t,c,C)}}var f=t.return;try{Ru(t)}catch(C){ot(t,f,C)}break;case 5:var p=t.return;try{Ru(t)}catch(C){ot(t,p,C)}}}catch(C){ot(t,t.return,C)}if(t===e){ie=null;break}var w=t.sibling;if(w!==null){w.return=t.return,ie=w;break}ie=t.return}}var Ep=Math.ceil,xa=rr.ReactCurrentDispatcher,Pc=rr.ReactCurrentOwner,wn=rr.ReactCurrentBatchConfig,Re=0,At=null,ft=null,Nt=0,rn=0,Ni=Dr(0),mt=0,Qs=null,Jr=0,Pa=0,Bc=0,bs=null,Qt=null,Lc=0,Hi=1/0,Zn=null,ma=!1,Du=null,Ir=null,Mo=!1,yr=null,wa=0,Os=0,Mu=null,Xo=-1,Yo=0;function Wt(){return Re&6?lt():Xo!==-1?Xo:Xo=lt()}function _r(e){return e.mode&1?Re&2&&Nt!==0?Nt&-Nt:rp.transition!==null?(Yo===0&&(Yo=Ff()),Yo):(e=ke,e!==0||(e=window.event,e=e===void 0?16:Gf(e.type)),e):1}function bn(e,t,i,l){if(50<Os)throw Os=0,Mu=null,Error(Q(185));eo(e,i,l),(!(Re&2)||e!==At)&&(e===At&&(!(Re&2)&&(Pa|=i),mt===4&&xr(e,Nt)),en(e,l),i===1&&Re===0&&!(t.mode&1)&&(Hi=lt()+500,Oa&&Mr()))}function en(e,t){var i=e.callbackNode;r2(e,t);var l=ta(e,e===At?Nt:0);if(l===0)i!==null&&N1(i),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(i!=null&&N1(i),t===1)e.tag===0?np(E0.bind(null,e)):cd(E0.bind(null,e)),$2(function(){!(Re&6)&&Mr()}),i=null;else{switch(Uf(l)){case 1:i=uc;break;case 4:i=Bf;break;case 16:i=ea;break;case 536870912:i=Lf;break;default:i=ea}i=lh(i,th.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function th(e,t){if(Xo=-1,Yo=0,Re&6)throw Error(Q(327));var i=e.callbackNode;if(Bi()&&e.callbackNode!==i)return null;var l=ta(e,e===At?Nt:0);if(l===0)return null;if(l&30||l&e.expiredLanes||t)t=ya(e,l);else{t=l;var c=Re;Re|=2;var f=rh();(At!==e||Nt!==t)&&(Zn=null,Hi=lt()+500,Zr(e,t));do try{vp();break}catch(w){nh(e,w)}while(!0);Ac(),xa.current=f,Re=c,ft!==null?t=0:(At=null,Nt=0,t=mt)}if(t!==0){if(t===2&&(c=ou(e),c!==0&&(l=c,t=ku(e,c))),t===1)throw i=Qs,Zr(e,0),xr(e,l),en(e,lt()),i;if(t===6)xr(e,l);else{if(c=e.current.alternate,!(l&30)&&!Cp(c)&&(t=ya(e,l),t===2&&(f=ou(e),f!==0&&(l=f,t=ku(e,f))),t===1))throw i=Qs,Zr(e,0),xr(e,l),en(e,lt()),i;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(Q(345));case 2:jr(e,Qt,Zn);break;case 3:if(xr(e,l),(l&130023424)===l&&(t=Lc+500-lt(),10<t)){if(ta(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){Wt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=gu(jr.bind(null,e,Qt,Zn),t);break}jr(e,Qt,Zn);break;case 4:if(xr(e,l),(l&4194240)===l)break;for(t=e.eventTimes,c=-1;0<l;){var p=31-Rn(l);f=1<<p,p=t[p],p>c&&(c=p),l&=~f}if(l=c,l=lt()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Ep(l/1960))-l,10<l){e.timeoutHandle=gu(jr.bind(null,e,Qt,Zn),l);break}jr(e,Qt,Zn);break;case 5:jr(e,Qt,Zn);break;default:throw Error(Q(329))}}}return en(e,lt()),e.callbackNode===i?th.bind(null,e):null}function ku(e,t){var i=bs;return e.current.memoizedState.isDehydrated&&(Zr(e,t).flags|=256),e=ya(e,t),e!==2&&(t=Qt,Qt=i,t!==null&&Pu(t)),e}function Pu(e){Qt===null?Qt=e:Qt.push.apply(Qt,e)}function Cp(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var l=0;l<i.length;l++){var c=i[l],f=c.getSnapshot;c=c.value;try{if(!On(f(),c))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 xr(e,t){for(t&=~Bc,t&=~Pa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Rn(t),l=1<<i;e[i]=-1,t&=~l}}function E0(e){if(Re&6)throw Error(Q(327));Bi();var t=ta(e,0);if(!(t&1))return en(e,lt()),null;var i=ya(e,t);if(e.tag!==0&&i===2){var l=ou(e);l!==0&&(t=l,i=ku(e,l))}if(i===1)throw i=Qs,Zr(e,0),xr(e,t),en(e,lt()),i;if(i===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jr(e,Qt,Zn),en(e,lt()),null}function Fc(e,t){var i=Re;Re|=1;try{return e(t)}finally{Re=i,Re===0&&(Hi=lt()+500,Oa&&Mr())}}function ei(e){yr!==null&&yr.tag===0&&!(Re&6)&&Bi();var t=Re;Re|=1;var i=wn.transition,l=ke;try{if(wn.transition=null,ke=1,e)return e()}finally{ke=l,wn.transition=i,Re=t,!(Re&6)&&Mr()}}function Uc(){rn=Ni.current,He(Ni)}function Zr(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,q2(i)),ft!==null)for(i=ft.return;i!==null;){var l=i;switch(yc(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&oa();break;case 3:Vi(),He($t),He(Bt),Nc();break;case 5:Tc(l);break;case 4:Vi();break;case 13:He($e);break;case 19:He($e);break;case 10:vc(l.type._context);break;case 22:case 23:Uc()}i=i.return}if(At=e,ft=e=Tr(e.current,null),Nt=rn=t,mt=0,Qs=null,Bc=Pa=Jr=0,Qt=bs=null,Xr!==null){for(t=0;t<Xr.length;t++)if(i=Xr[t],l=i.interleaved,l!==null){i.interleaved=null;var c=l.next,f=i.pending;if(f!==null){var p=f.next;f.next=c,l.next=p}i.pending=l}Xr=null}return e}function nh(e,t){do{var i=ft;try{if(Ac(),jo.current=pa,ga){for(var l=Je.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}ga=!1}if($r=0,Ct=xt=Je=null,Ns=!1,Ys=0,Pc.current=null,i===null||i.return===null){mt=1,Qs=t,ft=null;break}e:{var f=e,p=i.return,w=i,C=t;if(t=Nt,w.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var m=C,_=w,v=_.tag;if(!(_.mode&1)&&(v===0||v===11||v===15)){var R=_.alternate;R?(_.updateQueue=R.updateQueue,_.memoizedState=R.memoizedState,_.lanes=R.lanes):(_.updateQueue=null,_.memoizedState=null)}var M=a0(p);if(M!==null){M.flags&=-257,l0(M,p,w,f,t),M.mode&1&&o0(f,m,t),t=M,C=m;var P=t.updateQueue;if(P===null){var B=new Set;B.add(C),t.updateQueue=B}else P.add(C);break e}else{if(!(t&1)){o0(f,m,t),Wc();break e}C=Error(Q(426))}}else if(Ze&&w.mode&1){var K=a0(p);if(K!==null){!(K.flags&65536)&&(K.flags|=256),l0(K,p,w,f,t),Ec(ji(C,w));break e}}f=C=ji(C,w),mt!==4&&(mt=2),bs===null?bs=[f]:bs.push(f),f=p;do{switch(f.tag){case 3:f.flags|=65536,t&=-t,f.lanes|=t;var O=Ud(f,C,t);e0(f,O);break e;case 1:w=C;var T=f.type,N=f.stateNode;if(!(f.flags&128)&&(typeof T.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Ir===null||!Ir.has(N)))){f.flags|=65536,t&=-t,f.lanes|=t;var G=Wd(f,w,t);e0(f,G);break e}}f=f.return}while(f!==null)}sh(i)}catch(j){t=j,ft===i&&i!==null&&(ft=i=i.return);continue}break}while(!0)}function rh(){var e=xa.current;return xa.current=pa,e===null?pa:e}function Wc(){(mt===0||mt===3||mt===2)&&(mt=4),At===null||!(Jr&268435455)&&!(Pa&268435455)||xr(At,Nt)}function ya(e,t){var i=Re;Re|=2;var l=rh();(At!==e||Nt!==t)&&(Zn=null,Zr(e,t));do try{Ap();break}catch(c){nh(e,c)}while(!0);if(Ac(),Re=i,xa.current=l,ft!==null)throw Error(Q(261));return At=null,Nt=0,mt}function Ap(){for(;ft!==null;)ih(ft)}function vp(){for(;ft!==null&&!Zg();)ih(ft)}function ih(e){var t=ah(e.alternate,e,rn);e.memoizedProps=e.pendingProps,t===null?sh(e):ft=t,Pc.current=null}function sh(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=xp(i,t),i!==null){i.flags&=32767,ft=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{mt=6,ft=null;return}}else if(i=pp(i,t,rn),i!==null){ft=i;return}if(t=t.sibling,t!==null){ft=t;return}ft=t=e}while(t!==null);mt===0&&(mt=5)}function jr(e,t,i){var l=ke,c=wn.transition;try{wn.transition=null,ke=1,Sp(e,t,i,l)}finally{wn.transition=c,ke=l}return null}function Sp(e,t,i,l){do Bi();while(yr!==null);if(Re&6)throw Error(Q(327));i=e.finishedWork;var c=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var f=i.lanes|i.childLanes;if(i2(e,f),e===At&&(ft=At=null,Nt=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||Mo||(Mo=!0,lh(ea,function(){return Bi(),null})),f=(i.flags&15990)!==0,i.subtreeFlags&15990||f){f=wn.transition,wn.transition=null;var p=ke;ke=1;var w=Re;Re|=4,Pc.current=null,wp(e,i),Jd(i,e),H2(du),na=!!fu,du=fu=null,e.current=i,yp(i),Kg(),Re=w,ke=p,wn.transition=f}else e.current=i;if(Mo&&(Mo=!1,yr=e,wa=c),f=e.pendingLanes,f===0&&(Ir=null),$g(i.stateNode),en(e,lt()),t!==null)for(l=e.onRecoverableError,i=0;i<t.length;i++)c=t[i],l(c.value,{componentStack:c.stack,digest:c.digest});if(ma)throw ma=!1,e=Du,Du=null,e;return wa&1&&e.tag!==0&&Bi(),f=e.pendingLanes,f&1?e===Mu?Os++:(Os=0,Mu=e):Os=0,Mr(),null}function Bi(){if(yr!==null){var e=Uf(wa),t=wn.transition,i=ke;try{if(wn.transition=null,ke=16>e?16:e,yr===null)var l=!1;else{if(e=yr,yr=null,wa=0,Re&6)throw Error(Q(331));var c=Re;for(Re|=4,ie=e.current;ie!==null;){var f=ie,p=f.child;if(ie.flags&16){var w=f.deletions;if(w!==null){for(var C=0;C<w.length;C++){var m=w[C];for(ie=m;ie!==null;){var _=ie;switch(_.tag){case 0:case 11:case 15:Rs(8,_,f)}var v=_.child;if(v!==null)v.return=_,ie=v;else for(;ie!==null;){_=ie;var R=_.sibling,M=_.return;if(Qd(_),_===m){ie=null;break}if(R!==null){R.return=M,ie=R;break}ie=M}}}var P=f.alternate;if(P!==null){var B=P.child;if(B!==null){P.child=null;do{var K=B.sibling;B.sibling=null,B=K}while(B!==null)}}ie=f}}if(f.subtreeFlags&2064&&p!==null)p.return=f,ie=p;else e:for(;ie!==null;){if(f=ie,f.flags&2048)switch(f.tag){case 0:case 11:case 15:Rs(9,f,f.return)}var O=f.sibling;if(O!==null){O.return=f.return,ie=O;break e}ie=f.return}}var T=e.current;for(ie=T;ie!==null;){p=ie;var N=p.child;if(p.subtreeFlags&2064&&N!==null)N.return=p,ie=N;else e:for(p=T;ie!==null;){if(w=ie,w.flags&2048)try{switch(w.tag){case 0:case 11:case 15:ka(9,w)}}catch(j){ot(w,w.return,j)}if(w===p){ie=null;break e}var G=w.sibling;if(G!==null){G.return=w.return,ie=G;break e}ie=w.return}}if(Re=c,Mr(),jn&&typeof jn.onPostCommitFiberRoot=="function")try{jn.onPostCommitFiberRoot(_a,e)}catch{}l=!0}return l}finally{ke=i,wn.transition=t}}return!1}function C0(e,t,i){t=ji(i,t),t=Ud(e,t,1),e=Sr(e,t,1),t=Wt(),e!==null&&(eo(e,1,t),en(e,t))}function ot(e,t,i){if(e.tag===3)C0(e,e,i);else for(;t!==null;){if(t.tag===3){C0(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ir===null||!Ir.has(l))){e=ji(i,e),e=Wd(t,e,1),t=Sr(t,e,1),e=Wt(),t!==null&&(eo(t,1,e),en(t,e));break}}t=t.return}}function Ip(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&i,At===e&&(Nt&i)===i&&(mt===4||mt===3&&(Nt&130023424)===Nt&&500>lt()-Lc?Zr(e,0):Bc|=i),en(e,t)}function oh(e,t){t===0&&(e.mode&1?(t=vo,vo<<=1,!(vo&130023424)&&(vo=4194304)):t=1);var i=Wt();e=tr(e,t),e!==null&&(eo(e,t,i),en(e,i))}function _p(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),oh(e,i)}function Tp(e,t){var i=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(Q(314))}l!==null&&l.delete(t),oh(e,i)}var ah;ah=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||$t.current)qt=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return qt=!1,gp(e,t,i);qt=!!(e.flags&131072)}else qt=!1,Ze&&t.flags&1048576&&fd(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Go(e,t),e=t.pendingProps;var c=Ui(t,Bt.current);Pi(t,i),c=bc(null,t,l,e,c,i);var f=Oc();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,Jt(l)?(f=!0,aa(t)):f=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Ic(t),c.updater=Ma,t.stateNode=c,c._reactInternals=t,Cu(t,l,e,i),t=Su(null,t,l,!0,f,i)):(t.tag=0,Ze&&f&&wc(t),Ut(null,t,c,i),t=t.child),t;case 16:l=t.elementType;e:{switch(Go(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=Rp(l),e=_n(l,e),c){case 0:t=vu(null,t,l,e,i);break e;case 1:t=f0(null,t,l,e,i);break e;case 11:t=u0(null,t,l,e,i);break e;case 14:t=c0(null,t,l,_n(l.type,e),i);break e}throw Error(Q(306,l,""))}return t;case 0:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),vu(e,t,l,c,i);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),f0(e,t,l,c,i);case 3:e:{if(Hd(t),e===null)throw Error(Q(387));l=t.pendingProps,f=t.memoizedState,c=f.element,md(e,t),da(t,l,null,i);var p=t.memoizedState;if(l=p.element,f.isDehydrated)if(f={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){c=ji(Error(Q(423)),t),t=d0(e,t,l,i,c);break e}else if(l!==c){c=ji(Error(Q(424)),t),t=d0(e,t,l,i,c);break e}else for(sn=vr(t.stateNode.containerInfo.firstChild),on=t,Ze=!0,Nn=null,i=pd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Wi(),l===c){t=nr(e,t,i);break e}Ut(e,t,l,i)}t=t.child}return t;case 5:return wd(t),e===null&&wu(t),l=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,p=c.children,hu(l,c)?p=null:f!==null&&hu(l,f)&&(t.flags|=32),jd(e,t),Ut(e,t,p,i),t.child;case 6:return e===null&&wu(t),null;case 13:return Gd(e,t,i);case 4:return _c(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=zi(t,null,l,i):Ut(e,t,l,i),t.child;case 11:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),u0(e,t,l,c,i);case 7:return Ut(e,t,t.pendingProps,i),t.child;case 8:return Ut(e,t,t.pendingProps.children,i),t.child;case 12:return Ut(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(l=t.type._context,c=t.pendingProps,f=t.memoizedProps,p=c.value,ze(ca,l._currentValue),l._currentValue=p,f!==null)if(On(f.value,p)){if(f.children===c.children&&!$t.current){t=nr(e,t,i);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var w=f.dependencies;if(w!==null){p=f.child;for(var C=w.firstContext;C!==null;){if(C.context===l){if(f.tag===1){C=$n(-1,i&-i),C.tag=2;var m=f.updateQueue;if(m!==null){m=m.shared;var _=m.pending;_===null?C.next=C:(C.next=_.next,_.next=C),m.pending=C}}f.lanes|=i,C=f.alternate,C!==null&&(C.lanes|=i),yu(f.return,i,t),w.lanes|=i;break}C=C.next}}else if(f.tag===10)p=f.type===t.type?null:f.child;else if(f.tag===18){if(p=f.return,p===null)throw Error(Q(341));p.lanes|=i,w=p.alternate,w!==null&&(w.lanes|=i),yu(p,i,t),p=f.sibling}else p=f.child;if(p!==null)p.return=f;else for(p=f;p!==null;){if(p===t){p=null;break}if(f=p.sibling,f!==null){f.return=p.return,p=f;break}p=p.return}f=p}Ut(e,t,c.children,i),t=t.child}return t;case 9:return c=t.type,l=t.pendingProps.children,Pi(t,i),c=yn(c),l=l(c),t.flags|=1,Ut(e,t,l,i),t.child;case 14:return l=t.type,c=_n(l,t.pendingProps),c=_n(l.type,c),c0(e,t,l,c,i);case 15:return zd(e,t,t.type,t.pendingProps,i);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:_n(l,c),Go(e,t),t.tag=1,Jt(l)?(e=!0,aa(t)):e=!1,Pi(t,i),Fd(t,l,c),Cu(t,l,c,i),Su(null,t,l,!0,e,i);case 19:return Xd(e,t,i);case 22:return Vd(e,t,i)}throw Error(Q(156,t.tag))};function lh(e,t){return Pf(e,t)}function Np(e,t,i,l){this.tag=e,this.key=i,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,t,i,l){return new Np(e,t,i,l)}function zc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Rp(e){if(typeof e=="function")return zc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===oc)return 11;if(e===ac)return 14}return 2}function Tr(e,t){var i=e.alternate;return i===null?(i=mn(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Zo(e,t,i,l,c,f){var p=2;if(l=e,typeof e=="function")zc(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case wi:return Kr(i.children,c,f,t);case sc:p=8,c|=8;break;case Gl:return e=mn(12,i,t,c|2),e.elementType=Gl,e.lanes=f,e;case Xl:return e=mn(13,i,t,c),e.elementType=Xl,e.lanes=f,e;case Yl:return e=mn(19,i,t,c),e.elementType=Yl,e.lanes=f,e;case wf:return Ba(i,c,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xf:p=10;break e;case mf:p=9;break e;case oc:p=11;break e;case ac:p=14;break e;case hr:p=16,l=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=mn(p,i,t,c),t.elementType=e,t.type=l,t.lanes=f,t}function Kr(e,t,i,l){return e=mn(7,e,l,t),e.lanes=i,e}function Ba(e,t,i,l){return e=mn(22,e,l,t),e.elementType=wf,e.lanes=i,e.stateNode={isHidden:!1},e}function Ml(e,t,i){return e=mn(6,e,null,t),e.lanes=i,e}function kl(e,t,i){return t=mn(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bp(e,t,i,l,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=gl(0),this.expirationTimes=gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gl(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function Vc(e,t,i,l,c,f,p,w,C){return e=new bp(e,t,i,w,C),t===1?(t=1,f===!0&&(t|=8)):t=0,f=mn(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:l,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ic(f),e}function Op(e,t,i){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:mi,key:l==null?null:""+l,children:e,containerInfo:t,implementation:i}}function uh(e){if(!e)return Rr;e=e._reactInternals;e:{if(ni(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var i=e.type;if(Jt(i))return ud(e,i,t)}return t}function ch(e,t,i,l,c,f,p,w,C){return e=Vc(i,l,!0,e,c,f,p,w,C),e.context=uh(null),i=e.current,l=Wt(),c=_r(i),f=$n(l,c),f.callback=t??null,Sr(i,f,c),e.current.lanes=c,eo(e,c,l),en(e,l),e}function La(e,t,i,l){var c=t.current,f=Wt(),p=_r(c);return i=uh(i),t.context===null?t.context=i:t.pendingContext=i,t=$n(f,p),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=Sr(c,t,p),e!==null&&(bn(e,c,p,f),Vo(e,c,p)),p}function Ea(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 A0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function jc(e,t){A0(e,t),(e=e.alternate)&&A0(e,t)}function Dp(){return null}var fh=typeof reportError=="function"?reportError:function(e){console.error(e)};function Hc(e){this._internalRoot=e}Fa.prototype.render=Hc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));La(e,t,null,null)};Fa.prototype.unmount=Hc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ei(function(){La(null,e,null,null)}),t[er]=null}};function Fa(e){this._internalRoot=e}Fa.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vf();e={blockedOn:null,target:e,priority:t};for(var i=0;i<pr.length&&t!==0&&t<pr[i].priority;i++);pr.splice(i,0,e),i===0&&Hf(e)}};function Gc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ua(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function v0(){}function Mp(e,t,i,l,c){if(c){if(typeof l=="function"){var f=l;l=function(){var m=Ea(p);f.call(m)}}var p=ch(t,l,e,0,null,!1,!1,"",v0);return e._reactRootContainer=p,e[er]=p.current,Vs(e.nodeType===8?e.parentNode:e),ei(),p}for(;c=e.lastChild;)e.removeChild(c);if(typeof l=="function"){var w=l;l=function(){var m=Ea(C);w.call(m)}}var C=Vc(e,0,!1,null,null,!1,!1,"",v0);return e._reactRootContainer=C,e[er]=C.current,Vs(e.nodeType===8?e.parentNode:e),ei(function(){La(t,C,i,l)}),C}function Wa(e,t,i,l,c){var f=i._reactRootContainer;if(f){var p=f;if(typeof c=="function"){var w=c;c=function(){var C=Ea(p);w.call(C)}}La(t,p,e,c)}else p=Mp(i,t,e,c,l);return Ea(p)}Wf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=ys(t.pendingLanes);i!==0&&(cc(t,i|1),en(t,lt()),!(Re&6)&&(Hi=lt()+500,Mr()))}break;case 13:ei(function(){var l=tr(e,1);if(l!==null){var c=Wt();bn(l,e,1,c)}}),jc(e,1)}};fc=function(e){if(e.tag===13){var t=tr(e,134217728);if(t!==null){var i=Wt();bn(t,e,134217728,i)}jc(e,134217728)}};zf=function(e){if(e.tag===13){var t=_r(e),i=tr(e,t);if(i!==null){var l=Wt();bn(i,e,t,l)}jc(e,t)}};Vf=function(){return ke};jf=function(e,t){var i=ke;try{return ke=e,t()}finally{ke=i}};ru=function(e,t,i){switch(t){case"input":if(Ql(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=ba(l);if(!c)throw Error(Q(90));Ef(l),Ql(l,c)}}}break;case"textarea":Af(e,i);break;case"select":t=i.value,t!=null&&Oi(e,!!i.multiple,t,!1)}};Rf=Fc;bf=ei;var kp={usingClientEntryPoint:!1,Events:[no,Ai,ba,Tf,Nf,Fc]},xs={findFiberByHostInstance:Gr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Pp={bundleType:xs.bundleType,version:xs.version,rendererPackageName:xs.rendererPackageName,rendererConfig:xs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:rr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Mf(e),e===null?null:e.stateNode},findFiberByHostInstance:xs.findFiberByHostInstance||Dp,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 ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ko.isDisabled&&ko.supportsFiber)try{_a=ko.inject(Pp),jn=ko}catch{}}ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kp;ln.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gc(t))throw Error(Q(200));return Op(e,t,null,i)};ln.createRoot=function(e,t){if(!Gc(e))throw Error(Q(299));var i=!1,l="",c=fh;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Vc(e,1,!1,null,null,i,!1,l,c),e[er]=t.current,Vs(e.nodeType===8?e.parentNode:e),new Hc(t)};ln.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=Mf(t),e=e===null?null:e.stateNode,e};ln.flushSync=function(e){return ei(e)};ln.hydrate=function(e,t,i){if(!Ua(t))throw Error(Q(200));return Wa(null,e,t,!0,i)};ln.hydrateRoot=function(e,t,i){if(!Gc(e))throw Error(Q(405));var l=i!=null&&i.hydratedSources||null,c=!1,f="",p=fh;if(i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onRecoverableError!==void 0&&(p=i.onRecoverableError)),t=ch(t,null,e,1,i??null,c,!1,f,p),e[er]=t.current,Vs(e),l)for(e=0;e<l.length;e++)i=l[e],c=i._getVersion,c=c(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,c]:t.mutableSourceEagerHydrationData.push(i,c);return new Fa(t)};ln.render=function(e,t,i){if(!Ua(t))throw Error(Q(200));return Wa(null,e,t,!1,i)};ln.unmountComponentAtNode=function(e){if(!Ua(e))throw Error(Q(40));return e._reactRootContainer?(ei(function(){Wa(null,null,e,!1,function(){e._reactRootContainer=null,e[er]=null})}),!0):!1};ln.unstable_batchedUpdates=Fc;ln.unstable_renderSubtreeIntoContainer=function(e,t,i,l){if(!Ua(i))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Wa(e,t,i,!1,l)};ln.version="18.3.1-next-f1338f8080-20240426";function dh(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dh)}catch(e){console.error(e)}}dh(),df.exports=ln;var hh=df.exports;function Bp({message:e,showGuidance:t,onClose:i}){const l=ct.useRef(null);return ct.useEffect(()=>{var c;(c=l.current)==null||c.showModal()},[]),hh.createPortal(te.jsx("dialog",{ref:l,"aria-label":"远程桌面提醒",onCancel:i,onClick:c=>{c.target===c.currentTarget&&i()},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:te.jsxs("div",{style:{padding:20},children:[te.jsx("strong",{children:"远程桌面提醒"}),te.jsx("p",{children:e}),t&&te.jsxs(te.Fragment,{children:[te.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),te.jsx("p",{children:"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),te.jsx("button",{type:"button",className:"ui-quiet-button",onClick:i,autoFocus:!0,children:"知道了"})]})}),document.body)}function Lp(){const[e,t]=ct.useState(null),[i,l]=ct.useState(!1),[c,f]=ct.useState(!1),[p,w]=ct.useState(""),C=["127.0.0.1","localhost","[::1]"].includes(location.hostname),m=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);if(ct.useEffect(()=>{let v=!0;const R=async()=>{try{const P=await fetch(m&&C?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!P.ok)return;const B=await P.json();v&&t(B)}catch{}};R();const M=setInterval(R,2e3);return()=>{v=!1,clearInterval(M)}},[m,C]),!m){if(!e||e.online&&e.accessibility)return null;const v=e.supported?e.installed?e.enabled?!e.screen||!e.accessibility?"电脑的远程桌面授权尚未完成。":"电脑桌面正在连接,请稍候。":"电脑尚未开启桌面共享,请在电脑上完成授权并开启共享。":"电脑缺少远程桌面组件,请在电脑上升级 CLI。":"这台电脑暂不支持远程桌面。";return te.jsxs("div",{className:"remote-desktop-guidance",children:[te.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"查看远程桌面提醒","aria-haspopup":"dialog","aria-expanded":i,onClick:()=>l(!0),style:{color:"var(--warning, #d97706)",minWidth:44,minHeight:44},children:te.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[te.jsx("circle",{cx:"12",cy:"12",r:"9"}),te.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),i&&te.jsx(Bp,{message:v,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>l(!1)})]})}if(!C)return te.jsxs("div",{style:{position:"relative",marginLeft:12},children:[te.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>l(!i),"aria-expanded":i,"aria-label":"远程授权",title:"远程授权",children:te.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:[te.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),te.jsx("path",{d:"m9 12 2 2 4-4"})]})}),i&&te.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:[te.jsx("strong",{children:"远程授权"}),te.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开本机页面,完成配对后设置屏幕录制和辅助功能权限。"}),te.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",style:{padding:"10px 16px",background:"var(--accent, #5264ff)",color:"#fff",borderRadius:8},onClick:()=>window.open(`http://127.0.0.1:${location.port||"3000"}/web`,"_blank","noopener,noreferrer"),children:"打开本机授权页面"}),te.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const _=async(v,R)=>{f(!0),w("");try{const M=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:v,permission:R})}),P=await M.json();if(!M.ok)throw new Error(P.error||"操作失败");t(P)}catch(M){w(M instanceof Error?M.message:"操作失败")}finally{f(!1)}};return te.jsxs("div",{style:{position:"relative",marginLeft:12},children:[te.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>l(!i),"aria-expanded":i,"aria-label":"远程授权",title:"远程授权",children:te.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:[te.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),te.jsx("path",{d:"m9 12 2 2 4-4"})]})}),i&&te.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:[te.jsx("strong",{children:"远程授权"}),te.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.supported?e.installed?te.jsxs(te.Fragment,{children:[["screen","accessibility"].map(v=>te.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[te.jsxs("span",{children:[v==="screen"?"屏幕录制":"辅助功能",":",e[v]?"已授权":"待授权"]}),te.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("authorize",v),children:"去授权"})]},v)),te.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[te.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),te.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("recheck"),children:"重新检测"}),te.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void _("restart"),children:"重启授权组件"})]}),te.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待系统授权或首帧画面…":"尚未开启共享。"}),te.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):te.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):te.jsx("p",{children:"目前支持 macOS 14 及以上的 Apple Silicon 电脑。"}),(p||e.error)&&te.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:p||e.error})]})]})}var gh,S0=hh;gh=S0.createRoot,S0.hydrateRoot;class Fp extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class Up extends Error{constructor(t,i,l){super(i),this.status=t,this.code=l,this.name="ApiError"}}class Wp{constructor(t=(...l)=>fetch(...l),i=""){this.transport=t,this.baseUrl=i}setBaseUrl(t){this.baseUrl=t.replace(/\/+$/,"")}resolve(t){return this.baseUrl+t}async get(t,i){return this.request(t,{method:"GET",headers:i==null?void 0:i.headers})}async post(t,i,l){return this.request(t,{method:"POST",headers:{"content-type":"application/json",...l==null?void 0:l.headers},body:i===void 0?void 0:JSON.stringify(i)})}async patch(t,i,l){return this.request(t,{method:"PATCH",headers:{"content-type":"application/json",...l==null?void 0:l.headers},body:i===void 0?void 0:JSON.stringify(i)})}async delete(t,i){return this.request(t,{method:"DELETE",headers:i==null?void 0:i.headers})}async request(t,i){var c;const l=await this.transport(this.resolve(t),{credentials:"same-origin",cache:"no-store",...i});if(l.status===401||l.status===423)throw window.dispatchEvent(new CustomEvent("webapp:unauthorized")),new Fp;if(!l.ok){let f=`请求失败 (${l.status})`,p;try{const w=await l.json();typeof w.error=="string"?f=w.error:(c=w.error)!=null&&c.message&&(f=w.error.message),typeof w.code=="string"&&(p=w.code)}catch{}throw new Up(l.status,f,p)}if(l.status!==204)return await l.json()}}const Pl="<think>",Bl="</think>";function I0(e,t){const i=Math.min(t.length-1,e.length);for(let l=i;l>0;l--)if(e.endsWith(t.slice(0,l)))return l;return 0}function Po(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class zp{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let i="";for(;;){if(this.dropping){const c=this.buffer.indexOf(Bl);if(c===-1){const f=I0(this.buffer,Bl);return this.buffer=this.buffer.slice(this.buffer.length-f),i}this.buffer=this.buffer.slice(c+Bl.length),this.dropping=!1;continue}const l=this.buffer.indexOf(Pl);if(l===-1){const c=I0(this.buffer,Pl);return i+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),i}i+=this.buffer.slice(0,l),this.buffer=this.buffer.slice(l+Pl.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const Vp=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,jp=50;function _0(e){return e instanceof Error&&e.name!=="AbortError"&&Vp.test(e.message.trim())}class Hp{constructor(t,i,l,c=f=>new EventSource(f)){this.http=t,this.settings=i,this.projectBridge=l,this.createEventSource=c,this.streams=new Map,this.nativeStreamCursors=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=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,i,l,c,f,p){var M;const w=i.startsWith("runtime:"),C=this.streams.has(i),m=this.pendingRuns.has(i),_=this.nativeStreamCursors.get(i);let v=null,R=null;try{w||await this.openStream(i,this.nativeStreamCursors.get(i)),R=m?null:new Promise(B=>{v=B,this.pendingRuns.set(i,B)});const P=await this.http.post("/api/agent/run",{input:t,sessionId:i,...f!=null&&f.length?{images:f}:{},...l!=null&&l.length?{agentIds:l}:{},...(M=p==null?void 0:p.model)!=null&&M.id?{nativeModel:p.model}:{},...p!=null&&p.reasoningEffort?{nativeReasoningEffort:p.reasoningEffort}:{}});if(w){const B=typeof P.runId=="string"&&(_==null?void 0:_.runId)!==P.runId?{sequence:0,runId:P.runId}:_??{sequence:0,...typeof P.runId=="string"?{runId:P.runId}:{}};await this.openStream(i,B,{waitForOpen:!1})}this.dispatch(i,{type:"run_admitted",...typeof P.runId=="string"?{_nativeRunId:P.runId}:{}}),R&&await R}catch(P){const B=!m&&w&&_0(P)?await this.recoverNativeAdmission(i,_):null;if(B)return await this.openStream(i,B,{waitForOpen:!1}),R&&await R,[];const K=P.code,O=typeof K=="string"?K:P.status===409?"SESSION_OCCUPIED":void 0;w&&O==="SESSION_ALREADY_RUNNING"&&await this.openStream(i,_??{sequence:0},{waitForOpen:!1});const T=C||m||O==="SESSION_ALREADY_RUNNING";this.dispatch(i,{type:"error",message:_0(P)?"网络连接中断,消息未确认发送,请重试":P instanceof Error?P.message:"无法启动运行",...O?{code:O}:{},...T?{_preserveActiveRun:!0}:{}}),T?v&&this.pendingRuns.get(i)===v&&this.pendingRuns.delete(i):(this.closeStream(i),this.settle(i))}return[]}async recoverNativeAdmission(t,i){const l=this.nativeStreamCursors.get(t);if(l!=null&&l.runId&&l.runId!==(i==null?void 0:i.runId))return this.dispatchRecoveredAdmission(t,l),l;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,p=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,w=!!(f&&(i!=null&&i.runId)&&f!==i.runId),C=!!(f&&!(i!=null&&i.runId)&&c.status==="running");return!w&&!C?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:p}),{runId:f,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,i){this.dispatch(t,{type:"run_admitted",...i.runId?{_nativeRunId:i.runId}:{}})}async steer(t,i,l){return(await this.http.post("/api/agent/steer",{input:t,sessionId:i})).steered||this.run(t,i).catch(()=>{}),!0}async steerSessionMessage(t,i){const l=await this.http.post("/api/agent/steer",{sessionId:t,messageId:i});if(!l.steered)throw new Error("当前运行不支持插队消息");return l.state}async abort(t){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const i of[...this.pendingRuns.keys()])this.settle(i);for(const i of[...this.streams.keys()])this.closeStream(i)}}async answerQuestion(t,i,l){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:i,selectedIndices:l}),!0}catch{return!1}}async listSessions(t){const i=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${i}`)}async listAgentWorkspaces(t,i={}){const l=new URLSearchParams({agentType:t});return i.cursor&&l.set("cursor",i.cursor),i.limit!==void 0&&l.set("limit",String(i.limit)),i.refresh&&l.set("refresh","1"),i.since&&l.set("since",i.since),this.http.get(`/api/agent-workspaces?${l.toString()}`)}async importAgentWorkspace(t,i,l){return this.http.post("/api/agent-workspaces",{agentType:t,path:i,...l?{name:l}:{}})}async listAgentWorkspaceSessions(t,i,l={}){const c=new URLSearchParams({agentType:t});return l.cursor&&c.set("cursor",l.cursor),l.limit!==void 0&&c.set("limit",String(l.limit)),l.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(i)}/sessions?${c.toString()}`)}async refreshSessions(t){const i=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${i}`)}async listChildSessions(t){return[]}async getSession(t,i){try{const l=new URLSearchParams;i!=null&&i.before&&l.set("before",i.before),i!=null&&i.after&&l.set("after",i.after),i!=null&&i.anchor&&l.set("anchor",i.anchor),(i==null?void 0:i.limit)!==void 0&&l.set("limit",String(i.limit)),i!=null&&i.view&&l.set("view",i.view),i!=null&&i.revision&&l.set("revision",i.revision),i!=null&&i.turnId&&l.set("turnId",i.turnId);const c=l.size>0?`?${l.toString()}`:"",f=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${c}`);if(Array.isArray(f.messages)&&(f.messages=f.messages.map(p=>typeof p.content=="string"?{...p,content:Po(p.content)}:p)),Array.isArray(f.events)&&(f.events=f.events.map(p=>typeof p.text=="string"&&p.text.includes("<think>")?{...p,text:Po(p.text)}:typeof p.finalText=="string"&&p.finalText.includes("<think>")?{...p,finalText:Po(p.finalText)}:p)),t.startsWith("runtime:")&&typeof f.snapshotRevision=="number"){const p=typeof f.snapshotRunId=="string"?f.snapshotRunId:void 0,w=f.history,C=(w==null?void 0:w.delivery)==="core"||(w==null?void 0:w.delivery)==="trace";if(C||this.rememberNativeStreamCursor(t,f.snapshotRevision,p),f.status==="running"&&f.occupancy!=="owned-externally"){const m=this.nativeStreamCursors.get(t),_=C&&p&&(m==null?void 0:m.runId)!==p?{sequence:0,runId:p}:m??(C?{sequence:0,...p?{runId:p}:{}}:void 0);this.openStream(t,_).catch(()=>{})}}else if(!t.startsWith("runtime:")&&f.status==="active"){const p=f.activeRun;(p==null?void 0:p.running)===!0&&typeof p.eventId=="number"&&this.openStream(t,{sequence:p.eventId}).catch(()=>{})}return f}catch(l){if(l.status===404)return null;throw l}}async getSessionToolResult(t,i){const l=new URLSearchParams(i);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${l.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,i,l){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let f=!1;return c.onmessage=p=>{if(p.data)try{const w=JSON.parse(p.data);w.type==="session_history_changed"&&typeof w.revision=="number"&&i({type:w.type,revision:w.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),l==null||l())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:i})}async getSessionGoals(t){const i=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return i.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),i}async enqueueSessionGoal(t,i,l){var f;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:i,sourceMessageId:l});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,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:i})}async cancelSessionGoal(t,i){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(i)}`)}async enqueueSessionMessage(t,i){var c;await this.openStream(t,this.nativeStreamCursors.get(t));const l=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:i.content,sourceMessageId:i.sourceMessageId,messagePayload:{images:i.images,agentIds:i.agentIds,agentName:i.agentName}});return typeof((c=l.started)==null?void 0:c.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...l.started.runId?{_nativeRunId:l.started.runId}:{}}),l.state}async updateSessionMessage(t,i,l){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:i,objective:l})}async reorderSessionMessages(t,i){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:i})}async cancelSessionMessage(t,i){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(i)}`)}async createSession(t,i,l,c){return this.http.post("/api/sessions",{title:t,...i?{projectId:i}:{},...l&&l!=="customer-agent"?{agentType:l}:{},...c?{cwd:c}:{}})}async forkSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/fork`,{})}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,i){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:i??""})).project:this.http.post("/api/projects",{name:t,path:i??""})}async updateProject(t,i){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:i.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,i)}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,i){const l=await this.getSettings();if(!(t in l)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof l[t]=="number"?Number(i):Array.isArray(l[t])?JSON.parse(i):i;await this.saveSettings({[t]:c,revision:l.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(),i=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(i))return;const l=(f,p)=>{try{return JSON.parse(localStorage.getItem(f)||"null")??p}catch{return p}},c=l("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:l("webapp.agentDefs",[]),lsp:l("webapp.lspServers",[])}]),localStorage.setItem(i,"1")}business(t,i){return this.http.post("/api/business",{method:t,args:i})}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,i){return this.business("mcpSetEnabled",[t,i])}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,i){return this.business("setSkillEnabled",[t,i])}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,i){return this.business("updateAgentDef",[t,i])}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,i){return this.business("lspSetEnabled",[t,i])}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,i,l){return this.business("cronCreate",[t,i,l])}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,i){const l={...i,_sid:t};for(const c of this.listeners)try{c(l)}catch{}}dispatchStreamEvent(t,i){if(!(t.startsWith("runtime:codex:")&&i.type==="text_chunk"&&i.messagePhase==="commentary"&&typeof i.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,i);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===i._nativeRunId&&c.event.turnId===i.turnId&&c.event.itemId===i.itemId){c.event={...c.event,...i,text:String(c.event.text??"")+i.text};return}this.flushBufferedStreamText(t);const p=setTimeout(()=>this.flushBufferedStreamText(t),jp);this.bufferedStreamText.set(t,{event:{...i},timer:p})}flushBufferedStreamText(t){const i=this.bufferedStreamText.get(t);i&&(this.bufferedStreamText.delete(t),clearTimeout(i.timer),this.dispatch(t,i.event))}settle(t){const i=this.pendingRuns.get(t);i&&(this.pendingRuns.delete(t),i())}openStream(t,i,l={}){if(this.streams.has(t))return Promise.resolve();this.thinkFilters.set(t,new zp);const c=new URLSearchParams({sessionId:t});Number.isSafeInteger(i==null?void 0:i.sequence)&&c.set(t.startsWith("runtime:")?"afterSequence":"afterEventId",String(i.sequence)),t.startsWith("runtime:")&&(i!=null&&i.runId)&&c.set("afterRunId",i.runId);const f=this.createEventSource(`/api/agent/stream?${c.toString()}`);let p=!1;this.streams.set(t,f);const w=l.waitForOpen!==!1;let C=w,m=null,_=null,v=null;const R=w?new Promise((M,P)=>{_=M,v=P,m=setTimeout(()=>{C=!1,P(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return f.onopen=()=>{C&&(C=!1,m&&clearTimeout(m),_==null||_())},f.onmessage=M=>{var B;if(!M.data)return;let P;try{P=JSON.parse(M.data)}catch{return}if(typeof P._nativeSequence=="number"){const K=typeof P._nativeRunId=="string"?P._nativeRunId:void 0;if(!this.acceptNativeStreamEvent(t,P._nativeSequence,K))return}if(P.type==="text_chunk"&&typeof P.text=="string"&&(P.text=this.thinkFilters.get(t).push(P.text)),P.type==="done"||P.type==="error"||P.type==="turn_aborted"){const K=((B=this.thinkFilters.get(t))==null?void 0:B.flush())??"";K&&P.type==="done"&&typeof P.finalText=="string"&&(P.finalText=P.finalText+K),p=!0}P.type==="text_chunk"&&P.text===""||(this.dispatchStreamEvent(t,P),(P.type==="done"||P.type==="error"||P.type==="turn_aborted")&&(this.closeStream(t),this.settle(t)))},f.onerror=()=>{if(C&&f.readyState===EventSource.CLOSED){C=!1,m&&clearTimeout(m),v==null||v(new Error("事件流连接失败"));return}if(f.readyState===EventSource.CLOSED){if(this.closeStream(t),p){this.settle(t);return}(async()=>{let M="";for(let P=0;P<8&&!M;P++){P>0&&await new Promise(B=>setTimeout(B,750));try{const B=await this.getSession(t,{limit:50}),K=(B==null?void 0:B.messages)??[],O=K.map(N=>N.role).lastIndexOf("user"),T=K.slice(O+1).filter(N=>N.role==="assistant"&&(N.content??"").trim()).map(N=>N.content.trim()).join(`
42
42
 
43
- `);M=Po(T).trim()}catch{}}M?this.dispatch(t,{type:"text_chunk",text:M}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}},R}rememberNativeStreamCursor(t,i,l){const c=this.nativeStreamCursors.get(t);if(c&&(c.runId===l||!l)&&i<c.sequence)return;const p=l??(c==null?void 0:c.runId);this.nativeStreamCursors.set(t,{sequence:i,...p?{runId:p}:{}})}acceptNativeStreamEvent(t,i,l){const c=this.nativeStreamCursors.get(t);return c&&(c.runId===l||!l)&&i<=c.sequence?!1:(this.rememberNativeStreamCursor(t,i,l),!0)}closeStream(t){this.flushBufferedStreamText(t);const i=this.streams.get(t);i&&(i.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}const Bo="webapp.settings.v1";class jp{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(Bo)??"{}")}catch{t={}}return this.cached={...this.defaults(),...t},this.cached}save(t){const i=this.get();this.cached={...i,...t},t.profiles&&!t.activeProfileId&&(this.cached.activeProfileId=i.activeProfileId),localStorage.setItem(Bo,JSON.stringify(this.cached))}setActiveProfile(t){const i=this.get();this.cached={...i,activeProfileId:t},localStorage.setItem(Bo,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const i=this.get(),l=i.profiles.find(w=>w.id==="server-managed");if(!l||l.apiKey!=="managed"||l.modelId===t.modelId&&l.provider===(t.provider||"openai"))return;const c=t.modelId,f=t.provider||"openai",p=t.baseUrl||"";this.cached={...i,profiles:i.profiles.map(w=>w.id==="server-managed"?{...w,name:`服务端 · ${c}`,provider:f,modelId:c,baseUrl:p}:w),modelProvider:f,modelId:c,baseUrl:p||i.baseUrl},localStorage.setItem(Bo,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),i=t.profiles.find(w=>w.id===t.activeProfileId)??null,l=(i==null?void 0:i.provider)??t.modelProvider,c=(i==null?void 0:i.apiKey)??t.apiKey,f=(i==null?void 0:i.modelId)??t.modelId,p=(i==null?void 0:i.baseUrl)??t.baseUrl;return!c||c==="managed"||!f||f==="server"?null:{provider:l,apiKey:c,modelId:f,...p?{baseUrl:p}:{}}}getReasoningEffort(){const t=this.get().reasoningEffort;return["off","low","medium","high"].includes(t)?t:"off"}getRunLimits(){const t=this.get(),i=Math.min(50,Math.max(1,Math.trunc(Number(t.maxIterations)||10))),l=Math.min(2e3,Math.max(8,Math.trunc(Number(t.contextWindow)||100)));return{maxIterations:i,maxTokens:l*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 Gp(e){return e.toString(16).padStart(2,"0")}function Xp(e){const t=e.getRandomValues(new Uint8Array(16));t[6]=t[6]&15|64,t[8]=t[8]&63|128;const i=Array.from(t,Gp);return[i.slice(0,4).join(""),i.slice(4,6).join(""),i.slice(6,8).join(""),i.slice(8,10).join(""),i.slice(10,16).join("")].join("-")}function Yp(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>Xp(e)})}const Ll="agent-webapp:tab-swipe:v1",Zp=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(",");function Kp(e){return!e||typeof e.closest!="function"?!1:!!e.closest(Zp)}function Qp(e){let t=null;const i=l=>t!==null&&l.pointerType==="touch"&&l.pointerId===t.pointerId;return{pointerDown(l){l.pointerType!=="touch"||!l.isPrimary||l.interactive||(t={pointerId:l.pointerId,startX:l.clientX,startY:l.clientY,axis:"pending"})},pointerMove(l){if(!i(l)||!t)return!1;const c=l.clientX-t.startX,f=l.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:Ll,phase:"move",deltaX:c}),!0},pointerUp(l){if(!i(l)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Ll,phase:"end",deltaX:l.clientX-t.startX}),t=null,c},pointerCancel(l){if(!i(l)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Ll,phase:"cancel",deltaX:0}),t=null,c}}}function qp(){if(window.parent===window)return()=>{};const e=Qp(p=>{window.parent.postMessage(p,window.location.origin)}),t=p=>({pointerId:p.pointerId,pointerType:p.pointerType,isPrimary:p.isPrimary,clientX:p.clientX,clientY:p.clientY}),i=p=>{e.pointerDown({...t(p),interactive:Kp(p.target)})},l=p=>{e.pointerMove(t(p))&&p.preventDefault()},c=p=>{e.pointerUp(t(p))&&p.preventDefault()},f=p=>{e.pointerCancel(t(p))};return document.addEventListener("pointerdown",i,{capture:!0}),document.addEventListener("pointermove",l,{capture:!0,passive:!1}),document.addEventListener("pointerup",c,{capture:!0,passive:!1}),document.addEventListener("pointercancel",f,{capture:!0}),()=>{document.removeEventListener("pointerdown",i,{capture:!0}),document.removeEventListener("pointermove",l,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",f,{capture:!0})}}const $p={},T0=e=>{let t;const i=new Set,l=(_,v)=>{const R=typeof _=="function"?_(t):_;if(!Object.is(R,t)){const M=t;t=v??(typeof R!="object"||R===null)?R:Object.assign({},t,R),i.forEach(P=>P(t,M))}},c=()=>t,C={setState:l,getState:c,getInitialState:()=>m,subscribe:_=>(i.add(_),()=>i.delete(_)),destroy:()=>{($p?"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."),i.clear()}},m=t=e(l,c,C);return C},Jp=e=>e?T0(e):T0;var gh={exports:{}},ph={},xh={exports:{}},mh={};/**
43
+ `);M=Po(T).trim()}catch{}}M?this.dispatch(t,{type:"text_chunk",text:M}):this.dispatch(t,{type:"error",message:"连接中断,回复未能恢复,请重试"}),this.dispatch(t,{type:"done",finalText:""}),this.settle(t)})()}},R}rememberNativeStreamCursor(t,i,l){const c=this.nativeStreamCursors.get(t);if(c&&(c.runId===l||!l)&&i<c.sequence)return;const p=l??(c==null?void 0:c.runId);this.nativeStreamCursors.set(t,{sequence:i,...p?{runId:p}:{}})}acceptNativeStreamEvent(t,i,l){const c=this.nativeStreamCursors.get(t);return c&&(c.runId===l||!l)&&i<=c.sequence?!1:(this.rememberNativeStreamCursor(t,i,l),!0)}closeStream(t){this.flushBufferedStreamText(t);const i=this.streams.get(t);i&&(i.close(),this.streams.delete(t),this.thinkFilters.delete(t))}}const Bo="webapp.settings.v1";class Gp{constructor(){this.cached=null}get(){if(this.cached)return this.cached;let t={};try{t=JSON.parse(localStorage.getItem(Bo)??"{}")}catch{t={}}return this.cached={...this.defaults(),...t},this.cached}save(t){const i=this.get();this.cached={...i,...t},t.profiles&&!t.activeProfileId&&(this.cached.activeProfileId=i.activeProfileId),localStorage.setItem(Bo,JSON.stringify(this.cached))}setActiveProfile(t){const i=this.get();this.cached={...i,activeProfileId:t},localStorage.setItem(Bo,JSON.stringify(this.cached))}reflectServerModel(t){if(!(t!=null&&t.modelId))return;const i=this.get(),l=i.profiles.find(w=>w.id==="server-managed");if(!l||l.apiKey!=="managed"||l.modelId===t.modelId&&l.provider===(t.provider||"openai"))return;const c=t.modelId,f=t.provider||"openai",p=t.baseUrl||"";this.cached={...i,profiles:i.profiles.map(w=>w.id==="server-managed"?{...w,name:`服务端 · ${c}`,provider:f,modelId:c,baseUrl:p}:w),modelProvider:f,modelId:c,baseUrl:p||i.baseUrl},localStorage.setItem(Bo,JSON.stringify(this.cached))}getModelOverride(){const t=this.get(),i=t.profiles.find(w=>w.id===t.activeProfileId)??null,l=(i==null?void 0:i.provider)??t.modelProvider,c=(i==null?void 0:i.apiKey)??t.apiKey,f=(i==null?void 0:i.modelId)??t.modelId,p=(i==null?void 0:i.baseUrl)??t.baseUrl;return!c||c==="managed"||!f||f==="server"?null:{provider:l,apiKey:c,modelId:f,...p?{baseUrl:p}:{}}}getReasoningEffort(){const t=this.get().reasoningEffort;return["off","low","medium","high"].includes(t)?t:"off"}getRunLimits(){const t=this.get(),i=Math.min(50,Math.max(1,Math.trunc(Number(t.maxIterations)||10))),l=Math.min(2e3,Math.max(8,Math.trunc(Number(t.contextWindow)||100)));return{maxIterations:i,maxTokens:l*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 Xp(e){return e.toString(16).padStart(2,"0")}function Yp(e){const t=e.getRandomValues(new Uint8Array(16));t[6]=t[6]&15|64,t[8]=t[8]&63|128;const i=Array.from(t,Xp);return[i.slice(0,4).join(""),i.slice(4,6).join(""),i.slice(6,8).join(""),i.slice(8,10).join(""),i.slice(10,16).join("")].join("-")}function Zp(e=globalThis.crypto){typeof e.randomUUID!="function"&&Object.defineProperty(e,"randomUUID",{configurable:!0,writable:!0,value:()=>Yp(e)})}const Ll="agent-webapp:tab-swipe:v1",Kp=["input","textarea","select","button","a[href]","[contenteditable='true']","[role='button']","[data-tab-swipe-ignore]"].join(",");function Qp(e){return!e||typeof e.closest!="function"?!1:!!e.closest(Kp)}function qp(e){let t=null;const i=l=>t!==null&&l.pointerType==="touch"&&l.pointerId===t.pointerId;return{pointerDown(l){l.pointerType!=="touch"||!l.isPrimary||l.interactive||(t={pointerId:l.pointerId,startX:l.clientX,startY:l.clientY,axis:"pending"})},pointerMove(l){if(!i(l)||!t)return!1;const c=l.clientX-t.startX,f=l.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:Ll,phase:"move",deltaX:c}),!0},pointerUp(l){if(!i(l)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Ll,phase:"end",deltaX:l.clientX-t.startX}),t=null,c},pointerCancel(l){if(!i(l)||!t)return!1;const c=t.axis==="horizontal";return c&&e({type:Ll,phase:"cancel",deltaX:0}),t=null,c}}}function $p(){if(window.parent===window)return()=>{};const e=qp(p=>{window.parent.postMessage(p,window.location.origin)}),t=p=>({pointerId:p.pointerId,pointerType:p.pointerType,isPrimary:p.isPrimary,clientX:p.clientX,clientY:p.clientY}),i=p=>{e.pointerDown({...t(p),interactive:Qp(p.target)})},l=p=>{e.pointerMove(t(p))&&p.preventDefault()},c=p=>{e.pointerUp(t(p))&&p.preventDefault()},f=p=>{e.pointerCancel(t(p))};return document.addEventListener("pointerdown",i,{capture:!0}),document.addEventListener("pointermove",l,{capture:!0,passive:!1}),document.addEventListener("pointerup",c,{capture:!0,passive:!1}),document.addEventListener("pointercancel",f,{capture:!0}),()=>{document.removeEventListener("pointerdown",i,{capture:!0}),document.removeEventListener("pointermove",l,{capture:!0}),document.removeEventListener("pointerup",c,{capture:!0}),document.removeEventListener("pointercancel",f,{capture:!0})}}const Jp={},T0=e=>{let t;const i=new Set,l=(_,v)=>{const R=typeof _=="function"?_(t):_;if(!Object.is(R,t)){const M=t;t=v??(typeof R!="object"||R===null)?R:Object.assign({},t,R),i.forEach(P=>P(t,M))}},c=()=>t,C={setState:l,getState:c,getInitialState:()=>m,subscribe:_=>(i.add(_),()=>i.delete(_)),destroy:()=>{(Jp?"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."),i.clear()}},m=t=e(l,c,C);return C},ex=e=>e?T0(e):T0;var ph={exports:{}},xh={},mh={exports:{}},wh={};/**
44
44
  * @license React
45
45
  * use-sync-external-store-shim.production.js
46
46
  *
@@ -48,7 +48,7 @@ Error generating stack: `+f.message+`
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var Gi=Ct;function ex(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tx=typeof Object.is=="function"?Object.is:ex,nx=Gi.useState,rx=Gi.useEffect,ix=Gi.useLayoutEffect,sx=Gi.useDebugValue;function ox(e,t){var i=t(),l=nx({inst:{value:i,getSnapshot:t}}),c=l[0].inst,f=l[1];return ix(function(){c.value=i,c.getSnapshot=t,Fl(c)&&f({inst:c})},[e,i,t]),rx(function(){return Fl(c)&&f({inst:c}),e(function(){Fl(c)&&f({inst:c})})},[e]),sx(i),i}function Fl(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!tx(e,i)}catch{return!0}}function ax(e,t){return t()}var lx=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ax:ox;mh.useSyncExternalStore=Gi.useSyncExternalStore!==void 0?Gi.useSyncExternalStore:lx;xh.exports=mh;var ux=xh.exports;/**
51
+ */var Gi=ct;function tx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nx=typeof Object.is=="function"?Object.is:tx,rx=Gi.useState,ix=Gi.useEffect,sx=Gi.useLayoutEffect,ox=Gi.useDebugValue;function ax(e,t){var i=t(),l=rx({inst:{value:i,getSnapshot:t}}),c=l[0].inst,f=l[1];return sx(function(){c.value=i,c.getSnapshot=t,Fl(c)&&f({inst:c})},[e,i,t]),ix(function(){return Fl(c)&&f({inst:c}),e(function(){Fl(c)&&f({inst:c})})},[e]),ox(i),i}function Fl(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!nx(e,i)}catch{return!0}}function lx(e,t){return t()}var ux=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lx:ax;wh.useSyncExternalStore=Gi.useSyncExternalStore!==void 0?Gi.useSyncExternalStore:ux;mh.exports=wh;var cx=mh.exports;/**
52
52
  * @license React
53
53
  * use-sync-external-store-shim/with-selector.production.js
54
54
  *
@@ -56,14 +56,14 @@ Error generating stack: `+f.message+`
56
56
  *
57
57
  * This source code is licensed under the MIT license found in the
58
58
  * LICENSE file in the root directory of this source tree.
59
- */var za=Ct,cx=ux;function fx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dx=typeof Object.is=="function"?Object.is:fx,hx=cx.useSyncExternalStore,gx=za.useRef,px=za.useEffect,xx=za.useMemo,mx=za.useDebugValue;ph.useSyncExternalStoreWithSelector=function(e,t,i,l,c){var f=gx(null);if(f.current===null){var p={hasValue:!1,value:null};f.current=p}else p=f.current;f=xx(function(){function C(M){if(!m){if(m=!0,_=M,M=l(M),c!==void 0&&p.hasValue){var P=p.value;if(c(P,M))return v=P}return v=M}if(P=v,dx(_,M))return P;var B=l(M);return c!==void 0&&c(P,B)?(_=M,P):(_=M,v=B)}var m=!1,_,v,R=i===void 0?null:i;return[function(){return C(t())},R===null?void 0:function(){return C(R())}]},[t,i,l,c]);var w=hx(e,f[0],f[1]);return px(function(){p.hasValue=!0,p.value=w},[w]),mx(w),w};gh.exports=ph;var wx=gh.exports;const yx=J0(wx),wh={},{useDebugValue:Ex}=vg,{useSyncExternalStoreWithSelector:Cx}=yx;let N0=!1;const Ax=e=>e;function vx(e,t=Ax,i){(wh?"production":void 0)!=="production"&&i&&!N0&&(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"),N0=!0);const l=Cx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return Ex(l),l}const R0=e=>{(wh?"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"?Jp(e):e,i=(l,c)=>vx(t,l,c);return Object.assign(i,t),i},Sx=e=>e?R0(e):R0,Ix={};function _x(e,t){let i;try{i=e()}catch{return}return{getItem:c=>{var f;const p=C=>C===null?null:JSON.parse(C,void 0),w=(f=i.getItem(c))!=null?f:null;return w instanceof Promise?w.then(p):p(w)},setItem:(c,f)=>i.setItem(c,JSON.stringify(f,void 0)),removeItem:c=>i.removeItem(c)}}const qs=e=>t=>{try{const i=e(t);return i instanceof Promise?i:{then(l){return qs(l)(i)},catch(l){return this}}}catch(i){return{then(l){return this},catch(l){return qs(l)(i)}}}},Tx=(e,t)=>(i,l,c)=>{let f={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:K=>K,version:0,merge:(K,O)=>({...O,...K}),...t},p=!1;const w=new Set,C=new Set;let m;try{m=f.getStorage()}catch{}if(!m)return e((...K)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),i(...K)},l,c);const _=qs(f.serialize),v=()=>{const K=f.partialize({...l()});let O;const T=_({state:K,version:f.version}).then(N=>m.setItem(f.name,N)).catch(N=>{O=N});if(O)throw O;return T},R=c.setState;c.setState=(K,O)=>{R(K,O),v()};const M=e((...K)=>{i(...K),v()},l,c);let P;const B=()=>{var K;if(!m)return;p=!1,w.forEach(T=>T(l()));const O=((K=f.onRehydrateStorage)==null?void 0:K.call(f,l()))||void 0;return qs(m.getItem.bind(m))(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 N;return P=f.merge(T,(N=l())!=null?N:M),i(P,!0),v()}).then(()=>{O==null||O(P,void 0),p=!0,C.forEach(T=>T(P))}).catch(T=>{O==null||O(void 0,T)})};return c.persist={setOptions:K=>{f={...f,...K},K.getStorage&&(m=K.getStorage())},clearStorage:()=>{m==null||m.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>B(),hasHydrated:()=>p,onHydrate:K=>(w.add(K),()=>{w.delete(K)}),onFinishHydration:K=>(C.add(K),()=>{C.delete(K)})},B(),P||M},Nx=(e,t)=>(i,l,c)=>{let f={storage:_x(()=>localStorage),partialize:B=>B,version:0,merge:(B,K)=>({...K,...B}),...t},p=!1;const w=new Set,C=new Set;let m=f.storage;if(!m)return e((...B)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),i(...B)},l,c);const _=()=>{const B=f.partialize({...l()});return m.setItem(f.name,{state:B,version:f.version})},v=c.setState;c.setState=(B,K)=>{v(B,K),_()};const R=e((...B)=>{i(...B),_()},l,c);c.getInitialState=()=>R;let M;const P=()=>{var B,K;if(!m)return;p=!1,w.forEach(T=>{var N;return T((N=l())!=null?N:R)});const O=((K=f.onRehydrateStorage)==null?void 0:K.call(f,(B=l())!=null?B:R))||void 0;return qs(m.getItem.bind(m))(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 N;const[G,H]=T;if(M=f.merge(H,(N=l())!=null?N:R),i(M,!0),G)return _()}).then(()=>{O==null||O(M,void 0),M=l(),p=!0,C.forEach(T=>T(M))}).catch(T=>{O==null||O(void 0,T)})};return c.persist={setOptions:B=>{f={...f,...B},B.storage&&(m=B.storage)},clearStorage:()=>{m==null||m.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>P(),hasHydrated:()=>p,onHydrate:B=>(w.add(B),()=>{w.delete(B)}),onFinishHydration:B=>(C.add(B),()=>{C.delete(B)})},f.skipHydration||P(),M||R},Rx=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Ix?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Tx(e,t)):Nx(e,t),bx=Rx;function Ox(){return typeof document<"u"&&document.body.dataset.webShell==="1"}function yh(){return typeof navigator>"u"?!1:Ox()||!/Electron\//i.test(navigator.userAgent)}function iw(e=900){const[t,i]=Ct.useState(()=>typeof window<"u"&&window.innerWidth<e);return Ct.useEffect(()=>{const l=window.matchMedia(`(max-width: ${e-1}px)`),c=f=>i(f.matches);return i(l.matches),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[e]),t}const sw=[{id:"pearl",label:"珍珠白",preview:["#f5f6fa","#4f6ef7"]},{id:"scifi",label:"科幻霓虹",preview:["#050a14","#22d3ee"]},{id:"noir",label:"暗夜黑",preview:["#0f1115","#a78bfa"]}],ow=[{id:"standard",label:"标准",description:"侧边栏 + 对话区"},{id:"focus",label:"专注",description:"隐藏侧边栏,居中沉浸对话"},{id:"compact",label:"紧凑",description:"更小间距与字号,信息密度优先"}],Eh=4;function Ch(e){return Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))]:[]}function Dx(e,t){const i=e??{};return{...i.skin!==void 0?{skin:i.skin}:{},...i.layout!==void 0?{layout:i.layout}:{},...i.autoSpeak!==void 0?{autoSpeak:i.autoSpeak}:{},...i.wakeEnabled!==void 0?{wakeEnabled:i.wakeEnabled}:{},...i.wakeWord!==void 0?{wakeWord:i.wakeWord}:{},...i.runningFirst!==void 0?{runningFirst:i.runningFirst}:{},pinnedSessionIds:Ch(i.pinnedSessionIds),...t<Eh&&yh()?{wakeEnabled:!1}:{}}}function Mx(e=yh()){return!e}const kx=Sx()(bx(e=>({skin:"pearl",layout:"standard",autoSpeak:!1,wakeEnabled:Mx(),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(i=>({pinnedSessionIds:i.pinnedSessionIds.includes(t)?i.pinnedSessionIds.filter(l=>l!==t):Ch([...i.pinnedSessionIds,t])})),removePinnedSessions:t=>e(i=>{const l=new Set(t);return{pinnedSessionIds:i.pinnedSessionIds.filter(c=>!l.has(c))}})}),{name:"agent-ui-prefs",version:Eh,migrate:Dx})),Px="agent-web-shell:skin:v1",Bx=["pearl","scifi","noir"];function Lx(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const i=t.data;!i||typeof i!="object"||i.type!==Px||typeof i.skin!="string"||!Bx.includes(i.skin)||kx.getState().setSkin(i.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const Fx="agentroam:open-browser-live",Ux="agent-web-shell:open-browser-live:v1";function Wx(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const i=t.data;!i||typeof i!="object"||i.type!==Ux||window.dispatchEvent(new CustomEvent(Fx))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const zx="agent-webapp:ready:v1";function Vx(){window.parent!==window&&window.parent.postMessage({type:zx},window.location.origin)}const Hx="agent-webapp:project-request:v1",jx="agent-web-shell:project-response:v1",Gx=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"];new Set(Gx);function Xx(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==jx||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class Yx{constructor(t=window,i=15e3){this.context=t,this.timeoutMs=i,this.sequence=0,this.pending=new Map,this.onMessage=l=>{if(l.origin!==this.context.location.origin||l.source!==this.context.parent)return;const c=Xx(l.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,i={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"}));const l=++this.sequence;return new Promise((c,f)=>{const p=setTimeout(()=>{this.pending.delete(l),f(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(l,{resolve:c,reject:f,timer:p}),this.context.parent.postMessage({type:Hx,id:l,method:t,payload:i},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 Zx="agent-webapp:browser-request:v1",Kx="agent-web-shell:browser-response:v1",Qx="agent-web-shell:browser-event:v1",qx="agent-web-shell:browser-frame:v1",$x=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc"];new Set($x);function Jx(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==Kx||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function em(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==Qx||!t.event||typeof t.event!="object")return null;const i=t.event;return typeof i.type!="string"||!i.type.startsWith("browser:")?null:t}function tm(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==qx||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class nm{constructor(t=window,i=15e3){this.context=t,this.timeoutMs=i,this.sequence=0,this.pending=new Map,this.listeners=new Set,this.sessionsByChannel=new Map,this.pendingFramesByChannel=new Map,this.onMessage=l=>{var C;if(l.origin!==this.context.location.origin||l.source!==this.context.parent)return;const c=tm(l.data);if(c){const m=this.sessionsByChannel.get(c.channelId);if(!m){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,m);return}const f=em(l.data);if(f){for(const m of this.listeners)m(f.event);return}const p=Jx(l.data);if(!p)return;const w=this.pending.get(p.id);if(w)if(this.pending.delete(p.id),clearTimeout(w.timer),p.ok){if(w.method==="browser:watch"&&p.result&&typeof p.result=="object"){const m=p.result;if(Number.isSafeInteger(m.channelId)&&typeof((C=m.session)==null?void 0:C.id)=="string"){const _=Number(m.channelId);this.sessionsByChannel.set(_,m.session.id);const v=this.pendingFramesByChannel.get(_);v&&(this.pendingFramesByChannel.delete(_),this.emitBinaryFrame(v,m.session.id))}}w.resolve(p.result)}else w.reject(Object.assign(new Error(p.error||"浏览器操作失败"),{code:p.code}))},this.context.addEventListener("message",this.onMessage)}emitBinaryFrame(t,i){for(const l of this.listeners)l({type:"browser:frame",sessionId:i,sequence:t.sequence,data:t.data,mime:"image/jpeg",timestamp:Date.now()})}request(t,i={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开浏览器直播"),{code:"WEB_SHELL_REQUIRED"}));const l=++this.sequence;return new Promise((c,f)=>{const p=setTimeout(()=>{this.pending.delete(l),f(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(l,{resolve:c,reject:f,timer:p,method:t}),this.context.parent.postMessage({type:Zx,id:l,method:t,payload:i},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 br{constructor(t){this.url=t}static parse(t){const i=t.trim();if(!i)return null;const l=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(i)?i:`http://${i}`;let c;try{c=new URL(l)}catch{return null}return c.protocol!=="http:"&&c.protocol!=="https:"||!c.hostname?null:new br(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class rm{constructor(t,i,l){this.environment=t,this.storage=i,this.probe=l}async planStartup(){if(!this.environment.isNativeApp())return{mode:"same-origin"};const t=this.launchEndpoint();if(t)return{mode:"ready",endpoint:t};const i=this.storage.load();if(i){const l=await this.probe.probe(i);return l.ok?{mode:"ready",endpoint:i}:{mode:"setup",endpoint:i,failure:l.reason}}return{mode:"setup",endpoint:null}}async connect(t){const i=br.parse(t);if(!i)return{ok:!1,reason:"地址无效,请输入 http(s)://host:port 形式的服务器地址"};const l=await this.probe.probe(i);return l.ok?(this.storage.save(i),{ok:!0,endpoint:i}):{ok:!1,reason:`无法连接服务器:${l.reason}`}}disconnect(){this.storage.clear()}launchEndpoint(){const t=this.environment.launchServerUrl();return t?br.parse(t):null}}function b0(){return window.Capacitor??null}class im{isNativeApp(){var t,i;return((i=(t=b0())==null?void 0:t.isNativePlatform)==null?void 0:i.call(t))??!1}platform(){var i,l;const t=(l=(i=b0())==null?void 0:i.getPlatform)==null?void 0:l.call(i);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 Ul="webapp.mobile.serverEndpoint.v1";class O0{load(){try{const t=localStorage.getItem(Ul);return t?br.parse(t):null}catch{return null}}save(t){localStorage.setItem(Ul,t.toString())}clear(){localStorage.removeItem(Ul)}}const sm=6e3;class om{constructor(t=(...i)=>fetch(...i)){this.transport=t}async probe(t,i=sm){const l=new AbortController,c=setTimeout(()=>l.abort(),i);try{const f=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:l.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"?"连接超时":am(f)}}finally{clearTimeout(c)}}}function am(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function lm({service:e,savedEndpoint:t,initialFailure:i,onConnected:l,onScan:c}){const[f,p]=Ct.useState((t==null?void 0:t.toString())??""),[w,C]=Ct.useState(i??""),[m,_]=Ct.useState(!1);async function v(){if(!(m||!c)){_(!0),C("");try{const M=await c();M&&l(M)}catch(M){C(M instanceof Error?M.message:"扫码连接失败,请重试。")}finally{_(!1)}}}async function R(){if(!m){_(!0),C("");try{const M=await e.connect(f);M.ok?l(M.endpoint):C(M.reason)}catch{C("连接失败,请检查网络或重新扫码授权。")}finally{_(!1)}}}return ae.jsx("div",{style:Wn.page,children:ae.jsxs("div",{style:Wn.card,children:[ae.jsx("div",{style:Wn.icon,children:"🛰️"}),ae.jsx("h1",{style:Wn.title,children:"连接服务器"}),c?ae.jsxs(ae.Fragment,{children:[ae.jsx("p",{style:Wn.hint,children:"扫描电脑终端上的授权二维码,直接连接,无需再次确认。"}),ae.jsx("button",{type:"button",style:{...Wn.button,marginBottom:20},disabled:m,onClick:()=>void v(),children:m?"正在连接…":"扫码连接"})]}):null,ae.jsx("p",{style:Wn.hint,children:"也可以输入已授权的服务器地址。使用局域网地址时,手机与电脑需在同一网络。"}),ae.jsx("input",{style:Wn.input,value:f,inputMode:"url",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,placeholder:"http://192.168.1.10:3000",onChange:M=>p(M.target.value),onKeyDown:M=>{M.key==="Enter"&&R()}}),w?ae.jsx("p",{style:Wn.error,children:w}):null,ae.jsx("button",{style:{...Wn.button,opacity:m||!f.trim()?.6:1},disabled:m,onClick:()=>void R(),children:m?"正在连接…":"连接"})]})})}const Wn={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 Xi;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Xi||(Xi={}));class Wl extends Error{constructor(t,i,l){super(t),this.message=t,this.code=i,this.data=l}}const um=e=>{var t,i;return e!=null&&e.androidBridge?"android":!((i=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||i===void 0)&&i.bridge?"ios":"web"},cm=e=>{const t=e.CapacitorCustomPlatform||null,i=e.Capacitor||{},l=i.Plugins=i.Plugins||{},c=()=>t!==null?t.name:um(e),f=()=>c()!=="web",p=v=>{const R=m.get(v);return!!(R!=null&&R.platforms.has(c())||w(v))},w=v=>{var R;return(R=i.PluginHeaders)===null||R===void 0?void 0:R.find(M=>M.name===v)},C=v=>e.console.error(v),m=new Map,_=(v,R={})=>{const M=m.get(v);if(M)return console.warn(`Capacitor plugin "${v}" already registered. Cannot register plugins twice.`),M.proxy;const P=c(),B=w(v);let K;const O=async()=>(!K&&P in R?K=typeof R[P]=="function"?K=await R[P]():K=R[P]:t!==null&&!K&&"web"in R&&(K=typeof R.web=="function"?K=await R.web():K=R.web),K),T=(X,V)=>{var se,Ee;if(B){const ie=B==null?void 0:B.methods.find(ge=>V===ge.name);if(ie)return ie.rtype==="promise"?ge=>i.nativePromise(v,V.toString(),ge):(ge,_e)=>i.nativeCallback(v,V.toString(),ge,_e);if(X)return(se=X[V])===null||se===void 0?void 0:se.bind(X)}else{if(X)return(Ee=X[V])===null||Ee===void 0?void 0:Ee.bind(X);throw new Wl(`"${v}" plugin is not implemented on ${P}`,Xi.Unimplemented)}},N=X=>{let V;const se=(...Ee)=>{const ie=O().then(ge=>{const _e=T(ge,X);if(_e){const j=_e(...Ee);return V=j==null?void 0:j.remove,j}else throw new Wl(`"${v}.${X}()" is not implemented on ${P}`,Xi.Unimplemented)});return X==="addListener"&&(ie.remove=async()=>V()),ie};return se.toString=()=>`${X.toString()}() { [capacitor code] }`,Object.defineProperty(se,"name",{value:X,writable:!1,configurable:!1}),se},G=N("addListener"),H=N("removeListener"),U=(X,V)=>{const se=G({eventName:X},V),Ee=async()=>{const ge=await se;H({eventName:X,callbackId:ge},V)},ie=new Promise(ge=>se.then(()=>ge({remove:Ee})));return ie.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await Ee()},ie},k=new Proxy({},{get(X,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return B?U:G;case"removeListener":return H;default:return N(V)}}});return l[v]=k,m.set(v,{name:v,proxy:k,platforms:new Set([...Object.keys(R),...B?[P]:[]])}),k};return i.convertFileSrc||(i.convertFileSrc=v=>v),i.getPlatform=c,i.handleError=C,i.isNativePlatform=f,i.isPluginAvailable=p,i.registerPlugin=_,i.Exception=Wl,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i},fm=e=>e.Capacitor=cm(e),$s=fm(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Va=$s.registerPlugin;class Ah{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,i){let l=!1;this.listeners[t]||(this.listeners[t]=[],l=!0),this.listeners[t].push(i);const f=this.windowListeners[t];f&&!f.registered&&this.addWindowListener(f),l&&this.sendRetainedArgumentsForEvent(t);const p=async()=>this.removeListener(t,i);return Promise.resolve({remove:p})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,i,l){const c=this.listeners[t];if(!c){if(l){let f=this.retainedEventArguments[t];f||(f=[]),f.push(i),this.retainedEventArguments[t]=f}return}c.forEach(f=>f(i))}hasListeners(t){var i;return!!(!((i=this.listeners[t])===null||i===void 0)&&i.length)}registerWindowListener(t,i){this.windowListeners[i]={registered:!1,windowEventName:t,pluginEventName:i,handler:l=>{this.notifyListeners(i,l)}}}unimplemented(t="not implemented"){return new $s.Exception(t,Xi.Unimplemented)}unavailable(t="not available"){return new $s.Exception(t,Xi.Unavailable)}async removeListener(t,i){const l=this.listeners[t];if(!l)return;const c=l.indexOf(i);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 i=this.retainedEventArguments[t];i&&(delete this.retainedEventArguments[t],i.forEach(l=>{this.notifyListeners(t,l)}))}}const D0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),M0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class dm extends Ah{async getCookies(){const t=document.cookie,i={};return t.split(";").forEach(l=>{if(l.length<=0)return;let[c,f]=l.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=M0(c).trim(),f=M0(f).trim(),i[c]=f}),i}async setCookie(t){try{const i=D0(t.key),l=D0(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",f=(t.path||"/").replace("path=",""),p=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${i}=${l||""}${c}; path=${f}; ${p};`}catch(i){return Promise.reject(i)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(i){return Promise.reject(i)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const i of t)document.cookie=i.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)}}}Va("CapacitorCookies",{web:()=>new dm});const hm=async e=>new Promise((t,i)=>{const l=new FileReader;l.onload=()=>{const c=l.result;t(c.indexOf(",")>=0?c.split(",")[1]:c)},l.onerror=c=>i(c),l.readAsDataURL(e)}),gm=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,f,p)=>(c[f]=e[t[p]],c),{})},pm=(e,t=!0)=>e?Object.entries(e).reduce((l,c)=>{const[f,p]=c;let w,C;return Array.isArray(p)?(C="",p.forEach(m=>{w=t?encodeURIComponent(m):m,C+=`${f}=${w}&`}),C.slice(0,-1)):(w=t?encodeURIComponent(p):p,C=`${f}=${w}`),`${l}&${C}`},"").substr(1):null,xm=(e,t={})=>{const i=Object.assign({method:e.method||"GET",headers:e.headers},t),c=gm(e.headers)["content-type"]||"";if(typeof e.data=="string")i.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const f=new URLSearchParams;for(const[p,w]of Object.entries(e.data||{}))f.set(p,w);i.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((w,C)=>{f.append(C,w)});else for(const w of Object.keys(e.data))f.append(w,e.data[w]);i.body=f;const p=new Headers(i.headers);p.delete("content-type"),i.headers=p}else(c.includes("application/json")||typeof e.data=="object")&&(i.body=JSON.stringify(e.data));return i};class mm extends Ah{async request(t){const i=xm(t,t.webFetchExtra),l=pm(t.params,t.shouldEncodeUrlParams),c=l?`${t.url}?${l}`:t.url,f=await fetch(c,i),p=f.headers.get("content-type")||"";let{responseType:w="text"}=f.ok?t:{};p.includes("application/json")&&(w="json");let C,m;switch(w){case"arraybuffer":case"blob":m=await f.blob(),C=await hm(m);break;case"json":C=await f.json();break;case"document":case"text":default:C=await f.text()}const _={};return f.headers.forEach((v,R)=>{_[R]=v}),{data:C,headers:_,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"}))}}Va("CapacitorHttp",{web:()=>new mm});var te;(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"})(te||(te={}));var k0=new Map([[te.QR_CODE,"QR_CODE"],[te.AZTEC,"AZTEC"],[te.CODABAR,"CODABAR"],[te.CODE_39,"CODE_39"],[te.CODE_93,"CODE_93"],[te.CODE_128,"CODE_128"],[te.DATA_MATRIX,"DATA_MATRIX"],[te.MAXICODE,"MAXICODE"],[te.ITF,"ITF"],[te.EAN_13,"EAN_13"],[te.EAN_8,"EAN_8"],[te.PDF_417,"PDF_417"],[te.RSS_14,"RSS_14"],[te.RSS_EXPANDED,"RSS_EXPANDED"],[te.UPC_A,"UPC_A"],[te.UPC_E,"UPC_E"],[te.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),P0;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(P0||(P0={}));function wm(e){return Object.values(te).includes(e)}var Ca;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ca||(Ca={}));var ym=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=[Ca.SCAN_TYPE_CAMERA,Ca.SCAN_TYPE_FILE],e}(),vh=function(){function e(t,i){this.format=t,this.formatName=i}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!k0.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,k0.get(t))},e}(),B0=function(){function e(){}return e.createFromText=function(t){var i={text:t};return{decodedText:t,result:i}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),Bu;(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"})(Bu||(Bu={}));var Em=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:Bu.UNKWOWN_ERROR}},e}(),Cm=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,i){(this.verbose||i===!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 Xn(e){return typeof e>"u"||e===null}var Ri=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}(),Sh=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,i){if(typeof t!="object"){var l=typeof t;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(l,"."),!0),!1}for(var c=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(c),p=Object.keys(t),w=0,C=p;w<C.length;w++){var m=C[w];if(f.has(m))return i.logError("".concat(m," is not supported videoConstaints."),!0),!1}return!0},e}(),Lu={exports:{}};(function(e,t){(function(i,l){l(t)})(ls,function(i){function l(y){return y==null}var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,n){y.__proto__=n}||function(y,n){for(var r in n)n.hasOwnProperty(r)&&(y[r]=n[r])};function f(y,n){c(y,n);function r(){this.constructor=y}y.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}function p(y,n){var r=Object.setPrototypeOf;r?r(y,n):y.__proto__=n}function w(y,n){n===void 0&&(n=y.constructor);var r=Error.captureStackTrace;r&&r(y,n)}var C=function(y){f(n,y);function n(r){var s=this.constructor,o=y.call(this,r)||this;return Object.defineProperty(o,"name",{value:s.name,enumerable:!1}),p(o,s.prototype),w(o),o}return n}(Error);class m extends C{constructor(n=void 0){super(n),this.message=n}getKind(){return this.constructor.kind}}m.kind="Exception";class _ extends m{}_.kind="ArgumentException";class v extends m{}v.kind="IllegalArgumentException";class R{constructor(n){if(this.binarizer=n,n===null)throw new v("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(n,r){return this.binarizer.getBlackRow(n,r)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(n,r,s,o){const a=this.binarizer.getLuminanceSource().crop(n,r,s,o);return new R(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const n=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new R(this.binarizer.createBinarizer(n))}rotateCounterClockwise45(){const n=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new R(this.binarizer.createBinarizer(n))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class M extends m{static getChecksumInstance(){return new M}}M.kind="ChecksumException";class P{constructor(n){this.source=n}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class B{static arraycopy(n,r,s,o,a){for(;a--;)s[o++]=n[r++]}static currentTimeMillis(){return Date.now()}}class K extends m{}K.kind="IndexOutOfBoundsException";class O extends K{constructor(n=void 0,r=void 0){super(r),this.index=n,this.message=r}}O.kind="ArrayIndexOutOfBoundsException";class T{static fill(n,r){for(let s=0,o=n.length;s<o;s++)n[s]=r}static fillWithin(n,r,s,o){T.rangeCheck(n.length,r,s);for(let a=r;a<s;a++)n[a]=o}static rangeCheck(n,r,s){if(r>s)throw new v("fromIndex("+r+") > toIndex("+s+")");if(r<0)throw new O(r);if(s>n)throw new O(s)}static asList(...n){return n}static create(n,r,s){return Array.from({length:n}).map(a=>Array.from({length:r}).fill(s))}static createInt32Array(n,r,s){return Array.from({length:n}).map(a=>Int32Array.from({length:r}).fill(s))}static equals(n,r){if(!n||!r||!n.length||!r.length||n.length!==r.length)return!1;for(let s=0,o=n.length;s<o;s++)if(n[s]!==r[s])return!1;return!0}static hashCode(n){if(n===null)return 0;let r=1;for(const s of n)r=31*r+s;return r}static fillUint8Array(n,r){for(let s=0;s!==n.length;s++)n[s]=r}static copyOf(n,r){return n.slice(0,r)}static copyOfUint8Array(n,r){if(n.length<=r){const s=new Uint8Array(r);return s.set(n),s}return n.slice(0,r)}static copyOfRange(n,r,s){const o=s-r,a=new Int32Array(o);return B.arraycopy(n,r,a,0,o),a}static binarySearch(n,r,s){s===void 0&&(s=T.numberComparator);let o=0,a=n.length-1;for(;o<=a;){const u=a+o>>1,d=s(r,n[u]);if(d>0)o=u+1;else if(d<0)a=u-1;else return u}return-o-1}static numberComparator(n,r){return n-r}}class N{static numberOfTrailingZeros(n){let r;if(n===0)return 32;let s=31;return r=n<<16,r!==0&&(s-=16,n=r),r=n<<8,r!==0&&(s-=8,n=r),r=n<<4,r!==0&&(s-=4,n=r),r=n<<2,r!==0&&(s-=2,n=r),s-(n<<1>>>31)}static numberOfLeadingZeros(n){if(n===0)return 32;let r=1;return n>>>16||(r+=16,n<<=16),n>>>24||(r+=8,n<<=8),n>>>28||(r+=4,n<<=4),n>>>30||(r+=2,n<<=2),r-=n>>>31,r}static toHexString(n){return n.toString(16)}static toBinaryString(n){return String(parseInt(String(n),2))}static bitCount(n){return n=n-(n>>>1&1431655765),n=(n&858993459)+(n>>>2&858993459),n=n+(n>>>4)&252645135,n=n+(n>>>8),n=n+(n>>>16),n&63}static truncDivision(n,r){return Math.trunc(n/r)}static parseInt(n,r=void 0){return parseInt(n,r)}}N.MIN_VALUE_32_BITS=-2147483648,N.MAX_VALUE=Number.MAX_SAFE_INTEGER;class G{constructor(n,r){n===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=n,r==null?this.bits=G.makeArray(n):this.bits=r)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(n){if(n>this.bits.length*32){const r=G.makeArray(n);B.arraycopy(this.bits,0,r,0,this.bits.length),this.bits=r}}get(n){return(this.bits[Math.floor(n/32)]&1<<(n&31))!==0}set(n){this.bits[Math.floor(n/32)]|=1<<(n&31)}flip(n){this.bits[Math.floor(n/32)]^=1<<(n&31)}getNextSet(n){const r=this.size;if(n>=r)return r;const s=this.bits;let o=Math.floor(n/32),a=s[o];a&=~((1<<(n&31))-1);const u=s.length;for(;a===0;){if(++o===u)return r;a=s[o]}const d=o*32+N.numberOfTrailingZeros(a);return d>r?r:d}getNextUnset(n){const r=this.size;if(n>=r)return r;const s=this.bits;let o=Math.floor(n/32),a=~s[o];a&=~((1<<(n&31))-1);const u=s.length;for(;a===0;){if(++o===u)return r;a=~s[o]}const d=o*32+N.numberOfTrailingZeros(a);return d>r?r:d}setBulk(n,r){this.bits[Math.floor(n/32)]=r}setRange(n,r){if(r<n||n<0||r>this.size)throw new v;if(r===n)return;r--;const s=Math.floor(n/32),o=Math.floor(r/32),a=this.bits;for(let u=s;u<=o;u++){const d=u>s?0:n&31,g=(2<<(u<o?31:r&31))-(1<<d);a[u]|=g}}clear(){const n=this.bits.length,r=this.bits;for(let s=0;s<n;s++)r[s]=0}isRange(n,r,s){if(r<n||n<0||r>this.size)throw new v;if(r===n)return!0;r--;const o=Math.floor(n/32),a=Math.floor(r/32),u=this.bits;for(let d=o;d<=a;d++){const h=d>o?0:n&31,x=(2<<(d<a?31:r&31))-(1<<h)&4294967295;if((u[d]&x)!==(s?x:0))return!1}return!0}appendBit(n){this.ensureCapacity(this.size+1),n&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(n,r){if(r<0||r>32)throw new v("Num bits must be between 0 and 32");this.ensureCapacity(this.size+r);for(let s=r;s>0;s--)this.appendBit((n>>s-1&1)===1)}appendBitArray(n){const r=n.size;this.ensureCapacity(this.size+r);for(let s=0;s<r;s++)this.appendBit(n.get(s))}xor(n){if(this.size!==n.size)throw new v("Sizes don't match");const r=this.bits;for(let s=0,o=r.length;s<o;s++)r[s]^=n.bits[s]}toBytes(n,r,s,o){for(let a=0;a<o;a++){let u=0;for(let d=0;d<8;d++)this.get(n)&&(u|=1<<7-d),n++;r[s+a]=u}}getBitArray(){return this.bits}reverse(){const n=new Int32Array(this.bits.length),r=Math.floor((this.size-1)/32),s=r+1,o=this.bits;for(let a=0;a<s;a++){let u=o[a];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,n[r-a]=u}if(this.size!==s*32){const a=s*32-this.size;let u=n[0]>>>a;for(let d=1;d<s;d++){const h=n[d];u|=h<<32-a,n[d-1]=u,u=h>>>a}n[s-1]=u}this.bits=n}static makeArray(n){return new Int32Array(Math.floor((n+31)/32))}equals(n){if(!(n instanceof G))return!1;const r=n;return this.size===r.size&&T.equals(this.bits,r.bits)}hashCode(){return 31*this.size+T.hashCode(this.bits)}toString(){let n="";for(let r=0,s=this.size;r<s;r++)r&7||(n+=" "),n+=this.get(r)?"X":".";return n}clone(){return new G(this.size,this.bits.slice())}}var H;(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"})(H||(H={}));var U=H;class k extends m{static getFormatInstance(){return new k}}k.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(n,r,s,...o){this.valueIdentifier=n,this.name=s,typeof r=="number"?this.values=Int32Array.from([r]):this.values=r,this.otherEncodingNames=o,V.VALUE_IDENTIFIER_TO_ECI.set(n,this),V.NAME_TO_ECI.set(s,this);const a=this.values;for(let u=0,d=a.length;u!==d;u++){const h=a[u];V.VALUES_TO_ECI.set(h,this)}for(const u of o)V.NAME_TO_ECI.set(u,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(n){if(n<0||n>=900)throw new k("incorect value");const r=V.VALUES_TO_ECI.get(n);if(r===void 0)throw new k("incorect value");return r}static getCharacterSetECIByName(n){const r=V.NAME_TO_ECI.get(n);if(r===void 0)throw new k("incorect value");return r}equals(n){if(!(n instanceof V))return!1;const r=n;return this.getName()===r.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 se extends m{}se.kind="UnsupportedOperationException";class Ee{static decode(n,r){const s=this.encodingName(r);return this.customDecoder?this.customDecoder(n,s):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(s)?this.decodeFallback(n,s):new TextDecoder(s).decode(n)}static shouldDecodeOnFallback(n){return!Ee.isBrowser()&&n==="ISO-8859-1"}static encode(n,r){const s=this.encodingName(r);return this.customEncoder?this.customEncoder(n,s):typeof TextEncoder>"u"?this.encodeFallback(n):new TextEncoder().encode(n)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(n){return typeof n=="string"?n:n.getName()}static encodingCharacterSet(n){return n instanceof V?n:V.getCharacterSetECIByName(n)}static decodeFallback(n,r){const s=this.encodingCharacterSet(r);if(Ee.isDecodeFallbackSupported(s)){let o="";for(let a=0,u=n.length;a<u;a++){let d=n[a].toString(16);d.length<2&&(d="0"+d),o+="%"+d}return decodeURIComponent(o)}if(s.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(n.buffer));throw new se(`Encoding ${this.encodingName(r)} not supported by fallback.`)}static isDecodeFallbackSupported(n){return n.equals(V.UTF8)||n.equals(V.ISO8859_1)||n.equals(V.ASCII)}static encodeFallback(n){const s=btoa(unescape(encodeURIComponent(n))).split(""),o=[];for(let a=0;a<s.length;a++)o.push(s[a].charCodeAt(0));return new Uint8Array(o)}}class ie{static castAsNonUtf8Char(n,r=null){const s=r?r.getName():this.ISO88591;return Ee.decode(new Uint8Array([n]),s)}static guessEncoding(n,r){if(r!=null&&r.get(U.CHARACTER_SET)!==void 0)return r.get(U.CHARACTER_SET).toString();const s=n.length;let o=!0,a=!0,u=!0,d=0,h=0,g=0,x=0,E=0,A=0,I=0,b=0,D=0,L=0,z=0;const q=n.length>3&&n[0]===239&&n[1]===187&&n[2]===191;for(let $=0;$<s&&(o||a||u);$++){const Z=n[$]&255;u&&(d>0?Z&128?d--:u=!1:Z&128&&(Z&64?(d++,Z&32?(d++,Z&16?(d++,Z&8?u=!1:x++):g++):h++):u=!1)),o&&(Z>127&&Z<160?o=!1:Z>159&&(Z<192||Z===215||Z===247)&&z++),a&&(E>0?Z<64||Z===127||Z>252?a=!1:E--:Z===128||Z===160||Z>239?a=!1:Z>160&&Z<224?(A++,b=0,I++,I>D&&(D=I)):Z>127?(E++,I=0,b++,b>L&&(L=b)):(I=0,b=0))}return u&&d>0&&(u=!1),a&&E>0&&(a=!1),u&&(q||h+g+x>0)?ie.UTF8:a&&(ie.ASSUME_SHIFT_JIS||D>=3||L>=3)?ie.SHIFT_JIS:o&&a?D===2&&A===2||z*10>=s?ie.SHIFT_JIS:ie.ISO88591:o?ie.ISO88591:a?ie.SHIFT_JIS:u?ie.UTF8:ie.PLATFORM_DEFAULT_ENCODING}static format(n,...r){let s=-1;function o(u,d,h,g,x,E){if(u==="%%")return"%";if(r[++s]===void 0)return;u=g?parseInt(g.substr(1)):void 0;let A=x?parseInt(x.substr(1)):void 0,I;switch(E){case"s":I=r[s];break;case"c":I=r[s][0];break;case"f":I=parseFloat(r[s]).toFixed(u);break;case"p":I=parseFloat(r[s]).toPrecision(u);break;case"e":I=parseFloat(r[s]).toExponential(u);break;case"x":I=parseInt(r[s]).toString(A||16);break;case"d":I=parseFloat(parseInt(r[s],A||10).toPrecision(u)).toFixed(0);break}I=typeof I=="object"?JSON.stringify(I):(+I).toString(A);let b=parseInt(h),D=h&&h[0]+""=="0"?"0":" ";for(;I.length<b;)I=d!==void 0?I+D:D+I;return I}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return n.replace(a,o)}static getBytes(n,r){return Ee.encode(n,r)}static getCharCode(n,r=0){return n.charCodeAt(r)}static getCharAt(n){return String.fromCharCode(n)}}ie.SHIFT_JIS=V.SJIS.getName(),ie.GB2312="GB2312",ie.ISO88591=V.ISO8859_1.getName(),ie.EUC_JP="EUC_JP",ie.UTF8=V.UTF8.getName(),ie.PLATFORM_DEFAULT_ENCODING=ie.UTF8,ie.ASSUME_SHIFT_JIS=!1;class ge{constructor(n=""){this.value=n}enableDecoding(n){return this.encoding=n,this}append(n){return typeof n=="string"?this.value+=n.toString():this.encoding?this.value+=ie.castAsNonUtf8Char(n,this.encoding):this.value+=String.fromCharCode(n),this}appendChars(n,r,s){for(let o=r;r<r+s;o++)this.append(n[o]);return this}length(){return this.value.length}charAt(n){return this.value.charAt(n)}deleteCharAt(n){this.value=this.value.substr(0,n)+this.value.substring(n+1)}setCharAt(n,r){this.value=this.value.substr(0,n)+r+this.value.substr(n+1)}substring(n,r){return this.value.substring(n,r)}setLengthToZero(){this.value=""}toString(){return this.value}insert(n,r){this.value=this.value.substr(0,n)+r+this.value.substr(n+r.length)}}class _e{constructor(n,r,s,o){if(this.width=n,this.height=r,this.rowSize=s,this.bits=o,r==null&&(r=n),this.height=r,n<1||r<1)throw new v("Both dimensions must be greater than 0");s==null&&(s=Math.floor((n+31)/32)),this.rowSize=s,o==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(n){const r=n.length,s=n[0].length,o=new _e(s,r);for(let a=0;a<r;a++){const u=n[a];for(let d=0;d<s;d++)u[d]&&o.set(d,a)}return o}static parseFromString(n,r,s){if(n===null)throw new v("stringRepresentation cannot be null");const o=new Array(n.length);let a=0,u=0,d=-1,h=0,g=0;for(;g<n.length;)if(n.charAt(g)===`
59
+ */var za=ct,fx=cx;function dx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hx=typeof Object.is=="function"?Object.is:dx,gx=fx.useSyncExternalStore,px=za.useRef,xx=za.useEffect,mx=za.useMemo,wx=za.useDebugValue;xh.useSyncExternalStoreWithSelector=function(e,t,i,l,c){var f=px(null);if(f.current===null){var p={hasValue:!1,value:null};f.current=p}else p=f.current;f=mx(function(){function C(M){if(!m){if(m=!0,_=M,M=l(M),c!==void 0&&p.hasValue){var P=p.value;if(c(P,M))return v=P}return v=M}if(P=v,hx(_,M))return P;var B=l(M);return c!==void 0&&c(P,B)?(_=M,P):(_=M,v=B)}var m=!1,_,v,R=i===void 0?null:i;return[function(){return C(t())},R===null?void 0:function(){return C(R())}]},[t,i,l,c]);var w=gx(e,f[0],f[1]);return xx(function(){p.hasValue=!0,p.value=w},[w]),wx(w),w};ph.exports=xh;var yx=ph.exports;const Ex=J0(yx),yh={},{useDebugValue:Cx}=Sg,{useSyncExternalStoreWithSelector:Ax}=Ex;let N0=!1;const vx=e=>e;function Sx(e,t=vx,i){(yh?"production":void 0)!=="production"&&i&&!N0&&(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"),N0=!0);const l=Ax(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return Cx(l),l}const R0=e=>{(yh?"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"?ex(e):e,i=(l,c)=>Sx(t,l,c);return Object.assign(i,t),i},Ix=e=>e?R0(e):R0,_x={};function Tx(e,t){let i;try{i=e()}catch{return}return{getItem:c=>{var f;const p=C=>C===null?null:JSON.parse(C,void 0),w=(f=i.getItem(c))!=null?f:null;return w instanceof Promise?w.then(p):p(w)},setItem:(c,f)=>i.setItem(c,JSON.stringify(f,void 0)),removeItem:c=>i.removeItem(c)}}const qs=e=>t=>{try{const i=e(t);return i instanceof Promise?i:{then(l){return qs(l)(i)},catch(l){return this}}}catch(i){return{then(l){return this},catch(l){return qs(l)(i)}}}},Nx=(e,t)=>(i,l,c)=>{let f={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:K=>K,version:0,merge:(K,O)=>({...O,...K}),...t},p=!1;const w=new Set,C=new Set;let m;try{m=f.getStorage()}catch{}if(!m)return e((...K)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),i(...K)},l,c);const _=qs(f.serialize),v=()=>{const K=f.partialize({...l()});let O;const T=_({state:K,version:f.version}).then(N=>m.setItem(f.name,N)).catch(N=>{O=N});if(O)throw O;return T},R=c.setState;c.setState=(K,O)=>{R(K,O),v()};const M=e((...K)=>{i(...K),v()},l,c);let P;const B=()=>{var K;if(!m)return;p=!1,w.forEach(T=>T(l()));const O=((K=f.onRehydrateStorage)==null?void 0:K.call(f,l()))||void 0;return qs(m.getItem.bind(m))(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 N;return P=f.merge(T,(N=l())!=null?N:M),i(P,!0),v()}).then(()=>{O==null||O(P,void 0),p=!0,C.forEach(T=>T(P))}).catch(T=>{O==null||O(void 0,T)})};return c.persist={setOptions:K=>{f={...f,...K},K.getStorage&&(m=K.getStorage())},clearStorage:()=>{m==null||m.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>B(),hasHydrated:()=>p,onHydrate:K=>(w.add(K),()=>{w.delete(K)}),onFinishHydration:K=>(C.add(K),()=>{C.delete(K)})},B(),P||M},Rx=(e,t)=>(i,l,c)=>{let f={storage:Tx(()=>localStorage),partialize:B=>B,version:0,merge:(B,K)=>({...K,...B}),...t},p=!1;const w=new Set,C=new Set;let m=f.storage;if(!m)return e((...B)=>{console.warn(`[zustand persist middleware] Unable to update item '${f.name}', the given storage is currently unavailable.`),i(...B)},l,c);const _=()=>{const B=f.partialize({...l()});return m.setItem(f.name,{state:B,version:f.version})},v=c.setState;c.setState=(B,K)=>{v(B,K),_()};const R=e((...B)=>{i(...B),_()},l,c);c.getInitialState=()=>R;let M;const P=()=>{var B,K;if(!m)return;p=!1,w.forEach(T=>{var N;return T((N=l())!=null?N:R)});const O=((K=f.onRehydrateStorage)==null?void 0:K.call(f,(B=l())!=null?B:R))||void 0;return qs(m.getItem.bind(m))(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 N;const[G,j]=T;if(M=f.merge(j,(N=l())!=null?N:R),i(M,!0),G)return _()}).then(()=>{O==null||O(M,void 0),M=l(),p=!0,C.forEach(T=>T(M))}).catch(T=>{O==null||O(void 0,T)})};return c.persist={setOptions:B=>{f={...f,...B},B.storage&&(m=B.storage)},clearStorage:()=>{m==null||m.removeItem(f.name)},getOptions:()=>f,rehydrate:()=>P(),hasHydrated:()=>p,onHydrate:B=>(w.add(B),()=>{w.delete(B)}),onFinishHydration:B=>(C.add(B),()=>{C.delete(B)})},f.skipHydration||P(),M||R},bx=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((_x?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Nx(e,t)):Rx(e,t),Ox=bx;function Dx(){return typeof document<"u"&&document.body.dataset.webShell==="1"}function Eh(){return typeof navigator>"u"?!1:Dx()||!/Electron\//i.test(navigator.userAgent)}function sw(e=900){const[t,i]=ct.useState(()=>typeof window<"u"&&window.innerWidth<e);return ct.useEffect(()=>{const l=window.matchMedia(`(max-width: ${e-1}px)`),c=f=>i(f.matches);return i(l.matches),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[e]),t}const ow=[{id:"pearl",label:"珍珠白",preview:["#f5f6fa","#4f6ef7"]},{id:"scifi",label:"科幻霓虹",preview:["#050a14","#22d3ee"]},{id:"noir",label:"暗夜黑",preview:["#0f1115","#a78bfa"]}],aw=[{id:"standard",label:"标准",description:"侧边栏 + 对话区"},{id:"focus",label:"专注",description:"隐藏侧边栏,居中沉浸对话"},{id:"compact",label:"紧凑",description:"更小间距与字号,信息密度优先"}],Ch=4;function Ah(e){return Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))]:[]}function Mx(e,t){const i=e??{};return{...i.skin!==void 0?{skin:i.skin}:{},...i.layout!==void 0?{layout:i.layout}:{},...i.autoSpeak!==void 0?{autoSpeak:i.autoSpeak}:{},...i.wakeEnabled!==void 0?{wakeEnabled:i.wakeEnabled}:{},...i.wakeWord!==void 0?{wakeWord:i.wakeWord}:{},...i.runningFirst!==void 0?{runningFirst:i.runningFirst}:{},pinnedSessionIds:Ah(i.pinnedSessionIds),...t<Ch&&Eh()?{wakeEnabled:!1}:{}}}function kx(e=Eh()){return!e}const Px=Ix()(Ox(e=>({skin:"pearl",layout:"standard",autoSpeak:!1,wakeEnabled:kx(),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(i=>({pinnedSessionIds:i.pinnedSessionIds.includes(t)?i.pinnedSessionIds.filter(l=>l!==t):Ah([...i.pinnedSessionIds,t])})),removePinnedSessions:t=>e(i=>{const l=new Set(t);return{pinnedSessionIds:i.pinnedSessionIds.filter(c=>!l.has(c))}})}),{name:"agent-ui-prefs",version:Ch,migrate:Mx})),Bx="agent-web-shell:skin:v1",Lx=["pearl","scifi","noir"];function Fx(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const i=t.data;!i||typeof i!="object"||i.type!==Bx||typeof i.skin!="string"||!Lx.includes(i.skin)||Px.getState().setSkin(i.skin)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const Ux="agentroam:open-browser-live",Wx="agent-web-shell:open-browser-live:v1";function zx(){if(window.parent===window)return()=>{};const e=t=>{if(t.origin!==window.location.origin||t.source!==window.parent)return;const i=t.data;!i||typeof i!="object"||i.type!==Wx||window.dispatchEvent(new CustomEvent(Ux))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}const Vx="agent-webapp:ready:v1";function jx(){window.parent!==window&&window.parent.postMessage({type:Vx},window.location.origin)}const Hx="agent-webapp:project-request:v1",Gx="agent-web-shell:project-response:v1",Xx=["project:list","project:get","project:create","project:rename","project:delete","project:roots","project:directories","project:check"];new Set(Xx);function Yx(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==Gx||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}class Zx{constructor(t=window,i=15e3){this.context=t,this.timeoutMs=i,this.sequence=0,this.pending=new Map,this.onMessage=l=>{if(l.origin!==this.context.location.origin||l.source!==this.context.parent)return;const c=Yx(l.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,i={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"}));const l=++this.sequence;return new Promise((c,f)=>{const p=setTimeout(()=>{this.pending.delete(l),f(Object.assign(new Error("项目操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(l,{resolve:c,reject:f,timer:p}),this.context.parent.postMessage({type:Hx,id:l,method:t,payload:i},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 Kx="agent-webapp:browser-request:v1",Qx="agent-web-shell:browser-response:v1",qx="agent-web-shell:browser-event:v1",$x="agent-web-shell:browser-frame:v1",Jx=["browser:list","browser:watch","browser:unwatch","browser:takeover","browser:return","browser:input","browser:set-display","browser:ping","browser:webrtc"];new Set(Jx);function em(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==Qx||!Number.isSafeInteger(t.id)||Number(t.id)<1||typeof t.ok!="boolean"||!t.ok&&typeof t.error!="string"?null:t}function tm(e){if(!e||typeof e!="object")return null;const t=e;if(t.type!==qx||!t.event||typeof t.event!="object")return null;const i=t.event;return typeof i.type!="string"||!i.type.startsWith("browser:")?null:t}function nm(e){if(!e||typeof e!="object")return null;const t=e;return t.type!==$x||!Number.isSafeInteger(t.channelId)||Number(t.channelId)<1||!Number.isSafeInteger(t.sequence)||Number(t.sequence)<0||!(t.data instanceof ArrayBuffer)?null:t}class rm{constructor(t=window,i=15e3){this.context=t,this.timeoutMs=i,this.sequence=0,this.pending=new Map,this.listeners=new Set,this.sessionsByChannel=new Map,this.pendingFramesByChannel=new Map,this.onMessage=l=>{var C;if(l.origin!==this.context.location.origin||l.source!==this.context.parent)return;const c=nm(l.data);if(c){const m=this.sessionsByChannel.get(c.channelId);if(!m){this.pendingFramesByChannel.set(c.channelId,c);return}this.emitBinaryFrame(c,m);return}const f=tm(l.data);if(f){for(const m of this.listeners)m(f.event);return}const p=em(l.data);if(!p)return;const w=this.pending.get(p.id);if(w)if(this.pending.delete(p.id),clearTimeout(w.timer),p.ok){if(w.method==="browser:watch"&&p.result&&typeof p.result=="object"){const m=p.result;if(Number.isSafeInteger(m.channelId)&&typeof((C=m.session)==null?void 0:C.id)=="string"){const _=Number(m.channelId);this.sessionsByChannel.set(_,m.session.id);const v=this.pendingFramesByChannel.get(_);v&&(this.pendingFramesByChannel.delete(_),this.emitBinaryFrame(v,m.session.id))}}w.resolve(p.result)}else w.reject(Object.assign(new Error(p.error||"浏览器操作失败"),{code:p.code}))},this.context.addEventListener("message",this.onMessage)}emitBinaryFrame(t,i){for(const l of this.listeners)l({type:"browser:frame",sessionId:i,sequence:t.sequence,data:t.data,mime:"image/jpeg",timestamp:Date.now()})}request(t,i={}){if(this.context.parent===this.context)return Promise.reject(Object.assign(new Error("请从 AgentRoam Web 控制台打开浏览器直播"),{code:"WEB_SHELL_REQUIRED"}));const l=++this.sequence;return new Promise((c,f)=>{const p=setTimeout(()=>{this.pending.delete(l),f(Object.assign(new Error("浏览器操作超时"),{code:"WEB_SHELL_TIMEOUT"}))},this.timeoutMs);this.pending.set(l,{resolve:c,reject:f,timer:p,method:t}),this.context.parent.postMessage({type:Kx,id:l,method:t,payload:i},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 br{constructor(t){this.url=t}static parse(t){const i=t.trim();if(!i)return null;const l=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(i)?i:`http://${i}`;let c;try{c=new URL(l)}catch{return null}return c.protocol!=="http:"&&c.protocol!=="https:"||!c.hostname?null:new br(`${c.protocol}//${c.host}`)}toString(){return this.url}api(t){return`${this.url}${t.startsWith("/")?t:`/${t}`}`}}class im{constructor(t,i,l){this.environment=t,this.storage=i,this.probe=l}async planStartup(){if(!this.environment.isNativeApp())return{mode:"same-origin"};const t=this.launchEndpoint();if(t)return{mode:"ready",endpoint:t};const i=this.storage.load();if(i){const l=await this.probe.probe(i);return l.ok?{mode:"ready",endpoint:i}:{mode:"setup",endpoint:i,failure:l.reason}}return{mode:"setup",endpoint:null}}async connect(t){const i=br.parse(t);if(!i)return{ok:!1,reason:"地址无效,请输入 http(s)://host:port 形式的服务器地址"};const l=await this.probe.probe(i);return l.ok?(this.storage.save(i),{ok:!0,endpoint:i}):{ok:!1,reason:`无法连接服务器:${l.reason}`}}disconnect(){this.storage.clear()}launchEndpoint(){const t=this.environment.launchServerUrl();return t?br.parse(t):null}}function b0(){return window.Capacitor??null}class sm{isNativeApp(){var t,i;return((i=(t=b0())==null?void 0:t.isNativePlatform)==null?void 0:i.call(t))??!1}platform(){var i,l;const t=(l=(i=b0())==null?void 0:i.getPlatform)==null?void 0:l.call(i);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 Ul="webapp.mobile.serverEndpoint.v1";class O0{load(){try{const t=localStorage.getItem(Ul);return t?br.parse(t):null}catch{return null}}save(t){localStorage.setItem(Ul,t.toString())}clear(){localStorage.removeItem(Ul)}}const om=6e3;class am{constructor(t=(...i)=>fetch(...i)){this.transport=t}async probe(t,i=om){const l=new AbortController,c=setTimeout(()=>l.abort(),i);try{const f=await this.transport(t.api("/api/agent/model"),{method:"GET",cache:"no-store",signal:l.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"?"连接超时":lm(f)}}finally{clearTimeout(c)}}}function lm(e){return(e instanceof Error?e.message:String(e))||"网络错误"}function um({service:e,savedEndpoint:t,initialFailure:i,onConnected:l,onScan:c}){const[f,p]=ct.useState((t==null?void 0:t.toString())??""),[w,C]=ct.useState(i??""),[m,_]=ct.useState(!1);async function v(){if(!(m||!c)){_(!0),C("");try{const M=await c();M&&l(M)}catch(M){C(M instanceof Error?M.message:"扫码连接失败,请重试。")}finally{_(!1)}}}async function R(){if(!m){_(!0),C("");try{const M=await e.connect(f);M.ok?l(M.endpoint):C(M.reason)}catch{C("连接失败,请检查网络或重新扫码授权。")}finally{_(!1)}}}return te.jsx("div",{style:Wn.page,children:te.jsxs("div",{style:Wn.card,children:[te.jsx("div",{style:Wn.icon,children:"🛰️"}),te.jsx("h1",{style:Wn.title,children:"连接服务器"}),c?te.jsxs(te.Fragment,{children:[te.jsx("p",{style:Wn.hint,children:"扫描电脑终端上的授权二维码,直接连接,无需再次确认。"}),te.jsx("button",{type:"button",style:{...Wn.button,marginBottom:20},disabled:m,onClick:()=>void v(),children:m?"正在连接…":"扫码连接"})]}):null,te.jsx("p",{style:Wn.hint,children:"也可以输入已授权的服务器地址。使用局域网地址时,手机与电脑需在同一网络。"}),te.jsx("input",{style:Wn.input,value:f,inputMode:"url",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,placeholder:"http://192.168.1.10:3000",onChange:M=>p(M.target.value),onKeyDown:M=>{M.key==="Enter"&&R()}}),w?te.jsx("p",{style:Wn.error,children:w}):null,te.jsx("button",{style:{...Wn.button,opacity:m||!f.trim()?.6:1},disabled:m,onClick:()=>void R(),children:m?"正在连接…":"连接"})]})})}const Wn={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 Xi;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Xi||(Xi={}));class Wl extends Error{constructor(t,i,l){super(t),this.message=t,this.code=i,this.data=l}}const cm=e=>{var t,i;return e!=null&&e.androidBridge?"android":!((i=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||i===void 0)&&i.bridge?"ios":"web"},fm=e=>{const t=e.CapacitorCustomPlatform||null,i=e.Capacitor||{},l=i.Plugins=i.Plugins||{},c=()=>t!==null?t.name:cm(e),f=()=>c()!=="web",p=v=>{const R=m.get(v);return!!(R!=null&&R.platforms.has(c())||w(v))},w=v=>{var R;return(R=i.PluginHeaders)===null||R===void 0?void 0:R.find(M=>M.name===v)},C=v=>e.console.error(v),m=new Map,_=(v,R={})=>{const M=m.get(v);if(M)return console.warn(`Capacitor plugin "${v}" already registered. Cannot register plugins twice.`),M.proxy;const P=c(),B=w(v);let K;const O=async()=>(!K&&P in R?K=typeof R[P]=="function"?K=await R[P]():K=R[P]:t!==null&&!K&&"web"in R&&(K=typeof R.web=="function"?K=await R.web():K=R.web),K),T=(X,V)=>{var oe,Ee;if(B){const se=B==null?void 0:B.methods.find(ge=>V===ge.name);if(se)return se.rtype==="promise"?ge=>i.nativePromise(v,V.toString(),ge):(ge,_e)=>i.nativeCallback(v,V.toString(),ge,_e);if(X)return(oe=X[V])===null||oe===void 0?void 0:oe.bind(X)}else{if(X)return(Ee=X[V])===null||Ee===void 0?void 0:Ee.bind(X);throw new Wl(`"${v}" plugin is not implemented on ${P}`,Xi.Unimplemented)}},N=X=>{let V;const oe=(...Ee)=>{const se=O().then(ge=>{const _e=T(ge,X);if(_e){const H=_e(...Ee);return V=H==null?void 0:H.remove,H}else throw new Wl(`"${v}.${X}()" is not implemented on ${P}`,Xi.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},G=N("addListener"),j=N("removeListener"),U=(X,V)=>{const oe=G({eventName:X},V),Ee=async()=>{const ge=await oe;j({eventName:X,callbackId:ge},V)},se=new Promise(ge=>oe.then(()=>ge({remove:Ee})));return se.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await Ee()},se},k=new Proxy({},{get(X,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return B?U:G;case"removeListener":return j;default:return N(V)}}});return l[v]=k,m.set(v,{name:v,proxy:k,platforms:new Set([...Object.keys(R),...B?[P]:[]])}),k};return i.convertFileSrc||(i.convertFileSrc=v=>v),i.getPlatform=c,i.handleError=C,i.isNativePlatform=f,i.isPluginAvailable=p,i.registerPlugin=_,i.Exception=Wl,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i},dm=e=>e.Capacitor=fm(e),$s=dm(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Va=$s.registerPlugin;class vh{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,i){let l=!1;this.listeners[t]||(this.listeners[t]=[],l=!0),this.listeners[t].push(i);const f=this.windowListeners[t];f&&!f.registered&&this.addWindowListener(f),l&&this.sendRetainedArgumentsForEvent(t);const p=async()=>this.removeListener(t,i);return Promise.resolve({remove:p})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,i,l){const c=this.listeners[t];if(!c){if(l){let f=this.retainedEventArguments[t];f||(f=[]),f.push(i),this.retainedEventArguments[t]=f}return}c.forEach(f=>f(i))}hasListeners(t){var i;return!!(!((i=this.listeners[t])===null||i===void 0)&&i.length)}registerWindowListener(t,i){this.windowListeners[i]={registered:!1,windowEventName:t,pluginEventName:i,handler:l=>{this.notifyListeners(i,l)}}}unimplemented(t="not implemented"){return new $s.Exception(t,Xi.Unimplemented)}unavailable(t="not available"){return new $s.Exception(t,Xi.Unavailable)}async removeListener(t,i){const l=this.listeners[t];if(!l)return;const c=l.indexOf(i);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 i=this.retainedEventArguments[t];i&&(delete this.retainedEventArguments[t],i.forEach(l=>{this.notifyListeners(t,l)}))}}const D0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),M0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class hm extends vh{async getCookies(){const t=document.cookie,i={};return t.split(";").forEach(l=>{if(l.length<=0)return;let[c,f]=l.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");c=M0(c).trim(),f=M0(f).trim(),i[c]=f}),i}async setCookie(t){try{const i=D0(t.key),l=D0(t.value),c=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",f=(t.path||"/").replace("path=",""),p=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${i}=${l||""}${c}; path=${f}; ${p};`}catch(i){return Promise.reject(i)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(i){return Promise.reject(i)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const i of t)document.cookie=i.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)}}}Va("CapacitorCookies",{web:()=>new hm});const gm=async e=>new Promise((t,i)=>{const l=new FileReader;l.onload=()=>{const c=l.result;t(c.indexOf(",")>=0?c.split(",")[1]:c)},l.onerror=c=>i(c),l.readAsDataURL(e)}),pm=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(c=>c.toLocaleLowerCase()).reduce((c,f,p)=>(c[f]=e[t[p]],c),{})},xm=(e,t=!0)=>e?Object.entries(e).reduce((l,c)=>{const[f,p]=c;let w,C;return Array.isArray(p)?(C="",p.forEach(m=>{w=t?encodeURIComponent(m):m,C+=`${f}=${w}&`}),C.slice(0,-1)):(w=t?encodeURIComponent(p):p,C=`${f}=${w}`),`${l}&${C}`},"").substr(1):null,mm=(e,t={})=>{const i=Object.assign({method:e.method||"GET",headers:e.headers},t),c=pm(e.headers)["content-type"]||"";if(typeof e.data=="string")i.body=e.data;else if(c.includes("application/x-www-form-urlencoded")){const f=new URLSearchParams;for(const[p,w]of Object.entries(e.data||{}))f.set(p,w);i.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((w,C)=>{f.append(C,w)});else for(const w of Object.keys(e.data))f.append(w,e.data[w]);i.body=f;const p=new Headers(i.headers);p.delete("content-type"),i.headers=p}else(c.includes("application/json")||typeof e.data=="object")&&(i.body=JSON.stringify(e.data));return i};class wm extends vh{async request(t){const i=mm(t,t.webFetchExtra),l=xm(t.params,t.shouldEncodeUrlParams),c=l?`${t.url}?${l}`:t.url,f=await fetch(c,i),p=f.headers.get("content-type")||"";let{responseType:w="text"}=f.ok?t:{};p.includes("application/json")&&(w="json");let C,m;switch(w){case"arraybuffer":case"blob":m=await f.blob(),C=await gm(m);break;case"json":C=await f.json();break;case"document":case"text":default:C=await f.text()}const _={};return f.headers.forEach((v,R)=>{_[R]=v}),{data:C,headers:_,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"}))}}Va("CapacitorHttp",{web:()=>new wm});var ne;(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"})(ne||(ne={}));var k0=new Map([[ne.QR_CODE,"QR_CODE"],[ne.AZTEC,"AZTEC"],[ne.CODABAR,"CODABAR"],[ne.CODE_39,"CODE_39"],[ne.CODE_93,"CODE_93"],[ne.CODE_128,"CODE_128"],[ne.DATA_MATRIX,"DATA_MATRIX"],[ne.MAXICODE,"MAXICODE"],[ne.ITF,"ITF"],[ne.EAN_13,"EAN_13"],[ne.EAN_8,"EAN_8"],[ne.PDF_417,"PDF_417"],[ne.RSS_14,"RSS_14"],[ne.RSS_EXPANDED,"RSS_EXPANDED"],[ne.UPC_A,"UPC_A"],[ne.UPC_E,"UPC_E"],[ne.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),P0;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(P0||(P0={}));function ym(e){return Object.values(ne).includes(e)}var Ca;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ca||(Ca={}));var Em=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=[Ca.SCAN_TYPE_CAMERA,Ca.SCAN_TYPE_FILE],e}(),Sh=function(){function e(t,i){this.format=t,this.formatName=i}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!k0.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,k0.get(t))},e}(),B0=function(){function e(){}return e.createFromText=function(t){var i={text:t};return{decodedText:t,result:i}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),Bu;(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"})(Bu||(Bu={}));var Cm=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:Bu.UNKWOWN_ERROR}},e}(),Am=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,i){(this.verbose||i===!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 Xn(e){return typeof e>"u"||e===null}var Ri=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}(),Ih=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,i){if(typeof t!="object"){var l=typeof t;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(l,"."),!0),!1}for(var c=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(c),p=Object.keys(t),w=0,C=p;w<C.length;w++){var m=C[w];if(f.has(m))return i.logError("".concat(m," is not supported videoConstaints."),!0),!1}return!0},e}(),Lu={exports:{}};(function(e,t){(function(i,l){l(t)})(ls,function(i){function l(y){return y==null}var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,n){y.__proto__=n}||function(y,n){for(var r in n)n.hasOwnProperty(r)&&(y[r]=n[r])};function f(y,n){c(y,n);function r(){this.constructor=y}y.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}function p(y,n){var r=Object.setPrototypeOf;r?r(y,n):y.__proto__=n}function w(y,n){n===void 0&&(n=y.constructor);var r=Error.captureStackTrace;r&&r(y,n)}var C=function(y){f(n,y);function n(r){var s=this.constructor,o=y.call(this,r)||this;return Object.defineProperty(o,"name",{value:s.name,enumerable:!1}),p(o,s.prototype),w(o),o}return n}(Error);class m extends C{constructor(n=void 0){super(n),this.message=n}getKind(){return this.constructor.kind}}m.kind="Exception";class _ extends m{}_.kind="ArgumentException";class v extends m{}v.kind="IllegalArgumentException";class R{constructor(n){if(this.binarizer=n,n===null)throw new v("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(n,r){return this.binarizer.getBlackRow(n,r)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(n,r,s,o){const a=this.binarizer.getLuminanceSource().crop(n,r,s,o);return new R(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const n=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new R(this.binarizer.createBinarizer(n))}rotateCounterClockwise45(){const n=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new R(this.binarizer.createBinarizer(n))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class M extends m{static getChecksumInstance(){return new M}}M.kind="ChecksumException";class P{constructor(n){this.source=n}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class B{static arraycopy(n,r,s,o,a){for(;a--;)s[o++]=n[r++]}static currentTimeMillis(){return Date.now()}}class K extends m{}K.kind="IndexOutOfBoundsException";class O extends K{constructor(n=void 0,r=void 0){super(r),this.index=n,this.message=r}}O.kind="ArrayIndexOutOfBoundsException";class T{static fill(n,r){for(let s=0,o=n.length;s<o;s++)n[s]=r}static fillWithin(n,r,s,o){T.rangeCheck(n.length,r,s);for(let a=r;a<s;a++)n[a]=o}static rangeCheck(n,r,s){if(r>s)throw new v("fromIndex("+r+") > toIndex("+s+")");if(r<0)throw new O(r);if(s>n)throw new O(s)}static asList(...n){return n}static create(n,r,s){return Array.from({length:n}).map(a=>Array.from({length:r}).fill(s))}static createInt32Array(n,r,s){return Array.from({length:n}).map(a=>Int32Array.from({length:r}).fill(s))}static equals(n,r){if(!n||!r||!n.length||!r.length||n.length!==r.length)return!1;for(let s=0,o=n.length;s<o;s++)if(n[s]!==r[s])return!1;return!0}static hashCode(n){if(n===null)return 0;let r=1;for(const s of n)r=31*r+s;return r}static fillUint8Array(n,r){for(let s=0;s!==n.length;s++)n[s]=r}static copyOf(n,r){return n.slice(0,r)}static copyOfUint8Array(n,r){if(n.length<=r){const s=new Uint8Array(r);return s.set(n),s}return n.slice(0,r)}static copyOfRange(n,r,s){const o=s-r,a=new Int32Array(o);return B.arraycopy(n,r,a,0,o),a}static binarySearch(n,r,s){s===void 0&&(s=T.numberComparator);let o=0,a=n.length-1;for(;o<=a;){const u=a+o>>1,d=s(r,n[u]);if(d>0)o=u+1;else if(d<0)a=u-1;else return u}return-o-1}static numberComparator(n,r){return n-r}}class N{static numberOfTrailingZeros(n){let r;if(n===0)return 32;let s=31;return r=n<<16,r!==0&&(s-=16,n=r),r=n<<8,r!==0&&(s-=8,n=r),r=n<<4,r!==0&&(s-=4,n=r),r=n<<2,r!==0&&(s-=2,n=r),s-(n<<1>>>31)}static numberOfLeadingZeros(n){if(n===0)return 32;let r=1;return n>>>16||(r+=16,n<<=16),n>>>24||(r+=8,n<<=8),n>>>28||(r+=4,n<<=4),n>>>30||(r+=2,n<<=2),r-=n>>>31,r}static toHexString(n){return n.toString(16)}static toBinaryString(n){return String(parseInt(String(n),2))}static bitCount(n){return n=n-(n>>>1&1431655765),n=(n&858993459)+(n>>>2&858993459),n=n+(n>>>4)&252645135,n=n+(n>>>8),n=n+(n>>>16),n&63}static truncDivision(n,r){return Math.trunc(n/r)}static parseInt(n,r=void 0){return parseInt(n,r)}}N.MIN_VALUE_32_BITS=-2147483648,N.MAX_VALUE=Number.MAX_SAFE_INTEGER;class G{constructor(n,r){n===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=n,r==null?this.bits=G.makeArray(n):this.bits=r)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(n){if(n>this.bits.length*32){const r=G.makeArray(n);B.arraycopy(this.bits,0,r,0,this.bits.length),this.bits=r}}get(n){return(this.bits[Math.floor(n/32)]&1<<(n&31))!==0}set(n){this.bits[Math.floor(n/32)]|=1<<(n&31)}flip(n){this.bits[Math.floor(n/32)]^=1<<(n&31)}getNextSet(n){const r=this.size;if(n>=r)return r;const s=this.bits;let o=Math.floor(n/32),a=s[o];a&=~((1<<(n&31))-1);const u=s.length;for(;a===0;){if(++o===u)return r;a=s[o]}const d=o*32+N.numberOfTrailingZeros(a);return d>r?r:d}getNextUnset(n){const r=this.size;if(n>=r)return r;const s=this.bits;let o=Math.floor(n/32),a=~s[o];a&=~((1<<(n&31))-1);const u=s.length;for(;a===0;){if(++o===u)return r;a=~s[o]}const d=o*32+N.numberOfTrailingZeros(a);return d>r?r:d}setBulk(n,r){this.bits[Math.floor(n/32)]=r}setRange(n,r){if(r<n||n<0||r>this.size)throw new v;if(r===n)return;r--;const s=Math.floor(n/32),o=Math.floor(r/32),a=this.bits;for(let u=s;u<=o;u++){const d=u>s?0:n&31,g=(2<<(u<o?31:r&31))-(1<<d);a[u]|=g}}clear(){const n=this.bits.length,r=this.bits;for(let s=0;s<n;s++)r[s]=0}isRange(n,r,s){if(r<n||n<0||r>this.size)throw new v;if(r===n)return!0;r--;const o=Math.floor(n/32),a=Math.floor(r/32),u=this.bits;for(let d=o;d<=a;d++){const h=d>o?0:n&31,x=(2<<(d<a?31:r&31))-(1<<h)&4294967295;if((u[d]&x)!==(s?x:0))return!1}return!0}appendBit(n){this.ensureCapacity(this.size+1),n&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(n,r){if(r<0||r>32)throw new v("Num bits must be between 0 and 32");this.ensureCapacity(this.size+r);for(let s=r;s>0;s--)this.appendBit((n>>s-1&1)===1)}appendBitArray(n){const r=n.size;this.ensureCapacity(this.size+r);for(let s=0;s<r;s++)this.appendBit(n.get(s))}xor(n){if(this.size!==n.size)throw new v("Sizes don't match");const r=this.bits;for(let s=0,o=r.length;s<o;s++)r[s]^=n.bits[s]}toBytes(n,r,s,o){for(let a=0;a<o;a++){let u=0;for(let d=0;d<8;d++)this.get(n)&&(u|=1<<7-d),n++;r[s+a]=u}}getBitArray(){return this.bits}reverse(){const n=new Int32Array(this.bits.length),r=Math.floor((this.size-1)/32),s=r+1,o=this.bits;for(let a=0;a<s;a++){let u=o[a];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,n[r-a]=u}if(this.size!==s*32){const a=s*32-this.size;let u=n[0]>>>a;for(let d=1;d<s;d++){const h=n[d];u|=h<<32-a,n[d-1]=u,u=h>>>a}n[s-1]=u}this.bits=n}static makeArray(n){return new Int32Array(Math.floor((n+31)/32))}equals(n){if(!(n instanceof G))return!1;const r=n;return this.size===r.size&&T.equals(this.bits,r.bits)}hashCode(){return 31*this.size+T.hashCode(this.bits)}toString(){let n="";for(let r=0,s=this.size;r<s;r++)r&7||(n+=" "),n+=this.get(r)?"X":".";return n}clone(){return new G(this.size,this.bits.slice())}}var j;(function(y){y[y.OTHER=0]="OTHER",y[y.PURE_BARCODE=1]="PURE_BARCODE",y[y.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",y[y.TRY_HARDER=3]="TRY_HARDER",y[y.CHARACTER_SET=4]="CHARACTER_SET",y[y.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",y[y.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",y[y.ASSUME_GS1=7]="ASSUME_GS1",y[y.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",y[y.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",y[y.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(j||(j={}));var U=j;class k extends m{static getFormatInstance(){return new k}}k.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(n,r,s,...o){this.valueIdentifier=n,this.name=s,typeof r=="number"?this.values=Int32Array.from([r]):this.values=r,this.otherEncodingNames=o,V.VALUE_IDENTIFIER_TO_ECI.set(n,this),V.NAME_TO_ECI.set(s,this);const a=this.values;for(let u=0,d=a.length;u!==d;u++){const h=a[u];V.VALUES_TO_ECI.set(h,this)}for(const u of o)V.NAME_TO_ECI.set(u,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(n){if(n<0||n>=900)throw new k("incorect value");const r=V.VALUES_TO_ECI.get(n);if(r===void 0)throw new k("incorect value");return r}static getCharacterSetECIByName(n){const r=V.NAME_TO_ECI.get(n);if(r===void 0)throw new k("incorect value");return r}equals(n){if(!(n instanceof V))return!1;const r=n;return this.getName()===r.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 m{}oe.kind="UnsupportedOperationException";class Ee{static decode(n,r){const s=this.encodingName(r);return this.customDecoder?this.customDecoder(n,s):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(s)?this.decodeFallback(n,s):new TextDecoder(s).decode(n)}static shouldDecodeOnFallback(n){return!Ee.isBrowser()&&n==="ISO-8859-1"}static encode(n,r){const s=this.encodingName(r);return this.customEncoder?this.customEncoder(n,s):typeof TextEncoder>"u"?this.encodeFallback(n):new TextEncoder().encode(n)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(n){return typeof n=="string"?n:n.getName()}static encodingCharacterSet(n){return n instanceof V?n:V.getCharacterSetECIByName(n)}static decodeFallback(n,r){const s=this.encodingCharacterSet(r);if(Ee.isDecodeFallbackSupported(s)){let o="";for(let a=0,u=n.length;a<u;a++){let d=n[a].toString(16);d.length<2&&(d="0"+d),o+="%"+d}return decodeURIComponent(o)}if(s.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(n.buffer));throw new oe(`Encoding ${this.encodingName(r)} not supported by fallback.`)}static isDecodeFallbackSupported(n){return n.equals(V.UTF8)||n.equals(V.ISO8859_1)||n.equals(V.ASCII)}static encodeFallback(n){const s=btoa(unescape(encodeURIComponent(n))).split(""),o=[];for(let a=0;a<s.length;a++)o.push(s[a].charCodeAt(0));return new Uint8Array(o)}}class se{static castAsNonUtf8Char(n,r=null){const s=r?r.getName():this.ISO88591;return Ee.decode(new Uint8Array([n]),s)}static guessEncoding(n,r){if(r!=null&&r.get(U.CHARACTER_SET)!==void 0)return r.get(U.CHARACTER_SET).toString();const s=n.length;let o=!0,a=!0,u=!0,d=0,h=0,g=0,x=0,E=0,A=0,I=0,b=0,D=0,L=0,z=0;const q=n.length>3&&n[0]===239&&n[1]===187&&n[2]===191;for(let $=0;$<s&&(o||a||u);$++){const Z=n[$]&255;u&&(d>0?Z&128?d--:u=!1:Z&128&&(Z&64?(d++,Z&32?(d++,Z&16?(d++,Z&8?u=!1:x++):g++):h++):u=!1)),o&&(Z>127&&Z<160?o=!1:Z>159&&(Z<192||Z===215||Z===247)&&z++),a&&(E>0?Z<64||Z===127||Z>252?a=!1:E--:Z===128||Z===160||Z>239?a=!1:Z>160&&Z<224?(A++,b=0,I++,I>D&&(D=I)):Z>127?(E++,I=0,b++,b>L&&(L=b)):(I=0,b=0))}return u&&d>0&&(u=!1),a&&E>0&&(a=!1),u&&(q||h+g+x>0)?se.UTF8:a&&(se.ASSUME_SHIFT_JIS||D>=3||L>=3)?se.SHIFT_JIS:o&&a?D===2&&A===2||z*10>=s?se.SHIFT_JIS:se.ISO88591:o?se.ISO88591:a?se.SHIFT_JIS:u?se.UTF8:se.PLATFORM_DEFAULT_ENCODING}static format(n,...r){let s=-1;function o(u,d,h,g,x,E){if(u==="%%")return"%";if(r[++s]===void 0)return;u=g?parseInt(g.substr(1)):void 0;let A=x?parseInt(x.substr(1)):void 0,I;switch(E){case"s":I=r[s];break;case"c":I=r[s][0];break;case"f":I=parseFloat(r[s]).toFixed(u);break;case"p":I=parseFloat(r[s]).toPrecision(u);break;case"e":I=parseFloat(r[s]).toExponential(u);break;case"x":I=parseInt(r[s]).toString(A||16);break;case"d":I=parseFloat(parseInt(r[s],A||10).toPrecision(u)).toFixed(0);break}I=typeof I=="object"?JSON.stringify(I):(+I).toString(A);let b=parseInt(h),D=h&&h[0]+""=="0"?"0":" ";for(;I.length<b;)I=d!==void 0?I+D:D+I;return I}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return n.replace(a,o)}static getBytes(n,r){return Ee.encode(n,r)}static getCharCode(n,r=0){return n.charCodeAt(r)}static getCharAt(n){return String.fromCharCode(n)}}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(n=""){this.value=n}enableDecoding(n){return this.encoding=n,this}append(n){return typeof n=="string"?this.value+=n.toString():this.encoding?this.value+=se.castAsNonUtf8Char(n,this.encoding):this.value+=String.fromCharCode(n),this}appendChars(n,r,s){for(let o=r;r<r+s;o++)this.append(n[o]);return this}length(){return this.value.length}charAt(n){return this.value.charAt(n)}deleteCharAt(n){this.value=this.value.substr(0,n)+this.value.substring(n+1)}setCharAt(n,r){this.value=this.value.substr(0,n)+r+this.value.substr(n+1)}substring(n,r){return this.value.substring(n,r)}setLengthToZero(){this.value=""}toString(){return this.value}insert(n,r){this.value=this.value.substr(0,n)+r+this.value.substr(n+r.length)}}class _e{constructor(n,r,s,o){if(this.width=n,this.height=r,this.rowSize=s,this.bits=o,r==null&&(r=n),this.height=r,n<1||r<1)throw new v("Both dimensions must be greater than 0");s==null&&(s=Math.floor((n+31)/32)),this.rowSize=s,o==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(n){const r=n.length,s=n[0].length,o=new _e(s,r);for(let a=0;a<r;a++){const u=n[a];for(let d=0;d<s;d++)u[d]&&o.set(d,a)}return o}static parseFromString(n,r,s){if(n===null)throw new v("stringRepresentation cannot be null");const o=new Array(n.length);let a=0,u=0,d=-1,h=0,g=0;for(;g<n.length;)if(n.charAt(g)===`
60
60
  `||n.charAt(g)==="\r"){if(a>u){if(d===-1)d=a-u;else if(a-u!==d)throw new v("row lengths do not match");u=a,h++}g++}else if(n.substring(g,g+r.length)===r)g+=r.length,o[a]=!0,a++;else if(n.substring(g,g+s.length)===s)g+=s.length,o[a]=!1,a++;else throw new v("illegal character encountered: "+n.substring(g));if(a>u){if(d===-1)d=a-u;else if(a-u!==d)throw new v("row lengths do not match");h++}const x=new _e(d,h);for(let E=0;E<a;E++)o[E]&&x.set(Math.floor(E%d),Math.floor(E/d));return x}get(n,r){const s=r*this.rowSize+Math.floor(n/32);return(this.bits[s]>>>(n&31)&1)!==0}set(n,r){const s=r*this.rowSize+Math.floor(n/32);this.bits[s]|=1<<(n&31)&4294967295}unset(n,r){const s=r*this.rowSize+Math.floor(n/32);this.bits[s]&=~(1<<(n&31)&4294967295)}flip(n,r){const s=r*this.rowSize+Math.floor(n/32);this.bits[s]^=1<<(n&31)&4294967295}xor(n){if(this.width!==n.getWidth()||this.height!==n.getHeight()||this.rowSize!==n.getRowSize())throw new v("input matrix dimensions do not match");const r=new G(Math.floor(this.width/32)+1),s=this.rowSize,o=this.bits;for(let a=0,u=this.height;a<u;a++){const d=a*s,h=n.getRow(a,r).getBitArray();for(let g=0;g<s;g++)o[d+g]^=h[g]}}clear(){const n=this.bits,r=n.length;for(let s=0;s<r;s++)n[s]=0}setRegion(n,r,s,o){if(r<0||n<0)throw new v("Left and top must be nonnegative");if(o<1||s<1)throw new v("Height and width must be at least 1");const a=n+s,u=r+o;if(u>this.height||a>this.width)throw new v("The region must fit inside the matrix");const d=this.rowSize,h=this.bits;for(let g=r;g<u;g++){const x=g*d;for(let E=n;E<a;E++)h[x+Math.floor(E/32)]|=1<<(E&31)&4294967295}}getRow(n,r){r==null||r.getSize()<this.width?r=new G(this.width):r.clear();const s=this.rowSize,o=this.bits,a=n*s;for(let u=0;u<s;u++)r.setBulk(u*32,o[a+u]);return r}setRow(n,r){B.arraycopy(r.getBitArray(),0,this.bits,n*this.rowSize,this.rowSize)}rotate180(){const n=this.getWidth(),r=this.getHeight();let s=new G(n),o=new G(n);for(let a=0,u=Math.floor((r+1)/2);a<u;a++)s=this.getRow(a,s),o=this.getRow(r-1-a,o),s.reverse(),o.reverse(),this.setRow(a,o),this.setRow(r-1-a,s)}getEnclosingRectangle(){const n=this.width,r=this.height,s=this.rowSize,o=this.bits;let a=n,u=r,d=-1,h=-1;for(let g=0;g<r;g++)for(let x=0;x<s;x++){const E=o[g*s+x];if(E!==0){if(g<u&&(u=g),g>h&&(h=g),x*32<a){let A=0;for(;!(E<<31-A&4294967295);)A++;x*32+A<a&&(a=x*32+A)}if(x*32+31>d){let A=31;for(;!(E>>>A);)A--;x*32+A>d&&(d=x*32+A)}}}return d<a||h<u?null:Int32Array.from([a,u,d-a+1,h-u+1])}getTopLeftOnBit(){const n=this.rowSize,r=this.bits;let s=0;for(;s<r.length&&r[s]===0;)s++;if(s===r.length)return null;const o=s/n;let a=s%n*32;const u=r[s];let d=0;for(;!(u<<31-d&4294967295);)d++;return a+=d,Int32Array.from([a,o])}getBottomRightOnBit(){const n=this.rowSize,r=this.bits;let s=r.length-1;for(;s>=0&&r[s]===0;)s--;if(s<0)return null;const o=Math.floor(s/n);let a=Math.floor(s%n)*32;const u=r[s];let d=31;for(;!(u>>>d);)d--;return a+=d,Int32Array.from([a,o])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(n){if(!(n instanceof _e))return!1;const r=n;return this.width===r.width&&this.height===r.height&&this.rowSize===r.rowSize&&T.equals(this.bits,r.bits)}hashCode(){let n=this.width;return n=31*n+this.width,n=31*n+this.height,n=31*n+this.rowSize,n=31*n+T.hashCode(this.bits),n}toString(n="X ",r=" ",s=`
61
- `){return this.buildToString(n,r,s)}buildToString(n,r,s){let o=new ge;for(let a=0,u=this.height;a<u;a++){for(let d=0,h=this.width;d<h;d++)o.append(this.get(d,a)?n:r);o.append(s)}return o.toString()}clone(){return new _e(this.width,this.height,this.rowSize,this.bits.slice())}}class j extends m{static getNotFoundInstance(){return new j}}j.kind="NotFoundException";class tt extends P{constructor(n){super(n),this.luminances=tt.EMPTY,this.buckets=new Int32Array(tt.LUMINANCE_BUCKETS)}getBlackRow(n,r){const s=this.getLuminanceSource(),o=s.getWidth();r==null||r.getSize()<o?r=new G(o):r.clear(),this.initArrays(o);const a=s.getRow(n,this.luminances),u=this.buckets;for(let h=0;h<o;h++)u[(a[h]&255)>>tt.LUMINANCE_SHIFT]++;const d=tt.estimateBlackPoint(u);if(o<3)for(let h=0;h<o;h++)(a[h]&255)<d&&r.set(h);else{let h=a[0]&255,g=a[1]&255;for(let x=1;x<o-1;x++){const E=a[x+1]&255;(g*4-h-E)/2<d&&r.set(x),h=g,g=E}}return r}getBlackMatrix(){const n=this.getLuminanceSource(),r=n.getWidth(),s=n.getHeight(),o=new _e(r,s);this.initArrays(r);const a=this.buckets;for(let h=1;h<5;h++){const g=Math.floor(s*h/5),x=n.getRow(g,this.luminances),E=Math.floor(r*4/5);for(let A=Math.floor(r/5);A<E;A++){const I=x[A]&255;a[I>>tt.LUMINANCE_SHIFT]++}}const u=tt.estimateBlackPoint(a),d=n.getMatrix();for(let h=0;h<s;h++){const g=h*r;for(let x=0;x<r;x++)(d[g+x]&255)<u&&o.set(x,h)}return o}createBinarizer(n){return new tt(n)}initArrays(n){this.luminances.length<n&&(this.luminances=new Uint8ClampedArray(n));const r=this.buckets;for(let s=0;s<tt.LUMINANCE_BUCKETS;s++)r[s]=0}static estimateBlackPoint(n){const r=n.length;let s=0,o=0,a=0;for(let x=0;x<r;x++)n[x]>a&&(o=x,a=n[x]),n[x]>s&&(s=n[x]);let u=0,d=0;for(let x=0;x<r;x++){const E=x-o,A=n[x]*E*E;A>d&&(u=x,d=A)}if(o>u){const x=o;o=u,u=x}if(u-o<=r/16)throw new j;let h=u-1,g=-1;for(let x=u-1;x>o;x--){const E=x-o,A=E*E*(u-x)*(s-n[x]);A>g&&(h=x,g=A)}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(n){super(n),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const n=this.getLuminanceSource(),r=n.getWidth(),s=n.getHeight();if(r>=xe.MINIMUM_DIMENSION&&s>=xe.MINIMUM_DIMENSION){const o=n.getMatrix();let a=r>>xe.BLOCK_SIZE_POWER;r&xe.BLOCK_SIZE_MASK&&a++;let u=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&u++;const d=xe.calculateBlackPoints(o,a,u,r,s),h=new _e(r,s);xe.calculateThresholdForBlock(o,a,u,r,s,d,h),this.matrix=h}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(n){return new xe(n)}static calculateThresholdForBlock(n,r,s,o,a,u,d){const h=a-xe.BLOCK_SIZE,g=o-xe.BLOCK_SIZE;for(let x=0;x<s;x++){let E=x<<xe.BLOCK_SIZE_POWER;E>h&&(E=h);const A=xe.cap(x,2,s-3);for(let I=0;I<r;I++){let b=I<<xe.BLOCK_SIZE_POWER;b>g&&(b=g);const D=xe.cap(I,2,r-3);let L=0;for(let q=-2;q<=2;q++){const $=u[A+q];L+=$[D-2]+$[D-1]+$[D]+$[D+1]+$[D+2]}const z=L/25;xe.thresholdBlock(n,b,E,z,o,d)}}}static cap(n,r,s){return n<r?r:n>s?s:n}static thresholdBlock(n,r,s,o,a,u){for(let d=0,h=s*a+r;d<xe.BLOCK_SIZE;d++,h+=a)for(let g=0;g<xe.BLOCK_SIZE;g++)(n[h+g]&255)<=o&&u.set(r+g,s+d)}static calculateBlackPoints(n,r,s,o,a){const u=a-xe.BLOCK_SIZE,d=o-xe.BLOCK_SIZE,h=new Array(s);for(let g=0;g<s;g++){h[g]=new Int32Array(r);let x=g<<xe.BLOCK_SIZE_POWER;x>u&&(x=u);for(let E=0;E<r;E++){let A=E<<xe.BLOCK_SIZE_POWER;A>d&&(A=d);let I=0,b=255,D=0;for(let z=0,q=x*o+A;z<xe.BLOCK_SIZE;z++,q+=o){for(let $=0;$<xe.BLOCK_SIZE;$++){const Z=n[q+$]&255;I+=Z,Z<b&&(b=Z),Z>D&&(D=Z)}if(D-b>xe.MIN_DYNAMIC_RANGE)for(z++,q+=o;z<xe.BLOCK_SIZE;z++,q+=o)for(let $=0;$<xe.BLOCK_SIZE;$++)I+=n[q+$]&255}let L=I>>xe.BLOCK_SIZE_POWER*2;if(D-b<=xe.MIN_DYNAMIC_RANGE&&(L=b/2,g>0&&E>0)){const z=(h[g-1][E]+2*h[g][E-1]+h[g-1][E-1])/4;b<z&&(L=z)}h[g][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 ee{constructor(n,r){this.width=n,this.height=r}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(n,r,s,o){throw new se("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new se("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new se("This luminance source does not support rotation by 45 degrees.")}toString(){const n=new Uint8ClampedArray(this.width);let r=new ge;for(let s=0;s<this.height;s++){const o=this.getRow(s,n);for(let a=0;a<this.width;a++){const u=o[a]&255;let d;u<64?d="#":u<128?d="+":u<192?d=".":d=" ",r.append(d)}r.append(`
62
- `)}return r.toString()}}class de extends ee{constructor(n){super(n.getWidth(),n.getHeight()),this.delegate=n}getRow(n,r){const s=this.delegate.getRow(n,r),o=this.getWidth();for(let a=0;a<o;a++)s[a]=255-(s[a]&255);return s}getMatrix(){const n=this.delegate.getMatrix(),r=this.getWidth()*this.getHeight(),s=new Uint8ClampedArray(r);for(let o=0;o<r;o++)s[o]=255-(n[o]&255);return s}isCropSupported(){return this.delegate.isCropSupported()}crop(n,r,s,o){return new de(this.delegate.crop(n,r,s,o))}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 ee{constructor(n){super(n.width,n.height),this.canvas=n,this.tempCanvasElement=null,this.buffer=pe.makeBufferFromCanvasImageData(n)}static makeBufferFromCanvasImageData(n){const r=n.getContext("2d").getImageData(0,0,n.width,n.height);return pe.toGrayscaleBuffer(r.data,n.width,n.height)}static toGrayscaleBuffer(n,r,s){const o=new Uint8ClampedArray(r*s);for(let a=0,u=0,d=n.length;a<d;a+=4,u++){let h;if(n[a+3]===0)h=255;else{const x=n[a],E=n[a+1],A=n[a+2];h=306*x+601*E+117*A+512>>10}o[u]=h}return o}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth(),o=n*s;return r===null?r=this.buffer.slice(o,o+s):(r.length<s&&(r=new Uint8ClampedArray(s)),r.set(this.buffer.slice(o,o+s))),r}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(n,r,s,o){return super.crop(n,r,s,o),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement}rotate(n){const r=this.getTempCanvasElement(),s=r.getContext("2d"),o=n*pe.DEGREE_TO_RADIANS,a=this.canvas.width,u=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(o))*a+Math.abs(Math.sin(o))*u),h=Math.ceil(Math.abs(Math.sin(o))*a+Math.abs(Math.cos(o))*u);return r.width=d,r.height=h,s.translate(d/2,h/2),s.rotate(o),s.drawImage(this.canvas,a/-2,u/-2),this.buffer=pe.makeBufferFromCanvasImageData(r),this}invert(){return new de(this)}}pe.DEGREE_TO_RADIANS=Math.PI/180;class Ge{constructor(n,r,s){this.deviceId=n,this.label=r,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||ls||self||window||void 0)&&(globalThis||ls||self||window||void 0).__awaiter||function(y,n,r,s){function o(a){return a instanceof r?a:new r(function(u){u(a)})}return new(r||(r=Promise))(function(a,u){function d(x){try{g(s.next(x))}catch(E){u(E)}}function h(x){try{g(s.throw(x))}catch(E){u(E)}}function g(x){x.done?a(x.value):o(x.value).then(d,h)}g((s=s.apply(y,n||[])).next())})};class cn{constructor(n,r=500,s){this.reader=n,this.timeBetweenScansMillis=r,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(n){this._timeBetweenDecodingAttempts=n<0?0:n}set hints(n){this._hints=n||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 n=yield navigator.mediaDevices.enumerateDevices(),r=[];for(const s of n){const o=s.kind==="video"?"videoinput":s.kind;if(o!=="videoinput")continue;const a=s.deviceId||s.id,u=s.label||`Video device ${r.length+1}`,d=s.groupId,h={deviceId:a,label:u,kind:o,groupId:d};r.push(h)}return r})}getVideoInputDevices(){return Ie(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(r=>new Ge(r.deviceId,r.label))})}findDeviceById(n){return Ie(this,void 0,void 0,function*(){const r=yield this.listVideoInputDevices();return r?r.find(s=>s.deviceId===n):null})}decodeFromInputVideoDevice(n,r){return Ie(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(n,r)})}decodeOnceFromVideoDevice(n,r){return Ie(this,void 0,void 0,function*(){this.reset();let s;n?s={deviceId:{exact:n}}:s={facingMode:"environment"};const o={video:s};return yield this.decodeOnceFromConstraints(o,r)})}decodeOnceFromConstraints(n,r){return Ie(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(n);return yield this.decodeOnceFromStream(s,r)})}decodeOnceFromStream(n,r){return Ie(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(n,r);return yield this.decodeOnce(s)})}decodeFromInputVideoDeviceContinuously(n,r,s){return Ie(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(n,r,s)})}decodeFromVideoDevice(n,r,s){return Ie(this,void 0,void 0,function*(){let o;n?o={deviceId:{exact:n}}:o={facingMode:"environment"};const a={video:o};return yield this.decodeFromConstraints(a,r,s)})}decodeFromConstraints(n,r,s){return Ie(this,void 0,void 0,function*(){const o=yield navigator.mediaDevices.getUserMedia(n);return yield this.decodeFromStream(o,r,s)})}decodeFromStream(n,r,s){return Ie(this,void 0,void 0,function*(){this.reset();const o=yield this.attachStreamToVideo(n,r);return yield this.decodeContinuously(o,s)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(n,r){return Ie(this,void 0,void 0,function*(){const s=this.prepareVideoElement(r);return this.addVideoSource(s,n),this.videoElement=s,this.stream=n,yield this.playVideoOnLoadAsync(s),s})}playVideoOnLoadAsync(n){return new Promise((r,s)=>this.playVideoOnLoad(n,()=>r()))}playVideoOnLoad(n,r){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(n),n.addEventListener("ended",this.videoEndedListener),n.addEventListener("canplay",this.videoCanPlayListener),n.addEventListener("playing",r),this.tryPlayVideo(n)}isVideoPlaying(n){return n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2}tryPlayVideo(n){return Ie(this,void 0,void 0,function*(){if(this.isVideoPlaying(n)){console.warn("Trying to play video that is already playing.");return}try{yield n.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(n,r){const s=document.getElementById(n);if(!s)throw new _(`element with id '${n}' not found`);if(s.nodeName.toLowerCase()!==r.toLowerCase())throw new _(`element with id '${n}' must be an ${r} element`);return s}decodeFromImage(n,r){if(!n&&!r)throw new _("either imageElement with a src set or an url must be provided");return r&&!n?this.decodeFromImageUrl(r):this.decodeFromImageElement(n)}decodeFromVideo(n,r){if(!n&&!r)throw new _("Either an element with a src set or an URL must be provided");return r&&!n?this.decodeFromVideoUrl(r):this.decodeFromVideoElement(n)}decodeFromVideoContinuously(n,r,s){if(n===void 0&&r===void 0)throw new _("Either an element with a src set or an URL must be provided");return r&&!n?this.decodeFromVideoUrlContinuously(r,s):this.decodeFromVideoElementContinuously(n,s)}decodeFromImageElement(n){if(!n)throw new _("An image element must be provided.");this.reset();const r=this.prepareImageElement(n);this.imageElement=r;let s;return this.isImageLoaded(r)?s=this.decodeOnce(r,!1,!0):s=this._decodeOnLoadImage(r),s}decodeFromVideoElement(n){const r=this._decodeFromVideoElementSetup(n);return this._decodeOnLoadVideo(r)}decodeFromVideoElementContinuously(n,r){const s=this._decodeFromVideoElementSetup(n);return this._decodeOnLoadVideoContinuously(s,r)}_decodeFromVideoElementSetup(n){if(!n)throw new _("A video element must be provided.");this.reset();const r=this.prepareVideoElement(n);return this.videoElement=r,r}decodeFromImageUrl(n){if(!n)throw new _("An URL must be provided.");this.reset();const r=this.prepareImageElement();this.imageElement=r;const s=this._decodeOnLoadImage(r);return r.src=n,s}decodeFromVideoUrl(n){if(!n)throw new _("An URL must be provided.");this.reset();const r=this.prepareVideoElement(),s=this.decodeFromVideoElement(r);return r.src=n,s}decodeFromVideoUrlContinuously(n,r){if(!n)throw new _("An URL must be provided.");this.reset();const s=this.prepareVideoElement(),o=this.decodeFromVideoElementContinuously(s,r);return s.src=n,o}_decodeOnLoadImage(n){return new Promise((r,s)=>{this.imageLoadedListener=()=>this.decodeOnce(n,!1,!0).then(r,s),n.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(n){return Ie(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(n),yield this.decodeOnce(n)})}_decodeOnLoadVideoContinuously(n,r){return Ie(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(n),this.decodeContinuously(n,r)})}isImageLoaded(n){return!(!n.complete||n.naturalWidth===0)}prepareImageElement(n){let r;return typeof n>"u"&&(r=document.createElement("img"),r.width=200,r.height=200),typeof n=="string"&&(r=this.getMediaElement(n,"img")),n instanceof HTMLImageElement&&(r=n),r}prepareVideoElement(n){let r;return!n&&typeof document<"u"&&(r=document.createElement("video"),r.width=200,r.height=200),typeof n=="string"&&(r=this.getMediaElement(n,"video")),n instanceof HTMLVideoElement&&(r=n),r.setAttribute("autoplay","true"),r.setAttribute("muted","true"),r.setAttribute("playsinline","true"),r}decodeOnce(n,r=!0,s=!0){this._stopAsyncDecode=!1;const o=(a,u)=>{if(this._stopAsyncDecode){u(new j("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(n);a(d)}catch(d){const h=r&&d instanceof j,x=(d instanceof M||d instanceof k)&&s;if(h||x)return setTimeout(o,this._timeBetweenDecodingAttempts,a,u);u(d)}};return new Promise((a,u)=>o(a,u))}decodeContinuously(n,r){this._stopContinuousDecode=!1;const s=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const o=this.decode(n);r(o,null),setTimeout(s,this.timeBetweenScansMillis)}catch(o){r(null,o);const a=o instanceof M||o instanceof k,u=o instanceof j;(a||u)&&setTimeout(s,this._timeBetweenDecodingAttempts)}};s()}decode(n){const r=this.createBinaryBitmap(n);return this.decodeBitmap(r)}_isHTMLVideoElement(n){return n.videoWidth!==0}drawFrameOnCanvas(n,r,s){r||(r={sx:0,sy:0,sWidth:n.videoWidth,sHeight:n.videoHeight,dx:0,dy:0,dWidth:n.videoWidth,dHeight:n.videoHeight}),s||(s=this.captureCanvasContext),s.drawImage(n,r.sx,r.sy,r.sWidth,r.sHeight,r.dx,r.dy,r.dWidth,r.dHeight)}drawImageOnCanvas(n,r,s=this.captureCanvasContext){r||(r={sx:0,sy:0,sWidth:n.naturalWidth,sHeight:n.naturalHeight,dx:0,dy:0,dWidth:n.naturalWidth,dHeight:n.naturalHeight}),s||(s=this.captureCanvasContext),s.drawImage(n,r.sx,r.sy,r.sWidth,r.sHeight,r.dx,r.dy,r.dWidth,r.dHeight)}createBinaryBitmap(n){this.getCaptureCanvasContext(n),this._isHTMLVideoElement(n)?this.drawFrameOnCanvas(n):this.drawImageOnCanvas(n);const r=this.getCaptureCanvas(n),s=new pe(r),o=new xe(s);return new R(o)}getCaptureCanvasContext(n){if(!this.captureCanvasContext){const s=this.getCaptureCanvas(n).getContext("2d");this.captureCanvasContext=s}return this.captureCanvasContext}getCaptureCanvas(n){if(!this.captureCanvas){const r=this.createCaptureCanvas(n);this.captureCanvas=r}return this.captureCanvas}decodeBitmap(n){return this.reader.decode(n,this._hints)}createCaptureCanvas(n){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const r=document.createElement("canvas");let s,o;return typeof n<"u"&&(n instanceof HTMLVideoElement?(s=n.videoWidth,o=n.videoHeight):n instanceof HTMLImageElement&&(s=n.naturalWidth||n.width,o=n.naturalHeight||n.height)),r.style.width=s+"px",r.style.height=o+"px",r.width=s,r.height=o,r}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(n=>n.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(n,r){try{n.srcObject=r}catch{n.src=URL.createObjectURL(r)}}cleanVideoSource(n){try{n.srcObject=null}catch{n.src=""}this.videoElement.removeAttribute("src")}}class Ke{constructor(n,r,s=r==null?0:8*r.length,o,a,u=B.currentTimeMillis()){this.text=n,this.rawBytes=r,this.numBits=s,this.resultPoints=o,this.format=a,this.timestamp=u,this.text=n,this.rawBytes=r,s==null?this.numBits=r==null?0:8*r.length:this.numBits=s,this.resultPoints=o,this.format=a,this.resultMetadata=null,u==null?this.timestamp=B.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(n,r){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(n,r)}putAllMetadata(n){n!==null&&(this.resultMetadata===null?this.resultMetadata=n:this.resultMetadata=new Map(n))}addResultPoints(n){const r=this.resultPoints;if(r===null)this.resultPoints=n;else if(n!==null&&n.length>0){const s=new Array(r.length+n.length);B.arraycopy(r,0,s,0,r.length),B.arraycopy(n,0,s,r.length,n.length),this.resultPoints=s}}getTimestamp(){return this.timestamp}toString(){return this.text}}var kr;(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"})(kr||(kr={}));var le=kr,ir;(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"})(ir||(ir={}));var mt=ir;class Qi{constructor(n,r,s,o,a=-1,u=-1){this.rawBytes=n,this.text=r,this.byteSegments=s,this.ecLevel=o,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=u,this.numBits=n==null?0:8*n.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(n){this.numBits=n}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(n){this.errorsCorrected=n}getErasures(){return this.erasures}setErasures(n){this.erasures=n}getOther(){return this.other}setOther(n){this.other=n}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class qi{exp(n){return this.expTable[n]}log(n){if(n===0)throw new v;return this.logTable[n]}static addOrSubtract(n,r){return n^r}}class Ht{constructor(n,r){if(r.length===0)throw new v;this.field=n;const s=r.length;if(s>1&&r[0]===0){let o=1;for(;o<s&&r[o]===0;)o++;o===s?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(s-o),B.arraycopy(r,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=r}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(n){return this.coefficients[this.coefficients.length-1-n]}evaluateAt(n){if(n===0)return this.getCoefficient(0);const r=this.coefficients;let s;if(n===1){s=0;for(let u=0,d=r.length;u!==d;u++){const h=r[u];s=qi.addOrSubtract(s,h)}return s}s=r[0];const o=r.length,a=this.field;for(let u=1;u<o;u++)s=qi.addOrSubtract(a.multiply(n,s),r[u]);return s}addOrSubtract(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(this.isZero())return n;if(n.isZero())return this;let r=this.coefficients,s=n.coefficients;if(r.length>s.length){const u=r;r=s,s=u}let o=new Int32Array(s.length);const a=s.length-r.length;B.arraycopy(s,0,o,0,a);for(let u=a;u<s.length;u++)o[u]=qi.addOrSubtract(r[u-a],s[u]);return new Ht(this.field,o)}multiply(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(this.isZero()||n.isZero())return this.field.getZero();const r=this.coefficients,s=r.length,o=n.coefficients,a=o.length,u=new Int32Array(s+a-1),d=this.field;for(let h=0;h<s;h++){const g=r[h];for(let x=0;x<a;x++)u[h+x]=qi.addOrSubtract(u[h+x],d.multiply(g,o[x]))}return new Ht(d,u)}multiplyScalar(n){if(n===0)return this.field.getZero();if(n===1)return this;const r=this.coefficients.length,s=this.field,o=new Int32Array(r),a=this.coefficients;for(let u=0;u<r;u++)o[u]=s.multiply(a[u],n);return new Ht(s,o)}multiplyByMonomial(n,r){if(n<0)throw new v;if(r===0)return this.field.getZero();const s=this.coefficients,o=s.length,a=new Int32Array(o+n),u=this.field;for(let d=0;d<o;d++)a[d]=u.multiply(s[d],r);return new Ht(u,a)}divide(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(n.isZero())throw new v("Divide by 0");const r=this.field;let s=r.getZero(),o=this;const a=n.getCoefficient(n.getDegree()),u=r.inverse(a);for(;o.getDegree()>=n.getDegree()&&!o.isZero();){const d=o.getDegree()-n.getDegree(),h=r.multiply(o.getCoefficient(o.getDegree()),u),g=n.multiplyByMonomial(d,h),x=r.buildMonomial(d,h);s=s.addOrSubtract(x),o=o.addOrSubtract(g)}return[s,o]}toString(){let n="";for(let r=this.getDegree();r>=0;r--){let s=this.getCoefficient(r);if(s!==0){if(s<0?(n+=" - ",s=-s):n.length>0&&(n+=" + "),r===0||s!==1){const o=this.field.log(s);o===0?n+="1":o===1?n+="a":(n+="a^",n+=o)}r!==0&&(r===1?n+="x":(n+="x^",n+=r))}}return n}}class io extends m{}io.kind="ArithmeticException";class be extends qi{constructor(n,r,s){super(),this.primitive=n,this.size=r,this.generatorBase=s;const o=new Int32Array(r);let a=1;for(let d=0;d<r;d++)o[d]=a,a*=2,a>=r&&(a^=n,a&=r-1);this.expTable=o;const u=new Int32Array(r);for(let d=0;d<r-1;d++)u[o[d]]=d;this.logTable=u,this.zero=new Ht(this,Int32Array.from([0])),this.one=new Ht(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(n,r){if(n<0)throw new v;if(r===0)return this.zero;const s=new Int32Array(n+1);return s[0]=r,new Ht(this,s)}inverse(n){if(n===0)throw new io;return this.expTable[this.size-this.logTable[n]-1]}multiply(n,r){return n===0||r===0?0:this.expTable[(this.logTable[n]+this.logTable[r])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+N.toHexString(this.primitive)+","+this.size+")"}equals(n){return n===this}}be.AZTEC_DATA_12=new be(4201,4096,1),be.AZTEC_DATA_10=new be(1033,1024,1),be.AZTEC_DATA_6=new be(67,64,1),be.AZTEC_PARAM=new be(19,16,1),be.QR_CODE_FIELD_256=new be(285,256,0),be.DATA_MATRIX_FIELD_256=new be(301,256,1),be.AZTEC_DATA_8=be.DATA_MATRIX_FIELD_256,be.MAXICODE_FIELD_64=be.AZTEC_DATA_6;class ri extends m{}ri.kind="ReedSolomonException";class Dn extends m{}Dn.kind="IllegalStateException";class $i{constructor(n){this.field=n}decode(n,r){const s=this.field,o=new Ht(s,n),a=new Int32Array(r);let u=!0;for(let I=0;I<r;I++){const b=o.evaluateAt(s.exp(I+s.getGeneratorBase()));a[a.length-1-I]=b,b!==0&&(u=!1)}if(u)return;const d=new Ht(s,a),h=this.runEuclideanAlgorithm(s.buildMonomial(r,1),d,r),g=h[0],x=h[1],E=this.findErrorLocations(g),A=this.findErrorMagnitudes(x,E);for(let I=0;I<E.length;I++){const b=n.length-1-s.log(E[I]);if(b<0)throw new ri("Bad error location");n[b]=be.addOrSubtract(n[b],A[I])}}runEuclideanAlgorithm(n,r,s){if(n.getDegree()<r.getDegree()){const I=n;n=r,r=I}const o=this.field;let a=n,u=r,d=o.getZero(),h=o.getOne();for(;u.getDegree()>=(s/2|0);){let I=a,b=d;if(a=u,d=h,a.isZero())throw new ri("r_{i-1} was zero");u=I;let D=o.getZero();const L=a.getCoefficient(a.getDegree()),z=o.inverse(L);for(;u.getDegree()>=a.getDegree()&&!u.isZero();){const q=u.getDegree()-a.getDegree(),$=o.multiply(u.getCoefficient(u.getDegree()),z);D=D.addOrSubtract(o.buildMonomial(q,$)),u=u.addOrSubtract(a.multiplyByMonomial(q,$))}if(h=D.multiply(d).addOrSubtract(b),u.getDegree()>=a.getDegree())throw new Dn("Division algorithm failed to reduce polynomial?")}const g=h.getCoefficient(0);if(g===0)throw new ri("sigmaTilde(0) was zero");const x=o.inverse(g),E=h.multiplyScalar(x),A=u.multiplyScalar(x);return[E,A]}findErrorLocations(n){const r=n.getDegree();if(r===1)return Int32Array.from([n.getCoefficient(1)]);const s=new Int32Array(r);let o=0;const a=this.field;for(let u=1;u<a.getSize()&&o<r;u++)n.evaluateAt(u)===0&&(s[o]=a.inverse(u),o++);if(o!==r)throw new ri("Error locator degree does not match number of roots");return s}findErrorMagnitudes(n,r){const s=r.length,o=new Int32Array(s),a=this.field;for(let u=0;u<s;u++){const d=a.inverse(r[u]);let h=1;for(let g=0;g<s;g++)if(u!==g){const x=a.multiply(r[g],d),E=x&1?x&-2:x|1;h=a.multiply(h,E)}o[u]=a.multiply(n.evaluateAt(d),a.inverse(h)),a.getGeneratorBase()!==0&&(o[u]=a.multiply(o[u],d))}return o}}var vt;(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"})(vt||(vt={}));class Ue{decode(n){this.ddata=n;let r=n.getBits(),s=this.extractBits(r),o=this.correctBits(s),a=Ue.convertBoolArrayToByteArray(o),u=Ue.getEncodedData(o),d=new Qi(a,u,null,null);return d.setNumBits(o.length),d}static highLevelDecode(n){return this.getEncodedData(n)}static getEncodedData(n){let r=n.length,s=vt.UPPER,o=vt.UPPER,a="",u=0;for(;u<r;)if(o===vt.BINARY){if(r-u<5)break;let d=Ue.readCode(n,u,5);if(u+=5,d===0){if(r-u<11)break;d=Ue.readCode(n,u,11)+31,u+=11}for(let h=0;h<d;h++){if(r-u<8){u=r;break}const g=Ue.readCode(n,u,8);a+=ie.castAsNonUtf8Char(g),u+=8}o=s}else{let d=o===vt.DIGIT?4:5;if(r-u<d)break;let h=Ue.readCode(n,u,d);u+=d;let g=Ue.getCharacter(o,h);g.startsWith("CTRL_")?(s=o,o=Ue.getTable(g.charAt(5)),g.charAt(6)==="L"&&(s=o)):(a+=g,o=s)}return a}static getTable(n){switch(n){case"L":return vt.LOWER;case"P":return vt.PUNCT;case"M":return vt.MIXED;case"D":return vt.DIGIT;case"B":return vt.BINARY;case"U":default:return vt.UPPER}}static getCharacter(n,r){switch(n){case vt.UPPER:return Ue.UPPER_TABLE[r];case vt.LOWER:return Ue.LOWER_TABLE[r];case vt.MIXED:return Ue.MIXED_TABLE[r];case vt.PUNCT:return Ue.PUNCT_TABLE[r];case vt.DIGIT:return Ue.DIGIT_TABLE[r];default:throw new Dn("Bad table")}}correctBits(n){let r,s;this.ddata.getNbLayers()<=2?(s=6,r=be.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,r=be.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,r=be.AZTEC_DATA_10):(s=12,r=be.AZTEC_DATA_12);let o=this.ddata.getNbDatablocks(),a=n.length/s;if(a<o)throw new k;let u=n.length%s,d=new Int32Array(a);for(let A=0;A<a;A++,u+=s)d[A]=Ue.readCode(n,u,s);try{new $i(r).decode(d,a-o)}catch(A){throw new k(A)}let h=(1<<s)-1,g=0;for(let A=0;A<o;A++){let I=d[A];if(I===0||I===h)throw new k;(I===1||I===h-1)&&g++}let x=new Array(o*s-g),E=0;for(let A=0;A<o;A++){let I=d[A];if(I===1||I===h-1)x.fill(I>1,E,E+s-1),E+=s-1;else for(let b=s-1;b>=0;--b)x[E++]=(I&1<<b)!==0}return x}extractBits(n){let r=this.ddata.isCompact(),s=this.ddata.getNbLayers(),o=(r?11:14)+s*4,a=new Int32Array(o),u=new Array(this.totalBitsInLayer(s,r));if(r)for(let d=0;d<a.length;d++)a[d]=d;else{let d=o+1+2*N.truncDivision(N.truncDivision(o,2)-1,15),h=o/2,g=N.truncDivision(d,2);for(let x=0;x<h;x++){let E=x+N.truncDivision(x,15);a[h-x-1]=g-E-1,a[h+x]=g+E+1}}for(let d=0,h=0;d<s;d++){let g=(s-d)*4+(r?9:12),x=d*2,E=o-1-x;for(let A=0;A<g;A++){let I=A*2;for(let b=0;b<2;b++)u[h+I+b]=n.get(a[x+b],a[x+A]),u[h+2*g+I+b]=n.get(a[x+A],a[E-b]),u[h+4*g+I+b]=n.get(a[E-b],a[E-A]),u[h+6*g+I+b]=n.get(a[E-A],a[x+b])}h+=g*8}return u}static readCode(n,r,s){let o=0;for(let a=r;a<r+s;a++)o<<=1,n[a]&&(o|=1);return o}static readByte(n,r){let s=n.length-r;return s>=8?Ue.readCode(n,r,8):Ue.readCode(n,r,s)<<8-s}static convertBoolArrayToByteArray(n){let r=new Uint8Array((n.length+7)/8);for(let s=0;s<r.length;s++)r[s]=Ue.readByte(n,8*s);return r}totalBitsInLayer(n,r){return((r?88:112)+16*n)*n}}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"," ",`
61
+ `){return this.buildToString(n,r,s)}buildToString(n,r,s){let o=new ge;for(let a=0,u=this.height;a<u;a++){for(let d=0,h=this.width;d<h;d++)o.append(this.get(d,a)?n:r);o.append(s)}return o.toString()}clone(){return new _e(this.width,this.height,this.rowSize,this.bits.slice())}}class H extends m{static getNotFoundInstance(){return new H}}H.kind="NotFoundException";class tt extends P{constructor(n){super(n),this.luminances=tt.EMPTY,this.buckets=new Int32Array(tt.LUMINANCE_BUCKETS)}getBlackRow(n,r){const s=this.getLuminanceSource(),o=s.getWidth();r==null||r.getSize()<o?r=new G(o):r.clear(),this.initArrays(o);const a=s.getRow(n,this.luminances),u=this.buckets;for(let h=0;h<o;h++)u[(a[h]&255)>>tt.LUMINANCE_SHIFT]++;const d=tt.estimateBlackPoint(u);if(o<3)for(let h=0;h<o;h++)(a[h]&255)<d&&r.set(h);else{let h=a[0]&255,g=a[1]&255;for(let x=1;x<o-1;x++){const E=a[x+1]&255;(g*4-h-E)/2<d&&r.set(x),h=g,g=E}}return r}getBlackMatrix(){const n=this.getLuminanceSource(),r=n.getWidth(),s=n.getHeight(),o=new _e(r,s);this.initArrays(r);const a=this.buckets;for(let h=1;h<5;h++){const g=Math.floor(s*h/5),x=n.getRow(g,this.luminances),E=Math.floor(r*4/5);for(let A=Math.floor(r/5);A<E;A++){const I=x[A]&255;a[I>>tt.LUMINANCE_SHIFT]++}}const u=tt.estimateBlackPoint(a),d=n.getMatrix();for(let h=0;h<s;h++){const g=h*r;for(let x=0;x<r;x++)(d[g+x]&255)<u&&o.set(x,h)}return o}createBinarizer(n){return new tt(n)}initArrays(n){this.luminances.length<n&&(this.luminances=new Uint8ClampedArray(n));const r=this.buckets;for(let s=0;s<tt.LUMINANCE_BUCKETS;s++)r[s]=0}static estimateBlackPoint(n){const r=n.length;let s=0,o=0,a=0;for(let x=0;x<r;x++)n[x]>a&&(o=x,a=n[x]),n[x]>s&&(s=n[x]);let u=0,d=0;for(let x=0;x<r;x++){const E=x-o,A=n[x]*E*E;A>d&&(u=x,d=A)}if(o>u){const x=o;o=u,u=x}if(u-o<=r/16)throw new H;let h=u-1,g=-1;for(let x=u-1;x>o;x--){const E=x-o,A=E*E*(u-x)*(s-n[x]);A>g&&(h=x,g=A)}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(n){super(n),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const n=this.getLuminanceSource(),r=n.getWidth(),s=n.getHeight();if(r>=xe.MINIMUM_DIMENSION&&s>=xe.MINIMUM_DIMENSION){const o=n.getMatrix();let a=r>>xe.BLOCK_SIZE_POWER;r&xe.BLOCK_SIZE_MASK&&a++;let u=s>>xe.BLOCK_SIZE_POWER;s&xe.BLOCK_SIZE_MASK&&u++;const d=xe.calculateBlackPoints(o,a,u,r,s),h=new _e(r,s);xe.calculateThresholdForBlock(o,a,u,r,s,d,h),this.matrix=h}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(n){return new xe(n)}static calculateThresholdForBlock(n,r,s,o,a,u,d){const h=a-xe.BLOCK_SIZE,g=o-xe.BLOCK_SIZE;for(let x=0;x<s;x++){let E=x<<xe.BLOCK_SIZE_POWER;E>h&&(E=h);const A=xe.cap(x,2,s-3);for(let I=0;I<r;I++){let b=I<<xe.BLOCK_SIZE_POWER;b>g&&(b=g);const D=xe.cap(I,2,r-3);let L=0;for(let q=-2;q<=2;q++){const $=u[A+q];L+=$[D-2]+$[D-1]+$[D]+$[D+1]+$[D+2]}const z=L/25;xe.thresholdBlock(n,b,E,z,o,d)}}}static cap(n,r,s){return n<r?r:n>s?s:n}static thresholdBlock(n,r,s,o,a,u){for(let d=0,h=s*a+r;d<xe.BLOCK_SIZE;d++,h+=a)for(let g=0;g<xe.BLOCK_SIZE;g++)(n[h+g]&255)<=o&&u.set(r+g,s+d)}static calculateBlackPoints(n,r,s,o,a){const u=a-xe.BLOCK_SIZE,d=o-xe.BLOCK_SIZE,h=new Array(s);for(let g=0;g<s;g++){h[g]=new Int32Array(r);let x=g<<xe.BLOCK_SIZE_POWER;x>u&&(x=u);for(let E=0;E<r;E++){let A=E<<xe.BLOCK_SIZE_POWER;A>d&&(A=d);let I=0,b=255,D=0;for(let z=0,q=x*o+A;z<xe.BLOCK_SIZE;z++,q+=o){for(let $=0;$<xe.BLOCK_SIZE;$++){const Z=n[q+$]&255;I+=Z,Z<b&&(b=Z),Z>D&&(D=Z)}if(D-b>xe.MIN_DYNAMIC_RANGE)for(z++,q+=o;z<xe.BLOCK_SIZE;z++,q+=o)for(let $=0;$<xe.BLOCK_SIZE;$++)I+=n[q+$]&255}let L=I>>xe.BLOCK_SIZE_POWER*2;if(D-b<=xe.MIN_DYNAMIC_RANGE&&(L=b/2,g>0&&E>0)){const z=(h[g-1][E]+2*h[g][E-1]+h[g-1][E-1])/4;b<z&&(L=z)}h[g][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 ee{constructor(n,r){this.width=n,this.height=r}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(n,r,s,o){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 n=new Uint8ClampedArray(this.width);let r=new ge;for(let s=0;s<this.height;s++){const o=this.getRow(s,n);for(let a=0;a<this.width;a++){const u=o[a]&255;let d;u<64?d="#":u<128?d="+":u<192?d=".":d=" ",r.append(d)}r.append(`
62
+ `)}return r.toString()}}class de extends ee{constructor(n){super(n.getWidth(),n.getHeight()),this.delegate=n}getRow(n,r){const s=this.delegate.getRow(n,r),o=this.getWidth();for(let a=0;a<o;a++)s[a]=255-(s[a]&255);return s}getMatrix(){const n=this.delegate.getMatrix(),r=this.getWidth()*this.getHeight(),s=new Uint8ClampedArray(r);for(let o=0;o<r;o++)s[o]=255-(n[o]&255);return s}isCropSupported(){return this.delegate.isCropSupported()}crop(n,r,s,o){return new de(this.delegate.crop(n,r,s,o))}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 ee{constructor(n){super(n.width,n.height),this.canvas=n,this.tempCanvasElement=null,this.buffer=pe.makeBufferFromCanvasImageData(n)}static makeBufferFromCanvasImageData(n){const r=n.getContext("2d").getImageData(0,0,n.width,n.height);return pe.toGrayscaleBuffer(r.data,n.width,n.height)}static toGrayscaleBuffer(n,r,s){const o=new Uint8ClampedArray(r*s);for(let a=0,u=0,d=n.length;a<d;a+=4,u++){let h;if(n[a+3]===0)h=255;else{const x=n[a],E=n[a+1],A=n[a+2];h=306*x+601*E+117*A+512>>10}o[u]=h}return o}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth(),o=n*s;return r===null?r=this.buffer.slice(o,o+s):(r.length<s&&(r=new Uint8ClampedArray(s)),r.set(this.buffer.slice(o,o+s))),r}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(n,r,s,o){return super.crop(n,r,s,o),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement}rotate(n){const r=this.getTempCanvasElement(),s=r.getContext("2d"),o=n*pe.DEGREE_TO_RADIANS,a=this.canvas.width,u=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(o))*a+Math.abs(Math.sin(o))*u),h=Math.ceil(Math.abs(Math.sin(o))*a+Math.abs(Math.cos(o))*u);return r.width=d,r.height=h,s.translate(d/2,h/2),s.rotate(o),s.drawImage(this.canvas,a/-2,u/-2),this.buffer=pe.makeBufferFromCanvasImageData(r),this}invert(){return new de(this)}}pe.DEGREE_TO_RADIANS=Math.PI/180;class Ge{constructor(n,r,s){this.deviceId=n,this.label=r,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||ls||self||window||void 0)&&(globalThis||ls||self||window||void 0).__awaiter||function(y,n,r,s){function o(a){return a instanceof r?a:new r(function(u){u(a)})}return new(r||(r=Promise))(function(a,u){function d(x){try{g(s.next(x))}catch(E){u(E)}}function h(x){try{g(s.throw(x))}catch(E){u(E)}}function g(x){x.done?a(x.value):o(x.value).then(d,h)}g((s=s.apply(y,n||[])).next())})};class cn{constructor(n,r=500,s){this.reader=n,this.timeBetweenScansMillis=r,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(n){this._timeBetweenDecodingAttempts=n<0?0:n}set hints(n){this._hints=n||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 n=yield navigator.mediaDevices.enumerateDevices(),r=[];for(const s of n){const o=s.kind==="video"?"videoinput":s.kind;if(o!=="videoinput")continue;const a=s.deviceId||s.id,u=s.label||`Video device ${r.length+1}`,d=s.groupId,h={deviceId:a,label:u,kind:o,groupId:d};r.push(h)}return r})}getVideoInputDevices(){return Ie(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(r=>new Ge(r.deviceId,r.label))})}findDeviceById(n){return Ie(this,void 0,void 0,function*(){const r=yield this.listVideoInputDevices();return r?r.find(s=>s.deviceId===n):null})}decodeFromInputVideoDevice(n,r){return Ie(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(n,r)})}decodeOnceFromVideoDevice(n,r){return Ie(this,void 0,void 0,function*(){this.reset();let s;n?s={deviceId:{exact:n}}:s={facingMode:"environment"};const o={video:s};return yield this.decodeOnceFromConstraints(o,r)})}decodeOnceFromConstraints(n,r){return Ie(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(n);return yield this.decodeOnceFromStream(s,r)})}decodeOnceFromStream(n,r){return Ie(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(n,r);return yield this.decodeOnce(s)})}decodeFromInputVideoDeviceContinuously(n,r,s){return Ie(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(n,r,s)})}decodeFromVideoDevice(n,r,s){return Ie(this,void 0,void 0,function*(){let o;n?o={deviceId:{exact:n}}:o={facingMode:"environment"};const a={video:o};return yield this.decodeFromConstraints(a,r,s)})}decodeFromConstraints(n,r,s){return Ie(this,void 0,void 0,function*(){const o=yield navigator.mediaDevices.getUserMedia(n);return yield this.decodeFromStream(o,r,s)})}decodeFromStream(n,r,s){return Ie(this,void 0,void 0,function*(){this.reset();const o=yield this.attachStreamToVideo(n,r);return yield this.decodeContinuously(o,s)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(n,r){return Ie(this,void 0,void 0,function*(){const s=this.prepareVideoElement(r);return this.addVideoSource(s,n),this.videoElement=s,this.stream=n,yield this.playVideoOnLoadAsync(s),s})}playVideoOnLoadAsync(n){return new Promise((r,s)=>this.playVideoOnLoad(n,()=>r()))}playVideoOnLoad(n,r){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(n),n.addEventListener("ended",this.videoEndedListener),n.addEventListener("canplay",this.videoCanPlayListener),n.addEventListener("playing",r),this.tryPlayVideo(n)}isVideoPlaying(n){return n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2}tryPlayVideo(n){return Ie(this,void 0,void 0,function*(){if(this.isVideoPlaying(n)){console.warn("Trying to play video that is already playing.");return}try{yield n.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(n,r){const s=document.getElementById(n);if(!s)throw new _(`element with id '${n}' not found`);if(s.nodeName.toLowerCase()!==r.toLowerCase())throw new _(`element with id '${n}' must be an ${r} element`);return s}decodeFromImage(n,r){if(!n&&!r)throw new _("either imageElement with a src set or an url must be provided");return r&&!n?this.decodeFromImageUrl(r):this.decodeFromImageElement(n)}decodeFromVideo(n,r){if(!n&&!r)throw new _("Either an element with a src set or an URL must be provided");return r&&!n?this.decodeFromVideoUrl(r):this.decodeFromVideoElement(n)}decodeFromVideoContinuously(n,r,s){if(n===void 0&&r===void 0)throw new _("Either an element with a src set or an URL must be provided");return r&&!n?this.decodeFromVideoUrlContinuously(r,s):this.decodeFromVideoElementContinuously(n,s)}decodeFromImageElement(n){if(!n)throw new _("An image element must be provided.");this.reset();const r=this.prepareImageElement(n);this.imageElement=r;let s;return this.isImageLoaded(r)?s=this.decodeOnce(r,!1,!0):s=this._decodeOnLoadImage(r),s}decodeFromVideoElement(n){const r=this._decodeFromVideoElementSetup(n);return this._decodeOnLoadVideo(r)}decodeFromVideoElementContinuously(n,r){const s=this._decodeFromVideoElementSetup(n);return this._decodeOnLoadVideoContinuously(s,r)}_decodeFromVideoElementSetup(n){if(!n)throw new _("A video element must be provided.");this.reset();const r=this.prepareVideoElement(n);return this.videoElement=r,r}decodeFromImageUrl(n){if(!n)throw new _("An URL must be provided.");this.reset();const r=this.prepareImageElement();this.imageElement=r;const s=this._decodeOnLoadImage(r);return r.src=n,s}decodeFromVideoUrl(n){if(!n)throw new _("An URL must be provided.");this.reset();const r=this.prepareVideoElement(),s=this.decodeFromVideoElement(r);return r.src=n,s}decodeFromVideoUrlContinuously(n,r){if(!n)throw new _("An URL must be provided.");this.reset();const s=this.prepareVideoElement(),o=this.decodeFromVideoElementContinuously(s,r);return s.src=n,o}_decodeOnLoadImage(n){return new Promise((r,s)=>{this.imageLoadedListener=()=>this.decodeOnce(n,!1,!0).then(r,s),n.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(n){return Ie(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(n),yield this.decodeOnce(n)})}_decodeOnLoadVideoContinuously(n,r){return Ie(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(n),this.decodeContinuously(n,r)})}isImageLoaded(n){return!(!n.complete||n.naturalWidth===0)}prepareImageElement(n){let r;return typeof n>"u"&&(r=document.createElement("img"),r.width=200,r.height=200),typeof n=="string"&&(r=this.getMediaElement(n,"img")),n instanceof HTMLImageElement&&(r=n),r}prepareVideoElement(n){let r;return!n&&typeof document<"u"&&(r=document.createElement("video"),r.width=200,r.height=200),typeof n=="string"&&(r=this.getMediaElement(n,"video")),n instanceof HTMLVideoElement&&(r=n),r.setAttribute("autoplay","true"),r.setAttribute("muted","true"),r.setAttribute("playsinline","true"),r}decodeOnce(n,r=!0,s=!0){this._stopAsyncDecode=!1;const o=(a,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(n);a(d)}catch(d){const h=r&&d instanceof H,x=(d instanceof M||d instanceof k)&&s;if(h||x)return setTimeout(o,this._timeBetweenDecodingAttempts,a,u);u(d)}};return new Promise((a,u)=>o(a,u))}decodeContinuously(n,r){this._stopContinuousDecode=!1;const s=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const o=this.decode(n);r(o,null),setTimeout(s,this.timeBetweenScansMillis)}catch(o){r(null,o);const a=o instanceof M||o instanceof k,u=o instanceof H;(a||u)&&setTimeout(s,this._timeBetweenDecodingAttempts)}};s()}decode(n){const r=this.createBinaryBitmap(n);return this.decodeBitmap(r)}_isHTMLVideoElement(n){return n.videoWidth!==0}drawFrameOnCanvas(n,r,s){r||(r={sx:0,sy:0,sWidth:n.videoWidth,sHeight:n.videoHeight,dx:0,dy:0,dWidth:n.videoWidth,dHeight:n.videoHeight}),s||(s=this.captureCanvasContext),s.drawImage(n,r.sx,r.sy,r.sWidth,r.sHeight,r.dx,r.dy,r.dWidth,r.dHeight)}drawImageOnCanvas(n,r,s=this.captureCanvasContext){r||(r={sx:0,sy:0,sWidth:n.naturalWidth,sHeight:n.naturalHeight,dx:0,dy:0,dWidth:n.naturalWidth,dHeight:n.naturalHeight}),s||(s=this.captureCanvasContext),s.drawImage(n,r.sx,r.sy,r.sWidth,r.sHeight,r.dx,r.dy,r.dWidth,r.dHeight)}createBinaryBitmap(n){this.getCaptureCanvasContext(n),this._isHTMLVideoElement(n)?this.drawFrameOnCanvas(n):this.drawImageOnCanvas(n);const r=this.getCaptureCanvas(n),s=new pe(r),o=new xe(s);return new R(o)}getCaptureCanvasContext(n){if(!this.captureCanvasContext){const s=this.getCaptureCanvas(n).getContext("2d");this.captureCanvasContext=s}return this.captureCanvasContext}getCaptureCanvas(n){if(!this.captureCanvas){const r=this.createCaptureCanvas(n);this.captureCanvas=r}return this.captureCanvas}decodeBitmap(n){return this.reader.decode(n,this._hints)}createCaptureCanvas(n){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const r=document.createElement("canvas");let s,o;return typeof n<"u"&&(n instanceof HTMLVideoElement?(s=n.videoWidth,o=n.videoHeight):n instanceof HTMLImageElement&&(s=n.naturalWidth||n.width,o=n.naturalHeight||n.height)),r.style.width=s+"px",r.style.height=o+"px",r.width=s,r.height=o,r}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(n=>n.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(n,r){try{n.srcObject=r}catch{n.src=URL.createObjectURL(r)}}cleanVideoSource(n){try{n.srcObject=null}catch{n.src=""}this.videoElement.removeAttribute("src")}}class Ke{constructor(n,r,s=r==null?0:8*r.length,o,a,u=B.currentTimeMillis()){this.text=n,this.rawBytes=r,this.numBits=s,this.resultPoints=o,this.format=a,this.timestamp=u,this.text=n,this.rawBytes=r,s==null?this.numBits=r==null?0:8*r.length:this.numBits=s,this.resultPoints=o,this.format=a,this.resultMetadata=null,u==null?this.timestamp=B.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(n,r){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(n,r)}putAllMetadata(n){n!==null&&(this.resultMetadata===null?this.resultMetadata=n:this.resultMetadata=new Map(n))}addResultPoints(n){const r=this.resultPoints;if(r===null)this.resultPoints=n;else if(n!==null&&n.length>0){const s=new Array(r.length+n.length);B.arraycopy(r,0,s,0,r.length),B.arraycopy(n,0,s,r.length,n.length),this.resultPoints=s}}getTimestamp(){return this.timestamp}toString(){return this.text}}var kr;(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"})(kr||(kr={}));var le=kr,ir;(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"})(ir||(ir={}));var wt=ir;class Qi{constructor(n,r,s,o,a=-1,u=-1){this.rawBytes=n,this.text=r,this.byteSegments=s,this.ecLevel=o,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=u,this.numBits=n==null?0:8*n.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(n){this.numBits=n}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(n){this.errorsCorrected=n}getErasures(){return this.erasures}setErasures(n){this.erasures=n}getOther(){return this.other}setOther(n){this.other=n}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class qi{exp(n){return this.expTable[n]}log(n){if(n===0)throw new v;return this.logTable[n]}static addOrSubtract(n,r){return n^r}}class jt{constructor(n,r){if(r.length===0)throw new v;this.field=n;const s=r.length;if(s>1&&r[0]===0){let o=1;for(;o<s&&r[o]===0;)o++;o===s?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(s-o),B.arraycopy(r,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=r}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(n){return this.coefficients[this.coefficients.length-1-n]}evaluateAt(n){if(n===0)return this.getCoefficient(0);const r=this.coefficients;let s;if(n===1){s=0;for(let u=0,d=r.length;u!==d;u++){const h=r[u];s=qi.addOrSubtract(s,h)}return s}s=r[0];const o=r.length,a=this.field;for(let u=1;u<o;u++)s=qi.addOrSubtract(a.multiply(n,s),r[u]);return s}addOrSubtract(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(this.isZero())return n;if(n.isZero())return this;let r=this.coefficients,s=n.coefficients;if(r.length>s.length){const u=r;r=s,s=u}let o=new Int32Array(s.length);const a=s.length-r.length;B.arraycopy(s,0,o,0,a);for(let u=a;u<s.length;u++)o[u]=qi.addOrSubtract(r[u-a],s[u]);return new jt(this.field,o)}multiply(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(this.isZero()||n.isZero())return this.field.getZero();const r=this.coefficients,s=r.length,o=n.coefficients,a=o.length,u=new Int32Array(s+a-1),d=this.field;for(let h=0;h<s;h++){const g=r[h];for(let x=0;x<a;x++)u[h+x]=qi.addOrSubtract(u[h+x],d.multiply(g,o[x]))}return new jt(d,u)}multiplyScalar(n){if(n===0)return this.field.getZero();if(n===1)return this;const r=this.coefficients.length,s=this.field,o=new Int32Array(r),a=this.coefficients;for(let u=0;u<r;u++)o[u]=s.multiply(a[u],n);return new jt(s,o)}multiplyByMonomial(n,r){if(n<0)throw new v;if(r===0)return this.field.getZero();const s=this.coefficients,o=s.length,a=new Int32Array(o+n),u=this.field;for(let d=0;d<o;d++)a[d]=u.multiply(s[d],r);return new jt(u,a)}divide(n){if(!this.field.equals(n.field))throw new v("GenericGFPolys do not have same GenericGF field");if(n.isZero())throw new v("Divide by 0");const r=this.field;let s=r.getZero(),o=this;const a=n.getCoefficient(n.getDegree()),u=r.inverse(a);for(;o.getDegree()>=n.getDegree()&&!o.isZero();){const d=o.getDegree()-n.getDegree(),h=r.multiply(o.getCoefficient(o.getDegree()),u),g=n.multiplyByMonomial(d,h),x=r.buildMonomial(d,h);s=s.addOrSubtract(x),o=o.addOrSubtract(g)}return[s,o]}toString(){let n="";for(let r=this.getDegree();r>=0;r--){let s=this.getCoefficient(r);if(s!==0){if(s<0?(n+=" - ",s=-s):n.length>0&&(n+=" + "),r===0||s!==1){const o=this.field.log(s);o===0?n+="1":o===1?n+="a":(n+="a^",n+=o)}r!==0&&(r===1?n+="x":(n+="x^",n+=r))}}return n}}class io extends m{}io.kind="ArithmeticException";class be extends qi{constructor(n,r,s){super(),this.primitive=n,this.size=r,this.generatorBase=s;const o=new Int32Array(r);let a=1;for(let d=0;d<r;d++)o[d]=a,a*=2,a>=r&&(a^=n,a&=r-1);this.expTable=o;const u=new Int32Array(r);for(let d=0;d<r-1;d++)u[o[d]]=d;this.logTable=u,this.zero=new jt(this,Int32Array.from([0])),this.one=new jt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(n,r){if(n<0)throw new v;if(r===0)return this.zero;const s=new Int32Array(n+1);return s[0]=r,new jt(this,s)}inverse(n){if(n===0)throw new io;return this.expTable[this.size-this.logTable[n]-1]}multiply(n,r){return n===0||r===0?0:this.expTable[(this.logTable[n]+this.logTable[r])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+N.toHexString(this.primitive)+","+this.size+")"}equals(n){return n===this}}be.AZTEC_DATA_12=new be(4201,4096,1),be.AZTEC_DATA_10=new be(1033,1024,1),be.AZTEC_DATA_6=new be(67,64,1),be.AZTEC_PARAM=new be(19,16,1),be.QR_CODE_FIELD_256=new be(285,256,0),be.DATA_MATRIX_FIELD_256=new be(301,256,1),be.AZTEC_DATA_8=be.DATA_MATRIX_FIELD_256,be.MAXICODE_FIELD_64=be.AZTEC_DATA_6;class ri extends m{}ri.kind="ReedSolomonException";class Dn extends m{}Dn.kind="IllegalStateException";class $i{constructor(n){this.field=n}decode(n,r){const s=this.field,o=new jt(s,n),a=new Int32Array(r);let u=!0;for(let I=0;I<r;I++){const b=o.evaluateAt(s.exp(I+s.getGeneratorBase()));a[a.length-1-I]=b,b!==0&&(u=!1)}if(u)return;const d=new jt(s,a),h=this.runEuclideanAlgorithm(s.buildMonomial(r,1),d,r),g=h[0],x=h[1],E=this.findErrorLocations(g),A=this.findErrorMagnitudes(x,E);for(let I=0;I<E.length;I++){const b=n.length-1-s.log(E[I]);if(b<0)throw new ri("Bad error location");n[b]=be.addOrSubtract(n[b],A[I])}}runEuclideanAlgorithm(n,r,s){if(n.getDegree()<r.getDegree()){const I=n;n=r,r=I}const o=this.field;let a=n,u=r,d=o.getZero(),h=o.getOne();for(;u.getDegree()>=(s/2|0);){let I=a,b=d;if(a=u,d=h,a.isZero())throw new ri("r_{i-1} was zero");u=I;let D=o.getZero();const L=a.getCoefficient(a.getDegree()),z=o.inverse(L);for(;u.getDegree()>=a.getDegree()&&!u.isZero();){const q=u.getDegree()-a.getDegree(),$=o.multiply(u.getCoefficient(u.getDegree()),z);D=D.addOrSubtract(o.buildMonomial(q,$)),u=u.addOrSubtract(a.multiplyByMonomial(q,$))}if(h=D.multiply(d).addOrSubtract(b),u.getDegree()>=a.getDegree())throw new Dn("Division algorithm failed to reduce polynomial?")}const g=h.getCoefficient(0);if(g===0)throw new ri("sigmaTilde(0) was zero");const x=o.inverse(g),E=h.multiplyScalar(x),A=u.multiplyScalar(x);return[E,A]}findErrorLocations(n){const r=n.getDegree();if(r===1)return Int32Array.from([n.getCoefficient(1)]);const s=new Int32Array(r);let o=0;const a=this.field;for(let u=1;u<a.getSize()&&o<r;u++)n.evaluateAt(u)===0&&(s[o]=a.inverse(u),o++);if(o!==r)throw new ri("Error locator degree does not match number of roots");return s}findErrorMagnitudes(n,r){const s=r.length,o=new Int32Array(s),a=this.field;for(let u=0;u<s;u++){const d=a.inverse(r[u]);let h=1;for(let g=0;g<s;g++)if(u!==g){const x=a.multiply(r[g],d),E=x&1?x&-2:x|1;h=a.multiply(h,E)}o[u]=a.multiply(n.evaluateAt(d),a.inverse(h)),a.getGeneratorBase()!==0&&(o[u]=a.multiply(o[u],d))}return o}}var vt;(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"})(vt||(vt={}));class Ue{decode(n){this.ddata=n;let r=n.getBits(),s=this.extractBits(r),o=this.correctBits(s),a=Ue.convertBoolArrayToByteArray(o),u=Ue.getEncodedData(o),d=new Qi(a,u,null,null);return d.setNumBits(o.length),d}static highLevelDecode(n){return this.getEncodedData(n)}static getEncodedData(n){let r=n.length,s=vt.UPPER,o=vt.UPPER,a="",u=0;for(;u<r;)if(o===vt.BINARY){if(r-u<5)break;let d=Ue.readCode(n,u,5);if(u+=5,d===0){if(r-u<11)break;d=Ue.readCode(n,u,11)+31,u+=11}for(let h=0;h<d;h++){if(r-u<8){u=r;break}const g=Ue.readCode(n,u,8);a+=se.castAsNonUtf8Char(g),u+=8}o=s}else{let d=o===vt.DIGIT?4:5;if(r-u<d)break;let h=Ue.readCode(n,u,d);u+=d;let g=Ue.getCharacter(o,h);g.startsWith("CTRL_")?(s=o,o=Ue.getTable(g.charAt(5)),g.charAt(6)==="L"&&(s=o)):(a+=g,o=s)}return a}static getTable(n){switch(n){case"L":return vt.LOWER;case"P":return vt.PUNCT;case"M":return vt.MIXED;case"D":return vt.DIGIT;case"B":return vt.BINARY;case"U":default:return vt.UPPER}}static getCharacter(n,r){switch(n){case vt.UPPER:return Ue.UPPER_TABLE[r];case vt.LOWER:return Ue.LOWER_TABLE[r];case vt.MIXED:return Ue.MIXED_TABLE[r];case vt.PUNCT:return Ue.PUNCT_TABLE[r];case vt.DIGIT:return Ue.DIGIT_TABLE[r];default:throw new Dn("Bad table")}}correctBits(n){let r,s;this.ddata.getNbLayers()<=2?(s=6,r=be.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(s=8,r=be.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(s=10,r=be.AZTEC_DATA_10):(s=12,r=be.AZTEC_DATA_12);let o=this.ddata.getNbDatablocks(),a=n.length/s;if(a<o)throw new k;let u=n.length%s,d=new Int32Array(a);for(let A=0;A<a;A++,u+=s)d[A]=Ue.readCode(n,u,s);try{new $i(r).decode(d,a-o)}catch(A){throw new k(A)}let h=(1<<s)-1,g=0;for(let A=0;A<o;A++){let I=d[A];if(I===0||I===h)throw new k;(I===1||I===h-1)&&g++}let x=new Array(o*s-g),E=0;for(let A=0;A<o;A++){let I=d[A];if(I===1||I===h-1)x.fill(I>1,E,E+s-1),E+=s-1;else for(let b=s-1;b>=0;--b)x[E++]=(I&1<<b)!==0}return x}extractBits(n){let r=this.ddata.isCompact(),s=this.ddata.getNbLayers(),o=(r?11:14)+s*4,a=new Int32Array(o),u=new Array(this.totalBitsInLayer(s,r));if(r)for(let d=0;d<a.length;d++)a[d]=d;else{let d=o+1+2*N.truncDivision(N.truncDivision(o,2)-1,15),h=o/2,g=N.truncDivision(d,2);for(let x=0;x<h;x++){let E=x+N.truncDivision(x,15);a[h-x-1]=g-E-1,a[h+x]=g+E+1}}for(let d=0,h=0;d<s;d++){let g=(s-d)*4+(r?9:12),x=d*2,E=o-1-x;for(let A=0;A<g;A++){let I=A*2;for(let b=0;b<2;b++)u[h+I+b]=n.get(a[x+b],a[x+A]),u[h+2*g+I+b]=n.get(a[x+A],a[E-b]),u[h+4*g+I+b]=n.get(a[E-b],a[E-A]),u[h+6*g+I+b]=n.get(a[E-A],a[x+b])}h+=g*8}return u}static readCode(n,r,s){let o=0;for(let a=r;a<r+s;a++)o<<=1,n[a]&&(o|=1);return o}static readByte(n,r){let s=n.length-r;return s>=8?Ue.readCode(n,r,8):Ue.readCode(n,r,s)<<8-s}static convertBoolArrayToByteArray(n){let r=new Uint8Array((n.length+7)/8);for(let s=0;s<r.length;s++)r[s]=Ue.readByte(n,8*s);return r}totalBitsInLayer(n,r){return((r?88:112)+16*n)*n}}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"," ",`
63
63
  `,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Ue.PUNCT_TABLE=["","\r",`\r
64
- `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ue.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Te{constructor(){}static round(n){return n===NaN?0:n<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:n>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n+(n<0?-.5:.5)|0}static distance(n,r,s,o){const a=n-s,u=r-o;return Math.sqrt(a*a+u*u)}static sum(n){let r=0;for(let s=0,o=n.length;s!==o;s++){const a=n[s];r+=a}return r}}class so{static floatToIntBits(n){return n}}so.MAX_VALUE=Number.MAX_SAFE_INTEGER;class oe{constructor(n,r){this.x=n,this.y=r}getX(){return this.x}getY(){return this.y}equals(n){if(n instanceof oe){const r=n;return this.x===r.x&&this.y===r.y}return!1}hashCode(){return 31*so.floatToIntBits(this.x)+so.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(n){const r=this.distance(n[0],n[1]),s=this.distance(n[1],n[2]),o=this.distance(n[0],n[2]);let a,u,d;if(s>=r&&s>=o?(u=n[0],a=n[1],d=n[2]):o>=s&&o>=r?(u=n[1],a=n[0],d=n[2]):(u=n[2],a=n[0],d=n[1]),this.crossProductZ(a,u,d)<0){const h=a;a=d,d=h}n[0]=a,n[1]=u,n[2]=d}static distance(n,r){return Te.distance(n.x,n.y,r.x,r.y)}static crossProductZ(n,r,s){const o=r.x,a=r.y;return(s.x-o)*(n.y-a)-(s.y-a)*(n.x-o)}}class oo{constructor(n,r){this.bits=n,this.points=r}getBits(){return this.bits}getPoints(){return this.points}}class Kc extends oo{constructor(n,r,s,o,a){super(n,r),this.compact=s,this.nbDatablocks=o,this.nbLayers=a}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Gn{constructor(n,r,s,o){this.image=n,this.height=n.getHeight(),this.width=n.getWidth(),r==null&&(r=Gn.INIT_SIZE),s==null&&(s=n.getWidth()/2|0),o==null&&(o=n.getHeight()/2|0);const a=r/2|0;if(this.leftInit=s-a,this.rightInit=s+a,this.upInit=o-a,this.downInit=o+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new j}detect(){let n=this.leftInit,r=this.rightInit,s=this.upInit,o=this.downInit,a=!1,u=!0,d=!1,h=!1,g=!1,x=!1,E=!1;const A=this.width,I=this.height;for(;u;){u=!1;let b=!0;for(;(b||!h)&&r<A;)b=this.containsBlackPoint(s,o,r,!1),b?(r++,u=!0,h=!0):h||r++;if(r>=A){a=!0;break}let D=!0;for(;(D||!g)&&o<I;)D=this.containsBlackPoint(n,r,o,!0),D?(o++,u=!0,g=!0):g||o++;if(o>=I){a=!0;break}let L=!0;for(;(L||!x)&&n>=0;)L=this.containsBlackPoint(s,o,n,!1),L?(n--,u=!0,x=!0):x||n--;if(n<0){a=!0;break}let z=!0;for(;(z||!E)&&s>=0;)z=this.containsBlackPoint(n,r,s,!0),z?(s--,u=!0,E=!0):E||s--;if(s<0){a=!0;break}u&&(d=!0)}if(!a&&d){const b=r-n;let D=null;for(let $=1;D===null&&$<b;$++)D=this.getBlackPointOnSegment(n,o-$,n+$,o);if(D==null)throw new j;let L=null;for(let $=1;L===null&&$<b;$++)L=this.getBlackPointOnSegment(n,s+$,n+$,s);if(L==null)throw new j;let z=null;for(let $=1;z===null&&$<b;$++)z=this.getBlackPointOnSegment(r,s+$,r-$,s);if(z==null)throw new j;let q=null;for(let $=1;q===null&&$<b;$++)q=this.getBlackPointOnSegment(r,o-$,r-$,o);if(q==null)throw new j;return this.centerEdges(q,D,z,L)}else throw new j}getBlackPointOnSegment(n,r,s,o){const a=Te.round(Te.distance(n,r,s,o)),u=(s-n)/a,d=(o-r)/a,h=this.image;for(let g=0;g<a;g++){const x=Te.round(n+g*u),E=Te.round(r+g*d);if(h.get(x,E))return new oe(x,E)}return null}centerEdges(n,r,s,o){const a=n.getX(),u=n.getY(),d=r.getX(),h=r.getY(),g=s.getX(),x=s.getY(),E=o.getX(),A=o.getY(),I=Gn.CORR;return a<this.width/2?[new oe(E-I,A+I),new oe(d+I,h+I),new oe(g-I,x-I),new oe(a+I,u-I)]:[new oe(E+I,A+I),new oe(d+I,h-I),new oe(g-I,x+I),new oe(a-I,u-I)]}containsBlackPoint(n,r,s,o){const a=this.image;if(o){for(let u=n;u<=r;u++)if(a.get(u,s))return!0}else for(let u=n;u<=r;u++)if(a.get(s,u))return!0;return!1}}Gn.INIT_SIZE=10,Gn.CORR=1;class Ha{static checkAndNudgePoints(n,r){const s=n.getWidth(),o=n.getHeight();let a=!0;for(let u=0;u<r.length&&a;u+=2){const d=Math.floor(r[u]),h=Math.floor(r[u+1]);if(d<-1||d>s||h<-1||h>o)throw new j;a=!1,d===-1?(r[u]=0,a=!0):d===s&&(r[u]=s-1,a=!0),h===-1?(r[u+1]=0,a=!0):h===o&&(r[u+1]=o-1,a=!0)}a=!0;for(let u=r.length-2;u>=0&&a;u-=2){const d=Math.floor(r[u]),h=Math.floor(r[u+1]);if(d<-1||d>s||h<-1||h>o)throw new j;a=!1,d===-1?(r[u]=0,a=!0):d===s&&(r[u]=s-1,a=!0),h===-1?(r[u+1]=0,a=!0):h===o&&(r[u+1]=o-1,a=!0)}}}class Cn{constructor(n,r,s,o,a,u,d,h,g){this.a11=n,this.a21=r,this.a31=s,this.a12=o,this.a22=a,this.a32=u,this.a13=d,this.a23=h,this.a33=g}static quadrilateralToQuadrilateral(n,r,s,o,a,u,d,h,g,x,E,A,I,b,D,L){const z=Cn.quadrilateralToSquare(n,r,s,o,a,u,d,h);return Cn.squareToQuadrilateral(g,x,E,A,I,b,D,L).times(z)}transformPoints(n){const r=n.length,s=this.a11,o=this.a12,a=this.a13,u=this.a21,d=this.a22,h=this.a23,g=this.a31,x=this.a32,E=this.a33;for(let A=0;A<r;A+=2){const I=n[A],b=n[A+1],D=a*I+h*b+E;n[A]=(s*I+u*b+g)/D,n[A+1]=(o*I+d*b+x)/D}}transformPointsWithValues(n,r){const s=this.a11,o=this.a12,a=this.a13,u=this.a21,d=this.a22,h=this.a23,g=this.a31,x=this.a32,E=this.a33,A=n.length;for(let I=0;I<A;I++){const b=n[I],D=r[I],L=a*b+h*D+E;n[I]=(s*b+u*D+g)/L,r[I]=(o*b+d*D+x)/L}}static squareToQuadrilateral(n,r,s,o,a,u,d,h){const g=n-s+a-d,x=r-o+u-h;if(g===0&&x===0)return new Cn(s-n,a-s,n,o-r,u-o,r,0,0,1);{const E=s-a,A=d-a,I=o-u,b=h-u,D=E*b-A*I,L=(g*b-A*x)/D,z=(E*x-g*I)/D;return new Cn(s-n+L*s,d-n+z*d,n,o-r+L*o,h-r+z*h,r,L,z,1)}}static quadrilateralToSquare(n,r,s,o,a,u,d,h){return Cn.squareToQuadrilateral(n,r,s,o,a,u,d,h).buildAdjoint()}buildAdjoint(){return new Cn(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(n){return new Cn(this.a11*n.a11+this.a21*n.a12+this.a31*n.a13,this.a11*n.a21+this.a21*n.a22+this.a31*n.a23,this.a11*n.a31+this.a21*n.a32+this.a31*n.a33,this.a12*n.a11+this.a22*n.a12+this.a32*n.a13,this.a12*n.a21+this.a22*n.a22+this.a32*n.a23,this.a12*n.a31+this.a22*n.a32+this.a32*n.a33,this.a13*n.a11+this.a23*n.a12+this.a33*n.a13,this.a13*n.a21+this.a23*n.a22+this.a33*n.a23,this.a13*n.a31+this.a23*n.a32+this.a33*n.a33)}}class Qc extends Ha{sampleGrid(n,r,s,o,a,u,d,h,g,x,E,A,I,b,D,L,z,q,$){const Z=Cn.quadrilateralToQuadrilateral(o,a,u,d,h,g,x,E,A,I,b,D,L,z,q,$);return this.sampleGridWithTransform(n,r,s,Z)}sampleGridWithTransform(n,r,s,o){if(r<=0||s<=0)throw new j;const a=new _e(r,s),u=new Float32Array(2*r);for(let d=0;d<s;d++){const h=u.length,g=d+.5;for(let x=0;x<h;x+=2)u[x]=x/2+.5,u[x+1]=g;o.transformPoints(u),Ha.checkAndNudgePoints(n,u);try{for(let x=0;x<h;x+=2)n.get(Math.floor(u[x]),Math.floor(u[x+1]))&&a.set(x/2,d)}catch{throw new j}}return a}}class sr{static setGridSampler(n){sr.gridSampler=n}static getInstance(){return sr.gridSampler}}sr.gridSampler=new Qc;class Lt{constructor(n,r){this.x=n,this.y=r}toResultPoint(){return new oe(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class qc{constructor(n){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=n}detect(){return this.detectMirror(!1)}detectMirror(n){let r=this.getMatrixCenter(),s=this.getBullsEyeCorners(r);if(n){let u=s[0];s[0]=s[2],s[2]=u}this.extractParameters(s);let o=this.sampleGrid(this.image,s[this.shift%4],s[(this.shift+1)%4],s[(this.shift+2)%4],s[(this.shift+3)%4]),a=this.getMatrixCornerPoints(s);return new Kc(o,a,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(n){if(!this.isValidPoint(n[0])||!this.isValidPoint(n[1])||!this.isValidPoint(n[2])||!this.isValidPoint(n[3]))throw new j;let r=2*this.nbCenterLayers,s=new Int32Array([this.sampleLine(n[0],n[1],r),this.sampleLine(n[1],n[2],r),this.sampleLine(n[2],n[3],r),this.sampleLine(n[3],n[0],r)]);this.shift=this.getRotation(s,r);let o=0;for(let u=0;u<4;u++){let d=s[(this.shift+u)%4];this.compact?(o<<=7,o+=d>>1&127):(o<<=10,o+=(d>>2&992)+(d>>1&31))}let a=this.getCorrectedParameterData(o,this.compact);this.compact?(this.nbLayers=(a>>6)+1,this.nbDataBlocks=(a&63)+1):(this.nbLayers=(a>>11)+1,this.nbDataBlocks=(a&2047)+1)}getRotation(n,r){let s=0;n.forEach((o,a,u)=>{let d=(o>>r-2<<1)+(o&1);s=(s<<3)+d}),s=((s&1)<<11)+(s>>1);for(let o=0;o<4;o++)if(N.bitCount(s^this.EXPECTED_CORNER_BITS[o])<=2)return o;throw new j}getCorrectedParameterData(n,r){let s,o;r?(s=7,o=2):(s=10,o=4);let a=s-o,u=new Int32Array(s);for(let h=s-1;h>=0;--h)u[h]=n&15,n>>=4;try{new $i(be.AZTEC_PARAM).decode(u,a)}catch{throw new j}let d=0;for(let h=0;h<o;h++)d=(d<<4)+u[h];return d}getBullsEyeCorners(n){let r=n,s=n,o=n,a=n,u=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(r,u,1,-1),A=this.getFirstDifferent(s,u,1,1),I=this.getFirstDifferent(o,u,-1,1),b=this.getFirstDifferent(a,u,-1,-1);if(this.nbCenterLayers>2){let D=this.distancePoint(b,E)*this.nbCenterLayers/(this.distancePoint(a,r)*(this.nbCenterLayers+2));if(D<.75||D>1.25||!this.isWhiteOrBlackRectangle(E,A,I,b))break}r=E,s=A,o=I,a=b,u=!u}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new j;this.compact=this.nbCenterLayers===5;let d=new oe(r.getX()+.5,r.getY()-.5),h=new oe(s.getX()+.5,s.getY()+.5),g=new oe(o.getX()-.5,o.getY()+.5),x=new oe(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,h,g,x],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let n,r,s,o;try{let d=new Gn(this.image).detect();n=d[0],r=d[1],s=d[2],o=d[3]}catch{let h=this.image.getWidth()/2,g=this.image.getHeight()/2;n=this.getFirstDifferent(new Lt(h+7,g-7),!1,1,-1).toResultPoint(),r=this.getFirstDifferent(new Lt(h+7,g+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(h-7,g+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Lt(h-7,g-7),!1,-1,-1).toResultPoint()}let a=Te.round((n.getX()+o.getX()+r.getX()+s.getX())/4),u=Te.round((n.getY()+o.getY()+r.getY()+s.getY())/4);try{let d=new Gn(this.image,15,a,u).detect();n=d[0],r=d[1],s=d[2],o=d[3]}catch{n=this.getFirstDifferent(new Lt(a+7,u-7),!1,1,-1).toResultPoint(),r=this.getFirstDifferent(new Lt(a+7,u+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(a-7,u+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Lt(a-7,u-7),!1,-1,-1).toResultPoint()}return a=Te.round((n.getX()+o.getX()+r.getX()+s.getX())/4),u=Te.round((n.getY()+o.getY()+r.getY()+s.getY())/4),new Lt(a,u)}getMatrixCornerPoints(n){return this.expandSquare(n,2*this.nbCenterLayers,this.getDimension())}sampleGrid(n,r,s,o,a){let u=sr.getInstance(),d=this.getDimension(),h=d/2-this.nbCenterLayers,g=d/2+this.nbCenterLayers;return u.sampleGrid(n,d,d,h,h,g,h,g,g,h,g,r.getX(),r.getY(),s.getX(),s.getY(),o.getX(),o.getY(),a.getX(),a.getY())}sampleLine(n,r,s){let o=0,a=this.distanceResultPoint(n,r),u=a/s,d=n.getX(),h=n.getY(),g=u*(r.getX()-n.getX())/a,x=u*(r.getY()-n.getY())/a;for(let E=0;E<s;E++)this.image.get(Te.round(d+E*g),Te.round(h+E*x))&&(o|=1<<s-E-1);return o}isWhiteOrBlackRectangle(n,r,s,o){let a=3;n=new Lt(n.getX()-a,n.getY()+a),r=new Lt(r.getX()-a,r.getY()-a),s=new Lt(s.getX()+a,s.getY()-a),o=new Lt(o.getX()+a,o.getY()+a);let u=this.getColor(o,n);if(u===0)return!1;let d=this.getColor(n,r);return d!==u||(d=this.getColor(r,s),d!==u)?!1:(d=this.getColor(s,o),d===u)}getColor(n,r){let s=this.distancePoint(n,r),o=(r.getX()-n.getX())/s,a=(r.getY()-n.getY())/s,u=0,d=n.getX(),h=n.getY(),g=this.image.get(n.getX(),n.getY()),x=Math.ceil(s);for(let A=0;A<x;A++)d+=o,h+=a,this.image.get(Te.round(d),Te.round(h))!==g&&u++;let E=u/s;return E>.1&&E<.9?0:E<=.1===g?1:-1}getFirstDifferent(n,r,s,o){let a=n.getX()+s,u=n.getY()+o;for(;this.isValid(a,u)&&this.image.get(a,u)===r;)a+=s,u+=o;for(a-=s,u-=o;this.isValid(a,u)&&this.image.get(a,u)===r;)a+=s;for(a-=s;this.isValid(a,u)&&this.image.get(a,u)===r;)u+=o;return u-=o,new Lt(a,u)}expandSquare(n,r,s){let o=s/(2*r),a=n[0].getX()-n[2].getX(),u=n[0].getY()-n[2].getY(),d=(n[0].getX()+n[2].getX())/2,h=(n[0].getY()+n[2].getY())/2,g=new oe(d+o*a,h+o*u),x=new oe(d-o*a,h-o*u);a=n[1].getX()-n[3].getX(),u=n[1].getY()-n[3].getY(),d=(n[1].getX()+n[3].getX())/2,h=(n[1].getY()+n[3].getY())/2;let E=new oe(d+o*a,h+o*u),A=new oe(d-o*a,h-o*u);return[g,E,x,A]}isValid(n,r){return n>=0&&n<this.image.getWidth()&&r>0&&r<this.image.getHeight()}isValidPoint(n){let r=Te.round(n.getX()),s=Te.round(n.getY());return this.isValid(r,s)}distancePoint(n,r){return Te.distance(n.getX(),n.getY(),r.getX(),r.getY())}distanceResultPoint(n,r){return Te.distance(n.getX(),n.getY(),r.getX(),r.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(N.truncDivision(this.nbLayers-4,8)+1)+15}}class ao{decode(n,r=null){let s=null,o=new qc(n.getBlackMatrix()),a=null,u=null;try{let x=o.detectMirror(!1);a=x.getPoints(),this.reportFoundResultPoints(r,a),u=new Ue().decode(x)}catch(x){s=x}if(u==null)try{let x=o.detectMirror(!0);a=x.getPoints(),this.reportFoundResultPoints(r,a),u=new Ue().decode(x)}catch(x){throw s??x}let d=new Ke(u.getText(),u.getRawBytes(),u.getNumBits(),a,le.AZTEC,B.currentTimeMillis()),h=u.getByteSegments();h!=null&&d.putMetadata(mt.BYTE_SEGMENTS,h);let g=u.getECLevel();return g!=null&&d.putMetadata(mt.ERROR_CORRECTION_LEVEL,g),d}reportFoundResultPoints(n,r){if(n!=null){let s=n.get(U.NEED_RESULT_POINT_CALLBACK);s!=null&&r.forEach((o,a,u)=>{s.foundPossibleResultPoint(o)})}}reset(){}}class Rh extends cn{constructor(n=500){super(new ao,n)}}class ut{decode(n,r){try{return this.doDecode(n,r)}catch{if(r&&r.get(U.TRY_HARDER)===!0&&n.isRotateSupported()){const a=n.rotateCounterClockwise(),u=this.doDecode(a,r),d=u.getResultMetadata();let h=270;d!==null&&d.get(mt.ORIENTATION)===!0&&(h=h+d.get(mt.ORIENTATION)%360),u.putMetadata(mt.ORIENTATION,h);const g=u.getResultPoints();if(g!==null){const x=a.getHeight();for(let E=0;E<g.length;E++)g[E]=new oe(x-g[E].getY()-1,g[E].getX())}return u}else throw new j}}reset(){}doDecode(n,r){const s=n.getWidth(),o=n.getHeight();let a=new G(s);const u=r&&r.get(U.TRY_HARDER)===!0,d=Math.max(1,o>>(u?8:5));let h;u?h=o:h=15;const g=Math.trunc(o/2);for(let x=0;x<h;x++){const E=Math.trunc((x+1)/2),A=(x&1)===0,I=g+d*(A?E:-E);if(I<0||I>=o)break;try{a=n.getBlackRow(I,a)}catch{continue}for(let b=0;b<2;b++){if(b===1&&(a.reverse(),r&&r.get(U.NEED_RESULT_POINT_CALLBACK)===!0)){const D=new Map;r.forEach((L,z)=>D.set(z,L)),D.delete(U.NEED_RESULT_POINT_CALLBACK),r=D}try{const D=this.decodeRow(I,a,r);if(b===1){D.putMetadata(mt.ORIENTATION,180);const L=D.getResultPoints();L!==null&&(L[0]=new oe(s-L[0].getX()-1,L[0].getY()),L[1]=new oe(s-L[1].getX()-1,L[1].getY()))}return D}catch{}}}throw new j}static recordPattern(n,r,s){const o=s.length;for(let g=0;g<o;g++)s[g]=0;const a=n.getSize();if(r>=a)throw new j;let u=!n.get(r),d=0,h=r;for(;h<a;){if(n.get(h)!==u)s[d]++;else{if(++d===o)break;s[d]=1,u=!u}h++}if(!(d===o||d===o-1&&h===a))throw new j}static recordPatternInReverse(n,r,s){let o=s.length,a=n.get(r);for(;r>0&&o>=0;)n.get(--r)!==a&&(o--,a=!a);if(o>=0)throw new j;ut.recordPattern(n,r+1,s)}static patternMatchVariance(n,r,s){const o=n.length;let a=0,u=0;for(let g=0;g<o;g++)a+=n[g],u+=r[g];if(a<u)return Number.POSITIVE_INFINITY;const d=a/u;s*=d;let h=0;for(let g=0;g<o;g++){const x=n[g],E=r[g]*d,A=x>E?x-E:E-x;if(A>s)return Number.POSITIVE_INFINITY;h+=A}return h/a}}class J extends ut{static findStartPattern(n){const r=n.getSize(),s=n.getNextSet(0);let o=0,a=Int32Array.from([0,0,0,0,0,0]),u=s,d=!1;const h=6;for(let g=s;g<r;g++)if(n.get(g)!==d)a[o]++;else{if(o===h-1){let x=J.MAX_AVG_VARIANCE,E=-1;for(let A=J.CODE_START_A;A<=J.CODE_START_C;A++){const I=ut.patternMatchVariance(a,J.CODE_PATTERNS[A],J.MAX_INDIVIDUAL_VARIANCE);I<x&&(x=I,E=A)}if(E>=0&&n.isRange(Math.max(0,u-(g-u)/2),u,!1))return Int32Array.from([u,g,E]);u+=a[0]+a[1],a=a.slice(2,a.length-1),a[o-1]=0,a[o]=0,o--}else o++;a[o]=1,d=!d}throw new j}static decodeCode(n,r,s){ut.recordPattern(n,s,r);let o=J.MAX_AVG_VARIANCE,a=-1;for(let u=0;u<J.CODE_PATTERNS.length;u++){const d=J.CODE_PATTERNS[u],h=this.patternMatchVariance(r,d,J.MAX_INDIVIDUAL_VARIANCE);h<o&&(o=h,a=u)}if(a>=0)return a;throw new j}decodeRow(n,r,s){const o=s&&s.get(U.ASSUME_GS1)===!0,a=J.findStartPattern(r),u=a[2];let d=0;const h=new Uint8Array(20);h[d++]=u;let g;switch(u){case J.CODE_START_A:g=J.CODE_CODE_A;break;case J.CODE_START_B:g=J.CODE_CODE_B;break;case J.CODE_START_C:g=J.CODE_CODE_C;break;default:throw new k}let x=!1,E=!1,A="",I=a[0],b=a[1];const D=Int32Array.from([0,0,0,0,0,0]);let L=0,z=0,q=u,$=0,Z=!0,ve=!1,me=!1;for(;!x;){const di=E;switch(E=!1,L=z,z=J.decodeCode(r,D,b),h[d++]=z,z!==J.CODE_STOP&&(Z=!0),z!==J.CODE_STOP&&($++,q+=$*z),I=b,b+=D.reduce((ig,sg)=>ig+sg,0),z){case J.CODE_START_A:case J.CODE_START_B:case J.CODE_START_C:throw new k}switch(g){case J.CODE_CODE_A:if(z<64)me===ve?A+=String.fromCharCode(32+z):A+=String.fromCharCode(32+z+128),me=!1;else if(z<96)me===ve?A+=String.fromCharCode(z-64):A+=String.fromCharCode(z+64),me=!1;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_A:!ve&&me?(ve=!0,me=!1):ve&&me?(ve=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,g=J.CODE_CODE_B;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:x=!0;break}break;case J.CODE_CODE_B:if(z<96)me===ve?A+=String.fromCharCode(32+z):A+=String.fromCharCode(32+z+128),me=!1;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_B:!ve&&me?(ve=!0,me=!1):ve&&me?(ve=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,g=J.CODE_CODE_A;break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:x=!0;break}break;case J.CODE_CODE_C:if(z<100)z<10&&(A+="0"),A+=z;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_STOP:x=!0;break}break}di&&(g=g===J.CODE_CODE_A?J.CODE_CODE_B:J.CODE_CODE_A)}const Yt=b-I;if(b=r.getNextUnset(b),!r.isRange(b,Math.min(r.getSize(),b+(b-I)/2),!1))throw new j;if(q-=$*L,q%103!==L)throw new M;const vn=A.length;if(vn===0)throw new j;vn>0&&Z&&(g===J.CODE_CODE_C?A=A.substring(0,vn-2):A=A.substring(0,vn-1));const Zt=(a[1]+a[0])/2,Fe=I+Yt/2,_t=h.length,tn=new Uint8Array(_t);for(let di=0;di<_t;di++)tn[di]=h[di];const fi=[new oe(Zt,n),new oe(Fe,n)];return new Ke(A,tn,0,fi,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 ft extends ut{constructor(n=!1,r=!1){super(),this.usingCheckDigit=n,this.extendedMode=r,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(n,r,s){let o=this.counters;o.fill(0),this.decodeRowResult="";let a=ft.findAsteriskPattern(r,o),u=r.getNextSet(a[1]),d=r.getSize(),h,g;do{ft.recordPattern(r,u,o);let D=ft.toNarrowWidePattern(o);if(D<0)throw new j;h=ft.patternToChar(D),this.decodeRowResult+=h,g=u;for(let L of o)u+=L;u=r.getNextSet(u)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let x=0;for(let D of o)x+=D;let E=u-g-x;if(u!==d&&E*2<x)throw new j;if(this.usingCheckDigit){let D=this.decodeRowResult.length-1,L=0;for(let z=0;z<D;z++)L+=ft.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(z));if(this.decodeRowResult.charAt(D)!==ft.ALPHABET_STRING.charAt(L%43))throw new M;this.decodeRowResult=this.decodeRowResult.substring(0,D)}if(this.decodeRowResult.length===0)throw new j;let A;this.extendedMode?A=ft.decodeExtended(this.decodeRowResult):A=this.decodeRowResult;let I=(a[1]+a[0])/2,b=g+x/2;return new Ke(A,null,0,[new oe(I,n),new oe(b,n)],le.CODE_39,new Date().getTime())}static findAsteriskPattern(n,r){let s=n.getSize(),o=n.getNextSet(0),a=0,u=o,d=!1,h=r.length;for(let g=o;g<s;g++)if(n.get(g)!==d)r[a]++;else{if(a===h-1){if(this.toNarrowWidePattern(r)===ft.ASTERISK_ENCODING&&n.isRange(Math.max(0,u-Math.floor((g-u)/2)),u,!1))return[u,g];u+=r[0]+r[1],r.copyWithin(0,2,2+a-1),r[a-1]=0,r[a]=0,a--}else a++;r[a]=1,d=!d}throw new j}static toNarrowWidePattern(n){let r=n.length,s=0,o;do{let a=2147483647;for(let h of n)h<a&&h>s&&(a=h);s=a,o=0;let u=0,d=0;for(let h=0;h<r;h++){let g=n[h];g>s&&(d|=1<<r-1-h,o++,u+=g)}if(o===3){for(let h=0;h<r&&o>0;h++){let g=n[h];if(g>s&&(o--,g*2>=u))return-1}return d}}while(o>3);return-1}static patternToChar(n){for(let r=0;r<ft.CHARACTER_ENCODINGS.length;r++)if(ft.CHARACTER_ENCODINGS[r]===n)return ft.ALPHABET_STRING.charAt(r);if(n===ft.ASTERISK_ENCODING)return"*";throw new j}static decodeExtended(n){let r=n.length,s="";for(let o=0;o<r;o++){let a=n.charAt(o);if(a==="+"||a==="$"||a==="%"||a==="/"){let u=n.charAt(o+1),d="\0";switch(a){case"+":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)+32);else throw new k;break;case"$":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)-64);else throw new k;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 k;break;case"/":if(u>="A"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)-32);else if(u==="Z")d=":";else throw new k;break}s+=d,o++}else s+=a}return s}}ft.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ft.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],ft.ASTERISK_ENCODING=148;class Be extends ut{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(n,r,s){let o=this.decodeStart(r),a=this.decodeEnd(r),u=new ge;Be.decodeMiddle(r,o[1],a[0],u);let d=u.toString(),h=null;s!=null&&(h=s.get(U.ALLOWED_LENGTHS)),h==null&&(h=Be.DEFAULT_ALLOWED_LENGTHS);let g=d.length,x=!1,E=0;for(let b of h){if(g===b){x=!0;break}b>E&&(E=b)}if(!x&&g>E&&(x=!0),!x)throw new k;const A=[new oe(o[1],n),new oe(a[0],n)];return new Ke(d,null,0,A,le.ITF,new Date().getTime())}static decodeMiddle(n,r,s,o){let a=new Int32Array(10),u=new Int32Array(5),d=new Int32Array(5);for(a.fill(0),u.fill(0),d.fill(0);r<s;){ut.recordPattern(n,r,a);for(let g=0;g<5;g++){let x=2*g;u[g]=a[x],d[g]=a[x+1]}let h=Be.decodeDigit(u);o.append(h.toString()),h=this.decodeDigit(d),o.append(h.toString()),a.forEach(function(g){r+=g})}}decodeStart(n){let r=Be.skipWhiteSpace(n),s=Be.findGuardPattern(n,r,Be.START_PATTERN);return this.narrowLineWidth=(s[1]-s[0])/4,this.validateQuietZone(n,s[0]),s}validateQuietZone(n,r){let s=this.narrowLineWidth*10;s=s<r?s:r;for(let o=r-1;s>0&&o>=0&&!n.get(o);o--)s--;if(s!==0)throw new j}static skipWhiteSpace(n){const r=n.getSize(),s=n.getNextSet(0);if(s===r)throw new j;return s}decodeEnd(n){n.reverse();try{let r=Be.skipWhiteSpace(n),s;try{s=Be.findGuardPattern(n,r,Be.END_PATTERN_REVERSED[0])}catch(a){a instanceof j&&(s=Be.findGuardPattern(n,r,Be.END_PATTERN_REVERSED[1]))}this.validateQuietZone(n,s[0]);let o=s[0];return s[0]=n.getSize()-s[1],s[1]=n.getSize()-o,s}finally{n.reverse()}}static findGuardPattern(n,r,s){let o=s.length,a=new Int32Array(o),u=n.getSize(),d=!1,h=0,g=r;a.fill(0);for(let x=r;x<u;x++)if(n.get(x)!==d)a[h]++;else{if(h===o-1){if(ut.patternMatchVariance(a,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[g,x];g+=a[0]+a[1],B.arraycopy(a,2,a,0,h-1),a[h-1]=0,a[h]=0,h--}else h++;a[h]=1,d=!d}throw new j}static decodeDigit(n){let r=Be.MAX_AVG_VARIANCE,s=-1,o=Be.PATTERNS.length;for(let a=0;a<o;a++){let u=Be.PATTERNS[a],d=ut.patternMatchVariance(n,u,Be.MAX_INDIVIDUAL_VARIANCE);d<r?(r=d,s=a):d===r&&(s=-1)}if(s>=0)return s%10;throw new j}}Be.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Be.MAX_AVG_VARIANCE=.38,Be.MAX_INDIVIDUAL_VARIANCE=.5,Be.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Be.START_PATTERN=Int32Array.from([1,1,1,1]),Be.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class nt extends ut{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(n){let r=!1,s,o=0,a=Int32Array.from([0,0,0]);for(;!r;){a=Int32Array.from([0,0,0]),s=nt.findGuardPattern(n,o,!1,this.START_END_PATTERN,a);let u=s[0];o=s[1];let d=u-(o-u);d>=0&&(r=n.isRange(d,u,!1))}return s}static checkChecksum(n){return nt.checkStandardUPCEANChecksum(n)}static checkStandardUPCEANChecksum(n){let r=n.length;if(r===0)return!1;let s=parseInt(n.charAt(r-1),10);return nt.getStandardUPCEANChecksum(n.substring(0,r-1))===s}static getStandardUPCEANChecksum(n){let r=n.length,s=0;for(let o=r-1;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}s*=3;for(let o=r-2;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}return(1e3-s)%10}static decodeEnd(n,r){return nt.findGuardPattern(n,r,!1,nt.START_END_PATTERN,new Int32Array(nt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(n,r,s,o){return this.findGuardPattern(n,r,s,o,new Int32Array(o.length))}static findGuardPattern(n,r,s,o,a){let u=n.getSize();r=s?n.getNextUnset(r):n.getNextSet(r);let d=0,h=r,g=o.length,x=s;for(let E=r;E<u;E++)if(n.get(E)!==x)a[d]++;else{if(d===g-1){if(ut.patternMatchVariance(a,o,nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return Int32Array.from([h,E]);h+=a[0]+a[1];let A=a.slice(2,a.length-1);for(let I=0;I<d-1;I++)a[I]=A[I];a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,x=!x}throw new j}static decodeDigit(n,r,s,o){this.recordPattern(n,s,r);let a=this.MAX_AVG_VARIANCE,u=-1,d=o.length;for(let h=0;h<d;h++){let g=o[h],x=ut.patternMatchVariance(r,g,nt.MAX_INDIVIDUAL_VARIANCE);x<a&&(a=x,u=h)}if(u>=0)return u;throw new j}}nt.MAX_AVG_VARIANCE=.48,nt.MAX_INDIVIDUAL_VARIANCE=.7,nt.START_END_PATTERN=Int32Array.from([1,1,1]),nt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),nt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),nt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Ji{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(n,r,s){let o=this.decodeRowStringBuffer,a=this.decodeMiddle(r,s,o),u=o.toString(),d=Ji.parseExtensionString(u),h=[new oe((s[0]+s[1])/2,n),new oe(a,n)],g=new Ke(u,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&g.putAllMetadata(d),g}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let g=0;g<5&&u<a;g++){let x=nt.decodeDigit(n,o,u,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<4-g),g!==4&&(u=n.getNextSet(u),u=n.getNextUnset(u))}if(s.length!==5)throw new j;let h=this.determineCheckDigit(d);if(Ji.extensionChecksum(s.toString())!==h)throw new j;return u}static extensionChecksum(n){let r=n.length,s=0;for(let o=r-2;o>=0;o-=2)s+=n.charAt(o).charCodeAt(0)-48;s*=3;for(let o=r-1;o>=0;o-=2)s+=n.charAt(o).charCodeAt(0)-48;return s*=3,s%10}determineCheckDigit(n){for(let r=0;r<10;r++)if(n===this.CHECK_DIGIT_ENCODINGS[r])return r;throw new j}static parseExtensionString(n){if(n.length!==5)return null;let r=Ji.parseExtension5String(n);return r==null?null:new Map([[mt.SUGGESTED_PRICE,r]])}static parseExtension5String(n){let r;switch(n.charAt(0)){case"0":r="£";break;case"5":r="$";break;case"9":switch(n){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}r="";break;default:r="";break}let s=parseInt(n.substring(1)),o=(s/100).toString(),a=s%100,u=a<10?"0"+a:a.toString();return r+o+"."+u}}class ja{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(n,r,s){let o=this.decodeRowStringBuffer,a=this.decodeMiddle(r,s,o),u=o.toString(),d=ja.parseExtensionString(u),h=[new oe((s[0]+s[1])/2,n),new oe(a,n)],g=new Ke(u,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&g.putAllMetadata(d),g}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let h=0;h<2&&u<a;h++){let g=nt.decodeDigit(n,o,u,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+g%10);for(let x of o)u+=x;g>=10&&(d|=1<<1-h),h!==1&&(u=n.getNextSet(u),u=n.getNextUnset(u))}if(s.length!==2)throw new j;if(parseInt(s.toString())%4!==d)throw new j;return u}static parseExtensionString(n){return n.length!==2?null:new Map([[mt.ISSUE_NUMBER,parseInt(n)]])}}class $c{static decodeRow(n,r,s){let o=nt.findGuardPattern(r,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Ji().decodeRow(n,r,o)}catch{return new ja().decodeRow(n,r,o)}}}$c.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Oe extends nt{constructor(){super(),this.decodeRowStringBuffer="",Oe.L_AND_G_PATTERNS=Oe.L_PATTERNS.map(n=>Int32Array.from(n));for(let n=10;n<20;n++){let r=Oe.L_PATTERNS[n-10],s=new Int32Array(r.length);for(let o=0;o<r.length;o++)s[o]=r[r.length-o-1];Oe.L_AND_G_PATTERNS[n]=s}}decodeRow(n,r,s){let o=Oe.findStartGuardPattern(r),a=s==null?null:s.get(U.NEED_RESULT_POINT_CALLBACK);if(a!=null){const Z=new oe((o[0]+o[1])/2,n);a.foundPossibleResultPoint(Z)}let u=this.decodeMiddle(r,o,this.decodeRowStringBuffer),d=u.rowOffset,h=u.resultString;if(a!=null){const Z=new oe(d,n);a.foundPossibleResultPoint(Z)}let g=this.decodeEnd(r,d);if(a!=null){const Z=new oe((g[0]+g[1])/2,n);a.foundPossibleResultPoint(Z)}let x=g[1],E=x+(x-g[0]);if(E>=r.getSize()||!r.isRange(x,E,!1))throw new j;let A=h.toString();if(A.length<8)throw new k;if(!Oe.checkChecksum(A))throw new M;let I=(o[1]+o[0])/2,b=(g[1]+g[0])/2,D=this.getBarcodeFormat(),L=[new oe(I,n),new oe(b,n)],z=new Ke(A,null,0,L,D,new Date().getTime()),q=0;try{let Z=$c.decodeRow(n,r,g[1]);z.putMetadata(mt.UPC_EAN_EXTENSION,Z.getText()),z.putAllMetadata(Z.getResultMetadata()),z.addResultPoints(Z.getResultPoints()),q=Z.getText().length}catch{}let $=s==null?null:s.get(U.ALLOWED_EAN_EXTENSIONS);if($!=null){let Z=!1;for(let ve in $)if(q.toString()===ve){Z=!0;break}if(!Z)throw new j}return z}decodeEnd(n,r){return Oe.findGuardPattern(n,r,!1,Oe.START_END_PATTERN,new Int32Array(Oe.START_END_PATTERN.length).fill(0))}static checkChecksum(n){return Oe.checkStandardUPCEANChecksum(n)}static checkStandardUPCEANChecksum(n){let r=n.length;if(r===0)return!1;let s=parseInt(n.charAt(r-1),10);return Oe.getStandardUPCEANChecksum(n.substring(0,r-1))===s}static getStandardUPCEANChecksum(n){let r=n.length,s=0;for(let o=r-1;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}s*=3;for(let o=r-2;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}return(1e3-s)%10}}class Pr extends Oe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let g=0;g<6&&u<a;g++){let x=Oe.decodeDigit(n,o,u,Oe.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<5-g)}s=Pr.determineFirstDigit(s,d),u=Oe.findGuardPattern(n,u,!0,Oe.MIDDLE_PATTERN,new Int32Array(Oe.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<6&&u<a;g++){let x=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+x);for(let E of o)u+=E}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_13}static determineFirstDigit(n,r){for(let s=0;s<10;s++)if(r===this.FIRST_DIGIT_ENCODINGS[s])return n=String.fromCharCode(48+s)+n,n;throw new j}}Pr.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Jc extends Oe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(n,r,s){const o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1];for(let h=0;h<4&&u<a;h++){let g=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+g);for(let x of o)u+=x}u=Oe.findGuardPattern(n,u,!0,Oe.MIDDLE_PATTERN,new Int32Array(Oe.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<4&&u<a;h++){let g=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+g);for(let x of o)u+=x}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class e1 extends Oe{constructor(){super(...arguments),this.ean13Reader=new Pr}getBarcodeFormat(){return le.UPC_A}decode(n,r){return this.maybeReturnResult(this.ean13Reader.decode(n))}decodeRow(n,r,s){return this.maybeReturnResult(this.ean13Reader.decodeRow(n,r,s))}decodeMiddle(n,r,s){return this.ean13Reader.decodeMiddle(n,r,s)}maybeReturnResult(n){let r=n.getText();if(r.charAt(0)==="0"){let s=new Ke(r.substring(1),null,null,n.getResultPoints(),le.UPC_A);return n.getResultMetadata()!=null&&s.putAllMetadata(n.getResultMetadata()),s}else throw new j}reset(){this.ean13Reader.reset()}}class An extends Oe{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(n,r,s){const o=this.decodeMiddleCounters.map(g=>g);o[0]=0,o[1]=0,o[2]=0,o[3]=0;const a=n.getSize();let u=r[1],d=0;for(let g=0;g<6&&u<a;g++){const x=An.decodeDigit(n,o,u,An.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<5-g)}let h=An.determineNumSysAndCheckDigit(s,d);return{rowOffset:u,resultString:h}}decodeEnd(n,r){return An.findGuardPatternWithoutCounters(n,r,!0,An.MIDDLE_END_PATTERN)}checkChecksum(n){return Oe.checkChecksum(An.convertUPCEtoUPCA(n))}static determineNumSysAndCheckDigit(n,r){for(let s=0;s<=1;s++)for(let o=0;o<10;o++)if(r===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[s][o]){let a=String.fromCharCode(48+s),u=String.fromCharCode(48+o);return a+n+u}throw j.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(n){const r=n.slice(1,7).split("").map(a=>a.charCodeAt(0)),s=new ge;s.append(n.charAt(0));let o=r[5];switch(o){case 0:case 1:case 2:s.appendChars(r,0,2),s.append(o),s.append("0000"),s.appendChars(r,2,3);break;case 3:s.appendChars(r,0,3),s.append("00000"),s.appendChars(r,3,2);break;case 4:s.appendChars(r,0,4),s.append("00000"),s.append(r[4]);break;default:s.appendChars(r,0,5),s.append("0000"),s.append(o);break}return n.length>=8&&s.append(n.charAt(7)),s.toString()}}An.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),An.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 Ga extends ut{constructor(n){super();let r=n==null?null:n.get(U.POSSIBLE_FORMATS),s=[];l(r)?(s.push(new Pr),s.push(new e1),s.push(new Jc),s.push(new An)):(r.indexOf(le.EAN_13)>-1&&s.push(new Pr),r.indexOf(le.UPC_A)>-1&&s.push(new e1),r.indexOf(le.EAN_8)>-1&&s.push(new Jc),r.indexOf(le.UPC_E)>-1&&s.push(new An)),this.readers=s}decodeRow(n,r,s){for(let o of this.readers)try{const a=o.decodeRow(n,r,s),u=a.getBarcodeFormat()===le.EAN_13&&a.getText().charAt(0)==="0",d=s==null?null:s.get(U.POSSIBLE_FORMATS),h=d==null||d.includes(le.UPC_A);if(u&&h){const g=a.getRawBytes(),x=new Ke(a.getText().substring(1),g,g?g.length:null,a.getResultPoints(),le.UPC_A);return x.putAllMetadata(a.getResultMetadata()),x}return a}catch{}throw new j}reset(){for(let n of this.readers)n.reset()}}class bt extends ut{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(n,r){for(let s=0;s<r.length;s++)if(ut.patternMatchVariance(n,r[s],bt.MAX_INDIVIDUAL_VARIANCE)<bt.MAX_AVG_VARIANCE)return s;throw new j}static count(n){return Te.sum(new Int32Array(n))}static increment(n,r){let s=0,o=r[0];for(let a=1;a<n.length;a++)r[a]>o&&(o=r[a],s=a);n[s]++}static decrement(n,r){let s=0,o=r[0];for(let a=1;a<n.length;a++)r[a]<o&&(o=r[a],s=a);n[s]--}static isFinderPattern(n){let r=n[0]+n[1],s=r+n[2]+n[3],o=r/s;if(o>=bt.MIN_FINDER_PATTERN_RATIO&&o<=bt.MAX_FINDER_PATTERN_RATIO){let a=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;for(let d of n)d>u&&(u=d),d<a&&(a=d);return u<10*a}return!1}}bt.MAX_AVG_VARIANCE=.2,bt.MAX_INDIVIDUAL_VARIANCE=.45,bt.MIN_FINDER_PATTERN_RATIO=9.5/12,bt.MAX_FINDER_PATTERN_RATIO=12.5/14;class ii{constructor(n,r){this.value=n,this.checksumPortion=r}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(n){if(!(n instanceof ii))return!1;const r=n;return this.value===r.value&&this.checksumPortion===r.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class lo{constructor(n,r,s,o,a){this.value=n,this.startEnd=r,this.value=n,this.startEnd=r,this.resultPoints=new Array,this.resultPoints.push(new oe(s,a)),this.resultPoints.push(new oe(o,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(n){if(!(n instanceof lo))return!1;const r=n;return this.value===r.value}hashCode(){return this.value}}class Mn{constructor(){}static getRSSvalue(n,r,s){let o=0;for(let h of n)o+=h;let a=0,u=0,d=n.length;for(let h=0;h<d-1;h++){let g;for(g=1,u|=1<<h;g<n[h];g++,u&=~(1<<h)){let x=Mn.combins(o-g-1,d-h-2);if(s&&u===0&&o-g-(d-h-1)>=d-h-1&&(x-=Mn.combins(o-g-(d-h),d-h-2)),d-h-1>1){let E=0;for(let A=o-g-(d-h-2);A>r;A--)E+=Mn.combins(o-g-A-1,d-h-3);x-=E*(d-1-h)}else o-g>r&&x--;a+=x}o-=g}return a}static combins(n,r){let s,o;n-r>r?(o=r,s=n-r):(o=n-r,s=r);let a=1,u=1;for(let d=n;d>s;d--)a*=d,u<=o&&(a/=u,u++);for(;u<=o;)a/=u,u++;return a}}class bh{static buildBitArray(n){let r=n.length*2-1;n[n.length-1].getRightChar()==null&&(r-=1);let s=12*r,o=new G(s),a=0,d=n[0].getRightChar().getValue();for(let h=11;h>=0;--h)d&1<<h&&o.set(a),a++;for(let h=1;h<n.length;++h){let g=n[h],x=g.getLeftChar().getValue();for(let E=11;E>=0;--E)x&1<<E&&o.set(a),a++;if(g.getRightChar()!=null){let E=g.getRightChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&o.set(a),a++}}return o}}class Br{constructor(n,r){r?this.decodedInformation=null:(this.finished=n,this.decodedInformation=r)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Xa{constructor(n){this.newPosition=n}getNewPosition(){return this.newPosition}}class jt extends Xa{constructor(n,r){super(n),this.value=r}getValue(){return this.value}isFNC1(){return this.value===jt.FNC1}}jt.FNC1="$";class Lr extends Xa{constructor(n,r,s){super(n),s?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=r}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class fn extends Xa{constructor(n,r,s){if(super(n),r<0||r>10||s<0||s>10)throw new k;this.firstDigit=r,this.secondDigit=s}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===fn.FNC1}isSecondDigitFNC1(){return this.secondDigit===fn.FNC1}isAnyFNC1(){return this.firstDigit===fn.FNC1||this.secondDigit===fn.FNC1}}fn.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(n){if(!n)return null;if(n.length<2)throw new j;let r=n.substring(0,2);for(let a of ne.TWO_DIGIT_DATA_LENGTH)if(a[0]===r)return a[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(2,a[2],n):ne.processFixedAI(2,a[1],n);if(n.length<3)throw new j;let s=n.substring(0,3);for(let a of ne.THREE_DIGIT_DATA_LENGTH)if(a[0]===s)return a[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(3,a[2],n):ne.processFixedAI(3,a[1],n);for(let a of ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(a[0]===s)return a[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,a[2],n):ne.processFixedAI(4,a[1],n);if(n.length<4)throw new j;let o=n.substring(0,4);for(let a of ne.FOUR_DIGIT_DATA_LENGTH)if(a[0]===o)return a[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,a[2],n):ne.processFixedAI(4,a[1],n);throw new j}static processFixedAI(n,r,s){if(s.length<n)throw new j;let o=s.substring(0,n);if(s.length<n+r)throw new j;let a=s.substring(n,n+r),u=s.substring(n+r),d="("+o+")"+a,h=ne.parseFieldsInGeneralPurpose(u);return h==null?d:d+h}static processVariableAI(n,r,s){let o=s.substring(0,n),a;s.length<n+r?a=s.length:a=n+r;let u=s.substring(n,a),d=s.substring(a),h="("+o+")"+u,g=ne.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}}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 si{constructor(n){this.buffer=new ge,this.information=n}decodeAllCodes(n,r){let s=r,o=null;do{let a=this.decodeGeneralPurposeField(s,o),u=ne.parseFieldsInGeneralPurpose(a.getNewString());if(u!=null&&n.append(u),a.isRemaining()?o=""+a.getRemainingValue():o=null,s===a.getNewPosition())break;s=a.getNewPosition()}while(!0);return n.toString()}isStillNumeric(n){if(n+7>this.information.getSize())return n+4<=this.information.getSize();for(let r=n;r<n+3;++r)if(this.information.get(r))return!0;return this.information.get(n+3)}decodeNumeric(n){if(n+7>this.information.getSize()){let a=this.extractNumericValueFromBitArray(n,4);return a===0?new fn(this.information.getSize(),fn.FNC1,fn.FNC1):new fn(this.information.getSize(),a-1,fn.FNC1)}let r=this.extractNumericValueFromBitArray(n,7),s=(r-8)/11,o=(r-8)%11;return new fn(n+7,s,o)}extractNumericValueFromBitArray(n,r){return si.extractNumericValueFromBitArray(this.information,n,r)}static extractNumericValueFromBitArray(n,r,s){let o=0;for(let a=0;a<s;++a)n.get(r+a)&&(o|=1<<s-a-1);return o}decodeGeneralPurposeField(n,r){this.buffer.setLengthToZero(),r!=null&&this.buffer.append(r),this.current.setPosition(n);let s=this.parseBlocks();return s!=null&&s.isRemaining()?new Lr(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new Lr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let n,r;do{let s=this.current.getPosition();if(this.current.isAlpha()?(r=this.parseAlphaBlock(),n=r.isFinished()):this.current.isIsoIec646()?(r=this.parseIsoIec646Block(),n=r.isFinished()):(r=this.parseNumericBlock(),n=r.isFinished()),!(s!==this.current.getPosition())&&!n)break}while(!n);return r.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let n=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFirstDigitFNC1()){let r;return n.isSecondDigitFNC1()?r=new Lr(this.current.getPosition(),this.buffer.toString()):r=new Lr(this.current.getPosition(),this.buffer.toString(),n.getSecondDigit()),new Br(!0,r)}if(this.buffer.append(n.getFirstDigit()),n.isSecondDigitFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Br(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let n=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.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 Br(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let n=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.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 Br(!1)}isStillIsoIec646(n){if(n+5>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(n,5);if(r>=5&&r<16)return!0;if(n+7>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(n,7);if(s>=64&&s<116)return!0;if(n+8>this.information.getSize())return!1;let o=this.extractNumericValueFromBitArray(n,8);return o>=232&&o<253}decodeIsoIec646(n){let r=this.extractNumericValueFromBitArray(n,5);if(r===15)return new jt(n+5,jt.FNC1);if(r>=5&&r<15)return new jt(n+5,"0"+(r-5));let s=this.extractNumericValueFromBitArray(n,7);if(s>=64&&s<90)return new jt(n+7,""+(s+1));if(s>=90&&s<116)return new jt(n+7,""+(s+7));let o=this.extractNumericValueFromBitArray(n,8),a;switch(o){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new k}return new jt(n+8,a)}isStillAlpha(n){if(n+5>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(n,5);if(r>=5&&r<16)return!0;if(n+6>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(n,6);return s>=16&&s<63}decodeAlphanumeric(n){let r=this.extractNumericValueFromBitArray(n,5);if(r===15)return new jt(n+5,jt.FNC1);if(r>=5&&r<15)return new jt(n+5,"0"+(r-5));let s=this.extractNumericValueFromBitArray(n,6);if(s>=32&&s<58)return new jt(n+6,""+(s+33));let o;switch(s){case 58:o="*";break;case 59:o=",";break;case 60:o="-";break;case 61:o=".";break;case 62:o="/";break;default:throw new Dn("Decoding invalid alphanumeric value: "+s)}return new jt(n+6,o)}isAlphaTo646ToAlphaLatch(n){if(n+1>this.information.getSize())return!1;for(let r=0;r<5&&r+n<this.information.getSize();++r)if(r===2){if(!this.information.get(n+2))return!1}else if(this.information.get(n+r))return!1;return!0}isAlphaOr646ToNumericLatch(n){if(n+3>this.information.getSize())return!1;for(let r=n;r<n+3;++r)if(this.information.get(r))return!1;return!0}isNumericToAlphaNumericLatch(n){if(n+1>this.information.getSize())return!1;for(let r=0;r<4&&r+n<this.information.getSize();++r)if(this.information.get(n+r))return!1;return!0}}class Ya{constructor(n){this.information=n,this.generalDecoder=new si(n)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Gt extends Ya{constructor(n){super(n)}encodeCompressedGtin(n,r){n.append("(01)");let s=n.length();n.append("9"),this.encodeCompressedGtinWithoutAI(n,r,s)}encodeCompressedGtinWithoutAI(n,r,s){for(let o=0;o<4;++o){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(r+10*o,10);a/100===0&&n.append("0"),a/10===0&&n.append("0"),n.append(a)}Gt.appendCheckDigit(n,s)}static appendCheckDigit(n,r){let s=0;for(let o=0;o<13;o++){let a=n.charAt(o+r).charCodeAt(0)-48;s+=o&1?a:3*a}s=10-s%10,s===10&&(s=0),n.append(s)}}Gt.GTIN_SIZE=40;class oi extends Gt{constructor(n){super(n)}parseInformation(){let n=new ge;n.append("(01)");let r=n.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(oi.HEADER_SIZE,4);return n.append(s),this.encodeCompressedGtinWithoutAI(n,oi.HEADER_SIZE+4,r),this.getGeneralDecoder().decodeAllCodes(n,oi.HEADER_SIZE+44)}}oi.HEADER_SIZE=4;class uo extends Ya{constructor(n){super(n)}parseInformation(){let n=new ge;return this.getGeneralDecoder().decodeAllCodes(n,uo.HEADER_SIZE)}}uo.HEADER_SIZE=5;class co extends Gt{constructor(n){super(n)}encodeCompressedWeight(n,r,s){let o=this.getGeneralDecoder().extractNumericValueFromBitArray(r,s);this.addWeightCode(n,o);let a=this.checkWeight(o),u=1e5;for(let d=0;d<5;++d)a/u===0&&n.append("0"),u/=10;n.append(a)}}class kn extends co{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()!=kn.HEADER_SIZE+co.GTIN_SIZE+kn.WEIGHT_SIZE)throw new j;let n=new ge;return this.encodeCompressedGtin(n,kn.HEADER_SIZE),this.encodeCompressedWeight(n,kn.HEADER_SIZE+co.GTIN_SIZE,kn.WEIGHT_SIZE),n.toString()}}kn.HEADER_SIZE=5,kn.WEIGHT_SIZE=15;class Oh extends kn{constructor(n){super(n)}addWeightCode(n,r){n.append("(3103)")}checkWeight(n){return n}}class Dh extends kn{constructor(n){super(n)}addWeightCode(n,r){r<1e4?n.append("(3202)"):n.append("(3203)")}checkWeight(n){return n<1e4?n:n-1e4}}class Pn extends Gt{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()<Pn.HEADER_SIZE+Gt.GTIN_SIZE)throw new j;let n=new ge;this.encodeCompressedGtin(n,Pn.HEADER_SIZE);let r=this.getGeneralDecoder().extractNumericValueFromBitArray(Pn.HEADER_SIZE+Gt.GTIN_SIZE,Pn.LAST_DIGIT_SIZE);n.append("(392"),n.append(r),n.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Pn.HEADER_SIZE+Gt.GTIN_SIZE+Pn.LAST_DIGIT_SIZE,null);return n.append(s.getNewString()),n.toString()}}Pn.HEADER_SIZE=8,Pn.LAST_DIGIT_SIZE=2;class Ft extends Gt{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()<Ft.HEADER_SIZE+Gt.GTIN_SIZE)throw new j;let n=new ge;this.encodeCompressedGtin(n,Ft.HEADER_SIZE);let r=this.getGeneralDecoder().extractNumericValueFromBitArray(Ft.HEADER_SIZE+Gt.GTIN_SIZE,Ft.LAST_DIGIT_SIZE);n.append("(393"),n.append(r),n.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ft.HEADER_SIZE+Gt.GTIN_SIZE+Ft.LAST_DIGIT_SIZE,Ft.FIRST_THREE_DIGITS_SIZE);s/100==0&&n.append("0"),s/10==0&&n.append("0"),n.append(s);let o=this.getGeneralDecoder().decodeGeneralPurposeField(Ft.HEADER_SIZE+Gt.GTIN_SIZE+Ft.LAST_DIGIT_SIZE+Ft.FIRST_THREE_DIGITS_SIZE,null);return n.append(o.getNewString()),n.toString()}}Ft.HEADER_SIZE=8,Ft.LAST_DIGIT_SIZE=2,Ft.FIRST_THREE_DIGITS_SIZE=10;class Xe extends co{constructor(n,r,s){super(n),this.dateCode=s,this.firstAIdigits=r}parseInformation(){if(this.getInformation().getSize()!=Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE+Xe.DATE_SIZE)throw new j;let n=new ge;return this.encodeCompressedGtin(n,Xe.HEADER_SIZE),this.encodeCompressedWeight(n,Xe.HEADER_SIZE+Xe.GTIN_SIZE,Xe.WEIGHT_SIZE),this.encodeCompressedDate(n,Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE),n.toString()}encodeCompressedDate(n,r){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(r,Xe.DATE_SIZE);if(s==38400)return;n.append("("),n.append(this.dateCode),n.append(")");let o=s%32;s/=32;let a=s%12+1;s/=12;let u=s;u/10==0&&n.append("0"),n.append(u),a/10==0&&n.append("0"),n.append(a),o/10==0&&n.append("0"),n.append(o)}addWeightCode(n,r){n.append("("),n.append(this.firstAIdigits),n.append(r/1e5),n.append(")")}checkWeight(n){return n%1e5}}Xe.HEADER_SIZE=8,Xe.WEIGHT_SIZE=20,Xe.DATE_SIZE=16;function t1(y){try{if(y.get(1))return new oi(y);if(!y.get(2))return new uo(y);switch(si.extractNumericValueFromBitArray(y,1,4)){case 4:return new Oh(y);case 5:return new Dh(y)}switch(si.extractNumericValueFromBitArray(y,1,5)){case 12:return new Pn(y);case 13:return new Ft(y)}switch(si.extractNumericValueFromBitArray(y,1,7)){case 56:return new Xe(y,"310","11");case 57:return new Xe(y,"320","11");case 58:return new Xe(y,"310","13");case 59:return new Xe(y,"320","13");case 60:return new Xe(y,"310","15");case 61:return new Xe(y,"320","15");case 62:return new Xe(y,"310","17");case 63:return new Xe(y,"320","17")}}catch(n){throw console.log(n),new Dn("unknown decoder: "+y)}}class or{constructor(n,r,s,o){this.leftchar=n,this.rightchar=r,this.finderpattern=s,this.maybeLast=o}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(n,r){return n instanceof or?or.equalsOrNull(n.leftchar,r.leftchar)&&or.equalsOrNull(n.rightchar,r.rightchar)&&or.equalsOrNull(n.finderpattern,r.finderpattern):!1}static equalsOrNull(n,r){return n===null?r===null:or.equals(n,r)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Za{constructor(n,r,s){this.pairs=n,this.rowNumber=r,this.wasReversed=s}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(n){return this.checkEqualitity(this,n)}toString(){return"{ "+this.pairs+" }"}equals(n,r){return n instanceof Za?this.checkEqualitity(n,r)&&n.wasReversed===r.wasReversed:!1}checkEqualitity(n,r){if(!n||!r)return;let s;return n.forEach((o,a)=>{r.forEach(u=>{o.getLeftChar().getValue()===u.getLeftChar().getValue()&&o.getRightChar().getValue()===u.getRightChar().getValue()&&o.getFinderPatter().getValue()===u.getFinderPatter().getValue()&&(s=!0)})}),s}}class Y extends bt{constructor(n){super(...arguments),this.pairs=new Array(Y.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=n===!0}decodeRow(n,r,s){this.pairs.length=0,this.startFromEven=!1;try{return Y.constructResult(this.decodeRow2pairs(n,r))}catch(o){this.verbose&&console.log(o)}return this.pairs.length=0,this.startFromEven=!0,Y.constructResult(this.decodeRow2pairs(n,r))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(n,r){let s=!1;for(;!s;)try{this.pairs.push(this.retrieveNextPair(r,this.pairs,n))}catch(a){if(a instanceof j){if(!this.pairs.length)throw new j;s=!0}}if(this.checkChecksum())return this.pairs;let o;if(this.rows.length?o=!0:o=!1,this.storeRow(n,!1),o){let a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new j}checkRowsBoolean(n){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,n&&(this.rows=this.rows.reverse());let r=null;try{r=this.checkRows(new Array,0)}catch(s){this.verbose&&console.log(s)}return n&&(this.rows=this.rows.reverse()),r}checkRows(n,r){for(let s=r;s<this.rows.length;s++){let o=this.rows[s];this.pairs.length=0;for(let u of n)this.pairs.push(u.getPairs());if(this.pairs.push(o.getPairs()),!Y.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let a=new Array(n);a.push(o);try{return this.checkRows(a,s+1)}catch(u){this.verbose&&console.log(u)}}throw new j}static isValidSequence(n){for(let r of Y.FINDER_PATTERN_SEQUENCES){if(n.length>r.length)continue;let s=!0;for(let o=0;o<n.length;o++)if(n[o].getFinderPattern().getValue()!=r[o]){s=!1;break}if(s)return!0}return!1}storeRow(n,r){let s=0,o=!1,a=!1;for(;s<this.rows.length;){let u=this.rows[s];if(u.getRowNumber()>n){a=u.isEquivalent(this.pairs);break}o=u.isEquivalent(this.pairs),s++}a||o||Y.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new Za(this.pairs,n,r)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(n,r){for(let s of r)if(s.getPairs().length!==n.length){for(let o of s.getPairs())for(let a of n)if(or.equals(o,a))break}}static isPartialRow(n,r){for(let s of r){let o=!0;for(let a of n){let u=!1;for(let d of s.getPairs())if(a.equals(d)){u=!0;break}if(!u){o=!1;break}}if(o)return!0}return!1}getRows(){return this.rows}static constructResult(n){let r=bh.buildBitArray(n),o=t1(r).parseInformation(),a=n[0].getFinderPattern().getResultPoints(),u=n[n.length-1].getFinderPattern().getResultPoints(),d=[a[0],a[1],u[0],u[1]];return new Ke(o,null,null,d,le.RSS_EXPANDED,null)}checkChecksum(){let n=this.pairs.get(0),r=n.getLeftChar(),s=n.getRightChar();if(s==null)return!1;let o=s.getChecksumPortion(),a=2;for(let d=1;d<this.pairs.size();++d){let h=this.pairs.get(d);o+=h.getLeftChar().getChecksumPortion(),a++;let g=h.getRightChar();g!=null&&(o+=g.getChecksumPortion(),a++)}return o%=211,211*(a-4)+o==r.getValue()}static getNextSecondBar(n,r){let s;return n.get(r)?(s=n.getNextUnset(r),s=n.getNextSet(s)):(s=n.getNextSet(r),s=n.getNextUnset(s)),s}retrieveNextPair(n,r,s){let o=r.length%2==0;this.startFromEven&&(o=!o);let a,u=!0,d=-1;do this.findNextPair(n,r,d),a=this.parseFoundFinderPattern(n,s,o),a==null?d=Y.getNextSecondBar(n,this.startEnd[0]):u=!1;while(u);let h=this.decodeDataCharacter(n,a,o,!0);if(!this.isEmptyPair(r)&&r[r.length-1].mustBeLast())throw new j;let g;try{g=this.decodeDataCharacter(n,a,o,!1)}catch(x){g=null,this.verbose&&console.log(x)}return new or(h,g,a,!0)}isEmptyPair(n){return n.length===0}findNextPair(n,r,s){let o=this.getDecodeFinderCounters();o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u;s>=0?u=s:this.isEmptyPair(r)?u=0:u=r[r.length-1].getFinderPattern().getStartEnd()[1];let d=r.length%2!=0;this.startFromEven&&(d=!d);let h=!1;for(;u<a&&(h=!n.get(u),!!h);)u++;let g=0,x=u;for(let E=u;E<a;E++)if(n.get(E)!=h)o[g]++;else{if(g==3){if(d&&Y.reverseCounters(o),Y.isFinderPattern(o)){this.startEnd[0]=x,this.startEnd[1]=E;return}d&&Y.reverseCounters(o),x+=o[0]+o[1],o[0]=o[2],o[1]=o[3],o[2]=0,o[3]=0,g--}else g++;o[g]=1,h=!h}throw new j}static reverseCounters(n){let r=n.length;for(let s=0;s<r/2;++s){let o=n[s];n[s]=n[r-s-1],n[r-s-1]=o}}parseFoundFinderPattern(n,r,s){let o,a,u;if(s){let g=this.startEnd[0]-1;for(;g>=0&&!n.get(g);)g--;g++,o=this.startEnd[0]-g,a=g,u=this.startEnd[1]}else a=this.startEnd[0],u=n.getNextUnset(this.startEnd[1]+1),o=u-this.startEnd[1];let d=this.getDecodeFinderCounters();B.arraycopy(d,0,d,1,d.length-1),d[0]=o;let h;try{h=this.parseFinderValue(d,Y.FINDER_PATTERNS)}catch{return null}return new lo(h,[a,u],a,u,r)}decodeDataCharacter(n,r,s,o){let a=this.getDataCharacterCounters();for(let Fe=0;Fe<a.length;Fe++)a[Fe]=0;if(o)Y.recordPatternInReverse(n,r.getStartEnd()[0],a);else{Y.recordPattern(n,r.getStartEnd()[1],a);for(let Fe=0,_t=a.length-1;Fe<_t;Fe++,_t--){let tn=a[Fe];a[Fe]=a[_t],a[_t]=tn}}let u=17,d=Te.sum(new Int32Array(a))/u,h=(r.getStartEnd()[1]-r.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new j;let g=this.getOddCounts(),x=this.getEvenCounts(),E=this.getOddRoundingErrors(),A=this.getEvenRoundingErrors();for(let Fe=0;Fe<a.length;Fe++){let _t=1*a[Fe]/d,tn=_t+.5;if(tn<1){if(_t<.3)throw new j;tn=1}else if(tn>8){if(_t>8.7)throw new j;tn=8}let fi=Fe/2;Fe&1?(x[fi]=tn,A[fi]=_t-tn):(g[fi]=tn,E[fi]=_t-tn)}this.adjustOddEvenCounts(u);let I=4*r.getValue()+(s?0:2)+(o?0:1)-1,b=0,D=0;for(let Fe=g.length-1;Fe>=0;Fe--){if(Y.isNotA1left(r,s,o)){let _t=Y.WEIGHTS[I][2*Fe];D+=g[Fe]*_t}b+=g[Fe]}let L=0;for(let Fe=x.length-1;Fe>=0;Fe--)if(Y.isNotA1left(r,s,o)){let _t=Y.WEIGHTS[I][2*Fe+1];L+=x[Fe]*_t}let z=D+L;if(b&1||b>13||b<4)throw new j;let q=(13-b)/2,$=Y.SYMBOL_WIDEST[q],Z=9-$,ve=Mn.getRSSvalue(g,$,!0),me=Mn.getRSSvalue(x,Z,!1),Yt=Y.EVEN_TOTAL_SUBSET[q],vn=Y.GSUM[q],Zt=ve*Yt+me+vn;return new ii(Zt,z)}static isNotA1left(n,r,s){return!(n.getValue()==0&&r&&s)}adjustOddEvenCounts(n){let r=Te.sum(new Int32Array(this.getOddCounts())),s=Te.sum(new Int32Array(this.getEvenCounts())),o=!1,a=!1;r>13?a=!0:r<4&&(o=!0);let u=!1,d=!1;s>13?d=!0:s<4&&(u=!0);let h=r+s-n,g=(r&1)==1,x=(s&1)==0;if(h==1)if(g){if(x)throw new j;a=!0}else{if(!x)throw new j;d=!0}else if(h==-1)if(g){if(x)throw new j;o=!0}else{if(!x)throw new j;u=!0}else if(h==0){if(g){if(!x)throw new j;r<s?(o=!0,d=!0):(a=!0,u=!0)}else if(x)throw new j}else throw new j;if(o){if(a)throw new j;Y.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&Y.decrement(this.getOddCounts(),this.getOddRoundingErrors()),u){if(d)throw new j;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 Mh extends ii{constructor(n,r,s){super(n,r),this.count=0,this.finderPattern=s}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class rt extends bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(n,r,s){const o=this.decodePair(r,!1,n,s);rt.addOrTally(this.possibleLeftPairs,o),r.reverse();let a=this.decodePair(r,!0,n,s);rt.addOrTally(this.possibleRightPairs,a),r.reverse();for(let u of this.possibleLeftPairs)if(u.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&rt.checkChecksum(u,d))return rt.constructResult(u,d)}throw new j}static addOrTally(n,r){if(r==null)return;let s=!1;for(let o of n)if(o.getValue()===r.getValue()){o.incrementCount(),s=!0;break}s||n.push(r)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(n,r){let s=4537077*n.getValue()+r.getValue(),o=new String(s).toString(),a=new ge;for(let g=13-o.length;g>0;g--)a.append("0");a.append(o);let u=0;for(let g=0;g<13;g++){let x=a.charAt(g).charCodeAt(0)-48;u+=g&1?x:3*x}u=10-u%10,u===10&&(u=0),a.append(u.toString());let d=n.getFinderPattern().getResultPoints(),h=r.getFinderPattern().getResultPoints();return new Ke(a.toString(),null,0,[d[0],d[1],h[0],h[1]],le.RSS_14,new Date().getTime())}static checkChecksum(n,r){let s=(n.getChecksumPortion()+16*r.getChecksumPortion())%79,o=9*n.getFinderPattern().getValue()+r.getFinderPattern().getValue();return o>72&&o--,o>8&&o--,s===o}decodePair(n,r,s,o){try{let a=this.findFinderPattern(n,r),u=this.parseFoundFinderPattern(n,s,r,a),d=o==null?null:o.get(U.NEED_RESULT_POINT_CALLBACK);if(d!=null){let x=(a[0]+a[1])/2;r&&(x=n.getSize()-1-x),d.foundPossibleResultPoint(new oe(x,s))}let h=this.decodeDataCharacter(n,u,!0),g=this.decodeDataCharacter(n,u,!1);return new Mh(1597*h.getValue()+g.getValue(),h.getChecksumPortion()+4*g.getChecksumPortion(),u)}catch{return null}}decodeDataCharacter(n,r,s){let o=this.getDataCharacterCounters();for(let L=0;L<o.length;L++)o[L]=0;if(s)ut.recordPatternInReverse(n,r.getStartEnd()[0],o);else{ut.recordPattern(n,r.getStartEnd()[1]+1,o);for(let L=0,z=o.length-1;L<z;L++,z--){let q=o[L];o[L]=o[z],o[z]=q}}let a=s?16:15,u=Te.sum(new Int32Array(o))/a,d=this.getOddCounts(),h=this.getEvenCounts(),g=this.getOddRoundingErrors(),x=this.getEvenRoundingErrors();for(let L=0;L<o.length;L++){let z=o[L]/u,q=Math.floor(z+.5);q<1?q=1:q>8&&(q=8);let $=Math.floor(L/2);L&1?(h[$]=q,x[$]=z-q):(d[$]=q,g[$]=z-q)}this.adjustOddEvenCounts(s,a);let E=0,A=0;for(let L=d.length-1;L>=0;L--)A*=9,A+=d[L],E+=d[L];let I=0,b=0;for(let L=h.length-1;L>=0;L--)I*=9,I+=h[L],b+=h[L];let D=A+3*I;if(s){if(E&1||E>12||E<4)throw new j;let L=(12-E)/2,z=rt.OUTSIDE_ODD_WIDEST[L],q=9-z,$=Mn.getRSSvalue(d,z,!1),Z=Mn.getRSSvalue(h,q,!0),ve=rt.OUTSIDE_EVEN_TOTAL_SUBSET[L],me=rt.OUTSIDE_GSUM[L];return new ii($*ve+Z+me,D)}else{if(b&1||b>10||b<4)throw new j;let L=(10-b)/2,z=rt.INSIDE_ODD_WIDEST[L],q=9-z,$=Mn.getRSSvalue(d,z,!0),Z=Mn.getRSSvalue(h,q,!1),ve=rt.INSIDE_ODD_TOTAL_SUBSET[L],me=rt.INSIDE_GSUM[L];return new ii(Z*ve+$+me,D)}}findFinderPattern(n,r){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let o=n.getSize(),a=!1,u=0;for(;u<o&&(a=!n.get(u),r!==a);)u++;let d=0,h=u;for(let g=u;g<o;g++)if(n.get(g)!==a)s[d]++;else{if(d===3){if(bt.isFinderPattern(s))return[h,g];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,a=!a}throw new j}parseFoundFinderPattern(n,r,s,o){let a=n.get(o[0]),u=o[0]-1;for(;u>=0&&a!==n.get(u);)u--;u++;const d=o[0]-u,h=this.getDecodeFinderCounters(),g=new Int32Array(h.length);B.arraycopy(h,0,g,1,h.length-1),g[0]=d;const x=this.parseFinderValue(g,rt.FINDER_PATTERNS);let E=u,A=o[1];return s&&(E=n.getSize()-1-E,A=n.getSize()-1-A),new lo(x,[u,o[1]],E,A,r)}adjustOddEvenCounts(n,r){let s=Te.sum(new Int32Array(this.getOddCounts())),o=Te.sum(new Int32Array(this.getEvenCounts())),a=!1,u=!1,d=!1,h=!1;n?(s>12?u=!0:s<4&&(a=!0),o>12?h=!0:o<4&&(d=!0)):(s>11?u=!0:s<5&&(a=!0),o>10?h=!0:o<4&&(d=!0));let g=s+o-r,x=(s&1)===(n?1:0),E=(o&1)===1;if(g===1)if(x){if(E)throw new j;u=!0}else{if(!E)throw new j;h=!0}else if(g===-1)if(x){if(E)throw new j;a=!0}else{if(!E)throw new j;d=!0}else if(g===0){if(x){if(!E)throw new j;s<o?(a=!0,h=!0):(u=!0,d=!0)}else if(E)throw new j}else throw new j;if(a){if(u)throw new j;bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(u&&bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new j;bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}rt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],rt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],rt.OUTSIDE_GSUM=[0,161,961,2015,2715],rt.INSIDE_GSUM=[0,336,1036,1516],rt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],rt.INSIDE_ODD_WIDEST=[2,4,6,8],rt.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 ai extends ut{constructor(n,r){super(),this.readers=[],this.verbose=r===!0;const s=n?n.get(U.POSSIBLE_FORMATS):null,o=n&&n.get(U.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;s?((s.includes(le.EAN_13)||s.includes(le.UPC_A)||s.includes(le.EAN_8)||s.includes(le.UPC_E))&&this.readers.push(new Ga(n)),s.includes(le.CODE_39)&&this.readers.push(new ft(o)),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 rt),s.includes(le.RSS_EXPANDED)&&this.readers.push(new Y(this.verbose))):(this.readers.push(new Ga(n)),this.readers.push(new ft),this.readers.push(new Ga(n)),this.readers.push(new J),this.readers.push(new Be),this.readers.push(new rt),this.readers.push(new Y(this.verbose)))}decodeRow(n,r,s){for(let o=0;o<this.readers.length;o++)try{return this.readers[o].decodeRow(n,r,s)}catch{}throw new j}reset(){this.readers.forEach(n=>n.reset())}}class kh extends cn{constructor(n=500,r){super(new ai(r),n,r)}}class Me{constructor(n,r,s){this.ecCodewords=n,this.ecBlocks=[r],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class De{constructor(n,r){this.count=n,this.dataCodewords=r}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Se{constructor(n,r,s,o,a,u){this.versionNumber=n,this.symbolSizeRows=r,this.symbolSizeColumns=s,this.dataRegionSizeRows=o,this.dataRegionSizeColumns=a,this.ecBlocks=u;let d=0;const h=u.getECCodewords(),g=u.getECBlocks();for(let x of g)d+=x.getCount()*(x.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(n,r){if(n&1||r&1)throw new k;for(let s of Se.VERSIONS)if(s.symbolSizeRows===n&&s.symbolSizeColumns===r)return s;throw new k}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 Ka{constructor(n){const r=n.getHeight();if(r<8||r>144||r&1)throw new k;this.version=Ka.readVersion(n),this.mappingBitMatrix=this.extractDataRegion(n),this.readMappingMatrix=new _e(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(n){const r=n.getHeight(),s=n.getWidth();return Se.getVersionForDimensions(r,s)}readCodewords(){const n=new Int8Array(this.version.getTotalCodewords());let r=0,s=4,o=0;const a=this.mappingBitMatrix.getHeight(),u=this.mappingBitMatrix.getWidth();let d=!1,h=!1,g=!1,x=!1;do if(s===a&&o===0&&!d)n[r++]=this.readCorner1(a,u)&255,s-=2,o+=2,d=!0;else if(s===a-2&&o===0&&u&3&&!h)n[r++]=this.readCorner2(a,u)&255,s-=2,o+=2,h=!0;else if(s===a+4&&o===2&&!(u&7)&&!g)n[r++]=this.readCorner3(a,u)&255,s-=2,o+=2,g=!0;else if(s===a-2&&o===0&&(u&7)===4&&!x)n[r++]=this.readCorner4(a,u)&255,s-=2,o+=2,x=!0;else{do s<a&&o>=0&&!this.readMappingMatrix.get(o,s)&&(n[r++]=this.readUtah(s,o,a,u)&255),s-=2,o+=2;while(s>=0&&o<u);s+=1,o+=3;do s>=0&&o<u&&!this.readMappingMatrix.get(o,s)&&(n[r++]=this.readUtah(s,o,a,u)&255),s+=2,o-=2;while(s<a&&o>=0);s+=3,o+=1}while(s<a||o<u);if(r!==this.version.getTotalCodewords())throw new k;return n}readModule(n,r,s,o){return n<0&&(n+=s,r+=4-(s+4&7)),r<0&&(r+=o,n+=4-(o+4&7)),this.readMappingMatrix.set(r,n),this.mappingBitMatrix.get(r,n)}readUtah(n,r,s,o){let a=0;return this.readModule(n-2,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n-2,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r,s,o)&&(a|=1),a<<=1,this.readModule(n,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n,r,s,o)&&(a|=1),a}readCorner1(n,r){let s=0;return this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,1,n,r)&&(s|=1),s<<=1,this.readModule(n-1,2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(2,r-1,n,r)&&(s|=1),s<<=1,this.readModule(3,r-1,n,r)&&(s|=1),s}readCorner2(n,r){let s=0;return this.readModule(n-3,0,n,r)&&(s|=1),s<<=1,this.readModule(n-2,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(0,r-4,n,r)&&(s|=1),s<<=1,this.readModule(0,r-3,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s}readCorner3(n,r){let s=0;return this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(0,r-3,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-3,n,r)&&(s|=1),s<<=1,this.readModule(1,r-2,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s}readCorner4(n,r){let s=0;return this.readModule(n-3,0,n,r)&&(s|=1),s<<=1,this.readModule(n-2,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(2,r-1,n,r)&&(s|=1),s<<=1,this.readModule(3,r-1,n,r)&&(s|=1),s}extractDataRegion(n){const r=this.version.getSymbolSizeRows(),s=this.version.getSymbolSizeColumns();if(n.getHeight()!==r)throw new v("Dimension of bitMatrix must match the version size");const o=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),u=r/o|0,d=s/a|0,h=u*o,g=d*a,x=new _e(g,h);for(let E=0;E<u;++E){const A=E*o;for(let I=0;I<d;++I){const b=I*a;for(let D=0;D<o;++D){const L=E*(o+2)+1+D,z=A+D;for(let q=0;q<a;++q){const $=I*(a+2)+1+q;if(n.get($,L)){const Z=b+q;x.set(Z,z)}}}}}return x}}class Qa{constructor(n,r){this.numDataCodewords=n,this.codewords=r}static getDataBlocks(n,r){const s=r.getECBlocks();let o=0;const a=s.getECBlocks();for(let D of a)o+=D.getCount();const u=new Array(o);let d=0;for(let D of a)for(let L=0;L<D.getCount();L++){const z=D.getDataCodewords(),q=s.getECCodewords()+z;u[d++]=new Qa(z,new Uint8Array(q))}const g=u[0].codewords.length-s.getECCodewords(),x=g-1;let E=0;for(let D=0;D<x;D++)for(let L=0;L<d;L++)u[L].codewords[D]=n[E++];const A=r.getVersionNumber()===24,I=A?8:d;for(let D=0;D<I;D++)u[D].codewords[g-1]=n[E++];const b=u[0].codewords.length;for(let D=g;D<b;D++)for(let L=0;L<d;L++){const z=A?(L+8)%d:L,q=A&&z>7?D-1:D;u[z].codewords[q]=n[E++]}if(E!==n.length)throw new v;return u}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class qa{constructor(n){this.bytes=n,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(n){if(n<1||n>32||n>this.available())throw new v(""+n);let r=0,s=this.bitOffset,o=this.byteOffset;const a=this.bytes;if(s>0){const u=8-s,d=n<u?n:u,h=u-d,g=255>>8-d<<h;r=(a[o]&g)>>h,n-=d,s+=d,s===8&&(s=0,o++)}if(n>0){for(;n>=8;)r=r<<8|a[o]&255,o++,n-=8;if(n>0){const u=8-n,d=255>>u<<u;r=r<<n|(a[o]&d)>>u,s+=n}}return this.bitOffset=s,this.byteOffset=o,r}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var dt;(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"})(dt||(dt={}));class ar{static decode(n){const r=new qa(n),s=new ge,o=new ge,a=new Array;let u=dt.ASCII_ENCODE;do if(u===dt.ASCII_ENCODE)u=this.decodeAsciiSegment(r,s,o);else{switch(u){case dt.C40_ENCODE:this.decodeC40Segment(r,s);break;case dt.TEXT_ENCODE:this.decodeTextSegment(r,s);break;case dt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(r,s);break;case dt.EDIFACT_ENCODE:this.decodeEdifactSegment(r,s);break;case dt.BASE256_ENCODE:this.decodeBase256Segment(r,s,a);break;default:throw new k}u=dt.ASCII_ENCODE}while(u!==dt.PAD_ENCODE&&r.available()>0);return o.length()>0&&s.append(o.toString()),new Qi(n,s.toString(),a.length===0?null:a,null)}static decodeAsciiSegment(n,r,s){let o=!1;do{let a=n.readBits(8);if(a===0)throw new k;if(a<=128)return o&&(a+=128),r.append(String.fromCharCode(a-1)),dt.ASCII_ENCODE;if(a===129)return dt.PAD_ENCODE;if(a<=229){const u=a-130;u<10&&r.append("0"),r.append(""+u)}else switch(a){case 230:return dt.C40_ENCODE;case 231:return dt.BASE256_ENCODE;case 232:r.append("");break;case 233:case 234:break;case 235:o=!0;break;case 236:r.append("[)>05"),s.insert(0,"");break;case 237:r.append("[)>06"),s.insert(0,"");break;case 238:return dt.ANSIX12_ENCODE;case 239:return dt.TEXT_ENCODE;case 240:return dt.EDIFACT_ENCODE;case 241:break;default:if(a!==254||n.available()!==0)throw new k;break}}while(n.available()>0);return dt.ASCII_ENCODE}static decodeC40Segment(n,r){let s=!1;const o=[];let a=0;do{if(n.available()===8)return;const u=n.readBits(8);if(u===254)return;this.parseTwoBytes(u,n.readBits(8),o);for(let d=0;d<3;d++){const h=o[d];switch(a){case 0:if(h<3)a=h+1;else if(h<this.C40_BASIC_SET_CHARS.length){const g=this.C40_BASIC_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else throw new k;break;case 1:s?(r.append(String.fromCharCode(h+128)),s=!1):r.append(String.fromCharCode(h)),a=0;break;case 2:if(h<this.C40_SHIFT2_SET_CHARS.length){const g=this.C40_SHIFT2_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else switch(h){case 27:r.append("");break;case 30:s=!0;break;default:throw new k}a=0;break;case 3:s?(r.append(String.fromCharCode(h+224)),s=!1):r.append(String.fromCharCode(h+96)),a=0;break;default:throw new k}}}while(n.available()>0)}static decodeTextSegment(n,r){let s=!1,o=[],a=0;do{if(n.available()===8)return;const u=n.readBits(8);if(u===254)return;this.parseTwoBytes(u,n.readBits(8),o);for(let d=0;d<3;d++){const h=o[d];switch(a){case 0:if(h<3)a=h+1;else if(h<this.TEXT_BASIC_SET_CHARS.length){const g=this.TEXT_BASIC_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else throw new k;break;case 1:s?(r.append(String.fromCharCode(h+128)),s=!1):r.append(String.fromCharCode(h)),a=0;break;case 2:if(h<this.TEXT_SHIFT2_SET_CHARS.length){const g=this.TEXT_SHIFT2_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else switch(h){case 27:r.append("");break;case 30:s=!0;break;default:throw new k}a=0;break;case 3:if(h<this.TEXT_SHIFT3_SET_CHARS.length){const g=this.TEXT_SHIFT3_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g),a=0}else throw new k;break;default:throw new k}}}while(n.available()>0)}static decodeAnsiX12Segment(n,r){const s=[];do{if(n.available()===8)return;const o=n.readBits(8);if(o===254)return;this.parseTwoBytes(o,n.readBits(8),s);for(let a=0;a<3;a++){const u=s[a];switch(u){case 0:r.append("\r");break;case 1:r.append("*");break;case 2:r.append(">");break;case 3:r.append(" ");break;default:if(u<14)r.append(String.fromCharCode(u+44));else if(u<40)r.append(String.fromCharCode(u+51));else throw new k;break}}}while(n.available()>0)}static parseTwoBytes(n,r,s){let o=(n<<8)+r-1,a=Math.floor(o/1600);s[0]=a,o-=a*1600,a=Math.floor(o/40),s[1]=a,s[2]=o-a*40}static decodeEdifactSegment(n,r){do{if(n.available()<=16)return;for(let s=0;s<4;s++){let o=n.readBits(6);if(o===31){const a=8-n.getBitOffset();a!==8&&n.readBits(a);return}o&32||(o|=64),r.append(String.fromCharCode(o))}}while(n.available()>0)}static decodeBase256Segment(n,r,s){let o=1+n.getByteOffset();const a=this.unrandomize255State(n.readBits(8),o++);let u;if(a===0?u=n.available()/8|0:a<250?u=a:u=250*(a-249)+this.unrandomize255State(n.readBits(8),o++),u<0)throw new k;const d=new Uint8Array(u);for(let h=0;h<u;h++){if(n.available()<8)throw new k;d[h]=this.unrandomize255State(n.readBits(8),o++)}s.push(d);try{r.append(Ee.decode(d,ie.ISO88591))}catch(h){throw new Dn("Platform does not support required encoding: "+h.message)}}static unrandomize255State(n,r){const s=149*r%255+1,o=n-s;return o>=0?o:o+256}}ar.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"],ar.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],ar.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"],ar.TEXT_SHIFT2_SET_CHARS=ar.C40_SHIFT2_SET_CHARS,ar.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 Ph{constructor(){this.rsDecoder=new $i(be.DATA_MATRIX_FIELD_256)}decode(n){const r=new Ka(n),s=r.getVersion(),o=r.readCodewords(),a=Qa.getDataBlocks(o,s);let u=0;for(let g of a)u+=g.getNumDataCodewords();const d=new Uint8Array(u),h=a.length;for(let g=0;g<h;g++){const x=a[g],E=x.getCodewords(),A=x.getNumDataCodewords();this.correctErrors(E,A);for(let I=0;I<A;I++)d[I*h+g]=E[I]}return ar.decode(d)}correctErrors(n,r){const s=new Int32Array(n);try{this.rsDecoder.decode(s,n.length-r)}catch{throw new M}for(let o=0;o<r;o++)n[o]=s[o]}}class at{constructor(n){this.image=n,this.rectangleDetector=new Gn(this.image)}detect(){const n=this.rectangleDetector.detect();let r=this.detectSolid1(n);if(r=this.detectSolid2(r),r[3]=this.correctTopRight(r),!r[3])throw new j;r=this.shiftToModuleCenter(r);const s=r[0],o=r[1],a=r[2],u=r[3];let d=this.transitionsBetween(s,u)+1,h=this.transitionsBetween(a,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 g=at.sampleGrid(this.image,s,o,a,u,d,h);return new oo(g,[s,o,a,u])}static shiftPoint(n,r,s){let o=(r.getX()-n.getX())/(s+1),a=(r.getY()-n.getY())/(s+1);return new oe(n.getX()+o,n.getY()+a)}static moveAway(n,r,s){let o=n.getX(),a=n.getY();return o<r?o-=1:o+=1,a<s?a-=1:a+=1,new oe(o,a)}detectSolid1(n){let r=n[0],s=n[1],o=n[3],a=n[2],u=this.transitionsBetween(r,s),d=this.transitionsBetween(s,o),h=this.transitionsBetween(o,a),g=this.transitionsBetween(a,r),x=u,E=[a,r,s,o];return x>d&&(x=d,E[0]=r,E[1]=s,E[2]=o,E[3]=a),x>h&&(x=h,E[0]=s,E[1]=o,E[2]=a,E[3]=r),x>g&&(E[0]=o,E[1]=a,E[2]=r,E[3]=s),E}detectSolid2(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a),d=at.shiftPoint(s,o,(u+1)*4),h=at.shiftPoint(o,s,(u+1)*4),g=this.transitionsBetween(d,r),x=this.transitionsBetween(h,a);return g<x?(n[0]=r,n[1]=s,n[2]=o,n[3]=a):(n[0]=s,n[1]=o,n[2]=a,n[3]=r),n}correctTopRight(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a),d=this.transitionsBetween(s,a),h=at.shiftPoint(r,s,(d+1)*4),g=at.shiftPoint(o,s,(u+1)*4);u=this.transitionsBetween(h,a),d=this.transitionsBetween(g,a);let x=new oe(a.getX()+(o.getX()-s.getX())/(u+1),a.getY()+(o.getY()-s.getY())/(u+1)),E=new oe(a.getX()+(r.getX()-s.getX())/(d+1),a.getY()+(r.getY()-s.getY())/(d+1));if(!this.isValid(x))return this.isValid(E)?E:null;if(!this.isValid(E))return x;let A=this.transitionsBetween(h,x)+this.transitionsBetween(g,x),I=this.transitionsBetween(h,E)+this.transitionsBetween(g,E);return A>I?x:E}shiftToModuleCenter(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a)+1,d=this.transitionsBetween(o,a)+1,h=at.shiftPoint(r,s,d*4),g=at.shiftPoint(o,s,u*4);u=this.transitionsBetween(h,a)+1,d=this.transitionsBetween(g,a)+1,(u&1)===1&&(u+=1),(d&1)===1&&(d+=1);let x=(r.getX()+s.getX()+o.getX()+a.getX())/4,E=(r.getY()+s.getY()+o.getY()+a.getY())/4;r=at.moveAway(r,x,E),s=at.moveAway(s,x,E),o=at.moveAway(o,x,E),a=at.moveAway(a,x,E);let A,I;return h=at.shiftPoint(r,s,d*4),h=at.shiftPoint(h,a,u*4),A=at.shiftPoint(s,r,d*4),A=at.shiftPoint(A,o,u*4),g=at.shiftPoint(o,a,d*4),g=at.shiftPoint(g,s,u*4),I=at.shiftPoint(a,o,d*4),I=at.shiftPoint(I,r,u*4),[h,A,g,I]}isValid(n){return n.getX()>=0&&n.getX()<this.image.getWidth()&&n.getY()>0&&n.getY()<this.image.getHeight()}static sampleGrid(n,r,s,o,a,u,d){return sr.getInstance().sampleGrid(n,u,d,.5,.5,u-.5,.5,u-.5,d-.5,.5,d-.5,r.getX(),r.getY(),a.getX(),a.getY(),o.getX(),o.getY(),s.getX(),s.getY())}transitionsBetween(n,r){let s=Math.trunc(n.getX()),o=Math.trunc(n.getY()),a=Math.trunc(r.getX()),u=Math.trunc(r.getY()),d=Math.abs(u-o)>Math.abs(a-s);if(d){let D=s;s=o,o=D,D=a,a=u,u=D}let h=Math.abs(a-s),g=Math.abs(u-o),x=-h/2,E=o<u?1:-1,A=s<a?1:-1,I=0,b=this.image.get(d?o:s,d?s:o);for(let D=s,L=o;D!==a;D+=A){let z=this.image.get(d?L:D,d?D:L);if(z!==b&&(I++,b=z),x+=g,x>0){if(L===u)break;L+=E,x-=h}}return I}}class lr{constructor(){this.decoder=new Ph}decode(n,r=null){let s,o;if(r!=null&&r.has(U.PURE_BARCODE)){const g=lr.extractPureBits(n.getBlackMatrix());s=this.decoder.decode(g),o=lr.NO_POINTS}else{const g=new at(n.getBlackMatrix()).detect();s=this.decoder.decode(g.getBits()),o=g.getPoints()}const a=s.getRawBytes(),u=new Ke(s.getText(),a,8*a.length,o,le.DATA_MATRIX,B.currentTimeMillis()),d=s.getByteSegments();d!=null&&u.putMetadata(mt.BYTE_SEGMENTS,d);const h=s.getECLevel();return h!=null&&u.putMetadata(mt.ERROR_CORRECTION_LEVEL,h),u}reset(){}static extractPureBits(n){const r=n.getTopLeftOnBit(),s=n.getBottomRightOnBit();if(r==null||s==null)throw new j;const o=this.moduleSize(r,n);let a=r[1];const u=s[1];let d=r[0];const g=(s[0]-d+1)/o,x=(u-a+1)/o;if(g<=0||x<=0)throw new j;const E=o/2;a+=E,d+=E;const A=new _e(g,x);for(let I=0;I<x;I++){const b=a+I*o;for(let D=0;D<g;D++)n.get(d+D*o,b)&&A.set(D,I)}return A}static moduleSize(n,r){const s=r.getWidth();let o=n[0];const a=n[1];for(;o<s&&r.get(o,a);)o++;if(o===s)throw new j;const u=o-n[0];if(u===0)throw new j;return u}}lr.NO_POINTS=[];class Bh extends cn{constructor(n=500){super(new lr,n)}}var li;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(li||(li={}));class We{constructor(n,r,s){this.value=n,this.stringValue=r,this.bits=s,We.FOR_BITS.set(s,this),We.FOR_VALUE.set(n,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(n){switch(n){case"L":return We.L;case"M":return We.M;case"Q":return We.Q;case"H":return We.H;default:throw new _(n+"not available")}}toString(){return this.stringValue}equals(n){if(!(n instanceof We))return!1;const r=n;return this.value===r.value}static forBits(n){if(n<0||n>=We.FOR_BITS.size)throw new v;return We.FOR_BITS.get(n)}}We.FOR_BITS=new Map,We.FOR_VALUE=new Map,We.L=new We(li.L,"L",1),We.M=new We(li.M,"M",0),We.Q=new We(li.Q,"Q",3),We.H=new We(li.H,"H",2);class Ot{constructor(n){this.errorCorrectionLevel=We.forBits(n>>3&3),this.dataMask=n&7}static numBitsDiffering(n,r){return N.bitCount(n^r)}static decodeFormatInformation(n,r){const s=Ot.doDecodeFormatInformation(n,r);return s!==null?s:Ot.doDecodeFormatInformation(n^Ot.FORMAT_INFO_MASK_QR,r^Ot.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(n,r){let s=Number.MAX_SAFE_INTEGER,o=0;for(const a of Ot.FORMAT_INFO_DECODE_LOOKUP){const u=a[0];if(u===n||u===r)return new Ot(a[1]);let d=Ot.numBitsDiffering(n,u);d<s&&(o=a[1],s=d),n!==r&&(d=Ot.numBitsDiffering(r,u),d<s&&(o=a[1],s=d))}return s<=3?new Ot(o):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(n){if(!(n instanceof Ot))return!1;const r=n;return this.errorCorrectionLevel===r.errorCorrectionLevel&&this.dataMask===r.dataMask}}Ot.FORMAT_INFO_MASK_QR=21522,Ot.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(n,...r){this.ecCodewordsPerBlock=n,this.ecBlocks=r}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let n=0;const r=this.ecBlocks;for(const s of r)n+=s.getCount();return n}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class S{constructor(n,r){this.count=n,this.dataCodewords=r}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ue{constructor(n,r,...s){this.versionNumber=n,this.alignmentPatternCenters=r,this.ecBlocks=s;let o=0;const a=s[0].getECCodewordsPerBlock(),u=s[0].getECBlocks();for(const d of u)o+=d.getCount()*(d.getDataCodewords()+a);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(n){return this.ecBlocks[n.getValue()]}static getProvisionalVersionForDimension(n){if(n%4!==1)throw new k;try{return this.getVersionForNumber((n-17)/4)}catch{throw new k}}static getVersionForNumber(n){if(n<1||n>40)throw new v;return ue.VERSIONS[n-1]}static decodeVersionInformation(n){let r=Number.MAX_SAFE_INTEGER,s=0;for(let o=0;o<ue.VERSION_DECODE_INFO.length;o++){const a=ue.VERSION_DECODE_INFO[o];if(a===n)return ue.getVersionForNumber(o+7);const u=Ot.numBitsDiffering(n,a);u<r&&(s=o+7,r=u)}return r<=3?ue.getVersionForNumber(s):null}buildFunctionPattern(){const n=this.getDimensionForVersion(),r=new _e(n);r.setRegion(0,0,9,9),r.setRegion(n-8,0,8,9),r.setRegion(0,n-8,9,8);const s=this.alignmentPatternCenters.length;for(let o=0;o<s;o++){const a=this.alignmentPatternCenters[o]-2;for(let u=0;u<s;u++)o===0&&(u===0||u===s-1)||o===s-1&&u===0||r.setRegion(this.alignmentPatternCenters[u]-2,a,5,5)}return r.setRegion(6,9,1,n-17),r.setRegion(9,6,n-17,1),this.versionNumber>6&&(r.setRegion(n-11,0,3,6),r.setRegion(0,n-11,6,3)),r}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 S(1,19)),new F(10,new S(1,16)),new F(13,new S(1,13)),new F(17,new S(1,9))),new ue(2,Int32Array.from([6,18]),new F(10,new S(1,34)),new F(16,new S(1,28)),new F(22,new S(1,22)),new F(28,new S(1,16))),new ue(3,Int32Array.from([6,22]),new F(15,new S(1,55)),new F(26,new S(1,44)),new F(18,new S(2,17)),new F(22,new S(2,13))),new ue(4,Int32Array.from([6,26]),new F(20,new S(1,80)),new F(18,new S(2,32)),new F(26,new S(2,24)),new F(16,new S(4,9))),new ue(5,Int32Array.from([6,30]),new F(26,new S(1,108)),new F(24,new S(2,43)),new F(18,new S(2,15),new S(2,16)),new F(22,new S(2,11),new S(2,12))),new ue(6,Int32Array.from([6,34]),new F(18,new S(2,68)),new F(16,new S(4,27)),new F(24,new S(4,19)),new F(28,new S(4,15))),new ue(7,Int32Array.from([6,22,38]),new F(20,new S(2,78)),new F(18,new S(4,31)),new F(18,new S(2,14),new S(4,15)),new F(26,new S(4,13),new S(1,14))),new ue(8,Int32Array.from([6,24,42]),new F(24,new S(2,97)),new F(22,new S(2,38),new S(2,39)),new F(22,new S(4,18),new S(2,19)),new F(26,new S(4,14),new S(2,15))),new ue(9,Int32Array.from([6,26,46]),new F(30,new S(2,116)),new F(22,new S(3,36),new S(2,37)),new F(20,new S(4,16),new S(4,17)),new F(24,new S(4,12),new S(4,13))),new ue(10,Int32Array.from([6,28,50]),new F(18,new S(2,68),new S(2,69)),new F(26,new S(4,43),new S(1,44)),new F(24,new S(6,19),new S(2,20)),new F(28,new S(6,15),new S(2,16))),new ue(11,Int32Array.from([6,30,54]),new F(20,new S(4,81)),new F(30,new S(1,50),new S(4,51)),new F(28,new S(4,22),new S(4,23)),new F(24,new S(3,12),new S(8,13))),new ue(12,Int32Array.from([6,32,58]),new F(24,new S(2,92),new S(2,93)),new F(22,new S(6,36),new S(2,37)),new F(26,new S(4,20),new S(6,21)),new F(28,new S(7,14),new S(4,15))),new ue(13,Int32Array.from([6,34,62]),new F(26,new S(4,107)),new F(22,new S(8,37),new S(1,38)),new F(24,new S(8,20),new S(4,21)),new F(22,new S(12,11),new S(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new F(30,new S(3,115),new S(1,116)),new F(24,new S(4,40),new S(5,41)),new F(20,new S(11,16),new S(5,17)),new F(24,new S(11,12),new S(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new F(22,new S(5,87),new S(1,88)),new F(24,new S(5,41),new S(5,42)),new F(30,new S(5,24),new S(7,25)),new F(24,new S(11,12),new S(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new F(24,new S(5,98),new S(1,99)),new F(28,new S(7,45),new S(3,46)),new F(24,new S(15,19),new S(2,20)),new F(30,new S(3,15),new S(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new F(28,new S(1,107),new S(5,108)),new F(28,new S(10,46),new S(1,47)),new F(28,new S(1,22),new S(15,23)),new F(28,new S(2,14),new S(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new F(30,new S(5,120),new S(1,121)),new F(26,new S(9,43),new S(4,44)),new F(28,new S(17,22),new S(1,23)),new F(28,new S(2,14),new S(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new F(28,new S(3,113),new S(4,114)),new F(26,new S(3,44),new S(11,45)),new F(26,new S(17,21),new S(4,22)),new F(26,new S(9,13),new S(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new F(28,new S(3,107),new S(5,108)),new F(26,new S(3,41),new S(13,42)),new F(30,new S(15,24),new S(5,25)),new F(28,new S(15,15),new S(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new F(28,new S(4,116),new S(4,117)),new F(26,new S(17,42)),new F(28,new S(17,22),new S(6,23)),new F(30,new S(19,16),new S(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new F(28,new S(2,111),new S(7,112)),new F(28,new S(17,46)),new F(30,new S(7,24),new S(16,25)),new F(24,new S(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new F(30,new S(4,121),new S(5,122)),new F(28,new S(4,47),new S(14,48)),new F(30,new S(11,24),new S(14,25)),new F(30,new S(16,15),new S(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new F(30,new S(6,117),new S(4,118)),new F(28,new S(6,45),new S(14,46)),new F(30,new S(11,24),new S(16,25)),new F(30,new S(30,16),new S(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new F(26,new S(8,106),new S(4,107)),new F(28,new S(8,47),new S(13,48)),new F(30,new S(7,24),new S(22,25)),new F(30,new S(22,15),new S(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new F(28,new S(10,114),new S(2,115)),new F(28,new S(19,46),new S(4,47)),new F(28,new S(28,22),new S(6,23)),new F(30,new S(33,16),new S(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new F(30,new S(8,122),new S(4,123)),new F(28,new S(22,45),new S(3,46)),new F(30,new S(8,23),new S(26,24)),new F(30,new S(12,15),new S(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new F(30,new S(3,117),new S(10,118)),new F(28,new S(3,45),new S(23,46)),new F(30,new S(4,24),new S(31,25)),new F(30,new S(11,15),new S(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new F(30,new S(7,116),new S(7,117)),new F(28,new S(21,45),new S(7,46)),new F(30,new S(1,23),new S(37,24)),new F(30,new S(19,15),new S(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new F(30,new S(5,115),new S(10,116)),new F(28,new S(19,47),new S(10,48)),new F(30,new S(15,24),new S(25,25)),new F(30,new S(23,15),new S(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new F(30,new S(13,115),new S(3,116)),new F(28,new S(2,46),new S(29,47)),new F(30,new S(42,24),new S(1,25)),new F(30,new S(23,15),new S(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new F(30,new S(17,115)),new F(28,new S(10,46),new S(23,47)),new F(30,new S(10,24),new S(35,25)),new F(30,new S(19,15),new S(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new F(30,new S(17,115),new S(1,116)),new F(28,new S(14,46),new S(21,47)),new F(30,new S(29,24),new S(19,25)),new F(30,new S(11,15),new S(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new F(30,new S(13,115),new S(6,116)),new F(28,new S(14,46),new S(23,47)),new F(30,new S(44,24),new S(7,25)),new F(30,new S(59,16),new S(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new F(30,new S(12,121),new S(7,122)),new F(28,new S(12,47),new S(26,48)),new F(30,new S(39,24),new S(14,25)),new F(30,new S(22,15),new S(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new F(30,new S(6,121),new S(14,122)),new F(28,new S(6,47),new S(34,48)),new F(30,new S(46,24),new S(10,25)),new F(30,new S(2,15),new S(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new F(30,new S(17,122),new S(4,123)),new F(28,new S(29,46),new S(14,47)),new F(30,new S(49,24),new S(10,25)),new F(30,new S(24,15),new S(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new F(30,new S(4,122),new S(18,123)),new F(28,new S(13,46),new S(32,47)),new F(30,new S(48,24),new S(14,25)),new F(30,new S(42,15),new S(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new F(30,new S(20,117),new S(4,118)),new F(28,new S(40,47),new S(7,48)),new F(30,new S(43,24),new S(22,25)),new F(30,new S(10,15),new S(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new F(30,new S(19,118),new S(6,119)),new F(28,new S(18,47),new S(31,48)),new F(30,new S(34,24),new S(34,25)),new F(30,new S(20,15),new S(61,16)))];var wt;(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"})(wt||(wt={}));class dn{constructor(n,r){this.value=n,this.isMasked=r}unmaskBitMatrix(n,r){for(let s=0;s<r;s++)for(let o=0;o<r;o++)this.isMasked(s,o)&&n.flip(o,s)}}dn.values=new Map([[wt.DATA_MASK_000,new dn(wt.DATA_MASK_000,(y,n)=>(y+n&1)===0)],[wt.DATA_MASK_001,new dn(wt.DATA_MASK_001,(y,n)=>(y&1)===0)],[wt.DATA_MASK_010,new dn(wt.DATA_MASK_010,(y,n)=>n%3===0)],[wt.DATA_MASK_011,new dn(wt.DATA_MASK_011,(y,n)=>(y+n)%3===0)],[wt.DATA_MASK_100,new dn(wt.DATA_MASK_100,(y,n)=>(Math.floor(y/2)+Math.floor(n/3)&1)===0)],[wt.DATA_MASK_101,new dn(wt.DATA_MASK_101,(y,n)=>y*n%6===0)],[wt.DATA_MASK_110,new dn(wt.DATA_MASK_110,(y,n)=>y*n%6<3)],[wt.DATA_MASK_111,new dn(wt.DATA_MASK_111,(y,n)=>(y+n+y*n%3&1)===0)]]);class Lh{constructor(n){const r=n.getHeight();if(r<21||(r&3)!==1)throw new k;this.bitMatrix=n}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let n=0;for(let a=0;a<6;a++)n=this.copyBit(a,8,n);n=this.copyBit(7,8,n),n=this.copyBit(8,8,n),n=this.copyBit(8,7,n);for(let a=5;a>=0;a--)n=this.copyBit(8,a,n);const r=this.bitMatrix.getHeight();let s=0;const o=r-7;for(let a=r-1;a>=o;a--)s=this.copyBit(8,a,s);for(let a=r-8;a<r;a++)s=this.copyBit(a,8,s);if(this.parsedFormatInfo=Ot.decodeFormatInformation(n,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new k}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const n=this.bitMatrix.getHeight(),r=Math.floor((n-17)/4);if(r<=6)return ue.getVersionForNumber(r);let s=0;const o=n-11;for(let u=5;u>=0;u--)for(let d=n-9;d>=o;d--)s=this.copyBit(d,u,s);let a=ue.decodeVersionInformation(s);if(a!==null&&a.getDimensionForVersion()===n)return this.parsedVersion=a,a;s=0;for(let u=5;u>=0;u--)for(let d=n-9;d>=o;d--)s=this.copyBit(u,d,s);if(a=ue.decodeVersionInformation(s),a!==null&&a.getDimensionForVersion()===n)return this.parsedVersion=a,a;throw new k}copyBit(n,r,s){return(this.isMirror?this.bitMatrix.get(r,n):this.bitMatrix.get(n,r))?s<<1|1:s<<1}readCodewords(){const n=this.readFormatInformation(),r=this.readVersion(),s=dn.values.get(n.getDataMask()),o=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,o);const a=r.buildFunctionPattern();let u=!0;const d=new Uint8Array(r.getTotalCodewords());let h=0,g=0,x=0;for(let E=o-1;E>0;E-=2){E===6&&E--;for(let A=0;A<o;A++){const I=u?o-1-A:A;for(let b=0;b<2;b++)a.get(E-b,I)||(x++,g<<=1,this.bitMatrix.get(E-b,I)&&(g|=1),x===8&&(d[h++]=g,x=0,g=0))}u=!u}if(h!==r.getTotalCodewords())throw new k;return d}remask(){if(this.parsedFormatInfo===null)return;const n=dn.values[this.parsedFormatInfo.getDataMask()],r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r)}setMirror(n){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=n}mirror(){const n=this.bitMatrix;for(let r=0,s=n.getWidth();r<s;r++)for(let o=r+1,a=n.getHeight();o<a;o++)n.get(r,o)!==n.get(o,r)&&(n.flip(o,r),n.flip(r,o))}}class $a{constructor(n,r){this.numDataCodewords=n,this.codewords=r}static getDataBlocks(n,r,s){if(n.length!==r.getTotalCodewords())throw new v;const o=r.getECBlocksForLevel(s);let a=0;const u=o.getECBlocks();for(const b of u)a+=b.getCount();const d=new Array(a);let h=0;for(const b of u)for(let D=0;D<b.getCount();D++){const L=b.getDataCodewords(),z=o.getECCodewordsPerBlock()+L;d[h++]=new $a(L,new Uint8Array(z))}const g=d[0].codewords.length;let x=d.length-1;for(;x>=0&&d[x].codewords.length!==g;)x--;x++;const E=g-o.getECCodewordsPerBlock();let A=0;for(let b=0;b<E;b++)for(let D=0;D<h;D++)d[D].codewords[b]=n[A++];for(let b=x;b<h;b++)d[b].codewords[E]=n[A++];const I=d[0].codewords.length;for(let b=E;b<I;b++)for(let D=0;D<h;D++){const L=D<x?b:b+1;d[D].codewords[L]=n[A++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var hn;(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"})(hn||(hn={}));class ce{constructor(n,r,s,o){this.value=n,this.stringValue=r,this.characterCountBitsForVersions=s,this.bits=o,ce.FOR_BITS.set(o,this),ce.FOR_VALUE.set(n,this)}static forBits(n){const r=ce.FOR_BITS.get(n);if(r===void 0)throw new v;return r}getCharacterCountBits(n){const r=n.getVersionNumber();let s;return r<=9?s=0:r<=26?s=1:s=2,this.characterCountBitsForVersions[s]}getValue(){return this.value}getBits(){return this.bits}equals(n){if(!(n instanceof ce))return!1;const r=n;return this.value===r.value}toString(){return this.stringValue}}ce.FOR_BITS=new Map,ce.FOR_VALUE=new Map,ce.TERMINATOR=new ce(hn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ce.NUMERIC=new ce(hn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ce.ALPHANUMERIC=new ce(hn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ce.STRUCTURED_APPEND=new ce(hn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ce.BYTE=new ce(hn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ce.ECI=new ce(hn.ECI,"ECI",Int32Array.from([0,0,0]),7),ce.KANJI=new ce(hn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ce.FNC1_FIRST_POSITION=new ce(hn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ce.FNC1_SECOND_POSITION=new ce(hn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ce.HANZI=new ce(hn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Qe{static decode(n,r,s,o){const a=new qa(n);let u=new ge;const d=new Array;let h=-1,g=-1;try{let x=null,E=!1,A;do{if(a.available()<4)A=ce.TERMINATOR;else{const I=a.readBits(4);A=ce.forBits(I)}switch(A){case ce.TERMINATOR:break;case ce.FNC1_FIRST_POSITION:case ce.FNC1_SECOND_POSITION:E=!0;break;case ce.STRUCTURED_APPEND:if(a.available()<16)throw new k;h=a.readBits(8),g=a.readBits(8);break;case ce.ECI:const I=Qe.parseECIValue(a);if(x=V.getCharacterSetECIByValue(I),x===null)throw new k;break;case ce.HANZI:const b=a.readBits(4),D=a.readBits(A.getCharacterCountBits(r));b===Qe.GB2312_SUBSET&&Qe.decodeHanziSegment(a,u,D);break;default:const L=a.readBits(A.getCharacterCountBits(r));switch(A){case ce.NUMERIC:Qe.decodeNumericSegment(a,u,L);break;case ce.ALPHANUMERIC:Qe.decodeAlphanumericSegment(a,u,L,E);break;case ce.BYTE:Qe.decodeByteSegment(a,u,L,x,d,o);break;case ce.KANJI:Qe.decodeKanjiSegment(a,u,L);break;default:throw new k}break}}while(A!==ce.TERMINATOR)}catch{throw new k}return new Qi(n,u.toString(),d.length===0?null:d,s===null?null:s.toString(),h,g)}static decodeHanziSegment(n,r,s){if(s*13>n.available())throw new k;const o=new Uint8Array(2*s);let a=0;for(;s>0;){const u=n.readBits(13);let d=u/96<<8&4294967295|u%96;d<959?d+=41377:d+=42657,o[a]=d>>8&255,o[a+1]=d&255,a+=2,s--}try{r.append(Ee.decode(o,ie.GB2312))}catch(u){throw new k(u)}}static decodeKanjiSegment(n,r,s){if(s*13>n.available())throw new k;const o=new Uint8Array(2*s);let a=0;for(;s>0;){const u=n.readBits(13);let d=u/192<<8&4294967295|u%192;d<7936?d+=33088:d+=49472,o[a]=d>>8,o[a+1]=d,a+=2,s--}try{r.append(Ee.decode(o,ie.SHIFT_JIS))}catch(u){throw new k(u)}}static decodeByteSegment(n,r,s,o,a,u){if(8*s>n.available())throw new k;const d=new Uint8Array(s);for(let g=0;g<s;g++)d[g]=n.readBits(8);let h;o===null?h=ie.guessEncoding(d,u):h=o.getName();try{r.append(Ee.decode(d,h))}catch(g){throw new k(g)}a.push(d)}static toAlphaNumericChar(n){if(n>=Qe.ALPHANUMERIC_CHARS.length)throw new k;return Qe.ALPHANUMERIC_CHARS[n]}static decodeAlphanumericSegment(n,r,s,o){const a=r.length();for(;s>1;){if(n.available()<11)throw new k;const u=n.readBits(11);r.append(Qe.toAlphaNumericChar(Math.floor(u/45))),r.append(Qe.toAlphaNumericChar(u%45)),s-=2}if(s===1){if(n.available()<6)throw new k;r.append(Qe.toAlphaNumericChar(n.readBits(6)))}if(o)for(let u=a;u<r.length();u++)r.charAt(u)==="%"&&(u<r.length()-1&&r.charAt(u+1)==="%"?r.deleteCharAt(u+1):r.setCharAt(u,""))}static decodeNumericSegment(n,r,s){for(;s>=3;){if(n.available()<10)throw new k;const o=n.readBits(10);if(o>=1e3)throw new k;r.append(Qe.toAlphaNumericChar(Math.floor(o/100))),r.append(Qe.toAlphaNumericChar(Math.floor(o/10)%10)),r.append(Qe.toAlphaNumericChar(o%10)),s-=3}if(s===2){if(n.available()<7)throw new k;const o=n.readBits(7);if(o>=100)throw new k;r.append(Qe.toAlphaNumericChar(Math.floor(o/10))),r.append(Qe.toAlphaNumericChar(o%10))}else if(s===1){if(n.available()<4)throw new k;const o=n.readBits(4);if(o>=10)throw new k;r.append(Qe.toAlphaNumericChar(o))}}static parseECIValue(n){const r=n.readBits(8);if(!(r&128))return r&127;if((r&192)===128){const s=n.readBits(8);return(r&63)<<8&4294967295|s}if((r&224)===192){const s=n.readBits(16);return(r&31)<<16&4294967295|s}throw new k}}Qe.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Qe.GB2312_SUBSET=1;class n1{constructor(n){this.mirrored=n}isMirrored(){return this.mirrored}applyMirroredCorrection(n){if(!this.mirrored||n===null||n.length<3)return;const r=n[0];n[0]=n[2],n[2]=r}}class Fh{constructor(){this.rsDecoder=new $i(be.QR_CODE_FIELD_256)}decodeBooleanArray(n,r){return this.decodeBitMatrix(_e.parseFromBooleanArray(n),r)}decodeBitMatrix(n,r){const s=new Lh(n);let o=null;try{return this.decodeBitMatrixParser(s,r)}catch(a){o=a}try{s.remask(),s.setMirror(!0),s.readVersion(),s.readFormatInformation(),s.mirror();const a=this.decodeBitMatrixParser(s,r);return a.setOther(new n1(!0)),a}catch(a){throw o!==null?o:a}}decodeBitMatrixParser(n,r){const s=n.readVersion(),o=n.readFormatInformation().getErrorCorrectionLevel(),a=n.readCodewords(),u=$a.getDataBlocks(a,s,o);let d=0;for(const x of u)d+=x.getNumDataCodewords();const h=new Uint8Array(d);let g=0;for(const x of u){const E=x.getCodewords(),A=x.getNumDataCodewords();this.correctErrors(E,A);for(let I=0;I<A;I++)h[g++]=E[I]}return Qe.decode(h,s,o,r)}correctErrors(n,r){const s=new Int32Array(n);try{this.rsDecoder.decode(s,n.length-r)}catch{throw new M}for(let o=0;o<r;o++)n[o]=s[o]}}class Ja extends oe{constructor(n,r,s){super(n,r),this.estimatedModuleSize=s}aboutEquals(n,r,s){if(Math.abs(r-this.getY())<=n&&Math.abs(s-this.getX())<=n){const o=Math.abs(n-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(n,r,s){const o=(this.getX()+r)/2,a=(this.getY()+n)/2,u=(this.estimatedModuleSize+s)/2;return new Ja(o,a,u)}}class fo{constructor(n,r,s,o,a,u,d){this.image=n,this.startX=r,this.startY=s,this.width=o,this.height=a,this.moduleSize=u,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const n=this.startX,r=this.height,s=this.width,o=n+s,a=this.startY+r/2,u=new Int32Array(3),d=this.image;for(let h=0;h<r;h++){const g=a+(h&1?-Math.floor((h+1)/2):Math.floor((h+1)/2));u[0]=0,u[1]=0,u[2]=0;let x=n;for(;x<o&&!d.get(x,g);)x++;let E=0;for(;x<o;){if(d.get(x,g))if(E===1)u[1]++;else if(E===2){if(this.foundPatternCross(u)){const A=this.handlePossibleCenter(u,g,x);if(A!==null)return A}u[0]=u[2],u[1]=1,u[2]=0,E=1}else u[++E]++;else E===1&&E++,u[E]++;x++}if(this.foundPatternCross(u)){const A=this.handlePossibleCenter(u,g,o);if(A!==null)return A}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new j}static centerFromEnd(n,r){return r-n[2]-n[1]/2}foundPatternCross(n){const r=this.moduleSize,s=r/2;for(let o=0;o<3;o++)if(Math.abs(r-n[o])>=s)return!1;return!0}crossCheckVertical(n,r,s,o){const a=this.image,u=a.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let h=n;for(;h>=0&&a.get(r,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&!a.get(r,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(r,h)&&d[1]<=s;)d[1]++,h++;if(h===u||d[1]>s)return NaN;for(;h<u&&!a.get(r,h)&&d[2]<=s;)d[2]++,h++;if(d[2]>s)return NaN;const g=d[0]+d[1]+d[2];return 5*Math.abs(g-o)>=2*o?NaN:this.foundPatternCross(d)?fo.centerFromEnd(d,h):NaN}handlePossibleCenter(n,r,s){const o=n[0]+n[1]+n[2],a=fo.centerFromEnd(n,s),u=this.crossCheckVertical(r,a,2*n[1],o);if(!isNaN(u)){const d=(n[0]+n[1]+n[2])/3;for(const g of this.possibleCenters)if(g.aboutEquals(d,u,a))return g.combineEstimate(u,a,d);const h=new Ja(a,u,d);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null}}class el extends oe{constructor(n,r,s,o){super(n,r),this.estimatedModuleSize=s,this.count=o,o===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(n,r,s){if(Math.abs(r-this.getY())<=n&&Math.abs(s-this.getX())<=n){const o=Math.abs(n-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(n,r,s){const o=this.count+1,a=(this.count*this.getX()+r)/o,u=(this.count*this.getY()+n)/o,d=(this.count*this.estimatedModuleSize+s)/o;return new el(a,u,d,o)}}class Uh{constructor(n){this.bottomLeft=n[0],this.topLeft=n[1],this.topRight=n[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class yt{constructor(n,r){this.image=n,this.resultPointCallback=r,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=r}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(n){const r=n!=null&&n.get(U.TRY_HARDER)!==void 0,s=n!=null&&n.get(U.PURE_BARCODE)!==void 0,o=this.image,a=o.getHeight(),u=o.getWidth();let d=Math.floor(3*a/(4*yt.MAX_MODULES));(d<yt.MIN_SKIP||r)&&(d=yt.MIN_SKIP);let h=!1;const g=new Int32Array(5);for(let E=d-1;E<a&&!h;E+=d){g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0;let A=0;for(let I=0;I<u;I++)if(o.get(I,E))(A&1)===1&&A++,g[A]++;else if(A&1)g[A]++;else if(A===4)if(yt.foundPatternCross(g)){if(this.handlePossibleCenter(g,E,I,s)===!0)if(d=2,this.hasSkipped===!0)h=this.haveMultiplyConfirmedCenters();else{const D=this.findRowSkip();D>g[2]&&(E+=D-g[2]-d,I=u-1)}else{g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;continue}A=0,g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0}else g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;else g[++A]++;yt.foundPatternCross(g)&&this.handlePossibleCenter(g,E,u,s)===!0&&(d=g[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}const x=this.selectBestPatterns();return oe.orderBestPatterns(x),new Uh(x)}static centerFromEnd(n,r){return r-n[4]-n[3]-n[2]/2}static foundPatternCross(n){let r=0;for(let a=0;a<5;a++){const u=n[a];if(u===0)return!1;r+=u}if(r<7)return!1;const s=r/7,o=s/2;return Math.abs(s-n[0])<o&&Math.abs(s-n[1])<o&&Math.abs(3*s-n[2])<3*o&&Math.abs(s-n[3])<o&&Math.abs(s-n[4])<o}getCrossCheckStateCount(){const n=this.crossCheckStateCount;return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n}crossCheckDiagonal(n,r,s,o){const a=this.getCrossCheckStateCount();let u=0;const d=this.image;for(;n>=u&&r>=u&&d.get(r-u,n-u);)a[2]++,u++;if(n<u||r<u)return!1;for(;n>=u&&r>=u&&!d.get(r-u,n-u)&&a[1]<=s;)a[1]++,u++;if(n<u||r<u||a[1]>s)return!1;for(;n>=u&&r>=u&&d.get(r-u,n-u)&&a[0]<=s;)a[0]++,u++;if(a[0]>s)return!1;const h=d.getHeight(),g=d.getWidth();for(u=1;n+u<h&&r+u<g&&d.get(r+u,n+u);)a[2]++,u++;if(n+u>=h||r+u>=g)return!1;for(;n+u<h&&r+u<g&&!d.get(r+u,n+u)&&a[3]<s;)a[3]++,u++;if(n+u>=h||r+u>=g||a[3]>=s)return!1;for(;n+u<h&&r+u<g&&d.get(r+u,n+u)&&a[4]<s;)a[4]++,u++;if(a[4]>=s)return!1;const x=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(x-o)<2*o&&yt.foundPatternCross(a)}crossCheckVertical(n,r,s,o){const a=this.image,u=a.getHeight(),d=this.getCrossCheckStateCount();let h=n;for(;h>=0&&a.get(r,h);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!a.get(r,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&a.get(r,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(r,h);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!a.get(r,h)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&a.get(r,h)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const g=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(g-o)>=2*o?NaN:yt.foundPatternCross(d)?yt.centerFromEnd(d,h):NaN}crossCheckHorizontal(n,r,s,o){const a=this.image,u=a.getWidth(),d=this.getCrossCheckStateCount();let h=n;for(;h>=0&&a.get(h,r);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!a.get(h,r)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&a.get(h,r)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(h,r);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!a.get(h,r)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&a.get(h,r)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const g=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(g-o)>=o?NaN:yt.foundPatternCross(d)?yt.centerFromEnd(d,h):NaN}handlePossibleCenter(n,r,s,o){const a=n[0]+n[1]+n[2]+n[3]+n[4];let u=yt.centerFromEnd(n,s),d=this.crossCheckVertical(r,Math.floor(u),n[2],a);if(!isNaN(d)&&(u=this.crossCheckHorizontal(Math.floor(u),Math.floor(d),n[2],a),!isNaN(u)&&(!o||this.crossCheckDiagonal(Math.floor(d),Math.floor(u),n[2],a)))){const h=a/7;let g=!1;const x=this.possibleCenters;for(let E=0,A=x.length;E<A;E++){const I=x[E];if(I.aboutEquals(h,d,u)){x[E]=I.combineEstimate(d,u,h),g=!0;break}}if(!g){const E=new el(u,d,h);x.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 r=null;for(const s of this.possibleCenters)if(s.getCount()>=yt.CENTER_QUORUM)if(r==null)r=s;else return this.hasSkipped=!0,Math.floor((Math.abs(r.getX()-s.getX())-Math.abs(r.getY()-s.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let n=0,r=0;const s=this.possibleCenters.length;for(const u of this.possibleCenters)u.getCount()>=yt.CENTER_QUORUM&&(n++,r+=u.getEstimatedModuleSize());if(n<3)return!1;const o=r/s;let a=0;for(const u of this.possibleCenters)a+=Math.abs(u.getEstimatedModuleSize()-o);return a<=.05*r}selectBestPatterns(){const n=this.possibleCenters.length;if(n<3)throw new j;const r=this.possibleCenters;let s;if(n>3){let o=0,a=0;for(const h of this.possibleCenters){const g=h.getEstimatedModuleSize();o+=g,a+=g*g}s=o/n;let u=Math.sqrt(a/n-s*s);r.sort((h,g)=>{const x=Math.abs(g.getEstimatedModuleSize()-s),E=Math.abs(h.getEstimatedModuleSize()-s);return x<E?-1:x>E?1:0});const d=Math.max(.2*s,u);for(let h=0;h<r.length&&r.length>3;h++){const g=r[h];Math.abs(g.getEstimatedModuleSize()-s)>d&&(r.splice(h,1),h--)}}if(r.length>3){let o=0;for(const a of r)o+=a.getEstimatedModuleSize();s=o/r.length,r.sort((a,u)=>{if(u.getCount()===a.getCount()){const d=Math.abs(u.getEstimatedModuleSize()-s),h=Math.abs(a.getEstimatedModuleSize()-s);return d<h?1:d>h?-1:0}else return u.getCount()-a.getCount()}),r.splice(3)}return[r[0],r[1],r[2]]}}yt.CENTER_QUORUM=2,yt.MIN_SKIP=3,yt.MAX_MODULES=57;class es{constructor(n){this.image=n}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(n){this.resultPointCallback=n==null?null:n.get(U.NEED_RESULT_POINT_CALLBACK);const s=new yt(this.image,this.resultPointCallback).find(n);return this.processFinderPatternInfo(s)}processFinderPatternInfo(n){const r=n.getTopLeft(),s=n.getTopRight(),o=n.getBottomLeft(),a=this.calculateModuleSize(r,s,o);if(a<1)throw new j("No pattern found in proccess finder.");const u=es.computeDimension(r,s,o,a),d=ue.getProvisionalVersionForDimension(u),h=d.getDimensionForVersion()-7;let g=null;if(d.getAlignmentPatternCenters().length>0){const I=s.getX()-r.getX()+o.getX(),b=s.getY()-r.getY()+o.getY(),D=1-3/h,L=Math.floor(r.getX()+D*(I-r.getX())),z=Math.floor(r.getY()+D*(b-r.getY()));for(let q=4;q<=16;q<<=1)try{g=this.findAlignmentInRegion(a,L,z,q);break}catch($){if(!($ instanceof j))throw $}}const x=es.createTransform(r,s,o,g,u),E=es.sampleGrid(this.image,x,u);let A;return g===null?A=[o,r,s]:A=[o,r,s,g],new oo(E,A)}static createTransform(n,r,s,o,a){const u=a-3.5;let d,h,g,x;return o!==null?(d=o.getX(),h=o.getY(),g=u-3,x=g):(d=r.getX()-n.getX()+s.getX(),h=r.getY()-n.getY()+s.getY(),g=u,x=u),Cn.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,g,x,3.5,u,n.getX(),n.getY(),r.getX(),r.getY(),d,h,s.getX(),s.getY())}static sampleGrid(n,r,s){return sr.getInstance().sampleGridWithTransform(n,s,s,r)}static computeDimension(n,r,s,o){const a=Te.round(oe.distance(n,r)/o),u=Te.round(oe.distance(n,s)/o);let d=Math.floor((a+u)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new j("Dimensions could be not found.")}return d}calculateModuleSize(n,r,s){return(this.calculateModuleSizeOneWay(n,r)+this.calculateModuleSizeOneWay(n,s))/2}calculateModuleSizeOneWay(n,r){const s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(n.getX()),Math.floor(n.getY()),Math.floor(r.getX()),Math.floor(r.getY())),o=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(r.getX()),Math.floor(r.getY()),Math.floor(n.getX()),Math.floor(n.getY()));return isNaN(s)?o/7:isNaN(o)?s/7:(s+o)/14}sizeOfBlackWhiteBlackRunBothWays(n,r,s,o){let a=this.sizeOfBlackWhiteBlackRun(n,r,s,o),u=1,d=n-(s-n);d<0?(u=n/(n-d),d=0):d>=this.image.getWidth()&&(u=(this.image.getWidth()-1-n)/(d-n),d=this.image.getWidth()-1);let h=Math.floor(r-(o-r)*u);return u=1,h<0?(u=r/(r-h),h=0):h>=this.image.getHeight()&&(u=(this.image.getHeight()-1-r)/(h-r),h=this.image.getHeight()-1),d=Math.floor(n+(d-n)*u),a+=this.sizeOfBlackWhiteBlackRun(n,r,d,h),a-1}sizeOfBlackWhiteBlackRun(n,r,s,o){const a=Math.abs(o-r)>Math.abs(s-n);if(a){let I=n;n=r,r=I,I=s,s=o,o=I}const u=Math.abs(s-n),d=Math.abs(o-r);let h=-u/2;const g=n<s?1:-1,x=r<o?1:-1;let E=0;const A=s+g;for(let I=n,b=r;I!==A;I+=g){const D=a?b:I,L=a?I:b;if(E===1===this.image.get(D,L)){if(E===2)return Te.distance(I,b,n,r);E++}if(h+=d,h>0){if(b===o)break;b+=x,h-=u}}return E===2?Te.distance(s+g,o,n,r):NaN}findAlignmentInRegion(n,r,s,o){const a=Math.floor(o*n),u=Math.max(0,r-a),d=Math.min(this.image.getWidth()-1,r+a);if(d-u<n*3)throw new j("Alignment top exceeds estimated module size.");const h=Math.max(0,s-a),g=Math.min(this.image.getHeight()-1,s+a);if(g-h<n*3)throw new j("Alignment bottom exceeds estimated module size.");return new fo(this.image,u,h,d-u,g-h,n,this.resultPointCallback).find()}}class ur{constructor(){this.decoder=new Fh}getDecoder(){return this.decoder}decode(n,r){let s,o;if(r!=null&&r.get(U.PURE_BARCODE)!==void 0){const h=ur.extractPureBits(n.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,r),o=ur.NO_POINTS}else{const h=new es(n.getBlackMatrix()).detect(r);s=this.decoder.decodeBitMatrix(h.getBits(),r),o=h.getPoints()}s.getOther()instanceof n1&&s.getOther().applyMirroredCorrection(o);const a=new Ke(s.getText(),s.getRawBytes(),void 0,o,le.QR_CODE,void 0),u=s.getByteSegments();u!==null&&a.putMetadata(mt.BYTE_SEGMENTS,u);const d=s.getECLevel();return d!==null&&a.putMetadata(mt.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(a.putMetadata(mt.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),a.putMetadata(mt.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),a}reset(){}static extractPureBits(n){const r=n.getTopLeftOnBit(),s=n.getBottomRightOnBit();if(r===null||s===null)throw new j;const o=this.moduleSize(r,n);let a=r[1],u=s[1],d=r[0],h=s[0];if(d>=h||a>=u)throw new j;if(u-a!==h-d&&(h=d+(u-a),h>=n.getWidth()))throw new j;const g=Math.round((h-d+1)/o),x=Math.round((u-a+1)/o);if(g<=0||x<=0)throw new j;if(x!==g)throw new j;const E=Math.floor(o/2);a+=E,d+=E;const A=d+Math.floor((g-1)*o)-h;if(A>0){if(A>E)throw new j;d-=A}const I=a+Math.floor((x-1)*o)-u;if(I>0){if(I>E)throw new j;a-=I}const b=new _e(g,x);for(let D=0;D<x;D++){const L=a+Math.floor(D*o);for(let z=0;z<g;z++)n.get(d+Math.floor(z*o),L)&&b.set(z,D)}return b}static moduleSize(n,r){const s=r.getHeight(),o=r.getWidth();let a=n[0],u=n[1],d=!0,h=0;for(;a<o&&u<s;){if(d!==r.get(a,u)){if(++h===5)break;d=!d}a++,u++}if(a===o||u===s)throw new j;return(a-n[0])/7}}ur.NO_POINTS=new Array;class he{PDF417Common(){}static getBitCountSum(n){return Te.sum(n)}static toIntArray(n){if(n==null||!n.length)return he.EMPTY_INT_ARRAY;const r=new Int32Array(n.length);let s=0;for(const o of n)r[s++]=o;return r}static getCodeword(n){const r=T.binarySearch(he.SYMBOL_TABLE,n&262143);return r<0?-1:(he.CODEWORD_TABLE[r]-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 Wh{constructor(n,r){this.bits=n,this.points=r}getBits(){return this.bits}getPoints(){return this.points}}class we{static detectMultiple(n,r,s){let o=n.getBlackMatrix(),a=we.detect(s,o);return a.length||(o=o.clone(),o.rotate180(),a=we.detect(s,o)),new Wh(o,a)}static detect(n,r){const s=new Array;let o=0,a=0,u=!1;for(;o<r.getHeight();){const d=we.findVertices(r,o,a);if(d[0]==null&&d[3]==null){if(!u)break;u=!1,a=0;for(const h of s)h[1]!=null&&(o=Math.trunc(Math.max(o,h[1].getY()))),h[3]!=null&&(o=Math.max(o,Math.trunc(h[3].getY())));o+=we.ROW_STEP;continue}if(u=!0,s.push(d),!n)break;d[2]!=null?(a=Math.trunc(d[2].getX()),o=Math.trunc(d[2].getY())):(a=Math.trunc(d[4].getX()),o=Math.trunc(d[4].getY()))}return s}static findVertices(n,r,s){const o=n.getHeight(),a=n.getWidth(),u=new Array(8);return we.copyToResult(u,we.findRowsWithPattern(n,o,a,r,s,we.START_PATTERN),we.INDEXES_START_PATTERN),u[4]!=null&&(s=Math.trunc(u[4].getX()),r=Math.trunc(u[4].getY())),we.copyToResult(u,we.findRowsWithPattern(n,o,a,r,s,we.STOP_PATTERN),we.INDEXES_STOP_PATTERN),u}static copyToResult(n,r,s){for(let o=0;o<s.length;o++)n[s[o]]=r[o]}static findRowsWithPattern(n,r,s,o,a,u){const d=new Array(4);let h=!1;const g=new Int32Array(u.length);for(;o<r;o+=we.ROW_STEP){let E=we.findGuardPattern(n,a,o,s,!1,u,g);if(E!=null){for(;o>0;){const A=we.findGuardPattern(n,a,--o,s,!1,u,g);if(A!=null)E=A;else{o++;break}}d[0]=new oe(E[0],o),d[1]=new oe(E[1],o),h=!0;break}}let x=o+1;if(h){let E=0,A=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;x<r;x++){const I=we.findGuardPattern(n,A[0],x,s,!1,u,g);if(I!=null&&Math.abs(A[0]-I[0])<we.MAX_PATTERN_DRIFT&&Math.abs(A[1]-I[1])<we.MAX_PATTERN_DRIFT)A=I,E=0;else{if(E>we.SKIPPED_ROW_COUNT_MAX)break;E++}}x-=E+1,d[2]=new oe(A[0],x),d[3]=new oe(A[1],x)}return x-o<we.BARCODE_MIN_HEIGHT&&T.fill(d,null),d}static findGuardPattern(n,r,s,o,a,u,d){T.fillWithin(d,0,d.length,0);let h=r,g=0;for(;n.get(h,s)&&h>0&&g++<we.MAX_PIXEL_DRIFT;)h--;let x=h,E=0,A=u.length;for(let I=a;x<o;x++)if(n.get(x,s)!==I)d[E]++;else{if(E===A-1){if(we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE)return new Int32Array([h,x]);h+=d[0]+d[1],B.arraycopy(d,2,d,0,E-1),d[E-1]=0,d[E]=0,E--}else E++;d[E]=1,I=!I}return E===A-1&&we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE?new Int32Array([h,x-1]):null}static patternMatchVariance(n,r,s){let o=n.length,a=0,u=0;for(let g=0;g<o;g++)a+=n[g],u+=r[g];if(a<u)return 1/0;let d=a/u;s*=d;let h=0;for(let g=0;g<o;g++){let x=n[g],E=r[g]*d,A=x>E?x-E:E-x;if(A>s)return 1/0;h+=A}return h/a}}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 St{constructor(n,r){if(r.length===0)throw new v;this.field=n;let s=r.length;if(s>1&&r[0]===0){let o=1;for(;o<s&&r[o]===0;)o++;o===s?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(s-o),B.arraycopy(r,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=r}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(n){return this.coefficients[this.coefficients.length-1-n]}evaluateAt(n){if(n===0)return this.getCoefficient(0);if(n===1){let o=0;for(let a of this.coefficients)o=this.field.add(o,a);return o}let r=this.coefficients[0],s=this.coefficients.length;for(let o=1;o<s;o++)r=this.field.add(this.field.multiply(n,r),this.coefficients[o]);return r}add(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");if(this.isZero())return n;if(n.isZero())return this;let r=this.coefficients,s=n.coefficients;if(r.length>s.length){let u=r;r=s,s=u}let o=new Int32Array(s.length),a=s.length-r.length;B.arraycopy(s,0,o,0,a);for(let u=a;u<s.length;u++)o[u]=this.field.add(r[u-a],s[u]);return new St(this.field,o)}subtract(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");return n.isZero()?this:this.add(n.negative())}multiply(n){return n instanceof St?this.multiplyOther(n):this.multiplyScalar(n)}multiplyOther(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");if(this.isZero()||n.isZero())return new St(this.field,new Int32Array([0]));let r=this.coefficients,s=r.length,o=n.coefficients,a=o.length,u=new Int32Array(s+a-1);for(let d=0;d<s;d++){let h=r[d];for(let g=0;g<a;g++)u[d+g]=this.field.add(u[d+g],this.field.multiply(h,o[g]))}return new St(this.field,u)}negative(){let n=this.coefficients.length,r=new Int32Array(n);for(let s=0;s<n;s++)r[s]=this.field.subtract(0,this.coefficients[s]);return new St(this.field,r)}multiplyScalar(n){if(n===0)return new St(this.field,new Int32Array([0]));if(n===1)return this;let r=this.coefficients.length,s=new Int32Array(r);for(let o=0;o<r;o++)s[o]=this.field.multiply(this.coefficients[o],n);return new St(this.field,s)}multiplyByMonomial(n,r){if(n<0)throw new v;if(r===0)return new St(this.field,new Int32Array([0]));let s=this.coefficients.length,o=new Int32Array(s+n);for(let a=0;a<s;a++)o[a]=this.field.multiply(this.coefficients[a],r);return new St(this.field,o)}toString(){let n=new ge;for(let r=this.getDegree();r>=0;r--){let s=this.getCoefficient(r);s!==0&&(s<0?(n.append(" - "),s=-s):n.length()>0&&n.append(" + "),(r===0||s!==1)&&n.append(s),r!==0&&(r===1?n.append("x"):(n.append("x^"),n.append(r))))}return n.toString()}}class zh{add(n,r){return(n+r)%this.modulus}subtract(n,r){return(this.modulus+n-r)%this.modulus}exp(n){return this.expTable[n]}log(n){if(n===0)throw new v;return this.logTable[n]}inverse(n){if(n===0)throw new io;return this.expTable[this.modulus-this.logTable[n]-1]}multiply(n,r){return n===0||r===0?0:this.expTable[(this.logTable[n]+this.logTable[r])%(this.modulus-1)]}getSize(){return this.modulus}equals(n){return n===this}}class tl extends zh{constructor(n,r){super(),this.modulus=n,this.expTable=new Int32Array(n),this.logTable=new Int32Array(n);let s=1;for(let o=0;o<n;o++)this.expTable[o]=s,s=s*r%n;for(let o=0;o<n-1;o++)this.logTable[this.expTable[o]]=o;this.zero=new St(this,new Int32Array([0])),this.one=new St(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(n,r){if(n<0)throw new v;if(r===0)return this.zero;let s=new Int32Array(n+1);return s[0]=r,new St(this,s)}}tl.PDF417_GF=new tl(he.NUMBER_OF_CODEWORDS,3);class r1{constructor(){this.field=tl.PDF417_GF}decode(n,r,s){let o=new St(this.field,n),a=new Int32Array(r),u=!1;for(let b=r;b>0;b--){let D=o.evaluateAt(this.field.exp(b));a[r-b]=D,D!==0&&(u=!0)}if(!u)return 0;let d=this.field.getOne();if(s!=null)for(const b of s){let D=this.field.exp(n.length-1-b),L=new St(this.field,new Int32Array([this.field.subtract(0,D),1]));d=d.multiply(L)}let h=new St(this.field,a),g=this.runEuclideanAlgorithm(this.field.buildMonomial(r,1),h,r),x=g[0],E=g[1],A=this.findErrorLocations(x),I=this.findErrorMagnitudes(E,x,A);for(let b=0;b<A.length;b++){let D=n.length-1-this.field.log(A[b]);if(D<0)throw M.getChecksumInstance();n[D]=this.field.subtract(n[D],I[b])}return A.length}runEuclideanAlgorithm(n,r,s){if(n.getDegree()<r.getDegree()){let A=n;n=r,r=A}let o=n,a=r,u=this.field.getZero(),d=this.field.getOne();for(;a.getDegree()>=Math.round(s/2);){let A=o,I=u;if(o=a,u=d,o.isZero())throw M.getChecksumInstance();a=A;let b=this.field.getZero(),D=o.getCoefficient(o.getDegree()),L=this.field.inverse(D);for(;a.getDegree()>=o.getDegree()&&!a.isZero();){let z=a.getDegree()-o.getDegree(),q=this.field.multiply(a.getCoefficient(a.getDegree()),L);b=b.add(this.field.buildMonomial(z,q)),a=a.subtract(o.multiplyByMonomial(z,q))}d=b.multiply(u).subtract(I).negative()}let h=d.getCoefficient(0);if(h===0)throw M.getChecksumInstance();let g=this.field.inverse(h),x=d.multiply(g),E=a.multiply(g);return[x,E]}findErrorLocations(n){let r=n.getDegree(),s=new Int32Array(r),o=0;for(let a=1;a<this.field.getSize()&&o<r;a++)n.evaluateAt(a)===0&&(s[o]=this.field.inverse(a),o++);if(o!==r)throw M.getChecksumInstance();return s}findErrorMagnitudes(n,r,s){let o=r.getDegree(),a=new Int32Array(o);for(let g=1;g<=o;g++)a[o-g]=this.field.multiply(g,r.getCoefficient(g));let u=new St(this.field,a),d=s.length,h=new Int32Array(d);for(let g=0;g<d;g++){let x=this.field.inverse(s[g]),E=this.field.subtract(0,n.evaluateAt(x)),A=this.field.inverse(u.evaluateAt(x));h[g]=this.field.multiply(E,A)}return h}}class Fr{constructor(n,r,s,o,a){n instanceof Fr?this.constructor_2(n):this.constructor_1(n,r,s,o,a)}constructor_1(n,r,s,o,a){const u=r==null||s==null,d=o==null||a==null;if(u&&d)throw new j;u?(r=new oe(0,o.getY()),s=new oe(0,a.getY())):d&&(o=new oe(n.getWidth()-1,r.getY()),a=new oe(n.getWidth()-1,s.getY())),this.image=n,this.topLeft=r,this.bottomLeft=s,this.topRight=o,this.bottomRight=a,this.minX=Math.trunc(Math.min(r.getX(),s.getX())),this.maxX=Math.trunc(Math.max(o.getX(),a.getX())),this.minY=Math.trunc(Math.min(r.getY(),o.getY())),this.maxY=Math.trunc(Math.max(s.getY(),a.getY()))}constructor_2(n){this.image=n.image,this.topLeft=n.getTopLeft(),this.bottomLeft=n.getBottomLeft(),this.topRight=n.getTopRight(),this.bottomRight=n.getBottomRight(),this.minX=n.getMinX(),this.maxX=n.getMaxX(),this.minY=n.getMinY(),this.maxY=n.getMaxY()}static merge(n,r){return n==null?r:r==null?n:new Fr(n.image,n.topLeft,n.bottomLeft,r.topRight,r.bottomRight)}addMissingRows(n,r,s){let o=this.topLeft,a=this.bottomLeft,u=this.topRight,d=this.bottomRight;if(n>0){let h=s?this.topLeft:this.topRight,g=Math.trunc(h.getY()-n);g<0&&(g=0);let x=new oe(h.getX(),g);s?o=x:u=x}if(r>0){let h=s?this.bottomLeft:this.bottomRight,g=Math.trunc(h.getY()+r);g>=this.image.getHeight()&&(g=this.image.getHeight()-1);let x=new oe(h.getX(),g);s?a=x:d=x}return new Fr(this.image,o,a,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 Vh{constructor(n,r,s,o){this.columnCount=n,this.errorCorrectionLevel=o,this.rowCountUpperPart=r,this.rowCountLowerPart=s,this.rowCount=r+s}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class ts{constructor(){this.buffer=""}static form(n,r){let s=-1;function o(u,d,h,g,x,E){if(u==="%%")return"%";if(r[++s]===void 0)return;u=g?parseInt(g.substr(1)):void 0;let A=x?parseInt(x.substr(1)):void 0,I;switch(E){case"s":I=r[s];break;case"c":I=r[s][0];break;case"f":I=parseFloat(r[s]).toFixed(u);break;case"p":I=parseFloat(r[s]).toPrecision(u);break;case"e":I=parseFloat(r[s]).toExponential(u);break;case"x":I=parseInt(r[s]).toString(A||16);break;case"d":I=parseFloat(parseInt(r[s],A||10).toPrecision(u)).toFixed(0);break}I=typeof I=="object"?JSON.stringify(I):(+I).toString(A);let b=parseInt(h),D=h&&h[0]+""=="0"?"0":" ";for(;I.length<b;)I=d!==void 0?I+D:D+I;return I}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return n.replace(a,o)}format(n,...r){this.buffer+=ts.form(n,r)}toString(){return this.buffer}}class ns{constructor(n){this.boundingBox=new Fr(n),this.codewords=new Array(n.getMaxY()-n.getMinY()+1)}getCodewordNearby(n){let r=this.getCodeword(n);if(r!=null)return r;for(let s=1;s<ns.MAX_NEARBY_DISTANCE;s++){let o=this.imageRowToCodewordIndex(n)-s;if(o>=0&&(r=this.codewords[o],r!=null)||(o=this.imageRowToCodewordIndex(n)+s,o<this.codewords.length&&(r=this.codewords[o],r!=null)))return r}return null}imageRowToCodewordIndex(n){return n-this.boundingBox.getMinY()}setCodeword(n,r){this.codewords[this.imageRowToCodewordIndex(n)]=r}getCodeword(n){return this.codewords[this.imageRowToCodewordIndex(n)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const n=new ts;let r=0;for(const s of this.codewords){if(s==null){n.format("%3d: | %n",r++);continue}n.format("%3d: %3d|%3d%n",r++,s.getRowNumber(),s.getValue())}return n.toString()}}ns.MAX_NEARBY_DISTANCE=5;class rs{constructor(){this.values=new Map}setValue(n){n=Math.trunc(n);let r=this.values.get(n);r==null&&(r=0),r++,this.values.set(n,r)}getValue(){let n=-1,r=new Array;for(const[s,o]of this.values.entries()){const a={getKey:()=>s,getValue:()=>o};a.getValue()>n?(n=a.getValue(),r=[],r.push(a.getKey())):a.getValue()===n&&r.push(a.getKey())}return he.toIntArray(r)}getConfidence(n){return this.values.get(n)}}class i1 extends ns{constructor(n,r){super(n),this._isLeft=r}setRowNumbers(){for(let n of this.getCodewords())n!=null&&n.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(n){let r=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(r,n);let s=this.getBoundingBox(),o=this._isLeft?s.getTopLeft():s.getTopRight(),a=this._isLeft?s.getBottomLeft():s.getBottomRight(),u=this.imageRowToCodewordIndex(Math.trunc(o.getY())),d=this.imageRowToCodewordIndex(Math.trunc(a.getY())),h=-1,g=1,x=0;for(let E=u;E<d;E++){if(r[E]==null)continue;let A=r[E],I=A.getRowNumber()-h;if(I===0)x++;else if(I===1)g=Math.max(g,x),x=1,h=A.getRowNumber();else if(I<0||A.getRowNumber()>=n.getRowCount()||I>E)r[E]=null;else{let b;g>2?b=(g-2)*I:b=I;let D=b>=E;for(let L=1;L<=b&&!D;L++)D=r[E-L]!=null;D?r[E]=null:(h=A.getRowNumber(),x=1)}}}getRowHeights(){let n=this.getBarcodeMetadata();if(n==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(n);let r=new Int32Array(n.getRowCount());for(let s of this.getCodewords())if(s!=null){let o=s.getRowNumber();if(o>=r.length)continue;r[o]++}return r}adjustIncompleteIndicatorColumnRowNumbers(n){let r=this.getBoundingBox(),s=this._isLeft?r.getTopLeft():r.getTopRight(),o=this._isLeft?r.getBottomLeft():r.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(s.getY())),u=this.imageRowToCodewordIndex(Math.trunc(o.getY())),d=this.getCodewords(),h=-1;for(let g=a;g<u;g++){if(d[g]==null)continue;let x=d[g];x.setRowNumberAsRowIndicatorColumn();let E=x.getRowNumber()-h;E===0||(E===1?h=x.getRowNumber():x.getRowNumber()>=n.getRowCount()?d[g]=null:h=x.getRowNumber())}}getBarcodeMetadata(){let n=this.getCodewords(),r=new rs,s=new rs,o=new rs,a=new rs;for(let d of n){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let h=d.getValue()%30,g=d.getRowNumber();switch(this._isLeft||(g+=2),g%3){case 0:s.setValue(h*3+1);break;case 1:a.setValue(h/3),o.setValue(h%3);break;case 2:r.setValue(h+1);break}}if(r.getValue().length===0||s.getValue().length===0||o.getValue().length===0||a.getValue().length===0||r.getValue()[0]<1||s.getValue()[0]+o.getValue()[0]<he.MIN_ROWS_IN_BARCODE||s.getValue()[0]+o.getValue()[0]>he.MAX_ROWS_IN_BARCODE)return null;let u=new Vh(r.getValue()[0],s.getValue()[0],o.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(n,u),u}removeIncorrectCodewords(n,r){for(let s=0;s<n.length;s++){let o=n[s];if(n[s]==null)continue;let a=o.getValue()%30,u=o.getRowNumber();if(u>r.getRowCount()){n[s]=null;continue}switch(this._isLeft||(u+=2),u%3){case 0:a*3+1!==r.getRowCountUpperPart()&&(n[s]=null);break;case 1:(Math.trunc(a/3)!==r.getErrorCorrectionLevel()||a%3!==r.getRowCountLowerPart())&&(n[s]=null);break;case 2:a+1!==r.getColumnCount()&&(n[s]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
65
- `+super.toString()}}class is{constructor(n,r){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=n,this.barcodeColumnCount=n.getColumnCount(),this.boundingBox=r,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let n=he.MAX_CODEWORDS_IN_BARCODE,r;do r=n,n=this.adjustRowNumbersAndGetCount();while(n>0&&n<r);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(n){n!=null&&n.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let n=this.adjustRowNumbersByRow();if(n===0)return 0;for(let r=1;r<this.barcodeColumnCount+1;r++){let s=this.detectionResultColumns[r].getCodewords();for(let o=0;o<s.length;o++)s[o]!=null&&(s[o].hasValidRowNumber()||this.adjustRowNumbers(r,o,s))}return n}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let n=this.detectionResultColumns[0].getCodewords(),r=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<n.length;s++)if(n[s]!=null&&r[s]!=null&&n[s].getRowNumber()===r[s].getRowNumber())for(let o=1;o<=this.barcodeColumnCount;o++){let a=this.detectionResultColumns[o].getCodewords()[s];a!=null&&(a.setRowNumber(n[s].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[o].getCodewords()[s]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let n=0,r=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<r.length;s++){if(r[s]==null)continue;let o=r[s].getRowNumber(),a=0;for(let u=this.barcodeColumnCount+1;u>0&&a<this.ADJUST_ROW_NUMBER_SKIP;u--){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(a=is.adjustRowNumberIfValid(o,a,d),d.hasValidRowNumber()||n++)}}return n}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let n=0,r=this.detectionResultColumns[0].getCodewords();for(let s=0;s<r.length;s++){if(r[s]==null)continue;let o=r[s].getRowNumber(),a=0;for(let u=1;u<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;u++){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(a=is.adjustRowNumberIfValid(o,a,d),d.hasValidRowNumber()||n++)}}return n}static adjustRowNumberIfValid(n,r,s){return s==null||s.hasValidRowNumber()||(s.isValidRowNumber(n)?(s.setRowNumber(n),r=0):++r),r}adjustRowNumbers(n,r,s){if(!this.detectionResultColumns[n-1])return;let o=s[r],a=this.detectionResultColumns[n-1].getCodewords(),u=a;this.detectionResultColumns[n+1]!=null&&(u=this.detectionResultColumns[n+1].getCodewords());let d=new Array(14);d[2]=a[r],d[3]=u[r],r>0&&(d[0]=s[r-1],d[4]=a[r-1],d[5]=u[r-1]),r>1&&(d[8]=s[r-2],d[10]=a[r-2],d[11]=u[r-2]),r<s.length-1&&(d[1]=s[r+1],d[6]=a[r+1],d[7]=u[r+1]),r<s.length-2&&(d[9]=s[r+2],d[12]=a[r+2],d[13]=u[r+2]);for(let h of d)if(is.adjustRowNumber(o,h))return}static adjustRowNumber(n,r){return r==null?!1:r.hasValidRowNumber()&&r.getBucket()===n.getBucket()?(n.setRowNumber(r.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(n){this.boundingBox=n}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(n,r){this.detectionResultColumns[n]=r}getDetectionResultColumn(n){return this.detectionResultColumns[n]}toString(){let n=this.detectionResultColumns[0];n==null&&(n=this.detectionResultColumns[this.barcodeColumnCount+1]);let r=new ts;for(let s=0;s<n.getCodewords().length;s++){r.format("CW %3d:",s);for(let o=0;o<this.barcodeColumnCount+2;o++){if(this.detectionResultColumns[o]==null){r.format(" | ");continue}let a=this.detectionResultColumns[o].getCodewords()[s];if(a==null){r.format(" | ");continue}r.format(" %3d|%3d",a.getRowNumber(),a.getValue())}r.format("%n")}return r.toString()}}class ss{constructor(n,r,s,o){this.rowNumber=ss.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(n),this.endX=Math.trunc(r),this.bucket=Math.trunc(s),this.value=Math.trunc(o)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(n){return n!==ss.BARCODE_ROW_UNKNOWN&&this.bucket===n%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(n){this.rowNumber=n}toString(){return this.rowNumber+"|"+this.value}}ss.BARCODE_ROW_UNKNOWN=-1;class Xt{static initialize(){for(let n=0;n<he.SYMBOL_TABLE.length;n++){let r=he.SYMBOL_TABLE[n],s=r&1;for(let o=0;o<he.BARS_IN_MODULE;o++){let a=0;for(;(r&1)===s;)a+=1,r>>=1;s=r&1,Xt.RATIOS_TABLE[n]||(Xt.RATIOS_TABLE[n]=new Array(he.BARS_IN_MODULE)),Xt.RATIOS_TABLE[n][he.BARS_IN_MODULE-o-1]=Math.fround(a/he.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(n){let r=Xt.getDecodedCodewordValue(Xt.sampleBitCounts(n));return r!==-1?r:Xt.getClosestDecodedValue(n)}static sampleBitCounts(n){let r=Te.sum(n),s=new Int32Array(he.BARS_IN_MODULE),o=0,a=0;for(let u=0;u<he.MODULES_IN_CODEWORD;u++){let d=r/(2*he.MODULES_IN_CODEWORD)+u*r/he.MODULES_IN_CODEWORD;a+n[o]<=d&&(a+=n[o],o++),s[o]++}return s}static getDecodedCodewordValue(n){let r=Xt.getBitValue(n);return he.getCodeword(r)===-1?-1:r}static getBitValue(n){let r=0;for(let s=0;s<n.length;s++)for(let o=0;o<n[s];o++)r=r<<1|(s%2===0?1:0);return Math.trunc(r)}static getClosestDecodedValue(n){let r=Te.sum(n),s=new Array(he.BARS_IN_MODULE);if(r>1)for(let u=0;u<s.length;u++)s[u]=Math.fround(n[u]/r);let o=so.MAX_VALUE,a=-1;this.bSymbolTableReady||Xt.initialize();for(let u=0;u<Xt.RATIOS_TABLE.length;u++){let d=0,h=Xt.RATIOS_TABLE[u];for(let g=0;g<he.BARS_IN_MODULE;g++){let x=Math.fround(h[g]-s[g]);if(d+=Math.fround(x*x),d>=o)break}d<o&&(o=d,a=he.SYMBOL_TABLE[u])}return a}}Xt.bSymbolTableReady=!1,Xt.RATIOS_TABLE=new Array(he.SYMBOL_TABLE.length).map(y=>new Array(he.BARS_IN_MODULE));class s1{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(n){this.segmentIndex=n}getFileId(){return this.fileId}setFileId(n){this.fileId=n}getOptionalData(){return this.optionalData}setOptionalData(n){this.optionalData=n}isLastSegment(){return this.lastSegment}setLastSegment(n){this.lastSegment=n}getSegmentCount(){return this.segmentCount}setSegmentCount(n){this.segmentCount=n}getSender(){return this.sender||null}setSender(n){this.sender=n}getAddressee(){return this.addressee||null}setAddressee(n){this.addressee=n}getFileName(){return this.fileName}setFileName(n){this.fileName=n}getFileSize(){return this.fileSize}setFileSize(n){this.fileSize=n}getChecksum(){return this.checksum}setChecksum(n){this.checksum=n}getTimestamp(){return this.timestamp}setTimestamp(n){this.timestamp=n}}class o1{static parseLong(n,r=void 0){return parseInt(n,r)}}class a1 extends m{}a1.kind="NullPointerException";class Hh{writeBytes(n){this.writeBytesOffset(n,0,n.length)}writeBytesOffset(n,r,s){if(n==null)throw new a1;if(r<0||r>n.length||s<0||r+s>n.length||r+s<0)throw new K;if(s===0)return;for(let o=0;o<s;o++)this.write(n[r+o])}flush(){}close(){}}class jh extends m{}class Gh extends Hh{constructor(n=32){if(super(),this.count=0,n<0)throw new v("Negative initial size: "+n);this.buf=new Uint8Array(n)}ensureCapacity(n){n-this.buf.length>0&&this.grow(n)}grow(n){let s=this.buf.length<<1;if(s-n<0&&(s=n),s<0){if(n<0)throw new jh;s=N.MAX_VALUE}this.buf=T.copyOfUint8Array(this.buf,s)}write(n){this.ensureCapacity(this.count+1),this.buf[this.count]=n,this.count+=1}writeBytesOffset(n,r,s){if(r<0||r>n.length||s<0||r+s-n.length>0)throw new K;this.ensureCapacity(this.count+s),B.arraycopy(n,r,this.buf,this.count,s),this.count+=s}writeTo(n){n.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return T.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(n){return n?typeof n=="string"?this.toString_string(n):this.toString_number(n):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(n){return new String(this.buf).toString()}toString_number(n){return new String(this.buf).toString()}close(){}}var Pe;(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"})(Pe||(Pe={}));function l1(){if(typeof window<"u")return window.BigInt||null;if(typeof ls<"u")return ls.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ho;function cr(y){if(typeof ho>"u"&&(ho=l1()),ho===null)throw new Error("BigInt is not supported!");return ho(y)}function Xh(){let y=[];y[0]=cr(1);let n=cr(900);y[1]=n;for(let r=2;r<16;r++)y[r]=y[r-1]*n;return y}class W{static decode(n,r){let s=new ge(""),o=V.ISO8859_1;s.enableDecoding(o);let a=1,u=n[a++],d=new s1;for(;a<n[0];){switch(u){case W.TEXT_COMPACTION_MODE_LATCH:a=W.textCompaction(n,a,s);break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:a=W.byteCompaction(u,n,o,a,s);break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(n[a++]);break;case W.NUMERIC_COMPACTION_MODE_LATCH:a=W.numericCompaction(n,a,s);break;case W.ECI_CHARSET:V.getCharacterSetECIByValue(n[a++]);break;case W.ECI_GENERAL_PURPOSE:a+=2;break;case W.ECI_USER_DEFINED:a++;break;case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=W.decodeMacroBlock(n,a,d);break;case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:throw new k;default:a--,a=W.textCompaction(n,a,s);break}if(a<n.length)u=n[a++];else throw k.getFormatInstance()}if(s.length()===0)throw k.getFormatInstance();let h=new Qi(null,s.toString(),null,r);return h.setOther(d),h}static decodeMacroBlock(n,r,s){if(r+W.NUMBER_OF_SEQUENCE_CODEWORDS>n[0])throw k.getFormatInstance();let o=new Int32Array(W.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<W.NUMBER_OF_SEQUENCE_CODEWORDS;d++,r++)o[d]=n[r];s.setSegmentIndex(N.parseInt(W.decodeBase900toBase10(o,W.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new ge;r=W.textCompaction(n,r,a),s.setFileId(a.toString());let u=-1;for(n[r]===W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(u=r+1);r<n[0];)switch(n[r]){case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(r++,n[r]){case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new ge;r=W.textCompaction(n,r+1,d),s.setFileName(d.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let h=new ge;r=W.textCompaction(n,r+1,h),s.setSender(h.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let g=new ge;r=W.textCompaction(n,r+1,g),s.setAddressee(g.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let x=new ge;r=W.numericCompaction(n,r+1,x),s.setSegmentCount(N.parseInt(x.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new ge;r=W.numericCompaction(n,r+1,E),s.setTimestamp(o1.parseLong(E.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let A=new ge;r=W.numericCompaction(n,r+1,A),s.setChecksum(N.parseInt(A.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let I=new ge;r=W.numericCompaction(n,r+1,I),s.setFileSize(o1.parseLong(I.toString()));break;default:throw k.getFormatInstance()}break;case W.MACRO_PDF417_TERMINATOR:r++,s.setLastSegment(!0);break;default:throw k.getFormatInstance()}if(u!==-1){let d=r-u;s.isLastSegment()&&d--,s.setOptionalData(T.copyOfRange(n,u,u+d))}return r}static textCompaction(n,r,s){let o=new Int32Array((n[0]-r)*2),a=new Int32Array((n[0]-r)*2),u=0,d=!1;for(;r<n[0]&&!d;){let h=n[r++];if(h<W.TEXT_COMPACTION_MODE_LATCH)o[u]=h/30,o[u+1]=h%30,u+=2;else switch(h){case W.TEXT_COMPACTION_MODE_LATCH:o[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:r--,d=!0;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o[u]=W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,h=n[r++],a[u]=h,u++;break}}return W.decodeTextCompaction(o,a,u,s),r}static decodeTextCompaction(n,r,s,o){let a=Pe.ALPHA,u=Pe.ALPHA,d=0;for(;d<s;){let h=n[d],g="";switch(a){case Pe.ALPHA:if(h<26)g=String.fromCharCode(65+h);else switch(h){case 26:g=" ";break;case W.LL:a=Pe.LOWER;break;case W.ML:a=Pe.MIXED;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.LOWER:if(h<26)g=String.fromCharCode(97+h);else switch(h){case 26:g=" ";break;case W.AS:u=a,a=Pe.ALPHA_SHIFT;break;case W.ML:a=Pe.MIXED;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.MIXED:if(h<W.PL)g=W.MIXED_CHARS[h];else switch(h){case W.PL:a=Pe.PUNCT;break;case 26:g=" ";break;case W.LL:a=Pe.LOWER;break;case W.AL:a=Pe.ALPHA;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.PUNCT:if(h<W.PAL)g=W.PUNCT_CHARS[h];else switch(h){case W.PAL:a=Pe.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.ALPHA_SHIFT:if(a=u,h<26)g=String.fromCharCode(65+h);else switch(h){case 26:g=" ";break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.PUNCT_SHIFT:if(a=u,h<W.PAL)g=W.PUNCT_CHARS[h];else switch(h){case W.PAL:a=Pe.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break}g!==""&&o.append(g),d++}}static byteCompaction(n,r,s,o,a){let u=new Gh,d=0,h=0,g=!1;switch(n){case W.BYTE_COMPACTION_MODE_LATCH:let x=new Int32Array(6),E=r[o++];for(;o<r[0]&&!g;)switch(x[d++]=E,h=900*h+E,E=r[o++],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:o--,g=!0;break;default:if(d%5===0&&d>0){for(let A=0;A<6;++A)u.write(Number(cr(h)>>cr(8*(5-A))));h=0,d=0}break}o===r[0]&&E<W.TEXT_COMPACTION_MODE_LATCH&&(x[d++]=E);for(let A=0;A<d;A++)u.write(x[A]);break;case W.BYTE_COMPACTION_MODE_LATCH_6:for(;o<r[0]&&!g;){let A=r[o++];if(A<W.TEXT_COMPACTION_MODE_LATCH)d++,h=900*h+A;else switch(A){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:o--,g=!0;break}if(d%5===0&&d>0){for(let I=0;I<6;++I)u.write(Number(cr(h)>>cr(8*(5-I))));h=0,d=0}}break}return a.append(Ee.decode(u.toByteArray(),s)),o}static numericCompaction(n,r,s){let o=0,a=!1,u=new Int32Array(W.MAX_NUMERIC_CODEWORDS);for(;r<n[0]&&!a;){let d=n[r++];if(r===n[0]&&(a=!0),d<W.TEXT_COMPACTION_MODE_LATCH)u[o]=d,o++;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:r--,a=!0;break}(o%W.MAX_NUMERIC_CODEWORDS===0||d===W.NUMERIC_COMPACTION_MODE_LATCH||a)&&o>0&&(s.append(W.decodeBase900toBase10(u,o)),o=0)}return r}static decodeBase900toBase10(n,r){let s=cr(0);for(let a=0;a<r;a++)s+=W.EXP900[r-a-1]*cr(n[a]);let o=s.toString();if(o.charAt(0)!=="1")throw new k;return o.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 ,:
66
- -.$/"|*()?{}'`,W.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",W.EXP900=l1()?Xh():[],W.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ye{constructor(){}static decode(n,r,s,o,a,u,d){let h=new Fr(n,r,s,o,a),g=null,x=null,E;for(let b=!0;;b=!1){if(r!=null&&(g=ye.getRowIndicatorColumn(n,h,r,!0,u,d)),o!=null&&(x=ye.getRowIndicatorColumn(n,h,o,!1,u,d)),E=ye.merge(g,x),E==null)throw j.getNotFoundInstance();let D=E.getBoundingBox();if(b&&D!=null&&(D.getMinY()<h.getMinY()||D.getMaxY()>h.getMaxY()))h=D;else break}E.setBoundingBox(h);let A=E.getBarcodeColumnCount()+1;E.setDetectionResultColumn(0,g),E.setDetectionResultColumn(A,x);let I=g!=null;for(let b=1;b<=A;b++){let D=I?b:A-b;if(E.getDetectionResultColumn(D)!==void 0)continue;let L;D===0||D===A?L=new i1(h,D===0):L=new ns(h),E.setDetectionResultColumn(D,L);let z=-1,q=z;for(let $=h.getMinY();$<=h.getMaxY();$++){if(z=ye.getStartColumn(E,D,$,I),z<0||z>h.getMaxX()){if(q===-1)continue;z=q}let Z=ye.detectCodeword(n,h.getMinX(),h.getMaxX(),I,z,$,u,d);Z!=null&&(L.setCodeword($,Z),q=z,u=Math.min(u,Z.getWidth()),d=Math.max(d,Z.getWidth()))}}return ye.createDecoderResult(E)}static merge(n,r){if(n==null&&r==null)return null;let s=ye.getBarcodeMetadata(n,r);if(s==null)return null;let o=Fr.merge(ye.adjustBoundingBox(n),ye.adjustBoundingBox(r));return new is(s,o)}static adjustBoundingBox(n){if(n==null)return null;let r=n.getRowHeights();if(r==null)return null;let s=ye.getMax(r),o=0;for(let d of r)if(o+=s-d,d>0)break;let a=n.getCodewords();for(let d=0;o>0&&a[d]==null;d++)o--;let u=0;for(let d=r.length-1;d>=0&&(u+=s-r[d],!(r[d]>0));d--);for(let d=a.length-1;u>0&&a[d]==null;d--)u--;return n.getBoundingBox().addMissingRows(o,u,n.isLeft())}static getMax(n){let r=-1;for(let s of n)r=Math.max(r,s);return r}static getBarcodeMetadata(n,r){let s;if(n==null||(s=n.getBarcodeMetadata())==null)return r==null?null:r.getBarcodeMetadata();let o;return r==null||(o=r.getBarcodeMetadata())==null?s:s.getColumnCount()!==o.getColumnCount()&&s.getErrorCorrectionLevel()!==o.getErrorCorrectionLevel()&&s.getRowCount()!==o.getRowCount()?null:s}static getRowIndicatorColumn(n,r,s,o,a,u){let d=new i1(r,o);for(let h=0;h<2;h++){let g=h===0?1:-1,x=Math.trunc(Math.trunc(s.getX()));for(let E=Math.trunc(Math.trunc(s.getY()));E<=r.getMaxY()&&E>=r.getMinY();E+=g){let A=ye.detectCodeword(n,0,n.getWidth(),o,x,E,a,u);A!=null&&(d.setCodeword(E,A),o?x=A.getStartX():x=A.getEndX())}}return d}static adjustCodewordCount(n,r){let s=r[0][1],o=s.getValue(),a=n.getBarcodeColumnCount()*n.getBarcodeRowCount()-ye.getNumberOfECCodeWords(n.getBarcodeECLevel());if(o.length===0){if(a<1||a>he.MAX_CODEWORDS_IN_BARCODE)throw j.getNotFoundInstance();s.setValue(a)}else o[0]!==a&&s.setValue(a)}static createDecoderResult(n){let r=ye.createBarcodeMatrix(n);ye.adjustCodewordCount(n,r);let s=new Array,o=new Int32Array(n.getBarcodeRowCount()*n.getBarcodeColumnCount()),a=[],u=new Array;for(let h=0;h<n.getBarcodeRowCount();h++)for(let g=0;g<n.getBarcodeColumnCount();g++){let x=r[h][g+1].getValue(),E=h*n.getBarcodeColumnCount()+g;x.length===0?s.push(E):x.length===1?o[E]=x[0]:(u.push(E),a.push(x))}let d=new Array(a.length);for(let h=0;h<d.length;h++)d[h]=a[h];return ye.createDecoderResultFromAmbiguousValues(n.getBarcodeECLevel(),o,he.toIntArray(s),he.toIntArray(u),d)}static createDecoderResultFromAmbiguousValues(n,r,s,o,a){let u=new Int32Array(o.length),d=100;for(;d-- >0;){for(let h=0;h<u.length;h++)r[o[h]]=a[h][u[h]];try{return ye.decodeCodewords(r,n,s)}catch(h){if(!(h instanceof M))throw h}if(u.length===0)throw M.getChecksumInstance();for(let h=0;h<u.length;h++)if(u[h]<a[h].length-1){u[h]++;break}else if(u[h]=0,h===u.length-1)throw M.getChecksumInstance()}throw M.getChecksumInstance()}static createBarcodeMatrix(n){let r=Array.from({length:n.getBarcodeRowCount()},()=>new Array(n.getBarcodeColumnCount()+2));for(let o=0;o<r.length;o++)for(let a=0;a<r[o].length;a++)r[o][a]=new rs;let s=0;for(let o of n.getDetectionResultColumns()){if(o!=null){for(let a of o.getCodewords())if(a!=null){let u=a.getRowNumber();if(u>=0){if(u>=r.length)continue;r[u][s].setValue(a.getValue())}}}s++}return r}static isValidBarcodeColumn(n,r){return r>=0&&r<=n.getBarcodeColumnCount()+1}static getStartColumn(n,r,s,o){let a=o?1:-1,u=null;if(ye.isValidBarcodeColumn(n,r-a)&&(u=n.getDetectionResultColumn(r-a).getCodeword(s)),u!=null)return o?u.getEndX():u.getStartX();if(u=n.getDetectionResultColumn(r).getCodewordNearby(s),u!=null)return o?u.getStartX():u.getEndX();if(ye.isValidBarcodeColumn(n,r-a)&&(u=n.getDetectionResultColumn(r-a).getCodewordNearby(s)),u!=null)return o?u.getEndX():u.getStartX();let d=0;for(;ye.isValidBarcodeColumn(n,r-a);){r-=a;for(let h of n.getDetectionResultColumn(r).getCodewords())if(h!=null)return(o?h.getEndX():h.getStartX())+a*d*(h.getEndX()-h.getStartX());d++}return o?n.getBoundingBox().getMinX():n.getBoundingBox().getMaxX()}static detectCodeword(n,r,s,o,a,u,d,h){a=ye.adjustCodewordStartColumn(n,r,s,o,a,u);let g=ye.getModuleBitCount(n,r,s,o,a,u);if(g==null)return null;let x,E=Te.sum(g);if(o)x=a+E;else{for(let b=0;b<g.length/2;b++){let D=g[b];g[b]=g[g.length-1-b],g[g.length-1-b]=D}x=a,a=x-E}if(!ye.checkCodewordSkew(E,d,h))return null;let A=Xt.getDecodedValue(g),I=he.getCodeword(A);return I===-1?null:new ss(a,x,ye.getCodewordBucketNumber(A),I)}static getModuleBitCount(n,r,s,o,a,u){let d=a,h=new Int32Array(8),g=0,x=o?1:-1,E=o;for(;(o?d<s:d>=r)&&g<h.length;)n.get(d,u)===E?(h[g]++,d+=x):(g++,E=!E);return g===h.length||d===(o?s:r)&&g===h.length-1?h:null}static getNumberOfECCodeWords(n){return 2<<n}static adjustCodewordStartColumn(n,r,s,o,a,u){let d=a,h=o?-1:1;for(let g=0;g<2;g++){for(;(o?d>=r:d<s)&&o===n.get(d,u);){if(Math.abs(a-d)>ye.CODEWORD_SKEW_SIZE)return a;d+=h}h=-h,o=!o}return d}static checkCodewordSkew(n,r,s){return r-ye.CODEWORD_SKEW_SIZE<=n&&n<=s+ye.CODEWORD_SKEW_SIZE}static decodeCodewords(n,r,s){if(n.length===0)throw k.getFormatInstance();let o=1<<r+1,a=ye.correctErrors(n,s,o);ye.verifyCodewordCount(n,o);let u=W.decode(n,""+r);return u.setErrorsCorrected(a),u.setErasures(s.length),u}static correctErrors(n,r,s){if(r!=null&&r.length>s/2+ye.MAX_ERRORS||s<0||s>ye.MAX_EC_CODEWORDS)throw M.getChecksumInstance();return ye.errorCorrection.decode(n,s,r)}static verifyCodewordCount(n,r){if(n.length<4)throw k.getFormatInstance();let s=n[0];if(s>n.length)throw k.getFormatInstance();if(s===0)if(r<n.length)n[0]=n.length-r;else throw k.getFormatInstance()}static getBitCountForCodeword(n){let r=new Int32Array(8),s=0,o=r.length-1;for(;!((n&1)!==s&&(s=n&1,o--,o<0));)r[o]++,n>>=1;return r}static getCodewordBucketNumber(n){return n instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(n):this.getCodewordBucketNumber_number(n)}static getCodewordBucketNumber_number(n){return ye.getCodewordBucketNumber(ye.getBitCountForCodeword(n))}static getCodewordBucketNumber_Int32Array(n){return(n[0]-n[2]+n[4]-n[6]+9)%9}static toString(n){let r=new ts;for(let s=0;s<n.length;s++){r.format("Row %2d: ",s);for(let o=0;o<n[s].length;o++){let a=n[s][o];a.getValue().length===0?r.format(" ",null):r.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}r.format("%n")}return r.toString()}}ye.CODEWORD_SKEW_SIZE=2,ye.MAX_ERRORS=3,ye.MAX_EC_CODEWORDS=512,ye.errorCorrection=new r1;class It{decode(n,r=null){let s=It.decode(n,r,!1);if(s==null||s.length===0||s[0]==null)throw j.getNotFoundInstance();return s[0]}decodeMultiple(n,r=null){try{return It.decode(n,r,!0)}catch(s){throw s instanceof k||s instanceof M?j.getNotFoundInstance():s}}static decode(n,r,s){const o=new Array,a=we.detectMultiple(n,r,s);for(const u of a.getPoints()){const d=ye.decode(a.getBits(),u[4],u[5],u[6],u[7],It.getMinCodewordWidth(u),It.getMaxCodewordWidth(u)),h=new Ke(d.getText(),d.getRawBytes(),void 0,u,le.PDF_417);h.putMetadata(mt.ERROR_CORRECTION_LEVEL,d.getECLevel());const g=d.getOther();g!=null&&h.putMetadata(mt.PDF417_EXTRA_METADATA,g),o.push(h)}return o.map(u=>u)}static getMaxWidth(n,r){return n==null||r==null?0:Math.trunc(Math.abs(n.getX()-r.getX()))}static getMinWidth(n,r){return n==null||r==null?N.MAX_VALUE:Math.trunc(Math.abs(n.getX()-r.getX()))}static getMaxCodewordWidth(n){return Math.floor(Math.max(Math.max(It.getMaxWidth(n[0],n[4]),It.getMaxWidth(n[6],n[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.max(It.getMaxWidth(n[1],n[5]),It.getMaxWidth(n[7],n[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(n){return Math.floor(Math.min(Math.min(It.getMinWidth(n[0],n[4]),It.getMinWidth(n[6],n[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.min(It.getMinWidth(n[1],n[5]),It.getMinWidth(n[7],n[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}reset(){}}class go extends m{}go.kind="ReaderException";class u1{constructor(n,r){this.verbose=n===!0,r&&this.setHints(r)}decode(n,r){return r&&this.setHints(r),this.decodeInternal(n)}decodeWithState(n){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(n)}setHints(n){this.hints=n;const r=!l(n)&&n.get(U.TRY_HARDER)===!0,s=l(n)?null:n.get(U.POSSIBLE_FORMATS),o=new Array;if(!l(s)){const a=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);a&&!r&&o.push(new ai(n,this.verbose)),s.includes(le.QR_CODE)&&o.push(new ur),s.includes(le.DATA_MATRIX)&&o.push(new lr),s.includes(le.AZTEC)&&o.push(new ao),s.includes(le.PDF_417)&&o.push(new It),a&&r&&o.push(new ai(n,this.verbose))}o.length===0&&(r||o.push(new ai(n,this.verbose)),o.push(new ur),o.push(new lr),o.push(new ao),o.push(new It),r&&o.push(new ai(n,this.verbose))),this.readers=o}reset(){if(this.readers!==null)for(const n of this.readers)n.reset()}decodeInternal(n){if(this.readers===null)throw new go("No readers where selected, nothing can be read.");for(const r of this.readers)try{return r.decode(n,this.hints)}catch(s){if(s instanceof go)continue}throw new j("No MultiFormat Readers were able to detect the code.")}}class Yh extends cn{constructor(n=null,r=500){const s=new u1;s.setHints(n),super(s,r)}decodeBitmap(n){return this.reader.decodeWithState(n)}}class Zh extends cn{constructor(n=500){super(new It,n)}}class Kh extends cn{constructor(n=500){super(new ur,n)}}var nl;(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"})(nl||(nl={}));var ht=nl;class rl{constructor(n){this.field=n,this.cachedGenerators=[],this.cachedGenerators.push(new Ht(n,Int32Array.from([1])))}buildGenerator(n){const r=this.cachedGenerators;if(n>=r.length){let s=r[r.length-1];const o=this.field;for(let a=r.length;a<=n;a++){const u=s.multiply(new Ht(o,Int32Array.from([1,o.exp(a-1+o.getGeneratorBase())])));r.push(u),s=u}}return r[n]}encode(n,r){if(r===0)throw new v("No error correction bytes");const s=n.length-r;if(s<=0)throw new v("No data bytes provided");const o=this.buildGenerator(r),a=new Int32Array(s);B.arraycopy(n,0,a,0,s);let u=new Ht(this.field,a);u=u.multiplyByMonomial(r,1);const h=u.divide(o)[1].getCoefficients(),g=r-h.length;for(let x=0;x<g;x++)n[s+x]=0;B.arraycopy(h,0,n,s+g,h.length)}}class it{constructor(){}static applyMaskPenaltyRule1(n){return it.applyMaskPenaltyRule1Internal(n,!0)+it.applyMaskPenaltyRule1Internal(n,!1)}static applyMaskPenaltyRule2(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let u=0;u<a-1;u++){const d=s[u];for(let h=0;h<o-1;h++){const g=d[h];g===d[h+1]&&g===s[u+1][h]&&g===s[u+1][h+1]&&r++}}return it.N2*r}static applyMaskPenaltyRule3(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let u=0;u<a;u++)for(let d=0;d<o;d++){const h=s[u];d+6<o&&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))&&r++,u+6<a&&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))&&r++}return r*it.N3}static isWhiteHorizontal(n,r,s){r=Math.max(r,0),s=Math.min(s,n.length);for(let o=r;o<s;o++)if(n[o]===1)return!1;return!0}static isWhiteVertical(n,r,s,o){s=Math.max(s,0),o=Math.min(o,n.length);for(let a=s;a<o;a++)if(n[a][r]===1)return!1;return!0}static applyMaskPenaltyRule4(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let h=0;h<a;h++){const g=s[h];for(let x=0;x<o;x++)g[x]===1&&r++}const u=n.getHeight()*n.getWidth();return Math.floor(Math.abs(r*2-u)*10/u)*it.N4}static getDataMaskBit(n,r,s){let o,a;switch(n){case 0:o=s+r&1;break;case 1:o=s&1;break;case 2:o=r%3;break;case 3:o=(s+r)%3;break;case 4:o=Math.floor(s/2)+Math.floor(r/3)&1;break;case 5:a=s*r,o=(a&1)+a%3;break;case 6:a=s*r,o=(a&1)+a%3&1;break;case 7:a=s*r,o=a%3+(s+r&1)&1;break;default:throw new v("Invalid mask pattern: "+n)}return o===0}static applyMaskPenaltyRule1Internal(n,r){let s=0;const o=r?n.getHeight():n.getWidth(),a=r?n.getWidth():n.getHeight(),u=n.getArray();for(let d=0;d<o;d++){let h=0,g=-1;for(let x=0;x<a;x++){const E=r?u[d][x]:u[x][d];E===g?h++:(h>=5&&(s+=it.N1+(h-5)),h=1,g=E)}h>=5&&(s+=it.N1+(h-5))}return s}}it.N1=3,it.N2=3,it.N3=40,it.N4=10;class po{constructor(n,r){this.width=n,this.height=r;const s=new Array(r);for(let o=0;o!==r;o++)s[o]=new Uint8Array(n);this.bytes=s}getHeight(){return this.height}getWidth(){return this.width}get(n,r){return this.bytes[r][n]}getArray(){return this.bytes}setNumber(n,r,s){this.bytes[r][n]=s}setBoolean(n,r,s){this.bytes[r][n]=s?1:0}clear(n){for(const r of this.bytes)T.fill(r,n)}equals(n){if(!(n instanceof po))return!1;const r=n;if(this.width!==r.width||this.height!==r.height)return!1;for(let s=0,o=this.height;s<o;++s){const a=this.bytes[s],u=r.bytes[s];for(let d=0,h=this.width;d<h;++d)if(a[d]!==u[d])return!1}return!0}toString(){const n=new ge;for(let r=0,s=this.height;r<s;++r){const o=this.bytes[r];for(let a=0,u=this.width;a<u;++a)switch(o[a]){case 0:n.append(" 0");break;case 1:n.append(" 1");break;default:n.append(" ");break}n.append(`
64
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ue.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Te{constructor(){}static round(n){return n===NaN?0:n<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:n>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n+(n<0?-.5:.5)|0}static distance(n,r,s,o){const a=n-s,u=r-o;return Math.sqrt(a*a+u*u)}static sum(n){let r=0;for(let s=0,o=n.length;s!==o;s++){const a=n[s];r+=a}return r}}class so{static floatToIntBits(n){return n}}so.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ae{constructor(n,r){this.x=n,this.y=r}getX(){return this.x}getY(){return this.y}equals(n){if(n instanceof ae){const r=n;return this.x===r.x&&this.y===r.y}return!1}hashCode(){return 31*so.floatToIntBits(this.x)+so.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(n){const r=this.distance(n[0],n[1]),s=this.distance(n[1],n[2]),o=this.distance(n[0],n[2]);let a,u,d;if(s>=r&&s>=o?(u=n[0],a=n[1],d=n[2]):o>=s&&o>=r?(u=n[1],a=n[0],d=n[2]):(u=n[2],a=n[0],d=n[1]),this.crossProductZ(a,u,d)<0){const h=a;a=d,d=h}n[0]=a,n[1]=u,n[2]=d}static distance(n,r){return Te.distance(n.x,n.y,r.x,r.y)}static crossProductZ(n,r,s){const o=r.x,a=r.y;return(s.x-o)*(n.y-a)-(s.y-a)*(n.x-o)}}class oo{constructor(n,r){this.bits=n,this.points=r}getBits(){return this.bits}getPoints(){return this.points}}class Kc extends oo{constructor(n,r,s,o,a){super(n,r),this.compact=s,this.nbDatablocks=o,this.nbLayers=a}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Gn{constructor(n,r,s,o){this.image=n,this.height=n.getHeight(),this.width=n.getWidth(),r==null&&(r=Gn.INIT_SIZE),s==null&&(s=n.getWidth()/2|0),o==null&&(o=n.getHeight()/2|0);const a=r/2|0;if(this.leftInit=s-a,this.rightInit=s+a,this.upInit=o-a,this.downInit=o+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new H}detect(){let n=this.leftInit,r=this.rightInit,s=this.upInit,o=this.downInit,a=!1,u=!0,d=!1,h=!1,g=!1,x=!1,E=!1;const A=this.width,I=this.height;for(;u;){u=!1;let b=!0;for(;(b||!h)&&r<A;)b=this.containsBlackPoint(s,o,r,!1),b?(r++,u=!0,h=!0):h||r++;if(r>=A){a=!0;break}let D=!0;for(;(D||!g)&&o<I;)D=this.containsBlackPoint(n,r,o,!0),D?(o++,u=!0,g=!0):g||o++;if(o>=I){a=!0;break}let L=!0;for(;(L||!x)&&n>=0;)L=this.containsBlackPoint(s,o,n,!1),L?(n--,u=!0,x=!0):x||n--;if(n<0){a=!0;break}let z=!0;for(;(z||!E)&&s>=0;)z=this.containsBlackPoint(n,r,s,!0),z?(s--,u=!0,E=!0):E||s--;if(s<0){a=!0;break}u&&(d=!0)}if(!a&&d){const b=r-n;let D=null;for(let $=1;D===null&&$<b;$++)D=this.getBlackPointOnSegment(n,o-$,n+$,o);if(D==null)throw new H;let L=null;for(let $=1;L===null&&$<b;$++)L=this.getBlackPointOnSegment(n,s+$,n+$,s);if(L==null)throw new H;let z=null;for(let $=1;z===null&&$<b;$++)z=this.getBlackPointOnSegment(r,s+$,r-$,s);if(z==null)throw new H;let q=null;for(let $=1;q===null&&$<b;$++)q=this.getBlackPointOnSegment(r,o-$,r-$,o);if(q==null)throw new H;return this.centerEdges(q,D,z,L)}else throw new H}getBlackPointOnSegment(n,r,s,o){const a=Te.round(Te.distance(n,r,s,o)),u=(s-n)/a,d=(o-r)/a,h=this.image;for(let g=0;g<a;g++){const x=Te.round(n+g*u),E=Te.round(r+g*d);if(h.get(x,E))return new ae(x,E)}return null}centerEdges(n,r,s,o){const a=n.getX(),u=n.getY(),d=r.getX(),h=r.getY(),g=s.getX(),x=s.getY(),E=o.getX(),A=o.getY(),I=Gn.CORR;return a<this.width/2?[new ae(E-I,A+I),new ae(d+I,h+I),new ae(g-I,x-I),new ae(a+I,u-I)]:[new ae(E+I,A+I),new ae(d+I,h-I),new ae(g-I,x+I),new ae(a-I,u-I)]}containsBlackPoint(n,r,s,o){const a=this.image;if(o){for(let u=n;u<=r;u++)if(a.get(u,s))return!0}else for(let u=n;u<=r;u++)if(a.get(s,u))return!0;return!1}}Gn.INIT_SIZE=10,Gn.CORR=1;class ja{static checkAndNudgePoints(n,r){const s=n.getWidth(),o=n.getHeight();let a=!0;for(let u=0;u<r.length&&a;u+=2){const d=Math.floor(r[u]),h=Math.floor(r[u+1]);if(d<-1||d>s||h<-1||h>o)throw new H;a=!1,d===-1?(r[u]=0,a=!0):d===s&&(r[u]=s-1,a=!0),h===-1?(r[u+1]=0,a=!0):h===o&&(r[u+1]=o-1,a=!0)}a=!0;for(let u=r.length-2;u>=0&&a;u-=2){const d=Math.floor(r[u]),h=Math.floor(r[u+1]);if(d<-1||d>s||h<-1||h>o)throw new H;a=!1,d===-1?(r[u]=0,a=!0):d===s&&(r[u]=s-1,a=!0),h===-1?(r[u+1]=0,a=!0):h===o&&(r[u+1]=o-1,a=!0)}}}class Cn{constructor(n,r,s,o,a,u,d,h,g){this.a11=n,this.a21=r,this.a31=s,this.a12=o,this.a22=a,this.a32=u,this.a13=d,this.a23=h,this.a33=g}static quadrilateralToQuadrilateral(n,r,s,o,a,u,d,h,g,x,E,A,I,b,D,L){const z=Cn.quadrilateralToSquare(n,r,s,o,a,u,d,h);return Cn.squareToQuadrilateral(g,x,E,A,I,b,D,L).times(z)}transformPoints(n){const r=n.length,s=this.a11,o=this.a12,a=this.a13,u=this.a21,d=this.a22,h=this.a23,g=this.a31,x=this.a32,E=this.a33;for(let A=0;A<r;A+=2){const I=n[A],b=n[A+1],D=a*I+h*b+E;n[A]=(s*I+u*b+g)/D,n[A+1]=(o*I+d*b+x)/D}}transformPointsWithValues(n,r){const s=this.a11,o=this.a12,a=this.a13,u=this.a21,d=this.a22,h=this.a23,g=this.a31,x=this.a32,E=this.a33,A=n.length;for(let I=0;I<A;I++){const b=n[I],D=r[I],L=a*b+h*D+E;n[I]=(s*b+u*D+g)/L,r[I]=(o*b+d*D+x)/L}}static squareToQuadrilateral(n,r,s,o,a,u,d,h){const g=n-s+a-d,x=r-o+u-h;if(g===0&&x===0)return new Cn(s-n,a-s,n,o-r,u-o,r,0,0,1);{const E=s-a,A=d-a,I=o-u,b=h-u,D=E*b-A*I,L=(g*b-A*x)/D,z=(E*x-g*I)/D;return new Cn(s-n+L*s,d-n+z*d,n,o-r+L*o,h-r+z*h,r,L,z,1)}}static quadrilateralToSquare(n,r,s,o,a,u,d,h){return Cn.squareToQuadrilateral(n,r,s,o,a,u,d,h).buildAdjoint()}buildAdjoint(){return new Cn(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(n){return new Cn(this.a11*n.a11+this.a21*n.a12+this.a31*n.a13,this.a11*n.a21+this.a21*n.a22+this.a31*n.a23,this.a11*n.a31+this.a21*n.a32+this.a31*n.a33,this.a12*n.a11+this.a22*n.a12+this.a32*n.a13,this.a12*n.a21+this.a22*n.a22+this.a32*n.a23,this.a12*n.a31+this.a22*n.a32+this.a32*n.a33,this.a13*n.a11+this.a23*n.a12+this.a33*n.a13,this.a13*n.a21+this.a23*n.a22+this.a33*n.a23,this.a13*n.a31+this.a23*n.a32+this.a33*n.a33)}}class Qc extends ja{sampleGrid(n,r,s,o,a,u,d,h,g,x,E,A,I,b,D,L,z,q,$){const Z=Cn.quadrilateralToQuadrilateral(o,a,u,d,h,g,x,E,A,I,b,D,L,z,q,$);return this.sampleGridWithTransform(n,r,s,Z)}sampleGridWithTransform(n,r,s,o){if(r<=0||s<=0)throw new H;const a=new _e(r,s),u=new Float32Array(2*r);for(let d=0;d<s;d++){const h=u.length,g=d+.5;for(let x=0;x<h;x+=2)u[x]=x/2+.5,u[x+1]=g;o.transformPoints(u),ja.checkAndNudgePoints(n,u);try{for(let x=0;x<h;x+=2)n.get(Math.floor(u[x]),Math.floor(u[x+1]))&&a.set(x/2,d)}catch{throw new H}}return a}}class sr{static setGridSampler(n){sr.gridSampler=n}static getInstance(){return sr.gridSampler}}sr.gridSampler=new Qc;class Lt{constructor(n,r){this.x=n,this.y=r}toResultPoint(){return new ae(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class qc{constructor(n){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=n}detect(){return this.detectMirror(!1)}detectMirror(n){let r=this.getMatrixCenter(),s=this.getBullsEyeCorners(r);if(n){let u=s[0];s[0]=s[2],s[2]=u}this.extractParameters(s);let o=this.sampleGrid(this.image,s[this.shift%4],s[(this.shift+1)%4],s[(this.shift+2)%4],s[(this.shift+3)%4]),a=this.getMatrixCornerPoints(s);return new Kc(o,a,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(n){if(!this.isValidPoint(n[0])||!this.isValidPoint(n[1])||!this.isValidPoint(n[2])||!this.isValidPoint(n[3]))throw new H;let r=2*this.nbCenterLayers,s=new Int32Array([this.sampleLine(n[0],n[1],r),this.sampleLine(n[1],n[2],r),this.sampleLine(n[2],n[3],r),this.sampleLine(n[3],n[0],r)]);this.shift=this.getRotation(s,r);let o=0;for(let u=0;u<4;u++){let d=s[(this.shift+u)%4];this.compact?(o<<=7,o+=d>>1&127):(o<<=10,o+=(d>>2&992)+(d>>1&31))}let a=this.getCorrectedParameterData(o,this.compact);this.compact?(this.nbLayers=(a>>6)+1,this.nbDataBlocks=(a&63)+1):(this.nbLayers=(a>>11)+1,this.nbDataBlocks=(a&2047)+1)}getRotation(n,r){let s=0;n.forEach((o,a,u)=>{let d=(o>>r-2<<1)+(o&1);s=(s<<3)+d}),s=((s&1)<<11)+(s>>1);for(let o=0;o<4;o++)if(N.bitCount(s^this.EXPECTED_CORNER_BITS[o])<=2)return o;throw new H}getCorrectedParameterData(n,r){let s,o;r?(s=7,o=2):(s=10,o=4);let a=s-o,u=new Int32Array(s);for(let h=s-1;h>=0;--h)u[h]=n&15,n>>=4;try{new $i(be.AZTEC_PARAM).decode(u,a)}catch{throw new H}let d=0;for(let h=0;h<o;h++)d=(d<<4)+u[h];return d}getBullsEyeCorners(n){let r=n,s=n,o=n,a=n,u=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let E=this.getFirstDifferent(r,u,1,-1),A=this.getFirstDifferent(s,u,1,1),I=this.getFirstDifferent(o,u,-1,1),b=this.getFirstDifferent(a,u,-1,-1);if(this.nbCenterLayers>2){let D=this.distancePoint(b,E)*this.nbCenterLayers/(this.distancePoint(a,r)*(this.nbCenterLayers+2));if(D<.75||D>1.25||!this.isWhiteOrBlackRectangle(E,A,I,b))break}r=E,s=A,o=I,a=b,u=!u}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new H;this.compact=this.nbCenterLayers===5;let d=new ae(r.getX()+.5,r.getY()-.5),h=new ae(s.getX()+.5,s.getY()+.5),g=new ae(o.getX()-.5,o.getY()+.5),x=new ae(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,h,g,x],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let n,r,s,o;try{let d=new Gn(this.image).detect();n=d[0],r=d[1],s=d[2],o=d[3]}catch{let h=this.image.getWidth()/2,g=this.image.getHeight()/2;n=this.getFirstDifferent(new Lt(h+7,g-7),!1,1,-1).toResultPoint(),r=this.getFirstDifferent(new Lt(h+7,g+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(h-7,g+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Lt(h-7,g-7),!1,-1,-1).toResultPoint()}let a=Te.round((n.getX()+o.getX()+r.getX()+s.getX())/4),u=Te.round((n.getY()+o.getY()+r.getY()+s.getY())/4);try{let d=new Gn(this.image,15,a,u).detect();n=d[0],r=d[1],s=d[2],o=d[3]}catch{n=this.getFirstDifferent(new Lt(a+7,u-7),!1,1,-1).toResultPoint(),r=this.getFirstDifferent(new Lt(a+7,u+7),!1,1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(a-7,u+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Lt(a-7,u-7),!1,-1,-1).toResultPoint()}return a=Te.round((n.getX()+o.getX()+r.getX()+s.getX())/4),u=Te.round((n.getY()+o.getY()+r.getY()+s.getY())/4),new Lt(a,u)}getMatrixCornerPoints(n){return this.expandSquare(n,2*this.nbCenterLayers,this.getDimension())}sampleGrid(n,r,s,o,a){let u=sr.getInstance(),d=this.getDimension(),h=d/2-this.nbCenterLayers,g=d/2+this.nbCenterLayers;return u.sampleGrid(n,d,d,h,h,g,h,g,g,h,g,r.getX(),r.getY(),s.getX(),s.getY(),o.getX(),o.getY(),a.getX(),a.getY())}sampleLine(n,r,s){let o=0,a=this.distanceResultPoint(n,r),u=a/s,d=n.getX(),h=n.getY(),g=u*(r.getX()-n.getX())/a,x=u*(r.getY()-n.getY())/a;for(let E=0;E<s;E++)this.image.get(Te.round(d+E*g),Te.round(h+E*x))&&(o|=1<<s-E-1);return o}isWhiteOrBlackRectangle(n,r,s,o){let a=3;n=new Lt(n.getX()-a,n.getY()+a),r=new Lt(r.getX()-a,r.getY()-a),s=new Lt(s.getX()+a,s.getY()-a),o=new Lt(o.getX()+a,o.getY()+a);let u=this.getColor(o,n);if(u===0)return!1;let d=this.getColor(n,r);return d!==u||(d=this.getColor(r,s),d!==u)?!1:(d=this.getColor(s,o),d===u)}getColor(n,r){let s=this.distancePoint(n,r),o=(r.getX()-n.getX())/s,a=(r.getY()-n.getY())/s,u=0,d=n.getX(),h=n.getY(),g=this.image.get(n.getX(),n.getY()),x=Math.ceil(s);for(let A=0;A<x;A++)d+=o,h+=a,this.image.get(Te.round(d),Te.round(h))!==g&&u++;let E=u/s;return E>.1&&E<.9?0:E<=.1===g?1:-1}getFirstDifferent(n,r,s,o){let a=n.getX()+s,u=n.getY()+o;for(;this.isValid(a,u)&&this.image.get(a,u)===r;)a+=s,u+=o;for(a-=s,u-=o;this.isValid(a,u)&&this.image.get(a,u)===r;)a+=s;for(a-=s;this.isValid(a,u)&&this.image.get(a,u)===r;)u+=o;return u-=o,new Lt(a,u)}expandSquare(n,r,s){let o=s/(2*r),a=n[0].getX()-n[2].getX(),u=n[0].getY()-n[2].getY(),d=(n[0].getX()+n[2].getX())/2,h=(n[0].getY()+n[2].getY())/2,g=new ae(d+o*a,h+o*u),x=new ae(d-o*a,h-o*u);a=n[1].getX()-n[3].getX(),u=n[1].getY()-n[3].getY(),d=(n[1].getX()+n[3].getX())/2,h=(n[1].getY()+n[3].getY())/2;let E=new ae(d+o*a,h+o*u),A=new ae(d-o*a,h-o*u);return[g,E,x,A]}isValid(n,r){return n>=0&&n<this.image.getWidth()&&r>0&&r<this.image.getHeight()}isValidPoint(n){let r=Te.round(n.getX()),s=Te.round(n.getY());return this.isValid(r,s)}distancePoint(n,r){return Te.distance(n.getX(),n.getY(),r.getX(),r.getY())}distanceResultPoint(n,r){return Te.distance(n.getX(),n.getY(),r.getX(),r.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(N.truncDivision(this.nbLayers-4,8)+1)+15}}class ao{decode(n,r=null){let s=null,o=new qc(n.getBlackMatrix()),a=null,u=null;try{let x=o.detectMirror(!1);a=x.getPoints(),this.reportFoundResultPoints(r,a),u=new Ue().decode(x)}catch(x){s=x}if(u==null)try{let x=o.detectMirror(!0);a=x.getPoints(),this.reportFoundResultPoints(r,a),u=new Ue().decode(x)}catch(x){throw s??x}let d=new Ke(u.getText(),u.getRawBytes(),u.getNumBits(),a,le.AZTEC,B.currentTimeMillis()),h=u.getByteSegments();h!=null&&d.putMetadata(wt.BYTE_SEGMENTS,h);let g=u.getECLevel();return g!=null&&d.putMetadata(wt.ERROR_CORRECTION_LEVEL,g),d}reportFoundResultPoints(n,r){if(n!=null){let s=n.get(U.NEED_RESULT_POINT_CALLBACK);s!=null&&r.forEach((o,a,u)=>{s.foundPossibleResultPoint(o)})}}reset(){}}class bh extends cn{constructor(n=500){super(new ao,n)}}class ut{decode(n,r){try{return this.doDecode(n,r)}catch{if(r&&r.get(U.TRY_HARDER)===!0&&n.isRotateSupported()){const a=n.rotateCounterClockwise(),u=this.doDecode(a,r),d=u.getResultMetadata();let h=270;d!==null&&d.get(wt.ORIENTATION)===!0&&(h=h+d.get(wt.ORIENTATION)%360),u.putMetadata(wt.ORIENTATION,h);const g=u.getResultPoints();if(g!==null){const x=a.getHeight();for(let E=0;E<g.length;E++)g[E]=new ae(x-g[E].getY()-1,g[E].getX())}return u}else throw new H}}reset(){}doDecode(n,r){const s=n.getWidth(),o=n.getHeight();let a=new G(s);const u=r&&r.get(U.TRY_HARDER)===!0,d=Math.max(1,o>>(u?8:5));let h;u?h=o:h=15;const g=Math.trunc(o/2);for(let x=0;x<h;x++){const E=Math.trunc((x+1)/2),A=(x&1)===0,I=g+d*(A?E:-E);if(I<0||I>=o)break;try{a=n.getBlackRow(I,a)}catch{continue}for(let b=0;b<2;b++){if(b===1&&(a.reverse(),r&&r.get(U.NEED_RESULT_POINT_CALLBACK)===!0)){const D=new Map;r.forEach((L,z)=>D.set(z,L)),D.delete(U.NEED_RESULT_POINT_CALLBACK),r=D}try{const D=this.decodeRow(I,a,r);if(b===1){D.putMetadata(wt.ORIENTATION,180);const L=D.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 D}catch{}}}throw new H}static recordPattern(n,r,s){const o=s.length;for(let g=0;g<o;g++)s[g]=0;const a=n.getSize();if(r>=a)throw new H;let u=!n.get(r),d=0,h=r;for(;h<a;){if(n.get(h)!==u)s[d]++;else{if(++d===o)break;s[d]=1,u=!u}h++}if(!(d===o||d===o-1&&h===a))throw new H}static recordPatternInReverse(n,r,s){let o=s.length,a=n.get(r);for(;r>0&&o>=0;)n.get(--r)!==a&&(o--,a=!a);if(o>=0)throw new H;ut.recordPattern(n,r+1,s)}static patternMatchVariance(n,r,s){const o=n.length;let a=0,u=0;for(let g=0;g<o;g++)a+=n[g],u+=r[g];if(a<u)return Number.POSITIVE_INFINITY;const d=a/u;s*=d;let h=0;for(let g=0;g<o;g++){const x=n[g],E=r[g]*d,A=x>E?x-E:E-x;if(A>s)return Number.POSITIVE_INFINITY;h+=A}return h/a}}class J extends ut{static findStartPattern(n){const r=n.getSize(),s=n.getNextSet(0);let o=0,a=Int32Array.from([0,0,0,0,0,0]),u=s,d=!1;const h=6;for(let g=s;g<r;g++)if(n.get(g)!==d)a[o]++;else{if(o===h-1){let x=J.MAX_AVG_VARIANCE,E=-1;for(let A=J.CODE_START_A;A<=J.CODE_START_C;A++){const I=ut.patternMatchVariance(a,J.CODE_PATTERNS[A],J.MAX_INDIVIDUAL_VARIANCE);I<x&&(x=I,E=A)}if(E>=0&&n.isRange(Math.max(0,u-(g-u)/2),u,!1))return Int32Array.from([u,g,E]);u+=a[0]+a[1],a=a.slice(2,a.length-1),a[o-1]=0,a[o]=0,o--}else o++;a[o]=1,d=!d}throw new H}static decodeCode(n,r,s){ut.recordPattern(n,s,r);let o=J.MAX_AVG_VARIANCE,a=-1;for(let u=0;u<J.CODE_PATTERNS.length;u++){const d=J.CODE_PATTERNS[u],h=this.patternMatchVariance(r,d,J.MAX_INDIVIDUAL_VARIANCE);h<o&&(o=h,a=u)}if(a>=0)return a;throw new H}decodeRow(n,r,s){const o=s&&s.get(U.ASSUME_GS1)===!0,a=J.findStartPattern(r),u=a[2];let d=0;const h=new Uint8Array(20);h[d++]=u;let g;switch(u){case J.CODE_START_A:g=J.CODE_CODE_A;break;case J.CODE_START_B:g=J.CODE_CODE_B;break;case J.CODE_START_C:g=J.CODE_CODE_C;break;default:throw new k}let x=!1,E=!1,A="",I=a[0],b=a[1];const D=Int32Array.from([0,0,0,0,0,0]);let L=0,z=0,q=u,$=0,Z=!0,ve=!1,me=!1;for(;!x;){const di=E;switch(E=!1,L=z,z=J.decodeCode(r,D,b),h[d++]=z,z!==J.CODE_STOP&&(Z=!0),z!==J.CODE_STOP&&($++,q+=$*z),I=b,b+=D.reduce((sg,og)=>sg+og,0),z){case J.CODE_START_A:case J.CODE_START_B:case J.CODE_START_C:throw new k}switch(g){case J.CODE_CODE_A:if(z<64)me===ve?A+=String.fromCharCode(32+z):A+=String.fromCharCode(32+z+128),me=!1;else if(z<96)me===ve?A+=String.fromCharCode(z-64):A+=String.fromCharCode(z+64),me=!1;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_A:!ve&&me?(ve=!0,me=!1):ve&&me?(ve=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,g=J.CODE_CODE_B;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:x=!0;break}break;case J.CODE_CODE_B:if(z<96)me===ve?A+=String.fromCharCode(32+z):A+=String.fromCharCode(32+z+128),me=!1;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_B:!ve&&me?(ve=!0,me=!1):ve&&me?(ve=!1,me=!1):me=!0;break;case J.CODE_SHIFT:E=!0,g=J.CODE_CODE_A;break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:x=!0;break}break;case J.CODE_CODE_C:if(z<100)z<10&&(A+="0"),A+=z;else switch(z!==J.CODE_STOP&&(Z=!1),z){case J.CODE_FNC_1:o&&(A.length===0?A+="]C1":A+="");break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_STOP:x=!0;break}break}di&&(g=g===J.CODE_CODE_A?J.CODE_CODE_B:J.CODE_CODE_A)}const Yt=b-I;if(b=r.getNextUnset(b),!r.isRange(b,Math.min(r.getSize(),b+(b-I)/2),!1))throw new H;if(q-=$*L,q%103!==L)throw new M;const vn=A.length;if(vn===0)throw new H;vn>0&&Z&&(g===J.CODE_CODE_C?A=A.substring(0,vn-2):A=A.substring(0,vn-1));const Zt=(a[1]+a[0])/2,Fe=I+Yt/2,_t=h.length,tn=new Uint8Array(_t);for(let di=0;di<_t;di++)tn[di]=h[di];const fi=[new ae(Zt,n),new ae(Fe,n)];return new Ke(A,tn,0,fi,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 dt extends ut{constructor(n=!1,r=!1){super(),this.usingCheckDigit=n,this.extendedMode=r,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(n,r,s){let o=this.counters;o.fill(0),this.decodeRowResult="";let a=dt.findAsteriskPattern(r,o),u=r.getNextSet(a[1]),d=r.getSize(),h,g;do{dt.recordPattern(r,u,o);let D=dt.toNarrowWidePattern(o);if(D<0)throw new H;h=dt.patternToChar(D),this.decodeRowResult+=h,g=u;for(let L of o)u+=L;u=r.getNextSet(u)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let x=0;for(let D of o)x+=D;let E=u-g-x;if(u!==d&&E*2<x)throw new H;if(this.usingCheckDigit){let D=this.decodeRowResult.length-1,L=0;for(let z=0;z<D;z++)L+=dt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(z));if(this.decodeRowResult.charAt(D)!==dt.ALPHABET_STRING.charAt(L%43))throw new M;this.decodeRowResult=this.decodeRowResult.substring(0,D)}if(this.decodeRowResult.length===0)throw new H;let A;this.extendedMode?A=dt.decodeExtended(this.decodeRowResult):A=this.decodeRowResult;let I=(a[1]+a[0])/2,b=g+x/2;return new Ke(A,null,0,[new ae(I,n),new ae(b,n)],le.CODE_39,new Date().getTime())}static findAsteriskPattern(n,r){let s=n.getSize(),o=n.getNextSet(0),a=0,u=o,d=!1,h=r.length;for(let g=o;g<s;g++)if(n.get(g)!==d)r[a]++;else{if(a===h-1){if(this.toNarrowWidePattern(r)===dt.ASTERISK_ENCODING&&n.isRange(Math.max(0,u-Math.floor((g-u)/2)),u,!1))return[u,g];u+=r[0]+r[1],r.copyWithin(0,2,2+a-1),r[a-1]=0,r[a]=0,a--}else a++;r[a]=1,d=!d}throw new H}static toNarrowWidePattern(n){let r=n.length,s=0,o;do{let a=2147483647;for(let h of n)h<a&&h>s&&(a=h);s=a,o=0;let u=0,d=0;for(let h=0;h<r;h++){let g=n[h];g>s&&(d|=1<<r-1-h,o++,u+=g)}if(o===3){for(let h=0;h<r&&o>0;h++){let g=n[h];if(g>s&&(o--,g*2>=u))return-1}return d}}while(o>3);return-1}static patternToChar(n){for(let r=0;r<dt.CHARACTER_ENCODINGS.length;r++)if(dt.CHARACTER_ENCODINGS[r]===n)return dt.ALPHABET_STRING.charAt(r);if(n===dt.ASTERISK_ENCODING)return"*";throw new H}static decodeExtended(n){let r=n.length,s="";for(let o=0;o<r;o++){let a=n.charAt(o);if(a==="+"||a==="$"||a==="%"||a==="/"){let u=n.charAt(o+1),d="\0";switch(a){case"+":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)+32);else throw new k;break;case"$":if(u>="A"&&u<="Z")d=String.fromCharCode(u.charCodeAt(0)-64);else throw new k;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 k;break;case"/":if(u>="A"&&u<="O")d=String.fromCharCode(u.charCodeAt(0)-32);else if(u==="Z")d=":";else throw new k;break}s+=d,o++}else s+=a}return s}}dt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",dt.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],dt.ASTERISK_ENCODING=148;class Be extends ut{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(n,r,s){let o=this.decodeStart(r),a=this.decodeEnd(r),u=new ge;Be.decodeMiddle(r,o[1],a[0],u);let d=u.toString(),h=null;s!=null&&(h=s.get(U.ALLOWED_LENGTHS)),h==null&&(h=Be.DEFAULT_ALLOWED_LENGTHS);let g=d.length,x=!1,E=0;for(let b of h){if(g===b){x=!0;break}b>E&&(E=b)}if(!x&&g>E&&(x=!0),!x)throw new k;const A=[new ae(o[1],n),new ae(a[0],n)];return new Ke(d,null,0,A,le.ITF,new Date().getTime())}static decodeMiddle(n,r,s,o){let a=new Int32Array(10),u=new Int32Array(5),d=new Int32Array(5);for(a.fill(0),u.fill(0),d.fill(0);r<s;){ut.recordPattern(n,r,a);for(let g=0;g<5;g++){let x=2*g;u[g]=a[x],d[g]=a[x+1]}let h=Be.decodeDigit(u);o.append(h.toString()),h=this.decodeDigit(d),o.append(h.toString()),a.forEach(function(g){r+=g})}}decodeStart(n){let r=Be.skipWhiteSpace(n),s=Be.findGuardPattern(n,r,Be.START_PATTERN);return this.narrowLineWidth=(s[1]-s[0])/4,this.validateQuietZone(n,s[0]),s}validateQuietZone(n,r){let s=this.narrowLineWidth*10;s=s<r?s:r;for(let o=r-1;s>0&&o>=0&&!n.get(o);o--)s--;if(s!==0)throw new H}static skipWhiteSpace(n){const r=n.getSize(),s=n.getNextSet(0);if(s===r)throw new H;return s}decodeEnd(n){n.reverse();try{let r=Be.skipWhiteSpace(n),s;try{s=Be.findGuardPattern(n,r,Be.END_PATTERN_REVERSED[0])}catch(a){a instanceof H&&(s=Be.findGuardPattern(n,r,Be.END_PATTERN_REVERSED[1]))}this.validateQuietZone(n,s[0]);let o=s[0];return s[0]=n.getSize()-s[1],s[1]=n.getSize()-o,s}finally{n.reverse()}}static findGuardPattern(n,r,s){let o=s.length,a=new Int32Array(o),u=n.getSize(),d=!1,h=0,g=r;a.fill(0);for(let x=r;x<u;x++)if(n.get(x)!==d)a[h]++;else{if(h===o-1){if(ut.patternMatchVariance(a,s,Be.MAX_INDIVIDUAL_VARIANCE)<Be.MAX_AVG_VARIANCE)return[g,x];g+=a[0]+a[1],B.arraycopy(a,2,a,0,h-1),a[h-1]=0,a[h]=0,h--}else h++;a[h]=1,d=!d}throw new H}static decodeDigit(n){let r=Be.MAX_AVG_VARIANCE,s=-1,o=Be.PATTERNS.length;for(let a=0;a<o;a++){let u=Be.PATTERNS[a],d=ut.patternMatchVariance(n,u,Be.MAX_INDIVIDUAL_VARIANCE);d<r?(r=d,s=a):d===r&&(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 nt extends ut{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(n){let r=!1,s,o=0,a=Int32Array.from([0,0,0]);for(;!r;){a=Int32Array.from([0,0,0]),s=nt.findGuardPattern(n,o,!1,this.START_END_PATTERN,a);let u=s[0];o=s[1];let d=u-(o-u);d>=0&&(r=n.isRange(d,u,!1))}return s}static checkChecksum(n){return nt.checkStandardUPCEANChecksum(n)}static checkStandardUPCEANChecksum(n){let r=n.length;if(r===0)return!1;let s=parseInt(n.charAt(r-1),10);return nt.getStandardUPCEANChecksum(n.substring(0,r-1))===s}static getStandardUPCEANChecksum(n){let r=n.length,s=0;for(let o=r-1;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}s*=3;for(let o=r-2;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}return(1e3-s)%10}static decodeEnd(n,r){return nt.findGuardPattern(n,r,!1,nt.START_END_PATTERN,new Int32Array(nt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(n,r,s,o){return this.findGuardPattern(n,r,s,o,new Int32Array(o.length))}static findGuardPattern(n,r,s,o,a){let u=n.getSize();r=s?n.getNextUnset(r):n.getNextSet(r);let d=0,h=r,g=o.length,x=s;for(let E=r;E<u;E++)if(n.get(E)!==x)a[d]++;else{if(d===g-1){if(ut.patternMatchVariance(a,o,nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return Int32Array.from([h,E]);h+=a[0]+a[1];let A=a.slice(2,a.length-1);for(let I=0;I<d-1;I++)a[I]=A[I];a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,x=!x}throw new H}static decodeDigit(n,r,s,o){this.recordPattern(n,s,r);let a=this.MAX_AVG_VARIANCE,u=-1,d=o.length;for(let h=0;h<d;h++){let g=o[h],x=ut.patternMatchVariance(r,g,nt.MAX_INDIVIDUAL_VARIANCE);x<a&&(a=x,u=h)}if(u>=0)return u;throw new H}}nt.MAX_AVG_VARIANCE=.48,nt.MAX_INDIVIDUAL_VARIANCE=.7,nt.START_END_PATTERN=Int32Array.from([1,1,1]),nt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),nt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),nt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Ji{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(n,r,s){let o=this.decodeRowStringBuffer,a=this.decodeMiddle(r,s,o),u=o.toString(),d=Ji.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,n),new ae(a,n)],g=new Ke(u,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&g.putAllMetadata(d),g}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let g=0;g<5&&u<a;g++){let x=nt.decodeDigit(n,o,u,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<4-g),g!==4&&(u=n.getNextSet(u),u=n.getNextUnset(u))}if(s.length!==5)throw new H;let h=this.determineCheckDigit(d);if(Ji.extensionChecksum(s.toString())!==h)throw new H;return u}static extensionChecksum(n){let r=n.length,s=0;for(let o=r-2;o>=0;o-=2)s+=n.charAt(o).charCodeAt(0)-48;s*=3;for(let o=r-1;o>=0;o-=2)s+=n.charAt(o).charCodeAt(0)-48;return s*=3,s%10}determineCheckDigit(n){for(let r=0;r<10;r++)if(n===this.CHECK_DIGIT_ENCODINGS[r])return r;throw new H}static parseExtensionString(n){if(n.length!==5)return null;let r=Ji.parseExtension5String(n);return r==null?null:new Map([[wt.SUGGESTED_PRICE,r]])}static parseExtension5String(n){let r;switch(n.charAt(0)){case"0":r="£";break;case"5":r="$";break;case"9":switch(n){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}r="";break;default:r="";break}let s=parseInt(n.substring(1)),o=(s/100).toString(),a=s%100,u=a<10?"0"+a:a.toString();return r+o+"."+u}}class Ha{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(n,r,s){let o=this.decodeRowStringBuffer,a=this.decodeMiddle(r,s,o),u=o.toString(),d=Ha.parseExtensionString(u),h=[new ae((s[0]+s[1])/2,n),new ae(a,n)],g=new Ke(u,null,0,h,le.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&g.putAllMetadata(d),g}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let h=0;h<2&&u<a;h++){let g=nt.decodeDigit(n,o,u,nt.L_AND_G_PATTERNS);s+=String.fromCharCode(48+g%10);for(let x of o)u+=x;g>=10&&(d|=1<<1-h),h!==1&&(u=n.getNextSet(u),u=n.getNextUnset(u))}if(s.length!==2)throw new H;if(parseInt(s.toString())%4!==d)throw new H;return u}static parseExtensionString(n){return n.length!==2?null:new Map([[wt.ISSUE_NUMBER,parseInt(n)]])}}class $c{static decodeRow(n,r,s){let o=nt.findGuardPattern(r,s,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Ji().decodeRow(n,r,o)}catch{return new Ha().decodeRow(n,r,o)}}}$c.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Oe extends nt{constructor(){super(),this.decodeRowStringBuffer="",Oe.L_AND_G_PATTERNS=Oe.L_PATTERNS.map(n=>Int32Array.from(n));for(let n=10;n<20;n++){let r=Oe.L_PATTERNS[n-10],s=new Int32Array(r.length);for(let o=0;o<r.length;o++)s[o]=r[r.length-o-1];Oe.L_AND_G_PATTERNS[n]=s}}decodeRow(n,r,s){let o=Oe.findStartGuardPattern(r),a=s==null?null:s.get(U.NEED_RESULT_POINT_CALLBACK);if(a!=null){const Z=new ae((o[0]+o[1])/2,n);a.foundPossibleResultPoint(Z)}let u=this.decodeMiddle(r,o,this.decodeRowStringBuffer),d=u.rowOffset,h=u.resultString;if(a!=null){const Z=new ae(d,n);a.foundPossibleResultPoint(Z)}let g=this.decodeEnd(r,d);if(a!=null){const Z=new ae((g[0]+g[1])/2,n);a.foundPossibleResultPoint(Z)}let x=g[1],E=x+(x-g[0]);if(E>=r.getSize()||!r.isRange(x,E,!1))throw new H;let A=h.toString();if(A.length<8)throw new k;if(!Oe.checkChecksum(A))throw new M;let I=(o[1]+o[0])/2,b=(g[1]+g[0])/2,D=this.getBarcodeFormat(),L=[new ae(I,n),new ae(b,n)],z=new Ke(A,null,0,L,D,new Date().getTime()),q=0;try{let Z=$c.decodeRow(n,r,g[1]);z.putMetadata(wt.UPC_EAN_EXTENSION,Z.getText()),z.putAllMetadata(Z.getResultMetadata()),z.addResultPoints(Z.getResultPoints()),q=Z.getText().length}catch{}let $=s==null?null:s.get(U.ALLOWED_EAN_EXTENSIONS);if($!=null){let Z=!1;for(let ve in $)if(q.toString()===ve){Z=!0;break}if(!Z)throw new H}return z}decodeEnd(n,r){return Oe.findGuardPattern(n,r,!1,Oe.START_END_PATTERN,new Int32Array(Oe.START_END_PATTERN.length).fill(0))}static checkChecksum(n){return Oe.checkStandardUPCEANChecksum(n)}static checkStandardUPCEANChecksum(n){let r=n.length;if(r===0)return!1;let s=parseInt(n.charAt(r-1),10);return Oe.getStandardUPCEANChecksum(n.substring(0,r-1))===s}static getStandardUPCEANChecksum(n){let r=n.length,s=0;for(let o=r-1;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}s*=3;for(let o=r-2;o>=0;o-=2){let a=n.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;s+=a}return(1e3-s)%10}}class Pr extends Oe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(n,r,s){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1],d=0;for(let g=0;g<6&&u<a;g++){let x=Oe.decodeDigit(n,o,u,Oe.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<5-g)}s=Pr.determineFirstDigit(s,d),u=Oe.findGuardPattern(n,u,!0,Oe.MIDDLE_PATTERN,new Int32Array(Oe.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<6&&u<a;g++){let x=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+x);for(let E of o)u+=E}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_13}static determineFirstDigit(n,r){for(let s=0;s<10;s++)if(r===this.FIRST_DIGIT_ENCODINGS[s])return n=String.fromCharCode(48+s)+n,n;throw new H}}Pr.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Jc extends Oe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(n,r,s){const o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u=r[1];for(let h=0;h<4&&u<a;h++){let g=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+g);for(let x of o)u+=x}u=Oe.findGuardPattern(n,u,!0,Oe.MIDDLE_PATTERN,new Int32Array(Oe.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<4&&u<a;h++){let g=Oe.decodeDigit(n,o,u,Oe.L_PATTERNS);s+=String.fromCharCode(48+g);for(let x of o)u+=x}return{rowOffset:u,resultString:s}}getBarcodeFormat(){return le.EAN_8}}class e1 extends Oe{constructor(){super(...arguments),this.ean13Reader=new Pr}getBarcodeFormat(){return le.UPC_A}decode(n,r){return this.maybeReturnResult(this.ean13Reader.decode(n))}decodeRow(n,r,s){return this.maybeReturnResult(this.ean13Reader.decodeRow(n,r,s))}decodeMiddle(n,r,s){return this.ean13Reader.decodeMiddle(n,r,s)}maybeReturnResult(n){let r=n.getText();if(r.charAt(0)==="0"){let s=new Ke(r.substring(1),null,null,n.getResultPoints(),le.UPC_A);return n.getResultMetadata()!=null&&s.putAllMetadata(n.getResultMetadata()),s}else throw new H}reset(){this.ean13Reader.reset()}}class An extends Oe{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(n,r,s){const o=this.decodeMiddleCounters.map(g=>g);o[0]=0,o[1]=0,o[2]=0,o[3]=0;const a=n.getSize();let u=r[1],d=0;for(let g=0;g<6&&u<a;g++){const x=An.decodeDigit(n,o,u,An.L_AND_G_PATTERNS);s+=String.fromCharCode(48+x%10);for(let E of o)u+=E;x>=10&&(d|=1<<5-g)}let h=An.determineNumSysAndCheckDigit(s,d);return{rowOffset:u,resultString:h}}decodeEnd(n,r){return An.findGuardPatternWithoutCounters(n,r,!0,An.MIDDLE_END_PATTERN)}checkChecksum(n){return Oe.checkChecksum(An.convertUPCEtoUPCA(n))}static determineNumSysAndCheckDigit(n,r){for(let s=0;s<=1;s++)for(let o=0;o<10;o++)if(r===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[s][o]){let a=String.fromCharCode(48+s),u=String.fromCharCode(48+o);return a+n+u}throw H.getNotFoundInstance()}getBarcodeFormat(){return le.UPC_E}static convertUPCEtoUPCA(n){const r=n.slice(1,7).split("").map(a=>a.charCodeAt(0)),s=new ge;s.append(n.charAt(0));let o=r[5];switch(o){case 0:case 1:case 2:s.appendChars(r,0,2),s.append(o),s.append("0000"),s.appendChars(r,2,3);break;case 3:s.appendChars(r,0,3),s.append("00000"),s.appendChars(r,3,2);break;case 4:s.appendChars(r,0,4),s.append("00000"),s.append(r[4]);break;default:s.appendChars(r,0,5),s.append("0000"),s.append(o);break}return n.length>=8&&s.append(n.charAt(7)),s.toString()}}An.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),An.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 Ga extends ut{constructor(n){super();let r=n==null?null:n.get(U.POSSIBLE_FORMATS),s=[];l(r)?(s.push(new Pr),s.push(new e1),s.push(new Jc),s.push(new An)):(r.indexOf(le.EAN_13)>-1&&s.push(new Pr),r.indexOf(le.UPC_A)>-1&&s.push(new e1),r.indexOf(le.EAN_8)>-1&&s.push(new Jc),r.indexOf(le.UPC_E)>-1&&s.push(new An)),this.readers=s}decodeRow(n,r,s){for(let o of this.readers)try{const a=o.decodeRow(n,r,s),u=a.getBarcodeFormat()===le.EAN_13&&a.getText().charAt(0)==="0",d=s==null?null:s.get(U.POSSIBLE_FORMATS),h=d==null||d.includes(le.UPC_A);if(u&&h){const g=a.getRawBytes(),x=new Ke(a.getText().substring(1),g,g?g.length:null,a.getResultPoints(),le.UPC_A);return x.putAllMetadata(a.getResultMetadata()),x}return a}catch{}throw new H}reset(){for(let n of this.readers)n.reset()}}class bt extends ut{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(n,r){for(let s=0;s<r.length;s++)if(ut.patternMatchVariance(n,r[s],bt.MAX_INDIVIDUAL_VARIANCE)<bt.MAX_AVG_VARIANCE)return s;throw new H}static count(n){return Te.sum(new Int32Array(n))}static increment(n,r){let s=0,o=r[0];for(let a=1;a<n.length;a++)r[a]>o&&(o=r[a],s=a);n[s]++}static decrement(n,r){let s=0,o=r[0];for(let a=1;a<n.length;a++)r[a]<o&&(o=r[a],s=a);n[s]--}static isFinderPattern(n){let r=n[0]+n[1],s=r+n[2]+n[3],o=r/s;if(o>=bt.MIN_FINDER_PATTERN_RATIO&&o<=bt.MAX_FINDER_PATTERN_RATIO){let a=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;for(let d of n)d>u&&(u=d),d<a&&(a=d);return u<10*a}return!1}}bt.MAX_AVG_VARIANCE=.2,bt.MAX_INDIVIDUAL_VARIANCE=.45,bt.MIN_FINDER_PATTERN_RATIO=9.5/12,bt.MAX_FINDER_PATTERN_RATIO=12.5/14;class ii{constructor(n,r){this.value=n,this.checksumPortion=r}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(n){if(!(n instanceof ii))return!1;const r=n;return this.value===r.value&&this.checksumPortion===r.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class lo{constructor(n,r,s,o,a){this.value=n,this.startEnd=r,this.value=n,this.startEnd=r,this.resultPoints=new Array,this.resultPoints.push(new ae(s,a)),this.resultPoints.push(new ae(o,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(n){if(!(n instanceof lo))return!1;const r=n;return this.value===r.value}hashCode(){return this.value}}class Mn{constructor(){}static getRSSvalue(n,r,s){let o=0;for(let h of n)o+=h;let a=0,u=0,d=n.length;for(let h=0;h<d-1;h++){let g;for(g=1,u|=1<<h;g<n[h];g++,u&=~(1<<h)){let x=Mn.combins(o-g-1,d-h-2);if(s&&u===0&&o-g-(d-h-1)>=d-h-1&&(x-=Mn.combins(o-g-(d-h),d-h-2)),d-h-1>1){let E=0;for(let A=o-g-(d-h-2);A>r;A--)E+=Mn.combins(o-g-A-1,d-h-3);x-=E*(d-1-h)}else o-g>r&&x--;a+=x}o-=g}return a}static combins(n,r){let s,o;n-r>r?(o=r,s=n-r):(o=n-r,s=r);let a=1,u=1;for(let d=n;d>s;d--)a*=d,u<=o&&(a/=u,u++);for(;u<=o;)a/=u,u++;return a}}class Oh{static buildBitArray(n){let r=n.length*2-1;n[n.length-1].getRightChar()==null&&(r-=1);let s=12*r,o=new G(s),a=0,d=n[0].getRightChar().getValue();for(let h=11;h>=0;--h)d&1<<h&&o.set(a),a++;for(let h=1;h<n.length;++h){let g=n[h],x=g.getLeftChar().getValue();for(let E=11;E>=0;--E)x&1<<E&&o.set(a),a++;if(g.getRightChar()!=null){let E=g.getRightChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&o.set(a),a++}}return o}}class Br{constructor(n,r){r?this.decodedInformation=null:(this.finished=n,this.decodedInformation=r)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Xa{constructor(n){this.newPosition=n}getNewPosition(){return this.newPosition}}class Ht extends Xa{constructor(n,r){super(n),this.value=r}getValue(){return this.value}isFNC1(){return this.value===Ht.FNC1}}Ht.FNC1="$";class Lr extends Xa{constructor(n,r,s){super(n),s?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=r}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class fn extends Xa{constructor(n,r,s){if(super(n),r<0||r>10||s<0||s>10)throw new k;this.firstDigit=r,this.secondDigit=s}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===fn.FNC1}isSecondDigitFNC1(){return this.secondDigit===fn.FNC1}isAnyFNC1(){return this.firstDigit===fn.FNC1||this.secondDigit===fn.FNC1}}fn.FNC1=10;class re{constructor(){}static parseFieldsInGeneralPurpose(n){if(!n)return null;if(n.length<2)throw new H;let r=n.substring(0,2);for(let a of re.TWO_DIGIT_DATA_LENGTH)if(a[0]===r)return a[1]===re.VARIABLE_LENGTH?re.processVariableAI(2,a[2],n):re.processFixedAI(2,a[1],n);if(n.length<3)throw new H;let s=n.substring(0,3);for(let a of re.THREE_DIGIT_DATA_LENGTH)if(a[0]===s)return a[1]===re.VARIABLE_LENGTH?re.processVariableAI(3,a[2],n):re.processFixedAI(3,a[1],n);for(let a of re.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(a[0]===s)return a[1]===re.VARIABLE_LENGTH?re.processVariableAI(4,a[2],n):re.processFixedAI(4,a[1],n);if(n.length<4)throw new H;let o=n.substring(0,4);for(let a of re.FOUR_DIGIT_DATA_LENGTH)if(a[0]===o)return a[1]===re.VARIABLE_LENGTH?re.processVariableAI(4,a[2],n):re.processFixedAI(4,a[1],n);throw new H}static processFixedAI(n,r,s){if(s.length<n)throw new H;let o=s.substring(0,n);if(s.length<n+r)throw new H;let a=s.substring(n,n+r),u=s.substring(n+r),d="("+o+")"+a,h=re.parseFieldsInGeneralPurpose(u);return h==null?d:d+h}static processVariableAI(n,r,s){let o=s.substring(0,n),a;s.length<n+r?a=s.length:a=n+r;let u=s.substring(n,a),d=s.substring(a),h="("+o+")"+u,g=re.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}}re.VARIABLE_LENGTH=[],re.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",re.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",re.VARIABLE_LENGTH,20],["22",re.VARIABLE_LENGTH,29],["30",re.VARIABLE_LENGTH,8],["37",re.VARIABLE_LENGTH,8],["90",re.VARIABLE_LENGTH,30],["91",re.VARIABLE_LENGTH,30],["92",re.VARIABLE_LENGTH,30],["93",re.VARIABLE_LENGTH,30],["94",re.VARIABLE_LENGTH,30],["95",re.VARIABLE_LENGTH,30],["96",re.VARIABLE_LENGTH,30],["97",re.VARIABLE_LENGTH,3],["98",re.VARIABLE_LENGTH,30],["99",re.VARIABLE_LENGTH,30]],re.THREE_DIGIT_DATA_LENGTH=[["240",re.VARIABLE_LENGTH,30],["241",re.VARIABLE_LENGTH,30],["242",re.VARIABLE_LENGTH,6],["250",re.VARIABLE_LENGTH,30],["251",re.VARIABLE_LENGTH,30],["253",re.VARIABLE_LENGTH,17],["254",re.VARIABLE_LENGTH,20],["400",re.VARIABLE_LENGTH,30],["401",re.VARIABLE_LENGTH,30],["402",17],["403",re.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",re.VARIABLE_LENGTH,20],["421",re.VARIABLE_LENGTH,15],["422",3],["423",re.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],re.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",re.VARIABLE_LENGTH,15],["391",re.VARIABLE_LENGTH,18],["392",re.VARIABLE_LENGTH,15],["393",re.VARIABLE_LENGTH,18],["703",re.VARIABLE_LENGTH,30]],re.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",re.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",re.VARIABLE_LENGTH,20],["8003",re.VARIABLE_LENGTH,30],["8004",re.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",re.VARIABLE_LENGTH,30],["8008",re.VARIABLE_LENGTH,12],["8018",18],["8020",re.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",re.VARIABLE_LENGTH,70],["8200",re.VARIABLE_LENGTH,70]];class si{constructor(n){this.buffer=new ge,this.information=n}decodeAllCodes(n,r){let s=r,o=null;do{let a=this.decodeGeneralPurposeField(s,o),u=re.parseFieldsInGeneralPurpose(a.getNewString());if(u!=null&&n.append(u),a.isRemaining()?o=""+a.getRemainingValue():o=null,s===a.getNewPosition())break;s=a.getNewPosition()}while(!0);return n.toString()}isStillNumeric(n){if(n+7>this.information.getSize())return n+4<=this.information.getSize();for(let r=n;r<n+3;++r)if(this.information.get(r))return!0;return this.information.get(n+3)}decodeNumeric(n){if(n+7>this.information.getSize()){let a=this.extractNumericValueFromBitArray(n,4);return a===0?new fn(this.information.getSize(),fn.FNC1,fn.FNC1):new fn(this.information.getSize(),a-1,fn.FNC1)}let r=this.extractNumericValueFromBitArray(n,7),s=(r-8)/11,o=(r-8)%11;return new fn(n+7,s,o)}extractNumericValueFromBitArray(n,r){return si.extractNumericValueFromBitArray(this.information,n,r)}static extractNumericValueFromBitArray(n,r,s){let o=0;for(let a=0;a<s;++a)n.get(r+a)&&(o|=1<<s-a-1);return o}decodeGeneralPurposeField(n,r){this.buffer.setLengthToZero(),r!=null&&this.buffer.append(r),this.current.setPosition(n);let s=this.parseBlocks();return s!=null&&s.isRemaining()?new Lr(this.current.getPosition(),this.buffer.toString(),s.getRemainingValue()):new Lr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let n,r;do{let s=this.current.getPosition();if(this.current.isAlpha()?(r=this.parseAlphaBlock(),n=r.isFinished()):this.current.isIsoIec646()?(r=this.parseIsoIec646Block(),n=r.isFinished()):(r=this.parseNumericBlock(),n=r.isFinished()),!(s!==this.current.getPosition())&&!n)break}while(!n);return r.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let n=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFirstDigitFNC1()){let r;return n.isSecondDigitFNC1()?r=new Lr(this.current.getPosition(),this.buffer.toString()):r=new Lr(this.current.getPosition(),this.buffer.toString(),n.getSecondDigit()),new Br(!0,r)}if(this.buffer.append(n.getFirstDigit()),n.isSecondDigitFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Br(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let n=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.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 Br(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let n=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(n.getNewPosition()),n.isFNC1()){let r=new Lr(this.current.getPosition(),this.buffer.toString());return new Br(!0,r)}this.buffer.append(n.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 Br(!1)}isStillIsoIec646(n){if(n+5>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(n,5);if(r>=5&&r<16)return!0;if(n+7>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(n,7);if(s>=64&&s<116)return!0;if(n+8>this.information.getSize())return!1;let o=this.extractNumericValueFromBitArray(n,8);return o>=232&&o<253}decodeIsoIec646(n){let r=this.extractNumericValueFromBitArray(n,5);if(r===15)return new Ht(n+5,Ht.FNC1);if(r>=5&&r<15)return new Ht(n+5,"0"+(r-5));let s=this.extractNumericValueFromBitArray(n,7);if(s>=64&&s<90)return new Ht(n+7,""+(s+1));if(s>=90&&s<116)return new Ht(n+7,""+(s+7));let o=this.extractNumericValueFromBitArray(n,8),a;switch(o){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new k}return new Ht(n+8,a)}isStillAlpha(n){if(n+5>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(n,5);if(r>=5&&r<16)return!0;if(n+6>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(n,6);return s>=16&&s<63}decodeAlphanumeric(n){let r=this.extractNumericValueFromBitArray(n,5);if(r===15)return new Ht(n+5,Ht.FNC1);if(r>=5&&r<15)return new Ht(n+5,"0"+(r-5));let s=this.extractNumericValueFromBitArray(n,6);if(s>=32&&s<58)return new Ht(n+6,""+(s+33));let o;switch(s){case 58:o="*";break;case 59:o=",";break;case 60:o="-";break;case 61:o=".";break;case 62:o="/";break;default:throw new Dn("Decoding invalid alphanumeric value: "+s)}return new Ht(n+6,o)}isAlphaTo646ToAlphaLatch(n){if(n+1>this.information.getSize())return!1;for(let r=0;r<5&&r+n<this.information.getSize();++r)if(r===2){if(!this.information.get(n+2))return!1}else if(this.information.get(n+r))return!1;return!0}isAlphaOr646ToNumericLatch(n){if(n+3>this.information.getSize())return!1;for(let r=n;r<n+3;++r)if(this.information.get(r))return!1;return!0}isNumericToAlphaNumericLatch(n){if(n+1>this.information.getSize())return!1;for(let r=0;r<4&&r+n<this.information.getSize();++r)if(this.information.get(n+r))return!1;return!0}}class Ya{constructor(n){this.information=n,this.generalDecoder=new si(n)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Gt extends Ya{constructor(n){super(n)}encodeCompressedGtin(n,r){n.append("(01)");let s=n.length();n.append("9"),this.encodeCompressedGtinWithoutAI(n,r,s)}encodeCompressedGtinWithoutAI(n,r,s){for(let o=0;o<4;++o){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(r+10*o,10);a/100===0&&n.append("0"),a/10===0&&n.append("0"),n.append(a)}Gt.appendCheckDigit(n,s)}static appendCheckDigit(n,r){let s=0;for(let o=0;o<13;o++){let a=n.charAt(o+r).charCodeAt(0)-48;s+=o&1?a:3*a}s=10-s%10,s===10&&(s=0),n.append(s)}}Gt.GTIN_SIZE=40;class oi extends Gt{constructor(n){super(n)}parseInformation(){let n=new ge;n.append("(01)");let r=n.length(),s=this.getGeneralDecoder().extractNumericValueFromBitArray(oi.HEADER_SIZE,4);return n.append(s),this.encodeCompressedGtinWithoutAI(n,oi.HEADER_SIZE+4,r),this.getGeneralDecoder().decodeAllCodes(n,oi.HEADER_SIZE+44)}}oi.HEADER_SIZE=4;class uo extends Ya{constructor(n){super(n)}parseInformation(){let n=new ge;return this.getGeneralDecoder().decodeAllCodes(n,uo.HEADER_SIZE)}}uo.HEADER_SIZE=5;class co extends Gt{constructor(n){super(n)}encodeCompressedWeight(n,r,s){let o=this.getGeneralDecoder().extractNumericValueFromBitArray(r,s);this.addWeightCode(n,o);let a=this.checkWeight(o),u=1e5;for(let d=0;d<5;++d)a/u===0&&n.append("0"),u/=10;n.append(a)}}class kn extends co{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()!=kn.HEADER_SIZE+co.GTIN_SIZE+kn.WEIGHT_SIZE)throw new H;let n=new ge;return this.encodeCompressedGtin(n,kn.HEADER_SIZE),this.encodeCompressedWeight(n,kn.HEADER_SIZE+co.GTIN_SIZE,kn.WEIGHT_SIZE),n.toString()}}kn.HEADER_SIZE=5,kn.WEIGHT_SIZE=15;class Dh extends kn{constructor(n){super(n)}addWeightCode(n,r){n.append("(3103)")}checkWeight(n){return n}}class Mh extends kn{constructor(n){super(n)}addWeightCode(n,r){r<1e4?n.append("(3202)"):n.append("(3203)")}checkWeight(n){return n<1e4?n:n-1e4}}class Pn extends Gt{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()<Pn.HEADER_SIZE+Gt.GTIN_SIZE)throw new H;let n=new ge;this.encodeCompressedGtin(n,Pn.HEADER_SIZE);let r=this.getGeneralDecoder().extractNumericValueFromBitArray(Pn.HEADER_SIZE+Gt.GTIN_SIZE,Pn.LAST_DIGIT_SIZE);n.append("(392"),n.append(r),n.append(")");let s=this.getGeneralDecoder().decodeGeneralPurposeField(Pn.HEADER_SIZE+Gt.GTIN_SIZE+Pn.LAST_DIGIT_SIZE,null);return n.append(s.getNewString()),n.toString()}}Pn.HEADER_SIZE=8,Pn.LAST_DIGIT_SIZE=2;class Ft extends Gt{constructor(n){super(n)}parseInformation(){if(this.getInformation().getSize()<Ft.HEADER_SIZE+Gt.GTIN_SIZE)throw new H;let n=new ge;this.encodeCompressedGtin(n,Ft.HEADER_SIZE);let r=this.getGeneralDecoder().extractNumericValueFromBitArray(Ft.HEADER_SIZE+Gt.GTIN_SIZE,Ft.LAST_DIGIT_SIZE);n.append("(393"),n.append(r),n.append(")");let s=this.getGeneralDecoder().extractNumericValueFromBitArray(Ft.HEADER_SIZE+Gt.GTIN_SIZE+Ft.LAST_DIGIT_SIZE,Ft.FIRST_THREE_DIGITS_SIZE);s/100==0&&n.append("0"),s/10==0&&n.append("0"),n.append(s);let o=this.getGeneralDecoder().decodeGeneralPurposeField(Ft.HEADER_SIZE+Gt.GTIN_SIZE+Ft.LAST_DIGIT_SIZE+Ft.FIRST_THREE_DIGITS_SIZE,null);return n.append(o.getNewString()),n.toString()}}Ft.HEADER_SIZE=8,Ft.LAST_DIGIT_SIZE=2,Ft.FIRST_THREE_DIGITS_SIZE=10;class Xe extends co{constructor(n,r,s){super(n),this.dateCode=s,this.firstAIdigits=r}parseInformation(){if(this.getInformation().getSize()!=Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE+Xe.DATE_SIZE)throw new H;let n=new ge;return this.encodeCompressedGtin(n,Xe.HEADER_SIZE),this.encodeCompressedWeight(n,Xe.HEADER_SIZE+Xe.GTIN_SIZE,Xe.WEIGHT_SIZE),this.encodeCompressedDate(n,Xe.HEADER_SIZE+Xe.GTIN_SIZE+Xe.WEIGHT_SIZE),n.toString()}encodeCompressedDate(n,r){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(r,Xe.DATE_SIZE);if(s==38400)return;n.append("("),n.append(this.dateCode),n.append(")");let o=s%32;s/=32;let a=s%12+1;s/=12;let u=s;u/10==0&&n.append("0"),n.append(u),a/10==0&&n.append("0"),n.append(a),o/10==0&&n.append("0"),n.append(o)}addWeightCode(n,r){n.append("("),n.append(this.firstAIdigits),n.append(r/1e5),n.append(")")}checkWeight(n){return n%1e5}}Xe.HEADER_SIZE=8,Xe.WEIGHT_SIZE=20,Xe.DATE_SIZE=16;function t1(y){try{if(y.get(1))return new oi(y);if(!y.get(2))return new uo(y);switch(si.extractNumericValueFromBitArray(y,1,4)){case 4:return new Dh(y);case 5:return new Mh(y)}switch(si.extractNumericValueFromBitArray(y,1,5)){case 12:return new Pn(y);case 13:return new Ft(y)}switch(si.extractNumericValueFromBitArray(y,1,7)){case 56:return new Xe(y,"310","11");case 57:return new Xe(y,"320","11");case 58:return new Xe(y,"310","13");case 59:return new Xe(y,"320","13");case 60:return new Xe(y,"310","15");case 61:return new Xe(y,"320","15");case 62:return new Xe(y,"310","17");case 63:return new Xe(y,"320","17")}}catch(n){throw console.log(n),new Dn("unknown decoder: "+y)}}class or{constructor(n,r,s,o){this.leftchar=n,this.rightchar=r,this.finderpattern=s,this.maybeLast=o}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(n,r){return n instanceof or?or.equalsOrNull(n.leftchar,r.leftchar)&&or.equalsOrNull(n.rightchar,r.rightchar)&&or.equalsOrNull(n.finderpattern,r.finderpattern):!1}static equalsOrNull(n,r){return n===null?r===null:or.equals(n,r)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Za{constructor(n,r,s){this.pairs=n,this.rowNumber=r,this.wasReversed=s}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(n){return this.checkEqualitity(this,n)}toString(){return"{ "+this.pairs+" }"}equals(n,r){return n instanceof Za?this.checkEqualitity(n,r)&&n.wasReversed===r.wasReversed:!1}checkEqualitity(n,r){if(!n||!r)return;let s;return n.forEach((o,a)=>{r.forEach(u=>{o.getLeftChar().getValue()===u.getLeftChar().getValue()&&o.getRightChar().getValue()===u.getRightChar().getValue()&&o.getFinderPatter().getValue()===u.getFinderPatter().getValue()&&(s=!0)})}),s}}class Y extends bt{constructor(n){super(...arguments),this.pairs=new Array(Y.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=n===!0}decodeRow(n,r,s){this.pairs.length=0,this.startFromEven=!1;try{return Y.constructResult(this.decodeRow2pairs(n,r))}catch(o){this.verbose&&console.log(o)}return this.pairs.length=0,this.startFromEven=!0,Y.constructResult(this.decodeRow2pairs(n,r))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(n,r){let s=!1;for(;!s;)try{this.pairs.push(this.retrieveNextPair(r,this.pairs,n))}catch(a){if(a instanceof H){if(!this.pairs.length)throw new H;s=!0}}if(this.checkChecksum())return this.pairs;let o;if(this.rows.length?o=!0:o=!1,this.storeRow(n,!1),o){let a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new H}checkRowsBoolean(n){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,n&&(this.rows=this.rows.reverse());let r=null;try{r=this.checkRows(new Array,0)}catch(s){this.verbose&&console.log(s)}return n&&(this.rows=this.rows.reverse()),r}checkRows(n,r){for(let s=r;s<this.rows.length;s++){let o=this.rows[s];this.pairs.length=0;for(let u of n)this.pairs.push(u.getPairs());if(this.pairs.push(o.getPairs()),!Y.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let a=new Array(n);a.push(o);try{return this.checkRows(a,s+1)}catch(u){this.verbose&&console.log(u)}}throw new H}static isValidSequence(n){for(let r of Y.FINDER_PATTERN_SEQUENCES){if(n.length>r.length)continue;let s=!0;for(let o=0;o<n.length;o++)if(n[o].getFinderPattern().getValue()!=r[o]){s=!1;break}if(s)return!0}return!1}storeRow(n,r){let s=0,o=!1,a=!1;for(;s<this.rows.length;){let u=this.rows[s];if(u.getRowNumber()>n){a=u.isEquivalent(this.pairs);break}o=u.isEquivalent(this.pairs),s++}a||o||Y.isPartialRow(this.pairs,this.rows)||(this.rows.push(s,new Za(this.pairs,n,r)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(n,r){for(let s of r)if(s.getPairs().length!==n.length){for(let o of s.getPairs())for(let a of n)if(or.equals(o,a))break}}static isPartialRow(n,r){for(let s of r){let o=!0;for(let a of n){let u=!1;for(let d of s.getPairs())if(a.equals(d)){u=!0;break}if(!u){o=!1;break}}if(o)return!0}return!1}getRows(){return this.rows}static constructResult(n){let r=Oh.buildBitArray(n),o=t1(r).parseInformation(),a=n[0].getFinderPattern().getResultPoints(),u=n[n.length-1].getFinderPattern().getResultPoints(),d=[a[0],a[1],u[0],u[1]];return new Ke(o,null,null,d,le.RSS_EXPANDED,null)}checkChecksum(){let n=this.pairs.get(0),r=n.getLeftChar(),s=n.getRightChar();if(s==null)return!1;let o=s.getChecksumPortion(),a=2;for(let d=1;d<this.pairs.size();++d){let h=this.pairs.get(d);o+=h.getLeftChar().getChecksumPortion(),a++;let g=h.getRightChar();g!=null&&(o+=g.getChecksumPortion(),a++)}return o%=211,211*(a-4)+o==r.getValue()}static getNextSecondBar(n,r){let s;return n.get(r)?(s=n.getNextUnset(r),s=n.getNextSet(s)):(s=n.getNextSet(r),s=n.getNextUnset(s)),s}retrieveNextPair(n,r,s){let o=r.length%2==0;this.startFromEven&&(o=!o);let a,u=!0,d=-1;do this.findNextPair(n,r,d),a=this.parseFoundFinderPattern(n,s,o),a==null?d=Y.getNextSecondBar(n,this.startEnd[0]):u=!1;while(u);let h=this.decodeDataCharacter(n,a,o,!0);if(!this.isEmptyPair(r)&&r[r.length-1].mustBeLast())throw new H;let g;try{g=this.decodeDataCharacter(n,a,o,!1)}catch(x){g=null,this.verbose&&console.log(x)}return new or(h,g,a,!0)}isEmptyPair(n){return n.length===0}findNextPair(n,r,s){let o=this.getDecodeFinderCounters();o[0]=0,o[1]=0,o[2]=0,o[3]=0;let a=n.getSize(),u;s>=0?u=s:this.isEmptyPair(r)?u=0:u=r[r.length-1].getFinderPattern().getStartEnd()[1];let d=r.length%2!=0;this.startFromEven&&(d=!d);let h=!1;for(;u<a&&(h=!n.get(u),!!h);)u++;let g=0,x=u;for(let E=u;E<a;E++)if(n.get(E)!=h)o[g]++;else{if(g==3){if(d&&Y.reverseCounters(o),Y.isFinderPattern(o)){this.startEnd[0]=x,this.startEnd[1]=E;return}d&&Y.reverseCounters(o),x+=o[0]+o[1],o[0]=o[2],o[1]=o[3],o[2]=0,o[3]=0,g--}else g++;o[g]=1,h=!h}throw new H}static reverseCounters(n){let r=n.length;for(let s=0;s<r/2;++s){let o=n[s];n[s]=n[r-s-1],n[r-s-1]=o}}parseFoundFinderPattern(n,r,s){let o,a,u;if(s){let g=this.startEnd[0]-1;for(;g>=0&&!n.get(g);)g--;g++,o=this.startEnd[0]-g,a=g,u=this.startEnd[1]}else a=this.startEnd[0],u=n.getNextUnset(this.startEnd[1]+1),o=u-this.startEnd[1];let d=this.getDecodeFinderCounters();B.arraycopy(d,0,d,1,d.length-1),d[0]=o;let h;try{h=this.parseFinderValue(d,Y.FINDER_PATTERNS)}catch{return null}return new lo(h,[a,u],a,u,r)}decodeDataCharacter(n,r,s,o){let a=this.getDataCharacterCounters();for(let Fe=0;Fe<a.length;Fe++)a[Fe]=0;if(o)Y.recordPatternInReverse(n,r.getStartEnd()[0],a);else{Y.recordPattern(n,r.getStartEnd()[1],a);for(let Fe=0,_t=a.length-1;Fe<_t;Fe++,_t--){let tn=a[Fe];a[Fe]=a[_t],a[_t]=tn}}let u=17,d=Te.sum(new Int32Array(a))/u,h=(r.getStartEnd()[1]-r.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new H;let g=this.getOddCounts(),x=this.getEvenCounts(),E=this.getOddRoundingErrors(),A=this.getEvenRoundingErrors();for(let Fe=0;Fe<a.length;Fe++){let _t=1*a[Fe]/d,tn=_t+.5;if(tn<1){if(_t<.3)throw new H;tn=1}else if(tn>8){if(_t>8.7)throw new H;tn=8}let fi=Fe/2;Fe&1?(x[fi]=tn,A[fi]=_t-tn):(g[fi]=tn,E[fi]=_t-tn)}this.adjustOddEvenCounts(u);let I=4*r.getValue()+(s?0:2)+(o?0:1)-1,b=0,D=0;for(let Fe=g.length-1;Fe>=0;Fe--){if(Y.isNotA1left(r,s,o)){let _t=Y.WEIGHTS[I][2*Fe];D+=g[Fe]*_t}b+=g[Fe]}let L=0;for(let Fe=x.length-1;Fe>=0;Fe--)if(Y.isNotA1left(r,s,o)){let _t=Y.WEIGHTS[I][2*Fe+1];L+=x[Fe]*_t}let z=D+L;if(b&1||b>13||b<4)throw new H;let q=(13-b)/2,$=Y.SYMBOL_WIDEST[q],Z=9-$,ve=Mn.getRSSvalue(g,$,!0),me=Mn.getRSSvalue(x,Z,!1),Yt=Y.EVEN_TOTAL_SUBSET[q],vn=Y.GSUM[q],Zt=ve*Yt+me+vn;return new ii(Zt,z)}static isNotA1left(n,r,s){return!(n.getValue()==0&&r&&s)}adjustOddEvenCounts(n){let r=Te.sum(new Int32Array(this.getOddCounts())),s=Te.sum(new Int32Array(this.getEvenCounts())),o=!1,a=!1;r>13?a=!0:r<4&&(o=!0);let u=!1,d=!1;s>13?d=!0:s<4&&(u=!0);let h=r+s-n,g=(r&1)==1,x=(s&1)==0;if(h==1)if(g){if(x)throw new H;a=!0}else{if(!x)throw new H;d=!0}else if(h==-1)if(g){if(x)throw new H;o=!0}else{if(!x)throw new H;u=!0}else if(h==0){if(g){if(!x)throw new H;r<s?(o=!0,d=!0):(a=!0,u=!0)}else if(x)throw new H}else throw new H;if(o){if(a)throw new H;Y.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&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 kh extends ii{constructor(n,r,s){super(n,r),this.count=0,this.finderPattern=s}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class rt extends bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(n,r,s){const o=this.decodePair(r,!1,n,s);rt.addOrTally(this.possibleLeftPairs,o),r.reverse();let a=this.decodePair(r,!0,n,s);rt.addOrTally(this.possibleRightPairs,a),r.reverse();for(let u of this.possibleLeftPairs)if(u.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&rt.checkChecksum(u,d))return rt.constructResult(u,d)}throw new H}static addOrTally(n,r){if(r==null)return;let s=!1;for(let o of n)if(o.getValue()===r.getValue()){o.incrementCount(),s=!0;break}s||n.push(r)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(n,r){let s=4537077*n.getValue()+r.getValue(),o=new String(s).toString(),a=new ge;for(let g=13-o.length;g>0;g--)a.append("0");a.append(o);let u=0;for(let g=0;g<13;g++){let x=a.charAt(g).charCodeAt(0)-48;u+=g&1?x:3*x}u=10-u%10,u===10&&(u=0),a.append(u.toString());let d=n.getFinderPattern().getResultPoints(),h=r.getFinderPattern().getResultPoints();return new Ke(a.toString(),null,0,[d[0],d[1],h[0],h[1]],le.RSS_14,new Date().getTime())}static checkChecksum(n,r){let s=(n.getChecksumPortion()+16*r.getChecksumPortion())%79,o=9*n.getFinderPattern().getValue()+r.getFinderPattern().getValue();return o>72&&o--,o>8&&o--,s===o}decodePair(n,r,s,o){try{let a=this.findFinderPattern(n,r),u=this.parseFoundFinderPattern(n,s,r,a),d=o==null?null:o.get(U.NEED_RESULT_POINT_CALLBACK);if(d!=null){let x=(a[0]+a[1])/2;r&&(x=n.getSize()-1-x),d.foundPossibleResultPoint(new ae(x,s))}let h=this.decodeDataCharacter(n,u,!0),g=this.decodeDataCharacter(n,u,!1);return new kh(1597*h.getValue()+g.getValue(),h.getChecksumPortion()+4*g.getChecksumPortion(),u)}catch{return null}}decodeDataCharacter(n,r,s){let o=this.getDataCharacterCounters();for(let L=0;L<o.length;L++)o[L]=0;if(s)ut.recordPatternInReverse(n,r.getStartEnd()[0],o);else{ut.recordPattern(n,r.getStartEnd()[1]+1,o);for(let L=0,z=o.length-1;L<z;L++,z--){let q=o[L];o[L]=o[z],o[z]=q}}let a=s?16:15,u=Te.sum(new Int32Array(o))/a,d=this.getOddCounts(),h=this.getEvenCounts(),g=this.getOddRoundingErrors(),x=this.getEvenRoundingErrors();for(let L=0;L<o.length;L++){let z=o[L]/u,q=Math.floor(z+.5);q<1?q=1:q>8&&(q=8);let $=Math.floor(L/2);L&1?(h[$]=q,x[$]=z-q):(d[$]=q,g[$]=z-q)}this.adjustOddEvenCounts(s,a);let E=0,A=0;for(let L=d.length-1;L>=0;L--)A*=9,A+=d[L],E+=d[L];let I=0,b=0;for(let L=h.length-1;L>=0;L--)I*=9,I+=h[L],b+=h[L];let D=A+3*I;if(s){if(E&1||E>12||E<4)throw new H;let L=(12-E)/2,z=rt.OUTSIDE_ODD_WIDEST[L],q=9-z,$=Mn.getRSSvalue(d,z,!1),Z=Mn.getRSSvalue(h,q,!0),ve=rt.OUTSIDE_EVEN_TOTAL_SUBSET[L],me=rt.OUTSIDE_GSUM[L];return new ii($*ve+Z+me,D)}else{if(b&1||b>10||b<4)throw new H;let L=(10-b)/2,z=rt.INSIDE_ODD_WIDEST[L],q=9-z,$=Mn.getRSSvalue(d,z,!0),Z=Mn.getRSSvalue(h,q,!1),ve=rt.INSIDE_ODD_TOTAL_SUBSET[L],me=rt.INSIDE_GSUM[L];return new ii(Z*ve+$+me,D)}}findFinderPattern(n,r){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let o=n.getSize(),a=!1,u=0;for(;u<o&&(a=!n.get(u),r!==a);)u++;let d=0,h=u;for(let g=u;g<o;g++)if(n.get(g)!==a)s[d]++;else{if(d===3){if(bt.isFinderPattern(s))return[h,g];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,a=!a}throw new H}parseFoundFinderPattern(n,r,s,o){let a=n.get(o[0]),u=o[0]-1;for(;u>=0&&a!==n.get(u);)u--;u++;const d=o[0]-u,h=this.getDecodeFinderCounters(),g=new Int32Array(h.length);B.arraycopy(h,0,g,1,h.length-1),g[0]=d;const x=this.parseFinderValue(g,rt.FINDER_PATTERNS);let E=u,A=o[1];return s&&(E=n.getSize()-1-E,A=n.getSize()-1-A),new lo(x,[u,o[1]],E,A,r)}adjustOddEvenCounts(n,r){let s=Te.sum(new Int32Array(this.getOddCounts())),o=Te.sum(new Int32Array(this.getEvenCounts())),a=!1,u=!1,d=!1,h=!1;n?(s>12?u=!0:s<4&&(a=!0),o>12?h=!0:o<4&&(d=!0)):(s>11?u=!0:s<5&&(a=!0),o>10?h=!0:o<4&&(d=!0));let g=s+o-r,x=(s&1)===(n?1:0),E=(o&1)===1;if(g===1)if(x){if(E)throw new H;u=!0}else{if(!E)throw new H;h=!0}else if(g===-1)if(x){if(E)throw new H;a=!0}else{if(!E)throw new H;d=!0}else if(g===0){if(x){if(!E)throw new H;s<o?(a=!0,h=!0):(u=!0,d=!0)}else if(E)throw new H}else throw new H;if(a){if(u)throw new H;bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(u&&bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new H;bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}rt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],rt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],rt.OUTSIDE_GSUM=[0,161,961,2015,2715],rt.INSIDE_GSUM=[0,336,1036,1516],rt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],rt.INSIDE_ODD_WIDEST=[2,4,6,8],rt.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 ai extends ut{constructor(n,r){super(),this.readers=[],this.verbose=r===!0;const s=n?n.get(U.POSSIBLE_FORMATS):null,o=n&&n.get(U.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;s?((s.includes(le.EAN_13)||s.includes(le.UPC_A)||s.includes(le.EAN_8)||s.includes(le.UPC_E))&&this.readers.push(new Ga(n)),s.includes(le.CODE_39)&&this.readers.push(new dt(o)),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 rt),s.includes(le.RSS_EXPANDED)&&this.readers.push(new Y(this.verbose))):(this.readers.push(new Ga(n)),this.readers.push(new dt),this.readers.push(new Ga(n)),this.readers.push(new J),this.readers.push(new Be),this.readers.push(new rt),this.readers.push(new Y(this.verbose)))}decodeRow(n,r,s){for(let o=0;o<this.readers.length;o++)try{return this.readers[o].decodeRow(n,r,s)}catch{}throw new H}reset(){this.readers.forEach(n=>n.reset())}}class Ph extends cn{constructor(n=500,r){super(new ai(r),n,r)}}class Me{constructor(n,r,s){this.ecCodewords=n,this.ecBlocks=[r],s&&this.ecBlocks.push(s)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class De{constructor(n,r){this.count=n,this.dataCodewords=r}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Se{constructor(n,r,s,o,a,u){this.versionNumber=n,this.symbolSizeRows=r,this.symbolSizeColumns=s,this.dataRegionSizeRows=o,this.dataRegionSizeColumns=a,this.ecBlocks=u;let d=0;const h=u.getECCodewords(),g=u.getECBlocks();for(let x of g)d+=x.getCount()*(x.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(n,r){if(n&1||r&1)throw new k;for(let s of Se.VERSIONS)if(s.symbolSizeRows===n&&s.symbolSizeColumns===r)return s;throw new k}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 Ka{constructor(n){const r=n.getHeight();if(r<8||r>144||r&1)throw new k;this.version=Ka.readVersion(n),this.mappingBitMatrix=this.extractDataRegion(n),this.readMappingMatrix=new _e(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(n){const r=n.getHeight(),s=n.getWidth();return Se.getVersionForDimensions(r,s)}readCodewords(){const n=new Int8Array(this.version.getTotalCodewords());let r=0,s=4,o=0;const a=this.mappingBitMatrix.getHeight(),u=this.mappingBitMatrix.getWidth();let d=!1,h=!1,g=!1,x=!1;do if(s===a&&o===0&&!d)n[r++]=this.readCorner1(a,u)&255,s-=2,o+=2,d=!0;else if(s===a-2&&o===0&&u&3&&!h)n[r++]=this.readCorner2(a,u)&255,s-=2,o+=2,h=!0;else if(s===a+4&&o===2&&!(u&7)&&!g)n[r++]=this.readCorner3(a,u)&255,s-=2,o+=2,g=!0;else if(s===a-2&&o===0&&(u&7)===4&&!x)n[r++]=this.readCorner4(a,u)&255,s-=2,o+=2,x=!0;else{do s<a&&o>=0&&!this.readMappingMatrix.get(o,s)&&(n[r++]=this.readUtah(s,o,a,u)&255),s-=2,o+=2;while(s>=0&&o<u);s+=1,o+=3;do s>=0&&o<u&&!this.readMappingMatrix.get(o,s)&&(n[r++]=this.readUtah(s,o,a,u)&255),s+=2,o-=2;while(s<a&&o>=0);s+=3,o+=1}while(s<a||o<u);if(r!==this.version.getTotalCodewords())throw new k;return n}readModule(n,r,s,o){return n<0&&(n+=s,r+=4-(s+4&7)),r<0&&(r+=o,n+=4-(o+4&7)),this.readMappingMatrix.set(r,n),this.mappingBitMatrix.get(r,n)}readUtah(n,r,s,o){let a=0;return this.readModule(n-2,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n-2,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n-1,r,s,o)&&(a|=1),a<<=1,this.readModule(n,r-2,s,o)&&(a|=1),a<<=1,this.readModule(n,r-1,s,o)&&(a|=1),a<<=1,this.readModule(n,r,s,o)&&(a|=1),a}readCorner1(n,r){let s=0;return this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,1,n,r)&&(s|=1),s<<=1,this.readModule(n-1,2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(2,r-1,n,r)&&(s|=1),s<<=1,this.readModule(3,r-1,n,r)&&(s|=1),s}readCorner2(n,r){let s=0;return this.readModule(n-3,0,n,r)&&(s|=1),s<<=1,this.readModule(n-2,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(0,r-4,n,r)&&(s|=1),s<<=1,this.readModule(0,r-3,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s}readCorner3(n,r){let s=0;return this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(0,r-3,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-3,n,r)&&(s|=1),s<<=1,this.readModule(1,r-2,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s}readCorner4(n,r){let s=0;return this.readModule(n-3,0,n,r)&&(s|=1),s<<=1,this.readModule(n-2,0,n,r)&&(s|=1),s<<=1,this.readModule(n-1,0,n,r)&&(s|=1),s<<=1,this.readModule(0,r-2,n,r)&&(s|=1),s<<=1,this.readModule(0,r-1,n,r)&&(s|=1),s<<=1,this.readModule(1,r-1,n,r)&&(s|=1),s<<=1,this.readModule(2,r-1,n,r)&&(s|=1),s<<=1,this.readModule(3,r-1,n,r)&&(s|=1),s}extractDataRegion(n){const r=this.version.getSymbolSizeRows(),s=this.version.getSymbolSizeColumns();if(n.getHeight()!==r)throw new v("Dimension of bitMatrix must match the version size");const o=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),u=r/o|0,d=s/a|0,h=u*o,g=d*a,x=new _e(g,h);for(let E=0;E<u;++E){const A=E*o;for(let I=0;I<d;++I){const b=I*a;for(let D=0;D<o;++D){const L=E*(o+2)+1+D,z=A+D;for(let q=0;q<a;++q){const $=I*(a+2)+1+q;if(n.get($,L)){const Z=b+q;x.set(Z,z)}}}}}return x}}class Qa{constructor(n,r){this.numDataCodewords=n,this.codewords=r}static getDataBlocks(n,r){const s=r.getECBlocks();let o=0;const a=s.getECBlocks();for(let D of a)o+=D.getCount();const u=new Array(o);let d=0;for(let D of a)for(let L=0;L<D.getCount();L++){const z=D.getDataCodewords(),q=s.getECCodewords()+z;u[d++]=new Qa(z,new Uint8Array(q))}const g=u[0].codewords.length-s.getECCodewords(),x=g-1;let E=0;for(let D=0;D<x;D++)for(let L=0;L<d;L++)u[L].codewords[D]=n[E++];const A=r.getVersionNumber()===24,I=A?8:d;for(let D=0;D<I;D++)u[D].codewords[g-1]=n[E++];const b=u[0].codewords.length;for(let D=g;D<b;D++)for(let L=0;L<d;L++){const z=A?(L+8)%d:L,q=A&&z>7?D-1:D;u[z].codewords[q]=n[E++]}if(E!==n.length)throw new v;return u}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class qa{constructor(n){this.bytes=n,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(n){if(n<1||n>32||n>this.available())throw new v(""+n);let r=0,s=this.bitOffset,o=this.byteOffset;const a=this.bytes;if(s>0){const u=8-s,d=n<u?n:u,h=u-d,g=255>>8-d<<h;r=(a[o]&g)>>h,n-=d,s+=d,s===8&&(s=0,o++)}if(n>0){for(;n>=8;)r=r<<8|a[o]&255,o++,n-=8;if(n>0){const u=8-n,d=255>>u<<u;r=r<<n|(a[o]&d)>>u,s+=n}}return this.bitOffset=s,this.byteOffset=o,r}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var ht;(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"})(ht||(ht={}));class ar{static decode(n){const r=new qa(n),s=new ge,o=new ge,a=new Array;let u=ht.ASCII_ENCODE;do if(u===ht.ASCII_ENCODE)u=this.decodeAsciiSegment(r,s,o);else{switch(u){case ht.C40_ENCODE:this.decodeC40Segment(r,s);break;case ht.TEXT_ENCODE:this.decodeTextSegment(r,s);break;case ht.ANSIX12_ENCODE:this.decodeAnsiX12Segment(r,s);break;case ht.EDIFACT_ENCODE:this.decodeEdifactSegment(r,s);break;case ht.BASE256_ENCODE:this.decodeBase256Segment(r,s,a);break;default:throw new k}u=ht.ASCII_ENCODE}while(u!==ht.PAD_ENCODE&&r.available()>0);return o.length()>0&&s.append(o.toString()),new Qi(n,s.toString(),a.length===0?null:a,null)}static decodeAsciiSegment(n,r,s){let o=!1;do{let a=n.readBits(8);if(a===0)throw new k;if(a<=128)return o&&(a+=128),r.append(String.fromCharCode(a-1)),ht.ASCII_ENCODE;if(a===129)return ht.PAD_ENCODE;if(a<=229){const u=a-130;u<10&&r.append("0"),r.append(""+u)}else switch(a){case 230:return ht.C40_ENCODE;case 231:return ht.BASE256_ENCODE;case 232:r.append("");break;case 233:case 234:break;case 235:o=!0;break;case 236:r.append("[)>05"),s.insert(0,"");break;case 237:r.append("[)>06"),s.insert(0,"");break;case 238:return ht.ANSIX12_ENCODE;case 239:return ht.TEXT_ENCODE;case 240:return ht.EDIFACT_ENCODE;case 241:break;default:if(a!==254||n.available()!==0)throw new k;break}}while(n.available()>0);return ht.ASCII_ENCODE}static decodeC40Segment(n,r){let s=!1;const o=[];let a=0;do{if(n.available()===8)return;const u=n.readBits(8);if(u===254)return;this.parseTwoBytes(u,n.readBits(8),o);for(let d=0;d<3;d++){const h=o[d];switch(a){case 0:if(h<3)a=h+1;else if(h<this.C40_BASIC_SET_CHARS.length){const g=this.C40_BASIC_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else throw new k;break;case 1:s?(r.append(String.fromCharCode(h+128)),s=!1):r.append(String.fromCharCode(h)),a=0;break;case 2:if(h<this.C40_SHIFT2_SET_CHARS.length){const g=this.C40_SHIFT2_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else switch(h){case 27:r.append("");break;case 30:s=!0;break;default:throw new k}a=0;break;case 3:s?(r.append(String.fromCharCode(h+224)),s=!1):r.append(String.fromCharCode(h+96)),a=0;break;default:throw new k}}}while(n.available()>0)}static decodeTextSegment(n,r){let s=!1,o=[],a=0;do{if(n.available()===8)return;const u=n.readBits(8);if(u===254)return;this.parseTwoBytes(u,n.readBits(8),o);for(let d=0;d<3;d++){const h=o[d];switch(a){case 0:if(h<3)a=h+1;else if(h<this.TEXT_BASIC_SET_CHARS.length){const g=this.TEXT_BASIC_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else throw new k;break;case 1:s?(r.append(String.fromCharCode(h+128)),s=!1):r.append(String.fromCharCode(h)),a=0;break;case 2:if(h<this.TEXT_SHIFT2_SET_CHARS.length){const g=this.TEXT_SHIFT2_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g)}else switch(h){case 27:r.append("");break;case 30:s=!0;break;default:throw new k}a=0;break;case 3:if(h<this.TEXT_SHIFT3_SET_CHARS.length){const g=this.TEXT_SHIFT3_SET_CHARS[h];s?(r.append(String.fromCharCode(g.charCodeAt(0)+128)),s=!1):r.append(g),a=0}else throw new k;break;default:throw new k}}}while(n.available()>0)}static decodeAnsiX12Segment(n,r){const s=[];do{if(n.available()===8)return;const o=n.readBits(8);if(o===254)return;this.parseTwoBytes(o,n.readBits(8),s);for(let a=0;a<3;a++){const u=s[a];switch(u){case 0:r.append("\r");break;case 1:r.append("*");break;case 2:r.append(">");break;case 3:r.append(" ");break;default:if(u<14)r.append(String.fromCharCode(u+44));else if(u<40)r.append(String.fromCharCode(u+51));else throw new k;break}}}while(n.available()>0)}static parseTwoBytes(n,r,s){let o=(n<<8)+r-1,a=Math.floor(o/1600);s[0]=a,o-=a*1600,a=Math.floor(o/40),s[1]=a,s[2]=o-a*40}static decodeEdifactSegment(n,r){do{if(n.available()<=16)return;for(let s=0;s<4;s++){let o=n.readBits(6);if(o===31){const a=8-n.getBitOffset();a!==8&&n.readBits(a);return}o&32||(o|=64),r.append(String.fromCharCode(o))}}while(n.available()>0)}static decodeBase256Segment(n,r,s){let o=1+n.getByteOffset();const a=this.unrandomize255State(n.readBits(8),o++);let u;if(a===0?u=n.available()/8|0:a<250?u=a:u=250*(a-249)+this.unrandomize255State(n.readBits(8),o++),u<0)throw new k;const d=new Uint8Array(u);for(let h=0;h<u;h++){if(n.available()<8)throw new k;d[h]=this.unrandomize255State(n.readBits(8),o++)}s.push(d);try{r.append(Ee.decode(d,se.ISO88591))}catch(h){throw new Dn("Platform does not support required encoding: "+h.message)}}static unrandomize255State(n,r){const s=149*r%255+1,o=n-s;return o>=0?o:o+256}}ar.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"],ar.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],ar.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"],ar.TEXT_SHIFT2_SET_CHARS=ar.C40_SHIFT2_SET_CHARS,ar.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 Bh{constructor(){this.rsDecoder=new $i(be.DATA_MATRIX_FIELD_256)}decode(n){const r=new Ka(n),s=r.getVersion(),o=r.readCodewords(),a=Qa.getDataBlocks(o,s);let u=0;for(let g of a)u+=g.getNumDataCodewords();const d=new Uint8Array(u),h=a.length;for(let g=0;g<h;g++){const x=a[g],E=x.getCodewords(),A=x.getNumDataCodewords();this.correctErrors(E,A);for(let I=0;I<A;I++)d[I*h+g]=E[I]}return ar.decode(d)}correctErrors(n,r){const s=new Int32Array(n);try{this.rsDecoder.decode(s,n.length-r)}catch{throw new M}for(let o=0;o<r;o++)n[o]=s[o]}}class at{constructor(n){this.image=n,this.rectangleDetector=new Gn(this.image)}detect(){const n=this.rectangleDetector.detect();let r=this.detectSolid1(n);if(r=this.detectSolid2(r),r[3]=this.correctTopRight(r),!r[3])throw new H;r=this.shiftToModuleCenter(r);const s=r[0],o=r[1],a=r[2],u=r[3];let d=this.transitionsBetween(s,u)+1,h=this.transitionsBetween(a,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 g=at.sampleGrid(this.image,s,o,a,u,d,h);return new oo(g,[s,o,a,u])}static shiftPoint(n,r,s){let o=(r.getX()-n.getX())/(s+1),a=(r.getY()-n.getY())/(s+1);return new ae(n.getX()+o,n.getY()+a)}static moveAway(n,r,s){let o=n.getX(),a=n.getY();return o<r?o-=1:o+=1,a<s?a-=1:a+=1,new ae(o,a)}detectSolid1(n){let r=n[0],s=n[1],o=n[3],a=n[2],u=this.transitionsBetween(r,s),d=this.transitionsBetween(s,o),h=this.transitionsBetween(o,a),g=this.transitionsBetween(a,r),x=u,E=[a,r,s,o];return x>d&&(x=d,E[0]=r,E[1]=s,E[2]=o,E[3]=a),x>h&&(x=h,E[0]=s,E[1]=o,E[2]=a,E[3]=r),x>g&&(E[0]=o,E[1]=a,E[2]=r,E[3]=s),E}detectSolid2(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a),d=at.shiftPoint(s,o,(u+1)*4),h=at.shiftPoint(o,s,(u+1)*4),g=this.transitionsBetween(d,r),x=this.transitionsBetween(h,a);return g<x?(n[0]=r,n[1]=s,n[2]=o,n[3]=a):(n[0]=s,n[1]=o,n[2]=a,n[3]=r),n}correctTopRight(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a),d=this.transitionsBetween(s,a),h=at.shiftPoint(r,s,(d+1)*4),g=at.shiftPoint(o,s,(u+1)*4);u=this.transitionsBetween(h,a),d=this.transitionsBetween(g,a);let x=new ae(a.getX()+(o.getX()-s.getX())/(u+1),a.getY()+(o.getY()-s.getY())/(u+1)),E=new ae(a.getX()+(r.getX()-s.getX())/(d+1),a.getY()+(r.getY()-s.getY())/(d+1));if(!this.isValid(x))return this.isValid(E)?E:null;if(!this.isValid(E))return x;let A=this.transitionsBetween(h,x)+this.transitionsBetween(g,x),I=this.transitionsBetween(h,E)+this.transitionsBetween(g,E);return A>I?x:E}shiftToModuleCenter(n){let r=n[0],s=n[1],o=n[2],a=n[3],u=this.transitionsBetween(r,a)+1,d=this.transitionsBetween(o,a)+1,h=at.shiftPoint(r,s,d*4),g=at.shiftPoint(o,s,u*4);u=this.transitionsBetween(h,a)+1,d=this.transitionsBetween(g,a)+1,(u&1)===1&&(u+=1),(d&1)===1&&(d+=1);let x=(r.getX()+s.getX()+o.getX()+a.getX())/4,E=(r.getY()+s.getY()+o.getY()+a.getY())/4;r=at.moveAway(r,x,E),s=at.moveAway(s,x,E),o=at.moveAway(o,x,E),a=at.moveAway(a,x,E);let A,I;return h=at.shiftPoint(r,s,d*4),h=at.shiftPoint(h,a,u*4),A=at.shiftPoint(s,r,d*4),A=at.shiftPoint(A,o,u*4),g=at.shiftPoint(o,a,d*4),g=at.shiftPoint(g,s,u*4),I=at.shiftPoint(a,o,d*4),I=at.shiftPoint(I,r,u*4),[h,A,g,I]}isValid(n){return n.getX()>=0&&n.getX()<this.image.getWidth()&&n.getY()>0&&n.getY()<this.image.getHeight()}static sampleGrid(n,r,s,o,a,u,d){return sr.getInstance().sampleGrid(n,u,d,.5,.5,u-.5,.5,u-.5,d-.5,.5,d-.5,r.getX(),r.getY(),a.getX(),a.getY(),o.getX(),o.getY(),s.getX(),s.getY())}transitionsBetween(n,r){let s=Math.trunc(n.getX()),o=Math.trunc(n.getY()),a=Math.trunc(r.getX()),u=Math.trunc(r.getY()),d=Math.abs(u-o)>Math.abs(a-s);if(d){let D=s;s=o,o=D,D=a,a=u,u=D}let h=Math.abs(a-s),g=Math.abs(u-o),x=-h/2,E=o<u?1:-1,A=s<a?1:-1,I=0,b=this.image.get(d?o:s,d?s:o);for(let D=s,L=o;D!==a;D+=A){let z=this.image.get(d?L:D,d?D:L);if(z!==b&&(I++,b=z),x+=g,x>0){if(L===u)break;L+=E,x-=h}}return I}}class lr{constructor(){this.decoder=new Bh}decode(n,r=null){let s,o;if(r!=null&&r.has(U.PURE_BARCODE)){const g=lr.extractPureBits(n.getBlackMatrix());s=this.decoder.decode(g),o=lr.NO_POINTS}else{const g=new at(n.getBlackMatrix()).detect();s=this.decoder.decode(g.getBits()),o=g.getPoints()}const a=s.getRawBytes(),u=new Ke(s.getText(),a,8*a.length,o,le.DATA_MATRIX,B.currentTimeMillis()),d=s.getByteSegments();d!=null&&u.putMetadata(wt.BYTE_SEGMENTS,d);const h=s.getECLevel();return h!=null&&u.putMetadata(wt.ERROR_CORRECTION_LEVEL,h),u}reset(){}static extractPureBits(n){const r=n.getTopLeftOnBit(),s=n.getBottomRightOnBit();if(r==null||s==null)throw new H;const o=this.moduleSize(r,n);let a=r[1];const u=s[1];let d=r[0];const g=(s[0]-d+1)/o,x=(u-a+1)/o;if(g<=0||x<=0)throw new H;const E=o/2;a+=E,d+=E;const A=new _e(g,x);for(let I=0;I<x;I++){const b=a+I*o;for(let D=0;D<g;D++)n.get(d+D*o,b)&&A.set(D,I)}return A}static moduleSize(n,r){const s=r.getWidth();let o=n[0];const a=n[1];for(;o<s&&r.get(o,a);)o++;if(o===s)throw new H;const u=o-n[0];if(u===0)throw new H;return u}}lr.NO_POINTS=[];class Lh extends cn{constructor(n=500){super(new lr,n)}}var li;(function(y){y[y.L=0]="L",y[y.M=1]="M",y[y.Q=2]="Q",y[y.H=3]="H"})(li||(li={}));class We{constructor(n,r,s){this.value=n,this.stringValue=r,this.bits=s,We.FOR_BITS.set(s,this),We.FOR_VALUE.set(n,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(n){switch(n){case"L":return We.L;case"M":return We.M;case"Q":return We.Q;case"H":return We.H;default:throw new _(n+"not available")}}toString(){return this.stringValue}equals(n){if(!(n instanceof We))return!1;const r=n;return this.value===r.value}static forBits(n){if(n<0||n>=We.FOR_BITS.size)throw new v;return We.FOR_BITS.get(n)}}We.FOR_BITS=new Map,We.FOR_VALUE=new Map,We.L=new We(li.L,"L",1),We.M=new We(li.M,"M",0),We.Q=new We(li.Q,"Q",3),We.H=new We(li.H,"H",2);class Ot{constructor(n){this.errorCorrectionLevel=We.forBits(n>>3&3),this.dataMask=n&7}static numBitsDiffering(n,r){return N.bitCount(n^r)}static decodeFormatInformation(n,r){const s=Ot.doDecodeFormatInformation(n,r);return s!==null?s:Ot.doDecodeFormatInformation(n^Ot.FORMAT_INFO_MASK_QR,r^Ot.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(n,r){let s=Number.MAX_SAFE_INTEGER,o=0;for(const a of Ot.FORMAT_INFO_DECODE_LOOKUP){const u=a[0];if(u===n||u===r)return new Ot(a[1]);let d=Ot.numBitsDiffering(n,u);d<s&&(o=a[1],s=d),n!==r&&(d=Ot.numBitsDiffering(r,u),d<s&&(o=a[1],s=d))}return s<=3?new Ot(o):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(n){if(!(n instanceof Ot))return!1;const r=n;return this.errorCorrectionLevel===r.errorCorrectionLevel&&this.dataMask===r.dataMask}}Ot.FORMAT_INFO_MASK_QR=21522,Ot.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(n,...r){this.ecCodewordsPerBlock=n,this.ecBlocks=r}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let n=0;const r=this.ecBlocks;for(const s of r)n+=s.getCount();return n}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class S{constructor(n,r){this.count=n,this.dataCodewords=r}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ue{constructor(n,r,...s){this.versionNumber=n,this.alignmentPatternCenters=r,this.ecBlocks=s;let o=0;const a=s[0].getECCodewordsPerBlock(),u=s[0].getECBlocks();for(const d of u)o+=d.getCount()*(d.getDataCodewords()+a);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(n){return this.ecBlocks[n.getValue()]}static getProvisionalVersionForDimension(n){if(n%4!==1)throw new k;try{return this.getVersionForNumber((n-17)/4)}catch{throw new k}}static getVersionForNumber(n){if(n<1||n>40)throw new v;return ue.VERSIONS[n-1]}static decodeVersionInformation(n){let r=Number.MAX_SAFE_INTEGER,s=0;for(let o=0;o<ue.VERSION_DECODE_INFO.length;o++){const a=ue.VERSION_DECODE_INFO[o];if(a===n)return ue.getVersionForNumber(o+7);const u=Ot.numBitsDiffering(n,a);u<r&&(s=o+7,r=u)}return r<=3?ue.getVersionForNumber(s):null}buildFunctionPattern(){const n=this.getDimensionForVersion(),r=new _e(n);r.setRegion(0,0,9,9),r.setRegion(n-8,0,8,9),r.setRegion(0,n-8,9,8);const s=this.alignmentPatternCenters.length;for(let o=0;o<s;o++){const a=this.alignmentPatternCenters[o]-2;for(let u=0;u<s;u++)o===0&&(u===0||u===s-1)||o===s-1&&u===0||r.setRegion(this.alignmentPatternCenters[u]-2,a,5,5)}return r.setRegion(6,9,1,n-17),r.setRegion(9,6,n-17,1),this.versionNumber>6&&(r.setRegion(n-11,0,3,6),r.setRegion(0,n-11,6,3)),r}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 S(1,19)),new F(10,new S(1,16)),new F(13,new S(1,13)),new F(17,new S(1,9))),new ue(2,Int32Array.from([6,18]),new F(10,new S(1,34)),new F(16,new S(1,28)),new F(22,new S(1,22)),new F(28,new S(1,16))),new ue(3,Int32Array.from([6,22]),new F(15,new S(1,55)),new F(26,new S(1,44)),new F(18,new S(2,17)),new F(22,new S(2,13))),new ue(4,Int32Array.from([6,26]),new F(20,new S(1,80)),new F(18,new S(2,32)),new F(26,new S(2,24)),new F(16,new S(4,9))),new ue(5,Int32Array.from([6,30]),new F(26,new S(1,108)),new F(24,new S(2,43)),new F(18,new S(2,15),new S(2,16)),new F(22,new S(2,11),new S(2,12))),new ue(6,Int32Array.from([6,34]),new F(18,new S(2,68)),new F(16,new S(4,27)),new F(24,new S(4,19)),new F(28,new S(4,15))),new ue(7,Int32Array.from([6,22,38]),new F(20,new S(2,78)),new F(18,new S(4,31)),new F(18,new S(2,14),new S(4,15)),new F(26,new S(4,13),new S(1,14))),new ue(8,Int32Array.from([6,24,42]),new F(24,new S(2,97)),new F(22,new S(2,38),new S(2,39)),new F(22,new S(4,18),new S(2,19)),new F(26,new S(4,14),new S(2,15))),new ue(9,Int32Array.from([6,26,46]),new F(30,new S(2,116)),new F(22,new S(3,36),new S(2,37)),new F(20,new S(4,16),new S(4,17)),new F(24,new S(4,12),new S(4,13))),new ue(10,Int32Array.from([6,28,50]),new F(18,new S(2,68),new S(2,69)),new F(26,new S(4,43),new S(1,44)),new F(24,new S(6,19),new S(2,20)),new F(28,new S(6,15),new S(2,16))),new ue(11,Int32Array.from([6,30,54]),new F(20,new S(4,81)),new F(30,new S(1,50),new S(4,51)),new F(28,new S(4,22),new S(4,23)),new F(24,new S(3,12),new S(8,13))),new ue(12,Int32Array.from([6,32,58]),new F(24,new S(2,92),new S(2,93)),new F(22,new S(6,36),new S(2,37)),new F(26,new S(4,20),new S(6,21)),new F(28,new S(7,14),new S(4,15))),new ue(13,Int32Array.from([6,34,62]),new F(26,new S(4,107)),new F(22,new S(8,37),new S(1,38)),new F(24,new S(8,20),new S(4,21)),new F(22,new S(12,11),new S(4,12))),new ue(14,Int32Array.from([6,26,46,66]),new F(30,new S(3,115),new S(1,116)),new F(24,new S(4,40),new S(5,41)),new F(20,new S(11,16),new S(5,17)),new F(24,new S(11,12),new S(5,13))),new ue(15,Int32Array.from([6,26,48,70]),new F(22,new S(5,87),new S(1,88)),new F(24,new S(5,41),new S(5,42)),new F(30,new S(5,24),new S(7,25)),new F(24,new S(11,12),new S(7,13))),new ue(16,Int32Array.from([6,26,50,74]),new F(24,new S(5,98),new S(1,99)),new F(28,new S(7,45),new S(3,46)),new F(24,new S(15,19),new S(2,20)),new F(30,new S(3,15),new S(13,16))),new ue(17,Int32Array.from([6,30,54,78]),new F(28,new S(1,107),new S(5,108)),new F(28,new S(10,46),new S(1,47)),new F(28,new S(1,22),new S(15,23)),new F(28,new S(2,14),new S(17,15))),new ue(18,Int32Array.from([6,30,56,82]),new F(30,new S(5,120),new S(1,121)),new F(26,new S(9,43),new S(4,44)),new F(28,new S(17,22),new S(1,23)),new F(28,new S(2,14),new S(19,15))),new ue(19,Int32Array.from([6,30,58,86]),new F(28,new S(3,113),new S(4,114)),new F(26,new S(3,44),new S(11,45)),new F(26,new S(17,21),new S(4,22)),new F(26,new S(9,13),new S(16,14))),new ue(20,Int32Array.from([6,34,62,90]),new F(28,new S(3,107),new S(5,108)),new F(26,new S(3,41),new S(13,42)),new F(30,new S(15,24),new S(5,25)),new F(28,new S(15,15),new S(10,16))),new ue(21,Int32Array.from([6,28,50,72,94]),new F(28,new S(4,116),new S(4,117)),new F(26,new S(17,42)),new F(28,new S(17,22),new S(6,23)),new F(30,new S(19,16),new S(6,17))),new ue(22,Int32Array.from([6,26,50,74,98]),new F(28,new S(2,111),new S(7,112)),new F(28,new S(17,46)),new F(30,new S(7,24),new S(16,25)),new F(24,new S(34,13))),new ue(23,Int32Array.from([6,30,54,78,102]),new F(30,new S(4,121),new S(5,122)),new F(28,new S(4,47),new S(14,48)),new F(30,new S(11,24),new S(14,25)),new F(30,new S(16,15),new S(14,16))),new ue(24,Int32Array.from([6,28,54,80,106]),new F(30,new S(6,117),new S(4,118)),new F(28,new S(6,45),new S(14,46)),new F(30,new S(11,24),new S(16,25)),new F(30,new S(30,16),new S(2,17))),new ue(25,Int32Array.from([6,32,58,84,110]),new F(26,new S(8,106),new S(4,107)),new F(28,new S(8,47),new S(13,48)),new F(30,new S(7,24),new S(22,25)),new F(30,new S(22,15),new S(13,16))),new ue(26,Int32Array.from([6,30,58,86,114]),new F(28,new S(10,114),new S(2,115)),new F(28,new S(19,46),new S(4,47)),new F(28,new S(28,22),new S(6,23)),new F(30,new S(33,16),new S(4,17))),new ue(27,Int32Array.from([6,34,62,90,118]),new F(30,new S(8,122),new S(4,123)),new F(28,new S(22,45),new S(3,46)),new F(30,new S(8,23),new S(26,24)),new F(30,new S(12,15),new S(28,16))),new ue(28,Int32Array.from([6,26,50,74,98,122]),new F(30,new S(3,117),new S(10,118)),new F(28,new S(3,45),new S(23,46)),new F(30,new S(4,24),new S(31,25)),new F(30,new S(11,15),new S(31,16))),new ue(29,Int32Array.from([6,30,54,78,102,126]),new F(30,new S(7,116),new S(7,117)),new F(28,new S(21,45),new S(7,46)),new F(30,new S(1,23),new S(37,24)),new F(30,new S(19,15),new S(26,16))),new ue(30,Int32Array.from([6,26,52,78,104,130]),new F(30,new S(5,115),new S(10,116)),new F(28,new S(19,47),new S(10,48)),new F(30,new S(15,24),new S(25,25)),new F(30,new S(23,15),new S(25,16))),new ue(31,Int32Array.from([6,30,56,82,108,134]),new F(30,new S(13,115),new S(3,116)),new F(28,new S(2,46),new S(29,47)),new F(30,new S(42,24),new S(1,25)),new F(30,new S(23,15),new S(28,16))),new ue(32,Int32Array.from([6,34,60,86,112,138]),new F(30,new S(17,115)),new F(28,new S(10,46),new S(23,47)),new F(30,new S(10,24),new S(35,25)),new F(30,new S(19,15),new S(35,16))),new ue(33,Int32Array.from([6,30,58,86,114,142]),new F(30,new S(17,115),new S(1,116)),new F(28,new S(14,46),new S(21,47)),new F(30,new S(29,24),new S(19,25)),new F(30,new S(11,15),new S(46,16))),new ue(34,Int32Array.from([6,34,62,90,118,146]),new F(30,new S(13,115),new S(6,116)),new F(28,new S(14,46),new S(23,47)),new F(30,new S(44,24),new S(7,25)),new F(30,new S(59,16),new S(1,17))),new ue(35,Int32Array.from([6,30,54,78,102,126,150]),new F(30,new S(12,121),new S(7,122)),new F(28,new S(12,47),new S(26,48)),new F(30,new S(39,24),new S(14,25)),new F(30,new S(22,15),new S(41,16))),new ue(36,Int32Array.from([6,24,50,76,102,128,154]),new F(30,new S(6,121),new S(14,122)),new F(28,new S(6,47),new S(34,48)),new F(30,new S(46,24),new S(10,25)),new F(30,new S(2,15),new S(64,16))),new ue(37,Int32Array.from([6,28,54,80,106,132,158]),new F(30,new S(17,122),new S(4,123)),new F(28,new S(29,46),new S(14,47)),new F(30,new S(49,24),new S(10,25)),new F(30,new S(24,15),new S(46,16))),new ue(38,Int32Array.from([6,32,58,84,110,136,162]),new F(30,new S(4,122),new S(18,123)),new F(28,new S(13,46),new S(32,47)),new F(30,new S(48,24),new S(14,25)),new F(30,new S(42,15),new S(32,16))),new ue(39,Int32Array.from([6,26,54,82,110,138,166]),new F(30,new S(20,117),new S(4,118)),new F(28,new S(40,47),new S(7,48)),new F(30,new S(43,24),new S(22,25)),new F(30,new S(10,15),new S(67,16))),new ue(40,Int32Array.from([6,30,58,86,114,142,170]),new F(30,new S(19,118),new S(6,119)),new F(28,new S(18,47),new S(31,48)),new F(30,new S(34,24),new S(34,25)),new F(30,new S(20,15),new S(61,16)))];var yt;(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"})(yt||(yt={}));class dn{constructor(n,r){this.value=n,this.isMasked=r}unmaskBitMatrix(n,r){for(let s=0;s<r;s++)for(let o=0;o<r;o++)this.isMasked(s,o)&&n.flip(o,s)}}dn.values=new Map([[yt.DATA_MASK_000,new dn(yt.DATA_MASK_000,(y,n)=>(y+n&1)===0)],[yt.DATA_MASK_001,new dn(yt.DATA_MASK_001,(y,n)=>(y&1)===0)],[yt.DATA_MASK_010,new dn(yt.DATA_MASK_010,(y,n)=>n%3===0)],[yt.DATA_MASK_011,new dn(yt.DATA_MASK_011,(y,n)=>(y+n)%3===0)],[yt.DATA_MASK_100,new dn(yt.DATA_MASK_100,(y,n)=>(Math.floor(y/2)+Math.floor(n/3)&1)===0)],[yt.DATA_MASK_101,new dn(yt.DATA_MASK_101,(y,n)=>y*n%6===0)],[yt.DATA_MASK_110,new dn(yt.DATA_MASK_110,(y,n)=>y*n%6<3)],[yt.DATA_MASK_111,new dn(yt.DATA_MASK_111,(y,n)=>(y+n+y*n%3&1)===0)]]);class Fh{constructor(n){const r=n.getHeight();if(r<21||(r&3)!==1)throw new k;this.bitMatrix=n}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let n=0;for(let a=0;a<6;a++)n=this.copyBit(a,8,n);n=this.copyBit(7,8,n),n=this.copyBit(8,8,n),n=this.copyBit(8,7,n);for(let a=5;a>=0;a--)n=this.copyBit(8,a,n);const r=this.bitMatrix.getHeight();let s=0;const o=r-7;for(let a=r-1;a>=o;a--)s=this.copyBit(8,a,s);for(let a=r-8;a<r;a++)s=this.copyBit(a,8,s);if(this.parsedFormatInfo=Ot.decodeFormatInformation(n,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new k}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const n=this.bitMatrix.getHeight(),r=Math.floor((n-17)/4);if(r<=6)return ue.getVersionForNumber(r);let s=0;const o=n-11;for(let u=5;u>=0;u--)for(let d=n-9;d>=o;d--)s=this.copyBit(d,u,s);let a=ue.decodeVersionInformation(s);if(a!==null&&a.getDimensionForVersion()===n)return this.parsedVersion=a,a;s=0;for(let u=5;u>=0;u--)for(let d=n-9;d>=o;d--)s=this.copyBit(u,d,s);if(a=ue.decodeVersionInformation(s),a!==null&&a.getDimensionForVersion()===n)return this.parsedVersion=a,a;throw new k}copyBit(n,r,s){return(this.isMirror?this.bitMatrix.get(r,n):this.bitMatrix.get(n,r))?s<<1|1:s<<1}readCodewords(){const n=this.readFormatInformation(),r=this.readVersion(),s=dn.values.get(n.getDataMask()),o=this.bitMatrix.getHeight();s.unmaskBitMatrix(this.bitMatrix,o);const a=r.buildFunctionPattern();let u=!0;const d=new Uint8Array(r.getTotalCodewords());let h=0,g=0,x=0;for(let E=o-1;E>0;E-=2){E===6&&E--;for(let A=0;A<o;A++){const I=u?o-1-A:A;for(let b=0;b<2;b++)a.get(E-b,I)||(x++,g<<=1,this.bitMatrix.get(E-b,I)&&(g|=1),x===8&&(d[h++]=g,x=0,g=0))}u=!u}if(h!==r.getTotalCodewords())throw new k;return d}remask(){if(this.parsedFormatInfo===null)return;const n=dn.values[this.parsedFormatInfo.getDataMask()],r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r)}setMirror(n){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=n}mirror(){const n=this.bitMatrix;for(let r=0,s=n.getWidth();r<s;r++)for(let o=r+1,a=n.getHeight();o<a;o++)n.get(r,o)!==n.get(o,r)&&(n.flip(o,r),n.flip(r,o))}}class $a{constructor(n,r){this.numDataCodewords=n,this.codewords=r}static getDataBlocks(n,r,s){if(n.length!==r.getTotalCodewords())throw new v;const o=r.getECBlocksForLevel(s);let a=0;const u=o.getECBlocks();for(const b of u)a+=b.getCount();const d=new Array(a);let h=0;for(const b of u)for(let D=0;D<b.getCount();D++){const L=b.getDataCodewords(),z=o.getECCodewordsPerBlock()+L;d[h++]=new $a(L,new Uint8Array(z))}const g=d[0].codewords.length;let x=d.length-1;for(;x>=0&&d[x].codewords.length!==g;)x--;x++;const E=g-o.getECCodewordsPerBlock();let A=0;for(let b=0;b<E;b++)for(let D=0;D<h;D++)d[D].codewords[b]=n[A++];for(let b=x;b<h;b++)d[b].codewords[E]=n[A++];const I=d[0].codewords.length;for(let b=E;b<I;b++)for(let D=0;D<h;D++){const L=D<x?b:b+1;d[D].codewords[L]=n[A++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var hn;(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"})(hn||(hn={}));class ce{constructor(n,r,s,o){this.value=n,this.stringValue=r,this.characterCountBitsForVersions=s,this.bits=o,ce.FOR_BITS.set(o,this),ce.FOR_VALUE.set(n,this)}static forBits(n){const r=ce.FOR_BITS.get(n);if(r===void 0)throw new v;return r}getCharacterCountBits(n){const r=n.getVersionNumber();let s;return r<=9?s=0:r<=26?s=1:s=2,this.characterCountBitsForVersions[s]}getValue(){return this.value}getBits(){return this.bits}equals(n){if(!(n instanceof ce))return!1;const r=n;return this.value===r.value}toString(){return this.stringValue}}ce.FOR_BITS=new Map,ce.FOR_VALUE=new Map,ce.TERMINATOR=new ce(hn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ce.NUMERIC=new ce(hn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ce.ALPHANUMERIC=new ce(hn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ce.STRUCTURED_APPEND=new ce(hn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ce.BYTE=new ce(hn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ce.ECI=new ce(hn.ECI,"ECI",Int32Array.from([0,0,0]),7),ce.KANJI=new ce(hn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ce.FNC1_FIRST_POSITION=new ce(hn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ce.FNC1_SECOND_POSITION=new ce(hn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ce.HANZI=new ce(hn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Qe{static decode(n,r,s,o){const a=new qa(n);let u=new ge;const d=new Array;let h=-1,g=-1;try{let x=null,E=!1,A;do{if(a.available()<4)A=ce.TERMINATOR;else{const I=a.readBits(4);A=ce.forBits(I)}switch(A){case ce.TERMINATOR:break;case ce.FNC1_FIRST_POSITION:case ce.FNC1_SECOND_POSITION:E=!0;break;case ce.STRUCTURED_APPEND:if(a.available()<16)throw new k;h=a.readBits(8),g=a.readBits(8);break;case ce.ECI:const I=Qe.parseECIValue(a);if(x=V.getCharacterSetECIByValue(I),x===null)throw new k;break;case ce.HANZI:const b=a.readBits(4),D=a.readBits(A.getCharacterCountBits(r));b===Qe.GB2312_SUBSET&&Qe.decodeHanziSegment(a,u,D);break;default:const L=a.readBits(A.getCharacterCountBits(r));switch(A){case ce.NUMERIC:Qe.decodeNumericSegment(a,u,L);break;case ce.ALPHANUMERIC:Qe.decodeAlphanumericSegment(a,u,L,E);break;case ce.BYTE:Qe.decodeByteSegment(a,u,L,x,d,o);break;case ce.KANJI:Qe.decodeKanjiSegment(a,u,L);break;default:throw new k}break}}while(A!==ce.TERMINATOR)}catch{throw new k}return new Qi(n,u.toString(),d.length===0?null:d,s===null?null:s.toString(),h,g)}static decodeHanziSegment(n,r,s){if(s*13>n.available())throw new k;const o=new Uint8Array(2*s);let a=0;for(;s>0;){const u=n.readBits(13);let d=u/96<<8&4294967295|u%96;d<959?d+=41377:d+=42657,o[a]=d>>8&255,o[a+1]=d&255,a+=2,s--}try{r.append(Ee.decode(o,se.GB2312))}catch(u){throw new k(u)}}static decodeKanjiSegment(n,r,s){if(s*13>n.available())throw new k;const o=new Uint8Array(2*s);let a=0;for(;s>0;){const u=n.readBits(13);let d=u/192<<8&4294967295|u%192;d<7936?d+=33088:d+=49472,o[a]=d>>8,o[a+1]=d,a+=2,s--}try{r.append(Ee.decode(o,se.SHIFT_JIS))}catch(u){throw new k(u)}}static decodeByteSegment(n,r,s,o,a,u){if(8*s>n.available())throw new k;const d=new Uint8Array(s);for(let g=0;g<s;g++)d[g]=n.readBits(8);let h;o===null?h=se.guessEncoding(d,u):h=o.getName();try{r.append(Ee.decode(d,h))}catch(g){throw new k(g)}a.push(d)}static toAlphaNumericChar(n){if(n>=Qe.ALPHANUMERIC_CHARS.length)throw new k;return Qe.ALPHANUMERIC_CHARS[n]}static decodeAlphanumericSegment(n,r,s,o){const a=r.length();for(;s>1;){if(n.available()<11)throw new k;const u=n.readBits(11);r.append(Qe.toAlphaNumericChar(Math.floor(u/45))),r.append(Qe.toAlphaNumericChar(u%45)),s-=2}if(s===1){if(n.available()<6)throw new k;r.append(Qe.toAlphaNumericChar(n.readBits(6)))}if(o)for(let u=a;u<r.length();u++)r.charAt(u)==="%"&&(u<r.length()-1&&r.charAt(u+1)==="%"?r.deleteCharAt(u+1):r.setCharAt(u,""))}static decodeNumericSegment(n,r,s){for(;s>=3;){if(n.available()<10)throw new k;const o=n.readBits(10);if(o>=1e3)throw new k;r.append(Qe.toAlphaNumericChar(Math.floor(o/100))),r.append(Qe.toAlphaNumericChar(Math.floor(o/10)%10)),r.append(Qe.toAlphaNumericChar(o%10)),s-=3}if(s===2){if(n.available()<7)throw new k;const o=n.readBits(7);if(o>=100)throw new k;r.append(Qe.toAlphaNumericChar(Math.floor(o/10))),r.append(Qe.toAlphaNumericChar(o%10))}else if(s===1){if(n.available()<4)throw new k;const o=n.readBits(4);if(o>=10)throw new k;r.append(Qe.toAlphaNumericChar(o))}}static parseECIValue(n){const r=n.readBits(8);if(!(r&128))return r&127;if((r&192)===128){const s=n.readBits(8);return(r&63)<<8&4294967295|s}if((r&224)===192){const s=n.readBits(16);return(r&31)<<16&4294967295|s}throw new k}}Qe.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Qe.GB2312_SUBSET=1;class n1{constructor(n){this.mirrored=n}isMirrored(){return this.mirrored}applyMirroredCorrection(n){if(!this.mirrored||n===null||n.length<3)return;const r=n[0];n[0]=n[2],n[2]=r}}class Uh{constructor(){this.rsDecoder=new $i(be.QR_CODE_FIELD_256)}decodeBooleanArray(n,r){return this.decodeBitMatrix(_e.parseFromBooleanArray(n),r)}decodeBitMatrix(n,r){const s=new Fh(n);let o=null;try{return this.decodeBitMatrixParser(s,r)}catch(a){o=a}try{s.remask(),s.setMirror(!0),s.readVersion(),s.readFormatInformation(),s.mirror();const a=this.decodeBitMatrixParser(s,r);return a.setOther(new n1(!0)),a}catch(a){throw o!==null?o:a}}decodeBitMatrixParser(n,r){const s=n.readVersion(),o=n.readFormatInformation().getErrorCorrectionLevel(),a=n.readCodewords(),u=$a.getDataBlocks(a,s,o);let d=0;for(const x of u)d+=x.getNumDataCodewords();const h=new Uint8Array(d);let g=0;for(const x of u){const E=x.getCodewords(),A=x.getNumDataCodewords();this.correctErrors(E,A);for(let I=0;I<A;I++)h[g++]=E[I]}return Qe.decode(h,s,o,r)}correctErrors(n,r){const s=new Int32Array(n);try{this.rsDecoder.decode(s,n.length-r)}catch{throw new M}for(let o=0;o<r;o++)n[o]=s[o]}}class Ja extends ae{constructor(n,r,s){super(n,r),this.estimatedModuleSize=s}aboutEquals(n,r,s){if(Math.abs(r-this.getY())<=n&&Math.abs(s-this.getX())<=n){const o=Math.abs(n-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(n,r,s){const o=(this.getX()+r)/2,a=(this.getY()+n)/2,u=(this.estimatedModuleSize+s)/2;return new Ja(o,a,u)}}class fo{constructor(n,r,s,o,a,u,d){this.image=n,this.startX=r,this.startY=s,this.width=o,this.height=a,this.moduleSize=u,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const n=this.startX,r=this.height,s=this.width,o=n+s,a=this.startY+r/2,u=new Int32Array(3),d=this.image;for(let h=0;h<r;h++){const g=a+(h&1?-Math.floor((h+1)/2):Math.floor((h+1)/2));u[0]=0,u[1]=0,u[2]=0;let x=n;for(;x<o&&!d.get(x,g);)x++;let E=0;for(;x<o;){if(d.get(x,g))if(E===1)u[1]++;else if(E===2){if(this.foundPatternCross(u)){const A=this.handlePossibleCenter(u,g,x);if(A!==null)return A}u[0]=u[2],u[1]=1,u[2]=0,E=1}else u[++E]++;else E===1&&E++,u[E]++;x++}if(this.foundPatternCross(u)){const A=this.handlePossibleCenter(u,g,o);if(A!==null)return A}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new H}static centerFromEnd(n,r){return r-n[2]-n[1]/2}foundPatternCross(n){const r=this.moduleSize,s=r/2;for(let o=0;o<3;o++)if(Math.abs(r-n[o])>=s)return!1;return!0}crossCheckVertical(n,r,s,o){const a=this.image,u=a.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let h=n;for(;h>=0&&a.get(r,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&!a.get(r,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(r,h)&&d[1]<=s;)d[1]++,h++;if(h===u||d[1]>s)return NaN;for(;h<u&&!a.get(r,h)&&d[2]<=s;)d[2]++,h++;if(d[2]>s)return NaN;const g=d[0]+d[1]+d[2];return 5*Math.abs(g-o)>=2*o?NaN:this.foundPatternCross(d)?fo.centerFromEnd(d,h):NaN}handlePossibleCenter(n,r,s){const o=n[0]+n[1]+n[2],a=fo.centerFromEnd(n,s),u=this.crossCheckVertical(r,a,2*n[1],o);if(!isNaN(u)){const d=(n[0]+n[1]+n[2])/3;for(const g of this.possibleCenters)if(g.aboutEquals(d,u,a))return g.combineEstimate(u,a,d);const h=new Ja(a,u,d);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null}}class el extends ae{constructor(n,r,s,o){super(n,r),this.estimatedModuleSize=s,this.count=o,o===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(n,r,s){if(Math.abs(r-this.getY())<=n&&Math.abs(s-this.getX())<=n){const o=Math.abs(n-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(n,r,s){const o=this.count+1,a=(this.count*this.getX()+r)/o,u=(this.count*this.getY()+n)/o,d=(this.count*this.estimatedModuleSize+s)/o;return new el(a,u,d,o)}}class Wh{constructor(n){this.bottomLeft=n[0],this.topLeft=n[1],this.topRight=n[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Et{constructor(n,r){this.image=n,this.resultPointCallback=r,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=r}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(n){const r=n!=null&&n.get(U.TRY_HARDER)!==void 0,s=n!=null&&n.get(U.PURE_BARCODE)!==void 0,o=this.image,a=o.getHeight(),u=o.getWidth();let d=Math.floor(3*a/(4*Et.MAX_MODULES));(d<Et.MIN_SKIP||r)&&(d=Et.MIN_SKIP);let h=!1;const g=new Int32Array(5);for(let E=d-1;E<a&&!h;E+=d){g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0;let A=0;for(let I=0;I<u;I++)if(o.get(I,E))(A&1)===1&&A++,g[A]++;else if(A&1)g[A]++;else if(A===4)if(Et.foundPatternCross(g)){if(this.handlePossibleCenter(g,E,I,s)===!0)if(d=2,this.hasSkipped===!0)h=this.haveMultiplyConfirmedCenters();else{const D=this.findRowSkip();D>g[2]&&(E+=D-g[2]-d,I=u-1)}else{g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;continue}A=0,g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0}else g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;else g[++A]++;Et.foundPatternCross(g)&&this.handlePossibleCenter(g,E,u,s)===!0&&(d=g[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}const x=this.selectBestPatterns();return ae.orderBestPatterns(x),new Wh(x)}static centerFromEnd(n,r){return r-n[4]-n[3]-n[2]/2}static foundPatternCross(n){let r=0;for(let a=0;a<5;a++){const u=n[a];if(u===0)return!1;r+=u}if(r<7)return!1;const s=r/7,o=s/2;return Math.abs(s-n[0])<o&&Math.abs(s-n[1])<o&&Math.abs(3*s-n[2])<3*o&&Math.abs(s-n[3])<o&&Math.abs(s-n[4])<o}getCrossCheckStateCount(){const n=this.crossCheckStateCount;return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n}crossCheckDiagonal(n,r,s,o){const a=this.getCrossCheckStateCount();let u=0;const d=this.image;for(;n>=u&&r>=u&&d.get(r-u,n-u);)a[2]++,u++;if(n<u||r<u)return!1;for(;n>=u&&r>=u&&!d.get(r-u,n-u)&&a[1]<=s;)a[1]++,u++;if(n<u||r<u||a[1]>s)return!1;for(;n>=u&&r>=u&&d.get(r-u,n-u)&&a[0]<=s;)a[0]++,u++;if(a[0]>s)return!1;const h=d.getHeight(),g=d.getWidth();for(u=1;n+u<h&&r+u<g&&d.get(r+u,n+u);)a[2]++,u++;if(n+u>=h||r+u>=g)return!1;for(;n+u<h&&r+u<g&&!d.get(r+u,n+u)&&a[3]<s;)a[3]++,u++;if(n+u>=h||r+u>=g||a[3]>=s)return!1;for(;n+u<h&&r+u<g&&d.get(r+u,n+u)&&a[4]<s;)a[4]++,u++;if(a[4]>=s)return!1;const x=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(x-o)<2*o&&Et.foundPatternCross(a)}crossCheckVertical(n,r,s,o){const a=this.image,u=a.getHeight(),d=this.getCrossCheckStateCount();let h=n;for(;h>=0&&a.get(r,h);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!a.get(r,h)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&a.get(r,h)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(r,h);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!a.get(r,h)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&a.get(r,h)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const g=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(g-o)>=2*o?NaN:Et.foundPatternCross(d)?Et.centerFromEnd(d,h):NaN}crossCheckHorizontal(n,r,s,o){const a=this.image,u=a.getWidth(),d=this.getCrossCheckStateCount();let h=n;for(;h>=0&&a.get(h,r);)d[2]++,h--;if(h<0)return NaN;for(;h>=0&&!a.get(h,r)&&d[1]<=s;)d[1]++,h--;if(h<0||d[1]>s)return NaN;for(;h>=0&&a.get(h,r)&&d[0]<=s;)d[0]++,h--;if(d[0]>s)return NaN;for(h=n+1;h<u&&a.get(h,r);)d[2]++,h++;if(h===u)return NaN;for(;h<u&&!a.get(h,r)&&d[3]<s;)d[3]++,h++;if(h===u||d[3]>=s)return NaN;for(;h<u&&a.get(h,r)&&d[4]<s;)d[4]++,h++;if(d[4]>=s)return NaN;const g=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(g-o)>=o?NaN:Et.foundPatternCross(d)?Et.centerFromEnd(d,h):NaN}handlePossibleCenter(n,r,s,o){const a=n[0]+n[1]+n[2]+n[3]+n[4];let u=Et.centerFromEnd(n,s),d=this.crossCheckVertical(r,Math.floor(u),n[2],a);if(!isNaN(d)&&(u=this.crossCheckHorizontal(Math.floor(u),Math.floor(d),n[2],a),!isNaN(u)&&(!o||this.crossCheckDiagonal(Math.floor(d),Math.floor(u),n[2],a)))){const h=a/7;let g=!1;const x=this.possibleCenters;for(let E=0,A=x.length;E<A;E++){const I=x[E];if(I.aboutEquals(h,d,u)){x[E]=I.combineEstimate(d,u,h),g=!0;break}}if(!g){const E=new el(u,d,h);x.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 r=null;for(const s of this.possibleCenters)if(s.getCount()>=Et.CENTER_QUORUM)if(r==null)r=s;else return this.hasSkipped=!0,Math.floor((Math.abs(r.getX()-s.getX())-Math.abs(r.getY()-s.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let n=0,r=0;const s=this.possibleCenters.length;for(const u of this.possibleCenters)u.getCount()>=Et.CENTER_QUORUM&&(n++,r+=u.getEstimatedModuleSize());if(n<3)return!1;const o=r/s;let a=0;for(const u of this.possibleCenters)a+=Math.abs(u.getEstimatedModuleSize()-o);return a<=.05*r}selectBestPatterns(){const n=this.possibleCenters.length;if(n<3)throw new H;const r=this.possibleCenters;let s;if(n>3){let o=0,a=0;for(const h of this.possibleCenters){const g=h.getEstimatedModuleSize();o+=g,a+=g*g}s=o/n;let u=Math.sqrt(a/n-s*s);r.sort((h,g)=>{const x=Math.abs(g.getEstimatedModuleSize()-s),E=Math.abs(h.getEstimatedModuleSize()-s);return x<E?-1:x>E?1:0});const d=Math.max(.2*s,u);for(let h=0;h<r.length&&r.length>3;h++){const g=r[h];Math.abs(g.getEstimatedModuleSize()-s)>d&&(r.splice(h,1),h--)}}if(r.length>3){let o=0;for(const a of r)o+=a.getEstimatedModuleSize();s=o/r.length,r.sort((a,u)=>{if(u.getCount()===a.getCount()){const d=Math.abs(u.getEstimatedModuleSize()-s),h=Math.abs(a.getEstimatedModuleSize()-s);return d<h?1:d>h?-1:0}else return u.getCount()-a.getCount()}),r.splice(3)}return[r[0],r[1],r[2]]}}Et.CENTER_QUORUM=2,Et.MIN_SKIP=3,Et.MAX_MODULES=57;class es{constructor(n){this.image=n}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(n){this.resultPointCallback=n==null?null:n.get(U.NEED_RESULT_POINT_CALLBACK);const s=new Et(this.image,this.resultPointCallback).find(n);return this.processFinderPatternInfo(s)}processFinderPatternInfo(n){const r=n.getTopLeft(),s=n.getTopRight(),o=n.getBottomLeft(),a=this.calculateModuleSize(r,s,o);if(a<1)throw new H("No pattern found in proccess finder.");const u=es.computeDimension(r,s,o,a),d=ue.getProvisionalVersionForDimension(u),h=d.getDimensionForVersion()-7;let g=null;if(d.getAlignmentPatternCenters().length>0){const I=s.getX()-r.getX()+o.getX(),b=s.getY()-r.getY()+o.getY(),D=1-3/h,L=Math.floor(r.getX()+D*(I-r.getX())),z=Math.floor(r.getY()+D*(b-r.getY()));for(let q=4;q<=16;q<<=1)try{g=this.findAlignmentInRegion(a,L,z,q);break}catch($){if(!($ instanceof H))throw $}}const x=es.createTransform(r,s,o,g,u),E=es.sampleGrid(this.image,x,u);let A;return g===null?A=[o,r,s]:A=[o,r,s,g],new oo(E,A)}static createTransform(n,r,s,o,a){const u=a-3.5;let d,h,g,x;return o!==null?(d=o.getX(),h=o.getY(),g=u-3,x=g):(d=r.getX()-n.getX()+s.getX(),h=r.getY()-n.getY()+s.getY(),g=u,x=u),Cn.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,g,x,3.5,u,n.getX(),n.getY(),r.getX(),r.getY(),d,h,s.getX(),s.getY())}static sampleGrid(n,r,s){return sr.getInstance().sampleGridWithTransform(n,s,s,r)}static computeDimension(n,r,s,o){const a=Te.round(ae.distance(n,r)/o),u=Te.round(ae.distance(n,s)/o);let d=Math.floor((a+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(n,r,s){return(this.calculateModuleSizeOneWay(n,r)+this.calculateModuleSizeOneWay(n,s))/2}calculateModuleSizeOneWay(n,r){const s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(n.getX()),Math.floor(n.getY()),Math.floor(r.getX()),Math.floor(r.getY())),o=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(r.getX()),Math.floor(r.getY()),Math.floor(n.getX()),Math.floor(n.getY()));return isNaN(s)?o/7:isNaN(o)?s/7:(s+o)/14}sizeOfBlackWhiteBlackRunBothWays(n,r,s,o){let a=this.sizeOfBlackWhiteBlackRun(n,r,s,o),u=1,d=n-(s-n);d<0?(u=n/(n-d),d=0):d>=this.image.getWidth()&&(u=(this.image.getWidth()-1-n)/(d-n),d=this.image.getWidth()-1);let h=Math.floor(r-(o-r)*u);return u=1,h<0?(u=r/(r-h),h=0):h>=this.image.getHeight()&&(u=(this.image.getHeight()-1-r)/(h-r),h=this.image.getHeight()-1),d=Math.floor(n+(d-n)*u),a+=this.sizeOfBlackWhiteBlackRun(n,r,d,h),a-1}sizeOfBlackWhiteBlackRun(n,r,s,o){const a=Math.abs(o-r)>Math.abs(s-n);if(a){let I=n;n=r,r=I,I=s,s=o,o=I}const u=Math.abs(s-n),d=Math.abs(o-r);let h=-u/2;const g=n<s?1:-1,x=r<o?1:-1;let E=0;const A=s+g;for(let I=n,b=r;I!==A;I+=g){const D=a?b:I,L=a?I:b;if(E===1===this.image.get(D,L)){if(E===2)return Te.distance(I,b,n,r);E++}if(h+=d,h>0){if(b===o)break;b+=x,h-=u}}return E===2?Te.distance(s+g,o,n,r):NaN}findAlignmentInRegion(n,r,s,o){const a=Math.floor(o*n),u=Math.max(0,r-a),d=Math.min(this.image.getWidth()-1,r+a);if(d-u<n*3)throw new H("Alignment top exceeds estimated module size.");const h=Math.max(0,s-a),g=Math.min(this.image.getHeight()-1,s+a);if(g-h<n*3)throw new H("Alignment bottom exceeds estimated module size.");return new fo(this.image,u,h,d-u,g-h,n,this.resultPointCallback).find()}}class ur{constructor(){this.decoder=new Uh}getDecoder(){return this.decoder}decode(n,r){let s,o;if(r!=null&&r.get(U.PURE_BARCODE)!==void 0){const h=ur.extractPureBits(n.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,r),o=ur.NO_POINTS}else{const h=new es(n.getBlackMatrix()).detect(r);s=this.decoder.decodeBitMatrix(h.getBits(),r),o=h.getPoints()}s.getOther()instanceof n1&&s.getOther().applyMirroredCorrection(o);const a=new Ke(s.getText(),s.getRawBytes(),void 0,o,le.QR_CODE,void 0),u=s.getByteSegments();u!==null&&a.putMetadata(wt.BYTE_SEGMENTS,u);const d=s.getECLevel();return d!==null&&a.putMetadata(wt.ERROR_CORRECTION_LEVEL,d),s.hasStructuredAppend()&&(a.putMetadata(wt.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),a.putMetadata(wt.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),a}reset(){}static extractPureBits(n){const r=n.getTopLeftOnBit(),s=n.getBottomRightOnBit();if(r===null||s===null)throw new H;const o=this.moduleSize(r,n);let a=r[1],u=s[1],d=r[0],h=s[0];if(d>=h||a>=u)throw new H;if(u-a!==h-d&&(h=d+(u-a),h>=n.getWidth()))throw new H;const g=Math.round((h-d+1)/o),x=Math.round((u-a+1)/o);if(g<=0||x<=0)throw new H;if(x!==g)throw new H;const E=Math.floor(o/2);a+=E,d+=E;const A=d+Math.floor((g-1)*o)-h;if(A>0){if(A>E)throw new H;d-=A}const I=a+Math.floor((x-1)*o)-u;if(I>0){if(I>E)throw new H;a-=I}const b=new _e(g,x);for(let D=0;D<x;D++){const L=a+Math.floor(D*o);for(let z=0;z<g;z++)n.get(d+Math.floor(z*o),L)&&b.set(z,D)}return b}static moduleSize(n,r){const s=r.getHeight(),o=r.getWidth();let a=n[0],u=n[1],d=!0,h=0;for(;a<o&&u<s;){if(d!==r.get(a,u)){if(++h===5)break;d=!d}a++,u++}if(a===o||u===s)throw new H;return(a-n[0])/7}}ur.NO_POINTS=new Array;class he{PDF417Common(){}static getBitCountSum(n){return Te.sum(n)}static toIntArray(n){if(n==null||!n.length)return he.EMPTY_INT_ARRAY;const r=new Int32Array(n.length);let s=0;for(const o of n)r[s++]=o;return r}static getCodeword(n){const r=T.binarySearch(he.SYMBOL_TABLE,n&262143);return r<0?-1:(he.CODEWORD_TABLE[r]-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 zh{constructor(n,r){this.bits=n,this.points=r}getBits(){return this.bits}getPoints(){return this.points}}class we{static detectMultiple(n,r,s){let o=n.getBlackMatrix(),a=we.detect(s,o);return a.length||(o=o.clone(),o.rotate180(),a=we.detect(s,o)),new zh(o,a)}static detect(n,r){const s=new Array;let o=0,a=0,u=!1;for(;o<r.getHeight();){const d=we.findVertices(r,o,a);if(d[0]==null&&d[3]==null){if(!u)break;u=!1,a=0;for(const h of s)h[1]!=null&&(o=Math.trunc(Math.max(o,h[1].getY()))),h[3]!=null&&(o=Math.max(o,Math.trunc(h[3].getY())));o+=we.ROW_STEP;continue}if(u=!0,s.push(d),!n)break;d[2]!=null?(a=Math.trunc(d[2].getX()),o=Math.trunc(d[2].getY())):(a=Math.trunc(d[4].getX()),o=Math.trunc(d[4].getY()))}return s}static findVertices(n,r,s){const o=n.getHeight(),a=n.getWidth(),u=new Array(8);return we.copyToResult(u,we.findRowsWithPattern(n,o,a,r,s,we.START_PATTERN),we.INDEXES_START_PATTERN),u[4]!=null&&(s=Math.trunc(u[4].getX()),r=Math.trunc(u[4].getY())),we.copyToResult(u,we.findRowsWithPattern(n,o,a,r,s,we.STOP_PATTERN),we.INDEXES_STOP_PATTERN),u}static copyToResult(n,r,s){for(let o=0;o<s.length;o++)n[s[o]]=r[o]}static findRowsWithPattern(n,r,s,o,a,u){const d=new Array(4);let h=!1;const g=new Int32Array(u.length);for(;o<r;o+=we.ROW_STEP){let E=we.findGuardPattern(n,a,o,s,!1,u,g);if(E!=null){for(;o>0;){const A=we.findGuardPattern(n,a,--o,s,!1,u,g);if(A!=null)E=A;else{o++;break}}d[0]=new ae(E[0],o),d[1]=new ae(E[1],o),h=!0;break}}let x=o+1;if(h){let E=0,A=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;x<r;x++){const I=we.findGuardPattern(n,A[0],x,s,!1,u,g);if(I!=null&&Math.abs(A[0]-I[0])<we.MAX_PATTERN_DRIFT&&Math.abs(A[1]-I[1])<we.MAX_PATTERN_DRIFT)A=I,E=0;else{if(E>we.SKIPPED_ROW_COUNT_MAX)break;E++}}x-=E+1,d[2]=new ae(A[0],x),d[3]=new ae(A[1],x)}return x-o<we.BARCODE_MIN_HEIGHT&&T.fill(d,null),d}static findGuardPattern(n,r,s,o,a,u,d){T.fillWithin(d,0,d.length,0);let h=r,g=0;for(;n.get(h,s)&&h>0&&g++<we.MAX_PIXEL_DRIFT;)h--;let x=h,E=0,A=u.length;for(let I=a;x<o;x++)if(n.get(x,s)!==I)d[E]++;else{if(E===A-1){if(we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE)return new Int32Array([h,x]);h+=d[0]+d[1],B.arraycopy(d,2,d,0,E-1),d[E-1]=0,d[E]=0,E--}else E++;d[E]=1,I=!I}return E===A-1&&we.patternMatchVariance(d,u,we.MAX_INDIVIDUAL_VARIANCE)<we.MAX_AVG_VARIANCE?new Int32Array([h,x-1]):null}static patternMatchVariance(n,r,s){let o=n.length,a=0,u=0;for(let g=0;g<o;g++)a+=n[g],u+=r[g];if(a<u)return 1/0;let d=a/u;s*=d;let h=0;for(let g=0;g<o;g++){let x=n[g],E=r[g]*d,A=x>E?x-E:E-x;if(A>s)return 1/0;h+=A}return h/a}}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 St{constructor(n,r){if(r.length===0)throw new v;this.field=n;let s=r.length;if(s>1&&r[0]===0){let o=1;for(;o<s&&r[o]===0;)o++;o===s?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(s-o),B.arraycopy(r,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=r}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(n){return this.coefficients[this.coefficients.length-1-n]}evaluateAt(n){if(n===0)return this.getCoefficient(0);if(n===1){let o=0;for(let a of this.coefficients)o=this.field.add(o,a);return o}let r=this.coefficients[0],s=this.coefficients.length;for(let o=1;o<s;o++)r=this.field.add(this.field.multiply(n,r),this.coefficients[o]);return r}add(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");if(this.isZero())return n;if(n.isZero())return this;let r=this.coefficients,s=n.coefficients;if(r.length>s.length){let u=r;r=s,s=u}let o=new Int32Array(s.length),a=s.length-r.length;B.arraycopy(s,0,o,0,a);for(let u=a;u<s.length;u++)o[u]=this.field.add(r[u-a],s[u]);return new St(this.field,o)}subtract(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");return n.isZero()?this:this.add(n.negative())}multiply(n){return n instanceof St?this.multiplyOther(n):this.multiplyScalar(n)}multiplyOther(n){if(!this.field.equals(n.field))throw new v("ModulusPolys do not have same ModulusGF field");if(this.isZero()||n.isZero())return new St(this.field,new Int32Array([0]));let r=this.coefficients,s=r.length,o=n.coefficients,a=o.length,u=new Int32Array(s+a-1);for(let d=0;d<s;d++){let h=r[d];for(let g=0;g<a;g++)u[d+g]=this.field.add(u[d+g],this.field.multiply(h,o[g]))}return new St(this.field,u)}negative(){let n=this.coefficients.length,r=new Int32Array(n);for(let s=0;s<n;s++)r[s]=this.field.subtract(0,this.coefficients[s]);return new St(this.field,r)}multiplyScalar(n){if(n===0)return new St(this.field,new Int32Array([0]));if(n===1)return this;let r=this.coefficients.length,s=new Int32Array(r);for(let o=0;o<r;o++)s[o]=this.field.multiply(this.coefficients[o],n);return new St(this.field,s)}multiplyByMonomial(n,r){if(n<0)throw new v;if(r===0)return new St(this.field,new Int32Array([0]));let s=this.coefficients.length,o=new Int32Array(s+n);for(let a=0;a<s;a++)o[a]=this.field.multiply(this.coefficients[a],r);return new St(this.field,o)}toString(){let n=new ge;for(let r=this.getDegree();r>=0;r--){let s=this.getCoefficient(r);s!==0&&(s<0?(n.append(" - "),s=-s):n.length()>0&&n.append(" + "),(r===0||s!==1)&&n.append(s),r!==0&&(r===1?n.append("x"):(n.append("x^"),n.append(r))))}return n.toString()}}class Vh{add(n,r){return(n+r)%this.modulus}subtract(n,r){return(this.modulus+n-r)%this.modulus}exp(n){return this.expTable[n]}log(n){if(n===0)throw new v;return this.logTable[n]}inverse(n){if(n===0)throw new io;return this.expTable[this.modulus-this.logTable[n]-1]}multiply(n,r){return n===0||r===0?0:this.expTable[(this.logTable[n]+this.logTable[r])%(this.modulus-1)]}getSize(){return this.modulus}equals(n){return n===this}}class tl extends Vh{constructor(n,r){super(),this.modulus=n,this.expTable=new Int32Array(n),this.logTable=new Int32Array(n);let s=1;for(let o=0;o<n;o++)this.expTable[o]=s,s=s*r%n;for(let o=0;o<n-1;o++)this.logTable[this.expTable[o]]=o;this.zero=new St(this,new Int32Array([0])),this.one=new St(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(n,r){if(n<0)throw new v;if(r===0)return this.zero;let s=new Int32Array(n+1);return s[0]=r,new St(this,s)}}tl.PDF417_GF=new tl(he.NUMBER_OF_CODEWORDS,3);class r1{constructor(){this.field=tl.PDF417_GF}decode(n,r,s){let o=new St(this.field,n),a=new Int32Array(r),u=!1;for(let b=r;b>0;b--){let D=o.evaluateAt(this.field.exp(b));a[r-b]=D,D!==0&&(u=!0)}if(!u)return 0;let d=this.field.getOne();if(s!=null)for(const b of s){let D=this.field.exp(n.length-1-b),L=new St(this.field,new Int32Array([this.field.subtract(0,D),1]));d=d.multiply(L)}let h=new St(this.field,a),g=this.runEuclideanAlgorithm(this.field.buildMonomial(r,1),h,r),x=g[0],E=g[1],A=this.findErrorLocations(x),I=this.findErrorMagnitudes(E,x,A);for(let b=0;b<A.length;b++){let D=n.length-1-this.field.log(A[b]);if(D<0)throw M.getChecksumInstance();n[D]=this.field.subtract(n[D],I[b])}return A.length}runEuclideanAlgorithm(n,r,s){if(n.getDegree()<r.getDegree()){let A=n;n=r,r=A}let o=n,a=r,u=this.field.getZero(),d=this.field.getOne();for(;a.getDegree()>=Math.round(s/2);){let A=o,I=u;if(o=a,u=d,o.isZero())throw M.getChecksumInstance();a=A;let b=this.field.getZero(),D=o.getCoefficient(o.getDegree()),L=this.field.inverse(D);for(;a.getDegree()>=o.getDegree()&&!a.isZero();){let z=a.getDegree()-o.getDegree(),q=this.field.multiply(a.getCoefficient(a.getDegree()),L);b=b.add(this.field.buildMonomial(z,q)),a=a.subtract(o.multiplyByMonomial(z,q))}d=b.multiply(u).subtract(I).negative()}let h=d.getCoefficient(0);if(h===0)throw M.getChecksumInstance();let g=this.field.inverse(h),x=d.multiply(g),E=a.multiply(g);return[x,E]}findErrorLocations(n){let r=n.getDegree(),s=new Int32Array(r),o=0;for(let a=1;a<this.field.getSize()&&o<r;a++)n.evaluateAt(a)===0&&(s[o]=this.field.inverse(a),o++);if(o!==r)throw M.getChecksumInstance();return s}findErrorMagnitudes(n,r,s){let o=r.getDegree(),a=new Int32Array(o);for(let g=1;g<=o;g++)a[o-g]=this.field.multiply(g,r.getCoefficient(g));let u=new St(this.field,a),d=s.length,h=new Int32Array(d);for(let g=0;g<d;g++){let x=this.field.inverse(s[g]),E=this.field.subtract(0,n.evaluateAt(x)),A=this.field.inverse(u.evaluateAt(x));h[g]=this.field.multiply(E,A)}return h}}class Fr{constructor(n,r,s,o,a){n instanceof Fr?this.constructor_2(n):this.constructor_1(n,r,s,o,a)}constructor_1(n,r,s,o,a){const u=r==null||s==null,d=o==null||a==null;if(u&&d)throw new H;u?(r=new ae(0,o.getY()),s=new ae(0,a.getY())):d&&(o=new ae(n.getWidth()-1,r.getY()),a=new ae(n.getWidth()-1,s.getY())),this.image=n,this.topLeft=r,this.bottomLeft=s,this.topRight=o,this.bottomRight=a,this.minX=Math.trunc(Math.min(r.getX(),s.getX())),this.maxX=Math.trunc(Math.max(o.getX(),a.getX())),this.minY=Math.trunc(Math.min(r.getY(),o.getY())),this.maxY=Math.trunc(Math.max(s.getY(),a.getY()))}constructor_2(n){this.image=n.image,this.topLeft=n.getTopLeft(),this.bottomLeft=n.getBottomLeft(),this.topRight=n.getTopRight(),this.bottomRight=n.getBottomRight(),this.minX=n.getMinX(),this.maxX=n.getMaxX(),this.minY=n.getMinY(),this.maxY=n.getMaxY()}static merge(n,r){return n==null?r:r==null?n:new Fr(n.image,n.topLeft,n.bottomLeft,r.topRight,r.bottomRight)}addMissingRows(n,r,s){let o=this.topLeft,a=this.bottomLeft,u=this.topRight,d=this.bottomRight;if(n>0){let h=s?this.topLeft:this.topRight,g=Math.trunc(h.getY()-n);g<0&&(g=0);let x=new ae(h.getX(),g);s?o=x:u=x}if(r>0){let h=s?this.bottomLeft:this.bottomRight,g=Math.trunc(h.getY()+r);g>=this.image.getHeight()&&(g=this.image.getHeight()-1);let x=new ae(h.getX(),g);s?a=x:d=x}return new Fr(this.image,o,a,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 jh{constructor(n,r,s,o){this.columnCount=n,this.errorCorrectionLevel=o,this.rowCountUpperPart=r,this.rowCountLowerPart=s,this.rowCount=r+s}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class ts{constructor(){this.buffer=""}static form(n,r){let s=-1;function o(u,d,h,g,x,E){if(u==="%%")return"%";if(r[++s]===void 0)return;u=g?parseInt(g.substr(1)):void 0;let A=x?parseInt(x.substr(1)):void 0,I;switch(E){case"s":I=r[s];break;case"c":I=r[s][0];break;case"f":I=parseFloat(r[s]).toFixed(u);break;case"p":I=parseFloat(r[s]).toPrecision(u);break;case"e":I=parseFloat(r[s]).toExponential(u);break;case"x":I=parseInt(r[s]).toString(A||16);break;case"d":I=parseFloat(parseInt(r[s],A||10).toPrecision(u)).toFixed(0);break}I=typeof I=="object"?JSON.stringify(I):(+I).toString(A);let b=parseInt(h),D=h&&h[0]+""=="0"?"0":" ";for(;I.length<b;)I=d!==void 0?I+D:D+I;return I}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return n.replace(a,o)}format(n,...r){this.buffer+=ts.form(n,r)}toString(){return this.buffer}}class ns{constructor(n){this.boundingBox=new Fr(n),this.codewords=new Array(n.getMaxY()-n.getMinY()+1)}getCodewordNearby(n){let r=this.getCodeword(n);if(r!=null)return r;for(let s=1;s<ns.MAX_NEARBY_DISTANCE;s++){let o=this.imageRowToCodewordIndex(n)-s;if(o>=0&&(r=this.codewords[o],r!=null)||(o=this.imageRowToCodewordIndex(n)+s,o<this.codewords.length&&(r=this.codewords[o],r!=null)))return r}return null}imageRowToCodewordIndex(n){return n-this.boundingBox.getMinY()}setCodeword(n,r){this.codewords[this.imageRowToCodewordIndex(n)]=r}getCodeword(n){return this.codewords[this.imageRowToCodewordIndex(n)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const n=new ts;let r=0;for(const s of this.codewords){if(s==null){n.format("%3d: | %n",r++);continue}n.format("%3d: %3d|%3d%n",r++,s.getRowNumber(),s.getValue())}return n.toString()}}ns.MAX_NEARBY_DISTANCE=5;class rs{constructor(){this.values=new Map}setValue(n){n=Math.trunc(n);let r=this.values.get(n);r==null&&(r=0),r++,this.values.set(n,r)}getValue(){let n=-1,r=new Array;for(const[s,o]of this.values.entries()){const a={getKey:()=>s,getValue:()=>o};a.getValue()>n?(n=a.getValue(),r=[],r.push(a.getKey())):a.getValue()===n&&r.push(a.getKey())}return he.toIntArray(r)}getConfidence(n){return this.values.get(n)}}class i1 extends ns{constructor(n,r){super(n),this._isLeft=r}setRowNumbers(){for(let n of this.getCodewords())n!=null&&n.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(n){let r=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(r,n);let s=this.getBoundingBox(),o=this._isLeft?s.getTopLeft():s.getTopRight(),a=this._isLeft?s.getBottomLeft():s.getBottomRight(),u=this.imageRowToCodewordIndex(Math.trunc(o.getY())),d=this.imageRowToCodewordIndex(Math.trunc(a.getY())),h=-1,g=1,x=0;for(let E=u;E<d;E++){if(r[E]==null)continue;let A=r[E],I=A.getRowNumber()-h;if(I===0)x++;else if(I===1)g=Math.max(g,x),x=1,h=A.getRowNumber();else if(I<0||A.getRowNumber()>=n.getRowCount()||I>E)r[E]=null;else{let b;g>2?b=(g-2)*I:b=I;let D=b>=E;for(let L=1;L<=b&&!D;L++)D=r[E-L]!=null;D?r[E]=null:(h=A.getRowNumber(),x=1)}}}getRowHeights(){let n=this.getBarcodeMetadata();if(n==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(n);let r=new Int32Array(n.getRowCount());for(let s of this.getCodewords())if(s!=null){let o=s.getRowNumber();if(o>=r.length)continue;r[o]++}return r}adjustIncompleteIndicatorColumnRowNumbers(n){let r=this.getBoundingBox(),s=this._isLeft?r.getTopLeft():r.getTopRight(),o=this._isLeft?r.getBottomLeft():r.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(s.getY())),u=this.imageRowToCodewordIndex(Math.trunc(o.getY())),d=this.getCodewords(),h=-1;for(let g=a;g<u;g++){if(d[g]==null)continue;let x=d[g];x.setRowNumberAsRowIndicatorColumn();let E=x.getRowNumber()-h;E===0||(E===1?h=x.getRowNumber():x.getRowNumber()>=n.getRowCount()?d[g]=null:h=x.getRowNumber())}}getBarcodeMetadata(){let n=this.getCodewords(),r=new rs,s=new rs,o=new rs,a=new rs;for(let d of n){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let h=d.getValue()%30,g=d.getRowNumber();switch(this._isLeft||(g+=2),g%3){case 0:s.setValue(h*3+1);break;case 1:a.setValue(h/3),o.setValue(h%3);break;case 2:r.setValue(h+1);break}}if(r.getValue().length===0||s.getValue().length===0||o.getValue().length===0||a.getValue().length===0||r.getValue()[0]<1||s.getValue()[0]+o.getValue()[0]<he.MIN_ROWS_IN_BARCODE||s.getValue()[0]+o.getValue()[0]>he.MAX_ROWS_IN_BARCODE)return null;let u=new jh(r.getValue()[0],s.getValue()[0],o.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(n,u),u}removeIncorrectCodewords(n,r){for(let s=0;s<n.length;s++){let o=n[s];if(n[s]==null)continue;let a=o.getValue()%30,u=o.getRowNumber();if(u>r.getRowCount()){n[s]=null;continue}switch(this._isLeft||(u+=2),u%3){case 0:a*3+1!==r.getRowCountUpperPart()&&(n[s]=null);break;case 1:(Math.trunc(a/3)!==r.getErrorCorrectionLevel()||a%3!==r.getRowCountLowerPart())&&(n[s]=null);break;case 2:a+1!==r.getColumnCount()&&(n[s]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
65
+ `+super.toString()}}class is{constructor(n,r){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=n,this.barcodeColumnCount=n.getColumnCount(),this.boundingBox=r,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let n=he.MAX_CODEWORDS_IN_BARCODE,r;do r=n,n=this.adjustRowNumbersAndGetCount();while(n>0&&n<r);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(n){n!=null&&n.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let n=this.adjustRowNumbersByRow();if(n===0)return 0;for(let r=1;r<this.barcodeColumnCount+1;r++){let s=this.detectionResultColumns[r].getCodewords();for(let o=0;o<s.length;o++)s[o]!=null&&(s[o].hasValidRowNumber()||this.adjustRowNumbers(r,o,s))}return n}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let n=this.detectionResultColumns[0].getCodewords(),r=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<n.length;s++)if(n[s]!=null&&r[s]!=null&&n[s].getRowNumber()===r[s].getRowNumber())for(let o=1;o<=this.barcodeColumnCount;o++){let a=this.detectionResultColumns[o].getCodewords()[s];a!=null&&(a.setRowNumber(n[s].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[o].getCodewords()[s]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let n=0,r=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let s=0;s<r.length;s++){if(r[s]==null)continue;let o=r[s].getRowNumber(),a=0;for(let u=this.barcodeColumnCount+1;u>0&&a<this.ADJUST_ROW_NUMBER_SKIP;u--){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(a=is.adjustRowNumberIfValid(o,a,d),d.hasValidRowNumber()||n++)}}return n}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let n=0,r=this.detectionResultColumns[0].getCodewords();for(let s=0;s<r.length;s++){if(r[s]==null)continue;let o=r[s].getRowNumber(),a=0;for(let u=1;u<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;u++){let d=this.detectionResultColumns[u].getCodewords()[s];d!=null&&(a=is.adjustRowNumberIfValid(o,a,d),d.hasValidRowNumber()||n++)}}return n}static adjustRowNumberIfValid(n,r,s){return s==null||s.hasValidRowNumber()||(s.isValidRowNumber(n)?(s.setRowNumber(n),r=0):++r),r}adjustRowNumbers(n,r,s){if(!this.detectionResultColumns[n-1])return;let o=s[r],a=this.detectionResultColumns[n-1].getCodewords(),u=a;this.detectionResultColumns[n+1]!=null&&(u=this.detectionResultColumns[n+1].getCodewords());let d=new Array(14);d[2]=a[r],d[3]=u[r],r>0&&(d[0]=s[r-1],d[4]=a[r-1],d[5]=u[r-1]),r>1&&(d[8]=s[r-2],d[10]=a[r-2],d[11]=u[r-2]),r<s.length-1&&(d[1]=s[r+1],d[6]=a[r+1],d[7]=u[r+1]),r<s.length-2&&(d[9]=s[r+2],d[12]=a[r+2],d[13]=u[r+2]);for(let h of d)if(is.adjustRowNumber(o,h))return}static adjustRowNumber(n,r){return r==null?!1:r.hasValidRowNumber()&&r.getBucket()===n.getBucket()?(n.setRowNumber(r.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(n){this.boundingBox=n}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(n,r){this.detectionResultColumns[n]=r}getDetectionResultColumn(n){return this.detectionResultColumns[n]}toString(){let n=this.detectionResultColumns[0];n==null&&(n=this.detectionResultColumns[this.barcodeColumnCount+1]);let r=new ts;for(let s=0;s<n.getCodewords().length;s++){r.format("CW %3d:",s);for(let o=0;o<this.barcodeColumnCount+2;o++){if(this.detectionResultColumns[o]==null){r.format(" | ");continue}let a=this.detectionResultColumns[o].getCodewords()[s];if(a==null){r.format(" | ");continue}r.format(" %3d|%3d",a.getRowNumber(),a.getValue())}r.format("%n")}return r.toString()}}class ss{constructor(n,r,s,o){this.rowNumber=ss.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(n),this.endX=Math.trunc(r),this.bucket=Math.trunc(s),this.value=Math.trunc(o)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(n){return n!==ss.BARCODE_ROW_UNKNOWN&&this.bucket===n%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(n){this.rowNumber=n}toString(){return this.rowNumber+"|"+this.value}}ss.BARCODE_ROW_UNKNOWN=-1;class Xt{static initialize(){for(let n=0;n<he.SYMBOL_TABLE.length;n++){let r=he.SYMBOL_TABLE[n],s=r&1;for(let o=0;o<he.BARS_IN_MODULE;o++){let a=0;for(;(r&1)===s;)a+=1,r>>=1;s=r&1,Xt.RATIOS_TABLE[n]||(Xt.RATIOS_TABLE[n]=new Array(he.BARS_IN_MODULE)),Xt.RATIOS_TABLE[n][he.BARS_IN_MODULE-o-1]=Math.fround(a/he.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(n){let r=Xt.getDecodedCodewordValue(Xt.sampleBitCounts(n));return r!==-1?r:Xt.getClosestDecodedValue(n)}static sampleBitCounts(n){let r=Te.sum(n),s=new Int32Array(he.BARS_IN_MODULE),o=0,a=0;for(let u=0;u<he.MODULES_IN_CODEWORD;u++){let d=r/(2*he.MODULES_IN_CODEWORD)+u*r/he.MODULES_IN_CODEWORD;a+n[o]<=d&&(a+=n[o],o++),s[o]++}return s}static getDecodedCodewordValue(n){let r=Xt.getBitValue(n);return he.getCodeword(r)===-1?-1:r}static getBitValue(n){let r=0;for(let s=0;s<n.length;s++)for(let o=0;o<n[s];o++)r=r<<1|(s%2===0?1:0);return Math.trunc(r)}static getClosestDecodedValue(n){let r=Te.sum(n),s=new Array(he.BARS_IN_MODULE);if(r>1)for(let u=0;u<s.length;u++)s[u]=Math.fround(n[u]/r);let o=so.MAX_VALUE,a=-1;this.bSymbolTableReady||Xt.initialize();for(let u=0;u<Xt.RATIOS_TABLE.length;u++){let d=0,h=Xt.RATIOS_TABLE[u];for(let g=0;g<he.BARS_IN_MODULE;g++){let x=Math.fround(h[g]-s[g]);if(d+=Math.fround(x*x),d>=o)break}d<o&&(o=d,a=he.SYMBOL_TABLE[u])}return a}}Xt.bSymbolTableReady=!1,Xt.RATIOS_TABLE=new Array(he.SYMBOL_TABLE.length).map(y=>new Array(he.BARS_IN_MODULE));class s1{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(n){this.segmentIndex=n}getFileId(){return this.fileId}setFileId(n){this.fileId=n}getOptionalData(){return this.optionalData}setOptionalData(n){this.optionalData=n}isLastSegment(){return this.lastSegment}setLastSegment(n){this.lastSegment=n}getSegmentCount(){return this.segmentCount}setSegmentCount(n){this.segmentCount=n}getSender(){return this.sender||null}setSender(n){this.sender=n}getAddressee(){return this.addressee||null}setAddressee(n){this.addressee=n}getFileName(){return this.fileName}setFileName(n){this.fileName=n}getFileSize(){return this.fileSize}setFileSize(n){this.fileSize=n}getChecksum(){return this.checksum}setChecksum(n){this.checksum=n}getTimestamp(){return this.timestamp}setTimestamp(n){this.timestamp=n}}class o1{static parseLong(n,r=void 0){return parseInt(n,r)}}class a1 extends m{}a1.kind="NullPointerException";class Hh{writeBytes(n){this.writeBytesOffset(n,0,n.length)}writeBytesOffset(n,r,s){if(n==null)throw new a1;if(r<0||r>n.length||s<0||r+s>n.length||r+s<0)throw new K;if(s===0)return;for(let o=0;o<s;o++)this.write(n[r+o])}flush(){}close(){}}class Gh extends m{}class Xh extends Hh{constructor(n=32){if(super(),this.count=0,n<0)throw new v("Negative initial size: "+n);this.buf=new Uint8Array(n)}ensureCapacity(n){n-this.buf.length>0&&this.grow(n)}grow(n){let s=this.buf.length<<1;if(s-n<0&&(s=n),s<0){if(n<0)throw new Gh;s=N.MAX_VALUE}this.buf=T.copyOfUint8Array(this.buf,s)}write(n){this.ensureCapacity(this.count+1),this.buf[this.count]=n,this.count+=1}writeBytesOffset(n,r,s){if(r<0||r>n.length||s<0||r+s-n.length>0)throw new K;this.ensureCapacity(this.count+s),B.arraycopy(n,r,this.buf,this.count,s),this.count+=s}writeTo(n){n.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return T.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(n){return n?typeof n=="string"?this.toString_string(n):this.toString_number(n):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(n){return new String(this.buf).toString()}toString_number(n){return new String(this.buf).toString()}close(){}}var Pe;(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"})(Pe||(Pe={}));function l1(){if(typeof window<"u")return window.BigInt||null;if(typeof ls<"u")return ls.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ho;function cr(y){if(typeof ho>"u"&&(ho=l1()),ho===null)throw new Error("BigInt is not supported!");return ho(y)}function Yh(){let y=[];y[0]=cr(1);let n=cr(900);y[1]=n;for(let r=2;r<16;r++)y[r]=y[r-1]*n;return y}class W{static decode(n,r){let s=new ge(""),o=V.ISO8859_1;s.enableDecoding(o);let a=1,u=n[a++],d=new s1;for(;a<n[0];){switch(u){case W.TEXT_COMPACTION_MODE_LATCH:a=W.textCompaction(n,a,s);break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:a=W.byteCompaction(u,n,o,a,s);break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(n[a++]);break;case W.NUMERIC_COMPACTION_MODE_LATCH:a=W.numericCompaction(n,a,s);break;case W.ECI_CHARSET:V.getCharacterSetECIByValue(n[a++]);break;case W.ECI_GENERAL_PURPOSE:a+=2;break;case W.ECI_USER_DEFINED:a++;break;case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=W.decodeMacroBlock(n,a,d);break;case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:throw new k;default:a--,a=W.textCompaction(n,a,s);break}if(a<n.length)u=n[a++];else throw k.getFormatInstance()}if(s.length()===0)throw k.getFormatInstance();let h=new Qi(null,s.toString(),null,r);return h.setOther(d),h}static decodeMacroBlock(n,r,s){if(r+W.NUMBER_OF_SEQUENCE_CODEWORDS>n[0])throw k.getFormatInstance();let o=new Int32Array(W.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<W.NUMBER_OF_SEQUENCE_CODEWORDS;d++,r++)o[d]=n[r];s.setSegmentIndex(N.parseInt(W.decodeBase900toBase10(o,W.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new ge;r=W.textCompaction(n,r,a),s.setFileId(a.toString());let u=-1;for(n[r]===W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(u=r+1);r<n[0];)switch(n[r]){case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(r++,n[r]){case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new ge;r=W.textCompaction(n,r+1,d),s.setFileName(d.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let h=new ge;r=W.textCompaction(n,r+1,h),s.setSender(h.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let g=new ge;r=W.textCompaction(n,r+1,g),s.setAddressee(g.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let x=new ge;r=W.numericCompaction(n,r+1,x),s.setSegmentCount(N.parseInt(x.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let E=new ge;r=W.numericCompaction(n,r+1,E),s.setTimestamp(o1.parseLong(E.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let A=new ge;r=W.numericCompaction(n,r+1,A),s.setChecksum(N.parseInt(A.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let I=new ge;r=W.numericCompaction(n,r+1,I),s.setFileSize(o1.parseLong(I.toString()));break;default:throw k.getFormatInstance()}break;case W.MACRO_PDF417_TERMINATOR:r++,s.setLastSegment(!0);break;default:throw k.getFormatInstance()}if(u!==-1){let d=r-u;s.isLastSegment()&&d--,s.setOptionalData(T.copyOfRange(n,u,u+d))}return r}static textCompaction(n,r,s){let o=new Int32Array((n[0]-r)*2),a=new Int32Array((n[0]-r)*2),u=0,d=!1;for(;r<n[0]&&!d;){let h=n[r++];if(h<W.TEXT_COMPACTION_MODE_LATCH)o[u]=h/30,o[u+1]=h%30,u+=2;else switch(h){case W.TEXT_COMPACTION_MODE_LATCH:o[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:r--,d=!0;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o[u]=W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,h=n[r++],a[u]=h,u++;break}}return W.decodeTextCompaction(o,a,u,s),r}static decodeTextCompaction(n,r,s,o){let a=Pe.ALPHA,u=Pe.ALPHA,d=0;for(;d<s;){let h=n[d],g="";switch(a){case Pe.ALPHA:if(h<26)g=String.fromCharCode(65+h);else switch(h){case 26:g=" ";break;case W.LL:a=Pe.LOWER;break;case W.ML:a=Pe.MIXED;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.LOWER:if(h<26)g=String.fromCharCode(97+h);else switch(h){case 26:g=" ";break;case W.AS:u=a,a=Pe.ALPHA_SHIFT;break;case W.ML:a=Pe.MIXED;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.MIXED:if(h<W.PL)g=W.MIXED_CHARS[h];else switch(h){case W.PL:a=Pe.PUNCT;break;case 26:g=" ";break;case W.LL:a=Pe.LOWER;break;case W.AL:a=Pe.ALPHA;break;case W.PS:u=a,a=Pe.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.PUNCT:if(h<W.PAL)g=W.PUNCT_CHARS[h];else switch(h){case W.PAL:a=Pe.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.ALPHA_SHIFT:if(a=u,h<26)g=String.fromCharCode(65+h);else switch(h){case 26:g=" ";break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break;case Pe.PUNCT_SHIFT:if(a=u,h<W.PAL)g=W.PUNCT_CHARS[h];else switch(h){case W.PAL:a=Pe.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(r[d]);break;case W.TEXT_COMPACTION_MODE_LATCH:a=Pe.ALPHA;break}break}g!==""&&o.append(g),d++}}static byteCompaction(n,r,s,o,a){let u=new Xh,d=0,h=0,g=!1;switch(n){case W.BYTE_COMPACTION_MODE_LATCH:let x=new Int32Array(6),E=r[o++];for(;o<r[0]&&!g;)switch(x[d++]=E,h=900*h+E,E=r[o++],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:o--,g=!0;break;default:if(d%5===0&&d>0){for(let A=0;A<6;++A)u.write(Number(cr(h)>>cr(8*(5-A))));h=0,d=0}break}o===r[0]&&E<W.TEXT_COMPACTION_MODE_LATCH&&(x[d++]=E);for(let A=0;A<d;A++)u.write(x[A]);break;case W.BYTE_COMPACTION_MODE_LATCH_6:for(;o<r[0]&&!g;){let A=r[o++];if(A<W.TEXT_COMPACTION_MODE_LATCH)d++,h=900*h+A;else switch(A){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:o--,g=!0;break}if(d%5===0&&d>0){for(let I=0;I<6;++I)u.write(Number(cr(h)>>cr(8*(5-I))));h=0,d=0}}break}return a.append(Ee.decode(u.toByteArray(),s)),o}static numericCompaction(n,r,s){let o=0,a=!1,u=new Int32Array(W.MAX_NUMERIC_CODEWORDS);for(;r<n[0]&&!a;){let d=n[r++];if(r===n[0]&&(a=!0),d<W.TEXT_COMPACTION_MODE_LATCH)u[o]=d,o++;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:r--,a=!0;break}(o%W.MAX_NUMERIC_CODEWORDS===0||d===W.NUMERIC_COMPACTION_MODE_LATCH||a)&&o>0&&(s.append(W.decodeBase900toBase10(u,o)),o=0)}return r}static decodeBase900toBase10(n,r){let s=cr(0);for(let a=0;a<r;a++)s+=W.EXP900[r-a-1]*cr(n[a]);let o=s.toString();if(o.charAt(0)!=="1")throw new k;return o.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 ,:
66
+ -.$/"|*()?{}'`,W.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",W.EXP900=l1()?Yh():[],W.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ye{constructor(){}static decode(n,r,s,o,a,u,d){let h=new Fr(n,r,s,o,a),g=null,x=null,E;for(let b=!0;;b=!1){if(r!=null&&(g=ye.getRowIndicatorColumn(n,h,r,!0,u,d)),o!=null&&(x=ye.getRowIndicatorColumn(n,h,o,!1,u,d)),E=ye.merge(g,x),E==null)throw H.getNotFoundInstance();let D=E.getBoundingBox();if(b&&D!=null&&(D.getMinY()<h.getMinY()||D.getMaxY()>h.getMaxY()))h=D;else break}E.setBoundingBox(h);let A=E.getBarcodeColumnCount()+1;E.setDetectionResultColumn(0,g),E.setDetectionResultColumn(A,x);let I=g!=null;for(let b=1;b<=A;b++){let D=I?b:A-b;if(E.getDetectionResultColumn(D)!==void 0)continue;let L;D===0||D===A?L=new i1(h,D===0):L=new ns(h),E.setDetectionResultColumn(D,L);let z=-1,q=z;for(let $=h.getMinY();$<=h.getMaxY();$++){if(z=ye.getStartColumn(E,D,$,I),z<0||z>h.getMaxX()){if(q===-1)continue;z=q}let Z=ye.detectCodeword(n,h.getMinX(),h.getMaxX(),I,z,$,u,d);Z!=null&&(L.setCodeword($,Z),q=z,u=Math.min(u,Z.getWidth()),d=Math.max(d,Z.getWidth()))}}return ye.createDecoderResult(E)}static merge(n,r){if(n==null&&r==null)return null;let s=ye.getBarcodeMetadata(n,r);if(s==null)return null;let o=Fr.merge(ye.adjustBoundingBox(n),ye.adjustBoundingBox(r));return new is(s,o)}static adjustBoundingBox(n){if(n==null)return null;let r=n.getRowHeights();if(r==null)return null;let s=ye.getMax(r),o=0;for(let d of r)if(o+=s-d,d>0)break;let a=n.getCodewords();for(let d=0;o>0&&a[d]==null;d++)o--;let u=0;for(let d=r.length-1;d>=0&&(u+=s-r[d],!(r[d]>0));d--);for(let d=a.length-1;u>0&&a[d]==null;d--)u--;return n.getBoundingBox().addMissingRows(o,u,n.isLeft())}static getMax(n){let r=-1;for(let s of n)r=Math.max(r,s);return r}static getBarcodeMetadata(n,r){let s;if(n==null||(s=n.getBarcodeMetadata())==null)return r==null?null:r.getBarcodeMetadata();let o;return r==null||(o=r.getBarcodeMetadata())==null?s:s.getColumnCount()!==o.getColumnCount()&&s.getErrorCorrectionLevel()!==o.getErrorCorrectionLevel()&&s.getRowCount()!==o.getRowCount()?null:s}static getRowIndicatorColumn(n,r,s,o,a,u){let d=new i1(r,o);for(let h=0;h<2;h++){let g=h===0?1:-1,x=Math.trunc(Math.trunc(s.getX()));for(let E=Math.trunc(Math.trunc(s.getY()));E<=r.getMaxY()&&E>=r.getMinY();E+=g){let A=ye.detectCodeword(n,0,n.getWidth(),o,x,E,a,u);A!=null&&(d.setCodeword(E,A),o?x=A.getStartX():x=A.getEndX())}}return d}static adjustCodewordCount(n,r){let s=r[0][1],o=s.getValue(),a=n.getBarcodeColumnCount()*n.getBarcodeRowCount()-ye.getNumberOfECCodeWords(n.getBarcodeECLevel());if(o.length===0){if(a<1||a>he.MAX_CODEWORDS_IN_BARCODE)throw H.getNotFoundInstance();s.setValue(a)}else o[0]!==a&&s.setValue(a)}static createDecoderResult(n){let r=ye.createBarcodeMatrix(n);ye.adjustCodewordCount(n,r);let s=new Array,o=new Int32Array(n.getBarcodeRowCount()*n.getBarcodeColumnCount()),a=[],u=new Array;for(let h=0;h<n.getBarcodeRowCount();h++)for(let g=0;g<n.getBarcodeColumnCount();g++){let x=r[h][g+1].getValue(),E=h*n.getBarcodeColumnCount()+g;x.length===0?s.push(E):x.length===1?o[E]=x[0]:(u.push(E),a.push(x))}let d=new Array(a.length);for(let h=0;h<d.length;h++)d[h]=a[h];return ye.createDecoderResultFromAmbiguousValues(n.getBarcodeECLevel(),o,he.toIntArray(s),he.toIntArray(u),d)}static createDecoderResultFromAmbiguousValues(n,r,s,o,a){let u=new Int32Array(o.length),d=100;for(;d-- >0;){for(let h=0;h<u.length;h++)r[o[h]]=a[h][u[h]];try{return ye.decodeCodewords(r,n,s)}catch(h){if(!(h instanceof M))throw h}if(u.length===0)throw M.getChecksumInstance();for(let h=0;h<u.length;h++)if(u[h]<a[h].length-1){u[h]++;break}else if(u[h]=0,h===u.length-1)throw M.getChecksumInstance()}throw M.getChecksumInstance()}static createBarcodeMatrix(n){let r=Array.from({length:n.getBarcodeRowCount()},()=>new Array(n.getBarcodeColumnCount()+2));for(let o=0;o<r.length;o++)for(let a=0;a<r[o].length;a++)r[o][a]=new rs;let s=0;for(let o of n.getDetectionResultColumns()){if(o!=null){for(let a of o.getCodewords())if(a!=null){let u=a.getRowNumber();if(u>=0){if(u>=r.length)continue;r[u][s].setValue(a.getValue())}}}s++}return r}static isValidBarcodeColumn(n,r){return r>=0&&r<=n.getBarcodeColumnCount()+1}static getStartColumn(n,r,s,o){let a=o?1:-1,u=null;if(ye.isValidBarcodeColumn(n,r-a)&&(u=n.getDetectionResultColumn(r-a).getCodeword(s)),u!=null)return o?u.getEndX():u.getStartX();if(u=n.getDetectionResultColumn(r).getCodewordNearby(s),u!=null)return o?u.getStartX():u.getEndX();if(ye.isValidBarcodeColumn(n,r-a)&&(u=n.getDetectionResultColumn(r-a).getCodewordNearby(s)),u!=null)return o?u.getEndX():u.getStartX();let d=0;for(;ye.isValidBarcodeColumn(n,r-a);){r-=a;for(let h of n.getDetectionResultColumn(r).getCodewords())if(h!=null)return(o?h.getEndX():h.getStartX())+a*d*(h.getEndX()-h.getStartX());d++}return o?n.getBoundingBox().getMinX():n.getBoundingBox().getMaxX()}static detectCodeword(n,r,s,o,a,u,d,h){a=ye.adjustCodewordStartColumn(n,r,s,o,a,u);let g=ye.getModuleBitCount(n,r,s,o,a,u);if(g==null)return null;let x,E=Te.sum(g);if(o)x=a+E;else{for(let b=0;b<g.length/2;b++){let D=g[b];g[b]=g[g.length-1-b],g[g.length-1-b]=D}x=a,a=x-E}if(!ye.checkCodewordSkew(E,d,h))return null;let A=Xt.getDecodedValue(g),I=he.getCodeword(A);return I===-1?null:new ss(a,x,ye.getCodewordBucketNumber(A),I)}static getModuleBitCount(n,r,s,o,a,u){let d=a,h=new Int32Array(8),g=0,x=o?1:-1,E=o;for(;(o?d<s:d>=r)&&g<h.length;)n.get(d,u)===E?(h[g]++,d+=x):(g++,E=!E);return g===h.length||d===(o?s:r)&&g===h.length-1?h:null}static getNumberOfECCodeWords(n){return 2<<n}static adjustCodewordStartColumn(n,r,s,o,a,u){let d=a,h=o?-1:1;for(let g=0;g<2;g++){for(;(o?d>=r:d<s)&&o===n.get(d,u);){if(Math.abs(a-d)>ye.CODEWORD_SKEW_SIZE)return a;d+=h}h=-h,o=!o}return d}static checkCodewordSkew(n,r,s){return r-ye.CODEWORD_SKEW_SIZE<=n&&n<=s+ye.CODEWORD_SKEW_SIZE}static decodeCodewords(n,r,s){if(n.length===0)throw k.getFormatInstance();let o=1<<r+1,a=ye.correctErrors(n,s,o);ye.verifyCodewordCount(n,o);let u=W.decode(n,""+r);return u.setErrorsCorrected(a),u.setErasures(s.length),u}static correctErrors(n,r,s){if(r!=null&&r.length>s/2+ye.MAX_ERRORS||s<0||s>ye.MAX_EC_CODEWORDS)throw M.getChecksumInstance();return ye.errorCorrection.decode(n,s,r)}static verifyCodewordCount(n,r){if(n.length<4)throw k.getFormatInstance();let s=n[0];if(s>n.length)throw k.getFormatInstance();if(s===0)if(r<n.length)n[0]=n.length-r;else throw k.getFormatInstance()}static getBitCountForCodeword(n){let r=new Int32Array(8),s=0,o=r.length-1;for(;!((n&1)!==s&&(s=n&1,o--,o<0));)r[o]++,n>>=1;return r}static getCodewordBucketNumber(n){return n instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(n):this.getCodewordBucketNumber_number(n)}static getCodewordBucketNumber_number(n){return ye.getCodewordBucketNumber(ye.getBitCountForCodeword(n))}static getCodewordBucketNumber_Int32Array(n){return(n[0]-n[2]+n[4]-n[6]+9)%9}static toString(n){let r=new ts;for(let s=0;s<n.length;s++){r.format("Row %2d: ",s);for(let o=0;o<n[s].length;o++){let a=n[s][o];a.getValue().length===0?r.format(" ",null):r.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}r.format("%n")}return r.toString()}}ye.CODEWORD_SKEW_SIZE=2,ye.MAX_ERRORS=3,ye.MAX_EC_CODEWORDS=512,ye.errorCorrection=new r1;class It{decode(n,r=null){let s=It.decode(n,r,!1);if(s==null||s.length===0||s[0]==null)throw H.getNotFoundInstance();return s[0]}decodeMultiple(n,r=null){try{return It.decode(n,r,!0)}catch(s){throw s instanceof k||s instanceof M?H.getNotFoundInstance():s}}static decode(n,r,s){const o=new Array,a=we.detectMultiple(n,r,s);for(const u of a.getPoints()){const d=ye.decode(a.getBits(),u[4],u[5],u[6],u[7],It.getMinCodewordWidth(u),It.getMaxCodewordWidth(u)),h=new Ke(d.getText(),d.getRawBytes(),void 0,u,le.PDF_417);h.putMetadata(wt.ERROR_CORRECTION_LEVEL,d.getECLevel());const g=d.getOther();g!=null&&h.putMetadata(wt.PDF417_EXTRA_METADATA,g),o.push(h)}return o.map(u=>u)}static getMaxWidth(n,r){return n==null||r==null?0:Math.trunc(Math.abs(n.getX()-r.getX()))}static getMinWidth(n,r){return n==null||r==null?N.MAX_VALUE:Math.trunc(Math.abs(n.getX()-r.getX()))}static getMaxCodewordWidth(n){return Math.floor(Math.max(Math.max(It.getMaxWidth(n[0],n[4]),It.getMaxWidth(n[6],n[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.max(It.getMaxWidth(n[1],n[5]),It.getMaxWidth(n[7],n[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(n){return Math.floor(Math.min(Math.min(It.getMinWidth(n[0],n[4]),It.getMinWidth(n[6],n[2])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN),Math.min(It.getMinWidth(n[1],n[5]),It.getMinWidth(n[7],n[3])*he.MODULES_IN_CODEWORD/he.MODULES_IN_STOP_PATTERN)))}reset(){}}class go extends m{}go.kind="ReaderException";class u1{constructor(n,r){this.verbose=n===!0,r&&this.setHints(r)}decode(n,r){return r&&this.setHints(r),this.decodeInternal(n)}decodeWithState(n){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(n)}setHints(n){this.hints=n;const r=!l(n)&&n.get(U.TRY_HARDER)===!0,s=l(n)?null:n.get(U.POSSIBLE_FORMATS),o=new Array;if(!l(s)){const a=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);a&&!r&&o.push(new ai(n,this.verbose)),s.includes(le.QR_CODE)&&o.push(new ur),s.includes(le.DATA_MATRIX)&&o.push(new lr),s.includes(le.AZTEC)&&o.push(new ao),s.includes(le.PDF_417)&&o.push(new It),a&&r&&o.push(new ai(n,this.verbose))}o.length===0&&(r||o.push(new ai(n,this.verbose)),o.push(new ur),o.push(new lr),o.push(new ao),o.push(new It),r&&o.push(new ai(n,this.verbose))),this.readers=o}reset(){if(this.readers!==null)for(const n of this.readers)n.reset()}decodeInternal(n){if(this.readers===null)throw new go("No readers where selected, nothing can be read.");for(const r of this.readers)try{return r.decode(n,this.hints)}catch(s){if(s instanceof go)continue}throw new H("No MultiFormat Readers were able to detect the code.")}}class Zh extends cn{constructor(n=null,r=500){const s=new u1;s.setHints(n),super(s,r)}decodeBitmap(n){return this.reader.decodeWithState(n)}}class Kh extends cn{constructor(n=500){super(new It,n)}}class Qh extends cn{constructor(n=500){super(new ur,n)}}var nl;(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"})(nl||(nl={}));var gt=nl;class rl{constructor(n){this.field=n,this.cachedGenerators=[],this.cachedGenerators.push(new jt(n,Int32Array.from([1])))}buildGenerator(n){const r=this.cachedGenerators;if(n>=r.length){let s=r[r.length-1];const o=this.field;for(let a=r.length;a<=n;a++){const u=s.multiply(new jt(o,Int32Array.from([1,o.exp(a-1+o.getGeneratorBase())])));r.push(u),s=u}}return r[n]}encode(n,r){if(r===0)throw new v("No error correction bytes");const s=n.length-r;if(s<=0)throw new v("No data bytes provided");const o=this.buildGenerator(r),a=new Int32Array(s);B.arraycopy(n,0,a,0,s);let u=new jt(this.field,a);u=u.multiplyByMonomial(r,1);const h=u.divide(o)[1].getCoefficients(),g=r-h.length;for(let x=0;x<g;x++)n[s+x]=0;B.arraycopy(h,0,n,s+g,h.length)}}class it{constructor(){}static applyMaskPenaltyRule1(n){return it.applyMaskPenaltyRule1Internal(n,!0)+it.applyMaskPenaltyRule1Internal(n,!1)}static applyMaskPenaltyRule2(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let u=0;u<a-1;u++){const d=s[u];for(let h=0;h<o-1;h++){const g=d[h];g===d[h+1]&&g===s[u+1][h]&&g===s[u+1][h+1]&&r++}}return it.N2*r}static applyMaskPenaltyRule3(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let u=0;u<a;u++)for(let d=0;d<o;d++){const h=s[u];d+6<o&&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))&&r++,u+6<a&&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))&&r++}return r*it.N3}static isWhiteHorizontal(n,r,s){r=Math.max(r,0),s=Math.min(s,n.length);for(let o=r;o<s;o++)if(n[o]===1)return!1;return!0}static isWhiteVertical(n,r,s,o){s=Math.max(s,0),o=Math.min(o,n.length);for(let a=s;a<o;a++)if(n[a][r]===1)return!1;return!0}static applyMaskPenaltyRule4(n){let r=0;const s=n.getArray(),o=n.getWidth(),a=n.getHeight();for(let h=0;h<a;h++){const g=s[h];for(let x=0;x<o;x++)g[x]===1&&r++}const u=n.getHeight()*n.getWidth();return Math.floor(Math.abs(r*2-u)*10/u)*it.N4}static getDataMaskBit(n,r,s){let o,a;switch(n){case 0:o=s+r&1;break;case 1:o=s&1;break;case 2:o=r%3;break;case 3:o=(s+r)%3;break;case 4:o=Math.floor(s/2)+Math.floor(r/3)&1;break;case 5:a=s*r,o=(a&1)+a%3;break;case 6:a=s*r,o=(a&1)+a%3&1;break;case 7:a=s*r,o=a%3+(s+r&1)&1;break;default:throw new v("Invalid mask pattern: "+n)}return o===0}static applyMaskPenaltyRule1Internal(n,r){let s=0;const o=r?n.getHeight():n.getWidth(),a=r?n.getWidth():n.getHeight(),u=n.getArray();for(let d=0;d<o;d++){let h=0,g=-1;for(let x=0;x<a;x++){const E=r?u[d][x]:u[x][d];E===g?h++:(h>=5&&(s+=it.N1+(h-5)),h=1,g=E)}h>=5&&(s+=it.N1+(h-5))}return s}}it.N1=3,it.N2=3,it.N3=40,it.N4=10;class po{constructor(n,r){this.width=n,this.height=r;const s=new Array(r);for(let o=0;o!==r;o++)s[o]=new Uint8Array(n);this.bytes=s}getHeight(){return this.height}getWidth(){return this.width}get(n,r){return this.bytes[r][n]}getArray(){return this.bytes}setNumber(n,r,s){this.bytes[r][n]=s}setBoolean(n,r,s){this.bytes[r][n]=s?1:0}clear(n){for(const r of this.bytes)T.fill(r,n)}equals(n){if(!(n instanceof po))return!1;const r=n;if(this.width!==r.width||this.height!==r.height)return!1;for(let s=0,o=this.height;s<o;++s){const a=this.bytes[s],u=r.bytes[s];for(let d=0,h=this.width;d<h;++d)if(a[d]!==u[d])return!1}return!0}toString(){const n=new ge;for(let r=0,s=this.height;r<s;++r){const o=this.bytes[r];for(let a=0,u=this.width;a<u;++a)switch(o[a]){case 0:n.append(" 0");break;case 1:n.append(" 1");break;default:n.append(" ");break}n.append(`
67
67
  `)}return n.toString()}}class Ur{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 n=new ge;return n.append(`<<
68
68
  `),n.append(" mode: "),n.append(this.mode?this.mode.toString():"null"),n.append(`
69
69
  ecLevel: `),n.append(this.ecLevel?this.ecLevel.toString():"null"),n.append(`
@@ -73,15 +73,15 @@ Error generating stack: `+f.message+`
73
73
  `),n.append(this.matrix.toString())):n.append(`
74
74
  matrix: null
75
75
  `),n.append(`>>
76
- `),n.toString()}setMode(n){this.mode=n}setECLevel(n){this.ecLevel=n}setVersion(n){this.version=n}setMaskPattern(n){this.maskPattern=n}setMatrix(n){this.matrix=n}static isValidMaskPattern(n){return n>=0&&n<Ur.NUM_MASK_PATTERNS}}Ur.NUM_MASK_PATTERNS=8;class Le extends m{}Le.kind="WriterException";class fe{constructor(){}static clearMatrix(n){n.clear(255)}static buildMatrix(n,r,s,o,a){fe.clearMatrix(a),fe.embedBasicPatterns(s,a),fe.embedTypeInfo(r,o,a),fe.maybeEmbedVersionInfo(s,a),fe.embedDataBits(n,o,a)}static embedBasicPatterns(n,r){fe.embedPositionDetectionPatternsAndSeparators(r),fe.embedDarkDotAtLeftBottomCorner(r),fe.maybeEmbedPositionAdjustmentPatterns(n,r),fe.embedTimingPatterns(r)}static embedTypeInfo(n,r,s){const o=new G;fe.makeTypeInfoBits(n,r,o);for(let a=0,u=o.getSize();a<u;++a){const d=o.get(o.getSize()-1-a),h=fe.TYPE_INFO_COORDINATES[a],g=h[0],x=h[1];if(s.setBoolean(g,x,d),a<8){const E=s.getWidth()-a-1;s.setBoolean(E,8,d)}else{const A=s.getHeight()-7+(a-8);s.setBoolean(8,A,d)}}}static maybeEmbedVersionInfo(n,r){if(n.getVersionNumber()<7)return;const s=new G;fe.makeVersionInfoBits(n,s);let o=6*3-1;for(let a=0;a<6;++a)for(let u=0;u<3;++u){const d=s.get(o);o--,r.setBoolean(a,r.getHeight()-11+u,d),r.setBoolean(r.getHeight()-11+u,a,d)}}static embedDataBits(n,r,s){let o=0,a=-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 g=u-h;if(!fe.isEmpty(s.get(g,d)))continue;let x;o<n.getSize()?(x=n.get(o),++o):x=!1,r!==255&&it.getDataMaskBit(r,g,d)&&(x=!x),s.setBoolean(g,d,x)}d+=a}a=-a,d+=a,u-=2}if(o!==n.getSize())throw new Le("Not all bits consumed: "+o+"/"+n.getSize())}static findMSBSet(n){return 32-N.numberOfLeadingZeros(n)}static calculateBCHCode(n,r){if(r===0)throw new v("0 polynomial");const s=fe.findMSBSet(r);for(n<<=s-1;fe.findMSBSet(n)>=s;)n^=r<<fe.findMSBSet(n)-s;return n}static makeTypeInfoBits(n,r,s){if(!Ur.isValidMaskPattern(r))throw new Le("Invalid mask pattern");const o=n.getBits()<<3|r;s.appendBits(o,5);const a=fe.calculateBCHCode(o,fe.TYPE_INFO_POLY);s.appendBits(a,10);const u=new G;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(n,r){r.appendBits(n.getVersionNumber(),6);const s=fe.calculateBCHCode(n.getVersionNumber(),fe.VERSION_INFO_POLY);if(r.appendBits(s,12),r.getSize()!==18)throw new Le("should not happen but we got: "+r.getSize())}static isEmpty(n){return n===255}static embedTimingPatterns(n){for(let r=8;r<n.getWidth()-8;++r){const s=(r+1)%2;fe.isEmpty(n.get(r,6))&&n.setNumber(r,6,s),fe.isEmpty(n.get(6,r))&&n.setNumber(6,r,s)}}static embedDarkDotAtLeftBottomCorner(n){if(n.get(8,n.getHeight()-8)===0)throw new Le;n.setNumber(8,n.getHeight()-8,1)}static embedHorizontalSeparationPattern(n,r,s){for(let o=0;o<8;++o){if(!fe.isEmpty(s.get(n+o,r)))throw new Le;s.setNumber(n+o,r,0)}}static embedVerticalSeparationPattern(n,r,s){for(let o=0;o<7;++o){if(!fe.isEmpty(s.get(n,r+o)))throw new Le;s.setNumber(n,r+o,0)}}static embedPositionAdjustmentPattern(n,r,s){for(let o=0;o<5;++o){const a=fe.POSITION_ADJUSTMENT_PATTERN[o];for(let u=0;u<5;++u)s.setNumber(n+u,r+o,a[u])}}static embedPositionDetectionPattern(n,r,s){for(let o=0;o<7;++o){const a=fe.POSITION_DETECTION_PATTERN[o];for(let u=0;u<7;++u)s.setNumber(n+u,r+o,a[u])}}static embedPositionDetectionPatternsAndSeparators(n){const r=fe.POSITION_DETECTION_PATTERN[0].length;fe.embedPositionDetectionPattern(0,0,n),fe.embedPositionDetectionPattern(n.getWidth()-r,0,n),fe.embedPositionDetectionPattern(0,n.getWidth()-r,n);const s=8;fe.embedHorizontalSeparationPattern(0,s-1,n),fe.embedHorizontalSeparationPattern(n.getWidth()-s,s-1,n),fe.embedHorizontalSeparationPattern(0,n.getWidth()-s,n);const o=7;fe.embedVerticalSeparationPattern(o,0,n),fe.embedVerticalSeparationPattern(n.getHeight()-o-1,0,n),fe.embedVerticalSeparationPattern(o,n.getHeight()-o,n)}static maybeEmbedPositionAdjustmentPatterns(n,r){if(n.getVersionNumber()<2)return;const s=n.getVersionNumber()-1,o=fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let a=0,u=o.length;a!==u;a++){const d=o[a];if(d>=0)for(let h=0;h!==u;h++){const g=o[h];g>=0&&fe.isEmpty(r.get(g,d))&&fe.embedPositionAdjustmentPattern(g-2,d-2,r)}}}}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 Qh{constructor(n,r){this.dataBytes=n,this.errorCorrectionBytes=r}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Ve{constructor(){}static calculateMaskPenalty(n){return it.applyMaskPenaltyRule1(n)+it.applyMaskPenaltyRule2(n)+it.applyMaskPenaltyRule3(n)+it.applyMaskPenaltyRule4(n)}static encode(n,r,s=null){let o=Ve.DEFAULT_BYTE_MODE_ENCODING;const a=s!==null&&s.get(ht.CHARACTER_SET)!==void 0;a&&(o=s.get(ht.CHARACTER_SET).toString());const u=this.chooseMode(n,o),d=new G;if(u===ce.BYTE&&(a||Ve.DEFAULT_BYTE_MODE_ENCODING!==o)){const $=V.getCharacterSetECIByName(o);$!==void 0&&this.appendECI($,d)}this.appendModeInfo(u,d);const h=new G;this.appendBytes(n,u,h,o);let g;if(s!==null&&s.get(ht.QR_VERSION)!==void 0){const $=Number.parseInt(s.get(ht.QR_VERSION).toString(),10);g=ue.getVersionForNumber($);const Z=this.calculateBitsNeeded(u,d,h,g);if(!this.willFit(Z,g,r))throw new Le("Data too big for requested version")}else g=this.recommendVersion(r,u,d,h);const x=new G;x.appendBitArray(d);const E=u===ce.BYTE?h.getSizeInBytes():n.length;this.appendLengthInfo(E,g,u,x),x.appendBitArray(h);const A=g.getECBlocksForLevel(r),I=g.getTotalCodewords()-A.getTotalECCodewords();this.terminateBits(I,x);const b=this.interleaveWithECBytes(x,g.getTotalCodewords(),I,A.getNumBlocks()),D=new Ur;D.setECLevel(r),D.setMode(u),D.setVersion(g);const L=g.getDimensionForVersion(),z=new po(L,L),q=this.chooseMaskPattern(b,r,g,z);return D.setMaskPattern(q),fe.buildMatrix(b,r,g,q,z),D.setMatrix(z),D}static recommendVersion(n,r,s,o){const a=this.calculateBitsNeeded(r,s,o,ue.getVersionForNumber(1)),u=this.chooseVersion(a,n),d=this.calculateBitsNeeded(r,s,o,u);return this.chooseVersion(d,n)}static calculateBitsNeeded(n,r,s,o){return r.getSize()+n.getCharacterCountBits(o)+s.getSize()}static getAlphanumericCode(n){return n<Ve.ALPHANUMERIC_TABLE.length?Ve.ALPHANUMERIC_TABLE[n]:-1}static chooseMode(n,r=null){if(V.SJIS.getName()===r&&this.isOnlyDoubleByteKanji(n))return ce.KANJI;let s=!1,o=!1;for(let a=0,u=n.length;a<u;++a){const d=n.charAt(a);if(Ve.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)o=!0;else return ce.BYTE}return o?ce.ALPHANUMERIC:s?ce.NUMERIC:ce.BYTE}static isOnlyDoubleByteKanji(n){let r;try{r=Ee.encode(n,V.SJIS)}catch{return!1}const s=r.length;if(s%2!==0)return!1;for(let o=0;o<s;o+=2){const a=r[o]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0}static chooseMaskPattern(n,r,s,o){let a=Number.MAX_SAFE_INTEGER,u=-1;for(let d=0;d<Ur.NUM_MASK_PATTERNS;d++){fe.buildMatrix(n,r,s,d,o);let h=this.calculateMaskPenalty(o);h<a&&(a=h,u=d)}return u}static chooseVersion(n,r){for(let s=1;s<=40;s++){const o=ue.getVersionForNumber(s);if(Ve.willFit(n,o,r))return o}throw new Le("Data too big")}static willFit(n,r,s){const o=r.getTotalCodewords(),u=r.getECBlocksForLevel(s).getTotalECCodewords(),d=o-u,h=(n+7)/8;return d>=h}static terminateBits(n,r){const s=n*8;if(r.getSize()>s)throw new Le("data bits cannot fit in the QR Code"+r.getSize()+" > "+s);for(let u=0;u<4&&r.getSize()<s;++u)r.appendBit(!1);const o=r.getSize()&7;if(o>0)for(let u=o;u<8;u++)r.appendBit(!1);const a=n-r.getSizeInBytes();for(let u=0;u<a;++u)r.appendBits(u&1?17:236,8);if(r.getSize()!==s)throw new Le("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(n,r,s,o,a,u){if(o>=s)throw new Le("Block ID too large");const d=n%s,h=s-d,g=Math.floor(n/s),x=g+1,E=Math.floor(r/s),A=E+1,I=g-E,b=x-A;if(I!==b)throw new Le("EC bytes mismatch");if(s!==h+d)throw new Le("RS blocks mismatch");if(n!==(E+I)*h+(A+b)*d)throw new Le("Total bytes mismatch");o<h?(a[0]=E,u[0]=I):(a[0]=A,u[0]=b)}static interleaveWithECBytes(n,r,s,o){if(n.getSizeInBytes()!==s)throw new Le("Number of bits and data bytes does not match");let a=0,u=0,d=0;const h=new Array;for(let x=0;x<o;++x){const E=new Int32Array(1),A=new Int32Array(1);Ve.getNumDataBytesAndNumECBytesForBlockID(r,s,o,x,E,A);const I=E[0],b=new Uint8Array(I);n.toBytes(8*a,b,0,I);const D=Ve.generateECBytes(b,A[0]);h.push(new Qh(b,D)),u=Math.max(u,I),d=Math.max(d,D.length),a+=E[0]}if(s!==a)throw new Le("Data bytes does not match offset");const g=new G;for(let x=0;x<u;++x)for(const E of h){const A=E.getDataBytes();x<A.length&&g.appendBits(A[x],8)}for(let x=0;x<d;++x)for(const E of h){const A=E.getErrorCorrectionBytes();x<A.length&&g.appendBits(A[x],8)}if(r!==g.getSizeInBytes())throw new Le("Interleaving error: "+r+" and "+g.getSizeInBytes()+" differ.");return g}static generateECBytes(n,r){const s=n.length,o=new Int32Array(s+r);for(let u=0;u<s;u++)o[u]=n[u]&255;new rl(be.QR_CODE_FIELD_256).encode(o,r);const a=new Uint8Array(r);for(let u=0;u<r;u++)a[u]=o[s+u];return a}static appendModeInfo(n,r){r.appendBits(n.getBits(),4)}static appendLengthInfo(n,r,s,o){const a=s.getCharacterCountBits(r);if(n>=1<<a)throw new Le(n+" is bigger than "+((1<<a)-1));o.appendBits(n,a)}static appendBytes(n,r,s,o){switch(r){case ce.NUMERIC:Ve.appendNumericBytes(n,s);break;case ce.ALPHANUMERIC:Ve.appendAlphanumericBytes(n,s);break;case ce.BYTE:Ve.append8BitBytes(n,s,o);break;case ce.KANJI:Ve.appendKanjiBytes(n,s);break;default:throw new Le("Invalid mode: "+r)}}static getDigit(n){return n.charCodeAt(0)-48}static isDigit(n){const r=Ve.getDigit(n);return r>=0&&r<=9}static appendNumericBytes(n,r){const s=n.length;let o=0;for(;o<s;){const a=Ve.getDigit(n.charAt(o));if(o+2<s){const u=Ve.getDigit(n.charAt(o+1)),d=Ve.getDigit(n.charAt(o+2));r.appendBits(a*100+u*10+d,10),o+=3}else if(o+1<s){const u=Ve.getDigit(n.charAt(o+1));r.appendBits(a*10+u,7),o+=2}else r.appendBits(a,4),o++}}static appendAlphanumericBytes(n,r){const s=n.length;let o=0;for(;o<s;){const a=Ve.getAlphanumericCode(n.charCodeAt(o));if(a===-1)throw new Le;if(o+1<s){const u=Ve.getAlphanumericCode(n.charCodeAt(o+1));if(u===-1)throw new Le;r.appendBits(a*45+u,11),o+=2}else r.appendBits(a,6),o++}}static append8BitBytes(n,r,s){let o;try{o=Ee.encode(n,s)}catch(a){throw new Le(a)}for(let a=0,u=o.length;a!==u;a++){const d=o[a];r.appendBits(d,8)}}static appendKanjiBytes(n,r){let s;try{s=Ee.encode(n,V.SJIS)}catch(a){throw new Le(a)}const o=s.length;for(let a=0;a<o;a+=2){const u=s[a]&255,d=s[a+1]&255,h=u<<8&4294967295|d;let g=-1;if(h>=33088&&h<=40956?g=h-33088:h>=57408&&h<=60351&&(g=h-49472),g===-1)throw new Le("Invalid byte sequence");const x=(g>>8)*192+(g&255);r.appendBits(x,13)}}static appendECI(n,r){r.appendBits(ce.ECI.getBits(),4),r.appendBits(n.getValue(),8)}}Ve.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]),Ve.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class Wr{write(n,r,s,o=null){if(n.length===0)throw new v("Found empty contents");if(r<0||s<0)throw new v("Requested dimensions are too small: "+r+"x"+s);let a=We.L,u=Wr.QUIET_ZONE_SIZE;o!==null&&(o.get(ht.ERROR_CORRECTION)!==void 0&&(a=We.fromString(o.get(ht.ERROR_CORRECTION).toString())),o.get(ht.MARGIN)!==void 0&&(u=Number.parseInt(o.get(ht.MARGIN).toString(),10)));const d=Ve.encode(n,a,o);return this.renderResult(d,r,s,u)}writeToDom(n,r,s,o,a=null){typeof n=="string"&&(n=document.querySelector(n));const u=this.write(r,s,o,a);n&&n.appendChild(u)}renderResult(n,r,s,o){const a=n.getMatrix();if(a===null)throw new Dn;const u=a.getWidth(),d=a.getHeight(),h=u+o*2,g=d+o*2,x=Math.max(r,h),E=Math.max(s,g),A=Math.min(Math.floor(x/h),Math.floor(E/g)),I=Math.floor((x-u*A)/2),b=Math.floor((E-d*A)/2),D=this.createSVGElement(x,E);for(let L=0,z=b;L<d;L++,z+=A)for(let q=0,$=I;q<u;q++,$+=A)if(a.get(q,L)===1){const Z=this.createSvgRectElement($,z,A,A);D.appendChild(Z)}return D}createSVGElement(n,r){const s=document.createElementNS(Wr.SVG_NS,"svg");return s.setAttributeNS(null,"height",n.toString()),s.setAttributeNS(null,"width",r.toString()),s}createSvgRectElement(n,r,s,o){const a=document.createElementNS(Wr.SVG_NS,"rect");return a.setAttributeNS(null,"x",n.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"height",s.toString()),a.setAttributeNS(null,"width",o.toString()),a.setAttributeNS(null,"fill","#000000"),a}}Wr.QUIET_ZONE_SIZE=4,Wr.SVG_NS="http://www.w3.org/2000/svg";class ui{encode(n,r,s,o,a){if(n.length===0)throw new v("Found empty contents");if(r!==le.QR_CODE)throw new v("Can only encode QR_CODE, but got "+r);if(s<0||o<0)throw new v(`Requested dimensions are too small: ${s}x${o}`);let u=We.L,d=ui.QUIET_ZONE_SIZE;a!==null&&(a.get(ht.ERROR_CORRECTION)!==void 0&&(u=We.fromString(a.get(ht.ERROR_CORRECTION).toString())),a.get(ht.MARGIN)!==void 0&&(d=Number.parseInt(a.get(ht.MARGIN).toString(),10)));const h=Ve.encode(n,u,a);return ui.renderResult(h,s,o,d)}static renderResult(n,r,s,o){const a=n.getMatrix();if(a===null)throw new Dn;const u=a.getWidth(),d=a.getHeight(),h=u+o*2,g=d+o*2,x=Math.max(r,h),E=Math.max(s,g),A=Math.min(Math.floor(x/h),Math.floor(E/g)),I=Math.floor((x-u*A)/2),b=Math.floor((E-d*A)/2),D=new _e(x,E);for(let L=0,z=b;L<d;L++,z+=A)for(let q=0,$=I;q<u;q++,$+=A)a.get(q,L)===1&&D.setRegion($,z,A,A);return D}}ui.QUIET_ZONE_SIZE=4;class qh{encode(n,r,s,o,a){let u;switch(r){case le.QR_CODE:u=new ui;break;default:throw new v("No encoder available for format "+r)}return u.encode(n,r,s,o,a)}}class Bn extends ee{constructor(n,r,s,o,a,u,d,h){if(super(u,d),this.yuvData=n,this.dataWidth=r,this.dataHeight=s,this.left=o,this.top=a,o+u>r||a+d>s)throw new v("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(u,d)}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth();(r==null||r.length<s)&&(r=new Uint8ClampedArray(s));const o=(n+this.top)*this.dataWidth+this.left;return B.arraycopy(this.yuvData,o,r,0,s),r}getMatrix(){const n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.yuvData;const s=n*r,o=new Uint8ClampedArray(s);let a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return B.arraycopy(this.yuvData,a,o,0,s),o;for(let u=0;u<r;u++){const d=u*n;B.arraycopy(this.yuvData,a,o,d,n),a+=this.dataWidth}return o}isCropSupported(){return!0}crop(n,r,s,o){return new Bn(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,s,o,!1)}renderThumbnail(){const n=this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(n*r),o=this.yuvData;let a=this.top*this.dataWidth+this.left;for(let u=0;u<r;u++){const d=u*n;for(let h=0;h<n;h++){const g=o[a+h*Bn.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|g*65793}a+=this.dataWidth*Bn.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(n,r){const s=this.yuvData;for(let o=0,a=this.top*this.dataWidth+this.left;o<r;o++,a+=this.dataWidth){const u=a+n/2;for(let d=a,h=a+n-1;d<u;d++,h--){const g=s[d];s[d]=s[h],s[h]=g}}}invert(){return new de(this)}}Bn.THUMBNAIL_SCALE_FACTOR=2;class il extends ee{constructor(n,r,s,o,a,u,d){if(super(r,s),this.dataWidth=o,this.dataHeight=a,this.left=u,this.top=d,n.BYTES_PER_ELEMENT===4){const h=r*s,g=new Uint8ClampedArray(h);for(let x=0;x<h;x++){const E=n[x],A=E>>16&255,I=E>>7&510,b=E&255;g[x]=(A+I+b)/4&255}this.luminances=g}else this.luminances=n;if(o===void 0&&(this.dataWidth=r),a===void 0&&(this.dataHeight=s),u===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+r>this.dataWidth||this.top+s>this.dataHeight)throw new v("Crop rectangle does not fit within image data.")}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth();(r==null||r.length<s)&&(r=new Uint8ClampedArray(s));const o=(n+this.top)*this.dataWidth+this.left;return B.arraycopy(this.luminances,o,r,0,s),r}getMatrix(){const n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.luminances;const s=n*r,o=new Uint8ClampedArray(s);let a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return B.arraycopy(this.luminances,a,o,0,s),o;for(let u=0;u<r;u++){const d=u*n;B.arraycopy(this.luminances,a,o,d,n),a+=this.dataWidth}return o}isCropSupported(){return!0}crop(n,r,s,o){return new il(this.luminances,s,o,this.dataWidth,this.dataHeight,this.left+n,this.top+r)}invert(){return new de(this)}}class c1 extends V{static forName(n){return this.getCharacterSetECIByName(n)}}class sl{}sl.ISO_8859_1=V.ISO8859_1;class f1{isCompact(){return this.compact}setCompact(n){this.compact=n}getSize(){return this.size}setSize(n){this.size=n}getLayers(){return this.layers}setLayers(n){this.layers=n}getCodeWords(){return this.codeWords}setCodeWords(n){this.codeWords=n}getMatrix(){return this.matrix}setMatrix(n){this.matrix=n}}class d1{static singletonList(n){return[n]}static min(n,r){return n.sort(r)[0]}}class $h{constructor(n){this.previous=n}getPrevious(){return this.previous}}class ci extends $h{constructor(n,r,s){super(n),this.value=r,this.bitCount=s}appendTo(n,r){n.appendBits(this.value,this.bitCount)}add(n,r){return new ci(this,n,r)}addBinaryShift(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new ci(this,n,r)}toString(){let n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+N.toBinaryString(n|1<<this.bitCount).substring(1)+">"}}class ol extends ci{constructor(n,r,s){super(n,0,0),this.binaryShiftStart=r,this.binaryShiftByteCount=s}appendTo(n,r){for(let s=0;s<this.binaryShiftByteCount;s++)(s===0||s===31&&this.binaryShiftByteCount<=62)&&(n.appendBits(31,5),this.binaryShiftByteCount>62?n.appendBits(this.binaryShiftByteCount-31,16):s===0?n.appendBits(Math.min(this.binaryShiftByteCount,31),5):n.appendBits(this.binaryShiftByteCount-31,5)),n.appendBits(r[this.binaryShiftStart+s],8)}addBinaryShift(n,r){return new ol(this,n,r)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Jh(y,n,r){return new ol(y,n,r)}function os(y,n,r){return new ci(y,n,r)}const eg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],fr=0,xo=1,gn=2,h1=3,Ln=4,tg=new ci(null,0,0),al=[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 ng(y){for(let n of y)T.fill(n,-1);return y[fr][Ln]=0,y[xo][Ln]=0,y[xo][fr]=28,y[h1][Ln]=0,y[gn][Ln]=0,y[gn][fr]=15,y}const g1=ng(T.createInt32Array(6,6));class Fn{constructor(n,r,s,o){this.token=n,this.mode=r,this.binaryShiftByteCount=s,this.bitCount=o}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(n,r){let s=this.bitCount,o=this.token;if(n!==this.mode){let u=al[this.mode][n];o=os(o,u&65535,u>>16),s+=u>>16}let a=n===gn?4:5;return o=os(o,r,a),new Fn(o,n,0,s+a)}shiftAndAppend(n,r){let s=this.token,o=this.mode===gn?4:5;return s=os(s,g1[this.mode][n],o),s=os(s,r,5),new Fn(s,this.mode,0,this.bitCount+o+5)}addBinaryShiftChar(n){let r=this.token,s=this.mode,o=this.bitCount;if(this.mode===Ln||this.mode===gn){let d=al[s][fr];r=os(r,d&65535,d>>16),o+=d>>16,s=fr}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,u=new Fn(r,s,this.binaryShiftByteCount+1,o+a);return u.binaryShiftByteCount===2078&&(u=u.endBinaryShift(n+1)),u}endBinaryShift(n){if(this.binaryShiftByteCount===0)return this;let r=this.token;return r=Jh(r,n-this.binaryShiftByteCount,this.binaryShiftByteCount),new Fn(r,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(n){let r=this.bitCount+(al[this.mode][n.mode]>>16);return this.binaryShiftByteCount<n.binaryShiftByteCount?r+=Fn.calculateBinaryShiftCost(n)-Fn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>n.binaryShiftByteCount&&n.binaryShiftByteCount>0&&(r+=10),r<=n.bitCount}toBitArray(n){let r=[];for(let o=this.endBinaryShift(n.length).token;o!==null;o=o.getPrevious())r.unshift(o);let s=new G;for(const o of r)o.appendTo(s,n);return s}toString(){return ie.format("%s bits=%d bytes=%d",eg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(n){return n.binaryShiftByteCount>62?21:n.binaryShiftByteCount>31?20:n.binaryShiftByteCount>0?10:0}}Fn.INITIAL_STATE=new Fn(tg,fr,0,0);function rg(y){const n=ie.getCharCode(" "),r=ie.getCharCode("."),s=ie.getCharCode(",");y[fr][n]=1;const o=ie.getCharCode("Z"),a=ie.getCharCode("A");for(let A=a;A<=o;A++)y[fr][A]=A-a+2;y[xo][n]=1;const u=ie.getCharCode("z"),d=ie.getCharCode("a");for(let A=d;A<=u;A++)y[xo][A]=A-d+2;y[gn][n]=1;const h=ie.getCharCode("9"),g=ie.getCharCode("0");for(let A=g;A<=h;A++)y[gn][A]=A-g+2;y[gn][s]=12,y[gn][r]=13;const x=["\0"," ","","","","","","","\x07","\b"," ",`
77
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let A=0;A<x.length;A++)y[h1][ie.getCharCode(x[A])]=A;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let A=0;A<E.length;A++)ie.getCharCode(E[A])>0&&(y[Ln][ie.getCharCode(E[A])]=A);return y}const ll=rg(T.createInt32Array(5,256));class as{constructor(n){this.text=n}encode(){const n=ie.getCharCode(" "),r=ie.getCharCode(`
78
- `);let s=d1.singletonList(Fn.INITIAL_STATE);for(let a=0;a<this.text.length;a++){let u,d=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case ie.getCharCode("\r"):u=d===r?2:0;break;case ie.getCharCode("."):u=d===n?3:0;break;case ie.getCharCode(","):u=d===n?4:0;break;case ie.getCharCode(":"):u=d===n?5:0;break;default:u=0}u>0?(s=as.updateStateListForPair(s,a,u),a++):s=this.updateStateListForChar(s,a)}return d1.min(s,(a,u)=>a.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(n,r){const s=[];for(let o of n)this.updateStateForChar(o,r,s);return as.simplifyStates(s)}updateStateForChar(n,r,s){let o=this.text[r]&255,a=ll[n.getMode()][o]>0,u=null;for(let d=0;d<=Ln;d++){let h=ll[d][o];if(h>0){if(u==null&&(u=n.endBinaryShift(r)),!a||d===n.getMode()||d===gn){const g=u.latchAndAppend(d,h);s.push(g)}if(!a&&g1[n.getMode()][d]>=0){const g=u.shiftAndAppend(d,h);s.push(g)}}}if(n.getBinaryShiftByteCount()>0||ll[n.getMode()][o]===0){let d=n.addBinaryShiftChar(r);s.push(d)}}static updateStateListForPair(n,r,s){const o=[];for(let a of n)this.updateStateForPair(a,r,s,o);return this.simplifyStates(o)}static updateStateForPair(n,r,s,o){let a=n.endBinaryShift(r);if(o.push(a.latchAndAppend(Ln,s)),n.getMode()!==Ln&&o.push(a.shiftAndAppend(Ln,s)),s===3||s===4){let u=a.latchAndAppend(gn,16-s).latchAndAppend(gn,1);o.push(u)}if(n.getBinaryShiftByteCount()>0){let u=n.addBinaryShiftChar(r).addBinaryShiftChar(r+1);o.push(u)}}static simplifyStates(n){let r=[];for(const s of n){let o=!0;for(const a of r){if(a.isBetterThanOrEqualTo(s)){o=!1;break}s.isBetterThanOrEqualTo(a)&&(r=r.filter(u=>u!==a))}o&&r.push(s)}return r}}class Ne{constructor(){}static encodeBytes(n){return Ne.encode(n,Ne.DEFAULT_EC_PERCENT,Ne.DEFAULT_AZTEC_LAYERS)}static encode(n,r,s){let o=new as(n).encode(),a=N.truncDivision(o.getSize()*r,100)+11,u=o.getSize()+a,d,h,g,x,E;if(s!==Ne.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?Ne.MAX_NB_BITS_COMPACT:Ne.MAX_NB_BITS))throw new v(ie.format("Illegal value %s for layers",s));g=Ne.totalBitsInLayer(h,d),x=Ne.WORD_SIZE[h];let Z=g-g%x;if(E=Ne.stuffBits(o,x),E.getSize()+a>Z)throw new v("Data to large for user specified layer");if(d&&E.getSize()>x*64)throw new v("Data to large for user specified layer")}else{x=0,E=null;for(let Z=0;;Z++){if(Z>Ne.MAX_NB_BITS)throw new v("Data too large for an Aztec code");if(d=Z<=3,h=d?Z+1:Z,g=Ne.totalBitsInLayer(h,d),u>g)continue;(E==null||x!==Ne.WORD_SIZE[h])&&(x=Ne.WORD_SIZE[h],E=Ne.stuffBits(o,x));let ve=g-g%x;if(!(d&&E.getSize()>x*64)&&E.getSize()+a<=ve)break}}let A=Ne.generateCheckWords(E,g,x),I=E.getSize()/x,b=Ne.generateModeMessage(d,h,I),D=(d?11:14)+h*4,L=new Int32Array(D),z;if(d){z=D;for(let Z=0;Z<L.length;Z++)L[Z]=Z}else{z=D+1+2*N.truncDivision(N.truncDivision(D,2)-1,15);let Z=N.truncDivision(D,2),ve=N.truncDivision(z,2);for(let me=0;me<Z;me++){let Yt=me+N.truncDivision(me,15);L[Z-me-1]=ve-Yt-1,L[Z+me]=ve+Yt+1}}let q=new _e(z);for(let Z=0,ve=0;Z<h;Z++){let me=(h-Z)*4+(d?9:12);for(let Yt=0;Yt<me;Yt++){let vn=Yt*2;for(let Zt=0;Zt<2;Zt++)A.get(ve+vn+Zt)&&q.set(L[Z*2+Zt],L[Z*2+Yt]),A.get(ve+me*2+vn+Zt)&&q.set(L[Z*2+Yt],L[D-1-Z*2-Zt]),A.get(ve+me*4+vn+Zt)&&q.set(L[D-1-Z*2-Zt],L[D-1-Z*2-Yt]),A.get(ve+me*6+vn+Zt)&&q.set(L[D-1-Z*2-Yt],L[Z*2+Zt])}ve+=me*8}if(Ne.drawModeMessage(q,d,z,b),d)Ne.drawBullsEye(q,N.truncDivision(z,2),5);else{Ne.drawBullsEye(q,N.truncDivision(z,2),7);for(let Z=0,ve=0;Z<N.truncDivision(D,2)-1;Z+=15,ve+=16)for(let me=N.truncDivision(z,2)&1;me<z;me+=2)q.set(N.truncDivision(z,2)-ve,me),q.set(N.truncDivision(z,2)+ve,me),q.set(me,N.truncDivision(z,2)-ve),q.set(me,N.truncDivision(z,2)+ve)}let $=new f1;return $.setCompact(d),$.setSize(z),$.setLayers(h),$.setCodeWords(I),$.setMatrix(q),$}static drawBullsEye(n,r,s){for(let o=0;o<s;o+=2)for(let a=r-o;a<=r+o;a++)n.set(a,r-o),n.set(a,r+o),n.set(r-o,a),n.set(r+o,a);n.set(r-s,r-s),n.set(r-s+1,r-s),n.set(r-s,r-s+1),n.set(r+s,r-s),n.set(r+s,r-s+1),n.set(r+s,r+s-1)}static generateModeMessage(n,r,s){let o=new G;return n?(o.appendBits(r-1,2),o.appendBits(s-1,6),o=Ne.generateCheckWords(o,28,4)):(o.appendBits(r-1,5),o.appendBits(s-1,11),o=Ne.generateCheckWords(o,40,4)),o}static drawModeMessage(n,r,s,o){let a=N.truncDivision(s,2);if(r)for(let u=0;u<7;u++){let d=a-3+u;o.get(u)&&n.set(d,a-5),o.get(u+7)&&n.set(a+5,d),o.get(20-u)&&n.set(d,a+5),o.get(27-u)&&n.set(a-5,d)}else for(let u=0;u<10;u++){let d=a-5+u+N.truncDivision(u,5);o.get(u)&&n.set(d,a-7),o.get(u+10)&&n.set(a+7,d),o.get(29-u)&&n.set(d,a+7),o.get(39-u)&&n.set(a-7,d)}}static generateCheckWords(n,r,s){let o=n.getSize()/s,a=new rl(Ne.getGF(s)),u=N.truncDivision(r,s),d=Ne.bitsToWords(n,s,u);a.encode(d,u-o);let h=r%s,g=new G;g.appendBits(0,h);for(const x of Array.from(d))g.appendBits(x,s);return g}static bitsToWords(n,r,s){let o=new Int32Array(s),a,u;for(a=0,u=n.getSize()/r;a<u;a++){let d=0;for(let h=0;h<r;h++)d|=n.get(a*r+h)?1<<r-h-1:0;o[a]=d}return o}static getGF(n){switch(n){case 4:return be.AZTEC_PARAM;case 6:return be.AZTEC_DATA_6;case 8:return be.AZTEC_DATA_8;case 10:return be.AZTEC_DATA_10;case 12:return be.AZTEC_DATA_12;default:throw new v("Unsupported word size "+n)}}static stuffBits(n,r){let s=new G,o=n.getSize(),a=(1<<r)-2;for(let u=0;u<o;u+=r){let d=0;for(let h=0;h<r;h++)(u+h>=o||n.get(u+h))&&(d|=1<<r-1-h);(d&a)===a?(s.appendBits(d&a,r),u--):d&a?s.appendBits(d,r):(s.appendBits(d|1,r),u--)}return s}static totalBitsInLayer(n,r){return((r?88:112)+16*n)*n}}Ne.DEFAULT_EC_PERCENT=33,Ne.DEFAULT_AZTEC_LAYERS=0,Ne.MAX_NB_BITS=32,Ne.MAX_NB_BITS_COMPACT=4,Ne.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 mo{encode(n,r,s,o){return this.encodeWithHints(n,r,s,o,null)}encodeWithHints(n,r,s,o,a){let u=sl.ISO_8859_1,d=Ne.DEFAULT_EC_PERCENT,h=Ne.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(ht.CHARACTER_SET)&&(u=c1.forName(a.get(ht.CHARACTER_SET).toString())),a.has(ht.ERROR_CORRECTION)&&(d=N.parseInt(a.get(ht.ERROR_CORRECTION).toString())),a.has(ht.AZTEC_LAYERS)&&(h=N.parseInt(a.get(ht.AZTEC_LAYERS).toString()))),mo.encodeLayers(n,r,s,o,u,d,h)}static encodeLayers(n,r,s,o,a,u,d){if(r!==le.AZTEC)throw new v("Can only encode AZTEC, but got "+r);let h=Ne.encode(ie.getBytes(n,a),u,d);return mo.renderResult(h,s,o)}static renderResult(n,r,s){let o=n.getMatrix();if(o==null)throw new Dn;let a=o.getWidth(),u=o.getHeight(),d=Math.max(r,a),h=Math.max(s,u),g=Math.min(d/a,h/u),x=(d-a*g)/2,E=(h-u*g)/2,A=new _e(d,h);for(let I=0,b=E;I<u;I++,b+=g)for(let D=0,L=x;D<a;D++,L+=g)o.get(D,I)&&A.setRegion(L,b,g,g);return A}}i.AbstractExpandedDecoder=Ya,i.ArgumentException=_,i.ArithmeticException=io,i.AztecCode=f1,i.AztecCodeReader=ao,i.AztecCodeWriter=mo,i.AztecDecoder=Ue,i.AztecDetector=qc,i.AztecDetectorResult=Kc,i.AztecEncoder=Ne,i.AztecHighLevelEncoder=as,i.AztecPoint=Lt,i.BarcodeFormat=le,i.Binarizer=P,i.BinaryBitmap=R,i.BitArray=G,i.BitMatrix=_e,i.BitSource=qa,i.BrowserAztecCodeReader=Rh,i.BrowserBarcodeReader=kh,i.BrowserCodeReader=cn,i.BrowserDatamatrixCodeReader=Bh,i.BrowserMultiFormatReader=Yh,i.BrowserPDF417Reader=Zh,i.BrowserQRCodeReader=Kh,i.BrowserQRCodeSvgWriter=Wr,i.CharacterSetECI=V,i.ChecksumException=M,i.Code128Reader=J,i.Code39Reader=ft,i.DataMatrixDecodedBitStreamParser=ar,i.DataMatrixReader=lr,i.DecodeHintType=U,i.DecoderResult=Qi,i.DefaultGridSampler=Qc,i.DetectorResult=oo,i.EAN13Reader=Pr,i.EncodeHintType=ht,i.Exception=m,i.FormatException=k,i.GenericGF=be,i.GenericGFPoly=Ht,i.GlobalHistogramBinarizer=tt,i.GridSampler=Ha,i.GridSamplerInstance=sr,i.HTMLCanvasElementLuminanceSource=pe,i.HybridBinarizer=xe,i.ITFReader=Be,i.IllegalArgumentException=v,i.IllegalStateException=Dn,i.InvertedLuminanceSource=de,i.LuminanceSource=ee,i.MathUtils=Te,i.MultiFormatOneDReader=ai,i.MultiFormatReader=u1,i.MultiFormatWriter=qh,i.NotFoundException=j,i.OneDReader=ut,i.PDF417DecodedBitStreamParser=W,i.PDF417DecoderErrorCorrection=r1,i.PDF417Reader=It,i.PDF417ResultMetadata=s1,i.PerspectiveTransform=Cn,i.PlanarYUVLuminanceSource=Bn,i.QRCodeByteMatrix=po,i.QRCodeDataMask=dn,i.QRCodeDecodedBitStreamParser=Qe,i.QRCodeDecoderErrorCorrectionLevel=We,i.QRCodeDecoderFormatInformation=Ot,i.QRCodeEncoder=Ve,i.QRCodeEncoderQRCode=Ur,i.QRCodeMaskUtil=it,i.QRCodeMatrixUtil=fe,i.QRCodeMode=ce,i.QRCodeReader=ur,i.QRCodeVersion=ue,i.QRCodeWriter=ui,i.RGBLuminanceSource=il,i.RSS14Reader=rt,i.RSSExpandedReader=Y,i.ReaderException=go,i.ReedSolomonDecoder=$i,i.ReedSolomonEncoder=rl,i.ReedSolomonException=ri,i.Result=Ke,i.ResultMetadataType=mt,i.ResultPoint=oe,i.StringUtils=ie,i.UnsupportedOperationException=se,i.VideoInputDevice=Ge,i.WhiteRectangleDetector=Gn,i.WriterException=Le,i.ZXingArrays=T,i.ZXingCharset=c1,i.ZXingInteger=N,i.ZXingStandardCharsets=sl,i.ZXingStringBuilder=ge,i.ZXingStringEncoding=Ee,i.ZXingSystem=B,i.createAbstractExpandedDecoder=t1,Object.defineProperty(i,"__esModule",{value:!0})})})(Lu,Lu.exports);var qe=Lu.exports;const Am=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var L0=function(){function e(t,i,l){if(this.formatMap=new Map([[te.QR_CODE,qe.BarcodeFormat.QR_CODE],[te.AZTEC,qe.BarcodeFormat.AZTEC],[te.CODABAR,qe.BarcodeFormat.CODABAR],[te.CODE_39,qe.BarcodeFormat.CODE_39],[te.CODE_93,qe.BarcodeFormat.CODE_93],[te.CODE_128,qe.BarcodeFormat.CODE_128],[te.DATA_MATRIX,qe.BarcodeFormat.DATA_MATRIX],[te.MAXICODE,qe.BarcodeFormat.MAXICODE],[te.ITF,qe.BarcodeFormat.ITF],[te.EAN_13,qe.BarcodeFormat.EAN_13],[te.EAN_8,qe.BarcodeFormat.EAN_8],[te.PDF_417,qe.BarcodeFormat.PDF_417],[te.RSS_14,qe.BarcodeFormat.RSS_14],[te.RSS_EXPANDED,qe.BarcodeFormat.RSS_EXPANDED],[te.UPC_A,qe.BarcodeFormat.UPC_A],[te.UPC_E,qe.BarcodeFormat.UPC_E],[te.UPC_EAN_EXTENSION,qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Am)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=l;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 i=this;return new Promise(function(l,c){try{l(i.decode(t))}catch(f){c(f)}})},e.prototype.decode=function(t){var i=new qe.MultiFormatReader(this.verbose,this.hints),l=new qe.HTMLCanvasElementLuminanceSource(t),c=new qe.BinaryBitmap(new qe.HybridBinarizer(l)),f=i.decode(c);return{text:f.text,format:vh.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(i,l,c){t.set(i,l)}),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 i=[],l=0,c=t;l<c.length;l++){var f=c[l];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return i},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),vm=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},Sm=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},F0=function(){function e(t,i,l){if(this.formatMap=new Map([[te.QR_CODE,"qr_code"],[te.AZTEC,"aztec"],[te.CODABAR,"codabar"],[te.CODE_39,"code_39"],[te.CODE_93,"code_93"],[te.CODE_128,"code_128"],[te.DATA_MATRIX,"data_matrix"],[te.ITF,"itf"],[te.EAN_13,"ean_13"],[te.EAN_8,"ean_8"],[te.PDF_417,"pdf417"],[te.UPC_A,"upc_a"],[te.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=i,this.logger=l;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 vm(this,void 0,void 0,function(){var i,l;return Sm(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(i=c.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return l=this.selectLargestBarcode(i),[2,{text:l.rawValue,format:vh.create(this.toHtml5QrcodeSupportedFormats(l.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var i=null,l=0,c=0,f=t;c<f.length;c++){var p=f[c],w=p.boundingBox.width*p.boundingBox.height;w>l&&(l=w,i=p)}if(!i)throw"No largest barcode found";return i},e.prototype.createBarcodeDetectorFormats=function(t){for(var i=[],l=0,c=t;l<c.length;l++){var f=c[l];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},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(i,l,c){t.set(i,l)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),U0=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},W0=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Im=function(){function e(t,i,l,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=l,i&&F0.isSupported()?(this.primaryDecoder=new F0(t,l,c),this.secondaryDecoder=new L0(t,l,c)):this.primaryDecoder=new L0(t,l,c)}return e.prototype.decodeAsync=function(t){return U0(this,void 0,void 0,function(){var i;return W0(this,function(l){switch(l.label){case 0:i=performance.now(),l.label=1;case 1:return l.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,l.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return U0(this,void 0,void 0,function(){var i,l;return W0(this,function(c){switch(c.label){case 0:i=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(l=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw l;case 4:return this.possiblyLogPerformance(i),[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 i=performance.now()-t;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,i=0,l=this.executionResults;i<l.length;i++){var c=l[i];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}(),Xc=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(l[f]=c[f])},e(t,i)};return function(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(t,i);function l(){this.constructor=t}t.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),Aa=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},va=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Ih=function(){function e(t,i){this.name=t,this.track=i}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var i={};i[this.name]=t;var l={advanced:[i]};return this.track.applyConstraints(l)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var i=t[this.name];return i}return null},e}(),_m=function(e){Xc(t,e);function t(i,l){return e.call(this,i,l)||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(i){var l={};l[this.name]=i;var c={advanced:[l]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),l=i[this.name];return{min:l.min,max:l.max,step:l.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Ih),Tm=function(e){Xc(t,e);function t(i){return e.call(this,"zoom",i)||this}return t}(_m),Nm=function(e){Xc(t,e);function t(i){return e.call(this,"torch",i)||this}return t}(Ih),Rm=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new Tm(this.track)},e.prototype.torchFeature=function(){return new Nm(this.track)},e}(),bm=function(){function e(t,i,l){this.isClosed=!1,this.parentElement=t,this.mediaStream=i,this.callbacks=l,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var i=document.createElement("video");return i.style.width="".concat(t,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},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 i=function(){var l=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(l,c),t.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,i,l,c){return Aa(this,void 0,void 0,function(){var f,p;return va(this,function(w){switch(w.label){case 0:return f=new e(t,i,c),l.aspectRatio?(p={aspectRatio:l.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(p)]):[3,2];case 1:w.sent(),w.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 i=this,l=function(){setTimeout(t,200),i.surface.removeEventListener("playing",l)};this.surface.addEventListener("playing",l),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 Aa(this,void 0,void 0,function(){return va(this,function(i){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(i,l){var c=t.mediaStream.getVideoTracks(),f=c.length,p=0;t.mediaStream.getVideoTracks().forEach(function(w){t.mediaStream.removeTrack(w),w.stop(),++p,p>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),i())})})},e.prototype.getCapabilities=function(){return new Rm(this.getFirstTrackOrFail())},e}(),Om=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,i,l){return Aa(this,void 0,void 0,function(){return va(this,function(c){return[2,bm.create(t,this.mediaStream,i,l)]})})},e.create=function(t){return Aa(this,void 0,void 0,function(){var i,l;return va(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return l=c.sent(),[2,new e(l)]}})})},e}(),z0=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},V0=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Dm=function(){function e(){}return e.failIfNotSupported=function(){return z0(this,void 0,void 0,function(){return V0(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return z0(this,void 0,void 0,function(){return V0(this,function(i){return[2,Om.create(t)]})})},e}(),Mm=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},km=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Pm=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=Ri.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=Ri.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 Mm(this,void 0,void 0,function(){var t,i,l,c,f,p,w;return km(this,function(C){switch(C.label){case 0:return t=function(m){for(var _=m.getVideoTracks(),v=0,R=_;v<R.length;v++){var M=R[v];M.enabled=!1,M.stop(),m.removeTrack(M)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=C.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(l=C.sent(),c=[],f=0,p=l;f<p.length;f++)w=p[f],w.kind==="videoinput"&&c.push({id:w.deviceId,label:w.label});return t(i),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,i){var l=function(f){for(var p=[],w=0,C=f;w<C.length;w++){var m=C[w];m.kind==="video"&&p.push({id:m.id,label:m.label})}t(p)},c=MediaStreamTrack;c.getSources(l)})},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 Bm=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,i){for(var l=0,c=i;l<c.length;l++){var f=c[l];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),Lm=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}(),Fm=function(){function e(){}return e.create=function(){return new Lm(new Bm)},e}(),Um=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(l[f]=c[f])},e(t,i)};return function(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(t,i);function l(){this.constructor=t}t.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),nn=function(e){Um(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}(ym),Wm=function(){function e(t,i){this.logger=i,this.fps=nn.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=nn.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Sh.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!Xn(this.qrbox)},e.create=function(t,i){return new e(t,i)},e}(),aw=function(){function e(t,i){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 l;typeof i=="boolean"?this.verbose=i===!0:i&&(l=i,this.verbose=l.verbose===!0,l.experimentalFeatures),this.logger=new Cm(this.verbose),this.qrcode=new Im(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(l),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Fm.create()}return e.prototype.start=function(t,i,l,c){var f=this;if(!t)throw"cameraIdOrConfig is required";if(!l||typeof l!="function")throw"qrCodeSuccessCallback is required and should be a function.";var p;c?p=c:p=this.verbose?this.logger.log:function(){};var w=Wm.create(i,this.logger);this.clearElement();var C=!1;w.videoConstraints&&(w.isMediaStreamConstraintsValid()?C=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var m=C,_=document.getElementById(this.elementId);_.clientWidth?_.clientWidth:nn.DEFAULT_WIDTH,_.style.position="relative",this.shouldScan=!0,this.element=_;var v=this,R=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(M,P){var B=m?w.videoConstraints:v.createVideoConstraints(t);if(!B){R.cancel(),P("videoConstraints should be defined");return}var K={};(!m||w.aspectRatio)&&(K.aspectRatio=w.aspectRatio);var O={onRenderSurfaceReady:function(T,N){v.setupUi(T,N,w),v.isScanning=!0,v.foreverScan(w,l,p)}};Dm.failIfNotSupported().then(function(T){T.create(B).then(function(N){return N.render(f.element,K,O).then(function(G){v.renderedCamera=G,R.execute(),M(null)}).catch(function(G){R.cancel(),P(G)})}).catch(function(N){R.cancel(),P(Ri.errorGettingUserMedia(N))})}).catch(function(T){R.cancel(),P(Ri.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(Xn(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,i=function(){t.stateManagerProxy.directTransition(st.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},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 i=this.stateManagerProxy.startTransition(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var l=function(){if(t.element){var f=document.getElementById(nn.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),l(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),i.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,i){return this.scanFileV2(t,i).then(function(l){return l.decodedText})},e.prototype.scanFileV2=function(t,i){var l=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Xn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){l.possiblyCloseLastScanImageFile(),l.clearElement(),l.lastScanImageFile=URL.createObjectURL(t);var p=new Image;p.onload=function(){var w=p.width,C=p.height,m=document.getElementById(l.elementId),_=m.clientWidth?m.clientWidth:nn.DEFAULT_WIDTH,v=Math.max(m.clientHeight?m.clientHeight:C,nn.FILE_SCAN_MIN_HEIGHT),R=l.computeCanvasDrawConfig(w,C,_,v);if(i){var M=l.createCanvasElement(_,v,"qr-canvas-visible");M.style.display="inline-block",m.appendChild(M);var P=M.getContext("2d");if(!P)throw"Unable to get 2d context from canvas";P.canvas.width=_,P.canvas.height=v,P.drawImage(p,0,0,w,C,R.x,R.y,R.width,R.height)}var B=nn.FILE_SCAN_HIDDEN_CANVAS_PADDING,K=Math.max(p.width,R.width),O=Math.max(p.height,R.height),T=K+2*B,N=O+2*B,G=l.createCanvasElement(T,N);m.appendChild(G);var H=G.getContext("2d");if(!H)throw"Unable to get 2d context from canvas";H.canvas.width=T,H.canvas.height=N,H.drawImage(p,0,0,w,C,B,B,K,O);try{l.qrcode.decodeRobustlyAsync(G).then(function(U){c(B0.createFromQrcodeResult(U))}).catch(f)}catch(U){f("QR code parse error, error = ".concat(U))}},p.onerror=f,p.onabort=f,p.onstalled=f,p.onsuspend=f,p.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Pm.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(!Sh.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 i=[te.QR_CODE,te.AZTEC,te.CODABAR,te.CODE_39,te.CODE_93,te.CODE_128,te.DATA_MATRIX,te.MAXICODE,te.ITF,te.EAN_13,te.EAN_8,te.PDF_417,te.RSS_14,te.RSS_EXPANDED,te.UPC_A,te.UPC_E,te.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return i;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 l=[],c=0,f=t.formatsToSupport;c<f.length;c++){var p=f[c];wm(p)?l.push(p):this.logger.warn("Invalid format: ".concat(p," passed in config, ignoring."))}if(l.length===0)throw"None of formatsToSupport match supported values.";return l},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(Xn(t))return!0;if(!Xn(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(Xn(t.experimentalFeatures))return!0;var i=t.experimentalFeatures;return Xn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,i,l){var c=this,f=l.qrbox;this.validateQrboxConfig(f);var p=this.toQrdimensions(t,i,f),w=function(m){if(m<nn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(nn.MIN_QR_BOX_SIZE,"px.")},C=function(m){return m>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),m=t),m};w(p.width),w(p.height),p.width=C(p.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,i,l){if(typeof l=="number")return{width:l,height:l};if(typeof l=="function")try{return l(t,i)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return l},e.prototype.setupUi=function(t,i,l){l.isShadedBoxEnabled()&&this.validateQrboxSize(t,i,l);var c=Xn(l.qrbox)?{width:t,height:i}:l.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,i,c);f.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var p=l.isShadedBoxEnabled()&&f.height<=i,w={x:0,y:0,width:t,height:i},C=p?this.getShadedRegionBounds(t,i,f):w,m=this.createCanvasElement(C.width,C.height),_={willReadFrequently:!0},v=m.getContext("2d",_);v.canvas.width=C.width,v.canvas.height=C.height,this.element.append(m),p&&this.possiblyInsertShadingElement(this.element,t,i,f),this.createScannerPausedUiElement(this.element),this.qrRegion=C,this.context=v,this.canvasElement=m},e.prototype.createScannerPausedUiElement=function(t){var i=document.createElement("div");i.innerText=Ri.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",t.appendChild(i),this.scannerPausedUiElement=i},e.prototype.scanContext=function(t,i){var l=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,B0.createFromQrcodeResult(c)),l.possiblyUpdateShaders(!0),!0}).catch(function(c){l.possiblyUpdateShaders(!1);var f=Ri.codeParseError(c);return i(f,Em.createFrom(f)),!1})},e.prototype.foreverScan=function(t,i,l){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),p=f.videoWidth/f.clientWidth,w=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var C=this.qrRegion.width*p,m=this.qrRegion.height*w,_=this.qrRegion.x*p,v=this.qrRegion.y*w;this.context.drawImage(f,_,v,C,m,0,0,this.qrRegion.width,this.qrRegion.height);var R=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,i,l)},c.getTimeoutFps(t.fps))};this.scanContext(i,l).then(function(M){!M&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(i,l).finally(function(){R()})):R()}).catch(function(M){c.logger.logError("Error happend while scanning context",M),R()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var i="facingMode",l="deviceId",c={user:!0,environment:!0},f="exact",p=function(P){if(P in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(P,"'")},w=Object.keys(t);if(w.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(w.length," keys");var C=Object.keys(t)[0];if(C!==i&&C!==l)throw"Only '".concat(i,"' and '").concat(l,"' ")+" are supported for 'cameraIdOrConfig'";if(C===i){var m=t.facingMode;if(typeof m=="string"){if(p(m))return{facingMode:m}}else if(typeof m=="object")if(f in m){if(p(m["".concat(f)]))return{facingMode:{exact:m["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var _=typeof m;throw"Invalid type of 'facingMode' = ".concat(_)}}else{var v=t.deviceId;if(typeof v=="string")return{deviceId:v};if(typeof v=="object"){if(f in v)return{deviceId:{exact:v["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var R=typeof v;throw"Invalid type of 'deviceId' = ".concat(R)}}}var M=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(M)},e.prototype.computeCanvasDrawConfig=function(t,i,l,c){if(t<=l&&i<=c){var f=(l-t)/2,p=(c-i)/2;return{x:f,y:p,width:t,height:i}}else{var w=t,C=i;return t>l&&(i=l/t*i,t=l),i>c&&(t=c/i*t,i=c),this.logger.log("Image downsampled from "+"".concat(w,"X").concat(C)+" to ".concat(t,"X").concat(i,".")),this.computeCanvasDrawConfig(t,i,l,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(i){i.style.backgroundColor=t?nn.BORDER_SHADER_MATCH_COLOR:nn.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,i,l){var c=t,f=i,p=document.createElement("canvas");return p.style.width="".concat(c,"px"),p.style.height="".concat(f,"px"),p.style.display="none",p.id=Xn(l)?"qr-canvas":l,p},e.prototype.getShadedRegionBounds=function(t,i,l){if(l.width>t||l.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-l.width)/2,y:(i-l.height)/2,width:l.width,height:l.height}},e.prototype.possiblyInsertShadingElement=function(t,i,l,c){if(!(i-c.width<1||l-c.height<1)){var f=document.createElement("div");f.style.position="absolute";var p=(i-c.width)/2,w=(l-c.height)/2;if(f.style.borderLeft="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(w,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(w,"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(nn.SHADED_REGION_ELEMENT_ID),i-c.width<11||l-c.height<11)this.hasBorderShaders=!1;else{var C=5,m=40;this.insertShaderBorders(f,m,C,-C,null,0,!0),this.insertShaderBorders(f,m,C,-C,null,0,!1),this.insertShaderBorders(f,m,C,null,-C,0,!0),this.insertShaderBorders(f,m,C,null,-C,0,!1),this.insertShaderBorders(f,C,m+C,-C,null,-C,!0),this.insertShaderBorders(f,C,m+C,null,-C,-C,!0),this.insertShaderBorders(f,C,m+C,-C,null,-C,!1),this.insertShaderBorders(f,C,m+C,null,-C,-C,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,i,l,c,f,p,w){var C=document.createElement("div");C.style.position="absolute",C.style.backgroundColor=nn.BORDER_SHADER_DEFAULT_COLOR,C.style.width="".concat(i,"px"),C.style.height="".concat(l,"px"),c!==null&&(C.style.top="".concat(c,"px")),f!==null&&(C.style.bottom="".concat(f,"px")),w?C.style.left="".concat(p,"px"):C.style.right="".concat(p,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(C),t.appendChild(C)},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}(),H0;(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"})(H0||(H0={}));var Fu;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(Fu||(Fu={}));var Uu;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(Uu||(Uu={}));var Wu;(function(e){e[e.ALL=17]="ALL"})(Wu||(Wu={}));const zm=Object.assign(Object.assign({},te),Wu);var j0;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(j0||(j0={}));const Vm=[{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 Hm(e){const t="custom-style-os-cap-barcode";let i=document.getElementById(t);if(i||(i=document.createElement("style"),i.type="text/css",i.id=t,document.head.appendChild(i)),i.sheet){for(;i.sheet.cssRules.length;)i.sheet.deleteRule(0);for(const{selector:l,css:c}of e)i.sheet.insertRule(`${l} { ${c} }`)}else{i.textContent="";for(const{selector:l,css:c}of e)i.textContent+=`${l} { ${c} }`}}const jm=Va("CapacitorBarcodeScanner",{web:()=>(Hm(Vm),qu(()=>import("./web-ueoOhAeL.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class Gm{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||Fu.BACK,t.scanOrientation=t.scanOrientation||Uu.ADAPTIVE,jm.scanBarcode(t)}}const zl=Va("SecureStoragePlugin",{web:()=>qu(()=>import("./web-DWyw2SAG.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function Xm(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=br.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 i=new URL(t.server);if(i.username||i.password||i.search||i.hash||i.pathname!=="/")throw new Error;const l=br.parse(t.server);if(!l)throw new Error;return{endpoint:l,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class Ym{ready(){if(!$s.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await zl.get({key:`agentroam-device:${t}`})).value}catch(i){if(String(i).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,i){this.ready(),await zl.set({key:`agentroam-device:${t}`,value:i})}async remove(t){this.ready();try{await zl.remove({key:`agentroam-device:${t}`})}catch(i){if(!String(i).includes("does not exist"))throw i}}}async function Zm(){if(!$s.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await Gm.scanBarcode({hint:zm.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class Km{constructor(t,i=(...c)=>fetch(...c),l=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=i,this.onRevoked=l,this.session=null,this.fetch=async(c,f={})=>{const p=this.session,w=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),C=new Headers(f.headers??(c instanceof Request?c.headers:void 0));p&&w.origin===p.origin&&C.set("authorization",`Bearer ${p.token}`);const m=await this.transport(c,{...f,headers:C,credentials:"omit",redirect:"error"});if(p&&this.session===p&&w.origin===p.origin&&(m.status===401||m.status===423)){this.session=null;try{await this.storage.remove(p.origin)}finally{this.onRevoked()}}return m}}async resume(t){const i=await this.storage.get(t.url);this.session=i?{origin:t.url,token:i}:null}async pair(t){const{endpoint:i,grant:l}=Xm(t),c=await this.transport(i.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:l,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(i.url,f.token)}catch{throw await this.transport(i.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:i.url,token:f.token},i}async checkAuthorization(){const t=this.session;if(!t)return;const i=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!i.ok)return;const l=await i.json();if(this.session===t&&(l.locked||l.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}class Vl extends Error{constructor(t,i){super(t),this.name="ParseError",this.type=i.type,this.field=i.field,this.value=i.value,this.line=i.line}}const G0=10,Qm=13,zr=32;function Hl(e){}function qm(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=Hl,onError:i=Hl,onRetry:l=Hl,onComment:c,maxBufferSize:f}=e,p=[];let w=0,C=!0,m,_="",v=0,R,M=!1;function P(H){if(M)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(C&&(C=!1,H.charCodeAt(0)===239&&H.charCodeAt(1)===187&&H.charCodeAt(2)===191&&(H=H.slice(3))),p.length===0){const X=K(H);X!==""&&(p.push(X),w=X.length),B();return}if(H.indexOf(`
79
- `)===-1&&H.indexOf("\r")===-1){p.push(H),w+=H.length,B();return}p.push(H);const U=p.join("");p.length=0,w=0;const k=K(U);k!==""&&(p.push(k),w=k.length),B()}function B(){f!==void 0&&(w+_.length<=f||(M=!0,p.length=0,w=0,m=void 0,_="",v=0,R=void 0,i(new Vl(`Buffered data exceeded max buffer size of ${f} characters`,{type:"max-buffer-size-exceeded"}))))}function K(H){let U=0;if(H.indexOf("\r")===-1){let k=H.indexOf(`
80
- `,U);for(;k!==-1;){if(U===k){v>0&&t({id:m,event:R,data:_}),m=void 0,_="",v=0,R=void 0,U=k+1,k=H.indexOf(`
81
- `,U);continue}const X=H.charCodeAt(U);if(X0(H,U,X)){const V=H.charCodeAt(U+5)===zr?U+6:U+5,se=H.slice(V,k);if(v===0&&H.charCodeAt(k+1)===G0){t({id:m,event:R,data:se}),m=void 0,_="",R=void 0,U=k+2,k=H.indexOf(`
82
- `,U);continue}_=v===0?se:`${_}
83
- ${se}`,v++}else Y0(H,U,X)?R=H.slice(H.charCodeAt(U+6)===zr?U+7:U+6,k)||void 0:O(H,U,k);U=k+1,k=H.indexOf(`
84
- `,U)}return H.slice(U)}for(;U<H.length;){const k=H.indexOf("\r",U),X=H.indexOf(`
85
- `,U);let V=-1;if(k!==-1&&X!==-1?V=k<X?k:X:k!==-1?k===H.length-1?V=-1:V=k:X!==-1&&(V=X),V===-1)break;O(H,U,V),U=V+1,H.charCodeAt(U-1)===Qm&&H.charCodeAt(U)===G0&&U++}return H.slice(U)}function O(H,U,k){if(U===k){N();return}const X=H.charCodeAt(U);if(X0(H,U,X)){const _e=H.charCodeAt(U+5)===zr?U+6:U+5,j=H.slice(_e,k);_=v===0?j:`${_}
86
- ${j}`,v++;return}if(Y0(H,U,X)){R=H.slice(H.charCodeAt(U+6)===zr?U+7:U+6,k)||void 0;return}if(X===105&&H.charCodeAt(U+1)===100&&H.charCodeAt(U+2)===58){const _e=H.slice(H.charCodeAt(U+3)===zr?U+4:U+3,k);_e.includes("\0")||(m=_e);return}if(X===58){if(c){const _e=H.slice(U,k);c(_e.slice(H.charCodeAt(U+1)===zr?2:1))}return}const V=H.slice(U,k),se=V.indexOf(":");if(se===-1){T(V,"",V);return}const Ee=V.slice(0,se),ie=V.charCodeAt(se+1)===zr?2:1,ge=V.slice(se+ie);T(Ee,ge,V)}function T(H,U,k){switch(H){case"event":R=U||void 0;break;case"data":_=v===0?U:`${_}
87
- ${U}`,v++;break;case"id":U.includes("\0")||(m=U);break;case"retry":/^\d+$/.test(U)?l(parseInt(U,10)):i(new Vl(`Invalid \`retry\` value: "${U}"`,{type:"invalid-retry",value:U,line:k}));break;default:i(new Vl(`Unknown field "${H.length>20?`${H.slice(0,20)}…`:H}"`,{type:"unknown-field",field:H,value:U,line:k}));break}}function N(){v>0&&t({id:m,event:R,data:_}),m=void 0,_="",v=0,R=void 0}function G(H={}){if(H.consume&&p.length>0){const U=p.join("");O(U,0,U.length)}C=!0,m=void 0,_="",v=0,R=void 0,p.length=0,w=0,M=!1}return{feed:P,reset:G}}function X0(e,t,i){return i===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Y0(e,t,i){return i===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 Z0 extends Event{constructor(t,i){var l,c;super(t),this.code=(l=i==null?void 0:i.code)!=null?l:void 0,this.message=(c=i==null?void 0:i.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,i,l){return l(K0(this),i)}[Symbol.for("Deno.customInspect")](t,i){return t(K0(this),i)}}function $m(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function zu(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(zu).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${zu(e.cause)}`:e.message:`${e}`}function K0(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var _h=e=>{throw TypeError(e)},Yc=(e,t,i)=>t.has(e)||_h("Cannot "+i),Ce=(e,t,i)=>(Yc(e,t,"read from private field"),i?i.call(e):t.get(e)),gt=(e,t,i)=>t.has(e)?_h("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Ye=(e,t,i,l)=>(Yc(e,t,"write to private field"),t.set(e,i),i),Yn=(e,t,i)=>(Yc(e,t,"access private method"),i),Kt,jr,gi,Ko,Sa,Ds,bi,Ms,mr,pi,Li,xi,Cs,In,Vu,Hu,ju,Q0,Gu,Xu,As,Yu,Zu;let Qo=class extends EventTarget{constructor(t,i){var l,c;super(),gt(this,In),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,gt(this,Kt),gt(this,jr),gt(this,gi),gt(this,Ko),gt(this,Sa),gt(this,Ds),gt(this,bi),gt(this,Ms,null),gt(this,mr),gt(this,pi),gt(this,Li,null),gt(this,xi,null),gt(this,Cs,null),gt(this,Hu,async f=>{var p;Ce(this,pi).reset();const{body:w,redirected:C,status:m,headers:_}=f;if(m===204){Yn(this,In,As).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(C?Ye(this,gi,new URL(f.url)):Ye(this,gi,void 0),m!==200){Yn(this,In,As).call(this,`Non-200 status code (${m})`,m);return}if(!(_.get("content-type")||"").startsWith("text/event-stream")){Yn(this,In,As).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(Ce(this,Kt)===this.CLOSED)return;Ye(this,Kt,this.OPEN);const v=new Event("open");if((p=Ce(this,Cs))==null||p.call(this,v),this.dispatchEvent(v),typeof w!="object"||!w||!("getReader"in w)){Yn(this,In,As).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const R=new TextDecoder,M=w.getReader();let P=!0;do{const{done:B,value:K}=await M.read();K&&Ce(this,pi).feed(R.decode(K,{stream:!B})),B&&(P=!1,Ce(this,pi).reset(),Yn(this,In,Yu).call(this))}while(P)}),gt(this,ju,f=>{Ye(this,mr,void 0),!(f.name==="AbortError"||f.type==="aborted")&&Yn(this,In,Yu).call(this,zu(f))}),gt(this,Gu,f=>{typeof f.id=="string"&&Ye(this,Ms,f.id);const p=new MessageEvent(f.event||"message",{data:f.data,origin:Ce(this,gi)?Ce(this,gi).origin:Ce(this,jr).origin,lastEventId:f.id||""});Ce(this,xi)&&(!f.event||f.event==="message")&&Ce(this,xi).call(this,p),this.dispatchEvent(p)}),gt(this,Xu,f=>{Ye(this,Ds,f)}),gt(this,Zu,()=>{Ye(this,bi,void 0),Ce(this,Kt)===this.CONNECTING&&Yn(this,In,Vu).call(this)});try{if(t instanceof URL)Ye(this,jr,t);else if(typeof t=="string")Ye(this,jr,new URL(t,Jm()));else throw new Error("Invalid URL")}catch{throw $m("An invalid or illegal string was specified")}Ye(this,pi,qm({onEvent:Ce(this,Gu),onRetry:Ce(this,Xu)})),Ye(this,Kt,this.CONNECTING),Ye(this,Ds,3e3),Ye(this,Sa,(l=i==null?void 0:i.fetch)!=null?l:globalThis.fetch),Ye(this,Ko,(c=i==null?void 0:i.withCredentials)!=null?c:!1),Yn(this,In,Vu).call(this)}get readyState(){return Ce(this,Kt)}get url(){return Ce(this,jr).href}get withCredentials(){return Ce(this,Ko)}get onerror(){return Ce(this,Li)}set onerror(t){Ye(this,Li,t)}get onmessage(){return Ce(this,xi)}set onmessage(t){Ye(this,xi,t)}get onopen(){return Ce(this,Cs)}set onopen(t){Ye(this,Cs,t)}addEventListener(t,i,l){const c=i;super.addEventListener(t,c,l)}removeEventListener(t,i,l){const c=i;super.removeEventListener(t,c,l)}close(){Ce(this,bi)&&clearTimeout(Ce(this,bi)),Ce(this,Kt)!==this.CLOSED&&(Ce(this,mr)&&Ce(this,mr).abort(),Ye(this,Kt,this.CLOSED),Ye(this,mr,void 0))}};Kt=new WeakMap,jr=new WeakMap,gi=new WeakMap,Ko=new WeakMap,Sa=new WeakMap,Ds=new WeakMap,bi=new WeakMap,Ms=new WeakMap,mr=new WeakMap,pi=new WeakMap,Li=new WeakMap,xi=new WeakMap,Cs=new WeakMap,In=new WeakSet,Vu=function(){Ye(this,Kt,this.CONNECTING),Ye(this,mr,new AbortController),Ce(this,Sa)(Ce(this,jr),Yn(this,In,Q0).call(this)).then(Ce(this,Hu)).catch(Ce(this,ju))},Hu=new WeakMap,ju=new WeakMap,Q0=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ce(this,Ms)?{"Last-Event-ID":Ce(this,Ms)}:void 0},cache:"no-store",signal:(e=Ce(this,mr))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Gu=new WeakMap,Xu=new WeakMap,As=function(e,t){var i;Ce(this,Kt)!==this.CLOSED&&Ye(this,Kt,this.CLOSED);const l=new Z0("error",{code:t,message:e});(i=Ce(this,Li))==null||i.call(this,l),this.dispatchEvent(l)},Yu=function(e,t){var i;if(Ce(this,Kt)===this.CLOSED)return;Ye(this,Kt,this.CONNECTING);const l=new Z0("error",{code:t,message:e});(i=Ce(this,Li))==null||i.call(this,l),this.dispatchEvent(l),Ye(this,bi,setTimeout(Ce(this,Zu),Ce(this,Ds)))},Zu=new WeakMap,Qo.CONNECTING=0,Qo.OPEN=1,Qo.CLOSED=2;function Jm(){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}Yp();qp();Lx();Wx();document.body.dataset.webShell="1";const Zc=new im;if(!Zc.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 i=document.createElement("script");i.src="/pwa/install.js",document.head.append(i)}const Pt=Zc.isNativeApp()?new Km(new Ym):null,Th=new Up(Pt==null?void 0:Pt.fetch),ew=window.parent===window?void 0:new Yx,tw=window.parent===window?void 0:new nm;let Ku="";const q0=new Hp(Th,new jp,ew,e=>Pt?new Qo(Ku+e,{fetch:Pt.fetch}):new EventSource(Ku+e));window.browserLiveApi=tw;const Nh=document.getElementById("root");if(!Nh)throw new Error("#root missing");const Qu=hh(Nh);function nw(){return Ct.useEffect(()=>{Vx()},[]),null}(async()=>{Pt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new rm(Zc,new O0,new om(Pt?async(i,l)=>{const c=br.parse(String(i));return c&&await Pt.resume(c),Pt.fetch(i,l)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){Qu.render(ae.jsx(lm,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Pt?async()=>{const i=await Zm();if(!i)return null;const l=await Pt.pair(i);return new O0().save(l),l}:void 0,onConnected:i=>void $0(i)}));return}await $0(t.mode==="ready"?t.endpoint:null)})();async function $0(e){try{e&&(await(Pt==null?void 0:Pt.resume(e)),Th.setBaseUrl(e.url),Ku=e.url),window.agentApi=q0,await q0.refreshServerModel();const{default:t}=await qu(async()=>{const{default:i}=await import("./App-Cso_5v1O.js");return{default:i}},__vite__mapDeps([0,1]),import.meta.url);Qu.render(ae.jsxs(Ct.StrictMode,{children:[ae.jsx(bg.Provider,{value:ae.jsx(Og,{}),children:ae.jsx(t,{})}),ae.jsx(nw,{})]})),Pt&&setInterval(()=>{Pt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),rw())}catch(t){Qu.render(ae.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:ae.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[ae.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),ae.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),ae.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 rw(){const e=[...document.scripts].map(i=>i.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{try{const i=await fetch("/api/agent/model",{credentials:"same-origin",cache:"no-store"});if(i.status===401||i.status===423){location.reload();return}const c=((await i.json()).buildId||"").replace(/^index-|\.js$/g,"");c&&c!==t&&location.reload()}catch{}},6e4)}export{bg as B,Uu as C,aw as H,ow as L,Fx as O,vg as R,sw as S,Ah as W,qu as _,zm as a,Bp as b,ls as c,Sx as d,iw as e,J0 as g,Ox as i,ae as j,Ct as r,kx as u};
76
+ `),n.toString()}setMode(n){this.mode=n}setECLevel(n){this.ecLevel=n}setVersion(n){this.version=n}setMaskPattern(n){this.maskPattern=n}setMatrix(n){this.matrix=n}static isValidMaskPattern(n){return n>=0&&n<Ur.NUM_MASK_PATTERNS}}Ur.NUM_MASK_PATTERNS=8;class Le extends m{}Le.kind="WriterException";class fe{constructor(){}static clearMatrix(n){n.clear(255)}static buildMatrix(n,r,s,o,a){fe.clearMatrix(a),fe.embedBasicPatterns(s,a),fe.embedTypeInfo(r,o,a),fe.maybeEmbedVersionInfo(s,a),fe.embedDataBits(n,o,a)}static embedBasicPatterns(n,r){fe.embedPositionDetectionPatternsAndSeparators(r),fe.embedDarkDotAtLeftBottomCorner(r),fe.maybeEmbedPositionAdjustmentPatterns(n,r),fe.embedTimingPatterns(r)}static embedTypeInfo(n,r,s){const o=new G;fe.makeTypeInfoBits(n,r,o);for(let a=0,u=o.getSize();a<u;++a){const d=o.get(o.getSize()-1-a),h=fe.TYPE_INFO_COORDINATES[a],g=h[0],x=h[1];if(s.setBoolean(g,x,d),a<8){const E=s.getWidth()-a-1;s.setBoolean(E,8,d)}else{const A=s.getHeight()-7+(a-8);s.setBoolean(8,A,d)}}}static maybeEmbedVersionInfo(n,r){if(n.getVersionNumber()<7)return;const s=new G;fe.makeVersionInfoBits(n,s);let o=6*3-1;for(let a=0;a<6;++a)for(let u=0;u<3;++u){const d=s.get(o);o--,r.setBoolean(a,r.getHeight()-11+u,d),r.setBoolean(r.getHeight()-11+u,a,d)}}static embedDataBits(n,r,s){let o=0,a=-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 g=u-h;if(!fe.isEmpty(s.get(g,d)))continue;let x;o<n.getSize()?(x=n.get(o),++o):x=!1,r!==255&&it.getDataMaskBit(r,g,d)&&(x=!x),s.setBoolean(g,d,x)}d+=a}a=-a,d+=a,u-=2}if(o!==n.getSize())throw new Le("Not all bits consumed: "+o+"/"+n.getSize())}static findMSBSet(n){return 32-N.numberOfLeadingZeros(n)}static calculateBCHCode(n,r){if(r===0)throw new v("0 polynomial");const s=fe.findMSBSet(r);for(n<<=s-1;fe.findMSBSet(n)>=s;)n^=r<<fe.findMSBSet(n)-s;return n}static makeTypeInfoBits(n,r,s){if(!Ur.isValidMaskPattern(r))throw new Le("Invalid mask pattern");const o=n.getBits()<<3|r;s.appendBits(o,5);const a=fe.calculateBCHCode(o,fe.TYPE_INFO_POLY);s.appendBits(a,10);const u=new G;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(n,r){r.appendBits(n.getVersionNumber(),6);const s=fe.calculateBCHCode(n.getVersionNumber(),fe.VERSION_INFO_POLY);if(r.appendBits(s,12),r.getSize()!==18)throw new Le("should not happen but we got: "+r.getSize())}static isEmpty(n){return n===255}static embedTimingPatterns(n){for(let r=8;r<n.getWidth()-8;++r){const s=(r+1)%2;fe.isEmpty(n.get(r,6))&&n.setNumber(r,6,s),fe.isEmpty(n.get(6,r))&&n.setNumber(6,r,s)}}static embedDarkDotAtLeftBottomCorner(n){if(n.get(8,n.getHeight()-8)===0)throw new Le;n.setNumber(8,n.getHeight()-8,1)}static embedHorizontalSeparationPattern(n,r,s){for(let o=0;o<8;++o){if(!fe.isEmpty(s.get(n+o,r)))throw new Le;s.setNumber(n+o,r,0)}}static embedVerticalSeparationPattern(n,r,s){for(let o=0;o<7;++o){if(!fe.isEmpty(s.get(n,r+o)))throw new Le;s.setNumber(n,r+o,0)}}static embedPositionAdjustmentPattern(n,r,s){for(let o=0;o<5;++o){const a=fe.POSITION_ADJUSTMENT_PATTERN[o];for(let u=0;u<5;++u)s.setNumber(n+u,r+o,a[u])}}static embedPositionDetectionPattern(n,r,s){for(let o=0;o<7;++o){const a=fe.POSITION_DETECTION_PATTERN[o];for(let u=0;u<7;++u)s.setNumber(n+u,r+o,a[u])}}static embedPositionDetectionPatternsAndSeparators(n){const r=fe.POSITION_DETECTION_PATTERN[0].length;fe.embedPositionDetectionPattern(0,0,n),fe.embedPositionDetectionPattern(n.getWidth()-r,0,n),fe.embedPositionDetectionPattern(0,n.getWidth()-r,n);const s=8;fe.embedHorizontalSeparationPattern(0,s-1,n),fe.embedHorizontalSeparationPattern(n.getWidth()-s,s-1,n),fe.embedHorizontalSeparationPattern(0,n.getWidth()-s,n);const o=7;fe.embedVerticalSeparationPattern(o,0,n),fe.embedVerticalSeparationPattern(n.getHeight()-o-1,0,n),fe.embedVerticalSeparationPattern(o,n.getHeight()-o,n)}static maybeEmbedPositionAdjustmentPatterns(n,r){if(n.getVersionNumber()<2)return;const s=n.getVersionNumber()-1,o=fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let a=0,u=o.length;a!==u;a++){const d=o[a];if(d>=0)for(let h=0;h!==u;h++){const g=o[h];g>=0&&fe.isEmpty(r.get(g,d))&&fe.embedPositionAdjustmentPattern(g-2,d-2,r)}}}}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 qh{constructor(n,r){this.dataBytes=n,this.errorCorrectionBytes=r}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Ve{constructor(){}static calculateMaskPenalty(n){return it.applyMaskPenaltyRule1(n)+it.applyMaskPenaltyRule2(n)+it.applyMaskPenaltyRule3(n)+it.applyMaskPenaltyRule4(n)}static encode(n,r,s=null){let o=Ve.DEFAULT_BYTE_MODE_ENCODING;const a=s!==null&&s.get(gt.CHARACTER_SET)!==void 0;a&&(o=s.get(gt.CHARACTER_SET).toString());const u=this.chooseMode(n,o),d=new G;if(u===ce.BYTE&&(a||Ve.DEFAULT_BYTE_MODE_ENCODING!==o)){const $=V.getCharacterSetECIByName(o);$!==void 0&&this.appendECI($,d)}this.appendModeInfo(u,d);const h=new G;this.appendBytes(n,u,h,o);let g;if(s!==null&&s.get(gt.QR_VERSION)!==void 0){const $=Number.parseInt(s.get(gt.QR_VERSION).toString(),10);g=ue.getVersionForNumber($);const Z=this.calculateBitsNeeded(u,d,h,g);if(!this.willFit(Z,g,r))throw new Le("Data too big for requested version")}else g=this.recommendVersion(r,u,d,h);const x=new G;x.appendBitArray(d);const E=u===ce.BYTE?h.getSizeInBytes():n.length;this.appendLengthInfo(E,g,u,x),x.appendBitArray(h);const A=g.getECBlocksForLevel(r),I=g.getTotalCodewords()-A.getTotalECCodewords();this.terminateBits(I,x);const b=this.interleaveWithECBytes(x,g.getTotalCodewords(),I,A.getNumBlocks()),D=new Ur;D.setECLevel(r),D.setMode(u),D.setVersion(g);const L=g.getDimensionForVersion(),z=new po(L,L),q=this.chooseMaskPattern(b,r,g,z);return D.setMaskPattern(q),fe.buildMatrix(b,r,g,q,z),D.setMatrix(z),D}static recommendVersion(n,r,s,o){const a=this.calculateBitsNeeded(r,s,o,ue.getVersionForNumber(1)),u=this.chooseVersion(a,n),d=this.calculateBitsNeeded(r,s,o,u);return this.chooseVersion(d,n)}static calculateBitsNeeded(n,r,s,o){return r.getSize()+n.getCharacterCountBits(o)+s.getSize()}static getAlphanumericCode(n){return n<Ve.ALPHANUMERIC_TABLE.length?Ve.ALPHANUMERIC_TABLE[n]:-1}static chooseMode(n,r=null){if(V.SJIS.getName()===r&&this.isOnlyDoubleByteKanji(n))return ce.KANJI;let s=!1,o=!1;for(let a=0,u=n.length;a<u;++a){const d=n.charAt(a);if(Ve.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)o=!0;else return ce.BYTE}return o?ce.ALPHANUMERIC:s?ce.NUMERIC:ce.BYTE}static isOnlyDoubleByteKanji(n){let r;try{r=Ee.encode(n,V.SJIS)}catch{return!1}const s=r.length;if(s%2!==0)return!1;for(let o=0;o<s;o+=2){const a=r[o]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0}static chooseMaskPattern(n,r,s,o){let a=Number.MAX_SAFE_INTEGER,u=-1;for(let d=0;d<Ur.NUM_MASK_PATTERNS;d++){fe.buildMatrix(n,r,s,d,o);let h=this.calculateMaskPenalty(o);h<a&&(a=h,u=d)}return u}static chooseVersion(n,r){for(let s=1;s<=40;s++){const o=ue.getVersionForNumber(s);if(Ve.willFit(n,o,r))return o}throw new Le("Data too big")}static willFit(n,r,s){const o=r.getTotalCodewords(),u=r.getECBlocksForLevel(s).getTotalECCodewords(),d=o-u,h=(n+7)/8;return d>=h}static terminateBits(n,r){const s=n*8;if(r.getSize()>s)throw new Le("data bits cannot fit in the QR Code"+r.getSize()+" > "+s);for(let u=0;u<4&&r.getSize()<s;++u)r.appendBit(!1);const o=r.getSize()&7;if(o>0)for(let u=o;u<8;u++)r.appendBit(!1);const a=n-r.getSizeInBytes();for(let u=0;u<a;++u)r.appendBits(u&1?17:236,8);if(r.getSize()!==s)throw new Le("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(n,r,s,o,a,u){if(o>=s)throw new Le("Block ID too large");const d=n%s,h=s-d,g=Math.floor(n/s),x=g+1,E=Math.floor(r/s),A=E+1,I=g-E,b=x-A;if(I!==b)throw new Le("EC bytes mismatch");if(s!==h+d)throw new Le("RS blocks mismatch");if(n!==(E+I)*h+(A+b)*d)throw new Le("Total bytes mismatch");o<h?(a[0]=E,u[0]=I):(a[0]=A,u[0]=b)}static interleaveWithECBytes(n,r,s,o){if(n.getSizeInBytes()!==s)throw new Le("Number of bits and data bytes does not match");let a=0,u=0,d=0;const h=new Array;for(let x=0;x<o;++x){const E=new Int32Array(1),A=new Int32Array(1);Ve.getNumDataBytesAndNumECBytesForBlockID(r,s,o,x,E,A);const I=E[0],b=new Uint8Array(I);n.toBytes(8*a,b,0,I);const D=Ve.generateECBytes(b,A[0]);h.push(new qh(b,D)),u=Math.max(u,I),d=Math.max(d,D.length),a+=E[0]}if(s!==a)throw new Le("Data bytes does not match offset");const g=new G;for(let x=0;x<u;++x)for(const E of h){const A=E.getDataBytes();x<A.length&&g.appendBits(A[x],8)}for(let x=0;x<d;++x)for(const E of h){const A=E.getErrorCorrectionBytes();x<A.length&&g.appendBits(A[x],8)}if(r!==g.getSizeInBytes())throw new Le("Interleaving error: "+r+" and "+g.getSizeInBytes()+" differ.");return g}static generateECBytes(n,r){const s=n.length,o=new Int32Array(s+r);for(let u=0;u<s;u++)o[u]=n[u]&255;new rl(be.QR_CODE_FIELD_256).encode(o,r);const a=new Uint8Array(r);for(let u=0;u<r;u++)a[u]=o[s+u];return a}static appendModeInfo(n,r){r.appendBits(n.getBits(),4)}static appendLengthInfo(n,r,s,o){const a=s.getCharacterCountBits(r);if(n>=1<<a)throw new Le(n+" is bigger than "+((1<<a)-1));o.appendBits(n,a)}static appendBytes(n,r,s,o){switch(r){case ce.NUMERIC:Ve.appendNumericBytes(n,s);break;case ce.ALPHANUMERIC:Ve.appendAlphanumericBytes(n,s);break;case ce.BYTE:Ve.append8BitBytes(n,s,o);break;case ce.KANJI:Ve.appendKanjiBytes(n,s);break;default:throw new Le("Invalid mode: "+r)}}static getDigit(n){return n.charCodeAt(0)-48}static isDigit(n){const r=Ve.getDigit(n);return r>=0&&r<=9}static appendNumericBytes(n,r){const s=n.length;let o=0;for(;o<s;){const a=Ve.getDigit(n.charAt(o));if(o+2<s){const u=Ve.getDigit(n.charAt(o+1)),d=Ve.getDigit(n.charAt(o+2));r.appendBits(a*100+u*10+d,10),o+=3}else if(o+1<s){const u=Ve.getDigit(n.charAt(o+1));r.appendBits(a*10+u,7),o+=2}else r.appendBits(a,4),o++}}static appendAlphanumericBytes(n,r){const s=n.length;let o=0;for(;o<s;){const a=Ve.getAlphanumericCode(n.charCodeAt(o));if(a===-1)throw new Le;if(o+1<s){const u=Ve.getAlphanumericCode(n.charCodeAt(o+1));if(u===-1)throw new Le;r.appendBits(a*45+u,11),o+=2}else r.appendBits(a,6),o++}}static append8BitBytes(n,r,s){let o;try{o=Ee.encode(n,s)}catch(a){throw new Le(a)}for(let a=0,u=o.length;a!==u;a++){const d=o[a];r.appendBits(d,8)}}static appendKanjiBytes(n,r){let s;try{s=Ee.encode(n,V.SJIS)}catch(a){throw new Le(a)}const o=s.length;for(let a=0;a<o;a+=2){const u=s[a]&255,d=s[a+1]&255,h=u<<8&4294967295|d;let g=-1;if(h>=33088&&h<=40956?g=h-33088:h>=57408&&h<=60351&&(g=h-49472),g===-1)throw new Le("Invalid byte sequence");const x=(g>>8)*192+(g&255);r.appendBits(x,13)}}static appendECI(n,r){r.appendBits(ce.ECI.getBits(),4),r.appendBits(n.getValue(),8)}}Ve.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]),Ve.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class Wr{write(n,r,s,o=null){if(n.length===0)throw new v("Found empty contents");if(r<0||s<0)throw new v("Requested dimensions are too small: "+r+"x"+s);let a=We.L,u=Wr.QUIET_ZONE_SIZE;o!==null&&(o.get(gt.ERROR_CORRECTION)!==void 0&&(a=We.fromString(o.get(gt.ERROR_CORRECTION).toString())),o.get(gt.MARGIN)!==void 0&&(u=Number.parseInt(o.get(gt.MARGIN).toString(),10)));const d=Ve.encode(n,a,o);return this.renderResult(d,r,s,u)}writeToDom(n,r,s,o,a=null){typeof n=="string"&&(n=document.querySelector(n));const u=this.write(r,s,o,a);n&&n.appendChild(u)}renderResult(n,r,s,o){const a=n.getMatrix();if(a===null)throw new Dn;const u=a.getWidth(),d=a.getHeight(),h=u+o*2,g=d+o*2,x=Math.max(r,h),E=Math.max(s,g),A=Math.min(Math.floor(x/h),Math.floor(E/g)),I=Math.floor((x-u*A)/2),b=Math.floor((E-d*A)/2),D=this.createSVGElement(x,E);for(let L=0,z=b;L<d;L++,z+=A)for(let q=0,$=I;q<u;q++,$+=A)if(a.get(q,L)===1){const Z=this.createSvgRectElement($,z,A,A);D.appendChild(Z)}return D}createSVGElement(n,r){const s=document.createElementNS(Wr.SVG_NS,"svg");return s.setAttributeNS(null,"height",n.toString()),s.setAttributeNS(null,"width",r.toString()),s}createSvgRectElement(n,r,s,o){const a=document.createElementNS(Wr.SVG_NS,"rect");return a.setAttributeNS(null,"x",n.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"height",s.toString()),a.setAttributeNS(null,"width",o.toString()),a.setAttributeNS(null,"fill","#000000"),a}}Wr.QUIET_ZONE_SIZE=4,Wr.SVG_NS="http://www.w3.org/2000/svg";class ui{encode(n,r,s,o,a){if(n.length===0)throw new v("Found empty contents");if(r!==le.QR_CODE)throw new v("Can only encode QR_CODE, but got "+r);if(s<0||o<0)throw new v(`Requested dimensions are too small: ${s}x${o}`);let u=We.L,d=ui.QUIET_ZONE_SIZE;a!==null&&(a.get(gt.ERROR_CORRECTION)!==void 0&&(u=We.fromString(a.get(gt.ERROR_CORRECTION).toString())),a.get(gt.MARGIN)!==void 0&&(d=Number.parseInt(a.get(gt.MARGIN).toString(),10)));const h=Ve.encode(n,u,a);return ui.renderResult(h,s,o,d)}static renderResult(n,r,s,o){const a=n.getMatrix();if(a===null)throw new Dn;const u=a.getWidth(),d=a.getHeight(),h=u+o*2,g=d+o*2,x=Math.max(r,h),E=Math.max(s,g),A=Math.min(Math.floor(x/h),Math.floor(E/g)),I=Math.floor((x-u*A)/2),b=Math.floor((E-d*A)/2),D=new _e(x,E);for(let L=0,z=b;L<d;L++,z+=A)for(let q=0,$=I;q<u;q++,$+=A)a.get(q,L)===1&&D.setRegion($,z,A,A);return D}}ui.QUIET_ZONE_SIZE=4;class $h{encode(n,r,s,o,a){let u;switch(r){case le.QR_CODE:u=new ui;break;default:throw new v("No encoder available for format "+r)}return u.encode(n,r,s,o,a)}}class Bn extends ee{constructor(n,r,s,o,a,u,d,h){if(super(u,d),this.yuvData=n,this.dataWidth=r,this.dataHeight=s,this.left=o,this.top=a,o+u>r||a+d>s)throw new v("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(u,d)}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth();(r==null||r.length<s)&&(r=new Uint8ClampedArray(s));const o=(n+this.top)*this.dataWidth+this.left;return B.arraycopy(this.yuvData,o,r,0,s),r}getMatrix(){const n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.yuvData;const s=n*r,o=new Uint8ClampedArray(s);let a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return B.arraycopy(this.yuvData,a,o,0,s),o;for(let u=0;u<r;u++){const d=u*n;B.arraycopy(this.yuvData,a,o,d,n),a+=this.dataWidth}return o}isCropSupported(){return!0}crop(n,r,s,o){return new Bn(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,s,o,!1)}renderThumbnail(){const n=this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(n*r),o=this.yuvData;let a=this.top*this.dataWidth+this.left;for(let u=0;u<r;u++){const d=u*n;for(let h=0;h<n;h++){const g=o[a+h*Bn.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|g*65793}a+=this.dataWidth*Bn.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(n,r){const s=this.yuvData;for(let o=0,a=this.top*this.dataWidth+this.left;o<r;o++,a+=this.dataWidth){const u=a+n/2;for(let d=a,h=a+n-1;d<u;d++,h--){const g=s[d];s[d]=s[h],s[h]=g}}}invert(){return new de(this)}}Bn.THUMBNAIL_SCALE_FACTOR=2;class il extends ee{constructor(n,r,s,o,a,u,d){if(super(r,s),this.dataWidth=o,this.dataHeight=a,this.left=u,this.top=d,n.BYTES_PER_ELEMENT===4){const h=r*s,g=new Uint8ClampedArray(h);for(let x=0;x<h;x++){const E=n[x],A=E>>16&255,I=E>>7&510,b=E&255;g[x]=(A+I+b)/4&255}this.luminances=g}else this.luminances=n;if(o===void 0&&(this.dataWidth=r),a===void 0&&(this.dataHeight=s),u===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+r>this.dataWidth||this.top+s>this.dataHeight)throw new v("Crop rectangle does not fit within image data.")}getRow(n,r){if(n<0||n>=this.getHeight())throw new v("Requested row is outside the image: "+n);const s=this.getWidth();(r==null||r.length<s)&&(r=new Uint8ClampedArray(s));const o=(n+this.top)*this.dataWidth+this.left;return B.arraycopy(this.luminances,o,r,0,s),r}getMatrix(){const n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.luminances;const s=n*r,o=new Uint8ClampedArray(s);let a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return B.arraycopy(this.luminances,a,o,0,s),o;for(let u=0;u<r;u++){const d=u*n;B.arraycopy(this.luminances,a,o,d,n),a+=this.dataWidth}return o}isCropSupported(){return!0}crop(n,r,s,o){return new il(this.luminances,s,o,this.dataWidth,this.dataHeight,this.left+n,this.top+r)}invert(){return new de(this)}}class c1 extends V{static forName(n){return this.getCharacterSetECIByName(n)}}class sl{}sl.ISO_8859_1=V.ISO8859_1;class f1{isCompact(){return this.compact}setCompact(n){this.compact=n}getSize(){return this.size}setSize(n){this.size=n}getLayers(){return this.layers}setLayers(n){this.layers=n}getCodeWords(){return this.codeWords}setCodeWords(n){this.codeWords=n}getMatrix(){return this.matrix}setMatrix(n){this.matrix=n}}class d1{static singletonList(n){return[n]}static min(n,r){return n.sort(r)[0]}}class Jh{constructor(n){this.previous=n}getPrevious(){return this.previous}}class ci extends Jh{constructor(n,r,s){super(n),this.value=r,this.bitCount=s}appendTo(n,r){n.appendBits(this.value,this.bitCount)}add(n,r){return new ci(this,n,r)}addBinaryShift(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new ci(this,n,r)}toString(){let n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+N.toBinaryString(n|1<<this.bitCount).substring(1)+">"}}class ol extends ci{constructor(n,r,s){super(n,0,0),this.binaryShiftStart=r,this.binaryShiftByteCount=s}appendTo(n,r){for(let s=0;s<this.binaryShiftByteCount;s++)(s===0||s===31&&this.binaryShiftByteCount<=62)&&(n.appendBits(31,5),this.binaryShiftByteCount>62?n.appendBits(this.binaryShiftByteCount-31,16):s===0?n.appendBits(Math.min(this.binaryShiftByteCount,31),5):n.appendBits(this.binaryShiftByteCount-31,5)),n.appendBits(r[this.binaryShiftStart+s],8)}addBinaryShift(n,r){return new ol(this,n,r)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function eg(y,n,r){return new ol(y,n,r)}function os(y,n,r){return new ci(y,n,r)}const tg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],fr=0,xo=1,gn=2,h1=3,Ln=4,ng=new ci(null,0,0),al=[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 rg(y){for(let n of y)T.fill(n,-1);return y[fr][Ln]=0,y[xo][Ln]=0,y[xo][fr]=28,y[h1][Ln]=0,y[gn][Ln]=0,y[gn][fr]=15,y}const g1=rg(T.createInt32Array(6,6));class Fn{constructor(n,r,s,o){this.token=n,this.mode=r,this.binaryShiftByteCount=s,this.bitCount=o}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(n,r){let s=this.bitCount,o=this.token;if(n!==this.mode){let u=al[this.mode][n];o=os(o,u&65535,u>>16),s+=u>>16}let a=n===gn?4:5;return o=os(o,r,a),new Fn(o,n,0,s+a)}shiftAndAppend(n,r){let s=this.token,o=this.mode===gn?4:5;return s=os(s,g1[this.mode][n],o),s=os(s,r,5),new Fn(s,this.mode,0,this.bitCount+o+5)}addBinaryShiftChar(n){let r=this.token,s=this.mode,o=this.bitCount;if(this.mode===Ln||this.mode===gn){let d=al[s][fr];r=os(r,d&65535,d>>16),o+=d>>16,s=fr}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,u=new Fn(r,s,this.binaryShiftByteCount+1,o+a);return u.binaryShiftByteCount===2078&&(u=u.endBinaryShift(n+1)),u}endBinaryShift(n){if(this.binaryShiftByteCount===0)return this;let r=this.token;return r=eg(r,n-this.binaryShiftByteCount,this.binaryShiftByteCount),new Fn(r,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(n){let r=this.bitCount+(al[this.mode][n.mode]>>16);return this.binaryShiftByteCount<n.binaryShiftByteCount?r+=Fn.calculateBinaryShiftCost(n)-Fn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>n.binaryShiftByteCount&&n.binaryShiftByteCount>0&&(r+=10),r<=n.bitCount}toBitArray(n){let r=[];for(let o=this.endBinaryShift(n.length).token;o!==null;o=o.getPrevious())r.unshift(o);let s=new G;for(const o of r)o.appendTo(s,n);return s}toString(){return se.format("%s bits=%d bytes=%d",tg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(n){return n.binaryShiftByteCount>62?21:n.binaryShiftByteCount>31?20:n.binaryShiftByteCount>0?10:0}}Fn.INITIAL_STATE=new Fn(ng,fr,0,0);function ig(y){const n=se.getCharCode(" "),r=se.getCharCode("."),s=se.getCharCode(",");y[fr][n]=1;const o=se.getCharCode("Z"),a=se.getCharCode("A");for(let A=a;A<=o;A++)y[fr][A]=A-a+2;y[xo][n]=1;const u=se.getCharCode("z"),d=se.getCharCode("a");for(let A=d;A<=u;A++)y[xo][A]=A-d+2;y[gn][n]=1;const h=se.getCharCode("9"),g=se.getCharCode("0");for(let A=g;A<=h;A++)y[gn][A]=A-g+2;y[gn][s]=12,y[gn][r]=13;const x=["\0"," ","","","","","","","\x07","\b"," ",`
77
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let A=0;A<x.length;A++)y[h1][se.getCharCode(x[A])]=A;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let A=0;A<E.length;A++)se.getCharCode(E[A])>0&&(y[Ln][se.getCharCode(E[A])]=A);return y}const ll=ig(T.createInt32Array(5,256));class as{constructor(n){this.text=n}encode(){const n=se.getCharCode(" "),r=se.getCharCode(`
78
+ `);let s=d1.singletonList(Fn.INITIAL_STATE);for(let a=0;a<this.text.length;a++){let u,d=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case se.getCharCode("\r"):u=d===r?2:0;break;case se.getCharCode("."):u=d===n?3:0;break;case se.getCharCode(","):u=d===n?4:0;break;case se.getCharCode(":"):u=d===n?5:0;break;default:u=0}u>0?(s=as.updateStateListForPair(s,a,u),a++):s=this.updateStateListForChar(s,a)}return d1.min(s,(a,u)=>a.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(n,r){const s=[];for(let o of n)this.updateStateForChar(o,r,s);return as.simplifyStates(s)}updateStateForChar(n,r,s){let o=this.text[r]&255,a=ll[n.getMode()][o]>0,u=null;for(let d=0;d<=Ln;d++){let h=ll[d][o];if(h>0){if(u==null&&(u=n.endBinaryShift(r)),!a||d===n.getMode()||d===gn){const g=u.latchAndAppend(d,h);s.push(g)}if(!a&&g1[n.getMode()][d]>=0){const g=u.shiftAndAppend(d,h);s.push(g)}}}if(n.getBinaryShiftByteCount()>0||ll[n.getMode()][o]===0){let d=n.addBinaryShiftChar(r);s.push(d)}}static updateStateListForPair(n,r,s){const o=[];for(let a of n)this.updateStateForPair(a,r,s,o);return this.simplifyStates(o)}static updateStateForPair(n,r,s,o){let a=n.endBinaryShift(r);if(o.push(a.latchAndAppend(Ln,s)),n.getMode()!==Ln&&o.push(a.shiftAndAppend(Ln,s)),s===3||s===4){let u=a.latchAndAppend(gn,16-s).latchAndAppend(gn,1);o.push(u)}if(n.getBinaryShiftByteCount()>0){let u=n.addBinaryShiftChar(r).addBinaryShiftChar(r+1);o.push(u)}}static simplifyStates(n){let r=[];for(const s of n){let o=!0;for(const a of r){if(a.isBetterThanOrEqualTo(s)){o=!1;break}s.isBetterThanOrEqualTo(a)&&(r=r.filter(u=>u!==a))}o&&r.push(s)}return r}}class Ne{constructor(){}static encodeBytes(n){return Ne.encode(n,Ne.DEFAULT_EC_PERCENT,Ne.DEFAULT_AZTEC_LAYERS)}static encode(n,r,s){let o=new as(n).encode(),a=N.truncDivision(o.getSize()*r,100)+11,u=o.getSize()+a,d,h,g,x,E;if(s!==Ne.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?Ne.MAX_NB_BITS_COMPACT:Ne.MAX_NB_BITS))throw new v(se.format("Illegal value %s for layers",s));g=Ne.totalBitsInLayer(h,d),x=Ne.WORD_SIZE[h];let Z=g-g%x;if(E=Ne.stuffBits(o,x),E.getSize()+a>Z)throw new v("Data to large for user specified layer");if(d&&E.getSize()>x*64)throw new v("Data to large for user specified layer")}else{x=0,E=null;for(let Z=0;;Z++){if(Z>Ne.MAX_NB_BITS)throw new v("Data too large for an Aztec code");if(d=Z<=3,h=d?Z+1:Z,g=Ne.totalBitsInLayer(h,d),u>g)continue;(E==null||x!==Ne.WORD_SIZE[h])&&(x=Ne.WORD_SIZE[h],E=Ne.stuffBits(o,x));let ve=g-g%x;if(!(d&&E.getSize()>x*64)&&E.getSize()+a<=ve)break}}let A=Ne.generateCheckWords(E,g,x),I=E.getSize()/x,b=Ne.generateModeMessage(d,h,I),D=(d?11:14)+h*4,L=new Int32Array(D),z;if(d){z=D;for(let Z=0;Z<L.length;Z++)L[Z]=Z}else{z=D+1+2*N.truncDivision(N.truncDivision(D,2)-1,15);let Z=N.truncDivision(D,2),ve=N.truncDivision(z,2);for(let me=0;me<Z;me++){let Yt=me+N.truncDivision(me,15);L[Z-me-1]=ve-Yt-1,L[Z+me]=ve+Yt+1}}let q=new _e(z);for(let Z=0,ve=0;Z<h;Z++){let me=(h-Z)*4+(d?9:12);for(let Yt=0;Yt<me;Yt++){let vn=Yt*2;for(let Zt=0;Zt<2;Zt++)A.get(ve+vn+Zt)&&q.set(L[Z*2+Zt],L[Z*2+Yt]),A.get(ve+me*2+vn+Zt)&&q.set(L[Z*2+Yt],L[D-1-Z*2-Zt]),A.get(ve+me*4+vn+Zt)&&q.set(L[D-1-Z*2-Zt],L[D-1-Z*2-Yt]),A.get(ve+me*6+vn+Zt)&&q.set(L[D-1-Z*2-Yt],L[Z*2+Zt])}ve+=me*8}if(Ne.drawModeMessage(q,d,z,b),d)Ne.drawBullsEye(q,N.truncDivision(z,2),5);else{Ne.drawBullsEye(q,N.truncDivision(z,2),7);for(let Z=0,ve=0;Z<N.truncDivision(D,2)-1;Z+=15,ve+=16)for(let me=N.truncDivision(z,2)&1;me<z;me+=2)q.set(N.truncDivision(z,2)-ve,me),q.set(N.truncDivision(z,2)+ve,me),q.set(me,N.truncDivision(z,2)-ve),q.set(me,N.truncDivision(z,2)+ve)}let $=new f1;return $.setCompact(d),$.setSize(z),$.setLayers(h),$.setCodeWords(I),$.setMatrix(q),$}static drawBullsEye(n,r,s){for(let o=0;o<s;o+=2)for(let a=r-o;a<=r+o;a++)n.set(a,r-o),n.set(a,r+o),n.set(r-o,a),n.set(r+o,a);n.set(r-s,r-s),n.set(r-s+1,r-s),n.set(r-s,r-s+1),n.set(r+s,r-s),n.set(r+s,r-s+1),n.set(r+s,r+s-1)}static generateModeMessage(n,r,s){let o=new G;return n?(o.appendBits(r-1,2),o.appendBits(s-1,6),o=Ne.generateCheckWords(o,28,4)):(o.appendBits(r-1,5),o.appendBits(s-1,11),o=Ne.generateCheckWords(o,40,4)),o}static drawModeMessage(n,r,s,o){let a=N.truncDivision(s,2);if(r)for(let u=0;u<7;u++){let d=a-3+u;o.get(u)&&n.set(d,a-5),o.get(u+7)&&n.set(a+5,d),o.get(20-u)&&n.set(d,a+5),o.get(27-u)&&n.set(a-5,d)}else for(let u=0;u<10;u++){let d=a-5+u+N.truncDivision(u,5);o.get(u)&&n.set(d,a-7),o.get(u+10)&&n.set(a+7,d),o.get(29-u)&&n.set(d,a+7),o.get(39-u)&&n.set(a-7,d)}}static generateCheckWords(n,r,s){let o=n.getSize()/s,a=new rl(Ne.getGF(s)),u=N.truncDivision(r,s),d=Ne.bitsToWords(n,s,u);a.encode(d,u-o);let h=r%s,g=new G;g.appendBits(0,h);for(const x of Array.from(d))g.appendBits(x,s);return g}static bitsToWords(n,r,s){let o=new Int32Array(s),a,u;for(a=0,u=n.getSize()/r;a<u;a++){let d=0;for(let h=0;h<r;h++)d|=n.get(a*r+h)?1<<r-h-1:0;o[a]=d}return o}static getGF(n){switch(n){case 4:return be.AZTEC_PARAM;case 6:return be.AZTEC_DATA_6;case 8:return be.AZTEC_DATA_8;case 10:return be.AZTEC_DATA_10;case 12:return be.AZTEC_DATA_12;default:throw new v("Unsupported word size "+n)}}static stuffBits(n,r){let s=new G,o=n.getSize(),a=(1<<r)-2;for(let u=0;u<o;u+=r){let d=0;for(let h=0;h<r;h++)(u+h>=o||n.get(u+h))&&(d|=1<<r-1-h);(d&a)===a?(s.appendBits(d&a,r),u--):d&a?s.appendBits(d,r):(s.appendBits(d|1,r),u--)}return s}static totalBitsInLayer(n,r){return((r?88:112)+16*n)*n}}Ne.DEFAULT_EC_PERCENT=33,Ne.DEFAULT_AZTEC_LAYERS=0,Ne.MAX_NB_BITS=32,Ne.MAX_NB_BITS_COMPACT=4,Ne.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 mo{encode(n,r,s,o){return this.encodeWithHints(n,r,s,o,null)}encodeWithHints(n,r,s,o,a){let u=sl.ISO_8859_1,d=Ne.DEFAULT_EC_PERCENT,h=Ne.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(gt.CHARACTER_SET)&&(u=c1.forName(a.get(gt.CHARACTER_SET).toString())),a.has(gt.ERROR_CORRECTION)&&(d=N.parseInt(a.get(gt.ERROR_CORRECTION).toString())),a.has(gt.AZTEC_LAYERS)&&(h=N.parseInt(a.get(gt.AZTEC_LAYERS).toString()))),mo.encodeLayers(n,r,s,o,u,d,h)}static encodeLayers(n,r,s,o,a,u,d){if(r!==le.AZTEC)throw new v("Can only encode AZTEC, but got "+r);let h=Ne.encode(se.getBytes(n,a),u,d);return mo.renderResult(h,s,o)}static renderResult(n,r,s){let o=n.getMatrix();if(o==null)throw new Dn;let a=o.getWidth(),u=o.getHeight(),d=Math.max(r,a),h=Math.max(s,u),g=Math.min(d/a,h/u),x=(d-a*g)/2,E=(h-u*g)/2,A=new _e(d,h);for(let I=0,b=E;I<u;I++,b+=g)for(let D=0,L=x;D<a;D++,L+=g)o.get(D,I)&&A.setRegion(L,b,g,g);return A}}i.AbstractExpandedDecoder=Ya,i.ArgumentException=_,i.ArithmeticException=io,i.AztecCode=f1,i.AztecCodeReader=ao,i.AztecCodeWriter=mo,i.AztecDecoder=Ue,i.AztecDetector=qc,i.AztecDetectorResult=Kc,i.AztecEncoder=Ne,i.AztecHighLevelEncoder=as,i.AztecPoint=Lt,i.BarcodeFormat=le,i.Binarizer=P,i.BinaryBitmap=R,i.BitArray=G,i.BitMatrix=_e,i.BitSource=qa,i.BrowserAztecCodeReader=bh,i.BrowserBarcodeReader=Ph,i.BrowserCodeReader=cn,i.BrowserDatamatrixCodeReader=Lh,i.BrowserMultiFormatReader=Zh,i.BrowserPDF417Reader=Kh,i.BrowserQRCodeReader=Qh,i.BrowserQRCodeSvgWriter=Wr,i.CharacterSetECI=V,i.ChecksumException=M,i.Code128Reader=J,i.Code39Reader=dt,i.DataMatrixDecodedBitStreamParser=ar,i.DataMatrixReader=lr,i.DecodeHintType=U,i.DecoderResult=Qi,i.DefaultGridSampler=Qc,i.DetectorResult=oo,i.EAN13Reader=Pr,i.EncodeHintType=gt,i.Exception=m,i.FormatException=k,i.GenericGF=be,i.GenericGFPoly=jt,i.GlobalHistogramBinarizer=tt,i.GridSampler=ja,i.GridSamplerInstance=sr,i.HTMLCanvasElementLuminanceSource=pe,i.HybridBinarizer=xe,i.ITFReader=Be,i.IllegalArgumentException=v,i.IllegalStateException=Dn,i.InvertedLuminanceSource=de,i.LuminanceSource=ee,i.MathUtils=Te,i.MultiFormatOneDReader=ai,i.MultiFormatReader=u1,i.MultiFormatWriter=$h,i.NotFoundException=H,i.OneDReader=ut,i.PDF417DecodedBitStreamParser=W,i.PDF417DecoderErrorCorrection=r1,i.PDF417Reader=It,i.PDF417ResultMetadata=s1,i.PerspectiveTransform=Cn,i.PlanarYUVLuminanceSource=Bn,i.QRCodeByteMatrix=po,i.QRCodeDataMask=dn,i.QRCodeDecodedBitStreamParser=Qe,i.QRCodeDecoderErrorCorrectionLevel=We,i.QRCodeDecoderFormatInformation=Ot,i.QRCodeEncoder=Ve,i.QRCodeEncoderQRCode=Ur,i.QRCodeMaskUtil=it,i.QRCodeMatrixUtil=fe,i.QRCodeMode=ce,i.QRCodeReader=ur,i.QRCodeVersion=ue,i.QRCodeWriter=ui,i.RGBLuminanceSource=il,i.RSS14Reader=rt,i.RSSExpandedReader=Y,i.ReaderException=go,i.ReedSolomonDecoder=$i,i.ReedSolomonEncoder=rl,i.ReedSolomonException=ri,i.Result=Ke,i.ResultMetadataType=wt,i.ResultPoint=ae,i.StringUtils=se,i.UnsupportedOperationException=oe,i.VideoInputDevice=Ge,i.WhiteRectangleDetector=Gn,i.WriterException=Le,i.ZXingArrays=T,i.ZXingCharset=c1,i.ZXingInteger=N,i.ZXingStandardCharsets=sl,i.ZXingStringBuilder=ge,i.ZXingStringEncoding=Ee,i.ZXingSystem=B,i.createAbstractExpandedDecoder=t1,Object.defineProperty(i,"__esModule",{value:!0})})})(Lu,Lu.exports);var qe=Lu.exports;const vm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var L0=function(){function e(t,i,l){if(this.formatMap=new Map([[ne.QR_CODE,qe.BarcodeFormat.QR_CODE],[ne.AZTEC,qe.BarcodeFormat.AZTEC],[ne.CODABAR,qe.BarcodeFormat.CODABAR],[ne.CODE_39,qe.BarcodeFormat.CODE_39],[ne.CODE_93,qe.BarcodeFormat.CODE_93],[ne.CODE_128,qe.BarcodeFormat.CODE_128],[ne.DATA_MATRIX,qe.BarcodeFormat.DATA_MATRIX],[ne.MAXICODE,qe.BarcodeFormat.MAXICODE],[ne.ITF,qe.BarcodeFormat.ITF],[ne.EAN_13,qe.BarcodeFormat.EAN_13],[ne.EAN_8,qe.BarcodeFormat.EAN_8],[ne.PDF_417,qe.BarcodeFormat.PDF_417],[ne.RSS_14,qe.BarcodeFormat.RSS_14],[ne.RSS_EXPANDED,qe.BarcodeFormat.RSS_EXPANDED],[ne.UPC_A,qe.BarcodeFormat.UPC_A],[ne.UPC_E,qe.BarcodeFormat.UPC_E],[ne.UPC_EAN_EXTENSION,qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!vm)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=l;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 i=this;return new Promise(function(l,c){try{l(i.decode(t))}catch(f){c(f)}})},e.prototype.decode=function(t){var i=new qe.MultiFormatReader(this.verbose,this.hints),l=new qe.HTMLCanvasElementLuminanceSource(t),c=new qe.BinaryBitmap(new qe.HybridBinarizer(l)),f=i.decode(c);return{text:f.text,format:Sh.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(i,l,c){t.set(i,l)}),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 i=[],l=0,c=t;l<c.length;l++){var f=c[l];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return i},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),Sm=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},Im=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},F0=function(){function e(t,i,l){if(this.formatMap=new Map([[ne.QR_CODE,"qr_code"],[ne.AZTEC,"aztec"],[ne.CODABAR,"codabar"],[ne.CODE_39,"code_39"],[ne.CODE_93,"code_93"],[ne.CODE_128,"code_128"],[ne.DATA_MATRIX,"data_matrix"],[ne.ITF,"itf"],[ne.EAN_13,"ean_13"],[ne.EAN_8,"ean_8"],[ne.PDF_417,"pdf417"],[ne.UPC_A,"upc_a"],[ne.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=i,this.logger=l;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 Sm(this,void 0,void 0,function(){var i,l;return Im(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(i=c.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return l=this.selectLargestBarcode(i),[2,{text:l.rawValue,format:Sh.create(this.toHtml5QrcodeSupportedFormats(l.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var i=null,l=0,c=0,f=t;c<f.length;c++){var p=f[c],w=p.boundingBox.width*p.boundingBox.height;w>l&&(l=w,i=p)}if(!i)throw"No largest barcode found";return i},e.prototype.createBarcodeDetectorFormats=function(t){for(var i=[],l=0,c=t;l<c.length;l++){var f=c[l];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},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(i,l,c){t.set(i,l)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),U0=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},W0=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},_m=function(){function e(t,i,l,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=l,i&&F0.isSupported()?(this.primaryDecoder=new F0(t,l,c),this.secondaryDecoder=new L0(t,l,c)):this.primaryDecoder=new L0(t,l,c)}return e.prototype.decodeAsync=function(t){return U0(this,void 0,void 0,function(){var i;return W0(this,function(l){switch(l.label){case 0:i=performance.now(),l.label=1;case 1:return l.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,l.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return U0(this,void 0,void 0,function(){var i,l;return W0(this,function(c){switch(c.label){case 0:i=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(l=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw l;case 4:return this.possiblyLogPerformance(i),[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 i=performance.now()-t;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,i=0,l=this.executionResults;i<l.length;i++){var c=l[i];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}(),Xc=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(l[f]=c[f])},e(t,i)};return function(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(t,i);function l(){this.constructor=t}t.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),Aa=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},va=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},_h=function(){function e(t,i){this.name=t,this.track=i}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var i={};i[this.name]=t;var l={advanced:[i]};return this.track.applyConstraints(l)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var i=t[this.name];return i}return null},e}(),Tm=function(e){Xc(t,e);function t(i,l){return e.call(this,i,l)||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(i){var l={};l[this.name]=i;var c={advanced:[l]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),l=i[this.name];return{min:l.min,max:l.max,step:l.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(_h),Nm=function(e){Xc(t,e);function t(i){return e.call(this,"zoom",i)||this}return t}(Tm),Rm=function(e){Xc(t,e);function t(i){return e.call(this,"torch",i)||this}return t}(_h),bm=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new Nm(this.track)},e.prototype.torchFeature=function(){return new Rm(this.track)},e}(),Om=function(){function e(t,i,l){this.isClosed=!1,this.parentElement=t,this.mediaStream=i,this.callbacks=l,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var i=document.createElement("video");return i.style.width="".concat(t,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},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 i=function(){var l=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(l,c),t.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,i,l,c){return Aa(this,void 0,void 0,function(){var f,p;return va(this,function(w){switch(w.label){case 0:return f=new e(t,i,c),l.aspectRatio?(p={aspectRatio:l.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(p)]):[3,2];case 1:w.sent(),w.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 i=this,l=function(){setTimeout(t,200),i.surface.removeEventListener("playing",l)};this.surface.addEventListener("playing",l),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 Aa(this,void 0,void 0,function(){return va(this,function(i){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(i,l){var c=t.mediaStream.getVideoTracks(),f=c.length,p=0;t.mediaStream.getVideoTracks().forEach(function(w){t.mediaStream.removeTrack(w),w.stop(),++p,p>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),i())})})},e.prototype.getCapabilities=function(){return new bm(this.getFirstTrackOrFail())},e}(),Dm=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,i,l){return Aa(this,void 0,void 0,function(){return va(this,function(c){return[2,Om.create(t,this.mediaStream,i,l)]})})},e.create=function(t){return Aa(this,void 0,void 0,function(){var i,l;return va(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return l=c.sent(),[2,new e(l)]}})})},e}(),z0=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},V0=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Mm=function(){function e(){}return e.failIfNotSupported=function(){return z0(this,void 0,void 0,function(){return V0(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return z0(this,void 0,void 0,function(){return V0(this,function(i){return[2,Dm.create(t)]})})},e}(),km=function(e,t,i,l){function c(f){return f instanceof i?f:new i(function(p){p(f)})}return new(i||(i=Promise))(function(f,p){function w(_){try{m(l.next(_))}catch(v){p(v)}}function C(_){try{m(l.throw(_))}catch(v){p(v)}}function m(_){_.done?f(_.value):c(_.value).then(w,C)}m((l=l.apply(e,t||[])).next())})},Pm=function(e,t){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},l,c,f,p;return p={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function w(m){return function(_){return C([m,_])}}function C(m){if(l)throw new TypeError("Generator is already executing.");for(;p&&(p=0,m[0]&&(i=0)),i;)try{if(l=1,c&&(f=m[0]&2?c.return:m[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,m[1])).done)return f;switch(c=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return i.label++,{value:m[1],done:!1};case 5:i.label++,c=m[1],m=[0];continue;case 7:m=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){i=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){i.label=m[1];break}if(m[0]===6&&i.label<f[1]){i.label=f[1],f=m;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(m);break}f[2]&&i.ops.pop(),i.trys.pop();continue}m=t.call(e,i)}catch(_){m=[6,_],c=0}finally{l=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},Bm=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=Ri.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=Ri.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 km(this,void 0,void 0,function(){var t,i,l,c,f,p,w;return Pm(this,function(C){switch(C.label){case 0:return t=function(m){for(var _=m.getVideoTracks(),v=0,R=_;v<R.length;v++){var M=R[v];M.enabled=!1,M.stop(),m.removeTrack(M)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=C.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(l=C.sent(),c=[],f=0,p=l;f<p.length;f++)w=p[f],w.kind==="videoinput"&&c.push({id:w.deviceId,label:w.label});return t(i),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,i){var l=function(f){for(var p=[],w=0,C=f;w<C.length;w++){var m=C[w];m.kind==="video"&&p.push({id:m.id,label:m.label})}t(p)},c=MediaStreamTrack;c.getSources(l)})},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 Lm=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,i){for(var l=0,c=i;l<c.length;l++){var f=c[l];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),Fm=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}(),Um=function(){function e(){}return e.create=function(){return new Fm(new Lm)},e}(),Wm=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(l[f]=c[f])},e(t,i)};return function(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(t,i);function l(){this.constructor=t}t.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),nn=function(e){Wm(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}(Em),zm=function(){function e(t,i){this.logger=i,this.fps=nn.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=nn.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Ih.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!Xn(this.qrbox)},e.create=function(t,i){return new e(t,i)},e}(),lw=function(){function e(t,i){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 l;typeof i=="boolean"?this.verbose=i===!0:i&&(l=i,this.verbose=l.verbose===!0,l.experimentalFeatures),this.logger=new Am(this.verbose),this.qrcode=new _m(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(l),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Um.create()}return e.prototype.start=function(t,i,l,c){var f=this;if(!t)throw"cameraIdOrConfig is required";if(!l||typeof l!="function")throw"qrCodeSuccessCallback is required and should be a function.";var p;c?p=c:p=this.verbose?this.logger.log:function(){};var w=zm.create(i,this.logger);this.clearElement();var C=!1;w.videoConstraints&&(w.isMediaStreamConstraintsValid()?C=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var m=C,_=document.getElementById(this.elementId);_.clientWidth?_.clientWidth:nn.DEFAULT_WIDTH,_.style.position="relative",this.shouldScan=!0,this.element=_;var v=this,R=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(M,P){var B=m?w.videoConstraints:v.createVideoConstraints(t);if(!B){R.cancel(),P("videoConstraints should be defined");return}var K={};(!m||w.aspectRatio)&&(K.aspectRatio=w.aspectRatio);var O={onRenderSurfaceReady:function(T,N){v.setupUi(T,N,w),v.isScanning=!0,v.foreverScan(w,l,p)}};Mm.failIfNotSupported().then(function(T){T.create(B).then(function(N){return N.render(f.element,K,O).then(function(G){v.renderedCamera=G,R.execute(),M(null)}).catch(function(G){R.cancel(),P(G)})}).catch(function(N){R.cancel(),P(Ri.errorGettingUserMedia(N))})}).catch(function(T){R.cancel(),P(Ri.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(Xn(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,i=function(){t.stateManagerProxy.directTransition(st.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},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 i=this.stateManagerProxy.startTransition(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var l=function(){if(t.element){var f=document.getElementById(nn.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),l(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),i.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,i){return this.scanFileV2(t,i).then(function(l){return l.decodedText})},e.prototype.scanFileV2=function(t,i){var l=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Xn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){l.possiblyCloseLastScanImageFile(),l.clearElement(),l.lastScanImageFile=URL.createObjectURL(t);var p=new Image;p.onload=function(){var w=p.width,C=p.height,m=document.getElementById(l.elementId),_=m.clientWidth?m.clientWidth:nn.DEFAULT_WIDTH,v=Math.max(m.clientHeight?m.clientHeight:C,nn.FILE_SCAN_MIN_HEIGHT),R=l.computeCanvasDrawConfig(w,C,_,v);if(i){var M=l.createCanvasElement(_,v,"qr-canvas-visible");M.style.display="inline-block",m.appendChild(M);var P=M.getContext("2d");if(!P)throw"Unable to get 2d context from canvas";P.canvas.width=_,P.canvas.height=v,P.drawImage(p,0,0,w,C,R.x,R.y,R.width,R.height)}var B=nn.FILE_SCAN_HIDDEN_CANVAS_PADDING,K=Math.max(p.width,R.width),O=Math.max(p.height,R.height),T=K+2*B,N=O+2*B,G=l.createCanvasElement(T,N);m.appendChild(G);var j=G.getContext("2d");if(!j)throw"Unable to get 2d context from canvas";j.canvas.width=T,j.canvas.height=N,j.drawImage(p,0,0,w,C,B,B,K,O);try{l.qrcode.decodeRobustlyAsync(G).then(function(U){c(B0.createFromQrcodeResult(U))}).catch(f)}catch(U){f("QR code parse error, error = ".concat(U))}},p.onerror=f,p.onabort=f,p.onstalled=f,p.onsuspend=f,p.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Bm.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(!Ih.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 i=[ne.QR_CODE,ne.AZTEC,ne.CODABAR,ne.CODE_39,ne.CODE_93,ne.CODE_128,ne.DATA_MATRIX,ne.MAXICODE,ne.ITF,ne.EAN_13,ne.EAN_8,ne.PDF_417,ne.RSS_14,ne.RSS_EXPANDED,ne.UPC_A,ne.UPC_E,ne.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return i;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 l=[],c=0,f=t.formatsToSupport;c<f.length;c++){var p=f[c];ym(p)?l.push(p):this.logger.warn("Invalid format: ".concat(p," passed in config, ignoring."))}if(l.length===0)throw"None of formatsToSupport match supported values.";return l},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(Xn(t))return!0;if(!Xn(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(Xn(t.experimentalFeatures))return!0;var i=t.experimentalFeatures;return Xn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,i,l){var c=this,f=l.qrbox;this.validateQrboxConfig(f);var p=this.toQrdimensions(t,i,f),w=function(m){if(m<nn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(nn.MIN_QR_BOX_SIZE,"px.")},C=function(m){return m>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),m=t),m};w(p.width),w(p.height),p.width=C(p.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,i,l){if(typeof l=="number")return{width:l,height:l};if(typeof l=="function")try{return l(t,i)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return l},e.prototype.setupUi=function(t,i,l){l.isShadedBoxEnabled()&&this.validateQrboxSize(t,i,l);var c=Xn(l.qrbox)?{width:t,height:i}:l.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,i,c);f.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var p=l.isShadedBoxEnabled()&&f.height<=i,w={x:0,y:0,width:t,height:i},C=p?this.getShadedRegionBounds(t,i,f):w,m=this.createCanvasElement(C.width,C.height),_={willReadFrequently:!0},v=m.getContext("2d",_);v.canvas.width=C.width,v.canvas.height=C.height,this.element.append(m),p&&this.possiblyInsertShadingElement(this.element,t,i,f),this.createScannerPausedUiElement(this.element),this.qrRegion=C,this.context=v,this.canvasElement=m},e.prototype.createScannerPausedUiElement=function(t){var i=document.createElement("div");i.innerText=Ri.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",t.appendChild(i),this.scannerPausedUiElement=i},e.prototype.scanContext=function(t,i){var l=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,B0.createFromQrcodeResult(c)),l.possiblyUpdateShaders(!0),!0}).catch(function(c){l.possiblyUpdateShaders(!1);var f=Ri.codeParseError(c);return i(f,Cm.createFrom(f)),!1})},e.prototype.foreverScan=function(t,i,l){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),p=f.videoWidth/f.clientWidth,w=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var C=this.qrRegion.width*p,m=this.qrRegion.height*w,_=this.qrRegion.x*p,v=this.qrRegion.y*w;this.context.drawImage(f,_,v,C,m,0,0,this.qrRegion.width,this.qrRegion.height);var R=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,i,l)},c.getTimeoutFps(t.fps))};this.scanContext(i,l).then(function(M){!M&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(i,l).finally(function(){R()})):R()}).catch(function(M){c.logger.logError("Error happend while scanning context",M),R()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var i="facingMode",l="deviceId",c={user:!0,environment:!0},f="exact",p=function(P){if(P in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(P,"'")},w=Object.keys(t);if(w.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(w.length," keys");var C=Object.keys(t)[0];if(C!==i&&C!==l)throw"Only '".concat(i,"' and '").concat(l,"' ")+" are supported for 'cameraIdOrConfig'";if(C===i){var m=t.facingMode;if(typeof m=="string"){if(p(m))return{facingMode:m}}else if(typeof m=="object")if(f in m){if(p(m["".concat(f)]))return{facingMode:{exact:m["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var _=typeof m;throw"Invalid type of 'facingMode' = ".concat(_)}}else{var v=t.deviceId;if(typeof v=="string")return{deviceId:v};if(typeof v=="object"){if(f in v)return{deviceId:{exact:v["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var R=typeof v;throw"Invalid type of 'deviceId' = ".concat(R)}}}var M=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(M)},e.prototype.computeCanvasDrawConfig=function(t,i,l,c){if(t<=l&&i<=c){var f=(l-t)/2,p=(c-i)/2;return{x:f,y:p,width:t,height:i}}else{var w=t,C=i;return t>l&&(i=l/t*i,t=l),i>c&&(t=c/i*t,i=c),this.logger.log("Image downsampled from "+"".concat(w,"X").concat(C)+" to ".concat(t,"X").concat(i,".")),this.computeCanvasDrawConfig(t,i,l,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(i){i.style.backgroundColor=t?nn.BORDER_SHADER_MATCH_COLOR:nn.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,i,l){var c=t,f=i,p=document.createElement("canvas");return p.style.width="".concat(c,"px"),p.style.height="".concat(f,"px"),p.style.display="none",p.id=Xn(l)?"qr-canvas":l,p},e.prototype.getShadedRegionBounds=function(t,i,l){if(l.width>t||l.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-l.width)/2,y:(i-l.height)/2,width:l.width,height:l.height}},e.prototype.possiblyInsertShadingElement=function(t,i,l,c){if(!(i-c.width<1||l-c.height<1)){var f=document.createElement("div");f.style.position="absolute";var p=(i-c.width)/2,w=(l-c.height)/2;if(f.style.borderLeft="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(w,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(w,"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(nn.SHADED_REGION_ELEMENT_ID),i-c.width<11||l-c.height<11)this.hasBorderShaders=!1;else{var C=5,m=40;this.insertShaderBorders(f,m,C,-C,null,0,!0),this.insertShaderBorders(f,m,C,-C,null,0,!1),this.insertShaderBorders(f,m,C,null,-C,0,!0),this.insertShaderBorders(f,m,C,null,-C,0,!1),this.insertShaderBorders(f,C,m+C,-C,null,-C,!0),this.insertShaderBorders(f,C,m+C,null,-C,-C,!0),this.insertShaderBorders(f,C,m+C,-C,null,-C,!1),this.insertShaderBorders(f,C,m+C,null,-C,-C,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,i,l,c,f,p,w){var C=document.createElement("div");C.style.position="absolute",C.style.backgroundColor=nn.BORDER_SHADER_DEFAULT_COLOR,C.style.width="".concat(i,"px"),C.style.height="".concat(l,"px"),c!==null&&(C.style.top="".concat(c,"px")),f!==null&&(C.style.bottom="".concat(f,"px")),w?C.style.left="".concat(p,"px"):C.style.right="".concat(p,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(C),t.appendChild(C)},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}(),j0;(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"})(j0||(j0={}));var Fu;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(Fu||(Fu={}));var Uu;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(Uu||(Uu={}));var Wu;(function(e){e[e.ALL=17]="ALL"})(Wu||(Wu={}));const Vm=Object.assign(Object.assign({},ne),Wu);var H0;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(H0||(H0={}));const jm=[{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 Hm(e){const t="custom-style-os-cap-barcode";let i=document.getElementById(t);if(i||(i=document.createElement("style"),i.type="text/css",i.id=t,document.head.appendChild(i)),i.sheet){for(;i.sheet.cssRules.length;)i.sheet.deleteRule(0);for(const{selector:l,css:c}of e)i.sheet.insertRule(`${l} { ${c} }`)}else{i.textContent="";for(const{selector:l,css:c}of e)i.textContent+=`${l} { ${c} }`}}const Gm=Va("CapacitorBarcodeScanner",{web:()=>(Hm(jm),qu(()=>import("./web-DseRebF6.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class Xm{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||Fu.BACK,t.scanOrientation=t.scanOrientation||Uu.ADAPTIVE,Gm.scanBarcode(t)}}const zl=Va("SecureStoragePlugin",{web:()=>qu(()=>import("./web-CzXjoC1h.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function Ym(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=br.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 i=new URL(t.server);if(i.username||i.password||i.search||i.hash||i.pathname!=="/")throw new Error;const l=br.parse(t.server);if(!l)throw new Error;return{endpoint:l,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class Zm{ready(){if(!$s.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await zl.get({key:`agentroam-device:${t}`})).value}catch(i){if(String(i).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,i){this.ready(),await zl.set({key:`agentroam-device:${t}`,value:i})}async remove(t){this.ready();try{await zl.remove({key:`agentroam-device:${t}`})}catch(i){if(!String(i).includes("does not exist"))throw i}}}async function Km(){if(!$s.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await Xm.scanBarcode({hint:Vm.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class Qm{constructor(t,i=(...c)=>fetch(...c),l=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=i,this.onRevoked=l,this.session=null,this.fetch=async(c,f={})=>{const p=this.session,w=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),C=new Headers(f.headers??(c instanceof Request?c.headers:void 0));p&&w.origin===p.origin&&C.set("authorization",`Bearer ${p.token}`);const m=await this.transport(c,{...f,headers:C,credentials:"omit",redirect:"error"});if(p&&this.session===p&&w.origin===p.origin&&(m.status===401||m.status===423)){this.session=null;try{await this.storage.remove(p.origin)}finally{this.onRevoked()}}return m}}async resume(t){const i=await this.storage.get(t.url);this.session=i?{origin:t.url,token:i}:null}async pair(t){const{endpoint:i,grant:l}=Ym(t),c=await this.transport(i.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:l,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(i.url,f.token)}catch{throw await this.transport(i.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:i.url,token:f.token},i}async checkAuthorization(){const t=this.session;if(!t)return;const i=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!i.ok)return;const l=await i.json();if(this.session===t&&(l.locked||l.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}class Vl extends Error{constructor(t,i){super(t),this.name="ParseError",this.type=i.type,this.field=i.field,this.value=i.value,this.line=i.line}}const G0=10,qm=13,zr=32;function jl(e){}function $m(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=jl,onError:i=jl,onRetry:l=jl,onComment:c,maxBufferSize:f}=e,p=[];let w=0,C=!0,m,_="",v=0,R,M=!1;function P(j){if(M)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(C&&(C=!1,j.charCodeAt(0)===239&&j.charCodeAt(1)===187&&j.charCodeAt(2)===191&&(j=j.slice(3))),p.length===0){const X=K(j);X!==""&&(p.push(X),w=X.length),B();return}if(j.indexOf(`
79
+ `)===-1&&j.indexOf("\r")===-1){p.push(j),w+=j.length,B();return}p.push(j);const U=p.join("");p.length=0,w=0;const k=K(U);k!==""&&(p.push(k),w=k.length),B()}function B(){f!==void 0&&(w+_.length<=f||(M=!0,p.length=0,w=0,m=void 0,_="",v=0,R=void 0,i(new Vl(`Buffered data exceeded max buffer size of ${f} characters`,{type:"max-buffer-size-exceeded"}))))}function K(j){let U=0;if(j.indexOf("\r")===-1){let k=j.indexOf(`
80
+ `,U);for(;k!==-1;){if(U===k){v>0&&t({id:m,event:R,data:_}),m=void 0,_="",v=0,R=void 0,U=k+1,k=j.indexOf(`
81
+ `,U);continue}const X=j.charCodeAt(U);if(X0(j,U,X)){const V=j.charCodeAt(U+5)===zr?U+6:U+5,oe=j.slice(V,k);if(v===0&&j.charCodeAt(k+1)===G0){t({id:m,event:R,data:oe}),m=void 0,_="",R=void 0,U=k+2,k=j.indexOf(`
82
+ `,U);continue}_=v===0?oe:`${_}
83
+ ${oe}`,v++}else Y0(j,U,X)?R=j.slice(j.charCodeAt(U+6)===zr?U+7:U+6,k)||void 0:O(j,U,k);U=k+1,k=j.indexOf(`
84
+ `,U)}return j.slice(U)}for(;U<j.length;){const k=j.indexOf("\r",U),X=j.indexOf(`
85
+ `,U);let V=-1;if(k!==-1&&X!==-1?V=k<X?k:X:k!==-1?k===j.length-1?V=-1:V=k:X!==-1&&(V=X),V===-1)break;O(j,U,V),U=V+1,j.charCodeAt(U-1)===qm&&j.charCodeAt(U)===G0&&U++}return j.slice(U)}function O(j,U,k){if(U===k){N();return}const X=j.charCodeAt(U);if(X0(j,U,X)){const _e=j.charCodeAt(U+5)===zr?U+6:U+5,H=j.slice(_e,k);_=v===0?H:`${_}
86
+ ${H}`,v++;return}if(Y0(j,U,X)){R=j.slice(j.charCodeAt(U+6)===zr?U+7:U+6,k)||void 0;return}if(X===105&&j.charCodeAt(U+1)===100&&j.charCodeAt(U+2)===58){const _e=j.slice(j.charCodeAt(U+3)===zr?U+4:U+3,k);_e.includes("\0")||(m=_e);return}if(X===58){if(c){const _e=j.slice(U,k);c(_e.slice(j.charCodeAt(U+1)===zr?2:1))}return}const V=j.slice(U,k),oe=V.indexOf(":");if(oe===-1){T(V,"",V);return}const Ee=V.slice(0,oe),se=V.charCodeAt(oe+1)===zr?2:1,ge=V.slice(oe+se);T(Ee,ge,V)}function T(j,U,k){switch(j){case"event":R=U||void 0;break;case"data":_=v===0?U:`${_}
87
+ ${U}`,v++;break;case"id":U.includes("\0")||(m=U);break;case"retry":/^\d+$/.test(U)?l(parseInt(U,10)):i(new Vl(`Invalid \`retry\` value: "${U}"`,{type:"invalid-retry",value:U,line:k}));break;default:i(new Vl(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:U,line:k}));break}}function N(){v>0&&t({id:m,event:R,data:_}),m=void 0,_="",v=0,R=void 0}function G(j={}){if(j.consume&&p.length>0){const U=p.join("");O(U,0,U.length)}C=!0,m=void 0,_="",v=0,R=void 0,p.length=0,w=0,M=!1}return{feed:P,reset:G}}function X0(e,t,i){return i===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Y0(e,t,i){return i===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 Z0 extends Event{constructor(t,i){var l,c;super(t),this.code=(l=i==null?void 0:i.code)!=null?l:void 0,this.message=(c=i==null?void 0:i.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,i,l){return l(K0(this),i)}[Symbol.for("Deno.customInspect")](t,i){return t(K0(this),i)}}function Jm(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function zu(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(zu).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${zu(e.cause)}`:e.message:`${e}`}function K0(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var Th=e=>{throw TypeError(e)},Yc=(e,t,i)=>t.has(e)||Th("Cannot "+i),Ce=(e,t,i)=>(Yc(e,t,"read from private field"),i?i.call(e):t.get(e)),pt=(e,t,i)=>t.has(e)?Th("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Ye=(e,t,i,l)=>(Yc(e,t,"write to private field"),t.set(e,i),i),Yn=(e,t,i)=>(Yc(e,t,"access private method"),i),Kt,Hr,gi,Ko,Sa,Ds,bi,Ms,mr,pi,Li,xi,Cs,In,Vu,ju,Hu,Q0,Gu,Xu,As,Yu,Zu;let Qo=class extends EventTarget{constructor(t,i){var l,c;super(),pt(this,In),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,pt(this,Kt),pt(this,Hr),pt(this,gi),pt(this,Ko),pt(this,Sa),pt(this,Ds),pt(this,bi),pt(this,Ms,null),pt(this,mr),pt(this,pi),pt(this,Li,null),pt(this,xi,null),pt(this,Cs,null),pt(this,ju,async f=>{var p;Ce(this,pi).reset();const{body:w,redirected:C,status:m,headers:_}=f;if(m===204){Yn(this,In,As).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(C?Ye(this,gi,new URL(f.url)):Ye(this,gi,void 0),m!==200){Yn(this,In,As).call(this,`Non-200 status code (${m})`,m);return}if(!(_.get("content-type")||"").startsWith("text/event-stream")){Yn(this,In,As).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(Ce(this,Kt)===this.CLOSED)return;Ye(this,Kt,this.OPEN);const v=new Event("open");if((p=Ce(this,Cs))==null||p.call(this,v),this.dispatchEvent(v),typeof w!="object"||!w||!("getReader"in w)){Yn(this,In,As).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const R=new TextDecoder,M=w.getReader();let P=!0;do{const{done:B,value:K}=await M.read();K&&Ce(this,pi).feed(R.decode(K,{stream:!B})),B&&(P=!1,Ce(this,pi).reset(),Yn(this,In,Yu).call(this))}while(P)}),pt(this,Hu,f=>{Ye(this,mr,void 0),!(f.name==="AbortError"||f.type==="aborted")&&Yn(this,In,Yu).call(this,zu(f))}),pt(this,Gu,f=>{typeof f.id=="string"&&Ye(this,Ms,f.id);const p=new MessageEvent(f.event||"message",{data:f.data,origin:Ce(this,gi)?Ce(this,gi).origin:Ce(this,Hr).origin,lastEventId:f.id||""});Ce(this,xi)&&(!f.event||f.event==="message")&&Ce(this,xi).call(this,p),this.dispatchEvent(p)}),pt(this,Xu,f=>{Ye(this,Ds,f)}),pt(this,Zu,()=>{Ye(this,bi,void 0),Ce(this,Kt)===this.CONNECTING&&Yn(this,In,Vu).call(this)});try{if(t instanceof URL)Ye(this,Hr,t);else if(typeof t=="string")Ye(this,Hr,new URL(t,ew()));else throw new Error("Invalid URL")}catch{throw Jm("An invalid or illegal string was specified")}Ye(this,pi,$m({onEvent:Ce(this,Gu),onRetry:Ce(this,Xu)})),Ye(this,Kt,this.CONNECTING),Ye(this,Ds,3e3),Ye(this,Sa,(l=i==null?void 0:i.fetch)!=null?l:globalThis.fetch),Ye(this,Ko,(c=i==null?void 0:i.withCredentials)!=null?c:!1),Yn(this,In,Vu).call(this)}get readyState(){return Ce(this,Kt)}get url(){return Ce(this,Hr).href}get withCredentials(){return Ce(this,Ko)}get onerror(){return Ce(this,Li)}set onerror(t){Ye(this,Li,t)}get onmessage(){return Ce(this,xi)}set onmessage(t){Ye(this,xi,t)}get onopen(){return Ce(this,Cs)}set onopen(t){Ye(this,Cs,t)}addEventListener(t,i,l){const c=i;super.addEventListener(t,c,l)}removeEventListener(t,i,l){const c=i;super.removeEventListener(t,c,l)}close(){Ce(this,bi)&&clearTimeout(Ce(this,bi)),Ce(this,Kt)!==this.CLOSED&&(Ce(this,mr)&&Ce(this,mr).abort(),Ye(this,Kt,this.CLOSED),Ye(this,mr,void 0))}};Kt=new WeakMap,Hr=new WeakMap,gi=new WeakMap,Ko=new WeakMap,Sa=new WeakMap,Ds=new WeakMap,bi=new WeakMap,Ms=new WeakMap,mr=new WeakMap,pi=new WeakMap,Li=new WeakMap,xi=new WeakMap,Cs=new WeakMap,In=new WeakSet,Vu=function(){Ye(this,Kt,this.CONNECTING),Ye(this,mr,new AbortController),Ce(this,Sa)(Ce(this,Hr),Yn(this,In,Q0).call(this)).then(Ce(this,ju)).catch(Ce(this,Hu))},ju=new WeakMap,Hu=new WeakMap,Q0=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ce(this,Ms)?{"Last-Event-ID":Ce(this,Ms)}:void 0},cache:"no-store",signal:(e=Ce(this,mr))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Gu=new WeakMap,Xu=new WeakMap,As=function(e,t){var i;Ce(this,Kt)!==this.CLOSED&&Ye(this,Kt,this.CLOSED);const l=new Z0("error",{code:t,message:e});(i=Ce(this,Li))==null||i.call(this,l),this.dispatchEvent(l)},Yu=function(e,t){var i;if(Ce(this,Kt)===this.CLOSED)return;Ye(this,Kt,this.CONNECTING);const l=new Z0("error",{code:t,message:e});(i=Ce(this,Li))==null||i.call(this,l),this.dispatchEvent(l),Ye(this,bi,setTimeout(Ce(this,Zu),Ce(this,Ds)))},Zu=new WeakMap,Qo.CONNECTING=0,Qo.OPEN=1,Qo.CLOSED=2;function ew(){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}Zp();$p();Fx();zx();document.body.dataset.webShell="1";const Zc=new sm;if(!Zc.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 i=document.createElement("script");i.src="/pwa/install.js",document.head.append(i)}const Pt=Zc.isNativeApp()?new Qm(new Zm):null,Nh=new Wp(Pt==null?void 0:Pt.fetch),tw=window.parent===window?void 0:new Zx,nw=window.parent===window?void 0:new rm;let Ku="";const q0=new Hp(Nh,new Gp,tw,e=>Pt?new Qo(Ku+e,{fetch:Pt.fetch}):new EventSource(Ku+e));window.browserLiveApi=nw;const Rh=document.getElementById("root");if(!Rh)throw new Error("#root missing");const Qu=gh(Rh);function rw(){return ct.useEffect(()=>{jx()},[]),null}(async()=>{Pt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new im(Zc,new O0,new am(Pt?async(i,l)=>{const c=br.parse(String(i));return c&&await Pt.resume(c),Pt.fetch(i,l)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){Qu.render(te.jsx(um,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Pt?async()=>{const i=await Km();if(!i)return null;const l=await Pt.pair(i);return new O0().save(l),l}:void 0,onConnected:i=>void $0(i)}));return}await $0(t.mode==="ready"?t.endpoint:null)})();async function $0(e){try{e&&(await(Pt==null?void 0:Pt.resume(e)),Nh.setBaseUrl(e.url),Ku=e.url),window.agentApi=q0,await q0.refreshServerModel();const{default:t}=await qu(async()=>{const{default:i}=await import("./App-C0GaUX7E.js");return{default:i}},__vite__mapDeps([0,1]),import.meta.url);Qu.render(te.jsxs(ct.StrictMode,{children:[te.jsx(Og.Provider,{value:te.jsx(Lp,{}),children:te.jsx(t,{})}),te.jsx(rw,{})]})),Pt&&setInterval(()=>{Pt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),iw())}catch(t){Qu.render(te.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:te.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[te.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),te.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),te.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 iw(){const e=[...document.scripts].map(i=>i.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{try{const i=await fetch("/api/agent/model",{credentials:"same-origin",cache:"no-store"});if(i.status===401||i.status===423){location.reload();return}const c=((await i.json()).buildId||"").replace(/^index-|\.js$/g,"");c&&c!==t&&location.reload()}catch{}},6e4)}export{Og as B,Uu as C,lw as H,aw as L,Ux as O,Sg as R,ow as S,vh as W,qu as _,Vm as a,hh as b,ls as c,Ix as d,sw as e,J0 as g,Dx as i,te as j,ct as r,Px as u};