@delali/narsil 0.3.1-next.156 → 0.3.1-next.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/filesystem.mjs +3 -3
- package/dist/adapters/gcs.mjs +3 -3
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +3 -3
- package/dist/browser/{chunk-3V7DNNZL.mjs → chunk-4RNSFVWI.mjs} +20997 -19899
- package/dist/browser/chunk-MMHIIL5B.mjs +564 -0
- package/dist/browser/chunk-MZHQ65VI.mjs +1228 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/{chunk-VLJQW4J6.mjs → core-leaf-TJAGWPZZ.mjs} +4674 -3102
- package/dist/browser/{durability-config-TIYKW6XX.mjs → durability-config-SGB5ZP5K.mjs} +8 -3
- package/dist/browser/embed-RF2MPGAO.mjs +222 -0
- package/dist/{geo-index-MRH5JMIR.mjs → browser/geo-index-GNHY4PUB.mjs} +190 -93
- package/dist/{react-native/chunks/module-TTEVPRCW.mjs → browser/module-362VSIGR.mjs} +1570 -275
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-WMZX4OEC.mjs +3196 -0
- package/dist/browser/phrase-module-22TKMXWI.mjs +616 -0
- package/dist/browser/resolve-vector-text-KI65IHMD.mjs +60 -0
- package/dist/{react-native/chunks/restore-hooks-IBGIY3DR.mjs → browser/restore-queue-S4BWOGMU.mjs} +98 -36
- package/dist/{react-native/chunks/runtime-R5E3TB3J.mjs → browser/runtime-NU6VOVH2.mjs} +61 -25
- package/dist/browser/segment-codec-leaf-A427QJUX.mjs +554 -0
- package/dist/browser/segment-merge-leaf-7BZ54JPI.mjs +1636 -0
- package/dist/browser/storage-leaf-X6CNRHJS.mjs +18221 -0
- package/dist/browser/store-leaf-AEMTAVHX.mjs +2069 -0
- package/dist/browser/{chunk-SSTPBZZX.mjs → suggestions-leaf-3Y6MR6OF.mjs} +441 -119
- package/dist/browser/worker-copies-WQCPP3TS.mjs +2750 -0
- package/dist/{capabilities-Da4ywVVl.d.ts → capabilities-BKDrry0z.d.ts} +2 -2
- package/dist/chunk-2JRERUNZ.mjs +217 -0
- package/dist/chunk-2RIS76RJ.mjs +212 -0
- package/dist/chunk-3B775F3C.mjs +252 -0
- package/dist/{chunk-K5QFDYST.mjs → chunk-3D6RZGJH.mjs} +3 -3
- package/dist/{chunk-INJYO3BU.mjs → chunk-4CAMH7FO.mjs} +1 -1
- package/dist/{chunk-U476IXKQ.mjs → chunk-4PY4JYMY.mjs} +2 -1
- package/dist/chunk-6EZW2GQL.mjs +978 -0
- package/dist/chunk-75UNINFA.mjs +271 -0
- package/dist/chunk-77AUVDQ5.mjs +7 -0
- package/dist/{browser/chunk-23XRXIBW.mjs → chunk-7MWYORQC.mjs} +10 -3
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-XIHUI4KB.mjs → chunk-AB27FWZM.mjs} +8 -3
- package/dist/{chunk-XAXKV65G.mjs → chunk-BXM7XM4G.mjs} +7 -3
- package/dist/{chunk-HJJI72X7.mjs → chunk-C7YQHCSO.mjs} +1 -1
- package/dist/{chunk-RVGRFOGN.mjs → chunk-D456ZFPQ.mjs} +2 -1
- package/dist/{chunk-KKQC526K.mjs → chunk-E2F6LZR3.mjs} +19 -21
- package/dist/{chunk-I2KPOLOZ.mjs → chunk-FE3MRIBN.mjs} +104 -13
- package/dist/{chunk-KYYABCSW.mjs → chunk-FETZYCH7.mjs} +15 -1
- package/dist/{chunk-ZKP7G7TV.mjs → chunk-FVZ5DB6Y.mjs} +3 -2
- package/dist/{chunk-2UV4QBHW.mjs → chunk-GF4K7IUK.mjs} +317 -120
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/{chunk-25KDNIZZ.mjs → chunk-H64YDF5M.mjs} +3 -3
- package/dist/{browser/chunk-CRE3G7F3.mjs → chunk-HOOR4CP5.mjs} +63 -7
- package/dist/chunk-IB4BYLE3.mjs +127 -0
- package/dist/{chunk-3C7MTCCI.mjs → chunk-IE3Q62QD.mjs} +2 -2
- package/dist/chunk-IH3G6SJO.mjs +40 -0
- package/dist/chunk-JV74RKCY.mjs +3041 -0
- package/dist/{chunk-FRBFVQFN.mjs → chunk-K67I3RF4.mjs} +261 -101
- package/dist/chunk-KLVMK3R5.mjs +47 -0
- package/dist/{chunk-5VV4R6P7.mjs → chunk-LAWIJRMJ.mjs} +4154 -2577
- package/dist/chunk-LF4GB4PO.mjs +281 -0
- package/dist/chunk-NC4QLCZC.mjs +59 -0
- package/dist/chunk-OOO54OVC.mjs +627 -0
- package/dist/chunk-OUWZKNO3.mjs +207 -0
- package/dist/{chunk-FJKKCV4D.mjs → chunk-P5YLI5ED.mjs} +343 -182
- package/dist/{chunk-6I6AYAXS.mjs → chunk-PTTMGRG5.mjs} +9 -10
- package/dist/{browser/chunk-SRMZXJSL.mjs → chunk-Q3ZZH5Z7.mjs} +6 -0
- package/dist/chunk-QBVTYY4J.mjs +54 -0
- package/dist/{react-native/chunks/chunk-GXX3DQXP.mjs → chunk-R4CE4IVU.mjs} +352 -165
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/{chunk-KJ3RTZDJ.mjs → chunk-S3BSDBF7.mjs} +10 -3
- package/dist/{chunk-FAKFUDZZ.mjs → chunk-SHGN3QIF.mjs} +80 -13
- package/dist/chunk-SXIRM4MX.mjs +3549 -0
- package/dist/{react-native/chunks/chunk-EJ33LCHV.mjs → chunk-TGPKS2UM.mjs} +47 -1
- package/dist/chunk-TINW4BSH.mjs +31301 -0
- package/dist/{cold-module-6MO2XJF2.mjs → chunk-TSLV5P2J.mjs} +397 -79
- package/dist/{chunk-HHBUCIUY.mjs → chunk-TW543F33.mjs} +3 -3
- package/dist/chunk-U6B7DUQW.mjs +788 -0
- package/dist/{chunk-FYOVBEMM.mjs → chunk-V3SGPXWQ.mjs} +8 -9
- package/dist/chunk-W34VJXY7.mjs +4723 -0
- package/dist/chunk-YETKPX5M.mjs +5 -0
- package/dist/chunk-ZQ6QY42L.mjs +59 -0
- package/dist/{client-DRv7UVeY.d.ts → client-CTp8RRiK.d.ts} +16 -4
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +70 -18
- package/dist/{config-DMwffLKn.d.ts → config-PCNzWjHL.d.ts} +6 -3
- package/dist/{config-CoSig5Ox.d.ts → config-_WT5grSL.d.ts} +3 -3
- package/dist/core-leaf-KXFGP74A.mjs +7 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-MKTZBR26.mjs +16 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +7 -4
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +1 -2
- package/dist/distribution/transport/grpc.mjs +7 -2
- package/dist/distribution/transport/tcp.mjs +7 -1
- package/dist/distribution.d.ts +7 -7
- package/dist/distribution.mjs +1192 -1077
- package/dist/{react-native/chunks/durability-config-QXVZEO7T.mjs → durability-config-XV4XR7Y4.mjs} +7 -3
- package/dist/embed-4H7RTBVL.mjs +221 -0
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CFxPYqEk.d.ts → engine-DBRVR_d-.d.ts} +1252 -1239
- package/dist/{browser/geo-index-HHWGMNIS.mjs → geo-index-2ZMMWWSK.mjs} +190 -92
- package/dist/{index-C4AmUnl1.d.ts → index-Ck9w5WHz.d.ts} +1 -1
- package/dist/index.browser.mjs +4 -15
- package/dist/index.d.ts +1495 -78
- package/dist/index.mjs +14 -50
- package/dist/index.react-native.mjs +11 -28
- package/dist/invalidation/filesystem.mjs +1 -2
- package/dist/languages/albanian.mjs +1 -1
- package/dist/languages/amharic.mjs +1 -1
- package/dist/languages/arabic.mjs +1 -1
- package/dist/languages/armenian.mjs +1 -1
- package/dist/languages/azerbaijani.mjs +1 -1
- package/dist/languages/bambara.mjs +1 -1
- package/dist/languages/basque.mjs +1 -1
- package/dist/languages/belarusian.mjs +1 -1
- package/dist/languages/bengali.mjs +1 -1
- package/dist/languages/bosnian.mjs +1 -1
- package/dist/languages/breton.mjs +1 -1
- package/dist/languages/bulgarian.mjs +1 -1
- package/dist/languages/burmese.mjs +1 -1
- package/dist/languages/catalan.mjs +1 -1
- package/dist/languages/chinese.mjs +1 -1
- package/dist/languages/croatian.mjs +1 -1
- package/dist/languages/czech.mjs +1 -1
- package/dist/languages/dagbani.mjs +1 -1
- package/dist/languages/danish.mjs +1 -1
- package/dist/languages/dutch.mjs +1 -1
- package/dist/languages/english.mjs +1 -1
- package/dist/languages/esperanto.mjs +1 -1
- package/dist/languages/estonian.mjs +1 -1
- package/dist/languages/ewe.mjs +1 -1
- package/dist/languages/faroese.mjs +1 -1
- package/dist/languages/fijian.mjs +1 -1
- package/dist/languages/finnish.mjs +1 -1
- package/dist/languages/french.mjs +1 -1
- package/dist/languages/ga.mjs +1 -1
- package/dist/languages/galician.mjs +1 -1
- package/dist/languages/georgian.mjs +1 -1
- package/dist/languages/german.mjs +1 -1
- package/dist/languages/greek.mjs +1 -1
- package/dist/languages/guarani.mjs +1 -1
- package/dist/languages/gujarati.mjs +1 -1
- package/dist/languages/haitian-creole.mjs +1 -1
- package/dist/languages/hausa.mjs +1 -1
- package/dist/languages/hawaiian.mjs +1 -1
- package/dist/languages/hebrew.mjs +1 -1
- package/dist/languages/hindi.mjs +1 -1
- package/dist/languages/hungarian.mjs +1 -1
- package/dist/languages/icelandic.mjs +1 -1
- package/dist/languages/igbo.mjs +1 -1
- package/dist/languages/indonesian.mjs +1 -1
- package/dist/languages/irish.mjs +1 -1
- package/dist/languages/italian.mjs +1 -1
- package/dist/languages/japanese.mjs +1 -1
- package/dist/languages/kannada.mjs +1 -1
- package/dist/languages/kazakh.mjs +1 -1
- package/dist/languages/khmer.mjs +1 -1
- package/dist/languages/kinyarwanda.mjs +1 -1
- package/dist/languages/kirundi.mjs +1 -1
- package/dist/languages/korean.mjs +1 -1
- package/dist/languages/kurmanji.mjs +1 -1
- package/dist/languages/kyrgyz.mjs +1 -1
- package/dist/languages/lao.mjs +1 -1
- package/dist/languages/latin.mjs +1 -1
- package/dist/languages/latvian.mjs +1 -1
- package/dist/languages/lingala.mjs +1 -1
- package/dist/languages/lithuanian.mjs +1 -1
- package/dist/languages/luxembourgish.mjs +1 -1
- package/dist/languages/macedonian.mjs +1 -1
- package/dist/languages/malagasy.mjs +1 -1
- package/dist/languages/malay.mjs +1 -1
- package/dist/languages/malayalam.mjs +1 -1
- package/dist/languages/maltese.mjs +1 -1
- package/dist/languages/maori.mjs +1 -1
- package/dist/languages/marathi.mjs +1 -1
- package/dist/languages/nepali.mjs +1 -1
- package/dist/languages/norwegian.mjs +1 -1
- package/dist/languages/oromo.mjs +1 -1
- package/dist/languages/persian.mjs +1 -1
- package/dist/languages/polish.mjs +1 -1
- package/dist/languages/portuguese.mjs +1 -1
- package/dist/languages/punjabi.mjs +1 -1
- package/dist/languages/romanian.mjs +1 -1
- package/dist/languages/russian.mjs +1 -1
- package/dist/languages/samoan.mjs +1 -1
- package/dist/languages/sanskrit.mjs +1 -1
- package/dist/languages/scottish-gaelic.mjs +1 -1
- package/dist/languages/serbian.mjs +1 -1
- package/dist/languages/shona.mjs +1 -1
- package/dist/languages/sinhala.mjs +1 -1
- package/dist/languages/slovak.mjs +1 -1
- package/dist/languages/slovenian.mjs +1 -1
- package/dist/languages/sorani.mjs +1 -1
- package/dist/languages/spanish.mjs +1 -1
- package/dist/languages/swahili.mjs +1 -1
- package/dist/languages/swedish.mjs +1 -1
- package/dist/languages/tagalog.mjs +1 -1
- package/dist/languages/tamil.mjs +1 -1
- package/dist/languages/tatar.mjs +1 -1
- package/dist/languages/telugu.mjs +1 -1
- package/dist/languages/thai.mjs +1 -1
- package/dist/languages/tibetan.mjs +1 -1
- package/dist/languages/tigrinya.mjs +1 -1
- package/dist/languages/tongan.mjs +1 -1
- package/dist/languages/turkish.mjs +1 -1
- package/dist/languages/twi.mjs +1 -1
- package/dist/languages/ukrainian.mjs +1 -1
- package/dist/languages/urdu.mjs +1 -1
- package/dist/languages/vietnamese.mjs +1 -1
- package/dist/languages/welsh.mjs +1 -1
- package/dist/languages/wolof.mjs +1 -1
- package/dist/languages/xhosa.mjs +1 -1
- package/dist/languages/yoruba.mjs +1 -1
- package/dist/languages/zulu.mjs +1 -1
- package/dist/{long-query-thread-YA4IAYSY.mjs → long-query-thread-JMGNGF6V.mjs} +74 -58
- package/dist/{module-N55W4Q5C.mjs → module-ZJ6ARG6V.mjs} +444 -111
- package/dist/msgpack-leaf-5WFRP6JM.mjs +9 -0
- package/dist/optional-reads-BR3BOVZW.mjs +3373 -0
- package/dist/optional-writes-DDFHYUOH.mjs +218 -0
- package/dist/{paged-partition-archive-PXW5XAYU.mjs → paged-partition-archive-G576XGVE.mjs} +29 -69
- package/dist/partial-words.browser.mjs +1649 -0
- package/dist/partial-words.mjs +15 -14
- package/dist/{chunk-CITFCZKF.mjs → pattern.browser.mjs} +153 -186
- package/dist/pattern.mjs +6 -8
- package/dist/persistence/durability/checkpoint-worker.d.ts +32 -24
- package/dist/persistence/durability/checkpoint-worker.mjs +27 -58
- package/dist/phrase-module-XK3T44VU.mjs +634 -0
- package/dist/query-actions-OMXJEC2J.mjs +118 -0
- package/dist/query-suggestions/merge-worker.mjs +18 -54
- package/dist/query-suggestions.browser.mjs +26 -226
- package/dist/query-suggestions.d.ts +2 -2
- package/dist/query-suggestions.mjs +16 -67
- package/dist/react-native/chunks/chunk-4EXKQ2IB.mjs +565 -0
- package/dist/react-native/chunks/chunk-52QD7CBJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-72OKYHZL.mjs +969 -0
- package/dist/react-native/chunks/chunk-AQOWRH2C.mjs +802 -0
- package/dist/react-native/chunks/chunk-FTQ7JNMU.mjs +898 -0
- package/dist/react-native/chunks/chunk-G3CUQ333.mjs +42 -0
- package/dist/{chunk-TBC3XUL2.mjs → react-native/chunks/chunk-HRDMIQ63.mjs} +53 -1
- package/dist/react-native/chunks/{chunk-KV46CT4D.mjs → chunk-IY6U6HRA.mjs} +63 -7
- package/dist/react-native/chunks/chunk-J2NQW353.mjs +212 -0
- package/dist/react-native/chunks/chunk-L4R5ITVG.mjs +29047 -0
- package/dist/react-native/chunks/chunk-OK3WUA6N.mjs +54 -0
- package/dist/react-native/chunks/{chunk-MVXELMJX.mjs → chunk-PVMEHBQO.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-DZ7H7D2C.mjs → chunk-TQ26BKBH.mjs} +6 -0
- package/dist/react-native/chunks/{chunk-6VBXNFLE.mjs → chunk-VUJCSQG5.mjs} +3 -1
- package/dist/react-native/chunks/{chunk-ENLMYKSX.mjs → chunk-XEGKQKLY.mjs} +5385 -3114
- package/dist/react-native/chunks/chunk-YOTP2FPE.mjs +232 -0
- package/dist/react-native/chunks/chunk-ZIU6TWXG.mjs +127 -0
- package/dist/react-native/chunks/core-leaf-5B4JXCVA.mjs +6 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/{durability-config-GE4U7MCZ.mjs → react-native/chunks/durability-config-3IOXIPYZ.mjs} +7 -3
- package/dist/react-native/chunks/embed-3WQ2CCR5.mjs +221 -0
- package/dist/react-native/chunks/{geo-index-PX3BIHAH.mjs → geo-index-QEYKEVPH.mjs} +190 -93
- package/dist/react-native/chunks/{chunk-CKNRFDTZ.mjs → gzip.react-native-DLO4WW27.mjs} +2 -1
- package/dist/{browser/module-TCT66FWA.mjs → react-native/chunks/module-VUA27HZZ.mjs} +1018 -540
- package/dist/react-native/chunks/msgpack-leaf-TR66ZVAX.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-WDTLLHUT.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-FZV3QW34.mjs +267 -0
- package/dist/react-native/chunks/phrase-module-KCQWVXYZ.mjs +635 -0
- package/dist/react-native/chunks/resolve-vector-text-LXRYXF7M.mjs +59 -0
- package/dist/react-native/chunks/restore-queue-EI2V2I4S.mjs +179 -0
- package/dist/{browser/runtime-OTAGEFQW.mjs → react-native/chunks/runtime-BUCSAK4U.mjs} +61 -25
- package/dist/react-native/chunks/segment-codec-leaf-6ULP7H3I.mjs +12 -0
- package/dist/react-native/chunks/segment-merge-leaf-F4GQZNK6.mjs +13 -0
- package/dist/react-native/chunks/storage-leaf-OAXBU2L6.mjs +18042 -0
- package/dist/react-native/chunks/store-leaf-GY2ZZFXB.mjs +14 -0
- package/dist/react-native/chunks/{chunk-UQ4OAXKU.mjs → suggestions-leaf-SQEZ4IBS.mjs} +332 -118
- package/dist/react-native/chunks/worker-copies-EEHSCFJW.mjs +2627 -0
- package/dist/react-native/partial-words.mjs +954 -35
- package/dist/react-native/pattern.mjs +238 -111
- package/dist/react-native/query-suggestions.mjs +33 -239
- package/dist/react-native/sync.mjs +127 -50
- package/dist/react-native/synonyms.mjs +256 -112
- package/dist/react.d.ts +9 -9
- package/dist/react.mjs +6 -0
- package/dist/{rerank-MQ37IYRV.mjs → rerank-Y6MWBMTT.mjs} +17 -8
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-4PDRTPNQ.mjs +2 -0
- package/dist/restore-queue-KPYSRJ4A.mjs +184 -0
- package/dist/runtime-4GKUIAKV.mjs +595 -0
- package/dist/{schema-Jwt928nJ.d.ts → schema-C_7yRJLt.d.ts} +1 -1
- package/dist/segment-codec-leaf-6IFBSBPN.mjs +17 -0
- package/dist/segment-merge-leaf-VE3FUSVE.mjs +17 -0
- package/dist/server.d.ts +35 -13
- package/dist/server.mjs +90 -101
- package/dist/{browser/durability-wiring-A7BVG2DW.mjs → storage-leaf-HMIIOUYN.mjs} +2348 -902
- package/dist/store-leaf-M7T7SUZJ.mjs +19 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-Q3Q5D6XV.mjs +53 -0
- package/dist/sync/filesystem.d.ts +3 -3
- package/dist/sync/filesystem.mjs +27 -11
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +3 -3
- package/dist/sync/indexeddb.mjs +7 -2
- package/dist/sync.browser.mjs +120 -70
- package/dist/sync.d.ts +4 -4
- package/dist/sync.mjs +121 -57
- package/dist/{chunk-I5B7RXU7.mjs → synonyms.browser.mjs} +248 -135
- package/dist/synonyms.mjs +15 -11
- package/dist/{tasks-qrJojgST.d.ts → tasks-B4tT4vmP.d.ts} +4 -4
- package/dist/thread-SNILJXX3.mjs +30 -0
- package/dist/{types-BZCGjfLn.d.ts → types-CTg0KaMy.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +7 -1
- package/dist/vector/search-worker.mjs +9 -13
- package/dist/worker-copies-ZLZS2CUM.mjs +2152 -0
- package/dist/workers/entry.mjs +60 -30
- package/openapi.json +137 -50
- package/package.json +233 -8
- package/dist/analysis-change-5BQOQ4BF.mjs +0 -55
- package/dist/analysis-change-entry-TXX6JSMX.mjs +0 -1
- package/dist/archive-history-E4R73RWD.mjs +0 -29
- package/dist/browser/analysis-change-435CUEPZ.mjs +0 -933
- package/dist/browser/analysis-change-entry-HZXKPPGV.mjs +0 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +0 -29
- package/dist/browser/chunk-2CFI5VVV.mjs +0 -241
- package/dist/browser/chunk-2TI4SSUP.mjs +0 -315
- package/dist/browser/chunk-3I27KXQD.mjs +0 -34
- package/dist/browser/chunk-3SSRJMFN.mjs +0 -100
- package/dist/browser/chunk-4NGKC4H4.mjs +0 -2635
- package/dist/browser/chunk-4RD3AFSB.mjs +0 -32
- package/dist/browser/chunk-5W3MMTLG.mjs +0 -19
- package/dist/browser/chunk-6LWDPLTB.mjs +0 -177
- package/dist/browser/chunk-7IGKGWSQ.mjs +0 -79
- package/dist/browser/chunk-7U3WVJUP.mjs +0 -150
- package/dist/browser/chunk-ATEBYXP6.mjs +0 -10
- package/dist/browser/chunk-BHFQATSC.mjs +0 -432
- package/dist/browser/chunk-DSXIBE6N.mjs +0 -78
- package/dist/browser/chunk-EA63E3D2.mjs +0 -857
- package/dist/browser/chunk-ELV4OZOI.mjs +0 -29
- package/dist/browser/chunk-EXQZGUQH.mjs +0 -193
- package/dist/browser/chunk-G64Q6OJF.mjs +0 -96
- package/dist/browser/chunk-GPPOG6PT.mjs +0 -9
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-IZXVW2ZJ.mjs +0 -217
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-K4Q6KX3R.mjs +0 -2528
- package/dist/browser/chunk-KZWSX6BH.mjs +0 -645
- package/dist/browser/chunk-MGI4BCXC.mjs +0 -63
- package/dist/browser/chunk-ML7THVLJ.mjs +0 -38
- package/dist/browser/chunk-MOG4OVDK.mjs +0 -51
- package/dist/browser/chunk-NLWTBAGB.mjs +0 -111
- package/dist/browser/chunk-NQAME3RK.mjs +0 -21
- package/dist/browser/chunk-NXQG7DRA.mjs +0 -318
- package/dist/browser/chunk-OEDCEZXJ.mjs +0 -92
- package/dist/browser/chunk-OIZS5KIX.mjs +0 -6
- package/dist/browser/chunk-RA6LSBCM.mjs +0 -43
- package/dist/browser/chunk-STOWQFT3.mjs +0 -1829
- package/dist/browser/chunk-TK63WFXK.mjs +0 -90
- package/dist/browser/chunk-TY7L6OXO.mjs +0 -69
- package/dist/browser/chunk-U3JOQGWX.mjs +0 -19
- package/dist/browser/chunk-U4YDIBUT.mjs +0 -653
- package/dist/browser/chunk-VI7BQR4U.mjs +0 -21
- package/dist/browser/chunk-WI4MR75E.mjs +0 -86
- package/dist/browser/chunk-WN464PTL.mjs +0 -375
- package/dist/browser/chunk-WXLBZJMT.mjs +0 -25
- package/dist/browser/chunk-XAWNZ4G2.mjs +0 -151
- package/dist/browser/chunk-ZI2V4VD7.mjs +0 -21
- package/dist/browser/cold-module-2EHCIV4K.mjs +0 -759
- package/dist/browser/engine-hooks-E4UD67JD.mjs +0 -17
- package/dist/browser/gzip-5S7ROJFJ.mjs +0 -1
- package/dist/browser/import-DXYB6756.mjs +0 -19
- package/dist/browser/methods-KTQCSIN4.mjs +0 -30
- package/dist/browser/module-NIYMEA5R.mjs +0 -23
- package/dist/browser/operations-OJ3BXS55.mjs +0 -5
- package/dist/browser/phrase-module-HAT3TLZN.mjs +0 -328
- package/dist/browser/pool-3JLET5RO.mjs +0 -297
- package/dist/browser/release-76MXRPGV.mjs +0 -33
- package/dist/browser/restore-hooks-YPN4ZFCY.mjs +0 -114
- package/dist/browser/restore-queue-G3RQGL3Y.mjs +0 -55
- package/dist/browser/retention-ZWVMNC3Q.mjs +0 -210
- package/dist/browser/snapshot-VEQNIE6C.mjs +0 -963
- package/dist/browser/start-BM442C6R.mjs +0 -25
- package/dist/browser/sync-state-P5XG6LTQ.mjs +0 -15
- package/dist/browser/write-2EVMZWDE.mjs +0 -194
- package/dist/chunk-2NE7VCYE.mjs +0 -212
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-3HYC4JRF.mjs +0 -50
- package/dist/chunk-3MXV3VHR.mjs +0 -46
- package/dist/chunk-3OH67G7R.mjs +0 -214
- package/dist/chunk-46KY2PJD.mjs +0 -905
- package/dist/chunk-4KKXNJM6.mjs +0 -242
- package/dist/chunk-5YNRKI2C.mjs +0 -81
- package/dist/chunk-6HTGOXIK.mjs +0 -875
- package/dist/chunk-6OEGXLBX.mjs +0 -57
- package/dist/chunk-6RC4K46J.mjs +0 -86
- package/dist/chunk-7GFE3PEY.mjs +0 -40
- package/dist/chunk-7GXJUJ24.mjs +0 -49
- package/dist/chunk-7LXHHCXZ.mjs +0 -1397
- package/dist/chunk-7V5IUP2T.mjs +0 -63
- package/dist/chunk-A4L7YTKX.mjs +0 -458
- package/dist/chunk-BEZH7VEH.mjs +0 -23
- package/dist/chunk-BTPGQC6Z.mjs +0 -27
- package/dist/chunk-BU4SAIC4.mjs +0 -196
- package/dist/chunk-BWZ3P4MU.mjs +0 -20
- package/dist/chunk-CSLGFPFQ.mjs +0 -218
- package/dist/chunk-CZQ33DLW.mjs +0 -78
- package/dist/chunk-DP5C7YFQ.mjs +0 -543
- package/dist/chunk-DWEPMFJE.mjs +0 -240
- package/dist/chunk-EEBCDP36.mjs +0 -32
- package/dist/chunk-EFBDHH5P.mjs +0 -7081
- package/dist/chunk-FB6463IN.mjs +0 -1499
- package/dist/chunk-FCJ553HS.mjs +0 -655
- package/dist/chunk-FNGAM5B7.mjs +0 -2639
- package/dist/chunk-FOCV4CBZ.mjs +0 -87
- package/dist/chunk-FQBFZAWG.mjs +0 -27
- package/dist/chunk-G6HRSGOU.mjs +0 -74
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-GH4WQ22V.mjs +0 -34
- package/dist/chunk-GQPTDQCL.mjs +0 -54
- package/dist/chunk-HFPMMRQT.mjs +0 -206
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-I53G4JAU.mjs +0 -1974
- package/dist/chunk-I54T6CQP.mjs +0 -117
- package/dist/chunk-IPN7S4KX.mjs +0 -130
- package/dist/chunk-J4IJTTEX.mjs +0 -226
- package/dist/chunk-JDJBQLRO.mjs +0 -1126
- package/dist/chunk-JWRUUCWD.mjs +0 -151
- package/dist/chunk-K4ZIGL2O.mjs +0 -290
- package/dist/chunk-KAKQ74LS.mjs +0 -53
- package/dist/chunk-KF4EXSM4.mjs +0 -21
- package/dist/chunk-KHKIRS5D.mjs +0 -113
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KP7TYHWT.mjs +0 -92
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-L6V6BST3.mjs +0 -1435
- package/dist/chunk-LHKOSI2J.mjs +0 -58
- package/dist/chunk-LQG5G2LY.mjs +0 -39
- package/dist/chunk-MATMVH65.mjs +0 -9
- package/dist/chunk-MP7ABPTD.mjs +0 -189
- package/dist/chunk-MQOJIO5B.mjs +0 -316
- package/dist/chunk-NF4DT3IH.mjs +0 -85
- package/dist/chunk-ORN5BLL7.mjs +0 -11
- package/dist/chunk-P5ZI2P2W.mjs +0 -7481
- package/dist/chunk-PELHVTO7.mjs +0 -24
- package/dist/chunk-PWC4VB3Q.mjs +0 -106
- package/dist/chunk-Q2UL2TPC.mjs +0 -21
- package/dist/chunk-QHPYS427.mjs +0 -66
- package/dist/chunk-QJVOLKU6.mjs +0 -111
- package/dist/chunk-QOW2JPUI.mjs +0 -634
- package/dist/chunk-QYRNLLLI.mjs +0 -99
- package/dist/chunk-RDXO6JST.mjs +0 -63
- package/dist/chunk-RFBLQLLZ.mjs +0 -16
- package/dist/chunk-RLOES5SX.mjs +0 -31
- package/dist/chunk-RZWWB2XR.mjs +0 -96
- package/dist/chunk-S5LN746F.mjs +0 -10
- package/dist/chunk-SA5LOGO3.mjs +0 -470
- package/dist/chunk-SQJWAIF4.mjs +0 -12
- package/dist/chunk-TDIK6NTV.mjs +0 -10
- package/dist/chunk-TGS5UXBE.mjs +0 -216
- package/dist/chunk-TQXHPFWT.mjs +0 -177
- package/dist/chunk-TZ3355VS.mjs +0 -121
- package/dist/chunk-TZTRKM33.mjs +0 -74
- package/dist/chunk-U55XJEIG.mjs +0 -18
- package/dist/chunk-UHICS3JI.mjs +0 -83
- package/dist/chunk-VD7J552I.mjs +0 -28
- package/dist/chunk-VTTRFF2C.mjs +0 -3711
- package/dist/chunk-WX4LAO6M.mjs +0 -656
- package/dist/chunk-WZ7YV54N.mjs +0 -152
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-XXHN7J46.mjs +0 -101
- package/dist/chunk-Y4WPNHMC.mjs +0 -50
- package/dist/chunk-YEKL4JBK.mjs +0 -96
- package/dist/chunk-YTWZVGCB.mjs +0 -382
- package/dist/chunk-Z2KAFCRT.mjs +0 -30
- package/dist/chunk-ZXNQEW43.mjs +0 -18
- package/dist/chunk-ZYAY26KG.mjs +0 -29
- package/dist/direct-executor-FTMYY3TI.mjs +0 -34
- package/dist/durability-wiring-VIF5MOSY.mjs +0 -4064
- package/dist/engine-hooks-EGUGNZYE.mjs +0 -54
- package/dist/gzip-F4HMIEEQ.mjs +0 -1
- package/dist/import-XKDPJQDP.mjs +0 -56
- package/dist/methods-7IOINERF.mjs +0 -30
- package/dist/module-FQ4JWNQJ.mjs +0 -62
- package/dist/operations-G5EP6JPX.mjs +0 -5
- package/dist/phrase-module-XW5MKWP5.mjs +0 -330
- package/dist/pool-Y4A46T36.mjs +0 -298
- package/dist/react-native/chunks/analysis-change-LT5QBQ3H.mjs +0 -926
- package/dist/react-native/chunks/analysis-change-entry-SCVWK6OU.mjs +0 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +0 -29
- package/dist/react-native/chunks/chunk-2PRHILX3.mjs +0 -529
- package/dist/react-native/chunks/chunk-3JWDECAZ.mjs +0 -858
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +0 -1
- package/dist/react-native/chunks/chunk-3WI35N75.mjs +0 -226
- package/dist/react-native/chunks/chunk-4DII3ZSM.mjs +0 -73
- package/dist/react-native/chunks/chunk-4J74WHQM.mjs +0 -177
- package/dist/react-native/chunks/chunk-4JYO3JD2.mjs +0 -242
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +0 -17
- package/dist/react-native/chunks/chunk-6WA3C3DV.mjs +0 -85
- package/dist/react-native/chunks/chunk-AAAETEJK.mjs +0 -27
- package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +0 -32
- package/dist/react-native/chunks/chunk-C5G6TJ7A.mjs +0 -140
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +0 -43
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +0 -10
- package/dist/react-native/chunks/chunk-DNXOMPAQ.mjs +0 -191
- package/dist/react-native/chunks/chunk-DVDX4SDR.mjs +0 -375
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +0 -12
- package/dist/react-native/chunks/chunk-F753DA54.mjs +0 -23
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +0 -40
- package/dist/react-native/chunks/chunk-FTZHMRD2.mjs +0 -18
- package/dist/react-native/chunks/chunk-G43IPIDG.mjs +0 -151
- package/dist/react-native/chunks/chunk-HJBJBH26.mjs +0 -34
- package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +0 -10
- package/dist/react-native/chunks/chunk-IYNT75CE.mjs +0 -111
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +0 -38
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +0 -15
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +0 -68
- package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +0 -93
- package/dist/react-native/chunks/chunk-LZSLNSUN.mjs +0 -193
- package/dist/react-native/chunks/chunk-MIP4SOR6.mjs +0 -22803
- package/dist/react-native/chunks/chunk-MJDQU5MW.mjs +0 -1225
- package/dist/react-native/chunks/chunk-MUWD2H2S.mjs +0 -21
- package/dist/react-native/chunks/chunk-NB3LP33V.mjs +0 -315
- package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +0 -8
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +0 -78
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +0 -29
- package/dist/react-native/chunks/chunk-PDRWWPKV.mjs +0 -2532
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +0 -79
- package/dist/react-native/chunks/chunk-POPDAGH6.mjs +0 -2636
- package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +0 -9
- package/dist/react-native/chunks/chunk-QUKQNI3H.mjs +0 -647
- package/dist/react-native/chunks/chunk-RDWG33MM.mjs +0 -79
- package/dist/react-native/chunks/chunk-SK2PWYDH.mjs +0 -654
- package/dist/react-native/chunks/chunk-SUPXRTMD.mjs +0 -96
- package/dist/react-native/chunks/chunk-TP6KCKER.mjs +0 -63
- package/dist/react-native/chunks/chunk-U4KSKA4Z.mjs +0 -23
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +0 -68
- package/dist/react-native/chunks/chunk-VWUDIOT6.mjs +0 -218
- package/dist/react-native/chunks/chunk-WBYQRHDY.mjs +0 -86
- package/dist/react-native/chunks/chunk-YH7QY657.mjs +0 -288
- package/dist/react-native/chunks/chunk-YZW4CHM6.mjs +0 -562
- package/dist/react-native/chunks/chunk-ZLWVW734.mjs +0 -100
- package/dist/react-native/chunks/chunk-ZXZFN7FI.mjs +0 -432
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +0 -92
- package/dist/react-native/chunks/cold-module-KVZYUGRY.mjs +0 -772
- package/dist/react-native/chunks/durability-wiring-34OYO32E.mjs +0 -4942
- package/dist/react-native/chunks/engine-hooks-M7JV46NH.mjs +0 -30
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +0 -3
- package/dist/react-native/chunks/import-H6AQREWI.mjs +0 -32
- package/dist/react-native/chunks/methods-6W5U4C3H.mjs +0 -30
- package/dist/react-native/chunks/module-LBZPGOWH.mjs +0 -36
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +0 -5
- package/dist/react-native/chunks/phrase-module-QK22HSQ2.mjs +0 -329
- package/dist/react-native/chunks/pool-JR3NJCAF.mjs +0 -297
- package/dist/react-native/chunks/release-D7ZTIANM.mjs +0 -33
- package/dist/react-native/chunks/restore-queue-ZZX54AH7.mjs +0 -55
- package/dist/react-native/chunks/retention-EW4TTDFB.mjs +0 -223
- package/dist/react-native/chunks/snapshot-REYVIN3X.mjs +0 -975
- package/dist/react-native/chunks/start-BQK6KN3R.mjs +0 -38
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +0 -15
- package/dist/react-native/chunks/write-FQAYCZF5.mjs +0 -207
- package/dist/release-BH3DKW3T.mjs +0 -33
- package/dist/restore-hooks-CDERDEF4.mjs +0 -153
- package/dist/restore-queue-7NNSTROA.mjs +0 -55
- package/dist/retention-QSVBBNRM.mjs +0 -66
- package/dist/runtime-COIUORCN.mjs +0 -177
- package/dist/snapshot-RH4NSKIZ.mjs +0 -782
- package/dist/start-MCKCOGIW.mjs +0 -66
- package/dist/sync-state-ZWHLAFLE.mjs +0 -15
- package/dist/thread-O4SBJJJS.mjs +0 -50
- package/dist/write-3FK7NG3Y.mjs +0 -232
- /package/dist/browser/{chunk-M3MQE2X7.mjs → digest-leaf-64IPRPZD.mjs} +0 -0
- /package/dist/browser/{chunk-JNOAKDUM.mjs → gzip-JF3S6PPT.mjs} +0 -0
- /package/dist/{chunk-ZXNNR73R.mjs → gzip-2UCZW2MM.mjs} +0 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { NarsilError, ErrorCodes, requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-MZHQ65VI.mjs';
|
|
2
|
+
|
|
3
|
+
// src/core/stored-values/build.ts
|
|
4
|
+
var ORDINAL_LIMIT = 4294967295;
|
|
5
|
+
var TEXT_UNIT_LIMIT = 1073741824;
|
|
6
|
+
function checkedCount(count) {
|
|
7
|
+
if (count > ORDINAL_LIMIT) {
|
|
8
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The stored field exceeds the native value layout");
|
|
9
|
+
}
|
|
10
|
+
return count;
|
|
11
|
+
}
|
|
12
|
+
function valueKind(value) {
|
|
13
|
+
if (value === null || value === void 0) return 0;
|
|
14
|
+
if (value === false) return 1;
|
|
15
|
+
if (value === true) return 2;
|
|
16
|
+
if (typeof value === "number") return 3;
|
|
17
|
+
if (typeof value === "string") return 4;
|
|
18
|
+
return 5;
|
|
19
|
+
}
|
|
20
|
+
function buildStoredValues(values) {
|
|
21
|
+
checkedCount(values.length);
|
|
22
|
+
const shapes = new Uint8Array(values.length);
|
|
23
|
+
const starts = new Uint32Array(values.length + 1);
|
|
24
|
+
const elements = [];
|
|
25
|
+
for (let ordinal = 0; ordinal < values.length; ordinal++) {
|
|
26
|
+
const value = values[ordinal];
|
|
27
|
+
starts[ordinal] = elements.length;
|
|
28
|
+
if (value === void 0) continue;
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
shapes[ordinal] = 2;
|
|
31
|
+
checkedCount(elements.length + value.length);
|
|
32
|
+
for (let at = 0; at < value.length; at++) elements.push(value[at]);
|
|
33
|
+
} else {
|
|
34
|
+
shapes[ordinal] = 1;
|
|
35
|
+
checkedCount(elements.length + 1);
|
|
36
|
+
elements.push(value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
starts[values.length] = elements.length;
|
|
40
|
+
const kinds = new Uint8Array(elements.length);
|
|
41
|
+
const numbers = new Float64Array(elements.length);
|
|
42
|
+
const textStart = new Uint32Array(elements.length);
|
|
43
|
+
const textLength = new Uint32Array(elements.length);
|
|
44
|
+
const encoded = /* @__PURE__ */ new Map();
|
|
45
|
+
let unitCount = 0;
|
|
46
|
+
let byteCount = 0;
|
|
47
|
+
for (let at = 0; at < elements.length; at++) {
|
|
48
|
+
const value = elements[at];
|
|
49
|
+
kinds[at] = valueKind(value);
|
|
50
|
+
if (typeof value === "number") numbers[at] = value;
|
|
51
|
+
else if (typeof value === "string") {
|
|
52
|
+
if (value.length > TEXT_UNIT_LIMIT) {
|
|
53
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The stored string exceeds the native text layout");
|
|
54
|
+
}
|
|
55
|
+
textStart[at] = unitCount;
|
|
56
|
+
textLength[at] = value.length;
|
|
57
|
+
unitCount = checkedCount(unitCount + value.length);
|
|
58
|
+
} else if (kinds[at] === 5) {
|
|
59
|
+
const bytes2 = requireLoadedMessagePack().encodeDocument(value);
|
|
60
|
+
textStart[at] = byteCount;
|
|
61
|
+
textLength[at] = bytes2.length;
|
|
62
|
+
byteCount = checkedCount(byteCount + bytes2.length);
|
|
63
|
+
encoded.set(at, bytes2);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const units = new Uint16Array(unitCount);
|
|
67
|
+
const bytes = new Uint8Array(byteCount);
|
|
68
|
+
for (let at = 0; at < elements.length; at++) {
|
|
69
|
+
const value = elements[at];
|
|
70
|
+
if (typeof value === "string") {
|
|
71
|
+
for (let unit = 0; unit < value.length; unit++) units[textStart[at] + unit] = value.charCodeAt(unit);
|
|
72
|
+
} else {
|
|
73
|
+
const stored = encoded.get(at);
|
|
74
|
+
if (stored !== void 0) bytes.set(stored, textStart[at]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { shapes, starts, kinds, numbers, textStart, textLength, units, bytes };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/core/stored-values/constants.ts
|
|
81
|
+
var VALUES_INITIAL_CAPACITY = 64;
|
|
82
|
+
var PAYLOAD_INITIAL_CAPACITY = 128;
|
|
83
|
+
|
|
84
|
+
// src/core/stored-values/storage.ts
|
|
85
|
+
function checkedSize(size, maximum = 4294967295) {
|
|
86
|
+
if (!Number.isInteger(size) || size < 0 || size > maximum)
|
|
87
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The stored field exceeds the native value layout");
|
|
88
|
+
return size;
|
|
89
|
+
}
|
|
90
|
+
function capacity(current2, needed, minimum, maximum = 4294967295) {
|
|
91
|
+
checkedSize(needed, maximum);
|
|
92
|
+
return Math.max(needed, Math.min(maximum, current2 * 2), minimum);
|
|
93
|
+
}
|
|
94
|
+
function grow(region, needed, create, minimum, maximum = 4294967295) {
|
|
95
|
+
if (needed <= region.length) return region;
|
|
96
|
+
const next = create(capacity(region.length, needed, minimum, maximum));
|
|
97
|
+
next.set(region);
|
|
98
|
+
return next;
|
|
99
|
+
}
|
|
100
|
+
function reserveStoredValues(held, ordinals, elements, units, bytes) {
|
|
101
|
+
checkedSize(ordinals);
|
|
102
|
+
checkedSize(elements);
|
|
103
|
+
return {
|
|
104
|
+
shapes: grow(held.shapes, ordinals, (length) => new Uint8Array(length), VALUES_INITIAL_CAPACITY),
|
|
105
|
+
starts: grow(held.starts, ordinals + 1, (length) => new Uint32Array(length), VALUES_INITIAL_CAPACITY, 4294967296),
|
|
106
|
+
kinds: grow(held.kinds, elements, (length) => new Uint8Array(length), VALUES_INITIAL_CAPACITY),
|
|
107
|
+
numbers: grow(held.numbers, elements, (length) => new Float64Array(length), VALUES_INITIAL_CAPACITY),
|
|
108
|
+
textStart: grow(held.textStart, elements, (length) => new Uint32Array(length), VALUES_INITIAL_CAPACITY),
|
|
109
|
+
textLength: grow(held.textLength, elements, (length) => new Uint32Array(length), VALUES_INITIAL_CAPACITY),
|
|
110
|
+
units: grow(held.units, units, (length) => new Uint16Array(length), PAYLOAD_INITIAL_CAPACITY),
|
|
111
|
+
bytes: grow(held.bytes, bytes, (length) => new Uint8Array(length), PAYLOAD_INITIAL_CAPACITY)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function compactStoredPayload(held, elements, unitCount, byteCount, extraUnits, extraBytes) {
|
|
115
|
+
const units = new Uint16Array(capacity(0, unitCount + extraUnits, PAYLOAD_INITIAL_CAPACITY));
|
|
116
|
+
const bytes = new Uint8Array(capacity(0, byteCount + extraBytes, PAYLOAD_INITIAL_CAPACITY));
|
|
117
|
+
const textStart = held.textStart.slice();
|
|
118
|
+
let unit = 0;
|
|
119
|
+
let byte = 0;
|
|
120
|
+
for (let at = 0; at < elements; at++) {
|
|
121
|
+
const start = held.textStart[at];
|
|
122
|
+
const end = start + held.textLength[at];
|
|
123
|
+
if (held.kinds[at] === 4) {
|
|
124
|
+
units.set(held.units.subarray(start, end), unit);
|
|
125
|
+
textStart[at] = unit;
|
|
126
|
+
unit += end - start;
|
|
127
|
+
} else if (held.kinds[at] === 5) {
|
|
128
|
+
bytes.set(held.bytes.subarray(start, end), byte);
|
|
129
|
+
textStart[at] = byte;
|
|
130
|
+
byte += end - start;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { ...held, units, bytes, textStart };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/core/stored-values/column.ts
|
|
137
|
+
var StoredValueColumn = class {
|
|
138
|
+
held;
|
|
139
|
+
ordinals;
|
|
140
|
+
elements;
|
|
141
|
+
usedUnits;
|
|
142
|
+
usedBytes;
|
|
143
|
+
liveUnits;
|
|
144
|
+
liveBytes;
|
|
145
|
+
view = null;
|
|
146
|
+
constructor(values) {
|
|
147
|
+
this.held = "shapes" in values ? values : buildStoredValues(values);
|
|
148
|
+
this.ordinals = this.held.shapes.length;
|
|
149
|
+
this.elements = this.held.kinds.length;
|
|
150
|
+
this.usedUnits = this.liveUnits = this.held.units.length;
|
|
151
|
+
this.usedBytes = this.liveBytes = this.held.bytes.length;
|
|
152
|
+
}
|
|
153
|
+
prepare(changes) {
|
|
154
|
+
const prepared = changes.map((change) => ({ ordinal: change.ordinal, values: buildStoredValues([change.value]) }));
|
|
155
|
+
let ordinals = this.ordinals;
|
|
156
|
+
let elements = this.elements;
|
|
157
|
+
let capacity2 = elements;
|
|
158
|
+
let units = 0;
|
|
159
|
+
let bytes = 0;
|
|
160
|
+
for (const change of prepared) {
|
|
161
|
+
checkedSize(change.ordinal);
|
|
162
|
+
ordinals = Math.max(ordinals, change.ordinal + 1);
|
|
163
|
+
const previous = change.ordinal < this.ordinals ? this.held.starts[change.ordinal + 1] - this.held.starts[change.ordinal] : 0;
|
|
164
|
+
elements += change.values.kinds.length - previous;
|
|
165
|
+
capacity2 = Math.max(capacity2, checkedSize(elements));
|
|
166
|
+
units += change.values.units.length;
|
|
167
|
+
bytes += change.values.bytes.length;
|
|
168
|
+
}
|
|
169
|
+
let held = this.held;
|
|
170
|
+
let usedUnits = this.usedUnits;
|
|
171
|
+
let usedBytes = this.usedBytes;
|
|
172
|
+
if (usedUnits > PAYLOAD_INITIAL_CAPACITY && usedUnits - this.liveUnits > this.liveUnits || usedBytes > PAYLOAD_INITIAL_CAPACITY && usedBytes - this.liveBytes > this.liveBytes) {
|
|
173
|
+
held = compactStoredPayload(held, this.elements, this.liveUnits, this.liveBytes, units, bytes);
|
|
174
|
+
usedUnits = this.liveUnits;
|
|
175
|
+
usedBytes = this.liveBytes;
|
|
176
|
+
}
|
|
177
|
+
held = reserveStoredValues(held, ordinals, capacity2, usedUnits + units, usedBytes + bytes);
|
|
178
|
+
return () => {
|
|
179
|
+
this.view = null;
|
|
180
|
+
this.held = held;
|
|
181
|
+
this.usedUnits = usedUnits;
|
|
182
|
+
this.usedBytes = usedBytes;
|
|
183
|
+
for (const change of prepared) this.replace(change.ordinal, change.values);
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
replace(ordinal, values) {
|
|
187
|
+
const held = this.held;
|
|
188
|
+
if (ordinal >= this.ordinals) {
|
|
189
|
+
held.starts.fill(this.elements, this.ordinals, ordinal + 2);
|
|
190
|
+
this.ordinals = ordinal + 1;
|
|
191
|
+
}
|
|
192
|
+
const start = held.starts[ordinal];
|
|
193
|
+
const end = held.starts[ordinal + 1];
|
|
194
|
+
for (let at = start; at < end; at++) {
|
|
195
|
+
if (held.kinds[at] === 4) this.liveUnits -= held.textLength[at];
|
|
196
|
+
else if (held.kinds[at] === 5) this.liveBytes -= held.textLength[at];
|
|
197
|
+
}
|
|
198
|
+
const delta = values.kinds.length - (end - start);
|
|
199
|
+
if (delta !== 0) {
|
|
200
|
+
held.kinds.copyWithin(end + delta, end, this.elements);
|
|
201
|
+
held.numbers.copyWithin(end + delta, end, this.elements);
|
|
202
|
+
held.textStart.copyWithin(end + delta, end, this.elements);
|
|
203
|
+
held.textLength.copyWithin(end + delta, end, this.elements);
|
|
204
|
+
for (let at = ordinal + 1; at <= this.ordinals; at++) held.starts[at] += delta;
|
|
205
|
+
this.elements += delta;
|
|
206
|
+
}
|
|
207
|
+
held.shapes[ordinal] = values.shapes[0];
|
|
208
|
+
held.kinds.set(values.kinds, start);
|
|
209
|
+
held.numbers.set(values.numbers, start);
|
|
210
|
+
held.textLength.set(values.textLength, start);
|
|
211
|
+
for (let at = 0; at < values.kinds.length; at++) {
|
|
212
|
+
const base = values.kinds[at] === 4 ? this.usedUnits : values.kinds[at] === 5 ? this.usedBytes : 0;
|
|
213
|
+
held.textStart[start + at] = values.textStart[at] + base;
|
|
214
|
+
}
|
|
215
|
+
held.units.set(values.units, this.usedUnits);
|
|
216
|
+
held.bytes.set(values.bytes, this.usedBytes);
|
|
217
|
+
this.usedUnits += values.units.length;
|
|
218
|
+
this.liveUnits += values.units.length;
|
|
219
|
+
this.usedBytes += values.bytes.length;
|
|
220
|
+
this.liveBytes += values.bytes.length;
|
|
221
|
+
}
|
|
222
|
+
regions() {
|
|
223
|
+
if (this.view !== null) return this.view;
|
|
224
|
+
const held = this.held;
|
|
225
|
+
this.view = {
|
|
226
|
+
shapes: held.shapes.subarray(0, this.ordinals),
|
|
227
|
+
starts: held.starts.subarray(0, this.ordinals + 1),
|
|
228
|
+
kinds: held.kinds.subarray(0, this.elements),
|
|
229
|
+
numbers: held.numbers.subarray(0, this.elements),
|
|
230
|
+
textStart: held.textStart.subarray(0, this.elements),
|
|
231
|
+
textLength: held.textLength.subarray(0, this.elements),
|
|
232
|
+
units: held.units.subarray(0, this.usedUnits),
|
|
233
|
+
bytes: held.bytes.subarray(0, this.usedBytes)
|
|
234
|
+
};
|
|
235
|
+
return this.view;
|
|
236
|
+
}
|
|
237
|
+
bytes() {
|
|
238
|
+
return Object.values(this.held).reduce((sum, region) => sum + region.byteLength, 0);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// src/core/stored-values/columns.ts
|
|
243
|
+
var columns = /* @__PURE__ */ new WeakMap();
|
|
244
|
+
function discardStoredValues(store) {
|
|
245
|
+
columns.delete(store);
|
|
246
|
+
}
|
|
247
|
+
function current(store) {
|
|
248
|
+
const held = columns.get(store);
|
|
249
|
+
if (held === void 0 || held.generation === store.numberingGeneration()) return held;
|
|
250
|
+
columns.delete(store);
|
|
251
|
+
return void 0;
|
|
252
|
+
}
|
|
253
|
+
function unchanged() {
|
|
254
|
+
}
|
|
255
|
+
function cachedStoredFields(store) {
|
|
256
|
+
const held = current(store);
|
|
257
|
+
return held === void 0 ? [] : Array.from(held.fields, ([field, column]) => ({ field, values: column.regions() }));
|
|
258
|
+
}
|
|
259
|
+
function installStoredFields(store, fields) {
|
|
260
|
+
if (fields.length === 0) return;
|
|
261
|
+
columns.set(store, {
|
|
262
|
+
generation: store.numberingGeneration(),
|
|
263
|
+
fields: new Map(fields.map(({ field, values }) => [field, new StoredValueColumn(values)]))
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function storedValuesOf(store, field) {
|
|
267
|
+
let held = current(store);
|
|
268
|
+
if (held === void 0) {
|
|
269
|
+
held = { generation: store.numberingGeneration(), fields: /* @__PURE__ */ new Map() };
|
|
270
|
+
columns.set(store, held);
|
|
271
|
+
}
|
|
272
|
+
let column = held.fields.get(field);
|
|
273
|
+
if (column === void 0) {
|
|
274
|
+
const values = new Array(store.internalIdCapacity());
|
|
275
|
+
const read = store.fieldReader(field);
|
|
276
|
+
for (const ordinal of store.allInternalIds()) values[ordinal] = read(ordinal);
|
|
277
|
+
column = new StoredValueColumn(values);
|
|
278
|
+
held.fields.set(field, column);
|
|
279
|
+
}
|
|
280
|
+
return column.regions();
|
|
281
|
+
}
|
|
282
|
+
function prepareStoredValues(store, removed, written, document) {
|
|
283
|
+
const held = current(store);
|
|
284
|
+
if (held === void 0) return unchanged;
|
|
285
|
+
const changes = [];
|
|
286
|
+
for (const [field, column] of held.fields) {
|
|
287
|
+
const values = [];
|
|
288
|
+
if (removed !== void 0 && removed !== written) values.push({ ordinal: removed, value: void 0 });
|
|
289
|
+
if (written !== void 0)
|
|
290
|
+
values.push({ ordinal: written, value: document === void 0 ? void 0 : getNestedValue(document, field) });
|
|
291
|
+
changes.push(column.prepare(values));
|
|
292
|
+
}
|
|
293
|
+
return () => {
|
|
294
|
+
for (const apply of changes) apply();
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function storedValueBytes(store) {
|
|
298
|
+
const held = current(store);
|
|
299
|
+
let bytes = 0;
|
|
300
|
+
if (held !== void 0) for (const field of held.fields.values()) bytes += field.bytes();
|
|
301
|
+
return bytes;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/core/bitset.ts
|
|
305
|
+
function createBitSet(capacity2) {
|
|
306
|
+
return new Uint32Array(capacity2 + 31 >>> 5 || 1);
|
|
307
|
+
}
|
|
308
|
+
function bitsetSet(bs, index) {
|
|
309
|
+
const word = index >>> 5;
|
|
310
|
+
if (word < bs.length) {
|
|
311
|
+
bs[word] |= 1 << (index & 31);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function bitsetClear(bs, index) {
|
|
315
|
+
const word = index >>> 5;
|
|
316
|
+
if (word < bs.length) {
|
|
317
|
+
bs[word] &= ~(1 << (index & 31));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function bitsetHas(bs, index) {
|
|
321
|
+
const word = index >>> 5;
|
|
322
|
+
if (word >= bs.length) return false;
|
|
323
|
+
return (bs[word] & 1 << (index & 31)) !== 0;
|
|
324
|
+
}
|
|
325
|
+
function bitsetAnd(a, b) {
|
|
326
|
+
const len = Math.min(a.length, b.length);
|
|
327
|
+
const result = new Uint32Array(len);
|
|
328
|
+
for (let i = 0; i < len; i++) {
|
|
329
|
+
result[i] = a[i] & b[i];
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
function bitsetAndInto(target, other) {
|
|
334
|
+
const shared = Math.min(target.length, other.length);
|
|
335
|
+
for (let i = 0; i < shared; i++) target[i] &= other[i];
|
|
336
|
+
target.fill(0, shared);
|
|
337
|
+
}
|
|
338
|
+
function bitsetOrInto(target, other) {
|
|
339
|
+
const shared = Math.min(target.length, other.length);
|
|
340
|
+
for (let i = 0; i < shared; i++) target[i] |= other[i];
|
|
341
|
+
}
|
|
342
|
+
function bitsetAndNotInto(target, removed) {
|
|
343
|
+
const shared = Math.min(target.length, removed.length);
|
|
344
|
+
for (let i = 0; i < shared; i++) target[i] &= ~removed[i];
|
|
345
|
+
}
|
|
346
|
+
function bitsetNot(bs, capacity2) {
|
|
347
|
+
const result = new Uint32Array(bs.length);
|
|
348
|
+
const fullWords = capacity2 >>> 5;
|
|
349
|
+
for (let i = 0; i < fullWords; i++) {
|
|
350
|
+
result[i] = ~bs[i];
|
|
351
|
+
}
|
|
352
|
+
const remainder = capacity2 & 31;
|
|
353
|
+
if (remainder > 0 && fullWords < bs.length) {
|
|
354
|
+
result[fullWords] = ~bs[fullWords] & (1 << remainder) - 1;
|
|
355
|
+
}
|
|
356
|
+
return result;
|
|
357
|
+
}
|
|
358
|
+
function bitsetIsEmpty(bs) {
|
|
359
|
+
for (let i = 0; i < bs.length; i++) {
|
|
360
|
+
if (bs[i] !== 0) return false;
|
|
361
|
+
}
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
function* bitsetIterator(bs) {
|
|
365
|
+
for (let i = 0; i < bs.length; i++) {
|
|
366
|
+
let word = bs[i];
|
|
367
|
+
if (word === 0) continue;
|
|
368
|
+
const base = i << 5;
|
|
369
|
+
while (word !== 0) {
|
|
370
|
+
const tz = Math.clz32(word & -word) ^ 31;
|
|
371
|
+
yield base + tz;
|
|
372
|
+
word &= word - 1;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function bitsetFromSet(set, capacity2) {
|
|
377
|
+
const bs = createBitSet(capacity2);
|
|
378
|
+
for (const id of set) {
|
|
379
|
+
bs[id >>> 5] |= 1 << (id & 31);
|
|
380
|
+
}
|
|
381
|
+
return bs;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// src/filters/constants.ts
|
|
385
|
+
var MAX_FILTER_DEPTH = 30;
|
|
386
|
+
var MAX_FILTER_TESTS = 1024;
|
|
387
|
+
var FILTER_OPERAND_COPY_DEPTH = 3;
|
|
388
|
+
var MAX_FILTER_ARRAY_SIZE = 65536;
|
|
389
|
+
var GEO_UNIT_METRES = { km: 1e3, mi: 1609.344, m: 1 };
|
|
390
|
+
|
|
391
|
+
// src/filters/operands/checks.ts
|
|
392
|
+
function operandKindOf(type) {
|
|
393
|
+
if (type === void 0) return void 0;
|
|
394
|
+
if (type === "number" || type === "number[]") return "number";
|
|
395
|
+
if (type === "boolean" || type === "boolean[]") return "boolean";
|
|
396
|
+
if (type === "geopoint") return "geopoint";
|
|
397
|
+
if (type.startsWith("vector[")) return "vector";
|
|
398
|
+
return "text";
|
|
399
|
+
}
|
|
400
|
+
function isFiniteNumber(value) {
|
|
401
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
402
|
+
}
|
|
403
|
+
function kindOfValue(value) {
|
|
404
|
+
if (isFiniteNumber(value)) return "number";
|
|
405
|
+
if (typeof value === "boolean") return "boolean";
|
|
406
|
+
if (typeof value === "string") return "text";
|
|
407
|
+
return void 0;
|
|
408
|
+
}
|
|
409
|
+
function isObjectRecord(value) {
|
|
410
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
411
|
+
}
|
|
412
|
+
function invalid(message, fieldPath, operator) {
|
|
413
|
+
throw new NarsilError(ErrorCodes.SEARCH_INVALID_FILTER, message, { fieldPath, operator });
|
|
414
|
+
}
|
|
415
|
+
function requireFieldKind(fieldPath, operator, type, accepted) {
|
|
416
|
+
const kind = operandKindOf(type);
|
|
417
|
+
if (kind === void 0 || accepted.includes(kind)) return;
|
|
418
|
+
invalid(
|
|
419
|
+
`The engine applies "${operator}" to ${accepted.join(" or ")} fields alone, and the schema declares field "${fieldPath}" as "${type}"`,
|
|
420
|
+
fieldPath,
|
|
421
|
+
operator
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
function requireTextRangeField(fieldPath, operator, type) {
|
|
425
|
+
const parsed = parsedTypeOf(type);
|
|
426
|
+
if (parsed?.sortable && (parsed.base === "string" || parsed.base === "verbatim")) return;
|
|
427
|
+
const declared = type === void 0 ? `the schema has no field "${fieldPath}"` : `field "${fieldPath}" has type "${type}"`;
|
|
428
|
+
invalid(
|
|
429
|
+
`The engine applies "${operator}" with a text bound to a "string" or "verbatim" field whose type includes "sortable", but ${declared}`,
|
|
430
|
+
fieldPath,
|
|
431
|
+
operator
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
function requireListLength(fieldPath, operator, values) {
|
|
435
|
+
if (values.length <= MAX_FILTER_ARRAY_SIZE) return;
|
|
436
|
+
invalid(
|
|
437
|
+
`"${operator}" on field "${fieldPath}" holds ${values.length} values, while a filter list holds at most ${MAX_FILTER_ARRAY_SIZE}`,
|
|
438
|
+
fieldPath,
|
|
439
|
+
operator
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// src/core/pattern-index/constants.ts
|
|
444
|
+
var DEFAULT_PATTERN_WORK_CAP = 25e6;
|
|
445
|
+
var MAX_PATTERN_TEXT_CODE_POINTS = 1024;
|
|
446
|
+
var MAX_PATTERN_POSITIONS = 2048;
|
|
447
|
+
var MATCHER_STATE_BUDGET_BYTES = 1e6;
|
|
448
|
+
var MATCHER_CODE_POINT_BYTES = 8;
|
|
449
|
+
var MATCHER_SIMULATION_BYTES_PER_POSITION = 16;
|
|
450
|
+
var MATCHER_STATE_OVERHEAD_BYTES = 96;
|
|
451
|
+
var PATTERN_WORK_FLUSH_UNITS = 65536;
|
|
452
|
+
var PATTERN_RUN_CODE_POINTS = 3;
|
|
453
|
+
var MAX_PATTERN_TOLERANCE = 2;
|
|
454
|
+
var TYPO_CLAIM_SLOTS_PER_WORD = 32;
|
|
455
|
+
var PATTERN_TEST_OPERATORS = ["eq", "ne", "in", "nin", "startsWith", "endsWith", "contains"];
|
|
456
|
+
var PATTERN_EXPRESSION_OPERATORS = ["wildcard", "regex"];
|
|
457
|
+
var PATTERN_ELEMENT_OPERATORS = ["matchesAny", "containsAll"];
|
|
458
|
+
|
|
459
|
+
// src/core/partition/growable-uint32.ts
|
|
460
|
+
var GrowableUint32 = class {
|
|
461
|
+
values;
|
|
462
|
+
length = 0;
|
|
463
|
+
constructor(capacity2) {
|
|
464
|
+
this.values = new Uint32Array(capacity2);
|
|
465
|
+
}
|
|
466
|
+
growTo(needed, kept) {
|
|
467
|
+
let capacity2 = this.values.length * 2;
|
|
468
|
+
while (capacity2 < needed) capacity2 *= 2;
|
|
469
|
+
const next = new Uint32Array(capacity2);
|
|
470
|
+
next.set(this.values.subarray(0, kept));
|
|
471
|
+
this.values = next;
|
|
472
|
+
}
|
|
473
|
+
reserve(extra) {
|
|
474
|
+
const needed = this.length + extra;
|
|
475
|
+
if (needed > this.values.length) this.growTo(needed, this.length);
|
|
476
|
+
}
|
|
477
|
+
push(value) {
|
|
478
|
+
if (this.length === this.values.length) this.growTo(this.length + 1, this.length);
|
|
479
|
+
this.values[this.length++] = value;
|
|
480
|
+
}
|
|
481
|
+
ensureIndex(index) {
|
|
482
|
+
if (index >= this.values.length) this.growTo(index + 1, this.values.length);
|
|
483
|
+
}
|
|
484
|
+
clear() {
|
|
485
|
+
this.length = 0;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// src/core/fuzzy.ts
|
|
490
|
+
var FIRST_SURROGATE = 55296;
|
|
491
|
+
var LAST_SURROGATE = 57343;
|
|
492
|
+
var LAST_BASIC_PLANE_CODE_POINT = 65535;
|
|
493
|
+
function hasSurrogate(text) {
|
|
494
|
+
for (let index = 0; index < text.length; index++) {
|
|
495
|
+
const unit = text.charCodeAt(index);
|
|
496
|
+
if (unit >= FIRST_SURROGATE && unit <= LAST_SURROGATE) return true;
|
|
497
|
+
}
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
function fuzzyPrefixOf(queryTerm, prefixLength) {
|
|
501
|
+
let end = 0;
|
|
502
|
+
for (let counted = 0; counted < prefixLength && end < queryTerm.length; counted++) {
|
|
503
|
+
const codePoint = queryTerm.codePointAt(end);
|
|
504
|
+
end += codePoint !== void 0 && codePoint > LAST_BASIC_PLANE_CODE_POINT ? 2 : 1;
|
|
505
|
+
}
|
|
506
|
+
return queryTerm.slice(0, end);
|
|
507
|
+
}
|
|
508
|
+
function fuzzyTermMatches(queryTerm, indexTerm, tolerance, prefixLength) {
|
|
509
|
+
if (queryTerm === indexTerm) return true;
|
|
510
|
+
if (tolerance <= 0) return false;
|
|
511
|
+
if (!indexTerm.startsWith(fuzzyPrefixOf(queryTerm, prefixLength))) return false;
|
|
512
|
+
return boundedLevenshtein(queryTerm, indexTerm, tolerance).withinTolerance;
|
|
513
|
+
}
|
|
514
|
+
function boundedLevenshtein(a, b, tolerance) {
|
|
515
|
+
if (tolerance < 0) return { distance: -1, withinTolerance: false, cells: 0 };
|
|
516
|
+
if (a === b) return { distance: 0, withinTolerance: true, cells: 0 };
|
|
517
|
+
return tabulatedLevenshtein(a, b, tolerance);
|
|
518
|
+
}
|
|
519
|
+
function tabulatedLevenshtein(a, b, tolerance) {
|
|
520
|
+
if (tolerance < 0) return { distance: -1, withinTolerance: false, cells: 0 };
|
|
521
|
+
if (hasSurrogate(a) || hasSurrogate(b)) return bandedDistance(Array.from(a), Array.from(b), tolerance);
|
|
522
|
+
return bandedDistance(a, b, tolerance);
|
|
523
|
+
}
|
|
524
|
+
function bandedDistance(a, b, tolerance) {
|
|
525
|
+
const m = a.length;
|
|
526
|
+
const n = b.length;
|
|
527
|
+
const beyond = tolerance + 1;
|
|
528
|
+
if (Math.abs(m - n) > tolerance) return { distance: beyond, withinTolerance: false, cells: 0 };
|
|
529
|
+
let previous = new Uint32Array(n + 1).fill(beyond);
|
|
530
|
+
let current2 = new Uint32Array(n + 1).fill(beyond);
|
|
531
|
+
const firstRowEnd = Math.min(n, tolerance);
|
|
532
|
+
for (let j = 0; j <= firstRowEnd; j++) previous[j] = j;
|
|
533
|
+
let cells = 0;
|
|
534
|
+
for (let i = 1; i <= m; i++) {
|
|
535
|
+
const low = Math.max(1, i - tolerance);
|
|
536
|
+
const high = Math.min(n, i + tolerance);
|
|
537
|
+
current2[low - 1] = low === 1 ? i : beyond;
|
|
538
|
+
let rowMin = current2[low - 1];
|
|
539
|
+
const character = a[i - 1];
|
|
540
|
+
if (high >= low) cells += high - low + 1;
|
|
541
|
+
for (let j = low; j <= high; j++) {
|
|
542
|
+
const substitution = previous[j - 1] + (character === b[j - 1] ? 0 : 1);
|
|
543
|
+
const cell = Math.min(previous[j] + 1, current2[j - 1] + 1, substitution, beyond);
|
|
544
|
+
current2[j] = cell;
|
|
545
|
+
if (cell < rowMin) rowMin = cell;
|
|
546
|
+
}
|
|
547
|
+
if (rowMin > tolerance) return { distance: beyond, withinTolerance: false, cells };
|
|
548
|
+
const finished = previous;
|
|
549
|
+
previous = current2;
|
|
550
|
+
current2 = finished;
|
|
551
|
+
}
|
|
552
|
+
const distance = previous[n];
|
|
553
|
+
return { distance, withinTolerance: distance <= tolerance, cells };
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// src/core/stored-values/text.ts
|
|
557
|
+
function storedText(units, start, length) {
|
|
558
|
+
const end = start + length;
|
|
559
|
+
let text = "";
|
|
560
|
+
for (let at = start; at < end; at++) text += String.fromCharCode(units[at]);
|
|
561
|
+
return text;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export { DEFAULT_PATTERN_WORK_CAP, FILTER_OPERAND_COPY_DEPTH, GEO_UNIT_METRES, GrowableUint32, MATCHER_CODE_POINT_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION, MATCHER_STATE_BUDGET_BYTES, MATCHER_STATE_OVERHEAD_BYTES, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, MAX_PATTERN_POSITIONS, MAX_PATTERN_TEXT_CODE_POINTS, MAX_PATTERN_TOLERANCE, PATTERN_ELEMENT_OPERATORS, PATTERN_EXPRESSION_OPERATORS, PATTERN_RUN_CODE_POINTS, PATTERN_TEST_OPERATORS, PATTERN_WORK_FLUSH_UNITS, TYPO_CLAIM_SLOTS_PER_WORD, bitsetAnd, bitsetAndInto, bitsetAndNotInto, bitsetClear, bitsetFromSet, bitsetHas, bitsetIsEmpty, bitsetIterator, bitsetNot, bitsetOrInto, bitsetSet, boundedLevenshtein, buildStoredValues, cachedStoredFields, checkedSize, createBitSet, discardStoredValues, fuzzyPrefixOf, fuzzyTermMatches, installStoredFields, invalid, isFiniteNumber, isObjectRecord, kindOfValue, prepareStoredValues, requireFieldKind, requireListLength, requireTextRangeField, storedText, storedValueBytes, storedValuesOf, tabulatedLevenshtein };
|