@delali/narsil 0.3.1-next.153 → 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.
- package/README.md +2 -1
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/{analysis-change-2OYM7ARW.mjs → analysis-change-4GCRVRBW.mjs} +27 -18
- package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KYGSXW4K.mjs} +1 -1
- package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-IXWPXXJJ.mjs} +17 -7
- package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-FCSHFQSS.mjs} +1 -1
- package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-2FX6ROWR.mjs} +15 -6
- package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-2SHAKW2Z.mjs} +119 -1922
- package/dist/browser/{chunk-55WYRLDZ.mjs → chunk-3U3QR5YP.mjs} +2 -2
- package/dist/browser/chunk-4PD752F6.mjs +85 -0
- package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
- package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-7MEYN7V6.mjs} +1 -151
- package/dist/browser/chunk-7TTWXUH6.mjs +1828 -0
- package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-AJ4HHOVT.mjs} +4 -4
- package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-AYY6PIKL.mjs} +2 -2
- package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-C4KS2QNF.mjs} +9 -8
- package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
- package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
- package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-EUNBNLKM.mjs} +6 -5
- package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-G7LUMBSG.mjs} +137 -253
- package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-H6QFBMVE.mjs} +3 -2
- package/dist/browser/chunk-J433A7P3.mjs +241 -0
- package/dist/browser/chunk-ML6HY7T7.mjs +96 -0
- package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
- package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-MYITLCHT.mjs} +7 -1
- package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-QXTPSX2H.mjs} +9 -150
- package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
- package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SIR3LMTV.mjs} +2 -2
- package/dist/browser/{chunk-LURXVCHG.mjs → chunk-SJB6VIZG.mjs} +1 -1
- package/dist/browser/chunk-TTD27VXX.mjs +298 -0
- package/dist/browser/chunk-U2E3HMYW.mjs +151 -0
- package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-VCOYGVP7.mjs} +5 -31
- package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
- package/dist/browser/chunk-W5X2UFWQ.mjs +102 -0
- package/dist/browser/{chunk-HT7J73QL.mjs → chunk-XRV72TJD.mjs} +2 -2
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
- package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-ZPTA75ZC.mjs} +2 -79
- package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-VTUGDYNY.mjs} +20 -14
- package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-GL4A7KDV.mjs} +1886 -1364
- package/dist/browser/import-YI5GNB4H.mjs +17 -0
- package/dist/browser/methods-LMUTS7OI.mjs +30 -0
- package/dist/browser/{module-XQLEOYNM.mjs → module-EC3FYW7N.mjs} +9 -8
- package/dist/browser/{module-KAMRAJLE.mjs → module-M4JNBV6V.mjs} +16 -10
- package/dist/browser/operations-WVYLF72Q.mjs +5 -0
- package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-NPYUVX75.mjs} +1 -1
- package/dist/browser/{pool-DTYSPBMQ.mjs → pool-WCGDZHJP.mjs} +3 -2
- package/dist/{restore-queue-AOF5OTQV.mjs → browser/restore-queue-TYIGDL5L.mjs} +2 -2
- package/dist/browser/retention-6QMRS5VK.mjs +207 -0
- package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-3EW2AGB6.mjs} +1 -1
- package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-DN3CRVUQ.mjs} +38 -307
- package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
- package/dist/browser/{write-I5P5MW4O.mjs → write-WAWAFGKQ.mjs} +16 -11
- package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-B3Brs1Rc.d.ts} +62 -7
- package/dist/{chunk-DGRM4EZZ.mjs → chunk-37IVJLP6.mjs} +1 -1
- package/dist/{chunk-KYVRZAYP.mjs → chunk-3A5KI24C.mjs} +2 -69
- package/dist/{chunk-POUYICOU.mjs → chunk-3OFU3NJT.mjs} +1 -1
- package/dist/{chunk-3TVDTACC.mjs → chunk-3Y3J4V2R.mjs} +1 -1
- package/dist/{chunk-FNBNZCGP.mjs → chunk-466PYR4P.mjs} +2 -2
- package/dist/{chunk-SEAJS664.mjs → chunk-4HWZV5MK.mjs} +5 -5
- package/dist/{chunk-UGVUW27S.mjs → chunk-5FUOVJKG.mjs} +13 -9
- package/dist/{chunk-ZHAXP7SD.mjs → chunk-5KGYQT6W.mjs} +6 -235
- package/dist/{chunk-NPXVQS33.mjs → chunk-62G63NMH.mjs} +4 -3
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-7GXJUJ24.mjs +49 -0
- package/dist/{chunk-3E4RRF5J.mjs → chunk-7HCZWC7B.mjs} +58 -8
- package/dist/{chunk-6RKSY3BX.mjs → chunk-7NTMUDC5.mjs} +5 -5
- package/dist/chunk-7QUGDVFC.mjs +101 -0
- package/dist/{chunk-G5KHSM6E.mjs → chunk-AO2FAYIZ.mjs} +1 -1
- package/dist/chunk-B7S6YEBP.mjs +102 -0
- package/dist/{chunk-AWNHDBKV.mjs → chunk-BPSKLCS7.mjs} +15 -7
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/{chunk-T4CJDBBE.mjs → chunk-C6ASEFZI.mjs} +1 -1
- package/dist/{chunk-NITCPDFL.mjs → chunk-C73JLU4E.mjs} +2 -2
- package/dist/{chunk-NYSONUB7.mjs → chunk-CP5RRPJR.mjs} +1 -1
- package/dist/{chunk-TTCKT2RT.mjs → chunk-DMQPFLGI.mjs} +134 -11
- package/dist/{chunk-3SBJVQLL.mjs → chunk-DVWYODEB.mjs} +2 -2
- package/dist/chunk-ECX4SGX6.mjs +167 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/{chunk-NVTFQFUL.mjs → chunk-HVKXNBFL.mjs} +1 -1
- package/dist/chunk-HVYICDY3.mjs +214 -0
- package/dist/{chunk-3HV7M5OJ.mjs → chunk-HWEDFLB7.mjs} +9 -133
- package/dist/{chunk-52QQWEBS.mjs → chunk-IBNLW3AV.mjs} +21 -6
- package/dist/chunk-IJU7LL7D.mjs +242 -0
- package/dist/chunk-IPN7S4KX.mjs +130 -0
- package/dist/{chunk-5QMHMELB.mjs → chunk-IQ4R2I6N.mjs} +4 -1
- package/dist/chunk-JCLTESFN.mjs +96 -0
- package/dist/{chunk-J4BDAH2W.mjs → chunk-JFNKIBDT.mjs} +2 -2
- package/dist/{chunk-LDGGR7YT.mjs → chunk-K4B7OH65.mjs} +2 -2
- package/dist/{chunk-7TE2AJIH.mjs → chunk-K7KLL263.mjs} +13 -10
- package/dist/{chunk-CSHHU7PA.mjs → chunk-KCUIFVVW.mjs} +11 -30
- package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-KUZKUONM.mjs} +11 -2
- package/dist/chunk-KYYABCSW.mjs +72 -0
- package/dist/{chunk-B2FTZNNF.mjs → chunk-LKUE5GXS.mjs} +34 -14
- package/dist/{chunk-2PNYKG2D.mjs → chunk-LSM2YTKM.mjs} +100 -335
- package/dist/{chunk-DMNPYF54.mjs → chunk-LTUGDMV4.mjs} +2 -2
- package/dist/{chunk-FDG4KXX5.mjs → chunk-MLHNSAPK.mjs} +5 -3
- package/dist/{chunk-VP6XRMWR.mjs → chunk-MMBEANB2.mjs} +6 -32
- package/dist/{chunk-LJ4ENXOD.mjs → chunk-MMEMEUOO.mjs} +2 -2
- package/dist/{chunk-2HJWQPR6.mjs → chunk-NTZOXVUZ.mjs} +6 -122
- package/dist/{chunk-5WB2A3XU.mjs → chunk-NZMAXR2S.mjs} +397 -24
- package/dist/{chunk-IZT3G24Q.mjs → chunk-O43Z4MS6.mjs} +2 -2
- package/dist/{chunk-U46IZNCW.mjs → chunk-OKX2BBNW.mjs} +3 -2
- package/dist/{chunk-RBEHLIKX.mjs → chunk-PFKM7VNZ.mjs} +14 -8
- package/dist/chunk-PGVPE7GJ.mjs +96 -0
- package/dist/chunk-Q3TCTQCC.mjs +85 -0
- package/dist/chunk-Q7MS6P2J.mjs +74 -0
- package/dist/chunk-QDZJM7NI.mjs +23 -0
- package/dist/{chunk-ZS6CMXAE.mjs → chunk-QKZHLADX.mjs} +89 -250
- package/dist/{chunk-IJSFWGVW.mjs → chunk-REL7LFLR.mjs} +3 -3
- package/dist/chunk-RVKFI3A2.mjs +237 -0
- package/dist/chunk-S2N75OTN.mjs +83 -0
- package/dist/chunk-TRISKD4Q.mjs +50 -0
- package/dist/{chunk-6F6USYII.mjs → chunk-TV2L3BN7.mjs} +13 -11
- package/dist/{chunk-6BWLDLS3.mjs → chunk-URPCYQVJ.mjs} +1 -1
- package/dist/chunk-USR7FQRZ.mjs +34 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/{chunk-SOUZMPME.mjs → chunk-VMXSVVXG.mjs} +7 -194
- package/dist/{chunk-4QCSHLNM.mjs → chunk-VREK3MYG.mjs} +3 -3
- package/dist/{chunk-YGQOPB2Z.mjs → chunk-WCBA2LVZ.mjs} +1 -1
- package/dist/{chunk-KQJVNPRM.mjs → chunk-X6NSJYQ3.mjs} +19 -16
- package/dist/chunk-Y4WPNHMC.mjs +50 -0
- package/dist/{chunk-IRWP524D.mjs → chunk-YBJDOA2T.mjs} +1 -1
- package/dist/{chunk-IJPK5PGM.mjs → chunk-YPUEV6ZC.mjs} +1 -1
- package/dist/{chunk-J7M73VY7.mjs → chunk-YROWNOMH.mjs} +1 -1
- package/dist/chunk-Z3TNWCI5.mjs +196 -0
- package/dist/{chunk-65WCV5JO.mjs → chunk-ZIFJXCKA.mjs} +1 -1
- package/dist/chunk-ZYAY26KG.mjs +29 -0
- package/dist/{client-Cn3gNxUU.d.ts → client-Df76GNKm.d.ts} +76 -6
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +56 -5
- package/dist/{cold-module-PYSSBIL7.mjs → cold-module-YLWMTTZG.mjs} +38 -28
- package/dist/{config-CfhH1IWQ.d.ts → config-05G_hy-1.d.ts} +3 -3
- package/dist/config-B8DP2VwR.d.ts +463 -0
- package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-FI5GJHWX.mjs} +14 -9
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +3 -3
- package/dist/distribution.d.ts +41 -9
- package/dist/distribution.mjs +1296 -117
- package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-RHLXDIVF.mjs} +1751 -1226
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CJRUHXgf.d.ts → engine-DYu-e0oR.d.ts} +50 -40
- package/dist/{import-GJOMB2HC.mjs → import-SRBNC6TE.mjs} +27 -19
- package/dist/{index-MsF7e5hL.d.ts → index-nRqDM6uS.d.ts} +1 -1
- package/dist/index.browser.mjs +8 -4
- package/dist/index.d.ts +7 -6
- package/dist/index.mjs +24 -16
- package/dist/index.react-native.mjs +17 -11
- package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-EMYTGSJP.mjs} +28 -15
- package/dist/methods-ABM5ELBR.mjs +30 -0
- package/dist/{module-AVQEIB7O.mjs → module-3OMJZUFT.mjs} +12 -12
- package/dist/{module-6RLIKSZQ.mjs → module-MG7JMV2U.mjs} +33 -23
- package/dist/operations-PGOAY2KS.mjs +5 -0
- package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-UOLHOEZJ.mjs} +37 -26
- package/dist/partial-words.mjs +6 -4
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +9 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +34 -23
- package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-O3MDRQXP.mjs} +1 -1
- package/dist/{pool-UPV5PVPY.mjs → pool-CQXYPFLG.mjs} +2 -2
- package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-EAYO3Y6Q.mjs} +27 -15
- package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-2CGSQM4O.mjs} +12 -10
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
- package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-3O57C2ZO.mjs} +2 -2
- package/dist/react-native/chunks/chunk-3XKMRNRE.mjs +298 -0
- package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-63YSZOXB.mjs} +97 -333
- package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-75VWIY35.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7GWPJDOA.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-AUT7PMA4.mjs} +6 -190
- package/dist/react-native/chunks/chunk-C2H2QQFW.mjs +288 -0
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
- package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-CUNGPR5R.mjs} +11 -2
- package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-DCKMICOB.mjs} +2 -79
- package/dist/react-native/chunks/chunk-DH3TVWWK.mjs +102 -0
- package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-EH5CFV6Z.mjs} +2 -2
- package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
- package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-GFYFQLJD.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-I5PGWQJF.mjs} +142 -257
- package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-IOY2SM2P.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
- package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-JPAJWO6D.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
- package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-JX2RIAXH.mjs} +4 -4
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
- package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-NCJS3WIY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-NKIZX26F.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-NP7DD4G5.mjs} +5 -4
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
- package/dist/react-native/chunks/chunk-O32RB3BL.mjs +191 -0
- package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-OQQVRWZ2.mjs} +2 -69
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-RVAEBN74.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-RYMDHGL4.mjs} +16 -8
- package/dist/react-native/chunks/chunk-SJWDBRNP.mjs +85 -0
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
- package/dist/react-native/chunks/chunk-UWDNZDWK.mjs +242 -0
- package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-VQSKZ3EZ.mjs} +9 -152
- package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-VVFYOADG.mjs} +7 -6
- package/dist/react-native/chunks/{chunk-VGUWIZFQ.mjs → chunk-YBEW6YTR.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-YHKZSLOC.mjs} +7 -33
- package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-ZBSWRSBG.mjs} +4 -30
- package/dist/react-native/chunks/chunk-ZYDKJXQJ.mjs +96 -0
- package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-TJL6AFAD.mjs} +29 -21
- package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-RRDYJLLM.mjs} +1882 -1358
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +3 -0
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +29 -0
- package/dist/react-native/chunks/methods-X6F36SJE.mjs +30 -0
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +33 -0
- package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-S4DKSWMF.mjs} +10 -9
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-JZ37TB7N.mjs} +1 -1
- package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-RTGXJXPU.mjs} +3 -2
- package/dist/{browser/restore-queue-UQ6AAUVX.mjs → react-native/chunks/restore-queue-ZBVIKJWI.mjs} +2 -2
- package/dist/react-native/chunks/retention-PPCTP2VY.mjs +219 -0
- package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-KUATOLYB.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-ZBIEOZTZ.mjs} +47 -314
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
- package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-2W4FTX7J.mjs} +25 -18
- package/dist/react-native/partial-words.mjs +6 -4
- package/dist/react-native/pattern.mjs +4 -3
- package/dist/react-native/sync.mjs +2236 -0
- package/dist/react-native/synonyms.mjs +7 -4
- package/dist/react.d.ts +10 -9
- package/dist/react.mjs +7 -1
- package/dist/{rerank-3W54N6P2.mjs → rerank-IZOB6NII.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{react-native/chunks/restore-queue-H5VCN453.mjs → restore-queue-COI2GSSK.mjs} +2 -2
- package/dist/retention-55WA7GPU.mjs +58 -0
- package/dist/{runtime-L2DZYY6N.mjs → runtime-UZOC3NPY.mjs} +5 -5
- package/dist/{schema-D33CyXCy.d.ts → schema-DDauvDOv.d.ts} +1 -1
- package/dist/server.d.ts +22 -19
- package/dist/server.mjs +868 -50
- package/dist/{snapshot-WMX6JCLP.mjs → snapshot-NFX2EYN2.mjs} +62 -36
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +271 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +237 -0
- package/dist/sync-state-ZWHLAFLE.mjs +15 -0
- package/dist/{config-aIsy7mcL.d.ts → sync-uXR7MmM7.d.ts} +53 -444
- package/dist/sync.browser.mjs +2231 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2206 -0
- package/dist/synonyms.mjs +5 -3
- package/dist/{tasks-C4ElXr4P.d.ts → tasks-BShx8pdK.d.ts} +4 -4
- package/dist/thread-P2G2FWM2.mjs +44 -0
- package/dist/types-SnO7_tAI.d.ts +228 -0
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-SKJ6HW7O.mjs → write-FGB62BHQ.mjs} +31 -23
- package/openapi.json +119 -3
- package/package.json +28 -8
- package/dist/browser/import-QOY6ZH6X.mjs +0 -12
- package/dist/chunk-7LDMWKP6.mjs +0 -209
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
- package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
- package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
- package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
- package/dist/thread-I7DVHHW7.mjs +0 -31
|
@@ -0,0 +1,1828 @@
|
|
|
1
|
+
import { MAX_DOCUMENT_ENCODING_DEPTH, compareCodePoints, MAX_FILE_BYTES, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-7MEYN7V6.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-MYITLCHT.mjs';
|
|
3
|
+
import { Encoder, decode } from '@msgpack/msgpack';
|
|
4
|
+
|
|
5
|
+
// src/analysis/registry.ts
|
|
6
|
+
var tokenizers = /* @__PURE__ */ new Map();
|
|
7
|
+
var stopWordSets = /* @__PURE__ */ new Map();
|
|
8
|
+
function requireName(name, kind) {
|
|
9
|
+
if (typeof name !== "string" || name.trim().length === 0) {
|
|
10
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `A registered ${kind} needs a non-empty name`, { name });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function registerTokenizer(name, tokenizer) {
|
|
14
|
+
requireName(name, "tokenizer");
|
|
15
|
+
if (typeof tokenizer?.tokenize !== "function") {
|
|
16
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" needs a tokenize method`, { tokenizer: name });
|
|
17
|
+
}
|
|
18
|
+
tokenizers.set(name, tokenizer);
|
|
19
|
+
}
|
|
20
|
+
function registerStopWords(name, stopWords2) {
|
|
21
|
+
requireName(name, "stop word set");
|
|
22
|
+
if (!(stopWords2 instanceof Set) && typeof stopWords2 !== "function") {
|
|
23
|
+
throw new NarsilError(
|
|
24
|
+
ErrorCodes.CONFIG_INVALID,
|
|
25
|
+
`Stop word set "${name}" needs a Set of words or a function returning one`,
|
|
26
|
+
{ stopWords: name }
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
stopWordSets.set(name, stopWords2);
|
|
30
|
+
}
|
|
31
|
+
function hasTokenizer(name) {
|
|
32
|
+
return tokenizers.has(name);
|
|
33
|
+
}
|
|
34
|
+
function hasStopWords(name) {
|
|
35
|
+
return stopWordSets.has(name);
|
|
36
|
+
}
|
|
37
|
+
function getTokenizer(name) {
|
|
38
|
+
const tokenizer = tokenizers.get(name);
|
|
39
|
+
if (!tokenizer) {
|
|
40
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" is not registered on this engine`, {
|
|
41
|
+
tokenizer: name,
|
|
42
|
+
available: [...tokenizers.keys()]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return tokenizer;
|
|
46
|
+
}
|
|
47
|
+
function getStopWords(name) {
|
|
48
|
+
const stopWords2 = stopWordSets.get(name);
|
|
49
|
+
if (!stopWords2) {
|
|
50
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Stop word set "${name}" is not registered on this engine`, {
|
|
51
|
+
stopWords: name,
|
|
52
|
+
available: [...stopWordSets.keys()]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return stopWords2;
|
|
56
|
+
}
|
|
57
|
+
function holdsPositionsOutOfOrder(entries) {
|
|
58
|
+
for (let index = 1; index < entries.length; index++) {
|
|
59
|
+
if (entries[index].position < entries[index - 1].position) return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
function inPositionOrder(tokenizer) {
|
|
64
|
+
return {
|
|
65
|
+
tokenize(text) {
|
|
66
|
+
const entries = tokenizer.tokenize(text);
|
|
67
|
+
if (!holdsPositionsOutOfOrder(entries)) return entries;
|
|
68
|
+
return [...entries].sort((first, second) => first.position - second.position);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function resolveIndexAnalysis(config) {
|
|
73
|
+
const tokenizer = typeof config.tokenizer === "string" ? getTokenizer(config.tokenizer) : config.tokenizer;
|
|
74
|
+
return {
|
|
75
|
+
stopWords: typeof config.stopWords === "string" ? getStopWords(config.stopWords) : config.stopWords,
|
|
76
|
+
customTokenizer: tokenizer === void 0 ? void 0 : inPositionOrder(tokenizer)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/schema/constants.ts
|
|
81
|
+
var MAX_NESTING_DEPTH = 4;
|
|
82
|
+
var MAX_DOCUMENT_NESTING_DEPTH = 32;
|
|
83
|
+
var DEFAULT_PATTERN_VALUE_LIMIT = 8192;
|
|
84
|
+
var MIN_PATTERN_VALUE_LIMIT = 1;
|
|
85
|
+
var MAX_PATTERN_VALUE_LIMIT = 65536;
|
|
86
|
+
var MAX_VECTOR_DIMENSION = 4096;
|
|
87
|
+
var MAX_STORED_VECTOR_DIMENSION = 65535;
|
|
88
|
+
var MAX_TEXT_FIELDS = 65536;
|
|
89
|
+
var MAX_DOCUMENT_BYTES = 16777216;
|
|
90
|
+
var PARSED_FIELD_TYPE_CACHE_ENTRIES = 1024;
|
|
91
|
+
|
|
92
|
+
// src/schema/validator/shared.ts
|
|
93
|
+
var VECTOR_PATTERN = /^vector\[(\d+)]$/;
|
|
94
|
+
function isGeopointOrVectorType(fieldType) {
|
|
95
|
+
return fieldType === "geopoint" || fieldType !== void 0 && VECTOR_PATTERN.test(fieldType);
|
|
96
|
+
}
|
|
97
|
+
var FIELD_NAME_PATTERN = /^[A-Za-z0-9_]+$/;
|
|
98
|
+
var RESERVED_ROOT_FIELDS = /* @__PURE__ */ new Set(["id"]);
|
|
99
|
+
var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
100
|
+
function isPlainObject(value) {
|
|
101
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/schema/validator/field-type.ts
|
|
105
|
+
var FIELD_OPTION_ORDER = ["sortable", "pattern", "partial"];
|
|
106
|
+
var OPTIONS_BY_BASE = {
|
|
107
|
+
string: FIELD_OPTION_ORDER,
|
|
108
|
+
"string[]": FIELD_OPTION_ORDER,
|
|
109
|
+
verbatim: ["sortable"],
|
|
110
|
+
"verbatim[]": ["sortable"],
|
|
111
|
+
number: [],
|
|
112
|
+
"number[]": [],
|
|
113
|
+
boolean: [],
|
|
114
|
+
"boolean[]": [],
|
|
115
|
+
enum: [],
|
|
116
|
+
"enum[]": [],
|
|
117
|
+
geopoint: [],
|
|
118
|
+
vector: []
|
|
119
|
+
};
|
|
120
|
+
var TYPE_SEPARATOR = ":";
|
|
121
|
+
function isNamedBase(name) {
|
|
122
|
+
return name !== "vector" && Object.hasOwn(OPTIONS_BY_BASE, name);
|
|
123
|
+
}
|
|
124
|
+
function describeAllowedOptions(baseName, allowed) {
|
|
125
|
+
if (allowed.length === 0) return `the "${baseName}" type has no options`;
|
|
126
|
+
const quoted = allowed.map((option) => `"${option}"`);
|
|
127
|
+
if (quoted.length === 1) return `the only option of the "${baseName}" type is ${quoted[0]}`;
|
|
128
|
+
return `the options of the "${baseName}" type are ${quoted.slice(0, -1).join(", ")}, and ${quoted[quoted.length - 1]}`;
|
|
129
|
+
}
|
|
130
|
+
function invalidType(path, type, message) {
|
|
131
|
+
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, message, { field: path, type });
|
|
132
|
+
}
|
|
133
|
+
function parseBase(baseName, path, type) {
|
|
134
|
+
if (isNamedBase(baseName)) return { base: baseName, dimension: 0 };
|
|
135
|
+
const vectorMatch = VECTOR_PATTERN.exec(baseName);
|
|
136
|
+
if (vectorMatch === null) {
|
|
137
|
+
invalidType(path, type, `Field "${path}" has an unsupported type: "${type}"`);
|
|
138
|
+
}
|
|
139
|
+
const dimension = Number.parseInt(vectorMatch[1], 10);
|
|
140
|
+
if (dimension <= 0 || dimension > MAX_STORED_VECTOR_DIMENSION) {
|
|
141
|
+
throw new NarsilError(
|
|
142
|
+
ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
|
|
143
|
+
`Vector field "${path}" has ${dimension} dimensions, but a vector field holds from 1 to ${MAX_STORED_VECTOR_DIMENSION}`,
|
|
144
|
+
{ field: path, dimension, maximum: MAX_STORED_VECTOR_DIMENSION }
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return { base: "vector", dimension };
|
|
148
|
+
}
|
|
149
|
+
function parseFieldType(type, path) {
|
|
150
|
+
const separatorIndex = type.indexOf(TYPE_SEPARATOR);
|
|
151
|
+
const baseName = separatorIndex === -1 ? type : type.slice(0, separatorIndex);
|
|
152
|
+
const { base, dimension } = parseBase(baseName, path, type);
|
|
153
|
+
const allowed = OPTIONS_BY_BASE[base];
|
|
154
|
+
const options = /* @__PURE__ */ new Set();
|
|
155
|
+
if (separatorIndex !== -1) {
|
|
156
|
+
for (const option of type.slice(separatorIndex + 1).split(TYPE_SEPARATOR)) {
|
|
157
|
+
if (!allowed.includes(option)) {
|
|
158
|
+
invalidType(
|
|
159
|
+
path,
|
|
160
|
+
type,
|
|
161
|
+
`Field "${path}" has type "${type}" with the option "${option}", but ${describeAllowedOptions(baseName, allowed)}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (options.has(option)) {
|
|
165
|
+
invalidType(path, type, `Field "${path}" has the "${option}" option twice in type "${type}"`);
|
|
166
|
+
}
|
|
167
|
+
options.add(option);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const ordered = FIELD_OPTION_ORDER.filter((option) => options.has(option));
|
|
171
|
+
const verbatim = base === "verbatim" || base === "verbatim[]";
|
|
172
|
+
return {
|
|
173
|
+
type: [baseName, ...ordered].join(TYPE_SEPARATOR),
|
|
174
|
+
base,
|
|
175
|
+
sortable: options.has("sortable"),
|
|
176
|
+
pattern: verbatim || options.has("pattern"),
|
|
177
|
+
partial: options.has("partial"),
|
|
178
|
+
dimension
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
var parsedTypesByName = /* @__PURE__ */ new Map();
|
|
182
|
+
function parsedTypeOf(type) {
|
|
183
|
+
if (type === void 0) return void 0;
|
|
184
|
+
const known = parsedTypesByName.get(type);
|
|
185
|
+
if (known !== void 0) return known;
|
|
186
|
+
try {
|
|
187
|
+
const parsed = Object.freeze(parseFieldType(type, ""));
|
|
188
|
+
if (parsedTypesByName.size < PARSED_FIELD_TYPE_CACHE_ENTRIES) parsedTypesByName.set(type, parsed);
|
|
189
|
+
return parsed;
|
|
190
|
+
} catch {
|
|
191
|
+
return void 0;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function withSortableOption(parsed) {
|
|
195
|
+
if (parsed.sortable) return parsed.type;
|
|
196
|
+
const separatorIndex = parsed.type.indexOf(TYPE_SEPARATOR);
|
|
197
|
+
const baseName = separatorIndex === -1 ? parsed.type : parsed.type.slice(0, separatorIndex);
|
|
198
|
+
return parseFieldType(`${baseName}${TYPE_SEPARATOR}sortable${parsed.type.slice(baseName.length)}`, "").type;
|
|
199
|
+
}
|
|
200
|
+
function isListBase(base) {
|
|
201
|
+
return base.endsWith("[]");
|
|
202
|
+
}
|
|
203
|
+
function isWordIndexedBase(base) {
|
|
204
|
+
return base === "string" || base === "string[]";
|
|
205
|
+
}
|
|
206
|
+
function isSingleStringFieldType(fieldType) {
|
|
207
|
+
return parsedTypeOf(fieldType)?.base === "string";
|
|
208
|
+
}
|
|
209
|
+
function isWordIndexedFieldType(fieldType) {
|
|
210
|
+
const parsed = parsedTypeOf(fieldType);
|
|
211
|
+
return parsed !== void 0 && isWordIndexedBase(parsed.base);
|
|
212
|
+
}
|
|
213
|
+
function isStringValuedBase(base) {
|
|
214
|
+
return base === "string" || base === "string[]" || base === "verbatim" || base === "verbatim[]";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/schema/validator/schema.ts
|
|
218
|
+
function validateSchemaFields(schema, depth, prefix) {
|
|
219
|
+
if (depth > MAX_NESTING_DEPTH) {
|
|
220
|
+
throw new NarsilError(
|
|
221
|
+
ErrorCodes.SCHEMA_DEPTH_EXCEEDED,
|
|
222
|
+
`Schema nesting exceeds the maximum depth of ${MAX_NESTING_DEPTH} at "${prefix}"`,
|
|
223
|
+
{ path: prefix, maxDepth: MAX_NESTING_DEPTH }
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
let canonical = null;
|
|
227
|
+
const replace = (field, value) => {
|
|
228
|
+
if (canonical === null) canonical = { ...schema };
|
|
229
|
+
canonical[field] = value;
|
|
230
|
+
};
|
|
231
|
+
for (const [field, type] of Object.entries(schema)) {
|
|
232
|
+
const path = prefix ? `${prefix}.${field}` : field;
|
|
233
|
+
if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
|
|
234
|
+
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, `Field name "${field}" is not allowed in a schema`, {
|
|
235
|
+
field,
|
|
236
|
+
path
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
if (!FIELD_NAME_PATTERN.test(field)) {
|
|
240
|
+
throw new NarsilError(
|
|
241
|
+
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
242
|
+
`Field name "${field}" contains characters that are not allowed; use letters, digits, and underscores only`,
|
|
243
|
+
{ field, path }
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
if (depth === 1 && RESERVED_ROOT_FIELDS.has(field)) {
|
|
247
|
+
throw new NarsilError(
|
|
248
|
+
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
249
|
+
`Field "${field}" is reserved and cannot be defined in a schema`,
|
|
250
|
+
{ field, path }
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
if (isPlainObject(type)) {
|
|
254
|
+
const nested = validateSchemaFields(type, depth + 1, path);
|
|
255
|
+
if (nested !== type) replace(field, nested);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (typeof type !== "string") {
|
|
259
|
+
throw new NarsilError(
|
|
260
|
+
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
261
|
+
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
262
|
+
{
|
|
263
|
+
field: path,
|
|
264
|
+
type: String(type)
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
const parsed = parseFieldType(type, path);
|
|
269
|
+
if (parsed.type !== type) replace(field, parsed.type);
|
|
270
|
+
}
|
|
271
|
+
return canonical ?? schema;
|
|
272
|
+
}
|
|
273
|
+
function validateSchema(schema) {
|
|
274
|
+
if (!isPlainObject(schema)) {
|
|
275
|
+
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must be a plain object", {
|
|
276
|
+
received: typeof schema
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (Object.keys(schema).length === 0) {
|
|
280
|
+
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must define at least one field");
|
|
281
|
+
}
|
|
282
|
+
const validated = validateSchemaFields(schema, 1, "");
|
|
283
|
+
requireTextFieldCount(schemaFieldsOf(validated).filter((field) => isWordIndexedBase(field.base)).length);
|
|
284
|
+
return validated;
|
|
285
|
+
}
|
|
286
|
+
function requireTextFieldCount(count) {
|
|
287
|
+
if (count <= MAX_TEXT_FIELDS) return;
|
|
288
|
+
throw new NarsilError(
|
|
289
|
+
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
290
|
+
`The schema declares ${count} string and string[] fields, but a schema holds at most ${MAX_TEXT_FIELDS}`,
|
|
291
|
+
{ textFields: count, maximum: MAX_TEXT_FIELDS }
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
function requireCreatableSchema(schema) {
|
|
295
|
+
for (const field of schemaFieldsOf(schema)) {
|
|
296
|
+
if (field.base !== "vector" || field.dimension <= MAX_VECTOR_DIMENSION) continue;
|
|
297
|
+
throw new NarsilError(
|
|
298
|
+
ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
|
|
299
|
+
`Vector field "${field.path}" has ${field.dimension} dimensions, but a new index takes at most ${MAX_VECTOR_DIMENSION}`,
|
|
300
|
+
{ field: field.path, dimension: field.dimension, maximum: MAX_VECTOR_DIMENSION }
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function requireValidFieldTypes(flatSchema) {
|
|
305
|
+
let textFields = 0;
|
|
306
|
+
for (const [path, type] of Object.entries(flatSchema)) {
|
|
307
|
+
if (typeof type !== "string") {
|
|
308
|
+
throw new NarsilError(
|
|
309
|
+
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
310
|
+
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
311
|
+
{ field: path, type: String(type) }
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
if (isWordIndexedBase(parseFieldType(type, path).base)) textFields += 1;
|
|
315
|
+
}
|
|
316
|
+
requireTextFieldCount(textFields);
|
|
317
|
+
}
|
|
318
|
+
function flattenRecursive(schema, prefix, result) {
|
|
319
|
+
for (const [field, type] of Object.entries(schema)) {
|
|
320
|
+
const path = prefix ? `${prefix}.${field}` : field;
|
|
321
|
+
if (isPlainObject(type)) {
|
|
322
|
+
flattenRecursive(type, path, result);
|
|
323
|
+
} else {
|
|
324
|
+
result[path] = type;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
var flattenedSchemas = /* @__PURE__ */ new WeakMap();
|
|
329
|
+
function flattenSchema(schema) {
|
|
330
|
+
const cached = flattenedSchemas.get(schema);
|
|
331
|
+
if (cached !== void 0) return cached;
|
|
332
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
333
|
+
flattenRecursive(schema, "", result);
|
|
334
|
+
flattenedSchemas.set(schema, Object.freeze(result));
|
|
335
|
+
return result;
|
|
336
|
+
}
|
|
337
|
+
var parsedSchemas = /* @__PURE__ */ new WeakMap();
|
|
338
|
+
function schemaFieldsOf(schema) {
|
|
339
|
+
const cached = parsedSchemas.get(schema);
|
|
340
|
+
if (cached !== void 0) return cached;
|
|
341
|
+
const fields = [];
|
|
342
|
+
for (const [path, type] of Object.entries(flattenSchema(schema))) {
|
|
343
|
+
fields.push({ ...parseFieldType(type, path), path });
|
|
344
|
+
}
|
|
345
|
+
const frozen = Object.freeze(fields);
|
|
346
|
+
parsedSchemas.set(schema, frozen);
|
|
347
|
+
return frozen;
|
|
348
|
+
}
|
|
349
|
+
var partialFieldsBySchema = /* @__PURE__ */ new WeakMap();
|
|
350
|
+
function partialFieldsOf(schema) {
|
|
351
|
+
const cached = partialFieldsBySchema.get(schema);
|
|
352
|
+
if (cached !== void 0) return cached;
|
|
353
|
+
const paths = [];
|
|
354
|
+
for (const field of schemaFieldsOf(schema)) {
|
|
355
|
+
if (field.partial) paths.push(field.path);
|
|
356
|
+
}
|
|
357
|
+
const frozen = Object.freeze(paths.sort(compareCodePoints));
|
|
358
|
+
partialFieldsBySchema.set(schema, frozen);
|
|
359
|
+
return frozen;
|
|
360
|
+
}
|
|
361
|
+
function extractVectorFieldsFromSchema(schema) {
|
|
362
|
+
const result = /* @__PURE__ */ new Map();
|
|
363
|
+
for (const field of schemaFieldsOf(schema)) {
|
|
364
|
+
if (field.base === "vector") result.set(field.path, field.dimension);
|
|
365
|
+
}
|
|
366
|
+
return result;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/languages/snowball/base-stemmer.ts
|
|
370
|
+
var BaseStemmer = class {
|
|
371
|
+
current = "";
|
|
372
|
+
c = 0;
|
|
373
|
+
limit = 0;
|
|
374
|
+
limit_backward = 0;
|
|
375
|
+
bra = 0;
|
|
376
|
+
ket = 0;
|
|
377
|
+
af = 0;
|
|
378
|
+
setCurrent(value) {
|
|
379
|
+
this.current = value;
|
|
380
|
+
this.c = 0;
|
|
381
|
+
this.limit = this.current.length;
|
|
382
|
+
this.limit_backward = 0;
|
|
383
|
+
this.bra = 0;
|
|
384
|
+
this.ket = 0;
|
|
385
|
+
}
|
|
386
|
+
getCurrent() {
|
|
387
|
+
return this.current;
|
|
388
|
+
}
|
|
389
|
+
in_grouping(s, min, max) {
|
|
390
|
+
if (this.c >= this.limit) return false;
|
|
391
|
+
let ch = this.current.charCodeAt(this.c);
|
|
392
|
+
if (ch > max || ch < min) return false;
|
|
393
|
+
ch -= min;
|
|
394
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
|
|
395
|
+
this.c++;
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
go_in_grouping(s, min, max) {
|
|
399
|
+
while (this.c < this.limit) {
|
|
400
|
+
let ch = this.current.charCodeAt(this.c);
|
|
401
|
+
if (ch > max || ch < min) return true;
|
|
402
|
+
ch -= min;
|
|
403
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
|
|
404
|
+
this.c++;
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
in_grouping_b(s, min, max) {
|
|
409
|
+
if (this.c <= this.limit_backward) return false;
|
|
410
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
411
|
+
if (ch > max || ch < min) return false;
|
|
412
|
+
ch -= min;
|
|
413
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
|
|
414
|
+
this.c--;
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
go_in_grouping_b(s, min, max) {
|
|
418
|
+
while (this.c > this.limit_backward) {
|
|
419
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
420
|
+
if (ch > max || ch < min) return true;
|
|
421
|
+
ch -= min;
|
|
422
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
|
|
423
|
+
this.c--;
|
|
424
|
+
}
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
out_grouping(s, min, max) {
|
|
428
|
+
if (this.c >= this.limit) return false;
|
|
429
|
+
let ch = this.current.charCodeAt(this.c);
|
|
430
|
+
if (ch > max || ch < min) {
|
|
431
|
+
this.c++;
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
ch -= min;
|
|
435
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
|
|
436
|
+
this.c++;
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
go_out_grouping(s, min, max) {
|
|
442
|
+
while (this.c < this.limit) {
|
|
443
|
+
let ch = this.current.charCodeAt(this.c);
|
|
444
|
+
if (ch <= max && ch >= min) {
|
|
445
|
+
ch -= min;
|
|
446
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
|
|
447
|
+
}
|
|
448
|
+
this.c++;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
out_grouping_b(s, min, max) {
|
|
453
|
+
if (this.c <= this.limit_backward) return false;
|
|
454
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
455
|
+
if (ch > max || ch < min) {
|
|
456
|
+
this.c--;
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
ch -= min;
|
|
460
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
|
|
461
|
+
this.c--;
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
go_out_grouping_b(s, min, max) {
|
|
467
|
+
while (this.c > this.limit_backward) {
|
|
468
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
469
|
+
if (ch <= max && ch >= min) {
|
|
470
|
+
ch -= min;
|
|
471
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
|
|
472
|
+
}
|
|
473
|
+
this.c--;
|
|
474
|
+
}
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
eq_s(s) {
|
|
478
|
+
if (this.limit - this.c < s.length) return false;
|
|
479
|
+
if (!this.current.startsWith(s, this.c)) return false;
|
|
480
|
+
this.c += s.length;
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
eq_s_b(s) {
|
|
484
|
+
if (this.c - this.limit_backward < s.length) return false;
|
|
485
|
+
if (!this.current.endsWith(s, this.c)) return false;
|
|
486
|
+
this.c -= s.length;
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
find_among(v, call_among_func) {
|
|
490
|
+
let i = 0;
|
|
491
|
+
let j = v.length;
|
|
492
|
+
const c = this.c;
|
|
493
|
+
const l = this.limit;
|
|
494
|
+
let common_i = 0;
|
|
495
|
+
let common_j = 0;
|
|
496
|
+
let first_key_inspected = false;
|
|
497
|
+
while (true) {
|
|
498
|
+
const k = i + (j - i >>> 1);
|
|
499
|
+
let diff = 0;
|
|
500
|
+
let common = common_i < common_j ? common_i : common_j;
|
|
501
|
+
const s = v[k][0];
|
|
502
|
+
for (let i2 = common; i2 < s.length; i2++) {
|
|
503
|
+
if (c + common === l) {
|
|
504
|
+
diff = -1;
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
diff = this.current.charCodeAt(c + common) - s.charCodeAt(i2);
|
|
508
|
+
if (diff !== 0) break;
|
|
509
|
+
common++;
|
|
510
|
+
}
|
|
511
|
+
if (diff < 0) {
|
|
512
|
+
j = k;
|
|
513
|
+
common_j = common;
|
|
514
|
+
} else {
|
|
515
|
+
i = k;
|
|
516
|
+
common_i = common;
|
|
517
|
+
}
|
|
518
|
+
if (j - i <= 1) {
|
|
519
|
+
if (i > 0) break;
|
|
520
|
+
if (j === i) break;
|
|
521
|
+
if (first_key_inspected) break;
|
|
522
|
+
first_key_inspected = true;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
while (true) {
|
|
526
|
+
const w = v[i];
|
|
527
|
+
const len = w[0].length;
|
|
528
|
+
if (common_i >= len) {
|
|
529
|
+
this.c = c + len;
|
|
530
|
+
const action = w[3];
|
|
531
|
+
if (action === void 0) return w[1];
|
|
532
|
+
this.af = action;
|
|
533
|
+
if (call_among_func?.call(this) === true) {
|
|
534
|
+
this.c = c + len;
|
|
535
|
+
return w[1];
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const back = w[2];
|
|
539
|
+
if (back === void 0 || back === 0) return 0;
|
|
540
|
+
i -= back;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
find_among_b(v, call_among_func) {
|
|
544
|
+
let i = 0;
|
|
545
|
+
let j = v.length;
|
|
546
|
+
const c = this.c;
|
|
547
|
+
const lb = this.limit_backward;
|
|
548
|
+
let common_i = 0;
|
|
549
|
+
let common_j = 0;
|
|
550
|
+
let first_key_inspected = false;
|
|
551
|
+
while (true) {
|
|
552
|
+
const k = i + (j - i >> 1);
|
|
553
|
+
let diff = 0;
|
|
554
|
+
let common = common_i < common_j ? common_i : common_j;
|
|
555
|
+
const s = v[k][0];
|
|
556
|
+
for (let i2 = s.length - 1 - common; i2 >= 0; i2--) {
|
|
557
|
+
if (c - common === lb) {
|
|
558
|
+
diff = -1;
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
diff = this.current.charCodeAt(c - 1 - common) - s.charCodeAt(i2);
|
|
562
|
+
if (diff !== 0) break;
|
|
563
|
+
common++;
|
|
564
|
+
}
|
|
565
|
+
if (diff < 0) {
|
|
566
|
+
j = k;
|
|
567
|
+
common_j = common;
|
|
568
|
+
} else {
|
|
569
|
+
i = k;
|
|
570
|
+
common_i = common;
|
|
571
|
+
}
|
|
572
|
+
if (j - i <= 1) {
|
|
573
|
+
if (i > 0) break;
|
|
574
|
+
if (j === i) break;
|
|
575
|
+
if (first_key_inspected) break;
|
|
576
|
+
first_key_inspected = true;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
while (true) {
|
|
580
|
+
const w = v[i];
|
|
581
|
+
const len = w[0].length;
|
|
582
|
+
if (common_i >= len) {
|
|
583
|
+
this.c = c - len;
|
|
584
|
+
const action = w[3];
|
|
585
|
+
if (action === void 0) return w[1];
|
|
586
|
+
this.af = action;
|
|
587
|
+
if (call_among_func?.call(this) === true) {
|
|
588
|
+
this.c = c - len;
|
|
589
|
+
return w[1];
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const back = w[2];
|
|
593
|
+
if (back === void 0 || back === 0) return 0;
|
|
594
|
+
i -= back;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
replace_s(c_bra, c_ket, s) {
|
|
598
|
+
const adjustment = s.length - (c_ket - c_bra);
|
|
599
|
+
this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket);
|
|
600
|
+
this.limit += adjustment;
|
|
601
|
+
if (this.c >= c_ket) this.c += adjustment;
|
|
602
|
+
else if (this.c > c_bra) this.c = c_bra;
|
|
603
|
+
return adjustment;
|
|
604
|
+
}
|
|
605
|
+
slice_from(s) {
|
|
606
|
+
this.replace_s(this.bra, this.ket, s);
|
|
607
|
+
this.ket = this.bra + s.length;
|
|
608
|
+
}
|
|
609
|
+
slice_del() {
|
|
610
|
+
this.slice_from("");
|
|
611
|
+
}
|
|
612
|
+
insert(c_bra, c_ket, s) {
|
|
613
|
+
const adjustment = this.replace_s(c_bra, c_ket, s);
|
|
614
|
+
if (c_bra <= this.bra) this.bra += adjustment;
|
|
615
|
+
if (c_bra <= this.ket) this.ket += adjustment;
|
|
616
|
+
}
|
|
617
|
+
slice_to() {
|
|
618
|
+
return this.current.slice(this.bra, this.ket);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// src/languages/snowball/english.ts
|
|
623
|
+
var a_0 = [
|
|
624
|
+
["arsen", -1],
|
|
625
|
+
["commun", -1],
|
|
626
|
+
["emerg", -1],
|
|
627
|
+
["gener", -1],
|
|
628
|
+
["inter", -1],
|
|
629
|
+
["later", -1],
|
|
630
|
+
["organ", -1],
|
|
631
|
+
["past", -1],
|
|
632
|
+
["univers", -1]
|
|
633
|
+
];
|
|
634
|
+
var a_1 = [
|
|
635
|
+
["'", 1],
|
|
636
|
+
["'s'", 1, 1],
|
|
637
|
+
["'s", 1]
|
|
638
|
+
];
|
|
639
|
+
var a_2 = [
|
|
640
|
+
["ied", 2],
|
|
641
|
+
["s", 3],
|
|
642
|
+
["ies", 2, 1],
|
|
643
|
+
["sses", 1, 2],
|
|
644
|
+
["ss", -1, 3],
|
|
645
|
+
["us", -1, 4]
|
|
646
|
+
];
|
|
647
|
+
var a_3 = [
|
|
648
|
+
["succ", 1],
|
|
649
|
+
["proc", 1],
|
|
650
|
+
["exc", 1]
|
|
651
|
+
];
|
|
652
|
+
var a_4 = [
|
|
653
|
+
["even", 2],
|
|
654
|
+
["cann", 2],
|
|
655
|
+
["inn", 2],
|
|
656
|
+
["earr", 2],
|
|
657
|
+
["herr", 2],
|
|
658
|
+
["out", 2],
|
|
659
|
+
["y", 1]
|
|
660
|
+
];
|
|
661
|
+
var a_5 = [
|
|
662
|
+
["", -1],
|
|
663
|
+
["ed", 2, 1],
|
|
664
|
+
["eed", 1, 1],
|
|
665
|
+
["ing", 3, 3],
|
|
666
|
+
["edly", 2, 4],
|
|
667
|
+
["eedly", 1, 1],
|
|
668
|
+
["ingly", 2, 6]
|
|
669
|
+
];
|
|
670
|
+
var a_6 = [
|
|
671
|
+
["", 3],
|
|
672
|
+
["bb", 2, 1],
|
|
673
|
+
["dd", 2, 2],
|
|
674
|
+
["ff", 2, 3],
|
|
675
|
+
["gg", 2, 4],
|
|
676
|
+
["bl", 1, 5],
|
|
677
|
+
["mm", 2, 6],
|
|
678
|
+
["nn", 2, 7],
|
|
679
|
+
["pp", 2, 8],
|
|
680
|
+
["rr", 2, 9],
|
|
681
|
+
["at", 1, 10],
|
|
682
|
+
["tt", 2, 11],
|
|
683
|
+
["iz", 1, 12]
|
|
684
|
+
];
|
|
685
|
+
var a_7 = [
|
|
686
|
+
["anci", 3],
|
|
687
|
+
["enci", 2],
|
|
688
|
+
["ogi", 14],
|
|
689
|
+
["li", 16],
|
|
690
|
+
["bli", 12, 1],
|
|
691
|
+
["abli", 4, 1],
|
|
692
|
+
["alli", 8, 3],
|
|
693
|
+
["fulli", 9, 4],
|
|
694
|
+
["lessli", 15, 5],
|
|
695
|
+
["ousli", 10, 6],
|
|
696
|
+
["entli", 5, 7],
|
|
697
|
+
["aliti", 8],
|
|
698
|
+
["biliti", 12],
|
|
699
|
+
["iviti", 11],
|
|
700
|
+
["tional", 1],
|
|
701
|
+
["ational", 7, 1],
|
|
702
|
+
["alism", 8],
|
|
703
|
+
["ation", 7],
|
|
704
|
+
["ization", 6, 1],
|
|
705
|
+
["izer", 6],
|
|
706
|
+
["ator", 7],
|
|
707
|
+
["iveness", 11],
|
|
708
|
+
["fulness", 9],
|
|
709
|
+
["ousness", 10],
|
|
710
|
+
["ogist", 13]
|
|
711
|
+
];
|
|
712
|
+
var a_8 = [
|
|
713
|
+
["icate", 4],
|
|
714
|
+
["ative", 6],
|
|
715
|
+
["alize", 3],
|
|
716
|
+
["iciti", 4],
|
|
717
|
+
["ical", 4],
|
|
718
|
+
["tional", 1],
|
|
719
|
+
["ational", 2, 1],
|
|
720
|
+
["ful", 5],
|
|
721
|
+
["ness", 5]
|
|
722
|
+
];
|
|
723
|
+
var a_9 = [
|
|
724
|
+
["ic", 1],
|
|
725
|
+
["ance", 1],
|
|
726
|
+
["ence", 1],
|
|
727
|
+
["able", 1],
|
|
728
|
+
["ible", 1],
|
|
729
|
+
["ate", 1],
|
|
730
|
+
["ive", 1],
|
|
731
|
+
["ize", 1],
|
|
732
|
+
["iti", 1],
|
|
733
|
+
["al", 1],
|
|
734
|
+
["ism", 1],
|
|
735
|
+
["ion", 2],
|
|
736
|
+
["er", 1],
|
|
737
|
+
["ous", 1],
|
|
738
|
+
["ant", 1],
|
|
739
|
+
["ent", 1],
|
|
740
|
+
["ment", 1, 1],
|
|
741
|
+
["ement", 1, 1]
|
|
742
|
+
];
|
|
743
|
+
var a_10 = [
|
|
744
|
+
["e", 1],
|
|
745
|
+
["l", 2]
|
|
746
|
+
];
|
|
747
|
+
var a_11 = [
|
|
748
|
+
["andes", -1],
|
|
749
|
+
["atlas", -1],
|
|
750
|
+
["bias", -1],
|
|
751
|
+
["cosmos", -1],
|
|
752
|
+
["early", 6],
|
|
753
|
+
["gently", 4],
|
|
754
|
+
["howe", -1],
|
|
755
|
+
["idly", 3],
|
|
756
|
+
["news", -1],
|
|
757
|
+
["only", 7],
|
|
758
|
+
["singly", 8],
|
|
759
|
+
["skies", 2],
|
|
760
|
+
["skis", 1],
|
|
761
|
+
["sky", -1],
|
|
762
|
+
["ugly", 5]
|
|
763
|
+
];
|
|
764
|
+
var as_11 = ["ski", "sky", "idl", "gentl", "ugli", "earli", "onli", "singl"];
|
|
765
|
+
var g_aeo = [17, 64];
|
|
766
|
+
var g_v = [17, 65, 16, 1];
|
|
767
|
+
var g_v_WXY = [1, 17, 65, 208, 1];
|
|
768
|
+
var g_valid_LI = [55, 141, 2];
|
|
769
|
+
var EnglishStemmer = class extends BaseStemmer {
|
|
770
|
+
#r_shortv() {
|
|
771
|
+
lab0: {
|
|
772
|
+
const v_1 = this.limit - this.c;
|
|
773
|
+
lab1: {
|
|
774
|
+
if (!this.out_grouping_b(g_v_WXY, 89, 121)) break lab1;
|
|
775
|
+
if (!this.in_grouping_b(g_v, 97, 121)) break lab1;
|
|
776
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab1;
|
|
777
|
+
break lab0;
|
|
778
|
+
}
|
|
779
|
+
this.c = this.limit - v_1;
|
|
780
|
+
lab2: {
|
|
781
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab2;
|
|
782
|
+
if (!this.in_grouping_b(g_v, 97, 121)) break lab2;
|
|
783
|
+
if (
|
|
784
|
+
/**@type {boolean}*/
|
|
785
|
+
this.c > this.limit_backward
|
|
786
|
+
) break lab2;
|
|
787
|
+
break lab0;
|
|
788
|
+
}
|
|
789
|
+
this.c = this.limit - v_1;
|
|
790
|
+
if (!this.eq_s_b("past")) return false;
|
|
791
|
+
}
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
#stem() {
|
|
795
|
+
let a;
|
|
796
|
+
let B_Y_found;
|
|
797
|
+
let I_p2;
|
|
798
|
+
let I_p1;
|
|
799
|
+
lab0: {
|
|
800
|
+
const v_1 = this.c;
|
|
801
|
+
lab1: {
|
|
802
|
+
this.bra = this.c;
|
|
803
|
+
a = this.find_among(a_11);
|
|
804
|
+
if (a === 0) break lab1;
|
|
805
|
+
this.ket = this.c;
|
|
806
|
+
if (
|
|
807
|
+
/**@type {boolean}*/
|
|
808
|
+
this.c < this.limit
|
|
809
|
+
) break lab1;
|
|
810
|
+
if (a > 0) {
|
|
811
|
+
this.slice_from(as_11[a - 1]);
|
|
812
|
+
}
|
|
813
|
+
break lab0;
|
|
814
|
+
}
|
|
815
|
+
this.c = v_1;
|
|
816
|
+
lab2: {
|
|
817
|
+
lab3: {
|
|
818
|
+
if (this.c + 3 > this.limit) break lab3;
|
|
819
|
+
this.c += 3;
|
|
820
|
+
break lab2;
|
|
821
|
+
}
|
|
822
|
+
break lab0;
|
|
823
|
+
}
|
|
824
|
+
this.c = v_1;
|
|
825
|
+
{
|
|
826
|
+
B_Y_found = false;
|
|
827
|
+
const v_2 = this.c;
|
|
828
|
+
lab5: {
|
|
829
|
+
this.bra = this.c;
|
|
830
|
+
if (!this.eq_s("'")) break lab5;
|
|
831
|
+
this.ket = this.c;
|
|
832
|
+
this.slice_del();
|
|
833
|
+
}
|
|
834
|
+
this.c = v_2;
|
|
835
|
+
const v_3 = this.c;
|
|
836
|
+
lab6: {
|
|
837
|
+
this.bra = this.c;
|
|
838
|
+
if (!this.eq_s("y")) break lab6;
|
|
839
|
+
this.ket = this.c;
|
|
840
|
+
this.slice_from("Y");
|
|
841
|
+
B_Y_found = true;
|
|
842
|
+
}
|
|
843
|
+
this.c = v_3;
|
|
844
|
+
const v_4 = this.c;
|
|
845
|
+
while (true) {
|
|
846
|
+
const v_5 = this.c;
|
|
847
|
+
lab8: {
|
|
848
|
+
while (true) {
|
|
849
|
+
const v_6 = this.c;
|
|
850
|
+
lab10: {
|
|
851
|
+
if (!this.in_grouping(g_v, 97, 121)) break lab10;
|
|
852
|
+
this.bra = this.c;
|
|
853
|
+
if (!this.eq_s("y")) break lab10;
|
|
854
|
+
this.ket = this.c;
|
|
855
|
+
this.c = v_6;
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
this.c = v_6;
|
|
859
|
+
if (this.c >= this.limit) break lab8;
|
|
860
|
+
this.c++;
|
|
861
|
+
}
|
|
862
|
+
this.slice_from("Y");
|
|
863
|
+
B_Y_found = true;
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
this.c = v_5;
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
this.c = v_4;
|
|
870
|
+
}
|
|
871
|
+
{
|
|
872
|
+
I_p1 = this.limit;
|
|
873
|
+
I_p2 = this.limit;
|
|
874
|
+
const v_7 = this.c;
|
|
875
|
+
lab12: {
|
|
876
|
+
lab13: {
|
|
877
|
+
const v_8 = this.c;
|
|
878
|
+
lab14: {
|
|
879
|
+
if (this.find_among(a_0) === 0) break lab14;
|
|
880
|
+
break lab13;
|
|
881
|
+
}
|
|
882
|
+
this.c = v_8;
|
|
883
|
+
if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
|
|
884
|
+
this.c++;
|
|
885
|
+
if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
|
|
886
|
+
this.c++;
|
|
887
|
+
}
|
|
888
|
+
I_p1 = this.c;
|
|
889
|
+
if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
|
|
890
|
+
this.c++;
|
|
891
|
+
if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
|
|
892
|
+
this.c++;
|
|
893
|
+
I_p2 = this.c;
|
|
894
|
+
}
|
|
895
|
+
this.c = v_7;
|
|
896
|
+
}
|
|
897
|
+
this.limit_backward = this.c;
|
|
898
|
+
this.c = this.limit;
|
|
899
|
+
const v_9 = this.limit - this.c;
|
|
900
|
+
lab15: {
|
|
901
|
+
const v_10 = this.limit - this.c;
|
|
902
|
+
lab16: {
|
|
903
|
+
this.ket = this.c;
|
|
904
|
+
if (this.find_among_b(a_1) === 0) {
|
|
905
|
+
this.c = this.limit - v_10;
|
|
906
|
+
break lab16;
|
|
907
|
+
}
|
|
908
|
+
this.bra = this.c;
|
|
909
|
+
this.slice_del();
|
|
910
|
+
}
|
|
911
|
+
this.ket = this.c;
|
|
912
|
+
a = this.find_among_b(a_2);
|
|
913
|
+
if (a === 0) break lab15;
|
|
914
|
+
this.bra = this.c;
|
|
915
|
+
switch (a) {
|
|
916
|
+
case 1: {
|
|
917
|
+
this.slice_from("ss");
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
case 2: {
|
|
921
|
+
lab17: {
|
|
922
|
+
const v_11 = this.limit - this.c;
|
|
923
|
+
lab18: {
|
|
924
|
+
if (this.c - 2 < this.limit_backward) break lab18;
|
|
925
|
+
this.c -= 2;
|
|
926
|
+
this.slice_from("i");
|
|
927
|
+
break lab17;
|
|
928
|
+
}
|
|
929
|
+
this.c = this.limit - v_11;
|
|
930
|
+
this.slice_from("ie");
|
|
931
|
+
}
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
case 3: {
|
|
935
|
+
if (this.c <= this.limit_backward) break lab15;
|
|
936
|
+
this.c--;
|
|
937
|
+
if (!this.go_out_grouping_b(g_v, 97, 121)) break lab15;
|
|
938
|
+
this.c--;
|
|
939
|
+
this.slice_del();
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
this.c = this.limit - v_9;
|
|
945
|
+
const v_12 = this.limit - this.c;
|
|
946
|
+
lab19: {
|
|
947
|
+
this.ket = this.c;
|
|
948
|
+
a = this.find_among_b(a_5);
|
|
949
|
+
this.bra = this.c;
|
|
950
|
+
lab20: {
|
|
951
|
+
const v_13 = this.limit - this.c;
|
|
952
|
+
lab21: {
|
|
953
|
+
switch (a) {
|
|
954
|
+
case 1: {
|
|
955
|
+
const v_14 = this.limit - this.c;
|
|
956
|
+
lab22: {
|
|
957
|
+
if (
|
|
958
|
+
/**@type {boolean}*/
|
|
959
|
+
I_p1 > this.c
|
|
960
|
+
) break lab22;
|
|
961
|
+
lab23: {
|
|
962
|
+
const v_15 = this.limit - this.c;
|
|
963
|
+
lab24: {
|
|
964
|
+
if (this.find_among_b(a_3) === 0) break lab24;
|
|
965
|
+
if (
|
|
966
|
+
/**@type {boolean}*/
|
|
967
|
+
this.c > this.limit_backward
|
|
968
|
+
) break lab24;
|
|
969
|
+
break lab23;
|
|
970
|
+
}
|
|
971
|
+
this.c = this.limit - v_15;
|
|
972
|
+
this.slice_from("ee");
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
this.c = this.limit - v_14;
|
|
976
|
+
break;
|
|
977
|
+
}
|
|
978
|
+
case 2: {
|
|
979
|
+
break lab21;
|
|
980
|
+
}
|
|
981
|
+
case 3: {
|
|
982
|
+
a = this.find_among_b(a_4);
|
|
983
|
+
if (a === 0) break lab21;
|
|
984
|
+
switch (a) {
|
|
985
|
+
case 1: {
|
|
986
|
+
const v_16 = this.limit - this.c;
|
|
987
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab21;
|
|
988
|
+
if (
|
|
989
|
+
/**@type {boolean}*/
|
|
990
|
+
this.c > this.limit_backward
|
|
991
|
+
) break lab21;
|
|
992
|
+
this.c = this.limit - v_16;
|
|
993
|
+
this.bra = this.c;
|
|
994
|
+
this.slice_from("ie");
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
case 2: {
|
|
998
|
+
if (
|
|
999
|
+
/**@type {boolean}*/
|
|
1000
|
+
this.c > this.limit_backward
|
|
1001
|
+
) break lab21;
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
break lab20;
|
|
1009
|
+
}
|
|
1010
|
+
this.c = this.limit - v_13;
|
|
1011
|
+
const v_17 = this.limit - this.c;
|
|
1012
|
+
if (!this.go_out_grouping_b(g_v, 97, 121)) break lab19;
|
|
1013
|
+
this.c--;
|
|
1014
|
+
this.c = this.limit - v_17;
|
|
1015
|
+
this.slice_del();
|
|
1016
|
+
this.ket = this.c;
|
|
1017
|
+
this.bra = this.c;
|
|
1018
|
+
const v_18 = this.limit - this.c;
|
|
1019
|
+
a = this.find_among_b(a_6);
|
|
1020
|
+
switch (a) {
|
|
1021
|
+
case 1: {
|
|
1022
|
+
this.slice_from("e");
|
|
1023
|
+
break lab19;
|
|
1024
|
+
}
|
|
1025
|
+
case 2: {
|
|
1026
|
+
{
|
|
1027
|
+
const v_19 = this.limit - this.c;
|
|
1028
|
+
lab25: {
|
|
1029
|
+
if (!this.in_grouping_b(g_aeo, 97, 111)) break lab25;
|
|
1030
|
+
if (
|
|
1031
|
+
/**@type {boolean}*/
|
|
1032
|
+
this.c > this.limit_backward
|
|
1033
|
+
) break lab25;
|
|
1034
|
+
break lab19;
|
|
1035
|
+
}
|
|
1036
|
+
this.c = this.limit - v_19;
|
|
1037
|
+
}
|
|
1038
|
+
break;
|
|
1039
|
+
}
|
|
1040
|
+
case 3: {
|
|
1041
|
+
if (
|
|
1042
|
+
/**@type {boolean}*/
|
|
1043
|
+
this.c !== I_p1
|
|
1044
|
+
) break lab19;
|
|
1045
|
+
const v_20 = this.limit - this.c;
|
|
1046
|
+
if (!this.#r_shortv()) break lab19;
|
|
1047
|
+
this.c = this.limit - v_20;
|
|
1048
|
+
this.slice_from("e");
|
|
1049
|
+
break lab19;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
this.c = this.limit - v_18;
|
|
1053
|
+
this.ket = this.c;
|
|
1054
|
+
if (this.c <= this.limit_backward) break lab19;
|
|
1055
|
+
this.c--;
|
|
1056
|
+
this.bra = this.c;
|
|
1057
|
+
this.slice_del();
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
this.c = this.limit - v_12;
|
|
1061
|
+
const v_21 = this.limit - this.c;
|
|
1062
|
+
lab26: {
|
|
1063
|
+
this.ket = this.c;
|
|
1064
|
+
lab27: {
|
|
1065
|
+
lab28: {
|
|
1066
|
+
if (!this.eq_s_b("y")) break lab28;
|
|
1067
|
+
break lab27;
|
|
1068
|
+
}
|
|
1069
|
+
if (!this.eq_s_b("Y")) break lab26;
|
|
1070
|
+
}
|
|
1071
|
+
this.bra = this.c;
|
|
1072
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab26;
|
|
1073
|
+
if (
|
|
1074
|
+
/**@type {boolean}*/
|
|
1075
|
+
this.c <= this.limit_backward
|
|
1076
|
+
) break lab26;
|
|
1077
|
+
this.slice_from("i");
|
|
1078
|
+
}
|
|
1079
|
+
this.c = this.limit - v_21;
|
|
1080
|
+
const v_22 = this.limit - this.c;
|
|
1081
|
+
lab29: {
|
|
1082
|
+
this.ket = this.c;
|
|
1083
|
+
a = this.find_among_b(a_7);
|
|
1084
|
+
if (a === 0) break lab29;
|
|
1085
|
+
this.bra = this.c;
|
|
1086
|
+
if (
|
|
1087
|
+
/**@type {boolean}*/
|
|
1088
|
+
I_p1 > this.c
|
|
1089
|
+
) break lab29;
|
|
1090
|
+
switch (a) {
|
|
1091
|
+
case 1: {
|
|
1092
|
+
this.slice_from("tion");
|
|
1093
|
+
break;
|
|
1094
|
+
}
|
|
1095
|
+
case 2: {
|
|
1096
|
+
this.slice_from("ence");
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
case 3: {
|
|
1100
|
+
this.slice_from("ance");
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
case 4: {
|
|
1104
|
+
this.slice_from("able");
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
case 5: {
|
|
1108
|
+
this.slice_from("ent");
|
|
1109
|
+
break;
|
|
1110
|
+
}
|
|
1111
|
+
case 6: {
|
|
1112
|
+
this.slice_from("ize");
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
case 7: {
|
|
1116
|
+
this.slice_from("ate");
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
case 8: {
|
|
1120
|
+
this.slice_from("al");
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
case 9: {
|
|
1124
|
+
this.slice_from("ful");
|
|
1125
|
+
break;
|
|
1126
|
+
}
|
|
1127
|
+
case 10: {
|
|
1128
|
+
this.slice_from("ous");
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
case 11: {
|
|
1132
|
+
this.slice_from("ive");
|
|
1133
|
+
break;
|
|
1134
|
+
}
|
|
1135
|
+
case 12: {
|
|
1136
|
+
this.slice_from("ble");
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
case 13: {
|
|
1140
|
+
this.slice_from("og");
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
case 14: {
|
|
1144
|
+
if (!this.eq_s_b("l")) break lab29;
|
|
1145
|
+
this.slice_from("og");
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
case 15: {
|
|
1149
|
+
this.slice_from("less");
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
case 16: {
|
|
1153
|
+
if (!this.in_grouping_b(g_valid_LI, 99, 116)) break lab29;
|
|
1154
|
+
this.slice_del();
|
|
1155
|
+
break;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
this.c = this.limit - v_22;
|
|
1160
|
+
const v_23 = this.limit - this.c;
|
|
1161
|
+
lab30: {
|
|
1162
|
+
this.ket = this.c;
|
|
1163
|
+
a = this.find_among_b(a_8);
|
|
1164
|
+
if (a === 0) break lab30;
|
|
1165
|
+
this.bra = this.c;
|
|
1166
|
+
if (
|
|
1167
|
+
/**@type {boolean}*/
|
|
1168
|
+
I_p1 > this.c
|
|
1169
|
+
) break lab30;
|
|
1170
|
+
switch (a) {
|
|
1171
|
+
case 1: {
|
|
1172
|
+
this.slice_from("tion");
|
|
1173
|
+
break;
|
|
1174
|
+
}
|
|
1175
|
+
case 2: {
|
|
1176
|
+
this.slice_from("ate");
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
case 3: {
|
|
1180
|
+
this.slice_from("al");
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
case 4: {
|
|
1184
|
+
this.slice_from("ic");
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
case 5: {
|
|
1188
|
+
this.slice_del();
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
case 6: {
|
|
1192
|
+
if (
|
|
1193
|
+
/**@type {boolean}*/
|
|
1194
|
+
I_p2 > this.c
|
|
1195
|
+
) break lab30;
|
|
1196
|
+
this.slice_del();
|
|
1197
|
+
break;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
this.c = this.limit - v_23;
|
|
1202
|
+
const v_24 = this.limit - this.c;
|
|
1203
|
+
lab31: {
|
|
1204
|
+
this.ket = this.c;
|
|
1205
|
+
a = this.find_among_b(a_9);
|
|
1206
|
+
if (a === 0) break lab31;
|
|
1207
|
+
this.bra = this.c;
|
|
1208
|
+
if (
|
|
1209
|
+
/**@type {boolean}*/
|
|
1210
|
+
I_p2 > this.c
|
|
1211
|
+
) break lab31;
|
|
1212
|
+
switch (a) {
|
|
1213
|
+
case 1: {
|
|
1214
|
+
this.slice_del();
|
|
1215
|
+
break;
|
|
1216
|
+
}
|
|
1217
|
+
case 2: {
|
|
1218
|
+
lab32: {
|
|
1219
|
+
lab33: {
|
|
1220
|
+
if (!this.eq_s_b("s")) break lab33;
|
|
1221
|
+
break lab32;
|
|
1222
|
+
}
|
|
1223
|
+
if (!this.eq_s_b("t")) break lab31;
|
|
1224
|
+
}
|
|
1225
|
+
this.slice_del();
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
this.c = this.limit - v_24;
|
|
1231
|
+
const v_25 = this.limit - this.c;
|
|
1232
|
+
lab34: {
|
|
1233
|
+
this.ket = this.c;
|
|
1234
|
+
a = this.find_among_b(a_10);
|
|
1235
|
+
if (a === 0) break lab34;
|
|
1236
|
+
this.bra = this.c;
|
|
1237
|
+
switch (a) {
|
|
1238
|
+
case 1: {
|
|
1239
|
+
lab35: {
|
|
1240
|
+
lab36: {
|
|
1241
|
+
if (
|
|
1242
|
+
/**@type {boolean}*/
|
|
1243
|
+
I_p2 > this.c
|
|
1244
|
+
) break lab36;
|
|
1245
|
+
break lab35;
|
|
1246
|
+
}
|
|
1247
|
+
if (
|
|
1248
|
+
/**@type {boolean}*/
|
|
1249
|
+
I_p1 > this.c
|
|
1250
|
+
) break lab34;
|
|
1251
|
+
{
|
|
1252
|
+
const v_26 = this.limit - this.c;
|
|
1253
|
+
lab37: {
|
|
1254
|
+
if (!this.#r_shortv()) break lab37;
|
|
1255
|
+
break lab34;
|
|
1256
|
+
}
|
|
1257
|
+
this.c = this.limit - v_26;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
this.slice_del();
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
case 2: {
|
|
1264
|
+
if (
|
|
1265
|
+
/**@type {boolean}*/
|
|
1266
|
+
I_p2 > this.c
|
|
1267
|
+
) break lab34;
|
|
1268
|
+
if (!this.eq_s_b("l")) break lab34;
|
|
1269
|
+
this.slice_del();
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
this.c = this.limit - v_25;
|
|
1275
|
+
this.c = this.limit_backward;
|
|
1276
|
+
const v_27 = this.c;
|
|
1277
|
+
lab38: {
|
|
1278
|
+
if (!B_Y_found) break lab38;
|
|
1279
|
+
while (true) {
|
|
1280
|
+
const v_28 = this.c;
|
|
1281
|
+
lab39: {
|
|
1282
|
+
while (true) {
|
|
1283
|
+
const v_29 = this.c;
|
|
1284
|
+
lab41: {
|
|
1285
|
+
this.bra = this.c;
|
|
1286
|
+
if (!this.eq_s("Y")) break lab41;
|
|
1287
|
+
this.ket = this.c;
|
|
1288
|
+
this.c = v_29;
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
this.c = v_29;
|
|
1292
|
+
if (this.c >= this.limit) break lab39;
|
|
1293
|
+
this.c++;
|
|
1294
|
+
}
|
|
1295
|
+
this.slice_from("y");
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
this.c = v_28;
|
|
1299
|
+
break;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
this.c = v_27;
|
|
1303
|
+
}
|
|
1304
|
+
return true;
|
|
1305
|
+
}
|
|
1306
|
+
stem(input) {
|
|
1307
|
+
this.setCurrent(input);
|
|
1308
|
+
this.#stem();
|
|
1309
|
+
return this.getCurrent();
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
var shared = new EnglishStemmer();
|
|
1313
|
+
function stem(token) {
|
|
1314
|
+
return shared.stem(token);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
// src/languages/english.ts
|
|
1318
|
+
var stopWords = /* @__PURE__ */ new Set([
|
|
1319
|
+
"a",
|
|
1320
|
+
"an",
|
|
1321
|
+
"the",
|
|
1322
|
+
"i",
|
|
1323
|
+
"me",
|
|
1324
|
+
"my",
|
|
1325
|
+
"myself",
|
|
1326
|
+
"we",
|
|
1327
|
+
"us",
|
|
1328
|
+
"our",
|
|
1329
|
+
"ours",
|
|
1330
|
+
"ourselves",
|
|
1331
|
+
"you",
|
|
1332
|
+
"your",
|
|
1333
|
+
"yours",
|
|
1334
|
+
"yourself",
|
|
1335
|
+
"yourselves",
|
|
1336
|
+
"he",
|
|
1337
|
+
"him",
|
|
1338
|
+
"his",
|
|
1339
|
+
"himself",
|
|
1340
|
+
"she",
|
|
1341
|
+
"her",
|
|
1342
|
+
"hers",
|
|
1343
|
+
"herself",
|
|
1344
|
+
"it",
|
|
1345
|
+
"its",
|
|
1346
|
+
"itself",
|
|
1347
|
+
"they",
|
|
1348
|
+
"them",
|
|
1349
|
+
"their",
|
|
1350
|
+
"theirs",
|
|
1351
|
+
"themselves",
|
|
1352
|
+
"what",
|
|
1353
|
+
"which",
|
|
1354
|
+
"who",
|
|
1355
|
+
"whom",
|
|
1356
|
+
"this",
|
|
1357
|
+
"that",
|
|
1358
|
+
"these",
|
|
1359
|
+
"those",
|
|
1360
|
+
"am",
|
|
1361
|
+
"is",
|
|
1362
|
+
"are",
|
|
1363
|
+
"was",
|
|
1364
|
+
"were",
|
|
1365
|
+
"be",
|
|
1366
|
+
"been",
|
|
1367
|
+
"being",
|
|
1368
|
+
"have",
|
|
1369
|
+
"has",
|
|
1370
|
+
"had",
|
|
1371
|
+
"having",
|
|
1372
|
+
"do",
|
|
1373
|
+
"does",
|
|
1374
|
+
"did",
|
|
1375
|
+
"doing",
|
|
1376
|
+
"will",
|
|
1377
|
+
"would",
|
|
1378
|
+
"shall",
|
|
1379
|
+
"should",
|
|
1380
|
+
"can",
|
|
1381
|
+
"could",
|
|
1382
|
+
"may",
|
|
1383
|
+
"might",
|
|
1384
|
+
"must",
|
|
1385
|
+
"ought",
|
|
1386
|
+
"i'm",
|
|
1387
|
+
"you're",
|
|
1388
|
+
"we're",
|
|
1389
|
+
"they're",
|
|
1390
|
+
"i've",
|
|
1391
|
+
"you've",
|
|
1392
|
+
"we've",
|
|
1393
|
+
"they've",
|
|
1394
|
+
"i'd",
|
|
1395
|
+
"you'd",
|
|
1396
|
+
"he'd",
|
|
1397
|
+
"she'd",
|
|
1398
|
+
"we'd",
|
|
1399
|
+
"they'd",
|
|
1400
|
+
"i'll",
|
|
1401
|
+
"you'll",
|
|
1402
|
+
"he'll",
|
|
1403
|
+
"she'll",
|
|
1404
|
+
"we'll",
|
|
1405
|
+
"they'll",
|
|
1406
|
+
"isn't",
|
|
1407
|
+
"aren't",
|
|
1408
|
+
"wasn't",
|
|
1409
|
+
"weren't",
|
|
1410
|
+
"hasn't",
|
|
1411
|
+
"haven't",
|
|
1412
|
+
"hadn't",
|
|
1413
|
+
"doesn't",
|
|
1414
|
+
"don't",
|
|
1415
|
+
"didn't",
|
|
1416
|
+
"won't",
|
|
1417
|
+
"wouldn't",
|
|
1418
|
+
"shan't",
|
|
1419
|
+
"shouldn't",
|
|
1420
|
+
"can't",
|
|
1421
|
+
"cannot",
|
|
1422
|
+
"couldn't",
|
|
1423
|
+
"mustn't",
|
|
1424
|
+
"and",
|
|
1425
|
+
"but",
|
|
1426
|
+
"if",
|
|
1427
|
+
"or",
|
|
1428
|
+
"because",
|
|
1429
|
+
"as",
|
|
1430
|
+
"until",
|
|
1431
|
+
"while",
|
|
1432
|
+
"of",
|
|
1433
|
+
"at",
|
|
1434
|
+
"by",
|
|
1435
|
+
"for",
|
|
1436
|
+
"with",
|
|
1437
|
+
"about",
|
|
1438
|
+
"against",
|
|
1439
|
+
"between",
|
|
1440
|
+
"into",
|
|
1441
|
+
"through",
|
|
1442
|
+
"during",
|
|
1443
|
+
"before",
|
|
1444
|
+
"after",
|
|
1445
|
+
"above",
|
|
1446
|
+
"below",
|
|
1447
|
+
"to",
|
|
1448
|
+
"from",
|
|
1449
|
+
"up",
|
|
1450
|
+
"down",
|
|
1451
|
+
"in",
|
|
1452
|
+
"out",
|
|
1453
|
+
"on",
|
|
1454
|
+
"off",
|
|
1455
|
+
"over",
|
|
1456
|
+
"under",
|
|
1457
|
+
"again",
|
|
1458
|
+
"further",
|
|
1459
|
+
"then",
|
|
1460
|
+
"once",
|
|
1461
|
+
"here",
|
|
1462
|
+
"there",
|
|
1463
|
+
"when",
|
|
1464
|
+
"where",
|
|
1465
|
+
"why",
|
|
1466
|
+
"how",
|
|
1467
|
+
"all",
|
|
1468
|
+
"any",
|
|
1469
|
+
"both",
|
|
1470
|
+
"each",
|
|
1471
|
+
"few",
|
|
1472
|
+
"more",
|
|
1473
|
+
"most",
|
|
1474
|
+
"other",
|
|
1475
|
+
"some",
|
|
1476
|
+
"such",
|
|
1477
|
+
"no",
|
|
1478
|
+
"nor",
|
|
1479
|
+
"not",
|
|
1480
|
+
"only",
|
|
1481
|
+
"own",
|
|
1482
|
+
"same",
|
|
1483
|
+
"so",
|
|
1484
|
+
"than",
|
|
1485
|
+
"too",
|
|
1486
|
+
"very"
|
|
1487
|
+
]);
|
|
1488
|
+
var english = {
|
|
1489
|
+
name: "english",
|
|
1490
|
+
revision: "ebae3448ae674b59",
|
|
1491
|
+
stemmer: stem,
|
|
1492
|
+
stopWords,
|
|
1493
|
+
tokenizer: {
|
|
1494
|
+
splitPattern: /[^\p{L}\p{M}\p{N}_']+/u,
|
|
1495
|
+
stripPossessive: true
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
// src/languages/registry.ts
|
|
1500
|
+
var languages = /* @__PURE__ */ new Map();
|
|
1501
|
+
languages.set("english", english);
|
|
1502
|
+
function registerLanguage(module) {
|
|
1503
|
+
languages.set(module.name, module);
|
|
1504
|
+
}
|
|
1505
|
+
function getLanguage(name) {
|
|
1506
|
+
const lang = languages.get(name);
|
|
1507
|
+
if (!lang) {
|
|
1508
|
+
throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
|
|
1509
|
+
}
|
|
1510
|
+
return lang;
|
|
1511
|
+
}
|
|
1512
|
+
function hasLanguage(name) {
|
|
1513
|
+
return languages.has(name);
|
|
1514
|
+
}
|
|
1515
|
+
var INTEGER_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH };
|
|
1516
|
+
var FLOAT_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH, forceIntegerToFloat: true };
|
|
1517
|
+
var integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
1518
|
+
var floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
1519
|
+
function encodeExactly(document, forceIntegerToFloat) {
|
|
1520
|
+
const bytes = (forceIntegerToFloat ? floatEncoder : integerEncoder).encode(document);
|
|
1521
|
+
if (bytes.byteLength > DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES) {
|
|
1522
|
+
if (forceIntegerToFloat) floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
1523
|
+
else integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
1524
|
+
}
|
|
1525
|
+
return bytes;
|
|
1526
|
+
}
|
|
1527
|
+
function holdsNegativeZero(value, depth) {
|
|
1528
|
+
if (typeof value === "number") return Object.is(value, -0);
|
|
1529
|
+
if (value === null || typeof value !== "object" || ArrayBuffer.isView(value) || depth > MAX_DOCUMENT_ENCODING_DEPTH) {
|
|
1530
|
+
return false;
|
|
1531
|
+
}
|
|
1532
|
+
for (const child of Array.isArray(value) ? value : Object.values(value)) {
|
|
1533
|
+
if (holdsNegativeZero(child, depth + 1)) return true;
|
|
1534
|
+
}
|
|
1535
|
+
return false;
|
|
1536
|
+
}
|
|
1537
|
+
function encodeDocument(document) {
|
|
1538
|
+
try {
|
|
1539
|
+
return encodeExactly(document, holdsNegativeZero(document, 1));
|
|
1540
|
+
} catch (error) {
|
|
1541
|
+
throw new NarsilError(
|
|
1542
|
+
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
1543
|
+
`The document cannot be encoded as MessagePack: ${error instanceof Error ? error.message : String(error)}`
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
// src/serialization/header.ts
|
|
1549
|
+
var MAGIC_BYTES = new Uint8Array([78, 82, 83, 76]);
|
|
1550
|
+
var HEADER_SIZE = 32;
|
|
1551
|
+
var MAX_PAYLOAD_LENGTH = 4294967295;
|
|
1552
|
+
var COMPRESSION_ALGORITHMS = {
|
|
1553
|
+
0: "none",
|
|
1554
|
+
1: "gzip",
|
|
1555
|
+
2: "lz4",
|
|
1556
|
+
3: "zstd"
|
|
1557
|
+
};
|
|
1558
|
+
var COMPRESSION_TO_BITS = {
|
|
1559
|
+
none: 0,
|
|
1560
|
+
gzip: 1,
|
|
1561
|
+
lz4: 2,
|
|
1562
|
+
zstd: 3
|
|
1563
|
+
};
|
|
1564
|
+
function encodeFlags(flags) {
|
|
1565
|
+
let bits = 0;
|
|
1566
|
+
if (flags.compressionEnabled) bits |= 1;
|
|
1567
|
+
bits |= (COMPRESSION_TO_BITS[flags.compressionAlgorithm] & 3) << 1;
|
|
1568
|
+
if (flags.checksumPresent) bits |= 1 << 3;
|
|
1569
|
+
if (flags.encryptionEnabled) bits |= 1 << 4;
|
|
1570
|
+
return bits;
|
|
1571
|
+
}
|
|
1572
|
+
function decodeFlags(value) {
|
|
1573
|
+
const compressionEnabled = (value & 1) === 1;
|
|
1574
|
+
const algorithmBits = value >> 1 & 3;
|
|
1575
|
+
const checksumPresent = (value >> 3 & 1) === 1;
|
|
1576
|
+
const encryptionEnabled = (value >> 4 & 1) === 1;
|
|
1577
|
+
return {
|
|
1578
|
+
compressionEnabled,
|
|
1579
|
+
compressionAlgorithm: COMPRESSION_ALGORITHMS[algorithmBits] ?? "none",
|
|
1580
|
+
checksumPresent,
|
|
1581
|
+
encryptionEnabled
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function writeHeader(header) {
|
|
1585
|
+
if (header.payloadLength > MAX_PAYLOAD_LENGTH) {
|
|
1586
|
+
throw new NarsilError(
|
|
1587
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
1588
|
+
`A payload of ${header.payloadLength} bytes exceeds the ${MAX_PAYLOAD_LENGTH} bytes the envelope header can describe`,
|
|
1589
|
+
{ payloadLength: header.payloadLength, maxPayloadLength: MAX_PAYLOAD_LENGTH }
|
|
1590
|
+
);
|
|
1591
|
+
}
|
|
1592
|
+
const buffer = new Uint8Array(HEADER_SIZE);
|
|
1593
|
+
const view = new DataView(buffer.buffer);
|
|
1594
|
+
buffer.set(MAGIC_BYTES, 0);
|
|
1595
|
+
buffer[4] = header.envelopeFormatVersion & 255;
|
|
1596
|
+
buffer[5] = header.engineVersionMajor & 255;
|
|
1597
|
+
buffer[6] = header.engineVersionMinor & 255;
|
|
1598
|
+
buffer[7] = header.engineVersionPatch & 255;
|
|
1599
|
+
view.setUint32(8, header.payloadLength, false);
|
|
1600
|
+
view.setUint16(12, encodeFlags(header.flags), false);
|
|
1601
|
+
view.setUint32(14, header.checksum, false);
|
|
1602
|
+
for (let i = 18; i < HEADER_SIZE; i++) {
|
|
1603
|
+
buffer[i] = 0;
|
|
1604
|
+
}
|
|
1605
|
+
return buffer;
|
|
1606
|
+
}
|
|
1607
|
+
function hasNrslMagic(data) {
|
|
1608
|
+
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];
|
|
1609
|
+
}
|
|
1610
|
+
function readHeader(data) {
|
|
1611
|
+
if (data.length < HEADER_SIZE) {
|
|
1612
|
+
throw new NarsilError(
|
|
1613
|
+
ErrorCodes.ENVELOPE_INVALID_MAGIC,
|
|
1614
|
+
`Expected at least ${HEADER_SIZE} bytes, received ${data.length}`
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
if (data[0] !== MAGIC_BYTES[0] || data[1] !== MAGIC_BYTES[1] || data[2] !== MAGIC_BYTES[2] || data[3] !== MAGIC_BYTES[3]) {
|
|
1618
|
+
throw new NarsilError(ErrorCodes.ENVELOPE_INVALID_MAGIC, "File does not begin with NRSL magic bytes");
|
|
1619
|
+
}
|
|
1620
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
1621
|
+
const envelopeFormatVersion = data[4];
|
|
1622
|
+
const engineVersionMajor = data[5];
|
|
1623
|
+
const engineVersionMinor = data[6];
|
|
1624
|
+
const engineVersionPatch = data[7];
|
|
1625
|
+
const payloadLength = view.getUint32(8, false);
|
|
1626
|
+
const flagBits = view.getUint16(12, false);
|
|
1627
|
+
const checksum = view.getUint32(14, false);
|
|
1628
|
+
const reserved = data.slice(18, HEADER_SIZE);
|
|
1629
|
+
return {
|
|
1630
|
+
magic: "NRSL",
|
|
1631
|
+
envelopeFormatVersion,
|
|
1632
|
+
engineVersionMajor,
|
|
1633
|
+
engineVersionMinor,
|
|
1634
|
+
engineVersionPatch,
|
|
1635
|
+
payloadLength,
|
|
1636
|
+
flags: decodeFlags(flagBits),
|
|
1637
|
+
checksum,
|
|
1638
|
+
reserved
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
// src/serialization/crc32.ts
|
|
1643
|
+
var IEEE_POLYNOMIAL = 3988292384;
|
|
1644
|
+
var ALL_BITS = 4294967295;
|
|
1645
|
+
var cachedTable = null;
|
|
1646
|
+
function buildTable() {
|
|
1647
|
+
const table = new Uint32Array(256);
|
|
1648
|
+
for (let i = 0; i < 256; i++) {
|
|
1649
|
+
let crc = i;
|
|
1650
|
+
for (let bit = 0; bit < 8; bit++) {
|
|
1651
|
+
crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
|
|
1652
|
+
}
|
|
1653
|
+
table[i] = crc;
|
|
1654
|
+
}
|
|
1655
|
+
return table;
|
|
1656
|
+
}
|
|
1657
|
+
function getTable() {
|
|
1658
|
+
if (cachedTable === null) {
|
|
1659
|
+
cachedTable = buildTable();
|
|
1660
|
+
}
|
|
1661
|
+
return cachedTable;
|
|
1662
|
+
}
|
|
1663
|
+
function crc32(data) {
|
|
1664
|
+
return crc32Final(crc32Update(crc32Init(), data));
|
|
1665
|
+
}
|
|
1666
|
+
function crc32Init() {
|
|
1667
|
+
return ALL_BITS;
|
|
1668
|
+
}
|
|
1669
|
+
function crc32Update(state, data) {
|
|
1670
|
+
const table = getTable();
|
|
1671
|
+
let crc = state;
|
|
1672
|
+
for (let i = 0; i < data.length; i++) {
|
|
1673
|
+
crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
|
|
1674
|
+
}
|
|
1675
|
+
return crc;
|
|
1676
|
+
}
|
|
1677
|
+
function crc32Final(state) {
|
|
1678
|
+
return (state ^ ALL_BITS) >>> 0;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
// src/serialization/chunk-checksum.ts
|
|
1682
|
+
function yieldToEventLoop() {
|
|
1683
|
+
if (typeof setImmediate === "function") {
|
|
1684
|
+
return new Promise((resolve) => setImmediate(resolve));
|
|
1685
|
+
}
|
|
1686
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
1687
|
+
}
|
|
1688
|
+
async function advanceChecksum(start, payload) {
|
|
1689
|
+
let state = start;
|
|
1690
|
+
for (let offset = 0; offset < payload.length; offset += CHECKSUM_YIELD_CHUNK_BYTES) {
|
|
1691
|
+
const end = Math.min(offset + CHECKSUM_YIELD_CHUNK_BYTES, payload.length);
|
|
1692
|
+
state = crc32Update(state, payload.subarray(offset, end));
|
|
1693
|
+
if (end < payload.length) {
|
|
1694
|
+
await yieldToEventLoop();
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return state;
|
|
1698
|
+
}
|
|
1699
|
+
async function checksumOfChunks(chunks) {
|
|
1700
|
+
let state = crc32Init();
|
|
1701
|
+
for (const chunk of chunks) state = await advanceChecksum(state, chunk);
|
|
1702
|
+
return crc32Final(state);
|
|
1703
|
+
}
|
|
1704
|
+
function payloadByteLength(chunks) {
|
|
1705
|
+
let total = 0;
|
|
1706
|
+
for (const chunk of chunks) total += chunk.byteLength;
|
|
1707
|
+
return total;
|
|
1708
|
+
}
|
|
1709
|
+
function requireWithinFileLimit(byteLength, what) {
|
|
1710
|
+
if (byteLength <= MAX_FILE_BYTES) return;
|
|
1711
|
+
throw new NarsilError(
|
|
1712
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
1713
|
+
`The ${what} would take ${byteLength} bytes, above the file size limit of ${MAX_FILE_BYTES}`,
|
|
1714
|
+
{ bytes: byteLength, maximum: MAX_FILE_BYTES }
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
function packEnvelopeWithEngineVersion(payloadChunks, envelopeFormatVersion, what, checksum, engineVersion) {
|
|
1718
|
+
const payloadLength = payloadByteLength(payloadChunks);
|
|
1719
|
+
requireWithinFileLimit(HEADER_SIZE + payloadLength, what);
|
|
1720
|
+
const [major, minor, patch] = engineVersion;
|
|
1721
|
+
const header = writeHeader({
|
|
1722
|
+
envelopeFormatVersion,
|
|
1723
|
+
engineVersionMajor: major,
|
|
1724
|
+
engineVersionMinor: minor,
|
|
1725
|
+
engineVersionPatch: patch,
|
|
1726
|
+
payloadLength,
|
|
1727
|
+
flags: { compressionEnabled: false, compressionAlgorithm: "none", checksumPresent: true, encryptionEnabled: false },
|
|
1728
|
+
checksum});
|
|
1729
|
+
return { chunks: [header, ...payloadChunks], byteLength: HEADER_SIZE + payloadLength, checksum };
|
|
1730
|
+
}
|
|
1731
|
+
function loadFailed(message, details) {
|
|
1732
|
+
throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, message, details);
|
|
1733
|
+
}
|
|
1734
|
+
async function gunzipWithinLimit(compressed, what) {
|
|
1735
|
+
const { gunzip } = await import('./gzip-5S7ROJFJ.mjs');
|
|
1736
|
+
try {
|
|
1737
|
+
return await gunzip(compressed, MAX_FILE_BYTES);
|
|
1738
|
+
} catch (error) {
|
|
1739
|
+
if (error?.code === "EFBIG") {
|
|
1740
|
+
loadFailed(`The ${what} inflates past the file size limit of ${MAX_FILE_BYTES} bytes`);
|
|
1741
|
+
}
|
|
1742
|
+
loadFailed(`The ${what} holds a gzip payload that fails to inflate`, {
|
|
1743
|
+
cause: error instanceof Error ? error.message : String(error)
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
async function openChecksummedEnvelope(data, expected) {
|
|
1748
|
+
const { envelopeFormatVersion, what } = expected;
|
|
1749
|
+
const header = readHeader(data);
|
|
1750
|
+
if (header.envelopeFormatVersion !== envelopeFormatVersion) {
|
|
1751
|
+
throw new NarsilError(
|
|
1752
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
1753
|
+
`The ${what} holds envelope format v${header.envelopeFormatVersion}, while this build reads it as v${envelopeFormatVersion}`,
|
|
1754
|
+
{ version: header.envelopeFormatVersion, expected: envelopeFormatVersion }
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
if (header.flags.encryptionEnabled) {
|
|
1758
|
+
throw new NarsilError(
|
|
1759
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
1760
|
+
`The ${what} is encrypted, which this build cannot read`
|
|
1761
|
+
);
|
|
1762
|
+
}
|
|
1763
|
+
if (header.flags.compressionEnabled && !expected.allowsCompression) {
|
|
1764
|
+
loadFailed(`The ${what} is compressed, while its format stores it raw`);
|
|
1765
|
+
}
|
|
1766
|
+
if (header.flags.compressionEnabled && header.flags.compressionAlgorithm !== "gzip") {
|
|
1767
|
+
throw new NarsilError(
|
|
1768
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
1769
|
+
`The ${what} uses ${header.flags.compressionAlgorithm} compression, which this build cannot read`
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
if (!header.flags.checksumPresent) loadFailed(`The ${what} carries no checksum, while its format requires one`);
|
|
1773
|
+
if (data.byteLength !== HEADER_SIZE + header.payloadLength) {
|
|
1774
|
+
loadFailed(
|
|
1775
|
+
`The ${what} holds ${data.byteLength} bytes where its header gives ${HEADER_SIZE + header.payloadLength}`,
|
|
1776
|
+
{ bytes: data.byteLength, expected: HEADER_SIZE + header.payloadLength }
|
|
1777
|
+
);
|
|
1778
|
+
}
|
|
1779
|
+
const payload = data.subarray(HEADER_SIZE);
|
|
1780
|
+
const computed = await checksumOfChunks([payload]);
|
|
1781
|
+
if (computed !== header.checksum) {
|
|
1782
|
+
throw new NarsilError(
|
|
1783
|
+
ErrorCodes.PERSISTENCE_CRC_MISMATCH,
|
|
1784
|
+
`The checksum of the ${what} does not match its payload`,
|
|
1785
|
+
{
|
|
1786
|
+
expected: header.checksum,
|
|
1787
|
+
computed
|
|
1788
|
+
}
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1791
|
+
if (header.flags.compressionEnabled) return { header, payload: await gunzipWithinLimit(payload, what) };
|
|
1792
|
+
return { header, payload };
|
|
1793
|
+
}
|
|
1794
|
+
var INDEX_CONFIGURATION_ENVELOPE_VERSION = 5;
|
|
1795
|
+
function requireConfigurationShape(raw, what) {
|
|
1796
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1797
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} does not hold an index configuration`);
|
|
1798
|
+
}
|
|
1799
|
+
const configuration = raw;
|
|
1800
|
+
if (configuration.schema === null || typeof configuration.schema !== "object") {
|
|
1801
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no schema`);
|
|
1802
|
+
}
|
|
1803
|
+
if (typeof configuration.language !== "string" || configuration.language.length === 0) {
|
|
1804
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no language`);
|
|
1805
|
+
}
|
|
1806
|
+
return configuration;
|
|
1807
|
+
}
|
|
1808
|
+
async function decodeIndexConfiguration(bytes) {
|
|
1809
|
+
const { payload } = await openChecksummedEnvelope(bytes, {
|
|
1810
|
+
envelopeFormatVersion: INDEX_CONFIGURATION_ENVELOPE_VERSION,
|
|
1811
|
+
what: "index configuration",
|
|
1812
|
+
allowsCompression: true
|
|
1813
|
+
});
|
|
1814
|
+
let raw;
|
|
1815
|
+
try {
|
|
1816
|
+
raw = decode(payload);
|
|
1817
|
+
} catch {
|
|
1818
|
+
throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, "The index configuration is not MessagePack");
|
|
1819
|
+
}
|
|
1820
|
+
return requireConfigurationShape(raw, "index configuration");
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
// src/runtime/heap-statistics.browser.ts
|
|
1824
|
+
function readHeapStatistics() {
|
|
1825
|
+
return null;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
export { DEFAULT_PATTERN_VALUE_LIMIT, HEADER_SIZE, INDEX_CONFIGURATION_ENVELOPE_VERSION, MAX_DOCUMENT_BYTES, MAX_DOCUMENT_NESTING_DEPTH, MAX_NESTING_DEPTH, MAX_PATTERN_VALUE_LIMIT, MIN_PATTERN_VALUE_LIMIT, PROTOTYPE_POLLUTION_KEYS, VECTOR_PATTERN, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, decodeIndexConfiguration, encodeDocument, extractVectorFieldsFromSchema, flattenSchema, getLanguage, getStopWords, getTokenizer, hasLanguage, hasNrslMagic, hasStopWords, hasTokenizer, isGeopointOrVectorType, isListBase, isPlainObject, isSingleStringFieldType, isStringValuedBase, isWordIndexedBase, isWordIndexedFieldType, openChecksummedEnvelope, packEnvelopeWithEngineVersion, parseFieldType, parsedTypeOf, partialFieldsOf, payloadByteLength, readHeader, readHeapStatistics, registerLanguage, registerStopWords, registerTokenizer, requireConfigurationShape, requireCreatableSchema, requireValidFieldTypes, requireWithinFileLimit, resolveIndexAnalysis, schemaFieldsOf, validateSchema, withSortableOption, writeHeader };
|