@powerhousedao/connect 1.0.4 → 1.0.5-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +1 -0
- package/dist/.env +11 -6
- package/dist/assets/app-CcH3qGge.css +5805 -0
- package/dist/assets/app-D5aQi0aY.js +80396 -0
- package/dist/assets/app-loader-D5SWSIlq.js +31582 -0
- package/dist/assets/app-loader-DGByWxSG.css +5640 -0
- package/dist/assets/ccip-BmvACOxw.js +170 -0
- package/dist/assets/connect-loader-CvOC68Ih.mp4 +0 -0
- package/dist/assets/content-CjM3gin6.js +3967 -0
- package/dist/assets/home-bg-BEhF9NuW.png +0 -0
- package/dist/assets/index-D60iiT4f.js +2560 -0
- package/dist/assets/index-DIYv2p_P.js +12 -0
- package/dist/assets/index-d_545vU_.js +46565 -0
- package/dist/assets/main.DnroXr_4.js +105 -0
- package/dist/assets/powerhouse-rounded-CeKGGUG4.png +0 -0
- package/dist/assets/renown-short-hover-BiSLBV7L.png +0 -0
- package/dist/assets/rwa-report-Bb0W5-ac.png +0 -0
- package/dist/assets/style-Ce3V83BE.css +1658 -0
- package/dist/external-packages.js +5 -0
- package/dist/hmr.js +4 -0
- package/dist/icon.ico +0 -0
- package/dist/index.html +48 -10
- package/dist/modules/@powerhousedao/reactor-browser/chunk-2ESYSVXG.js +48 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-2ONJ2PX4.js +50 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-2X2M6BYG.js +2542 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-64UP3MVE.js +14171 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-7OQWVUC5.js +43 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-C7QRY43M.js +786 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-CO2RVWYY.js +67 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-DKDARAJS.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-F6NNSREE.js +2513 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-FQF4YAVC.js +11917 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-GDP7BUIH.js +45 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-IQTSFTNF.js +48 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-J5TYPY7U.js +36 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-LH2T6NLN.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-LRNZZ3SR.js +14 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-NHD6VUCD.js +53 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-OVGOA2P5.js +11 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-P6NJ6IAQ.js +12 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-QXHTR6KF.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-RGIB4DD4.js +162 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-U34SEKEB.js +250 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-U36SV333.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-UWJGRLW3.js +82 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-XBTEGV5M.js +17 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-Y7NTRTMT.js +25 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-YG67WAIS.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-YSOX63EM.js +178 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-YWKVPJNL.js +52 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-ZL5IPB6D.js +0 -0
- package/dist/modules/@powerhousedao/reactor-browser/chunk-ZWFCVUBU.js +113 -0
- package/dist/modules/@powerhousedao/reactor-browser/context/index.js +16 -0
- package/dist/modules/@powerhousedao/reactor-browser/context/read-mode.js +15 -0
- package/dist/modules/@powerhousedao/reactor-browser/crypto/browser.js +7 -0
- package/dist/modules/@powerhousedao/reactor-browser/crypto/index.js +7 -0
- package/dist/modules/@powerhousedao/reactor-browser/document-model.js +10 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/document-state.js +96 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/index.js +98 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useAddDebouncedOperations.js +11 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useConnectCrypto.js +12 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocument.js +7 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentDispatch.js +7 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentDrives.js +13 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentEditor.js +20 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActions.js +9 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes.js +14 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveContext.js +9 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useUiNodesContext.js +46 -0
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useUserPermissions.js +7 -0
- package/dist/modules/@powerhousedao/reactor-browser/index.js +125 -0
- package/dist/modules/@powerhousedao/reactor-browser/reactor.js +11 -0
- package/dist/modules/@powerhousedao/reactor-browser/renown/constants.js +53 -0
- package/dist/modules/@powerhousedao/reactor-browser/renown/types.js +1 -0
- package/dist/modules/@powerhousedao/reactor-browser/storage/index.js +1 -0
- package/dist/modules/@powerhousedao/reactor-browser/storage/types.js +1 -0
- package/dist/modules/@powerhousedao/reactor-browser/uiNodes/constants.js +37 -0
- package/dist/modules/@powerhousedao/reactor-browser/uiNodes/types.js +1 -0
- package/dist/modules/@powerhousedao/reactor-browser/utils/export-document.js +8 -0
- package/dist/modules/@powerhousedao/reactor-browser/utils/index.js +9 -0
- package/dist/modules/@powerhousedao/reactor-browser/utils/signature.js +10 -0
- package/dist/service-worker.js +46 -2
- package/dist/swEnv.js +9 -8
- package/dist/vite-envs.sh +56 -35
- package/nginx.conf +93 -0
- package/nginx.sh +10 -0
- package/package.json +36 -50
- package/dist/assets/ArrowFilledRight-blx8xu7X-D3d8PUWh.js +0 -2
- package/dist/assets/ArrowFilledRight-blx8xu7X-D3d8PUWh.js.map +0 -1
- package/dist/assets/ArrowLeft-7pYNK4eX-8ZR_YHAJ.js +0 -2
- package/dist/assets/ArrowLeft-7pYNK4eX-8ZR_YHAJ.js.map +0 -1
- package/dist/assets/ArrowUp-Bbr_dwo_-C5ppCQo4.js +0 -2
- package/dist/assets/ArrowUp-Bbr_dwo_-C5ppCQo4.js.map +0 -1
- package/dist/assets/BarChart-B0G05Nfd-CHDJ7OaJ.js +0 -2
- package/dist/assets/BarChart-B0G05Nfd-CHDJ7OaJ.js.map +0 -1
- package/dist/assets/BaseArrowLeft-DBzhFHMt-Dkbf2sWs.js +0 -2
- package/dist/assets/BaseArrowLeft-DBzhFHMt-Dkbf2sWs.js.map +0 -1
- package/dist/assets/BaseArrowRight-DYQTBWAs-CkkPllYm.js +0 -2
- package/dist/assets/BaseArrowRight-DYQTBWAs-CkkPllYm.js.map +0 -1
- package/dist/assets/Braces-N-sH2Zyc-3LcexUsR.js +0 -2
- package/dist/assets/Braces-N-sH2Zyc-3LcexUsR.js.map +0 -1
- package/dist/assets/Branch-CWdBw1_P-CmGdOXsI.js +0 -2
- package/dist/assets/Branch-CWdBw1_P-CmGdOXsI.js.map +0 -1
- package/dist/assets/BrickGlobe-67zaG6_H-DP0By6z_.js +0 -2
- package/dist/assets/BrickGlobe-67zaG6_H-DP0By6z_.js.map +0 -1
- package/dist/assets/Briefcase-CedW3KRR-DO5_k15F.js +0 -2
- package/dist/assets/Briefcase-CedW3KRR-DO5_k15F.js.map +0 -1
- package/dist/assets/Calendar-C-6HV96D-YetudWvP.js +0 -2
- package/dist/assets/Calendar-C-6HV96D-YetudWvP.js.map +0 -1
- package/dist/assets/Caret-Ep0j0fz2-By3ojfim.js +0 -2
- package/dist/assets/Caret-Ep0j0fz2-By3ojfim.js.map +0 -1
- package/dist/assets/CaretDown-3X7LFYBf-C43xdKg8.js +0 -2
- package/dist/assets/CaretDown-3X7LFYBf-C43xdKg8.js.map +0 -1
- package/dist/assets/CaretSort-BkGdLETT-DVOzEEqR.js +0 -2
- package/dist/assets/CaretSort-BkGdLETT-DVOzEEqR.js.map +0 -1
- package/dist/assets/Check-DV-U4AEq-B582NMZp.js +0 -2
- package/dist/assets/Check-DV-U4AEq-B582NMZp.js.map +0 -1
- package/dist/assets/CheckCircle-DI5fEgGd-CVF4LDhR.js +0 -2
- package/dist/assets/CheckCircle-DI5fEgGd-CVF4LDhR.js.map +0 -1
- package/dist/assets/CheckCircleFill-C-F0v5mB-BSW1YMqM.js +0 -2
- package/dist/assets/CheckCircleFill-C-F0v5mB-BSW1YMqM.js.map +0 -1
- package/dist/assets/Checkmark-BXnfChpo-CyQitGI2.js +0 -2
- package/dist/assets/Checkmark-BXnfChpo-CyQitGI2.js.map +0 -1
- package/dist/assets/ChevronDown-ouBxrU-k-eUsCPXcB.js +0 -2
- package/dist/assets/ChevronDown-ouBxrU-k-eUsCPXcB.js.map +0 -1
- package/dist/assets/Circle-n3-Wh4HS-8dOehHQf.js +0 -2
- package/dist/assets/Circle-n3-Wh4HS-8dOehHQf.js.map +0 -1
- package/dist/assets/CircleInfo-BhZY3C2Q-CZgYK1h2.js +0 -2
- package/dist/assets/CircleInfo-BhZY3C2Q-CZgYK1h2.js.map +0 -1
- package/dist/assets/ClockFill-Bd0t48q7-CcfHiJtH.js +0 -2
- package/dist/assets/ClockFill-Bd0t48q7-CcfHiJtH.js.map +0 -1
- package/dist/assets/CloudSlash-B-zJBjaD-CxVyp-Ac.js +0 -2
- package/dist/assets/CloudSlash-B-zJBjaD-CxVyp-Ac.js.map +0 -1
- package/dist/assets/Collapse-DRDB8Czs-CGcuZQgy.js +0 -2
- package/dist/assets/Collapse-DRDB8Czs-CGcuZQgy.js.map +0 -1
- package/dist/assets/Connect-Dme-qfKq-CgniLji8.js +0 -2
- package/dist/assets/Connect-Dme-qfKq-CgniLji8.js.map +0 -1
- package/dist/assets/Discord-CAS0Cj7s-CcsBWpnf.js +0 -2
- package/dist/assets/Discord-CAS0Cj7s-CcsBWpnf.js.map +0 -1
- package/dist/assets/Drive-GMcgBcIY-CzahDx9j.js +0 -2
- package/dist/assets/Drive-GMcgBcIY-CzahDx9j.js.map +0 -1
- package/dist/assets/Ellipsis-XK8AwMEC-BuVBeYhB.js +0 -2
- package/dist/assets/Ellipsis-XK8AwMEC-BuVBeYhB.js.map +0 -1
- package/dist/assets/Error-BmIZ2ZUy-CphzuMLn.js +0 -2
- package/dist/assets/Error-BmIZ2ZUy-CphzuMLn.js.map +0 -1
- package/dist/assets/Exclamation-CVsNS_QS-DLccamql.js +0 -2
- package/dist/assets/Exclamation-CVsNS_QS-DLccamql.js.map +0 -1
- package/dist/assets/FilesEarmark-CyrCQy8E-Bhut4E02.js +0 -2
- package/dist/assets/FilesEarmark-CyrCQy8E-Bhut4E02.js.map +0 -1
- package/dist/assets/FolderClose-DG_qHisc-CH6NoBuu.js +0 -2
- package/dist/assets/FolderClose-DG_qHisc-CH6NoBuu.js.map +0 -1
- package/dist/assets/FolderOpen-kDoWFkJO-Cciutkdg.js +0 -2
- package/dist/assets/FolderOpen-kDoWFkJO-Cciutkdg.js.map +0 -1
- package/dist/assets/FolderPlus-CSBSl9lZ-CifD0ek9.js +0 -2
- package/dist/assets/FolderPlus-CSBSl9lZ-CifD0ek9.js.map +0 -1
- package/dist/assets/Forum-DZ-CkLFh-BwabccAX.js +0 -2
- package/dist/assets/Forum-DZ-CkLFh-BwabccAX.js.map +0 -1
- package/dist/assets/Gear-cUlHJ4q6-B9R2l_9_.js +0 -2
- package/dist/assets/Gear-cUlHJ4q6-B9R2l_9_.js.map +0 -1
- package/dist/assets/Github-0PLiINY0-CjkZIHCO.js +0 -2
- package/dist/assets/Github-0PLiINY0-CjkZIHCO.js.map +0 -1
- package/dist/assets/Globe-CIYqVkpa-CL530H46.js +0 -2
- package/dist/assets/Globe-CIYqVkpa-CL530H46.js.map +0 -1
- package/dist/assets/GlobeWww-DN4yKujh-Ci7aa5CE.js +0 -2
- package/dist/assets/GlobeWww-DN4yKujh-Ci7aa5CE.js.map +0 -1
- package/dist/assets/Hdd-Dn_LdJIh-CJ6x9Bve.js +0 -2
- package/dist/assets/Hdd-Dn_LdJIh-CJ6x9Bve.js.map +0 -1
- package/dist/assets/History-BP4SmaS_-P4WBKyqX.js +0 -2
- package/dist/assets/History-BP4SmaS_-P4WBKyqX.js.map +0 -1
- package/dist/assets/InfoSquare-C98JaLiz-yPcGR71f.js +0 -2
- package/dist/assets/InfoSquare-C98JaLiz-yPcGR71f.js.map +0 -1
- package/dist/assets/Link-BF7aZjVu-CXIVQOz6.js +0 -2
- package/dist/assets/Link-BF7aZjVu-CXIVQOz6.js.map +0 -1
- package/dist/assets/Linkedin-DJwIkS6q-Dkb5Tp_Z.js +0 -2
- package/dist/assets/Linkedin-DJwIkS6q-Dkb5Tp_Z.js.map +0 -1
- package/dist/assets/Lock-PyaFHdNS-D_qxRTye.js +0 -2
- package/dist/assets/Lock-PyaFHdNS-D_qxRTye.js.map +0 -1
- package/dist/assets/M-DozhhPMY-DBQw97P_.js +0 -2
- package/dist/assets/M-DozhhPMY-DBQw97P_.js.map +0 -1
- package/dist/assets/Pencil-D7lvxXIP-D830iveq.js +0 -2
- package/dist/assets/Pencil-D7lvxXIP-D830iveq.js.map +0 -1
- package/dist/assets/People-CUB8LYKf-CyJmMqcw.js +0 -2
- package/dist/assets/People-CUB8LYKf-CyJmMqcw.js.map +0 -1
- package/dist/assets/Person-DuL4PQzm-ttQR0nPy.js +0 -2
- package/dist/assets/Person-DuL4PQzm-ttQR0nPy.js.map +0 -1
- package/dist/assets/Plus-DPFWGJM4-BztpK8li.js +0 -2
- package/dist/assets/Plus-DPFWGJM4-BztpK8li.js.map +0 -1
- package/dist/assets/PlusCircle-BEnWRjHa-w5zztKGx.js +0 -2
- package/dist/assets/PlusCircle-BEnWRjHa-w5zztKGx.js.map +0 -1
- package/dist/assets/PowerhouseLogoSmall-CmO95IAS-CDGLkst3.js +0 -2
- package/dist/assets/PowerhouseLogoSmall-CmO95IAS-CDGLkst3.js.map +0 -1
- package/dist/assets/Project-BlXuclr0-EsBam9d0.js +0 -2
- package/dist/assets/Project-BlXuclr0-EsBam9d0.js.map +0 -1
- package/dist/assets/RedoArrow-BJeEsiph-BbidqIFP.js +0 -2
- package/dist/assets/RedoArrow-BJeEsiph-BbidqIFP.js.map +0 -1
- package/dist/assets/Renown-6m7hx37h-CItksi2j.js +0 -2
- package/dist/assets/Renown-6m7hx37h-CItksi2j.js.map +0 -1
- package/dist/assets/RenownHover-CQ0TZHZv-cYQgnwQW.js +0 -2
- package/dist/assets/RenownHover-CQ0TZHZv-cYQgnwQW.js.map +0 -1
- package/dist/assets/Ring-DKv0gnwT-CDHLz87h.js +0 -2
- package/dist/assets/Ring-DKv0gnwT-CDHLz87h.js.map +0 -1
- package/dist/assets/Save-BBxj68pn-BkUvn89C.js +0 -2
- package/dist/assets/Save-BBxj68pn-BkUvn89C.js.map +0 -1
- package/dist/assets/Search-YUJuRBLe-CecGUkZA.js +0 -2
- package/dist/assets/Search-YUJuRBLe-CecGUkZA.js.map +0 -1
- package/dist/assets/Server-Bfkkjui1-lBan_3Dm.js +0 -2
- package/dist/assets/Server-Bfkkjui1-lBan_3Dm.js.map +0 -1
- package/dist/assets/Settings-mbbylBS5-Cca-sV-_.js +0 -2
- package/dist/assets/Settings-mbbylBS5-Cca-sV-_.js.map +0 -1
- package/dist/assets/Synced-DKJXzPiw-Cui8pDsS.js +0 -2
- package/dist/assets/Synced-DKJXzPiw-Cui8pDsS.js.map +0 -1
- package/dist/assets/Syncing-aT9WSMFf-2VhhyCcX.js +0 -2
- package/dist/assets/Syncing-aT9WSMFf-2VhhyCcX.js.map +0 -1
- package/dist/assets/Trash-CgSbHk-P-DIYkVMER.js +0 -2
- package/dist/assets/Trash-CgSbHk-P-DIYkVMER.js.map +0 -1
- package/dist/assets/TrashFill-DN50ercb-Oqx67xXN.js +0 -2
- package/dist/assets/TrashFill-DN50ercb-Oqx67xXN.js.map +0 -1
- package/dist/assets/VariantArrowLeft-CnuX59_e-6Zt_Q3tm.js +0 -2
- package/dist/assets/VariantArrowLeft-CnuX59_e-6Zt_Q3tm.js.map +0 -1
- package/dist/assets/VerticalDots-C8QYf7et-CCxZfvjq.js +0 -2
- package/dist/assets/VerticalDots-C8QYf7et-CCxZfvjq.js.map +0 -1
- package/dist/assets/WarningFill-WowAvi5P-D5XCckM6.js +0 -2
- package/dist/assets/WarningFill-WowAvi5P-D5XCckM6.js.map +0 -1
- package/dist/assets/XTwitter-k3Pt8itk-mvLk8TKx.js +0 -2
- package/dist/assets/XTwitter-k3Pt8itk-mvLk8TKx.js.map +0 -1
- package/dist/assets/Xmark-8qnJCs2Y-CZ3t0Fap.js +0 -2
- package/dist/assets/Xmark-8qnJCs2Y-CZ3t0Fap.js.map +0 -1
- package/dist/assets/XmarkLight-GHzDR5_F-CloMvuzt.js +0 -2
- package/dist/assets/XmarkLight-GHzDR5_F-CloMvuzt.js.map +0 -1
- package/dist/assets/Youtube-i8V0IXUU-Bkiwoayp.js +0 -2
- package/dist/assets/Youtube-i8V0IXUU-Bkiwoayp.js.map +0 -1
- package/dist/assets/app-BdM_bCqD.js +0 -842
- package/dist/assets/app-BdM_bCqD.js.map +0 -1
- package/dist/assets/app-loader-B7xllAoS.js +0 -3
- package/dist/assets/app-loader-B7xllAoS.js.map +0 -1
- package/dist/assets/app-loader-D5wPX62N.css +0 -1
- package/dist/assets/browser-CwKAjz_f.js +0 -43
- package/dist/assets/browser-CwKAjz_f.js.map +0 -1
- package/dist/assets/browser-Dmr6AWWk.js +0 -2
- package/dist/assets/browser-Dmr6AWWk.js.map +0 -1
- package/dist/assets/ccip-BoVyVgwR.js +0 -2
- package/dist/assets/ccip-BoVyVgwR.js.map +0 -1
- package/dist/assets/content-BmCNR4Pw.js +0 -6
- package/dist/assets/content-BmCNR4Pw.js.map +0 -1
- package/dist/assets/editor-Cma-7Z7k.js +0 -2
- package/dist/assets/editor-Cma-7Z7k.js.map +0 -1
- package/dist/assets/editor-IMwm8pim.js +0 -2
- package/dist/assets/editor-IMwm8pim.js.map +0 -1
- package/dist/assets/editor-vgD9wEAH.js +0 -2
- package/dist/assets/editor-vgD9wEAH.js.map +0 -1
- package/dist/assets/editors-DQC0rqOg.js +0 -347
- package/dist/assets/editors-DQC0rqOg.js.map +0 -1
- package/dist/assets/index-BP2fj1j6.js +0 -16
- package/dist/assets/index-BP2fj1j6.js.map +0 -1
- package/dist/assets/index-SwNHx8hV.js +0 -3
- package/dist/assets/index-SwNHx8hV.js.map +0 -1
- package/dist/assets/index-T6Et30Eh-CdVwpIBO.js +0 -12
- package/dist/assets/index-T6Et30Eh-CdVwpIBO.js.map +0 -1
- package/dist/assets/main.DQ-aV7Qq.js +0 -2
- package/dist/assets/main.DQ-aV7Qq.js.map +0 -1
- package/dist/assets/root-BKJF0Yl6.js +0 -12
- package/dist/assets/root-BKJF0Yl6.js.map +0 -1
- package/dist/assets/router-Hd499Vrp.js +0 -12
- package/dist/assets/router-Hd499Vrp.js.map +0 -1
- package/dist/assets/useUiNodes-Ch-W4vsB.js +0 -107
- package/dist/assets/useUiNodes-Ch-W4vsB.js.map +0 -1
- package/dist/service-worker.js.map +0 -1
- package/dist/studio/cli.js +0 -6
- package/dist/studio/helpers.d.ts +0 -2
- package/dist/studio/index.d.ts +0 -20
- package/dist/studio/index.js +0 -580
- package/dist/studio/server.d.ts +0 -7
- package/dist/studio/vite-plugin.d.ts +0 -12
|
@@ -1,842 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BP2fj1j6.js","assets/main.DQ-aV7Qq.js","assets/app-loader-B7xllAoS.js","assets/app-loader-D5wPX62N.css","assets/browser-CwKAjz_f.js","assets/router-Hd499Vrp.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var HO=Object.defineProperty;var Gg=t=>{throw TypeError(t)};var WO=(t,e,n)=>e in t?HO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var qe=(t,e,n)=>WO(t,typeof e!="symbol"?e+"":e,n),$f=(t,e,n)=>e.has(t)||Gg("Cannot "+n);var Dt=(t,e,n)=>($f(t,e,"read from private field"),n?n.call(t):e.get(t)),jr=(t,e,n)=>e.has(t)?Gg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ma=(t,e,n,r)=>($f(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),mr=(t,e,n)=>($f(t,e,"access private method"),n);import{_ as Ko}from"./main.DQ-aV7Qq.js";import{jsx as Te,jsxs as Ft,Fragment as C_}from"react/jsx-runtime";import{AddLocalDriveModal as qO,AddRemoteDriveModal as ZO,ConnectConfirmationModal as GO,ReadRequiredModal as M_,FILE as bp,LOCAL as YO,ERROR as JO,CreateDocumentModal as XO,Modal as KO,Icon as Vl,Combobox as Za,Button as Mo,FormInput as Yg,ConnectDeleteDriveModal as QO,ConnectDeleteItemModal as e1,DriveSettingsModal as t1,SettingsModal as n1,DocumentSelectSettingsRow as r1,ClearStorageSettingsRow as i1,DependencyVersions as s1,ConnectUpgradeDriveModal as o1,CookieBanner as a1,WagmiContext as c1,UiNodesContextProvider as l1,ToastContainer as u1}from"@powerhousedao/design-system";import*as Fe from"react";import wi,{createElement as lc,isValidElement as Pu,cloneElement as d1,Children as f1,createContext as Ph,useContext as yl,useState as xn,useRef as Fu,useEffect as Pn,useReducer as p1,useDebugValue as h1,useCallback as Rt,useMemo as is,Suspense as m1}from"react";import{g as L_,a as Fh,c as vi,s as Hl,p as g1}from"./app-loader-B7xllAoS.js";function y1(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Ep(){return Ep=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ep.apply(null,arguments)}var ar=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function qV(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var v1={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const _1=vl(v1);var b1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Jg(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=t.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(e.name=n[1],(_1[n[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var r=t.indexOf("-->");return{type:"comment",comment:r!==-1?t.slice(4,r):""}}for(var i=new RegExp(b1),s=null;(s=i.exec(t))!==null;)if(s[0].trim())if(s[1]){var o=s[1].trim(),a=[o,""];o.indexOf("=")>-1&&(a=o.split("=")),e.attrs[a[0]]=a[1],i.lastIndex--}else s[2]&&(e.attrs[s[2]]=s[3].trim().substring(1,s[3].length-1));return e}var E1=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,S1=/^\s*$/,w1=Object.create(null);function P_(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(n){var r=[];for(var i in n)r.push(i+'="'+n[i]+'"');return r.length?" "+r.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(P_,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var T1={parse:function(t,e){e||(e={}),e.components||(e.components=w1);var n,r=[],i=[],s=-1,o=!1;if(t.indexOf("<")!==0){var a=t.indexOf("<");r.push({type:"text",content:a===-1?t:t.substring(0,a)})}return t.replace(E1,function(c,l){if(o){if(c!=="</"+n.name+">")return;o=!1}var u,d=c.charAt(1)!=="/",f=c.startsWith("<!--"),p=l+c.length,h=t.charAt(p);if(f){var m=Jg(c);return s<0?(r.push(m),r):((u=i[s]).children.push(m),r)}if(d&&(s++,(n=Jg(c)).type==="tag"&&e.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!h||h==="<"||n.children.push({type:"text",content:t.slice(p,t.indexOf("<",p))}),s===0&&r.push(n),(u=i[s-1])&&u.children.push(n),i[s]=n),(!d||n.voidElement)&&(s>-1&&(n.voidElement||n.name===c.slice(2,-1))&&(s--,n=s===-1?r:i[s]),!o&&h!=="<"&&h)){u=s===-1?r:i[s].children;var v=t.indexOf("<",p),y=t.slice(p,v===-1?void 0:v);S1.test(y)&&(y=" "),(v>-1&&s+u.length>=0||y!==" ")&&u.push({type:"text",content:y})}}),r},stringify:function(t){return t.reduce(function(e,n){return e+P_("",n)},"")}};function _u(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const Xg={};function $u(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&Xg[e[0]]||(typeof e[0]=="string"&&(Xg[e[0]]=new Date),_u(...e))}const F_=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function Kg(t,e,n){t.loadNamespaces(e,F_(t,n))}function Qg(t,e,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,F_(t,r))}function I1(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,c)=>{const l=e.services.backendConnector.state[`${a}|${c}`];return l===-1||l===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}function x1(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?($u("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,t))return!1}}):I1(t,e,n)}function jf(t,e){if(!t)return!1;const n=t.props?t.props.children:t.children;return e?n.length>0:!!n}function Uf(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?Lo(e):e}function O1(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Pu(e))}function Lo(t){return Array.isArray(t)?t:[t]}function D1(t,e){const n={...e};return n.props=Object.assign(t.props,e.props),n}function $_(t,e){if(!t)return"";let n="";const r=Lo(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return r.forEach((s,o)=>{if(typeof s=="string")n+=`${s}`;else if(Pu(s)){const a=Object.keys(s.props).length,c=i.indexOf(s.type)>-1,l=s.props.children;if(!l&&c&&a===0)n+=`<${s.type}/>`;else if(!l&&(!c||a!==0))n+=`<${o}></${o}>`;else if(s.props.i18nIsDynamicList)n+=`<${o}></${o}>`;else if(c&&a===1&&typeof l=="string")n+=`<${s.type}>${l}</${s.type}>`;else{const u=$_(l,e);n+=`<${o}>${u}</${o}>`}}else if(s===null)_u("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof s=="object"){const{format:a,...c}=s,l=Object.keys(c);if(l.length===1){const u=a?`${l[0]}, ${a}`:l[0];n+=`{{${u}}}`}else _u("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",s)}else _u("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",s)}),n}function R1(t,e,n,r,i,s){if(e==="")return[];const o=r.transKeepBasicHtmlNodesFor||[],a=e&&new RegExp(o.map(v=>`<${v}`).join("|")).test(e);if(!t&&!a&&!s)return[e];const c={};function l(v){Lo(v).forEach(g=>{typeof g!="string"&&(jf(g)?l(Uf(g)):typeof g=="object"&&!Pu(g)&&Object.assign(c,g))})}l(t);const u=T1.parse(`<0>${e}</0>`),d={...c,...i};function f(v,y,g){const _=Uf(v),T=h(_,y.children,g);return O1(_)&&T.length===0||v.props&&v.props.i18nIsDynamicList?_:T}function p(v,y,g,_,T){v.dummy?(v.children=y,g.push(d1(v,{key:_},T?void 0:y))):g.push(...f1.map([v],w=>{const E={...w.props};return delete E.i18nIsDynamicList,wi.createElement(w.type,Ep({},E,{key:_,ref:w.ref},T?{}:{children:y}))}))}function h(v,y,g){const _=Lo(v);return Lo(y).reduce((w,E,R)=>{const j=E.children&&E.children[0]&&E.children[0].content&&n.services.interpolator.interpolate(E.children[0].content,d,n.language);if(E.type==="tag"){let M=_[parseInt(E.name,10)];g.length===1&&!M&&(M=g[0][E.name]),M||(M={});const $=Object.keys(E.attrs).length!==0?D1({props:E.attrs},M):M,ne=Pu($),x=ne&&jf(E,!0)&&!E.voidElement,G=a&&typeof $=="object"&&$.dummy&&!ne,S=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,E.name);if(typeof $=="string"){const k=n.services.interpolator.interpolate($,d,n.language);w.push(k)}else if(jf($)||x){const k=f($,E,g);p($,k,w,R)}else if(G){const k=h(_,E.children,g);p($,k,w,R)}else if(Number.isNaN(parseFloat(E.name)))if(S){const k=f($,E,g);p($,k,w,R,E.voidElement)}else if(r.transSupportBasicHtmlNodes&&o.indexOf(E.name)>-1)if(E.voidElement)w.push(lc(E.name,{key:`${E.name}-${R}`}));else{const k=h(_,E.children,g);w.push(lc(E.name,{key:`${E.name}-${R}`},k))}else if(E.voidElement)w.push(`<${E.name} />`);else{const k=h(_,E.children,g);w.push(`<${E.name}>${k}</${E.name}>`)}else if(typeof $=="object"&&!ne){const k=E.children[0]?j:null;k&&w.push(k)}else p($,j,w,R,E.children.length!==1||!j)}else if(E.type==="text"){const M=r.transWrapTextNodes,$=s?r.unescape(n.services.interpolator.interpolate(E.content,d,n.language)):n.services.interpolator.interpolate(E.content,d,n.language);M?w.push(lc(M,{key:`${E.name}-${R}`},$)):w.push($)}return w},[])}const m=h([{dummy:!0,children:t||[]}],u,Lo(t||[]));return Uf(m[0])}function k1(t){let{children:e,count:n,parent:r,i18nKey:i,context:s,tOptions:o={},values:a,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...h}=t;const m=d||Fh();if(!m)return $u("You will need to pass in an i18next instance by using i18nextReactModule"),e;const v=f||m.t.bind(m)||(x=>x);s&&(o.context=s);const y={...L_(),...m.options&&m.options.react};let g=u||v.ns||m.options&&m.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"];const _=$_(e,y),T=c||_||y.transEmptyNodeValue||i,{hashTransKey:w}=y,E=i||(w?w(_||T):_||T);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(a=a&&Object.keys(a).length>0?{...a,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const R=a?o.interpolation:{interpolation:{...o.interpolation,prefix:"#$?",suffix:"?$#"}},j={...o,count:n,...a,...R,defaultValue:T,ns:g},M=E?v(E,j):T;l&&Object.keys(l).forEach(x=>{const G=l[x];if(typeof G.type=="function"||!G.props||!G.props.children||M.indexOf(`${x}/>`)<0&&M.indexOf(`${x} />`)<0)return;function S(){return wi.createElement(wi.Fragment,null,G)}l[x]=wi.createElement(S,null)});const $=R1(l||e,M,m,y,j,p),ne=r!==void 0?r:y.defaultTransParent;return ne?lc(ne,h,$):$}const j_=Ph();class N1{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function U_(t){let{children:e,count:n,parent:r,i18nKey:i,context:s,tOptions:o={},values:a,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...h}=t;const{i18n:m,defaultNS:v}=yl(j_)||{},y=d||m||Fh(),g=f||y&&y.t.bind(y);return k1({children:e,count:n,parent:r,i18nKey:i,context:s,tOptions:o,values:a,defaults:c,components:l,ns:u||g&&g.ns||v||y&&y.options&&y.options.defaultNS,i18n:y,t:f,shouldUnescape:p,...h})}const A1=(t,e)=>{const n=Fu();return Pn(()=>{n.current=t},[t,e]),n.current};function so(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:i}=yl(j_)||{},s=n||r||Fh();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new N1),!s){$u("You will need to pass in an i18next instance by using initReactI18next");const _=(w,E)=>typeof E=="string"?E:E&&typeof E=="object"&&typeof E.defaultValue=="string"?E.defaultValue:Array.isArray(w)?w[w.length-1]:w,T=[_,{},!1];return T.t=_,T.i18n={},T.ready=!1,T}s.options.react&&s.options.react.wait!==void 0&&$u("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...L_(),...s.options.react,...e},{useSuspense:a,keyPrefix:c}=o;let l=i||s.options&&s.options.defaultNS;l=typeof l=="string"?[l]:l||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(l);const u=(s.isInitialized||s.initializedStoreOnce)&&l.every(_=>x1(_,s,o));function d(){return s.getFixedT(e.lng||null,o.nsMode==="fallback"?l:l[0],c)}const[f,p]=xn(d);let h=l.join();e.lng&&(h=`${e.lng}${h}`);const m=A1(h),v=Fu(!0);Pn(()=>{const{bindI18n:_,bindI18nStore:T}=o;v.current=!0,!u&&!a&&(e.lng?Qg(s,e.lng,l,()=>{v.current&&p(d)}):Kg(s,l,()=>{v.current&&p(d)})),u&&m&&m!==h&&v.current&&p(d);function w(){v.current&&p(d)}return _&&s&&s.on(_,w),T&&s&&s.store.on(T,w),()=>{v.current=!1,_&&s&&_.split(" ").forEach(E=>s.off(E,w)),T&&s&&T.split(" ").forEach(E=>s.store.off(E,w))}},[s,h]);const y=Fu(!0);Pn(()=>{v.current&&!y.current&&p(d),y.current=!1},[s,c]);const g=[f,s,u];if(g.t=f,g.i18n=s,g.ready=u,u||!u&&!a)return g;throw new Promise(_=>{e.lng?Qg(s,e.lng,l,()=>_()):Kg(s,l,()=>_())})}let C1=0;function yn(t,e){const n=`atom${++C1}`,r={toString(){return n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=M1,r.write=L1),e&&(r.write=e),r}function M1(t){return t(this)}function L1(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const ey=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,ty=t=>"init"in t,ny=t=>!!t.write,ju=new WeakMap,Sp=t=>{var e;return wp(t)&&!((e=ju.get(t))!=null&&e[1])},P1=(t,e)=>{const n=ju.get(t);n&&(n[1]=!0,n[0].forEach(r=>r(e)))},F1=t=>{if(ju.has(t))return;const e=[new Set,!1];ju.set(t,e);const n=()=>{e[1]=!0};t.then(n,n),t.onCancel=r=>{e[0].add(r)}},wp=t=>typeof(t==null?void 0:t.then)=="function",ry=t=>"v"in t||"e"in t,Wl=t=>{if("e"in t)throw t.e;return t.v},B_=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},iy=(t,e,n,r,i)=>{var s;n.d.set(r,i.n),Sp(n.v)&&B_(e,n.v,i),(s=i.m)==null||s.t.add(e),t&&$1(t,r,e)},La=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),uc=(t,e,n)=>{t[e].add(n)},sy=(t,e,n)=>{t.D.has(e)||(t.D.set(e,new Set),uc(t,"M",()=>{var r;(r=n.m)==null||r.l.forEach(i=>uc(t,"M",i))}))},$1=(t,e,n)=>{const r=t.D.get(e);r&&r.add(n)},j1=(t,e)=>t.D.get(e),Ss=t=>{let e,n=!1;const r=i=>{try{i()}catch(s){n||(e=s,n=!0)}};for(;t.H.size||t.M.size||t.L.size;)t.D.clear(),t.H.forEach(r),t.H.clear(),t.M.forEach(r),t.M.clear(),t.L.forEach(r),t.L.clear();if(n)throw e},z_=(...[t,e,n,r])=>{const i=(y,g,_)=>{const T="v"in g,w=g.v,E=Sp(g.v)?g.v:null;if(wp(_)){F1(_);for(const R of g.d.keys())B_(y,_,t(R));g.v=_}else g.v=_;delete g.e,delete g.x,(!T||!Object.is(w,g.v))&&(++g.n,E&&P1(E,_))},s=(y,g)=>{var _;const T=t(g);if(ry(T)&&(T.m&&!T.x||Array.from(T.d).every(([$,ne])=>s(y,$).n===ne)))return T;T.d.clear();let w=!0;const E=$=>{if(ey(g,$)){const x=t($);if(!ry(x))if(ty($))i($,x,$.init);else throw new Error("no atom init");return Wl(x)}const ne=s(y,$);try{return Wl(ne)}finally{if(w)iy(y,g,T,$,ne);else{const x=La();iy(x,g,T,$,ne),d(x,g,T),Ss(x)}}};let R,j;const M={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return!j&&ny(g)&&(j=(...$)=>{if(!w)return u(g,...$)}),j}};try{const $=e(g,E,M);if(i(g,T,$),wp($)){(_=$.onCancel)==null||_.call($,()=>R==null?void 0:R.abort());const ne=()=>{if(T.m){const x=La();d(x,g,T),Ss(x)}};$.then(ne,ne)}return T}catch($){return delete T.v,T.e=$,delete T.x,++T.n,T}finally{w=!1}},o=y=>Wl(s(void 0,y)),a=(y,g,_)=>{var T,w;const E=new Map;for(const R of((T=_.m)==null?void 0:T.t)||[]){const j=t(R);j.m&&E.set(R,j)}for(const R of _.p)E.set(R,t(R));return(w=j1(y,g))==null||w.forEach(R=>{E.set(R,t(R))}),E},c=(y,g,_)=>{const T=[],w=new Set,E=new Set,R=[[g,_]];for(;R.length>0;){const[j,M]=R[R.length-1];if(E.has(j)){R.pop();continue}if(w.has(j)){T.push([j,M,M.n]),E.add(j),M.x=!0,R.pop();continue}w.add(j);for(const[$,ne]of a(y,j,M))j!==$&&!w.has($)&&R.push([$,ne])}uc(y,"H",()=>{const j=new Set([g]);for(let M=T.length-1;M>=0;--M){const[$,ne,x]=T[M];let G=!1;for(const S of ne.d.keys())if(S!==$&&j.has(S)){G=!0;break}G&&(s(y,$),d(y,$,ne),x!==ne.n&&(sy(y,$,ne),j.add($))),delete ne.x}})},l=(y,g,..._)=>{let T=!0;const w=R=>Wl(s(y,R)),E=(R,...j)=>{const M=t(R);try{if(ey(g,R)){if(!ty(R))throw new Error("atom not writable");const $=M.n,ne=j[0];i(R,M,ne),d(y,R,M),$!==M.n&&(sy(y,R,M),c(y,R,M));return}else return l(y,R,...j)}finally{T||Ss(y)}};try{return n(g,w,E,..._)}finally{T=!1}},u=(y,...g)=>{const _=La();try{return l(_,y,...g)}finally{Ss(_)}},d=(y,g,_)=>{if(_.m&&!Sp(_.v)){for(const T of _.d.keys())_.m.d.has(T)||(f(y,T,t(T)).t.add(g),_.m.d.add(T));for(const T of _.m.d||[])if(!_.d.has(T)){_.m.d.delete(T);const w=p(y,T,t(T));w==null||w.t.delete(g)}}},f=(y,g,_)=>{if(!_.m){s(y,g);for(const T of _.d.keys())f(y,T,t(T)).t.add(g);if(_.m={l:new Set,d:new Set(_.d.keys()),t:new Set},ny(g)){const T=_.m;let w;const E=(R,j)=>{let M=!0;w=(...$)=>{try{return l(R,g,...$)}finally{M||Ss(R)}};try{return j()}finally{M=!1}};uc(y,"L",()=>{const R=E(y,()=>r(g,(...j)=>w(...j)));R&&(T.u=j=>E(j,R))})}}return _.m},p=(y,g,_)=>{if(_.m&&!_.m.l.size&&!Array.from(_.m.t).some(T=>{var w;return(w=t(T).m)==null?void 0:w.d.has(g)})){const T=_.m.u;T&&uc(y,"L",()=>T(y)),delete _.m;for(const w of _.d.keys()){const E=p(y,w,t(w));E==null||E.t.delete(g)}return}return _.m};return{get:o,set:u,sub:(y,g)=>{const _=La(),T=t(y),E=f(_,y,T).l;return E.add(g),Ss(_),()=>{E.delete(g);const R=La();p(R,y,T),Ss(R)}},unstable_derive:y=>z_(...y(t,e,n,r))}},$h=()=>{const t=new WeakMap;return z_(r=>{let i=t.get(r);return i||(i={d:new Map,p:new Set,n:0},t.set(r,i)),i},(r,...i)=>r.read(...i),(r,...i)=>r.write(...i),(r,...i)=>{var s;return(s=r.onMount)==null?void 0:s.call(r,...i)})};let Bf;const U1=()=>(Bf||(Bf=$h()),Bf),V_=Ph(void 0),H_=t=>yl(V_)||U1(),B1=({children:t,store:e})=>{const n=Fu(void 0);return!e&&!n.current&&(n.current=$h()),lc(V_.Provider,{value:e||n.current},t)},W_=t=>typeof(t==null?void 0:t.then)=="function",z1=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},V1=wi.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(z1(t),t)}),zf=new WeakMap,H1=t=>{let e=zf.get(t);return e||(e=new Promise((n,r)=>{let i=t;const s=c=>l=>{i===c&&n(l)},o=c=>l=>{i===c&&r(l)},a=c=>{"onCancel"in c&&typeof c.onCancel=="function"&&c.onCancel(l=>{W_(l)?(zf.set(l,e),i=l,l.then(s(l),o(l)),a(l)):n(l)})};t.then(s(t),o(t)),a(t)}),zf.set(t,e)),e};function _l(t,e){const n=H_(),[[r,i,s],o]=p1(l=>{const u=n.get(t);return Object.is(l[0],u)&&l[1]===n&&l[2]===t?l:[u,n,t]},void 0,()=>[n.get(t),n,t]);let a=r;if((i!==n||s!==t)&&(o(),a=n.get(t)),Pn(()=>{const l=n.sub(t,()=>{o()});return o(),l},[n,t,void 0]),h1(a),W_(a)){const l=H1(a);return V1(l)}return a}function W1(t,e){const n=H_();return Rt((...i)=>n.set(t,...i),[n,t])}function Nr(t,e){return[_l(t),W1(t)]}const q1=Symbol("");function Z1(t,e){let n=null;const r=new Map,i=new Set,s=a=>{let c;if(c=r.get(a),c!==void 0)if(n!=null&&n(c[1],a))s.remove(a);else return c[0];const l=t(a);return r.set(a,[l,Date.now()]),o("CREATE",a,l),l};function o(a,c,l){for(const u of i)u({type:a,param:c,atom:l})}return s.unstable_listen=a=>(i.add(a),()=>{i.delete(a)}),s.getParams=()=>r.keys(),s.remove=a=>{{if(!r.has(a))return;const[c]=r.get(a);r.delete(a),o("REMOVE",a,c)}},s.setShouldRemove=a=>{if(n=a,!!n)for(const[c,[l,u]]of r)n(u,c)&&(r.delete(c),o("REMOVE",c,l))},s}const G1=t=>typeof(t==null?void 0:t.then)=="function";function Y1(t=()=>{try{return window.localStorage}catch{return}},e){var n;let r,i;const s={getItem:(c,l)=>{var u,d;const f=h=>{if(h=h||"",r!==h){try{i=JSON.parse(h,e==null?void 0:e.reviver)}catch{return l}r=h}return i},p=(d=(u=t())==null?void 0:u.getItem(c))!=null?d:null;return G1(p)?p.then(f):f(p)},setItem:(c,l)=>{var u;return(u=t())==null?void 0:u.setItem(c,JSON.stringify(l,void 0))},removeItem:c=>{var l;return(l=t())==null?void 0:l.removeItem(c)}},o=c=>(l,u,d)=>c(l,f=>{let p;try{p=JSON.parse(f||"")}catch{p=d}u(p)});let a;try{a=(n=t())==null?void 0:n.subscribe}catch{}return!a&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(a=(c,l)=>{if(!(t()instanceof window.Storage))return()=>{};const u=d=>{d.storageArea===t()&&d.key===c&&l(d.newValue)};return window.addEventListener("storage",u),()=>{window.removeEventListener("storage",u)}}),a&&(s.subscribe=o(a)),s}const J1=Y1();function q_(t,e,n=J1,r){const i=yn(e);return i.onMount=o=>{o(n.getItem(t,e));let a;return n.subscribe&&(a=n.subscribe(t,o,e)),a},yn(o=>o(i),(o,a,c)=>{const l=typeof c=="function"?c(o(i)):c;return l===q1?(a(i,e),n.removeItem(t)):l instanceof Promise?l.then(u=>(a(i,u),n.setItem(t,u))):(a(i,l),n.setItem(t,l))})}const oy=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),X1=new WeakMap,K1=(t,e,n)=>{const r=oy(()=>new WeakMap,X1,e);return oy(t,r,n)},Q1=t=>t instanceof Promise,eD=()=>{};function Z_(t,e=eD){return K1(()=>{const n=new WeakMap,r=new WeakMap,i=yn(0),s=yn((o,{setSelf:a})=>{o(i);const c=o(s),l=o(t);if(!Q1(l))return{v:l};if(l!==(c==null?void 0:c.p)&&l.then(u=>{r.set(l,u),a()},u=>{n.set(l,u),a()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:c&&"v"in c?{p:l,f:e(c.v),v:c.v}:{p:l,f:e()}},(o,a)=>{a(i,c=>c+1)});return s.init=void 0,yn(o=>{const a=o(s);return"f"in a?a.f:a.v},(o,a,...c)=>a(t,...c))},t,e)}const Ga=vi.routerBasename,bl=(t,e,n,r)=>q_(`${Ga}:${t}`,e,void 0),tD=(t,e,n)=>q_(t,e,{getItem(r,i){const s=localStorage.getItem(`${Ga}:${r}`);return s?JSON.parse(s):i},setItem(r,i){localStorage.setItem(`${Ga}:${r}`,JSON.stringify(i)),n(i)},removeItem(r){localStorage.removeItem(`${Ga}:${r}`)},subscribe(r,i){if(typeof window.addEventListener>"u")return()=>null;function s(o){o.storageArea===localStorage&&o.key===`${Ga}:${r}`&&i(o.newValue??"")}return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)}}),nD="acceptedCookies",rD=bl(nD,{analytics:!1,marketing:!1,functional:!1}),jh=()=>Nr(rD),iD="display-cookie-banner",sD=bl(iD,!0),oD=()=>Nr(sD);function aD(t){const{open:e,onAddLocalDrive:n,onClose:r}=t;async function i(s){await n(s),r()}return Te(qO,{open:e,onSubmit:i,onOpenChange:s=>{if(!s)return r()}})}const cD=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),lD=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),uD=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),dD=/[^\p{L}\d]+/giu,ay="$1\0$2",cy="";function G_(t){let e=t.trim();e=e.replace(cD,ay).replace(lD,ay),e=e.replace(dD,"\0");let n=0,r=e.length;for(;e.charAt(n)==="\0";)n++;if(n===r)return[];for(;e.charAt(r-1)==="\0";)r--;return e.slice(n,r).split(/\0/g)}function fD(t){const e=G_(t);for(let n=0;n<e.length;n++){const r=e[n],i=uD.exec(r);if(i){const s=i.index+(i[1]??i[2]).length;e.splice(n,1,r.slice(0,s),r.slice(s))}}return e}function Y_(t,e){const[n,r,i]=gD(t,e),s=pD(e==null?void 0:e.locale),o=hD(e==null?void 0:e.locale),a=mD(s,o);return n+r.map(a).join("")+i}function pD(t){return e=>e.toLocaleLowerCase(t)}function hD(t){return e=>e.toLocaleUpperCase(t)}function mD(t,e){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(n.slice(1))}}function gD(t,e={}){const n=e.split??(e.separateNumbers?fD:G_),r=e.prefixCharacters??cy,i=e.suffixCharacters??cy;let s=0,o=t.length;for(;s<t.length;){const a=t.charAt(s);if(!r.includes(a))break;s++}for(;o>s;){const a=o-1,c=t.charAt(a);if(!i.includes(c))break;o=a}return[t.slice(0,s),n(t.slice(s,o)),t.slice(o)]}function kt(t,e){if(!!!t)throw new Error(e)}function Bs(t){return typeof t=="object"&&t!==null}function xr(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const yD=/\r\n|[\n\r]/g;function Tp(t,e){let n=0,r=1;for(const i of t.body.matchAll(yD)){if(typeof i.index=="number"||xr(!1),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function vD(t){return J_(t.source,Tp(t.source,t.start))}function J_(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,i=e.line-1,s=t.locationOffset.line-1,o=e.line+s,a=e.line===1?n:0,c=e.column+a,l=`${t.name}:${o}:${c}
|
|
3
|
-
`,u=r.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const f=Math.floor(c/80),p=c%80,h=[];for(let m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return l+ly([[`${o} |`,h[0]],...h.slice(1,f+1).map(m=>["|",m]),["|","^".padStart(p)],["|",h[f+1]]])}return l+ly([[`${o-1} |`,u[i-1]],[`${o} |`,d],["|","^".padStart(c)],[`${o+1} |`,u[i+1]]])}function ly(t){const e=t.filter(([r,i])=>i!==void 0),n=Math.max(...e.map(([r])=>r.length));return e.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
4
|
-
`)}function _D(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class _e extends Error{constructor(e,...n){var r,i,s;const{nodes:o,source:a,positions:c,path:l,originalError:u,extensions:d}=_D(n);super(e),this.name="GraphQLError",this.path=l??void 0,this.originalError=u??void 0,this.nodes=uy(Array.isArray(o)?o:o?[o]:void 0);const f=uy((r=this.nodes)===null||r===void 0?void 0:r.map(h=>h.loc).filter(h=>h!=null));this.source=a??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=c??(f==null?void 0:f.map(h=>h.start)),this.locations=c&&a?c.map(h=>Tp(a,h)):f==null?void 0:f.map(h=>Tp(h.source,h.start));const p=Bs(u==null?void 0:u.extensions)?u==null?void 0:u.extensions:void 0;this.extensions=(s=d??p)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,_e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+=`
|
|
5
|
-
|
|
6
|
-
`+vD(n.loc));else if(this.source&&this.locations)for(const n of this.locations)e+=`
|
|
7
|
-
|
|
8
|
-
`+J_(this.source,n);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function uy(t){return t===void 0||t.length===0?void 0:t}function mn(t,e,n){return new _e(`Syntax Error: ${n}`,{source:t,positions:[e]})}class bD{constructor(e,n,r){this.start=e.start,this.end=n.end,this.startToken=e,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class X_{constructor(e,n,r,i,s,o){this.kind=e,this.start=n,this.end=r,this.line=i,this.column=s,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const K_={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},ED=new Set(Object.keys(K_));function dy(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&ED.has(e)}var cr;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(cr||(cr={}));var Ye;(function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(Ye||(Ye={}));var q;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(q||(q={}));function Ip(t){return t===9||t===32}function Ic(t){return t>=48&&t<=57}function Q_(t){return t>=97&&t<=122||t>=65&&t<=90}function Uh(t){return Q_(t)||t===95}function eb(t){return Q_(t)||Ic(t)||t===95}function SD(t){var e;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let o=0;o<t.length;++o){var s;const a=t[o],c=wD(a);c!==a.length&&(r=(s=r)!==null&&s!==void 0?s:o,i=o,o!==0&&c<n&&(n=c))}return t.map((o,a)=>a===0?o:o.slice(n)).slice((e=r)!==null&&e!==void 0?e:0,i+1)}function wD(t){let e=0;for(;e<t.length&&Ip(t.charCodeAt(e));)++e;return e}function TD(t,e){const n=t.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(p=>p.length===0||Ip(p.charCodeAt(0))),o=n.endsWith('\\"""'),a=t.endsWith('"')&&!o,c=t.endsWith("\\"),l=a||c,u=!i||t.length>70||l||s||o;let d="";const f=i&&Ip(t.charCodeAt(0));return(u&&!f||s)&&(d+=`
|
|
9
|
-
`),d+=n,(u||l)&&(d+=`
|
|
10
|
-
`),'"""'+d+'"""'}var fe;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(fe||(fe={}));class ID{constructor(e){const n=new X_(fe.SOF,0,0,0,0);this.source=e,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==fe.EOF)do if(e.next)e=e.next;else{const n=OD(this,e.end);e.next=n,n.prev=e,e=n}while(e.kind===fe.COMMENT);return e}}function xD(t){return t===fe.BANG||t===fe.DOLLAR||t===fe.AMP||t===fe.PAREN_L||t===fe.PAREN_R||t===fe.SPREAD||t===fe.COLON||t===fe.EQUALS||t===fe.AT||t===fe.BRACKET_L||t===fe.BRACKET_R||t===fe.BRACE_L||t===fe.PIPE||t===fe.BRACE_R}function va(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function $d(t,e){return tb(t.charCodeAt(e))&&nb(t.charCodeAt(e+1))}function tb(t){return t>=55296&&t<=56319}function nb(t){return t>=56320&&t<=57343}function zs(t,e){const n=t.source.body.codePointAt(e);if(n===void 0)return fe.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function an(t,e,n,r,i){const s=t.line,o=1+n-t.lineStart;return new X_(e,n,r,s,o,i)}function OD(t,e){const n=t.source.body,r=n.length;let i=e;for(;i<r;){const s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++t.line,t.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++t.line,t.lineStart=i;continue;case 35:return DD(t,i);case 33:return an(t,fe.BANG,i,i+1);case 36:return an(t,fe.DOLLAR,i,i+1);case 38:return an(t,fe.AMP,i,i+1);case 40:return an(t,fe.PAREN_L,i,i+1);case 41:return an(t,fe.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return an(t,fe.SPREAD,i,i+3);break;case 58:return an(t,fe.COLON,i,i+1);case 61:return an(t,fe.EQUALS,i,i+1);case 64:return an(t,fe.AT,i,i+1);case 91:return an(t,fe.BRACKET_L,i,i+1);case 93:return an(t,fe.BRACKET_R,i,i+1);case 123:return an(t,fe.BRACE_L,i,i+1);case 124:return an(t,fe.PIPE,i,i+1);case 125:return an(t,fe.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?MD(t,i):kD(t,i)}if(Ic(s)||s===45)return RD(t,i,s);if(Uh(s))return LD(t,i);throw mn(t.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:va(s)||$d(n,i)?`Unexpected character: ${zs(t,i)}.`:`Invalid character: ${zs(t,i)}.`)}return an(t,fe.EOF,r,r)}function DD(t,e){const n=t.source.body,r=n.length;let i=e+1;for(;i<r;){const s=n.charCodeAt(i);if(s===10||s===13)break;if(va(s))++i;else if($d(n,i))i+=2;else break}return an(t,fe.COMMENT,e,i,n.slice(e+1,i))}function RD(t,e,n){const r=t.source.body;let i=e,s=n,o=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),Ic(s))throw mn(t.source,i,`Invalid number, unexpected digit after 0: ${zs(t,i)}.`)}else i=Vf(t,i,s),s=r.charCodeAt(i);if(s===46&&(o=!0,s=r.charCodeAt(++i),i=Vf(t,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(o=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=Vf(t,i,s),s=r.charCodeAt(i)),s===46||Uh(s))throw mn(t.source,i,`Invalid number, expected digit but got: ${zs(t,i)}.`);return an(t,o?fe.FLOAT:fe.INT,e,i,r.slice(e,i))}function Vf(t,e,n){if(!Ic(n))throw mn(t.source,e,`Invalid number, expected digit but got: ${zs(t,e)}.`);const r=t.source.body;let i=e+1;for(;Ic(r.charCodeAt(i));)++i;return i}function kD(t,e){const n=t.source.body,r=n.length;let i=e+1,s=i,o="";for(;i<r;){const a=n.charCodeAt(i);if(a===34)return o+=n.slice(s,i),an(t,fe.STRING,e,i+1,o);if(a===92){o+=n.slice(s,i);const c=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ND(t,i):AD(t,i):CD(t,i);o+=c.value,i+=c.size,s=i;continue}if(a===10||a===13)break;if(va(a))++i;else if($d(n,i))i+=2;else throw mn(t.source,i,`Invalid character within String: ${zs(t,i)}.`)}throw mn(t.source,i,"Unterminated string.")}function ND(t,e){const n=t.source.body;let r=0,i=3;for(;i<12;){const s=n.charCodeAt(e+i++);if(s===125){if(i<5||!va(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Ya(s),r<0)break}throw mn(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+i)}".`)}function AD(t,e){const n=t.source.body,r=fy(n,e+2);if(va(r))return{value:String.fromCodePoint(r),size:6};if(tb(r)&&n.charCodeAt(e+6)===92&&n.charCodeAt(e+7)===117){const i=fy(n,e+8);if(nb(i))return{value:String.fromCodePoint(r,i),size:12}}throw mn(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function fy(t,e){return Ya(t.charCodeAt(e))<<12|Ya(t.charCodeAt(e+1))<<8|Ya(t.charCodeAt(e+2))<<4|Ya(t.charCodeAt(e+3))}function Ya(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function CD(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
11
|
-
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw mn(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function MD(t,e){const n=t.source.body,r=n.length;let i=t.lineStart,s=e+3,o=s,a="";const c=[];for(;s<r;){const l=n.charCodeAt(s);if(l===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){a+=n.slice(o,s),c.push(a);const u=an(t,fe.BLOCK_STRING,e,s+3,SD(c).join(`
|
|
12
|
-
`));return t.line+=c.length-1,t.lineStart=i,u}if(l===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){a+=n.slice(o,s),o=s+1,s+=4;continue}if(l===10||l===13){a+=n.slice(o,s),c.push(a),l===13&&n.charCodeAt(s+1)===10?s+=2:++s,a="",o=s,i=s;continue}if(va(l))++s;else if($d(n,s))s+=2;else throw mn(t.source,s,`Invalid character within String: ${zs(t,s)}.`)}throw mn(t.source,s,"Unterminated string.")}function LD(t,e){const n=t.source.body,r=n.length;let i=e+1;for(;i<r;){const s=n.charCodeAt(i);if(eb(s))++i;else break}return an(t,fe.NAME,e,i,n.slice(e,i))}const PD=10,rb=2;function Ze(t){return jd(t,[])}function jd(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return FD(t,e);default:return String(t)}}function FD(t,e){if(t===null)return"null";if(e.includes(t))return"[Circular]";const n=[...e,t];if($D(t)){const r=t.toJSON();if(r!==t)return typeof r=="string"?r:jd(r,n)}else if(Array.isArray(t))return UD(t,n);return jD(t,n)}function $D(t){return typeof t.toJSON=="function"}function jD(t,e){const n=Object.entries(t);return n.length===0?"{}":e.length>rb?"["+BD(t)+"]":"{ "+n.map(([i,s])=>i+": "+jd(s,e)).join(", ")+" }"}function UD(t,e){if(t.length===0)return"[]";if(e.length>rb)return"[Array]";const n=Math.min(PD,t.length),r=t.length-n,i=[];for(let s=0;s<n;++s)i.push(jd(t[s],e));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function BD(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const n=t.constructor.name;if(typeof n=="string"&&n!=="")return n}return e}const zD=globalThis.process&&!0,ri=zD?function(e,n){return e instanceof n}:function(e,n){if(e instanceof n)return!0;if(typeof e=="object"&&e!==null){var r;const i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in e?e[Symbol.toStringTag]:(r=e.constructor)===null||r===void 0?void 0:r.name;if(i===s){const o=Ze(e);throw new Error(`Cannot use ${i} "${o}" from another module or realm.
|
|
13
|
-
|
|
14
|
-
Ensure that there is only one instance of "graphql" in the node_modules
|
|
15
|
-
directory. If different versions of "graphql" are the dependencies of other
|
|
16
|
-
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
17
|
-
|
|
18
|
-
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
19
|
-
|
|
20
|
-
Duplicate "graphql" modules cannot be used at the same time since different
|
|
21
|
-
versions may have different capabilities and behavior. The data from one
|
|
22
|
-
version used in the function from another could produce confusing and
|
|
23
|
-
spurious results.`)}}return!1};class ib{constructor(e,n="GraphQL request",r={line:1,column:1}){typeof e=="string"||kt(!1,`Body must be a string. Received: ${Ze(e)}.`),this.body=e,this.name=n,this.locationOffset=r,this.locationOffset.line>0||kt(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||kt(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function VD(t){return ri(t,ib)}function sb(t,e){const n=new HD(t,e),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}class HD{constructor(e,n={}){const r=VD(e)?e:new ib(e);this._lexer=new ID(r),this._options=n,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(fe.NAME);return this.node(e,{kind:q.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:q.DOCUMENT,definitions:this.many(fe.SOF,this.parseDefinition,fe.EOF)})}parseDefinition(){if(this.peek(fe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(n.kind===fe.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw mn(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(fe.BRACE_L))return this.node(e,{kind:q.OPERATION_DEFINITION,operation:cr.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(fe.NAME)&&(r=this.parseName()),this.node(e,{kind:q.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(fe.NAME);switch(e.value){case"query":return cr.QUERY;case"mutation":return cr.MUTATION;case"subscription":return cr.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(fe.PAREN_L,this.parseVariableDefinition,fe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:q.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(fe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(fe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(fe.DOLLAR),this.node(e,{kind:q.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:q.SELECTION_SET,selections:this.many(fe.BRACE_L,this.parseSelection,fe.BRACE_R)})}parseSelection(){return this.peek(fe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(fe.COLON)?(r=n,i=this.parseName()):i=n,this.node(e,{kind:q.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(fe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const n=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(fe.PAREN_L,n,fe.PAREN_R)}parseArgument(e=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(fe.COLON),this.node(n,{kind:q.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(fe.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(fe.NAME)?this.node(e,{kind:q.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:q.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const n=this._lexer.token;switch(n.kind){case fe.BRACKET_L:return this.parseList(e);case fe.BRACE_L:return this.parseObject(e);case fe.INT:return this.advanceLexer(),this.node(n,{kind:q.INT,value:n.value});case fe.FLOAT:return this.advanceLexer(),this.node(n,{kind:q.FLOAT,value:n.value});case fe.STRING:case fe.BLOCK_STRING:return this.parseStringLiteral();case fe.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:q.BOOLEAN,value:!0});case"false":return this.node(n,{kind:q.BOOLEAN,value:!1});case"null":return this.node(n,{kind:q.NULL});default:return this.node(n,{kind:q.ENUM,value:n.value})}case fe.DOLLAR:if(e)if(this.expectToken(fe.DOLLAR),this._lexer.token.kind===fe.NAME){const r=this._lexer.token.value;throw mn(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:q.STRING,value:e.value,block:e.kind===fe.BLOCK_STRING})}parseList(e){const n=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:q.LIST,values:this.any(fe.BRACKET_L,n,fe.BRACKET_R)})}parseObject(e){const n=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:q.OBJECT,fields:this.any(fe.BRACE_L,n,fe.BRACE_R)})}parseObjectField(e){const n=this._lexer.token,r=this.parseName();return this.expectToken(fe.COLON),this.node(n,{kind:q.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const n=[];for(;this.peek(fe.AT);)n.push(this.parseDirective(e));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const n=this._lexer.token;return this.expectToken(fe.AT),this.node(n,{kind:q.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let n;if(this.expectOptionalToken(fe.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(fe.BRACKET_R),n=this.node(e,{kind:q.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(fe.BANG)?this.node(e,{kind:q.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:q.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(fe.STRING)||this.peek(fe.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(fe.BRACE_L,this.parseOperationTypeDefinition,fe.BRACE_R);return this.node(e,{kind:q.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,n=this.parseOperationType();this.expectToken(fe.COLON);const r=this.parseNamedType();return this.node(e,{kind:q.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:q.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:q.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(fe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(fe.BRACE_L,this.parseFieldDefinition,fe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(fe.COLON);const s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:q.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(fe.PAREN_L,this.parseInputValueDef,fe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(fe.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(fe.EQUALS)&&(s=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:q.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:q.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(e,{kind:q.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(fe.EQUALS)?this.delimitedMany(fe.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(e,{kind:q.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(fe.BRACE_L,this.parseEnumValueDefinition,fe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:q.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw mn(this._lexer.source,this._lexer.token.start,`${ql(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(e,{kind:q.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(fe.BRACE_L,this.parseInputValueDef,fe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===fe.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(fe.BRACE_L,this.parseOperationTypeDefinition,fe.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:q.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(e,{kind:q.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:q.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:q.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:q.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:q.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:q.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(fe.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:q.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:o})}parseDirectiveLocations(){return this.delimitedMany(fe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(Ye,n.value))return n;throw this.unexpected(e)}node(e,n){return this._options.noLocation!==!0&&(n.loc=new bD(e,this._lexer.lastToken,this._lexer.source)),n}peek(e){return this._lexer.token.kind===e}expectToken(e){const n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw mn(this._lexer.source,n.start,`Expected ${ob(e)}, found ${ql(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const n=this._lexer.token;if(n.kind===fe.NAME&&n.value===e)this.advanceLexer();else throw mn(this._lexer.source,n.start,`Expected "${e}", found ${ql(n)}.`)}expectOptionalKeyword(e){const n=this._lexer.token;return n.kind===fe.NAME&&n.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const n=e??this._lexer.token;return mn(this._lexer.source,n.start,`Unexpected ${ql(n)}.`)}any(e,n,r){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(e,n,r){if(this.expectOptionalToken(e)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(e,n,r){this.expectToken(e);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(e,n){this.expectOptionalToken(e);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(e));return r}advanceLexer(){const{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==fe.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw mn(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ql(t){const e=t.value;return ob(t.kind)+(e!=null?` "${e}"`:"")}function ob(t){return xD(t)?`"${t}"`:t}const WD=5;function ss(t,e){const[n,r]=e?[t,e]:[void 0,t];let i=" Did you mean ";n&&(i+=n+" ");const s=r.map(c=>`"${c}"`);switch(s.length){case 0:return"";case 1:return i+s[0]+"?";case 2:return i+s[0]+" or "+s[1]+"?"}const o=s.slice(0,WD),a=o.pop();return i+o.join(", ")+", or "+a+"?"}function py(t){return t}function Vs(t,e){const n=Object.create(null);for(const r of t)n[e(r)]=r;return n}function Bh(t,e,n){const r=Object.create(null);for(const i of t)r[e(i)]=n(i);return r}function _i(t,e){const n=Object.create(null);for(const r of Object.keys(t))n[r]=e(t[r],r);return n}function zh(t,e){let n=0,r=0;for(;n<t.length&&r<e.length;){let i=t.charCodeAt(n),s=e.charCodeAt(r);if(Zl(i)&&Zl(s)){let o=0;do++n,o=o*10+i-xp,i=t.charCodeAt(n);while(Zl(i)&&o>0);let a=0;do++r,a=a*10+s-xp,s=e.charCodeAt(r);while(Zl(s)&&a>0);if(o<a)return-1;if(o>a)return 1}else{if(i<s)return-1;if(i>s)return 1;++n,++r}}return t.length-e.length}const xp=48,qD=57;function Zl(t){return!isNaN(t)&&xp<=t&&t<=qD}function oo(t,e){const n=Object.create(null),r=new ZD(t),i=Math.floor(t.length*.4)+1;for(const s of e){const o=r.measure(s,i);o!==void 0&&(n[s]=o)}return Object.keys(n).sort((s,o)=>{const a=n[s]-n[o];return a!==0?a:zh(s,o)})}class ZD{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=hy(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,n){if(this._input===e)return 0;const r=e.toLowerCase();if(this._inputLowerCase===r)return 1;let i=hy(r),s=this._inputArray;if(i.length<s.length){const u=i;i=s,s=u}const o=i.length,a=s.length;if(o-a>n)return;const c=this._rows;for(let u=0;u<=a;u++)c[0][u]=u;for(let u=1;u<=o;u++){const d=c[(u-1)%3],f=c[u%3];let p=f[0]=u;for(let h=1;h<=a;h++){const m=i[u-1]===s[h-1]?0:1;let v=Math.min(d[h]+1,f[h-1]+1,d[h-1]+m);if(u>1&&h>1&&i[u-1]===s[h-2]&&i[u-2]===s[h-1]){const y=c[(u-2)%3][h-2];v=Math.min(v,y+1)}v<p&&(p=v),f[h]=v}if(p>n)return}const l=c[o%3][a];return l<=n?l:void 0}}function hy(t){const e=t.length,n=new Array(e);for(let r=0;r<e;++r)n[r]=t.charCodeAt(r);return n}function fr(t){if(t==null)return Object.create(null);if(Object.getPrototypeOf(t)===null)return t;const e=Object.create(null);for(const[n,r]of Object.entries(t))e[n]=r;return e}function GD(t){return`"${t.replace(YD,JD)}"`}const YD=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function JD(t){return XD[t.charCodeAt(0)]}const XD=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Ja=Object.freeze({});function ab(t,e,n=K_){const r=new Map;for(const y of Object.values(q))r.set(y,cb(e,y));let i,s=Array.isArray(t),o=[t],a=-1,c=[],l=t,u,d;const f=[],p=[];do{a++;const y=a===o.length,g=y&&c.length!==0;if(y){if(u=p.length===0?void 0:f[f.length-1],l=d,d=p.pop(),g)if(s){l=l.slice();let T=0;for(const[w,E]of c){const R=w-T;E===null?(l.splice(R,1),T++):l[R]=E}}else{l=Object.defineProperties({},Object.getOwnPropertyDescriptors(l));for(const[T,w]of c)l[T]=w}a=i.index,o=i.keys,c=i.edits,s=i.inArray,i=i.prev}else if(d){if(u=s?a:o[a],l=d[u],l==null)continue;f.push(u)}let _;if(!Array.isArray(l)){var h,m;dy(l)||kt(!1,`Invalid AST Node: ${Ze(l)}.`);const T=y?(h=r.get(l.kind))===null||h===void 0?void 0:h.leave:(m=r.get(l.kind))===null||m===void 0?void 0:m.enter;if(_=T==null?void 0:T.call(e,l,u,d,f,p),_===Ja)break;if(_===!1){if(!y){f.pop();continue}}else if(_!==void 0&&(c.push([u,_]),!y))if(dy(_))l=_;else{f.pop();continue}}if(_===void 0&&g&&c.push([u,l]),y)f.pop();else{var v;i={inArray:s,index:a,keys:o,edits:c,prev:i},s=Array.isArray(l),o=s?l:(v=n[l.kind])!==null&&v!==void 0?v:[],a=-1,c=[],d&&p.push(d),d=l}}while(i!==void 0);return c.length!==0?c[c.length-1][1]:t}function KD(t){const e=new Array(t.length).fill(null),n=Object.create(null);for(const r of Object.values(q)){let i=!1;const s=new Array(t.length).fill(void 0),o=new Array(t.length).fill(void 0);for(let c=0;c<t.length;++c){const{enter:l,leave:u}=cb(t[c],r);i||(i=l!=null||u!=null),s[c]=l,o[c]=u}if(!i)continue;const a={enter(...c){const l=c[0];for(let d=0;d<t.length;d++)if(e[d]===null){var u;const f=(u=s[d])===null||u===void 0?void 0:u.apply(t[d],c);if(f===!1)e[d]=l;else if(f===Ja)e[d]=Ja;else if(f!==void 0)return f}},leave(...c){const l=c[0];for(let d=0;d<t.length;d++)if(e[d]===null){var u;const f=(u=o[d])===null||u===void 0?void 0:u.apply(t[d],c);if(f===Ja)e[d]=Ja;else if(f!==void 0&&f!==!1)return f}else e[d]===l&&(e[d]=null)}};n[r]=a}return n}function cb(t,e){const n=t[e];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}function fn(t){return ab(t,eR)}const QD=80,eR={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>Pe(t.definitions,`
|
|
24
|
-
|
|
25
|
-
`)},OperationDefinition:{leave(t){const e=_t("(",Pe(t.variableDefinitions,", "),")"),n=Pe([t.operation,Pe([t.name,e]),Pe(t.directives," ")]," ");return(n==="query"?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+_t(" = ",n)+_t(" ",Pe(r," "))},SelectionSet:{leave:({selections:t})=>gr(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:i}){const s=_t("",t,": ")+e;let o=s+_t("(",Pe(n,", "),")");return o.length>QD&&(o=s+_t(`(
|
|
26
|
-
`,bu(Pe(n,`
|
|
27
|
-
`)),`
|
|
28
|
-
)`)),Pe([o,Pe(r," "),i]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+_t(" ",Pe(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>Pe(["...",_t("on ",t),Pe(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${t}${_t("(",Pe(n,", "),")")} on ${e} ${_t("",Pe(r," ")," ")}`+i},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?TD(t):GD(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+Pe(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+Pe(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+_t("(",Pe(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>_t("",t,`
|
|
29
|
-
`)+Pe(["schema",Pe(e," "),gr(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>_t("",t,`
|
|
30
|
-
`)+Pe(["scalar",e,Pe(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:r,fields:i})=>_t("",t,`
|
|
31
|
-
`)+Pe(["type",e,_t("implements ",Pe(n," & ")),Pe(r," "),gr(i)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:i})=>_t("",t,`
|
|
32
|
-
`)+e+(my(n)?_t(`(
|
|
33
|
-
`,bu(Pe(n,`
|
|
34
|
-
`)),`
|
|
35
|
-
)`):_t("(",Pe(n,", "),")"))+": "+r+_t(" ",Pe(i," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:i})=>_t("",t,`
|
|
36
|
-
`)+Pe([e+": "+n,_t("= ",r),Pe(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:r,fields:i})=>_t("",t,`
|
|
37
|
-
`)+Pe(["interface",e,_t("implements ",Pe(n," & ")),Pe(r," "),gr(i)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>_t("",t,`
|
|
38
|
-
`)+Pe(["union",e,Pe(n," "),_t("= ",Pe(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:r})=>_t("",t,`
|
|
39
|
-
`)+Pe(["enum",e,Pe(n," "),gr(r)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>_t("",t,`
|
|
40
|
-
`)+Pe([e,Pe(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:r})=>_t("",t,`
|
|
41
|
-
`)+Pe(["input",e,Pe(n," "),gr(r)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:i})=>_t("",t,`
|
|
42
|
-
`)+"directive @"+e+(my(n)?_t(`(
|
|
43
|
-
`,bu(Pe(n,`
|
|
44
|
-
`)),`
|
|
45
|
-
)`):_t("(",Pe(n,", "),")"))+(r?" repeatable":"")+" on "+Pe(i," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>Pe(["extend schema",Pe(t," "),gr(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>Pe(["extend scalar",t,Pe(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:r})=>Pe(["extend type",t,_t("implements ",Pe(e," & ")),Pe(n," "),gr(r)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:r})=>Pe(["extend interface",t,_t("implements ",Pe(e," & ")),Pe(n," "),gr(r)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>Pe(["extend union",t,Pe(e," "),_t("= ",Pe(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>Pe(["extend enum",t,Pe(e," "),gr(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>Pe(["extend input",t,Pe(e," "),gr(n)]," ")}};function Pe(t,e=""){var n;return(n=t==null?void 0:t.filter(r=>r).join(e))!==null&&n!==void 0?n:""}function gr(t){return _t(`{
|
|
46
|
-
`,bu(Pe(t,`
|
|
47
|
-
`)),`
|
|
48
|
-
}`)}function _t(t,e,n=""){return e!=null&&e!==""?t+e+n:""}function bu(t){return _t(" ",t.replace(/\n/g,`
|
|
49
|
-
`))}function my(t){var e;return(e=t==null?void 0:t.some(n=>n.includes(`
|
|
50
|
-
`)))!==null&&e!==void 0?e:!1}function Op(t,e){switch(t.kind){case q.NULL:return null;case q.INT:return parseInt(t.value,10);case q.FLOAT:return parseFloat(t.value);case q.STRING:case q.ENUM:case q.BOOLEAN:return t.value;case q.LIST:return t.values.map(n=>Op(n,e));case q.OBJECT:return Bh(t.fields,n=>n.name.value,n=>Op(n.value,e));case q.VARIABLE:return e==null?void 0:e[t.name.value]}}function Lr(t){if(t!=null||kt(!1,"Must provide name."),typeof t=="string"||kt(!1,"Expected name to be a string."),t.length===0)throw new _e("Expected name to be a non-empty string.");for(let e=1;e<t.length;++e)if(!eb(t.charCodeAt(e)))throw new _e(`Names must only contain [_a-zA-Z0-9] but "${t}" does not.`);if(!Uh(t.charCodeAt(0)))throw new _e(`Names must start with [_a-zA-Z] but "${t}" does not.`);return t}function tR(t){if(t==="true"||t==="false"||t==="null")throw new _e(`Enum values cannot be named: ${t}`);return Lr(t)}function Vh(t){return _a(t)||Ln(t)||vn(t)||xi(t)||Oi(t)||Qn(t)||er(t)||Vt(t)}function _a(t){return ri(t,Di)}function Ln(t){return ri(t,lr)}function vn(t){return ri(t,Dp)}function xi(t){return ri(t,Vo)}function Oi(t){return ri(t,Oc)}function Qn(t){return ri(t,Rp)}function er(t){return ri(t,An)}function Vt(t){return ri(t,pt)}function lb(t){return _a(t)||Oi(t)||Qn(t)||ub(t)&&lb(t.ofType)}function Qo(t){return _a(t)||Oi(t)}function xc(t){return Ln(t)||vn(t)||xi(t)}function Fs(t){return vn(t)||xi(t)}class An{constructor(e){Vh(e)||kt(!1,`Expected ${Ze(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class pt{constructor(e){nR(e)||kt(!1,`Expected ${Ze(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function ub(t){return er(t)||Vt(t)}function nR(t){return Vh(t)&&!Vt(t)}function rR(t){if(t)return Vt(t)?t.ofType:t}function Hs(t){if(t){let e=t;for(;ub(e);)e=e.ofType;return e}}function db(t){return typeof t=="function"?t():t}function fb(t){return typeof t=="function"?t():t}class Di{constructor(e){var n,r,i,s;const o=(n=e.parseValue)!==null&&n!==void 0?n:py;this.name=Lr(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=(r=e.serialize)!==null&&r!==void 0?r:py,this.parseValue=o,this.parseLiteral=(i=e.parseLiteral)!==null&&i!==void 0?i:(a,c)=>o(Op(a,c)),this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(s=e.extensionASTNodes)!==null&&s!==void 0?s:[],e.specifiedByURL==null||typeof e.specifiedByURL=="string"||kt(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${Ze(e.specifiedByURL)}.`),e.serialize==null||typeof e.serialize=="function"||kt(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&(typeof e.parseValue=="function"&&typeof e.parseLiteral=="function"||kt(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class lr{constructor(e){var n;this.name=Lr(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=()=>hb(e),this._interfaces=()=>pb(e),e.isTypeOf==null||typeof e.isTypeOf=="function"||kt(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${Ze(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:gb(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function pb(t){var e;const n=db((e=t.interfaces)!==null&&e!==void 0?e:[]);return Array.isArray(n)||kt(!1,`${t.name} interfaces must be an Array or a function which returns an Array.`),n}function hb(t){const e=fb(t.fields);return zo(e)||kt(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),_i(e,(n,r)=>{var i;zo(n)||kt(!1,`${t.name}.${r} field config must be an object.`),n.resolve==null||typeof n.resolve=="function"||kt(!1,`${t.name}.${r} field resolver must be a function if provided, but got: ${Ze(n.resolve)}.`);const s=(i=n.args)!==null&&i!==void 0?i:{};return zo(s)||kt(!1,`${t.name}.${r} args must be an object with argument names as keys.`),{name:Lr(r),description:n.description,type:n.type,args:mb(s),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:fr(n.extensions),astNode:n.astNode}})}function mb(t){return Object.entries(t).map(([e,n])=>({name:Lr(e),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:fr(n.extensions),astNode:n.astNode}))}function zo(t){return Bs(t)&&!Array.isArray(t)}function gb(t){return _i(t,e=>({description:e.description,type:e.type,args:yb(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function yb(t){return Bh(t,e=>e.name,e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function vb(t){return Vt(t.type)&&t.defaultValue===void 0}class Dp{constructor(e){var n;this.name=Lr(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=hb.bind(void 0,e),this._interfaces=pb.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||kt(!1,`${this.name} must provide "resolveType" as a function, but got: ${Ze(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:gb(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Vo{constructor(e){var n;this.name=Lr(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this._types=iR.bind(void 0,e),e.resolveType==null||typeof e.resolveType=="function"||kt(!1,`${this.name} must provide "resolveType" as a function, but got: ${Ze(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function iR(t){const e=db(t.types);return Array.isArray(e)||kt(!1,`Must provide Array of types or a function which returns such an array for Union ${t.name}.`),e}class Oc{constructor(e){var n;this.name=Lr(e.name),this.description=e.description,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this._values=typeof e.values=="function"?e.values:gy(this.name,e.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=gy(this.name,this._values())),this._values}getValue(e){return this._nameLookup===null&&(this._nameLookup=Vs(this.getValues(),n=>n.name)),this._nameLookup[e]}serialize(e){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(r=>[r.value,r])));const n=this._valueLookup.get(e);if(n===void 0)throw new _e(`Enum "${this.name}" cannot represent value: ${Ze(e)}`);return n.name}parseValue(e){if(typeof e!="string"){const r=Ze(e);throw new _e(`Enum "${this.name}" cannot represent non-string value: ${r}.`+Gl(this,r))}const n=this.getValue(e);if(n==null)throw new _e(`Value "${e}" does not exist in "${this.name}" enum.`+Gl(this,e));return n.value}parseLiteral(e,n){if(e.kind!==q.ENUM){const i=fn(e);throw new _e(`Enum "${this.name}" cannot represent non-enum value: ${i}.`+Gl(this,i),{nodes:e})}const r=this.getValue(e.value);if(r==null){const i=fn(e);throw new _e(`Value "${i}" does not exist in "${this.name}" enum.`+Gl(this,i),{nodes:e})}return r.value}toConfig(){const e=Bh(this.getValues(),n=>n.name,n=>({description:n.description,value:n.value,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Gl(t,e){const n=t.getValues().map(i=>i.name),r=oo(e,n);return ss("the enum value",r)}function gy(t,e){return zo(e)||kt(!1,`${t} values must be an object with value names as keys.`),Object.entries(e).map(([n,r])=>(zo(r)||kt(!1,`${t}.${n} must refer to an object with a "value" key representing an internal value but got: ${Ze(r)}.`),{name:tR(n),description:r.description,value:r.value!==void 0?r.value:n,deprecationReason:r.deprecationReason,extensions:fr(r.extensions),astNode:r.astNode}))}class Rp{constructor(e){var n,r;this.name=Lr(e.name),this.description=e.description,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this.isOneOf=(r=e.isOneOf)!==null&&r!==void 0?r:!1,this._fields=sR.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const e=_i(this.getFields(),n=>({description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function sR(t){const e=fb(t.fields);return zo(e)||kt(!1,`${t.name} fields must be an object with field names as keys or a function which returns such an object.`),_i(e,(n,r)=>(!("resolve"in n)||kt(!1,`${t.name}.${r} field has a resolve property, but Input Types cannot define resolvers.`),{name:Lr(r),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:fr(n.extensions),astNode:n.astNode}))}function oR(t){return Vt(t.type)&&t.defaultValue===void 0}function dc(t,e,n){return e===n?!0:Vt(n)?Vt(e)?dc(t,e.ofType,n.ofType):!1:Vt(e)?dc(t,e.ofType,n):er(n)?er(e)?dc(t,e.ofType,n.ofType):!1:er(e)?!1:Fs(n)&&(vn(e)||Ln(e))&&t.isSubType(n,e)}function yy(t,e,n){return e===n?!0:Fs(e)?Fs(n)?t.getPossibleTypes(e).some(r=>t.isSubType(n,r)):t.isSubType(e,n):Fs(n)?t.isSubType(n,e):!1}const Hf=2147483647,Wf=-2147483648,aR=new Di({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(t){const e=El(t);if(typeof e=="boolean")return e?1:0;let n=e;if(typeof e=="string"&&e!==""&&(n=Number(e)),typeof n!="number"||!Number.isInteger(n))throw new _e(`Int cannot represent non-integer value: ${Ze(e)}`);if(n>Hf||n<Wf)throw new _e("Int cannot represent non 32-bit signed integer value: "+Ze(e));return n},parseValue(t){if(typeof t!="number"||!Number.isInteger(t))throw new _e(`Int cannot represent non-integer value: ${Ze(t)}`);if(t>Hf||t<Wf)throw new _e(`Int cannot represent non 32-bit signed integer value: ${t}`);return t},parseLiteral(t){if(t.kind!==q.INT)throw new _e(`Int cannot represent non-integer value: ${fn(t)}`,{nodes:t});const e=parseInt(t.value,10);if(e>Hf||e<Wf)throw new _e(`Int cannot represent non 32-bit signed integer value: ${t.value}`,{nodes:t});return e}}),cR=new Di({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(t){const e=El(t);if(typeof e=="boolean")return e?1:0;let n=e;if(typeof e=="string"&&e!==""&&(n=Number(e)),typeof n!="number"||!Number.isFinite(n))throw new _e(`Float cannot represent non numeric value: ${Ze(e)}`);return n},parseValue(t){if(typeof t!="number"||!Number.isFinite(t))throw new _e(`Float cannot represent non numeric value: ${Ze(t)}`);return t},parseLiteral(t){if(t.kind!==q.FLOAT&&t.kind!==q.INT)throw new _e(`Float cannot represent non numeric value: ${fn(t)}`,t);return parseFloat(t.value)}}),rn=new Di({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(t){const e=El(t);if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"&&Number.isFinite(e))return e.toString();throw new _e(`String cannot represent value: ${Ze(t)}`)},parseValue(t){if(typeof t!="string")throw new _e(`String cannot represent a non string value: ${Ze(t)}`);return t},parseLiteral(t){if(t.kind!==q.STRING)throw new _e(`String cannot represent a non string value: ${fn(t)}`,{nodes:t});return t.value}}),Kn=new Di({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(t){const e=El(t);if(typeof e=="boolean")return e;if(Number.isFinite(e))return e!==0;throw new _e(`Boolean cannot represent a non boolean value: ${Ze(e)}`)},parseValue(t){if(typeof t!="boolean")throw new _e(`Boolean cannot represent a non boolean value: ${Ze(t)}`);return t},parseLiteral(t){if(t.kind!==q.BOOLEAN)throw new _e(`Boolean cannot represent a non boolean value: ${fn(t)}`,{nodes:t});return t.value}}),_b=new Di({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(t){const e=El(t);if(typeof e=="string")return e;if(Number.isInteger(e))return String(e);throw new _e(`ID cannot represent value: ${Ze(t)}`)},parseValue(t){if(typeof t=="string")return t;if(typeof t=="number"&&Number.isInteger(t))return t.toString();throw new _e(`ID cannot represent value: ${Ze(t)}`)},parseLiteral(t){if(t.kind!==q.STRING&&t.kind!==q.INT)throw new _e("ID cannot represent a non-string and non-integer value: "+fn(t),{nodes:t});return t.value}}),Hh=Object.freeze([rn,aR,cR,Kn,_b]);function lR(t){return Hh.some(({name:e})=>t.name===e)}function El(t){if(Bs(t)){if(typeof t.valueOf=="function"){const e=t.valueOf();if(!Bs(e))return e}if(typeof t.toJSON=="function")return t.toJSON()}return t}function uR(t){return ri(t,os)}class os{constructor(e){var n,r;this.name=Lr(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=(n=e.isRepeatable)!==null&&n!==void 0?n:!1,this.extensions=fr(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||kt(!1,`@${e.name} locations must be an Array.`);const i=(r=e.args)!==null&&r!==void 0?r:{};Bs(i)&&!Array.isArray(i)||kt(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=mb(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:yb(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const bb=new os({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[Ye.FIELD,Ye.FRAGMENT_SPREAD,Ye.INLINE_FRAGMENT],args:{if:{type:new pt(Kn),description:"Included when true."}}}),Eb=new os({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[Ye.FIELD,Ye.FRAGMENT_SPREAD,Ye.INLINE_FRAGMENT],args:{if:{type:new pt(Kn),description:"Skipped when true."}}}),dR="No longer supported",Sb=new os({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[Ye.FIELD_DEFINITION,Ye.ARGUMENT_DEFINITION,Ye.INPUT_FIELD_DEFINITION,Ye.ENUM_VALUE],args:{reason:{type:rn,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:dR}}}),wb=new os({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[Ye.SCALAR],args:{url:{type:new pt(rn),description:"The URL that specifies the behavior of this scalar."}}}),Tb=new os({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[Ye.INPUT_OBJECT],args:{}}),ba=Object.freeze([bb,Eb,Sb,wb,Tb]);function fR(t){return typeof t=="object"&&typeof(t==null?void 0:t[Symbol.iterator])=="function"}function Xa(t,e){if(Vt(e)){const n=Xa(t,e.ofType);return(n==null?void 0:n.kind)===q.NULL?null:n}if(t===null)return{kind:q.NULL};if(t===void 0)return null;if(er(e)){const n=e.ofType;if(fR(t)){const r=[];for(const i of t){const s=Xa(i,n);s!=null&&r.push(s)}return{kind:q.LIST,values:r}}return Xa(t,n)}if(Qn(e)){if(!Bs(t))return null;const n=[];for(const r of Object.values(e.getFields())){const i=Xa(t[r.name],r.type);i&&n.push({kind:q.OBJECT_FIELD,name:{kind:q.NAME,value:r.name},value:i})}return{kind:q.OBJECT,fields:n}}if(Qo(e)){const n=e.serialize(t);if(n==null)return null;if(typeof n=="boolean")return{kind:q.BOOLEAN,value:n};if(typeof n=="number"&&Number.isFinite(n)){const r=String(n);return vy.test(r)?{kind:q.INT,value:r}:{kind:q.FLOAT,value:r}}if(typeof n=="string")return Oi(e)?{kind:q.ENUM,value:n}:e===_b&&vy.test(n)?{kind:q.INT,value:n}:{kind:q.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${Ze(n)}.`)}xr(!1,"Unexpected input type: "+Ze(e))}const vy=/^-?(?:0|[1-9][0-9]*)$/,Wh=new lr({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:rn,resolve:t=>t.description},types:{description:"A list of all types supported by this server.",type:new pt(new An(new pt(Tr))),resolve(t){return Object.values(t.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new pt(Tr),resolve:t=>t.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Tr,resolve:t=>t.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Tr,resolve:t=>t.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new pt(new An(new pt(Ib))),resolve:t=>t.getDirectives()}})}),Ib=new lr({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
|
|
51
|
-
|
|
52
|
-
In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new pt(rn),resolve:t=>t.name},description:{type:rn,resolve:t=>t.description},isRepeatable:{type:new pt(Kn),resolve:t=>t.isRepeatable},locations:{type:new pt(new An(new pt(xb))),resolve:t=>t.locations},args:{type:new pt(new An(new pt(Ud))),args:{includeDeprecated:{type:Kn,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(n=>n.deprecationReason==null)}}})}),xb=new Oc({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:Ye.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:Ye.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:Ye.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:Ye.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:Ye.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:Ye.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:Ye.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:Ye.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:Ye.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:Ye.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:Ye.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:Ye.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:Ye.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:Ye.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:Ye.UNION,description:"Location adjacent to a union definition."},ENUM:{value:Ye.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:Ye.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:Ye.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:Ye.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Tr=new lr({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new pt(Rb),resolve(t){if(_a(t))return hn.SCALAR;if(Ln(t))return hn.OBJECT;if(vn(t))return hn.INTERFACE;if(xi(t))return hn.UNION;if(Oi(t))return hn.ENUM;if(Qn(t))return hn.INPUT_OBJECT;if(er(t))return hn.LIST;if(Vt(t))return hn.NON_NULL;xr(!1,`Unexpected type: "${Ze(t)}".`)}},name:{type:rn,resolve:t=>"name"in t?t.name:void 0},description:{type:rn,resolve:t=>"description"in t?t.description:void 0},specifiedByURL:{type:rn,resolve:t=>"specifiedByURL"in t?t.specifiedByURL:void 0},fields:{type:new An(new pt(Ob)),args:{includeDeprecated:{type:Kn,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Ln(t)||vn(t)){const n=Object.values(t.getFields());return e?n:n.filter(r=>r.deprecationReason==null)}}},interfaces:{type:new An(new pt(Tr)),resolve(t){if(Ln(t)||vn(t))return t.getInterfaces()}},possibleTypes:{type:new An(new pt(Tr)),resolve(t,e,n,{schema:r}){if(Fs(t))return r.getPossibleTypes(t)}},enumValues:{type:new An(new pt(Db)),args:{includeDeprecated:{type:Kn,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Oi(t)){const n=t.getValues();return e?n:n.filter(r=>r.deprecationReason==null)}}},inputFields:{type:new An(new pt(Ud)),args:{includeDeprecated:{type:Kn,defaultValue:!1}},resolve(t,{includeDeprecated:e}){if(Qn(t)){const n=Object.values(t.getFields());return e?n:n.filter(r=>r.deprecationReason==null)}}},ofType:{type:Tr,resolve:t=>"ofType"in t?t.ofType:void 0},isOneOf:{type:Kn,resolve:t=>{if(Qn(t))return t.isOneOf}}})}),Ob=new lr({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new pt(rn),resolve:t=>t.name},description:{type:rn,resolve:t=>t.description},args:{type:new pt(new An(new pt(Ud))),args:{includeDeprecated:{type:Kn,defaultValue:!1}},resolve(t,{includeDeprecated:e}){return e?t.args:t.args.filter(n=>n.deprecationReason==null)}},type:{type:new pt(Tr),resolve:t=>t.type},isDeprecated:{type:new pt(Kn),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:rn,resolve:t=>t.deprecationReason}})}),Ud=new lr({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new pt(rn),resolve:t=>t.name},description:{type:rn,resolve:t=>t.description},type:{type:new pt(Tr),resolve:t=>t.type},defaultValue:{type:rn,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(t){const{type:e,defaultValue:n}=t,r=Xa(n,e);return r?fn(r):null}},isDeprecated:{type:new pt(Kn),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:rn,resolve:t=>t.deprecationReason}})}),Db=new lr({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new pt(rn),resolve:t=>t.name},description:{type:rn,resolve:t=>t.description},isDeprecated:{type:new pt(Kn),resolve:t=>t.deprecationReason!=null},deprecationReason:{type:rn,resolve:t=>t.deprecationReason}})});var hn;(function(t){t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.INPUT_OBJECT="INPUT_OBJECT",t.LIST="LIST",t.NON_NULL="NON_NULL"})(hn||(hn={}));const Rb=new Oc({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:hn.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:hn.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:hn.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:hn.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:hn.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:hn.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:hn.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:hn.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}});new pt(Wh);new pt(rn);new pt(rn);const qh=Object.freeze([Wh,Ib,xb,Tr,Ob,Ud,Db,Rb]);function pR(t){return qh.some(({name:e})=>t.name===e)}class hR{constructor(e){var n,r;this.__validationErrors=e.assumeValid===!0?[]:void 0,Bs(e)||kt(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||kt(!1,`"types" must be Array if provided but got: ${Ze(e.types)}.`),!e.directives||Array.isArray(e.directives)||kt(!1,`"directives" must be Array if provided but got: ${Ze(e.directives)}.`),this.description=e.description,this.extensions=fr(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=(n=e.extensionASTNodes)!==null&&n!==void 0?n:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=(r=e.directives)!==null&&r!==void 0?r:ba;const i=new Set(e.types);if(e.types!=null)for(const s of e.types)i.delete(s),Er(s,i);this._queryType!=null&&Er(this._queryType,i),this._mutationType!=null&&Er(this._mutationType,i),this._subscriptionType!=null&&Er(this._subscriptionType,i);for(const s of this._directives)if(uR(s))for(const o of s.args)Er(o.type,i);Er(Wh,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const s of i){if(s==null)continue;const o=s.name;if(o||kt(!1,"One of the provided types for building the Schema is missing a name."),this._typeMap[o]!==void 0)throw new Error(`Schema must contain uniquely named types but contains multiple types named "${o}".`);if(this._typeMap[o]=s,vn(s)){for(const a of s.getInterfaces())if(vn(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.interfaces.push(s)}}else if(Ln(s)){for(const a of s.getInterfaces())if(vn(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.objects.push(s)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case cr.QUERY:return this.getQueryType();case cr.MUTATION:return this.getMutationType();case cr.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return xi(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const n=this._implementationsMap[e.name];return n??{objects:[],interfaces:[]}}isSubType(e,n){let r=this._subTypeMap[e.name];if(r===void 0){if(r=Object.create(null),xi(e))for(const i of e.getTypes())r[i.name]=!0;else{const i=this.getImplementations(e);for(const s of i.objects)r[s.name]=!0;for(const s of i.interfaces)r[s.name]=!0}this._subTypeMap[e.name]=r}return r[n.name]!==void 0}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find(n=>n.name===e)}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.__validationErrors!==void 0}}}function Er(t,e){const n=Hs(t);if(!e.has(n)){if(e.add(n),xi(n))for(const r of n.getTypes())Er(r,e);else if(Ln(n)||vn(n)){for(const r of n.getInterfaces())Er(r,e);for(const r of Object.values(n.getFields())){Er(r.type,e);for(const i of r.args)Er(i.type,e)}}else if(Qn(n))for(const r of Object.values(n.getFields()))Er(r.type,e)}return e}function Qr(t,e){switch(e.kind){case q.LIST_TYPE:{const n=Qr(t,e.type);return n&&new An(n)}case q.NON_NULL_TYPE:{const n=Qr(t,e.type);return n&&new pt(n)}case q.NAMED_TYPE:return t.getType(e.name.value)}}function mR(t){return t.kind===q.OPERATION_DEFINITION||t.kind===q.FRAGMENT_DEFINITION}function gR(t){return t.kind===q.SCHEMA_DEFINITION||Sl(t)||t.kind===q.DIRECTIVE_DEFINITION}function Sl(t){return t.kind===q.SCALAR_TYPE_DEFINITION||t.kind===q.OBJECT_TYPE_DEFINITION||t.kind===q.INTERFACE_TYPE_DEFINITION||t.kind===q.UNION_TYPE_DEFINITION||t.kind===q.ENUM_TYPE_DEFINITION||t.kind===q.INPUT_OBJECT_TYPE_DEFINITION}function yR(t){return t.kind===q.SCHEMA_EXTENSION||Zh(t)}function Zh(t){return t.kind===q.SCALAR_TYPE_EXTENSION||t.kind===q.OBJECT_TYPE_EXTENSION||t.kind===q.INTERFACE_TYPE_EXTENSION||t.kind===q.UNION_TYPE_EXTENSION||t.kind===q.ENUM_TYPE_EXTENSION||t.kind===q.INPUT_OBJECT_TYPE_EXTENSION}function vR(t){return{Document(e){for(const n of e.definitions)if(!mR(n)){const r=n.kind===q.SCHEMA_DEFINITION||n.kind===q.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';t.reportError(new _e(`The ${r} definition is not executable.`,{nodes:n}))}return!1}}}function _R(t){return{Field(e){const n=t.getParentType();if(n&&!t.getFieldDef()){const i=t.getSchema(),s=e.name.value;let o=ss("to use an inline fragment on",bR(i,n,s));o===""&&(o=ss(ER(n,s))),t.reportError(new _e(`Cannot query field "${s}" on type "${n.name}".`+o,{nodes:e}))}}}}function bR(t,e,n){if(!Fs(e))return[];const r=new Set,i=Object.create(null);for(const o of t.getPossibleTypes(e))if(o.getFields()[n]){r.add(o),i[o.name]=1;for(const a of o.getInterfaces()){var s;a.getFields()[n]&&(r.add(a),i[a.name]=((s=i[a.name])!==null&&s!==void 0?s:0)+1)}}return[...r].sort((o,a)=>{const c=i[a.name]-i[o.name];return c!==0?c:vn(o)&&t.isSubType(o,a)?-1:vn(a)&&t.isSubType(a,o)?1:zh(o.name,a.name)}).map(o=>o.name)}function ER(t,e){if(Ln(t)||vn(t)){const n=Object.keys(t.getFields());return oo(e,n)}return[]}function SR(t){return{InlineFragment(e){const n=e.typeCondition;if(n){const r=Qr(t.getSchema(),n);if(r&&!xc(r)){const i=fn(n);t.reportError(new _e(`Fragment cannot condition on non composite type "${i}".`,{nodes:n}))}}},FragmentDefinition(e){const n=Qr(t.getSchema(),e.typeCondition);if(n&&!xc(n)){const r=fn(e.typeCondition);t.reportError(new _e(`Fragment "${e.name.value}" cannot condition on non composite type "${r}".`,{nodes:e.typeCondition}))}}}}function wR(t){return{...kb(t),Argument(e){const n=t.getArgument(),r=t.getFieldDef(),i=t.getParentType();if(!n&&r&&i){const s=e.name.value,o=r.args.map(c=>c.name),a=oo(s,o);t.reportError(new _e(`Unknown argument "${s}" on field "${i.name}.${r.name}".`+ss(a),{nodes:e}))}}}}function kb(t){const e=Object.create(null),n=t.getSchema(),r=n?n.getDirectives():ba;for(const o of r)e[o.name]=o.args.map(a=>a.name);const i=t.getDocument().definitions;for(const o of i)if(o.kind===q.DIRECTIVE_DEFINITION){var s;const a=(s=o.arguments)!==null&&s!==void 0?s:[];e[o.name.value]=a.map(c=>c.name.value)}return{Directive(o){const a=o.name.value,c=e[a];if(o.arguments&&c)for(const l of o.arguments){const u=l.name.value;if(!c.includes(u)){const d=oo(u,c);t.reportError(new _e(`Unknown argument "${u}" on directive "@${a}".`+ss(d),{nodes:l}))}}return!1}}}function Nb(t){const e=Object.create(null),n=t.getSchema(),r=n?n.getDirectives():ba;for(const s of r)e[s.name]=s.locations;const i=t.getDocument().definitions;for(const s of i)s.kind===q.DIRECTIVE_DEFINITION&&(e[s.name.value]=s.locations.map(o=>o.value));return{Directive(s,o,a,c,l){const u=s.name.value,d=e[u];if(!d){t.reportError(new _e(`Unknown directive "@${u}".`,{nodes:s}));return}const f=TR(l);f&&!d.includes(f)&&t.reportError(new _e(`Directive "@${u}" may not be used on ${f}.`,{nodes:s}))}}}function TR(t){const e=t[t.length-1];switch("kind"in e||xr(!1),e.kind){case q.OPERATION_DEFINITION:return IR(e.operation);case q.FIELD:return Ye.FIELD;case q.FRAGMENT_SPREAD:return Ye.FRAGMENT_SPREAD;case q.INLINE_FRAGMENT:return Ye.INLINE_FRAGMENT;case q.FRAGMENT_DEFINITION:return Ye.FRAGMENT_DEFINITION;case q.VARIABLE_DEFINITION:return Ye.VARIABLE_DEFINITION;case q.SCHEMA_DEFINITION:case q.SCHEMA_EXTENSION:return Ye.SCHEMA;case q.SCALAR_TYPE_DEFINITION:case q.SCALAR_TYPE_EXTENSION:return Ye.SCALAR;case q.OBJECT_TYPE_DEFINITION:case q.OBJECT_TYPE_EXTENSION:return Ye.OBJECT;case q.FIELD_DEFINITION:return Ye.FIELD_DEFINITION;case q.INTERFACE_TYPE_DEFINITION:case q.INTERFACE_TYPE_EXTENSION:return Ye.INTERFACE;case q.UNION_TYPE_DEFINITION:case q.UNION_TYPE_EXTENSION:return Ye.UNION;case q.ENUM_TYPE_DEFINITION:case q.ENUM_TYPE_EXTENSION:return Ye.ENUM;case q.ENUM_VALUE_DEFINITION:return Ye.ENUM_VALUE;case q.INPUT_OBJECT_TYPE_DEFINITION:case q.INPUT_OBJECT_TYPE_EXTENSION:return Ye.INPUT_OBJECT;case q.INPUT_VALUE_DEFINITION:{const n=t[t.length-3];return"kind"in n||xr(!1),n.kind===q.INPUT_OBJECT_TYPE_DEFINITION?Ye.INPUT_FIELD_DEFINITION:Ye.ARGUMENT_DEFINITION}default:xr(!1,"Unexpected kind: "+Ze(e.kind))}}function IR(t){switch(t){case cr.QUERY:return Ye.QUERY;case cr.MUTATION:return Ye.MUTATION;case cr.SUBSCRIPTION:return Ye.SUBSCRIPTION}}function xR(t){return{FragmentSpread(e){const n=e.name.value;t.getFragment(n)||t.reportError(new _e(`Unknown fragment "${n}".`,{nodes:e.name}))}}}function Ab(t){const e=t.getSchema(),n=e?e.getTypeMap():Object.create(null),r=Object.create(null);for(const s of t.getDocument().definitions)Sl(s)&&(r[s.name.value]=!0);const i=[...Object.keys(n),...Object.keys(r)];return{NamedType(s,o,a,c,l){const u=s.name.value;if(!n[u]&&!r[u]){var d;const f=(d=l[2])!==null&&d!==void 0?d:a,p=f!=null&&OR(f);if(p&&_y.includes(u))return;const h=oo(u,p?_y.concat(i):i);t.reportError(new _e(`Unknown type "${u}".`+ss(h),{nodes:s}))}}}}const _y=[...Hh,...qh].map(t=>t.name);function OR(t){return"kind"in t&&(gR(t)||yR(t))}function DR(t){let e=0;return{Document(n){e=n.definitions.filter(r=>r.kind===q.OPERATION_DEFINITION).length},OperationDefinition(n){!n.name&&e>1&&t.reportError(new _e("This anonymous operation must be the only defined operation.",{nodes:n}))}}}function RR(t){var e,n,r;const i=t.getSchema(),s=(e=(n=(r=i==null?void 0:i.astNode)!==null&&r!==void 0?r:i==null?void 0:i.getQueryType())!==null&&n!==void 0?n:i==null?void 0:i.getMutationType())!==null&&e!==void 0?e:i==null?void 0:i.getSubscriptionType();let o=0;return{SchemaDefinition(a){if(s){t.reportError(new _e("Cannot define a new schema within a schema extension.",{nodes:a}));return}o>0&&t.reportError(new _e("Must provide only one schema definition.",{nodes:a})),++o}}}const kR=3;function NR(t){function e(n,r=Object.create(null),i=0){if(n.kind===q.FRAGMENT_SPREAD){const s=n.name.value;if(r[s]===!0)return!1;const o=t.getFragment(s);if(!o)return!1;try{return r[s]=!0,e(o,r,i)}finally{r[s]=void 0}}if(n.kind===q.FIELD&&(n.name.value==="fields"||n.name.value==="interfaces"||n.name.value==="possibleTypes"||n.name.value==="inputFields")&&(i++,i>=kR))return!0;if("selectionSet"in n&&n.selectionSet){for(const s of n.selectionSet.selections)if(e(s,r,i))return!0}return!1}return{Field(n){if((n.name.value==="__schema"||n.name.value==="__type")&&e(n))return t.reportError(new _e("Maximum introspection depth exceeded",{nodes:[n]})),!1}}}function AR(t){const e=Object.create(null),n=[],r=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(s){return i(s),!1}};function i(s){if(e[s.name.value])return;const o=s.name.value;e[o]=!0;const a=t.getFragmentSpreads(s.selectionSet);if(a.length!==0){r[o]=n.length;for(const c of a){const l=c.name.value,u=r[l];if(n.push(c),u===void 0){const d=t.getFragment(l);d&&i(d)}else{const d=n.slice(u),f=d.slice(0,-1).map(p=>'"'+p.name.value+'"').join(", ");t.reportError(new _e(`Cannot spread fragment "${l}" within itself`+(f!==""?` via ${f}.`:"."),{nodes:d}))}n.pop()}r[o]=void 0}}}function CR(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(n){const r=t.getRecursiveVariableUsages(n);for(const{node:i}of r){const s=i.name.value;e[s]!==!0&&t.reportError(new _e(n.name?`Variable "$${s}" is not defined by operation "${n.name.value}".`:`Variable "$${s}" is not defined.`,{nodes:[i,n]}))}}},VariableDefinition(n){e[n.variable.name.value]=!0}}}function MR(t){const e=[],n=[];return{OperationDefinition(r){return e.push(r),!1},FragmentDefinition(r){return n.push(r),!1},Document:{leave(){const r=Object.create(null);for(const i of e)for(const s of t.getRecursivelyReferencedFragments(i))r[s.name.value]=!0;for(const i of n){const s=i.name.value;r[s]!==!0&&t.reportError(new _e(`Fragment "${s}" is never used.`,{nodes:i}))}}}}}function LR(t){let e=[];return{OperationDefinition:{enter(){e=[]},leave(n){const r=Object.create(null),i=t.getRecursiveVariableUsages(n);for(const{node:s}of i)r[s.name.value]=!0;for(const s of e){const o=s.variable.name.value;r[o]!==!0&&t.reportError(new _e(n.name?`Variable "$${o}" is never used in operation "${n.name.value}".`:`Variable "$${o}" is never used.`,{nodes:s}))}}},VariableDefinition(n){e.push(n)}}}function Gh(t){switch(t.kind){case q.OBJECT:return{...t,fields:PR(t.fields)};case q.LIST:return{...t,values:t.values.map(Gh)};case q.INT:case q.FLOAT:case q.STRING:case q.BOOLEAN:case q.NULL:case q.ENUM:case q.VARIABLE:return t}}function PR(t){return t.map(e=>({...e,value:Gh(e.value)})).sort((e,n)=>zh(e.name.value,n.name.value))}function Cb(t){return Array.isArray(t)?t.map(([e,n])=>`subfields "${e}" conflict because `+Cb(n)).join(" and "):t}function FR(t){const e=new Pb,n=new VR,r=new Map;return{SelectionSet(i){const s=$R(t,r,e,n,t.getParentType(),i);for(const[[o,a],c,l]of s){const u=Cb(a);t.reportError(new _e(`Fields "${o}" conflict because ${u}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:c.concat(l)}))}}}}function $R(t,e,n,r,i,s){const o=[],[a,c]=zu(t,e,i,s);if(UR(t,o,e,n,r,a),c.length!==0)for(let l=0;l<c.length;l++){Uu(t,o,e,n,r,!1,a,c[l]);for(let u=l+1;u<c.length;u++)Bu(t,o,e,n,r,!1,c[l],c[u])}return o}function Uu(t,e,n,r,i,s,o,a){if(r.has(o,a,s))return;r.add(o,a,s);const c=t.getFragment(a);if(!c)return;const[l,u]=Np(t,n,c);if(o!==l){Yh(t,e,n,r,i,s,o,l);for(const d of u)Uu(t,e,n,r,i,s,o,d)}}function Bu(t,e,n,r,i,s,o,a){if(o===a||i.has(o,a,s))return;i.add(o,a,s);const c=t.getFragment(o),l=t.getFragment(a);if(!c||!l)return;const[u,d]=Np(t,n,c),[f,p]=Np(t,n,l);Yh(t,e,n,r,i,s,u,f);for(const h of p)Bu(t,e,n,r,i,s,o,h);for(const h of d)Bu(t,e,n,r,i,s,h,a)}function jR(t,e,n,r,i,s,o,a,c){const l=[],[u,d]=zu(t,e,s,o),[f,p]=zu(t,e,a,c);Yh(t,l,e,n,r,i,u,f);for(const h of p)Uu(t,l,e,n,r,i,u,h);for(const h of d)Uu(t,l,e,n,r,i,f,h);for(const h of d)for(const m of p)Bu(t,l,e,n,r,i,h,m);return l}function UR(t,e,n,r,i,s){for(const[o,a]of Object.entries(s))if(a.length>1)for(let c=0;c<a.length;c++)for(let l=c+1;l<a.length;l++){const u=Mb(t,n,r,i,!1,o,a[c],a[l]);u&&e.push(u)}}function Yh(t,e,n,r,i,s,o,a){for(const[c,l]of Object.entries(o)){const u=a[c];if(u)for(const d of l)for(const f of u){const p=Mb(t,n,r,i,s,c,d,f);p&&e.push(p)}}}function Mb(t,e,n,r,i,s,o,a){const[c,l,u]=o,[d,f,p]=a,h=i||c!==d&&Ln(c)&&Ln(d);if(!h){const _=l.name.value,T=f.name.value;if(_!==T)return[[s,`"${_}" and "${T}" are different fields`],[l],[f]];if(!BR(l,f))return[[s,"they have differing arguments"],[l],[f]]}const m=u==null?void 0:u.type,v=p==null?void 0:p.type;if(m&&v&&kp(m,v))return[[s,`they return conflicting types "${Ze(m)}" and "${Ze(v)}"`],[l],[f]];const y=l.selectionSet,g=f.selectionSet;if(y&&g){const _=jR(t,e,n,r,h,Hs(m),y,Hs(v),g);return zR(_,s,l,f)}}function BR(t,e){const n=t.arguments,r=e.arguments;if(n===void 0||n.length===0)return r===void 0||r.length===0;if(r===void 0||r.length===0||n.length!==r.length)return!1;const i=new Map(r.map(({name:s,value:o})=>[s.value,o]));return n.every(s=>{const o=s.value,a=i.get(s.name.value);return a===void 0?!1:by(o)===by(a)})}function by(t){return fn(Gh(t))}function kp(t,e){return er(t)?er(e)?kp(t.ofType,e.ofType):!0:er(e)?!0:Vt(t)?Vt(e)?kp(t.ofType,e.ofType):!0:Vt(e)?!0:Qo(t)||Qo(e)?t!==e:!1}function zu(t,e,n,r){const i=e.get(r);if(i)return i;const s=Object.create(null),o=Object.create(null);Lb(t,n,r,s,o);const a=[s,Object.keys(o)];return e.set(r,a),a}function Np(t,e,n){const r=e.get(n.selectionSet);if(r)return r;const i=Qr(t.getSchema(),n.typeCondition);return zu(t,e,i,n.selectionSet)}function Lb(t,e,n,r,i){for(const s of n.selections)switch(s.kind){case q.FIELD:{const o=s.name.value;let a;(Ln(e)||vn(e))&&(a=e.getFields()[o]);const c=s.alias?s.alias.value:o;r[c]||(r[c]=[]),r[c].push([e,s,a]);break}case q.FRAGMENT_SPREAD:i[s.name.value]=!0;break;case q.INLINE_FRAGMENT:{const o=s.typeCondition,a=o?Qr(t.getSchema(),o):e;Lb(t,a,s.selectionSet,r,i);break}}}function zR(t,e,n,r){if(t.length>0)return[[e,t.map(([i])=>i)],[n,...t.map(([,i])=>i).flat()],[r,...t.map(([,,i])=>i).flat()]]}class Pb{constructor(){this._data=new Map}has(e,n,r){var i;const s=(i=this._data.get(e))===null||i===void 0?void 0:i.get(n);return s===void 0?!1:r?!0:r===s}add(e,n,r){const i=this._data.get(e);i===void 0?this._data.set(e,new Map([[n,r]])):i.set(n,r)}}class VR{constructor(){this._orderedPairSet=new Pb}has(e,n,r){return e<n?this._orderedPairSet.has(e,n,r):this._orderedPairSet.has(n,e,r)}add(e,n,r){e<n?this._orderedPairSet.add(e,n,r):this._orderedPairSet.add(n,e,r)}}function HR(t){return{InlineFragment(e){const n=t.getType(),r=t.getParentType();if(xc(n)&&xc(r)&&!yy(t.getSchema(),n,r)){const i=Ze(r),s=Ze(n);t.reportError(new _e(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${s}".`,{nodes:e}))}},FragmentSpread(e){const n=e.name.value,r=WR(t,n),i=t.getParentType();if(r&&i&&!yy(t.getSchema(),r,i)){const s=Ze(i),o=Ze(r);t.reportError(new _e(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:e}))}}}}function WR(t,e){const n=t.getFragment(e);if(n){const r=Qr(t.getSchema(),n.typeCondition);if(xc(r))return r}}function qR(t){const e=t.getSchema(),n=Object.create(null);for(const i of t.getDocument().definitions)Sl(i)&&(n[i.name.value]=i);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(i){const s=i.name.value,o=n[s],a=e==null?void 0:e.getType(s);let c;if(o?c=ZR[o.kind]:a&&(c=GR(a)),c){if(c!==i.kind){const l=YR(i.kind);t.reportError(new _e(`Cannot extend non-${l} type "${s}".`,{nodes:o?[o,i]:i}))}}else{const l=Object.keys({...n,...e==null?void 0:e.getTypeMap()}),u=oo(s,l);t.reportError(new _e(`Cannot extend type "${s}" because it is not defined.`+ss(u),{nodes:i.name}))}}}const ZR={[q.SCALAR_TYPE_DEFINITION]:q.SCALAR_TYPE_EXTENSION,[q.OBJECT_TYPE_DEFINITION]:q.OBJECT_TYPE_EXTENSION,[q.INTERFACE_TYPE_DEFINITION]:q.INTERFACE_TYPE_EXTENSION,[q.UNION_TYPE_DEFINITION]:q.UNION_TYPE_EXTENSION,[q.ENUM_TYPE_DEFINITION]:q.ENUM_TYPE_EXTENSION,[q.INPUT_OBJECT_TYPE_DEFINITION]:q.INPUT_OBJECT_TYPE_EXTENSION};function GR(t){if(_a(t))return q.SCALAR_TYPE_EXTENSION;if(Ln(t))return q.OBJECT_TYPE_EXTENSION;if(vn(t))return q.INTERFACE_TYPE_EXTENSION;if(xi(t))return q.UNION_TYPE_EXTENSION;if(Oi(t))return q.ENUM_TYPE_EXTENSION;if(Qn(t))return q.INPUT_OBJECT_TYPE_EXTENSION;xr(!1,"Unexpected type: "+Ze(t))}function YR(t){switch(t){case q.SCALAR_TYPE_EXTENSION:return"scalar";case q.OBJECT_TYPE_EXTENSION:return"object";case q.INTERFACE_TYPE_EXTENSION:return"interface";case q.UNION_TYPE_EXTENSION:return"union";case q.ENUM_TYPE_EXTENSION:return"enum";case q.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:xr(!1,"Unexpected kind: "+Ze(t))}}function JR(t){return{...Fb(t),Field:{leave(e){var n;const r=t.getFieldDef();if(!r)return!1;const i=new Set((n=e.arguments)===null||n===void 0?void 0:n.map(s=>s.name.value));for(const s of r.args)if(!i.has(s.name)&&vb(s)){const o=Ze(s.type);t.reportError(new _e(`Field "${r.name}" argument "${s.name}" of type "${o}" is required, but it was not provided.`,{nodes:e}))}}}}}function Fb(t){var e;const n=Object.create(null),r=t.getSchema(),i=(e=r==null?void 0:r.getDirectives())!==null&&e!==void 0?e:ba;for(const a of i)n[a.name]=Vs(a.args.filter(vb),c=>c.name);const s=t.getDocument().definitions;for(const a of s)if(a.kind===q.DIRECTIVE_DEFINITION){var o;const c=(o=a.arguments)!==null&&o!==void 0?o:[];n[a.name.value]=Vs(c.filter(XR),l=>l.name.value)}return{Directive:{leave(a){const c=a.name.value,l=n[c];if(l){var u;const d=(u=a.arguments)!==null&&u!==void 0?u:[],f=new Set(d.map(p=>p.name.value));for(const[p,h]of Object.entries(l))if(!f.has(p)){const m=Vh(h.type)?Ze(h.type):fn(h.type);t.reportError(new _e(`Directive "@${c}" argument "${p}" of type "${m}" is required, but it was not provided.`,{nodes:a}))}}}}}}function XR(t){return t.type.kind===q.NON_NULL_TYPE&&t.defaultValue==null}function KR(t){return{Field(e){const n=t.getType(),r=e.selectionSet;if(n)if(Qo(Hs(n))){if(r){const i=e.name.value,s=Ze(n);t.reportError(new _e(`Field "${i}" must not have a selection since type "${s}" has no subfields.`,{nodes:r}))}}else if(r){if(r.selections.length===0){const i=e.name.value,s=Ze(n);t.reportError(new _e(`Field "${i}" of type "${s}" must have at least one field selected.`,{nodes:e}))}}else{const i=e.name.value,s=Ze(n);t.reportError(new _e(`Field "${i}" of type "${s}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:e}))}}}}function Ns(t,e,n){if(t){if(t.kind===q.VARIABLE){const r=t.name.value;if(n==null||n[r]===void 0)return;const i=n[r];return i===null&&Vt(e)?void 0:i}if(Vt(e))return t.kind===q.NULL?void 0:Ns(t,e.ofType,n);if(t.kind===q.NULL)return null;if(er(e)){const r=e.ofType;if(t.kind===q.LIST){const s=[];for(const o of t.values)if(Ey(o,n)){if(Vt(r))return;s.push(null)}else{const a=Ns(o,r,n);if(a===void 0)return;s.push(a)}return s}const i=Ns(t,r,n);return i===void 0?void 0:[i]}if(Qn(e)){if(t.kind!==q.OBJECT)return;const r=Object.create(null),i=Vs(t.fields,s=>s.name.value);for(const s of Object.values(e.getFields())){const o=i[s.name];if(!o||Ey(o.value,n)){if(s.defaultValue!==void 0)r[s.name]=s.defaultValue;else if(Vt(s.type))return;continue}const a=Ns(o.value,s.type,n);if(a===void 0)return;r[s.name]=a}if(e.isOneOf){const s=Object.keys(r);if(s.length!==1||r[s[0]]===null)return}return r}if(Qo(e)){let r;try{r=e.parseLiteral(t,n)}catch{return}return r===void 0?void 0:r}xr(!1,"Unexpected input type: "+Ze(e))}}function Ey(t,e){return t.kind===q.VARIABLE&&(e==null||e[t.name.value]===void 0)}function QR(t,e,n){var r;const i={},s=(r=e.arguments)!==null&&r!==void 0?r:[],o=Vs(s,a=>a.name.value);for(const a of t.args){const c=a.name,l=a.type,u=o[c];if(!u){if(a.defaultValue!==void 0)i[c]=a.defaultValue;else if(Vt(l))throw new _e(`Argument "${c}" of required type "${Ze(l)}" was not provided.`,{nodes:e});continue}const d=u.value;let f=d.kind===q.NULL;if(d.kind===q.VARIABLE){const h=d.name.value;if(n==null||!ek(n,h)){if(a.defaultValue!==void 0)i[c]=a.defaultValue;else if(Vt(l))throw new _e(`Argument "${c}" of required type "${Ze(l)}" was provided the variable "$${h}" which was not provided a runtime value.`,{nodes:d});continue}f=n[h]==null}if(f&&Vt(l))throw new _e(`Argument "${c}" of non-null type "${Ze(l)}" must not be null.`,{nodes:d});const p=Ns(d,l,n);if(p===void 0)throw new _e(`Argument "${c}" has invalid value ${fn(d)}.`,{nodes:d});i[c]=p}return i}function Dc(t,e,n){var r;const i=(r=e.directives)===null||r===void 0?void 0:r.find(s=>s.name.value===t.name);if(i)return QR(t,i,n)}function ek(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function tk(t,e,n,r,i){const s=new Map;return Ap(t,e,n,r,i,s,new Set),s}function Ap(t,e,n,r,i,s,o){for(const a of i.selections)switch(a.kind){case q.FIELD:{if(!qf(n,a))continue;const c=nk(a),l=s.get(c);l!==void 0?l.push(a):s.set(c,[a]);break}case q.INLINE_FRAGMENT:{if(!qf(n,a)||!Sy(t,a,r))continue;Ap(t,e,n,r,a.selectionSet,s,o);break}case q.FRAGMENT_SPREAD:{const c=a.name.value;if(o.has(c)||!qf(n,a))continue;o.add(c);const l=e[c];if(!l||!Sy(t,l,r))continue;Ap(t,e,n,r,l.selectionSet,s,o);break}}}function qf(t,e){const n=Dc(Eb,e,t);if((n==null?void 0:n.if)===!0)return!1;const r=Dc(bb,e,t);return(r==null?void 0:r.if)!==!1}function Sy(t,e,n){const r=e.typeCondition;if(!r)return!0;const i=Qr(t,r);return i===n?!0:Fs(i)?t.isSubType(i,n):!1}function nk(t){return t.alias?t.alias.value:t.name.value}function rk(t){return{OperationDefinition(e){if(e.operation==="subscription"){const n=t.getSchema(),r=n.getSubscriptionType();if(r){const i=e.name?e.name.value:null,s=Object.create(null),o=t.getDocument(),a=Object.create(null);for(const l of o.definitions)l.kind===q.FRAGMENT_DEFINITION&&(a[l.name.value]=l);const c=tk(n,a,s,r,e.selectionSet);if(c.size>1){const d=[...c.values()].slice(1).flat();t.reportError(new _e(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:d}))}for(const l of c.values())l[0].name.value.startsWith("__")&&t.reportError(new _e(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:l}))}}}}}function Jh(t,e){const n=new Map;for(const r of t){const i=e(r),s=n.get(i);s===void 0?n.set(i,[r]):s.push(r)}return n}function ik(t){return{DirectiveDefinition(r){var i;const s=(i=r.arguments)!==null&&i!==void 0?i:[];return n(`@${r.name.value}`,s)},InterfaceTypeDefinition:e,InterfaceTypeExtension:e,ObjectTypeDefinition:e,ObjectTypeExtension:e};function e(r){var i;const s=r.name.value,o=(i=r.fields)!==null&&i!==void 0?i:[];for(const c of o){var a;const l=c.name.value,u=(a=c.arguments)!==null&&a!==void 0?a:[];n(`${s}.${l}`,u)}return!1}function n(r,i){const s=Jh(i,o=>o.name.value);for(const[o,a]of s)a.length>1&&t.reportError(new _e(`Argument "${r}(${o}:)" can only be defined once.`,{nodes:a.map(c=>c.name)}));return!1}}function $b(t){return{Field:e,Directive:e};function e(n){var r;const i=(r=n.arguments)!==null&&r!==void 0?r:[],s=Jh(i,o=>o.name.value);for(const[o,a]of s)a.length>1&&t.reportError(new _e(`There can be only one argument named "${o}".`,{nodes:a.map(c=>c.name)}))}}function sk(t){const e=Object.create(null),n=t.getSchema();return{DirectiveDefinition(r){const i=r.name.value;if(n!=null&&n.getDirective(i)){t.reportError(new _e(`Directive "@${i}" already exists in the schema. It cannot be redefined.`,{nodes:r.name}));return}return e[i]?t.reportError(new _e(`There can be only one directive named "@${i}".`,{nodes:[e[i],r.name]})):e[i]=r.name,!1}}}function jb(t){const e=Object.create(null),n=t.getSchema(),r=n?n.getDirectives():ba;for(const a of r)e[a.name]=!a.isRepeatable;const i=t.getDocument().definitions;for(const a of i)a.kind===q.DIRECTIVE_DEFINITION&&(e[a.name.value]=!a.repeatable);const s=Object.create(null),o=Object.create(null);return{enter(a){if(!("directives"in a)||!a.directives)return;let c;if(a.kind===q.SCHEMA_DEFINITION||a.kind===q.SCHEMA_EXTENSION)c=s;else if(Sl(a)||Zh(a)){const l=a.name.value;c=o[l],c===void 0&&(o[l]=c=Object.create(null))}else c=Object.create(null);for(const l of a.directives){const u=l.name.value;e[u]&&(c[u]?t.reportError(new _e(`The directive "@${u}" can only be used once at this location.`,{nodes:[c[u],l]})):c[u]=l)}}}}function ok(t){const e=t.getSchema(),n=e?e.getTypeMap():Object.create(null),r=Object.create(null);return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(s){var o;const a=s.name.value;r[a]||(r[a]=Object.create(null));const c=(o=s.values)!==null&&o!==void 0?o:[],l=r[a];for(const u of c){const d=u.name.value,f=n[a];Oi(f)&&f.getValue(d)?t.reportError(new _e(`Enum value "${a}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:u.name})):l[d]?t.reportError(new _e(`Enum value "${a}.${d}" can only be defined once.`,{nodes:[l[d],u.name]})):l[d]=u.name}return!1}}function ak(t){const e=t.getSchema(),n=e?e.getTypeMap():Object.create(null),r=Object.create(null);return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(s){var o;const a=s.name.value;r[a]||(r[a]=Object.create(null));const c=(o=s.fields)!==null&&o!==void 0?o:[],l=r[a];for(const u of c){const d=u.name.value;ck(n[a],d)?t.reportError(new _e(`Field "${a}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:u.name})):l[d]?t.reportError(new _e(`Field "${a}.${d}" can only be defined once.`,{nodes:[l[d],u.name]})):l[d]=u.name}return!1}}function ck(t,e){return Ln(t)||vn(t)||Qn(t)?t.getFields()[e]!=null:!1}function lk(t){const e=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const r=n.name.value;return e[r]?t.reportError(new _e(`There can be only one fragment named "${r}".`,{nodes:[e[r],n.name]})):e[r]=n.name,!1}}}function Ub(t){const e=[];let n=Object.create(null);return{ObjectValue:{enter(){e.push(n),n=Object.create(null)},leave(){const r=e.pop();r||xr(!1),n=r}},ObjectField(r){const i=r.name.value;n[i]?t.reportError(new _e(`There can be only one input field named "${i}".`,{nodes:[n[i],r.name]})):n[i]=r.name}}}function uk(t){const e=Object.create(null);return{OperationDefinition(n){const r=n.name;return r&&(e[r.value]?t.reportError(new _e(`There can be only one operation named "${r.value}".`,{nodes:[e[r.value],r]})):e[r.value]=r),!1},FragmentDefinition:()=>!1}}function dk(t){const e=t.getSchema(),n=Object.create(null),r=e?{query:e.getQueryType(),mutation:e.getMutationType(),subscription:e.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(s){var o;const a=(o=s.operationTypes)!==null&&o!==void 0?o:[];for(const c of a){const l=c.operation,u=n[l];r[l]?t.reportError(new _e(`Type for ${l} already defined in the schema. It cannot be redefined.`,{nodes:c})):u?t.reportError(new _e(`There can be only one ${l} type in schema.`,{nodes:[u,c]})):n[l]=c}return!1}}function fk(t){const e=Object.create(null),n=t.getSchema();return{ScalarTypeDefinition:r,ObjectTypeDefinition:r,InterfaceTypeDefinition:r,UnionTypeDefinition:r,EnumTypeDefinition:r,InputObjectTypeDefinition:r};function r(i){const s=i.name.value;if(n!=null&&n.getType(s)){t.reportError(new _e(`Type "${s}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:i.name}));return}return e[s]?t.reportError(new _e(`There can be only one type named "${s}".`,{nodes:[e[s],i.name]})):e[s]=i.name,!1}}function pk(t){return{OperationDefinition(e){var n;const r=(n=e.variableDefinitions)!==null&&n!==void 0?n:[],i=Jh(r,s=>s.variable.name.value);for(const[s,o]of i)o.length>1&&t.reportError(new _e(`There can be only one variable named "$${s}".`,{nodes:o.map(a=>a.variable.name)}))}}}function hk(t){let e={};return{OperationDefinition:{enter(){e={}}},VariableDefinition(n){e[n.variable.name.value]=n},ListValue(n){const r=rR(t.getParentInputType());if(!er(r))return ws(t,n),!1},ObjectValue(n){const r=Hs(t.getInputType());if(!Qn(r))return ws(t,n),!1;const i=Vs(n.fields,s=>s.name.value);for(const s of Object.values(r.getFields()))if(!i[s.name]&&oR(s)){const a=Ze(s.type);t.reportError(new _e(`Field "${r.name}.${s.name}" of required type "${a}" was not provided.`,{nodes:n}))}r.isOneOf&&mk(t,n,r,i,e)},ObjectField(n){const r=Hs(t.getParentInputType());if(!t.getInputType()&&Qn(r)){const s=oo(n.name.value,Object.keys(r.getFields()));t.reportError(new _e(`Field "${n.name.value}" is not defined by type "${r.name}".`+ss(s),{nodes:n}))}},NullValue(n){const r=t.getInputType();Vt(r)&&t.reportError(new _e(`Expected value of type "${Ze(r)}", found ${fn(n)}.`,{nodes:n}))},EnumValue:n=>ws(t,n),IntValue:n=>ws(t,n),FloatValue:n=>ws(t,n),StringValue:n=>ws(t,n),BooleanValue:n=>ws(t,n)}}function ws(t,e){const n=t.getInputType();if(!n)return;const r=Hs(n);if(!Qo(r)){const i=Ze(n);t.reportError(new _e(`Expected value of type "${i}", found ${fn(e)}.`,{nodes:e}));return}try{if(r.parseLiteral(e,void 0)===void 0){const s=Ze(n);t.reportError(new _e(`Expected value of type "${s}", found ${fn(e)}.`,{nodes:e}))}}catch(i){const s=Ze(n);i instanceof _e?t.reportError(i):t.reportError(new _e(`Expected value of type "${s}", found ${fn(e)}; `+i.message,{nodes:e,originalError:i}))}}function mk(t,e,n,r,i){var s;const o=Object.keys(r);if(o.length!==1){t.reportError(new _e(`OneOf Input Object "${n.name}" must specify exactly one key.`,{nodes:[e]}));return}const c=(s=r[o[0]])===null||s===void 0?void 0:s.value,l=!c||c.kind===q.NULL,u=(c==null?void 0:c.kind)===q.VARIABLE;if(l){t.reportError(new _e(`Field "${n.name}.${o[0]}" must be non-null.`,{nodes:[e]}));return}if(u){const d=c.name.value;i[d].type.kind!==q.NON_NULL_TYPE&&t.reportError(new _e(`Variable "${d}" must be non-nullable to be used for OneOf Input Object "${n.name}".`,{nodes:[e]}))}}function gk(t){return{VariableDefinition(e){const n=Qr(t.getSchema(),e.type);if(n!==void 0&&!lb(n)){const r=e.variable.name.value,i=fn(e.type);t.reportError(new _e(`Variable "$${r}" cannot be non-input type "${i}".`,{nodes:e.type}))}}}}function yk(t){let e=Object.create(null);return{OperationDefinition:{enter(){e=Object.create(null)},leave(n){const r=t.getRecursiveVariableUsages(n);for(const{node:i,type:s,defaultValue:o}of r){const a=i.name.value,c=e[a];if(c&&s){const l=t.getSchema(),u=Qr(l,c.type);if(u&&!vk(l,u,c.defaultValue,s,o)){const d=Ze(u),f=Ze(s);t.reportError(new _e(`Variable "$${a}" of type "${d}" used in position expecting type "${f}".`,{nodes:[c,i]}))}}}}},VariableDefinition(n){e[n.variable.name.value]=n}}}function vk(t,e,n,r,i){if(Vt(r)&&!Vt(e)){if(!(n!=null&&n.kind!==q.NULL)&&!(i!==void 0))return!1;const a=r.ofType;return dc(t,e,a)}return dc(t,e,r)}const _k=Object.freeze([NR]);Object.freeze([vR,uk,DR,rk,Ab,SR,gk,KR,_R,lk,xR,MR,HR,AR,pk,CR,LR,Nb,jb,wR,$b,hk,JR,yk,FR,Ub,..._k]);const bk=Object.freeze([RR,dk,fk,ok,ak,ik,sk,Ab,Nb,jb,qR,kb,$b,Ub,Fb]);class Ek{constructor(e,n){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=n}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let n;if(this._fragments)n=this._fragments;else{n=Object.create(null);for(const r of this.getDocument().definitions)r.kind===q.FRAGMENT_DEFINITION&&(n[r.name.value]=r);this._fragments=n}return n[e]}getFragmentSpreads(e){let n=this._fragmentSpreads.get(e);if(!n){n=[];const r=[e];let i;for(;i=r.pop();)for(const s of i.selections)s.kind===q.FRAGMENT_SPREAD?n.push(s):s.selectionSet&&r.push(s.selectionSet);this._fragmentSpreads.set(e,n)}return n}getRecursivelyReferencedFragments(e){let n=this._recursivelyReferencedFragments.get(e);if(!n){n=[];const r=Object.create(null),i=[e.selectionSet];let s;for(;s=i.pop();)for(const o of this.getFragmentSpreads(s)){const a=o.name.value;if(r[a]!==!0){r[a]=!0;const c=this.getFragment(a);c&&(n.push(c),i.push(c.selectionSet))}}this._recursivelyReferencedFragments.set(e,n)}return n}}class Sk extends Ek{constructor(e,n,r){super(e,r),this._schema=n}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}function wk(t,e,n=bk){const r=[],i=new Sk(t,e,o=>{r.push(o)}),s=n.map(o=>o(i));return ab(t,KD(s)),r}function Tk(t){const e=wk(t);if(e.length!==0)throw new Error(e.map(n=>n.message).join(`
|
|
53
|
-
|
|
54
|
-
`))}function Ik(t,e,n){var r,i,s,o;const a=[],c=Object.create(null),l=[];let u;const d=[];for(const I of e.definitions)if(I.kind===q.SCHEMA_DEFINITION)u=I;else if(I.kind===q.SCHEMA_EXTENSION)d.push(I);else if(Sl(I))a.push(I);else if(Zh(I)){const X=I.name.value,B=c[X];c[X]=B?B.concat([I]):[I]}else I.kind===q.DIRECTIVE_DEFINITION&&l.push(I);if(Object.keys(c).length===0&&a.length===0&&l.length===0&&d.length===0&&u==null)return t;const f=Object.create(null);for(const I of t.types)f[I.name]=g(I);for(const I of a){var p;const X=I.name.value;f[X]=(p=wy[X])!==null&&p!==void 0?p:L(I)}const h={query:t.query&&v(t.query),mutation:t.mutation&&v(t.mutation),subscription:t.subscription&&v(t.subscription),...u&&ne([u]),...ne(d)};return{description:(r=u)===null||r===void 0||(i=r.description)===null||i===void 0?void 0:i.value,...h,types:Object.values(f),directives:[...t.directives.map(y),...l.map(S)],extensions:Object.create(null),astNode:(s=u)!==null&&s!==void 0?s:t.astNode,extensionASTNodes:t.extensionASTNodes.concat(d),assumeValid:(o=n==null?void 0:n.assumeValid)!==null&&o!==void 0?o:!1};function m(I){return er(I)?new An(m(I.ofType)):Vt(I)?new pt(m(I.ofType)):v(I)}function v(I){return f[I.name]}function y(I){const X=I.toConfig();return new os({...X,args:_i(X.args,$)})}function g(I){if(pR(I)||lR(I))return I;if(_a(I))return w(I);if(Ln(I))return E(I);if(vn(I))return R(I);if(xi(I))return j(I);if(Oi(I))return T(I);if(Qn(I))return _(I);xr(!1,"Unexpected type: "+Ze(I))}function _(I){var X;const B=I.toConfig(),H=(X=c[B.name])!==null&&X!==void 0?X:[];return new Rp({...B,fields:()=>({..._i(B.fields,ve=>({...ve,type:m(ve.type)})),...U(H)}),extensionASTNodes:B.extensionASTNodes.concat(H)})}function T(I){var X;const B=I.toConfig(),H=(X=c[I.name])!==null&&X!==void 0?X:[];return new Oc({...B,values:{...B.values,...oe(H)},extensionASTNodes:B.extensionASTNodes.concat(H)})}function w(I){var X;const B=I.toConfig(),H=(X=c[B.name])!==null&&X!==void 0?X:[];let ve=B.specifiedByURL;for(const Ee of H){var he;ve=(he=Ty(Ee))!==null&&he!==void 0?he:ve}return new Di({...B,specifiedByURL:ve,extensionASTNodes:B.extensionASTNodes.concat(H)})}function E(I){var X;const B=I.toConfig(),H=(X=c[B.name])!==null&&X!==void 0?X:[];return new lr({...B,interfaces:()=>[...I.getInterfaces().map(v),...F(H)],fields:()=>({..._i(B.fields,M),...k(H)}),extensionASTNodes:B.extensionASTNodes.concat(H)})}function R(I){var X;const B=I.toConfig(),H=(X=c[B.name])!==null&&X!==void 0?X:[];return new Dp({...B,interfaces:()=>[...I.getInterfaces().map(v),...F(H)],fields:()=>({..._i(B.fields,M),...k(H)}),extensionASTNodes:B.extensionASTNodes.concat(H)})}function j(I){var X;const B=I.toConfig(),H=(X=c[B.name])!==null&&X!==void 0?X:[];return new Vo({...B,types:()=>[...I.getTypes().map(v),...Z(H)],extensionASTNodes:B.extensionASTNodes.concat(H)})}function M(I){return{...I,type:m(I.type),args:I.args&&_i(I.args,$)}}function $(I){return{...I,type:m(I.type)}}function ne(I){const X={};for(const H of I){var B;const ve=(B=H.operationTypes)!==null&&B!==void 0?B:[];for(const he of ve)X[he.operation]=x(he.type)}return X}function x(I){var X;const B=I.name.value,H=(X=wy[B])!==null&&X!==void 0?X:f[B];if(H===void 0)throw new Error(`Unknown type: "${B}".`);return H}function G(I){return I.kind===q.LIST_TYPE?new An(G(I.type)):I.kind===q.NON_NULL_TYPE?new pt(G(I.type)):x(I)}function S(I){var X;return new os({name:I.name.value,description:(X=I.description)===null||X===void 0?void 0:X.value,locations:I.locations.map(({value:B})=>B),isRepeatable:I.repeatable,args:C(I.arguments),astNode:I})}function k(I){const X=Object.create(null);for(const ve of I){var B;const he=(B=ve.fields)!==null&&B!==void 0?B:[];for(const Ee of he){var H;X[Ee.name.value]={type:G(Ee.type),description:(H=Ee.description)===null||H===void 0?void 0:H.value,args:C(Ee.arguments),deprecationReason:Yl(Ee),astNode:Ee}}}return X}function C(I){const X=I??[],B=Object.create(null);for(const ve of X){var H;const he=G(ve.type);B[ve.name.value]={type:he,description:(H=ve.description)===null||H===void 0?void 0:H.value,defaultValue:Ns(ve.defaultValue,he),deprecationReason:Yl(ve),astNode:ve}}return B}function U(I){const X=Object.create(null);for(const ve of I){var B;const he=(B=ve.fields)!==null&&B!==void 0?B:[];for(const Ee of he){var H;const ze=G(Ee.type);X[Ee.name.value]={type:ze,description:(H=Ee.description)===null||H===void 0?void 0:H.value,defaultValue:Ns(Ee.defaultValue,ze),deprecationReason:Yl(Ee),astNode:Ee}}}return X}function oe(I){const X=Object.create(null);for(const ve of I){var B;const he=(B=ve.values)!==null&&B!==void 0?B:[];for(const Ee of he){var H;X[Ee.name.value]={description:(H=Ee.description)===null||H===void 0?void 0:H.value,deprecationReason:Yl(Ee),astNode:Ee}}}return X}function F(I){return I.flatMap(X=>{var B,H;return(B=(H=X.interfaces)===null||H===void 0?void 0:H.map(x))!==null&&B!==void 0?B:[]})}function Z(I){return I.flatMap(X=>{var B,H;return(B=(H=X.types)===null||H===void 0?void 0:H.map(x))!==null&&B!==void 0?B:[]})}function L(I){var X;const B=I.name.value,H=(X=c[B])!==null&&X!==void 0?X:[];switch(I.kind){case q.OBJECT_TYPE_DEFINITION:{var ve;const it=[I,...H];return new lr({name:B,description:(ve=I.description)===null||ve===void 0?void 0:ve.value,interfaces:()=>F(it),fields:()=>k(it),astNode:I,extensionASTNodes:H})}case q.INTERFACE_TYPE_DEFINITION:{var he;const it=[I,...H];return new Dp({name:B,description:(he=I.description)===null||he===void 0?void 0:he.value,interfaces:()=>F(it),fields:()=>k(it),astNode:I,extensionASTNodes:H})}case q.ENUM_TYPE_DEFINITION:{var Ee;const it=[I,...H];return new Oc({name:B,description:(Ee=I.description)===null||Ee===void 0?void 0:Ee.value,values:oe(it),astNode:I,extensionASTNodes:H})}case q.UNION_TYPE_DEFINITION:{var ze;const it=[I,...H];return new Vo({name:B,description:(ze=I.description)===null||ze===void 0?void 0:ze.value,types:()=>Z(it),astNode:I,extensionASTNodes:H})}case q.SCALAR_TYPE_DEFINITION:{var rt;return new Di({name:B,description:(rt=I.description)===null||rt===void 0?void 0:rt.value,specifiedByURL:Ty(I),astNode:I,extensionASTNodes:H})}case q.INPUT_OBJECT_TYPE_DEFINITION:{var We;const it=[I,...H];return new Rp({name:B,description:(We=I.description)===null||We===void 0?void 0:We.value,fields:()=>U(it),astNode:I,extensionASTNodes:H,isOneOf:xk(I)})}}}}const wy=Vs([...Hh,...qh],t=>t.name);function Yl(t){const e=Dc(Sb,t);return e==null?void 0:e.reason}function Ty(t){const e=Dc(wb,t);return e==null?void 0:e.url}function xk(t){return!!Dc(Tb,t)}function Ok(t,e){t!=null&&t.kind===q.DOCUMENT||kt(!1,"Must provide valid Document AST."),(e==null?void 0:e.assumeValid)!==!0&&(e==null?void 0:e.assumeValidSDL)!==!0&&Tk(t);const r=Ik({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},t,e);if(r.astNode==null)for(const s of r.types)switch(s.name){case"Query":r.query=s;break;case"Mutation":r.mutation=s;break;case"Subscription":r.subscription=s;break}const i=[...r.directives,...ba.filter(s=>r.directives.every(o=>o.name!==s.name))];return new hR({...r,directives:i})}function Dk(t,e){const n=sb(t,{noLocation:void 0,allowLegacyFragmentVariables:void 0});return Ok(n,{assumeValidSDL:void 0,assumeValid:void 0})}const Xh=JSON,Rk=t=>t.toUpperCase(),kk=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},Nk=(t,e,n)=>t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0},Ak=(t,e,n)=>t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0},Ck=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0},Iy=t=>{var r,i;let e;const n=t.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(e=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),e},Zf=t=>{if(typeof t=="string"){let n;try{const r=sb(t);n=Iy(r)}catch{}return{query:t,operationName:n}}const e=Iy(t);return{query:fn(t),operationName:e}};class Ho extends Error{constructor(e,n){const r=`${Ho.extractMessage(e)}: ${JSON.stringify({response:e,request:n})}`;super(r),Object.setPrototypeOf(this,Ho.prototype),this.response=e,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ho)}static extractMessage(e){var n,r;return((r=(n=e.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${e.status})`}}var Cp={exports:{}};(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof ar<"u"&&ar,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof ar<"u"&&ar||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(k){return k&&u.indexOf(Object.prototype.toString.call(k))>-1};function f(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function h(k){var C={next:function(){var U=k.shift();return{done:U===void 0,value:U}}};return c.iterable&&(C[Symbol.iterator]=function(){return C}),C}function m(k){this.map={},k instanceof m?k.forEach(function(C,U){this.append(U,C)},this):Array.isArray(k)?k.forEach(function(C){if(C.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+C.length);this.append(C[0],C[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(C){this.append(C,k[C])},this)}m.prototype.append=function(k,C){k=f(k),C=p(C);var U=this.map[k];this.map[k]=U?U+", "+C:C},m.prototype.delete=function(k){delete this.map[f(k)]},m.prototype.get=function(k){return k=f(k),this.has(k)?this.map[k]:null},m.prototype.has=function(k){return this.map.hasOwnProperty(f(k))},m.prototype.set=function(k,C){this.map[f(k)]=p(C)},m.prototype.forEach=function(k,C){for(var U in this.map)this.map.hasOwnProperty(U)&&k.call(C,this.map[U],U,this)},m.prototype.keys=function(){var k=[];return this.forEach(function(C,U){k.push(U)}),h(k)},m.prototype.values=function(){var k=[];return this.forEach(function(C){k.push(C)}),h(k)},m.prototype.entries=function(){var k=[];return this.forEach(function(C,U){k.push([U,C])}),h(k)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function v(k){if(!k._noBody){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}}function y(k){return new Promise(function(C,U){k.onload=function(){C(k.result)},k.onerror=function(){U(k.error)}})}function g(k){var C=new FileReader,U=y(C);return C.readAsArrayBuffer(k),U}function _(k){var C=new FileReader,U=y(C),oe=/charset=([A-Za-z0-9_-]+)/.exec(k.type),F=oe?oe[1]:"utf-8";return C.readAsText(k,F),U}function T(k){for(var C=new Uint8Array(k),U=new Array(C.length),oe=0;oe<C.length;oe++)U[oe]=String.fromCharCode(C[oe]);return U.join("")}function w(k){if(k.slice)return k.slice(0);var C=new Uint8Array(k.byteLength);return C.set(new Uint8Array(k)),C.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=w(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||d(k))?this._bodyArrayBuffer=w(k):this._bodyText=k=Object.prototype.toString.call(k):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof k=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=v(this);if(k)return k;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var k=v(this);return k||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var k=v(this);if(k)return k;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}var R=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function j(k){var C=k.toUpperCase();return R.indexOf(C)>-1?C:k}function M(k,C){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');C=C||{};var U=C.body;if(k instanceof M){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,C.headers||(this.headers=new m(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!U&&k._bodyInit!=null&&(U=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=C.credentials||this.credentials||"same-origin",(C.headers||!this.headers)&&(this.headers=new m(C.headers)),this.method=j(C.method||this.method||"GET"),this.mode=C.mode||this.mode||null,this.signal=C.signal||this.signal||function(){if("AbortController"in a){var Z=new AbortController;return Z.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&U)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(U),(this.method==="GET"||this.method==="HEAD")&&(C.cache==="no-store"||C.cache==="no-cache")){var oe=/([?&])_=[^&]*/;if(oe.test(this.url))this.url=this.url.replace(oe,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function $(k){var C=new FormData;return k.trim().split("&").forEach(function(U){if(U){var oe=U.split("="),F=oe.shift().replace(/\+/g," "),Z=oe.join("=").replace(/\+/g," ");C.append(decodeURIComponent(F),decodeURIComponent(Z))}}),C}function ne(k){var C=new m,U=k.replace(/\r?\n[\t ]+/g," ");return U.split("\r").map(function(oe){return oe.indexOf(`
|
|
55
|
-
`)===0?oe.substr(1,oe.length):oe}).forEach(function(oe){var F=oe.split(":"),Z=F.shift().trim();if(Z){var L=F.join(":").trim();try{C.append(Z,L)}catch(I){console.warn("Response "+I.message)}}}),C}E.call(M.prototype);function x(k,C){if(!(this instanceof x))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(C||(C={}),this.type="default",this.status=C.status===void 0?200:C.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=C.statusText===void 0?"":""+C.statusText,this.headers=new m(C.headers),this.url=C.url||"",this._initBody(k)}E.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},x.error=function(){var k=new x(null,{status:200,statusText:""});return k.ok=!1,k.status=0,k.type="error",k};var G=[301,302,303,307,308];x.redirect=function(k,C){if(G.indexOf(C)===-1)throw new RangeError("Invalid status code");return new x(null,{status:C,headers:{location:k}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(C,U){this.message=C,this.name=U;var oe=Error(C);this.stack=oe.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function S(k,C){return new Promise(function(U,oe){var F=new M(k,C);if(F.signal&&F.signal.aborted)return oe(new o.DOMException("Aborted","AbortError"));var Z=new XMLHttpRequest;function L(){Z.abort()}Z.onload=function(){var B={statusText:Z.statusText,headers:ne(Z.getAllResponseHeaders()||"")};F.url.indexOf("file://")===0&&(Z.status<200||Z.status>599)?B.status=200:B.status=Z.status,B.url="responseURL"in Z?Z.responseURL:B.headers.get("X-Request-URL");var H="response"in Z?Z.response:Z.responseText;setTimeout(function(){U(new x(H,B))},0)},Z.onerror=function(){setTimeout(function(){oe(new TypeError("Network request failed"))},0)},Z.ontimeout=function(){setTimeout(function(){oe(new TypeError("Network request timed out"))},0)},Z.onabort=function(){setTimeout(function(){oe(new o.DOMException("Aborted","AbortError"))},0)};function I(B){try{return B===""&&a.location.href?a.location.href:B}catch{return B}}if(Z.open(F.method,I(F.url),!0),F.credentials==="include"?Z.withCredentials=!0:F.credentials==="omit"&&(Z.withCredentials=!1),"responseType"in Z&&(c.blob?Z.responseType="blob":c.arrayBuffer&&(Z.responseType="arraybuffer")),C&&typeof C.headers=="object"&&!(C.headers instanceof m||a.Headers&&C.headers instanceof a.Headers)){var X=[];Object.getOwnPropertyNames(C.headers).forEach(function(B){X.push(f(B)),Z.setRequestHeader(B,p(C.headers[B]))}),F.headers.forEach(function(B,H){X.indexOf(H)===-1&&Z.setRequestHeader(H,B)})}else F.headers.forEach(function(B,H){Z.setRequestHeader(H,B)});F.signal&&(F.signal.addEventListener("abort",L),Z.onreadystatechange=function(){Z.readyState===4&&F.signal.removeEventListener("abort",L)}),Z.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}return S.polyfill=!0,a.fetch||(a.fetch=S,a.Headers=m,a.Request=M,a.Response=x),o.Headers=m,o.Request=M,o.Response=x,o.fetch=S,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(Cp,Cp.exports);var Vu=Cp.exports;const Eu=vl(Vu),Mk=y1({__proto__:null,default:Eu},[Vu]),_o=t=>{let e={};return t&&(typeof Headers<"u"&&t instanceof Headers||Mk&&Vu.Headers&&t instanceof Vu.Headers?e=kk(t):Array.isArray(t)?t.forEach(([n,r])=>{n&&r!==void 0&&(e[n]=r)}):e=t),e},xy=t=>t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Lk=t=>{if(!Array.isArray(t.query)){const r=t,i=[`query=${encodeURIComponent(xy(r.query))}`];return t.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof t.variables<"u"&&!Array.isArray(t.variables))throw new Error("Cannot create query with given variable type, array expected");const e=t,n=t.query.reduce((r,i,s)=>(r.push({query:xy(i),variables:e.variables?e.jsonSerializer.stringify(e.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(e.jsonSerializer.stringify(n))}`},Pk=t=>async e=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:a,middleware:c}=e,l={...e.headers};let u="",d;t==="POST"?(d=$k(r,i,s,a.jsonSerializer),typeof d=="string"&&(l["Content-Type"]="application/json")):u=Lk({query:r,variables:i,operationName:s,jsonSerializer:a.jsonSerializer??Xh});const f={method:t,headers:l,body:d,...a};let p=n,h=f;if(c){const m=await Promise.resolve(c({...f,url:n,operationName:s,variables:i})),{url:v,...y}=m;p=v,h=y}return u&&(p=`${p}?${u}`),await o(p,h)};class Fk{constructor(e,n={}){this.url=e,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,o]=r,a=Ak(i,s,o),{headers:c,fetch:l=Eu,method:u="POST",requestMiddleware:d,responseMiddleware:f,...p}=this.requestConfig,{url:h}=this;a.signal!==void 0&&(p.signal=a.signal);const{operationName:m}=Zf(a.query);return Gf({url:h,query:a.query,variables:a.variables,headers:{..._o(Yf(c)),..._o(a.requestHeaders)},operationName:m,fetch:l,method:u,fetchOptions:p,middleware:d}).then(v=>(f&&f(v),v)).catch(v=>{throw f&&f(v),v})}}async request(e,...n){const[r,i]=n,s=Nk(e,r,i),{headers:o,fetch:a=Eu,method:c="POST",requestMiddleware:l,responseMiddleware:u,...d}=this.requestConfig,{url:f}=this;s.signal!==void 0&&(d.signal=s.signal);const{query:p,operationName:h}=Zf(s.document);return Gf({url:f,query:p,variables:s.variables,headers:{..._o(Yf(o)),..._o(s.requestHeaders)},operationName:h,fetch:a,method:c,fetchOptions:d,middleware:l}).then(m=>(u&&u(m),m.data)).catch(m=>{throw u&&u(m),m})}batchRequests(e,n){const r=Ck(e,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const o=r.documents.map(({document:c})=>Zf(c).query),a=r.documents.map(({variables:c})=>c);return Gf({url:this.url,query:o,variables:a,headers:{..._o(Yf(i)),..._o(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??Eu,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(c=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c.data)).catch(c=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c})}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,n){const{headers:r}=this.requestConfig;return r?r[e]=n:this.requestConfig.headers={[e]:n},this}setEndpoint(e){return this.url=e,this}}const Gf=async t=>{const{query:e,variables:n,fetchOptions:r}=t,i=Pk(Rk(t.method??"post")),s=Array.isArray(t.query),o=await i(t),a=await jk(o,r.jsonSerializer??Xh),c=Array.isArray(a)?!a.some(({data:u})=>!u):!!a.data,l=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(o.ok&&l&&c){const{errors:u,...d}=(Array.isArray(a),a),f=r.errorPolicy==="ignore"?d:a;return{...s?{data:f}:f,headers:o.headers,status:o.status}}else{const u=typeof a=="string"?{error:a}:a;throw new Ho({...u,status:o.status,headers:o.headers},{query:e,variables:n})}},$k=(t,e,n,r)=>{const i=r??Xh;if(!Array.isArray(t))return i.stringify({query:t,variables:e,operationName:n});if(typeof e<"u"&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");const s=t.reduce((o,a,c)=>(o.push({query:a,variables:e?e[c]:void 0}),o),[]);return i.stringify(s)},jk=async(t,e)=>{let n;return t.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?e.parse(await t.text()):t.text()},Yf=t=>typeof t=="function"?t():t,Wo=(t,...e)=>t.reduce((n,r,i)=>`${n}${r}${i in e?String(e[i]):""}`,"");var Vr;class Uk{constructor(){jr(this,Vr,console)}set logger(e){Ma(this,Vr,e)}log(...e){return Dt(this,Vr).log(...e)}info(...e){return Dt(this,Vr).info(...e)}warn(...e){return Dt(this,Vr).warn(...e)}error(...e){return Dt(this,Vr).error(...e)}debug(...e){return Dt(this,Vr).debug(...e)}trace(...e){return Dt(this,Vr).trace(...e)}}Vr=new WeakMap;const Bb=new Uk,ct=Bb,Bk=t=>Bb.logger=t;async function qo(...t){const[e,...n]=t,r=new Fk(e,{fetch}),{errors:i,...s}=await r.request(...n),o={...s};return i!=null&&i.length&&(o.errors=i.map(({message:a,...c})=>new _e(a,c))),o}function Su(t){return t instanceof lr?Object.entries(t.getFields()).map(([e,n])=>{const r=n.type instanceof pt?n.type.ofType:n.type;if(r instanceof lr||r instanceof Vo)return`${e} { ${Su(r)} }`;if(r instanceof An){const i=r.ofType instanceof pt?r.ofType.ofType:r.ofType;if(i instanceof Di)return e;if(i instanceof lr||i instanceof Vo)return`${e} { ${Su(i)} }`;throw new Error(`List item type ${i.toString()} is not handled`)}return e}).join(" "):t instanceof Vo?t.getTypes().map(e=>`... on ${e.name} { ${Su(e)} }`).join(" "):""}function zk(t,e){const n=Y_(t.name),r=t.specifications.at(-1);if(!r)throw new Error("No document model specification found");const i=`${r.state.global.schema} type Query { ${n}: ${n}State }`,o=Dk(i).getQueryType();if(!o)throw new Error("No query type found");const c=o.getFields()[n];if(!c)throw new Error("No state query found");return Su(c.type)}async function As(t){var n,r;let e;try{const i=await qo(t,Wo`
|
|
56
|
-
query getDrive {
|
|
57
|
-
drive {
|
|
58
|
-
id
|
|
59
|
-
name
|
|
60
|
-
icon
|
|
61
|
-
slug
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`);if((n=i.errors)!=null&&n.length||!i.drive)throw((r=i.errors)==null?void 0:r.at(0))??new Error("Drive not found");e=i.drive}catch(i){throw ct.error(i),new Error("Couldn't find drive info")}return e}async function Oy(t,e,n){const{documentModel:r,utils:i}=n,s=zk(r),o=Y_(r.name),a=await qo(t,Wo`
|
|
65
|
-
query ($id: String!) {
|
|
66
|
-
document(id: $id) {
|
|
67
|
-
id
|
|
68
|
-
name
|
|
69
|
-
created
|
|
70
|
-
documentType
|
|
71
|
-
lastModified
|
|
72
|
-
revision
|
|
73
|
-
operations {
|
|
74
|
-
id
|
|
75
|
-
error
|
|
76
|
-
hash
|
|
77
|
-
index
|
|
78
|
-
skip
|
|
79
|
-
timestamp
|
|
80
|
-
type
|
|
81
|
-
inputText
|
|
82
|
-
context {
|
|
83
|
-
signer {
|
|
84
|
-
user {
|
|
85
|
-
address
|
|
86
|
-
networkId
|
|
87
|
-
chainId
|
|
88
|
-
}
|
|
89
|
-
app {
|
|
90
|
-
name
|
|
91
|
-
key
|
|
92
|
-
}
|
|
93
|
-
signatures
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
... on ${o} {
|
|
98
|
-
state {
|
|
99
|
-
${s}
|
|
100
|
-
}
|
|
101
|
-
initialState {
|
|
102
|
-
${s}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
`,{id:e}),c=a.document?{...a.document,revision:{global:a.document.revision,local:0},state:i.createState({global:a.document.state}),operations:{global:a.document.operations.map(({inputText:l,...u})=>({...u,error:u.error??void 0,scope:"global",input:JSON.parse(l)})),local:[]},attachments:{},initialState:i.createExtendedState({created:a.document.created,lastModified:a.document.created,state:i.createState({global:a.document.initialState})}),clipboard:[]}:null;return{...a,document:c}}function Vk(t){const{open:e,groupSharingType:n,onAddRemoteDrive:r,onClose:i}=t;async function s(o){await r(o),i()}return Te(ZO,{open:e,onSubmit:s,sharingType:n,onOpenChange:o=>{if(!o)return i()},requestPublicDrive:As})}const Hk=t=>{const{open:e,onClose:n,onCancel:r,title:i,body:s,cancelLabel:o,continueLabel:a,onContinue:c}=t;return Te(GO,{open:e,onCancel:()=>r(n),header:i,body:s,cancelLabel:o,continueLabel:a,onContinue:()=>c(n),onOpenChange:l=>{if(!l)return n()}})},Wk=t=>{const{open:e,onClose:n}=t,{t:r}=so();return Te(M_,{open:e,header:r("modals.cookiesPolicy.title"),body:Te(U_,{i18nKey:"modals.cookiesPolicy.body",components:{subtitle:Te("h2",{className:"mb-4 text-lg font-bold"}),p:Te("p",{className:"mb-2"}),list:Te("ul",{className:"mb-4 list-disc pl-6"}),bullet:Te("li",{})}}),bodyProps:{className:"text-left"},closeLabel:"Close",onContinue:()=>n(),overlayProps:{style:{zIndex:1e4}}})};function Qi(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zb={exports:{}};/*!
|
|
108
|
-
|
|
109
|
-
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
110
|
-
<http://stuartk.com/jszip>
|
|
111
|
-
|
|
112
|
-
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
113
|
-
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
114
|
-
|
|
115
|
-
JSZip uses the library pako released under the MIT license :
|
|
116
|
-
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
117
|
-
*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(l,u){if(!i[l]){if(!r[l]){var d=typeof Qi=="function"&&Qi;if(!u&&d)return d(l,!0);if(a)return a(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var p=i[l]={exports:{}};r[l][0].call(p.exports,function(h){var m=r[l][1][h];return o(m||h)},p,p.exports,n,r,i,s)}return i[l].exports}for(var a=typeof Qi=="function"&&Qi,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(n,r,i){var s=n("./utils"),o=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(c){for(var l,u,d,f,p,h,m,v=[],y=0,g=c.length,_=g,T=s.getTypeOf(c)!=="string";y<c.length;)_=g-y,d=T?(l=c[y++],u=y<g?c[y++]:0,y<g?c[y++]:0):(l=c.charCodeAt(y++),u=y<g?c.charCodeAt(y++):0,y<g?c.charCodeAt(y++):0),f=l>>2,p=(3&l)<<4|u>>4,h=1<_?(15&u)<<2|d>>6:64,m=2<_?63&d:64,v.push(a.charAt(f)+a.charAt(p)+a.charAt(h)+a.charAt(m));return v.join("")},i.decode=function(c){var l,u,d,f,p,h,m=0,v=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var g,_=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&_--,c.charAt(c.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(g=o.uint8array?new Uint8Array(0|_):new Array(0|_);m<c.length;)l=a.indexOf(c.charAt(m++))<<2|(f=a.indexOf(c.charAt(m++)))>>4,u=(15&f)<<4|(p=a.indexOf(c.charAt(m++)))>>2,d=(3&p)<<6|(h=a.indexOf(c.charAt(m++))),g[v++]=l,p!==64&&(g[v++]=u),h!==64&&(g[v++]=d);return g}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function l(u,d,f,p,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=f,this.compression=p,this.compressedContent=h}l.prototype={getContentWorker:function(){var u=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(u,d,f){return u.pipe(new a).pipe(new c("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",d)},r.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),o=function(){for(var a,c=[],l=0;l<256;l++){a=l;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;c[l]=a}return c}();r.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(l,u,d,f){var p=o,h=f+d;l^=-1;for(var m=f;m<h;m++)l=l>>>8^p[255&(l^u[m])];return-1^l}(0|c,a,a.length,0):function(l,u,d,f){var p=o,h=f+d;l^=-1;for(var m=f;m<h;m++)l=l>>>8^p[255&(l^u.charCodeAt(m))];return-1^l}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),c=n("./stream/GenericWorker"),l=s?"uint8array":"array";function u(d,f){c.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(u,c),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(l,d.data),!1)},u.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},i.compressWorker=function(d){return new u("Deflate",d)},i.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,h){var m,v="";for(m=0;m<h;m++)v+=String.fromCharCode(255&p),p>>>=8;return v}function o(p,h,m,v,y,g){var _,T,w=p.file,E=p.compression,R=g!==l.utf8encode,j=a.transformTo("string",g(w.name)),M=a.transformTo("string",l.utf8encode(w.name)),$=w.comment,ne=a.transformTo("string",g($)),x=a.transformTo("string",l.utf8encode($)),G=M.length!==w.name.length,S=x.length!==$.length,k="",C="",U="",oe=w.dir,F=w.date,Z={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(Z.crc32=p.crc32,Z.compressedSize=p.compressedSize,Z.uncompressedSize=p.uncompressedSize);var L=0;h&&(L|=8),R||!G&&!S||(L|=2048);var I=0,X=0;oe&&(I|=16),y==="UNIX"?(X=798,I|=function(H,ve){var he=H;return H||(he=ve?16893:33204),(65535&he)<<16}(w.unixPermissions,oe)):(X=20,I|=function(H){return 63&(H||0)}(w.dosPermissions)),_=F.getUTCHours(),_<<=6,_|=F.getUTCMinutes(),_<<=5,_|=F.getUTCSeconds()/2,T=F.getUTCFullYear()-1980,T<<=4,T|=F.getUTCMonth()+1,T<<=5,T|=F.getUTCDate(),G&&(C=s(1,1)+s(u(j),4)+M,k+="up"+s(C.length,2)+C),S&&(U=s(1,1)+s(u(ne),4)+x,k+="uc"+s(U.length,2)+U);var B="";return B+=`
|
|
118
|
-
\0`,B+=s(L,2),B+=E.magic,B+=s(_,2),B+=s(T,2),B+=s(Z.crc32,4),B+=s(Z.compressedSize,4),B+=s(Z.uncompressedSize,4),B+=s(j.length,2),B+=s(k.length,2),{fileRecord:d.LOCAL_FILE_HEADER+B+j+k,dirRecord:d.CENTRAL_FILE_HEADER+s(X,2)+B+s(ne.length,2)+"\0\0\0\0"+s(I,4)+s(v,4)+j+k+ne}}var a=n("../utils"),c=n("../stream/GenericWorker"),l=n("../utf8"),u=n("../crc32"),d=n("../signature");function f(p,h,m,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,c),f.prototype.push=function(p){var h=p.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(h+100*(m-v-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var h=this.streamFiles&&!p.file.dir;if(h){var m=o(p,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var h=this.streamFiles&&!p.file.dir,m=o(p,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),h)this.push({data:function(v){return d.DATA_DESCRIPTOR+s(v.crc32,4)+s(v.compressedSize,4)+s(v.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var m=this.bytesWritten-p,v=function(y,g,_,T,w){var E=a.transformTo("string",w(T));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(g,4)+s(_,4)+s(E.length,2)+E}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var h=this;return p.on("data",function(m){h.processChunk(m)}),p.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),p.on("error",function(m){h.error(m)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var h=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<h.length;m++)try{h[m].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,h=0;h<p.length;h++)p[h].lock()},r.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),o=n("./ZipFileWorker");i.generateWorker=function(a,c,l){var u=new o(c.streamFiles,l,c.platform,c.encodeFileName),d=0;try{a.forEach(function(f,p){d++;var h=function(g,_){var T=g||_,w=s[T];if(!w)throw new Error(T+" is not a valid compression method !");return w}(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},v=p.dir,y=p.date;p._compressWorker(h,m).withStreamInfo("file",{name:f,dir:v,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(u)}),u.entriesCount=d}catch(f){u.error(f)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),o=n("./external"),a=n("./utf8"),c=n("./zipEntries"),l=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function d(f){return new o.Promise(function(p,h){var m=f.decompressed.getContentWorker().pipe(new l);m.on("error",function(v){h(v)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(f,p){var h=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),u.isNode&&u.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var v=new c(p);return v.load(m),v}).then(function(m){var v=[o.Promise.resolve(m)],y=m.files;if(p.checkCRC32)for(var g=0;g<y.length;g++)v.push(d(y[g]));return o.Promise.all(v)}).then(function(m){for(var v=m.shift(),y=v.files,g=0;g<y.length;g++){var _=y[g],T=_.fileNameStr,w=s.resolve(_.fileNameStr);h.file(w,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:p.createFolders}),_.dir||(h.file(w).unsafeOriginalName=T)}return v.zipComment.length&&(h.comment=v.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var s=n("../utils"),o=n("../stream/GenericWorker");function a(c,l){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}s.inherits(a,o),a.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(u){l.push({data:u,meta:{percent:0}})}).on("error",function(u){l.isPaused?this.generatedError=u:l.error(u)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var s=n("readable-stream").Readable;function o(a,c,l){s.call(this,c),this._helper=a;var u=this;a.on("data",function(d,f){u.push(d)||u._helper.pause(),l&&l(f)}).on("error",function(d){u.emit("error",d)}).on("end",function(){u.push(null)})}n("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},r.exports=o},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,i){function s(w,E,R){var j,M=a.getTypeOf(E),$=a.extend(R||{},u);$.date=$.date||new Date,$.compression!==null&&($.compression=$.compression.toUpperCase()),typeof $.unixPermissions=="string"&&($.unixPermissions=parseInt($.unixPermissions,8)),$.unixPermissions&&16384&$.unixPermissions&&($.dir=!0),$.dosPermissions&&16&$.dosPermissions&&($.dir=!0),$.dir&&(w=y(w)),$.createFolders&&(j=v(w))&&g.call(this,j,!0);var ne=M==="string"&&$.binary===!1&&$.base64===!1;R&&R.binary!==void 0||($.binary=!ne),(E instanceof d&&E.uncompressedSize===0||$.dir||!E||E.length===0)&&($.base64=!1,$.binary=!0,E="",$.compression="STORE",M="string");var x=null;x=E instanceof d||E instanceof c?E:h.isNode&&h.isStream(E)?new m(w,E):a.prepareContent(w,E,$.binary,$.optimizedBinaryString,$.base64);var G=new f(w,x,$);this.files[w]=G}var o=n("./utf8"),a=n("./utils"),c=n("./stream/GenericWorker"),l=n("./stream/StreamHelper"),u=n("./defaults"),d=n("./compressedObject"),f=n("./zipObject"),p=n("./generate"),h=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),v=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var E=w.lastIndexOf("/");return 0<E?w.substring(0,E):""},y=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},g=function(w,E){return E=E!==void 0?E:u.createFolders,w=y(w),this.files[w]||s.call(this,w,null,{dir:!0,createFolders:E}),this.files[w]};function _(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var E,R,j;for(E in this.files)j=this.files[E],(R=E.slice(this.root.length,E.length))&&E.slice(0,this.root.length)===this.root&&w(R,j)},filter:function(w){var E=[];return this.forEach(function(R,j){w(R,j)&&E.push(j)}),E},file:function(w,E,R){if(arguments.length!==1)return w=this.root+w,s.call(this,w,E,R),this;if(_(w)){var j=w;return this.filter(function($,ne){return!ne.dir&&j.test($)})}var M=this.files[this.root+w];return M&&!M.dir?M:null},folder:function(w){if(!w)return this;if(_(w))return this.filter(function(M,$){return $.dir&&w.test(M)});var E=this.root+w,R=g.call(this,E),j=this.clone();return j.root=R.name,j},remove:function(w){w=this.root+w;var E=this.files[w];if(E||(w.slice(-1)!=="/"&&(w+="/"),E=this.files[w]),E&&!E.dir)delete this.files[w];else for(var R=this.filter(function(M,$){return $.name.slice(0,w.length)===w}),j=0;j<R.length;j++)delete this.files[R[j].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var E,R={};try{if((R=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");a.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var j=R.comment||this.comment||"";E=p.generateWorker(this,R,j)}catch(M){(E=new c("error")).error(M)}return new l(E,R.type||"string",R.mimeType)},generateAsync:function(w,E){return this.generateInternalStream(w).accumulate(E)},generateNodeStream:function(w,E){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(E)}};r.exports=T},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,i){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,i){var s=n("./DataReader");function o(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),l=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===l&&this.data[f+2]===u&&this.data[f+3]===d)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),l=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.readData(4);return c===f[0]&&l===f[1]&&u===f[2]&&d===f[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=o},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var s=n("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,l=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=a,l},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),o=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),l=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var f=s.getTypeOf(d);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new l(d):o.uint8array?new u(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new c(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),o=n("../utils");function a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),o=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,o),a.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}o.prototype.processChunk.call(this,c)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(c){o.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(u){l.dataIsReady=!0,l.data=u,l.max=u&&u.length||0,l.type=s.getTypeOf(u),l.isPaused||l._tickAndRepeat()},function(u){l.error(u)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(c){a.processChunk(c)}),o.on("end",function(){a.end()}),o.on("error",function(c){a.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),o=n("./ConvertWorker"),a=n("./GenericWorker"),c=n("../base64"),l=n("../support"),u=n("../external"),d=null;if(l.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(h,m){return new u.Promise(function(v,y){var g=[],_=h._internalType,T=h._outputType,w=h._mimeType;h.on("data",function(E,R){g.push(E),m&&m(R)}).on("error",function(E){g=[],y(E)}).on("end",function(){try{var E=function(R,j,M){switch(R){case"blob":return s.newBlob(s.transformTo("arraybuffer",j),M);case"base64":return c.encode(j);default:return s.transformTo(R,j)}}(T,function(R,j){var M,$=0,ne=null,x=0;for(M=0;M<j.length;M++)x+=j[M].length;switch(R){case"string":return j.join("");case"array":return Array.prototype.concat.apply([],j);case"uint8array":for(ne=new Uint8Array(x),M=0;M<j.length;M++)ne.set(j[M],$),$+=j[M].length;return ne;case"nodebuffer":return Buffer.concat(j);default:throw new Error("concat : unsupported type '"+R+"'")}}(_,g),w);v(E)}catch(R){y(R)}g=[]}).resume()})}function p(h,m,v){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=v,s.checkSupport(y),this._worker=h.pipe(new o(y)),h.lock()}catch(g){this._worker=new a("error"),this._worker.error(g)}}p.prototype={accumulate:function(h){return f(this,h)},on:function(h,m){var v=this;return h==="data"?this._worker.on(h,function(y){m.call(v,y.data,y.meta)}):this._worker.on(h,function(){s.delay(m,arguments,v)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},h)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),o=n("./support"),a=n("./nodejsUtils"),c=n("./stream/GenericWorker"),l=new Array(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;l[254]=l[254]=1;function d(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}i.utf8encode=function(p){return o.nodebuffer?a.newBufferFrom(p,"utf-8"):function(h){var m,v,y,g,_,T=h.length,w=0;for(g=0;g<T;g++)(64512&(v=h.charCodeAt(g)))==55296&&g+1<T&&(64512&(y=h.charCodeAt(g+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),g++),w+=v<128?1:v<2048?2:v<65536?3:4;for(m=o.uint8array?new Uint8Array(w):new Array(w),g=_=0;_<w;g++)(64512&(v=h.charCodeAt(g)))==55296&&g+1<T&&(64512&(y=h.charCodeAt(g+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),g++),v<128?m[_++]=v:(v<2048?m[_++]=192|v>>>6:(v<65536?m[_++]=224|v>>>12:(m[_++]=240|v>>>18,m[_++]=128|v>>>12&63),m[_++]=128|v>>>6&63),m[_++]=128|63&v);return m}(p)},i.utf8decode=function(p){return o.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(h){var m,v,y,g,_=h.length,T=new Array(2*_);for(m=v=0;m<_;)if((y=h[m++])<128)T[v++]=y;else if(4<(g=l[y]))T[v++]=65533,m+=g-1;else{for(y&=g===2?31:g===3?15:7;1<g&&m<_;)y=y<<6|63&h[m++],g--;1<g?T[v++]=65533:y<65536?T[v++]=y:(y-=65536,T[v++]=55296|y>>10&1023,T[v++]=56320|1023&y)}return T.length!==v&&(T.subarray?T=T.subarray(0,v):T.length=v),s.applyFromCharCode(T)}(p=s.transformTo(o.uint8array?"uint8array":"array",p))},s.inherits(d,c),d.prototype.processChunk=function(p){var h=s.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=h;(h=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),h.set(m,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var v=function(g,_){var T;for((_=_||g.length)>g.length&&(_=g.length),T=_-1;0<=T&&(192&g[T])==128;)T--;return T<0||T===0?_:T+l[g[T]]>_?T:_}(h),y=h;v!==h.length&&(o.uint8array?(y=h.subarray(0,v),this.leftOver=h.subarray(v,h.length)):(y=h.slice(0,v),this.leftOver=h.slice(v,h.length))),this.push({data:i.utf8decode(y),meta:p.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,s.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),o=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function l(m){return m}function u(m,v){for(var y=0;y<m.length;++y)v[y]=255&m.charCodeAt(y);return v}n("setimmediate"),i.newBlob=function(m,v){i.checkSupport("blob");try{return new Blob([m],{type:v})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,v,y){var g=[],_=0,T=m.length;if(T<=y)return String.fromCharCode.apply(null,m);for(;_<T;)v==="array"||v==="nodebuffer"?g.push(String.fromCharCode.apply(null,m.slice(_,Math.min(_+y,T)))):g.push(String.fromCharCode.apply(null,m.subarray(_,Math.min(_+y,T)))),_+=y;return g.join("")},stringifyByChar:function(m){for(var v="",y=0;y<m.length;y++)v+=String.fromCharCode(m[y]);return v},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var v=65536,y=i.getTypeOf(m),g=!0;if(y==="uint8array"?g=d.applyCanBeUsed.uint8array:y==="nodebuffer"&&(g=d.applyCanBeUsed.nodebuffer),g)for(;1<v;)try{return d.stringifyByChunk(m,y,v)}catch{v=Math.floor(v/2)}return d.stringifyByChar(m)}function p(m,v){for(var y=0;y<m.length;y++)v[y]=m[y];return v}i.applyFromCharCode=f;var h={};h.string={string:l,array:function(m){return u(m,new Array(m.length))},arraybuffer:function(m){return h.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,a.allocBuffer(m.length))}},h.array={string:f,array:l,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},h.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:l,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},h.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:l,nodebuffer:function(m){return a.newBufferFrom(m)}},h.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return h.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:l},i.transformTo=function(m,v){if(v=v||"",!m)return v;i.checkSupport(m);var y=i.getTypeOf(v);return h[y][m](v)},i.resolve=function(m){for(var v=m.split("/"),y=[],g=0;g<v.length;g++){var _=v[g];_==="."||_===""&&g!==0&&g!==v.length-1||(_===".."?y.pop():y.push(_))}return y.join("/")},i.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(m){var v,y,g="";for(y=0;y<(m||"").length;y++)g+="\\x"+((v=m.charCodeAt(y))<16?"0":"")+v.toString(16).toUpperCase();return g},i.delay=function(m,v,y){setImmediate(function(){m.apply(y||null,v||[])})},i.inherits=function(m,v){function y(){}y.prototype=v.prototype,m.prototype=new y},i.extend=function(){var m,v,y={};for(m=0;m<arguments.length;m++)for(v in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],v)&&y[v]===void 0&&(y[v]=arguments[m][v]);return y},i.prepareContent=function(m,v,y,g,_){return c.Promise.resolve(v).then(function(T){return s.blob&&(T instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(T))!==-1)&&typeof FileReader<"u"?new c.Promise(function(w,E){var R=new FileReader;R.onload=function(j){w(j.target.result)},R.onerror=function(j){E(j.target.error)},R.readAsArrayBuffer(T)}):T}).then(function(T){var w=i.getTypeOf(T);return w?(w==="arraybuffer"?T=i.transformTo("uint8array",T):w==="string"&&(_?T=o.decode(T):y&&g!==!0&&(T=function(E){return u(E,s.uint8array?new Uint8Array(E.length):new Array(E.length))}(T))),T):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var s=n("./reader/readerFor"),o=n("./utils"),a=n("./signature"),c=n("./zipEntry"),l=n("./support");function u(d){this.files=[],this.loadOptions=d}u.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(d)+")")}},isSignature:function(d,f){var p=this.reader.index;this.reader.setIndex(d);var h=this.reader.readString(4)===f;return this.reader.setIndex(p),h},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),f=l.uint8array?"uint8array":"array",p=o.transformTo(f,d);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,f,p,h=this.zip64EndOfCentralSize-44;0<h;)d=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[d]={id:d,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,f;for(d=0;d<this.files.length;d++)f=this.files[d],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var f=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var h=f-p;if(0<h)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(d){this.reader=s(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var s=n("./reader/readerFor"),o=n("./utils"),a=n("./compressedObject"),c=n("./crc32"),l=n("./utf8"),u=n("./compressions"),d=n("./support");function f(p,h){this.options=p,this.loadOptions=h}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var h,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((h=function(v){for(var y in u)if(Object.prototype.hasOwnProperty.call(u,y)&&u[y].magic===v)return u[y];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,h,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var h=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(h),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var h,m,v,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)h=p.readInt(2),m=p.readInt(2),v=p.readData(m),this.extraFields[h]={id:h,length:m,value:v};p.setIndex(y)},handleUTF8:function(){var p=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var m=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var y=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var h=s(p.value);return h.readInt(1)!==1||c(this.fileName)!==h.readInt(4)?null:l.utf8decode(h.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var h=s(p.value);return h.readInt(1)!==1||c(this.fileComment)!==h.readInt(4)?null:l.utf8decode(h.readData(p.length-5))}return null}},r.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function s(h,m,v){this.name=h,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=m,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var o=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),l=n("./compressedObject"),u=n("./stream/GenericWorker");s.prototype={internalStream:function(h){var m=null,v="string";try{if(!h)throw new Error("No output type specified.");var y=(v=h.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),m=this._decompressWorker();var g=!this._dataBinary;g&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!g&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(_){(m=new u("error")).error(_)}return new o(m,v,"")},async:function(h,m){return this.internalStream(h).accumulate(m)},nodeStream:function(h,m){return this.internalStream(h||"nodebuffer").toNodejsStream(m)},_compressWorker:function(h,m){if(this._data instanceof l&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(v,h,m)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof u?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<d.length;p++)s.prototype[d[p]]=f;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(s){var o,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var l=0,u=new c(h),d=s.document.createTextNode("");u.observe(d,{characterData:!0}),o=function(){d.data=l=++l%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){h(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(h,0)};else{var f=new s.MessageChannel;f.port1.onmessage=h,o=function(){f.port2.postMessage(0)}}var p=[];function h(){var m,v;a=!0;for(var y=p.length;y;){for(v=p,p=[],m=-1;++m<y;)v[m]();y=p.length}a=!1}r.exports=function(m){p.push(m)!==1||a||o()}}).call(this,typeof ar<"u"?ar:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var s=n("immediate");function o(){}var a={},c=["REJECTED"],l=["FULFILLED"],u=["PENDING"];function d(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,y!==o&&m(this,y)}function f(y,g,_){this.promise=y,typeof g=="function"&&(this.onFulfilled=g,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function p(y,g,_){s(function(){var T;try{T=g(_)}catch(w){return a.reject(y,w)}T===y?a.reject(y,new TypeError("Cannot resolve promise with itself")):a.resolve(y,T)})}function h(y){var g=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof g=="function")return function(){g.apply(y,arguments)}}function m(y,g){var _=!1;function T(R){_||(_=!0,a.reject(y,R))}function w(R){_||(_=!0,a.resolve(y,R))}var E=v(function(){g(w,T)});E.status==="error"&&T(E.value)}function v(y,g){var _={};try{_.value=y(g),_.status="success"}catch(T){_.status="error",_.value=T}return _}(r.exports=d).prototype.finally=function(y){if(typeof y!="function")return this;var g=this.constructor;return this.then(function(_){return g.resolve(y()).then(function(){return _})},function(_){return g.resolve(y()).then(function(){throw _})})},d.prototype.catch=function(y){return this.then(null,y)},d.prototype.then=function(y,g){if(typeof y!="function"&&this.state===l||typeof g!="function"&&this.state===c)return this;var _=new this.constructor(o);return this.state!==u?p(_,this.state===l?y:g,this.outcome):this.queue.push(new f(_,y,g)),_},f.prototype.callFulfilled=function(y){a.resolve(this.promise,y)},f.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},f.prototype.callRejected=function(y){a.reject(this.promise,y)},f.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},a.resolve=function(y,g){var _=v(h,g);if(_.status==="error")return a.reject(y,_.value);var T=_.value;if(T)m(y,T);else{y.state=l,y.outcome=g;for(var w=-1,E=y.queue.length;++w<E;)y.queue[w].callFulfilled(g)}return y},a.reject=function(y,g){y.state=c,y.outcome=g;for(var _=-1,T=y.queue.length;++_<T;)y.queue[_].callRejected(g);return y},d.resolve=function(y){return y instanceof this?y:a.resolve(new this(o),y)},d.reject=function(y){var g=new this(o);return a.reject(g,y)},d.all=function(y){var g=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,T=!1;if(!_)return this.resolve([]);for(var w=new Array(_),E=0,R=-1,j=new this(o);++R<_;)M(y[R],R);return j;function M($,ne){g.resolve($).then(function(x){w[ne]=x,++E!==_||T||(T=!0,a.resolve(j,w))},function(x){T||(T=!0,a.reject(j,x))})}},d.race=function(y){var g=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,T=!1;if(!_)return this.resolve([]);for(var w=-1,E=new this(o);++w<_;)R=y[w],g.resolve(R).then(function(j){T||(T=!0,a.resolve(E,j))},function(j){T||(T=!0,a.reject(E,j))});var R;return E}},{immediate:36}],38:[function(n,r,i){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var s=n("./zlib/deflate"),o=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/messages"),l=n("./zlib/zstream"),u=Object.prototype.toString,d=0,f=-1,p=0,h=8;function m(y){if(!(this instanceof m))return new m(y);this.options=o.assign({level:f,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var g=this.options;g.raw&&0<g.windowBits?g.windowBits=-g.windowBits:g.gzip&&0<g.windowBits&&g.windowBits<16&&(g.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var _=s.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(_!==d)throw new Error(c[_]);if(g.header&&s.deflateSetHeader(this.strm,g.header),g.dictionary){var T;if(T=typeof g.dictionary=="string"?a.string2buf(g.dictionary):u.call(g.dictionary)==="[object ArrayBuffer]"?new Uint8Array(g.dictionary):g.dictionary,(_=s.deflateSetDictionary(this.strm,T))!==d)throw new Error(c[_]);this._dict_set=!0}}function v(y,g){var _=new m(g);if(_.push(y,!0),_.err)throw _.msg||c[_.err];return _.result}m.prototype.push=function(y,g){var _,T,w=this.strm,E=this.options.chunkSize;if(this.ended)return!1;T=g===~~g?g:g===!0?4:0,typeof y=="string"?w.input=a.string2buf(y):u.call(y)==="[object ArrayBuffer]"?w.input=new Uint8Array(y):w.input=y,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new o.Buf8(E),w.next_out=0,w.avail_out=E),(_=s.deflate(w,T))!==1&&_!==d)return this.onEnd(_),!(this.ended=!0);w.avail_out!==0&&(w.avail_in!==0||T!==4&&T!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(w.output,w.next_out))):this.onData(o.shrinkBuf(w.output,w.next_out)))}while((0<w.avail_in||w.avail_out===0)&&_!==1);return T===4?(_=s.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===d):T!==2||(this.onEnd(d),!(w.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},i.Deflate=m,i.deflate=v,i.deflateRaw=function(y,g){return(g=g||{}).raw=!0,v(y,g)},i.gzip=function(y,g){return(g=g||{}).gzip=!0,v(y,g)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,i){var s=n("./zlib/inflate"),o=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/constants"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=n("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||m&&m.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,v.windowBits);if(y!==c.Z_OK)throw new Error(l[y]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function h(m,v){var y=new p(v);if(y.push(m,!0),y.err)throw y.msg||l[y.err];return y.result}p.prototype.push=function(m,v){var y,g,_,T,w,E,R=this.strm,j=this.options.chunkSize,M=this.options.dictionary,$=!1;if(this.ended)return!1;g=v===~~v?v:v===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?R.input=a.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?R.input=new Uint8Array(m):R.input=m,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new o.Buf8(j),R.next_out=0,R.avail_out=j),(y=s.inflate(R,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&M&&(E=typeof M=="string"?a.string2buf(M):f.call(M)==="[object ArrayBuffer]"?new Uint8Array(M):M,y=s.inflateSetDictionary(this.strm,E)),y===c.Z_BUF_ERROR&&$===!0&&(y=c.Z_OK,$=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);R.next_out&&(R.avail_out!==0&&y!==c.Z_STREAM_END&&(R.avail_in!==0||g!==c.Z_FINISH&&g!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=a.utf8border(R.output,R.next_out),T=R.next_out-_,w=a.buf2string(R.output,_),R.next_out=T,R.avail_out=j-T,T&&o.arraySet(R.output,R.output,_,T,0),this.onData(w)):this.onData(o.shrinkBuf(R.output,R.next_out)))),R.avail_in===0&&R.avail_out===0&&($=!0)}while((0<R.avail_in||R.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(g=c.Z_FINISH),g===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):g!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(R.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Inflate=p,i.inflate=h,i.inflateRaw=function(m,v){return(v=v||{}).raw=!0,h(m,v)},i.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var u=l.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])}}return c},i.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var o={arraySet:function(c,l,u,d,f){if(l.subarray&&c.subarray)c.set(l.subarray(u,u+d),f);else for(var p=0;p<d;p++)c[f+p]=l[u+p]},flattenChunks:function(c){var l,u,d,f,p,h;for(l=d=0,u=c.length;l<u;l++)d+=c[l].length;for(h=new Uint8Array(d),l=f=0,u=c.length;l<u;l++)p=c[l],h.set(p,f),f+=p.length;return h}},a={arraySet:function(c,l,u,d,f){for(var p=0;p<d;p++)c[f+p]=l[u+p]},flattenChunks:function(c){return[].concat.apply([],c)}};i.setTyped=function(c){c?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,o)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(s)},{}],42:[function(n,r,i){var s=n("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var c=new s.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(d,f){if(f<65537&&(d.subarray&&a||!d.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(d,f));for(var p="",h=0;h<f;h++)p+=String.fromCharCode(d[h]);return p}c[254]=c[254]=1,i.string2buf=function(d){var f,p,h,m,v,y=d.length,g=0;for(m=0;m<y;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<y&&(64512&(h=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(h-56320),m++),g+=p<128?1:p<2048?2:p<65536?3:4;for(f=new s.Buf8(g),m=v=0;v<g;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<y&&(64512&(h=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(h-56320),m++),p<128?f[v++]=p:(p<2048?f[v++]=192|p>>>6:(p<65536?f[v++]=224|p>>>12:(f[v++]=240|p>>>18,f[v++]=128|p>>>12&63),f[v++]=128|p>>>6&63),f[v++]=128|63&p);return f},i.buf2binstring=function(d){return u(d,d.length)},i.binstring2buf=function(d){for(var f=new s.Buf8(d.length),p=0,h=f.length;p<h;p++)f[p]=d.charCodeAt(p);return f},i.buf2string=function(d,f){var p,h,m,v,y=f||d.length,g=new Array(2*y);for(p=h=0;p<y;)if((m=d[p++])<128)g[h++]=m;else if(4<(v=c[m]))g[h++]=65533,p+=v-1;else{for(m&=v===2?31:v===3?15:7;1<v&&p<y;)m=m<<6|63&d[p++],v--;1<v?g[h++]=65533:m<65536?g[h++]=m:(m-=65536,g[h++]=55296|m>>10&1023,g[h++]=56320|1023&m)}return u(g,h)},i.utf8border=function(d,f){var p;for((f=f||d.length)>d.length&&(f=d.length),p=f-1;0<=p&&(192&d[p])==128;)p--;return p<0||p===0?f:p+c[d[p]]>f?p:f}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,o,a,c){for(var l=65535&s|0,u=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;u=u+(l=l+o[c++]|0)|0,--d;);l%=65521,u%=65521}return l|u<<16|0}},{}],44:[function(n,r,i){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,i){var s=function(){for(var o,a=[],c=0;c<256;c++){o=c;for(var l=0;l<8;l++)o=1&o?3988292384^o>>>1:o>>>1;a[c]=o}return a}();r.exports=function(o,a,c,l){var u=s,d=l+c;o^=-1;for(var f=l;f<d;f++)o=o>>>8^u[255&(o^a[f])];return-1^o}},{}],46:[function(n,r,i){var s,o=n("../utils/common"),a=n("./trees"),c=n("./adler32"),l=n("./crc32"),u=n("./messages"),d=0,f=4,p=0,h=-2,m=-1,v=4,y=2,g=8,_=9,T=286,w=30,E=19,R=2*T+1,j=15,M=3,$=258,ne=$+M+1,x=42,G=113,S=1,k=2,C=3,U=4;function oe(b,ae){return b.msg=u[ae],ae}function F(b){return(b<<1)-(4<b?9:0)}function Z(b){for(var ae=b.length;0<=--ae;)b[ae]=0}function L(b){var ae=b.state,ie=ae.pending;ie>b.avail_out&&(ie=b.avail_out),ie!==0&&(o.arraySet(b.output,ae.pending_buf,ae.pending_out,ie,b.next_out),b.next_out+=ie,ae.pending_out+=ie,b.total_out+=ie,b.avail_out-=ie,ae.pending-=ie,ae.pending===0&&(ae.pending_out=0))}function I(b,ae){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,ae),b.block_start=b.strstart,L(b.strm)}function X(b,ae){b.pending_buf[b.pending++]=ae}function B(b,ae){b.pending_buf[b.pending++]=ae>>>8&255,b.pending_buf[b.pending++]=255&ae}function H(b,ae){var ie,P,A=b.max_chain_length,V=b.strstart,ue=b.prev_length,se=b.nice_match,K=b.strstart>b.w_size-ne?b.strstart-(b.w_size-ne):0,ce=b.window,Ie=b.w_mask,be=b.prev,Be=b.strstart+$,ht=ce[V+ue-1],et=ce[V+ue];b.prev_length>=b.good_match&&(A>>=2),se>b.lookahead&&(se=b.lookahead);do if(ce[(ie=ae)+ue]===et&&ce[ie+ue-1]===ht&&ce[ie]===ce[V]&&ce[++ie]===ce[V+1]){V+=2,ie++;do;while(ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&ce[++V]===ce[++ie]&&V<Be);if(P=$-(Be-V),V=Be-$,ue<P){if(b.match_start=ae,se<=(ue=P))break;ht=ce[V+ue-1],et=ce[V+ue]}}while((ae=be[ae&Ie])>K&&--A!=0);return ue<=b.lookahead?ue:b.lookahead}function ve(b){var ae,ie,P,A,V,ue,se,K,ce,Ie,be=b.w_size;do{if(A=b.window_size-b.lookahead-b.strstart,b.strstart>=be+(be-ne)){for(o.arraySet(b.window,b.window,be,be,0),b.match_start-=be,b.strstart-=be,b.block_start-=be,ae=ie=b.hash_size;P=b.head[--ae],b.head[ae]=be<=P?P-be:0,--ie;);for(ae=ie=be;P=b.prev[--ae],b.prev[ae]=be<=P?P-be:0,--ie;);A+=be}if(b.strm.avail_in===0)break;if(ue=b.strm,se=b.window,K=b.strstart+b.lookahead,ce=A,Ie=void 0,Ie=ue.avail_in,ce<Ie&&(Ie=ce),ie=Ie===0?0:(ue.avail_in-=Ie,o.arraySet(se,ue.input,ue.next_in,Ie,K),ue.state.wrap===1?ue.adler=c(ue.adler,se,Ie,K):ue.state.wrap===2&&(ue.adler=l(ue.adler,se,Ie,K)),ue.next_in+=Ie,ue.total_in+=Ie,Ie),b.lookahead+=ie,b.lookahead+b.insert>=M)for(V=b.strstart-b.insert,b.ins_h=b.window[V],b.ins_h=(b.ins_h<<b.hash_shift^b.window[V+1])&b.hash_mask;b.insert&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[V+M-1])&b.hash_mask,b.prev[V&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=V,V++,b.insert--,!(b.lookahead+b.insert<M)););}while(b.lookahead<ne&&b.strm.avail_in!==0)}function he(b,ae){for(var ie,P;;){if(b.lookahead<ne){if(ve(b),b.lookahead<ne&&ae===d)return S;if(b.lookahead===0)break}if(ie=0,b.lookahead>=M&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+M-1])&b.hash_mask,ie=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),ie!==0&&b.strstart-ie<=b.w_size-ne&&(b.match_length=H(b,ie)),b.match_length>=M)if(P=a._tr_tally(b,b.strstart-b.match_start,b.match_length-M),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=M){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+M-1])&b.hash_mask,ie=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart,--b.match_length!=0;);b.strstart++}else b.strstart+=b.match_length,b.match_length=0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else P=a._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(P&&(I(b,!1),b.strm.avail_out===0))return S}return b.insert=b.strstart<M-1?b.strstart:M-1,ae===f?(I(b,!0),b.strm.avail_out===0?C:U):b.last_lit&&(I(b,!1),b.strm.avail_out===0)?S:k}function Ee(b,ae){for(var ie,P,A;;){if(b.lookahead<ne){if(ve(b),b.lookahead<ne&&ae===d)return S;if(b.lookahead===0)break}if(ie=0,b.lookahead>=M&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+M-1])&b.hash_mask,ie=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),b.prev_length=b.match_length,b.prev_match=b.match_start,b.match_length=M-1,ie!==0&&b.prev_length<b.max_lazy_match&&b.strstart-ie<=b.w_size-ne&&(b.match_length=H(b,ie),b.match_length<=5&&(b.strategy===1||b.match_length===M&&4096<b.strstart-b.match_start)&&(b.match_length=M-1)),b.prev_length>=M&&b.match_length<=b.prev_length){for(A=b.strstart+b.lookahead-M,P=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-M),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=A&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+M-1])&b.hash_mask,ie=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),--b.prev_length!=0;);if(b.match_available=0,b.match_length=M-1,b.strstart++,P&&(I(b,!1),b.strm.avail_out===0))return S}else if(b.match_available){if((P=a._tr_tally(b,0,b.window[b.strstart-1]))&&I(b,!1),b.strstart++,b.lookahead--,b.strm.avail_out===0)return S}else b.match_available=1,b.strstart++,b.lookahead--}return b.match_available&&(P=a._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0),b.insert=b.strstart<M-1?b.strstart:M-1,ae===f?(I(b,!0),b.strm.avail_out===0?C:U):b.last_lit&&(I(b,!1),b.strm.avail_out===0)?S:k}function ze(b,ae,ie,P,A){this.good_length=b,this.max_lazy=ae,this.nice_length=ie,this.max_chain=P,this.func=A}function rt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*R),this.dyn_dtree=new o.Buf16(2*(2*w+1)),this.bl_tree=new o.Buf16(2*(2*E+1)),Z(this.dyn_ltree),Z(this.dyn_dtree),Z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(j+1),this.heap=new o.Buf16(2*T+1),Z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*T+1),Z(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function We(b){var ae;return b&&b.state?(b.total_in=b.total_out=0,b.data_type=y,(ae=b.state).pending=0,ae.pending_out=0,ae.wrap<0&&(ae.wrap=-ae.wrap),ae.status=ae.wrap?x:G,b.adler=ae.wrap===2?0:1,ae.last_flush=d,a._tr_init(ae),p):oe(b,h)}function it(b){var ae=We(b);return ae===p&&function(ie){ie.window_size=2*ie.w_size,Z(ie.head),ie.max_lazy_match=s[ie.level].max_lazy,ie.good_match=s[ie.level].good_length,ie.nice_match=s[ie.level].nice_length,ie.max_chain_length=s[ie.level].max_chain,ie.strstart=0,ie.block_start=0,ie.lookahead=0,ie.insert=0,ie.match_length=ie.prev_length=M-1,ie.match_available=0,ie.ins_h=0}(b.state),ae}function At(b,ae,ie,P,A,V){if(!b)return h;var ue=1;if(ae===m&&(ae=6),P<0?(ue=0,P=-P):15<P&&(ue=2,P-=16),A<1||_<A||ie!==g||P<8||15<P||ae<0||9<ae||V<0||v<V)return oe(b,h);P===8&&(P=9);var se=new rt;return(b.state=se).strm=b,se.wrap=ue,se.gzhead=null,se.w_bits=P,se.w_size=1<<se.w_bits,se.w_mask=se.w_size-1,se.hash_bits=A+7,se.hash_size=1<<se.hash_bits,se.hash_mask=se.hash_size-1,se.hash_shift=~~((se.hash_bits+M-1)/M),se.window=new o.Buf8(2*se.w_size),se.head=new o.Buf16(se.hash_size),se.prev=new o.Buf16(se.w_size),se.lit_bufsize=1<<A+6,se.pending_buf_size=4*se.lit_bufsize,se.pending_buf=new o.Buf8(se.pending_buf_size),se.d_buf=1*se.lit_bufsize,se.l_buf=3*se.lit_bufsize,se.level=ae,se.strategy=V,se.method=ie,it(b)}s=[new ze(0,0,0,0,function(b,ae){var ie=65535;for(ie>b.pending_buf_size-5&&(ie=b.pending_buf_size-5);;){if(b.lookahead<=1){if(ve(b),b.lookahead===0&&ae===d)return S;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var P=b.block_start+ie;if((b.strstart===0||b.strstart>=P)&&(b.lookahead=b.strstart-P,b.strstart=P,I(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-ne&&(I(b,!1),b.strm.avail_out===0))return S}return b.insert=0,ae===f?(I(b,!0),b.strm.avail_out===0?C:U):(b.strstart>b.block_start&&(I(b,!1),b.strm.avail_out),S)}),new ze(4,4,8,4,he),new ze(4,5,16,8,he),new ze(4,6,32,32,he),new ze(4,4,16,16,Ee),new ze(8,16,32,32,Ee),new ze(8,16,128,128,Ee),new ze(8,32,128,256,Ee),new ze(32,128,258,1024,Ee),new ze(32,258,258,4096,Ee)],i.deflateInit=function(b,ae){return At(b,ae,g,15,8,0)},i.deflateInit2=At,i.deflateReset=it,i.deflateResetKeep=We,i.deflateSetHeader=function(b,ae){return b&&b.state?b.state.wrap!==2?h:(b.state.gzhead=ae,p):h},i.deflate=function(b,ae){var ie,P,A,V;if(!b||!b.state||5<ae||ae<0)return b?oe(b,h):h;if(P=b.state,!b.output||!b.input&&b.avail_in!==0||P.status===666&&ae!==f)return oe(b,b.avail_out===0?-5:h);if(P.strm=b,ie=P.last_flush,P.last_flush=ae,P.status===x)if(P.wrap===2)b.adler=0,X(P,31),X(P,139),X(P,8),P.gzhead?(X(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),X(P,255&P.gzhead.time),X(P,P.gzhead.time>>8&255),X(P,P.gzhead.time>>16&255),X(P,P.gzhead.time>>24&255),X(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),X(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(X(P,255&P.gzhead.extra.length),X(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(b.adler=l(b.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(X(P,0),X(P,0),X(P,0),X(P,0),X(P,0),X(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),X(P,3),P.status=G);else{var ue=g+(P.w_bits-8<<4)<<8;ue|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(ue|=32),ue+=31-ue%31,P.status=G,B(P,ue),P.strstart!==0&&(B(P,b.adler>>>16),B(P,65535&b.adler)),b.adler=1}if(P.status===69)if(P.gzhead.extra){for(A=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),L(b),A=P.pending,P.pending!==P.pending_buf_size));)X(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){A=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),L(b),A=P.pending,P.pending===P.pending_buf_size)){V=1;break}V=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,X(P,V)}while(V!==0);P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),V===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){A=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),L(b),A=P.pending,P.pending===P.pending_buf_size)){V=1;break}V=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,X(P,V)}while(V!==0);P.gzhead.hcrc&&P.pending>A&&(b.adler=l(b.adler,P.pending_buf,P.pending-A,A)),V===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&L(b),P.pending+2<=P.pending_buf_size&&(X(P,255&b.adler),X(P,b.adler>>8&255),b.adler=0,P.status=G)):P.status=G),P.pending!==0){if(L(b),b.avail_out===0)return P.last_flush=-1,p}else if(b.avail_in===0&&F(ae)<=F(ie)&&ae!==f)return oe(b,-5);if(P.status===666&&b.avail_in!==0)return oe(b,-5);if(b.avail_in!==0||P.lookahead!==0||ae!==d&&P.status!==666){var se=P.strategy===2?function(K,ce){for(var Ie;;){if(K.lookahead===0&&(ve(K),K.lookahead===0)){if(ce===d)return S;break}if(K.match_length=0,Ie=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,Ie&&(I(K,!1),K.strm.avail_out===0))return S}return K.insert=0,ce===f?(I(K,!0),K.strm.avail_out===0?C:U):K.last_lit&&(I(K,!1),K.strm.avail_out===0)?S:k}(P,ae):P.strategy===3?function(K,ce){for(var Ie,be,Be,ht,et=K.window;;){if(K.lookahead<=$){if(ve(K),K.lookahead<=$&&ce===d)return S;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=M&&0<K.strstart&&(be=et[Be=K.strstart-1])===et[++Be]&&be===et[++Be]&&be===et[++Be]){ht=K.strstart+$;do;while(be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&be===et[++Be]&&Be<ht);K.match_length=$-(ht-Be),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=M?(Ie=a._tr_tally(K,1,K.match_length-M),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(Ie=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),Ie&&(I(K,!1),K.strm.avail_out===0))return S}return K.insert=0,ce===f?(I(K,!0),K.strm.avail_out===0?C:U):K.last_lit&&(I(K,!1),K.strm.avail_out===0)?S:k}(P,ae):s[P.level].func(P,ae);if(se!==C&&se!==U||(P.status=666),se===S||se===C)return b.avail_out===0&&(P.last_flush=-1),p;if(se===k&&(ae===1?a._tr_align(P):ae!==5&&(a._tr_stored_block(P,0,0,!1),ae===3&&(Z(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),L(b),b.avail_out===0))return P.last_flush=-1,p}return ae!==f?p:P.wrap<=0?1:(P.wrap===2?(X(P,255&b.adler),X(P,b.adler>>8&255),X(P,b.adler>>16&255),X(P,b.adler>>24&255),X(P,255&b.total_in),X(P,b.total_in>>8&255),X(P,b.total_in>>16&255),X(P,b.total_in>>24&255)):(B(P,b.adler>>>16),B(P,65535&b.adler)),L(b),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?p:1)},i.deflateEnd=function(b){var ae;return b&&b.state?(ae=b.state.status)!==x&&ae!==69&&ae!==73&&ae!==91&&ae!==103&&ae!==G&&ae!==666?oe(b,h):(b.state=null,ae===G?oe(b,-3):p):h},i.deflateSetDictionary=function(b,ae){var ie,P,A,V,ue,se,K,ce,Ie=ae.length;if(!b||!b.state||(V=(ie=b.state).wrap)===2||V===1&&ie.status!==x||ie.lookahead)return h;for(V===1&&(b.adler=c(b.adler,ae,Ie,0)),ie.wrap=0,Ie>=ie.w_size&&(V===0&&(Z(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ce=new o.Buf8(ie.w_size),o.arraySet(ce,ae,Ie-ie.w_size,ie.w_size,0),ae=ce,Ie=ie.w_size),ue=b.avail_in,se=b.next_in,K=b.input,b.avail_in=Ie,b.next_in=0,b.input=ae,ve(ie);ie.lookahead>=M;){for(P=ie.strstart,A=ie.lookahead-(M-1);ie.ins_h=(ie.ins_h<<ie.hash_shift^ie.window[P+M-1])&ie.hash_mask,ie.prev[P&ie.w_mask]=ie.head[ie.ins_h],ie.head[ie.ins_h]=P,P++,--A;);ie.strstart=P,ie.lookahead=M-1,ve(ie)}return ie.strstart+=ie.lookahead,ie.block_start=ie.strstart,ie.insert=ie.lookahead,ie.lookahead=0,ie.match_length=ie.prev_length=M-1,ie.match_available=0,b.next_in=se,b.input=K,b.avail_in=ue,ie.wrap=V,p},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,i){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,i){r.exports=function(s,o){var a,c,l,u,d,f,p,h,m,v,y,g,_,T,w,E,R,j,M,$,ne,x,G,S,k;a=s.state,c=s.next_in,S=s.input,l=c+(s.avail_in-5),u=s.next_out,k=s.output,d=u-(o-s.avail_out),f=u+(s.avail_out-257),p=a.dmax,h=a.wsize,m=a.whave,v=a.wnext,y=a.window,g=a.hold,_=a.bits,T=a.lencode,w=a.distcode,E=(1<<a.lenbits)-1,R=(1<<a.distbits)-1;e:do{_<15&&(g+=S[c++]<<_,_+=8,g+=S[c++]<<_,_+=8),j=T[g&E];t:for(;;){if(g>>>=M=j>>>24,_-=M,(M=j>>>16&255)===0)k[u++]=65535&j;else{if(!(16&M)){if(!(64&M)){j=T[(65535&j)+(g&(1<<M)-1)];continue t}if(32&M){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}$=65535&j,(M&=15)&&(_<M&&(g+=S[c++]<<_,_+=8),$+=g&(1<<M)-1,g>>>=M,_-=M),_<15&&(g+=S[c++]<<_,_+=8,g+=S[c++]<<_,_+=8),j=w[g&R];n:for(;;){if(g>>>=M=j>>>24,_-=M,!(16&(M=j>>>16&255))){if(!(64&M)){j=w[(65535&j)+(g&(1<<M)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(ne=65535&j,_<(M&=15)&&(g+=S[c++]<<_,(_+=8)<M&&(g+=S[c++]<<_,_+=8)),p<(ne+=g&(1<<M)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(g>>>=M,_-=M,(M=u-d)<ne){if(m<(M=ne-M)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(G=y,(x=0)===v){if(x+=h-M,M<$){for($-=M;k[u++]=y[x++],--M;);x=u-ne,G=k}}else if(v<M){if(x+=h+v-M,(M-=v)<$){for($-=M;k[u++]=y[x++],--M;);if(x=0,v<$){for($-=M=v;k[u++]=y[x++],--M;);x=u-ne,G=k}}}else if(x+=v-M,M<$){for($-=M;k[u++]=y[x++],--M;);x=u-ne,G=k}for(;2<$;)k[u++]=G[x++],k[u++]=G[x++],k[u++]=G[x++],$-=3;$&&(k[u++]=G[x++],1<$&&(k[u++]=G[x++]))}else{for(x=u-ne;k[u++]=k[x++],k[u++]=k[x++],k[u++]=k[x++],2<($-=3););$&&(k[u++]=k[x++],1<$&&(k[u++]=k[x++]))}break}}break}}while(c<l&&u<f);c-=$=_>>3,g&=(1<<(_-=$<<3))-1,s.next_in=c,s.next_out=u,s.avail_in=c<l?l-c+5:5-(c-l),s.avail_out=u<f?f-u+257:257-(u-f),a.hold=g,a.bits=_}},{}],49:[function(n,r,i){var s=n("../utils/common"),o=n("./adler32"),a=n("./crc32"),c=n("./inffast"),l=n("./inftrees"),u=1,d=2,f=0,p=-2,h=1,m=852,v=592;function y(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(x){var G;return x&&x.state?(G=x.state,x.total_in=x.total_out=G.total=0,x.msg="",G.wrap&&(x.adler=1&G.wrap),G.mode=h,G.last=0,G.havedict=0,G.dmax=32768,G.head=null,G.hold=0,G.bits=0,G.lencode=G.lendyn=new s.Buf32(m),G.distcode=G.distdyn=new s.Buf32(v),G.sane=1,G.back=-1,f):p}function T(x){var G;return x&&x.state?((G=x.state).wsize=0,G.whave=0,G.wnext=0,_(x)):p}function w(x,G){var S,k;return x&&x.state?(k=x.state,G<0?(S=0,G=-G):(S=1+(G>>4),G<48&&(G&=15)),G&&(G<8||15<G)?p:(k.window!==null&&k.wbits!==G&&(k.window=null),k.wrap=S,k.wbits=G,T(x))):p}function E(x,G){var S,k;return x?(k=new g,(x.state=k).window=null,(S=w(x,G))!==f&&(x.state=null),S):p}var R,j,M=!0;function $(x){if(M){var G;for(R=new s.Buf32(512),j=new s.Buf32(32),G=0;G<144;)x.lens[G++]=8;for(;G<256;)x.lens[G++]=9;for(;G<280;)x.lens[G++]=7;for(;G<288;)x.lens[G++]=8;for(l(u,x.lens,0,288,R,0,x.work,{bits:9}),G=0;G<32;)x.lens[G++]=5;l(d,x.lens,0,32,j,0,x.work,{bits:5}),M=!1}x.lencode=R,x.lenbits=9,x.distcode=j,x.distbits=5}function ne(x,G,S,k){var C,U=x.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new s.Buf8(U.wsize)),k>=U.wsize?(s.arraySet(U.window,G,S-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(k<(C=U.wsize-U.wnext)&&(C=k),s.arraySet(U.window,G,S-k,C,U.wnext),(k-=C)?(s.arraySet(U.window,G,S-k,k,0),U.wnext=k,U.whave=U.wsize):(U.wnext+=C,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=C))),0}i.inflateReset=T,i.inflateReset2=w,i.inflateResetKeep=_,i.inflateInit=function(x){return E(x,15)},i.inflateInit2=E,i.inflate=function(x,G){var S,k,C,U,oe,F,Z,L,I,X,B,H,ve,he,Ee,ze,rt,We,it,At,b,ae,ie,P,A=0,V=new s.Buf8(4),ue=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return p;(S=x.state).mode===12&&(S.mode=13),oe=x.next_out,C=x.output,Z=x.avail_out,U=x.next_in,k=x.input,F=x.avail_in,L=S.hold,I=S.bits,X=F,B=Z,ae=f;e:for(;;)switch(S.mode){case h:if(S.wrap===0){S.mode=13;break}for(;I<16;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(2&S.wrap&&L===35615){V[S.check=0]=255&L,V[1]=L>>>8&255,S.check=a(S.check,V,2,0),I=L=0,S.mode=2;break}if(S.flags=0,S.head&&(S.head.done=!1),!(1&S.wrap)||(((255&L)<<8)+(L>>8))%31){x.msg="incorrect header check",S.mode=30;break}if((15&L)!=8){x.msg="unknown compression method",S.mode=30;break}if(I-=4,b=8+(15&(L>>>=4)),S.wbits===0)S.wbits=b;else if(b>S.wbits){x.msg="invalid window size",S.mode=30;break}S.dmax=1<<b,x.adler=S.check=1,S.mode=512&L?10:12,I=L=0;break;case 2:for(;I<16;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(S.flags=L,(255&S.flags)!=8){x.msg="unknown compression method",S.mode=30;break}if(57344&S.flags){x.msg="unknown header flags set",S.mode=30;break}S.head&&(S.head.text=L>>8&1),512&S.flags&&(V[0]=255&L,V[1]=L>>>8&255,S.check=a(S.check,V,2,0)),I=L=0,S.mode=3;case 3:for(;I<32;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.head&&(S.head.time=L),512&S.flags&&(V[0]=255&L,V[1]=L>>>8&255,V[2]=L>>>16&255,V[3]=L>>>24&255,S.check=a(S.check,V,4,0)),I=L=0,S.mode=4;case 4:for(;I<16;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.head&&(S.head.xflags=255&L,S.head.os=L>>8),512&S.flags&&(V[0]=255&L,V[1]=L>>>8&255,S.check=a(S.check,V,2,0)),I=L=0,S.mode=5;case 5:if(1024&S.flags){for(;I<16;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.length=L,S.head&&(S.head.extra_len=L),512&S.flags&&(V[0]=255&L,V[1]=L>>>8&255,S.check=a(S.check,V,2,0)),I=L=0}else S.head&&(S.head.extra=null);S.mode=6;case 6:if(1024&S.flags&&(F<(H=S.length)&&(H=F),H&&(S.head&&(b=S.head.extra_len-S.length,S.head.extra||(S.head.extra=new Array(S.head.extra_len)),s.arraySet(S.head.extra,k,U,H,b)),512&S.flags&&(S.check=a(S.check,k,H,U)),F-=H,U+=H,S.length-=H),S.length))break e;S.length=0,S.mode=7;case 7:if(2048&S.flags){if(F===0)break e;for(H=0;b=k[U+H++],S.head&&b&&S.length<65536&&(S.head.name+=String.fromCharCode(b)),b&&H<F;);if(512&S.flags&&(S.check=a(S.check,k,H,U)),F-=H,U+=H,b)break e}else S.head&&(S.head.name=null);S.length=0,S.mode=8;case 8:if(4096&S.flags){if(F===0)break e;for(H=0;b=k[U+H++],S.head&&b&&S.length<65536&&(S.head.comment+=String.fromCharCode(b)),b&&H<F;);if(512&S.flags&&(S.check=a(S.check,k,H,U)),F-=H,U+=H,b)break e}else S.head&&(S.head.comment=null);S.mode=9;case 9:if(512&S.flags){for(;I<16;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(L!==(65535&S.check)){x.msg="header crc mismatch",S.mode=30;break}I=L=0}S.head&&(S.head.hcrc=S.flags>>9&1,S.head.done=!0),x.adler=S.check=0,S.mode=12;break;case 10:for(;I<32;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}x.adler=S.check=y(L),I=L=0,S.mode=11;case 11:if(S.havedict===0)return x.next_out=oe,x.avail_out=Z,x.next_in=U,x.avail_in=F,S.hold=L,S.bits=I,2;x.adler=S.check=1,S.mode=12;case 12:if(G===5||G===6)break e;case 13:if(S.last){L>>>=7&I,I-=7&I,S.mode=27;break}for(;I<3;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}switch(S.last=1&L,I-=1,3&(L>>>=1)){case 0:S.mode=14;break;case 1:if($(S),S.mode=20,G!==6)break;L>>>=2,I-=2;break e;case 2:S.mode=17;break;case 3:x.msg="invalid block type",S.mode=30}L>>>=2,I-=2;break;case 14:for(L>>>=7&I,I-=7&I;I<32;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if((65535&L)!=(L>>>16^65535)){x.msg="invalid stored block lengths",S.mode=30;break}if(S.length=65535&L,I=L=0,S.mode=15,G===6)break e;case 15:S.mode=16;case 16:if(H=S.length){if(F<H&&(H=F),Z<H&&(H=Z),H===0)break e;s.arraySet(C,k,U,H,oe),F-=H,U+=H,Z-=H,oe+=H,S.length-=H;break}S.mode=12;break;case 17:for(;I<14;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(S.nlen=257+(31&L),L>>>=5,I-=5,S.ndist=1+(31&L),L>>>=5,I-=5,S.ncode=4+(15&L),L>>>=4,I-=4,286<S.nlen||30<S.ndist){x.msg="too many length or distance symbols",S.mode=30;break}S.have=0,S.mode=18;case 18:for(;S.have<S.ncode;){for(;I<3;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.lens[ue[S.have++]]=7&L,L>>>=3,I-=3}for(;S.have<19;)S.lens[ue[S.have++]]=0;if(S.lencode=S.lendyn,S.lenbits=7,ie={bits:S.lenbits},ae=l(0,S.lens,0,19,S.lencode,0,S.work,ie),S.lenbits=ie.bits,ae){x.msg="invalid code lengths set",S.mode=30;break}S.have=0,S.mode=19;case 19:for(;S.have<S.nlen+S.ndist;){for(;ze=(A=S.lencode[L&(1<<S.lenbits)-1])>>>16&255,rt=65535&A,!((Ee=A>>>24)<=I);){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(rt<16)L>>>=Ee,I-=Ee,S.lens[S.have++]=rt;else{if(rt===16){for(P=Ee+2;I<P;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(L>>>=Ee,I-=Ee,S.have===0){x.msg="invalid bit length repeat",S.mode=30;break}b=S.lens[S.have-1],H=3+(3&L),L>>>=2,I-=2}else if(rt===17){for(P=Ee+3;I<P;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}I-=Ee,b=0,H=3+(7&(L>>>=Ee)),L>>>=3,I-=3}else{for(P=Ee+7;I<P;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}I-=Ee,b=0,H=11+(127&(L>>>=Ee)),L>>>=7,I-=7}if(S.have+H>S.nlen+S.ndist){x.msg="invalid bit length repeat",S.mode=30;break}for(;H--;)S.lens[S.have++]=b}}if(S.mode===30)break;if(S.lens[256]===0){x.msg="invalid code -- missing end-of-block",S.mode=30;break}if(S.lenbits=9,ie={bits:S.lenbits},ae=l(u,S.lens,0,S.nlen,S.lencode,0,S.work,ie),S.lenbits=ie.bits,ae){x.msg="invalid literal/lengths set",S.mode=30;break}if(S.distbits=6,S.distcode=S.distdyn,ie={bits:S.distbits},ae=l(d,S.lens,S.nlen,S.ndist,S.distcode,0,S.work,ie),S.distbits=ie.bits,ae){x.msg="invalid distances set",S.mode=30;break}if(S.mode=20,G===6)break e;case 20:S.mode=21;case 21:if(6<=F&&258<=Z){x.next_out=oe,x.avail_out=Z,x.next_in=U,x.avail_in=F,S.hold=L,S.bits=I,c(x,B),oe=x.next_out,C=x.output,Z=x.avail_out,U=x.next_in,k=x.input,F=x.avail_in,L=S.hold,I=S.bits,S.mode===12&&(S.back=-1);break}for(S.back=0;ze=(A=S.lencode[L&(1<<S.lenbits)-1])>>>16&255,rt=65535&A,!((Ee=A>>>24)<=I);){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(ze&&!(240&ze)){for(We=Ee,it=ze,At=rt;ze=(A=S.lencode[At+((L&(1<<We+it)-1)>>We)])>>>16&255,rt=65535&A,!(We+(Ee=A>>>24)<=I);){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}L>>>=We,I-=We,S.back+=We}if(L>>>=Ee,I-=Ee,S.back+=Ee,S.length=rt,ze===0){S.mode=26;break}if(32&ze){S.back=-1,S.mode=12;break}if(64&ze){x.msg="invalid literal/length code",S.mode=30;break}S.extra=15&ze,S.mode=22;case 22:if(S.extra){for(P=S.extra;I<P;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.length+=L&(1<<S.extra)-1,L>>>=S.extra,I-=S.extra,S.back+=S.extra}S.was=S.length,S.mode=23;case 23:for(;ze=(A=S.distcode[L&(1<<S.distbits)-1])>>>16&255,rt=65535&A,!((Ee=A>>>24)<=I);){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(!(240&ze)){for(We=Ee,it=ze,At=rt;ze=(A=S.distcode[At+((L&(1<<We+it)-1)>>We)])>>>16&255,rt=65535&A,!(We+(Ee=A>>>24)<=I);){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}L>>>=We,I-=We,S.back+=We}if(L>>>=Ee,I-=Ee,S.back+=Ee,64&ze){x.msg="invalid distance code",S.mode=30;break}S.offset=rt,S.extra=15&ze,S.mode=24;case 24:if(S.extra){for(P=S.extra;I<P;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}S.offset+=L&(1<<S.extra)-1,L>>>=S.extra,I-=S.extra,S.back+=S.extra}if(S.offset>S.dmax){x.msg="invalid distance too far back",S.mode=30;break}S.mode=25;case 25:if(Z===0)break e;if(H=B-Z,S.offset>H){if((H=S.offset-H)>S.whave&&S.sane){x.msg="invalid distance too far back",S.mode=30;break}ve=H>S.wnext?(H-=S.wnext,S.wsize-H):S.wnext-H,H>S.length&&(H=S.length),he=S.window}else he=C,ve=oe-S.offset,H=S.length;for(Z<H&&(H=Z),Z-=H,S.length-=H;C[oe++]=he[ve++],--H;);S.length===0&&(S.mode=21);break;case 26:if(Z===0)break e;C[oe++]=S.length,Z--,S.mode=21;break;case 27:if(S.wrap){for(;I<32;){if(F===0)break e;F--,L|=k[U++]<<I,I+=8}if(B-=Z,x.total_out+=B,S.total+=B,B&&(x.adler=S.check=S.flags?a(S.check,C,B,oe-B):o(S.check,C,B,oe-B)),B=Z,(S.flags?L:y(L))!==S.check){x.msg="incorrect data check",S.mode=30;break}I=L=0}S.mode=28;case 28:if(S.wrap&&S.flags){for(;I<32;){if(F===0)break e;F--,L+=k[U++]<<I,I+=8}if(L!==(4294967295&S.total)){x.msg="incorrect length check",S.mode=30;break}I=L=0}S.mode=29;case 29:ae=1;break e;case 30:ae=-3;break e;case 31:return-4;case 32:default:return p}return x.next_out=oe,x.avail_out=Z,x.next_in=U,x.avail_in=F,S.hold=L,S.bits=I,(S.wsize||B!==x.avail_out&&S.mode<30&&(S.mode<27||G!==4))&&ne(x,x.output,x.next_out,B-x.avail_out)?(S.mode=31,-4):(X-=x.avail_in,B-=x.avail_out,x.total_in+=X,x.total_out+=B,S.total+=B,S.wrap&&B&&(x.adler=S.check=S.flags?a(S.check,C,B,x.next_out-B):o(S.check,C,B,x.next_out-B)),x.data_type=S.bits+(S.last?64:0)+(S.mode===12?128:0)+(S.mode===20||S.mode===15?256:0),(X==0&&B===0||G===4)&&ae===f&&(ae=-5),ae)},i.inflateEnd=function(x){if(!x||!x.state)return p;var G=x.state;return G.window&&(G.window=null),x.state=null,f},i.inflateGetHeader=function(x,G){var S;return x&&x.state&&2&(S=x.state).wrap?((S.head=G).done=!1,f):p},i.inflateSetDictionary=function(x,G){var S,k=G.length;return x&&x.state?(S=x.state).wrap!==0&&S.mode!==11?p:S.mode===11&&o(1,G,k,0)!==S.check?-3:ne(x,G,k,k)?(S.mode=31,-4):(S.havedict=1,f):p},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var s=n("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,d,f,p,h,m,v,y){var g,_,T,w,E,R,j,M,$,ne=y.bits,x=0,G=0,S=0,k=0,C=0,U=0,oe=0,F=0,Z=0,L=0,I=null,X=0,B=new s.Buf16(16),H=new s.Buf16(16),ve=null,he=0;for(x=0;x<=15;x++)B[x]=0;for(G=0;G<p;G++)B[d[f+G]]++;for(C=ne,k=15;1<=k&&B[k]===0;k--);if(k<C&&(C=k),k===0)return h[m++]=20971520,h[m++]=20971520,y.bits=1,0;for(S=1;S<k&&B[S]===0;S++);for(C<S&&(C=S),x=F=1;x<=15;x++)if(F<<=1,(F-=B[x])<0)return-1;if(0<F&&(u===0||k!==1))return-1;for(H[1]=0,x=1;x<15;x++)H[x+1]=H[x]+B[x];for(G=0;G<p;G++)d[f+G]!==0&&(v[H[d[f+G]]++]=G);if(R=u===0?(I=ve=v,19):u===1?(I=o,X-=257,ve=a,he-=257,256):(I=c,ve=l,-1),x=S,E=m,oe=G=L=0,T=-1,w=(Z=1<<(U=C))-1,u===1&&852<Z||u===2&&592<Z)return 1;for(;;){for(j=x-oe,$=v[G]<R?(M=0,v[G]):v[G]>R?(M=ve[he+v[G]],I[X+v[G]]):(M=96,0),g=1<<x-oe,S=_=1<<U;h[E+(L>>oe)+(_-=g)]=j<<24|M<<16|$|0,_!==0;);for(g=1<<x-1;L&g;)g>>=1;if(g!==0?(L&=g-1,L+=g):L=0,G++,--B[x]==0){if(x===k)break;x=d[f+v[G]]}if(C<x&&(L&w)!==T){for(oe===0&&(oe=C),E+=S,F=1<<(U=x-oe);U+oe<k&&!((F-=B[U+oe])<=0);)U++,F<<=1;if(Z+=1<<U,u===1&&852<Z||u===2&&592<Z)return 1;h[T=L&w]=C<<24|U<<16|E-m|0}}return L!==0&&(h[E+L]=x-oe<<24|64<<16|0),y.bits=C,0}},{"../utils/common":41}],51:[function(n,r,i){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,i){var s=n("../utils/common"),o=0,a=1;function c(A){for(var V=A.length;0<=--V;)A[V]=0}var l=0,u=29,d=256,f=d+1+u,p=30,h=19,m=2*f+1,v=15,y=16,g=7,_=256,T=16,w=17,E=18,R=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ne=new Array(2*(f+2));c(ne);var x=new Array(2*p);c(x);var G=new Array(512);c(G);var S=new Array(256);c(S);var k=new Array(u);c(k);var C,U,oe,F=new Array(p);function Z(A,V,ue,se,K){this.static_tree=A,this.extra_bits=V,this.extra_base=ue,this.elems=se,this.max_length=K,this.has_stree=A&&A.length}function L(A,V){this.dyn_tree=A,this.max_code=0,this.stat_desc=V}function I(A){return A<256?G[A]:G[256+(A>>>7)]}function X(A,V){A.pending_buf[A.pending++]=255&V,A.pending_buf[A.pending++]=V>>>8&255}function B(A,V,ue){A.bi_valid>y-ue?(A.bi_buf|=V<<A.bi_valid&65535,X(A,A.bi_buf),A.bi_buf=V>>y-A.bi_valid,A.bi_valid+=ue-y):(A.bi_buf|=V<<A.bi_valid&65535,A.bi_valid+=ue)}function H(A,V,ue){B(A,ue[2*V],ue[2*V+1])}function ve(A,V){for(var ue=0;ue|=1&A,A>>>=1,ue<<=1,0<--V;);return ue>>>1}function he(A,V,ue){var se,K,ce=new Array(v+1),Ie=0;for(se=1;se<=v;se++)ce[se]=Ie=Ie+ue[se-1]<<1;for(K=0;K<=V;K++){var be=A[2*K+1];be!==0&&(A[2*K]=ve(ce[be]++,be))}}function Ee(A){var V;for(V=0;V<f;V++)A.dyn_ltree[2*V]=0;for(V=0;V<p;V++)A.dyn_dtree[2*V]=0;for(V=0;V<h;V++)A.bl_tree[2*V]=0;A.dyn_ltree[2*_]=1,A.opt_len=A.static_len=0,A.last_lit=A.matches=0}function ze(A){8<A.bi_valid?X(A,A.bi_buf):0<A.bi_valid&&(A.pending_buf[A.pending++]=A.bi_buf),A.bi_buf=0,A.bi_valid=0}function rt(A,V,ue,se){var K=2*V,ce=2*ue;return A[K]<A[ce]||A[K]===A[ce]&&se[V]<=se[ue]}function We(A,V,ue){for(var se=A.heap[ue],K=ue<<1;K<=A.heap_len&&(K<A.heap_len&&rt(V,A.heap[K+1],A.heap[K],A.depth)&&K++,!rt(V,se,A.heap[K],A.depth));)A.heap[ue]=A.heap[K],ue=K,K<<=1;A.heap[ue]=se}function it(A,V,ue){var se,K,ce,Ie,be=0;if(A.last_lit!==0)for(;se=A.pending_buf[A.d_buf+2*be]<<8|A.pending_buf[A.d_buf+2*be+1],K=A.pending_buf[A.l_buf+be],be++,se===0?H(A,K,V):(H(A,(ce=S[K])+d+1,V),(Ie=R[ce])!==0&&B(A,K-=k[ce],Ie),H(A,ce=I(--se),ue),(Ie=j[ce])!==0&&B(A,se-=F[ce],Ie)),be<A.last_lit;);H(A,_,V)}function At(A,V){var ue,se,K,ce=V.dyn_tree,Ie=V.stat_desc.static_tree,be=V.stat_desc.has_stree,Be=V.stat_desc.elems,ht=-1;for(A.heap_len=0,A.heap_max=m,ue=0;ue<Be;ue++)ce[2*ue]!==0?(A.heap[++A.heap_len]=ht=ue,A.depth[ue]=0):ce[2*ue+1]=0;for(;A.heap_len<2;)ce[2*(K=A.heap[++A.heap_len]=ht<2?++ht:0)]=1,A.depth[K]=0,A.opt_len--,be&&(A.static_len-=Ie[2*K+1]);for(V.max_code=ht,ue=A.heap_len>>1;1<=ue;ue--)We(A,ce,ue);for(K=Be;ue=A.heap[1],A.heap[1]=A.heap[A.heap_len--],We(A,ce,1),se=A.heap[1],A.heap[--A.heap_max]=ue,A.heap[--A.heap_max]=se,ce[2*K]=ce[2*ue]+ce[2*se],A.depth[K]=(A.depth[ue]>=A.depth[se]?A.depth[ue]:A.depth[se])+1,ce[2*ue+1]=ce[2*se+1]=K,A.heap[1]=K++,We(A,ce,1),2<=A.heap_len;);A.heap[--A.heap_max]=A.heap[1],function(et,pn){var qn,Dn,bn,jt,pr,Li,Zn=pn.dyn_tree,oi=pn.max_code,ai=pn.stat_desc.static_tree,mo=pn.stat_desc.has_stree,jn=pn.stat_desc.extra_bits,Pi=pn.stat_desc.extra_base,ci=pn.stat_desc.max_length,$r=0;for(jt=0;jt<=v;jt++)et.bl_count[jt]=0;for(Zn[2*et.heap[et.heap_max]+1]=0,qn=et.heap_max+1;qn<m;qn++)ci<(jt=Zn[2*Zn[2*(Dn=et.heap[qn])+1]+1]+1)&&(jt=ci,$r++),Zn[2*Dn+1]=jt,oi<Dn||(et.bl_count[jt]++,pr=0,Pi<=Dn&&(pr=jn[Dn-Pi]),Li=Zn[2*Dn],et.opt_len+=Li*(jt+pr),mo&&(et.static_len+=Li*(ai[2*Dn+1]+pr)));if($r!==0){do{for(jt=ci-1;et.bl_count[jt]===0;)jt--;et.bl_count[jt]--,et.bl_count[jt+1]+=2,et.bl_count[ci]--,$r-=2}while(0<$r);for(jt=ci;jt!==0;jt--)for(Dn=et.bl_count[jt];Dn!==0;)oi<(bn=et.heap[--qn])||(Zn[2*bn+1]!==jt&&(et.opt_len+=(jt-Zn[2*bn+1])*Zn[2*bn],Zn[2*bn+1]=jt),Dn--)}}(A,V),he(ce,ht,A.bl_count)}function b(A,V,ue){var se,K,ce=-1,Ie=V[1],be=0,Be=7,ht=4;for(Ie===0&&(Be=138,ht=3),V[2*(ue+1)+1]=65535,se=0;se<=ue;se++)K=Ie,Ie=V[2*(se+1)+1],++be<Be&&K===Ie||(be<ht?A.bl_tree[2*K]+=be:K!==0?(K!==ce&&A.bl_tree[2*K]++,A.bl_tree[2*T]++):be<=10?A.bl_tree[2*w]++:A.bl_tree[2*E]++,ce=K,ht=(be=0)===Ie?(Be=138,3):K===Ie?(Be=6,3):(Be=7,4))}function ae(A,V,ue){var se,K,ce=-1,Ie=V[1],be=0,Be=7,ht=4;for(Ie===0&&(Be=138,ht=3),se=0;se<=ue;se++)if(K=Ie,Ie=V[2*(se+1)+1],!(++be<Be&&K===Ie)){if(be<ht)for(;H(A,K,A.bl_tree),--be!=0;);else K!==0?(K!==ce&&(H(A,K,A.bl_tree),be--),H(A,T,A.bl_tree),B(A,be-3,2)):be<=10?(H(A,w,A.bl_tree),B(A,be-3,3)):(H(A,E,A.bl_tree),B(A,be-11,7));ce=K,ht=(be=0)===Ie?(Be=138,3):K===Ie?(Be=6,3):(Be=7,4)}}c(F);var ie=!1;function P(A,V,ue,se){B(A,(l<<1)+(se?1:0),3),function(K,ce,Ie,be){ze(K),X(K,Ie),X(K,~Ie),s.arraySet(K.pending_buf,K.window,ce,Ie,K.pending),K.pending+=Ie}(A,V,ue)}i._tr_init=function(A){ie||(function(){var V,ue,se,K,ce,Ie=new Array(v+1);for(K=se=0;K<u-1;K++)for(k[K]=se,V=0;V<1<<R[K];V++)S[se++]=K;for(S[se-1]=K,K=ce=0;K<16;K++)for(F[K]=ce,V=0;V<1<<j[K];V++)G[ce++]=K;for(ce>>=7;K<p;K++)for(F[K]=ce<<7,V=0;V<1<<j[K]-7;V++)G[256+ce++]=K;for(ue=0;ue<=v;ue++)Ie[ue]=0;for(V=0;V<=143;)ne[2*V+1]=8,V++,Ie[8]++;for(;V<=255;)ne[2*V+1]=9,V++,Ie[9]++;for(;V<=279;)ne[2*V+1]=7,V++,Ie[7]++;for(;V<=287;)ne[2*V+1]=8,V++,Ie[8]++;for(he(ne,f+1,Ie),V=0;V<p;V++)x[2*V+1]=5,x[2*V]=ve(V,5);C=new Z(ne,R,d+1,f,v),U=new Z(x,j,0,p,v),oe=new Z(new Array(0),M,0,h,g)}(),ie=!0),A.l_desc=new L(A.dyn_ltree,C),A.d_desc=new L(A.dyn_dtree,U),A.bl_desc=new L(A.bl_tree,oe),A.bi_buf=0,A.bi_valid=0,Ee(A)},i._tr_stored_block=P,i._tr_flush_block=function(A,V,ue,se){var K,ce,Ie=0;0<A.level?(A.strm.data_type===2&&(A.strm.data_type=function(be){var Be,ht=4093624447;for(Be=0;Be<=31;Be++,ht>>>=1)if(1&ht&&be.dyn_ltree[2*Be]!==0)return o;if(be.dyn_ltree[18]!==0||be.dyn_ltree[20]!==0||be.dyn_ltree[26]!==0)return a;for(Be=32;Be<d;Be++)if(be.dyn_ltree[2*Be]!==0)return a;return o}(A)),At(A,A.l_desc),At(A,A.d_desc),Ie=function(be){var Be;for(b(be,be.dyn_ltree,be.l_desc.max_code),b(be,be.dyn_dtree,be.d_desc.max_code),At(be,be.bl_desc),Be=h-1;3<=Be&&be.bl_tree[2*$[Be]+1]===0;Be--);return be.opt_len+=3*(Be+1)+5+5+4,Be}(A),K=A.opt_len+3+7>>>3,(ce=A.static_len+3+7>>>3)<=K&&(K=ce)):K=ce=ue+5,ue+4<=K&&V!==-1?P(A,V,ue,se):A.strategy===4||ce===K?(B(A,2+(se?1:0),3),it(A,ne,x)):(B(A,4+(se?1:0),3),function(be,Be,ht,et){var pn;for(B(be,Be-257,5),B(be,ht-1,5),B(be,et-4,4),pn=0;pn<et;pn++)B(be,be.bl_tree[2*$[pn]+1],3);ae(be,be.dyn_ltree,Be-1),ae(be,be.dyn_dtree,ht-1)}(A,A.l_desc.max_code+1,A.d_desc.max_code+1,Ie+1),it(A,A.dyn_ltree,A.dyn_dtree)),Ee(A),se&&ze(A)},i._tr_tally=function(A,V,ue){return A.pending_buf[A.d_buf+2*A.last_lit]=V>>>8&255,A.pending_buf[A.d_buf+2*A.last_lit+1]=255&V,A.pending_buf[A.l_buf+A.last_lit]=255&ue,A.last_lit++,V===0?A.dyn_ltree[2*ue]++:(A.matches++,V--,A.dyn_ltree[2*(S[ue]+d+1)]++,A.dyn_dtree[2*I(V)]++),A.last_lit===A.lit_bufsize-1},i._tr_align=function(A){B(A,2,3),H(A,_,ne),function(V){V.bi_valid===16?(X(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.bi_valid-=8)}(A)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(s){(function(o,a){if(!o.setImmediate){var c,l,u,d,f=1,p={},h=!1,m=o.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(o);v=v&&v.setTimeout?v:o,c={}.toString.call(o.process)==="[object process]"?function(T){process.nextTick(function(){g(T)})}:function(){if(o.postMessage&&!o.importScripts){var T=!0,w=o.onmessage;return o.onmessage=function(){T=!1},o.postMessage("","*"),o.onmessage=w,T}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",_,!1):o.attachEvent("onmessage",_),function(T){o.postMessage(d+T,"*")}):o.MessageChannel?((u=new MessageChannel).port1.onmessage=function(T){g(T.data)},function(T){u.port2.postMessage(T)}):m&&"onreadystatechange"in m.createElement("script")?(l=m.documentElement,function(T){var w=m.createElement("script");w.onreadystatechange=function(){g(T),w.onreadystatechange=null,l.removeChild(w),w=null},l.appendChild(w)}):function(T){setTimeout(g,0,T)},v.setImmediate=function(T){typeof T!="function"&&(T=new Function(""+T));for(var w=new Array(arguments.length-1),E=0;E<w.length;E++)w[E]=arguments[E+1];var R={callback:T,args:w};return p[f]=R,c(f),f++},v.clearImmediate=y}function y(T){delete p[T]}function g(T){if(h)setTimeout(g,0,T);else{var w=p[T];if(w){h=!0;try{(function(E){var R=E.callback,j=E.args;switch(j.length){case 0:R();break;case 1:R(j[0]);break;case 2:R(j[0],j[1]);break;case 3:R(j[0],j[1],j[2]);break;default:R.apply(a,j)}})(w)}finally{y(T),h=!1}}}}function _(T){T.source===o&&typeof T.data=="string"&&T.data.indexOf(d)===0&&g(+T.data.slice(d.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ar<"u"?ar:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(zb);var qk=zb.exports;const Vb=vl(qk);var It;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(It||(It={}));var Mp;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Mp||(Mp={}));const ke=It.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mi=t=>{switch(typeof t){case"undefined":return ke.undefined;case"string":return ke.string;case"number":return isNaN(t)?ke.nan:ke.number;case"boolean":return ke.boolean;case"function":return ke.function;case"bigint":return ke.bigint;case"symbol":return ke.symbol;case"object":return Array.isArray(t)?ke.array:t===null?ke.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ke.promise:typeof Map<"u"&&t instanceof Map?ke.map:typeof Set<"u"&&t instanceof Set?ke.set:typeof Date<"u"&&t instanceof Date?ke.date:ke.object;default:return ke.unknown}},ge=It.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Zk=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Hn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return i(this),r}static assert(e){if(!(e instanceof Hn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,It.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Hn.create=t=>new Hn(t);const ea=(t,e)=>{let n;switch(t.code){case ge.invalid_type:t.received===ke.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ge.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,It.jsonStringifyReplacer)}`;break;case ge.unrecognized_keys:n=`Unrecognized key(s) in object: ${It.joinValues(t.keys,", ")}`;break;case ge.invalid_union:n="Invalid input";break;case ge.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${It.joinValues(t.options)}`;break;case ge.invalid_enum_value:n=`Invalid enum value. Expected ${It.joinValues(t.options)}, received '${t.received}'`;break;case ge.invalid_arguments:n="Invalid function arguments";break;case ge.invalid_return_type:n="Invalid function return type";break;case ge.invalid_date:n="Invalid date";break;case ge.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:It.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ge.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ge.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ge.custom:n="Invalid input";break;case ge.invalid_intersection_types:n="Intersection results could not be merged";break;case ge.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ge.not_finite:n="Number must be finite";break;default:n=e.defaultError,It.assertNever(t)}return{message:n}};let Hb=ea;function Gk(t){Hb=t}function Hu(){return Hb}const Wu=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},Yk=[];function Oe(t,e){const n=Hu(),r=Wu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ea?void 0:ea].filter(i=>!!i)});t.common.issues.push(r)}class On{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Qe;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return On.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Qe;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const Qe=Object.freeze({status:"aborted"}),Po=t=>({status:"dirty",value:t}),Fn=t=>({status:"valid",value:t}),Lp=t=>t.status==="aborted",Pp=t=>t.status==="dirty",Ws=t=>t.status==="valid",Rc=t=>typeof Promise<"u"&&t instanceof Promise;function qu(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Wb(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var je;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(je||(je={}));var Ka,Qa;class ei{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Dy=(t,e)=>{if(Ws(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Hn(t.common.issues);return this._error=n,this._error}}};function ot(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{var c,l;const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(c=u??r)!==null&&c!==void 0?c:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(l=u??n)!==null&&l!==void 0?l:a.defaultError}},description:i}}class lt{get description(){return this._def.description}_getType(e){return mi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new On,ctx:{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Rc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Dy(i,s)}"~validate"(e){var n,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:i});return Ws(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(n=s==null?void 0:s.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>Ws(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Rc(i)?i:Promise.resolve(i));return Dy(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),a=()=>s.addIssue({code:ge.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Ar({schema:this,typeName:Xe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Gr.create(this,this._def)}nullable(){return us.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this)}promise(){return na.create(this,this._def)}or(e){return Cc.create([this,e],this._def)}and(e){return Mc.create(this,e,this._def)}transform(e){return new Ar({...ot(this._def),schema:this,typeName:Xe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new jc({...ot(this._def),innerType:this,defaultValue:n,typeName:Xe.ZodDefault})}brand(){return new Kh({typeName:Xe.ZodBranded,type:this,...ot(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Uc({...ot(this._def),innerType:this,catchValue:n,typeName:Xe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return wl.create(this,e)}readonly(){return Bc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Jk=/^c[^\s-]{8,}$/i,Xk=/^[0-9a-z]+$/,Kk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,eN=/^[a-z0-9_-]{21}$/i,tN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Jf;const sN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,oN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,aN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qb="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dN=new RegExp(`^${qb}$`);function Zb(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function fN(t){return new RegExp(`^${Zb(t)}$`)}function Gb(t){let e=`${qb}T${Zb(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function pN(t,e){return!!((e==="v4"||!e)&&sN.test(t)||(e==="v6"||!e)&&aN.test(t))}function hN(t,e){if(!tN.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function mN(t,e){return!!((e==="v4"||!e)&&oN.test(t)||(e==="v6"||!e)&&cN.test(t))}class Ir extends lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ke.string){const s=this._getOrReturnCtx(e);return Oe(s,{code:ge.invalid_type,expected:ke.string,received:s.parsedType}),Qe}const r=new On;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?Oe(i,{code:ge.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&Oe(i,{code:ge.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")rN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"email",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Jf||(Jf=new RegExp(iN,"u")),Jf.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"emoji",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Qk.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"uuid",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")eN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"nanoid",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Jk.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"cuid",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Xk.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"cuid2",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Kk.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"ulid",code:ge.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Oe(i,{validation:"url",code:ge.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"regex",code:ge.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Gb(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?dN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?fN(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?nN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"duration",code:ge.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?pN(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"ip",code:ge.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?hN(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"jwt",code:ge.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?mN(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"cidr",code:ge.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?lN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"base64",code:ge.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?uN.test(e.data)||(i=this._getOrReturnCtx(e,i),Oe(i,{validation:"base64url",code:ge.invalid_string,message:s.message}),r.dirty()):It.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:ge.invalid_string,...je.errToObj(r)})}_addCheck(e){return new Ir({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...je.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...je.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...je.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...je.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...je.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...je.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...je.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...je.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...je.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...je.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...je.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...je.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...je.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...je.errToObj(n)})}nonempty(e){return this.min(1,je.errToObj(e))}trim(){return new Ir({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ir({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ir({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ir.create=t=>{var e;return new Ir({checks:[],typeName:Xe.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ot(t)})};function gN(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class as extends lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ke.number){const s=this._getOrReturnCtx(e);return Oe(s,{code:ge.invalid_type,expected:ke.number,received:s.parsedType}),Qe}let r;const i=new On;for(const s of this._def.checks)s.kind==="int"?It.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?gN(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.not_finite,message:s.message}),i.dirty()):It.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,je.toString(n))}gt(e,n){return this.setLimit("min",e,!1,je.toString(n))}lte(e,n){return this.setLimit("max",e,!0,je.toString(n))}lt(e,n){return this.setLimit("max",e,!1,je.toString(n))}setLimit(e,n,r,i){return new as({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:je.toString(i)}]})}_addCheck(e){return new as({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:je.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&It.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}as.create=t=>new as({checks:[],typeName:Xe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ot(t)});class cs extends lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ke.bigint)return this._getInvalidInput(e);let r;const i=new On;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Oe(r,{code:ge.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):It.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Oe(n,{code:ge.invalid_type,expected:ke.bigint,received:n.parsedType}),Qe}gte(e,n){return this.setLimit("min",e,!0,je.toString(n))}gt(e,n){return this.setLimit("min",e,!1,je.toString(n))}lte(e,n){return this.setLimit("max",e,!0,je.toString(n))}lt(e,n){return this.setLimit("max",e,!1,je.toString(n))}setLimit(e,n,r,i){return new cs({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:je.toString(i)}]})}_addCheck(e){return new cs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:je.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}cs.create=t=>{var e;return new cs({checks:[],typeName:Xe.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ot(t)})};class kc extends lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ke.boolean){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.boolean,received:r.parsedType}),Qe}return Fn(e.data)}}kc.create=t=>new kc({typeName:Xe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ot(t)});class qs extends lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ke.date){const s=this._getOrReturnCtx(e);return Oe(s,{code:ge.invalid_type,expected:ke.date,received:s.parsedType}),Qe}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Oe(s,{code:ge.invalid_date}),Qe}const r=new On;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),Oe(i,{code:ge.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):It.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new qs({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:je.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:je.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}qs.create=t=>new qs({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Xe.ZodDate,...ot(t)});class Zu extends lt{_parse(e){if(this._getType(e)!==ke.symbol){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.symbol,received:r.parsedType}),Qe}return Fn(e.data)}}Zu.create=t=>new Zu({typeName:Xe.ZodSymbol,...ot(t)});class Nc extends lt{_parse(e){if(this._getType(e)!==ke.undefined){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.undefined,received:r.parsedType}),Qe}return Fn(e.data)}}Nc.create=t=>new Nc({typeName:Xe.ZodUndefined,...ot(t)});class Ac extends lt{_parse(e){if(this._getType(e)!==ke.null){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.null,received:r.parsedType}),Qe}return Fn(e.data)}}Ac.create=t=>new Ac({typeName:Xe.ZodNull,...ot(t)});class ta extends lt{constructor(){super(...arguments),this._any=!0}_parse(e){return Fn(e.data)}}ta.create=t=>new ta({typeName:Xe.ZodAny,...ot(t)});class $s extends lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fn(e.data)}}$s.create=t=>new $s({typeName:Xe.ZodUnknown,...ot(t)});class Ri extends lt{_parse(e){const n=this._getOrReturnCtx(e);return Oe(n,{code:ge.invalid_type,expected:ke.never,received:n.parsedType}),Qe}}Ri.create=t=>new Ri({typeName:Xe.ZodNever,...ot(t)});class Gu extends lt{_parse(e){if(this._getType(e)!==ke.undefined){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.void,received:r.parsedType}),Qe}return Fn(e.data)}}Gu.create=t=>new Gu({typeName:Xe.ZodVoid,...ot(t)});class Or extends lt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ke.array)return Oe(n,{code:ge.invalid_type,expected:ke.array,received:n.parsedType}),Qe;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(Oe(n,{code:o?ge.too_big:ge.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Oe(n,{code:ge.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Oe(n,{code:ge.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new ei(n,o,n.path,a)))).then(o=>On.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new ei(n,o,n.path,a)));return On.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Or({...this._def,minLength:{value:e,message:je.toString(n)}})}max(e,n){return new Or({...this._def,maxLength:{value:e,message:je.toString(n)}})}length(e,n){return new Or({...this._def,exactLength:{value:e,message:je.toString(n)}})}nonempty(e){return this.min(1,e)}}Or.create=(t,e)=>new Or({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xe.ZodArray,...ot(e)});function Oo(t){if(t instanceof Jt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Gr.create(Oo(r))}return new Jt({...t._def,shape:()=>e})}else return t instanceof Or?new Or({...t._def,type:Oo(t.element)}):t instanceof Gr?Gr.create(Oo(t.unwrap())):t instanceof us?us.create(Oo(t.unwrap())):t instanceof ti?ti.create(t.items.map(e=>Oo(e))):t}class Jt extends lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=It.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ke.object){const l=this._getOrReturnCtx(e);return Oe(l,{code:ge.invalid_type,expected:ke.object,received:l.parsedType}),Qe}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ri&&this._def.unknownKeys==="strip"))for(const l in i.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const u=s[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ei(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Ri){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")a.length>0&&(Oe(i,{code:ge.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ei(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>On.mergeObjectSync(r,l)):On.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return je.errToObj,new Jt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,s,o,a;const c=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=je.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Jt({...this._def,unknownKeys:"strip"})}passthrough(){return new Jt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Jt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Jt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Jt({...this._def,catchall:e})}pick(e){const n={};return It.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Jt({...this._def,shape:()=>n})}omit(e){const n={};return It.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Jt({...this._def,shape:()=>n})}deepPartial(){return Oo(this)}partial(e){const n={};return It.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Jt({...this._def,shape:()=>n})}required(e){const n={};return It.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Gr;)s=s._def.innerType;n[r]=s}}),new Jt({...this._def,shape:()=>n})}keyof(){return Yb(It.objectKeys(this.shape))}}Jt.create=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strip",catchall:Ri.create(),typeName:Xe.ZodObject,...ot(e)});Jt.strictCreate=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strict",catchall:Ri.create(),typeName:Xe.ZodObject,...ot(e)});Jt.lazycreate=(t,e)=>new Jt({shape:t,unknownKeys:"strip",catchall:Ri.create(),typeName:Xe.ZodObject,...ot(e)});class Cc extends lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Hn(a.ctx.common.issues));return Oe(n,{code:ge.invalid_union,unionErrors:o}),Qe}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const c of r){const l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(c=>new Hn(c));return Oe(n,{code:ge.invalid_union,unionErrors:a}),Qe}}get options(){return this._def.options}}Cc.create=(t,e)=>new Cc({options:t,typeName:Xe.ZodUnion,...ot(e)});const fi=t=>t instanceof Pc?fi(t.schema):t instanceof Ar?fi(t.innerType()):t instanceof Fc?[t.value]:t instanceof ls?t.options:t instanceof $c?It.objectValues(t.enum):t instanceof jc?fi(t._def.innerType):t instanceof Nc?[void 0]:t instanceof Ac?[null]:t instanceof Gr?[void 0,...fi(t.unwrap())]:t instanceof us?[null,...fi(t.unwrap())]:t instanceof Kh||t instanceof Bc?fi(t.unwrap()):t instanceof Uc?fi(t._def.innerType):[];class Bd extends lt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.object)return Oe(n,{code:ge.invalid_type,expected:ke.object,received:n.parsedType}),Qe;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Oe(n,{code:ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Qe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const s of n){const o=fi(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new Bd({typeName:Xe.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...ot(r)})}}function Fp(t,e){const n=mi(t),r=mi(e);if(t===e)return{valid:!0,data:t};if(n===ke.object&&r===ke.object){const i=It.objectKeys(e),s=It.objectKeys(t).filter(a=>i.indexOf(a)!==-1),o={...t,...e};for(const a of s){const c=Fp(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===ke.array&&r===ke.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],a=e[s],c=Fp(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===ke.date&&r===ke.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mc extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(Lp(s)||Lp(o))return Qe;const a=Fp(s.value,o.value);return a.valid?((Pp(s)||Pp(o))&&n.dirty(),{status:n.value,value:a.data}):(Oe(r,{code:ge.invalid_intersection_types}),Qe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mc.create=(t,e,n)=>new Mc({left:t,right:e,typeName:Xe.ZodIntersection,...ot(n)});class ti extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.array)return Oe(r,{code:ge.invalid_type,expected:ke.array,received:r.parsedType}),Qe;if(r.data.length<this._def.items.length)return Oe(r,{code:ge.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Qe;!this._def.rest&&r.data.length>this._def.items.length&&(Oe(r,{code:ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ei(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>On.mergeArray(n,o)):On.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new ti({...this._def,rest:e})}}ti.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ti({items:t,typeName:Xe.ZodTuple,rest:null,...ot(e)})};class Lc extends lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.object)return Oe(r,{code:ge.invalid_type,expected:ke.object,received:r.parsedType}),Qe;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new ei(r,a,r.path,a)),value:o._parse(new ei(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?On.mergeObjectAsync(n,i):On.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof lt?new Lc({keyType:e,valueType:n,typeName:Xe.ZodRecord,...ot(r)}):new Lc({keyType:Ir.create(),valueType:e,typeName:Xe.ZodRecord,...ot(n)})}}class Yu extends lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.map)return Oe(r,{code:ge.invalid_type,expected:ke.map,received:r.parsedType}),Qe;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:i._parse(new ei(r,a,r.path,[l,"key"])),value:s._parse(new ei(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Qe;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Qe;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}}}}Yu.create=(t,e,n)=>new Yu({valueType:e,keyType:t,typeName:Xe.ZodMap,...ot(n)});class Zs extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.set)return Oe(r,{code:ge.invalid_type,expected:ke.set,received:r.parsedType}),Qe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Oe(r,{code:ge.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Oe(r,{code:ge.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(c){const l=new Set;for(const u of c){if(u.status==="aborted")return Qe;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}const a=[...r.data.values()].map((c,l)=>s._parse(new ei(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new Zs({...this._def,minSize:{value:e,message:je.toString(n)}})}max(e,n){return new Zs({...this._def,maxSize:{value:e,message:je.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Zs.create=(t,e)=>new Zs({valueType:t,minSize:null,maxSize:null,typeName:Xe.ZodSet,...ot(e)});class Zo extends lt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.function)return Oe(n,{code:ge.invalid_type,expected:ke.function,received:n.parsedType}),Qe;function r(a,c){return Wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hu(),ea].filter(l=>!!l),issueData:{code:ge.invalid_arguments,argumentsError:c}})}function i(a,c){return Wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hu(),ea].filter(l=>!!l),issueData:{code:ge.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof na){const a=this;return Fn(async function(...c){const l=new Hn([]),u=await a._def.args.parseAsync(c,s).catch(p=>{throw l.addIssue(r(c,p)),l}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(p=>{throw l.addIssue(i(d,p)),l})})}else{const a=this;return Fn(function(...c){const l=a._def.args.safeParse(c,s);if(!l.success)throw new Hn([r(c,l.error)]);const u=Reflect.apply(o,this,l.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new Hn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Zo({...this._def,args:ti.create(e).rest($s.create())})}returns(e){return new Zo({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Zo({args:e||ti.create([]).rest($s.create()),returns:n||$s.create(),typeName:Xe.ZodFunction,...ot(r)})}}class Pc extends lt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Pc.create=(t,e)=>new Pc({getter:t,typeName:Xe.ZodLazy,...ot(e)});class Fc extends lt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Oe(n,{received:n.data,code:ge.invalid_literal,expected:this._def.value}),Qe}return{status:"valid",value:e.data}}get value(){return this._def.value}}Fc.create=(t,e)=>new Fc({value:t,typeName:Xe.ZodLiteral,...ot(e)});function Yb(t,e){return new ls({values:t,typeName:Xe.ZodEnum,...ot(e)})}class ls extends lt{constructor(){super(...arguments),Ka.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Oe(n,{expected:It.joinValues(r),received:n.parsedType,code:ge.invalid_type}),Qe}if(qu(this,Ka)||Wb(this,Ka,new Set(this._def.values)),!qu(this,Ka).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Oe(n,{received:n.data,code:ge.invalid_enum_value,options:r}),Qe}return Fn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return ls.create(e,{...this._def,...n})}exclude(e,n=this._def){return ls.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ka=new WeakMap;ls.create=Yb;class $c extends lt{constructor(){super(...arguments),Qa.set(this,void 0)}_parse(e){const n=It.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ke.string&&r.parsedType!==ke.number){const i=It.objectValues(n);return Oe(r,{expected:It.joinValues(i),received:r.parsedType,code:ge.invalid_type}),Qe}if(qu(this,Qa)||Wb(this,Qa,new Set(It.getValidEnumValues(this._def.values))),!qu(this,Qa).has(e.data)){const i=It.objectValues(n);return Oe(r,{received:r.data,code:ge.invalid_enum_value,options:i}),Qe}return Fn(e.data)}get enum(){return this._def.values}}Qa=new WeakMap;$c.create=(t,e)=>new $c({values:t,typeName:Xe.ZodNativeEnum,...ot(e)});class na extends lt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.promise&&n.common.async===!1)return Oe(n,{code:ge.invalid_type,expected:ke.promise,received:n.parsedType}),Qe;const r=n.parsedType===ke.promise?n.data:Promise.resolve(n.data);return Fn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}na.create=(t,e)=>new na({type:t,typeName:Xe.ZodPromise,...ot(e)});class Ar extends lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Oe(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Qe;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Qe:c.status==="dirty"||n.value==="dirty"?Po(c.value):c});{if(n.value==="aborted")return Qe;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Qe:a.status==="dirty"||n.value==="dirty"?Po(a.value):a}}if(i.type==="refinement"){const o=a=>{const c=i.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Qe:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Qe:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ws(o))return o;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ws(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):o);It.assertNever(i)}}Ar.create=(t,e,n)=>new Ar({schema:t,typeName:Xe.ZodEffects,effect:e,...ot(n)});Ar.createWithPreprocess=(t,e,n)=>new Ar({schema:e,effect:{type:"preprocess",transform:t},typeName:Xe.ZodEffects,...ot(n)});class Gr extends lt{_parse(e){return this._getType(e)===ke.undefined?Fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gr.create=(t,e)=>new Gr({innerType:t,typeName:Xe.ZodOptional,...ot(e)});class us extends lt{_parse(e){return this._getType(e)===ke.null?Fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}us.create=(t,e)=>new us({innerType:t,typeName:Xe.ZodNullable,...ot(e)});class jc extends lt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ke.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jc.create=(t,e)=>new jc({innerType:t,typeName:Xe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ot(e)});class Uc extends lt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Rc(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hn(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Uc.create=(t,e)=>new Uc({innerType:t,typeName:Xe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ot(e)});class Ju extends lt{_parse(e){if(this._getType(e)!==ke.nan){const r=this._getOrReturnCtx(e);return Oe(r,{code:ge.invalid_type,expected:ke.nan,received:r.parsedType}),Qe}return{status:"valid",value:e.data}}}Ju.create=t=>new Ju({typeName:Xe.ZodNaN,...ot(t)});const yN=Symbol("zod_brand");class Kh extends lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class wl extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Qe:s.status==="dirty"?(n.dirty(),Po(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Qe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new wl({in:e,out:n,typeName:Xe.ZodPipeline})}}class Bc extends lt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ws(i)&&(i.value=Object.freeze(i.value)),i);return Rc(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Bc.create=(t,e)=>new Bc({innerType:t,typeName:Xe.ZodReadonly,...ot(e)});function Jb(t,e={},n){return t?ta.create().superRefine((r,i)=>{var s,o;if(!t(r)){const a=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(o=(s=a.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0,l=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...l,fatal:c})}}):ta.create()}const vN={object:Jt.lazycreate};var Xe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Xe||(Xe={}));const _N=(t,e={message:`Input not instance of ${t.name}`})=>Jb(n=>n instanceof t,e),Xb=Ir.create,Kb=as.create,bN=Ju.create,EN=cs.create,Qb=kc.create,SN=qs.create,wN=Zu.create,TN=Nc.create,IN=Ac.create,xN=ta.create,ON=$s.create,DN=Ri.create,RN=Gu.create,kN=Or.create,NN=Jt.create,AN=Jt.strictCreate,CN=Cc.create,MN=Bd.create,LN=Mc.create,PN=ti.create,FN=Lc.create,$N=Yu.create,jN=Zs.create,UN=Zo.create,BN=Pc.create,zN=Fc.create,VN=ls.create,HN=$c.create,WN=na.create,Ry=Ar.create,qN=Gr.create,ZN=us.create,GN=Ar.createWithPreprocess,YN=wl.create,JN=()=>Xb().optional(),XN=()=>Kb().optional(),KN=()=>Qb().optional(),QN={string:t=>Ir.create({...t,coerce:!0}),number:t=>as.create({...t,coerce:!0}),boolean:t=>kc.create({...t,coerce:!0}),bigint:t=>cs.create({...t,coerce:!0}),date:t=>qs.create({...t,coerce:!0})},eA=Qe;var te=Object.freeze({__proto__:null,defaultErrorMap:ea,setErrorMap:Gk,getErrorMap:Hu,makeIssue:Wu,EMPTY_PATH:Yk,addIssueToContext:Oe,ParseStatus:On,INVALID:Qe,DIRTY:Po,OK:Fn,isAborted:Lp,isDirty:Pp,isValid:Ws,isAsync:Rc,get util(){return It},get objectUtil(){return Mp},ZodParsedType:ke,getParsedType:mi,ZodType:lt,datetimeRegex:Gb,ZodString:Ir,ZodNumber:as,ZodBigInt:cs,ZodBoolean:kc,ZodDate:qs,ZodSymbol:Zu,ZodUndefined:Nc,ZodNull:Ac,ZodAny:ta,ZodUnknown:$s,ZodNever:Ri,ZodVoid:Gu,ZodArray:Or,ZodObject:Jt,ZodUnion:Cc,ZodDiscriminatedUnion:Bd,ZodIntersection:Mc,ZodTuple:ti,ZodRecord:Lc,ZodMap:Yu,ZodSet:Zs,ZodFunction:Zo,ZodLazy:Pc,ZodLiteral:Fc,ZodEnum:ls,ZodNativeEnum:$c,ZodPromise:na,ZodEffects:Ar,ZodTransformer:Ar,ZodOptional:Gr,ZodNullable:us,ZodDefault:jc,ZodCatch:Uc,ZodNaN:Ju,BRAND:yN,ZodBranded:Kh,ZodPipeline:wl,ZodReadonly:Bc,custom:Jb,Schema:lt,ZodSchema:lt,late:vN,get ZodFirstPartyTypeKind(){return Xe},coerce:QN,any:xN,array:kN,bigint:EN,boolean:Qb,date:SN,discriminatedUnion:MN,effect:Ry,enum:VN,function:UN,instanceof:_N,intersection:LN,lazy:BN,literal:zN,map:$N,nan:bN,nativeEnum:HN,never:DN,null:IN,nullable:ZN,number:Kb,object:NN,oboolean:KN,onumber:XN,optional:qN,ostring:JN,pipeline:YN,preprocess:GN,promise:WN,record:FN,set:jN,strictObject:AN,string:Xb,symbol:wN,transformer:Ry,tuple:PN,undefined:TN,union:CN,unknown:ON,void:RN,NEVER:eA,ZodIssueCode:ge,quotelessJson:Zk,ZodError:Hn});const nn={Remove:"remove",Replace:"replace",Add:"add"},eE=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),tA=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),wu=Symbol.iterator,tr={mutable:"mutable",immutable:"immutable"},Qh={};function fc(t,e){return t instanceof Map?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function ky(t,e){if(e in t){let n=Reflect.getPrototypeOf(t);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,e);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function em(t){return Object.getPrototypeOf(t)===Set.prototype}function tm(t){return Object.getPrototypeOf(t)===Map.prototype}function Jn(t){var e;return(e=t.copy)!==null&&e!==void 0?e:t.original}function Gs(t){return!!bt(t)}function bt(t){return typeof t!="object"?null:t==null?void 0:t[eE]}function nm(t){var e;const n=bt(t);return n?(e=n.copy)!==null&&e!==void 0?e:n.original:t}function Cr(t,e){if(!t||typeof t!="object")return!1;let n;return Object.getPrototypeOf(t)===Object.prototype||Array.isArray(t)||t instanceof Map||t instanceof Set||!!(e!=null&&e.mark)&&((n=e.mark(t,tr))===tr.immutable||typeof n=="function")}function tE(t,e=[]){if(Object.hasOwnProperty.call(t,"key")){const n=t.parent.copy,r=bt(ki(n,t.key));if(r!==null&&(r==null?void 0:r.original)!==t.original)return null;const i=t.parent.type===3,s=i?Array.from(t.parent.setMap.keys()).indexOf(t.key):t.key;if(!(i&&n.size>s||fc(n,s)))return null;e.push(s)}if(t.parent)return tE(t.parent,e);e.reverse();try{nA(t.copy,e)}catch{return null}return e}function ao(t){return Array.isArray(t)?1:t instanceof Map?2:t instanceof Set?3:0}function ki(t,e){return ao(t)===2?t.get(e):t[e]}function Tl(t,e,n){ao(t)===2?t.set(e,n):t[e]=n}function Xf(t,e){const n=bt(t);return(n?Jn(n):t)[e]}function Ti(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function $p(t){if(t)for(;t.finalities.revoke.length>0;)t.finalities.revoke.pop()()}function Cs(t,e){return e?t:[""].concat(t).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function nA(t,e){for(let n=0;n<e.length-1;n+=1){const r=e[n];if(t=ki(ao(t)===3?Array.from(t):t,r),typeof t!="object")throw new Error(`Cannot resolve patch at '${e.join("/")}'.`)}return t}function rA(t){const e=Object.create(Object.getPrototypeOf(t));return Reflect.ownKeys(t).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(t,n);if(r.enumerable&&r.configurable&&r.writable){e[n]=t[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:t[n]}),Reflect.defineProperty(e,n,r)}),e}const iA=Object.prototype.propertyIsEnumerable;function nE(t,e){let n;if(Array.isArray(t))return Array.prototype.concat.call(t);if(t instanceof Set){if(!em(t)){const r=Object.getPrototypeOf(t).constructor;return new r(t.values())}return Set.prototype.difference?Set.prototype.difference.call(t,new Set):new Set(t.values())}else if(t instanceof Map){if(!tm(t)){const r=Object.getPrototypeOf(t).constructor;return new r(t)}return new Map(t)}else if(e!=null&&e.mark&&(n=e.mark(t,tr),n!==void 0)&&n!==tr.mutable){if(n===tr.immutable)return rA(t);if(typeof n=="function"){if(e.enablePatches||e.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype){const r={};return Object.keys(t).forEach(i=>{r[i]=t[i]}),Object.getOwnPropertySymbols(t).forEach(i=>{iA.call(t,i)&&(r[i]=t[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Nn(t){t.copy||(t.copy=nE(t.original,t.options))}function ec(t){if(!Cr(t))return nm(t);if(Array.isArray(t))return t.map(ec);if(t instanceof Map){const n=Array.from(t.entries()).map(([r,i])=>[r,ec(i)]);if(!tm(t)){const r=Object.getPrototypeOf(t).constructor;return new r(n)}return new Map(n)}if(t instanceof Set){const n=Array.from(t).map(ec);if(!em(t)){const r=Object.getPrototypeOf(t).constructor;return new r(n)}return new Set(n)}const e=Object.create(Object.getPrototypeOf(t));for(const n in t)e[n]=ec(t[n]);return e}function Tu(t){return Gs(t)?ec(t):t}function Yr(t){var e;t.assignedMap=(e=t.assignedMap)!==null&&e!==void 0?e:new Map,t.operated||(t.operated=!0,t.parent&&Yr(t.parent))}function Ny(){throw new Error("Cannot modify frozen object")}function Do(t,e,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const o=n.has(t)?n.get(t):t;if(r.length>0){const a=r.indexOf(o);if(o&&typeof o=="object"&&a!==-1)throw r[0]===o?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,a).map((c,l)=>{if(typeof c=="symbol")return`[${c.toString()}]`;const u=r[l];return typeof c=="object"&&(u instanceof Map||u instanceof Set)?Array.from(u.keys()).indexOf(c):c}).join("/")}`);r.push(o),i.push(e)}else r.push(o)}if(Object.isFrozen(t)||Gs(t)){r.pop(),i.pop();return}switch(ao(t)){case 2:for(const[a,c]of t)Do(a,a,n,r,i),Do(c,a,n,r,i);t.set=t.clear=t.delete=Ny;break;case 3:for(const a of t)Do(a,a,n,r,i);t.add=t.clear=t.delete=Ny;break;case 1:Object.freeze(t);let o=0;for(const a of t)Do(a,o,n,r,i),o+=1;break;default:Object.freeze(t),Object.keys(t).forEach(a=>{const c=t[a];Do(c,a,n,r,i)})}r.pop(),i.pop()}function rm(t,e){const n=ao(t);if(n===0)Reflect.ownKeys(t).forEach(r=>{e(r,t[r],t)});else if(n===1){let r=0;for(const i of t)e(r,i,t),r+=1}else t.forEach((r,i)=>e(i,r,t))}function rE(t,e,n){if(Gs(t)||!Cr(t,n)||e.has(t)||Object.isFrozen(t))return;const r=t instanceof Set,i=r?new Map:void 0;if(e.add(t),rm(t,(s,o)=>{var a;if(Gs(o)){const c=bt(o);Nn(c);const l=!((a=c.assignedMap)===null||a===void 0)&&a.size||c.operated?c.copy:c.original;Tl(r?i:t,s,l)}else rE(o,e,n)}),i){const s=t,o=Array.from(s);s.clear(),o.forEach(a=>{s.add(i.has(a)?i.get(a):a)})}}function sA(t,e){const n=t.type===3?t.setMap:t.copy;t.finalities.revoke.length>1&&t.assignedMap.get(e)&&n&&rE(ki(n,e),t.finalities.handledSet,t.options)}function jp(t){t.type===3&&t.copy&&(t.copy.clear(),t.setMap.forEach(e=>{t.copy.add(nm(e))}))}function Up(t,e,n,r){if(t.operated&&t.assignedMap&&t.assignedMap.size>0&&!t.finalized){if(n&&r){const s=tE(t);s&&e(t,s,n,r)}t.finalized=!0}}function im(t,e,n,r){const i=bt(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((s,o)=>{var a;const c=t.type===3?t.setMap:t.copy;if(Ti(ki(c,e),n)){let l=i.original;i.copy&&(l=i.copy),jp(t),Up(t,r,s,o),t.options.enableAutoFreeze&&(t.options.updatedValues=(a=t.options.updatedValues)!==null&&a!==void 0?a:new WeakMap,t.options.updatedValues.set(l,i.original)),Tl(c,e,l)}}),t.options.enableAutoFreeze&&i.finalities!==t.finalities&&(t.options.enableAutoFreeze=!1)),Cr(n,t.options)&&t.finalities.draft.push(()=>{const s=t.type===3?t.setMap:t.copy;Ti(ki(s,e),n)&&sA(t,e)})}function oA(t,e,n,r,i){let{original:s,assignedMap:o,options:a}=t,c=t.copy;c.length<s.length&&([s,c]=[c,s],[n,r]=[r,n]);for(let l=0;l<s.length;l+=1)if(o.get(l.toString())&&c[l]!==s[l]){const u=e.concat([l]),d=Cs(u,i);n.push({op:nn.Replace,path:d,value:Tu(c[l])}),r.push({op:nn.Replace,path:d,value:Tu(s[l])})}for(let l=s.length;l<c.length;l+=1){const u=e.concat([l]),d=Cs(u,i);n.push({op:nn.Add,path:d,value:Tu(c[l])})}if(s.length<c.length){const{arrayLengthAssignment:l=!0}=a.enablePatches;if(l){const u=e.concat(["length"]),d=Cs(u,i);r.push({op:nn.Replace,path:d,value:s.length})}else for(let u=c.length;s.length<u;u-=1){const d=e.concat([u-1]),f=Cs(d,i);r.push({op:nn.Remove,path:f})}}}function aA({original:t,copy:e,assignedMap:n},r,i,s,o){n.forEach((a,c)=>{const l=ki(t,c),u=Tu(ki(e,c)),d=a?fc(t,c)?nn.Replace:nn.Add:nn.Remove;if(Ti(l,u)&&d===nn.Replace)return;const f=r.concat(c),p=Cs(f,o);i.push(d===nn.Remove?{op:d,path:p}:{op:d,path:p,value:u}),s.push(d===nn.Add?{op:nn.Remove,path:p}:d===nn.Remove?{op:nn.Add,path:p,value:l}:{op:nn.Replace,path:p,value:l})})}function cA({original:t,copy:e},n,r,i,s){let o=0;t.forEach(a=>{if(!e.has(a)){const c=n.concat([o]),l=Cs(c,s);r.push({op:nn.Remove,path:l,value:a}),i.unshift({op:nn.Add,path:l,value:a})}o+=1}),o=0,e.forEach(a=>{if(!t.has(a)){const c=n.concat([o]),l=Cs(c,s);r.push({op:nn.Add,path:l,value:a}),i.unshift({op:nn.Remove,path:l,value:a})}o+=1})}function zc(t,e,n,r){const{pathAsArray:i=!0}=t.options.enablePatches;switch(t.type){case 0:case 2:return aA(t,e,n,r,i);case 1:return oA(t,e,n,r,i);case 3:return cA(t,e,n,r,i)}}let Bp=!1;const Xu=(t,e,n=!1)=>{if(typeof t=="object"&&t!==null&&(!Cr(t,e)||n)&&!Bp)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function lA(t){Bp=!0;let e;try{e=t()}finally{Bp=!1}return e}const zp={get size(){return Jn(bt(this)).size},has(t){return Jn(bt(this)).has(t)},set(t,e){const n=bt(this),r=Jn(n);return(!r.has(t)||!Ti(r.get(t),e))&&(Nn(n),Yr(n),n.assignedMap.set(t,!0),n.copy.set(t,e),im(n,t,e,zc)),this},delete(t){if(!this.has(t))return!1;const e=bt(this);return Nn(e),Yr(e),e.original.has(t)?e.assignedMap.set(t,!1):e.assignedMap.delete(t),e.copy.delete(t),!0},clear(){const t=bt(this);if(this.size){Nn(t),Yr(t),t.assignedMap=new Map;for(const[e]of t.original)t.assignedMap.set(e,!1);t.copy.clear()}},forEach(t,e){const n=bt(this);Jn(n).forEach((r,i)=>{t.call(e,this.get(i),i,this)})},get(t){var e,n;const r=bt(this),i=Jn(r).get(t),s=((n=(e=r.options).mark)===null||n===void 0?void 0:n.call(e,i,tr))===tr.mutable;if(r.options.strict&&Xu(i,r.options,s),s||r.finalized||!Cr(i,r.options)||i!==r.original.get(t))return i;const o=Qh.createDraft({original:i,parentDraft:r,key:t,finalities:r.finalities,options:r.options});return Nn(r),r.copy.set(t,o),o},keys(){return Jn(bt(this)).keys()},values(){const t=this.keys();return{[wu]:()=>this.values(),next:()=>{const e=t.next();return e.done?e:{done:!1,value:this.get(e.value)}}}},entries(){const t=this.keys();return{[wu]:()=>this.entries(),next:()=>{const e=t.next();if(e.done)return e;const n=this.get(e.value);return{done:!1,value:[e.value,n]}}}},[wu](){return this.entries()}},uA=Reflect.ownKeys(zp),Ay=(t,e,{isValuesIterator:n})=>()=>{var r,i;const s=e.next();if(s.done)return s;const o=s.value;let a=t.setMap.get(o);const c=bt(a),l=((i=(r=t.options).mark)===null||i===void 0?void 0:i.call(r,a,tr))===tr.mutable;if(t.options.strict&&Xu(o,t.options,l),!l&&!c&&Cr(o,t.options)&&!t.finalized&&t.original.has(o)){const u=Qh.createDraft({original:o,parentDraft:t,key:o,finalities:t.finalities,options:t.options});t.setMap.set(o,u),a=u}else c&&(a=c.proxy);return{done:!1,value:n?a:[a,a]}},Ku={get size(){return bt(this).setMap.size},has(t){const e=bt(this);if(e.setMap.has(t))return!0;Nn(e);const n=bt(t);return!!(n&&e.setMap.has(n.original))},add(t){const e=bt(this);return this.has(t)||(Nn(e),Yr(e),e.assignedMap.set(t,!0),e.setMap.set(t,t),im(e,t,t,zc)),this},delete(t){if(!this.has(t))return!1;const e=bt(this);Nn(e),Yr(e);const n=bt(t);return n&&e.setMap.has(n.original)?(e.assignedMap.set(n.original,!1),e.setMap.delete(n.original)):(!n&&e.setMap.has(t)?e.assignedMap.set(t,!1):e.assignedMap.delete(t),e.setMap.delete(t))},clear(){if(!this.size)return;const t=bt(this);Nn(t),Yr(t);for(const e of t.original)t.assignedMap.set(e,!1);t.setMap.clear()},values(){const t=bt(this);Nn(t);const e=t.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:Ay(t,e,{isValuesIterator:!0})}},entries(){const t=bt(this);Nn(t);const e=t.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:Ay(t,e,{isValuesIterator:!1})}},keys(){return this.values()},[wu](){return this.values()},forEach(t,e){const n=this.values();let r=n.next();for(;!r.done;)t.call(e,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(Ku,{intersection(t){return Set.prototype.intersection.call(new Set(this.values()),t)},union(t){return Set.prototype.union.call(new Set(this.values()),t)},difference(t){return Set.prototype.difference.call(new Set(this.values()),t)},symmetricDifference(t){return Set.prototype.symmetricDifference.call(new Set(this.values()),t)},isSubsetOf(t){return Set.prototype.isSubsetOf.call(new Set(this.values()),t)},isSupersetOf(t){return Set.prototype.isSupersetOf.call(new Set(this.values()),t)},isDisjointFrom(t){return Set.prototype.isDisjointFrom.call(new Set(this.values()),t)}});const dA=Reflect.ownKeys(Ku),iE=new WeakSet,sE={get(t,e,n){var r,i;const s=(r=t.copy)===null||r===void 0?void 0:r[e];if(s&&iE.has(s))return s;if(e===eE)return t;let o;if(t.options.mark){const l=e==="size"&&(t.original instanceof Map||t.original instanceof Set)?Reflect.get(t.original,e):Reflect.get(t.original,e,n);if(o=t.options.mark(l,tr),o===tr.mutable)return t.options.strict&&Xu(l,t.options,!0),l}const a=Jn(t);if(a instanceof Map&&uA.includes(e)){if(e==="size")return Object.getOwnPropertyDescriptor(zp,"size").get.call(t.proxy);const l=zp[e];if(l)return l.bind(t.proxy)}if(a instanceof Set&&dA.includes(e)){if(e==="size")return Object.getOwnPropertyDescriptor(Ku,"size").get.call(t.proxy);const l=Ku[e];if(l)return l.bind(t.proxy)}if(!fc(a,e)){const l=ky(a,e);return l?"value"in l?l.value:(i=l.get)===null||i===void 0?void 0:i.call(t.proxy):void 0}const c=a[e];if(t.options.strict&&Xu(c,t.options),t.finalized||!Cr(c,t.options))return c;if(c===Xf(t.original,e)){if(Nn(t),t.copy[e]=sm({original:t.original[e],parentDraft:t,key:t.type===1?Number(e):e,finalities:t.finalities,options:t.options}),typeof o=="function"){const l=bt(t.copy[e]);return Nn(l),Yr(l),l.copy}return t.copy[e]}return c},set(t,e,n){var r;if(t.type===3||t.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(t.type===1&&e!=="length"&&!(Number.isInteger(i=Number(e))&&i>=0&&(e===0||i===0||String(i)===String(e))))throw new Error("Only supports setting array indices and the 'length' property.");const s=ky(Jn(t),e);if(s!=null&&s.set)return s.set.call(t.proxy,n),!0;const o=Xf(Jn(t),e),a=bt(o);return a&&Ti(a.original,n)?(t.copy[e]=n,t.assignedMap=(r=t.assignedMap)!==null&&r!==void 0?r:new Map,t.assignedMap.set(e,!1),!0):(Ti(n,o)&&(n!==void 0||fc(t.original,e))||(Nn(t),Yr(t),fc(t.original,e)&&Ti(n,t.original[e])?t.assignedMap.delete(e):t.assignedMap.set(e,!0),t.copy[e]=n,im(t,e,n,zc)),!0)},has(t,e){return e in Jn(t)},ownKeys(t){return Reflect.ownKeys(Jn(t))},getOwnPropertyDescriptor(t,e){const n=Jn(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},getPrototypeOf(t){return Reflect.getPrototypeOf(t.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(t,e){var n;return t.type===1?sE.set.call(this,t,e,void 0,t.proxy):(Xf(t.original,e)!==void 0||e in t.original?(Nn(t),Yr(t),t.assignedMap.set(e,!1)):(t.assignedMap=(n=t.assignedMap)!==null&&n!==void 0?n:new Map,t.assignedMap.delete(e)),t.copy&&delete t.copy[e],!0)}};function sm(t){const{original:e,parentDraft:n,key:r,finalities:i,options:s}=t,o=ao(e),a={type:o,finalized:!1,parent:n,original:e,copy:null,proxy:null,finalities:i,options:s,setMap:o===3?new Map(e.entries()):void 0};(r||"key"in t)&&(a.key=r);const{proxy:c,revoke:l}=Proxy.revocable(o===1?Object.assign([],a):a,sE);if(i.revoke.push(l),iE.add(c),a.proxy=c,n){const u=n;u.finalities.draft.push((d,f)=>{var p,h;const m=bt(c);let v=u.type===3?u.setMap:u.copy;const y=ki(v,r),g=bt(y);if(g){let _=g.original;g.operated&&(_=nm(y)),jp(g),Up(g,zc,d,f),u.options.enableAutoFreeze&&(u.options.updatedValues=(p=u.options.updatedValues)!==null&&p!==void 0?p:new WeakMap,u.options.updatedValues.set(_,g.original)),Tl(v,r,_)}(h=m.callbacks)===null||h===void 0||h.forEach(_=>{_(d,f)})})}else{const u=bt(c);u.finalities.draft.push((d,f)=>{jp(u),Up(u,zc,d,f)})}return c}Qh.createDraft=sm;function fA(t,e,n,r,i){var s;const o=bt(t),a=(s=o==null?void 0:o.original)!==null&&s!==void 0?s:t,c=!!e.length;if(o!=null&&o.operated)for(;o.finalities.draft.length>0;)o.finalities.draft.pop()(n,r);const l=c?e[0]:o?o.operated?o.copy:o.original:t;return o&&$p(o),i&&Do(l,l,o==null?void 0:o.options.updatedValues),[l,n&&c?[{op:nn.Replace,path:[],value:e[0]}]:n,r&&c?[{op:nn.Replace,path:[],value:a}]:r]}function pA(t,e){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,s;e.enablePatches&&(i=[],s=[]);const a=((n=e.mark)===null||n===void 0?void 0:n.call(e,t,tr))===tr.mutable||!Cr(t,e)?t:sm({original:t,parentDraft:null,finalities:r,options:e});return[a,(c=[])=>{const[l,u,d]=fA(a,c,i,s,e.enableAutoFreeze);return e.enablePatches?[l,u,d]:l}]}function Vp(t){const{rootDraft:e,value:n,useRawReturn:r=!1,isRoot:i=!0}=t;rm(n,(s,o,a)=>{const c=bt(o);if(c&&e&&c.finalities===e.finalities){t.isContainDraft=!0;const l=c.original;if(a instanceof Set){const u=Array.from(a);a.clear(),u.forEach(d=>a.add(s===d?l:d))}else Tl(a,s,l)}else typeof o=="object"&&o!==null&&(t.value=o,t.isRoot=!1,Vp(t))}),i&&(t.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function oE(t){var e;const n=bt(t);if(!Cr(t,n==null?void 0:n.options))return t;const r=ao(t);if(n&&!n.operated)return n.original;let i;function s(){i=r===2?tm(t)?new Map(t):new(Object.getPrototypeOf(t)).constructor(t):r===3?Array.from(n.setMap.values()):nE(t,n==null?void 0:n.options)}if(n){n.finalized=!0;try{s()}finally{n.finalized=!1}}else i=t;if(rm(i,(o,a)=>{if(n&&Ti(ki(n.original,o),a))return;const c=oE(a);c!==a&&(i===t&&s(),Tl(i,o,c))}),r===3){const o=(e=n==null?void 0:n.original)!==null&&e!==void 0?e:i;return em(o)?new Set(i):new(Object.getPrototypeOf(o)).constructor(i)}return i}function Cy(t){if(!Gs(t))throw new Error(`current() is only used for Draft, parameter: ${t}`);return oE(t)}const hA=t=>function e(n,r,i){var s,o,a;if(typeof n=="function"&&typeof r!="function")return function(w,...E){return e(w,R=>n.call(this,R,...E),r)};const c=n,l=r;let u=i;if(typeof r!="function"&&(u=r),u!==void 0&&Object.prototype.toString.call(u)!=="[object Object]")throw new Error(`Invalid options: ${u}, 'options' should be an object.`);u=Object.assign(Object.assign({},t),u);const d=Gs(c)?Cy(c):c,f=Array.isArray(u.mark)?(w,E)=>{for(const R of u.mark){if(typeof R!="function")throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);const j=R(w,E);if(j)return j}}:u.mark,p=(s=u.enablePatches)!==null&&s!==void 0?s:!1,h=(o=u.strict)!==null&&o!==void 0?o:!1,v={enableAutoFreeze:(a=u.enableAutoFreeze)!==null&&a!==void 0?a:!1,mark:f,strict:h,enablePatches:p};if(!Cr(d,v)&&typeof d=="object"&&d!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=pA(d,v);if(typeof r!="function"){if(!Cr(d,v))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let _;try{_=l(y)}catch(w){throw $p(bt(y)),w}const T=w=>{const E=bt(y);if(!Gs(w)){if(w!==void 0&&!Ti(w,y)&&(E!=null&&E.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const j=w==null?void 0:w[tA];if(j){const M=j[0];return v.strict&&typeof w=="object"&&w!==null&&Vp({rootDraft:E,value:w,useRawReturn:!0}),g([M])}if(w!==void 0)return typeof w=="object"&&w!==null&&Vp({rootDraft:E,value:w}),g([w])}if(w===y||w===void 0)return g([]);const R=bt(w);if(v===R.options){if(R.operated)throw new Error("Cannot return a modified child draft.");return g([Cy(w)])}return g([w])};return _ instanceof Promise?_.then(T,w=>{throw $p(bt(y)),w}):T(_)},om=hA();Object.prototype.constructor.toString();var mA=Object.defineProperty,gA=(t,e,n)=>e in t?mA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,aE=(t,e,n)=>gA(t,typeof e!="symbol"?e+"":e,n);const yA=t=>t!=null;te.any().refine(t=>yA(t));const vA=te.enum(["LOAD_STATE"]),_A=te.enum(["PRUNE"]),bA=te.enum(["REDO"]),EA=te.enum(["SET_NAME"]),SA=te.enum(["UNDO"]);function zd(){return te.literal("global").or(te.literal("local"))}function wA(){return te.union([TA(),xA(),OA(),DA(),RA()])}function TA(){return te.object({input:te.lazy(()=>cE()),type:vA,scope:zd()})}function cE(){return te.object({operations:te.number(),state:te.lazy(()=>IA())})}function IA(){return te.object({data:te.unknown().nullish(),name:te.string()})}function xA(){return te.object({input:te.lazy(()=>lE()),type:_A,scope:zd()})}function lE(){return te.object({end:te.number().nullish(),start:te.number().nullish()})}const uE=te.number;function OA(){return te.object({input:uE(),type:bA,scope:zd()})}const dE=te.string;function DA(){return te.object({input:dE(),type:EA,scope:te.literal("global")})}const fE=te.number;function RA(){return te.object({input:fE(),type:SA,scope:zd()})}function kA(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jl={exports:{}},My;function NA(){return My||(My=1,function(t,e){const{hasOwnProperty:n}=Object.prototype,r=y();r.configure=y,r.stringify=r,r.default=r,e.stringify=r,e.configure=y,t.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function s(g){return g.length<5e3&&!i.test(g)?`"${g}"`:JSON.stringify(g)}function o(g,_){if(g.length>200||_)return g.sort(_);for(let T=1;T<g.length;T++){const w=g[T];let E=T;for(;E!==0&&g[E-1]>w;)g[E]=g[E-1],E--;g[E]=w}return g}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(g){return a.call(g)!==void 0&&g.length!==0}function l(g,_,T){g.length<T&&(T=g.length);const w=_===","?"":" ";let E=`"0":${w}${g[0]}`;for(let R=1;R<T;R++)E+=`${_}"${R}":${w}${g[R]}`;return E}function u(g){if(n.call(g,"circularValue")){const _=g.circularValue;if(typeof _=="string")return`"${_}"`;if(_==null)return _;if(_===Error||_===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function d(g){let _;if(n.call(g,"deterministic")&&(_=g.deterministic,typeof _!="boolean"&&typeof _!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return _===void 0?!0:_}function f(g,_){let T;if(n.call(g,_)&&(T=g[_],typeof T!="boolean"))throw new TypeError(`The "${_}" argument must be of type boolean`);return T===void 0?!0:T}function p(g,_){let T;if(n.call(g,_)){if(T=g[_],typeof T!="number")throw new TypeError(`The "${_}" argument must be of type number`);if(!Number.isInteger(T))throw new TypeError(`The "${_}" argument must be an integer`);if(T<1)throw new RangeError(`The "${_}" argument must be >= 1`)}return T===void 0?1/0:T}function h(g){return g===1?"1 item":`${g} items`}function m(g){const _=new Set;for(const T of g)(typeof T=="string"||typeof T=="number")&&_.add(String(T));return _}function v(g){if(n.call(g,"strict")){const _=g.strict;if(typeof _!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(_)return T=>{let w=`Object can not safely be stringified. Received type ${typeof T}`;throw typeof T!="function"&&(w+=` (${T.toString()})`),new Error(w)}}}function y(g){g={...g};const _=v(g);_&&(g.bigint===void 0&&(g.bigint=!1),"circularValue"in g||(g.circularValue=Error));const T=u(g),w=f(g,"bigint"),E=d(g),R=typeof E=="function"?E:void 0,j=p(g,"maximumDepth"),M=p(g,"maximumBreadth");function $(k,C,U,oe,F,Z){let L=C[k];switch(typeof L=="object"&&L!==null&&typeof L.toJSON=="function"&&(L=L.toJSON(k)),L=oe.call(C,k,L),typeof L){case"string":return s(L);case"object":{if(L===null)return"null";if(U.indexOf(L)!==-1)return T;let I="",X=",";const B=Z;if(Array.isArray(L)){if(L.length===0)return"[]";if(j<U.length+1)return'"[Array]"';U.push(L),F!==""&&(Z+=F,I+=`
|
|
119
|
-
${Z}`,X=`,
|
|
120
|
-
${Z}`);const rt=Math.min(L.length,M);let We=0;for(;We<rt-1;We++){const At=$(String(We),L,U,oe,F,Z);I+=At!==void 0?At:"null",I+=X}const it=$(String(We),L,U,oe,F,Z);if(I+=it!==void 0?it:"null",L.length-1>M){const At=L.length-M-1;I+=`${X}"... ${h(At)} not stringified"`}return F!==""&&(I+=`
|
|
121
|
-
${B}`),U.pop(),`[${I}]`}let H=Object.keys(L);const ve=H.length;if(ve===0)return"{}";if(j<U.length+1)return'"[Object]"';let he="",Ee="";F!==""&&(Z+=F,X=`,
|
|
122
|
-
${Z}`,he=" ");const ze=Math.min(ve,M);E&&!c(L)&&(H=o(H,R)),U.push(L);for(let rt=0;rt<ze;rt++){const We=H[rt],it=$(We,L,U,oe,F,Z);it!==void 0&&(I+=`${Ee}${s(We)}:${he}${it}`,Ee=X)}if(ve>M){const rt=ve-M;I+=`${Ee}"...":${he}"${h(rt)} not stringified"`,Ee=X}return F!==""&&Ee.length>1&&(I=`
|
|
123
|
-
${Z}${I}
|
|
124
|
-
${B}`),U.pop(),`{${I}}`}case"number":return isFinite(L)?String(L):_?_(L):"null";case"boolean":return L===!0?"true":"false";case"undefined":return;case"bigint":if(w)return String(L);default:return _?_(L):void 0}}function ne(k,C,U,oe,F,Z){switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(k)),typeof C){case"string":return s(C);case"object":{if(C===null)return"null";if(U.indexOf(C)!==-1)return T;const L=Z;let I="",X=",";if(Array.isArray(C)){if(C.length===0)return"[]";if(j<U.length+1)return'"[Array]"';U.push(C),F!==""&&(Z+=F,I+=`
|
|
125
|
-
${Z}`,X=`,
|
|
126
|
-
${Z}`);const ve=Math.min(C.length,M);let he=0;for(;he<ve-1;he++){const ze=ne(String(he),C[he],U,oe,F,Z);I+=ze!==void 0?ze:"null",I+=X}const Ee=ne(String(he),C[he],U,oe,F,Z);if(I+=Ee!==void 0?Ee:"null",C.length-1>M){const ze=C.length-M-1;I+=`${X}"... ${h(ze)} not stringified"`}return F!==""&&(I+=`
|
|
127
|
-
${L}`),U.pop(),`[${I}]`}U.push(C);let B="";F!==""&&(Z+=F,X=`,
|
|
128
|
-
${Z}`,B=" ");let H="";for(const ve of oe){const he=ne(ve,C[ve],U,oe,F,Z);he!==void 0&&(I+=`${H}${s(ve)}:${B}${he}`,H=X)}return F!==""&&H.length>1&&(I=`
|
|
129
|
-
${Z}${I}
|
|
130
|
-
${L}`),U.pop(),`{${I}}`}case"number":return isFinite(C)?String(C):_?_(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(w)return String(C);default:return _?_(C):void 0}}function x(k,C,U,oe,F){switch(typeof C){case"string":return s(C);case"object":{if(C===null)return"null";if(typeof C.toJSON=="function"){if(C=C.toJSON(k),typeof C!="object")return x(k,C,U,oe,F);if(C===null)return"null"}if(U.indexOf(C)!==-1)return T;const Z=F;if(Array.isArray(C)){if(C.length===0)return"[]";if(j<U.length+1)return'"[Array]"';U.push(C),F+=oe;let he=`
|
|
131
|
-
${F}`;const Ee=`,
|
|
132
|
-
${F}`,ze=Math.min(C.length,M);let rt=0;for(;rt<ze-1;rt++){const it=x(String(rt),C[rt],U,oe,F);he+=it!==void 0?it:"null",he+=Ee}const We=x(String(rt),C[rt],U,oe,F);if(he+=We!==void 0?We:"null",C.length-1>M){const it=C.length-M-1;he+=`${Ee}"... ${h(it)} not stringified"`}return he+=`
|
|
133
|
-
${Z}`,U.pop(),`[${he}]`}let L=Object.keys(C);const I=L.length;if(I===0)return"{}";if(j<U.length+1)return'"[Object]"';F+=oe;const X=`,
|
|
134
|
-
${F}`;let B="",H="",ve=Math.min(I,M);c(C)&&(B+=l(C,X,M),L=L.slice(C.length),ve-=C.length,H=X),E&&(L=o(L,R)),U.push(C);for(let he=0;he<ve;he++){const Ee=L[he],ze=x(Ee,C[Ee],U,oe,F);ze!==void 0&&(B+=`${H}${s(Ee)}: ${ze}`,H=X)}if(I>M){const he=I-M;B+=`${H}"...": "${h(he)} not stringified"`,H=X}return H!==""&&(B=`
|
|
135
|
-
${F}${B}
|
|
136
|
-
${Z}`),U.pop(),`{${B}}`}case"number":return isFinite(C)?String(C):_?_(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(w)return String(C);default:return _?_(C):void 0}}function G(k,C,U){switch(typeof C){case"string":return s(C);case"object":{if(C===null)return"null";if(typeof C.toJSON=="function"){if(C=C.toJSON(k),typeof C!="object")return G(k,C,U);if(C===null)return"null"}if(U.indexOf(C)!==-1)return T;let oe="";const F=C.length!==void 0;if(F&&Array.isArray(C)){if(C.length===0)return"[]";if(j<U.length+1)return'"[Array]"';U.push(C);const B=Math.min(C.length,M);let H=0;for(;H<B-1;H++){const he=G(String(H),C[H],U);oe+=he!==void 0?he:"null",oe+=","}const ve=G(String(H),C[H],U);if(oe+=ve!==void 0?ve:"null",C.length-1>M){const he=C.length-M-1;oe+=`,"... ${h(he)} not stringified"`}return U.pop(),`[${oe}]`}let Z=Object.keys(C);const L=Z.length;if(L===0)return"{}";if(j<U.length+1)return'"[Object]"';let I="",X=Math.min(L,M);F&&c(C)&&(oe+=l(C,",",M),Z=Z.slice(C.length),X-=C.length,I=","),E&&(Z=o(Z,R)),U.push(C);for(let B=0;B<X;B++){const H=Z[B],ve=G(H,C[H],U);ve!==void 0&&(oe+=`${I}${s(H)}:${ve}`,I=",")}if(L>M){const B=L-M;oe+=`${I}"...":"${h(B)} not stringified"`}return U.pop(),`{${oe}}`}case"number":return isFinite(C)?String(C):_?_(C):"null";case"boolean":return C===!0?"true":"false";case"undefined":return;case"bigint":if(w)return String(C);default:return _?_(C):void 0}}function S(k,C,U){if(arguments.length>1){let oe="";if(typeof U=="number"?oe=" ".repeat(Math.min(U,10)):typeof U=="string"&&(oe=U.slice(0,10)),C!=null){if(typeof C=="function")return $("",{"":k},[],C,oe,"");if(Array.isArray(C))return ne("",k,[],m(C),oe,"")}if(oe.length!==0)return x("",k,[],oe,"")}return G("",k,[])}return S}}(Jl,Jl.exports)),Jl.exports}var AA=NA();const Ys=kA(AA);Ys.configure;const CA=[1518500249,1859775393,-1894007588,-899497514];function MA(t){return new LA}class LA{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!Xl||Pa>=8e3)&&(Xl=new ArrayBuffer(8e3),Pa=0),this._byte=new Uint8Array(Xl,Pa,80),this._word=new Int32Array(Xl,Pa,20),Pa+=80}update(e){if(typeof e=="string")return this._utf8(e);if(e==null)throw new TypeError("Invalid type: "+typeof e);const n=e.byteOffset,r=e.byteLength;let i=r/64|0,s=0;if(i&&!(n&3)&&!(this._size%64)){const a=new Int32Array(e.buffer,n,i*16);for(;i--;)this._int32(a,s>>2),s+=64;this._size+=s}if(e.BYTES_PER_ELEMENT!==1&&e.buffer){const a=new Uint8Array(e.buffer,n+s,r-s);return this._uint8(a)}return s===r?this:this._uint8(e,s)}_uint8(e,n){const{_byte:r,_word:i}=this,s=e.length;for(n=n|0;n<s;){const o=this._size%64;let a=o;for(;n<s&&a<64;)r[a++]=e[n++];a>=64&&this._int32(i),this._size+=a-o}return this}_utf8(e){const{_byte:n,_word:r}=this,i=e.length;let s=this._sp;for(let o=0;o<i;){const a=this._size%64;let c=a;for(;o<i&&c<64;){let l=e.charCodeAt(o++)|0;l<128?n[c++]=l:l<2048?(n[c++]=192|l>>>6,n[c++]=128|l&63):l<55296||l>57343?(n[c++]=224|l>>>12,n[c++]=128|l>>>6&63,n[c++]=128|l&63):s?(l=((s&1023)<<10)+(l&1023)+65536,n[c++]=240|l>>>18,n[c++]=128|l>>>12&63,n[c++]=128|l>>>6&63,n[c++]=128|l&63,s=0):s=l}c>=64&&(this._int32(r),r[0]=r[16]),this._size+=c-a}return this._sp=s,this}_int32(e,n){let{A:r,B:i,C:s,D:o,E:a}=this,c=0;for(n=n|0;c<16;)Ts[c++]=Bi(e[n++]);for(c=16;c<80;c++)Ts[c]=$A(Ts[c-3]^Ts[c-8]^Ts[c-14]^Ts[c-16]);for(c=0;c<80;c++){const l=c/20|0,u=jA(r)+BA(l,i,s,o)+a+Ts[c]+CA[l]|0;a=o,o=s,s=UA(i),i=r,r=u}this.A=r+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=o+this.D|0,this.E=a+this.E|0}digest(e){const{_byte:n,_word:r}=this;let i=this._size%64|0;for(n[i++]=128;i&3;)n[i++]=0;if(i>>=2,i>14){for(;i<16;)r[i++]=0;i=0,this._int32(r)}for(;i<16;)r[i++]=0;const s=this._size*8,o=(s&4294967295)>>>0,a=(s-o)/4294967296;return a&&(r[14]=Bi(a)),o&&(r[15]=Bi(o)),this._int32(r),e==="hex"?this._hex():this._bin()}_hex(){const{A:e,B:n,C:r,D:i,E:s}=this;return Fa(e)+Fa(n)+Fa(r)+Fa(i)+Fa(s)}_bin(){const{A:e,B:n,C:r,D:i,E:s,_byte:o,_word:a}=this;return a[0]=Bi(e),a[1]=Bi(n),a[2]=Bi(r),a[3]=Bi(i),a[4]=Bi(s),o.slice(0,20)}}const Ts=new Int32Array(80);let Xl,Pa=0;const Fa=t=>(t+4294967296).toString(16).substr(-8),PA=t=>t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255,FA=t=>t,Bi=zA()?FA:PA,$A=t=>t<<1|t>>>31,jA=t=>t<<5|t>>>27,UA=t=>t<<30|t>>>2;function BA(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}function zA(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const am=new Error("File system not available.");function VA(){if(!crypto.randomUUID)throw new Error("generateUUID is not available in unsecure contexts.");return crypto.randomUUID()}function HA(t,e,n){throw am}function pE(t){throw am}function WA(t){throw am}const qA=async t=>pE(),Il=(t,e="sha1")=>{if(!["sha1"].includes(e))throw new Error("Hashing algorithm not supported: Available: sha1");const n=GA(t);return ZA(n)};function ZA(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function GA(t,e="sha1"){if(!["sha1"].includes(e))throw new Error("Hashing algorithm not supported: Available: sha1");return MA().update(t).digest()}function cm(t){if(t&&t.toString()!=="UUIDv4")throw new Error(`Id generation method not supported: "${t.toString()}"`);return VA()}function hE(t){return(new Date(t).getTime()/1e3).toFixed(0)}function mE({documentId:t,signer:e,operation:n,previousStateHash:r}){const{timestamp:i,scope:s,id:o,type:a}=n;return[hE(i),e.app.key,Il([t,s,o,a,Ys(n.input)].join("")),r]}const YA=new TextEncoder;function lm(t){const e=t.join(""),n=`Signed Operation:
|
|
137
|
-
`+e.length.toString();return YA.encode(n+e)}function gE(t){const e=ArrayBuffer.isView(t)?t:new Uint8Array(t);return Array.prototype.map.call(e,n=>("00"+n.toString(16)).slice(-2)).join("")}function yE(t){var e;return new Uint8Array(((e=t.match(/[\da-f]{2}/gi))==null?void 0:e.map(function(n){return parseInt(n,16)}))??[])}async function vE(t,e){const n=mE(t),r=lm(n),i=await e(r);return[...n,`0x${gE(i)}`]}async function JA(t,e,n,r,i){var s,o;const a=e(n,t,void 0,{reuseHash:!0,reuseOperationResultingState:!0}),c=a.operations[t.scope].at(-1);if(!c)throw new Error("Action was not applied");const l=((s=a.operations[t.scope].at(-2))==null?void 0:s.hash)??"",u=await vE({...r,operation:c,previousStateHash:l},i);return{...c,context:{...c.context,signer:{...(o=c.context)==null?void 0:o.signer,...r.signer,signatures:[...r.signer.signatures??[],u]}}}}async function XA(t,e,n){const r=e.app.key,i=t.slice(0,4),s=yE(t[4]),o=lm(i);return n(r,s,o)}class um extends Error{constructor(e){super(),aE(this,"data"),this.name="InvalidActionInputError",this.data=e,this.message=this.message||`Invalid action input: ${JSON.stringify(e,null,2)}`}}class _E extends um{constructor(e){super(e),aE(this,"issues"),this.issues=e,this.name="InvalidActionInputZodError"}}const bE={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxl":["jxl"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts","m2t","m2ts","mts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(bE);var or=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Ro,tc,Os;class KA{constructor(...e){Ro.set(this,new Map),tc.set(this,new Map),Os.set(this,new Map);for(const n of e)this.define(n)}define(e,n=!1){for(let[r,i]of Object.entries(e)){r=r.toLowerCase(),i=i.map(a=>a.toLowerCase()),or(this,Os,"f").has(r)||or(this,Os,"f").set(r,new Set);const s=or(this,Os,"f").get(r);let o=!0;for(let a of i){const c=a.startsWith("*");if(a=c?a.slice(1):a,s==null||s.add(a),o&&or(this,tc,"f").set(r,a),o=!1,c)continue;const l=or(this,Ro,"f").get(a);if(l&&l!=r&&!n)throw new Error(`"${r} -> ${a}" conflicts with "${l} -> ${a}". Pass \`force=true\` to override this definition.`);or(this,Ro,"f").set(a,r)}}return this}getType(e){if(typeof e!="string")return null;const n=e.replace(/^.*[/\\]/,"").toLowerCase(),r=n.replace(/^.*\./,"").toLowerCase(),i=n.length<e.length;return!(r.length<n.length-1)&&i?null:or(this,Ro,"f").get(r)??null}getExtension(e){var n;return typeof e!="string"?null:(e=(n=e==null?void 0:e.split)==null?void 0:n.call(e,";")[0],(e&&or(this,tc,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:or(this,Os,"f").get(e.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(const e of or(this,Os,"f").values())Object.freeze(e);return this}_getTestState(){return{types:or(this,Ro,"f"),extensions:or(this,tc,"f")}}}Ro=new WeakMap,tc=new WeakMap,Os=new WeakMap;const QA=new KA(bE)._freeze();function EE(t){const e=[],n=Object.keys(t);for(const r of n){const i=t[r].sort((o,a)=>o.index-a.index);let s=-1;for(let o=0;o<i.length;o++)s=s+1+i[o].skip,i[o].index!==s&&e.push({message:`Invalid operation index ${i[o].index} at position ${o}`,details:{position:o,operation:i[o],scope:i[o].scope}})}return e}var SE=(t=>(t.UNEXPECTED_INDEX="UNEXPECTED_INDEX",t))(SE||{}),wE=(t=>(t.DUPLICATED_INDEX="DUPLICATED_INDEX",t.MISSING_INDEX="MISSING_INDEX",t))(wE||{});function dm(t){const e=[];let n=-1;for(const r of t){const i=r.index-r.skip;i!==n+1&&e.push({operation:{index:r.index,skip:r.skip},issue:"UNEXPECTED_INDEX",category:i>n+1?"MISSING_INDEX":"DUPLICATED_INDEX",message:`Expected index ${n+1} with skip 0 or equivalent, got index ${r.index} with skip ${r.skip}`}),n=r.index}return e}function Dr(t){var e,n,r;const i=[];let s=t.length-1;for(;s>-1;){i.unshift(t[s]);const o=(((e=t[s])==null?void 0:e.index)||0)-(((n=t[s])==null?void 0:n.skip)||0)-1;let a=s-1;for(;a>-1&&(((r=t[a])==null?void 0:r.index)||0)>o;)a--;s=a}return i}function eC(t){const e=[...t],n=e[e.length-1];return n&&(n.type==="NOOP"?e.push({...n,index:n.index,type:"NOOP",skip:pm(t)}):e.push({type:"NOOP",index:n.index+1,timestamp:new Date().toISOString(),input:{},skip:1,scope:n.scope,hash:n.hash})),e}function ur(t){return t.slice().sort((e,n)=>e.skip-n.skip).sort((e,n)=>e.index-n.index)}const tC=(t,e,n)=>[...e,...n].sort((r,i)=>new Date(r.timestamp).getTime()-new Date(i.timestamp).getTime()).map((r,i)=>({...r,index:t.index+i,skip:i===0?t.skip:0})),nC=(t,e,n)=>[...e,...n].sort((r,i)=>new Date(r.timestamp).getTime()-new Date(i.timestamp).getTime()).sort((r,i)=>r.index-i.index).map((r,i)=>({...r,index:t.index+i,skip:i===0?t.skip:0}));function fm(t,e){return Ys(t)===Ys(e)}function rC(t,e){const n=Dr(ur(t.slice())),r=Dr(ur(e.slice()));if(n.length<1)return[r,[]];const i=[];let s=!1;for(;r.length>0;){const o=r[0];let a=n.shift();for(;a&&TE(a,o);)i.push(a),a=n.shift();if(a?s||(fm(a,o)?(r.shift(),i.push(a)):(n.unshift(a),s=!0)):s=!0,s){let c=r.shift();for(;c;)i.push(c),c=r.shift()}}if(!s){let o=n.shift();for(;o;)i.push(o),o=n.shift()}return[Dr(i),n]}function TE(t,e){return t.index<e.index||t.index===e.index&&t.id===e.id&&t.skip<e.skip}function IE(t,e){const n=[],r=[],i=[],s=Math.max(t.length,e.length);let o=!1;for(let a=0;a<s;a++){const c=t[a],l=e[a];c&&l?!o&&fm(c,l)?n.push(c):(o=!0,r.push(c),i.push(l)):c?r.push(c):l&&i.push(l)}return[n,r,i]}function iC(t,e,n){const[r,i,s]=IE(Dr(t),Dr(e)),o=Kf(r),a=1+Math.max(o,Kf(i),Kf(s)),c=OE(s,i),l=n({index:a,skip:a-(o+1)},i,c);return r.concat(l)}function Kf(t){const e=t[t.length-1];return e?e.index:-1}function pm(t){var e,n,r;if(t.length<1)return-1;const i=Dr(t);let s=(((e=i[i.length-1])==null?void 0:e.skip)||0)+1;return i.length>1&&(s+=((n=i[i.length-2])==null?void 0:n.skip)||0),(((r=i[i.length-1])==null?void 0:r.index)||-1)<s?-1:s}const sC=t=>dm(Dr(ur(t))),oC=t=>t.reduce((n,r)=>{var i;return n[r.scope]||(n[r.scope]=[]),(i=n[r.scope])==null||i.push(r),n},{}),aC=(t,e)=>{var n;const r={integrityIssues:[],validOperations:[],invalidOperations:[],duplicatedOperations:[]},i=ur(t),s=ur(e),o=dm([...i,...s]),c=(n=[...o.filter(l=>l.category==="MISSING_INDEX")].sort((l,u)=>u.operation.index-l.operation.index).pop())==null?void 0:n.operation;for(const l of s){if(c&&l.index>=c.index){r.invalidOperations.push(l);continue}if(o.some(d=>d.operation.index===l.index&&d.operation.skip===l.skip&&d.category==="DUPLICATED_INDEX")){r.duplicatedOperations.push(l);continue}r.validOperations.push(l)}return r.integrityIssues.push(...o),r};function cC(t,e){return t.filter(n=>!e.some(r=>n.type==="NOOP"&&n.skip===0&&n.index===r.index||n.index===r.index&&n.skip===r.skip&&n.scope===r.scope&&n.hash===r.hash&&n.type===r.type))}function xE(t,e){const[n]=ur(t).slice(-1),r=(n==null?void 0:n.index)??-1,i=r+1,s={...e,index:e.index??i};if(s.index<r)throw new Error(`The skip header operation index must be greater than or equal to ${r}`);return(Dr(ur([...t,s]))||[]).slice(0,-1)}function Vc(t){return{...Object.entries(t).reduce((n,r)=>{const[i,s]=r;return{...n,[i]:Dr(ur(s))}},{})}}function OE(t,e){return t.filter(n=>n.id?!e.some(r=>r.id===n.id):!0)}function DE(t){return t?Object.entries(t).reduce((n,[r,i])=>({...n,[r]:i.map(s=>{const{resultingState:o,...a}=s;return a})}),{}):{}}function RE(t,e){return t.filter(n=>!e.some(r=>n.index===r.index))}const lC=Object.freeze(Object.defineProperty({__proto__:null,IntegrityIssueSubType:wE,IntegrityIssueType:SE,addUndo:eC,attachBranch:rC,checkCleanedOperationsIntegrity:dm,checkOperationsIntegrity:sC,diffOperations:RE,filterDocumentOperationsResultingState:DE,filterDuplicatedOperations:OE,garbageCollect:Dr,garbageCollectDocumentOperations:Vc,groupOperationsByScope:oC,merge:iC,nextSkipNumber:pm,operationsAreEqual:fm,precedes:TE,prepareOperations:aC,removeExistingOperations:cC,reshuffleByTimestamp:tC,reshuffleByTimestampAndIndex:nC,skipHeaderOperations:xE,sortOperations:ur,split:IE},Symbol.toStringTag,{value:"Module"})),hm=async t=>{const e=new Vb,{name:n,revision:r,documentType:i,created:s,lastModified:o}=t,a={name:n,revision:r,documentType:i,created:s,lastModified:o};return e.file("header.json",JSON.stringify(a,null,2)),e.file("state.json",JSON.stringify(t.initialState||{},null,2)),e.file("current-state.json",JSON.stringify(t.state||{},null,2)),e.file("operations.json",JSON.stringify(DE(t.operations),null,2)),t.attachments&&Object.keys(t.attachments).forEach(l=>{const{data:u,...d}=t.attachments[l];e.file(l,u,{base64:!0,createFolders:!0,comment:JSON.stringify(d)})}),e},mm=async(t,e,n,r)=>{await(await hm(t)).generateAsync({type:"uint8array",streamFiles:!0});const s=r??t.name,o=`.${n}.zip`;return HA(e,s.endsWith(o)?s:`${s}${o}`)},kE=async(t,e)=>{const r=await(await hm(t)).generateAsync({type:"blob"}),i=await e.createWritable();await i.write(r),await i.close()},Qu=async(t,e,n)=>{const r=pE();return gm(r,e,n)},gm=async(t,e,n)=>{const r=new Vb;return await r.loadAsync(t),uC(r,e,n)};async function uC(t,e,n){const r=t.file("state.json");if(!r)throw new Error("Initial state not found");const i=await r.async("string"),s=JSON.parse(i),o=t.file("header.json");let a;o&&(a=JSON.parse(await o.async("string")));const c=t.file("operations.json");if(!c)throw new Error("Operations history not found");const l=JSON.parse(await c.async("string")),u=Vc(l),d=EE(u);if(d.length){const p=d.map(h=>h.message);throw new Error(p.join(`
|
|
138
|
-
`))}let f=bm(s,u,e,void 0,a,{},n);return a&&(f={...f,...a}),f}function NE(t){const e=t.replace(/^.*\./,"")||void 0,n=t.replace(/^.*[/\\]/,"")||void 0;return{extension:e,fileName:n}}async function dC(t){const{buffer:e,mimeType:n="application/octet-stream"}=await WA(),r=NE(t),i=e.toString("base64");return{data:i,hash:Il(i),mimeType:n,...r}}async function fC(t){const e=await qA(),n=QA.getType(t)||"application/octet-stream",r=NE(t),i=e.toString("base64");return{data:i,hash:Il(i),mimeType:n,...r}}function pC(t,e){return{...t,name:e}}function hC(t,e,n){const{scope:r,input:i}=e;return om({document:t,action:e,skip:n,reuseLastOperationIndex:!1},o=>{const a=[...t.operations[r]],c=ur(a);o.action=ZE(r);const l=c.at(-1);let u=(l==null?void 0:l.index)??-1;const d=(l==null?void 0:l.type)!=="NOOP";d?u=u+1:o.reuseLastOperationIndex=!0;const f=d?[...c,{index:u,skip:0}]:c;if(o.skip=pm(f),l&&o.skip>l.skip+1&&(o.skip=o.skip+1),o.skip<0)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history")})}function mC(t,e,n){const{scope:r,input:i}=e;return om({document:t,action:e,skip:n,reuseLastOperationIndex:!1},o=>{if(o.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(i>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(i<1)throw new Error("Invalid REDO action: invalid redo input value");if(o.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const a=o.document.clipboard.findLastIndex(l=>l.scope===r);if(a<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const c=o.document.clipboard.splice(a,1)[0];o.action={type:c.type,scope:c.scope,input:c.input}})}function gC(t,e,n){const{scope:r}=e,i=t.operations[r];let{input:{start:s,end:o}}=e;s=s||0,o=o||i.length;const a=i.slice(s,o),c=i.slice(0,s),l=i.slice(o),u=Hc(t.initialState,{...t.operations,[r]:c.concat(a)},n),{name:d,state:f}=u,p=c.length,h=c.length?c[c.length-1].timestamp:l.length?l[0].timestamp:new Date().toISOString();return Hc(t.initialState,{...t.operations,[r]:[...c,{...Em({name:d,state:f},a.length),timestamp:h,index:p,hash:Ol({state:f},"global")},...l.map((m,v)=>({...m,index:p+v+1}))]},n)}function yC(t,e){return{...t,name:e.name,state:e.state??{global:{},local:{}}}}const AE="SET_NAME",co="UNDO",Ea="REDO",xl="PRUNE",CE="LOAD_STATE",vC="NOOP";function _C(t,e){let n;return"index"in e?n={...e}:n=t.operations[e.scope].at(-1),((n==null?void 0:n.index)??-1)+1}function ME(t,e){return{...t,revision:{...t.revision,[e.scope]:_C(t,e)},lastModified:zE(t)}}function bC(t,e,n=0,r=!1){if([co,Ea,xl].includes(e.type))return t;const{scope:i}=e,s=t.operations[i].slice();let o;const a=s.at(-1),c=(a==null?void 0:a.index)??-1;let l=r?c:c+1,u=new Date().toISOString();if("index"in e){if(e.index-n>l)throw new Error(`Missing operations: expected ${l} with skip 0 or equivalent, got index ${e.index} with skip ${n}`);l=e.index,o=e.id,u=e.timestamp}else o="id"in e?e.id:cm();return s.push({...e,id:o,index:l,timestamp:u,hash:"",scope:i,skip:n,error:void 0}),{...t,operations:{...t.operations,[i]:s}}}function LE(t,e,n=0,r=!1){let i=bC(t,e,n,r);return i=ME(i,e),i}function PE(t,e,n){switch(wA().parse(e),e.type){case AE:return pC(t,e.input);case xl:return gC(t,e,n);case CE:return yC(t,e.input.state);default:return t}}function EC(t,e,n){switch(e.type){case co:return hC(t,e,n);case Ea:return mC(t,e,n);default:return{document:t,action:e,skip:n,reuseLastOperationIndex:!1}}}function FE(t,e,n,r,i=!1,s=Vd){const o=e.scope,a=t.operations[o].at(-1);if(!a)return t;const c=Vc({...t.operations,[o]:xE(t.operations[o],a)});let l;const u=c[o].at(-1);if(i&&(u!=null&&u.resultingState))l=s(u.resultingState);else{const{state:d}=Hc(t.initialState,c,n,void 0,void 0,void 0,void 0,{reuseHash:!0,reuseOperationResultingState:i,operationResultingStateParser:s});l=d[o]}return{...t,state:{...t.state,[o]:l},operations:Vc({...t.operations})}}function SC(t,e,n,r=!1,i=Vd){const s=[...t.operations[e]],o=ur(s);o.pop();const a=Vc({...t.operations}),c=[...a[e]],l=RE(Dr(o),c),u=Hc(t.initialState,a,n,void 0,void 0,void 0,void 0,{reuseHash:!0,reuseOperationResultingState:r,operationResultingStateParser:i}),d=ur([...t.clipboard,...l].filter(f=>f.type!=="NOOP")).reverse();return{...u,clipboard:d}}function $E(t,e,n,r,i={}){const{skip:s,ignoreSkipOperations:o=!1,reuseHash:a=!1,reuseOperationResultingState:c=!1,operationResultingStateParser:l}=i;let u={...e},d=s||0,f={...t},p=!1;const h=!o&&(d>0||"index"in u&&u.skip>0);if(jE(u)){const{skip:_,action:T,document:w,reuseLastOperationIndex:E}=EC(t,u,d);u=T,d=_,f=w,p=E}else f={...f,clipboard:[]};if(ra(u)&&(f=PE(f,u,n)),f=LE(f,u,d,p),UE(e))return SC(f,e.scope,n);if(h&&(f=FE(f,u,n,d,c,l)),f=om(f,_=>{try{const T=n(_.state,u,r);T&&lA(()=>{_.state=T})}catch(T){const w=f.operations[u.scope].length-1;_.operations[u.scope][w].error=T.message,_.operations[u.scope][w].skip=0,h&&(_.state={...t.state},_.operations={...t.operations,[u.scope]:[...t.operations[u.scope],{..._.operations[u.scope][w]}]})}}),[co,Ea,xl].includes(u.type))return f;const v=u.scope||"global",y=a&&Object.prototype.hasOwnProperty.call(u,"hash")?u.hash:Ol(f,v),g=f.operations[v].at(-1);return g&&(g.hash=y,c&&(g.resultingState=f.state[v]),!ra(u)&&u.attachments&&u.attachments.forEach(_=>{const{hash:T,...w}=_;f.attachments[T]={...w}})),f}function wC(t,e,n,r,i={}){const{skip:s,ignoreSkipOperations:o=!1,reuseHash:a=!1,reuseOperationResultingState:c=!1,operationResultingStateParser:l}=i,u={...e},d=s||0;let f={...t};const p=!o&&(d>0||"index"in u&&u.skip>0);ra(u)&&(f=PE(f,u,n)),f=LE(f,u,d),p&&(f=FE(f,u,n,d,c,l));try{const y=n(f.state,u,r);y&&(f.state=y)}catch(y){const g=f.operations[u.scope].length-1;f.operations[u.scope][g].error=y.message,f.operations[u.scope][g].skip=0,p&&(f.state={...t.state},f.operations={...t.operations,[u.scope]:[...t.operations[u.scope],{...f.operations[u.scope][g]}]})}if([co,Ea,xl].includes(u.type))return f;const h=u.scope||"global",m=a&&Object.prototype.hasOwnProperty.call(u,"hash")?u.hash:Ol(f,h),v=f.operations[h].at(-1);return v&&(v.hash=m,c&&(v.resultingState=f.state[h]),!ra(u)&&u.attachments&&u.attachments.forEach(y=>{const{hash:g,..._}=y;f.attachments[g]={..._}})),f}function TC(t){return t.type===vC&&t.skip!==void 0&&t.skip>0&&t.hash!==void 0}function jE(t){return[co,Ea].includes(t.type)}function UE(t){return t.type===co}function ra(t){return[AE,co,Ea,xl,CE].includes(t.type)}function Je(t,e,n,r,i="global"){if(!t)throw new Error("Empty action type");if(typeof t!="string")throw new Error(`Invalid action type: ${JSON.stringify(t)}`);const s={type:t,input:e,scope:i};n&&(s.attachments=n);try{r==null||r().parse(s.input)}catch(o){throw o instanceof Hn?new _E(o.issues):new um(o)}return s}function ym(t,e=$E){return(n,r,i,s)=>e(n,r,t,i,s)}function IC(t,e=wC){return(n,r,i,s)=>e(n,r,t,i,s)}const vm=(t,e)=>({name:"",documentType:"",revision:{global:0,local:0},created:new Date().toISOString(),lastModified:new Date().toISOString(),attachments:{},...t,state:(e==null?void 0:e(t==null?void 0:t.state))??(t==null?void 0:t.state)??{global:{},local:{}}}),_m=(t,e)=>{const n=vm(t,e);return{...n,initialState:n,operations:{global:[],local:[]},clipboard:[]}},Ol=(t,e="global")=>Il(Ys(t.state[e]||"")),xC=(t,e=1e3)=>{const n=Math.random()*e;return Il(`${(t??new Date).toISOString()}${n}`)};function nc(t){return Object.freeze(t)}function OC(t,e){const n=[...t];let r=e||0,i=n.length>0?n[n.length-1].index:0;const s=[];for(const o of n.reverse()){if(r>0){const l=i-o.index;r-=l}if(r<0)throw new Error("Invalid operation index, missing operations");const a={ignore:r>0,operation:o},c=o.skip>0?o.skip+1:0;if(c>0&&c>r){const l=c-r;r=r+l}i=o.index,s.push(a)}return s.reverse()}function BE(t){return Object.values(t).flatMap(e=>e).sort((e,n)=>new Date(e.timestamp).getTime()-new Date(n.timestamp).getTime())}function DC(t){return Object.values(t).flatMap(e=>e).sort((e,n)=>new Date(e.operation.timestamp).getTime()-new Date(n.operation.timestamp).getTime())}function zE(t){var e;return((e=BE(t.operations).at(-1))==null?void 0:e.timestamp)||t.initialState.lastModified}function Hc(t,e,n,r,i,s=$E,o={},a){const c=ym(n,s);return bm(t,e,c,r,i,o,a)}function bm(t,e,n,r,i,s={},o){const{checkHashes:a=!0,reuseOperationResultingState:c,operationResultingStateParser:l=Vd}=o||{};let u=t;const d=[],f={global:[],local:[]};if(c)for(const[y,g]of Object.entries(e)){const _=g.findLastIndex(w=>!!w.resultingState);if(_<0){d.push(...g);continue}const T=g[_];try{const w=l(T.resultingState);u={...u,state:{...u.state,[y]:w}},f[y].push(...g.slice(0,_+1)),d.push(...g.slice(_+1))}catch{d.push(...g)}}else d.push(...Object.values(e).flat());const p=_m(u);p.initialState=t,p.operations=f;let h=p;if(d.length)h=d.reduce((y,g)=>n(y,g,r,{skip:g.skip,ignoreSkipOperations:!0,reuseHash:!a}),p);else for(const y of Object.values(f)){const g=y.at(-1);g&&(h=ME(h,g))}if(!a)for(const y of Object.keys(h.state))for(let g=d.length-1;g>=0;g--){const _=d[g];if(_.scope===y){if(_.hash!==Ol(h,y))throw new Error(`Hash mismatch for scope ${y}`);break}}const m=Object.keys(h.operations).reduce((y,g)=>{const _=g;return{...y,[_]:[...h.operations[_].map((T,w)=>{var E;return{...T,timestamp:((E=e[_][w])==null?void 0:E.timestamp)??T.timestamp}})]}},{global:[],local:[]}),v=Object.values(m).reduce((y,g)=>{const _=g.at(-1);return _&&_.timestamp>y&&(y=_.timestamp),y},t.lastModified);return{...h,operations:m,lastModified:v}}function RC(t,e){return Ys(t)===Ys(e)}function Vd(t){const e=typeof t;if(e==="string")return JSON.parse(t);if(e==="object")return t;throw new Error(`Providing resulting state is of type: ${e}`)}const VE=t=>Je("SET_NAME",t,void 0,dE,void 0),HE=(t=1,e="global")=>Je("UNDO",t,void 0,fE,e),WE=(t=1,e="global")=>Je("REDO",t,void 0,uE,e),qE=(t,e,n="global")=>Je("PRUNE",{start:t,end:e},void 0,lE,n),Em=(t,e)=>Je("LOAD_STATE",{state:t,operations:e},void 0,cE),ZE=(t="global")=>Je("NOOP",{},void 0,void 0,t),Sa=Object.freeze(Object.defineProperty({__proto__:null,loadState:Em,noop:ZE,prune:qE,redo:WE,setName:VE,undo:HE},Symbol.toStringTag,{value:"Module"}));var kC=Object.defineProperty,NC=(t,e,n)=>e in t?kC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qf=(t,e,n)=>NC(t,typeof e!="symbol"?e+"":e,n);class Yt{constructor(e,n,r){Qf(this,"_document"),Qf(this,"_reducer"),Qf(this,"_signalDispatch"),this._reducer=e,this._document=n,this._signalDispatch=r}dispatch(e,n){return this._document=this._reducer(this._document,e,this._signalDispatch,n),this}saveToFile(e,n,r){return mm(this._document,e,n,r)}async loadFromFile(e){this._document=await Qu(e,this._reducer)}static async stateFromFile(e,n){return await Qu(e,n)}get state(){return nc(this._document.state)}get operations(){return nc(this._document.operations)}get name(){return this._document.name}get documentType(){return this._document.documentType}get created(){return this._document.created}get lastModified(){return this._document.lastModified}get revision(){return this._document.revision.global}getRevision(e){return this._document.revision[e]}get initialState(){return nc(this._document.initialState)}toDocument(){return nc(this._document)}getAttachment(e){return this._document.attachments[e]}setName(e){return this.dispatch(VE(e)),this}undo(e){return this.dispatch(HE(e)),this}redo(e){return this.dispatch(WE(e)),this}prune(e,n){return this.dispatch(qE(e,n)),this}loadState(e,n){return this.dispatch(Em(e,n)),this}}function wa(t,e){e.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(r=>{Object.defineProperty(t.prototype,r,Object.getOwnPropertyDescriptor(n.prototype,r)||Object.create(null))})})}const Ce=Object.freeze(Object.defineProperty({__proto__:null,InvalidActionInputError:um,InvalidActionInputZodError:_E,ab2hex:gE,buildOperationSignature:vE,buildOperationSignatureMessage:lm,buildOperationSignatureParams:mE,buildSignedOperation:JA,createAction:Je,createDocument:_m,createExtendedState:vm,createReducer:ym,createUnsafeReducer:IC,createZip:hm,documentHelpers:lC,generateId:cm,getDocumentLastModified:zE,getLocalFile:fC,getRemoteFile:dC,getUnixTimestamp:hE,hashDocument:Ol,hashKey:xC,hex2ab:yE,isBaseAction:ra,isNoopOperation:TC,isSameDocument:RC,isUndo:UE,isUndoRedo:jE,loadFromFile:Qu,loadFromInput:gm,mapSkippedOperations:OC,parseResultingState:Vd,readOnly:nc,replayDocument:bm,replayOperations:Hc,saveToFile:mm,saveToFileHandle:kE,sortMappedOperations:DC,sortOperations:BE,validateOperations:EE,verifyOperationSignature:XA},Symbol.toStringTag,{value:"Module"}));var AC=Object.defineProperty,CC=(t,e,n)=>e in t?AC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,MC=(t,e,n)=>CC(t,e+"",n);const LC={id:"powerhouse/account-snapshot",name:"AccountSnapshot",extension:"phas",description:"",author:{name:"powerhouse",website:"https://powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type AccountSnapshotState {
|
|
139
|
-
id: ID!
|
|
140
|
-
ownerId: ID
|
|
141
|
-
ownerType: String
|
|
142
|
-
period: String
|
|
143
|
-
start: String
|
|
144
|
-
end: String
|
|
145
|
-
actualsComparison: [ActualsComparison]
|
|
146
|
-
snapshotAccount: [SnapshotAccount]
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
type ActualsComparison {
|
|
150
|
-
currency: String
|
|
151
|
-
month: String
|
|
152
|
-
reportedActuals: Float
|
|
153
|
-
netExpenses: ActualsComparisonNetExpenses
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
type ActualsComparisonNetExpenses {
|
|
157
|
-
offChainIncluded: ActualsComparisonNetExpensesItem
|
|
158
|
-
onChainOnly: ActualsComparisonNetExpensesItem!
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
type ActualsComparisonNetExpensesItem {
|
|
162
|
-
amount: Float
|
|
163
|
-
difference: Float
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
type SnapshotAccount {
|
|
167
|
-
accountAddress: String
|
|
168
|
-
accountLabel: String
|
|
169
|
-
accountType: String
|
|
170
|
-
groupAccountId: ID
|
|
171
|
-
id: ID!
|
|
172
|
-
offChain: Boolean
|
|
173
|
-
upstreamAccountId: ID
|
|
174
|
-
snapshotAccountBalance: [SnapshotAccountBalance]
|
|
175
|
-
snapshotAccountTransaction: [SnapshotAccountTransaction]
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
type SnapshotAccountBalance {
|
|
179
|
-
id: ID
|
|
180
|
-
includesOffChain: Boolean
|
|
181
|
-
inflow: Float
|
|
182
|
-
initialBalance: Float
|
|
183
|
-
newBalance: Float
|
|
184
|
-
outflow: Float
|
|
185
|
-
token: String
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
type SnapshotAccountTransaction {
|
|
189
|
-
amount: Float
|
|
190
|
-
block: Int
|
|
191
|
-
counterParty: String
|
|
192
|
-
counterPartyName: String
|
|
193
|
-
id: ID!
|
|
194
|
-
timestamp: String
|
|
195
|
-
token: String
|
|
196
|
-
txHash: String
|
|
197
|
-
txLabel: String
|
|
198
|
-
}`,initialValue:'"{\\"id\\":\\"\\",\\"ownerId\\":\\"\\",\\"ownerType\\":\\"\\",\\"period\\":\\"\\",\\"start\\":\\"\\",\\"end\\":\\"\\",\\"actualsComparison\\":[],\\"snapshotAccount\\":[]}"',examples:[]},local:{schema:"type AccountSnapshotLocalState",initialValue:'"{}"',examples:[]}},modules:[{id:"3XqsMczWItdBoiPQ/VyXTNNduxA=",name:"Snapshot",description:"",operations:[{id:"PVeZyYajy8nJe0Y+zRzT+jwSE+Y=",name:"SET_ID",description:"",schema:`input SetIdInput {
|
|
199
|
-
id: ID!
|
|
200
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"AfnDCBOfdGrU+bkibtHuikyJXHY=",name:"SET_OWNER_ID",description:"",schema:`input SetOwnerIdInput {
|
|
201
|
-
ownerId: ID!
|
|
202
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"v3ZXOHRIxLzCaRPU9lYz65Erlnk=",name:"SET_OWNER_TYPE",description:"",schema:`input SetOwnerTypeInput {
|
|
203
|
-
ownerType: String!
|
|
204
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"+ZoYYO2TLmhBnmr03y/lUZ7Pqu0=",name:"SET_PERIOD",description:"",schema:`input SetPeriodInput {
|
|
205
|
-
period: String!
|
|
206
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"XxvmrG51cWoeVFX1qCrH5N7kJwM=",name:"SET_START",description:"",schema:`input SetStartInput {
|
|
207
|
-
start: String!
|
|
208
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"BhYmPnigaKFIA6fASbTvrULfW4U=",name:"SET_END",description:"",schema:`input SetEndInput {
|
|
209
|
-
end: String!
|
|
210
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]};var xt;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(xt||(xt={}));var Hp;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Hp||(Hp={}));const Ne=xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gi=t=>{switch(typeof t){case"undefined":return Ne.undefined;case"string":return Ne.string;case"number":return isNaN(t)?Ne.nan:Ne.number;case"boolean":return Ne.boolean;case"function":return Ne.function;case"bigint":return Ne.bigint;case"symbol":return Ne.symbol;case"object":return Array.isArray(t)?Ne.array:t===null?Ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ne.promise:typeof Map<"u"&&t instanceof Map?Ne.map:typeof Set<"u"&&t instanceof Set?Ne.set:typeof Date<"u"&&t instanceof Date?Ne.date:Ne.object;default:return Ne.unknown}},ye=xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),PC=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");let Rr=class GE extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return i(this),r}static assert(e){if(!(e instanceof GE))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Rr.create=t=>new Rr(t);const ia=(t,e)=>{let n;switch(t.code){case ye.invalid_type:t.received===Ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ye.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,xt.jsonStringifyReplacer)}`;break;case ye.unrecognized_keys:n=`Unrecognized key(s) in object: ${xt.joinValues(t.keys,", ")}`;break;case ye.invalid_union:n="Invalid input";break;case ye.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xt.joinValues(t.options)}`;break;case ye.invalid_enum_value:n=`Invalid enum value. Expected ${xt.joinValues(t.options)}, received '${t.received}'`;break;case ye.invalid_arguments:n="Invalid function arguments";break;case ye.invalid_return_type:n="Invalid function return type";break;case ye.invalid_date:n="Invalid date";break;case ye.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:xt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ye.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ye.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ye.custom:n="Invalid input";break;case ye.invalid_intersection_types:n="Intersection results could not be merged";break;case ye.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ye.not_finite:n="Number must be finite";break;default:n=e.defaultError,xt.assertNever(t)}return{message:n}};let YE=ia;function FC(t){YE=t}function ed(){return YE}const td=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},$C=[];function De(t,e){const n=ed(),r=td({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ia?void 0:ia].filter(i=>!!i)});t.common.issues.push(r)}let Wn=class JE{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return tt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return JE.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return tt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}};const tt=Object.freeze({status:"aborted"}),nd=t=>({status:"dirty",value:t}),$n=t=>({status:"valid",value:t}),Wp=t=>t.status==="aborted",qp=t=>t.status==="dirty",Js=t=>t.status==="valid",Wc=t=>typeof Promise<"u"&&t instanceof Promise;function rd(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function XE(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var Ue;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ue||(Ue={}));var rc,ic;let ni=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Ly=(t,e)=>{if(Js(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Rr(t.common.issues);return this._error=n,this._error}}};function at(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,o)=>{var a,c;const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(a=l??r)!==null&&a!==void 0?a:o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:(c=l??n)!==null&&c!==void 0?c:o.defaultError}},description:i}}let ut=class{get description(){return this._def.description}_getType(e){return gi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:gi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Wn,ctx:{common:e.parent.common,data:e.data,parsedType:gi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Wc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gi(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Ly(i,s)}"~validate"(e){var n,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gi(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:i});return Js(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(n=s==null?void 0:s.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>Js(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gi(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Wc(i)?i:Promise.resolve(i));return Ly(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),a=()=>s.addIssue({code:ye.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Mr({schema:this,typeName:Ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Jr.create(this,this._def)}nullable(){return fs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xs.create(this)}promise(){return aa.create(this,this._def)}or(e){return Kc.create([this,e],this._def)}and(e){return Qc.create(this,e,this._def)}transform(e){return new Mr({...at(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new rl({...at(this._def),innerType:this,defaultValue:n,typeName:Ke.ZodDefault})}brand(){return new Sm({typeName:Ke.ZodBranded,type:this,...at(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new il({...at(this._def),innerType:this,catchValue:n,typeName:Ke.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return wm.create(this,e)}readonly(){return sl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const jC=/^c[^\s-]{8,}$/i,UC=/^[0-9a-z]+$/,BC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,VC=/^[a-z0-9_-]{21}$/i,HC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,WC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ZC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ep;const GC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,YC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,JC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,XC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,KC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,QC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,KE="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",eM=new RegExp(`^${KE}$`);function QE(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function tM(t){return new RegExp(`^${QE(t)}$`)}function eS(t){let e=`${KE}T${QE(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function nM(t,e){return!!((e==="v4"||!e)&&GC.test(t)||(e==="v6"||!e)&&JC.test(t))}function rM(t,e){if(!HC.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function iM(t,e){return!!((e==="v4"||!e)&&YC.test(t)||(e==="v6"||!e)&&XC.test(t))}let sa=class sc extends ut{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ne.string){const i=this._getOrReturnCtx(e);return De(i,{code:ye.invalid_type,expected:Ne.string,received:i.parsedType}),tt}const n=new Wn;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:ye.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:ye.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(r=this._getOrReturnCtx(e,r),s?De(r,{code:ye.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&De(r,{code:ye.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")qC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"email",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")ep||(ep=new RegExp(ZC,"u")),ep.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"emoji",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")zC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"uuid",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")VC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"nanoid",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")jC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")UC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid2",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")BC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ulid",code:ye.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),De(r,{validation:"url",code:ye.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"regex",code:ye.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?eS(i).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?eM.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?tM(i).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:ye.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?WC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"duration",code:ye.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?nM(e.data,i.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ip",code:ye.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?rM(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"jwt",code:ye.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?iM(e.data,i.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cidr",code:ye.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?KC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64",code:ye.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?QC.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64url",code:ye.invalid_string,message:i.message}),n.dirty()):xt.assertNever(i);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:ye.invalid_string,...Ue.errToObj(r)})}_addCheck(e){return new sc({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ue.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ue.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ue.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ue.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ue.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ue.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ue.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ue.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ue.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ue.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ue.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ue.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ue.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Ue.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ue.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ue.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ue.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ue.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ue.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ue.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ue.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ue.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ue.errToObj(n)})}nonempty(e){return this.min(1,Ue.errToObj(e))}trim(){return new sc({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sc({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sc({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};sa.create=t=>{var e;return new sa({checks:[],typeName:Ke.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...at(t)})};function sM(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}let qc=class Zp extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ne.number){const i=this._getOrReturnCtx(e);return De(i,{code:ye.invalid_type,expected:Ne.number,received:i.parsedType}),tt}let n;const r=new Wn;for(const i of this._def.checks)i.kind==="int"?xt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{code:ye.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?sM(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{code:ye.not_finite,message:i.message}),r.dirty()):xt.assertNever(i);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ue.toString(n))}setLimit(e,n,r,i){return new Zp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(e){return new Zp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ue.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ue.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ue.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ue.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ue.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};qc.create=t=>new qc({checks:[],typeName:Ke.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...at(t)});let Zc=class Gp extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ne.bigint)return this._getInvalidInput(e);let n;const r=new Wn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),De(n,{code:ye.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):xt.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.bigint,received:n.parsedType}),tt}gte(e,n){return this.setLimit("min",e,!0,Ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ue.toString(n))}setLimit(e,n,r,i){return new Gp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(e){return new Gp({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ue.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Zc.create=t=>{var e;return new Zc({checks:[],typeName:Ke.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...at(t)})};let Gc=class extends ut{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ne.boolean){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.boolean,received:n.parsedType}),tt}return $n(e.data)}};Gc.create=t=>new Gc({typeName:Ke.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...at(t)});let Yc=class tS extends ut{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ne.date){const i=this._getOrReturnCtx(e);return De(i,{code:ye.invalid_type,expected:Ne.date,received:i.parsedType}),tt}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return De(i,{code:ye.invalid_date}),tt}const n=new Wn;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:ye.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:ye.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):xt.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tS({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ue.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ue.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Yc.create=t=>new Yc({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ke.ZodDate,...at(t)});let id=class extends ut{_parse(e){if(this._getType(e)!==Ne.symbol){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.symbol,received:n.parsedType}),tt}return $n(e.data)}};id.create=t=>new id({typeName:Ke.ZodSymbol,...at(t)});let Jc=class extends ut{_parse(e){if(this._getType(e)!==Ne.undefined){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.undefined,received:n.parsedType}),tt}return $n(e.data)}};Jc.create=t=>new Jc({typeName:Ke.ZodUndefined,...at(t)});let Xc=class extends ut{_parse(e){if(this._getType(e)!==Ne.null){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.null,received:n.parsedType}),tt}return $n(e.data)}};Xc.create=t=>new Xc({typeName:Ke.ZodNull,...at(t)});let oa=class extends ut{constructor(){super(...arguments),this._any=!0}_parse(e){return $n(e.data)}};oa.create=t=>new oa({typeName:Ke.ZodAny,...at(t)});let js=class extends ut{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $n(e.data)}};js.create=t=>new js({typeName:Ke.ZodUnknown,...at(t)});let Ni=class extends ut{_parse(e){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.never,received:n.parsedType}),tt}};Ni.create=t=>new Ni({typeName:Ke.ZodNever,...at(t)});let sd=class extends ut{_parse(e){if(this._getType(e)!==Ne.undefined){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.void,received:n.parsedType}),tt}return $n(e.data)}};sd.create=t=>new sd({typeName:Ke.ZodVoid,...at(t)});let Xs=class Iu extends ut{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ne.array)return De(n,{code:ye.invalid_type,expected:Ne.array,received:n.parsedType}),tt;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(De(n,{code:o?ye.too_big:ye.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(De(n,{code:ye.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(De(n,{code:ye.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new ni(n,o,n.path,a)))).then(o=>Wn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new ni(n,o,n.path,a)));return Wn.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Iu({...this._def,minLength:{value:e,message:Ue.toString(n)}})}max(e,n){return new Iu({...this._def,maxLength:{value:e,message:Ue.toString(n)}})}length(e,n){return new Iu({...this._def,exactLength:{value:e,message:Ue.toString(n)}})}nonempty(e){return this.min(1,e)}};Xs.create=(t,e)=>new Xs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...at(e)});function ko(t){if(t instanceof dr){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Jr.create(ko(r))}return new dr({...t._def,shape:()=>e})}else return t instanceof Xs?new Xs({...t._def,type:ko(t.element)}):t instanceof Jr?Jr.create(ko(t.unwrap())):t instanceof fs?fs.create(ko(t.unwrap())):t instanceof ds?ds.create(t.items.map(e=>ko(e))):t}let dr=class yr extends ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=xt.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ne.object){const c=this._getOrReturnCtx(e);return De(c,{code:ye.invalid_type,expected:Ne.object,received:c.parsedType}),tt}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ni&&this._def.unknownKeys==="strip"))for(const c in r.data)s.includes(c)||o.push(c);const a=[];for(const c of s){const l=i[c],u=r.data[c];a.push({key:{status:"valid",value:c},value:l._parse(new ni(r,u,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Ni){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of o)a.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict")o.length>0&&(De(r,{code:ye.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of o){const u=r.data[l];a.push({key:{status:"valid",value:l},value:c._parse(new ni(r,u,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of a){const u=await l.key,d=await l.value;c.push({key:u,value:d,alwaysSet:l.alwaysSet})}return c}).then(c=>Wn.mergeObjectSync(n,c)):Wn.mergeObjectSync(n,a)}get shape(){return this._def.shape()}strict(e){return Ue.errToObj,new yr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,s,o,a;const c=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=Ue.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new yr({...this._def,unknownKeys:"strip"})}passthrough(){return new yr({...this._def,unknownKeys:"passthrough"})}extend(e){return new yr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ke.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new yr({...this._def,catchall:e})}pick(e){const n={};return xt.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new yr({...this._def,shape:()=>n})}omit(e){const n={};return xt.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new yr({...this._def,shape:()=>n})}deepPartial(){return ko(this)}partial(e){const n={};return xt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new yr({...this._def,shape:()=>n})}required(e){const n={};return xt.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Jr;)i=i._def.innerType;n[r]=i}}),new yr({...this._def,shape:()=>n})}keyof(){return aS(xt.objectKeys(this.shape))}};dr.create=(t,e)=>new dr({shape:()=>t,unknownKeys:"strip",catchall:Ni.create(),typeName:Ke.ZodObject,...at(e)});dr.strictCreate=(t,e)=>new dr({shape:()=>t,unknownKeys:"strict",catchall:Ni.create(),typeName:Ke.ZodObject,...at(e)});dr.lazycreate=(t,e)=>new dr({shape:t,unknownKeys:"strip",catchall:Ni.create(),typeName:Ke.ZodObject,...at(e)});let Kc=class extends ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Rr(a.ctx.common.issues));return De(n,{code:ye.invalid_union,unionErrors:o}),tt}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const c of r){const l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(c=>new Rr(c));return De(n,{code:ye.invalid_union,unionErrors:a}),tt}}get options(){return this._def.options}};Kc.create=(t,e)=>new Kc({options:t,typeName:Ke.ZodUnion,...at(e)});const Hi=t=>t instanceof el?Hi(t.schema):t instanceof Mr?Hi(t.innerType()):t instanceof tl?[t.value]:t instanceof Dl?t.options:t instanceof nl?xt.objectValues(t.enum):t instanceof rl?Hi(t._def.innerType):t instanceof Jc?[void 0]:t instanceof Xc?[null]:t instanceof Jr?[void 0,...Hi(t.unwrap())]:t instanceof fs?[null,...Hi(t.unwrap())]:t instanceof Sm||t instanceof sl?Hi(t.unwrap()):t instanceof il?Hi(t._def.innerType):[];let nS=class rS extends ut{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ne.object)return De(n,{code:ye.invalid_type,expected:Ne.object,received:n.parsedType}),tt;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(De(n,{code:ye.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const s of n){const o=Hi(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new rS({typeName:Ke.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...at(r)})}};function Yp(t,e){const n=gi(t),r=gi(e);if(t===e)return{valid:!0,data:t};if(n===Ne.object&&r===Ne.object){const i=xt.objectKeys(e),s=xt.objectKeys(t).filter(a=>i.indexOf(a)!==-1),o={...t,...e};for(const a of s){const c=Yp(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===Ne.array&&r===Ne.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],a=e[s],c=Yp(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===Ne.date&&r===Ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let Qc=class extends ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(Wp(s)||Wp(o))return tt;const a=Yp(s.value,o.value);return a.valid?((qp(s)||qp(o))&&n.dirty(),{status:n.value,value:a.data}):(De(r,{code:ye.invalid_intersection_types}),tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Qc.create=(t,e,n)=>new Qc({left:t,right:e,typeName:Ke.ZodIntersection,...at(n)});let ds=class iS extends ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.array)return De(r,{code:ye.invalid_type,expected:Ne.array,received:r.parsedType}),tt;if(r.data.length<this._def.items.length)return De(r,{code:ye.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tt;!this._def.rest&&r.data.length>this._def.items.length&&(De(r,{code:ye.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,o)=>{const a=this._def.items[o]||this._def.rest;return a?a._parse(new ni(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Wn.mergeArray(n,s)):Wn.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new iS({...this._def,rest:e})}};ds.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ds({items:t,typeName:Ke.ZodTuple,rest:null,...at(e)})};let sS=class Jp extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.object)return De(r,{code:ye.invalid_type,expected:Ne.object,received:r.parsedType}),tt;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new ni(r,a,r.path,a)),value:o._parse(new ni(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Wn.mergeObjectAsync(n,i):Wn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ut?new Jp({keyType:e,valueType:n,typeName:Ke.ZodRecord,...at(r)}):new Jp({keyType:sa.create(),valueType:e,typeName:Ke.ZodRecord,...at(n)})}},od=class extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.map)return De(r,{code:ye.invalid_type,expected:Ne.map,received:r.parsedType}),tt;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:i._parse(new ni(r,a,r.path,[l,"key"])),value:s._parse(new ni(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return tt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return tt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}}}};od.create=(t,e,n)=>new od({valueType:e,keyType:t,typeName:Ke.ZodMap,...at(n)});let ad=class Xp extends ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ne.set)return De(r,{code:ye.invalid_type,expected:Ne.set,received:r.parsedType}),tt;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(De(r,{code:ye.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(De(r,{code:ye.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(c){const l=new Set;for(const u of c){if(u.status==="aborted")return tt;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}const a=[...r.data.values()].map((c,l)=>s._parse(new ni(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new Xp({...this._def,minSize:{value:e,message:Ue.toString(n)}})}max(e,n){return new Xp({...this._def,maxSize:{value:e,message:Ue.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};ad.create=(t,e)=>new ad({valueType:t,minSize:null,maxSize:null,typeName:Ke.ZodSet,...at(e)});let oS=class xu extends ut{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ne.function)return De(n,{code:ye.invalid_type,expected:Ne.function,received:n.parsedType}),tt;function r(a,c){return td({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ed(),ia].filter(l=>!!l),issueData:{code:ye.invalid_arguments,argumentsError:c}})}function i(a,c){return td({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ed(),ia].filter(l=>!!l),issueData:{code:ye.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof aa){const a=this;return $n(async function(...c){const l=new Rr([]),u=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(i(d,f)),l})})}else{const a=this;return $n(function(...c){const l=a._def.args.safeParse(c,s);if(!l.success)throw new Rr([r(c,l.error)]);const u=Reflect.apply(o,this,l.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new Rr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new xu({...this._def,args:ds.create(e).rest(js.create())})}returns(e){return new xu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new xu({args:e||ds.create([]).rest(js.create()),returns:n||js.create(),typeName:Ke.ZodFunction,...at(r)})}},el=class extends ut{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};el.create=(t,e)=>new el({getter:t,typeName:Ke.ZodLazy,...at(e)});let tl=class extends ut{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return De(n,{received:n.data,code:ye.invalid_literal,expected:this._def.value}),tt}return{status:"valid",value:e.data}}get value(){return this._def.value}};tl.create=(t,e)=>new tl({value:t,typeName:Ke.ZodLiteral,...at(e)});function aS(t,e){return new Dl({values:t,typeName:Ke.ZodEnum,...at(e)})}let Dl=class Kp extends ut{constructor(){super(...arguments),rc.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return De(n,{expected:xt.joinValues(r),received:n.parsedType,code:ye.invalid_type}),tt}if(rd(this,rc)||XE(this,rc,new Set(this._def.values)),!rd(this,rc).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return De(n,{received:n.data,code:ye.invalid_enum_value,options:r}),tt}return $n(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Kp.create(e,{...this._def,...n})}exclude(e,n=this._def){return Kp.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};rc=new WeakMap;Dl.create=aS;let nl=class extends ut{constructor(){super(...arguments),ic.set(this,void 0)}_parse(e){const n=xt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ne.string&&r.parsedType!==Ne.number){const i=xt.objectValues(n);return De(r,{expected:xt.joinValues(i),received:r.parsedType,code:ye.invalid_type}),tt}if(rd(this,ic)||XE(this,ic,new Set(xt.getValidEnumValues(this._def.values))),!rd(this,ic).has(e.data)){const i=xt.objectValues(n);return De(r,{received:r.data,code:ye.invalid_enum_value,options:i}),tt}return $n(e.data)}get enum(){return this._def.values}};ic=new WeakMap;nl.create=(t,e)=>new nl({values:t,typeName:Ke.ZodNativeEnum,...at(e)});let aa=class extends ut{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ne.promise&&n.common.async===!1)return De(n,{code:ye.invalid_type,expected:Ne.promise,received:n.parsedType}),tt;const r=n.parsedType===Ne.promise?n.data:Promise.resolve(n.data);return $n(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};aa.create=(t,e)=>new aa({type:t,typeName:Ke.ZodPromise,...at(e)});let Mr=class extends ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{De(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return tt;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?tt:c.status==="dirty"||n.value==="dirty"?nd(c.value):c});{if(n.value==="aborted")return tt;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?tt:a.status==="dirty"||n.value==="dirty"?nd(a.value):a}}if(i.type==="refinement"){const o=a=>{const c=i.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?tt:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?tt:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Js(o))return o;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Js(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):o);xt.assertNever(i)}};Mr.create=(t,e,n)=>new Mr({schema:t,typeName:Ke.ZodEffects,effect:e,...at(n)});Mr.createWithPreprocess=(t,e,n)=>new Mr({schema:e,effect:{type:"preprocess",transform:t},typeName:Ke.ZodEffects,...at(n)});let Jr=class extends ut{_parse(e){return this._getType(e)===Ne.undefined?$n(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jr.create=(t,e)=>new Jr({innerType:t,typeName:Ke.ZodOptional,...at(e)});let fs=class extends ut{_parse(e){return this._getType(e)===Ne.null?$n(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fs.create=(t,e)=>new fs({innerType:t,typeName:Ke.ZodNullable,...at(e)});let rl=class extends ut{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};rl.create=(t,e)=>new rl({innerType:t,typeName:Ke.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...at(e)});let il=class extends ut{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Wc(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Rr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Rr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};il.create=(t,e)=>new il({innerType:t,typeName:Ke.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...at(e)});let cd=class extends ut{_parse(e){if(this._getType(e)!==Ne.nan){const n=this._getOrReturnCtx(e);return De(n,{code:ye.invalid_type,expected:Ne.nan,received:n.parsedType}),tt}return{status:"valid",value:e.data}}};cd.create=t=>new cd({typeName:Ke.ZodNaN,...at(t)});const oM=Symbol("zod_brand");let Sm=class extends ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},wm=class cS extends ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?tt:i.status==="dirty"?(n.dirty(),nd(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?tt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new cS({in:e,out:n,typeName:Ke.ZodPipeline})}},sl=class extends ut{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Js(i)&&(i.value=Object.freeze(i.value)),i);return Wc(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};sl.create=(t,e)=>new sl({innerType:t,typeName:Ke.ZodReadonly,...at(e)});function lS(t,e={},n){return t?oa.create().superRefine((r,i)=>{var s,o;if(!t(r)){const a=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(o=(s=a.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0,l=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...l,fatal:c})}}):oa.create()}const aM={object:dr.lazycreate};var Ke;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ke||(Ke={}));const cM=(t,e={message:`Input not instance of ${t.name}`})=>lS(n=>n instanceof t,e),uS=sa.create,dS=qc.create,lM=cd.create,uM=Zc.create,fS=Gc.create,dM=Yc.create,fM=id.create,pM=Jc.create,hM=Xc.create,mM=oa.create,gM=js.create,yM=Ni.create,vM=sd.create,_M=Xs.create,bM=dr.create,EM=dr.strictCreate,SM=Kc.create,wM=nS.create,TM=Qc.create,IM=ds.create,xM=sS.create,OM=od.create,DM=ad.create,RM=oS.create,kM=el.create,NM=tl.create,AM=Dl.create,CM=nl.create,MM=aa.create,Py=Mr.create,LM=Jr.create,PM=fs.create,FM=Mr.createWithPreprocess,$M=wm.create,jM=()=>uS().optional(),UM=()=>dS().optional(),BM=()=>fS().optional(),zM={string:t=>sa.create({...t,coerce:!0}),number:t=>qc.create({...t,coerce:!0}),boolean:t=>Gc.create({...t,coerce:!0}),bigint:t=>Zc.create({...t,coerce:!0}),date:t=>Yc.create({...t,coerce:!0})},VM=tt;var D=Object.freeze({__proto__:null,defaultErrorMap:ia,setErrorMap:FC,getErrorMap:ed,makeIssue:td,EMPTY_PATH:$C,addIssueToContext:De,ParseStatus:Wn,INVALID:tt,DIRTY:nd,OK:$n,isAborted:Wp,isDirty:qp,isValid:Js,isAsync:Wc,get util(){return xt},get objectUtil(){return Hp},ZodParsedType:Ne,getParsedType:gi,ZodType:ut,datetimeRegex:eS,ZodString:sa,ZodNumber:qc,ZodBigInt:Zc,ZodBoolean:Gc,ZodDate:Yc,ZodSymbol:id,ZodUndefined:Jc,ZodNull:Xc,ZodAny:oa,ZodUnknown:js,ZodNever:Ni,ZodVoid:sd,ZodArray:Xs,ZodObject:dr,ZodUnion:Kc,ZodDiscriminatedUnion:nS,ZodIntersection:Qc,ZodTuple:ds,ZodRecord:sS,ZodMap:od,ZodSet:ad,ZodFunction:oS,ZodLazy:el,ZodLiteral:tl,ZodEnum:Dl,ZodNativeEnum:nl,ZodPromise:aa,ZodEffects:Mr,ZodTransformer:Mr,ZodOptional:Jr,ZodNullable:fs,ZodDefault:rl,ZodCatch:il,ZodNaN:cd,BRAND:oM,ZodBranded:Sm,ZodPipeline:wm,ZodReadonly:sl,custom:lS,Schema:ut,ZodSchema:ut,late:aM,get ZodFirstPartyTypeKind(){return Ke},coerce:zM,any:mM,array:_M,bigint:uM,boolean:fS,date:dM,discriminatedUnion:wM,effect:Py,enum:AM,function:RM,instanceof:cM,intersection:TM,lazy:kM,literal:NM,map:OM,nan:lM,nativeEnum:CM,never:yM,null:hM,nullable:PM,number:dS,object:bM,oboolean:BM,onumber:UM,optional:LM,ostring:jM,pipeline:$M,preprocess:FM,promise:MM,record:xM,set:DM,strictObject:EM,string:uS,symbol:fM,transformer:Py,tuple:IM,undefined:pM,union:SM,unknown:gM,void:vM,NEVER:VM,ZodIssueCode:ye,quotelessJson:PC,ZodError:Rr});const HM=t=>t!=null;D.any().refine(t=>HM(t));function pS(){return D.object({end:D.string()})}function hS(){return D.object({id:D.string()})}function mS(){return D.object({ownerId:D.string()})}function gS(){return D.object({ownerType:D.string()})}function yS(){return D.object({period:D.string()})}function vS(){return D.object({start:D.string()})}const bo={setIdOperation(t,e){t.id=e.input.id},setOwnerIdOperation(t,e){t.ownerId=e.input.ownerId},setOwnerTypeOperation(t,e){t.ownerType=e.input.ownerType},setPeriodOperation(t,e){t.period=e.input.period},setStartOperation(t,e){t.start=e.input.start},setEndOperation(t,e){t.end=e.input.end}},WM=(t,e,n)=>{if(Ce.isBaseAction(e))return t;switch(e.type){case"SET_ID":hS().parse(e.input),bo.setIdOperation(t[e.scope],e,n);break;case"SET_OWNER_ID":mS().parse(e.input),bo.setOwnerIdOperation(t[e.scope],e,n);break;case"SET_OWNER_TYPE":gS().parse(e.input),bo.setOwnerTypeOperation(t[e.scope],e,n);break;case"SET_PERIOD":yS().parse(e.input),bo.setPeriodOperation(t[e.scope],e,n);break;case"SET_START":vS().parse(e.input),bo.setStartOperation(t[e.scope],e,n);break;case"SET_END":pS().parse(e.input),bo.setEndOperation(t[e.scope],e,n);break;default:return t}},ld=Ce.createReducer(WM),qM={id:"",ownerId:"",ownerType:"",period:"",start:"",end:"",actualsComparison:[],snapshotAccount:[]},ZM={},pc={fileExtension:"phas",createState(t){return{global:{...qM,...t==null?void 0:t.global},local:{...ZM,...t==null?void 0:t.local}}},createExtendedState(t){return Ce.createExtendedState({...t,documentType:"powerhouse/account-snapshot"},pc.createState)},createDocument(t){return Ce.createDocument(pc.createExtendedState(t),pc.createState)},saveToFile(t,e,n){return Ce.saveToFile(t,e,"phas",n)},saveToFileHandle(t,e){return Ce.saveToFileHandle(t,e)},loadFromFile(t){return Ce.loadFromFile(t,ld)},loadFromInput(t){return Ce.loadFromInput(t,ld)}},{createAction:Ta}=Ce,_S=t=>Ta("SET_ID",{...t},void 0,hS,"global"),bS=t=>Ta("SET_OWNER_ID",{...t},void 0,mS,"global"),ES=t=>Ta("SET_OWNER_TYPE",{...t},void 0,gS,"global"),SS=t=>Ta("SET_PERIOD",{...t},void 0,yS,"global"),wS=t=>Ta("SET_START",{...t},void 0,vS,"global"),TS=t=>Ta("SET_END",{...t},void 0,pS,"global");class GM extends Yt{setId(e){return this.dispatch(_S(e))}setOwnerId(e){return this.dispatch(bS(e))}setOwnerType(e){return this.dispatch(ES(e))}setPeriod(e){return this.dispatch(SS(e))}setStart(e){return this.dispatch(wS(e))}setEnd(e){return this.dispatch(TS(e))}}const IS=class xS extends Yt{constructor(e,n){super(ld,pc.createDocument(e),n)}saveToFile(e,n){return super.saveToFile(e,xS.fileExtension,n)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const n=new this;return await n.loadFromFile(e),n}};MC(IS,"fileExtension","phas");let OS=IS;wa(OS,[GM]);const YM=Object.freeze(Object.defineProperty({__proto__:null,setEnd:TS,setId:_S,setOwnerId:bS,setOwnerType:ES,setPeriod:SS,setStart:wS},Symbol.toStringTag,{value:"Module"})),JM=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),XM=OS,KM={...pc,...JM},QM={...Sa,...YM},eL={Document:XM,reducer:ld,actions:QM,utils:KM,documentModel:LC};var tL=Object.defineProperty,nL=(t,e,n)=>e in t?tL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rL=(t,e,n)=>nL(t,e+"",n);const Hd={id:"powerhouse/document-drive",name:"DocumentDrive",extension:"phdd",description:"",author:{name:"Powerhouse Inc",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type FolderNode {
|
|
211
|
-
id: String!
|
|
212
|
-
name: String!
|
|
213
|
-
kind: String!
|
|
214
|
-
parentFolder: String
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
type SynchronizationUnit {
|
|
218
|
-
syncId: ID!
|
|
219
|
-
scope: String!
|
|
220
|
-
branch: String!
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
type FileNode {
|
|
224
|
-
id: String!
|
|
225
|
-
name: String!
|
|
226
|
-
kind: String!
|
|
227
|
-
documentType: String!
|
|
228
|
-
parentFolder: String
|
|
229
|
-
synchronizationUnits: [SynchronizationUnit!]!
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
union Node = FolderNode | FileNode
|
|
233
|
-
|
|
234
|
-
type DocumentDriveState {
|
|
235
|
-
id: ID!
|
|
236
|
-
name: String!
|
|
237
|
-
nodes: [Node!]!
|
|
238
|
-
icon: String
|
|
239
|
-
slug: String
|
|
240
|
-
}`,initialValue:'"{\\"id\\":\\"\\",\\"name\\":\\"\\",\\"nodes\\":[],\\"icon\\":null,\\"slug\\":null}"',examples:[]},local:{schema:`type ListenerFilter {
|
|
241
|
-
documentType: [String!]!
|
|
242
|
-
documentId: [ID!]
|
|
243
|
-
scope: [String!]
|
|
244
|
-
branch: [String!]
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
enum TransmitterType {
|
|
248
|
-
Internal,
|
|
249
|
-
SwitchboardPush,
|
|
250
|
-
PullResponder,
|
|
251
|
-
SecureConnect,
|
|
252
|
-
MatrixConnect,
|
|
253
|
-
RESTWebhook
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
type ListenerCallInfo {
|
|
257
|
-
transmitterType: TransmitterType
|
|
258
|
-
name: String
|
|
259
|
-
data: String
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
type Listener {
|
|
263
|
-
listenerId: ID!
|
|
264
|
-
label: String
|
|
265
|
-
block: Boolean!
|
|
266
|
-
system: Boolean!
|
|
267
|
-
filter: ListenerFilter!
|
|
268
|
-
callInfo: ListenerCallInfo
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
enum TriggerType {
|
|
272
|
-
PullResponder
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
type PullResponderTriggerData {
|
|
276
|
-
listenerId: ID!
|
|
277
|
-
url: String!
|
|
278
|
-
interval: String!
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
union TriggerData = PullResponderTriggerData
|
|
282
|
-
|
|
283
|
-
type Trigger {
|
|
284
|
-
id: ID!
|
|
285
|
-
type: TriggerType!
|
|
286
|
-
data: TriggerData
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
type DocumentDriveLocalState{
|
|
290
|
-
sharingType: String
|
|
291
|
-
listeners: [Listener!]!
|
|
292
|
-
triggers: [Trigger!]!
|
|
293
|
-
availableOffline: Boolean!
|
|
294
|
-
}`,initialValue:'"{ \\"listeners\\": [], \\"triggers\\": [], \\"sharingType\\": \\"private\\", \\"availableOffline\\": false}"',examples:[]}},modules:[{id:"GRzuvv78tBvmB6ciitokLfonNHA=",name:"Node",description:"",operations:[{id:"7xiTdxonc9yEASR8sfV/KnbSV10=",name:"ADD_FILE",description:"",schema:`input AddFileInput {
|
|
295
|
-
id: ID!
|
|
296
|
-
name: String!
|
|
297
|
-
documentType: String!
|
|
298
|
-
parentFolder: ID
|
|
299
|
-
synchronizationUnits: [SynchronizationUnit!]!
|
|
300
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"4lzNMMKKdIAtEU6i12xLgi9hp+U=",name:"ADD_FOLDER",description:"",schema:`input AddFolderInput {
|
|
301
|
-
id: ID!
|
|
302
|
-
name: String!
|
|
303
|
-
parentFolder: ID
|
|
304
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"53jH2/3TWTTcgCJiv2C+BmuC6i0=",name:"DELETE_NODE",description:"",schema:`input DeleteNodeInput {
|
|
305
|
-
id: ID!
|
|
306
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"pNn+Y1/HVq/GNMk7t0u3g3gtMLE=",name:"UPDATE_FILE",description:"",schema:`input UpdateFileInput {
|
|
307
|
-
id: ID!
|
|
308
|
-
parentFolder: ID
|
|
309
|
-
name: String
|
|
310
|
-
documentType: String
|
|
311
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"P0x1M8Mnt+Q/+9nggkwgVbfybsc=",name:"UPDATE_NODE",description:"",schema:`input UpdateNodeInput {
|
|
312
|
-
id: ID!
|
|
313
|
-
parentFolder: ID
|
|
314
|
-
name: String
|
|
315
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"vnQ7OB5b3wGLgjhbgJqAIpA+JLE=",name:"COPY_NODE",description:"",schema:`input CopyNodeInput {
|
|
316
|
-
srcId: ID!
|
|
317
|
-
targetId: ID!
|
|
318
|
-
targetName: String
|
|
319
|
-
targetParentFolder: ID
|
|
320
|
-
synchronizationUnits: [SynchronizationUnit!]
|
|
321
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"VNyiD/sNGzk6k9A1Qe7s8dmrJxA=",name:"MOVE_NODE",description:"",schema:`input MoveNodeInput {
|
|
322
|
-
srcFolder: ID!
|
|
323
|
-
targetParentFolder: ID
|
|
324
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]},{id:"0dHwHlxOM9x0vMZ+gLnKxf2qTEo=",name:"Drive",description:"",operations:[{id:"qGCiPGpTt/cyz3HzyrBn92z1dsU=",name:"SET_DRIVE_NAME",description:"",schema:`input SetDriveNameInput {
|
|
325
|
-
name: String!
|
|
326
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"qGCiPGpTt/cyz3HzyrBn92z30dsU=",name:"SET_DRIVE_ICON",description:"",schema:`input SetDriveIconInput {
|
|
327
|
-
icon: String!
|
|
328
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"qGCiPGpTt/cyz3HzyrBn92z2dsU=",name:"SET_SHARING_TYPE",description:"",schema:`input SetSharingTypeInput {
|
|
329
|
-
type: String!
|
|
330
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z3dsU=",name:"SET_AVAILABLE_OFFLINE",description:"",schema:`input SetAvailableOfflineInput {
|
|
331
|
-
availableOffline: Boolean!
|
|
332
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z9dsU=",name:"ADD_LISTENER",description:"",schema:`input AddListenerInput {
|
|
333
|
-
listener: Listener!
|
|
334
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z10dsU=",name:"REMOVE_LISTENER",description:"",schema:`input RemoveListenerInput {
|
|
335
|
-
listenerId: String!
|
|
336
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z20dsU=",name:"ADD_TRIGGER",description:"",schema:`input AddTriggerInput {
|
|
337
|
-
trigger: Trigger!
|
|
338
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z30dsU=",name:"REMOVE_TRIGGER",description:"",schema:`input RemoveTriggerInput {
|
|
339
|
-
triggerId: String!
|
|
340
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"}]}]}]},DS=t=>t!=null,iL=D.any().refine(t=>DS(t)),RS=D.enum(["Internal","MatrixConnect","PullResponder","RESTWebhook","SecureConnect","SwitchboardPush"]),kS=D.enum(["PullResponder"]);function Tm(){return D.object({document:D.unknown().nullish(),documentType:D.string(),id:D.string(),name:D.string(),parentFolder:D.string().nullish(),synchronizationUnits:D.array(Wd())})}function Im(){return D.object({id:D.string(),name:D.string(),parentFolder:D.string().nullish()})}function xm(){return D.object({listener:km()})}function Om(){return D.object({trigger:$m()})}function Dm(){return D.object({srcId:D.string(),synchronizationUnits:D.array(Wd()).nullish(),targetId:D.string(),targetName:D.string().nullish(),targetParentFolder:D.string().nullish()})}function Rm(){return D.object({id:D.string()})}function sL(){return D.object({__typename:D.literal("DocumentDriveLocalState").optional(),availableOffline:D.boolean(),listeners:D.array(km()),sharingType:D.string().nullable(),triggers:D.array($m())})}function oL(){return D.object({__typename:D.literal("DocumentDriveState").optional(),icon:D.string().nullable(),id:D.string(),name:D.string(),nodes:D.array(LS()),slug:D.string().nullable()})}function NS(){return D.object({__typename:D.literal("FileNode").optional(),documentType:D.string(),id:D.string(),kind:D.string(),name:D.string(),parentFolder:D.string().nullable(),synchronizationUnits:D.array(Wd())})}function AS(){return D.object({__typename:D.literal("FolderNode").optional(),id:D.string(),kind:D.string(),name:D.string(),parentFolder:D.string().nullable()})}function km(){return D.object({__typename:D.literal("Listener").optional(),block:D.boolean(),callInfo:CS().nullable(),filter:MS(),label:D.string().nullable(),listenerId:D.string(),system:D.boolean()})}function CS(){return D.object({__typename:D.literal("ListenerCallInfo").optional(),data:D.string().nullable(),name:D.string().nullable(),transmitterType:RS.nullable()})}function MS(){return D.object({__typename:D.literal("ListenerFilter").optional(),branch:D.array(D.string()).nullable(),documentId:D.array(D.string()).nullable(),documentType:D.array(D.string()),scope:D.array(D.string()).nullable()})}function Nm(){return D.object({srcFolder:D.string(),targetParentFolder:D.string().nullish()})}function LS(){return D.union([NS(),AS()])}function PS(){return D.object({__typename:D.literal("PullResponderTriggerData").optional(),interval:D.string(),listenerId:D.string(),url:D.string()})}function Am(){return D.object({listenerId:D.string()})}function Cm(){return D.object({triggerId:D.string()})}function Mm(){return D.object({availableOffline:D.boolean()})}function Lm(){return D.object({icon:D.string()})}function Pm(){return D.object({name:D.string()})}function Fm(){return D.object({type:D.string()})}function Wd(){return D.object({__typename:D.literal("SynchronizationUnit").optional(),branch:D.string(),scope:D.string(),syncId:D.string()})}function $m(){return D.object({__typename:D.literal("Trigger").optional(),data:FS().nullable(),id:D.string(),type:kS})}function FS(){return PS()}function jm(){return D.object({documentType:D.string().nullish(),id:D.string(),name:D.string().nullish(),parentFolder:D.string().nullish()})}function Um(){return D.object({id:D.string(),name:D.string().nullish(),parentFolder:D.string().nullish()})}const aL=Object.freeze(Object.defineProperty({__proto__:null,AddFileInputSchema:Tm,AddFolderInputSchema:Im,AddListenerInputSchema:xm,AddTriggerInputSchema:Om,CopyNodeInputSchema:Dm,DeleteNodeInputSchema:Rm,DocumentDriveLocalStateSchema:sL,DocumentDriveStateSchema:oL,FileNodeSchema:NS,FolderNodeSchema:AS,ListenerCallInfoSchema:CS,ListenerFilterSchema:MS,ListenerSchema:km,MoveNodeInputSchema:Nm,NodeSchema:LS,PullResponderTriggerDataSchema:PS,RemoveListenerInputSchema:Am,RemoveTriggerInputSchema:Cm,SetAvailableOfflineInputSchema:Mm,SetDriveIconInputSchema:Lm,SetDriveNameInputSchema:Pm,SetSharingTypeInputSchema:Fm,SynchronizationUnitSchema:Wd,TransmitterTypeSchema:RS,TriggerDataSchema:FS,TriggerSchema:$m,TriggerTypeSchema:kS,UpdateFileInputSchema:jm,UpdateNodeInputSchema:Um,definedNonNullAnySchema:iL,isDefinedNonNullAny:DS},Symbol.toStringTag,{value:"Module"})),Is={addFileOperation(t,e,n){if(t.nodes.find(a=>a.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const r=qi({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null}),i=e.input.synchronizationUnits,s=i.find(a=>!!t.nodes.find(c=>Vn(c)&&c.synchronizationUnits.find(l=>l.syncId===a.syncId)));if(s)throw new Error(`A synchronization unit with Id ${s.syncId} already exists`);const o={id:e.input.id,name:r,kind:"file",parentFolder:e.input.parentFolder??null,synchronizationUnits:i,documentType:e.input.documentType};t.nodes.push(o),n==null||n({type:"CREATE_CHILD_DOCUMENT",input:{id:e.input.id,documentType:e.input.documentType,synchronizationUnits:i,document:e.input.document}})},addFolderOperation(t,e){if(t.nodes.find(r=>r.id===e.input.id))throw new Error(`Node with id ${e.input.id} already exists!`);const n=qi({nodes:t.nodes,srcName:e.input.name,targetParentFolder:e.input.parentFolder||null});t.nodes.push({...e.input,name:n,kind:"folder",parentFolder:e.input.parentFolder??null})},deleteNodeOperation(t,e,n){const r=t.nodes.find(s=>s.id===e.input.id);if(!r)throw new Error(`Node with id ${e.input.id} not found`);const i=ca(r,t.nodes);t.nodes=t.nodes.filter(s=>s.id!==e.input.id&&!i.find(o=>o.id===s.id)),[r,...i].filter(s=>Vn(s)).forEach(s=>{n==null||n({type:"DELETE_CHILD_DOCUMENT",input:{id:s.id}})})},updateFileOperation(t,e){t.nodes=t.nodes.map(n=>n.id===e.input.id?{...n,name:qi({nodes:t.nodes,srcName:e.input.name??n.name,targetParentFolder:e.input.parentFolder||null}),documentType:e.input.documentType??n.documentType}:n)},updateNodeOperation(t,e){t.nodes=t.nodes.map(n=>n.id===e.input.id?{...n,name:qi({nodes:t.nodes,srcName:e.input.name??n.name,targetParentFolder:e.input.parentFolder||null}),parentFolder:e.input.parentFolder===null?null:n.parentFolder}:n)},copyNodeOperation(t,e,n){const r=t.nodes.find(a=>a.id===e.input.srcId);if(!r)throw new Error(`Node with id ${e.input.srcId} not found`);if(t.nodes.find(a=>a.id===e.input.targetId))throw new Error(`Node with id ${e.input.targetId} already exists`);const i=qi({nodes:t.nodes,srcName:e.input.targetName||r.name,targetParentFolder:e.input.targetParentFolder||null}),s={...r,name:i,id:e.input.targetId,parentFolder:e.input.targetParentFolder||null},o=Vn(s);if(o){const a=e.input.synchronizationUnits;if(!e.input.synchronizationUnits)throw new Error("Synchronization units were not provided");const c=a.find(l=>!!t.nodes.find(u=>Vn(u)&&u.synchronizationUnits.find(d=>d.syncId===l.syncId)));if(c)throw new Error(`A synchronization unit with Id ${c.syncId} already exists`);s.synchronizationUnits=a}t.nodes.push(s),o&&(n==null||n({type:"COPY_CHILD_DOCUMENT",input:{id:e.input.srcId,newId:e.input.targetId,synchronizationUnits:s.synchronizationUnits}}))},moveNodeOperation(t,e){if(e.input.srcFolder===e.input.targetParentFolder)throw new Error("Circular Reference Error: Attempting to move a node to its current parent folder");const n=t.nodes.find(i=>i.id===e.input.srcFolder);if(!n)throw new Error(`Node with id ${e.input.srcFolder} not found`);const r=qi({nodes:t.nodes,srcName:n.name,targetParentFolder:e.input.targetParentFolder||null});if(qd(n)&&ca(n,t.nodes).find(i=>i.id===e.input.targetParentFolder))throw new Error("Circular Reference Error: Cannot move a folder to one of its descendants");t.nodes=t.nodes.map(i=>i.id===e.input.srcFolder?{...i,name:r,parentFolder:e.input.targetParentFolder||null}:i)}},zi={setDriveNameOperation(t,e,n){t.name=e.input.name},setDriveIconOperation(t,e,n){t.icon=e.input.icon},setSharingTypeOperation(t,e,n){t.sharingType=e.input.type},setAvailableOfflineOperation(t,e,n){t.availableOffline=e.input.availableOffline},addListenerOperation(t,e,n){if(t.listeners.find(r=>r.listenerId===e.input.listener.listenerId))throw new Error(`A listener with Id: ${e.input.listener.listenerId} already exists`);t.listeners.push(e.input.listener)},removeListenerOperation(t,e,n){t.listeners=t.listeners.filter(r=>r.listenerId!==e.input.listenerId)},addTriggerOperation(t,e,n){if(t.triggers.find(r=>r.id===e.input.trigger.id))throw new Error(`A trigger with Id: ${e.input.trigger.id} already exists`);t.triggers.push(e.input.trigger)},removeTriggerOperation(t,e,n){t.triggers=t.triggers.filter(r=>r.id!==e.input.triggerId)}},cL=(t,e,n)=>{if(Ce.isBaseAction(e))return t;switch(e.type){case"ADD_FILE":Tm().parse(e.input),Is.addFileOperation(t[e.scope],e,n);break;case"ADD_FOLDER":Im().parse(e.input),Is.addFolderOperation(t[e.scope],e,n);break;case"DELETE_NODE":Rm().parse(e.input),Is.deleteNodeOperation(t[e.scope],e,n);break;case"UPDATE_FILE":jm().parse(e.input),Is.updateFileOperation(t[e.scope],e,n);break;case"UPDATE_NODE":Um().parse(e.input),Is.updateNodeOperation(t[e.scope],e,n);break;case"COPY_NODE":Dm().parse(e.input),Is.copyNodeOperation(t[e.scope],e,n);break;case"MOVE_NODE":Nm().parse(e.input),Is.moveNodeOperation(t[e.scope],e,n);break;case"SET_DRIVE_NAME":Pm().parse(e.input),zi.setDriveNameOperation(t[e.scope],e,n);break;case"SET_DRIVE_ICON":Lm().parse(e.input),zi.setDriveIconOperation(t[e.scope],e,n);break;case"SET_SHARING_TYPE":Fm().parse(e.input),zi.setSharingTypeOperation(t[e.scope],e,n);break;case"SET_AVAILABLE_OFFLINE":Mm().parse(e.input),zi.setAvailableOfflineOperation(t[e.scope],e,n);break;case"ADD_LISTENER":xm().parse(e.input),zi.addListenerOperation(t[e.scope],e,n);break;case"REMOVE_LISTENER":Am().parse(e.input),zi.removeListenerOperation(t[e.scope],e,n);break;case"ADD_TRIGGER":Om().parse(e.input),zi.addTriggerOperation(t[e.scope],e,n);break;case"REMOVE_TRIGGER":Cm().parse(e.input),zi.removeTriggerOperation(t[e.scope],e,n);break;default:return t}},Ks=Ce.createReducer(cL),lL={id:"",name:"",nodes:[],icon:null,slug:null},uL={listeners:[],triggers:[],sharingType:"private",availableOffline:!1},hc={fileExtension:"phdd",createState(t){return{global:{...lL,...t==null?void 0:t.global},local:{...uL,...t==null?void 0:t.local}}},createExtendedState(t){return Ce.createExtendedState({...t,documentType:"powerhouse/document-drive"},hc.createState)},createDocument(t){return Ce.createDocument(hc.createExtendedState(t),hc.createState)},saveToFile(t,e,n){return Ce.saveToFile(t,e,"phdd",n)},saveToFileHandle(t,e){return Ce.saveToFileHandle(t,e)},loadFromFile(t){return Ce.loadFromFile(t,Ks)},loadFromInput(t){return Ce.loadFromInput(t,Ks)}},{createAction:lo}=Ce,Bm=t=>lo("ADD_FILE",{...t},void 0,Tm,"global"),$S=t=>lo("ADD_FOLDER",{...t},void 0,Im,"global"),jS=t=>lo("DELETE_NODE",{...t},void 0,Rm,"global"),US=t=>lo("UPDATE_FILE",{...t},void 0,jm,"global"),BS=t=>lo("UPDATE_NODE",{...t},void 0,Um,"global"),zm=t=>lo("COPY_NODE",{...t},void 0,Dm,"global"),zS=t=>lo("MOVE_NODE",{...t},void 0,Nm,"global");let dL=class extends Yt{addFile(e){return this.dispatch(Bm(e))}addFolder(e){return this.dispatch($S(e))}deleteNode(e){return this.dispatch(jS(e))}updateFile(e){return this.dispatch(US(e))}updateNode(e){return this.dispatch(BS(e))}copyNode(e){return this.dispatch(zm(e))}moveNode(e){return this.dispatch(zS(e))}};const{createAction:gs}=Ce,VS=t=>gs("SET_DRIVE_NAME",{...t},void 0,Pm,"global"),HS=t=>gs("SET_DRIVE_ICON",{...t},void 0,Lm,"global"),WS=t=>gs("SET_SHARING_TYPE",{...t},void 0,Fm,"local"),qS=t=>gs("SET_AVAILABLE_OFFLINE",{...t},void 0,Mm,"local"),ZS=t=>gs("ADD_LISTENER",{...t},void 0,xm,"local"),GS=t=>gs("REMOVE_LISTENER",{...t},void 0,Am,"local"),YS=t=>gs("ADD_TRIGGER",{...t},void 0,Om,"local"),JS=t=>gs("REMOVE_TRIGGER",{...t},void 0,Cm,"local");let fL=class extends Yt{setDriveName(e){return this.dispatch(VS(e))}setDriveIcon(e){return this.dispatch(HS(e))}setSharingType(e){return this.dispatch(WS(e))}setAvailableOffline(e){return this.dispatch(qS(e))}addListener(e){return this.dispatch(ZS(e))}removeListener(e){return this.dispatch(GS(e))}addTrigger(e){return this.dispatch(YS(e))}removeTrigger(e){return this.dispatch(JS(e))}};const XS=class KS extends Yt{constructor(e,n){super(Ks,hc.createDocument(e),n)}saveToFile(e,n){return super.saveToFile(e,KS.fileExtension,n)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const n=new this;return await n.loadFromFile(e),n}};rL(XS,"fileExtension","phdd");let Vm=XS;wa(Vm,[dL,fL]);const pL=Object.freeze(Object.defineProperty({__proto__:null,addFile:Bm,addFolder:$S,addListener:ZS,addTrigger:YS,copyNode:zm,deleteNode:jS,moveNode:zS,removeListener:GS,removeTrigger:JS,setAvailableOffline:qS,setDriveIcon:HS,setDriveName:VS,setSharingType:WS,updateFile:US,updateNode:BS},Symbol.toStringTag,{value:"Module"}));var En=[];for(var tp=0;tp<256;++tp)En.push((tp+256).toString(16).slice(1));function hL(t,e=0){return(En[t[e+0]]+En[t[e+1]]+En[t[e+2]]+En[t[e+3]]+"-"+En[t[e+4]]+En[t[e+5]]+"-"+En[t[e+6]]+En[t[e+7]]+"-"+En[t[e+8]]+En[t[e+9]]+"-"+En[t[e+10]]+En[t[e+11]]+En[t[e+12]]+En[t[e+13]]+En[t[e+14]]+En[t[e+15]]).toLowerCase()}var Kl,mL=new Uint8Array(16);function gL(){if(!Kl&&(Kl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Kl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Kl(mL)}var yL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Fy={randomUUID:yL};function vL(t,e,n){if(Fy.randomUUID&&!e&&!t)return Fy.randomUUID();t=t||{};var r=t.random||(t.rng||gL)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,hL(r)}function Vn(t){return t.kind==="file"}function qd(t){return t.kind==="folder"}function Hm(t,e){if(t.parentFolder){const n=e.find(r=>r.id===t.parentFolder);if(!n)throw new Error(`Parent node with id ${t.parentFolder} not found`);return[n,...Hm(n,e)]}else return[]}function ca(t,e){const n=e.filter(i=>i.parentFolder===t.id),r=n.map(i=>ca(i,e));return[...n,...r.flat()]}function QS(t,e,n){const r=n.find(a=>a.id===t.srcId);if(!r)throw new Error(`Node with id ${t.srcId} not found`);const i=[{...r,name:t.targetName||r.name,parentFolder:t.targetParentFolder||null},...ca(r,n)],s={};t.targetParentFolder&&(s[t.targetParentFolder]=t.targetParentFolder);const o=a=>{let c=s[a];if(!c){const l=a;c=e(a),s[l]=c}return c};return i.map(a=>({srcId:a.id,targetId:o(a.id),targetName:a.name,targetParentFolder:a.parentFolder?o(a.parentFolder):null,synchronizationUnits:Vn(a)?a.synchronizationUnits.map(c=>({...c,syncId:Rl(n)})):void 0}))}function Rl(t){let e="";for(;!e||t.find(n=>Vn(n)&&n.synchronizationUnits.find(r=>r.syncId===e));)e=vL();return e}function Wm(t,e,n="main"){return e.map(r=>({scope:r,branch:n,syncId:Rl(t.nodes)}))}function qm(t,e,n){return Bm({...e,synchronizationUnits:Wm(t,n)})}function ew(t,e){const n=t.nodes.find(i=>i.id===e.srcId);if(!n)throw new Error(`Node with id ${e.srcId} not found`);let r;return Vn(n)&&(r=n.synchronizationUnits.map(i=>({...i,syncId:Rl(t.nodes)}))),zm({...e,synchronizationUnits:r})}function Zm(t,e){let n=0;const r=new RegExp(`^${Gm(e)} \\(copy\\)(?: (\\d+))?$`);for(const i of t){const s=i.match(r);if(s){const o=s[1]?parseInt(s[1],10):1;o>n&&(n=o)}}return n+1}function Gm(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qi(t){const{nodes:e,targetParentFolder:n,srcName:r}=t,i=e.filter(s=>n===""?s.parentFolder===null:s.parentFolder===n).map(s=>s.name);return i.includes(r)?`${r} (copy) ${Zm(i,r)}`:r}const _L=Object.freeze(Object.defineProperty({__proto__:null,escapeRegExp:Gm,generateAddNodeAction:qm,generateCopyNodeAction:ew,generateNodesCopy:QS,generateSynchronizationUnitId:Rl,generateSynchronizationUnits:Wm,getAncestors:Hm,getDescendants:ca,getNextCopyNumber:Zm,handleTargetNameCollisions:qi,isFileNode:Vn,isFolderNode:qd},Symbol.toStringTag,{value:"Module"})),tw=Vm,ol={...hc,..._L},Tn={...Sa,...pL},nw={Document:tw,reducer:Ks,actions:Tn,utils:ol,documentModel:Hd},bL=Object.freeze(Object.defineProperty({__proto__:null,Document:tw,DocumentDrive:Vm,actions:Tn,documentModel:Hd,escapeRegExp:Gm,generateAddNodeAction:qm,generateCopyNodeAction:ew,generateNodesCopy:QS,generateSynchronizationUnitId:Rl,generateSynchronizationUnits:Wm,getAncestors:Hm,getDescendants:ca,getNextCopyNumber:Zm,handleTargetNameCollisions:qi,isFileNode:Vn,isFolderNode:qd,module:nw,reducer:Ks,utils:ol,z:aL},Symbol.toStringTag,{value:"Module"}));let rw=()=>({emit(t,...e){for(let n=this.events[t]||[],r=0,i=n.length;r<i;r++)n[r](...e)},events:{},on(t,e){var n;return((n=this.events)[t]||(n[t]=[])).push(e),()=>{var r;this.events[t]=(r=this.events[t])==null?void 0:r.filter(i=>e!==i)}}});class iw{constructor(){qe(this,"cache",new Map)}async setDocument(e,n,r){var a;const i=r.operations.global.map(c=>(delete c.resultingState,c)),s=r.operations.local.map(c=>(delete c.resultingState,c)),o={...r,operations:{global:i,local:s}};return this.cache.has(e)||this.cache.set(e,new Map),(a=this.cache.get(e))==null||a.set(n,o),!0}async deleteDocument(e,n){var r;return((r=this.cache.get(e))==null?void 0:r.delete(n))??!1}async getDocument(e,n){var r;return(r=this.cache.get(e))==null?void 0:r.get(n)}}class EL extends Error{constructor(e,n){super(`Document model "${e}" not found`,{cause:n}),this.id=e}}class zn extends Error{constructor(n,r,i,s){super(i,{cause:s??r});qe(this,"status");qe(this,"operation");this.status=n,this.operation=r}}class SL extends zn{constructor(e,n){super("CONFLICT",n,`Conflicting operation on index ${n.index}`,{existingOperation:e,newOperation:n})}}class wL extends Error{constructor(n){super(`Drive already exists. ID: ${n}`);qe(this,"driveId");this.driveId=n}}class mc extends Error{constructor(n){super(`Drive with id ${n} not found`);qe(this,"driveId");this.driveId=n}}class sw extends Error{constructor(n,r){super(n);qe(this,"syncUnitId");this.syncUnitId=r}}var al;(t=>{t.useMessageChannel=typeof MessageChannel>"u"?new Error("MessageChannel is not supported"):r=>{const i=new AbortController,s=i.signal,o=new MessageChannel;return o.port1.postMessage(null),o.port2.addEventListener("message",()=>{r(),o.port1.close(),o.port2.close()},{once:!0,signal:s}),o.port2.start(),()=>i.abort()},t.usePostMessage=(()=>{const r=typeof window=="object"&&window||typeof global=="object"&&global||typeof self=="object"&&self;if(!r)return new Error("No global object found");const i=r;if(!i.postMessage||!i.addEventListener||i.importScripts)return new Error("postMessage is not supported");let s=0;const o=new Map;function a(){return s===9007199254740991?0:++s}const c="com.usePostMessage"+Math.random();return i.addEventListener("message",l=>{const u=l;if(typeof u.data!="string"||u.source!==i||!u.data.startsWith(c))return;const d=u.data.split(":").at(1);if(d===void 0)return;const f=+d,p=o.get(f);p&&(p(),o.delete(f))},!1),l=>{const u=a();return o.set(u,l),i.postMessage(c+":"+u,{targetOrigin:"*"}),()=>{o.delete(u)}}})(),t.useSetImmediate=typeof window<"u"?new Error("setImmediate is not supported on the browser"):typeof setImmediate>"u"?new Error("setImmediate is not supported"):r=>{const i=setImmediate(r);return()=>clearImmediate(i)},t.useSetTimeout=r=>{const i=setTimeout(r,0);return()=>clearTimeout(i)};function e(r){return t.useSetImmediate instanceof Error?t.useMessageChannel instanceof Error?t.usePostMessage instanceof Error?(0,t.useSetTimeout)(r):(0,t.usePostMessage)(r):(0,t.useMessageChannel)(r):(0,t.useSetImmediate)(r)}t.runAsap=e;function n(r,i=e){if(i instanceof Error)throw new Error("queueMethod is not supported",{cause:i});return new Promise((s,o)=>{i(()=>{r().then(s).catch(o)})})}t.runAsapAsync=n})(al||(al={}));const TL=al.runAsap,IL=al.runAsapAsync;function Ds(t){return t.documentType===Hd.id}function ud(t,e){const n=Object.keys(t).reduce((i,s)=>{var a;const o=s;return i[o]=((a=t[o].at(-1))==null?void 0:a.index)??0,i},{}),r=e.find(i=>i.index<(n[i.scope]??0));if(r)throw new zn("ERROR",r,`Tried to add operation with index ${r.index} and document is at index ${n[r.scope]}`);return e.sort((i,s)=>i.index-s.index).reduce((i,s)=>{const o=i[s.scope]||[];return{...i,[s.scope]:[...o,s]}},t)}function Ym(){return cm()}function xL(t,e){return new Date(t)<new Date(e)}function Ou(t){return"operations"in t}function OL(t){return"actions"in t}class DL{constructor(e){qe(this,"id");qe(this,"blocked",!1);qe(this,"deleted",!1);qe(this,"items",[]);qe(this,"dependencies",new Array);this.id=e}async setDeleted(e){this.deleted=e}async isDeleted(){return this.deleted}async addJob(e){return this.items.push(e),Promise.resolve()}async getNextJob(){const e=this.items.shift();return Promise.resolve(e)}async amountOfJobs(){return Promise.resolve(this.items.length)}getId(){return this.id}async setBlocked(e){this.blocked=e}async isBlocked(){return this.blocked}async getJobs(){return this.items}async addDependencies(e){this.dependencies.find(n=>n.jobId===e.jobId)||this.dependencies.push(e),this.isBlocked()||this.setBlocked(!0)}async removeDependencies(e){this.dependencies=this.dependencies.filter(n=>n.jobId!==e.jobId&&n.driveId!==e.driveId),this.dependencies.length===0&&await this.setBlocked(!1)}}class ow{constructor(e=3,n=0){qe(this,"emitter",rw());qe(this,"ticker",0);qe(this,"queues",[]);qe(this,"workers");qe(this,"timeout");qe(this,"delegate");this.workers=e,this.timeout=n}async init(e,n){this.delegate=e;for(let r=0;r<this.workers;r++)setTimeout(()=>this.processNextJob.bind(this)().catch(n),100*r);return Promise.resolve()}async addJob(e){if(!this.delegate)throw new Error("No server delegate defined");const n=Ym(),r=this.getQueue(e.driveId,e.documentId);if(await r.isDeleted())throw new Error("Queue is deleted");if(e.documentId&&!await this.delegate.checkDocumentExists(e.driveId,e.documentId)&&!await r.isBlocked()){await r.setBlocked(!0);const l=await this.getQueue(e.driveId).getJobs();for(const u of l)(Ou(u)?u.operations:u.actions).find(p=>{const h=p.input;return p.type==="ADD_FILE"&&h.id===e.documentId})&&await r.addDependencies(u)}const s=Ou(e)?e.operations:e.actions,o=s.filter(c=>c.type==="ADD_FILE");for(const c of o){const l=c.input;await this.getQueue(e.driveId,l.id).addDependencies({jobId:n,...e})}const a=s.filter(c=>c.type==="DELETE_NODE");for(const c of a){const l=c.input;await this.getQueue(e.driveId,l.id).setDeleted(!0)}return await r.addJob({jobId:n,...e}),n}getQueue(e,n){const r=this.getQueueId(e,n);let i=this.queues.find(s=>s.getId()===r);return i||(i=new DL(r),this.queues.push(i)),i}removeQueue(e,n){const r=this.getQueueId(e,n);this.queues=this.queues.filter(i=>i.getId()!==r),this.emit("queueRemoved",r)}getQueueByIndex(e){const n=this.queues[e];return n||null}getQueues(){return this.queues.map(e=>e.getId())}retryNextJob(e){const n=e!==void 0?e:this.timeout;(n>0?i=>setTimeout(i,n):TL)(()=>this.processNextJob())}async findFirstNonEmptyQueue(e){const n=this.queues.length;for(let r=0;r<n;r++){const i=(e+r)%n,s=this.queues[i];if(s&&await s.amountOfJobs()>0)return i}return null}async processNextJob(){if(!this.delegate)throw new Error("No server delegate defined");if(this.queues.length===0){this.retryNextJob();return}const e=this.queues[this.ticker];if(!e){this.ticker=0,this.retryNextJob();return}if(await e.amountOfJobs()===0){const s=await this.findFirstNonEmptyQueue(this.ticker);s!==null?(this.ticker=s,this.retryNextJob(0)):this.retryNextJob();return}if(this.ticker=this.ticker===this.queues.length-1?0:this.ticker+1,await e.isBlocked()){this.retryNextJob();return}await e.setBlocked(!0);const i=await e.getNextJob();if(!i){this.retryNextJob();return}try{const s=await this.delegate.processJob(i),a=(Ou(i)?i.operations:i.actions).filter(c=>c.type==="ADD_FILE");if(a.length>0)for(const c of a)await this.getQueue(i.driveId,c.input.id).removeDependencies(i);this.emit("jobCompleted",i,s)}catch(s){ct.error("job failed",s),this.emit("jobFailed",i,s)}finally{await e.setBlocked(!1),this.retryNextJob(0)}}emit(e,...n){this.emitter.emit(e,...n)}on(e,n){return this.emitter.on(e,n)}getQueueId(e,n){return`queue:${e}${n?`:${n}`:""}`}}class Zd extends Error{}class Rs extends Zd{constructor(e){super(`Read drive ${e} not found.`)}}class RL extends Zd{constructor(e){super(`Read drive with slug ${e} not found.`)}}class $y extends Zd{constructor(e,n){super(`Document with id ${n} not found on read drive ${e}.`)}}var gl,_r,io,Qp,aw;class kL{constructor(e){jr(this,io);jr(this,gl);jr(this,_r,new Map);Ma(this,gl,e)}async fetchDrive(e){const n=Dt(this,_r).get(e);if(!n)return new Rs(e);const r=await this.fetchDocument(e,e,Hd.id);if(r instanceof Error)return r;const i={...r,readContext:n.context};return n.drive=i,i}async fetchDocument(e,n,r){const i=Dt(this,_r).get(e);if(!i)return new Rs(e);let s;try{s=Dt(this,gl).call(this,r)}catch(l){return new EL(r,l)}const{url:o}=i.context,{errors:a,document:c}=await Oy(o,n,s);if(a){const l=mr(this,io,Qp).call(this,a,e,n);if(l instanceof Zd)return l;if(l)throw l}return c||new $y(e,n)}async addReadDrive(e,n){const{id:r}=(n==null?void 0:n.expectedDriveInfo)??await As(e),i=await mr(this,io,aw).call(this,r,e);if(i instanceof Error)throw i;if(!i)throw new Error(`Drive "${r}" not found at ${e}`);Dt(this,_r).set(r,{drive:i,context:{...n,url:e}})}async getReadDrives(){return Promise.resolve([...Dt(this,_r).keys()])}async getReadDrive(e){const n=Dt(this,_r).get(e);return Promise.resolve(n?{...n.drive,readContext:n.context}:new Rs(e))}async getReadDriveBySlug(e){const n=[...Dt(this,_r).values()].find(({drive:r})=>r.state.global.slug===e);return Promise.resolve(n?{...n.drive,readContext:n.context}:new RL(e))}getReadDriveContext(e){var n;return Promise.resolve(((n=Dt(this,_r).get(e))==null?void 0:n.context)??new Rs(e))}deleteReadDrive(e){const n=Dt(this,_r).delete(e);return Promise.resolve(n?void 0:new Rs(e))}}gl=new WeakMap,_r=new WeakMap,io=new WeakSet,Qp=function(e,n,r){for(const s of e){if(s.message===`Drive with id ${n} not found`)return new Rs(n);if(r&&s.message===`Document with id ${r} not found`)return new $y(n,r)}const i=e.at(0);if(i)return i},aw=async function(e,n){const{errors:r,document:i}=await Oy(n,e,bL);return(r?mr(this,io,Qp).call(this,r,e):void 0)||i};function NL(t){var e,n,r,Du,Ru,o;return o=class extends t{constructor(...l){super(...l);jr(this,r);jr(this,e);jr(this,n,new Set);Ma(this,e,new kL(this.getDocumentModel.bind(this))),mr(this,r,Du).call(this).then(u=>{u.length&&mr(this,r,Ru).call(this,u,"add")}).catch(ct.error)}getReadDrives(){return Dt(this,e).getReadDrives()}getReadDrive(l){return Dt(this,e).getReadDrive(l)}getReadDriveBySlug(l){return Dt(this,e).getReadDriveBySlug(l)}getReadDriveContext(l){return Dt(this,e).getReadDriveContext(l)}async addReadDrive(l,u){await Dt(this,e).addReadDrive(l,u),mr(this,r,Ru).call(this,await mr(this,r,Du).call(this),"add")}fetchDrive(l){return Dt(this,e).fetchDrive(l)}fetchDocument(l,u,d){return Dt(this,e).fetchDocument(l,u,d)}async deleteReadDrive(l){const u=await Dt(this,e).deleteReadDrive(l);if(u)return u;mr(this,r,Ru).call(this,await mr(this,r,Du).call(this),"delete")}async migrateReadDrive(l,u){const d=await this.getReadDriveContext(l);if(d instanceof Error)return d;const{url:f,...p}=d;try{return await this.addRemoteDrive(f,u)}catch(h){throw ct.error(h),await this.addReadDrive(d.url,p),h}}onReadDrivesUpdate(l){return Dt(this,n).add(l),Promise.resolve(()=>Dt(this,n).delete(l))}},e=new WeakMap,n=new WeakMap,r=new WeakSet,Du=async function(){const l=await this.getReadDrives();return(await Promise.all(l.map(d=>this.getReadDrive(d)))).filter(d=>!(d instanceof Error))},Ru=function(l,u){Dt(this,n).forEach(d=>d(l,u))},o}class AL{constructor(){qe(this,"documents");qe(this,"drives");qe(this,"slugToDriveId",{});this.documents={},this.drives={}}checkDocumentExists(e,n){var r;return Promise.resolve(((r=this.documents[e])==null?void 0:r[n])!==void 0)}async getDocuments(e){return Object.keys(this.documents[e]??{})}async getDocument(e,n){const r=this.documents[e];if(!r)throw new mc(e);const i=r[n];if(!i)throw new Error(`Document with id ${n} not found`);return i}async saveDocument(e,n,r){this.documents[e]=this.documents[e]??{},this.documents[e][n]=r}async clearStorage(){this.documents={},this.drives={}}async createDocument(e,n,r){this.documents[e]=this.documents[e]??{};const{operations:i,initialState:s,name:o,revision:a,documentType:c,created:l,lastModified:u,clipboard:d,state:f}=r;this.documents[e][n]={operations:i,initialState:s,name:o,revision:a,documentType:c,created:l,lastModified:u,clipboard:d,state:f}}async addDocumentOperations(e,n,r,i){const s=await this.getDocument(e,n);if(!s)throw new Error(`Document with id ${n} not found`);const o=ud(s.operations,r);this.documents[e][n]={...s,...i,operations:o}}async deleteDocument(e,n){if(!this.documents[e])throw new mc(e);delete this.documents[e][n]}async getDrives(){return Object.keys(this.drives)}async getDrive(e){const n=this.drives[e];if(!n)throw new mc(e);return n}async getDriveBySlug(e){const n=this.slugToDriveId[e];if(!n)throw new Error(`Drive with slug ${e} not found`);return this.getDrive(n)}async createDrive(e,n){this.drives[e]=n,this.documents[e]={};const{slug:r}=n.initialState.state.global;r&&(this.slugToDriveId[r]=e)}async addDriveOperations(e,n,r){const i=await this.getDrive(e),s=ud(i.operations,n);this.drives[e]={...i,...r,operations:s}}async deleteDrive(e){delete this.documents[e],delete this.drives[e]}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async r=>{try{const i=await(r.documentId?this.getDocument(r.driveId,r.documentId):this.getDrive(r.driveId));if(!i)return;const s=i.operations[r.scope].at(-1);if(s)return{driveId:r.driveId,documentId:r.documentId,scope:r.scope,branch:r.branch,lastUpdated:s.timestamp,revision:s.index}}catch{return}}))).reduce((r,i)=>(i.status==="fulfilled"&&i.value!==void 0&&r.push(i.value),r),[])}}function CL(t){return typeof t.getReadDrives=="function"}class ML{constructor(e,n,r){qe(this,"defaultRemoteDrives",new Map);qe(this,"removeOldRemoteDrivesConfig");if(this.server=e,this.delegate=n,r!=null&&r.defaultDrives.remoteDrives)for(const i of r.defaultDrives.remoteDrives)this.defaultRemoteDrives.set(i.url,{...i,status:"PENDING"});this.removeOldRemoteDrivesConfig=(r==null?void 0:r.defaultDrives.removeOldRemoteDrives)||{strategy:"preserve-all"}}getDefaultRemoteDrives(){return new Map(JSON.parse(JSON.stringify(Array.from(this.defaultRemoteDrives))))}async deleteDriveById(e){try{await this.server.deleteDrive(e)}catch(n){n instanceof mc||ct.error(n)}}async preserveDrivesById(e,n,r="detach"){const i=n.map(a=>this.server.getDrive(a)),o=(await Promise.all(i)).filter(a=>a.state.local.listeners.length>0||a.state.local.triggers.length>0).filter(a=>!e.includes(a.state.global.id)).map(a=>a.state.global.id);r==="detach"?await this.detachDrivesById(o):await this.removeDrivesById(o)}async removeDrivesById(e){for(const n of e)await this.deleteDriveById(n)}async detachDrivesById(e){const n=e.map(r=>this.delegate.detachDrive(r));await Promise.all(n)}async removeOldremoteDrives(){const e=await this.server.getDrives();switch(this.removeOldRemoteDrivesConfig.strategy){case"preserve-by-id-and-detach":case"preserve-by-id":{const n=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-id-and-detach"?"detach":"remove";await this.preserveDrivesById(this.removeOldRemoteDrivesConfig.ids,e,n);break}case"preserve-by-url-and-detach":case"preserve-by-url":{const n=this.removeOldRemoteDrivesConfig.strategy==="preserve-by-url-and-detach"?"detach":"remove",r=this.removeOldRemoteDrivesConfig.urls.map(s=>As(s)),i=(await Promise.all(r)).map(s=>s.id);await this.preserveDrivesById(i,e,n);break}case"remove-by-id":{const n=this.removeOldRemoteDrivesConfig.ids.filter(r=>e.includes(r));await this.removeDrivesById(n);break}case"remove-by-url":{const n=this.removeOldRemoteDrivesConfig.urls.map(s=>As(s)),i=(await Promise.all(n)).map(s=>s.id).filter(s=>e.includes(s));await this.removeDrivesById(i);break}case"remove-all":{const n=e.map(s=>this.server.getDrive(s)),i=(await Promise.all(n)).filter(s=>s.state.local.listeners.length>0||s.state.local.triggers.length>0).map(s=>s.state.global.id);await this.removeDrivesById(i);break}case"detach-by-id":{const r=this.removeOldRemoteDrivesConfig.ids.filter(i=>e.includes(i)).map(i=>this.delegate.detachDrive(i));await Promise.all(r);break}case"detach-by-url":{const n=this.removeOldRemoteDrivesConfig.urls.map(o=>As(o)),s=(await Promise.all(n)).map(o=>o.id).filter(o=>e.includes(o)).map(o=>this.delegate.detachDrive(o));await Promise.all(s);break}}}async setAllDefaultDrivesAccessLevel(e){const n=this.defaultRemoteDrives.values();for(const r of n)await this.setDefaultDriveAccessLevel(r.url,e)}async setDefaultDriveAccessLevel(e,n){const r=this.defaultRemoteDrives.get(e);if(r&&r.options.accessLevel!==n){const i={...r,options:{...r.options,accessLevel:n}};this.defaultRemoteDrives.set(e,i),await this.initializeDefaultRemoteDrives([i])}}async initializeDefaultRemoteDrives(e=Array.from(this.defaultRemoteDrives.values())){const n=await this.server.getDrives(),r=CL(this.server)?this.server:void 0,i=await(r==null?void 0:r.getReadDrives());for(const s of e){let o={...s};try{const a=s.metadata??await As(s.url);o={...s,metadata:a},this.defaultRemoteDrives.set(s.url,o);const c=n.includes(a.id),l=i==null?void 0:i.includes(a.id),u=s.options.accessLevel!==void 0,d=r&&s.options.accessLevel==="READ",f=d?l:c;if(u&&(d?c:l))try{await(d?this.server.deleteDrive(a.id):r==null?void 0:r.deleteReadDrive(a.id))}catch(h){ct.error(h)}if(f){o.status="ALREADY_ADDED",this.defaultRemoteDrives.set(s.url,o),this.delegate.emit("ALREADY_ADDED",this.defaultRemoteDrives,o,a.id,a.name);continue}o.status="ADDING",this.defaultRemoteDrives.set(s.url,o),this.delegate.emit("ADDING",this.defaultRemoteDrives,o),!u&&r||d?await r.addReadDrive(s.url,{...s.options,expectedDriveInfo:a}):await this.server.addRemoteDrive(s.url,{...s.options,expectedDriveInfo:a}),o.status="SUCCESS",this.defaultRemoteDrives.set(s.url,o),this.delegate.emit("SUCCESS",this.defaultRemoteDrives,o,a.id,a.name)}catch(a){o.status="ERROR",this.defaultRemoteDrives.set(s.url,o),this.delegate.emit("ERROR",this.defaultRemoteDrives,o,void 0,void 0,a)}}}}const{attachBranch:LL,garbageCollect:PL,groupOperationsByScope:FL,merge:$L,split:EH,precedes:jL,removeExistingOperations:UL,reshuffleByTimestamp:BL,sortOperations:zL,addUndo:SH,checkOperationsIntegrity:wH,checkCleanedOperationsIntegrity:TH,reshuffleByTimestampAndIndex:IH,nextSkipNumber:xH,prepareOperations:OH,IntegrityIssueSubType:DH,IntegrityIssueType:RH}=Ce.documentHelpers;class VL{}const eh={sequentialUpdates:!0};class HL{constructor(e,n=new Map,r=eh){qe(this,"drive");qe(this,"listenerState",new Map);qe(this,"options");qe(this,"transmitters",{});this.drive=e,this.listenerState=n,this.options={...eh,...r}}}var Pd,lw;class cw{constructor(e,n){jr(this,Pd);qe(this,"drive");qe(this,"listener");qe(this,"receiver");this.listener=e,this.drive=n}async transmit(e,n){var i;if(!this.receiver)return[];const r=[];for(const s of e){const o=await mr(this,Pd,lw).call(this,s),a=((i=o.at(-1))==null?void 0:i.state)??{};r.push({...s,operations:o,state:a})}try{return await this.receiver.onStrands(r),e.map(({operations:s,...o})=>{var a;return{...o,status:"SUCCESS",revision:((a=s.at(s.length-1))==null?void 0:a.index)??-1}})}catch(s){return ct.error(s),e.map(({operations:o,...a})=>{var c;return{...a,status:"ERROR",revision:(((c=o.at(0))==null?void 0:c.index)??0)-1}})}}setReceiver(e){this.receiver=e}async disconnect(){var e;await((e=this.receiver)==null?void 0:e.onDisconnect())}getListener(){return this.listener}}Pd=new WeakSet,lw=async function(e){const n=[],r=new Map,i=async s=>{const o=r.get(s);if(o)return o;const a={revisions:{[e.scope]:s},checkHashes:!1},c=await(e.documentId?this.drive.getDocument(e.driveId,e.documentId,a):this.drive.getDrive(e.driveId,a));return s<0?r.set(s,c.initialState.state[e.scope]):r.set(s,c.state[e.scope]),r.get(s)};for(const s of e.operations)n.push({...s,state:await i(s.index),previousState:await i(s.index-1)});return n};class bi{constructor(e,n,r){qe(this,"drive");qe(this,"listener");qe(this,"manager");this.listener=e,this.drive=n,this.manager=r}getStrands(e){return this.manager.getStrands(this.listener.driveId,this.listener.listenerId,e)}disconnect(){return Promise.resolve()}async processAcknowledge(e,n,r){const i=await this.manager.getListenerSyncUnitIds(e,n);let s=!0;for(const o of r){const a=i.find(c=>c.scope===o.scope&&c.branch===o.branch&&c.driveId===o.driveId&&c.documentId==o.documentId);if(!a){ct.warn("Unknown sync unit was acknowledged",o),s=!1;continue}await this.manager.updateListenerRevision(n,e,a.syncId,o.revision)}return s}static async registerPullResponder(e,n,r){var o;const i=await qo(n,Wo`
|
|
341
|
-
mutation registerPullResponderListener($filter: InputListenerFilter!) {
|
|
342
|
-
registerPullResponderListener(filter: $filter) {
|
|
343
|
-
listenerId
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
`,{filter:r}),s=(o=i.errors)==null?void 0:o.at(0);if(s)throw s;if(!i.registerPullResponderListener)throw new Error("Error registering listener");return i.registerPullResponderListener.listenerId}static async pullStrands(e,n,r,i){var a;const s=await qo(n,Wo`
|
|
347
|
-
query strands($listenerId: ID!) {
|
|
348
|
-
system {
|
|
349
|
-
sync {
|
|
350
|
-
strands(listenerId: $listenerId) {
|
|
351
|
-
driveId
|
|
352
|
-
documentId
|
|
353
|
-
scope
|
|
354
|
-
branch
|
|
355
|
-
operations {
|
|
356
|
-
id
|
|
357
|
-
timestamp
|
|
358
|
-
skip
|
|
359
|
-
type
|
|
360
|
-
input
|
|
361
|
-
hash
|
|
362
|
-
index
|
|
363
|
-
context {
|
|
364
|
-
signer {
|
|
365
|
-
user {
|
|
366
|
-
address
|
|
367
|
-
networkId
|
|
368
|
-
chainId
|
|
369
|
-
}
|
|
370
|
-
app {
|
|
371
|
-
name
|
|
372
|
-
key
|
|
373
|
-
}
|
|
374
|
-
signatures
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
`,{listenerId:r}),o=(a=s.errors)==null?void 0:a.at(0);if(o)throw o;return s.system?s.system.sync.strands.map(c=>({...c,operations:c.operations.map(l=>({...l,input:JSON.parse(l.input)}))})):[]}static async acknowledgeStrands(e,n,r,i){var a;const s=await qo(n,Wo`
|
|
383
|
-
mutation acknowledge(
|
|
384
|
-
$listenerId: String!
|
|
385
|
-
$revisions: [ListenerRevisionInput]
|
|
386
|
-
) {
|
|
387
|
-
acknowledge(listenerId: $listenerId, revisions: $revisions)
|
|
388
|
-
}
|
|
389
|
-
`,{listenerId:r,revisions:i}),o=(a=s.errors)==null?void 0:a.at(0);if(o)throw o;if(s.acknowledge===null)throw new Error("Error acknowledging strands");return s.acknowledge}static async executePull(e,n,r,i,s,o){var a;try{const{url:c,listenerId:l}=n.data,u=await bi.pullStrands(e,c,l);if(!u.length){s==null||s([]);return}const d=[];for(const f of u){const p=f.operations.map(m=>({...m,scope:f.scope,branch:f.branch}));let h;try{const m=await r(f,{type:"trigger",trigger:n});if(m.error)throw m.error}catch(m){h=m,i(h)}d.push({branch:f.branch,documentId:f.documentId||"",driveId:f.driveId,revision:((a=p.pop())==null?void 0:a.index)??-1,scope:f.scope,status:h?h instanceof zn?h.status:"ERROR":"SUCCESS",error:h})}s==null||s(d),await bi.acknowledgeStrands(e,c,l,d.map(f=>{const{error:p,...h}=f;return h})).then(f=>o==null?void 0:o(f)).catch(f=>ct.error("ACK error",f))}catch(c){i(c)}}static setupPull(e,n,r,i,s,o){const{interval:a}=n.data;let c=sP;if(a)try{const f=parseInt(a);f&&(c=f)}catch{}let l=!1,u;return(async()=>{for(;!l;)await this.executePull(e,n,r,i,s,o),await new Promise(f=>{u=setTimeout(f,c)})})().catch(ct.error),()=>{l=!0,u!==void 0&&clearTimeout(u)}}static async createPullResponderTrigger(e,n,r){const{pullFilter:i,pullInterval:s}=r,o=await bi.registerPullResponder(e,n,i??{documentId:["*"],documentType:["*"],branch:["*"],scope:["*"]});return{id:Ym(),type:"PullResponder",data:{url:n,listenerId:o,interval:(s==null?void 0:s.toString())??""}}}static isPullResponderTrigger(e){return e.type==="PullResponder"}}var WL={space:"",cycles:!1,replacer:(t,e)=>e,stringify:JSON.stringify},uo={isArray:Array.isArray,assign:Object.assign,isObject:t=>typeof t=="object",isFunction:t=>typeof t=="function",isBoolean:t=>typeof t=="boolean",isRegex:t=>t instanceof RegExp,keys:Object.keys};const $a=WL,qL=uo.isFunction,ZL=uo.isBoolean,GL=uo.isObject,YL=uo.isArray,JL=uo.isRegex,XL=uo.assign,KL=uo.keys;function QL(t){return t==null?t:JL(t)?t.toString():t.toJSON?t.toJSON():t}function eP(t,e){e=e||XL({},$a),qL(e)&&(e={compare:e});const n=e.space||$a.space,r=ZL(e.cycles)?e.cycles:$a.cycles,i=e.replacer||$a.replacer,s=e.stringify||$a.stringify,o=e.compare&&function(c){return function(l){return function(u,d){const f={key:u,value:l[u]},p={key:d,value:l[d]};return c(f,p)}}}(e.compare);r||s(t);const a=[];return function c(l,u,d,f){const p=n?`
|
|
390
|
-
`+new Array(f+1).join(n):"",h=n?": ":":";if(d=QL(d),d=i.call(l,u,d),d!==void 0){if(!GL(d)||d===null)return s(d);if(YL(d)){const m=[];for(let v=0;v<d.length;v++){const y=c(d,v,d[v],f+1)||s(null);m.push(p+n+y)}return"["+m.join(",")+p+"]"}else{if(r){if(a.indexOf(d)!==-1)return s("[Circular]");a.push(d)}const m=KL(d).sort(o&&o(d)),v=[];for(let y=0;y<m.length;y++){const g=m[y],_=c(d,g,d[g],f+1);if(!_)continue;const T=s(g)+h+_;v.push(p+n+T)}return a.splice(a.indexOf(d),1),"{"+v.join(",")+p+"}"}}}({"":t},"",t,0)}var tP=eP;const nP=vl(tP);class rP{constructor(e,n){qe(this,"drive");qe(this,"listener");qe(this,"targetURL");this.listener=e,this.drive=n,this.targetURL=e.callInfo.data}async transmit(e,n){var r;if(n.type==="trigger"&&((r=n.trigger.data)==null?void 0:r.url)===this.targetURL)return e.map(i=>{var s;return{driveId:i.driveId,documentId:i.documentId,scope:i.scope,branch:i.branch,status:"SUCCESS",revision:((s=i.operations.at(-1))==null?void 0:s.index)??-1}});try{const{pushUpdates:i}=await qo(this.targetURL,Wo`
|
|
391
|
-
mutation pushUpdates($strands: [InputStrandUpdate!]) {
|
|
392
|
-
pushUpdates(strands: $strands) {
|
|
393
|
-
driveId
|
|
394
|
-
documentId
|
|
395
|
-
scope
|
|
396
|
-
branch
|
|
397
|
-
status
|
|
398
|
-
revision
|
|
399
|
-
error
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
`,{strands:e.map(s=>({...s,operations:s.operations.map(o=>({...o,input:nP(o.input)}))}))});if(!i)throw new Error("Couldn't update listener revision");return i}catch(i){throw ct.error(i),i}return[]}}function iP(t,e=250){let n;return(r,...i)=>(n&&clearTimeout(n),new Promise((s,o)=>{r?t(...i).then(s).catch(o):n=setTimeout(()=>{t(...i).then(s).catch(o)},e)}))}const Fd=class Fd extends HL{constructor(){super(...arguments);qe(this,"triggerUpdate",iP(this._triggerUpdate.bind(this),Fd.LISTENER_UPDATE_DELAY))}async getTransmitter(n,r){var i;return Promise.resolve((i=this.transmitters[n])==null?void 0:i[r])}driveHasListeners(n){return this.listenerState.has(n)}async addListener(n){var a;const r=n.driveId;this.listenerState.has(r)||this.listenerState.set(r,new Map),this.listenerState.get(r).set(n.listenerId,{block:n.block,driveId:n.driveId,pendingTimeout:"0",listener:n,listenerStatus:"CREATED",syncUnits:new Map});let s;switch((a=n.callInfo)==null?void 0:a.transmitterType){case"SwitchboardPush":{s=new rP(n,this.drive);break}case"PullResponder":{s=new bi(n,this.drive,this);break}case"Internal":{s=new cw(n,this.drive);break}}if(!s)throw new Error("Transmitter not found");const o=this.transmitters[r]||{};return o[n.listenerId]=s,this.transmitters[r]=o,this.triggerUpdate(!0,{type:"local"}),Promise.resolve(s)}async removeListener(n,r){const i=this.listenerState.get(n);return i?Promise.resolve(i.delete(r)):!1}async removeSyncUnits(n,r){const i=this.listenerState.get(n);if(i){for(const[,s]of i)for(const o of r)s.syncUnits.delete(o.syncId);return Promise.resolve()}}async updateSynchronizationRevisions(n,r,i,s,o,a=!1){const c=this.listenerState.get(n);if(!c)return[];const l=[];for(const[,u]of c){if(l.find(f=>f.listenerId===u.listener.listenerId))continue;const d=await this.getTransmitter(n,u.listener.listenerId);if(d!=null&&d.transmit)for(const f of r){if(!this._checkFilter(u.listener.filter,f))continue;const p=u.syncUnits.get(f.syncId);if(!p||p.listenerRev<f.revision){l.push(u.listener);break}}}return l.length?(s==null||s(l),this.triggerUpdate(a,i,o)):[]}async updateListenerRevision(n,r,i,s){const o=this.listenerState.get(r);if(!o)return;const a=o.get(n);if(!a)return;const c=new Date().toISOString(),l=a.syncUnits.get(i);return l?(l.listenerRev=s,l.lastUpdated=c):a.syncUnits.set(i,{listenerRev:s,lastUpdated:c}),Promise.resolve()}async _triggerUpdate(n,r){var s;const i=[];for(const[o,a]of this.listenerState)for(const[c,l]of a){const u=await this.getTransmitter(o,c);if(!(u!=null&&u.transmit))continue;const d=await this.getListenerSyncUnits(o,l.listener.listenerId),f=[],p=d.map(h=>async()=>{const m=l.syncUnits.get(h.syncId);if(m&&m.listenerRev>=h.revision)return;const v=[];try{const y=await this.drive.getOperationData(o,h.syncId,{fromRevision:m==null?void 0:m.listenerRev});v.push(...y)}catch(y){ct.error(y)}v.length&&f.push({driveId:o,documentId:h.documentId,branch:h.branch,operations:v,scope:h.scope})});if(this.options.sequentialUpdates)for(const h of p)await h();else await Promise.all(p.map(h=>h()));if(f.length!=0){l.pendingTimeout=new Date(new Date().getTime()/1e3+300).toISOString(),l.listenerStatus="PENDING";try{const h=await u.transmit(f,n);l.pendingTimeout="0",l.listenerStatus="PENDING";const m=new Date().toISOString();for(const v of h){const y=d.find(g=>v.documentId===g.documentId&&v.scope===g.scope&&v.branch===g.branch);y?l.syncUnits.set(y.syncId,{lastUpdated:m,listenerRev:v.revision}):ct.warn(`Received revision for untracked unit for listener ${l.listener.listenerId}`,v)}for(const v of h){const y=v.status==="ERROR";if((s=v.error)!=null&&s.includes("Missing operations")){const g=await this._triggerUpdate(n,r);i.push(...g)}else if(i.push({listenerId:l.listener.listenerId,listenerRevisions:h}),y)throw new zn(v.status,void 0,v.error,v.error)}l.listenerStatus="SUCCESS"}catch(h){r==null||r(h,o,l),l.listenerStatus=h instanceof zn?h.status:"ERROR"}}}return i}_checkFilter(n,r){const{branch:i,documentId:s,scope:o,documentType:a}=r;return!!((!n.branch||n.branch.includes(i)||n.branch.includes("*"))&&(!n.documentId||n.documentId.includes(s)||n.documentId.includes("*"))&&(!n.scope||n.scope.includes(o)||n.scope.includes("*"))&&(!n.documentType||n.documentType.includes(a)||n.documentType.includes("*")))}getListenerSyncUnits(n,r,i){var a;const s=(a=this.listenerState.get(n))==null?void 0:a.get(r);if(!s)return[];const o=s.listener.filter;return this.drive.getSynchronizationUnits(n,o.documentId??["*"],o.scope??["*"],o.branch??["*"],o.documentType??["*"],i)}getListenerSyncUnitIds(n,r){var o;const i=(o=this.listenerState.get(n))==null?void 0:o.get(r);if(!i)return[];const s=i.listener.filter;return this.drive.getSynchronizationUnitsIds(n,s.documentId??["*"],s.scope??["*"],s.branch??["*"],s.documentType??["*"])}async initDrive(n){const{state:{local:{listeners:r}}}=n;for(const i of r)await this.addListener({block:i.block,driveId:n.state.global.id,filter:{branch:i.filter.branch??[],documentId:i.filter.documentId??[],documentType:i.filter.documentType,scope:i.filter.scope??[]},listenerId:i.listenerId,system:i.system,callInfo:i.callInfo??void 0,label:i.label??""})}async removeDrive(n){this.listenerState.delete(n);const r=this.transmitters[n];r&&await Promise.all(Object.values(r).map(i=>{var s;return(s=i.disconnect)==null?void 0:s.call(i)}))}getListener(n,r){const i=this.listenerState.get(n);if(!i)throw new Error("Drive not found");const s=i.get(r);if(!s)throw new Error("Listener not found");return Promise.resolve(s)}async getStrands(n,r,i){const s=await this.getListener(n,r),o=[],a=await this.drive.getDrive(n),c=await this.getListenerSyncUnits(n,r,a),l=i==null?void 0:i.limit;let u=0;const d=c.map(f=>async()=>{if(l&&u>=l||f.revision<0)return;const p=s.syncUnits.get(f.syncId);if(p&&p.listenerRev>=f.revision)return;const{documentId:h,driveId:m,scope:v,branch:y}=f;try{const g=await this.drive.getOperationData(m,f.syncId,{since:i==null?void 0:i.since,fromRevision:(i==null?void 0:i.fromRevision)??(p==null?void 0:p.listenerRev),limit:l?l-u:void 0},a);if(!g.length)return;u+=g.length,o.push({driveId:m,documentId:h,scope:v,branch:y,operations:g})}catch(g){ct.error(g);return}});if(this.options.sequentialUpdates)for(const f of d)await f();else await Promise.all(d.map(f=>f()));return o}};qe(Fd,"LISTENER_UPDATE_DELAY",250);let th=Fd;function jy(t,e){return e?Object.keys(t).reduce((n,r)=>{const i=e[r];return i!==void 0&&(n[r]=t[r].filter(s=>s.index<=i)),n},{global:[],local:[]}):t}function np(t,e){return!e||Object.entries(e).find(([n,r])=>{const i=t.operations[n].at(-1);return r===-1?i!==void 0:(i==null?void 0:i.index)!==r})===void 0}const sP=5e3;class oP extends VL{constructor(n,r=new AL,i=new iw,s=new ow,o){var a,c;super();qe(this,"emitter",rw());qe(this,"cache");qe(this,"documentModels");qe(this,"storage");qe(this,"listenerStateManager");qe(this,"triggerMap",new Map);qe(this,"syncStatus",new Map);qe(this,"queueManager");qe(this,"initializePromise");qe(this,"defaultDrivesManager");qe(this,"options");qe(this,"defaultDrivesManagerDelegate",{detachDrive:this.detachDrive.bind(this),emit:(...n)=>this.emit("defaultRemoteDrive",...n)});qe(this,"queueDelegate",{checkDocumentExists:(n,r)=>this.storage.checkDocumentExists(n,r),processOperationJob:async({driveId:n,documentId:r,operations:i,options:s})=>r?this.addOperations(n,r,i,s):this.addDriveOperations(n,i,s),processActionJob:async({driveId:n,documentId:r,actions:i,options:s})=>r?this.addActions(n,r,i,s):this.addDriveActions(n,i,s),processJob:async n=>{if(Ou(n))return this.queueDelegate.processOperationJob(n);if(OL(n))return this.queueDelegate.processActionJob(n);throw new Error("Unknown job type",n)}});this.options={...o,defaultDrives:{...o==null?void 0:o.defaultDrives},listenerManager:{...eh,...o==null?void 0:o.listenerManager},taskQueueMethod:(o==null?void 0:o.taskQueueMethod)===void 0?al.runAsap:o.taskQueueMethod},this.listenerStateManager=new th(this,void 0,o==null?void 0:o.listenerManager),this.documentModels=n,this.storage=r,this.cache=i,this.queueManager=s,this.defaultDrivesManager=new ML(this,this.defaultDrivesManagerDelegate,o),(c=(a=this.storage).setStorageDelegate)==null||c.call(a,{getCachedOperations:async(l,u)=>{try{const d=await this.cache.getDocument(l,u);return d==null?void 0:d.operations}catch(d){ct.error(d);return}}}),this.initializePromise=this._initialize()}setDocumentModels(n){this.documentModels=[...n],this.emit("documentModels",[...n])}initializeDefaultRemoteDrives(){return this.defaultDrivesManager.initializeDefaultRemoteDrives()}getDefaultRemoteDrives(){return this.defaultDrivesManager.getDefaultRemoteDrives()}setDefaultDriveAccessLevel(n,r){return this.defaultDrivesManager.setDefaultDriveAccessLevel(n,r)}setAllDefaultDrivesAccessLevel(n){return this.defaultDrivesManager.setAllDefaultDrivesAccessLevel(n)}getOperationSource(n){return n.type==="local"?"push":"pull"}getCombinedSyncUnitStatus(n){if(!n.pull&&!n.push||n.pull==="INITIAL_SYNC")return"INITIAL_SYNC";if(n.push==="INITIAL_SYNC")return n.pull||"INITIAL_SYNC";const r=["ERROR","MISSING","CONFLICT","SYNCING","SUCCESS"];return Object.values(n).sort((s,o)=>r.indexOf(s)-r.indexOf(o))[0]}initSyncStatus(n,r){const i=Object.entries(r).reduce((s,[o,a])=>({...s,[o]:a!=="SYNCING"?a:"INITIAL_SYNC"}),{});this.syncStatus.set(n,i),this.emit("syncStatus",n,this.getCombinedSyncUnitStatus(i),void 0,i)}async initializeDriveSyncStatus(n,r){const i=await this.getSynchronizationUnitsIds(n),s={pull:r.state.local.triggers.length>0?"INITIAL_SYNC":void 0,push:r.state.local.listeners.length>0?"SUCCESS":void 0};if(!s.pull&&!s.push)return;const o=[n,...i.map(a=>a.syncId)];for(const a of o)this.initSyncStatus(a,s)}updateSyncUnitStatus(n,r,i){if(r===null){this.syncStatus.delete(n);return}const s=this.syncStatus.get(n);if(!s){this.initSyncStatus(n,r);return}if(Object.entries(r).some(([a,c])=>s[a]!==c)){const a=Object.entries(r).reduce((u,[d,f])=>({...u,[d]:u[d]==="INITIAL_SYNC"&&f==="SYNCING"?"INITIAL_SYNC":f}),s),c=this.getCombinedSyncUnitStatus(s),l=this.getCombinedSyncUnitStatus(a);this.syncStatus.set(n,a),c!==l&&this.emit("syncStatus",n,this.getCombinedSyncUnitStatus(a),i,a)}}async saveStrand(n,r){const i=n.operations.map(o=>({...o,scope:n.scope,branch:n.branch})),s=await(n.documentId?this.queueOperations(n.driveId,n.documentId,i,{source:r}):this.queueDriveOperations(n.driveId,i,{source:r}));if(s.status==="ERROR"){const o=n.documentId!==""?(await this.getSynchronizationUnitsIds(n.driveId,[n.documentId],[n.scope],[n.branch])).map(c=>c.syncId):[n.driveId],a=this.getOperationSource(r);for(const c of o)this.updateSyncUnitStatus(c,{[a]:s.status},s.error)}return this.emit("strandUpdate",n),s}handleListenerError(n,r,i){ct.error(`Listener ${i.listener.label??i.listener.listenerId} error:`,n);const s=n instanceof zn?n.status:"ERROR";this.updateSyncUnitStatus(r,{push:s},n)}shouldSyncRemoteDrive(n){return n.state.local.availableOffline&&n.state.local.triggers.length>0}async startSyncRemoteDrive(n){const r=await this.getDrive(n);let i=this.triggerMap.get(n);const s=await this.getSynchronizationUnitsIds(n,void 0,void 0,void 0,void 0,r);for(const o of r.state.local.triggers)if(!(i!=null&&i.get(o.id))){i||(i=new Map),this.updateSyncUnitStatus(n,{pull:"SYNCING"});for(const a of s)this.updateSyncUnitStatus(a.syncId,{pull:"SYNCING"});if(bi.isPullResponderTrigger(o)){let a=!0;const c=bi.setupPull(n,o,this.saveStrand.bind(this),l=>{const u=l instanceof zn?l.status:"ERROR";this.updateSyncUnitStatus(n,{pull:u},l),l instanceof Ho&&this.emit("clientStrandsError",n,o,l.response.status,l.message)},l=>{const u=l.filter(f=>f.status!=="SUCCESS");u.length<1&&this.updateSyncUnitStatus(n,{pull:"SUCCESS"});const d=l.filter(f=>f.documentId!=="").map(f=>f.documentId);if(this.getSynchronizationUnitsIds(n,d).then(f=>{for(const p of f){const h=u.find(m=>m.documentId===p.documentId);h?this.updateSyncUnitStatus(p.syncId,{pull:h.status},h.error):this.updateSyncUnitStatus(p.syncId,{pull:"SUCCESS"})}}).catch(console.error),a){a=!1;const f=r.state.local.listeners.find(p=>{var h;return o.data.url===((h=p.callInfo)==null?void 0:h.data)});f&&this.getSynchronizationUnitsRevision(n,s).then(p=>{for(const h of p)this.listenerStateManager.updateListenerRevision(f.listenerId,n,h.syncId,h.revision).catch(ct.error)}).catch(ct.error)}});i.set(o.id,c),this.triggerMap.set(n,i)}}}async stopSyncRemoteDrive(n){const i=(await this.getSynchronizationUnitsIds(n)).filter(o=>o.documentId!=="").map(o=>o.syncId),s=this.triggerMap.get(n);s==null||s.forEach(o=>o()),this.updateSyncUnitStatus(n,null);for(const o of i)this.updateSyncUnitStatus(o,null);return this.triggerMap.delete(n)}initialize(){return this.initializePromise}async _initialize(){await this.queueManager.init(this.queueDelegate,i=>{ct.error("Error initializing queue manager",i),n.push(i)});try{await this.defaultDrivesManager.removeOldremoteDrives()}catch(i){ct.error(i)}const n=[],r=await this.getDrives();for(const i of r)await this._initializeDrive(i).catch(s=>{ct.error(`Error initializing drive ${i}`,s),n.push(s)});return this.options.defaultDrives.loadOnInit!==!1&&await this.defaultDrivesManager.initializeDefaultRemoteDrives(),typeof window<"u"&&window.addEventListener("online",()=>{this.listenerStateManager.triggerUpdate(!1,{type:"local"},this.handleListenerError.bind(this)).catch(i=>{ct.error("Non handled error updating listeners",i)})}),n.length===0?null:n}async _initializeDrive(n){const r=await this.getDrive(n);await this.initializeDriveSyncStatus(n,r),this.shouldSyncRemoteDrive(r)&&await this.startSyncRemoteDrive(n),await this.listenerStateManager.initDrive(r)}async getSynchronizationUnits(n,r,i,s,o,a){const c=a||await this.getDrive(n),l=await this.getSynchronizationUnitsIds(n,r,i,s,o,c);return this.getSynchronizationUnitsRevision(n,l,c)}async getSynchronizationUnitsRevision(n,r,i){const s=i||await this.getDrive(n),o=await this.storage.getSynchronizationUnitsRevision(r),a=r.map(c=>({...c,lastUpdated:s.created,revision:-1}));for(const c of o){const l=a.find(u=>c.driveId===u.driveId&&c.documentId===u.documentId&&c.scope===u.scope&&c.branch===u.branch);l&&(l.revision=c.revision,l.lastUpdated=c.lastUpdated)}return a}async getSynchronizationUnitsIds(n,r,i,s,o,a){const l=(a??await this.getDrive(n)).state.global.nodes.filter(d=>Vn(d)&&(!(r!=null&&r.length)||r.includes(d.id)||r.includes("*"))&&(!(o!=null&&o.length)||o.includes(d.documentType)||o.includes("*")));(!r||r.includes("*")||r.includes(""))&&(!(o!=null&&o.length)||o.includes("powerhouse/document-drive")||o.includes("*"))&&l.unshift({id:"",documentType:"powerhouse/document-drive",synchronizationUnits:[{syncId:"0",scope:"global",branch:"main"}]});const u=[];for(const d of l){const f=i!=null&&i.length||s!=null&&s.length?d.synchronizationUnits.filter(p=>(!(i!=null&&i.length)||i.includes(p.scope)||i.includes("*"))&&(!(s!=null&&s.length)||s.includes(p.branch)||s.includes("*"))):d.synchronizationUnits;f.length&&u.push(...f.map(p=>({driveId:n,documentId:d.id,syncId:p.syncId,documentType:d.documentType,scope:p.scope,branch:p.branch})))}return u}async getSynchronizationUnitIdInfo(n,r,i){const o=(i||await this.getDrive(n)).state.global.nodes.find(c=>Vn(c)&&c.synchronizationUnits.find(l=>l.syncId===r));if(!o||!Vn(o))return;const a=o.synchronizationUnits.find(c=>c.syncId===r);if(a)return{syncId:r,scope:a.scope,branch:a.branch,driveId:n,documentId:o.id,documentType:o.documentType}}async getSynchronizationUnit(n,r,i){const s=await this.getSynchronizationUnitIdInfo(n,r,i);if(!s)return;const{scope:o,branch:a,documentId:c,documentType:l}=s,u=await this.getDocument(n,c),d=u.operations[o]??[],f=d[d.length-1];return{syncId:r,scope:o,branch:a,driveId:n,documentId:c,documentType:l,lastUpdated:(f==null?void 0:f.timestamp)??u.lastModified,revision:(f==null?void 0:f.index)??0}}async getOperationData(n,r,i,s){const o=r==="0"?{documentId:"",scope:"global"}:await this.getSynchronizationUnitIdInfo(n,r,s);if(!o)throw new Error(`Invalid Sync Id ${r} in drive ${n}`);const l=((r==="0"?s||await this.getDrive(n):await this.getDocument(n,o.documentId)).operations[o.scope]??[]).filter(d=>Object.keys(i).length===0||(i.since===void 0||xL(i.since,d.timestamp))&&(i.fromRevision===void 0||d.index>i.fromRevision));return(i.limit?l.slice(0,i.limit):l).map(d=>({hash:d.hash,index:d.index,timestamp:d.timestamp,type:d.type,input:d.input,skip:d.skip,context:d.context,id:d.id}))}getDocumentModel(n){const r=this.documentModels.find(i=>i.documentModel.id===n);if(!r)throw new Error(`Document type ${n} not supported`);return r}getDocumentModels(){return[...this.documentModels]}async addDrive(n){const r=n.global.id||Ym();if(!r)throw new Error("Invalid Drive Id");if((await this.storage.getDrives()).includes(r))throw new wL(r);const s=ol.createDocument({state:n});return await this.storage.createDrive(r,s),n.global.slug&&await this.cache.deleteDocument("drives-slug",n.global.slug),await this._initializeDrive(r),this.emit("driveAdded",s),s}async addRemoteDrive(n,r){const{id:i,name:s,slug:o,icon:a}=r.expectedDriveInfo||await As(n),{pullFilter:c,pullInterval:l,availableOffline:u,sharingType:d,listeners:f,triggers:p}=r,h=await bi.createPullResponderTrigger(i,n,{pullFilter:c,pullInterval:l});return await this.addDrive({global:{id:i,name:s,slug:o,icon:a??null},local:{triggers:[...p,h],listeners:f,availableOffline:u,sharingType:d}})}async registerPullResponderTrigger(n,r,i){return await bi.createPullResponderTrigger(n,r,i)}async deleteDrive(n){(await Promise.allSettled([this.stopSyncRemoteDrive(n),this.listenerStateManager.removeDrive(n),this.cache.deleteDocument("drives",n),this.storage.deleteDrive(n)])).forEach(i=>{if(i.status==="rejected")throw i.reason})}getDrives(){return this.storage.getDrives()}async getDrive(n,r){let i;try{const a=await this.cache.getDocument("drives",n);if(a&&Ds(a)&&(i=a,np(i,r==null?void 0:r.revisions)))return i}catch(a){ct.error("Error getting drive from cache",a)}const s=i??await this.storage.getDrive(n),o=this._buildDocument(s,r);if(Ds(o))return r!=null&&r.revisions||this.cache.setDocument("drives",n,o).catch(ct.error),o;throw new Error(`Document with id ${n} is not a Document Drive`)}async getDriveBySlug(n,r){try{const o=await this.cache.getDocument("drives-slug",n);if(o&&Ds(o))return o}catch(o){ct.error("Error getting drive from cache",o)}const i=await this.storage.getDriveBySlug(n),s=this._buildDocument(i,r);if(Ds(s))return this.cache.setDocument("drives-slug",n,s).catch(ct.error),s;throw new Error(`Document with slug ${n} is not a Document Drive`)}async getDocument(n,r,i){let s;try{if(s=await this.cache.getDocument(n,r),s&&np(s,i==null?void 0:i.revisions))return s}catch(c){ct.error("Error getting document from cache",c)}const o=s??await this.storage.getDocument(n,r),a=this._buildDocument(o,i);return i!=null&&i.revisions||this.cache.setDocument(n,r,a).catch(ct.error),a}getDocuments(n){return this.storage.getDocuments(n)}async createDocument(n,r){let i;if(r.document){if(r.documentType!==r.document.documentType)throw new Error(`Provided document is not ${r.documentType}`);i=this._buildDocument(r.document).state}const s=r.document??this.getDocumentModel(r.documentType).utils.createDocument(),o={name:s.name,revision:s.revision,documentType:s.documentType,created:s.created,lastModified:s.lastModified,operations:{global:[],local:[]},initialState:s.initialState,clipboard:[],state:i??s.state};await this.storage.createDocument(n,r.id,o);for(const c of r.synchronizationUnits)this.initSyncStatus(c.syncId,{pull:this.triggerMap.get(n)?"INITIAL_SYNC":void 0,push:this.listenerStateManager.driveHasListeners(n)?"SUCCESS":void 0});const a=Object.values(s.operations).flat();return a.length&&(Ds(s)?await this.storage.addDriveOperations(n,a,s):await this.storage.addDocumentOperations(n,r.id,a,s)),s}async deleteDocument(n,r){try{const i=await this.getSynchronizationUnitsIds(n,[r]);for(const s of i)this.updateSyncUnitStatus(s.syncId,null);await this.listenerStateManager.removeSyncUnits(n,i)}catch(i){ct.warn("Error deleting document",i)}return await this.cache.deleteDocument(n,r),this.storage.deleteDocument(n,r)}async _processOperations(n,r,i,s){const o=[],a=[],c=await this._addDocumentResultingStage(i,n,r);let l=this._buildDocument(c),u;const d=FL(s);for(const f of Object.keys(d)){const p=i.operations[f],h=UL(d[f]||[],p);if(h.length<1)continue;const m=PL(zL(p)),[v,y]=LL(m,h),_=(y.length<1?v:$L(m,v,BL)).filter(T=>m.length<1||jL(m[m.length-1],T));for(const T of _){let w=!1;if(y.length>0){const E=s.find(R=>R.hash===T.hash);w=!E||E.index!==T.index||E.skip!==T.skip}try{const E=this.options.taskQueueMethod,R=()=>this._performOperation(n,r,l,T,w),j=await(E?IL(R,E):R());l=j.document,a.push(...j.signals),o.push(j.operation)}catch(E){u=E instanceof zn?E:new zn("ERROR",T,E.message,E.cause);break}}}return{document:l,operationsApplied:o,signals:a,error:u}}async _addDocumentResultingStage(n,r,i,s){var c,l,u,d;const o=(s==null?void 0:s.revisions)!==void 0?jy(n.operations,s.revisions):n.operations,a=Ce.documentHelpers.garbageCollectDocumentOperations(o);for(const f of Object.keys(a)){const p=a[f].at(-1);p&&!p.resultingState&&(p.resultingState=await(i?(l=(c=this.storage).getOperationResultingState)==null?void 0:l.call(c,r,i,p.index,p.scope,"main"):(d=(u=this.storage).getDriveOperationResultingState)==null?void 0:d.call(u,r,p.index,p.scope,"main")))}return{...n,operations:a}}_buildDocument(n,r){if(n.state&&(!r||r.checkHashes===!1)&&np(n,r==null?void 0:r.revisions))return n;const i=this.getDocumentModel(n.documentType),s=(r==null?void 0:r.revisions)!==void 0?jy(n.operations,r.revisions):n.operations,o=Ce.documentHelpers.garbageCollectDocumentOperations(s);return Ce.replayDocument(n.initialState,o,i.reducer,void 0,n,void 0,{...r,checkHashes:(r==null?void 0:r.checkHashes)??!0,reuseOperationResultingState:(r==null?void 0:r.checkHashes)??!0})}async _performOperation(n,r,i,s,o=!1){var v,y,g,_;const a=this.getDocumentModel(i.documentType),c=[];let l=i;const u=s.scope,f=Ce.documentHelpers.garbageCollectDocumentOperations({...i.operations,[u]:Ce.documentHelpers.skipHeaderOperations(i.operations[u],s)})[u].at(-1);f&&!f.resultingState&&(f.resultingState=await(r?(y=(v=this.storage).getOperationResultingState)==null?void 0:y.call(v,n,r,f.index,f.scope,"main"):(_=(g=this.storage).getDriveOperationResultingState)==null?void 0:_.call(g,n,f.index,f.scope,"main")));const p=[];l=a.reducer(l,s,T=>{let w;switch(T.type){case"CREATE_CHILD_DOCUMENT":w=()=>this.createDocument(n,T.input);break;case"DELETE_CHILD_DOCUMENT":w=()=>this.deleteDocument(n,T.input.id);break;case"COPY_CHILD_DOCUMENT":w=()=>this.getDocument(n,T.input.id).then(E=>this.createDocument(n,{id:T.input.newId,documentType:E.documentType,document:E,synchronizationUnits:T.input.synchronizationUnits}));break}w&&p.push(()=>w().then(E=>({signal:T,result:E})))},{skip:s.skip,reuseOperationResultingState:!0});const m=l.operations[s.scope].filter(T=>T.index==s.index&&T.skip==s.skip).at(0);if(!m)throw new zn("ERROR",s,`Operation with index ${s.index}:${s.skip} was not applied.`);if(!m.error&&m.hash!==s.hash&&!o)throw new SL(s,m);for(const T of p){const w=await T();c.push(w)}return{document:l,signals:c,operation:m}}addOperation(n,r,i,s){return this.addOperations(n,r,[i],s)}async _addOperations(n,r,i){if(this.storage.addDocumentOperationsWithTransaction)await this.storage.addDocumentOperationsWithTransaction(n,r,i);else{const s=await this.storage.getDocument(n,r),o=await i(s);o.operations.length>0&&await this.storage.addDocumentOperations(n,r,o.operations,o.header)}}queueOperation(n,r,i,s){return this.queueOperations(n,r,[i],s)}async resultIfExistingOperations(n,r,i){try{const s=await this.getDocument(n,r);return i.find(a=>!a.id||!s.operations[a.scope].find(c=>c.id===a.id&&c.index===a.index&&c.type===a.type&&c.hash===a.hash))?void 0:{status:"SUCCESS",document:s,operations:i,signals:[]}}catch(s){s.message.includes(`Document with id ${r} not found`)||console.error(s);return}}async queueOperations(n,r,i,s){const o=await this.resultIfExistingOperations(n,r,i);if(o)return o;try{const a=await this.queueManager.addJob({driveId:n,documentId:r,operations:i,options:s});return new Promise((c,l)=>{const u=this.queueManager.on("jobCompleted",(f,p)=>{f.jobId===a&&(u(),d(),c(p))}),d=this.queueManager.on("jobFailed",(f,p)=>{f.jobId===a&&(u(),d(),l(p))})})}catch(a){throw ct.error("Error adding job",a),a}}async queueAction(n,r,i,s){return this.queueActions(n,r,[i],s)}async queueActions(n,r,i,s){try{const o=await this.queueManager.addJob({driveId:n,documentId:r,actions:i,options:s});return new Promise((a,c)=>{const l=this.queueManager.on("jobCompleted",(d,f)=>{d.jobId===o&&(l(),u(),a(f))}),u=this.queueManager.on("jobFailed",(d,f)=>{d.jobId===o&&(l(),u(),c(f))})})}catch(o){throw ct.error("Error adding job",o),o}}async queueDriveAction(n,r,i){return this.queueDriveActions(n,[r],i)}async queueDriveActions(n,r,i){try{const s=await this.queueManager.addJob({driveId:n,actions:r,options:i});return new Promise((o,a)=>{const c=this.queueManager.on("jobCompleted",(u,d)=>{u.jobId===s&&(c(),l(),o(d))}),l=this.queueManager.on("jobFailed",(u,d)=>{u.jobId===s&&(c(),l(),a(d))})})}catch(s){throw ct.error("Error adding drive job",s),s}}async addOperations(n,r,i,s){const o=await this.resultIfExistingOperations(n,r,i);if(o)return o;let a;const c=[],l=[];let u;try{await this._addOperations(n,r,async y=>{const g=await this._processOperations(n,r,y,i);if(!g.document)throw ct.error("Invalid document"),g.error??new Error("Invalid document");return a=g.document,u=g.error,l.push(...g.signals),c.push(...g.operationsApplied),{operations:g.operationsApplied,header:g.document,newState:a.state}}),a&&this.cache.setDocument(n,r,a).catch(ct.error);const{scopes:d,branches:f}=c.reduce((y,g)=>(y.scopes.includes(g.scope)||y.scopes.push(g.scope),y),{scopes:[],branches:["main"]}),p=await this.getSynchronizationUnits(n,[r],d,f),m=c.find(y=>!i.find(g=>g.id===y.id&&g.index===y.index&&g.skip===y.skip&&g.hash===y.hash))?{type:"local"}:(s==null?void 0:s.source)??{type:"local"},v=this.getOperationSource(m);if(this.listenerStateManager.updateSynchronizationRevisions(n,p,m,()=>{this.updateSyncUnitStatus(n,{[v]:"SYNCING"});for(const y of p)this.updateSyncUnitStatus(y.syncId,{[v]:"SYNCING"})},this.handleListenerError.bind(this),(s==null?void 0:s.forceSync)??m.type==="local").then(y=>{y.length&&this.updateSyncUnitStatus(n,{[v]:"SUCCESS"});for(const g of p)this.updateSyncUnitStatus(g.syncId,{[v]:"SUCCESS"})}).catch(y=>{ct.error("Non handled error updating sync revision",y),this.updateSyncUnitStatus(n,{[v]:"ERROR"},y);for(const g of p)this.updateSyncUnitStatus(g.syncId,{[v]:"ERROR"},y)}),u)throw u;return{status:"SUCCESS",document:a,operations:c,signals:l}}catch(d){const f=d instanceof zn?d:new zn("ERROR",void 0,d.message,d.cause);return{status:f.status,error:f,document:a,operations:c,signals:l}}}addDriveOperation(n,r,i){return this.addDriveOperations(n,[r],i)}async clearStorage(){var n,r;for(const i of await this.getDrives())await this.deleteDrive(i);await((r=(n=this.storage).clearStorage)==null?void 0:r.call(n))}async _addDriveOperations(n,r){if(this.storage.addDriveOperationsWithTransaction)return this.storage.addDriveOperationsWithTransaction(n,r);{const i=await this.storage.getDrive(n),s=await r(i);return s.operations.length>0&&await this.storage.addDriveOperations(n,s.operations,s.header),s}}queueDriveOperation(n,r,i){return this.queueDriveOperations(n,[r],i)}async resultIfExistingDriveOperations(n,r){try{const i=await this.getDrive(n);return r.find(o=>!o.id||!i.operations[o.scope].find(a=>a.id===o.id&&a.index===o.index&&a.type===o.type&&a.hash===o.hash))?void 0:{status:"SUCCESS",document:i,operations:r,signals:[]}}catch(i){console.error(i);return}}async queueDriveOperations(n,r,i){const s=await this.resultIfExistingDriveOperations(n,r);if(s)return s;try{const o=await this.queueManager.addJob({driveId:n,operations:r,options:i});return new Promise((a,c)=>{const l=this.queueManager.on("jobCompleted",(d,f)=>{d.jobId===o&&(l(),u(),a(f))}),u=this.queueManager.on("jobFailed",(d,f)=>{d.jobId===o&&(l(),u(),c(f))})})}catch(o){throw ct.error("Error adding drive job",o),o}}async addDriveOperations(n,r,i){let s;const o=[],a=[];let c;const l=await this.resultIfExistingDriveOperations(n,r);if(l)return l;try{if(await this._addDriveOperations(n,async d=>{const f=await this._processOperations(n,void 0,d,r.slice());return s=f.document,o.push(...f.operationsApplied),a.push(...f.signals),c=f.error,{operations:f.operationsApplied,header:f.document}}),!s||!Ds(s))throw c??new Error("Invalid Document Drive document");this.cache.setDocument("drives",n,s).catch(ct.error);for(const d of o)switch(d.type){case"ADD_LISTENER":{await this.addListener(n,d);break}case"REMOVE_LISTENER":{await this.removeListener(n,d);break}}const u=o.filter(d=>d.scope==="global").slice().pop();if(u){const f=o.find(h=>!r.find(m=>m.id===h.id&&m.index===h.index&&m.skip===h.skip&&m.hash===h.hash))?{type:"local"}:(i==null?void 0:i.source)??{type:"local"},p=this.getOperationSource(f);this.listenerStateManager.updateSynchronizationRevisions(n,[{syncId:"0",driveId:n,documentId:"",scope:"global",branch:"main",documentType:"powerhouse/document-drive",lastUpdated:u.timestamp,revision:u.index}],f,()=>{this.updateSyncUnitStatus(n,{[p]:"SYNCING"})},this.handleListenerError.bind(this),(i==null?void 0:i.forceSync)??f.type==="local").then(h=>{h.length&&this.updateSyncUnitStatus(n,{[p]:"SUCCESS"})}).catch(h=>{ct.error("Non handled error updating sync revision",h),this.updateSyncUnitStatus(n,{[p]:"ERROR"},h)})}if(this.shouldSyncRemoteDrive(s)?this.startSyncRemoteDrive(s.state.global.id):this.stopSyncRemoteDrive(s.state.global.id),c)throw c;return{status:"SUCCESS",document:s,operations:o,signals:a}}catch(u){const d=u instanceof zn?u:new zn("ERROR",void 0,u.message,u.cause);return{status:d.status,error:d,document:s,operations:o,signals:a}}}_buildOperations(n,r){const i=[],{reducer:s}=this.getDocumentModel(n.documentType);for(const o of r){n=s(n,o);const a=n.operations[o.scope].slice().pop();if(!a)throw new Error("Error creating operations");i.push(a)}return i}async addAction(n,r,i,s){return this.addActions(n,r,[i],s)}async addActions(n,r,i,s){const o=await this.getDocument(n,r),a=this._buildOperations(o,i);return this.addOperations(n,r,a,s)}async addDriveAction(n,r,i){return this.addDriveActions(n,[r],i)}async addDriveActions(n,r,i){const s=await this.getDrive(n),o=this._buildOperations(s,r);return await this.addDriveOperations(n,o,i)}async addInternalListener(n,r,i){const s={callInfo:{data:"",name:"Interal",transmitterType:"Internal"},system:!0,...i};await this.addDriveAction(n,Tn.addListener({listener:s}));const o=await this.getTransmitter(n,i.listenerId);if(!o)throw ct.error("Internal listener not found"),new Error("Internal listener not found");if(!(o instanceof cw))throw ct.error("Listener is not an internal transmitter"),new Error("Listener is not an internal transmitter");return o.setReceiver(r),o}async detachDrive(n){const r=await this.getDrive(n),i=r.state.local.listeners||[],s=r.state.local.triggers||[];for(const o of i)await this.addDriveAction(n,Tn.removeListener({listenerId:o.listenerId}));for(const o of s)await this.addDriveAction(n,Tn.removeTrigger({triggerId:o.id}));await this.addDriveAction(n,Tn.setSharingType({type:"LOCAL"}))}async addListener(n,r){var s,o,a;const{listener:i}=r.input;await this.listenerStateManager.addListener({...i,driveId:n,label:i.label??"",system:i.system??!1,filter:{branch:i.filter.branch??[],documentId:i.filter.documentId??[],documentType:i.filter.documentType??[],scope:i.filter.scope??[]},callInfo:{data:((s=i.callInfo)==null?void 0:s.data)??"",name:((o=i.callInfo)==null?void 0:o.name)??"PullResponder",transmitterType:((a=i.callInfo)==null?void 0:a.transmitterType)??"PullResponder"}})}async removeListener(n,r){const{listenerId:i}=r.input;await this.listenerStateManager.removeListener(n,i)}getTransmitter(n,r){return this.listenerStateManager.getTransmitter(n,r)}getListener(n,r){return this.listenerStateManager.getListener(n,r)}getSyncStatus(n){const r=this.syncStatus.get(n);return r?this.getCombinedSyncUnitStatus(r):new sw(`Sync status not found for syncUnitId: ${n}`,n)}on(n,r){return this.emitter.on(n,r)}emit(n,...r){return this.emitter.emit(n,...r)}}const aP=NL(oP),uw=Object.prototype.toString;function Go(t){switch(uw.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Ai(t,Error)}}function Ia(t,e){return uw.call(t)===`[object ${e}]`}function Jm(t){return Ia(t,"ErrorEvent")}function Uy(t){return Ia(t,"DOMError")}function cP(t){return Ia(t,"DOMException")}function Xr(t){return Ia(t,"String")}function Xm(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Km(t){return t===null||Xm(t)||typeof t!="object"&&typeof t!="function"}function Qs(t){return Ia(t,"Object")}function Gd(t){return typeof Event<"u"&&Ai(t,Event)}function lP(t){return typeof Element<"u"&&Ai(t,Element)}function uP(t){return Ia(t,"RegExp")}function Yd(t){return!!(t&&t.then&&typeof t.then=="function")}function dP(t){return Qs(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function dw(t){return typeof t=="number"&&t!==t}function Ai(t,e){try{return t instanceof e}catch{return!1}}function fw(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Yo(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function dd(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{fw(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function fP(t,e,n=!1){return Xr(t)?uP(e)?e.test(t):Xr(e)?n?t===e:t.includes(e):!1:!1}function xa(t,e=[],n=!1){return e.some(r=>fP(t,r,n))}function pP(t,e,n=250,r,i,s,o){if(!s.exception||!s.exception.values||!o||!Ai(o.originalException,Error))return;const a=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;a&&(s.exception.values=hP(nh(t,e,i,o.originalException,r,s.exception.values,a,0),n))}function nh(t,e,n,r,i,s,o,a){if(s.length>=n+1)return s;let c=[...s];if(Ai(r[i],Error)){By(o,a);const l=t(e,r[i]),u=c.length;zy(l,i,u,a),c=nh(t,e,n,r[i],i,[l,...c],l,u)}return Array.isArray(r.errors)&&r.errors.forEach((l,u)=>{if(Ai(l,Error)){By(o,a);const d=t(e,l),f=c.length;zy(d,`errors[${u}]`,f,a),c=nh(t,e,n,l,i,[d,...c],d,f)}}),c}function By(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function zy(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function hP(t,e){return t.map(n=>(n.value&&(n.value=Yo(n.value,e)),n))}function Ql(t){return t&&t.Math==Math?t:void 0}const Et=typeof globalThis=="object"&&Ql(globalThis)||typeof window=="object"&&Ql(window)||typeof self=="object"&&Ql(self)||typeof global=="object"&&Ql(global)||function(){return this}()||{};function Qm(){return Et}function pw(t,e,n){const r=n||Et,i=r.__SENTRY__=r.__SENTRY__||{};return i[t]||(i[t]=e())}const Jo=Qm(),mP=80;function ps(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let s=0,o=0;const a=" > ",c=a.length;let l;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||mP;for(;n&&s++<r&&(l=gP(n,u),!(l==="html"||s>1&&o+i.length*c+l.length>=d));)i.push(l),o+=l.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function gP(t,e){const n=t,r=[];let i,s,o,a,c;if(!n||!n.tagName)return"";if(Jo.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const l=e&&e.length?e.filter(d=>n.getAttribute(d)).map(d=>[d,n.getAttribute(d)]):null;if(l&&l.length)l.forEach(d=>{r.push(`[${d[0]}="${d[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&Xr(i))for(s=i.split(/\s+/),c=0;c<s.length;c++)r.push(`.${s[c]}`);const u=["aria-label","type","name","title","alt"];for(c=0;c<u.length;c++)o=u[c],a=n.getAttribute(o),a&&r.push(`[${o}="${a}"]`);return r.join("")}function yP(){try{return Jo.document.location.href}catch{return""}}function vP(t){return Jo.document&&Jo.document.querySelector?Jo.document.querySelector(t):null}function hw(t){if(!Jo.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement&&e.dataset.sentryComponent)return e.dataset.sentryComponent;e=e.parentNode}return null}const Oa=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,_P="Sentry Logger ",fd=["debug","info","warn","error","log","assert","trace"],pd={};function eo(t){if(!("console"in Et))return t();const e=Et.console,n={},r=Object.keys(pd);r.forEach(i=>{const s=pd[i];n[i]=e[i],e[i]=s});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}function bP(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Oa?fd.forEach(n=>{e[n]=(...r)=>{t&&eo(()=>{Et.console[n](`${_P}[${n}]:`,...r)})}}):fd.forEach(n=>{e[n]=()=>{}}),e}const le=bP(),EP=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function SP(t){return t==="http"||t==="https"}function Da(t,e=!1){const{host:n,path:r,pass:i,port:s,projectId:o,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${o}`}function wP(t){const e=EP.exec(t);if(!e){eo(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,i="",s,o="",a]=e.slice(1);let c="",l=a;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const d=l.match(/^\d+/);d&&(l=d[0])}return mw({host:s,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function mw(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function TP(t){if(!Oa)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(le.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?SP(r)?e&&isNaN(parseInt(e,10))?(le.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(le.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(le.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function IP(t){const e=typeof t=="string"?wP(t):mw(t);if(!(!e||!TP(e)))return e}class qr extends Error{constructor(e,n="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}function gn(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&gw(i,r),t[e]=i}function hs(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Oa&&le.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function gw(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,hs(t,"__sentry_original__",e)}catch{}}function eg(t){return t.__sentry_original__}function xP(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function yw(t){if(Go(t))return{message:t.message,name:t.name,stack:t.stack,...Hy(t)};if(Gd(t)){const e={type:t.type,target:Vy(t.target),currentTarget:Vy(t.currentTarget),...Hy(t)};return typeof CustomEvent<"u"&&Ai(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Vy(t){try{return lP(t)?ps(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Hy(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function OP(t,e=40){const n=Object.keys(yw(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return Yo(n[0],e);for(let r=n.length;r>0;r--){const i=n.slice(0,r).join(", ");if(!(i.length>e))return r===n.length?i:Yo(i,e)}return""}function Mn(t){return rh(t,new Map)}function rh(t,e){if(DP(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const i of Object.keys(t))typeof t[i]<"u"&&(r[i]=rh(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(i=>{r.push(rh(i,e))}),r}return t}function DP(t){if(!Qs(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const vw=50,Wy=/\(error: (.*)\)/,qy=/captureMessage|captureException/;function _w(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{const i=[],s=n.split(`
|
|
403
|
-
`);for(let o=r;o<s.length;o++){const a=s[o];if(a.length>1024)continue;const c=Wy.test(a)?a.replace(Wy,"$1"):a;if(!c.match(/\S*Error: /)){for(const l of e){const u=l(c);if(u){i.push(u);break}}if(i.length>=vw)break}}return kP(i)}}function RP(t){return Array.isArray(t)?_w(...t):t}function kP(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),qy.test(e[e.length-1].function||"")&&(e.pop(),qy.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,vw).map(n=>({...n,filename:n.filename||e[e.length-1].filename,function:n.function||"?"}))}const rp="<anonymous>";function Ci(t){try{return!t||typeof t!="function"?rp:t.name||rp}catch{return rp}}const ku={},Zy={};function fo(t,e){ku[t]=ku[t]||[],ku[t].push(e)}function po(t,e){Zy[t]||(e(),Zy[t]=!0)}function kr(t,e){const n=t&&ku[t];if(n)for(const r of n)try{r(e)}catch(i){Oa&&le.error(`Error while triggering instrumentation handler.
|
|
404
|
-
Type: ${t}
|
|
405
|
-
Name: ${Ci(r)}
|
|
406
|
-
Error:`,i)}}function bw(t){const e="console";fo(e,t),po(e,NP)}function NP(){"console"in Et&&fd.forEach(function(t){t in Et.console&&gn(Et.console,t,function(e){return pd[t]=e,function(...n){kr("console",{args:n,level:t});const i=pd[t];i&&i.apply(Et.console,n)}})})}function en(){const t=Et,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function Ew(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Xi(t){const{message:e,event_id:n}=t;if(e)return e;const r=Ew(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ih(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function to(t,e){const n=Ew(t);if(!n)return;const r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...e},e&&"data"in e){const s={...i&&i.data,...e.data};n.mechanism.data=s}}function Gy(t){if(t&&t.__sentry_captured__)return!0;try{hs(t,"__sentry_captured__",!0)}catch{}return!1}function Sw(t){return Array.isArray(t)?t:[t]}const No=Et,AP=1e3;let Yy,sh,oh;function ww(t){const e="dom";fo(e,t),po(e,CP)}function CP(){if(!No.document)return;const t=kr.bind(null,"dom"),e=Jy(t,!0);No.document.addEventListener("click",e,!1),No.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=No[n]&&No[n].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(gn(r,"addEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},u=l[s]=l[s]||{refCount:0};if(!u.handler){const d=Jy(t);u.handler=d,i.call(this,s,d,a)}u.refCount++}catch{}return i.call(this,s,o,a)}}),gn(r,"removeEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__||{},u=l[s];u&&(u.refCount--,u.refCount<=0&&(i.call(this,s,u.handler,a),u.handler=void 0,delete l[s]),Object.keys(l).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,a)}}))})}function MP(t){if(t.type!==sh)return!1;try{if(!t.target||t.target._sentryId!==oh)return!1}catch{}return!0}function LP(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Jy(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=PP(n);if(LP(n.type,r))return;hs(n,"_sentryCaptured",!0),r&&!r._sentryId&&hs(r,"_sentryId",en());const i=n.type==="keypress"?"input":n.type;MP(n)||(t({event:n,name:i,global:e}),sh=n.type,oh=r?r._sentryId:void 0),clearTimeout(Yy),Yy=No.setTimeout(()=>{oh=void 0,sh=void 0},AP)}}function PP(t){try{return t.target}catch{return null}}const ah=Qm();function Tw(){if(!("fetch"in ah))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function ch(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Iw(){if(typeof EdgeRuntime=="string")return!0;if(!Tw())return!1;if(ch(ah.fetch))return!0;let t=!1;const e=ah.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=ch(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){Oa&&le.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function Jd(t){const e="fetch";fo(e,t),po(e,FP)}function FP(){Iw()&&gn(Et,"fetch",function(t){return function(...e){const{method:n,url:r}=$P(e),i={args:e,fetchData:{method:n,url:r},startTimestamp:Date.now()};return kr("fetch",{...i}),t.apply(Et,e).then(s=>{const o={...i,endTimestamp:Date.now(),response:s};return kr("fetch",o),s},s=>{const o={...i,endTimestamp:Date.now(),error:s};throw kr("fetch",o),s})}})}function lh(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Xy(t){return typeof t=="string"?t:t?lh(t,"url")?t.url:t.toString?t.toString():"":""}function $P(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:Xy(n),method:lh(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:Xy(e),method:lh(e,"method")?String(e.method).toUpperCase():"GET"}}let eu=null;function xw(t){const e="error";fo(e,t),po(e,jP)}function jP(){eu=Et.onerror,Et.onerror=function(t,e,n,r,i){return kr("error",{column:r,error:i,line:n,msg:t,url:e}),eu&&!eu.__SENTRY_LOADER__?eu.apply(this,arguments):!1},Et.onerror.__SENTRY_INSTRUMENTED__=!0}let tu=null;function Ow(t){const e="unhandledrejection";fo(e,t),po(e,UP)}function UP(){tu=Et.onunhandledrejection,Et.onunhandledrejection=function(t){return kr("unhandledrejection",t),tu&&!tu.__SENTRY_LOADER__?tu.apply(this,arguments):!0},Et.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const nu=Qm();function BP(){const t=nu.chrome,e=t&&t.app&&t.app.runtime,n="history"in nu&&!!nu.history.pushState&&!!nu.history.replaceState;return!e&&n}const ja=Et;let ru;function Xd(t){const e="history";fo(e,t),po(e,zP)}function zP(){if(!BP())return;const t=ja.onpopstate;ja.onpopstate=function(...n){const r=ja.location.href,i=ru;if(ru=r,kr("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}};function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const s=ru,o=String(i);ru=o,kr("history",{from:s,to:o})}return n.apply(this,r)}}gn(ja.history,"pushState",e),gn(ja.history,"replaceState",e)}const VP=Et,Ei="__sentry_xhr_v3__";function Kd(t){const e="xhr";fo(e,t),po(e,HP)}function HP(){if(!VP.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;gn(t,"open",function(e){return function(...n){const r=Date.now(),i=Xr(n[0])?n[0].toUpperCase():void 0,s=WP(n[1]);if(!i||!s)return e.apply(this,n);this[Ei]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const a=this[Ei];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}const c={args:[i,s],endTimestamp:Date.now(),startTimestamp:r,xhr:this};kr("xhr",c)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?gn(this,"onreadystatechange",function(a){return function(...c){return o(),a.apply(this,c)}}):this.addEventListener("readystatechange",o),gn(this,"setRequestHeader",function(a){return function(...c){const[l,u]=c,d=this[Ei];return d&&Xr(l)&&Xr(u)&&(d.request_headers[l.toLowerCase()]=u),a.apply(this,c)}}),e.apply(this,n)}}),gn(t,"send",function(e){return function(...n){const r=this[Ei];if(!r)return e.apply(this,n);n[0]!==void 0&&(r.body=n[0]);const i={args:[r.method,r.url],startTimestamp:Date.now(),xhr:this};return kr("xhr",i),e.apply(this,n)}})}function WP(t){if(Xr(t))return t;try{return t.toString()}catch{}}function qP(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function ZP(){return"npm"}function GP(){return!qP()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Ky(){return typeof window<"u"&&(!GP()||YP())}function YP(){return Et.process!==void 0&&Et.process.type==="renderer"}function JP(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(i){if(t)return e.has(i)?!0:(e.add(i),!1);for(let s=0;s<e.length;s++)if(e[s]===i)return!0;return e.push(i),!1}function r(i){if(t)e.delete(i);else for(let s=0;s<e.length;s++)if(e[s]===i){e.splice(s,1);break}}return[n,r]}function Sr(t,e=100,n=1/0){try{return uh("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Dw(t,e=3,n=100*1024){const r=Sr(t,e);return e2(r)>n?Dw(t,e-1,n):r}function uh(t,e,n=1/0,r=1/0,i=JP()){const[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!dw(e))return e;const a=XP(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const p=l.toJSON();return uh("",p,c-1,r,i)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const f=yw(e);for(const p in f){if(!Object.prototype.hasOwnProperty.call(f,p))continue;if(d>=r){u[p]="[MaxProperties ~]";break}const h=f[p];u[p]=uh(p,h,c-1,r,i),d++}return o(e),u}function XP(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(fw(e))return"[VueViewModel]";if(dP(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${Ci(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=KP(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function KP(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function QP(t){return~-encodeURI(t).split(/%..|./).length}function e2(t){return QP(JSON.stringify(t))}var hi;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(hi||(hi={}));function la(t){return new Xn(e=>{e(t)})}function tg(t){return new Xn((e,n)=>{n(t)})}class Xn{constructor(e){Xn.prototype.__init.call(this),Xn.prototype.__init2.call(this),Xn.prototype.__init3.call(this),Xn.prototype.__init4.call(this),this._state=hi.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Xn((r,i)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(o){i(o)}},s=>{if(!n)i(s);else try{r(n(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Xn((n,r)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){r(i);return}n(i)})})}__init(){this._resolve=e=>{this._setResult(hi.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(hi.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===hi.PENDING){if(Yd(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===hi.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===hi.RESOLVED&&n[1](this._value),this._state===hi.REJECTED&&n[2](this._value),n[0]=!0)})}}}function t2(t){const e=[];function n(){return t===void 0||e.length<t}function r(o){return e.splice(e.indexOf(o),1)[0]}function i(o){if(!n())return tg(new qr("Not adding Promise because buffer limit was reached."));const a=o();return e.indexOf(a)===-1&&e.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function s(o){return new Xn((a,c)=>{let l=e.length;if(!l)return a(!0);const u=setTimeout(()=>{o&&o>0&&a(!1)},o);e.forEach(d=>{la(d).then(()=>{--l||(clearTimeout(u),a(!0))},c)})})}return{$:e,add:i,drain:s}}function Us(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const n2=["fatal","error","warning","log","info","debug"];function Rw(t){return t==="warn"?"warning":n2.includes(t)?t:"log"}const kw=1e3;function kl(){return Date.now()/kw}function r2(){const{performance:t}=Et;if(!t||!t.now)return kl;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/kw}const Nl=r2(),nr=(()=>{const{performance:t}=Et;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=i<e,o=t.timing&&t.timing.navigationStart,c=typeof o=="number"?Math.abs(o+n-r):e,l=c<e;return s||l?i<=c?t.timeOrigin:o:r})(),dh="baggage",Nw="sentry-",i2=/^sentry-/,s2=8192;function o2(t){if(!Xr(t)&&!Array.isArray(t))return;let e={};if(Array.isArray(t))e=t.reduce((r,i)=>{const s=Qy(i);for(const o of Object.keys(s))r[o]=s[o];return r},{});else{if(!t)return;e=Qy(t)}const n=Object.entries(e).reduce((r,[i,s])=>{if(i.match(i2)){const o=i.slice(Nw.length);r[o]=s}return r},{});if(Object.keys(n).length>0)return n}function Aw(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,i])=>(i&&(n[`${Nw}${r}`]=i),n),{});return a2(e)}function Qy(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(e[n]=r,e),{})}function a2(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],i)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,o=i===0?s:`${e},${s}`;return o.length>s2?(Oa&&le.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):o},"")}const c2=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function l2(t){if(!t)return;const e=t.match(c2);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function u2(t,e){const n=l2(t),r=o2(e),{traceId:i,parentSpanId:s,parentSampled:o}=n||{};return n?{traceId:i||en(),parentSpanId:s||en().substring(16),spanId:en().substring(16),sampled:o,dsc:r||{}}:{traceId:i||en(),spanId:en().substring(16)}}function ng(t=en(),e=en().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t,e=[]){return[t,e]}function d2(t,e){const[n,r]=t;return[n,[...r,e]]}function ev(t,e){const n=t[1];for(const r of n){const i=r[0].type;if(e(r,i))return!0}return!1}function fh(t,e){return(e||new TextEncoder).encode(t)}function f2(t,e){const[n,r]=t;let i=JSON.stringify(n);function s(o){typeof i=="string"?i=typeof o=="string"?i+o:[fh(i,e),o]:i.push(typeof o=="string"?fh(o,e):o)}for(const o of r){const[a,c]=o;if(s(`
|
|
407
|
-
${JSON.stringify(a)}
|
|
408
|
-
`),typeof c=="string"||c instanceof Uint8Array)s(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(Sr(c))}s(l)}}return typeof i=="string"?i:p2(i)}function p2(t){const e=t.reduce((i,s)=>i+s.length,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function h2(t,e){const n=typeof t.data=="string"?fh(t.data,e):t.data;return[Mn({type:"attachment",length:n.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),n]}const m2={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function tv(t){return m2[t]}function rg(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Cw(t,e,n,r){const i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Da(r)},...i&&{trace:Mn({...i})}}}function g2(t,e,n){const r=[{type:"client_report"},{timestamp:kl(),discarded_events:t}];return ys(e?{dsn:e}:{},[r])}const y2=60*1e3;function v2(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?y2:r-e}function _2(t,e){return t[e]||t.all||0}function Mw(t,e,n=Date.now()){return _2(t,e)>n}function Lw(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},s=n&&n["x-sentry-rate-limits"],o=n&&n["retry-after"];if(s)for(const a of s.trim().split(",")){const[c,l,,,u]=a.split(":",5),d=parseInt(c,10),f=(isNaN(d)?60:d)*1e3;if(!l)i.all=r+f;else for(const p of l.split(";"))p==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(i[p]=r+f):i[p]=r+f}else o?i.all=r+v2(o,r):e===429&&(i.all=r+60*1e3);return i}function b2(t,e){return t??e()}function ip(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}const Ge=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Qd="production";function ig(){return pw("globalEventProcessors",()=>[])}function E2(t){ig().push(t)}function hd(t,e,n,r=0){return new Xn((i,s)=>{const o=t[r];if(e===null||typeof o!="function")i(e);else{const a=o({...e},n);Ge&&o.id&&a===null&&le.log(`Event processor "${o.id}" dropped event`),Yd(a)?a.then(c=>hd(t,c,n,r+1).then(i)).then(null,s):hd(t,a,n,r+1).then(i).then(null,s)}})}function Pw(t){const e=Nl(),n={sid:en(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>S2(n)};return t&&no(n,t),n}function no(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Nl(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:en()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Fw(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),no(t,n)}function S2(t){return Mn({sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}const w2=0,$w=1;function sg(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:i,parent_span_id:s,status:o,tags:a,origin:c}=sn(t);return Mn({data:r,op:i,parent_span_id:s,span_id:e,status:o,tags:a,trace_id:n,origin:c})}function ef(t){const{traceId:e,spanId:n}=t.spanContext(),r=og(t);return ng(e,n,r)}function tf(t){return typeof t=="number"?nv(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?nv(t.getTime()):Nl()}function nv(t){return t>9999999999?t/1e3:t}function sn(t){return T2(t)?t.getSpanJSON():typeof t.toJSON=="function"?t.toJSON():{}}function T2(t){return typeof t.getSpanJSON=="function"}function og(t){const{traceFlags:e}=t.spanContext();return!!(e&$w)}function jw(t,e,n,r,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||en(),timestamp:e.timestamp||kl()},l=n.integrations||t.integrations.map(v=>v.name);I2(c,t),D2(c,l),e.type===void 0&&x2(c,t.stackParser);const u=k2(r,n.captureContext);n.mechanism&&to(c,n.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],f=V2().getScopeData();if(s){const v=s.getScopeData();av(f,v)}if(u){const v=u.getScopeData();av(f,v)}const p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Vw(c,f);const h=[...d,...ig(),...f.eventProcessors];return hd(h,c,n).then(v=>(v&&O2(v),typeof o=="number"&&o>0?R2(v,o,a):v))}function I2(t,e){const{environment:n,release:r,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?n:Qd),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=Yo(t.message,s));const o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=Yo(o.value,s));const a=t.request;a&&a.url&&(a.url=Yo(a.url,s))}const rv=new WeakMap;function x2(t,e){const n=Et._sentryDebugIds;if(!n)return;let r;const i=rv.get(e);i?r=i:(r=new Map,rv.set(e,r));const s=Object.keys(n).reduce((o,a)=>{let c;const l=r.get(a);l?c=l:(c=e(a),r.set(a,c));for(let u=c.length-1;u>=0;u--){const d=c[u];if(d.filename){o[d.filename]=n[a];break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=s[a.filename])})})}catch{}}function O2(t){const e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.keys(e).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:e[r]})})}function D2(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function R2(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>({...i,...i.data&&{data:Sr(i.data,e,n)}}))},...t.user&&{user:Sr(t.user,e,n)},...t.contexts&&{contexts:Sr(t.contexts,e,n)},...t.extra&&{extra:Sr(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Sr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(i=>{const s=sn(i).data;return s&&(i.data=Sr(s,e,n)),i})),r}function k2(t,e){if(!e)return t;const n=t?t.clone():new Ii;return n.update(e),n}function N2(t){if(t)return A2(t)?{captureContext:t}:M2(t)?{captureContext:t}:t}function A2(t){return t instanceof Ii||typeof t=="function"}const C2=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function M2(t){return Object.keys(t).some(e=>C2.includes(e))}function Al(t,e){return In().captureException(t,N2(e))}function iv(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return In().captureMessage(t,n,r)}function nf(t,e){return In().captureEvent(t,e)}function ms(t,e){In().addBreadcrumb(t,e)}function L2(t,e){In().setContext(t,e)}function P2(t){In().setUser(t)}function Uw(...t){const e=In();if(t.length===2){const[n,r]=t;return n?e.withScope(()=>(e.getStackTop().scope=n,r(n))):e.withScope(r)}return e.withScope(t[0])}function wt(){return In().getClient()}function rr(){return In().getScope()}function sv(t){const e=wt(),n=vs(),r=rr(),{release:i,environment:s=Qd}=e&&e.getOptions()||{},{userAgent:o}=Et.navigator||{},a=Pw({release:i,environment:s,user:r.getUser()||n.getUser(),...o&&{userAgent:o},...t}),c=n.getSession();return c&&c.status==="ok"&&no(c,{status:"exited"}),Bw(),n.setSession(a),r.setSession(a),a}function Bw(){const t=vs(),e=rr(),n=e.getSession()||t.getSession();n&&Fw(n),zw(),t.setSession(),e.setSession()}function zw(){const t=vs(),e=rr(),n=wt(),r=e.getSession()||t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function ov(t=!1){if(t){Bw();return}zw()}function md(t){return t.transaction}function rf(t,e,n){const r=e.getOptions(),{publicKey:i}=e.getDsn()||{},{segment:s}=n&&n.getUser()||{},o=Mn({environment:r.environment||Qd,release:r.release,user_segment:s,public_key:i,trace_id:t});return e.emit&&e.emit("createDsc",o),o}function ua(t){const e=wt();if(!e)return{};const n=rf(sn(t).trace_id||"",e,rr()),r=md(t);if(!r)return n;const i=r&&r._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:s,source:o}=r.metadata;s!=null&&(n.sample_rate=`${s}`);const a=sn(r);return o&&o!=="url"&&(n.transaction=a.description),n.sampled=String(og(r)),e.emit&&e.emit("createDsc",n),n}function Vw(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=e;F2(t,e),r&&U2(t,r),B2(t,n),$2(t,i),j2(t,s)}function av(t,e){const{extra:n,tags:r,user:i,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:f,transactionName:p,span:h}=e;Ua(t,"extra",n),Ua(t,"tags",r),Ua(t,"user",i),Ua(t,"contexts",s),Ua(t,"sdkProcessingMetadata",a),o&&(t.level=o),p&&(t.transactionName=p),h&&(t.span=h),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...f}}function Ua(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function F2(t,e){const{extra:n,tags:r,user:i,contexts:s,level:o,transactionName:a}=e,c=Mn(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});const l=Mn(r);l&&Object.keys(l).length&&(t.tags={...l,...t.tags});const u=Mn(i);u&&Object.keys(u).length&&(t.user={...u,...t.user});const d=Mn(s);d&&Object.keys(d).length&&(t.contexts={...d,...t.contexts}),o&&(t.level=o),a&&(t.transaction=a)}function $2(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function j2(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function U2(t,e){t.contexts={trace:sg(e),...t.contexts};const n=md(e);if(n){t.sdkProcessingMetadata={dynamicSamplingContext:ua(e),...t.sdkProcessingMetadata};const r=sn(n).description;r&&(t.tags={transaction:r,...t.tags})}}function B2(t,e){t.fingerprint=t.fingerprint?Sw(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}const z2=100;let sp;class Ii{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=cv()}static clone(e){return e?e.clone():new Ii}clone(){const e=new Ii;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&no(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e;if(n instanceof Ii){const r=n.getScopeData();this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&Object.keys(r.user).length&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint.length&&(this._fingerprint=r.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),r.propagationContext&&(this._propagationContext=r.propagationContext)}else if(Qs(n)){const r=e;this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint&&(this._fingerprint=r.fingerprint),r.requestSession&&(this._requestSession=r.requestSession),r.propagationContext&&(this._propagationContext=r.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=cv(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:z2;if(r<=0)return this;const i={timestamp:kl(),...e},s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>r?s.slice(-r):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:n,_contexts:r,_tags:i,_extra:s,_user:o,_level:a,_fingerprint:c,_eventProcessors:l,_propagationContext:u,_sdkProcessingMetadata:d,_transactionName:f,_span:p}=this;return{breadcrumbs:e,attachments:n,contexts:r,tags:i,extra:s,user:o,level:a,fingerprint:c||[],eventProcessors:l,propagationContext:u,sdkProcessingMetadata:d,transactionName:f,span:p}}applyToEvent(e,n={},r=[]){Vw(e,this.getScopeData());const i=[...r,...ig(),...this._eventProcessors];return hd(i,e,n)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:en();if(!this._client)return le.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=r&&r.event_id?r.event_id:en();if(!this._client)return le.warn("No client configured on scope - will not capture message!"),i;const s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:i},this),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:en();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(le.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function V2(){return sp||(sp=new Ii),sp}function cv(){return{traceId:en(),spanId:en().substring(16)}}const ph="7.120.3",Hw=parseFloat(ph),H2=100;class Ww{constructor(e,n,r,i=Hw){this._version=i;let s;n?s=n:(s=new Ii,s.setClient(e));let o;r?o=r:(o=new Ii,o.setClient(e)),this._stack=[{scope:s}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const n=this.getStackTop();n.client=e,n.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(e){const n=this.pushScope();let r;try{r=e(n)}catch(i){throw this.popScope(),i}return Yd(r)?r.then(i=>(this.popScope(),i),i=>{throw this.popScope(),i}):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,n){const r=this._lastEventId=n&&n.event_id?n.event_id:en(),i=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:i,...n,event_id:r}),r}captureMessage(e,n,r){const i=this._lastEventId=r&&r.event_id?r.event_id:en(),s=new Error(e);return this.getScope().captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:i}),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:en();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...n,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,n){const{scope:r,client:i}=this.getStackTop();if(!i)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:o=H2}=i.getOptions&&i.getOptions()||{};if(o<=0)return;const c={timestamp:kl(),...e},l=s?eo(()=>s(c,n)):c;l!==null&&(i.emit&&i.emit("beforeAddBreadcrumb",l,n),r.addBreadcrumb(l,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,n){this.getScope().setTag(e,n),this.getIsolationScope().setTag(e,n)}setExtra(e,n){this.getScope().setExtra(e,n),this.getIsolationScope().setExtra(e,n)}setContext(e,n){this.getScope().setContext(e,n),this.getIsolationScope().setContext(e,n)}configureScope(e){const{scope:n,client:r}=this.getStackTop();r&&e(n)}run(e){const n=lv(this);try{e(this)}finally{lv(n)}}getIntegration(e){const n=this.getClient();if(!n)return null;try{return n.getIntegration(e)}catch{return Ge&&le.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,n){const r=this._callExtensionMethod("startTransaction",e,n);return Ge&&!r&&(this.getClient()?le.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
|
|
409
|
-
Sentry.addTracingExtensions();
|
|
410
|
-
Sentry.init({...});
|
|
411
|
-
`):le.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Fw(r),this._sendSessionUpdate(),n.setSession()}startSession(e){const{scope:n,client:r}=this.getStackTop(),{release:i,environment:s=Qd}=r&&r.getOptions()||{},{userAgent:o}=Et.navigator||{},a=Pw({release:i,environment:s,user:n.getUser(),...o&&{userAgent:o},...e}),c=n.getSession&&n.getSession();return c&&c.status==="ok"&&no(c,{status:"exited"}),this.endSession(),n.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),n=e&&e.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:n}=this.getStackTop(),r=e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(e,...n){const i=Cl().__SENTRY__;if(i&&i.extensions&&typeof i.extensions[e]=="function")return i.extensions[e].apply(this,n);Ge&&le.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function Cl(){return Et.__SENTRY__=Et.__SENTRY__||{extensions:{},hub:void 0},Et}function lv(t){const e=Cl(),n=hh(e);return qw(e,t),n}function In(){const t=Cl();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return W2(t)}function vs(){return In().getIsolationScope()}function W2(t=Cl()){return(!q2(t)||hh(t).isOlderThan(Hw))&&qw(t,new Ww),hh(t)}function q2(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function hh(t){return pw("hub",()=>new Ww,t)}function qw(t,e){if(!t)return!1;const n=t.__SENTRY__=t.__SENTRY__||{};return n.hub=e,!0}function ho(t){return In().getScope().getTransaction()}let uv=!1;function Z2(){uv||(uv=!0,xw(mh),Ow(mh))}function mh(){const t=ho();if(t){const e="internal_error";Ge&&le.log(`[Tracing] Transaction: ${e} -> Global error occured`),t.setStatus(e)}}mh.tag="sentry_tracingErrorCallback";var dv;(function(t){const e="ok";t.Ok=e;const n="deadline_exceeded";t.DeadlineExceeded=n;const r="unauthenticated";t.Unauthenticated=r;const i="permission_denied";t.PermissionDenied=i;const s="not_found";t.NotFound=s;const o="resource_exhausted";t.ResourceExhausted=o;const a="invalid_argument";t.InvalidArgument=a;const c="unimplemented";t.Unimplemented=c;const l="unavailable";t.Unavailable=l;const u="internal_error";t.InternalError=u;const d="unknown_error";t.UnknownError=d;const f="cancelled";t.Cancelled=f;const p="already_exists";t.AlreadyExists=p;const h="failed_precondition";t.FailedPrecondition=h;const m="aborted";t.Aborted=m;const v="out_of_range";t.OutOfRange=v;const y="data_loss";t.DataLoss=y})(dv||(dv={}));function G2(t){if(t<400&&t>=100)return"ok";if(t>=400&&t<500)switch(t){case 401:return"unauthenticated";case 403:return"permission_denied";case 404:return"not_found";case 409:return"already_exists";case 413:return"failed_precondition";case 429:return"resource_exhausted";default:return"invalid_argument"}if(t>=500&&t<600)switch(t){case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline_exceeded";default:return"internal_error"}return"unknown_error"}function ag(t,e){t.setTag("http.status_code",String(e)),t.setData("http.response.status_code",e);const n=G2(e);n!=="unknown_error"&&t.setStatus(n)}function Ra(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=wt(),n=t||e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}function Zw(t){if(!Ra())return;const e=J2(t),n=In(),r=t.scope?t.scope.getSpan():cg();if(t.onlyIfParent&&!r)return;const o=(t.scope||rr()).clone();return Y2(n,{parentSpan:r,spanContext:e,forceTransaction:t.forceTransaction,scope:o})}function cg(){return rr().getSpan()}function Y2(t,{parentSpan:e,spanContext:n,forceTransaction:r,scope:i}){if(!Ra())return;const s=vs();let o;if(e&&!r)o=e.startChild(n);else if(e){const a=ua(e),{traceId:c,spanId:l}=e.spanContext(),u=og(e);o=t.startTransaction({traceId:c,parentSpanId:l,parentSampled:u,...n,metadata:{dynamicSamplingContext:a,...n.metadata}})}else{const{traceId:a,dsc:c,parentSpanId:l,sampled:u}={...s.getPropagationContext(),...i.getPropagationContext()};o=t.startTransaction({traceId:a,parentSpanId:l,parentSampled:u,...n,metadata:{dynamicSamplingContext:c,...n.metadata}})}return i.setSpan(o),X2(o,i,s),o}function J2(t){if(t.startTime){const e={...t};return e.startTimestamp=tf(t.startTime),delete e.startTime,e}return t}const Gw="_sentryScope",Yw="_sentryIsolationScope";function X2(t,e,n){t&&(hs(t,Yw,n),hs(t,Gw,e))}function K2(t){return{scope:t[Gw],isolationScope:t[Yw]}}const Kr="sentry.source",Fo="sentry.sample_rate",oc="sentry.op",Ms="sentry.origin",Q2="profile_id";class Jw{constructor(e=1e3){this._maxlen=e,this.spans=[]}add(e){this.spans.length>this._maxlen?e.spanRecorder=void 0:this.spans.push(e)}}class sf{constructor(e={}){this._traceId=e.traceId||en(),this._spanId=e.spanId||en().substring(16),this._startTime=e.startTimestamp||Nl(),this.tags=e.tags?{...e.tags}:{},this.data=e.data?{...e.data}:{},this.instrumenter=e.instrumenter||"sentry",this._attributes={},this.setAttributes({[Ms]:e.origin||"manual",[oc]:e.op,...e.attributes}),this._name=e.name||e.description,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.status&&(this._status=e.status),e.endTimestamp&&(this._endTime=e.endTimestamp),e.exclusiveTime!==void 0&&(this._exclusiveTime=e.exclusiveTime),this._measurements=e.measurements?{...e.measurements}:{}}get name(){return this._name||""}set name(e){this.updateName(e)}get description(){return this._name}set description(e){this._name=e}get traceId(){return this._traceId}set traceId(e){this._traceId=e}get spanId(){return this._spanId}set spanId(e){this._spanId=e}set parentSpanId(e){this._parentSpanId=e}get parentSpanId(){return this._parentSpanId}get sampled(){return this._sampled}set sampled(e){this._sampled=e}get attributes(){return this._attributes}set attributes(e){this._attributes=e}get startTimestamp(){return this._startTime}set startTimestamp(e){this._startTime=e}get endTimestamp(){return this._endTime}set endTimestamp(e){this._endTime=e}get status(){return this._status}set status(e){this._status=e}get op(){return this._attributes[oc]}set op(e){this.setAttribute(oc,e)}get origin(){return this._attributes[Ms]}set origin(e){this.setAttribute(Ms,e)}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?$w:w2}}startChild(e){const n=new sf({...e,parentSpanId:this._spanId,sampled:this._sampled,traceId:this._traceId});n.spanRecorder=this.spanRecorder,n.spanRecorder&&n.spanRecorder.add(n);const r=md(this);if(n.transaction=r,Ge&&r){const i=e&&e.op||"< unknown op >",s=sn(n).description||"< unknown name >",o=r.spanContext().spanId,a=`[Tracing] Starting '${i}' span on transaction '${s}' (${o}).`;le.log(a),this._logMessage=a}return n}setTag(e,n){return this.tags={...this.tags,[e]:n},this}setData(e,n){return this.data={...this.data,[e]:n},this}setAttribute(e,n){n===void 0?delete this._attributes[e]:this._attributes[e]=n}setAttributes(e){Object.keys(e).forEach(n=>this.setAttribute(n,e[n]))}setStatus(e){return this._status=e,this}setHttpStatus(e){return ag(this,e),this}setName(e){this.updateName(e)}updateName(e){return this._name=e,this}isSuccess(){return this._status==="ok"}finish(e){return this.end(e)}end(e){if(this._endTime)return;const n=md(this);if(Ge&&n&&n.spanContext().spanId!==this._spanId){const r=this._logMessage;r&&le.log(r.replace("Starting","Finishing"))}this._endTime=tf(e)}toTraceparent(){return ef(this)}toContext(){return Mn({data:this._getData(),description:this._name,endTimestamp:this._endTime,op:this.op,parentSpanId:this._parentSpanId,sampled:this._sampled,spanId:this._spanId,startTimestamp:this._startTime,status:this._status,tags:this.tags,traceId:this._traceId})}updateWithContext(e){return this.data=e.data||{},this._name=e.name||e.description,this._endTime=e.endTimestamp,this.op=e.op,this._parentSpanId=e.parentSpanId,this._sampled=e.sampled,this._spanId=e.spanId||this._spanId,this._startTime=e.startTimestamp||this._startTime,this._status=e.status,this.tags=e.tags||{},this._traceId=e.traceId||this._traceId,this}getTraceContext(){return sg(this)}getSpanJSON(){return Mn({data:this._getData(),description:this._name,op:this._attributes[oc],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:this._status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Ms],_metrics_summary:void 0,profile_id:this._attributes[Q2],exclusive_time:this._exclusiveTime,measurements:Object.keys(this._measurements).length>0?this._measurements:void 0})}isRecording(){return!this._endTime&&!!this._sampled}toJSON(){return this.getSpanJSON()}_getData(){const{data:e,_attributes:n}=this,r=Object.keys(e).length>0,i=Object.keys(n).length>0;if(!(!r&&!i))return r&&i?{...e,...n}:r?e:n}}class Xw extends sf{constructor(e,n){super(e),this._contexts={},this._hub=n||In(),this._name=e.name||"",this._metadata={...e.metadata},this._trimEnd=e.trimEnd,this.transaction=this;const r=this._metadata.dynamicSamplingContext;r&&(this._frozenDynamicSamplingContext={...r})}get name(){return this._name}set name(e){this.setName(e)}get metadata(){return{source:"custom",spanMetadata:{},...this._metadata,...this._attributes[Kr]&&{source:this._attributes[Kr]},...this._attributes[Fo]&&{sampleRate:this._attributes[Fo]}}}set metadata(e){this._metadata=e}setName(e,n="custom"){this._name=e,this.setAttribute(Kr,n)}updateName(e){return this._name=e,this}initSpanRecorder(e=1e3){this.spanRecorder||(this.spanRecorder=new Jw(e)),this.spanRecorder.add(this)}setContext(e,n){n===null?delete this._contexts[e]:this._contexts[e]=n}setMeasurement(e,n,r=""){this._measurements[e]={value:n,unit:r}}setMetadata(e){this._metadata={...this._metadata,...e}}end(e){const n=tf(e),r=this._finishTransaction(n);if(r)return this._hub.captureEvent(r)}toContext(){const e=super.toContext();return Mn({...e,name:this._name,trimEnd:this._trimEnd})}updateWithContext(e){return super.updateWithContext(e),this._name=e.name||"",this._trimEnd=e.trimEnd,this}getDynamicSamplingContext(){return ua(this)}setHub(e){this._hub=e}getProfileId(){if(this._contexts!==void 0&&this._contexts.profile!==void 0)return this._contexts.profile.profile_id}_finishTransaction(e){if(this._endTime!==void 0)return;this._name||(Ge&&le.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>"),super.end(e);const n=this._hub.getClient();if(n&&n.emit&&n.emit("finishTransaction",this),this._sampled!==!0){Ge&&le.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),n&&n.recordDroppedEvent("sample_rate","transaction");return}const r=this.spanRecorder?this.spanRecorder.spans.filter(u=>u!==this&&sn(u).timestamp):[];if(this._trimEnd&&r.length>0){const u=r.map(d=>sn(d).timestamp).filter(Boolean);this._endTime=u.reduce((d,f)=>d>f?d:f)}const{scope:i,isolationScope:s}=K2(this),{metadata:o}=this,{source:a}=o,c={contexts:{...this._contexts,trace:sg(this)},spans:r,start_timestamp:this._startTime,tags:this.tags,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{...o,capturedSpanScope:i,capturedSpanIsolationScope:s,...Mn({dynamicSamplingContext:ua(this)})},_metrics_summary:void 0,...a&&{transaction_info:{source:a}}};return Object.keys(this._measurements).length>0&&(Ge&&le.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),c.measurements=this._measurements),Ge&&le.log(`[Tracing] Finishing ${this.op} transaction: ${this._name}.`),c}}const Nu={idleTimeout:1e3,finalTimeout:3e4,heartbeatInterval:5e3},eF="finishReason",Eo=["heartbeatFailed","idleTimeout","documentHidden","finalTimeout","externalFinish","cancelled"];class tF extends Jw{constructor(e,n,r,i){super(i),this._pushActivity=e,this._popActivity=n,this.transactionSpanId=r}add(e){if(e.spanContext().spanId!==this.transactionSpanId){const n=e.end;e.end=(...r)=>(this._popActivity(e.spanContext().spanId),n.apply(e,r)),sn(e).timestamp===void 0&&this._pushActivity(e.spanContext().spanId)}super.add(e)}}class nF extends Xw{constructor(e,n,r=Nu.idleTimeout,i=Nu.finalTimeout,s=Nu.heartbeatInterval,o=!1,a=!1){super(e,n),this._idleHub=n,this._idleTimeout=r,this._finalTimeout=i,this._heartbeatInterval=s,this._onScope=o,this.activities={},this._heartbeatCounter=0,this._finished=!1,this._idleTimeoutCanceledPermanently=!1,this._beforeFinishCallbacks=[],this._finishReason=Eo[4],this._autoFinishAllowed=!a,o&&(Ge&&le.log(`Setting idle transaction on scope. Span ID: ${this.spanContext().spanId}`),n.getScope().setSpan(this)),a||this._restartIdleTimeout(),setTimeout(()=>{this._finished||(this.setStatus("deadline_exceeded"),this._finishReason=Eo[3],this.end())},this._finalTimeout)}end(e){const n=tf(e);if(this._finished=!0,this.activities={},this.op==="ui.action.click"&&this.setAttribute(eF,this._finishReason),this.spanRecorder){Ge&&le.log("[Tracing] finishing IdleTransaction",new Date(n*1e3).toISOString(),this.op);for(const r of this._beforeFinishCallbacks)r(this,n);this.spanRecorder.spans=this.spanRecorder.spans.filter(r=>{if(r.spanContext().spanId===this.spanContext().spanId)return!0;sn(r).timestamp||(r.setStatus("cancelled"),r.end(n),Ge&&le.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(r,void 0,2)));const{start_timestamp:i,timestamp:s}=sn(r),o=i&&i<n,a=(this._finalTimeout+this._idleTimeout)/1e3,c=s&&i&&s-i<a;if(Ge){const l=JSON.stringify(r,void 0,2);o?c||le.log("[Tracing] discarding Span since it finished after Transaction final timeout",l):le.log("[Tracing] discarding Span since it happened after Transaction was finished",l)}return o&&c}),Ge&&le.log("[Tracing] flushing IdleTransaction")}else Ge&&le.log("[Tracing] No active IdleTransaction");if(this._onScope){const r=this._idleHub.getScope();r.getTransaction()===this&&r.setSpan(void 0)}return super.end(e)}registerBeforeFinishCallback(e){this._beforeFinishCallbacks.push(e)}initSpanRecorder(e){if(!this.spanRecorder){const n=i=>{this._finished||this._pushActivity(i)},r=i=>{this._finished||this._popActivity(i)};this.spanRecorder=new tF(n,r,this.spanContext().spanId,e),Ge&&le.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)}cancelIdleTimeout(e,{restartOnChildSpanChange:n}={restartOnChildSpanChange:!0}){this._idleTimeoutCanceledPermanently=n===!1,this._idleTimeoutID&&(clearTimeout(this._idleTimeoutID),this._idleTimeoutID=void 0,Object.keys(this.activities).length===0&&this._idleTimeoutCanceledPermanently&&(this._finishReason=Eo[5],this.end(e)))}setFinishReason(e){this._finishReason=e}sendAutoFinishSignal(){this._autoFinishAllowed||(Ge&&le.log("[Tracing] Received finish signal for idle transaction."),this._restartIdleTimeout(),this._autoFinishAllowed=!0)}_restartIdleTimeout(e){this.cancelIdleTimeout(),this._idleTimeoutID=setTimeout(()=>{!this._finished&&Object.keys(this.activities).length===0&&(this._finishReason=Eo[1],this.end(e))},this._idleTimeout)}_pushActivity(e){this.cancelIdleTimeout(void 0,{restartOnChildSpanChange:!this._idleTimeoutCanceledPermanently}),Ge&&le.log(`[Tracing] pushActivity: ${e}`),this.activities[e]=!0,Ge&&le.log("[Tracing] new activities count",Object.keys(this.activities).length)}_popActivity(e){if(this.activities[e]&&(Ge&&le.log(`[Tracing] popActivity ${e}`),delete this.activities[e],Ge&&le.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){const n=Nl();this._idleTimeoutCanceledPermanently?this._autoFinishAllowed&&(this._finishReason=Eo[5],this.end(n)):this._restartIdleTimeout(n+this._idleTimeout/1e3)}}_beat(){if(this._finished)return;const e=Object.keys(this.activities).join("");e===this._prevHeartbeatString?this._heartbeatCounter++:this._heartbeatCounter=1,this._prevHeartbeatString=e,this._heartbeatCounter>=3?this._autoFinishAllowed&&(Ge&&le.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus("deadline_exceeded"),this._finishReason=Eo[0],this.end()):this._pingHeartbeat()}_pingHeartbeat(){Ge&&le.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`),setTimeout(()=>{this._beat()},this._heartbeatInterval)}}function Kw(t,e,n){if(!Ra(e))return t.sampled=!1,t;if(t.sampled!==void 0)return t.setAttribute(Fo,Number(t.sampled)),t;let r;return typeof e.tracesSampler=="function"?(r=e.tracesSampler(n),t.setAttribute(Fo,Number(r))):n.parentSampled!==void 0?r=n.parentSampled:typeof e.tracesSampleRate<"u"?(r=e.tracesSampleRate,t.setAttribute(Fo,Number(r))):(r=1,t.setAttribute(Fo,r)),Qw(r)?r?(t.sampled=Math.random()<r,t.sampled?(Ge&&le.log(`[Tracing] starting ${t.op} transaction - ${sn(t).description}`),t):(Ge&&le.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`),t)):(Ge&&le.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),t.sampled=!1,t):(Ge&&le.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)}function Qw(t){return dw(t)||!(typeof t=="number"||typeof t=="boolean")?(Ge&&le.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`),!1):t<0||t>1?(Ge&&le.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${t}.`),!1):!0}function rF(){const e=this.getScope().getSpan();return e?{"sentry-trace":ef(e)}:{}}function iF(t,e){const n=this.getClient(),r=n&&n.getOptions()||{},i=r.instrumenter||"sentry",s=t.instrumenter||"sentry";i!==s&&(Ge&&le.error(`A transaction was started with instrumenter=\`${s}\`, but the SDK is configured with the \`${i}\` instrumenter.
|
|
412
|
-
The transaction will not be sampled. Please use the ${i} instrumentation to start transactions.`),t.sampled=!1);let o=new Xw(t,this);return o=Kw(o,r,{name:t.name,parentSampled:t.parentSampled,transactionContext:t,attributes:{...t.data,...t.attributes},...e}),o.isRecording()&&o.initSpanRecorder(r._experiments&&r._experiments.maxSpans),n&&n.emit&&n.emit("startTransaction",o),o}function e0(t,e,n,r,i,s,o,a=!1){const c=t.getClient(),l=c&&c.getOptions()||{};let u=new nF(e,t,n,r,o,i,a);return u=Kw(u,l,{name:e.name,parentSampled:e.parentSampled,transactionContext:e,attributes:{...e.data,...e.attributes},...s}),u.isRecording()&&u.initSpanRecorder(l._experiments&&l._experiments.maxSpans),c&&c.emit&&c.emit("startTransaction",u),u}function sF(){const t=Cl();t.__SENTRY__&&(t.__SENTRY__.extensions=t.__SENTRY__.extensions||{},t.__SENTRY__.extensions.startTransaction||(t.__SENTRY__.extensions.startTransaction=iF),t.__SENTRY__.extensions.traceHeaders||(t.__SENTRY__.extensions.traceHeaders=rF),Z2())}function oF(t,e,n){const r=ho();r&&r.setMeasurement(t,e,n)}function aF(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function cF(t,e,n,r){const i=rg(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:Da(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ys(s,[o])}function lF(t,e,n,r){const i=rg(n),s=t.type&&t.type!=="replay_event"?t.type:"event";aF(t,n&&n.sdk);const o=Cw(t,i,r,e);return delete t.sdkProcessingMetadata,ys(o,[[{type:s},t]])}const uF="7";function dF(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function fF(t){return`${dF(t)}${t.projectId}/envelope/`}function pF(t,e){return xP({sentry_key:t.publicKey,sentry_version:uF,...e&&{sentry_client:`${e.name}/${e.version}`}})}function hF(t,e={}){const n=typeof e=="string"?e:e.tunnel,r=typeof e=="string"||!e._metadata?void 0:e._metadata.sdk;return n||`${fF(t)}?${pF(t,r)}`}const fv=[];function mF(t){const e={};return t.forEach(n=>{const{name:r}=n,i=e[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.keys(e).map(n=>e[n])}function gF(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;Array.isArray(n)?r=[...e,...n]:typeof n=="function"?r=Sw(n(e)):r=e;const i=mF(r),s=vF(i,o=>o.name==="Debug");if(s!==-1){const[o]=i.splice(s,1);i.push(o)}return i}function yF(t,e){const n={};return e.forEach(r=>{r&&t0(t,r,n)}),n}function pv(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function t0(t,e,n){if(n[e.name]){Ge&&le.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,fv.indexOf(e.name)===-1&&(e.setupOnce(E2,In),fv.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),t.on&&typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>r(i,s,t))}if(t.addEventProcessor&&typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((s,o)=>r(s,o,t),{id:e.name});t.addEventProcessor(i)}Ge&&le.log(`Integration installed: ${e.name}`)}function vF(t,e){for(let n=0;n<t.length;n++)if(e(t[n])===!0)return n;return-1}function Pr(t,e){return Object.assign(function(...r){return e(...r)},{id:t})}function _F(t){let e="";for(const n of t){const r=Object.entries(n.tags),i=r.length>0?`|#${r.map(([s,o])=>`${s}:${o}`).join(",")}`:"";e+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${i}|T${n.timestamp}
|
|
413
|
-
`}return e}function bF(t,e,n,r){const i={sent_at:new Date().toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&e&&(i.dsn=Da(e));const s=EF(t);return ys(i,[s])}function EF(t){const e=_F(t);return[{type:"statsd",length:e.length},e]}const hv="Not capturing exception because it's already been captured.";class SF{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=IP(e.dsn):Ge&&le.warn("No DSN provided, client will not send events."),this._dsn){const n=hF(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){if(Gy(e)){Ge&&le.log(hv);return}let i=n&&n.event_id;return this._process(this.eventFromException(e,n).then(s=>this._captureEvent(s,n,r)).then(s=>{i=s})),i}captureMessage(e,n,r,i){let s=r&&r.event_id;const o=Xm(e)?e:String(e),a=Km(e)?this.eventFromMessage(o,n,r):this.eventFromException(e,r);return this._process(a.then(c=>this._captureEvent(c,r,i)).then(c=>{s=c})),s}captureEvent(e,n,r){if(n&&n.originalException&&Gy(n.originalException)){Ge&&le.log(hv);return}let i=n&&n.event_id;const o=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,n,o||r).then(a=>{i=a})),i}captureSession(e){typeof e.release!="string"?Ge&&le.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),no(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):la(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return Ge&&le.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const n=this._integrations[e.name];t0(this,e,this._integrations),n||pv(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=lF(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=d2(r,h2(s,this._options.transportOptions&&this._options.transportOptions.textEncoder));const i=this._sendEnvelope(r);i&&i.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){const n=cF(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const i=typeof r=="number"?r:1,s=`${e}:${n}`;Ge&&le.log(`Recording outcome: "${s}"${i>1?` (${i} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+i}}captureAggregateMetrics(e){Ge&&le.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const n=bF(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(n)}on(e,n){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(n)}emit(e,...n){this._hooks[e]&&this._hooks[e].forEach(r=>r(...n))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=yF(this,e),pv(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,n){let r=!1,i=!1;const s=n.exception&&n.exception.values;if(s){i=!0;for(const c of s){const l=c.mechanism;if(l&&l.handled===!1){r=!0;break}}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(no(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Xn(n=>{let r=0;const i=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(r+=i,e&&r>=e&&(clearInterval(s),n(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,i=vs()){const s=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&o.length>0&&(n.integrations=o),this.emit("preprocessEvent",e,n),jw(s,e,n,r,this,i).then(a=>{if(a===null)return a;const c={...i.getPropagationContext(),...r?r.getPropagationContext():void 0};if(!(a.contexts&&a.contexts.trace)&&c){const{traceId:u,spanId:d,parentSpanId:f,dsc:p}=c;a.contexts={trace:{trace_id:u,span_id:d,parent_span_id:f},...a.contexts};const h=p||rf(u,this,r);a.sdkProcessingMetadata={dynamicSamplingContext:h,...a.sdkProcessingMetadata}}return a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(i=>i.event_id,i=>{if(Ge){const s=i;s.logLevel==="log"?le.log(s.message):le.warn(s)}})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:s}=i,o=r0(e),a=n0(e),c=e.type||"error",l=`before send for type \`${c}\``;if(a&&typeof s=="number"&&Math.random()>s)return this.recordDroppedEvent("sample_rate","error",e),tg(new qr(`Discarding event because it's not included in the random sample (sampling rate = ${s})`,"log"));const u=c==="replay_event"?"replay":c,f=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,f).then(p=>{if(p===null)throw this.recordDroppedEvent("event_processor",u,e),new qr("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return p;const m=TF(i,p,n);return wF(m,l)}).then(p=>{if(p===null){if(this.recordDroppedEvent("before_send",u,e),o){const y=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",y)}throw new qr(`${l} returned \`null\`, will not send event.`,"log")}const h=r&&r.getSession();if(!o&&h&&this._updateSessionFromEvent(h,p),o){const v=p.sdkProcessingMetadata&&p.sdkProcessingMetadata.spanCountBeforeProcessing||0,y=p.spans?p.spans.length:0,g=v-y;g>0&&this.recordDroppedEvent("before_send","span",g)}const m=p.transaction_info;if(o&&m&&p.transaction!==e.transaction){const v="custom";p.transaction_info={...m,source:v}}return this.sendEvent(p,n),p}).then(null,p=>{throw p instanceof qr?p:(this.captureException(p,{data:{__sentry__:!0},originalException:p}),new qr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
414
|
-
Reason: ${p}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,n=>{Ge&&le.error("Error while sending event:",n)});Ge&&le.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map(n=>{const[r,i]=n.split(":");return{reason:r,category:i,quantity:e[n]}})}}function wF(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Yd(t))return t.then(r=>{if(!Qs(r)&&r!==null)throw new qr(n);return r},r=>{throw new qr(`${e} rejected with ${r}`)});if(!Qs(t)&&t!==null)throw new qr(n);return t}function TF(t,e,n){const{beforeSend:r,beforeSendTransaction:i}=t;if(n0(e)&&r)return r(e,n);if(r0(e)&&i){if(e.spans){const s=e.spans.length;e.sdkProcessingMetadata={...e.sdkProcessingMetadata,spanCountBeforeProcessing:s}}return i(e,n)}return e}function n0(t){return t.type===void 0}function r0(t){return t.type==="transaction"}function IF(t){const e=wt();!e||!e.addEventProcessor||e.addEventProcessor(t)}function xF(t,e){e.debug===!0&&(Ge?le.enable():eo(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),rr().update(e.initialScope);const r=new t(e);OF(r),DF(r)}function OF(t){const n=In().getStackTop();n.client=t,n.scope.setClient(t)}function DF(t){t.init?t.init():t.setupIntegrations&&t.setupIntegrations()}const RF=30;function i0(t,e,n=t2(t.bufferSize||RF)){let r={};const i=o=>n.drain(o);function s(o){const a=[];if(ev(o,(d,f)=>{const p=tv(f);if(Mw(r,p)){const h=mv(d,f);t.recordDroppedEvent("ratelimit_backoff",p,h)}else a.push(d)}),a.length===0)return la();const c=ys(o[0],a),l=d=>{ev(c,(f,p)=>{const h=mv(f,p);t.recordDroppedEvent(d,tv(p),h)})},u=()=>e({body:f2(c,t.textEncoder)}).then(d=>(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&Ge&&le.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=Lw(r,d),d),d=>{throw l("network_error"),d});return n.add(u).then(d=>d,d=>{if(d instanceof qr)return Ge&&le.error("Skipped sending event because buffer is full."),l("queue_overflow"),la();throw d})}return s.__sentry__baseTransport__=!0,{send:s,flush:i}}function mv(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function kF(t,e){const n={sent_at:new Date().toISOString()};e&&(n.dsn=Da(e));const r=t.map(NF);return ys(n,r)}function NF(t){return[{type:"span"},t]}function s0(t,e){const n=e&&MF(e)?e.getClient():e,r=n&&n.getDsn(),i=n&&n.getOptions().tunnel;return CF(t,r)||AF(t,i)}function AF(t,e){return e?gv(t)===gv(e):!1}function CF(t,e){return e?t.includes(e.host):!1}function gv(t){return t[t.length-1]==="/"?t.slice(0,-1):t}function MF(t){return t.getClient!==void 0}function o0(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(s=>({name:`${r}:@sentry/${s}`,version:ph})),version:ph}),t._metadata=i}const LF=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],PF=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],a0="InboundFilters",FF=(t={})=>({name:a0,setupOnce(){},processEvent(e,n,r){const i=r.getOptions(),s=$F(t,i);return jF(e,s)?null:e}}),c0=FF;Pr(a0,c0);function $F(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:LF],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[],...t.disableTransactionDefaults?[]:PF],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function jF(t,e){return e.ignoreInternal&&WF(t)?(Ge&&le.warn(`Event dropped due to being internal Sentry Error.
|
|
415
|
-
Event: ${Xi(t)}`),!0):UF(t,e.ignoreErrors)?(Ge&&le.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
416
|
-
Event: ${Xi(t)}`),!0):BF(t,e.ignoreTransactions)?(Ge&&le.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
417
|
-
Event: ${Xi(t)}`),!0):zF(t,e.denyUrls)?(Ge&&le.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
418
|
-
Event: ${Xi(t)}.
|
|
419
|
-
Url: ${gd(t)}`),!0):VF(t,e.allowUrls)?!1:(Ge&&le.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
420
|
-
Event: ${Xi(t)}.
|
|
421
|
-
Url: ${gd(t)}`),!0)}function UF(t,e){return t.type||!e||!e.length?!1:HF(t).some(n=>xa(n,e))}function BF(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;const n=t.transaction;return n?xa(n,e):!1}function zF(t,e){if(!e||!e.length)return!1;const n=gd(t);return n?xa(n,e):!1}function VF(t,e){if(!e||!e.length)return!0;const n=gd(t);return n?xa(n,e):!0}function HF(t){const e=[];t.message&&e.push(t.message);let n;try{n=t.exception.values[t.exception.values.length-1]}catch{}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),Ge&&e.length===0&&le.error(`Could not extract message for event ${Xi(t)}`),e}function WF(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function qF(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function gd(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?qF(e):null}catch{return Ge&&le.error(`Cannot extract url for event ${Xi(t)}`),null}}let yv;const l0="FunctionToString",vv=new WeakMap,ZF=()=>({name:l0,setupOnce(){yv=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=eg(this),n=vv.has(wt())&&e!==void 0?e:this;return yv.apply(n,t)}}catch{}},setup(t){vv.set(t,!0)}}),u0=ZF;Pr(l0,u0);const Gt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,st=Et;function GF(){st.document?st.document.addEventListener("visibilitychange",()=>{const t=ho();if(st.document.hidden&&t){const e="cancelled",{op:n,status:r}=sn(t);Gt&&le.log(`[Tracing] Transaction: ${e} -> since tab moved to the background, op: ${n}`),r||t.setStatus(e),t.setTag("visibilitychange","document.hidden"),t.end()}}):Gt&&le.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const Ml=(t,e,n)=>{let r,i;return s=>{e.value>=0&&(s||n)&&(i=e.value-(r||0),(i||r===void 0)&&(r=e.value,e.delta=i,t(e)))}},YF=()=>`v3-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,JF=()=>{const t=st.performance.timing,e=st.performance.navigation.type,n={entryType:"navigation",startTime:0,type:e==2?"back_forward":e===1?"reload":"navigate"};for(const r in t)r!=="navigationStart"&&r!=="toJSON"&&(n[r]=Math.max(t[r]-t.navigationStart,0));return n},of=()=>st.__WEB_VITALS_POLYFILL__?st.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||JF()):st.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0],lg=()=>{const t=of();return t&&t.activationStart||0},Ll=(t,e)=>{const n=of();let r="navigate";return n&&(st.document&&st.document.prerendering||lg()>0?r="prerender":r=n.type.replace(/_/g,"-")),{name:t,value:typeof e>"u"?-1:e,rating:"good",delta:0,entries:[],id:YF(),navigationType:r}},ka=(t,e,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const r=new PerformanceObserver(i=>{e(i.getEntries())});return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch{}},Pl=(t,e)=>{const n=r=>{(r.type==="pagehide"||st.document.visibilityState==="hidden")&&(t(r),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};st.document&&(addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0))},XF=(t,e={})=>{const n=Ll("CLS",0);let r,i=0,s=[];const o=c=>{c.forEach(l=>{if(!l.hadRecentInput){const u=s[0],d=s[s.length-1];i&&s.length!==0&&l.startTime-d.startTime<1e3&&l.startTime-u.startTime<5e3?(i+=l.value,s.push(l)):(i=l.value,s=[l]),i>n.value&&(n.value=i,n.entries=s,r&&r())}})},a=ka("layout-shift",o);if(a){r=Ml(t,n,e.reportAllChanges);const c=()=>{o(a.takeRecords()),r(!0)};return Pl(c),c}};let yd=-1;const KF=()=>{st.document&&st.document.visibilityState&&(yd=st.document.visibilityState==="hidden"&&!st.document.prerendering?0:1/0)},QF=()=>{Pl(({timeStamp:t})=>{yd=t},!0)},ug=()=>(yd<0&&(KF(),QF()),{get firstHiddenTime(){return yd}}),e$=t=>{const e=ug(),n=Ll("FID");let r;const i=a=>{a.startTime<e.firstHiddenTime&&(n.value=a.processingStart-a.startTime,n.entries.push(a),r(!0))},s=a=>{a.forEach(i)},o=ka("first-input",s);r=Ml(t,n),o&&Pl(()=>{s(o.takeRecords()),o.disconnect()},!0)};let d0=0,op=1/0,iu=0;const t$=t=>{t.forEach(e=>{e.interactionId&&(op=Math.min(op,e.interactionId),iu=Math.max(iu,e.interactionId),d0=iu?(iu-op)/7+1:0)})};let gh;const n$=()=>gh?d0:performance.interactionCount||0,r$=()=>{"interactionCount"in performance||gh||(gh=ka("event",t$,{type:"event",buffered:!0,durationThreshold:0}))},f0=()=>n$(),_v=10,yi=[],ap={},bv=t=>{const e=yi[yi.length-1],n=ap[t.interactionId];if(n||yi.length<_v||t.duration>e.latency){if(n)n.entries.push(t),n.latency=Math.max(n.latency,t.duration);else{const r={id:t.interactionId,latency:t.duration,entries:[t]};ap[r.id]=r,yi.push(r)}yi.sort((r,i)=>i.latency-r.latency),yi.splice(_v).forEach(r=>{delete ap[r.id]})}},i$=()=>{const t=Math.min(yi.length-1,Math.floor(f0()/50));return yi[t]},s$=(t,e)=>{e=e||{},r$();const n=Ll("INP");let r;const i=o=>{o.forEach(c=>{c.interactionId&&bv(c),c.entryType==="first-input"&&!yi.some(u=>u.entries.some(d=>c.duration===d.duration&&c.startTime===d.startTime))&&bv(c)});const a=i$();a&&a.latency!==n.value&&(n.value=a.latency,n.entries=a.entries,r())},s=ka("event",i,{durationThreshold:e.durationThreshold||40});r=Ml(t,n,e.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),Pl(()=>{i(s.takeRecords()),n.value<0&&f0()>0&&(n.value=0,n.entries=[]),r(!0)}))},Ev={},o$=t=>{const e=ug(),n=Ll("LCP");let r;const i=o=>{const a=o[o.length-1];if(a){const c=Math.max(a.startTime-lg(),0);c<e.firstHiddenTime&&(n.value=c,n.entries=[a],r())}},s=ka("largest-contentful-paint",i);if(s){r=Ml(t,n);const o=()=>{Ev[n.id]||(i(s.takeRecords()),s.disconnect(),Ev[n.id]=!0,r(!0))};return["keydown","click"].forEach(a=>{st.document&&addEventListener(a,o,{once:!0,capture:!0})}),Pl(o,!0),o}},yh=t=>{st.document&&(st.document.prerendering?addEventListener("prerenderingchange",()=>yh(t),!0):st.document.readyState!=="complete"?addEventListener("load",()=>yh(t),!0):setTimeout(t,0))},a$=(t,e)=>{e=e||{};const n=Ll("TTFB"),r=Ml(t,n,e.reportAllChanges);yh(()=>{const i=of();if(i){if(n.value=Math.max(i.responseStart-lg(),0),n.value<0||n.value>performance.now())return;n.entries=[i],r(!0)}})},gc={},vd={};let p0,h0,m0,g0,y0;function c$(t,e=!1){return Fl("cls",t,f$,p0,e)}function v0(t,e=!1){return Fl("lcp",t,h$,m0,e)}function l$(t){return Fl("ttfb",t,m$,g0)}function u$(t){return Fl("fid",t,p$,h0)}function d$(t){return Fl("inp",t,g$,y0)}function da(t,e){return _0(t,e),vd[t]||(y$(t),vd[t]=!0),b0(t,e)}function Na(t,e){const n=gc[t];if(!(!n||!n.length))for(const r of n)try{r(e)}catch(i){Gt&&le.error(`Error while triggering instrumentation handler.
|
|
422
|
-
Type: ${t}
|
|
423
|
-
Name: ${Ci(r)}
|
|
424
|
-
Error:`,i)}}function f$(){return XF(t=>{Na("cls",{metric:t}),p0=t},{reportAllChanges:!0})}function p$(){return e$(t=>{Na("fid",{metric:t}),h0=t})}function h$(){return o$(t=>{Na("lcp",{metric:t}),m0=t})}function m$(){return a$(t=>{Na("ttfb",{metric:t}),g0=t})}function g$(){return s$(t=>{Na("inp",{metric:t}),y0=t})}function Fl(t,e,n,r,i=!1){_0(t,e);let s;return vd[t]||(s=n(),vd[t]=!0),r&&e({metric:r}),b0(t,e,i?s:void 0)}function y$(t){const e={};t==="event"&&(e.durationThreshold=0),ka(t,n=>{Na(t,{entries:n})},e)}function _0(t,e){gc[t]=gc[t]||[],gc[t].push(e)}function b0(t,e,n){return()=>{n&&n();const r=gc[t];if(!r)return;const i=r.indexOf(e);i!==-1&&r.splice(i,1)}}function cp(t){return typeof t=="number"&&isFinite(t)}function fa(t,{startTimestamp:e,...n}){return e&&t.startTimestamp>e&&(t.startTimestamp=e),t.startChild({startTimestamp:e,...n})}const v$=2147483647;function un(t){return t/1e3}function dg(){return st.addEventListener&&st.performance}let Sv=0,Qt={},zr,yc;function _$(){const t=dg();if(t&&nr){t.mark&&st.performance.mark("sentry-tracing-init");const e=I$(),n=w$(),r=T$(),i=x$();return()=>{e(),n(),r(),i()}}return()=>{}}function b$(){da("longtask",({entries:t})=>{for(const e of t){const n=ho();if(!n)return;const r=un(nr+e.startTime),i=un(e.duration);n.startChild({description:"Main UI thread blocked",op:"ui.long-task",origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i})}})}function E$(){da("event",({entries:t})=>{for(const e of t){const n=ho();if(!n)return;if(e.name==="click"){const r=un(nr+e.startTime),i=un(e.duration),s={description:ps(e.target),op:`ui.interaction.${e.name}`,origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i},o=hw(e.target);o&&(s.attributes={"ui.component_name":o}),n.startChild(s)}}})}function S$(t,e){if(dg()&&nr){const r=O$(t,e);return()=>{r()}}return()=>{}}function w$(){return c$(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Gt&&le.log("[Measurements] Adding CLS"),Qt.cls={value:t.value,unit:""},yc=e)},!0)}function T$(){return v0(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Gt&&le.log("[Measurements] Adding LCP"),Qt.lcp={value:t.value,unit:"millisecond"},zr=e)},!0)}function I$(){return u$(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=un(nr),r=un(e.startTime);Gt&&le.log("[Measurements] Adding FID"),Qt.fid={value:t.value,unit:"millisecond"},Qt["mark.fid"]={value:n+r,unit:"second"}})}function x$(){return l$(({metric:t})=>{t.entries[t.entries.length-1]&&(Gt&&le.log("[Measurements] Adding TTFB"),Qt.ttfb={value:t.value,unit:"millisecond"})})}const wv={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function O$(t,e){return d$(({metric:n})=>{if(n.value===void 0)return;const r=n.entries.find(_=>_.duration===n.value&&wv[_.name]!==void 0),i=wt();if(!r||!i)return;const s=wv[r.name],o=i.getOptions(),a=un(nr+r.startTime),c=un(n.value),l=r.interactionId!==void 0?t[r.interactionId]:void 0;if(l===void 0)return;const{routeName:u,parentContext:d,activeTransaction:f,user:p,replayId:h}=l,m=p!==void 0?p.email||p.id||p.ip_address:void 0,v=f!==void 0?f.getProfileId():void 0,y=new sf({startTimestamp:a,endTimestamp:a+c,op:`ui.interaction.${s}`,name:ps(r.target),attributes:{release:o.release,environment:o.environment,transaction:u,...m!==void 0&&m!==""?{user:m}:{},...v!==void 0?{profile_id:v}:{},...h!==void 0?{replay_id:h}:{}},exclusiveTime:n.value,measurements:{inp:{value:n.value,unit:"millisecond"}}}),g=P$(d,o,e);if(g&&Math.random()<g){const _=y?kF([y],i.getDsn()):void 0,T=i&&i.getTransport();T&&_&&T.send(_).then(null,w=>{Gt&&le.error("Error while sending interaction:",w)});return}})}function D$(t){const e=dg();if(!e||!st.performance.getEntries||!nr)return;Gt&&le.log("[Tracing] Adding & adjusting spans using Performance API");const n=un(nr),r=e.getEntries(),{op:i,start_timestamp:s}=sn(t);if(r.slice(Sv).forEach(o=>{const a=un(o.startTime),c=un(o.duration);if(!(t.op==="navigation"&&s&&n+a<s))switch(o.entryType){case"navigation":{k$(t,o,n);break}case"mark":case"paint":case"measure":{R$(t,o,a,c,n);const l=ug(),u=o.startTime<l.firstHiddenTime;o.name==="first-paint"&&u&&(Gt&&le.log("[Measurements] Adding FP"),Qt.fp={value:o.startTime,unit:"millisecond"}),o.name==="first-contentful-paint"&&u&&(Gt&&le.log("[Measurements] Adding FCP"),Qt.fcp={value:o.startTime,unit:"millisecond"});break}case"resource":{A$(t,o,o.name,a,c,n);break}}}),Sv=Math.max(r.length-1,0),C$(t),i==="pageload"){L$(Qt),["fcp","fp","lcp"].forEach(a=>{if(!Qt[a]||!s||n>=s)return;const c=Qt[a].value,l=n+un(c),u=Math.abs((l-s)*1e3),d=u-c;Gt&&le.log(`[Measurements] Normalized ${a} from ${c} to ${u} (${d})`),Qt[a].value=u});const o=Qt["mark.fid"];o&&Qt.fid&&(fa(t,{description:"first input delay",endTimestamp:o.value+un(Qt.fid.value),op:"ui.action",origin:"auto.ui.browser.metrics",startTimestamp:o.value}),delete Qt["mark.fid"]),"fcp"in Qt||delete Qt.cls,Object.keys(Qt).forEach(a=>{oF(a,Qt[a].value,Qt[a].unit)}),M$(t)}zr=void 0,yc=void 0,Qt={}}function R$(t,e,n,r,i){const s=i+n,o=s+r;return fa(t,{description:e.name,endTimestamp:o,op:e.entryType,origin:"auto.resource.browser.metrics",startTimestamp:s}),s}function k$(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{su(t,e,r,n)}),su(t,e,"secureConnection",n,"TLS/SSL","connectEnd"),su(t,e,"fetch",n,"cache","domainLookupStart"),su(t,e,"domainLookup",n,"DNS"),N$(t,e,n)}function su(t,e,n,r,i,s){const o=s?e[s]:e[`${n}End`],a=e[`${n}Start`];!a||!o||fa(t,{op:"browser",origin:"auto.browser.browser.metrics",description:i||n,startTimestamp:r+un(a),endTimestamp:r+un(o)})}function N$(t,e,n){e.responseEnd&&(fa(t,{op:"browser",origin:"auto.browser.browser.metrics",description:"request",startTimestamp:n+un(e.requestStart),endTimestamp:n+un(e.responseEnd)}),fa(t,{op:"browser",origin:"auto.browser.browser.metrics",description:"response",startTimestamp:n+un(e.responseStart),endTimestamp:n+un(e.responseEnd)}))}function A$(t,e,n,r,i,s){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const o=Us(n),a={};lp(a,e,"transferSize","http.response_transfer_size"),lp(a,e,"encodedBodySize","http.response_content_length"),lp(a,e,"decodedBodySize","http.decoded_response_content_length"),"renderBlockingStatus"in e&&(a["resource.render_blocking_status"]=e.renderBlockingStatus),o.protocol&&(a["url.scheme"]=o.protocol.split(":").pop()),o.host&&(a["server.address"]=o.host),a["url.same_origin"]=n.includes(st.location.origin);const c=s+r,l=c+i;fa(t,{description:n.replace(st.location.origin,""),endTimestamp:l,op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",origin:"auto.resource.browser.metrics",startTimestamp:c,data:a})}function C$(t){const e=st.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),cp(n.rtt)&&(Qt["connection.rtt"]={value:n.rtt,unit:"millisecond"})),cp(e.deviceMemory)&&t.setTag("deviceMemory",`${e.deviceMemory} GB`),cp(e.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(e.hardwareConcurrency))}function M$(t){zr&&(Gt&&le.log("[Measurements] Adding LCP Data"),zr.element&&t.setTag("lcp.element",ps(zr.element)),zr.id&&t.setTag("lcp.id",zr.id),zr.url&&t.setTag("lcp.url",zr.url.trim().slice(0,200)),t.setTag("lcp.size",zr.size)),yc&&yc.sources&&(Gt&&le.log("[Measurements] Adding CLS Data"),yc.sources.forEach((e,n)=>t.setTag(`cls.source.${n+1}`,ps(e.node))))}function lp(t,e,n,r){const i=e[n];i!=null&&i<v$&&(t[r]=i)}function L$(t){const e=of();if(!e)return;const{responseStart:n,requestStart:r}=e;r<=n&&(Gt&&le.log("[Measurements] Adding TTFB Request Time"),t["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}function P$(t,e,n){if(!Ra(e))return!1;let r;return t!==void 0&&typeof e.tracesSampler=="function"?r=e.tracesSampler({transactionContext:t,name:t.name,parentSampled:t.parentSampled,attributes:{...t.data,...t.attributes},location:st.location}):t!==void 0&&t.sampled!==void 0?r=t.sampled:typeof e.tracesSampleRate<"u"?r=e.tracesSampleRate:r=1,Qw(r)?r===!0?n:r===!1?0:r*n:(Gt&&le.warn("[Tracing] Discarding interaction span because of invalid sample rate."),!1)}function F$(t,e,n,r,i="auto.http.browser"){if(!Ra()||!t.fetchData)return;const s=e(t.fetchData.url);if(t.endTimestamp&&s){const p=t.fetchData.__span;if(!p)return;const h=r[p];h&&(U$(h,t),delete r[p]);return}const o=rr(),a=wt(),{method:c,url:l}=t.fetchData,u=j$(l),d=u?Us(u).host:void 0,f=s?Zw({name:`${c} ${l}`,onlyIfParent:!0,attributes:{url:l,type:"fetch","http.method":c,"http.url":u,"server.address":d,[Ms]:i},op:"http.client"}):void 0;if(f&&(t.fetchData.__span=f.spanContext().spanId,r[f.spanContext().spanId]=f),n(t.fetchData.url)&&a){const p=t.args[0];t.args[1]=t.args[1]||{};const h=t.args[1];h.headers=$$(p,a,o,h,f)}return f}function $$(t,e,n,r,i){const s=i||n.getSpan(),o=vs(),{traceId:a,spanId:c,sampled:l,dsc:u}={...o.getPropagationContext(),...n.getPropagationContext()},d=s?ef(s):ng(a,c,l),f=Aw(u||(s?ua(s):rf(a,e,n))),p=r.headers||(typeof Request<"u"&&Ai(t,Request)?t.headers:void 0);if(p)if(typeof Headers<"u"&&Ai(p,Headers)){const h=new Headers(p);return h.append("sentry-trace",d),f&&h.append(dh,f),h}else if(Array.isArray(p)){const h=[...p,["sentry-trace",d]];return f&&h.push([dh,f]),h}else{const h="baggage"in p?p.baggage:void 0,m=[];return Array.isArray(h)?m.push(...h):h&&m.push(h),f&&m.push(f),{...p,"sentry-trace":d,baggage:m.length>0?m.join(","):void 0}}else return{"sentry-trace":d,baggage:f}}function j$(t){try{return new URL(t).href}catch{return}}function U$(t,e){if(e.response){ag(t,e.response.status);const n=e.response&&e.response.headers&&e.response.headers.get("content-length");if(n){const r=parseInt(n);r>0&&t.setAttribute("http.response_content_length",r)}}else e.error&&t.setStatus("internal_error");t.end()}const vh=["localhost",/^\/(?!\/)/],_h={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,tracingOrigins:vh,tracePropagationTargets:vh};function B$(t){const{traceFetch:e,traceXHR:n,tracePropagationTargets:r,tracingOrigins:i,shouldCreateSpanForRequest:s,enableHTTPTimings:o}={traceFetch:_h.traceFetch,traceXHR:_h.traceXHR,...t},a=typeof s=="function"?s:u=>!0,c=u=>W$(u,r||i),l={};e&&Jd(u=>{const d=F$(u,a,c,l);if(d){const f=E0(u.fetchData.url),p=f?Us(f).host:void 0;d.setAttributes({"http.url":f,"server.address":p})}o&&d&&Tv(d)}),n&&Kd(u=>{const d=q$(u,a,c,l);o&&d&&Tv(d)})}function z$(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function Tv(t){const{url:e}=sn(t).data||{};if(!e||typeof e!="string")return;const n=da("resource",({entries:r})=>{r.forEach(i=>{z$(i)&&i.name.endsWith(e)&&(H$(i).forEach(o=>t.setAttribute(...o)),setTimeout(n))})})}function V$(t){let e="unknown",n="unknown",r="";for(const i of t){if(i==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(i))){e=r==="h"?"http":r,n=t.split(r)[1];break}r+=i}return r===t&&(e=r),{name:e,version:n}}function Ur(t=0){return((nr||performance.timeOrigin)+t)/1e3}function H$(t){const{name:e,version:n}=V$(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),nr?[...r,["http.request.redirect_start",Ur(t.redirectStart)],["http.request.fetch_start",Ur(t.fetchStart)],["http.request.domain_lookup_start",Ur(t.domainLookupStart)],["http.request.domain_lookup_end",Ur(t.domainLookupEnd)],["http.request.connect_start",Ur(t.connectStart)],["http.request.secure_connection_start",Ur(t.secureConnectionStart)],["http.request.connection_end",Ur(t.connectEnd)],["http.request.request_start",Ur(t.requestStart)],["http.request.response_start",Ur(t.responseStart)],["http.request.response_end",Ur(t.responseEnd)]]:r}function W$(t,e){return xa(t,e||vh)}function q$(t,e,n,r){const i=t.xhr,s=i&&i[Ei];if(!Ra()||!i||i.__sentry_own_request__||!s)return;const o=e(s.url);if(t.endTimestamp&&o){const p=i.__sentry_xhr_span_id__;if(!p)return;const h=r[p];h&&s.status_code!==void 0&&(ag(h,s.status_code),h.end(),delete r[p]);return}const a=rr(),c=vs(),l=E0(s.url),u=l?Us(l).host:void 0,d=o?Zw({name:`${s.method} ${s.url}`,onlyIfParent:!0,attributes:{type:"xhr","http.method":s.method,"http.url":l,url:s.url,"server.address":u,[Ms]:"auto.http.browser"},op:"http.client"}):void 0;d&&(i.__sentry_xhr_span_id__=d.spanContext().spanId,r[i.__sentry_xhr_span_id__]=d);const f=wt();if(i.setRequestHeader&&n(s.url)&&f){const{traceId:p,spanId:h,sampled:m,dsc:v}={...c.getPropagationContext(),...a.getPropagationContext()},y=d?ef(d):ng(p,h,m),g=Aw(v||(d?ua(d):rf(p,f,a)));Z$(i,y,g)}return d}function Z$(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader(dh,n)}catch{}}function E0(t){try{return new URL(t,st.location.origin).href}catch{return}}const G$="BrowserTracing",Y$={...Nu,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableInp:!1,interactionsSampleRate:1,_experiments:{},..._h},J$=(t={})=>{const e=Gt?!!(t.tracePropagationTargets||t.tracingOrigins):!1;sF(),!t.tracePropagationTargets&&t.tracingOrigins&&(t.tracePropagationTargets=t.tracingOrigins);const n={...Y$,...t},r=_$(),i={};n.enableInp&&S$(i,n.interactionsSampleRate),n.enableLongTask&&b$(),n._experiments.enableInteractions&&E$();const s={name:void 0,context:void 0};function o(a){const c=In(),{beforeStartSpan:l,idleTimeout:u,finalTimeout:d,heartbeatInterval:f}=n,p=a.op==="pageload";let h;if(p){const g=p?Iv("sentry-trace"):"",_=p?Iv("baggage"):void 0,{traceId:T,dsc:w,parentSpanId:E,sampled:R}=u2(g,_);h={traceId:T,parentSpanId:E,parentSampled:R,...a,metadata:{...a.metadata,dynamicSamplingContext:w},trimEnd:!0}}else h={trimEnd:!0,...a};const m=l?l(h):h;m.metadata=m.name!==h.name?{...m.metadata,source:"custom"}:m.metadata,s.name=m.name,s.context=m,m.sampled===!1&&Gt&&le.log(`[Tracing] Will not send ${m.op} transaction because of beforeNavigate.`),Gt&&le.log(`[Tracing] Starting ${m.op} transaction on scope`);const{location:v}=st,y=e0(c,m,u,d,!0,{location:v},f,p);return p&&st.document&&(st.document.addEventListener("readystatechange",()=>{["interactive","complete"].includes(st.document.readyState)&&y.sendAutoFinishSignal()}),["interactive","complete"].includes(st.document.readyState)&&y.sendAutoFinishSignal()),y.registerBeforeFinishCallback(g=>{r(),D$(g)}),y}return{name:G$,setupOnce:()=>{},afterAllSetup(a){const c=a.getOptions(),{markBackgroundSpan:l,traceFetch:u,traceXHR:d,shouldCreateSpanForRequest:f,enableHTTPTimings:p,_experiments:h}=n,m=c&&c.tracePropagationTargets,v=m||n.tracePropagationTargets;Gt&&e&&m&&le.warn("[Tracing] The `tracePropagationTargets` option was set in the BrowserTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.");let y,g=st.location&&st.location.href;if(a.on&&(a.on("startNavigationSpan",_=>{y&&(Gt&&le.log(`[Tracing] Finishing current transaction with op: ${sn(y).op}`),y.end()),y=o({op:"navigation",..._})}),a.on("startPageLoadSpan",_=>{y&&(Gt&&le.log(`[Tracing] Finishing current transaction with op: ${sn(y).op}`),y.end()),y=o({op:"pageload",..._})})),n.instrumentPageLoad&&a.emit&&st.location){const _={name:st.location.pathname,startTimestamp:nr?nr/1e3:void 0,origin:"auto.pageload.browser",attributes:{[Kr]:"url"}};S0(a,_)}n.instrumentNavigation&&a.emit&&st.location&&Xd(({to:_,from:T})=>{if(T===void 0&&g&&g.indexOf(_)!==-1){g=void 0;return}if(T!==_){g=void 0;const w={name:st.location.pathname,origin:"auto.navigation.browser",attributes:{[Kr]:"url"}};X$(a,w)}}),l&&GF(),h.enableInteractions&&K$(n,s),n.enableInp&&ej(i,s),B$({traceFetch:u,traceXHR:d,tracePropagationTargets:v,shouldCreateSpanForRequest:f,enableHTTPTimings:p})},options:n}};function S0(t,e){if(!t.emit)return;t.emit("startPageLoadSpan",e);const n=cg();return(n&&sn(n).op)==="pageload"?n:void 0}function X$(t,e){if(!t.emit)return;t.emit("startNavigationSpan",e);const n=cg();return(n&&sn(n).op)==="navigation"?n:void 0}function Iv(t){const e=vP(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function K$(t,e){let n;const r=()=>{const{idleTimeout:i,finalTimeout:s,heartbeatInterval:o}=t,a="ui.action.click",c=ho();if(c&&c.op&&["navigation","pageload"].includes(c.op)){Gt&&le.warn(`[Tracing] Did not create ${a} transaction because a pageload or navigation transaction is in progress.`);return}if(n&&(n.setFinishReason("interactionInterrupted"),n.end(),n=void 0),!e.name){Gt&&le.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}const{location:l}=st,u={name:e.name,op:a,trimEnd:!0,data:{[Kr]:e.context?tj(e.context):"url"}};n=e0(In(),u,i,s,!0,{location:l},o)};["click"].forEach(i=>{st.document&&addEventListener(i,r,{once:!1,capture:!0})})}function Q$(t){return"duration"in t}const xv=10;function ej(t,e){const n=({entries:r})=>{const i=wt(),s=i!==void 0&&i.getIntegrationByName!==void 0?i.getIntegrationByName("Replay"):void 0,o=s!==void 0?s.getReplayId():void 0,a=ho(),c=rr(),l=c!==void 0?c.getUser():void 0;r.forEach(u=>{if(Q$(u)){const d=u.interactionId;if(d===void 0)return;const f=t[d],p=u.duration,h=u.startTime,m=Object.keys(t),v=m.length>0?m.reduce((y,g)=>t[y].duration<t[g].duration?y:g):void 0;if(u.entryType==="first-input"&&m.map(g=>t[g]).some(g=>g.duration===p&&g.startTime===h)||!d)return;if(f)f.duration=Math.max(f.duration,p);else if(m.length<xv||v===void 0||p>t[v].duration){const y=e.name,g=e.context;y&&g&&(v&&Object.keys(t).length>=xv&&delete t[v],t[d]={routeName:y,duration:p,parentContext:g,user:l,activeTransaction:a,replayId:o,startTime:h})}}})};da("event",n),da("first-input",n)}function tj(t){const e=t.attributes&&t.attributes[Kr],n=t.data&&t.data[Kr],r=t.metadata&&t.metadata.source;return e||n||r}const Mt=Et;let bh=0;function w0(){return bh>0}function nj(){bh++,setTimeout(()=>{bh--})}function pa(t,e={},n){if(typeof t!="function")return t;try{const i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(eg(t))return t}catch{return t}const r=function(){const i=Array.prototype.slice.call(arguments);try{const s=i.map(o=>pa(o,e));return t.apply(this,s)}catch(s){throw nj(),Uw(o=>{o.addEventProcessor(a=>(e.mechanism&&(ih(a,void 0),to(a,e.mechanism)),a.extra={...a.extra,arguments:i},a)),Al(s)}),s}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}gw(r,t),hs(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}const Si=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function T0(t,e){const n=fg(t,e),r={type:e&&e.name,value:oj(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function rj(t,e,n,r){const i=wt(),s=i&&i.getOptions().normalizeDepth,o={exception:{values:[{type:Gd(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:lj(e,{isUnhandledRejection:r})}]},extra:{__serialized__:Dw(e,s)}};if(n){const a=fg(t,n);a.length&&(o.exception.values[0].stacktrace={frames:a})}return o}function up(t,e){return{exception:{values:[T0(t,e)]}}}function fg(t,e){const n=e.stacktrace||e.stack||"",r=sj(e);try{return t(n,r)}catch{}return[]}const ij=/Minified React error #\d+;/i;function sj(t){if(t){if(typeof t.framesToPop=="number")return t.framesToPop;if(ij.test(t.message))return 1}return 0}function oj(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function aj(t,e,n,r){const i=n&&n.syntheticException||void 0,s=pg(t,e,i,r);return to(s),s.level="error",n&&n.event_id&&(s.event_id=n.event_id),la(s)}function cj(t,e,n="info",r,i){const s=r&&r.syntheticException||void 0,o=Eh(t,e,s,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),la(o)}function pg(t,e,n,r,i){let s;if(Jm(e)&&e.error)return up(t,e.error);if(Uy(e)||cP(e)){const o=e;if("stack"in e)s=up(t,e);else{const a=o.name||(Uy(o)?"DOMError":"DOMException"),c=o.message?`${a}: ${o.message}`:a;s=Eh(t,c,n,r),ih(s,c)}return"code"in o&&(s.tags={...s.tags,"DOMException.code":`${o.code}`}),s}return Go(e)?up(t,e):Qs(e)||Gd(e)?(s=rj(t,e,n,i),to(s,{synthetic:!0}),s):(s=Eh(t,e,n,r),ih(s,`${e}`),to(s,{synthetic:!0}),s)}function Eh(t,e,n,r){const i={};if(r&&n){const s=fg(t,n);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(Xm(e)){const{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function lj(t,{isUnhandledRejection:e}){const n=OP(t),r=e?"promise rejection":"exception";return Jm(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Gd(t)?`Event \`${uj(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function uj(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function dj(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:new Date().toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:Da(r)}},s=fj(t);return ys(i,[s])}function fj(t){return[{type:"user_report"},t]}class pj extends SF{constructor(e){const n=Mt.SENTRY_SDK_SOURCE||ZP();o0(e,"browser",["browser"],n),super(e),e.sendClientReports&&Mt.document&&Mt.document.addEventListener("visibilitychange",()=>{Mt.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return aj(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return cj(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){Si&&le.warn("SDK not enabled, will not capture user feedback.");return}const n=dj(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}_flushOutcomes(){const e=this._clearOutcomes();if(e.length===0){Si&&le.log("No outcomes to send");return}if(!this._dsn){Si&&le.log("No dsn provided, will not send outcomes");return}Si&&le.log("Sending outcomes:",e);const n=g2(e,this._options.tunnel&&Da(this._dsn));this._sendEnvelope(n)}}let ac;function hj(){if(ac)return ac;if(ch(Mt.fetch))return ac=Mt.fetch.bind(Mt);const t=Mt.document;let e=Mt.fetch;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(e=r.fetch),t.head.removeChild(n)}catch(n){Si&&le.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return ac=e.bind(Mt)}function mj(){ac=void 0}function gj(t,e=hj()){let n=0,r=0;function i(s){const o=s.body.length;n+=o,r++;const a={body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{return e(t.url,a).then(c=>(n-=o,r--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return mj(),n-=o,r--,tg(c)}}return i0(t,i)}const yj=4;function vj(t){function e(n){return new Xn((r,i)=>{const s=new XMLHttpRequest;s.onerror=i,s.onreadystatechange=()=>{s.readyState===yj&&r({statusCode:s.status,headers:{"x-sentry-rate-limits":s.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":s.getResponseHeader("Retry-After")}})},s.open("POST",t.url);for(const o in t.headers)Object.prototype.hasOwnProperty.call(t.headers,o)&&s.setRequestHeader(o,t.headers[o]);s.send(n.body)})}return i0(t,e)}const af="?",_j=30,bj=40,Ej=50;function hg(t,e,n,r){const i={filename:t,function:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const Sj=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wj=/\((\S*)(?::(\d+))(?::(\d+))\)/,Tj=t=>{const e=Sj.exec(t);if(e){if(e[2]&&e[2].indexOf("eval")===0){const s=wj.exec(e[2]);s&&(e[2]=s[1],e[3]=s[2],e[4]=s[3])}const[r,i]=I0(e[1]||af,e[2]);return hg(i,r,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}},Ij=[_j,Tj],xj=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Oj=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dj=t=>{const e=xj.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const s=Oj.exec(e[3]);s&&(e[1]=e[1]||"eval",e[3]=s[1],e[4]=s[2],e[5]="")}let r=e[3],i=e[1]||af;return[i,r]=I0(i,r),hg(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Rj=[Ej,Dj],kj=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Nj=t=>{const e=kj.exec(t);return e?hg(e[2],e[1]||af,+e[3],e[4]?+e[4]:void 0):void 0},Aj=[bj,Nj],Cj=[Ij,Rj,Aj],Mj=_w(...Cj),I0=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:af,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},ou=1024,x0="Breadcrumbs",Lj=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:x0,setupOnce(){},setup(n){e.console&&bw($j(n)),e.dom&&ww(Fj(n,e.dom)),e.xhr&&Kd(jj(n)),e.fetch&&Jd(Uj(n)),e.history&&Xd(Bj(n)),e.sentry&&n.on&&n.on("beforeSendEvent",Pj(n))}}},O0=Lj;Pr(x0,O0);function Pj(t){return function(n){wt()===t&&ms({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Xi(n)},{event:n})}}function Fj(t,e){return function(r){if(wt()!==t)return;let i,s,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>ou&&(Si&&le.warn(`\`dom.maxStringLength\` cannot exceed ${ou}, but a value of ${a} was configured. Sentry will use ${ou} instead.`),a=ou),typeof o=="string"&&(o=[o]);try{const l=r.event,u=zj(l)?l.target:l;i=ps(u,{keyAttrs:o,maxStringLength:a}),s=hw(u)}catch{i="<unknown>"}if(i.length===0)return;const c={category:`ui.${r.name}`,message:i};s&&(c.data={"ui.component_name":s}),ms(c,{event:r.event,name:r.name,global:r.global})}}function $j(t){return function(n){if(wt()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:Rw(n.level),message:dd(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${dd(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;ms(r,{input:n.args,level:n.level})}}function jj(t){return function(n){if(wt()!==t)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[Ei];if(!r||!i||!s)return;const{method:o,url:a,status_code:c,body:l}=s,u={method:o,url:a,status_code:c},d={xhr:n.xhr,input:l,startTimestamp:r,endTimestamp:i};ms({category:"xhr",data:u,type:"http"},d)}}function Uj(t){return function(n){if(wt()!==t)return;const{startTimestamp:r,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const s=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i};ms({category:"fetch",data:s,level:"error",type:"http"},o)}else{const s=n.response,o={...n.fetchData,status_code:s&&s.status},a={input:n.args,response:s,startTimestamp:r,endTimestamp:i};ms({category:"fetch",data:o,type:"http"},a)}}}function Bj(t){return function(n){if(wt()!==t)return;let r=n.from,i=n.to;const s=Us(Mt.location.href);let o=r?Us(r):void 0;const a=Us(i);(!o||!o.path)&&(o=s),s.protocol===a.protocol&&s.host===a.host&&(i=a.relative),s.protocol===o.protocol&&s.host===o.host&&(r=o.relative),ms({category:"navigation",data:{from:r,to:i}})}}function zj(t){return!!t&&!!t.target}const D0="Dedupe",Vj=()=>{let t;return{name:D0,setupOnce(){},processEvent(e){if(e.type)return e;try{if(Hj(e,t))return Si&&le.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},R0=Vj;Pr(D0,R0);function Hj(t,e){return e?!!(Wj(t,e)||qj(t,e)):!1}function Wj(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!N0(t,e)||!k0(t,e))}function qj(t,e){const n=Ov(e),r=Ov(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!N0(t,e)||!k0(t,e))}function k0(t,e){let n=Dv(t),r=Dv(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const s=r[i],o=n[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function N0(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function Ov(t){return t.exception&&t.exception.values&&t.exception.values[0]}function Dv(t){const e=t.exception;if(e)try{return e.values[0].stacktrace.frames}catch{return}}const A0="GlobalHandlers",Zj=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:A0,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(Gj(n),Rv("onerror")),e.onunhandledrejection&&(Yj(n),Rv("onunhandledrejection"))}}},C0=Zj;Pr(A0,C0);function Gj(t){xw(e=>{const{stackParser:n,attachStacktrace:r}=L0();if(wt()!==t||w0())return;const{msg:i,url:s,line:o,column:a,error:c}=e,l=c===void 0&&Xr(i)?Kj(i,s,o,a):M0(pg(n,c||i,void 0,r,!1),s,o,a);l.level="error",nf(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Yj(t){Ow(e=>{const{stackParser:n,attachStacktrace:r}=L0();if(wt()!==t||w0())return;const i=Jj(e),s=Km(i)?Xj(i):pg(n,i,void 0,r,!0);s.level="error",nf(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Jj(t){if(Km(t))return t;const e=t;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return t}function Xj(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Kj(t,e,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let s=Jm(t)?t.message:t,o="Error";const a=s.match(i);return a&&(o=a[1],s=a[2]),M0({exception:{values:[{type:o,value:s}]}},e,n,r)}function M0(t,e,n,r){const i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},c=a.frames=a.frames||[],l=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=Xr(e)&&e.length>0?e:yP();return c.length===0&&c.push({colno:l,filename:d,function:"?",in_app:!0,lineno:u}),t}function Rv(t){Si&&le.log(`Global Handler attached: ${t}`)}function L0(){const t=wt();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const P0="HttpContext",Qj=()=>({name:P0,setupOnce(){},preprocessEvent(t){if(!Mt.navigator&&!Mt.location&&!Mt.document)return;const e=t.request&&t.request.url||Mt.location&&Mt.location.href,{referrer:n}=Mt.document||{},{userAgent:r}=Mt.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},s={...t.request,...e&&{url:e},headers:i};t.request=s}}),F0=Qj;Pr(P0,F0);const eU="cause",tU=5,$0="LinkedErrors",nU=(t={})=>{const e=t.limit||tU,n=t.key||eU;return{name:$0,setupOnce(){},preprocessEvent(r,i,s){const o=s.getOptions();pP(T0,o.stackParser,o.maxValueLength,n,e,r,i)}}},j0=nU;Pr($0,j0);const rU=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],U0="TryCatch",iU=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:U0,setupOnce(){e.setTimeout&&gn(Mt,"setTimeout",kv),e.setInterval&&gn(Mt,"setInterval",kv),e.requestAnimationFrame&&gn(Mt,"requestAnimationFrame",sU),e.XMLHttpRequest&&"XMLHttpRequest"in Mt&&gn(XMLHttpRequest.prototype,"send",oU);const n=e.eventTarget;n&&(Array.isArray(n)?n:rU).forEach(aU)}}},B0=iU;Pr(U0,B0);function kv(t){return function(...e){const n=e[0];return e[0]=pa(n,{mechanism:{data:{function:Ci(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function sU(t){return function(e){return t.apply(this,[pa(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Ci(t)},handled:!1,type:"instrument"}})])}}function oU(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&gn(n,i,function(s){const o={mechanism:{data:{function:i,handler:Ci(s)},handled:!1,type:"instrument"}},a=eg(s);return a&&(o.mechanism.data.handler=Ci(a)),pa(s,o)})}),t.apply(this,e)}}function aU(t){const e=Mt,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(gn(n,"addEventListener",function(r){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=pa(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Ci(s),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,pa(s,{mechanism:{data:{function:"addEventListener",handler:Ci(s),target:t},handled:!1,type:"instrument"}}),o])}}),gn(n,"removeEventListener",function(r){return function(i,s,o){const a=s;try{const c=a&&a.__sentry_wrapped__;c&&r.call(this,i,c,o)}catch{}return r.call(this,i,a,o)}}))}const cU=[c0(),u0(),B0(),O0(),C0(),j0(),R0(),F0()];function lU(t){return[...cU]}function uU(t={}){t.defaultIntegrations===void 0&&(t.defaultIntegrations=lU()),t.release===void 0&&(typeof __SENTRY_RELEASE__=="string"&&(t.release=__SENTRY_RELEASE__),Mt.SENTRY_RELEASE&&Mt.SENTRY_RELEASE.id&&(t.release=Mt.SENTRY_RELEASE.id)),t.autoSessionTracking===void 0&&(t.autoSessionTracking=!0),t.sendClientReports===void 0&&(t.sendClientReports=!0);const e={...t,stackParser:RP(t.stackParser||Mj),integrations:gF(t),transport:t.transport||(Tw()?gj:vj)};xF(pj,e),t.autoSessionTracking&&dU()}function dU(){if(typeof Mt.document>"u"){Si&&le.warn("Session tracking in non-browser environment with @sentry/browser is not supported.");return}sv({ignoreDuration:!0}),ov(),Xd(({from:t,to:e})=>{t!==void 0&&t!==e&&(sv({ignoreDuration:!0}),ov())})}const zt=Et,mg="sentryReplaySession",fU="replay_event",gg="Unable to send Replay",pU=3e5,hU=9e5,mU=5e3,gU=5500,yU=6e4,vU=5e3,_U=3,Nv=15e4,au=5e3,bU=3e3,EU=300,yg=2e7,SU=4999,wU=15e3,Av=36e5;function TU(t,e){return t??e()}function _d(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}var ln;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(ln||(ln={}));function IU(t){return t.nodeType===t.ELEMENT_NODE}function vc(t){const e=_d([t,"optionalAccess",n=>n.host]);return _d([e,"optionalAccess",n=>n.shadowRoot])===t}function _c(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function xU(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function OU(t){const{cssText:e}=t;if(e.split('"').length<3)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return t.layerName===""?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function bd(t){try{const e=t.rules||t.cssRules;return e?xU(Array.from(e,z0).join("")):null}catch{return null}}function z0(t){let e;if(RU(t))try{e=bd(t.styleSheet)||OU(t)}catch{}else if(kU(t)&&t.selectorText.includes(":"))return DU(t.cssText);return e||t.cssText}function DU(t){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function RU(t){return"styleSheet"in t}function kU(t){return"selectorText"in t}class V0{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;const n=_d([this,"access",r=>r.getMeta,"call",r=>r(e),"optionalAccess",r=>r.id]);return TU(n,()=>-1)}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)}replace(e,n){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function NU(){return new V0}function cf({maskInputOptions:t,tagName:e,type:n}){return e==="OPTION"&&(e="SELECT"),!!(t[e.toLowerCase()]||n&&t[n]||n==="password"||e==="INPUT"&&!n&&t.text)}function cl({isMasked:t,element:e,value:n,maskInputFn:r}){let i=n||"";return t?(r&&(i=r(i,e)),"*".repeat(i.length)):i}function ha(t){return t.toLowerCase()}function Sh(t){return t.toUpperCase()}const Cv="__rrweb_original__";function AU(t){const e=t.getContext("2d");if(!e)return!0;const n=50;for(let r=0;r<t.width;r+=n)for(let i=0;i<t.height;i+=n){const s=e.getImageData,o=Cv in s?s[Cv]:s;if(new Uint32Array(o.call(e,r,i,Math.min(n,t.width-r),Math.min(n,t.height-i)).data.buffer).some(c=>c!==0))return!1}return!0}function vg(t){const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?ha(e):null}function Ed(t,e,n){return e==="INPUT"&&(n==="radio"||n==="checkbox")?t.getAttribute("value")||"":t.value}let CU=1;const MU=new RegExp("[^a-z0-9-_:]"),ll=-2;function _g(){return CU++}function LU(t){if(t instanceof HTMLFormElement)return"form";const e=ha(t.tagName);return MU.test(e)?"div":e}function PU(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}let So,Mv;const FU=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,$U=/^(?:[a-z+]+:)?\/\//i,jU=/^www\..*/i,UU=/^(data:)([^,]*),(.*)/i;function Sd(t,e){return(t||"").replace(FU,(n,r,i,s,o,a)=>{const c=i||o||a,l=r||s||"";if(!c)return n;if($U.test(c)||jU.test(c))return`url(${l}${c}${l})`;if(UU.test(c))return`url(${l}${c}${l})`;if(c[0]==="/")return`url(${l}${PU(e)+c}${l})`;const u=e.split("/"),d=c.split("/");u.pop();for(const f of d)f!=="."&&(f===".."?u.pop():u.push(f));return`url(${l}${u.join("/")}${l})`})}const BU=/^[^ \t\n\r\u000c]+/,zU=/^[, \t\n\r\u000c]+/;function VU(t,e){if(e.trim()==="")return e;let n=0;function r(s){let o;const a=s.exec(e.substring(n));return a?(o=a[0],n+=o.length,o):""}const i=[];for(;r(zU),!(n>=e.length);){let s=r(BU);if(s.slice(-1)===",")s=$o(t,s.substring(0,s.length-1)),i.push(s);else{let o="";s=$o(t,s);let a=!1;for(;;){const c=e.charAt(n);if(c===""){i.push((s+o).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){n+=1,i.push((s+o).trim());break}else c==="("&&(a=!0);o+=c,n+=1}}}return i.join(", ")}function $o(t,e){if(!e||e.trim()==="")return e;const n=t.createElement("a");return n.href=e,n.href}function HU(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function bg(){const t=document.createElement("a");return t.href="",t.href}function H0(t,e,n,r,i,s){return r&&(n==="src"||n==="href"&&!(e==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(e==="table"||e==="td"||e==="th")?$o(t,r):n==="srcset"?VU(t,r):n==="style"?Sd(r,bg()):e==="object"&&n==="data"?$o(t,r):typeof s=="function"?s(n,r,i):r)}function W0(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function WU(t,e,n,r){try{if(r&&t.matches(r))return!1;if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;){const s=t.classList[i];if(e.test(s))return!0}if(n)return t.matches(n)}catch{}return!1}function qU(t,e){for(let n=t.classList.length;n--;){const r=t.classList[n];if(e.test(r))return!0}return!1}function Ls(t,e,n=1/0,r=0){return!t||t.nodeType!==t.ELEMENT_NODE||r>n?-1:e(t)?r:Ls(t.parentNode,e,n,r+1)}function jo(t,e){return n=>{const r=n;if(r===null)return!1;try{if(t){if(typeof t=="string"){if(r.matches(`.${t}`))return!0}else if(qU(r,t))return!0}return!!(e&&r.matches(e))}catch{return!1}}}function ma(t,e,n,r,i,s){try{const o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){const l=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(l))return!0}let a=-1,c=-1;if(s){if(c=Ls(o,jo(r,i)),c<0)return!0;a=Ls(o,jo(e,n),c>=0?c:1/0)}else{if(a=Ls(o,jo(e,n)),a<0)return!1;c=Ls(o,jo(r,i),a>=0?a:1/0)}return a>=0?c>=0?a<=c:!0:c>=0?!1:!!s}catch{}return!!s}function ZU(t,e,n){const r=t.contentWindow;if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const a=setTimeout(()=>{i||(e(),i=!0)},n);t.addEventListener("load",()=>{clearTimeout(a),i=!0,e()});return}const o="about:blank";if(r.location.href!==o||t.src===o||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function GU(t,e,n){let r=!1,i;try{i=t.sheet}catch{return}if(i)return;const s=setTimeout(()=>{r||(e(),r=!0)},n);t.addEventListener("load",()=>{clearTimeout(s),r=!0,e()})}function YU(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskAttributeFn:c,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,inlineStylesheet:p,maskInputOptions:h={},maskTextFn:m,maskInputFn:v,dataURLOptions:y={},inlineImages:g,recordCanvas:_,keepIframeSrcFn:T,newlyAddedElement:w=!1}=e,E=JU(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:ln.Document,childNodes:[],compatMode:t.compatMode}:{type:ln.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:ln.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:E};case t.ELEMENT_NODE:return KU(t,{doc:n,blockClass:i,blockSelector:s,unblockSelector:o,inlineStylesheet:p,maskAttributeFn:c,maskInputOptions:h,maskInputFn:v,dataURLOptions:y,inlineImages:g,recordCanvas:_,keepIframeSrcFn:T,newlyAddedElement:w,rootId:E,maskAllText:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f});case t.TEXT_NODE:return XU(t,{maskAllText:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,maskTextFn:m,maskInputOptions:h,maskInputFn:v,rootId:E});case t.CDATA_SECTION_NODE:return{type:ln.CDATA,textContent:"",rootId:E};case t.COMMENT_NODE:return{type:ln.Comment,textContent:t.textContent||"",rootId:E};default:return!1}}function JU(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return n===1?void 0:n}function XU(t,e){const{maskAllText:n,maskTextClass:r,unmaskTextClass:i,maskTextSelector:s,unmaskTextSelector:o,maskTextFn:a,maskInputOptions:c,maskInputFn:l,rootId:u}=e,d=t.parentNode&&t.parentNode.tagName;let f=t.textContent;const p=d==="STYLE"?!0:void 0,h=d==="SCRIPT"?!0:void 0,m=d==="TEXTAREA"?!0:void 0;if(p&&f){try{t.nextSibling||t.previousSibling||_d([t,"access",y=>y.parentNode,"access",y=>y.sheet,"optionalAccess",y=>y.cssRules])&&(f=bd(t.parentNode.sheet))}catch(y){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${y}`,t)}f=Sd(f,bg())}h&&(f="SCRIPT_PLACEHOLDER");const v=ma(t,r,s,i,o,n);if(!p&&!h&&!m&&f&&v&&(f=a?a(f,t.parentElement):f.replace(/[\S]/g,"*")),m&&f&&(c.textarea||v)&&(f=l?l(f,t.parentNode):f.replace(/[\S]/g,"*")),d==="OPTION"&&f){const y=cf({type:null,tagName:d,maskInputOptions:c});f=cl({isMasked:ma(t,r,s,i,o,y),element:t,value:f,maskInputFn:l})}return{type:ln.Text,textContent:f||"",isStyle:p,rootId:u}}function KU(t,e){const{doc:n,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:c,maskInputFn:l,dataURLOptions:u={},inlineImages:d,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:h=!1,rootId:m,maskAllText:v,maskTextClass:y,unmaskTextClass:g,maskTextSelector:_,unmaskTextSelector:T}=e,w=WU(t,r,i,s),E=LU(t);let R={};const j=t.attributes.length;for(let $=0;$<j;$++){const ne=t.attributes[$];ne.name&&!W0(E,ne.name,ne.value)&&(R[ne.name]=H0(n,E,ha(ne.name),ne.value,t,c))}if(E==="link"&&o){const $=Array.from(n.styleSheets).find(x=>x.href===t.href);let ne=null;$&&(ne=bd($)),ne&&(delete R.rel,delete R.href,R._cssText=Sd(ne,$.href))}if(E==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const $=bd(t.sheet);$&&(R._cssText=Sd($,bg()))}if(E==="input"||E==="textarea"||E==="select"||E==="option"){const $=t,ne=vg($),x=Ed($,Sh(E),ne),G=$.checked;if(ne!=="submit"&&ne!=="button"&&x){const S=ma($,y,_,g,T,cf({type:ne,tagName:Sh(E),maskInputOptions:a}));R.value=cl({isMasked:S,element:$,value:x,maskInputFn:l})}G&&(R.checked=G)}if(E==="option"&&(t.selected&&!a.select?R.selected=!0:delete R.selected),E==="canvas"&&f){if(t.__context==="2d")AU(t)||(R.rr_dataURL=t.toDataURL(u.type,u.quality));else if(!("__context"in t)){const $=t.toDataURL(u.type,u.quality),ne=document.createElement("canvas");ne.width=t.width,ne.height=t.height;const x=ne.toDataURL(u.type,u.quality);$!==x&&(R.rr_dataURL=$)}}if(E==="img"&&d){So||(So=n.createElement("canvas"),Mv=So.getContext("2d"));const $=t,ne=$.crossOrigin;$.crossOrigin="anonymous";const x=()=>{$.removeEventListener("load",x);try{So.width=$.naturalWidth,So.height=$.naturalHeight,Mv.drawImage($,0,0),R.rr_dataURL=So.toDataURL(u.type,u.quality)}catch(G){console.warn(`Cannot inline img src=${$.currentSrc}! Error: ${G}`)}ne?R.crossOrigin=ne:$.removeAttribute("crossorigin")};$.complete&&$.naturalWidth!==0?x():$.addEventListener("load",x)}if((E==="audio"||E==="video")&&(R.rr_mediaState=t.paused?"paused":"played",R.rr_mediaCurrentTime=t.currentTime),h||(t.scrollLeft&&(R.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(R.rr_scrollTop=t.scrollTop)),w){const{width:$,height:ne}=t.getBoundingClientRect();R={class:R.class,rr_width:`${$}px`,rr_height:`${ne}px`}}E==="iframe"&&!p(R.src)&&(t.contentDocument||(R.rr_src=R.src),delete R.src);let M;try{customElements.get(E)&&(M=!0)}catch{}return{type:ln.Element,tagName:E,attributes:R,childNodes:[],isSVG:HU(t)||void 0,needBlock:w,rootId:m,isCustom:M}}function Bt(t){return t==null?"":t.toLowerCase()}function QU(t,e){if(e.comment&&t.type===ln.Comment)return!0;if(t.type===ln.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(Bt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||Bt(t.attributes.name)==="application-name"||Bt(t.attributes.rel)==="icon"||Bt(t.attributes.rel)==="apple-touch-icon"||Bt(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&Bt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Bt(t.attributes.property).match(/^(og|twitter|fb):/)||Bt(t.attributes.name).match(/^(og|twitter):/)||Bt(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(Bt(t.attributes.name)==="robots"||Bt(t.attributes.name)==="googlebot"||Bt(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(Bt(t.attributes.name)==="author"||Bt(t.attributes.name)==="generator"||Bt(t.attributes.name)==="framework"||Bt(t.attributes.name)==="publisher"||Bt(t.attributes.name)==="progid"||Bt(t.attributes.property).match(/^article:/)||Bt(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(Bt(t.attributes.name)==="google-site-verification"||Bt(t.attributes.name)==="yandex-verification"||Bt(t.attributes.name)==="csrf-token"||Bt(t.attributes.name)==="p:domain_verify"||Bt(t.attributes.name)==="verify-v1"||Bt(t.attributes.name)==="verification"||Bt(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Uo(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,skipChild:f=!1,inlineStylesheet:p=!0,maskInputOptions:h={},maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOMOptions:g,dataURLOptions:_={},inlineImages:T=!1,recordCanvas:w=!1,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:j=5e3,onStylesheetLoad:M,stylesheetLoadTimeout:$=5e3,keepIframeSrcFn:ne=()=>!1,newlyAddedElement:x=!1}=e;let{preserveWhiteSpace:G=!0}=e;const S=YU(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,dataURLOptions:_,inlineImages:T,recordCanvas:w,keepIframeSrcFn:ne,newlyAddedElement:x});if(!S)return console.warn(t,"not serialized"),null;let k;r.hasNode(t)?k=r.getId(t):QU(S,g)||!G&&S.type===ln.Text&&!S.isStyle&&!S.textContent.replace(/^\s+|\s+$/gm,"").length?k=ll:k=_g();const C=Object.assign(S,{id:k});if(r.add(t,C),k===ll)return null;E&&E(t);let U=!f;if(C.type===ln.Element){U=U&&!C.needBlock,delete C.needBlock;const oe=t.shadowRoot;oe&&_c(oe)&&(C.isShadowHost=!0)}if((C.type===ln.Document||C.type===ln.Element)&&U){g.headWhitespace&&C.type===ln.Element&&C.tagName==="head"&&(G=!1);const oe={doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,skipChild:f,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOMOptions:g,dataURLOptions:_,inlineImages:T,recordCanvas:w,preserveWhiteSpace:G,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:j,onStylesheetLoad:M,stylesheetLoadTimeout:$,keepIframeSrcFn:ne};for(const F of Array.from(t.childNodes)){const Z=Uo(F,oe);Z&&C.childNodes.push(Z)}if(IU(t)&&t.shadowRoot)for(const F of Array.from(t.shadowRoot.childNodes)){const Z=Uo(F,oe);Z&&(_c(t.shadowRoot)&&(Z.isShadow=!0),C.childNodes.push(Z))}}return t.parentNode&&vc(t.parentNode)&&_c(t.parentNode)&&(C.isShadow=!0),C.type===ln.Element&&C.tagName==="iframe"&&ZU(t,()=>{const oe=t.contentDocument;if(oe&&R){const F=Uo(oe,{doc:oe,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOMOptions:g,dataURLOptions:_,inlineImages:T,recordCanvas:w,preserveWhiteSpace:G,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:j,onStylesheetLoad:M,stylesheetLoadTimeout:$,keepIframeSrcFn:ne});F&&R(t,F)}},j),C.type===ln.Element&&C.tagName==="link"&&C.attributes.rel==="stylesheet"&&GU(t,()=>{if(M){const oe=Uo(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOMOptions:g,dataURLOptions:_,inlineImages:T,recordCanvas:w,preserveWhiteSpace:G,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:j,onStylesheetLoad:M,stylesheetLoadTimeout:$,keepIframeSrcFn:ne});oe&&M(t,oe)}},$),C}function e3(t,e){const{mirror:n=new V0,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:s=null,maskAllText:o=!1,maskTextClass:a="rr-mask",unmaskTextClass:c=null,maskTextSelector:l=null,unmaskTextSelector:u=null,inlineStylesheet:d=!0,inlineImages:f=!1,recordCanvas:p=!1,maskAllInputs:h=!1,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOM:g=!1,dataURLOptions:_,preserveWhiteSpace:T,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:j,stylesheetLoadTimeout:M,keepIframeSrcFn:$=()=>!1}=e;return Uo(t,{doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,maskAllText:o,maskTextClass:a,unmaskTextClass:c,maskTextSelector:l,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:h===!1?{}:h,maskAttributeFn:m,maskTextFn:v,maskInputFn:y,slimDOMOptions:g===!0||g==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:g==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:g===!1?{}:g,dataURLOptions:_,inlineImages:f,recordCanvas:p,preserveWhiteSpace:T,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:j,stylesheetLoadTimeout:M,keepIframeSrcFn:$,newlyAddedElement:!1})}function Zi(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}function Cn(t,e,n=document){const r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}const Ao=`Please stop import mirror directly. Instead of that,\r
|
|
425
|
-
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
426
|
-
or you can use record.mirror to access the mirror instance during recording.`;let Lv={map:{},getId(){return console.error(Ao),-1},getNode(){return console.error(Ao),null},removeNodeFromMap(){console.error(Ao)},has(){return console.error(Ao),!1},reset(){console.error(Ao)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Lv=new Proxy(Lv,{get(t,e,n){return e==="map"&&console.error(Ao),Reflect.get(t,e,n)}}));function ul(t,e,n={}){let r=null,i=0;return function(...s){const o=Date.now();!i&&n.leading===!1&&(i=o);const a=e-(o-i),c=this;a<=0||a>e?(r&&(a3(r),r=null),i=o,t.apply(c,s)):!r&&n.trailing!==!1&&(r=lf(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(c,s)},a))}}function q0(t,e,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(o){lf(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>q0(t,e,s||{},!0)}function Eg(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}let wd=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(wd=()=>new Date().getTime());function Z0(t){const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:Zi([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollLeft])||Zi([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollLeft])||Zi([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollLeft])||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:Zi([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollTop])||Zi([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollTop])||Zi([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollTop])||0}}function G0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Y0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function J0(t){return t?t.nodeType===t.ELEMENT_NODE?t:t.parentElement:null}function wr(t,e,n,r,i){if(!t)return!1;const s=J0(t);if(!s)return!1;const o=jo(e,n);if(!i){const l=r&&s.matches(r);return o(s)&&!l}const a=Ls(s,o);let c=-1;return a<0?!1:(r&&(c=Ls(s,jo(null,r))),a>-1&&c<0?!0:a<c)}function t3(t,e){return e.getId(t)!==-1}function dp(t,e){return e.getId(t)===ll}function X0(t,e){if(vc(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?X0(t.parentNode,e):!0:!0}function wh(t){return!!t.changedTouches}function n3(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function K0(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Q0(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Th(t){return!!Zi([t,"optionalAccess",e=>e.shadowRoot])}class r3{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return b2(this.styleIDMap.get(e),()=>-1)}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function eT(t){let e=null;return Zi([t,"access",n=>n.getRootNode,"optionalCall",n=>n(),"optionalAccess",n=>n.nodeType])===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function i3(t){let e=t,n;for(;n=eT(e);)e=n;return e}function s3(t){const e=t.ownerDocument;if(!e)return!1;const n=i3(t);return e.contains(n)}function tT(t){const e=t.ownerDocument;return e?e.contains(t)||s3(t):!1}const Pv={};function Sg(t){const e=Pv[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return Pv[t]=r.bind(window)}function o3(...t){return Sg("requestAnimationFrame")(...t)}function lf(...t){return Sg("setTimeout")(...t)}function a3(...t){return Sg("clearTimeout")(...t)}var dt=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(dt||{}),ft=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ft||{}),Rn=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Rn||{}),pi=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(pi||{});function c3(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}function Fv(t){return"__ln"in t}class l3{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=c3([n,"optionalAccess",i=>i.next])||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&Fv(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&Fv(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const $v=(t,e)=>`${t}@${e}`;class u3{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,r=new l3,i=c=>{let l=c,u=ll;for(;u===ll;)l=l&&l.nextSibling,u=l&&this.mirror.getId(l);return u},s=c=>{if(!c.parentNode||!tT(c))return;const l=vc(c.parentNode)?this.mirror.getId(eT(c)):this.mirror.getId(c.parentNode),u=i(c);if(l===-1||u===-1)return r.addNode(c);const d=Uo(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{K0(f,this.mirror)&&this.iframeManager.addIframe(f),Q0(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Th(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,p)=>{this.iframeManager.attachIframe(f,p),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,p)=>{this.stylesheetManager.attachLinkElement(f,p)}});d&&(e.push({parentId:l,nextId:u,node:d}),n.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)jv(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!Uv(this.droppedSet,c)&&!jv(this.removes,c,this.mirror)||Uv(this.movedSet,c)?s(c):this.droppedSet.add(c);let o=null;for(;r.length;){let c=null;if(o){const l=this.mirror.getId(o.value.parentNode),u=i(o.value);l!==-1&&u!==-1&&(c=o)}if(!c){let l=r.tail;for(;l;){const u=l;if(l=l.previous,u){const d=this.mirror.getId(u.value.parentNode);if(i(u.value)===-1)continue;if(d!==-1){c=u;break}else{const p=u.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=p.parentNode.host;if(this.mirror.getId(h)!==-1){c=u;break}}}}}}if(!c){for(;r.head;)r.removeNode(r.head.value);break}o=c.previous,r.removeNode(c.value),s(c.value)}const a={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:l}=c;if(typeof l.style=="string"){const u=JSON.stringify(c.styleDiff),d=JSON.stringify(c._unchangedStyles);u.length<l.style.length&&(u+d).split("var(").length===l.style.split("var(").length&&(l.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:l}}).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=e=>{if(!dp(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!wr(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:ma(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,J0(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=vg(n),a=n.tagName;i=Ed(n,a,o);const c=cf({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),l=ma(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);i=cl({isMasked:l,element:n,value:i,maskInputFn:this.maskInputFn})}if(wr(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||i===e.oldValue)return;let s=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)r="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),r==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!W0(n.tagName,r)&&(s.attributes[r]=H0(this.doc,ha(n.tagName),ha(r),i,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const a of Array.from(n.style)){const c=n.style.getPropertyValue(a),l=n.style.getPropertyPriority(a);c!==o.style.getPropertyValue(a)||l!==o.style.getPropertyPriority(a)?l===""?s.styleDiff[a]=c:s.styleDiff[a]=[c,l]:s._unchangedStyles[a]=[c,l]}for(const a of Array.from(o.style))n.style.getPropertyValue(a)===""&&(s.styleDiff[a]=!1)}break}case"childList":{if(wr(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),i=vc(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);wr(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||dp(n,this.mirror)||!t3(n,this.mirror)||(this.addedSet.has(n)?(Ih(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||X0(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[$v(r,i)]?Ih(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:vc(e.target)&&_c(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(dp(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[$v(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);wr(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes.forEach(r=>this.genAdds(r)),Th(e)&&e.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Ih(t,e){t.delete(e),e.childNodes.forEach(n=>Ih(t,n))}function jv(t,e,n){return t.length===0?!1:nT(t,e,n)}function nT(t,e,n){const{parentNode:r}=e;if(!r)return!1;const i=n.getId(r);return t.some(s=>s.id===i)?!0:nT(t,r,n)}function Uv(t,e){return t.size===0?!1:rT(t,e)}function rT(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:rT(t,n):!1}let bc;function d3(t){bc=t}function f3(){bc=void 0}const Tt=t=>bc?(...n)=>{try{return t(...n)}catch(r){if(bc&&bc(r)===!0)return()=>{};throw r}}:t;function Wr(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}const Bo=[];function $l(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function iT(t,e){const n=new u3;Bo.push(n),n.init(t);let r=window.MutationObserver||window.__rrMutationObserver;const i=Wr([window,"optionalAccess",o=>o.Zone,"optionalAccess",o=>o.__symbol__,"optionalCall",o=>o("MutationObserver")]);i&&window[i]&&(r=window[i]);const s=new r(Tt(o=>{t.onMutation&&t.onMutation(o)===!1||n.processMutations.bind(n)(o)}));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function p3({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],a;const c=ul(Tt(d=>{const f=Date.now()-a;t(o.map(p=>(p.timeOffset-=f,p)),d),o=[],a=null}),s),l=Tt(ul(Tt(d=>{const f=$l(d),{clientX:p,clientY:h}=wh(d)?d.changedTouches[0]:d;a||(a=wd()),o.push({x:p,y:h,id:r.getId(f),timeOffset:wd()-a}),c(typeof DragEvent<"u"&&d instanceof DragEvent?ft.Drag:d instanceof MouseEvent?ft.MouseMove:ft.TouchMove)}),i,{trailing:!1})),u=[Cn("mousemove",l,n),Cn("touchmove",l,n),Cn("drag",l,n)];return Tt(()=>{u.forEach(d=>d())})}function h3({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[];let l=null;const u=d=>f=>{const p=$l(f);if(wr(p,r,i,s,!0))return;let h=null,m=d;if("pointerType"in f){switch(f.pointerType){case"mouse":h=pi.Mouse;break;case"touch":h=pi.Touch;break;case"pen":h=pi.Pen;break}h===pi.Touch?Rn[d]===Rn.MouseDown?m="TouchStart":Rn[d]===Rn.MouseUp&&(m="TouchEnd"):pi.Pen}else wh(f)&&(h=pi.Touch);h!==null?(l=h,(m.startsWith("Touch")&&h===pi.Touch||m.startsWith("Mouse")&&h===pi.Mouse)&&(h=null)):Rn[d]===Rn.Click&&(h=l,l=null);const v=wh(f)?f.changedTouches[0]:f;if(!v)return;const y=n.getId(p),{clientX:g,clientY:_}=v;Tt(t)({type:Rn[m],id:y,x:g,y:_,...h!==null&&{pointerType:h}})};return Object.keys(Rn).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&a[d]!==!1).forEach(d=>{let f=ha(d);const p=u(d);if(window.PointerEvent)switch(Rn[d]){case Rn.MouseDown:case Rn.MouseUp:f=f.replace("mouse","pointer");break;case Rn.TouchStart:case Rn.TouchEnd:return}c.push(Cn(f,p,e))}),Tt(()=>{c.forEach(d=>d())})}function sT({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){const a=Tt(ul(Tt(c=>{const l=$l(c);if(!l||wr(l,r,i,s,!0))return;const u=n.getId(l);if(l===e&&e.defaultView){const d=Z0(e.defaultView);t({id:u,x:d.left,y:d.top})}else t({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Cn("scroll",a,e)}function m3({viewportResizeCb:t},{win:e}){let n=-1,r=-1;const i=Tt(ul(Tt(()=>{const s=G0(),o=Y0();(n!==s||r!==o)&&(t({width:Number(o),height:Number(s)}),n=s,r=o)}),200));return Cn("resize",i,e)}const g3=["INPUT","TEXTAREA","SELECT"],Bv=new WeakMap;function y3({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:l,sampling:u,userTriggeredOnInput:d,maskTextClass:f,unmaskTextClass:p,maskTextSelector:h,unmaskTextSelector:m}){function v(R){let j=$l(R);const M=R.isTrusted,$=j&&Sh(j.tagName);if($==="OPTION"&&(j=j.parentElement),!j||!$||g3.indexOf($)<0||wr(j,r,i,s,!0))return;const ne=j;if(ne.classList.contains(o)||a&&ne.matches(a))return;const x=vg(j);let G=Ed(ne,$,x),S=!1;const k=cf({maskInputOptions:c,tagName:$,type:x}),C=ma(j,f,h,p,m,k);(x==="radio"||x==="checkbox")&&(S=j.checked),G=cl({isMasked:C,element:j,value:G,maskInputFn:l}),y(j,d?{text:G,isChecked:S,userTriggered:M}:{text:G,isChecked:S});const U=j.name;x==="radio"&&U&&S&&e.querySelectorAll(`input[type="radio"][name="${U}"]`).forEach(oe=>{if(oe!==j){const F=cl({isMasked:C,element:oe,value:Ed(oe,$,x),maskInputFn:l});y(oe,d?{text:F,isChecked:!S,userTriggered:!1}:{text:F,isChecked:!S})}})}function y(R,j){const M=Bv.get(R);if(!M||M.text!==j.text||M.isChecked!==j.isChecked){Bv.set(R,j);const $=n.getId(R);Tt(t)({...j,id:$})}}const _=(u.input==="last"?["change"]:["input","change"]).map(R=>Cn(R,Tt(v),e)),T=e.defaultView;if(!T)return()=>{_.forEach(R=>R())};const w=T.Object.getOwnPropertyDescriptor(T.HTMLInputElement.prototype,"value"),E=[[T.HTMLInputElement.prototype,"value"],[T.HTMLInputElement.prototype,"checked"],[T.HTMLSelectElement.prototype,"value"],[T.HTMLTextAreaElement.prototype,"value"],[T.HTMLSelectElement.prototype,"selectedIndex"],[T.HTMLOptionElement.prototype,"selected"]];return w&&w.set&&_.push(...E.map(R=>q0(R[0],R[1],{set(){Tt(v)({target:this,isTrusted:!1})}},!1,T))),Tt(()=>{_.forEach(R=>R())})}function Td(t){const e=[];function n(r,i){if(cu("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||cu("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||cu("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||cu("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return n(t,e)}function Gi(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function v3({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Tt((u,d,f)=>{const[p,h]=f,{id:m,styleId:v}=Gi(d,e,n.styleMirror);return(m&&m!==-1||v&&v!==-1)&&t({id:m,styleId:v,adds:[{rule:p,index:h}]}),u.apply(d,f)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Tt((u,d,f)=>{const[p]=f,{id:h,styleId:m}=Gi(d,e,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&t({id:h,styleId:m,removes:[{index:p}]}),u.apply(d,f)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:Tt((u,d,f)=>{const[p]=f,{id:h,styleId:m}=Gi(d,e,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&t({id:h,styleId:m,replace:p}),u.apply(d,f)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Tt((u,d,f)=>{const[p]=f,{id:h,styleId:m}=Gi(d,e,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&t({id:h,styleId:m,replaceSync:p}),u.apply(d,f)})}));const c={};lu("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(lu("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),lu("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),lu("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([u,d])=>{l[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(l[u].insertRule,{apply:Tt((f,p,h)=>{const[m,v]=h,{id:y,styleId:g}=Gi(p.parentStyleSheet,e,n.styleMirror);return(y&&y!==-1||g&&g!==-1)&&t({id:y,styleId:g,adds:[{rule:m,index:[...Td(p),v||0]}]}),f.apply(p,h)})}),d.prototype.deleteRule=new Proxy(l[u].deleteRule,{apply:Tt((f,p,h)=>{const[m]=h,{id:v,styleId:y}=Gi(p.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||y&&y!==-1)&&t({id:v,styleId:y,removes:[{index:[...Td(p),m]}]}),f.apply(p,h)})})}),Tt(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([u,d])=>{d.prototype.insertRule=l[u].insertRule,d.prototype.deleteRule=l[u].deleteRule})})}function oT({mirror:t,stylesheetManager:e},n){let r=null;n.nodeName==="#document"?r=t.getId(n):r=t.getId(n.host);const i=n.nodeName==="#document"?Wr([n,"access",o=>o.defaultView,"optionalAccess",o=>o.Document]):Wr([n,"access",o=>o.ownerDocument,"optionalAccess",o=>o.defaultView,"optionalAccess",o=>o.ShadowRoot]),s=Wr([i,"optionalAccess",o=>o.prototype])?Object.getOwnPropertyDescriptor(Wr([i,"optionalAccess",o=>o.prototype]),"adoptedStyleSheets"):void 0;return r===null||r===-1||!i||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){return Wr([s,"access",o=>o.get,"optionalAccess",o=>o.call,"call",o=>o(this)])},set(o){const a=Wr([s,"access",c=>c.set,"optionalAccess",c=>c.call,"call",c=>c(this,o)]);if(r!==null&&r!==-1)try{e.adoptStyleSheets(o,r)}catch{}return a}}),Tt(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function _3({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Tt((a,c,l)=>{const[u,d,f]=l;if(n.has(u))return s.apply(c,[u,d,f]);const{id:p,styleId:h}=Gi(Wr([c,"access",m=>m.parentRule,"optionalAccess",m=>m.parentStyleSheet]),e,r.styleMirror);return(p&&p!==-1||h&&h!==-1)&&t({id:p,styleId:h,set:{property:u,value:d,priority:f},index:Td(c.parentRule)}),a.apply(c,l)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:Tt((a,c,l)=>{const[u]=l;if(n.has(u))return o.apply(c,[u]);const{id:d,styleId:f}=Gi(Wr([c,"access",p=>p.parentRule,"optionalAccess",p=>p.parentStyleSheet]),e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,remove:{property:u},index:Td(c.parentRule)}),a.apply(c,l)})}),Tt(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o})}function b3({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:r,mirror:i,sampling:s,doc:o}){const a=Tt(l=>ul(Tt(u=>{const d=$l(u);if(!d||wr(d,e,n,r,!0))return;const{currentTime:f,volume:p,muted:h,playbackRate:m}=d;t({type:l,id:i.getId(d),currentTime:f,volume:p,muted:h,playbackRate:m})}),s.media||500)),c=[Cn("play",a(0),o),Cn("pause",a(1),o),Cn("seeked",a(2),o),Cn("volumechange",a(3),o),Cn("ratechange",a(4),o)];return Tt(()=>{c.forEach(l=>l())})}function E3({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,s=n.FontFace;n.FontFace=function(c,l,u){const d=new s(c,l,u);return i.set(d,{family:c,buffer:typeof l!="string",descriptors:u,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),d};const o=Eg(e.fonts,"add",function(a){return function(c){return lf(Tt(()=>{const l=i.get(c);l&&(t(l),i.delete(c))}),0),a.apply(this,[c])}});return r.push(()=>{n.FontFace=s}),r.push(o),Tt(()=>{r.forEach(a=>a())})}function S3(t){const{doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:o}=t;let a=!0;const c=Tt(()=>{const l=e.getSelection();if(!l||a&&Wr([l,"optionalAccess",f=>f.isCollapsed]))return;a=l.isCollapsed||!1;const u=[],d=l.rangeCount||0;for(let f=0;f<d;f++){const p=l.getRangeAt(f),{startContainer:h,startOffset:m,endContainer:v,endOffset:y}=p;wr(h,r,i,s,!0)||wr(v,r,i,s,!0)||u.push({start:n.getId(h),startOffset:m,end:n.getId(v),endOffset:y})}o({ranges:u})});return c(),Cn("selectionchange",c)}function w3({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:Eg(n.customElements,"define",function(i){return function(s,o,a){try{e({define:{name:s}})}catch{}return i.apply(this,[s,o,a])}})}function T3(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};const r=iT(t,t.doc),i=p3(t),s=h3(t),o=sT(t),a=m3(t,{win:n}),c=y3(t),l=b3(t),u=v3(t,{win:n}),d=oT(t,t.doc),f=_3(t,{win:n}),p=t.collectFonts?E3(t):()=>{},h=S3(t),m=w3(t),v=[];for(const y of t.plugins)v.push(y.observer(y.callback,n,y.options));return Tt(()=>{Bo.forEach(y=>y.reset()),r.disconnect(),i(),s(),o(),a(),c(),l(),u(),d(),f(),p(),h(),m(),v.forEach(y=>y())})}function cu(t){return typeof window[t]<"u"}function lu(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class xh{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,i){const s=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let a=s.get(n);return a||(a=this.generateIdFn(),s.set(n,a),o.set(a,n)),a}getIds(e,n){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return n.map(s=>this.getId(e,s,r,i))}getRemoteId(e,n,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const s=i.get(n);return s||-1}getRemoteIds(e,n){const r=this.getRemoteIdToIdMap(e);return n.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}function zv(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],s=t[r+1];if(r+=2,(i==="optionalAccess"||i==="optionalCall")&&n==null)return;i==="access"||i==="optionalAccess"?(e=n,n=s(n)):(i==="call"||i==="optionalCall")&&(n=s((...o)=>n.call(e,...o)),e=void 0)}return n}class I3{constructor(){this.crossOriginIframeMirror=new xh(_g),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class x3{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new xh(_g),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new xh(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),zv([this,"access",r=>r.loadListener,"optionalCall",r=>r(e)]),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(e,n){switch(n.type){case dt.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:dt.IncrementalSnapshot,data:{source:ft.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case dt.Meta:case dt.Load:case dt.DomContentLoaded:return!1;case dt.Plugin:return n;case dt.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case dt.IncrementalSnapshot:switch(n.data.source){case ft.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(r.node,i)}),n.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case ft.Drag:case ft.TouchMove:case ft.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case ft.ViewportResize:return!1;case ft.MediaInteraction:case ft.MouseInteraction:case ft.Scroll:case ft.CanvasMutation:case ft.Input:return this.replaceIds(n.data,e,["id"]),n;case ft.StyleSheetRule:case ft.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case ft.Font:return n;case ft.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),n;case ft.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),zv([n,"access",r=>r.data,"access",r=>r.styles,"optionalAccess",r=>r.forEach,"call",r=>r(i=>{this.replaceStyleIds(i,e,["styleId"])})]),n}}return!1}replace(e,n,r,i){for(const s of i)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=e.getIds(r,n[s]):n[s]=e.getId(r,n[s]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(e,n){e.type!==ln.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class O3{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class D3{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!_c(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=iT({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(sT({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),lf(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(oT({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,n){const r=this;this.restoreHandlers.push(Eg(e.prototype,"attachShadow",function(i){return function(s){const o=i.call(this,s);return this.shadowRoot&&tT(this)&&r.addShadowRoot(this.shadowRoot,n),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Vv{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}}class R3{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new r3,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const r={id:n,styleIds:[]},i=[];for(const s of e){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),i.push({styleId:o,rules:Array.from(s.rules||CSSRule,(a,c)=>({rule:z0(a),index:c}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class k3{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){o3(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,n){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==n)}add(e,n){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}let Kt,Id;const vr=NU();function ts(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskAllText:l=!1,maskTextClass:u="rr-mask",unmaskTextClass:d=null,maskTextSelector:f=null,unmaskTextSelector:p=null,inlineStylesheet:h=!0,maskAllInputs:m,maskInputOptions:v,slimDOMOptions:y,maskAttributeFn:g,maskInputFn:_,maskTextFn:T,maxCanvasSize:w=null,packFn:E,sampling:R={},dataURLOptions:j={},mousemoveWait:M,recordCanvas:$=!1,recordCrossOriginIframes:ne=!1,recordAfter:x=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:S=!1,inlineImages:k=!1,plugins:C,keepIframeSrcFn:U=()=>!1,ignoreCSSAttributes:oe=new Set([]),errorHandler:F,onMutation:Z,getCanvasManager:L}=t;d3(F);const I=ne?window.parent===window:!0;let X=!1;if(!I)try{window.parent.document&&(X=!1)}catch{X=!0}if(I&&!e)throw new Error("emit function is required");M!==void 0&&R.mousemove===void 0&&(R.mousemove=M),vr.reset();const B=m===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:v!==void 0?v:{},H=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};n3();let ve,he=0;const Ee=V=>{for(const ue of C||[])ue.eventProcessor&&(V=ue.eventProcessor(V));return E&&!X&&(V=E(V)),V};Kt=(V,ue)=>{const se=V;if(se.timestamp=wd(),ip([Bo,"access",K=>K[0],"optionalAccess",K=>K.isFrozen,"call",K=>K()])&&se.type!==dt.FullSnapshot&&!(se.type===dt.IncrementalSnapshot&&se.data.source===ft.Mutation)&&Bo.forEach(K=>K.unfreeze()),I)ip([e,"optionalCall",K=>K(Ee(se),ue)]);else if(X){const K={type:"rrweb",event:Ee(se),origin:window.location.origin,isCheckout:ue};window.parent.postMessage(K,"*")}if(se.type===dt.FullSnapshot)ve=se,he=0;else if(se.type===dt.IncrementalSnapshot){if(se.data.source===ft.Mutation&&se.data.isAttachIframe)return;he++;const K=r&&he>=r,ce=n&&ve&&se.timestamp-ve.timestamp>n;(K||ce)&&A(!0)}};const ze=V=>{Kt({type:dt.IncrementalSnapshot,data:{source:ft.Mutation,...V}})},rt=V=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.Scroll,...V}}),We=V=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.CanvasMutation,...V}}),it=V=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.AdoptedStyleSheet,...V}}),At=new R3({mutationCb:ze,adoptedStyleSheetCb:it}),b=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new I3:new x3({mirror:vr,mutationCb:ze,stylesheetManager:At,recordCrossOriginIframes:ne,wrappedEmit:Kt});for(const V of C||[])V.getMirror&&V.getMirror({nodeMirror:vr,crossOriginIframeMirror:b.crossOriginIframeMirror,crossOriginIframeStyleMirror:b.crossOriginIframeStyleMirror});const ae=new k3,ie=A3(L,{mirror:vr,win:window,mutationCb:V=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.CanvasMutation,...V}}),recordCanvas:$,blockClass:i,blockSelector:s,unblockSelector:o,maxCanvasSize:w,sampling:R.canvas,dataURLOptions:j,errorHandler:F}),P=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new O3:new D3({mutationCb:ze,scrollCb:rt,bypassOptions:{onMutation:Z,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:l,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskInputOptions:B,dataURLOptions:j,maskAttributeFn:g,maskTextFn:T,maskInputFn:_,recordCanvas:$,inlineImages:k,sampling:R,slimDOMOptions:H,iframeManager:b,stylesheetManager:At,canvasManager:ie,keepIframeSrcFn:U,processedNodeManager:ae},mirror:vr}),A=(V=!1)=>{Kt({type:dt.Meta,data:{href:window.location.href,width:Y0(),height:G0()}},V),At.reset(),P.init(),Bo.forEach(se=>se.lock());const ue=e3(document,{mirror:vr,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:l,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskAllInputs:B,maskAttributeFn:g,maskInputFn:_,maskTextFn:T,slimDOM:H,dataURLOptions:j,recordCanvas:$,inlineImages:k,onSerialize:se=>{K0(se,vr)&&b.addIframe(se),Q0(se,vr)&&At.trackLinkElement(se),Th(se)&&P.addShadowRoot(se.shadowRoot,document)},onIframeLoad:(se,K)=>{b.attachIframe(se,K),P.observeAttachShadow(se)},onStylesheetLoad:(se,K)=>{At.attachLinkElement(se,K)},keepIframeSrcFn:U});if(!ue)return console.warn("Failed to snapshot the document");Kt({type:dt.FullSnapshot,data:{node:ue,initialOffset:Z0(window)}}),Bo.forEach(se=>se.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&At.adoptStyleSheets(document.adoptedStyleSheets,vr.getId(document))};Id=A;try{const V=[],ue=K=>Tt(T3)({onMutation:Z,mutationCb:ze,mousemoveCb:(ce,Ie)=>Kt({type:dt.IncrementalSnapshot,data:{source:Ie,positions:ce}}),mouseInteractionCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.MouseInteraction,...ce}}),scrollCb:rt,viewportResizeCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.ViewportResize,...ce}}),inputCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.Input,...ce}}),mediaInteractionCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.MediaInteraction,...ce}}),styleSheetRuleCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.StyleSheetRule,...ce}}),styleDeclarationCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.StyleDeclaration,...ce}}),canvasMutationCb:We,fontCb:ce=>Kt({type:dt.IncrementalSnapshot,data:{source:ft.Font,...ce}}),selectionCb:ce=>{Kt({type:dt.IncrementalSnapshot,data:{source:ft.Selection,...ce}})},customElementCb:ce=>{Kt({type:dt.IncrementalSnapshot,data:{source:ft.CustomElement,...ce}})},blockClass:i,ignoreClass:a,ignoreSelector:c,maskAllText:l,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,maskInputOptions:B,inlineStylesheet:h,sampling:R,recordCanvas:$,inlineImages:k,userTriggeredOnInput:G,collectFonts:S,doc:K,maskAttributeFn:g,maskInputFn:_,maskTextFn:T,keepIframeSrcFn:U,blockSelector:s,unblockSelector:o,slimDOMOptions:H,dataURLOptions:j,mirror:vr,iframeManager:b,stylesheetManager:At,shadowDomManager:P,processedNodeManager:ae,canvasManager:ie,ignoreCSSAttributes:oe,plugins:ip([C,"optionalAccess",ce=>ce.filter,"call",ce=>ce(Ie=>Ie.observer),"optionalAccess",ce=>ce.map,"call",ce=>ce(Ie=>({observer:Ie.observer,options:Ie.options,callback:be=>Kt({type:dt.Plugin,data:{plugin:Ie.name,payload:be}})}))])||[]},{});b.addLoadListener(K=>{try{V.push(ue(K.contentDocument))}catch(ce){console.warn(ce)}});const se=()=>{A(),V.push(ue(document))};return document.readyState==="interactive"||document.readyState==="complete"?se():(V.push(Cn("DOMContentLoaded",()=>{Kt({type:dt.DomContentLoaded,data:{}}),x==="DOMContentLoaded"&&se()})),V.push(Cn("load",()=>{Kt({type:dt.Load,data:{}}),x==="load"&&se()},window))),()=>{V.forEach(K=>K()),ae.destroy(),Id=void 0,f3()}}catch(V){console.warn(V)}}function N3(t){if(!Id)throw new Error("please take full snapshot after start recording");Id(t)}ts.mirror=vr;ts.takeFullSnapshot=N3;function A3(t,e){try{return t?t(e):new Vv}catch{return console.warn("Unable to initialize CanvasManager"),new Vv}}const C3=3,M3=5;function wg(t){return t>9999999999?t:t*1e3}function fp(t){return t>9999999999?t/1e3:t}function jl(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:dt.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Sr(e,10,1e3)}}),e.category==="console")))}const L3="button,a";function aT(t){return t.closest(L3)||t}function cT(t){const e=lT(t);return!e||!(e instanceof Element)?e:aT(e)}function lT(t){return P3(t)?t.target:t}function P3(t){return typeof t=="object"&&!!t&&"target"in t}let Yi;function F3(t){return Yi||(Yi=[],$3()),Yi.push(t),()=>{const e=Yi?Yi.indexOf(t):-1;e>-1&&Yi.splice(e,1)}}function $3(){gn(zt,"open",function(t){return function(...e){if(Yi)try{Yi.forEach(n=>n())}catch{}return t.apply(zt,e)}})}function j3(t,e,n){t.handleClick(e,n)}class U3{constructor(e,n,r=jl){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=F3(()=>{this._lastMutation=Hv()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(z3(n,this._ignoreSelector)||!V3(e))return;const r={timestamp:fp(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(i=>i.node===r.node&&Math.abs(i.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=fp(e)}registerScroll(e=Date.now()){this._lastScroll=fp(e)}registerClick(e){const n=aT(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=Hv();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&e.push(r)});for(const r of e){const i=this._clicks.indexOf(r);i>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(i,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const n=this._replay,r=e.scrollAfter&&e.scrollAfter<=this._scollTimeout,i=e.mutationAfter&&e.mutationAfter<=this._threshold,s=!r&&!i,{clickCount:o,clickBreadcrumb:a}=e;if(s){const c=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,l=c<this._timeout*1e3?"mutation":"timeout",u={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.slowClickDetected",data:{...a.data,url:zt.location.href,route:n.getCurrentRoute(),timeAfterClickMs:c,endReason:l,clickCount:o||1}};this._addBreadcrumbEvent(n,u);return}if(o>1){const c={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.multiClick",data:{...a.data,url:zt.location.href,route:n.getCurrentRoute(),clickCount:o,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=setTimeout(()=>this._checkClicks(),1e3)}}const B3=["A","BUTTON","INPUT"];function z3(t,e){return!!(!B3.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function V3(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function Hv(){return Date.now()/1e3}function H3(t,e){try{if(!W3(e))return;const{source:n}=e.data;if(n===ft.Mutation&&t.registerMutation(e.timestamp),n===ft.Scroll&&t.registerScroll(e.timestamp),q3(e)){const{type:r,id:i}=e.data,s=ts.mirror.getNode(i);s instanceof HTMLElement&&r===Rn.Click&&t.registerClick(s)}}catch{}}function W3(t){return t.type===C3}function q3(t){return t.data.source===ft.MouseInteraction}function Zr(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var xd;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(xd||(xd={}));const Z3=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function G3(t){const e={};for(const n in t)if(Z3.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),e[r]=t[n]}return e}const Y3=t=>e=>{if(!t.isEnabled())return;const n=J3(e);if(!n)return;const r=e.name==="click",i=r?e.event:void 0;r&&t.clickDetector&&i&&i.target&&!i.altKey&&!i.metaKey&&!i.ctrlKey&&!i.shiftKey&&j3(t.clickDetector,n,cT(e.event)),jl(t,n)};function uT(t,e){const n=ts.mirror.getId(t),r=n&&ts.mirror.getNode(n),i=r&&ts.mirror.getMeta(r),s=i&&K3(i)?i:null;return{message:e,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(o=>o.type===xd.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:G3(s.attributes)}}:{}}}function J3(t){const{target:e,message:n}=X3(t);return Zr({category:`ui.${t.name}`,...uT(e,n)})}function X3(t){const e=t.name==="click";let n,r=null;try{r=e?cT(t.event):lT(t.event),n=ps(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function K3(t){return t.type===xd.Element}function Q3(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=e5(e);n&&jl(t,n)}function e5(t){const{metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s,target:o}=t;if(!o||t5(o)||!s)return null;const a=e||r||i,c=s.length===1;if(!a&&c)return null;const l=ps(o,{maxStringLength:200})||"<unknown>",u=uT(o,l);return Zr({category:"ui.keyDown",message:l,data:{...u.data,metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s}})}function t5(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const Wv={resource:o5,paint:i5,navigation:s5};function n5(t){return t.map(r5).filter(Boolean)}function r5(t){return Wv[t.entryType]?Wv[t.entryType](t):null}function ga(t){return((nr||zt.performance.timeOrigin)+t)/1e3}function i5(t){const{duration:e,entryType:n,name:r,startTime:i}=t,s=ga(i);return{type:n,name:r,start:s,end:s+e,data:void 0}}function s5(t){const{entryType:e,name:n,decodedBodySize:r,duration:i,domComplete:s,encodedBodySize:o,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,domInteractive:l,loadEventStart:u,loadEventEnd:d,redirectCount:f,startTime:p,transferSize:h,type:m}=t;return i===0?null:{type:`${e}.${m}`,start:ga(p),end:ga(s),name:n,data:{size:h,decodedBodySize:r,encodedBodySize:o,duration:i,domInteractive:l,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,loadEventStart:u,loadEventEnd:d,domComplete:s,redirectCount:f}}}function o5(t){const{entryType:e,initiatorType:n,name:r,responseEnd:i,startTime:s,decodedBodySize:o,encodedBodySize:a,responseStatus:c,transferSize:l}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:ga(s),end:ga(i),name:r,data:{size:l,statusCode:c,decodedBodySize:o,encodedBodySize:a}}}function a5(t){const e=t.entries,n=e[e.length-1],r=n?n.element:void 0,i=t.value,s=ga(i);return{type:"largest-contentful-paint",name:"largest-contentful-paint",start:s,end:s,data:{value:i,size:i,nodeId:r?ts.mirror.getId(r):void 0}}}function c5(t){function e(i){t.performanceEntries.includes(i)||t.performanceEntries.push(i)}function n({entries:i}){i.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(i=>{r.push(da(i,n))}),r.push(v0(({metric:i})=>{t.replayPerformanceEntries.push(a5(i))})),()=>{r.forEach(i=>i())}}const Ut=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,l5='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==r||r<0)&&(r=0),(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},A=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},_=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=x(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},x=function(t,n,r){return-1==t.s?Math.max(x(t.l,n,r+1),x(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},C=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=_(f,15),M=b.t,E=b.l,x=_(h,15),C=x.t,U=x.l,F=D(M),I=F.c,S=F.n,L=D(C),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=_(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,C)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(C,U,0),R=C;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){A(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;A(r,m,Q[et]),m+=R[et],et>3&&(A(r,m,rt>>5&8191),m+=i[et])}else A(r,m,N[rt]),m+=P[rt]}return A(r,m,N[256]),m+P[256]},U=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=U[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,A=c.p||new n(32768),_=c.h||new n(z+1),x=Math.ceil(o/3),D=2*x,T=function(t){return(a[t]^a[t+1]<<x^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=_[H];if(A[J]=K,_[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=C(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-A[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=A[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=C(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=_,c.p=A,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,a=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),s=a.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(a,n),O(a,s-8,r.d()),O(a,s-4,e),a}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(r){for(var e=new t(n.length),i=0;i<n.length;++i)e[i]=n.charCodeAt(i);return e}if(G)return G.encode(n);var a=n.length,s=new t(n.length+(n.length>>1)),o=0,f=function(t){s[o++]=t};for(i=0;i<a;++i){if(o+5>s.length){var h=new t(o+8+(a-i<<1));h.set(s),s=h}var l=n.charCodeAt(i);l<128||r?f(l):l<2048?(f(192|l>>6),f(128|63&l)):l>55295&&l<57344?(f(240|(l=65536+(1047552&l)|1023&n.charCodeAt(++i))>>18),f(128|l>>12&63),f(128|l>>6&63),f(128|63&l)):(f(224|l>>12),f(128|l>>6&63),f(128|63&l))}return b(s,0,o)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(let r=0,e=t.length;r<e;r++)n+=t[r].length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function u5(){const t=new Blob([l5]);return URL.createObjectURL(t)}function kn(t,e){Ut&&(le.info(t),e&&dT(t))}function Xo(t,e){Ut&&(le.info(t),e&&setTimeout(()=>{dT(t)},0))}function dT(t){ms({category:"console",data:{logger:"replay"},level:"info",message:t},{level:"info"})}class Tg extends Error{constructor(){super(`Event buffer exceeded maximum size of ${yg}.`)}}class fT{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>yg)throw new Tg;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?wg(e):null}}class d5{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){kn("[Replay] Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const r=this._getAndIncrementId();return new Promise((i,s)=>{const o=({data:a})=>{const c=a;if(c.method===e&&c.id===r){if(this._worker.removeEventListener("message",o),!c.success){Ut&&le.error("[Replay]",c.response),s(new Error("Error in compression worker"));return}i(c.response)}};this._worker.addEventListener("message",o),this._worker.postMessage({id:r,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class f5{constructor(e){this._worker=new d5(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const n=wg(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>yg?Promise.reject(new Tg):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{Ut&&le.warn('[Replay] Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class p5{constructor(e){this._fallback=new fT,this._compression=new f5(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch{kn("[Replay] Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n}=this._fallback,r=[];for(const i of e)r.push(this._compression.addEvent(i));this._compression.hasCheckout=n,this._used=this._compression;try{await Promise.all(r)}catch(i){Ut&&le.warn("[Replay] Failed to add events when switching buffers.",i)}}}function h5({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=m5(e);if(n)return n}return kn("[Replay] Using simple buffer"),new fT}function m5(t){try{const e=t||g5();if(!e)return;kn(`[Replay] Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new p5(n)}catch{kn("[Replay] Failed to create compression worker")}}function g5(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?u5():""}function Ig(){try{return"sessionStorage"in zt&&!!zt.sessionStorage}catch{return!1}}function y5(t){v5(),t.session=void 0}function v5(){if(Ig())try{zt.sessionStorage.removeItem(mg)}catch{}}function pT(t){return t===void 0?!1:Math.random()<t}function hT(t){const e=Date.now(),n=t.id||en(),r=t.started||e,i=t.lastActivity||e,s=t.segmentId||0,o=t.sampled,a=t.previousSessionId;return{id:n,started:r,lastActivity:i,segmentId:s,sampled:o,previousSessionId:a}}function xg(t){if(Ig())try{zt.sessionStorage.setItem(mg,JSON.stringify(t))}catch{}}function _5(t,e){return pT(t)?"session":e?"buffer":!1}function qv({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:r}={}){const i=_5(t,e),s=hT({sampled:i,previousSessionId:r});return n&&xg(s),s}function b5(t){if(!Ig())return null;try{const e=zt.sessionStorage.getItem(mg);if(!e)return null;const n=JSON.parse(e);return Xo("[Replay] Loading existing session",t),hT(n)}catch{return null}}function Oh(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function mT(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:r=Date.now()}){return Oh(t.started,e,r)||Oh(t.lastActivity,n,r)}function gT(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!mT(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function pp({traceInternals:t,sessionIdleExpire:e,maxReplayDuration:n,previousSessionId:r},i){const s=i.stickySession&&b5(t);return s?gT(s,{sessionIdleExpire:e,maxReplayDuration:n})?(Xo("[Replay] Session in sessionStorage is expired, creating new one..."),qv(i,{previousSessionId:s.id})):s:(Xo("[Replay] Creating new session",t),qv(i,{previousSessionId:r}))}function E5(t){return t.type===dt.Custom}function Og(t,e,n){return vT(t,e)?(yT(t,e,n),!0):!1}function S5(t,e,n){return vT(t,e)?yT(t,e,n):Promise.resolve(null)}async function yT(t,e,n){if(!t.eventBuffer)return null;try{n&&t.recordingMode==="buffer"&&t.eventBuffer.clear(),n&&(t.eventBuffer.hasCheckout=!0);const r=t.getOptions(),i=w5(e,r.beforeAddRecordingEvent);return i?await t.eventBuffer.addEvent(i):void 0}catch(r){const i=r&&r instanceof Tg?"addEventSizeExceeded":"addEvent";Ut&&le.error(r),await t.stop({reason:i});const s=wt();s&&s.recordDroppedEvent("internal_sdk_error","replay")}}function vT(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=wg(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(kn(`[Replay] Skipping event with timestamp ${n} because it is after maxReplayDuration`,t.getOptions()._experiments.traceInternals),!1):!0}function w5(t,e){try{if(typeof e=="function"&&E5(t))return e(t)}catch(n){return Ut&&le.error("[Replay] An error occured in the `beforeAddRecordingEvent` callback, skipping the event...",n),null}return t}function Dg(t){return!t.type}function Dh(t){return t.type==="transaction"}function T5(t){return t.type==="replay_event"}function Zv(t){return t.type==="feedback"}function _T(t){const e=O5();return(n,r)=>{if(!t.isEnabled()||!Dg(n)&&!Dh(n))return;const i=r&&r.statusCode;if(!(e&&(!i||i<200||i>=300))){if(Dh(n)){I5(t,n);return}x5(t,n)}}}function I5(t,e){const n=t.getContext();e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function x5(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:r}=t.getOptions();typeof r=="function"&&!r(e)||setTimeout(()=>{t.sendBufferedReplayOrFlush()})}function O5(){const t=wt();if(!t)return!1;const e=t.getTransport();return e&&e.send.__sentry__baseTransport__||!1}function D5(t){return e=>{!t.isEnabled()||!Dg(e)||R5(t,e)}}function R5(t,e){const n=e.exception&&e.exception.values&&e.exception.values[0].value;if(typeof n=="string"&&(n.match(/reactjs\.org\/docs\/error-decoder\.html\?invariant=(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const r=Zr({category:"replay.hydrate-error"});jl(t,r)}}function k5(t,e){return t.type||!t.exception||!t.exception.values||!t.exception.values.length?!1:!!(e.originalException&&e.originalException.__rrweb__)}function N5(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:dt.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function A5(t,e){return t.recordingMode!=="buffer"||e.message===gg||!e.exception||e.type?!1:pT(t.getOptions().errorSampleRate)}function C5(t,e=!1){const n=e?_T(t):void 0;return Object.assign((r,i)=>t.isEnabled()?T5(r)?(delete r.breadcrumbs,r):!Dg(r)&&!Dh(r)&&!Zv(r)||!t.checkAndHandleExpiredSession()?r:Zv(r)?(t.flush(),r.contexts.feedback.replay_id=t.getSessionId(),N5(t,r),r):k5(r,i)&&!t.getOptions()._experiments.captureExceptions?(Ut&&le.log("[Replay] Ignoring error from rrweb internals",r),null):((A5(t,r)||t.recordingMode==="session")&&(r.tags={...r.tags,replayId:t.getSessionId()}),n&&n(r,{statusCode:200}),r):r,{id:"Replay"})}function uf(t,e){return e.map(({type:n,start:r,end:i,name:s,data:o})=>{const a=t.throttledAddEvent({type:dt.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:r,endTimestamp:i,data:o}}});return typeof a=="string"?Promise.resolve(null):a})}function M5(t){const{from:e,to:n}=t,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:e}}}function L5(t){return e=>{if(!t.isEnabled())return;const n=M5(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(uf(t,[n]),!1)))}}function P5(t,e){return Ut&&t.getOptions()._experiments.traceInternals?!1:s0(e,wt())}function df(t,e){t.isEnabled()&&e!==null&&(P5(t,e.name)||t.addUpdate(()=>(uf(t,[e]),!0)))}function F5(t){const{startTimestamp:e,endTimestamp:n,fetchData:r,response:i}=t;if(!n)return null;const{method:s,url:o}=r;return{type:"resource.fetch",start:e/1e3,end:n/1e3,name:o,data:{method:s,statusCode:i?i.status:void 0}}}function $5(t){return e=>{if(!t.isEnabled())return;const n=F5(e);df(t,n)}}function j5(t){const{startTimestamp:e,endTimestamp:n,xhr:r}=t,i=r[Ei];if(!e||!n||!i)return null;const{method:s,url:o,status_code:a}=i;return o===void 0?null:{type:"resource.xhr",name:o,start:e/1e3,end:n/1e3,data:{method:s,statusCode:a}}}function U5(t){return e=>{if(!t.isEnabled())return;const n=j5(e);df(t,n)}}function ff(t,e){if(t)try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=wT(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function bT(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function ET(t){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[wT(t)];if(!t)return[void 0]}catch{return Ut&&le.warn("[Replay] Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return Ut&&le.info("[Replay] Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Od(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},r=n.warnings||[];return n.warnings=[...r,e],t._meta=n,t}function ST(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:r,url:i,method:s,statusCode:o,request:a,response:c}=e;return{type:t,start:n/1e3,end:r/1e3,name:i,data:Mn({method:s,statusCode:o,request:a,response:c})}}function dl(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function ns(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const r={headers:t,size:e},{body:i,warnings:s}=B5(n);return r.body=i,s&&s.length>0&&(r._meta={warnings:s}),r}function Rh(t,e){return Object.keys(t).reduce((n,r)=>{const i=r.toLowerCase();return e.includes(i)&&t[r]&&(n[i]=t[r]),n},{})}function wT(t){return new URLSearchParams(t).toString()}function B5(t){if(!t||typeof t!="string")return{body:t};const e=t.length>Nv,n=z5(t);if(e){const r=t.slice(0,Nv);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function z5(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function Dd(t,e){const n=V5(t);return xa(n,e)}function V5(t,e=zt.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(zt.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const r=n.href;return!t.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function H5(t,e,n){try{const r=await q5(t,e,n),i=ST("resource.fetch",r);df(n.replay,i)}catch(r){Ut&&le.error("[Replay] Failed to capture fetch breadcrumb",r)}}function W5(t,e,n){const{input:r,response:i}=e,s=r?TT(r):void 0,o=ff(s,n.textEncoder),a=i?bT(i.headers.get("content-length")):void 0;o!==void 0&&(t.data.request_body_size=o),a!==void 0&&(t.data.response_body_size=a)}async function q5(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r}=e,{url:o,method:a,status_code:c=0,request_body_size:l,response_body_size:u}=t.data,d=Dd(o,n.networkDetailAllowUrls)&&!Dd(o,n.networkDetailDenyUrls),f=d?Z5(n,e.input,l):dl(l),p=await G5(d,n,e.response,u);return{startTimestamp:i,endTimestamp:s,url:o,method:a,statusCode:c,request:f,response:p}}function Z5({networkCaptureBodies:t,networkRequestHeaders:e},n,r){const i=n?X5(n,e):{};if(!t)return ns(i,r,void 0);const s=TT(n),[o,a]=ET(s),c=ns(i,r,o);return a?Od(c,a):c}async function G5(t,{networkCaptureBodies:e,textEncoder:n,networkResponseHeaders:r},i,s){if(!t&&s!==void 0)return dl(s);const o=i?IT(i.headers,r):{};if(!i||!e&&s!==void 0)return ns(o,s,void 0);const[a,c]=await J5(i),l=Y5(a,{networkCaptureBodies:e,textEncoder:n,responseBodySize:s,captureDetails:t,headers:o});return c?Od(l,c):l}function Y5(t,{networkCaptureBodies:e,textEncoder:n,responseBodySize:r,captureDetails:i,headers:s}){try{const o=t&&t.length&&r===void 0?ff(t,n):r;return i?e?ns(s,o,t):ns(s,o,void 0):dl(o)}catch(o){return Ut&&le.warn("[Replay] Failed to serialize response body",o),ns(s,r,void 0)}}async function J5(t){const e=K5(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await Q5(e)]}catch(n){return Ut&&le.warn("[Replay] Failed to get text body from response",n),[void 0,"BODY_PARSE_ERROR"]}}function TT(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}function IT(t,e){const n={};return e.forEach(r=>{t.get(r)&&(n[r]=t.get(r))}),n}function X5(t,e){return t.length===1&&typeof t[0]!="string"?Gv(t[0],e):t.length===2?Gv(t[1],e):{}}function Gv(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?IT(n,e):Array.isArray(n)?{}:Rh(n,e):{}}function K5(t){try{return t.clone()}catch(e){Ut&&le.warn("[Replay] Failed to clone response body",e)}}function Q5(t){return new Promise((e,n)=>{const r=setTimeout(()=>n(new Error("Timeout while trying to read response body")),500);eB(t).then(i=>e(i),i=>n(i)).finally(()=>clearTimeout(r))})}async function eB(t){return await t.text()}async function tB(t,e,n){try{const r=rB(t,e,n),i=ST("resource.xhr",r);df(n.replay,i)}catch(r){Ut&&le.error("[Replay] Failed to capture xhr breadcrumb",r)}}function nB(t,e,n){const{xhr:r,input:i}=e;if(!r)return;const s=ff(i,n.textEncoder),o=r.getResponseHeader("content-length")?bT(r.getResponseHeader("content-length")):aB(r.response,r.responseType,n.textEncoder);s!==void 0&&(t.data.request_body_size=s),o!==void 0&&(t.data.response_body_size=o)}function rB(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r,input:o,xhr:a}=e,{url:c,method:l,status_code:u=0,request_body_size:d,response_body_size:f}=t.data;if(!c)return null;if(!a||!Dd(c,n.networkDetailAllowUrls)||Dd(c,n.networkDetailDenyUrls)){const E=dl(d),R=dl(f);return{startTimestamp:i,endTimestamp:s,url:c,method:l,statusCode:u,request:E,response:R}}const p=a[Ei],h=p?Rh(p.request_headers,n.networkRequestHeaders):{},m=Rh(iB(a),n.networkResponseHeaders),[v,y]=n.networkCaptureBodies?ET(o):[void 0],[g,_]=n.networkCaptureBodies?sB(a):[void 0],T=ns(h,d,v),w=ns(m,f,g);return{startTimestamp:i,endTimestamp:s,url:c,method:l,statusCode:u,request:y?Od(T,y):T,response:_?Od(w,_):w}}function iB(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
|
|
427
|
-
`).reduce((n,r)=>{const[i,s]=r.split(": ");return n[i.toLowerCase()]=s,n},{}):{}}function sB(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return oB(t.response,t.responseType)}catch(n){e.push(n)}return Ut&&le.warn("[Replay] Failed to get xhr response body",...e),[void 0]}function oB(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch{return Ut&&le.warn("[Replay] Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return Ut&&le.info("[Replay] Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function aB(t,e,n){try{const r=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return ff(r,n)}catch{return}}function cB(t){const e=wt();try{const n=new TextEncoder,{networkDetailAllowUrls:r,networkDetailDenyUrls:i,networkCaptureBodies:s,networkRequestHeaders:o,networkResponseHeaders:a}=t.getOptions(),c={replay:t,textEncoder:n,networkDetailAllowUrls:r,networkDetailDenyUrls:i,networkCaptureBodies:s,networkRequestHeaders:o,networkResponseHeaders:a};e&&e.on?e.on("beforeAddBreadcrumb",(l,u)=>lB(c,l,u)):(Jd($5(t)),Kd(U5(t)))}catch{}}function lB(t,e,n){if(e.data)try{uB(e)&&fB(n)&&(nB(e,n,t),tB(e,n,t)),dB(e)&&pB(n)&&(W5(e,n,t),H5(e,n,t))}catch{Ut&&le.warn("Error when enriching network breadcrumb")}}function uB(t){return t.category==="xhr"}function dB(t){return t.category==="fetch"}function fB(t){return t&&t.xhr}function pB(t){return t&&t.response}let Yv=null;function hB(t){return!!t.category}const mB=t=>e=>{if(!t.isEnabled())return;const n=gB(e);n&&jl(t,n)};function gB(t){const e=t.getLastBreadcrumb&&t.getLastBreadcrumb();return Yv===e||!e||(Yv=e,!hB(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui."))?null:e.category==="console"?yB(e):Zr(e)}function yB(t){const e=t.data&&t.data.arguments;if(!Array.isArray(e)||e.length===0)return Zr(t);let n=!1;const r=e.map(i=>{if(!i)return i;if(typeof i=="string")return i.length>au?(n=!0,`${i.slice(0,au)}…`):i;if(typeof i=="object")try{const s=Sr(i,7);return JSON.stringify(s).length>au?(n=!0,`${JSON.stringify(s,null,2).slice(0,au)}…`):s}catch{}return i});return Zr({...t,data:{...t.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function vB(t){const e=rr(),n=wt();e.addScopeListener(mB(t)),ww(Y3(t)),Xd(L5(t)),cB(t);const r=C5(t,!Jv(n));n&&n.addEventProcessor?n.addEventProcessor(r):IF(r),Jv(n)&&(n.on("beforeSendEvent",D5(t)),n.on("afterSendEvent",_T(t)),n.on("createDsc",i=>{const s=t.getSessionId();s&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(i.replay_id=s)}),n.on("startTransaction",i=>{t.lastTransaction=i}),n.on("finishTransaction",i=>{t.lastTransaction=i}),n.on("beforeSendFeedback",(i,s)=>{const o=t.getSessionId();s&&s.includeReplay&&t.isEnabled()&&o&&i.contexts&&i.contexts.feedback&&(i.contexts.feedback.replay_id=o)}))}function Jv(t){return!!(t&&t.on)}async function _B(t){try{return Promise.all(uf(t,[bB(zt.performance.memory)]))}catch{return[]}}function bB(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}=t,i=Date.now()/1e3;return{type:"memory",name:"memory",start:i,end:i,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}}}}function EB(t,e,n){let r,i,s;const o=n.maxWait?Math.max(n.maxWait,e):0;function a(){return c(),r=t(),r}function c(){i!==void 0&&clearTimeout(i),s!==void 0&&clearTimeout(s),i=s=void 0}function l(){return i!==void 0||s!==void 0?a():r}function u(){return i&&clearTimeout(i),i=setTimeout(a,e),o&&s===void 0&&(s=setTimeout(a,o)),r}return u.cancel=c,u.flush=l,u}function SB(t){let e=!1;return(n,r)=>{if(!t.checkAndHandleExpiredSession()){Ut&&le.warn("[Replay] Received replay event after session expired.");return}const i=r||!e;e=!0,t.clickDetector&&H3(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&i&&t.setInitialState(),!Og(t,n,i))return!0;if(!i)return!1;if(TB(t,i),t.session&&t.session.previousSessionId)return!0;if(t.recordingMode==="buffer"&&t.session&&t.eventBuffer){const s=t.eventBuffer.getEarliestTimestamp();s&&(kn(`[Replay] Updating session start time to earliest event in buffer to ${new Date(s)}`,t.getOptions()._experiments.traceInternals),t.session.started=s,t.getOptions().stickySession&&xg(t.session))}return t.recordingMode==="session"&&t.flush(),!0})}}function wB(t){const e=t.getOptions();return{type:dt.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function TB(t,e){!e||!t.session||t.session.segmentId!==0||Og(t,wB(t),!1)}function IB(t,e,n,r){return ys(Cw(t,rg(t),r,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function xB({recordingData:t,headers:e}){let n;const r=`${JSON.stringify(e)}
|
|
428
|
-
`;if(typeof t=="string")n=`${r}${t}`;else{const s=new TextEncoder().encode(r);n=new Uint8Array(s.length+t.length),n.set(s),n.set(t,s.length)}return n}async function OB({client:t,scope:e,replayId:n,event:r}){const i=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,s={event_id:n,integrations:i};t.emit&&t.emit("preprocessEvent",r,s);const o=await jw(t.getOptions(),r,s,e,t,vs());if(!o)return null;o.platform=o.platform||"javascript";const a=t.getSdkMetadata&&t.getSdkMetadata(),{name:c,version:l}=a&&a.sdk||{};return o.sdk={...o.sdk,name:c||"sentry.javascript.unknown",version:l||"0.0.0"},o}async function DB({recordingData:t,replayId:e,segmentId:n,eventContext:r,timestamp:i,session:s}){const o=xB({recordingData:t,headers:{segment_id:n}}),{urls:a,errorIds:c,traceIds:l,initialTimestamp:u}=r,d=wt(),f=rr(),p=d&&d.getTransport(),h=d&&d.getDsn();if(!d||!p||!h||!s.sampled)return;const m={type:fU,replay_start_timestamp:u/1e3,timestamp:i/1e3,error_ids:c,trace_ids:l,urls:a,replay_id:e,segment_id:n,replay_type:s.sampled},v=await OB({scope:f,client:d,replayId:e,event:m});if(!v){d.recordDroppedEvent("event_processor","replay",m),kn("An event processor returned `null`, will not send event.");return}delete v.sdkProcessingMetadata;const y=IB(v,o,h,d.getOptions().tunnel);let g;try{g=await p.send(y)}catch(T){const w=new Error(gg);try{w.cause=T}catch{}throw w}if(!g)return g;if(typeof g.statusCode=="number"&&(g.statusCode<200||g.statusCode>=300))throw new xT(g.statusCode);const _=Lw({},g);if(Mw(_,"replay"))throw new OT(_);return g}class xT extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class OT extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function DT(t,e={count:0,interval:vU}){const{recordingData:n,options:r}=t;if(n.length)try{return await DB(t),!0}catch(i){if(i instanceof xT||i instanceof OT)throw i;if(L2("Replays",{_retryCount:e.count}),Ut&&r._experiments&&r._experiments.captureExceptions&&Al(i),e.count>=_U){const s=new Error(`${gg} - max retries exceeded`);try{s.cause=i}catch{}throw s}return e.interval*=++e.count,new Promise((s,o)=>{setTimeout(async()=>{try{await DT(t,e),s(!0)}catch(a){o(a)}},e.interval)})}}const RT="__THROTTLED",RB="__SKIPPED";function kB(t,e,n){const r=new Map,i=a=>{const c=a-n;r.forEach((l,u)=>{u<c&&r.delete(u)})},s=()=>[...r.values()].reduce((a,c)=>a+c,0);let o=!1;return(...a)=>{const c=Math.floor(Date.now()/1e3);if(i(c),s()>=e){const u=o;return o=!0,u?RB:RT}o=!1;const l=r.get(c)||0;return r.set(c,l+1),t(...a)}}class Ji{constructor({options:e,recordingOptions:n}){Ji.prototype.__init.call(this),Ji.prototype.__init2.call(this),Ji.prototype.__init3.call(this),Ji.prototype.__init4.call(this),Ji.prototype.__init5.call(this),Ji.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:pU,sessionIdleExpire:hU},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=EB(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=kB((o,a)=>S5(this,o,a),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(bU,r),timeout:r,scrollTimeout:EU,ignoreSelector:i?i.join(","):""}:void 0;s&&(this.clickDetector=new U3(this,s))}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:r}=this._options;if(!(n<=0&&r<=0)){if(this._initializeSessionForSampling(e),!this.session){this._handleException(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",Xo(`[Replay] Starting replay in ${this.recordingMode} mode`,this._options._experiments.traceInternals),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session")throw new Error("Replay recording is already in progress");if(this._isEnabled&&this.recordingMode==="buffer")throw new Error("Replay buffering is in progress, call `flush()` to save the replay");Xo("[Replay] Starting replay in session mode",this._options._experiments.traceInternals),this._updateUserActivity();const e=pp({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire,traceInternals:this._options._experiments.traceInternals},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this._initializeRecording()}startBuffering(){if(this._isEnabled)throw new Error("Replay recording is already in progress");Xo("[Replay] Starting replay in buffer mode",this._options._experiments.traceInternals);const e=pp({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,traceInternals:this._options._experiments.traceInternals},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=ts({...this._recordingOptions,...this.recordingMode==="buffer"&&{checkoutEveryNms:yU},emit:SB(this),onMutation:this._onMutationHandler,...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this._handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this._handleException(e),!1}}async stop({forceFlush:e=!1,reason:n}={}){if(this._isEnabled){this._isEnabled=!1;try{kn(`[Replay] Stopping Replay${n?` triggered by ${n}`:""}`,this._options._experiments.traceInternals),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,y5(this)}catch(r){this._handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),kn("[Replay] Pausing replay",this._options._experiments.traceInternals))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),kn("[Replay] Resuming replay",this._options._experiments.traceInternals))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();kn("[Replay] Converting buffer to session",this._options._experiments.traceInternals),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode!=="buffer"&&n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&Oh(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${zt.location.pathname}${zt.location.hash}${zt.location.search}`,n=`${zt.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const r=this._throttledAddEvent(e,n);if(r===RT){const i=Zr({category:"replay.throttled"});this.addUpdate(()=>!Og(this,{type:M3,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastTransaction||rr().getTransaction(),r=(e&&sn(e).data||{})[Kr];if(!(!e||!r||!["route","custom"].includes(r)))return sn(e).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=h5({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_handleException(e){Ut&&le.error("[Replay]",e),Ut&&this._options._experiments&&this._options._experiments.captureExceptions&&Al(e)}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,r=pp({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,traceInternals:this._options._experiments.traceInternals,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return gT(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{zt.document.addEventListener("visibilitychange",this._handleVisibilityChange),zt.addEventListener("blur",this._handleWindowBlur),zt.addEventListener("focus",this._handleWindowFocus),zt.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(vB(this),this._hasInitializedCoreListeners=!0)}catch(e){this._handleException(e)}this._performanceCleanupCallback=c5(this)}_removeListeners(){try{zt.document.removeEventListener("visibilitychange",this._handleVisibilityChange),zt.removeEventListener("blur",this._handleWindowBlur),zt.removeEventListener("focus",this._handleWindowFocus),zt.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this._handleException(e)}}__init(){this._handleVisibilityChange=()=>{zt.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()}}__init2(){this._handleWindowBlur=()=>{const e=Zr({category:"ui.blur"});this._doChangeToBackgroundTasks(e)}}__init3(){this._handleWindowFocus=()=>{const e=Zr({category:"ui.focus"});this._doChangeToForegroundTasks(e)}}__init4(){this._handleKeyboardEvent=e=>{Q3(this,e)}}_doChangeToBackgroundTasks(e){!this.session||mT(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){kn("[Replay] Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:dt.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){const e=n5(this.performanceEntries).concat(this.replayPerformanceEntries);return this.performanceEntries=[],this.replayPerformanceEntries=[],Promise.all(uf(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||e.segmentId)return;const r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){Ut&&le.error("[Replay] No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await _B(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const r=this._popEventContext(),i=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await DT({replayId:e,recordingData:s,segmentId:i,eventContext:r,session:this.session,options:this.getOptions(),timestamp:n})}catch(n){this._handleException(n),this.stop({reason:"sendReplay"});const r=wt();r&&r.recordDroppedEvent("send_error","replay")}}__init5(){this._flush=async({force:e=!1}={})=>{if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){Ut&&le.error("[Replay] Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,i=Date.now()-n;this._debouncedFlush.cancel();const s=i<this._options.minReplayDuration,o=i>this._options.maxReplayDuration+5e3;if(s||o){kn(`[Replay] Session duration (${Math.floor(i/1e3)}s) is too ${s?"short":"long"}, not sending replay.`,this._options._experiments.traceInternals),s&&this._debouncedFlush();return}const a=this.eventBuffer;if(a&&this.session.segmentId===0&&!a.hasCheckout&&kn("[Replay] Flushing initial segment without checkout.",this._options._experiments.traceInternals),!this._flushLock){this._flushLock=this._runFlush(),await this._flushLock,this._flushLock=void 0;return}try{await this._flushLock}catch(c){Ut&&le.error(c)}finally{this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&xg(this.session)}__init6(){this._onMutationHandler=e=>{const n=e.length,r=this._options.mutationLimit,i=this._options.mutationBreadcrumbLimit,s=r&&n>r;if(n>i||s){const o=Zr({category:"replay.mutations",data:{count:n,limit:s}});this._createCustomBreadcrumb(o)}return s?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function Ba(t,e,n,r){const i=typeof r=="string"?r.split(","):[],s=[...t,...i,...e];return typeof n<"u"&&(typeof n=="string"&&s.push(`.${n}`),eo(()=>{console.warn("[Replay] You are using a deprecated configuration item for privacy. Read the documentation on how to use the new privacy configuration.")})),s.join(",")}function NB({mask:t,unmask:e,block:n,unblock:r,ignore:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,ignoreClass:l}){const u=['base[href="/"]'],d=Ba(t,[".sentry-mask","[data-sentry-mask]"],a,c),f=Ba(e,[".sentry-unmask","[data-sentry-unmask]"]),p={maskTextSelector:d,unmaskTextSelector:f,blockSelector:Ba(n,[".sentry-block","[data-sentry-block]",...u],s,o),unblockSelector:Ba(r,[".sentry-unblock","[data-sentry-unblock]"]),ignoreSelector:Ba(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'],l)};return s instanceof RegExp&&(p.blockClass=s),a instanceof RegExp&&(p.maskTextClass=a),p}function AB({el:t,key:e,maskAttributes:n,maskAllText:r,privacyOptions:i,value:s}){return!r||i.unmaskTextSelector&&t.matches(i.unmaskTextSelector)?s:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const Xv='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',CB=["content-length","content-type","accept"];let Kv=!1;const MB=t=>new pf(t);class pf{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:e=mU,flushMaxDelay:n=gU,minReplayDuration:r=SU,maxReplayDuration:i=Av,stickySession:s=!0,useCompression:o=!0,workerUrl:a,_experiments:c={},sessionSampleRate:l,errorSampleRate:u,maskAllText:d=!0,maskAllInputs:f=!0,blockAllMedia:p=!0,mutationBreadcrumbLimit:h=750,mutationLimit:m=1e4,slowClickTimeout:v=7e3,slowClickIgnoreSelectors:y=[],networkDetailAllowUrls:g=[],networkDetailDenyUrls:_=[],networkCaptureBodies:T=!0,networkRequestHeaders:w=[],networkResponseHeaders:E=[],mask:R=[],maskAttributes:j=["title","placeholder"],unmask:M=[],block:$=[],unblock:ne=[],ignore:x=[],maskFn:G,beforeAddRecordingEvent:S,beforeErrorSampling:k,blockClass:C,blockSelector:U,maskInputOptions:oe,maskTextClass:F,maskTextSelector:Z,ignoreClass:L}={}){this.name=pf.id;const I=NB({mask:R,unmask:M,block:$,unblock:ne,ignore:x,blockClass:C,blockSelector:U,maskTextClass:F,maskTextSelector:Z,ignoreClass:L});if(this._recordingOptions={maskAllInputs:f,maskAllText:d,maskInputOptions:{...oe||{},password:!0},maskTextFn:G,maskInputFn:G,maskAttributeFn:(X,B,H)=>AB({maskAttributes:j,maskAllText:d,privacyOptions:I,key:X,value:B,el:H}),...I,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:X=>{try{X.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(r,wU),maxReplayDuration:Math.min(i,Av),stickySession:s,sessionSampleRate:l,errorSampleRate:u,useCompression:o,workerUrl:a,blockAllMedia:p,maskAllInputs:f,maskAllText:d,mutationBreadcrumbLimit:h,mutationLimit:m,slowClickTimeout:v,slowClickIgnoreSelectors:y,networkDetailAllowUrls:g,networkDetailDenyUrls:_,networkCaptureBodies:T,networkRequestHeaders:Qv(w),networkResponseHeaders:Qv(E),beforeAddRecordingEvent:S,beforeErrorSampling:k,_experiments:c},typeof l=="number"&&(console.warn(`[Replay] You are passing \`sessionSampleRate\` to the Replay integration.
|
|
429
|
-
This option is deprecated and will be removed soon.
|
|
430
|
-
Instead, configure \`replaysSessionSampleRate\` directly in the SDK init options, e.g.:
|
|
431
|
-
Sentry.init({ replaysSessionSampleRate: ${l} })`),this._initialOptions.sessionSampleRate=l),typeof u=="number"&&(console.warn(`[Replay] You are passing \`errorSampleRate\` to the Replay integration.
|
|
432
|
-
This option is deprecated and will be removed soon.
|
|
433
|
-
Instead, configure \`replaysOnErrorSampleRate\` directly in the SDK init options, e.g.:
|
|
434
|
-
Sentry.init({ replaysOnErrorSampleRate: ${u} })`),this._initialOptions.errorSampleRate=u),this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Xv}`:Xv),this._isInitialized&&Ky())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return Kv}set _isInitialized(e){Kv=e}setupOnce(){Ky()&&(this._setup(),setTimeout(()=>this._initialize()))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return!this._replay||!this._replay.isEnabled()?Promise.resolve():this._replay.sendBufferedReplayOrFlush(e)}getReplayId(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}_initialize(){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(),this._replay.initializeSampling())}_setup(){const e=LB(this._initialOptions);this._replay=new Ji({options:e,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(){try{const n=wt().getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}pf.__initStatic();function LB(t){const e=wt(),n=e&&e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...Mn(t)};return n?(t.sessionSampleRate==null&&t.errorSampleRate==null&&n.replaysSessionSampleRate==null&&n.replaysOnErrorSampleRate==null&&eo(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),typeof n.replaysSessionSampleRate=="number"&&(r.sessionSampleRate=n.replaysSessionSampleRate),typeof n.replaysOnErrorSampleRate=="number"&&(r.errorSampleRate=n.replaysOnErrorSampleRate),r):(eo(()=>{console.warn("SDK client is not available.")}),r)}function Qv(t){return[...CB,...t.map(e=>e.toLowerCase())]}const kT="CaptureConsole",PB=(t={})=>{const e=t.levels||fd;return{name:kT,setupOnce(){},setup(n){"console"in Et&&bw(({args:r,level:i})=>{wt()!==n||!e.includes(i)||FB(r,i)})}}},NT=PB;Pr(kT,NT);function FB(t,e){const n={level:Rw(e),extra:{arguments:t}};Uw(r=>{if(r.addEventProcessor(o=>(o.logger="console",to(o,{handled:!1,type:"console"}),o)),e==="assert"&&t[0]===!1){const o=`Assertion failed: ${dd(t.slice(1)," ")||"console.assert"}`;r.setExtra("arguments",t.slice(1)),iv(o,n);return}const i=t.find(o=>o instanceof Error);if(e==="error"&&i){Al(i,n);return}const s=dd(t," ");iv(s,n)})}const fl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,AT="ExtraErrorData",$B=(t={})=>{const e=t.depth||3,n=t.captureErrorCause||!1;return{name:AT,setupOnce(){},processEvent(r,i){return jB(r,i,e,n)}}},CT=$B;Pr(AT,CT);function jB(t,e={},n,r){if(!e.originalException||!Go(e.originalException))return t;const i=e.originalException.name||e.originalException.constructor.name,s=UB(e.originalException,r);if(s){const o={...t.contexts},a=Sr(s,n);return Qs(a)&&(hs(a,"__sentry_skip_normalization__",!0),o[i]=a),{...t,contexts:o}}return t}function UB(t,e){try{const n=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],r={};for(const i of Object.keys(t)){if(n.indexOf(i)!==-1)continue;const s=t[i];r[i]=Go(s)?s.toString():s}if(e&&t.cause!==void 0&&(r.cause=Go(t.cause)?t.cause.toString():t.cause),typeof t.toJSON=="function"){const i=t.toJSON();for(const s of Object.keys(i)){const o=i[s];r[s]=Go(o)?o.toString():o}}return r}catch(n){fl&&le.error("Unable to extract extra data from the Error object:",n)}return null}var MT={exports:{}};/*!
|
|
435
|
-
localForage -- Offline Storage, Improved
|
|
436
|
-
Version 1.10.0
|
|
437
|
-
https://localforage.github.io/localForage
|
|
438
|
-
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
439
|
-
*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(l,u){if(!i[l]){if(!r[l]){var d=typeof Qi=="function"&&Qi;if(!u&&d)return d(l,!0);if(a)return a(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var p=i[l]={exports:{}};r[l][0].call(p.exports,function(h){var m=r[l][1][h];return o(m||h)},p,p.exports,n,r,i,s)}return i[l].exports}for(var a=typeof Qi=="function"&&Qi,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,l=new o(h),u=s.document.createTextNode("");l.observe(u,{characterData:!0}),a=function(){u.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var d=new s.MessageChannel;d.port1.onmessage=h,a=function(){d.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var v=s.document.createElement("script");v.onreadystatechange=function(){h(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},s.document.documentElement.appendChild(v)}:a=function(){setTimeout(h,0)};var f,p=[];function h(){f=!0;for(var v,y,g=p.length;g;){for(y=p,p=[],v=-1;++v<g;)y[v]();g=p.length}f=!1}r.exports=m;function m(v){p.push(v)===1&&!f&&a()}}).call(this,typeof ar<"u"?ar:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},c=["REJECTED"],l=["FULFILLED"],u=["PENDING"];r.exports=d;function d(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,w!==o&&m(this,w)}d.prototype.catch=function(w){return this.then(null,w)},d.prototype.then=function(w,E){if(typeof w!="function"&&this.state===l||typeof E!="function"&&this.state===c)return this;var R=new this.constructor(o);if(this.state!==u){var j=this.state===l?w:E;p(R,j,this.outcome)}else this.queue.push(new f(R,w,E));return R};function f(w,E,R){this.promise=w,typeof E=="function"&&(this.onFulfilled=E,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},f.prototype.otherCallFulfilled=function(w){p(this.promise,this.onFulfilled,w)},f.prototype.callRejected=function(w){a.reject(this.promise,w)},f.prototype.otherCallRejected=function(w){p(this.promise,this.onRejected,w)};function p(w,E,R){s(function(){var j;try{j=E(R)}catch(M){return a.reject(w,M)}j===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,j)})}a.resolve=function(w,E){var R=v(h,E);if(R.status==="error")return a.reject(w,R.value);var j=R.value;if(j)m(w,j);else{w.state=l,w.outcome=E;for(var M=-1,$=w.queue.length;++M<$;)w.queue[M].callFulfilled(E)}return w},a.reject=function(w,E){w.state=c,w.outcome=E;for(var R=-1,j=w.queue.length;++R<j;)w.queue[R].callRejected(E);return w};function h(w){var E=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof E=="function")return function(){E.apply(w,arguments)}}function m(w,E){var R=!1;function j(x){R||(R=!0,a.reject(w,x))}function M(x){R||(R=!0,a.resolve(w,x))}function $(){E(M,j)}var ne=v($);ne.status==="error"&&j(ne.value)}function v(w,E){var R={};try{R.value=w(E),R.status="success"}catch(j){R.status="error",R.value=j}return R}d.resolve=y;function y(w){return w instanceof this?w:a.resolve(new this(o),w)}d.reject=g;function g(w){var E=new this(o);return a.reject(E,w)}d.all=_;function _(w){var E=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=w.length,j=!1;if(!R)return this.resolve([]);for(var M=new Array(R),$=0,ne=-1,x=new this(o);++ne<R;)G(w[ne],ne);return x;function G(S,k){E.resolve(S).then(C,function(U){j||(j=!0,a.reject(x,U))});function C(U){M[k]=U,++$===R&&!j&&(j=!0,a.resolve(x,M))}}}d.race=T;function T(w){var E=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=w.length,j=!1;if(!R)return this.resolve([]);for(var M=-1,$=new this(o);++M<R;)ne(w[M]);return $;function ne(x){E.resolve(x).then(function(G){j||(j=!0,a.resolve($,G))},function(G){j||(j=!0,a.reject($,G))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof ar<"u"?ar:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(O){return typeof O}:function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O};function o(O,z){if(!(O instanceof z))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function l(){try{if(!c||!c.open)return!1;var O=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),z=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!O||z)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function u(O,z){O=O||[],z=z||{};try{return new Blob(O,z)}catch(Y){if(Y.name!=="TypeError")throw Y;for(var N=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,J=new N,ee=0;ee<O.length;ee+=1)J.append(O[ee]);return J.getBlob(z.type)}}typeof Promise>"u"&&n(3);var d=Promise;function f(O,z){z&&O.then(function(N){z(null,N)},function(N){z(N)})}function p(O,z,N){typeof z=="function"&&O.then(z),typeof N=="function"&&O.catch(N)}function h(O){return typeof O!="string"&&(console.warn(O+" used as a key, but it is not a string."),O=String(O)),O}function m(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var v="local-forage-detect-blob-support",y=void 0,g={},_=Object.prototype.toString,T="readonly",w="readwrite";function E(O){for(var z=O.length,N=new ArrayBuffer(z),J=new Uint8Array(N),ee=0;ee<z;ee++)J[ee]=O.charCodeAt(ee);return N}function R(O){return new d(function(z){var N=O.transaction(v,w),J=u([""]);N.objectStore(v).put(J,"key"),N.onabort=function(ee){ee.preventDefault(),ee.stopPropagation(),z(!1)},N.oncomplete=function(){var ee=navigator.userAgent.match(/Chrome\/(\d+)/),Y=navigator.userAgent.match(/Edge\//);z(Y||!ee||parseInt(ee[1],10)>=43)}}).catch(function(){return!1})}function j(O){return typeof y=="boolean"?d.resolve(y):R(O).then(function(z){return y=z,y})}function M(O){var z=g[O.name],N={};N.promise=new d(function(J,ee){N.resolve=J,N.reject=ee}),z.deferredOperations.push(N),z.dbReady?z.dbReady=z.dbReady.then(function(){return N.promise}):z.dbReady=N.promise}function $(O){var z=g[O.name],N=z.deferredOperations.pop();if(N)return N.resolve(),N.promise}function ne(O,z){var N=g[O.name],J=N.deferredOperations.pop();if(J)return J.reject(z),J.promise}function x(O,z){return new d(function(N,J){if(g[O.name]=g[O.name]||I(),O.db)if(z)M(O),O.db.close();else return N(O.db);var ee=[O.name];z&&ee.push(O.version);var Y=c.open.apply(c,ee);z&&(Y.onupgradeneeded=function(de){var me=Y.result;try{me.createObjectStore(O.storeName),de.oldVersion<=1&&me.createObjectStore(v)}catch(Se){if(Se.name==="ConstraintError")console.warn('The database "'+O.name+'" has been upgraded from version '+de.oldVersion+" to version "+de.newVersion+', but the storage "'+O.storeName+'" already exists.');else throw Se}}),Y.onerror=function(de){de.preventDefault(),J(Y.error)},Y.onsuccess=function(){var de=Y.result;de.onversionchange=function(me){me.target.close()},N(de),$(O)}})}function G(O){return x(O,!1)}function S(O){return x(O,!0)}function k(O,z){if(!O.db)return!0;var N=!O.db.objectStoreNames.contains(O.storeName),J=O.version<O.db.version,ee=O.version>O.db.version;if(J&&(O.version!==z&&console.warn('The database "'+O.name+`" can't be downgraded from version `+O.db.version+" to version "+O.version+"."),O.version=O.db.version),ee||N){if(N){var Y=O.db.version+1;Y>O.version&&(O.version=Y)}return!0}return!1}function C(O){return new d(function(z,N){var J=new FileReader;J.onerror=N,J.onloadend=function(ee){var Y=btoa(ee.target.result||"");z({__local_forage_encoded_blob:!0,data:Y,type:O.type})},J.readAsBinaryString(O)})}function U(O){var z=E(atob(O.data));return u([z],{type:O.type})}function oe(O){return O&&O.__local_forage_encoded_blob}function F(O){var z=this,N=z._initReady().then(function(){var J=g[z._dbInfo.name];if(J&&J.dbReady)return J.dbReady});return p(N,O,O),N}function Z(O){M(O);for(var z=g[O.name],N=z.forages,J=0;J<N.length;J++){var ee=N[J];ee._dbInfo.db&&(ee._dbInfo.db.close(),ee._dbInfo.db=null)}return O.db=null,G(O).then(function(Y){return O.db=Y,k(O)?S(O):Y}).then(function(Y){O.db=z.db=Y;for(var de=0;de<N.length;de++)N[de]._dbInfo.db=Y}).catch(function(Y){throw ne(O,Y),Y})}function L(O,z,N,J){J===void 0&&(J=1);try{var ee=O.db.transaction(O.storeName,z);N(null,ee)}catch(Y){if(J>0&&(!O.db||Y.name==="InvalidStateError"||Y.name==="NotFoundError"))return d.resolve().then(function(){if(!O.db||Y.name==="NotFoundError"&&!O.db.objectStoreNames.contains(O.storeName)&&O.version<=O.db.version)return O.db&&(O.version=O.db.version+1),S(O)}).then(function(){return Z(O).then(function(){L(O,z,N,J-1)})}).catch(N);N(Y)}}function I(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function X(O){var z=this,N={db:null};if(O)for(var J in O)N[J]=O[J];var ee=g[N.name];ee||(ee=I(),g[N.name]=ee),ee.forages.push(z),z._initReady||(z._initReady=z.ready,z.ready=F);var Y=[];function de(){return d.resolve()}for(var me=0;me<ee.forages.length;me++){var Se=ee.forages[me];Se!==z&&Y.push(Se._initReady().catch(de))}var we=ee.forages.slice(0);return d.all(Y).then(function(){return N.db=ee.db,G(N)}).then(function(xe){return N.db=xe,k(N,z._defaultConfig.version)?S(N):xe}).then(function(xe){N.db=ee.db=xe,z._dbInfo=N;for(var $e=0;$e<we.length;$e++){var gt=we[$e];gt!==z&&(gt._dbInfo.db=N.db,gt._dbInfo.version=N.version)}})}function B(O,z){var N=this;O=h(O);var J=new d(function(ee,Y){N.ready().then(function(){L(N._dbInfo,T,function(de,me){if(de)return Y(de);try{var Se=me.objectStore(N._dbInfo.storeName),we=Se.get(O);we.onsuccess=function(){var xe=we.result;xe===void 0&&(xe=null),oe(xe)&&(xe=U(xe)),ee(xe)},we.onerror=function(){Y(we.error)}}catch(xe){Y(xe)}})}).catch(Y)});return f(J,z),J}function H(O,z){var N=this,J=new d(function(ee,Y){N.ready().then(function(){L(N._dbInfo,T,function(de,me){if(de)return Y(de);try{var Se=me.objectStore(N._dbInfo.storeName),we=Se.openCursor(),xe=1;we.onsuccess=function(){var $e=we.result;if($e){var gt=$e.value;oe(gt)&&(gt=U(gt));var Nt=O(gt,$e.key,xe++);Nt!==void 0?ee(Nt):$e.continue()}else ee()},we.onerror=function(){Y(we.error)}}catch($e){Y($e)}})}).catch(Y)});return f(J,z),J}function ve(O,z,N){var J=this;O=h(O);var ee=new d(function(Y,de){var me;J.ready().then(function(){return me=J._dbInfo,_.call(z)==="[object Blob]"?j(me.db).then(function(Se){return Se?z:C(z)}):z}).then(function(Se){L(J._dbInfo,w,function(we,xe){if(we)return de(we);try{var $e=xe.objectStore(J._dbInfo.storeName);Se===null&&(Se=void 0);var gt=$e.put(Se,O);xe.oncomplete=function(){Se===void 0&&(Se=null),Y(Se)},xe.onabort=xe.onerror=function(){var Nt=gt.error?gt.error:gt.transaction.error;de(Nt)}}catch(Nt){de(Nt)}})}).catch(de)});return f(ee,N),ee}function he(O,z){var N=this;O=h(O);var J=new d(function(ee,Y){N.ready().then(function(){L(N._dbInfo,w,function(de,me){if(de)return Y(de);try{var Se=me.objectStore(N._dbInfo.storeName),we=Se.delete(O);me.oncomplete=function(){ee()},me.onerror=function(){Y(we.error)},me.onabort=function(){var xe=we.error?we.error:we.transaction.error;Y(xe)}}catch(xe){Y(xe)}})}).catch(Y)});return f(J,z),J}function Ee(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){L(z._dbInfo,w,function(Y,de){if(Y)return ee(Y);try{var me=de.objectStore(z._dbInfo.storeName),Se=me.clear();de.oncomplete=function(){J()},de.onabort=de.onerror=function(){var we=Se.error?Se.error:Se.transaction.error;ee(we)}}catch(we){ee(we)}})}).catch(ee)});return f(N,O),N}function ze(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){L(z._dbInfo,T,function(Y,de){if(Y)return ee(Y);try{var me=de.objectStore(z._dbInfo.storeName),Se=me.count();Se.onsuccess=function(){J(Se.result)},Se.onerror=function(){ee(Se.error)}}catch(we){ee(we)}})}).catch(ee)});return f(N,O),N}function rt(O,z){var N=this,J=new d(function(ee,Y){if(O<0){ee(null);return}N.ready().then(function(){L(N._dbInfo,T,function(de,me){if(de)return Y(de);try{var Se=me.objectStore(N._dbInfo.storeName),we=!1,xe=Se.openKeyCursor();xe.onsuccess=function(){var $e=xe.result;if(!$e){ee(null);return}O===0||we?ee($e.key):(we=!0,$e.advance(O))},xe.onerror=function(){Y(xe.error)}}catch($e){Y($e)}})}).catch(Y)});return f(J,z),J}function We(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){L(z._dbInfo,T,function(Y,de){if(Y)return ee(Y);try{var me=de.objectStore(z._dbInfo.storeName),Se=me.openKeyCursor(),we=[];Se.onsuccess=function(){var xe=Se.result;if(!xe){J(we);return}we.push(xe.key),xe.continue()},Se.onerror=function(){ee(Se.error)}}catch(xe){ee(xe)}})}).catch(ee)});return f(N,O),N}function it(O,z){z=m.apply(this,arguments);var N=this.config();O=typeof O!="function"&&O||{},O.name||(O.name=O.name||N.name,O.storeName=O.storeName||N.storeName);var J=this,ee;if(!O.name)ee=d.reject("Invalid arguments");else{var Y=O.name===N.name&&J._dbInfo.db,de=Y?d.resolve(J._dbInfo.db):G(O).then(function(me){var Se=g[O.name],we=Se.forages;Se.db=me;for(var xe=0;xe<we.length;xe++)we[xe]._dbInfo.db=me;return me});O.storeName?ee=de.then(function(me){if(me.objectStoreNames.contains(O.storeName)){var Se=me.version+1;M(O);var we=g[O.name],xe=we.forages;me.close();for(var $e=0;$e<xe.length;$e++){var gt=xe[$e];gt._dbInfo.db=null,gt._dbInfo.version=Se}var Nt=new d(function(Ct,on){var tn=c.open(O.name,Se);tn.onerror=function(sr){var Ca=tn.result;Ca.close(),on(sr)},tn.onupgradeneeded=function(){var sr=tn.result;sr.deleteObjectStore(O.storeName)},tn.onsuccess=function(){var sr=tn.result;sr.close(),Ct(sr)}});return Nt.then(function(Ct){we.db=Ct;for(var on=0;on<xe.length;on++){var tn=xe[on];tn._dbInfo.db=Ct,$(tn._dbInfo)}}).catch(function(Ct){throw(ne(O,Ct)||d.resolve()).catch(function(){}),Ct})}}):ee=de.then(function(me){M(O);var Se=g[O.name],we=Se.forages;me.close();for(var xe=0;xe<we.length;xe++){var $e=we[xe];$e._dbInfo.db=null}var gt=new d(function(Nt,Ct){var on=c.deleteDatabase(O.name);on.onerror=function(){var tn=on.result;tn&&tn.close(),Ct(on.error)},on.onblocked=function(){console.warn('dropInstance blocked for database "'+O.name+'" until all open connections are closed')},on.onsuccess=function(){var tn=on.result;tn&&tn.close(),Nt(tn)}});return gt.then(function(Nt){Se.db=Nt;for(var Ct=0;Ct<we.length;Ct++){var on=we[Ct];$(on._dbInfo)}}).catch(function(Nt){throw(ne(O,Nt)||d.resolve()).catch(function(){}),Nt})})}return f(ee,z),ee}var At={_driver:"asyncStorage",_initStorage:X,_support:l(),iterate:H,getItem:B,setItem:ve,removeItem:he,clear:Ee,length:ze,key:rt,keys:We,dropInstance:it};function b(){return typeof openDatabase=="function"}var ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ie="~~local_forage_type~",P=/^~~local_forage_type~([^~]+)~/,A="__lfsc__:",V=A.length,ue="arbf",se="blob",K="si08",ce="ui08",Ie="uic8",be="si16",Be="si32",ht="ur16",et="ui32",pn="fl32",qn="fl64",Dn=V+ue.length,bn=Object.prototype.toString;function jt(O){var z=O.length*.75,N=O.length,J,ee=0,Y,de,me,Se;O[O.length-1]==="="&&(z--,O[O.length-2]==="="&&z--);var we=new ArrayBuffer(z),xe=new Uint8Array(we);for(J=0;J<N;J+=4)Y=ae.indexOf(O[J]),de=ae.indexOf(O[J+1]),me=ae.indexOf(O[J+2]),Se=ae.indexOf(O[J+3]),xe[ee++]=Y<<2|de>>4,xe[ee++]=(de&15)<<4|me>>2,xe[ee++]=(me&3)<<6|Se&63;return we}function pr(O){var z=new Uint8Array(O),N="",J;for(J=0;J<z.length;J+=3)N+=ae[z[J]>>2],N+=ae[(z[J]&3)<<4|z[J+1]>>4],N+=ae[(z[J+1]&15)<<2|z[J+2]>>6],N+=ae[z[J+2]&63];return z.length%3===2?N=N.substring(0,N.length-1)+"=":z.length%3===1&&(N=N.substring(0,N.length-2)+"=="),N}function Li(O,z){var N="";if(O&&(N=bn.call(O)),O&&(N==="[object ArrayBuffer]"||O.buffer&&bn.call(O.buffer)==="[object ArrayBuffer]")){var J,ee=A;O instanceof ArrayBuffer?(J=O,ee+=ue):(J=O.buffer,N==="[object Int8Array]"?ee+=K:N==="[object Uint8Array]"?ee+=ce:N==="[object Uint8ClampedArray]"?ee+=Ie:N==="[object Int16Array]"?ee+=be:N==="[object Uint16Array]"?ee+=ht:N==="[object Int32Array]"?ee+=Be:N==="[object Uint32Array]"?ee+=et:N==="[object Float32Array]"?ee+=pn:N==="[object Float64Array]"?ee+=qn:z(new Error("Failed to get type for BinaryArray"))),z(ee+pr(J))}else if(N==="[object Blob]"){var Y=new FileReader;Y.onload=function(){var de=ie+O.type+"~"+pr(this.result);z(A+se+de)},Y.readAsArrayBuffer(O)}else try{z(JSON.stringify(O))}catch(de){console.error("Couldn't convert value into a JSON string: ",O),z(null,de)}}function Zn(O){if(O.substring(0,V)!==A)return JSON.parse(O);var z=O.substring(Dn),N=O.substring(V,Dn),J;if(N===se&&P.test(z)){var ee=z.match(P);J=ee[1],z=z.substring(ee[0].length)}var Y=jt(z);switch(N){case ue:return Y;case se:return u([Y],{type:J});case K:return new Int8Array(Y);case ce:return new Uint8Array(Y);case Ie:return new Uint8ClampedArray(Y);case be:return new Int16Array(Y);case ht:return new Uint16Array(Y);case Be:return new Int32Array(Y);case et:return new Uint32Array(Y);case pn:return new Float32Array(Y);case qn:return new Float64Array(Y);default:throw new Error("Unkown type: "+N)}}var oi={serialize:Li,deserialize:Zn,stringToBuffer:jt,bufferToString:pr};function ai(O,z,N,J){O.executeSql("CREATE TABLE IF NOT EXISTS "+z.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],N,J)}function mo(O){var z=this,N={db:null};if(O)for(var J in O)N[J]=typeof O[J]!="string"?O[J].toString():O[J];var ee=new d(function(Y,de){try{N.db=openDatabase(N.name,String(N.version),N.description,N.size)}catch(me){return de(me)}N.db.transaction(function(me){ai(me,N,function(){z._dbInfo=N,Y()},function(Se,we){de(we)})},de)});return N.serializer=oi,ee}function jn(O,z,N,J,ee,Y){O.executeSql(N,J,ee,function(de,me){me.code===me.SYNTAX_ERR?de.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[z.storeName],function(Se,we){we.rows.length?Y(Se,me):ai(Se,z,function(){Se.executeSql(N,J,ee,Y)},Y)},Y):Y(de,me)},Y)}function Pi(O,z){var N=this;O=h(O);var J=new d(function(ee,Y){N.ready().then(function(){var de=N._dbInfo;de.db.transaction(function(me){jn(me,de,"SELECT * FROM "+de.storeName+" WHERE key = ? LIMIT 1",[O],function(Se,we){var xe=we.rows.length?we.rows.item(0).value:null;xe&&(xe=de.serializer.deserialize(xe)),ee(xe)},function(Se,we){Y(we)})})}).catch(Y)});return f(J,z),J}function ci(O,z){var N=this,J=new d(function(ee,Y){N.ready().then(function(){var de=N._dbInfo;de.db.transaction(function(me){jn(me,de,"SELECT * FROM "+de.storeName,[],function(Se,we){for(var xe=we.rows,$e=xe.length,gt=0;gt<$e;gt++){var Nt=xe.item(gt),Ct=Nt.value;if(Ct&&(Ct=de.serializer.deserialize(Ct)),Ct=O(Ct,Nt.key,gt+1),Ct!==void 0){ee(Ct);return}}ee()},function(Se,we){Y(we)})})}).catch(Y)});return f(J,z),J}function $r(O,z,N,J){var ee=this;O=h(O);var Y=new d(function(de,me){ee.ready().then(function(){z===void 0&&(z=null);var Se=z,we=ee._dbInfo;we.serializer.serialize(z,function(xe,$e){$e?me($e):we.db.transaction(function(gt){jn(gt,we,"INSERT OR REPLACE INTO "+we.storeName+" (key, value) VALUES (?, ?)",[O,xe],function(){de(Se)},function(Nt,Ct){me(Ct)})},function(gt){if(gt.code===gt.QUOTA_ERR){if(J>0){de($r.apply(ee,[O,Se,N,J-1]));return}me(gt)}})})}).catch(me)});return f(Y,N),Y}function Cf(O,z,N){return $r.apply(this,[O,z,N,1])}function zl(O,z){var N=this;O=h(O);var J=new d(function(ee,Y){N.ready().then(function(){var de=N._dbInfo;de.db.transaction(function(me){jn(me,de,"DELETE FROM "+de.storeName+" WHERE key = ?",[O],function(){ee()},function(Se,we){Y(we)})})}).catch(Y)});return f(J,z),J}function go(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){var Y=z._dbInfo;Y.db.transaction(function(de){jn(de,Y,"DELETE FROM "+Y.storeName,[],function(){J()},function(me,Se){ee(Se)})})}).catch(ee)});return f(N,O),N}function yo(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){var Y=z._dbInfo;Y.db.transaction(function(de){jn(de,Y,"SELECT COUNT(key) as c FROM "+Y.storeName,[],function(me,Se){var we=Se.rows.item(0).c;J(we)},function(me,Se){ee(Se)})})}).catch(ee)});return f(N,O),N}function Mf(O,z){var N=this,J=new d(function(ee,Y){N.ready().then(function(){var de=N._dbInfo;de.db.transaction(function(me){jn(me,de,"SELECT key FROM "+de.storeName+" WHERE id = ? LIMIT 1",[O+1],function(Se,we){var xe=we.rows.length?we.rows.item(0).key:null;ee(xe)},function(Se,we){Y(we)})})}).catch(Y)});return f(J,z),J}function Lf(O){var z=this,N=new d(function(J,ee){z.ready().then(function(){var Y=z._dbInfo;Y.db.transaction(function(de){jn(de,Y,"SELECT key FROM "+Y.storeName,[],function(me,Se){for(var we=[],xe=0;xe<Se.rows.length;xe++)we.push(Se.rows.item(xe).key);J(we)},function(me,Se){ee(Se)})})}).catch(ee)});return f(N,O),N}function W(O){return new d(function(z,N){O.transaction(function(J){J.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(ee,Y){for(var de=[],me=0;me<Y.rows.length;me++)de.push(Y.rows.item(me).name);z({db:O,storeNames:de})},function(ee,Y){N(Y)})},function(J){N(J)})})}function Q(O,z){z=m.apply(this,arguments);var N=this.config();O=typeof O!="function"&&O||{},O.name||(O.name=O.name||N.name,O.storeName=O.storeName||N.storeName);var J=this,ee;return O.name?ee=new d(function(Y){var de;O.name===N.name?de=J._dbInfo.db:de=openDatabase(O.name,"","",0),O.storeName?Y({db:de,storeNames:[O.storeName]}):Y(W(de))}).then(function(Y){return new d(function(de,me){Y.db.transaction(function(Se){function we(Nt){return new d(function(Ct,on){Se.executeSql("DROP TABLE IF EXISTS "+Nt,[],function(){Ct()},function(tn,sr){on(sr)})})}for(var xe=[],$e=0,gt=Y.storeNames.length;$e<gt;$e++)xe.push(we(Y.storeNames[$e]));d.all(xe).then(function(){de()}).catch(function(Nt){me(Nt)})},function(Se){me(Se)})})}):ee=d.reject("Invalid arguments"),f(ee,z),ee}var re={_driver:"webSQLStorage",_initStorage:mo,_support:b(),iterate:ci,getItem:Pi,setItem:Cf,removeItem:zl,clear:go,length:yo,key:Mf,keys:Lf,dropInstance:Q};function pe(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Re(O,z){var N=O.name+"/";return O.storeName!==z.storeName&&(N+=O.storeName+"/"),N}function Ve(){var O="_localforage_support_test";try{return localStorage.setItem(O,!0),localStorage.removeItem(O),!1}catch{return!0}}function nt(){return!Ve()||localStorage.length>0}function Me(O){var z=this,N={};if(O)for(var J in O)N[J]=O[J];return N.keyPrefix=Re(O,z._defaultConfig),nt()?(z._dbInfo=N,N.serializer=oi,d.resolve()):d.reject()}function Le(O){var z=this,N=z.ready().then(function(){for(var J=z._dbInfo.keyPrefix,ee=localStorage.length-1;ee>=0;ee--){var Y=localStorage.key(ee);Y.indexOf(J)===0&&localStorage.removeItem(Y)}});return f(N,O),N}function Ae(O,z){var N=this;O=h(O);var J=N.ready().then(function(){var ee=N._dbInfo,Y=localStorage.getItem(ee.keyPrefix+O);return Y&&(Y=ee.serializer.deserialize(Y)),Y});return f(J,z),J}function He(O,z){var N=this,J=N.ready().then(function(){for(var ee=N._dbInfo,Y=ee.keyPrefix,de=Y.length,me=localStorage.length,Se=1,we=0;we<me;we++){var xe=localStorage.key(we);if(xe.indexOf(Y)===0){var $e=localStorage.getItem(xe);if($e&&($e=ee.serializer.deserialize($e)),$e=O($e,xe.substring(de),Se++),$e!==void 0)return $e}}});return f(J,z),J}function mt(O,z){var N=this,J=N.ready().then(function(){var ee=N._dbInfo,Y;try{Y=localStorage.key(O)}catch{Y=null}return Y&&(Y=Y.substring(ee.keyPrefix.length)),Y});return f(J,z),J}function St(O){var z=this,N=z.ready().then(function(){for(var J=z._dbInfo,ee=localStorage.length,Y=[],de=0;de<ee;de++){var me=localStorage.key(de);me.indexOf(J.keyPrefix)===0&&Y.push(me.substring(J.keyPrefix.length))}return Y});return f(N,O),N}function cn(O){var z=this,N=z.keys().then(function(J){return J.length});return f(N,O),N}function Pt(O,z){var N=this;O=h(O);var J=N.ready().then(function(){var ee=N._dbInfo;localStorage.removeItem(ee.keyPrefix+O)});return f(J,z),J}function Ot(O,z,N){var J=this;O=h(O);var ee=J.ready().then(function(){z===void 0&&(z=null);var Y=z;return new d(function(de,me){var Se=J._dbInfo;Se.serializer.serialize(z,function(we,xe){if(xe)me(xe);else try{localStorage.setItem(Se.keyPrefix+O,we),de(Y)}catch($e){($e.name==="QuotaExceededError"||$e.name==="NS_ERROR_DOM_QUOTA_REACHED")&&me($e),me($e)}})})});return f(ee,N),ee}function Ht(O,z){if(z=m.apply(this,arguments),O=typeof O!="function"&&O||{},!O.name){var N=this.config();O.name=O.name||N.name,O.storeName=O.storeName||N.storeName}var J=this,ee;return O.name?ee=new d(function(Y){O.storeName?Y(Re(O,J._defaultConfig)):Y(O.name+"/")}).then(function(Y){for(var de=localStorage.length-1;de>=0;de--){var me=localStorage.key(de);me.indexOf(Y)===0&&localStorage.removeItem(me)}}):ee=d.reject("Invalid arguments"),f(ee,z),ee}var Fi={_driver:"localStorageWrapper",_initStorage:Me,_support:pe(),iterate:He,getItem:Ae,setItem:Ot,removeItem:Pt,clear:Le,length:cn,key:mt,keys:St,dropInstance:Ht},Es=function(z,N){return z===N||typeof z=="number"&&typeof N=="number"&&isNaN(z)&&isNaN(N)},hr=function(z,N){for(var J=z.length,ee=0;ee<J;){if(Es(z[ee],N))return!0;ee++}return!1},Gn=Array.isArray||function(O){return Object.prototype.toString.call(O)==="[object Array]"},li={},$i={},Un={INDEXEDDB:At,WEBSQL:re,LOCALSTORAGE:Fi},vo=[Un.INDEXEDDB._driver,Un.WEBSQL._driver,Un.LOCALSTORAGE._driver],ui=["dropInstance"],vt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ui),Wt={description:"",driver:vo.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ji(O,z){O[z]=function(){var N=arguments;return O.ready().then(function(){return O[z].apply(O,N)})}}function di(){for(var O=1;O<arguments.length;O++){var z=arguments[O];if(z)for(var N in z)z.hasOwnProperty(N)&&(Gn(z[N])?arguments[0][N]=z[N].slice():arguments[0][N]=z[N])}return arguments[0]}var Xt=function(){function O(z){o(this,O);for(var N in Un)if(Un.hasOwnProperty(N)){var J=Un[N],ee=J._driver;this[N]=ee,li[ee]||this.defineDriver(J)}this._defaultConfig=di({},Wt),this._config=di({},this._defaultConfig,z),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return O.prototype.config=function(N){if((typeof N>"u"?"undefined":s(N))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var J in N){if(J==="storeName"&&(N[J]=N[J].replace(/\W/g,"_")),J==="version"&&typeof N[J]!="number")return new Error("Database version must be a number.");this._config[J]=N[J]}return"driver"in N&&N.driver?this.setDriver(this._config.driver):!0}else return typeof N=="string"?this._config[N]:this._config},O.prototype.defineDriver=function(N,J,ee){var Y=new d(function(de,me){try{var Se=N._driver,we=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!N._driver){me(we);return}for(var xe=vt.concat("_initStorage"),$e=0,gt=xe.length;$e<gt;$e++){var Nt=xe[$e],Ct=!hr(ui,Nt);if((Ct||N[Nt])&&typeof N[Nt]!="function"){me(we);return}}var on=function(){for(var Ca=function(zO){return function(){var VO=new Error("Method "+zO+" is not implemented by the current driver"),Zg=d.reject(VO);return f(Zg,arguments[arguments.length-1]),Zg}},Pf=0,BO=ui.length;Pf<BO;Pf++){var Ff=ui[Pf];N[Ff]||(N[Ff]=Ca(Ff))}};on();var tn=function(Ca){li[Se]&&console.info("Redefining LocalForage driver: "+Se),li[Se]=N,$i[Se]=Ca,de()};"_support"in N?N._support&&typeof N._support=="function"?N._support().then(tn,me):tn(!!N._support):tn(!0)}catch(sr){me(sr)}});return p(Y,J,ee),Y},O.prototype.driver=function(){return this._driver||null},O.prototype.getDriver=function(N,J,ee){var Y=li[N]?d.resolve(li[N]):d.reject(new Error("Driver not found."));return p(Y,J,ee),Y},O.prototype.getSerializer=function(N){var J=d.resolve(oi);return p(J,N),J},O.prototype.ready=function(N){var J=this,ee=J._driverSet.then(function(){return J._ready===null&&(J._ready=J._initDriver()),J._ready});return p(ee,N,N),ee},O.prototype.setDriver=function(N,J,ee){var Y=this;Gn(N)||(N=[N]);var de=this._getSupportedDrivers(N);function me(){Y._config.driver=Y.driver()}function Se($e){return Y._extend($e),me(),Y._ready=Y._initStorage(Y._config),Y._ready}function we($e){return function(){var gt=0;function Nt(){for(;gt<$e.length;){var Ct=$e[gt];return gt++,Y._dbInfo=null,Y._ready=null,Y.getDriver(Ct).then(Se).catch(Nt)}me();var on=new Error("No available storage method found.");return Y._driverSet=d.reject(on),Y._driverSet}return Nt()}}var xe=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=xe.then(function(){var $e=de[0];return Y._dbInfo=null,Y._ready=null,Y.getDriver($e).then(function(gt){Y._driver=gt._driver,me(),Y._wrapLibraryMethodsWithReady(),Y._initDriver=we(de)})}).catch(function(){me();var $e=new Error("No available storage method found.");return Y._driverSet=d.reject($e),Y._driverSet}),p(this._driverSet,J,ee),this._driverSet},O.prototype.supports=function(N){return!!$i[N]},O.prototype._extend=function(N){di(this,N)},O.prototype._getSupportedDrivers=function(N){for(var J=[],ee=0,Y=N.length;ee<Y;ee++){var de=N[ee];this.supports(de)&&J.push(de)}return J},O.prototype._wrapLibraryMethodsWithReady=function(){for(var N=0,J=vt.length;N<J;N++)ji(this,vt[N])},O.prototype.createInstance=function(N){return new O(N)},O}(),Ui=new Xt;r.exports=Ui},{3:3}]},{},[4])(4)})})(MT);var BB=MT.exports;const e_=vl(BB),LT="HttpClient",zB=(t={})=>{const e={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...t};return{name:LT,setupOnce(){},setup(n){JB(n,e),XB(n,e)}}},PT=zB;Pr(LT,PT);function VB(t,e,n,r){if($T(t,n.status,n.url)){const i=KB(e,r);let s,o,a,c;UT()&&([{headers:s,cookies:a},{headers:o,cookies:c}]=[{cookieHeader:"Cookie",obj:i},{cookieHeader:"Set-Cookie",obj:n}].map(({cookieHeader:u,obj:d})=>{const f=qB(d.headers);let p;try{const h=f[u]||f[u.toLowerCase()]||void 0;h&&(p=FT(h))}catch{fl&&le.log(`Could not extract cookies from header ${u}`)}return{headers:f,cookies:p}}));const l=jT({url:i.url,method:i.method,status:n.status,requestHeaders:s,responseHeaders:o,requestCookies:a,responseCookies:c});nf(l)}}function HB(t,e,n,r){if($T(t,e.status,e.responseURL)){let i,s,o;if(UT()){try{const c=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;c&&(s=FT(c))}catch{fl&&le.log("Could not extract cookies from response headers")}try{o=ZB(e)}catch{fl&&le.log("Could not extract headers from response")}i=r}const a=jT({url:e.responseURL,method:n,status:e.status,requestHeaders:i,responseHeaders:o,responseCookies:s});nf(a)}}function WB(t){if(t){const e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function FT(t){return t.split("; ").reduce((e,n)=>{const[r,i]=n.split("=");return e[r]=i,e},{})}function qB(t){const e={};return t.forEach((n,r)=>{e[r]=n}),e}function ZB(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
|
|
440
|
-
`).reduce((n,r)=>{const[i,s]=r.split(": ");return n[i]=s,n},{}):{}}function GB(t,e){return t.some(n=>typeof n=="string"?e.includes(n):n.test(e))}function YB(t,e){return t.some(n=>typeof n=="number"?n===e:e>=n[0]&&e<=n[1])}function JB(t,e){Iw()&&Jd(n=>{if(wt()!==t)return;const{response:r,args:i}=n,[s,o]=i;r&&VB(e,s,r,o)})}function XB(t,e){"XMLHttpRequest"in Et&&Kd(n=>{if(wt()!==t)return;const r=n.xhr,i=r[Ei];if(!i)return;const{method:s,request_headers:o}=i;try{HB(e,r,s,o)}catch(a){fl&&le.warn("Error while extracting response event form XHR response",a)}})}function $T(t,e,n){return YB(t.failedRequestStatusCodes,e)&&GB(t.failedRequestTargets,n)&&!s0(n,wt())}function jT(t){const e=`HTTP Client Error with status code: ${t.status}`,n={message:e,exception:{values:[{type:"Error",value:e}]},request:{url:t.url,method:t.method,headers:t.requestHeaders,cookies:t.requestCookies},contexts:{response:{status_code:t.status,headers:t.responseHeaders,cookies:t.responseCookies,body_size:WB(t.responseHeaders)}}};return to(n,{type:"http.client",handled:!1}),n}function KB(t,e){return!e&&t instanceof Request||t instanceof Request&&t.bodyUsed?t:new Request(t,e)}function UT(){const t=wt();return t?!!t.getOptions().sendDefaultPii:!1}function QB(t){const e={...t};o0(e,"react"),uU(e)}var BT={exports:{}},Lt={};/** @license React v16.13.1
|
|
441
|
-
* react-is.production.min.js
|
|
442
|
-
*
|
|
443
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
444
|
-
*
|
|
445
|
-
* This source code is licensed under the MIT license found in the
|
|
446
|
-
* LICENSE file in the root directory of this source tree.
|
|
447
|
-
*/var _n=typeof Symbol=="function"&&Symbol.for,Rg=_n?Symbol.for("react.element"):60103,kg=_n?Symbol.for("react.portal"):60106,hf=_n?Symbol.for("react.fragment"):60107,mf=_n?Symbol.for("react.strict_mode"):60108,gf=_n?Symbol.for("react.profiler"):60114,yf=_n?Symbol.for("react.provider"):60109,vf=_n?Symbol.for("react.context"):60110,Ng=_n?Symbol.for("react.async_mode"):60111,_f=_n?Symbol.for("react.concurrent_mode"):60111,bf=_n?Symbol.for("react.forward_ref"):60112,Ef=_n?Symbol.for("react.suspense"):60113,e9=_n?Symbol.for("react.suspense_list"):60120,Sf=_n?Symbol.for("react.memo"):60115,wf=_n?Symbol.for("react.lazy"):60116,t9=_n?Symbol.for("react.block"):60121,n9=_n?Symbol.for("react.fundamental"):60117,r9=_n?Symbol.for("react.responder"):60118,i9=_n?Symbol.for("react.scope"):60119;function ir(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case Rg:switch(t=t.type,t){case Ng:case _f:case hf:case gf:case mf:case Ef:return t;default:switch(t=t&&t.$$typeof,t){case vf:case bf:case wf:case Sf:case yf:return t;default:return e}}case kg:return e}}}function zT(t){return ir(t)===_f}Lt.AsyncMode=Ng;Lt.ConcurrentMode=_f;Lt.ContextConsumer=vf;Lt.ContextProvider=yf;Lt.Element=Rg;Lt.ForwardRef=bf;Lt.Fragment=hf;Lt.Lazy=wf;Lt.Memo=Sf;Lt.Portal=kg;Lt.Profiler=gf;Lt.StrictMode=mf;Lt.Suspense=Ef;Lt.isAsyncMode=function(t){return zT(t)||ir(t)===Ng};Lt.isConcurrentMode=zT;Lt.isContextConsumer=function(t){return ir(t)===vf};Lt.isContextProvider=function(t){return ir(t)===yf};Lt.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===Rg};Lt.isForwardRef=function(t){return ir(t)===bf};Lt.isFragment=function(t){return ir(t)===hf};Lt.isLazy=function(t){return ir(t)===wf};Lt.isMemo=function(t){return ir(t)===Sf};Lt.isPortal=function(t){return ir(t)===kg};Lt.isProfiler=function(t){return ir(t)===gf};Lt.isStrictMode=function(t){return ir(t)===mf};Lt.isSuspense=function(t){return ir(t)===Ef};Lt.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===hf||t===_f||t===gf||t===mf||t===Ef||t===e9||typeof t=="object"&&t!==null&&(t.$$typeof===wf||t.$$typeof===Sf||t.$$typeof===yf||t.$$typeof===vf||t.$$typeof===bf||t.$$typeof===n9||t.$$typeof===r9||t.$$typeof===i9||t.$$typeof===t9)};Lt.typeOf=ir;BT.exports=Lt;var s9=BT.exports,VT=s9,o9={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a9={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},HT={};HT[VT.ForwardRef]=o9;HT[VT.Memo]=a9;function c9(t){const e=J$({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:n,useLocation:r,useNavigationType:i,createRoutesFromChildren:s,matchRoutes:o,stripBasename:a,instrumentPageLoad:c=!0,instrumentNavigation:l=!0}=t;return{...e,afterAllSetup(u){e.afterAllSetup(u);const d=Mt.location&&Mt.location.pathname;c&&d&&S0(u,{name:d,attributes:{[Kr]:"url",[oc]:"pageload",[Ms]:"auto.pageload.react.reactrouter_v6"}})}}}function l9(...t){let e,n;const r=t.findIndex(i=>i instanceof Error);r?(e=t.at(r),n=t.slice(0,r).concat(t.slice(r+1))):t.length===1?e=t:t.length>1&&(e=t[0],n=t.slice(1)),!(e instanceof TypeError&&e.message==="Failed to fetch"&&!navigator.onLine)&&Al(e,n?{data:n}:void 0)}var Hr;class u9{constructor(){jr(this,Hr,console);this.log=this.log.bind(this),this.info=this.info.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this),this.debug=this.debug.bind(this),this.trace=this.trace.bind(this)}set logger(e){Ma(this,Hr,e)}log(...e){return Dt(this,Hr).log(...e)}info(...e){return Dt(this,Hr).info(...e)}warn(...e){return Dt(this,Hr).warn(...e)}error(...e){return l9(...e),Dt(this,Hr).error(...e)}debug(...e){return Dt(this,Hr).debug(...e)}trace(...e){return Dt(this,Hr).trace(...e)}}Hr=new WeakMap;const dn=new u9;Bk(dn);var d9=Object.defineProperty,f9=(t,e,n)=>e in t?d9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p9=(t,e,n)=>f9(t,e+"",n);const h9={id:"powerhouse/budget-statement",name:"BudgetStatement",extension:"phbs",description:"The BudgetStatement module manages the state and actions related to budget statements, which are documents that track the financial transactions of an organization over a month.",author:{name:"Powerhouse",website:"https://powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"account",operations:[{name:"AddAccount",id:"",description:"",schema:`input AddAccountInput {
|
|
448
|
-
address: String!
|
|
449
|
-
name: String
|
|
450
|
-
lineItems: [LineItemInput!]
|
|
451
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateAccount",id:"",description:"",schema:`input UpdateAccountInput {
|
|
452
|
-
address: String!
|
|
453
|
-
name: String
|
|
454
|
-
lineItems: [LineItem!]
|
|
455
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteAccount",id:"",description:"",schema:`input DeleteAccountInput {
|
|
456
|
-
account: String!
|
|
457
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SortAccounts",id:"",description:"",schema:`input SortAccountsInput {
|
|
458
|
-
accounts: [String!]!
|
|
459
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"line-item",operations:[{name:"AddLineItem",id:"",description:"",schema:`input AddLineItemInput {
|
|
460
|
-
accountId: ID!
|
|
461
|
-
group: LineItemGroup
|
|
462
|
-
headcountExpense: Boolean
|
|
463
|
-
category: LineItemCategory
|
|
464
|
-
budgetCap: Float
|
|
465
|
-
actual: Float
|
|
466
|
-
payment: Float
|
|
467
|
-
forecast: [LineItemForecast!]
|
|
468
|
-
comment: String }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateLineItem",id:"",description:"",schema:`input LineItemUpdateInput {
|
|
469
|
-
group: String
|
|
470
|
-
category: String
|
|
471
|
-
headcountExpense: Boolean
|
|
472
|
-
budgetCap: Float
|
|
473
|
-
actual: Float
|
|
474
|
-
payment: Float
|
|
475
|
-
forecast: [LineItemForecast!]
|
|
476
|
-
comment: String }
|
|
477
|
-
|
|
478
|
-
input UpdateLineItemInput {
|
|
479
|
-
accountId: ID!
|
|
480
|
-
group: String
|
|
481
|
-
category: String
|
|
482
|
-
headcountExpense: Boolean
|
|
483
|
-
budgetCap: Float
|
|
484
|
-
actual: Float
|
|
485
|
-
payment: Float
|
|
486
|
-
forecast: [LineItemForecast!]
|
|
487
|
-
comment: String }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteLineItem",id:"",description:"",schema:`input DeleteLineItemInput {
|
|
488
|
-
accountId: ID!
|
|
489
|
-
group: String
|
|
490
|
-
category: String }
|
|
491
|
-
|
|
492
|
-
`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SortLineItems",id:"",description:"",schema:`input LineItemsSortInput {
|
|
493
|
-
group: String
|
|
494
|
-
category: String }
|
|
495
|
-
|
|
496
|
-
input SortLineItemsInput {
|
|
497
|
-
accountId: ID!
|
|
498
|
-
lineItems: [LineItemsSortInput!]! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"base",operations:[{name:"SetOwner",id:"",description:"",schema:`input SetOwnerInput {
|
|
499
|
-
ref: String
|
|
500
|
-
id: String
|
|
501
|
-
title: String }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetMonth",id:"",description:"",schema:`input SetMonthInput {
|
|
502
|
-
month: String! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetFtes",id:"",description:"",schema:`input FtesForecastInput {
|
|
503
|
-
month: String!
|
|
504
|
-
value: Float! }
|
|
505
|
-
|
|
506
|
-
input SetFtesInput {
|
|
507
|
-
value: Float!
|
|
508
|
-
forecast: [FtesForecastInput!]! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetQuoteCurrency",id:"",description:"",schema:`input SetQuoteCurrencyInput {
|
|
509
|
-
quoteCurrency: String! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"audit",operations:[{name:"AddAuditReport",id:"",description:"",schema:`input AddAuditReportInput {
|
|
510
|
-
timestamp: DateTime
|
|
511
|
-
report: Attachment!
|
|
512
|
-
status: AuditReportStatus!
|
|
513
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteAuditReport",id:"",description:"",schema:`input DeleteAuditReportInput {
|
|
514
|
-
report: String!
|
|
515
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"comment",operations:[{name:"AddComment",id:"",description:"",schema:`input CommentAuthorInput {
|
|
516
|
-
ref: String
|
|
517
|
-
id: String
|
|
518
|
-
username: String
|
|
519
|
-
roleLabel: String }
|
|
520
|
-
|
|
521
|
-
input AddCommentInput {
|
|
522
|
-
key: String
|
|
523
|
-
author: CommentAuthorInput
|
|
524
|
-
comment: String!
|
|
525
|
-
timestamp: DateTime
|
|
526
|
-
status: BudgetStatus }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateComment",id:"",description:"",schema:`input UpdateCommentInput {
|
|
527
|
-
key: String!
|
|
528
|
-
author: CommentAuthorInput
|
|
529
|
-
comment: String
|
|
530
|
-
timestamp: DateTime
|
|
531
|
-
status: BudgetStatus }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteComment",id:"",description:"",schema:`input DeleteCommentInput {
|
|
532
|
-
comment: String! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"vesting",operations:[{name:"AddVesting",id:"",description:"",schema:`input AddVestingInput {
|
|
533
|
-
key: String
|
|
534
|
-
date: String
|
|
535
|
-
amount: String
|
|
536
|
-
amountOld: String
|
|
537
|
-
comment: String
|
|
538
|
-
currency: String
|
|
539
|
-
vested: Boolean }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateVesting",id:"",description:"",schema:`input UpdateVestingInput {
|
|
540
|
-
key: String!
|
|
541
|
-
date: String
|
|
542
|
-
amount: String
|
|
543
|
-
amountOld: String
|
|
544
|
-
comment: String
|
|
545
|
-
currency: String
|
|
546
|
-
vested: Boolean }`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteVesting",id:"",description:"",schema:`input DeleteVestingInput {
|
|
547
|
-
vesting: String! }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}],state:{global:{schema:`scalar DateTime
|
|
548
|
-
scalar Attachment
|
|
549
|
-
|
|
550
|
-
input LineItemInput {
|
|
551
|
-
group: LineItemGroup
|
|
552
|
-
headcountExpense: Boolean
|
|
553
|
-
category: LineItemCategory
|
|
554
|
-
budgetCap: Float
|
|
555
|
-
actual: Float
|
|
556
|
-
payment: Float
|
|
557
|
-
forecast: [LineItemForecast!]
|
|
558
|
-
comment: String }
|
|
559
|
-
|
|
560
|
-
type LineItemGroup {
|
|
561
|
-
ref: String!
|
|
562
|
-
id: String!
|
|
563
|
-
title: String!
|
|
564
|
-
color: String!
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
type LineItemCategory {
|
|
568
|
-
ref: String!
|
|
569
|
-
id: String!
|
|
570
|
-
title: String!
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
type LineItemForecast {
|
|
574
|
-
month: String!
|
|
575
|
-
value: Float!
|
|
576
|
-
budgetCap: Float!
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
type LineItem {
|
|
580
|
-
group: LineItemGroup
|
|
581
|
-
headcountExpense: Boolean!
|
|
582
|
-
category: LineItemCategory
|
|
583
|
-
budgetCap: Float
|
|
584
|
-
actual: Float
|
|
585
|
-
payment: Float
|
|
586
|
-
forecast: [LineItemForecast!]!
|
|
587
|
-
comment: String
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
type Account {
|
|
591
|
-
address: String! # TODO Address
|
|
592
|
-
name: String!
|
|
593
|
-
lineItems: [LineItem!]!
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
type Owner {
|
|
597
|
-
ref: String
|
|
598
|
-
id: String
|
|
599
|
-
title: String
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
type Vesting {
|
|
603
|
-
key: String!
|
|
604
|
-
date: String!
|
|
605
|
-
amount: String!
|
|
606
|
-
amountOld: String!
|
|
607
|
-
comment: String!
|
|
608
|
-
currency: String!
|
|
609
|
-
vested: Boolean!
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
type FtesForecast {
|
|
613
|
-
month: String!
|
|
614
|
-
value: Float!
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
type Ftes {
|
|
618
|
-
value: Float!
|
|
619
|
-
forecast: [FtesForecast!]!
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
enum AuditReportStatus {
|
|
623
|
-
Approved
|
|
624
|
-
ApprovedWithComments
|
|
625
|
-
NeedsAction
|
|
626
|
-
Escalated
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
type AuditReport {
|
|
630
|
-
timestamp: DateTime!
|
|
631
|
-
report: Attachment! # TODO enforce attachment
|
|
632
|
-
status: AuditReportStatus!
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
type CommentAuthor {
|
|
636
|
-
ref: String
|
|
637
|
-
id: String
|
|
638
|
-
username: String
|
|
639
|
-
roleLabel: String
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
enum BudgetStatus {
|
|
643
|
-
Draft
|
|
644
|
-
Review
|
|
645
|
-
Final
|
|
646
|
-
Escalated
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
type Comment {
|
|
650
|
-
key: String!
|
|
651
|
-
author: CommentAuthor!
|
|
652
|
-
comment: String!
|
|
653
|
-
timestamp: DateTime!
|
|
654
|
-
status: BudgetStatus!
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
type BudgetStatementState {
|
|
658
|
-
owner: Owner
|
|
659
|
-
month: String
|
|
660
|
-
quoteCurrency: String
|
|
661
|
-
accounts: [Account!]!
|
|
662
|
-
vesting: [Vesting!]!
|
|
663
|
-
ftes: Ftes
|
|
664
|
-
auditReports: [AuditReport!]!
|
|
665
|
-
comments: [Comment!]!
|
|
666
|
-
}`,initialValue:'"{\\n \\"owner\\": {\\n \\"ref\\": null,\\n \\"id\\": null,\\n \\"title\\": null\\n },\\n \\"month\\": null,\\n \\"quoteCurrency\\": null,\\n \\"vesting\\": [],\\n \\"ftes\\": null,\\n \\"accounts\\": [],\\n \\"auditReports\\": [],\\n \\"comments\\": []\\n}"',examples:[]},local:{schema:"type BudgetStatementLocalState",initialValue:'"{}"',examples:[]}}}]},m9=t=>t!=null;D.any().refine(t=>m9(t));const g9=D.enum(["Approved","ApprovedWithComments","Escalated","NeedsAction"]),WT=D.enum(["Draft","Escalated","Final","Review"]);function qT(){return D.object({address:D.string(),lineItems:D.array(D.lazy(()=>_9())).nullish(),name:D.string().nullish()})}function ZT(){return D.object({report:D.string(),status:g9,timestamp:D.string().datetime().nullish()})}function GT(){return D.object({author:D.lazy(()=>XT().nullish()),comment:D.string(),key:D.string().nullish(),status:WT.nullish(),timestamp:D.string().datetime().nullish()})}function YT(){return D.object({accountId:D.string(),actual:D.number().nullish(),budgetCap:D.number().nullish(),category:Ag().nullish(),comment:D.string().nullish(),forecast:D.array(Tf()).nullish(),group:Cg().nullish(),headcountExpense:D.boolean().nullish(),payment:D.number().nullish()})}function JT(){return D.object({amount:D.string().nullish(),amountOld:D.string().nullish(),comment:D.string().nullish(),currency:D.string().nullish(),date:D.string().nullish(),key:D.string().nullish(),vested:D.boolean().nullish()})}function XT(){return D.object({id:D.string().nullish(),ref:D.string().nullish(),roleLabel:D.string().nullish(),username:D.string().nullish()})}function KT(){return D.object({account:D.string()})}function QT(){return D.object({report:D.string()})}function eI(){return D.object({comment:D.string()})}function tI(){return D.object({accountId:D.string(),category:D.string().nullish(),group:D.string().nullish()})}function nI(){return D.object({vesting:D.string()})}function y9(){return D.object({month:D.string(),value:D.number()})}function v9(){return D.object({__typename:D.literal("LineItem").optional(),actual:D.number().nullable(),budgetCap:D.number().nullable(),category:Ag().nullable(),comment:D.string().nullable(),forecast:D.array(Tf()),group:Cg().nullable(),headcountExpense:D.boolean(),payment:D.number().nullable()})}function Ag(){return D.object({__typename:D.literal("LineItemCategory").optional(),id:D.string(),ref:D.string(),title:D.string()})}function Tf(){return D.object({__typename:D.literal("LineItemForecast").optional(),budgetCap:D.number(),month:D.string(),value:D.number()})}function Cg(){return D.object({__typename:D.literal("LineItemGroup").optional(),color:D.string(),id:D.string(),ref:D.string(),title:D.string()})}function _9(){return D.object({actual:D.number().nullish(),budgetCap:D.number().nullish(),category:Ag().nullish(),comment:D.string().nullish(),forecast:D.array(Tf()).nullish(),group:Cg().nullish(),headcountExpense:D.boolean().nullish(),payment:D.number().nullish()})}function b9(){return D.object({category:D.string().nullish(),group:D.string().nullish()})}function rI(){return D.object({forecast:D.array(D.lazy(()=>y9())),value:D.number()})}function iI(){return D.object({month:D.string()})}function sI(){return D.object({id:D.string().nullish(),ref:D.string().nullish(),title:D.string().nullish()})}function oI(){return D.object({quoteCurrency:D.string()})}function aI(){return D.object({accounts:D.array(D.string())})}function cI(){return D.object({accountId:D.string(),lineItems:D.array(D.lazy(()=>b9()))})}function lI(){return D.object({address:D.string(),lineItems:D.array(v9()).nullish(),name:D.string().nullish()})}function uI(){return D.object({author:D.lazy(()=>XT().nullish()),comment:D.string().nullish(),key:D.string(),status:WT.nullish(),timestamp:D.string().datetime().nullish()})}function dI(){return D.object({accountId:D.string(),actual:D.number().nullish(),budgetCap:D.number().nullish(),category:D.string().nullish(),comment:D.string().nullish(),forecast:D.array(Tf()).nullish(),group:D.string().nullish(),headcountExpense:D.boolean().nullish(),payment:D.number().nullish()})}function fI(){return D.object({amount:D.string().nullish(),amountOld:D.string().nullish(),comment:D.string().nullish(),currency:D.string().nullish(),date:D.string().nullish(),key:D.string(),vested:D.boolean().nullish()})}const pI=t=>{var e;return{...t,name:t.name??"",lineItems:((e=t.lineItems)==null?void 0:e.map(Mg))??new Array}},Mg=t=>{var e;return{budgetCap:null,payment:null,actual:null,comment:null,...t,forecast:((e=t.forecast)==null?void 0:e.sort((n,r)=>n.month.localeCompare(r.month)))??new Array,headcountExpense:t.headcountExpense??!1,group:t.group??null,category:t.category??null}},E9=Object.freeze(Object.defineProperty({__proto__:null,createAccount:pI,createLineItem:Mg},Symbol.toStringTag,{value:"Module"})),uu={addAccountOperation(t,e){const{input:n}=e;if(t.accounts.find(r=>r.address===n.address))throw new Error(`Account with address ${n.address} already exists!`);t.accounts.push(pI(n))},updateAccountOperation(t,e){const{input:n}=e,r=t.accounts.findIndex(s=>s.address===n.address);if(r===-1)throw new Error(`Account with adddress ${n.address} not found`);const i=t.accounts[r];t.accounts[r]={...i,lineItems:n.lineItems??i.lineItems,name:n.name??i.name}},deleteAccountOperation(t,e){const{input:n}=e;t.accounts=t.accounts.filter(r=>r.address!==n.account)},sortAccountsOperation(t,e){t.accounts.sort((n,r)=>{const i=e.input.accounts.indexOf(n.address),s=e.input.accounts.indexOf(r.address);return(i>-1?i:1/0)-(s>-1?s:1/0)})}};function du(t,e){return t.category===e.category&&t.group===e.group}const fu={addLineItemOperation(t,e){var n,r;const{accountId:i,...s}=e.input,o=t.accounts.find(a=>a.address===i);if(!o)throw new Error(`Account with address ${i} not found`);if(o.lineItems.find(a=>{var c,l,u,d;return((c=s.category)==null?void 0:c.id)===((l=a.category)==null?void 0:l.id)&&((u=s.group)==null?void 0:u.id)===((d=a.group)==null?void 0:d.id)}))throw new Error(`Line item with category '${((n=s.category)==null?void 0:n.id)??"null"}' and group '${((r=s.group)==null?void 0:r.id)??"null"}' already exists`);o.lineItems.push(Mg(s))},updateLineItemOperation(t,e){const{accountId:n,...r}=e.input,i=t.accounts.find(a=>a.address===n);if(!i)throw new Error(`Account with address ${n} not found`);const s=i.lineItems.findIndex(a=>du(r,a));if(s===-1)throw new Error("Line item not found");const o=i.lineItems[s];i.lineItems[s]={...o,...r,category:o.category,headcountExpense:r.headcountExpense??!1,group:o.group,forecast:(r.forecast??o.forecast).sort((a,c)=>a.month.localeCompare(c.month))}},deleteLineItemOperation(t,e){const{accountId:n,...r}=e.input,i=t.accounts.find(s=>s.address===n);if(!i)throw new Error(`Account with address ${n} not found`);i.lineItems=i.lineItems.filter(s=>!du(r,s))},sortLineItemsOperation(t,e){const{accountId:n,lineItems:r}=e.input,i=t.accounts.find(s=>s.address===n);if(!i)throw new Error(`Account with address ${n} not found`);i.lineItems.sort((s,o)=>{const a=r.findIndex(l=>du(l,s)),c=r.findIndex(l=>du(l,o));return(a>-1?a:1/0)-(c>-1?c:1/0)})}},pu={setOwnerOperation(t,e){t.owner={id:e.input.id??null,ref:e.input.ref??null,title:e.input.title??null}},setMonthOperation(t,e){t.month=e.input.month},setFtesOperation(t,e){t.ftes=e.input,t.ftes.forecast.sort((n,r)=>n.month.localeCompare(r.month))},setQuoteCurrencyOperation(t,e){t.quoteCurrency=e.input.quoteCurrency}};function S9(t,e){if(t.auditReports.find(n=>n.report===e))throw new Error(`Audit with report ${e} already exists`)}const t_={addAuditReportOperation(t,e){if(S9(t,e.input.report),!e.attachments.find(n=>n.hash===e.input.report))throw new Error("Report was not included in the action attachments");t.auditReports.push({...e.input,timestamp:e.input.timestamp??new Date().toISOString()})},deleteAuditReportOperation(t,e){const n=t.auditReports.findIndex(r=>r.report===e.input.report);n>-1&&t.auditReports.splice(n,1)}},n_=(t,e)=>t.timestamp<e.timestamp?-1:1,hp={addCommentOperation(t,e){const{input:n}=e,r=n.key??Ce.hashKey();if(t.comments.findIndex(i=>i.key===n.key)>-1)throw new Error(`Comment with key ${r} already exists`);t.comments.push({key:r,author:{ref:null,id:null,username:null,roleLabel:null,...n.author},comment:n.comment,timestamp:n.timestamp||new Date().toISOString(),status:n.status??"Draft"}),t.comments.sort(n_)},updateCommentOperation(t,e){var n,r,i,s;const{input:o}=e,a=t.comments.findIndex(l=>l.key===o.key);if(a===-1)return;const c=t.comments[a];t.comments[a]={...c,...o,author:{id:((n=o.author)==null?void 0:n.id)??c.author.id,ref:((r=o.author)==null?void 0:r.ref)??c.author.ref,roleLabel:((i=o.author)==null?void 0:i.roleLabel)??c.author.roleLabel,username:((s=o.author)==null?void 0:s.username)??c.author.username},comment:o.comment??c.comment,timestamp:o.timestamp??new Date().toISOString(),status:o.status??c.status},t.comments.sort(n_)},deleteCommentOperation(t,e){const{input:n}=e;t.comments=t.comments.filter(r=>n.comment!==r.key)}},r_=(t,e)=>t.date<e.date?-1:1,mp={addVestingOperation(t,e){const{input:n}=e,r=n.key??Ce.hashKey();if(t.vesting.findIndex(i=>i.key===n.key)>-1)throw new Error(`Vesting with key ${r} already exists`);t.vesting.push({...n,key:r,date:n.date??"",amount:n.amount??"",amountOld:n.amountOld??n.amount??"",comment:n.comment??"",currency:n.currency??"",vested:n.vested??!1}),t.vesting.sort(r_)},updateVestingOperation(t,e){const{input:n}=e,r=t.vesting.findIndex(s=>s.key===n.key);if(r===-1)return;const i=t.vesting[r];t.vesting[r]={...i,...n,amount:n.amount??i.amount,amountOld:n.amountOld??i.amountOld,comment:n.comment??i.comment,currency:n.currency??i.currency,date:n.date??i.date,vested:n.vested??i.vested},t.vesting.sort(r_)},deleteVestingOperation(t,e){t.vesting=t.vesting.filter(n=>!e.input.vesting.includes(n.key))}},w9=(t,e,n)=>{if(Ce.isBaseAction(e))return t;switch(e.type){case"ADD_ACCOUNT":qT().parse(e.input),uu.addAccountOperation(t[e.scope],e,n);break;case"UPDATE_ACCOUNT":lI().parse(e.input),uu.updateAccountOperation(t[e.scope],e,n);break;case"DELETE_ACCOUNT":KT().parse(e.input),uu.deleteAccountOperation(t[e.scope],e,n);break;case"SORT_ACCOUNTS":aI().parse(e.input),uu.sortAccountsOperation(t[e.scope],e,n);break;case"ADD_LINE_ITEM":YT().parse(e.input),fu.addLineItemOperation(t[e.scope],e,n);break;case"UPDATE_LINE_ITEM":dI().parse(e.input),fu.updateLineItemOperation(t[e.scope],e,n);break;case"DELETE_LINE_ITEM":tI().parse(e.input),fu.deleteLineItemOperation(t[e.scope],e,n);break;case"SORT_LINE_ITEMS":cI().parse(e.input),fu.sortLineItemsOperation(t[e.scope],e,n);break;case"SET_OWNER":sI().parse(e.input),pu.setOwnerOperation(t[e.scope],e,n);break;case"SET_MONTH":iI().parse(e.input),pu.setMonthOperation(t[e.scope],e,n);break;case"SET_FTES":rI().parse(e.input),pu.setFtesOperation(t[e.scope],e,n);break;case"SET_QUOTE_CURRENCY":oI().parse(e.input),pu.setQuoteCurrencyOperation(t[e.scope],e,n);break;case"ADD_AUDIT_REPORT":ZT().parse(e.input),t_.addAuditReportOperation(t[e.scope],e,n);break;case"DELETE_AUDIT_REPORT":QT().parse(e.input),t_.deleteAuditReportOperation(t[e.scope],e,n);break;case"ADD_COMMENT":GT().parse(e.input),hp.addCommentOperation(t[e.scope],e,n);break;case"UPDATE_COMMENT":uI().parse(e.input),hp.updateCommentOperation(t[e.scope],e,n);break;case"DELETE_COMMENT":eI().parse(e.input),hp.deleteCommentOperation(t[e.scope],e,n);break;case"ADD_VESTING":JT().parse(e.input),mp.addVestingOperation(t[e.scope],e,n);break;case"UPDATE_VESTING":fI().parse(e.input),mp.updateVestingOperation(t[e.scope],e,n);break;case"DELETE_VESTING":nI().parse(e.input),mp.deleteVestingOperation(t[e.scope],e,n);break;default:return t}},Rd=Ce.createReducer(w9),T9={owner:{ref:null,id:null,title:null},month:null,quoteCurrency:null,vesting:[],ftes:null,accounts:[],auditReports:[],comments:[]},I9={},Ec={fileExtension:"phbs",createState(t){return{global:{...T9,...t==null?void 0:t.global},local:{...I9,...t==null?void 0:t.local}}},createExtendedState(t){return Ce.createExtendedState({...t,documentType:"powerhouse/budget-statement"},Ec.createState)},createDocument(t){return Ce.createDocument(Ec.createExtendedState(t),Ec.createState)},saveToFile(t,e,n){return Ce.saveToFile(t,e,"phbs",n)},saveToFileHandle(t,e){return Ce.saveToFileHandle(t,e)},loadFromFile(t){return Ce.loadFromFile(t,Rd)},loadFromInput(t){return Ce.loadFromInput(t,Rd)}},{createAction:If}=Ce,hI=t=>If("ADD_ACCOUNT",{...t},void 0,qT,"global"),mI=t=>If("UPDATE_ACCOUNT",{...t},void 0,lI,"global"),gI=t=>If("DELETE_ACCOUNT",{...t},void 0,KT,"global"),yI=t=>If("SORT_ACCOUNTS",{...t},void 0,aI,"global");class x9 extends Yt{addAccount(e){return this.dispatch(hI(e))}updateAccount(e){return this.dispatch(mI(e))}deleteAccount(e){return this.dispatch(gI(e))}sortAccounts(e){return this.dispatch(yI(e))}}const{createAction:xf}=Ce,vI=t=>xf("ADD_LINE_ITEM",{...t},void 0,YT,"global"),_I=t=>xf("UPDATE_LINE_ITEM",{...t},void 0,dI,"global"),bI=t=>xf("DELETE_LINE_ITEM",{...t},void 0,tI,"global"),EI=t=>xf("SORT_LINE_ITEMS",{...t},void 0,cI,"global");class O9 extends Yt{addLineItem(e){return this.dispatch(vI(e))}updateLineItem(e){return this.dispatch(_I(e))}deleteLineItem(e){return this.dispatch(bI(e))}sortLineItems(e){return this.dispatch(EI(e))}}const{createAction:Of}=Ce,SI=t=>Of("SET_OWNER",{...t},void 0,sI,"global"),wI=t=>Of("SET_MONTH",{...t},void 0,iI,"global"),TI=t=>Of("SET_FTES",{...t},void 0,rI,"global"),II=t=>Of("SET_QUOTE_CURRENCY",{...t},void 0,oI,"global");class D9 extends Yt{setOwner(e){return this.dispatch(SI(e))}setMonth(e){return this.dispatch(wI(e))}setFtes(e){return this.dispatch(TI(e))}setQuoteCurrency(e){return this.dispatch(II(e))}}const{createAction:xI}=Ce,OI=(t,e)=>xI("ADD_AUDIT_REPORT",{...t},e,ZT,"global"),DI=t=>xI("DELETE_AUDIT_REPORT",{...t},void 0,QT,"global");class R9 extends Yt{addAuditReport(e,n){return this.dispatch(OI(e,n))}deleteAuditReport(e){return this.dispatch(DI(e))}}const{createAction:Lg}=Ce,RI=t=>Lg("ADD_COMMENT",{...t},void 0,GT,"global"),kI=t=>Lg("UPDATE_COMMENT",{...t},void 0,uI,"global"),NI=t=>Lg("DELETE_COMMENT",{...t},void 0,eI,"global");class k9 extends Yt{addComment(e){return this.dispatch(RI(e))}updateComment(e){return this.dispatch(kI(e))}deleteComment(e){return this.dispatch(NI(e))}}const{createAction:Pg}=Ce,AI=t=>Pg("ADD_VESTING",{...t},void 0,JT,"global"),CI=t=>Pg("UPDATE_VESTING",{...t},void 0,fI,"global"),MI=t=>Pg("DELETE_VESTING",{...t},void 0,nI,"global");class N9 extends Yt{addVesting(e){return this.dispatch(AI(e))}updateVesting(e){return this.dispatch(CI(e))}deleteVesting(e){return this.dispatch(MI(e))}}const LI=class PI extends Yt{constructor(e,n){super(Rd,Ec.createDocument(e),n)}saveToFile(e,n){return super.saveToFile(e,PI.fileExtension,n)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const n=new this;return await n.loadFromFile(e),n}};p9(LI,"fileExtension","phbs");let FI=LI;wa(FI,[x9,O9,D9,R9,k9,N9]);const A9=Object.freeze(Object.defineProperty({__proto__:null,addAccount:hI,addAuditReport:OI,addComment:RI,addLineItem:vI,addVesting:AI,deleteAccount:gI,deleteAuditReport:DI,deleteComment:NI,deleteLineItem:bI,deleteVesting:MI,setFtes:TI,setMonth:wI,setOwner:SI,setQuoteCurrency:II,sortAccounts:yI,sortLineItems:EI,updateAccount:mI,updateComment:kI,updateLineItem:_I,updateVesting:CI},Symbol.toStringTag,{value:"Module"})),C9=FI,M9={...Ec,...E9},L9={...Sa,...A9},P9={Document:C9,reducer:Rd,actions:L9,utils:M9,documentModel:h9};var F9=Object.defineProperty,$9=(t,e,n)=>e in t?F9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j9=(t,e,n)=>$9(t,e+"",n);const U9={id:"makerdao/scope-framework",name:"ScopeFramework",extension:"mdsf",description:"The MakerDAO Scope Framework document contains articles, sections and other elements that make up the governance rules for the MakerDAO scopes.",author:{name:"MakerDAO",website:"https://www.makerdao.com/"},specifications:[{version:1,changeLog:[],modules:[{name:"main",operations:[{name:"SetRootPath",id:"",description:"",schema:`type SetRootPathInput {
|
|
667
|
-
newRootPath: String!
|
|
668
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"AddElement",id:"",description:"",schema:`type AddElementInput {
|
|
669
|
-
id: String!
|
|
670
|
-
path: String!
|
|
671
|
-
type: ScopeFrameworkElementType!
|
|
672
|
-
name: String
|
|
673
|
-
components: ElementComponents
|
|
674
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateElementType",id:"",description:"",schema:`type UpdateElementTypeInput {
|
|
675
|
-
id: ID!
|
|
676
|
-
type: ScopeFrameworkElementType!
|
|
677
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateElementName",id:"",description:"",schema:`type UpdateElementNameInput {
|
|
678
|
-
id: ID!
|
|
679
|
-
name: String
|
|
680
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateElementComponents",id:"",description:"",schema:`type UpdateElementComponentsInput {
|
|
681
|
-
id: ID!
|
|
682
|
-
components: ElementComponents
|
|
683
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"RemoveElement",id:"",description:"",schema:`type RemoveElementInput {
|
|
684
|
-
id: ID!
|
|
685
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderElements",id:"",description:"",schema:`type ReorderElementsInput {
|
|
686
|
-
parentElementId: ID!
|
|
687
|
-
order: [ID!]!
|
|
688
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MoveElement",id:"",description:"",schema:`type MoveElementInput {
|
|
689
|
-
id: ID!
|
|
690
|
-
newParentId: ID!
|
|
691
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}],state:{global:{schema:`type ScopeComponent {
|
|
692
|
-
content: String
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
type ArticleComponent {
|
|
696
|
-
content: String
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
type SectionComponent {
|
|
700
|
-
content: String
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
type CoreComponent {
|
|
704
|
-
content: String
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
enum TypeSpecificationComponentCategory {
|
|
708
|
-
Primary
|
|
709
|
-
Supporting
|
|
710
|
-
Immutable
|
|
711
|
-
Accessory
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
type TypeSpecificationComponent {
|
|
715
|
-
name: String
|
|
716
|
-
overview: String
|
|
717
|
-
category: TypeSpecificationComponentCategory
|
|
718
|
-
documentIdentifierRules: String
|
|
719
|
-
typeAuthority: String
|
|
720
|
-
additionalLogic: String
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
union ElementComponents =
|
|
724
|
-
ScopeComponent
|
|
725
|
-
| ArticleComponent
|
|
726
|
-
| SectionComponent
|
|
727
|
-
| CoreComponent
|
|
728
|
-
| TypeSpecificationComponent
|
|
729
|
-
|
|
730
|
-
enum ScopeFrameworkElementType {
|
|
731
|
-
Scope
|
|
732
|
-
Article
|
|
733
|
-
Section
|
|
734
|
-
Core
|
|
735
|
-
TypeSpecification
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
type ScopeFrameworkElement {
|
|
739
|
-
id: ID!
|
|
740
|
-
path: String!
|
|
741
|
-
version: Int!
|
|
742
|
-
name: String
|
|
743
|
-
type: ScopeFrameworkElementType
|
|
744
|
-
components: ElementComponents
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
type ScopeFrameworkState {
|
|
748
|
-
rootPath: String!
|
|
749
|
-
elements: [ScopeFrameworkElement!]!
|
|
750
|
-
}`,initialValue:'"{\\n \\"rootPath\\": \\"A\\",\\n \\"elements\\": [\\n {\\n \\"id\\": \\"hruFam5ot7s0Gb1n+aIBa+y+NJA=\\",\\n \\"name\\": \\"Scope Name\\",\\n \\"version\\": 1,\\n \\"type\\": \\"Scope\\",\\n \\"path\\": \\"A.1\\",\\n \\"components\\": {\\n \\"content\\": \\"Scope description goes here.\\"\\n }\\n }\\n ]\\n}"',examples:[]},local:{schema:"type ScopeFrameworkLocalState",initialValue:'"{}"',examples:[]}}}]},B9=t=>t!=null;D.any().refine(t=>B9(t));const $I=D.enum(["Article","Core","Scope","Section","TypeSpecification"]),z9=D.enum(["Accessory","Immutable","Primary","Supporting"]);function jI(){return D.object({__typename:D.literal("AddElementInput").optional(),components:UI().nullable(),id:D.string(),name:D.string().nullable(),path:D.string(),type:$I})}function V9(){return D.object({__typename:D.literal("ArticleComponent").optional(),content:D.string().nullable()})}function H9(){return D.object({__typename:D.literal("CoreComponent").optional(),content:D.string().nullable()})}function UI(){return D.union([V9(),H9(),W9(),q9(),Z9()])}function BI(){return D.object({__typename:D.literal("MoveElementInput").optional(),id:D.string(),newParentId:D.string()})}function zI(){return D.object({__typename:D.literal("RemoveElementInput").optional(),id:D.string()})}function VI(){return D.object({__typename:D.literal("ReorderElementsInput").optional(),order:D.array(D.string()),parentElementId:D.string()})}function W9(){return D.object({__typename:D.literal("ScopeComponent").optional(),content:D.string().nullable()})}function q9(){return D.object({__typename:D.literal("SectionComponent").optional(),content:D.string().nullable()})}function HI(){return D.object({__typename:D.literal("SetRootPathInput").optional(),newRootPath:D.string()})}function Z9(){return D.object({__typename:D.literal("TypeSpecificationComponent").optional(),additionalLogic:D.string().nullable(),category:z9.nullable(),documentIdentifierRules:D.string().nullable(),name:D.string().nullable(),overview:D.string().nullable(),typeAuthority:D.string().nullable()})}function WI(){return D.object({__typename:D.literal("UpdateElementComponentsInput").optional(),components:UI().nullable(),id:D.string()})}function qI(){return D.object({__typename:D.literal("UpdateElementNameInput").optional(),id:D.string(),name:D.string().nullable()})}function ZI(){return D.object({__typename:D.literal("UpdateElementTypeInput").optional(),id:D.string(),type:$I})}const i_=t=>t.split(".",2)[0],G9=(t,e)=>{const n=t.split("."),r=e.split("."),i=Math.min(n.length,r.length);if(n[0]!=r[0])return n[0]<r[0];for(let s=1;s<i;s++)if(n[s]!=r[s])return parseInt(n[s])<parseInt(r[s]);return n.length<r.length},Vi={setRootPathOperation(t,e){if(!/^[A-Z]+$/.exec(e.input.newRootPath))throw new Error(`Invalid root path format ${e.input.newRootPath}. Use one or more capital letters: 'A', 'D', 'AQ', ...`);const n=t.rootPath+".",r=e.input.newRootPath+".";t.rootPath=e.input.newRootPath,t.elements=t.elements.map(i=>({...i,path:i.path.replace(n,r)}))},addElementOperation(t,e){const n=[],r={id:e.input.id,version:1,path:e.input.path,type:e.input.type,name:e.input.name,components:e.input.components};if(i_(r.path)!=t.rootPath)throw new Error(`Cannot add element with root segment ${i_(r.path)} to document with root path ${t.rootPath}`);let i=!1,s=null;for(;s=t.elements.shift();){if(!i&&G9(r.path,s.path)&&(n.push(r),i=!0),!i&&r.path==s.path)throw new Error(`New element's path ${r.path} already exists.`);n.push(s)}i||n.push(r),t.elements=n},updateElementTypeOperation(t,e){t.elements.filter(n=>n.id==e.input.id).forEach(n=>{n.type=e.input.type})},updateElementNameOperation(t,e){t.elements.filter(n=>n.id==e.input.id).forEach(n=>{n.name=e.input.name})},updateElementComponentsOperation(t,e){t.elements.filter(n=>n.id==e.input.id).forEach(n=>{n.components=e.input.components})},removeElementOperation(t,e){const n=t.elements.filter(r=>r.id==e.input.id)[0];n&&(t.elements=t.elements.filter(r=>!r.path.startsWith(n.path)))},reorderElementsOperation(t,e){throw new Error('Reducer "reorderElementsOperation" not yet implemented')},moveElementOperation(t,e){throw new Error('Reducer "moveElementOperation" not yet implemented')}},Y9=(t,e,n)=>{if(Ce.isBaseAction(e))return t;switch(e.type){case"SET_ROOT_PATH":HI().parse(e.input),Vi.setRootPathOperation(t[e.scope],e,n);break;case"ADD_ELEMENT":jI().parse(e.input),Vi.addElementOperation(t[e.scope],e,n);break;case"UPDATE_ELEMENT_TYPE":ZI().parse(e.input),Vi.updateElementTypeOperation(t[e.scope],e,n);break;case"UPDATE_ELEMENT_NAME":qI().parse(e.input),Vi.updateElementNameOperation(t[e.scope],e,n);break;case"UPDATE_ELEMENT_COMPONENTS":WI().parse(e.input),Vi.updateElementComponentsOperation(t[e.scope],e,n);break;case"REMOVE_ELEMENT":zI().parse(e.input),Vi.removeElementOperation(t[e.scope],e,n);break;case"REORDER_ELEMENTS":VI().parse(e.input),Vi.reorderElementsOperation(t[e.scope],e,n);break;case"MOVE_ELEMENT":BI().parse(e.input),Vi.moveElementOperation(t[e.scope],e,n);break;default:return t}},kd=Ce.createReducer(Y9),J9={rootPath:"A",elements:[{id:"hruFam5ot7s0Gb1n+aIBa+y+NJA=",name:"Scope Name",version:1,type:"Scope",path:"A.1",components:{content:"Scope description goes here."}}]},X9={},Sc={fileExtension:"mdsf",createState(t){return{global:{...J9,...t==null?void 0:t.global},local:{...X9,...t==null?void 0:t.local}}},createExtendedState(t){return Ce.createExtendedState({...t,documentType:"makerdao/scope-framework"},Sc.createState)},createDocument(t){return Ce.createDocument(Sc.createExtendedState(t),Sc.createState)},saveToFile(t,e,n){return Ce.saveToFile(t,e,"mdsf",n)},saveToFileHandle(t,e){return Ce.saveToFileHandle(t,e)},loadFromFile(t){return Ce.loadFromFile(t,kd)},loadFromInput(t){return Ce.loadFromInput(t,kd)}},{createAction:_s}=Ce,GI=t=>_s("SET_ROOT_PATH",{...t},void 0,HI,"global"),YI=t=>_s("ADD_ELEMENT",{...t},void 0,jI,"global"),JI=t=>_s("UPDATE_ELEMENT_TYPE",{...t},void 0,ZI,"global"),XI=t=>_s("UPDATE_ELEMENT_NAME",{...t},void 0,qI,"global"),KI=t=>_s("UPDATE_ELEMENT_COMPONENTS",{...t},void 0,WI,"global"),QI=t=>_s("REMOVE_ELEMENT",{...t},void 0,zI,"global"),ex=t=>_s("REORDER_ELEMENTS",{...t},void 0,VI,"global"),tx=t=>_s("MOVE_ELEMENT",{...t},void 0,BI,"global");class K9 extends Yt{setRootPath(e){return this.dispatch(GI(e))}addElement(e){return this.dispatch(YI(e))}updateElementType(e){return this.dispatch(JI(e))}updateElementName(e){return this.dispatch(XI(e))}updateElementComponents(e){return this.dispatch(KI(e))}removeElement(e){return this.dispatch(QI(e))}reorderElements(e){return this.dispatch(ex(e))}moveElement(e){return this.dispatch(tx(e))}}const nx=class rx extends Yt{constructor(e,n){super(kd,Sc.createDocument(e),n)}saveToFile(e,n){return super.saveToFile(e,rx.fileExtension,n)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const n=new this;return await n.loadFromFile(e),n}};j9(nx,"fileExtension","mdsf");let ix=nx;wa(ix,[K9]);const Q9=Object.freeze(Object.defineProperty({__proto__:null,addElement:YI,moveElement:tx,removeElement:QI,reorderElements:ex,setRootPath:GI,updateElementComponents:KI,updateElementName:XI,updateElementType:JI},Symbol.toStringTag,{value:"Module"})),e6=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),t6=ix,n6={...Sc,...e6},r6={...Sa,...Q9},i6={Document:t6,reducer:kd,actions:r6,utils:n6,documentModel:U9};var s6=Object.defineProperty,o6=(t,e,n)=>e in t?s6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sx=(t,e,n)=>o6(t,typeof e!="symbol"?e+"":e,n);const a6={id:"powerhouse/chat-room",name:"ChatRoom",extension:".phdm",description:"Description",author:{name:"0x",website:"https://powerhouse.inc"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type ChatRoomState {
|
|
751
|
-
id: OID!
|
|
752
|
-
name: String!
|
|
753
|
-
description: String
|
|
754
|
-
createdAt: DateTime!
|
|
755
|
-
createdBy: ID!
|
|
756
|
-
messages: [Message!]!
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
type Message {
|
|
760
|
-
id: OID!
|
|
761
|
-
sender: Sender!
|
|
762
|
-
content: String
|
|
763
|
-
sentAt: DateTime!
|
|
764
|
-
reactions: [Reaction!]
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
type Sender {
|
|
768
|
-
id: ID!
|
|
769
|
-
name: String
|
|
770
|
-
avatarUrl: URL
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
type Reaction {
|
|
774
|
-
type: ReactionType! # Type of reaction (one of the predefined emoji)
|
|
775
|
-
reactedBy: [ID!]! # Agent ID of the user who reacted
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
enum ReactionType {
|
|
779
|
-
THUMBS_UP
|
|
780
|
-
THUMBS_DOWN
|
|
781
|
-
LAUGH
|
|
782
|
-
HEART
|
|
783
|
-
CRY
|
|
784
|
-
}`,initialValue:'"{\\n \\"id\\": \\"\\",\\n \\"name\\": \\"\\",\\n \\"description\\": \\"\\",\\n \\"createdAt\\": \\"2024-12-03T14:13:08.862Z\\",\\n \\"createdBy\\": \\"\\",\\n \\"messages\\": []\\n}"',examples:[]},local:{schema:"",initialValue:'""',examples:[]}},modules:[{id:"K/Em4FC2mDn6EIec3sGFaEHpfHw=",name:"general_operations",description:"",operations:[{id:"+rTrTsaz2oomuXmTf9EmYlg2L8M=",name:"ADD_MESSAGE",description:"",schema:`input AddMessageInput {
|
|
785
|
-
messageId: OID! # ID of the message that is being added
|
|
786
|
-
sender: Sender! # ID of the user sending the message
|
|
787
|
-
content: String! # Content of the message
|
|
788
|
-
sentAt: DateTime!
|
|
789
|
-
}`,template:"",reducer:"",errors:[{id:"BYa+dXU0lytb2+58A4z2hpywzAU=",name:"MessageContentCannotBeEmpty",code:"",description:"",template:""},{id:"ZVA6sBSOVxHZXP6xaYqNvDxGneE=",name:"MessageContentExceedsTheMaximumLength",code:"",description:"",template:""}],examples:[],scope:"global"},{id:"lGopkrwnC9h9HO4aZA2YSf0RO2I=",name:"ADD_EMOJI_REACTION",description:"",schema:`input AddEmojiReactionInput {
|
|
790
|
-
messageId: OID! # ID of the message to which the reaction is being added
|
|
791
|
-
reactedBy: ID! # ID of the user adding the reaction
|
|
792
|
-
type: ReactionType! # Type of the reaction (emoji)
|
|
793
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"lrDchn0v4MAD+N6czrz773na6OY=",name:"REMOVE_EMOJI_REACTION",description:"",schema:`input RemoveEmojiReactionInput {
|
|
794
|
-
messageId: OID! # ID of the message to which the reaction is being removed
|
|
795
|
-
senderId: ID! # ID of the user that is removing the reaction
|
|
796
|
-
type: ReactionType! # Type of the reaction (emoji)
|
|
797
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"KSoGfAD5eLW7JJIJOMn+SLishkI=",name:"EDIT_CHAT_NAME",description:"",schema:`input EditChatNameInput {
|
|
798
|
-
name: String!
|
|
799
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"5HHylDd/auLeCwpybVYdzTISAzg=",name:"EDIT_CHAT_DESCRIPTION",description:"",schema:`input EditChatDescriptionInput {
|
|
800
|
-
description: String!
|
|
801
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]},c6=t=>t!=null;D.any().refine(t=>c6(t));const ox=D.enum(["CRY","HEART","LAUGH","THUMBS_DOWN","THUMBS_UP"]);function ax(){return D.object({messageId:D.string(),reactedBy:D.string(),type:ox})}function cx(){return D.object({content:D.string(),messageId:D.string(),sender:l6(),sentAt:D.string().datetime()})}function lx(){return D.object({description:D.string()})}function ux(){return D.object({name:D.string()})}function dx(){return D.object({messageId:D.string(),senderId:D.string(),type:ox})}function l6(){return D.object({__typename:D.literal("Sender").optional(),avatarUrl:D.string().url().nullable(),id:D.string(),name:D.string().nullable()})}class u6 extends Error{constructor(e="MessageContentCannotBeEmpty"){super(e),sx(this,"errorCode","MessageContentCannotBeEmpty")}}const za={addMessageOperation(t,e,n){if(e.input.content==="")throw new u6;t.messages.push({id:e.input.messageId,content:e.input.content,sender:e.input.sender,sentAt:e.input.sentAt,reactions:[]})},addEmojiReactionOperation(t,e,n){const r=t.messages.find(s=>s.id===e.input.messageId);if(!r)throw new Error("Message not found");const i=r.reactions||[];i.find(s=>s.type===e.input.type)?r.reactions=i.map(s=>s.type===e.input.type?{...s,reactedBy:[...s.reactedBy,e.input.reactedBy]}:s):r.reactions=[...i,{reactedBy:[e.input.reactedBy],type:e.input.type}],t.messages=t.messages.map(s=>s.id===r.id?r:s)},removeEmojiReactionOperation(t,e,n){t.messages=t.messages.map(r=>(r.id===e.input.messageId&&(r.reactions=(r.reactions||[]).map(i=>i.type===e.input.type?{...i,reactedBy:i.reactedBy.filter(s=>s!==e.input.senderId)}:i)),r))},editChatNameOperation(t,e,n){t.name=e.input.name||""},editChatDescriptionOperation(t,e,n){t.description=e.input.description||""}},d6=(t,e,n)=>{if(Ce.isBaseAction(e))return t;switch(e.type){case"ADD_MESSAGE":cx().parse(e.input),za.addMessageOperation(t[e.scope],e,n);break;case"ADD_EMOJI_REACTION":ax().parse(e.input),za.addEmojiReactionOperation(t[e.scope],e,n);break;case"REMOVE_EMOJI_REACTION":dx().parse(e.input),za.removeEmojiReactionOperation(t[e.scope],e,n);break;case"EDIT_CHAT_NAME":ux().parse(e.input),za.editChatNameOperation(t[e.scope],e,n);break;case"EDIT_CHAT_DESCRIPTION":lx().parse(e.input),za.editChatDescriptionOperation(t[e.scope],e,n);break;default:return t}},Nd=Ce.createReducer(d6),f6={id:"",name:"",description:"",createdAt:"2024-12-03T14:13:08.862Z",createdBy:"",messages:[]},p6={},wc={fileExtension:".phdm",createState(t){return{global:{...f6,...t==null?void 0:t.global},local:{...p6,...t==null?void 0:t.local}}},createExtendedState(t){return Ce.createExtendedState({...t,documentType:"powerhouse/chat-room"},wc.createState)},createDocument(t){return Ce.createDocument(wc.createExtendedState(t),wc.createState)},saveToFile(t,e,n){return Ce.saveToFile(t,e,".phdm",n)},saveToFileHandle(t,e){return Ce.saveToFileHandle(t,e)},loadFromFile(t){return Ce.loadFromFile(t,Nd)},loadFromInput(t){return Ce.loadFromInput(t,Nd)}},{createAction:Ul}=Ce,fx=t=>Ul("ADD_MESSAGE",{...t},void 0,cx,"global"),px=t=>Ul("ADD_EMOJI_REACTION",{...t},void 0,ax,"global"),hx=t=>Ul("REMOVE_EMOJI_REACTION",{...t},void 0,dx,"global"),mx=t=>Ul("EDIT_CHAT_NAME",{...t},void 0,ux,"global"),gx=t=>Ul("EDIT_CHAT_DESCRIPTION",{...t},void 0,lx,"global");class h6 extends Yt{addMessage(e){return this.dispatch(fx(e))}addEmojiReaction(e){return this.dispatch(px(e))}removeEmojiReaction(e){return this.dispatch(hx(e))}editChatName(e){return this.dispatch(mx(e))}editChatDescription(e){return this.dispatch(gx(e))}}const yx=class vx extends Yt{constructor(e,n){super(Nd,wc.createDocument(e),n)}saveToFile(e,n){return super.saveToFile(e,vx.fileExtension,n)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const n=new this;return await n.loadFromFile(e),n}};sx(yx,"fileExtension",".phdm");let _x=yx;wa(_x,[h6]);const m6=Object.freeze(Object.defineProperty({__proto__:null,addEmojiReaction:px,addMessage:fx,editChatDescription:gx,editChatName:mx,removeEmojiReaction:hx},Symbol.toStringTag,{value:"Module"})),g6=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),y6=_x,v6={...wc,...g6},_6={...Sa,...m6},b6={Document:y6,reducer:Nd,actions:_6,utils:v6,documentModel:a6},E6=Object.freeze(Object.defineProperty({__proto__:null,AccountSnapshot:eL,BudgetStatement:P9,ChatRoom:b6,DocumentDrive:nw,ScopeFramework:i6},Symbol.toStringTag,{value:"Module"}));var S6=Object.defineProperty,w6=(t,e,n)=>e in t?S6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T6=(t,e,n)=>w6(t,e+"",n),hu;const I6=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),x6=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),O6=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),D6=/[^\p{L}\d]+/giu,s_="$1\0$2",o_="";function bx(t){let e=t.trim();e=e.replace(I6,s_).replace(x6,s_),e=e.replace(D6,"\0");let n=0,r=e.length;for(;e.charAt(n)==="\0";)n++;if(n===r)return[];for(;e.charAt(r-1)==="\0";)r--;return e.slice(n,r).split(/\0/g)}function R6(t){const e=bx(t);for(let n=0;n<e.length;n++){const r=e[n],i=O6.exec(r);if(i){const s=i.index+(i[1]??i[2]).length;e.splice(n,1,r.slice(0,s),r.slice(s))}}return e}function a_(t,e){const[n,r,i]=C6(t,e),s=k6(void 0),o=N6(void 0),a=A6(s,o);return n+r.map(a).join("")+i}function k6(t){return e=>e.toLocaleLowerCase(t)}function N6(t){return e=>e.toLocaleUpperCase(t)}function A6(t,e){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(n.slice(1))}}function C6(t,e={}){const n=e.split??(e.separateNumbers?R6:bx),r=e.prefixCharacters??o_,i=e.suffixCharacters??o_;let s=0,o=t.length;for(;s<t.length;){const a=t.charAt(s);if(!r.includes(a))break;s++}for(;o>s;){const a=o-1,c=t.charAt(a);if(!i.includes(c))break;o=a}return[t.slice(0,s),n(t.slice(s,o)),t.slice(o)]}function M6(t,e=!1){const n=[];if(e&&t==="")return n;try{const r=JSON.parse(t);!e&&!Object.keys(r).length&&n.push({message:"Initial state cannot be empty",details:{initialState:t}})}catch{n.push({message:"Invalid initial state",details:{initialState:t}})}return n}function L6(t,e,n="",r=!0){const i=[];if(!r&&!t)return i.push({message:"State schema is required",details:{schema:t}}),i;if(r&&!t)return i;const s=`type ${a_(e)}${a_(n)}State`;return t.includes(s)||i.push({message:`Invalid state schema name. Expected ${s}`,details:{schema:t}}),i}function P6(t){const e=[];t.length||e.push({message:"Modules are required",details:{modules:t}});const n=t.reduce((r,i)=>[...r,...Ex(i)],[]);return[...e,...n]}function Ex(t){const e=[];t.name||e.push({message:"Module name is required",details:{module:t}}),t.operations.length||e.push({message:"Module operations are required",details:{module:t}});const n=t.operations.reduce((r,i)=>[...r,...Sx(i)],[]);return[...e,...n]}function Sx(t){const e=[];return t.name||e.push({message:"Operation name is required",details:{operation:t}}),t.schema||e.push({message:"Operation schema is required",details:{operation:t}}),e}const F6=Object.freeze(Object.defineProperty({__proto__:null,validateInitialState:M6,validateModule:Ex,validateModuleOperation:Sx,validateModules:P6,validateStateSchemaName:L6},Symbol.toStringTag,{value:"Module"})),$6={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"header",operations:[{name:"SetModelName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelId",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelExtension",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorWebsite",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"versioning",operations:[{name:"AddChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderChangeLogItems",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReleaseNewVersion",schema:null,id:"",description:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"module",operations:[{name:"AddModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModules",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-error",operations:[{name:"AddOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorCode",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationErrors",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-example",operations:[{name:"AddOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation",operations:[{name:"AddOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationReducer",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MoveOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModuleOperations",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"state",operations:[{name:"SetStateSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetInitialState",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"AddStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderStateExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}],state:{global:{schema:"",initialValue:`{
|
|
802
|
-
"id": "",
|
|
803
|
-
"name": "",
|
|
804
|
-
"extension": "",
|
|
805
|
-
"description": "",
|
|
806
|
-
"author": {
|
|
807
|
-
"name": "",
|
|
808
|
-
"website": ""
|
|
809
|
-
},
|
|
810
|
-
"specifications": [
|
|
811
|
-
{
|
|
812
|
-
"version": 1,
|
|
813
|
-
"changeLog": [],
|
|
814
|
-
"state": {
|
|
815
|
-
"schema": "",
|
|
816
|
-
"initialValue": "",
|
|
817
|
-
"examples": []
|
|
818
|
-
},
|
|
819
|
-
"modules": []
|
|
820
|
-
}
|
|
821
|
-
]
|
|
822
|
-
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},j6=t=>t!=null;te.any().refine(t=>j6(t));function U6(){return te.object({__typename:te.literal("AddChangeLogItemInput").optional(),content:te.string(),id:te.string(),insertBefore:te.string().nullable()})}function B6(){return te.object({description:te.string().nullish(),id:te.string(),name:te.string()})}function z6(){return te.object({errorCode:te.string().nullish(),errorDescription:te.string().nullish(),errorName:te.string().nullish(),errorTemplate:te.string().nullish(),id:te.string(),operationId:te.string()})}function V6(){return te.object({example:te.string(),id:te.string(),operationId:te.string()})}function H6(){return te.object({description:te.string().nullish(),id:te.string(),moduleId:te.string(),name:te.string(),reducer:te.string().nullish(),schema:te.string().nullish(),template:te.string().nullish(),scope:wx().nullish()})}function W6(){return te.object({scope:te.string(),example:te.string(),id:te.string(),insertBefore:te.string().nullish()})}function q6(){return te.object({__typename:te.literal("DeleteChangeLogItemInput").optional(),id:te.string()})}function Z6(){return te.object({id:te.string()})}function G6(){return te.object({id:te.string()})}function Y6(){return te.object({id:te.string()})}function J6(){return te.object({id:te.string()})}function X6(){return te.object({scope:te.string(),id:te.string()})}function wx(){return te.literal("global").or(te.literal("local"))}function K6(){return te.object({newModuleId:te.string(),operationId:te.string()})}function Q6(){return te.object({__typename:te.literal("ReorderChangeLogItemsInput").optional(),order:te.array(te.string())})}function e4(){return te.object({moduleId:te.string(),order:te.array(te.string())})}function t4(){return te.object({order:te.array(te.string())})}function n4(){return te.object({operationId:te.string(),order:te.array(te.string())})}function r4(){return te.object({operationId:te.string(),order:te.array(te.string())})}function i4(){return te.object({scope:te.string(),order:te.array(te.string())})}function s4(){return te.object({authorName:te.string()})}function o4(){return te.object({authorWebsite:te.string()})}function a4(){return te.object({scope:te.string(),initialValue:te.string()})}function c4(){return te.object({description:te.string()})}function l4(){return te.object({extension:te.string()})}function u4(){return te.object({id:te.string()})}function d4(){return te.object({name:te.string()})}function f4(){return te.object({description:te.string().nullish(),id:te.string()})}function p4(){return te.object({id:te.string(),name:te.string().nullish()})}function h4(){return te.object({description:te.string().nullish(),id:te.string()})}function m4(){return te.object({errorCode:te.string().nullish(),id:te.string()})}function g4(){return te.object({errorDescription:te.string().nullish(),id:te.string()})}function y4(){return te.object({errorName:te.string().nullish(),id:te.string()})}function v4(){return te.object({errorTemplate:te.string().nullish(),id:te.string()})}function _4(){return te.object({id:te.string(),name:te.string().nullish()})}function b4(){return te.object({id:te.string(),scope:wx()})}function E4(){return te.object({id:te.string(),reducer:te.string().nullish()})}function S4(){return te.object({id:te.string(),schema:te.string().nullish()})}function w4(){return te.object({id:te.string(),template:te.string().nullish()})}function T4(){return te.object({scope:te.string(),schema:te.string()})}function I4(){return te.object({__typename:te.literal("UpdateChangeLogItemInput").optional(),id:te.string(),newContent:te.string()})}function x4(){return te.object({example:te.string(),id:te.string()})}function O4(){return te.object({scope:te.string(),id:te.string(),newExample:te.string()})}const wo={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Va={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},D4=t=>{const e={};return t.forEach((n,r)=>e[n]=r),(n,r)=>(e[r.id]||999999)-(e[n.id]||999999)},Ha={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===e.input.id&&(n.modules[r].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===e.input.id&&(n.modules[r].description=e.input.description||"")},deleteModuleOperation(t,e){const n=t.specifications[t.specifications.length-1];n.modules=n.modules.filter(r=>r.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(D4(e.input.order))}},R4=t=>{const e={};return t.forEach((n,r)=>e[n]=r),(n,r)=>(e[r.id]||999999)-(e[n.id]||999999)},xs={addOperationErrorOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.operationId&&n.modules[r].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==e.input.id&&(n.modules[r].operations[i].errors[s].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==e.input.id&&(n.modules[r].operations[i].errors[s].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==e.input.id&&(n.modules[r].operations[i].errors[s].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==e.input.id&&(n.modules[r].operations[i].errors[s].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].errors=n.modules[r].operations[i].errors.filter(s=>s.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.operationId&&n.modules[r].operations[i].errors.sort(R4(e.input.order))}},k4=t=>{const e={};return t.forEach((n,r)=>e[n]=r),(n,r)=>(e[r.id]||999999)-(e[n.id]||999999)},mu={addOperationExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.operationId&&n.modules[r].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].examples.length;s++)n.modules[r].operations[i].examples[s].id==e.input.id&&(n.modules[r].operations[i].examples[s].value=e.input.example)},deleteOperationExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].examples=n.modules[r].operations[i].examples.filter(s=>s.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.operationId&&n.modules[r].operations[i].examples.sort(k4(e.input.order))}},N4=t=>{const e={};return t.forEach((n,r)=>e[n]=r),(n,r)=>(e[r.id]||999999)-(e[n.id]||999999)},Br={addOperationOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==e.input.moduleId&&n.modules[r].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==e.input.id&&(n.modules[r].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const n=[],r=t.specifications[t.specifications.length-1];for(let i=0;i<r.modules.length;i++)r.modules[i].operations=r.modules[i].operations.filter(s=>s.id==e.input.operationId?(n.push(s),!1):!0);for(let i=0;i<r.modules.length;i++)r.modules[i].id==e.input.newModuleId&&r.modules[i].operations.push(...n)},deleteOperationOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].operations=n.modules[r].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const n=t.specifications[t.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==e.input.moduleId&&n.modules[r].operations.sort(N4(e.input.order))}},A4=t=>{const e={};return t.forEach((n,r)=>e[n]=r),(n,r)=>(e[r.id]||999999)-(e[n.id]||999999)},To={setStateSchemaOperation(t,e){const n=t.specifications[t.specifications.length-1];if(Object.keys(n.state).includes(e.input.scope))n.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const n=t.specifications[t.specifications.length-1];if(Object.keys(n.state).includes(e.input.scope))n.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];if(Object.keys(n.state).includes(e.input.scope))n.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];if(!Object.keys(n.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const r=n.state[e.input.scope].examples;for(let i=0;i<r.length;i++)r[i].id==e.input.id&&(r[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const n=t.specifications[t.specifications.length-1];if(Object.keys(n.state).includes(e.input.scope))n.state[e.input.scope].examples=n.state[e.input.scope].examples.filter(r=>r.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const n=t.specifications[t.specifications.length-1];if(Object.keys(n.state).includes(e.input.scope))n.state[e.input.scope].examples.sort(A4(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},C4=(t,e)=>{if(ra(e))return t;switch(e.type){case"SET_MODEL_NAME":d4().parse(e.input),wo.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":u4().parse(e.input),wo.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":l4().parse(e.input),wo.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":c4().parse(e.input),wo.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":s4().parse(e.input),wo.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":o4().parse(e.input),wo.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":U6().parse(e.input),Va.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":I4().parse(e.input),Va.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":q6().parse(e.input),Va.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":Q6().parse(e.input),Va.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Va.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":B6().parse(e.input),Ha.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":p4().parse(e.input),Ha.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":f4().parse(e.input),Ha.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":Z6().parse(e.input),Ha.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":t4().parse(e.input),Ha.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":z6().parse(e.input),xs.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":m4().parse(e.input),xs.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":y4().parse(e.input),xs.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":g4().parse(e.input),xs.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":v4().parse(e.input),xs.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":G6().parse(e.input),xs.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":n4().parse(e.input),xs.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":V6().parse(e.input),mu.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":x4().parse(e.input),mu.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":Y6().parse(e.input),mu.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":r4().parse(e.input),mu.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":H6().parse(e.input),Br.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":_4().parse(e.input),Br.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":b4().parse(e.input),Br.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":S4().parse(e.input),Br.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":h4().parse(e.input),Br.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":w4().parse(e.input),Br.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":E4().parse(e.input),Br.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":K6().parse(e.input),Br.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":J6().parse(e.input),Br.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":e4().parse(e.input),Br.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":T4().parse(e.input),To.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":a4().parse(e.input),To.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":W6().parse(e.input),To.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":O4().parse(e.input),To.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":X6().parse(e.input),To.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":i4().parse(e.input),To.reorderStateExamplesOperation(t.global,e);break;default:return t}},Ad=ym(C4),M4={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},L4={},Tc={fileExtension:"phdm",createState(t){return{global:{...M4,...t==null?void 0:t.global},local:{...L4,...t==null?void 0:t.local}}},createExtendedState(t){return vm({...t,documentType:"powerhouse/document-model"},Tc.createState)},createDocument(t){return _m(Tc.createExtendedState(t),Tc.createState)},saveToFile(t,e,n){return mm(t,e,"phdm",n)},saveToFileHandle(t,e){return kE(t,e)},loadFromFile(t){return Qu(t,Ad)},loadFromInput(t){return gm(t,Ad)}},Tx=t=>Je("SET_MODEL_NAME",{...t}),Ix=t=>Je("SET_MODEL_ID",{...t}),xx=t=>Je("SET_MODEL_EXTENSION",{...t}),Ox=t=>Je("SET_MODEL_DESCRIPTION",{...t}),Dx=t=>Je("SET_AUTHOR_NAME",{...t}),Rx=t=>Je("SET_AUTHOR_WEBSITE",{...t});class P4 extends Yt{setModelName(e,n){return this.dispatch(Tx(e),n)}setModelId(e,n){return this.dispatch(Ix(e),n)}setModelExtension(e,n){return this.dispatch(xx(e),n)}setModelDescription(e,n){return this.dispatch(Ox(e),n)}setAuthorName(e,n){return this.dispatch(Dx(e),n)}setAuthorWebsite(e,n){return this.dispatch(Rx(e),n)}}const kx=t=>Je("ADD_CHANGE_LOG_ITEM",{...t}),Nx=t=>Je("UPDATE_CHANGE_LOG_ITEM",{...t}),Ax=t=>Je("DELETE_CHANGE_LOG_ITEM",{...t}),Cx=t=>Je("REORDER_CHANGE_LOG_ITEMS",{...t}),Mx=()=>Je("RELEASE_NEW_VERSION");class F4 extends Yt{addChangeLogItem(e,n){return this.dispatch(kx(e),n)}updateChangeLogItem(e,n){return this.dispatch(Nx(e),n)}deleteChangeLogItem(e,n){return this.dispatch(Ax(e),n)}reorderChangeLogItems(e,n){return this.dispatch(Cx(e),n)}releaseNewVersion(e){return this.dispatch(Mx(),e)}}const Lx=t=>Je("ADD_MODULE",{...t}),Px=t=>Je("SET_MODULE_NAME",{...t}),Fx=t=>Je("SET_MODULE_DESCRIPTION",{...t}),$x=t=>Je("DELETE_MODULE",{...t}),jx=t=>Je("REORDER_MODULES",{...t});class $4 extends Yt{addModule(e,n){return this.dispatch(Lx(e),n)}setModuleName(e,n){return this.dispatch(Px(e),n)}setModuleDescription(e,n){return this.dispatch(Fx(e),n)}deleteModule(e,n){return this.dispatch($x(e),n)}reorderModules(e,n){return this.dispatch(jx(e),n)}}const Ux=t=>Je("ADD_OPERATION_ERROR",{...t}),Bx=t=>Je("SET_OPERATION_ERROR_CODE",{...t}),zx=t=>Je("SET_OPERATION_ERROR_NAME",{...t}),Vx=t=>Je("SET_OPERATION_ERROR_DESCRIPTION",{...t}),Hx=t=>Je("SET_OPERATION_ERROR_TEMPLATE",{...t}),Wx=t=>Je("DELETE_OPERATION_ERROR",{...t}),qx=t=>Je("REORDER_OPERATION_ERRORS",{...t});class j4 extends Yt{addOperationError(e,n){return this.dispatch(Ux(e),n)}setOperationErrorCode(e,n){return this.dispatch(Bx(e),n)}setOperationErrorName(e,n){return this.dispatch(zx(e),n)}setOperationErrorDescription(e,n){return this.dispatch(Vx(e),n)}setOperationErrorTemplate(e,n){return this.dispatch(Hx(e),n)}deleteOperationError(e,n){return this.dispatch(Wx(e),n)}reorderOperationErrors(e,n){return this.dispatch(qx(e),n)}}const Zx=t=>Je("ADD_OPERATION_EXAMPLE",{...t}),Gx=t=>Je("UPDATE_OPERATION_EXAMPLE",{...t}),Yx=t=>Je("DELETE_OPERATION_EXAMPLE",{...t}),Jx=t=>Je("REORDER_OPERATION_EXAMPLES",{...t});class U4 extends Yt{addOperationExample(e,n){return this.dispatch(Zx(e),n)}updateOperationExample(e,n){return this.dispatch(Gx(e),n)}deleteOperationExample(e,n){return this.dispatch(Yx(e),n)}reorderOperationExamples(e,n){return this.dispatch(Jx(e),n)}}const Xx=t=>Je("ADD_OPERATION",{...t}),Kx=t=>Je("SET_OPERATION_NAME",{...t}),Qx=t=>Je("SET_OPERATION_SCOPE",{...t}),eO=t=>Je("SET_OPERATION_SCHEMA",{...t}),tO=t=>Je("SET_OPERATION_DESCRIPTION",{...t}),nO=t=>Je("SET_OPERATION_TEMPLATE",{...t}),rO=t=>Je("SET_OPERATION_REDUCER",{...t}),iO=t=>Je("MOVE_OPERATION",{...t}),sO=t=>Je("DELETE_OPERATION",{...t}),oO=t=>Je("REORDER_MODULE_OPERATIONS",{...t});class B4 extends Yt{addOperation(e,n){return this.dispatch(Xx(e),n)}setOperationName(e,n){return this.dispatch(Kx(e),n)}setOperationScope(e,n){return this.dispatch(Qx(e),n)}setOperationSchema(e,n){return this.dispatch(eO(e),n)}setOperationDescription(e,n){return this.dispatch(tO(e),n)}setOperationTemplate(e,n){return this.dispatch(nO(e),n)}setOperationReducer(e,n){return this.dispatch(rO(e),n)}moveOperation(e,n){return this.dispatch(iO(e),n)}deleteOperation(e,n){return this.dispatch(sO(e),n)}reorderModuleOperations(e,n){return this.dispatch(oO(e),n)}}const aO=t=>Je("SET_STATE_SCHEMA",{...t}),cO=t=>Je("SET_INITIAL_STATE",{...t}),lO=t=>Je("ADD_STATE_EXAMPLE",{...t}),uO=t=>Je("UPDATE_STATE_EXAMPLE",{...t}),dO=t=>Je("DELETE_STATE_EXAMPLE",{...t}),fO=t=>Je("REORDER_STATE_EXAMPLES",{...t});class z4 extends Yt{setStateSchema(e,n){return this.dispatch(aO(e),n)}setInitialState(e,n){return this.dispatch(cO(e),n)}addStateExample(e,n){return this.dispatch(lO(e),n)}updateStateExample(e,n){return this.dispatch(uO(e),n)}deleteStateExample(e,n){return this.dispatch(dO(e),n)}reorderStateExamples(e,n){return this.dispatch(fO(e),n)}}let pO=(hu=class extends Yt{constructor(t,e){super(Ad,Tc.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,hu.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},T6(hu,"fileExtension","phdm"),hu);wa(pO,[P4,F4,$4,j4,U4,B4,z4]);const V4=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:kx,addModule:Lx,addOperation:Xx,addOperationError:Ux,addOperationExample:Zx,addStateExample:lO,deleteChangeLogItem:Ax,deleteModule:$x,deleteOperation:sO,deleteOperationError:Wx,deleteOperationExample:Yx,deleteStateExample:dO,moveOperation:iO,releaseNewVersion:Mx,reorderChangeLogItems:Cx,reorderModuleOperations:oO,reorderModules:jx,reorderOperationErrors:qx,reorderOperationExamples:Jx,reorderStateExamples:fO,setAuthorName:Dx,setAuthorWebsite:Rx,setInitialState:cO,setModelDescription:Ox,setModelExtension:xx,setModelId:Ix,setModelName:Tx,setModuleDescription:Fx,setModuleName:Px,setOperationDescription:tO,setOperationErrorCode:Bx,setOperationErrorDescription:Vx,setOperationErrorName:zx,setOperationErrorTemplate:Hx,setOperationName:Kx,setOperationReducer:rO,setOperationSchema:eO,setOperationScope:Qx,setOperationTemplate:nO,setStateSchema:aO,updateChangeLogItem:Nx,updateOperationExample:Gx,updateStateExample:uO},Symbol.toStringTag,{value:"Module"})),H4=pO,W4={...Tc,...F6},q4={...Sa,...V4},Z4={Document:H4,reducer:Ad,actions:q4,utils:W4,documentModel:$6},G4="feature-flags-config",Au=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,Y4=Au==null?void 0:Au.split(","),Cu=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,J4=Cu==null?void 0:Cu.split(","),hO={editors:{enabledEditors:Au==="*"?"*":Y4,disabledEditors:Cu==="*"?"*":J4}},X4=bl(G4,hO),mO=()=>{const[t,e]=Nr(X4);return{config:{...hO,...t},setConfig:e}},K4=tD("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),pl=$h(),Q4=bl("sidebar-collapsed",!1);yn(!1);const e8={sidebarCollapsedAtom:Q4,themeAtom:K4},t8=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS,c_=window.__VITE_ENVS.LOAD_EXTERNAL_PROJECTS;async function n8(){if(!c_||c_!=="true")return[];try{return(await Ko(()=>import("EXTERNAL_PROJECTS"),[])).default}catch(t){return console.error("Error loading external projects",t),[]}}function r8(t){return t.filter(e=>!!e.documentModels).map(e=>e.documentModels).reduce((e,n)=>e.concat(n),[])}async function i8(){if(!t8)return[];try{const t=await Ko(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const s8={DocumentModel:Z4,...E6},gO=Object.values(s8),yO=i8(),o8=n8(),a8=yn(yO),c8=yn(o8),hl=yn(async t=>{const e=await t(a8),n=await t(c8),r=e.map(i=>i.documentModel.id);return[...gO.filter(i=>!r.includes(i.documentModel.id)),...e,...r8(n)]}),l8=()=>_l(hl),u8=Z_(hl),vO=()=>_l(u8),d8=()=>yO,f8=function(t){return pl.sub(hl,()=>{pl.get(hl).then(t).catch(e=>{throw e})})};function p8(t,e){return e==null?void 0:e.find(n=>n.documentModel.id===t)}const h8=()=>{const t=vO();return e=>p8(e,t)},m8=()=>{const t=vO(),{config:e}=mO(),{enabledEditors:n,disabledEditors:r}=e.editors;if(!t)return;const i=t.filter(s=>s.documentModel.id!=="powerhouse/document-drive");return n==="*"?t:r==="*"?[]:r?i.filter(s=>!r.includes(s.documentModel.id)):n?i.filter(s=>n.includes(s.documentModel.id)):i};function g8(t){let e=!1;const n=Object.entries(t.operations).reduce((r,[i,s])=>{const o=i;for(const a of s){const c=y8(a);r[o].push(c),c!==a&&(e=!0)}return r},{global:[],local:[]});return e?{...t,operations:n}:t}function y8(t){var n;if(!((n=t.context)!=null&&n.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const r=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:r!=null&&r.length?[r]:[]}}}}else return t}const wn=class wn{constructor(e){qe(this,"db");this.db=e_.ready().then(()=>e_.createInstance({name:e?`${e}:${wn.DBName}`:wn.DBName}))}buildKey(...e){return e.join(wn.SEP)}async checkDocumentExists(e,n){return!!await(await this.db).getItem(this.buildKey(e,n))}async getDocuments(e){const r=await(await this.db).keys(),i=`${e}${wn.SEP}`;return r.filter(s=>s.startsWith(i)).map(s=>s.slice(i.length))}async getDocument(e,n){const r=await(await this.db).getItem(this.buildKey(e,n));if(!r)throw new Error(`Document with id ${n} not found`);return r}async createDocument(e,n,r){await(await this.db).setItem(this.buildKey(e,n),r)}async deleteDocument(e,n){await(await this.db).removeItem(this.buildKey(e,n))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,n,r,i){const s=await this.getDocument(e,n);if(!s)throw new Error(`Document with id ${n} not found`);const o=ud(s.operations,r);await(await this.db).setItem(this.buildKey(e,n),{...s,...i,operations:o})}async getDrives(){return(await(await this.db).keys()).filter(r=>r.startsWith(wn.DRIVES_KEY)).map(r=>r.slice(wn.DRIVES_KEY.length+wn.SEP.length))}async getDrive(e){const r=await(await this.db).getItem(this.buildKey(wn.DRIVES_KEY,e));if(!r)throw new mc(e);return r}async getDriveBySlug(e){const n=(await this.getDrives()).reverse();for(const r of n)if((await this.getDrive(r)).initialState.state.global.slug===e)return this.getDrive(r);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,n){await(await this.db).setItem(this.buildKey(wn.DRIVES_KEY,e),n)}async deleteDrive(e){const n=await this.getDocuments(e);return await Promise.all(n.map(r=>this.deleteDocument(e,r))),(await this.db).removeItem(this.buildKey(wn.DRIVES_KEY,e))}async addDriveOperations(e,n,r){const i=await this.getDrive(e),s=ud(i.operations,n);await(await this.db).setItem(this.buildKey(wn.DRIVES_KEY,e),{...i,...r,operations:s})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async r=>{try{const i=await(r.documentId?this.getDocument(r.driveId,r.documentId):this.getDrive(r.driveId));if(!i)return;const s=i.operations[r.scope].at(-1);if(s)return{driveId:r.driveId,documentId:r.documentId,scope:r.scope,branch:r.branch,lastUpdated:s.timestamp,revision:s.index}}catch{return}}))).reduce((r,i)=>(i.status==="fulfilled"&&i.value!==void 0&&r.push(i.value),r),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const n of e){await this.migrateDocument(wn.DRIVES_KEY,n);const r=await this.getDocuments(n);await Promise.all(r.map(async i=>this.migrateDocument(n,i)))}}async migrateDocument(e,n){const r=await this.getDocument(e,n),i=g8(r);if(i!==r)return(await this.db).setItem(this.buildKey(e,n),i)}};qe(wn,"DBName","DOCUMENT_DRIVES"),qe(wn,"SEP",":"),qe(wn,"DRIVES_KEY","DRIVES");let kh=wn;const l_=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,gp=l_?l_.split(","):[],v8=()=>({defaultDrives:{remoteDrives:gp.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[],pullInterval:3e3}})),removeOldRemoteDrives:gp.length>0?{strategy:"preserve-by-url-and-detach",urls:gp}:{strategy:"preserve-all"}}});function _8(t,e){return new aP(t,new kh(e),new iw,new ow(1,10),{...v8()})}async function b8(t){const e=await t.initialize(),n=e==null?void 0:e.at(0);if(n)throw n;!(await t.getDrives()).length&&vi.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:Ce.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(dn.error)}const Fg=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??_8(gO,vi.routerBasename);return await b8(t),t})(),_O=yn(Fg),E8=Z_(_O),bO=()=>_l(E8),S8=()=>Fg;f8(async t=>{(await pl.get(_O)).setDocumentModels(t)});async function w8(){await d8();const t=await pl.get(hl);(await Fg).setDocumentModels(t)}w8().catch(console.error);const Mu=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await Ko(async()=>{const{ConnectCrypto:r}=await import("./index-BP2fj1j6.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await Ko(async()=>{const{BrowserKeyStorage:r}=await import("./browser-Dmr6AWWk.js");return{BrowserKeyStorage:r}},[]),n=new t(new e);return await n.did(),n})();function $g(){return is(()=>({async regenerateDid(){return(await Mu).regenerateDid()},async did(){return(await Mu).did()},sign:async t=>await(await Mu).sign(t)}),[])}const T8=yn(void 0);function I8(){const[t,e]=Nr(T8);return Pn(()=>{t||Mu.then(n=>n.did()).then(n=>e(n)).catch(dn.error)}),t}const x8=yn(window.renown?Promise.resolve(window.renown):void 0);function EO(){const[t,e]=Nr(x8),{did:n}=$g();async function r(i){const s=await i();if(!s)return;const{initRenownBrowser:o}=await Ko(async()=>{const{initRenownBrowser:l}=await import("./browser-CwKAjz_f.js").then(u=>u.f);return{initRenownBrowser:l}},__vite__mapDeps([4,1,2,3])),a=o(s);return{user:function(){return Promise.resolve(a.user)},login:function(l){return a.login(l)},logout(){return Promise.resolve(a.logout())},on:{user(l){return a.on("user",l)}}}}return t||e(r(n)),t}let gu=!1;const O8=yn(void 0),Df=()=>{const[t,e]=Nr(O8),n=EO();return Pn(()=>{var i;let r=null;if(t){const{credential:s,...o}=t;r={id:o.did,username:(i=o.ens)==null?void 0:i.name,...o}}P2(r)},[t]),Pn(()=>{if(gu)return;gu=!0,n==null||n.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const r=n==null?void 0:n.on.user(i=>{e(i||null)});return()=>{r==null||r(),gu=!1}},[n,gu]),t},D8=parseInt("50");function kH(t,e,n=dn.error){const[r,i]=xn(e),[s,o]=xn(),a=l=>{o(l),n(l)};return Pn(()=>{i(e)},[e]),[r,(l,u,d)=>{o(void 0),i(f=>{if(!t||!f)return f;try{const p=t(f,l),h=l.scope??"global",m=p.operations[h],v=m[m.length-1];if(v.error){const y=new Error(v.error);a(y),d==null||d(y)}return u==null||u(v,{prevState:{...f},newState:{...p}}),p}catch(p){return a(p),d==null||d(p),f}})},s]}async function R8(t,e,n,r,i){let s;const o=new Promise(l=>{s=i.on("strandUpdate",u=>{var p;if(!(u.documentId===e&&u.scope==n))return;const f=(p=u.operations.at(-1))==null?void 0:p.index;f&&f>=r&&l()})}),a=new Promise((l,u)=>setTimeout(()=>u(new Error(`Timed out waiting for operation ${r} for document ${e}`)),t)),c=Promise.race([o,a]);return c.finally(()=>{s==null||s()}),c}async function k8(t,e,n,r,i,s){const o=(s==null?void 0:s.operationsLimit)||D8;for(const a of Object.values(n.operations))for(let c=0;c<a.length;c+=o){const l=a.slice(c,c+o),u=l.at(-1);if(!u)break;const{scope:d}=u;await i(t,e,l),s!=null&&s.waitForSync&&await R8(1e4,e,d,u.index,r)}}const N8=async t=>{(await Ce.createZip(t)).generateAsync({type:"blob"}).then(n=>{const r=window.document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(n),r.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(r),r.click(),window.document.body.removeChild(r)}).catch(dn.error)};async function NH(t,e){var i,s;const n=e(t.documentType);if(!n)throw new Error(`Document model not supported: ${t.documentType}`);const r=n.utils.fileExtension;if(!window.showSaveFilePicker){await N8(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((i=t.state.global)==null?void 0:i.name)||"Untitled"}.${r?`${r}.`:""}zip`});await n.utils.saveToFileHandle(t,o);const a=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,a)),a}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function A8(t,e){const n=await Ce.loadFromInput(t,i=>i,{checkHashes:!0}),r=e(n.documentType);if(!r)throw new Error(`Document "${n.documentType}" is not supported`);return r.utils.loadFromInput(t)}async function C8(t,e,n,r,i,s){if(!s||!t.context||!t.context.signer)return t;if(!i)return dn.error(`Document model '${r.documentType}' does not have a reducer`),t;const o={documentId:n,signer:t.context.signer};return await Ce.buildSignedOperation(t,i,r,o,e)}function M8(t,e,n){return n?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:n.address,networkId:n.networkId,chainId:n.chainId},signatures:[]}},...t}:t}const u_=yn(new Map);function L8(t){return Object.keys(t.operations).map(e=>{var n;return`${e}:${t.operations[e].length}:${(n=t.operations[e].at(-1))==null?void 0:n.hash}`}).join(":")}function Cd(t){return t.map(L8).join("&")}const P8=t=>()=>yn(e=>t?e(u_).get(t)??[]:[],(e,n,r)=>{n(u_,i=>{if(!t)return new Map;const s=i.get(t)??[];return s.length!==r.length||Cd(s)!==Cd(r)?new Map(i).set(t,r):i})}),F8=Z1(()=>yn("INITIAL"));function $8(){const t=bO(),[e,n]=Nr(is(P8(t),[t])),r=Rt(async()=>{if(!t)return;const a=[];try{const c=await t.getDrives();for(const l of c)try{const u=await t.getDrive(l);a.push(u)}catch(u){dn.error(u)}}catch(c){dn.error(c)}finally{n(a)}},[t]),[i,s]=Nr(F8(t));i==="INITIAL"&&(s("LOADING"),r().then(()=>s("LOADED")).catch(()=>s("ERROR")));const o=Rt(a=>{if(!t)return;const c=t.on("syncStatus",async(f,p,h)=>{h&&dn.error(h),await r()}),l=t.on("strandUpdate",()=>r()),u=t.on("clientStrandsError",a.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>r());return()=>{c(),l(),u(),d()}},[t,r]);return is(()=>[e,r,o,i],[e,i])}const j8=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",U8=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",B8=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",z8=yn("initial"),jg=()=>{const[t,e]=Nr(z8),n=Df(),r=EO(),{did:i}=$g(),s=Rt(async()=>{var u;const c=await i(),l=new URL(j8);if(l.searchParams.set("connect",c),l.searchParams.set("network",U8),l.searchParams.set("chain",B8),window.electronAPI){const d=await window.electronAPI.protocol();l.searchParams.set("deeplink",d),await window.electronAPI.openURL(l.toString())}else{const d=new URL(window.location.pathname,window.location.origin);l.searchParams.set("returnUrl",d.toJSON()),(u=window.open(l,"_self"))==null||u.focus()}},[i]),o=Rt(async c=>{if(r)try{e("checking");const l=await r.user();if((l==null?void 0:l.did)===c)return e("authorized"),l;const u=await r.login(c);if(u)return e("authorized"),u;e("not-authorized")}catch(l){e("not-authorized"),dn.error(l)}},[r]);Pn(()=>{n&&t!=="authorized"&&e("authorized")},[n,t]);const a=Rt(async()=>{e("initial"),await(r==null?void 0:r.logout())},[r]);return is(()=>({openRenown:s,user:n,status:n?"authorized":t,login:r?o:void 0,logout:a}),[r,s,n,t,o,a])};function V8(){const{user:t,status:e}=jg(),n=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,r=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!n&&n!=="",s=!!r&&r!=="";if(i&&s)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!s)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const o=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:o.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(s){const o=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:o.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function SO(){const t=V8();if(!t)return;const{allowListType:e,isAllowed:n}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:n}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function Ug(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=SO()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},n=Df()||void 0,r=I8(),{sign:i}=$g(),s=bO(),o=h8(),[a,c,,l]=$8(),u=Rt(async(F,Z)=>{if(!s)throw new Error("Reactor is not loaded");const L=await s.getDocument(F,Z);if(!L)throw new Error(`There was an error opening file with id ${Z} on drive ${F}`);return L},[s]),d=Rt(async(F,Z)=>{if(!s)throw new Error("Reactor is not loaded");let L=a.find(he=>he.state.global.id===F);if(!L)throw new Error(`Drive with id ${F} not found`);const I={...L};L=Ks(L,M8(Z,r,n));const X=Z.scope??"global",H=L.operations[X].findLast(he=>he.type===Z.type);if(!H)throw new Error("There was an error applying the operation");const ve=await C8(H,i,F,I,Ks,n);try{const he=await s.queueDriveOperation(F,ve);if(he.status!=="SUCCESS"&&dn.error(he.error),he.operations.length&&await c(),he.document&&!Ds(he.document))throw new Error("Received document is not a Document Drive");return he.document}catch(he){return dn.error(he),L}},[a,c,s,i,n,r]),f=Rt(async(F,Z,L,I,X)=>{if(!t)throw new Error("User is not allowed to create documents");const B=Ce.hashKey();let H=a.find(Ee=>Ee.state.global.id===F);if(!H)throw new Error(`Drive with id ${F} not found`);const ve=qm(H.state.global,{id:B,name:Z,parentFolder:I??null,documentType:L,document:X},["global"]);H=await d(F,ve);const he=H==null?void 0:H.state.global.nodes.find(Ee=>Ee.id===B);if(!he||!Vn(he))throw new Error("There was an error adding document");return he},[d,a,t]),p=Rt(async(F,Z,L)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!s)throw new Error("Reactor is not loaded");if(!a.find(B=>B.state.global.id===F))throw new Error(`Drive with id ${F} not found`);return(await s.queueOperations(F,Z,L)).document},[a,e,s]),h=Rt(async(F,Z,L,I)=>{if(!s)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const X=await A8(F,o),B={...X.initialState,initialState:X.initialState,operations:{global:[],local:[]},clipboard:[]},H=await f(Z,L||(typeof F=="string"?X.name:F.name),X.documentType,I,B),ve=a.find(Ee=>Ee.state.global.id===Z),he=ve&&ve.state.local.listeners.length>0;k8(Z,H.id,X,s,p,{waitForSync:he}).catch(Ee=>{throw Ee})},[f,p,o,t,s]),m=Rt(async(F,Z,L,I,X)=>{if(!t)throw new Error("User is not allowed to update files");const B=await d(F,Tn.updateFile({id:Z,name:I||void 0,parentFolder:X,documentType:L})),H=B==null?void 0:B.state.global.nodes.find(ve=>ve.id===Z);if(!H||!Vn(H))throw new Error("There was an error updating document");return H},[d,t]),v=Rt(async(F,Z,L)=>{if(!t)throw new Error("User is not allowed to create folders");const I=Ce.hashKey(),X=await d(F,Tn.addFolder({id:I,name:Z,parentFolder:L})),B=X==null?void 0:X.state.global.nodes.find(H=>H.id===I);if(!B||!qd(B))throw new Error("There was an error adding folder");return B},[d,t]),y=Rt(async(F,Z)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(F,Tn.deleteNode({id:Z}))},[d,t]),g=Rt(async(F,Z,L)=>{if(!t)throw new Error("User is not allowed to rename documents");const I=await d(F,Tn.updateNode({id:Z,name:L})),X=I==null?void 0:I.state.global.nodes.find(B=>B.id===Z);if(!X)throw new Error("There was an error renaming node");return X},[d,t]),_=Rt(async(F,Z)=>{if(!t)throw new Error("User is not allowed to move documents");Z.kind===bp||F.parentFolder===Z.id||await d(Z.driveId,Tn.moveNode({srcFolder:F.id,targetParentFolder:Z.id}))},[d,t]),T=Rt(async(F,Z)=>{if(!s)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(Z.kind===bp)return;const L=a.find(ve=>ve.state.global.id===F.driveId);if(!L)return;const I=()=>Ce.hashKey(),B=ol.generateNodesCopy({srcId:F.id,targetParentFolder:Z.id,targetName:F.name},I,L.state.global.nodes).map(ve=>Tn.copyNode(ve)),H=await s.addDriveActions(F.driveId,B);H.operations.length?await c():H.status!=="SUCCESS"&&dn.error(`Error copying files: ${H.status}`,H.error)},[a,t,c,s]),w=Rt(async(F,Z,L)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!s)throw new Error("Reactor is not loaded");if(!a.find(B=>B.state.global.id===F))throw new Error(`Drive with id ${F} not found`);return(await s.addOperation(F,Z,L)).document},[a,e,s]),E=Rt(async F=>{if(!s)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const Z=F.global.id||Ce.hashKey();F=ol.createState(F);const L=await s.addDrive({global:{...F.global,id:Z},local:F.local});return await c(),L},[t,c,s]),R=Rt(async(F,Z)=>{if(!s)throw new Error("Reactor is not loaded");const L=await s.addRemoteDrive(F,Z);return await c(),L},[c,s]),j=Rt(async F=>{if(!t)throw new Error("User is not allowed to delete drives");if(!s)throw new Error("Reactor is not loaded");if(!a.find(L=>L.state.global.id===F))throw new Error(`Drive with id ${F} not found`);return await s.deleteDrive(F),c()},[a,t,c,s]),M=Rt(async(F,Z)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(F,Tn.setDriveName({name:Z}))},[d,t]),$=Rt(async(F,Z)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(F,Tn.setAvailableOffline({availableOffline:Z}))},[d,t]),ne=Rt(async(F,Z)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(F,Tn.setSharingType({type:Z}))},[d,t]),x=Rt(async(F,Z)=>{if(Z!==YO){if(!s)throw new Error("Reactor is not loaded");try{const L=s.getSyncStatus(F);return L instanceof sw?"INITIAL_SYNC":L}catch(L){return console.error(L),JO}}},[s]),G=Rt(F=>{if(!s)throw new Error("Reactor is not loaded");return s.on("strandUpdate",F)},[s]),S=Rt(F=>{if(!s)throw new Error("Reactor is not loaded");return s.on("syncStatus",F)},[s]),k=Rt(async()=>{s&&(await s.clearStorage(),await c())},[c,s]),C=Rt(async(F,Z)=>{const L=await d(F,Tn.removeTrigger({triggerId:Z}));if(L==null?void 0:L.state.local.triggers.find(X=>X.id===Z))throw new Error(`There was an error removing trigger ${Z}`)},[d]),U=Rt(async(F,Z,L)=>{if(!s)throw new Error("Reactor is not loaded");return await s.registerPullResponderTrigger(F,Z,L)},[s]),oe=Rt(async(F,Z)=>{const L=await d(F,Tn.addTrigger({trigger:Z}));if(!(L==null?void 0:L.state.local.triggers.find(X=>X.id===X.id)))throw new Error(`There was an error adding the trigger ${Z.id}`)},[d]);return is(()=>({documentDrives:a,documentDrivesStatus:l,addDocument:f,openFile:u,addFile:h,updateFile:m,addFolder:v,deleteNode:y,renameNode:g,moveNode:_,copyNode:T,addOperation:w,addOperations:p,addDrive:E,addRemoteDrive:R,deleteDrive:j,renameDrive:M,setDriveAvailableOffline:$,setDriveSharingType:ne,getSyncStatus:x,onStrandUpdate:G,onSyncStatus:S,clearStorage:k,removeTrigger:C,addTrigger:oe,registerNewPullResponderTrigger:U}),[f,E,h,v,w,p,R,oe,k,T,j,y,a,l,x,_,G,S,u,U,C,M,g,$,ne,m])}function H8(t){return t.replaceAll(/\s/g,"-")}const W8=t=>{const{open:e,onClose:n,selectedParentNode:r,setSelectedNode:i,documentModel:s}=t,{addDocument:o}=Ug();return Te(XO,{open:e,onContinue:async c=>{if(n(),!r)throw new Error("No drive or folder selected");const l=await o(r.driveId,c||`New ${s.documentModel.name}`,s.documentModel.id,r.id);l&&i({...l,slug:H8(l.name),kind:bp,documentType:l.documentType,parentFolder:r.id,driveId:r.driveId,syncStatus:r.syncStatus,synchronizationUnits:[],sharingType:r.sharingType})},onOpenChange:c=>{if(!c)return n()}})},q8=yn(vi);function Bg(){return Nr(q8)}let yu;const Z8=new Uint8Array(16);function G8(){if(!yu&&(yu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yu(Z8)}const Sn=[];for(let t=0;t<256;++t)Sn.push((t+256).toString(16).slice(1));function Y8(t,e=0){return Sn[t[e+0]]+Sn[t[e+1]]+Sn[t[e+2]]+Sn[t[e+3]]+"-"+Sn[t[e+4]]+Sn[t[e+5]]+"-"+Sn[t[e+6]]+Sn[t[e+7]]+"-"+Sn[t[e+8]]+Sn[t[e+9]]+"-"+Sn[t[e+10]]+Sn[t[e+11]]+Sn[t[e+12]]+Sn[t[e+13]]+Sn[t[e+14]]+Sn[t[e+15]]}const J8=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),d_={randomUUID:J8};function f_(t,e,n){if(d_.randomUUID&&!e&&!t)return d_.randomUUID();t=t||{};const r=t.random||(t.rng||G8)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Y8(r)}const X8=t=>{var ne;const[e]=Bg(),{open:n,onClose:r}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[s,o]=xn(e.appVersion),[a,c]=xn({label:Hl.debug?"Enabled":"Disabled",value:Hl.debug}),[l,u]=xn(),[d,f]=xn(null),[p,h]=xn(""),[m,v]=xn({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:y,removeTrigger:g,addTrigger:_,registerNewPullResponderTrigger:T}=Ug();Pn(()=>{Hl.setDebug(a.value)},[a]),console.log("documentDrives",y),console.log("selectedDrive",l);const w=((ne=y.find(x=>x.state.global.id===l))==null?void 0:ne.state.local.triggers)||[],R=!l||p==="",j=async()=>{!d||!l||(await g(l,d.value),f(null))},M=async(x=!1)=>{if(!(!p||p===""||!l)){if(!x){const G=await T(l,p,{pullInterval:3e3});await _(l,G),h("");return}await _(l,{id:`invalid-trigger-${f_()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${f_()}`,url:p}}),h("")}},$=x=>{v(x),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",x.value)};return Te(KO,{open:n,onOpenChange:x=>{if(!x)return r()},contentProps:{className:"rounded-2xl"},children:Ft("div",{className:"w-[700px] rounded-2xl p-6",children:[Ft("div",{className:"mb-6 flex justify-between",children:[Te("div",{className:"text-xl font-bold",children:"Debug Tools"}),Te("button",{id:"close-modal",onClick:()=>r(),children:Te(Vl,{name:"Xmark",size:28})})]}),Ft("div",{className:"flex text-sm font-bold",children:[Te(Vl,{name:"Ring",size:22}),Ft("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Ft("div",{className:"mt-4 flex text-sm font-bold",children:[Te(Vl,{name:"Hdd",size:22}),Te("span",{className:"ml-2",children:"Drive Tools:"})]}),Ft("div",{children:[Te("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),Te(Za,{id:"selectedDrive",onChange:x=>{if(!x||typeof x!="object"||!("value"in x)){u(void 0),f(null);return}u(x.value),f(null)},options:y.map(x=>({label:x.state.global.name,value:x.state.global.id}))})]}),Te("div",{className:"mt-2 flex items-end justify-between pl-4",children:Ft("div",{className:"w-[400px]",children:[Te("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),Te(Za,{id:"autoRegisterPullResponder",onChange:x=>{$(x)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Ft("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Ft("div",{className:"w-[400px]",children:[Te("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),Te(Za,{id:"driveTrigger",onChange:x=>{f(x)},value:d,options:w.map(x=>({label:`${x.id} - ${x.type}`,value:x.id}))})]}),Te("div",{children:Te(Mo,{onClick:j,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Ft("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Ft("div",{className:"w-[400px]",children:[Te("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),Te(Yg,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:Te("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:p,onChange:x=>h(x.target.value)})]}),Ft("div",{className:"mb-1 flex items-center justify-center",children:[Te(Mo,{className:"mr-2",color:R?"light":"blue",size:"small",disabled:R,onClick:()=>M(),children:"Add Trigger"}),Te(Mo,{color:R?"light":"red",size:"small",disabled:R,onClick:()=>M(!0),children:"Add Invalid Trigger"})]})]}),Ft("div",{className:"mt-4 flex text-sm font-bold",children:[Te(Vl,{name:"Gear",size:22}),Te("span",{className:"ml-2",children:"Service Worker Tools:"})]}),Te("div",{className:"mt-2 flex items-end justify-between pl-4",children:Ft("div",{className:"w-[400px]",children:[Te("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),Te(Za,{id:"serviceWorkerDebugMode",onChange:x=>{c(x)},value:a,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Ft("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Ft("div",{className:"w-[400px]",children:[Te("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),Te(Yg,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:Te("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:s,onChange:x=>o(x.target.value)})]}),Te("div",{className:"mb-1 flex items-center justify-center",children:Te(Mo,{color:s===""?"light":"red",size:"small",disabled:s==="",onClick:()=>{Hl.sendMessage({type:"SET_APP_VERSION",version:s}),o("")},children:"Add Invalid App Version"})})]})]})})},K8=t=>{const{open:e,onClose:n,uiDriveNode:r,onDelete:i}=t,{t:s}=so();return Te(QO,{open:e,driveName:r.name,onCancel:n,header:s("modals.deleteDrive.title",{label:r.name}),body:s("modals.deleteDrive.body"),inputPlaceholder:s("modals.deleteDrive.inputPlaceholder"),cancelLabel:s("common.cancel"),continueLabel:s("common.delete"),onContinue:()=>i(n),onOpenChange:o=>{if(!o)return n()}})},Q8=t=>{const{t:e}=so(),{uiNode:n,open:r,onClose:i,onDelete:s}=t,{kind:o,name:a}=n;return Te(e1,{open:r,onDelete:()=>s(i),onCancel:()=>i(),header:e(`modals.deleteItem.${o.toLowerCase()}.header`,{item:a}),body:e(`modals.deleteItem.${o.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},ez=t=>{const{open:e,onClose:n}=t,{t:r}=so();return Te(M_,{open:e,header:r("modals.disclaimer.title"),body:r("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>n()})};function tz(t){const{uiDriveNode:e,open:n,onRenameDrive:r,onDeleteDrive:i,onChangeAvailableOffline:s,onChangeSharingType:o,onClose:a}=t;return Te(t1,{uiDriveNode:e,open:n,onRenameDrive:r,onDeleteDrive:i,onChangeAvailableOffline:s,onChangeSharingType:o,onOpenChange:c=>{if(!c)return a()}})}const nz="defaultDocumentModelEditor",rz=bl(nz,{label:"V2",value:"document-model-editor-v2"}),iz=()=>Nr(rz),sz=t=>Fe.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},Fe.createElement("g",{id:"Group 1000003373"},Fe.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),Fe.createElement("g",{id:"Renown"},Fe.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),Fe.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),Fe.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),Fe.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),Fe.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),Fe.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),oz=()=>{const[t,e]=xn(0);return Pn(()=>{const n=setInterval(()=>{e(r=>r===3?0:r+1)},200);return()=>{clearInterval(n)}},[]),Te("span",{children:new Array(t).fill(".").join("")})},az=()=>{const t=Df(),{openRenown:e,status:n}=jg();return Te("div",{children:n==="checking"?Ft("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[Te("span",{children:"Checking Authorization"}),Te("span",{className:"inline-block w-5 text-left",children:Te(oz,{})})]}):n!=="authorized"?Ft("div",{className:"flex flex-col items-center",children:[Te("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),Te(sz,{className:"mb-3"}),Te("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),Te(Mo,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:Te("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Ft("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},p_=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),cz=t=>{const{open:e,onClose:n,onRefresh:r}=t,{clearStorage:i}=Ug(),{t:s}=so(),o=m8(),a=l8(),{setConfig:c}=mO(),{showModal:l}=TO(),[u]=Bg(),[d,f]=iz(),[p,h]=xn(p_(o)),{logout:m,status:v}=jg(),y=Df(),g=()=>{c(T=>({...T,editors:{enabledEditors:p.map(w=>w.value)}})),n()},_=()=>{l("confirmationModal",{title:s("modals.connectSettings.clearStorage.confirmation.title"),body:s("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:s("common.cancel"),continueLabel:s("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{r()}).catch(dn.error)},onCancel:()=>l("settingsModal",{onRefresh:r})})};return Ft(n1,{open:e,title:s("modals.connectSettings.title"),body:s("modals.connectSettings.body"),cancelLabel:s("common.cancel"),saveLabel:s("common.save"),onSave:g,onOpenChange:T=>{if(!T)return n()},children:[Te("div",{className:"rounded border border-gray-400 p-4",children:v==="authorized"?Ft(C_,{children:[Ft("p",{children:["Logged in with address:"," ",Te("span",{className:"text-sm font-semibold",children:y==null?void 0:y.address})]}),Te(Mo,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):Te(az,{})}),u.content.showDocumentModelSelectionSetting&&Te(r1,{selected:p,onChange:T=>h(T),options:p_(a),title:s("modals.connectSettings.enabledDocumentTypes.title"),description:s("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:s("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),Te(i1,{onClearStorage:_,buttonLabel:s("modals.connectSettings.clearStorage.button"),description:s("modals.connectSettings.clearStorage.description")}),Ft("div",{children:[Te("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),Te(Za,{id:"default-document-model-editor",value:d,onChange:T=>f(T),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),Te(s1,{packageJson:g1})]})},lz=t=>{const{open:e,onClose:n,driveId:r}=t,{t:i}=so();return Te(o1,{open:e,onContinue:()=>{console.log("Upgrade drive: ",r),n()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:o=>{if(!o)return n()}})},uz={deleteItem:Q8,upgradeDrive:lz,createDocument:W8,addLocalDrive:aD,addRemoteDrive:Vk,driveSettings:tz,settingsModal:cz,confirmationModal:Hk,deleteDriveModal:K8,debugSettingsModal:X8,disclaimerModal:ez,cookiesPolicy:Wk},wO=wi.createContext({showModal:()=>{},closeModal:()=>{}}),TO=()=>yl(wO),dz=t=>{const{children:e}=t,[n,r]=xn(),[i,s]=xn(),[o,a]=xn(!1),c=Rt((f,p)=>{a(!0),r(p),s(f)},[]),l=Rt(()=>{a(!1)},[]),u=i?uz[i]:null,d=is(()=>({showModal:c,closeModal:l}),[l,c]);return Ft(wO.Provider,{value:d,children:[e,u&&Te(u,{...n,open:o,onClose:l})]})},fz=(t,e)=>t.some(n=>n.id===e&&n.value),pz=()=>{const{t}=so(),{showModal:e}=TO(),[n,r]=oD(),[,i]=jh(),s=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],o=c=>{r(!1),fz(c,"analytics-cookie")&&i(l=>({...l,analytics:!0}))},a=()=>{r(!1),i({analytics:!1,functional:!1,marketing:!1})};return n?Ft("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[Te("div",{className:"absolute inset-0 bg-black opacity-15"}),Te("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:Te(a1,{className:"max-w-[1024px] ",cookies:s,onSubmit:o,onReject:a,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:Te("p",{className:"font-semibold text-gray-500",children:Te(U_,{i18nKey:"cookieBanner.message",components:{a:Te("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var hz=Object.defineProperty,mz=Object.getOwnPropertyDescriptor,ii=(t,e,n,r)=>{for(var i=mz(e,n),s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=o(e,n,i)||i);return i&&hz(e,n,i),i};function si(t,e,n){const r=n.value;n.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return r.apply(this,i)}}function gz(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);i&&typeof i.value=="function"&&r!=="constructor"&&(t[r]=t[r].bind(t))})}class Fr{constructor(e){qe(this,"server");gz(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,n){return this.server.migrateReadDrive(e,n)}addReadDrive(e,n){return this.server.addReadDrive(e,n)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,n,r){return this.server.fetchDocument(e,n,r)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}ii([si],Fr.prototype,"migrateReadDrive");ii([si],Fr.prototype,"addReadDrive");ii([si],Fr.prototype,"getReadDrives");ii([si],Fr.prototype,"getReadDriveBySlug");ii([si],Fr.prototype,"getReadDrive");ii([si],Fr.prototype,"getReadDriveContext");ii([si],Fr.prototype,"fetchDrive");ii([si],Fr.prototype,"fetchDocument");ii([si],Fr.prototype,"deleteReadDrive");ii([si],Fr.prototype,"onReadDrivesUpdate");const Co=new Fr,IO=Ph({...Co,readDrives:[]});async function yz(t){const e=await t.getReadDrives();return(await Promise.all(e.map(r=>t.getReadDrive(r)))).filter(r=>!(r instanceof Rs))}const vz=t=>{const e=S8(),[n,r]=xn([]),i=SO(),[s,o]=xn(!1);Pn(()=>{e.then(l=>{Co.setDocumentDrive(l),o(!0)}).catch(dn.error)},[e]);const a=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);is(()=>{if(!s||a===void 0)return;const l=a?"READ":"WRITE",u=Co.getServer();u&&typeof u.setAllDefaultDrivesAccessLevel=="function"&&u.setAllDefaultDrivesAccessLevel(l).catch(dn.error)},[a,s]),Pn(()=>{if(!s)return;yz(Co).then(u=>r(u)).catch(dn.error);const l=Co.onReadDrivesUpdate(u=>{r(d=>d.length!==u.length||Cd(d)!==Cd(u)?u:d)}).catch(dn.error);return()=>{l.then(u=>u==null?void 0:u()).catch(dn.error)}},[s]);const c=is(()=>({...Co,readDrives:n}),[n]);return Te(IO.Provider,{...t,value:c})},AH=()=>yl(IO);/**
|
|
823
|
-
* @remix-run/router v1.21.1
|
|
824
|
-
*
|
|
825
|
-
* Copyright (c) Remix Software Inc.
|
|
826
|
-
*
|
|
827
|
-
* This source code is licensed under the MIT license found in the
|
|
828
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
829
|
-
*
|
|
830
|
-
* @license MIT
|
|
831
|
-
*/function Zt(){return Zt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Zt.apply(this,arguments)}var qt;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(qt||(qt={}));const h_="popstate";function _z(t){t===void 0&&(t={});let{initialEntries:e=["/"],initialIndex:n,v5Compat:r=!1}=t,i;i=e.map((p,h)=>u(p,typeof p=="string"?null:p.state,h===0?"default":void 0));let s=c(n??i.length-1),o=qt.Pop,a=null;function c(p){return Math.min(Math.max(p,0),i.length-1)}function l(){return i[s]}function u(p,h,m){h===void 0&&(h=null);let v=ya(i?l().pathname:"/",p,h,m);return ro(v.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(p)),v}function d(p){return typeof p=="string"?p:Aa(p)}return{get index(){return s},get action(){return o},get location(){return l()},createHref:d,createURL(p){return new URL(d(p),"http://localhost")},encodeLocation(p){let h=typeof p=="string"?Mi(p):p;return{pathname:h.pathname||"",search:h.search||"",hash:h.hash||""}},push(p,h){o=qt.Push;let m=u(p,h);s+=1,i.splice(s,i.length,m),r&&a&&a({action:o,location:m,delta:1})},replace(p,h){o=qt.Replace;let m=u(p,h);i[s]=m,r&&a&&a({action:o,location:m,delta:0})},go(p){o=qt.Pop;let h=c(s+p),m=i[h];s=h,a&&a({action:o,location:m,delta:p})},listen(p){return a=p,()=>{a=null}}}}function CH(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return ya("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Aa(i)}return Ez(e,n,null,t)}function yt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ro(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function bz(){return Math.random().toString(36).substr(2,8)}function m_(t,e){return{usr:t.state,key:t.key,idx:e}}function ya(t,e,n,r){return n===void 0&&(n=null),Zt({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Mi(e):e,{state:n,key:e&&e.key||r||bz()})}function Aa(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Mi(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Ez(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=qt.Pop,c=null,l=u();l==null&&(l=0,o.replaceState(Zt({},o.state,{idx:l}),""));function u(){return(o.state||{idx:null}).idx}function d(){a=qt.Pop;let v=u(),y=v==null?null:v-l;l=v,c&&c({action:a,location:m.location,delta:y})}function f(v,y){a=qt.Push;let g=ya(m.location,v,y);l=u()+1;let _=m_(g,l),T=m.createHref(g);try{o.pushState(_,"",T)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;i.location.assign(T)}s&&c&&c({action:a,location:m.location,delta:1})}function p(v,y){a=qt.Replace;let g=ya(m.location,v,y);l=u();let _=m_(g,l),T=m.createHref(g);o.replaceState(_,"",T),s&&c&&c({action:a,location:m.location,delta:0})}function h(v){let y=i.location.origin!=="null"?i.location.origin:i.location.href,g=typeof v=="string"?v:Aa(v);return g=g.replace(/ $/,"%20"),yt(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let m={get action(){return a},get location(){return t(i,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(h_,d),c=v,()=>{i.removeEventListener(h_,d),c=null}},createHref(v){return e(i,v)},createURL:h,encodeLocation(v){let y=h(v);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(v){return o.go(v)}};return m}var $t;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})($t||($t={}));const Sz=new Set(["lazy","caseSensitive","path","id","index","children"]);function wz(t){return t.index===!0}function Md(t,e,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),t.map((i,s)=>{let o=[...n,String(s)],a=typeof i.id=="string"?i.id:o.join("-");if(yt(i.index!==!0||!i.children,"Cannot specify children on an index route"),yt(!r[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),wz(i)){let c=Zt({},i,e(i),{id:a});return r[a]=c,c}else{let c=Zt({},i,e(i),{id:a,children:void 0});return r[a]=c,i.children&&(c.children=Md(i.children,e,o,r)),c}})}function Ki(t,e,n){return n===void 0&&(n="/"),Lu(t,e,n,!1)}function Lu(t,e,n,r){let i=typeof e=="string"?Mi(e):e,s=Bl(i.pathname||"/",n);if(s==null)return null;let o=xO(t);Iz(o);let a=null;for(let c=0;a==null&&c<o.length;++c){let l=Pz(s);a=Mz(o[c],l,r)}return a}function Tz(t,e){let{route:n,pathname:r,params:i}=t;return{id:n.id,pathname:r,params:i,data:e[n.id],handle:n.handle}}function xO(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let c={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(yt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let l=rs([r,c.relativePath]),u=n.concat(c);s.children&&s.children.length>0&&(yt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),xO(s.children,e,u,l)),!(s.path==null&&!s.index)&&e.push({path:l,score:Az(l,s.index),routesMeta:u})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let c of OO(s.path))i(s,o,c)}),e}function OO(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=OO(r.join("/")),a=[];return a.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&a.push(...o),a.map(c=>t.startsWith("/")&&c===""?"/":c)}function Iz(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Cz(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const xz=/^:[\w-]+$/,Oz=3,Dz=2,Rz=1,kz=10,Nz=-2,g_=t=>t==="*";function Az(t,e){let n=t.split("/"),r=n.length;return n.some(g_)&&(r+=Nz),e&&(r+=Dz),n.filter(i=>!g_(i)).reduce((i,s)=>i+(xz.test(s)?Oz:s===""?Rz:kz),r)}function Cz(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function Mz(t,e,n){n===void 0&&(n=!1);let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let c=r[a],l=a===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=y_({path:c.relativePath,caseSensitive:c.caseSensitive,end:l},u),f=c.route;if(!d&&l&&n&&!r[r.length-1].route.index&&(d=y_({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:rs([s,d.pathname]),pathnameBase:jz(rs([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=rs([s,d.pathnameBase]))}return o}function y_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=Lz(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((l,u,d)=>{let{paramName:f,isOptional:p}=u;if(f==="*"){let m=a[d]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const h=a[d];return p&&!h?l[f]=void 0:l[f]=(h||"").replace(/%2F/g,"/"),l},{}),pathname:s,pathnameBase:o,pattern:t}}function Lz(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),ro(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,c)=>(r.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function Pz(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ro(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Bl(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function Fz(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Mi(t):t;return{pathname:n?n.startsWith("/")?n:$z(n,e):e,search:Uz(r),hash:Bz(i)}}function $z(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function yp(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function DO(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function RO(t,e){let n=DO(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function kO(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Mi(t):(i=Zt({},t),yt(!i.pathname||!i.pathname.includes("?"),yp("?","pathname","search",i)),yt(!i.pathname||!i.pathname.includes("#"),yp("#","pathname","hash",i)),yt(!i.search||!i.search.includes("#"),yp("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}a=d>=0?e[d]:"/"}let c=Fz(i,a),l=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(l||u)&&(c.pathname+="/"),c}const rs=t=>t.join("/").replace(/\/\/+/g,"/"),jz=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Uz=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Bz=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class Nh{constructor(e,n,r,i){i===void 0&&(i=!1),this.status=e,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Rf(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const NO=["post","put","patch","delete"],zz=new Set(NO),Vz=["get",...NO],Hz=new Set(Vz),Wz=new Set([301,302,303,307,308]),qz=new Set([307,308]),vp={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zz={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Wa={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},zg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gz=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),AO="remix-router-transitions";function Yz(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",r=!n;yt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let W=t.detectErrorBoundary;i=Q=>({hasErrorBoundary:W(Q)})}else i=Gz;let s={},o=Md(t.routes,i,void 0,s),a,c=t.basename||"/",l=t.dataStrategy||Qz,u=t.patchRoutesOnNavigation,d=Zt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,p=new Set,h=null,m=null,v=null,y=t.hydrationData!=null,g=Ki(o,t.history.location,c),_=null;if(g==null&&!u){let W=Bn(404,{pathname:t.history.location.pathname}),{matches:Q,route:re}=D_(o);g=Q,_={[re.id]:W}}g&&!t.hydrationData&&go(g,o,t.history.location.pathname).active&&(g=null);let T;if(g)if(g.some(W=>W.route.lazy))T=!1;else if(!g.some(W=>W.route.loader))T=!0;else if(d.v7_partialHydration){let W=t.hydrationData?t.hydrationData.loaderData:null,Q=t.hydrationData?t.hydrationData.errors:null;if(Q){let re=g.findIndex(pe=>Q[pe.route.id]!==void 0);T=g.slice(0,re+1).every(pe=>!Ch(pe.route,W,Q))}else T=g.every(re=>!Ch(re.route,W,Q))}else T=t.hydrationData!=null;else if(T=!1,g=[],d.v7_partialHydration){let W=go(null,o,t.history.location.pathname);W.active&&W.matches&&(g=W.matches)}let w,E={historyAction:t.history.action,location:t.history.location,matches:g,initialized:T,navigation:vp,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||_,fetchers:new Map,blockers:new Map},R=qt.Pop,j=!1,M,$=!1,ne=new Map,x=null,G=!1,S=!1,k=[],C=new Set,U=new Map,oe=0,F=-1,Z=new Map,L=new Set,I=new Map,X=new Map,B=new Set,H=new Map,ve=new Map,he;function Ee(){if(f=t.history.listen(W=>{let{action:Q,location:re,delta:pe}=W;if(he){he(),he=void 0;return}ro(ve.size===0||pe!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Re=mo({currentLocation:E.location,nextLocation:re,historyAction:Q});if(Re&&pe!=null){let Ve=new Promise(nt=>{he=nt});t.history.go(pe*-1),ai(Re,{state:"blocked",location:re,proceed(){ai(Re,{state:"proceeding",proceed:void 0,reset:void 0,location:re}),Ve.then(()=>t.history.go(pe))},reset(){let nt=new Map(E.blockers);nt.set(Re,Wa),We({blockers:nt})}});return}return ae(Q,re)}),n){pV(e,ne);let W=()=>hV(e,ne);e.addEventListener("pagehide",W),x=()=>e.removeEventListener("pagehide",W)}return E.initialized||ae(qt.Pop,E.location,{initialHydration:!0}),w}function ze(){f&&f(),x&&x(),p.clear(),M&&M.abort(),E.fetchers.forEach((W,Q)=>qn(Q)),E.blockers.forEach((W,Q)=>oi(Q))}function rt(W){return p.add(W),()=>p.delete(W)}function We(W,Q){Q===void 0&&(Q={}),E=Zt({},E,W);let re=[],pe=[];d.v7_fetcherPersist&&E.fetchers.forEach((Re,Ve)=>{Re.state==="idle"&&(B.has(Ve)?pe.push(Ve):re.push(Ve))}),B.forEach(Re=>{!E.fetchers.has(Re)&&!U.has(Re)&&pe.push(Re)}),[...p].forEach(Re=>Re(E,{deletedFetchers:pe,viewTransitionOpts:Q.viewTransitionOpts,flushSync:Q.flushSync===!0})),d.v7_fetcherPersist?(re.forEach(Re=>E.fetchers.delete(Re)),pe.forEach(Re=>qn(Re))):pe.forEach(Re=>B.delete(Re))}function it(W,Q,re){var pe,Re;let{flushSync:Ve}=re===void 0?{}:re,nt=E.actionData!=null&&E.navigation.formMethod!=null&&br(E.navigation.formMethod)&&E.navigation.state==="loading"&&((pe=W.state)==null?void 0:pe._isRedirect)!==!0,Me;Q.actionData?Object.keys(Q.actionData).length>0?Me=Q.actionData:Me=null:nt?Me=E.actionData:Me=null;let Le=Q.loaderData?x_(E.loaderData,Q.loaderData,Q.matches||[],Q.errors):E.loaderData,Ae=E.blockers;Ae.size>0&&(Ae=new Map(Ae),Ae.forEach((St,cn)=>Ae.set(cn,Wa)));let He=j===!0||E.navigation.formMethod!=null&&br(E.navigation.formMethod)&&((Re=W.state)==null?void 0:Re._isRedirect)!==!0;a&&(o=a,a=void 0),G||R===qt.Pop||(R===qt.Push?t.history.push(W,W.state):R===qt.Replace&&t.history.replace(W,W.state));let mt;if(R===qt.Pop){let St=ne.get(E.location.pathname);St&&St.has(W.pathname)?mt={currentLocation:E.location,nextLocation:W}:ne.has(W.pathname)&&(mt={currentLocation:W,nextLocation:E.location})}else if($){let St=ne.get(E.location.pathname);St?St.add(W.pathname):(St=new Set([W.pathname]),ne.set(E.location.pathname,St)),mt={currentLocation:E.location,nextLocation:W}}We(Zt({},Q,{actionData:Me,loaderData:Le,historyAction:R,location:W,initialized:!0,navigation:vp,revalidation:"idle",restoreScrollPosition:zl(W,Q.matches||E.matches),preventScrollReset:He,blockers:Ae}),{viewTransitionOpts:mt,flushSync:Ve===!0}),R=qt.Pop,j=!1,$=!1,G=!1,S=!1,k=[]}async function At(W,Q){if(typeof W=="number"){t.history.go(W);return}let re=Ah(E.location,E.matches,c,d.v7_prependBasename,W,d.v7_relativeSplatPath,Q==null?void 0:Q.fromRouteId,Q==null?void 0:Q.relative),{path:pe,submission:Re,error:Ve}=v_(d.v7_normalizeFormMethod,!1,re,Q),nt=E.location,Me=ya(E.location,pe,Q&&Q.state);Me=Zt({},Me,t.history.encodeLocation(Me));let Le=Q&&Q.replace!=null?Q.replace:void 0,Ae=qt.Push;Le===!0?Ae=qt.Replace:Le===!1||Re!=null&&br(Re.formMethod)&&Re.formAction===E.location.pathname+E.location.search&&(Ae=qt.Replace);let He=Q&&"preventScrollReset"in Q?Q.preventScrollReset===!0:void 0,mt=(Q&&Q.flushSync)===!0,St=mo({currentLocation:nt,nextLocation:Me,historyAction:Ae});if(St){ai(St,{state:"blocked",location:Me,proceed(){ai(St,{state:"proceeding",proceed:void 0,reset:void 0,location:Me}),At(W,Q)},reset(){let cn=new Map(E.blockers);cn.set(St,Wa),We({blockers:cn})}});return}return await ae(Ae,Me,{submission:Re,pendingError:Ve,preventScrollReset:He,replace:Q&&Q.replace,enableViewTransition:Q&&Q.viewTransition,flushSync:mt})}function b(){if(Be(),We({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){ae(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}ae(R||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:$===!0})}}async function ae(W,Q,re){M&&M.abort(),M=null,R=W,G=(re&&re.startUninterruptedRevalidation)===!0,Cf(E.location,E.matches),j=(re&&re.preventScrollReset)===!0,$=(re&&re.enableViewTransition)===!0;let pe=a||o,Re=re&&re.overrideNavigation,Ve=Ki(pe,Q,c),nt=(re&&re.flushSync)===!0,Me=go(Ve,pe,Q.pathname);if(Me.active&&Me.matches&&(Ve=Me.matches),!Ve){let{error:Pt,notFoundMatches:Ot,route:Ht}=jn(Q.pathname);it(Q,{matches:Ot,loaderData:{},errors:{[Ht.id]:Pt}},{flushSync:nt});return}if(E.initialized&&!S&&sV(E.location,Q)&&!(re&&re.submission&&br(re.submission.formMethod))){it(Q,{matches:Ve},{flushSync:nt});return}M=new AbortController;let Le=Io(t.history,Q,M.signal,re&&re.submission),Ae;if(re&&re.pendingError)Ae=[ks(Ve).route.id,{type:$t.error,error:re.pendingError}];else if(re&&re.submission&&br(re.submission.formMethod)){let Pt=await ie(Le,Q,re.submission,Ve,Me.active,{replace:re.replace,flushSync:nt});if(Pt.shortCircuited)return;if(Pt.pendingActionResult){let[Ot,Ht]=Pt.pendingActionResult;if(Yn(Ht)&&Rf(Ht.error)&&Ht.error.status===404){M=null,it(Q,{matches:Pt.matches,loaderData:{},errors:{[Ot]:Ht.error}});return}}Ve=Pt.matches||Ve,Ae=Pt.pendingActionResult,Re=_p(Q,re.submission),nt=!1,Me.active=!1,Le=Io(t.history,Le.url,Le.signal)}let{shortCircuited:He,matches:mt,loaderData:St,errors:cn}=await P(Le,Q,Ve,Me.active,Re,re&&re.submission,re&&re.fetcherSubmission,re&&re.replace,re&&re.initialHydration===!0,nt,Ae);He||(M=null,it(Q,Zt({matches:mt||Ve},O_(Ae),{loaderData:St,errors:cn})))}async function ie(W,Q,re,pe,Re,Ve){Ve===void 0&&(Ve={}),Be();let nt=dV(Q,re);if(We({navigation:nt},{flushSync:Ve.flushSync===!0}),Re){let Ae=await yo(pe,Q.pathname,W.signal);if(Ae.type==="aborted")return{shortCircuited:!0};if(Ae.type==="error"){let He=ks(Ae.partialMatches).route.id;return{matches:Ae.partialMatches,pendingActionResult:[He,{type:$t.error,error:Ae.error}]}}else if(Ae.matches)pe=Ae.matches;else{let{notFoundMatches:He,error:mt,route:St}=jn(Q.pathname);return{matches:He,pendingActionResult:[St.id,{type:$t.error,error:mt}]}}}let Me,Le=cc(pe,Q);if(!Le.route.action&&!Le.route.lazy)Me={type:$t.error,error:Bn(405,{method:W.method,pathname:Q.pathname,routeId:Le.route.id})};else if(Me=(await Ie("action",E,W,[Le],pe,null))[Le.route.id],W.signal.aborted)return{shortCircuited:!0};if(Ps(Me)){let Ae;return Ve&&Ve.replace!=null?Ae=Ve.replace:Ae=w_(Me.response.headers.get("Location"),new URL(W.url),c)===E.location.pathname+E.location.search,await ce(W,Me,!0,{submission:re,replace:Ae}),{shortCircuited:!0}}if(es(Me))throw Bn(400,{type:"defer-action"});if(Yn(Me)){let Ae=ks(pe,Le.route.id);return(Ve&&Ve.replace)!==!0&&(R=qt.Push),{matches:pe,pendingActionResult:[Ae.route.id,Me]}}return{matches:pe,pendingActionResult:[Le.route.id,Me]}}async function P(W,Q,re,pe,Re,Ve,nt,Me,Le,Ae,He){let mt=Re||_p(Q,Ve),St=Ve||nt||k_(mt),cn=!G&&(!d.v7_partialHydration||!Le);if(pe){if(cn){let Wt=A(He);We(Zt({navigation:mt},Wt!==void 0?{actionData:Wt}:{}),{flushSync:Ae})}let vt=await yo(re,Q.pathname,W.signal);if(vt.type==="aborted")return{shortCircuited:!0};if(vt.type==="error"){let Wt=ks(vt.partialMatches).route.id;return{matches:vt.partialMatches,loaderData:{},errors:{[Wt]:vt.error}}}else if(vt.matches)re=vt.matches;else{let{error:Wt,notFoundMatches:ji,route:di}=jn(Q.pathname);return{matches:ji,loaderData:{},errors:{[di.id]:Wt}}}}let Pt=a||o,[Ot,Ht]=b_(t.history,E,re,St,Q,d.v7_partialHydration&&Le===!0,d.v7_skipActionErrorRevalidation,S,k,C,B,I,L,Pt,c,He);if(Pi(vt=>!(re&&re.some(Wt=>Wt.route.id===vt))||Ot&&Ot.some(Wt=>Wt.route.id===vt)),F=++oe,Ot.length===0&&Ht.length===0){let vt=pr();return it(Q,Zt({matches:re,loaderData:{},errors:He&&Yn(He[1])?{[He[0]]:He[1].error}:null},O_(He),vt?{fetchers:new Map(E.fetchers)}:{}),{flushSync:Ae}),{shortCircuited:!0}}if(cn){let vt={};if(!pe){vt.navigation=mt;let Wt=A(He);Wt!==void 0&&(vt.actionData=Wt)}Ht.length>0&&(vt.fetchers=V(Ht)),We(vt,{flushSync:Ae})}Ht.forEach(vt=>{bn(vt.key),vt.controller&&U.set(vt.key,vt.controller)});let Fi=()=>Ht.forEach(vt=>bn(vt.key));M&&M.signal.addEventListener("abort",Fi);let{loaderResults:Es,fetcherResults:hr}=await be(E,re,Ot,Ht,W);if(W.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Fi),Ht.forEach(vt=>U.delete(vt.key));let Gn=vu(Es);if(Gn)return await ce(W,Gn.result,!0,{replace:Me}),{shortCircuited:!0};if(Gn=vu(hr),Gn)return L.add(Gn.key),await ce(W,Gn.result,!0,{replace:Me}),{shortCircuited:!0};let{loaderData:li,errors:$i}=I_(E,re,Es,He,Ht,hr,H);H.forEach((vt,Wt)=>{vt.subscribe(ji=>{(ji||vt.done)&&H.delete(Wt)})}),d.v7_partialHydration&&Le&&E.errors&&($i=Zt({},E.errors,$i));let Un=pr(),vo=Li(F),ui=Un||vo||Ht.length>0;return Zt({matches:re,loaderData:li,errors:$i},ui?{fetchers:new Map(E.fetchers)}:{})}function A(W){if(W&&!Yn(W[1]))return{[W[0]]:W[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function V(W){return W.forEach(Q=>{let re=E.fetchers.get(Q.key),pe=qa(void 0,re?re.data:void 0);E.fetchers.set(Q.key,pe)}),new Map(E.fetchers)}function ue(W,Q,re,pe){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");bn(W);let Re=(pe&&pe.flushSync)===!0,Ve=a||o,nt=Ah(E.location,E.matches,c,d.v7_prependBasename,re,d.v7_relativeSplatPath,Q,pe==null?void 0:pe.relative),Me=Ki(Ve,nt,c),Le=go(Me,Ve,nt);if(Le.active&&Le.matches&&(Me=Le.matches),!Me){et(W,Q,Bn(404,{pathname:nt}),{flushSync:Re});return}let{path:Ae,submission:He,error:mt}=v_(d.v7_normalizeFormMethod,!0,nt,pe);if(mt){et(W,Q,mt,{flushSync:Re});return}let St=cc(Me,Ae),cn=(pe&&pe.preventScrollReset)===!0;if(He&&br(He.formMethod)){se(W,Q,Ae,St,Me,Le.active,Re,cn,He);return}I.set(W,{routeId:Q,path:Ae}),K(W,Q,Ae,St,Me,Le.active,Re,cn,He)}async function se(W,Q,re,pe,Re,Ve,nt,Me,Le){Be(),I.delete(W);function Ae(Xt){if(!Xt.route.action&&!Xt.route.lazy){let Ui=Bn(405,{method:Le.formMethod,pathname:re,routeId:Q});return et(W,Q,Ui,{flushSync:nt}),!0}return!1}if(!Ve&&Ae(pe))return;let He=E.fetchers.get(W);ht(W,fV(Le,He),{flushSync:nt});let mt=new AbortController,St=Io(t.history,re,mt.signal,Le);if(Ve){let Xt=await yo(Re,re,St.signal);if(Xt.type==="aborted")return;if(Xt.type==="error"){et(W,Q,Xt.error,{flushSync:nt});return}else if(Xt.matches){if(Re=Xt.matches,pe=cc(Re,re),Ae(pe))return}else{et(W,Q,Bn(404,{pathname:re}),{flushSync:nt});return}}U.set(W,mt);let cn=oe,Ot=(await Ie("action",E,St,[pe],Re,W))[pe.route.id];if(St.signal.aborted){U.get(W)===mt&&U.delete(W);return}if(d.v7_fetcherPersist&&B.has(W)){if(Ps(Ot)||Yn(Ot)){ht(W,Wi(void 0));return}}else{if(Ps(Ot))if(U.delete(W),F>cn){ht(W,Wi(void 0));return}else return L.add(W),ht(W,qa(Le)),ce(St,Ot,!1,{fetcherSubmission:Le,preventScrollReset:Me});if(Yn(Ot)){et(W,Q,Ot.error);return}}if(es(Ot))throw Bn(400,{type:"defer-action"});let Ht=E.navigation.location||E.location,Fi=Io(t.history,Ht,mt.signal),Es=a||o,hr=E.navigation.state!=="idle"?Ki(Es,E.navigation.location,c):E.matches;yt(hr,"Didn't find any matches after fetcher action");let Gn=++oe;Z.set(W,Gn);let li=qa(Le,Ot.data);E.fetchers.set(W,li);let[$i,Un]=b_(t.history,E,hr,Le,Ht,!1,d.v7_skipActionErrorRevalidation,S,k,C,B,I,L,Es,c,[pe.route.id,Ot]);Un.filter(Xt=>Xt.key!==W).forEach(Xt=>{let Ui=Xt.key,O=E.fetchers.get(Ui),z=qa(void 0,O?O.data:void 0);E.fetchers.set(Ui,z),bn(Ui),Xt.controller&&U.set(Ui,Xt.controller)}),We({fetchers:new Map(E.fetchers)});let vo=()=>Un.forEach(Xt=>bn(Xt.key));mt.signal.addEventListener("abort",vo);let{loaderResults:ui,fetcherResults:vt}=await be(E,hr,$i,Un,Fi);if(mt.signal.aborted)return;mt.signal.removeEventListener("abort",vo),Z.delete(W),U.delete(W),Un.forEach(Xt=>U.delete(Xt.key));let Wt=vu(ui);if(Wt)return ce(Fi,Wt.result,!1,{preventScrollReset:Me});if(Wt=vu(vt),Wt)return L.add(Wt.key),ce(Fi,Wt.result,!1,{preventScrollReset:Me});let{loaderData:ji,errors:di}=I_(E,hr,ui,void 0,Un,vt,H);if(E.fetchers.has(W)){let Xt=Wi(Ot.data);E.fetchers.set(W,Xt)}Li(Gn),E.navigation.state==="loading"&&Gn>F?(yt(R,"Expected pending action"),M&&M.abort(),it(E.navigation.location,{matches:hr,loaderData:ji,errors:di,fetchers:new Map(E.fetchers)})):(We({errors:di,loaderData:x_(E.loaderData,ji,hr,di),fetchers:new Map(E.fetchers)}),S=!1)}async function K(W,Q,re,pe,Re,Ve,nt,Me,Le){let Ae=E.fetchers.get(W);ht(W,qa(Le,Ae?Ae.data:void 0),{flushSync:nt});let He=new AbortController,mt=Io(t.history,re,He.signal);if(Ve){let Ot=await yo(Re,re,mt.signal);if(Ot.type==="aborted")return;if(Ot.type==="error"){et(W,Q,Ot.error,{flushSync:nt});return}else if(Ot.matches)Re=Ot.matches,pe=cc(Re,re);else{et(W,Q,Bn(404,{pathname:re}),{flushSync:nt});return}}U.set(W,He);let St=oe,Pt=(await Ie("loader",E,mt,[pe],Re,W))[pe.route.id];if(es(Pt)&&(Pt=await Vg(Pt,mt.signal,!0)||Pt),U.get(W)===He&&U.delete(W),!mt.signal.aborted){if(B.has(W)){ht(W,Wi(void 0));return}if(Ps(Pt))if(F>St){ht(W,Wi(void 0));return}else{L.add(W),await ce(mt,Pt,!1,{preventScrollReset:Me});return}if(Yn(Pt)){et(W,Q,Pt.error);return}yt(!es(Pt),"Unhandled fetcher deferred data"),ht(W,Wi(Pt.data))}}async function ce(W,Q,re,pe){let{submission:Re,fetcherSubmission:Ve,preventScrollReset:nt,replace:Me}=pe===void 0?{}:pe;Q.response.headers.has("X-Remix-Revalidate")&&(S=!0);let Le=Q.response.headers.get("Location");yt(Le,"Expected a Location header on the redirect Response"),Le=w_(Le,new URL(W.url),c);let Ae=ya(E.location,Le,{_isRedirect:!0});if(n){let Ot=!1;if(Q.response.headers.has("X-Remix-Reload-Document"))Ot=!0;else if(zg.test(Le)){const Ht=t.history.createURL(Le);Ot=Ht.origin!==e.location.origin||Bl(Ht.pathname,c)==null}if(Ot){Me?e.location.replace(Le):e.location.assign(Le);return}}M=null;let He=Me===!0||Q.response.headers.has("X-Remix-Replace")?qt.Replace:qt.Push,{formMethod:mt,formAction:St,formEncType:cn}=E.navigation;!Re&&!Ve&&mt&&St&&cn&&(Re=k_(E.navigation));let Pt=Re||Ve;if(qz.has(Q.response.status)&&Pt&&br(Pt.formMethod))await ae(He,Ae,{submission:Zt({},Pt,{formAction:Le}),preventScrollReset:nt||j,enableViewTransition:re?$:void 0});else{let Ot=_p(Ae,Re);await ae(He,Ae,{overrideNavigation:Ot,fetcherSubmission:Ve,preventScrollReset:nt||j,enableViewTransition:re?$:void 0})}}async function Ie(W,Q,re,pe,Re,Ve){let nt,Me={};try{nt=await eV(l,W,Q,re,pe,Re,Ve,s,i)}catch(Le){return pe.forEach(Ae=>{Me[Ae.route.id]={type:$t.error,error:Le}}),Me}for(let[Le,Ae]of Object.entries(nt))if(oV(Ae)){let He=Ae.result;Me[Le]={type:$t.redirect,response:rV(He,re,Le,Re,c,d.v7_relativeSplatPath)}}else Me[Le]=await nV(Ae);return Me}async function be(W,Q,re,pe,Re){let Ve=W.matches,nt=Ie("loader",W,Re,re,Q,null),Me=Promise.all(pe.map(async He=>{if(He.matches&&He.match&&He.controller){let St=(await Ie("loader",W,Io(t.history,He.path,He.controller.signal),[He.match],He.matches,He.key))[He.match.route.id];return{[He.key]:St}}else return Promise.resolve({[He.key]:{type:$t.error,error:Bn(404,{pathname:He.path})}})})),Le=await nt,Ae=(await Me).reduce((He,mt)=>Object.assign(He,mt),{});return await Promise.all([lV(Q,Le,Re.signal,Ve,W.loaderData),uV(Q,Ae,pe)]),{loaderResults:Le,fetcherResults:Ae}}function Be(){S=!0,k.push(...Pi()),I.forEach((W,Q)=>{U.has(Q)&&C.add(Q),bn(Q)})}function ht(W,Q,re){re===void 0&&(re={}),E.fetchers.set(W,Q),We({fetchers:new Map(E.fetchers)},{flushSync:(re&&re.flushSync)===!0})}function et(W,Q,re,pe){pe===void 0&&(pe={});let Re=ks(E.matches,Q);qn(W),We({errors:{[Re.route.id]:re},fetchers:new Map(E.fetchers)},{flushSync:(pe&&pe.flushSync)===!0})}function pn(W){return X.set(W,(X.get(W)||0)+1),B.has(W)&&B.delete(W),E.fetchers.get(W)||Zz}function qn(W){let Q=E.fetchers.get(W);U.has(W)&&!(Q&&Q.state==="loading"&&Z.has(W))&&bn(W),I.delete(W),Z.delete(W),L.delete(W),d.v7_fetcherPersist&&B.delete(W),C.delete(W),E.fetchers.delete(W)}function Dn(W){let Q=(X.get(W)||0)-1;Q<=0?(X.delete(W),B.add(W),d.v7_fetcherPersist||qn(W)):X.set(W,Q),We({fetchers:new Map(E.fetchers)})}function bn(W){let Q=U.get(W);Q&&(Q.abort(),U.delete(W))}function jt(W){for(let Q of W){let re=pn(Q),pe=Wi(re.data);E.fetchers.set(Q,pe)}}function pr(){let W=[],Q=!1;for(let re of L){let pe=E.fetchers.get(re);yt(pe,"Expected fetcher: "+re),pe.state==="loading"&&(L.delete(re),W.push(re),Q=!0)}return jt(W),Q}function Li(W){let Q=[];for(let[re,pe]of Z)if(pe<W){let Re=E.fetchers.get(re);yt(Re,"Expected fetcher: "+re),Re.state==="loading"&&(bn(re),Z.delete(re),Q.push(re))}return jt(Q),Q.length>0}function Zn(W,Q){let re=E.blockers.get(W)||Wa;return ve.get(W)!==Q&&ve.set(W,Q),re}function oi(W){E.blockers.delete(W),ve.delete(W)}function ai(W,Q){let re=E.blockers.get(W)||Wa;yt(re.state==="unblocked"&&Q.state==="blocked"||re.state==="blocked"&&Q.state==="blocked"||re.state==="blocked"&&Q.state==="proceeding"||re.state==="blocked"&&Q.state==="unblocked"||re.state==="proceeding"&&Q.state==="unblocked","Invalid blocker state transition: "+re.state+" -> "+Q.state);let pe=new Map(E.blockers);pe.set(W,Q),We({blockers:pe})}function mo(W){let{currentLocation:Q,nextLocation:re,historyAction:pe}=W;if(ve.size===0)return;ve.size>1&&ro(!1,"A router only supports one blocker at a time");let Re=Array.from(ve.entries()),[Ve,nt]=Re[Re.length-1],Me=E.blockers.get(Ve);if(!(Me&&Me.state==="proceeding")&&nt({currentLocation:Q,nextLocation:re,historyAction:pe}))return Ve}function jn(W){let Q=Bn(404,{pathname:W}),re=a||o,{matches:pe,route:Re}=D_(re);return Pi(),{notFoundMatches:pe,route:Re,error:Q}}function Pi(W){let Q=[];return H.forEach((re,pe)=>{(!W||W(pe))&&(re.cancel(),Q.push(pe),H.delete(pe))}),Q}function ci(W,Q,re){if(h=W,v=Q,m=re||null,!y&&E.navigation===vp){y=!0;let pe=zl(E.location,E.matches);pe!=null&&We({restoreScrollPosition:pe})}return()=>{h=null,v=null,m=null}}function $r(W,Q){return m&&m(W,Q.map(pe=>Tz(pe,E.loaderData)))||W.key}function Cf(W,Q){if(h&&v){let re=$r(W,Q);h[re]=v()}}function zl(W,Q){if(h){let re=$r(W,Q),pe=h[re];if(typeof pe=="number")return pe}return null}function go(W,Q,re){if(u)if(W){if(Object.keys(W[0].params).length>0)return{active:!0,matches:Lu(Q,re,c,!0)}}else return{active:!0,matches:Lu(Q,re,c,!0)||[]};return{active:!1,matches:null}}async function yo(W,Q,re){if(!u)return{type:"success",matches:W};let pe=W;for(;;){let Re=a==null,Ve=a||o,nt=s;try{await u({path:Q,matches:pe,patch:(Ae,He)=>{re.aborted||S_(Ae,He,Ve,nt,i)}})}catch(Ae){return{type:"error",error:Ae,partialMatches:pe}}finally{Re&&!re.aborted&&(o=[...o])}if(re.aborted)return{type:"aborted"};let Me=Ki(Ve,Q,c);if(Me)return{type:"success",matches:Me};let Le=Lu(Ve,Q,c,!0);if(!Le||pe.length===Le.length&&pe.every((Ae,He)=>Ae.route.id===Le[He].route.id))return{type:"success",matches:null};pe=Le}}function Mf(W){s={},a=Md(W,i,void 0,s)}function Lf(W,Q){let re=a==null;S_(W,Q,a||o,s,i),re&&(o=[...o],We({}))}return w={get basename(){return c},get future(){return d},get state(){return E},get routes(){return o},get window(){return e},initialize:Ee,subscribe:rt,enableScrollRestoration:ci,navigate:At,fetch:ue,revalidate:b,createHref:W=>t.history.createHref(W),encodeLocation:W=>t.history.encodeLocation(W),getFetcher:pn,deleteFetcher:Dn,dispose:ze,getBlocker:Zn,deleteBlocker:oi,patchRoutes:Lf,_internalFetchControllers:U,_internalActiveDeferreds:H,_internalSetRoutes:Mf},w}function Jz(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Ah(t,e,n,r,i,s,o,a){let c,l;if(o){c=[];for(let d of e)if(c.push(d),d.route.id===o){l=d;break}}else c=e,l=e[e.length-1];let u=kO(i||".",RO(c,s),Bl(t.pathname,n)||t.pathname,a==="path");if(i==null&&(u.search=t.search,u.hash=t.hash),(i==null||i===""||i===".")&&l){let d=Hg(u.search);if(l.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&d){let f=new URLSearchParams(u.search),p=f.getAll("index");f.delete("index"),p.filter(m=>m).forEach(m=>f.append("index",m));let h=f.toString();u.search=h?"?"+h:""}}return r&&n!=="/"&&(u.pathname=u.pathname==="/"?n:rs([n,u.pathname])),Aa(u)}function v_(t,e,n,r){if(!r||!Jz(r))return{path:n};if(r.formMethod&&!cV(r.formMethod))return{path:n,error:Bn(405,{method:r.formMethod})};let i=()=>({path:n,error:Bn(400,{type:"invalid-body"})}),s=r.formMethod||"get",o=t?s.toUpperCase():s.toLowerCase(),a=LO(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!br(o))return i();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((p,h)=>{let[m,v]=h;return""+p+m+"="+v+`
|
|
832
|
-
`},""):String(r.body);return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!br(o))return i();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return i()}}}yt(typeof FormData=="function","FormData is not available in this environment");let c,l;if(r.formData)c=Mh(r.formData),l=r.formData;else if(r.body instanceof FormData)c=Mh(r.body),l=r.body;else if(r.body instanceof URLSearchParams)c=r.body,l=T_(c);else if(r.body==null)c=new URLSearchParams,l=new FormData;else try{c=new URLSearchParams(r.body),l=T_(c)}catch{return i()}let u={formMethod:o,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(br(u.formMethod))return{path:n,submission:u};let d=Mi(n);return e&&d.search&&Hg(d.search)&&c.append("index",""),d.search="?"+c,{path:Aa(d),submission:u}}function __(t,e,n){n===void 0&&(n=!1);let r=t.findIndex(i=>i.route.id===e);return r>=0?t.slice(0,n?r+1:r):t}function b_(t,e,n,r,i,s,o,a,c,l,u,d,f,p,h,m){let v=m?Yn(m[1])?m[1].error:m[1].data:void 0,y=t.createURL(e.location),g=t.createURL(i),_=n;s&&e.errors?_=__(n,Object.keys(e.errors)[0],!0):m&&Yn(m[1])&&(_=__(n,m[0]));let T=m?m[1].statusCode:void 0,w=o&&T&&T>=400,E=_.filter((j,M)=>{let{route:$}=j;if($.lazy)return!0;if($.loader==null)return!1;if(s)return Ch($,e.loaderData,e.errors);if(Xz(e.loaderData,e.matches[M],j)||c.some(G=>G===j.route.id))return!0;let ne=e.matches[M],x=j;return E_(j,Zt({currentUrl:y,currentParams:ne.params,nextUrl:g,nextParams:x.params},r,{actionResult:v,actionStatus:T,defaultShouldRevalidate:w?!1:a||y.pathname+y.search===g.pathname+g.search||y.search!==g.search||CO(ne,x)}))}),R=[];return d.forEach((j,M)=>{if(s||!n.some(S=>S.route.id===j.routeId)||u.has(M))return;let $=Ki(p,j.path,h);if(!$){R.push({key:M,routeId:j.routeId,path:j.path,matches:null,match:null,controller:null});return}let ne=e.fetchers.get(M),x=cc($,j.path),G=!1;f.has(M)?G=!1:l.has(M)?(l.delete(M),G=!0):ne&&ne.state!=="idle"&&ne.data===void 0?G=a:G=E_(x,Zt({currentUrl:y,currentParams:e.matches[e.matches.length-1].params,nextUrl:g,nextParams:n[n.length-1].params},r,{actionResult:v,actionStatus:T,defaultShouldRevalidate:w?!1:a})),G&&R.push({key:M,routeId:j.routeId,path:j.path,matches:$,match:x,controller:new AbortController})}),[E,R]}function Ch(t,e,n){if(t.lazy)return!0;if(!t.loader)return!1;let r=e!=null&&e[t.id]!==void 0,i=n!=null&&n[t.id]!==void 0;return!r&&i?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!i}function Xz(t,e,n){let r=!e||n.route.id!==e.route.id,i=t[n.route.id]===void 0;return r||i}function CO(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function E_(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function S_(t,e,n,r,i){var s;let o;if(t){let l=r[t];yt(l,"No route found to patch children into: routeId = "+t),l.children||(l.children=[]),o=l.children}else o=n;let a=e.filter(l=>!o.some(u=>MO(l,u))),c=Md(a,i,[t||"_","patch",String(((s=o)==null?void 0:s.length)||"0")],r);o.push(...c)}function MO(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>{var i;return(i=e.children)==null?void 0:i.some(s=>MO(n,s))}):!1}async function Kz(t,e,n){if(!t.lazy)return;let r=await t.lazy();if(!t.lazy)return;let i=n[t.id];yt(i,"No route found in manifest");let s={};for(let o in r){let c=i[o]!==void 0&&o!=="hasErrorBoundary";ro(!c,'Route "'+i.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!Sz.has(o)&&(s[o]=r[o])}Object.assign(i,s),Object.assign(i,Zt({},e(i),{lazy:void 0}))}async function Qz(t){let{matches:e}=t,n=e.filter(i=>i.shouldLoad);return(await Promise.all(n.map(i=>i.resolve()))).reduce((i,s,o)=>Object.assign(i,{[n[o].route.id]:s}),{})}async function eV(t,e,n,r,i,s,o,a,c,l){let u=s.map(p=>p.route.lazy?Kz(p.route,c,a):void 0),d=s.map((p,h)=>{let m=u[h],v=i.some(g=>g.route.id===p.route.id);return Zt({},p,{shouldLoad:v,resolve:async g=>(g&&r.method==="GET"&&(p.route.lazy||p.route.loader)&&(v=!0),v?tV(e,r,p,m,g,l):Promise.resolve({type:$t.data,result:void 0}))})}),f=await t({matches:d,request:r,params:s[0].params,fetcherKey:o,context:l});try{await Promise.all(u)}catch{}return f}async function tV(t,e,n,r,i,s){let o,a,c=l=>{let u,d=new Promise((h,m)=>u=m);a=()=>u(),e.signal.addEventListener("abort",a);let f=h=>typeof l!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+n.route.id+"]"))):l({request:e,params:n.params,context:s},...h!==void 0?[h]:[]),p=(async()=>{try{return{type:"data",result:await(i?i(m=>f(m)):f())}}catch(h){return{type:"error",result:h}}})();return Promise.race([p,d])};try{let l=n.route[t];if(r)if(l){let u,[d]=await Promise.all([c(l).catch(f=>{u=f}),r]);if(u!==void 0)throw u;o=d}else if(await r,l=n.route[t],l)o=await c(l);else if(t==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw Bn(405,{method:e.method,pathname:d,routeId:n.route.id})}else return{type:$t.data,result:void 0};else if(l)o=await c(l);else{let u=new URL(e.url),d=u.pathname+u.search;throw Bn(404,{pathname:d})}yt(o.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(l){return{type:$t.error,result:l}}finally{a&&e.signal.removeEventListener("abort",a)}return o}async function nV(t){let{result:e,type:n}=t;if(PO(e)){let l;try{let u=e.headers.get("Content-Type");u&&/\bapplication\/json\b/.test(u)?e.body==null?l=null:l=await e.json():l=await e.text()}catch(u){return{type:$t.error,error:u}}return n===$t.error?{type:$t.error,error:new Nh(e.status,e.statusText,l),statusCode:e.status,headers:e.headers}:{type:$t.data,data:l,statusCode:e.status,headers:e.headers}}if(n===$t.error){if(R_(e)){var r;if(e.data instanceof Error){var i;return{type:$t.error,error:e.data,statusCode:(i=e.init)==null?void 0:i.status}}e=new Nh(((r=e.init)==null?void 0:r.status)||500,void 0,e.data)}return{type:$t.error,error:e,statusCode:Rf(e)?e.status:void 0}}if(aV(e)){var s,o;return{type:$t.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((o=e.init)==null?void 0:o.headers)&&new Headers(e.init.headers)}}if(R_(e)){var a,c;return{type:$t.data,data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(c=e.init)!=null&&c.headers?new Headers(e.init.headers):void 0}}return{type:$t.data,data:e}}function rV(t,e,n,r,i,s){let o=t.headers.get("Location");if(yt(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!zg.test(o)){let a=r.slice(0,r.findIndex(c=>c.route.id===n)+1);o=Ah(new URL(e.url),a,i,!0,o,s),t.headers.set("Location",o)}return t}function w_(t,e,n){if(zg.test(t)){let r=t,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Bl(i.pathname,n)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function Io(t,e,n,r){let i=t.createURL(LO(e)).toString(),s={signal:n};if(r&&br(r.formMethod)){let{formMethod:o,formEncType:a}=r;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(r.json)):a==="text/plain"?s.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?s.body=Mh(r.formData):s.body=r.formData}return new Request(i,s)}function Mh(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function T_(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function iV(t,e,n,r,i){let s={},o=null,a,c=!1,l={},u=n&&Yn(n[1])?n[1].error:void 0;return t.forEach(d=>{if(!(d.route.id in e))return;let f=d.route.id,p=e[f];if(yt(!Ps(p),"Cannot handle redirect results in processLoaderData"),Yn(p)){let h=p.error;u!==void 0&&(h=u,u=void 0),o=o||{};{let m=ks(t,f);o[m.route.id]==null&&(o[m.route.id]=h)}s[f]=void 0,c||(c=!0,a=Rf(p.error)?p.error.status:500),p.headers&&(l[f]=p.headers)}else es(p)?(r.set(f,p.deferredData),s[f]=p.deferredData.data,p.statusCode!=null&&p.statusCode!==200&&!c&&(a=p.statusCode),p.headers&&(l[f]=p.headers)):(s[f]=p.data,p.statusCode&&p.statusCode!==200&&!c&&(a=p.statusCode),p.headers&&(l[f]=p.headers))}),u!==void 0&&n&&(o={[n[0]]:u},s[n[0]]=void 0),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:l}}function I_(t,e,n,r,i,s,o){let{loaderData:a,errors:c}=iV(e,n,r,o);return i.forEach(l=>{let{key:u,match:d,controller:f}=l,p=s[u];if(yt(p,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(Yn(p)){let h=ks(t.matches,d==null?void 0:d.route.id);c&&c[h.route.id]||(c=Zt({},c,{[h.route.id]:p.error})),t.fetchers.delete(u)}else if(Ps(p))yt(!1,"Unhandled fetcher revalidation redirect");else if(es(p))yt(!1,"Unhandled fetcher deferred data");else{let h=Wi(p.data);t.fetchers.set(u,h)}}),{loaderData:a,errors:c}}function x_(t,e,n,r){let i=Zt({},e);for(let s of n){let o=s.route.id;if(e.hasOwnProperty(o)?e[o]!==void 0&&(i[o]=e[o]):t[o]!==void 0&&s.route.loader&&(i[o]=t[o]),r&&r.hasOwnProperty(o))break}return i}function O_(t){return t?Yn(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function ks(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function D_(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Bn(t,e){let{pathname:n,routeId:r,method:i,type:s,message:o}=e===void 0?{}:e,a="Unknown Server Error",c="Unknown @remix-run/router error";return t===400?(a="Bad Request",i&&n&&r?c="You made a "+i+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":s==="defer-action"?c="defer() is not supported in actions":s==="invalid-body"&&(c="Unable to encode submission body")):t===403?(a="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):t===404?(a="Not Found",c='No route matches URL "'+n+'"'):t===405&&(a="Method Not Allowed",i&&n&&r?c="You made a "+i.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":i&&(c='Invalid request method "'+i.toUpperCase()+'"')),new Nh(t||500,a,new Error(c),!0)}function vu(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,i]=e[n];if(Ps(i))return{key:r,result:i}}}function LO(t){let e=typeof t=="string"?Mi(t):t;return Aa(Zt({},e,{hash:""}))}function sV(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function oV(t){return PO(t.result)&&Wz.has(t.result.status)}function es(t){return t.type===$t.deferred}function Yn(t){return t.type===$t.error}function Ps(t){return(t&&t.type)===$t.redirect}function R_(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function aV(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function PO(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function cV(t){return Hz.has(t.toLowerCase())}function br(t){return zz.has(t.toLowerCase())}async function lV(t,e,n,r,i){let s=Object.entries(e);for(let o=0;o<s.length;o++){let[a,c]=s[o],l=t.find(f=>(f==null?void 0:f.route.id)===a);if(!l)continue;let u=r.find(f=>f.route.id===l.route.id),d=u!=null&&!CO(u,l)&&(i&&i[l.route.id])!==void 0;es(c)&&d&&await Vg(c,n,!1).then(f=>{f&&(e[a]=f)})}}async function uV(t,e,n){for(let r=0;r<n.length;r++){let{key:i,routeId:s,controller:o}=n[r],a=e[i];t.find(l=>(l==null?void 0:l.route.id)===s)&&es(a)&&(yt(o,"Expected an AbortController for revalidating fetcher deferred result"),await Vg(a,o.signal,!0).then(l=>{l&&(e[i]=l)}))}}async function Vg(t,e,n){if(n===void 0&&(n=!1),!await t.deferredData.resolveData(e)){if(n)try{return{type:$t.data,data:t.deferredData.unwrappedData}}catch(i){return{type:$t.error,error:i}}return{type:$t.data,data:t.deferredData.data}}}function Hg(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function cc(t,e){let n=typeof e=="string"?Mi(e).search:e.search;if(t[t.length-1].route.index&&Hg(n||""))return t[t.length-1];let r=DO(t);return r[r.length-1]}function k_(t){let{formMethod:e,formAction:n,formEncType:r,text:i,formData:s,json:o}=t;if(!(!e||!n||!r)){if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function _p(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function dV(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function qa(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function fV(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Wi(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function pV(t,e){try{let n=t.sessionStorage.getItem(AO);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function hV(t,e){if(e.size>0){let n={};for(let[r,i]of e)n[r]=[...i];try{t.sessionStorage.setItem(AO,JSON.stringify(n))}catch(r){ro(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
|
|
833
|
-
* React Router v6.28.2
|
|
834
|
-
*
|
|
835
|
-
* Copyright (c) Remix Software Inc.
|
|
836
|
-
*
|
|
837
|
-
* This source code is licensed under the MIT license found in the
|
|
838
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
839
|
-
*
|
|
840
|
-
* @license MIT
|
|
841
|
-
*/function ml(){return ml=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ml.apply(this,arguments)}const Wg=Fe.createContext(null),mV=Fe.createContext(null),kf=Fe.createContext(null),Nf=Fe.createContext(null),bs=Fe.createContext({outlet:null,matches:[],isDataRoute:!1}),FO=Fe.createContext(null);function Af(){return Fe.useContext(Nf)!=null}function qg(){return Af()||yt(!1),Fe.useContext(Nf).location}function gV(){return Fe.useContext(Nf).navigationType}function $O(t){Fe.useContext(kf).static||Fe.useLayoutEffect(t)}function MH(){let{isDataRoute:t}=Fe.useContext(bs);return t?RV():yV()}function yV(){Af()||yt(!1);let t=Fe.useContext(Wg),{basename:e,future:n,navigator:r}=Fe.useContext(kf),{matches:i}=Fe.useContext(bs),{pathname:s}=qg(),o=JSON.stringify(RO(i,n.v7_relativeSplatPath)),a=Fe.useRef(!1);return $O(()=>{a.current=!0}),Fe.useCallback(function(l,u){if(u===void 0&&(u={}),!a.current)return;if(typeof l=="number"){r.go(l);return}let d=kO(l,JSON.parse(o),s,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:rs([e,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[e,r,o,s,t])}const vV=Fe.createContext(null);function _V(t){let e=Fe.useContext(bs).outlet;return e&&Fe.createElement(vV.Provider,{value:t},e)}function LH(){let{matches:t}=Fe.useContext(bs),e=t[t.length-1];return e?e.params:{}}function PH(t,e,n,r){Af()||yt(!1);let{navigator:i}=Fe.useContext(kf),{matches:s}=Fe.useContext(bs),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let l=qg(),u;u=l;let d=u.pathname||"/",f=d;if(c!=="/"){let m=c.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=Ki(t,{pathname:f});return TV(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:rs([c,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:rs([c,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),s,n,r)}function bV(){let t=DV(),e=Rf(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Fe.createElement(Fe.Fragment,null,Fe.createElement("h2",null,"Unexpected Application Error!"),Fe.createElement("h3",{style:{fontStyle:"italic"}},e),n?Fe.createElement("pre",{style:i},n):null,null)}const EV=Fe.createElement(bV,null);class SV extends Fe.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?Fe.createElement(bs.Provider,{value:this.props.routeContext},Fe.createElement(FO.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wV(t){let{routeContext:e,match:n,children:r}=t,i=Fe.useContext(Wg);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),Fe.createElement(bs.Provider,{value:e},r)}function TV(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let u=o.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);u>=0||yt(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,l=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<o.length;u++){let d=o[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=u),d.route.id){let{loaderData:f,errors:p}=n,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){c=!0,l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}return o.reduceRight((u,d,f)=>{let p,h=!1,m=null,v=null;n&&(p=a&&d.route.id?a[d.route.id]:void 0,m=d.route.errorElement||EV,c&&(l<0&&f===0?(h=!0,v=null):l===f&&(h=!0,v=d.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,f+1)),g=()=>{let _;return p?_=m:h?_=v:d.route.Component?_=Fe.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=u,Fe.createElement(wV,{match:d,routeContext:{outlet:u,matches:y,isDataRoute:n!=null},children:_})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?Fe.createElement(SV,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var jO=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(jO||{}),Ld=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ld||{});function IV(t){let e=Fe.useContext(Wg);return e||yt(!1),e}function xV(t){let e=Fe.useContext(mV);return e||yt(!1),e}function OV(t){let e=Fe.useContext(bs);return e||yt(!1),e}function UO(t){let e=OV(),n=e.matches[e.matches.length-1];return n.route.id||yt(!1),n.route.id}function DV(){var t;let e=Fe.useContext(FO),n=xV(Ld.UseRouteError),r=UO(Ld.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function RV(){let{router:t}=IV(jO.UseNavigateStable),e=UO(Ld.UseNavigateStable),n=Fe.useRef(!1);return $O(()=>{n.current=!0}),Fe.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,ml({fromRouteId:e},s)))},[t,e])}const N_={};function kV(t,e){N_[e]||(N_[e]=!0,console.warn(e))}const xo=(t,e,n)=>kV(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+n+"."));function FH(t,e){(t==null?void 0:t.v7_startTransition)===void 0&&xo("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),(t==null?void 0:t.v7_relativeSplatPath)===void 0&&(!e||!e.v7_relativeSplatPath)&&xo("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist===void 0&&xo("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod===void 0&&xo("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration===void 0&&xo("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation===void 0&&xo("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function $H(t){return _V(t.context)}function NV(t){yt(!1)}function jH(t){let{basename:e="/",children:n=null,location:r,navigationType:i=qt.Pop,navigator:s,static:o=!1,future:a}=t;Af()&&yt(!1);let c=e.replace(/^\/*/,"/"),l=Fe.useMemo(()=>({basename:c,navigator:s,static:o,future:ml({v7_relativeSplatPath:!1},a)}),[c,a,s,o]);typeof r=="string"&&(r=Mi(r));let{pathname:u="/",search:d="",hash:f="",state:p=null,key:h="default"}=r,m=Fe.useMemo(()=>{let v=Bl(u,c);return v==null?null:{location:{pathname:v,search:d,hash:f,state:p,key:h},navigationType:i}},[c,u,d,f,p,h,i]);return m==null?null:Fe.createElement(kf.Provider,{value:l},Fe.createElement(Nf.Provider,{children:n,value:m}))}new Promise(()=>{});function Lh(t,e){e===void 0&&(e=[]);let n=[];return Fe.Children.forEach(t,(r,i)=>{if(!Fe.isValidElement(r))return;let s=[...e,i];if(r.type===Fe.Fragment){n.push.apply(n,Lh(r.props.children,s));return}r.type!==NV&&yt(!1),!r.props.index||!r.props.children||yt(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Lh(r.props.children,s)),n.push(o)}),n}function AV(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:Fe.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:Fe.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:Fe.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function UH(t,e){return Yz({basename:e==null?void 0:e.basename,future:ml({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:_z({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:AV,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function CV(){const[t]=jh(),{analytics:e}=t;Pn(()=>{const n=wt();if(!e){n&&n.close();return}if(n||!vi.sentry.dsn||vi.sentry.dsn==="")return;const r=window.__VITE_ENVS.SENTRY_RELEASE,i=[PT(),CT({depth:5}),MB(),NT({levels:["error"]})];vi.sentry.tracing&&i.push(c9({useEffect:wi.useEffect,useLocation:qg,useNavigationType:gV,createRoutesFromChildren:Lh,matchRoutes:Ki})),QB({release:r,dsn:vi.sentry.dsn,environment:vi.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(s,o){const a=o.originalException;return a instanceof TypeError&&a.message.includes("Failed to fetch")&&!navigator.onLine?null:s}})},[e])}const MV=({children:t})=>(CV(),t);function A_(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const LV=()=>{const[{gaTrackingId:t}]=Bg(),[{analytics:e}]=jh(),n=t&&e;return Pn(()=>{if(n){const r=document.createElement("script");return r.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,r.async=!0,document.head.appendChild(r),window.dataLayer=window.dataLayer||[],A_("js",new Date),A_("config",t),()=>{document.head.removeChild(r)}}},[n,t]),null},PV=wi.lazy(async()=>({default:await(await Ko(()=>import("./router-Hd499Vrp.js").then(n=>n.r),__vite__mapDeps([5,1,2,3]))).default()})),FV=()=>{for(const t of Object.values(e8))_l(t);return null},$V=()=>Te(wi.StrictMode,{children:Te(m1,{fallback:Te(C_,{}),children:Ft(B1,{store:pl,children:[Te(FV,{}),Te(c1,{children:Te(MV,{children:Te(vz,{children:Ft(l1,{children:[Te(u1,{position:"bottom-right"}),Ft(dz,{children:[Te(PV,{}),Te(pz,{}),Te(LV,{})]})]})})})})]})})}),BH=Object.freeze(Object.defineProperty({__proto__:null,default:$V},Symbol.toStringTag,{value:"Module"}));export{_6 as $,iz as A,_l as B,Df as C,Wg as D,Nh as E,I8 as F,$g as G,h8 as H,kH as I,SO as J,K4 as K,M8 as L,Sa as M,C8 as N,$H as O,oD as P,LH as Q,jH as R,W4 as S,U_ as T,NH as U,L8 as V,m8 as W,H8 as X,Ce as Y,D as Z,q4 as _,MH as a,L9 as a0,r6 as a1,BH as a2,mV as b,PH as c,Yz as d,CH as e,UH as f,qV as g,vl as h,j8 as i,dn as j,so as k,FH as l,AV as m,Ug as n,$8 as o,AH as p,bO as q,Bg as r,Nr as s,TO as t,qg as u,jg as v,Q4 as w,yn as x,Z_ as y,n8 as z};
|
|
842
|
-
//# sourceMappingURL=app-BdM_bCqD.js.map
|