@inkeep/open-knowledge 0.31.0-beta.6 → 0.31.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +11 -11
  4. package/dist/constants-B2EvNGWZ.mjs +2 -0
  5. package/dist/{dist-Pe1Q8dMj.mjs → dist-CynAX6cy.mjs} +4 -4
  6. package/dist/{dist-BYM_jxPa.mjs → dist-DiaxTJ69.mjs} +1 -1
  7. package/dist/{gh-detect-C6QZctcU.mjs → gh-detect-Uu4VAWnW.mjs} +2 -2
  8. package/dist/index.d.mts +9 -3
  9. package/dist/index.mjs +1 -1
  10. package/dist/init-1G9fj8cH.mjs +639 -0
  11. package/dist/init-MrbSP11w.mjs +1 -0
  12. package/dist/launch-json-removal-D3x1PYMJ.mjs +2 -0
  13. package/dist/loader-BvbWpeUk.mjs +1 -0
  14. package/dist/{loader-B7V7uIES.mjs → loader-DIcwzOTi.mjs} +2 -2
  15. package/dist/{open-browser-CPSoIF8R.mjs → open-browser-Lk0l8JF5.mjs} +2 -2
  16. package/dist/{preview-BBQwe-gv.mjs → preview-C9JeIyOB.mjs} +2 -2
  17. package/dist/preview-CZN7WKk2.mjs +1 -0
  18. package/dist/public/assets/ActivityModeContent-BbFXNuKx.js +2 -0
  19. package/dist/public/assets/CodeMirrorPropInput-CHf8Iz40.js +3 -0
  20. package/dist/public/assets/{ConsentDialogBody-DUEo7dzd.js → ConsentDialogBody-TGvdiCLr.js} +1 -1
  21. package/dist/public/assets/CopyButton-DoEsGDa4.js +1 -0
  22. package/dist/public/assets/DocumentContext-DG5n9u7B.js +36 -0
  23. package/dist/public/assets/{EnableSyncConfirmDialog-BRji_vuj.js → EnableSyncConfirmDialog-CJzmvuen.js} +1 -1
  24. package/dist/public/assets/{GraphPanel-cScfZ2Kh.js → GraphPanel-m-nt5HQn.js} +1 -1
  25. package/dist/public/assets/{ManagedArtifactProperties-_bcR56Re.js → ManagedArtifactProperties-BePO6ANU.js} +1 -1
  26. package/dist/public/assets/{McpConsentDialogBody-pimma18E.js → McpConsentDialogBody-arNbqqes.js} +1 -1
  27. package/dist/public/assets/{MermaidDocEditor-Bm909VrA.js → MermaidDocEditor-DoV9dGJN.js} +1 -1
  28. package/dist/public/assets/PropertyPanel-DUZsqzTw.js +2 -0
  29. package/dist/public/assets/ReportBugDialogBody-CJkfjKa2.js +2 -0
  30. package/dist/public/assets/SettingsDialogBody-BPlL1Yed.js +7 -0
  31. package/dist/public/assets/{ShareBranchSwitchDialog-nDcQbyjK.js → ShareBranchSwitchDialog-DSKoiVrF.js} +1 -1
  32. package/dist/public/assets/{ShareReceiveDialog-Bi91UHeB.js → ShareReceiveDialog-Bvh3tHuH.js} +1 -1
  33. package/dist/public/assets/{ShareReceiveMissDialog-Cr-lyfq3.js → ShareReceiveMissDialog-Bdk7y3ML.js} +1 -1
  34. package/dist/public/assets/{SkillEditorActions-COoshjEA.js → SkillEditorActions-oiOuAa4I.js} +1 -1
  35. package/dist/public/assets/{SourceEditor-CmecCLss.js → SourceEditor-Df_8kdW5.js} +1 -1
  36. package/dist/public/assets/{TerminalPanel-C8Yoxppo.js → TerminalPanel-Bd8Dtt_n.js} +1 -1
  37. package/dist/public/assets/{_baseFor-VECk3xZB.js → _baseFor-0d9AvFx1.js} +1 -1
  38. package/dist/public/assets/agent-presence-Dl0E_LN8.js +1 -0
  39. package/dist/public/assets/{arc-CxehPN-O.js → arc-BWLwkJ2r.js} +1 -1
  40. package/dist/public/assets/architecture-YZFGNWBL-9BNhGkdz.js +1 -0
  41. package/dist/public/assets/{architectureDiagram-Q4EWVU46-BP3qpyaD.js → architectureDiagram-Q4EWVU46-KXeh9itt.js} +1 -1
  42. package/dist/public/assets/{auth-state-cache-DewLLWl7.js → auth-state-cache-BSJEl4LS.js} +5 -5
  43. package/dist/public/assets/{blockDiagram-DXYQGD6D-B5TD8A38.js → blockDiagram-DXYQGD6D-DtrdFoMb.js} +1 -1
  44. package/dist/public/assets/{c4Diagram-AHTNJAMY-DXobwygF.js → c4Diagram-AHTNJAMY-fq1Z49Kc.js} +1 -1
  45. package/dist/public/assets/{calendar-DvL8Q5iT.js → calendar-B2qs7swV.js} +1 -1
  46. package/dist/public/assets/channel-CuMNseph.js +1 -0
  47. package/dist/public/assets/{checkbox-09LNjybZ.js → checkbox-CgcvT5md.js} +1 -1
  48. package/dist/public/assets/{chunk-2KRD3SAO-DDUdr-iX.js → chunk-2KRD3SAO-Bk_Wilkm.js} +1 -1
  49. package/dist/public/assets/{chunk-336JU56O-B_KFr_Bs.js → chunk-336JU56O-CL9kwjEg.js} +2 -2
  50. package/dist/public/assets/chunk-426QAEUC-pZbdhoaS.js +1 -0
  51. package/dist/public/assets/{chunk-4BX2VUAB-DRfG-ueY.js → chunk-4BX2VUAB-D96BT_Bg.js} +1 -1
  52. package/dist/public/assets/{chunk-4TB4RGXK-B0Gnlc8Z.js → chunk-4TB4RGXK-1ZoApeth.js} +1 -1
  53. package/dist/public/assets/chunk-55IACEB6-HEGApgMn.js +1 -0
  54. package/dist/public/assets/{chunk-5FUZZQ4R-CVl_7PAT.js → chunk-5FUZZQ4R-DPbA0GBM.js} +1 -1
  55. package/dist/public/assets/{chunk-5PVQY5BW-Cfkq4RiL.js → chunk-5PVQY5BW-CQS0U6F7.js} +1 -1
  56. package/dist/public/assets/{chunk-67CJDMHE-G9bUyIhz.js → chunk-67CJDMHE-okMxnkQT.js} +1 -1
  57. package/dist/public/assets/{chunk-7N4EOEYR-URuUKEXP.js → chunk-7N4EOEYR-Drske5an.js} +1 -1
  58. package/dist/public/assets/{chunk-AA7GKIK3-DRCEQeZY.js → chunk-AA7GKIK3-BlHxQeSp.js} +1 -1
  59. package/dist/public/assets/{chunk-BSJP7CBP-DGKfJILj.js → chunk-BSJP7CBP-BpNyv8Y4.js} +1 -1
  60. package/dist/public/assets/{chunk-CIAEETIT-C-4SSDk6.js → chunk-CIAEETIT-8deU_mkj.js} +1 -1
  61. package/dist/public/assets/{chunk-EDXVE4YY-B7GwVaSD.js → chunk-EDXVE4YY-VzPvg9KF.js} +1 -1
  62. package/dist/public/assets/{chunk-ENJZ2VHE-BaPHkOPd.js → chunk-ENJZ2VHE-BjhT8OeZ.js} +1 -1
  63. package/dist/public/assets/{chunk-FMBD7UC4-Sg4QfR2X.js → chunk-FMBD7UC4-CGtQ8v2r.js} +1 -1
  64. package/dist/public/assets/{chunk-FOC6F5B3-D76iMJUf.js → chunk-FOC6F5B3--YnpQUAX.js} +1 -1
  65. package/dist/public/assets/{chunk-ICPOFSXX-DlM8yc3o.js → chunk-ICPOFSXX-By9Q-6fm.js} +2 -2
  66. package/dist/public/assets/{chunk-K5T4RW27-o4pGUO6-.js → chunk-K5T4RW27-C_6VcMXC.js} +1 -1
  67. package/dist/public/assets/{chunk-KGLVRYIC-DlaCM317.js → chunk-KGLVRYIC-C3De9ry6.js} +1 -1
  68. package/dist/public/assets/{chunk-LIHQZDEY-wt2Qc-rg.js → chunk-LIHQZDEY-D4-GsYgm.js} +1 -1
  69. package/dist/public/assets/{chunk-ORNJ4GCN-BHgDQV41.js → chunk-ORNJ4GCN-qQUTfvQr.js} +1 -1
  70. package/dist/public/assets/{chunk-OYMX7WX6-BHQCcMht.js → chunk-OYMX7WX6-DAJTRr-n.js} +1 -1
  71. package/dist/public/assets/chunk-QZHKN3VN-DI8KBGbP.js +1 -0
  72. package/dist/public/assets/{chunk-U2HBQHQK-D4H3Zear.js → chunk-U2HBQHQK-Cp-6rjnO.js} +1 -1
  73. package/dist/public/assets/{chunk-X2U36JSP-ByMMuCmz.js → chunk-X2U36JSP-BFqfQNWU.js} +1 -1
  74. package/dist/public/assets/{chunk-XPW4576I-DGAGb6jI.js → chunk-XPW4576I-DI0-cfrS.js} +1 -1
  75. package/dist/public/assets/{chunk-YZCP3GAM-CLKcOka4.js → chunk-YZCP3GAM-sn7T8ho2.js} +1 -1
  76. package/dist/public/assets/{chunk-ZZ45TVLE-nqD2epOe.js → chunk-ZZ45TVLE-CxH2fGjk.js} +1 -1
  77. package/dist/public/assets/classDiagram-6PBFFD2Q-D98rNdcz.js +1 -0
  78. package/dist/public/assets/classDiagram-v2-HSJHXN6E-Cz77sXrt.js +1 -0
  79. package/dist/public/assets/clone-DXiEg0sZ.js +1 -0
  80. package/dist/public/assets/{config-provider-CPU__wB0.js → config-provider-CFiLGdZF.js} +1 -1
  81. package/dist/public/assets/copy-D8YVE0Jc.js +1 -0
  82. package/dist/public/assets/{cose-bilkent-S5V4N54A-B2yzzZk8.js → cose-bilkent-S5V4N54A-CXBsVXq9.js} +1 -1
  83. package/dist/public/assets/{cursor-CouJSC9c.js → cursor-BsJMggkz.js} +1 -1
  84. package/dist/public/assets/{dagre-BIgQuqiZ.js → dagre-C2Qb6hf2.js} +1 -1
  85. package/dist/public/assets/{dagre-KV5264BT-D7ZMiRem.js → dagre-KV5264BT-BQUJovtG.js} +1 -1
  86. package/dist/public/assets/{diagram-5BDNPKRD-BYEpe_ZJ.js → diagram-5BDNPKRD-C6tTTvBq.js} +1 -1
  87. package/dist/public/assets/{diagram-G4DWMVQ6-DxQlpGFr.js → diagram-G4DWMVQ6-Cq1-s9xc.js} +1 -1
  88. package/dist/public/assets/{diagram-MMDJMWI5-RJKi5ZMs.js → diagram-MMDJMWI5-BE-MhKN8.js} +1 -1
  89. package/dist/public/assets/{diagram-TYMM5635-Cbv6Q-Tj.js → diagram-TYMM5635-G0QPzMX4.js} +1 -1
  90. package/dist/public/assets/{dialog-CZK_GJbX.js → dialog-BvTRDNMV.js} +1 -1
  91. package/dist/public/assets/{dist-5OMiBr1O.js → dist-B0sSo1rx.js} +1 -1
  92. package/dist/public/assets/{dist-CK-u_yUG.js → dist-BI2wTleN.js} +1 -1
  93. package/dist/public/assets/{dist-DwvfOBE4.js → dist-BVRsG3b2.js} +3 -3
  94. package/dist/public/assets/{dist-C1stM53P.js → dist-C9Q20TxL.js} +1 -1
  95. package/dist/public/assets/{dist-Ctotkt8m.js → dist-CFvMrf5i.js} +1 -1
  96. package/dist/public/assets/{dist-DJzR_Ier.js → dist-CN2Ak373.js} +1 -1
  97. package/dist/public/assets/{dist-yzeYbK6D.js → dist-CPK5NxVp.js} +1 -1
  98. package/dist/public/assets/{dist-DJkVfTTW.js → dist-C_9BPzNE.js} +1 -1
  99. package/dist/public/assets/{dist-DwYhX11V.js → dist-CqC3taBS.js} +1 -1
  100. package/dist/public/assets/{dist-BJTNIx2m.js → dist-DSzqChbc.js} +1 -1
  101. package/dist/public/assets/{dist-CD524qWG.js → dist-DfkfQshV.js} +1 -1
  102. package/dist/public/assets/{dist-V49XHj-a.js → dist-LqTeaHS1.js} +1 -1
  103. package/dist/public/assets/dist-jyqE5kfZ.js +1 -0
  104. package/dist/public/assets/{dist-DIOoTUYz.js → dist-p4lElMBx.js} +1 -1
  105. package/dist/public/assets/{doc-hash-BtUMDwMU.js → doc-hash-CmkGIiUd.js} +1 -1
  106. package/dist/public/assets/{documents-events-DrrEYmNa.js → documents-events-CBqhEmHl.js} +1 -1
  107. package/dist/public/assets/{erDiagram-SMLLAGMA-BmMOegIt.js → erDiagram-SMLLAGMA-N7gNLe9o.js} +1 -1
  108. package/dist/public/assets/{file-tree-adapter-BiXhoQNr.js → file-tree-adapter-BRoSU5bE.js} +1 -1
  109. package/dist/public/assets/{flatten-CCmz8_dj.js → flatten-dENnAN6s.js} +1 -1
  110. package/dist/public/assets/{flowDiagram-DWJPFMVM-0LqPtkiA.js → flowDiagram-DWJPFMVM-DgclgNSr.js} +1 -1
  111. package/dist/public/assets/{ganttDiagram-T4ZO3ILL-DRsSWVHe.js → ganttDiagram-T4ZO3ILL-CAydivVh.js} +1 -1
  112. package/dist/public/assets/gitGraph-7Q5UKJZL-DuuJiYvS.js +1 -0
  113. package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-BdADm4E0.js → gitGraphDiagram-UUTBAWPF-Qfom5ijS.js} +1 -1
  114. package/dist/public/assets/{graphlib-Dg3M3E4b.js → graphlib-BZWt_BGf.js} +1 -1
  115. package/dist/public/assets/index-C3IDVWhb.css +1 -0
  116. package/dist/public/assets/index-FeSh48__.js +2003 -0
  117. package/dist/public/assets/info-OMHHGYJF-DmgDPzke.js +1 -0
  118. package/dist/public/assets/{infoDiagram-42DDH7IO-qvYhaJaR.js → infoDiagram-42DDH7IO-BLFTlht0.js} +1 -1
  119. package/dist/public/assets/{isEmpty-C5m2-RSe.js → isEmpty-Dg6Et8UD.js} +1 -1
  120. package/dist/public/assets/isSymbol-BhYgyzzO.js +1 -0
  121. package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-CcivmKPd.js → ishikawaDiagram-UXIWVN3A-C8gBLX8v.js} +1 -1
  122. package/dist/public/assets/{journeyDiagram-VCZTEJTY-ouWVthki.js → journeyDiagram-VCZTEJTY-DVV127Ia.js} +1 -1
  123. package/dist/public/assets/{kanban-definition-6JOO6SKY-ZhUMH8F2.js → kanban-definition-6JOO6SKY-Bi_LNUlw.js} +1 -1
  124. package/dist/public/assets/{keyboard-shortcuts-CH4qhzpw.js → keyboard-shortcuts-Dw2cvMMp.js} +1 -1
  125. package/dist/public/assets/{line-So0Nf7v2.js → line-CuRBOqmw.js} +1 -1
  126. package/dist/public/assets/{linear-7dqmcJYs.js → linear-BnfMN22g.js} +1 -1
  127. package/dist/public/assets/{mermaid-parser.core-gjoLdFzV.js → mermaid-parser.core-noqTIfNm.js} +2 -2
  128. package/dist/public/assets/{mermaid.core-DIaQcKcu.js → mermaid.core-DMKNygs1.js} +3 -3
  129. package/dist/public/assets/{mindmap-definition-QFDTVHPH-BpktrSi5.js → mindmap-definition-QFDTVHPH-DLIIn_h8.js} +1 -1
  130. package/dist/public/assets/{navigation-targets-C8x96muf.js → navigation-targets-G6yEVp6c.js} +1 -1
  131. package/dist/public/assets/{now-Dslec7Y8.js → now-esIbxJzw.js} +1 -1
  132. package/dist/public/assets/{open-managed-artifact-tab-C7sLBkCv.js → open-managed-artifact-tab-acLO8au6.js} +1 -1
  133. package/dist/public/assets/{ordinal-GH4e7Z1z.js → ordinal-DYUgOuL7.js} +1 -1
  134. package/dist/public/assets/packet-4T2RLAQJ-CVcq-ivT.js +1 -0
  135. package/dist/public/assets/{pending-receive-nav-store-D83rXcWH.js → pending-receive-nav-store-omPUhaeY.js} +1 -1
  136. package/dist/public/assets/pie-ZZUOXDRM-DSvYqp8t.js +1 -0
  137. package/dist/public/assets/{pieDiagram-DEJITSTG-BPZLf8gB.js → pieDiagram-DEJITSTG-C-vgeRar.js} +1 -1
  138. package/dist/public/assets/{project-paths-Bg2cu_Xr.js → project-paths-CqH22Xq0.js} +1 -1
  139. package/dist/public/assets/{prop-types-589M92VT.js → prop-types-6gA_YVnm.js} +1 -1
  140. package/dist/public/assets/{propagation-api-C0PBUfbG.js → propagation-api-M_AcuP6N.js} +1 -1
  141. package/dist/public/assets/{quadrantDiagram-34T5L4WZ-pdw_MogG.js → quadrantDiagram-34T5L4WZ-BmQcA7GQ.js} +1 -1
  142. package/dist/public/assets/radar-PYXPWWZC-BrGdIzLo.js +1 -0
  143. package/dist/public/assets/{radio-group-CkH5F_ZT.js → radio-group-DyHNJs2C.js} +1 -1
  144. package/dist/public/assets/{receive-store-DUmQ9Q7m.js → receive-store-CrJ3w3k0.js} +1 -1
  145. package/dist/public/assets/{reduce-CmXLDnl6.js → reduce-BKUJZ1TP.js} +1 -1
  146. package/dist/public/assets/{requirementDiagram-MS252O5E-BPFpj55s.js → requirementDiagram-MS252O5E-DPE-Czmf.js} +1 -1
  147. package/dist/public/assets/{sankeyDiagram-XADWPNL6-BlIkXMJT.js → sankeyDiagram-XADWPNL6-C6mEVWX1.js} +1 -1
  148. package/dist/public/assets/{selection-context-D_zj8y90.js → selection-context-8HFgCBJz.js} +1 -1
  149. package/dist/public/assets/{sequenceDiagram-FGHM5R23-DiHLgJYc.js → sequenceDiagram-FGHM5R23-rp9LrkhC.js} +1 -1
  150. package/dist/public/assets/skill-actions-D2r7iq9h.js +1 -0
  151. package/dist/public/assets/{skills-api-DULTMJrv.js → skills-api-DvU5qnRa.js} +1 -1
  152. package/dist/public/assets/{src-DReJgyBg.js → src-DldiksFQ.js} +1 -1
  153. package/dist/public/assets/{src-CqaRgyJX.js → src-sATQ-1TS.js} +1 -1
  154. package/dist/public/assets/{stateDiagram-FHFEXIEX-BvvfLH6H.js → stateDiagram-FHFEXIEX-4q5ruYzC.js} +1 -1
  155. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-9Y5TkQAw.js +1 -0
  156. package/dist/public/assets/{target-navigation-intent-BrbTHf_2.js → target-navigation-intent-DIz1qTBm.js} +1 -1
  157. package/dist/public/assets/{telemetry-impl-DkfWYdsZ.js → telemetry-impl-Cs0UMIR2.js} +2 -2
  158. package/dist/public/assets/telemetry-startup-BO7q-IdH.js +1 -0
  159. package/dist/public/assets/{timeline-definition-GMOUNBTQ-Cm-_wwCn.js → timeline-definition-GMOUNBTQ-CRtE2coR.js} +1 -1
  160. package/dist/public/assets/{toggle-group-B_aSxEq-.js → toggle-group-Hn7Etr9N.js} +1 -1
  161. package/dist/public/assets/{tooltip-DZYAkZo5.js → tooltip-tSMIHkKA.js} +1 -1
  162. package/dist/public/assets/treeView-SZITEDCU-C_aWaIS6.js +1 -0
  163. package/dist/public/assets/treemap-W4RFUUIX-CcQyutfG.js +1 -0
  164. package/dist/public/assets/{typing-burst-detector-BCt9a4xO.js → typing-burst-detector-DP8u_tQC.js} +1 -1
  165. package/dist/public/assets/{vennDiagram-DHZGUBPP-rndTcHCv.js → vennDiagram-DHZGUBPP-B5-arv9-.js} +1 -1
  166. package/dist/public/assets/wardley-RL74JXVD-B57ZwOFM.js +1 -0
  167. package/dist/public/assets/{wardleyDiagram-NUSXRM2D-D0g460BL.js → wardleyDiagram-NUSXRM2D-NXmNnKuY.js} +1 -1
  168. package/dist/public/assets/workspace-paths-Dj3MgOE7.js +1 -0
  169. package/dist/public/assets/{xychartDiagram-5P7HB3ND-DzjJ5eMr.js → xychartDiagram-5P7HB3ND-B_cLbDrg.js} +1 -1
  170. package/dist/public/index.html +79 -80
  171. package/dist/{repair-launch-json-Du0EU3Si.mjs → repair-launch-json-DzczMayl.mjs} +2 -2
  172. package/dist/repair-mcp-configs-Cp5VRehu.mjs +2 -0
  173. package/dist/repair-skills-B-9mVcmb.mjs +1 -0
  174. package/dist/{repair-skills-DuNm-kMp.mjs → repair-skills-XQg-rb3q.mjs} +2 -2
  175. package/dist/server-lock-GuuouVft-C6kYMpa7.mjs +1 -0
  176. package/dist/{server-lock-iLcBw_q0-nWzkxbfg.mjs → server-lock-iLcBw_q0-DddnIrHS.mjs} +2 -2
  177. package/dist/{src-B9TNCBdI.mjs → src-CZcBOOJs.mjs} +4 -4
  178. package/dist/start-DcvuVtnN.mjs +1 -0
  179. package/dist/{start-Dld0QqQ2.mjs → start-Ig8o-wfe.mjs} +2 -2
  180. package/dist/write-project-skill-DV1PSHkd.mjs +50 -0
  181. package/package.json +1 -1
  182. package/dist/constants-Ba7kuv_h.mjs +0 -2
  183. package/dist/init-CM8vkkIB.mjs +0 -1
  184. package/dist/init-CWVdQeQP.mjs +0 -653
  185. package/dist/launch-json-removal-TcMw8bt1.mjs +0 -2
  186. package/dist/loader-BktwkYhG.mjs +0 -1
  187. package/dist/preview-C317XX3v.mjs +0 -1
  188. package/dist/public/assets/ActivityModeContent-tdDE-61j.js +0 -2
  189. package/dist/public/assets/CodeMirrorPropInput-DNVWCpb0.js +0 -3
  190. package/dist/public/assets/DocumentContext-Dc9Bp6oO.js +0 -36
  191. package/dist/public/assets/PropertyPanel-CvVf4BX_.js +0 -2
  192. package/dist/public/assets/ReportBugDialogBody-C_Q3PS3L.js +0 -2
  193. package/dist/public/assets/SettingsDialogBody-DUbN9FMx.js +0 -7
  194. package/dist/public/assets/agent-presence-BgZw7jcH.js +0 -1
  195. package/dist/public/assets/architecture-YZFGNWBL-DsxJN6Kz.js +0 -1
  196. package/dist/public/assets/channel-DVu0OxhH.js +0 -1
  197. package/dist/public/assets/chunk-426QAEUC-RFGaT71Y.js +0 -1
  198. package/dist/public/assets/chunk-55IACEB6-DAOIsDKo.js +0 -1
  199. package/dist/public/assets/chunk-QZHKN3VN-BcpoMdLu.js +0 -1
  200. package/dist/public/assets/circle-alert-sOrK-E2e.js +0 -1
  201. package/dist/public/assets/classDiagram-6PBFFD2Q-MnKF6SyF.js +0 -1
  202. package/dist/public/assets/classDiagram-v2-HSJHXN6E-zCakvYeI.js +0 -1
  203. package/dist/public/assets/clone-C-i8X3vQ.js +0 -1
  204. package/dist/public/assets/dist-CCW5cnWo.js +0 -1
  205. package/dist/public/assets/dist-D-nYc0c5.js +0 -1
  206. package/dist/public/assets/file-text-et24uQST.js +0 -1
  207. package/dist/public/assets/gitGraph-7Q5UKJZL-D_-MQMqR.js +0 -1
  208. package/dist/public/assets/index-BDOi3sKE.js +0 -2003
  209. package/dist/public/assets/index-Bai-YKSb.css +0 -1
  210. package/dist/public/assets/info-OMHHGYJF-BszLPAsY.js +0 -1
  211. package/dist/public/assets/isSymbol-bbBleIZC.js +0 -1
  212. package/dist/public/assets/packet-4T2RLAQJ-Bv1Aae8C.js +0 -1
  213. package/dist/public/assets/pie-ZZUOXDRM-CWm6tOdZ.js +0 -1
  214. package/dist/public/assets/radar-PYXPWWZC-BnuozSTl.js +0 -1
  215. package/dist/public/assets/skill-actions-DbGgyPDT.js +0 -1
  216. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-Ddr1j6xz.js +0 -1
  217. package/dist/public/assets/telemetry-startup-B2tAiMsF.js +0 -1
  218. package/dist/public/assets/treeView-SZITEDCU-DKwVPz-3.js +0 -1
  219. package/dist/public/assets/treemap-W4RFUUIX-D4LXGVs_.js +0 -1
  220. package/dist/public/assets/wardley-RL74JXVD-BivuXjN1.js +0 -1
  221. package/dist/public/assets/workspace-paths-AsbfFKxa.js +0 -1
  222. package/dist/repair-mcp-configs-DCP-rfpP.mjs +0 -2
  223. package/dist/repair-skills-BDe9l22O.mjs +0 -1
  224. package/dist/server-lock-GuuouVft-CO_sPVNi.mjs +0 -1
  225. package/dist/start-rypz41-s.mjs +0 -1
  226. package/dist/write-project-skill-DyoxYjJB.mjs +0 -36
  227. /package/dist/public/assets/{ActivityPanelDiffView-BUS_IClA.js → ActivityPanelDiffView-B2UyxRqh.js} +0 -0
  228. /package/dist/public/assets/{__vite-browser-external-nMYNicjc.js → __vite-browser-external-DWP-nnLG.js} +0 -0
  229. /package/dist/public/assets/{array-DA62ss4d.js → array-DCThpSXQ.js} +0 -0
  230. /package/dist/public/assets/{arrow-up-right-Vg7lRNno.js → arrow-up-right-Bj9cWgcz.js} +0 -0
  231. /package/dist/public/assets/{check-CBLIjSIa.js → check-nyYgwOgK.js} +0 -0
  232. /package/dist/public/assets/{chevron-down-D2qF2W9D.js → chevron-down-B4gqqe-h.js} +0 -0
  233. /package/dist/public/assets/{chevron-left-SSPDkqEW.js → chevron-left-aRnXScdx.js} +0 -0
  234. /package/dist/public/assets/{chevron-right-C6588edp.js → chevron-right-DjreZbLo.js} +0 -0
  235. /package/dist/public/assets/{clike-f5rGWX5o.js → clike-DBPhSRc7.js} +0 -0
  236. /package/dist/public/assets/{clipboard-adapter-BscVzpz1.js → clipboard-adapter-BYqGVFAr.js} +0 -0
  237. /package/dist/public/assets/{colors-BtJnRWTu.js → colors-BWTxgr-H.js} +0 -0
  238. /package/dist/public/assets/{config-context-GBTLA0Td.js → config-context-B9tR3DuQ.js} +0 -0
  239. /package/dist/public/assets/{cytoscape.esm-DAexRXdS.js → cytoscape.esm-DI3FlJaw.js} +0 -0
  240. /package/dist/public/assets/{defaultLocale-DjcXuYt0.js → defaultLocale-CRhqsANo.js} +0 -0
  241. /package/dist/public/assets/{desktop-bridge-types-DUvVV0tT.js → desktop-bridge-types-BTzWYfK3.js} +0 -0
  242. /package/dist/public/assets/{diff-C6rPA7NX.js → diff-Drz_kYcR.js} +0 -0
  243. /package/dist/public/assets/{dist-K3kyyBcW.js → dist-B0Ibo2lT.js} +0 -0
  244. /package/dist/public/assets/{dist-DlBs2Z86.js → dist-BR1KZiCX.js} +0 -0
  245. /package/dist/public/assets/{dist-Bvqpz5aH.js → dist-BRGTi0a4.js} +0 -0
  246. /package/dist/public/assets/{dist-QYTl87xy.js → dist-URshSBRl.js} +0 -0
  247. /package/dist/public/assets/{documents-fetch-D9Azkuau.js → documents-fetch-B7M_d64D.js} +0 -0
  248. /package/dist/public/assets/{external-link-PPmVWR7S.js → external-link-Ds9yTh4D.js} +0 -0
  249. /package/dist/public/assets/{file-tree-rename-validation-DEJ31Vcw.js → file-tree-rename-validation-DcXYaYEd.js} +0 -0
  250. /package/dist/public/assets/{folder-open-BO3O3WRb.js → folder-open-DVXRBalt.js} +0 -0
  251. /package/dist/public/assets/{format-ReH7V0UD.js → format-Dfi8-r7-.js} +0 -0
  252. /package/dist/public/assets/{git-branch-Bb5seqP3.js → git-branch-BfSSsaKF.js} +0 -0
  253. /package/dist/public/assets/{go-BDL-nvej.js → go-BpmSPnTF.js} +0 -0
  254. /package/dist/public/assets/{info-p7xnknfW.js → info-DsmJgZ0m.js} +0 -0
  255. /package/dist/public/assets/{init-BcRdj30F.js → init-Do59aTWs.js} +0 -0
  256. /package/dist/public/assets/{input-DBQZgTXT.js → input-tBscWWrn.js} +0 -0
  257. /package/dist/public/assets/{isObjectLike-p4oxO3k2.js → isObjectLike-DBZB8Di0.js} +0 -0
  258. /package/dist/public/assets/{katex-lkho_UhZ.js → katex-C_q0VtM5.js} +0 -0
  259. /package/dist/public/assets/{label-BpH34DoN.js → label-DmfuSB7r.js} +0 -0
  260. /package/dist/public/assets/{loader-circle-Cu01Ckhe.js → loader-circle-IFoG3v_v.js} +0 -0
  261. /package/dist/public/assets/{lua-DazQKUZ0.js → lua-C_zL8YdL.js} +0 -0
  262. /package/dist/public/assets/{mcp-consent-store-3q0L29vA.js → mcp-consent-store-Q4I4TJ6C.js} +0 -0
  263. /package/dist/public/assets/{min-BBkt5AXx.js → min-CHYmOP54.js} +0 -0
  264. /package/dist/public/assets/{miss-dialog-store-DxVemLe3.js → miss-dialog-store-E61ZbtU3.js} +0 -0
  265. /package/dist/public/assets/{panzoom.es-CuUBMiI5.js → panzoom.es-IG_ffrHS.js} +0 -0
  266. /package/dist/public/assets/{parse-api-error-D_SUnYAN.js → parse-api-error-CKwNHPHP.js} +0 -0
  267. /package/dist/public/assets/{path-DO8zQ-Ae.js → path-BumxrnWh.js} +0 -0
  268. /package/dist/public/assets/{pdf-CbXPrrUD.js → pdf-Dfrvv9Dp.js} +0 -0
  269. /package/dist/public/assets/{pdf.worker-XGhSae8l.js → pdf.worker-BW4O2Ok7.js} +0 -0
  270. /package/dist/public/assets/{perl-BaZItvTQ.js → perl-CBgKNlH2.js} +0 -0
  271. /package/dist/public/assets/{properties-CuaVqlKt.js → properties-CYWLEd9P.js} +0 -0
  272. /package/dist/public/assets/{r-IUsFwQdS.js → r-C7V19TwF.js} +0 -0
  273. /package/dist/public/assets/{refresh-cw-C9i-ShKk.js → refresh-cw-C6wj273J.js} +0 -0
  274. /package/dist/public/assets/{rough.esm-DWDlLNAi.js → rough.esm-DGd9yuC8.js} +0 -0
  275. /package/dist/public/assets/{ruby-BWibniew.js → ruby-XhXUlf0J.js} +0 -0
  276. /package/dist/public/assets/{share-metadata-rows-VY-5eTfA.js → share-metadata-rows-C9T0cDSG.js} +0 -0
  277. /package/dist/public/assets/{shell-DUveK2Hb.js → shell-CGj6v8kb.js} +0 -0
  278. /package/dist/public/assets/{sql-C6MOB-cH.js → sql-CLlqBctF.js} +0 -0
  279. /package/dist/public/assets/{src-C1bTuxCq.js → src-DHCu-mNI.js} +0 -0
  280. /package/dist/public/assets/{startup-marks-DdXX18dm.js → startup-marks-DkfPsa68.js} +0 -0
  281. /package/dist/public/assets/{stex-C0Jw9RbH.js → stex-Bt71ugp5.js} +0 -0
  282. /package/dist/public/assets/{swift-BD9rjiqY.js → swift-C_3ADj_i.js} +0 -0
  283. /package/dist/public/assets/{textarea-BBYgAifm.js → textarea-IugbKaIV.js} +0 -0
  284. /package/dist/public/assets/{toml-25JKpH7B.js → toml-DohB9k6t.js} +0 -0
  285. /package/dist/public/assets/{trace-api-DN18ByDo.js → trace-api-BIWqyPc9.js} +0 -0
  286. /package/dist/public/assets/{trash-2-410fw8eF.js → trash-2-DuQrfywu.js} +0 -0
  287. /package/dist/public/assets/{triangle-alert-Bo8gNh02.js → triangle-alert-CX4BgEzP.js} +0 -0
  288. /package/dist/public/assets/{w3c-keyname-VSld09PZ.js → w3c-keyname-CRPBoZED.js} +0 -0
  289. /package/dist/public/assets/{worktree-store-CLuGV1SL.js → worktree-store-DfQ15jw3.js} +0 -0
  290. /package/dist/public/assets/{x-BIoRq4ww.js → x-Bcc1k6VU.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{r as e}from"./chunk-CFjPhJqf.js";import{A as t,At as n,Dt as r,Et as i,F as a,G as o,H as s,K as c,L as l,O as u,P as d,R as f,T as p,U as m,V as h,Vt as g,X as ee,a as _,b as te,i as ne,o as v,p as re,q as ie,s as ae,ut as oe,x as se}from"./dist-V49XHj-a.js";import{n as ce,r as le}from"./dist-DJkVfTTW.js";import{t as ue}from"./dist-DJzR_Ier.js";var de=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.hashProp=[[h.contextHash,r]]}addChild(e,t){e.prop(h.contextHash)!=this.hash&&(e=new c(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new c(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new c(m.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return x(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function me(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=y.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var he={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(R(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:me,[y.BulletList]:me,[y.Document](){return!0}};function b(e){return e==32||e==9||e==10||e==13}function x(e,t=0){for(;t<e.length&&b(e.charCodeAt(t));)t++;return t}function S(e,t,n){for(;t>n&&b(e.charCodeAt(t-1));)t--;return t}function ge(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function _e(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!b(n))return-1}return n&&e.next==45&&be(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Te.SetextHeading)>-1||r<3?-1:1}function ve(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||b(e.text.charCodeAt(e.pos+1)))&&(!n||ve(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!b(e.text.charCodeAt(r+1))||n&&!ve(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ye(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function be(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&b(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,xe=/-->/,Se=/\?>/,D=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,xe],[/^\s*<\?/,Se],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function O(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function k(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function A(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(R(y.CodeText,t,n))}var j={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(A(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){A(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?A(o,e.from,e.to):o.push(e);s=[]}A(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&A(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=ge(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=S(t.text,t.text.length,o),c=[R(y.CodeMark,r,r+a)];o<s&&c.push(R(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&A(c,e.lineStart-1,e.lineStart),c.push(R(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(A(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(A(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=_e(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=k(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=k(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ye(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=S(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!b(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=O(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==xe?y.CommentBlock:i==Se?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},Ce=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
1
+ import{r as e}from"./chunk-CFjPhJqf.js";import{A as t,At as n,Dt as r,Et as i,F as a,G as o,H as s,K as c,L as l,O as u,P as d,R as f,T as p,U as m,V as h,Vt as g,X as ee,a as _,b as te,i as ne,o as v,p as re,q as ie,s as ae,ut as oe,x as se}from"./dist-LqTeaHS1.js";import{n as ce,r as le}from"./dist-C_9BPzNE.js";import{t as ue}from"./dist-CN2Ak373.js";var de=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.hashProp=[[h.contextHash,r]]}addChild(e,t){e.prop(h.contextHash)!=this.hash&&(e=new c(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new c(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new c(m.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return x(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function me(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=y.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var he={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(R(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:me,[y.BulletList]:me,[y.Document](){return!0}};function b(e){return e==32||e==9||e==10||e==13}function x(e,t=0){for(;t<e.length&&b(e.charCodeAt(t));)t++;return t}function S(e,t,n){for(;t>n&&b(e.charCodeAt(t-1));)t--;return t}function ge(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function _e(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!b(n))return-1}return n&&e.next==45&&be(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Te.SetextHeading)>-1||r<3?-1:1}function ve(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||b(e.text.charCodeAt(e.pos+1)))&&(!n||ve(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!b(e.text.charCodeAt(r+1))||n&&!ve(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ye(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function be(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&b(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,xe=/-->/,Se=/\?>/,D=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,xe],[/^\s*<\?/,Se],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function O(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function k(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function A(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(R(y.CodeText,t,n))}var j={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(A(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){A(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?A(o,e.from,e.to):o.push(e);s=[]}A(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&A(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=ge(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=S(t.text,t.text.length,o),c=[R(y.CodeMark,r,r+a)];o<s&&c.push(R(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&A(c,e.lineStart-1,e.lineStart),c.push(R(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(A(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(A(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=_e(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=k(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=k(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ye(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=S(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!b(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=O(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==xe?y.CommentBlock:i==Se?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},Ce=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
2
2
  `+t.scrub(),i=this.advance(r);return i>-1&&i<r.length?this.complete(e,n,i):!1}finish(e,t){return(this.stage==2||this.stage==3)&&x(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,R(y.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(Be(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(R(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Re(e,x(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=x(e,this.pos),n=0;if(t>this.pos){let r=ze(e,t,this.start);if(r){let t=M(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=M(e,this.pos),n>0&&n<e.length?n:-1}else return M(e,this.pos)}};function M(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!b(n))return-1}return t}var we=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:be(t),i=t.next;if(r<0)return!1;let a=R(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,R(i==61?y.SetextHeading1:y.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},Te={LinkReference(e,t){return t.content.charCodeAt(0)==91?new Ce(t):null},SetextHeading(){return new we}},Ee=[(e,t)=>ye(t)>=0,(e,t)=>ge(t)>=0,(e,t)=>_e(t)>=0,(e,t)=>w(t,e,!0)>=0,(e,t)=>T(t,e,!0)>=0,(e,t)=>C(t,e,!0)>=0,(e,t)=>O(t,e,!0)>=0],De={text:``,end:0},Oe=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new pe,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=de.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new He(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}let t=new fe(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
3
3
  `+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=Ue(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=De;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+y[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
4
4
  `?``:t;else{let e=t.indexOf(`
@@ -1,4 +1,4 @@
1
- import{o as e,r as t,t as n}from"./chunk-CFjPhJqf.js";import{n as r,t as i}from"./trace-api-DN18ByDo.js";import{n as a,t as o}from"./w3c-keyname-VSld09PZ.js";var s=Symbol.for(`yaml.alias`),c=Symbol.for(`yaml.document`),l=Symbol.for(`yaml.map`),u=Symbol.for(`yaml.pair`),d=Symbol.for(`yaml.scalar`),f=Symbol.for(`yaml.seq`),p=Symbol.for(`yaml.node.type`),m=e=>!!e&&typeof e==`object`&&e[p]===s,h=e=>!!e&&typeof e==`object`&&e[p]===c,g=e=>!!e&&typeof e==`object`&&e[p]===l,_=e=>!!e&&typeof e==`object`&&e[p]===u,v=e=>!!e&&typeof e==`object`&&e[p]===d,y=e=>!!e&&typeof e==`object`&&e[p]===f;function b(e){if(e&&typeof e==`object`)switch(e[p]){case l:case f:return!0}return!1}function x(e){if(e&&typeof e==`object`)switch(e[p]){case s:case l:case d:case f:return!0}return!1}var S=e=>(v(e)||b(e))&&!!e.anchor,C=Symbol(`break visit`),ee=Symbol(`skip children`),w=Symbol(`remove node`);function T(e,t){let n=ie(t);h(e)?te(null,e.contents,n,Object.freeze([e]))===w&&(e.contents=null):te(null,e,n,Object.freeze([]))}T.BREAK=C,T.SKIP=ee,T.REMOVE=w;function te(e,t,n,r){let i=ae(e,t,n,r);if(x(i)||_(i))return oe(e,r,i),te(e,i,n,r);if(typeof i!=`symbol`){if(b(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=te(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===C)return C;else i===w&&(t.items.splice(e,1),--e)}}else if(_(t)){r=Object.freeze(r.concat(t));let e=te(`key`,t.key,n,r);if(e===C)return C;e===w&&(t.key=null);let i=te(`value`,t.value,n,r);if(i===C)return C;i===w&&(t.value=null)}}return i}async function ne(e,t){let n=ie(t);h(e)?await re(null,e.contents,n,Object.freeze([e]))===w&&(e.contents=null):await re(null,e,n,Object.freeze([]))}ne.BREAK=C,ne.SKIP=ee,ne.REMOVE=w;async function re(e,t,n,r){let i=await ae(e,t,n,r);if(x(i)||_(i))return oe(e,r,i),re(e,i,n,r);if(typeof i!=`symbol`){if(b(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await re(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===C)return C;else i===w&&(t.items.splice(e,1),--e)}}else if(_(t)){r=Object.freeze(r.concat(t));let e=await re(`key`,t.key,n,r);if(e===C)return C;e===w&&(t.key=null);let i=await re(`value`,t.value,n,r);if(i===C)return C;i===w&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(g(t))return n.Map?.(e,t,r);if(y(t))return n.Seq?.(e,t,r);if(_(t))return n.Pair?.(e,t,r);if(v(t))return n.Scalar?.(e,t,r);if(m(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(b(r))r.items[e]=n;else if(_(r))e===`key`?r.key=n:r.value=n;else if(h(r))r.contents=n;else{let e=m(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var se={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ce=e=>e.replace(/[!,[\]{}]/g,e=>se[e]),le=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ce(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&x(e.contents)){let t={};T(e.contents,(e,n)=>{x(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
1
+ import{o as e,r as t,t as n}from"./chunk-CFjPhJqf.js";import{n as r,t as i}from"./trace-api-BIWqyPc9.js";import{n as a,t as o}from"./w3c-keyname-CRPBoZED.js";var s=Symbol.for(`yaml.alias`),c=Symbol.for(`yaml.document`),l=Symbol.for(`yaml.map`),u=Symbol.for(`yaml.pair`),d=Symbol.for(`yaml.scalar`),f=Symbol.for(`yaml.seq`),p=Symbol.for(`yaml.node.type`),m=e=>!!e&&typeof e==`object`&&e[p]===s,h=e=>!!e&&typeof e==`object`&&e[p]===c,g=e=>!!e&&typeof e==`object`&&e[p]===l,_=e=>!!e&&typeof e==`object`&&e[p]===u,v=e=>!!e&&typeof e==`object`&&e[p]===d,y=e=>!!e&&typeof e==`object`&&e[p]===f;function b(e){if(e&&typeof e==`object`)switch(e[p]){case l:case f:return!0}return!1}function x(e){if(e&&typeof e==`object`)switch(e[p]){case s:case l:case d:case f:return!0}return!1}var S=e=>(v(e)||b(e))&&!!e.anchor,C=Symbol(`break visit`),ee=Symbol(`skip children`),w=Symbol(`remove node`);function T(e,t){let n=ie(t);h(e)?te(null,e.contents,n,Object.freeze([e]))===w&&(e.contents=null):te(null,e,n,Object.freeze([]))}T.BREAK=C,T.SKIP=ee,T.REMOVE=w;function te(e,t,n,r){let i=ae(e,t,n,r);if(x(i)||_(i))return oe(e,r,i),te(e,i,n,r);if(typeof i!=`symbol`){if(b(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=te(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===C)return C;else i===w&&(t.items.splice(e,1),--e)}}else if(_(t)){r=Object.freeze(r.concat(t));let e=te(`key`,t.key,n,r);if(e===C)return C;e===w&&(t.key=null);let i=te(`value`,t.value,n,r);if(i===C)return C;i===w&&(t.value=null)}}return i}async function ne(e,t){let n=ie(t);h(e)?await re(null,e.contents,n,Object.freeze([e]))===w&&(e.contents=null):await re(null,e,n,Object.freeze([]))}ne.BREAK=C,ne.SKIP=ee,ne.REMOVE=w;async function re(e,t,n,r){let i=await ae(e,t,n,r);if(x(i)||_(i))return oe(e,r,i),re(e,i,n,r);if(typeof i!=`symbol`){if(b(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await re(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===C)return C;else i===w&&(t.items.splice(e,1),--e)}}else if(_(t)){r=Object.freeze(r.concat(t));let e=await re(`key`,t.key,n,r);if(e===C)return C;e===w&&(t.key=null);let i=await re(`value`,t.value,n,r);if(i===C)return C;i===w&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(g(t))return n.Map?.(e,t,r);if(y(t))return n.Seq?.(e,t,r);if(_(t))return n.Pair?.(e,t,r);if(v(t))return n.Scalar?.(e,t,r);if(m(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(b(r))r.items[e]=n;else if(_(r))e===`key`?r.key=n:r.value=n;else if(h(r))r.contents=n;else{let e=m(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var se={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ce=e=>e.replace(/[!,[\]{}]/g,e=>se[e]),le=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ce(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&x(e.contents)){let t={};T(e.contents,(e,n)=>{x(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
2
2
  `)}};le.defaultYaml={explicit:!1,version:`1.2`},le.defaultTags={"!!":`tag:yaml.org,2002:`};function ue(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function de(e){let t=new Set;return T(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function fe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function pe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=de(e);let a=fe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(v(t.node)||b(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function me(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=me(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=me(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=me(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=me(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function he(e,t,n){if(Array.isArray(e))return e.map((e,t)=>he(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!S(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ge=class{constructor(e){Object.defineProperty(this,p,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!h(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=he(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?me(i,{"":o},``,o):o}},_e=class extends ge{constructor(e){super(s),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],T(e,{Node:(e,t)=>{(m(t)||S(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(he(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ve(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ue(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ve(e,t,n){if(m(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(b(t)){let r=0;for(let i of t.items){let t=ve(e,i,n);t>r&&(r=t)}return r}else if(_(t)){let r=ve(e,t.key,n),i=ve(e,t.value,n);return Math.max(r,i)}return 1}var ye=e=>!e||typeof e!=`function`&&typeof e!=`object`,E=class extends ge{constructor(e){super(d),this.value=e}toJSON(e,t){return t?.keep?this.value:he(this.value,e,t)}toString(){return String(this.value)}};E.BLOCK_FOLDED=`BLOCK_FOLDED`,E.BLOCK_LITERAL=`BLOCK_LITERAL`,E.PLAIN=`PLAIN`,E.QUOTE_DOUBLE=`QUOTE_DOUBLE`,E.QUOTE_SINGLE=`QUOTE_SINGLE`;var be=`tag:yaml.org,2002:`;function xe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Se(e,t,n){if(h(e)&&(e=e.contents),x(e))return e;if(_(e)){let t=n.schema[l].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new _e(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=be+t.slice(2));let u=xe(e,t,o.tags);if(!u){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new E(e);return c&&(c.node=t),t}u=e instanceof Map?o[l]:Symbol.iterator in Object(e)?o[f]:o[l]}a&&(a(u),delete n.onTagObj);let d=u?.createNode?u.createNode(n.schema,e,n):typeof u?.nodeClass?.from==`function`?u.nodeClass.from(n.schema,e,n):new E(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function Ce(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Se(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var we=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Te=class extends ge{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>x(t)||_(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(we(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(b(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ce(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(b(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&v(i)?i.value:i:b(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!_(t))return!1;let n=t.value;return n==null||e&&v(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return b(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(b(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ce(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ee=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function De(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Oe=(e,t,n)=>e.endsWith(`
3
3
  `)?De(n,t):n.includes(`
4
4
  `)?`
@@ -380,7 +380,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
380
380
  `,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
381
381
  Please provide a chat model before proceeding with creating an answer session.
382
382
  Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
383
- `,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function pY(e,...t){let n=Error(WJ(fY[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function mY(e){return{raw:Number(e),formatted:JJ(e)}}function hY(e){if(e.id){if(typeof e.id!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return XJ()}function gY(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(bY(r)){let e=CY(r);if(!Array.isArray(t)||t.length!==e)throw pY(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(xY(r)){if(!Array.isArray(t))return n;let e=SY(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=gY(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var _Y={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},vY={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function yY(e){return e===`geopoint`}function bY(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function xY(e){return typeof e==`string`&&_Y[e]}function SY(e){return vY[e]}function CY(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw pY(`INVALID_VECTOR_VALUE`,e);case t<=0:throw pY(`INVALID_VECTOR_SIZE`,e);default:return t}}function wY(){return{idToInternalId:new Map,internalIdToId:[],save:TY,load:EY}}function TY(e){return{internalIdToId:e.internalIdToId}}function EY(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function DY(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?DY(e,t.toString()):t}function OY(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function kY(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function AY(e,t){let n=DY(e.sharedInternalDocumentStore,t);return e.docs[n]}function jY(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=DY(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function MY(e){return e.docs}function NY(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function PY(e,t){let n=DY(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function FY(e){return e.count}function IY(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function LY(e){return{docs:e.docs,count:e.count}}function RY(){return{create:kY,get:AY,getMultiple:jY,getAll:MY,store:NY,remove:PY,count:FY,load:IY,save:LY}}var zY=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function BY(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),pY(`PLUGIN_CRASHED`)}return n}var VY=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],HY=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function UY(e,t,n,r){if(e.some(aY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function WY(e,t,n){if(e.some(aY))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function GY(e,t,n,r,i){if(e.some(aY))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function KY(e,t,n,r){if(e.some(aY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function qY(e,t){if(e.some(aY))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var JY=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},YY=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new JY(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?JY.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new JY(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new JY(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new JY(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},XY=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function ZY(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function QY(e,t,n){let r=ZY(e,t,n);return{distance:r,isBounded:r>=0}}var $Y=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(ZJ(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&QY(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(ZJ(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&(QY(e,n,r).isBounded&&(i[n]=[]),ZJ(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},eX=class e extends $Y{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,$Y.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},tX=2,nX=6371e3,rX=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},iX=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new rX(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%tX===0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=rX.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return nX*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let ee=S*(n*n-i*i)/(i*i),w=1+ee/16384*(4096+ee*(-768+ee*(320-175*ee))),T=ee/1024*(256+ee*(-128+ee*(74-47*ee))),te=T*v*(C+T/4*(y*(-1+2*C*C)-T/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*w*(b-te)}},aX=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function oX(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var sX=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=cX(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),lX(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function cX(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function lX(e,t,n,r,i){let a=cX(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function uX(e,t,n,r,i){let a=DY(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function dX(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=DY(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function fX(e,t,n,r){let i=DY(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function pX(e,t,n){e.tokenOccurrences[t][n]--}function mX(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){mX(e,t,o,r,n);continue}if(bY(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new sX(CY(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new aX,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new YY(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new eX,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new XY,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new iX,isArray:e};break;default:throw pY(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function hX(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function gX(e,t,n,r,i,a,o,s,c,l,u){if(bY(o))return _X(t,n,a,r,i);let d=hX(e,t,n,i,s,c,l,u);if(!xY(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function _X(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function vX(e,t,n,r,i,a,o,s,c,l){if(bY(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function yX(e,t,n,r,i,a,o,s,c,l){if(!xY(o))return vX(e,t,n,r,i,a,o,s,c,l);let u=SY(o),d=a,f=d.length;for(let a=0;a<f;a++)vX(e,t,n,r,i,d[a],u,s,c,l);return!0}function bX(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=oX(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function xX(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw pY(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw pY(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];bX(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function SX(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:sY(...i.map(n=>SX(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>SX(e,t,n,r)).reduce((e,t)=>lY(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return uY(a,SX(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw pY(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=lY(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=rY(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=OX(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=OX(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=MX(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw pY(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=lY(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw pY(`INVALID_FILTER_OPERATION`,e)}a[o]=lY(a[o],n)}}return sY(...Object.values(a))}function CX(e){return e.searchableProperties}function wX(e){return e.searchablePropertiesWithTypes}function TX(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:eX.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:XY.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:YY.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:iX.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:aX.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:sX.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function EX(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function DX(){return{create:mX,insert:gX,remove:yX,insertDocumentScoreParameters:uX,insertTokenScoreParameters:dX,removeDocumentScoreParameters:fX,removeTokenScoreParameters:pX,calculateResultScores:bX,search:xX,searchByWhereClause:SX,getSearchableProperties:CX,getSearchablePropertiesWithTypes:wX,load:TX,save:EX}}function OX(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function kX(e,t,n=!1){let r=n?iX.vincentyDistance:iX.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function AX(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function jX(e,t){let n=e,r=AX(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=rY(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),kX(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=iX.calculatePolygonCentroid(e);return kX(s,r,n)}return null}function MX(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function NX(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=NX(e,t,s,r,n);UJ(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!bY(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw pY(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function PX(e,t,n,r){return r?.enabled===!1?{disabled:!0}:NX(e,t,n,(r||{}).unsortableProperties||[],``)}function FX(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=DY(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&HX(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function IX(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)BX(e,n);e.isSorted=!0}function LX(e,t,n){return t[1].localeCompare(n[1],IJ(e))}function RX(e,t){return e[1]-t[1]}function zX(e,t){return t[1]?-1:1}function BX(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=LX.bind(null,e.language);break;case`number`:r=RX.bind(null);break;case`boolean`:r=zX.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function VX(e){let t=Object.keys(e.sorts);for(let n of t)HX(e,n)}function HX(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function UX(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=DY(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function WX(e,t,n){if(!e.enabled)throw pY(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw pY(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return HX(e,r),IX(e),t.sort((t,n)=>{let r=a.docs.get(DY(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(DY(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function GX(e){return e.enabled?e.sortableProperties:[]}function KX(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function qX(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function JX(e){if(!e.enabled)return{enabled:!1};VX(e),IX(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function YX(){return{create:PX,insert:FX,remove:UX,save:JX,load:qX,sortBy:WX,getSortableProperties:GX,getSortablePropertiesWithTypes:KX}}var XX=192,ZX=383,QX=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function $X(e){return e<XX||e>ZX?e:QX[e-XX]||e}function eZ(e){let t=[];for(let n=0;n<e.length;n++)t[n]=$X(e.charCodeAt(n));return String.fromCharCode(...t)}var tZ={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},nZ={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},rZ=`[^aeiou]`,iZ=`[aeiouy]`,aZ=rZ+`[^aeiouy]*`;iZ+``;var oZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,sZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,cZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,lZ=`^(`+aZ+`)?[aeiouy]`;function uZ(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(oZ),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(lZ),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+aZ+iZ+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(lZ),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(oZ),t&&r.test(t)&&(e=t+tZ[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(oZ),t&&r.test(t)&&(e=t+nZ[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(cZ),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(cZ),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(cZ),i=new RegExp(sZ),a=RegExp(`^`+aZ+iZ+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(cZ),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function dZ(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=eZ(t),n&&this.normalizationCache.set(r,t),t)}function fZ(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function pZ(e,t,n,r=!0){if(t&&t!==this.language)throw pY(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=PJ[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=fZ(a);return this.allowDuplicates?o:Array.from(new Set(o))}function mZ(e={}){if(!e.language)e.language=`english`;else if(!FJ.includes(e.language))throw pY(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw pY(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=uZ;else throw pY(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:pZ,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:dZ,normalizationCache:new Map};return r.tokenize=pZ.bind(r),r.normalizeToken=dZ,r}function hZ(e){return{sharedInternalDocumentStore:e,rules:new Map}}function gZ(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function _Z(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function vZ(e,t){return e.rules.delete(t)}function yZ(e,t){return e.rules.get(t)}function bZ(e){return Array.from(e.rules.values())}function xZ(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function SZ(e,t){return e?t.conditions.every(t=>xZ(e,t)):!1}function CZ(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())SZ(t,r)&&n.push(r);return n}function wZ(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function TZ(e){return{rules:Array.from(e.rules.entries())}}function EZ(){return{create:hZ,addRule:gZ,updateRule:_Z,removeRule:vZ,getRule:yZ,getAllRules:bZ,getMatchingRules:CZ,load:wZ,save:TZ}}function DZ(e){let t={formatElapsedTime:mY,getDocumentIndexId:hY,getDocumentProperties:eY,validateSchema:gY};for(let n of HY){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw pY(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!VY.includes(t)&&!HY.includes(t))throw pY(`UNSUPPORTED_COMPONENT`,t)}function OZ({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw pY(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=XJ();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:mZ(o):mZ({language:n??`english`}),r.tokenizer&&n)throw pY(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=wY();s||=DX(),l||=YX(),c||=RY(),u||=EZ(),DZ(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:kZ()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of zY)g[e]=(g[e]??[]).concat(BY(g,e));let _=g.afterCreate;return _&&qY(_,g),g}function kZ(){return`{{VERSION}}`}function AZ(e){return e.documentsStore.count(e.data.docs)}function jZ(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw pY(`SCHEMA_VALIDATION_FAILURE`,a);return aY(e.beforeInsert)||aY(e.afterInsert)||aY(e.index.beforeInsert)||aY(e.index.insert)||aY(e.index.afterInsert)?PZ(e,t,n,r,i):FZ(e,t,n,r,i)}var MZ=new Set([`enum`,`enum[]`]),NZ=new Set([`string`,`number`]);async function PZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=DY(e.internalDocumentIDStore,s);if(r||await UY(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw pY(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];IZ(n,r,e,t)}return await LZ(e,s,u,f,l,n,t,i),r||await UY(e.afterInsert,e,s,t),s}function FZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=DY(e.internalDocumentIDStore,s);if(r||UY(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw pY(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];IZ(n,r,e,t)}return RZ(e,s,u,f,l,n,t,i),r||UY(e.afterInsert,e,s,t),s}function IZ(e,t,n,r){if(!(yY(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(bY(t)&&Array.isArray(r))&&!(xY(t)&&Array.isArray(r))&&!(MZ.has(t)&&NZ.has(e))&&e!==t)throw pY(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function LZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function RZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=DY(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function zZ(e,t,n,r,i,a){return aY(e.afterInsertMultiple)||aY(e.beforeInsertMultiple)||aY(e.index.beforeInsert)||aY(e.index.insert)||aY(e.index.afterInsert)?BZ(e,t,n,r,i,a):VZ(e,t,n,r,i,a)}async function BZ(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await jZ(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&dY(e)}}})(),i||await WY(e.afterInsertMultiple,e,t),o}function VZ(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=jZ(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&dY(e)}}}return l(),i||WY(e.afterInsertMultiple,e,t),o}function _ne(e,t){return e[1]-t[1]}function HZ(e,t){return t[1]-e[1]}function UZ(e=`desc`){return e.toLowerCase()===`asc`?_ne:HZ}function WZ(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?tY(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;GZ(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=GZ(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:KZ(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=KZ(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw pY(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=UZ(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function GZ(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function KZ(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}var qZ={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},JZ=[`string`,`number`,`boolean`];function YZ(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw pY(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!JZ.includes(a[t]))throw pY(`INVALID_GROUP_BY_PROPERTY`,t,JZ.join(`, `),a[t])}let o=t.map(([t])=>OY(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=tY(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=XZ(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=$J(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||qZ,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function XZ(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=XZ(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];UJ(n,t),i.push(n)}return i}function ZZ(e,t,n,r){let i=CZ(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=DY(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function QZ(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw pY(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=AZ(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},rQ(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=eQ(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${$Z(e)}\\b`).test(n)))return!0}return!1})}}else l=s?jX(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function $Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eQ(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function tQ(e,t,n){let r=YJ();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=QZ(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[DY(e.internalDocumentIDStore,t),n]);else d=d.sort(QJ);d=ZZ(e,e.data.pinning,d,t.term);let f;u||(f=c?hQ(e,d,s,o,c):gQ(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||iY(p,i)),a&&(p.facets=WZ(e,d,t.facets)),t.groupBy&&(p.groups=YZ(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(YJ()-r),p}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var nQ={k:1.2,b:.75,d:.5};function rQ(e){let t=e??{};return t.k=t.k??nQ.k,t.b=t.b??nQ.b,t.d=t.d??nQ.d,t}function iQ(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw pY(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw pY(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?pY(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):pY(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function aQ(e,t,n=`english`){let r=YJ();function i(){let i=iQ(e,t,n).sort(QJ);i=ZZ(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=WZ(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:OY(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=YZ(e,i,t.groupBy));let f=YJ()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:JJ(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function oQ(e,t,n){let r=lQ(QZ(e,t,n)),i=iQ(e,t,n),a=t.hybridWeights;return fQ(r,i,t.term??``,a)}function sQ(e,t,n){let r=YJ();function i(){let i=oQ(e,t,n);i=ZZ(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=WZ(e,i,t.facets));let o;t.groupBy&&(o=YZ(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=gQ(e,i,s,c).filter(Boolean),u=YJ(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:JJ(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||iY(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function cQ(e){return e[1]}function lQ(e){let t=Math.max.apply(Math,e.map(cQ));return e.map(([e,n])=>[e,n/t])}function uQ(e,t){return e/t}function dQ(e,t){return(n,r)=>n*e+r*t}function fQ(e,t,n,r){let i=Math.max.apply(Math,e.map(cQ)),a=Math.max.apply(Math,t.map(cQ)),{text:o,vector:s}=r&&r.text&&r.vector?r:pQ(n),c=new Map,l=e.length,u=dQ(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(uQ(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=uQ(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function pQ(e){return{text:.5,vector:.5}}function mQ(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return tQ(e,t,n);if(r===`vector`)return aQ(e,t);if(r===`hybrid`)return sQ(e,t);throw pY(`INVALID_SEARCH_MODE`,r)}function hQ(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=tY(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:OY(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function gQ(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:OY(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var _Q=e(MJ(),1),vQ=`0.0.0-unknown`,yQ={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function bQ({kind:e,runtimeVersion:t}){return{[yQ.protocol]:`1`,[yQ.runtime]:t,[yQ.kind]:e}}function xQ({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var SQ=8192,CQ=32768,wQ=`…[truncated]`;function TQ(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function EQ(e){return e.length<=8192?e:`${e.slice(0,SQ-12)}${wQ}`}var DQ=`source`;function OQ(e){return{ok:!1,error:e}}function kQ(e){return{ok:!0,...e}}function AQ(){return yu.parse({})}function jQ(e,t){let n=e.toString();if(n.length===0)return AQ();let r=hr(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),AQ();let i=r.toJSON()??{},a=yu.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),AQ())}function MQ(e,t,n={}){return xu(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>NQ(e,t,n))}function NQ(e,t,n){let{ytextKey:r=DQ}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=jQ(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return OQ({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=Du(e,t);if(n!==null)return OQ(n);let r=hr(a.toString()),o=r.contents!==null&&!g(r.contents);if(r.errors.length>0||o){Su(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=hr(``)}r.contents===null&&(r.contents=r.createNode({}));let s=ku(r,e),l=r.toJSON()??{},u=xu(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=yu.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Su(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return OQ({code:`SCHEMA_INVALID`,issues:u.error.issues.map(Au)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),kQ({effective:u.data,appliedPaths:s})}return{current(){return jQ(a,t)},patch(e){return xu(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var PQ=`source`,FQ=800;function IQ(e){return{ok:!1,error:e}}function LQ(e){return{ok:!0,...e}}function RQ(e,t={}){let{ytextKey:n=PQ,acceptanceDelayMs:r=FQ}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?IQ({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),LQ({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function zQ(e,t,n){return BQ([e,t,n],[])}function BQ(e,t){if(t.length>0){let n=Tu(yu,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[1]??e[0]}let n=VQ(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>HQ(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=BQ(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function VQ(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function HQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var UQ=2e3;function WQ(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function GQ(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var KQ=`__system__`,qQ=`__config__/project`,JQ=`__user__/config.yml`,YQ=`__local__/project`,XQ=`__config__/okignore`;Object.freeze([qQ,YQ,JQ,XQ]);var ZQ=`__skill__/`,QQ=`__template__/`,$Q=[`project`,`global`];function e$(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}var t$=`.ok/skills`;function n$(e){return`${t$}/${e}/SKILL`}var r$=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function i$(e){let t=r$.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function a$(e,t){return e===`project`?n$(t):`${ZQ}${e}/${t}`}function o$(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function s$(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:o$(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:o$(n<0?``:t.slice(0,n)),name:o$(r)}:null}return null}var c$=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function l$(e){let t=c$.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${QQ}${e?`${e}/`:``}${t[2]}`}return null}var u$=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],d$=[`.mdx`,`.md`],f$=`epoch`,p$=512*1024;function m$(e,t=p$){return typeof e==`number`&&Number.isFinite(e)&&e>t}var h$=[`claude`,`claude-desktop`,`cursor`,`codex`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],g$={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},_$={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},v$=h$.filter(e=>_$[e]!==null);v$.filter(e=>e!==`pi`).map(e=>({hostDir:(_$[e]??``).split(`/`)[0],editorId:e}));var y$={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},b$={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function x$(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(b$))if(n.test(e))return t;return null}var S$=[`incoming`,`outgoing`,`both`];function C$(e){return S$.includes(e)}var w$=`open-knowledge`,T$=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
383
+ `,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function pY(e,...t){let n=Error(WJ(fY[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function mY(e){return{raw:Number(e),formatted:JJ(e)}}function hY(e){if(e.id){if(typeof e.id!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return XJ()}function gY(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(bY(r)){let e=CY(r);if(!Array.isArray(t)||t.length!==e)throw pY(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(xY(r)){if(!Array.isArray(t))return n;let e=SY(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=gY(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var _Y={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},vY={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function yY(e){return e===`geopoint`}function bY(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function xY(e){return typeof e==`string`&&_Y[e]}function SY(e){return vY[e]}function CY(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw pY(`INVALID_VECTOR_VALUE`,e);case t<=0:throw pY(`INVALID_VECTOR_SIZE`,e);default:return t}}function wY(){return{idToInternalId:new Map,internalIdToId:[],save:TY,load:EY}}function TY(e){return{internalIdToId:e.internalIdToId}}function EY(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function DY(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?DY(e,t.toString()):t}function OY(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function kY(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function AY(e,t){let n=DY(e.sharedInternalDocumentStore,t);return e.docs[n]}function jY(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=DY(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function MY(e){return e.docs}function NY(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function PY(e,t){let n=DY(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function FY(e){return e.count}function IY(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function LY(e){return{docs:e.docs,count:e.count}}function RY(){return{create:kY,get:AY,getMultiple:jY,getAll:MY,store:NY,remove:PY,count:FY,load:IY,save:LY}}var zY=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function BY(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),pY(`PLUGIN_CRASHED`)}return n}var VY=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],HY=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function UY(e,t,n,r){if(e.some(aY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function WY(e,t,n){if(e.some(aY))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function GY(e,t,n,r,i){if(e.some(aY))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function KY(e,t,n,r){if(e.some(aY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function qY(e,t){if(e.some(aY))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var JY=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},YY=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new JY(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?JY.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new JY(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new JY(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new JY(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},XY=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function ZY(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function QY(e,t,n){let r=ZY(e,t,n);return{distance:r,isBounded:r>=0}}var $Y=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(ZJ(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&QY(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(ZJ(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&(QY(e,n,r).isBounded&&(i[n]=[]),ZJ(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},eX=class e extends $Y{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,$Y.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},tX=2,nX=6371e3,rX=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},iX=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new rX(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%tX===0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=rX.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return nX*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let ee=S*(n*n-i*i)/(i*i),w=1+ee/16384*(4096+ee*(-768+ee*(320-175*ee))),T=ee/1024*(256+ee*(-128+ee*(74-47*ee))),te=T*v*(C+T/4*(y*(-1+2*C*C)-T/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*w*(b-te)}},aX=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function oX(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var sX=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=cX(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),lX(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function cX(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function lX(e,t,n,r,i){let a=cX(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function uX(e,t,n,r,i){let a=DY(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function dX(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=DY(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function fX(e,t,n,r){let i=DY(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function pX(e,t,n){e.tokenOccurrences[t][n]--}function mX(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){mX(e,t,o,r,n);continue}if(bY(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new sX(CY(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new aX,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new YY(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new eX,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new XY,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new iX,isArray:e};break;default:throw pY(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function hX(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function gX(e,t,n,r,i,a,o,s,c,l,u){if(bY(o))return _X(t,n,a,r,i);let d=hX(e,t,n,i,s,c,l,u);if(!xY(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function _X(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function vX(e,t,n,r,i,a,o,s,c,l){if(bY(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function yX(e,t,n,r,i,a,o,s,c,l){if(!xY(o))return vX(e,t,n,r,i,a,o,s,c,l);let u=SY(o),d=a,f=d.length;for(let a=0;a<f;a++)vX(e,t,n,r,i,d[a],u,s,c,l);return!0}function bX(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=oX(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function xX(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw pY(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw pY(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];bX(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function SX(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:sY(...i.map(n=>SX(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>SX(e,t,n,r)).reduce((e,t)=>lY(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return uY(a,SX(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw pY(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=lY(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=rY(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=OX(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=OX(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=MX(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw pY(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=lY(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw pY(`INVALID_FILTER_OPERATION`,e)}a[o]=lY(a[o],n)}}return sY(...Object.values(a))}function CX(e){return e.searchableProperties}function wX(e){return e.searchablePropertiesWithTypes}function TX(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:eX.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:XY.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:YY.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:iX.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:aX.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:sX.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function EX(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function DX(){return{create:mX,insert:gX,remove:yX,insertDocumentScoreParameters:uX,insertTokenScoreParameters:dX,removeDocumentScoreParameters:fX,removeTokenScoreParameters:pX,calculateResultScores:bX,search:xX,searchByWhereClause:SX,getSearchableProperties:CX,getSearchablePropertiesWithTypes:wX,load:TX,save:EX}}function OX(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function kX(e,t,n=!1){let r=n?iX.vincentyDistance:iX.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function AX(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function jX(e,t){let n=e,r=AX(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=rY(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),kX(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=iX.calculatePolygonCentroid(e);return kX(s,r,n)}return null}function MX(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function NX(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=NX(e,t,s,r,n);UJ(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!bY(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw pY(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function PX(e,t,n,r){return r?.enabled===!1?{disabled:!0}:NX(e,t,n,(r||{}).unsortableProperties||[],``)}function FX(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=DY(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&HX(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function IX(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)BX(e,n);e.isSorted=!0}function LX(e,t,n){return t[1].localeCompare(n[1],IJ(e))}function RX(e,t){return e[1]-t[1]}function zX(e,t){return t[1]?-1:1}function BX(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=LX.bind(null,e.language);break;case`number`:r=RX.bind(null);break;case`boolean`:r=zX.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function VX(e){let t=Object.keys(e.sorts);for(let n of t)HX(e,n)}function HX(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function UX(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=DY(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function WX(e,t,n){if(!e.enabled)throw pY(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw pY(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return HX(e,r),IX(e),t.sort((t,n)=>{let r=a.docs.get(DY(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(DY(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function GX(e){return e.enabled?e.sortableProperties:[]}function KX(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function qX(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function JX(e){if(!e.enabled)return{enabled:!1};VX(e),IX(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function YX(){return{create:PX,insert:FX,remove:UX,save:JX,load:qX,sortBy:WX,getSortableProperties:GX,getSortablePropertiesWithTypes:KX}}var XX=192,ZX=383,QX=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function $X(e){return e<XX||e>ZX?e:QX[e-XX]||e}function eZ(e){let t=[];for(let n=0;n<e.length;n++)t[n]=$X(e.charCodeAt(n));return String.fromCharCode(...t)}var tZ={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},nZ={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},rZ=`[^aeiou]`,iZ=`[aeiouy]`,aZ=rZ+`[^aeiouy]*`;iZ+``;var oZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,sZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,cZ=`^(`+aZ+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,lZ=`^(`+aZ+`)?[aeiouy]`;function uZ(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(oZ),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(lZ),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+aZ+iZ+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(lZ),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(oZ),t&&r.test(t)&&(e=t+tZ[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(oZ),t&&r.test(t)&&(e=t+nZ[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(cZ),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(cZ),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(cZ),i=new RegExp(sZ),a=RegExp(`^`+aZ+iZ+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(cZ),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function dZ(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=eZ(t),n&&this.normalizationCache.set(r,t),t)}function fZ(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function pZ(e,t,n,r=!0){if(t&&t!==this.language)throw pY(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=PJ[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=fZ(a);return this.allowDuplicates?o:Array.from(new Set(o))}function mZ(e={}){if(!e.language)e.language=`english`;else if(!FJ.includes(e.language))throw pY(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw pY(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=uZ;else throw pY(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw pY(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:pZ,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:dZ,normalizationCache:new Map};return r.tokenize=pZ.bind(r),r.normalizeToken=dZ,r}function hZ(e){return{sharedInternalDocumentStore:e,rules:new Map}}function gZ(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function _Z(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function vZ(e,t){return e.rules.delete(t)}function yZ(e,t){return e.rules.get(t)}function bZ(e){return Array.from(e.rules.values())}function xZ(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function SZ(e,t){return e?t.conditions.every(t=>xZ(e,t)):!1}function CZ(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())SZ(t,r)&&n.push(r);return n}function wZ(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function TZ(e){return{rules:Array.from(e.rules.entries())}}function EZ(){return{create:hZ,addRule:gZ,updateRule:_Z,removeRule:vZ,getRule:yZ,getAllRules:bZ,getMatchingRules:CZ,load:wZ,save:TZ}}function DZ(e){let t={formatElapsedTime:mY,getDocumentIndexId:hY,getDocumentProperties:eY,validateSchema:gY};for(let n of HY){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw pY(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!VY.includes(t)&&!HY.includes(t))throw pY(`UNSUPPORTED_COMPONENT`,t)}function OZ({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw pY(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=XJ();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:mZ(o):mZ({language:n??`english`}),r.tokenizer&&n)throw pY(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=wY();s||=DX(),l||=YX(),c||=RY(),u||=EZ(),DZ(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:kZ()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of zY)g[e]=(g[e]??[]).concat(BY(g,e));let _=g.afterCreate;return _&&qY(_,g),g}function kZ(){return`{{VERSION}}`}function AZ(e){return e.documentsStore.count(e.data.docs)}function jZ(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw pY(`SCHEMA_VALIDATION_FAILURE`,a);return aY(e.beforeInsert)||aY(e.afterInsert)||aY(e.index.beforeInsert)||aY(e.index.insert)||aY(e.index.afterInsert)?PZ(e,t,n,r,i):FZ(e,t,n,r,i)}var MZ=new Set([`enum`,`enum[]`]),NZ=new Set([`string`,`number`]);async function PZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=DY(e.internalDocumentIDStore,s);if(r||await UY(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw pY(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];IZ(n,r,e,t)}return await LZ(e,s,u,f,l,n,t,i),r||await UY(e.afterInsert,e,s,t),s}function FZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw pY(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=DY(e.internalDocumentIDStore,s);if(r||UY(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw pY(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];IZ(n,r,e,t)}return RZ(e,s,u,f,l,n,t,i),r||UY(e.afterInsert,e,s,t),s}function IZ(e,t,n,r){if(!(yY(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(bY(t)&&Array.isArray(r))&&!(xY(t)&&Array.isArray(r))&&!(MZ.has(t)&&NZ.has(e))&&e!==t)throw pY(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function LZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function RZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=DY(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function zZ(e,t,n,r,i,a){return aY(e.afterInsertMultiple)||aY(e.beforeInsertMultiple)||aY(e.index.beforeInsert)||aY(e.index.insert)||aY(e.index.afterInsert)?BZ(e,t,n,r,i,a):VZ(e,t,n,r,i,a)}async function BZ(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await jZ(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&dY(e)}}})(),i||await WY(e.afterInsertMultiple,e,t),o}function VZ(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=jZ(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&dY(e)}}}return l(),i||WY(e.afterInsertMultiple,e,t),o}function _ne(e,t){return e[1]-t[1]}function HZ(e,t){return t[1]-e[1]}function UZ(e=`desc`){return e.toLowerCase()===`asc`?_ne:HZ}function WZ(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?tY(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;GZ(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=GZ(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:KZ(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=KZ(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw pY(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=UZ(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function GZ(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function KZ(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}var qZ={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},JZ=[`string`,`number`,`boolean`];function YZ(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw pY(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!JZ.includes(a[t]))throw pY(`INVALID_GROUP_BY_PROPERTY`,t,JZ.join(`, `),a[t])}let o=t.map(([t])=>OY(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=tY(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=XZ(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=$J(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||qZ,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function XZ(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=XZ(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];UJ(n,t),i.push(n)}return i}function ZZ(e,t,n,r){let i=CZ(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=DY(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function QZ(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw pY(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=AZ(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},rQ(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=eQ(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${$Z(e)}\\b`).test(n)))return!0}return!1})}}else l=s?jX(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function $Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eQ(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function tQ(e,t,n){let r=YJ();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=QZ(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[DY(e.internalDocumentIDStore,t),n]);else d=d.sort(QJ);d=ZZ(e,e.data.pinning,d,t.term);let f;u||(f=c?hQ(e,d,s,o,c):gQ(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||iY(p,i)),a&&(p.facets=WZ(e,d,t.facets)),t.groupBy&&(p.groups=YZ(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(YJ()-r),p}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var nQ={k:1.2,b:.75,d:.5};function rQ(e){let t=e??{};return t.k=t.k??nQ.k,t.b=t.b??nQ.b,t.d=t.d??nQ.d,t}function iQ(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw pY(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw pY(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?pY(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):pY(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function aQ(e,t,n=`english`){let r=YJ();function i(){let i=iQ(e,t,n).sort(QJ);i=ZZ(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=WZ(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:OY(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=YZ(e,i,t.groupBy));let f=YJ()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:JJ(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function oQ(e,t,n){let r=lQ(QZ(e,t,n)),i=iQ(e,t,n),a=t.hybridWeights;return fQ(r,i,t.term??``,a)}function sQ(e,t,n){let r=YJ();function i(){let i=oQ(e,t,n);i=ZZ(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=WZ(e,i,t.facets));let o;t.groupBy&&(o=YZ(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=gQ(e,i,s,c).filter(Boolean),u=YJ(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:JJ(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||iY(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await KY(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await GY(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function cQ(e){return e[1]}function lQ(e){let t=Math.max.apply(Math,e.map(cQ));return e.map(([e,n])=>[e,n/t])}function uQ(e,t){return e/t}function dQ(e,t){return(n,r)=>n*e+r*t}function fQ(e,t,n,r){let i=Math.max.apply(Math,e.map(cQ)),a=Math.max.apply(Math,t.map(cQ)),{text:o,vector:s}=r&&r.text&&r.vector?r:pQ(n),c=new Map,l=e.length,u=dQ(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(uQ(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=uQ(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function pQ(e){return{text:.5,vector:.5}}function mQ(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return tQ(e,t,n);if(r===`vector`)return aQ(e,t);if(r===`hybrid`)return sQ(e,t);throw pY(`INVALID_SEARCH_MODE`,r)}function hQ(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=tY(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:OY(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function gQ(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:OY(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var _Q=e(MJ(),1),vQ=`0.0.0-unknown`,yQ={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function bQ({kind:e,runtimeVersion:t}){return{[yQ.protocol]:`1`,[yQ.runtime]:t,[yQ.kind]:e}}function xQ({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var SQ=8192,CQ=32768,wQ=`…[truncated]`;function TQ(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function EQ(e){return e.length<=8192?e:`${e.slice(0,SQ-12)}${wQ}`}var DQ=`source`;function OQ(e){return{ok:!1,error:e}}function kQ(e){return{ok:!0,...e}}function AQ(){return yu.parse({})}function jQ(e,t){let n=e.toString();if(n.length===0)return AQ();let r=hr(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),AQ();let i=r.toJSON()??{},a=yu.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),AQ())}function MQ(e,t,n={}){return xu(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>NQ(e,t,n))}function NQ(e,t,n){let{ytextKey:r=DQ}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=jQ(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return OQ({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=Du(e,t);if(n!==null)return OQ(n);let r=hr(a.toString()),o=r.contents!==null&&!g(r.contents);if(r.errors.length>0||o){Su(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=hr(``)}r.contents===null&&(r.contents=r.createNode({}));let s=ku(r,e),l=r.toJSON()??{},u=xu(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=yu.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Su(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return OQ({code:`SCHEMA_INVALID`,issues:u.error.issues.map(Au)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),kQ({effective:u.data,appliedPaths:s})}return{current(){return jQ(a,t)},patch(e){return xu(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var PQ=`source`,FQ=800;function IQ(e){return{ok:!1,error:e}}function LQ(e){return{ok:!0,...e}}function RQ(e,t={}){let{ytextKey:n=PQ,acceptanceDelayMs:r=FQ}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?IQ({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),LQ({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function zQ(e,t,n){return BQ([e,t,n],[])}function BQ(e,t){if(t.length>0){let n=Tu(yu,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[1]??e[0]}let n=VQ(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>HQ(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=BQ(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function VQ(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function HQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var UQ=2e3;function WQ(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function GQ(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var KQ=`__system__`,qQ=`__config__/project`,JQ=`__user__/config.yml`,YQ=`__local__/project`,XQ=`__config__/okignore`;Object.freeze([qQ,YQ,JQ,XQ]);var ZQ=`__skill__/`,QQ=`__template__/`,$Q=[`project`,`global`];function e$(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}var t$=`.ok/skills`;function n$(e){return`${t$}/${e}/SKILL`}var r$=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function i$(e){let t=r$.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function a$(e,t){return e===`project`?n$(t):`${ZQ}${e}/${t}`}function o$(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function s$(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:o$(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:o$(n<0?``:t.slice(0,n)),name:o$(r)}:null}return null}var c$=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function l$(e){let t=c$.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${QQ}${e?`${e}/`:``}${t[2]}`}return null}var u$=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],d$=[`.mdx`,`.md`],f$=`epoch`,p$=512*1024;function m$(e,t=p$){return typeof e==`number`&&Number.isFinite(e)&&e>t}var h$=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],g$={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},_$={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},v$=h$.filter(e=>_$[e]!==null);v$.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(_$[e]??``).split(`/`)[0],editorId:e}));var y$={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},b$={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function x$(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(b$))if(n.test(e))return t;return null}var S$=[`incoming`,`outgoing`,`both`];function C$(e){return S$.includes(e)}var w$=`open-knowledge`,T$=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
384
384
  <h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
385
385
  <div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
386
386
  <script>
@@ -466,7 +466,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
466
466
  `)}function V0(e,t,n){return`The selected passage is ${e===t?`line ${e}`:`lines ${e}-${t}`} of @${n}. Read it from @${n} via the OpenKnowledge MCP server before editing.`}function H0(e){let t=e.map(e=>o0(e)).filter(e=>e!==``);return t.length===0?``:[`Also reference:`,``,...t.map(e=>`@${e}`)].join(`
467
467
  `)}function U0(e){return e.scope===`doc`?`Let's work on @${o0(e.docRelativePath)} using OpenKnowledge.`:e.scope===`folder`?`Let's work on the @${o0(e.folderRelativePath)} folder using OpenKnowledge.`:`Let's work on this project using OpenKnowledge.`}function W0(e,t,n,r,i){let a=t.trim();if(!(a!==``||n!==``||r!==``))return i===``?e:`${e} ${i}`;let o=[e];return a!==``&&o.push(R0(a)),n!==``&&o.push(n),r!==``&&o.push(r),i!==``&&o.push(i),o.join(`
468
468
 
469
- `)}function G0(e,t,n,r,i,a){if(e.kind===`lines`)return V0(e.startLine,e.endLine,n);if(e.kind===`anchor`)return B0(e.markdown,n);let o=z0(e.markdown);return w0(W0(t,``,o,r,i),a)<=g0?o:B0(e.markdown,n)}function K0(e,t,n,r){let{target:i}=e,a=o0(e.docRelativePath),o=`Let's work on @${a} using OpenKnowledge.`,s=G0(t,o,a,n,r,i);return W0(o,N0(e.instruction,i,e=>W0(o,e,s,n,r)),s,n,r)}function q0(e){let{target:t}=e,n=e.autoOpen?L0:``,r=H0(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return K0(e,e.selection,r,n);let i=U0(e);return W0(i,N0(e.instruction,t,e=>W0(i,e,``,r,n)),``,r,n)}function J0(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Y0=[`mcp__${w$}`,`Bash(ok open:*)`],X0=[`delete`,`move`,`share_link`,`install`].map(e=>`mcp__${w$}__${e}`),Z0=`-c ${J0(`mcp_servers.${w$}.default_tools_approval_mode="approve"`)}`;function Q0(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[w$]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...Y0],deny:[...X0]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${J0(JSON.stringify(t))}`}var $0={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:Z0},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`}},e2=[`claude`,`codex`,`opencode`,`cursor`,`pi`,`antigravity`];function t2(e,t,n={}){let r=$0[e],i=e===`claude`?Q0(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``;if(t==null||t.length===0)return`${r.bin} ${a}`.trimEnd();let o=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${a}${o}${J0(t)}`}function n2(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var r2=new Set([`opencode.json`]);function i2(e){return e.split(`/`).some(e=>e.startsWith(`.`))?!0:r2.has(e.slice(e.lastIndexOf(`/`)+1))}function a2(e,t){let n=n2(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var o2=k().superRefine(a2).optional(),s2={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},c2=k().optional(),l2=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Jc(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]);var u2=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),d2=P([`current`,`stale`,`absent`]),f2=Jc(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1),freshness:d2.optional().catch(void 0)}).loose(),N({ok:F(!1),error:u2,branch:k().min(1).optional()}).loose()]),p2=P([`user`,`org`]),m2=N({login:k().min(1),kind:p2,avatarUrl:k().optional()}).loose(),h2=P([`auth-required`,`network`]),g2=Jc(`ok`,[N({ok:F(!0),owners:M(m2)}).loose(),N({ok:F(!1),error:h2}).loose()]),_2=Jc(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:h2}).loose()]),v2=P([`public`,`private`]);N({owner:k().min(1),name:k().min(1),visibility:v2,description:k().optional()}).loose();var y2=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),b2=Jc(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:y2}).loose()]);function x2(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var S2=e=>e.refine(x2,`invalid branch name`),C2={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j(),shareTargetOnOriginBranch:j().optional()};Jc(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Lc(),...C2}).loose(),N({detached:F(!0),currentBranch:Lc(),currentHeadSha:k().min(1),...C2}).loose()]),N({branch:S2(k().min(1)),principalId:k().optional(),fastForward:j().optional()}).loose();var w2=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);Jc(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:w2,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),P([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),N({branch:S2(k().min(1)),path:k(),kind:P([`doc`,`folder`])}).loose(),Jc(`verdict`,[N({verdict:F(`on-origin`)}).loose(),N({verdict:F(`renamed`),renamedTo:k().min(1)}).loose(),N({verdict:F(`deleted`)}).loose(),N({verdict:F(`never-on-branch`)}).loose(),N({verdict:F(`changed-locally`)}).loose(),N({verdict:F(`unknown`)}).loose()]).catch({verdict:`unknown`});var T2=N({startedAt:k().min(1),httpListenMs:A().nonnegative().optional(),seedWalkMs:A().nonnegative().optional(),indexesMs:A().nonnegative().optional(),readyMs:A().nonnegative().optional(),fileCount:A().nonnegative().optional()}),E2=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:Qc(k().min(1),k().min(1)).optional(),boot:T2.optional()}).loose(),D2=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose();N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),singleFile:j().default(!1)}).loose();var O2=N({type:P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`)),title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(l2,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose();N({parentDocName:k().min(1),placement:P([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose();var k2=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose();N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(x2,`invalid branch name`).optional()}).loose(),N({type:F(`error`),problem:O2}).loose();var A2=/notionvc:/i,j2=()=>e=>{M2(e)&&(N2(e),P2(e))};function M2(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(A2.test(e))return!0}if(t.type===`element`&&M2(t))return!0}return!1}function N2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&N2(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
469
+ `)}function G0(e,t,n,r,i,a){if(e.kind===`lines`)return V0(e.startLine,e.endLine,n);if(e.kind===`anchor`)return B0(e.markdown,n);let o=z0(e.markdown);return w0(W0(t,``,o,r,i),a)<=g0?o:B0(e.markdown,n)}function K0(e,t,n,r){let{target:i}=e,a=o0(e.docRelativePath),o=`Let's work on @${a} using OpenKnowledge.`,s=G0(t,o,a,n,r,i);return W0(o,N0(e.instruction,i,e=>W0(o,e,s,n,r)),s,n,r)}function q0(e){let{target:t}=e,n=e.autoOpen?L0:``,r=H0(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return K0(e,e.selection,r,n);let i=U0(e);return W0(i,N0(e.instruction,t,e=>W0(i,e,``,r,n)),``,r,n)}function J0(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Y0=[`mcp__${w$}`,`Bash(ok open:*)`],X0=[`delete`,`move`,`share_link`,`install`].map(e=>`mcp__${w$}__${e}`),Z0=`-c ${J0(`mcp_servers.${w$}.default_tools_approval_mode="approve"`)}`;function Q0(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[w$]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...Y0],deny:[...X0]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${J0(JSON.stringify(t))}`}var $0={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:Z0},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`}},e2=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`];function t2(e,t,n={}){let r=$0[e],i=e===`claude`?Q0(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``;if(t==null||t.length===0)return`${r.bin} ${a}`.trimEnd();let o=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${a}${o}${J0(t)}`}function n2(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var r2=new Set([`opencode.json`]);function i2(e){return e.split(`/`).some(e=>e.startsWith(`.`))?!0:r2.has(e.slice(e.lastIndexOf(`/`)+1))}function a2(e,t){let n=n2(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var o2=k().superRefine(a2).optional(),s2={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},c2=k().optional(),l2=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Jc(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]);var u2=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),d2=P([`current`,`stale`,`absent`]),f2=Jc(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1),freshness:d2.optional().catch(void 0)}).loose(),N({ok:F(!1),error:u2,branch:k().min(1).optional()}).loose()]),p2=P([`user`,`org`]),m2=N({login:k().min(1),kind:p2,avatarUrl:k().optional()}).loose(),h2=P([`auth-required`,`network`]),g2=Jc(`ok`,[N({ok:F(!0),owners:M(m2)}).loose(),N({ok:F(!1),error:h2}).loose()]),_2=Jc(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:h2}).loose()]),v2=P([`public`,`private`]);N({owner:k().min(1),name:k().min(1),visibility:v2,description:k().optional()}).loose();var y2=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),b2=Jc(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:y2}).loose()]);function x2(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var S2=e=>e.refine(x2,`invalid branch name`),C2={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j(),shareTargetOnOriginBranch:j().optional()};Jc(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Lc(),...C2}).loose(),N({detached:F(!0),currentBranch:Lc(),currentHeadSha:k().min(1),...C2}).loose()]),N({branch:S2(k().min(1)),principalId:k().optional(),fastForward:j().optional()}).loose();var w2=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);Jc(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:w2,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),P([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),N({branch:S2(k().min(1)),path:k(),kind:P([`doc`,`folder`])}).loose(),Jc(`verdict`,[N({verdict:F(`on-origin`)}).loose(),N({verdict:F(`renamed`),renamedTo:k().min(1)}).loose(),N({verdict:F(`deleted`)}).loose(),N({verdict:F(`never-on-branch`)}).loose(),N({verdict:F(`changed-locally`)}).loose(),N({verdict:F(`unknown`)}).loose()]).catch({verdict:`unknown`});var T2=N({startedAt:k().min(1),httpListenMs:A().nonnegative().optional(),seedWalkMs:A().nonnegative().optional(),indexesMs:A().nonnegative().optional(),readyMs:A().nonnegative().optional(),fileCount:A().nonnegative().optional()}),E2=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:Qc(k().min(1),k().min(1)).optional(),boot:T2.optional()}).loose(),D2=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose();N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),singleFile:j().default(!1)}).loose();var O2=N({type:P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`)),title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(l2,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose();N({parentDocName:k().min(1),placement:P([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose();var k2=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose();N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(x2,`invalid branch name`).optional()}).loose(),N({type:F(`error`),problem:O2}).loose();var A2=/notionvc:/i,j2=()=>e=>{M2(e)&&(N2(e),P2(e))};function M2(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(A2.test(e))return!0}if(t.type===`element`&&M2(t))return!0}return!1}function N2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&N2(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
470
470
  `)){t.push(n);continue}let r=e.split(`
471
471
  `);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function P2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!A2.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&P2(t)}}var F2=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),I2=()=>e=>{L2(e)};function L2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&L2(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return R2(t)?[]:z2(t)?t.children:[t]})}}function R2(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function z2(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>F2.has(String(e))):!1}var B2=`docs-internal-guid-`;function V2(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var H2=()=>e=>{U2(e)};function U2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&U2(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(W2(r)||G2(r)){V2(e,t);continue}t++}}function W2(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(B2)}function G2(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var K2=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),q2=()=>e=>{J2(e)};function J2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&J2(t);for(let t of e.children)t.type===`element`&&Y2(t)}}function Y2(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!K2.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var X2=/^gmail_/,Z2=()=>e=>{Q2(e)};function Q2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&Q2(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&$2(r,`gmail_quote`)&&(r.tagName=`blockquote`),e4(r),t4(r)){e.children.splice(t,1,...r.children);continue}t++}}function $2(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function e4(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!X2.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function t4(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var n4=()=>e=>{r4(e)};function r4(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&r4(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(i4(t),[t])})}}function i4(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var a4=[`o:`,`w:`,`m:`,`v:`,`u1:`],o4=/^Mso[A-Z]/,s4=/^\s*\[if\s+[^\]]*\]/,c4=()=>e=>{l4(e)};function l4(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&l4(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return s4.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return u4(t)?[]:(d4(t),[t])})}}function u4(e){return a4.some(t=>e.tagName.startsWith(t))}function d4(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!o4.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&o4.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);a4.some(e=>e===`${n}:`)&&delete t[e]}}var f4=/^c-(message_kit__|message__|compose|timestamp)/,p4=()=>e=>{m4(e)};function m4(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&m4(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return h4(t)?[]:(g4(t),[t])})}}function h4(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function g4(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!f4.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var _4=()=>e=>{v4(e)};function v4(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&v4(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;y4(r)&&(e.children[t]=x4(r))}}}function y4(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>b4(e))}function b4(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||b4(e))return!0}return!1}function x4(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>S4(e)).join(`
472
472
  `)}]}]}}function S4(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=S4(n));return t}var C4=new Set([`break`,`delete`,`emphasis`,`footnoteReference`,`html`,`image`,`imageReference`,`inlineCode`,`link`,`linkReference`,`strong`,`text`]);function w4(e){let t=e.children;Array.isArray(t)&&t.forEach((e,n)=>{if(e.type===`break`){t[n]={type:`html`,value:`<br />`};return}w4(e)})}function T4(e){let t=e.children;if(Array.isArray(t))for(let e of t)(e.type===`inlineCode`||e.type===`html`)&&(e.value.includes(`