@inkeep/open-knowledge 0.31.0-beta.5 → 0.31.0-beta.7
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/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +17 -17
- package/dist/config-schema.json +17 -0
- package/dist/config.project-local.schema.json +17 -0
- package/dist/constants-B8Zie8rF.mjs +2 -0
- package/dist/dist-BYM_jxPa.mjs +1 -0
- package/dist/{dist-DEBa6nkk.mjs → dist-Pe1Q8dMj.mjs} +24 -24
- package/dist/{gh-detect-Cm8hekXk.mjs → gh-detect-C6QZctcU.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/init-D3BvztSN.mjs +1 -0
- package/dist/{init-reB4XeLP.mjs → init-DT-9Ccjv.mjs} +5 -5
- package/dist/{launch-json-removal-v_ZIEJ04.mjs → launch-json-removal-bo3gNUN4.mjs} +2 -2
- package/dist/loader-BiXk2JV6.mjs +1 -0
- package/dist/{loader-C3crD0ZW.mjs → loader-Biqewihc.mjs} +2 -2
- package/dist/{open-browser-B5KfPH4H.mjs → open-browser-CPSoIF8R.mjs} +2 -2
- package/dist/preview-BrPKQxiM.mjs +1 -0
- package/dist/{preview-yptAXY9Q.mjs → preview-DhDDUDKS.mjs} +2 -2
- package/dist/public/assets/ActivityModeContent-DCeOqkvP.js +2 -0
- package/dist/public/assets/CodeMirrorPropInput-B1vWorID.js +3 -0
- package/dist/public/assets/{ConsentDialogBody-DUEo7dzd.js → ConsentDialogBody-TGvdiCLr.js} +1 -1
- package/dist/public/assets/CopyButton-DoEsGDa4.js +1 -0
- package/dist/public/assets/DocumentContext-BhV2wOiZ.js +36 -0
- package/dist/public/assets/{EnableSyncConfirmDialog-CDm2rW8c.js → EnableSyncConfirmDialog-Ca-ry-Ae.js} +1 -1
- package/dist/public/assets/{GraphPanel-BSBoTUuF.js → GraphPanel-lBz9qIQN.js} +9 -9
- package/dist/public/assets/ManagedArtifactProperties-D_Nk4cbN.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-DZr8d0vu.js → McpConsentDialogBody-Bsj9E3Ff.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DqKOZzfV.js → MermaidDocEditor-DX5BTbSo.js} +1 -1
- package/dist/public/assets/PropertyPanel-CDFSWToc.js +2 -0
- package/dist/public/assets/ReportBugDialogBody-CJkfjKa2.js +2 -0
- package/dist/public/assets/SettingsDialogBody-CZ8Q6HdO.js +7 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-Dv66XosJ.js → ShareBranchSwitchDialog-BF1nOzHu.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-DcJrhi3C.js → ShareReceiveDialog-Dqg_ZHxL.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-8AKkkTF9.js → ShareReceiveMissDialog-Cmk3vfV-.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-D7GmHyae.js → SkillEditorActions-kSWzLf2i.js} +1 -1
- package/dist/public/assets/{SourceEditor-F7MHMYDQ.js → SourceEditor-DUfgIVNL.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Z0XhL8rx.js → TerminalPanel-z1aKcdQN.js} +3 -3
- package/dist/public/assets/{_baseFor-VECk3xZB.js → _baseFor-0d9AvFx1.js} +1 -1
- package/dist/public/assets/{agent-presence-Bf_k8RmI.js → agent-presence-CR_Kl3f1.js} +1 -1
- package/dist/public/assets/{arc-CxehPN-O.js → arc-BWLwkJ2r.js} +1 -1
- package/dist/public/assets/architecture-YZFGNWBL-9BNhGkdz.js +1 -0
- package/dist/public/assets/{architectureDiagram-Q4EWVU46-BP3qpyaD.js → architectureDiagram-Q4EWVU46-KXeh9itt.js} +1 -1
- package/dist/public/assets/auth-state-cache-QESJRGUP.js +11 -0
- package/dist/public/assets/{blockDiagram-DXYQGD6D-B5TD8A38.js → blockDiagram-DXYQGD6D-DtrdFoMb.js} +1 -1
- package/dist/public/assets/{c4Diagram-AHTNJAMY-DXobwygF.js → c4Diagram-AHTNJAMY-fq1Z49Kc.js} +1 -1
- package/dist/public/assets/{calendar-DvL8Q5iT.js → calendar-B2qs7swV.js} +1 -1
- package/dist/public/assets/channel-CuMNseph.js +1 -0
- package/dist/public/assets/{checkbox-09LNjybZ.js → checkbox-CgcvT5md.js} +1 -1
- package/dist/public/assets/{chunk-2KRD3SAO-DDUdr-iX.js → chunk-2KRD3SAO-Bk_Wilkm.js} +1 -1
- package/dist/public/assets/{chunk-336JU56O-B_KFr_Bs.js → chunk-336JU56O-CL9kwjEg.js} +2 -2
- package/dist/public/assets/chunk-426QAEUC-pZbdhoaS.js +1 -0
- package/dist/public/assets/{chunk-4BX2VUAB-DRfG-ueY.js → chunk-4BX2VUAB-D96BT_Bg.js} +1 -1
- package/dist/public/assets/{chunk-4TB4RGXK-B0Gnlc8Z.js → chunk-4TB4RGXK-1ZoApeth.js} +1 -1
- package/dist/public/assets/chunk-55IACEB6-HEGApgMn.js +1 -0
- package/dist/public/assets/{chunk-5FUZZQ4R-CVl_7PAT.js → chunk-5FUZZQ4R-DPbA0GBM.js} +1 -1
- package/dist/public/assets/{chunk-5PVQY5BW-Cfkq4RiL.js → chunk-5PVQY5BW-CQS0U6F7.js} +1 -1
- package/dist/public/assets/{chunk-67CJDMHE-G9bUyIhz.js → chunk-67CJDMHE-okMxnkQT.js} +1 -1
- package/dist/public/assets/{chunk-7N4EOEYR-URuUKEXP.js → chunk-7N4EOEYR-Drske5an.js} +1 -1
- package/dist/public/assets/{chunk-AA7GKIK3-DRCEQeZY.js → chunk-AA7GKIK3-BlHxQeSp.js} +1 -1
- package/dist/public/assets/{chunk-BSJP7CBP-DGKfJILj.js → chunk-BSJP7CBP-BpNyv8Y4.js} +1 -1
- package/dist/public/assets/{chunk-CIAEETIT-C-4SSDk6.js → chunk-CIAEETIT-8deU_mkj.js} +1 -1
- package/dist/public/assets/{chunk-EDXVE4YY-B7GwVaSD.js → chunk-EDXVE4YY-VzPvg9KF.js} +1 -1
- package/dist/public/assets/{chunk-ENJZ2VHE-BaPHkOPd.js → chunk-ENJZ2VHE-BjhT8OeZ.js} +1 -1
- package/dist/public/assets/{chunk-FMBD7UC4-Sg4QfR2X.js → chunk-FMBD7UC4-CGtQ8v2r.js} +1 -1
- package/dist/public/assets/{chunk-FOC6F5B3-D76iMJUf.js → chunk-FOC6F5B3--YnpQUAX.js} +1 -1
- package/dist/public/assets/{chunk-ICPOFSXX-DlM8yc3o.js → chunk-ICPOFSXX-By9Q-6fm.js} +2 -2
- package/dist/public/assets/{chunk-K5T4RW27-o4pGUO6-.js → chunk-K5T4RW27-C_6VcMXC.js} +1 -1
- package/dist/public/assets/{chunk-KGLVRYIC-DlaCM317.js → chunk-KGLVRYIC-C3De9ry6.js} +1 -1
- package/dist/public/assets/{chunk-LIHQZDEY-wt2Qc-rg.js → chunk-LIHQZDEY-D4-GsYgm.js} +1 -1
- package/dist/public/assets/{chunk-ORNJ4GCN-BHgDQV41.js → chunk-ORNJ4GCN-qQUTfvQr.js} +1 -1
- package/dist/public/assets/{chunk-OYMX7WX6-BHQCcMht.js → chunk-OYMX7WX6-DAJTRr-n.js} +1 -1
- package/dist/public/assets/chunk-QZHKN3VN-DI8KBGbP.js +1 -0
- package/dist/public/assets/{chunk-U2HBQHQK-D4H3Zear.js → chunk-U2HBQHQK-Cp-6rjnO.js} +1 -1
- package/dist/public/assets/{chunk-X2U36JSP-ByMMuCmz.js → chunk-X2U36JSP-BFqfQNWU.js} +1 -1
- package/dist/public/assets/{chunk-XPW4576I-DGAGb6jI.js → chunk-XPW4576I-DI0-cfrS.js} +1 -1
- package/dist/public/assets/{chunk-YZCP3GAM-CLKcOka4.js → chunk-YZCP3GAM-sn7T8ho2.js} +1 -1
- package/dist/public/assets/{chunk-ZZ45TVLE-nqD2epOe.js → chunk-ZZ45TVLE-CxH2fGjk.js} +1 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-D98rNdcz.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-Cz77sXrt.js +1 -0
- package/dist/public/assets/clone-DXiEg0sZ.js +1 -0
- package/dist/public/assets/config-provider-DJpUWM8E.js +4 -0
- package/dist/public/assets/copy-D8YVE0Jc.js +1 -0
- package/dist/public/assets/{cose-bilkent-S5V4N54A-B2yzzZk8.js → cose-bilkent-S5V4N54A-CXBsVXq9.js} +1 -1
- package/dist/public/assets/{dagre-BIgQuqiZ.js → dagre-C2Qb6hf2.js} +1 -1
- package/dist/public/assets/{dagre-KV5264BT-D7ZMiRem.js → dagre-KV5264BT-BQUJovtG.js} +1 -1
- package/dist/public/assets/{diagram-5BDNPKRD-BYEpe_ZJ.js → diagram-5BDNPKRD-C6tTTvBq.js} +1 -1
- package/dist/public/assets/{diagram-G4DWMVQ6-DxQlpGFr.js → diagram-G4DWMVQ6-Cq1-s9xc.js} +1 -1
- package/dist/public/assets/{diagram-MMDJMWI5-RJKi5ZMs.js → diagram-MMDJMWI5-BE-MhKN8.js} +1 -1
- package/dist/public/assets/{diagram-TYMM5635-Cbv6Q-Tj.js → diagram-TYMM5635-G0QPzMX4.js} +1 -1
- package/dist/public/assets/{dialog-CZK_GJbX.js → dialog-BvTRDNMV.js} +1 -1
- package/dist/public/assets/{dist-5OMiBr1O.js → dist-B0sSo1rx.js} +1 -1
- package/dist/public/assets/{dist-CK-u_yUG.js → dist-BI2wTleN.js} +1 -1
- package/dist/public/assets/{dist-BmgoHUkm.js → dist-Bj4Ae4LE.js} +108 -108
- package/dist/public/assets/{dist-LUHivJAB.js → dist-C9FdwUZB.js} +1 -1
- package/dist/public/assets/{dist-C1stM53P.js → dist-C9Q20TxL.js} +1 -1
- package/dist/public/assets/{dist-Ctotkt8m.js → dist-CFvMrf5i.js} +1 -1
- package/dist/public/assets/{dist-DJzR_Ier.js → dist-CN2Ak373.js} +1 -1
- package/dist/public/assets/{dist-yzeYbK6D.js → dist-CPK5NxVp.js} +1 -1
- package/dist/public/assets/{dist-DJkVfTTW.js → dist-C_9BPzNE.js} +1 -1
- package/dist/public/assets/{dist-DwYhX11V.js → dist-CqC3taBS.js} +1 -1
- package/dist/public/assets/{dist-CD524qWG.js → dist-DfkfQshV.js} +1 -1
- package/dist/public/assets/{dist-V49XHj-a.js → dist-LqTeaHS1.js} +1 -1
- package/dist/public/assets/dist-jyqE5kfZ.js +1 -0
- package/dist/public/assets/{dist-DIOoTUYz.js → dist-p4lElMBx.js} +1 -1
- package/dist/public/assets/{doc-hash-W5LZeE0c.js → doc-hash-BvJ4F5wQ.js} +1 -1
- package/dist/public/assets/{documents-events-CijCy-Sc.js → documents-events-KDHNhdfV.js} +1 -1
- package/dist/public/assets/{erDiagram-SMLLAGMA-BmMOegIt.js → erDiagram-SMLLAGMA-N7gNLe9o.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-Bjoeiw_B.js → file-tree-adapter-D99FaCGJ.js} +1 -1
- package/dist/public/assets/{flatten-CCmz8_dj.js → flatten-dENnAN6s.js} +1 -1
- package/dist/public/assets/{flowDiagram-DWJPFMVM-0LqPtkiA.js → flowDiagram-DWJPFMVM-DgclgNSr.js} +1 -1
- package/dist/public/assets/{ganttDiagram-T4ZO3ILL-DRsSWVHe.js → ganttDiagram-T4ZO3ILL-CAydivVh.js} +1 -1
- package/dist/public/assets/gitGraph-7Q5UKJZL-DuuJiYvS.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-BdADm4E0.js → gitGraphDiagram-UUTBAWPF-Qfom5ijS.js} +1 -1
- package/dist/public/assets/{graphlib-Dg3M3E4b.js → graphlib-BZWt_BGf.js} +1 -1
- package/dist/public/assets/index-C3IDVWhb.css +1 -0
- package/dist/public/assets/index-DZyzbLiq.js +2003 -0
- package/dist/public/assets/info-OMHHGYJF-DmgDPzke.js +1 -0
- package/dist/public/assets/{infoDiagram-42DDH7IO-qvYhaJaR.js → infoDiagram-42DDH7IO-BLFTlht0.js} +1 -1
- package/dist/public/assets/{isEmpty-C5m2-RSe.js → isEmpty-Dg6Et8UD.js} +1 -1
- package/dist/public/assets/isSymbol-BhYgyzzO.js +1 -0
- package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-CcivmKPd.js → ishikawaDiagram-UXIWVN3A-C8gBLX8v.js} +1 -1
- package/dist/public/assets/{journeyDiagram-VCZTEJTY-ouWVthki.js → journeyDiagram-VCZTEJTY-DVV127Ia.js} +1 -1
- package/dist/public/assets/{kanban-definition-6JOO6SKY-ZhUMH8F2.js → kanban-definition-6JOO6SKY-Bi_LNUlw.js} +1 -1
- package/dist/public/assets/{keyboard-shortcuts-DDw4HRe3.js → keyboard-shortcuts-9kQVtaDu.js} +1 -1
- package/dist/public/assets/{line-So0Nf7v2.js → line-CuRBOqmw.js} +1 -1
- package/dist/public/assets/{linear-7dqmcJYs.js → linear-BnfMN22g.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-gjoLdFzV.js → mermaid-parser.core-noqTIfNm.js} +2 -2
- package/dist/public/assets/{mermaid.core-DIaQcKcu.js → mermaid.core-DMKNygs1.js} +3 -3
- package/dist/public/assets/{mindmap-definition-QFDTVHPH-BpktrSi5.js → mindmap-definition-QFDTVHPH-DLIIn_h8.js} +1 -1
- package/dist/public/assets/{navigation-targets-V0noaD6h.js → navigation-targets-B1j0YdRn.js} +1 -1
- package/dist/public/assets/{now-Dslec7Y8.js → now-esIbxJzw.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-_d-k5W-o.js → open-managed-artifact-tab-BThYnqZz.js} +1 -1
- package/dist/public/assets/{ordinal-GH4e7Z1z.js → ordinal-DYUgOuL7.js} +1 -1
- package/dist/public/assets/packet-4T2RLAQJ-CVcq-ivT.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-Cqe-Gc-y.js → pending-receive-nav-store-D9kW0zL5.js} +1 -1
- package/dist/public/assets/pie-ZZUOXDRM-DSvYqp8t.js +1 -0
- package/dist/public/assets/{pieDiagram-DEJITSTG-BPZLf8gB.js → pieDiagram-DEJITSTG-C-vgeRar.js} +1 -1
- package/dist/public/assets/{project-paths-Bg2cu_Xr.js → project-paths-CqH22Xq0.js} +1 -1
- package/dist/public/assets/{prop-types-DK0zwiLA.js → prop-types-CADDENK9.js} +1 -1
- package/dist/public/assets/{propagation-api-C0PBUfbG.js → propagation-api-M_AcuP6N.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-34T5L4WZ-pdw_MogG.js → quadrantDiagram-34T5L4WZ-BmQcA7GQ.js} +1 -1
- package/dist/public/assets/radar-PYXPWWZC-BrGdIzLo.js +1 -0
- package/dist/public/assets/{radio-group-CkH5F_ZT.js → radio-group-DyHNJs2C.js} +1 -1
- package/dist/public/assets/{receive-store-DIQKaDkz.js → receive-store-1Qk9uwTc.js} +1 -1
- package/dist/public/assets/{reduce-CmXLDnl6.js → reduce-BKUJZ1TP.js} +1 -1
- package/dist/public/assets/{requirementDiagram-MS252O5E-BPFpj55s.js → requirementDiagram-MS252O5E-DPE-Czmf.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-XADWPNL6-BlIkXMJT.js → sankeyDiagram-XADWPNL6-C6mEVWX1.js} +1 -1
- package/dist/public/assets/{selection-context-D7Vmm-jV.js → selection-context-_wSKX4pT.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-FGHM5R23-DiHLgJYc.js → sequenceDiagram-FGHM5R23-rp9LrkhC.js} +1 -1
- package/dist/public/assets/skill-actions-CnQtb5aQ.js +1 -0
- package/dist/public/assets/{skills-api-FVkz2ZvD.js → skills-api-C6f0gQUn.js} +1 -1
- package/dist/public/assets/{src-BfQVXkAq.js → src-DIGGo2K4.js} +1 -1
- package/dist/public/assets/{src-CqaRgyJX.js → src-sATQ-1TS.js} +1 -1
- package/dist/public/assets/{stateDiagram-FHFEXIEX-BvvfLH6H.js → stateDiagram-FHFEXIEX-4q5ruYzC.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-9Y5TkQAw.js +1 -0
- package/dist/public/assets/{target-navigation-intent-BF4mAnMq.js → target-navigation-intent-DszwtIOt.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DkfWYdsZ.js → telemetry-impl-Cs0UMIR2.js} +2 -2
- package/dist/public/assets/telemetry-startup-BO7q-IdH.js +1 -0
- package/dist/public/assets/{timeline-definition-GMOUNBTQ-Cm-_wwCn.js → timeline-definition-GMOUNBTQ-CRtE2coR.js} +1 -1
- package/dist/public/assets/{toggle-group-B_aSxEq-.js → toggle-group-Hn7Etr9N.js} +1 -1
- package/dist/public/assets/{tooltip-DZYAkZo5.js → tooltip-tSMIHkKA.js} +1 -1
- package/dist/public/assets/treeView-SZITEDCU-C_aWaIS6.js +1 -0
- package/dist/public/assets/treemap-W4RFUUIX-CcQyutfG.js +1 -0
- package/dist/public/assets/{typing-burst-detector-D0BBhVWB.js → typing-burst-detector--_GJ5sz1.js} +1 -1
- package/dist/public/assets/{vennDiagram-DHZGUBPP-rndTcHCv.js → vennDiagram-DHZGUBPP-B5-arv9-.js} +1 -1
- package/dist/public/assets/wardley-RL74JXVD-B57ZwOFM.js +1 -0
- package/dist/public/assets/{wardleyDiagram-NUSXRM2D-D0g460BL.js → wardleyDiagram-NUSXRM2D-NXmNnKuY.js} +1 -1
- package/dist/public/assets/workspace-paths-GEb_gilm.js +1 -0
- package/dist/public/assets/{xychartDiagram-5P7HB3ND-DzjJ5eMr.js → xychartDiagram-5P7HB3ND-B_cLbDrg.js} +1 -1
- package/dist/public/index.html +79 -80
- package/dist/{repair-launch-json-DJL0xXvL.mjs → repair-launch-json-B6nfMuDG.mjs} +2 -2
- package/dist/{repair-mcp-configs-DsGk5WD7.mjs → repair-mcp-configs-CfO_BZxd.mjs} +2 -2
- package/dist/repair-skills-BDe9l22O.mjs +1 -0
- package/dist/{repair-skills-wFFbPc3w.mjs → repair-skills-DuNm-kMp.mjs} +2 -2
- package/dist/schemas/v0/config.project-local.schema.json +17 -0
- package/dist/server-lock-GuuouVft-CO_sPVNi.mjs +1 -0
- package/dist/{server-lock-iLcBw_q0-CEih6ZHm.mjs → server-lock-iLcBw_q0-nWzkxbfg.mjs} +17 -17
- package/dist/{src-DHfQops5.mjs → src-CU3zxCid.mjs} +2 -2
- package/dist/{start-r9b4OB7D.mjs → start-D9sidghM.mjs} +2 -2
- package/dist/start-DHrKkLIh.mjs +1 -0
- package/dist/{write-project-skill-CAZzOEUh.mjs → write-project-skill-DyoxYjJB.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-DK10Qbwz.mjs +0 -2
- package/dist/dist-D-bO1Mlq.mjs +0 -1
- package/dist/init-BGGQ3ing.mjs +0 -1
- package/dist/loader-pzsmJGfG.mjs +0 -1
- package/dist/preview-GYvJ1m2X.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-DIN900Tw.js +0 -2
- package/dist/public/assets/CodeMirrorPropInput-ZO7IAXY4.js +0 -3
- package/dist/public/assets/DocumentContext-yguu7wL1.js +0 -35
- package/dist/public/assets/ManagedArtifactProperties-DCr0fsi-.js +0 -1
- package/dist/public/assets/PropertyPanel-C_ExYapZ.js +0 -2
- package/dist/public/assets/ReportBugDialogBody-C_Q3PS3L.js +0 -2
- package/dist/public/assets/SettingsDialogBody-ILc_zuoi.js +0 -7
- package/dist/public/assets/architecture-YZFGNWBL-DsxJN6Kz.js +0 -1
- package/dist/public/assets/auth-state-cache-Ck3G6jUi.js +0 -11
- package/dist/public/assets/channel-DVu0OxhH.js +0 -1
- package/dist/public/assets/chunk-426QAEUC-RFGaT71Y.js +0 -1
- package/dist/public/assets/chunk-55IACEB6-DAOIsDKo.js +0 -1
- package/dist/public/assets/chunk-QZHKN3VN-BcpoMdLu.js +0 -1
- package/dist/public/assets/circle-alert-sOrK-E2e.js +0 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-MnKF6SyF.js +0 -1
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-zCakvYeI.js +0 -1
- package/dist/public/assets/clone-C-i8X3vQ.js +0 -1
- package/dist/public/assets/config-provider-CQL47dca.js +0 -4
- package/dist/public/assets/dist-CCW5cnWo.js +0 -1
- package/dist/public/assets/dist-D-nYc0c5.js +0 -1
- package/dist/public/assets/file-text-et24uQST.js +0 -1
- package/dist/public/assets/gitGraph-7Q5UKJZL-D_-MQMqR.js +0 -1
- package/dist/public/assets/index-A8hej5b5.css +0 -1
- package/dist/public/assets/index-BpZF8EJT.js +0 -2003
- package/dist/public/assets/info-OMHHGYJF-BszLPAsY.js +0 -1
- package/dist/public/assets/isSymbol-bbBleIZC.js +0 -1
- package/dist/public/assets/packet-4T2RLAQJ-Bv1Aae8C.js +0 -1
- package/dist/public/assets/pie-ZZUOXDRM-CWm6tOdZ.js +0 -1
- package/dist/public/assets/radar-PYXPWWZC-BnuozSTl.js +0 -1
- package/dist/public/assets/skill-actions-C3jnKy6a.js +0 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-Ddr1j6xz.js +0 -1
- package/dist/public/assets/telemetry-startup-B2tAiMsF.js +0 -1
- package/dist/public/assets/treeView-SZITEDCU-DKwVPz-3.js +0 -1
- package/dist/public/assets/treemap-W4RFUUIX-D4LXGVs_.js +0 -1
- package/dist/public/assets/wardley-RL74JXVD-BivuXjN1.js +0 -1
- package/dist/public/assets/workspace-paths-B1R7zp-q.js +0 -1
- package/dist/repair-skills-UdFUgcgx.mjs +0 -1
- package/dist/server-lock-GuuouVft-CPaJpyJ7.mjs +0 -1
- package/dist/start-esyH-MiN.mjs +0 -1
- /package/dist/public/assets/{ActivityPanelDiffView-BUS_IClA.js → ActivityPanelDiffView-B2UyxRqh.js} +0 -0
- /package/dist/public/assets/{__vite-browser-external-nMYNicjc.js → __vite-browser-external-DWP-nnLG.js} +0 -0
- /package/dist/public/assets/{array-DA62ss4d.js → array-DCThpSXQ.js} +0 -0
- /package/dist/public/assets/{arrow-up-right-Vg7lRNno.js → arrow-up-right-Bj9cWgcz.js} +0 -0
- /package/dist/public/assets/{check-CBLIjSIa.js → check-nyYgwOgK.js} +0 -0
- /package/dist/public/assets/{chevron-down-D2qF2W9D.js → chevron-down-B4gqqe-h.js} +0 -0
- /package/dist/public/assets/{chevron-left-SSPDkqEW.js → chevron-left-aRnXScdx.js} +0 -0
- /package/dist/public/assets/{chevron-right-C6588edp.js → chevron-right-DjreZbLo.js} +0 -0
- /package/dist/public/assets/{clike-f5rGWX5o.js → clike-DBPhSRc7.js} +0 -0
- /package/dist/public/assets/{clipboard-adapter-BscVzpz1.js → clipboard-adapter-BYqGVFAr.js} +0 -0
- /package/dist/public/assets/{colors-BtJnRWTu.js → colors-BWTxgr-H.js} +0 -0
- /package/dist/public/assets/{config-context-GBTLA0Td.js → config-context-B9tR3DuQ.js} +0 -0
- /package/dist/public/assets/{cursor-CouJSC9c.js → cursor-BkiD2ODR.js} +0 -0
- /package/dist/public/assets/{cytoscape.esm-DAexRXdS.js → cytoscape.esm-DI3FlJaw.js} +0 -0
- /package/dist/public/assets/{defaultLocale-DjcXuYt0.js → defaultLocale-CRhqsANo.js} +0 -0
- /package/dist/public/assets/{desktop-bridge-types-DUvVV0tT.js → desktop-bridge-types-BTzWYfK3.js} +0 -0
- /package/dist/public/assets/{diff-C6rPA7NX.js → diff-Drz_kYcR.js} +0 -0
- /package/dist/public/assets/{dist-K3kyyBcW.js → dist-B0Ibo2lT.js} +0 -0
- /package/dist/public/assets/{dist-DlBs2Z86.js → dist-BR1KZiCX.js} +0 -0
- /package/dist/public/assets/{dist-Bvqpz5aH.js → dist-BRGTi0a4.js} +0 -0
- /package/dist/public/assets/{dist-QYTl87xy.js → dist-URshSBRl.js} +0 -0
- /package/dist/public/assets/{documents-fetch-D9Azkuau.js → documents-fetch-B7M_d64D.js} +0 -0
- /package/dist/public/assets/{external-link-PPmVWR7S.js → external-link-Ds9yTh4D.js} +0 -0
- /package/dist/public/assets/{file-tree-rename-validation-DEJ31Vcw.js → file-tree-rename-validation-DcXYaYEd.js} +0 -0
- /package/dist/public/assets/{folder-open-BO3O3WRb.js → folder-open-DVXRBalt.js} +0 -0
- /package/dist/public/assets/{format-ReH7V0UD.js → format-Dfi8-r7-.js} +0 -0
- /package/dist/public/assets/{git-branch-Bb5seqP3.js → git-branch-BfSSsaKF.js} +0 -0
- /package/dist/public/assets/{go-BDL-nvej.js → go-BpmSPnTF.js} +0 -0
- /package/dist/public/assets/{info-p7xnknfW.js → info-DsmJgZ0m.js} +0 -0
- /package/dist/public/assets/{init-BcRdj30F.js → init-Do59aTWs.js} +0 -0
- /package/dist/public/assets/{input-DBQZgTXT.js → input-tBscWWrn.js} +0 -0
- /package/dist/public/assets/{isObjectLike-p4oxO3k2.js → isObjectLike-DBZB8Di0.js} +0 -0
- /package/dist/public/assets/{katex-lkho_UhZ.js → katex-C_q0VtM5.js} +0 -0
- /package/dist/public/assets/{label-BpH34DoN.js → label-DmfuSB7r.js} +0 -0
- /package/dist/public/assets/{loader-circle-Cu01Ckhe.js → loader-circle-IFoG3v_v.js} +0 -0
- /package/dist/public/assets/{lua-DazQKUZ0.js → lua-C_zL8YdL.js} +0 -0
- /package/dist/public/assets/{mcp-consent-store-3q0L29vA.js → mcp-consent-store-Q4I4TJ6C.js} +0 -0
- /package/dist/public/assets/{min-BBkt5AXx.js → min-CHYmOP54.js} +0 -0
- /package/dist/public/assets/{miss-dialog-store-DxVemLe3.js → miss-dialog-store-E61ZbtU3.js} +0 -0
- /package/dist/public/assets/{panzoom.es-CuUBMiI5.js → panzoom.es-IG_ffrHS.js} +0 -0
- /package/dist/public/assets/{parse-api-error-D_SUnYAN.js → parse-api-error-CKwNHPHP.js} +0 -0
- /package/dist/public/assets/{path-DO8zQ-Ae.js → path-BumxrnWh.js} +0 -0
- /package/dist/public/assets/{pdf-CbXPrrUD.js → pdf-Dfrvv9Dp.js} +0 -0
- /package/dist/public/assets/{pdf.worker-XGhSae8l.js → pdf.worker-BW4O2Ok7.js} +0 -0
- /package/dist/public/assets/{perl-BaZItvTQ.js → perl-CBgKNlH2.js} +0 -0
- /package/dist/public/assets/{properties-CuaVqlKt.js → properties-CYWLEd9P.js} +0 -0
- /package/dist/public/assets/{r-IUsFwQdS.js → r-C7V19TwF.js} +0 -0
- /package/dist/public/assets/{refresh-cw-C9i-ShKk.js → refresh-cw-C6wj273J.js} +0 -0
- /package/dist/public/assets/{rough.esm-DWDlLNAi.js → rough.esm-DGd9yuC8.js} +0 -0
- /package/dist/public/assets/{ruby-BWibniew.js → ruby-XhXUlf0J.js} +0 -0
- /package/dist/public/assets/{share-metadata-rows-VY-5eTfA.js → share-metadata-rows-C9T0cDSG.js} +0 -0
- /package/dist/public/assets/{shell-DUveK2Hb.js → shell-CGj6v8kb.js} +0 -0
- /package/dist/public/assets/{sql-C6MOB-cH.js → sql-CLlqBctF.js} +0 -0
- /package/dist/public/assets/{src-C1bTuxCq.js → src-DHCu-mNI.js} +0 -0
- /package/dist/public/assets/{startup-marks-DdXX18dm.js → startup-marks-DkfPsa68.js} +0 -0
- /package/dist/public/assets/{stex-C0Jw9RbH.js → stex-Bt71ugp5.js} +0 -0
- /package/dist/public/assets/{swift-BD9rjiqY.js → swift-C_3ADj_i.js} +0 -0
- /package/dist/public/assets/{textarea-BBYgAifm.js → textarea-IugbKaIV.js} +0 -0
- /package/dist/public/assets/{toml-25JKpH7B.js → toml-DohB9k6t.js} +0 -0
- /package/dist/public/assets/{trace-api-DN18ByDo.js → trace-api-BIWqyPc9.js} +0 -0
- /package/dist/public/assets/{trash-2-410fw8eF.js → trash-2-DuQrfywu.js} +0 -0
- /package/dist/public/assets/{triangle-alert-Bo8gNh02.js → triangle-alert-CX4BgEzP.js} +0 -0
- /package/dist/public/assets/{w3c-keyname-VSld09PZ.js → w3c-keyname-CRPBoZED.js} +0 -0
- /package/dist/public/assets/{worktree-store-CLuGV1SL.js → worktree-store-DfQ15jw3.js} +0 -0
- /package/dist/public/assets/{x-BIoRq4ww.js → x-Bcc1k6VU.js} +0 -0
|
@@ -151,7 +151,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
151
151
|
|
|
152
152
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Nt,s=!vt.jitless,c=s&&Pt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?oi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function li(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Yt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Qt(e,r,yt())))}),t)}const ui=O(`$ZodUnion`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Dt(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Dt(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Dt(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>wt(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>li(t,i,e,a)):li(s,i,e,a)}}),di=O(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ui.init(e,t);let n=e._zod.parse;Dt(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=St(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Nt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),fi=O(`$ZodIntersection`,(e,t)=>{br.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mi(e,t,n)):mi(e,i,a)}});function pi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ft(e)&&Ft(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=pi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Yt(e))return e;let o=pi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const hi=O(`$ZodRecord`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ft(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Xt(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Xt(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Xn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Qt(e,r,yt())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Xt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Xt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),gi=O(`$ZodEnum`,(e,t)=>{br.init(e,t);let n=bt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Lt.has(typeof e)).map(e=>typeof e==`string`?Rt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_i=O(`$ZodLiteral`,(e,t)=>{if(br.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Rt(e):e?Rt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vi=O(`$ZodTransform`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new gt;return n.value=i,n}});function yi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const bi=O(`$ZodOptional`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Dt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yi(t,e.value)):yi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),xi=O(`$ZodExactOptional`,(e,t)=>{bi.init(e,t),Dt(e._zod,`values`,()=>t.innerType._zod.values),Dt(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Si=O(`$ZodNullable`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.innerType._zod.optin),Dt(e._zod,`optout`,()=>t.innerType._zod.optout),Dt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wt(e.source)}|null)$`):void 0}),Dt(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ci=O(`$ZodDefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wi(e,t)):wi(r,t)}});function wi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ti=O(`$ZodPrefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ei=O(`$ZodNonOptional`,(e,t)=>{br.init(e,t),Dt(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Di(t,e)):Di(i,e)}});function Di(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Oi=O(`$ZodCatch`,(e,t)=>{br.init(e,t),Dt(e._zod,`optin`,()=>t.innerType._zod.optin),Dt(e._zod,`optout`,()=>t.innerType._zod.optout),Dt(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Qt(e,n,yt()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Qt(e,n,yt()))},input:e.value}),e.issues=[]),e)}}),ki=O(`$ZodPipe`,(e,t)=>{br.init(e,t),Dt(e._zod,`values`,()=>t.in._zod.values),Dt(e._zod,`optin`,()=>t.in._zod.optin),Dt(e._zod,`optout`,()=>t.out._zod.optout),Dt(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ai(e,t.in,n)):Ai(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ai(e,t.out,n)):Ai(r,t.out,n)}});function Ai(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ji=O(`$ZodReadonly`,(e,t)=>{br.init(e,t),Dt(e._zod,`propValues`,()=>t.innerType._zod.propValues),Dt(e._zod,`values`,()=>t.innerType._zod.values),Dt(e._zod,`optin`,()=>t.innerType?._zod?.optin),Dt(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Mi):Mi(r)}});function Mi(e){return e.value=Object.freeze(e.value),e}const Ni=O(`$ZodLazy`,(e,t)=>{br.init(e,t),Dt(e._zod,`innerType`,()=>t.getter()),Dt(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Dt(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Dt(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Dt(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Pi=O(`$ZodCustom`,(e,t)=>{tr.init(e,t),br.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fi(t,n,r,e));Fi(i,n,r,e)}});function Fi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(en(e))}}var Ii,Li=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ri(){return new Li}(Ii=globalThis).__zod_globalRegistry??(Ii.__zod_globalRegistry=Ri());const zi=globalThis.__zod_globalRegistry;function Bi(e,t){return new e({type:`string`,...k(t)})}function Vi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...k(t)})}function Hi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...k(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...k(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...k(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...k(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...k(t)})}function qi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...k(t)})}function Ji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...k(t)})}function Yi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...k(t)})}function Xi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...k(t)})}function Zi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...k(t)})}function Qi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...k(t)})}function $i(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...k(t)})}function ea(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...k(t)})}function ta(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...k(t)})}function na(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...k(t)})}function ra(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...k(t)})}function ia(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...k(t)})}function aa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...k(t)})}function oa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...k(t)})}function sa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...k(t)})}function ca(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...k(t)})}function la(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...k(t)})}function ua(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...k(t)})}function da(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...k(t)})}function fa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...k(t)})}function pa(e,t){return new e({type:`number`,checks:[],...k(t)})}function ma(e,t){return new e({type:`number`,coerce:!0,checks:[],...k(t)})}function ha(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...k(t)})}function ga(e,t){return new e({type:`boolean`,...k(t)})}function _a(e,t){return new e({type:`null`,...k(t)})}function va(e){return new e({type:`any`})}function ya(e){return new e({type:`unknown`})}function ba(e,t){return new e({type:`never`,...k(t)})}function xa(e,t){return new rr({check:`less_than`,...k(t),value:e,inclusive:!1})}function Sa(e,t){return new rr({check:`less_than`,...k(t),value:e,inclusive:!0})}function Ca(e,t){return new ir({check:`greater_than`,...k(t),value:e,inclusive:!1})}function wa(e,t){return new ir({check:`greater_than`,...k(t),value:e,inclusive:!0})}function Ta(e,t){return new ar({check:`multiple_of`,...k(t),value:e})}function Ea(e,t){return new sr({check:`max_length`,...k(t),maximum:e})}function Da(e,t){return new cr({check:`min_length`,...k(t),minimum:e})}function Oa(e,t){return new lr({check:`length_equals`,...k(t),length:e})}function ka(e,t){return new dr({check:`string_format`,format:`regex`,...k(t),pattern:e})}function Aa(e){return new fr({check:`string_format`,format:`lowercase`,...k(e)})}function ja(e){return new pr({check:`string_format`,format:`uppercase`,...k(e)})}function Ma(e,t){return new mr({check:`string_format`,format:`includes`,...k(t),includes:e})}function Na(e,t){return new hr({check:`string_format`,format:`starts_with`,...k(t),prefix:e})}function Pa(e,t){return new gr({check:`string_format`,format:`ends_with`,...k(t),suffix:e})}function Fa(e){return new _r({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>jt(e))}function Va(e,t,n){return new e({type:`array`,element:t,...k(n)})}function Ha(e,t,n){let r=k(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Ua(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...k(n)})}function Wa(e){let t=Ga(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(en(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(en(r))}},e(n.value,n)));return t}function Ga(e,t){let n=new tr({check:`custom`,...k(t)});return n._zod.check=e,n}function Ka(e){let t=new tr({check:`describe`});return t._zod.onattach=[t=>{let n=zi.get(t)??{};zi.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function qa(e){let t=new tr({check:`meta`});return t._zod.onattach=[t=>{let n=zi.get(t)??{};zi.add(t,{...n,...e})}],t._zod.check=()=>{},t}function Ja(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??zi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ya(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ya(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Qa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
153
153
|
|
|
154
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:eo(t,`input`,e.processors),output:eo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qa(r.element,n);if(r.type===`set`)return Qa(r.valueType,n);if(r.type===`lazy`)return Qa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Qa(r.innerType,n);if(r.type===`intersection`)return Qa(r.left,n)||Qa(r.right,n);if(r.type===`record`||r.type===`map`)return Qa(r.keyType,n)||Qa(r.valueType,n);if(r.type===`pipe`)return Qa(r.in,n)||Qa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qa(e,n))return!0;return!!(r.rest&&Qa(r.rest,n))}return!1}const $a=(e,t={})=>n=>{let r=Ja({...n,processors:t});return Ya(e,r),Xa(r,e),Za(r,e)},eo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ja({...i??{},target:a,io:t,processors:n});return Ya(e,o),Xa(o,e),Za(o,e)},to={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},no=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=to[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ro=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},io=(e,t,n,r)=>{n.type=`boolean`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},lo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},uo=(e,t,n,r)=>{n.not={}},fo=(e,t,n,r)=>{},po=(e,t,n,r)=>{},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=e._zod.def,a=bt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},go=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},_o=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},yo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},bo=(e,t,n,r)=>{n.type=`boolean`},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ya(a.element,t,{...r,path:[...r.path,`items`]})},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ya(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ya(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Oo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ya(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ya(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ya(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ya(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ya(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ya(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ya(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Mo=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},No=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Po=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Fo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Io=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ya(a,t,r);let o=t.seen.get(e);o.ref=a},Ro=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vo=(e,t,n,r)=>{let i=e._zod.innerType;Ya(i,t,r);let a=t.seen.get(e);a.ref=i},Ho={string:no,number:ro,boolean:io,bigint:ao,symbol:oo,null:so,undefined:co,void:lo,never:uo,any:fo,unknown:po,date:mo,enum:ho,literal:go,nan:_o,template_literal:vo,file:yo,success:bo,custom:xo,function:So,transform:Co,map:wo,set:To,array:Eo,object:Do,union:Oo,intersection:ko,tuple:Ao,record:jo,nullable:Mo,nonoptional:No,default:Po,prefault:Fo,catch:Io,pipe:Lo,readonly:Ro,promise:zo,optional:Bo,lazy:Vo};function Uo(e,t){if(`_idmap`in e){let n=e,r=Ja({...t,processors:Ho}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ya(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Xa(r,n),a[t]=Za(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ja({...t,processors:Ho});return Ya(e,n),Xa(n,e),Za(n,e)}const Wo=O(`ZodISODateTime`,(e,t)=>{Pr.init(e,t),gs.init(e,t)});function Go(e){return la(Wo,e)}const Ko=O(`ZodISODate`,(e,t)=>{Fr.init(e,t),gs.init(e,t)});function qo(e){return ua(Ko,e)}const Jo=O(`ZodISOTime`,(e,t)=>{Ir.init(e,t),gs.init(e,t)});function Yo(e){return da(Jo,e)}const Xo=O(`ZodISODuration`,(e,t)=>{Lr.init(e,t),gs.init(e,t)});function Zo(e){return fa(Xo,e)}const Qo=(e,t)=>{nn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>on(e,t)},flatten:{value:t=>an(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xt,2)}},isEmpty:{get(){return e.issues.length===0}}})};O(`ZodError`,Qo);const $o=O(`ZodError`,Qo,{Parent:Error}),es=ln($o),ts=dn($o),ns=pn($o),rs=hn($o),is=_n($o),as=vn($o),ss=yn($o),cs=bn($o),ls=xn($o),us=Sn($o),ds=Cn($o),fs=wn($o),ps=O(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:eo(e,`input`),output:eo(e,`output`)}}),e.toJSONSchema=$a(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(kt(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>zt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>ss(e,t,n),e.decodeAsync=async(t,n)=>cs(e,t,n),e.safeEncode=(t,n)=>ls(e,t,n),e.safeDecode=(t,n)=>us(e,t,n),e.safeEncodeAsync=async(t,n)=>ds(e,t,n),e.safeDecodeAsync=async(t,n)=>fs(e,t,n),e.refine=(t,n)=>e.check(Mc(t,n)),e.superRefine=t=>e.check(Nc(t)),e.overwrite=t=>e.check(Fa(t)),e.optional=()=>dc(e),e.exactOptional=()=>pc(e),e.nullable=()=>hc(e),e.nullish=()=>dc(hc(e)),e.nonoptional=t=>xc(e,t),e.array=()=>N(e),e.or=t=>$s([e,t]),e.and=t=>rc(e,t),e.transform=t=>Tc(e,lc(t)),e.default=t=>_c(e,t),e.prefault=t=>yc(e,t),e.catch=t=>Cc(e,t),e.pipe=t=>Tc(e,t),e.readonly=()=>Dc(e),e.describe=t=>{let n=e.clone();return zi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return zi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return zi.get(e);let n=e.clone();return zi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ms=O(`_ZodString`,(e,t)=>{xr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ka(...t)),e.includes=(...t)=>e.check(Ma(...t)),e.startsWith=(...t)=>e.check(Na(...t)),e.endsWith=(...t)=>e.check(Pa(...t)),e.min=(...t)=>e.check(Da(...t)),e.max=(...t)=>e.check(Ea(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Da(1,...t)),e.lowercase=t=>e.check(Aa(t)),e.uppercase=t=>e.check(ja(t)),e.trim=()=>e.check(La()),e.normalize=(...t)=>e.check(Ia(...t)),e.toLowerCase=()=>e.check(Ra()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(Ba())}),hs=O(`ZodString`,(e,t)=>{xr.init(e,t),ms.init(e,t),e.email=t=>e.check(Vi(_s,t)),e.url=t=>e.check(qi(bs,t)),e.jwt=t=>e.check(ca(Is,t)),e.emoji=t=>e.check(Ji(Ss,t)),e.guid=t=>e.check(Hi(vs,t)),e.uuid=t=>e.check(Ui(ys,t)),e.uuidv4=t=>e.check(Wi(ys,t)),e.uuidv6=t=>e.check(Gi(ys,t)),e.uuidv7=t=>e.check(Ki(ys,t)),e.nanoid=t=>e.check(Yi(Cs,t)),e.guid=t=>e.check(Hi(vs,t)),e.cuid=t=>e.check(Xi(ws,t)),e.cuid2=t=>e.check(Zi(Ts,t)),e.ulid=t=>e.check(Qi(Es,t)),e.base64=t=>e.check(aa(Ns,t)),e.base64url=t=>e.check(oa(Ps,t)),e.xid=t=>e.check($i(Ds,t)),e.ksuid=t=>e.check(ea(Os,t)),e.ipv4=t=>e.check(ta(ks,t)),e.ipv6=t=>e.check(na(As,t)),e.cidrv4=t=>e.check(ra(js,t)),e.cidrv6=t=>e.check(ia(Ms,t)),e.e164=t=>e.check(sa(Fs,t)),e.datetime=t=>e.check(Go(t)),e.date=t=>e.check(qo(t)),e.time=t=>e.check(Yo(t)),e.duration=t=>e.check(Zo(t))});function A(e){return Bi(hs,e)}const gs=O(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),_s=O(`ZodEmail`,(e,t)=>{Tr.init(e,t),gs.init(e,t)}),vs=O(`ZodGUID`,(e,t)=>{Cr.init(e,t),gs.init(e,t)}),ys=O(`ZodUUID`,(e,t)=>{wr.init(e,t),gs.init(e,t)}),bs=O(`ZodURL`,(e,t)=>{Er.init(e,t),gs.init(e,t)});function xs(e){return qi(bs,e)}const Ss=O(`ZodEmoji`,(e,t)=>{Dr.init(e,t),gs.init(e,t)}),Cs=O(`ZodNanoID`,(e,t)=>{Or.init(e,t),gs.init(e,t)}),ws=O(`ZodCUID`,(e,t)=>{kr.init(e,t),gs.init(e,t)}),Ts=O(`ZodCUID2`,(e,t)=>{Ar.init(e,t),gs.init(e,t)}),Es=O(`ZodULID`,(e,t)=>{jr.init(e,t),gs.init(e,t)}),Ds=O(`ZodXID`,(e,t)=>{Mr.init(e,t),gs.init(e,t)}),Os=O(`ZodKSUID`,(e,t)=>{Nr.init(e,t),gs.init(e,t)}),ks=O(`ZodIPv4`,(e,t)=>{Rr.init(e,t),gs.init(e,t)}),As=O(`ZodIPv6`,(e,t)=>{zr.init(e,t),gs.init(e,t)}),js=O(`ZodCIDRv4`,(e,t)=>{Br.init(e,t),gs.init(e,t)}),Ms=O(`ZodCIDRv6`,(e,t)=>{Vr.init(e,t),gs.init(e,t)}),Ns=O(`ZodBase64`,(e,t)=>{Ur.init(e,t),gs.init(e,t)}),Ps=O(`ZodBase64URL`,(e,t)=>{Gr.init(e,t),gs.init(e,t)}),Fs=O(`ZodE164`,(e,t)=>{Kr.init(e,t),gs.init(e,t)}),Is=O(`ZodJWT`,(e,t)=>{Jr.init(e,t),gs.init(e,t)}),Ls=O(`ZodNumber`,(e,t)=>{Yr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.int=t=>e.check(zs(t)),e.safe=t=>e.check(zs(t)),e.positive=t=>e.check(Ca(0,t)),e.nonnegative=t=>e.check(wa(0,t)),e.negative=t=>e.check(xa(0,t)),e.nonpositive=t=>e.check(Sa(0,t)),e.multipleOf=(t,n)=>e.check(Ta(t,n)),e.step=(t,n)=>e.check(Ta(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return pa(Ls,e)}const Rs=O(`ZodNumberFormat`,(e,t)=>{Xr.init(e,t),Ls.init(e,t)});function zs(e){return ha(Rs,e)}const Bs=O(`ZodBoolean`,(e,t)=>{Zr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function M(e){return ga(Bs,e)}const Vs=O(`ZodNull`,(e,t)=>{Qr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Hs(e){return _a(Vs,e)}const Us=O(`ZodAny`,(e,t)=>{$r.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ws(){return va(Us)}const Gs=O(`ZodUnknown`,(e,t)=>{ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ks(){return ya(Gs)}const qs=O(`ZodNever`,(e,t)=>{ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Js(e){return ba(qs,e)}const Ys=O(`ZodArray`,(e,t)=>{ri.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Da(t,n)),e.nonempty=t=>e.check(Da(1,t)),e.max=(t,n)=>e.check(Ea(t,n)),e.length=(t,n)=>e.check(Oa(t,n)),e.unwrap=()=>e.element});function N(e,t){return Va(Ys,e,t)}const Xs=O(`ZodObject`,(e,t)=>{ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),Dt(e,`shape`,()=>t.shape),e.keyof=()=>F(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:Js()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Wt(e,t),e.safeExtend=t=>Gt(e,t),e.merge=t=>Kt(e,t),e.pick=t=>Ht(e,t),e.omit=t=>Ut(e,t),e.partial=(...t)=>qt(uc,e,t[0]),e.required=(...t)=>Jt(bc,e,t[0])});function P(e,t){return new Xs({type:`object`,shape:e??{},...k(t)})}function Zs(e,t){return new Xs({type:`object`,shape:e,catchall:Ks(),...k(t)})}const Qs=O(`ZodUnion`,(e,t)=>{ui.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.options=t.options});function $s(e,t){return new Qs({type:`union`,options:e,...k(t)})}const ec=O(`ZodDiscriminatedUnion`,(e,t)=>{Qs.init(e,t),di.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...k(n)})}const nc=O(`ZodIntersection`,(e,t)=>{fi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}const ic=O(`ZodRecord`,(e,t)=>{hi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ac(e,t,n){return new ic({type:`record`,keyType:e,valueType:t,...k(n)})}const oc=O(`ZodEnum`,(e,t)=>{gi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})}});function F(e,t){return new oc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...k(t)})}const sc=O(`ZodLiteral`,(e,t)=>{_i.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new sc({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}const cc=O(`ZodTransform`,(e,t)=>{vi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(en(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(en(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function lc(e){return new cc({type:`transform`,transform:e})}const uc=O(`ZodOptional`,(e,t)=>{bi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}const fc=O(`ZodExactOptional`,(e,t)=>{xi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}const mc=O(`ZodNullable`,(e,t)=>{Si.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`nullable`,innerType:e})}const gc=O(`ZodDefault`,(e,t)=>{Ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _c(e,t){return new gc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const vc=O(`ZodPrefault`,(e,t)=>{Ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const bc=O(`ZodNonOptional`,(e,t)=>{Ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`nonoptional`,innerType:e,...k(t)})}const Sc=O(`ZodCatch`,(e,t)=>{Oi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cc(e,t){return new Sc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const wc=O(`ZodPipe`,(e,t)=>{ki.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function Tc(e,t){return new wc({type:`pipe`,in:e,out:t})}const Ec=O(`ZodReadonly`,(e,t)=>{ji.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`readonly`,innerType:e})}const Oc=O(`ZodLazy`,(e,t)=>{Ni.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function kc(e){return new Oc({type:`lazy`,getter:e})}const Ac=O(`ZodCustom`,(e,t)=>{Pi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function jc(e,t){return Ha(Ac,e??(()=>!0),t)}function Mc(e,t={}){return Ua(Ac,e,t)}function Nc(e){return Wa(e)}function Pc(e,t){return Tc(lc(e),t)}var Fc=mt();a();const Ic=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Lc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Rc=[`video/mp4`,`video/webm`,`video/ogg`],zc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Bc=[`application/pdf`],Vc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Hc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Uc=new Set([`pdf`]),Wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Gc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Kc=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Jc=new Set([`html`,`htm`]),Yc=`sandbox allow-scripts; connect-src 'none'`,Xc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Zc=`same-dir`,Qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),$c=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],el=[`mp4`,`webm`,`mov`,`m4v`],tl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],nl=[`pdf`],rl=[`json`,`toml`,`lock`];function il(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}il(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$c,Vc),il(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,el,Hc),il(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,tl,Wc),il(`SIDEBAR_PDF_ASSET_EXTENSIONS`,nl,Uc),il(`FILE_ATTACHMENT_EXTENSIONS`,[...Gc],Qc),il(`WIKI_EMBED_EXTENSIONS`,[...Qc],qc);const al=new Set($c),ol=new Set(el),sl=new Set(tl),cl=new Set(nl),ll=new Set(rl);il(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$c,...el,...tl,...nl,...rl])],Xc);const ul=new Set([`base`,`canvas`]),dl=new Set([`mmd`,`mermaid`]);function fl(e){let t=e.lastIndexOf(`.`);return t<0?!1:dl.has(e.slice(t+1).toLowerCase())}const pl=new Set([...qc,...ul,...dl]);function ml(e){let t=e.toLowerCase().replace(/^\./,``);return al.has(t)?`image`:ol.has(t)?`video`:sl.has(t)?`audio`:cl.has(t)?`pdf`:ll.has(t)||ul.has(t)?`text`:dl.has(t)?`mermaid`:Ic.has(t)?`text`:null}const hl=Symbol.for(`@inkeep/open-knowledge/field-registry`),gl=globalThis;gl[hl]===void 0&&(gl[hl]=Ri());const _l=gl[hl];function vl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=yl(t)?_l.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function yl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const bl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),xl=52428800,Sl=26214400,Cl=`https://api.openai.com/v1`,wl=`text-embedding-3-small`;function Tl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}if(t.protocol===`https:`)return null;let n=t.hostname.toLowerCase(),r=n===`localhost`||n===`127.0.0.1`||n===`[::1]`;return t.protocol===`http:`&&r?null:`insecure-scheme`}function El(e){let t=e.trim();return t===``?`./`:t}function Dl(e){let t=El(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ol=Zs({content:Zs({dir:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Dl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zs({theme:F([`light`,`dark`,`system`]).register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Zs({autoOpen:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zs({showHiddenFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:Zs({wordWrap:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Zs({autoApproveOkTools:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),telemetry:Zs({localSink:Zs({enabled:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(xl)}).default({maxBytes:xl}),logs:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Sl)}).default({maxBytes:Sl}),attributeDenylist:N(A()).register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...bl])}).default({enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]})}).default({localSink:{enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]}}),search:Zs({semantic:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(Cl),model:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(wl),dimensions:j().int().positive().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:j().min(0).max(1).register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cl,model:wl})}).default({semantic:{enabled:!1,baseUrl:Cl,model:wl}})}),kl=`open-knowledge-config`;async function Al(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function jl(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Ml(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Nl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Pl(e,t){let n=e;for(let e of t){n=Nl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Fl(e,t){let n=Pl(e,t);if(n!==void 0)return vl(n)}function Il(e,t){return e===`either`?!0:e===t}function Ll(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Fl(Ol,i);a?.scope!==void 0&&(Il(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Rl(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,Fc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function zl(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Rl(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Rl(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Bl(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const Vl=P({file:A(),line:j().int().min(1),column:j().int().min(1),snippet:A().optional()}),Hl=P({path:N($s([A(),j()])),message:A(),issueCode:A(),params:ac(A(),Ks()).optional(),source:Vl.optional()}),Ul=F([`user`,`project`,`project-local`,`either`]),Wl=F([`user`,`project`,`project-local`]),Gl=tc(`code`,[P({code:I(`YAML_PARSE`),detail:A()}),P({code:I(`SCHEMA_INVALID`),issues:N(Hl)}),P({code:I(`SCOPE_VIOLATION`),path:N(A()),expectedScope:Ul,actualScope:Wl}),P({code:I(`NOT_AGENT_SETTABLE`),path:N(A())}),P({code:I(`MIXED_SCOPE`),paths:N(P({path:N(A()),scope:Wl}))}),P({code:I(`REMOVED_KEY`),path:N(A()),redirect:A(),source:Vl.optional()}),P({code:I(`WRITE_ERROR`),detail:A()}),P({code:I(`OKIGNORE_INVALID`),detail:A(),lineNumber:j().int().min(1).optional()}),P({code:I(`UNKNOWN`),message:A().optional()})]),Kl=new Set(Gl.options.map(e=>e.shape.code.value)),ql=$s([Gl,Zs({code:A(),message:A().optional()})]);function Jl(e){return Kl.has(e.code)}function Yl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Xl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function Zl(e){if(!Jl(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
154
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:eo(t,`input`,e.processors),output:eo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qa(r.element,n);if(r.type===`set`)return Qa(r.valueType,n);if(r.type===`lazy`)return Qa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Qa(r.innerType,n);if(r.type===`intersection`)return Qa(r.left,n)||Qa(r.right,n);if(r.type===`record`||r.type===`map`)return Qa(r.keyType,n)||Qa(r.valueType,n);if(r.type===`pipe`)return Qa(r.in,n)||Qa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qa(e,n))return!0;return!!(r.rest&&Qa(r.rest,n))}return!1}const $a=(e,t={})=>n=>{let r=Ja({...n,processors:t});return Ya(e,r),Xa(r,e),Za(r,e)},eo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ja({...i??{},target:a,io:t,processors:n});return Ya(e,o),Xa(o,e),Za(o,e)},to={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},no=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=to[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ro=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},io=(e,t,n,r)=>{n.type=`boolean`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},lo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},uo=(e,t,n,r)=>{n.not={}},fo=(e,t,n,r)=>{},po=(e,t,n,r)=>{},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=e._zod.def,a=bt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},go=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},_o=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},yo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},bo=(e,t,n,r)=>{n.type=`boolean`},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ya(a.element,t,{...r,path:[...r.path,`items`]})},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ya(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ya(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Oo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ya(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ya(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ya(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ya(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ya(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ya(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ya(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Mo=(e,t,n,r)=>{let i=e._zod.def,a=Ya(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},No=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Po=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Fo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Io=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ya(a,t,r);let o=t.seen.get(e);o.ref=a},Ro=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.def;Ya(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vo=(e,t,n,r)=>{let i=e._zod.innerType;Ya(i,t,r);let a=t.seen.get(e);a.ref=i},Ho={string:no,number:ro,boolean:io,bigint:ao,symbol:oo,null:so,undefined:co,void:lo,never:uo,any:fo,unknown:po,date:mo,enum:ho,literal:go,nan:_o,template_literal:vo,file:yo,success:bo,custom:xo,function:So,transform:Co,map:wo,set:To,array:Eo,object:Do,union:Oo,intersection:ko,tuple:Ao,record:jo,nullable:Mo,nonoptional:No,default:Po,prefault:Fo,catch:Io,pipe:Lo,readonly:Ro,promise:zo,optional:Bo,lazy:Vo};function Uo(e,t){if(`_idmap`in e){let n=e,r=Ja({...t,processors:Ho}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ya(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Xa(r,n),a[t]=Za(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ja({...t,processors:Ho});return Ya(e,n),Xa(n,e),Za(n,e)}const Wo=O(`ZodISODateTime`,(e,t)=>{Pr.init(e,t),gs.init(e,t)});function Go(e){return la(Wo,e)}const Ko=O(`ZodISODate`,(e,t)=>{Fr.init(e,t),gs.init(e,t)});function qo(e){return ua(Ko,e)}const Jo=O(`ZodISOTime`,(e,t)=>{Ir.init(e,t),gs.init(e,t)});function Yo(e){return da(Jo,e)}const Xo=O(`ZodISODuration`,(e,t)=>{Lr.init(e,t),gs.init(e,t)});function Zo(e){return fa(Xo,e)}const Qo=(e,t)=>{nn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>on(e,t)},flatten:{value:t=>an(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xt,2)}},isEmpty:{get(){return e.issues.length===0}}})};O(`ZodError`,Qo);const $o=O(`ZodError`,Qo,{Parent:Error}),es=ln($o),ts=dn($o),ns=pn($o),rs=hn($o),is=_n($o),as=vn($o),ss=yn($o),cs=bn($o),ls=xn($o),us=Sn($o),ds=Cn($o),fs=wn($o),ps=O(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:eo(e,`input`),output:eo(e,`output`)}}),e.toJSONSchema=$a(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(kt(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>zt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>es(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ns(e,t,n),e.parseAsync=async(t,n)=>ts(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>rs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>is(e,t,n),e.decode=(t,n)=>as(e,t,n),e.encodeAsync=async(t,n)=>ss(e,t,n),e.decodeAsync=async(t,n)=>cs(e,t,n),e.safeEncode=(t,n)=>ls(e,t,n),e.safeDecode=(t,n)=>us(e,t,n),e.safeEncodeAsync=async(t,n)=>ds(e,t,n),e.safeDecodeAsync=async(t,n)=>fs(e,t,n),e.refine=(t,n)=>e.check(Mc(t,n)),e.superRefine=t=>e.check(Nc(t)),e.overwrite=t=>e.check(Fa(t)),e.optional=()=>dc(e),e.exactOptional=()=>pc(e),e.nullable=()=>hc(e),e.nullish=()=>dc(hc(e)),e.nonoptional=t=>xc(e,t),e.array=()=>N(e),e.or=t=>$s([e,t]),e.and=t=>rc(e,t),e.transform=t=>Tc(e,lc(t)),e.default=t=>_c(e,t),e.prefault=t=>yc(e,t),e.catch=t=>Cc(e,t),e.pipe=t=>Tc(e,t),e.readonly=()=>Dc(e),e.describe=t=>{let n=e.clone();return zi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return zi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return zi.get(e);let n=e.clone();return zi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ms=O(`_ZodString`,(e,t)=>{xr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ka(...t)),e.includes=(...t)=>e.check(Ma(...t)),e.startsWith=(...t)=>e.check(Na(...t)),e.endsWith=(...t)=>e.check(Pa(...t)),e.min=(...t)=>e.check(Da(...t)),e.max=(...t)=>e.check(Ea(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Da(1,...t)),e.lowercase=t=>e.check(Aa(t)),e.uppercase=t=>e.check(ja(t)),e.trim=()=>e.check(La()),e.normalize=(...t)=>e.check(Ia(...t)),e.toLowerCase=()=>e.check(Ra()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(Ba())}),hs=O(`ZodString`,(e,t)=>{xr.init(e,t),ms.init(e,t),e.email=t=>e.check(Vi(_s,t)),e.url=t=>e.check(qi(bs,t)),e.jwt=t=>e.check(ca(Is,t)),e.emoji=t=>e.check(Ji(Ss,t)),e.guid=t=>e.check(Hi(vs,t)),e.uuid=t=>e.check(Ui(ys,t)),e.uuidv4=t=>e.check(Wi(ys,t)),e.uuidv6=t=>e.check(Gi(ys,t)),e.uuidv7=t=>e.check(Ki(ys,t)),e.nanoid=t=>e.check(Yi(Cs,t)),e.guid=t=>e.check(Hi(vs,t)),e.cuid=t=>e.check(Xi(ws,t)),e.cuid2=t=>e.check(Zi(Ts,t)),e.ulid=t=>e.check(Qi(Es,t)),e.base64=t=>e.check(aa(Ns,t)),e.base64url=t=>e.check(oa(Ps,t)),e.xid=t=>e.check($i(Ds,t)),e.ksuid=t=>e.check(ea(Os,t)),e.ipv4=t=>e.check(ta(ks,t)),e.ipv6=t=>e.check(na(As,t)),e.cidrv4=t=>e.check(ra(js,t)),e.cidrv6=t=>e.check(ia(Ms,t)),e.e164=t=>e.check(sa(Fs,t)),e.datetime=t=>e.check(Go(t)),e.date=t=>e.check(qo(t)),e.time=t=>e.check(Yo(t)),e.duration=t=>e.check(Zo(t))});function A(e){return Bi(hs,e)}const gs=O(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),_s=O(`ZodEmail`,(e,t)=>{Tr.init(e,t),gs.init(e,t)}),vs=O(`ZodGUID`,(e,t)=>{Cr.init(e,t),gs.init(e,t)}),ys=O(`ZodUUID`,(e,t)=>{wr.init(e,t),gs.init(e,t)}),bs=O(`ZodURL`,(e,t)=>{Er.init(e,t),gs.init(e,t)});function xs(e){return qi(bs,e)}const Ss=O(`ZodEmoji`,(e,t)=>{Dr.init(e,t),gs.init(e,t)}),Cs=O(`ZodNanoID`,(e,t)=>{Or.init(e,t),gs.init(e,t)}),ws=O(`ZodCUID`,(e,t)=>{kr.init(e,t),gs.init(e,t)}),Ts=O(`ZodCUID2`,(e,t)=>{Ar.init(e,t),gs.init(e,t)}),Es=O(`ZodULID`,(e,t)=>{jr.init(e,t),gs.init(e,t)}),Ds=O(`ZodXID`,(e,t)=>{Mr.init(e,t),gs.init(e,t)}),Os=O(`ZodKSUID`,(e,t)=>{Nr.init(e,t),gs.init(e,t)}),ks=O(`ZodIPv4`,(e,t)=>{Rr.init(e,t),gs.init(e,t)}),As=O(`ZodIPv6`,(e,t)=>{zr.init(e,t),gs.init(e,t)}),js=O(`ZodCIDRv4`,(e,t)=>{Br.init(e,t),gs.init(e,t)}),Ms=O(`ZodCIDRv6`,(e,t)=>{Vr.init(e,t),gs.init(e,t)}),Ns=O(`ZodBase64`,(e,t)=>{Ur.init(e,t),gs.init(e,t)}),Ps=O(`ZodBase64URL`,(e,t)=>{Gr.init(e,t),gs.init(e,t)}),Fs=O(`ZodE164`,(e,t)=>{Kr.init(e,t),gs.init(e,t)}),Is=O(`ZodJWT`,(e,t)=>{Jr.init(e,t),gs.init(e,t)}),Ls=O(`ZodNumber`,(e,t)=>{Yr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.int=t=>e.check(zs(t)),e.safe=t=>e.check(zs(t)),e.positive=t=>e.check(Ca(0,t)),e.nonnegative=t=>e.check(wa(0,t)),e.negative=t=>e.check(xa(0,t)),e.nonpositive=t=>e.check(Sa(0,t)),e.multipleOf=(t,n)=>e.check(Ta(t,n)),e.step=(t,n)=>e.check(Ta(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return pa(Ls,e)}const Rs=O(`ZodNumberFormat`,(e,t)=>{Xr.init(e,t),Ls.init(e,t)});function zs(e){return ha(Rs,e)}const Bs=O(`ZodBoolean`,(e,t)=>{Zr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function M(e){return ga(Bs,e)}const Vs=O(`ZodNull`,(e,t)=>{Qr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Hs(e){return _a(Vs,e)}const Us=O(`ZodAny`,(e,t)=>{$r.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ws(){return va(Us)}const Gs=O(`ZodUnknown`,(e,t)=>{ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ks(){return ya(Gs)}const qs=O(`ZodNever`,(e,t)=>{ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Js(e){return ba(qs,e)}const Ys=O(`ZodArray`,(e,t)=>{ri.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Da(t,n)),e.nonempty=t=>e.check(Da(1,t)),e.max=(t,n)=>e.check(Ea(t,n)),e.length=(t,n)=>e.check(Oa(t,n)),e.unwrap=()=>e.element});function N(e,t){return Va(Ys,e,t)}const Xs=O(`ZodObject`,(e,t)=>{ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),Dt(e,`shape`,()=>t.shape),e.keyof=()=>F(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:Js()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Wt(e,t),e.safeExtend=t=>Gt(e,t),e.merge=t=>Kt(e,t),e.pick=t=>Ht(e,t),e.omit=t=>Ut(e,t),e.partial=(...t)=>qt(uc,e,t[0]),e.required=(...t)=>Jt(bc,e,t[0])});function P(e,t){return new Xs({type:`object`,shape:e??{},...k(t)})}function Zs(e,t){return new Xs({type:`object`,shape:e,catchall:Ks(),...k(t)})}const Qs=O(`ZodUnion`,(e,t)=>{ui.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.options=t.options});function $s(e,t){return new Qs({type:`union`,options:e,...k(t)})}const ec=O(`ZodDiscriminatedUnion`,(e,t)=>{Qs.init(e,t),di.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...k(n)})}const nc=O(`ZodIntersection`,(e,t)=>{fi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}const ic=O(`ZodRecord`,(e,t)=>{hi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ac(e,t,n){return new ic({type:`record`,keyType:e,valueType:t,...k(n)})}const oc=O(`ZodEnum`,(e,t)=>{gi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oc({...t,checks:[],...k(r),entries:i})}});function F(e,t){return new oc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...k(t)})}const sc=O(`ZodLiteral`,(e,t)=>{_i.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new sc({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}const cc=O(`ZodTransform`,(e,t)=>{vi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _t(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(en(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(en(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function lc(e){return new cc({type:`transform`,transform:e})}const uc=O(`ZodOptional`,(e,t)=>{bi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}const fc=O(`ZodExactOptional`,(e,t)=>{xi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}const mc=O(`ZodNullable`,(e,t)=>{Si.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`nullable`,innerType:e})}const gc=O(`ZodDefault`,(e,t)=>{Ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _c(e,t){return new gc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const vc=O(`ZodPrefault`,(e,t)=>{Ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():It(t)}})}const bc=O(`ZodNonOptional`,(e,t)=>{Ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`nonoptional`,innerType:e,...k(t)})}const Sc=O(`ZodCatch`,(e,t)=>{Oi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cc(e,t){return new Sc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const wc=O(`ZodPipe`,(e,t)=>{ki.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function Tc(e,t){return new wc({type:`pipe`,in:e,out:t})}const Ec=O(`ZodReadonly`,(e,t)=>{ji.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`readonly`,innerType:e})}const Oc=O(`ZodLazy`,(e,t)=>{Ni.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function kc(e){return new Oc({type:`lazy`,getter:e})}const Ac=O(`ZodCustom`,(e,t)=>{Pi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function jc(e,t){return Ha(Ac,e??(()=>!0),t)}function Mc(e,t={}){return Ua(Ac,e,t)}function Nc(e){return Wa(e)}function Pc(e,t){return Tc(lc(e),t)}var Fc=mt();a();const Ic=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Lc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Rc=[`video/mp4`,`video/webm`,`video/ogg`],zc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Bc=[`application/pdf`],Vc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Hc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Uc=new Set([`pdf`]),Wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Gc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Kc=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Jc=new Set([`html`,`htm`]),Yc=`sandbox allow-scripts; connect-src 'none'`,Xc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Zc=`same-dir`,Qc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),$c=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],el=[`mp4`,`webm`,`mov`,`m4v`],tl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],nl=[`pdf`],rl=[`json`,`toml`,`lock`];function il(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}il(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$c,Vc),il(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,el,Hc),il(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,tl,Wc),il(`SIDEBAR_PDF_ASSET_EXTENSIONS`,nl,Uc),il(`FILE_ATTACHMENT_EXTENSIONS`,[...Gc],Qc),il(`WIKI_EMBED_EXTENSIONS`,[...Qc],qc);const al=new Set($c),ol=new Set(el),sl=new Set(tl),cl=new Set(nl),ll=new Set(rl);il(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$c,...el,...tl,...nl,...rl])],Xc);const ul=new Set([`base`,`canvas`]),dl=new Set([`mmd`,`mermaid`]);function fl(e){let t=e.lastIndexOf(`.`);return t<0?!1:dl.has(e.slice(t+1).toLowerCase())}const pl=new Set([...qc,...ul,...dl]);function ml(e){let t=e.toLowerCase().replace(/^\./,``);return al.has(t)?`image`:ol.has(t)?`video`:sl.has(t)?`audio`:cl.has(t)?`pdf`:ll.has(t)||ul.has(t)?`text`:dl.has(t)?`mermaid`:Ic.has(t)?`text`:null}const hl=Symbol.for(`@inkeep/open-knowledge/field-registry`),gl=globalThis;gl[hl]===void 0&&(gl[hl]=Ri());const _l=gl[hl];function vl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=yl(t)?_l.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function yl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const bl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),xl=52428800,Sl=26214400,Cl=`https://api.openai.com/v1`,wl=`text-embedding-3-small`;function Tl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}if(t.protocol===`https:`)return null;let n=t.hostname.toLowerCase(),r=n===`localhost`||n===`127.0.0.1`||n===`[::1]`;return t.protocol===`http:`&&r?null:`insecure-scheme`}function El(e){let t=e.trim();return t===``?`./`:t}function Dl(e){let t=El(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ol=Zs({content:Zs({dir:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:A().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Dl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zs({theme:F([`light`,`dark`,`system`]).register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Zs({autoOpen:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zs({showHiddenFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:Zs({wordWrap:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Zs({autoApproveOkTools:M().register(_l,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),telemetry:Zs({localSink:Zs({enabled:M().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(xl)}).default({maxBytes:xl}),logs:Zs({maxBytes:j().register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Sl)}).default({maxBytes:Sl}),attributeDenylist:N(A()).register(_l,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...bl])}).default({enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]})}).default({localSink:{enabled:!0,spans:{maxBytes:xl},logs:{maxBytes:Sl},attributeDenylist:[...bl]}}),search:Zs({semantic:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(Cl),model:A().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(wl),dimensions:j().int().positive().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:j().min(0).max(1).register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cl,model:wl})}).default({semantic:{enabled:!1,baseUrl:Cl,model:wl}}),linkPreviews:Zs({enabled:M().register(_l,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default OFF. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!1)}).default({enabled:!1})}),kl=`open-knowledge-config`;async function Al(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function jl(e,t,n){let r=o.getTracer(kl),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Ml(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Nl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Pl(e,t){let n=e;for(let e of t){n=Nl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Fl(e,t){let n=Pl(e,t);if(n!==void 0)return vl(n)}function Il(e,t){return e===`either`?!0:e===t}function Ll(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Fl(Ol,i);a?.scope!==void 0&&(Il(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Rl(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,Fc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function zl(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Rl(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Rl(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Bl(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const Vl=P({file:A(),line:j().int().min(1),column:j().int().min(1),snippet:A().optional()}),Hl=P({path:N($s([A(),j()])),message:A(),issueCode:A(),params:ac(A(),Ks()).optional(),source:Vl.optional()}),Ul=F([`user`,`project`,`project-local`,`either`]),Wl=F([`user`,`project`,`project-local`]),Gl=tc(`code`,[P({code:I(`YAML_PARSE`),detail:A()}),P({code:I(`SCHEMA_INVALID`),issues:N(Hl)}),P({code:I(`SCOPE_VIOLATION`),path:N(A()),expectedScope:Ul,actualScope:Wl}),P({code:I(`NOT_AGENT_SETTABLE`),path:N(A())}),P({code:I(`MIXED_SCOPE`),paths:N(P({path:N(A()),scope:Wl}))}),P({code:I(`REMOVED_KEY`),path:N(A()),redirect:A(),source:Vl.optional()}),P({code:I(`WRITE_ERROR`),detail:A()}),P({code:I(`OKIGNORE_INVALID`),detail:A(),lineNumber:j().int().min(1).optional()}),P({code:I(`UNKNOWN`),message:A().optional()})]),Kl=new Set(Gl.options.map(e=>e.shape.code.value)),ql=$s([Gl,Zs({code:A(),message:A().optional()})]);function Jl(e){return Kl.has(e.code)}function Yl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Xl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function Zl(e){if(!Jl(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
155
155
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
156
156
|
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${Yl(e.expectedScope)} — ${Xl(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${Yl(e.actualScope)}).`,`Move it to ${Yl(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${Yl(t)} (${t})`).join(`
|
|
157
157
|
`)].join(`
|
|
@@ -426,35 +426,35 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
426
426
|
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return p$(y$(i,n))}function g$(e){if(Number.isNaN(e))return`ws`;let t=UN(e);return t===1?`ws`:t===2?`punct`:`other`}function _$(e,t,n){let r=g$(t),i=g$(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function v$(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
427
427
|
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function y$(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&v$(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=_$(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function b$(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);x$(i.charCodeAt(i.length-1),s,r)&&(o=S$(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return x$(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+S$(c)),o}function x$(e,t,n){return!(UN(t)!==1||n===`_`&&UN(e)===void 0)}function S$(e){return`&#x${e.toString(16).toUpperCase()};`}function C$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!T$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function w$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=b$(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function T$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function E$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var D$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=_b(e.extensions),this.handlers=L$(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?qJ({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=R$(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=UQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=WQ({toMarkdownHandlers:s$})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return XQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?ZQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?ZY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return QQ(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const O$=zY();function k$(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function A$(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function j$(e,t){return e.attrs.sourceDirty||A$(e)?!0:t?t.isDiverged(e.toJSON()):!1}function M$(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function N$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function P$(e,t){if(e.length===0)return N$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return N$({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[P$(n.children,t)]}}return N$({type:`inlineCode`,value:F$(e)},t)}function F$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=F$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const I$=Vc;function L$(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=MR(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=MR(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=n$(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&iq(t.raw)!==null&&tq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=iq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=NR(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NR(r.highlight)),r.comment&&(i.comment=NR(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MR(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NR(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NR(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MR(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=MR(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=MR(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=O$.getOrWildcard(o),c=k$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=n$(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=yq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&I$.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Hc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Wc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Gc.has(l)&&n.jsxComponent&&O$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:E$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=MR(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function R$(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RR(`paragraph`)),i.blockquote&&(n.blockquote=RR(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=RR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=RR(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&M$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=RR(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:yJ(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!j$(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:O$.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:O$,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=zR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return P$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=zR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zR(`mark`)),a.comment&&(r.comment=zR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RR(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=RR(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return oq(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const z$=/\p{M}+/gu,B$=/[^\p{L}\p{N}]+/gu,V$=/^-+|-+$/g;function H$(e){return e.trim().normalize(`NFKD`).replace(z$,``).toLowerCase().replace(B$,`-`).replace(V$,``)}function U$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function W$(e,t){let n=H$(e);return n?U$(n,t):``}const G$=new Set([`img`,`video`,`audio`,`mark`]);new Map(LY.flatMap(e=>e.surface===`compat`&&G$.has(e.rendersAs)?[[e.name,e]]:[])),GF(`<>`);const K$=OV(),q$=KB(),J$=qB();function Y$(){return LY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function X$(){return Y$().filter(e=>Z$(e)!==`fence`)}function Z$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function Q$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:Z$(e)}}function $$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function e1(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function t1(e){let t=[];for(let n of e.props){let e=$$(n);e!==void 0&&e1(n,e)&&t.push(XJ(n.name,e))}return t}function n1(e){return eB(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[K$],mdastExtensions:[q$]}).children}function r1(e){let t=Z$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
|
|
428
428
|
A --> B`};else{let r=t1(e),i=t===`jsx-block`?n1(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return KP({type:`root`,children:[n]},{extensions:[J$]}).trimEnd()}function i1(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function a1(e){return{...Q$(e),example:r1(e),params:i1(e)}}function o1(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...X$().map(Q$).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
|
|
429
|
-
`)}const s1=[`text`,`number`,`boolean`,`date`,`list`,`object`];F(s1);const c1=$s([A(),j(),M()]),l1=kc(()=>$s([c1.transform(e=>String(e)),ac(A(),u1),N(l1)])),u1=kc(()=>$s([A(),j(),M(),N(l1),ac(A(),u1)]));function d1(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(d1(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:d1(r);return t}return e}const f1=Pc(d1,ac(A(),u1));ac(A(),$s([u1,Hs()]));function p1(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const m1=P({docName:Oq,summary:Aq,content:A().optional(),...kq}).loose(),h1=P({docName:Oq,summary:Aq,markdown:A(),position:F([`append`,`prepend`,`replace`]).optional(),extension:F(VG).optional(),...kq}).loose(),g1=P({docName:Oq,summary:Aq,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...kq}).loose(),_1=P({docName:Oq,connectionId:A().min(1),scope:F([`last`,`session`,`file`]).optional(),...kq}).loose(),v1=P({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),y1=tc(`kind`,[P({kind:I(`inline`),content:A()}),P({kind:I(`truncated`),byteLength:j().int().nonnegative(),hint:A()})]),b1=P({kind:I(`content-divergence`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),divergenceType:A().optional(),currentState:y1.optional(),hint:A().optional()}).loose(),x1=P({type:I(`orphan`),parentCandidates:N(A()),message:A()}).loose(),S1=P({kind:I(`disk-edit-reconciled`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),mergeOutcome:A().optional(),hint:A().optional()}).loose(),C1=tc(`kind`,[b1,S1]),w1=tc(`kind`,[b1,S1,P({kind:I(`mermaid-parse-error`),fenceIndex:j().int().positive(),fenceFirstLine:A(),message:A(),line:j().int().positive().optional()}).loose()]),T1=N(w1).min(1),E1=P({href:A(),resolvedTo:A().nullable(),reason:F([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),D1=N(E1),O1=P({timestamp:A().min(1),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional()}).loose(),k1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:N(x1).optional(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),A1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),j1=P({docName:A().min(1),scope:F([`last`,`session`]),undone:M()}).loose(),M1=P({docName:Oq,patch:ac(A(),$s([u1,Hs()])),types:ac(A(),F(s1)).optional(),summary:Aq,...kq}).loose(),N1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),appliedKeys:N(A()),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),P1=P({entries:N(P({level:F([`info`,`warn`,`error`]),message:A().max(8192),event:A().optional(),fields:ac(A(),Ks()).optional(),ts:j().optional(),sourceId:A().optional(),lineNumber:j().optional()}).loose()).max(100)}).loose(),F1=P({accepted:j().int().min(0)}).loose(),I1=P({status:A().min(1),reason:A()}).loose(),L1=P({docName:A().min(1),content:A(),lifecycle:I1.nullable()}).loose(),R1=P({documents:N(P({kind:F([`document`,`asset`,`folder`,`file`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:M().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:F([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:N(A().min(1)).optional(),hasChildren:M().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:M().optional()}).loose(),z1=P({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),B1=P({docName:A().min(1),backlinks:N(z1)}).loose(),V1=P({counts:ac(A().min(1),j().int().nonnegative())}).loose(),H1=tc(`kind`,[P({kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),P({kind:I(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),U1=P({docName:A().min(1),forwardLinks:N(H1)}).loose(),W1=tc(`kind`,[P({id:A().min(1),kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:N(A()).nullable()}).loose(),P({id:A().min(1),kind:I(`external`),url:A().min(1),label:A()}).loose()]),G1=P({source:A().min(1),target:A().min(1)}).loose(),K1=P({nodes:N(W1),links:N(G1)}).loose(),q1=P({ts:j().int().min(0),url:A(),method:A(),ua:A().optional(),origin:A().optional(),referer:A().optional(),host:A().optional(),remote:A().optional(),secChUa:A().optional(),secChUaMobile:A().optional(),secChUaPlatform:A().optional(),secFetchSite:A().optional(),secFetchDest:A().optional(),secFetchMode:A().optional(),secFetchUser:A().optional()}).loose(),J1=P({app:$s([I(`cursor`),I(`codex`),I(`claude`),Hs()]),signals_fired:N(A())}).loose(),Y1=P({entries:N(q1),count:j().int().min(0),detection:J1}).loose(),X1=P({writers:N(P({id:A().min(1),name:A().optional(),email:A().optional()}).loose()).optional(),summary:Aq,...kq}).loose(),Z1=P({checkpointRef:A().min(1)}).loose(),Q1=P({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:N(A()),summaries:N(A()).optional()}).loose(),$1=P({entries:N(P({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:F([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:N(Q1),checkpoint:Ks().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:M().optional(),hasMore:M().optional()}).loose(),e0=P({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),t0=P({contentDir:A().min(1),pathSeparator:F([`/`,`\\`]),symlinkResolved:M()}).loose(),n0=N(tc(`source`,[P({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:I(`flat`)}).loose(),P({docName:A().min(1),timestamp:A().min(1),source:I(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),r0=P({orphans:N(P({docName:A().min(1),title:A()}).loose())}).loose(),i0=P({hubs:N(P({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),a0=P({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),o0=P({deadLinks:N(P({target:A().min(1),sources:N(a0)}).loose())}).loose(),s0=P({target:P({docName:A().min(1),title:A(),aliases:N(A())}).loose(),mentions:N(P({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:M()}).loose(),c0=P({projectPath:A().min(1)}).loose(),l0=F([`not-a-git-worktree`,`init-failed`]),u0=tc(`ok`,[P({ok:I(!0),projectPath:A().min(1)}).loose(),P({ok:I(!1),reason:l0,message:A().min(1)}).loose()]),d0=P({host:A().min(1).optional()}).loose(),f0=P({key:A().min(1)}).loose(),p0=P({keyPresent:M()}).loose(),m0=P({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),h0=P({authenticated:M()}).loose(),g0=P({}).loose(),_0=P({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),v0=P({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:N(_0)}).loose(),y0=P({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),b0=P({sessionAlive:M(),agent:y0.nullable(),files:N(v0)}).loose(),x0=P({diff:A(),generatedAt:j().int().min(0)}).loose(),S0=P({}).loose(),C0=P({}).loose(),w0=P({}).loose(),T0=P({}).loose(),E0=P({}).loose(),D0=P({}).loose(),O0=P({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:F([`idle`,`writing`]),ts:j().int().min(0)}).loose(),k0=P({presence:ac(A().min(1),O0)}).loose(),A0=ac(A().min(1),M()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});P({path:A().min(1,`path must be non-empty`)}).loose();const j0=P({}).loose(),M0=P({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),N0=P({fromPath:A().min(1),toPath:A().min(1)}).loose(),P0=P({}).loose(),F0=P({path:A().min(1),...kq,summary:Aq}).loose(),I0=P({docName:A().min(1)}).loose(),L0=P({path:A().min(1),...kq,summary:Aq}).loose(),R0=P({path:A().min(1)}).loose(),z0=P({kind:F([`file`,`folder`]),path:A().min(1),...kq,summary:Aq}).loose(),B0=P({kind:F([`file`,`folder`]),path:A().min(1),duplicatedDocNames:N(A().min(1))}).loose(),V0=P({pages:N(P({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1),icon:A().min(1).max(2048).optional()}).loose())}).loose(),H0=P({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),U0=P({docName:A().min(1),headings:N(H0)}).loose(),W0=P({docName:A().min(1),rewrites:j().int().nonnegative()}).loose(),G0=P({kind:F([`file`,`folder`,`asset`]),fromPath:A().min(1),toPath:A().min(1),...kq,summary:Aq}).loose(),K0=P({renamed:N(M0),renamedAssets:N(N0),rewrittenDocs:N(W0).optional(),summary:v1.optional()}).loose(),q0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq}).loose(),J0=P({deletedDocNames:N(A().min(1))}).loose(),Y0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq,summary:Aq}).loose(),X0=P({deletedDocNames:N(A().min(1))}).loose(),Z0=P({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Aq,...kq}).loose(),Q0=P({restoredFrom:A().min(1),timestamp:A().min(1),summary:v1.optional(),warning:b1.optional(),warnings:T1.optional()}).loose(),$0=F([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),e2=P({label:A().min(1),webUrl:xs().nullable()}).loose(),t2=tc(`checkStatus`,[P({checkStatus:I(`allowed`)}).loose(),P({checkStatus:I(`denied`),deniedReason:F([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),P({checkStatus:I(`unknown`),unknownError:F([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),n2=F([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),r2=P({state:$0,lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:M(),syncEnabled:M(),identityUnresolved:M(),remote:e2.nullable().optional(),pushError:A().optional(),pushErrorCode:n2.optional(),pullError:A().optional(),pullErrorCode:n2.optional(),pausedReason:A().optional(),pushPermission:t2.optional()}).loose(),i2=P({op:F([`sync`,`push`,`pull`]).optional()}).loose(),a2=P({op:F([`sync`,`push`,`pull`])}).loose(),o2=P({conflicts:N(P({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),s2=P({file:A().min(1),strategy:F([`mine`,`theirs`,`content`,`delete`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),c2=P({}).loose(),l2=P({file:A().min(1),base:A(),ours:A(),theirs:A(),kind:F([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:A().nullable()}).loose(),u2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),d2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),f2=P({result:jc(e=>e!==void 0,{message:`result is required`})}).loose(),p2=P({path:A().min(1),summary:A().min(1)}).loose(),m2=P({files:j().int().nonnegative(),folders:j().int().nonnegative()}).loose(),h2=P({packs:N(P({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:N(p2),entryCounts:m2}).loose())}).loose(),g2=P({noOpen:M().optional(),out:A().min(1).optional()}).loose(),_2=P({reason:F([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),v2=tc(`status`,[P({status:I(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),P({status:I(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:_2.optional()}).loose(),P({status:I(`failed`),buildError:A()}).loose(),P({status:I(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),y2=[`.ok`,`skill-targets.json`],b2=F(qG),x2=Zs({schema:I(1),targets:N(b2).default([])});function S2(e){let t;try{t=JSON.parse(e)}catch{return null}let n=x2.safeParse(t);return n.success?n.data:null}const C2=P({tags:N(P({name:A().min(1),count:j().int().nonnegative(),isLeaf:M()}).loose())}).loose(),w2=P({docName:A().min(1),title:A(),matchingTags:N(A().min(1)),snippet:A().nullable()}).loose(),T2=P({name:A().min(1),docs:N(w2)}).loose(),E2=P({folder:Ks(),frontmatter_local:ac(A(),Ks()).nullable()}).loose(),D2=P({path:A(),frontmatter:ac(A(),Ks()).optional()}).loose(),O2=P({applied:Ks()}).loose(),k2=ac(A(),Ks()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),A2=P({template:P({name:A().min(1),folder:A(),scope:F([`local`,`inherited`]),path:A().min(1),frontmatter:k2,body:A()}).strict()}).strict(),j2=P({templates:N(P({name:A().min(1),title:A().optional(),description:A().optional(),path:A().min(1),source_folder:A()}).strict()),truncated:M()}).strict(),M2=P({folder:A(),name:A(),body:A().optional(),frontmatter:k2.optional(),...kq,summary:Aq}).strict(),N2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),P2=P({existed:M(),path:A().min(1)}).strict(),F2=P({fromFolder:A(),fromName:A(),toFolder:A(),toName:A(),body:A().optional(),frontmatter:k2.optional(),...kq,summary:Aq}).strict(),I2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),L2=F(EG),R2=/^[a-z0-9-]+$/,z2=/<\/?[A-Za-z][^>]*>/;function B2(e){return z2.test(e)}const V2=/^[A-Za-z0-9_-]+$/,H2=P({name:A(),description:A()}).strict(),U2=P({skill:P({name:A().min(1),scope:L2,path:A().min(1),frontmatter:H2,body:A(),files:N(P({path:A().min(1),text:A().nullable()})).optional()}).strict()}).strict(),W2=P({skills:N(P({name:A().min(1),description:A().optional(),scope:L2,path:A().min(1),absolutePath:A().min(1).optional(),installed:M(),hosts:N(A()),installedVersion:A().optional(),bundledVersion:A().optional(),updateAvailable:M().optional()}).strict()),truncated:M()}).strict(),G2=P({scope:L2.default(`project`),name:A(),body:A().optional(),frontmatter:H2,...kq,summary:Aq}).strict(),K2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),q2=P({scope:L2.default(`project`),name:A(),...kq,summary:Aq}).strict(),J2=P({name:A().min(1),version:A().min(1),previousVersion:A().optional(),checkpointRef:A().optional()}).strict(),Y2=P({existed:M(),path:A().min(1)}).strict(),X2=P({scope:L2.default(`project`),fromName:A(),toName:A(),body:A().optional(),frontmatter:H2.optional(),...kq,summary:Aq}).strict(),Z2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),Q2=F([`reference`,`script`]),$2=P({scope:L2.default(`project`),name:A(),path:A().min(1),content:A(),...kq,summary:Aq}).strict(),e4=P({path:A().min(1),created:M(),kind:Q2,content:M()}).strict(),t4=P({path:A().min(1),kind:Q2,text:A()}).strict(),n4=P({path:A().min(1),existed:M(),kind:Q2}).strict(),r4=P({scope:L2.default(`project`),name:A(),targets:N(b2).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...kq,summary:Aq}).strict(),i4=P({name:A().min(1),hosts:N(A()),scripts:M(),warnings:N(A()),warningCodes:N(F([`no-targets`,`scripts-present`]))}).strict(),a4=P({scope:L2.default(`project`),name:A()}).strict(),o4=P({name:A().min(1),uninstalled:M()}).strict(),s4=P({targets:N(b2),configured:M()}).strict(),c4=P({targets:N(b2)}).strict(),l4=P({targets:N(b2),reprojected:N(P({name:A(),hosts:N(A())}).strict()),bundleHosts:N(A()),removedFrom:N(A())}).strict(),u4=P({scope:L2.default(`project`),name:A(),version:A().regex(/^[0-9a-f]{40}$/i),...kq,summary:Aq}).strict(),d4=P({name:A().min(1),version:A(),restoredFiles:N(A()),warnings:N(A())}).strict(),f4=P({query:A().optional(),intent:F([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:F([`navigation`,`relevance`]).optional(),scopes:N(F([`page`,`folder`,`content`,`file`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional(),semantic:M().optional(),source:F([`omnibar`,`mcp`,`http`]).optional()}).loose(),p4=P({kind:F([`page`,`folder`,`content`,`file`]),path:A().min(1),title:A(),score:j(),signals:ac(A(),Ks()),snippet:A().optional()}).loose(),m4=P({capable:M(),applied:M(),coverage:P({embedded:j().int().nonnegative(),total:j().int().nonnegative()})}).loose(),h4=P({enabled:M(),keyPresent:M(),keySource:F([`file`,`env`]).nullable(),keyHint:A().nullable(),ready:M(),capable:M(),embedded:j().int().nonnegative(),total:j().int().nonnegative()}).loose(),g4=P({query:A(),intent:F([`autocomplete`,`full_text`,`omnibar`]),results:N(p4),elapsedMs:j().nonnegative(),semantic:m4.optional(),truncated:M().optional(),ready:M().optional()}).loose(),_4=P({version:A().min(1),recordedAt:A().min(1)}).loose(),v4=P({currentVersion:A().min(1),targets:ac(A(),_4.nullable())}).loose(),y4=`server-info`,b4=`branch-switched`,x4=`disk-ack`,S4=`config-validation-rejected`,C4=`config-ignore-nested-error`,w4=F([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),T4=P({v:I(1),ch:I(y4),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),E4=P({v:I(1),ch:I(b4),seq:j(),branch:A().min(1)}).loose(),D4=P({v:I(1),ch:w4,seq:j()}).loose(),O4=P({v:I(1),ch:I(x4),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),k4=P({v:I(1),ch:I(S4),seq:j(),docName:A().min(1),error:ql}).loose(),A4=P({v:I(1),ch:I(C4),seq:j(),path:A().min(1),error:A().min(1)}).loose(),j4=new pG.default;function M4(e,t){if(e===t)return[{value:e}];let{chars1:n,chars2:r,lineArray:i}=j4.diff_linesToChars_(e,t),a=j4.diff_main(n,r,!1);j4.diff_charsToLines_(a,i),j4.diff_cleanupSemantic(a);let o=[];for(let[e,t]of a)e===pG.default.DIFF_DELETE?o.push({value:t,removed:!0}):e===pG.default.DIFF_INSERT?o.push({value:t,added:!0}):o.push({value:t});return o}const N4=new pG.default;N4.Diff_Timeout=.25;const P4=256*1024;function F4(e,t,n){if(t===n)return;let r=M4(t,n),i=0;for(let n=0;n<r.length;n++){let a=r[n],o=r[n+1];if(a.removed&&o?.added){if(t.substring(i,i+o.value.length)===o.value){i+=o.value.length,n++;continue}e.delete(i,a.value.length),e.insert(i,o.value),i+=o.value.length,n++}else a.removed?e.delete(i,a.value.length):(a.added&&e.insert(i,a.value),i+=a.value.length)}}function I4(e,t,n){if(t===n)return;if(t.length>P4||n.length>P4){L4(e,t,n);return}let r=N4.diff_main(t,n);N4.diff_cleanupSemantic(r);let i=0;for(let[t,n]of r)t===0?i+=n.length:t===-1?e.delete(i,n.length):t===1&&(e.insert(i,n),i+=n.length)}function L4(e,t,n){let r=0,i=Math.min(t.length,n.length);for(;r<i&&t.charCodeAt(r)===n.charCodeAt(r);)r++;let a=0;for(;a<i-r&&t.charCodeAt(t.length-1-a)===n.charCodeAt(n.length-1-a);)a++;let o=t.length-r-a,s=n.slice(r,n.length-a);o>0&&e.delete(r,o),s.length>0&&e.insert(r,s)}const R4=P({path:N($s([A(),j()])),message:A(),issueCode:A()});tc(`code`,[P({code:I(`SCHEMA_INVALID`),issues:N(R4)}),P({code:I(`WRITE_ERROR`),detail:A()})]);const z4={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function B4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=f1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function V4(e){return Object.keys(e).length===0?``:new Fc.Document(e).toString(z4)}function H4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U4(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=(0,Fc.isSeq)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(H4(n)){let r=e.createNode(n),i=(0,Fc.isMap)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function W4(e){return e===``?``:`---\n${e.endsWith(`
|
|
430
|
-
`)?e.slice(0,-1):e}\n---\n`}function
|
|
431
|
-
`)}function
|
|
432
|
-
`)){if(!
|
|
429
|
+
`)}const s1=[`text`,`number`,`boolean`,`date`,`list`,`object`];F(s1);const c1=$s([A(),j(),M()]),l1=kc(()=>$s([c1.transform(e=>String(e)),ac(A(),u1),N(l1)])),u1=kc(()=>$s([A(),j(),M(),N(l1),ac(A(),u1)]));function d1(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(d1(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:d1(r);return t}return e}const f1=Pc(d1,ac(A(),u1));ac(A(),$s([u1,Hs()]));function p1(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}const m1=P({docName:Oq,summary:Aq,content:A().optional(),...kq}).loose(),h1=P({docName:Oq,summary:Aq,markdown:A(),position:F([`append`,`prepend`,`replace`]).optional(),extension:F(VG).optional(),...kq}).loose(),g1=P({docName:Oq,summary:Aq,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...kq}).loose(),_1=P({docName:Oq,connectionId:A().min(1),scope:F([`last`,`session`,`file`]).optional(),...kq}).loose(),v1=P({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),y1=tc(`kind`,[P({kind:I(`inline`),content:A()}),P({kind:I(`truncated`),byteLength:j().int().nonnegative(),hint:A()})]),b1=P({kind:I(`content-divergence`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),divergenceType:A().optional(),currentState:y1.optional(),hint:A().optional()}).loose(),x1=P({type:I(`orphan`),parentCandidates:N(A()),message:A()}).loose(),S1=P({kind:I(`disk-edit-reconciled`),intendedBytes:j().int().nonnegative(),actualBytes:j().int().nonnegative(),byteDelta:j().int(),mergeOutcome:A().optional(),hint:A().optional()}).loose(),C1=tc(`kind`,[b1,S1]),w1=tc(`kind`,[b1,S1,P({kind:I(`mermaid-parse-error`),fenceIndex:j().int().positive(),fenceFirstLine:A(),message:A(),line:j().int().positive().optional()}).loose()]),T1=N(w1).min(1),E1=P({href:A(),resolvedTo:A().nullable(),reason:F([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),D1=N(E1),O1=P({timestamp:A().min(1),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional()}).loose(),k1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:N(x1).optional(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),A1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),j1=P({docName:A().min(1),scope:F([`last`,`session`]),undone:M()}).loose(),M1=P({docName:Oq,patch:ac(A(),$s([u1,Hs()])),types:ac(A(),F(s1)).optional(),summary:Aq,...kq}).loose(),N1=P({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),appliedKeys:N(A()),summary:v1.optional(),warning:C1.optional(),warnings:T1.optional(),brokenLinks:D1}).loose(),P1=P({entries:N(P({level:F([`info`,`warn`,`error`]),message:A().max(8192),event:A().optional(),fields:ac(A(),Ks()).optional(),ts:j().optional(),sourceId:A().optional(),lineNumber:j().optional()}).loose()).max(100)}).loose(),F1=P({accepted:j().int().min(0)}).loose(),I1=P({status:A().min(1),reason:A()}).loose(),L1=P({docName:A().min(1),content:A(),lifecycle:I1.nullable()}).loose(),R1=P({documents:N(P({kind:F([`document`,`asset`,`folder`,`file`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:M().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:F([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:N(A().min(1)).optional(),hasChildren:M().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:M().optional()}).loose(),z1=P({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),B1=P({docName:A().min(1),backlinks:N(z1)}).loose(),V1=P({counts:ac(A().min(1),j().int().nonnegative())}).loose(),H1=tc(`kind`,[P({kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),P({kind:I(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),U1=P({docName:A().min(1),forwardLinks:N(H1)}).loose(),W1=tc(`kind`,[P({id:A().min(1),kind:I(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:N(A()).nullable()}).loose(),P({id:A().min(1),kind:I(`external`),url:A().min(1),label:A()}).loose()]),G1=P({source:A().min(1),target:A().min(1)}).loose(),K1=P({nodes:N(W1),links:N(G1)}).loose(),q1=P({ts:j().int().min(0),url:A(),method:A(),ua:A().optional(),origin:A().optional(),referer:A().optional(),host:A().optional(),remote:A().optional(),secChUa:A().optional(),secChUaMobile:A().optional(),secChUaPlatform:A().optional(),secFetchSite:A().optional(),secFetchDest:A().optional(),secFetchMode:A().optional(),secFetchUser:A().optional()}).loose(),J1=P({app:$s([I(`cursor`),I(`codex`),I(`claude`),Hs()]),signals_fired:N(A())}).loose(),Y1=P({entries:N(q1),count:j().int().min(0),detection:J1}).loose(),X1=P({writers:N(P({id:A().min(1),name:A().optional(),email:A().optional()}).loose()).optional(),summary:Aq,...kq}).loose(),Z1=P({checkpointRef:A().min(1)}).loose(),Q1=P({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:N(A()),summaries:N(A()).optional()}).loose(),$1=P({entries:N(P({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:F([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:N(Q1),checkpoint:Ks().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:M().optional(),hasMore:M().optional()}).loose(),e0=P({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),t0=P({contentDir:A().min(1),pathSeparator:F([`/`,`\\`]),symlinkResolved:M()}).loose(),n0=N(tc(`source`,[P({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:I(`flat`)}).loose(),P({docName:A().min(1),timestamp:A().min(1),source:I(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),r0=P({domain:A().min(1),title:A().optional(),description:A().optional(),siteName:A().optional(),faviconDataUri:A().optional()}).loose(),i0=P({url:A()}).loose(),a0=tc(`ok`,[P({ok:I(!0),metadata:r0}).loose(),P({ok:I(!1),reason:A()}).loose()]),o0=P({orphans:N(P({docName:A().min(1),title:A()}).loose())}).loose(),s0=P({hubs:N(P({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),c0=P({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),l0=P({deadLinks:N(P({target:A().min(1),sources:N(c0)}).loose())}).loose(),u0=P({target:P({docName:A().min(1),title:A(),aliases:N(A())}).loose(),mentions:N(P({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:M()}).loose(),d0=P({projectPath:A().min(1)}).loose(),f0=F([`not-a-git-worktree`,`init-failed`]),p0=tc(`ok`,[P({ok:I(!0),projectPath:A().min(1)}).loose(),P({ok:I(!1),reason:f0,message:A().min(1)}).loose()]),m0=P({host:A().min(1).optional()}).loose(),h0=P({key:A().min(1)}).loose(),g0=P({keyPresent:M()}).loose(),_0=P({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),v0=P({authenticated:M()}).loose(),y0=P({}).loose(),b0=P({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),x0=P({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:N(b0)}).loose(),S0=P({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),C0=P({sessionAlive:M(),agent:S0.nullable(),files:N(x0)}).loose(),w0=P({diff:A(),generatedAt:j().int().min(0)}).loose(),T0=P({}).loose(),E0=P({}).loose(),D0=P({}).loose(),O0=P({}).loose(),k0=P({}).loose(),A0=P({}).loose(),j0=P({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:F([`idle`,`writing`]),ts:j().int().min(0)}).loose(),M0=P({presence:ac(A().min(1),j0)}).loose(),N0=ac(A().min(1),M()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});P({path:A().min(1,`path must be non-empty`)}).loose();const P0=P({}).loose(),F0=P({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),I0=P({fromPath:A().min(1),toPath:A().min(1)}).loose(),L0=P({}).loose(),R0=P({path:A().min(1),...kq,summary:Aq}).loose(),z0=P({docName:A().min(1)}).loose(),B0=P({path:A().min(1),...kq,summary:Aq}).loose(),V0=P({path:A().min(1)}).loose(),H0=P({kind:F([`file`,`folder`]),path:A().min(1),...kq,summary:Aq}).loose(),U0=P({kind:F([`file`,`folder`]),path:A().min(1),duplicatedDocNames:N(A().min(1))}).loose(),W0=P({pages:N(P({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1),icon:A().min(1).max(2048).optional()}).loose())}).loose(),G0=P({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),K0=P({docName:A().min(1),headings:N(G0)}).loose(),q0=P({docName:A().min(1),rewrites:j().int().nonnegative()}).loose(),J0=P({kind:F([`file`,`folder`,`asset`]),fromPath:A().min(1),toPath:A().min(1),...kq,summary:Aq}).loose(),Y0=P({renamed:N(F0),renamedAssets:N(I0),rewrittenDocs:N(q0).optional(),summary:v1.optional()}).loose(),X0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq}).loose(),Z0=P({deletedDocNames:N(A().min(1))}).loose(),Q0=P({kind:F([`file`,`folder`,`asset`]),path:A().min(1),...kq,summary:Aq}).loose(),$0=P({deletedDocNames:N(A().min(1))}).loose(),e2=P({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Aq,...kq}).loose(),t2=P({restoredFrom:A().min(1),timestamp:A().min(1),summary:v1.optional(),warning:b1.optional(),warnings:T1.optional()}).loose(),n2=F([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),r2=P({label:A().min(1),webUrl:xs().nullable()}).loose(),i2=tc(`checkStatus`,[P({checkStatus:I(`allowed`)}).loose(),P({checkStatus:I(`denied`),deniedReason:F([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),P({checkStatus:I(`unknown`),unknownError:F([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),a2=F([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),o2=P({state:n2,lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:M(),syncEnabled:M(),identityUnresolved:M(),remote:r2.nullable().optional(),pushError:A().optional(),pushErrorCode:a2.optional(),pullError:A().optional(),pullErrorCode:a2.optional(),pausedReason:A().optional(),pushPermission:i2.optional()}).loose(),s2=P({op:F([`sync`,`push`,`pull`]).optional()}).loose(),c2=P({op:F([`sync`,`push`,`pull`])}).loose(),l2=P({conflicts:N(P({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),u2=P({file:A().min(1),strategy:F([`mine`,`theirs`,`content`,`delete`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),d2=P({}).loose(),f2=P({file:A().min(1),base:A(),ours:A(),theirs:A(),kind:F([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:A().nullable()}).loose(),p2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),m2=P({plan:jc(e=>e!==void 0,{message:`plan is required`})}).loose(),h2=P({result:jc(e=>e!==void 0,{message:`result is required`})}).loose(),g2=P({path:A().min(1),summary:A().min(1)}).loose(),_2=P({files:j().int().nonnegative(),folders:j().int().nonnegative()}).loose(),v2=P({packs:N(P({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:N(g2),entryCounts:_2}).loose())}).loose(),y2=P({noOpen:M().optional(),out:A().min(1).optional()}).loose(),b2=P({reason:F([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),x2=tc(`status`,[P({status:I(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),P({status:I(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:b2.optional()}).loose(),P({status:I(`failed`),buildError:A()}).loose(),P({status:I(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),S2=[`.ok`,`skill-targets.json`],C2=F(qG),w2=Zs({schema:I(1),targets:N(C2).default([])});function T2(e){let t;try{t=JSON.parse(e)}catch{return null}let n=w2.safeParse(t);return n.success?n.data:null}const E2=P({tags:N(P({name:A().min(1),count:j().int().nonnegative(),isLeaf:M()}).loose())}).loose(),D2=P({docName:A().min(1),title:A(),matchingTags:N(A().min(1)),snippet:A().nullable()}).loose(),O2=P({name:A().min(1),docs:N(D2)}).loose(),k2=P({folder:Ks(),frontmatter_local:ac(A(),Ks()).nullable()}).loose(),A2=P({path:A(),frontmatter:ac(A(),Ks()).optional()}).loose(),j2=P({applied:Ks()}).loose(),M2=ac(A(),Ks()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),N2=P({template:P({name:A().min(1),folder:A(),scope:F([`local`,`inherited`]),path:A().min(1),frontmatter:M2,body:A()}).strict()}).strict(),P2=P({templates:N(P({name:A().min(1),title:A().optional(),description:A().optional(),path:A().min(1),source_folder:A()}).strict()),truncated:M()}).strict(),F2=P({folder:A(),name:A(),body:A().optional(),frontmatter:M2.optional(),...kq,summary:Aq}).strict(),I2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),L2=P({existed:M(),path:A().min(1)}).strict(),R2=P({fromFolder:A(),fromName:A(),toFolder:A(),toName:A(),body:A().optional(),frontmatter:M2.optional(),...kq,summary:Aq}).strict(),z2=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),B2=F(EG),V2=/^[a-z0-9-]+$/,H2=/<\/?[A-Za-z][^>]*>/;function U2(e){return H2.test(e)}const W2=/^[A-Za-z0-9_-]+$/,G2=P({name:A(),description:A()}).strict(),K2=P({skill:P({name:A().min(1),scope:B2,path:A().min(1),frontmatter:G2,body:A(),files:N(P({path:A().min(1),text:A().nullable()})).optional()}).strict()}).strict(),q2=P({skills:N(P({name:A().min(1),description:A().optional(),scope:B2,path:A().min(1),absolutePath:A().min(1).optional(),installed:M(),hosts:N(A()),installedVersion:A().optional(),bundledVersion:A().optional(),updateAvailable:M().optional()}).strict()),truncated:M()}).strict(),J2=P({scope:B2.default(`project`),name:A(),body:A().optional(),frontmatter:G2,...kq,summary:Aq}).strict(),Y2=P({path:A().min(1),created:M(),warnings:N(A())}).strict(),X2=P({scope:B2.default(`project`),name:A(),...kq,summary:Aq}).strict(),Z2=P({name:A().min(1),version:A().min(1),previousVersion:A().optional(),checkpointRef:A().optional()}).strict(),Q2=P({existed:M(),path:A().min(1)}).strict(),$2=P({scope:B2.default(`project`),fromName:A(),toName:A(),body:A().optional(),frontmatter:G2.optional(),...kq,summary:Aq}).strict(),e4=P({from:A().min(1),to:A().min(1),committed:M()}).strict(),t4=F([`reference`,`script`]),n4=P({scope:B2.default(`project`),name:A(),path:A().min(1),content:A(),...kq,summary:Aq}).strict(),r4=P({path:A().min(1),created:M(),kind:t4,content:M()}).strict(),i4=P({path:A().min(1),kind:t4,text:A()}).strict(),a4=P({path:A().min(1),existed:M(),kind:t4}).strict(),o4=P({scope:B2.default(`project`),name:A(),targets:N(C2).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...kq,summary:Aq}).strict(),s4=P({name:A().min(1),hosts:N(A()),scripts:M(),warnings:N(A()),warningCodes:N(F([`no-targets`,`scripts-present`]))}).strict(),c4=P({scope:B2.default(`project`),name:A()}).strict(),l4=P({name:A().min(1),uninstalled:M()}).strict(),u4=P({targets:N(C2),configured:M()}).strict(),d4=P({targets:N(C2)}).strict(),f4=P({targets:N(C2),reprojected:N(P({name:A(),hosts:N(A())}).strict()),bundleHosts:N(A()),removedFrom:N(A())}).strict(),p4=P({scope:B2.default(`project`),name:A(),version:A().regex(/^[0-9a-f]{40}$/i),...kq,summary:Aq}).strict(),m4=P({name:A().min(1),version:A(),restoredFiles:N(A()),warnings:N(A())}).strict(),h4=P({query:A().optional(),intent:F([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:F([`navigation`,`relevance`]).optional(),scopes:N(F([`page`,`folder`,`content`,`file`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional(),semantic:M().optional(),source:F([`omnibar`,`mcp`,`http`]).optional()}).loose(),g4=P({kind:F([`page`,`folder`,`content`,`file`]),path:A().min(1),title:A(),score:j(),signals:ac(A(),Ks()),snippet:A().optional()}).loose(),_4=P({capable:M(),applied:M(),coverage:P({embedded:j().int().nonnegative(),total:j().int().nonnegative()})}).loose(),v4=P({enabled:M(),keyPresent:M(),keySource:F([`file`,`env`]).nullable(),keyHint:A().nullable(),ready:M(),capable:M(),embedded:j().int().nonnegative(),total:j().int().nonnegative()}).loose(),y4=P({query:A(),intent:F([`autocomplete`,`full_text`,`omnibar`]),results:N(g4),elapsedMs:j().nonnegative(),semantic:_4.optional(),truncated:M().optional(),ready:M().optional()}).loose(),b4=P({version:A().min(1),recordedAt:A().min(1)}).loose(),x4=P({currentVersion:A().min(1),targets:ac(A(),b4.nullable())}).loose(),S4=`server-info`,C4=`branch-switched`,w4=`disk-ack`,T4=`config-validation-rejected`,E4=`config-ignore-nested-error`,D4=F([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),O4=P({v:I(1),ch:I(S4),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),k4=P({v:I(1),ch:I(C4),seq:j(),branch:A().min(1)}).loose(),A4=P({v:I(1),ch:D4,seq:j()}).loose(),j4=P({v:I(1),ch:I(w4),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),M4=P({v:I(1),ch:I(T4),seq:j(),docName:A().min(1),error:ql}).loose(),N4=P({v:I(1),ch:I(E4),seq:j(),path:A().min(1),error:A().min(1)}).loose(),P4=new pG.default;function F4(e,t){if(e===t)return[{value:e}];let{chars1:n,chars2:r,lineArray:i}=P4.diff_linesToChars_(e,t),a=P4.diff_main(n,r,!1);P4.diff_charsToLines_(a,i),P4.diff_cleanupSemantic(a);let o=[];for(let[e,t]of a)e===pG.default.DIFF_DELETE?o.push({value:t,removed:!0}):e===pG.default.DIFF_INSERT?o.push({value:t,added:!0}):o.push({value:t});return o}const I4=new pG.default;I4.Diff_Timeout=.25;const L4=256*1024;function R4(e,t,n){if(t===n)return;let r=F4(t,n),i=0;for(let n=0;n<r.length;n++){let a=r[n],o=r[n+1];if(a.removed&&o?.added){if(t.substring(i,i+o.value.length)===o.value){i+=o.value.length,n++;continue}e.delete(i,a.value.length),e.insert(i,o.value),i+=o.value.length,n++}else a.removed?e.delete(i,a.value.length):(a.added&&e.insert(i,a.value),i+=a.value.length)}}function z4(e,t,n){if(t===n)return;if(t.length>L4||n.length>L4){B4(e,t,n);return}let r=I4.diff_main(t,n);I4.diff_cleanupSemantic(r);let i=0;for(let[t,n]of r)t===0?i+=n.length:t===-1?e.delete(i,n.length):t===1&&(e.insert(i,n),i+=n.length)}function B4(e,t,n){let r=0,i=Math.min(t.length,n.length);for(;r<i&&t.charCodeAt(r)===n.charCodeAt(r);)r++;let a=0;for(;a<i-r&&t.charCodeAt(t.length-1-a)===n.charCodeAt(n.length-1-a);)a++;let o=t.length-r-a,s=n.slice(r,n.length-a);o>0&&e.delete(r,o),s.length>0&&e.insert(r,s)}const V4=P({path:N($s([A(),j()])),message:A(),issueCode:A()});tc(`code`,[P({code:I(`SCHEMA_INVALID`),issues:N(V4)}),P({code:I(`WRITE_ERROR`),detail:A()})]);const H4={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function U4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=f1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function W4(e){return Object.keys(e).length===0?``:new Fc.Document(e).toString(H4)}function G4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K4(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=(0,Fc.isSeq)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(G4(n)){let r=e.createNode(n),i=(0,Fc.isMap)(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function q4(e){return e===``?``:`---\n${e.endsWith(`
|
|
430
|
+
`)?e.slice(0,-1):e}\n---\n`}function J4(e){let t=e.match(fK);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function Y4(e){if(e.trim()===``)return{doc:new Fc.Document({}),map:{}};let t;try{t=(0,Fc.parseDocument)(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Fc.Document({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=f1.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function X4(e){return e===``?{doc:new Fc.Document({}),map:{}}:Y4(hK(e))}function Z4(e){let{fenced:t}=J4(e),{map:n}=X4(t);return n??{}}function Q4(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function $4(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:q4(e.toString(H4))}function e3(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:65536}:null}function t3(e){let t=$4(e),n=e3(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function n3(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:`frontmatter`}};let{doc:n,map:r}=X4(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{Q4(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=u1.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,K4(n,n.get(e,!0),t.data))}return t3(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function r3(e,t){let n=t?.verbose===!0,r=t?.nowMs===void 0?new Date().toISOString():new Date(t.nowMs).toISOString(),i={event:`bridge-invariant-violation`,site:e.site,"doc.name":e.docName??null,"tolerance-class-attempted":`untracked`,"normalize-equal-modulo-tolerance":!1,ytextLen:e.ytextSnapshot.length,fragmentLen:e.fragmentMdSnapshot.length,ytextHash:uu(e.ytextSnapshot),fragmentHash:uu(e.fragmentMdSnapshot),redacted:!n,timestamp:r};return n?{...i,diff:e.unifiedDiff}:i}var i3=class extends Error{violation;constructor(e){let t=typeof e.origin==`string`?e.origin:e.origin?.context?.origin??`unknown-object`,n=e.docName?` doc='${e.docName}'`:``;super(`Bridge invariant violated [site='${e.site}'${n}, origin='${t}'].\n Y.Text (${e.ytextSnapshot.length} chars): ${e.ytextSnapshot.slice(0,200)}...\n Fragment (${e.fragmentMdSnapshot.length} chars): ${e.fragmentMdSnapshot.slice(0,200)}...\n Diff:\n${e.unifiedDiff}`),this.name=`BridgeInvariantViolationError`,this.violation=e}};const a3=/^(?:\r?\n)+/;function o3(e){let{frontmatter:t,body:n}=pK(e),r=n.match(a3);if(!r)return{boundary:``,text:e};let i=n.slice(r[0].length);return t===``&&fK.test(i)?{boundary:``,text:e}:{boundary:r[0],text:t+i}}function s3(e,t){if(t===``)return e;let{frontmatter:n,body:r}=pK(e);return n+t+r}function c3(e){let t=o3(e).text;return pK(t).frontmatter===``?t:s3(t,`
|
|
431
|
+
`)}function l3(e,t=16){let n=e.trim();return n.length<t?!1:!(n.startsWith(`<`)||n.startsWith("```")||n.startsWith(`|`))}function u3(e,t=16){let n=new Map;for(let r of e.split(`
|
|
432
|
+
`)){if(!l3(r,t))continue;let e=r.trim();n.set(e,(n.get(e)??0)+1)}return n}function d3(e,t,n=16){let r=u3(t,n),i=[];for(let[t,a]of u3(e,n))a>=2&&a>(r.get(t)??0)&&i.push(t);return i}const f3=new pG.default;f3.Match_Threshold=.5;function p3(e,t,n){let r=m3(e,t,n);return y3(e,t,n,r),r}function m3(e,t,n){if(e===t)return n;if(e===n||t===n)return t;let r=NV(t.split(`
|
|
433
433
|
`),e.split(`
|
|
434
434
|
`),n.split(`
|
|
435
435
|
`)),i=[];for(let e=0;e<r.length;e++){let t=r[e];if(`ok`in t&&t.ok)i.push(t.ok.join(`
|
|
436
436
|
`));else if(`conflict`in t&&t.conflict){let e=t.conflict.o.join(`
|
|
437
437
|
`),n=t.conflict.a.join(`
|
|
438
438
|
`),r=t.conflict.b.join(`
|
|
439
|
-
`);i.push(
|
|
440
|
-
`)}function
|
|
441
|
-
`)){let t=e.trim();t.length!==0&&r.push(t)}return r}function
|
|
439
|
+
`);i.push(b3(e,n,r))}}return i.join(`
|
|
440
|
+
`)}function h3(e){return e.map(e=>({len:e.length,digest:uu(e)}))}var g3=class extends Error{info;constructor(e){let t=e.lostSubstrings.map(e=>JSON.stringify(e.length>80?`${e.slice(0,77)}...`:e)).join(`, `);super(`Bridge merge content loss (which=${e.which}, side=${e.side}): ${t}`),this.name=`BridgeMergeContentLossError`,this.info=e}toLog(e){let t=e?.verbose===!0;return{event:`bridge-merge-content-loss`,which:this.info.which,side:this.info.side,baselineLen:this.info.baseline.length,userTextLen:this.info.userText.length,agentTextLen:this.info.agentText.length,resultLen:this.info.result.length,lostSubstrings:t?this.info.lostSubstrings:h3(this.info.lostSubstrings),redacted:!t}}};function _3(e,t){if(e===t)return[];let n=f3.diff_main(e,t);f3.diff_cleanupSemantic(n);let r=[];for(let[e,t]of n)if(e===1)for(let e of t.split(`
|
|
441
|
+
`)){let t=e.trim();t.length!==0&&r.push(t)}return r}function v3(e,t){let n=0;for(let r of t){let t=e.indexOf(r,n);if(t<0){if(e.indexOf(r)<0)continue;return r}n=t+r.length}return null}function y3(e,t,n,r){let i=_3(e,t),a=_3(e,n),o=i.filter(e=>!r.includes(e));if(o.length>0)throw new g3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:o,which:`substring`,side:`user`});let s=a.filter(e=>!r.includes(e));if(s.length>0)throw new g3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:s,which:`substring`,side:`agent`});let c=v3(r,i);if(c!==null)throw new g3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[c],which:`order`,side:`user`});let l=v3(r,a);if(l!==null)throw new g3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[l],which:`order`,side:`agent`});let u=u3(e),d=u3(t),f=u3(n);for(let[i,a]of u3(r))if(!(a<2)&&a>Math.max(u.get(i)??0,d.get(i)??0,f.get(i)??0))throw new g3({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[i],which:`growth`,side:`user`})}function b3(e,t,n){if(t===``)return n;if(n===``)return t;let r=f3.patch_make(e,t),[i,a]=f3.patch_apply(r,n);return a.some(e=>!e)&&console.warn(JSON.stringify({event:`bridge-merge-patch-drop`,applied:a.filter(Boolean).length,total:a.length,regionSize:n.length})),i}const x3=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,S3=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,C3=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,w3=/^\d+([.)])(?=\s)/,T3=/\*\*\s*(`[^`]+`)\s*\*\*/g,E3=/^(`{3,}|~{3,})/;function D3(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r].trimEnd(),a=E3.exec(i);if(a){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}if(n!==null||r===0||!S3.test(i))continue;let o=e[r-1].trimEnd();if(!(!o.startsWith(`|`)||S3.test(o))){t.add(r-1),t.add(r);for(let n=r+1;n<e.length&&e[n].trimEnd().startsWith(`|`);n++)t.add(n)}}return t}function O3(e){return e.slice(0,-1).trimEnd()}const k3=/^(?:#{1,6}[ \t]|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function A3(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r]??``,a=/^(`{3,}|~{3,})/.exec(i.trimStart());if(a?.[1]){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}n!==null&&t.add(r)}return t}const j3=/^<\/?[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,M3=/^<[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,N3=/^<\/[A-Z][A-Za-z0-9.]*\s*>$/,P3=/<\/?[A-Z]/;function F3(e){let t=!1;for(let n=0;n<e.length;n++)if(P3.test(e[n]??``)){t=!0;break}if(!t)return e;let n=A3(e),r=[],i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t]??``,s=o.trim();if(n.has(t)){r.push(!1),i.push(a);continue}let c=a>=1||!/^[ \t]/.test(o);r.push(c&&j3.test(s));let l=c&&N3.test(s),u=c&&!l&&M3.test(s)&&!s.endsWith(`/>`);l?(a=Math.max(0,a-1),i.push(a)):(i.push(a),u&&(a+=1))}let o=Array(e.length);for(let t=0,n=-1;t<e.length;t++)o[t]=n,(e[t]??``).trim()!==``&&(n=t);let s=Array(e.length);for(let t=e.length-1,n=e.length;t>=0;t--)s[t]=n,(e[t]??``).trim()!==``&&(n=t);let c=new Set;for(let t=0;t<e.length;t++){if((e[t]??``).trim()!==``||n.has(t)||(i[t]??0)<1)continue;let a=o[t]??-1,l=s[t]??e.length;(a>=0&&r[a]===!0||l<e.length&&r[l]===!0)&&c.add(t)}let l=[];for(let t=0;t<e.length;t++){if(c.has(t))continue;let n=e[t]??``;l.push(r[t]===!0&&(i[t]??0)>=1?n.replace(/^[ \t]+/,``):n)}return l}function I3(e){let t=F3(e.replace(/^/,``).replace(/\r/g,``).replace(x3,`$1`).replace(T3,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
|
|
442
442
|
|
|
443
443
|
$2`).replace(/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n([^\n])/gm,`$1
|
|
444
444
|
|
|
445
445
|
$2`).split(`
|
|
446
|
-
`)),n=
|
|
446
|
+
`)),n=D3(t),r=A3(t);return t.map((e,i)=>{let a=e.trimEnd();if(i>0&&!r.has(i)&&/^[ \t]+\S/.test(a)&&(t[i-1]??``).trim()!==``&&!C3.test(a)&&!k3.test(a.trimStart())){let e=(t[i-1]??``).trimStart();if(!k3.test(e)&&!e.startsWith(`|`))return a.replace(/^[ \t]+/,``)}if(S3.test(a)){let e=a.replace(/\s+/g,``);return n.has(i)&&e.length>1&&e.startsWith(`|`)&&e.endsWith(`|`)?O3(e):e}let o=C3.test(a)?a.replace(/^[ \t]+/,``):a;return n.has(i)&&o.length>1&&o.startsWith(`|`)&&o.endsWith(`|`)&&(o=O3(o)),o.replace(w3,`1$1`)}).join(`
|
|
447
447
|
`).replace(/\n{3,}/g,`
|
|
448
448
|
|
|
449
|
-
`).replace(/\n+$/,``)}function
|
|
449
|
+
`).replace(/\n+$/,``)}function L3(e,t){let n=[];(e.charCodeAt(0)===65279||t.charCodeAt(0)===65279)&&n.push(`bom`),(e.includes(`\r`)||t.includes(`\r`))&&n.push(`crlf`),(/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(e)||/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(t))&&n.push(`commonmark-escape`),(/\*\*\s*`[^`]+`\s*\*\*/.test(e)||/\*\*\s*`[^`]+`\s*\*\*/.test(t))&&n.push(`emphasis-around-code`);let r=e.replace(/^/,``),i=t.replace(/^/,``);r.startsWith(`
|
|
450
450
|
`)!==i.startsWith(`
|
|
451
451
|
`)&&n.push(`leading-newline`);let a=r.replace(/^\n+/,``),o=i.replace(/^\n+/,``),s=/^\*{3,}(?=\n|$)/.test(a),c=/^-{3,}(?=\n|$)/.test(a),l=/^\*{3,}(?=\n|$)/.test(o),u=/^-{3,}(?=\n|$)/.test(o);(s&&u||c&&l)&&n.push(`doc-start-thematic`);let d=/\n\n([#>+-]|\d+[.)]|`{3,}|~{3,})/,f=/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n\n[^\n]/m,p=d.test(r),m=d.test(i),h=f.test(r),g=f.test(i);(p!==m||h!==g)&&n.push(`block-separator-collapse`);let _=r.replace(/\r/g,``),v=i.replace(/\r/g,``),y=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/m;(y.test(_)||y.test(v))&&n.push(`table-align-row-spacing`);let b=e=>y.test(e)&&/^\|[^\n]*[^|\s][ \t]*$/m.test(e);b(_)!==b(v)&&n.push(`row-no-trailing-pipe`);let x=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/m;(x.test(_)||x.test(v))&&n.push(`list-indent-canonical`);let S=/[^\n]\n[ \t]+(?![-+*>#]|\d+[.)])\S/;(S.test(_)||S.test(v))&&n.push(`paragraph-continuation-indent`);let C=_.split(`
|
|
452
452
|
`),w=v.split(`
|
|
453
|
-
`),T=e=>{for(let t=0;t<e.length-1;t++){let n=(e[t]??``).trim(),r=(e[t+1]??``).trim(),i=n!==``&&r===``&&
|
|
453
|
+
`),T=e=>{for(let t=0;t<e.length-1;t++){let n=(e[t]??``).trim(),r=(e[t+1]??``).trim(),i=n!==``&&r===``&&j3.test(n),a=n===``&&r!==``&&j3.test(r);if(i||a)return!0}return!1};(T(C)||T(w))&&n.push(`jsx-container-boundary-blank`);let E=e=>e.replace(/^[ \t]+/,``).replace(w3,`1$1`),ee=Math.min(C.length,w.length);for(let e=0;e<ee;e++){let t=C[e]??``,r=w[e]??``;if(t!==r&&E(t)===E(r)&&/^[ \t]*\d+[.)]\s/.test(t)){n.push(`ordered-list-marker-number`);break}}return(/[ \t]\n/.test(_)||/[ \t]\n/.test(v))&&n.push(`trailing-whitespace`),(/[ \t]$/.test(_)||/[ \t]$/.test(v))&&(n.includes(`trailing-whitespace`)||n.push(`trailing-whitespace`)),(/\n{3,}/.test(_)||/\n{3,}/.test(v))&&n.push(`blank-line-collapse`),_.endsWith(`
|
|
454
454
|
`)!==v.endsWith(`
|
|
455
|
-
`)&&n.push(`trailing-newline`),n}const
|
|
456
|
-
`).map(e=>e.replace(R3,(e,t,n)=>`${t}1${n}`)).join(``).replace(/\s+/g,``)}const B3=new Set;function V3(e,t,n){let r=pK(e),i=pK(t);if(r.frontmatter!==i.frontmatter)return!1;if(r.body===i.body)return!0;let a;try{a=n(r.body)}catch(e){let t=e instanceof Error?e.message:String(e);return B3.size<8&&!B3.has(t)&&(B3.add(t),console.warn(`[parse-equivalence] canonicalizeBody threw; treating as not equivalent:`,t)),!1}return I3(L3(a))===I3(L3(i.body))?bJ(z3(r.body),z3(a)):!1}const H3={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},U3={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"jsx-container-boundary-blank":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`,"parse-equivalence":`parser-caused`};function W3(e){return U3[e]}function G3(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let K3=null;function q3(e){K3=e}function J3(e,t,n,r){if(!K3||e.length===0)return;let i=G3(t,n),a=new Date().toISOString();for(let t of e)K3({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:W3(t)})}const Y3=1e4,X3=`last-spawn-error.log`,Z3=/^[a-zA-Z0-9][\w/-]*$/;function Q3(e){return e.startsWith(`#`)?e.slice(1):e}function $3(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function e6(e){if(!e||e.trim()===``)return[];let{map:t}=B4(e);if(!t)return[];let n=$3(t.tags),r=[];for(let e of n){let t=Q3(e);Z3.test(t)&&r.push(t)}return r}const t6=[`.ok`,`local`,`installed-skills.json`],n6=F(EG),r6=Zs({hosts:N(A()),scope:n6,scripts:M(),installedAt:Go()}),i6=Zs({schema:I(1),skills:ac(A(),r6).default({})});function a6(){return{schema:1,skills:{}}}function o6(e){let t;try{t=JSON.parse(e)}catch{return null}let n=i6.safeParse(t);return n.success?n.data:null}const s6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},c6=new WeakMap;function l6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function u6(e){return e.trim().toLowerCase()}const d6=/\.(?:md|mdx)$/;function f6(e,t){if(t!==`page`)return e;let n=e.replace(d6,``);return n.length>0?n:e}function p6(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function m6(e){let t=p6(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function h6(e){let t=CW({schema:s6});return e.length>0&&PW(t,e),t}function g6(e){let t={documents:e};return c6.set(t,h6(e)),t}function _6(e){let t=c6.get(e);if(t)return t;let n=h6(e.documents);return c6.set(e,n),n}function v6(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function y6(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function b6(e,t){let n=u6(t);if(!n)return 0;let r=f6(n,e.kind),i=u6(e.title),a=u6(e.name),o=u6(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function x6(e,t){let n=b6(e,t);return n<=0?n:Eq(e.path)?n*.5:n}function S6(e){return e===`file`?-60:0}function C6(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function w6(e,t,n,r){return e+t*20+n+S6(r)}function T6(e,t,n,r,i,a){return e===`relevance`?w6(t,n,r,i):C6(t,n,r,i,a)}function E6(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function D6(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function O6(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function k6(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function A6(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function j6(e,t){return u6(t).length<4?0:e===`full_text`?1:0}function M6(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function N6(e){let t=[],n=[],r=[];for(let i of e){let e=M6(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function P6(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=N6(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function F6(e,t,n={}){let r=n.intent??`omnibar`,i=E6(r,n.ranking),a=l6(n.limit),o=new Set(n.scopes??v6(r)),s=e.documents.filter(e=>y6(e,o)),c=u6(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=uG(_6(e),{term:c,properties:k6(r),boost:A6(r),tolerance:j6(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>y6(e.document,o)).map(e=>[e.document.id,e.score])),d=O6(s),f=new Map;for(let e of s)x6(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)y6(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=D6(f.values(),u);return P6([...f.values()].map(t=>{let n=Math.max(0,x6(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:T6(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return P6(L6({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function I6(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function L6(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=D6(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,x6(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?T6(o,t,n,s,e.kind,m):w6(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=I6(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=I6(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function R6(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),z6(n)}function z6(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const B6=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),V6=globalThis;V6[B6]===void 0&&(V6[B6]=Ri());const H6=V6[B6],U6=[`.ok`,`skill-state.yml`],W6=[`claude-cowork`,`cli-hosts`],G6=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],K6=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,q6=Zs({version:A().regex(K6,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(H6,{description:`Recorded skill version for this target.`}),recordedAt:Go().register(H6,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:F(G6).register(H6,{description:`Install-source surface that recorded this entry.`}).optional()}),J6=Zs({enabled:M().register(H6,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Go().register(H6,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),Y6=Zs({schema:I(1).register(H6,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zs({"claude-cowork":q6.optional(),"cli-hosts":q6.optional()}).register(H6,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:ac(A(),J6).register(H6,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});function X6(e,t){return e??t.installedOnDisk}function Z6(){return{schema:1,targets:{}}}const Q6=`template`;function $6(e){if(e.trim()===``)return{};let t;try{t=(0,Fc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function e8(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function t8(e){let{frontmatter:t,body:n}=pK(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:hK(t),markdown:n}}function n8(e){let t=e.split(`
|
|
457
|
-
`);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i
|
|
458
|
-
`))[
|
|
459
|
-
`).replace(/\n+$/,``)}}function r8(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=pK(t);if(n===``)return{identity:{},starterContent:t};let i=hK(n),a=n8(i);if(a)return{identity:a.identity,starterContent:e8(a.docFrontmatterText,r)};let{frontmatter:o}=pK(r);if(o!==``)return{identity:$6(i),starterContent:r};let s=$6(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:e8(i,r)}}function i8(e,t){let{docFrontmatterText:n,markdown:r}=t8(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Fc.stringify)({[Q6]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function a8(e){return r8(e).starterContent}function o8(){let e=!1,t=``,n=0;return r=>{let i=s8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function s8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const c8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],l8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function u8(e,t=c8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const d8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function f8(e){return e?d8[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const p8={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function m8(e){let t=e?.trim();return t?p8[f8(t)]??t:`Agent`}function h8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const g8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function _8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function v8(e){let t=e.trim();return g8.test(t)||t.startsWith(`//`)}function y8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(v8(n))return{kind:`external`,url:n};let r=h8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=_8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function b8(e,t){let n=e.trim();if(!n)return null;if(v8(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=_8(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function x8(e,t){let n=e.trim();if(!n||g8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function S8(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function C8(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function w8(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function T8(e){return e.split(`/`).filter(e=>e!==``)}function E8(e,t){let n=w8(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function D8(e,t){let n=w8(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:T8(r).length}function O8(e,t){let n=T8(e),r=T8(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function k8(){let e=new Map;function t(t){let n=S8(t);if(n===``)return;let r=C8(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=S8(t),r=C8(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=w8(S8(n)),o=[],s=[];for(let e of i)E8(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=D8(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=D8(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=O8(a,w8(t));for(let r=1;r<e.length;r++){let i=e[r],o=O8(a,w8(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function A8(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function j8(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function M8(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function N8(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const P8=/^[A-Za-z0-9-]{8,64}$/;let F8=null;function I8(e){return l(e??m(),`.ok`,`machine-id`)}function L8(e){if(e===void 0&&F8!==null)return F8;let t=I8(e),n=null;try{let e=b(t,`utf-8`).trim();P8.test(e)&&(n=e)}catch{}if(n===null){n=w();try{v(c(t),{recursive:!0}),S(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(F8=n),n}function R8(){try{let e=u(c(f(import.meta.url)),`..`,`package.json`),t=JSON.parse(b(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const z8=R8(),B8=1;var V8=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function H8(e,t){return u(e,`${t}.lock`)}const U8=new Map;function W8(e){U8.set(e,(U8.get(e)??0)+1)}function G8(e){let t=U8.get(e);return t===void 0||t<=1?(U8.delete(e),!0):(U8.set(e,t-1),!1)}function K8(e){return typeof e.machineId==`string`?e.machineId===L8():e.hostname===h()}const q8=new Set;let J8=!1;function Y8(e){q8.add(e),!J8&&(J8=!0,process.on(`exit`,()=>{for(let e of q8)try{let t=JSON.parse(b(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==L8()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==h())continue;x(e)}catch{}}))}function X8(e,t){try{let n=JSON.parse(b(e,`utf-8`));return n&&typeof n==`object`&&N8(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function Z8(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;v(n,{recursive:!0});let a=H8(n,t),o={pid:process.pid,hostname:h(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:L8(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??z8},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!_(a))try{let e=y(a,`wx`,384);try{C(e,s)}finally{g(e)}return W8(a),Y8(a),Q8({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=X8(a,i);if(e){if(K8(e)&&e.pid===process.pid)return S(a,s,{encoding:`utf-8`,mode:384}),W8(a),Y8(a),Q8({lockName:t,lockDir:n,lockPath:a});if(M8(e.pid))throw new V8(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{x(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function Q8(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>i5({lockName:t,lockDir:n}),updatePort:e=>$8({lockName:t,lockDir:n,port:e})}}function $8(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=H8(n,t);if(!_(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||!N8(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&K8(o)){o.port=r;try{S(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function e5(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=H8(n,t);if((U8.get(i)??0)>1)return;let a;try{let e=JSON.parse(b(i,`utf-8`));if(!e||typeof e!=`object`||!N8(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&K8(a)&&a.draining!==!0){a.draining=!0;try{S(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function t5(e){let{lockName:t,lockDir:n}=e,r=H8(n,t);if(!_(r))return null;let i;try{let e=JSON.parse(b(r,`utf-8`));if(!e||typeof e!=`object`||!N8(e.pid))return null;i=e}catch{return null}if(!K8(i))return null;if(!M8(i.pid)){try{x(r)}catch{}return null}return i}function n5(e){let{lockName:t,lockDir:n}=e,r=H8(n,t);if(!_(r))return{status:`absent`};let i;try{i=JSON.parse(b(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!N8(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!K8(o))return{status:`stale`,lock:o};if(!M8(o.pid)){try{x(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}async function r5(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>t5({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function i5(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=H8(n,t);if(G8(a)){if(r){e5({lockName:t,lockDir:n});return}if(_(a))try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!K8(e))return;x(a),q8.delete(a)}catch(e){console.warn(`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var a5=class extends V8{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function o5(e,t){try{return Z8({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof V8&&e.lockName===`server`?new a5(e.existing,e.lockPath):e}}function s5(e,t){$8({lockName:`server`,lockDir:e,port:t})}function c5(e){return t5({lockName:`server`,lockDir:e})}function l5(e,t){i5({lockName:`server`,lockDir:e,...t})}function u5(e){e5({lockName:`server`,lockDir:e})}function d5(e,t){return r5({lockName:`server`,lockDir:e,...t})}export{hG as $,ou as $a,RG as $i,sJ as $n,X0 as $r,p0 as $t,h1 as A,sp as Aa,e6 as Ai,W6 as An,Ks as Ao,l2 as Ar,D2 as At,E1 as B,xl as Ba,Eq as Bi,d2 as Bn,fn as Bo,C2 as Br,t6 as Bt,w1 as C,j8 as Ca,G4 as Ci,K0 as Cn,j as Co,o4 as Cr,B0 as Ct,A1 as D,wq as Da,Z6 as Di,OG as Dn,ac as Do,j0 as Dr,Y1 as Dt,g1 as E,hK as Ea,a6 as Ei,Q0 as En,Pc as Eo,W2 as Er,KG as Et,V1 as F,Ol as Fa,_q as Fi,_G as Fn,Ka as Fo,i2 as Fr,u1 as Ft,O4 as G,lu as Ga,Gq as Gi,lJ as Gn,Dt as Go,M2 as Gr,QG as Gt,A4 as H,Kc as Ha,DG as Hi,h2 as Hn,gn as Ho,A2 as Hr,v2 as Ht,B1 as I,Zc as Ia,f8 as Ii,X1 as In,qa as Io,a2 as Ir,JG as It,C4 as J,Yc as Ja,N3 as Ji,Bq as Jn,ht as Jo,T0 as Jr,g0 as Jt,T4 as K,cu as Ka,BG as Ki,Mq as Kn,k as Ko,N2 as Kr,HG as Kt,nJ as L,Cl as La,a8 as Li,Z1 as Ln,si as Lo,Q6 as Lr,$1 as Lt,m1 as M,uu as Ma,X$ as Mi,y2 as Mn,Go as Mo,s2 as Mr,U1 as Mt,O1 as N,qc as Na,W$ as Ni,X3 as Nn,Uo as No,c2 as Nr,M1 as Nt,_1 as O,W4 as Oa,R6 as Oi,R2 as On,A as Oo,vJ as Or,P0 as Ot,dJ as P,su as Pa,GY as Pi,VG as Pn,ma as Po,r2 as Pr,N1 as Pt,vG as Q,Tl as Qa,o6 as Qi,oJ as Qn,Y0 as Qr,_J as Qt,t3 as R,wl as Ra,qq as Ri,f4 as Rn,br as Ro,V2 as Rr,e0 as Rt,WG as S,pK as Sa,P3 as Si,G0 as Sn,Zs as So,a4 as Sr,z0 as St,x0 as T,H$ as Ta,J3 as Ti,Z0 as Tn,dc as To,J2 as Tr,YG as Tt,k4 as U,Xc as Ua,eK as Ui,u2 as Un,cn as Uo,F2 as Ur,A0 as Ut,E4 as V,bl as Va,eJ as Vi,f2 as Vn,mn as Vo,P2 as Vr,g2 as Vt,D4 as W,pl as Wa,V3 as Wi,h4 as Wn,zt as Wo,I2 as Wr,i6 as Wt,x4 as X,Ml as Xa,B4 as Xi,Hq as Xn,w0 as Xr,m0 as Xt,S4 as Y,Jc as Ya,c3 as Yi,zq as Yn,mt as Yo,C0 as Yr,d0 as Yt,y4 as Z,zl as Za,FG as Zi,Wq as Zn,S0 as Zr,h0 as Zt,l5 as _,q3 as _a,o8 as _i,mG as _n,M as _o,b2 as _r,o0 as _t,Z8 as a,a1 as aa,F4 as ai,EG as an,ml as ao,U2 as ar,rJ as at,d5 as b,IG as ba,m6 as bi,uJ as bn,rc as bo,l4 as br,R1 as bt,M8 as c,J4 as ca,$q as ci,k0 as cn,Ll as co,i4 as cr,F1 as ct,e5 as d,x8 as da,gG as di,$G as dn,Ls as do,G2 as dr,F0 as dt,NG as ea,XG as ei,f0 as en,Zl as eo,Y2 as er,CG as et,u5 as f,X6 as fa,u8 as fi,r0 as fn,uc as fo,K2 as fr,I0 as ft,i5 as g,V4 as ga,k8 as gi,qG as gn,N as go,Y6 as gr,UG as gt,c5 as h,F6 as ha,B2 as hi,iK as hn,Ws as ho,L2 as hr,Y3 as ht,a5 as i,rK as ia,I4 as ii,TG as in,tu as io,e4 as ir,bG as it,k1 as j,L as ja,E$ as ji,K6 as jn,xs as jo,o2 as jr,O2 as jt,j1 as k,_b as ka,A8 as ki,U6 as kn,$s as ko,s0 as kr,E2 as kt,N8 as l,i3 as la,y8 as li,D0 as ln,Al as lo,X2 as lr,L0 as lt,n5 as m,jG as ma,i8 as mi,nK as mn,Hs as mo,d4 as mr,aK as mt,z8 as n,r8 as na,hJ as ni,u0 as nn,fl as no,t4 as nr,yG as nt,o5 as o,a3 as oa,$4 as oi,tK as on,El as oo,r4 as or,aJ as ot,t5 as p,h8 as pa,RJ as pi,F3 as pn,F as po,u4 as pr,ZG as pt,b4 as q,ru as qa,u3 as qi,Fq as qn,O as qo,j2 as qr,K1 as qt,B8 as r,mK as ra,t0 as ri,wG as rn,Dl as ro,$2 as rr,xG as rt,L8 as s,kG as sa,pJ as si,D$ as sn,Bl as so,v4 as sr,P1 as st,V8 as t,S2 as ta,gJ as ti,c0 as tn,Jl as to,n4 as tr,SG as tt,H8 as u,o1 as ua,b8 as ui,E0 as un,jl as uo,Z2 as ur,R0 as ut,$8 as v,xq as va,$Z as vi,U0 as vn,jc as vo,s4 as vr,q0 as vt,b0 as w,e3 as wa,m8 as wi,n0 as wn,P as wo,q2 as wr,GG as wt,l8 as x,r3 as xa,H3 as xi,mJ as xn,I as xo,x2 as xr,L1 as xt,s5 as y,Cq as ya,g6 as yi,V0 as yn,tc as yo,c4 as yr,J0 as yt,p3 as z,Sl as za,p1 as zi,g4 as zn,un as zo,T2 as zr,i0 as zt};
|
|
460
|
-
//# sourceMappingURL=server-lock-iLcBw_q0-
|
|
455
|
+
`)&&n.push(`trailing-newline`),n}const R3=`parse-equivalence`;function z3(e){return e.replace(/^\n+/,``).replace(/\n+$/,``)}function B3(e){return e.replace(/[ \t]+$/gm,``)}const V3=/^([ \t]*)\d+([.)])(?=[ \t])/;function H3(e){return e.split(`
|
|
456
|
+
`).map(e=>e.replace(V3,(e,t,n)=>`${t}1${n}`)).join(``).replace(/\s+/g,``)}const U3=new Set;function W3(e,t,n){let r=pK(e),i=pK(t);if(r.frontmatter!==i.frontmatter)return!1;if(r.body===i.body)return!0;let a;try{a=n(r.body)}catch(e){let t=e instanceof Error?e.message:String(e);return U3.size<8&&!U3.has(t)&&(U3.add(t),console.warn(`[parse-equivalence] canonicalizeBody threw; treating as not equivalent:`,t)),!1}return z3(B3(a))===z3(B3(i.body))?bJ(H3(r.body),H3(a)):!1}const G3={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},K3={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"jsx-container-boundary-blank":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`,"parse-equivalence":`parser-caused`};function q3(e){return K3[e]}function J3(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let Y3=null;function X3(e){Y3=e}function Z3(e,t,n,r){if(!Y3||e.length===0)return;let i=J3(t,n),a=new Date().toISOString();for(let t of e)Y3({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:q3(t)})}const Q3=1e4,$3=`last-spawn-error.log`,e6=/^[a-zA-Z0-9][\w/-]*$/;function t6(e){return e.startsWith(`#`)?e.slice(1):e}function n6(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function r6(e){if(!e||e.trim()===``)return[];let{map:t}=U4(e);if(!t)return[];let n=n6(t.tags),r=[];for(let e of n){let t=t6(e);e6.test(t)&&r.push(t)}return r}const i6=[`.ok`,`local`,`installed-skills.json`],a6=F(EG),o6=Zs({hosts:N(A()),scope:a6,scripts:M(),installedAt:Go()}),s6=Zs({schema:I(1),skills:ac(A(),o6).default({})});function c6(){return{schema:1,skills:{}}}function l6(e){let t;try{t=JSON.parse(e)}catch{return null}let n=s6.safeParse(t);return n.success?n.data:null}const u6={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},d6=new WeakMap;function f6(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function p6(e){return e.trim().toLowerCase()}const m6=/\.(?:md|mdx)$/;function h6(e,t){if(t!==`page`)return e;let n=e.replace(m6,``);return n.length>0?n:e}function g6(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function _6(e){let t=g6(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function v6(e){let t=CW({schema:u6});return e.length>0&&PW(t,e),t}function y6(e){let t={documents:e};return d6.set(t,v6(e)),t}function b6(e){let t=d6.get(e);if(t)return t;let n=v6(e.documents);return d6.set(e,n),n}function x6(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function S6(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function C6(e,t){let n=p6(t);if(!n)return 0;let r=h6(n,e.kind),i=p6(e.title),a=p6(e.name),o=p6(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function w6(e,t){let n=C6(e,t);return n<=0?n:Eq(e.path)?n*.5:n}function T6(e){return e===`file`?-60:0}function E6(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function D6(e,t,n,r){return e+t*20+n+T6(r)}function O6(e,t,n,r,i,a){return e===`relevance`?D6(t,n,r,i):E6(t,n,r,i,a)}function k6(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function A6(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function j6(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function M6(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function N6(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function P6(e,t){return p6(t).length<4?0:e===`full_text`?1:0}function F6(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function I6(e){let t=[],n=[],r=[];for(let i of e){let e=F6(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L6(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=I6(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function R6(e,t,n={}){let r=n.intent??`omnibar`,i=k6(r,n.ranking),a=f6(n.limit),o=new Set(n.scopes??x6(r)),s=e.documents.filter(e=>S6(e,o)),c=p6(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=uG(b6(e),{term:c,properties:M6(r),boost:N6(r),tolerance:P6(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>S6(e.document,o)).map(e=>[e.document.id,e.score])),d=j6(s),f=new Map;for(let e of s)w6(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)S6(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=A6(f.values(),u);return L6([...f.values()].map(t=>{let n=Math.max(0,w6(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:O6(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return L6(B6({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function z6(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function B6(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=A6(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,w6(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?O6(o,t,n,s,e.kind,m):D6(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=z6(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=z6(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function V6(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),H6(n)}function H6(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const U6=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),W6=globalThis;W6[U6]===void 0&&(W6[U6]=Ri());const G6=W6[U6],K6=[`.ok`,`skill-state.yml`],q6=[`claude-cowork`,`cli-hosts`],J6=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],Y6=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,X6=Zs({version:A().regex(Y6,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(G6,{description:`Recorded skill version for this target.`}),recordedAt:Go().register(G6,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:F(J6).register(G6,{description:`Install-source surface that recorded this entry.`}).optional()}),Z6=Zs({enabled:M().register(G6,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Go().register(G6,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),Q6=Zs({schema:I(1).register(G6,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Zs({"claude-cowork":X6.optional(),"cli-hosts":X6.optional()}).register(G6,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:ac(A(),Z6).register(G6,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});function $6(e,t){return e??t.installedOnDisk}function e8(){return{schema:1,targets:{}}}const t8=`template`;function n8(e){if(e.trim()===``)return{};let t;try{t=(0,Fc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function r8(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function i8(e){let{frontmatter:t,body:n}=pK(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:hK(t),markdown:n}}function a8(e){let t=e.split(`
|
|
457
|
+
`);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=n8(n.join(`
|
|
458
|
+
`))[t8];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
|
|
459
|
+
`).replace(/\n+$/,``)}}function o8(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=pK(t);if(n===``)return{identity:{},starterContent:t};let i=hK(n),a=a8(i);if(a)return{identity:a.identity,starterContent:r8(a.docFrontmatterText,r)};let{frontmatter:o}=pK(r);if(o!==``)return{identity:n8(i),starterContent:r};let s=n8(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:r8(i,r)}}function s8(e,t){let{docFrontmatterText:n,markdown:r}=i8(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Fc.stringify)({[t8]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function c8(e){return o8(e).starterContent}function l8(){let e=!1,t=``,n=0;return r=>{let i=u8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function u8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const d8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],f8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function p8(e,t=d8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const m8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function h8(e){return e?m8[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const g8={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function _8(e){let t=e?.trim();return t?g8[h8(t)]??t:`Agent`}function v8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const y8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function b8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function x8(e){let t=e.trim();return y8.test(t)||t.startsWith(`//`)}function S8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(x8(n))return{kind:`external`,url:n};let r=v8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=b8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function C8(e,t){let n=e.trim();if(!n)return null;if(x8(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=b8(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function w8(e,t){let n=e.trim();if(!n||y8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function T8(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function E8(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function D8(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function O8(e){return e.split(`/`).filter(e=>e!==``)}function k8(e,t){let n=D8(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function A8(e,t){let n=D8(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:O8(r).length}function j8(e,t){let n=O8(e),r=O8(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function M8(){let e=new Map;function t(t){let n=T8(t);if(n===``)return;let r=E8(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=T8(t),r=E8(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=D8(T8(n)),o=[],s=[];for(let e of i)k8(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=A8(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=A8(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=j8(a,D8(t));for(let r=1;r<e.length;r++){let i=e[r],o=j8(a,D8(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function N8(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function P8(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function F8(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function I8(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const L8=/^[A-Za-z0-9-]{8,64}$/;let R8=null;function z8(e){return l(e??m(),`.ok`,`machine-id`)}function B8(e){if(e===void 0&&R8!==null)return R8;let t=z8(e),n=null;try{let e=b(t,`utf-8`).trim();L8.test(e)&&(n=e)}catch{}if(n===null){n=w();try{v(c(t),{recursive:!0}),S(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(R8=n),n}function V8(){try{let e=u(c(f(import.meta.url)),`..`,`package.json`),t=JSON.parse(b(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const H8=V8(),U8=1;var W8=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function G8(e,t){return u(e,`${t}.lock`)}const K8=new Map;function q8(e){K8.set(e,(K8.get(e)??0)+1)}function J8(e){let t=K8.get(e);return t===void 0||t<=1?(K8.delete(e),!0):(K8.set(e,t-1),!1)}function Y8(e){return typeof e.machineId==`string`?e.machineId===B8():e.hostname===h()}const X8=new Set;let Z8=!1;function Q8(e){X8.add(e),!Z8&&(Z8=!0,process.on(`exit`,()=>{for(let e of X8)try{let t=JSON.parse(b(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==B8()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==h())continue;x(e)}catch{}}))}function $8(e,t){try{let n=JSON.parse(b(e,`utf-8`));return n&&typeof n==`object`&&I8(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function e5(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;v(n,{recursive:!0});let a=G8(n,t),o={pid:process.pid,hostname:h(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:B8(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??H8},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!_(a))try{let e=y(a,`wx`,384);try{C(e,s)}finally{g(e)}return q8(a),Q8(a),t5({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=$8(a,i);if(e){if(Y8(e)&&e.pid===process.pid)return S(a,s,{encoding:`utf-8`,mode:384}),q8(a),Q8(a),t5({lockName:t,lockDir:n,lockPath:a});if(F8(e.pid))throw new W8(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{x(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function t5(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>s5({lockName:t,lockDir:n}),updatePort:e=>n5({lockName:t,lockDir:n,port:e})}}function n5(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=G8(n,t);if(!_(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&Y8(o)){o.port=r;try{S(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function r5(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=G8(n,t);if((K8.get(i)??0)>1)return;let a;try{let e=JSON.parse(b(i,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&Y8(a)&&a.draining!==!0){a.draining=!0;try{S(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function i5(e){let{lockName:t,lockDir:n}=e,r=G8(n,t);if(!_(r))return null;let i;try{let e=JSON.parse(b(r,`utf-8`));if(!e||typeof e!=`object`||!I8(e.pid))return null;i=e}catch{return null}if(!Y8(i))return null;if(!F8(i.pid)){try{x(r)}catch{}return null}return i}function a5(e){let{lockName:t,lockDir:n}=e,r=G8(n,t);if(!_(r))return{status:`absent`};let i;try{i=JSON.parse(b(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!I8(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!Y8(o))return{status:`stale`,lock:o};if(!F8(o.pid)){try{x(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}async function o5(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>i5({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function s5(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=G8(n,t);if(J8(a)){if(r){r5({lockName:t,lockDir:n});return}if(_(a))try{let e=JSON.parse(b(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!Y8(e))return;x(a),X8.delete(a)}catch(e){console.warn(`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var c5=class extends W8{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function l5(e,t){try{return e5({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof W8&&e.lockName===`server`?new c5(e.existing,e.lockPath):e}}function u5(e,t){n5({lockName:`server`,lockDir:e,port:t})}function d5(e){return i5({lockName:`server`,lockDir:e})}function f5(e,t){s5({lockName:`server`,lockDir:e,...t})}function p5(e){r5({lockName:`server`,lockDir:e})}function m5(e,t){return o5({lockName:`server`,lockDir:e,...t})}export{hG as $,Ml as $a,U4 as $i,Hq as $n,D0 as $r,_0 as $t,h1 as A,wq as Aa,e8 as Ai,OG as An,ac as Ao,P0 as Ar,A2 as At,E1 as B,Cl as Ba,c8 as Bi,Z1 as Bn,si as Bo,t8 as Br,i6 as Bt,w1 as C,IG as Ca,_6 as Ci,uJ as Cn,rc as Co,f4 as Cr,U0 as Ct,A1 as D,r3 as Da,_8 as Di,n0 as Dn,P as Do,X2 as Dr,Y1 as Dt,g1 as E,P8 as Ea,J4 as Ei,Y0 as En,j as Eo,l4 as Er,KG as Et,V1 as F,uu as Fa,X$ as Fi,S2 as Fn,Go as Fo,u2 as Fr,u1 as Ft,j4 as G,Kc as Ga,DG as Gi,v2 as Gn,gn as Go,N2 as Gr,QG as Gt,N4 as H,Sl as Ha,p1 as Hi,y4 as Hn,un as Ho,O2 as Hr,x2 as Ht,B1 as I,qc as Ia,W$ as Ii,$3 as In,Uo as Io,d2 as Ir,JG as It,E4 as J,lu as Ja,Gq as Ji,lJ as Jn,Dt as Jo,F2 as Jr,r0 as Jt,O4 as K,Xc as Ka,eK as Ki,p2 as Kn,cn as Ko,R2 as Kr,HG as Kt,nJ as L,su as La,GY as Li,VG as Ln,ma as Lo,o2 as Lr,$1 as Lt,m1 as M,_b as Ma,N8 as Mi,K6 as Mn,$s as Mo,u0 as Mr,U1 as Mt,O1 as N,sp as Na,r6 as Ni,q6 as Nn,Ks as No,f2 as Nr,M1 as Nt,_1 as O,H$ as Oa,Z3 as Oi,e2 as On,dc as Oo,Z2 as Or,L0 as Ot,dJ as P,L as Pa,E$ as Pi,Y6 as Pn,xs as Po,l2 as Pr,N1 as Pt,vG as Q,Jc as Qa,d3 as Qi,zq as Qn,mt as Qo,E0 as Qr,m0 as Qt,i3 as R,Ol as Ra,_q as Ri,_G as Rn,Ka as Ro,s2 as Rr,e0 as Rt,WG as S,Cq as Sa,y6 as Si,W0 as Sn,tc as So,d4 as Sr,H0 as St,w0 as T,pK as Ta,L3 as Ti,J0 as Tn,Zs as To,c4 as Tr,YG as Tt,M4 as U,xl as Ua,Eq as Ui,m2 as Un,fn as Uo,E2 as Ur,N0 as Ut,k4 as V,wl as Va,qq as Vi,h4 as Vn,br as Vo,W2 as Vr,y2 as Vt,A4 as W,bl as Wa,eJ as Wi,h2 as Wn,mn as Wo,L2 as Wr,s6 as Wt,w4 as X,ru as Xa,p3 as Xi,Fq as Xn,O as Xo,P2 as Xr,a0 as Xt,T4 as Y,cu as Ya,BG as Yi,Mq as Yn,k as Yo,I2 as Yr,i0 as Yt,S4 as Z,Yc as Za,I3 as Zi,Bq as Zn,ht as Zo,O0 as Zr,y0 as Zt,f5 as _,jG as _a,s8 as _i,nK as _n,Hs as _o,m4 as _r,l0 as _t,e5 as a,o8 as aa,hJ as ai,p0 as an,fl as ao,i4 as ar,rJ as at,m5 as b,X3 as ba,l8 as bi,mG as bn,M as bo,C2 as br,R1 as bt,F8 as c,a1 as ca,R4 as ci,EG as cn,ml as co,K2 as cr,F1 as ct,r5 as d,Z4 as da,$q as di,M0 as dn,Ll as do,s4 as dr,R0 as dt,FG as ea,T0 as ei,v0 as en,zl as eo,Wq as er,CG as et,p5 as f,s3 as fa,S8 as fi,A0 as fn,Al as fo,$2 as fr,z0 as ft,s5 as g,v8 as ga,RJ as gi,R3 as gn,F as go,p4 as gr,UG as gt,d5 as h,$6 as ha,p8 as hi,o0 as hn,uc as ho,Y2 as hr,Q3 as ht,c5 as i,T2 as ia,gJ as ii,d0 as in,Jl as io,a4 as ir,bG as it,k1 as j,q4 as ja,V6 as ji,V2 as jn,A as jo,vJ as jr,j2 as jt,j1 as k,hK as ka,c6 as ki,t2 as kn,Pc as ko,q2 as kr,k2 as kt,I8 as l,c3 as la,n3 as li,tK as ln,El as lo,o4 as lr,B0 as lt,a5 as m,w8 as ma,gG as mi,$G as mn,Ls as mo,J2 as mr,aK as mt,H8 as n,RG as na,$0 as ni,g0 as nn,ou as no,sJ as nr,yG as nt,l5 as o,mK as oa,t0 as oi,wG as on,Dl as oo,n4 as or,aJ as ot,i5 as p,o1 as pa,C8 as pi,k0 as pn,jl as po,e4 as pr,ZG as pt,C4 as q,pl as qa,W3 as qi,v4 as qn,zt as qo,z2 as qr,K1 as qt,U8 as r,NG as ra,XG as ri,h0 as rn,Zl as ro,Q2 as rr,xG as rt,B8 as s,rK as sa,z4 as si,TG as sn,tu as so,r4 as sr,P1 as st,W8 as t,l6 as ta,Q0 as ti,_J as tn,Tl as to,oJ as tr,SG as tt,G8 as u,kG as ua,pJ as ui,D$ as un,Bl as uo,x4 as ur,V0 as ut,n5 as v,R6 as va,U2 as vi,iK as vn,Ws as vo,B2 as vr,X0 as vt,C0 as w,o3 as wa,G3 as wi,mJ as wn,I as wo,w2 as wr,GG as wt,f8 as x,xq as xa,$Z as xi,K0 as xn,jc as xo,u4 as xr,L1 as xt,u5 as y,W4 as ya,M8 as yi,qG as yn,N as yo,Q6 as yr,Z0 as yt,g3 as z,Zc as za,h8 as zi,X1 as zn,qa as zo,c2 as zr,s0 as zt};
|
|
460
|
+
//# sourceMappingURL=server-lock-iLcBw_q0-nWzkxbfg.mjs.map
|