decocms 3.2.1 → 3.2.2
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/dist/client/assets/{AlertCircle-ByuuAmrP.js → AlertCircle-B4jsZ7IP.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-7eXsw1ql.js → ArrowUpRight-Cy8Jts75.js} +1 -1
- package/dist/client/assets/{Check-BbSnE7nF.js → Check-BcJnSpP-.js} +1 -1
- package/dist/client/assets/{CheckCircle-Ca1wJWW6.js → CheckCircle-CS-5SeNh.js} +1 -1
- package/dist/client/assets/{ChevronDown-B3TWWBuw.js → ChevronDown-Dn2G7txX.js} +1 -1
- package/dist/client/assets/{ChevronLeft-CuRKchB5.js → ChevronLeft-DMtbpB_E.js} +1 -1
- package/dist/client/assets/{ChevronRight-CYgA53ZB.js → ChevronRight-CY3YFT-N.js} +1 -1
- package/dist/client/assets/{ChevronUp-0T6APBSE.js → ChevronUp-DaIovYNP.js} +1 -1
- package/dist/client/assets/{Container-RPSmr1XN.js → Container-pwvMIQ8x.js} +1 -1
- package/dist/client/assets/{DotsVertical-BQNv4yup.js → DotsVertical-BZmjvUjx.js} +1 -1
- package/dist/client/assets/{Eye-CNWO8gM7.js → Eye-COqgNgOQ.js} +1 -1
- package/dist/client/assets/{FilterLines-Cpimx7eF.js → FilterLines-o2dXSd9m.js} +1 -1
- package/dist/client/assets/{Globe01-C0ij8Y-s.js → Globe01-C9VThViN.js} +1 -1
- package/dist/client/assets/{HardDrive-ChaMHCwz.js → HardDrive-BrK4QeY5.js} +1 -1
- package/dist/client/assets/{Key01-Bfuisq2G.js → Key01-Cv9DeFg9.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BDqI6g0z.js → LinkExternal01-Dop0HaF1.js} +1 -1
- package/dist/client/assets/{Monitor01-CcL8iOzY.js → Monitor01-Ov0MWegc.js} +1 -1
- package/dist/client/assets/{Palette-DKpoyUgd.js → Palette-C9vvRsl1.js} +1 -1
- package/dist/client/assets/{Play-Bb6uueKI.js → Play-CpfveWpO.js} +1 -1
- package/dist/client/assets/{Plus-CZ_sF7TZ.js → Plus-CBBhRRCR.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BPWCc7Ui.js → RefreshCcw01-C_SS_L3k.js} +1 -1
- package/dist/client/assets/{SearchMd-BFlkVflN.js → SearchMd-C2Ooa8X-.js} +1 -1
- package/dist/client/assets/{Settings02-Ch7efITK.js → Settings02-BdIfFRAO.js} +1 -1
- package/dist/client/assets/{Shield01-rrS6w-7t.js → Shield01-Cav9VS8z.js} +1 -1
- package/dist/client/assets/{Star01-CNXX9diU.js → Star01-DU6VzyMA.js} +1 -1
- package/dist/client/assets/{Stars01-BQswryR6.js → Stars01-CUBgq4tk.js} +1 -1
- package/dist/client/assets/{Stars02-CSL2rgyN.js → Stars02-zmPvOQIG.js} +1 -1
- package/dist/client/assets/{Sun-Ck3cYoCA.js → Sun-BRLHiHpH.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DsrQHrpb.js → SwitchHorizontal01-D6QQwdrB.js} +1 -1
- package/dist/client/assets/{Tool01-Cjv1XJEb.js → Tool01-Cxk9aEZy.js} +1 -1
- package/dist/client/assets/{Trash01-CxCHXGOx.js → Trash01-CiY0-H-z.js} +1 -1
- package/dist/client/assets/{Upload01-CeYSkJhe.js → Upload01-WFvQ7PcR.js} +1 -1
- package/dist/client/assets/{User01-DrA8Lgm7.js → User01-CSPM7-j5.js} +1 -1
- package/dist/client/assets/{Users01-3z4KNhww.js → Users01-KGXeUnPr.js} +1 -1
- package/dist/client/assets/{Users03-C9tAd5Ba.js → Users03-BjY9UbF_.js} +1 -1
- package/dist/client/assets/{X-DSdGdxng.js → X-DCPshBE5.js} +1 -1
- package/dist/client/assets/{XCircle--wEB3Wnr.js → XCircle-7OUszoCa.js} +1 -1
- package/dist/client/assets/{XClose-SBhbV0jV.js → XClose-Dh42xuQx.js} +1 -1
- package/dist/client/assets/{Zap-BRXknHpU.js → Zap-DdcTYCbc.js} +1 -1
- package/dist/client/assets/{ZapSquare-DW4J95z9.js → ZapSquare-BHv8IlMQ.js} +1 -1
- package/dist/client/assets/{ZoomOut-1w3s7N6o.js → ZoomOut-Cl1mwueX.js} +1 -1
- package/dist/client/assets/{access-gate-DUP-FMW_.js → access-gate-CBv65jyA.js} +1 -1
- package/dist/client/assets/{accordion-Bu_taiZe.js → accordion-CIEVzq71.js} +1 -1
- package/dist/client/assets/{add-section-modal-BvFEBv0h.js → add-section-modal-BNR3lyTT.js} +1 -1
- package/dist/client/assets/{agent-capabilities-DbMxSg-C.js → agent-capabilities-ZULVjZ6I.js} +1 -1
- package/dist/client/assets/{agent-icon-DkS6Ap-C.js → agent-icon-S2kXebD8.js} +1 -1
- package/dist/client/assets/{agent-icons-BU8H-xTW.js → agent-icons-BiolkcA_.js} +1 -1
- package/dist/client/assets/{agents-list-DVZwv3E6.js → agents-list-CGuCmg-I.js} +1 -1
- package/dist/client/assets/{ai-providers-agn-dcob.js → ai-providers-miD8yIVm.js} +1 -1
- package/dist/client/assets/{alert-DN73WALn.js → alert-Dsr1Tkf7.js} +1 -1
- package/dist/client/assets/{alert-dialog-Bw7NBbRz.js → alert-dialog-CZ8DxHXn.js} +1 -1
- package/dist/client/assets/app-editor-qLxcbkzh.js +1 -0
- package/dist/client/assets/{auth-catchall-BlJ-5WHw.js → auth-catchall-W2h-8Fgb.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Dzm1aPH4.js → auth-split-layout-C4vUHoIj.js} +1 -1
- package/dist/client/assets/{automation-list-row-C3x-E244.js → automation-list-row-BPG-TiQs.js} +1 -1
- package/dist/client/assets/{automation-runs-CTZmIulC.js → automation-runs-DOsjurBA.js} +1 -1
- package/dist/client/assets/{automations-S87NSt_f.js → automations-BpU6Ed1t.js} +1 -1
- package/dist/client/assets/{avatar-6TETgWGc.js → avatar-BtEW5t9q.js} +1 -1
- package/dist/client/assets/{badge-B8xisPo_.js → badge-B5iIVekl.js} +1 -1
- package/dist/client/assets/{brand-context-Mfgei73B.js → brand-context-DPMhbKzD.js} +1 -1
- package/dist/client/assets/{buckets-CVy4SLLv.js → buckets-BJ0j2KLm.js} +1 -1
- package/dist/client/assets/{calendar-BvvsEYKA.js → calendar-DJMqhuU_.js} +1 -1
- package/dist/client/assets/{capability-load-error-VErw4nLB.js → capability-load-error-DLVSOsZp.js} +1 -1
- package/dist/client/assets/{card-XQIiSY-b.js → card-PGDlYSYu.js} +1 -1
- package/dist/client/assets/{chat-context-DzUbC-xr.js → chat-context-Cn8Z9qNH.js} +1 -1
- package/dist/client/assets/{checkbox-Bpq-GtnK.js → checkbox-BXMwMWhn.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BrX77bKE.js → cli-auth-success-ByOEbre8.js} +1 -1
- package/dist/client/assets/{collection-detail-Dvs8YEXJ.js → collection-detail-BQ-x1NkW.js} +1 -1
- package/dist/client/assets/{collection-display-button-B3IAyNvh.js → collection-display-button-CG23ihWU.js} +1 -1
- package/dist/client/assets/{collection-search-Dnrehh9Y.js → collection-search-B_1t9PBO.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-UpBeyOT3.js → collection-table-wrapper-DJMQgA1-.js} +1 -1
- package/dist/client/assets/{collection-tabs-CoI7UjOp.js → collection-tabs-_m8_Oysw.js} +1 -1
- package/dist/client/assets/{collections-B7jkmTPa.js → collections-Ctgd2_xQ.js} +1 -1
- package/dist/client/assets/{command-B39UMlEv.js → command-DVsD8zbf.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-B_fv-zC_.js → connect-desktop-dialog-rW3v-fhc.js} +1 -1
- package/dist/client/assets/{connection-card-BxD3hzYk.js → connection-card-UvC-rBfq.js} +1 -1
- package/dist/client/assets/{connection-detail-Bi7jbI9b.js → connection-detail-C7yYcwvq.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-qDos9L_s.js → connection-form-helpers-BFz0Oqzb.js} +1 -1
- package/dist/client/assets/{connections-qXvhTW3S.js → connections-DgcdoyFQ.js} +1 -1
- package/dist/client/assets/{constants-_OexfFJl.js → constants-BWQ6Sd_e.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-B9TJutJ9.js → decopilot-sse-pool-Tw1t3t_5.js} +1 -1
- package/dist/client/assets/{dialog-N8dYL9IV.js → dialog-Dg7YCnw0.js} +1 -1
- package/dist/client/assets/{domain-settings-BMZMOFLc.js → domain-settings-BojuNvDV.js} +1 -1
- package/dist/client/assets/{drawer-BDyeiuJ6.js → drawer-Vui0Qe00.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Jaik1o9W.js → dropdown-menu-CRPwqyA_.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CGMYG2P8.js → dynamic-plugin-layout-D04ue7Gd.js} +1 -1
- package/dist/client/assets/{empty-state-BIZp3Wzl.js → empty-state-BmjzPls6.js} +1 -1
- package/dist/client/assets/{empty-state-DmuFPxSA.js → empty-state-DBniKhnN.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BMrTOxqq.js → extract-connection-data-C0XQgQkq.js} +1 -1
- package/dist/client/assets/{features-RZhE2UVO.js → features-DXjEq73y.js} +1 -1
- package/dist/client/assets/{file-explorer-eWHbqcdV.js → file-explorer-Dk_zVrtP.js} +1 -1
- package/dist/client/assets/{file-type-icon-Bscuxmvi.js → file-type-icon-DngJz3vh.js} +1 -1
- package/dist/client/assets/{files-C6VU3gjR.js → files-CcPaGgft.js} +1 -1
- package/dist/client/assets/{form-BzUl5L3O.js → form-BxztHJPs.js} +1 -1
- package/dist/client/assets/{general-FkmFS6e6.js → general-BlkOonf1.js} +1 -1
- package/dist/client/assets/{generate-id-BHkehxKG.js → generate-id-kkKlM_ZT.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BFiC9cbF.js → github-repo-picker-NzNJJ2mH.js} +1 -1
- package/dist/client/assets/{header-tab-button-CeJ9c_tl.js → header-tab-button-C2bZpoGh.js} +1 -1
- package/dist/client/assets/{hover-card-Cd5Q8igo.js → hover-card-BoNuGO9O.js} +1 -1
- package/dist/client/assets/{image-field-UZAPAOOz.js → image-field-zdMprORm.js} +1 -1
- package/dist/client/assets/{index-CapCq4uG.js → index-7sx6qeDB.js} +1 -1
- package/dist/client/assets/{index-BUA93rVM.js → index-B-6O4glO.js} +1 -1
- package/dist/client/assets/{index-WmwIsUVI.js → index-B-_a0Oss.js} +1 -1
- package/dist/client/assets/{index-B8ILnfS6.js → index-B0SUBZdo.js} +1 -1
- package/dist/client/assets/{index-Dc-40HGd.js → index-B7817iVc.js} +1 -1
- package/dist/client/assets/{index-CUwWwcrX.js → index-BIkLnmgx.js} +1 -1
- package/dist/client/assets/{index-BLLBrYfT.js → index-BIycoEZO.js} +1 -1
- package/dist/client/assets/{index-CVcc7k1H.js → index-BM1QEMf0.js} +1 -1
- package/dist/client/assets/{index-meHkju0S.js → index-BUBqDUve.js} +1 -1
- package/dist/client/assets/{index-CXD35HrY.js → index-BqIGGS2X.js} +3 -3
- package/dist/client/assets/{index-3PLXj9NO.js → index-CUhf1CAw.js} +4 -4
- package/dist/client/assets/{index-BLB4nIBt.js → index-CpZ3-kDL.js} +1 -1
- package/dist/client/assets/{index-Du62ET2a.js → index-EqE4qoN3.js} +1 -1
- package/dist/client/assets/{index-CEk4GIBJ.js → index-Q9wqmVcK.js} +1 -1
- package/dist/client/assets/{index-BQjzxwMq.js → index-f_-lPfBP.js} +1 -1
- package/dist/client/assets/{index-redirect-DDOXoojV.js → index-redirect-DwV22T_l.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CGU6vZCH.js → infiniteQueryObserver-Dc8FQ59R.js} +1 -1
- package/dist/client/assets/{input-C9wjfV7v.js → input-CaVAm8U_.js} +1 -1
- package/dist/client/assets/{integration-icon-DsMTB170.js → integration-icon-B3LZ-ypH.js} +1 -1
- package/dist/client/assets/{label-g7qALGmg.js → label-BdesrWkr.js} +1 -1
- package/dist/client/assets/{layout-bDoXge5D.js → layout-Dy7Xl8GD.js} +1 -1
- package/dist/client/assets/{login-CPZKVFaQ.js → login-ClSpLxLe.js} +1 -1
- package/dist/client/assets/{members-DWt34Meb.js → members-AbFNyBGG.js} +1 -1
- package/dist/client/assets/{monaco-editor-CIVDk0X4.js → monaco-editor-jUNgFLA_.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DVsMM237.js → monitoring-stats-row-Bl7vBKPA.js} +1 -1
- package/dist/client/assets/{oauth-callback-CSUHKD_o.js → oauth-callback-Cfg0BYlX.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BlWETFFP.js → oauth-callback-ai-provider-6-233q1O.js} +1 -1
- package/dist/client/assets/{onboarding-D5Ic9zJG.js → onboarding-CF8aT867.js} +1 -1
- package/dist/client/assets/{org-install-Bn_KoOXH.js → org-install-BouKl_Hm.js} +1 -1
- package/dist/client/assets/{org-layout-BELYI7z_.js → org-layout-CJYZ6hJx.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-WHwrW77i.js → org-plugin-layout-C_i2p4nu.js} +1 -1
- package/dist/client/assets/{page-seo-form-Rig1soEP.js → page-seo-form-CGlEWrly.js} +1 -1
- package/dist/client/assets/page-seo-sheet-D9OH76zu.js +1 -0
- package/dist/client/assets/{pair-zYr2GmQ7.js → pair-nPVqMFKf.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CaWAfurE.js → plugin-empty-state-DxmNZcu2.js} +1 -1
- package/dist/client/assets/{plugin-header-BD-ptlOP.js → plugin-header-Cih3pw8c.js} +1 -1
- package/dist/client/assets/{plugin-layout-CIQ_MNTQ.js → plugin-layout-C0u4T8bf.js} +1 -1
- package/dist/client/assets/{popover-OD-r-fVD.js → popover-Dh1FmH19.js} +1 -1
- package/dist/client/assets/{post-editor-Ww43847q.js → post-editor-DKzJCa2h.js} +1 -1
- package/dist/client/assets/{primitives-BkhZbhaK.js → primitives-Bpsqoi37.js} +1 -1
- package/dist/client/assets/{profile-DScmkuI4.js → profile-BKniS2eJ.js} +1 -1
- package/dist/client/assets/project-app-view-NeIgV6JC.js +1 -0
- package/dist/client/assets/record-editor-B0nFfN45.js +1 -0
- package/dist/client/assets/registry-lMOMpCMU.js +2 -0
- package/dist/client/assets/{registry-layout-aQVqpLkk.js → registry-layout-CywrtQu-.js} +1 -1
- package/dist/client/assets/{require-capability-B83Rfplv.js → require-capability-DC0Is4D3.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DCPdZlSg.js → required-auth-layout-ChMVNVuI.js} +1 -1
- package/dist/client/assets/{reset-password-BSCF-TYh.js → reset-password-C8Ac0h7h.js} +1 -1
- package/dist/client/assets/{resizable-BT2keVUf.js → resizable-DnoMgmPk.js} +1 -1
- package/dist/client/assets/{roles-DDxTqNFx.js → roles-Rx3zDvt6.js} +1 -1
- package/dist/client/assets/{save-status-BWK9t34W.js → save-status-5BzwhxLA.js} +1 -1
- package/dist/client/assets/{schema-form-DMN65tMe.js → schema-form-GGiCnZqw.js} +1 -1
- package/dist/client/assets/{scroll-area-huDDjp9h.js → scroll-area-lKcEVEIp.js} +1 -1
- package/dist/client/assets/{search-input-Bo1czWuc.js → search-input-DLl3bcGX.js} +1 -1
- package/dist/client/assets/{secrets-BSGdlXxl.js → secrets-DfX78pXS.js} +1 -1
- package/dist/client/assets/{sections-editor-Kc6kOt9I.js → sections-editor-DTXL7qNG.js} +1 -1
- package/dist/client/assets/{select-D_rADyeN.js → select-aLHKiSfh.js} +1 -1
- package/dist/client/assets/{select-model-D4qI7a0H.js → select-model-CKUscIjE.js} +1 -1
- package/dist/client/assets/{seo-editor-GY9idGrl.js → seo-editor-BMslVCBp.js} +1 -1
- package/dist/client/assets/{settings-layout-B0Ul5kvB.js → settings-layout-DIID8x1q.js} +1 -1
- package/dist/client/assets/{settings-section-DMc4s0vU.js → settings-section-Cp0JxD81.js} +1 -1
- package/dist/client/assets/{sheet-Pz5-NB3k.js → sheet-CrjSd0ee.js} +1 -1
- package/dist/client/assets/{shell-controls-C0ImSETI.js → shell-controls-3XxUtHpH.js} +1 -1
- package/dist/client/assets/{shell-layout-Dgdt_8rv.js → shell-layout-C1QcgINV.js} +1 -1
- package/dist/client/assets/{shell-route-loading-CB1BVSfX.js → shell-route-loading-QSXXe5uW.js} +1 -1
- package/dist/client/assets/{sidebar-B-j-nI2l.js → sidebar-B5XsaO6I.js} +1 -1
- package/dist/client/assets/{skeleton-DIe_hcjh.js → skeleton-C0D8_b7-.js} +1 -1
- package/dist/client/assets/{sortable.esm-DY8YVkDQ.js → sortable.esm-BT8c1g1j.js} +1 -1
- package/dist/client/assets/{spinner-B0UNMt-U.js → spinner-2Lki_FxR.js} +1 -1
- package/dist/client/assets/{sso-B0wN1G0O.js → sso-Dk4f1NLd.js} +1 -1
- package/dist/client/assets/{store-Ck7Guxqc.js → store-CxWtyfZA.js} +1 -1
- package/dist/client/assets/store-registry-B6ii15gd.js +2 -0
- package/dist/client/assets/{switch-CCm7Q442.js → switch-ChhMoO4B.js} +1 -1
- package/dist/client/assets/{tab-id-Bw_e4wJV.js → tab-id-tG-5YHAn.js} +1 -1
- package/dist/client/assets/{table-BYsCVFvU.js → table-xtQhl8PY.js} +1 -1
- package/dist/client/assets/{tabs-DU8yElp1.js → tabs-g3tAy1aN.js} +1 -1
- package/dist/client/assets/{task-status-DukwwWFW.js → task-status-B8s-1rF4.js} +1 -1
- package/dist/client/assets/{textarea-Bg3_-gyq.js → textarea-DTaE0QqC.js} +1 -1
- package/dist/client/assets/{toggle-group-D3JRSHCm.js → toggle-group-DN-y36Xr.js} +1 -1
- package/dist/client/assets/{toolbar-BcNvXnW_.js → toolbar-B1nEeO2l.js} +1 -1
- package/dist/client/assets/{tools-list-D-XUldpQ.js → tools-list-elJwsP4L.js} +1 -1
- package/dist/client/assets/{tooltip-BLOVWRLB.js → tooltip-D9W-TwLE.js} +1 -1
- package/dist/client/assets/{types-BDkt4vmT.js → types-B3ytm7Q2.js} +1 -1
- package/dist/client/assets/{use-ai-providers-D8uqA8F3.js → use-ai-providers-lWKhYcs-.js} +1 -1
- package/dist/client/assets/{use-automations-B9xj4bsi.js → use-automations-Cx1Icu0C.js} +1 -1
- package/dist/client/assets/{use-capability-D90XVo0g.js → use-capability-B5qHp81z.js} +1 -1
- package/dist/client/assets/{use-collections-DoCz8MGT.js → use-collections-DsyJRjKq.js} +1 -1
- package/dist/client/assets/{use-connection-BP0gNEj8.js → use-connection-C51qpM4f.js} +1 -1
- package/dist/client/assets/{use-copy-QEEDdK3_.js → use-copy-CiQ5q1uw.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BH7S5Lx3.js → use-create-virtual-mcp-C5di5h_F.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CiGa02ts.js → use-debounced-autosave-BgqckX6w.js} +1 -1
- package/dist/client/assets/{use-delete-connection-ClZdPbyx.js → use-delete-connection-5smOllWL.js} +1 -1
- package/dist/client/assets/{use-file-configs-DryWc5C3.js → use-file-configs-9KLr3i9W.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-G1byfuk0.js → use-infinite-scroll-D0jZyhlQ.js} +1 -1
- package/dist/client/assets/{use-list-state-ao0R-NZI.js → use-list-state-CCenvwJV.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-Dsxmrp6C.js → use-mcp-prompts-D63BK4EU.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CP1ukXK9.js → use-mcp-tools-DbyFJj3o.js} +1 -1
- package/dist/client/assets/{use-members-DJtUNna_.js → use-members-Tv2gVVWu.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-D4AslRZm.js → use-navigate-to-agent-Bd9ehn7Y.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CxpHs_Vn.js → use-org-auth-client-Bj_sA4qc.js} +1 -1
- package/dist/client/assets/{use-org-sso-RJt5vtQj.js → use-org-sso-DrMKOP9k.js} +1 -1
- package/dist/client/assets/{use-organization-roles-B1v3SUrz.js → use-organization-roles-BSqim_9n.js} +1 -1
- package/dist/client/assets/{use-organization-settings-1zemtEzS.js → use-organization-settings-CMmcWWrW.js} +1 -1
- package/dist/client/assets/{use-registry-connections-Ex6acs_f.js → use-registry-connections-tzElWLgC.js} +1 -1
- package/dist/client/assets/{use-secrets-CIR-JEqt.js → use-secrets-BEBy8eUJ.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DYoN9DxD.js → use-status-sounds-DrcXZHth.js} +1 -1
- package/dist/client/assets/{use-view-mode-ZMLCKL2b.js → use-view-mode-inO99fmS.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BRv_CvsW.js → use-virtual-mcp-BmNsIAjR.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Cd0Pj7fS.js +1 -0
- package/dist/client/assets/{useRouterState-DNu2gJlX.js → useRouterState-DipVSTx6.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Lk51cCbS.js +1 -0
- package/dist/client/assets/{user-CDUKY7Tn.js → user-3pmWA0m5.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DgZQSMnW.js → view-mode-toggle-CeZvzPnX.js} +1 -1
- package/dist/client/assets/{workflow-H0Kk_Nq-.js → workflow-De5nNOdK.js} +1 -1
- package/dist/client/assets/workflow-detail-NitZ_h6K.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +432 -432
- package/dist/server/migrate.js +9 -9
- package/dist/server/server.js +285 -285
- package/package.json +1 -1
- package/dist/client/assets/app-editor-BuMABOjf.js +0 -1
- package/dist/client/assets/page-seo-sheet-Bf_FSOof.js +0 -1
- package/dist/client/assets/project-app-view-DRVCBkTN.js +0 -1
- package/dist/client/assets/record-editor-DNW7IuYT.js +0 -1
- package/dist/client/assets/registry-BDe37MkZ.js +0 -2
- package/dist/client/assets/store-registry-CFkyafgO.js +0 -2
- package/dist/client/assets/useInfiniteQuery-Dsby0HYE.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DMzYQ3Lt.js +0 -1
- package/dist/client/assets/workflow-detail-G3IbeOSM.js +0 -1
package/dist/server/migrate.js
CHANGED
|
@@ -3,15 +3,15 @@ var _2=Object.create;var{getPrototypeOf:C2,defineProperty:n$,getOwnPropertyNames
|
|
|
3
3
|
`:""},this._extScope=$,this._scope=new C0.Scope({parent:$}),this._nodes=[new eK]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,Z){let Y=this._extScope.value($,Z);return(this._values[Y.prefix]||(this._values[Y.prefix]=new Set)).add(Y),Y}getScopeValue($,Z){return this._extScope.getValue($,Z)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,Z,Y,Q){let W=this._scope.toName(Z);if(Y!==void 0&&Q)this._constants[W.str]=Y;return this._leafNode(new nK($,W,Y)),W}const($,Z,Y){return this._def(C0.varKinds.const,$,Z,Y)}let($,Z,Y){return this._def(C0.varKinds.let,$,Z,Y)}var($,Z,Y){return this._def(C0.varKinds.var,$,Z,Y)}assign($,Z,Y){return this._leafNode(new QX($,Z,Y))}add($,Z){return this._leafNode(new rK($,o1.operators.ADD,Z))}code($){if(typeof $=="function")$();else if($!==J1.nil)this._leafNode(new tK($));return this}object(...$){let Z=["{"];for(let[Y,Q]of $){if(Z.length>1)Z.push(",");if(Z.push(Y),Y!==Q||this.opts.es5)Z.push(":"),(0,J1.addCodeArg)(Z,Q)}return Z.push("}"),new J1._Code(Z)}if($,Z,Y){if(this._blockNode(new Y6($)),Z&&Y)this.code(Z).else().code(Y).endIf();else if(Z)this.code(Z).endIf();else if(Y)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new Y6($))}else(){return this._elseNode(new o9)}endIf(){return this._endBlockNode(Y6,o9)}_for($,Z){if(this._blockNode($),Z)this.code(Z).endFor();return this}for($,Z){return this._for(new $H($),Z)}forRange($,Z,Y,Q,W=this.opts.es5?C0.varKinds.var:C0.varKinds.let){let J=this._scope.toName($);return this._for(new ZH(W,J,Z,Y),()=>Q(J))}forOf($,Z,Y,Q=C0.varKinds.const){let W=this._scope.toName($);if(this.opts.es5){let J=Z instanceof J1.Name?Z:this.var("_arr",Z);return this.forRange("_i",0,J1._`${J}.length`,(G)=>{this.var(W,J1._`${J}[${G}]`),Y(W)})}return this._for(new ZX("of",Q,W,Z),()=>Y(W))}forIn($,Z,Y,Q=this.opts.es5?C0.varKinds.var:C0.varKinds.const){if(this.opts.ownProperties)return this.forOf($,J1._`Object.keys(${Z})`,Y);let W=this._scope.toName($);return this._for(new ZX("in",Q,W,Z),()=>Y(W))}endFor(){return this._endBlockNode(g8)}label($){return this._leafNode(new aK($))}break($){return this._leafNode(new oK($))}return($){let Z=new k4;if(this._blockNode(Z),this.code($),Z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k4)}try($,Z,Y){if(!Z&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let Q=new YH;if(this._blockNode(Q),this.code($),Z){let W=this.name("e");this._currNode=Q.catch=new x4(W),Z(W)}if(Y)this._currNode=Q.finally=new g4,this.code(Y);return this._endBlockNode(x4,g4)}throw($){return this._leafNode(new sK($))}block($,Z){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(Z);return this}endBlock($){let Z=this._blockStarts.pop();if(Z===void 0)throw Error("CodeGen: not in self-balancing block");let Y=this._nodes.length-Z;if(Y<0||$!==void 0&&Y!==$)throw Error(`CodeGen: wrong number of nodes: ${Y} vs ${$} expected`);return this._nodes.length=Z,this}func($,Z=J1.nil,Y,Q){if(this._blockNode(new T4($,Z,Y)),Q)this.code(Q).endFunc();return this}endFunc(){return this._endBlockNode(T4)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,Z){let Y=this._currNode;if(Y instanceof $||Z&&Y instanceof Z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${Z?`${$.kind}/${Z.kind}`:$.kind}"`)}_elseNode($){let Z=this._currNode;if(!(Z instanceof Y6))throw Error('CodeGen: "else" without "if"');return this._currNode=Z.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let Z=this._nodes;Z[Z.length-1]=$}}o1.CodeGen=QH;function a6($,Z){for(let Y in Z)$[Y]=($[Y]||0)+(Z[Y]||0);return $}function u4($,Z){return Z instanceof J1._CodeOrName?a6($,Z.names):$}function u8($,Z,Y){if($ instanceof J1.Name)return Q($);if(!W($))return $;return new J1._Code($._items.reduce((J,G)=>{if(G instanceof J1.Name)G=Q(G);if(G instanceof J1._Code)J.push(...G._items);else J.push(G);return J},[]));function Q(J){let G=Y[J.str];if(G===void 0||Z[J.str]!==1)return J;return delete Z[J.str],G}function W(J){return J instanceof J1._Code&&J._items.some((G)=>G instanceof J1.Name&&Z[G.str]===1&&Y[G.str]!==void 0)}}function sw($,Z){for(let Y in Z)$[Y]=($[Y]||0)-(Z[Y]||0)}function XH($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:J1._`!${YX($)}`}o1.not=XH;var tw=WH(o1.operators.AND);function ew(...$){return $.reduce(tw)}o1.and=ew;var $E=WH(o1.operators.OR);function ZE(...$){return $.reduce($E)}o1.or=ZE;function WH($){return(Z,Y)=>Z===J1.nil?Y:Y===J1.nil?Z:J1._`${YX(Z)} ${$} ${YX(Y)}`}function YX($){return $ instanceof J1.Name?$:J1._`(${$})`}});var G1=k((LH)=>{Object.defineProperty(LH,"__esModule",{value:!0});LH.checkStrictMode=LH.getErrorPath=LH.Type=LH.useFunc=LH.setEvaluated=LH.evaluatedPropsToName=LH.mergeEvaluated=LH.eachItem=LH.unescapeJsonPointer=LH.escapeJsonPointer=LH.escapeFragment=LH.unescapeFragment=LH.schemaRefOrVal=LH.schemaHasRulesButRef=LH.schemaHasRules=LH.checkUnknownRules=LH.alwaysValidSchema=LH.toHash=void 0;var L1=Z1(),WE=a9();function JE($){let Z={};for(let Y of $)Z[Y]=!0;return Z}LH.toHash=JE;function GE($,Z){if(typeof Z=="boolean")return Z;if(Object.keys(Z).length===0)return!0;return HH($,Z),!BH(Z,$.self.RULES.all)}LH.alwaysValidSchema=GE;function HH($,Z=$.schema){let{opts:Y,self:Q}=$;if(!Y.strictSchema)return;if(typeof Z==="boolean")return;let W=Q.RULES.keywords;for(let J in Z)if(!W[J])VH($,`unknown keyword: "${J}"`)}LH.checkUnknownRules=HH;function BH($,Z){if(typeof $=="boolean")return!$;for(let Y in $)if(Z[Y])return!0;return!1}LH.schemaHasRules=BH;function KE($,Z){if(typeof $=="boolean")return!$;for(let Y in $)if(Y!=="$ref"&&Z.all[Y])return!0;return!1}LH.schemaHasRulesButRef=KE;function HE({topSchemaRef:$,schemaPath:Z},Y,Q,W){if(!W){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return L1._`${Y}`}return L1._`${$}${Z}${(0,L1.getProperty)(Q)}`}LH.schemaRefOrVal=HE;function BE($){return FH(decodeURIComponent($))}LH.unescapeFragment=BE;function FE($){return encodeURIComponent(WX($))}LH.escapeFragment=FE;function WX($){if(typeof $=="number")return`${$}`;return $.replace(/~/g,"~0").replace(/\//g,"~1")}LH.escapeJsonPointer=WX;function FH($){return $.replace(/~1/g,"/").replace(/~0/g,"~")}LH.unescapeJsonPointer=FH;function DE($,Z){if(Array.isArray($))for(let Y of $)Z(Y);else Z($)}LH.eachItem=DE;function GH({mergeNames:$,mergeToName:Z,mergeValues:Y,resultToName:Q}){return(W,J,G,K)=>{let B=G===void 0?J:G instanceof L1.Name?(J instanceof L1.Name?$(W,J,G):Z(W,J,G),G):J instanceof L1.Name?(Z(W,G,J),J):Y(J,G);return K===L1.Name&&!(B instanceof L1.Name)?Q(W,B):B}}LH.mergeEvaluated={props:GH({mergeNames:($,Z,Y)=>$.if(L1._`${Y} !== true && ${Z} !== undefined`,()=>{$.if(L1._`${Z} === true`,()=>$.assign(Y,!0),()=>$.assign(Y,L1._`${Y} || {}`).code(L1._`Object.assign(${Y}, ${Z})`))}),mergeToName:($,Z,Y)=>$.if(L1._`${Y} !== true`,()=>{if(Z===!0)$.assign(Y,!0);else $.assign(Y,L1._`${Y} || {}`),JX($,Y,Z)}),mergeValues:($,Z)=>$===!0?!0:{...$,...Z},resultToName:DH}),items:GH({mergeNames:($,Z,Y)=>$.if(L1._`${Y} !== true && ${Z} !== undefined`,()=>$.assign(Y,L1._`${Z} === true ? true : ${Y} > ${Z} ? ${Y} : ${Z}`)),mergeToName:($,Z,Y)=>$.if(L1._`${Y} !== true`,()=>$.assign(Y,Z===!0?!0:L1._`${Y} > ${Z} ? ${Y} : ${Z}`)),mergeValues:($,Z)=>$===!0?!0:Math.max($,Z),resultToName:($,Z)=>$.var("items",Z)})};function DH($,Z){if(Z===!0)return $.var("props",!0);let Y=$.var("props",L1._`{}`);if(Z!==void 0)JX($,Y,Z);return Y}LH.evaluatedPropsToName=DH;function JX($,Z,Y){Object.keys(Y).forEach((Q)=>$.assign(L1._`${Z}${(0,L1.getProperty)(Q)}`,!0))}LH.setEvaluated=JX;var KH={};function VE($,Z){return $.scopeValue("func",{ref:Z,code:KH[Z.code]||(KH[Z.code]=new WE._Code(Z.code))})}LH.useFunc=VE;var XX;(function($){$[$.Num=0]="Num",$[$.Str=1]="Str"})(XX||(LH.Type=XX={}));function LE($,Z,Y){if($ instanceof L1.Name){let Q=Z===XX.Num;return Y?Q?L1._`"[" + ${$} + "]"`:L1._`"['" + ${$} + "']"`:Q?L1._`"/" + ${$}`:L1._`"/" + ${$}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,L1.getProperty)($).toString():"/"+WX($)}LH.getErrorPath=LE;function VH($,Z,Y=$.opts.strictSchema){if(!Y)return;if(Z=`strict mode: ${Z}`,Y===!0)throw Error(Z);$.self.logger.warn(Z)}LH.checkStrictMode=VH});var Q6=k((jH)=>{Object.defineProperty(jH,"__esModule",{value:!0});var l1=Z1(),bE={data:new l1.Name("data"),valCxt:new l1.Name("valCxt"),instancePath:new l1.Name("instancePath"),parentData:new l1.Name("parentData"),parentDataProperty:new l1.Name("parentDataProperty"),rootData:new l1.Name("rootData"),dynamicAnchors:new l1.Name("dynamicAnchors"),vErrors:new l1.Name("vErrors"),errors:new l1.Name("errors"),this:new l1.Name("this"),self:new l1.Name("self"),scope:new l1.Name("scope"),json:new l1.Name("json"),jsonPos:new l1.Name("jsonPos"),jsonLen:new l1.Name("jsonLen"),jsonPart:new l1.Name("jsonPart")};jH.default=bE});var s9=k((qH)=>{Object.defineProperty(qH,"__esModule",{value:!0});qH.extendErrors=qH.resetErrorsCount=qH.reportExtraError=qH.reportError=qH.keyword$DataError=qH.keywordError=void 0;var K1=Z1(),p4=G1(),c1=Q6();qH.keywordError={message:({keyword:$})=>K1.str`must pass "${$}" keyword validation`};qH.keyword$DataError={message:({keyword:$,schemaType:Z})=>Z?K1.str`"${$}" keyword must be ${Z} ($data)`:K1.str`"${$}" keyword is invalid ($data)`};function yE($,Z=qH.keywordError,Y,Q){let{it:W}=$,{gen:J,compositeRule:G,allErrors:K}=W,B=OH($,Z,Y);if(Q!==null&&Q!==void 0?Q:G||K)AH(J,B);else zH(W,K1._`[${B}]`)}qH.reportError=yE;function TE($,Z=qH.keywordError,Y){let{it:Q}=$,{gen:W,compositeRule:J,allErrors:G}=Q,K=OH($,Z,Y);if(AH(W,K),!(J||G))zH(Q,c1.default.vErrors)}qH.reportExtraError=TE;function kE($,Z){$.assign(c1.default.errors,Z),$.if(K1._`${c1.default.vErrors} !== null`,()=>$.if(Z,()=>$.assign(K1._`${c1.default.vErrors}.length`,Z),()=>$.assign(c1.default.vErrors,null)))}qH.resetErrorsCount=kE;function xE({gen:$,keyword:Z,schemaValue:Y,data:Q,errsCount:W,it:J}){if(W===void 0)throw Error("ajv implementation error");let G=$.name("err");$.forRange("i",W,c1.default.errors,(K)=>{if($.const(G,K1._`${c1.default.vErrors}[${K}]`),$.if(K1._`${G}.instancePath === undefined`,()=>$.assign(K1._`${G}.instancePath`,(0,K1.strConcat)(c1.default.instancePath,J.errorPath))),$.assign(K1._`${G}.schemaPath`,K1.str`${J.errSchemaPath}/${Z}`),J.opts.verbose)$.assign(K1._`${G}.schema`,Y),$.assign(K1._`${G}.data`,Q)})}qH.extendErrors=xE;function AH($,Z){let Y=$.const("err",Z);$.if(K1._`${c1.default.vErrors} === null`,()=>$.assign(c1.default.vErrors,K1._`[${Y}]`),K1._`${c1.default.vErrors}.push(${Y})`),$.code(K1._`${c1.default.errors}++`)}function zH($,Z){let{gen:Y,validateName:Q,schemaEnv:W}=$;if(W.$async)Y.throw(K1._`new ${$.ValidationError}(${Z})`);else Y.assign(K1._`${Q}.errors`,Z),Y.return(!1)}var o6={keyword:new K1.Name("keyword"),schemaPath:new K1.Name("schemaPath"),params:new K1.Name("params"),propertyName:new K1.Name("propertyName"),message:new K1.Name("message"),schema:new K1.Name("schema"),parentSchema:new K1.Name("parentSchema")};function OH($,Z,Y){let{createErrors:Q}=$.it;if(Q===!1)return K1._`{}`;return gE($,Z,Y)}function gE($,Z,Y={}){let{gen:Q,it:W}=$,J=[uE(W,Y),hE($,Y)];return mE($,Z,J),Q.object(...J)}function uE({errorPath:$},{instancePath:Z}){let Y=Z?K1.str`${$}${(0,p4.getErrorPath)(Z,p4.Type.Str)}`:$;return[c1.default.instancePath,(0,K1.strConcat)(c1.default.instancePath,Y)]}function hE({keyword:$,it:{errSchemaPath:Z}},{schemaPath:Y,parentSchema:Q}){let W=Q?Z:K1.str`${Z}/${$}`;if(Y)W=K1.str`${W}${(0,p4.getErrorPath)(Y,p4.Type.Str)}`;return[o6.schemaPath,W]}function mE($,{params:Z,message:Y},Q){let{keyword:W,data:J,schemaValue:G,it:K}=$,{opts:B,propertyName:D,topSchemaRef:V,schemaPath:L}=K;if(Q.push([o6.keyword,W],[o6.params,typeof Z=="function"?Z($):Z||K1._`{}`]),B.messages)Q.push([o6.message,typeof Y=="function"?Y($):Y]);if(B.verbose)Q.push([o6.schema,G],[o6.parentSchema,K1._`${V}${L}`],[c1.default.data,J]);if(D)Q.push([o6.propertyName,D])}});var EH=k((PH)=>{Object.defineProperty(PH,"__esModule",{value:!0});PH.boolOrEmptySchema=PH.topBoolOrEmptySchema=void 0;var dE=s9(),nE=Z1(),rE=Q6(),aE={message:"boolean schema is false"};function oE($){let{gen:Z,schema:Y,validateName:Q}=$;if(Y===!1)MH($,!1);else if(typeof Y=="object"&&Y.$async===!0)Z.return(rE.default.data);else Z.assign(nE._`${Q}.errors`,null),Z.return(!0)}PH.topBoolOrEmptySchema=oE;function sE($,Z){let{gen:Y,schema:Q}=$;if(Q===!1)Y.var(Z,!1),MH($);else Y.var(Z,!0)}PH.boolOrEmptySchema=sE;function MH($,Z){let{gen:Y,data:Q}=$,W={gen:Y,keyword:"false schema",data:Q,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:$};(0,dE.reportError)(W,aE,void 0,Z)}});var KX=k((RH)=>{Object.defineProperty(RH,"__esModule",{value:!0});RH.getRules=RH.isJSONType=void 0;var eE=["string","number","integer","boolean","null","object","array"],$R=new Set(eE);function ZR($){return typeof $=="string"&&$R.has($)}RH.isJSONType=ZR;function YR(){let $={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...$,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},$.number,$.string,$.array,$.object],post:{rules:[]},all:{},keywords:{}}}RH.getRules=YR});var HX=k((fH)=>{Object.defineProperty(fH,"__esModule",{value:!0});fH.shouldUseRule=fH.shouldUseGroup=fH.schemaHasRulesForType=void 0;function XR({schema:$,self:Z},Y){let Q=Z.RULES.types[Y];return Q&&Q!==!0&&CH($,Q)}fH.schemaHasRulesForType=XR;function CH($,Z){return Z.rules.some((Y)=>IH($,Y))}fH.shouldUseGroup=CH;function IH($,Z){var Y;return $[Z.keyword]!==void 0||((Y=Z.definition.implements)===null||Y===void 0?void 0:Y.some((Q)=>$[Q]!==void 0))}fH.shouldUseRule=IH});var t9=k((TH)=>{Object.defineProperty(TH,"__esModule",{value:!0});TH.reportTypeError=TH.checkDataTypes=TH.checkDataType=TH.coerceAndCheckDataType=TH.getJSONTypes=TH.getSchemaTypes=TH.DataType=void 0;var GR=KX(),KR=HX(),HR=s9(),e=Z1(),bH=G1(),h8;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(h8||(TH.DataType=h8={}));function BR($){let Z=vH($.type);if(Z.includes("null")){if($.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!Z.length&&$.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if($.nullable===!0)Z.push("null")}return Z}TH.getSchemaTypes=BR;function vH($){let Z=Array.isArray($)?$:$?[$]:[];if(Z.every(GR.isJSONType))return Z;throw Error("type must be JSONType or JSONType[]: "+Z.join(","))}TH.getJSONTypes=vH;function FR($,Z){let{gen:Y,data:Q,opts:W}=$,J=DR(Z,W.coerceTypes),G=Z.length>0&&!(J.length===0&&Z.length===1&&(0,KR.schemaHasRulesForType)($,Z[0]));if(G){let K=FX(Z,Q,W.strictNumbers,h8.Wrong);Y.if(K,()=>{if(J.length)VR($,Z,J);else DX($)})}return G}TH.coerceAndCheckDataType=FR;var yH=new Set(["string","number","integer","boolean","null"]);function DR($,Z){return Z?$.filter((Y)=>yH.has(Y)||Z==="array"&&Y==="array"):[]}function VR($,Z,Y){let{gen:Q,data:W,opts:J}=$,G=Q.let("dataType",e._`typeof ${W}`),K=Q.let("coerced",e._`undefined`);if(J.coerceTypes==="array")Q.if(e._`${G} == 'object' && Array.isArray(${W}) && ${W}.length == 1`,()=>Q.assign(W,e._`${W}[0]`).assign(G,e._`typeof ${W}`).if(FX(Z,W,J.strictNumbers),()=>Q.assign(K,W)));Q.if(e._`${K} !== undefined`);for(let D of Y)if(yH.has(D)||D==="array"&&J.coerceTypes==="array")B(D);Q.else(),DX($),Q.endIf(),Q.if(e._`${K} !== undefined`,()=>{Q.assign(W,K),LR($,K)});function B(D){switch(D){case"string":Q.elseIf(e._`${G} == "number" || ${G} == "boolean"`).assign(K,e._`"" + ${W}`).elseIf(e._`${W} === null`).assign(K,e._`""`);return;case"number":Q.elseIf(e._`${G} == "boolean" || ${W} === null
|
|
4
4
|
|| (${G} == "string" && ${W} && ${W} == +${W})`).assign(K,e._`+${W}`);return;case"integer":Q.elseIf(e._`${G} === "boolean" || ${W} === null
|
|
5
5
|
|| (${G} === "string" && ${W} && ${W} == +${W} && !(${W} % 1))`).assign(K,e._`+${W}`);return;case"boolean":Q.elseIf(e._`${W} === "false" || ${W} === 0 || ${W} === null`).assign(K,!1).elseIf(e._`${W} === "true" || ${W} === 1`).assign(K,!0);return;case"null":Q.elseIf(e._`${W} === "" || ${W} === 0 || ${W} === false`),Q.assign(K,null);return;case"array":Q.elseIf(e._`${G} === "string" || ${G} === "number"
|
|
6
|
-
|| ${G} === "boolean" || ${W} === null`).assign(K,e._`[${W}]`)}}}function LR({gen:$,parentData:Z,parentDataProperty:Y},Q){$.if(e._`${Z} !== undefined`,()=>$.assign(e._`${Z}[${Y}]`,Q))}function BX($,Z,Y,Q=h8.Correct){let W=Q===h8.Correct?e.operators.EQ:e.operators.NEQ,J;switch($){case"null":return e._`${Z} ${W} null`;case"array":J=e._`Array.isArray(${Z})`;break;case"object":J=e._`${Z} && typeof ${Z} == "object" && !Array.isArray(${Z})`;break;case"integer":J=G(e._`!(${Z} % 1) && !isNaN(${Z})`);break;case"number":J=G();break;default:return e._`typeof ${Z} ${W} ${$}`}return Q===h8.Correct?J:(0,e.not)(J);function G(K=e.nil){return(0,e.and)(e._`typeof ${Z} == "number"`,K,Y?e._`isFinite(${Z})`:e.nil)}}TH.checkDataType=BX;function FX($,Z,Y,Q){if($.length===1)return BX($[0],Z,Y,Q);let W,J=(0,bH.toHash)($);if(J.array&&J.object){let G=e._`typeof ${Z} != "object"`;W=J.null?G:e._`!${Z} || ${G}`,delete J.null,delete J.array,delete J.object}else W=e.nil;if(J.number)delete J.integer;for(let G in J)W=(0,e.and)(W,BX(G,Z,Y,Q));return W}TH.checkDataTypes=FX;var UR={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:Z})=>typeof $=="string"?e._`{type: ${$}}`:e._`{type: ${Z}}`};function DX($){let Z=jR($);(0,HR.reportError)(Z,UR)}TH.reportTypeError=DX;function jR($){let{gen:Z,data:Y,schema:Q}=$,W=(0,bH.schemaRefOrVal)($,Q,"type");return{gen:Z,keyword:"type",data:Y,schema:Q.type,schemaCode:W,schemaValue:W,parentSchema:Q,params:{},it:$}}});var hH=k((gH)=>{Object.defineProperty(gH,"__esModule",{value:!0});gH.assignDefaults=void 0;var m8=Z1(),PR=G1();function wR($,Z){let{properties:Y,items:Q}=$.schema;if(Z==="object"&&Y)for(let W in Y)xH($,W,Y[W].default);else if(Z==="array"&&Array.isArray(Q))Q.forEach((W,J)=>xH($,J,W.default))}gH.assignDefaults=wR;function xH($,Z,Y){let{gen:Q,compositeRule:W,data:J,opts:G}=$;if(Y===void 0)return;let K=m8._`${J}${(0,m8.getProperty)(Z)}`;if(W){(0,PR.checkStrictMode)($,`default is ignored for: ${K}`);return}let B=m8._`${K} === undefined`;if(G.useDefaults==="empty")B=m8._`${B} || ${K} === null || ${K} === ""`;Q.if(B,m8._`${K} = ${(0,m8.stringify)(Y)}`)}});var A0=k((pH)=>{Object.defineProperty(pH,"__esModule",{value:!0});pH.validateUnion=pH.validateArray=pH.usePattern=pH.callValidateCode=pH.schemaProperties=pH.allSchemaProperties=pH.noPropertyInData=pH.propertyInData=pH.isOwnProperty=pH.hasPropFunc=pH.reportMissingProp=pH.checkMissingProp=pH.checkReportMissingProp=void 0;var A1=Z1(),VX=G1(),S6=Q6(),ER=G1();function RR($,Z){let{gen:Y,data:Q,it:W}=$;Y.if(UX(Y,Q,Z,W.opts.ownProperties),()=>{$.setParams({missingProperty:A1._`${Z}`},!0),$.error()})}pH.checkReportMissingProp=RR;function _R({gen:$,data:Z,it:{opts:Y}},Q,W){return(0,A1.or)(...Q.map((J)=>(0,A1.and)(UX($,Z,J,Y.ownProperties),A1._`${W} = ${J}`)))}pH.checkMissingProp=_R;function CR($,Z){$.setParams({missingProperty:Z},!0),$.error()}pH.reportMissingProp=CR;function mH($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:A1._`Object.prototype.hasOwnProperty`})}pH.hasPropFunc=mH;function LX($,Z,Y){return A1._`${mH($)}.call(${Z}, ${Y})`}pH.isOwnProperty=LX;function IR($,Z,Y,Q){let W=A1._`${Z}${(0,A1.getProperty)(Y)} !== undefined`;return Q?A1._`${W} && ${LX($,Z,Y)}`:W}pH.propertyInData=IR;function UX($,Z,Y,Q){let W=A1._`${Z}${(0,A1.getProperty)(Y)} === undefined`;return Q?(0,A1.or)(W,(0,A1.not)(LX($,Z,Y))):W}pH.noPropertyInData=UX;function lH($){return $?Object.keys($).filter((Z)=>Z!=="__proto__"):[]}pH.allSchemaProperties=lH;function fR($,Z){return lH(Z).filter((Y)=>!(0,VX.alwaysValidSchema)($,Z[Y]))}pH.schemaProperties=fR;function SR({schemaCode:$,data:Z,it:{gen:Y,topSchemaRef:Q,schemaPath:W,errorPath:J},it:G},K,B,D){let V=D?A1._`${$}, ${Z}, ${Q}${W}`:Z,L=[[S6.default.instancePath,(0,A1.strConcat)(S6.default.instancePath,J)],[S6.default.parentData,G.parentData],[S6.default.parentDataProperty,G.parentDataProperty],[S6.default.rootData,S6.default.rootData]];if(G.opts.dynamicRef)L.push([S6.default.dynamicAnchors,S6.default.dynamicAnchors]);let A=A1._`${V}, ${Y.object(...L)}`;return B!==A1.nil?A1._`${K}.call(${B}, ${A})`:A1._`${K}(${A})`}pH.callValidateCode=SR;var bR=A1._`new RegExp`;function vR({gen:$,it:{opts:Z}},Y){let Q=Z.unicodeRegExp?"u":"",{regExp:W}=Z.code,J=W(Y,Q);return $.scopeValue("pattern",{key:J.toString(),ref:J,code:A1._`${W.code==="new RegExp"?bR:(0,ER.useFunc)($,W)}(${Y}, ${Q})`})}pH.usePattern=vR;function yR($){let{gen:Z,data:Y,keyword:Q,it:W}=$,J=Z.name("valid");if(W.allErrors){let K=Z.let("valid",!0);return G(()=>Z.assign(K,!1)),K}return Z.var(J,!0),G(()=>Z.break()),J;function G(K){let B=Z.const("len",A1._`${Y}.length`);Z.forRange("i",0,B,(D)=>{$.subschema({keyword:Q,dataProp:D,dataPropType:VX.Type.Num},J),Z.if((0,A1.not)(J),K)})}}pH.validateArray=yR;function TR($){let{gen:Z,schema:Y,keyword:Q,it:W}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,VX.alwaysValidSchema)(W,B))&&!W.opts.unevaluated)return;let G=Z.let("valid",!1),K=Z.name("_valid");Z.block(()=>Y.forEach((B,D)=>{let V=$.subschema({keyword:Q,schemaProp:D,compositeRule:!0},K);if(Z.assign(G,A1._`${G} || ${K}`),!$.mergeValidEvaluated(V,K))Z.if((0,A1.not)(G))})),$.result(G,()=>$.reset(),()=>$.error(!0))}pH.validateUnion=TR});var aH=k((nH)=>{Object.defineProperty(nH,"__esModule",{value:!0});nH.validateKeywordUsage=nH.validSchemaType=nH.funcKeywordCode=nH.macroKeywordCode=void 0;var d1=Z1(),s6=Q6(),rR=A0(),aR=s9();function oR($,Z){let{gen:Y,keyword:Q,schema:W,parentSchema:J,it:G}=$,K=Z.macro.call(G.self,W,J,G),B=dH(Y,Q,K);if(G.opts.validateSchema!==!1)G.self.validateSchema(K,!0);let D=Y.name("valid");$.subschema({schema:K,schemaPath:d1.nil,errSchemaPath:`${G.errSchemaPath}/${Q}`,topSchemaRef:B,compositeRule:!0},D),$.pass(D,()=>$.error(!0))}nH.macroKeywordCode=oR;function sR($,Z){var Y;let{gen:Q,keyword:W,schema:J,parentSchema:G,$data:K,it:B}=$;eR(B,Z);let D=!K&&Z.compile?Z.compile.call(B.self,J,G,B):Z.validate,V=dH(Q,W,D),L=Q.let("valid");$.block$data(L,A),$.ok((Y=Z.valid)!==null&&Y!==void 0?Y:L);function A(){if(Z.errors===!1){if(M(),Z.modifying)cH($);I(()=>$.error())}else{let N=Z.async?O():q();if(Z.modifying)cH($);I(()=>tR($,N))}}function O(){let N=Q.let("ruleErrs",null);return Q.try(()=>M(d1._`await `),(E)=>Q.assign(L,!1).if(d1._`${E} instanceof ${B.ValidationError}`,()=>Q.assign(N,d1._`${E}.errors`),()=>Q.throw(E))),N}function q(){let N=d1._`${V}.errors`;return Q.assign(N,null),M(d1.nil),N}function M(N=Z.async?d1._`await `:d1.nil){let E=B.opts.passContext?s6.default.this:s6.default.self,f=!(("compile"in Z)&&!K||Z.schema===!1);Q.assign(L,d1._`${N}${(0,rR.callValidateCode)($,V,E,f)}`,Z.modifying)}function I(N){var E;Q.if((0,d1.not)((E=Z.valid)!==null&&E!==void 0?E:L),N)}}nH.funcKeywordCode=sR;function cH($){let{gen:Z,data:Y,it:Q}=$;Z.if(Q.parentData,()=>Z.assign(Y,d1._`${Q.parentData}[${Q.parentDataProperty}]`))}function tR($,Z){let{gen:Y}=$;Y.if(d1._`Array.isArray(${Z})`,()=>{Y.assign(s6.default.vErrors,d1._`${s6.default.vErrors} === null ? ${Z} : ${s6.default.vErrors}.concat(${Z})`).assign(s6.default.errors,d1._`${s6.default.vErrors}.length`),(0,aR.extendErrors)($)},()=>$.error())}function eR({schemaEnv:$},Z){if(Z.async&&!$.$async)throw Error("async keyword in sync schema")}function dH($,Z,Y){if(Y===void 0)throw Error(`keyword "${Z}" failed to compile`);return $.scopeValue("keyword",typeof Y=="function"?{ref:Y}:{ref:Y,code:(0,d1.stringify)(Y)})}function $_($,Z,Y=!1){return!Z.length||Z.some((Q)=>Q==="array"?Array.isArray($):Q==="object"?$&&typeof $=="object"&&!Array.isArray($):typeof $==Q||Y&&typeof $>"u")}nH.validSchemaType=$_;function Z_({schema:$,opts:Z,self:Y,errSchemaPath:Q},W,J){if(Array.isArray(W.keyword)?!W.keyword.includes(J):W.keyword!==J)throw Error("ajv implementation error");let G=W.dependencies;if(G===null||G===void 0?void 0:G.some((K)=>!Object.prototype.hasOwnProperty.call($,K)))throw Error(`parent schema must have dependencies of ${J}: ${G.join(",")}`);if(W.validateSchema){if(!W.validateSchema($[J])){let B=`keyword "${J}" value is invalid at path "${Q}": `+Y.errorsText(W.validateSchema.errors);if(Z.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}nH.validateKeywordUsage=Z_});var eH=k((sH)=>{Object.defineProperty(sH,"__esModule",{value:!0});sH.extendSubschemaMode=sH.extendSubschemaData=sH.getSubschema=void 0;var h0=Z1(),oH=G1();function W_($,{keyword:Z,schemaProp:Y,schema:Q,schemaPath:W,errSchemaPath:J,topSchemaRef:G}){if(Z!==void 0&&Q!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Z!==void 0){let K=$.schema[Z];return Y===void 0?{schema:K,schemaPath:h0._`${$.schemaPath}${(0,h0.getProperty)(Z)}`,errSchemaPath:`${$.errSchemaPath}/${Z}`}:{schema:K[Y],schemaPath:h0._`${$.schemaPath}${(0,h0.getProperty)(Z)}${(0,h0.getProperty)(Y)}`,errSchemaPath:`${$.errSchemaPath}/${Z}/${(0,oH.escapeFragment)(Y)}`}}if(Q!==void 0){if(W===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Q,schemaPath:W,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}sH.getSubschema=W_;function J_($,Z,{dataProp:Y,dataPropType:Q,data:W,dataTypes:J,propertyName:G}){if(W!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:K}=Z;if(Y!==void 0){let{errorPath:D,dataPathArr:V,opts:L}=Z,A=K.let("data",h0._`${Z.data}${(0,h0.getProperty)(Y)}`,!0);B(A),$.errorPath=h0.str`${D}${(0,oH.getErrorPath)(Y,Q,L.jsPropertySyntax)}`,$.parentDataProperty=h0._`${Y}`,$.dataPathArr=[...V,$.parentDataProperty]}if(W!==void 0){let D=W instanceof h0.Name?W:K.let("data",W,!0);if(B(D),G!==void 0)$.propertyName=G}if(J)$.dataTypes=J;function B(D){$.data=D,$.dataLevel=Z.dataLevel+1,$.dataTypes=[],Z.definedProperties=new Set,$.parentData=Z.data,$.dataNames=[...Z.dataNames,D]}}sH.extendSubschemaData=J_;function G_($,{jtdDiscriminator:Z,jtdMetadata:Y,compositeRule:Q,createErrors:W,allErrors:J}){if(Q!==void 0)$.compositeRule=Q;if(W!==void 0)$.createErrors=W;if(J!==void 0)$.allErrors=J;$.jtdDiscriminator=Z,$.jtdMetadata=Y}sH.extendSubschemaMode=G_});var jX=k((ur,$B)=>{$B.exports=function $(Z,Y){if(Z===Y)return!0;if(Z&&Y&&typeof Z=="object"&&typeof Y=="object"){if(Z.constructor!==Y.constructor)return!1;var Q,W,J;if(Array.isArray(Z)){if(Q=Z.length,Q!=Y.length)return!1;for(W=Q;W--!==0;)if(!$(Z[W],Y[W]))return!1;return!0}if(Z.constructor===RegExp)return Z.source===Y.source&&Z.flags===Y.flags;if(Z.valueOf!==Object.prototype.valueOf)return Z.valueOf()===Y.valueOf();if(Z.toString!==Object.prototype.toString)return Z.toString()===Y.toString();if(J=Object.keys(Z),Q=J.length,Q!==Object.keys(Y).length)return!1;for(W=Q;W--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[W]))return!1;for(W=Q;W--!==0;){var G=J[W];if(!$(Z[G],Y[G]))return!1}return!0}return Z!==Z&&Y!==Y}});var YB=k((hr,ZB)=>{var b6=ZB.exports=function($,Z,Y){if(typeof Z=="function")Y=Z,Z={};Y=Z.cb||Y;var Q=typeof Y=="function"?Y:Y.pre||function(){},W=Y.post||function(){};i4(Z,Q,W,$,"",$)};b6.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};b6.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};b6.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};b6.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function i4($,Z,Y,Q,W,J,G,K,B,D){if(Q&&typeof Q=="object"&&!Array.isArray(Q)){Z(Q,W,J,G,K,B,D);for(var V in Q){var L=Q[V];if(Array.isArray(L)){if(V in b6.arrayKeywords)for(var A=0;A<L.length;A++)i4($,Z,Y,L[A],W+"/"+V+"/"+A,J,W,V,Q,A)}else if(V in b6.propsKeywords){if(L&&typeof L=="object")for(var O in L)i4($,Z,Y,L[O],W+"/"+V+"/"+B_(O),J,W,V,Q,O)}else if(V in b6.keywords||$.allKeys&&!(V in b6.skipKeywords))i4($,Z,Y,L,W+"/"+V,J,W,V,Q)}Y(Q,W,J,G,K,B,D)}}function B_($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}});var e9=k((JB)=>{Object.defineProperty(JB,"__esModule",{value:!0});JB.getSchemaRefs=JB.resolveUrl=JB.normalizeId=JB._getFullPath=JB.getFullPath=JB.inlineRef=void 0;var F_=G1(),D_=jX(),V_=YB(),L_=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function U_($,Z=!0){if(typeof $=="boolean")return!0;if(Z===!0)return!AX($);if(!Z)return!1;return QB($)<=Z}JB.inlineRef=U_;var j_=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function AX($){for(let Z in $){if(j_.has(Z))return!0;let Y=$[Z];if(Array.isArray(Y)&&Y.some(AX))return!0;if(typeof Y=="object"&&AX(Y))return!0}return!1}function QB($){let Z=0;for(let Y in $){if(Y==="$ref")return 1/0;if(Z++,L_.has(Y))continue;if(typeof $[Y]=="object")(0,F_.eachItem)($[Y],(Q)=>Z+=QB(Q));if(Z===1/0)return 1/0}return Z}function XB($,Z="",Y){if(Y!==!1)Z=l8(Z);let Q=$.parse(Z);return WB($,Q)}JB.getFullPath=XB;function WB($,Z){return $.serialize(Z).split("#")[0]+"#"}JB._getFullPath=WB;var A_=/#\/?$/;function l8($){return $?$.replace(A_,""):""}JB.normalizeId=l8;function z_($,Z,Y){return Y=l8(Y),$.resolve(Z,Y)}JB.resolveUrl=z_;var O_=/^[a-z_][-a-z0-9._]*$/i;function q_($,Z){if(typeof $=="boolean")return{};let{schemaId:Y,uriResolver:Q}=this.opts,W=l8($[Y]||Z),J={"":W},G=XB(Q,W,!1),K={},B=new Set;return V_($,{allKeys:!0},(L,A,O,q)=>{if(q===void 0)return;let M=G+A,I=J[q];if(typeof L[Y]=="string")I=N.call(this,L[Y]);E.call(this,L.$anchor),E.call(this,L.$dynamicAnchor),J[A]=I;function N(f){let v=this.opts.uriResolver.resolve;if(f=l8(I?v(I,f):f),B.has(f))throw V(f);B.add(f);let y=this.refs[f];if(typeof y=="string")y=this.refs[y];if(typeof y=="object")D(L,y.schema,f);else if(f!==l8(M))if(f[0]==="#")D(L,K[f],f),K[f]=L;else this.refs[f]=M;return f}function E(f){if(typeof f=="string"){if(!O_.test(f))throw Error(`invalid anchor "${f}"`);N.call(this,`#${f}`)}}}),K;function D(L,A,O){if(A!==void 0&&!D_(L,A))throw V(O)}function V(L){return Error(`reference "${L}" resolves to more than one schema`)}}JB.getSchemaRefs=q_});var Y7=k((MB)=>{Object.defineProperty(MB,"__esModule",{value:!0});MB.getData=MB.KeywordCxt=MB.validateFunctionCode=void 0;var DB=EH(),KB=t9(),OX=HX(),c4=t9(),R_=hH(),Z7=aH(),zX=eH(),m=Z1(),o=Q6(),__=e9(),X6=G1(),$7=s9();function C_($){if(UB($)){if(jB($),LB($)){S_($);return}}VB($,()=>(0,DB.topBoolOrEmptySchema)($))}MB.validateFunctionCode=C_;function VB({gen:$,validateName:Z,schema:Y,schemaEnv:Q,opts:W},J){if(W.code.es5)$.func(Z,m._`${o.default.data}, ${o.default.valCxt}`,Q.$async,()=>{$.code(m._`"use strict"; ${HB(Y,W)}`),f_($,W),$.code(J)});else $.func(Z,m._`${o.default.data}, ${I_(W)}`,Q.$async,()=>$.code(HB(Y,W)).code(J))}function I_($){return m._`{${o.default.instancePath}="", ${o.default.parentData}, ${o.default.parentDataProperty}, ${o.default.rootData}=${o.default.data}${$.dynamicRef?m._`, ${o.default.dynamicAnchors}={}`:m.nil}}={}`}function f_($,Z){$.if(o.default.valCxt,()=>{if($.var(o.default.instancePath,m._`${o.default.valCxt}.${o.default.instancePath}`),$.var(o.default.parentData,m._`${o.default.valCxt}.${o.default.parentData}`),$.var(o.default.parentDataProperty,m._`${o.default.valCxt}.${o.default.parentDataProperty}`),$.var(o.default.rootData,m._`${o.default.valCxt}.${o.default.rootData}`),Z.dynamicRef)$.var(o.default.dynamicAnchors,m._`${o.default.valCxt}.${o.default.dynamicAnchors}`)},()=>{if($.var(o.default.instancePath,m._`""`),$.var(o.default.parentData,m._`undefined`),$.var(o.default.parentDataProperty,m._`undefined`),$.var(o.default.rootData,o.default.data),Z.dynamicRef)$.var(o.default.dynamicAnchors,m._`{}`)})}function S_($){let{schema:Z,opts:Y,gen:Q}=$;VB($,()=>{if(Y.$comment&&Z.$comment)zB($);if(k_($),Q.let(o.default.vErrors,null),Q.let(o.default.errors,0),Y.unevaluated)b_($);AB($),u_($)});return}function b_($){let{gen:Z,validateName:Y}=$;$.evaluated=Z.const("evaluated",m._`${Y}.evaluated`),Z.if(m._`${$.evaluated}.dynamicProps`,()=>Z.assign(m._`${$.evaluated}.props`,m._`undefined`)),Z.if(m._`${$.evaluated}.dynamicItems`,()=>Z.assign(m._`${$.evaluated}.items`,m._`undefined`))}function HB($,Z){let Y=typeof $=="object"&&$[Z.schemaId];return Y&&(Z.code.source||Z.code.process)?m._`/*# sourceURL=${Y} */`:m.nil}function v_($,Z){if(UB($)){if(jB($),LB($)){y_($,Z);return}}(0,DB.boolOrEmptySchema)($,Z)}function LB({schema:$,self:Z}){if(typeof $=="boolean")return!$;for(let Y in $)if(Z.RULES.all[Y])return!0;return!1}function UB($){return typeof $.schema!="boolean"}function y_($,Z){let{schema:Y,gen:Q,opts:W}=$;if(W.$comment&&Y.$comment)zB($);x_($),g_($);let J=Q.const("_errs",o.default.errors);AB($,J),Q.var(Z,m._`${J} === ${o.default.errors}`)}function jB($){(0,X6.checkUnknownRules)($),T_($)}function AB($,Z){if($.opts.jtd)return BB($,[],!1,Z);let Y=(0,KB.getSchemaTypes)($.schema),Q=(0,KB.coerceAndCheckDataType)($,Y);BB($,Y,!Q,Z)}function T_($){let{schema:Z,errSchemaPath:Y,opts:Q,self:W}=$;if(Z.$ref&&Q.ignoreKeywordsWithRef&&(0,X6.schemaHasRulesButRef)(Z,W.RULES))W.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function k_($){let{schema:Z,opts:Y}=$;if(Z.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,X6.checkStrictMode)($,"default is ignored in the schema root")}function x_($){let Z=$.schema[$.opts.schemaId];if(Z)$.baseId=(0,__.resolveUrl)($.opts.uriResolver,$.baseId,Z)}function g_($){if($.schema.$async&&!$.schemaEnv.$async)throw Error("async schema in sync schema")}function zB({gen:$,schemaEnv:Z,schema:Y,errSchemaPath:Q,opts:W}){let J=Y.$comment;if(W.$comment===!0)$.code(m._`${o.default.self}.logger.log(${J})`);else if(typeof W.$comment=="function"){let G=m.str`${Q}/$comment`,K=$.scopeValue("root",{ref:Z.root});$.code(m._`${o.default.self}.opts.$comment(${J}, ${G}, ${K}.schema)`)}}function u_($){let{gen:Z,schemaEnv:Y,validateName:Q,ValidationError:W,opts:J}=$;if(Y.$async)Z.if(m._`${o.default.errors} === 0`,()=>Z.return(o.default.data),()=>Z.throw(m._`new ${W}(${o.default.vErrors})`));else{if(Z.assign(m._`${Q}.errors`,o.default.vErrors),J.unevaluated)h_($);Z.return(m._`${o.default.errors} === 0`)}}function h_({gen:$,evaluated:Z,props:Y,items:Q}){if(Y instanceof m.Name)$.assign(m._`${Z}.props`,Y);if(Q instanceof m.Name)$.assign(m._`${Z}.items`,Q)}function BB($,Z,Y,Q){let{gen:W,schema:J,data:G,allErrors:K,opts:B,self:D}=$,{RULES:V}=D;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,X6.schemaHasRulesButRef)(J,V))){W.block(()=>qB($,"$ref",V.all.$ref.definition));return}if(!B.jtd)m_($,Z);W.block(()=>{for(let A of V.rules)L(A);L(V.post)});function L(A){if(!(0,OX.shouldUseGroup)(J,A))return;if(A.type){if(W.if((0,c4.checkDataType)(A.type,G,B.strictNumbers)),FB($,A),Z.length===1&&Z[0]===A.type&&Y)W.else(),(0,c4.reportTypeError)($);W.endIf()}else FB($,A);if(!K)W.if(m._`${o.default.errors} === ${Q||0}`)}}function FB($,Z){let{gen:Y,schema:Q,opts:{useDefaults:W}}=$;if(W)(0,R_.assignDefaults)($,Z.type);Y.block(()=>{for(let J of Z.rules)if((0,OX.shouldUseRule)(Q,J))qB($,J.keyword,J.definition,Z.type)})}function m_($,Z){if($.schemaEnv.meta||!$.opts.strictTypes)return;if(l_($,Z),!$.opts.allowUnionTypes)p_($,Z);i_($,$.dataTypes)}function l_($,Z){if(!Z.length)return;if(!$.dataTypes.length){$.dataTypes=Z;return}Z.forEach((Y)=>{if(!OB($.dataTypes,Y))qX($,`type "${Y}" not allowed by context "${$.dataTypes.join(",")}"`)}),d_($,Z)}function p_($,Z){if(Z.length>1&&!(Z.length===2&&Z.includes("null")))qX($,"use allowUnionTypes to allow union type keyword")}function i_($,Z){let Y=$.self.RULES.all;for(let Q in Y){let W=Y[Q];if(typeof W=="object"&&(0,OX.shouldUseRule)($.schema,W)){let{type:J}=W.definition;if(J.length&&!J.some((G)=>c_(Z,G)))qX($,`missing type "${J.join(",")}" for keyword "${Q}"`)}}}function c_($,Z){return $.includes(Z)||Z==="number"&&$.includes("integer")}function OB($,Z){return $.includes(Z)||Z==="integer"&&$.includes("number")}function d_($,Z){let Y=[];for(let Q of $.dataTypes)if(OB(Z,Q))Y.push(Q);else if(Z.includes("integer")&&Q==="number")Y.push("integer");$.dataTypes=Y}function qX($,Z){let Y=$.schemaEnv.baseId+$.errSchemaPath;Z+=` at "${Y}" (strictTypes)`,(0,X6.checkStrictMode)($,Z,$.opts.strictTypes)}class NX{constructor($,Z,Y){if((0,Z7.validateKeywordUsage)($,Z,Y),this.gen=$.gen,this.allErrors=$.allErrors,this.keyword=Y,this.data=$.data,this.schema=$.schema[Y],this.$data=Z.$data&&$.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,X6.schemaRefOrVal)($,this.schema,Y,this.$data),this.schemaType=Z.schemaType,this.parentSchema=$.schema,this.params={},this.it=$,this.def=Z,this.$data)this.schemaCode=$.gen.const("vSchema",NB(this.$data,$));else if(this.schemaCode=this.schemaValue,!(0,Z7.validSchemaType)(this.schema,Z.schemaType,Z.allowUndefined))throw Error(`${Y} value must be ${JSON.stringify(Z.schemaType)}`);if("code"in Z?Z.trackErrors:Z.errors!==!1)this.errsCount=$.gen.const("_errs",o.default.errors)}result($,Z,Y){this.failResult((0,m.not)($),Z,Y)}failResult($,Z,Y){if(this.gen.if($),Y)Y();else this.error();if(Z){if(this.gen.else(),Z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass($,Z){this.failResult((0,m.not)($),void 0,Z)}fail($){if($===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if($),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data($){if(!this.$data)return this.fail($);let{schemaCode:Z}=this;this.fail(m._`${Z} !== undefined && (${(0,m.or)(this.invalid$data(),$)})`)}error($,Z,Y){if(Z){this.setParams(Z),this._error($,Y),this.setParams({});return}this._error($,Y)}_error($,Z){($?$7.reportExtraError:$7.reportError)(this,this.def.error,Z)}$dataError(){(0,$7.reportError)(this,this.def.$dataError||$7.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,$7.resetErrorsCount)(this.gen,this.errsCount)}ok($){if(!this.allErrors)this.gen.if($)}setParams($,Z){if(Z)Object.assign(this.params,$);else this.params=$}block$data($,Z,Y=m.nil){this.gen.block(()=>{this.check$data($,Y),Z()})}check$data($=m.nil,Z=m.nil){if(!this.$data)return;let{gen:Y,schemaCode:Q,schemaType:W,def:J}=this;if(Y.if((0,m.or)(m._`${Q} === undefined`,Z)),$!==m.nil)Y.assign($,!0);if(W.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),$!==m.nil)Y.assign($,!1)}Y.else()}invalid$data(){let{gen:$,schemaCode:Z,schemaType:Y,def:Q,it:W}=this;return(0,m.or)(J(),G());function J(){if(Y.length){if(!(Z instanceof m.Name))throw Error("ajv implementation error");let K=Array.isArray(Y)?Y:[Y];return m._`${(0,c4.checkDataTypes)(K,Z,W.opts.strictNumbers,c4.DataType.Wrong)}`}return m.nil}function G(){if(Q.validateSchema){let K=$.scopeValue("validate$data",{ref:Q.validateSchema});return m._`!${K}(${Z})`}return m.nil}}subschema($,Z){let Y=(0,zX.getSubschema)(this.it,$);(0,zX.extendSubschemaData)(Y,this.it,$),(0,zX.extendSubschemaMode)(Y,$);let Q={...this.it,...Y,items:void 0,props:void 0};return v_(Q,Z),Q}mergeEvaluated($,Z){let{it:Y,gen:Q}=this;if(!Y.opts.unevaluated)return;if(Y.props!==!0&&$.props!==void 0)Y.props=X6.mergeEvaluated.props(Q,$.props,Y.props,Z);if(Y.items!==!0&&$.items!==void 0)Y.items=X6.mergeEvaluated.items(Q,$.items,Y.items,Z)}mergeValidEvaluated($,Z){let{it:Y,gen:Q}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return Q.if(Z,()=>this.mergeEvaluated($,m.Name)),!0}}MB.KeywordCxt=NX;function qB($,Z,Y,Q){let W=new NX($,Y,Z);if("code"in Y)Y.code(W,Q);else if(W.$data&&Y.validate)(0,Z7.funcKeywordCode)(W,Y);else if("macro"in Y)(0,Z7.macroKeywordCode)(W,Y);else if(Y.compile||Y.validate)(0,Z7.funcKeywordCode)(W,Y)}var n_=/^\/(?:[^~]|~0|~1)*$/,r_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function NB($,{dataLevel:Z,dataNames:Y,dataPathArr:Q}){let W,J;if($==="")return o.default.rootData;if($[0]==="/"){if(!n_.test($))throw Error(`Invalid JSON-pointer: ${$}`);W=$,J=o.default.rootData}else{let D=r_.exec($);if(!D)throw Error(`Invalid JSON-pointer: ${$}`);let V=+D[1];if(W=D[2],W==="#"){if(V>=Z)throw Error(B("property/index",V));return Q[Z-V]}if(V>Z)throw Error(B("data",V));if(J=Y[Z-V],!W)return J}let G=J,K=W.split("/");for(let D of K)if(D)J=m._`${J}${(0,m.getProperty)((0,X6.unescapeJsonPointer)(D))}`,G=m._`${G} && ${J}`;return G;function B(D,V){return`Cannot access ${D} ${V} levels up, current level is ${Z}`}}MB.getData=NB});var d4=k((EB)=>{Object.defineProperty(EB,"__esModule",{value:!0});class wB extends Error{constructor($){super("validation failed");this.errors=$,this.ajv=this.validation=!0}}EB.default=wB});var Q7=k((_B)=>{Object.defineProperty(_B,"__esModule",{value:!0});var MX=e9();class RB extends Error{constructor($,Z,Y,Q){super(Q||`can't resolve reference ${Y} from id ${Z}`);this.missingRef=(0,MX.resolveUrl)($,Z,Y),this.missingSchema=(0,MX.normalizeId)((0,MX.getFullPath)($,this.missingRef))}}_B.default=RB});var r4=k((fB)=>{Object.defineProperty(fB,"__esModule",{value:!0});fB.resolveSchema=fB.getCompilingSchema=fB.resolveRef=fB.compileSchema=fB.SchemaEnv=void 0;var I0=Z1(),e_=d4(),t6=Q6(),f0=e9(),CB=G1(),$C=Y7();class X7{constructor($){var Z;this.refs={},this.dynamicAnchors={};let Y;if(typeof $.schema=="object")Y=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(Z=$.baseId)!==null&&Z!==void 0?Z:(0,f0.normalizeId)(Y===null||Y===void 0?void 0:Y[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=Y===null||Y===void 0?void 0:Y.$async,this.refs={}}}fB.SchemaEnv=X7;function wX($){let Z=IB.call(this,$);if(Z)return Z;let Y=(0,f0.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:Q,lines:W}=this.opts.code,{ownProperties:J}=this.opts,G=new I0.CodeGen(this.scope,{es5:Q,lines:W,ownProperties:J}),K;if($.$async)K=G.scopeValue("Error",{ref:e_.default,code:I0._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");$.validateName=B;let D={gen:G,allErrors:this.opts.allErrors,data:t6.default.data,parentData:t6.default.parentData,parentDataProperty:t6.default.parentDataProperty,dataNames:[t6.default.data],dataPathArr:[I0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,I0.stringify)($.schema)}:{ref:$.schema}),validateName:B,ValidationError:K,schema:$.schema,schemaEnv:$,rootId:Y,baseId:$.baseId||Y,schemaPath:I0.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:I0._`""`,opts:this.opts,self:this},V;try{this._compilations.add($),(0,$C.validateFunctionCode)(D),G.optimize(this.opts.code.optimize);let L=G.toString();if(V=`${G.scopeRefs(t6.default.scope)}return ${L}`,this.opts.code.process)V=this.opts.code.process(V,$);let O=Function(`${t6.default.self}`,`${t6.default.scope}`,V)(this,this.scope.get());if(this.scope.value(B,{ref:O}),O.errors=null,O.schema=$.schema,O.schemaEnv=$,$.$async)O.$async=!0;if(this.opts.code.source===!0)O.source={validateName:B,validateCode:L,scopeValues:G._values};if(this.opts.unevaluated){let{props:q,items:M}=D;if(O.evaluated={props:q instanceof I0.Name?void 0:q,items:M instanceof I0.Name?void 0:M,dynamicProps:q instanceof I0.Name,dynamicItems:M instanceof I0.Name},O.source)O.source.evaluated=(0,I0.stringify)(O.evaluated)}return $.validate=O,$}catch(L){if(delete $.validate,delete $.validateName,V)this.logger.error("Error compiling schema, function code:",V);throw L}finally{this._compilations.delete($)}}fB.compileSchema=wX;function ZC($,Z,Y){var Q;Y=(0,f0.resolveUrl)(this.opts.uriResolver,Z,Y);let W=$.refs[Y];if(W)return W;let J=XC.call(this,$,Y);if(J===void 0){let G=(Q=$.localRefs)===null||Q===void 0?void 0:Q[Y],{schemaId:K}=this.opts;if(G)J=new X7({schema:G,schemaId:K,root:$,baseId:Z})}if(J===void 0)return;return $.refs[Y]=YC.call(this,J)}fB.resolveRef=ZC;function YC($){if((0,f0.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:wX.call(this,$)}function IB($){for(let Z of this._compilations)if(QC(Z,$))return Z}fB.getCompilingSchema=IB;function QC($,Z){return $.schema===Z.schema&&$.root===Z.root&&$.baseId===Z.baseId}function XC($,Z){let Y;while(typeof(Y=this.refs[Z])=="string")Z=Y;return Y||this.schemas[Z]||n4.call(this,$,Z)}function n4($,Z){let Y=this.opts.uriResolver.parse(Z),Q=(0,f0._getFullPath)(this.opts.uriResolver,Y),W=(0,f0.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&Q===W)return PX.call(this,Y,$);let J=(0,f0.normalizeId)(Q),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let K=n4.call(this,$,G);if(typeof(K===null||K===void 0?void 0:K.schema)!=="object")return;return PX.call(this,Y,K)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)wX.call(this,G);if(J===(0,f0.normalizeId)(Z)){let{schema:K}=G,{schemaId:B}=this.opts,D=K[B];if(D)W=(0,f0.resolveUrl)(this.opts.uriResolver,W,D);return new X7({schema:K,schemaId:B,root:$,baseId:W})}return PX.call(this,Y,G)}fB.resolveSchema=n4;var WC=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function PX($,{baseId:Z,schema:Y,root:Q}){var W;if(((W=$.fragment)===null||W===void 0?void 0:W[0])!=="/")return;for(let K of $.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,CB.unescapeFragment)(K)];if(B===void 0)return;Y=B;let D=typeof Y==="object"&&Y[this.opts.schemaId];if(!WC.has(K)&&D)Z=(0,f0.resolveUrl)(this.opts.uriResolver,Z,D)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,CB.schemaHasRulesButRef)(Y,this.RULES)){let K=(0,f0.resolveUrl)(this.opts.uriResolver,Z,Y.$ref);J=n4.call(this,Q,K)}let{schemaId:G}=this.opts;if(J=J||new X7({schema:Y,schemaId:G,root:Q,baseId:Z}),J.schema!==J.root.schema)return J;return}});var bB=k((dr,BC)=>{BC.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var RX=k((nr,kB)=>{var FC=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),yB=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function EX($){let Z="",Y=0,Q=0;for(Q=0;Q<$.length;Q++){if(Y=$[Q].charCodeAt(0),Y===48)continue;if(!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";Z+=$[Q];break}for(Q+=1;Q<$.length;Q++){if(Y=$[Q].charCodeAt(0),!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";Z+=$[Q]}return Z}var DC=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function vB($){return $.length=0,!0}function VC($,Z,Y){if($.length){let Q=EX($);if(Q!=="")Z.push(Q);else return Y.error=!0,!1;$.length=0}return!0}function LC($){let Z=0,Y={error:!1,address:"",zone:""},Q=[],W=[],J=!1,G=!1,K=VC;for(let B=0;B<$.length;B++){let D=$[B];if(D==="["||D==="]")continue;if(D===":"){if(J===!0)G=!0;if(!K(W,Q,Y))break;if(++Z>7){Y.error=!0;break}if(B>0&&$[B-1]===":")J=!0;Q.push(":");continue}else if(D==="%"){if(!K(W,Q,Y))break;K=vB}else{W.push(D);continue}}if(W.length)if(K===vB)Y.zone=W.join("");else if(G)Q.push(W.join(""));else Q.push(EX(W));return Y.address=Q.join(""),Y}function TB($){if(UC($,":")<2)return{host:$,isIPV6:!1};let Z=LC($);if(!Z.error){let{address:Y,address:Q}=Z;if(Z.zone)Y+="%"+Z.zone,Q+="%25"+Z.zone;return{host:Y,isIPV6:!0,escapedHost:Q}}else return{host:$,isIPV6:!1}}function UC($,Z){let Y=0;for(let Q=0;Q<$.length;Q++)if($[Q]===Z)Y++;return Y}function jC($){let Z=$,Y=[],Q=-1,W=0;while(W=Z.length){if(W===1)if(Z===".")break;else if(Z==="/"){Y.push("/");break}else{Y.push(Z);break}else if(W===2){if(Z[0]==="."){if(Z[1]===".")break;else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."||Z[1]==="/"){Y.push("/");break}}}else if(W===3){if(Z==="/.."){if(Y.length!==0)Y.pop();Y.push("/");break}}if(Z[0]==="."){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(3);continue}}else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(2);continue}else if(Z[2]==="."){if(Z[3]==="/"){if(Z=Z.slice(3),Y.length!==0)Y.pop();continue}}}}if((Q=Z.indexOf("/",1))===-1){Y.push(Z);break}else Y.push(Z.slice(0,Q)),Z=Z.slice(Q)}return Y.join("")}function AC($,Z){let Y=Z!==!0?escape:unescape;if($.scheme!==void 0)$.scheme=Y($.scheme);if($.userinfo!==void 0)$.userinfo=Y($.userinfo);if($.host!==void 0)$.host=Y($.host);if($.path!==void 0)$.path=Y($.path);if($.query!==void 0)$.query=Y($.query);if($.fragment!==void 0)$.fragment=Y($.fragment);return $}function zC($){let Z=[];if($.userinfo!==void 0)Z.push($.userinfo),Z.push("@");if($.host!==void 0){let Y=unescape($.host);if(!yB(Y)){let Q=TB(Y);if(Q.isIPV6===!0)Y=`[${Q.escapedHost}]`;else Y=$.host}Z.push(Y)}if(typeof $.port==="number"||typeof $.port==="string")Z.push(":"),Z.push(String($.port));return Z.length?Z.join(""):void 0}kB.exports={nonSimpleDomain:DC,recomposeAuthority:zC,normalizeComponentEncoding:AC,removeDotSegments:jC,isIPv4:yB,isUUID:FC,normalizeIPv6:TB,stringArrayToHexStripped:EX}});var mB=k((rr,hB)=>{var{isUUID:OC}=RX(),qC=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,NC=["http","https","ws","wss","urn","urn:uuid"];function MC($){return NC.indexOf($)!==-1}function _X($){if($.secure===!0)return!0;else if($.secure===!1)return!1;else if($.scheme)return $.scheme.length===3&&($.scheme[0]==="w"||$.scheme[0]==="W")&&($.scheme[1]==="s"||$.scheme[1]==="S")&&($.scheme[2]==="s"||$.scheme[2]==="S");else return!1}function xB($){if(!$.host)$.error=$.error||"HTTP URIs must have a host.";return $}function gB($){let Z=String($.scheme).toLowerCase()==="https";if($.port===(Z?443:80)||$.port==="")$.port=void 0;if(!$.path)$.path="/";return $}function PC($){return $.secure=_X($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$}function wC($){if($.port===(_X($)?443:80)||$.port==="")$.port=void 0;if(typeof $.secure==="boolean")$.scheme=$.secure?"wss":"ws",$.secure=void 0;if($.resourceName){let[Z,Y]=$.resourceName.split("?");$.path=Z&&Z!=="/"?Z:void 0,$.query=Y,$.resourceName=void 0}return $.fragment=void 0,$}function EC($,Z){if(!$.path)return $.error="URN can not be parsed",$;let Y=$.path.match(qC);if(Y){let Q=Z.scheme||$.scheme||"urn";$.nid=Y[1].toLowerCase(),$.nss=Y[2];let W=`${Q}:${Z.nid||$.nid}`,J=CX(W);if($.path=void 0,J)$=J.parse($,Z)}else $.error=$.error||"URN can not be parsed.";return $}function RC($,Z){if($.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=Z.scheme||$.scheme||"urn",Q=$.nid.toLowerCase(),W=`${Y}:${Z.nid||Q}`,J=CX(W);if(J)$=J.serialize($,Z);let G=$,K=$.nss;return G.path=`${Q||Z.nid}:${K}`,Z.skipEscape=!0,G}function _C($,Z){let Y=$;if(Y.uuid=Y.nss,Y.nss=void 0,!Z.tolerant&&(!Y.uuid||!OC(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function CC($){let Z=$;return Z.nss=($.uuid||"").toLowerCase(),Z}var uB={scheme:"http",domainHost:!0,parse:xB,serialize:gB},IC={scheme:"https",domainHost:uB.domainHost,parse:xB,serialize:gB},a4={scheme:"ws",domainHost:!0,parse:PC,serialize:wC},fC={scheme:"wss",domainHost:a4.domainHost,parse:a4.parse,serialize:a4.serialize},SC={scheme:"urn",parse:EC,serialize:RC,skipNormalize:!0},bC={scheme:"urn:uuid",parse:_C,serialize:CC,skipNormalize:!0},o4={http:uB,https:IC,ws:a4,wss:fC,urn:SC,"urn:uuid":bC};Object.setPrototypeOf(o4,null);function CX($){return $&&(o4[$]||o4[$.toLowerCase()])||void 0}hB.exports={wsIsSecure:_X,SCHEMES:o4,isValidSchemeName:MC,getSchemeHandler:CX}});var iB=k((ar,t4)=>{var{normalizeIPv6:vC,removeDotSegments:W7,recomposeAuthority:yC,normalizeComponentEncoding:s4,isIPv4:TC,nonSimpleDomain:kC}=RX(),{SCHEMES:xC,getSchemeHandler:lB}=mB();function gC($,Z){if(typeof $==="string")$=m0(W6($,Z),Z);else if(typeof $==="object")$=W6(m0($,Z),Z);return $}function uC($,Z,Y){let Q=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},W=pB(W6($,Q),W6(Z,Q),Q,!0);return Q.skipEscape=!0,m0(W,Q)}function pB($,Z,Y,Q){let W={};if(!Q)$=W6(m0($,Y),Y),Z=W6(m0(Z,Y),Y);if(Y=Y||{},!Y.tolerant&&Z.scheme)W.scheme=Z.scheme,W.userinfo=Z.userinfo,W.host=Z.host,W.port=Z.port,W.path=W7(Z.path||""),W.query=Z.query;else{if(Z.userinfo!==void 0||Z.host!==void 0||Z.port!==void 0)W.userinfo=Z.userinfo,W.host=Z.host,W.port=Z.port,W.path=W7(Z.path||""),W.query=Z.query;else{if(!Z.path)if(W.path=$.path,Z.query!==void 0)W.query=Z.query;else W.query=$.query;else{if(Z.path[0]==="/")W.path=W7(Z.path);else{if(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path)W.path="/"+Z.path;else if(!$.path)W.path=Z.path;else W.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+Z.path;W.path=W7(W.path)}W.query=Z.query}W.userinfo=$.userinfo,W.host=$.host,W.port=$.port}W.scheme=$.scheme}return W.fragment=Z.fragment,W}function hC($,Z,Y){if(typeof $==="string")$=unescape($),$=m0(s4(W6($,Y),!0),{...Y,skipEscape:!0});else if(typeof $==="object")$=m0(s4($,!0),{...Y,skipEscape:!0});if(typeof Z==="string")Z=unescape(Z),Z=m0(s4(W6(Z,Y),!0),{...Y,skipEscape:!0});else if(typeof Z==="object")Z=m0(s4(Z,!0),{...Y,skipEscape:!0});return $.toLowerCase()===Z.toLowerCase()}function m0($,Z){let Y={host:$.host,scheme:$.scheme,userinfo:$.userinfo,port:$.port,path:$.path,query:$.query,nid:$.nid,nss:$.nss,uuid:$.uuid,fragment:$.fragment,reference:$.reference,resourceName:$.resourceName,secure:$.secure,error:""},Q=Object.assign({},Z),W=[],J=lB(Q.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,Q);if(Y.path!==void 0)if(!Q.skipEscape){if(Y.path=escape(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=unescape(Y.path);if(Q.reference!=="suffix"&&Y.scheme)W.push(Y.scheme,":");let G=yC(Y);if(G!==void 0){if(Q.reference!=="suffix")W.push("//");if(W.push(G),Y.path&&Y.path[0]!=="/")W.push("/")}if(Y.path!==void 0){let K=Y.path;if(!Q.absolutePath&&(!J||!J.absolutePath))K=W7(K);if(G===void 0&&K[0]==="/"&&K[1]==="/")K="/%2F"+K.slice(2);W.push(K)}if(Y.query!==void 0)W.push("?",Y.query);if(Y.fragment!==void 0)W.push("#",Y.fragment);return W.join("")}var mC=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function W6($,Z){let Y=Object.assign({},Z),Q={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},W=!1;if(Y.reference==="suffix")if(Y.scheme)$=Y.scheme+":"+$;else $="//"+$;let J=$.match(mC);if(J){if(Q.scheme=J[1],Q.userinfo=J[3],Q.host=J[4],Q.port=parseInt(J[5],10),Q.path=J[6]||"",Q.query=J[7],Q.fragment=J[8],isNaN(Q.port))Q.port=J[5];if(Q.host)if(TC(Q.host)===!1){let B=vC(Q.host);Q.host=B.host.toLowerCase(),W=B.isIPV6}else W=!0;if(Q.scheme===void 0&&Q.userinfo===void 0&&Q.host===void 0&&Q.port===void 0&&Q.query===void 0&&!Q.path)Q.reference="same-document";else if(Q.scheme===void 0)Q.reference="relative";else if(Q.fragment===void 0)Q.reference="absolute";else Q.reference="uri";if(Y.reference&&Y.reference!=="suffix"&&Y.reference!==Q.reference)Q.error=Q.error||"URI is not a "+Y.reference+" reference.";let G=lB(Y.scheme||Q.scheme);if(!Y.unicodeSupport&&(!G||!G.unicodeSupport)){if(Q.host&&(Y.domainHost||G&&G.domainHost)&&W===!1&&kC(Q.host))try{Q.host=URL.domainToASCII(Q.host.toLowerCase())}catch(K){Q.error=Q.error||"Host's domain name can not be converted to ASCII: "+K}}if(!G||G&&!G.skipNormalize){if($.indexOf("%")!==-1){if(Q.scheme!==void 0)Q.scheme=unescape(Q.scheme);if(Q.host!==void 0)Q.host=unescape(Q.host)}if(Q.path)Q.path=escape(unescape(Q.path));if(Q.fragment)Q.fragment=encodeURI(decodeURIComponent(Q.fragment))}if(G&&G.parse)G.parse(Q,Y)}else Q.error=Q.error||"URI can not be parsed.";return Q}var IX={SCHEMES:xC,normalize:gC,resolve:uC,resolveComponent:pB,equal:hC,serialize:m0,parse:W6};t4.exports=IX;t4.exports.default=IX;t4.exports.fastUri=IX});var nB=k((dB)=>{Object.defineProperty(dB,"__esModule",{value:!0});var cB=iB();cB.code='require("ajv/dist/runtime/uri").default';dB.default=cB});var ZF=k((J6)=>{Object.defineProperty(J6,"__esModule",{value:!0});J6.CodeGen=J6.Name=J6.nil=J6.stringify=J6.str=J6._=J6.KeywordCxt=void 0;var pC=Y7();Object.defineProperty(J6,"KeywordCxt",{enumerable:!0,get:function(){return pC.KeywordCxt}});var p8=Z1();Object.defineProperty(J6,"_",{enumerable:!0,get:function(){return p8._}});Object.defineProperty(J6,"str",{enumerable:!0,get:function(){return p8.str}});Object.defineProperty(J6,"stringify",{enumerable:!0,get:function(){return p8.stringify}});Object.defineProperty(J6,"nil",{enumerable:!0,get:function(){return p8.nil}});Object.defineProperty(J6,"Name",{enumerable:!0,get:function(){return p8.Name}});Object.defineProperty(J6,"CodeGen",{enumerable:!0,get:function(){return p8.CodeGen}});var iC=d4(),tB=Q7(),cC=KX(),J7=r4(),dC=Z1(),G7=e9(),e4=t9(),SX=G1(),rB=bB(),nC=nB(),eB=($,Z)=>new RegExp($,Z);eB.code="new RegExp";var rC=["removeAdditional","useDefaults","coerceTypes"],aC=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),oC={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},sC={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},aB=200;function tC($){var Z,Y,Q,W,J,G,K,B,D,V,L,A,O,q,M,I,N,E,f,v,y,$1,j1,X0,F0;let _1=$.strict,W0=(Z=$.code)===null||Z===void 0?void 0:Z.optimize,o0=W0===!0||W0===void 0?1:W0||0,s0=(Q=(Y=$.code)===null||Y===void 0?void 0:Y.regExp)!==null&&Q!==void 0?Q:eB,q6=(W=$.uriResolver)!==null&&W!==void 0?W:nC.default;return{strictSchema:(G=(J=$.strictSchema)!==null&&J!==void 0?J:_1)!==null&&G!==void 0?G:!0,strictNumbers:(B=(K=$.strictNumbers)!==null&&K!==void 0?K:_1)!==null&&B!==void 0?B:!0,strictTypes:(V=(D=$.strictTypes)!==null&&D!==void 0?D:_1)!==null&&V!==void 0?V:"log",strictTuples:(A=(L=$.strictTuples)!==null&&L!==void 0?L:_1)!==null&&A!==void 0?A:"log",strictRequired:(q=(O=$.strictRequired)!==null&&O!==void 0?O:_1)!==null&&q!==void 0?q:!1,code:$.code?{...$.code,optimize:o0,regExp:s0}:{optimize:o0,regExp:s0},loopRequired:(M=$.loopRequired)!==null&&M!==void 0?M:aB,loopEnum:(I=$.loopEnum)!==null&&I!==void 0?I:aB,meta:(N=$.meta)!==null&&N!==void 0?N:!0,messages:(E=$.messages)!==null&&E!==void 0?E:!0,inlineRefs:(f=$.inlineRefs)!==null&&f!==void 0?f:!0,schemaId:(v=$.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(y=$.addUsedSchema)!==null&&y!==void 0?y:!0,validateSchema:($1=$.validateSchema)!==null&&$1!==void 0?$1:!0,validateFormats:(j1=$.validateFormats)!==null&&j1!==void 0?j1:!0,unicodeRegExp:(X0=$.unicodeRegExp)!==null&&X0!==void 0?X0:!0,int32range:(F0=$.int32range)!==null&&F0!==void 0?F0:!0,uriResolver:q6}}class $5{constructor($={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...tC($)};let{es5:Z,lines:Y}=this.opts.code;this.scope=new dC.ValueScope({scope:{},prefixes:aC,es5:Z,lines:Y}),this.logger=XI($.logger);let Q=$.validateFormats;if($.validateFormats=!1,this.RULES=(0,cC.getRules)(),oB.call(this,oC,$,"NOT SUPPORTED"),oB.call(this,sC,$,"DEPRECATED","warn"),this._metaOpts=YI.call(this),$.formats)$I.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords)ZI.call(this,$.keywords);if(typeof $.meta=="object")this.addMetaSchema($.meta);eC.call(this),$.validateFormats=Q}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:Z,schemaId:Y}=this.opts,Q=rB;if(Y==="id")Q={...rB},Q.id=Q.$id,delete Q.$id;if(Z&&$)this.addMetaSchema(Q,Q[Y],!1)}defaultMeta(){let{meta:$,schemaId:Z}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[Z]||$:void 0}validate($,Z){let Y;if(typeof $=="string"){if(Y=this.getSchema($),!Y)throw Error(`no schema with key or ref "${$}"`)}else Y=this.compile($);let Q=Y(Z);if(!("$async"in Y))this.errors=Y.errors;return Q}compile($,Z){let Y=this._addSchema($,Z);return Y.validate||this._compileSchemaEnv(Y)}compileAsync($,Z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:Y}=this.opts;return Q.call(this,$,Z);async function Q(D,V){await W.call(this,D.$schema);let L=this._addSchema(D,V);return L.validate||J.call(this,L)}async function W(D){if(D&&!this.getSchema(D))await Q.call(this,{$ref:D},!0)}async function J(D){try{return this._compileSchemaEnv(D)}catch(V){if(!(V instanceof tB.default))throw V;return G.call(this,V),await K.call(this,V.missingSchema),J.call(this,D)}}function G({missingSchema:D,missingRef:V}){if(this.refs[D])throw Error(`AnySchema ${D} is loaded but ${V} cannot be resolved`)}async function K(D){let V=await B.call(this,D);if(!this.refs[D])await W.call(this,V.$schema);if(!this.refs[D])this.addSchema(V,D,Z)}async function B(D){let V=this._loading[D];if(V)return V;try{return await(this._loading[D]=Y(D))}finally{delete this._loading[D]}}}addSchema($,Z,Y,Q=this.opts.validateSchema){if(Array.isArray($)){for(let J of $)this.addSchema(J,void 0,Y,Q);return this}let W;if(typeof $==="object"){let{schemaId:J}=this.opts;if(W=$[J],W!==void 0&&typeof W!="string")throw Error(`schema ${J} must be string`)}return Z=(0,G7.normalizeId)(Z||W),this._checkUnique(Z),this.schemas[Z]=this._addSchema($,Y,Z,Q,!0),this}addMetaSchema($,Z,Y=this.opts.validateSchema){return this.addSchema($,Z,!0,Y),this}validateSchema($,Z){if(typeof $=="boolean")return!0;let Y;if(Y=$.$schema,Y!==void 0&&typeof Y!="string")throw Error("$schema must be a string");if(Y=Y||this.opts.defaultMeta||this.defaultMeta(),!Y)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Q=this.validate(Y,$);if(!Q&&Z){let W="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(W);else throw Error(W)}return Q}getSchema($){let Z;while(typeof(Z=sB.call(this,$))=="string")$=Z;if(Z===void 0){let{schemaId:Y}=this.opts,Q=new J7.SchemaEnv({schema:{},schemaId:Y});if(Z=J7.resolveSchema.call(this,Q,$),!Z)return;this.refs[$]=Z}return Z.validate||this._compileSchemaEnv(Z)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let Z=sB.call(this,$);if(typeof Z=="object")this._cache.delete(Z.schema);return delete this.schemas[$],delete this.refs[$],this}case"object":{let Z=$;this._cache.delete(Z);let Y=$[this.opts.schemaId];if(Y)Y=(0,G7.normalizeId)(Y),delete this.schemas[Y],delete this.refs[Y];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let Z of $)this.addKeyword(Z);return this}addKeyword($,Z){let Y;if(typeof $=="string"){if(Y=$,typeof Z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Z.keyword=Y}else if(typeof $=="object"&&Z===void 0){if(Z=$,Y=Z.keyword,Array.isArray(Y)&&!Y.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(JI.call(this,Y,Z),!Z)return(0,SX.eachItem)(Y,(W)=>fX.call(this,W)),this;KI.call(this,Z);let Q={...Z,type:(0,e4.getJSONTypes)(Z.type),schemaType:(0,e4.getJSONTypes)(Z.schemaType)};return(0,SX.eachItem)(Y,Q.type.length===0?(W)=>fX.call(this,W,Q):(W)=>Q.type.forEach((J)=>fX.call(this,W,Q,J))),this}getKeyword($){let Z=this.RULES.all[$];return typeof Z=="object"?Z.definition:!!Z}removeKeyword($){let{RULES:Z}=this;delete Z.keywords[$],delete Z.all[$];for(let Y of Z.rules){let Q=Y.rules.findIndex((W)=>W.keyword===$);if(Q>=0)Y.rules.splice(Q,1)}return this}addFormat($,Z){if(typeof Z=="string")Z=new RegExp(Z);return this.formats[$]=Z,this}errorsText($=this.errors,{separator:Z=", ",dataVar:Y="data"}={}){if(!$||$.length===0)return"No errors";return $.map((Q)=>`${Y}${Q.instancePath} ${Q.message}`).reduce((Q,W)=>Q+Z+W)}$dataMetaSchema($,Z){let Y=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let Q of Z){let W=Q.split("/").slice(1),J=$;for(let G of W)J=J[G];for(let G in Y){let K=Y[G];if(typeof K!="object")continue;let{$data:B}=K.definition,D=J[G];if(B&&D)J[G]=$F(D)}}return $}_removeAllSchemas($,Z){for(let Y in $){let Q=$[Y];if(!Z||Z.test(Y)){if(typeof Q=="string")delete $[Y];else if(Q&&!Q.meta)this._cache.delete(Q.schema),delete $[Y]}}}_addSchema($,Z,Y,Q=this.opts.validateSchema,W=this.opts.addUsedSchema){let J,{schemaId:G}=this.opts;if(typeof $=="object")J=$[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof $!="boolean")throw Error("schema must be object or boolean");let K=this._cache.get($);if(K!==void 0)return K;Y=(0,G7.normalizeId)(J||Y);let B=G7.getSchemaRefs.call(this,$,Y);if(K=new J7.SchemaEnv({schema:$,schemaId:G,meta:Z,baseId:Y,localRefs:B}),this._cache.set(K.schema,K),W&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=K}if(Q)this.validateSchema($,!0);return K}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta)this._compileMetaSchema($);else J7.compileSchema.call(this,$);if(!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let Z=this.opts;this.opts=this._metaOpts;try{J7.compileSchema.call(this,$)}finally{this.opts=Z}}}$5.ValidationError=iC.default;$5.MissingRefError=tB.default;J6.default=$5;function oB($,Z,Y,Q="error"){for(let W in $){let J=W;if(J in Z)this.logger[Q](`${Y}: option ${W}. ${$[J]}`)}}function sB($){return $=(0,G7.normalizeId)($),this.schemas[$]||this.refs[$]}function eC(){let $=this.opts.schemas;if(!$)return;if(Array.isArray($))this.addSchema($);else for(let Z in $)this.addSchema($[Z],Z)}function $I(){for(let $ in this.opts.formats){let Z=this.opts.formats[$];if(Z)this.addFormat($,Z)}}function ZI($){if(Array.isArray($)){this.addVocabulary($);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Z in $){let Y=$[Z];if(!Y.keyword)Y.keyword=Z;this.addKeyword(Y)}}function YI(){let $={...this.opts};for(let Z of rC)delete $[Z];return $}var QI={log(){},warn(){},error(){}};function XI($){if($===!1)return QI;if($===void 0)return console;if($.log&&$.warn&&$.error)return $;throw Error("logger must implement log, warn and error methods")}var WI=/^[a-z_$][a-z0-9_$:-]*$/i;function JI($,Z){let{RULES:Y}=this;if((0,SX.eachItem)($,(Q)=>{if(Y.keywords[Q])throw Error(`Keyword ${Q} is already defined`);if(!WI.test(Q))throw Error(`Keyword ${Q} has invalid name`)}),!Z)return;if(Z.$data&&!(("code"in Z)||("validate"in Z)))throw Error('$data keyword must have "code" or "validate" function')}function fX($,Z,Y){var Q;let W=Z===null||Z===void 0?void 0:Z.post;if(Y&&W)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=W?J.post:J.rules.find(({type:B})=>B===Y);if(!G)G={type:Y,rules:[]},J.rules.push(G);if(J.keywords[$]=!0,!Z)return;let K={keyword:$,definition:{...Z,type:(0,e4.getJSONTypes)(Z.type),schemaType:(0,e4.getJSONTypes)(Z.schemaType)}};if(Z.before)GI.call(this,G,K,Z.before);else G.rules.push(K);J.all[$]=K,(Q=Z.implements)===null||Q===void 0||Q.forEach((B)=>this.addKeyword(B))}function GI($,Z,Y){let Q=$.rules.findIndex((W)=>W.keyword===Y);if(Q>=0)$.rules.splice(Q,0,Z);else $.rules.push(Z),this.logger.warn(`rule ${Y} is not defined`)}function KI($){let{metaSchema:Z}=$;if(Z===void 0)return;if($.$data&&this.opts.$data)Z=$F(Z);$.validateSchema=this.compile(Z,!0)}var HI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function $F($){return{anyOf:[$,HI]}}});var QF=k((YF)=>{Object.defineProperty(YF,"__esModule",{value:!0});var DI={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};YF.default=DI});var HF=k((GF)=>{Object.defineProperty(GF,"__esModule",{value:!0});GF.callRef=GF.getValidate=void 0;var LI=Q7(),XF=A0(),s1=Z1(),i8=Q6(),WF=r4(),Z5=G1(),UI={keyword:"$ref",schemaType:"string",code($){let{gen:Z,schema:Y,it:Q}=$,{baseId:W,schemaEnv:J,validateName:G,opts:K,self:B}=Q,{root:D}=J;if((Y==="#"||Y==="#/")&&W===D.baseId)return L();let V=WF.resolveRef.call(B,D,W,Y);if(V===void 0)throw new LI.default(Q.opts.uriResolver,W,Y);if(V instanceof WF.SchemaEnv)return A(V);return O(V);function L(){if(J===D)return Y5($,G,J,J.$async);let q=Z.scopeValue("root",{ref:D});return Y5($,s1._`${q}.validate`,D,D.$async)}function A(q){let M=JF($,q);Y5($,M,q,q.$async)}function O(q){let M=Z.scopeValue("schema",K.code.source===!0?{ref:q,code:(0,s1.stringify)(q)}:{ref:q}),I=Z.name("valid"),N=$.subschema({schema:q,dataTypes:[],schemaPath:s1.nil,topSchemaRef:M,errSchemaPath:Y},I);$.mergeEvaluated(N),$.ok(I)}}};function JF($,Z){let{gen:Y}=$;return Z.validate?Y.scopeValue("validate",{ref:Z.validate}):s1._`${Y.scopeValue("wrapper",{ref:Z})}.validate`}GF.getValidate=JF;function Y5($,Z,Y,Q){let{gen:W,it:J}=$,{allErrors:G,schemaEnv:K,opts:B}=J,D=B.passContext?i8.default.this:s1.nil;if(Q)V();else L();function V(){if(!K.$async)throw Error("async schema referenced by sync schema");let q=W.let("valid");W.try(()=>{if(W.code(s1._`await ${(0,XF.callValidateCode)($,Z,D)}`),O(Z),!G)W.assign(q,!0)},(M)=>{if(W.if(s1._`!(${M} instanceof ${J.ValidationError})`,()=>W.throw(M)),A(M),!G)W.assign(q,!1)}),$.ok(q)}function L(){$.result((0,XF.callValidateCode)($,Z,D),()=>O(Z),()=>A(Z))}function A(q){let M=s1._`${q}.errors`;W.assign(i8.default.vErrors,s1._`${i8.default.vErrors} === null ? ${M} : ${i8.default.vErrors}.concat(${M})`),W.assign(i8.default.errors,s1._`${i8.default.vErrors}.length`)}function O(q){var M;if(!J.opts.unevaluated)return;let I=(M=Y===null||Y===void 0?void 0:Y.validate)===null||M===void 0?void 0:M.evaluated;if(J.props!==!0)if(I&&!I.dynamicProps){if(I.props!==void 0)J.props=Z5.mergeEvaluated.props(W,I.props,J.props)}else{let N=W.var("props",s1._`${q}.evaluated.props`);J.props=Z5.mergeEvaluated.props(W,N,J.props,s1.Name)}if(J.items!==!0)if(I&&!I.dynamicItems){if(I.items!==void 0)J.items=Z5.mergeEvaluated.items(W,I.items,J.items)}else{let N=W.var("items",s1._`${q}.evaluated.items`);J.items=Z5.mergeEvaluated.items(W,N,J.items,s1.Name)}}}GF.callRef=Y5;GF.default=UI});var FF=k((BF)=>{Object.defineProperty(BF,"__esModule",{value:!0});var zI=QF(),OI=HF(),qI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",zI.default,OI.default];BF.default=qI});var VF=k((DF)=>{Object.defineProperty(DF,"__esModule",{value:!0});var Q5=Z1(),v6=Q5.operators,X5={maximum:{okStr:"<=",ok:v6.LTE,fail:v6.GT},minimum:{okStr:">=",ok:v6.GTE,fail:v6.LT},exclusiveMaximum:{okStr:"<",ok:v6.LT,fail:v6.GTE},exclusiveMinimum:{okStr:">",ok:v6.GT,fail:v6.LTE}},MI={message:({keyword:$,schemaCode:Z})=>Q5.str`must be ${X5[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>Q5._`{comparison: ${X5[$].okStr}, limit: ${Z}}`},PI={keyword:Object.keys(X5),type:"number",schemaType:"number",$data:!0,error:MI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$;$.fail$data(Q5._`${Y} ${X5[Z].fail} ${Q} || isNaN(${Y})`)}};DF.default=PI});var UF=k((LF)=>{Object.defineProperty(LF,"__esModule",{value:!0});var K7=Z1(),EI={message:({schemaCode:$})=>K7.str`must be multiple of ${$}`,params:({schemaCode:$})=>K7._`{multipleOf: ${$}}`},RI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EI,code($){let{gen:Z,data:Y,schemaCode:Q,it:W}=$,J=W.opts.multipleOfPrecision,G=Z.let("res"),K=J?K7._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:K7._`${G} !== parseInt(${G})`;$.fail$data(K7._`(${Q} === 0 || (${G} = ${Y}/${Q}, ${K}))`)}};LF.default=RI});var zF=k((AF)=>{Object.defineProperty(AF,"__esModule",{value:!0});function jF($){let Z=$.length,Y=0,Q=0,W;while(Q<Z)if(Y++,W=$.charCodeAt(Q++),W>=55296&&W<=56319&&Q<Z){if(W=$.charCodeAt(Q),(W&64512)===56320)Q++}return Y}AF.default=jF;jF.code='require("ajv/dist/runtime/ucs2length").default'});var qF=k((OF)=>{Object.defineProperty(OF,"__esModule",{value:!0});var e6=Z1(),II=G1(),fI=zF(),SI={message({keyword:$,schemaCode:Z}){let Y=$==="maxLength"?"more":"fewer";return e6.str`must NOT have ${Y} than ${Z} characters`},params:({schemaCode:$})=>e6._`{limit: ${$}}`},bI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:SI,code($){let{keyword:Z,data:Y,schemaCode:Q,it:W}=$,J=Z==="maxLength"?e6.operators.GT:e6.operators.LT,G=W.opts.unicode===!1?e6._`${Y}.length`:e6._`${(0,II.useFunc)($.gen,fI.default)}(${Y})`;$.fail$data(e6._`${G} ${J} ${Q}`)}};OF.default=bI});var MF=k((NF)=>{Object.defineProperty(NF,"__esModule",{value:!0});var yI=A0(),TI=G1(),c8=Z1(),kI={message:({schemaCode:$})=>c8.str`must match pattern "${$}"`,params:({schemaCode:$})=>c8._`{pattern: ${$}}`},xI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:kI,code($){let{gen:Z,data:Y,$data:Q,schema:W,schemaCode:J,it:G}=$,K=G.opts.unicodeRegExp?"u":"";if(Q){let{regExp:B}=G.opts.code,D=B.code==="new RegExp"?c8._`new RegExp`:(0,TI.useFunc)(Z,B),V=Z.let("valid");Z.try(()=>Z.assign(V,c8._`${D}(${J}, ${K}).test(${Y})`),()=>Z.assign(V,!1)),$.fail$data(c8._`!${V}`)}else{let B=(0,yI.usePattern)($,W);$.fail$data(c8._`!${B}.test(${Y})`)}}};NF.default=xI});var wF=k((PF)=>{Object.defineProperty(PF,"__esModule",{value:!0});var H7=Z1(),uI={message({keyword:$,schemaCode:Z}){let Y=$==="maxProperties"?"more":"fewer";return H7.str`must NOT have ${Y} than ${Z} properties`},params:({schemaCode:$})=>H7._`{limit: ${$}}`},hI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:uI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$,W=Z==="maxProperties"?H7.operators.GT:H7.operators.LT;$.fail$data(H7._`Object.keys(${Y}).length ${W} ${Q}`)}};PF.default=hI});var RF=k((EF)=>{Object.defineProperty(EF,"__esModule",{value:!0});var B7=A0(),F7=Z1(),lI=G1(),pI={message:({params:{missingProperty:$}})=>F7.str`must have required property '${$}'`,params:({params:{missingProperty:$}})=>F7._`{missingProperty: ${$}}`},iI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:pI,code($){let{gen:Z,schema:Y,schemaCode:Q,data:W,$data:J,it:G}=$,{opts:K}=G;if(!J&&Y.length===0)return;let B=Y.length>=K.loopRequired;if(G.allErrors)D();else V();if(K.strictRequired){let O=$.parentSchema.properties,{definedProperties:q}=$.it;for(let M of Y)if((O===null||O===void 0?void 0:O[M])===void 0&&!q.has(M)){let I=G.schemaEnv.baseId+G.errSchemaPath,N=`required property "${M}" is not defined at "${I}" (strictRequired)`;(0,lI.checkStrictMode)(G,N,G.opts.strictRequired)}}function D(){if(B||J)$.block$data(F7.nil,L);else for(let O of Y)(0,B7.checkReportMissingProp)($,O)}function V(){let O=Z.let("missing");if(B||J){let q=Z.let("valid",!0);$.block$data(q,()=>A(O,q)),$.ok(q)}else Z.if((0,B7.checkMissingProp)($,Y,O)),(0,B7.reportMissingProp)($,O),Z.else()}function L(){Z.forOf("prop",Q,(O)=>{$.setParams({missingProperty:O}),Z.if((0,B7.noPropertyInData)(Z,W,O,K.ownProperties),()=>$.error())})}function A(O,q){$.setParams({missingProperty:O}),Z.forOf(O,Q,()=>{Z.assign(q,(0,B7.propertyInData)(Z,W,O,K.ownProperties)),Z.if((0,F7.not)(q),()=>{$.error(),Z.break()})},F7.nil)}}};EF.default=iI});var CF=k((_F)=>{Object.defineProperty(_F,"__esModule",{value:!0});var D7=Z1(),dI={message({keyword:$,schemaCode:Z}){let Y=$==="maxItems"?"more":"fewer";return D7.str`must NOT have ${Y} than ${Z} items`},params:({schemaCode:$})=>D7._`{limit: ${$}}`},nI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:dI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$,W=Z==="maxItems"?D7.operators.GT:D7.operators.LT;$.fail$data(D7._`${Y}.length ${W} ${Q}`)}};_F.default=nI});var W5=k((fF)=>{Object.defineProperty(fF,"__esModule",{value:!0});var IF=jX();IF.code='require("ajv/dist/runtime/equal").default';fF.default=IF});var bF=k((SF)=>{Object.defineProperty(SF,"__esModule",{value:!0});var bX=t9(),x1=Z1(),oI=G1(),sI=W5(),tI={message:({params:{i:$,j:Z}})=>x1.str`must NOT have duplicate items (items ## ${Z} and ${$} are identical)`,params:({params:{i:$,j:Z}})=>x1._`{i: ${$}, j: ${Z}}`},eI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:tI,code($){let{gen:Z,data:Y,$data:Q,schema:W,parentSchema:J,schemaCode:G,it:K}=$;if(!Q&&!W)return;let B=Z.let("valid"),D=J.items?(0,bX.getSchemaTypes)(J.items):[];$.block$data(B,V,x1._`${G} === false`),$.ok(B);function V(){let q=Z.let("i",x1._`${Y}.length`),M=Z.let("j");$.setParams({i:q,j:M}),Z.assign(B,!0),Z.if(x1._`${q} > 1`,()=>(L()?A:O)(q,M))}function L(){return D.length>0&&!D.some((q)=>q==="object"||q==="array")}function A(q,M){let I=Z.name("item"),N=(0,bX.checkDataTypes)(D,I,K.opts.strictNumbers,bX.DataType.Wrong),E=Z.const("indices",x1._`{}`);Z.for(x1._`;${q}--;`,()=>{if(Z.let(I,x1._`${Y}[${q}]`),Z.if(N,x1._`continue`),D.length>1)Z.if(x1._`typeof ${I} == "string"`,x1._`${I} += "_"`);Z.if(x1._`typeof ${E}[${I}] == "number"`,()=>{Z.assign(M,x1._`${E}[${I}]`),$.error(),Z.assign(B,!1).break()}).code(x1._`${E}[${I}] = ${q}`)})}function O(q,M){let I=(0,oI.useFunc)(Z,sI.default),N=Z.name("outer");Z.label(N).for(x1._`;${q}--;`,()=>Z.for(x1._`${M} = ${q}; ${M}--;`,()=>Z.if(x1._`${I}(${Y}[${q}], ${Y}[${M}])`,()=>{$.error(),Z.assign(B,!1).break(N)})))}}};SF.default=eI});var yF=k((vF)=>{Object.defineProperty(vF,"__esModule",{value:!0});var vX=Z1(),Zf=G1(),Yf=W5(),Qf={message:"must be equal to constant",params:({schemaCode:$})=>vX._`{allowedValue: ${$}}`},Xf={keyword:"const",$data:!0,error:Qf,code($){let{gen:Z,data:Y,$data:Q,schemaCode:W,schema:J}=$;if(Q||J&&typeof J=="object")$.fail$data(vX._`!${(0,Zf.useFunc)(Z,Yf.default)}(${Y}, ${W})`);else $.fail(vX._`${J} !== ${Y}`)}};vF.default=Xf});var kF=k((TF)=>{Object.defineProperty(TF,"__esModule",{value:!0});var V7=Z1(),Jf=G1(),Gf=W5(),Kf={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>V7._`{allowedValues: ${$}}`},Hf={keyword:"enum",schemaType:"array",$data:!0,error:Kf,code($){let{gen:Z,data:Y,$data:Q,schema:W,schemaCode:J,it:G}=$;if(!Q&&W.length===0)throw Error("enum must have non-empty array");let K=W.length>=G.opts.loopEnum,B,D=()=>B!==null&&B!==void 0?B:B=(0,Jf.useFunc)(Z,Gf.default),V;if(K||Q)V=Z.let("valid"),$.block$data(V,L);else{if(!Array.isArray(W))throw Error("ajv implementation error");let O=Z.const("vSchema",J);V=(0,V7.or)(...W.map((q,M)=>A(O,M)))}$.pass(V);function L(){Z.assign(V,!1),Z.forOf("v",J,(O)=>Z.if(V7._`${D()}(${Y}, ${O})`,()=>Z.assign(V,!0).break()))}function A(O,q){let M=W[q];return typeof M==="object"&&M!==null?V7._`${D()}(${Y}, ${O}[${q}])`:V7._`${Y} === ${M}`}}};TF.default=Hf});var gF=k((xF)=>{Object.defineProperty(xF,"__esModule",{value:!0});var Ff=VF(),Df=UF(),Vf=qF(),Lf=MF(),Uf=wF(),jf=RF(),Af=CF(),zf=bF(),Of=yF(),qf=kF(),Nf=[Ff.default,Df.default,Vf.default,Lf.default,Uf.default,jf.default,Af.default,zf.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Of.default,qf.default];xF.default=Nf});var TX=k((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.validateAdditionalItems=void 0;var $8=Z1(),yX=G1(),Pf={message:({params:{len:$}})=>$8.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>$8._`{limit: ${$}}`},wf={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Pf,code($){let{parentSchema:Z,it:Y}=$,{items:Q}=Z;if(!Array.isArray(Q)){(0,yX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}uF($,Q)}};function uF($,Z){let{gen:Y,schema:Q,data:W,keyword:J,it:G}=$;G.items=!0;let K=Y.const("len",$8._`${W}.length`);if(Q===!1)$.setParams({len:Z.length}),$.pass($8._`${K} <= ${Z.length}`);else if(typeof Q=="object"&&!(0,yX.alwaysValidSchema)(G,Q)){let D=Y.var("valid",$8._`${K} <= ${Z.length}`);Y.if((0,$8.not)(D),()=>B(D)),$.ok(D)}function B(D){Y.forRange("i",Z.length,K,(V)=>{if($.subschema({keyword:J,dataProp:V,dataPropType:yX.Type.Num},D),!G.allErrors)Y.if((0,$8.not)(D),()=>Y.break())})}}hF.validateAdditionalItems=uF;hF.default=wf});var kX=k((iF)=>{Object.defineProperty(iF,"__esModule",{value:!0});iF.validateTuple=void 0;var lF=Z1(),J5=G1(),Rf=A0(),_f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code($){let{schema:Z,it:Y}=$;if(Array.isArray(Z))return pF($,"additionalItems",Z);if(Y.items=!0,(0,J5.alwaysValidSchema)(Y,Z))return;$.ok((0,Rf.validateArray)($))}};function pF($,Z,Y=$.schema){let{gen:Q,parentSchema:W,data:J,keyword:G,it:K}=$;if(V(W),K.opts.unevaluated&&Y.length&&K.items!==!0)K.items=J5.mergeEvaluated.items(Q,Y.length,K.items);let B=Q.name("valid"),D=Q.const("len",lF._`${J}.length`);Y.forEach((L,A)=>{if((0,J5.alwaysValidSchema)(K,L))return;Q.if(lF._`${D} > ${A}`,()=>$.subschema({keyword:G,schemaProp:A,dataProp:A},B)),$.ok(B)});function V(L){let{opts:A,errSchemaPath:O}=K,q=Y.length,M=q===L.minItems&&(q===L.maxItems||L[Z]===!1);if(A.strictTuples&&!M){let I=`"${G}" is ${q}-tuple, but minItems or maxItems/${Z} are not specified or different at path "${O}"`;(0,J5.checkStrictMode)(K,I,A.strictTuples)}}}iF.validateTuple=pF;iF.default=_f});var nF=k((dF)=>{Object.defineProperty(dF,"__esModule",{value:!0});var If=kX(),ff={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:($)=>(0,If.validateTuple)($,"items")};dF.default=ff});var oF=k((aF)=>{Object.defineProperty(aF,"__esModule",{value:!0});var rF=Z1(),bf=G1(),vf=A0(),yf=TX(),Tf={message:({params:{len:$}})=>rF.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>rF._`{limit: ${$}}`},kf={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Tf,code($){let{schema:Z,parentSchema:Y,it:Q}=$,{prefixItems:W}=Y;if(Q.items=!0,(0,bf.alwaysValidSchema)(Q,Z))return;if(W)(0,yf.validateAdditionalItems)($,W);else $.ok((0,vf.validateArray)($))}};aF.default=kf});var tF=k((sF)=>{Object.defineProperty(sF,"__esModule",{value:!0});var z0=Z1(),G5=G1(),gf={message:({params:{min:$,max:Z}})=>Z===void 0?z0.str`must contain at least ${$} valid item(s)`:z0.str`must contain at least ${$} and no more than ${Z} valid item(s)`,params:({params:{min:$,max:Z}})=>Z===void 0?z0._`{minContains: ${$}}`:z0._`{minContains: ${$}, maxContains: ${Z}}`},uf={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:gf,code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,it:J}=$,G,K,{minContains:B,maxContains:D}=Q;if(J.opts.next)G=B===void 0?1:B,K=D;else G=1;let V=Z.const("len",z0._`${W}.length`);if($.setParams({min:G,max:K}),K===void 0&&G===0){(0,G5.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(K!==void 0&&G>K){(0,G5.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),$.fail();return}if((0,G5.alwaysValidSchema)(J,Y)){let M=z0._`${V} >= ${G}`;if(K!==void 0)M=z0._`${M} && ${V} <= ${K}`;$.pass(M);return}J.items=!0;let L=Z.name("valid");if(K===void 0&&G===1)O(L,()=>Z.if(L,()=>Z.break()));else if(G===0){if(Z.let(L,!0),K!==void 0)Z.if(z0._`${W}.length > 0`,A)}else Z.let(L,!1),A();$.result(L,()=>$.reset());function A(){let M=Z.name("_valid"),I=Z.let("count",0);O(M,()=>Z.if(M,()=>q(I)))}function O(M,I){Z.forRange("i",0,V,(N)=>{$.subschema({keyword:"contains",dataProp:N,dataPropType:G5.Type.Num,compositeRule:!0},M),I()})}function q(M){if(Z.code(z0._`${M}++`),K===void 0)Z.if(z0._`${M} >= ${G}`,()=>Z.assign(L,!0).break());else if(Z.if(z0._`${M} > ${K}`,()=>Z.assign(L,!1).break()),G===1)Z.assign(L,!0);else Z.if(z0._`${M} >= ${G}`,()=>Z.assign(L,!0))}}};sF.default=uf});var XD=k((ZD)=>{Object.defineProperty(ZD,"__esModule",{value:!0});ZD.validateSchemaDeps=ZD.validatePropertyDeps=ZD.error=void 0;var xX=Z1(),mf=G1(),L7=A0();ZD.error={message:({params:{property:$,depsCount:Z,deps:Y}})=>{let Q=Z===1?"property":"properties";return xX.str`must have ${Q} ${Y} when property ${$} is present`},params:({params:{property:$,depsCount:Z,deps:Y,missingProperty:Q}})=>xX._`{property: ${$},
|
|
6
|
+
|| ${G} === "boolean" || ${W} === null`).assign(K,e._`[${W}]`)}}}function LR({gen:$,parentData:Z,parentDataProperty:Y},Q){$.if(e._`${Z} !== undefined`,()=>$.assign(e._`${Z}[${Y}]`,Q))}function BX($,Z,Y,Q=h8.Correct){let W=Q===h8.Correct?e.operators.EQ:e.operators.NEQ,J;switch($){case"null":return e._`${Z} ${W} null`;case"array":J=e._`Array.isArray(${Z})`;break;case"object":J=e._`${Z} && typeof ${Z} == "object" && !Array.isArray(${Z})`;break;case"integer":J=G(e._`!(${Z} % 1) && !isNaN(${Z})`);break;case"number":J=G();break;default:return e._`typeof ${Z} ${W} ${$}`}return Q===h8.Correct?J:(0,e.not)(J);function G(K=e.nil){return(0,e.and)(e._`typeof ${Z} == "number"`,K,Y?e._`isFinite(${Z})`:e.nil)}}TH.checkDataType=BX;function FX($,Z,Y,Q){if($.length===1)return BX($[0],Z,Y,Q);let W,J=(0,bH.toHash)($);if(J.array&&J.object){let G=e._`typeof ${Z} != "object"`;W=J.null?G:e._`!${Z} || ${G}`,delete J.null,delete J.array,delete J.object}else W=e.nil;if(J.number)delete J.integer;for(let G in J)W=(0,e.and)(W,BX(G,Z,Y,Q));return W}TH.checkDataTypes=FX;var UR={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:Z})=>typeof $=="string"?e._`{type: ${$}}`:e._`{type: ${Z}}`};function DX($){let Z=jR($);(0,HR.reportError)(Z,UR)}TH.reportTypeError=DX;function jR($){let{gen:Z,data:Y,schema:Q}=$,W=(0,bH.schemaRefOrVal)($,Q,"type");return{gen:Z,keyword:"type",data:Y,schema:Q.type,schemaCode:W,schemaValue:W,parentSchema:Q,params:{},it:$}}});var hH=k((gH)=>{Object.defineProperty(gH,"__esModule",{value:!0});gH.assignDefaults=void 0;var m8=Z1(),PR=G1();function wR($,Z){let{properties:Y,items:Q}=$.schema;if(Z==="object"&&Y)for(let W in Y)xH($,W,Y[W].default);else if(Z==="array"&&Array.isArray(Q))Q.forEach((W,J)=>xH($,J,W.default))}gH.assignDefaults=wR;function xH($,Z,Y){let{gen:Q,compositeRule:W,data:J,opts:G}=$;if(Y===void 0)return;let K=m8._`${J}${(0,m8.getProperty)(Z)}`;if(W){(0,PR.checkStrictMode)($,`default is ignored for: ${K}`);return}let B=m8._`${K} === undefined`;if(G.useDefaults==="empty")B=m8._`${B} || ${K} === null || ${K} === ""`;Q.if(B,m8._`${K} = ${(0,m8.stringify)(Y)}`)}});var A0=k((pH)=>{Object.defineProperty(pH,"__esModule",{value:!0});pH.validateUnion=pH.validateArray=pH.usePattern=pH.callValidateCode=pH.schemaProperties=pH.allSchemaProperties=pH.noPropertyInData=pH.propertyInData=pH.isOwnProperty=pH.hasPropFunc=pH.reportMissingProp=pH.checkMissingProp=pH.checkReportMissingProp=void 0;var A1=Z1(),VX=G1(),S6=Q6(),ER=G1();function RR($,Z){let{gen:Y,data:Q,it:W}=$;Y.if(UX(Y,Q,Z,W.opts.ownProperties),()=>{$.setParams({missingProperty:A1._`${Z}`},!0),$.error()})}pH.checkReportMissingProp=RR;function _R({gen:$,data:Z,it:{opts:Y}},Q,W){return(0,A1.or)(...Q.map((J)=>(0,A1.and)(UX($,Z,J,Y.ownProperties),A1._`${W} = ${J}`)))}pH.checkMissingProp=_R;function CR($,Z){$.setParams({missingProperty:Z},!0),$.error()}pH.reportMissingProp=CR;function mH($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:A1._`Object.prototype.hasOwnProperty`})}pH.hasPropFunc=mH;function LX($,Z,Y){return A1._`${mH($)}.call(${Z}, ${Y})`}pH.isOwnProperty=LX;function IR($,Z,Y,Q){let W=A1._`${Z}${(0,A1.getProperty)(Y)} !== undefined`;return Q?A1._`${W} && ${LX($,Z,Y)}`:W}pH.propertyInData=IR;function UX($,Z,Y,Q){let W=A1._`${Z}${(0,A1.getProperty)(Y)} === undefined`;return Q?(0,A1.or)(W,(0,A1.not)(LX($,Z,Y))):W}pH.noPropertyInData=UX;function lH($){return $?Object.keys($).filter((Z)=>Z!=="__proto__"):[]}pH.allSchemaProperties=lH;function fR($,Z){return lH(Z).filter((Y)=>!(0,VX.alwaysValidSchema)($,Z[Y]))}pH.schemaProperties=fR;function SR({schemaCode:$,data:Z,it:{gen:Y,topSchemaRef:Q,schemaPath:W,errorPath:J},it:G},K,B,D){let V=D?A1._`${$}, ${Z}, ${Q}${W}`:Z,L=[[S6.default.instancePath,(0,A1.strConcat)(S6.default.instancePath,J)],[S6.default.parentData,G.parentData],[S6.default.parentDataProperty,G.parentDataProperty],[S6.default.rootData,S6.default.rootData]];if(G.opts.dynamicRef)L.push([S6.default.dynamicAnchors,S6.default.dynamicAnchors]);let A=A1._`${V}, ${Y.object(...L)}`;return B!==A1.nil?A1._`${K}.call(${B}, ${A})`:A1._`${K}(${A})`}pH.callValidateCode=SR;var bR=A1._`new RegExp`;function vR({gen:$,it:{opts:Z}},Y){let Q=Z.unicodeRegExp?"u":"",{regExp:W}=Z.code,J=W(Y,Q);return $.scopeValue("pattern",{key:J.toString(),ref:J,code:A1._`${W.code==="new RegExp"?bR:(0,ER.useFunc)($,W)}(${Y}, ${Q})`})}pH.usePattern=vR;function yR($){let{gen:Z,data:Y,keyword:Q,it:W}=$,J=Z.name("valid");if(W.allErrors){let K=Z.let("valid",!0);return G(()=>Z.assign(K,!1)),K}return Z.var(J,!0),G(()=>Z.break()),J;function G(K){let B=Z.const("len",A1._`${Y}.length`);Z.forRange("i",0,B,(D)=>{$.subschema({keyword:Q,dataProp:D,dataPropType:VX.Type.Num},J),Z.if((0,A1.not)(J),K)})}}pH.validateArray=yR;function TR($){let{gen:Z,schema:Y,keyword:Q,it:W}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,VX.alwaysValidSchema)(W,B))&&!W.opts.unevaluated)return;let G=Z.let("valid",!1),K=Z.name("_valid");Z.block(()=>Y.forEach((B,D)=>{let V=$.subschema({keyword:Q,schemaProp:D,compositeRule:!0},K);if(Z.assign(G,A1._`${G} || ${K}`),!$.mergeValidEvaluated(V,K))Z.if((0,A1.not)(G))})),$.result(G,()=>$.reset(),()=>$.error(!0))}pH.validateUnion=TR});var aH=k((nH)=>{Object.defineProperty(nH,"__esModule",{value:!0});nH.validateKeywordUsage=nH.validSchemaType=nH.funcKeywordCode=nH.macroKeywordCode=void 0;var d1=Z1(),s6=Q6(),rR=A0(),aR=s9();function oR($,Z){let{gen:Y,keyword:Q,schema:W,parentSchema:J,it:G}=$,K=Z.macro.call(G.self,W,J,G),B=dH(Y,Q,K);if(G.opts.validateSchema!==!1)G.self.validateSchema(K,!0);let D=Y.name("valid");$.subschema({schema:K,schemaPath:d1.nil,errSchemaPath:`${G.errSchemaPath}/${Q}`,topSchemaRef:B,compositeRule:!0},D),$.pass(D,()=>$.error(!0))}nH.macroKeywordCode=oR;function sR($,Z){var Y;let{gen:Q,keyword:W,schema:J,parentSchema:G,$data:K,it:B}=$;eR(B,Z);let D=!K&&Z.compile?Z.compile.call(B.self,J,G,B):Z.validate,V=dH(Q,W,D),L=Q.let("valid");$.block$data(L,A),$.ok((Y=Z.valid)!==null&&Y!==void 0?Y:L);function A(){if(Z.errors===!1){if(M(),Z.modifying)cH($);I(()=>$.error())}else{let N=Z.async?O():q();if(Z.modifying)cH($);I(()=>tR($,N))}}function O(){let N=Q.let("ruleErrs",null);return Q.try(()=>M(d1._`await `),(E)=>Q.assign(L,!1).if(d1._`${E} instanceof ${B.ValidationError}`,()=>Q.assign(N,d1._`${E}.errors`),()=>Q.throw(E))),N}function q(){let N=d1._`${V}.errors`;return Q.assign(N,null),M(d1.nil),N}function M(N=Z.async?d1._`await `:d1.nil){let E=B.opts.passContext?s6.default.this:s6.default.self,f=!(("compile"in Z)&&!K||Z.schema===!1);Q.assign(L,d1._`${N}${(0,rR.callValidateCode)($,V,E,f)}`,Z.modifying)}function I(N){var E;Q.if((0,d1.not)((E=Z.valid)!==null&&E!==void 0?E:L),N)}}nH.funcKeywordCode=sR;function cH($){let{gen:Z,data:Y,it:Q}=$;Z.if(Q.parentData,()=>Z.assign(Y,d1._`${Q.parentData}[${Q.parentDataProperty}]`))}function tR($,Z){let{gen:Y}=$;Y.if(d1._`Array.isArray(${Z})`,()=>{Y.assign(s6.default.vErrors,d1._`${s6.default.vErrors} === null ? ${Z} : ${s6.default.vErrors}.concat(${Z})`).assign(s6.default.errors,d1._`${s6.default.vErrors}.length`),(0,aR.extendErrors)($)},()=>$.error())}function eR({schemaEnv:$},Z){if(Z.async&&!$.$async)throw Error("async keyword in sync schema")}function dH($,Z,Y){if(Y===void 0)throw Error(`keyword "${Z}" failed to compile`);return $.scopeValue("keyword",typeof Y=="function"?{ref:Y}:{ref:Y,code:(0,d1.stringify)(Y)})}function $_($,Z,Y=!1){return!Z.length||Z.some((Q)=>Q==="array"?Array.isArray($):Q==="object"?$&&typeof $=="object"&&!Array.isArray($):typeof $==Q||Y&&typeof $>"u")}nH.validSchemaType=$_;function Z_({schema:$,opts:Z,self:Y,errSchemaPath:Q},W,J){if(Array.isArray(W.keyword)?!W.keyword.includes(J):W.keyword!==J)throw Error("ajv implementation error");let G=W.dependencies;if(G===null||G===void 0?void 0:G.some((K)=>!Object.prototype.hasOwnProperty.call($,K)))throw Error(`parent schema must have dependencies of ${J}: ${G.join(",")}`);if(W.validateSchema){if(!W.validateSchema($[J])){let B=`keyword "${J}" value is invalid at path "${Q}": `+Y.errorsText(W.validateSchema.errors);if(Z.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}nH.validateKeywordUsage=Z_});var eH=k((sH)=>{Object.defineProperty(sH,"__esModule",{value:!0});sH.extendSubschemaMode=sH.extendSubschemaData=sH.getSubschema=void 0;var h0=Z1(),oH=G1();function W_($,{keyword:Z,schemaProp:Y,schema:Q,schemaPath:W,errSchemaPath:J,topSchemaRef:G}){if(Z!==void 0&&Q!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Z!==void 0){let K=$.schema[Z];return Y===void 0?{schema:K,schemaPath:h0._`${$.schemaPath}${(0,h0.getProperty)(Z)}`,errSchemaPath:`${$.errSchemaPath}/${Z}`}:{schema:K[Y],schemaPath:h0._`${$.schemaPath}${(0,h0.getProperty)(Z)}${(0,h0.getProperty)(Y)}`,errSchemaPath:`${$.errSchemaPath}/${Z}/${(0,oH.escapeFragment)(Y)}`}}if(Q!==void 0){if(W===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Q,schemaPath:W,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}sH.getSubschema=W_;function J_($,Z,{dataProp:Y,dataPropType:Q,data:W,dataTypes:J,propertyName:G}){if(W!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:K}=Z;if(Y!==void 0){let{errorPath:D,dataPathArr:V,opts:L}=Z,A=K.let("data",h0._`${Z.data}${(0,h0.getProperty)(Y)}`,!0);B(A),$.errorPath=h0.str`${D}${(0,oH.getErrorPath)(Y,Q,L.jsPropertySyntax)}`,$.parentDataProperty=h0._`${Y}`,$.dataPathArr=[...V,$.parentDataProperty]}if(W!==void 0){let D=W instanceof h0.Name?W:K.let("data",W,!0);if(B(D),G!==void 0)$.propertyName=G}if(J)$.dataTypes=J;function B(D){$.data=D,$.dataLevel=Z.dataLevel+1,$.dataTypes=[],Z.definedProperties=new Set,$.parentData=Z.data,$.dataNames=[...Z.dataNames,D]}}sH.extendSubschemaData=J_;function G_($,{jtdDiscriminator:Z,jtdMetadata:Y,compositeRule:Q,createErrors:W,allErrors:J}){if(Q!==void 0)$.compositeRule=Q;if(W!==void 0)$.createErrors=W;if(J!==void 0)$.allErrors=J;$.jtdDiscriminator=Z,$.jtdMetadata=Y}sH.extendSubschemaMode=G_});var jX=k((lr,$B)=>{$B.exports=function $(Z,Y){if(Z===Y)return!0;if(Z&&Y&&typeof Z=="object"&&typeof Y=="object"){if(Z.constructor!==Y.constructor)return!1;var Q,W,J;if(Array.isArray(Z)){if(Q=Z.length,Q!=Y.length)return!1;for(W=Q;W--!==0;)if(!$(Z[W],Y[W]))return!1;return!0}if(Z.constructor===RegExp)return Z.source===Y.source&&Z.flags===Y.flags;if(Z.valueOf!==Object.prototype.valueOf)return Z.valueOf()===Y.valueOf();if(Z.toString!==Object.prototype.toString)return Z.toString()===Y.toString();if(J=Object.keys(Z),Q=J.length,Q!==Object.keys(Y).length)return!1;for(W=Q;W--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[W]))return!1;for(W=Q;W--!==0;){var G=J[W];if(!$(Z[G],Y[G]))return!1}return!0}return Z!==Z&&Y!==Y}});var YB=k((pr,ZB)=>{var b6=ZB.exports=function($,Z,Y){if(typeof Z=="function")Y=Z,Z={};Y=Z.cb||Y;var Q=typeof Y=="function"?Y:Y.pre||function(){},W=Y.post||function(){};i4(Z,Q,W,$,"",$)};b6.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};b6.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};b6.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};b6.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function i4($,Z,Y,Q,W,J,G,K,B,D){if(Q&&typeof Q=="object"&&!Array.isArray(Q)){Z(Q,W,J,G,K,B,D);for(var V in Q){var L=Q[V];if(Array.isArray(L)){if(V in b6.arrayKeywords)for(var A=0;A<L.length;A++)i4($,Z,Y,L[A],W+"/"+V+"/"+A,J,W,V,Q,A)}else if(V in b6.propsKeywords){if(L&&typeof L=="object")for(var O in L)i4($,Z,Y,L[O],W+"/"+V+"/"+B_(O),J,W,V,Q,O)}else if(V in b6.keywords||$.allKeys&&!(V in b6.skipKeywords))i4($,Z,Y,L,W+"/"+V,J,W,V,Q)}Y(Q,W,J,G,K,B,D)}}function B_($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}});var e9=k((JB)=>{Object.defineProperty(JB,"__esModule",{value:!0});JB.getSchemaRefs=JB.resolveUrl=JB.normalizeId=JB._getFullPath=JB.getFullPath=JB.inlineRef=void 0;var F_=G1(),D_=jX(),V_=YB(),L_=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function U_($,Z=!0){if(typeof $=="boolean")return!0;if(Z===!0)return!AX($);if(!Z)return!1;return QB($)<=Z}JB.inlineRef=U_;var j_=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function AX($){for(let Z in $){if(j_.has(Z))return!0;let Y=$[Z];if(Array.isArray(Y)&&Y.some(AX))return!0;if(typeof Y=="object"&&AX(Y))return!0}return!1}function QB($){let Z=0;for(let Y in $){if(Y==="$ref")return 1/0;if(Z++,L_.has(Y))continue;if(typeof $[Y]=="object")(0,F_.eachItem)($[Y],(Q)=>Z+=QB(Q));if(Z===1/0)return 1/0}return Z}function XB($,Z="",Y){if(Y!==!1)Z=l8(Z);let Q=$.parse(Z);return WB($,Q)}JB.getFullPath=XB;function WB($,Z){return $.serialize(Z).split("#")[0]+"#"}JB._getFullPath=WB;var A_=/#\/?$/;function l8($){return $?$.replace(A_,""):""}JB.normalizeId=l8;function z_($,Z,Y){return Y=l8(Y),$.resolve(Z,Y)}JB.resolveUrl=z_;var O_=/^[a-z_][-a-z0-9._]*$/i;function q_($,Z){if(typeof $=="boolean")return{};let{schemaId:Y,uriResolver:Q}=this.opts,W=l8($[Y]||Z),J={"":W},G=XB(Q,W,!1),K={},B=new Set;return V_($,{allKeys:!0},(L,A,O,q)=>{if(q===void 0)return;let M=G+A,I=J[q];if(typeof L[Y]=="string")I=N.call(this,L[Y]);E.call(this,L.$anchor),E.call(this,L.$dynamicAnchor),J[A]=I;function N(f){let v=this.opts.uriResolver.resolve;if(f=l8(I?v(I,f):f),B.has(f))throw V(f);B.add(f);let y=this.refs[f];if(typeof y=="string")y=this.refs[y];if(typeof y=="object")D(L,y.schema,f);else if(f!==l8(M))if(f[0]==="#")D(L,K[f],f),K[f]=L;else this.refs[f]=M;return f}function E(f){if(typeof f=="string"){if(!O_.test(f))throw Error(`invalid anchor "${f}"`);N.call(this,`#${f}`)}}}),K;function D(L,A,O){if(A!==void 0&&!D_(L,A))throw V(O)}function V(L){return Error(`reference "${L}" resolves to more than one schema`)}}JB.getSchemaRefs=q_});var Y7=k((MB)=>{Object.defineProperty(MB,"__esModule",{value:!0});MB.getData=MB.KeywordCxt=MB.validateFunctionCode=void 0;var DB=EH(),KB=t9(),OX=HX(),c4=t9(),R_=hH(),Z7=aH(),zX=eH(),m=Z1(),o=Q6(),__=e9(),X6=G1(),$7=s9();function C_($){if(UB($)){if(jB($),LB($)){S_($);return}}VB($,()=>(0,DB.topBoolOrEmptySchema)($))}MB.validateFunctionCode=C_;function VB({gen:$,validateName:Z,schema:Y,schemaEnv:Q,opts:W},J){if(W.code.es5)$.func(Z,m._`${o.default.data}, ${o.default.valCxt}`,Q.$async,()=>{$.code(m._`"use strict"; ${HB(Y,W)}`),f_($,W),$.code(J)});else $.func(Z,m._`${o.default.data}, ${I_(W)}`,Q.$async,()=>$.code(HB(Y,W)).code(J))}function I_($){return m._`{${o.default.instancePath}="", ${o.default.parentData}, ${o.default.parentDataProperty}, ${o.default.rootData}=${o.default.data}${$.dynamicRef?m._`, ${o.default.dynamicAnchors}={}`:m.nil}}={}`}function f_($,Z){$.if(o.default.valCxt,()=>{if($.var(o.default.instancePath,m._`${o.default.valCxt}.${o.default.instancePath}`),$.var(o.default.parentData,m._`${o.default.valCxt}.${o.default.parentData}`),$.var(o.default.parentDataProperty,m._`${o.default.valCxt}.${o.default.parentDataProperty}`),$.var(o.default.rootData,m._`${o.default.valCxt}.${o.default.rootData}`),Z.dynamicRef)$.var(o.default.dynamicAnchors,m._`${o.default.valCxt}.${o.default.dynamicAnchors}`)},()=>{if($.var(o.default.instancePath,m._`""`),$.var(o.default.parentData,m._`undefined`),$.var(o.default.parentDataProperty,m._`undefined`),$.var(o.default.rootData,o.default.data),Z.dynamicRef)$.var(o.default.dynamicAnchors,m._`{}`)})}function S_($){let{schema:Z,opts:Y,gen:Q}=$;VB($,()=>{if(Y.$comment&&Z.$comment)zB($);if(k_($),Q.let(o.default.vErrors,null),Q.let(o.default.errors,0),Y.unevaluated)b_($);AB($),u_($)});return}function b_($){let{gen:Z,validateName:Y}=$;$.evaluated=Z.const("evaluated",m._`${Y}.evaluated`),Z.if(m._`${$.evaluated}.dynamicProps`,()=>Z.assign(m._`${$.evaluated}.props`,m._`undefined`)),Z.if(m._`${$.evaluated}.dynamicItems`,()=>Z.assign(m._`${$.evaluated}.items`,m._`undefined`))}function HB($,Z){let Y=typeof $=="object"&&$[Z.schemaId];return Y&&(Z.code.source||Z.code.process)?m._`/*# sourceURL=${Y} */`:m.nil}function v_($,Z){if(UB($)){if(jB($),LB($)){y_($,Z);return}}(0,DB.boolOrEmptySchema)($,Z)}function LB({schema:$,self:Z}){if(typeof $=="boolean")return!$;for(let Y in $)if(Z.RULES.all[Y])return!0;return!1}function UB($){return typeof $.schema!="boolean"}function y_($,Z){let{schema:Y,gen:Q,opts:W}=$;if(W.$comment&&Y.$comment)zB($);x_($),g_($);let J=Q.const("_errs",o.default.errors);AB($,J),Q.var(Z,m._`${J} === ${o.default.errors}`)}function jB($){(0,X6.checkUnknownRules)($),T_($)}function AB($,Z){if($.opts.jtd)return BB($,[],!1,Z);let Y=(0,KB.getSchemaTypes)($.schema),Q=(0,KB.coerceAndCheckDataType)($,Y);BB($,Y,!Q,Z)}function T_($){let{schema:Z,errSchemaPath:Y,opts:Q,self:W}=$;if(Z.$ref&&Q.ignoreKeywordsWithRef&&(0,X6.schemaHasRulesButRef)(Z,W.RULES))W.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function k_($){let{schema:Z,opts:Y}=$;if(Z.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,X6.checkStrictMode)($,"default is ignored in the schema root")}function x_($){let Z=$.schema[$.opts.schemaId];if(Z)$.baseId=(0,__.resolveUrl)($.opts.uriResolver,$.baseId,Z)}function g_($){if($.schema.$async&&!$.schemaEnv.$async)throw Error("async schema in sync schema")}function zB({gen:$,schemaEnv:Z,schema:Y,errSchemaPath:Q,opts:W}){let J=Y.$comment;if(W.$comment===!0)$.code(m._`${o.default.self}.logger.log(${J})`);else if(typeof W.$comment=="function"){let G=m.str`${Q}/$comment`,K=$.scopeValue("root",{ref:Z.root});$.code(m._`${o.default.self}.opts.$comment(${J}, ${G}, ${K}.schema)`)}}function u_($){let{gen:Z,schemaEnv:Y,validateName:Q,ValidationError:W,opts:J}=$;if(Y.$async)Z.if(m._`${o.default.errors} === 0`,()=>Z.return(o.default.data),()=>Z.throw(m._`new ${W}(${o.default.vErrors})`));else{if(Z.assign(m._`${Q}.errors`,o.default.vErrors),J.unevaluated)h_($);Z.return(m._`${o.default.errors} === 0`)}}function h_({gen:$,evaluated:Z,props:Y,items:Q}){if(Y instanceof m.Name)$.assign(m._`${Z}.props`,Y);if(Q instanceof m.Name)$.assign(m._`${Z}.items`,Q)}function BB($,Z,Y,Q){let{gen:W,schema:J,data:G,allErrors:K,opts:B,self:D}=$,{RULES:V}=D;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,X6.schemaHasRulesButRef)(J,V))){W.block(()=>qB($,"$ref",V.all.$ref.definition));return}if(!B.jtd)m_($,Z);W.block(()=>{for(let A of V.rules)L(A);L(V.post)});function L(A){if(!(0,OX.shouldUseGroup)(J,A))return;if(A.type){if(W.if((0,c4.checkDataType)(A.type,G,B.strictNumbers)),FB($,A),Z.length===1&&Z[0]===A.type&&Y)W.else(),(0,c4.reportTypeError)($);W.endIf()}else FB($,A);if(!K)W.if(m._`${o.default.errors} === ${Q||0}`)}}function FB($,Z){let{gen:Y,schema:Q,opts:{useDefaults:W}}=$;if(W)(0,R_.assignDefaults)($,Z.type);Y.block(()=>{for(let J of Z.rules)if((0,OX.shouldUseRule)(Q,J))qB($,J.keyword,J.definition,Z.type)})}function m_($,Z){if($.schemaEnv.meta||!$.opts.strictTypes)return;if(l_($,Z),!$.opts.allowUnionTypes)p_($,Z);i_($,$.dataTypes)}function l_($,Z){if(!Z.length)return;if(!$.dataTypes.length){$.dataTypes=Z;return}Z.forEach((Y)=>{if(!OB($.dataTypes,Y))qX($,`type "${Y}" not allowed by context "${$.dataTypes.join(",")}"`)}),d_($,Z)}function p_($,Z){if(Z.length>1&&!(Z.length===2&&Z.includes("null")))qX($,"use allowUnionTypes to allow union type keyword")}function i_($,Z){let Y=$.self.RULES.all;for(let Q in Y){let W=Y[Q];if(typeof W=="object"&&(0,OX.shouldUseRule)($.schema,W)){let{type:J}=W.definition;if(J.length&&!J.some((G)=>c_(Z,G)))qX($,`missing type "${J.join(",")}" for keyword "${Q}"`)}}}function c_($,Z){return $.includes(Z)||Z==="number"&&$.includes("integer")}function OB($,Z){return $.includes(Z)||Z==="integer"&&$.includes("number")}function d_($,Z){let Y=[];for(let Q of $.dataTypes)if(OB(Z,Q))Y.push(Q);else if(Z.includes("integer")&&Q==="number")Y.push("integer");$.dataTypes=Y}function qX($,Z){let Y=$.schemaEnv.baseId+$.errSchemaPath;Z+=` at "${Y}" (strictTypes)`,(0,X6.checkStrictMode)($,Z,$.opts.strictTypes)}class NX{constructor($,Z,Y){if((0,Z7.validateKeywordUsage)($,Z,Y),this.gen=$.gen,this.allErrors=$.allErrors,this.keyword=Y,this.data=$.data,this.schema=$.schema[Y],this.$data=Z.$data&&$.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,X6.schemaRefOrVal)($,this.schema,Y,this.$data),this.schemaType=Z.schemaType,this.parentSchema=$.schema,this.params={},this.it=$,this.def=Z,this.$data)this.schemaCode=$.gen.const("vSchema",NB(this.$data,$));else if(this.schemaCode=this.schemaValue,!(0,Z7.validSchemaType)(this.schema,Z.schemaType,Z.allowUndefined))throw Error(`${Y} value must be ${JSON.stringify(Z.schemaType)}`);if("code"in Z?Z.trackErrors:Z.errors!==!1)this.errsCount=$.gen.const("_errs",o.default.errors)}result($,Z,Y){this.failResult((0,m.not)($),Z,Y)}failResult($,Z,Y){if(this.gen.if($),Y)Y();else this.error();if(Z){if(this.gen.else(),Z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass($,Z){this.failResult((0,m.not)($),void 0,Z)}fail($){if($===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if($),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data($){if(!this.$data)return this.fail($);let{schemaCode:Z}=this;this.fail(m._`${Z} !== undefined && (${(0,m.or)(this.invalid$data(),$)})`)}error($,Z,Y){if(Z){this.setParams(Z),this._error($,Y),this.setParams({});return}this._error($,Y)}_error($,Z){($?$7.reportExtraError:$7.reportError)(this,this.def.error,Z)}$dataError(){(0,$7.reportError)(this,this.def.$dataError||$7.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,$7.resetErrorsCount)(this.gen,this.errsCount)}ok($){if(!this.allErrors)this.gen.if($)}setParams($,Z){if(Z)Object.assign(this.params,$);else this.params=$}block$data($,Z,Y=m.nil){this.gen.block(()=>{this.check$data($,Y),Z()})}check$data($=m.nil,Z=m.nil){if(!this.$data)return;let{gen:Y,schemaCode:Q,schemaType:W,def:J}=this;if(Y.if((0,m.or)(m._`${Q} === undefined`,Z)),$!==m.nil)Y.assign($,!0);if(W.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),$!==m.nil)Y.assign($,!1)}Y.else()}invalid$data(){let{gen:$,schemaCode:Z,schemaType:Y,def:Q,it:W}=this;return(0,m.or)(J(),G());function J(){if(Y.length){if(!(Z instanceof m.Name))throw Error("ajv implementation error");let K=Array.isArray(Y)?Y:[Y];return m._`${(0,c4.checkDataTypes)(K,Z,W.opts.strictNumbers,c4.DataType.Wrong)}`}return m.nil}function G(){if(Q.validateSchema){let K=$.scopeValue("validate$data",{ref:Q.validateSchema});return m._`!${K}(${Z})`}return m.nil}}subschema($,Z){let Y=(0,zX.getSubschema)(this.it,$);(0,zX.extendSubschemaData)(Y,this.it,$),(0,zX.extendSubschemaMode)(Y,$);let Q={...this.it,...Y,items:void 0,props:void 0};return v_(Q,Z),Q}mergeEvaluated($,Z){let{it:Y,gen:Q}=this;if(!Y.opts.unevaluated)return;if(Y.props!==!0&&$.props!==void 0)Y.props=X6.mergeEvaluated.props(Q,$.props,Y.props,Z);if(Y.items!==!0&&$.items!==void 0)Y.items=X6.mergeEvaluated.items(Q,$.items,Y.items,Z)}mergeValidEvaluated($,Z){let{it:Y,gen:Q}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return Q.if(Z,()=>this.mergeEvaluated($,m.Name)),!0}}MB.KeywordCxt=NX;function qB($,Z,Y,Q){let W=new NX($,Y,Z);if("code"in Y)Y.code(W,Q);else if(W.$data&&Y.validate)(0,Z7.funcKeywordCode)(W,Y);else if("macro"in Y)(0,Z7.macroKeywordCode)(W,Y);else if(Y.compile||Y.validate)(0,Z7.funcKeywordCode)(W,Y)}var n_=/^\/(?:[^~]|~0|~1)*$/,r_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function NB($,{dataLevel:Z,dataNames:Y,dataPathArr:Q}){let W,J;if($==="")return o.default.rootData;if($[0]==="/"){if(!n_.test($))throw Error(`Invalid JSON-pointer: ${$}`);W=$,J=o.default.rootData}else{let D=r_.exec($);if(!D)throw Error(`Invalid JSON-pointer: ${$}`);let V=+D[1];if(W=D[2],W==="#"){if(V>=Z)throw Error(B("property/index",V));return Q[Z-V]}if(V>Z)throw Error(B("data",V));if(J=Y[Z-V],!W)return J}let G=J,K=W.split("/");for(let D of K)if(D)J=m._`${J}${(0,m.getProperty)((0,X6.unescapeJsonPointer)(D))}`,G=m._`${G} && ${J}`;return G;function B(D,V){return`Cannot access ${D} ${V} levels up, current level is ${Z}`}}MB.getData=NB});var d4=k((EB)=>{Object.defineProperty(EB,"__esModule",{value:!0});class wB extends Error{constructor($){super("validation failed");this.errors=$,this.ajv=this.validation=!0}}EB.default=wB});var Q7=k((_B)=>{Object.defineProperty(_B,"__esModule",{value:!0});var MX=e9();class RB extends Error{constructor($,Z,Y,Q){super(Q||`can't resolve reference ${Y} from id ${Z}`);this.missingRef=(0,MX.resolveUrl)($,Z,Y),this.missingSchema=(0,MX.normalizeId)((0,MX.getFullPath)($,this.missingRef))}}_B.default=RB});var r4=k((fB)=>{Object.defineProperty(fB,"__esModule",{value:!0});fB.resolveSchema=fB.getCompilingSchema=fB.resolveRef=fB.compileSchema=fB.SchemaEnv=void 0;var I0=Z1(),e_=d4(),t6=Q6(),f0=e9(),CB=G1(),$C=Y7();class X7{constructor($){var Z;this.refs={},this.dynamicAnchors={};let Y;if(typeof $.schema=="object")Y=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(Z=$.baseId)!==null&&Z!==void 0?Z:(0,f0.normalizeId)(Y===null||Y===void 0?void 0:Y[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=Y===null||Y===void 0?void 0:Y.$async,this.refs={}}}fB.SchemaEnv=X7;function wX($){let Z=IB.call(this,$);if(Z)return Z;let Y=(0,f0.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:Q,lines:W}=this.opts.code,{ownProperties:J}=this.opts,G=new I0.CodeGen(this.scope,{es5:Q,lines:W,ownProperties:J}),K;if($.$async)K=G.scopeValue("Error",{ref:e_.default,code:I0._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");$.validateName=B;let D={gen:G,allErrors:this.opts.allErrors,data:t6.default.data,parentData:t6.default.parentData,parentDataProperty:t6.default.parentDataProperty,dataNames:[t6.default.data],dataPathArr:[I0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,I0.stringify)($.schema)}:{ref:$.schema}),validateName:B,ValidationError:K,schema:$.schema,schemaEnv:$,rootId:Y,baseId:$.baseId||Y,schemaPath:I0.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:I0._`""`,opts:this.opts,self:this},V;try{this._compilations.add($),(0,$C.validateFunctionCode)(D),G.optimize(this.opts.code.optimize);let L=G.toString();if(V=`${G.scopeRefs(t6.default.scope)}return ${L}`,this.opts.code.process)V=this.opts.code.process(V,$);let O=Function(`${t6.default.self}`,`${t6.default.scope}`,V)(this,this.scope.get());if(this.scope.value(B,{ref:O}),O.errors=null,O.schema=$.schema,O.schemaEnv=$,$.$async)O.$async=!0;if(this.opts.code.source===!0)O.source={validateName:B,validateCode:L,scopeValues:G._values};if(this.opts.unevaluated){let{props:q,items:M}=D;if(O.evaluated={props:q instanceof I0.Name?void 0:q,items:M instanceof I0.Name?void 0:M,dynamicProps:q instanceof I0.Name,dynamicItems:M instanceof I0.Name},O.source)O.source.evaluated=(0,I0.stringify)(O.evaluated)}return $.validate=O,$}catch(L){if(delete $.validate,delete $.validateName,V)this.logger.error("Error compiling schema, function code:",V);throw L}finally{this._compilations.delete($)}}fB.compileSchema=wX;function ZC($,Z,Y){var Q;Y=(0,f0.resolveUrl)(this.opts.uriResolver,Z,Y);let W=$.refs[Y];if(W)return W;let J=XC.call(this,$,Y);if(J===void 0){let G=(Q=$.localRefs)===null||Q===void 0?void 0:Q[Y],{schemaId:K}=this.opts;if(G)J=new X7({schema:G,schemaId:K,root:$,baseId:Z})}if(J===void 0)return;return $.refs[Y]=YC.call(this,J)}fB.resolveRef=ZC;function YC($){if((0,f0.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:wX.call(this,$)}function IB($){for(let Z of this._compilations)if(QC(Z,$))return Z}fB.getCompilingSchema=IB;function QC($,Z){return $.schema===Z.schema&&$.root===Z.root&&$.baseId===Z.baseId}function XC($,Z){let Y;while(typeof(Y=this.refs[Z])=="string")Z=Y;return Y||this.schemas[Z]||n4.call(this,$,Z)}function n4($,Z){let Y=this.opts.uriResolver.parse(Z),Q=(0,f0._getFullPath)(this.opts.uriResolver,Y),W=(0,f0.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&Q===W)return PX.call(this,Y,$);let J=(0,f0.normalizeId)(Q),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let K=n4.call(this,$,G);if(typeof(K===null||K===void 0?void 0:K.schema)!=="object")return;return PX.call(this,Y,K)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)wX.call(this,G);if(J===(0,f0.normalizeId)(Z)){let{schema:K}=G,{schemaId:B}=this.opts,D=K[B];if(D)W=(0,f0.resolveUrl)(this.opts.uriResolver,W,D);return new X7({schema:K,schemaId:B,root:$,baseId:W})}return PX.call(this,Y,G)}fB.resolveSchema=n4;var WC=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function PX($,{baseId:Z,schema:Y,root:Q}){var W;if(((W=$.fragment)===null||W===void 0?void 0:W[0])!=="/")return;for(let K of $.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,CB.unescapeFragment)(K)];if(B===void 0)return;Y=B;let D=typeof Y==="object"&&Y[this.opts.schemaId];if(!WC.has(K)&&D)Z=(0,f0.resolveUrl)(this.opts.uriResolver,Z,D)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,CB.schemaHasRulesButRef)(Y,this.RULES)){let K=(0,f0.resolveUrl)(this.opts.uriResolver,Z,Y.$ref);J=n4.call(this,Q,K)}let{schemaId:G}=this.opts;if(J=J||new X7({schema:Y,schemaId:G,root:Q,baseId:Z}),J.schema!==J.root.schema)return J;return}});var bB=k((ar,BC)=>{BC.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var RX=k((or,kB)=>{var FC=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),yB=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function EX($){let Z="",Y=0,Q=0;for(Q=0;Q<$.length;Q++){if(Y=$[Q].charCodeAt(0),Y===48)continue;if(!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";Z+=$[Q];break}for(Q+=1;Q<$.length;Q++){if(Y=$[Q].charCodeAt(0),!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";Z+=$[Q]}return Z}var DC=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function vB($){return $.length=0,!0}function VC($,Z,Y){if($.length){let Q=EX($);if(Q!=="")Z.push(Q);else return Y.error=!0,!1;$.length=0}return!0}function LC($){let Z=0,Y={error:!1,address:"",zone:""},Q=[],W=[],J=!1,G=!1,K=VC;for(let B=0;B<$.length;B++){let D=$[B];if(D==="["||D==="]")continue;if(D===":"){if(J===!0)G=!0;if(!K(W,Q,Y))break;if(++Z>7){Y.error=!0;break}if(B>0&&$[B-1]===":")J=!0;Q.push(":");continue}else if(D==="%"){if(!K(W,Q,Y))break;K=vB}else{W.push(D);continue}}if(W.length)if(K===vB)Y.zone=W.join("");else if(G)Q.push(W.join(""));else Q.push(EX(W));return Y.address=Q.join(""),Y}function TB($){if(UC($,":")<2)return{host:$,isIPV6:!1};let Z=LC($);if(!Z.error){let{address:Y,address:Q}=Z;if(Z.zone)Y+="%"+Z.zone,Q+="%25"+Z.zone;return{host:Y,isIPV6:!0,escapedHost:Q}}else return{host:$,isIPV6:!1}}function UC($,Z){let Y=0;for(let Q=0;Q<$.length;Q++)if($[Q]===Z)Y++;return Y}function jC($){let Z=$,Y=[],Q=-1,W=0;while(W=Z.length){if(W===1)if(Z===".")break;else if(Z==="/"){Y.push("/");break}else{Y.push(Z);break}else if(W===2){if(Z[0]==="."){if(Z[1]===".")break;else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."||Z[1]==="/"){Y.push("/");break}}}else if(W===3){if(Z==="/.."){if(Y.length!==0)Y.pop();Y.push("/");break}}if(Z[0]==="."){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(3);continue}}else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(2);continue}else if(Z[2]==="."){if(Z[3]==="/"){if(Z=Z.slice(3),Y.length!==0)Y.pop();continue}}}}if((Q=Z.indexOf("/",1))===-1){Y.push(Z);break}else Y.push(Z.slice(0,Q)),Z=Z.slice(Q)}return Y.join("")}function AC($,Z){let Y=Z!==!0?escape:unescape;if($.scheme!==void 0)$.scheme=Y($.scheme);if($.userinfo!==void 0)$.userinfo=Y($.userinfo);if($.host!==void 0)$.host=Y($.host);if($.path!==void 0)$.path=Y($.path);if($.query!==void 0)$.query=Y($.query);if($.fragment!==void 0)$.fragment=Y($.fragment);return $}function zC($){let Z=[];if($.userinfo!==void 0)Z.push($.userinfo),Z.push("@");if($.host!==void 0){let Y=unescape($.host);if(!yB(Y)){let Q=TB(Y);if(Q.isIPV6===!0)Y=`[${Q.escapedHost}]`;else Y=$.host}Z.push(Y)}if(typeof $.port==="number"||typeof $.port==="string")Z.push(":"),Z.push(String($.port));return Z.length?Z.join(""):void 0}kB.exports={nonSimpleDomain:DC,recomposeAuthority:zC,normalizeComponentEncoding:AC,removeDotSegments:jC,isIPv4:yB,isUUID:FC,normalizeIPv6:TB,stringArrayToHexStripped:EX}});var mB=k((sr,hB)=>{var{isUUID:OC}=RX(),qC=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,NC=["http","https","ws","wss","urn","urn:uuid"];function MC($){return NC.indexOf($)!==-1}function _X($){if($.secure===!0)return!0;else if($.secure===!1)return!1;else if($.scheme)return $.scheme.length===3&&($.scheme[0]==="w"||$.scheme[0]==="W")&&($.scheme[1]==="s"||$.scheme[1]==="S")&&($.scheme[2]==="s"||$.scheme[2]==="S");else return!1}function xB($){if(!$.host)$.error=$.error||"HTTP URIs must have a host.";return $}function gB($){let Z=String($.scheme).toLowerCase()==="https";if($.port===(Z?443:80)||$.port==="")$.port=void 0;if(!$.path)$.path="/";return $}function PC($){return $.secure=_X($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$}function wC($){if($.port===(_X($)?443:80)||$.port==="")$.port=void 0;if(typeof $.secure==="boolean")$.scheme=$.secure?"wss":"ws",$.secure=void 0;if($.resourceName){let[Z,Y]=$.resourceName.split("?");$.path=Z&&Z!=="/"?Z:void 0,$.query=Y,$.resourceName=void 0}return $.fragment=void 0,$}function EC($,Z){if(!$.path)return $.error="URN can not be parsed",$;let Y=$.path.match(qC);if(Y){let Q=Z.scheme||$.scheme||"urn";$.nid=Y[1].toLowerCase(),$.nss=Y[2];let W=`${Q}:${Z.nid||$.nid}`,J=CX(W);if($.path=void 0,J)$=J.parse($,Z)}else $.error=$.error||"URN can not be parsed.";return $}function RC($,Z){if($.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=Z.scheme||$.scheme||"urn",Q=$.nid.toLowerCase(),W=`${Y}:${Z.nid||Q}`,J=CX(W);if(J)$=J.serialize($,Z);let G=$,K=$.nss;return G.path=`${Q||Z.nid}:${K}`,Z.skipEscape=!0,G}function _C($,Z){let Y=$;if(Y.uuid=Y.nss,Y.nss=void 0,!Z.tolerant&&(!Y.uuid||!OC(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function CC($){let Z=$;return Z.nss=($.uuid||"").toLowerCase(),Z}var uB={scheme:"http",domainHost:!0,parse:xB,serialize:gB},IC={scheme:"https",domainHost:uB.domainHost,parse:xB,serialize:gB},a4={scheme:"ws",domainHost:!0,parse:PC,serialize:wC},fC={scheme:"wss",domainHost:a4.domainHost,parse:a4.parse,serialize:a4.serialize},SC={scheme:"urn",parse:EC,serialize:RC,skipNormalize:!0},bC={scheme:"urn:uuid",parse:_C,serialize:CC,skipNormalize:!0},o4={http:uB,https:IC,ws:a4,wss:fC,urn:SC,"urn:uuid":bC};Object.setPrototypeOf(o4,null);function CX($){return $&&(o4[$]||o4[$.toLowerCase()])||void 0}hB.exports={wsIsSecure:_X,SCHEMES:o4,isValidSchemeName:MC,getSchemeHandler:CX}});var iB=k((tr,t4)=>{var{normalizeIPv6:vC,removeDotSegments:W7,recomposeAuthority:yC,normalizeComponentEncoding:s4,isIPv4:TC,nonSimpleDomain:kC}=RX(),{SCHEMES:xC,getSchemeHandler:lB}=mB();function gC($,Z){if(typeof $==="string")$=m0(W6($,Z),Z);else if(typeof $==="object")$=W6(m0($,Z),Z);return $}function uC($,Z,Y){let Q=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},W=pB(W6($,Q),W6(Z,Q),Q,!0);return Q.skipEscape=!0,m0(W,Q)}function pB($,Z,Y,Q){let W={};if(!Q)$=W6(m0($,Y),Y),Z=W6(m0(Z,Y),Y);if(Y=Y||{},!Y.tolerant&&Z.scheme)W.scheme=Z.scheme,W.userinfo=Z.userinfo,W.host=Z.host,W.port=Z.port,W.path=W7(Z.path||""),W.query=Z.query;else{if(Z.userinfo!==void 0||Z.host!==void 0||Z.port!==void 0)W.userinfo=Z.userinfo,W.host=Z.host,W.port=Z.port,W.path=W7(Z.path||""),W.query=Z.query;else{if(!Z.path)if(W.path=$.path,Z.query!==void 0)W.query=Z.query;else W.query=$.query;else{if(Z.path[0]==="/")W.path=W7(Z.path);else{if(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path)W.path="/"+Z.path;else if(!$.path)W.path=Z.path;else W.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+Z.path;W.path=W7(W.path)}W.query=Z.query}W.userinfo=$.userinfo,W.host=$.host,W.port=$.port}W.scheme=$.scheme}return W.fragment=Z.fragment,W}function hC($,Z,Y){if(typeof $==="string")$=unescape($),$=m0(s4(W6($,Y),!0),{...Y,skipEscape:!0});else if(typeof $==="object")$=m0(s4($,!0),{...Y,skipEscape:!0});if(typeof Z==="string")Z=unescape(Z),Z=m0(s4(W6(Z,Y),!0),{...Y,skipEscape:!0});else if(typeof Z==="object")Z=m0(s4(Z,!0),{...Y,skipEscape:!0});return $.toLowerCase()===Z.toLowerCase()}function m0($,Z){let Y={host:$.host,scheme:$.scheme,userinfo:$.userinfo,port:$.port,path:$.path,query:$.query,nid:$.nid,nss:$.nss,uuid:$.uuid,fragment:$.fragment,reference:$.reference,resourceName:$.resourceName,secure:$.secure,error:""},Q=Object.assign({},Z),W=[],J=lB(Q.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,Q);if(Y.path!==void 0)if(!Q.skipEscape){if(Y.path=escape(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=unescape(Y.path);if(Q.reference!=="suffix"&&Y.scheme)W.push(Y.scheme,":");let G=yC(Y);if(G!==void 0){if(Q.reference!=="suffix")W.push("//");if(W.push(G),Y.path&&Y.path[0]!=="/")W.push("/")}if(Y.path!==void 0){let K=Y.path;if(!Q.absolutePath&&(!J||!J.absolutePath))K=W7(K);if(G===void 0&&K[0]==="/"&&K[1]==="/")K="/%2F"+K.slice(2);W.push(K)}if(Y.query!==void 0)W.push("?",Y.query);if(Y.fragment!==void 0)W.push("#",Y.fragment);return W.join("")}var mC=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function W6($,Z){let Y=Object.assign({},Z),Q={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},W=!1;if(Y.reference==="suffix")if(Y.scheme)$=Y.scheme+":"+$;else $="//"+$;let J=$.match(mC);if(J){if(Q.scheme=J[1],Q.userinfo=J[3],Q.host=J[4],Q.port=parseInt(J[5],10),Q.path=J[6]||"",Q.query=J[7],Q.fragment=J[8],isNaN(Q.port))Q.port=J[5];if(Q.host)if(TC(Q.host)===!1){let B=vC(Q.host);Q.host=B.host.toLowerCase(),W=B.isIPV6}else W=!0;if(Q.scheme===void 0&&Q.userinfo===void 0&&Q.host===void 0&&Q.port===void 0&&Q.query===void 0&&!Q.path)Q.reference="same-document";else if(Q.scheme===void 0)Q.reference="relative";else if(Q.fragment===void 0)Q.reference="absolute";else Q.reference="uri";if(Y.reference&&Y.reference!=="suffix"&&Y.reference!==Q.reference)Q.error=Q.error||"URI is not a "+Y.reference+" reference.";let G=lB(Y.scheme||Q.scheme);if(!Y.unicodeSupport&&(!G||!G.unicodeSupport)){if(Q.host&&(Y.domainHost||G&&G.domainHost)&&W===!1&&kC(Q.host))try{Q.host=URL.domainToASCII(Q.host.toLowerCase())}catch(K){Q.error=Q.error||"Host's domain name can not be converted to ASCII: "+K}}if(!G||G&&!G.skipNormalize){if($.indexOf("%")!==-1){if(Q.scheme!==void 0)Q.scheme=unescape(Q.scheme);if(Q.host!==void 0)Q.host=unescape(Q.host)}if(Q.path)Q.path=escape(unescape(Q.path));if(Q.fragment)Q.fragment=encodeURI(decodeURIComponent(Q.fragment))}if(G&&G.parse)G.parse(Q,Y)}else Q.error=Q.error||"URI can not be parsed.";return Q}var IX={SCHEMES:xC,normalize:gC,resolve:uC,resolveComponent:pB,equal:hC,serialize:m0,parse:W6};t4.exports=IX;t4.exports.default=IX;t4.exports.fastUri=IX});var nB=k((dB)=>{Object.defineProperty(dB,"__esModule",{value:!0});var cB=iB();cB.code='require("ajv/dist/runtime/uri").default';dB.default=cB});var ZF=k((J6)=>{Object.defineProperty(J6,"__esModule",{value:!0});J6.CodeGen=J6.Name=J6.nil=J6.stringify=J6.str=J6._=J6.KeywordCxt=void 0;var pC=Y7();Object.defineProperty(J6,"KeywordCxt",{enumerable:!0,get:function(){return pC.KeywordCxt}});var p8=Z1();Object.defineProperty(J6,"_",{enumerable:!0,get:function(){return p8._}});Object.defineProperty(J6,"str",{enumerable:!0,get:function(){return p8.str}});Object.defineProperty(J6,"stringify",{enumerable:!0,get:function(){return p8.stringify}});Object.defineProperty(J6,"nil",{enumerable:!0,get:function(){return p8.nil}});Object.defineProperty(J6,"Name",{enumerable:!0,get:function(){return p8.Name}});Object.defineProperty(J6,"CodeGen",{enumerable:!0,get:function(){return p8.CodeGen}});var iC=d4(),tB=Q7(),cC=KX(),J7=r4(),dC=Z1(),G7=e9(),e4=t9(),SX=G1(),rB=bB(),nC=nB(),eB=($,Z)=>new RegExp($,Z);eB.code="new RegExp";var rC=["removeAdditional","useDefaults","coerceTypes"],aC=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),oC={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},sC={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},aB=200;function tC($){var Z,Y,Q,W,J,G,K,B,D,V,L,A,O,q,M,I,N,E,f,v,y,$1,j1,X0,F0;let _1=$.strict,W0=(Z=$.code)===null||Z===void 0?void 0:Z.optimize,o0=W0===!0||W0===void 0?1:W0||0,s0=(Q=(Y=$.code)===null||Y===void 0?void 0:Y.regExp)!==null&&Q!==void 0?Q:eB,q6=(W=$.uriResolver)!==null&&W!==void 0?W:nC.default;return{strictSchema:(G=(J=$.strictSchema)!==null&&J!==void 0?J:_1)!==null&&G!==void 0?G:!0,strictNumbers:(B=(K=$.strictNumbers)!==null&&K!==void 0?K:_1)!==null&&B!==void 0?B:!0,strictTypes:(V=(D=$.strictTypes)!==null&&D!==void 0?D:_1)!==null&&V!==void 0?V:"log",strictTuples:(A=(L=$.strictTuples)!==null&&L!==void 0?L:_1)!==null&&A!==void 0?A:"log",strictRequired:(q=(O=$.strictRequired)!==null&&O!==void 0?O:_1)!==null&&q!==void 0?q:!1,code:$.code?{...$.code,optimize:o0,regExp:s0}:{optimize:o0,regExp:s0},loopRequired:(M=$.loopRequired)!==null&&M!==void 0?M:aB,loopEnum:(I=$.loopEnum)!==null&&I!==void 0?I:aB,meta:(N=$.meta)!==null&&N!==void 0?N:!0,messages:(E=$.messages)!==null&&E!==void 0?E:!0,inlineRefs:(f=$.inlineRefs)!==null&&f!==void 0?f:!0,schemaId:(v=$.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(y=$.addUsedSchema)!==null&&y!==void 0?y:!0,validateSchema:($1=$.validateSchema)!==null&&$1!==void 0?$1:!0,validateFormats:(j1=$.validateFormats)!==null&&j1!==void 0?j1:!0,unicodeRegExp:(X0=$.unicodeRegExp)!==null&&X0!==void 0?X0:!0,int32range:(F0=$.int32range)!==null&&F0!==void 0?F0:!0,uriResolver:q6}}class $5{constructor($={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...tC($)};let{es5:Z,lines:Y}=this.opts.code;this.scope=new dC.ValueScope({scope:{},prefixes:aC,es5:Z,lines:Y}),this.logger=XI($.logger);let Q=$.validateFormats;if($.validateFormats=!1,this.RULES=(0,cC.getRules)(),oB.call(this,oC,$,"NOT SUPPORTED"),oB.call(this,sC,$,"DEPRECATED","warn"),this._metaOpts=YI.call(this),$.formats)$I.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords)ZI.call(this,$.keywords);if(typeof $.meta=="object")this.addMetaSchema($.meta);eC.call(this),$.validateFormats=Q}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:Z,schemaId:Y}=this.opts,Q=rB;if(Y==="id")Q={...rB},Q.id=Q.$id,delete Q.$id;if(Z&&$)this.addMetaSchema(Q,Q[Y],!1)}defaultMeta(){let{meta:$,schemaId:Z}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[Z]||$:void 0}validate($,Z){let Y;if(typeof $=="string"){if(Y=this.getSchema($),!Y)throw Error(`no schema with key or ref "${$}"`)}else Y=this.compile($);let Q=Y(Z);if(!("$async"in Y))this.errors=Y.errors;return Q}compile($,Z){let Y=this._addSchema($,Z);return Y.validate||this._compileSchemaEnv(Y)}compileAsync($,Z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:Y}=this.opts;return Q.call(this,$,Z);async function Q(D,V){await W.call(this,D.$schema);let L=this._addSchema(D,V);return L.validate||J.call(this,L)}async function W(D){if(D&&!this.getSchema(D))await Q.call(this,{$ref:D},!0)}async function J(D){try{return this._compileSchemaEnv(D)}catch(V){if(!(V instanceof tB.default))throw V;return G.call(this,V),await K.call(this,V.missingSchema),J.call(this,D)}}function G({missingSchema:D,missingRef:V}){if(this.refs[D])throw Error(`AnySchema ${D} is loaded but ${V} cannot be resolved`)}async function K(D){let V=await B.call(this,D);if(!this.refs[D])await W.call(this,V.$schema);if(!this.refs[D])this.addSchema(V,D,Z)}async function B(D){let V=this._loading[D];if(V)return V;try{return await(this._loading[D]=Y(D))}finally{delete this._loading[D]}}}addSchema($,Z,Y,Q=this.opts.validateSchema){if(Array.isArray($)){for(let J of $)this.addSchema(J,void 0,Y,Q);return this}let W;if(typeof $==="object"){let{schemaId:J}=this.opts;if(W=$[J],W!==void 0&&typeof W!="string")throw Error(`schema ${J} must be string`)}return Z=(0,G7.normalizeId)(Z||W),this._checkUnique(Z),this.schemas[Z]=this._addSchema($,Y,Z,Q,!0),this}addMetaSchema($,Z,Y=this.opts.validateSchema){return this.addSchema($,Z,!0,Y),this}validateSchema($,Z){if(typeof $=="boolean")return!0;let Y;if(Y=$.$schema,Y!==void 0&&typeof Y!="string")throw Error("$schema must be a string");if(Y=Y||this.opts.defaultMeta||this.defaultMeta(),!Y)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Q=this.validate(Y,$);if(!Q&&Z){let W="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(W);else throw Error(W)}return Q}getSchema($){let Z;while(typeof(Z=sB.call(this,$))=="string")$=Z;if(Z===void 0){let{schemaId:Y}=this.opts,Q=new J7.SchemaEnv({schema:{},schemaId:Y});if(Z=J7.resolveSchema.call(this,Q,$),!Z)return;this.refs[$]=Z}return Z.validate||this._compileSchemaEnv(Z)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let Z=sB.call(this,$);if(typeof Z=="object")this._cache.delete(Z.schema);return delete this.schemas[$],delete this.refs[$],this}case"object":{let Z=$;this._cache.delete(Z);let Y=$[this.opts.schemaId];if(Y)Y=(0,G7.normalizeId)(Y),delete this.schemas[Y],delete this.refs[Y];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let Z of $)this.addKeyword(Z);return this}addKeyword($,Z){let Y;if(typeof $=="string"){if(Y=$,typeof Z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Z.keyword=Y}else if(typeof $=="object"&&Z===void 0){if(Z=$,Y=Z.keyword,Array.isArray(Y)&&!Y.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(JI.call(this,Y,Z),!Z)return(0,SX.eachItem)(Y,(W)=>fX.call(this,W)),this;KI.call(this,Z);let Q={...Z,type:(0,e4.getJSONTypes)(Z.type),schemaType:(0,e4.getJSONTypes)(Z.schemaType)};return(0,SX.eachItem)(Y,Q.type.length===0?(W)=>fX.call(this,W,Q):(W)=>Q.type.forEach((J)=>fX.call(this,W,Q,J))),this}getKeyword($){let Z=this.RULES.all[$];return typeof Z=="object"?Z.definition:!!Z}removeKeyword($){let{RULES:Z}=this;delete Z.keywords[$],delete Z.all[$];for(let Y of Z.rules){let Q=Y.rules.findIndex((W)=>W.keyword===$);if(Q>=0)Y.rules.splice(Q,1)}return this}addFormat($,Z){if(typeof Z=="string")Z=new RegExp(Z);return this.formats[$]=Z,this}errorsText($=this.errors,{separator:Z=", ",dataVar:Y="data"}={}){if(!$||$.length===0)return"No errors";return $.map((Q)=>`${Y}${Q.instancePath} ${Q.message}`).reduce((Q,W)=>Q+Z+W)}$dataMetaSchema($,Z){let Y=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let Q of Z){let W=Q.split("/").slice(1),J=$;for(let G of W)J=J[G];for(let G in Y){let K=Y[G];if(typeof K!="object")continue;let{$data:B}=K.definition,D=J[G];if(B&&D)J[G]=$F(D)}}return $}_removeAllSchemas($,Z){for(let Y in $){let Q=$[Y];if(!Z||Z.test(Y)){if(typeof Q=="string")delete $[Y];else if(Q&&!Q.meta)this._cache.delete(Q.schema),delete $[Y]}}}_addSchema($,Z,Y,Q=this.opts.validateSchema,W=this.opts.addUsedSchema){let J,{schemaId:G}=this.opts;if(typeof $=="object")J=$[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof $!="boolean")throw Error("schema must be object or boolean");let K=this._cache.get($);if(K!==void 0)return K;Y=(0,G7.normalizeId)(J||Y);let B=G7.getSchemaRefs.call(this,$,Y);if(K=new J7.SchemaEnv({schema:$,schemaId:G,meta:Z,baseId:Y,localRefs:B}),this._cache.set(K.schema,K),W&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=K}if(Q)this.validateSchema($,!0);return K}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta)this._compileMetaSchema($);else J7.compileSchema.call(this,$);if(!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let Z=this.opts;this.opts=this._metaOpts;try{J7.compileSchema.call(this,$)}finally{this.opts=Z}}}$5.ValidationError=iC.default;$5.MissingRefError=tB.default;J6.default=$5;function oB($,Z,Y,Q="error"){for(let W in $){let J=W;if(J in Z)this.logger[Q](`${Y}: option ${W}. ${$[J]}`)}}function sB($){return $=(0,G7.normalizeId)($),this.schemas[$]||this.refs[$]}function eC(){let $=this.opts.schemas;if(!$)return;if(Array.isArray($))this.addSchema($);else for(let Z in $)this.addSchema($[Z],Z)}function $I(){for(let $ in this.opts.formats){let Z=this.opts.formats[$];if(Z)this.addFormat($,Z)}}function ZI($){if(Array.isArray($)){this.addVocabulary($);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Z in $){let Y=$[Z];if(!Y.keyword)Y.keyword=Z;this.addKeyword(Y)}}function YI(){let $={...this.opts};for(let Z of rC)delete $[Z];return $}var QI={log(){},warn(){},error(){}};function XI($){if($===!1)return QI;if($===void 0)return console;if($.log&&$.warn&&$.error)return $;throw Error("logger must implement log, warn and error methods")}var WI=/^[a-z_$][a-z0-9_$:-]*$/i;function JI($,Z){let{RULES:Y}=this;if((0,SX.eachItem)($,(Q)=>{if(Y.keywords[Q])throw Error(`Keyword ${Q} is already defined`);if(!WI.test(Q))throw Error(`Keyword ${Q} has invalid name`)}),!Z)return;if(Z.$data&&!(("code"in Z)||("validate"in Z)))throw Error('$data keyword must have "code" or "validate" function')}function fX($,Z,Y){var Q;let W=Z===null||Z===void 0?void 0:Z.post;if(Y&&W)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=W?J.post:J.rules.find(({type:B})=>B===Y);if(!G)G={type:Y,rules:[]},J.rules.push(G);if(J.keywords[$]=!0,!Z)return;let K={keyword:$,definition:{...Z,type:(0,e4.getJSONTypes)(Z.type),schemaType:(0,e4.getJSONTypes)(Z.schemaType)}};if(Z.before)GI.call(this,G,K,Z.before);else G.rules.push(K);J.all[$]=K,(Q=Z.implements)===null||Q===void 0||Q.forEach((B)=>this.addKeyword(B))}function GI($,Z,Y){let Q=$.rules.findIndex((W)=>W.keyword===Y);if(Q>=0)$.rules.splice(Q,0,Z);else $.rules.push(Z),this.logger.warn(`rule ${Y} is not defined`)}function KI($){let{metaSchema:Z}=$;if(Z===void 0)return;if($.$data&&this.opts.$data)Z=$F(Z);$.validateSchema=this.compile(Z,!0)}var HI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function $F($){return{anyOf:[$,HI]}}});var QF=k((YF)=>{Object.defineProperty(YF,"__esModule",{value:!0});var DI={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};YF.default=DI});var HF=k((GF)=>{Object.defineProperty(GF,"__esModule",{value:!0});GF.callRef=GF.getValidate=void 0;var LI=Q7(),XF=A0(),s1=Z1(),i8=Q6(),WF=r4(),Z5=G1(),UI={keyword:"$ref",schemaType:"string",code($){let{gen:Z,schema:Y,it:Q}=$,{baseId:W,schemaEnv:J,validateName:G,opts:K,self:B}=Q,{root:D}=J;if((Y==="#"||Y==="#/")&&W===D.baseId)return L();let V=WF.resolveRef.call(B,D,W,Y);if(V===void 0)throw new LI.default(Q.opts.uriResolver,W,Y);if(V instanceof WF.SchemaEnv)return A(V);return O(V);function L(){if(J===D)return Y5($,G,J,J.$async);let q=Z.scopeValue("root",{ref:D});return Y5($,s1._`${q}.validate`,D,D.$async)}function A(q){let M=JF($,q);Y5($,M,q,q.$async)}function O(q){let M=Z.scopeValue("schema",K.code.source===!0?{ref:q,code:(0,s1.stringify)(q)}:{ref:q}),I=Z.name("valid"),N=$.subschema({schema:q,dataTypes:[],schemaPath:s1.nil,topSchemaRef:M,errSchemaPath:Y},I);$.mergeEvaluated(N),$.ok(I)}}};function JF($,Z){let{gen:Y}=$;return Z.validate?Y.scopeValue("validate",{ref:Z.validate}):s1._`${Y.scopeValue("wrapper",{ref:Z})}.validate`}GF.getValidate=JF;function Y5($,Z,Y,Q){let{gen:W,it:J}=$,{allErrors:G,schemaEnv:K,opts:B}=J,D=B.passContext?i8.default.this:s1.nil;if(Q)V();else L();function V(){if(!K.$async)throw Error("async schema referenced by sync schema");let q=W.let("valid");W.try(()=>{if(W.code(s1._`await ${(0,XF.callValidateCode)($,Z,D)}`),O(Z),!G)W.assign(q,!0)},(M)=>{if(W.if(s1._`!(${M} instanceof ${J.ValidationError})`,()=>W.throw(M)),A(M),!G)W.assign(q,!1)}),$.ok(q)}function L(){$.result((0,XF.callValidateCode)($,Z,D),()=>O(Z),()=>A(Z))}function A(q){let M=s1._`${q}.errors`;W.assign(i8.default.vErrors,s1._`${i8.default.vErrors} === null ? ${M} : ${i8.default.vErrors}.concat(${M})`),W.assign(i8.default.errors,s1._`${i8.default.vErrors}.length`)}function O(q){var M;if(!J.opts.unevaluated)return;let I=(M=Y===null||Y===void 0?void 0:Y.validate)===null||M===void 0?void 0:M.evaluated;if(J.props!==!0)if(I&&!I.dynamicProps){if(I.props!==void 0)J.props=Z5.mergeEvaluated.props(W,I.props,J.props)}else{let N=W.var("props",s1._`${q}.evaluated.props`);J.props=Z5.mergeEvaluated.props(W,N,J.props,s1.Name)}if(J.items!==!0)if(I&&!I.dynamicItems){if(I.items!==void 0)J.items=Z5.mergeEvaluated.items(W,I.items,J.items)}else{let N=W.var("items",s1._`${q}.evaluated.items`);J.items=Z5.mergeEvaluated.items(W,N,J.items,s1.Name)}}}GF.callRef=Y5;GF.default=UI});var FF=k((BF)=>{Object.defineProperty(BF,"__esModule",{value:!0});var zI=QF(),OI=HF(),qI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",zI.default,OI.default];BF.default=qI});var VF=k((DF)=>{Object.defineProperty(DF,"__esModule",{value:!0});var Q5=Z1(),v6=Q5.operators,X5={maximum:{okStr:"<=",ok:v6.LTE,fail:v6.GT},minimum:{okStr:">=",ok:v6.GTE,fail:v6.LT},exclusiveMaximum:{okStr:"<",ok:v6.LT,fail:v6.GTE},exclusiveMinimum:{okStr:">",ok:v6.GT,fail:v6.LTE}},MI={message:({keyword:$,schemaCode:Z})=>Q5.str`must be ${X5[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>Q5._`{comparison: ${X5[$].okStr}, limit: ${Z}}`},PI={keyword:Object.keys(X5),type:"number",schemaType:"number",$data:!0,error:MI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$;$.fail$data(Q5._`${Y} ${X5[Z].fail} ${Q} || isNaN(${Y})`)}};DF.default=PI});var UF=k((LF)=>{Object.defineProperty(LF,"__esModule",{value:!0});var K7=Z1(),EI={message:({schemaCode:$})=>K7.str`must be multiple of ${$}`,params:({schemaCode:$})=>K7._`{multipleOf: ${$}}`},RI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EI,code($){let{gen:Z,data:Y,schemaCode:Q,it:W}=$,J=W.opts.multipleOfPrecision,G=Z.let("res"),K=J?K7._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:K7._`${G} !== parseInt(${G})`;$.fail$data(K7._`(${Q} === 0 || (${G} = ${Y}/${Q}, ${K}))`)}};LF.default=RI});var zF=k((AF)=>{Object.defineProperty(AF,"__esModule",{value:!0});function jF($){let Z=$.length,Y=0,Q=0,W;while(Q<Z)if(Y++,W=$.charCodeAt(Q++),W>=55296&&W<=56319&&Q<Z){if(W=$.charCodeAt(Q),(W&64512)===56320)Q++}return Y}AF.default=jF;jF.code='require("ajv/dist/runtime/ucs2length").default'});var qF=k((OF)=>{Object.defineProperty(OF,"__esModule",{value:!0});var e6=Z1(),II=G1(),fI=zF(),SI={message({keyword:$,schemaCode:Z}){let Y=$==="maxLength"?"more":"fewer";return e6.str`must NOT have ${Y} than ${Z} characters`},params:({schemaCode:$})=>e6._`{limit: ${$}}`},bI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:SI,code($){let{keyword:Z,data:Y,schemaCode:Q,it:W}=$,J=Z==="maxLength"?e6.operators.GT:e6.operators.LT,G=W.opts.unicode===!1?e6._`${Y}.length`:e6._`${(0,II.useFunc)($.gen,fI.default)}(${Y})`;$.fail$data(e6._`${G} ${J} ${Q}`)}};OF.default=bI});var MF=k((NF)=>{Object.defineProperty(NF,"__esModule",{value:!0});var yI=A0(),TI=G1(),c8=Z1(),kI={message:({schemaCode:$})=>c8.str`must match pattern "${$}"`,params:({schemaCode:$})=>c8._`{pattern: ${$}}`},xI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:kI,code($){let{gen:Z,data:Y,$data:Q,schema:W,schemaCode:J,it:G}=$,K=G.opts.unicodeRegExp?"u":"";if(Q){let{regExp:B}=G.opts.code,D=B.code==="new RegExp"?c8._`new RegExp`:(0,TI.useFunc)(Z,B),V=Z.let("valid");Z.try(()=>Z.assign(V,c8._`${D}(${J}, ${K}).test(${Y})`),()=>Z.assign(V,!1)),$.fail$data(c8._`!${V}`)}else{let B=(0,yI.usePattern)($,W);$.fail$data(c8._`!${B}.test(${Y})`)}}};NF.default=xI});var wF=k((PF)=>{Object.defineProperty(PF,"__esModule",{value:!0});var H7=Z1(),uI={message({keyword:$,schemaCode:Z}){let Y=$==="maxProperties"?"more":"fewer";return H7.str`must NOT have ${Y} than ${Z} properties`},params:({schemaCode:$})=>H7._`{limit: ${$}}`},hI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:uI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$,W=Z==="maxProperties"?H7.operators.GT:H7.operators.LT;$.fail$data(H7._`Object.keys(${Y}).length ${W} ${Q}`)}};PF.default=hI});var RF=k((EF)=>{Object.defineProperty(EF,"__esModule",{value:!0});var B7=A0(),F7=Z1(),lI=G1(),pI={message:({params:{missingProperty:$}})=>F7.str`must have required property '${$}'`,params:({params:{missingProperty:$}})=>F7._`{missingProperty: ${$}}`},iI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:pI,code($){let{gen:Z,schema:Y,schemaCode:Q,data:W,$data:J,it:G}=$,{opts:K}=G;if(!J&&Y.length===0)return;let B=Y.length>=K.loopRequired;if(G.allErrors)D();else V();if(K.strictRequired){let O=$.parentSchema.properties,{definedProperties:q}=$.it;for(let M of Y)if((O===null||O===void 0?void 0:O[M])===void 0&&!q.has(M)){let I=G.schemaEnv.baseId+G.errSchemaPath,N=`required property "${M}" is not defined at "${I}" (strictRequired)`;(0,lI.checkStrictMode)(G,N,G.opts.strictRequired)}}function D(){if(B||J)$.block$data(F7.nil,L);else for(let O of Y)(0,B7.checkReportMissingProp)($,O)}function V(){let O=Z.let("missing");if(B||J){let q=Z.let("valid",!0);$.block$data(q,()=>A(O,q)),$.ok(q)}else Z.if((0,B7.checkMissingProp)($,Y,O)),(0,B7.reportMissingProp)($,O),Z.else()}function L(){Z.forOf("prop",Q,(O)=>{$.setParams({missingProperty:O}),Z.if((0,B7.noPropertyInData)(Z,W,O,K.ownProperties),()=>$.error())})}function A(O,q){$.setParams({missingProperty:O}),Z.forOf(O,Q,()=>{Z.assign(q,(0,B7.propertyInData)(Z,W,O,K.ownProperties)),Z.if((0,F7.not)(q),()=>{$.error(),Z.break()})},F7.nil)}}};EF.default=iI});var CF=k((_F)=>{Object.defineProperty(_F,"__esModule",{value:!0});var D7=Z1(),dI={message({keyword:$,schemaCode:Z}){let Y=$==="maxItems"?"more":"fewer";return D7.str`must NOT have ${Y} than ${Z} items`},params:({schemaCode:$})=>D7._`{limit: ${$}}`},nI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:dI,code($){let{keyword:Z,data:Y,schemaCode:Q}=$,W=Z==="maxItems"?D7.operators.GT:D7.operators.LT;$.fail$data(D7._`${Y}.length ${W} ${Q}`)}};_F.default=nI});var W5=k((fF)=>{Object.defineProperty(fF,"__esModule",{value:!0});var IF=jX();IF.code='require("ajv/dist/runtime/equal").default';fF.default=IF});var bF=k((SF)=>{Object.defineProperty(SF,"__esModule",{value:!0});var bX=t9(),x1=Z1(),oI=G1(),sI=W5(),tI={message:({params:{i:$,j:Z}})=>x1.str`must NOT have duplicate items (items ## ${Z} and ${$} are identical)`,params:({params:{i:$,j:Z}})=>x1._`{i: ${$}, j: ${Z}}`},eI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:tI,code($){let{gen:Z,data:Y,$data:Q,schema:W,parentSchema:J,schemaCode:G,it:K}=$;if(!Q&&!W)return;let B=Z.let("valid"),D=J.items?(0,bX.getSchemaTypes)(J.items):[];$.block$data(B,V,x1._`${G} === false`),$.ok(B);function V(){let q=Z.let("i",x1._`${Y}.length`),M=Z.let("j");$.setParams({i:q,j:M}),Z.assign(B,!0),Z.if(x1._`${q} > 1`,()=>(L()?A:O)(q,M))}function L(){return D.length>0&&!D.some((q)=>q==="object"||q==="array")}function A(q,M){let I=Z.name("item"),N=(0,bX.checkDataTypes)(D,I,K.opts.strictNumbers,bX.DataType.Wrong),E=Z.const("indices",x1._`{}`);Z.for(x1._`;${q}--;`,()=>{if(Z.let(I,x1._`${Y}[${q}]`),Z.if(N,x1._`continue`),D.length>1)Z.if(x1._`typeof ${I} == "string"`,x1._`${I} += "_"`);Z.if(x1._`typeof ${E}[${I}] == "number"`,()=>{Z.assign(M,x1._`${E}[${I}]`),$.error(),Z.assign(B,!1).break()}).code(x1._`${E}[${I}] = ${q}`)})}function O(q,M){let I=(0,oI.useFunc)(Z,sI.default),N=Z.name("outer");Z.label(N).for(x1._`;${q}--;`,()=>Z.for(x1._`${M} = ${q}; ${M}--;`,()=>Z.if(x1._`${I}(${Y}[${q}], ${Y}[${M}])`,()=>{$.error(),Z.assign(B,!1).break(N)})))}}};SF.default=eI});var yF=k((vF)=>{Object.defineProperty(vF,"__esModule",{value:!0});var vX=Z1(),Zf=G1(),Yf=W5(),Qf={message:"must be equal to constant",params:({schemaCode:$})=>vX._`{allowedValue: ${$}}`},Xf={keyword:"const",$data:!0,error:Qf,code($){let{gen:Z,data:Y,$data:Q,schemaCode:W,schema:J}=$;if(Q||J&&typeof J=="object")$.fail$data(vX._`!${(0,Zf.useFunc)(Z,Yf.default)}(${Y}, ${W})`);else $.fail(vX._`${J} !== ${Y}`)}};vF.default=Xf});var kF=k((TF)=>{Object.defineProperty(TF,"__esModule",{value:!0});var V7=Z1(),Jf=G1(),Gf=W5(),Kf={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>V7._`{allowedValues: ${$}}`},Hf={keyword:"enum",schemaType:"array",$data:!0,error:Kf,code($){let{gen:Z,data:Y,$data:Q,schema:W,schemaCode:J,it:G}=$;if(!Q&&W.length===0)throw Error("enum must have non-empty array");let K=W.length>=G.opts.loopEnum,B,D=()=>B!==null&&B!==void 0?B:B=(0,Jf.useFunc)(Z,Gf.default),V;if(K||Q)V=Z.let("valid"),$.block$data(V,L);else{if(!Array.isArray(W))throw Error("ajv implementation error");let O=Z.const("vSchema",J);V=(0,V7.or)(...W.map((q,M)=>A(O,M)))}$.pass(V);function L(){Z.assign(V,!1),Z.forOf("v",J,(O)=>Z.if(V7._`${D()}(${Y}, ${O})`,()=>Z.assign(V,!0).break()))}function A(O,q){let M=W[q];return typeof M==="object"&&M!==null?V7._`${D()}(${Y}, ${O}[${q}])`:V7._`${Y} === ${M}`}}};TF.default=Hf});var gF=k((xF)=>{Object.defineProperty(xF,"__esModule",{value:!0});var Ff=VF(),Df=UF(),Vf=qF(),Lf=MF(),Uf=wF(),jf=RF(),Af=CF(),zf=bF(),Of=yF(),qf=kF(),Nf=[Ff.default,Df.default,Vf.default,Lf.default,Uf.default,jf.default,Af.default,zf.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Of.default,qf.default];xF.default=Nf});var TX=k((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.validateAdditionalItems=void 0;var $8=Z1(),yX=G1(),Pf={message:({params:{len:$}})=>$8.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>$8._`{limit: ${$}}`},wf={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Pf,code($){let{parentSchema:Z,it:Y}=$,{items:Q}=Z;if(!Array.isArray(Q)){(0,yX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}uF($,Q)}};function uF($,Z){let{gen:Y,schema:Q,data:W,keyword:J,it:G}=$;G.items=!0;let K=Y.const("len",$8._`${W}.length`);if(Q===!1)$.setParams({len:Z.length}),$.pass($8._`${K} <= ${Z.length}`);else if(typeof Q=="object"&&!(0,yX.alwaysValidSchema)(G,Q)){let D=Y.var("valid",$8._`${K} <= ${Z.length}`);Y.if((0,$8.not)(D),()=>B(D)),$.ok(D)}function B(D){Y.forRange("i",Z.length,K,(V)=>{if($.subschema({keyword:J,dataProp:V,dataPropType:yX.Type.Num},D),!G.allErrors)Y.if((0,$8.not)(D),()=>Y.break())})}}hF.validateAdditionalItems=uF;hF.default=wf});var kX=k((iF)=>{Object.defineProperty(iF,"__esModule",{value:!0});iF.validateTuple=void 0;var lF=Z1(),J5=G1(),Rf=A0(),_f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code($){let{schema:Z,it:Y}=$;if(Array.isArray(Z))return pF($,"additionalItems",Z);if(Y.items=!0,(0,J5.alwaysValidSchema)(Y,Z))return;$.ok((0,Rf.validateArray)($))}};function pF($,Z,Y=$.schema){let{gen:Q,parentSchema:W,data:J,keyword:G,it:K}=$;if(V(W),K.opts.unevaluated&&Y.length&&K.items!==!0)K.items=J5.mergeEvaluated.items(Q,Y.length,K.items);let B=Q.name("valid"),D=Q.const("len",lF._`${J}.length`);Y.forEach((L,A)=>{if((0,J5.alwaysValidSchema)(K,L))return;Q.if(lF._`${D} > ${A}`,()=>$.subschema({keyword:G,schemaProp:A,dataProp:A},B)),$.ok(B)});function V(L){let{opts:A,errSchemaPath:O}=K,q=Y.length,M=q===L.minItems&&(q===L.maxItems||L[Z]===!1);if(A.strictTuples&&!M){let I=`"${G}" is ${q}-tuple, but minItems or maxItems/${Z} are not specified or different at path "${O}"`;(0,J5.checkStrictMode)(K,I,A.strictTuples)}}}iF.validateTuple=pF;iF.default=_f});var nF=k((dF)=>{Object.defineProperty(dF,"__esModule",{value:!0});var If=kX(),ff={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:($)=>(0,If.validateTuple)($,"items")};dF.default=ff});var oF=k((aF)=>{Object.defineProperty(aF,"__esModule",{value:!0});var rF=Z1(),bf=G1(),vf=A0(),yf=TX(),Tf={message:({params:{len:$}})=>rF.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>rF._`{limit: ${$}}`},kf={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Tf,code($){let{schema:Z,parentSchema:Y,it:Q}=$,{prefixItems:W}=Y;if(Q.items=!0,(0,bf.alwaysValidSchema)(Q,Z))return;if(W)(0,yf.validateAdditionalItems)($,W);else $.ok((0,vf.validateArray)($))}};aF.default=kf});var tF=k((sF)=>{Object.defineProperty(sF,"__esModule",{value:!0});var z0=Z1(),G5=G1(),gf={message:({params:{min:$,max:Z}})=>Z===void 0?z0.str`must contain at least ${$} valid item(s)`:z0.str`must contain at least ${$} and no more than ${Z} valid item(s)`,params:({params:{min:$,max:Z}})=>Z===void 0?z0._`{minContains: ${$}}`:z0._`{minContains: ${$}, maxContains: ${Z}}`},uf={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:gf,code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,it:J}=$,G,K,{minContains:B,maxContains:D}=Q;if(J.opts.next)G=B===void 0?1:B,K=D;else G=1;let V=Z.const("len",z0._`${W}.length`);if($.setParams({min:G,max:K}),K===void 0&&G===0){(0,G5.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(K!==void 0&&G>K){(0,G5.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),$.fail();return}if((0,G5.alwaysValidSchema)(J,Y)){let M=z0._`${V} >= ${G}`;if(K!==void 0)M=z0._`${M} && ${V} <= ${K}`;$.pass(M);return}J.items=!0;let L=Z.name("valid");if(K===void 0&&G===1)O(L,()=>Z.if(L,()=>Z.break()));else if(G===0){if(Z.let(L,!0),K!==void 0)Z.if(z0._`${W}.length > 0`,A)}else Z.let(L,!1),A();$.result(L,()=>$.reset());function A(){let M=Z.name("_valid"),I=Z.let("count",0);O(M,()=>Z.if(M,()=>q(I)))}function O(M,I){Z.forRange("i",0,V,(N)=>{$.subschema({keyword:"contains",dataProp:N,dataPropType:G5.Type.Num,compositeRule:!0},M),I()})}function q(M){if(Z.code(z0._`${M}++`),K===void 0)Z.if(z0._`${M} >= ${G}`,()=>Z.assign(L,!0).break());else if(Z.if(z0._`${M} > ${K}`,()=>Z.assign(L,!1).break()),G===1)Z.assign(L,!0);else Z.if(z0._`${M} >= ${G}`,()=>Z.assign(L,!0))}}};sF.default=uf});var XD=k((ZD)=>{Object.defineProperty(ZD,"__esModule",{value:!0});ZD.validateSchemaDeps=ZD.validatePropertyDeps=ZD.error=void 0;var xX=Z1(),mf=G1(),L7=A0();ZD.error={message:({params:{property:$,depsCount:Z,deps:Y}})=>{let Q=Z===1?"property":"properties";return xX.str`must have ${Q} ${Y} when property ${$} is present`},params:({params:{property:$,depsCount:Z,deps:Y,missingProperty:Q}})=>xX._`{property: ${$},
|
|
7
7
|
missingProperty: ${Q},
|
|
8
8
|
depsCount: ${Z},
|
|
9
|
-
deps: ${Y}}`};var lf={keyword:"dependencies",type:"object",schemaType:"object",error:ZD.error,code($){let[Z,Y]=pf($);eF($,Z),$D($,Y)}};function pf({schema:$}){let Z={},Y={};for(let Q in $){if(Q==="__proto__")continue;let W=Array.isArray($[Q])?Z:Y;W[Q]=$[Q]}return[Z,Y]}function eF($,Z=$.schema){let{gen:Y,data:Q,it:W}=$;if(Object.keys(Z).length===0)return;let J=Y.let("missing");for(let G in Z){let K=Z[G];if(K.length===0)continue;let B=(0,L7.propertyInData)(Y,Q,G,W.opts.ownProperties);if($.setParams({property:G,depsCount:K.length,deps:K.join(", ")}),W.allErrors)Y.if(B,()=>{for(let D of K)(0,L7.checkReportMissingProp)($,D)});else Y.if(xX._`${B} && (${(0,L7.checkMissingProp)($,K,J)})`),(0,L7.reportMissingProp)($,J),Y.else()}}ZD.validatePropertyDeps=eF;function $D($,Z=$.schema){let{gen:Y,data:Q,keyword:W,it:J}=$,G=Y.name("valid");for(let K in Z){if((0,mf.alwaysValidSchema)(J,Z[K]))continue;Y.if((0,L7.propertyInData)(Y,Q,K,J.opts.ownProperties),()=>{let B=$.subschema({keyword:W,schemaProp:K},G);$.mergeValidEvaluated(B,G)},()=>Y.var(G,!0)),$.ok(G)}}ZD.validateSchemaDeps=$D;ZD.default=lf});var GD=k((JD)=>{Object.defineProperty(JD,"__esModule",{value:!0});var WD=Z1(),nf=G1(),rf={message:"property name must be valid",params:({params:$})=>WD._`{propertyName: ${$.propertyName}}`},af={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rf,code($){let{gen:Z,schema:Y,data:Q,it:W}=$;if((0,nf.alwaysValidSchema)(W,Y))return;let J=Z.name("valid");Z.forIn("key",Q,(G)=>{$.setParams({propertyName:G}),$.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),Z.if((0,WD.not)(J),()=>{if($.error(!0),!W.allErrors)Z.break()})}),$.ok(J)}};JD.default=af});var gX=k((KD)=>{Object.defineProperty(KD,"__esModule",{value:!0});var K5=A0(),S0=Z1(),sf=Q6(),H5=G1(),tf={message:"must NOT have additional properties",params:({params:$})=>S0._`{additionalProperty: ${$.additionalProperty}}`},ef={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tf,code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,errsCount:J,it:G}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:B}=G;if(G.props=!0,B.removeAdditional!=="all"&&(0,H5.alwaysValidSchema)(G,Y))return;let D=(0,K5.allSchemaProperties)(Q.properties),V=(0,K5.allSchemaProperties)(Q.patternProperties);L(),$.ok(S0._`${J} === ${sf.default.errors}`);function L(){Z.forIn("key",W,(I)=>{if(!D.length&&!V.length)q(I);else Z.if(A(I),()=>q(I))})}function A(I){let N;if(D.length>8){let E=(0,H5.schemaRefOrVal)(G,Q.properties,"properties");N=(0,K5.isOwnProperty)(Z,E,I)}else if(D.length)N=(0,S0.or)(...D.map((E)=>S0._`${I} === ${E}`));else N=S0.nil;if(V.length)N=(0,S0.or)(N,...V.map((E)=>S0._`${(0,K5.usePattern)($,E)}.test(${I})`));return(0,S0.not)(N)}function O(I){Z.code(S0._`delete ${W}[${I}]`)}function q(I){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){O(I);return}if(Y===!1){if($.setParams({additionalProperty:I}),$.error(),!K)Z.break();return}if(typeof Y=="object"&&!(0,H5.alwaysValidSchema)(G,Y)){let N=Z.name("valid");if(B.removeAdditional==="failing")M(I,N,!1),Z.if((0,S0.not)(N),()=>{$.reset(),O(I)});else if(M(I,N),!K)Z.if((0,S0.not)(N),()=>Z.break())}}function M(I,N,E){let f={keyword:"additionalProperties",dataProp:I,dataPropType:H5.Type.Str};if(E===!1)Object.assign(f,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(f,N)}}};KD.default=ef});var DD=k((FD)=>{Object.defineProperty(FD,"__esModule",{value:!0});var ZS=Y7(),HD=A0(),uX=G1(),BD=gX(),YS={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,it:J}=$;if(J.opts.removeAdditional==="all"&&Q.additionalProperties===void 0)BD.default.code(new ZS.KeywordCxt(J,BD.default,"additionalProperties"));let G=(0,HD.allSchemaProperties)(Y);for(let L of G)J.definedProperties.add(L);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=uX.mergeEvaluated.props(Z,(0,uX.toHash)(G),J.props);let K=G.filter((L)=>!(0,uX.alwaysValidSchema)(J,Y[L]));if(K.length===0)return;let B=Z.name("valid");for(let L of K){if(D(L))V(L);else{if(Z.if((0,HD.propertyInData)(Z,W,L,J.opts.ownProperties)),V(L),!J.allErrors)Z.else().var(B,!0);Z.endIf()}$.it.definedProperties.add(L),$.ok(B)}function D(L){return J.opts.useDefaults&&!J.compositeRule&&Y[L].default!==void 0}function V(L){$.subschema({keyword:"properties",schemaProp:L,dataProp:L},B)}}};FD.default=YS});var AD=k((jD)=>{Object.defineProperty(jD,"__esModule",{value:!0});var VD=A0(),B5=Z1(),LD=G1(),UD=G1(),XS={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:Z,schema:Y,data:Q,parentSchema:W,it:J}=$,{opts:G}=J,K=(0,VD.allSchemaProperties)(Y),B=K.filter((M)=>(0,LD.alwaysValidSchema)(J,Y[M]));if(K.length===0||B.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let D=G.strictSchema&&!G.allowMatchingProperties&&W.properties,V=Z.name("valid");if(J.props!==!0&&!(J.props instanceof B5.Name))J.props=(0,UD.evaluatedPropsToName)(Z,J.props);let{props:L}=J;A();function A(){for(let M of K){if(D)O(M);if(J.allErrors)q(M);else Z.var(V,!0),q(M),Z.if(V)}}function O(M){for(let I in D)if(new RegExp(M).test(I))(0,LD.checkStrictMode)(J,`property ${I} matches pattern ${M} (use allowMatchingProperties)`)}function q(M){Z.forIn("key",Q,(I)=>{Z.if(B5._`${(0,VD.usePattern)($,M)}.test(${I})`,()=>{let N=B.includes(M);if(!N)$.subschema({keyword:"patternProperties",schemaProp:M,dataProp:I,dataPropType:UD.Type.Str},V);if(J.opts.unevaluated&&L!==!0)Z.assign(B5._`${L}[${I}]`,!0);else if(!N&&!J.allErrors)Z.if((0,B5.not)(V),()=>Z.break())})})}}};jD.default=XS});var OD=k((zD)=>{Object.defineProperty(zD,"__esModule",{value:!0});var JS=G1(),GS={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code($){let{gen:Z,schema:Y,it:Q}=$;if((0,JS.alwaysValidSchema)(Q,Y)){$.fail();return}let W=Z.name("valid");$.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},W),$.failResult(W,()=>$.reset(),()=>$.error())},error:{message:"must NOT be valid"}};zD.default=GS});var ND=k((qD)=>{Object.defineProperty(qD,"__esModule",{value:!0});var HS=A0(),BS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:HS.validateUnion,error:{message:"must match a schema in anyOf"}};qD.default=BS});var PD=k((MD)=>{Object.defineProperty(MD,"__esModule",{value:!0});var F5=Z1(),DS=G1(),VS={message:"must match exactly one schema in oneOf",params:({params:$})=>F5._`{passingSchemas: ${$.passing}}`},LS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:VS,code($){let{gen:Z,schema:Y,parentSchema:Q,it:W}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");if(W.opts.discriminator&&Q.discriminator)return;let J=Y,G=Z.let("valid",!1),K=Z.let("passing",null),B=Z.name("_valid");$.setParams({passing:K}),Z.block(D),$.result(G,()=>$.reset(),()=>$.error(!0));function D(){J.forEach((V,L)=>{let A;if((0,DS.alwaysValidSchema)(W,V))Z.var(B,!0);else A=$.subschema({keyword:"oneOf",schemaProp:L,compositeRule:!0},B);if(L>0)Z.if(F5._`${B} && ${G}`).assign(G,!1).assign(K,F5._`[${K}, ${L}]`).else();Z.if(B,()=>{if(Z.assign(G,!0),Z.assign(K,L),A)$.mergeEvaluated(A,F5.Name)})})}}};MD.default=LS});var ED=k((wD)=>{Object.defineProperty(wD,"__esModule",{value:!0});var jS=G1(),AS={keyword:"allOf",schemaType:"array",code($){let{gen:Z,schema:Y,it:Q}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");let W=Z.name("valid");Y.forEach((J,G)=>{if((0,jS.alwaysValidSchema)(Q,J))return;let K=$.subschema({keyword:"allOf",schemaProp:G},W);$.ok(W),$.mergeEvaluated(K)})}};wD.default=AS});var ID=k((CD)=>{Object.defineProperty(CD,"__esModule",{value:!0});var D5=Z1(),_D=G1(),OS={message:({params:$})=>D5.str`must match "${$.ifClause}" schema`,params:({params:$})=>D5._`{failingKeyword: ${$.ifClause}}`},qS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:OS,code($){let{gen:Z,parentSchema:Y,it:Q}=$;if(Y.then===void 0&&Y.else===void 0)(0,_D.checkStrictMode)(Q,'"if" without "then" and "else" is ignored');let W=RD(Q,"then"),J=RD(Q,"else");if(!W&&!J)return;let G=Z.let("valid",!0),K=Z.name("_valid");if(B(),$.reset(),W&&J){let V=Z.let("ifClause");$.setParams({ifClause:V}),Z.if(K,D("then",V),D("else",V))}else if(W)Z.if(K,D("then"));else Z.if((0,D5.not)(K),D("else"));$.pass(G,()=>$.error(!0));function B(){let V=$.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},K);$.mergeEvaluated(V)}function D(V,L){return()=>{let A=$.subschema({keyword:V},K);if(Z.assign(G,K),$.mergeValidEvaluated(A,G),L)Z.assign(L,D5._`${V}`);else $.setParams({ifClause:V})}}}};function RD($,Z){let Y=$.schema[Z];return Y!==void 0&&!(0,_D.alwaysValidSchema)($,Y)}CD.default=qS});var SD=k((fD)=>{Object.defineProperty(fD,"__esModule",{value:!0});var MS=G1(),PS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:$,parentSchema:Z,it:Y}){if(Z.if===void 0)(0,MS.checkStrictMode)(Y,`"${$}" without "if" is ignored`)}};fD.default=PS});var vD=k((bD)=>{Object.defineProperty(bD,"__esModule",{value:!0});var ES=TX(),RS=nF(),_S=kX(),CS=oF(),IS=tF(),fS=XD(),SS=GD(),bS=gX(),vS=DD(),yS=AD(),TS=OD(),kS=ND(),xS=PD(),gS=ED(),uS=ID(),hS=SD();function mS($=!1){let Z=[TS.default,kS.default,xS.default,gS.default,uS.default,hS.default,SS.default,bS.default,fS.default,vS.default,yS.default];if($)Z.push(RS.default,CS.default);else Z.push(ES.default,_S.default);return Z.push(IS.default),Z}bD.default=mS});var TD=k((yD)=>{Object.defineProperty(yD,"__esModule",{value:!0});var w1=Z1(),pS={message:({schemaCode:$})=>w1.str`must match format "${$}"`,params:({schemaCode:$})=>w1._`{format: ${$}}`},iS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pS,code($,Z){let{gen:Y,data:Q,$data:W,schema:J,schemaCode:G,it:K}=$,{opts:B,errSchemaPath:D,schemaEnv:V,self:L}=K;if(!B.validateFormats)return;if(W)A();else O();function A(){let q=Y.scopeValue("formats",{ref:L.formats,code:B.code.formats}),M=Y.const("fDef",w1._`${q}[${G}]`),I=Y.let("fType"),N=Y.let("format");Y.if(w1._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>Y.assign(I,w1._`${M}.type || "string"`).assign(N,w1._`${M}.validate`),()=>Y.assign(I,w1._`"string"`).assign(N,M)),$.fail$data((0,w1.or)(E(),f()));function E(){if(B.strictSchema===!1)return w1.nil;return w1._`${G} && !${N}`}function f(){let v=V.$async?w1._`(${M}.async ? await ${N}(${Q}) : ${N}(${Q}))`:w1._`${N}(${Q})`,y=w1._`(typeof ${N} == "function" ? ${v} : ${N}.test(${Q}))`;return w1._`${N} && ${N} !== true && ${I} === ${Z} && !${y}`}}function O(){let q=L.formats[J];if(!q){E();return}if(q===!0)return;let[M,I,N]=f(q);if(M===Z)$.pass(v());function E(){if(B.strictSchema===!1){L.logger.warn(y());return}throw Error(y());function y(){return`unknown format "${J}" ignored in schema at path "${D}"`}}function f(y){let $1=y instanceof RegExp?(0,w1.regexpCode)(y):B.code.formats?w1._`${B.code.formats}${(0,w1.getProperty)(J)}`:void 0,j1=Y.scopeValue("formats",{key:J,ref:y,code:$1});if(typeof y=="object"&&!(y instanceof RegExp))return[y.type||"string",y.validate,w1._`${j1}.validate`];return["string",y,j1]}function v(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!V.$async)throw Error("async format in sync schema");return w1._`await ${N}(${Q})`}return typeof I=="function"?w1._`${N}(${Q})`:w1._`${N}.test(${Q})`}}}};yD.default=iS});var xD=k((kD)=>{Object.defineProperty(kD,"__esModule",{value:!0});var dS=TD(),nS=[dS.default];kD.default=nS});var hD=k((gD)=>{Object.defineProperty(gD,"__esModule",{value:!0});gD.contentVocabulary=gD.metadataVocabulary=void 0;gD.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gD.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var pD=k((lD)=>{Object.defineProperty(lD,"__esModule",{value:!0});var oS=FF(),sS=gF(),tS=vD(),eS=xD(),mD=hD(),$b=[oS.default,sS.default,(0,tS.default)(),eS.default,mD.metadataVocabulary,mD.contentVocabulary];lD.default=$b});var nD=k((cD)=>{Object.defineProperty(cD,"__esModule",{value:!0});cD.DiscrError=void 0;var iD;(function($){$.Tag="tag",$.Mapping="mapping"})(iD||(cD.DiscrError=iD={}))});var oD=k((aD)=>{Object.defineProperty(aD,"__esModule",{value:!0});var d8=Z1(),hX=nD(),rD=r4(),Yb=Q7(),Qb=G1(),Xb={message:({params:{discrError:$,tagName:Z}})=>$===hX.DiscrError.Tag?`tag "${Z}" must be string`:`value of tag "${Z}" must be in oneOf`,params:({params:{discrError:$,tag:Z,tagName:Y}})=>d8._`{error: ${$}, tag: ${Y}, tagValue: ${Z}}`},Wb={keyword:"discriminator",type:"object",schemaType:"object",error:Xb,code($){let{gen:Z,data:Y,schema:Q,parentSchema:W,it:J}=$,{oneOf:G}=W;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let K=Q.propertyName;if(typeof K!="string")throw Error("discriminator: requires propertyName");if(Q.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let B=Z.let("valid",!1),D=Z.const("tag",d8._`${Y}${(0,d8.getProperty)(K)}`);Z.if(d8._`typeof ${D} == "string"`,()=>V(),()=>$.error(!1,{discrError:hX.DiscrError.Tag,tag:D,tagName:K})),$.ok(B);function V(){let O=A();Z.if(!1);for(let q in O)Z.elseIf(d8._`${D} === ${q}`),Z.assign(B,L(O[q]));Z.else(),$.error(!1,{discrError:hX.DiscrError.Mapping,tag:D,tagName:K}),Z.endIf()}function L(O){let q=Z.name("valid"),M=$.subschema({keyword:"oneOf",schemaProp:O},q);return $.mergeEvaluated(M,d8.Name),q}function A(){var O;let q={},M=N(W),I=!0;for(let v=0;v<G.length;v++){let y=G[v];if((y===null||y===void 0?void 0:y.$ref)&&!(0,Qb.schemaHasRulesButRef)(y,J.self.RULES)){let j1=y.$ref;if(y=rD.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,j1),y instanceof rD.SchemaEnv)y=y.schema;if(y===void 0)throw new Yb.default(J.opts.uriResolver,J.baseId,j1)}let $1=(O=y===null||y===void 0?void 0:y.properties)===null||O===void 0?void 0:O[K];if(typeof $1!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${K}"`);I=I&&(M||N(y)),E($1,v)}if(!I)throw Error(`discriminator: "${K}" must be required`);return q;function N({required:v}){return Array.isArray(v)&&v.includes(K)}function E(v,y){if(v.const)f(v.const,y);else if(v.enum)for(let $1 of v.enum)f($1,y);else throw Error(`discriminator: "properties/${K}" must have "const" or "enum"`)}function f(v,y){if(typeof v!="string"||v in q)throw Error(`discriminator: "${K}" values must be unique strings`);q[v]=y}}}};aD.default=Wb});var sD=k((pa,Gb)=>{Gb.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var lX=k((t1,mX)=>{Object.defineProperty(t1,"__esModule",{value:!0});t1.MissingRefError=t1.ValidationError=t1.CodeGen=t1.Name=t1.nil=t1.stringify=t1.str=t1._=t1.KeywordCxt=t1.Ajv=void 0;var Kb=ZF(),Hb=pD(),Bb=oD(),tD=sD(),Fb=["/properties"],V5="http://json-schema.org/draft-07/schema";class U7 extends Kb.default{_addVocabularies(){if(super._addVocabularies(),Hb.default.forEach(($)=>this.addVocabulary($)),this.opts.discriminator)this.addKeyword(Bb.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let $=this.opts.$data?this.$dataMetaSchema(tD,Fb):tD;this.addMetaSchema($,V5,!1),this.refs["http://json-schema.org/schema"]=V5}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(V5)?V5:void 0)}}t1.Ajv=U7;mX.exports=t1=U7;mX.exports.Ajv=U7;Object.defineProperty(t1,"__esModule",{value:!0});t1.default=U7;var Db=Y7();Object.defineProperty(t1,"KeywordCxt",{enumerable:!0,get:function(){return Db.KeywordCxt}});var n8=Z1();Object.defineProperty(t1,"_",{enumerable:!0,get:function(){return n8._}});Object.defineProperty(t1,"str",{enumerable:!0,get:function(){return n8.str}});Object.defineProperty(t1,"stringify",{enumerable:!0,get:function(){return n8.stringify}});Object.defineProperty(t1,"nil",{enumerable:!0,get:function(){return n8.nil}});Object.defineProperty(t1,"Name",{enumerable:!0,get:function(){return n8.Name}});Object.defineProperty(t1,"CodeGen",{enumerable:!0,get:function(){return n8.CodeGen}});var Vb=d4();Object.defineProperty(t1,"ValidationError",{enumerable:!0,get:function(){return Vb.default}});var Lb=Q7();Object.defineProperty(t1,"MissingRefError",{enumerable:!0,get:function(){return Lb.default}})});var KV=k((JV)=>{Object.defineProperty(JV,"__esModule",{value:!0});JV.formatNames=JV.fastFormats=JV.fullFormats=void 0;function l0($,Z){return{validate:$,compare:Z}}JV.fullFormats={date:l0(YV,dX),time:l0(iX(!0),nX),"date-time":l0(eD(!0),XV),"iso-time":l0(iX(),QV),"iso-date-time":l0(eD(),WV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Mb,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Ib,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Pb,int32:{type:"number",validate:Rb},int64:{type:"number",validate:_b},float:{type:"number",validate:ZV},double:{type:"number",validate:ZV},password:!0,binary:!0};JV.fastFormats={...JV.fullFormats,date:l0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,dX),time:l0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,nX),"date-time":l0(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,XV),"iso-time":l0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QV),"iso-date-time":l0(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,WV),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};JV.formatNames=Object.keys(JV.fullFormats);function Ab($){return $%4===0&&($%100!==0||$%400===0)}var zb=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ob=[0,31,28,31,30,31,30,31,31,30,31,30,31];function YV($){let Z=zb.exec($);if(!Z)return!1;let Y=+Z[1],Q=+Z[2],W=+Z[3];return Q>=1&&Q<=12&&W>=1&&W<=(Q===2&&Ab(Y)?29:Ob[Q])}function dX($,Z){if(!($&&Z))return;if($>Z)return 1;if($<Z)return-1;return 0}var pX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function iX($){return function(Y){let Q=pX.exec(Y);if(!Q)return!1;let W=+Q[1],J=+Q[2],G=+Q[3],K=Q[4],B=Q[5]==="-"?-1:1,D=+(Q[6]||0),V=+(Q[7]||0);if(D>23||V>59||$&&!K)return!1;if(W<=23&&J<=59&&G<60)return!0;let L=J-V*B,A=W-D*B-(L<0?1:0);return(A===23||A===-1)&&(L===59||L===-1)&&G<61}}function nX($,Z){if(!($&&Z))return;let Y=new Date("2020-01-01T"+$).valueOf(),Q=new Date("2020-01-01T"+Z).valueOf();if(!(Y&&Q))return;return Y-Q}function QV($,Z){if(!($&&Z))return;let Y=pX.exec($),Q=pX.exec(Z);if(!(Y&&Q))return;if($=Y[1]+Y[2]+Y[3],Z=Q[1]+Q[2]+Q[3],$>Z)return 1;if($<Z)return-1;return 0}var cX=/t|\s/i;function eD($){let Z=iX($);return function(Q){let W=Q.split(cX);return W.length===2&&YV(W[0])&&Z(W[1])}}function XV($,Z){if(!($&&Z))return;let Y=new Date($).valueOf(),Q=new Date(Z).valueOf();if(!(Y&&Q))return;return Y-Q}function WV($,Z){if(!($&&Z))return;let[Y,Q]=$.split(cX),[W,J]=Z.split(cX),G=dX(Y,W);if(G===void 0)return;return G||nX(Q,J)}var qb=/\/|:/,Nb=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Mb($){return qb.test($)&&Nb.test($)}var $V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Pb($){return $V.lastIndex=0,$V.test($)}var wb=-2147483648,Eb=2147483647;function Rb($){return Number.isInteger($)&&$<=Eb&&$>=wb}function _b($){return Number.isInteger($)}function ZV(){return!0}var Cb=/[^\\]\\Z/;function Ib($){if(Cb.test($))return!1;try{return new RegExp($),!0}catch(Z){return!1}}});var BV=k((HV)=>{Object.defineProperty(HV,"__esModule",{value:!0});HV.formatLimitDefinition=void 0;var Sb=lX(),b0=Z1(),y6=b0.operators,L5={formatMaximum:{okStr:"<=",ok:y6.LTE,fail:y6.GT},formatMinimum:{okStr:">=",ok:y6.GTE,fail:y6.LT},formatExclusiveMaximum:{okStr:"<",ok:y6.LT,fail:y6.GTE},formatExclusiveMinimum:{okStr:">",ok:y6.GT,fail:y6.LTE}},bb={message:({keyword:$,schemaCode:Z})=>b0.str`should be ${L5[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>b0._`{comparison: ${L5[$].okStr}, limit: ${Z}}`};HV.formatLimitDefinition={keyword:Object.keys(L5),type:"string",schemaType:"string",$data:!0,error:bb,code($){let{gen:Z,data:Y,schemaCode:Q,keyword:W,it:J}=$,{opts:G,self:K}=J;if(!G.validateFormats)return;let B=new Sb.KeywordCxt(J,K.RULES.all.format.definition,"format");if(B.$data)D();else V();function D(){let A=Z.scopeValue("formats",{ref:K.formats,code:G.code.formats}),O=Z.const("fmt",b0._`${A}[${B.schemaCode}]`);$.fail$data((0,b0.or)(b0._`typeof ${O} != "object"`,b0._`${O} instanceof RegExp`,b0._`typeof ${O}.compare != "function"`,L(O)))}function V(){let A=B.schema,O=K.formats[A];if(!O||O===!0)return;if(typeof O!="object"||O instanceof RegExp||typeof O.compare!="function")throw Error(`"${W}": format "${A}" does not define "compare" function`);let q=Z.scopeValue("formats",{key:A,ref:O,code:G.code.formats?b0._`${G.code.formats}${(0,b0.getProperty)(A)}`:void 0});$.fail$data(L(q))}function L(A){return b0._`${A}.compare(${Y}, ${Q}) ${L5[W].fail} 0`}},dependencies:["format"]};var vb=($)=>{return $.addKeyword(HV.formatLimitDefinition),$};HV.default=vb});var LV=k((j7,VV)=>{Object.defineProperty(j7,"__esModule",{value:!0});var r8=KV(),Tb=BV(),oX=Z1(),FV=new oX.Name("fullFormats"),kb=new oX.Name("fastFormats"),sX=($,Z={keywords:!0})=>{if(Array.isArray(Z))return DV($,Z,r8.fullFormats,FV),$;let[Y,Q]=Z.mode==="fast"?[r8.fastFormats,kb]:[r8.fullFormats,FV],W=Z.formats||r8.formatNames;if(DV($,W,Y,Q),Z.keywords)(0,Tb.default)($);return $};sX.get=($,Z="full")=>{let Q=(Z==="fast"?r8.fastFormats:r8.fullFormats)[$];if(!Q)throw Error(`Unknown format "${$}"`);return Q};function DV($,Z,Y,Q){var W,J;(W=(J=$.opts.code).formats)!==null&&W!==void 0||(J.formats=oX._`require("ajv-formats/dist/formats").${Q}`);for(let G of Z)$.addFormat(G,Y[G])}VV.exports=j7=sX;Object.defineProperty(j7,"__esModule",{value:!0});j7.default=sX});var Z3=k((r0)=>{var Rk=r0&&r0.__extends||function(){var $=function(Z,Y){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,W){Q.__proto__=W}||function(Q,W){for(var J in W)if(W.hasOwnProperty(J))Q[J]=W[J]},$(Z,Y)};return function(Z,Y){$(Z,Y);function Q(){this.constructor=Z}Z.prototype=Y===null?Object.create(Y):(Q.prototype=Y.prototype,new Q)}}();Object.defineProperty(r0,"__esModule",{value:!0});r0.DetailContext=r0.NoopContext=r0.VError=void 0;var qU=function($){Rk(Z,$);function Z(Y,Q){var W=$.call(this,Q)||this;return W.path=Y,Object.setPrototypeOf(W,Z.prototype),W}return Z}(Error);r0.VError=qU;var _k=function(){function $(){}return $.prototype.fail=function(Z,Y,Q){return!1},$.prototype.unionResolver=function(){return this},$.prototype.createContext=function(){return this},$.prototype.resolveUnion=function(Z){},$}();r0.NoopContext=_k;var NU=function(){function $(){this._propNames=[""],this._messages=[null],this._score=0}return $.prototype.fail=function(Z,Y,Q){return this._propNames.push(Z),this._messages.push(Y),this._score+=Q,!1},$.prototype.unionResolver=function(){return new Ck},$.prototype.resolveUnion=function(Z){var Y,Q,W=Z,J=null;for(var G=0,K=W.contexts;G<K.length;G++){var B=K[G];if(!J||B._score>=J._score)J=B}if(J&&J._score>0)(Y=this._propNames).push.apply(Y,J._propNames),(Q=this._messages).push.apply(Q,J._messages)},$.prototype.getError=function(Z){var Y=[];for(var Q=this._propNames.length-1;Q>=0;Q--){var W=this._propNames[Q];Z+=typeof W==="number"?"["+W+"]":W?"."+W:"";var J=this._messages[Q];if(J)Y.push(Z+" "+J)}return new qU(Z,Y.join("; "))},$.prototype.getErrorDetail=function(Z){var Y=[];for(var Q=this._propNames.length-1;Q>=0;Q--){var W=this._propNames[Q];Z+=typeof W==="number"?"["+W+"]":W?"."+W:"";var J=this._messages[Q];if(J)Y.push({path:Z,message:J})}var G=null;for(var Q=Y.length-1;Q>=0;Q--){if(G)Y[Q].nested=[G];G=Y[Q]}return G},$}();r0.DetailContext=NU;var Ck=function(){function $(){this.contexts=[]}return $.prototype.createContext=function(){var Z=new NU;return this.contexts.push(Z),Z},$}()});var MJ=k((u)=>{var H0=u&&u.__extends||function(){var $=function(Z,Y){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,W){Q.__proto__=W}||function(Q,W){for(var J in W)if(W.hasOwnProperty(J))Q[J]=W[J]},$(Z,Y)};return function(Z,Y){$(Z,Y);function Q(){this.constructor=Z}Z.prototype=Y===null?Object.create(Y):(Q.prototype=Y.prototype,new Q)}}();Object.defineProperty(u,"__esModule",{value:!0});u.basicTypes=u.BasicType=u.TParamList=u.TParam=u.param=u.TFunc=u.func=u.TProp=u.TOptional=u.opt=u.TIface=u.iface=u.TEnumLiteral=u.enumlit=u.TEnumType=u.enumtype=u.TIntersection=u.intersection=u.TUnion=u.union=u.TTuple=u.tuple=u.TArray=u.array=u.TLiteral=u.lit=u.TName=u.name=u.TType=void 0;var PU=Z3(),Y0=function(){function $(){}return $}();u.TType=Y0;function g6($){return typeof $==="string"?wU($):$}function AJ($,Z){var Y=$[Z];if(!Y)throw Error("Unknown type "+Z);return Y}function wU($){return new zJ($)}u.name=wU;var zJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.name=Y,Q._failMsg="is not a "+Y,Q}return Z.prototype.getChecker=function(Y,Q,W){var J=this,G=AJ(Y,this.name),K=G.getChecker(Y,Q,W);if(G instanceof p1||G instanceof Z)return K;return function(B,D){return K(B,D)?!0:D.fail(null,J._failMsg,0)}},Z}(Y0);u.TName=zJ;function Ik($){return new OJ($)}u.lit=Ik;var OJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.value=Y,Q.name=JSON.stringify(Y),Q._failMsg="is not "+Q.name,Q}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return J===W.value?!0:G.fail(null,W._failMsg,-1)}},Z}(Y0);u.TLiteral=OJ;function fk($){return new EU(g6($))}u.array=fk;var EU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttype=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttype.getChecker(Y,Q);return function(J,G){if(!Array.isArray(J))return G.fail(null,"is not an array",0);for(var K=0;K<J.length;K++){var B=W(J[K],G);if(!B)return G.fail(K,null,1)}return!0}},Z}(Y0);u.TArray=EU;function Sk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new RU($.map(function(Y){return g6(Y)}))}u.tuple=Sk;var RU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttypes=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttypes.map(function(G){return G.getChecker(Y,Q)}),J=function(G,K){if(!Array.isArray(G))return K.fail(null,"is not an array",0);for(var B=0;B<W.length;B++){var D=W[B](G[B],K);if(!D)return K.fail(B,null,1)}return!0};if(!Q)return J;return function(G,K){if(!J(G,K))return!1;return G.length<=W.length?!0:K.fail(W.length,"is extraneous",2)}},Z}(Y0);u.TTuple=RU;function bk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new _U($.map(function(Y){return g6(Y)}))}u.union=bk;var _U=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;Q.ttypes=Y;var W=Y.map(function(G){return G instanceof zJ||G instanceof OJ?G.name:null}).filter(function(G){return G}),J=Y.length-W.length;if(W.length){if(J>0)W.push(J+" more");Q._failMsg="is none of "+W.join(", ")}else Q._failMsg="is none of "+J+" types";return Q}return Z.prototype.getChecker=function(Y,Q){var W=this,J=this.ttypes.map(function(G){return G.getChecker(Y,Q)});return function(G,K){var B=K.unionResolver();for(var D=0;D<J.length;D++){var V=J[D](G,B.createContext());if(V)return!0}return K.resolveUnion(B),K.fail(null,W._failMsg,0)}},Z}(Y0);u.TUnion=_U;function vk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new CU($.map(function(Y){return g6(Y)}))}u.intersection=vk;var CU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttypes=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=new Set,J=this.ttypes.map(function(G){return G.getChecker(Y,Q,W)});return function(G,K){var B=J.every(function(D){return D(G,K)});if(B)return!0;return K.fail(null,null,0)}},Z}(Y0);u.TIntersection=CU;function yk($){return new qJ($)}u.enumtype=yk;var qJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.members=Y,Q.validValues=new Set,Q._failMsg="is not a valid enum value",Q.validValues=new Set(Object.keys(Y).map(function(W){return Y[W]})),Q}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return W.validValues.has(J)?!0:G.fail(null,W._failMsg,0)}},Z}(Y0);u.TEnumType=qJ;function Tk($,Z){return new IU($,Z)}u.enumlit=Tk;var IU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.enumName=Y,W.prop=Q,W._failMsg="is not "+Y+"."+Q,W}return Z.prototype.getChecker=function(Y,Q){var W=this,J=AJ(Y,this.enumName);if(!(J instanceof qJ))throw Error("Type "+this.enumName+" used in enumlit is not an enum type");var G=J.members[this.prop];if(!J.members.hasOwnProperty(this.prop))throw Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(K,B){return K===G?!0:B.fail(null,W._failMsg,-1)}},Z}(Y0);u.TEnumLiteral=IU;function kk($){return Object.keys($).map(function(Z){return xk(Z,$[Z])})}function xk($,Z){return Z instanceof NJ?new UJ($,Z.ttype,!0):new UJ($,g6(Z),!1)}function gk($,Z){return new fU($,kk(Z))}u.iface=gk;var fU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.bases=Y,W.props=Q,W.propSet=new Set(Q.map(function(J){return J.name})),W}return Z.prototype.getChecker=function(Y,Q,W){var J=this,G=this.bases.map(function(A){return AJ(Y,A).getChecker(Y,Q)}),K=this.props.map(function(A){return A.ttype.getChecker(Y,Q)}),B=new PU.NoopContext,D=this.props.map(function(A,O){return!A.isOpt&&!K[O](void 0,B)}),V=function(A,O){if(typeof A!=="object"||A===null)return O.fail(null,"is not an object",0);for(var q=0;q<G.length;q++)if(!G[q](A,O))return!1;for(var q=0;q<K.length;q++){var M=J.props[q].name,I=A[M];if(I===void 0){if(D[q])return O.fail(M,"is missing",1)}else{var N=K[q](I,O);if(!N)return O.fail(M,null,1)}}return!0};if(!Q)return V;var L=this.propSet;if(W)this.propSet.forEach(function(A){return W.add(A)}),L=W;return function(A,O){if(!V(A,O))return!1;for(var q in A)if(!L.has(q))return O.fail(q,"is extraneous",2);return!0}},Z}(Y0);u.TIface=fU;function uk($){return new NJ(g6($))}u.opt=uk;var NJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttype=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttype.getChecker(Y,Q);return function(J,G){return J===void 0||W(J,G)}},Z}(Y0);u.TOptional=NJ;var UJ=function(){function $(Z,Y,Q){this.name=Z,this.ttype=Y,this.isOpt=Q}return $}();u.TProp=UJ;function hk($){var Z=[];for(var Y=1;Y<arguments.length;Y++)Z[Y-1]=arguments[Y];return new SU(new vU(Z),g6($))}u.func=hk;var SU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.paramList=Y,W.result=Q,W}return Z.prototype.getChecker=function(Y,Q){return function(W,J){return typeof W==="function"?!0:J.fail(null,"is not a function",0)}},Z}(Y0);u.TFunc=SU;function mk($,Z,Y){return new bU($,g6(Z),Boolean(Y))}u.param=mk;var bU=function(){function $(Z,Y,Q){this.name=Z,this.ttype=Y,this.isOpt=Q}return $}();u.TParam=bU;var vU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.params=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this,J=this.params.map(function(D){return D.ttype.getChecker(Y,Q)}),G=new PU.NoopContext,K=this.params.map(function(D,V){return!D.isOpt&&!J[V](void 0,G)}),B=function(D,V){if(!Array.isArray(D))return V.fail(null,"is not an array",0);for(var L=0;L<J.length;L++){var A=W.params[L];if(D[L]===void 0){if(K[L])return V.fail(A.name,"is missing",1)}else{var O=J[L](D[L],V);if(!O)return V.fail(A.name,null,1)}}return!0};if(!Q)return B;return function(D,V){if(!B(D,V))return!1;return D.length<=J.length?!0:V.fail(J.length,"is extraneous",2)}},Z}(Y0);u.TParamList=vU;var p1=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.validator=Y,W.message=Q,W}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return W.validator(J)?!0:G.fail(null,W.message,0)}},Z}(Y0);u.BasicType=p1;u.basicTypes={any:new p1(function($){return!0},"is invalid"),number:new p1(function($){return typeof $==="number"},"is not a number"),object:new p1(function($){return typeof $==="object"&&$},"is not an object"),boolean:new p1(function($){return typeof $==="boolean"},"is not a boolean"),string:new p1(function($){return typeof $==="string"},"is not a string"),symbol:new p1(function($){return typeof $==="symbol"},"is not a symbol"),void:new p1(function($){return $==null},"is not void"),undefined:new p1(function($){return $===void 0},"is not undefined"),null:new p1(function($){return $===null},"is not null"),never:new p1(function($){return!1},"is unexpected"),Date:new p1(MU("[object Date]"),"is not a Date"),RegExp:new p1(MU("[object RegExp]"),"is not a RegExp")};var lk=Object.prototype.toString;function MU($){return function(Z){return typeof Z==="object"&&Z&&lk.call(Z)===$}}if(typeof Buffer<"u")u.basicTypes.Buffer=new p1(function($){return Buffer.isBuffer($)},"is not a Buffer");var pk=function($){u.basicTypes[$.name]=new p1(function(Z){return Z instanceof $},"is not a "+$.name)};for(S7=0,Y3=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];S7<Y3.length;S7++)jJ=Y3[S7],pk(jJ);var jJ,S7,Y3});var PJ=k((W1)=>{var ik=W1&&W1.__spreadArrays||function(){for(var $=0,Z=0,Y=arguments.length;Z<Y;Z++)$+=arguments[Z].length;for(var Q=Array($),W=0,Z=0;Z<Y;Z++)for(var J=arguments[Z],G=0,K=J.length;G<K;G++,W++)Q[W]=J[G];return Q};Object.defineProperty(W1,"__esModule",{value:!0});W1.Checker=W1.createCheckers=void 0;var b7=MJ(),V9=Z3(),V1=MJ();Object.defineProperty(W1,"TArray",{enumerable:!0,get:function(){return V1.TArray}});Object.defineProperty(W1,"TEnumType",{enumerable:!0,get:function(){return V1.TEnumType}});Object.defineProperty(W1,"TEnumLiteral",{enumerable:!0,get:function(){return V1.TEnumLiteral}});Object.defineProperty(W1,"TFunc",{enumerable:!0,get:function(){return V1.TFunc}});Object.defineProperty(W1,"TIface",{enumerable:!0,get:function(){return V1.TIface}});Object.defineProperty(W1,"TLiteral",{enumerable:!0,get:function(){return V1.TLiteral}});Object.defineProperty(W1,"TName",{enumerable:!0,get:function(){return V1.TName}});Object.defineProperty(W1,"TOptional",{enumerable:!0,get:function(){return V1.TOptional}});Object.defineProperty(W1,"TParam",{enumerable:!0,get:function(){return V1.TParam}});Object.defineProperty(W1,"TParamList",{enumerable:!0,get:function(){return V1.TParamList}});Object.defineProperty(W1,"TProp",{enumerable:!0,get:function(){return V1.TProp}});Object.defineProperty(W1,"TTuple",{enumerable:!0,get:function(){return V1.TTuple}});Object.defineProperty(W1,"TType",{enumerable:!0,get:function(){return V1.TType}});Object.defineProperty(W1,"TUnion",{enumerable:!0,get:function(){return V1.TUnion}});Object.defineProperty(W1,"TIntersection",{enumerable:!0,get:function(){return V1.TIntersection}});Object.defineProperty(W1,"array",{enumerable:!0,get:function(){return V1.array}});Object.defineProperty(W1,"enumlit",{enumerable:!0,get:function(){return V1.enumlit}});Object.defineProperty(W1,"enumtype",{enumerable:!0,get:function(){return V1.enumtype}});Object.defineProperty(W1,"func",{enumerable:!0,get:function(){return V1.func}});Object.defineProperty(W1,"iface",{enumerable:!0,get:function(){return V1.iface}});Object.defineProperty(W1,"lit",{enumerable:!0,get:function(){return V1.lit}});Object.defineProperty(W1,"name",{enumerable:!0,get:function(){return V1.name}});Object.defineProperty(W1,"opt",{enumerable:!0,get:function(){return V1.opt}});Object.defineProperty(W1,"param",{enumerable:!0,get:function(){return V1.param}});Object.defineProperty(W1,"tuple",{enumerable:!0,get:function(){return V1.tuple}});Object.defineProperty(W1,"union",{enumerable:!0,get:function(){return V1.union}});Object.defineProperty(W1,"intersection",{enumerable:!0,get:function(){return V1.intersection}});Object.defineProperty(W1,"BasicType",{enumerable:!0,get:function(){return V1.BasicType}});var ck=Z3();Object.defineProperty(W1,"VError",{enumerable:!0,get:function(){return ck.VError}});function dk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];var Y=Object.assign.apply(Object,ik([{},b7.basicTypes],$)),Q={};for(var W=0,J=$;W<J.length;W++){var G=J[W];for(var K=0,B=Object.keys(G);K<B.length;K++){var D=B[K];Q[D]=new yU(Y,G[D])}}return Q}W1.createCheckers=dk;var yU=function(){function $(Z,Y,Q){if(Q===void 0)Q="value";if(this.suite=Z,this.ttype=Y,this._path=Q,this.props=new Map,Y instanceof b7.TIface)for(var W=0,J=Y.props;W<J.length;W++){var G=J[W];this.props.set(G.name,G.ttype)}this.checkerPlain=this.ttype.getChecker(Z,!1),this.checkerStrict=this.ttype.getChecker(Z,!0)}return $.prototype.setReportedPath=function(Z){this._path=Z},$.prototype.check=function(Z){return this._doCheck(this.checkerPlain,Z)},$.prototype.test=function(Z){return this.checkerPlain(Z,new V9.NoopContext)},$.prototype.validate=function(Z){return this._doValidate(this.checkerPlain,Z)},$.prototype.strictCheck=function(Z){return this._doCheck(this.checkerStrict,Z)},$.prototype.strictTest=function(Z){return this.checkerStrict(Z,new V9.NoopContext)},$.prototype.strictValidate=function(Z){return this._doValidate(this.checkerStrict,Z)},$.prototype.getProp=function(Z){var Y=this.props.get(Z);if(!Y)throw Error("Type has no property "+Z);return new $(this.suite,Y,this._path+"."+Z)},$.prototype.methodArgs=function(Z){var Y=this._getMethod(Z);return new $(this.suite,Y.paramList)},$.prototype.methodResult=function(Z){var Y=this._getMethod(Z);return new $(this.suite,Y.result)},$.prototype.getArgs=function(){if(!(this.ttype instanceof b7.TFunc))throw Error("getArgs() applied to non-function");return new $(this.suite,this.ttype.paramList)},$.prototype.getResult=function(){if(!(this.ttype instanceof b7.TFunc))throw Error("getResult() applied to non-function");return new $(this.suite,this.ttype.result)},$.prototype.getType=function(){return this.ttype},$.prototype._doCheck=function(Z,Y){var Q=new V9.NoopContext;if(!Z(Y,Q)){var W=new V9.DetailContext;throw Z(Y,W),W.getError(this._path)}},$.prototype._doValidate=function(Z,Y){var Q=new V9.NoopContext;if(Z(Y,Q))return null;var W=new V9.DetailContext;return Z(Y,W),W.getErrorDetail(this._path)},$.prototype._getMethod=function(Z){var Y=this.props.get(Z);if(!Y)throw Error("Type has no property "+Z);if(!(Y instanceof b7.TFunc))throw Error("Property "+Z+" is not a method");return Y},$}();W1.Checker=yU});var qA=k((Ru)=>{Ru.__esModule=!0;Ru.LinesAndColumns=void 0;var v3=`
|
|
9
|
+
deps: ${Y}}`};var lf={keyword:"dependencies",type:"object",schemaType:"object",error:ZD.error,code($){let[Z,Y]=pf($);eF($,Z),$D($,Y)}};function pf({schema:$}){let Z={},Y={};for(let Q in $){if(Q==="__proto__")continue;let W=Array.isArray($[Q])?Z:Y;W[Q]=$[Q]}return[Z,Y]}function eF($,Z=$.schema){let{gen:Y,data:Q,it:W}=$;if(Object.keys(Z).length===0)return;let J=Y.let("missing");for(let G in Z){let K=Z[G];if(K.length===0)continue;let B=(0,L7.propertyInData)(Y,Q,G,W.opts.ownProperties);if($.setParams({property:G,depsCount:K.length,deps:K.join(", ")}),W.allErrors)Y.if(B,()=>{for(let D of K)(0,L7.checkReportMissingProp)($,D)});else Y.if(xX._`${B} && (${(0,L7.checkMissingProp)($,K,J)})`),(0,L7.reportMissingProp)($,J),Y.else()}}ZD.validatePropertyDeps=eF;function $D($,Z=$.schema){let{gen:Y,data:Q,keyword:W,it:J}=$,G=Y.name("valid");for(let K in Z){if((0,mf.alwaysValidSchema)(J,Z[K]))continue;Y.if((0,L7.propertyInData)(Y,Q,K,J.opts.ownProperties),()=>{let B=$.subschema({keyword:W,schemaProp:K},G);$.mergeValidEvaluated(B,G)},()=>Y.var(G,!0)),$.ok(G)}}ZD.validateSchemaDeps=$D;ZD.default=lf});var GD=k((JD)=>{Object.defineProperty(JD,"__esModule",{value:!0});var WD=Z1(),nf=G1(),rf={message:"property name must be valid",params:({params:$})=>WD._`{propertyName: ${$.propertyName}}`},af={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rf,code($){let{gen:Z,schema:Y,data:Q,it:W}=$;if((0,nf.alwaysValidSchema)(W,Y))return;let J=Z.name("valid");Z.forIn("key",Q,(G)=>{$.setParams({propertyName:G}),$.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),Z.if((0,WD.not)(J),()=>{if($.error(!0),!W.allErrors)Z.break()})}),$.ok(J)}};JD.default=af});var gX=k((KD)=>{Object.defineProperty(KD,"__esModule",{value:!0});var K5=A0(),S0=Z1(),sf=Q6(),H5=G1(),tf={message:"must NOT have additional properties",params:({params:$})=>S0._`{additionalProperty: ${$.additionalProperty}}`},ef={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tf,code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,errsCount:J,it:G}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:B}=G;if(G.props=!0,B.removeAdditional!=="all"&&(0,H5.alwaysValidSchema)(G,Y))return;let D=(0,K5.allSchemaProperties)(Q.properties),V=(0,K5.allSchemaProperties)(Q.patternProperties);L(),$.ok(S0._`${J} === ${sf.default.errors}`);function L(){Z.forIn("key",W,(I)=>{if(!D.length&&!V.length)q(I);else Z.if(A(I),()=>q(I))})}function A(I){let N;if(D.length>8){let E=(0,H5.schemaRefOrVal)(G,Q.properties,"properties");N=(0,K5.isOwnProperty)(Z,E,I)}else if(D.length)N=(0,S0.or)(...D.map((E)=>S0._`${I} === ${E}`));else N=S0.nil;if(V.length)N=(0,S0.or)(N,...V.map((E)=>S0._`${(0,K5.usePattern)($,E)}.test(${I})`));return(0,S0.not)(N)}function O(I){Z.code(S0._`delete ${W}[${I}]`)}function q(I){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){O(I);return}if(Y===!1){if($.setParams({additionalProperty:I}),$.error(),!K)Z.break();return}if(typeof Y=="object"&&!(0,H5.alwaysValidSchema)(G,Y)){let N=Z.name("valid");if(B.removeAdditional==="failing")M(I,N,!1),Z.if((0,S0.not)(N),()=>{$.reset(),O(I)});else if(M(I,N),!K)Z.if((0,S0.not)(N),()=>Z.break())}}function M(I,N,E){let f={keyword:"additionalProperties",dataProp:I,dataPropType:H5.Type.Str};if(E===!1)Object.assign(f,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(f,N)}}};KD.default=ef});var DD=k((FD)=>{Object.defineProperty(FD,"__esModule",{value:!0});var ZS=Y7(),HD=A0(),uX=G1(),BD=gX(),YS={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:Z,schema:Y,parentSchema:Q,data:W,it:J}=$;if(J.opts.removeAdditional==="all"&&Q.additionalProperties===void 0)BD.default.code(new ZS.KeywordCxt(J,BD.default,"additionalProperties"));let G=(0,HD.allSchemaProperties)(Y);for(let L of G)J.definedProperties.add(L);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=uX.mergeEvaluated.props(Z,(0,uX.toHash)(G),J.props);let K=G.filter((L)=>!(0,uX.alwaysValidSchema)(J,Y[L]));if(K.length===0)return;let B=Z.name("valid");for(let L of K){if(D(L))V(L);else{if(Z.if((0,HD.propertyInData)(Z,W,L,J.opts.ownProperties)),V(L),!J.allErrors)Z.else().var(B,!0);Z.endIf()}$.it.definedProperties.add(L),$.ok(B)}function D(L){return J.opts.useDefaults&&!J.compositeRule&&Y[L].default!==void 0}function V(L){$.subschema({keyword:"properties",schemaProp:L,dataProp:L},B)}}};FD.default=YS});var AD=k((jD)=>{Object.defineProperty(jD,"__esModule",{value:!0});var VD=A0(),B5=Z1(),LD=G1(),UD=G1(),XS={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:Z,schema:Y,data:Q,parentSchema:W,it:J}=$,{opts:G}=J,K=(0,VD.allSchemaProperties)(Y),B=K.filter((M)=>(0,LD.alwaysValidSchema)(J,Y[M]));if(K.length===0||B.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let D=G.strictSchema&&!G.allowMatchingProperties&&W.properties,V=Z.name("valid");if(J.props!==!0&&!(J.props instanceof B5.Name))J.props=(0,UD.evaluatedPropsToName)(Z,J.props);let{props:L}=J;A();function A(){for(let M of K){if(D)O(M);if(J.allErrors)q(M);else Z.var(V,!0),q(M),Z.if(V)}}function O(M){for(let I in D)if(new RegExp(M).test(I))(0,LD.checkStrictMode)(J,`property ${I} matches pattern ${M} (use allowMatchingProperties)`)}function q(M){Z.forIn("key",Q,(I)=>{Z.if(B5._`${(0,VD.usePattern)($,M)}.test(${I})`,()=>{let N=B.includes(M);if(!N)$.subschema({keyword:"patternProperties",schemaProp:M,dataProp:I,dataPropType:UD.Type.Str},V);if(J.opts.unevaluated&&L!==!0)Z.assign(B5._`${L}[${I}]`,!0);else if(!N&&!J.allErrors)Z.if((0,B5.not)(V),()=>Z.break())})})}}};jD.default=XS});var OD=k((zD)=>{Object.defineProperty(zD,"__esModule",{value:!0});var JS=G1(),GS={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code($){let{gen:Z,schema:Y,it:Q}=$;if((0,JS.alwaysValidSchema)(Q,Y)){$.fail();return}let W=Z.name("valid");$.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},W),$.failResult(W,()=>$.reset(),()=>$.error())},error:{message:"must NOT be valid"}};zD.default=GS});var ND=k((qD)=>{Object.defineProperty(qD,"__esModule",{value:!0});var HS=A0(),BS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:HS.validateUnion,error:{message:"must match a schema in anyOf"}};qD.default=BS});var PD=k((MD)=>{Object.defineProperty(MD,"__esModule",{value:!0});var F5=Z1(),DS=G1(),VS={message:"must match exactly one schema in oneOf",params:({params:$})=>F5._`{passingSchemas: ${$.passing}}`},LS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:VS,code($){let{gen:Z,schema:Y,parentSchema:Q,it:W}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");if(W.opts.discriminator&&Q.discriminator)return;let J=Y,G=Z.let("valid",!1),K=Z.let("passing",null),B=Z.name("_valid");$.setParams({passing:K}),Z.block(D),$.result(G,()=>$.reset(),()=>$.error(!0));function D(){J.forEach((V,L)=>{let A;if((0,DS.alwaysValidSchema)(W,V))Z.var(B,!0);else A=$.subschema({keyword:"oneOf",schemaProp:L,compositeRule:!0},B);if(L>0)Z.if(F5._`${B} && ${G}`).assign(G,!1).assign(K,F5._`[${K}, ${L}]`).else();Z.if(B,()=>{if(Z.assign(G,!0),Z.assign(K,L),A)$.mergeEvaluated(A,F5.Name)})})}}};MD.default=LS});var ED=k((wD)=>{Object.defineProperty(wD,"__esModule",{value:!0});var jS=G1(),AS={keyword:"allOf",schemaType:"array",code($){let{gen:Z,schema:Y,it:Q}=$;if(!Array.isArray(Y))throw Error("ajv implementation error");let W=Z.name("valid");Y.forEach((J,G)=>{if((0,jS.alwaysValidSchema)(Q,J))return;let K=$.subschema({keyword:"allOf",schemaProp:G},W);$.ok(W),$.mergeEvaluated(K)})}};wD.default=AS});var ID=k((CD)=>{Object.defineProperty(CD,"__esModule",{value:!0});var D5=Z1(),_D=G1(),OS={message:({params:$})=>D5.str`must match "${$.ifClause}" schema`,params:({params:$})=>D5._`{failingKeyword: ${$.ifClause}}`},qS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:OS,code($){let{gen:Z,parentSchema:Y,it:Q}=$;if(Y.then===void 0&&Y.else===void 0)(0,_D.checkStrictMode)(Q,'"if" without "then" and "else" is ignored');let W=RD(Q,"then"),J=RD(Q,"else");if(!W&&!J)return;let G=Z.let("valid",!0),K=Z.name("_valid");if(B(),$.reset(),W&&J){let V=Z.let("ifClause");$.setParams({ifClause:V}),Z.if(K,D("then",V),D("else",V))}else if(W)Z.if(K,D("then"));else Z.if((0,D5.not)(K),D("else"));$.pass(G,()=>$.error(!0));function B(){let V=$.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},K);$.mergeEvaluated(V)}function D(V,L){return()=>{let A=$.subschema({keyword:V},K);if(Z.assign(G,K),$.mergeValidEvaluated(A,G),L)Z.assign(L,D5._`${V}`);else $.setParams({ifClause:V})}}}};function RD($,Z){let Y=$.schema[Z];return Y!==void 0&&!(0,_D.alwaysValidSchema)($,Y)}CD.default=qS});var SD=k((fD)=>{Object.defineProperty(fD,"__esModule",{value:!0});var MS=G1(),PS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:$,parentSchema:Z,it:Y}){if(Z.if===void 0)(0,MS.checkStrictMode)(Y,`"${$}" without "if" is ignored`)}};fD.default=PS});var vD=k((bD)=>{Object.defineProperty(bD,"__esModule",{value:!0});var ES=TX(),RS=nF(),_S=kX(),CS=oF(),IS=tF(),fS=XD(),SS=GD(),bS=gX(),vS=DD(),yS=AD(),TS=OD(),kS=ND(),xS=PD(),gS=ED(),uS=ID(),hS=SD();function mS($=!1){let Z=[TS.default,kS.default,xS.default,gS.default,uS.default,hS.default,SS.default,bS.default,fS.default,vS.default,yS.default];if($)Z.push(RS.default,CS.default);else Z.push(ES.default,_S.default);return Z.push(IS.default),Z}bD.default=mS});var TD=k((yD)=>{Object.defineProperty(yD,"__esModule",{value:!0});var w1=Z1(),pS={message:({schemaCode:$})=>w1.str`must match format "${$}"`,params:({schemaCode:$})=>w1._`{format: ${$}}`},iS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pS,code($,Z){let{gen:Y,data:Q,$data:W,schema:J,schemaCode:G,it:K}=$,{opts:B,errSchemaPath:D,schemaEnv:V,self:L}=K;if(!B.validateFormats)return;if(W)A();else O();function A(){let q=Y.scopeValue("formats",{ref:L.formats,code:B.code.formats}),M=Y.const("fDef",w1._`${q}[${G}]`),I=Y.let("fType"),N=Y.let("format");Y.if(w1._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>Y.assign(I,w1._`${M}.type || "string"`).assign(N,w1._`${M}.validate`),()=>Y.assign(I,w1._`"string"`).assign(N,M)),$.fail$data((0,w1.or)(E(),f()));function E(){if(B.strictSchema===!1)return w1.nil;return w1._`${G} && !${N}`}function f(){let v=V.$async?w1._`(${M}.async ? await ${N}(${Q}) : ${N}(${Q}))`:w1._`${N}(${Q})`,y=w1._`(typeof ${N} == "function" ? ${v} : ${N}.test(${Q}))`;return w1._`${N} && ${N} !== true && ${I} === ${Z} && !${y}`}}function O(){let q=L.formats[J];if(!q){E();return}if(q===!0)return;let[M,I,N]=f(q);if(M===Z)$.pass(v());function E(){if(B.strictSchema===!1){L.logger.warn(y());return}throw Error(y());function y(){return`unknown format "${J}" ignored in schema at path "${D}"`}}function f(y){let $1=y instanceof RegExp?(0,w1.regexpCode)(y):B.code.formats?w1._`${B.code.formats}${(0,w1.getProperty)(J)}`:void 0,j1=Y.scopeValue("formats",{key:J,ref:y,code:$1});if(typeof y=="object"&&!(y instanceof RegExp))return[y.type||"string",y.validate,w1._`${j1}.validate`];return["string",y,j1]}function v(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!V.$async)throw Error("async format in sync schema");return w1._`await ${N}(${Q})`}return typeof I=="function"?w1._`${N}(${Q})`:w1._`${N}.test(${Q})`}}}};yD.default=iS});var xD=k((kD)=>{Object.defineProperty(kD,"__esModule",{value:!0});var dS=TD(),nS=[dS.default];kD.default=nS});var hD=k((gD)=>{Object.defineProperty(gD,"__esModule",{value:!0});gD.contentVocabulary=gD.metadataVocabulary=void 0;gD.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gD.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var pD=k((lD)=>{Object.defineProperty(lD,"__esModule",{value:!0});var oS=FF(),sS=gF(),tS=vD(),eS=xD(),mD=hD(),$b=[oS.default,sS.default,(0,tS.default)(),eS.default,mD.metadataVocabulary,mD.contentVocabulary];lD.default=$b});var nD=k((cD)=>{Object.defineProperty(cD,"__esModule",{value:!0});cD.DiscrError=void 0;var iD;(function($){$.Tag="tag",$.Mapping="mapping"})(iD||(cD.DiscrError=iD={}))});var oD=k((aD)=>{Object.defineProperty(aD,"__esModule",{value:!0});var d8=Z1(),hX=nD(),rD=r4(),Yb=Q7(),Qb=G1(),Xb={message:({params:{discrError:$,tagName:Z}})=>$===hX.DiscrError.Tag?`tag "${Z}" must be string`:`value of tag "${Z}" must be in oneOf`,params:({params:{discrError:$,tag:Z,tagName:Y}})=>d8._`{error: ${$}, tag: ${Y}, tagValue: ${Z}}`},Wb={keyword:"discriminator",type:"object",schemaType:"object",error:Xb,code($){let{gen:Z,data:Y,schema:Q,parentSchema:W,it:J}=$,{oneOf:G}=W;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let K=Q.propertyName;if(typeof K!="string")throw Error("discriminator: requires propertyName");if(Q.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let B=Z.let("valid",!1),D=Z.const("tag",d8._`${Y}${(0,d8.getProperty)(K)}`);Z.if(d8._`typeof ${D} == "string"`,()=>V(),()=>$.error(!1,{discrError:hX.DiscrError.Tag,tag:D,tagName:K})),$.ok(B);function V(){let O=A();Z.if(!1);for(let q in O)Z.elseIf(d8._`${D} === ${q}`),Z.assign(B,L(O[q]));Z.else(),$.error(!1,{discrError:hX.DiscrError.Mapping,tag:D,tagName:K}),Z.endIf()}function L(O){let q=Z.name("valid"),M=$.subschema({keyword:"oneOf",schemaProp:O},q);return $.mergeEvaluated(M,d8.Name),q}function A(){var O;let q={},M=N(W),I=!0;for(let v=0;v<G.length;v++){let y=G[v];if((y===null||y===void 0?void 0:y.$ref)&&!(0,Qb.schemaHasRulesButRef)(y,J.self.RULES)){let j1=y.$ref;if(y=rD.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,j1),y instanceof rD.SchemaEnv)y=y.schema;if(y===void 0)throw new Yb.default(J.opts.uriResolver,J.baseId,j1)}let $1=(O=y===null||y===void 0?void 0:y.properties)===null||O===void 0?void 0:O[K];if(typeof $1!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${K}"`);I=I&&(M||N(y)),E($1,v)}if(!I)throw Error(`discriminator: "${K}" must be required`);return q;function N({required:v}){return Array.isArray(v)&&v.includes(K)}function E(v,y){if(v.const)f(v.const,y);else if(v.enum)for(let $1 of v.enum)f($1,y);else throw Error(`discriminator: "properties/${K}" must have "const" or "enum"`)}function f(v,y){if(typeof v!="string"||v in q)throw Error(`discriminator: "${K}" values must be unique strings`);q[v]=y}}}};aD.default=Wb});var sD=k((da,Gb)=>{Gb.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var lX=k((t1,mX)=>{Object.defineProperty(t1,"__esModule",{value:!0});t1.MissingRefError=t1.ValidationError=t1.CodeGen=t1.Name=t1.nil=t1.stringify=t1.str=t1._=t1.KeywordCxt=t1.Ajv=void 0;var Kb=ZF(),Hb=pD(),Bb=oD(),tD=sD(),Fb=["/properties"],V5="http://json-schema.org/draft-07/schema";class U7 extends Kb.default{_addVocabularies(){if(super._addVocabularies(),Hb.default.forEach(($)=>this.addVocabulary($)),this.opts.discriminator)this.addKeyword(Bb.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let $=this.opts.$data?this.$dataMetaSchema(tD,Fb):tD;this.addMetaSchema($,V5,!1),this.refs["http://json-schema.org/schema"]=V5}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(V5)?V5:void 0)}}t1.Ajv=U7;mX.exports=t1=U7;mX.exports.Ajv=U7;Object.defineProperty(t1,"__esModule",{value:!0});t1.default=U7;var Db=Y7();Object.defineProperty(t1,"KeywordCxt",{enumerable:!0,get:function(){return Db.KeywordCxt}});var n8=Z1();Object.defineProperty(t1,"_",{enumerable:!0,get:function(){return n8._}});Object.defineProperty(t1,"str",{enumerable:!0,get:function(){return n8.str}});Object.defineProperty(t1,"stringify",{enumerable:!0,get:function(){return n8.stringify}});Object.defineProperty(t1,"nil",{enumerable:!0,get:function(){return n8.nil}});Object.defineProperty(t1,"Name",{enumerable:!0,get:function(){return n8.Name}});Object.defineProperty(t1,"CodeGen",{enumerable:!0,get:function(){return n8.CodeGen}});var Vb=d4();Object.defineProperty(t1,"ValidationError",{enumerable:!0,get:function(){return Vb.default}});var Lb=Q7();Object.defineProperty(t1,"MissingRefError",{enumerable:!0,get:function(){return Lb.default}})});var KV=k((JV)=>{Object.defineProperty(JV,"__esModule",{value:!0});JV.formatNames=JV.fastFormats=JV.fullFormats=void 0;function l0($,Z){return{validate:$,compare:Z}}JV.fullFormats={date:l0(YV,dX),time:l0(iX(!0),nX),"date-time":l0(eD(!0),XV),"iso-time":l0(iX(),QV),"iso-date-time":l0(eD(),WV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Mb,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Ib,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Pb,int32:{type:"number",validate:Rb},int64:{type:"number",validate:_b},float:{type:"number",validate:ZV},double:{type:"number",validate:ZV},password:!0,binary:!0};JV.fastFormats={...JV.fullFormats,date:l0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,dX),time:l0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,nX),"date-time":l0(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,XV),"iso-time":l0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QV),"iso-date-time":l0(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,WV),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};JV.formatNames=Object.keys(JV.fullFormats);function Ab($){return $%4===0&&($%100!==0||$%400===0)}var zb=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ob=[0,31,28,31,30,31,30,31,31,30,31,30,31];function YV($){let Z=zb.exec($);if(!Z)return!1;let Y=+Z[1],Q=+Z[2],W=+Z[3];return Q>=1&&Q<=12&&W>=1&&W<=(Q===2&&Ab(Y)?29:Ob[Q])}function dX($,Z){if(!($&&Z))return;if($>Z)return 1;if($<Z)return-1;return 0}var pX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function iX($){return function(Y){let Q=pX.exec(Y);if(!Q)return!1;let W=+Q[1],J=+Q[2],G=+Q[3],K=Q[4],B=Q[5]==="-"?-1:1,D=+(Q[6]||0),V=+(Q[7]||0);if(D>23||V>59||$&&!K)return!1;if(W<=23&&J<=59&&G<60)return!0;let L=J-V*B,A=W-D*B-(L<0?1:0);return(A===23||A===-1)&&(L===59||L===-1)&&G<61}}function nX($,Z){if(!($&&Z))return;let Y=new Date("2020-01-01T"+$).valueOf(),Q=new Date("2020-01-01T"+Z).valueOf();if(!(Y&&Q))return;return Y-Q}function QV($,Z){if(!($&&Z))return;let Y=pX.exec($),Q=pX.exec(Z);if(!(Y&&Q))return;if($=Y[1]+Y[2]+Y[3],Z=Q[1]+Q[2]+Q[3],$>Z)return 1;if($<Z)return-1;return 0}var cX=/t|\s/i;function eD($){let Z=iX($);return function(Q){let W=Q.split(cX);return W.length===2&&YV(W[0])&&Z(W[1])}}function XV($,Z){if(!($&&Z))return;let Y=new Date($).valueOf(),Q=new Date(Z).valueOf();if(!(Y&&Q))return;return Y-Q}function WV($,Z){if(!($&&Z))return;let[Y,Q]=$.split(cX),[W,J]=Z.split(cX),G=dX(Y,W);if(G===void 0)return;return G||nX(Q,J)}var qb=/\/|:/,Nb=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Mb($){return qb.test($)&&Nb.test($)}var $V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Pb($){return $V.lastIndex=0,$V.test($)}var wb=-2147483648,Eb=2147483647;function Rb($){return Number.isInteger($)&&$<=Eb&&$>=wb}function _b($){return Number.isInteger($)}function ZV(){return!0}var Cb=/[^\\]\\Z/;function Ib($){if(Cb.test($))return!1;try{return new RegExp($),!0}catch(Z){return!1}}});var BV=k((HV)=>{Object.defineProperty(HV,"__esModule",{value:!0});HV.formatLimitDefinition=void 0;var Sb=lX(),b0=Z1(),y6=b0.operators,L5={formatMaximum:{okStr:"<=",ok:y6.LTE,fail:y6.GT},formatMinimum:{okStr:">=",ok:y6.GTE,fail:y6.LT},formatExclusiveMaximum:{okStr:"<",ok:y6.LT,fail:y6.GTE},formatExclusiveMinimum:{okStr:">",ok:y6.GT,fail:y6.LTE}},bb={message:({keyword:$,schemaCode:Z})=>b0.str`should be ${L5[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>b0._`{comparison: ${L5[$].okStr}, limit: ${Z}}`};HV.formatLimitDefinition={keyword:Object.keys(L5),type:"string",schemaType:"string",$data:!0,error:bb,code($){let{gen:Z,data:Y,schemaCode:Q,keyword:W,it:J}=$,{opts:G,self:K}=J;if(!G.validateFormats)return;let B=new Sb.KeywordCxt(J,K.RULES.all.format.definition,"format");if(B.$data)D();else V();function D(){let A=Z.scopeValue("formats",{ref:K.formats,code:G.code.formats}),O=Z.const("fmt",b0._`${A}[${B.schemaCode}]`);$.fail$data((0,b0.or)(b0._`typeof ${O} != "object"`,b0._`${O} instanceof RegExp`,b0._`typeof ${O}.compare != "function"`,L(O)))}function V(){let A=B.schema,O=K.formats[A];if(!O||O===!0)return;if(typeof O!="object"||O instanceof RegExp||typeof O.compare!="function")throw Error(`"${W}": format "${A}" does not define "compare" function`);let q=Z.scopeValue("formats",{key:A,ref:O,code:G.code.formats?b0._`${G.code.formats}${(0,b0.getProperty)(A)}`:void 0});$.fail$data(L(q))}function L(A){return b0._`${A}.compare(${Y}, ${Q}) ${L5[W].fail} 0`}},dependencies:["format"]};var vb=($)=>{return $.addKeyword(HV.formatLimitDefinition),$};HV.default=vb});var LV=k((j7,VV)=>{Object.defineProperty(j7,"__esModule",{value:!0});var r8=KV(),Tb=BV(),oX=Z1(),FV=new oX.Name("fullFormats"),kb=new oX.Name("fastFormats"),sX=($,Z={keywords:!0})=>{if(Array.isArray(Z))return DV($,Z,r8.fullFormats,FV),$;let[Y,Q]=Z.mode==="fast"?[r8.fastFormats,kb]:[r8.fullFormats,FV],W=Z.formats||r8.formatNames;if(DV($,W,Y,Q),Z.keywords)(0,Tb.default)($);return $};sX.get=($,Z="full")=>{let Q=(Z==="fast"?r8.fastFormats:r8.fullFormats)[$];if(!Q)throw Error(`Unknown format "${$}"`);return Q};function DV($,Z,Y,Q){var W,J;(W=(J=$.opts.code).formats)!==null&&W!==void 0||(J.formats=oX._`require("ajv-formats/dist/formats").${Q}`);for(let G of Z)$.addFormat(G,Y[G])}VV.exports=j7=sX;Object.defineProperty(j7,"__esModule",{value:!0});j7.default=sX});var Z3=k((r0)=>{var Rk=r0&&r0.__extends||function(){var $=function(Z,Y){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,W){Q.__proto__=W}||function(Q,W){for(var J in W)if(W.hasOwnProperty(J))Q[J]=W[J]},$(Z,Y)};return function(Z,Y){$(Z,Y);function Q(){this.constructor=Z}Z.prototype=Y===null?Object.create(Y):(Q.prototype=Y.prototype,new Q)}}();Object.defineProperty(r0,"__esModule",{value:!0});r0.DetailContext=r0.NoopContext=r0.VError=void 0;var qU=function($){Rk(Z,$);function Z(Y,Q){var W=$.call(this,Q)||this;return W.path=Y,Object.setPrototypeOf(W,Z.prototype),W}return Z}(Error);r0.VError=qU;var _k=function(){function $(){}return $.prototype.fail=function(Z,Y,Q){return!1},$.prototype.unionResolver=function(){return this},$.prototype.createContext=function(){return this},$.prototype.resolveUnion=function(Z){},$}();r0.NoopContext=_k;var NU=function(){function $(){this._propNames=[""],this._messages=[null],this._score=0}return $.prototype.fail=function(Z,Y,Q){return this._propNames.push(Z),this._messages.push(Y),this._score+=Q,!1},$.prototype.unionResolver=function(){return new Ck},$.prototype.resolveUnion=function(Z){var Y,Q,W=Z,J=null;for(var G=0,K=W.contexts;G<K.length;G++){var B=K[G];if(!J||B._score>=J._score)J=B}if(J&&J._score>0)(Y=this._propNames).push.apply(Y,J._propNames),(Q=this._messages).push.apply(Q,J._messages)},$.prototype.getError=function(Z){var Y=[];for(var Q=this._propNames.length-1;Q>=0;Q--){var W=this._propNames[Q];Z+=typeof W==="number"?"["+W+"]":W?"."+W:"";var J=this._messages[Q];if(J)Y.push(Z+" "+J)}return new qU(Z,Y.join("; "))},$.prototype.getErrorDetail=function(Z){var Y=[];for(var Q=this._propNames.length-1;Q>=0;Q--){var W=this._propNames[Q];Z+=typeof W==="number"?"["+W+"]":W?"."+W:"";var J=this._messages[Q];if(J)Y.push({path:Z,message:J})}var G=null;for(var Q=Y.length-1;Q>=0;Q--){if(G)Y[Q].nested=[G];G=Y[Q]}return G},$}();r0.DetailContext=NU;var Ck=function(){function $(){this.contexts=[]}return $.prototype.createContext=function(){var Z=new NU;return this.contexts.push(Z),Z},$}()});var MJ=k((u)=>{var H0=u&&u.__extends||function(){var $=function(Z,Y){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,W){Q.__proto__=W}||function(Q,W){for(var J in W)if(W.hasOwnProperty(J))Q[J]=W[J]},$(Z,Y)};return function(Z,Y){$(Z,Y);function Q(){this.constructor=Z}Z.prototype=Y===null?Object.create(Y):(Q.prototype=Y.prototype,new Q)}}();Object.defineProperty(u,"__esModule",{value:!0});u.basicTypes=u.BasicType=u.TParamList=u.TParam=u.param=u.TFunc=u.func=u.TProp=u.TOptional=u.opt=u.TIface=u.iface=u.TEnumLiteral=u.enumlit=u.TEnumType=u.enumtype=u.TIntersection=u.intersection=u.TUnion=u.union=u.TTuple=u.tuple=u.TArray=u.array=u.TLiteral=u.lit=u.TName=u.name=u.TType=void 0;var PU=Z3(),Y0=function(){function $(){}return $}();u.TType=Y0;function g6($){return typeof $==="string"?wU($):$}function AJ($,Z){var Y=$[Z];if(!Y)throw Error("Unknown type "+Z);return Y}function wU($){return new zJ($)}u.name=wU;var zJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.name=Y,Q._failMsg="is not a "+Y,Q}return Z.prototype.getChecker=function(Y,Q,W){var J=this,G=AJ(Y,this.name),K=G.getChecker(Y,Q,W);if(G instanceof p1||G instanceof Z)return K;return function(B,D){return K(B,D)?!0:D.fail(null,J._failMsg,0)}},Z}(Y0);u.TName=zJ;function Ik($){return new OJ($)}u.lit=Ik;var OJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.value=Y,Q.name=JSON.stringify(Y),Q._failMsg="is not "+Q.name,Q}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return J===W.value?!0:G.fail(null,W._failMsg,-1)}},Z}(Y0);u.TLiteral=OJ;function fk($){return new EU(g6($))}u.array=fk;var EU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttype=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttype.getChecker(Y,Q);return function(J,G){if(!Array.isArray(J))return G.fail(null,"is not an array",0);for(var K=0;K<J.length;K++){var B=W(J[K],G);if(!B)return G.fail(K,null,1)}return!0}},Z}(Y0);u.TArray=EU;function Sk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new RU($.map(function(Y){return g6(Y)}))}u.tuple=Sk;var RU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttypes=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttypes.map(function(G){return G.getChecker(Y,Q)}),J=function(G,K){if(!Array.isArray(G))return K.fail(null,"is not an array",0);for(var B=0;B<W.length;B++){var D=W[B](G[B],K);if(!D)return K.fail(B,null,1)}return!0};if(!Q)return J;return function(G,K){if(!J(G,K))return!1;return G.length<=W.length?!0:K.fail(W.length,"is extraneous",2)}},Z}(Y0);u.TTuple=RU;function bk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new _U($.map(function(Y){return g6(Y)}))}u.union=bk;var _U=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;Q.ttypes=Y;var W=Y.map(function(G){return G instanceof zJ||G instanceof OJ?G.name:null}).filter(function(G){return G}),J=Y.length-W.length;if(W.length){if(J>0)W.push(J+" more");Q._failMsg="is none of "+W.join(", ")}else Q._failMsg="is none of "+J+" types";return Q}return Z.prototype.getChecker=function(Y,Q){var W=this,J=this.ttypes.map(function(G){return G.getChecker(Y,Q)});return function(G,K){var B=K.unionResolver();for(var D=0;D<J.length;D++){var V=J[D](G,B.createContext());if(V)return!0}return K.resolveUnion(B),K.fail(null,W._failMsg,0)}},Z}(Y0);u.TUnion=_U;function vk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];return new CU($.map(function(Y){return g6(Y)}))}u.intersection=vk;var CU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttypes=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=new Set,J=this.ttypes.map(function(G){return G.getChecker(Y,Q,W)});return function(G,K){var B=J.every(function(D){return D(G,K)});if(B)return!0;return K.fail(null,null,0)}},Z}(Y0);u.TIntersection=CU;function yk($){return new qJ($)}u.enumtype=yk;var qJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.members=Y,Q.validValues=new Set,Q._failMsg="is not a valid enum value",Q.validValues=new Set(Object.keys(Y).map(function(W){return Y[W]})),Q}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return W.validValues.has(J)?!0:G.fail(null,W._failMsg,0)}},Z}(Y0);u.TEnumType=qJ;function Tk($,Z){return new IU($,Z)}u.enumlit=Tk;var IU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.enumName=Y,W.prop=Q,W._failMsg="is not "+Y+"."+Q,W}return Z.prototype.getChecker=function(Y,Q){var W=this,J=AJ(Y,this.enumName);if(!(J instanceof qJ))throw Error("Type "+this.enumName+" used in enumlit is not an enum type");var G=J.members[this.prop];if(!J.members.hasOwnProperty(this.prop))throw Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(K,B){return K===G?!0:B.fail(null,W._failMsg,-1)}},Z}(Y0);u.TEnumLiteral=IU;function kk($){return Object.keys($).map(function(Z){return xk(Z,$[Z])})}function xk($,Z){return Z instanceof NJ?new UJ($,Z.ttype,!0):new UJ($,g6(Z),!1)}function gk($,Z){return new fU($,kk(Z))}u.iface=gk;var fU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.bases=Y,W.props=Q,W.propSet=new Set(Q.map(function(J){return J.name})),W}return Z.prototype.getChecker=function(Y,Q,W){var J=this,G=this.bases.map(function(A){return AJ(Y,A).getChecker(Y,Q)}),K=this.props.map(function(A){return A.ttype.getChecker(Y,Q)}),B=new PU.NoopContext,D=this.props.map(function(A,O){return!A.isOpt&&!K[O](void 0,B)}),V=function(A,O){if(typeof A!=="object"||A===null)return O.fail(null,"is not an object",0);for(var q=0;q<G.length;q++)if(!G[q](A,O))return!1;for(var q=0;q<K.length;q++){var M=J.props[q].name,I=A[M];if(I===void 0){if(D[q])return O.fail(M,"is missing",1)}else{var N=K[q](I,O);if(!N)return O.fail(M,null,1)}}return!0};if(!Q)return V;var L=this.propSet;if(W)this.propSet.forEach(function(A){return W.add(A)}),L=W;return function(A,O){if(!V(A,O))return!1;for(var q in A)if(!L.has(q))return O.fail(q,"is extraneous",2);return!0}},Z}(Y0);u.TIface=fU;function uk($){return new NJ(g6($))}u.opt=uk;var NJ=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.ttype=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this.ttype.getChecker(Y,Q);return function(J,G){return J===void 0||W(J,G)}},Z}(Y0);u.TOptional=NJ;var UJ=function(){function $(Z,Y,Q){this.name=Z,this.ttype=Y,this.isOpt=Q}return $}();u.TProp=UJ;function hk($){var Z=[];for(var Y=1;Y<arguments.length;Y++)Z[Y-1]=arguments[Y];return new SU(new vU(Z),g6($))}u.func=hk;var SU=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.paramList=Y,W.result=Q,W}return Z.prototype.getChecker=function(Y,Q){return function(W,J){return typeof W==="function"?!0:J.fail(null,"is not a function",0)}},Z}(Y0);u.TFunc=SU;function mk($,Z,Y){return new bU($,g6(Z),Boolean(Y))}u.param=mk;var bU=function(){function $(Z,Y,Q){this.name=Z,this.ttype=Y,this.isOpt=Q}return $}();u.TParam=bU;var vU=function($){H0(Z,$);function Z(Y){var Q=$.call(this)||this;return Q.params=Y,Q}return Z.prototype.getChecker=function(Y,Q){var W=this,J=this.params.map(function(D){return D.ttype.getChecker(Y,Q)}),G=new PU.NoopContext,K=this.params.map(function(D,V){return!D.isOpt&&!J[V](void 0,G)}),B=function(D,V){if(!Array.isArray(D))return V.fail(null,"is not an array",0);for(var L=0;L<J.length;L++){var A=W.params[L];if(D[L]===void 0){if(K[L])return V.fail(A.name,"is missing",1)}else{var O=J[L](D[L],V);if(!O)return V.fail(A.name,null,1)}}return!0};if(!Q)return B;return function(D,V){if(!B(D,V))return!1;return D.length<=J.length?!0:V.fail(J.length,"is extraneous",2)}},Z}(Y0);u.TParamList=vU;var p1=function($){H0(Z,$);function Z(Y,Q){var W=$.call(this)||this;return W.validator=Y,W.message=Q,W}return Z.prototype.getChecker=function(Y,Q){var W=this;return function(J,G){return W.validator(J)?!0:G.fail(null,W.message,0)}},Z}(Y0);u.BasicType=p1;u.basicTypes={any:new p1(function($){return!0},"is invalid"),number:new p1(function($){return typeof $==="number"},"is not a number"),object:new p1(function($){return typeof $==="object"&&$},"is not an object"),boolean:new p1(function($){return typeof $==="boolean"},"is not a boolean"),string:new p1(function($){return typeof $==="string"},"is not a string"),symbol:new p1(function($){return typeof $==="symbol"},"is not a symbol"),void:new p1(function($){return $==null},"is not void"),undefined:new p1(function($){return $===void 0},"is not undefined"),null:new p1(function($){return $===null},"is not null"),never:new p1(function($){return!1},"is unexpected"),Date:new p1(MU("[object Date]"),"is not a Date"),RegExp:new p1(MU("[object RegExp]"),"is not a RegExp")};var lk=Object.prototype.toString;function MU($){return function(Z){return typeof Z==="object"&&Z&&lk.call(Z)===$}}if(typeof Buffer<"u")u.basicTypes.Buffer=new p1(function($){return Buffer.isBuffer($)},"is not a Buffer");var pk=function($){u.basicTypes[$.name]=new p1(function(Z){return Z instanceof $},"is not a "+$.name)};for(S7=0,Y3=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];S7<Y3.length;S7++)jJ=Y3[S7],pk(jJ);var jJ,S7,Y3});var PJ=k((W1)=>{var ik=W1&&W1.__spreadArrays||function(){for(var $=0,Z=0,Y=arguments.length;Z<Y;Z++)$+=arguments[Z].length;for(var Q=Array($),W=0,Z=0;Z<Y;Z++)for(var J=arguments[Z],G=0,K=J.length;G<K;G++,W++)Q[W]=J[G];return Q};Object.defineProperty(W1,"__esModule",{value:!0});W1.Checker=W1.createCheckers=void 0;var b7=MJ(),V9=Z3(),V1=MJ();Object.defineProperty(W1,"TArray",{enumerable:!0,get:function(){return V1.TArray}});Object.defineProperty(W1,"TEnumType",{enumerable:!0,get:function(){return V1.TEnumType}});Object.defineProperty(W1,"TEnumLiteral",{enumerable:!0,get:function(){return V1.TEnumLiteral}});Object.defineProperty(W1,"TFunc",{enumerable:!0,get:function(){return V1.TFunc}});Object.defineProperty(W1,"TIface",{enumerable:!0,get:function(){return V1.TIface}});Object.defineProperty(W1,"TLiteral",{enumerable:!0,get:function(){return V1.TLiteral}});Object.defineProperty(W1,"TName",{enumerable:!0,get:function(){return V1.TName}});Object.defineProperty(W1,"TOptional",{enumerable:!0,get:function(){return V1.TOptional}});Object.defineProperty(W1,"TParam",{enumerable:!0,get:function(){return V1.TParam}});Object.defineProperty(W1,"TParamList",{enumerable:!0,get:function(){return V1.TParamList}});Object.defineProperty(W1,"TProp",{enumerable:!0,get:function(){return V1.TProp}});Object.defineProperty(W1,"TTuple",{enumerable:!0,get:function(){return V1.TTuple}});Object.defineProperty(W1,"TType",{enumerable:!0,get:function(){return V1.TType}});Object.defineProperty(W1,"TUnion",{enumerable:!0,get:function(){return V1.TUnion}});Object.defineProperty(W1,"TIntersection",{enumerable:!0,get:function(){return V1.TIntersection}});Object.defineProperty(W1,"array",{enumerable:!0,get:function(){return V1.array}});Object.defineProperty(W1,"enumlit",{enumerable:!0,get:function(){return V1.enumlit}});Object.defineProperty(W1,"enumtype",{enumerable:!0,get:function(){return V1.enumtype}});Object.defineProperty(W1,"func",{enumerable:!0,get:function(){return V1.func}});Object.defineProperty(W1,"iface",{enumerable:!0,get:function(){return V1.iface}});Object.defineProperty(W1,"lit",{enumerable:!0,get:function(){return V1.lit}});Object.defineProperty(W1,"name",{enumerable:!0,get:function(){return V1.name}});Object.defineProperty(W1,"opt",{enumerable:!0,get:function(){return V1.opt}});Object.defineProperty(W1,"param",{enumerable:!0,get:function(){return V1.param}});Object.defineProperty(W1,"tuple",{enumerable:!0,get:function(){return V1.tuple}});Object.defineProperty(W1,"union",{enumerable:!0,get:function(){return V1.union}});Object.defineProperty(W1,"intersection",{enumerable:!0,get:function(){return V1.intersection}});Object.defineProperty(W1,"BasicType",{enumerable:!0,get:function(){return V1.BasicType}});var ck=Z3();Object.defineProperty(W1,"VError",{enumerable:!0,get:function(){return ck.VError}});function dk(){var $=[];for(var Z=0;Z<arguments.length;Z++)$[Z]=arguments[Z];var Y=Object.assign.apply(Object,ik([{},b7.basicTypes],$)),Q={};for(var W=0,J=$;W<J.length;W++){var G=J[W];for(var K=0,B=Object.keys(G);K<B.length;K++){var D=B[K];Q[D]=new yU(Y,G[D])}}return Q}W1.createCheckers=dk;var yU=function(){function $(Z,Y,Q){if(Q===void 0)Q="value";if(this.suite=Z,this.ttype=Y,this._path=Q,this.props=new Map,Y instanceof b7.TIface)for(var W=0,J=Y.props;W<J.length;W++){var G=J[W];this.props.set(G.name,G.ttype)}this.checkerPlain=this.ttype.getChecker(Z,!1),this.checkerStrict=this.ttype.getChecker(Z,!0)}return $.prototype.setReportedPath=function(Z){this._path=Z},$.prototype.check=function(Z){return this._doCheck(this.checkerPlain,Z)},$.prototype.test=function(Z){return this.checkerPlain(Z,new V9.NoopContext)},$.prototype.validate=function(Z){return this._doValidate(this.checkerPlain,Z)},$.prototype.strictCheck=function(Z){return this._doCheck(this.checkerStrict,Z)},$.prototype.strictTest=function(Z){return this.checkerStrict(Z,new V9.NoopContext)},$.prototype.strictValidate=function(Z){return this._doValidate(this.checkerStrict,Z)},$.prototype.getProp=function(Z){var Y=this.props.get(Z);if(!Y)throw Error("Type has no property "+Z);return new $(this.suite,Y,this._path+"."+Z)},$.prototype.methodArgs=function(Z){var Y=this._getMethod(Z);return new $(this.suite,Y.paramList)},$.prototype.methodResult=function(Z){var Y=this._getMethod(Z);return new $(this.suite,Y.result)},$.prototype.getArgs=function(){if(!(this.ttype instanceof b7.TFunc))throw Error("getArgs() applied to non-function");return new $(this.suite,this.ttype.paramList)},$.prototype.getResult=function(){if(!(this.ttype instanceof b7.TFunc))throw Error("getResult() applied to non-function");return new $(this.suite,this.ttype.result)},$.prototype.getType=function(){return this.ttype},$.prototype._doCheck=function(Z,Y){var Q=new V9.NoopContext;if(!Z(Y,Q)){var W=new V9.DetailContext;throw Z(Y,W),W.getError(this._path)}},$.prototype._doValidate=function(Z,Y){var Q=new V9.NoopContext;if(Z(Y,Q))return null;var W=new V9.DetailContext;return Z(Y,W),W.getErrorDetail(this._path)},$.prototype._getMethod=function(Z){var Y=this.props.get(Z);if(!Y)throw Error("Type has no property "+Z);if(!(Y instanceof b7.TFunc))throw Error("Property "+Z+" is not a method");return Y},$}();W1.Checker=yU});var qA=k((Ru)=>{Ru.__esModule=!0;Ru.LinesAndColumns=void 0;var v3=`
|
|
10
10
|
`,AA="\r",zA=function(){function $(Z){this.string=Z;var Y=[0];for(var Q=0;Q<Z.length;)switch(Z[Q]){case v3:Q+=v3.length,Y.push(Q);break;case AA:if(Q+=AA.length,Z[Q]===v3)Q+=v3.length;Y.push(Q);break;default:Q++;break}this.offsets=Y}return $.prototype.locationForIndex=function(Z){if(Z<0||Z>this.string.length)return null;var Y=0,Q=this.offsets;while(Q[Y+1]<=Z)Y++;var W=Z-Q[Y];return{line:Y,column:W}},$.prototype.indexForLocation=function(Z){var{line:Y,column:Q}=Z;if(Y<0||Y>=this.offsets.length)return null;if(Q<0||Q>this.lengthOfLine(Y))return null;return this.offsets[Y]+Q},$.prototype.lengthOfLine=function(Z){var Y=this.offsets[Z],Q=Z===this.offsets.length-1?this.string.length:this.offsets[Z+1];return Q-Y},$}();Ru.LinesAndColumns=zA;Ru.default=zA});var V8,HG,y3,L8,s7;var T3=r$(()=>{V8={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},HG={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},y3={Pending:0,Fulfilled:1,Rejected:2},L8={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},s7={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function w9(...$){UG&&console.log("quickjs-emscripten:",...$)}function*yA($){return yield $}function Tu($){return yA(AG($))}function MA($,Z){return(...Y)=>{let Q=Z.call($,jG,...Y);return AG(Q)}}function ku($,Z){let Y=Z.call($,jG);return AG(Y)}function AG($){function Z(Y){return Y.done?Y.value:Y.value instanceof Promise?Y.value.then((Q)=>Z($.next(Q)),(Q)=>Z($.throw(Q))):Z($.next(Y.value))}return Z($.next())}function BG($,Z){let Y;try{$.dispose()}catch(Q){Y=Q}if(Z&&Y)throw Object.assign(Z,{message:`${Z.message}
|
|
11
|
-
Then, failed to dispose scope: ${Y.message}`,disposeError:Y}),Z;if(Z||Y)throw Z||Y}function TA($){let Z=$?Array.from($):[];function Y(){return Z.forEach((W)=>W.alive?W.dispose():void 0)}function Q(){return Z.some((W)=>W.alive)}return Object.defineProperty(Z,VG,{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(Z,"dispose",{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(Z,"alive",{configurable:!0,enumerable:!1,get:Q}),Z}function k3($){return!!($&&(typeof $=="object"||typeof $=="function")&&("alive"in $)&&typeof $.alive=="boolean"&&("dispose"in $)&&typeof $.dispose=="function")}function xu($){if(!$)return 0;let Z=0;for(let[Y,Q]of Object.entries($)){if(!(Y in HG))throw new SA(Y);Q&&(Z|=HG[Y])}return Z}function gu($){if(typeof $=="number")return $;if($===void 0)return 0;let{type:Z,strict:Y,strip:Q,compileOnly:W,backtraceBarrier:J}=$,G=0;return Z==="global"&&(G|=V8.JS_EVAL_TYPE_GLOBAL),Z==="module"&&(G|=V8.JS_EVAL_TYPE_MODULE),Y&&(G|=V8.JS_EVAL_FLAG_STRICT),Q&&(G|=V8.JS_EVAL_FLAG_STRIP),W&&(G|=V8.JS_EVAL_FLAG_COMPILE_ONLY),J&&(G|=V8.JS_EVAL_FLAG_BACKTRACE_BARRIER),G}function uu($){if(typeof $=="number")return $;if($===void 0)return 0;let{strings:Z,symbols:Y,quickjsPrivate:Q,onlyEnumerable:W,numbers:J,numbersAsStrings:G}=$,K=0;return Z&&(K|=L8.JS_GPN_STRING_MASK),Y&&(K|=L8.JS_GPN_SYMBOL_MASK),Q&&(K|=L8.JS_GPN_PRIVATE_MASK),W&&(K|=L8.JS_GPN_ENUM_ONLY),J&&(K|=L8.QTS_GPN_NUMBER_MASK),G&&(K|=L8.QTS_STANDARD_COMPLIANT_NUMBER),K}function hu(...$){let Z=[];for(let Y of $)Y!==void 0&&(Z=Z.concat(Y));return Z}function NG($,Z){Z.interruptHandler&&$.setInterruptHandler(Z.interruptHandler),Z.maxStackSizeBytes!==void 0&&$.setMaxStackSize(Z.maxStackSizeBytes),Z.memoryLimitBytes!==void 0&&$.setMemoryLimit(Z.memoryLimitBytes)}function MG($,Z){Z.moduleLoader&&$.setModuleLoader(Z.moduleLoader),Z.shouldInterrupt&&$.setInterruptHandler(Z.shouldInterrupt),Z.memoryLimitBytes!==void 0&&$.setMemoryLimit(Z.memoryLimitBytes),Z.maxStackSizeBytes!==void 0&&$.setMaxStackSize(Z.maxStackSizeBytes)}var vu,yu=($,Z)=>{for(var Y in Z)vu($,Y,{get:Z[Y],enumerable:!0})},UG=!1,wA,FG,EA,DG,RA,_A,CA,IA,fA,SA,bA,vA,jG,O6,VG,PA,i1,l6,LG,k0,zG,kA,xA,U8,gA,uA=class{constructor($){this.module=$}toPointerArray($){let Z=new Int32Array($.map((W)=>W.value)),Y=Z.length*Z.BYTES_PER_ELEMENT,Q=this.module._malloc(Y);return new Uint8Array(this.module.HEAPU8.buffer,Q,Y).set(new Uint8Array(Z.buffer)),new i1(Q,void 0,(W)=>this.module._free(W))}newTypedArray($,Z){let Y=new $(Array(Z).fill(0)),Q=Y.length*Y.BYTES_PER_ELEMENT,W=this.module._malloc(Q),J=new $(this.module.HEAPU8.buffer,W,Z);return J.set(Y),new i1({typedArray:J,ptr:W},void 0,(G)=>this.module._free(G.ptr))}newMutablePointerArray($){return this.newTypedArray(Int32Array,$)}newHeapCharPointer($){let Z=this.module.lengthBytesUTF8($),Y=Z+1,Q=this.module._malloc(Y);return this.module.stringToUTF8($,Q,Y),new i1({ptr:Q,strlen:Z},void 0,(W)=>this.module._free(W.ptr))}newHeapBufferPointer($){let Z=$.byteLength,Y=this.module._malloc(Z);return this.module.HEAPU8.set($,Y),new i1({pointer:Y,numBytes:Z},void 0,(Q)=>this.module._free(Q.pointer))}consumeHeapCharPointer($){let Z=this.module.UTF8ToString($);return this.module._free($),Z}},
|
|
11
|
+
Then, failed to dispose scope: ${Y.message}`,disposeError:Y}),Z;if(Z||Y)throw Z||Y}function TA($){let Z=$?Array.from($):[];function Y(){return Z.forEach((W)=>W.alive?W.dispose():void 0)}function Q(){return Z.some((W)=>W.alive)}return Object.defineProperty(Z,VG,{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(Z,"dispose",{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(Z,"alive",{configurable:!0,enumerable:!1,get:Q}),Z}function k3($){return!!($&&(typeof $=="object"||typeof $=="function")&&("alive"in $)&&typeof $.alive=="boolean"&&("dispose"in $)&&typeof $.dispose=="function")}function xu($){if(!$)return 0;let Z=0;for(let[Y,Q]of Object.entries($)){if(!(Y in HG))throw new SA(Y);Q&&(Z|=HG[Y])}return Z}function gu($){if(typeof $=="number")return $;if($===void 0)return 0;let{type:Z,strict:Y,strip:Q,compileOnly:W,backtraceBarrier:J}=$,G=0;return Z==="global"&&(G|=V8.JS_EVAL_TYPE_GLOBAL),Z==="module"&&(G|=V8.JS_EVAL_TYPE_MODULE),Y&&(G|=V8.JS_EVAL_FLAG_STRICT),Q&&(G|=V8.JS_EVAL_FLAG_STRIP),W&&(G|=V8.JS_EVAL_FLAG_COMPILE_ONLY),J&&(G|=V8.JS_EVAL_FLAG_BACKTRACE_BARRIER),G}function uu($){if(typeof $=="number")return $;if($===void 0)return 0;let{strings:Z,symbols:Y,quickjsPrivate:Q,onlyEnumerable:W,numbers:J,numbersAsStrings:G}=$,K=0;return Z&&(K|=L8.JS_GPN_STRING_MASK),Y&&(K|=L8.JS_GPN_SYMBOL_MASK),Q&&(K|=L8.JS_GPN_PRIVATE_MASK),W&&(K|=L8.JS_GPN_ENUM_ONLY),J&&(K|=L8.QTS_GPN_NUMBER_MASK),G&&(K|=L8.QTS_STANDARD_COMPLIANT_NUMBER),K}function hu(...$){let Z=[];for(let Y of $)Y!==void 0&&(Z=Z.concat(Y));return Z}function NG($,Z){Z.interruptHandler&&$.setInterruptHandler(Z.interruptHandler),Z.maxStackSizeBytes!==void 0&&$.setMaxStackSize(Z.maxStackSizeBytes),Z.memoryLimitBytes!==void 0&&$.setMemoryLimit(Z.memoryLimitBytes)}function MG($,Z){Z.moduleLoader&&$.setModuleLoader(Z.moduleLoader),Z.shouldInterrupt&&$.setInterruptHandler(Z.shouldInterrupt),Z.memoryLimitBytes!==void 0&&$.setMemoryLimit(Z.memoryLimitBytes),Z.maxStackSizeBytes!==void 0&&$.setMaxStackSize(Z.maxStackSizeBytes)}var vu,yu=($,Z)=>{for(var Y in Z)vu($,Y,{get:Z[Y],enumerable:!0})},UG=!1,wA,FG,EA,DG,RA,_A,CA,IA,fA,SA,bA,vA,jG,O6,VG,PA,i1,l6,LG,k0,zG,kA,xA,U8,gA,uA=class{constructor($){this.module=$}toPointerArray($){let Z=new Int32Array($.map((W)=>W.value)),Y=Z.length*Z.BYTES_PER_ELEMENT,Q=this.module._malloc(Y);return new Uint8Array(this.module.HEAPU8.buffer,Q,Y).set(new Uint8Array(Z.buffer)),new i1(Q,void 0,(W)=>this.module._free(W))}newTypedArray($,Z){let Y=new $(Array(Z).fill(0)),Q=Y.length*Y.BYTES_PER_ELEMENT,W=this.module._malloc(Q),J=new $(this.module.HEAPU8.buffer,W,Z);return J.set(Y),new i1({typedArray:J,ptr:W},void 0,(G)=>this.module._free(G.ptr))}newMutablePointerArray($){return this.newTypedArray(Int32Array,$)}newHeapCharPointer($){let Z=this.module.lengthBytesUTF8($),Y=Z+1,Q=this.module._malloc(Y);return this.module.stringToUTF8($,Q,Y),new i1({ptr:Q,strlen:Z},void 0,(W)=>this.module._free(W.ptr))}newHeapBufferPointer($){let Z=$.byteLength,Y=this.module._malloc(Z);return this.module.HEAPU8.set($,Y),new i1({pointer:Y,numBytes:Z},void 0,(Q)=>this.module._free(Q.pointer))}consumeHeapCharPointer($){let Z=this.module.UTF8ToString($);return this.module._free($),Z}},V51,OG,mu,lu,hA,mA,pu=class{constructor($){this.callFunction=$.callFunction,this.shouldInterrupt=$.shouldInterrupt,this.loadModuleSource=$.loadModuleSource,this.normalizeModule=$.normalizeModule}},qG=class{constructor($){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new pu({callFunction:(Z,Y,Q,W,J,G)=>this.handleAsyncify(Z,()=>{try{let K=this.contextCallbacks.get(Y);if(!K)throw Error(`QuickJSContext(ctx = ${Y}) not found for C function call "${G}"`);return K.callFunction(Y,Q,W,J,G)}catch(K){return console.error("[C to host error: returning null]",K),0}}),shouldInterrupt:(Z,Y)=>this.handleAsyncify(Z,()=>{try{let Q=this.runtimeCallbacks.get(Y);if(!Q)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C interrupt`);return Q.shouldInterrupt(Y)}catch(Q){return console.error("[C to host interrupt: returning error]",Q),1}}),loadModuleSource:(Z,Y,Q,W)=>this.handleAsyncify(Z,()=>{try{let J=this.runtimeCallbacks.get(Y);if(!J)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let G=J.loadModuleSource;if(!G)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return G(Y,Q,W)}catch(J){return console.error("[C to host module loader error: returning null]",J),0}}),normalizeModule:(Z,Y,Q,W,J)=>this.handleAsyncify(Z,()=>{try{let G=this.runtimeCallbacks.get(Y);if(!G)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let K=G.normalizeModule;if(!K)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return K(Y,Q,W,J)}catch(G){return console.error("[C to host module loader error: returning null]",G),0}})}),this.module=$,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks($,Z){this.runtimeCallbacks.set($,Z)}deleteRuntime($){this.runtimeCallbacks.delete($)}setContextCallbacks($,Z){this.contextCallbacks.set($,Z)}deleteContext($){this.contextCallbacks.delete($)}handleAsyncify($,Z){if($)return $.handleSleep((Q)=>{try{let W=Z();if(!(W instanceof Promise)){w9("asyncify.handleSleep: not suspending:",W),Q(W);return}if(this.suspended)throw new _A(`Already suspended at: ${this.suspended.stack}
|
|
12
12
|
Attempted to suspend at:`);this.suspended=new CA(`(${this.suspendedCount++})`),w9("asyncify.handleSleep: suspending:",this.suspended),W.then((J)=>{this.suspended=void 0,w9("asyncify.handleSleep: resolved:",J),Q(J)},(J)=>{w9("asyncify.handleSleep: rejected:",J),console.error("QuickJS: cannot handle error in suspended function",J),this.suspended=void 0})}catch(W){throw w9("asyncify.handleSleep: error:",W),this.suspended=void 0,W}});let Y=Z();if(Y instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return Y}},PG=class{constructor($,Z){this.module=$,this.ffi=Z,this.callbacks=new qG($)}newRuntime($={}){let Z=new i1(this.ffi.QTS_NewRuntime(),void 0,(Q)=>{this.callbacks.deleteRuntime(Q),this.ffi.QTS_FreeRuntime(Q)}),Y=new mA({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:Z});return NG(Y,$),$.moduleLoader&&Y.setModuleLoader($.moduleLoader),Y}newContext($={}){let Z=this.newRuntime(),Y=Z.newContext({...$,ownedLifetimes:hu(Z,$.ownedLifetimes)});return Z.context=Y,Y}evalCode($,Z={}){return k0.withScope((Y)=>{let Q=Y.manage(this.newContext());MG(Q.runtime,Z);let W=Q.evalCode($,"eval.js");if(Z.memoryLimitBytes!==void 0&&Q.runtime.setMemoryLimit(-1),W.error)throw Q.dump(Y.manage(W.error));return Q.dump(Y.manage(W.value))})}getWasmMemory(){let $=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!$)throw Error("Variant does not support getting WebAssembly.Memory");return $}getFFI(){return this.ffi}};var wG=r$(()=>{T3();T3();vu=Object.defineProperty;wA={};yu(wA,{QuickJSAsyncifyError:()=>_A,QuickJSAsyncifySuspended:()=>CA,QuickJSEmptyGetOwnPropertyNames:()=>vA,QuickJSEmscriptenModuleError:()=>fA,QuickJSMemoryLeakDetected:()=>IA,QuickJSNotImplemented:()=>RA,QuickJSPromisePending:()=>bA,QuickJSUnknownIntrinsic:()=>SA,QuickJSUnwrapError:()=>FG,QuickJSUseAfterFree:()=>DG,QuickJSWrongOwner:()=>EA});FG=class extends Error{constructor($,Z){let Y=typeof $=="object"&&$&&"message"in $?String($.message):String($);super(Y);this.cause=$,this.context=Z,this.name="QuickJSUnwrapError"}},EA=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}},DG=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}},RA=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}},_A=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}},CA=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}},IA=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}},fA=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}},SA=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}},bA=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}},vA=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}};jG=yA;jG.of=Tu;O6=class{[Symbol.dispose](){return this.dispose()}},VG=Symbol.dispose??Symbol.for("Symbol.dispose"),PA=O6.prototype;PA[VG]||(PA[VG]=function(){return this.dispose()});i1=class $ extends O6{constructor(Z,Y,Q,W){super();this._value=Z,this.copier=Y,this.disposer=Q,this._owner=W,this._alive=!0,this._constructorStack=UG?Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw Error("Non-dupable lifetime");return new $(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(Z){this.assertAlive();let Y=Z(this);return this.dispose(),Y}map(Z){return this.assertAlive(),Z(this)}tap(Z){return Z(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new DG(`Lifetime not alive
|
|
13
13
|
${this._constructorStack}
|
|
14
|
-
Lifetime used`):new DG("Lifetime not alive")}},l6=class extends i1{constructor($,Z){super($,void 0,void 0,Z)}get dupable(){return!0}dup(){return this}dispose(){}},LG=class extends i1{constructor($,Z,Y,Q){super($,Z,Y,Q)}dispose(){this._alive=!1}};k0=class $ extends O6{constructor(){super(...arguments);this._disposables=new i1(new Set),this.manage=(Z)=>(this._disposables.value.add(Z),Z)}static withScope(Z){let Y=new $,Q;try{return Z(Y)}catch(W){throw Q=W,W}finally{BG(Y,Q)}}static withScopeMaybeAsync(Z,Y){return ku(void 0,function*(Q){let W=new $,J;try{return yield*Q.of(Y.call(Z,Q,W))}catch(G){throw J=G,G}finally{BG(W,J)}})}static async withScopeAsync(Z){let Y=new $,Q;try{return await Z(Y)}catch(W){throw Q=W,W}finally{BG(Y,Q)}}get alive(){return this._disposables.alive}dispose(){let Z=Array.from(this._disposables.value.values()).reverse();for(let Y of Z)Y.alive&&Y.dispose();this._disposables.dispose()}};zG=class $ extends O6{static success(Z){return new kA(Z)}static fail(Z,Y){return new xA(Z,Y)}static is(Z){return Z instanceof $}},kA=class extends zG{constructor($){super();this.value=$}get alive(){return k3(this.value)?this.value.alive:!0}dispose(){k3(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr($){return this.value}},xA=class extends zG{constructor($,Z){super();this.error=$,this.onUnwrap=Z}get alive(){return k3(this.error)?this.error.alive:!0}dispose(){k3(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr($){return $}},U8=zG,gA=class extends O6{constructor($){super();this.resolve=(Z)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,Z||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(Z)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,Z||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=$.context,this.owner=$.context.runtime,this.handle=$.promiseHandle,this.settled=new Promise((Z)=>{this.onSettled=Z}),this.resolveHandle=$.resolveHandle,this.rejectHandle=$.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},B51=Symbol("Unstable"),OG=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});mu=class extends O6{constructor($,Z){super();this.handle=$,this.context=Z,this._isDone=!1,this.owner=Z.runtime}[Symbol.iterator](){return this}next($){if(!this.alive||this._isDone)return{done:!0,value:void 0};let Z=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(Z,$)}return($){if(!this.alive)return{done:!0,value:void 0};let Z=this.context.getProp(this.handle,"return");if(Z===this.context.undefined&&$===void 0)return this.dispose(),{done:!0,value:void 0};let Y=this.callIteratorMethod(Z,$);return Z.dispose(),this.dispose(),Y}throw($){if(!this.alive)return{done:!0,value:void 0};let Z=$ instanceof i1?$:this.context.newError($),Y=this.context.getProp(this.handle,"throw"),Q=this.callIteratorMethod(Y,$);return Z.alive&&Z.dispose(),Y.dispose(),this.dispose(),Q}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod($,Z){let Y=Z?this.context.callFunction($,this.handle,Z):this.context.callFunction($,this.handle);if(Y.error)return this.dispose(),{value:Y};let Q=this.context.getProp(Y.value,"done").consume((J)=>this.context.dump(J));if(Q)return Y.value.dispose(),this.dispose(),{done:Q,value:void 0};let W=this.context.getProp(Y.value,"value");return Y.value.dispose(),{value:U8.success(W),done:Q}}},lu=class extends uA{constructor($){super($.module);this.scope=new k0,this.copyJSValue=(Z)=>this.ffi.QTS_DupValuePointer(this.ctx.value,Z),this.freeJSValue=(Z)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,Z)},$.ownedLifetimes?.forEach((Z)=>this.scope.manage(Z)),this.owner=$.owner,this.module=$.module,this.ffi=$.ffi,this.rt=$.rt,this.ctx=this.scope.manage($.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage($){return this.scope.manage($)}consumeJSCharPointer($){let Z=this.module.UTF8ToString($);return this.ffi.QTS_FreeCString(this.ctx.value,$),Z}heapValueHandle($){return new i1($,this.copyJSValue,this.freeJSValue,this.owner)}staticHeapValueHandle($){return this.manage(this.heapValueHandle($)),new l6($,this.owner)}},hA=class extends O6{constructor($){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.fnNextId=-32768,this.fnMaps=new Map,this.cToHostCallbacks={callFunction:(Z,Y,Q,W,J)=>{if(Z!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let G=this.getFunction(J);if(!G)throw Error(`QuickJSContext had no callback with id ${J}`);return k0.withScopeMaybeAsync(this,function*(K,B){let D=B.manage(new LG(Y,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),V=Array(Q);for(let L=0;L<Q;L++){let A=this.ffi.QTS_ArgvGetJSValueConstPointer(W,L);V[L]=B.manage(new LG(A,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let L=yield*K(G.apply(D,V));if(L){if("error"in L&&L.error)throw this.runtime.debugLog("throw error",L.error),L.error;let A=B.manage(L instanceof i1?L:L.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,A.value)}return 0}catch(L){return this.errorToHandle(L).consume((A)=>this.ffi.QTS_Throw(this.ctx.value,A.value))}})}},this.runtime=$.runtime,this.module=$.module,this.ffi=$.ffi,this.rt=$.rt,this.ctx=$.ctx,this.memory=new lu({...$,owner:this.runtime}),$.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let $=this.ffi.QTS_GetUndefined();return this._undefined=new l6($)}get null(){if(this._null)return this._null;let $=this.ffi.QTS_GetNull();return this._null=new l6($)}get true(){if(this._true)return this._true;let $=this.ffi.QTS_GetTrue();return this._true=new l6($)}get false(){if(this._false)return this._false;let $=this.ffi.QTS_GetFalse();return this._false=new l6($)}get global(){if(this._global)return this._global;let $=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle($),this._global}newNumber($){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,$))}newString($){let Z=this.memory.newHeapCharPointer($).consume((Y)=>this.ffi.QTS_NewString(this.ctx.value,Y.value.ptr));return this.memory.heapValueHandle(Z)}newUniqueSymbol($){let Z=(typeof $=="symbol"?$.description:$)??"",Y=this.memory.newHeapCharPointer(Z).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,0));return this.memory.heapValueHandle(Y)}newSymbolFor($){let Z=(typeof $=="symbol"?$.description:$)??"",Y=this.memory.newHeapCharPointer(Z).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,1));return this.memory.heapValueHandle(Y)}getWellKnownSymbol($){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,$)}newBigInt($){if(!this._BigInt){let Q=this.getProp(this.global,"BigInt");this.memory.manage(Q),this._BigInt=new l6(Q.value,this.runtime)}let Z=this._BigInt,Y=String($);return this.newString(Y).consume((Q)=>this.unwrapResult(this.callFunction(Z,this.undefined,Q)))}newObject($){$&&this.runtime.assertOwned($);let Z=$?this.ffi.QTS_NewObjectProto(this.ctx.value,$.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(Z)}newArray(){let $=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle($)}newArrayBuffer($){let Z=new Uint8Array($),Y=this.memory.newHeapBufferPointer(Z),Q=this.ffi.QTS_NewArrayBuffer(this.ctx.value,Y.value.pointer,Z.length);return this.memory.heapValueHandle(Q)}newPromise($){let Z=k0.withScope((Y)=>{let Q=Y.manage(this.memory.newMutablePointerArray(2)),W=this.ffi.QTS_NewPromiseCapability(this.ctx.value,Q.value.ptr),J=this.memory.heapValueHandle(W),[G,K]=Array.from(Q.value.typedArray).map((B)=>this.memory.heapValueHandle(B));return new gA({context:this,promiseHandle:J,resolveHandle:G,rejectHandle:K})});return $&&typeof $=="function"&&($=new Promise($)),$&&Promise.resolve($).then(Z.resolve,(Y)=>Y instanceof i1?Z.reject(Y):this.newError(Y).consume(Z.reject)),Z}newFunction($,Z){let Y=++this.fnNextId;return this.setFunction(Y,Z),this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,Y,$))}newError($){let Z=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return $&&typeof $=="object"?($.name!==void 0&&this.newString($.name).consume((Y)=>this.setProp(Z,"name",Y)),$.message!==void 0&&this.newString($.message).consume((Y)=>this.setProp(Z,"message",Y))):typeof $=="string"?this.newString($).consume((Y)=>this.setProp(Z,"message",Y)):$!==void 0&&this.newString(String($)).consume((Y)=>this.setProp(Z,"message",Y)),Z}typeof($){return this.runtime.assertOwned($),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,$.value))}getNumber($){return this.runtime.assertOwned($),this.ffi.QTS_GetFloat64(this.ctx.value,$.value)}getString($){return this.runtime.assertOwned($),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,$.value))}getSymbol($){this.runtime.assertOwned($);let Z=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,$.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,$.value)?Symbol.for(Z):Symbol(Z)}getBigInt($){this.runtime.assertOwned($);let Z=this.getString($);return BigInt(Z)}getArrayBuffer($){this.runtime.assertOwned($);let Z=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,$.value),Y=this.ffi.QTS_GetArrayBuffer(this.ctx.value,$.value);if(!Y)throw Error("Couldn't allocate memory to get ArrayBuffer");return new i1(this.module.HEAPU8.subarray(Y,Y+Z),void 0,()=>this.module._free(Y))}getPromiseState($){this.runtime.assertOwned($);let Z=this.ffi.QTS_PromiseState(this.ctx.value,$.value);if(Z<0)return{type:"fulfilled",value:$,notAPromise:!0};if(Z===y3.Pending)return{type:"pending",get error(){return new bA("Cannot unwrap a pending promise")}};let Y=this.ffi.QTS_PromiseResult(this.ctx.value,$.value),Q=this.memory.heapValueHandle(Y);if(Z===y3.Fulfilled)return{type:"fulfilled",value:Q};if(Z===y3.Rejected)return{type:"rejected",error:Q};throw Q.dispose(),Error(`Unknown JSPromiseStateEnum: ${Z}`)}resolvePromise($){this.runtime.assertOwned($);let Z=k0.withScope((Y)=>{let Q=Y.manage(this.getProp(this.global,"Promise")),W=Y.manage(this.getProp(Q,"resolve"));return this.callFunction(W,Q,$)});return Z.error?Promise.resolve(Z):new Promise((Y)=>{k0.withScope((Q)=>{let W=Q.manage(this.newFunction("resolve",(B)=>{Y(this.success(B&&B.dup()))})),J=Q.manage(this.newFunction("reject",(B)=>{Y(this.fail(B&&B.dup()))})),G=Q.manage(Z.value),K=Q.manage(this.getProp(G,"then"));this.callFunction(K,G,W,J).unwrap().dispose()})})}isEqual($,Z,Y=s7.IsStrictlyEqual){if($===Z)return!0;this.runtime.assertOwned($),this.runtime.assertOwned(Z);let Q=this.ffi.QTS_IsEqual(this.ctx.value,$.value,Z.value,Y);if(Q===-1)throw new RA("WASM variant does not expose equality");return!!Q}eq($,Z){return this.isEqual($,Z,s7.IsStrictlyEqual)}sameValue($,Z){return this.isEqual($,Z,s7.IsSameValue)}sameValueZero($,Z){return this.isEqual($,Z,s7.IsSameValueZero)}getProp($,Z){this.runtime.assertOwned($);let Y;return typeof Z=="number"&&Z>=0?Y=this.ffi.QTS_GetPropNumber(this.ctx.value,$.value,Z):Y=this.borrowPropertyKey(Z).consume((Q)=>this.ffi.QTS_GetProp(this.ctx.value,$.value,Q.value)),this.memory.heapValueHandle(Y)}getLength($){if(this.runtime.assertOwned($),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,$.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames($,Z={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned($),$.value;let Y=uu(Z);if(Y===0)throw new vA("No options set, will return an empty array");return k0.withScope((Q)=>{let W=Q.manage(this.memory.newMutablePointerArray(1)),J=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,W.value.ptr,this.uint32Out.value.ptr,$.value,Y);if(J)return this.fail(this.memory.heapValueHandle(J));let G=this.uint32Out.value.typedArray[0],K=W.value.typedArray[0],B=new Uint32Array(this.module.HEAP8.buffer,K,G),D=Array.from(B).map((V)=>this.memory.heapValueHandle(V));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,K),this.success(TA(D))})}getIterator($){let Z=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return k0.withScope((Y)=>{let Q=Y.manage(this.getProp($,Z)),W=this.callFunction(Q,$);return W.error?W:this.success(new mu(W.value,this))})}setProp($,Z,Y){this.runtime.assertOwned($),this.borrowPropertyKey(Z).consume((Q)=>this.ffi.QTS_SetProp(this.ctx.value,$.value,Q.value,Y.value))}defineProp($,Z,Y){this.runtime.assertOwned($),k0.withScope((Q)=>{let W=Q.manage(this.borrowPropertyKey(Z)),J=Y.value||this.undefined,G=!!Y.configurable,K=!!Y.enumerable,B=!!Y.value,D=Y.get?Q.manage(this.newFunction(Y.get.name,Y.get)):this.undefined,V=Y.set?Q.manage(this.newFunction(Y.set.name,Y.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,$.value,W.value,J.value,D.value,V.value,G,K,B)})}callFunction($,Z,...Y){this.runtime.assertOwned($);let Q,W=Y[0];W===void 0||Array.isArray(W)?Q=W??[]:Q=Y;let J=this.memory.toPointerArray(Q).consume((K)=>this.ffi.QTS_Call(this.ctx.value,$.value,Z.value,Q.length,K.value)),G=this.ffi.QTS_ResolveException(this.ctx.value,J);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,J),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(J))}callMethod($,Z,Y=[]){return this.getProp($,Z).consume((Q)=>this.callFunction(Q,$,Y))}evalCode($,Z="eval.js",Y){let Q=Y===void 0?1:0,W=gu(Y),J=this.memory.newHeapCharPointer($).consume((K)=>this.ffi.QTS_Eval(this.ctx.value,K.value.ptr,K.value.strlen,Z,Q,W)),G=this.ffi.QTS_ResolveException(this.ctx.value,J);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,J),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(J))}throw($){return this.errorToHandle($).consume((Z)=>this.ffi.QTS_Throw(this.ctx.value,Z.value))}borrowPropertyKey($){return typeof $=="number"?this.newNumber($):typeof $=="string"?this.newString($):new l6($.value,this.runtime)}getMemory($){if($===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump($){this.runtime.assertOwned($);let Z=this.typeof($);if(Z==="string")return this.getString($);if(Z==="number")return this.getNumber($);if(Z==="bigint")return this.getBigInt($);if(Z==="undefined")return;if(Z==="symbol")return this.getSymbol($);let Y=this.getPromiseState($);if(Y.type==="fulfilled"&&!Y.notAPromise)return $.dispose(),{type:Y.type,value:Y.value.consume(this.dump)};if(Y.type==="pending")return $.dispose(),{type:Y.type};if(Y.type==="rejected")return $.dispose(),{type:Y.type,error:Y.error.consume(this.dump)};let Q=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,$.value));try{return JSON.parse(Q)}catch{return Q}}unwrapResult($){if($.error){let Z="context"in $.error?$.error.context:this,Y=$.error.consume((Q)=>this.dump(Q));if(Y&&typeof Y=="object"&&typeof Y.message=="string"){let{message:Q,name:W,stack:J,...G}=Y,K=new FG(Y,Z);typeof W=="string"&&(K.name=Y.name),K.message=Q;let B=K.stack;throw typeof J=="string"&&(K.stack=`${W}: ${Q}
|
|
14
|
+
Lifetime used`):new DG("Lifetime not alive")}},l6=class extends i1{constructor($,Z){super($,void 0,void 0,Z)}get dupable(){return!0}dup(){return this}dispose(){}},LG=class extends i1{constructor($,Z,Y,Q){super($,Z,Y,Q)}dispose(){this._alive=!1}};k0=class $ extends O6{constructor(){super(...arguments);this._disposables=new i1(new Set),this.manage=(Z)=>(this._disposables.value.add(Z),Z)}static withScope(Z){let Y=new $,Q;try{return Z(Y)}catch(W){throw Q=W,W}finally{BG(Y,Q)}}static withScopeMaybeAsync(Z,Y){return ku(void 0,function*(Q){let W=new $,J;try{return yield*Q.of(Y.call(Z,Q,W))}catch(G){throw J=G,G}finally{BG(W,J)}})}static async withScopeAsync(Z){let Y=new $,Q;try{return await Z(Y)}catch(W){throw Q=W,W}finally{BG(Y,Q)}}get alive(){return this._disposables.alive}dispose(){let Z=Array.from(this._disposables.value.values()).reverse();for(let Y of Z)Y.alive&&Y.dispose();this._disposables.dispose()}};zG=class $ extends O6{static success(Z){return new kA(Z)}static fail(Z,Y){return new xA(Z,Y)}static is(Z){return Z instanceof $}},kA=class extends zG{constructor($){super();this.value=$}get alive(){return k3(this.value)?this.value.alive:!0}dispose(){k3(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr($){return this.value}},xA=class extends zG{constructor($,Z){super();this.error=$,this.onUnwrap=Z}get alive(){return k3(this.error)?this.error.alive:!0}dispose(){k3(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr($){return $}},U8=zG,gA=class extends O6{constructor($){super();this.resolve=(Z)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,Z||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(Z)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,Z||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=$.context,this.owner=$.context.runtime,this.handle=$.promiseHandle,this.settled=new Promise((Z)=>{this.onSettled=Z}),this.resolveHandle=$.resolveHandle,this.rejectHandle=$.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},V51=Symbol("Unstable"),OG=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});mu=class extends O6{constructor($,Z){super();this.handle=$,this.context=Z,this._isDone=!1,this.owner=Z.runtime}[Symbol.iterator](){return this}next($){if(!this.alive||this._isDone)return{done:!0,value:void 0};let Z=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(Z,$)}return($){if(!this.alive)return{done:!0,value:void 0};let Z=this.context.getProp(this.handle,"return");if(Z===this.context.undefined&&$===void 0)return this.dispose(),{done:!0,value:void 0};let Y=this.callIteratorMethod(Z,$);return Z.dispose(),this.dispose(),Y}throw($){if(!this.alive)return{done:!0,value:void 0};let Z=$ instanceof i1?$:this.context.newError($),Y=this.context.getProp(this.handle,"throw"),Q=this.callIteratorMethod(Y,$);return Z.alive&&Z.dispose(),Y.dispose(),this.dispose(),Q}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod($,Z){let Y=Z?this.context.callFunction($,this.handle,Z):this.context.callFunction($,this.handle);if(Y.error)return this.dispose(),{value:Y};let Q=this.context.getProp(Y.value,"done").consume((J)=>this.context.dump(J));if(Q)return Y.value.dispose(),this.dispose(),{done:Q,value:void 0};let W=this.context.getProp(Y.value,"value");return Y.value.dispose(),{value:U8.success(W),done:Q}}},lu=class extends uA{constructor($){super($.module);this.scope=new k0,this.copyJSValue=(Z)=>this.ffi.QTS_DupValuePointer(this.ctx.value,Z),this.freeJSValue=(Z)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,Z)},$.ownedLifetimes?.forEach((Z)=>this.scope.manage(Z)),this.owner=$.owner,this.module=$.module,this.ffi=$.ffi,this.rt=$.rt,this.ctx=this.scope.manage($.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage($){return this.scope.manage($)}consumeJSCharPointer($){let Z=this.module.UTF8ToString($);return this.ffi.QTS_FreeCString(this.ctx.value,$),Z}heapValueHandle($){return new i1($,this.copyJSValue,this.freeJSValue,this.owner)}staticHeapValueHandle($){return this.manage(this.heapValueHandle($)),new l6($,this.owner)}},hA=class extends O6{constructor($){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.fnNextId=-32768,this.fnMaps=new Map,this.cToHostCallbacks={callFunction:(Z,Y,Q,W,J)=>{if(Z!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let G=this.getFunction(J);if(!G)throw Error(`QuickJSContext had no callback with id ${J}`);return k0.withScopeMaybeAsync(this,function*(K,B){let D=B.manage(new LG(Y,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),V=Array(Q);for(let L=0;L<Q;L++){let A=this.ffi.QTS_ArgvGetJSValueConstPointer(W,L);V[L]=B.manage(new LG(A,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let L=yield*K(G.apply(D,V));if(L){if("error"in L&&L.error)throw this.runtime.debugLog("throw error",L.error),L.error;let A=B.manage(L instanceof i1?L:L.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,A.value)}return 0}catch(L){return this.errorToHandle(L).consume((A)=>this.ffi.QTS_Throw(this.ctx.value,A.value))}})}},this.runtime=$.runtime,this.module=$.module,this.ffi=$.ffi,this.rt=$.rt,this.ctx=$.ctx,this.memory=new lu({...$,owner:this.runtime}),$.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let $=this.ffi.QTS_GetUndefined();return this._undefined=new l6($)}get null(){if(this._null)return this._null;let $=this.ffi.QTS_GetNull();return this._null=new l6($)}get true(){if(this._true)return this._true;let $=this.ffi.QTS_GetTrue();return this._true=new l6($)}get false(){if(this._false)return this._false;let $=this.ffi.QTS_GetFalse();return this._false=new l6($)}get global(){if(this._global)return this._global;let $=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle($),this._global}newNumber($){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,$))}newString($){let Z=this.memory.newHeapCharPointer($).consume((Y)=>this.ffi.QTS_NewString(this.ctx.value,Y.value.ptr));return this.memory.heapValueHandle(Z)}newUniqueSymbol($){let Z=(typeof $=="symbol"?$.description:$)??"",Y=this.memory.newHeapCharPointer(Z).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,0));return this.memory.heapValueHandle(Y)}newSymbolFor($){let Z=(typeof $=="symbol"?$.description:$)??"",Y=this.memory.newHeapCharPointer(Z).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,1));return this.memory.heapValueHandle(Y)}getWellKnownSymbol($){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,$)}newBigInt($){if(!this._BigInt){let Q=this.getProp(this.global,"BigInt");this.memory.manage(Q),this._BigInt=new l6(Q.value,this.runtime)}let Z=this._BigInt,Y=String($);return this.newString(Y).consume((Q)=>this.unwrapResult(this.callFunction(Z,this.undefined,Q)))}newObject($){$&&this.runtime.assertOwned($);let Z=$?this.ffi.QTS_NewObjectProto(this.ctx.value,$.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(Z)}newArray(){let $=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle($)}newArrayBuffer($){let Z=new Uint8Array($),Y=this.memory.newHeapBufferPointer(Z),Q=this.ffi.QTS_NewArrayBuffer(this.ctx.value,Y.value.pointer,Z.length);return this.memory.heapValueHandle(Q)}newPromise($){let Z=k0.withScope((Y)=>{let Q=Y.manage(this.memory.newMutablePointerArray(2)),W=this.ffi.QTS_NewPromiseCapability(this.ctx.value,Q.value.ptr),J=this.memory.heapValueHandle(W),[G,K]=Array.from(Q.value.typedArray).map((B)=>this.memory.heapValueHandle(B));return new gA({context:this,promiseHandle:J,resolveHandle:G,rejectHandle:K})});return $&&typeof $=="function"&&($=new Promise($)),$&&Promise.resolve($).then(Z.resolve,(Y)=>Y instanceof i1?Z.reject(Y):this.newError(Y).consume(Z.reject)),Z}newFunction($,Z){let Y=++this.fnNextId;return this.setFunction(Y,Z),this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,Y,$))}newError($){let Z=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return $&&typeof $=="object"?($.name!==void 0&&this.newString($.name).consume((Y)=>this.setProp(Z,"name",Y)),$.message!==void 0&&this.newString($.message).consume((Y)=>this.setProp(Z,"message",Y))):typeof $=="string"?this.newString($).consume((Y)=>this.setProp(Z,"message",Y)):$!==void 0&&this.newString(String($)).consume((Y)=>this.setProp(Z,"message",Y)),Z}typeof($){return this.runtime.assertOwned($),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,$.value))}getNumber($){return this.runtime.assertOwned($),this.ffi.QTS_GetFloat64(this.ctx.value,$.value)}getString($){return this.runtime.assertOwned($),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,$.value))}getSymbol($){this.runtime.assertOwned($);let Z=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,$.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,$.value)?Symbol.for(Z):Symbol(Z)}getBigInt($){this.runtime.assertOwned($);let Z=this.getString($);return BigInt(Z)}getArrayBuffer($){this.runtime.assertOwned($);let Z=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,$.value),Y=this.ffi.QTS_GetArrayBuffer(this.ctx.value,$.value);if(!Y)throw Error("Couldn't allocate memory to get ArrayBuffer");return new i1(this.module.HEAPU8.subarray(Y,Y+Z),void 0,()=>this.module._free(Y))}getPromiseState($){this.runtime.assertOwned($);let Z=this.ffi.QTS_PromiseState(this.ctx.value,$.value);if(Z<0)return{type:"fulfilled",value:$,notAPromise:!0};if(Z===y3.Pending)return{type:"pending",get error(){return new bA("Cannot unwrap a pending promise")}};let Y=this.ffi.QTS_PromiseResult(this.ctx.value,$.value),Q=this.memory.heapValueHandle(Y);if(Z===y3.Fulfilled)return{type:"fulfilled",value:Q};if(Z===y3.Rejected)return{type:"rejected",error:Q};throw Q.dispose(),Error(`Unknown JSPromiseStateEnum: ${Z}`)}resolvePromise($){this.runtime.assertOwned($);let Z=k0.withScope((Y)=>{let Q=Y.manage(this.getProp(this.global,"Promise")),W=Y.manage(this.getProp(Q,"resolve"));return this.callFunction(W,Q,$)});return Z.error?Promise.resolve(Z):new Promise((Y)=>{k0.withScope((Q)=>{let W=Q.manage(this.newFunction("resolve",(B)=>{Y(this.success(B&&B.dup()))})),J=Q.manage(this.newFunction("reject",(B)=>{Y(this.fail(B&&B.dup()))})),G=Q.manage(Z.value),K=Q.manage(this.getProp(G,"then"));this.callFunction(K,G,W,J).unwrap().dispose()})})}isEqual($,Z,Y=s7.IsStrictlyEqual){if($===Z)return!0;this.runtime.assertOwned($),this.runtime.assertOwned(Z);let Q=this.ffi.QTS_IsEqual(this.ctx.value,$.value,Z.value,Y);if(Q===-1)throw new RA("WASM variant does not expose equality");return!!Q}eq($,Z){return this.isEqual($,Z,s7.IsStrictlyEqual)}sameValue($,Z){return this.isEqual($,Z,s7.IsSameValue)}sameValueZero($,Z){return this.isEqual($,Z,s7.IsSameValueZero)}getProp($,Z){this.runtime.assertOwned($);let Y;return typeof Z=="number"&&Z>=0?Y=this.ffi.QTS_GetPropNumber(this.ctx.value,$.value,Z):Y=this.borrowPropertyKey(Z).consume((Q)=>this.ffi.QTS_GetProp(this.ctx.value,$.value,Q.value)),this.memory.heapValueHandle(Y)}getLength($){if(this.runtime.assertOwned($),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,$.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames($,Z={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned($),$.value;let Y=uu(Z);if(Y===0)throw new vA("No options set, will return an empty array");return k0.withScope((Q)=>{let W=Q.manage(this.memory.newMutablePointerArray(1)),J=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,W.value.ptr,this.uint32Out.value.ptr,$.value,Y);if(J)return this.fail(this.memory.heapValueHandle(J));let G=this.uint32Out.value.typedArray[0],K=W.value.typedArray[0],B=new Uint32Array(this.module.HEAP8.buffer,K,G),D=Array.from(B).map((V)=>this.memory.heapValueHandle(V));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,K),this.success(TA(D))})}getIterator($){let Z=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return k0.withScope((Y)=>{let Q=Y.manage(this.getProp($,Z)),W=this.callFunction(Q,$);return W.error?W:this.success(new mu(W.value,this))})}setProp($,Z,Y){this.runtime.assertOwned($),this.borrowPropertyKey(Z).consume((Q)=>this.ffi.QTS_SetProp(this.ctx.value,$.value,Q.value,Y.value))}defineProp($,Z,Y){this.runtime.assertOwned($),k0.withScope((Q)=>{let W=Q.manage(this.borrowPropertyKey(Z)),J=Y.value||this.undefined,G=!!Y.configurable,K=!!Y.enumerable,B=!!Y.value,D=Y.get?Q.manage(this.newFunction(Y.get.name,Y.get)):this.undefined,V=Y.set?Q.manage(this.newFunction(Y.set.name,Y.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,$.value,W.value,J.value,D.value,V.value,G,K,B)})}callFunction($,Z,...Y){this.runtime.assertOwned($);let Q,W=Y[0];W===void 0||Array.isArray(W)?Q=W??[]:Q=Y;let J=this.memory.toPointerArray(Q).consume((K)=>this.ffi.QTS_Call(this.ctx.value,$.value,Z.value,Q.length,K.value)),G=this.ffi.QTS_ResolveException(this.ctx.value,J);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,J),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(J))}callMethod($,Z,Y=[]){return this.getProp($,Z).consume((Q)=>this.callFunction(Q,$,Y))}evalCode($,Z="eval.js",Y){let Q=Y===void 0?1:0,W=gu(Y),J=this.memory.newHeapCharPointer($).consume((K)=>this.ffi.QTS_Eval(this.ctx.value,K.value.ptr,K.value.strlen,Z,Q,W)),G=this.ffi.QTS_ResolveException(this.ctx.value,J);return G?(this.ffi.QTS_FreeValuePointer(this.ctx.value,J),this.fail(this.memory.heapValueHandle(G))):this.success(this.memory.heapValueHandle(J))}throw($){return this.errorToHandle($).consume((Z)=>this.ffi.QTS_Throw(this.ctx.value,Z.value))}borrowPropertyKey($){return typeof $=="number"?this.newNumber($):typeof $=="string"?this.newString($):new l6($.value,this.runtime)}getMemory($){if($===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump($){this.runtime.assertOwned($);let Z=this.typeof($);if(Z==="string")return this.getString($);if(Z==="number")return this.getNumber($);if(Z==="bigint")return this.getBigInt($);if(Z==="undefined")return;if(Z==="symbol")return this.getSymbol($);let Y=this.getPromiseState($);if(Y.type==="fulfilled"&&!Y.notAPromise)return $.dispose(),{type:Y.type,value:Y.value.consume(this.dump)};if(Y.type==="pending")return $.dispose(),{type:Y.type};if(Y.type==="rejected")return $.dispose(),{type:Y.type,error:Y.error.consume(this.dump)};let Q=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,$.value));try{return JSON.parse(Q)}catch{return Q}}unwrapResult($){if($.error){let Z="context"in $.error?$.error.context:this,Y=$.error.consume((Q)=>this.dump(Q));if(Y&&typeof Y=="object"&&typeof Y.message=="string"){let{message:Q,name:W,stack:J,...G}=Y,K=new FG(Y,Z);typeof W=="string"&&(K.name=Y.name),K.message=Q;let B=K.stack;throw typeof J=="string"&&(K.stack=`${W}: ${Q}
|
|
15
15
|
${Y.stack}Host: ${B}`),Object.assign(K,G),K}throw new FG(Y)}return $.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction($){let Z=$>>8,Y=this.fnMaps.get(Z);if(Y)return Y.get($)}setFunction($,Z){let Y=$>>8,Q=this.fnMaps.get(Y);return Q||(Q=new Map,this.fnMaps.set(Y,Q)),Q.set($,Z)}errorToHandle($){return $ instanceof i1?$:this.newError($)}encodeBinaryJSON($){let Z=this.ffi.QTS_bjson_encode(this.ctx.value,$.value);return this.memory.heapValueHandle(Z)}decodeBinaryJSON($){let Z=this.ffi.QTS_bjson_decode(this.ctx.value,$.value);return this.memory.heapValueHandle(Z)}success($){return U8.success($)}fail($){return U8.fail($,(Z)=>this.unwrapResult(Z))}},mA=class extends O6{constructor($){super();this.scope=new k0,this.contextMap=new Map,this._debugMode=!1,this.cToHostCallbacks={shouldInterrupt:(Z)=>{if(Z!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let Y=this.interruptHandler;if(!Y)throw Error("QuickJSContext had no interrupt handler");return Y(this)?1:0},loadModuleSource:MA(this,function*(Z,Y,Q,W){let J=this.moduleLoader;if(!J)throw Error("Runtime has no module loader");if(Y!==this.rt.value)throw Error("Runtime pointer mismatch");let G=this.contextMap.get(Q)??this.newContext({contextPointer:Q});try{let K=yield*Z(J(W,G));if(typeof K=="object"&&"error"in K&&K.error)throw this.debugLog("cToHostLoadModule: loader returned error",K.error),K.error;let B=typeof K=="string"?K:("value"in K)?K.value:K;return this.memory.newHeapCharPointer(B).value.ptr}catch(K){return this.debugLog("cToHostLoadModule: caught error",K),G.throw(K),0}}),normalizeModule:MA(this,function*(Z,Y,Q,W,J){let G=this.moduleNormalizer;if(!G)throw Error("Runtime has no module normalizer");if(Y!==this.rt.value)throw Error("Runtime pointer mismatch");let K=this.contextMap.get(Q)??this.newContext({contextPointer:Q});try{let B=yield*Z(G(W,J,K));if(typeof B=="object"&&"error"in B&&B.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",B.error),B.error;let D=typeof B=="string"?B:B.value;return K.getMemory(this.rt.value).newHeapCharPointer(D).value.ptr}catch(B){return this.debugLog("normalizeModule: caught error",B),K.throw(B),0}})},$.ownedLifetimes?.forEach((Z)=>this.scope.manage(Z)),this.module=$.module,this.memory=new uA(this.module),this.ffi=$.ffi,this.rt=$.rt,this.callbacks=$.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),UG&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext($={}){let Z=xu($.intrinsics),Y=new i1($.contextPointer||this.ffi.QTS_NewContext(this.rt.value,Z),void 0,(W)=>{this.contextMap.delete(W),this.callbacks.deleteContext(W),this.ffi.QTS_FreeContext(W)}),Q=new hA({module:this.module,ctx:Y,ffi:this.ffi,rt:this.rt,ownedLifetimes:$.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(Y.value,Q),Q}setModuleLoader($,Z){this.moduleLoader=$,this.moduleNormalizer=Z,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler($){let Z=this.interruptHandler;this.interruptHandler=$,Z||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs($=-1){let Z=this.memory.newMutablePointerArray(1),Y=this.ffi.QTS_ExecutePendingJob(this.rt.value,$??-1,Z.value.ptr),Q=Z.value.typedArray[0];if(Z.dispose(),Q===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,Y),U8.success(0);let W=this.contextMap.get(Q)??this.newContext({contextPointer:Q}),J=W.getMemory(this.rt.value).heapValueHandle(Y);if(W.typeof(J)==="number"){let G=W.getNumber(J);return J.dispose(),U8.success(G)}else{let G=Object.assign(J,{context:W});return U8.fail(G,(K)=>W.unwrapResult(K))}}setMemoryLimit($){if($<0&&$!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,$)}computeMemoryUsage(){let $=this.getSystemContext().getMemory(this.rt.value);return $.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,$.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize($){if($<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,$)}assertOwned($){if($.owner&&$.owner.rt!==this.rt)throw new EA(`Handle is not owned by this runtime: ${$.owner.rt.value} != ${this.rt.value}`)}setDebugMode($){this._debugMode=$,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,$?1:0)}isDebugMode(){return this._debugMode}debugLog(...$){this._debugMode&&console.log("quickjs-emscripten:",...$)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}}});var lA={};S(lA,{applyModuleEvalRuntimeOptions:()=>MG,applyBaseRuntimeOptions:()=>NG,QuickJSWASMModule:()=>PG,QuickJSModuleCallbacks:()=>qG});var pA=r$(()=>{wG()});import{Migrator as H2,sql as p6}from"kysely";var a$={};S(a$,{up:()=>x2,down:()=>g2});import{sql as x0}from"kysely";async function x2($){await $.schema.createTable("connections").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organizationId","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("createdById","text",(Z)=>Z.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(Z)=>Z.notNull()).addColumn("description","text").addColumn("icon","text").addColumn("appName","text").addColumn("appId","text").addColumn("connectionType","text",(Z)=>Z.notNull()).addColumn("connectionUrl","text",(Z)=>Z.notNull()).addColumn("connectionToken","text").addColumn("connectionHeaders","text").addColumn("oauthConfig","text").addColumn("metadata","text").addColumn("tools","text").addColumn("bindings","text").addColumn("status","text",(Z)=>Z.notNull().defaultTo("active")).addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("api_keys").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("userId","text",(Z)=>Z.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(Z)=>Z.notNull()).addColumn("hashedKey","text",(Z)=>Z.notNull().unique()).addColumn("permissions","text",(Z)=>Z.notNull()).addColumn("expiresAt","text").addColumn("remaining","integer").addColumn("metadata","text").addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("audit_logs").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(Z)=>Z.references("user.id").onDelete("set null")).addColumn("connectionId","text",(Z)=>Z.references("connections.id").onDelete("set null")).addColumn("toolName","text",(Z)=>Z.notNull()).addColumn("allowed","integer",(Z)=>Z.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await $.schema.createTable("oauth_clients").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("clientId","text",(Z)=>Z.notNull().unique()).addColumn("clientSecret","text").addColumn("clientName","text",(Z)=>Z.notNull()).addColumn("redirectUris","text",(Z)=>Z.notNull()).addColumn("grantTypes","text",(Z)=>Z.notNull()).addColumn("scope","text").addColumn("clientUri","text").addColumn("logoUri","text").addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("oauth_authorization_codes").addColumn("code","text",(Z)=>Z.primaryKey()).addColumn("clientId","text",(Z)=>Z.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(Z)=>Z.notNull().references("user.id").onDelete("cascade")).addColumn("redirectUri","text",(Z)=>Z.notNull()).addColumn("scope","text").addColumn("codeChallenge","text").addColumn("codeChallengeMethod","text").addColumn("expiresAt","text",(Z)=>Z.notNull()).addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("oauth_refresh_tokens").addColumn("token","text",(Z)=>Z.primaryKey()).addColumn("clientId","text",(Z)=>Z.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(Z)=>Z.notNull().references("user.id").onDelete("cascade")).addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("downstream_tokens").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("connectionId","text",(Z)=>Z.notNull().references("connections.id").onDelete("cascade")).addColumn("userId","text",(Z)=>Z.references("user.id").onDelete("cascade")).addColumn("accessToken","text",(Z)=>Z.notNull()).addColumn("refreshToken","text").addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(Z)=>Z.notNull().defaultTo(x0`CURRENT_TIMESTAMP`)).execute(),await $.schema.createIndex("idx_connections_organizationId").on("connections").column("organizationId").execute(),await $.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await $.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await $.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}async function g2($){await $.schema.dropTable("downstream_tokens").execute(),await $.schema.dropTable("oauth_refresh_tokens").execute(),await $.schema.dropTable("oauth_authorization_codes").execute(),await $.schema.dropTable("oauth_clients").execute(),await $.schema.dropTable("audit_logs").execute(),await $.schema.dropTable("api_keys").execute(),await $.schema.dropTable("connections").execute()}var o$={};S(o$,{up:()=>u2,down:()=>h2});import{sql as IG}from"kysely";async function u2($){await $.schema.createTable("organization_settings").addColumn("organizationId","text",(Z)=>Z.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(Z)=>Z.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(Z)=>Z.notNull().defaultTo(IG`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(Z)=>Z.notNull().defaultTo(IG`CURRENT_TIMESTAMP`)).execute()}async function h2($){await $.schema.dropTable("organization_settings").execute()}var s$={};S(s$,{up:()=>m2,down:()=>l2});async function m2($){await $.schema.alterTable("connections").renameColumn("name","title").execute(),await $.schema.alterTable("connections").renameColumn("createdById","created_by").execute(),await $.schema.alterTable("connections").renameColumn("createdAt","created_at").execute(),await $.schema.alterTable("connections").renameColumn("updatedAt","updated_at").execute(),await $.schema.alterTable("connections").renameColumn("organizationId","organization_id").execute(),await $.schema.alterTable("connections").renameColumn("connectionType","connection_type").execute(),await $.schema.alterTable("connections").renameColumn("connectionUrl","connection_url").execute(),await $.schema.alterTable("connections").renameColumn("connectionToken","connection_token").execute(),await $.schema.alterTable("connections").renameColumn("connectionHeaders","connection_headers").execute(),await $.schema.alterTable("connections").renameColumn("oauthConfig","oauth_config").execute(),await $.schema.alterTable("connections").renameColumn("appName","app_name").execute(),await $.schema.alterTable("connections").renameColumn("appId","app_id").execute()}async function l2($){await $.schema.alterTable("connections").renameColumn("title","name").execute(),await $.schema.alterTable("connections").renameColumn("created_by","createdById").execute(),await $.schema.alterTable("connections").renameColumn("created_at","createdAt").execute(),await $.schema.alterTable("connections").renameColumn("updated_at","updatedAt").execute(),await $.schema.alterTable("connections").renameColumn("organization_id","organizationId").execute(),await $.schema.alterTable("connections").renameColumn("connection_type","connectionType").execute(),await $.schema.alterTable("connections").renameColumn("connection_url","connectionUrl").execute(),await $.schema.alterTable("connections").renameColumn("connection_token","connectionToken").execute(),await $.schema.alterTable("connections").renameColumn("connection_headers","connectionHeaders").execute(),await $.schema.alterTable("connections").renameColumn("oauth_config","oauthConfig").execute(),await $.schema.alterTable("connections").renameColumn("app_name","appName").execute(),await $.schema.alterTable("connections").renameColumn("app_id","appId").execute()}var t$={};S(t$,{up:()=>p2,down:()=>i2});async function p2($){await $.schema.createTable("organization_settings_new").addColumn("organizationId","text",(Z)=>Z.primaryKey().references("organization.id").onDelete("cascade")).addColumn("createdAt","text",(Z)=>Z.notNull()).addColumn("updatedAt","text",(Z)=>Z.notNull()).execute(),await $.insertInto("organization_settings_new").columns(["organizationId","createdAt","updatedAt"]).expression((Z)=>Z.selectFrom("organization_settings").select(["organizationId","createdAt","updatedAt"])).execute(),await $.schema.dropTable("organization_settings").execute(),await $.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}async function i2($){await $.schema.createTable("organization_settings_new").addColumn("organizationId","text",(Z)=>Z.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(Z)=>Z.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(Z)=>Z.notNull()).addColumn("updatedAt","text",(Z)=>Z.notNull()).execute(),await $.insertInto("organization_settings_new").columns(["organizationId","modelsBindingConnectionId","createdAt","updatedAt"]).expression((Z)=>Z.selectFrom("organization_settings").select(["organizationId",Z.val(null).as("modelsBindingConnectionId"),"createdAt","updatedAt"])).execute(),await $.schema.dropTable("organization_settings").execute(),await $.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}var e$={};S(e$,{up:()=>c2,down:()=>d2});async function c2($){await $.schema.alterTable("connections").addColumn("configuration_state","text").execute(),await $.schema.alterTable("connections").addColumn("configuration_scopes","text").execute()}async function d2($){await $.schema.alterTable("connections").dropColumn("configuration_state").execute(),await $.schema.alterTable("connections").dropColumn("configuration_scopes").execute()}var $Z={};S($Z,{up:()=>r2,down:()=>a2});import{sql as n2}from"kysely";async function r2($){await $.schema.alterTable("organization_settings").addColumn("sidebar_items",n2`text`).execute()}async function a2($){await $.schema.alterTable("organization_settings").dropColumn("sidebar_items").execute()}var ZZ={};S(ZZ,{up:()=>o2,down:()=>s2});async function o2($){await $.schema.createTable("monitoring_logs").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(Z)=>Z.notNull().references("connections.id").onDelete("cascade")).addColumn("connection_title","text",(Z)=>Z.notNull()).addColumn("tool_name","text",(Z)=>Z.notNull()).addColumn("input","text",(Z)=>Z.notNull()).addColumn("output","text",(Z)=>Z.notNull()).addColumn("is_error","integer",(Z)=>Z.notNull()).addColumn("error_message","text").addColumn("duration_ms","integer",(Z)=>Z.notNull()).addColumn("timestamp","text",(Z)=>Z.notNull()).addColumn("user_id","text").addColumn("request_id","text",(Z)=>Z.notNull()).execute(),await $.schema.createIndex("monitoring_logs_org_timestamp").on("monitoring_logs").columns(["organization_id","timestamp"]).execute(),await $.schema.createIndex("monitoring_logs_connection_timestamp").on("monitoring_logs").columns(["connection_id","timestamp"]).execute(),await $.schema.createIndex("monitoring_logs_is_error").on("monitoring_logs").columns(["organization_id","is_error","timestamp"]).execute()}async function s2($){await $.schema.dropIndex("monitoring_logs_is_error").execute(),await $.schema.dropIndex("monitoring_logs_connection_timestamp").execute(),await $.schema.dropIndex("monitoring_logs_org_timestamp").execute(),await $.schema.dropTable("monitoring_logs").execute()}var YZ={};S(YZ,{up:()=>t2,down:()=>e2});import{sql as _9}from"kysely";async function t2($){await $.schema.createTable("events").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("type","text",(Z)=>Z.notNull()).addColumn("source","text",(Z)=>Z.notNull()).addColumn("specversion","text",(Z)=>Z.notNull().defaultTo("1.0")).addColumn("subject","text").addColumn("time","text",(Z)=>Z.notNull()).addColumn("datacontenttype","text",(Z)=>Z.notNull().defaultTo("application/json")).addColumn("dataschema","text").addColumn("data","text").addColumn("cron","varchar(255)").addColumn("status","text",(Z)=>Z.notNull().defaultTo("pending")).addColumn("attempts","integer",(Z)=>Z.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("next_retry_at","text").addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(_9`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(Z)=>Z.notNull().defaultTo(_9`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("event_subscriptions").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(Z)=>Z.notNull().references("connections.id").onDelete("cascade")).addColumn("publisher","text").addColumn("event_type","text",(Z)=>Z.notNull()).addColumn("filter","text").addColumn("enabled","integer",(Z)=>Z.notNull().defaultTo(1)).addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(_9`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(Z)=>Z.notNull().defaultTo(_9`CURRENT_TIMESTAMP`)).execute(),await $.schema.createTable("event_deliveries").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("event_id","text",(Z)=>Z.notNull()).addColumn("subscription_id","text",(Z)=>Z.notNull().references("event_subscriptions.id").onDelete("cascade")).addColumn("status","text",(Z)=>Z.notNull().defaultTo("pending")).addColumn("attempts","integer",(Z)=>Z.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("delivered_at","text").addColumn("next_retry_at","text").addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(_9`CURRENT_TIMESTAMP`)).execute(),await $.schema.createIndex("idx_events_org_status").on("events").columns(["organization_id","status"]).execute(),await $.schema.createIndex("idx_events_source").on("events").columns(["source"]).execute(),await $.schema.createIndex("idx_events_type").on("events").columns(["type"]).execute(),await $.schema.createIndex("idx_events_retry").on("events").columns(["status","next_retry_at"]).execute(),await $.schema.createIndex("idx_subscriptions_connection").on("event_subscriptions").columns(["connection_id"]).execute(),await $.schema.createIndex("idx_subscriptions_type").on("event_subscriptions").columns(["event_type"]).execute(),await $.schema.createIndex("idx_subscriptions_org_enabled").on("event_subscriptions").columns(["organization_id","enabled"]).execute(),await $.schema.createIndex("idx_subscriptions_unique").on("event_subscriptions").columns(["connection_id","event_type","publisher","filter"]).unique().execute(),await $.schema.createIndex("idx_deliveries_event").on("event_deliveries").columns(["event_id"]).execute(),await $.schema.createIndex("idx_deliveries_subscription_status").on("event_deliveries").columns(["subscription_id","status"]).execute(),await $.schema.createIndex("idx_deliveries_retry").on("event_deliveries").columns(["status","next_retry_at"]).execute()}async function e2($){await $.schema.dropIndex("idx_deliveries_retry").execute(),await $.schema.dropIndex("idx_deliveries_subscription_status").execute(),await $.schema.dropIndex("idx_deliveries_event").execute(),await $.schema.dropIndex("idx_subscriptions_unique").execute(),await $.schema.dropIndex("idx_subscriptions_org_enabled").execute(),await $.schema.dropIndex("idx_subscriptions_type").execute(),await $.schema.dropIndex("idx_subscriptions_connection").execute(),await $.schema.dropIndex("idx_events_retry").execute(),await $.schema.dropIndex("idx_events_type").execute(),await $.schema.dropIndex("idx_events_source").execute(),await $.schema.dropIndex("idx_events_org_status").execute(),await $.schema.dropTable("event_deliveries").execute(),await $.schema.dropTable("event_subscriptions").execute(),await $.schema.dropTable("events").execute()}var QZ={};S(QZ,{up:()=>Zz,down:()=>Yz});import{sql as $z}from"kysely";async function Zz($){await $.schema.dropTable("audit_logs").ifExists().execute()}async function Yz($){await $.schema.createTable("audit_logs").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(Z)=>Z.references("user.id").onDelete("set null")).addColumn("connectionId","text",(Z)=>Z.references("connections.id").onDelete("set null")).addColumn("toolName","text",(Z)=>Z.notNull()).addColumn("allowed","integer",(Z)=>Z.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(Z)=>Z.notNull().defaultTo($z`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await $.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await $.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await $.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}var XZ={};S(XZ,{up:()=>Qz,down:()=>Xz});import{sql as t7}from"kysely";async function Qz($){await $.schema.createTable("gateways").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(Z)=>Z.notNull()).addColumn("description","text").addColumn("tool_selection_strategy","text").addColumn("status","text",(Z)=>Z.notNull().defaultTo("active")).addColumn("is_default","integer",(Z)=>Z.notNull().defaultTo(0)).addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(t7`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(Z)=>Z.notNull().defaultTo(t7`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(Z)=>Z.notNull().references("user.id").onDelete("cascade")).addColumn("updated_by","text").execute(),await $.schema.createTable("gateway_connections").addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("gateway_id","text",(Z)=>Z.notNull().references("gateways.id").onDelete("cascade")).addColumn("connection_id","text",(Z)=>Z.notNull().references("connections.id").onDelete("cascade")).addColumn("selected_tools","text").addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(t7`CURRENT_TIMESTAMP`)).execute(),await $.schema.createIndex("idx_gateways_org").on("gateways").columns(["organization_id"]).execute(),await $.schema.createIndex("idx_gateways_org_status").on("gateways").columns(["organization_id","status"]).execute(),await t7`CREATE UNIQUE INDEX idx_gateways_default_per_org ON gateways (organization_id) WHERE is_default = 1`.execute($),await $.schema.createIndex("idx_gateway_connections_gateway").on("gateway_connections").columns(["gateway_id"]).execute(),await $.schema.createIndex("idx_gateway_connections_connection").on("gateway_connections").columns(["connection_id"]).execute(),await $.schema.createIndex("idx_gateway_connections_unique").on("gateway_connections").columns(["gateway_id","connection_id"]).unique().execute()}async function Xz($){await $.schema.dropIndex("idx_gateway_connections_unique").execute(),await $.schema.dropIndex("idx_gateway_connections_connection").execute(),await $.schema.dropIndex("idx_gateway_connections_gateway").execute(),await $.schema.dropIndex("idx_gateways_default_per_org").execute(),await $.schema.dropIndex("idx_gateways_org_status").execute(),await $.schema.dropIndex("idx_gateways_org").execute(),await $.schema.dropTable("gateway_connections").execute(),await $.schema.dropTable("gateways").execute()}var WZ={};S(WZ,{up:()=>Wz,down:()=>Jz});async function Wz($){await $.schema.alterTable("gateways").addColumn("icon","text").execute()}async function Jz($){await $.schema.alterTable("gateways").dropColumn("icon").execute()}var JZ={};S(JZ,{up:()=>Gz,down:()=>Kz});import{sql as e7}from"kysely";async function Gz($){await $.schema.alterTable("gateways").addColumn("tool_selection_mode","text",(Z)=>Z.notNull().defaultTo("inclusion")).execute(),await e7`
|
|
16
16
|
UPDATE gateways
|
|
17
17
|
SET tool_selection_mode = CASE
|
|
@@ -939,7 +939,7 @@ ${Y.stack}Host: ${B}`),Object.assign(K,G),K}throw new FG(Y)}return $.value}[Symb
|
|
|
939
939
|
DELETE FROM "organization" WHERE id = 'org_orgfs_public_skills'
|
|
940
940
|
`.execute($)}var XQ={};S(XQ,{up:()=>JM,down:()=>GM});async function JM($){await $.schema.alterTable("automations").addColumn("max_agent_steps","integer").execute()}async function GM($){await $.schema.alterTable("automations").dropColumn("max_agent_steps").execute()}var WQ={};S(WQ,{up:()=>KM,down:()=>HM});import{sql as eG}from"kysely";async function KM($){await eG`DROP INDEX IF EXISTS idx_tmp_run_seq`.execute($)}async function HM($){await eG`CREATE UNIQUE INDEX IF NOT EXISTS idx_tmp_run_seq ON thread_message_parts (run_id, seq)`.execute($)}var BM={"001-initial-schema":a$,"002-organization-settings":o$,"003-connection-schema-align":s$,"004-remove-models-binding":t$,"005-connection-configuration":e$,"006-add-views-to-settings":$Z,"007-monitoring-logs":ZZ,"008-event-bus":YZ,"009-drop-audit-logs":QZ,"010-gateways":XZ,"011-gateway-icon":WZ,"012-gateway-tool-selection-mode":JZ,"013-monitoring-user-agent-gateway":GZ,"014-gateway-resources-prompts":KZ,"015-monitoring-properties":HZ,"016-downstream-token-client-info":BZ,"017-downstream-token-remove-userid":FZ,"018-drop-gateway-tool-selection-strategy":DZ,"019-remove-gateway-is-default":VZ,"020-enabled-plugins":LZ,"021-threads":UZ,"022-rename-gateway-to-virtual-mcp":jZ,"023-optimize-thread-indexes":AZ,"024-consolidate-virtual-mcp":zZ,"025-add-monitoring-virtual-mcp-id":OZ,"026-restrict-child-connection-delete":qZ,"027-update-management-mcp-url":MZ,"028-update-management-mcp-to-self":wZ,"029-add-updated-by-to-connections":EZ,"030-member-tags":RZ,"031-add-dependency-mode":_Z,"032-projects":CZ,"033-thread-status":IZ,"034-monitoring-dashboards":fZ,"035-project-connections":SZ,"036-update-registry-url":bZ,"037-ai-provider-keys":vZ,"038-oauth-pkce-states":yZ,"039-automations":TZ,"040-replace-next-run-at-with-last-run-at":kZ,"041-ai-provider-keys-unique-constraint":xZ,"042-rename-mesh-mcp-to-cms-mcp":gZ,"043-rename-cms-mcp-to-deco-cms":uZ,"044-drop-connections-tools-column":hZ,"045-thread-context-start-message":mZ,"046-remove-object-storage-plugin":pZ,"047-add-next-run-at":iZ,"048-merge-projects-agents":dZ,"049-remove-org-admin-projects":nZ,"050-durable-agent-runs":rZ,"051-org-sso":oZ,"052-thread-agent-ids":sZ,"053-registry-config":tZ,"054-connection-slug":$Y,"055-spaces":ZY,"056-automation-project-scope":YY,"057-thread-virtual-mcp-id":QY,"058-trigger-callback-tokens":XY,"059-kv":WY,"060-member-index":JY,"061-downstream-token-connection-index":GY,"062-private-registry":KY,"063-event-subscriptions-enabled-boolean":HY,"064-brand-context":BY,"065-organization-domains":FY,"066-brand-context-structured":DY,"067-threads-metadata":VY,"068-threads-branch":LY,"069-sandbox-runner-state":UY,"070-model-categories":jY,"071-default-home-agents":AY,"072-ai-provider-key-preset-id":zY,"073-backfill-basic-usage-roles":OY,"074-sandbox-runner-state-handle-nonunique":qY,"075-thread-inflight-async-jobs":NY,"076-automations-drop-agent-json":MY,"077-tier-only-model-selection":wY,"078-automation-tool-call-kind":EY,"079-strip-legacy-freestyle-vm-map-entries":RY,"080-async-research-jobs":_Y,"081-async-research-jobs-result-content":CY,"082-secrets":IY,"083-thread-run-locally":fY,"084-drop-host-sandbox-rows":SY,"085-rename-runner-kind":bY,"086-thread-pins-and-vm-map-rekey":vY,"087-fix-vm-map-rekey":yY,"088-purge-cli-activate-keys":TY,"089-rename-remote-user-to-desktop":kY,"090-automation-webhook-triggers":xY,"091-organization-domains-allow-multi":gY,"092-sandbox-naming-uniformization":uY,"093-backfill-global-search-basic-usage":hY,"094-org-file-configs":lY,"095-remove-automation-tool-call-kind":pY,"096-org-file-configs-public-url-base":iY,"097-drop-local-docker-sandbox-state":dY,"098-thread-message-parts":nY,"099-run-fence":rY,"100-link-transport":aY,"101-cancel-requested-at":oY,"102-observational-agent":sY,"103-revert-observational-agent":tY,"104-agent-sandbox-provider-kind":$Q,"105-org-fs":ZQ,"106-automation-tools":YQ,"107-org-fs-public-org":QQ,"108-automation-max-agent-steps":XQ,"109-thread-message-parts-per-message-seq":WQ},JQ=BM;import{getMigrations as xM}from"better-auth/db";import{sso as gM}from"@better-auth/sso";import{organization as uM}from"@decocms/better-auth/plugins";import{admin as hM,apiKey as mM,jwt as lM,magicLink as pM,mcp as iM,openAPI as cM}from"better-auth/plugins";import{emailOTP as dM}from"better-auth/plugins/email-otp";import{Kysely as fM,PostgresDialect as BK}from"kysely";import{Pool as FK}from"pg";import{homedir as FM}from"os";function v9($){return $==="true"||$==="1"}function $K($){if(!$)return null;try{let Y=new URL($).hostname;if(Y==="localhost"||Y==="127.0.0.1"||Y==="::1")return null;return $}catch{return null}}var DM=new Set(["agent-sandbox","user-desktop"]);function VM($){let Z=$&&$.length>0?$:"user-desktop";if(Z==="cluster")return"agent-sandbox";if(!DM.has(Z))throw Error(`Unknown STUDIO_SANDBOX_PROVIDER="${$}" \u2014 expected "agent-sandbox", legacy "cluster", or "user-desktop".`);return Z}function ZK($,Z){let Y=$.home||Z.DATA_DIR||Z.DECOCMS_HOME||`${FM()}/deco`,Q=$.localMode,W=$.nodeEnv||Z.NODE_ENV||"development",J=Z.NATS_URL||"nats://localhost:4222";return{settings:{nodeEnv:W,port:Number($.port)||Number(Z.PORT)||3000,baseUrl:$.baseUrl||Z.BASE_URL,dataDir:Y,databasePgSsl:v9(Z.DATABASE_PG_SSL),databasePoolMax:Number(Z.DATABASE_POOL_MAX)||5,betterAuthSecret:Z.BETTER_AUTH_SECRET||"",encryptionKey:Z.ENCRYPTION_KEY||"",meshJwtSecret:Z.MESH_JWT_SECRET,localMode:Q,disableRateLimit:v9(Z.DISABLE_RATE_LIMIT),studioProvisionSecretKey:Z.STUDIO_PROVISION_SECRET_KEY,clickhouseUrl:Z.CLICKHOUSE_URL,monitoringOtlpEndpoint:Z.MONITORING_OTLP_ENDPOINT,otelServiceName:Z.OTEL_SERVICE_NAME||"studio",configPath:Z.CONFIG_PATH||"./config.json",aiGatewayEnabled:v9(Z.DECO_AI_GATEWAY_ENABLED),aiGatewayUrl:Z.DECO_AI_GATEWAY_URL||"https://ai-site.deco.site",enableDecoImport:v9(Z.ENABLE_DECO_IMPORT),orgFsClusterMounts:v9(Z.ORGFS_CLUSTER_MOUNTS),orgFsPublicSetsJson:Z.ORGFS_PUBLIC_SETS,s3Endpoint:Z.S3_ENDPOINT,s3Bucket:Z.S3_BUCKET,s3Region:Z.S3_REGION||"auto",s3AccessKeyId:Z.S3_ACCESS_KEY_ID,s3SecretAccessKey:Z.S3_SECRET_ACCESS_KEY,s3ForcePathStyle:Z.S3_FORCE_PATH_STYLE===void 0||Z.S3_FORCE_PATH_STYLE===""||Z.S3_FORCE_PATH_STYLE==="true"||Z.S3_FORCE_PATH_STYLE==="1",monitoringS3Bucket:Z.MONITORING_S3_BUCKET,monitoringS3Endpoint:Z.MONITORING_S3_ENDPOINT,monitoringS3Region:Z.MONITORING_S3_REGION,monitoringS3AccessKeyId:Z.MONITORING_S3_ACCESS_KEY_ID,monitoringS3SecretAccessKey:Z.MONITORING_S3_SECRET_ACCESS_KEY,monitoringS3Prefix:Z.MONITORING_S3_PREFIX,duckdbExtensionDirectory:Z.DUCKDB_EXTENSION_DIRECTORY||"/opt/duckdb/extensions",isCli:!0,noTui:$.noTui===!0,podName:Z.POD_NAME??crypto.randomUUID(),sandboxProviderKind:VM(Z.STUDIO_SANDBOX_PROVIDER),decoSupabaseUrl:Z.DECO_SUPABASE_URL,decoSupabaseServiceKey:Z.DECO_SUPABASE_SERVICE_KEY,firecrawlApiKey:Z.FIRECRAWL_API_KEY},externalDatabaseUrl:$K(Z.DATABASE_URL),externalNatsUrl:$K(J),skipMigrations:$.skipMigrations}}var H4=null;function S8(){if(!H4)LM();return H4}function LM(){if(H4)return;let $={...process.env},Z=ZK({port:$.PORT||"3000",home:$.DATA_DIR||$.DECOCMS_HOME||"",localMode:$.DECOCMS_LOCAL_MODE==="true",skipMigrations:!0,noTui:$.DECO_NO_TUI==="true",vitePort:$.VITE_PORT,baseUrl:$.BASE_URL},$);H4=Object.freeze({...Z.settings,databaseUrl:$.DATABASE_URL??"postgresql://postgres:postgres@localhost:5432/postgres",natsUrls:($.NATS_URL||"nats://localhost:4222").split(",").map((Y)=>Y.trim()).filter(Boolean)})}import{createContextKey as qM,metrics as NM,propagation as Zp,ROOT_CONTEXT as Yp,SpanStatusCode as Qp,trace as MM}from"@opentelemetry/api";import{logs as PM,SeverityNumber as GQ}from"@opentelemetry/api-logs";import{OTLPLogExporter as Jp}from"@opentelemetry/exporter-logs-otlp-proto";import{PrometheusExporter as wM}from"@opentelemetry/exporter-prometheus";import{OTLPTraceExporter as Hp}from"@opentelemetry/exporter-trace-otlp-proto";import{RuntimeNodeInstrumentation as Fp}from"@opentelemetry/instrumentation-runtime-node";import{context as am,propagation as om,SpanKind as sm,SpanStatusCode as tm}from"@opentelemetry/api";var $l=globalThis.fetch;import{ExportResultCode as Dl}from"@opentelemetry/core";import{ExportResultCode as B4}from"@opentelemetry/core";import{mkdir as UM,rename as jM,writeFile as AM}from"fs/promises";import{join as F4}from"path";class D4{bufferItems=[];bufferBytes=0;flushTimer=null;flushQueue=Promise.resolve();basePath;flushThreshold;maxBufferBytes;isShutdown=!1;knownDirs=new Set;partitionKey;constructor($){this.basePath=$.basePath,this.flushThreshold=$.flushThreshold??1000,this.maxBufferBytes=$.maxBufferBytes??10485760,this.partitionKey=$.partitionKey;let Z=$.flushIntervalMs??60000;if(Z>0&&Z<3600000){if(this.flushTimer=setInterval(()=>{this.flush().catch((Y)=>{console.error("[NDJSONExporter] Timer flush failed:",Y)})},Z),this.flushTimer&&typeof this.flushTimer==="object"&&"unref"in this.flushTimer)this.flushTimer.unref()}}exportRows($){if(this.isShutdown)return Promise.resolve({code:B4.FAILED});for(let Z of $){let Y=JSON.stringify(Z),Q=this.partitionKey?this.partitionKey(Z):"";this.bufferItems.push({partition:Q,json:Y}),this.bufferBytes+=Buffer.byteLength(Y,"utf8")+1}if(this.bufferItems.length>=this.flushThreshold||this.bufferBytes>=this.maxBufferBytes)return this.flush().then(()=>({code:B4.SUCCESS})).catch((Z)=>{return console.error("[NDJSONExporter] Flush failed:",Z),{code:B4.FAILED}});return Promise.resolve({code:B4.SUCCESS})}async shutdown(){if(this.isShutdown=!0,this.flushTimer)clearInterval(this.flushTimer),this.flushTimer=null;try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}async forceFlush(){try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}flush(){let Z=this.flushQueue.catch(()=>{}).then(()=>this.doFlush());return this.flushQueue=Z,Z}async doFlush(){if(this.bufferItems.length===0)return;let $=this.bufferItems;this.bufferItems=[],this.bufferBytes=0;let Z=new Map;for(let W of $){let J=Z.get(W.partition);if(!J)J=[],Z.set(W.partition,J);J.push(W.json)}let Y=await Promise.allSettled(Array.from(Z.entries()).map(([W,J])=>this.writeNDJSON(J,W).then(()=>W))),Q=Y.find((W)=>W.status==="rejected");if(Q){let W=new Set;for(let G of Y)if(G.status==="fulfilled")W.add(G.value);let J=$.filter((G)=>!W.has(G.partition));this.bufferItems=J.concat(this.bufferItems),this.bufferBytes=0;for(let G of this.bufferItems)this.bufferBytes+=Buffer.byteLength(G.json,"utf8")+1;throw Q.reason}}async writeNDJSON($,Z){let Y=new Date,Q=[String(Y.getUTCFullYear()),String(Y.getUTCMonth()+1).padStart(2,"0"),String(Y.getUTCDate()).padStart(2,"0"),String(Y.getUTCHours()).padStart(2,"0")],W=Z?F4(this.basePath,Z,...Q):F4(this.basePath,...Q);if(!this.knownDirs.has(W))await UM(W,{recursive:!0,mode:448}),this.knownDirs.add(W);let J=`${crypto.randomUUID()}.ndjson`,G=F4(W,`.${J}.tmp`),K=F4(W,J),B=$.join(`
|
|
941
941
|
`)+`
|
|
942
|
-
`;await AM(G,B,{mode:384}),await jM(G,K)}}import{ExportResultCode as Al}from"@opentelemetry/core";import{AggregationTemporality as Ol,DataPointType as ql}from"@opentelemetry/sdk-metrics";import{ExportResultCode as Rl}from"@opentelemetry/core";var fl=Buffer.byteLength("... [TRUNCATED]","utf8");import{BatchLogRecordProcessor as qp,LoggerProvider as Np}from"@opentelemetry/sdk-logs";import{detectResources as Pp,envDetector as wp,hostDetector as Ep,osDetector as Rp,processDetector as _p,resourceFromAttributes as Cp}from"@opentelemetry/resources";import{PeriodicExportingMetricReader as fp}from"@opentelemetry/sdk-metrics";import{NOOP_LOGGER as vl}from"@opentelemetry/api-logs";import{NodeSDK as vp}from"@opentelemetry/sdk-node";import{BatchSpanProcessor as Tp,SamplingDecision as b8}from"@opentelemetry/sdk-trace-base";import{SpanStatusCode as gl}from"@opentelemetry/api";var EM="__d",RM=qM("Current request"),_M=1;var QK=($)=>{let Y=new URL($.url).searchParams.get(EM);if(Y==="")return crypto.randomUUID();if(!Y)Y=$.headers.get("x-trace-debug-id");return Y};class XK{inner;constructor($){this.inner=$}shouldSample($,Z,Y,Q,W,J){let G=$.getValue(RM);if(!G){if(this.inner)return this.inner.shouldSample($,Z,Y,Q,W,J);return{decision:b8.RECORD_AND_SAMPLED}}let K=QK(G);if(K)return{decision:b8.RECORD_AND_SAMPLED,attributes:{"trace.debug.id":K}};if(this.inner){let B=this.inner.shouldSample($,Z,Y,Q,W,J);if(B.decision===b8.RECORD_AND_SAMPLED){let D=crypto.randomUUID();B.attributes={...B.attributes??{},"trace.debug.id":D}}return B}return{decision:b8.NOT_RECORD}}toString(){return"DebugSampler"}}class WK{ratio;constructor($){this.ratio=$}shouldSample(){if(Math.random()<this.ratio)return{decision:b8.RECORD_AND_SAMPLED};return{decision:b8.NOT_RECORD}}toString(){return`RatioSampler(${this.ratio})`}}var xp=new wM({preventServerStart:!0}),gp=new XK(new WK(_M));var YK=MM.getTracer("studio","1.0.0"),V4=NM.getMeter("studio","1.0.0"),CM=PM.getLogger("studio","1.0.0"),KQ=($,Z,Y)=>{let Q={},W=Y,J=Y[Y.length-1];if(J!==null&&typeof J==="object"&&!Array.isArray(J)&&!(J instanceof Error)&&Object.getPrototypeOf(J)===Object.prototype)Q=J,W=Y.slice(0,-1);let G=W.map((K)=>{if(K instanceof Error)return`${K.name}: ${K.message}`;if(typeof K==="object")try{return JSON.stringify(K)}catch{return"[Object]"}return String(K)}).join(" ");CM.emit({severityNumber:$,severityText:Z,body:G,attributes:{"log.source":"console",...Q}})},HQ={error:console.error.bind(console),warn:console.warn.bind(console),debug:console.debug.bind(console)};console.error=(...$)=>{KQ(GQ.ERROR,"ERROR",$),HQ.error(...$)};console.warn=(...$)=>{KQ(GQ.WARN,"WARN",$),HQ.warn(...$)};console.debug=(...$)=>{KQ(GQ.DEBUG,"DEBUG",$),HQ.debug(...$)};var BQ,JK=0,FQ=500;function IM(){if(BQ)return;let $=performance.now()+FQ;BQ=setInterval(()=>{let Z=performance.now();JK=Math.max(0,Z-$),$=Z+FQ},FQ),BQ.unref?.()}function GK(){return IM(),JK}var SM=()=>V4.createHistogram("db.query.duration",{description:"Database query execution duration in milliseconds",unit:"ms"}),KK=()=>V4.createHistogram("db.pool.acquire.duration",{description:"Time spent waiting to acquire a connection from the pool",unit:"ms"}),HK=400,bM=100,vM=($)=>(Z)=>{let Y={"db.statement":Z.query.sql,"db.status":Z.level==="error"?"error":"success"};if(Z.queryDurationMillis>HK){let Q=GK(),W=Q>HK/2;console.error(W?"Slow query measurement \u2014 likely event-loop lag, not slow SQL:":"Slow query detected:",{durationMs:Z.queryDurationMillis,eventLoopLagMs:Math.round(Q),sql:Z.query.sql,pool:{total:$.totalCount,idle:$.idleCount,waiting:$.waitingCount,max:L4()}})}if(SM().record(Z.queryDurationMillis,Y),Z.level==="error")console.error("Query failed:",{durationMs:Z.queryDurationMillis,error:Z.error,sql:Z.query.sql})};function yM($){let Z=$.connect.bind($);return $.connect=(Y)=>{if(typeof Y==="function")return Z(Y);let Q=performance.now(),W=L4(),J=$.idleCount===0&&$.totalCount>=W,G=$.idleCount;return Z().then((K)=>{let B=performance.now()-Q;if(KK().record(B,{"db.pool.outcome":J?"contended":"available"}),B>bM)if(J)console.error("Slow pool acquire \u2014 pool saturated:",{waitMs:B,total:$.totalCount,idle:$.idleCount,waiting:$.waitingCount,max:W});else console.warn("Slow pool acquire \u2014 event-loop lag (not pool):",{waitMs:B,idleAtStart:G,total:$.totalCount,max:W});return K},(K)=>{throw KK().record(performance.now()-Q,{"db.pool.outcome":"error"}),K})},$}var DK={keepAlive:!0,keepAliveInitialDelayMillis:1e4,idleTimeoutMillis:300000,connectionTimeoutMillis:30000,allowExitOnIdle:!0};function VK(){try{return S8().databasePgSsl}catch{return!1}}function L4(){try{return S8().databasePoolMax}catch{return 10}}function TM($){let Z=yM(new FK({connectionString:$,max:L4(),ssl:VK(),...DK})),Y=new BK({pool:Z});return{type:"postgres",db:new fM({dialect:Y,log:vM(Z)}),pool:Z}}function T9(){return S8().databaseUrl}function LK($){let Z=$||T9();return new BK({pool:new FK({connectionString:Z,max:L4(),ssl:VK(),...DK})})}function kM($){let Z=$||T9();return TM(Z)}async function UK($){if(await $.db.destroy(),!$.pool.ended)await $.pool.end();if($===y9)y9=null}var y9=null;function DQ(){if(!y9)y9=kM(T9());return y9}async function jK($){let Y={database:LK($||T9()),plugins:[uM({dynamicAccessControl:{enabled:!0,enableCustomResources:!0}}),hM(),mM(),lM(),cM(),iM({loginPage:"/login"}),gM(),pM({sendMagicLink:async()=>{}}),dM({sendVerificationOTP:async()=>{}})]},{toBeAdded:Q,toBeCreated:W,runMigrations:J}=await xM(Y);if(!Q.length&&!W.length)return"up to date";return await J(),`${W.length+Q.length} table(s) migrated`}import{createContext as nM,useContext as Qi}from"react";import{jsx as Ji}from"react/jsx-runtime";var Xi=nM(void 0);import $6 from"react";import Di from"react-dom";function tM($){if(!$||typeof document>"u")return;let Z=document.head||document.getElementsByTagName("head")[0],Y=document.createElement("style");Y.type="text/css",Z.appendChild(Y),Y.styleSheet?Y.styleSheet.cssText=$:Y.appendChild(document.createTextNode($))}var Vi=Array(12).fill(0);var LQ=1;class AK{constructor(){this.subscribe=($)=>{return this.subscribers.push($),()=>{let Z=this.subscribers.indexOf($);this.subscribers.splice(Z,1)}},this.publish=($)=>{this.subscribers.forEach((Z)=>Z($))},this.addToast=($)=>{this.publish($),this.toasts=[...this.toasts,$]},this.create=($)=>{var Z;let{message:Y,...Q}=$,W=typeof($==null?void 0:$.id)==="number"||((Z=$.id)==null?void 0:Z.length)>0?$.id:LQ++,J=this.toasts.find((K)=>{return K.id===W}),G=$.dismissible===void 0?!0:$.dismissible;if(this.dismissedToasts.has(W))this.dismissedToasts.delete(W);if(J)this.toasts=this.toasts.map((K)=>{if(K.id===W)return this.publish({...K,...$,id:W,title:Y}),{...K,...$,id:W,dismissible:G,title:Y};return K});else this.addToast({title:Y,...Q,dismissible:G,id:W});return W},this.dismiss=($)=>{if($)this.dismissedToasts.add($),requestAnimationFrame(()=>this.subscribers.forEach((Z)=>Z({id:$,dismiss:!0})));else this.toasts.forEach((Z)=>{this.subscribers.forEach((Y)=>Y({id:Z.id,dismiss:!0}))});return $},this.message=($,Z)=>{return this.create({...Z,message:$})},this.error=($,Z)=>{return this.create({...Z,message:$,type:"error"})},this.success=($,Z)=>{return this.create({...Z,type:"success",message:$})},this.info=($,Z)=>{return this.create({...Z,type:"info",message:$})},this.warning=($,Z)=>{return this.create({...Z,type:"warning",message:$})},this.loading=($,Z)=>{return this.create({...Z,type:"loading",message:$})},this.promise=($,Z)=>{if(!Z)return;let Y=void 0;if(Z.loading!==void 0)Y=this.create({...Z,promise:$,type:"loading",message:Z.loading,description:typeof Z.description!=="function"?Z.description:void 0});let Q=Promise.resolve($ instanceof Function?$():$),W=Y!==void 0,J,G=Q.then(async(B)=>{if(J=["resolve",B],$6.isValidElement(B))W=!1,this.create({id:Y,type:"default",message:B});else if($P(B)&&!B.ok){W=!1;let V=typeof Z.error==="function"?await Z.error(`HTTP error! status: ${B.status}`):Z.error,L=typeof Z.description==="function"?await Z.description(`HTTP error! status: ${B.status}`):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"error",description:L,...O})}else if(B instanceof Error){W=!1;let V=typeof Z.error==="function"?await Z.error(B):Z.error,L=typeof Z.description==="function"?await Z.description(B):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"error",description:L,...O})}else if(Z.success!==void 0){W=!1;let V=typeof Z.success==="function"?await Z.success(B):Z.success,L=typeof Z.description==="function"?await Z.description(B):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"success",description:L,...O})}}).catch(async(B)=>{if(J=["reject",B],Z.error!==void 0){W=!1;let D=typeof Z.error==="function"?await Z.error(B):Z.error,V=typeof Z.description==="function"?await Z.description(B):Z.description,A=typeof D==="object"&&!$6.isValidElement(D)?D:{message:D};this.create({id:Y,type:"error",description:V,...A})}}).finally(()=>{if(W)this.dismiss(Y),Y=void 0;Z.finally==null||Z.finally.call(Z)}),K=()=>new Promise((B,D)=>G.then(()=>J[0]==="reject"?D(J[1]):B(J[1])).catch(D));if(typeof Y!=="string"&&typeof Y!=="number")return{unwrap:K};else return Object.assign(Y,{unwrap:K})},this.custom=($,Z)=>{let Y=(Z==null?void 0:Z.id)||LQ++;return this.create({jsx:$(Y),id:Y,...Z}),Y},this.getActiveToasts=()=>{return this.toasts.filter(($)=>!this.dismissedToasts.has($.id))},this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}var V0=new AK,eM=($,Z)=>{let Y=(Z==null?void 0:Z.id)||LQ++;return V0.addToast({title:$,...Z,id:Y}),Y},$P=($)=>{return $&&typeof $==="object"&&"ok"in $&&typeof $.ok==="boolean"&&"status"in $&&typeof $.status==="number"},ZP=eM,YP=()=>V0.toasts,QP=()=>V0.getActiveToasts(),XP=Object.assign(ZP,{success:V0.success,info:V0.info,warning:V0.warning,error:V0.error,custom:V0.custom,message:V0.message,promise:V0.promise,dismiss:V0.dismiss,loading:V0.loading},{getHistory:YP,getToasts:QP});tM("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");import*as WP from"zod/v3";import*as U4 from"zod/v4-mini";function c6($){return!!$._zod}function L0($,Z){if(c6($))return U4.safeParse($,Z);return $.safeParse(Z)}function y8($){if(!$)return;let Z;if(c6($))Z=$._zod?.def?.shape;else Z=$.shape;if(!Z)return;if(typeof Z==="function")try{return Z()}catch{return}return Z}function UQ($){if(c6($)){let J=$._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=$._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let Q=$.value;if(Q!==void 0)return Q;return}import*as F from"zod/v4";var d6="2025-11-25";var jQ=[d6,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],P6="io.modelcontextprotocol/related-task",A4="2.0",C1=F.custom(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),zK=F.union([F.string(),F.number().int()]),OK=F.string(),qi=F.looseObject({ttl:F.number().optional(),pollInterval:F.number().optional()}),JP=F.object({ttl:F.number().optional()}),GP=F.object({taskId:F.string()}),AQ=F.looseObject({progressToken:zK.optional(),[P6]:GP.optional()}),J0=F.object({_meta:AQ.optional()}),k9=J0.extend({task:JP.optional()}),qK=($)=>k9.safeParse($).success,y1=F.object({method:F.string(),params:J0.loose().optional()}),U0=F.object({_meta:AQ.optional()}),j0=F.object({method:F.string(),params:U0.loose().optional()}),T1=F.looseObject({_meta:AQ.optional()}),z4=F.union([F.string(),F.number().int()]),NK=F.object({jsonrpc:F.literal(A4),id:z4,...y1.shape}).strict(),x9=($)=>NK.safeParse($).success,MK=F.object({jsonrpc:F.literal(A4),...j0.shape}).strict(),PK=($)=>MK.safeParse($).success,zQ=F.object({jsonrpc:F.literal(A4),id:z4,result:T1}).strict(),n6=($)=>zQ.safeParse($).success;var d;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(d||(d={}));var OQ=F.object({jsonrpc:F.literal(A4),id:z4.optional(),error:F.object({code:F.number().int(),message:F.string(),data:F.unknown().optional()})}).strict();var wK=($)=>OQ.safeParse($).success;var w6=F.union([NK,MK,zQ,OQ]),Ni=F.union([zQ,OQ]),E6=T1.strict(),KP=U0.extend({requestId:z4.optional(),reason:F.string().optional()}),O4=j0.extend({method:F.literal("notifications/cancelled"),params:KP}),HP=F.object({src:F.string(),mimeType:F.string().optional(),sizes:F.array(F.string()).optional(),theme:F.enum(["light","dark"]).optional()}),g9=F.object({icons:F.array(HP).optional()}),T8=F.object({name:F.string(),title:F.string().optional()}),EK=T8.extend({...T8.shape,...g9.shape,version:F.string(),websiteUrl:F.string().optional(),description:F.string().optional()}),BP=F.intersection(F.object({applyDefaults:F.boolean().optional()}),F.record(F.string(),F.unknown())),FP=F.preprocess(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},F.intersection(F.object({form:BP.optional(),url:C1.optional()}),F.record(F.string(),F.unknown()).optional())),DP=F.looseObject({list:C1.optional(),cancel:C1.optional(),requests:F.looseObject({sampling:F.looseObject({createMessage:C1.optional()}).optional(),elicitation:F.looseObject({create:C1.optional()}).optional()}).optional()}),VP=F.looseObject({list:C1.optional(),cancel:C1.optional(),requests:F.looseObject({tools:F.looseObject({call:C1.optional()}).optional()}).optional()}),LP=F.object({experimental:F.record(F.string(),C1).optional(),sampling:F.object({context:C1.optional(),tools:C1.optional()}).optional(),elicitation:FP.optional(),roots:F.object({listChanged:F.boolean().optional()}).optional(),tasks:DP.optional(),extensions:F.record(F.string(),C1).optional()}),UP=J0.extend({protocolVersion:F.string(),capabilities:LP,clientInfo:EK}),RK=y1.extend({method:F.literal("initialize"),params:UP});var jP=F.object({experimental:F.record(F.string(),C1).optional(),logging:C1.optional(),completions:C1.optional(),prompts:F.object({listChanged:F.boolean().optional()}).optional(),resources:F.object({subscribe:F.boolean().optional(),listChanged:F.boolean().optional()}).optional(),tools:F.object({listChanged:F.boolean().optional()}).optional(),tasks:VP.optional(),extensions:F.record(F.string(),C1).optional()}),qQ=T1.extend({protocolVersion:F.string(),capabilities:jP,serverInfo:EK,instructions:F.string().optional()}),NQ=j0.extend({method:F.literal("notifications/initialized"),params:U0.optional()}),_K=($)=>NQ.safeParse($).success,q4=y1.extend({method:F.literal("ping"),params:J0.optional()}),AP=F.object({progress:F.number(),total:F.optional(F.number()),message:F.optional(F.string())}),zP=F.object({...U0.shape,...AP.shape,progressToken:zK}),N4=j0.extend({method:F.literal("notifications/progress"),params:zP}),OP=J0.extend({cursor:OK.optional()}),u9=y1.extend({params:OP.optional()}),h9=T1.extend({nextCursor:OK.optional()}),qP=F.enum(["working","input_required","completed","failed","cancelled"]),m9=F.object({taskId:F.string(),status:qP,ttl:F.union([F.number(),F.null()]),createdAt:F.string(),lastUpdatedAt:F.string(),pollInterval:F.optional(F.number()),statusMessage:F.optional(F.string())}),R6=T1.extend({task:m9}),NP=U0.merge(m9),l9=j0.extend({method:F.literal("notifications/tasks/status"),params:NP}),M4=y1.extend({method:F.literal("tasks/get"),params:J0.extend({taskId:F.string()})}),P4=T1.merge(m9),w4=y1.extend({method:F.literal("tasks/result"),params:J0.extend({taskId:F.string()})}),Mi=T1.loose(),E4=u9.extend({method:F.literal("tasks/list")}),R4=h9.extend({tasks:F.array(m9)}),_4=y1.extend({method:F.literal("tasks/cancel"),params:J0.extend({taskId:F.string()})}),CK=T1.merge(m9),IK=F.object({uri:F.string(),mimeType:F.optional(F.string()),_meta:F.record(F.string(),F.unknown()).optional()}),fK=IK.extend({text:F.string()}),MQ=F.string().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),SK=IK.extend({blob:MQ}),p9=F.enum(["user","assistant"]),k8=F.object({audience:F.array(p9).optional(),priority:F.number().min(0).max(1).optional(),lastModified:F.iso.datetime({offset:!0}).optional()}),bK=F.object({...T8.shape,...g9.shape,uri:F.string(),description:F.optional(F.string()),mimeType:F.optional(F.string()),size:F.optional(F.number()),annotations:k8.optional(),_meta:F.optional(F.looseObject({}))}),MP=F.object({...T8.shape,...g9.shape,uriTemplate:F.string(),description:F.optional(F.string()),mimeType:F.optional(F.string()),annotations:k8.optional(),_meta:F.optional(F.looseObject({}))}),PQ=u9.extend({method:F.literal("resources/list")}),wQ=h9.extend({resources:F.array(bK)}),EQ=u9.extend({method:F.literal("resources/templates/list")}),RQ=h9.extend({resourceTemplates:F.array(MP)}),_Q=J0.extend({uri:F.string()}),PP=_Q,CQ=y1.extend({method:F.literal("resources/read"),params:PP}),IQ=T1.extend({contents:F.array(F.union([fK,SK]))}),fQ=j0.extend({method:F.literal("notifications/resources/list_changed"),params:U0.optional()}),wP=_Q,EP=y1.extend({method:F.literal("resources/subscribe"),params:wP}),RP=_Q,_P=y1.extend({method:F.literal("resources/unsubscribe"),params:RP}),CP=U0.extend({uri:F.string()}),IP=j0.extend({method:F.literal("notifications/resources/updated"),params:CP}),fP=F.object({name:F.string(),description:F.optional(F.string()),required:F.optional(F.boolean())}),SP=F.object({...T8.shape,...g9.shape,description:F.optional(F.string()),arguments:F.optional(F.array(fP)),_meta:F.optional(F.looseObject({}))}),SQ=u9.extend({method:F.literal("prompts/list")}),bQ=h9.extend({prompts:F.array(SP)}),bP=J0.extend({name:F.string(),arguments:F.record(F.string(),F.string()).optional()}),vQ=y1.extend({method:F.literal("prompts/get"),params:bP}),yQ=F.object({type:F.literal("text"),text:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),TQ=F.object({type:F.literal("image"),data:MQ,mimeType:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),kQ=F.object({type:F.literal("audio"),data:MQ,mimeType:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),vP=F.object({type:F.literal("tool_use"),name:F.string(),id:F.string(),input:F.record(F.string(),F.unknown()),_meta:F.record(F.string(),F.unknown()).optional()}),yP=F.object({type:F.literal("resource"),resource:F.union([fK,SK]),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),TP=bK.extend({type:F.literal("resource_link")}),xQ=F.union([yQ,TQ,kQ,TP,yP]),kP=F.object({role:p9,content:xQ}),gQ=T1.extend({description:F.string().optional(),messages:F.array(kP)}),uQ=j0.extend({method:F.literal("notifications/prompts/list_changed"),params:U0.optional()}),xP=F.object({title:F.string().optional(),readOnlyHint:F.boolean().optional(),destructiveHint:F.boolean().optional(),idempotentHint:F.boolean().optional(),openWorldHint:F.boolean().optional()}),gP=F.object({taskSupport:F.enum(["required","optional","forbidden"]).optional()}),C4=F.object({...T8.shape,...g9.shape,description:F.string().optional(),inputSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),C1).optional(),required:F.array(F.string()).optional()}).catchall(F.unknown()),outputSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),C1).optional(),required:F.array(F.string()).optional()}).catchall(F.unknown()).optional(),annotations:xP.optional(),execution:gP.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),hQ=u9.extend({method:F.literal("tools/list")}),i9=h9.extend({tools:F.array(C4)}),r6=T1.extend({content:F.array(xQ).default([]),structuredContent:F.record(F.string(),F.unknown()).optional(),isError:F.boolean().optional()}),Pi=r6.or(T1.extend({toolResult:F.unknown()})),uP=k9.extend({name:F.string(),arguments:F.record(F.string(),F.unknown()).optional()}),I4=y1.extend({method:F.literal("tools/call"),params:uP}),mQ=j0.extend({method:F.literal("notifications/tools/list_changed"),params:U0.optional()}),vK=F.object({autoRefresh:F.boolean().default(!0),debounceMs:F.number().int().nonnegative().default(300)}),lQ=F.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),hP=J0.extend({level:lQ}),yK=y1.extend({method:F.literal("logging/setLevel"),params:hP}),mP=U0.extend({level:lQ,logger:F.string().optional(),data:F.unknown()}),lP=j0.extend({method:F.literal("notifications/message"),params:mP}),pP=F.object({name:F.string().optional()}),iP=F.object({hints:F.array(pP).optional(),costPriority:F.number().min(0).max(1).optional(),speedPriority:F.number().min(0).max(1).optional(),intelligencePriority:F.number().min(0).max(1).optional()}),cP=F.object({mode:F.enum(["auto","required","none"]).optional()}),dP=F.object({type:F.literal("tool_result"),toolUseId:F.string().describe("The unique identifier for the corresponding tool call."),content:F.array(xQ).default([]),structuredContent:F.object({}).loose().optional(),isError:F.boolean().optional(),_meta:F.record(F.string(),F.unknown()).optional()}),nP=F.discriminatedUnion("type",[yQ,TQ,kQ]),j4=F.discriminatedUnion("type",[yQ,TQ,kQ,vP,dP]),rP=F.object({role:p9,content:F.union([j4,F.array(j4)]),_meta:F.record(F.string(),F.unknown()).optional()}),aP=k9.extend({messages:F.array(rP),modelPreferences:iP.optional(),systemPrompt:F.string().optional(),includeContext:F.enum(["none","thisServer","allServers"]).optional(),temperature:F.number().optional(),maxTokens:F.number().int(),stopSequences:F.array(F.string()).optional(),metadata:C1.optional(),tools:F.array(C4).optional(),toolChoice:cP.optional()}),pQ=y1.extend({method:F.literal("sampling/createMessage"),params:aP}),c9=T1.extend({model:F.string(),stopReason:F.optional(F.enum(["endTurn","stopSequence","maxTokens"]).or(F.string())),role:p9,content:nP}),f4=T1.extend({model:F.string(),stopReason:F.optional(F.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(F.string())),role:p9,content:F.union([j4,F.array(j4)])}),oP=F.object({type:F.literal("boolean"),title:F.string().optional(),description:F.string().optional(),default:F.boolean().optional()}),sP=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),minLength:F.number().optional(),maxLength:F.number().optional(),format:F.enum(["email","uri","date","date-time"]).optional(),default:F.string().optional()}),tP=F.object({type:F.enum(["number","integer"]),title:F.string().optional(),description:F.string().optional(),minimum:F.number().optional(),maximum:F.number().optional(),default:F.number().optional()}),eP=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),enum:F.array(F.string()),default:F.string().optional()}),$w=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),oneOf:F.array(F.object({const:F.string(),title:F.string()})),default:F.string().optional()}),Zw=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),enum:F.array(F.string()),enumNames:F.array(F.string()).optional(),default:F.string().optional()}),Yw=F.union([eP,$w]),Qw=F.object({type:F.literal("array"),title:F.string().optional(),description:F.string().optional(),minItems:F.number().optional(),maxItems:F.number().optional(),items:F.object({type:F.literal("string"),enum:F.array(F.string())}),default:F.array(F.string()).optional()}),Xw=F.object({type:F.literal("array"),title:F.string().optional(),description:F.string().optional(),minItems:F.number().optional(),maxItems:F.number().optional(),items:F.object({anyOf:F.array(F.object({const:F.string(),title:F.string()}))}),default:F.array(F.string()).optional()}),Ww=F.union([Qw,Xw]),Jw=F.union([Zw,Yw,Ww]),Gw=F.union([Jw,oP,sP,tP]),Kw=k9.extend({mode:F.literal("form").optional(),message:F.string(),requestedSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),Gw),required:F.array(F.string()).optional()})}),Hw=k9.extend({mode:F.literal("url"),message:F.string(),elicitationId:F.string(),url:F.string().url()}),Bw=F.union([Kw,Hw]),iQ=y1.extend({method:F.literal("elicitation/create"),params:Bw}),Fw=U0.extend({elicitationId:F.string()}),Dw=j0.extend({method:F.literal("notifications/elicitation/complete"),params:Fw}),d9=T1.extend({action:F.enum(["accept","decline","cancel"]),content:F.preprocess(($)=>$===null?void 0:$,F.record(F.string(),F.union([F.string(),F.number(),F.boolean(),F.array(F.string())])).optional())}),Vw=F.object({type:F.literal("ref/resource"),uri:F.string()});var Lw=F.object({type:F.literal("ref/prompt"),name:F.string()}),Uw=J0.extend({ref:F.union([Lw,Vw]),argument:F.object({name:F.string(),value:F.string()}),context:F.object({arguments:F.record(F.string(),F.string()).optional()}).optional()}),TK=y1.extend({method:F.literal("completion/complete"),params:Uw});var cQ=T1.extend({completion:F.looseObject({values:F.array(F.string()).max(100),total:F.optional(F.number().int()),hasMore:F.optional(F.boolean())})}),jw=F.object({uri:F.string().startsWith("file://"),name:F.string().optional(),_meta:F.record(F.string(),F.unknown()).optional()}),Aw=y1.extend({method:F.literal("roots/list"),params:J0.optional()}),kK=T1.extend({roots:F.array(jw)}),zw=j0.extend({method:F.literal("notifications/roots/list_changed"),params:U0.optional()}),wi=F.union([q4,RK,TK,yK,vQ,SQ,PQ,EQ,CQ,EP,_P,I4,hQ,M4,w4,E4,_4]),Ei=F.union([O4,N4,NQ,zw,l9]),Ri=F.union([E6,c9,f4,d9,kK,P4,R4,R6]),_i=F.union([q4,pQ,iQ,Aw,M4,w4,E4,_4]),Ci=F.union([O4,N4,lP,IP,fQ,mQ,uQ,l9,Dw]),Ii=F.union([E6,qQ,cQ,gQ,bQ,wQ,RQ,IQ,r6,i9,P4,R4,R6]);class l extends Error{constructor($,Z,Y){super(`MCP error ${$}: ${Z}`);this.code=$,this.data=Y,this.name="McpError"}static fromError($,Z,Y){if($===d.UrlElicitationRequired&&Y){let Q=Y;if(Q.elicitations)return new xK(Q.elicitations,Z)}return new l($,Z,Y)}}class xK extends l{constructor($,Z=`URL elicitation${$.length>1?"s":""} required`){super(d.UrlElicitationRequired,Z,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function _6($){return $==="completed"||$==="failed"||$==="cancelled"}import*as Ew from"zod/v4-mini";var Ow=Symbol("Let zodToJsonSchema decide on which parser to use");import{ZodFirstPartyTypeKind as Id}from"zod/v3";import{ZodFirstPartyTypeKind as mi}from"zod/v3";import{ZodFirstPartyTypeKind as Vc}from"zod/v3";var Bc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function dQ($){let Y=y8($)?.method;if(!Y)throw Error("Schema is missing a method literal");let Q=UQ(Y);if(typeof Q!=="string")throw Error("Schema method literal must be a string");return Q}function nQ($,Z){let Y=L0($,Z);if(!Y.success)throw Y.error;return Y.data}var Rw=60000;class S4{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(O4,(Z)=>{this._oncancel(Z)}),this.setNotificationHandler(N4,(Z)=>{this._onprogress(Z)}),this.setRequestHandler(q4,(Z)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(M4,async(Z,Y)=>{let Q=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!Q)throw new l(d.InvalidParams,"Failed to retrieve task: Task not found");return{...Q}}),this.setRequestHandler(w4,async(Z,Y)=>{let Q=async()=>{let W=Z.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue(W,Y.sessionId)){if(G.type==="response"||G.type==="error"){let K=G.message,B=K.id,D=this._requestResolvers.get(B);if(D)if(this._requestResolvers.delete(B),G.type==="response")D(K);else{let V=K,L=new l(V.error.code,V.error.message,V.error.data);D(L)}else{let V=G.type==="response"?"Response":"Error";this._onerror(Error(`${V} handler missing for request ${B}`))}continue}await this._transport?.send(G.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(W,Y.sessionId);if(!J)throw new l(d.InvalidParams,`Task not found: ${W}`);if(!_6(J.status))return await this._waitForTaskUpdate(W,Y.signal),await Q();if(_6(J.status)){let G=await this._taskStore.getTaskResult(W,Y.sessionId);return this._clearTaskQueue(W),{...G,_meta:{...G._meta,[P6]:{taskId:W}}}}return await Q()};return await Q()}),this.setRequestHandler(E4,async(Z,Y)=>{try{let{tasks:Q,nextCursor:W}=await this._taskStore.listTasks(Z.params?.cursor,Y.sessionId);return{tasks:Q,nextCursor:W,_meta:{}}}catch(Q){throw new l(d.InvalidParams,`Failed to list tasks: ${Q instanceof Error?Q.message:String(Q)}`)}}),this.setRequestHandler(_4,async(Z,Y)=>{try{let Q=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!Q)throw new l(d.InvalidParams,`Task not found: ${Z.params.taskId}`);if(_6(Q.status))throw new l(d.InvalidParams,`Cannot cancel task in terminal status: ${Q.status}`);await this._taskStore.updateTaskStatus(Z.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(Z.params.taskId);let W=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!W)throw new l(d.InvalidParams,`Task not found after cancellation: ${Z.params.taskId}`);return{_meta:{},...W}}catch(Q){if(Q instanceof l)throw Q;throw new l(d.InvalidRequest,`Failed to cancel task: ${Q instanceof Error?Q.message:String(Q)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,Z,Y,Q,W=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Q,Z),startTime:Date.now(),timeout:Z,maxTotalTimeout:Y,resetTimeoutOnProgress:W,onTimeout:Q})}_resetTimeout($){let Z=this._timeoutInfo.get($);if(!Z)return!1;let Y=Date.now()-Z.startTime;if(Z.maxTotalTimeout&&Y>=Z.maxTotalTimeout)throw this._timeoutInfo.delete($),l.fromError(d.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Z.maxTotalTimeout,totalElapsed:Y});return clearTimeout(Z.timeoutId),Z.timeoutId=setTimeout(Z.onTimeout,Z.timeout),!0}_cleanupTimeout($){let Z=this._timeoutInfo.get($);if(Z)clearTimeout(Z.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let Z=this.transport?.onclose;this._transport.onclose=()=>{Z?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(W)=>{Y?.(W),this._onerror(W)};let Q=this._transport?.onmessage;this._transport.onmessage=(W,J)=>{if(Q?.(W,J),n6(W)||wK(W))this._onresponse(W);else if(x9(W))this._onrequest(W,J);else if(PK(W))this._onnotification(W);else this._onerror(Error(`Unknown message type: ${JSON.stringify(W)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();for(let Y of this._requestHandlerAbortControllers.values())Y.abort();this._requestHandlerAbortControllers.clear();let Z=l.fromError(d.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of $.values())Y(Z)}_onerror($){this.onerror?.($)}_onnotification($){let Z=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(Z===void 0)return;Promise.resolve().then(()=>Z($)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest($,Z){let Y=this._requestHandlers.get($.method)??this.fallbackRequestHandler,Q=this._transport,W=$.params?._meta?.[P6]?.taskId;if(Y===void 0){let D={jsonrpc:"2.0",id:$.id,error:{code:d.MethodNotFound,message:"Method not found"}};if(W&&this._taskMessageQueue)this._enqueueTaskMessage(W,{type:"error",message:D,timestamp:Date.now()},Q?.sessionId).catch((V)=>this._onerror(Error(`Failed to enqueue error response: ${V}`)));else Q?.send(D).catch((V)=>this._onerror(Error(`Failed to send an error response: ${V}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set($.id,J);let G=qK($.params)?$.params.task:void 0,K=this._taskStore?this.requestTaskStore($,Q?.sessionId):void 0,B={signal:J.signal,sessionId:Q?.sessionId,_meta:$.params?._meta,sendNotification:async(D)=>{if(J.signal.aborted)return;let V={relatedRequestId:$.id};if(W)V.relatedTask={taskId:W};await this.notification(D,V)},sendRequest:async(D,V,L)=>{if(J.signal.aborted)throw new l(d.ConnectionClosed,"Request was cancelled");let A={...L,relatedRequestId:$.id};if(W&&!A.relatedTask)A.relatedTask={taskId:W};let O=A.relatedTask?.taskId??W;if(O&&K)await K.updateTaskStatus(O,"input_required");return await this.request(D,V,A)},authInfo:Z?.authInfo,requestId:$.id,requestInfo:Z?.requestInfo,taskId:W,taskStore:K,taskRequestedTtl:G?.ttl,closeSSEStream:Z?.closeSSEStream,closeStandaloneSSEStream:Z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(G)this.assertTaskHandlerCapability($.method)}).then(()=>Y($,B)).then(async(D)=>{if(J.signal.aborted)return;let V={result:D,jsonrpc:"2.0",id:$.id};if(W&&this._taskMessageQueue)await this._enqueueTaskMessage(W,{type:"response",message:V,timestamp:Date.now()},Q?.sessionId);else await Q?.send(V)},async(D)=>{if(J.signal.aborted)return;let V={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(D.code)?D.code:d.InternalError,message:D.message??"Internal error",...D.data!==void 0&&{data:D.data}}};if(W&&this._taskMessageQueue)await this._enqueueTaskMessage(W,{type:"error",message:V,timestamp:Date.now()},Q?.sessionId);else await Q?.send(V)}).catch((D)=>this._onerror(Error(`Failed to send response: ${D}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===J)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:Z,...Y}=$.params,Q=Number(Z),W=this._progressHandlers.get(Q);if(!W){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let J=this._responseHandlers.get(Q),G=this._timeoutInfo.get(Q);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(Q)}catch(K){this._responseHandlers.delete(Q),this._progressHandlers.delete(Q),this._cleanupTimeout(Q),J(K);return}W(Y)}_onresponse($){let Z=Number($.id),Y=this._requestResolvers.get(Z);if(Y){if(this._requestResolvers.delete(Z),n6($))Y($);else{let J=new l($.error.code,$.error.message,$.error.data);Y(J)}return}let Q=this._responseHandlers.get(Z);if(Q===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(Z),this._cleanupTimeout(Z);let W=!1;if(n6($)&&$.result&&typeof $.result==="object"){let J=$.result;if(J.task&&typeof J.task==="object"){let G=J.task;if(typeof G.taskId==="string")W=!0,this._taskProgressTokens.set(G.taskId,Z)}}if(!W)this._progressHandlers.delete(Z);if(n6($))Q($);else{let J=l.fromError($.error.code,$.error.message,$.error.data);Q(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,Z,Y){let{task:Q}=Y??{};if(!Q){try{yield{type:"result",result:await this.request($,Z,Y)}}catch(J){yield{type:"error",error:J instanceof l?J:new l(d.InternalError,String(J))}}return}let W;try{let J=await this.request($,R6,Y);if(J.task)W=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new l(d.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:W},Y);if(yield{type:"taskStatus",task:G},_6(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:W},Z,Y)};else if(G.status==="failed")yield{type:"error",error:new l(d.InternalError,`Task ${W} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new l(d.InternalError,`Task ${W} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:W},Z,Y)};return}let K=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,K)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof l?J:new l(d.InternalError,String(J))}}}request($,Z,Y){let{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J,task:G,relatedTask:K}=Y??{};return new Promise((B,D)=>{let V=(N)=>{D(N)};if(!this._transport){V(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),G)this.assertTaskCapability($.method)}catch(N){V(N);return}Y?.signal?.throwIfAborted();let L=this._requestMessageId++,A={...$,jsonrpc:"2.0",id:L};if(Y?.onprogress)this._progressHandlers.set(L,Y.onprogress),A.params={...$.params,_meta:{...$.params?._meta||{},progressToken:L}};if(G)A.params={...A.params,task:G};if(K)A.params={...A.params,_meta:{...A.params?._meta||{},[P6]:K}};let O=(N)=>{this._responseHandlers.delete(L),this._progressHandlers.delete(L),this._cleanupTimeout(L),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:L,reason:String(N)}},{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J}).catch((f)=>this._onerror(Error(`Failed to send cancellation: ${f}`)));let E=N instanceof l?N:new l(d.RequestTimeout,String(N));D(E)};this._responseHandlers.set(L,(N)=>{if(Y?.signal?.aborted)return;if(N instanceof Error)return D(N);try{let E=L0(Z,N.result);if(!E.success)D(E.error);else B(E.data)}catch(E){D(E)}}),Y?.signal?.addEventListener("abort",()=>{O(Y?.signal?.reason)});let q=Y?.timeout??Rw,M=()=>O(l.fromError(d.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(L,q,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let I=K?.taskId;if(I){let N=(E)=>{let f=this._responseHandlers.get(L);if(f)f(E);else this._onerror(Error(`Response handler missing for side-channeled request ${L}`))};this._requestResolvers.set(L,N),this._enqueueTaskMessage(I,{type:"request",message:A,timestamp:Date.now()}).catch((E)=>{this._cleanupTimeout(L),D(E)})}else this._transport.send(A,{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J}).catch((N)=>{this._cleanupTimeout(L),D(N)})})}async getTask($,Z){return this.request({method:"tasks/get",params:$},P4,Z)}async getTaskResult($,Z,Y){return this.request({method:"tasks/result",params:$},Z,Y)}async listTasks($,Z){return this.request({method:"tasks/list",params:$},R4,Z)}async cancelTask($,Z){return this.request({method:"tasks/cancel",params:$},CK,Z)}async notification($,Z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let Y=Z?.relatedTask?.taskId;if(Y){let G={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[P6]:Z.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:G,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!Z?.relatedRequestId&&!Z?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let G={...$,jsonrpc:"2.0"};if(Z?.relatedTask)G={...G,params:{...G.params,_meta:{...G.params?._meta||{},[P6]:Z.relatedTask}}};this._transport?.send(G,Z).catch((K)=>this._onerror(K))});return}let J={...$,jsonrpc:"2.0"};if(Z?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[P6]:Z.relatedTask}}};await this._transport.send(J,Z)}setRequestHandler($,Z){let Y=dQ($);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(Q,W)=>{let J=nQ($,Q);return Promise.resolve(Z(J,W))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,Z){let Y=dQ($);this._notificationHandlers.set(Y,(Q)=>{let W=nQ($,Q);return Promise.resolve(Z(W))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let Z=this._taskProgressTokens.get($);if(Z!==void 0)this._progressHandlers.delete(Z),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,Z,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let Q=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,Z,Y,Q)}async _clearTaskQueue($,Z){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll($,Z);for(let Q of Y)if(Q.type==="request"&&x9(Q.message)){let W=Q.message.id,J=this._requestResolvers.get(W);if(J)J(new l(d.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(W);else this._onerror(Error(`Resolver missing for request ${W} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,Z){let Y=this._options?.defaultTaskPollInterval??1000;try{let Q=await this._taskStore?.getTask($);if(Q?.pollInterval)Y=Q.pollInterval}catch{}return new Promise((Q,W)=>{if(Z.aborted){W(new l(d.InvalidRequest,"Request cancelled"));return}let J=setTimeout(Q,Y);Z.addEventListener("abort",()=>{clearTimeout(J),W(new l(d.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,Z){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(Q)=>{if(!$)throw Error("No request provided");return await Y.createTask(Q,$.id,{method:$.method,params:$.params},Z)},getTask:async(Q)=>{let W=await Y.getTask(Q,Z);if(!W)throw new l(d.InvalidParams,"Failed to retrieve task: Task not found");return W},storeTaskResult:async(Q,W,J)=>{await Y.storeTaskResult(Q,W,J,Z);let G=await Y.getTask(Q,Z);if(G){let K=l9.parse({method:"notifications/tasks/status",params:G});if(await this.notification(K),_6(G.status))this._cleanupTaskProgressHandler(Q)}},getTaskResult:(Q)=>{return Y.getTaskResult(Q,Z)},updateTaskStatus:async(Q,W,J)=>{let G=await Y.getTask(Q,Z);if(!G)throw new l(d.InvalidParams,`Task "${Q}" not found - it may have been cleaned up`);if(_6(G.status))throw new l(d.InvalidParams,`Cannot update task "${Q}" from terminal status "${G.status}" to "${W}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(Q,W,J,Z);let K=await Y.getTask(Q,Z);if(K){let B=l9.parse({method:"notifications/tasks/status",params:K});if(await this.notification(B),_6(K.status))this._cleanupTaskProgressHandler(Q)}},listTasks:(Q)=>{return Y.listTasks(Q,Z)}}}}function gK($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function rQ($,Z){let Y={...$};for(let Q in Z){let W=Q,J=Z[W];if(J===void 0)continue;let G=Y[W];if(gK(G)&&gK(J))Y[W]={...G,...J};else Y[W]=J}return Y}var UV=R9(lX(),1),jV=R9(LV(),1);function xb(){let $=new UV.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return jV.default($),$}class U5{constructor($){this._ajv=$??xb()}getValidator($){let Z="$id"in $&&typeof $.$id==="string"?this._ajv.getSchema($.$id)??this._ajv.compile($):this._ajv.compile($);return(Y)=>{if(Z(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Z.errors)}}}}class tX{constructor($){this._client=$}async*callToolStream($,Z=r6,Y){let Q=this._client,W={...Y,task:Y?.task??(Q.isToolTask($.name)?{}:void 0)},J=Q.requestStream({method:"tools/call",params:$},Z,W),G=Q.getToolOutputValidator($.name);for await(let K of J){if(K.type==="result"&&G){let B=K.result;if(!B.structuredContent&&!B.isError){yield{type:"error",error:new l(d.InvalidRequest,`Tool ${$.name} has an output schema but did not return structured content`)};return}if(B.structuredContent)try{let D=G(B.structuredContent);if(!D.valid){yield{type:"error",error:new l(d.InvalidParams,`Structured content does not match the tool's output schema: ${D.errorMessage}`)};return}}catch(D){if(D instanceof l){yield{type:"error",error:D};return}yield{type:"error",error:new l(d.InvalidParams,`Failed to validate structured content: ${D instanceof Error?D.message:String(D)}`)};return}}yield K}}async getTask($,Z){return this._client.getTask({taskId:$},Z)}async getTaskResult($,Z,Y){return this._client.getTaskResult({taskId:$},Z,Y)}async listTasks($,Z){return this._client.listTasks($?{cursor:$}:void 0,Z)}async cancelTask($,Z){return this._client.cancelTask({taskId:$},Z)}requestStream($,Z,Y){return this._client.requestStream($,Z,Y)}}function eX($,Z,Y){if(!$)throw Error(`${Y} does not support task creation (required for ${Z})`);switch(Z){case"tools/call":if(!$.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${Z})`);break;default:break}}function $W($,Z,Y){if(!$)throw Error(`${Y} does not support task creation (required for ${Z})`);switch(Z){case"sampling/createMessage":if(!$.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${Z})`);break;case"elicitation/create":if(!$.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${Z})`);break;default:break}}function j5($,Z){if(!$||Z===null||typeof Z!=="object")return;if($.type==="object"&&$.properties&&typeof $.properties==="object"){let Y=Z,Q=$.properties;for(let W of Object.keys(Q)){let J=Q[W];if(Y[W]===void 0&&Object.prototype.hasOwnProperty.call(J,"default"))Y[W]=J.default;if(Y[W]!==void 0)j5(J,Y[W])}}if(Array.isArray($.anyOf)){for(let Y of $.anyOf)if(typeof Y!=="boolean")j5(Y,Z)}if(Array.isArray($.oneOf)){for(let Y of $.oneOf)if(typeof Y!=="boolean")j5(Y,Z)}}function gb($){if(!$)return{supportsFormMode:!1,supportsUrlMode:!1};let Z=$.form!==void 0,Y=$.url!==void 0;return{supportsFormMode:Z||!Z&&!Y,supportsUrlMode:Y}}class A5 extends S4{constructor($,Z){super(Z);if(this._clientInfo=$,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=Z?.capabilities??{},this._jsonSchemaValidator=Z?.jsonSchemaValidator??new U5,Z?.listChanged)this._pendingListChangedConfig=Z.listChanged}_setupListChangedHandlers($){if($.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",mQ,$.tools,async()=>{return(await this.listTools()).tools});if($.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",uQ,$.prompts,async()=>{return(await this.listPrompts()).prompts});if($.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",fQ,$.resources,async()=>{return(await this.listResources()).resources})}get experimental(){if(!this._experimental)this._experimental={tasks:new tX(this)};return this._experimental}registerCapabilities($){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=rQ(this._capabilities,$)}setRequestHandler($,Z){let Q=y8($)?.method;if(!Q)throw Error("Schema is missing a method literal");let W;if(c6(Q)){let G=Q;W=G._zod?.def?.value??G.value}else{let G=Q;W=G._def?.value??G.value}if(typeof W!=="string")throw Error("Schema method literal must be a string");let J=W;if(J==="elicitation/create"){let G=async(K,B)=>{let D=L0(iQ,K);if(!D.success){let N=D.error instanceof Error?D.error.message:String(D.error);throw new l(d.InvalidParams,`Invalid elicitation request: ${N}`)}let{params:V}=D.data;V.mode=V.mode??"form";let{supportsFormMode:L,supportsUrlMode:A}=gb(this._capabilities.elicitation);if(V.mode==="form"&&!L)throw new l(d.InvalidParams,"Client does not support form-mode elicitation requests");if(V.mode==="url"&&!A)throw new l(d.InvalidParams,"Client does not support URL-mode elicitation requests");let O=await Promise.resolve(Z(K,B));if(V.task){let N=L0(R6,O);if(!N.success){let E=N.error instanceof Error?N.error.message:String(N.error);throw new l(d.InvalidParams,`Invalid task creation result: ${E}`)}return N.data}let q=L0(d9,O);if(!q.success){let N=q.error instanceof Error?q.error.message:String(q.error);throw new l(d.InvalidParams,`Invalid elicitation result: ${N}`)}let M=q.data,I=V.mode==="form"?V.requestedSchema:void 0;if(V.mode==="form"&&M.action==="accept"&&M.content&&I){if(this._capabilities.elicitation?.form?.applyDefaults)try{j5(I,M.content)}catch{}}return M};return super.setRequestHandler($,G)}if(J==="sampling/createMessage"){let G=async(K,B)=>{let D=L0(pQ,K);if(!D.success){let M=D.error instanceof Error?D.error.message:String(D.error);throw new l(d.InvalidParams,`Invalid sampling request: ${M}`)}let{params:V}=D.data,L=await Promise.resolve(Z(K,B));if(V.task){let M=L0(R6,L);if(!M.success){let I=M.error instanceof Error?M.error.message:String(M.error);throw new l(d.InvalidParams,`Invalid task creation result: ${I}`)}return M.data}let O=V.tools||V.toolChoice?f4:c9,q=L0(O,L);if(!q.success){let M=q.error instanceof Error?q.error.message:String(q.error);throw new l(d.InvalidParams,`Invalid sampling result: ${M}`)}return q.data};return super.setRequestHandler($,G)}return super.setRequestHandler($,Z)}assertCapability($,Z){if(!this._serverCapabilities?.[$])throw Error(`Server does not support ${$} (required for ${Z})`)}async connect($,Z){if(await super.connect($),$.sessionId!==void 0)return;try{let Y=await this.request({method:"initialize",params:{protocolVersion:d6,capabilities:this._capabilities,clientInfo:this._clientInfo}},qQ,Z);if(Y===void 0)throw Error(`Server sent invalid initialize result: ${Y}`);if(!jQ.includes(Y.protocolVersion))throw Error(`Server's protocol version is not supported: ${Y.protocolVersion}`);if(this._serverCapabilities=Y.capabilities,this._serverVersion=Y.serverInfo,$.setProtocolVersion)$.setProtocolVersion(Y.protocolVersion);if(this._instructions=Y.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(Y){throw this.close(),Y}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod($){switch($){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${$})`);if($==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${$})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${$})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${$})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){if(!this._capabilities)return;switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${$})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${$})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${$})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${$})`);break;case"ping":break}}assertTaskCapability($){eX(this._serverCapabilities?.tasks?.requests,$,"Server")}assertTaskHandlerCapability($){if(!this._capabilities)return;$W(this._capabilities.tasks?.requests,$,"Client")}async ping($){return this.request({method:"ping"},E6,$)}async complete($,Z){return this.request({method:"completion/complete",params:$},cQ,Z)}async setLoggingLevel($,Z){return this.request({method:"logging/setLevel",params:{level:$}},E6,Z)}async getPrompt($,Z){return this.request({method:"prompts/get",params:$},gQ,Z)}async listPrompts($,Z){return this.request({method:"prompts/list",params:$},bQ,Z)}async listResources($,Z){return this.request({method:"resources/list",params:$},wQ,Z)}async listResourceTemplates($,Z){return this.request({method:"resources/templates/list",params:$},RQ,Z)}async readResource($,Z){return this.request({method:"resources/read",params:$},IQ,Z)}async subscribeResource($,Z){return this.request({method:"resources/subscribe",params:$},E6,Z)}async unsubscribeResource($,Z){return this.request({method:"resources/unsubscribe",params:$},E6,Z)}async callTool($,Z=r6,Y){if(this.isToolTaskRequired($.name))throw new l(d.InvalidRequest,`Tool "${$.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let Q=await this.request({method:"tools/call",params:$},Z,Y),W=this.getToolOutputValidator($.name);if(W){if(!Q.structuredContent&&!Q.isError)throw new l(d.InvalidRequest,`Tool ${$.name} has an output schema but did not return structured content`);if(Q.structuredContent)try{let J=W(Q.structuredContent);if(!J.valid)throw new l(d.InvalidParams,`Structured content does not match the tool's output schema: ${J.errorMessage}`)}catch(J){if(J instanceof l)throw J;throw new l(d.InvalidParams,`Failed to validate structured content: ${J instanceof Error?J.message:String(J)}`)}}return Q}isToolTask($){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has($)}isToolTaskRequired($){return this._cachedRequiredTaskTools.has($)}cacheToolMetadata($){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let Z of $){if(Z.outputSchema){let Q=this._jsonSchemaValidator.getValidator(Z.outputSchema);this._cachedToolOutputValidators.set(Z.name,Q)}let Y=Z.execution?.taskSupport;if(Y==="required"||Y==="optional")this._cachedKnownTaskTools.add(Z.name);if(Y==="required")this._cachedRequiredTaskTools.add(Z.name)}}getToolOutputValidator($){return this._cachedToolOutputValidators.get($)}async listTools($,Z){let Y=await this.request({method:"tools/list",params:$},i9,Z);return this.cacheToolMetadata(Y.tools),Y}_setupListChangedHandler($,Z,Y,Q){let W=vK.safeParse(Y);if(!W.success)throw Error(`Invalid ${$} listChanged options: ${W.error.message}`);if(typeof Y.onChanged!=="function")throw Error(`Invalid ${$} listChanged options: onChanged must be a function`);let{autoRefresh:J,debounceMs:G}=W.data,{onChanged:K}=Y,B=async()=>{if(!J){K(null,null);return}try{let V=await Q();K(null,V)}catch(V){let L=V instanceof Error?V:Error(String(V));K(L,null)}},D=()=>{if(G){let V=this._listChangedDebounceTimers.get($);if(V)clearTimeout(V);let L=setTimeout(B,G);this._listChangedDebounceTimers.set($,L)}else B()};this.setNotificationHandler(Z,D)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function a8($){if(!$)return{};if($ instanceof Headers)return Object.fromEntries($.entries());if(Array.isArray($))return Object.fromEntries($);return{...$}}function z5($=fetch,Z){if(!Z)return $;return async(Y,Q)=>{let W={...Z,...Q,headers:Q?.headers?{...a8(Z.headers),...a8(Q.headers)}:Z.headers};return $(Y,W)}}var ZW;ZW=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then(($)=>$.webcrypto);async function ub($){return(await ZW).getRandomValues(new Uint8Array($))}async function hb($){let Y=Math.pow(2,8)-Math.pow(2,8)%66,Q="";while(Q.length<$){let W=await ub($-Q.length);for(let J of W)if(J<Y)Q+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[J%66]}return Q}async function mb($){return await hb($)}async function lb($){let Z=await(await ZW).subtle.digest("SHA-256",new TextEncoder().encode($));return btoa(String.fromCharCode(...new Uint8Array(Z))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function YW($){if(!$)$=43;if($<43||$>128)throw`Expected a length between 43 and 128. Received ${$}.`;let Z=await mb($),Y=await lb(Z);return{code_verifier:Z,code_challenge:Y}}import*as P from"zod/v4";var g1=P.url().superRefine(($,Z)=>{if(!URL.canParse($))return Z.addIssue({code:P.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),P.NEVER}).refine(($)=>{let Z=new URL($);return Z.protocol!=="javascript:"&&Z.protocol!=="data:"&&Z.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),zV=P.looseObject({resource:P.string().url(),authorization_servers:P.array(g1).optional(),jwks_uri:P.string().url().optional(),scopes_supported:P.array(P.string()).optional(),bearer_methods_supported:P.array(P.string()).optional(),resource_signing_alg_values_supported:P.array(P.string()).optional(),resource_name:P.string().optional(),resource_documentation:P.string().optional(),resource_policy_uri:P.string().url().optional(),resource_tos_uri:P.string().url().optional(),tls_client_certificate_bound_access_tokens:P.boolean().optional(),authorization_details_types_supported:P.array(P.string()).optional(),dpop_signing_alg_values_supported:P.array(P.string()).optional(),dpop_bound_access_tokens_required:P.boolean().optional()}),QW=P.looseObject({issuer:P.string(),authorization_endpoint:g1,token_endpoint:g1,registration_endpoint:g1.optional(),scopes_supported:P.array(P.string()).optional(),response_types_supported:P.array(P.string()),response_modes_supported:P.array(P.string()).optional(),grant_types_supported:P.array(P.string()).optional(),token_endpoint_auth_methods_supported:P.array(P.string()).optional(),token_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),service_documentation:g1.optional(),revocation_endpoint:g1.optional(),revocation_endpoint_auth_methods_supported:P.array(P.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),introspection_endpoint:P.string().optional(),introspection_endpoint_auth_methods_supported:P.array(P.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),code_challenge_methods_supported:P.array(P.string()).optional(),client_id_metadata_document_supported:P.boolean().optional()}),pb=P.looseObject({issuer:P.string(),authorization_endpoint:g1,token_endpoint:g1,userinfo_endpoint:g1.optional(),jwks_uri:g1,registration_endpoint:g1.optional(),scopes_supported:P.array(P.string()).optional(),response_types_supported:P.array(P.string()),response_modes_supported:P.array(P.string()).optional(),grant_types_supported:P.array(P.string()).optional(),acr_values_supported:P.array(P.string()).optional(),subject_types_supported:P.array(P.string()),id_token_signing_alg_values_supported:P.array(P.string()),id_token_encryption_alg_values_supported:P.array(P.string()).optional(),id_token_encryption_enc_values_supported:P.array(P.string()).optional(),userinfo_signing_alg_values_supported:P.array(P.string()).optional(),userinfo_encryption_alg_values_supported:P.array(P.string()).optional(),userinfo_encryption_enc_values_supported:P.array(P.string()).optional(),request_object_signing_alg_values_supported:P.array(P.string()).optional(),request_object_encryption_alg_values_supported:P.array(P.string()).optional(),request_object_encryption_enc_values_supported:P.array(P.string()).optional(),token_endpoint_auth_methods_supported:P.array(P.string()).optional(),token_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),display_values_supported:P.array(P.string()).optional(),claim_types_supported:P.array(P.string()).optional(),claims_supported:P.array(P.string()).optional(),service_documentation:P.string().optional(),claims_locales_supported:P.array(P.string()).optional(),ui_locales_supported:P.array(P.string()).optional(),claims_parameter_supported:P.boolean().optional(),request_parameter_supported:P.boolean().optional(),request_uri_parameter_supported:P.boolean().optional(),require_request_uri_registration:P.boolean().optional(),op_policy_uri:g1.optional(),op_tos_uri:g1.optional(),client_id_metadata_document_supported:P.boolean().optional()}),OV=P.object({...pb.shape,...QW.pick({code_challenge_methods_supported:!0}).shape}),qV=P.object({access_token:P.string(),id_token:P.string().optional(),token_type:P.string(),expires_in:P.coerce.number().optional(),scope:P.string().optional(),refresh_token:P.string().optional()}).strip(),NV=P.object({error:P.string(),error_description:P.string().optional(),error_uri:P.string().optional()}),AV=g1.optional().or(P.literal("").transform(()=>{return})),ib=P.object({redirect_uris:P.array(g1),token_endpoint_auth_method:P.string().optional(),grant_types:P.array(P.string()).optional(),response_types:P.array(P.string()).optional(),client_name:P.string().optional(),client_uri:g1.optional(),logo_uri:AV,scope:P.string().optional(),contacts:P.array(P.string()).optional(),tos_uri:AV,policy_uri:P.string().optional(),jwks_uri:g1.optional(),jwks:P.any().optional(),software_id:P.string().optional(),software_version:P.string().optional(),software_statement:P.string().optional()}).strip(),cb=P.object({client_id:P.string(),client_secret:P.string().optional(),client_id_issued_at:P.number().optional(),client_secret_expires_at:P.number().optional()}).strip(),MV=ib.merge(cb),Vo=P.object({error:P.string(),error_description:P.string().optional()}).strip(),Lo=P.object({token:P.string(),token_type_hint:P.string().optional()}).strip();function PV($){let Z=typeof $==="string"?new URL($):new URL($.href);return Z.hash="",Z}function wV({requestedResource:$,configuredResource:Z}){let Y=typeof $==="string"?new URL($):new URL($.href),Q=typeof Z==="string"?new URL(Z):new URL(Z.href);if(Y.origin!==Q.origin)return!1;if(Y.pathname.length<Q.pathname.length)return!1;let W=Y.pathname.endsWith("/")?Y.pathname:Y.pathname+"/",J=Q.pathname.endsWith("/")?Q.pathname:Q.pathname+"/";return W.startsWith(J)}class R1 extends Error{constructor($,Z){super($);this.errorUri=Z,this.name=this.constructor.name}toResponseObject(){let $={error:this.errorCode,error_description:this.message};if(this.errorUri)$.error_uri=this.errorUri;return $}get errorCode(){return this.constructor.errorCode}}class O5 extends R1{}O5.errorCode="invalid_request";class o8 extends R1{}o8.errorCode="invalid_client";class s8 extends R1{}s8.errorCode="invalid_grant";class t8 extends R1{}t8.errorCode="unauthorized_client";class q5 extends R1{}q5.errorCode="unsupported_grant_type";class N5 extends R1{}N5.errorCode="invalid_scope";class M5 extends R1{}M5.errorCode="access_denied";class T6 extends R1{}T6.errorCode="server_error";class P5 extends R1{}P5.errorCode="temporarily_unavailable";class w5 extends R1{}w5.errorCode="unsupported_response_type";class E5 extends R1{}E5.errorCode="unsupported_token_type";class R5 extends R1{}R5.errorCode="invalid_token";class _5 extends R1{}_5.errorCode="method_not_allowed";class C5 extends R1{}C5.errorCode="too_many_requests";class e8 extends R1{}e8.errorCode="invalid_client_metadata";class I5 extends R1{}I5.errorCode="insufficient_scope";class f5 extends R1{}f5.errorCode="invalid_target";var EV={[O5.errorCode]:O5,[o8.errorCode]:o8,[s8.errorCode]:s8,[t8.errorCode]:t8,[q5.errorCode]:q5,[N5.errorCode]:N5,[M5.errorCode]:M5,[T6.errorCode]:T6,[P5.errorCode]:P5,[w5.errorCode]:w5,[E5.errorCode]:E5,[R5.errorCode]:R5,[_5.errorCode]:_5,[C5.errorCode]:C5,[e8.errorCode]:e8,[I5.errorCode]:I5,[f5.errorCode]:f5};class e1 extends Error{constructor($){super($??"Unauthorized")}}function db($){return["client_secret_basic","client_secret_post","none"].includes($)}var XW="code",WW="S256";function nb($,Z){let Y=$.client_secret!==void 0;if("token_endpoint_auth_method"in $&&$.token_endpoint_auth_method&&db($.token_endpoint_auth_method)&&(Z.length===0||Z.includes($.token_endpoint_auth_method)))return $.token_endpoint_auth_method;if(Z.length===0)return Y?"client_secret_basic":"none";if(Y&&Z.includes("client_secret_basic"))return"client_secret_basic";if(Y&&Z.includes("client_secret_post"))return"client_secret_post";if(Z.includes("none"))return"none";return Y?"client_secret_post":"none"}function rb($,Z,Y,Q){let{client_id:W,client_secret:J}=Z;switch($){case"client_secret_basic":ab(W,J,Y);return;case"client_secret_post":ob(W,J,Q);return;case"none":sb(W,Q);return;default:throw Error(`Unsupported client authentication method: ${$}`)}}function ab($,Z,Y){if(!Z)throw Error("client_secret_basic authentication requires a client_secret");let Q=btoa(`${$}:${Z}`);Y.set("Authorization",`Basic ${Q}`)}function ob($,Z,Y){if(Y.set("client_id",$),Z)Y.set("client_secret",Z)}function sb($,Z){Z.set("client_id",$)}async function _V($){let Z=$ instanceof Response?$.status:void 0,Y=$ instanceof Response?await $.text():$;try{let Q=NV.parse(JSON.parse(Y)),{error:W,error_description:J,error_uri:G}=Q;return new(EV[W]||T6)(J||"",G)}catch(Q){let W=`${Z?`HTTP ${Z}: `:""}Invalid OAuth error response: ${Q}. Raw body: ${Y}`;return new T6(W)}}async function p0($,Z){try{return await JW($,Z)}catch(Y){if(Y instanceof o8||Y instanceof t8)return await $.invalidateCredentials?.("all"),await JW($,Z);else if(Y instanceof s8)return await $.invalidateCredentials?.("tokens"),await JW($,Z);throw Y}}async function JW($,{serverUrl:Z,authorizationCode:Y,scope:Q,resourceMetadataUrl:W,fetchFn:J}){let G=await $.discoveryState?.(),K,B,D,V=W;if(!V&&G?.resourceMetadataUrl)V=new URL(G.resourceMetadataUrl);if(G?.authorizationServerUrl){if(B=G.authorizationServerUrl,K=G.resourceMetadata,D=G.authorizationServerMetadata??await BW(B,{fetchFn:J}),!K)try{K=await KW(Z,{resourceMetadataUrl:V},J)}catch{}if(D!==G.authorizationServerMetadata||K!==G.resourceMetadata)await $.saveDiscoveryState?.({authorizationServerUrl:String(B),resourceMetadataUrl:V?.toString(),resourceMetadata:K,authorizationServerMetadata:D})}else{let f=await Xv(Z,{resourceMetadataUrl:V,fetchFn:J});B=f.authorizationServerUrl,D=f.authorizationServerMetadata,K=f.resourceMetadata,await $.saveDiscoveryState?.({authorizationServerUrl:String(B),resourceMetadataUrl:V?.toString(),resourceMetadata:K,authorizationServerMetadata:D})}let L=await eb(Z,$,K),A=Q||K?.scopes_supported?.join(" ")||$.clientMetadata.scope,O=await Promise.resolve($.clientInformation());if(!O){if(Y!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let f=D?.client_id_metadata_document_supported===!0,v=$.clientMetadataUrl;if(v&&!tb(v))throw new e8(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(f&&v)O={client_id:v},await $.saveClientInformation?.(O);else{if(!$.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let $1=await Hv(B,{metadata:D,clientMetadata:$.clientMetadata,scope:A,fetchFn:J});await $.saveClientInformation($1),O=$1}}let q=!$.redirectUrl;if(Y!==void 0||q){let f=await Kv($,B,{metadata:D,resource:L,authorizationCode:Y,fetchFn:J});return await $.saveTokens(f),"AUTHORIZED"}let M=await $.tokens();if(M?.refresh_token)try{let f=await Gv(B,{metadata:D,clientInformation:O,refreshToken:M.refresh_token,resource:L,addClientAuthentication:$.addClientAuthentication,fetchFn:J});return await $.saveTokens(f),"AUTHORIZED"}catch(f){if(!(f instanceof R1)||f instanceof T6);else throw f}let I=$.state?await $.state():void 0,{authorizationUrl:N,codeVerifier:E}=await Wv(B,{metadata:D,clientInformation:O,state:I,redirectUrl:$.redirectUrl,scope:A,resource:L});return await $.saveCodeVerifier(E),await $.redirectToAuthorization(N),"REDIRECT"}function tb($){if(!$)return!1;try{let Z=new URL($);return Z.protocol==="https:"&&Z.pathname!=="/"}catch{return!1}}async function eb($,Z,Y){let Q=PV($);if(Z.validateResourceURL)return await Z.validateResourceURL(Q,Y?.resource);if(!Y)return;if(!wV({requestedResource:Q,configuredResource:Y.resource}))throw Error(`Protected resource ${Y.resource} does not match expected ${Q} (or origin)`);return new URL(Y.resource)}function $9($){let Z=$.headers.get("WWW-Authenticate");if(!Z)return{};let[Y,Q]=Z.split(" ");if(Y.toLowerCase()!=="bearer"||!Q)return{};let W=GW($,"resource_metadata")||void 0,J;if(W)try{J=new URL(W)}catch{}let G=GW($,"scope")||void 0,K=GW($,"error")||void 0;return{resourceMetadataUrl:J,scope:G,error:K}}function GW($,Z){let Y=$.headers.get("WWW-Authenticate");if(!Y)return null;let Q=new RegExp(`${Z}=(?:"([^"]+)"|([^\\s,]+))`),W=Y.match(Q);if(W)return W[1]||W[2];return null}async function KW($,Z,Y=fetch){let Q=await Yv($,"oauth-protected-resource",Y,{protocolVersion:Z?.protocolVersion,metadataUrl:Z?.resourceMetadataUrl});if(!Q||Q.status===404)throw await Q?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!Q.ok)throw await Q.body?.cancel(),Error(`HTTP ${Q.status} trying to load well-known OAuth protected resource metadata.`);return zV.parse(await Q.json())}async function HW($,Z,Y=fetch){try{return await Y($,{headers:Z})}catch(Q){if(Q instanceof TypeError)if(Z)return HW($,void 0,Y);else return;throw Q}}function $v($,Z="",Y={}){if(Z.endsWith("/"))Z=Z.slice(0,-1);return Y.prependPathname?`${Z}/.well-known/${$}`:`/.well-known/${$}${Z}`}async function RV($,Z,Y=fetch){return await HW($,{"MCP-Protocol-Version":Z},Y)}function Zv($,Z){return!$||$.status>=400&&$.status<500&&Z!=="/"}async function Yv($,Z,Y,Q){let W=new URL($),J=Q?.protocolVersion??d6,G;if(Q?.metadataUrl)G=new URL(Q.metadataUrl);else{let B=$v(Z,W.pathname);G=new URL(B,Q?.metadataServerUrl??W),G.search=W.search}let K=await RV(G,J,Y);if(!Q?.metadataUrl&&Zv(K,W.pathname)){let B=new URL(`/.well-known/${Z}`,W);K=await RV(B,J,Y)}return K}function Qv($){let Z=typeof $==="string"?new URL($):$,Y=Z.pathname!=="/",Q=[];if(!Y)return Q.push({url:new URL("/.well-known/oauth-authorization-server",Z.origin),type:"oauth"}),Q.push({url:new URL("/.well-known/openid-configuration",Z.origin),type:"oidc"}),Q;let W=Z.pathname;if(W.endsWith("/"))W=W.slice(0,-1);return Q.push({url:new URL(`/.well-known/oauth-authorization-server${W}`,Z.origin),type:"oauth"}),Q.push({url:new URL(`/.well-known/openid-configuration${W}`,Z.origin),type:"oidc"}),Q.push({url:new URL(`${W}/.well-known/openid-configuration`,Z.origin),type:"oidc"}),Q}async function BW($,{fetchFn:Z=fetch,protocolVersion:Y=d6}={}){let Q={"MCP-Protocol-Version":Y,Accept:"application/json"},W=Qv($);for(let{url:J,type:G}of W){let K=await HW(J,Q,Z);if(!K)continue;if(!K.ok){if(await K.body?.cancel(),K.status>=400&&K.status<500)continue;throw Error(`HTTP ${K.status} trying to load ${G==="oauth"?"OAuth":"OpenID provider"} metadata from ${J}`)}if(G==="oauth")return QW.parse(await K.json());else return OV.parse(await K.json())}return}async function Xv($,Z){let Y,Q;try{if(Y=await KW($,{resourceMetadataUrl:Z?.resourceMetadataUrl},Z?.fetchFn),Y.authorization_servers&&Y.authorization_servers.length>0)Q=Y.authorization_servers[0]}catch{}if(!Q)Q=String(new URL("/",$));let W=await BW(Q,{fetchFn:Z?.fetchFn});return{authorizationServerUrl:Q,authorizationServerMetadata:W,resourceMetadata:Y}}async function Wv($,{metadata:Z,clientInformation:Y,redirectUrl:Q,scope:W,state:J,resource:G}){let K;if(Z){if(K=new URL(Z.authorization_endpoint),!Z.response_types_supported.includes(XW))throw Error(`Incompatible auth server: does not support response type ${XW}`);if(Z.code_challenge_methods_supported&&!Z.code_challenge_methods_supported.includes(WW))throw Error(`Incompatible auth server: does not support code challenge method ${WW}`)}else K=new URL("/authorize",$);let B=await YW(),D=B.code_verifier,V=B.code_challenge;if(K.searchParams.set("response_type",XW),K.searchParams.set("client_id",Y.client_id),K.searchParams.set("code_challenge",V),K.searchParams.set("code_challenge_method",WW),K.searchParams.set("redirect_uri",String(Q)),J)K.searchParams.set("state",J);if(W)K.searchParams.set("scope",W);if(W?.includes("offline_access"))K.searchParams.append("prompt","consent");if(G)K.searchParams.set("resource",G.href);return{authorizationUrl:K,codeVerifier:D}}function Jv($,Z,Y){return new URLSearchParams({grant_type:"authorization_code",code:$,code_verifier:Z,redirect_uri:String(Y)})}async function CV($,{metadata:Z,tokenRequestParams:Y,clientInformation:Q,addClientAuthentication:W,resource:J,fetchFn:G}){let K=Z?.token_endpoint?new URL(Z.token_endpoint):new URL("/token",$),B=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(J)Y.set("resource",J.href);if(W)await W(B,Y,K,Z);else if(Q){let V=Z?.token_endpoint_auth_methods_supported??[],L=nb(Q,V);rb(L,Q,B,Y)}let D=await(G??fetch)(K,{method:"POST",headers:B,body:Y});if(!D.ok)throw await _V(D);return qV.parse(await D.json())}async function Gv($,{metadata:Z,clientInformation:Y,refreshToken:Q,resource:W,addClientAuthentication:J,fetchFn:G}){let K=new URLSearchParams({grant_type:"refresh_token",refresh_token:Q}),B=await CV($,{metadata:Z,tokenRequestParams:K,clientInformation:Y,addClientAuthentication:J,resource:W,fetchFn:G});return{refresh_token:Q,...B}}async function Kv($,Z,{metadata:Y,resource:Q,authorizationCode:W,fetchFn:J}={}){let G=$.clientMetadata.scope,K;if($.prepareTokenRequest)K=await $.prepareTokenRequest(G);if(!K){if(!W)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!$.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let D=await $.codeVerifier();K=Jv(W,D,$.redirectUrl)}let B=await $.clientInformation();return CV(Z,{metadata:Y,tokenRequestParams:K,clientInformation:B??void 0,addClientAuthentication:$.addClientAuthentication,resource:Q,fetchFn:J})}async function Hv($,{metadata:Z,clientMetadata:Y,scope:Q,fetchFn:W}){let J;if(Z){if(!Z.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");J=new URL(Z.registration_endpoint)}else J=new URL("/register",$);let G=await(W??fetch)(J,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...Y,...Q!==void 0?{scope:Q}:{}})});if(!G.ok)throw await _V(G);return MV.parse(await G.json())}class DW extends Error{constructor($,Z){super($),this.name="ParseError",this.type=Z.type,this.field=Z.field,this.value=Z.value,this.line=Z.line}}var IV=10,Bv=13,Z8=32;function FW($){}function S5($){if(typeof $=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:Z=FW,onError:Y=FW,onRetry:Q=FW,onComment:W}=$,J=[],G=!0,K,B="",D=0,V;function L(N){if(G&&(G=!1,N.charCodeAt(0)===239&&N.charCodeAt(1)===187&&N.charCodeAt(2)===191&&(N=N.slice(3))),J.length===0){let v=A(N);v!==""&&J.push(v);return}if(N.indexOf(`
|
|
942
|
+
`;await AM(G,B,{mode:384}),await jM(G,K)}}import{ExportResultCode as Al}from"@opentelemetry/core";import{AggregationTemporality as Ol,DataPointType as ql}from"@opentelemetry/sdk-metrics";import{ExportResultCode as Rl}from"@opentelemetry/core";var fl=Buffer.byteLength("... [TRUNCATED]","utf8");import{BatchLogRecordProcessor as qp,LoggerProvider as Np}from"@opentelemetry/sdk-logs";import{detectResources as Pp,envDetector as wp,hostDetector as Ep,osDetector as Rp,processDetector as _p,resourceFromAttributes as Cp}from"@opentelemetry/resources";import{PeriodicExportingMetricReader as fp}from"@opentelemetry/sdk-metrics";import{NOOP_LOGGER as vl}from"@opentelemetry/api-logs";import{NodeSDK as vp}from"@opentelemetry/sdk-node";import{BatchSpanProcessor as Tp,SamplingDecision as b8}from"@opentelemetry/sdk-trace-base";import{SpanStatusCode as gl}from"@opentelemetry/api";var EM="__d",RM=qM("Current request"),_M=1;var QK=($)=>{let Y=new URL($.url).searchParams.get(EM);if(Y==="")return crypto.randomUUID();if(!Y)Y=$.headers.get("x-trace-debug-id");return Y};class XK{inner;constructor($){this.inner=$}shouldSample($,Z,Y,Q,W,J){let G=$.getValue(RM);if(!G){if(this.inner)return this.inner.shouldSample($,Z,Y,Q,W,J);return{decision:b8.RECORD_AND_SAMPLED}}let K=QK(G);if(K)return{decision:b8.RECORD_AND_SAMPLED,attributes:{"trace.debug.id":K}};if(this.inner){let B=this.inner.shouldSample($,Z,Y,Q,W,J);if(B.decision===b8.RECORD_AND_SAMPLED){let D=crypto.randomUUID();B.attributes={...B.attributes??{},"trace.debug.id":D}}return B}return{decision:b8.NOT_RECORD}}toString(){return"DebugSampler"}}class WK{ratio;constructor($){this.ratio=$}shouldSample(){if(Math.random()<this.ratio)return{decision:b8.RECORD_AND_SAMPLED};return{decision:b8.NOT_RECORD}}toString(){return`RatioSampler(${this.ratio})`}}var xp=new wM({preventServerStart:!0}),gp=new XK(new WK(_M));var YK=MM.getTracer("studio","1.0.0"),V4=NM.getMeter("studio","1.0.0"),CM=PM.getLogger("studio","1.0.0"),KQ=($,Z,Y)=>{let Q={},W=Y,J=Y[Y.length-1];if(J!==null&&typeof J==="object"&&!Array.isArray(J)&&!(J instanceof Error)&&Object.getPrototypeOf(J)===Object.prototype)Q=J,W=Y.slice(0,-1);let G=W.map((K)=>{if(K instanceof Error)return`${K.name}: ${K.message}`;if(typeof K==="object")try{return JSON.stringify(K)}catch{return"[Object]"}return String(K)}).join(" ");CM.emit({severityNumber:$,severityText:Z,body:G,attributes:{"log.source":"console",...Q}})},HQ={error:console.error.bind(console),warn:console.warn.bind(console),debug:console.debug.bind(console)};console.error=(...$)=>{KQ(GQ.ERROR,"ERROR",$),HQ.error(...$)};console.warn=(...$)=>{KQ(GQ.WARN,"WARN",$),HQ.warn(...$)};console.debug=(...$)=>{KQ(GQ.DEBUG,"DEBUG",$),HQ.debug(...$)};var BQ,JK=0,FQ=500;function IM(){if(BQ)return;let $=performance.now()+FQ;BQ=setInterval(()=>{let Z=performance.now();JK=Math.max(0,Z-$),$=Z+FQ},FQ),BQ.unref?.()}function GK(){return IM(),JK}var SM=()=>V4.createHistogram("db.query.duration",{description:"Database query execution duration in milliseconds",unit:"ms"}),KK=()=>V4.createHistogram("db.pool.acquire.duration",{description:"Time spent waiting to acquire a connection from the pool",unit:"ms"}),HK=400,bM=100,vM=($)=>(Z)=>{let Y={"db.statement":Z.query.sql,"db.status":Z.level==="error"?"error":"success"};if(Z.queryDurationMillis>HK){let Q=GK(),W=Q>HK/2;console.error(W?"Slow query measurement \u2014 likely event-loop lag, not slow SQL:":"Slow query detected:",{durationMs:Z.queryDurationMillis,eventLoopLagMs:Math.round(Q),sql:Z.query.sql,pool:{total:$.totalCount,idle:$.idleCount,waiting:$.waitingCount,max:L4()}})}if(SM().record(Z.queryDurationMillis,Y),Z.level==="error")console.error("Query failed:",{durationMs:Z.queryDurationMillis,error:Z.error,sql:Z.query.sql})};function yM($){let Z=$.connect.bind($);return $.connect=(Y)=>{if(typeof Y==="function")return Z(Y);let Q=performance.now(),W=L4(),J=$.idleCount===0&&$.totalCount>=W,G=$.idleCount;return Z().then((K)=>{let B=performance.now()-Q;if(KK().record(B,{"db.pool.outcome":J?"contended":"available"}),B>bM)if(J)console.error("Slow pool acquire \u2014 pool saturated:",{waitMs:B,total:$.totalCount,idle:$.idleCount,waiting:$.waitingCount,max:W});else console.warn("Slow pool acquire \u2014 event-loop lag (not pool):",{waitMs:B,idleAtStart:G,total:$.totalCount,max:W});return K},(K)=>{throw KK().record(performance.now()-Q,{"db.pool.outcome":"error"}),K})},$}var DK={keepAlive:!0,keepAliveInitialDelayMillis:1e4,idleTimeoutMillis:300000,connectionTimeoutMillis:30000,allowExitOnIdle:!0};function VK(){try{return S8().databasePgSsl}catch{return!1}}function L4(){try{return S8().databasePoolMax}catch{return 10}}function TM($){let Z=yM(new FK({connectionString:$,max:L4(),ssl:VK(),...DK})),Y=new BK({pool:Z});return{type:"postgres",db:new fM({dialect:Y,log:vM(Z)}),pool:Z}}function T9(){return S8().databaseUrl}function LK($){let Z=$||T9();return new BK({pool:new FK({connectionString:Z,max:L4(),ssl:VK(),...DK})})}function kM($){let Z=$||T9();return TM(Z)}async function UK($){if(await $.db.destroy(),!$.pool.ended)await $.pool.end();if($===y9)y9=null}var y9=null;function DQ(){if(!y9)y9=kM(T9());return y9}async function jK($){let Y={database:LK($||T9()),plugins:[uM({dynamicAccessControl:{enabled:!0,enableCustomResources:!0}}),hM(),mM(),lM(),cM(),iM({loginPage:"/login"}),gM(),pM({sendMagicLink:async()=>{}}),dM({sendVerificationOTP:async()=>{}})]},{toBeAdded:Q,toBeCreated:W,runMigrations:J}=await xM(Y);if(!Q.length&&!W.length)return"up to date";return await J(),`${W.length+Q.length} table(s) migrated`}import{createContext as nM,useContext as Ji}from"react";import{jsx as Hi}from"react/jsx-runtime";var Gi=nM(void 0);import $6 from"react";import Ui from"react-dom";function tM($){if(!$||typeof document>"u")return;let Z=document.head||document.getElementsByTagName("head")[0],Y=document.createElement("style");Y.type="text/css",Z.appendChild(Y),Y.styleSheet?Y.styleSheet.cssText=$:Y.appendChild(document.createTextNode($))}var ji=Array(12).fill(0);var LQ=1;class AK{constructor(){this.subscribe=($)=>{return this.subscribers.push($),()=>{let Z=this.subscribers.indexOf($);this.subscribers.splice(Z,1)}},this.publish=($)=>{this.subscribers.forEach((Z)=>Z($))},this.addToast=($)=>{this.publish($),this.toasts=[...this.toasts,$]},this.create=($)=>{var Z;let{message:Y,...Q}=$,W=typeof($==null?void 0:$.id)==="number"||((Z=$.id)==null?void 0:Z.length)>0?$.id:LQ++,J=this.toasts.find((K)=>{return K.id===W}),G=$.dismissible===void 0?!0:$.dismissible;if(this.dismissedToasts.has(W))this.dismissedToasts.delete(W);if(J)this.toasts=this.toasts.map((K)=>{if(K.id===W)return this.publish({...K,...$,id:W,title:Y}),{...K,...$,id:W,dismissible:G,title:Y};return K});else this.addToast({title:Y,...Q,dismissible:G,id:W});return W},this.dismiss=($)=>{if($)this.dismissedToasts.add($),requestAnimationFrame(()=>this.subscribers.forEach((Z)=>Z({id:$,dismiss:!0})));else this.toasts.forEach((Z)=>{this.subscribers.forEach((Y)=>Y({id:Z.id,dismiss:!0}))});return $},this.message=($,Z)=>{return this.create({...Z,message:$})},this.error=($,Z)=>{return this.create({...Z,message:$,type:"error"})},this.success=($,Z)=>{return this.create({...Z,type:"success",message:$})},this.info=($,Z)=>{return this.create({...Z,type:"info",message:$})},this.warning=($,Z)=>{return this.create({...Z,type:"warning",message:$})},this.loading=($,Z)=>{return this.create({...Z,type:"loading",message:$})},this.promise=($,Z)=>{if(!Z)return;let Y=void 0;if(Z.loading!==void 0)Y=this.create({...Z,promise:$,type:"loading",message:Z.loading,description:typeof Z.description!=="function"?Z.description:void 0});let Q=Promise.resolve($ instanceof Function?$():$),W=Y!==void 0,J,G=Q.then(async(B)=>{if(J=["resolve",B],$6.isValidElement(B))W=!1,this.create({id:Y,type:"default",message:B});else if($P(B)&&!B.ok){W=!1;let V=typeof Z.error==="function"?await Z.error(`HTTP error! status: ${B.status}`):Z.error,L=typeof Z.description==="function"?await Z.description(`HTTP error! status: ${B.status}`):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"error",description:L,...O})}else if(B instanceof Error){W=!1;let V=typeof Z.error==="function"?await Z.error(B):Z.error,L=typeof Z.description==="function"?await Z.description(B):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"error",description:L,...O})}else if(Z.success!==void 0){W=!1;let V=typeof Z.success==="function"?await Z.success(B):Z.success,L=typeof Z.description==="function"?await Z.description(B):Z.description,O=typeof V==="object"&&!$6.isValidElement(V)?V:{message:V};this.create({id:Y,type:"success",description:L,...O})}}).catch(async(B)=>{if(J=["reject",B],Z.error!==void 0){W=!1;let D=typeof Z.error==="function"?await Z.error(B):Z.error,V=typeof Z.description==="function"?await Z.description(B):Z.description,A=typeof D==="object"&&!$6.isValidElement(D)?D:{message:D};this.create({id:Y,type:"error",description:V,...A})}}).finally(()=>{if(W)this.dismiss(Y),Y=void 0;Z.finally==null||Z.finally.call(Z)}),K=()=>new Promise((B,D)=>G.then(()=>J[0]==="reject"?D(J[1]):B(J[1])).catch(D));if(typeof Y!=="string"&&typeof Y!=="number")return{unwrap:K};else return Object.assign(Y,{unwrap:K})},this.custom=($,Z)=>{let Y=(Z==null?void 0:Z.id)||LQ++;return this.create({jsx:$(Y),id:Y,...Z}),Y},this.getActiveToasts=()=>{return this.toasts.filter(($)=>!this.dismissedToasts.has($.id))},this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}var V0=new AK,eM=($,Z)=>{let Y=(Z==null?void 0:Z.id)||LQ++;return V0.addToast({title:$,...Z,id:Y}),Y},$P=($)=>{return $&&typeof $==="object"&&"ok"in $&&typeof $.ok==="boolean"&&"status"in $&&typeof $.status==="number"},ZP=eM,YP=()=>V0.toasts,QP=()=>V0.getActiveToasts(),XP=Object.assign(ZP,{success:V0.success,info:V0.info,warning:V0.warning,error:V0.error,custom:V0.custom,message:V0.message,promise:V0.promise,dismiss:V0.dismiss,loading:V0.loading},{getHistory:YP,getToasts:QP});tM("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");import*as WP from"zod/v3";import*as U4 from"zod/v4-mini";function c6($){return!!$._zod}function L0($,Z){if(c6($))return U4.safeParse($,Z);return $.safeParse(Z)}function y8($){if(!$)return;let Z;if(c6($))Z=$._zod?.def?.shape;else Z=$.shape;if(!Z)return;if(typeof Z==="function")try{return Z()}catch{return}return Z}function UQ($){if(c6($)){let J=$._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=$._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let Q=$.value;if(Q!==void 0)return Q;return}import*as F from"zod/v4";var d6="2025-11-25";var jQ=[d6,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],P6="io.modelcontextprotocol/related-task",A4="2.0",C1=F.custom(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),zK=F.union([F.string(),F.number().int()]),OK=F.string(),Pi=F.looseObject({ttl:F.number().optional(),pollInterval:F.number().optional()}),JP=F.object({ttl:F.number().optional()}),GP=F.object({taskId:F.string()}),AQ=F.looseObject({progressToken:zK.optional(),[P6]:GP.optional()}),J0=F.object({_meta:AQ.optional()}),k9=J0.extend({task:JP.optional()}),qK=($)=>k9.safeParse($).success,y1=F.object({method:F.string(),params:J0.loose().optional()}),U0=F.object({_meta:AQ.optional()}),j0=F.object({method:F.string(),params:U0.loose().optional()}),T1=F.looseObject({_meta:AQ.optional()}),z4=F.union([F.string(),F.number().int()]),NK=F.object({jsonrpc:F.literal(A4),id:z4,...y1.shape}).strict(),x9=($)=>NK.safeParse($).success,MK=F.object({jsonrpc:F.literal(A4),...j0.shape}).strict(),PK=($)=>MK.safeParse($).success,zQ=F.object({jsonrpc:F.literal(A4),id:z4,result:T1}).strict(),n6=($)=>zQ.safeParse($).success;var d;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(d||(d={}));var OQ=F.object({jsonrpc:F.literal(A4),id:z4.optional(),error:F.object({code:F.number().int(),message:F.string(),data:F.unknown().optional()})}).strict();var wK=($)=>OQ.safeParse($).success;var w6=F.union([NK,MK,zQ,OQ]),wi=F.union([zQ,OQ]),E6=T1.strict(),KP=U0.extend({requestId:z4.optional(),reason:F.string().optional()}),O4=j0.extend({method:F.literal("notifications/cancelled"),params:KP}),HP=F.object({src:F.string(),mimeType:F.string().optional(),sizes:F.array(F.string()).optional(),theme:F.enum(["light","dark"]).optional()}),g9=F.object({icons:F.array(HP).optional()}),T8=F.object({name:F.string(),title:F.string().optional()}),EK=T8.extend({...T8.shape,...g9.shape,version:F.string(),websiteUrl:F.string().optional(),description:F.string().optional()}),BP=F.intersection(F.object({applyDefaults:F.boolean().optional()}),F.record(F.string(),F.unknown())),FP=F.preprocess(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},F.intersection(F.object({form:BP.optional(),url:C1.optional()}),F.record(F.string(),F.unknown()).optional())),DP=F.looseObject({list:C1.optional(),cancel:C1.optional(),requests:F.looseObject({sampling:F.looseObject({createMessage:C1.optional()}).optional(),elicitation:F.looseObject({create:C1.optional()}).optional()}).optional()}),VP=F.looseObject({list:C1.optional(),cancel:C1.optional(),requests:F.looseObject({tools:F.looseObject({call:C1.optional()}).optional()}).optional()}),LP=F.object({experimental:F.record(F.string(),C1).optional(),sampling:F.object({context:C1.optional(),tools:C1.optional()}).optional(),elicitation:FP.optional(),roots:F.object({listChanged:F.boolean().optional()}).optional(),tasks:DP.optional(),extensions:F.record(F.string(),C1).optional()}),UP=J0.extend({protocolVersion:F.string(),capabilities:LP,clientInfo:EK}),RK=y1.extend({method:F.literal("initialize"),params:UP});var jP=F.object({experimental:F.record(F.string(),C1).optional(),logging:C1.optional(),completions:C1.optional(),prompts:F.object({listChanged:F.boolean().optional()}).optional(),resources:F.object({subscribe:F.boolean().optional(),listChanged:F.boolean().optional()}).optional(),tools:F.object({listChanged:F.boolean().optional()}).optional(),tasks:VP.optional(),extensions:F.record(F.string(),C1).optional()}),qQ=T1.extend({protocolVersion:F.string(),capabilities:jP,serverInfo:EK,instructions:F.string().optional()}),NQ=j0.extend({method:F.literal("notifications/initialized"),params:U0.optional()}),_K=($)=>NQ.safeParse($).success,q4=y1.extend({method:F.literal("ping"),params:J0.optional()}),AP=F.object({progress:F.number(),total:F.optional(F.number()),message:F.optional(F.string())}),zP=F.object({...U0.shape,...AP.shape,progressToken:zK}),N4=j0.extend({method:F.literal("notifications/progress"),params:zP}),OP=J0.extend({cursor:OK.optional()}),u9=y1.extend({params:OP.optional()}),h9=T1.extend({nextCursor:OK.optional()}),qP=F.enum(["working","input_required","completed","failed","cancelled"]),m9=F.object({taskId:F.string(),status:qP,ttl:F.union([F.number(),F.null()]),createdAt:F.string(),lastUpdatedAt:F.string(),pollInterval:F.optional(F.number()),statusMessage:F.optional(F.string())}),R6=T1.extend({task:m9}),NP=U0.merge(m9),l9=j0.extend({method:F.literal("notifications/tasks/status"),params:NP}),M4=y1.extend({method:F.literal("tasks/get"),params:J0.extend({taskId:F.string()})}),P4=T1.merge(m9),w4=y1.extend({method:F.literal("tasks/result"),params:J0.extend({taskId:F.string()})}),Ei=T1.loose(),E4=u9.extend({method:F.literal("tasks/list")}),R4=h9.extend({tasks:F.array(m9)}),_4=y1.extend({method:F.literal("tasks/cancel"),params:J0.extend({taskId:F.string()})}),CK=T1.merge(m9),IK=F.object({uri:F.string(),mimeType:F.optional(F.string()),_meta:F.record(F.string(),F.unknown()).optional()}),fK=IK.extend({text:F.string()}),MQ=F.string().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),SK=IK.extend({blob:MQ}),p9=F.enum(["user","assistant"]),k8=F.object({audience:F.array(p9).optional(),priority:F.number().min(0).max(1).optional(),lastModified:F.iso.datetime({offset:!0}).optional()}),bK=F.object({...T8.shape,...g9.shape,uri:F.string(),description:F.optional(F.string()),mimeType:F.optional(F.string()),size:F.optional(F.number()),annotations:k8.optional(),_meta:F.optional(F.looseObject({}))}),MP=F.object({...T8.shape,...g9.shape,uriTemplate:F.string(),description:F.optional(F.string()),mimeType:F.optional(F.string()),annotations:k8.optional(),_meta:F.optional(F.looseObject({}))}),PQ=u9.extend({method:F.literal("resources/list")}),wQ=h9.extend({resources:F.array(bK)}),EQ=u9.extend({method:F.literal("resources/templates/list")}),RQ=h9.extend({resourceTemplates:F.array(MP)}),_Q=J0.extend({uri:F.string()}),PP=_Q,CQ=y1.extend({method:F.literal("resources/read"),params:PP}),IQ=T1.extend({contents:F.array(F.union([fK,SK]))}),fQ=j0.extend({method:F.literal("notifications/resources/list_changed"),params:U0.optional()}),wP=_Q,EP=y1.extend({method:F.literal("resources/subscribe"),params:wP}),RP=_Q,_P=y1.extend({method:F.literal("resources/unsubscribe"),params:RP}),CP=U0.extend({uri:F.string()}),IP=j0.extend({method:F.literal("notifications/resources/updated"),params:CP}),fP=F.object({name:F.string(),description:F.optional(F.string()),required:F.optional(F.boolean())}),SP=F.object({...T8.shape,...g9.shape,description:F.optional(F.string()),arguments:F.optional(F.array(fP)),_meta:F.optional(F.looseObject({}))}),SQ=u9.extend({method:F.literal("prompts/list")}),bQ=h9.extend({prompts:F.array(SP)}),bP=J0.extend({name:F.string(),arguments:F.record(F.string(),F.string()).optional()}),vQ=y1.extend({method:F.literal("prompts/get"),params:bP}),yQ=F.object({type:F.literal("text"),text:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),TQ=F.object({type:F.literal("image"),data:MQ,mimeType:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),kQ=F.object({type:F.literal("audio"),data:MQ,mimeType:F.string(),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),vP=F.object({type:F.literal("tool_use"),name:F.string(),id:F.string(),input:F.record(F.string(),F.unknown()),_meta:F.record(F.string(),F.unknown()).optional()}),yP=F.object({type:F.literal("resource"),resource:F.union([fK,SK]),annotations:k8.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),TP=bK.extend({type:F.literal("resource_link")}),xQ=F.union([yQ,TQ,kQ,TP,yP]),kP=F.object({role:p9,content:xQ}),gQ=T1.extend({description:F.string().optional(),messages:F.array(kP)}),uQ=j0.extend({method:F.literal("notifications/prompts/list_changed"),params:U0.optional()}),xP=F.object({title:F.string().optional(),readOnlyHint:F.boolean().optional(),destructiveHint:F.boolean().optional(),idempotentHint:F.boolean().optional(),openWorldHint:F.boolean().optional()}),gP=F.object({taskSupport:F.enum(["required","optional","forbidden"]).optional()}),C4=F.object({...T8.shape,...g9.shape,description:F.string().optional(),inputSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),C1).optional(),required:F.array(F.string()).optional()}).catchall(F.unknown()),outputSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),C1).optional(),required:F.array(F.string()).optional()}).catchall(F.unknown()).optional(),annotations:xP.optional(),execution:gP.optional(),_meta:F.record(F.string(),F.unknown()).optional()}),hQ=u9.extend({method:F.literal("tools/list")}),i9=h9.extend({tools:F.array(C4)}),r6=T1.extend({content:F.array(xQ).default([]),structuredContent:F.record(F.string(),F.unknown()).optional(),isError:F.boolean().optional()}),Ri=r6.or(T1.extend({toolResult:F.unknown()})),uP=k9.extend({name:F.string(),arguments:F.record(F.string(),F.unknown()).optional()}),I4=y1.extend({method:F.literal("tools/call"),params:uP}),mQ=j0.extend({method:F.literal("notifications/tools/list_changed"),params:U0.optional()}),vK=F.object({autoRefresh:F.boolean().default(!0),debounceMs:F.number().int().nonnegative().default(300)}),lQ=F.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),hP=J0.extend({level:lQ}),yK=y1.extend({method:F.literal("logging/setLevel"),params:hP}),mP=U0.extend({level:lQ,logger:F.string().optional(),data:F.unknown()}),lP=j0.extend({method:F.literal("notifications/message"),params:mP}),pP=F.object({name:F.string().optional()}),iP=F.object({hints:F.array(pP).optional(),costPriority:F.number().min(0).max(1).optional(),speedPriority:F.number().min(0).max(1).optional(),intelligencePriority:F.number().min(0).max(1).optional()}),cP=F.object({mode:F.enum(["auto","required","none"]).optional()}),dP=F.object({type:F.literal("tool_result"),toolUseId:F.string().describe("The unique identifier for the corresponding tool call."),content:F.array(xQ).default([]),structuredContent:F.object({}).loose().optional(),isError:F.boolean().optional(),_meta:F.record(F.string(),F.unknown()).optional()}),nP=F.discriminatedUnion("type",[yQ,TQ,kQ]),j4=F.discriminatedUnion("type",[yQ,TQ,kQ,vP,dP]),rP=F.object({role:p9,content:F.union([j4,F.array(j4)]),_meta:F.record(F.string(),F.unknown()).optional()}),aP=k9.extend({messages:F.array(rP),modelPreferences:iP.optional(),systemPrompt:F.string().optional(),includeContext:F.enum(["none","thisServer","allServers"]).optional(),temperature:F.number().optional(),maxTokens:F.number().int(),stopSequences:F.array(F.string()).optional(),metadata:C1.optional(),tools:F.array(C4).optional(),toolChoice:cP.optional()}),pQ=y1.extend({method:F.literal("sampling/createMessage"),params:aP}),c9=T1.extend({model:F.string(),stopReason:F.optional(F.enum(["endTurn","stopSequence","maxTokens"]).or(F.string())),role:p9,content:nP}),f4=T1.extend({model:F.string(),stopReason:F.optional(F.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(F.string())),role:p9,content:F.union([j4,F.array(j4)])}),oP=F.object({type:F.literal("boolean"),title:F.string().optional(),description:F.string().optional(),default:F.boolean().optional()}),sP=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),minLength:F.number().optional(),maxLength:F.number().optional(),format:F.enum(["email","uri","date","date-time"]).optional(),default:F.string().optional()}),tP=F.object({type:F.enum(["number","integer"]),title:F.string().optional(),description:F.string().optional(),minimum:F.number().optional(),maximum:F.number().optional(),default:F.number().optional()}),eP=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),enum:F.array(F.string()),default:F.string().optional()}),$w=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),oneOf:F.array(F.object({const:F.string(),title:F.string()})),default:F.string().optional()}),Zw=F.object({type:F.literal("string"),title:F.string().optional(),description:F.string().optional(),enum:F.array(F.string()),enumNames:F.array(F.string()).optional(),default:F.string().optional()}),Yw=F.union([eP,$w]),Qw=F.object({type:F.literal("array"),title:F.string().optional(),description:F.string().optional(),minItems:F.number().optional(),maxItems:F.number().optional(),items:F.object({type:F.literal("string"),enum:F.array(F.string())}),default:F.array(F.string()).optional()}),Xw=F.object({type:F.literal("array"),title:F.string().optional(),description:F.string().optional(),minItems:F.number().optional(),maxItems:F.number().optional(),items:F.object({anyOf:F.array(F.object({const:F.string(),title:F.string()}))}),default:F.array(F.string()).optional()}),Ww=F.union([Qw,Xw]),Jw=F.union([Zw,Yw,Ww]),Gw=F.union([Jw,oP,sP,tP]),Kw=k9.extend({mode:F.literal("form").optional(),message:F.string(),requestedSchema:F.object({type:F.literal("object"),properties:F.record(F.string(),Gw),required:F.array(F.string()).optional()})}),Hw=k9.extend({mode:F.literal("url"),message:F.string(),elicitationId:F.string(),url:F.string().url()}),Bw=F.union([Kw,Hw]),iQ=y1.extend({method:F.literal("elicitation/create"),params:Bw}),Fw=U0.extend({elicitationId:F.string()}),Dw=j0.extend({method:F.literal("notifications/elicitation/complete"),params:Fw}),d9=T1.extend({action:F.enum(["accept","decline","cancel"]),content:F.preprocess(($)=>$===null?void 0:$,F.record(F.string(),F.union([F.string(),F.number(),F.boolean(),F.array(F.string())])).optional())}),Vw=F.object({type:F.literal("ref/resource"),uri:F.string()});var Lw=F.object({type:F.literal("ref/prompt"),name:F.string()}),Uw=J0.extend({ref:F.union([Lw,Vw]),argument:F.object({name:F.string(),value:F.string()}),context:F.object({arguments:F.record(F.string(),F.string()).optional()}).optional()}),TK=y1.extend({method:F.literal("completion/complete"),params:Uw});var cQ=T1.extend({completion:F.looseObject({values:F.array(F.string()).max(100),total:F.optional(F.number().int()),hasMore:F.optional(F.boolean())})}),jw=F.object({uri:F.string().startsWith("file://"),name:F.string().optional(),_meta:F.record(F.string(),F.unknown()).optional()}),Aw=y1.extend({method:F.literal("roots/list"),params:J0.optional()}),kK=T1.extend({roots:F.array(jw)}),zw=j0.extend({method:F.literal("notifications/roots/list_changed"),params:U0.optional()}),_i=F.union([q4,RK,TK,yK,vQ,SQ,PQ,EQ,CQ,EP,_P,I4,hQ,M4,w4,E4,_4]),Ci=F.union([O4,N4,NQ,zw,l9]),Ii=F.union([E6,c9,f4,d9,kK,P4,R4,R6]),fi=F.union([q4,pQ,iQ,Aw,M4,w4,E4,_4]),Si=F.union([O4,N4,lP,IP,fQ,mQ,uQ,l9,Dw]),bi=F.union([E6,qQ,cQ,gQ,bQ,wQ,RQ,IQ,r6,i9,P4,R4,R6]);class l extends Error{constructor($,Z,Y){super(`MCP error ${$}: ${Z}`);this.code=$,this.data=Y,this.name="McpError"}static fromError($,Z,Y){if($===d.UrlElicitationRequired&&Y){let Q=Y;if(Q.elicitations)return new xK(Q.elicitations,Z)}return new l($,Z,Y)}}class xK extends l{constructor($,Z=`URL elicitation${$.length>1?"s":""} required`){super(d.UrlElicitationRequired,Z,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function _6($){return $==="completed"||$==="failed"||$==="cancelled"}import*as Ew from"zod/v4-mini";var Ow=Symbol("Let zodToJsonSchema decide on which parser to use");import{ZodFirstPartyTypeKind as bd}from"zod/v3";import{ZodFirstPartyTypeKind as ii}from"zod/v3";import{ZodFirstPartyTypeKind as jc}from"zod/v3";var Vc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function dQ($){let Y=y8($)?.method;if(!Y)throw Error("Schema is missing a method literal");let Q=UQ(Y);if(typeof Q!=="string")throw Error("Schema method literal must be a string");return Q}function nQ($,Z){let Y=L0($,Z);if(!Y.success)throw Y.error;return Y.data}var Rw=60000;class S4{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(O4,(Z)=>{this._oncancel(Z)}),this.setNotificationHandler(N4,(Z)=>{this._onprogress(Z)}),this.setRequestHandler(q4,(Z)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(M4,async(Z,Y)=>{let Q=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!Q)throw new l(d.InvalidParams,"Failed to retrieve task: Task not found");return{...Q}}),this.setRequestHandler(w4,async(Z,Y)=>{let Q=async()=>{let W=Z.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue(W,Y.sessionId)){if(G.type==="response"||G.type==="error"){let K=G.message,B=K.id,D=this._requestResolvers.get(B);if(D)if(this._requestResolvers.delete(B),G.type==="response")D(K);else{let V=K,L=new l(V.error.code,V.error.message,V.error.data);D(L)}else{let V=G.type==="response"?"Response":"Error";this._onerror(Error(`${V} handler missing for request ${B}`))}continue}await this._transport?.send(G.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(W,Y.sessionId);if(!J)throw new l(d.InvalidParams,`Task not found: ${W}`);if(!_6(J.status))return await this._waitForTaskUpdate(W,Y.signal),await Q();if(_6(J.status)){let G=await this._taskStore.getTaskResult(W,Y.sessionId);return this._clearTaskQueue(W),{...G,_meta:{...G._meta,[P6]:{taskId:W}}}}return await Q()};return await Q()}),this.setRequestHandler(E4,async(Z,Y)=>{try{let{tasks:Q,nextCursor:W}=await this._taskStore.listTasks(Z.params?.cursor,Y.sessionId);return{tasks:Q,nextCursor:W,_meta:{}}}catch(Q){throw new l(d.InvalidParams,`Failed to list tasks: ${Q instanceof Error?Q.message:String(Q)}`)}}),this.setRequestHandler(_4,async(Z,Y)=>{try{let Q=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!Q)throw new l(d.InvalidParams,`Task not found: ${Z.params.taskId}`);if(_6(Q.status))throw new l(d.InvalidParams,`Cannot cancel task in terminal status: ${Q.status}`);await this._taskStore.updateTaskStatus(Z.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(Z.params.taskId);let W=await this._taskStore.getTask(Z.params.taskId,Y.sessionId);if(!W)throw new l(d.InvalidParams,`Task not found after cancellation: ${Z.params.taskId}`);return{_meta:{},...W}}catch(Q){if(Q instanceof l)throw Q;throw new l(d.InvalidRequest,`Failed to cancel task: ${Q instanceof Error?Q.message:String(Q)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,Z,Y,Q,W=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Q,Z),startTime:Date.now(),timeout:Z,maxTotalTimeout:Y,resetTimeoutOnProgress:W,onTimeout:Q})}_resetTimeout($){let Z=this._timeoutInfo.get($);if(!Z)return!1;let Y=Date.now()-Z.startTime;if(Z.maxTotalTimeout&&Y>=Z.maxTotalTimeout)throw this._timeoutInfo.delete($),l.fromError(d.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Z.maxTotalTimeout,totalElapsed:Y});return clearTimeout(Z.timeoutId),Z.timeoutId=setTimeout(Z.onTimeout,Z.timeout),!0}_cleanupTimeout($){let Z=this._timeoutInfo.get($);if(Z)clearTimeout(Z.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let Z=this.transport?.onclose;this._transport.onclose=()=>{Z?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(W)=>{Y?.(W),this._onerror(W)};let Q=this._transport?.onmessage;this._transport.onmessage=(W,J)=>{if(Q?.(W,J),n6(W)||wK(W))this._onresponse(W);else if(x9(W))this._onrequest(W,J);else if(PK(W))this._onnotification(W);else this._onerror(Error(`Unknown message type: ${JSON.stringify(W)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();for(let Y of this._requestHandlerAbortControllers.values())Y.abort();this._requestHandlerAbortControllers.clear();let Z=l.fromError(d.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of $.values())Y(Z)}_onerror($){this.onerror?.($)}_onnotification($){let Z=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(Z===void 0)return;Promise.resolve().then(()=>Z($)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest($,Z){let Y=this._requestHandlers.get($.method)??this.fallbackRequestHandler,Q=this._transport,W=$.params?._meta?.[P6]?.taskId;if(Y===void 0){let D={jsonrpc:"2.0",id:$.id,error:{code:d.MethodNotFound,message:"Method not found"}};if(W&&this._taskMessageQueue)this._enqueueTaskMessage(W,{type:"error",message:D,timestamp:Date.now()},Q?.sessionId).catch((V)=>this._onerror(Error(`Failed to enqueue error response: ${V}`)));else Q?.send(D).catch((V)=>this._onerror(Error(`Failed to send an error response: ${V}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set($.id,J);let G=qK($.params)?$.params.task:void 0,K=this._taskStore?this.requestTaskStore($,Q?.sessionId):void 0,B={signal:J.signal,sessionId:Q?.sessionId,_meta:$.params?._meta,sendNotification:async(D)=>{if(J.signal.aborted)return;let V={relatedRequestId:$.id};if(W)V.relatedTask={taskId:W};await this.notification(D,V)},sendRequest:async(D,V,L)=>{if(J.signal.aborted)throw new l(d.ConnectionClosed,"Request was cancelled");let A={...L,relatedRequestId:$.id};if(W&&!A.relatedTask)A.relatedTask={taskId:W};let O=A.relatedTask?.taskId??W;if(O&&K)await K.updateTaskStatus(O,"input_required");return await this.request(D,V,A)},authInfo:Z?.authInfo,requestId:$.id,requestInfo:Z?.requestInfo,taskId:W,taskStore:K,taskRequestedTtl:G?.ttl,closeSSEStream:Z?.closeSSEStream,closeStandaloneSSEStream:Z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(G)this.assertTaskHandlerCapability($.method)}).then(()=>Y($,B)).then(async(D)=>{if(J.signal.aborted)return;let V={result:D,jsonrpc:"2.0",id:$.id};if(W&&this._taskMessageQueue)await this._enqueueTaskMessage(W,{type:"response",message:V,timestamp:Date.now()},Q?.sessionId);else await Q?.send(V)},async(D)=>{if(J.signal.aborted)return;let V={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(D.code)?D.code:d.InternalError,message:D.message??"Internal error",...D.data!==void 0&&{data:D.data}}};if(W&&this._taskMessageQueue)await this._enqueueTaskMessage(W,{type:"error",message:V,timestamp:Date.now()},Q?.sessionId);else await Q?.send(V)}).catch((D)=>this._onerror(Error(`Failed to send response: ${D}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===J)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:Z,...Y}=$.params,Q=Number(Z),W=this._progressHandlers.get(Q);if(!W){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let J=this._responseHandlers.get(Q),G=this._timeoutInfo.get(Q);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(Q)}catch(K){this._responseHandlers.delete(Q),this._progressHandlers.delete(Q),this._cleanupTimeout(Q),J(K);return}W(Y)}_onresponse($){let Z=Number($.id),Y=this._requestResolvers.get(Z);if(Y){if(this._requestResolvers.delete(Z),n6($))Y($);else{let J=new l($.error.code,$.error.message,$.error.data);Y(J)}return}let Q=this._responseHandlers.get(Z);if(Q===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(Z),this._cleanupTimeout(Z);let W=!1;if(n6($)&&$.result&&typeof $.result==="object"){let J=$.result;if(J.task&&typeof J.task==="object"){let G=J.task;if(typeof G.taskId==="string")W=!0,this._taskProgressTokens.set(G.taskId,Z)}}if(!W)this._progressHandlers.delete(Z);if(n6($))Q($);else{let J=l.fromError($.error.code,$.error.message,$.error.data);Q(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,Z,Y){let{task:Q}=Y??{};if(!Q){try{yield{type:"result",result:await this.request($,Z,Y)}}catch(J){yield{type:"error",error:J instanceof l?J:new l(d.InternalError,String(J))}}return}let W;try{let J=await this.request($,R6,Y);if(J.task)W=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new l(d.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:W},Y);if(yield{type:"taskStatus",task:G},_6(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:W},Z,Y)};else if(G.status==="failed")yield{type:"error",error:new l(d.InternalError,`Task ${W} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new l(d.InternalError,`Task ${W} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:W},Z,Y)};return}let K=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,K)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof l?J:new l(d.InternalError,String(J))}}}request($,Z,Y){let{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J,task:G,relatedTask:K}=Y??{};return new Promise((B,D)=>{let V=(N)=>{D(N)};if(!this._transport){V(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),G)this.assertTaskCapability($.method)}catch(N){V(N);return}Y?.signal?.throwIfAborted();let L=this._requestMessageId++,A={...$,jsonrpc:"2.0",id:L};if(Y?.onprogress)this._progressHandlers.set(L,Y.onprogress),A.params={...$.params,_meta:{...$.params?._meta||{},progressToken:L}};if(G)A.params={...A.params,task:G};if(K)A.params={...A.params,_meta:{...A.params?._meta||{},[P6]:K}};let O=(N)=>{this._responseHandlers.delete(L),this._progressHandlers.delete(L),this._cleanupTimeout(L),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:L,reason:String(N)}},{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J}).catch((f)=>this._onerror(Error(`Failed to send cancellation: ${f}`)));let E=N instanceof l?N:new l(d.RequestTimeout,String(N));D(E)};this._responseHandlers.set(L,(N)=>{if(Y?.signal?.aborted)return;if(N instanceof Error)return D(N);try{let E=L0(Z,N.result);if(!E.success)D(E.error);else B(E.data)}catch(E){D(E)}}),Y?.signal?.addEventListener("abort",()=>{O(Y?.signal?.reason)});let q=Y?.timeout??Rw,M=()=>O(l.fromError(d.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(L,q,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let I=K?.taskId;if(I){let N=(E)=>{let f=this._responseHandlers.get(L);if(f)f(E);else this._onerror(Error(`Response handler missing for side-channeled request ${L}`))};this._requestResolvers.set(L,N),this._enqueueTaskMessage(I,{type:"request",message:A,timestamp:Date.now()}).catch((E)=>{this._cleanupTimeout(L),D(E)})}else this._transport.send(A,{relatedRequestId:Q,resumptionToken:W,onresumptiontoken:J}).catch((N)=>{this._cleanupTimeout(L),D(N)})})}async getTask($,Z){return this.request({method:"tasks/get",params:$},P4,Z)}async getTaskResult($,Z,Y){return this.request({method:"tasks/result",params:$},Z,Y)}async listTasks($,Z){return this.request({method:"tasks/list",params:$},R4,Z)}async cancelTask($,Z){return this.request({method:"tasks/cancel",params:$},CK,Z)}async notification($,Z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let Y=Z?.relatedTask?.taskId;if(Y){let G={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[P6]:Z.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:G,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!Z?.relatedRequestId&&!Z?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let G={...$,jsonrpc:"2.0"};if(Z?.relatedTask)G={...G,params:{...G.params,_meta:{...G.params?._meta||{},[P6]:Z.relatedTask}}};this._transport?.send(G,Z).catch((K)=>this._onerror(K))});return}let J={...$,jsonrpc:"2.0"};if(Z?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[P6]:Z.relatedTask}}};await this._transport.send(J,Z)}setRequestHandler($,Z){let Y=dQ($);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(Q,W)=>{let J=nQ($,Q);return Promise.resolve(Z(J,W))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,Z){let Y=dQ($);this._notificationHandlers.set(Y,(Q)=>{let W=nQ($,Q);return Promise.resolve(Z(W))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let Z=this._taskProgressTokens.get($);if(Z!==void 0)this._progressHandlers.delete(Z),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,Z,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let Q=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,Z,Y,Q)}async _clearTaskQueue($,Z){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll($,Z);for(let Q of Y)if(Q.type==="request"&&x9(Q.message)){let W=Q.message.id,J=this._requestResolvers.get(W);if(J)J(new l(d.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(W);else this._onerror(Error(`Resolver missing for request ${W} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,Z){let Y=this._options?.defaultTaskPollInterval??1000;try{let Q=await this._taskStore?.getTask($);if(Q?.pollInterval)Y=Q.pollInterval}catch{}return new Promise((Q,W)=>{if(Z.aborted){W(new l(d.InvalidRequest,"Request cancelled"));return}let J=setTimeout(Q,Y);Z.addEventListener("abort",()=>{clearTimeout(J),W(new l(d.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,Z){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(Q)=>{if(!$)throw Error("No request provided");return await Y.createTask(Q,$.id,{method:$.method,params:$.params},Z)},getTask:async(Q)=>{let W=await Y.getTask(Q,Z);if(!W)throw new l(d.InvalidParams,"Failed to retrieve task: Task not found");return W},storeTaskResult:async(Q,W,J)=>{await Y.storeTaskResult(Q,W,J,Z);let G=await Y.getTask(Q,Z);if(G){let K=l9.parse({method:"notifications/tasks/status",params:G});if(await this.notification(K),_6(G.status))this._cleanupTaskProgressHandler(Q)}},getTaskResult:(Q)=>{return Y.getTaskResult(Q,Z)},updateTaskStatus:async(Q,W,J)=>{let G=await Y.getTask(Q,Z);if(!G)throw new l(d.InvalidParams,`Task "${Q}" not found - it may have been cleaned up`);if(_6(G.status))throw new l(d.InvalidParams,`Cannot update task "${Q}" from terminal status "${G.status}" to "${W}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(Q,W,J,Z);let K=await Y.getTask(Q,Z);if(K){let B=l9.parse({method:"notifications/tasks/status",params:K});if(await this.notification(B),_6(K.status))this._cleanupTaskProgressHandler(Q)}},listTasks:(Q)=>{return Y.listTasks(Q,Z)}}}}function gK($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function rQ($,Z){let Y={...$};for(let Q in Z){let W=Q,J=Z[W];if(J===void 0)continue;let G=Y[W];if(gK(G)&&gK(J))Y[W]={...G,...J};else Y[W]=J}return Y}var UV=R9(lX(),1),jV=R9(LV(),1);function xb(){let $=new UV.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return jV.default($),$}class U5{constructor($){this._ajv=$??xb()}getValidator($){let Z="$id"in $&&typeof $.$id==="string"?this._ajv.getSchema($.$id)??this._ajv.compile($):this._ajv.compile($);return(Y)=>{if(Z(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Z.errors)}}}}class tX{constructor($){this._client=$}async*callToolStream($,Z=r6,Y){let Q=this._client,W={...Y,task:Y?.task??(Q.isToolTask($.name)?{}:void 0)},J=Q.requestStream({method:"tools/call",params:$},Z,W),G=Q.getToolOutputValidator($.name);for await(let K of J){if(K.type==="result"&&G){let B=K.result;if(!B.structuredContent&&!B.isError){yield{type:"error",error:new l(d.InvalidRequest,`Tool ${$.name} has an output schema but did not return structured content`)};return}if(B.structuredContent)try{let D=G(B.structuredContent);if(!D.valid){yield{type:"error",error:new l(d.InvalidParams,`Structured content does not match the tool's output schema: ${D.errorMessage}`)};return}}catch(D){if(D instanceof l){yield{type:"error",error:D};return}yield{type:"error",error:new l(d.InvalidParams,`Failed to validate structured content: ${D instanceof Error?D.message:String(D)}`)};return}}yield K}}async getTask($,Z){return this._client.getTask({taskId:$},Z)}async getTaskResult($,Z,Y){return this._client.getTaskResult({taskId:$},Z,Y)}async listTasks($,Z){return this._client.listTasks($?{cursor:$}:void 0,Z)}async cancelTask($,Z){return this._client.cancelTask({taskId:$},Z)}requestStream($,Z,Y){return this._client.requestStream($,Z,Y)}}function eX($,Z,Y){if(!$)throw Error(`${Y} does not support task creation (required for ${Z})`);switch(Z){case"tools/call":if(!$.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${Z})`);break;default:break}}function $W($,Z,Y){if(!$)throw Error(`${Y} does not support task creation (required for ${Z})`);switch(Z){case"sampling/createMessage":if(!$.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${Z})`);break;case"elicitation/create":if(!$.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${Z})`);break;default:break}}function j5($,Z){if(!$||Z===null||typeof Z!=="object")return;if($.type==="object"&&$.properties&&typeof $.properties==="object"){let Y=Z,Q=$.properties;for(let W of Object.keys(Q)){let J=Q[W];if(Y[W]===void 0&&Object.prototype.hasOwnProperty.call(J,"default"))Y[W]=J.default;if(Y[W]!==void 0)j5(J,Y[W])}}if(Array.isArray($.anyOf)){for(let Y of $.anyOf)if(typeof Y!=="boolean")j5(Y,Z)}if(Array.isArray($.oneOf)){for(let Y of $.oneOf)if(typeof Y!=="boolean")j5(Y,Z)}}function gb($){if(!$)return{supportsFormMode:!1,supportsUrlMode:!1};let Z=$.form!==void 0,Y=$.url!==void 0;return{supportsFormMode:Z||!Z&&!Y,supportsUrlMode:Y}}class A5 extends S4{constructor($,Z){super(Z);if(this._clientInfo=$,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=Z?.capabilities??{},this._jsonSchemaValidator=Z?.jsonSchemaValidator??new U5,Z?.listChanged)this._pendingListChangedConfig=Z.listChanged}_setupListChangedHandlers($){if($.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",mQ,$.tools,async()=>{return(await this.listTools()).tools});if($.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",uQ,$.prompts,async()=>{return(await this.listPrompts()).prompts});if($.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",fQ,$.resources,async()=>{return(await this.listResources()).resources})}get experimental(){if(!this._experimental)this._experimental={tasks:new tX(this)};return this._experimental}registerCapabilities($){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=rQ(this._capabilities,$)}setRequestHandler($,Z){let Q=y8($)?.method;if(!Q)throw Error("Schema is missing a method literal");let W;if(c6(Q)){let G=Q;W=G._zod?.def?.value??G.value}else{let G=Q;W=G._def?.value??G.value}if(typeof W!=="string")throw Error("Schema method literal must be a string");let J=W;if(J==="elicitation/create"){let G=async(K,B)=>{let D=L0(iQ,K);if(!D.success){let N=D.error instanceof Error?D.error.message:String(D.error);throw new l(d.InvalidParams,`Invalid elicitation request: ${N}`)}let{params:V}=D.data;V.mode=V.mode??"form";let{supportsFormMode:L,supportsUrlMode:A}=gb(this._capabilities.elicitation);if(V.mode==="form"&&!L)throw new l(d.InvalidParams,"Client does not support form-mode elicitation requests");if(V.mode==="url"&&!A)throw new l(d.InvalidParams,"Client does not support URL-mode elicitation requests");let O=await Promise.resolve(Z(K,B));if(V.task){let N=L0(R6,O);if(!N.success){let E=N.error instanceof Error?N.error.message:String(N.error);throw new l(d.InvalidParams,`Invalid task creation result: ${E}`)}return N.data}let q=L0(d9,O);if(!q.success){let N=q.error instanceof Error?q.error.message:String(q.error);throw new l(d.InvalidParams,`Invalid elicitation result: ${N}`)}let M=q.data,I=V.mode==="form"?V.requestedSchema:void 0;if(V.mode==="form"&&M.action==="accept"&&M.content&&I){if(this._capabilities.elicitation?.form?.applyDefaults)try{j5(I,M.content)}catch{}}return M};return super.setRequestHandler($,G)}if(J==="sampling/createMessage"){let G=async(K,B)=>{let D=L0(pQ,K);if(!D.success){let M=D.error instanceof Error?D.error.message:String(D.error);throw new l(d.InvalidParams,`Invalid sampling request: ${M}`)}let{params:V}=D.data,L=await Promise.resolve(Z(K,B));if(V.task){let M=L0(R6,L);if(!M.success){let I=M.error instanceof Error?M.error.message:String(M.error);throw new l(d.InvalidParams,`Invalid task creation result: ${I}`)}return M.data}let O=V.tools||V.toolChoice?f4:c9,q=L0(O,L);if(!q.success){let M=q.error instanceof Error?q.error.message:String(q.error);throw new l(d.InvalidParams,`Invalid sampling result: ${M}`)}return q.data};return super.setRequestHandler($,G)}return super.setRequestHandler($,Z)}assertCapability($,Z){if(!this._serverCapabilities?.[$])throw Error(`Server does not support ${$} (required for ${Z})`)}async connect($,Z){if(await super.connect($),$.sessionId!==void 0)return;try{let Y=await this.request({method:"initialize",params:{protocolVersion:d6,capabilities:this._capabilities,clientInfo:this._clientInfo}},qQ,Z);if(Y===void 0)throw Error(`Server sent invalid initialize result: ${Y}`);if(!jQ.includes(Y.protocolVersion))throw Error(`Server's protocol version is not supported: ${Y.protocolVersion}`);if(this._serverCapabilities=Y.capabilities,this._serverVersion=Y.serverInfo,$.setProtocolVersion)$.setProtocolVersion(Y.protocolVersion);if(this._instructions=Y.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(Y){throw this.close(),Y}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod($){switch($){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${$})`);if($==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${$})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${$})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${$})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){if(!this._capabilities)return;switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${$})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${$})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${$})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${$})`);break;case"ping":break}}assertTaskCapability($){eX(this._serverCapabilities?.tasks?.requests,$,"Server")}assertTaskHandlerCapability($){if(!this._capabilities)return;$W(this._capabilities.tasks?.requests,$,"Client")}async ping($){return this.request({method:"ping"},E6,$)}async complete($,Z){return this.request({method:"completion/complete",params:$},cQ,Z)}async setLoggingLevel($,Z){return this.request({method:"logging/setLevel",params:{level:$}},E6,Z)}async getPrompt($,Z){return this.request({method:"prompts/get",params:$},gQ,Z)}async listPrompts($,Z){return this.request({method:"prompts/list",params:$},bQ,Z)}async listResources($,Z){return this.request({method:"resources/list",params:$},wQ,Z)}async listResourceTemplates($,Z){return this.request({method:"resources/templates/list",params:$},RQ,Z)}async readResource($,Z){return this.request({method:"resources/read",params:$},IQ,Z)}async subscribeResource($,Z){return this.request({method:"resources/subscribe",params:$},E6,Z)}async unsubscribeResource($,Z){return this.request({method:"resources/unsubscribe",params:$},E6,Z)}async callTool($,Z=r6,Y){if(this.isToolTaskRequired($.name))throw new l(d.InvalidRequest,`Tool "${$.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let Q=await this.request({method:"tools/call",params:$},Z,Y),W=this.getToolOutputValidator($.name);if(W){if(!Q.structuredContent&&!Q.isError)throw new l(d.InvalidRequest,`Tool ${$.name} has an output schema but did not return structured content`);if(Q.structuredContent)try{let J=W(Q.structuredContent);if(!J.valid)throw new l(d.InvalidParams,`Structured content does not match the tool's output schema: ${J.errorMessage}`)}catch(J){if(J instanceof l)throw J;throw new l(d.InvalidParams,`Failed to validate structured content: ${J instanceof Error?J.message:String(J)}`)}}return Q}isToolTask($){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has($)}isToolTaskRequired($){return this._cachedRequiredTaskTools.has($)}cacheToolMetadata($){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let Z of $){if(Z.outputSchema){let Q=this._jsonSchemaValidator.getValidator(Z.outputSchema);this._cachedToolOutputValidators.set(Z.name,Q)}let Y=Z.execution?.taskSupport;if(Y==="required"||Y==="optional")this._cachedKnownTaskTools.add(Z.name);if(Y==="required")this._cachedRequiredTaskTools.add(Z.name)}}getToolOutputValidator($){return this._cachedToolOutputValidators.get($)}async listTools($,Z){let Y=await this.request({method:"tools/list",params:$},i9,Z);return this.cacheToolMetadata(Y.tools),Y}_setupListChangedHandler($,Z,Y,Q){let W=vK.safeParse(Y);if(!W.success)throw Error(`Invalid ${$} listChanged options: ${W.error.message}`);if(typeof Y.onChanged!=="function")throw Error(`Invalid ${$} listChanged options: onChanged must be a function`);let{autoRefresh:J,debounceMs:G}=W.data,{onChanged:K}=Y,B=async()=>{if(!J){K(null,null);return}try{let V=await Q();K(null,V)}catch(V){let L=V instanceof Error?V:Error(String(V));K(L,null)}},D=()=>{if(G){let V=this._listChangedDebounceTimers.get($);if(V)clearTimeout(V);let L=setTimeout(B,G);this._listChangedDebounceTimers.set($,L)}else B()};this.setNotificationHandler(Z,D)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function a8($){if(!$)return{};if($ instanceof Headers)return Object.fromEntries($.entries());if(Array.isArray($))return Object.fromEntries($);return{...$}}function z5($=fetch,Z){if(!Z)return $;return async(Y,Q)=>{let W={...Z,...Q,headers:Q?.headers?{...a8(Z.headers),...a8(Q.headers)}:Z.headers};return $(Y,W)}}var ZW;ZW=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then(($)=>$.webcrypto);async function ub($){return(await ZW).getRandomValues(new Uint8Array($))}async function hb($){let Y=Math.pow(2,8)-Math.pow(2,8)%66,Q="";while(Q.length<$){let W=await ub($-Q.length);for(let J of W)if(J<Y)Q+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[J%66]}return Q}async function mb($){return await hb($)}async function lb($){let Z=await(await ZW).subtle.digest("SHA-256",new TextEncoder().encode($));return btoa(String.fromCharCode(...new Uint8Array(Z))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function YW($){if(!$)$=43;if($<43||$>128)throw`Expected a length between 43 and 128. Received ${$}.`;let Z=await mb($),Y=await lb(Z);return{code_verifier:Z,code_challenge:Y}}import*as P from"zod/v4";var g1=P.url().superRefine(($,Z)=>{if(!URL.canParse($))return Z.addIssue({code:P.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),P.NEVER}).refine(($)=>{let Z=new URL($);return Z.protocol!=="javascript:"&&Z.protocol!=="data:"&&Z.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),zV=P.looseObject({resource:P.string().url(),authorization_servers:P.array(g1).optional(),jwks_uri:P.string().url().optional(),scopes_supported:P.array(P.string()).optional(),bearer_methods_supported:P.array(P.string()).optional(),resource_signing_alg_values_supported:P.array(P.string()).optional(),resource_name:P.string().optional(),resource_documentation:P.string().optional(),resource_policy_uri:P.string().url().optional(),resource_tos_uri:P.string().url().optional(),tls_client_certificate_bound_access_tokens:P.boolean().optional(),authorization_details_types_supported:P.array(P.string()).optional(),dpop_signing_alg_values_supported:P.array(P.string()).optional(),dpop_bound_access_tokens_required:P.boolean().optional()}),QW=P.looseObject({issuer:P.string(),authorization_endpoint:g1,token_endpoint:g1,registration_endpoint:g1.optional(),scopes_supported:P.array(P.string()).optional(),response_types_supported:P.array(P.string()),response_modes_supported:P.array(P.string()).optional(),grant_types_supported:P.array(P.string()).optional(),token_endpoint_auth_methods_supported:P.array(P.string()).optional(),token_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),service_documentation:g1.optional(),revocation_endpoint:g1.optional(),revocation_endpoint_auth_methods_supported:P.array(P.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),introspection_endpoint:P.string().optional(),introspection_endpoint_auth_methods_supported:P.array(P.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),code_challenge_methods_supported:P.array(P.string()).optional(),client_id_metadata_document_supported:P.boolean().optional()}),pb=P.looseObject({issuer:P.string(),authorization_endpoint:g1,token_endpoint:g1,userinfo_endpoint:g1.optional(),jwks_uri:g1,registration_endpoint:g1.optional(),scopes_supported:P.array(P.string()).optional(),response_types_supported:P.array(P.string()),response_modes_supported:P.array(P.string()).optional(),grant_types_supported:P.array(P.string()).optional(),acr_values_supported:P.array(P.string()).optional(),subject_types_supported:P.array(P.string()),id_token_signing_alg_values_supported:P.array(P.string()),id_token_encryption_alg_values_supported:P.array(P.string()).optional(),id_token_encryption_enc_values_supported:P.array(P.string()).optional(),userinfo_signing_alg_values_supported:P.array(P.string()).optional(),userinfo_encryption_alg_values_supported:P.array(P.string()).optional(),userinfo_encryption_enc_values_supported:P.array(P.string()).optional(),request_object_signing_alg_values_supported:P.array(P.string()).optional(),request_object_encryption_alg_values_supported:P.array(P.string()).optional(),request_object_encryption_enc_values_supported:P.array(P.string()).optional(),token_endpoint_auth_methods_supported:P.array(P.string()).optional(),token_endpoint_auth_signing_alg_values_supported:P.array(P.string()).optional(),display_values_supported:P.array(P.string()).optional(),claim_types_supported:P.array(P.string()).optional(),claims_supported:P.array(P.string()).optional(),service_documentation:P.string().optional(),claims_locales_supported:P.array(P.string()).optional(),ui_locales_supported:P.array(P.string()).optional(),claims_parameter_supported:P.boolean().optional(),request_parameter_supported:P.boolean().optional(),request_uri_parameter_supported:P.boolean().optional(),require_request_uri_registration:P.boolean().optional(),op_policy_uri:g1.optional(),op_tos_uri:g1.optional(),client_id_metadata_document_supported:P.boolean().optional()}),OV=P.object({...pb.shape,...QW.pick({code_challenge_methods_supported:!0}).shape}),qV=P.object({access_token:P.string(),id_token:P.string().optional(),token_type:P.string(),expires_in:P.coerce.number().optional(),scope:P.string().optional(),refresh_token:P.string().optional()}).strip(),NV=P.object({error:P.string(),error_description:P.string().optional(),error_uri:P.string().optional()}),AV=g1.optional().or(P.literal("").transform(()=>{return})),ib=P.object({redirect_uris:P.array(g1),token_endpoint_auth_method:P.string().optional(),grant_types:P.array(P.string()).optional(),response_types:P.array(P.string()).optional(),client_name:P.string().optional(),client_uri:g1.optional(),logo_uri:AV,scope:P.string().optional(),contacts:P.array(P.string()).optional(),tos_uri:AV,policy_uri:P.string().optional(),jwks_uri:g1.optional(),jwks:P.any().optional(),software_id:P.string().optional(),software_version:P.string().optional(),software_statement:P.string().optional()}).strip(),cb=P.object({client_id:P.string(),client_secret:P.string().optional(),client_id_issued_at:P.number().optional(),client_secret_expires_at:P.number().optional()}).strip(),MV=ib.merge(cb),jo=P.object({error:P.string(),error_description:P.string().optional()}).strip(),Ao=P.object({token:P.string(),token_type_hint:P.string().optional()}).strip();function PV($){let Z=typeof $==="string"?new URL($):new URL($.href);return Z.hash="",Z}function wV({requestedResource:$,configuredResource:Z}){let Y=typeof $==="string"?new URL($):new URL($.href),Q=typeof Z==="string"?new URL(Z):new URL(Z.href);if(Y.origin!==Q.origin)return!1;if(Y.pathname.length<Q.pathname.length)return!1;let W=Y.pathname.endsWith("/")?Y.pathname:Y.pathname+"/",J=Q.pathname.endsWith("/")?Q.pathname:Q.pathname+"/";return W.startsWith(J)}class R1 extends Error{constructor($,Z){super($);this.errorUri=Z,this.name=this.constructor.name}toResponseObject(){let $={error:this.errorCode,error_description:this.message};if(this.errorUri)$.error_uri=this.errorUri;return $}get errorCode(){return this.constructor.errorCode}}class O5 extends R1{}O5.errorCode="invalid_request";class o8 extends R1{}o8.errorCode="invalid_client";class s8 extends R1{}s8.errorCode="invalid_grant";class t8 extends R1{}t8.errorCode="unauthorized_client";class q5 extends R1{}q5.errorCode="unsupported_grant_type";class N5 extends R1{}N5.errorCode="invalid_scope";class M5 extends R1{}M5.errorCode="access_denied";class T6 extends R1{}T6.errorCode="server_error";class P5 extends R1{}P5.errorCode="temporarily_unavailable";class w5 extends R1{}w5.errorCode="unsupported_response_type";class E5 extends R1{}E5.errorCode="unsupported_token_type";class R5 extends R1{}R5.errorCode="invalid_token";class _5 extends R1{}_5.errorCode="method_not_allowed";class C5 extends R1{}C5.errorCode="too_many_requests";class e8 extends R1{}e8.errorCode="invalid_client_metadata";class I5 extends R1{}I5.errorCode="insufficient_scope";class f5 extends R1{}f5.errorCode="invalid_target";var EV={[O5.errorCode]:O5,[o8.errorCode]:o8,[s8.errorCode]:s8,[t8.errorCode]:t8,[q5.errorCode]:q5,[N5.errorCode]:N5,[M5.errorCode]:M5,[T6.errorCode]:T6,[P5.errorCode]:P5,[w5.errorCode]:w5,[E5.errorCode]:E5,[R5.errorCode]:R5,[_5.errorCode]:_5,[C5.errorCode]:C5,[e8.errorCode]:e8,[I5.errorCode]:I5,[f5.errorCode]:f5};class e1 extends Error{constructor($){super($??"Unauthorized")}}function db($){return["client_secret_basic","client_secret_post","none"].includes($)}var XW="code",WW="S256";function nb($,Z){let Y=$.client_secret!==void 0;if("token_endpoint_auth_method"in $&&$.token_endpoint_auth_method&&db($.token_endpoint_auth_method)&&(Z.length===0||Z.includes($.token_endpoint_auth_method)))return $.token_endpoint_auth_method;if(Z.length===0)return Y?"client_secret_basic":"none";if(Y&&Z.includes("client_secret_basic"))return"client_secret_basic";if(Y&&Z.includes("client_secret_post"))return"client_secret_post";if(Z.includes("none"))return"none";return Y?"client_secret_post":"none"}function rb($,Z,Y,Q){let{client_id:W,client_secret:J}=Z;switch($){case"client_secret_basic":ab(W,J,Y);return;case"client_secret_post":ob(W,J,Q);return;case"none":sb(W,Q);return;default:throw Error(`Unsupported client authentication method: ${$}`)}}function ab($,Z,Y){if(!Z)throw Error("client_secret_basic authentication requires a client_secret");let Q=btoa(`${$}:${Z}`);Y.set("Authorization",`Basic ${Q}`)}function ob($,Z,Y){if(Y.set("client_id",$),Z)Y.set("client_secret",Z)}function sb($,Z){Z.set("client_id",$)}async function _V($){let Z=$ instanceof Response?$.status:void 0,Y=$ instanceof Response?await $.text():$;try{let Q=NV.parse(JSON.parse(Y)),{error:W,error_description:J,error_uri:G}=Q;return new(EV[W]||T6)(J||"",G)}catch(Q){let W=`${Z?`HTTP ${Z}: `:""}Invalid OAuth error response: ${Q}. Raw body: ${Y}`;return new T6(W)}}async function p0($,Z){try{return await JW($,Z)}catch(Y){if(Y instanceof o8||Y instanceof t8)return await $.invalidateCredentials?.("all"),await JW($,Z);else if(Y instanceof s8)return await $.invalidateCredentials?.("tokens"),await JW($,Z);throw Y}}async function JW($,{serverUrl:Z,authorizationCode:Y,scope:Q,resourceMetadataUrl:W,fetchFn:J}){let G=await $.discoveryState?.(),K,B,D,V=W;if(!V&&G?.resourceMetadataUrl)V=new URL(G.resourceMetadataUrl);if(G?.authorizationServerUrl){if(B=G.authorizationServerUrl,K=G.resourceMetadata,D=G.authorizationServerMetadata??await BW(B,{fetchFn:J}),!K)try{K=await KW(Z,{resourceMetadataUrl:V},J)}catch{}if(D!==G.authorizationServerMetadata||K!==G.resourceMetadata)await $.saveDiscoveryState?.({authorizationServerUrl:String(B),resourceMetadataUrl:V?.toString(),resourceMetadata:K,authorizationServerMetadata:D})}else{let f=await Xv(Z,{resourceMetadataUrl:V,fetchFn:J});B=f.authorizationServerUrl,D=f.authorizationServerMetadata,K=f.resourceMetadata,await $.saveDiscoveryState?.({authorizationServerUrl:String(B),resourceMetadataUrl:V?.toString(),resourceMetadata:K,authorizationServerMetadata:D})}let L=await eb(Z,$,K),A=Q||K?.scopes_supported?.join(" ")||$.clientMetadata.scope,O=await Promise.resolve($.clientInformation());if(!O){if(Y!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let f=D?.client_id_metadata_document_supported===!0,v=$.clientMetadataUrl;if(v&&!tb(v))throw new e8(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(f&&v)O={client_id:v},await $.saveClientInformation?.(O);else{if(!$.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let $1=await Hv(B,{metadata:D,clientMetadata:$.clientMetadata,scope:A,fetchFn:J});await $.saveClientInformation($1),O=$1}}let q=!$.redirectUrl;if(Y!==void 0||q){let f=await Kv($,B,{metadata:D,resource:L,authorizationCode:Y,fetchFn:J});return await $.saveTokens(f),"AUTHORIZED"}let M=await $.tokens();if(M?.refresh_token)try{let f=await Gv(B,{metadata:D,clientInformation:O,refreshToken:M.refresh_token,resource:L,addClientAuthentication:$.addClientAuthentication,fetchFn:J});return await $.saveTokens(f),"AUTHORIZED"}catch(f){if(!(f instanceof R1)||f instanceof T6);else throw f}let I=$.state?await $.state():void 0,{authorizationUrl:N,codeVerifier:E}=await Wv(B,{metadata:D,clientInformation:O,state:I,redirectUrl:$.redirectUrl,scope:A,resource:L});return await $.saveCodeVerifier(E),await $.redirectToAuthorization(N),"REDIRECT"}function tb($){if(!$)return!1;try{let Z=new URL($);return Z.protocol==="https:"&&Z.pathname!=="/"}catch{return!1}}async function eb($,Z,Y){let Q=PV($);if(Z.validateResourceURL)return await Z.validateResourceURL(Q,Y?.resource);if(!Y)return;if(!wV({requestedResource:Q,configuredResource:Y.resource}))throw Error(`Protected resource ${Y.resource} does not match expected ${Q} (or origin)`);return new URL(Y.resource)}function $9($){let Z=$.headers.get("WWW-Authenticate");if(!Z)return{};let[Y,Q]=Z.split(" ");if(Y.toLowerCase()!=="bearer"||!Q)return{};let W=GW($,"resource_metadata")||void 0,J;if(W)try{J=new URL(W)}catch{}let G=GW($,"scope")||void 0,K=GW($,"error")||void 0;return{resourceMetadataUrl:J,scope:G,error:K}}function GW($,Z){let Y=$.headers.get("WWW-Authenticate");if(!Y)return null;let Q=new RegExp(`${Z}=(?:"([^"]+)"|([^\\s,]+))`),W=Y.match(Q);if(W)return W[1]||W[2];return null}async function KW($,Z,Y=fetch){let Q=await Yv($,"oauth-protected-resource",Y,{protocolVersion:Z?.protocolVersion,metadataUrl:Z?.resourceMetadataUrl});if(!Q||Q.status===404)throw await Q?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!Q.ok)throw await Q.body?.cancel(),Error(`HTTP ${Q.status} trying to load well-known OAuth protected resource metadata.`);return zV.parse(await Q.json())}async function HW($,Z,Y=fetch){try{return await Y($,{headers:Z})}catch(Q){if(Q instanceof TypeError)if(Z)return HW($,void 0,Y);else return;throw Q}}function $v($,Z="",Y={}){if(Z.endsWith("/"))Z=Z.slice(0,-1);return Y.prependPathname?`${Z}/.well-known/${$}`:`/.well-known/${$}${Z}`}async function RV($,Z,Y=fetch){return await HW($,{"MCP-Protocol-Version":Z},Y)}function Zv($,Z){return!$||$.status>=400&&$.status<500&&Z!=="/"}async function Yv($,Z,Y,Q){let W=new URL($),J=Q?.protocolVersion??d6,G;if(Q?.metadataUrl)G=new URL(Q.metadataUrl);else{let B=$v(Z,W.pathname);G=new URL(B,Q?.metadataServerUrl??W),G.search=W.search}let K=await RV(G,J,Y);if(!Q?.metadataUrl&&Zv(K,W.pathname)){let B=new URL(`/.well-known/${Z}`,W);K=await RV(B,J,Y)}return K}function Qv($){let Z=typeof $==="string"?new URL($):$,Y=Z.pathname!=="/",Q=[];if(!Y)return Q.push({url:new URL("/.well-known/oauth-authorization-server",Z.origin),type:"oauth"}),Q.push({url:new URL("/.well-known/openid-configuration",Z.origin),type:"oidc"}),Q;let W=Z.pathname;if(W.endsWith("/"))W=W.slice(0,-1);return Q.push({url:new URL(`/.well-known/oauth-authorization-server${W}`,Z.origin),type:"oauth"}),Q.push({url:new URL(`/.well-known/openid-configuration${W}`,Z.origin),type:"oidc"}),Q.push({url:new URL(`${W}/.well-known/openid-configuration`,Z.origin),type:"oidc"}),Q}async function BW($,{fetchFn:Z=fetch,protocolVersion:Y=d6}={}){let Q={"MCP-Protocol-Version":Y,Accept:"application/json"},W=Qv($);for(let{url:J,type:G}of W){let K=await HW(J,Q,Z);if(!K)continue;if(!K.ok){if(await K.body?.cancel(),K.status>=400&&K.status<500)continue;throw Error(`HTTP ${K.status} trying to load ${G==="oauth"?"OAuth":"OpenID provider"} metadata from ${J}`)}if(G==="oauth")return QW.parse(await K.json());else return OV.parse(await K.json())}return}async function Xv($,Z){let Y,Q;try{if(Y=await KW($,{resourceMetadataUrl:Z?.resourceMetadataUrl},Z?.fetchFn),Y.authorization_servers&&Y.authorization_servers.length>0)Q=Y.authorization_servers[0]}catch{}if(!Q)Q=String(new URL("/",$));let W=await BW(Q,{fetchFn:Z?.fetchFn});return{authorizationServerUrl:Q,authorizationServerMetadata:W,resourceMetadata:Y}}async function Wv($,{metadata:Z,clientInformation:Y,redirectUrl:Q,scope:W,state:J,resource:G}){let K;if(Z){if(K=new URL(Z.authorization_endpoint),!Z.response_types_supported.includes(XW))throw Error(`Incompatible auth server: does not support response type ${XW}`);if(Z.code_challenge_methods_supported&&!Z.code_challenge_methods_supported.includes(WW))throw Error(`Incompatible auth server: does not support code challenge method ${WW}`)}else K=new URL("/authorize",$);let B=await YW(),D=B.code_verifier,V=B.code_challenge;if(K.searchParams.set("response_type",XW),K.searchParams.set("client_id",Y.client_id),K.searchParams.set("code_challenge",V),K.searchParams.set("code_challenge_method",WW),K.searchParams.set("redirect_uri",String(Q)),J)K.searchParams.set("state",J);if(W)K.searchParams.set("scope",W);if(W?.includes("offline_access"))K.searchParams.append("prompt","consent");if(G)K.searchParams.set("resource",G.href);return{authorizationUrl:K,codeVerifier:D}}function Jv($,Z,Y){return new URLSearchParams({grant_type:"authorization_code",code:$,code_verifier:Z,redirect_uri:String(Y)})}async function CV($,{metadata:Z,tokenRequestParams:Y,clientInformation:Q,addClientAuthentication:W,resource:J,fetchFn:G}){let K=Z?.token_endpoint?new URL(Z.token_endpoint):new URL("/token",$),B=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(J)Y.set("resource",J.href);if(W)await W(B,Y,K,Z);else if(Q){let V=Z?.token_endpoint_auth_methods_supported??[],L=nb(Q,V);rb(L,Q,B,Y)}let D=await(G??fetch)(K,{method:"POST",headers:B,body:Y});if(!D.ok)throw await _V(D);return qV.parse(await D.json())}async function Gv($,{metadata:Z,clientInformation:Y,refreshToken:Q,resource:W,addClientAuthentication:J,fetchFn:G}){let K=new URLSearchParams({grant_type:"refresh_token",refresh_token:Q}),B=await CV($,{metadata:Z,tokenRequestParams:K,clientInformation:Y,addClientAuthentication:J,resource:W,fetchFn:G});return{refresh_token:Q,...B}}async function Kv($,Z,{metadata:Y,resource:Q,authorizationCode:W,fetchFn:J}={}){let G=$.clientMetadata.scope,K;if($.prepareTokenRequest)K=await $.prepareTokenRequest(G);if(!K){if(!W)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!$.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let D=await $.codeVerifier();K=Jv(W,D,$.redirectUrl)}let B=await $.clientInformation();return CV(Z,{metadata:Y,tokenRequestParams:K,clientInformation:B??void 0,addClientAuthentication:$.addClientAuthentication,resource:Q,fetchFn:J})}async function Hv($,{metadata:Z,clientMetadata:Y,scope:Q,fetchFn:W}){let J;if(Z){if(!Z.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");J=new URL(Z.registration_endpoint)}else J=new URL("/register",$);let G=await(W??fetch)(J,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...Y,...Q!==void 0?{scope:Q}:{}})});if(!G.ok)throw await _V(G);return MV.parse(await G.json())}class DW extends Error{constructor($,Z){super($),this.name="ParseError",this.type=Z.type,this.field=Z.field,this.value=Z.value,this.line=Z.line}}var IV=10,Bv=13,Z8=32;function FW($){}function S5($){if(typeof $=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:Z=FW,onError:Y=FW,onRetry:Q=FW,onComment:W}=$,J=[],G=!0,K,B="",D=0,V;function L(N){if(G&&(G=!1,N.charCodeAt(0)===239&&N.charCodeAt(1)===187&&N.charCodeAt(2)===191&&(N=N.slice(3))),J.length===0){let v=A(N);v!==""&&J.push(v);return}if(N.indexOf(`
|
|
943
943
|
`)===-1&&N.indexOf("\r")===-1){J.push(N);return}J.push(N);let E=J.join("");J.length=0;let f=A(E);f!==""&&J.push(f)}function A(N){let E=0;if(N.indexOf("\r")===-1){let f=N.indexOf(`
|
|
944
944
|
`,E);for(;f!==-1;){if(E===f){D>0&&Z({id:K,event:V,data:B}),K=void 0,B="",D=0,V=void 0,E=f+1,f=N.indexOf(`
|
|
945
945
|
`,E);continue}let v=N.charCodeAt(E);if(fV(N,E,v)){let y=N.charCodeAt(E+5)===Z8?E+6:E+5,$1=N.slice(y,f);if(D===0&&N.charCodeAt(f+1)===IV){Z({id:K,event:V,data:$1}),K=void 0,B="",V=void 0,E=f+2,f=N.indexOf(`
|
|
@@ -948,7 +948,7 @@ ${$1}`,D++}else SV(N,E,v)?V=N.slice(N.charCodeAt(E+6)===Z8?E+7:E+6,f)||void 0:O(
|
|
|
948
948
|
`,E)}return N.slice(E)}for(;E<N.length;){let f=N.indexOf("\r",E),v=N.indexOf(`
|
|
949
949
|
`,E),y=-1;if(f!==-1&&v!==-1?y=f<v?f:v:f!==-1?f===N.length-1?y=-1:y=f:v!==-1&&(y=v),y===-1)break;O(N,E,y),E=y+1,N.charCodeAt(E-1)===Bv&&N.charCodeAt(E)===IV&&E++}return N.slice(E)}function O(N,E,f){if(E===f){M();return}let v=N.charCodeAt(E);if(fV(N,E,v)){let _1=N.charCodeAt(E+5)===Z8?E+6:E+5,W0=N.slice(_1,f);B=D===0?W0:`${B}
|
|
950
950
|
${W0}`,D++;return}if(SV(N,E,v)){V=N.slice(N.charCodeAt(E+6)===Z8?E+7:E+6,f)||void 0;return}if(v===105&&N.charCodeAt(E+1)===100&&N.charCodeAt(E+2)===58){let _1=N.slice(N.charCodeAt(E+3)===Z8?E+4:E+3,f);K=_1.includes("\x00")?void 0:_1;return}if(v===58){if(W){let _1=N.slice(E,f);W(_1.slice(N.charCodeAt(E+1)===Z8?2:1))}return}let y=N.slice(E,f),$1=y.indexOf(":");if($1===-1){q(y,"",y);return}let j1=y.slice(0,$1),X0=y.charCodeAt($1+1)===Z8?2:1,F0=y.slice($1+X0);q(j1,F0,y)}function q(N,E,f){switch(N){case"event":V=E||void 0;break;case"data":B=D===0?E:`${B}
|
|
951
|
-
${E}`,D++;break;case"id":K=E.includes("\x00")?void 0:E;break;case"retry":/^\d+$/.test(E)?Q(parseInt(E,10)):Y(new DW(`Invalid \`retry\` value: "${E}"`,{type:"invalid-retry",value:E,line:f}));break;default:Y(new DW(`Unknown field "${N.length>20?`${N.slice(0,20)}\u2026`:N}"`,{type:"unknown-field",field:N,value:E,line:f}));break}}function M(){D>0&&Z({id:K,event:V,data:B}),K=void 0,B="",D=0,V=void 0}function I(N={}){if(N.consume&&J.length>0){let E=J.join("");O(E,0,E.length)}G=!0,K=void 0,B="",D=0,V=void 0,J.length=0}return{feed:L,reset:I}}function fV($,Z,Y){return Y===100&&$.charCodeAt(Z+1)===97&&$.charCodeAt(Z+2)===116&&$.charCodeAt(Z+3)===97&&$.charCodeAt(Z+4)===58}function SV($,Z,Y){return Y===101&&$.charCodeAt(Z+1)===118&&$.charCodeAt(Z+2)===101&&$.charCodeAt(Z+3)===110&&$.charCodeAt(Z+4)===116&&$.charCodeAt(Z+5)===58}class VW extends TransformStream{constructor({onError:$,onRetry:Z,onComment:Y}={}){let Q;super({start(W){Q=S5({onEvent:(J)=>{W.enqueue(J)},onError(J){$==="terminate"?W.error(J):typeof $=="function"&&$(J)},onRetry:Z,onComment:Y})},transform(W){Q.feed(W)}})}}var Fv={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Y8 extends Error{constructor($,Z){super(`Streamable HTTP error: ${Z}`);this.code=$}}class b5{constructor($,Z){this._hasCompletedAuthFlow=!1,this._url=$,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=Z?.requestInit,this._authProvider=Z?.authProvider,this._fetch=Z?.fetch,this._fetchWithInit=z5(Z?.fetch,Z?.requestInit),this._sessionId=Z?.sessionId,this._reconnectionOptions=Z?.reconnectionOptions??Fv}async _authThenStart(){if(!this._authProvider)throw new e1("No auth provider");let $;try{$=await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(Z){throw this.onerror?.(Z),Z}if($!=="AUTHORIZED")throw new e1;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let $={};if(this._authProvider){let Y=await this._authProvider.tokens();if(Y)$.Authorization=`Bearer ${Y.access_token}`}if(this._sessionId)$["mcp-session-id"]=this._sessionId;if(this._protocolVersion)$["mcp-protocol-version"]=this._protocolVersion;let Z=a8(this._requestInit?.headers);return new Headers({...$,...Z})}async _startOrAuthSse($){let{resumptionToken:Z}=$;try{let Y=await this._commonHeaders();if(Y.set("Accept","text/event-stream"),Z)Y.set("last-event-id",Z);let Q=await(this._fetch??fetch)(this._url,{method:"GET",headers:Y,signal:this._abortController?.signal});if(!Q.ok){if(await Q.body?.cancel(),Q.status===401&&this._authProvider)return await this._authThenStart();if(Q.status===405)return;throw new Y8(Q.status,`Failed to open SSE stream: ${Q.statusText}`)}this._handleSseStream(Q.body,$,!0)}catch(Y){throw this.onerror?.(Y),Y}}_getNextReconnectionDelay($){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let Z=this._reconnectionOptions.initialReconnectionDelay,Y=this._reconnectionOptions.reconnectionDelayGrowFactor,Q=this._reconnectionOptions.maxReconnectionDelay;return Math.min(Z*Math.pow(Y,$),Q)}_scheduleReconnection($,Z=0){let Y=this._reconnectionOptions.maxRetries;if(Z>=Y){this.onerror?.(Error(`Maximum reconnection attempts (${Y}) exceeded.`));return}let Q=this._getNextReconnectionDelay(Z);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse($).catch((W)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${W instanceof Error?W.message:String(W)}`)),this._scheduleReconnection($,Z+1)})},Q)}_handleSseStream($,Z,Y){if(!$)return;let{onresumptiontoken:Q,replayMessageId:W}=Z,J,G=!1,K=!1;(async()=>{try{let D=$.pipeThrough(new TextDecoderStream).pipeThrough(new VW({onRetry:(A)=>{this._serverRetryMs=A}})).getReader();while(!0){let{value:A,done:O}=await D.read();if(O)break;if(A.id)J=A.id,G=!0,Q?.(A.id);if(!A.data)continue;if(!A.event||A.event==="message")try{let q=w6.parse(JSON.parse(A.data));if(n6(q)){if(K=!0,W!==void 0)q.id=W}this.onmessage?.(q)}catch(q){this.onerror?.(q)}}if((Y||G)&&!K&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Q,replayMessageId:W},0)}catch(D){if(this.onerror?.(Error(`SSE stream disconnected: ${D}`)),(Y||G)&&!K&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Q,replayMessageId:W},0)}catch(A){this.onerror?.(Error(`Failed to reconnect: ${A instanceof Error?A.message:String(A)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth($){if(!this._authProvider)throw new e1("No auth provider");if(await p0(this._authProvider,{serverUrl:this._url,authorizationCode:$,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send($,Z){try{let{resumptionToken:Y,onresumptiontoken:Q}=Z||{};if(Y){this._startOrAuthSse({resumptionToken:Y,replayMessageId:x9($)?$.id:void 0}).catch((L)=>this.onerror?.(L));return}let W=await this._commonHeaders();W.set("content-type","application/json"),W.set("accept","application/json, text/event-stream");let J={...this._requestInit,method:"POST",headers:W,body:JSON.stringify($),signal:this._abortController?.signal},G=await(this._fetch??fetch)(this._url,J),K=G.headers.get("mcp-session-id");if(K)this._sessionId=K;if(!G.ok){let L=await G.text().catch(()=>null);if(G.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Y8(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:A,scope:O}=$9(G);if(this._resourceMetadataUrl=A,this._scope=O,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1;return this._hasCompletedAuthFlow=!0,this.send($)}if(G.status===403&&this._authProvider){let{resourceMetadataUrl:A,scope:O,error:q}=$9(G);if(q==="insufficient_scope"){let M=G.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===M)throw new Y8(403,"Server returned 403 after trying upscoping");if(O)this._scope=O;if(A)this._resourceMetadataUrl=A;if(this._lastUpscopingHeader=M??void 0,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new e1;return this.send($)}}throw new Y8(G.status,`Error POSTing to endpoint: ${L}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,G.status===202){if(await G.body?.cancel(),_K($))this._startOrAuthSse({resumptionToken:void 0}).catch((L)=>this.onerror?.(L));return}let D=(Array.isArray($)?$:[$]).filter((L)=>("method"in L)&&("id"in L)&&L.id!==void 0).length>0,V=G.headers.get("content-type");if(D)if(V?.includes("text/event-stream"))this._handleSseStream(G.body,{onresumptiontoken:Q},!1);else if(V?.includes("application/json")){let L=await G.json(),A=Array.isArray(L)?L.map((O)=>w6.parse(O)):[w6.parse(L)];for(let O of A)this.onmessage?.(O)}else throw await G.body?.cancel(),new Y8(-1,`Unexpected content type: ${V}`);else await G.body?.cancel()}catch(Y){throw this.onerror?.(Y),Y}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let $=await this._commonHeaders(),Z={...this._requestInit,method:"DELETE",headers:$,signal:this._abortController?.signal},Y=await(this._fetch??fetch)(this._url,Z);if(await Y.body?.cancel(),!Y.ok&&Y.status!==405)throw new Y8(Y.status,`Failed to terminate session: ${Y.statusText}`);this._sessionId=void 0}catch($){throw this.onerror?.($),$}}setProtocolVersion($){this._protocolVersion=$}get protocolVersion(){return this._protocolVersion}async resumeStream($,Z){await this._startOrAuthSse({resumptionToken:$,onresumptiontoken:Z?.onresumptiontoken})}}function LW($){return{is(Z){if(!Z)return null;if(!Z.startsWith($))return null;return Z.slice($.length)||null},get(Z){return`${$}${Z}`}}}var bV=LW("decopilot_"),Vv=bV.is,A7=bV.get;var vV=LW("brand-context-setup_"),Lv=vV.is,Uv=vV.get,
|
|
951
|
+
${E}`,D++;break;case"id":K=E.includes("\x00")?void 0:E;break;case"retry":/^\d+$/.test(E)?Q(parseInt(E,10)):Y(new DW(`Invalid \`retry\` value: "${E}"`,{type:"invalid-retry",value:E,line:f}));break;default:Y(new DW(`Unknown field "${N.length>20?`${N.slice(0,20)}\u2026`:N}"`,{type:"unknown-field",field:N,value:E,line:f}));break}}function M(){D>0&&Z({id:K,event:V,data:B}),K=void 0,B="",D=0,V=void 0}function I(N={}){if(N.consume&&J.length>0){let E=J.join("");O(E,0,E.length)}G=!0,K=void 0,B="",D=0,V=void 0,J.length=0}return{feed:L,reset:I}}function fV($,Z,Y){return Y===100&&$.charCodeAt(Z+1)===97&&$.charCodeAt(Z+2)===116&&$.charCodeAt(Z+3)===97&&$.charCodeAt(Z+4)===58}function SV($,Z,Y){return Y===101&&$.charCodeAt(Z+1)===118&&$.charCodeAt(Z+2)===101&&$.charCodeAt(Z+3)===110&&$.charCodeAt(Z+4)===116&&$.charCodeAt(Z+5)===58}class VW extends TransformStream{constructor({onError:$,onRetry:Z,onComment:Y}={}){let Q;super({start(W){Q=S5({onEvent:(J)=>{W.enqueue(J)},onError(J){$==="terminate"?W.error(J):typeof $=="function"&&$(J)},onRetry:Z,onComment:Y})},transform(W){Q.feed(W)}})}}var Fv={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Y8 extends Error{constructor($,Z){super(`Streamable HTTP error: ${Z}`);this.code=$}}class b5{constructor($,Z){this._hasCompletedAuthFlow=!1,this._url=$,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=Z?.requestInit,this._authProvider=Z?.authProvider,this._fetch=Z?.fetch,this._fetchWithInit=z5(Z?.fetch,Z?.requestInit),this._sessionId=Z?.sessionId,this._reconnectionOptions=Z?.reconnectionOptions??Fv}async _authThenStart(){if(!this._authProvider)throw new e1("No auth provider");let $;try{$=await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(Z){throw this.onerror?.(Z),Z}if($!=="AUTHORIZED")throw new e1;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let $={};if(this._authProvider){let Y=await this._authProvider.tokens();if(Y)$.Authorization=`Bearer ${Y.access_token}`}if(this._sessionId)$["mcp-session-id"]=this._sessionId;if(this._protocolVersion)$["mcp-protocol-version"]=this._protocolVersion;let Z=a8(this._requestInit?.headers);return new Headers({...$,...Z})}async _startOrAuthSse($){let{resumptionToken:Z}=$;try{let Y=await this._commonHeaders();if(Y.set("Accept","text/event-stream"),Z)Y.set("last-event-id",Z);let Q=await(this._fetch??fetch)(this._url,{method:"GET",headers:Y,signal:this._abortController?.signal});if(!Q.ok){if(await Q.body?.cancel(),Q.status===401&&this._authProvider)return await this._authThenStart();if(Q.status===405)return;throw new Y8(Q.status,`Failed to open SSE stream: ${Q.statusText}`)}this._handleSseStream(Q.body,$,!0)}catch(Y){throw this.onerror?.(Y),Y}}_getNextReconnectionDelay($){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let Z=this._reconnectionOptions.initialReconnectionDelay,Y=this._reconnectionOptions.reconnectionDelayGrowFactor,Q=this._reconnectionOptions.maxReconnectionDelay;return Math.min(Z*Math.pow(Y,$),Q)}_scheduleReconnection($,Z=0){let Y=this._reconnectionOptions.maxRetries;if(Z>=Y){this.onerror?.(Error(`Maximum reconnection attempts (${Y}) exceeded.`));return}let Q=this._getNextReconnectionDelay(Z);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse($).catch((W)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${W instanceof Error?W.message:String(W)}`)),this._scheduleReconnection($,Z+1)})},Q)}_handleSseStream($,Z,Y){if(!$)return;let{onresumptiontoken:Q,replayMessageId:W}=Z,J,G=!1,K=!1;(async()=>{try{let D=$.pipeThrough(new TextDecoderStream).pipeThrough(new VW({onRetry:(A)=>{this._serverRetryMs=A}})).getReader();while(!0){let{value:A,done:O}=await D.read();if(O)break;if(A.id)J=A.id,G=!0,Q?.(A.id);if(!A.data)continue;if(!A.event||A.event==="message")try{let q=w6.parse(JSON.parse(A.data));if(n6(q)){if(K=!0,W!==void 0)q.id=W}this.onmessage?.(q)}catch(q){this.onerror?.(q)}}if((Y||G)&&!K&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Q,replayMessageId:W},0)}catch(D){if(this.onerror?.(Error(`SSE stream disconnected: ${D}`)),(Y||G)&&!K&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Q,replayMessageId:W},0)}catch(A){this.onerror?.(Error(`Failed to reconnect: ${A instanceof Error?A.message:String(A)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth($){if(!this._authProvider)throw new e1("No auth provider");if(await p0(this._authProvider,{serverUrl:this._url,authorizationCode:$,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send($,Z){try{let{resumptionToken:Y,onresumptiontoken:Q}=Z||{};if(Y){this._startOrAuthSse({resumptionToken:Y,replayMessageId:x9($)?$.id:void 0}).catch((L)=>this.onerror?.(L));return}let W=await this._commonHeaders();W.set("content-type","application/json"),W.set("accept","application/json, text/event-stream");let J={...this._requestInit,method:"POST",headers:W,body:JSON.stringify($),signal:this._abortController?.signal},G=await(this._fetch??fetch)(this._url,J),K=G.headers.get("mcp-session-id");if(K)this._sessionId=K;if(!G.ok){let L=await G.text().catch(()=>null);if(G.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Y8(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:A,scope:O}=$9(G);if(this._resourceMetadataUrl=A,this._scope=O,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1;return this._hasCompletedAuthFlow=!0,this.send($)}if(G.status===403&&this._authProvider){let{resourceMetadataUrl:A,scope:O,error:q}=$9(G);if(q==="insufficient_scope"){let M=G.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===M)throw new Y8(403,"Server returned 403 after trying upscoping");if(O)this._scope=O;if(A)this._resourceMetadataUrl=A;if(this._lastUpscopingHeader=M??void 0,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new e1;return this.send($)}}throw new Y8(G.status,`Error POSTing to endpoint: ${L}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,G.status===202){if(await G.body?.cancel(),_K($))this._startOrAuthSse({resumptionToken:void 0}).catch((L)=>this.onerror?.(L));return}let D=(Array.isArray($)?$:[$]).filter((L)=>("method"in L)&&("id"in L)&&L.id!==void 0).length>0,V=G.headers.get("content-type");if(D)if(V?.includes("text/event-stream"))this._handleSseStream(G.body,{onresumptiontoken:Q},!1);else if(V?.includes("application/json")){let L=await G.json(),A=Array.isArray(L)?L.map((O)=>w6.parse(O)):[w6.parse(L)];for(let O of A)this.onmessage?.(O)}else throw await G.body?.cancel(),new Y8(-1,`Unexpected content type: ${V}`);else await G.body?.cancel()}catch(Y){throw this.onerror?.(Y),Y}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let $=await this._commonHeaders(),Z={...this._requestInit,method:"DELETE",headers:$,signal:this._abortController?.signal},Y=await(this._fetch??fetch)(this._url,Z);if(await Y.body?.cancel(),!Y.ok&&Y.status!==405)throw new Y8(Y.status,`Failed to terminate session: ${Y.statusText}`);this._sessionId=void 0}catch($){throw this.onerror?.($),$}}setProtocolVersion($){this._protocolVersion=$}get protocolVersion(){return this._protocolVersion}async resumeStream($,Z){await this._startOrAuthSse({resumptionToken:$,onresumptiontoken:Z?.onresumptiontoken})}}function LW($){return{is(Z){if(!Z)return null;if(!Z.startsWith($))return null;return Z.slice($.length)||null},get(Z){return`${$}${Z}`}}}var bV=LW("decopilot_"),Vv=bV.is,A7=bV.get;var vV=LW("brand-context-setup_"),Lv=vV.is,Uv=vV.get,lo=`
|
|
952
952
|
You are running the brand-context onboarding for the user's organization. Your only job in this thread is to set up the organization's brand context:
|
|
953
953
|
|
|
954
954
|
1. If the user hasn't already given you a website URL, ask for it in one short message. Accept whatever URL they give \u2014 don't quibble about format.
|
|
@@ -957,7 +957,7 @@ You are running the brand-context onboarding for the user's organization. Your o
|
|
|
957
957
|
4. Do NOT call any other tools in this thread. Do NOT call \`brand_context_setup\` more than once.
|
|
958
958
|
|
|
959
959
|
If the tool returns an error, surface the error message to the user and ask whether they want to try a different URL.
|
|
960
|
-
`.trim();var yV=LW("site-diagnostics_"),jv=yV.is,Av=yV.get;import{z as h}from"zod";var nv=h.object({authorizationEndpoint:h.string().url(),tokenEndpoint:h.string().url(),introspectionEndpoint:h.string().url().optional(),clientId:h.string(),clientSecret:h.string().optional(),scopes:h.array(h.string()),grantType:h.enum(["authorization_code","client_credentials"])}),kV=h.object({type:h.literal("object"),properties:h.record(h.string(),h.unknown()).optional(),required:h.array(h.string()).optional()}).catchall(h.unknown()),rv=C4.extend({inputSchema:kV,outputSchema:kV.optional()}),av=h.object({headers:h.record(h.string(),h.string()).optional()}),ov=h.object({command:h.string().describe("Command to run (e.g., 'npx', 'node')"),args:h.array(h.string()).optional().describe("Command arguments"),cwd:h.string().optional().describe("Working directory"),envVars:h.record(h.string(),h.string()).optional().describe("Environment variables (encrypted in storage)")}),v5=h.object({id:h.string().describe("Unique identifier for the connection"),title:h.string().describe("Human-readable name for the connection"),created_at:h.string().describe("When the connection was created"),updated_at:h.string().describe("When the connection was last updated"),created_by:h.string().describe("User ID who created the connection"),updated_by:h.string().optional().describe("User ID who last updated the connection"),organization_id:h.string().describe("Organization ID this connection belongs to"),description:h.string().nullable().describe("Description of the connection"),icon:h.string().nullable().describe("Icon URL for the connection"),app_name:h.string().nullable().describe("Associated app name"),app_id:h.string().nullable().describe("Associated app ID"),slug:h.string().nullable().optional().describe("URL-safe slug derived from app_name, connection_url, or title"),connection_type:h.enum(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:h.string().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:h.string().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:h.union([ov,av]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:nv.nullable().describe("OAuth configuration"),configuration_state:h.record(h.string(),h.unknown()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:h.array(h.string()).nullable().optional().describe("Configuration scopes"),metadata:h.record(h.string(),h.unknown()).nullable().describe("Additional metadata (includes repository info)"),tools:h.array(rv).nullable().describe("Discovered tools from MCP"),bindings:h.array(h.string()).nullable().describe("Detected bindings"),status:h.enum(["active","inactive","error"]).describe("Current status")}),xV=v5.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0}).extend({icon:h.string().nullish()}),gV=v5.partial();import{z as C}from"zod";var z7=C.object({connection_id:C.string().describe("Connection ID"),selected_tools:C.array(C.string()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:C.array(C.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:C.array(C.string()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),mV=z7.extend({selected_tools:z7.shape.selected_tools.optional(),selected_resources:z7.shape.selected_resources.optional(),selected_prompts:z7.shape.selected_prompts.optional()}),sv=C.object({connectionId:C.string(),toolName:C.string(),label:C.string(),icon:C.string().nullable().optional()}),OW=C.object({id:C.string().describe("Stable id; used as React key and ?tab= value"),title:C.string().describe("Tab label"),icon:C.string().optional().describe("Optional lucide icon name"),view:C.object({type:C.literal("ext-app"),appId:C.string(),args:C.record(C.string(),C.unknown()).optional()})}),qW=C.object({defaultMainView:C.object({type:C.string(),id:C.string().optional(),toolName:C.string().optional()}).nullable().optional(),chatDefaultOpen:C.boolean().nullable().optional(),tabs:C.array(OW).optional()}),uV=C.object({connectionId:C.string().optional().describe("Connection that owns the resource \u2014 the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:C.string().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),minHeight:C.number().int().positive().optional(),maxHeight:C.number().int().positive().optional()}),NW=C.object({banner:C.string().nullable().optional(),bannerColor:C.string().nullable().optional(),icon:C.string().nullable().optional(),themeColor:C.string().nullable().optional(),pinnedViews:C.array(sv).nullable().optional(),layout:qW.nullable().optional(),homeTile:uV.nullable().optional(),homeTiles:C.array(uV).nullable().optional(),homePrompts:C.array(C.string()).nullable().optional()});var MW=/^[A-Za-z_][A-Za-z0-9_]*$/,hV=C.string().min(1).regex(MW,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),tv=C.discriminatedUnion("kind",[C.object({key:hV,kind:C.literal("literal"),value:C.string()}),C.object({key:hV,kind:C.literal("secret"),secretId:C.string().min(1)})]),PW=C.object({selected:C.string().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:C.string().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:C.string().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:C.array(tv).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that mesh resolves via the credential vault before posting /_sandbox/config.")}),wW=C.object({url:C.string().describe("GitHub repository URL"),owner:C.string().describe("Repository owner"),name:C.string().describe("Repository name"),installationId:C.number().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:C.string().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),ev=C.enum(["agent-sandbox","user-desktop"]),$y=C.enum(["agent-sandbox","user-desktop","cluster"]);var lV={sandboxHandle:C.string().describe("Provider-specific handle"),previewUrl:C.string().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:C.string().nullable().optional().describe("Daemon's public URL \u2014 what cluster\u2192daemon RPCs target. Equal to previewUrl for user-desktop; null/absent for the agent-sandbox provider (routes through hosted ingress)."),sandboxProviderKind:ev.optional(),createdAt:C.number().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:C.object({packageManager:C.string().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:C.string().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:C.string().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},EW=C.object(lV),qs=C.object({...lV,sandboxProviderKind:$y.optional()});var O7=C.record(C.string().describe("userId"),C.record(C.string().describe("branch"),C.record(C.string().describe("sandboxProviderKind"),EW)));var pV=C.object({id:C.string().describe("Unique identifier"),title:C.string().describe("Human-readable name"),description:C.string().nullable().describe("Description"),icon:C.string().nullable().describe("Icon URL"),created_at:C.string().describe("Creation timestamp"),updated_at:C.string().describe("Last update timestamp"),created_by:C.string().describe("User ID who created this item"),updated_by:C.string().optional().describe("User ID who last updated this item"),organization_id:C.string().describe("Organization ID this item belongs to"),status:C.enum(["active","inactive"]).describe("Current status"),pinned:C.boolean().describe("Whether this space is pinned to the sidebar"),metadata:C.object({instructions:C.string().nullable().describe("Instructions also used as system prompt"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:C.array(z7).describe("Connections with their selected tools, resources, and prompts")}),iV=C.object({title:C.string().min(1).max(255).describe("Name for the virtual MCP"),description:C.string().nullable().optional().describe("Optional description"),icon:C.string().nullish().describe("Optional icon URL"),status:C.enum(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:C.boolean().optional().default(!1).describe("Pin to sidebar"),metadata:C.object({instructions:C.string().nullable().optional().describe("MCP server instructions"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C.array(mV).describe("Connections to include/exclude (can be empty for exclusion mode)")}),cV=C.object({title:C.string().min(1).max(255).optional().describe("New name"),description:C.string().nullable().optional().describe("New description (null to clear)"),icon:C.string().nullish().describe("New icon URL"),status:C.enum(["active","inactive"]).optional().describe("New status"),pinned:C.boolean().optional().describe("Pin/unpin from sidebar"),metadata:C.object({instructions:C.string().nullable().optional().describe("MCP server instructions"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C.array(mV).optional().describe("New connections (replaces existing)")});var RW=["in_progress","requires_action","failed","completed"],dV=[...RW,"expired"],_W={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},nV=Object.values(_W);var rV;(function($){$.Completable="McpCompletable"})(rV||(rV={}));import{ZodOptional as Lt}from"zod";var eV="MCP Workflows",$L="Create workflows using your MCP tools";import{sql as ZL}from"kysely";var YL={name:"001-workflows",async up($){await $.schema.createTable("workflow_collection").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(Z)=>Z.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(Z)=>Z.notNull()).addColumn("steps","text",(Z)=>Z.notNull().defaultTo("[]")).addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(ZL`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(Z)=>Z.notNull().defaultTo(ZL`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await $.schema.createIndex("idx_wf_collection_org").ifNotExists().on("workflow_collection").column("organization_id").execute(),await $.schema.createIndex("idx_wf_collection_created_at").ifNotExists().on("workflow_collection").column("created_at").execute(),await $.schema.createTable("workflow").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(Z)=>Z.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(Z)=>Z.notNull()).addColumn("created_at_epoch_ms","bigint",(Z)=>Z.notNull()).addColumn("created_by","text").execute(),await $.schema.createIndex("idx_workflow_created_at").ifNotExists().on("workflow").column("created_at_epoch_ms").execute(),await $.schema.createIndex("idx_workflow_collection_id").ifNotExists().on("workflow").column("workflow_collection_id").execute(),await $.schema.createTable("workflow_execution").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("workflow_id","text",(Z)=>Z.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(Z)=>Z.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(Z)=>Z.notNull()).addColumn("updated_at","bigint",(Z)=>Z.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await $.schema.createIndex("idx_wf_execution_status").ifNotExists().on("workflow_execution").column("status").execute(),await $.schema.createIndex("idx_wf_execution_workflow_id").ifNotExists().on("workflow_execution").column("workflow_id").execute(),await $.schema.createIndex("idx_wf_execution_org").ifNotExists().on("workflow_execution").column("organization_id").execute(),await $.schema.createIndex("idx_wf_execution_created_at").ifNotExists().on("workflow_execution").column("created_at").execute(),await $.schema.createTable("workflow_execution_step_result").ifNotExists().addColumn("execution_id","text",(Z)=>Z.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(Z)=>Z.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await $.schema.createIndex("idx_wf_step_result_pk").ifNotExists().on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await $.schema.createIndex("idx_wf_step_result_execution").ifNotExists().on("workflow_execution_step_result").column("execution_id").execute()},async down($){await $.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await $.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await $.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await $.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await $.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await $.schema.dropTable("workflow_execution").ifExists().execute(),await $.schema.dropTable("workflow").ifExists().execute(),await $.schema.dropTable("workflow_collection").ifExists().execute()}};var QL={name:"002-execution-list-index",async up($){await $.schema.createIndex("idx_wf_execution_org_created_at").ifNotExists().on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down($){await $.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}};var XL={name:"003-retry-and-input-schema",async up($){await $.schema.alterTable("workflow_execution_step_result").addColumn("attempt_number","integer",(Z)=>Z.notNull().defaultTo(1)).execute(),await $.schema.alterTable("workflow_collection").addColumn("input_schema","text").execute()},async down($){await $.schema.alterTable("workflow_execution_step_result").dropColumn("attempt_number").execute(),await $.schema.alterTable("workflow_collection").dropColumn("input_schema").execute()}};var WL=[YL,QL,XL];function $0($){let Z=$;if(!Z.organization)throw Error("Organization context required for workflow tools");return Z}function S1($){if($===null||$===void 0)return null;if(typeof $==="object")return $;if(typeof $!=="string")return $;try{return JSON.parse($)}catch{return $}}var CW=null;function JL($){CW=$}function u1(){if(!CW)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return CW}function GL($){return{...$,steps:S1($.steps)??[],input_schema:S1($.input_schema)??null}}class IW{db;constructor($){this.db=$}async list($,Z={}){let{limit:Y=50,offset:Q=0}=Z,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",$).orderBy("created_at","desc").limit(Y).offset(Q).execute(),J=await this.db.selectFrom("workflow_collection").select((G)=>G.fn.countAll().as("count")).where("organization_id","=",$).executeTakeFirstOrThrow();return{items:W,totalCount:Number(J.count)}}async getById($,Z){let Y=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst();return Y?GL(Y):null}async create($){let{input_schema:Z,...Y}=$,Q=await this.db.insertInto("workflow_collection").values({...Y,input_schema:Z!=null?JSON.stringify(Z):null}).returningAll().executeTakeFirstOrThrow();return GL(Q)}async update($,Z,Y){let{input_schema:Q,...W}=Y,J={...W,updated_at:new Date().toISOString()};if(Q!==void 0)J.input_schema=Q?JSON.stringify(Q):null;return await this.db.updateTable("workflow_collection").set(J).where("id","=",$).where("organization_id","=",Z).returningAll().executeTakeFirstOrThrow()}async delete($,Z){return await this.db.deleteFrom("workflow_collection").where("id","=",$).where("organization_id","=",Z).returningAll().executeTakeFirstOrThrow()}}function Uy($){return{...$,steps:S1($.steps)??[],input:S1($.input)??null}}function k6($){return{...$,output:S1($.output),error:S1($.error),raw_tool_output:S1($.raw_tool_output)}}class fW{db;constructor($){this.db=$}async _createWorkflow($,Z){let Y=crypto.randomUUID(),Q=Date.now();return await $.insertInto("workflow").values({id:Y,workflow_collection_id:Z.workflowCollectionId??null,organization_id:Z.organizationId,steps:JSON.stringify(Z.steps),input:Z.input?JSON.stringify(Z.input):null,virtual_mcp_id:Z.virtualMcpId,created_at_epoch_ms:Q,created_by:Z.createdBy??null}).execute(),{id:Y}}async createWorkflow($){return this._createWorkflow(this.db,$)}async getWorkflow($){let Z=await this.db.selectFrom("workflow").selectAll().where("id","=",$).executeTakeFirst();return Z?Uy(Z):null}async createExecution($){return this.db.transaction().execute(async(Z)=>{let Y=Date.now(),{id:Q}=await this._createWorkflow(Z,{organizationId:$.organizationId,workflowCollectionId:$.workflowCollectionId,virtualMcpId:$.virtualMcpId,input:$.input,steps:$.steps,createdBy:$.createdBy}),W=crypto.randomUUID(),J=$.startAtEpochMs??Y,G=$.timeoutMs?J+$.timeoutMs:null;return await Z.insertInto("workflow_execution").values({id:W,workflow_id:Q,organization_id:$.organizationId,status:"enqueued",input:$.input?JSON.stringify($.input):null,created_at:Y,updated_at:Y,start_at_epoch_ms:J,timeout_ms:$.timeoutMs??null,deadline_at_epoch_ms:G,created_by:$.createdBy??null}).execute(),{id:W}})}async getExecution($,Z){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst()??null}async getExecutionFull($,Z){let Y=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst();if(!Y)return null;let Q=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).execute();return{execution:Y,stepResults:Q.map(k6)}}async getExecutionContext($){let[Z,Y]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",$).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","started_at_epoch_ms","completed_at_epoch_ms","output","error","attempt_number"]).where("execution_id","=",$).execute()]);if(!Z)return null;return{execution:{id:Z.id,status:Z.status,workflow_id:Z.workflow_id,deadline_at_epoch_ms:Z.deadline_at_epoch_ms},workflow:{steps:S1(Z.steps)??[],input:S1(Z.input)??null,virtual_mcp_id:Z.virtual_mcp_id},stepResults:Y.map((Q)=>({step_id:Q.step_id,started_at_epoch_ms:Q.started_at_epoch_ms,completed_at_epoch_ms:Q.completed_at_epoch_ms,output:S1(Q.output),error:S1(Q.error),attempt_number:Q.attempt_number}))}}async claimExecution($){let Z=Date.now(),Y=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:Z}).where("id","=",$).where("status","=","enqueued").returningAll().executeTakeFirst();if(!Y)return null;let Q=await this.getWorkflow(Y.workflow_id);if(!Q)throw Error(`Workflow ${Y.workflow_id} not found for execution ${$}`);return{execution:Y,workflow:Q}}async updateExecution($,Z,Y){let W={updated_at:Date.now()};if(Z.status!==void 0)W.status=Z.status;if(Z.output!==void 0)W.output=JSON.stringify(Z.output);if(Z.error!==void 0)W.error=JSON.stringify(Z.error);if(Z.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=Z.completed_at_epoch_ms;let J=this.db.updateTable("workflow_execution").set(W).where("id","=",$);if(Y?.onlyIfStatus)J=J.where("status","=",Y.onlyIfStatus);return await J.returningAll().executeTakeFirst()??null}async cancelExecution($,Z){let Y=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:Y}).where("id","=",$).where("organization_id","=",Z).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution($,Z){return this.db.transaction().execute(async(Y)=>{let Q=Date.now(),W=await Y.selectFrom("workflow_execution").where("id","=",$).where("organization_id","=",Z).select(["status"]).executeTakeFirst();if(!W)return!1;let{status:J}=W;if(J==="success"){let B=await Y.selectFrom("workflow_execution_step_result").where("execution_id","=",$).where("error","is not",null).select(Y.fn.countAll().as("count")).executeTakeFirstOrThrow();if(Number(B.count)===0)return!1}else if(J!=="cancelled"&&J!=="error")return!1;await Y.updateTable("workflow_execution").set({status:"enqueued",updated_at:Q,completed_at_epoch_ms:null,error:null}).where("id","=",$).execute();let G=await Y.selectFrom("workflow_execution_step_result").where("execution_id","=",$).where("error","is not",null).where("step_id","like","%[%").select("step_id").execute(),K=new Set;for(let B of G)K.add(B.step_id.replace(/\[\d+\]$/,""));if(await Y.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where((B)=>B.or([B("completed_at_epoch_ms","is",null),B("error","is not",null)])).execute(),K.size>0)await Y.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where("step_id","in",[...K]).execute();return!0})}async listExecutions($,Z={}){let{limit:Y=50,offset:Q=0,status:W,workflowCollectionId:J}=Z,G=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((L)=>L.fn.coalesce("wc.title",L.val("Workflow Execution")).as("title")).where("we.organization_id","=",$);if(W)G=G.where("we.status","=",W);if(J)G=G.where("w.workflow_collection_id","=",J);let K=await G.orderBy("we.created_at","desc").limit(Y).offset(Q).execute(),B=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select((L)=>L.fn.countAll().as("count")).where("we.organization_id","=",$);if(W)B=B.where("we.status","=",W);if(J)B=B.where("w.workflow_collection_id","=",J);let D=await B.executeTakeFirstOrThrow(),V=Number(D.count);return{items:K,totalCount:V,hasMore:Q+K.length<V}}async createStepResult($){let Z=await this.db.insertInto("workflow_execution_step_result").values({execution_id:$.execution_id,step_id:$.step_id,started_at_epoch_ms:$.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:$.completed_at_epoch_ms??null,output:$.output!==void 0?JSON.stringify($.output):null,error:$.error!==void 0?JSON.stringify($.error):null,attempt_number:1}).onConflict((Y)=>Y.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return Z?k6(Z):null}async updateStepResult($,Z,Y){let Q={};if(Y.output!==void 0)Q.output=Y.output===null?null:JSON.stringify(Y.output);if(Y.error!==void 0)Q.error=Y.error===null?null:JSON.stringify(Y.error);if(Y.started_at_epoch_ms!==void 0)Q.started_at_epoch_ms=Y.started_at_epoch_ms;if(Y.completed_at_epoch_ms!==void 0)Q.completed_at_epoch_ms=Y.completed_at_epoch_ms;if(Y.attempt_number!==void 0)Q.attempt_number=Y.attempt_number;if(Y.raw_tool_output!==void 0)Q.raw_tool_output=Y.raw_tool_output===null?null:JSON.stringify(Y.raw_tool_output);if(Object.keys(Q).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(Q).where("execution_id","=",$).where("step_id","=",Z).returningAll().executeTakeFirst();return W?k6(W):null}async claimStepForRetry($,Z,Y){let Q=await this.db.updateTable("workflow_execution_step_result").set({started_at_epoch_ms:Date.now()}).where("execution_id","=",$).where("step_id","=",Z).where("attempt_number","=",Y).where("started_at_epoch_ms","is",null).returningAll().executeTakeFirst();return Q?k6(Q):null}async resetStepResultForRetry($,Z,Y){await this.updateStepResult($,Z,{completed_at_epoch_ms:null,output:null,error:null,started_at_epoch_ms:null,attempt_number:Y,raw_tool_output:null})}async checkpointAndTransform($,Z,Y,Q){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(Y)}).where("execution_id","=",$).where("step_id","=",Z).execute();let W,J;try{let B=await Q(Y);W=B.output,J=B.error}catch(B){J=B instanceof Error?`Transform failed: ${B.message}`:`Transform failed: ${String(B)}`}let G={completed_at_epoch_ms:Date.now()};if(W!==void 0)G.output=JSON.stringify(W);if(J!==void 0)G.error=JSON.stringify(J);let K=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",$).where("step_id","=",Z).returningAll().executeTakeFirst();return K?k6(K):null}async getStepResult($,Z){let Y=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).where("step_id","=",Z).executeTakeFirst();return Y?k6(Y):null}async getStepResults($){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).execute()).map(k6)}async deleteStepResult($,Z){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where("step_id","=",Z).execute()}async getStepResultsByPrefix($,Z){let Y=Z.replaceAll("\\","\\\\").replaceAll("%","\\%").replaceAll("_","\\_");return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).where("step_id","like",`${Y}%`).orderBy("step_id").execute()).map(k6)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}function KL($){let Z=$.db;return{collections:new IW(Z),executions:new fW(Z)}}import{z as c}from"zod";import{z as T}from"zod";import{z as O0}from"zod/v4";import{z as HL}from"zod/v4";import{z as y5}from"zod/v4";import{z as i0}from"zod/v4";import{z as Oy}from"zod/v4";import{z as Q8}from"zod/v4";import{z as c0}from"zod/v4";import{z as b1}from"zod/v4";import{z as BL}from"zod/v4";import{z as x5}from"zod/v4";import{z as ly}from"zod/v4";import{z as FL}from"zod/v4";import{z as T5}from"zod/v4";import{z as sy}from"zod/v4";var jy=class{apply($,Z){if(!Z.type)return;let Y=Array.isArray(Z.type)?Z.type:[Z.type],Q=new Set(Y);if(!Q.has("string"))$.string=!1;if(!Q.has("number")&&!Q.has("integer"))$.number=!1;if(!Q.has("boolean"))$.boolean=!1;if(!Q.has("null"))$.null=!1;if(!Q.has("array"))$.array=!1;if(!Q.has("object"))$.object=!1;if(Q.has("integer")&&$.number!==!1){let W=$.number||HL.number();if(W instanceof HL.ZodNumber)$.number=W.int()}}},Ay=class{apply($,Z){if(Z.const===void 0)return;let Y=Z.const;if($.string=!1,$.number=!1,$.boolean=!1,$.null=!1,$.array=!1,$.object=!1,typeof Y==="string")$.string=y5.literal(Y);else if(typeof Y==="number")$.number=y5.literal(Y);else if(typeof Y==="boolean")$.boolean=y5.literal(Y);else if(Y===null)$.null=y5.null();else if(Array.isArray(Y))$.array=void 0;else if(typeof Y==="object")$.object=void 0}},zy=class{apply($,Z){if(!Z.enum)return;if(Z.enum.length===0){if(!Z.type)$.string=!1,$.number=!1,$.boolean=!1,$.null=!1,$.array=!1,$.object=!1;return}let Y={string:Z.enum.filter((Q)=>typeof Q==="string"),number:Z.enum.filter((Q)=>typeof Q==="number"),boolean:Z.enum.filter((Q)=>typeof Q==="boolean"),null:Z.enum.filter((Q)=>Q===null),array:Z.enum.filter((Q)=>Array.isArray(Q)),object:Z.enum.filter((Q)=>typeof Q==="object"&&Q!==null&&!Array.isArray(Q))};$.string=this.createTypeSchema(Y.string,"string"),$.number=this.createTypeSchema(Y.number,"number"),$.boolean=this.createTypeSchema(Y.boolean,"boolean"),$.null=Y.null.length>0?i0.null():!1,$.array=Y.array.length>0?void 0:!1,$.object=Y.object.length>0?void 0:!1}createTypeSchema($,Z){if($.length===0)return!1;if($.length===1)return i0.literal($[0]);if(Z==="string")return i0.enum($);if(Z==="number"){let[Y,Q,...W]=$;return i0.union([i0.literal(Y),i0.literal(Q),...W.map((J)=>i0.literal(J))])}if(Z==="boolean")return i0.union([i0.literal(!0),i0.literal(!1)]);return!1}},qy=class{apply($,Z){let Y=Z;if(Y.type==="string"&&Y.format==="binary"&&Y.contentEncoding==="binary"){let Q=Oy.file();if(Y.minLength!==void 0)Q=Q.min(Y.minLength);if(Y.maxLength!==void 0)Q=Q.max(Y.maxLength);if(Y.contentMediaType!==void 0)Q=Q.mime(Y.contentMediaType);$.file=Q,$.string=!1}}},Ny=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.minLength!==void 0||Y.maxLength!==void 0||Y.pattern!==void 0)){if($.string===void 0)$.string=Q8.string()}}},My=class{apply($,Z){let Y=Z;if(Y.minLength===void 0)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString)$.string=Q.refine((W)=>{return Array.from(W).length>=Y.minLength},{message:`String must be at least ${Y.minLength} characters long`})}}},Py=class{apply($,Z){let Y=Z;if(Y.maxLength===void 0)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString)$.string=Q.refine((W)=>{return Array.from(W).length<=Y.maxLength},{message:`String must be at most ${Y.maxLength} characters long`})}}},wy=class{apply($,Z){let Y=Z;if(!Y.pattern)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString){let W=new RegExp(Y.pattern);$.string=Q.regex(W)}}}},Ey=class{apply($,Z){let Y=Z;if(Y.minimum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.min(Y.minimum)}}},Ry=class{apply($,Z){let Y=Z;if(Y.maximum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.max(Y.maximum)}}},_y=class{apply($,Z){let Y=Z;if(Y.exclusiveMinimum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)if(typeof Y.exclusiveMinimum==="number")$.number=Q.gt(Y.exclusiveMinimum);else $.number=!1}}},Cy=class{apply($,Z){let Y=Z;if(Y.exclusiveMaximum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)if(typeof Y.exclusiveMaximum==="number")$.number=Q.lt(Y.exclusiveMaximum);else $.number=!1}}},Iy=class{apply($,Z){let Y=Z;if(Y.multipleOf===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.refine((W)=>{if(Y.multipleOf===0)return!1;let J=W/Y.multipleOf,G=Math.round(J),K=Math.min(Math.abs(W)*Number.EPSILON*10,Math.abs(Y.multipleOf)*Number.EPSILON*10);return Math.abs(J-G)<=K/Math.abs(Y.multipleOf)},{message:`Must be a multiple of ${Y.multipleOf}`})}}},fy=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.minItems!==void 0||Y.maxItems!==void 0||Y.items!==void 0||Y.prefixItems!==void 0)){if($.array===void 0)$.array=b1.array(b1.any())}}},Sy=class{apply($,Z){let Y=Z;if(Y.minItems===void 0)return;if($.array!==!1)$.array=($.array||b1.array(b1.any())).min(Y.minItems)}},by=class{apply($,Z){let Y=Z;if(Y.maxItems===void 0)return;if($.array!==!1)$.array=($.array||b1.array(b1.any())).max(Y.maxItems)}},vy=class{apply($,Z){let Y=Z;if($.array===!1)return;if(Array.isArray(Y.items))$.array=$.array||b1.array(b1.any());else if(Y.items&&typeof Y.items!=="boolean"&&!Y.prefixItems){let Q=I1(Y.items),W=b1.array(Q);if($.array&&$.array instanceof b1.ZodArray){let J=$.array._def;if(J.checks)J.checks.forEach((G)=>{if(G._zod&&G._zod.def){let K=G._zod.def;if(K.check==="min_length"&&K.minimum!==void 0)W=W.min(K.minimum);else if(K.check==="max_length"&&K.maximum!==void 0)W=W.max(K.maximum)}})}$.array=W}else if(typeof Y.items==="boolean"&&Y.items===!1)if(!Y.prefixItems)$.array=b1.array(b1.any()).max(0);else $.array=$.array||b1.array(b1.any());else if(typeof Y.items==="boolean"&&Y.items===!0)$.array=$.array||b1.array(b1.any());else if(Y.prefixItems)$.array=$.array||b1.array(b1.any())}},yy=class{apply($,Z){if(Z.type!=="array")return;let Y=Z;if(!Array.isArray(Y.items))return;if($.array===!1)return;let Q=Y.items.map((J)=>I1(J)),W;if(Q.length===0)W=BL.tuple([]);else W=BL.tuple(Q);if(Y.minItems!==void 0&&Y.minItems>Q.length)W=!1;if(Y.maxItems!==void 0&&Y.maxItems<Q.length)W=!1;$.tuple=W,$.array=!1}},Ty=class{apply($,Z){let Y=Z;if($.object===!1)return;if(Y.properties||Y.required||Y.additionalProperties!==void 0)$.object=$.object||x5.object({}).passthrough()}},ky=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.maxProperties!==void 0||Y.minProperties!==void 0)){if($.object===void 0)$.object=x5.object({}).passthrough()}}},xy=class{apply($,Z){let Y=Z;if(Y.maxProperties===void 0)return;if($.object!==!1){let Q=$.object||x5.object({}).passthrough();$.object=Q.refine((W)=>Object.keys(W).length<=Y.maxProperties,{message:`Object must have at most ${Y.maxProperties} properties`})}}},gy=class{apply($,Z){let Y=Z;if(Y.minProperties===void 0)return;if($.object!==!1){let Q=$.object||x5.object({}).passthrough();$.object=Q.refine((W)=>Object.keys(W).length>=Y.minProperties,{message:`Object must have at least ${Y.minProperties} properties`})}}};function q7($,Z){if($===Z)return!0;if($==null||Z==null)return $===Z;if(typeof $!==typeof Z)return!1;if(Array.isArray($)&&Array.isArray(Z)){if($.length!==Z.length)return!1;return $.every((Y,Q)=>q7(Y,Z[Q]))}if(typeof $==="object"&&typeof Z==="object"){let Y=Object.keys($),Q=Object.keys(Z);if(Y.length!==Q.length)return!1;return Y.every((W)=>Q.includes(W)&&q7($[W],Z[W]))}return!1}function uy(){return($)=>{if(!Array.isArray($))return!0;let Z=[];return $.every((Y)=>{if(Z.some((W)=>q7(Y,W)))return!1;return Z.push(Y),!0})}}function k5($,Z){return $.safeParse(Z).success}var hy=class{apply($,Z){if(!Z.not)return $;let Y=I1(Z.not);return $.refine((Q)=>!k5(Y,Q),{message:"Value must not match the 'not' schema"})}},my=class{apply($,Z){if(Z.uniqueItems!==!0)return $;return $.refine(uy(),{message:"Array items must be unique"})}},py=class{apply($,Z){if(!Z.allOf||Z.allOf.length===0)return $;return Z.allOf.map((Q)=>I1(Q)).reduce((Q,W)=>ly.intersection(Q,W),$)}},iy=class{apply($,Z){if(!Z.anyOf||Z.anyOf.length===0)return $;let Y=Z.anyOf.length===1?I1(Z.anyOf[0]):FL.union([I1(Z.anyOf[0]),I1(Z.anyOf[1]),...Z.anyOf.slice(2).map((Q)=>I1(Q))]);return FL.intersection($,Y)}},cy=class{apply($,Z){if(!Z.oneOf||Z.oneOf.length===0)return $;let Y=Z.oneOf.map((Q)=>I1(Q));return $.refine((Q)=>{let W=0;for(let J of Y)if(J.safeParse(Q).success){if(W++,W>1)return!1}return W===1},{message:"Value must match exactly one of the oneOf schemas"})}},dy=class{apply($,Z){let Y=Z;if(Y.prefixItems&&Array.isArray(Y.prefixItems)){let W=Y.prefixItems.map((J)=>I1(J));return $.refine((J)=>{if(!Array.isArray(J))return!0;for(let G=0;G<Math.min(J.length,W.length);G++)if(!k5(W[G],J[G]))return!1;if(J.length>W.length){if(typeof Y.items==="boolean"&&Y.items===!1)return!1;else if(Y.items&&typeof Y.items==="object"&&!Array.isArray(Y.items)){let G=I1(Y.items);for(let K=W.length;K<J.length;K++)if(!k5(G,J[K]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return $}},ny=class{apply($,Z){let Y=Z;if(!Y.properties&&!Y.required&&Y.additionalProperties!==!1)return $;if($ instanceof T5.ZodObject||$ instanceof T5.ZodRecord){let Q={};if(Y.properties){for(let[W,J]of Object.entries(Y.properties))if(J!==void 0)Q[W]=I1(J)}if(Y.required&&Array.isArray(Y.required)){let W=new Set(Y.required);for(let J of Object.keys(Q))if(!W.has(J))Q[J]=Q[J].optional()}else for(let W of Object.keys(Q))Q[W]=Q[W].optional();if(Y.additionalProperties===!1)return T5.object(Q);else return T5.object(Q).passthrough()}return $.refine((Q)=>{if(typeof Q!=="object"||Q===null||Array.isArray(Q))return!0;if(Y.properties){for(let[W,J]of Object.entries(Y.properties))if(J!==void 0){if(Object.getOwnPropertyDescriptor(Q,W)!==void 0){if(!I1(J).safeParse(Q[W]).success)return!1}}}if(Y.required&&Array.isArray(Y.required)){for(let W of Y.required)if(Object.getOwnPropertyDescriptor(Q,W)===void 0)return!1}if(Y.additionalProperties===!1&&Y.properties){let W=new Set(Object.keys(Y.properties));for(let J in Q)if(!W.has(J))return!1}return!0},{message:"Object constraints validation failed"})}},ry=class{apply($,Z){if(!Z.enum||Z.enum.length===0)return $;let Y=Z.enum.filter((Q)=>Array.isArray(Q)||typeof Q==="object"&&Q!==null);if(Y.length===0)return $;return $.refine((Q)=>{if(typeof Q!=="object"||Q===null)return!0;return Y.some((W)=>q7(Q,W))},{message:"Value must match one of the enum values"})}},ay=class{apply($,Z){if(Z.const===void 0)return $;let Y=Z.const;if(typeof Y!=="object"||Y===null)return $;return $.refine((Q)=>q7(Q,Y),{message:"Value must equal the const value"})}},oy=class{apply($,Z){if(Z.description)$=$.describe(Z.description);return $}},ty=class{apply($,Z){var Y;let Q=Z;if(!((Y=Q.required)==null?void 0:Y.includes("__proto__"))||Z.type!==void 0)return $;return sy.any().refine((W)=>this.validateRequired(W,Q.required),{message:"Missing required properties"})}validateRequired($,Z){if(typeof $!=="object"||$===null||Array.isArray($))return!0;return Z.every((Y)=>Object.prototype.hasOwnProperty.call($,Y))}},ey=class{apply($,Z){var Y;let Q=Z;if(Q.contains===void 0)return $;let W=I1(Q.contains),J=(Y=Q.minContains)!=null?Y:1,G=Q.maxContains;return $.refine((K)=>{if(!Array.isArray(K))return!0;let B=0;for(let D of K)if(k5(W,D))B++;if(B<J)return!1;if(G!==void 0&&B>G)return!1;return!0},{message:"Array must contain required items matching the schema"})}},$T=class{apply($,Z){let{default:Y}=Z;if(Y===void 0)return $;if(!$.safeParse(Y).success)return $;return $.default(Y)}},ZT=[new Ay,new zy,new jy,new qy,new Ny,new fy,new ky,new My,new Py,new wy,new Ey,new Ry,new _y,new Cy,new Iy,new yy,new Sy,new by,new vy,new xy,new gy,new Ty],YT=[new ty,new ry,new ay,new py,new iy,new cy,new dy,new ny,new ey,new hy,new my,new $T,new oy];function I1($){if(typeof $==="boolean")return $?O0.any():O0.never();let Z={};for(let W of ZT)W.apply(Z,$);let Y=[];if(Z.string!==!1)Y.push(Z.string||O0.string());if(Z.number!==!1)Y.push(Z.number||O0.number());if(Z.boolean!==!1)Y.push(Z.boolean||O0.boolean());if(Z.null!==!1)Y.push(Z.null||O0.null());if(Z.array!==!1)Y.push(Z.array||O0.array(O0.any()));if(Z.tuple!==!1&&Z.tuple!==void 0)Y.push(Z.tuple);if(Z.object!==!1)if(Z.object)Y.push(Z.object);else{let W=O0.custom((J)=>{return typeof J==="object"&&J!==null&&!Array.isArray(J)},"Must be an object, not an array");Y.push(W)}if(Z.file!==!1&&Z.file!==void 0)Y.push(Z.file);let Q;if(Y.length===0)Q=O0.never();else if(Y.length===1)Q=Y[0];else if(!Object.keys($).some((J)=>J!=="$schema"&&J!=="title"&&J!=="description"))Q=O0.any();else Q=O0.union(Y);for(let W of YT)Q=W.apply(Q,$);return Q}class SW extends Event{constructor($,Z){var Y,Q;super($),this.code=(Y=Z==null?void 0:Z.code)!=null?Y:void 0,this.message=(Q=Z==null?void 0:Z.message)!=null?Q:void 0}[Symbol.for("nodejs.util.inspect.custom")]($,Z,Y){return Y(DL(this),Z)}[Symbol.for("Deno.customInspect")]($,Z){return $(DL(this),Z)}}function QT($){let Z=globalThis.DOMException;return typeof Z=="function"?new Z($,"SyntaxError"):SyntaxError($)}function bW($){return $ instanceof Error?"errors"in $&&Array.isArray($.errors)?$.errors.map(bW).join(", "):("cause"in $)&&$.cause instanceof Error?`${$}: ${bW($.cause)}`:$.message:`${$}`}function DL($){return{type:$.type,message:$.message,code:$.code,defaultPrevented:$.defaultPrevented,cancelable:$.cancelable,timeStamp:$.timeStamp}}var LL=($)=>{throw TypeError($)},hW=($,Z,Y)=>Z.has($)||LL("Cannot "+Y),X1=($,Z,Y)=>(hW($,Z,"read from private field"),Y?Y.call($):Z.get($)),f1=($,Z,Y)=>Z.has($)?LL("Cannot add the same private member more than once"):Z instanceof WeakSet?Z.add($):Z.set($,Y),O1=($,Z,Y,Q)=>(hW($,Z,"write to private field"),Z.set($,Y),Y),G6=($,Z,Y)=>(hW($,Z,"access private method"),Y),Z0,X8,Z9,g5,u5,P7,X9,w7,x6,Y9,W9,Q9,N7,v0,vW,yW,TW,VL,kW,xW,M7,gW,uW;class J9 extends EventTarget{constructor($,Z){var Y,Q;super(),f1(this,v0),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,f1(this,Z0),f1(this,X8),f1(this,Z9),f1(this,g5),f1(this,u5),f1(this,P7),f1(this,X9),f1(this,w7,null),f1(this,x6),f1(this,Y9),f1(this,W9,null),f1(this,Q9,null),f1(this,N7,null),f1(this,yW,async(W)=>{var J;X1(this,Y9).reset();let{body:G,redirected:K,status:B,headers:D}=W;if(B===204){G6(this,v0,M7).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(K?O1(this,Z9,new URL(W.url)):O1(this,Z9,void 0),B!==200){G6(this,v0,M7).call(this,`Non-200 status code (${B})`,B);return}if(!(D.get("content-type")||"").startsWith("text/event-stream")){G6(this,v0,M7).call(this,'Invalid content type, expected "text/event-stream"',B);return}if(X1(this,Z0)===this.CLOSED)return;O1(this,Z0,this.OPEN);let V=new Event("open");if((J=X1(this,N7))==null||J.call(this,V),this.dispatchEvent(V),typeof G!="object"||!G||!("getReader"in G)){G6(this,v0,M7).call(this,"Invalid response body, expected a web ReadableStream",B),this.close();return}let L=new TextDecoder,A=G.getReader(),O=!0;do{let{done:q,value:M}=await A.read();M&&X1(this,Y9).feed(L.decode(M,{stream:!q})),q&&(O=!1,X1(this,Y9).reset(),G6(this,v0,gW).call(this))}while(O)}),f1(this,TW,(W)=>{O1(this,x6,void 0),!(W.name==="AbortError"||W.type==="aborted")&&G6(this,v0,gW).call(this,bW(W))}),f1(this,kW,(W)=>{typeof W.id=="string"&&O1(this,w7,W.id);let J=new MessageEvent(W.event||"message",{data:W.data,origin:X1(this,Z9)?X1(this,Z9).origin:X1(this,X8).origin,lastEventId:W.id||""});X1(this,Q9)&&(!W.event||W.event==="message")&&X1(this,Q9).call(this,J),this.dispatchEvent(J)}),f1(this,xW,(W)=>{O1(this,P7,W)}),f1(this,uW,()=>{O1(this,X9,void 0),X1(this,Z0)===this.CONNECTING&&G6(this,v0,vW).call(this)});try{if($ instanceof URL)O1(this,X8,$);else if(typeof $=="string")O1(this,X8,new URL($,XT()));else throw Error("Invalid URL")}catch{throw QT("An invalid or illegal string was specified")}O1(this,Y9,S5({onEvent:X1(this,kW),onRetry:X1(this,xW)})),O1(this,Z0,this.CONNECTING),O1(this,P7,3000),O1(this,u5,(Y=Z==null?void 0:Z.fetch)!=null?Y:globalThis.fetch),O1(this,g5,(Q=Z==null?void 0:Z.withCredentials)!=null?Q:!1),G6(this,v0,vW).call(this)}get readyState(){return X1(this,Z0)}get url(){return X1(this,X8).href}get withCredentials(){return X1(this,g5)}get onerror(){return X1(this,W9)}set onerror($){O1(this,W9,$)}get onmessage(){return X1(this,Q9)}set onmessage($){O1(this,Q9,$)}get onopen(){return X1(this,N7)}set onopen($){O1(this,N7,$)}addEventListener($,Z,Y){let Q=Z;super.addEventListener($,Q,Y)}removeEventListener($,Z,Y){let Q=Z;super.removeEventListener($,Q,Y)}close(){X1(this,X9)&&clearTimeout(X1(this,X9)),X1(this,Z0)!==this.CLOSED&&(X1(this,x6)&&X1(this,x6).abort(),O1(this,Z0,this.CLOSED),O1(this,x6,void 0))}}Z0=new WeakMap,X8=new WeakMap,Z9=new WeakMap,g5=new WeakMap,u5=new WeakMap,P7=new WeakMap,X9=new WeakMap,w7=new WeakMap,x6=new WeakMap,Y9=new WeakMap,W9=new WeakMap,Q9=new WeakMap,N7=new WeakMap,v0=new WeakSet,vW=function(){O1(this,Z0,this.CONNECTING),O1(this,x6,new AbortController),X1(this,u5)(X1(this,X8),G6(this,v0,VL).call(this)).then(X1(this,yW)).catch(X1(this,TW))},yW=new WeakMap,TW=new WeakMap,VL=function(){var $;let Z={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...X1(this,w7)?{"Last-Event-ID":X1(this,w7)}:void 0},cache:"no-store",signal:($=X1(this,x6))==null?void 0:$.signal};return"window"in globalThis&&(Z.credentials=this.withCredentials?"include":"same-origin"),Z},kW=new WeakMap,xW=new WeakMap,M7=function($,Z){var Y;X1(this,Z0)!==this.CLOSED&&O1(this,Z0,this.CLOSED);let Q=new SW("error",{code:Z,message:$});(Y=X1(this,W9))==null||Y.call(this,Q),this.dispatchEvent(Q)},gW=function($,Z){var Y;if(X1(this,Z0)===this.CLOSED)return;O1(this,Z0,this.CONNECTING);let Q=new SW("error",{code:Z,message:$});(Y=X1(this,W9))==null||Y.call(this,Q),this.dispatchEvent(Q),O1(this,X9,setTimeout(X1(this,uW),X1(this,P7)))},uW=new WeakMap,J9.CONNECTING=0,J9.OPEN=1,J9.CLOSED=2;function XT(){let $="document"in globalThis?globalThis.document:void 0;return $&&typeof $=="object"&&"baseURI"in $&&typeof $.baseURI=="string"?$.baseURI:void 0}class UL extends Error{constructor($,Z,Y){super(`SSE error: ${Z}`);this.code=$,this.event=Y}}class mW{constructor($,Z){this._url=$,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=Z?.eventSourceInit,this._requestInit=Z?.requestInit,this._authProvider=Z?.authProvider,this._fetch=Z?.fetch,this._fetchWithInit=z5(Z?.fetch,Z?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new e1("No auth provider");let $;try{$=await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(Z){throw this.onerror?.(Z),Z}if($!=="AUTHORIZED")throw new e1;return await this._startOrAuth()}async _commonHeaders(){let $={};if(this._authProvider){let Y=await this._authProvider.tokens();if(Y)$.Authorization=`Bearer ${Y.access_token}`}if(this._protocolVersion)$["mcp-protocol-version"]=this._protocolVersion;let Z=a8(this._requestInit?.headers);return new Headers({...$,...Z})}_startOrAuth(){let $=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((Z,Y)=>{this._eventSource=new J9(this._url.href,{...this._eventSourceInit,fetch:async(Q,W)=>{let J=await this._commonHeaders();J.set("Accept","text/event-stream");let G=await $(Q,{...W,headers:J});if(G.status===401&&G.headers.has("www-authenticate")){let{resourceMetadataUrl:K,scope:B}=$9(G);this._resourceMetadataUrl=K,this._scope=B}return G}}),this._abortController=new AbortController,this._eventSource.onerror=(Q)=>{if(Q.code===401&&this._authProvider){this._authThenStart().then(Z,Y);return}let W=new UL(Q.code,Q.message,Q);Y(W),this.onerror?.(W)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",(Q)=>{let W=Q;try{if(this._endpoint=new URL(W.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(J){Y(J),this.onerror?.(J),this.close();return}Z()}),this._eventSource.onmessage=(Q)=>{let W=Q,J;try{J=w6.parse(JSON.parse(W.data))}catch(G){this.onerror?.(G);return}this.onmessage?.(J)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth($){if(!this._authProvider)throw new e1("No auth provider");if(await p0(this._authProvider,{serverUrl:this._url,authorizationCode:$,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send($){if(!this._endpoint)throw Error("Not connected");try{let Z=await this._commonHeaders();Z.set("content-type","application/json");let Y={...this._requestInit,method:"POST",headers:Z,body:JSON.stringify($),signal:this._abortController?.signal},Q=await(this._fetch??fetch)(this._endpoint,Y);if(!Q.ok){let W=await Q.text().catch(()=>null);if(Q.status===401&&this._authProvider){let{resourceMetadataUrl:J,scope:G}=$9(Q);if(this._resourceMetadataUrl=J,this._scope=G,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1;return this.send($)}throw Error(`Error POSTing to endpoint (HTTP ${Q.status}): ${W}`)}await Q.body?.cancel()}catch(Z){throw this.onerror?.(Z),Z}}setProtocolVersion($){this._protocolVersion=$}}var WT="mcp";class lW{constructor($){this._url=$}start(){if(this._socket)throw Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise(($,Z)=>{this._socket=new WebSocket(this._url,WT),this._socket.onerror=(Y)=>{let Q="error"in Y?Y.error:Error(`WebSocket error: ${JSON.stringify(Y)}`);Z(Q),this.onerror?.(Q)},this._socket.onopen=()=>{$()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=(Y)=>{let Q;try{Q=w6.parse(JSON.parse(Y.data))}catch(W){this.onerror?.(W);return}this.onmessage?.(Q)}})}async close(){this._socket?.close()}send($){return new Promise((Z,Y)=>{if(!this._socket){Y(Error("Not connected"));return}this._socket?.send(JSON.stringify($)),Z()})}}class pW extends b5{constructor($,Z){super($,Z)}send($,Z){let Y=JT($);if(Y?.type==="emit")return this.onmessage?.(Y.message),Promise.resolve();if(Y?.type==="suppress")return Promise.resolve();return super.send($,Z)}}function JT($){let Z=$;if(!Z||typeof Z!=="object"||!("method"in Z))return null;switch(Z.method){case"initialize":{let Y=Z?.params?.protocolVersion;if(!Y)return null;return{type:"emit",message:{result:{protocolVersion:Y,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:Z.jsonrpc??"2.0",id:Z.id}}}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class jL extends A5{constructor($,Z){super($,Z)}async listTools($,Z){return await this.request({method:"tools/list",params:$},i9,Z)}}var AL=async($,Z,Y)=>{let Q=GT($.connection,Z,Y);if(!Q)throw Error("Unknown MCP connection type");let W=new jL({name:$?.name??"MCP Client",version:"1.0.0"});return await W.connect(Q),{client:W}},GT=($,Z,Y)=>{if($.type==="Websocket")return new lW(new URL($.url));if($.type!=="SSE"&&$.type!=="HTTP")return null;let W={...$.token?{authorization:`Bearer ${$.token}`}:{},...Y??{},..."headers"in $?$.headers||{}:{}};if($.type==="SSE"){let J={requestInit:{headers:W,signal:Z}};if($.token)J.eventSourceInit={fetch:(G,K)=>{return fetch(G,{...K,headers:{...W,Accept:"text/event-stream"},signal:Z})}};return new mW(new URL($.url),J)}return new pW(new URL($.url),{requestInit:{headers:W,signal:Z,credentials:"include"}})};var zL=($)=>{try{return JSON.parse($)}catch{return $}},h5=new Map,OL=($,Z)=>{return{...$,id:$.name,inputSchema:$.inputSchema?I1($.inputSchema):void 0,outputSchema:$.outputSchema?I1($.outputSchema):void 0,execute:(Y)=>{return Z(Y.context,$.name)}}};function qL($){let Z=(Y)=>{if("connection"in $)return AL({connection:$.connection},void 0,Y);return $.client};return new Proxy({},{get(Y,Q){if(Q==="toJSON")return null;if(typeof Q!=="string")throw Error("Name must be a string");if(Q==="listTools")return K;async function W(B,D=Q){let V=$?.debugId?.(),L=V?{"x-trace-debug-id":V}:void 0,{client:A}=await Z(L),{structuredContent:O,isError:q,content:M}=await A.callTool({name:String(D),arguments:B});if(q){let N=M?.[0]?.text,E=typeof N==="string"?zL(N):null,f=E?.code&&typeof $?.getErrorByStatusCode==="function"?$.getErrorByStatusCode(E.code,E.message,E.traceId):null;if(f)throw f;throw Error(`Tool ${String(D)} returned an error: ${JSON.stringify(O??M)}`)}if(O!==void 0)return O;let I=M?.[0]?.text;return typeof I==="string"?zL(I):void 0}async function J(){let{client:B}=await Z(),{tools:D}=await B.listTools();return D}async function G(){if(!("connection"in $))return J();let B=$.connection,D=JSON.stringify(B);try{if(!h5.has(D))h5.set(D,J());return await h5.get(D)}catch(V){console.error("Failed to list tools",V),h5.delete(D);return}}async function K(){return(await G()??[]).map((D)=>OL(D,W))}return W.asTool=async()=>{let D=(await G()??[]).find((V)=>V.name===Q);if(!D)throw Error(`Tool ${Q} not found`);return OL(D,W)},W}})}var B01=new Proxy({},{get($,Z){if(Z==="toJSON")return null;if(Z==="forConnection")return(Y)=>m5({connection:Y});return global[Z]}});function m5($){return qL($)}var NL=($)=>{return{...KT($),forClient:(Z)=>{return m5({client:Z})},forConnection:(Z)=>{return m5({connection:Z})}}};function KT($){return{isImplementedBy:(Z)=>{for(let Y of $){let Q=typeof Y.name==="string"?new RegExp(`^${Y.name}$`):Y.name,W=Z.find((J)=>Q.test(J.name));if(!W&&Y.opt)continue;if(!W)return!1}return!0}}}import{z as s}from"zod";var l5=s.object({id:s.string().describe("Unique identifier for the entity"),title:s.string().describe("Human-readable title for the entity"),description:s.string().nullish().describe("Description of the entity"),created_at:s.string().datetime(),updated_at:s.string().datetime(),created_by:s.string().optional(),updated_by:s.string().optional()}),HT=s.object({field:s.array(s.string()),operator:s.enum(["eq","gt","gte","lt","lte","in","like","contains"]),value:s.unknown()}),ML=s.lazy(()=>s.union([HT,s.object({operator:s.enum(["and","or","not"]),conditions:s.array(ML)})])),BT=s.object({field:s.array(s.string()),direction:s.enum(["asc","desc"]),nulls:s.enum(["first","last"]).optional()}),FT=s.object({where:ML.optional().describe("Filter expression"),orderBy:s.array(BT).optional().describe("Sort expressions"),limit:s.number().int().min(1).max(1000).optional().describe("Maximum number of items to return"),offset:s.number().int().min(0).optional().describe("Number of items to skip")});function DT($){return s.object({items:s.array($).describe("Array of collection items"),totalCount:s.number().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:s.boolean().optional().describe("Whether there are more items available")})}var VT=s.object({id:s.string().describe("ID of the entity to retrieve")});function LT($){return s.object({item:$.nullable().describe("The retrieved item, or null if not found")})}function UT($){return s.object({data:$.partial().describe("Data for the new entity (id may be auto-generated)")})}function jT($){return s.object({item:$.describe("The created entity with generated id")})}function AT($){return s.object({id:s.string().describe("ID of the entity to update"),data:$.partial().describe("Partial entity data to update")})}function zT($){return s.object({item:$.describe("The updated entity")})}var OT=s.object({id:s.string().describe("ID of the entity to delete")});function qT($){return s.object({item:$.describe("The deleted entity")})}function p5($,Z,Y){let Q=$.toUpperCase(),W=Y?.readOnly??!1,J=[{name:`COLLECTION_${Q}_LIST`,inputSchema:FT,outputSchema:DT(Z)},{name:`COLLECTION_${Q}_GET`,inputSchema:VT,outputSchema:LT(Z)}];if(!W)J.push({name:`COLLECTION_${Q}_CREATE`,inputSchema:UT(Z),outputSchema:jT(Z),opt:!0},{name:`COLLECTION_${Q}_UPDATE`,inputSchema:AT(Z),outputSchema:zT(Z),opt:!0},{name:`COLLECTION_${Q}_DELETE`,inputSchema:OT,outputSchema:qT(Z),opt:!0});return J}var iW=T.object({toolName:T.string().describe("Name of the tool to invoke on that connection"),transformCode:T.string().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),NT=T.object({code:T.string().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
|
|
960
|
+
`.trim();var yV=LW("site-diagnostics_"),jv=yV.is,Av=yV.get;import{z as h}from"zod";var nv=h.object({authorizationEndpoint:h.string().url(),tokenEndpoint:h.string().url(),introspectionEndpoint:h.string().url().optional(),clientId:h.string(),clientSecret:h.string().optional(),scopes:h.array(h.string()),grantType:h.enum(["authorization_code","client_credentials"])}),kV=h.object({type:h.literal("object"),properties:h.record(h.string(),h.unknown()).optional(),required:h.array(h.string()).optional()}).catchall(h.unknown()),rv=C4.extend({inputSchema:kV,outputSchema:kV.optional()}),av=h.object({headers:h.record(h.string(),h.string()).optional()}),ov=h.object({command:h.string().describe("Command to run (e.g., 'npx', 'node')"),args:h.array(h.string()).optional().describe("Command arguments"),cwd:h.string().optional().describe("Working directory"),envVars:h.record(h.string(),h.string()).optional().describe("Environment variables (encrypted in storage)")}),v5=h.object({id:h.string().describe("Unique identifier for the connection"),title:h.string().describe("Human-readable name for the connection"),created_at:h.string().describe("When the connection was created"),updated_at:h.string().describe("When the connection was last updated"),created_by:h.string().describe("User ID who created the connection"),updated_by:h.string().optional().describe("User ID who last updated the connection"),organization_id:h.string().describe("Organization ID this connection belongs to"),description:h.string().nullable().describe("Description of the connection"),icon:h.string().nullable().describe("Icon URL for the connection"),app_name:h.string().nullable().describe("Associated app name"),app_id:h.string().nullable().describe("Associated app ID"),slug:h.string().nullable().optional().describe("URL-safe slug derived from app_name, connection_url, or title"),connection_type:h.enum(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:h.string().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:h.string().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:h.union([ov,av]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:nv.nullable().describe("OAuth configuration"),configuration_state:h.record(h.string(),h.unknown()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:h.array(h.string()).nullable().optional().describe("Configuration scopes"),metadata:h.record(h.string(),h.unknown()).nullable().describe("Additional metadata (includes repository info)"),tools:h.array(rv).nullable().describe("Discovered tools from MCP"),bindings:h.array(h.string()).nullable().describe("Detected bindings"),status:h.enum(["active","inactive","error"]).describe("Current status")}),xV=v5.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0}).extend({icon:h.string().nullish()}),gV=v5.partial();import{z as C}from"zod";var z7=C.object({connection_id:C.string().describe("Connection ID"),selected_tools:C.array(C.string()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:C.array(C.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:C.array(C.string()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),mV=z7.extend({selected_tools:z7.shape.selected_tools.optional(),selected_resources:z7.shape.selected_resources.optional(),selected_prompts:z7.shape.selected_prompts.optional()}),sv=C.object({connectionId:C.string(),toolName:C.string(),label:C.string(),icon:C.string().nullable().optional()}),OW=C.object({id:C.string().describe("Stable id; used as React key and ?tab= value"),title:C.string().describe("Tab label"),icon:C.string().optional().describe("Optional lucide icon name"),view:C.object({type:C.literal("ext-app"),appId:C.string(),args:C.record(C.string(),C.unknown()).optional()})}),qW=C.object({defaultMainView:C.object({type:C.string(),id:C.string().optional(),toolName:C.string().optional()}).nullable().optional(),chatDefaultOpen:C.boolean().nullable().optional(),tabs:C.array(OW).optional()}),uV=C.object({connectionId:C.string().optional().describe("Connection that owns the resource \u2014 the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:C.string().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),minHeight:C.number().int().positive().optional(),maxHeight:C.number().int().positive().optional()}),NW=C.object({banner:C.string().nullable().optional(),bannerColor:C.string().nullable().optional(),icon:C.string().nullable().optional(),themeColor:C.string().nullable().optional(),pinnedViews:C.array(sv).nullable().optional(),layout:qW.nullable().optional(),homeTile:uV.nullable().optional(),homeTiles:C.array(uV).nullable().optional(),homePrompts:C.array(C.string()).nullable().optional()});var MW=/^[A-Za-z_][A-Za-z0-9_]*$/,hV=C.string().min(1).regex(MW,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),tv=C.discriminatedUnion("kind",[C.object({key:hV,kind:C.literal("literal"),value:C.string()}),C.object({key:hV,kind:C.literal("secret"),secretId:C.string().min(1)})]),PW=C.object({selected:C.string().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:C.string().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:C.string().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:C.array(tv).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that mesh resolves via the credential vault before posting /_sandbox/config.")}),wW=C.object({url:C.string().describe("GitHub repository URL"),owner:C.string().describe("Repository owner"),name:C.string().describe("Repository name"),installationId:C.number().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:C.string().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),ev=C.enum(["agent-sandbox","user-desktop"]),$y=C.enum(["agent-sandbox","user-desktop","cluster"]);var lV={sandboxHandle:C.string().describe("Provider-specific handle"),previewUrl:C.string().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:C.string().nullable().optional().describe("Daemon's public URL \u2014 what cluster\u2192daemon RPCs target. Equal to previewUrl for user-desktop; null/absent for the agent-sandbox provider (routes through hosted ingress)."),sandboxProviderKind:ev.optional(),createdAt:C.number().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:C.object({packageManager:C.string().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:C.string().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:C.string().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},EW=C.object(lV),Ps=C.object({...lV,sandboxProviderKind:$y.optional()});var O7=C.record(C.string().describe("userId"),C.record(C.string().describe("branch"),C.record(C.string().describe("sandboxProviderKind"),EW)));var pV=C.object({id:C.string().describe("Unique identifier"),title:C.string().describe("Human-readable name"),description:C.string().nullable().describe("Description"),icon:C.string().nullable().describe("Icon URL"),created_at:C.string().describe("Creation timestamp"),updated_at:C.string().describe("Last update timestamp"),created_by:C.string().describe("User ID who created this item"),updated_by:C.string().optional().describe("User ID who last updated this item"),organization_id:C.string().describe("Organization ID this item belongs to"),status:C.enum(["active","inactive"]).describe("Current status"),pinned:C.boolean().describe("Whether this space is pinned to the sidebar"),metadata:C.object({instructions:C.string().nullable().describe("Instructions also used as system prompt"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:C.array(z7).describe("Connections with their selected tools, resources, and prompts")}),iV=C.object({title:C.string().min(1).max(255).describe("Name for the virtual MCP"),description:C.string().nullable().optional().describe("Optional description"),icon:C.string().nullish().describe("Optional icon URL"),status:C.enum(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:C.boolean().optional().default(!1).describe("Pin to sidebar"),metadata:C.object({instructions:C.string().nullable().optional().describe("MCP server instructions"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C.array(mV).describe("Connections to include/exclude (can be empty for exclusion mode)")}),cV=C.object({title:C.string().min(1).max(255).optional().describe("New name"),description:C.string().nullable().optional().describe("New description (null to clear)"),icon:C.string().nullish().describe("New icon URL"),status:C.enum(["active","inactive"]).optional().describe("New status"),pinned:C.boolean().optional().describe("Pin/unpin from sidebar"),metadata:C.object({instructions:C.string().nullable().optional().describe("MCP server instructions"),enabled_plugins:C.array(C.string()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C.array(C.string()).nullable().optional().describe("Allowlist of Virtual MCP (agent) IDs this agent may delegate to via subtask. null/absent = all active org agents; empty array = itself only (no cross-agent delegation)."),ui:NW.nullable().optional().describe("UI customization settings"),githubRepo:wW.nullable().optional().describe("Linked GitHub repository"),runtime:PW.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:O7.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C.array(mV).optional().describe("New connections (replaces existing)")});var RW=["in_progress","requires_action","failed","completed"],dV=[...RW,"expired"],_W={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},nV=Object.values(_W);var rV;(function($){$.Completable="McpCompletable"})(rV||(rV={}));import{ZodOptional as At}from"zod";var eV="MCP Workflows",$L="Create workflows using your MCP tools";import{sql as ZL}from"kysely";var YL={name:"001-workflows",async up($){await $.schema.createTable("workflow_collection").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(Z)=>Z.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(Z)=>Z.notNull()).addColumn("steps","text",(Z)=>Z.notNull().defaultTo("[]")).addColumn("created_at","text",(Z)=>Z.notNull().defaultTo(ZL`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(Z)=>Z.notNull().defaultTo(ZL`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await $.schema.createIndex("idx_wf_collection_org").ifNotExists().on("workflow_collection").column("organization_id").execute(),await $.schema.createIndex("idx_wf_collection_created_at").ifNotExists().on("workflow_collection").column("created_at").execute(),await $.schema.createTable("workflow").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(Z)=>Z.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(Z)=>Z.notNull()).addColumn("created_at_epoch_ms","bigint",(Z)=>Z.notNull()).addColumn("created_by","text").execute(),await $.schema.createIndex("idx_workflow_created_at").ifNotExists().on("workflow").column("created_at_epoch_ms").execute(),await $.schema.createIndex("idx_workflow_collection_id").ifNotExists().on("workflow").column("workflow_collection_id").execute(),await $.schema.createTable("workflow_execution").ifNotExists().addColumn("id","text",(Z)=>Z.primaryKey()).addColumn("workflow_id","text",(Z)=>Z.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(Z)=>Z.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(Z)=>Z.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(Z)=>Z.notNull()).addColumn("updated_at","bigint",(Z)=>Z.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await $.schema.createIndex("idx_wf_execution_status").ifNotExists().on("workflow_execution").column("status").execute(),await $.schema.createIndex("idx_wf_execution_workflow_id").ifNotExists().on("workflow_execution").column("workflow_id").execute(),await $.schema.createIndex("idx_wf_execution_org").ifNotExists().on("workflow_execution").column("organization_id").execute(),await $.schema.createIndex("idx_wf_execution_created_at").ifNotExists().on("workflow_execution").column("created_at").execute(),await $.schema.createTable("workflow_execution_step_result").ifNotExists().addColumn("execution_id","text",(Z)=>Z.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(Z)=>Z.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await $.schema.createIndex("idx_wf_step_result_pk").ifNotExists().on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await $.schema.createIndex("idx_wf_step_result_execution").ifNotExists().on("workflow_execution_step_result").column("execution_id").execute()},async down($){await $.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await $.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await $.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await $.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await $.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await $.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await $.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await $.schema.dropTable("workflow_execution").ifExists().execute(),await $.schema.dropTable("workflow").ifExists().execute(),await $.schema.dropTable("workflow_collection").ifExists().execute()}};var QL={name:"002-execution-list-index",async up($){await $.schema.createIndex("idx_wf_execution_org_created_at").ifNotExists().on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down($){await $.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}};var XL={name:"003-retry-and-input-schema",async up($){await $.schema.alterTable("workflow_execution_step_result").addColumn("attempt_number","integer",(Z)=>Z.notNull().defaultTo(1)).execute(),await $.schema.alterTable("workflow_collection").addColumn("input_schema","text").execute()},async down($){await $.schema.alterTable("workflow_execution_step_result").dropColumn("attempt_number").execute(),await $.schema.alterTable("workflow_collection").dropColumn("input_schema").execute()}};var WL=[YL,QL,XL];function $0($){let Z=$;if(!Z.organization)throw Error("Organization context required for workflow tools");return Z}function S1($){if($===null||$===void 0)return null;if(typeof $==="object")return $;if(typeof $!=="string")return $;try{return JSON.parse($)}catch{return $}}var CW=null;function JL($){CW=$}function u1(){if(!CW)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return CW}function GL($){return{...$,steps:S1($.steps)??[],input_schema:S1($.input_schema)??null}}class IW{db;constructor($){this.db=$}async list($,Z={}){let{limit:Y=50,offset:Q=0}=Z,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",$).orderBy("created_at","desc").limit(Y).offset(Q).execute(),J=await this.db.selectFrom("workflow_collection").select((G)=>G.fn.countAll().as("count")).where("organization_id","=",$).executeTakeFirstOrThrow();return{items:W,totalCount:Number(J.count)}}async getById($,Z){let Y=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst();return Y?GL(Y):null}async create($){let{input_schema:Z,...Y}=$,Q=await this.db.insertInto("workflow_collection").values({...Y,input_schema:Z!=null?JSON.stringify(Z):null}).returningAll().executeTakeFirstOrThrow();return GL(Q)}async update($,Z,Y){let{input_schema:Q,...W}=Y,J={...W,updated_at:new Date().toISOString()};if(Q!==void 0)J.input_schema=Q?JSON.stringify(Q):null;return await this.db.updateTable("workflow_collection").set(J).where("id","=",$).where("organization_id","=",Z).returningAll().executeTakeFirstOrThrow()}async delete($,Z){return await this.db.deleteFrom("workflow_collection").where("id","=",$).where("organization_id","=",Z).returningAll().executeTakeFirstOrThrow()}}function Uy($){return{...$,steps:S1($.steps)??[],input:S1($.input)??null}}function k6($){return{...$,output:S1($.output),error:S1($.error),raw_tool_output:S1($.raw_tool_output)}}class fW{db;constructor($){this.db=$}async _createWorkflow($,Z){let Y=crypto.randomUUID(),Q=Date.now();return await $.insertInto("workflow").values({id:Y,workflow_collection_id:Z.workflowCollectionId??null,organization_id:Z.organizationId,steps:JSON.stringify(Z.steps),input:Z.input?JSON.stringify(Z.input):null,virtual_mcp_id:Z.virtualMcpId,created_at_epoch_ms:Q,created_by:Z.createdBy??null}).execute(),{id:Y}}async createWorkflow($){return this._createWorkflow(this.db,$)}async getWorkflow($){let Z=await this.db.selectFrom("workflow").selectAll().where("id","=",$).executeTakeFirst();return Z?Uy(Z):null}async createExecution($){return this.db.transaction().execute(async(Z)=>{let Y=Date.now(),{id:Q}=await this._createWorkflow(Z,{organizationId:$.organizationId,workflowCollectionId:$.workflowCollectionId,virtualMcpId:$.virtualMcpId,input:$.input,steps:$.steps,createdBy:$.createdBy}),W=crypto.randomUUID(),J=$.startAtEpochMs??Y,G=$.timeoutMs?J+$.timeoutMs:null;return await Z.insertInto("workflow_execution").values({id:W,workflow_id:Q,organization_id:$.organizationId,status:"enqueued",input:$.input?JSON.stringify($.input):null,created_at:Y,updated_at:Y,start_at_epoch_ms:J,timeout_ms:$.timeoutMs??null,deadline_at_epoch_ms:G,created_by:$.createdBy??null}).execute(),{id:W}})}async getExecution($,Z){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst()??null}async getExecutionFull($,Z){let Y=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",$).where("organization_id","=",Z).executeTakeFirst();if(!Y)return null;let Q=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).execute();return{execution:Y,stepResults:Q.map(k6)}}async getExecutionContext($){let[Z,Y]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",$).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","started_at_epoch_ms","completed_at_epoch_ms","output","error","attempt_number"]).where("execution_id","=",$).execute()]);if(!Z)return null;return{execution:{id:Z.id,status:Z.status,workflow_id:Z.workflow_id,deadline_at_epoch_ms:Z.deadline_at_epoch_ms},workflow:{steps:S1(Z.steps)??[],input:S1(Z.input)??null,virtual_mcp_id:Z.virtual_mcp_id},stepResults:Y.map((Q)=>({step_id:Q.step_id,started_at_epoch_ms:Q.started_at_epoch_ms,completed_at_epoch_ms:Q.completed_at_epoch_ms,output:S1(Q.output),error:S1(Q.error),attempt_number:Q.attempt_number}))}}async claimExecution($){let Z=Date.now(),Y=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:Z}).where("id","=",$).where("status","=","enqueued").returningAll().executeTakeFirst();if(!Y)return null;let Q=await this.getWorkflow(Y.workflow_id);if(!Q)throw Error(`Workflow ${Y.workflow_id} not found for execution ${$}`);return{execution:Y,workflow:Q}}async updateExecution($,Z,Y){let W={updated_at:Date.now()};if(Z.status!==void 0)W.status=Z.status;if(Z.output!==void 0)W.output=JSON.stringify(Z.output);if(Z.error!==void 0)W.error=JSON.stringify(Z.error);if(Z.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=Z.completed_at_epoch_ms;let J=this.db.updateTable("workflow_execution").set(W).where("id","=",$);if(Y?.onlyIfStatus)J=J.where("status","=",Y.onlyIfStatus);return await J.returningAll().executeTakeFirst()??null}async cancelExecution($,Z){let Y=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:Y}).where("id","=",$).where("organization_id","=",Z).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution($,Z){return this.db.transaction().execute(async(Y)=>{let Q=Date.now(),W=await Y.selectFrom("workflow_execution").where("id","=",$).where("organization_id","=",Z).select(["status"]).executeTakeFirst();if(!W)return!1;let{status:J}=W;if(J==="success"){let B=await Y.selectFrom("workflow_execution_step_result").where("execution_id","=",$).where("error","is not",null).select(Y.fn.countAll().as("count")).executeTakeFirstOrThrow();if(Number(B.count)===0)return!1}else if(J!=="cancelled"&&J!=="error")return!1;await Y.updateTable("workflow_execution").set({status:"enqueued",updated_at:Q,completed_at_epoch_ms:null,error:null}).where("id","=",$).execute();let G=await Y.selectFrom("workflow_execution_step_result").where("execution_id","=",$).where("error","is not",null).where("step_id","like","%[%").select("step_id").execute(),K=new Set;for(let B of G)K.add(B.step_id.replace(/\[\d+\]$/,""));if(await Y.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where((B)=>B.or([B("completed_at_epoch_ms","is",null),B("error","is not",null)])).execute(),K.size>0)await Y.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where("step_id","in",[...K]).execute();return!0})}async listExecutions($,Z={}){let{limit:Y=50,offset:Q=0,status:W,workflowCollectionId:J}=Z,G=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((L)=>L.fn.coalesce("wc.title",L.val("Workflow Execution")).as("title")).where("we.organization_id","=",$);if(W)G=G.where("we.status","=",W);if(J)G=G.where("w.workflow_collection_id","=",J);let K=await G.orderBy("we.created_at","desc").limit(Y).offset(Q).execute(),B=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select((L)=>L.fn.countAll().as("count")).where("we.organization_id","=",$);if(W)B=B.where("we.status","=",W);if(J)B=B.where("w.workflow_collection_id","=",J);let D=await B.executeTakeFirstOrThrow(),V=Number(D.count);return{items:K,totalCount:V,hasMore:Q+K.length<V}}async createStepResult($){let Z=await this.db.insertInto("workflow_execution_step_result").values({execution_id:$.execution_id,step_id:$.step_id,started_at_epoch_ms:$.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:$.completed_at_epoch_ms??null,output:$.output!==void 0?JSON.stringify($.output):null,error:$.error!==void 0?JSON.stringify($.error):null,attempt_number:1}).onConflict((Y)=>Y.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return Z?k6(Z):null}async updateStepResult($,Z,Y){let Q={};if(Y.output!==void 0)Q.output=Y.output===null?null:JSON.stringify(Y.output);if(Y.error!==void 0)Q.error=Y.error===null?null:JSON.stringify(Y.error);if(Y.started_at_epoch_ms!==void 0)Q.started_at_epoch_ms=Y.started_at_epoch_ms;if(Y.completed_at_epoch_ms!==void 0)Q.completed_at_epoch_ms=Y.completed_at_epoch_ms;if(Y.attempt_number!==void 0)Q.attempt_number=Y.attempt_number;if(Y.raw_tool_output!==void 0)Q.raw_tool_output=Y.raw_tool_output===null?null:JSON.stringify(Y.raw_tool_output);if(Object.keys(Q).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(Q).where("execution_id","=",$).where("step_id","=",Z).returningAll().executeTakeFirst();return W?k6(W):null}async claimStepForRetry($,Z,Y){let Q=await this.db.updateTable("workflow_execution_step_result").set({started_at_epoch_ms:Date.now()}).where("execution_id","=",$).where("step_id","=",Z).where("attempt_number","=",Y).where("started_at_epoch_ms","is",null).returningAll().executeTakeFirst();return Q?k6(Q):null}async resetStepResultForRetry($,Z,Y){await this.updateStepResult($,Z,{completed_at_epoch_ms:null,output:null,error:null,started_at_epoch_ms:null,attempt_number:Y,raw_tool_output:null})}async checkpointAndTransform($,Z,Y,Q){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(Y)}).where("execution_id","=",$).where("step_id","=",Z).execute();let W,J;try{let B=await Q(Y);W=B.output,J=B.error}catch(B){J=B instanceof Error?`Transform failed: ${B.message}`:`Transform failed: ${String(B)}`}let G={completed_at_epoch_ms:Date.now()};if(W!==void 0)G.output=JSON.stringify(W);if(J!==void 0)G.error=JSON.stringify(J);let K=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",$).where("step_id","=",Z).returningAll().executeTakeFirst();return K?k6(K):null}async getStepResult($,Z){let Y=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).where("step_id","=",Z).executeTakeFirst();return Y?k6(Y):null}async getStepResults($){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).execute()).map(k6)}async deleteStepResult($,Z){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",$).where("step_id","=",Z).execute()}async getStepResultsByPrefix($,Z){let Y=Z.replaceAll("\\","\\\\").replaceAll("%","\\%").replaceAll("_","\\_");return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",$).where("step_id","like",`${Y}%`).orderBy("step_id").execute()).map(k6)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}function KL($){let Z=$.db;return{collections:new IW(Z),executions:new fW(Z)}}import{z as c}from"zod";import{z as T}from"zod";import{z as O0}from"zod/v4";import{z as HL}from"zod/v4";import{z as y5}from"zod/v4";import{z as i0}from"zod/v4";import{z as Oy}from"zod/v4";import{z as Q8}from"zod/v4";import{z as c0}from"zod/v4";import{z as b1}from"zod/v4";import{z as BL}from"zod/v4";import{z as x5}from"zod/v4";import{z as ly}from"zod/v4";import{z as FL}from"zod/v4";import{z as T5}from"zod/v4";import{z as sy}from"zod/v4";var jy=class{apply($,Z){if(!Z.type)return;let Y=Array.isArray(Z.type)?Z.type:[Z.type],Q=new Set(Y);if(!Q.has("string"))$.string=!1;if(!Q.has("number")&&!Q.has("integer"))$.number=!1;if(!Q.has("boolean"))$.boolean=!1;if(!Q.has("null"))$.null=!1;if(!Q.has("array"))$.array=!1;if(!Q.has("object"))$.object=!1;if(Q.has("integer")&&$.number!==!1){let W=$.number||HL.number();if(W instanceof HL.ZodNumber)$.number=W.int()}}},Ay=class{apply($,Z){if(Z.const===void 0)return;let Y=Z.const;if($.string=!1,$.number=!1,$.boolean=!1,$.null=!1,$.array=!1,$.object=!1,typeof Y==="string")$.string=y5.literal(Y);else if(typeof Y==="number")$.number=y5.literal(Y);else if(typeof Y==="boolean")$.boolean=y5.literal(Y);else if(Y===null)$.null=y5.null();else if(Array.isArray(Y))$.array=void 0;else if(typeof Y==="object")$.object=void 0}},zy=class{apply($,Z){if(!Z.enum)return;if(Z.enum.length===0){if(!Z.type)$.string=!1,$.number=!1,$.boolean=!1,$.null=!1,$.array=!1,$.object=!1;return}let Y={string:Z.enum.filter((Q)=>typeof Q==="string"),number:Z.enum.filter((Q)=>typeof Q==="number"),boolean:Z.enum.filter((Q)=>typeof Q==="boolean"),null:Z.enum.filter((Q)=>Q===null),array:Z.enum.filter((Q)=>Array.isArray(Q)),object:Z.enum.filter((Q)=>typeof Q==="object"&&Q!==null&&!Array.isArray(Q))};$.string=this.createTypeSchema(Y.string,"string"),$.number=this.createTypeSchema(Y.number,"number"),$.boolean=this.createTypeSchema(Y.boolean,"boolean"),$.null=Y.null.length>0?i0.null():!1,$.array=Y.array.length>0?void 0:!1,$.object=Y.object.length>0?void 0:!1}createTypeSchema($,Z){if($.length===0)return!1;if($.length===1)return i0.literal($[0]);if(Z==="string")return i0.enum($);if(Z==="number"){let[Y,Q,...W]=$;return i0.union([i0.literal(Y),i0.literal(Q),...W.map((J)=>i0.literal(J))])}if(Z==="boolean")return i0.union([i0.literal(!0),i0.literal(!1)]);return!1}},qy=class{apply($,Z){let Y=Z;if(Y.type==="string"&&Y.format==="binary"&&Y.contentEncoding==="binary"){let Q=Oy.file();if(Y.minLength!==void 0)Q=Q.min(Y.minLength);if(Y.maxLength!==void 0)Q=Q.max(Y.maxLength);if(Y.contentMediaType!==void 0)Q=Q.mime(Y.contentMediaType);$.file=Q,$.string=!1}}},Ny=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.minLength!==void 0||Y.maxLength!==void 0||Y.pattern!==void 0)){if($.string===void 0)$.string=Q8.string()}}},My=class{apply($,Z){let Y=Z;if(Y.minLength===void 0)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString)$.string=Q.refine((W)=>{return Array.from(W).length>=Y.minLength},{message:`String must be at least ${Y.minLength} characters long`})}}},Py=class{apply($,Z){let Y=Z;if(Y.maxLength===void 0)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString)$.string=Q.refine((W)=>{return Array.from(W).length<=Y.maxLength},{message:`String must be at most ${Y.maxLength} characters long`})}}},wy=class{apply($,Z){let Y=Z;if(!Y.pattern)return;if($.string!==!1){let Q=$.string||Q8.string();if(Q instanceof Q8.ZodString){let W=new RegExp(Y.pattern);$.string=Q.regex(W)}}}},Ey=class{apply($,Z){let Y=Z;if(Y.minimum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.min(Y.minimum)}}},Ry=class{apply($,Z){let Y=Z;if(Y.maximum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.max(Y.maximum)}}},_y=class{apply($,Z){let Y=Z;if(Y.exclusiveMinimum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)if(typeof Y.exclusiveMinimum==="number")$.number=Q.gt(Y.exclusiveMinimum);else $.number=!1}}},Cy=class{apply($,Z){let Y=Z;if(Y.exclusiveMaximum===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)if(typeof Y.exclusiveMaximum==="number")$.number=Q.lt(Y.exclusiveMaximum);else $.number=!1}}},Iy=class{apply($,Z){let Y=Z;if(Y.multipleOf===void 0)return;if($.number!==!1){let Q=$.number||c0.number();if(Q instanceof c0.ZodNumber)$.number=Q.refine((W)=>{if(Y.multipleOf===0)return!1;let J=W/Y.multipleOf,G=Math.round(J),K=Math.min(Math.abs(W)*Number.EPSILON*10,Math.abs(Y.multipleOf)*Number.EPSILON*10);return Math.abs(J-G)<=K/Math.abs(Y.multipleOf)},{message:`Must be a multiple of ${Y.multipleOf}`})}}},fy=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.minItems!==void 0||Y.maxItems!==void 0||Y.items!==void 0||Y.prefixItems!==void 0)){if($.array===void 0)$.array=b1.array(b1.any())}}},Sy=class{apply($,Z){let Y=Z;if(Y.minItems===void 0)return;if($.array!==!1)$.array=($.array||b1.array(b1.any())).min(Y.minItems)}},by=class{apply($,Z){let Y=Z;if(Y.maxItems===void 0)return;if($.array!==!1)$.array=($.array||b1.array(b1.any())).max(Y.maxItems)}},vy=class{apply($,Z){let Y=Z;if($.array===!1)return;if(Array.isArray(Y.items))$.array=$.array||b1.array(b1.any());else if(Y.items&&typeof Y.items!=="boolean"&&!Y.prefixItems){let Q=I1(Y.items),W=b1.array(Q);if($.array&&$.array instanceof b1.ZodArray){let J=$.array._def;if(J.checks)J.checks.forEach((G)=>{if(G._zod&&G._zod.def){let K=G._zod.def;if(K.check==="min_length"&&K.minimum!==void 0)W=W.min(K.minimum);else if(K.check==="max_length"&&K.maximum!==void 0)W=W.max(K.maximum)}})}$.array=W}else if(typeof Y.items==="boolean"&&Y.items===!1)if(!Y.prefixItems)$.array=b1.array(b1.any()).max(0);else $.array=$.array||b1.array(b1.any());else if(typeof Y.items==="boolean"&&Y.items===!0)$.array=$.array||b1.array(b1.any());else if(Y.prefixItems)$.array=$.array||b1.array(b1.any())}},yy=class{apply($,Z){if(Z.type!=="array")return;let Y=Z;if(!Array.isArray(Y.items))return;if($.array===!1)return;let Q=Y.items.map((J)=>I1(J)),W;if(Q.length===0)W=BL.tuple([]);else W=BL.tuple(Q);if(Y.minItems!==void 0&&Y.minItems>Q.length)W=!1;if(Y.maxItems!==void 0&&Y.maxItems<Q.length)W=!1;$.tuple=W,$.array=!1}},Ty=class{apply($,Z){let Y=Z;if($.object===!1)return;if(Y.properties||Y.required||Y.additionalProperties!==void 0)$.object=$.object||x5.object({}).passthrough()}},ky=class{apply($,Z){let Y=Z;if(Z.type===void 0&&(Y.maxProperties!==void 0||Y.minProperties!==void 0)){if($.object===void 0)$.object=x5.object({}).passthrough()}}},xy=class{apply($,Z){let Y=Z;if(Y.maxProperties===void 0)return;if($.object!==!1){let Q=$.object||x5.object({}).passthrough();$.object=Q.refine((W)=>Object.keys(W).length<=Y.maxProperties,{message:`Object must have at most ${Y.maxProperties} properties`})}}},gy=class{apply($,Z){let Y=Z;if(Y.minProperties===void 0)return;if($.object!==!1){let Q=$.object||x5.object({}).passthrough();$.object=Q.refine((W)=>Object.keys(W).length>=Y.minProperties,{message:`Object must have at least ${Y.minProperties} properties`})}}};function q7($,Z){if($===Z)return!0;if($==null||Z==null)return $===Z;if(typeof $!==typeof Z)return!1;if(Array.isArray($)&&Array.isArray(Z)){if($.length!==Z.length)return!1;return $.every((Y,Q)=>q7(Y,Z[Q]))}if(typeof $==="object"&&typeof Z==="object"){let Y=Object.keys($),Q=Object.keys(Z);if(Y.length!==Q.length)return!1;return Y.every((W)=>Q.includes(W)&&q7($[W],Z[W]))}return!1}function uy(){return($)=>{if(!Array.isArray($))return!0;let Z=[];return $.every((Y)=>{if(Z.some((W)=>q7(Y,W)))return!1;return Z.push(Y),!0})}}function k5($,Z){return $.safeParse(Z).success}var hy=class{apply($,Z){if(!Z.not)return $;let Y=I1(Z.not);return $.refine((Q)=>!k5(Y,Q),{message:"Value must not match the 'not' schema"})}},my=class{apply($,Z){if(Z.uniqueItems!==!0)return $;return $.refine(uy(),{message:"Array items must be unique"})}},py=class{apply($,Z){if(!Z.allOf||Z.allOf.length===0)return $;return Z.allOf.map((Q)=>I1(Q)).reduce((Q,W)=>ly.intersection(Q,W),$)}},iy=class{apply($,Z){if(!Z.anyOf||Z.anyOf.length===0)return $;let Y=Z.anyOf.length===1?I1(Z.anyOf[0]):FL.union([I1(Z.anyOf[0]),I1(Z.anyOf[1]),...Z.anyOf.slice(2).map((Q)=>I1(Q))]);return FL.intersection($,Y)}},cy=class{apply($,Z){if(!Z.oneOf||Z.oneOf.length===0)return $;let Y=Z.oneOf.map((Q)=>I1(Q));return $.refine((Q)=>{let W=0;for(let J of Y)if(J.safeParse(Q).success){if(W++,W>1)return!1}return W===1},{message:"Value must match exactly one of the oneOf schemas"})}},dy=class{apply($,Z){let Y=Z;if(Y.prefixItems&&Array.isArray(Y.prefixItems)){let W=Y.prefixItems.map((J)=>I1(J));return $.refine((J)=>{if(!Array.isArray(J))return!0;for(let G=0;G<Math.min(J.length,W.length);G++)if(!k5(W[G],J[G]))return!1;if(J.length>W.length){if(typeof Y.items==="boolean"&&Y.items===!1)return!1;else if(Y.items&&typeof Y.items==="object"&&!Array.isArray(Y.items)){let G=I1(Y.items);for(let K=W.length;K<J.length;K++)if(!k5(G,J[K]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return $}},ny=class{apply($,Z){let Y=Z;if(!Y.properties&&!Y.required&&Y.additionalProperties!==!1)return $;if($ instanceof T5.ZodObject||$ instanceof T5.ZodRecord){let Q={};if(Y.properties){for(let[W,J]of Object.entries(Y.properties))if(J!==void 0)Q[W]=I1(J)}if(Y.required&&Array.isArray(Y.required)){let W=new Set(Y.required);for(let J of Object.keys(Q))if(!W.has(J))Q[J]=Q[J].optional()}else for(let W of Object.keys(Q))Q[W]=Q[W].optional();if(Y.additionalProperties===!1)return T5.object(Q);else return T5.object(Q).passthrough()}return $.refine((Q)=>{if(typeof Q!=="object"||Q===null||Array.isArray(Q))return!0;if(Y.properties){for(let[W,J]of Object.entries(Y.properties))if(J!==void 0){if(Object.getOwnPropertyDescriptor(Q,W)!==void 0){if(!I1(J).safeParse(Q[W]).success)return!1}}}if(Y.required&&Array.isArray(Y.required)){for(let W of Y.required)if(Object.getOwnPropertyDescriptor(Q,W)===void 0)return!1}if(Y.additionalProperties===!1&&Y.properties){let W=new Set(Object.keys(Y.properties));for(let J in Q)if(!W.has(J))return!1}return!0},{message:"Object constraints validation failed"})}},ry=class{apply($,Z){if(!Z.enum||Z.enum.length===0)return $;let Y=Z.enum.filter((Q)=>Array.isArray(Q)||typeof Q==="object"&&Q!==null);if(Y.length===0)return $;return $.refine((Q)=>{if(typeof Q!=="object"||Q===null)return!0;return Y.some((W)=>q7(Q,W))},{message:"Value must match one of the enum values"})}},ay=class{apply($,Z){if(Z.const===void 0)return $;let Y=Z.const;if(typeof Y!=="object"||Y===null)return $;return $.refine((Q)=>q7(Q,Y),{message:"Value must equal the const value"})}},oy=class{apply($,Z){if(Z.description)$=$.describe(Z.description);return $}},ty=class{apply($,Z){var Y;let Q=Z;if(!((Y=Q.required)==null?void 0:Y.includes("__proto__"))||Z.type!==void 0)return $;return sy.any().refine((W)=>this.validateRequired(W,Q.required),{message:"Missing required properties"})}validateRequired($,Z){if(typeof $!=="object"||$===null||Array.isArray($))return!0;return Z.every((Y)=>Object.prototype.hasOwnProperty.call($,Y))}},ey=class{apply($,Z){var Y;let Q=Z;if(Q.contains===void 0)return $;let W=I1(Q.contains),J=(Y=Q.minContains)!=null?Y:1,G=Q.maxContains;return $.refine((K)=>{if(!Array.isArray(K))return!0;let B=0;for(let D of K)if(k5(W,D))B++;if(B<J)return!1;if(G!==void 0&&B>G)return!1;return!0},{message:"Array must contain required items matching the schema"})}},$T=class{apply($,Z){let{default:Y}=Z;if(Y===void 0)return $;if(!$.safeParse(Y).success)return $;return $.default(Y)}},ZT=[new Ay,new zy,new jy,new qy,new Ny,new fy,new ky,new My,new Py,new wy,new Ey,new Ry,new _y,new Cy,new Iy,new yy,new Sy,new by,new vy,new xy,new gy,new Ty],YT=[new ty,new ry,new ay,new py,new iy,new cy,new dy,new ny,new ey,new hy,new my,new $T,new oy];function I1($){if(typeof $==="boolean")return $?O0.any():O0.never();let Z={};for(let W of ZT)W.apply(Z,$);let Y=[];if(Z.string!==!1)Y.push(Z.string||O0.string());if(Z.number!==!1)Y.push(Z.number||O0.number());if(Z.boolean!==!1)Y.push(Z.boolean||O0.boolean());if(Z.null!==!1)Y.push(Z.null||O0.null());if(Z.array!==!1)Y.push(Z.array||O0.array(O0.any()));if(Z.tuple!==!1&&Z.tuple!==void 0)Y.push(Z.tuple);if(Z.object!==!1)if(Z.object)Y.push(Z.object);else{let W=O0.custom((J)=>{return typeof J==="object"&&J!==null&&!Array.isArray(J)},"Must be an object, not an array");Y.push(W)}if(Z.file!==!1&&Z.file!==void 0)Y.push(Z.file);let Q;if(Y.length===0)Q=O0.never();else if(Y.length===1)Q=Y[0];else if(!Object.keys($).some((J)=>J!=="$schema"&&J!=="title"&&J!=="description"))Q=O0.any();else Q=O0.union(Y);for(let W of YT)Q=W.apply(Q,$);return Q}class SW extends Event{constructor($,Z){var Y,Q;super($),this.code=(Y=Z==null?void 0:Z.code)!=null?Y:void 0,this.message=(Q=Z==null?void 0:Z.message)!=null?Q:void 0}[Symbol.for("nodejs.util.inspect.custom")]($,Z,Y){return Y(DL(this),Z)}[Symbol.for("Deno.customInspect")]($,Z){return $(DL(this),Z)}}function QT($){let Z=globalThis.DOMException;return typeof Z=="function"?new Z($,"SyntaxError"):SyntaxError($)}function bW($){return $ instanceof Error?"errors"in $&&Array.isArray($.errors)?$.errors.map(bW).join(", "):("cause"in $)&&$.cause instanceof Error?`${$}: ${bW($.cause)}`:$.message:`${$}`}function DL($){return{type:$.type,message:$.message,code:$.code,defaultPrevented:$.defaultPrevented,cancelable:$.cancelable,timeStamp:$.timeStamp}}var LL=($)=>{throw TypeError($)},hW=($,Z,Y)=>Z.has($)||LL("Cannot "+Y),X1=($,Z,Y)=>(hW($,Z,"read from private field"),Y?Y.call($):Z.get($)),f1=($,Z,Y)=>Z.has($)?LL("Cannot add the same private member more than once"):Z instanceof WeakSet?Z.add($):Z.set($,Y),O1=($,Z,Y,Q)=>(hW($,Z,"write to private field"),Z.set($,Y),Y),G6=($,Z,Y)=>(hW($,Z,"access private method"),Y),Z0,X8,Z9,g5,u5,P7,X9,w7,x6,Y9,W9,Q9,N7,v0,vW,yW,TW,VL,kW,xW,M7,gW,uW;class J9 extends EventTarget{constructor($,Z){var Y,Q;super(),f1(this,v0),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,f1(this,Z0),f1(this,X8),f1(this,Z9),f1(this,g5),f1(this,u5),f1(this,P7),f1(this,X9),f1(this,w7,null),f1(this,x6),f1(this,Y9),f1(this,W9,null),f1(this,Q9,null),f1(this,N7,null),f1(this,yW,async(W)=>{var J;X1(this,Y9).reset();let{body:G,redirected:K,status:B,headers:D}=W;if(B===204){G6(this,v0,M7).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(K?O1(this,Z9,new URL(W.url)):O1(this,Z9,void 0),B!==200){G6(this,v0,M7).call(this,`Non-200 status code (${B})`,B);return}if(!(D.get("content-type")||"").startsWith("text/event-stream")){G6(this,v0,M7).call(this,'Invalid content type, expected "text/event-stream"',B);return}if(X1(this,Z0)===this.CLOSED)return;O1(this,Z0,this.OPEN);let V=new Event("open");if((J=X1(this,N7))==null||J.call(this,V),this.dispatchEvent(V),typeof G!="object"||!G||!("getReader"in G)){G6(this,v0,M7).call(this,"Invalid response body, expected a web ReadableStream",B),this.close();return}let L=new TextDecoder,A=G.getReader(),O=!0;do{let{done:q,value:M}=await A.read();M&&X1(this,Y9).feed(L.decode(M,{stream:!q})),q&&(O=!1,X1(this,Y9).reset(),G6(this,v0,gW).call(this))}while(O)}),f1(this,TW,(W)=>{O1(this,x6,void 0),!(W.name==="AbortError"||W.type==="aborted")&&G6(this,v0,gW).call(this,bW(W))}),f1(this,kW,(W)=>{typeof W.id=="string"&&O1(this,w7,W.id);let J=new MessageEvent(W.event||"message",{data:W.data,origin:X1(this,Z9)?X1(this,Z9).origin:X1(this,X8).origin,lastEventId:W.id||""});X1(this,Q9)&&(!W.event||W.event==="message")&&X1(this,Q9).call(this,J),this.dispatchEvent(J)}),f1(this,xW,(W)=>{O1(this,P7,W)}),f1(this,uW,()=>{O1(this,X9,void 0),X1(this,Z0)===this.CONNECTING&&G6(this,v0,vW).call(this)});try{if($ instanceof URL)O1(this,X8,$);else if(typeof $=="string")O1(this,X8,new URL($,XT()));else throw Error("Invalid URL")}catch{throw QT("An invalid or illegal string was specified")}O1(this,Y9,S5({onEvent:X1(this,kW),onRetry:X1(this,xW)})),O1(this,Z0,this.CONNECTING),O1(this,P7,3000),O1(this,u5,(Y=Z==null?void 0:Z.fetch)!=null?Y:globalThis.fetch),O1(this,g5,(Q=Z==null?void 0:Z.withCredentials)!=null?Q:!1),G6(this,v0,vW).call(this)}get readyState(){return X1(this,Z0)}get url(){return X1(this,X8).href}get withCredentials(){return X1(this,g5)}get onerror(){return X1(this,W9)}set onerror($){O1(this,W9,$)}get onmessage(){return X1(this,Q9)}set onmessage($){O1(this,Q9,$)}get onopen(){return X1(this,N7)}set onopen($){O1(this,N7,$)}addEventListener($,Z,Y){let Q=Z;super.addEventListener($,Q,Y)}removeEventListener($,Z,Y){let Q=Z;super.removeEventListener($,Q,Y)}close(){X1(this,X9)&&clearTimeout(X1(this,X9)),X1(this,Z0)!==this.CLOSED&&(X1(this,x6)&&X1(this,x6).abort(),O1(this,Z0,this.CLOSED),O1(this,x6,void 0))}}Z0=new WeakMap,X8=new WeakMap,Z9=new WeakMap,g5=new WeakMap,u5=new WeakMap,P7=new WeakMap,X9=new WeakMap,w7=new WeakMap,x6=new WeakMap,Y9=new WeakMap,W9=new WeakMap,Q9=new WeakMap,N7=new WeakMap,v0=new WeakSet,vW=function(){O1(this,Z0,this.CONNECTING),O1(this,x6,new AbortController),X1(this,u5)(X1(this,X8),G6(this,v0,VL).call(this)).then(X1(this,yW)).catch(X1(this,TW))},yW=new WeakMap,TW=new WeakMap,VL=function(){var $;let Z={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...X1(this,w7)?{"Last-Event-ID":X1(this,w7)}:void 0},cache:"no-store",signal:($=X1(this,x6))==null?void 0:$.signal};return"window"in globalThis&&(Z.credentials=this.withCredentials?"include":"same-origin"),Z},kW=new WeakMap,xW=new WeakMap,M7=function($,Z){var Y;X1(this,Z0)!==this.CLOSED&&O1(this,Z0,this.CLOSED);let Q=new SW("error",{code:Z,message:$});(Y=X1(this,W9))==null||Y.call(this,Q),this.dispatchEvent(Q)},gW=function($,Z){var Y;if(X1(this,Z0)===this.CLOSED)return;O1(this,Z0,this.CONNECTING);let Q=new SW("error",{code:Z,message:$});(Y=X1(this,W9))==null||Y.call(this,Q),this.dispatchEvent(Q),O1(this,X9,setTimeout(X1(this,uW),X1(this,P7)))},uW=new WeakMap,J9.CONNECTING=0,J9.OPEN=1,J9.CLOSED=2;function XT(){let $="document"in globalThis?globalThis.document:void 0;return $&&typeof $=="object"&&"baseURI"in $&&typeof $.baseURI=="string"?$.baseURI:void 0}class UL extends Error{constructor($,Z,Y){super(`SSE error: ${Z}`);this.code=$,this.event=Y}}class mW{constructor($,Z){this._url=$,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=Z?.eventSourceInit,this._requestInit=Z?.requestInit,this._authProvider=Z?.authProvider,this._fetch=Z?.fetch,this._fetchWithInit=z5(Z?.fetch,Z?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new e1("No auth provider");let $;try{$=await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(Z){throw this.onerror?.(Z),Z}if($!=="AUTHORIZED")throw new e1;return await this._startOrAuth()}async _commonHeaders(){let $={};if(this._authProvider){let Y=await this._authProvider.tokens();if(Y)$.Authorization=`Bearer ${Y.access_token}`}if(this._protocolVersion)$["mcp-protocol-version"]=this._protocolVersion;let Z=a8(this._requestInit?.headers);return new Headers({...$,...Z})}_startOrAuth(){let $=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((Z,Y)=>{this._eventSource=new J9(this._url.href,{...this._eventSourceInit,fetch:async(Q,W)=>{let J=await this._commonHeaders();J.set("Accept","text/event-stream");let G=await $(Q,{...W,headers:J});if(G.status===401&&G.headers.has("www-authenticate")){let{resourceMetadataUrl:K,scope:B}=$9(G);this._resourceMetadataUrl=K,this._scope=B}return G}}),this._abortController=new AbortController,this._eventSource.onerror=(Q)=>{if(Q.code===401&&this._authProvider){this._authThenStart().then(Z,Y);return}let W=new UL(Q.code,Q.message,Q);Y(W),this.onerror?.(W)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",(Q)=>{let W=Q;try{if(this._endpoint=new URL(W.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(J){Y(J),this.onerror?.(J),this.close();return}Z()}),this._eventSource.onmessage=(Q)=>{let W=Q,J;try{J=w6.parse(JSON.parse(W.data))}catch(G){this.onerror?.(G);return}this.onmessage?.(J)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth($){if(!this._authProvider)throw new e1("No auth provider");if(await p0(this._authProvider,{serverUrl:this._url,authorizationCode:$,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send($){if(!this._endpoint)throw Error("Not connected");try{let Z=await this._commonHeaders();Z.set("content-type","application/json");let Y={...this._requestInit,method:"POST",headers:Z,body:JSON.stringify($),signal:this._abortController?.signal},Q=await(this._fetch??fetch)(this._endpoint,Y);if(!Q.ok){let W=await Q.text().catch(()=>null);if(Q.status===401&&this._authProvider){let{resourceMetadataUrl:J,scope:G}=$9(Q);if(this._resourceMetadataUrl=J,this._scope=G,await p0(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new e1;return this.send($)}throw Error(`Error POSTing to endpoint (HTTP ${Q.status}): ${W}`)}await Q.body?.cancel()}catch(Z){throw this.onerror?.(Z),Z}}setProtocolVersion($){this._protocolVersion=$}}var WT="mcp";class lW{constructor($){this._url=$}start(){if(this._socket)throw Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise(($,Z)=>{this._socket=new WebSocket(this._url,WT),this._socket.onerror=(Y)=>{let Q="error"in Y?Y.error:Error(`WebSocket error: ${JSON.stringify(Y)}`);Z(Q),this.onerror?.(Q)},this._socket.onopen=()=>{$()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=(Y)=>{let Q;try{Q=w6.parse(JSON.parse(Y.data))}catch(W){this.onerror?.(W);return}this.onmessage?.(Q)}})}async close(){this._socket?.close()}send($){return new Promise((Z,Y)=>{if(!this._socket){Y(Error("Not connected"));return}this._socket?.send(JSON.stringify($)),Z()})}}class pW extends b5{constructor($,Z){super($,Z)}send($,Z){let Y=JT($);if(Y?.type==="emit")return this.onmessage?.(Y.message),Promise.resolve();if(Y?.type==="suppress")return Promise.resolve();return super.send($,Z)}}function JT($){let Z=$;if(!Z||typeof Z!=="object"||!("method"in Z))return null;switch(Z.method){case"initialize":{let Y=Z?.params?.protocolVersion;if(!Y)return null;return{type:"emit",message:{result:{protocolVersion:Y,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:Z.jsonrpc??"2.0",id:Z.id}}}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class jL extends A5{constructor($,Z){super($,Z)}async listTools($,Z){return await this.request({method:"tools/list",params:$},i9,Z)}}var AL=async($,Z,Y)=>{let Q=GT($.connection,Z,Y);if(!Q)throw Error("Unknown MCP connection type");let W=new jL({name:$?.name??"MCP Client",version:"1.0.0"});return await W.connect(Q),{client:W}},GT=($,Z,Y)=>{if($.type==="Websocket")return new lW(new URL($.url));if($.type!=="SSE"&&$.type!=="HTTP")return null;let W={...$.token?{authorization:`Bearer ${$.token}`}:{},...Y??{},..."headers"in $?$.headers||{}:{}};if($.type==="SSE"){let J={requestInit:{headers:W,signal:Z}};if($.token)J.eventSourceInit={fetch:(G,K)=>{return fetch(G,{...K,headers:{...W,Accept:"text/event-stream"},signal:Z})}};return new mW(new URL($.url),J)}return new pW(new URL($.url),{requestInit:{headers:W,signal:Z,credentials:"include"}})};var zL=($)=>{try{return JSON.parse($)}catch{return $}},h5=new Map,OL=($,Z)=>{return{...$,id:$.name,inputSchema:$.inputSchema?I1($.inputSchema):void 0,outputSchema:$.outputSchema?I1($.outputSchema):void 0,execute:(Y)=>{return Z(Y.context,$.name)}}};function qL($){let Z=(Y)=>{if("connection"in $)return AL({connection:$.connection},void 0,Y);return $.client};return new Proxy({},{get(Y,Q){if(Q==="toJSON")return null;if(typeof Q!=="string")throw Error("Name must be a string");if(Q==="listTools")return K;async function W(B,D=Q){let V=$?.debugId?.(),L=V?{"x-trace-debug-id":V}:void 0,{client:A}=await Z(L),{structuredContent:O,isError:q,content:M}=await A.callTool({name:String(D),arguments:B});if(q){let N=M?.[0]?.text,E=typeof N==="string"?zL(N):null,f=E?.code&&typeof $?.getErrorByStatusCode==="function"?$.getErrorByStatusCode(E.code,E.message,E.traceId):null;if(f)throw f;throw Error(`Tool ${String(D)} returned an error: ${JSON.stringify(O??M)}`)}if(O!==void 0)return O;let I=M?.[0]?.text;return typeof I==="string"?zL(I):void 0}async function J(){let{client:B}=await Z(),{tools:D}=await B.listTools();return D}async function G(){if(!("connection"in $))return J();let B=$.connection,D=JSON.stringify(B);try{if(!h5.has(D))h5.set(D,J());return await h5.get(D)}catch(V){console.error("Failed to list tools",V),h5.delete(D);return}}async function K(){return(await G()??[]).map((D)=>OL(D,W))}return W.asTool=async()=>{let D=(await G()??[]).find((V)=>V.name===Q);if(!D)throw Error(`Tool ${Q} not found`);return OL(D,W)},W}})}var V01=new Proxy({},{get($,Z){if(Z==="toJSON")return null;if(Z==="forConnection")return(Y)=>m5({connection:Y});return global[Z]}});function m5($){return qL($)}var NL=($)=>{return{...KT($),forClient:(Z)=>{return m5({client:Z})},forConnection:(Z)=>{return m5({connection:Z})}}};function KT($){return{isImplementedBy:(Z)=>{for(let Y of $){let Q=typeof Y.name==="string"?new RegExp(`^${Y.name}$`):Y.name,W=Z.find((J)=>Q.test(J.name));if(!W&&Y.opt)continue;if(!W)return!1}return!0}}}import{z as s}from"zod";var l5=s.object({id:s.string().describe("Unique identifier for the entity"),title:s.string().describe("Human-readable title for the entity"),description:s.string().nullish().describe("Description of the entity"),created_at:s.string().datetime(),updated_at:s.string().datetime(),created_by:s.string().optional(),updated_by:s.string().optional()}),HT=s.object({field:s.array(s.string()),operator:s.enum(["eq","gt","gte","lt","lte","in","like","contains"]),value:s.unknown()}),ML=s.lazy(()=>s.union([HT,s.object({operator:s.enum(["and","or","not"]),conditions:s.array(ML)})])),BT=s.object({field:s.array(s.string()),direction:s.enum(["asc","desc"]),nulls:s.enum(["first","last"]).optional()}),FT=s.object({where:ML.optional().describe("Filter expression"),orderBy:s.array(BT).optional().describe("Sort expressions"),limit:s.number().int().min(1).max(1000).optional().describe("Maximum number of items to return"),offset:s.number().int().min(0).optional().describe("Number of items to skip")});function DT($){return s.object({items:s.array($).describe("Array of collection items"),totalCount:s.number().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:s.boolean().optional().describe("Whether there are more items available")})}var VT=s.object({id:s.string().describe("ID of the entity to retrieve")});function LT($){return s.object({item:$.nullable().describe("The retrieved item, or null if not found")})}function UT($){return s.object({data:$.partial().describe("Data for the new entity (id may be auto-generated)")})}function jT($){return s.object({item:$.describe("The created entity with generated id")})}function AT($){return s.object({id:s.string().describe("ID of the entity to update"),data:$.partial().describe("Partial entity data to update")})}function zT($){return s.object({item:$.describe("The updated entity")})}var OT=s.object({id:s.string().describe("ID of the entity to delete")});function qT($){return s.object({item:$.describe("The deleted entity")})}function p5($,Z,Y){let Q=$.toUpperCase(),W=Y?.readOnly??!1,J=[{name:`COLLECTION_${Q}_LIST`,inputSchema:FT,outputSchema:DT(Z)},{name:`COLLECTION_${Q}_GET`,inputSchema:VT,outputSchema:LT(Z)}];if(!W)J.push({name:`COLLECTION_${Q}_CREATE`,inputSchema:UT(Z),outputSchema:jT(Z),opt:!0},{name:`COLLECTION_${Q}_UPDATE`,inputSchema:AT(Z),outputSchema:zT(Z),opt:!0},{name:`COLLECTION_${Q}_DELETE`,inputSchema:OT,outputSchema:qT(Z),opt:!0});return J}var iW=T.object({toolName:T.string().describe("Name of the tool to invoke on that connection"),transformCode:T.string().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),NT=T.object({code:T.string().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
|
|
961
961
|
The stepInput is the resolved value of the references in the input field. Example:
|
|
962
962
|
{
|
|
963
963
|
"input": {
|
|
@@ -966,7 +966,7 @@ If the tool returns an error, surface the error message to the user and ask whet
|
|
|
966
966
|
},
|
|
967
967
|
"code": "export default function(stepInput): Output { return { result: \`\${stepInput.name} is \${stepInput.age} years old.\` } }"
|
|
968
968
|
}
|
|
969
|
-
`)}),
|
|
969
|
+
`)}),P01=T.object({signalName:T.string().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")}),MT=T.union([iW.describe("Call an external tool via MCP connection. "),NT.describe("Run pure TypeScript code for data transformation. Useful to merge data from multiple steps and transform it.")]),PT=T.object({ref:T.string().describe("@ref to resolve and evaluate, e.g. '@validate.shouldStop' or '@input.skipProcessing'"),eq:T.unknown().optional().describe("Step bails if resolved value equals this"),neq:T.unknown().optional().describe("Step bails if resolved value does NOT equal this"),gt:T.number().optional().describe("Step bails if resolved value is greater than this"),lt:T.number().optional().describe("Step bails if resolved value is less than this")}),wT=T.object({maxAttempts:T.number().int().min(1).max(10).optional().describe("Max retry attempts on failure (default: 1, no retries)"),backoffMs:T.number().int().min(100).max(60000).optional().describe("Initial delay between retries in ms (doubles each attempt)"),timeoutMs:T.number().int().min(100).max(86400000).optional().describe("Max execution time in ms before step fails (default: 30000). Upper bound 24h."),onError:T.enum(["fail","continue"]).optional().describe("What to do when this step fails: 'fail' aborts the workflow, 'continue' skips the error and proceeds")}),G9=T.lazy(()=>T.object({type:T.string().optional(),properties:T.record(T.string(),T.unknown()).optional(),required:T.array(T.string()).optional(),description:T.string().optional(),additionalProperties:T.union([T.boolean(),T.record(T.string(),T.unknown())]).optional(),additionalItems:T.union([T.boolean(),T.record(T.string(),T.unknown())]).optional(),items:G9.optional()}).passthrough()),PL=["input","item","index","ctx"],W8=T.object({name:T.string().min(1).refine(($)=>!PL.includes($),{message:`Step name is reserved. Reserved names: ${PL.join(", ")}`}).describe("Unique identifier for this step. Other steps reference its output as @name.field"),description:T.string().optional().describe("What this step does"),action:MT,input:T.record(T.string(),T.unknown()).optional().describe("Data passed to the action. Use @ref for dynamic values: @input.field (workflow input), @stepName.field (previous step output), @item/@index (loop context), @ctx.execution_id (current execution ID). Example: { 'userId': '@input.user_id', 'data': '@fetch.result', 'executionId': '@ctx.execution_id' }"),outputSchema:G9.optional().describe("Optional JSON Schema describing the expected output of the step."),config:wT.optional().describe("Retry and timeout settings"),forEach:T.object({ref:T.string().describe("@ ref to the step to iterate over"),concurrency:T.number().optional().default(1).describe("max parallel iterations. default is 1 (sequential)")}).optional(),bail:T.union([T.literal(!0),PT]).optional().describe("Early return: if true, the workflow exits with this step's output on successful completion. If a condition object, the workflow exits only when the condition is met. Bail is ignored on step error.")}),ET=T.enum(["enqueued","running","success","error","failed","cancelled"]).default("enqueued"),wL=l5.extend({virtual_mcp_id:T.string().describe("ID of the virtual MCP (agent) that will be used to execute the workflow"),status:ET.describe("Current status of the workflow execution"),input:T.record(T.string(),T.unknown()).optional().describe("Input data for the workflow execution"),output:T.unknown().optional().describe("Output data for the workflow execution"),completed_at_epoch_ms:T.number().nullish().describe("Timestamp of when the workflow execution completed"),start_at_epoch_ms:T.number().nullish().describe("Timestamp of when the workflow execution started or will start"),timeout_ms:T.number().nullish().describe("Timeout in milliseconds for the workflow execution"),deadline_at_epoch_ms:T.number().nullish().describe("Deadline for the workflow execution - when the workflow execution will be cancelled if it is not completed. This is read-only and is set by the workflow engine when an execution is created."),error:T.unknown().nullish().describe("Error that occurred during the workflow execution"),completed_steps:T.object({success:T.array(T.object({name:T.string(),completed_at_epoch_ms:T.number()})).describe("Names of the steps that were completed successfully"),error:T.array(T.string()).describe("Names of the steps that errored")}).optional().describe("Names of the steps that were completed and their status"),running_steps:T.array(T.string()).optional().describe("Names of the steps that are currently running")}),RT=T.enum(["signal","timer","message","output","step_started","step_completed","workflow_started","workflow_completed"]),w01=l5.extend({execution_id:T.string(),type:RT,name:T.string().nullish(),payload:T.unknown().optional(),visible_at:T.number().nullish(),consumed_at:T.number().nullish(),source_execution_id:T.string().nullish()}),_T=l5.extend({description:T.string().optional().describe("Human-readable summary of what this workflow does"),input_schema:G9.optional().describe("Optional JSON Schema describing the expected input for this workflow."),steps:T.array(W8).describe("Ordered list of steps. Execution order is auto-determined by @ref dependencies: steps with no @ref dependencies run in parallel; steps referencing @stepName wait for that step to complete.")}),CT=p5("workflow",_T);var IT=p5("workflow_execution",wL),fT=[...CT,...IT],ST=[...fT],E01=NL(ST),R01=p5("workflow_execution",wL);function bT($,Z){let Y=[];function Q(W){if(typeof W==="string"){let J=W.match(/@([a-zA-Z_][a-zA-Z0-9_-]*)/g);if(J)for(let G of J){let K=G.substring(1);if(Z.has(K)&&K!==$.name)Y.push(K)}}else if(Array.isArray(W))W.forEach(Q);else if(typeof W==="object"&&W!==null)Object.values(W).forEach(Q)}if(Q($.input),$.bail&&$.bail!==!0)Q($.bail.ref);return[...new Set(Y)]}function EL($){let Z=new Set($.map((G)=>G.name)),Y=new Map;for(let G of $)Y.set(G.name,bT(G,Z));let Q=new Set,W=new Set;function J(G,K){if(W.has(G))return[...K,G];if(Q.has(G))return null;Q.add(G),W.add(G);let B=Y.get(G)||[];for(let D of B){let V=J(D,[...K,G]);if(V)return V}return W.delete(G),null}for(let G of $){let K=J(G.name,[]);if(K)return{isValid:!1,error:`Circular dependency detected: ${K.join(" -> ")}`}}return{isValid:!0}}function K6($,Z=10,Y=0){if(Y>Z)throw Error("Input schema exceeds maximum nesting depth");if($==null||typeof $!=="object"||Array.isArray($))return;let Q=$;if(Q.properties&&typeof Q.properties==="object")for(let W of Object.values(Q.properties))K6(W,Z,Y+1);if(Q.items)K6(Q.items,Z,Y+1);if(Q.additionalProperties&&typeof Q.additionalProperties==="object")K6(Q.additionalProperties,Z,Y+1);for(let W of["anyOf","allOf","oneOf","not","if","then","else"]){let J=Q[W];if(Array.isArray(J))for(let G of J)K6(G,Z,Y+1);else if(J&&typeof J==="object")K6(J,Z,Y+1)}for(let W of["$defs","definitions"]){let J=Q[W];if(J&&typeof J==="object"&&!Array.isArray(J))for(let G of Object.values(J))K6(G,Z,Y+1)}}var vT=new Set(["properties","$defs","definitions","dependentSchemas"]);function E7($){if($==null||typeof $!=="object")return $;if(Array.isArray($))return $.map(E7);let Z=$,Y={};for(let[Q,W]of Object.entries(Z)){if(Q==="pattern"&&typeof W==="string")continue;if(Q==="patternProperties"&&typeof W==="object"&&W!==null)continue;if(vT.has(Q)&&typeof W==="object"&&W!==null&&!Array.isArray(W)){let J={};for(let[G,K]of Object.entries(W))J[G]=E7(K);Y[Q]=J;continue}Y[Q]=E7(W)}return Y}function cW($){if($==null)return;if(JSON.stringify($).length>1e5)throw Error("Input schema exceeds size limit");K6($)}function RL($){let Z=$;return{...Z,name:typeof Z.name==="string"?Z.name.trim().replaceAll(/\s+/g,"_"):Z.name}}var _L={name:"COLLECTION_WORKFLOW_LIST",description:"List workflows with pagination. Does not include steps -- use GET for full details.",inputSchema:c.object({limit:c.number().optional().default(50),offset:c.number().optional().default(0)}),outputSchema:c.object({items:c.array(c.object({id:c.string(),title:c.string(),description:c.string().nullable(),virtual_mcp_id:c.string(),created_at:c.string(),updated_at:c.string()})),totalCount:c.number(),hasMore:c.boolean()}),handler:async($,Z)=>{let Y=$0(Z);await Y.access.check();let Q=$,W=u1(),{items:J,totalCount:G}=await W.collections.list(Y.organization.id,{limit:Q.limit,offset:Q.offset});return{items:J.map((K)=>({id:K.id,title:K.title,description:K.description,virtual_mcp_id:K.virtual_mcp_id,created_at:K.created_at,updated_at:K.updated_at})),totalCount:G,hasMore:(Q.offset??0)+J.length<G}}},CL={name:"COLLECTION_WORKFLOW_GET",description:"Get a single workflow by ID, including its steps.",inputSchema:c.object({id:c.string()}),outputSchema:c.object({item:c.object({id:c.string(),title:c.string(),description:c.string().nullable(),virtual_mcp_id:c.string(),steps:c.array(W8),input_schema:c.unknown().nullish(),created_at:c.string(),updated_at:c.string()}).nullable()}),handler:async($,Z)=>{let Y=$0(Z);await Y.access.check();let{id:Q}=$,J=await u1().collections.getById(Q,Y.organization.id);if(!J)return{item:null};return{item:{id:J.id,title:J.title,description:J.description,virtual_mcp_id:J.virtual_mcp_id,steps:J.steps,input_schema:J.input_schema,created_at:J.created_at,updated_at:J.updated_at}}}},IL={name:"COLLECTION_WORKFLOW_CREATE",description:`Create a workflow template. This is a reusable definition, not an execution.
|
|
970
970
|
|
|
971
971
|
Key concepts:
|
|
972
972
|
- Steps without references run immediately (in parallel).
|
|
@@ -1152,4 +1152,4 @@ ${JSON.stringify(Z,null,2).substring(0,500)}`}catch{}return{stepId:Y,startedAt:W
|
|
|
1152
1152
|
`.execute($),Q=new Set(Y.rows.map((G)=>`${G.plugin_id}/${G.name}`)),W=new Map;for(let{pluginId:G,migration:K}of Z){if(!W.has(G))W.set(G,[]);W.get(G).push({name:K.name,up:K.up})}let J=0;for(let[G,K]of W){K.sort((B,D)=>B.name.localeCompare(D.name));for(let B of K){let D=`${G}/${B.name}`;if(Q.has(D))continue;J++,await B.up($);let V=new Date().toISOString();await p6`
|
|
1153
1153
|
INSERT INTO plugin_migrations (plugin_id, name, timestamp)
|
|
1154
1154
|
VALUES (${G}, ${B.name}, ${V})
|
|
1155
|
-
`.execute($)}}return J}async function Vh($){await Bh($),await Fh($);let Z=new H2({db:$,provider:{getMigrations:()=>Promise.resolve(JQ)}}),{error:Y,results:Q}=await Z.migrateToLatest(),W=0;if(Q?.forEach((J)=>{if(J.status==="Success")W++;else if(J.status==="Error")console.error(`Failed to execute migration "${J.migrationName}"`)}),Y)throw console.error("Failed to migrate"),console.error(Y),Y;return W}async function Lh($){let{keepOpen:Z=!1,database:Y,skipBetterAuth:Q=!1}=$??{},W="skipped";if(!Q&&!Y)W=await jK();let J=Y??DQ(),G=async()=>{if(!Z&&!Y)await UK(J).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await Vh(J.db),B=await Dh(J.db);return await G(),{betterAuth:W,kysely:K,plugins:B}}catch(K){throw await G(),K}}async function
|
|
1155
|
+
`.execute($)}}return J}async function Vh($){await Bh($),await Fh($);let Z=new H2({db:$,provider:{getMigrations:()=>Promise.resolve(JQ)}}),{error:Y,results:Q}=await Z.migrateToLatest(),W=0;if(Q?.forEach((J)=>{if(J.status==="Success")W++;else if(J.status==="Error")console.error(`Failed to execute migration "${J.migrationName}"`)}),Y)throw console.error("Failed to migrate"),console.error(Y),Y;return W}async function Lh($){let{keepOpen:Z=!1,database:Y,skipBetterAuth:Q=!1}=$??{},W="skipped";if(!Q&&!Y)W=await jK();let J=Y??DQ(),G=async()=>{if(!Z&&!Y)await UK(J).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await Vh(J.db),B=await Dh(J.db);return await G(),{betterAuth:W,kysely:K,plugins:B}}catch(K){throw await G(),K}}async function w31(){let $=DQ(),Z=new H2({db:$.db,provider:{getMigrations:()=>Promise.resolve(JQ)}}),{error:Y,results:Q}=await Z.migrateDown();if(Q?.forEach((W)=>{if(W.status==="Success")console.log(`\u2705 Migration "${W.migrationName}" rolled back successfully`);else if(W.status==="Error")console.error(`\u274C Failed to rollback migration "${W.migrationName}"`)}),Y)throw console.error("Failed to rollback migration"),console.error(Y),Y}if(import.meta.main)(async()=>{try{await Lh(),console.log("Migrations completed."),process.exit(0)}catch($){console.error("Migration failed:",$),process.exit(1)}})();export{Vh as runKyselyMigrations,Lh as migrateToLatest,w31 as migrateDown};
|