@webqit/webflo 0.20.2-next.0 → 0.20.2-next.1

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 (286) hide show
  1. package/package.json +1 -1
  2. package/site/.vitepress/config.ts +1 -0
  3. package/site/.vitepress/dist/-/_.html +56 -0
  4. package/site/.vitepress/dist/-/docs.old.html +679 -0
  5. package/site/.vitepress/dist/404.html +23 -0
  6. package/site/.vitepress/dist/api/webflo-fetch/FormData.html +55 -0
  7. package/site/.vitepress/dist/api/webflo-fetch/Headers.html +55 -0
  8. package/site/.vitepress/dist/api/webflo-fetch/LiveResponse.html +55 -0
  9. package/site/.vitepress/dist/api/webflo-fetch/Request.html +55 -0
  10. package/site/.vitepress/dist/api/webflo-fetch/Response.html +55 -0
  11. package/site/.vitepress/dist/api/webflo-fetch/fetch.html +55 -0
  12. package/site/.vitepress/dist/api/webflo-routing/HttpCookies.html +55 -0
  13. package/site/.vitepress/dist/api/webflo-routing/HttpEvent/respondWith.html +55 -0
  14. package/site/.vitepress/dist/api/webflo-routing/HttpEvent/waitUntil.html +55 -0
  15. package/site/.vitepress/dist/api/webflo-routing/HttpEvent/waitUntilNavigate.html +55 -0
  16. package/site/.vitepress/dist/api/webflo-routing/HttpEvent.html +55 -0
  17. package/site/.vitepress/dist/api/webflo-routing/HttpSession.html +55 -0
  18. package/site/.vitepress/dist/api/webflo-routing/HttpState.html +55 -0
  19. package/site/.vitepress/dist/api/webflo-routing/HttpUser.html +55 -0
  20. package/site/.vitepress/dist/api/webflo-routing/handler/fetch.html +59 -0
  21. package/site/.vitepress/dist/api/webflo-routing/handler/next.html +61 -0
  22. package/site/.vitepress/dist/api/webflo-routing/handler.html +65 -0
  23. package/site/.vitepress/dist/api.html +55 -0
  24. package/site/.vitepress/dist/assets/-__.md.wD5kDRhS.js +1 -0
  25. package/site/.vitepress/dist/assets/-__.md.wD5kDRhS.lean.js +1 -0
  26. package/site/.vitepress/dist/assets/-_docs.old.md.CiqucE_1.js +625 -0
  27. package/site/.vitepress/dist/assets/-_docs.old.md.CiqucE_1.lean.js +1 -0
  28. package/site/.vitepress/dist/assets/api.md.C9KRNLi_.js +1 -0
  29. package/site/.vitepress/dist/assets/api.md.C9KRNLi_.lean.js +1 -0
  30. package/site/.vitepress/dist/assets/api_webflo-fetch_FormData.md.CDuexUTz.js +1 -0
  31. package/site/.vitepress/dist/assets/api_webflo-fetch_FormData.md.CDuexUTz.lean.js +1 -0
  32. package/site/.vitepress/dist/assets/api_webflo-fetch_Headers.md.Cl_4-FUP.js +1 -0
  33. package/site/.vitepress/dist/assets/api_webflo-fetch_Headers.md.Cl_4-FUP.lean.js +1 -0
  34. package/site/.vitepress/dist/assets/api_webflo-fetch_LiveResponse.md.BMidKMB1.js +1 -0
  35. package/site/.vitepress/dist/assets/api_webflo-fetch_LiveResponse.md.BMidKMB1.lean.js +1 -0
  36. package/site/.vitepress/dist/assets/api_webflo-fetch_Request.md.DPwZCPmi.js +1 -0
  37. package/site/.vitepress/dist/assets/api_webflo-fetch_Request.md.DPwZCPmi.lean.js +1 -0
  38. package/site/.vitepress/dist/assets/api_webflo-fetch_Response.md.BaSyoOLE.js +1 -0
  39. package/site/.vitepress/dist/assets/api_webflo-fetch_Response.md.BaSyoOLE.lean.js +1 -0
  40. package/site/.vitepress/dist/assets/api_webflo-fetch_fetch.md.Bc9r3Q9I.js +1 -0
  41. package/site/.vitepress/dist/assets/api_webflo-fetch_fetch.md.Bc9r3Q9I.lean.js +1 -0
  42. package/site/.vitepress/dist/assets/api_webflo-routing_HttpCookies.md.B5ok3jrM.js +1 -0
  43. package/site/.vitepress/dist/assets/api_webflo-routing_HttpCookies.md.B5ok3jrM.lean.js +1 -0
  44. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent.md.DBkSQRTa.js +1 -0
  45. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent.md.DBkSQRTa.lean.js +1 -0
  46. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_respondWith.md.aAxq-5Ie.js +1 -0
  47. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_respondWith.md.aAxq-5Ie.lean.js +1 -0
  48. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_waitUntil.md.DyQZLhPR.js +1 -0
  49. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_waitUntil.md.DyQZLhPR.lean.js +1 -0
  50. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_waitUntilNavigate.md.DKLylwhl.js +1 -0
  51. package/site/.vitepress/dist/assets/api_webflo-routing_HttpEvent_waitUntilNavigate.md.DKLylwhl.lean.js +1 -0
  52. package/site/.vitepress/dist/assets/api_webflo-routing_HttpSession.md.bkeCy7_Q.js +1 -0
  53. package/site/.vitepress/dist/assets/api_webflo-routing_HttpSession.md.bkeCy7_Q.lean.js +1 -0
  54. package/site/.vitepress/dist/assets/api_webflo-routing_HttpState.md.DO53IAM1.js +1 -0
  55. package/site/.vitepress/dist/assets/api_webflo-routing_HttpState.md.DO53IAM1.lean.js +1 -0
  56. package/site/.vitepress/dist/assets/api_webflo-routing_HttpUser.md.CfsaBFdl.js +1 -0
  57. package/site/.vitepress/dist/assets/api_webflo-routing_HttpUser.md.CfsaBFdl.lean.js +1 -0
  58. package/site/.vitepress/dist/assets/api_webflo-routing_handler.md.B0eVFluL.js +11 -0
  59. package/site/.vitepress/dist/assets/api_webflo-routing_handler.md.B0eVFluL.lean.js +1 -0
  60. package/site/.vitepress/dist/assets/api_webflo-routing_handler_fetch.md.CpwUMFMz.js +1 -0
  61. package/site/.vitepress/dist/assets/api_webflo-routing_handler_fetch.md.CpwUMFMz.lean.js +1 -0
  62. package/site/.vitepress/dist/assets/api_webflo-routing_handler_next.md.CA4tDXtV.js +7 -0
  63. package/site/.vitepress/dist/assets/api_webflo-routing_handler_next.md.CA4tDXtV.lean.js +1 -0
  64. package/site/.vitepress/dist/assets/app.B989j-Lw.js +256 -0
  65. package/site/.vitepress/dist/assets/chunks/@localSearchIndexroot.IcaIAE_s.js +1 -0
  66. package/site/.vitepress/dist/assets/chunks/VPLocalSearchBox.CxstEVOs.js +8 -0
  67. package/site/.vitepress/dist/assets/chunks/arc.CNNknwAo.js +1 -0
  68. package/site/.vitepress/dist/assets/chunks/architectureDiagram-VXUJARFQ.DCLYhNHD.js +36 -0
  69. package/site/.vitepress/dist/assets/chunks/basePickBy.Cxi84nlK.js +1 -0
  70. package/site/.vitepress/dist/assets/chunks/baseUniq.DDTOgUAc.js +1 -0
  71. package/site/.vitepress/dist/assets/chunks/blockDiagram-VD42YOAC.BcpiarhA.js +122 -0
  72. package/site/.vitepress/dist/assets/chunks/c4Diagram-YG6GDRKO.BI_5dKaW.js +10 -0
  73. package/site/.vitepress/dist/assets/chunks/channel.CxIJmpCu.js +1 -0
  74. package/site/.vitepress/dist/assets/chunks/chunk-4BX2VUAB.C6goADHj.js +1 -0
  75. package/site/.vitepress/dist/assets/chunks/chunk-55IACEB6.BLGj4Pud.js +1 -0
  76. package/site/.vitepress/dist/assets/chunks/chunk-B4BG7PRW.DsAzxoJ_.js +165 -0
  77. package/site/.vitepress/dist/assets/chunks/chunk-DI55MBZ5.BnE2NeEC.js +220 -0
  78. package/site/.vitepress/dist/assets/chunks/chunk-FMBD7UC4.DGeT8zu4.js +15 -0
  79. package/site/.vitepress/dist/assets/chunks/chunk-QN33PNHL.Bc78W0xn.js +1 -0
  80. package/site/.vitepress/dist/assets/chunks/chunk-QZHKN3VN.BFSSbGEs.js +1 -0
  81. package/site/.vitepress/dist/assets/chunks/chunk-TZMSLE5B.DyZR9PPb.js +1 -0
  82. package/site/.vitepress/dist/assets/chunks/classDiagram-2ON5EDUG._0fUH5ha.js +1 -0
  83. package/site/.vitepress/dist/assets/chunks/classDiagram-v2-WZHVMYZB._0fUH5ha.js +1 -0
  84. package/site/.vitepress/dist/assets/chunks/clone.BYyOtvOD.js +1 -0
  85. package/site/.vitepress/dist/assets/chunks/cose-bilkent-S5V4N54A.TlhUFBAR.js +1 -0
  86. package/site/.vitepress/dist/assets/chunks/cytoscape.esm.CyJtwmzi.js +331 -0
  87. package/site/.vitepress/dist/assets/chunks/dagre-6UL2VRFP.D__9IqfC.js +4 -0
  88. package/site/.vitepress/dist/assets/chunks/defaultLocale.C4B-KCzX.js +1 -0
  89. package/site/.vitepress/dist/assets/chunks/diagram-PSM6KHXK.DYSDWndU.js +24 -0
  90. package/site/.vitepress/dist/assets/chunks/diagram-QEK2KX5R.FZi2c8WB.js +43 -0
  91. package/site/.vitepress/dist/assets/chunks/diagram-S2PKOQOG.D-Xxss9Z.js +24 -0
  92. package/site/.vitepress/dist/assets/chunks/erDiagram-Q2GNP2WA.CNdrcxqE.js +60 -0
  93. package/site/.vitepress/dist/assets/chunks/flowDiagram-NV44I4VS.C_6PWuGm.js +162 -0
  94. package/site/.vitepress/dist/assets/chunks/framework.9Uv4PgnO.js +18 -0
  95. package/site/.vitepress/dist/assets/chunks/ganttDiagram-LVOFAZNH._TBJejxF.js +267 -0
  96. package/site/.vitepress/dist/assets/chunks/gitGraphDiagram-NY62KEGX.BmQODSWS.js +65 -0
  97. package/site/.vitepress/dist/assets/chunks/graph.BHWe3GDJ.js +1 -0
  98. package/site/.vitepress/dist/assets/chunks/infoDiagram-ER5ION4S.CbdOaGtv.js +2 -0
  99. package/site/.vitepress/dist/assets/chunks/init.Gi6I4Gst.js +1 -0
  100. package/site/.vitepress/dist/assets/chunks/journeyDiagram-XKPGCS4Q.B-PjYmDZ.js +139 -0
  101. package/site/.vitepress/dist/assets/chunks/kanban-definition-3W4ZIXB7.Bc_8e9KR.js +89 -0
  102. package/site/.vitepress/dist/assets/chunks/katex.BbEIqZs1.js +261 -0
  103. package/site/.vitepress/dist/assets/chunks/layout.hswMW8l0.js +1 -0
  104. package/site/.vitepress/dist/assets/chunks/linear.CUHYPplj.js +1 -0
  105. package/site/.vitepress/dist/assets/chunks/mindmap-definition-VGOIOE7T.CvIaZI8e.js +68 -0
  106. package/site/.vitepress/dist/assets/chunks/ordinal.BYWQX77i.js +1 -0
  107. package/site/.vitepress/dist/assets/chunks/pieDiagram-ADFJNKIX.BSTQM2Ms.js +30 -0
  108. package/site/.vitepress/dist/assets/chunks/quadrantDiagram-AYHSOK5B.CkEJjNYC.js +7 -0
  109. package/site/.vitepress/dist/assets/chunks/requirementDiagram-UZGBJVZJ.QsTahBza.js +64 -0
  110. package/site/.vitepress/dist/assets/chunks/sankeyDiagram-TZEHDZUN.NRsUNMzF.js +10 -0
  111. package/site/.vitepress/dist/assets/chunks/sequenceDiagram-WL72ISMW.rq-YLOb-.js +145 -0
  112. package/site/.vitepress/dist/assets/chunks/stateDiagram-FKZM4ZOC.BseVQjcW.js +1 -0
  113. package/site/.vitepress/dist/assets/chunks/stateDiagram-v2-4FDKWEC3.CH4mdaj_.js +1 -0
  114. package/site/.vitepress/dist/assets/chunks/theme.Jp0RA4YE.js +2 -0
  115. package/site/.vitepress/dist/assets/chunks/timeline-definition-IT6M3QCI.N8DNMk16.js +61 -0
  116. package/site/.vitepress/dist/assets/chunks/treemap-KMMF4GRG.CAwkr_aP.js +128 -0
  117. package/site/.vitepress/dist/assets/chunks/virtual_mermaid-config.DDnGl6nM.js +1 -0
  118. package/site/.vitepress/dist/assets/chunks/xychartDiagram-PRI3JC2R.CF4KVQhG.js +7 -0
  119. package/site/.vitepress/dist/assets/contributing.md.gqIMCtVI.js +1 -0
  120. package/site/.vitepress/dist/assets/contributing.md.gqIMCtVI.lean.js +1 -0
  121. package/site/.vitepress/dist/assets/docs.md.hvbqYbFY.js +1 -0
  122. package/site/.vitepress/dist/assets/docs.md.hvbqYbFY.lean.js +1 -0
  123. package/site/.vitepress/dist/assets/docs_advanced.md.D048cxnq.js +1 -0
  124. package/site/.vitepress/dist/assets/docs_advanced.md.D048cxnq.lean.js +1 -0
  125. package/site/.vitepress/dist/assets/docs_advanced_lifecycles.md.BICPL-da.js +1 -0
  126. package/site/.vitepress/dist/assets/docs_advanced_lifecycles.md.BICPL-da.lean.js +1 -0
  127. package/site/.vitepress/dist/assets/docs_advanced_redirects.md.BMha6D3W.js +1 -0
  128. package/site/.vitepress/dist/assets/docs_advanced_redirects.md.BMha6D3W.lean.js +1 -0
  129. package/site/.vitepress/dist/assets/docs_advanced_routing.md.Cv63UDJF.js +1 -0
  130. package/site/.vitepress/dist/assets/docs_advanced_routing.md.Cv63UDJF.lean.js +1 -0
  131. package/site/.vitepress/dist/assets/docs_concepts.md.Clwx81Hz.js +3 -0
  132. package/site/.vitepress/dist/assets/docs_concepts.md.Clwx81Hz.lean.js +1 -0
  133. package/site/.vitepress/dist/assets/docs_concepts_realtime.md.CBrMq5Ln.js +218 -0
  134. package/site/.vitepress/dist/assets/docs_concepts_realtime.md.CBrMq5Ln.lean.js +1 -0
  135. package/site/.vitepress/dist/assets/docs_concepts_rendering.md.BWr5Lxgn.js +24 -0
  136. package/site/.vitepress/dist/assets/docs_concepts_rendering.md.BWr5Lxgn.lean.js +1 -0
  137. package/site/.vitepress/dist/assets/docs_concepts_request-response.md.DhplzNqt.js +4 -0
  138. package/site/.vitepress/dist/assets/docs_concepts_request-response.md.DhplzNqt.lean.js +1 -0
  139. package/site/.vitepress/dist/assets/docs_concepts_routing.md.C2KO1eAu.js +228 -0
  140. package/site/.vitepress/dist/assets/docs_concepts_routing.md.C2KO1eAu.lean.js +1 -0
  141. package/site/.vitepress/dist/assets/docs_concepts_state.md.CtbMVS_K.js +10 -0
  142. package/site/.vitepress/dist/assets/docs_concepts_state.md.CtbMVS_K.lean.js +1 -0
  143. package/site/.vitepress/dist/assets/docs_concepts_templates.md.4i6jQcYw.js +15 -0
  144. package/site/.vitepress/dist/assets/docs_concepts_templates.md.4i6jQcYw.lean.js +1 -0
  145. package/site/.vitepress/dist/assets/docs_getting-started.md.CNGtwB_L.js +75 -0
  146. package/site/.vitepress/dist/assets/docs_getting-started.md.CNGtwB_L.lean.js +1 -0
  147. package/site/.vitepress/dist/assets/docs_tech-stack.md.xiWGQstL.js +1 -0
  148. package/site/.vitepress/dist/assets/docs_tech-stack.md.xiWGQstL.lean.js +1 -0
  149. package/site/.vitepress/dist/assets/examples.md.BqDfJd4G.js +1 -0
  150. package/site/.vitepress/dist/assets/examples.md.BqDfJd4G.lean.js +1 -0
  151. package/site/.vitepress/dist/assets/examples_pwa.md.DREN7J2F.js +1 -0
  152. package/site/.vitepress/dist/assets/examples_pwa.md.DREN7J2F.lean.js +1 -0
  153. package/site/.vitepress/dist/assets/examples_web.md.DUhZ0IQL.js +1 -0
  154. package/site/.vitepress/dist/assets/examples_web.md.DUhZ0IQL.lean.js +1 -0
  155. package/site/.vitepress/dist/assets/faq.md.DtfXaXUI.js +1 -0
  156. package/site/.vitepress/dist/assets/faq.md.DtfXaXUI.lean.js +1 -0
  157. package/site/.vitepress/dist/assets/guides.md.BVdQyeU-.js +1 -0
  158. package/site/.vitepress/dist/assets/guides.md.BVdQyeU-.lean.js +1 -0
  159. package/site/.vitepress/dist/assets/guides_guide-auth.md.DNFuRudp.js +1 -0
  160. package/site/.vitepress/dist/assets/guides_guide-auth.md.DNFuRudp.lean.js +1 -0
  161. package/site/.vitepress/dist/assets/guides_guide-file-upload.md.DRbRLk7h.js +1 -0
  162. package/site/.vitepress/dist/assets/guides_guide-file-upload.md.DRbRLk7h.lean.js +1 -0
  163. package/site/.vitepress/dist/assets/guides_guide-service-worker.md.B0wEVcQw.js +1 -0
  164. package/site/.vitepress/dist/assets/guides_guide-service-worker.md.B0wEVcQw.lean.js +1 -0
  165. package/site/.vitepress/dist/assets/guides_tutorial-1-todo.md.D9ket3Re.js +3 -0
  166. package/site/.vitepress/dist/assets/guides_tutorial-1-todo.md.D9ket3Re.lean.js +1 -0
  167. package/site/.vitepress/dist/assets/index.md.DB-CsGEX.js +1 -0
  168. package/site/.vitepress/dist/assets/index.md.DB-CsGEX.lean.js +1 -0
  169. package/site/.vitepress/dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  170. package/site/.vitepress/dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  171. package/site/.vitepress/dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  172. package/site/.vitepress/dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  173. package/site/.vitepress/dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  174. package/site/.vitepress/dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  175. package/site/.vitepress/dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  176. package/site/.vitepress/dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  177. package/site/.vitepress/dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  178. package/site/.vitepress/dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  179. package/site/.vitepress/dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  180. package/site/.vitepress/dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  181. package/site/.vitepress/dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  182. package/site/.vitepress/dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  183. package/site/.vitepress/dist/assets/recipes_realtime.md.CX1Vs2FD.js +1 -0
  184. package/site/.vitepress/dist/assets/recipes_realtime.md.CX1Vs2FD.lean.js +1 -0
  185. package/site/.vitepress/dist/assets/recipes_streaming.md.C7GFShgF.js +5 -0
  186. package/site/.vitepress/dist/assets/recipes_streaming.md.C7GFShgF.lean.js +1 -0
  187. package/site/.vitepress/dist/assets/reference_cli.md.DERqaQJm.js +1 -0
  188. package/site/.vitepress/dist/assets/reference_cli.md.DERqaQJm.lean.js +1 -0
  189. package/site/.vitepress/dist/assets/reference_config.md.DI_yG-7N.js +1 -0
  190. package/site/.vitepress/dist/assets/reference_config.md.DI_yG-7N.lean.js +1 -0
  191. package/site/.vitepress/dist/assets/reference_tools.md.DZxjdVFX.js +1 -0
  192. package/site/.vitepress/dist/assets/reference_tools.md.DZxjdVFX.lean.js +1 -0
  193. package/site/.vitepress/dist/assets/style.BD0LzINo.css +1 -0
  194. package/site/.vitepress/dist/contributing.html +55 -0
  195. package/site/.vitepress/dist/docs/advanced/lifecycles.html +55 -0
  196. package/site/.vitepress/dist/docs/advanced/redirects.html +55 -0
  197. package/site/.vitepress/dist/docs/advanced/routing.html +55 -0
  198. package/site/.vitepress/dist/docs/advanced.html +55 -0
  199. package/site/.vitepress/dist/docs/concepts/realtime.html +272 -0
  200. package/site/.vitepress/dist/docs/concepts/rendering.html +78 -0
  201. package/site/.vitepress/dist/docs/concepts/request-response.html +58 -0
  202. package/site/.vitepress/dist/docs/concepts/routing.html +282 -0
  203. package/site/.vitepress/dist/docs/concepts/state.html +64 -0
  204. package/site/.vitepress/dist/docs/concepts/templates.html +69 -0
  205. package/site/.vitepress/dist/docs/concepts.html +57 -0
  206. package/site/.vitepress/dist/docs/getting-started.html +129 -0
  207. package/site/.vitepress/dist/docs/tech-stack.html +55 -0
  208. package/site/.vitepress/dist/docs.html +55 -0
  209. package/site/.vitepress/dist/examples/pwa.html +55 -0
  210. package/site/.vitepress/dist/examples/web.html +55 -0
  211. package/site/.vitepress/dist/examples.html +55 -0
  212. package/site/.vitepress/dist/faq.html +55 -0
  213. package/site/.vitepress/dist/guides/guide-auth.html +55 -0
  214. package/site/.vitepress/dist/guides/guide-file-upload.html +55 -0
  215. package/site/.vitepress/dist/guides/guide-service-worker.html +55 -0
  216. package/site/.vitepress/dist/guides/tutorial-1-todo.html +57 -0
  217. package/site/.vitepress/dist/guides.html +55 -0
  218. package/site/.vitepress/dist/hashmap.json +1 -0
  219. package/site/.vitepress/dist/img/brand/logo-670x670.png +0 -0
  220. package/site/.vitepress/dist/index.html +55 -0
  221. package/site/.vitepress/dist/recipes/realtime.html +55 -0
  222. package/site/.vitepress/dist/recipes/streaming.html +59 -0
  223. package/site/.vitepress/dist/reference/cli.html +55 -0
  224. package/site/.vitepress/dist/reference/config.html +55 -0
  225. package/site/.vitepress/dist/reference/tools.html +55 -0
  226. package/site/.vitepress/dist/vp-icons.css +1 -0
  227. package/site/.vitepress/cache/deps/@braintree_sanitize-url 2.js +0 -93
  228. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js 2.map +0 -7
  229. package/site/.vitepress/cache/deps/_metadata 2.json +0 -85
  230. package/site/.vitepress/cache/deps/_metadata.json +0 -85
  231. package/site/.vitepress/cache/deps/chunk-BUSYA2B4 2.js +0 -9
  232. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js 2.map +0 -7
  233. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK 2.js +0 -9719
  234. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js 2.map +0 -7
  235. package/site/.vitepress/cache/deps/chunk-QAXAIFA7 2.js +0 -12705
  236. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js 2.map +0 -7
  237. package/site/.vitepress/cache/deps/cytoscape 2.js +0 -30278
  238. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent 2.js +0 -4710
  239. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js 2.map +0 -7
  240. package/site/.vitepress/cache/deps/cytoscape.js 2.map +0 -7
  241. package/site/.vitepress/cache/deps/dayjs 2.js +0 -285
  242. package/site/.vitepress/cache/deps/dayjs.js 2.map +0 -7
  243. package/site/.vitepress/cache/deps/debug 2.js +0 -453
  244. package/site/.vitepress/cache/deps/debug.js 2.map +0 -7
  245. package/site/.vitepress/cache/deps/package 2.json +0 -3
  246. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api 2.js +0 -4507
  247. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js 2.map +0 -7
  248. package/site/.vitepress/cache/deps/vitepress___@vueuse_core 2.js +0 -584
  249. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js 2.map +0 -7
  250. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap 2.js +0 -1166
  251. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js 2.map +0 -7
  252. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js 2.js +0 -1667
  253. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js 2.map +0 -7
  254. package/site/.vitepress/cache/deps/vitepress___minisearch 2.js +0 -1815
  255. package/site/.vitepress/cache/deps/vitepress___minisearch.js 2.map +0 -7
  256. package/site/.vitepress/cache/deps/vue 2.js +0 -344
  257. package/site/.vitepress/cache/deps/vue.js 2.map +0 -7
  258. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/@braintree_sanitize-url.js +0 -0
  259. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/@braintree_sanitize-url.js.map +0 -0
  260. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-BUSYA2B4.js +0 -0
  261. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-BUSYA2B4.js.map +0 -0
  262. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-Q2AYPHVK.js +0 -0
  263. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-Q2AYPHVK.js.map +0 -0
  264. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-QAXAIFA7.js +0 -0
  265. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/chunk-QAXAIFA7.js.map +0 -0
  266. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/cytoscape-cose-bilkent.js +0 -0
  267. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/cytoscape-cose-bilkent.js.map +0 -0
  268. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/cytoscape.js +0 -0
  269. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/cytoscape.js.map +0 -0
  270. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/dayjs.js +0 -0
  271. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/dayjs.js.map +0 -0
  272. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/debug.js +0 -0
  273. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/debug.js.map +0 -0
  274. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/package.json +0 -0
  275. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vue_devtools-api.js +0 -0
  276. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vue_devtools-api.js.map +0 -0
  277. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vueuse_core.js +0 -0
  278. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vueuse_core.js.map +0 -0
  279. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vueuse_integrations_useFocusTrap.js +0 -0
  280. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___@vueuse_integrations_useFocusTrap.js.map +0 -0
  281. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___mark__js_src_vanilla__js.js +0 -0
  282. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___mark__js_src_vanilla__js.js.map +0 -0
  283. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___minisearch.js +0 -0
  284. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vitepress___minisearch.js.map +0 -0
  285. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vue.js +0 -0
  286. /package/site/.vitepress/cache/{deps → deps_temp_9b107c53}/vue.js.map +0 -0
@@ -1,1815 +0,0 @@
1
- import "./chunk-BUSYA2B4.js";
2
-
3
- // node_modules/minisearch/dist/es/index.js
4
- var ENTRIES = "ENTRIES";
5
- var KEYS = "KEYS";
6
- var VALUES = "VALUES";
7
- var LEAF = "";
8
- var TreeIterator = class {
9
- constructor(set, type) {
10
- const node = set._tree;
11
- const keys = Array.from(node.keys());
12
- this.set = set;
13
- this._type = type;
14
- this._path = keys.length > 0 ? [{ node, keys }] : [];
15
- }
16
- next() {
17
- const value = this.dive();
18
- this.backtrack();
19
- return value;
20
- }
21
- dive() {
22
- if (this._path.length === 0) {
23
- return { done: true, value: void 0 };
24
- }
25
- const { node, keys } = last$1(this._path);
26
- if (last$1(keys) === LEAF) {
27
- return { done: false, value: this.result() };
28
- }
29
- const child = node.get(last$1(keys));
30
- this._path.push({ node: child, keys: Array.from(child.keys()) });
31
- return this.dive();
32
- }
33
- backtrack() {
34
- if (this._path.length === 0) {
35
- return;
36
- }
37
- const keys = last$1(this._path).keys;
38
- keys.pop();
39
- if (keys.length > 0) {
40
- return;
41
- }
42
- this._path.pop();
43
- this.backtrack();
44
- }
45
- key() {
46
- return this.set._prefix + this._path.map(({ keys }) => last$1(keys)).filter((key) => key !== LEAF).join("");
47
- }
48
- value() {
49
- return last$1(this._path).node.get(LEAF);
50
- }
51
- result() {
52
- switch (this._type) {
53
- case VALUES:
54
- return this.value();
55
- case KEYS:
56
- return this.key();
57
- default:
58
- return [this.key(), this.value()];
59
- }
60
- }
61
- [Symbol.iterator]() {
62
- return this;
63
- }
64
- };
65
- var last$1 = (array) => {
66
- return array[array.length - 1];
67
- };
68
- var fuzzySearch = (node, query, maxDistance) => {
69
- const results = /* @__PURE__ */ new Map();
70
- if (query === void 0)
71
- return results;
72
- const n = query.length + 1;
73
- const m = n + maxDistance;
74
- const matrix = new Uint8Array(m * n).fill(maxDistance + 1);
75
- for (let j = 0; j < n; ++j)
76
- matrix[j] = j;
77
- for (let i = 1; i < m; ++i)
78
- matrix[i * n] = i;
79
- recurse(node, query, maxDistance, results, matrix, 1, n, "");
80
- return results;
81
- };
82
- var recurse = (node, query, maxDistance, results, matrix, m, n, prefix) => {
83
- const offset = m * n;
84
- key: for (const key of node.keys()) {
85
- if (key === LEAF) {
86
- const distance = matrix[offset - 1];
87
- if (distance <= maxDistance) {
88
- results.set(prefix, [node.get(key), distance]);
89
- }
90
- } else {
91
- let i = m;
92
- for (let pos = 0; pos < key.length; ++pos, ++i) {
93
- const char = key[pos];
94
- const thisRowOffset = n * i;
95
- const prevRowOffset = thisRowOffset - n;
96
- let minDistance = matrix[thisRowOffset];
97
- const jmin = Math.max(0, i - maxDistance - 1);
98
- const jmax = Math.min(n - 1, i + maxDistance);
99
- for (let j = jmin; j < jmax; ++j) {
100
- const different = char !== query[j];
101
- const rpl = matrix[prevRowOffset + j] + +different;
102
- const del = matrix[prevRowOffset + j + 1] + 1;
103
- const ins = matrix[thisRowOffset + j] + 1;
104
- const dist = matrix[thisRowOffset + j + 1] = Math.min(rpl, del, ins);
105
- if (dist < minDistance)
106
- minDistance = dist;
107
- }
108
- if (minDistance > maxDistance) {
109
- continue key;
110
- }
111
- }
112
- recurse(node.get(key), query, maxDistance, results, matrix, i, n, prefix + key);
113
- }
114
- }
115
- };
116
- var SearchableMap = class _SearchableMap {
117
- /**
118
- * The constructor is normally called without arguments, creating an empty
119
- * map. In order to create a {@link SearchableMap} from an iterable or from an
120
- * object, check {@link SearchableMap.from} and {@link
121
- * SearchableMap.fromObject}.
122
- *
123
- * The constructor arguments are for internal use, when creating derived
124
- * mutable views of a map at a prefix.
125
- */
126
- constructor(tree = /* @__PURE__ */ new Map(), prefix = "") {
127
- this._size = void 0;
128
- this._tree = tree;
129
- this._prefix = prefix;
130
- }
131
- /**
132
- * Creates and returns a mutable view of this {@link SearchableMap},
133
- * containing only entries that share the given prefix.
134
- *
135
- * ### Usage:
136
- *
137
- * ```javascript
138
- * let map = new SearchableMap()
139
- * map.set("unicorn", 1)
140
- * map.set("universe", 2)
141
- * map.set("university", 3)
142
- * map.set("unique", 4)
143
- * map.set("hello", 5)
144
- *
145
- * let uni = map.atPrefix("uni")
146
- * uni.get("unique") // => 4
147
- * uni.get("unicorn") // => 1
148
- * uni.get("hello") // => undefined
149
- *
150
- * let univer = map.atPrefix("univer")
151
- * univer.get("unique") // => undefined
152
- * univer.get("universe") // => 2
153
- * univer.get("university") // => 3
154
- * ```
155
- *
156
- * @param prefix The prefix
157
- * @return A {@link SearchableMap} representing a mutable view of the original
158
- * Map at the given prefix
159
- */
160
- atPrefix(prefix) {
161
- if (!prefix.startsWith(this._prefix)) {
162
- throw new Error("Mismatched prefix");
163
- }
164
- const [node, path] = trackDown(this._tree, prefix.slice(this._prefix.length));
165
- if (node === void 0) {
166
- const [parentNode, key] = last(path);
167
- for (const k of parentNode.keys()) {
168
- if (k !== LEAF && k.startsWith(key)) {
169
- const node2 = /* @__PURE__ */ new Map();
170
- node2.set(k.slice(key.length), parentNode.get(k));
171
- return new _SearchableMap(node2, prefix);
172
- }
173
- }
174
- }
175
- return new _SearchableMap(node, prefix);
176
- }
177
- /**
178
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear
179
- */
180
- clear() {
181
- this._size = void 0;
182
- this._tree.clear();
183
- }
184
- /**
185
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete
186
- * @param key Key to delete
187
- */
188
- delete(key) {
189
- this._size = void 0;
190
- return remove(this._tree, key);
191
- }
192
- /**
193
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries
194
- * @return An iterator iterating through `[key, value]` entries.
195
- */
196
- entries() {
197
- return new TreeIterator(this, ENTRIES);
198
- }
199
- /**
200
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach
201
- * @param fn Iteration function
202
- */
203
- forEach(fn) {
204
- for (const [key, value] of this) {
205
- fn(key, value, this);
206
- }
207
- }
208
- /**
209
- * Returns a Map of all the entries that have a key within the given edit
210
- * distance from the search key. The keys of the returned Map are the matching
211
- * keys, while the values are two-element arrays where the first element is
212
- * the value associated to the key, and the second is the edit distance of the
213
- * key to the search key.
214
- *
215
- * ### Usage:
216
- *
217
- * ```javascript
218
- * let map = new SearchableMap()
219
- * map.set('hello', 'world')
220
- * map.set('hell', 'yeah')
221
- * map.set('ciao', 'mondo')
222
- *
223
- * // Get all entries that match the key 'hallo' with a maximum edit distance of 2
224
- * map.fuzzyGet('hallo', 2)
225
- * // => Map(2) { 'hello' => ['world', 1], 'hell' => ['yeah', 2] }
226
- *
227
- * // In the example, the "hello" key has value "world" and edit distance of 1
228
- * // (change "e" to "a"), the key "hell" has value "yeah" and edit distance of 2
229
- * // (change "e" to "a", delete "o")
230
- * ```
231
- *
232
- * @param key The search key
233
- * @param maxEditDistance The maximum edit distance (Levenshtein)
234
- * @return A Map of the matching keys to their value and edit distance
235
- */
236
- fuzzyGet(key, maxEditDistance) {
237
- return fuzzySearch(this._tree, key, maxEditDistance);
238
- }
239
- /**
240
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get
241
- * @param key Key to get
242
- * @return Value associated to the key, or `undefined` if the key is not
243
- * found.
244
- */
245
- get(key) {
246
- const node = lookup(this._tree, key);
247
- return node !== void 0 ? node.get(LEAF) : void 0;
248
- }
249
- /**
250
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has
251
- * @param key Key
252
- * @return True if the key is in the map, false otherwise
253
- */
254
- has(key) {
255
- const node = lookup(this._tree, key);
256
- return node !== void 0 && node.has(LEAF);
257
- }
258
- /**
259
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys
260
- * @return An `Iterable` iterating through keys
261
- */
262
- keys() {
263
- return new TreeIterator(this, KEYS);
264
- }
265
- /**
266
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set
267
- * @param key Key to set
268
- * @param value Value to associate to the key
269
- * @return The {@link SearchableMap} itself, to allow chaining
270
- */
271
- set(key, value) {
272
- if (typeof key !== "string") {
273
- throw new Error("key must be a string");
274
- }
275
- this._size = void 0;
276
- const node = createPath(this._tree, key);
277
- node.set(LEAF, value);
278
- return this;
279
- }
280
- /**
281
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size
282
- */
283
- get size() {
284
- if (this._size) {
285
- return this._size;
286
- }
287
- this._size = 0;
288
- const iter = this.entries();
289
- while (!iter.next().done)
290
- this._size += 1;
291
- return this._size;
292
- }
293
- /**
294
- * Updates the value at the given key using the provided function. The function
295
- * is called with the current value at the key, and its return value is used as
296
- * the new value to be set.
297
- *
298
- * ### Example:
299
- *
300
- * ```javascript
301
- * // Increment the current value by one
302
- * searchableMap.update('somekey', (currentValue) => currentValue == null ? 0 : currentValue + 1)
303
- * ```
304
- *
305
- * If the value at the given key is or will be an object, it might not require
306
- * re-assignment. In that case it is better to use `fetch()`, because it is
307
- * faster.
308
- *
309
- * @param key The key to update
310
- * @param fn The function used to compute the new value from the current one
311
- * @return The {@link SearchableMap} itself, to allow chaining
312
- */
313
- update(key, fn) {
314
- if (typeof key !== "string") {
315
- throw new Error("key must be a string");
316
- }
317
- this._size = void 0;
318
- const node = createPath(this._tree, key);
319
- node.set(LEAF, fn(node.get(LEAF)));
320
- return this;
321
- }
322
- /**
323
- * Fetches the value of the given key. If the value does not exist, calls the
324
- * given function to create a new value, which is inserted at the given key
325
- * and subsequently returned.
326
- *
327
- * ### Example:
328
- *
329
- * ```javascript
330
- * const map = searchableMap.fetch('somekey', () => new Map())
331
- * map.set('foo', 'bar')
332
- * ```
333
- *
334
- * @param key The key to update
335
- * @param initial A function that creates a new value if the key does not exist
336
- * @return The existing or new value at the given key
337
- */
338
- fetch(key, initial) {
339
- if (typeof key !== "string") {
340
- throw new Error("key must be a string");
341
- }
342
- this._size = void 0;
343
- const node = createPath(this._tree, key);
344
- let value = node.get(LEAF);
345
- if (value === void 0) {
346
- node.set(LEAF, value = initial());
347
- }
348
- return value;
349
- }
350
- /**
351
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values
352
- * @return An `Iterable` iterating through values.
353
- */
354
- values() {
355
- return new TreeIterator(this, VALUES);
356
- }
357
- /**
358
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@iterator
359
- */
360
- [Symbol.iterator]() {
361
- return this.entries();
362
- }
363
- /**
364
- * Creates a {@link SearchableMap} from an `Iterable` of entries
365
- *
366
- * @param entries Entries to be inserted in the {@link SearchableMap}
367
- * @return A new {@link SearchableMap} with the given entries
368
- */
369
- static from(entries) {
370
- const tree = new _SearchableMap();
371
- for (const [key, value] of entries) {
372
- tree.set(key, value);
373
- }
374
- return tree;
375
- }
376
- /**
377
- * Creates a {@link SearchableMap} from the iterable properties of a JavaScript object
378
- *
379
- * @param object Object of entries for the {@link SearchableMap}
380
- * @return A new {@link SearchableMap} with the given entries
381
- */
382
- static fromObject(object) {
383
- return _SearchableMap.from(Object.entries(object));
384
- }
385
- };
386
- var trackDown = (tree, key, path = []) => {
387
- if (key.length === 0 || tree == null) {
388
- return [tree, path];
389
- }
390
- for (const k of tree.keys()) {
391
- if (k !== LEAF && key.startsWith(k)) {
392
- path.push([tree, k]);
393
- return trackDown(tree.get(k), key.slice(k.length), path);
394
- }
395
- }
396
- path.push([tree, key]);
397
- return trackDown(void 0, "", path);
398
- };
399
- var lookup = (tree, key) => {
400
- if (key.length === 0 || tree == null) {
401
- return tree;
402
- }
403
- for (const k of tree.keys()) {
404
- if (k !== LEAF && key.startsWith(k)) {
405
- return lookup(tree.get(k), key.slice(k.length));
406
- }
407
- }
408
- };
409
- var createPath = (node, key) => {
410
- const keyLength = key.length;
411
- outer: for (let pos = 0; node && pos < keyLength; ) {
412
- for (const k of node.keys()) {
413
- if (k !== LEAF && key[pos] === k[0]) {
414
- const len = Math.min(keyLength - pos, k.length);
415
- let offset = 1;
416
- while (offset < len && key[pos + offset] === k[offset])
417
- ++offset;
418
- const child2 = node.get(k);
419
- if (offset === k.length) {
420
- node = child2;
421
- } else {
422
- const intermediate = /* @__PURE__ */ new Map();
423
- intermediate.set(k.slice(offset), child2);
424
- node.set(key.slice(pos, pos + offset), intermediate);
425
- node.delete(k);
426
- node = intermediate;
427
- }
428
- pos += offset;
429
- continue outer;
430
- }
431
- }
432
- const child = /* @__PURE__ */ new Map();
433
- node.set(key.slice(pos), child);
434
- return child;
435
- }
436
- return node;
437
- };
438
- var remove = (tree, key) => {
439
- const [node, path] = trackDown(tree, key);
440
- if (node === void 0) {
441
- return;
442
- }
443
- node.delete(LEAF);
444
- if (node.size === 0) {
445
- cleanup(path);
446
- } else if (node.size === 1) {
447
- const [key2, value] = node.entries().next().value;
448
- merge(path, key2, value);
449
- }
450
- };
451
- var cleanup = (path) => {
452
- if (path.length === 0) {
453
- return;
454
- }
455
- const [node, key] = last(path);
456
- node.delete(key);
457
- if (node.size === 0) {
458
- cleanup(path.slice(0, -1));
459
- } else if (node.size === 1) {
460
- const [key2, value] = node.entries().next().value;
461
- if (key2 !== LEAF) {
462
- merge(path.slice(0, -1), key2, value);
463
- }
464
- }
465
- };
466
- var merge = (path, key, value) => {
467
- if (path.length === 0) {
468
- return;
469
- }
470
- const [node, nodeKey] = last(path);
471
- node.set(nodeKey + key, value);
472
- node.delete(nodeKey);
473
- };
474
- var last = (array) => {
475
- return array[array.length - 1];
476
- };
477
- var OR = "or";
478
- var AND = "and";
479
- var AND_NOT = "and_not";
480
- var MiniSearch = class _MiniSearch {
481
- /**
482
- * @param options Configuration options
483
- *
484
- * ### Examples:
485
- *
486
- * ```javascript
487
- * // Create a search engine that indexes the 'title' and 'text' fields of your
488
- * // documents:
489
- * const miniSearch = new MiniSearch({ fields: ['title', 'text'] })
490
- * ```
491
- *
492
- * ### ID Field:
493
- *
494
- * ```javascript
495
- * // Your documents are assumed to include a unique 'id' field, but if you want
496
- * // to use a different field for document identification, you can set the
497
- * // 'idField' option:
498
- * const miniSearch = new MiniSearch({ idField: 'key', fields: ['title', 'text'] })
499
- * ```
500
- *
501
- * ### Options and defaults:
502
- *
503
- * ```javascript
504
- * // The full set of options (here with their default value) is:
505
- * const miniSearch = new MiniSearch({
506
- * // idField: field that uniquely identifies a document
507
- * idField: 'id',
508
- *
509
- * // extractField: function used to get the value of a field in a document.
510
- * // By default, it assumes the document is a flat object with field names as
511
- * // property keys and field values as string property values, but custom logic
512
- * // can be implemented by setting this option to a custom extractor function.
513
- * extractField: (document, fieldName) => document[fieldName],
514
- *
515
- * // tokenize: function used to split fields into individual terms. By
516
- * // default, it is also used to tokenize search queries, unless a specific
517
- * // `tokenize` search option is supplied. When tokenizing an indexed field,
518
- * // the field name is passed as the second argument.
519
- * tokenize: (string, _fieldName) => string.split(SPACE_OR_PUNCTUATION),
520
- *
521
- * // processTerm: function used to process each tokenized term before
522
- * // indexing. It can be used for stemming and normalization. Return a falsy
523
- * // value in order to discard a term. By default, it is also used to process
524
- * // search queries, unless a specific `processTerm` option is supplied as a
525
- * // search option. When processing a term from a indexed field, the field
526
- * // name is passed as the second argument.
527
- * processTerm: (term, _fieldName) => term.toLowerCase(),
528
- *
529
- * // searchOptions: default search options, see the `search` method for
530
- * // details
531
- * searchOptions: undefined,
532
- *
533
- * // fields: document fields to be indexed. Mandatory, but not set by default
534
- * fields: undefined
535
- *
536
- * // storeFields: document fields to be stored and returned as part of the
537
- * // search results.
538
- * storeFields: []
539
- * })
540
- * ```
541
- */
542
- constructor(options) {
543
- if ((options === null || options === void 0 ? void 0 : options.fields) == null) {
544
- throw new Error('MiniSearch: option "fields" must be provided');
545
- }
546
- const autoVacuum = options.autoVacuum == null || options.autoVacuum === true ? defaultAutoVacuumOptions : options.autoVacuum;
547
- this._options = {
548
- ...defaultOptions,
549
- ...options,
550
- autoVacuum,
551
- searchOptions: { ...defaultSearchOptions, ...options.searchOptions || {} },
552
- autoSuggestOptions: { ...defaultAutoSuggestOptions, ...options.autoSuggestOptions || {} }
553
- };
554
- this._index = new SearchableMap();
555
- this._documentCount = 0;
556
- this._documentIds = /* @__PURE__ */ new Map();
557
- this._idToShortId = /* @__PURE__ */ new Map();
558
- this._fieldIds = {};
559
- this._fieldLength = /* @__PURE__ */ new Map();
560
- this._avgFieldLength = [];
561
- this._nextId = 0;
562
- this._storedFields = /* @__PURE__ */ new Map();
563
- this._dirtCount = 0;
564
- this._currentVacuum = null;
565
- this._enqueuedVacuum = null;
566
- this._enqueuedVacuumConditions = defaultVacuumConditions;
567
- this.addFields(this._options.fields);
568
- }
569
- /**
570
- * Adds a document to the index
571
- *
572
- * @param document The document to be indexed
573
- */
574
- add(document) {
575
- const { extractField, stringifyField, tokenize, processTerm, fields, idField } = this._options;
576
- const id = extractField(document, idField);
577
- if (id == null) {
578
- throw new Error(`MiniSearch: document does not have ID field "${idField}"`);
579
- }
580
- if (this._idToShortId.has(id)) {
581
- throw new Error(`MiniSearch: duplicate ID ${id}`);
582
- }
583
- const shortDocumentId = this.addDocumentId(id);
584
- this.saveStoredFields(shortDocumentId, document);
585
- for (const field of fields) {
586
- const fieldValue = extractField(document, field);
587
- if (fieldValue == null)
588
- continue;
589
- const tokens = tokenize(stringifyField(fieldValue, field), field);
590
- const fieldId = this._fieldIds[field];
591
- const uniqueTerms = new Set(tokens).size;
592
- this.addFieldLength(shortDocumentId, fieldId, this._documentCount - 1, uniqueTerms);
593
- for (const term of tokens) {
594
- const processedTerm = processTerm(term, field);
595
- if (Array.isArray(processedTerm)) {
596
- for (const t of processedTerm) {
597
- this.addTerm(fieldId, shortDocumentId, t);
598
- }
599
- } else if (processedTerm) {
600
- this.addTerm(fieldId, shortDocumentId, processedTerm);
601
- }
602
- }
603
- }
604
- }
605
- /**
606
- * Adds all the given documents to the index
607
- *
608
- * @param documents An array of documents to be indexed
609
- */
610
- addAll(documents) {
611
- for (const document of documents)
612
- this.add(document);
613
- }
614
- /**
615
- * Adds all the given documents to the index asynchronously.
616
- *
617
- * Returns a promise that resolves (to `undefined`) when the indexing is done.
618
- * This method is useful when index many documents, to avoid blocking the main
619
- * thread. The indexing is performed asynchronously and in chunks.
620
- *
621
- * @param documents An array of documents to be indexed
622
- * @param options Configuration options
623
- * @return A promise resolving to `undefined` when the indexing is done
624
- */
625
- addAllAsync(documents, options = {}) {
626
- const { chunkSize = 10 } = options;
627
- const acc = { chunk: [], promise: Promise.resolve() };
628
- const { chunk, promise } = documents.reduce(({ chunk: chunk2, promise: promise2 }, document, i) => {
629
- chunk2.push(document);
630
- if ((i + 1) % chunkSize === 0) {
631
- return {
632
- chunk: [],
633
- promise: promise2.then(() => new Promise((resolve) => setTimeout(resolve, 0))).then(() => this.addAll(chunk2))
634
- };
635
- } else {
636
- return { chunk: chunk2, promise: promise2 };
637
- }
638
- }, acc);
639
- return promise.then(() => this.addAll(chunk));
640
- }
641
- /**
642
- * Removes the given document from the index.
643
- *
644
- * The document to remove must NOT have changed between indexing and removal,
645
- * otherwise the index will be corrupted.
646
- *
647
- * This method requires passing the full document to be removed (not just the
648
- * ID), and immediately removes the document from the inverted index, allowing
649
- * memory to be released. A convenient alternative is {@link
650
- * MiniSearch#discard}, which needs only the document ID, and has the same
651
- * visible effect, but delays cleaning up the index until the next vacuuming.
652
- *
653
- * @param document The document to be removed
654
- */
655
- remove(document) {
656
- const { tokenize, processTerm, extractField, stringifyField, fields, idField } = this._options;
657
- const id = extractField(document, idField);
658
- if (id == null) {
659
- throw new Error(`MiniSearch: document does not have ID field "${idField}"`);
660
- }
661
- const shortId = this._idToShortId.get(id);
662
- if (shortId == null) {
663
- throw new Error(`MiniSearch: cannot remove document with ID ${id}: it is not in the index`);
664
- }
665
- for (const field of fields) {
666
- const fieldValue = extractField(document, field);
667
- if (fieldValue == null)
668
- continue;
669
- const tokens = tokenize(stringifyField(fieldValue, field), field);
670
- const fieldId = this._fieldIds[field];
671
- const uniqueTerms = new Set(tokens).size;
672
- this.removeFieldLength(shortId, fieldId, this._documentCount, uniqueTerms);
673
- for (const term of tokens) {
674
- const processedTerm = processTerm(term, field);
675
- if (Array.isArray(processedTerm)) {
676
- for (const t of processedTerm) {
677
- this.removeTerm(fieldId, shortId, t);
678
- }
679
- } else if (processedTerm) {
680
- this.removeTerm(fieldId, shortId, processedTerm);
681
- }
682
- }
683
- }
684
- this._storedFields.delete(shortId);
685
- this._documentIds.delete(shortId);
686
- this._idToShortId.delete(id);
687
- this._fieldLength.delete(shortId);
688
- this._documentCount -= 1;
689
- }
690
- /**
691
- * Removes all the given documents from the index. If called with no arguments,
692
- * it removes _all_ documents from the index.
693
- *
694
- * @param documents The documents to be removed. If this argument is omitted,
695
- * all documents are removed. Note that, for removing all documents, it is
696
- * more efficient to call this method with no arguments than to pass all
697
- * documents.
698
- */
699
- removeAll(documents) {
700
- if (documents) {
701
- for (const document of documents)
702
- this.remove(document);
703
- } else if (arguments.length > 0) {
704
- throw new Error("Expected documents to be present. Omit the argument to remove all documents.");
705
- } else {
706
- this._index = new SearchableMap();
707
- this._documentCount = 0;
708
- this._documentIds = /* @__PURE__ */ new Map();
709
- this._idToShortId = /* @__PURE__ */ new Map();
710
- this._fieldLength = /* @__PURE__ */ new Map();
711
- this._avgFieldLength = [];
712
- this._storedFields = /* @__PURE__ */ new Map();
713
- this._nextId = 0;
714
- }
715
- }
716
- /**
717
- * Discards the document with the given ID, so it won't appear in search results
718
- *
719
- * It has the same visible effect of {@link MiniSearch.remove} (both cause the
720
- * document to stop appearing in searches), but a different effect on the
721
- * internal data structures:
722
- *
723
- * - {@link MiniSearch#remove} requires passing the full document to be
724
- * removed as argument, and removes it from the inverted index immediately.
725
- *
726
- * - {@link MiniSearch#discard} instead only needs the document ID, and
727
- * works by marking the current version of the document as discarded, so it
728
- * is immediately ignored by searches. This is faster and more convenient
729
- * than {@link MiniSearch#remove}, but the index is not immediately
730
- * modified. To take care of that, vacuuming is performed after a certain
731
- * number of documents are discarded, cleaning up the index and allowing
732
- * memory to be released.
733
- *
734
- * After discarding a document, it is possible to re-add a new version, and
735
- * only the new version will appear in searches. In other words, discarding
736
- * and re-adding a document works exactly like removing and re-adding it. The
737
- * {@link MiniSearch.replace} method can also be used to replace a document
738
- * with a new version.
739
- *
740
- * #### Details about vacuuming
741
- *
742
- * Repetite calls to this method would leave obsolete document references in
743
- * the index, invisible to searches. Two mechanisms take care of cleaning up:
744
- * clean up during search, and vacuuming.
745
- *
746
- * - Upon search, whenever a discarded ID is found (and ignored for the
747
- * results), references to the discarded document are removed from the
748
- * inverted index entries for the search terms. This ensures that subsequent
749
- * searches for the same terms do not need to skip these obsolete references
750
- * again.
751
- *
752
- * - In addition, vacuuming is performed automatically by default (see the
753
- * `autoVacuum` field in {@link Options}) after a certain number of
754
- * documents are discarded. Vacuuming traverses all terms in the index,
755
- * cleaning up all references to discarded documents. Vacuuming can also be
756
- * triggered manually by calling {@link MiniSearch#vacuum}.
757
- *
758
- * @param id The ID of the document to be discarded
759
- */
760
- discard(id) {
761
- const shortId = this._idToShortId.get(id);
762
- if (shortId == null) {
763
- throw new Error(`MiniSearch: cannot discard document with ID ${id}: it is not in the index`);
764
- }
765
- this._idToShortId.delete(id);
766
- this._documentIds.delete(shortId);
767
- this._storedFields.delete(shortId);
768
- (this._fieldLength.get(shortId) || []).forEach((fieldLength, fieldId) => {
769
- this.removeFieldLength(shortId, fieldId, this._documentCount, fieldLength);
770
- });
771
- this._fieldLength.delete(shortId);
772
- this._documentCount -= 1;
773
- this._dirtCount += 1;
774
- this.maybeAutoVacuum();
775
- }
776
- maybeAutoVacuum() {
777
- if (this._options.autoVacuum === false) {
778
- return;
779
- }
780
- const { minDirtFactor, minDirtCount, batchSize, batchWait } = this._options.autoVacuum;
781
- this.conditionalVacuum({ batchSize, batchWait }, { minDirtCount, minDirtFactor });
782
- }
783
- /**
784
- * Discards the documents with the given IDs, so they won't appear in search
785
- * results
786
- *
787
- * It is equivalent to calling {@link MiniSearch#discard} for all the given
788
- * IDs, but with the optimization of triggering at most one automatic
789
- * vacuuming at the end.
790
- *
791
- * Note: to remove all documents from the index, it is faster and more
792
- * convenient to call {@link MiniSearch.removeAll} with no argument, instead
793
- * of passing all IDs to this method.
794
- */
795
- discardAll(ids) {
796
- const autoVacuum = this._options.autoVacuum;
797
- try {
798
- this._options.autoVacuum = false;
799
- for (const id of ids) {
800
- this.discard(id);
801
- }
802
- } finally {
803
- this._options.autoVacuum = autoVacuum;
804
- }
805
- this.maybeAutoVacuum();
806
- }
807
- /**
808
- * It replaces an existing document with the given updated version
809
- *
810
- * It works by discarding the current version and adding the updated one, so
811
- * it is functionally equivalent to calling {@link MiniSearch#discard}
812
- * followed by {@link MiniSearch#add}. The ID of the updated document should
813
- * be the same as the original one.
814
- *
815
- * Since it uses {@link MiniSearch#discard} internally, this method relies on
816
- * vacuuming to clean up obsolete document references from the index, allowing
817
- * memory to be released (see {@link MiniSearch#discard}).
818
- *
819
- * @param updatedDocument The updated document to replace the old version
820
- * with
821
- */
822
- replace(updatedDocument) {
823
- const { idField, extractField } = this._options;
824
- const id = extractField(updatedDocument, idField);
825
- this.discard(id);
826
- this.add(updatedDocument);
827
- }
828
- /**
829
- * Triggers a manual vacuuming, cleaning up references to discarded documents
830
- * from the inverted index
831
- *
832
- * Vacuuming is only useful for applications that use the {@link
833
- * MiniSearch#discard} or {@link MiniSearch#replace} methods.
834
- *
835
- * By default, vacuuming is performed automatically when needed (controlled by
836
- * the `autoVacuum` field in {@link Options}), so there is usually no need to
837
- * call this method, unless one wants to make sure to perform vacuuming at a
838
- * specific moment.
839
- *
840
- * Vacuuming traverses all terms in the inverted index in batches, and cleans
841
- * up references to discarded documents from the posting list, allowing memory
842
- * to be released.
843
- *
844
- * The method takes an optional object as argument with the following keys:
845
- *
846
- * - `batchSize`: the size of each batch (1000 by default)
847
- *
848
- * - `batchWait`: the number of milliseconds to wait between batches (10 by
849
- * default)
850
- *
851
- * On large indexes, vacuuming could have a non-negligible cost: batching
852
- * avoids blocking the thread for long, diluting this cost so that it is not
853
- * negatively affecting the application. Nonetheless, this method should only
854
- * be called when necessary, and relying on automatic vacuuming is usually
855
- * better.
856
- *
857
- * It returns a promise that resolves (to undefined) when the clean up is
858
- * completed. If vacuuming is already ongoing at the time this method is
859
- * called, a new one is enqueued immediately after the ongoing one, and a
860
- * corresponding promise is returned. However, no more than one vacuuming is
861
- * enqueued on top of the ongoing one, even if this method is called more
862
- * times (enqueuing multiple ones would be useless).
863
- *
864
- * @param options Configuration options for the batch size and delay. See
865
- * {@link VacuumOptions}.
866
- */
867
- vacuum(options = {}) {
868
- return this.conditionalVacuum(options);
869
- }
870
- conditionalVacuum(options, conditions) {
871
- if (this._currentVacuum) {
872
- this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && conditions;
873
- if (this._enqueuedVacuum != null) {
874
- return this._enqueuedVacuum;
875
- }
876
- this._enqueuedVacuum = this._currentVacuum.then(() => {
877
- const conditions2 = this._enqueuedVacuumConditions;
878
- this._enqueuedVacuumConditions = defaultVacuumConditions;
879
- return this.performVacuuming(options, conditions2);
880
- });
881
- return this._enqueuedVacuum;
882
- }
883
- if (this.vacuumConditionsMet(conditions) === false) {
884
- return Promise.resolve();
885
- }
886
- this._currentVacuum = this.performVacuuming(options);
887
- return this._currentVacuum;
888
- }
889
- async performVacuuming(options, conditions) {
890
- const initialDirtCount = this._dirtCount;
891
- if (this.vacuumConditionsMet(conditions)) {
892
- const batchSize = options.batchSize || defaultVacuumOptions.batchSize;
893
- const batchWait = options.batchWait || defaultVacuumOptions.batchWait;
894
- let i = 1;
895
- for (const [term, fieldsData] of this._index) {
896
- for (const [fieldId, fieldIndex] of fieldsData) {
897
- for (const [shortId] of fieldIndex) {
898
- if (this._documentIds.has(shortId)) {
899
- continue;
900
- }
901
- if (fieldIndex.size <= 1) {
902
- fieldsData.delete(fieldId);
903
- } else {
904
- fieldIndex.delete(shortId);
905
- }
906
- }
907
- }
908
- if (this._index.get(term).size === 0) {
909
- this._index.delete(term);
910
- }
911
- if (i % batchSize === 0) {
912
- await new Promise((resolve) => setTimeout(resolve, batchWait));
913
- }
914
- i += 1;
915
- }
916
- this._dirtCount -= initialDirtCount;
917
- }
918
- await null;
919
- this._currentVacuum = this._enqueuedVacuum;
920
- this._enqueuedVacuum = null;
921
- }
922
- vacuumConditionsMet(conditions) {
923
- if (conditions == null) {
924
- return true;
925
- }
926
- let { minDirtCount, minDirtFactor } = conditions;
927
- minDirtCount = minDirtCount || defaultAutoVacuumOptions.minDirtCount;
928
- minDirtFactor = minDirtFactor || defaultAutoVacuumOptions.minDirtFactor;
929
- return this.dirtCount >= minDirtCount && this.dirtFactor >= minDirtFactor;
930
- }
931
- /**
932
- * Is `true` if a vacuuming operation is ongoing, `false` otherwise
933
- */
934
- get isVacuuming() {
935
- return this._currentVacuum != null;
936
- }
937
- /**
938
- * The number of documents discarded since the most recent vacuuming
939
- */
940
- get dirtCount() {
941
- return this._dirtCount;
942
- }
943
- /**
944
- * A number between 0 and 1 giving an indication about the proportion of
945
- * documents that are discarded, and can therefore be cleaned up by vacuuming.
946
- * A value close to 0 means that the index is relatively clean, while a higher
947
- * value means that the index is relatively dirty, and vacuuming could release
948
- * memory.
949
- */
950
- get dirtFactor() {
951
- return this._dirtCount / (1 + this._documentCount + this._dirtCount);
952
- }
953
- /**
954
- * Returns `true` if a document with the given ID is present in the index and
955
- * available for search, `false` otherwise
956
- *
957
- * @param id The document ID
958
- */
959
- has(id) {
960
- return this._idToShortId.has(id);
961
- }
962
- /**
963
- * Returns the stored fields (as configured in the `storeFields` constructor
964
- * option) for the given document ID. Returns `undefined` if the document is
965
- * not present in the index.
966
- *
967
- * @param id The document ID
968
- */
969
- getStoredFields(id) {
970
- const shortId = this._idToShortId.get(id);
971
- if (shortId == null) {
972
- return void 0;
973
- }
974
- return this._storedFields.get(shortId);
975
- }
976
- /**
977
- * Search for documents matching the given search query.
978
- *
979
- * The result is a list of scored document IDs matching the query, sorted by
980
- * descending score, and each including data about which terms were matched and
981
- * in which fields.
982
- *
983
- * ### Basic usage:
984
- *
985
- * ```javascript
986
- * // Search for "zen art motorcycle" with default options: terms have to match
987
- * // exactly, and individual terms are joined with OR
988
- * miniSearch.search('zen art motorcycle')
989
- * // => [ { id: 2, score: 2.77258, match: { ... } }, { id: 4, score: 1.38629, match: { ... } } ]
990
- * ```
991
- *
992
- * ### Restrict search to specific fields:
993
- *
994
- * ```javascript
995
- * // Search only in the 'title' field
996
- * miniSearch.search('zen', { fields: ['title'] })
997
- * ```
998
- *
999
- * ### Field boosting:
1000
- *
1001
- * ```javascript
1002
- * // Boost a field
1003
- * miniSearch.search('zen', { boost: { title: 2 } })
1004
- * ```
1005
- *
1006
- * ### Prefix search:
1007
- *
1008
- * ```javascript
1009
- * // Search for "moto" with prefix search (it will match documents
1010
- * // containing terms that start with "moto" or "neuro")
1011
- * miniSearch.search('moto neuro', { prefix: true })
1012
- * ```
1013
- *
1014
- * ### Fuzzy search:
1015
- *
1016
- * ```javascript
1017
- * // Search for "ismael" with fuzzy search (it will match documents containing
1018
- * // terms similar to "ismael", with a maximum edit distance of 0.2 term.length
1019
- * // (rounded to nearest integer)
1020
- * miniSearch.search('ismael', { fuzzy: 0.2 })
1021
- * ```
1022
- *
1023
- * ### Combining strategies:
1024
- *
1025
- * ```javascript
1026
- * // Mix of exact match, prefix search, and fuzzy search
1027
- * miniSearch.search('ismael mob', {
1028
- * prefix: true,
1029
- * fuzzy: 0.2
1030
- * })
1031
- * ```
1032
- *
1033
- * ### Advanced prefix and fuzzy search:
1034
- *
1035
- * ```javascript
1036
- * // Perform fuzzy and prefix search depending on the search term. Here
1037
- * // performing prefix and fuzzy search only on terms longer than 3 characters
1038
- * miniSearch.search('ismael mob', {
1039
- * prefix: term => term.length > 3
1040
- * fuzzy: term => term.length > 3 ? 0.2 : null
1041
- * })
1042
- * ```
1043
- *
1044
- * ### Combine with AND:
1045
- *
1046
- * ```javascript
1047
- * // Combine search terms with AND (to match only documents that contain both
1048
- * // "motorcycle" and "art")
1049
- * miniSearch.search('motorcycle art', { combineWith: 'AND' })
1050
- * ```
1051
- *
1052
- * ### Combine with AND_NOT:
1053
- *
1054
- * There is also an AND_NOT combinator, that finds documents that match the
1055
- * first term, but do not match any of the other terms. This combinator is
1056
- * rarely useful with simple queries, and is meant to be used with advanced
1057
- * query combinations (see later for more details).
1058
- *
1059
- * ### Filtering results:
1060
- *
1061
- * ```javascript
1062
- * // Filter only results in the 'fiction' category (assuming that 'category'
1063
- * // is a stored field)
1064
- * miniSearch.search('motorcycle art', {
1065
- * filter: (result) => result.category === 'fiction'
1066
- * })
1067
- * ```
1068
- *
1069
- * ### Wildcard query
1070
- *
1071
- * Searching for an empty string (assuming the default tokenizer) returns no
1072
- * results. Sometimes though, one needs to match all documents, like in a
1073
- * "wildcard" search. This is possible by passing the special value
1074
- * {@link MiniSearch.wildcard} as the query:
1075
- *
1076
- * ```javascript
1077
- * // Return search results for all documents
1078
- * miniSearch.search(MiniSearch.wildcard)
1079
- * ```
1080
- *
1081
- * Note that search options such as `filter` and `boostDocument` are still
1082
- * applied, influencing which results are returned, and their order:
1083
- *
1084
- * ```javascript
1085
- * // Return search results for all documents in the 'fiction' category
1086
- * miniSearch.search(MiniSearch.wildcard, {
1087
- * filter: (result) => result.category === 'fiction'
1088
- * })
1089
- * ```
1090
- *
1091
- * ### Advanced combination of queries:
1092
- *
1093
- * It is possible to combine different subqueries with OR, AND, and AND_NOT,
1094
- * and even with different search options, by passing a query expression
1095
- * tree object as the first argument, instead of a string.
1096
- *
1097
- * ```javascript
1098
- * // Search for documents that contain "zen" and ("motorcycle" or "archery")
1099
- * miniSearch.search({
1100
- * combineWith: 'AND',
1101
- * queries: [
1102
- * 'zen',
1103
- * {
1104
- * combineWith: 'OR',
1105
- * queries: ['motorcycle', 'archery']
1106
- * }
1107
- * ]
1108
- * })
1109
- *
1110
- * // Search for documents that contain ("apple" or "pear") but not "juice" and
1111
- * // not "tree"
1112
- * miniSearch.search({
1113
- * combineWith: 'AND_NOT',
1114
- * queries: [
1115
- * {
1116
- * combineWith: 'OR',
1117
- * queries: ['apple', 'pear']
1118
- * },
1119
- * 'juice',
1120
- * 'tree'
1121
- * ]
1122
- * })
1123
- * ```
1124
- *
1125
- * Each node in the expression tree can be either a string, or an object that
1126
- * supports all {@link SearchOptions} fields, plus a `queries` array field for
1127
- * subqueries.
1128
- *
1129
- * Note that, while this can become complicated to do by hand for complex or
1130
- * deeply nested queries, it provides a formalized expression tree API for
1131
- * external libraries that implement a parser for custom query languages.
1132
- *
1133
- * @param query Search query
1134
- * @param searchOptions Search options. Each option, if not given, defaults to the corresponding value of `searchOptions` given to the constructor, or to the library default.
1135
- */
1136
- search(query, searchOptions = {}) {
1137
- const { searchOptions: globalSearchOptions } = this._options;
1138
- const searchOptionsWithDefaults = { ...globalSearchOptions, ...searchOptions };
1139
- const rawResults = this.executeQuery(query, searchOptions);
1140
- const results = [];
1141
- for (const [docId, { score, terms, match }] of rawResults) {
1142
- const quality = terms.length || 1;
1143
- const result = {
1144
- id: this._documentIds.get(docId),
1145
- score: score * quality,
1146
- terms: Object.keys(match),
1147
- queryTerms: terms,
1148
- match
1149
- };
1150
- Object.assign(result, this._storedFields.get(docId));
1151
- if (searchOptionsWithDefaults.filter == null || searchOptionsWithDefaults.filter(result)) {
1152
- results.push(result);
1153
- }
1154
- }
1155
- if (query === _MiniSearch.wildcard && searchOptionsWithDefaults.boostDocument == null) {
1156
- return results;
1157
- }
1158
- results.sort(byScore);
1159
- return results;
1160
- }
1161
- /**
1162
- * Provide suggestions for the given search query
1163
- *
1164
- * The result is a list of suggested modified search queries, derived from the
1165
- * given search query, each with a relevance score, sorted by descending score.
1166
- *
1167
- * By default, it uses the same options used for search, except that by
1168
- * default it performs prefix search on the last term of the query, and
1169
- * combine terms with `'AND'` (requiring all query terms to match). Custom
1170
- * options can be passed as a second argument. Defaults can be changed upon
1171
- * calling the {@link MiniSearch} constructor, by passing a
1172
- * `autoSuggestOptions` option.
1173
- *
1174
- * ### Basic usage:
1175
- *
1176
- * ```javascript
1177
- * // Get suggestions for 'neuro':
1178
- * miniSearch.autoSuggest('neuro')
1179
- * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 0.46240 } ]
1180
- * ```
1181
- *
1182
- * ### Multiple words:
1183
- *
1184
- * ```javascript
1185
- * // Get suggestions for 'zen ar':
1186
- * miniSearch.autoSuggest('zen ar')
1187
- * // => [
1188
- * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 },
1189
- * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 }
1190
- * // ]
1191
- * ```
1192
- *
1193
- * ### Fuzzy suggestions:
1194
- *
1195
- * ```javascript
1196
- * // Correct spelling mistakes using fuzzy search:
1197
- * miniSearch.autoSuggest('neromancer', { fuzzy: 0.2 })
1198
- * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 1.03998 } ]
1199
- * ```
1200
- *
1201
- * ### Filtering:
1202
- *
1203
- * ```javascript
1204
- * // Get suggestions for 'zen ar', but only within the 'fiction' category
1205
- * // (assuming that 'category' is a stored field):
1206
- * miniSearch.autoSuggest('zen ar', {
1207
- * filter: (result) => result.category === 'fiction'
1208
- * })
1209
- * // => [
1210
- * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 },
1211
- * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 }
1212
- * // ]
1213
- * ```
1214
- *
1215
- * @param queryString Query string to be expanded into suggestions
1216
- * @param options Search options. The supported options and default values
1217
- * are the same as for the {@link MiniSearch#search} method, except that by
1218
- * default prefix search is performed on the last term in the query, and terms
1219
- * are combined with `'AND'`.
1220
- * @return A sorted array of suggestions sorted by relevance score.
1221
- */
1222
- autoSuggest(queryString, options = {}) {
1223
- options = { ...this._options.autoSuggestOptions, ...options };
1224
- const suggestions = /* @__PURE__ */ new Map();
1225
- for (const { score, terms } of this.search(queryString, options)) {
1226
- const phrase = terms.join(" ");
1227
- const suggestion = suggestions.get(phrase);
1228
- if (suggestion != null) {
1229
- suggestion.score += score;
1230
- suggestion.count += 1;
1231
- } else {
1232
- suggestions.set(phrase, { score, terms, count: 1 });
1233
- }
1234
- }
1235
- const results = [];
1236
- for (const [suggestion, { score, terms, count }] of suggestions) {
1237
- results.push({ suggestion, terms, score: score / count });
1238
- }
1239
- results.sort(byScore);
1240
- return results;
1241
- }
1242
- /**
1243
- * Total number of documents available to search
1244
- */
1245
- get documentCount() {
1246
- return this._documentCount;
1247
- }
1248
- /**
1249
- * Number of terms in the index
1250
- */
1251
- get termCount() {
1252
- return this._index.size;
1253
- }
1254
- /**
1255
- * Deserializes a JSON index (serialized with `JSON.stringify(miniSearch)`)
1256
- * and instantiates a MiniSearch instance. It should be given the same options
1257
- * originally used when serializing the index.
1258
- *
1259
- * ### Usage:
1260
- *
1261
- * ```javascript
1262
- * // If the index was serialized with:
1263
- * let miniSearch = new MiniSearch({ fields: ['title', 'text'] })
1264
- * miniSearch.addAll(documents)
1265
- *
1266
- * const json = JSON.stringify(miniSearch)
1267
- * // It can later be deserialized like this:
1268
- * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] })
1269
- * ```
1270
- *
1271
- * @param json JSON-serialized index
1272
- * @param options configuration options, same as the constructor
1273
- * @return An instance of MiniSearch deserialized from the given JSON.
1274
- */
1275
- static loadJSON(json, options) {
1276
- if (options == null) {
1277
- throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
1278
- }
1279
- return this.loadJS(JSON.parse(json), options);
1280
- }
1281
- /**
1282
- * Async equivalent of {@link MiniSearch.loadJSON}
1283
- *
1284
- * This function is an alternative to {@link MiniSearch.loadJSON} that returns
1285
- * a promise, and loads the index in batches, leaving pauses between them to avoid
1286
- * blocking the main thread. It tends to be slower than the synchronous
1287
- * version, but does not block the main thread, so it can be a better choice
1288
- * when deserializing very large indexes.
1289
- *
1290
- * @param json JSON-serialized index
1291
- * @param options configuration options, same as the constructor
1292
- * @return A Promise that will resolve to an instance of MiniSearch deserialized from the given JSON.
1293
- */
1294
- static async loadJSONAsync(json, options) {
1295
- if (options == null) {
1296
- throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
1297
- }
1298
- return this.loadJSAsync(JSON.parse(json), options);
1299
- }
1300
- /**
1301
- * Returns the default value of an option. It will throw an error if no option
1302
- * with the given name exists.
1303
- *
1304
- * @param optionName Name of the option
1305
- * @return The default value of the given option
1306
- *
1307
- * ### Usage:
1308
- *
1309
- * ```javascript
1310
- * // Get default tokenizer
1311
- * MiniSearch.getDefault('tokenize')
1312
- *
1313
- * // Get default term processor
1314
- * MiniSearch.getDefault('processTerm')
1315
- *
1316
- * // Unknown options will throw an error
1317
- * MiniSearch.getDefault('notExisting')
1318
- * // => throws 'MiniSearch: unknown option "notExisting"'
1319
- * ```
1320
- */
1321
- static getDefault(optionName) {
1322
- if (defaultOptions.hasOwnProperty(optionName)) {
1323
- return getOwnProperty(defaultOptions, optionName);
1324
- } else {
1325
- throw new Error(`MiniSearch: unknown option "${optionName}"`);
1326
- }
1327
- }
1328
- /**
1329
- * @ignore
1330
- */
1331
- static loadJS(js, options) {
1332
- const { index, documentIds, fieldLength, storedFields, serializationVersion } = js;
1333
- const miniSearch = this.instantiateMiniSearch(js, options);
1334
- miniSearch._documentIds = objectToNumericMap(documentIds);
1335
- miniSearch._fieldLength = objectToNumericMap(fieldLength);
1336
- miniSearch._storedFields = objectToNumericMap(storedFields);
1337
- for (const [shortId, id] of miniSearch._documentIds) {
1338
- miniSearch._idToShortId.set(id, shortId);
1339
- }
1340
- for (const [term, data] of index) {
1341
- const dataMap = /* @__PURE__ */ new Map();
1342
- for (const fieldId of Object.keys(data)) {
1343
- let indexEntry = data[fieldId];
1344
- if (serializationVersion === 1) {
1345
- indexEntry = indexEntry.ds;
1346
- }
1347
- dataMap.set(parseInt(fieldId, 10), objectToNumericMap(indexEntry));
1348
- }
1349
- miniSearch._index.set(term, dataMap);
1350
- }
1351
- return miniSearch;
1352
- }
1353
- /**
1354
- * @ignore
1355
- */
1356
- static async loadJSAsync(js, options) {
1357
- const { index, documentIds, fieldLength, storedFields, serializationVersion } = js;
1358
- const miniSearch = this.instantiateMiniSearch(js, options);
1359
- miniSearch._documentIds = await objectToNumericMapAsync(documentIds);
1360
- miniSearch._fieldLength = await objectToNumericMapAsync(fieldLength);
1361
- miniSearch._storedFields = await objectToNumericMapAsync(storedFields);
1362
- for (const [shortId, id] of miniSearch._documentIds) {
1363
- miniSearch._idToShortId.set(id, shortId);
1364
- }
1365
- let count = 0;
1366
- for (const [term, data] of index) {
1367
- const dataMap = /* @__PURE__ */ new Map();
1368
- for (const fieldId of Object.keys(data)) {
1369
- let indexEntry = data[fieldId];
1370
- if (serializationVersion === 1) {
1371
- indexEntry = indexEntry.ds;
1372
- }
1373
- dataMap.set(parseInt(fieldId, 10), await objectToNumericMapAsync(indexEntry));
1374
- }
1375
- if (++count % 1e3 === 0)
1376
- await wait(0);
1377
- miniSearch._index.set(term, dataMap);
1378
- }
1379
- return miniSearch;
1380
- }
1381
- /**
1382
- * @ignore
1383
- */
1384
- static instantiateMiniSearch(js, options) {
1385
- const { documentCount, nextId, fieldIds, averageFieldLength, dirtCount, serializationVersion } = js;
1386
- if (serializationVersion !== 1 && serializationVersion !== 2) {
1387
- throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");
1388
- }
1389
- const miniSearch = new _MiniSearch(options);
1390
- miniSearch._documentCount = documentCount;
1391
- miniSearch._nextId = nextId;
1392
- miniSearch._idToShortId = /* @__PURE__ */ new Map();
1393
- miniSearch._fieldIds = fieldIds;
1394
- miniSearch._avgFieldLength = averageFieldLength;
1395
- miniSearch._dirtCount = dirtCount || 0;
1396
- miniSearch._index = new SearchableMap();
1397
- return miniSearch;
1398
- }
1399
- /**
1400
- * @ignore
1401
- */
1402
- executeQuery(query, searchOptions = {}) {
1403
- if (query === _MiniSearch.wildcard) {
1404
- return this.executeWildcardQuery(searchOptions);
1405
- }
1406
- if (typeof query !== "string") {
1407
- const options2 = { ...searchOptions, ...query, queries: void 0 };
1408
- const results2 = query.queries.map((subquery) => this.executeQuery(subquery, options2));
1409
- return this.combineResults(results2, options2.combineWith);
1410
- }
1411
- const { tokenize, processTerm, searchOptions: globalSearchOptions } = this._options;
1412
- const options = { tokenize, processTerm, ...globalSearchOptions, ...searchOptions };
1413
- const { tokenize: searchTokenize, processTerm: searchProcessTerm } = options;
1414
- const terms = searchTokenize(query).flatMap((term) => searchProcessTerm(term)).filter((term) => !!term);
1415
- const queries = terms.map(termToQuerySpec(options));
1416
- const results = queries.map((query2) => this.executeQuerySpec(query2, options));
1417
- return this.combineResults(results, options.combineWith);
1418
- }
1419
- /**
1420
- * @ignore
1421
- */
1422
- executeQuerySpec(query, searchOptions) {
1423
- const options = { ...this._options.searchOptions, ...searchOptions };
1424
- const boosts = (options.fields || this._options.fields).reduce((boosts2, field) => ({ ...boosts2, [field]: getOwnProperty(options.boost, field) || 1 }), {});
1425
- const { boostDocument, weights, maxFuzzy, bm25: bm25params } = options;
1426
- const { fuzzy: fuzzyWeight, prefix: prefixWeight } = { ...defaultSearchOptions.weights, ...weights };
1427
- const data = this._index.get(query.term);
1428
- const results = this.termResults(query.term, query.term, 1, query.termBoost, data, boosts, boostDocument, bm25params);
1429
- let prefixMatches;
1430
- let fuzzyMatches;
1431
- if (query.prefix) {
1432
- prefixMatches = this._index.atPrefix(query.term);
1433
- }
1434
- if (query.fuzzy) {
1435
- const fuzzy = query.fuzzy === true ? 0.2 : query.fuzzy;
1436
- const maxDistance = fuzzy < 1 ? Math.min(maxFuzzy, Math.round(query.term.length * fuzzy)) : fuzzy;
1437
- if (maxDistance)
1438
- fuzzyMatches = this._index.fuzzyGet(query.term, maxDistance);
1439
- }
1440
- if (prefixMatches) {
1441
- for (const [term, data2] of prefixMatches) {
1442
- const distance = term.length - query.term.length;
1443
- if (!distance) {
1444
- continue;
1445
- }
1446
- fuzzyMatches === null || fuzzyMatches === void 0 ? void 0 : fuzzyMatches.delete(term);
1447
- const weight = prefixWeight * term.length / (term.length + 0.3 * distance);
1448
- this.termResults(query.term, term, weight, query.termBoost, data2, boosts, boostDocument, bm25params, results);
1449
- }
1450
- }
1451
- if (fuzzyMatches) {
1452
- for (const term of fuzzyMatches.keys()) {
1453
- const [data2, distance] = fuzzyMatches.get(term);
1454
- if (!distance) {
1455
- continue;
1456
- }
1457
- const weight = fuzzyWeight * term.length / (term.length + distance);
1458
- this.termResults(query.term, term, weight, query.termBoost, data2, boosts, boostDocument, bm25params, results);
1459
- }
1460
- }
1461
- return results;
1462
- }
1463
- /**
1464
- * @ignore
1465
- */
1466
- executeWildcardQuery(searchOptions) {
1467
- const results = /* @__PURE__ */ new Map();
1468
- const options = { ...this._options.searchOptions, ...searchOptions };
1469
- for (const [shortId, id] of this._documentIds) {
1470
- const score = options.boostDocument ? options.boostDocument(id, "", this._storedFields.get(shortId)) : 1;
1471
- results.set(shortId, {
1472
- score,
1473
- terms: [],
1474
- match: {}
1475
- });
1476
- }
1477
- return results;
1478
- }
1479
- /**
1480
- * @ignore
1481
- */
1482
- combineResults(results, combineWith = OR) {
1483
- if (results.length === 0) {
1484
- return /* @__PURE__ */ new Map();
1485
- }
1486
- const operator = combineWith.toLowerCase();
1487
- const combinator = combinators[operator];
1488
- if (!combinator) {
1489
- throw new Error(`Invalid combination operator: ${combineWith}`);
1490
- }
1491
- return results.reduce(combinator) || /* @__PURE__ */ new Map();
1492
- }
1493
- /**
1494
- * Allows serialization of the index to JSON, to possibly store it and later
1495
- * deserialize it with {@link MiniSearch.loadJSON}.
1496
- *
1497
- * Normally one does not directly call this method, but rather call the
1498
- * standard JavaScript `JSON.stringify()` passing the {@link MiniSearch}
1499
- * instance, and JavaScript will internally call this method. Upon
1500
- * deserialization, one must pass to {@link MiniSearch.loadJSON} the same
1501
- * options used to create the original instance that was serialized.
1502
- *
1503
- * ### Usage:
1504
- *
1505
- * ```javascript
1506
- * // Serialize the index:
1507
- * let miniSearch = new MiniSearch({ fields: ['title', 'text'] })
1508
- * miniSearch.addAll(documents)
1509
- * const json = JSON.stringify(miniSearch)
1510
- *
1511
- * // Later, to deserialize it:
1512
- * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] })
1513
- * ```
1514
- *
1515
- * @return A plain-object serializable representation of the search index.
1516
- */
1517
- toJSON() {
1518
- const index = [];
1519
- for (const [term, fieldIndex] of this._index) {
1520
- const data = {};
1521
- for (const [fieldId, freqs] of fieldIndex) {
1522
- data[fieldId] = Object.fromEntries(freqs);
1523
- }
1524
- index.push([term, data]);
1525
- }
1526
- return {
1527
- documentCount: this._documentCount,
1528
- nextId: this._nextId,
1529
- documentIds: Object.fromEntries(this._documentIds),
1530
- fieldIds: this._fieldIds,
1531
- fieldLength: Object.fromEntries(this._fieldLength),
1532
- averageFieldLength: this._avgFieldLength,
1533
- storedFields: Object.fromEntries(this._storedFields),
1534
- dirtCount: this._dirtCount,
1535
- index,
1536
- serializationVersion: 2
1537
- };
1538
- }
1539
- /**
1540
- * @ignore
1541
- */
1542
- termResults(sourceTerm, derivedTerm, termWeight, termBoost, fieldTermData, fieldBoosts, boostDocumentFn, bm25params, results = /* @__PURE__ */ new Map()) {
1543
- if (fieldTermData == null)
1544
- return results;
1545
- for (const field of Object.keys(fieldBoosts)) {
1546
- const fieldBoost = fieldBoosts[field];
1547
- const fieldId = this._fieldIds[field];
1548
- const fieldTermFreqs = fieldTermData.get(fieldId);
1549
- if (fieldTermFreqs == null)
1550
- continue;
1551
- let matchingFields = fieldTermFreqs.size;
1552
- const avgFieldLength = this._avgFieldLength[fieldId];
1553
- for (const docId of fieldTermFreqs.keys()) {
1554
- if (!this._documentIds.has(docId)) {
1555
- this.removeTerm(fieldId, docId, derivedTerm);
1556
- matchingFields -= 1;
1557
- continue;
1558
- }
1559
- const docBoost = boostDocumentFn ? boostDocumentFn(this._documentIds.get(docId), derivedTerm, this._storedFields.get(docId)) : 1;
1560
- if (!docBoost)
1561
- continue;
1562
- const termFreq = fieldTermFreqs.get(docId);
1563
- const fieldLength = this._fieldLength.get(docId)[fieldId];
1564
- const rawScore = calcBM25Score(termFreq, matchingFields, this._documentCount, fieldLength, avgFieldLength, bm25params);
1565
- const weightedScore = termWeight * termBoost * fieldBoost * docBoost * rawScore;
1566
- const result = results.get(docId);
1567
- if (result) {
1568
- result.score += weightedScore;
1569
- assignUniqueTerm(result.terms, sourceTerm);
1570
- const match = getOwnProperty(result.match, derivedTerm);
1571
- if (match) {
1572
- match.push(field);
1573
- } else {
1574
- result.match[derivedTerm] = [field];
1575
- }
1576
- } else {
1577
- results.set(docId, {
1578
- score: weightedScore,
1579
- terms: [sourceTerm],
1580
- match: { [derivedTerm]: [field] }
1581
- });
1582
- }
1583
- }
1584
- }
1585
- return results;
1586
- }
1587
- /**
1588
- * @ignore
1589
- */
1590
- addTerm(fieldId, documentId, term) {
1591
- const indexData = this._index.fetch(term, createMap);
1592
- let fieldIndex = indexData.get(fieldId);
1593
- if (fieldIndex == null) {
1594
- fieldIndex = /* @__PURE__ */ new Map();
1595
- fieldIndex.set(documentId, 1);
1596
- indexData.set(fieldId, fieldIndex);
1597
- } else {
1598
- const docs = fieldIndex.get(documentId);
1599
- fieldIndex.set(documentId, (docs || 0) + 1);
1600
- }
1601
- }
1602
- /**
1603
- * @ignore
1604
- */
1605
- removeTerm(fieldId, documentId, term) {
1606
- if (!this._index.has(term)) {
1607
- this.warnDocumentChanged(documentId, fieldId, term);
1608
- return;
1609
- }
1610
- const indexData = this._index.fetch(term, createMap);
1611
- const fieldIndex = indexData.get(fieldId);
1612
- if (fieldIndex == null || fieldIndex.get(documentId) == null) {
1613
- this.warnDocumentChanged(documentId, fieldId, term);
1614
- } else if (fieldIndex.get(documentId) <= 1) {
1615
- if (fieldIndex.size <= 1) {
1616
- indexData.delete(fieldId);
1617
- } else {
1618
- fieldIndex.delete(documentId);
1619
- }
1620
- } else {
1621
- fieldIndex.set(documentId, fieldIndex.get(documentId) - 1);
1622
- }
1623
- if (this._index.get(term).size === 0) {
1624
- this._index.delete(term);
1625
- }
1626
- }
1627
- /**
1628
- * @ignore
1629
- */
1630
- warnDocumentChanged(shortDocumentId, fieldId, term) {
1631
- for (const fieldName of Object.keys(this._fieldIds)) {
1632
- if (this._fieldIds[fieldName] === fieldId) {
1633
- this._options.logger("warn", `MiniSearch: document with ID ${this._documentIds.get(shortDocumentId)} has changed before removal: term "${term}" was not present in field "${fieldName}". Removing a document after it has changed can corrupt the index!`, "version_conflict");
1634
- return;
1635
- }
1636
- }
1637
- }
1638
- /**
1639
- * @ignore
1640
- */
1641
- addDocumentId(documentId) {
1642
- const shortDocumentId = this._nextId;
1643
- this._idToShortId.set(documentId, shortDocumentId);
1644
- this._documentIds.set(shortDocumentId, documentId);
1645
- this._documentCount += 1;
1646
- this._nextId += 1;
1647
- return shortDocumentId;
1648
- }
1649
- /**
1650
- * @ignore
1651
- */
1652
- addFields(fields) {
1653
- for (let i = 0; i < fields.length; i++) {
1654
- this._fieldIds[fields[i]] = i;
1655
- }
1656
- }
1657
- /**
1658
- * @ignore
1659
- */
1660
- addFieldLength(documentId, fieldId, count, length) {
1661
- let fieldLengths = this._fieldLength.get(documentId);
1662
- if (fieldLengths == null)
1663
- this._fieldLength.set(documentId, fieldLengths = []);
1664
- fieldLengths[fieldId] = length;
1665
- const averageFieldLength = this._avgFieldLength[fieldId] || 0;
1666
- const totalFieldLength = averageFieldLength * count + length;
1667
- this._avgFieldLength[fieldId] = totalFieldLength / (count + 1);
1668
- }
1669
- /**
1670
- * @ignore
1671
- */
1672
- removeFieldLength(documentId, fieldId, count, length) {
1673
- if (count === 1) {
1674
- this._avgFieldLength[fieldId] = 0;
1675
- return;
1676
- }
1677
- const totalFieldLength = this._avgFieldLength[fieldId] * count - length;
1678
- this._avgFieldLength[fieldId] = totalFieldLength / (count - 1);
1679
- }
1680
- /**
1681
- * @ignore
1682
- */
1683
- saveStoredFields(documentId, doc) {
1684
- const { storeFields, extractField } = this._options;
1685
- if (storeFields == null || storeFields.length === 0) {
1686
- return;
1687
- }
1688
- let documentFields = this._storedFields.get(documentId);
1689
- if (documentFields == null)
1690
- this._storedFields.set(documentId, documentFields = {});
1691
- for (const fieldName of storeFields) {
1692
- const fieldValue = extractField(doc, fieldName);
1693
- if (fieldValue !== void 0)
1694
- documentFields[fieldName] = fieldValue;
1695
- }
1696
- }
1697
- };
1698
- MiniSearch.wildcard = Symbol("*");
1699
- var getOwnProperty = (object, property) => Object.prototype.hasOwnProperty.call(object, property) ? object[property] : void 0;
1700
- var combinators = {
1701
- [OR]: (a, b) => {
1702
- for (const docId of b.keys()) {
1703
- const existing = a.get(docId);
1704
- if (existing == null) {
1705
- a.set(docId, b.get(docId));
1706
- } else {
1707
- const { score, terms, match } = b.get(docId);
1708
- existing.score = existing.score + score;
1709
- existing.match = Object.assign(existing.match, match);
1710
- assignUniqueTerms(existing.terms, terms);
1711
- }
1712
- }
1713
- return a;
1714
- },
1715
- [AND]: (a, b) => {
1716
- const combined = /* @__PURE__ */ new Map();
1717
- for (const docId of b.keys()) {
1718
- const existing = a.get(docId);
1719
- if (existing == null)
1720
- continue;
1721
- const { score, terms, match } = b.get(docId);
1722
- assignUniqueTerms(existing.terms, terms);
1723
- combined.set(docId, {
1724
- score: existing.score + score,
1725
- terms: existing.terms,
1726
- match: Object.assign(existing.match, match)
1727
- });
1728
- }
1729
- return combined;
1730
- },
1731
- [AND_NOT]: (a, b) => {
1732
- for (const docId of b.keys())
1733
- a.delete(docId);
1734
- return a;
1735
- }
1736
- };
1737
- var defaultBM25params = { k: 1.2, b: 0.7, d: 0.5 };
1738
- var calcBM25Score = (termFreq, matchingCount, totalCount, fieldLength, avgFieldLength, bm25params) => {
1739
- const { k, b, d } = bm25params;
1740
- const invDocFreq = Math.log(1 + (totalCount - matchingCount + 0.5) / (matchingCount + 0.5));
1741
- return invDocFreq * (d + termFreq * (k + 1) / (termFreq + k * (1 - b + b * fieldLength / avgFieldLength)));
1742
- };
1743
- var termToQuerySpec = (options) => (term, i, terms) => {
1744
- const fuzzy = typeof options.fuzzy === "function" ? options.fuzzy(term, i, terms) : options.fuzzy || false;
1745
- const prefix = typeof options.prefix === "function" ? options.prefix(term, i, terms) : options.prefix === true;
1746
- const termBoost = typeof options.boostTerm === "function" ? options.boostTerm(term, i, terms) : 1;
1747
- return { term, fuzzy, prefix, termBoost };
1748
- };
1749
- var defaultOptions = {
1750
- idField: "id",
1751
- extractField: (document, fieldName) => document[fieldName],
1752
- stringifyField: (fieldValue, fieldName) => fieldValue.toString(),
1753
- tokenize: (text) => text.split(SPACE_OR_PUNCTUATION),
1754
- processTerm: (term) => term.toLowerCase(),
1755
- fields: void 0,
1756
- searchOptions: void 0,
1757
- storeFields: [],
1758
- logger: (level, message) => {
1759
- if (typeof (console === null || console === void 0 ? void 0 : console[level]) === "function")
1760
- console[level](message);
1761
- },
1762
- autoVacuum: true
1763
- };
1764
- var defaultSearchOptions = {
1765
- combineWith: OR,
1766
- prefix: false,
1767
- fuzzy: false,
1768
- maxFuzzy: 6,
1769
- boost: {},
1770
- weights: { fuzzy: 0.45, prefix: 0.375 },
1771
- bm25: defaultBM25params
1772
- };
1773
- var defaultAutoSuggestOptions = {
1774
- combineWith: AND,
1775
- prefix: (term, i, terms) => i === terms.length - 1
1776
- };
1777
- var defaultVacuumOptions = { batchSize: 1e3, batchWait: 10 };
1778
- var defaultVacuumConditions = { minDirtFactor: 0.1, minDirtCount: 20 };
1779
- var defaultAutoVacuumOptions = { ...defaultVacuumOptions, ...defaultVacuumConditions };
1780
- var assignUniqueTerm = (target, term) => {
1781
- if (!target.includes(term))
1782
- target.push(term);
1783
- };
1784
- var assignUniqueTerms = (target, source) => {
1785
- for (const term of source) {
1786
- if (!target.includes(term))
1787
- target.push(term);
1788
- }
1789
- };
1790
- var byScore = ({ score: a }, { score: b }) => b - a;
1791
- var createMap = () => /* @__PURE__ */ new Map();
1792
- var objectToNumericMap = (object) => {
1793
- const map = /* @__PURE__ */ new Map();
1794
- for (const key of Object.keys(object)) {
1795
- map.set(parseInt(key, 10), object[key]);
1796
- }
1797
- return map;
1798
- };
1799
- var objectToNumericMapAsync = async (object) => {
1800
- const map = /* @__PURE__ */ new Map();
1801
- let count = 0;
1802
- for (const key of Object.keys(object)) {
1803
- map.set(parseInt(key, 10), object[key]);
1804
- if (++count % 1e3 === 0) {
1805
- await wait(0);
1806
- }
1807
- }
1808
- return map;
1809
- };
1810
- var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1811
- var SPACE_OR_PUNCTUATION = /[\n\r\p{Z}\p{P}]+/u;
1812
- export {
1813
- MiniSearch as default
1814
- };
1815
- //# sourceMappingURL=vitepress___minisearch.js.map