@delali/narsil 0.3.1-next.152 → 0.3.1-next.154

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 (268) hide show
  1. package/README.md +2 -1
  2. package/dist/adapters/filesystem.mjs +2 -2
  3. package/dist/adapters/gcs.mjs +2 -2
  4. package/dist/adapters/indexeddb.mjs +1 -1
  5. package/dist/adapters/s3.mjs +2 -2
  6. package/dist/{analysis-change-2OYM7ARW.mjs → analysis-change-4GCRVRBW.mjs} +27 -18
  7. package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KYGSXW4K.mjs} +1 -1
  8. package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-IXWPXXJJ.mjs} +17 -7
  9. package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-FCSHFQSS.mjs} +1 -1
  10. package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-2FX6ROWR.mjs} +15 -6
  11. package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-2SHAKW2Z.mjs} +119 -1922
  12. package/dist/browser/{chunk-55WYRLDZ.mjs → chunk-3U3QR5YP.mjs} +2 -2
  13. package/dist/browser/chunk-4PD752F6.mjs +85 -0
  14. package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
  15. package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-7MEYN7V6.mjs} +1 -151
  16. package/dist/browser/chunk-7TTWXUH6.mjs +1828 -0
  17. package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-AJ4HHOVT.mjs} +4 -4
  18. package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-AYY6PIKL.mjs} +2 -2
  19. package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-C4KS2QNF.mjs} +9 -8
  20. package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
  21. package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
  22. package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-EUNBNLKM.mjs} +6 -5
  23. package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-G7LUMBSG.mjs} +137 -253
  24. package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-H6QFBMVE.mjs} +3 -2
  25. package/dist/browser/chunk-J433A7P3.mjs +241 -0
  26. package/dist/browser/chunk-ML6HY7T7.mjs +96 -0
  27. package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
  28. package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-MYITLCHT.mjs} +7 -1
  29. package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-QXTPSX2H.mjs} +9 -150
  30. package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
  31. package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SIR3LMTV.mjs} +2 -2
  32. package/dist/browser/{chunk-LURXVCHG.mjs → chunk-SJB6VIZG.mjs} +1 -1
  33. package/dist/browser/chunk-TTD27VXX.mjs +298 -0
  34. package/dist/browser/chunk-U2E3HMYW.mjs +151 -0
  35. package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-VCOYGVP7.mjs} +5 -31
  36. package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
  37. package/dist/browser/chunk-W5X2UFWQ.mjs +102 -0
  38. package/dist/browser/{chunk-HT7J73QL.mjs → chunk-XRV72TJD.mjs} +2 -2
  39. package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
  40. package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
  41. package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-ZPTA75ZC.mjs} +2 -79
  42. package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-VTUGDYNY.mjs} +20 -14
  43. package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-GL4A7KDV.mjs} +1886 -1364
  44. package/dist/browser/import-YI5GNB4H.mjs +17 -0
  45. package/dist/browser/methods-LMUTS7OI.mjs +30 -0
  46. package/dist/browser/{module-XQLEOYNM.mjs → module-EC3FYW7N.mjs} +9 -8
  47. package/dist/browser/{module-KAMRAJLE.mjs → module-M4JNBV6V.mjs} +16 -10
  48. package/dist/browser/operations-WVYLF72Q.mjs +5 -0
  49. package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-NPYUVX75.mjs} +1 -1
  50. package/dist/browser/{pool-DTYSPBMQ.mjs → pool-WCGDZHJP.mjs} +3 -2
  51. package/dist/{restore-queue-AOF5OTQV.mjs → browser/restore-queue-TYIGDL5L.mjs} +2 -2
  52. package/dist/browser/retention-6QMRS5VK.mjs +207 -0
  53. package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-3EW2AGB6.mjs} +1 -1
  54. package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-DN3CRVUQ.mjs} +38 -307
  55. package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
  56. package/dist/browser/{write-I5P5MW4O.mjs → write-WAWAFGKQ.mjs} +16 -11
  57. package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-B3Brs1Rc.d.ts} +62 -7
  58. package/dist/{chunk-DGRM4EZZ.mjs → chunk-37IVJLP6.mjs} +1 -1
  59. package/dist/{chunk-KYVRZAYP.mjs → chunk-3A5KI24C.mjs} +2 -69
  60. package/dist/{chunk-POUYICOU.mjs → chunk-3OFU3NJT.mjs} +1 -1
  61. package/dist/{chunk-3TVDTACC.mjs → chunk-3Y3J4V2R.mjs} +1 -1
  62. package/dist/{chunk-FNBNZCGP.mjs → chunk-466PYR4P.mjs} +2 -2
  63. package/dist/{chunk-SEAJS664.mjs → chunk-4HWZV5MK.mjs} +5 -5
  64. package/dist/{chunk-UGVUW27S.mjs → chunk-5FUOVJKG.mjs} +13 -9
  65. package/dist/{chunk-ZHAXP7SD.mjs → chunk-5KGYQT6W.mjs} +6 -235
  66. package/dist/{chunk-NPXVQS33.mjs → chunk-62G63NMH.mjs} +4 -3
  67. package/dist/chunk-6MSZ543Y.mjs +32 -0
  68. package/dist/chunk-7GXJUJ24.mjs +49 -0
  69. package/dist/{chunk-3E4RRF5J.mjs → chunk-7HCZWC7B.mjs} +58 -8
  70. package/dist/{chunk-6RKSY3BX.mjs → chunk-7NTMUDC5.mjs} +5 -5
  71. package/dist/chunk-7QUGDVFC.mjs +101 -0
  72. package/dist/{chunk-G5KHSM6E.mjs → chunk-AO2FAYIZ.mjs} +1 -1
  73. package/dist/chunk-B7S6YEBP.mjs +102 -0
  74. package/dist/{chunk-AWNHDBKV.mjs → chunk-BPSKLCS7.mjs} +15 -7
  75. package/dist/chunk-BUMREPLU.mjs +15 -0
  76. package/dist/{chunk-T4CJDBBE.mjs → chunk-C6ASEFZI.mjs} +1 -1
  77. package/dist/{chunk-NITCPDFL.mjs → chunk-C73JLU4E.mjs} +2 -2
  78. package/dist/{chunk-NYSONUB7.mjs → chunk-CP5RRPJR.mjs} +1 -1
  79. package/dist/{chunk-TTCKT2RT.mjs → chunk-DMQPFLGI.mjs} +134 -11
  80. package/dist/{chunk-3SBJVQLL.mjs → chunk-DVWYODEB.mjs} +2 -2
  81. package/dist/chunk-ECX4SGX6.mjs +167 -0
  82. package/dist/chunk-GES7U2PM.mjs +68 -0
  83. package/dist/{chunk-NVTFQFUL.mjs → chunk-HVKXNBFL.mjs} +1 -1
  84. package/dist/chunk-HVYICDY3.mjs +214 -0
  85. package/dist/{chunk-3HV7M5OJ.mjs → chunk-HWEDFLB7.mjs} +9 -133
  86. package/dist/{chunk-52QQWEBS.mjs → chunk-IBNLW3AV.mjs} +21 -6
  87. package/dist/chunk-IJU7LL7D.mjs +242 -0
  88. package/dist/chunk-IPN7S4KX.mjs +130 -0
  89. package/dist/{chunk-5QMHMELB.mjs → chunk-IQ4R2I6N.mjs} +4 -1
  90. package/dist/chunk-JCLTESFN.mjs +96 -0
  91. package/dist/{chunk-J4BDAH2W.mjs → chunk-JFNKIBDT.mjs} +2 -2
  92. package/dist/{chunk-LDGGR7YT.mjs → chunk-K4B7OH65.mjs} +2 -2
  93. package/dist/{chunk-7TE2AJIH.mjs → chunk-K7KLL263.mjs} +13 -10
  94. package/dist/{chunk-CSHHU7PA.mjs → chunk-KCUIFVVW.mjs} +11 -30
  95. package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-KUZKUONM.mjs} +11 -2
  96. package/dist/chunk-KYYABCSW.mjs +72 -0
  97. package/dist/{chunk-B2FTZNNF.mjs → chunk-LKUE5GXS.mjs} +34 -14
  98. package/dist/{chunk-2PNYKG2D.mjs → chunk-LSM2YTKM.mjs} +100 -335
  99. package/dist/{chunk-DMNPYF54.mjs → chunk-LTUGDMV4.mjs} +2 -2
  100. package/dist/{chunk-FDG4KXX5.mjs → chunk-MLHNSAPK.mjs} +5 -3
  101. package/dist/{chunk-VP6XRMWR.mjs → chunk-MMBEANB2.mjs} +6 -32
  102. package/dist/{chunk-LJ4ENXOD.mjs → chunk-MMEMEUOO.mjs} +2 -2
  103. package/dist/{chunk-2HJWQPR6.mjs → chunk-NTZOXVUZ.mjs} +6 -122
  104. package/dist/{chunk-5WB2A3XU.mjs → chunk-NZMAXR2S.mjs} +397 -24
  105. package/dist/{chunk-IZT3G24Q.mjs → chunk-O43Z4MS6.mjs} +2 -2
  106. package/dist/{chunk-U46IZNCW.mjs → chunk-OKX2BBNW.mjs} +3 -2
  107. package/dist/{chunk-RBEHLIKX.mjs → chunk-PFKM7VNZ.mjs} +14 -8
  108. package/dist/chunk-PGVPE7GJ.mjs +96 -0
  109. package/dist/chunk-Q3TCTQCC.mjs +85 -0
  110. package/dist/chunk-Q7MS6P2J.mjs +74 -0
  111. package/dist/chunk-QDZJM7NI.mjs +23 -0
  112. package/dist/{chunk-ZS6CMXAE.mjs → chunk-QKZHLADX.mjs} +89 -250
  113. package/dist/{chunk-IJSFWGVW.mjs → chunk-REL7LFLR.mjs} +3 -3
  114. package/dist/chunk-RVKFI3A2.mjs +237 -0
  115. package/dist/chunk-S2N75OTN.mjs +83 -0
  116. package/dist/chunk-TRISKD4Q.mjs +50 -0
  117. package/dist/{chunk-6F6USYII.mjs → chunk-TV2L3BN7.mjs} +13 -11
  118. package/dist/{chunk-6BWLDLS3.mjs → chunk-URPCYQVJ.mjs} +1 -1
  119. package/dist/chunk-USR7FQRZ.mjs +34 -0
  120. package/dist/chunk-V6EUBAIT.mjs +19 -0
  121. package/dist/{chunk-SOUZMPME.mjs → chunk-VMXSVVXG.mjs} +7 -194
  122. package/dist/{chunk-4QCSHLNM.mjs → chunk-VREK3MYG.mjs} +3 -3
  123. package/dist/{chunk-YGQOPB2Z.mjs → chunk-WCBA2LVZ.mjs} +1 -1
  124. package/dist/{chunk-KQJVNPRM.mjs → chunk-X6NSJYQ3.mjs} +19 -16
  125. package/dist/chunk-Y4WPNHMC.mjs +50 -0
  126. package/dist/{chunk-IRWP524D.mjs → chunk-YBJDOA2T.mjs} +1 -1
  127. package/dist/{chunk-IJPK5PGM.mjs → chunk-YPUEV6ZC.mjs} +1 -1
  128. package/dist/{chunk-J7M73VY7.mjs → chunk-YROWNOMH.mjs} +1 -1
  129. package/dist/chunk-Z3TNWCI5.mjs +196 -0
  130. package/dist/{chunk-65WCV5JO.mjs → chunk-ZIFJXCKA.mjs} +1 -1
  131. package/dist/chunk-ZYAY26KG.mjs +29 -0
  132. package/dist/{client-Cn3gNxUU.d.ts → client-Df76GNKm.d.ts} +76 -6
  133. package/dist/client.d.ts +8 -7
  134. package/dist/client.mjs +56 -5
  135. package/dist/{cold-module-PYSSBIL7.mjs → cold-module-YLWMTTZG.mjs} +38 -28
  136. package/dist/{config-CfhH1IWQ.d.ts → config-05G_hy-1.d.ts} +3 -3
  137. package/dist/config-B8DP2VwR.d.ts +463 -0
  138. package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-FI5GJHWX.mjs} +14 -9
  139. package/dist/distribution/coordinator/etcd.d.ts +11 -2
  140. package/dist/distribution/coordinator/etcd.mjs +268 -107
  141. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  142. package/dist/distribution/transport/grpc.mjs +4 -4
  143. package/dist/distribution/transport/in-memory.mjs +2 -2
  144. package/dist/distribution/transport/tcp.mjs +3 -3
  145. package/dist/distribution.d.ts +41 -9
  146. package/dist/distribution.mjs +1296 -117
  147. package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-RHLXDIVF.mjs} +1751 -1226
  148. package/dist/embeddings/openai.mjs +2 -2
  149. package/dist/{engine-CJRUHXgf.d.ts → engine-DYu-e0oR.d.ts} +50 -40
  150. package/dist/{import-GJOMB2HC.mjs → import-SRBNC6TE.mjs} +27 -19
  151. package/dist/{index-MsF7e5hL.d.ts → index-nRqDM6uS.d.ts} +1 -1
  152. package/dist/index.browser.mjs +8 -4
  153. package/dist/index.d.ts +7 -6
  154. package/dist/index.mjs +24 -16
  155. package/dist/index.react-native.mjs +17 -11
  156. package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-EMYTGSJP.mjs} +28 -15
  157. package/dist/methods-ABM5ELBR.mjs +30 -0
  158. package/dist/{module-AVQEIB7O.mjs → module-3OMJZUFT.mjs} +12 -12
  159. package/dist/{module-6RLIKSZQ.mjs → module-MG7JMV2U.mjs} +33 -23
  160. package/dist/operations-PGOAY2KS.mjs +5 -0
  161. package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-UOLHOEZJ.mjs} +37 -26
  162. package/dist/partial-words.mjs +6 -4
  163. package/dist/pattern.mjs +4 -3
  164. package/dist/persistence/durability/checkpoint-worker.d.ts +9 -1
  165. package/dist/persistence/durability/checkpoint-worker.mjs +34 -23
  166. package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-O3MDRQXP.mjs} +1 -1
  167. package/dist/{pool-UPV5PVPY.mjs → pool-CQXYPFLG.mjs} +2 -2
  168. package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-EAYO3Y6Q.mjs} +27 -15
  169. package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs} +1 -1
  170. package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-2CGSQM4O.mjs} +12 -10
  171. package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
  172. package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-3O57C2ZO.mjs} +2 -2
  173. package/dist/react-native/chunks/chunk-3XKMRNRE.mjs +298 -0
  174. package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-63YSZOXB.mjs} +97 -333
  175. package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-75VWIY35.mjs} +1 -1
  176. package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7GWPJDOA.mjs} +1 -1
  177. package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-AUT7PMA4.mjs} +6 -190
  178. package/dist/react-native/chunks/chunk-C2H2QQFW.mjs +288 -0
  179. package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
  180. package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-CUNGPR5R.mjs} +11 -2
  181. package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-DCKMICOB.mjs} +2 -79
  182. package/dist/react-native/chunks/chunk-DH3TVWWK.mjs +102 -0
  183. package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-EH5CFV6Z.mjs} +2 -2
  184. package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
  185. package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-GFYFQLJD.mjs} +2 -2
  186. package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-I5PGWQJF.mjs} +142 -257
  187. package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-IOY2SM2P.mjs} +1 -1
  188. package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
  189. package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-JPAJWO6D.mjs} +1 -1
  190. package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
  191. package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-JX2RIAXH.mjs} +4 -4
  192. package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
  193. package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-NCJS3WIY.mjs} +2 -2
  194. package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-NKIZX26F.mjs} +2 -2
  195. package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-NP7DD4G5.mjs} +5 -4
  196. package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
  197. package/dist/react-native/chunks/chunk-O32RB3BL.mjs +191 -0
  198. package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-OQQVRWZ2.mjs} +2 -69
  199. package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
  200. package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
  201. package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-RVAEBN74.mjs} +1 -1
  202. package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-RYMDHGL4.mjs} +16 -8
  203. package/dist/react-native/chunks/chunk-SJWDBRNP.mjs +85 -0
  204. package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
  205. package/dist/react-native/chunks/chunk-UWDNZDWK.mjs +242 -0
  206. package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-VQSKZ3EZ.mjs} +9 -152
  207. package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-VVFYOADG.mjs} +7 -6
  208. package/dist/react-native/chunks/{chunk-VGUWIZFQ.mjs → chunk-YBEW6YTR.mjs} +1 -1
  209. package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-YHKZSLOC.mjs} +7 -33
  210. package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-ZBSWRSBG.mjs} +4 -30
  211. package/dist/react-native/chunks/chunk-ZYDKJXQJ.mjs +96 -0
  212. package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-TJL6AFAD.mjs} +29 -21
  213. package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-RRDYJLLM.mjs} +1882 -1358
  214. package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +3 -0
  215. package/dist/react-native/chunks/import-JYBMEJPQ.mjs +29 -0
  216. package/dist/react-native/chunks/methods-X6F36SJE.mjs +30 -0
  217. package/dist/react-native/chunks/module-QT5HZAY4.mjs +33 -0
  218. package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-S4DKSWMF.mjs} +10 -9
  219. package/dist/react-native/chunks/operations-RYKTSZQA.mjs +5 -0
  220. package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-JZ37TB7N.mjs} +1 -1
  221. package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-RTGXJXPU.mjs} +3 -2
  222. package/dist/{browser/restore-queue-UQ6AAUVX.mjs → react-native/chunks/restore-queue-ZBVIKJWI.mjs} +2 -2
  223. package/dist/react-native/chunks/retention-PPCTP2VY.mjs +219 -0
  224. package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-KUATOLYB.mjs} +1 -1
  225. package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-ZBIEOZTZ.mjs} +47 -314
  226. package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
  227. package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-2W4FTX7J.mjs} +25 -18
  228. package/dist/react-native/partial-words.mjs +6 -4
  229. package/dist/react-native/pattern.mjs +4 -3
  230. package/dist/react-native/sync.mjs +2236 -0
  231. package/dist/react-native/synonyms.mjs +7 -4
  232. package/dist/react.d.ts +10 -9
  233. package/dist/react.mjs +7 -1
  234. package/dist/{rerank-3W54N6P2.mjs → rerank-IZOB6NII.mjs} +4 -4
  235. package/dist/rerankers/http.mjs +2 -2
  236. package/dist/{react-native/chunks/restore-queue-H5VCN453.mjs → restore-queue-COI2GSSK.mjs} +2 -2
  237. package/dist/retention-55WA7GPU.mjs +58 -0
  238. package/dist/{runtime-L2DZYY6N.mjs → runtime-UZOC3NPY.mjs} +5 -5
  239. package/dist/{schema-D33CyXCy.d.ts → schema-DDauvDOv.d.ts} +1 -1
  240. package/dist/server.d.ts +22 -19
  241. package/dist/server.mjs +868 -50
  242. package/dist/{snapshot-WMX6JCLP.mjs → snapshot-NFX2EYN2.mjs} +62 -36
  243. package/dist/sync/filesystem.d.ts +30 -0
  244. package/dist/sync/filesystem.mjs +271 -0
  245. package/dist/sync/indexeddb.d.ts +30 -0
  246. package/dist/sync/indexeddb.mjs +237 -0
  247. package/dist/sync-state-ZWHLAFLE.mjs +15 -0
  248. package/dist/{config-aIsy7mcL.d.ts → sync-uXR7MmM7.d.ts} +53 -444
  249. package/dist/sync.browser.mjs +2231 -0
  250. package/dist/sync.d.ts +23 -0
  251. package/dist/sync.mjs +2206 -0
  252. package/dist/synonyms.mjs +5 -3
  253. package/dist/{tasks-C4ElXr4P.d.ts → tasks-BShx8pdK.d.ts} +4 -4
  254. package/dist/thread-P2G2FWM2.mjs +44 -0
  255. package/dist/types-SnO7_tAI.d.ts +228 -0
  256. package/dist/vector/search-worker.d.ts +1 -1
  257. package/dist/vector/search-worker.mjs +6 -6
  258. package/dist/workers/entry.mjs +7 -7
  259. package/dist/{write-SKJ6HW7O.mjs → write-FGB62BHQ.mjs} +31 -23
  260. package/openapi.json +119 -3
  261. package/package.json +28 -8
  262. package/dist/browser/import-QOY6ZH6X.mjs +0 -12
  263. package/dist/chunk-7LDMWKP6.mjs +0 -209
  264. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
  265. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
  266. package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
  267. package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
  268. package/dist/thread-I7DVHHW7.mjs +0 -31
@@ -1,382 +1,22 @@
1
- import { fnv1a, createRequestId, FNV_OFFSET_BASIS, fnv1aContinue, isValidWorkerResponse, fnv1aContinueTaggedNumbers } from './chunk-MPK76GVS.mjs';
1
+ import { createRequestId, isValidWorkerResponse } from './chunk-VI7BQR4U.mjs';
2
2
  import { DEFAULT_MAX_RERANK_WINDOW, DEFAULT_RERANK_TIMEOUT_MS } from './chunk-JPTQZWJQ.mjs';
3
+ import { parsedTypeOf, flattenSchema, isSingleStringFieldType, partialFieldsOf, resolveIndexAnalysis, schemaFieldsOf, isWordIndexedBase, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, requireWithinFileLimit, HEADER_SIZE, payloadByteLength, checksumOfChunks, packEnvelopeWithEngineVersion, INDEX_CONFIGURATION_ENVELOPE_VERSION, DEFAULT_PATTERN_VALUE_LIMIT, MAX_DOCUMENT_NESTING_DEPTH, PROTOTYPE_POLLUTION_KEYS, encodeDocument, isPlainObject, MAX_NESTING_DEPTH, getLanguage, validateSchema, extractVectorFieldsFromSchema, readHeapStatistics, requireCreatableSchema, VECTOR_PATTERN, parseFieldType, isStringValuedBase, withSortableOption, isGeopointOrVectorType, isWordIndexedFieldType, isListBase, MAX_DOCUMENT_BYTES } from './chunk-7TTWXUH6.mjs';
4
+ import { fnv1a, FNV_OFFSET_BASIS, fnv1aContinue, fnv1aContinueTaggedNumbers } from './chunk-RA6LSBCM.mjs';
3
5
  import { TARGET_BLOCK_ENTRIES, bitsetHas, createBitSet, LOOKUP_KEY_SCRATCH_BYTES, GrowableUint32, SEGMENT_TOKEN_TABLE_START, SEGMENT_POSTING_LOG_START, SEGMENT_POSITION_POOL_START, SEGMENT_FIELD_SCRATCH_START, bitsetIsEmpty, bitsetSet, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY, PRUNING_REJECTION_SLACK, bitsetOrInto, bitsetAndNotInto, bitsetAndInto, SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD, SORT_COLUMN_REBUILD_FRACTION_SHIFT, bitsetFromSet } from './chunk-26A5JFT2.mjs';
4
- import { MAX_DOCUMENT_ENCODING_DEPTH, singleFoldTable, appendFoldedCodePoint, compareCodePoints, EARLIER_RELEASE_MIN_M, MIN_M, MAX_M, createDocIdMap, MAX_FILE_BYTES, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, CHECKSUM_YIELD_CHUNK_BYTES, detectRuntime, toReducedSortValue, compareComparableValues, defaultSortMode, resolveWorkerEntry, missingWorkerEntry, countWrite, holdsUnpairedSurrogate, readSortField, truncateSortString, exceedsCodePoints, turnIsSpent, yieldTurn, toComparableSortValue, SORT_VALUE_MAX_CODE_POINTS, compareComparableKeys, sortModeOf, isSortMode, SORT_MODES, MIN_OVERSAMPLE, compareSortValues, noteThreadSlotGone, threadSlotOfWorker, codePointCount, turnsAreBudgeted, indexChangeOutsideExternalWaits, changeIndexOutsideExternalWaits } from './chunk-IAXZAVYL.mjs';
6
+ import { createDocIdMap, detectRuntime, resolveWorkerEntry, missingWorkerEntry, countWrite, turnIsSpent, yieldTurn, MIN_OVERSAMPLE, noteThreadSlotGone, threadSlotOfWorker, turnsAreBudgeted, indexChangeOutsideExternalWaits, changeIndexOutsideExternalWaits } from './chunk-U2E3HMYW.mjs';
5
7
  import { splitWorkerBudget, resolveWorkerCount, DEFAULT_REQUEST_TIMEOUT_MS, resolveRequestThreadCount, MAX_RENUMBERED_SEARCH_ATTEMPTS, SHUTDOWN_TIMEOUT_MS, DEFAULT_BACKPRESSURE_LIMIT, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH } from './chunk-TY7L6OXO.mjs';
6
- import { MAX_INDEX_CONFIGURATION_BYTES, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, MAX_SUGGEST_LIMIT, FOREIGN_STATS_TTL_MS, HEAP_PRESSURE_WARNING_FRACTION, DEFAULT_SUGGEST_LIMIT, DEFAULT_LIMIT, DEFAULT_OFFSET, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, BATCH_CHUNK_SIZE, MAX_DOC_ID_LENGTH } from './chunk-4RD3AFSB.mjs';
8
+ import { MAX_INDEX_CONFIGURATION_BYTES, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, HEAP_PRESSURE_WARNING_FRACTION, MAX_SUGGEST_LIMIT, FOREIGN_STATS_TTL_MS, DEFAULT_SUGGEST_LIMIT, DEFAULT_LIMIT, DEFAULT_OFFSET, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, BATCH_CHUNK_SIZE, MAX_DOC_ID_LENGTH } from './chunk-4RD3AFSB.mjs';
9
+ import { singleFoldTable, appendFoldedCodePoint, EARLIER_RELEASE_MIN_M, MIN_M, MAX_M, compareCodePoints, toReducedSortValue, compareComparableValues, defaultSortMode, MAX_FILE_BYTES, holdsUnpairedSurrogate, readSortField, truncateSortString, exceedsCodePoints, toComparableSortValue, SORT_VALUE_MAX_CODE_POINTS, compareComparableKeys, sortModeOf, isSortMode, SORT_MODES, compareSortValues, codePointCount } from './chunk-7MEYN7V6.mjs';
7
10
  import { DEFAULT_FUZZY_PREFIX_LENGTH, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, BM25_DISPLAYED_NAME_LENGTH, RESULT_WINDOW, DEFAULT_LINEAR_ALPHA, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, DEFAULT_RANK_CONSTANT, MIN_RANK_CONSTANT, DEFAULT_PAGE_SIZE, DEFAULT_MAX_PER_GROUP, PREFIX_MAX_EXPANSIONS, MAX_TOLERANCE, MAX_PREFIX_LENGTH } from './chunk-WXLBZJMT.mjs';
8
- import { ErrorCodes, NarsilError, createNarsilError } from './chunk-PIS7ZAP7.mjs';
9
- import { Encoder, Decoder, decode, encode } from '@msgpack/msgpack';
10
-
11
- // src/analysis/registry.ts
12
- var tokenizers = /* @__PURE__ */ new Map();
13
- var stopWordSets = /* @__PURE__ */ new Map();
14
- function requireName(name, kind) {
15
- if (typeof name !== "string" || name.trim().length === 0) {
16
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `A registered ${kind} needs a non-empty name`, { name });
17
- }
18
- }
19
- function registerTokenizer(name, tokenizer) {
20
- requireName(name, "tokenizer");
21
- if (typeof tokenizer?.tokenize !== "function") {
22
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" needs a tokenize method`, { tokenizer: name });
23
- }
24
- tokenizers.set(name, tokenizer);
25
- }
26
- function registerStopWords(name, stopWords2) {
27
- requireName(name, "stop word set");
28
- if (!(stopWords2 instanceof Set) && typeof stopWords2 !== "function") {
29
- throw new NarsilError(
30
- ErrorCodes.CONFIG_INVALID,
31
- `Stop word set "${name}" needs a Set of words or a function returning one`,
32
- { stopWords: name }
33
- );
34
- }
35
- stopWordSets.set(name, stopWords2);
36
- }
37
- function hasTokenizer(name) {
38
- return tokenizers.has(name);
39
- }
40
- function hasStopWords(name) {
41
- return stopWordSets.has(name);
42
- }
43
- function getTokenizer(name) {
44
- const tokenizer = tokenizers.get(name);
45
- if (!tokenizer) {
46
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" is not registered on this engine`, {
47
- tokenizer: name,
48
- available: [...tokenizers.keys()]
49
- });
50
- }
51
- return tokenizer;
52
- }
53
- function getStopWords(name) {
54
- const stopWords2 = stopWordSets.get(name);
55
- if (!stopWords2) {
56
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Stop word set "${name}" is not registered on this engine`, {
57
- stopWords: name,
58
- available: [...stopWordSets.keys()]
59
- });
60
- }
61
- return stopWords2;
62
- }
63
- function holdsPositionsOutOfOrder(entries) {
64
- for (let index = 1; index < entries.length; index++) {
65
- if (entries[index].position < entries[index - 1].position) return true;
66
- }
67
- return false;
68
- }
69
- function inPositionOrder(tokenizer) {
70
- return {
71
- tokenize(text) {
72
- const entries = tokenizer.tokenize(text);
73
- if (!holdsPositionsOutOfOrder(entries)) return entries;
74
- return [...entries].sort((first, second) => first.position - second.position);
75
- }
76
- };
77
- }
78
- function resolveIndexAnalysis(config) {
79
- const tokenizer = typeof config.tokenizer === "string" ? getTokenizer(config.tokenizer) : config.tokenizer;
80
- return {
81
- stopWords: typeof config.stopWords === "string" ? getStopWords(config.stopWords) : config.stopWords,
82
- customTokenizer: tokenizer === void 0 ? void 0 : inPositionOrder(tokenizer)
83
- };
84
- }
11
+ import { emitSyncChange, withOpenIndex, oneAtATime } from './chunk-ML7THVLJ.mjs';
12
+ import { ErrorCodes, NarsilError, createNarsilError } from './chunk-MYITLCHT.mjs';
13
+ import { Decoder, decode, encode } from '@msgpack/msgpack';
85
14
 
86
15
  // src/core/partition/partial-words/platform.browser.ts
87
16
  function platformPartialWordSearch() {
88
17
  return null;
89
18
  }
90
19
 
91
- // src/schema/constants.ts
92
- var MAX_NESTING_DEPTH = 4;
93
- var MAX_DOCUMENT_NESTING_DEPTH = 32;
94
- var DEFAULT_PATTERN_VALUE_LIMIT = 8192;
95
- var MIN_PATTERN_VALUE_LIMIT = 1;
96
- var MAX_PATTERN_VALUE_LIMIT = 65536;
97
- var MAX_VECTOR_DIMENSION = 4096;
98
- var MAX_STORED_VECTOR_DIMENSION = 65535;
99
- var MAX_TEXT_FIELDS = 65536;
100
- var MAX_DOCUMENT_BYTES = 16777216;
101
- var PARSED_FIELD_TYPE_CACHE_ENTRIES = 1024;
102
-
103
- // src/schema/validator/shared.ts
104
- var VECTOR_PATTERN = /^vector\[(\d+)]$/;
105
- function isGeopointOrVectorType(fieldType) {
106
- return fieldType === "geopoint" || fieldType !== void 0 && VECTOR_PATTERN.test(fieldType);
107
- }
108
- var FIELD_NAME_PATTERN = /^[A-Za-z0-9_]+$/;
109
- var RESERVED_ROOT_FIELDS = /* @__PURE__ */ new Set(["id"]);
110
- var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
111
- function isPlainObject(value) {
112
- return typeof value === "object" && value !== null && !Array.isArray(value);
113
- }
114
-
115
- // src/schema/validator/field-type.ts
116
- var FIELD_OPTION_ORDER = ["sortable", "pattern", "partial"];
117
- var OPTIONS_BY_BASE = {
118
- string: FIELD_OPTION_ORDER,
119
- "string[]": FIELD_OPTION_ORDER,
120
- verbatim: ["sortable"],
121
- "verbatim[]": ["sortable"],
122
- number: [],
123
- "number[]": [],
124
- boolean: [],
125
- "boolean[]": [],
126
- enum: [],
127
- "enum[]": [],
128
- geopoint: [],
129
- vector: []
130
- };
131
- var TYPE_SEPARATOR = ":";
132
- function isNamedBase(name) {
133
- return name !== "vector" && Object.hasOwn(OPTIONS_BY_BASE, name);
134
- }
135
- function describeAllowedOptions(baseName, allowed) {
136
- if (allowed.length === 0) return `the "${baseName}" type has no options`;
137
- const quoted = allowed.map((option) => `"${option}"`);
138
- if (quoted.length === 1) return `the only option of the "${baseName}" type is ${quoted[0]}`;
139
- return `the options of the "${baseName}" type are ${quoted.slice(0, -1).join(", ")}, and ${quoted[quoted.length - 1]}`;
140
- }
141
- function invalidType(path, type, message) {
142
- throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, message, { field: path, type });
143
- }
144
- function parseBase(baseName, path, type) {
145
- if (isNamedBase(baseName)) return { base: baseName, dimension: 0 };
146
- const vectorMatch = VECTOR_PATTERN.exec(baseName);
147
- if (vectorMatch === null) {
148
- invalidType(path, type, `Field "${path}" has an unsupported type: "${type}"`);
149
- }
150
- const dimension = Number.parseInt(vectorMatch[1], 10);
151
- if (dimension <= 0 || dimension > MAX_STORED_VECTOR_DIMENSION) {
152
- throw new NarsilError(
153
- ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
154
- `Vector field "${path}" has ${dimension} dimensions, but a vector field holds from 1 to ${MAX_STORED_VECTOR_DIMENSION}`,
155
- { field: path, dimension, maximum: MAX_STORED_VECTOR_DIMENSION }
156
- );
157
- }
158
- return { base: "vector", dimension };
159
- }
160
- function parseFieldType(type, path) {
161
- const separatorIndex = type.indexOf(TYPE_SEPARATOR);
162
- const baseName = separatorIndex === -1 ? type : type.slice(0, separatorIndex);
163
- const { base, dimension } = parseBase(baseName, path, type);
164
- const allowed = OPTIONS_BY_BASE[base];
165
- const options = /* @__PURE__ */ new Set();
166
- if (separatorIndex !== -1) {
167
- for (const option of type.slice(separatorIndex + 1).split(TYPE_SEPARATOR)) {
168
- if (!allowed.includes(option)) {
169
- invalidType(
170
- path,
171
- type,
172
- `Field "${path}" has type "${type}" with the option "${option}", but ${describeAllowedOptions(baseName, allowed)}`
173
- );
174
- }
175
- if (options.has(option)) {
176
- invalidType(path, type, `Field "${path}" has the "${option}" option twice in type "${type}"`);
177
- }
178
- options.add(option);
179
- }
180
- }
181
- const ordered = FIELD_OPTION_ORDER.filter((option) => options.has(option));
182
- const verbatim = base === "verbatim" || base === "verbatim[]";
183
- return {
184
- type: [baseName, ...ordered].join(TYPE_SEPARATOR),
185
- base,
186
- sortable: options.has("sortable"),
187
- pattern: verbatim || options.has("pattern"),
188
- partial: options.has("partial"),
189
- dimension
190
- };
191
- }
192
- var parsedTypesByName = /* @__PURE__ */ new Map();
193
- function parsedTypeOf(type) {
194
- if (type === void 0) return void 0;
195
- const known = parsedTypesByName.get(type);
196
- if (known !== void 0) return known;
197
- try {
198
- const parsed = Object.freeze(parseFieldType(type, ""));
199
- if (parsedTypesByName.size < PARSED_FIELD_TYPE_CACHE_ENTRIES) parsedTypesByName.set(type, parsed);
200
- return parsed;
201
- } catch {
202
- return void 0;
203
- }
204
- }
205
- function withSortableOption(parsed) {
206
- if (parsed.sortable) return parsed.type;
207
- const separatorIndex = parsed.type.indexOf(TYPE_SEPARATOR);
208
- const baseName = separatorIndex === -1 ? parsed.type : parsed.type.slice(0, separatorIndex);
209
- return parseFieldType(`${baseName}${TYPE_SEPARATOR}sortable${parsed.type.slice(baseName.length)}`, "").type;
210
- }
211
- function isListBase(base) {
212
- return base.endsWith("[]");
213
- }
214
- function isWordIndexedBase(base) {
215
- return base === "string" || base === "string[]";
216
- }
217
- function isSingleStringFieldType(fieldType) {
218
- return parsedTypeOf(fieldType)?.base === "string";
219
- }
220
- function isWordIndexedFieldType(fieldType) {
221
- const parsed = parsedTypeOf(fieldType);
222
- return parsed !== void 0 && isWordIndexedBase(parsed.base);
223
- }
224
- function isStringValuedBase(base) {
225
- return base === "string" || base === "string[]" || base === "verbatim" || base === "verbatim[]";
226
- }
227
-
228
- // src/schema/validator/schema.ts
229
- function validateSchemaFields(schema, depth, prefix) {
230
- if (depth > MAX_NESTING_DEPTH) {
231
- throw new NarsilError(
232
- ErrorCodes.SCHEMA_DEPTH_EXCEEDED,
233
- `Schema nesting exceeds the maximum depth of ${MAX_NESTING_DEPTH} at "${prefix}"`,
234
- { path: prefix, maxDepth: MAX_NESTING_DEPTH }
235
- );
236
- }
237
- let canonical = null;
238
- const replace = (field, value) => {
239
- if (canonical === null) canonical = { ...schema };
240
- canonical[field] = value;
241
- };
242
- for (const [field, type] of Object.entries(schema)) {
243
- const path = prefix ? `${prefix}.${field}` : field;
244
- if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
245
- throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, `Field name "${field}" is not allowed in a schema`, {
246
- field,
247
- path
248
- });
249
- }
250
- if (!FIELD_NAME_PATTERN.test(field)) {
251
- throw new NarsilError(
252
- ErrorCodes.SCHEMA_INVALID_TYPE,
253
- `Field name "${field}" contains characters that are not allowed; use letters, digits, and underscores only`,
254
- { field, path }
255
- );
256
- }
257
- if (depth === 1 && RESERVED_ROOT_FIELDS.has(field)) {
258
- throw new NarsilError(
259
- ErrorCodes.SCHEMA_INVALID_TYPE,
260
- `Field "${field}" is reserved and cannot be defined in a schema`,
261
- { field, path }
262
- );
263
- }
264
- if (isPlainObject(type)) {
265
- const nested = validateSchemaFields(type, depth + 1, path);
266
- if (nested !== type) replace(field, nested);
267
- continue;
268
- }
269
- if (typeof type !== "string") {
270
- throw new NarsilError(
271
- ErrorCodes.SCHEMA_INVALID_TYPE,
272
- `Field "${path}" has an invalid type definition: ${String(type)}`,
273
- {
274
- field: path,
275
- type: String(type)
276
- }
277
- );
278
- }
279
- const parsed = parseFieldType(type, path);
280
- if (parsed.type !== type) replace(field, parsed.type);
281
- }
282
- return canonical ?? schema;
283
- }
284
- function validateSchema(schema) {
285
- if (!isPlainObject(schema)) {
286
- throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must be a plain object", {
287
- received: typeof schema
288
- });
289
- }
290
- if (Object.keys(schema).length === 0) {
291
- throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must define at least one field");
292
- }
293
- const validated = validateSchemaFields(schema, 1, "");
294
- requireTextFieldCount(schemaFieldsOf(validated).filter((field) => isWordIndexedBase(field.base)).length);
295
- return validated;
296
- }
297
- function requireTextFieldCount(count) {
298
- if (count <= MAX_TEXT_FIELDS) return;
299
- throw new NarsilError(
300
- ErrorCodes.SCHEMA_INVALID_TYPE,
301
- `The schema declares ${count} string and string[] fields, but a schema holds at most ${MAX_TEXT_FIELDS}`,
302
- { textFields: count, maximum: MAX_TEXT_FIELDS }
303
- );
304
- }
305
- function requireCreatableSchema(schema) {
306
- for (const field of schemaFieldsOf(schema)) {
307
- if (field.base !== "vector" || field.dimension <= MAX_VECTOR_DIMENSION) continue;
308
- throw new NarsilError(
309
- ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
310
- `Vector field "${field.path}" has ${field.dimension} dimensions, but a new index takes at most ${MAX_VECTOR_DIMENSION}`,
311
- { field: field.path, dimension: field.dimension, maximum: MAX_VECTOR_DIMENSION }
312
- );
313
- }
314
- }
315
- function requireValidFieldTypes(flatSchema) {
316
- let textFields = 0;
317
- for (const [path, type] of Object.entries(flatSchema)) {
318
- if (typeof type !== "string") {
319
- throw new NarsilError(
320
- ErrorCodes.SCHEMA_INVALID_TYPE,
321
- `Field "${path}" has an invalid type definition: ${String(type)}`,
322
- { field: path, type: String(type) }
323
- );
324
- }
325
- if (isWordIndexedBase(parseFieldType(type, path).base)) textFields += 1;
326
- }
327
- requireTextFieldCount(textFields);
328
- }
329
- function flattenRecursive(schema, prefix, result) {
330
- for (const [field, type] of Object.entries(schema)) {
331
- const path = prefix ? `${prefix}.${field}` : field;
332
- if (isPlainObject(type)) {
333
- flattenRecursive(type, path, result);
334
- } else {
335
- result[path] = type;
336
- }
337
- }
338
- }
339
- var flattenedSchemas = /* @__PURE__ */ new WeakMap();
340
- function flattenSchema(schema) {
341
- const cached = flattenedSchemas.get(schema);
342
- if (cached !== void 0) return cached;
343
- const result = /* @__PURE__ */ Object.create(null);
344
- flattenRecursive(schema, "", result);
345
- flattenedSchemas.set(schema, Object.freeze(result));
346
- return result;
347
- }
348
- var parsedSchemas = /* @__PURE__ */ new WeakMap();
349
- function schemaFieldsOf(schema) {
350
- const cached = parsedSchemas.get(schema);
351
- if (cached !== void 0) return cached;
352
- const fields = [];
353
- for (const [path, type] of Object.entries(flattenSchema(schema))) {
354
- fields.push({ ...parseFieldType(type, path), path });
355
- }
356
- const frozen = Object.freeze(fields);
357
- parsedSchemas.set(schema, frozen);
358
- return frozen;
359
- }
360
- var partialFieldsBySchema = /* @__PURE__ */ new WeakMap();
361
- function partialFieldsOf(schema) {
362
- const cached = partialFieldsBySchema.get(schema);
363
- if (cached !== void 0) return cached;
364
- const paths = [];
365
- for (const field of schemaFieldsOf(schema)) {
366
- if (field.partial) paths.push(field.path);
367
- }
368
- const frozen = Object.freeze(paths.sort(compareCodePoints));
369
- partialFieldsBySchema.set(schema, frozen);
370
- return frozen;
371
- }
372
- function extractVectorFieldsFromSchema(schema) {
373
- const result = /* @__PURE__ */ new Map();
374
- for (const field of schemaFieldsOf(schema)) {
375
- if (field.base === "vector") result.set(field.path, field.dimension);
376
- }
377
- return result;
378
- }
379
-
380
20
  // src/core/partition/partial-words/registry.ts
381
21
  var registered = null;
382
22
  var MODULE_FUNCTIONS = [
@@ -716,8 +356,8 @@ function evictOldestEntries(count) {
716
356
  }
717
357
  }
718
358
  }
719
- function transformToken(raw, language, stem2, removeDiacritics) {
720
- const flags = (stem2 ? "s" : "") + (removeDiacritics ? "d" : "");
359
+ function transformToken(raw, language, stem, removeDiacritics) {
360
+ const flags = (stem ? "s" : "") + (removeDiacritics ? "d" : "");
721
361
  let bucket = getCacheBucket(language, flags);
722
362
  const cached = bucket.get(raw);
723
363
  if (cached !== void 0) return cached;
@@ -728,7 +368,7 @@ function transformToken(raw, language, stem2, removeDiacritics) {
728
368
  if (removeDiacritics) {
729
369
  normalized = stripDiacritics(normalized);
730
370
  }
731
- if (stem2 && language.stemmer) {
371
+ if (stem && language.stemmer) {
732
372
  normalized = language.stemmer(normalized);
733
373
  }
734
374
  if (normalizationCacheSize >= maxCacheSize) {
@@ -924,7 +564,7 @@ function stripPossessive(token) {
924
564
  }
925
565
  function visitTokens(text, language, options, visit) {
926
566
  const {
927
- stem: stem2 = true,
567
+ stem = true,
928
568
  removeStopWords = true,
929
569
  removeDiacritics = false,
930
570
  collectSurfaces = false,
@@ -938,14 +578,14 @@ function visitTokens(text, language, options, visit) {
938
578
  const rawParts = splitText(normalizeForSplitting(text), language);
939
579
  const minLength = language.tokenizer?.minTokenLength ?? DEFAULT_MIN_TOKEN_LENGTH;
940
580
  const effectiveDiacritics = removeDiacritics || (language.tokenizer?.normalizeDiacritics ?? false);
941
- const wantSurfaces = collectSurfaces && stem2 && language.stemmer !== null;
942
- const stopWords2 = removeStopWords ? resolveStopWords(language, stopWordOverride) : null;
581
+ const wantSurfaces = collectSurfaces && stem && language.stemmer !== null;
582
+ const stopWords = removeStopWords ? resolveStopWords(language, stopWordOverride) : null;
943
583
  const stripPossessives = language.tokenizer?.stripPossessive ?? false;
944
584
  for (let position = 0; position < rawParts.length; position++) {
945
585
  const part = rawParts[position];
946
586
  const candidate = stripPossessives ? stripPossessive(part) : part;
947
- if (candidate.length < minLength || stopWords2?.has(candidate)) continue;
948
- const processed = transformToken(candidate, language, stem2, effectiveDiacritics);
587
+ if (candidate.length < minLength || stopWords?.has(candidate)) continue;
588
+ const processed = transformToken(candidate, language, stem, effectiveDiacritics);
949
589
  if (processed.length === 0) continue;
950
590
  if (!wantSurfaces) {
951
591
  visit(processed, position, void 0, part);
@@ -982,1150 +622,6 @@ function tokenize(text, language, options) {
982
622
  return { tokens, originalTokens, surfaces };
983
623
  }
984
624
 
985
- // src/languages/snowball/base-stemmer.ts
986
- var BaseStemmer = class {
987
- current = "";
988
- c = 0;
989
- limit = 0;
990
- limit_backward = 0;
991
- bra = 0;
992
- ket = 0;
993
- af = 0;
994
- setCurrent(value) {
995
- this.current = value;
996
- this.c = 0;
997
- this.limit = this.current.length;
998
- this.limit_backward = 0;
999
- this.bra = 0;
1000
- this.ket = 0;
1001
- }
1002
- getCurrent() {
1003
- return this.current;
1004
- }
1005
- in_grouping(s, min, max) {
1006
- if (this.c >= this.limit) return false;
1007
- let ch = this.current.charCodeAt(this.c);
1008
- if (ch > max || ch < min) return false;
1009
- ch -= min;
1010
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
1011
- this.c++;
1012
- return true;
1013
- }
1014
- go_in_grouping(s, min, max) {
1015
- while (this.c < this.limit) {
1016
- let ch = this.current.charCodeAt(this.c);
1017
- if (ch > max || ch < min) return true;
1018
- ch -= min;
1019
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
1020
- this.c++;
1021
- }
1022
- return false;
1023
- }
1024
- in_grouping_b(s, min, max) {
1025
- if (this.c <= this.limit_backward) return false;
1026
- let ch = this.current.charCodeAt(this.c - 1);
1027
- if (ch > max || ch < min) return false;
1028
- ch -= min;
1029
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
1030
- this.c--;
1031
- return true;
1032
- }
1033
- go_in_grouping_b(s, min, max) {
1034
- while (this.c > this.limit_backward) {
1035
- let ch = this.current.charCodeAt(this.c - 1);
1036
- if (ch > max || ch < min) return true;
1037
- ch -= min;
1038
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
1039
- this.c--;
1040
- }
1041
- return false;
1042
- }
1043
- out_grouping(s, min, max) {
1044
- if (this.c >= this.limit) return false;
1045
- let ch = this.current.charCodeAt(this.c);
1046
- if (ch > max || ch < min) {
1047
- this.c++;
1048
- return true;
1049
- }
1050
- ch -= min;
1051
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
1052
- this.c++;
1053
- return true;
1054
- }
1055
- return false;
1056
- }
1057
- go_out_grouping(s, min, max) {
1058
- while (this.c < this.limit) {
1059
- let ch = this.current.charCodeAt(this.c);
1060
- if (ch <= max && ch >= min) {
1061
- ch -= min;
1062
- if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
1063
- }
1064
- this.c++;
1065
- }
1066
- return false;
1067
- }
1068
- out_grouping_b(s, min, max) {
1069
- if (this.c <= this.limit_backward) return false;
1070
- let ch = this.current.charCodeAt(this.c - 1);
1071
- if (ch > max || ch < min) {
1072
- this.c--;
1073
- return true;
1074
- }
1075
- ch -= min;
1076
- if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
1077
- this.c--;
1078
- return true;
1079
- }
1080
- return false;
1081
- }
1082
- go_out_grouping_b(s, min, max) {
1083
- while (this.c > this.limit_backward) {
1084
- let ch = this.current.charCodeAt(this.c - 1);
1085
- if (ch <= max && ch >= min) {
1086
- ch -= min;
1087
- if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
1088
- }
1089
- this.c--;
1090
- }
1091
- return false;
1092
- }
1093
- eq_s(s) {
1094
- if (this.limit - this.c < s.length) return false;
1095
- if (!this.current.startsWith(s, this.c)) return false;
1096
- this.c += s.length;
1097
- return true;
1098
- }
1099
- eq_s_b(s) {
1100
- if (this.c - this.limit_backward < s.length) return false;
1101
- if (!this.current.endsWith(s, this.c)) return false;
1102
- this.c -= s.length;
1103
- return true;
1104
- }
1105
- find_among(v, call_among_func) {
1106
- let i = 0;
1107
- let j = v.length;
1108
- const c = this.c;
1109
- const l = this.limit;
1110
- let common_i = 0;
1111
- let common_j = 0;
1112
- let first_key_inspected = false;
1113
- while (true) {
1114
- const k = i + (j - i >>> 1);
1115
- let diff = 0;
1116
- let common = common_i < common_j ? common_i : common_j;
1117
- const s = v[k][0];
1118
- for (let i2 = common; i2 < s.length; i2++) {
1119
- if (c + common === l) {
1120
- diff = -1;
1121
- break;
1122
- }
1123
- diff = this.current.charCodeAt(c + common) - s.charCodeAt(i2);
1124
- if (diff !== 0) break;
1125
- common++;
1126
- }
1127
- if (diff < 0) {
1128
- j = k;
1129
- common_j = common;
1130
- } else {
1131
- i = k;
1132
- common_i = common;
1133
- }
1134
- if (j - i <= 1) {
1135
- if (i > 0) break;
1136
- if (j === i) break;
1137
- if (first_key_inspected) break;
1138
- first_key_inspected = true;
1139
- }
1140
- }
1141
- while (true) {
1142
- const w = v[i];
1143
- const len = w[0].length;
1144
- if (common_i >= len) {
1145
- this.c = c + len;
1146
- const action = w[3];
1147
- if (action === void 0) return w[1];
1148
- this.af = action;
1149
- if (call_among_func?.call(this) === true) {
1150
- this.c = c + len;
1151
- return w[1];
1152
- }
1153
- }
1154
- const back = w[2];
1155
- if (back === void 0 || back === 0) return 0;
1156
- i -= back;
1157
- }
1158
- }
1159
- find_among_b(v, call_among_func) {
1160
- let i = 0;
1161
- let j = v.length;
1162
- const c = this.c;
1163
- const lb = this.limit_backward;
1164
- let common_i = 0;
1165
- let common_j = 0;
1166
- let first_key_inspected = false;
1167
- while (true) {
1168
- const k = i + (j - i >> 1);
1169
- let diff = 0;
1170
- let common = common_i < common_j ? common_i : common_j;
1171
- const s = v[k][0];
1172
- for (let i2 = s.length - 1 - common; i2 >= 0; i2--) {
1173
- if (c - common === lb) {
1174
- diff = -1;
1175
- break;
1176
- }
1177
- diff = this.current.charCodeAt(c - 1 - common) - s.charCodeAt(i2);
1178
- if (diff !== 0) break;
1179
- common++;
1180
- }
1181
- if (diff < 0) {
1182
- j = k;
1183
- common_j = common;
1184
- } else {
1185
- i = k;
1186
- common_i = common;
1187
- }
1188
- if (j - i <= 1) {
1189
- if (i > 0) break;
1190
- if (j === i) break;
1191
- if (first_key_inspected) break;
1192
- first_key_inspected = true;
1193
- }
1194
- }
1195
- while (true) {
1196
- const w = v[i];
1197
- const len = w[0].length;
1198
- if (common_i >= len) {
1199
- this.c = c - len;
1200
- const action = w[3];
1201
- if (action === void 0) return w[1];
1202
- this.af = action;
1203
- if (call_among_func?.call(this) === true) {
1204
- this.c = c - len;
1205
- return w[1];
1206
- }
1207
- }
1208
- const back = w[2];
1209
- if (back === void 0 || back === 0) return 0;
1210
- i -= back;
1211
- }
1212
- }
1213
- replace_s(c_bra, c_ket, s) {
1214
- const adjustment = s.length - (c_ket - c_bra);
1215
- this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket);
1216
- this.limit += adjustment;
1217
- if (this.c >= c_ket) this.c += adjustment;
1218
- else if (this.c > c_bra) this.c = c_bra;
1219
- return adjustment;
1220
- }
1221
- slice_from(s) {
1222
- this.replace_s(this.bra, this.ket, s);
1223
- this.ket = this.bra + s.length;
1224
- }
1225
- slice_del() {
1226
- this.slice_from("");
1227
- }
1228
- insert(c_bra, c_ket, s) {
1229
- const adjustment = this.replace_s(c_bra, c_ket, s);
1230
- if (c_bra <= this.bra) this.bra += adjustment;
1231
- if (c_bra <= this.ket) this.ket += adjustment;
1232
- }
1233
- slice_to() {
1234
- return this.current.slice(this.bra, this.ket);
1235
- }
1236
- };
1237
-
1238
- // src/languages/snowball/english.ts
1239
- var a_0 = [
1240
- ["arsen", -1],
1241
- ["commun", -1],
1242
- ["emerg", -1],
1243
- ["gener", -1],
1244
- ["inter", -1],
1245
- ["later", -1],
1246
- ["organ", -1],
1247
- ["past", -1],
1248
- ["univers", -1]
1249
- ];
1250
- var a_1 = [
1251
- ["'", 1],
1252
- ["'s'", 1, 1],
1253
- ["'s", 1]
1254
- ];
1255
- var a_2 = [
1256
- ["ied", 2],
1257
- ["s", 3],
1258
- ["ies", 2, 1],
1259
- ["sses", 1, 2],
1260
- ["ss", -1, 3],
1261
- ["us", -1, 4]
1262
- ];
1263
- var a_3 = [
1264
- ["succ", 1],
1265
- ["proc", 1],
1266
- ["exc", 1]
1267
- ];
1268
- var a_4 = [
1269
- ["even", 2],
1270
- ["cann", 2],
1271
- ["inn", 2],
1272
- ["earr", 2],
1273
- ["herr", 2],
1274
- ["out", 2],
1275
- ["y", 1]
1276
- ];
1277
- var a_5 = [
1278
- ["", -1],
1279
- ["ed", 2, 1],
1280
- ["eed", 1, 1],
1281
- ["ing", 3, 3],
1282
- ["edly", 2, 4],
1283
- ["eedly", 1, 1],
1284
- ["ingly", 2, 6]
1285
- ];
1286
- var a_6 = [
1287
- ["", 3],
1288
- ["bb", 2, 1],
1289
- ["dd", 2, 2],
1290
- ["ff", 2, 3],
1291
- ["gg", 2, 4],
1292
- ["bl", 1, 5],
1293
- ["mm", 2, 6],
1294
- ["nn", 2, 7],
1295
- ["pp", 2, 8],
1296
- ["rr", 2, 9],
1297
- ["at", 1, 10],
1298
- ["tt", 2, 11],
1299
- ["iz", 1, 12]
1300
- ];
1301
- var a_7 = [
1302
- ["anci", 3],
1303
- ["enci", 2],
1304
- ["ogi", 14],
1305
- ["li", 16],
1306
- ["bli", 12, 1],
1307
- ["abli", 4, 1],
1308
- ["alli", 8, 3],
1309
- ["fulli", 9, 4],
1310
- ["lessli", 15, 5],
1311
- ["ousli", 10, 6],
1312
- ["entli", 5, 7],
1313
- ["aliti", 8],
1314
- ["biliti", 12],
1315
- ["iviti", 11],
1316
- ["tional", 1],
1317
- ["ational", 7, 1],
1318
- ["alism", 8],
1319
- ["ation", 7],
1320
- ["ization", 6, 1],
1321
- ["izer", 6],
1322
- ["ator", 7],
1323
- ["iveness", 11],
1324
- ["fulness", 9],
1325
- ["ousness", 10],
1326
- ["ogist", 13]
1327
- ];
1328
- var a_8 = [
1329
- ["icate", 4],
1330
- ["ative", 6],
1331
- ["alize", 3],
1332
- ["iciti", 4],
1333
- ["ical", 4],
1334
- ["tional", 1],
1335
- ["ational", 2, 1],
1336
- ["ful", 5],
1337
- ["ness", 5]
1338
- ];
1339
- var a_9 = [
1340
- ["ic", 1],
1341
- ["ance", 1],
1342
- ["ence", 1],
1343
- ["able", 1],
1344
- ["ible", 1],
1345
- ["ate", 1],
1346
- ["ive", 1],
1347
- ["ize", 1],
1348
- ["iti", 1],
1349
- ["al", 1],
1350
- ["ism", 1],
1351
- ["ion", 2],
1352
- ["er", 1],
1353
- ["ous", 1],
1354
- ["ant", 1],
1355
- ["ent", 1],
1356
- ["ment", 1, 1],
1357
- ["ement", 1, 1]
1358
- ];
1359
- var a_10 = [
1360
- ["e", 1],
1361
- ["l", 2]
1362
- ];
1363
- var a_11 = [
1364
- ["andes", -1],
1365
- ["atlas", -1],
1366
- ["bias", -1],
1367
- ["cosmos", -1],
1368
- ["early", 6],
1369
- ["gently", 4],
1370
- ["howe", -1],
1371
- ["idly", 3],
1372
- ["news", -1],
1373
- ["only", 7],
1374
- ["singly", 8],
1375
- ["skies", 2],
1376
- ["skis", 1],
1377
- ["sky", -1],
1378
- ["ugly", 5]
1379
- ];
1380
- var as_11 = ["ski", "sky", "idl", "gentl", "ugli", "earli", "onli", "singl"];
1381
- var g_aeo = [17, 64];
1382
- var g_v = [17, 65, 16, 1];
1383
- var g_v_WXY = [1, 17, 65, 208, 1];
1384
- var g_valid_LI = [55, 141, 2];
1385
- var EnglishStemmer = class extends BaseStemmer {
1386
- #r_shortv() {
1387
- lab0: {
1388
- const v_1 = this.limit - this.c;
1389
- lab1: {
1390
- if (!this.out_grouping_b(g_v_WXY, 89, 121)) break lab1;
1391
- if (!this.in_grouping_b(g_v, 97, 121)) break lab1;
1392
- if (!this.out_grouping_b(g_v, 97, 121)) break lab1;
1393
- break lab0;
1394
- }
1395
- this.c = this.limit - v_1;
1396
- lab2: {
1397
- if (!this.out_grouping_b(g_v, 97, 121)) break lab2;
1398
- if (!this.in_grouping_b(g_v, 97, 121)) break lab2;
1399
- if (
1400
- /**@type {boolean}*/
1401
- this.c > this.limit_backward
1402
- ) break lab2;
1403
- break lab0;
1404
- }
1405
- this.c = this.limit - v_1;
1406
- if (!this.eq_s_b("past")) return false;
1407
- }
1408
- return true;
1409
- }
1410
- #stem() {
1411
- let a;
1412
- let B_Y_found;
1413
- let I_p2;
1414
- let I_p1;
1415
- lab0: {
1416
- const v_1 = this.c;
1417
- lab1: {
1418
- this.bra = this.c;
1419
- a = this.find_among(a_11);
1420
- if (a === 0) break lab1;
1421
- this.ket = this.c;
1422
- if (
1423
- /**@type {boolean}*/
1424
- this.c < this.limit
1425
- ) break lab1;
1426
- if (a > 0) {
1427
- this.slice_from(as_11[a - 1]);
1428
- }
1429
- break lab0;
1430
- }
1431
- this.c = v_1;
1432
- lab2: {
1433
- lab3: {
1434
- if (this.c + 3 > this.limit) break lab3;
1435
- this.c += 3;
1436
- break lab2;
1437
- }
1438
- break lab0;
1439
- }
1440
- this.c = v_1;
1441
- {
1442
- B_Y_found = false;
1443
- const v_2 = this.c;
1444
- lab5: {
1445
- this.bra = this.c;
1446
- if (!this.eq_s("'")) break lab5;
1447
- this.ket = this.c;
1448
- this.slice_del();
1449
- }
1450
- this.c = v_2;
1451
- const v_3 = this.c;
1452
- lab6: {
1453
- this.bra = this.c;
1454
- if (!this.eq_s("y")) break lab6;
1455
- this.ket = this.c;
1456
- this.slice_from("Y");
1457
- B_Y_found = true;
1458
- }
1459
- this.c = v_3;
1460
- const v_4 = this.c;
1461
- while (true) {
1462
- const v_5 = this.c;
1463
- lab8: {
1464
- while (true) {
1465
- const v_6 = this.c;
1466
- lab10: {
1467
- if (!this.in_grouping(g_v, 97, 121)) break lab10;
1468
- this.bra = this.c;
1469
- if (!this.eq_s("y")) break lab10;
1470
- this.ket = this.c;
1471
- this.c = v_6;
1472
- break;
1473
- }
1474
- this.c = v_6;
1475
- if (this.c >= this.limit) break lab8;
1476
- this.c++;
1477
- }
1478
- this.slice_from("Y");
1479
- B_Y_found = true;
1480
- continue;
1481
- }
1482
- this.c = v_5;
1483
- break;
1484
- }
1485
- this.c = v_4;
1486
- }
1487
- {
1488
- I_p1 = this.limit;
1489
- I_p2 = this.limit;
1490
- const v_7 = this.c;
1491
- lab12: {
1492
- lab13: {
1493
- const v_8 = this.c;
1494
- lab14: {
1495
- if (this.find_among(a_0) === 0) break lab14;
1496
- break lab13;
1497
- }
1498
- this.c = v_8;
1499
- if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
1500
- this.c++;
1501
- if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
1502
- this.c++;
1503
- }
1504
- I_p1 = this.c;
1505
- if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
1506
- this.c++;
1507
- if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
1508
- this.c++;
1509
- I_p2 = this.c;
1510
- }
1511
- this.c = v_7;
1512
- }
1513
- this.limit_backward = this.c;
1514
- this.c = this.limit;
1515
- const v_9 = this.limit - this.c;
1516
- lab15: {
1517
- const v_10 = this.limit - this.c;
1518
- lab16: {
1519
- this.ket = this.c;
1520
- if (this.find_among_b(a_1) === 0) {
1521
- this.c = this.limit - v_10;
1522
- break lab16;
1523
- }
1524
- this.bra = this.c;
1525
- this.slice_del();
1526
- }
1527
- this.ket = this.c;
1528
- a = this.find_among_b(a_2);
1529
- if (a === 0) break lab15;
1530
- this.bra = this.c;
1531
- switch (a) {
1532
- case 1: {
1533
- this.slice_from("ss");
1534
- break;
1535
- }
1536
- case 2: {
1537
- lab17: {
1538
- const v_11 = this.limit - this.c;
1539
- lab18: {
1540
- if (this.c - 2 < this.limit_backward) break lab18;
1541
- this.c -= 2;
1542
- this.slice_from("i");
1543
- break lab17;
1544
- }
1545
- this.c = this.limit - v_11;
1546
- this.slice_from("ie");
1547
- }
1548
- break;
1549
- }
1550
- case 3: {
1551
- if (this.c <= this.limit_backward) break lab15;
1552
- this.c--;
1553
- if (!this.go_out_grouping_b(g_v, 97, 121)) break lab15;
1554
- this.c--;
1555
- this.slice_del();
1556
- break;
1557
- }
1558
- }
1559
- }
1560
- this.c = this.limit - v_9;
1561
- const v_12 = this.limit - this.c;
1562
- lab19: {
1563
- this.ket = this.c;
1564
- a = this.find_among_b(a_5);
1565
- this.bra = this.c;
1566
- lab20: {
1567
- const v_13 = this.limit - this.c;
1568
- lab21: {
1569
- switch (a) {
1570
- case 1: {
1571
- const v_14 = this.limit - this.c;
1572
- lab22: {
1573
- if (
1574
- /**@type {boolean}*/
1575
- I_p1 > this.c
1576
- ) break lab22;
1577
- lab23: {
1578
- const v_15 = this.limit - this.c;
1579
- lab24: {
1580
- if (this.find_among_b(a_3) === 0) break lab24;
1581
- if (
1582
- /**@type {boolean}*/
1583
- this.c > this.limit_backward
1584
- ) break lab24;
1585
- break lab23;
1586
- }
1587
- this.c = this.limit - v_15;
1588
- this.slice_from("ee");
1589
- }
1590
- }
1591
- this.c = this.limit - v_14;
1592
- break;
1593
- }
1594
- case 2: {
1595
- break lab21;
1596
- }
1597
- case 3: {
1598
- a = this.find_among_b(a_4);
1599
- if (a === 0) break lab21;
1600
- switch (a) {
1601
- case 1: {
1602
- const v_16 = this.limit - this.c;
1603
- if (!this.out_grouping_b(g_v, 97, 121)) break lab21;
1604
- if (
1605
- /**@type {boolean}*/
1606
- this.c > this.limit_backward
1607
- ) break lab21;
1608
- this.c = this.limit - v_16;
1609
- this.bra = this.c;
1610
- this.slice_from("ie");
1611
- break;
1612
- }
1613
- case 2: {
1614
- if (
1615
- /**@type {boolean}*/
1616
- this.c > this.limit_backward
1617
- ) break lab21;
1618
- break;
1619
- }
1620
- }
1621
- break;
1622
- }
1623
- }
1624
- break lab20;
1625
- }
1626
- this.c = this.limit - v_13;
1627
- const v_17 = this.limit - this.c;
1628
- if (!this.go_out_grouping_b(g_v, 97, 121)) break lab19;
1629
- this.c--;
1630
- this.c = this.limit - v_17;
1631
- this.slice_del();
1632
- this.ket = this.c;
1633
- this.bra = this.c;
1634
- const v_18 = this.limit - this.c;
1635
- a = this.find_among_b(a_6);
1636
- switch (a) {
1637
- case 1: {
1638
- this.slice_from("e");
1639
- break lab19;
1640
- }
1641
- case 2: {
1642
- {
1643
- const v_19 = this.limit - this.c;
1644
- lab25: {
1645
- if (!this.in_grouping_b(g_aeo, 97, 111)) break lab25;
1646
- if (
1647
- /**@type {boolean}*/
1648
- this.c > this.limit_backward
1649
- ) break lab25;
1650
- break lab19;
1651
- }
1652
- this.c = this.limit - v_19;
1653
- }
1654
- break;
1655
- }
1656
- case 3: {
1657
- if (
1658
- /**@type {boolean}*/
1659
- this.c !== I_p1
1660
- ) break lab19;
1661
- const v_20 = this.limit - this.c;
1662
- if (!this.#r_shortv()) break lab19;
1663
- this.c = this.limit - v_20;
1664
- this.slice_from("e");
1665
- break lab19;
1666
- }
1667
- }
1668
- this.c = this.limit - v_18;
1669
- this.ket = this.c;
1670
- if (this.c <= this.limit_backward) break lab19;
1671
- this.c--;
1672
- this.bra = this.c;
1673
- this.slice_del();
1674
- }
1675
- }
1676
- this.c = this.limit - v_12;
1677
- const v_21 = this.limit - this.c;
1678
- lab26: {
1679
- this.ket = this.c;
1680
- lab27: {
1681
- lab28: {
1682
- if (!this.eq_s_b("y")) break lab28;
1683
- break lab27;
1684
- }
1685
- if (!this.eq_s_b("Y")) break lab26;
1686
- }
1687
- this.bra = this.c;
1688
- if (!this.out_grouping_b(g_v, 97, 121)) break lab26;
1689
- if (
1690
- /**@type {boolean}*/
1691
- this.c <= this.limit_backward
1692
- ) break lab26;
1693
- this.slice_from("i");
1694
- }
1695
- this.c = this.limit - v_21;
1696
- const v_22 = this.limit - this.c;
1697
- lab29: {
1698
- this.ket = this.c;
1699
- a = this.find_among_b(a_7);
1700
- if (a === 0) break lab29;
1701
- this.bra = this.c;
1702
- if (
1703
- /**@type {boolean}*/
1704
- I_p1 > this.c
1705
- ) break lab29;
1706
- switch (a) {
1707
- case 1: {
1708
- this.slice_from("tion");
1709
- break;
1710
- }
1711
- case 2: {
1712
- this.slice_from("ence");
1713
- break;
1714
- }
1715
- case 3: {
1716
- this.slice_from("ance");
1717
- break;
1718
- }
1719
- case 4: {
1720
- this.slice_from("able");
1721
- break;
1722
- }
1723
- case 5: {
1724
- this.slice_from("ent");
1725
- break;
1726
- }
1727
- case 6: {
1728
- this.slice_from("ize");
1729
- break;
1730
- }
1731
- case 7: {
1732
- this.slice_from("ate");
1733
- break;
1734
- }
1735
- case 8: {
1736
- this.slice_from("al");
1737
- break;
1738
- }
1739
- case 9: {
1740
- this.slice_from("ful");
1741
- break;
1742
- }
1743
- case 10: {
1744
- this.slice_from("ous");
1745
- break;
1746
- }
1747
- case 11: {
1748
- this.slice_from("ive");
1749
- break;
1750
- }
1751
- case 12: {
1752
- this.slice_from("ble");
1753
- break;
1754
- }
1755
- case 13: {
1756
- this.slice_from("og");
1757
- break;
1758
- }
1759
- case 14: {
1760
- if (!this.eq_s_b("l")) break lab29;
1761
- this.slice_from("og");
1762
- break;
1763
- }
1764
- case 15: {
1765
- this.slice_from("less");
1766
- break;
1767
- }
1768
- case 16: {
1769
- if (!this.in_grouping_b(g_valid_LI, 99, 116)) break lab29;
1770
- this.slice_del();
1771
- break;
1772
- }
1773
- }
1774
- }
1775
- this.c = this.limit - v_22;
1776
- const v_23 = this.limit - this.c;
1777
- lab30: {
1778
- this.ket = this.c;
1779
- a = this.find_among_b(a_8);
1780
- if (a === 0) break lab30;
1781
- this.bra = this.c;
1782
- if (
1783
- /**@type {boolean}*/
1784
- I_p1 > this.c
1785
- ) break lab30;
1786
- switch (a) {
1787
- case 1: {
1788
- this.slice_from("tion");
1789
- break;
1790
- }
1791
- case 2: {
1792
- this.slice_from("ate");
1793
- break;
1794
- }
1795
- case 3: {
1796
- this.slice_from("al");
1797
- break;
1798
- }
1799
- case 4: {
1800
- this.slice_from("ic");
1801
- break;
1802
- }
1803
- case 5: {
1804
- this.slice_del();
1805
- break;
1806
- }
1807
- case 6: {
1808
- if (
1809
- /**@type {boolean}*/
1810
- I_p2 > this.c
1811
- ) break lab30;
1812
- this.slice_del();
1813
- break;
1814
- }
1815
- }
1816
- }
1817
- this.c = this.limit - v_23;
1818
- const v_24 = this.limit - this.c;
1819
- lab31: {
1820
- this.ket = this.c;
1821
- a = this.find_among_b(a_9);
1822
- if (a === 0) break lab31;
1823
- this.bra = this.c;
1824
- if (
1825
- /**@type {boolean}*/
1826
- I_p2 > this.c
1827
- ) break lab31;
1828
- switch (a) {
1829
- case 1: {
1830
- this.slice_del();
1831
- break;
1832
- }
1833
- case 2: {
1834
- lab32: {
1835
- lab33: {
1836
- if (!this.eq_s_b("s")) break lab33;
1837
- break lab32;
1838
- }
1839
- if (!this.eq_s_b("t")) break lab31;
1840
- }
1841
- this.slice_del();
1842
- break;
1843
- }
1844
- }
1845
- }
1846
- this.c = this.limit - v_24;
1847
- const v_25 = this.limit - this.c;
1848
- lab34: {
1849
- this.ket = this.c;
1850
- a = this.find_among_b(a_10);
1851
- if (a === 0) break lab34;
1852
- this.bra = this.c;
1853
- switch (a) {
1854
- case 1: {
1855
- lab35: {
1856
- lab36: {
1857
- if (
1858
- /**@type {boolean}*/
1859
- I_p2 > this.c
1860
- ) break lab36;
1861
- break lab35;
1862
- }
1863
- if (
1864
- /**@type {boolean}*/
1865
- I_p1 > this.c
1866
- ) break lab34;
1867
- {
1868
- const v_26 = this.limit - this.c;
1869
- lab37: {
1870
- if (!this.#r_shortv()) break lab37;
1871
- break lab34;
1872
- }
1873
- this.c = this.limit - v_26;
1874
- }
1875
- }
1876
- this.slice_del();
1877
- break;
1878
- }
1879
- case 2: {
1880
- if (
1881
- /**@type {boolean}*/
1882
- I_p2 > this.c
1883
- ) break lab34;
1884
- if (!this.eq_s_b("l")) break lab34;
1885
- this.slice_del();
1886
- break;
1887
- }
1888
- }
1889
- }
1890
- this.c = this.limit - v_25;
1891
- this.c = this.limit_backward;
1892
- const v_27 = this.c;
1893
- lab38: {
1894
- if (!B_Y_found) break lab38;
1895
- while (true) {
1896
- const v_28 = this.c;
1897
- lab39: {
1898
- while (true) {
1899
- const v_29 = this.c;
1900
- lab41: {
1901
- this.bra = this.c;
1902
- if (!this.eq_s("Y")) break lab41;
1903
- this.ket = this.c;
1904
- this.c = v_29;
1905
- break;
1906
- }
1907
- this.c = v_29;
1908
- if (this.c >= this.limit) break lab39;
1909
- this.c++;
1910
- }
1911
- this.slice_from("y");
1912
- continue;
1913
- }
1914
- this.c = v_28;
1915
- break;
1916
- }
1917
- }
1918
- this.c = v_27;
1919
- }
1920
- return true;
1921
- }
1922
- stem(input) {
1923
- this.setCurrent(input);
1924
- this.#stem();
1925
- return this.getCurrent();
1926
- }
1927
- };
1928
- var shared = new EnglishStemmer();
1929
- function stem(token) {
1930
- return shared.stem(token);
1931
- }
1932
-
1933
- // src/languages/english.ts
1934
- var stopWords = /* @__PURE__ */ new Set([
1935
- "a",
1936
- "an",
1937
- "the",
1938
- "i",
1939
- "me",
1940
- "my",
1941
- "myself",
1942
- "we",
1943
- "us",
1944
- "our",
1945
- "ours",
1946
- "ourselves",
1947
- "you",
1948
- "your",
1949
- "yours",
1950
- "yourself",
1951
- "yourselves",
1952
- "he",
1953
- "him",
1954
- "his",
1955
- "himself",
1956
- "she",
1957
- "her",
1958
- "hers",
1959
- "herself",
1960
- "it",
1961
- "its",
1962
- "itself",
1963
- "they",
1964
- "them",
1965
- "their",
1966
- "theirs",
1967
- "themselves",
1968
- "what",
1969
- "which",
1970
- "who",
1971
- "whom",
1972
- "this",
1973
- "that",
1974
- "these",
1975
- "those",
1976
- "am",
1977
- "is",
1978
- "are",
1979
- "was",
1980
- "were",
1981
- "be",
1982
- "been",
1983
- "being",
1984
- "have",
1985
- "has",
1986
- "had",
1987
- "having",
1988
- "do",
1989
- "does",
1990
- "did",
1991
- "doing",
1992
- "will",
1993
- "would",
1994
- "shall",
1995
- "should",
1996
- "can",
1997
- "could",
1998
- "may",
1999
- "might",
2000
- "must",
2001
- "ought",
2002
- "i'm",
2003
- "you're",
2004
- "we're",
2005
- "they're",
2006
- "i've",
2007
- "you've",
2008
- "we've",
2009
- "they've",
2010
- "i'd",
2011
- "you'd",
2012
- "he'd",
2013
- "she'd",
2014
- "we'd",
2015
- "they'd",
2016
- "i'll",
2017
- "you'll",
2018
- "he'll",
2019
- "she'll",
2020
- "we'll",
2021
- "they'll",
2022
- "isn't",
2023
- "aren't",
2024
- "wasn't",
2025
- "weren't",
2026
- "hasn't",
2027
- "haven't",
2028
- "hadn't",
2029
- "doesn't",
2030
- "don't",
2031
- "didn't",
2032
- "won't",
2033
- "wouldn't",
2034
- "shan't",
2035
- "shouldn't",
2036
- "can't",
2037
- "cannot",
2038
- "couldn't",
2039
- "mustn't",
2040
- "and",
2041
- "but",
2042
- "if",
2043
- "or",
2044
- "because",
2045
- "as",
2046
- "until",
2047
- "while",
2048
- "of",
2049
- "at",
2050
- "by",
2051
- "for",
2052
- "with",
2053
- "about",
2054
- "against",
2055
- "between",
2056
- "into",
2057
- "through",
2058
- "during",
2059
- "before",
2060
- "after",
2061
- "above",
2062
- "below",
2063
- "to",
2064
- "from",
2065
- "up",
2066
- "down",
2067
- "in",
2068
- "out",
2069
- "on",
2070
- "off",
2071
- "over",
2072
- "under",
2073
- "again",
2074
- "further",
2075
- "then",
2076
- "once",
2077
- "here",
2078
- "there",
2079
- "when",
2080
- "where",
2081
- "why",
2082
- "how",
2083
- "all",
2084
- "any",
2085
- "both",
2086
- "each",
2087
- "few",
2088
- "more",
2089
- "most",
2090
- "other",
2091
- "some",
2092
- "such",
2093
- "no",
2094
- "nor",
2095
- "not",
2096
- "only",
2097
- "own",
2098
- "same",
2099
- "so",
2100
- "than",
2101
- "too",
2102
- "very"
2103
- ]);
2104
- var english = {
2105
- name: "english",
2106
- revision: "ebae3448ae674b59",
2107
- stemmer: stem,
2108
- stopWords,
2109
- tokenizer: {
2110
- splitPattern: /[^\p{L}\p{M}\p{N}_']+/u,
2111
- stripPossessive: true
2112
- }
2113
- };
2114
-
2115
- // src/languages/registry.ts
2116
- var languages = /* @__PURE__ */ new Map();
2117
- languages.set("english", english);
2118
- function registerLanguage(module) {
2119
- languages.set(module.name, module);
2120
- }
2121
- function getLanguage(name) {
2122
- const lang = languages.get(name);
2123
- if (!lang) {
2124
- throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
2125
- }
2126
- return lang;
2127
- }
2128
-
2129
625
  // src/engine/memory/write-block.browser.ts
2130
626
  function validateMemorySettings(_settings) {
2131
627
  }
@@ -2798,38 +1294,6 @@ function validateRequiredFields(document, required) {
2798
1294
  }
2799
1295
  }
2800
1296
  }
2801
- var INTEGER_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH };
2802
- var FLOAT_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH, forceIntegerToFloat: true };
2803
- var integerEncoder = new Encoder(INTEGER_ENCODING);
2804
- var floatEncoder = new Encoder(FLOAT_ENCODING);
2805
- function encodeExactly(document, forceIntegerToFloat) {
2806
- const bytes = (forceIntegerToFloat ? floatEncoder : integerEncoder).encode(document);
2807
- if (bytes.byteLength > DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES) {
2808
- if (forceIntegerToFloat) floatEncoder = new Encoder(FLOAT_ENCODING);
2809
- else integerEncoder = new Encoder(INTEGER_ENCODING);
2810
- }
2811
- return bytes;
2812
- }
2813
- function holdsNegativeZero(value, depth) {
2814
- if (typeof value === "number") return Object.is(value, -0);
2815
- if (value === null || typeof value !== "object" || ArrayBuffer.isView(value) || depth > MAX_DOCUMENT_ENCODING_DEPTH) {
2816
- return false;
2817
- }
2818
- for (const child of Array.isArray(value) ? value : Object.values(value)) {
2819
- if (holdsNegativeZero(child, depth + 1)) return true;
2820
- }
2821
- return false;
2822
- }
2823
- function encodeDocument(document) {
2824
- try {
2825
- return encodeExactly(document, holdsNegativeZero(document, 1));
2826
- } catch (error) {
2827
- throw new NarsilError(
2828
- ErrorCodes.DOC_VALIDATION_FAILED,
2829
- `The document cannot be encoded as MessagePack: ${error instanceof Error ? error.message : String(error)}`
2830
- );
2831
- }
2832
- }
2833
1297
 
2834
1298
  // src/schema/validator/document-size.ts
2835
1299
  var LARGEST_HEADER_BYTES = 5;
@@ -3059,11 +1523,6 @@ function validateRequiredFieldsInSchema(required, schema) {
3059
1523
  }
3060
1524
  }
3061
1525
 
3062
- // src/runtime/heap-statistics.browser.ts
3063
- function readHeapStatistics() {
3064
- return null;
3065
- }
3066
-
3067
1526
  // src/core/partition/utils.ts
3068
1527
  function getOrCreateFieldNameIndex(table, fieldName) {
3069
1528
  const existing = table.indexMap.get(fieldName);
@@ -3158,8 +1617,8 @@ function splitPaths(paths) {
3158
1617
  return split;
3159
1618
  }
3160
1619
  function overlaps(a, b) {
3161
- const shared2 = Math.min(a.length, b.length);
3162
- for (let i = 0; i < shared2; i++) {
1620
+ const shared = Math.min(a.length, b.length);
1621
+ for (let i = 0; i < shared; i++) {
3163
1622
  if (a[i] !== b[i]) return false;
3164
1623
  }
3165
1624
  return true;
@@ -7842,7 +6301,7 @@ function requireLoadedPhraseCode() {
7842
6301
  }
7843
6302
  function loadPhraseCode() {
7844
6303
  if (loading === null) {
7845
- loading = import('./phrase-module-CNKMUY4U.mjs').then(
6304
+ loading = import('./phrase-module-NPYUVX75.mjs').then(
7846
6305
  (code) => {
7847
6306
  loaded = code;
7848
6307
  return code;
@@ -11664,7 +10123,7 @@ function localMeter(cap, spent, matcherStateBytes, flushUnits, clock) {
11664
10123
  new BigInt64Array(counter)[0] = BigInt(seed);
11665
10124
  preparedTypoTests = new SharedArrayBuffer(PREPARED_TYPO_TEST_BYTES);
11666
10125
  }
11667
- const shared2 = {
10126
+ const shared = {
11668
10127
  cap,
11669
10128
  spent: seed,
11670
10129
  counter,
@@ -11673,7 +10132,7 @@ function localMeter(cap, spent, matcherStateBytes, flushUnits, clock) {
11673
10132
  flushUnits: Math.max(1, Math.floor(flushUnits / copies))
11674
10133
  };
11675
10134
  return {
11676
- shared: shared2,
10135
+ shared,
11677
10136
  settle(reportedUnits) {
11678
10137
  if (counter === null) {
11679
10138
  meter.add(reportedUnits);
@@ -12989,8 +11448,8 @@ function encodedProjectionPathOf(path) {
12989
11448
  return segments;
12990
11449
  }
12991
11450
  function sharesPrefix(left, right) {
12992
- const shared2 = Math.min(left.length, right.length);
12993
- for (let at = 0; at < shared2; at++) {
11451
+ const shared = Math.min(left.length, right.length);
11452
+ for (let at = 0; at < shared; at++) {
12994
11453
  if (left[at] !== right[at]) return false;
12995
11454
  }
12996
11455
  return true;
@@ -13204,8 +11663,8 @@ function encodeExternalIdTableData(docIds) {
13204
11663
  }
13205
11664
  function compareBytes(blob, start, end, query) {
13206
11665
  const length = end - start;
13207
- const shared2 = length < query.length ? length : query.length;
13208
- for (let i = 0; i < shared2; i++) {
11666
+ const shared = length < query.length ? length : query.length;
11667
+ for (let i = 0; i < shared; i++) {
13209
11668
  const diff = blob[start + i] - query[i];
13210
11669
  if (diff !== 0) return diff;
13211
11670
  }
@@ -14021,8 +12480,8 @@ var encoder3 = new TextEncoder();
14021
12480
  var decoder3 = new TextDecoder();
14022
12481
  function compareBytes2(blob, start, end, query) {
14023
12482
  const length = end - start;
14024
- const shared2 = length < query.length ? length : query.length;
14025
- for (let i = 0; i < shared2; i++) {
12483
+ const shared = length < query.length ? length : query.length;
12484
+ for (let i = 0; i < shared; i++) {
14026
12485
  const diff = blob[start + i] - query[i];
14027
12486
  if (diff !== 0) return diff;
14028
12487
  }
@@ -15353,7 +13812,7 @@ async function attachSegments(entry, action) {
15353
13812
  growPartitionsTo(entry.manager, segment.partitionId);
15354
13813
  const surfaceForms = segment.survivingSurfaceForms;
15355
13814
  const spellings = surfaceForms === void 0 ? void 0 : NO_REMOVED_SPELLINGS;
15356
- const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-KAMRAJLE.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
13815
+ const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-M4JNBV6V.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
15357
13816
  for (const docId of segment.tombstonedDocIds ?? []) frozen.tombstoneDocument(docId, spellings);
15358
13817
  entry.manager.attachFrozenSegment(segment.partitionId, frozen);
15359
13818
  }
@@ -15408,7 +13867,7 @@ function runSegmentAction(entry, action) {
15408
13867
  case "attachSegments":
15409
13868
  return attachSegments(entry, action);
15410
13869
  case "adoptDiskSegments":
15411
- return import('./module-KAMRAJLE.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
13870
+ return import('./module-M4JNBV6V.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
15412
13871
  case "compactSegments": {
15413
13872
  const partition = requireComposite(entry, action.indexName, action.partitionId, "compact");
15414
13873
  return mergeFrozenSegments(
@@ -15456,7 +13915,7 @@ function requireLoadedVectorCode() {
15456
13915
  function loadVectorCode() {
15457
13916
  if (loaded2 !== null) return Promise.resolve(loaded2);
15458
13917
  if (loading2 === null) {
15459
- loading2 = import('./module-XQLEOYNM.mjs').then(
13918
+ loading2 = import('./module-EC3FYW7N.mjs').then(
15460
13919
  (code) => {
15461
13920
  loaded2 = code;
15462
13921
  return code;
@@ -15872,7 +14331,7 @@ var TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS = 1e3;
15872
14331
  // src/partitioning/rewrite-spill-of.ts
15873
14332
  async function rewriteSpillOf(storage, manager, target) {
15874
14333
  if (storage === void 0 || (target?.config ?? manager.config).textStorage !== "disk") return null;
15875
- const { openRewriteSpill } = await import('./module-KAMRAJLE.mjs');
14334
+ const { openRewriteSpill } = await import('./module-M4JNBV6V.mjs');
15876
14335
  return openRewriteSpill(storage, manager, target);
15877
14336
  }
15878
14337
 
@@ -16565,7 +15024,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
16565
15024
  const existing = deps.indexRegistry.get(metadata.indexName);
16566
15025
  if (existing !== void 0) {
16567
15026
  if ((metadata.analysisGeneration ?? 0) > existing.analysisGeneration) {
16568
- const { adoptSavedAnalysis } = await import('./analysis-change-2V2HZ2NY.mjs');
15027
+ const { adoptSavedAnalysis } = await import('./analysis-change-IXWPXXJJ.mjs');
16569
15028
  adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
16570
15029
  }
16571
15030
  if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
@@ -16620,7 +15079,8 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
16620
15079
  synonyms,
16621
15080
  analysisGeneration: metadata.analysisGeneration ?? 0,
16622
15081
  pendingAnalysis: metadata.pendingAnalysis ?? null,
16623
- durableAnalysis: null
15082
+ durableAnalysis: null,
15083
+ sync: metadata.sync?.enabled === true ? (await import('./sync-state-P5XG6LTQ.mjs')).syncStateOfMetadata(metadata) : null
16624
15084
  });
16625
15085
  if (loadData) await deps.indexState().registerOpen(metadata.indexName);
16626
15086
  else deps.indexState().registerClosed(metadata.indexName);
@@ -17415,9 +15875,9 @@ function captureComposite(manager, partitionId) {
17415
15875
  const segmentIds = partition.frozenSegmentSizes().map((size) => size.segmentId);
17416
15876
  const frozen = [];
17417
15877
  for (const segment of partition.frozenSegmentsById(segmentIds)) {
17418
- const shared2 = shareFrozenSegment(segment, manager.partialWordAnalysis);
17419
- if (shared2 === null) return null;
17420
- frozen.push(shared2);
15878
+ const shared = shareFrozenSegment(segment, manager.partialWordAnalysis);
15879
+ if (shared === null) return null;
15880
+ frozen.push(shared);
17421
15881
  }
17422
15882
  return { partitionId, live: captureLiveTail(partition.live), frozen };
17423
15883
  }
@@ -17461,11 +15921,11 @@ async function sendPartition(manager, executors, captured) {
17461
15921
  );
17462
15922
  }
17463
15923
  if (captured.frozen.length === 0) return;
17464
- const segments = captured.frozen.map((shared2) => ({
15924
+ const segments = captured.frozen.map((shared) => ({
17465
15925
  partitionId: captured.partitionId,
17466
- snapshot: shared2.snapshot,
17467
- tombstonedDocIds: shared2.tombstonedDocIds,
17468
- survivingSurfaceForms: shared2.survivingSurfaceForms
15926
+ snapshot: shared.snapshot,
15927
+ tombstonedDocIds: shared.tombstonedDocIds,
15928
+ survivingSurfaceForms: shared.survivingSurfaceForms
17469
15929
  }));
17470
15930
  await Promise.all(
17471
15931
  executors.map(
@@ -18687,7 +17147,7 @@ async function startPool(state) {
18687
17147
  );
18688
17148
  }
18689
17149
  eligibleIndexNames(state);
18690
- const [factory, { createWorkerPool }] = await Promise.all([createWorkerFactory(), import('./pool-DTYSPBMQ.mjs')]);
17150
+ const [factory, { createWorkerPool }] = await Promise.all([createWorkerFactory(), import('./pool-WCGDZHJP.mjs')]);
18691
17151
  let started = null;
18692
17152
  const pool = createWorkerPool({
18693
17153
  count: state.keywordWorkerCount + state.longQueryWorkerCount,
@@ -19378,7 +17838,7 @@ async function emitWriteEventAfter(source, indexName, write) {
19378
17838
  // src/engine/core.ts
19379
17839
  async function createEngineCore(config, hooks, capacityScope = "index") {
19380
17840
  validateWorkerConfig(config?.workers, config?.lifecycle);
19381
- const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-D2ULZGCN.mjs')).resolveRerankSettings(config);
17841
+ const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-3EW2AGB6.mjs')).resolveRerankSettings(config);
19382
17842
  const eventHandlers = eventHandlersOf(config?.events);
19383
17843
  const vectorWorkerCount = splitWorkerBudget(resolveWorkerCount(config?.workers?.count)).vector;
19384
17844
  const vectorCopyPolicy = {
@@ -19389,7 +17849,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
19389
17849
  if (config?.lifecycle !== void 0 && durabilityTier === null) {
19390
17850
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
19391
17851
  }
19392
- const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-LM7WFL6X.mjs');
17852
+ const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-GL4A7KDV.mjs');
19393
17853
  const filesystemDurability = durabilityTier?.kind === "wal";
19394
17854
  const executor = createDirectExecutor({
19395
17855
  vectorWorkerCopies: vectorCopyPolicy,
@@ -19516,7 +17976,8 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
19516
17976
  if (entry === void 0) return;
19517
17977
  entry.documentCount = documentCount;
19518
17978
  entry.partitionCount = partitionCount;
19519
- }
17979
+ },
17980
+ engineCore: () => engineCore
19520
17981
  });
19521
17982
  invalidation = createInvalidationFromConfig(config, durabilityTier?.kind ?? null, {
19522
17983
  getManager: (indexName) => executor.getManager(indexName) ?? void 0,
@@ -19574,7 +18035,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
19574
18035
  requireManager,
19575
18036
  resumeChange: async (indexName) => {
19576
18037
  if ((indexRegistry.get(indexName)?.pendingAnalysis ?? null) === null) return;
19577
- await (await import('./analysis-change-entry-JL5U2N3Q.mjs')).resumeChangeOf(engineCore, indexName);
18038
+ await (await import('./analysis-change-entry-FCSHFQSS.mjs')).resumeChangeOf(engineCore, indexName);
19578
18039
  },
19579
18040
  onClose: hooks?.onIndexClose,
19580
18041
  onOpen: (indexName) => {
@@ -19658,7 +18119,7 @@ async function startEngineCore(core, config) {
19658
18119
  checkHeapAfterRecovery(core);
19659
18120
  }
19660
18121
  if (core.invalidation) await core.invalidation.start();
19661
- if (core.durability) await (await import('./analysis-change-entry-JL5U2N3Q.mjs')).resumeEveryChange(core);
18122
+ if (core.durability) await (await import('./analysis-change-entry-FCSHFQSS.mjs')).resumeEveryChange(core);
19662
18123
  if (config?.lifecycle === void 0) await core.analysisRebuild.reviewStaleIndexes();
19663
18124
  } catch (err) {
19664
18125
  await core.durability?.manager.shutdown().catch(() => void 0);
@@ -19696,7 +18157,7 @@ async function shutdownEngine(core) {
19696
18157
  }
19697
18158
  }
19698
18159
  if (core.rerankAdapters.size > 0) {
19699
- await (await import('./runtime-D2ULZGCN.mjs')).shutdownRerankAdapters(core.rerankAdapters);
18160
+ await (await import('./runtime-3EW2AGB6.mjs')).shutdownRerankAdapters(core.rerankAdapters);
19700
18161
  }
19701
18162
  await orchestrator.shutdown();
19702
18163
  await executor.shutdown();
@@ -19828,162 +18289,7 @@ function storedBM25Params(params) {
19828
18289
  return Object.keys(stored).length === 0 ? void 0 : stored;
19829
18290
  }
19830
18291
 
19831
- // src/serialization/crc32.ts
19832
- var IEEE_POLYNOMIAL = 3988292384;
19833
- var ALL_BITS = 4294967295;
19834
- var cachedTable = null;
19835
- function buildTable() {
19836
- const table = new Uint32Array(256);
19837
- for (let i = 0; i < 256; i++) {
19838
- let crc = i;
19839
- for (let bit = 0; bit < 8; bit++) {
19840
- crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
19841
- }
19842
- table[i] = crc;
19843
- }
19844
- return table;
19845
- }
19846
- function getTable() {
19847
- if (cachedTable === null) {
19848
- cachedTable = buildTable();
19849
- }
19850
- return cachedTable;
19851
- }
19852
- function crc32(data) {
19853
- return crc32Final(crc32Update(crc32Init(), data));
19854
- }
19855
- function crc32Init() {
19856
- return ALL_BITS;
19857
- }
19858
- function crc32Update(state, data) {
19859
- const table = getTable();
19860
- let crc = state;
19861
- for (let i = 0; i < data.length; i++) {
19862
- crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
19863
- }
19864
- return crc;
19865
- }
19866
- function crc32Final(state) {
19867
- return (state ^ ALL_BITS) >>> 0;
19868
- }
19869
-
19870
- // src/serialization/chunk-checksum.ts
19871
- function yieldToEventLoop3() {
19872
- if (typeof setImmediate === "function") {
19873
- return new Promise((resolve) => setImmediate(resolve));
19874
- }
19875
- return new Promise((resolve) => setTimeout(resolve, 0));
19876
- }
19877
- async function advanceChecksum(start, payload) {
19878
- let state = start;
19879
- for (let offset = 0; offset < payload.length; offset += CHECKSUM_YIELD_CHUNK_BYTES) {
19880
- const end = Math.min(offset + CHECKSUM_YIELD_CHUNK_BYTES, payload.length);
19881
- state = crc32Update(state, payload.subarray(offset, end));
19882
- if (end < payload.length) {
19883
- await yieldToEventLoop3();
19884
- }
19885
- }
19886
- return state;
19887
- }
19888
- async function checksumOfChunks(chunks) {
19889
- let state = crc32Init();
19890
- for (const chunk of chunks) state = await advanceChecksum(state, chunk);
19891
- return crc32Final(state);
19892
- }
19893
-
19894
- // src/serialization/header.ts
19895
- var MAGIC_BYTES = new Uint8Array([78, 82, 83, 76]);
19896
- var HEADER_SIZE = 32;
19897
- var MAX_PAYLOAD_LENGTH = 4294967295;
19898
- var COMPRESSION_ALGORITHMS = {
19899
- 0: "none",
19900
- 1: "gzip",
19901
- 2: "lz4",
19902
- 3: "zstd"
19903
- };
19904
- var COMPRESSION_TO_BITS = {
19905
- none: 0,
19906
- gzip: 1,
19907
- lz4: 2,
19908
- zstd: 3
19909
- };
19910
- function encodeFlags(flags) {
19911
- let bits = 0;
19912
- if (flags.compressionEnabled) bits |= 1;
19913
- bits |= (COMPRESSION_TO_BITS[flags.compressionAlgorithm] & 3) << 1;
19914
- if (flags.checksumPresent) bits |= 1 << 3;
19915
- if (flags.encryptionEnabled) bits |= 1 << 4;
19916
- return bits;
19917
- }
19918
- function decodeFlags(value) {
19919
- const compressionEnabled = (value & 1) === 1;
19920
- const algorithmBits = value >> 1 & 3;
19921
- const checksumPresent = (value >> 3 & 1) === 1;
19922
- const encryptionEnabled = (value >> 4 & 1) === 1;
19923
- return {
19924
- compressionEnabled,
19925
- compressionAlgorithm: COMPRESSION_ALGORITHMS[algorithmBits] ?? "none",
19926
- checksumPresent,
19927
- encryptionEnabled
19928
- };
19929
- }
19930
- function writeHeader(header) {
19931
- if (header.payloadLength > MAX_PAYLOAD_LENGTH) {
19932
- throw new NarsilError(
19933
- ErrorCodes.PERSISTENCE_SAVE_FAILED,
19934
- `A payload of ${header.payloadLength} bytes exceeds the ${MAX_PAYLOAD_LENGTH} bytes the envelope header can describe`,
19935
- { payloadLength: header.payloadLength, maxPayloadLength: MAX_PAYLOAD_LENGTH }
19936
- );
19937
- }
19938
- const buffer = new Uint8Array(HEADER_SIZE);
19939
- const view = new DataView(buffer.buffer);
19940
- buffer.set(MAGIC_BYTES, 0);
19941
- buffer[4] = header.envelopeFormatVersion & 255;
19942
- buffer[5] = header.engineVersionMajor & 255;
19943
- buffer[6] = header.engineVersionMinor & 255;
19944
- buffer[7] = header.engineVersionPatch & 255;
19945
- view.setUint32(8, header.payloadLength, false);
19946
- view.setUint16(12, encodeFlags(header.flags), false);
19947
- view.setUint32(14, header.checksum, false);
19948
- for (let i = 18; i < HEADER_SIZE; i++) {
19949
- buffer[i] = 0;
19950
- }
19951
- return buffer;
19952
- }
19953
- function hasNrslMagic(data) {
19954
- return data.length >= MAGIC_BYTES.length && data[0] === MAGIC_BYTES[0] && data[1] === MAGIC_BYTES[1] && data[2] === MAGIC_BYTES[2] && data[3] === MAGIC_BYTES[3];
19955
- }
19956
- function readHeader(data) {
19957
- if (data.length < HEADER_SIZE) {
19958
- throw new NarsilError(
19959
- ErrorCodes.ENVELOPE_INVALID_MAGIC,
19960
- `Expected at least ${HEADER_SIZE} bytes, received ${data.length}`
19961
- );
19962
- }
19963
- if (data[0] !== MAGIC_BYTES[0] || data[1] !== MAGIC_BYTES[1] || data[2] !== MAGIC_BYTES[2] || data[3] !== MAGIC_BYTES[3]) {
19964
- throw new NarsilError(ErrorCodes.ENVELOPE_INVALID_MAGIC, "File does not begin with NRSL magic bytes");
19965
- }
19966
- const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
19967
- const envelopeFormatVersion = data[4];
19968
- const engineVersionMajor = data[5];
19969
- const engineVersionMinor = data[6];
19970
- const engineVersionPatch = data[7];
19971
- const payloadLength = view.getUint32(8, false);
19972
- const flagBits = view.getUint16(12, false);
19973
- const checksum = view.getUint32(14, false);
19974
- const reserved = data.slice(18, HEADER_SIZE);
19975
- return {
19976
- magic: "NRSL",
19977
- envelopeFormatVersion,
19978
- engineVersionMajor,
19979
- engineVersionMinor,
19980
- engineVersionPatch,
19981
- payloadLength,
19982
- flags: decodeFlags(flagBits),
19983
- checksum,
19984
- reserved
19985
- };
19986
- }
18292
+ // src/serialization/envelope-file.ts
19987
18293
  function engineVersionParts() {
19988
18294
  const parts = VERSION.split(".");
19989
18295
  return [
@@ -19992,103 +18298,15 @@ function engineVersionParts() {
19992
18298
  Number.parseInt(parts[2] ?? "0", 10)
19993
18299
  ];
19994
18300
  }
19995
- function payloadByteLength(chunks) {
19996
- let total = 0;
19997
- for (const chunk of chunks) total += chunk.byteLength;
19998
- return total;
19999
- }
20000
- function requireWithinFileLimit(byteLength, what) {
20001
- if (byteLength <= MAX_FILE_BYTES) return;
20002
- throw new NarsilError(
20003
- ErrorCodes.PERSISTENCE_SAVE_FAILED,
20004
- `The ${what} would take ${byteLength} bytes, above the file size limit of ${MAX_FILE_BYTES}`,
20005
- { bytes: byteLength, maximum: MAX_FILE_BYTES }
20006
- );
20007
- }
20008
18301
  async function packChecksummedEnvelope(payloadChunks, envelopeFormatVersion, what) {
20009
18302
  requireWithinFileLimit(HEADER_SIZE + payloadByteLength(payloadChunks), what);
20010
18303
  return packEnvelopeWithChecksum(payloadChunks, envelopeFormatVersion, what, await checksumOfChunks(payloadChunks));
20011
18304
  }
20012
18305
  function packEnvelopeWithChecksum(payloadChunks, envelopeFormatVersion, what, checksum) {
20013
- const payloadLength = payloadByteLength(payloadChunks);
20014
- requireWithinFileLimit(HEADER_SIZE + payloadLength, what);
20015
- const [major, minor, patch] = engineVersionParts();
20016
- const header = writeHeader({
20017
- envelopeFormatVersion,
20018
- engineVersionMajor: major,
20019
- engineVersionMinor: minor,
20020
- engineVersionPatch: patch,
20021
- payloadLength,
20022
- flags: { compressionEnabled: false, compressionAlgorithm: "none", checksumPresent: true, encryptionEnabled: false },
20023
- checksum});
20024
- return { chunks: [header, ...payloadChunks], byteLength: HEADER_SIZE + payloadLength, checksum };
20025
- }
20026
- function loadFailed(message, details) {
20027
- throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, message, details);
20028
- }
20029
- async function gunzipWithinLimit(compressed, what) {
20030
- const { gunzip } = await import('./gzip-5S7ROJFJ.mjs');
20031
- try {
20032
- return await gunzip(compressed, MAX_FILE_BYTES);
20033
- } catch (error) {
20034
- if (error?.code === "EFBIG") {
20035
- loadFailed(`The ${what} inflates past the file size limit of ${MAX_FILE_BYTES} bytes`);
20036
- }
20037
- loadFailed(`The ${what} holds a gzip payload that fails to inflate`, {
20038
- cause: error instanceof Error ? error.message : String(error)
20039
- });
20040
- }
20041
- }
20042
- async function openChecksummedEnvelope(data, expected) {
20043
- const { envelopeFormatVersion, what } = expected;
20044
- const header = readHeader(data);
20045
- if (header.envelopeFormatVersion !== envelopeFormatVersion) {
20046
- throw new NarsilError(
20047
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
20048
- `The ${what} holds envelope format v${header.envelopeFormatVersion}, while this build reads it as v${envelopeFormatVersion}`,
20049
- { version: header.envelopeFormatVersion, expected: envelopeFormatVersion }
20050
- );
20051
- }
20052
- if (header.flags.encryptionEnabled) {
20053
- throw new NarsilError(
20054
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
20055
- `The ${what} is encrypted, which this build cannot read`
20056
- );
20057
- }
20058
- if (header.flags.compressionEnabled && !expected.allowsCompression) {
20059
- loadFailed(`The ${what} is compressed, while its format stores it raw`);
20060
- }
20061
- if (header.flags.compressionEnabled && header.flags.compressionAlgorithm !== "gzip") {
20062
- throw new NarsilError(
20063
- ErrorCodes.ENVELOPE_VERSION_MISMATCH,
20064
- `The ${what} uses ${header.flags.compressionAlgorithm} compression, which this build cannot read`
20065
- );
20066
- }
20067
- if (!header.flags.checksumPresent) loadFailed(`The ${what} carries no checksum, while its format requires one`);
20068
- if (data.byteLength !== HEADER_SIZE + header.payloadLength) {
20069
- loadFailed(
20070
- `The ${what} holds ${data.byteLength} bytes where its header gives ${HEADER_SIZE + header.payloadLength}`,
20071
- { bytes: data.byteLength, expected: HEADER_SIZE + header.payloadLength }
20072
- );
20073
- }
20074
- const payload = data.subarray(HEADER_SIZE);
20075
- const computed = await checksumOfChunks([payload]);
20076
- if (computed !== header.checksum) {
20077
- throw new NarsilError(
20078
- ErrorCodes.PERSISTENCE_CRC_MISMATCH,
20079
- `The checksum of the ${what} does not match its payload`,
20080
- {
20081
- expected: header.checksum,
20082
- computed
20083
- }
20084
- );
20085
- }
20086
- if (header.flags.compressionEnabled) return { header, payload: await gunzipWithinLimit(payload, what) };
20087
- return { header, payload };
18306
+ return packEnvelopeWithEngineVersion(payloadChunks, envelopeFormatVersion, what, checksum, engineVersionParts());
20088
18307
  }
20089
18308
 
20090
18309
  // src/engine/snapshot/index-configuration.ts
20091
- var INDEX_CONFIGURATION_ENVELOPE_VERSION = 5;
20092
18310
  function refuseCode(entry) {
20093
18311
  if (entry.config.tokenizer !== void 0 && typeof entry.config.tokenizer !== "string") {
20094
18312
  throw new NarsilError(
@@ -20106,7 +18324,7 @@ function refuseCode(entry) {
20106
18324
  function indexConfigurationOf(entry) {
20107
18325
  refuseCode(entry);
20108
18326
  const synonyms = entry.synonyms === null ? void 0 : rulesOfStoredSynonyms(entry.synonyms);
20109
- return configurationPayloadOf(
18327
+ const payload = configurationPayloadOf(
20110
18328
  entry.config,
20111
18329
  entry.language,
20112
18330
  entry.embeddingAdapterName,
@@ -20115,6 +18333,7 @@ function indexConfigurationOf(entry) {
20115
18333
  synonyms,
20116
18334
  entry.analysisGeneration
20117
18335
  );
18336
+ return entry.sync === null ? payload : { ...payload, syncEpoch: entry.sync.epoch };
20118
18337
  }
20119
18338
  function requireConfigurationWithinSizeLimit(config, language) {
20120
18339
  const adapter = config.embedding?.adapter;
@@ -20184,33 +18403,6 @@ async function encodeIndexConfiguration(entry) {
20184
18403
  }
20185
18404
  return bytes;
20186
18405
  }
20187
- function requireConfigurationShape(raw, what) {
20188
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
20189
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} does not hold an index configuration`);
20190
- }
20191
- const configuration = raw;
20192
- if (configuration.schema === null || typeof configuration.schema !== "object") {
20193
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no schema`);
20194
- }
20195
- if (typeof configuration.language !== "string" || configuration.language.length === 0) {
20196
- throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no language`);
20197
- }
20198
- return configuration;
20199
- }
20200
- async function decodeIndexConfiguration(bytes) {
20201
- const { payload } = await openChecksummedEnvelope(bytes, {
20202
- envelopeFormatVersion: INDEX_CONFIGURATION_ENVELOPE_VERSION,
20203
- what: "index configuration",
20204
- allowsCompression: true
20205
- });
20206
- let raw;
20207
- try {
20208
- raw = decode(payload);
20209
- } catch {
20210
- throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, "The index configuration is not MessagePack");
20211
- }
20212
- return requireConfigurationShape(raw, "index configuration");
20213
- }
20214
18406
 
20215
18407
  // src/engine/index-lifecycle.ts
20216
18408
  async function runLifecycleHook(core, hookName, context) {
@@ -20324,7 +18516,8 @@ async function createEngineIndex(core, config, name, requestedConfig, creation =
20324
18516
  synonyms: synonyms?.encoded ?? null,
20325
18517
  analysisGeneration: 0,
20326
18518
  pendingAnalysis: null,
20327
- durableAnalysis: null
18519
+ durableAnalysis: null,
18520
+ sync: null
20328
18521
  });
20329
18522
  await core.indexState.registerOpen(name);
20330
18523
  if (core.durability) {
@@ -20337,7 +18530,7 @@ async function dropEngineIndex(core, name) {
20337
18530
  const entry = core.requireIndex(name);
20338
18531
  const changeRecorded = () => entry.pendingAnalysis !== null || entry.durableAnalysis !== null;
20339
18532
  const abandonChange = async () => {
20340
- await (await import('./analysis-change-entry-JL5U2N3Q.mjs')).abandonChangeOf(core, name);
18533
+ await (await import('./analysis-change-entry-FCSHFQSS.mjs')).abandonChangeOf(core, name);
20341
18534
  };
20342
18535
  if (changeRecorded()) await abandonChange();
20343
18536
  await core.indexState.drop(name, async () => {
@@ -20356,6 +18549,7 @@ async function dropEngineIndex(core, name) {
20356
18549
  core.indexRegistry.delete(name);
20357
18550
  core.watermarkNotifier.forget(name);
20358
18551
  core.analysisRebuild.clearStale(name);
18552
+ if (entry.sync !== null) emitSyncChange(core.indexRegistry, { kind: "dropped", indexName: name });
20359
18553
  });
20360
18554
  await runLifecycleHook(core, "onIndexDrop", { indexName: name, config: entry.config });
20361
18555
  }
@@ -21179,11 +19373,11 @@ function payloadSegments(segments) {
21179
19373
  return plain;
21180
19374
  }
21181
19375
  function snapshotSegments(segments) {
21182
- const shared2 = [];
19376
+ const shared = [];
21183
19377
  for (const segment of segments) {
21184
- if (segment.snapshot !== null) shared2.push({ partitionId: segment.partitionId, snapshot: segment.snapshot });
19378
+ if (segment.snapshot !== null) shared.push({ partitionId: segment.partitionId, snapshot: segment.snapshot });
21185
19379
  }
21186
- return shared2;
19380
+ return shared;
21187
19381
  }
21188
19382
  function attachSegments2(orchestrator, indexName, segments) {
21189
19383
  return orchestrator.replicateToWorkers({
@@ -21199,8 +19393,8 @@ async function broadcastBuiltSegments(orchestrator, indexName, segments, skipClo
21199
19393
  await attachSegments2(orchestrator, indexName, frozen);
21200
19394
  return;
21201
19395
  }
21202
- const shared2 = snapshotSegments(segments);
21203
- if (shared2.length > 0) await attachSegments2(orchestrator, indexName, shared2);
19396
+ const shared = snapshotSegments(segments);
19397
+ if (shared.length > 0) await attachSegments2(orchestrator, indexName, shared);
21204
19398
  const plain = payloadSegments(segments);
21205
19399
  if (plain.length === 0) return;
21206
19400
  await orchestrator.replicateToWorkers({
@@ -21966,6 +20160,31 @@ async function updateDocumentBatch(ctx, indexName, updates, options) {
21966
20160
  return { succeeded, failed };
21967
20161
  }
21968
20162
 
20163
+ // src/engine/sync-epoch.ts
20164
+ async function holdSyncEpochChange(core, indexName) {
20165
+ if ((core.indexRegistry.get(indexName)?.sync ?? null) === null) return () => void 0;
20166
+ return (await import('./operations-WVYLF72Q.mjs')).holdRenewedSyncEpoch(core, indexName);
20167
+ }
20168
+ async function withRenewedSyncEpoch(core, indexName, change) {
20169
+ const release = await holdSyncEpochChange(core, indexName);
20170
+ try {
20171
+ return await change();
20172
+ } finally {
20173
+ release();
20174
+ }
20175
+ }
20176
+
20177
+ // src/engine/clear-index.ts
20178
+ function clearEngineIndex(core, indexName) {
20179
+ return withRenewedSyncEpoch(core, indexName, async () => {
20180
+ await core.executor.execute({ type: "clear", indexName, requestId: indexName });
20181
+ await core.orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
20182
+ core.watermarkNotifier.forget(indexName);
20183
+ const durable = core.durability?.manager;
20184
+ await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
20185
+ });
20186
+ }
20187
+
21969
20188
  // src/runtime/process-memory.ts
21970
20189
  function readProcessMemory() {
21971
20190
  const proc = globalThis.process;
@@ -21990,35 +20209,6 @@ function readProcessMemory() {
21990
20209
  }
21991
20210
  }
21992
20211
 
21993
- // src/engine/serial-index-update.ts
21994
- var updatingByCore = /* @__PURE__ */ new WeakMap();
21995
- async function withOpenIndex(core, indexName, action) {
21996
- core.guardShutdown();
21997
- core.requireIndex(indexName);
21998
- const release = await core.indexState.acquire(indexName);
21999
- try {
22000
- return await action();
22001
- } finally {
22002
- release();
22003
- }
22004
- }
22005
- async function oneAtATime(core, indexName, action) {
22006
- let chains = updatingByCore.get(core);
22007
- if (chains === void 0) {
22008
- chains = /* @__PURE__ */ new Map();
22009
- updatingByCore.set(core, chains);
22010
- }
22011
- const updating = chains;
22012
- const earlier = updating.get(indexName) ?? Promise.resolve();
22013
- const current = earlier.catch(() => void 0).then(action);
22014
- updating.set(indexName, current);
22015
- try {
22016
- return await current;
22017
- } finally {
22018
- if (updating.get(indexName) === current) updating.delete(indexName);
22019
- }
22020
- }
22021
-
22022
20212
  // src/engine/bm25-update.ts
22023
20213
  async function replaceNow(core, indexName, bm25) {
22024
20214
  const { config } = core.requireIndex(indexName);
@@ -22037,6 +20227,7 @@ async function replaceNow(core, indexName, bm25) {
22037
20227
  ...bm25 !== void 0 ? { bm25 } : {}
22038
20228
  });
22039
20229
  await core.orchestrator.awaitWrites(indexName);
20230
+ if (core.requireIndex(indexName).sync !== null) emitSyncChange(core.indexRegistry, { kind: "settings", indexName });
22040
20231
  }
22041
20232
  function updateIndexBm25(core, indexName, value) {
22042
20233
  return withOpenIndex(
@@ -22096,14 +20287,14 @@ function portabilityOperations(core, config, engine) {
22096
20287
  return {
22097
20288
  snapshot(indexName) {
22098
20289
  return withOpenIndex2(indexName, async () => {
22099
- const { createSnapshot } = await import('./snapshot-UGZVMP4H.mjs');
20290
+ const { createSnapshot } = await import('./snapshot-DN3CRVUQ.mjs');
22100
20291
  return createSnapshot(snapshotDepsOf(indexName));
22101
20292
  });
22102
20293
  },
22103
20294
  async restore(indexName, data) {
22104
20295
  core.guardShutdown();
22105
20296
  validateIndexName(indexName);
22106
- const restored = import('./restore-queue-UQ6AAUVX.mjs').then(
20297
+ const restored = import('./restore-queue-TYIGDL5L.mjs').then(
22107
20298
  ({ queueRestore }) => queueRestore(core, restoreHost, restoresInFlight, indexName, data)
22108
20299
  );
22109
20300
  await emitWriteEventAfter(core, indexName, restored);
@@ -22112,8 +20303,8 @@ function portabilityOperations(core, config, engine) {
22112
20303
  exportDocuments(indexName) {
22113
20304
  return withOpenIndex2(indexName, async () => {
22114
20305
  const [{ checkpointForArchive }, { documentExportStream }] = await Promise.all([
22115
- import('./snapshot-UGZVMP4H.mjs'),
22116
- import('./write-I5P5MW4O.mjs')
20306
+ import('./snapshot-DN3CRVUQ.mjs'),
20307
+ import('./write-WAWAFGKQ.mjs')
22117
20308
  ]);
22118
20309
  const header = indexConfigurationOf(core.requireIndex(indexName));
22119
20310
  return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
@@ -22121,7 +20312,7 @@ function portabilityOperations(core, config, engine) {
22121
20312
  },
22122
20313
  importDocumentExport(indexName, data) {
22123
20314
  core.guardShutdown();
22124
- const imported = import('./import-QOY6ZH6X.mjs').then(
20315
+ const imported = import('./import-YI5GNB4H.mjs').then(
22125
20316
  ({ readDocumentExport }) => readDocumentExport(engine(), indexName, data)
22126
20317
  );
22127
20318
  return emitWriteEventAfter(core, indexName, imported);
@@ -23428,7 +21619,7 @@ function requireCursorDepth(cursor, signature, binding) {
23428
21619
  }
23429
21620
  function hybridSearchOf(params, context, limit, offset, cursorDepth) {
23430
21621
  if ((params.hybrid?.depth ?? null) === null) return executeHybridSearch(params, context, limit, offset, cursorDepth);
23431
- return import('./runtime-D2ULZGCN.mjs').then(
21622
+ return import('./runtime-3EW2AGB6.mjs').then(
23432
21623
  (runtime) => runtime.searchFixedDepthHybrid(params, context, { cursorDepth: cursorDepth ?? 0, offset, limit }, runtimeHost)
23433
21624
  );
23434
21625
  }
@@ -23438,7 +21629,7 @@ function executeQuery(request, callerContext) {
23438
21629
  if (loadingPhraseCode === null) return runQuery(request, callerContext);
23439
21630
  return loadingPhraseCode.then(() => runQuery(request, callerContext));
23440
21631
  }
23441
- return import('./runtime-D2ULZGCN.mjs').then(
21632
+ return import('./runtime-3EW2AGB6.mjs').then(
23442
21633
  (runtime) => runtime.executeRerankedQuery(request, callerContext, executeQuery, runtimeHost)
23443
21634
  );
23444
21635
  }
@@ -23837,7 +22028,7 @@ async function runEngineQuery(core, indexName, params, options) {
23837
22028
  const manager = core.requireManager(indexName);
23838
22029
  const scoped = scopedParams(params, options);
23839
22030
  await core.pluginRegistry.runHook("beforeSearch", { indexName, params: scoped });
23840
- const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-D2ULZGCN.mjs');
22031
+ const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-3EW2AGB6.mjs');
23841
22032
  const resolvedParams = await resolveVectorText(
23842
22033
  rerank === void 0 ? scoped : rerank.withRerankQueryText(scoped),
23843
22034
  entry.embeddingAdapter,
@@ -23956,6 +22147,14 @@ async function runEngineListDocuments(core, indexName, params, partitionIds) {
23956
22147
  }
23957
22148
  }
23958
22149
 
22150
+ // src/narsil/sync.ts
22151
+ function syncOperations(core) {
22152
+ return {
22153
+ updateSync: async (indexName, setting) => (await import('./methods-LMUTS7OI.mjs')).updateSyncOf(core, indexName, setting),
22154
+ getSync: async (indexName) => (await import('./methods-LMUTS7OI.mjs')).syncOf(core, indexName)
22155
+ };
22156
+ }
22157
+
23959
22158
  // src/narsil/synonyms.ts
23960
22159
  function synonymOperations(core) {
23961
22160
  return {
@@ -24134,7 +22333,7 @@ function createNarsilFromCore(core, config) {
24134
22333
  const entry = requireIndex(indexName);
24135
22334
  await withOpenIndexWrite(indexName, async () => {
24136
22335
  if (entry.pendingAnalysis === null) return core.analysisRebuild.rebuild(indexName);
24137
- return (await import('./analysis-change-2V2HZ2NY.mjs')).resumeAnalysisChange(core, indexName);
22336
+ return (await import('./analysis-change-IXWPXXJJ.mjs')).resumeAnalysisChange(core, indexName);
24138
22337
  });
24139
22338
  },
24140
22339
  async changeAnalysis(indexName, change) {
@@ -24142,13 +22341,14 @@ function createNarsilFromCore(core, config) {
24142
22341
  requireIndex(indexName);
24143
22342
  const changed = withOpenIndex2(
24144
22343
  indexName,
24145
- async () => (await import('./analysis-change-2V2HZ2NY.mjs')).changeIndexAnalysis(core, indexName, change)
22344
+ async () => (await import('./analysis-change-IXWPXXJJ.mjs')).changeIndexAnalysis(core, indexName, change)
24146
22345
  );
24147
22346
  await emitWriteEventAfter(core, indexName, changed);
24148
22347
  },
24149
22348
  ...portabilityOperations(core, config, () => narsil),
24150
22349
  ...synonymOperations(core),
24151
22350
  ...bm25Operations(core),
22351
+ ...syncOperations(core),
24152
22352
  async checkpoint(indexName) {
24153
22353
  guardShutdown();
24154
22354
  requireIndex(indexName);
@@ -24159,13 +22359,7 @@ function createNarsilFromCore(core, config) {
24159
22359
  async clear(indexName) {
24160
22360
  guardShutdown();
24161
22361
  requireIndex(indexName);
24162
- await withOpenIndexWrite(indexName, async () => {
24163
- await executor.execute({ type: "clear", indexName, requestId: indexName });
24164
- await orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
24165
- core.watermarkNotifier.forget(indexName);
24166
- const durable = core.durability?.manager;
24167
- await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
24168
- });
22362
+ await withOpenIndexWrite(indexName, () => clearEngineIndex(core, indexName));
24169
22363
  },
24170
22364
  async rebalance(indexName, targetPartitionCount) {
24171
22365
  guardShutdown();
@@ -24179,12 +22373,15 @@ function createNarsilFromCore(core, config) {
24179
22373
  if (rebalancesStarting.get(indexName) === started) rebalancesStarting.delete(indexName);
24180
22374
  }
24181
22375
  rebalancesStarting.set(indexName, started);
24182
- const rebalanced = withOpenIndex2(indexName, async () => {
24183
- const { executeRebalance } = await import('./analysis-change-2V2HZ2NY.mjs');
24184
- const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
24185
- releaseWrites();
24186
- return running;
24187
- });
22376
+ const rebalanced = withOpenIndex2(
22377
+ indexName,
22378
+ () => withRenewedSyncEpoch(core, indexName, async () => {
22379
+ const { executeRebalance } = await import('./analysis-change-IXWPXXJJ.mjs');
22380
+ const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
22381
+ releaseWrites();
22382
+ await running;
22383
+ })
22384
+ );
24188
22385
  return emitWriteEventAfter(core, indexName, rebalanced).finally(releaseWrites);
24189
22386
  },
24190
22387
  async updatePartitionConfig(indexName, partitionConfig) {
@@ -24307,4 +22504,4 @@ async function createNarsil(config) {
24307
22504
  // src/index.ts
24308
22505
  var VERSION = "0.1.0";
24309
22506
 
24310
- export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, HEADER_SIZE, MAX_DOCUMENT_NESTING_DEPTH, REBALANCE_CHUNK_SIZE, VECTOR_PATTERN, VERSION, arrayPositionsAreStale, assemblePagedFrozenSegment, buildPartialWordTableFrom, buildSegmentPayload, checksumOfChunks, clearNormalizationCache, configureNormalizationCache, crc32, crc32Final, crc32Init, crc32Update, createCompositePartition, createEncodedDocumentSource, createFrozenSegment, createNarsil, createPartitionIndex, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, decodeEveryStoredDocument, decodeIndexConfiguration, decodeMapWithoutFields, decodeStoredDocument, decodeSurfaceTable, deleteNestedValue, emitEngineEvent, encodeDocument, encodeIndexConfiguration, encodeSurfaceTable, endOfValue, engineVersionParts, extractVectorFieldsFromSchema, extractVectorFromDoc, fieldIndexRemapOf, flattenSchema, freezeSegmentShared, generateId, getLanguage, getNestedValue, getNormalizationCacheSize, getStopWords, getTokenizer, hasNrslMagic, hasStopWords, hasTokenizer, holdsADiscardedField, insertDocumentVectors, isCompositePartition, isQuantizationMode, isStorageMode, loadVectorCodeFor, mergeDocFrequencies, mergeFieldIndexes2 as mergeFieldIndexes, mergeFieldLengths, mergePartialWords, mergeSegmentContents, mergeSurfaceForms2 as mergeSurfaceForms, messagePackUpperBoundBytes, openChecksummedEnvelope, packChecksummedEnvelope, packEnvelopeWithChecksum, parseVectorDimension, partialFieldsOf, partitionStateOf, prepareConfiguredSynonyms, prepareDocumentVectors, prepareStoredSynonyms, raiseEarlierReleaseGraphSetting, readHeader, readHeapStatistics, readResidentMemory, rebuildTextIndexes, reconstructSchemaFromMetadata, registerLanguage, registerPartialWordSearch, registerPatternSearch, registerStopWords, registerSynonyms, registerTokenizer, removeDocumentVectors, requireConfigurationShape, requireConfigurationWithinSizeLimit, requireSurfaceFormsForPartialFields, requireValidFieldTypes, requireWithinFileLimit, resetNormalizationCache, resolveIndexAnalysis, resolvePartialWordAnalysis, resolvePartitionInsertOptions, rewriteSpillOf, rulesOfStoredSynonyms, scanPostingBlocks, segmentArraysOf, selectionKeeps, shareSegmentArrays, storedArrayPositionGap, survivorDocumentsOf, textRebuildTargetOf, toError2 as toError, validateEmbeddingConfig, validatePatternValueLimit, validateRequiredFieldsInSchema, validateSchema, validateTextStorage, validateVectorPromotion, validateVectorStorage, vectorsEqual, wrapFrozenTokenTable, writeHeader, yieldToEventLoop2 as yieldToEventLoop };
22507
+ export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, VERSION, arrayPositionsAreStale, assemblePagedFrozenSegment, buildPartialWordTableFrom, buildSegmentPayload, clearNormalizationCache, configureNormalizationCache, createCompositePartition, createEncodedDocumentSource, createFrozenSegment, createNarsil, createPartitionIndex, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, decodeSurfaceTable, deleteNestedValue, emitEngineEvent, encodeIndexConfiguration, encodeSurfaceTable, endOfValue, engineVersionParts, extractVectorFromDoc, fieldIndexRemapOf, freezeSegmentShared, generateId, getNestedValue, getNormalizationCacheSize, holdSyncEpochChange, holdsADiscardedField, insertDocumentVectors, isCompositePartition, isQuantizationMode, isStorageMode, loadVectorCodeFor, mergeDocFrequencies, mergeFieldIndexes2 as mergeFieldIndexes, mergeFieldLengths, mergePartialWords, mergeSegmentContents, mergeSurfaceForms2 as mergeSurfaceForms, messagePackUpperBoundBytes, packChecksummedEnvelope, packEnvelopeWithChecksum, parseVectorDimension, partitionStateOf, prepareConfiguredSynonyms, prepareDocumentVectors, prepareStoredSynonyms, raiseEarlierReleaseGraphSetting, readResidentMemory, rebuildTextIndexes, reconstructSchemaFromMetadata, registerPartialWordSearch, registerPatternSearch, registerSynonyms, removeDocumentVectors, requireConfigurationWithinSizeLimit, requireSurfaceFormsForPartialFields, resetNormalizationCache, resolvePartialWordAnalysis, resolvePartitionInsertOptions, rewriteSpillOf, rulesOfStoredSynonyms, scanPostingBlocks, segmentArraysOf, selectionKeeps, shareSegmentArrays, storedArrayPositionGap, survivorDocumentsOf, textRebuildTargetOf, toError2 as toError, validateEmbeddingConfig, validatePatternValueLimit, validateRequiredFieldsInSchema, validateTextStorage, validateVectorPromotion, validateVectorStorage, vectorsEqual, wrapFrozenTokenTable, yieldToEventLoop2 as yieldToEventLoop };