mcard-js 2.1.41 → 2.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/dist/{CardCollection-MXTUJV4J.js → CardCollection-7DKJWKAG.js} +3 -2
  2. package/dist/CardCollection-S4RE3RXP.js +10 -0
  3. package/dist/CardCollection-VPN7AAAX.js +10 -0
  4. package/dist/{IndexedDBEngine-2G5KCISA.js → IndexedDBEngine-7JOGM2MM.js} +3 -2
  5. package/dist/IndexedDBEngine-BGZHJK5L.js +12 -0
  6. package/dist/IndexedDBEngine-ZJ442GI7.js +12 -0
  7. package/dist/{LLMRuntime-GIGDMDEZ.js → LLMRuntime-OZNVAPXJ.js} +4 -3
  8. package/dist/{LLMRuntime-LBWUJ7ON.js → LLMRuntime-UPSEDSIK.js} +2 -2
  9. package/dist/{LambdaRuntime-B6D6IQKZ.js → LambdaRuntime-JZ4Q56TI.js} +6 -5
  10. package/dist/LambdaRuntime-PM3OUFHU.js +19 -0
  11. package/dist/LambdaRuntime-WBEK37AF.js +19 -0
  12. package/dist/LambdaRuntime-YKSBAT65.js +19 -0
  13. package/dist/{Loader-3LSJXJQG.js → Loader-7HQVYDPA.js} +2 -2
  14. package/dist/{Loader-BM56B2TX.js → Loader-NYWTV7CQ.js} +4 -3
  15. package/dist/{Loader-CYLAA4XU.js → Loader-OLKPY6HT.js} +3 -3
  16. package/dist/{MCard-H56VOJLR.js → MCard-OYI73CUI.js} +1 -1
  17. package/dist/{MCard-5LIREV2B.js → MCard-XHG3BZC7.js} +2 -2
  18. package/dist/{NetworkRuntime-IAFHPQSX.js → NetworkRuntime-VYCC5HSY.js} +16 -11
  19. package/dist/{NetworkRuntime-JNGKW3DY.js → NetworkRuntime-XQX3LDDI.js} +61 -33
  20. package/dist/{NetworkRuntime-CXPKIAOQ.js → NetworkRuntime-XZR733M5.js} +17 -12
  21. package/dist/{OllamaProvider-QPX2JXL2.js → OllamaProvider-FBZ5WW72.js} +1 -1
  22. package/dist/OllamaProvider-W6TPZNHD.js +9 -0
  23. package/dist/chunk-2NFGZ6PA.js +170 -0
  24. package/dist/{chunk-VXV35I5J.js → chunk-4TYRTQ4V.js} +48 -17
  25. package/dist/chunk-4VWWTGRW.js +497 -0
  26. package/dist/{chunk-4PDYHPR6.js → chunk-5GHZP7E5.js} +4 -2
  27. package/dist/{chunk-42VF42KH.js → chunk-5HZNWJFT.js} +4 -2
  28. package/dist/{chunk-DEYMHG5A.js → chunk-6MG5ZHAP.js} +58 -22
  29. package/dist/{chunk-7V37AAPK.js → chunk-7B4PABOL.js} +16 -7
  30. package/dist/chunk-A5S2PI37.js +47 -0
  31. package/dist/chunk-BFD4WSWU.js +497 -0
  32. package/dist/chunk-BSEFN25Q.js +32 -0
  33. package/dist/{chunk-3LPY36OG.js → chunk-CBEVE7RG.js} +20 -15
  34. package/dist/{chunk-A5AB4WQN.js → chunk-DPA3ZK4Q.js} +30 -21
  35. package/dist/{chunk-5FA54AMM.js → chunk-EJHX3VZL.js} +54 -21
  36. package/dist/{chunk-QXPHMSPA.js → chunk-GNF4WAPV.js} +22 -9
  37. package/dist/{chunk-XPG6B5IW.js → chunk-JHIA2BQK.js} +26 -13
  38. package/dist/{chunk-4I5IZILN.js → chunk-KGPICAQW.js} +10 -7
  39. package/dist/{chunk-4WBJPHZP.js → chunk-MST5AZXJ.js} +17 -8
  40. package/dist/{chunk-K35KFTEA.js → chunk-N6KDHCBC.js} +58 -33
  41. package/dist/{chunk-2R4ESMZB.js → chunk-NFO5NU6B.js} +5 -3
  42. package/dist/chunk-OKWBHCKC.js +170 -0
  43. package/dist/{chunk-FIE4LAJG.js → chunk-OX3K6UZJ.js} +5 -3
  44. package/dist/{chunk-6SEX42H2.js → chunk-R3K7DG7O.js} +21 -16
  45. package/dist/chunk-RB35Z35T.js +44 -0
  46. package/dist/{chunk-AWGFLRLI.js → chunk-SP4YPKPR.js} +51 -318
  47. package/dist/chunk-U7TSFDKX.js +217 -0
  48. package/dist/chunk-UP3SQX56.js +112 -0
  49. package/dist/{chunk-4EUEU4SM.js → chunk-VGIRC3HX.js} +13 -110
  50. package/dist/chunk-WGG7526Z.js +112 -0
  51. package/dist/{chunk-3JBSRALP.js → chunk-WNKP66IR.js} +10 -7
  52. package/dist/{chunk-DOC55MPG.js → chunk-WR6ISHCS.js} +11 -3
  53. package/dist/{chunk-52UNWVOD.js → chunk-ZVOPQ5BM.js} +54 -21
  54. package/dist/chunk-ZZMOPQER.js +217 -0
  55. package/dist/index.browser.cjs +79 -1454
  56. package/dist/index.browser.d.cts +2 -17
  57. package/dist/index.browser.d.ts +2 -17
  58. package/dist/index.browser.js +7 -6
  59. package/dist/index.cjs +306 -1631
  60. package/dist/index.d.cts +3 -1
  61. package/dist/index.d.ts +3 -1
  62. package/dist/index.js +49 -35
  63. package/dist/storage/SqliteNodeEngine.cjs +59 -1335
  64. package/dist/storage/SqliteNodeEngine.js +4 -3
  65. package/dist/storage/SqliteWasmEngine.cjs +57 -1335
  66. package/dist/storage/SqliteWasmEngine.js +4 -3
  67. package/package.json +12 -8
  68. package/dist/CardCollection-4OFJ6XQJ.js +0 -9
  69. package/dist/CardCollection-7PDWM24F.js +0 -9
  70. package/dist/CardCollection-CEFQ5PA6.js +0 -9
  71. package/dist/CardCollection-GUEYGN2Y.js +0 -9
  72. package/dist/CardCollection-KDO4CQ4B.js +0 -9
  73. package/dist/CardCollection-PB7ZY73E.js +0 -9
  74. package/dist/CardCollection-RK4DVH63.js +0 -9
  75. package/dist/CardCollection-T376E3TS.js +0 -9
  76. package/dist/CardCollection-WGCKKUOD.js +0 -9
  77. package/dist/CardCollection-XON2IWDU.js +0 -9
  78. package/dist/CardCollection-ZEI6FMP3.js +0 -9
  79. package/dist/EventProducer-MW6QF4IO.js +0 -47
  80. package/dist/EventProducer-V7RY2KKR.js +0 -47
  81. package/dist/FileIO.d.ts +0 -44
  82. package/dist/FileIO.d.ts.map +0 -1
  83. package/dist/FileIO.js +0 -203
  84. package/dist/FileIO.js.map +0 -1
  85. package/dist/IndexedDBEngine-7JI2CL32.js +0 -10
  86. package/dist/IndexedDBEngine-7OHQIRTI.js +0 -10
  87. package/dist/IndexedDBEngine-E5YJQG4U.js +0 -10
  88. package/dist/IndexedDBEngine-NV625E7L.js +0 -10
  89. package/dist/IndexedDBEngine-RPQS7ILF.js +0 -10
  90. package/dist/IndexedDBEngine-S3ZWCSI7.js +0 -10
  91. package/dist/IndexedDBEngine-T7OC5GRR.js +0 -10
  92. package/dist/LLMRuntime-BKB3CLXM.js +0 -16
  93. package/dist/LLMRuntime-BQUUFLAB.js +0 -16
  94. package/dist/LLMRuntime-TNBC4JCB.js +0 -16
  95. package/dist/LambdaRuntime-4YILF3G7.js +0 -15
  96. package/dist/LambdaRuntime-53TPVENI.js +0 -16
  97. package/dist/LambdaRuntime-73BSWP2G.js +0 -16
  98. package/dist/LambdaRuntime-AL5SBDCA.js +0 -17
  99. package/dist/LambdaRuntime-BYBUI7H5.js +0 -17
  100. package/dist/LambdaRuntime-JDZP3HIQ.js +0 -17
  101. package/dist/LambdaRuntime-JEI7RVWG.js +0 -16
  102. package/dist/LambdaRuntime-LCTHBYMV.js +0 -17
  103. package/dist/LambdaRuntime-LDA3G7IR.js +0 -16
  104. package/dist/LambdaRuntime-LF4FR6YA.js +0 -16
  105. package/dist/LambdaRuntime-O7JBVHO2.js +0 -16
  106. package/dist/LambdaRuntime-OFOTT464.js +0 -17
  107. package/dist/LambdaRuntime-Q6ISCHAD.js +0 -16
  108. package/dist/LambdaRuntime-TCZ42XCB.js +0 -16
  109. package/dist/LambdaRuntime-UKUOKJIW.js +0 -17
  110. package/dist/LambdaRuntime-VKLON4IB.js +0 -17
  111. package/dist/LambdaRuntime-WNYDBTS6.js +0 -16
  112. package/dist/LambdaRuntime-WPTX76CX.js +0 -17
  113. package/dist/Loader-4P7PEBCL.js +0 -11
  114. package/dist/Loader-HQ3QKMYM.js +0 -11
  115. package/dist/Loader-NCATGB67.js +0 -11
  116. package/dist/Loader-NRHGDQBD.js +0 -11
  117. package/dist/Loader-RT4NI6AT.js +0 -11
  118. package/dist/Loader-SSRY57SS.js +0 -11
  119. package/dist/Loader-W72QZ3T7.js +0 -11
  120. package/dist/Loader-WECRIXQW.js +0 -11
  121. package/dist/Loader-XFBIHCQF.js +0 -11
  122. package/dist/Loader.d.ts +0 -34
  123. package/dist/Loader.d.ts.map +0 -1
  124. package/dist/Loader.js +0 -190
  125. package/dist/Loader.js.map +0 -1
  126. package/dist/MCard-4J6WSBRF.js +0 -8
  127. package/dist/MCard-E3MRPTJF.js +0 -8
  128. package/dist/MCard-FCOIB6BP.js +0 -8
  129. package/dist/MCard-G4HUWHY5.js +0 -8
  130. package/dist/MCard-HFL7AFIH.js +0 -8
  131. package/dist/MCard-JOW6RBSO.js +0 -8
  132. package/dist/MCard-M4LKN4U2.js +0 -8
  133. package/dist/MCard-VB7UDUTN.js +0 -8
  134. package/dist/MCard-WOHE6SX6.js +0 -8
  135. package/dist/NetworkRuntime-2H7AQITA.js +0 -1571
  136. package/dist/NetworkRuntime-3MIUBNOF.js +0 -1571
  137. package/dist/NetworkRuntime-AOE2EJIM.js +0 -1571
  138. package/dist/NetworkRuntime-BQMDBUDO.js +0 -1570
  139. package/dist/NetworkRuntime-GMANLCAB.js +0 -1542
  140. package/dist/NetworkRuntime-L7P4VCGK.js +0 -1542
  141. package/dist/NetworkRuntime-LC7SUAOF.js +0 -1542
  142. package/dist/NetworkRuntime-OJWCWPBI.js +0 -1570
  143. package/dist/NetworkRuntime-ZJ3B4T3A.js +0 -1542
  144. package/dist/OllamaProvider-32RC36HD.js +0 -8
  145. package/dist/OllamaProvider-MQXSXLCA.js +0 -8
  146. package/dist/OllamaProvider-Q45BMOVN.js +0 -8
  147. package/dist/SqliteNodeEngine-WKVFWBNH.js +0 -9
  148. package/dist/StorageAdapter-DdDUiIvH.d.cts +0 -391
  149. package/dist/StorageAdapter-DdDUiIvH.d.ts +0 -391
  150. package/dist/StorageAdapter-Dw1BeOam.d.cts +0 -380
  151. package/dist/StorageAdapter-Dw1BeOam.d.ts +0 -380
  152. package/dist/chunk-23GCCCXB.js +0 -402
  153. package/dist/chunk-2ECISK2I.js +0 -354
  154. package/dist/chunk-2MRBTM72.js +0 -354
  155. package/dist/chunk-2THXO6FH.js +0 -2313
  156. package/dist/chunk-2VNRWIBZ.js +0 -389
  157. package/dist/chunk-2VOQRXWH.js +0 -296
  158. package/dist/chunk-34AYBZRO.js +0 -920
  159. package/dist/chunk-37EEYISR.js +0 -372
  160. package/dist/chunk-3E2TKOCZ.js +0 -354
  161. package/dist/chunk-3MMMJ7NH.js +0 -1068
  162. package/dist/chunk-437JTYVP.js +0 -292
  163. package/dist/chunk-4MQINOOG.js +0 -1218
  164. package/dist/chunk-4UIWXZHY.js +0 -1049
  165. package/dist/chunk-53S2EZCY.js +0 -290
  166. package/dist/chunk-5BIDGXA6.js +0 -987
  167. package/dist/chunk-5HXLTWYN.js +0 -296
  168. package/dist/chunk-5W2FDGUF.js +0 -371
  169. package/dist/chunk-6R4ERZMG.js +0 -1136
  170. package/dist/chunk-74YSNHEM.js +0 -2309
  171. package/dist/chunk-7H2BQZDK.js +0 -270
  172. package/dist/chunk-7KEWCCES.js +0 -1136
  173. package/dist/chunk-7PN2BUYF.js +0 -371
  174. package/dist/chunk-A2ZJA2EV.js +0 -389
  175. package/dist/chunk-ARPIBGRP.js +0 -1236
  176. package/dist/chunk-ATHNEEAG.js +0 -2309
  177. package/dist/chunk-AVXJOPUE.js +0 -354
  178. package/dist/chunk-B7VEU4S2.js +0 -204
  179. package/dist/chunk-C2TKISBR.js +0 -1213
  180. package/dist/chunk-CBH4YKB4.js +0 -2309
  181. package/dist/chunk-DP7HBRDL.js +0 -2309
  182. package/dist/chunk-DV7ZSH4W.js +0 -2309
  183. package/dist/chunk-DWXNZ5AJ.js +0 -642
  184. package/dist/chunk-EFKMZTT2.js +0 -270
  185. package/dist/chunk-FXJYXHG6.js +0 -266
  186. package/dist/chunk-G466I6RT.js +0 -229
  187. package/dist/chunk-GATPBTHL.js +0 -1142
  188. package/dist/chunk-GMQAHPBC.js +0 -292
  189. package/dist/chunk-GMWA2IJJ.js +0 -1105
  190. package/dist/chunk-GVX5LDLH.js +0 -371
  191. package/dist/chunk-HGENNKOJ.js +0 -355
  192. package/dist/chunk-HM2NBYHU.js +0 -292
  193. package/dist/chunk-IZWB5GCG.js +0 -389
  194. package/dist/chunk-J4HOFUKM.js +0 -2309
  195. package/dist/chunk-JIK2G3EH.js +0 -2313
  196. package/dist/chunk-JRXNWGSW.js +0 -1136
  197. package/dist/chunk-KRKK3KP6.js +0 -1081
  198. package/dist/chunk-KYXZHRUG.js +0 -389
  199. package/dist/chunk-L36L2VDL.js +0 -371
  200. package/dist/chunk-L5PZCES6.js +0 -204
  201. package/dist/chunk-L5U77ZEM.js +0 -1142
  202. package/dist/chunk-LQEKGX2T.js +0 -204
  203. package/dist/chunk-LWMUDMMQ.js +0 -1144
  204. package/dist/chunk-MLKGABMK.js +0 -9
  205. package/dist/chunk-NZ6OQ7UT.js +0 -92
  206. package/dist/chunk-O2UMNZGF.js +0 -903
  207. package/dist/chunk-OFHDMLNM.js +0 -355
  208. package/dist/chunk-PDBMNUMB.js +0 -316
  209. package/dist/chunk-PW4XS7M3.js +0 -850
  210. package/dist/chunk-QA2XQMMJ.js +0 -2313
  211. package/dist/chunk-QL2JFNA7.js +0 -389
  212. package/dist/chunk-QPZ2HNSU.js +0 -912
  213. package/dist/chunk-QVGVU6OS.js +0 -296
  214. package/dist/chunk-RCEU7PFH.js +0 -270
  215. package/dist/chunk-RSTKX7WM.js +0 -907
  216. package/dist/chunk-RXL2CW64.js +0 -266
  217. package/dist/chunk-RXUF6Y43.js +0 -2309
  218. package/dist/chunk-SIAA4J6H.js +0 -21
  219. package/dist/chunk-SOJ2UMO2.js +0 -986
  220. package/dist/chunk-T3AG6DXY.js +0 -296
  221. package/dist/chunk-TPCNKMGZ.js +0 -355
  222. package/dist/chunk-TPT3S5AX.js +0 -204
  223. package/dist/chunk-TXWGIEVH.js +0 -2313
  224. package/dist/chunk-TZFI54AU.js +0 -2313
  225. package/dist/chunk-U3FWUPD3.js +0 -717
  226. package/dist/chunk-UFW2VW2D.js +0 -266
  227. package/dist/chunk-UTAOS5Y7.js +0 -2313
  228. package/dist/chunk-V7VX5OJ6.js +0 -389
  229. package/dist/chunk-W2XGNMYB.js +0 -355
  230. package/dist/chunk-W3M4HJ4U.js +0 -2309
  231. package/dist/chunk-WMJGGREP.js +0 -296
  232. package/dist/chunk-WTNVQ5WS.js +0 -732
  233. package/dist/chunk-WVFWNVT2.js +0 -1050
  234. package/dist/chunk-WY7EYSYC.js +0 -1236
  235. package/dist/chunk-X42F7DE3.js +0 -373
  236. package/dist/chunk-XC7Y4I7L.js +0 -290
  237. package/dist/chunk-YFULZTKP.js +0 -270
  238. package/dist/chunk-YSVHXKSZ.js +0 -373
  239. package/dist/chunk-YWGVK5OS.js +0 -292
  240. package/dist/chunk-Z4BRNTO5.js +0 -2313
  241. package/dist/chunk-ZDUXDKPD.js +0 -292
  242. package/dist/chunk-ZXQ2W7LO.js +0 -355
  243. package/dist/chunk-ZXQELXXO.js +0 -378
  244. package/dist/index.browser.d.ts.map +0 -1
  245. package/dist/index.browser.js.map +0 -1
  246. package/dist/index.d.ts.map +0 -1
  247. package/dist/index.js.map +0 -1
  248. package/dist/lib-4XS34IPZ.js +0 -778
  249. package/dist/model/CardCollection.d.ts +0 -147
  250. package/dist/model/CardCollection.d.ts.map +0 -1
  251. package/dist/model/CardCollection.js +0 -272
  252. package/dist/model/CardCollection.js.map +0 -1
  253. package/dist/model/ContentTypeInterpreter.d.ts +0 -28
  254. package/dist/model/ContentTypeInterpreter.d.ts.map +0 -1
  255. package/dist/model/ContentTypeInterpreter.js +0 -147
  256. package/dist/model/ContentTypeInterpreter.js.map +0 -1
  257. package/dist/model/EventProducer.d.ts +0 -10
  258. package/dist/model/EventProducer.d.ts.map +0 -1
  259. package/dist/model/EventProducer.js +0 -46
  260. package/dist/model/EventProducer.js.map +0 -1
  261. package/dist/model/GTime.d.ts +0 -44
  262. package/dist/model/GTime.d.ts.map +0 -1
  263. package/dist/model/GTime.js +0 -91
  264. package/dist/model/GTime.js.map +0 -1
  265. package/dist/model/Handle.d.ts +0 -37
  266. package/dist/model/Handle.d.ts.map +0 -1
  267. package/dist/model/Handle.js +0 -90
  268. package/dist/model/Handle.js.map +0 -1
  269. package/dist/model/MCard.d.ts +0 -145
  270. package/dist/model/MCard.d.ts.map +0 -1
  271. package/dist/model/MCard.js +0 -180
  272. package/dist/model/MCard.js.map +0 -1
  273. package/dist/model/PCard.d.ts +0 -271
  274. package/dist/model/PCard.d.ts.map +0 -1
  275. package/dist/model/PCard.js +0 -558
  276. package/dist/model/PCard.js.map +0 -1
  277. package/dist/model/VCard.d.ts +0 -277
  278. package/dist/model/VCard.d.ts.map +0 -1
  279. package/dist/model/VCard.js +0 -573
  280. package/dist/model/VCard.js.map +0 -1
  281. package/dist/model/constants.d.ts +0 -45
  282. package/dist/model/constants.d.ts.map +0 -1
  283. package/dist/model/constants.js +0 -27
  284. package/dist/model/constants.js.map +0 -1
  285. package/dist/model/vcard_vocabulary.d.ts +0 -174
  286. package/dist/model/vcard_vocabulary.d.ts.map +0 -1
  287. package/dist/model/vcard_vocabulary.js +0 -187
  288. package/dist/model/vcard_vocabulary.js.map +0 -1
  289. package/dist/monads/Either.d.ts +0 -51
  290. package/dist/monads/Either.d.ts.map +0 -1
  291. package/dist/monads/Either.js +0 -82
  292. package/dist/monads/Either.js.map +0 -1
  293. package/dist/monads/IO.d.ts +0 -38
  294. package/dist/monads/IO.d.ts.map +0 -1
  295. package/dist/monads/IO.js +0 -66
  296. package/dist/monads/IO.js.map +0 -1
  297. package/dist/monads/Maybe.d.ts +0 -45
  298. package/dist/monads/Maybe.d.ts.map +0 -1
  299. package/dist/monads/Maybe.js +0 -73
  300. package/dist/monads/Maybe.js.map +0 -1
  301. package/dist/monads/Reader.d.ts +0 -29
  302. package/dist/monads/Reader.d.ts.map +0 -1
  303. package/dist/monads/Reader.js +0 -44
  304. package/dist/monads/Reader.js.map +0 -1
  305. package/dist/monads/State.d.ts +0 -33
  306. package/dist/monads/State.d.ts.map +0 -1
  307. package/dist/monads/State.js +0 -50
  308. package/dist/monads/State.js.map +0 -1
  309. package/dist/monads/Writer.d.ts +0 -29
  310. package/dist/monads/Writer.d.ts.map +0 -1
  311. package/dist/monads/Writer.js +0 -46
  312. package/dist/monads/Writer.js.map +0 -1
  313. package/dist/ptr/Bridgelet.d.ts +0 -180
  314. package/dist/ptr/Bridgelet.d.ts.map +0 -1
  315. package/dist/ptr/Bridgelet.js +0 -296
  316. package/dist/ptr/Bridgelet.js.map +0 -1
  317. package/dist/ptr/CLMIntrospection.d.ts +0 -169
  318. package/dist/ptr/CLMIntrospection.d.ts.map +0 -1
  319. package/dist/ptr/CLMIntrospection.js +0 -329
  320. package/dist/ptr/CLMIntrospection.js.map +0 -1
  321. package/dist/ptr/FaroSidecar.d.ts +0 -56
  322. package/dist/ptr/FaroSidecar.d.ts.map +0 -1
  323. package/dist/ptr/FaroSidecar.js +0 -102
  324. package/dist/ptr/FaroSidecar.js.map +0 -1
  325. package/dist/ptr/LensProtocol.d.ts +0 -84
  326. package/dist/ptr/LensProtocol.d.ts.map +0 -1
  327. package/dist/ptr/LensProtocol.js +0 -98
  328. package/dist/ptr/LensProtocol.js.map +0 -1
  329. package/dist/ptr/OpenTelemetrySidecar.d.ts +0 -144
  330. package/dist/ptr/OpenTelemetrySidecar.d.ts.map +0 -1
  331. package/dist/ptr/OpenTelemetrySidecar.js +0 -232
  332. package/dist/ptr/OpenTelemetrySidecar.js.map +0 -1
  333. package/dist/ptr/SandboxWorker.d.ts +0 -79
  334. package/dist/ptr/SandboxWorker.d.ts.map +0 -1
  335. package/dist/ptr/SandboxWorker.js +0 -298
  336. package/dist/ptr/SandboxWorker.js.map +0 -1
  337. package/dist/ptr/common_types.d.ts +0 -39
  338. package/dist/ptr/common_types.d.ts.map +0 -1
  339. package/dist/ptr/common_types.js +0 -12
  340. package/dist/ptr/common_types.js.map +0 -1
  341. package/dist/rag/GraphRAGEngine.d.ts +0 -26
  342. package/dist/rag/GraphRAGEngine.d.ts.map +0 -1
  343. package/dist/rag/GraphRAGEngine.js +0 -166
  344. package/dist/rag/GraphRAGEngine.js.map +0 -1
  345. package/dist/rag/HandleVectorStore.d.ts +0 -201
  346. package/dist/rag/HandleVectorStore.d.ts.map +0 -1
  347. package/dist/rag/HandleVectorStore.js +0 -527
  348. package/dist/rag/HandleVectorStore.js.map +0 -1
  349. package/dist/rag/PersistentIndexer.d.ts +0 -148
  350. package/dist/rag/PersistentIndexer.d.ts.map +0 -1
  351. package/dist/rag/PersistentIndexer.js +0 -302
  352. package/dist/rag/PersistentIndexer.js.map +0 -1
  353. package/dist/rag/index.d.ts +0 -20
  354. package/dist/rag/index.d.ts.map +0 -1
  355. package/dist/rag/index.js +0 -26
  356. package/dist/rag/index.js.map +0 -1
  357. package/dist/rag/semanticVersioning.d.ts +0 -187
  358. package/dist/rag/semanticVersioning.d.ts.map +0 -1
  359. package/dist/rag/semanticVersioning.js +0 -253
  360. package/dist/rag/semanticVersioning.js.map +0 -1
  361. package/dist/storage/IndexedDBEngine.d.ts +0 -33
  362. package/dist/storage/IndexedDBEngine.d.ts.map +0 -1
  363. package/dist/storage/IndexedDBEngine.js +0 -198
  364. package/dist/storage/IndexedDBEngine.js.map +0 -1
  365. package/dist/storage/SqliteNodeEngine.d.ts.map +0 -1
  366. package/dist/storage/SqliteNodeEngine.js.map +0 -1
  367. package/dist/storage/SqliteWasmEngine.d.ts.map +0 -1
  368. package/dist/storage/SqliteWasmEngine.js.map +0 -1
  369. package/dist/storage/StorageAdapter.d.ts +0 -42
  370. package/dist/storage/StorageAdapter.d.ts.map +0 -1
  371. package/dist/storage/StorageAdapter.js +0 -2
  372. package/dist/storage/StorageAdapter.js.map +0 -1
  373. package/dist/storage/VectorStore.d.ts +0 -202
  374. package/dist/storage/VectorStore.d.ts.map +0 -1
  375. package/dist/storage/VectorStore.js +0 -557
  376. package/dist/storage/VectorStore.js.map +0 -1
  377. package/dist/storage/schema.d.ts +0 -162
  378. package/dist/storage/schema.d.ts.map +0 -1
  379. package/dist/storage/schema.js +0 -335
  380. package/dist/storage/schema.js.map +0 -1
  381. package/dist/storage/schema_constants.d.ts +0 -7
  382. package/dist/storage/schema_constants.d.ts.map +0 -1
  383. package/dist/storage/schema_constants.js +0 -415
  384. package/dist/storage/schema_constants.js.map +0 -1
  385. package/dist/types/dots.d.ts +0 -206
  386. package/dist/types/dots.d.ts.map +0 -1
  387. package/dist/types/dots.js +0 -201
  388. package/dist/types/dots.js.map +0 -1
@@ -1,1068 +0,0 @@
1
- import {
2
- GTime,
3
- HashValidator
4
- } from "./chunk-7NKII2JA.js";
5
-
6
- // src/model/detectors/BinaryDetector.ts
7
- var BinarySignatureDetector = class _BinarySignatureDetector {
8
- contentTypeName = "binary";
9
- // Signatures map: [Signature Bytes, Mime Type]
10
- static SIGNATURES = [
11
- [new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]), "image/png"],
12
- [new Uint8Array([255, 216, 255]), "image/jpeg"],
13
- [new Uint8Array([71, 73, 70, 56, 55, 97]), "image/gif"],
14
- // GIF87a
15
- [new Uint8Array([71, 73, 70, 56, 57, 97]), "image/gif"],
16
- // GIF89a
17
- [new Uint8Array([66, 77]), "image/bmp"],
18
- // BM
19
- [new Uint8Array([0, 0, 1, 0]), "image/x-icon"],
20
- [new Uint8Array([0, 0, 2, 0]), "image/x-icon"],
21
- [new Uint8Array([37, 80, 68, 70]), "application/pdf"],
22
- // %PDF
23
- [new Uint8Array([80, 75, 3, 4]), "application/zip"],
24
- // PK..
25
- [new Uint8Array([31, 139, 8]), "application/gzip"],
26
- [new Uint8Array([82, 97, 114, 33, 26, 7, 0]), "application/x-rar-compressed"],
27
- [new Uint8Array([55, 122, 188, 175, 39, 28]), "application/x-7z-compressed"],
28
- [new Uint8Array([83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0]), "application/x-sqlite3"]
29
- ];
30
- // Extension-to-MIME mapping for binary types (used when byte detection fails)
31
- static EXT_TO_MIME = {
32
- // Video
33
- ".mp4": "video/mp4",
34
- ".webm": "video/webm",
35
- ".avi": "video/x-msvideo",
36
- ".mov": "video/quicktime",
37
- ".mkv": "video/x-matroska",
38
- ".wmv": "video/x-ms-wmv",
39
- ".flv": "video/x-flv",
40
- ".m4v": "video/x-m4v",
41
- // Audio
42
- ".mp3": "audio/mpeg",
43
- ".ogg": "audio/ogg",
44
- ".flac": "audio/flac",
45
- ".aac": "audio/aac",
46
- ".m4a": "audio/mp4",
47
- ".wma": "audio/x-ms-wma",
48
- // Images (backup for when signature detection fails)
49
- ".png": "image/png",
50
- ".jpg": "image/jpeg",
51
- ".jpeg": "image/jpeg",
52
- ".gif": "image/gif",
53
- ".bmp": "image/bmp",
54
- ".ico": "image/x-icon",
55
- ".webp": "image/webp",
56
- ".svg": "image/svg+xml",
57
- // Documents
58
- ".pdf": "application/pdf",
59
- // Archives
60
- ".zip": "application/zip",
61
- ".gz": "application/gzip",
62
- ".rar": "application/x-rar-compressed",
63
- ".7z": "application/x-7z-compressed",
64
- ".tar": "application/x-tar",
65
- // Database
66
- ".db": "application/x-sqlite3",
67
- ".sqlite": "application/x-sqlite3",
68
- ".sqlite3": "application/x-sqlite3",
69
- // Fonts
70
- ".woff": "font/woff",
71
- ".woff2": "font/woff2",
72
- ".ttf": "font/ttf",
73
- ".otf": "font/otf",
74
- ".eot": "application/vnd.ms-fontobject"
75
- };
76
- detect(contentSample, lines, firstLine, fileExtension) {
77
- const mime = this.getMimeType(contentSample, lines, firstLine, fileExtension);
78
- return mime && mime !== "application/octet-stream" ? 0.95 : 0;
79
- }
80
- getMimeType(contentSample, lines, firstLine, fileExtension) {
81
- const bytes = this.toBytes(contentSample);
82
- const detected = this.detectFromBytes(bytes);
83
- if (detected !== "application/octet-stream") {
84
- return detected;
85
- }
86
- if (fileExtension) {
87
- let ext = fileExtension.toLowerCase();
88
- const lastDotIndex = ext.lastIndexOf(".");
89
- if (lastDotIndex > -1) {
90
- ext = ext.substring(lastDotIndex);
91
- } else if (!ext.startsWith(".")) {
92
- if (ext.includes("/") || ext.includes("\\")) {
93
- return "application/octet-stream";
94
- }
95
- ext = "." + ext;
96
- }
97
- const extMime = _BinarySignatureDetector.EXT_TO_MIME[ext];
98
- if (extMime) {
99
- return extMime;
100
- }
101
- }
102
- return "application/octet-stream";
103
- }
104
- /**
105
- * Detect MIME type directly from bytes.
106
- */
107
- detectFromBytes(bytes) {
108
- if (this.startsWith(bytes, new Uint8Array([82, 73, 70, 70]))) {
109
- return this.detectRiffFormat(bytes);
110
- }
111
- for (const [sig, mime] of _BinarySignatureDetector.SIGNATURES) {
112
- if (this.startsWith(bytes, sig)) {
113
- if (mime === "application/zip") {
114
- return this.detectZipType(bytes);
115
- }
116
- return mime;
117
- }
118
- }
119
- return "application/octet-stream";
120
- }
121
- toBytes(content) {
122
- if (content instanceof Uint8Array) return content;
123
- return new TextEncoder().encode(content);
124
- }
125
- startsWith(data, prefix) {
126
- if (data.length < prefix.length) return false;
127
- for (let i = 0; i < prefix.length; i++) {
128
- if (data[i] !== prefix[i]) return false;
129
- }
130
- return true;
131
- }
132
- detectRiffFormat(bytes) {
133
- if (bytes.length < 12) return "application/octet-stream";
134
- const format = new TextDecoder().decode(bytes.slice(8, 12));
135
- if (format === "WAVE") return "audio/wav";
136
- if (format === "WEBP") return "image/webp";
137
- return "application/octet-stream";
138
- }
139
- detectZipType(bytes) {
140
- const header = new TextDecoder().decode(bytes.slice(0, 2048));
141
- if (header.includes("[Content_Types].xml") && header.includes("_rels/.rels")) {
142
- if (header.includes("word/")) return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
143
- if (header.includes("xl/")) return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
144
- if (header.includes("ppt/")) return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
145
- }
146
- return "application/zip";
147
- }
148
- };
149
-
150
- // src/model/detectors/LanguageDetector.ts
151
- var ProgrammingLanguageDetector = class {
152
- contentTypeName = "code";
153
- detect(contentSample, lines, firstLine, fileExtension) {
154
- const mime = this.getMimeType(contentSample, lines, firstLine, fileExtension);
155
- return mime && mime !== "text/plain" ? 0.95 : 0;
156
- }
157
- getMimeType(contentSample, lines, firstLine, fileExtension) {
158
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
159
- if (this.isPython(firstLine, text, lines)) {
160
- return "text/x-python";
161
- }
162
- const cType = this.detectCFamily(text);
163
- if (cType) return cType;
164
- const jsType = this.detectJsType(text);
165
- if (jsType) return jsType;
166
- if (this.isTypescript(text)) {
167
- return "text/typescript";
168
- }
169
- return "text/plain";
170
- }
171
- isPython(firstLine, text, lines) {
172
- if (/^\s*import\s+(\w+|\w+\.\w+)/m.test(text) || /^\s*from\s+(\w+|\w+\.\w+)\s+import\s+/m.test(text)) {
173
- const stdLibs = ["os", "sys", "re", "json", "math", "random", "datetime"];
174
- if (stdLibs.some((lib) => text.includes(`import ${lib}`) || text.includes(`from ${lib}`))) {
175
- return true;
176
- }
177
- }
178
- if (firstLine.startsWith("#!") && firstLine.toLowerCase().includes("python")) return true;
179
- if (text.includes("if __name__ ==") && text.includes("__main__")) return true;
180
- if (/^\s*def\s+\w+\s*\(/.test(text) && !text.includes("function")) return true;
181
- if (/^\s*class\s+\w+\s*[\(:]/m.test(text)) return true;
182
- if (/^\s*@\w+/m.test(text)) return true;
183
- let count = 0;
184
- const patterns = [
185
- /\bif\b.*?:/,
186
- /\belif\b.*?:/,
187
- /\belse\s*:/,
188
- /\bfor\b.*?\bin\b.*?:/,
189
- /\bwhile\b.*?:/,
190
- /\btry\s*:/,
191
- /\bexcept\b.*?:/,
192
- /\bfinally\s*:/,
193
- /\bNone\b/,
194
- /\bTrue\b/,
195
- /\bFalse\b/,
196
- /f["'].*?\{.*?\}["']/,
197
- // f-string
198
- /\bdef\b/,
199
- /\bclass\b/,
200
- /\bimport\b/,
201
- /\bfrom\b/,
202
- /\blambda\b.*?:/
203
- ];
204
- for (const p of patterns) {
205
- if (p.test(text)) count++;
206
- }
207
- const nonEmptyLines = lines.filter((l) => l.trim().length > 0).length;
208
- if (nonEmptyLines <= 5 && count >= 1) {
209
- return true;
210
- }
211
- return count >= 3;
212
- }
213
- detectCFamily(text) {
214
- const cPatterns = [
215
- /#include\s*<.*?>/,
216
- /#include\s*".*?"/,
217
- /\b(int|void|char|float|double)\s+main\s*\(.*\)\s*\{/,
218
- /\bstruct\s+\w+\s*\{/,
219
- /#define\s+\w+/,
220
- /printf\(.*?\);/,
221
- /scanf\(.*?\);/
222
- ];
223
- const cppPatterns = [
224
- /\bclass\s+\w+\s*\{/,
225
- /\bnamespace\s+\w+\s*\{/,
226
- /\btemplate\s*<.*?>/,
227
- /::/,
228
- /\bstd::/,
229
- /\bcout\s*<</,
230
- /\bcin\s*>>/,
231
- /\bnew\s+\w+/,
232
- /\bdelete\s+\w+/,
233
- /#include\s*<iostream>/
234
- ];
235
- let cCount = 0;
236
- let cppCount = 0;
237
- cPatterns.forEach((p) => {
238
- if (p.test(text)) cCount++;
239
- });
240
- cppPatterns.forEach((p) => {
241
- if (p.test(text)) cppCount++;
242
- });
243
- if (cppCount >= 2 || cppCount >= 1 && text.includes("std::")) return "text/x-c++";
244
- if (cCount >= 2) return "text/x-c";
245
- return null;
246
- }
247
- detectJsType(text) {
248
- const jsPatterns = [
249
- /function\s+\w+\s*\(/.test(text),
250
- // function foo(
251
- /\bconst\s+\w+\s*=/.test(text),
252
- /\blet\s+\w+\s*=/.test(text),
253
- /\bvar\s+\w+\s*=/.test(text),
254
- /\bimport\s+.*\s+from/.test(text),
255
- /\bexport\s+/.test(text),
256
- /\=\>\s*\{/.test(text),
257
- // Arrow func
258
- /console\.log\(/.test(text)
259
- ];
260
- const jsxPatterns = [
261
- /<\w+(>|\s+.*?>)[\s\S]*?<\/\w+>/m.test(text),
262
- /<\w+\s+\/>/m.test(text),
263
- /className=/.test(text),
264
- /React\.createElement/.test(text)
265
- ];
266
- const jsCount = jsPatterns.filter(Boolean).length;
267
- const jsxCount = jsxPatterns.filter(Boolean).length;
268
- if (jsxCount > 0 && (text.includes("import React") || text.includes('from "react"'))) return "text/jsx";
269
- if (jsxCount >= 2) return "text/jsx";
270
- if (jsCount >= 2) {
271
- const stripped = text.trim();
272
- if (stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]")) {
273
- try {
274
- JSON.parse(text);
275
- if (jsCount < 2) return null;
276
- } catch {
277
- }
278
- }
279
- return "text/javascript";
280
- }
281
- return null;
282
- }
283
- isTypescript(text) {
284
- const tsPatterns = [
285
- /:\s*(string|number|boolean|any|void|null|undefined)\b/,
286
- /\binterface\s+\w+\s*\{/,
287
- /\bclass\s+\w+\s+implements\s+\w+/,
288
- /\btype\s+\w+\s*=/,
289
- /\b(public|private|protected)\s+/,
290
- /\bnamespace\s+\w+\s*\{/,
291
- /<\w+>/
292
- // Generics (simple check)
293
- ];
294
- let count = 0;
295
- tsPatterns.forEach((p) => {
296
- if (p.test(text)) count++;
297
- });
298
- return count >= 2;
299
- }
300
- };
301
-
302
- // src/model/detectors/MarkupDetectors.ts
303
- var XMLDetector = class _XMLDetector {
304
- contentTypeName = "xml";
305
- static XML_DECLARATION = /^\s*<\?xml/i;
306
- static BASIC_TAG_PAIR = /<(\w+)[^>]*>.*?<\/\1>/s;
307
- detect(contentSample, lines, firstLine, fileExtension) {
308
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
309
- let confidence = 0;
310
- if (fileExtension && fileExtension.toLowerCase() === ".xml") {
311
- confidence = Math.max(confidence, 0.95);
312
- }
313
- if (_XMLDetector.XML_DECLARATION.test(firstLine) || text.trim().startsWith("<?xml")) {
314
- confidence = Math.max(confidence, 0.95);
315
- }
316
- if (text.includes("<") && text.includes(">") && text.includes("</")) {
317
- confidence = Math.max(confidence, 0.5);
318
- if (_XMLDetector.BASIC_TAG_PAIR.test(text)) {
319
- confidence = Math.max(confidence, 0.7);
320
- }
321
- }
322
- if (text.toLowerCase().includes("<!doctype html")) {
323
- if (confidence > 0.3) confidence -= 0.4;
324
- }
325
- return Math.min(Math.max(confidence, 0), 1);
326
- }
327
- getMimeType(contentSample, lines, firstLine, fileExtension) {
328
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
329
- if (fileExtension === ".xml") return "application/xml";
330
- if (text.toLowerCase().includes("<svg")) return "image/svg+xml";
331
- if (text.toLowerCase().includes("<html") || text.toLowerCase().includes("<!doctype html")) return "text/html";
332
- if (this.detect(contentSample, lines, firstLine, fileExtension) > 0.5) return "application/xml";
333
- return "text/plain";
334
- }
335
- };
336
- var MarkdownDetector = class _MarkdownDetector {
337
- contentTypeName = "markdown";
338
- static MD_PATTERNS = [
339
- /^#{1,6}\s+\S+/,
340
- // ATX Headers
341
- /^\s*[\*\+\-]\s+\S+/,
342
- // List items
343
- /^\s*\d+\.\s+\S+/,
344
- // Ordered list items
345
- /`{1,3}[^`]+`{1,3}/,
346
- // Inline code
347
- /\[[^\]]+\]\([^\)]+\)/,
348
- // Links
349
- /!\[[^\]]+\]\([^\)]+\)/,
350
- // Images
351
- /^\s*>.*/
352
- // Blockquotes
353
- ];
354
- static SETEXT_HEADER = /^.*\n(?:={3,}|-{3,})\s*$/m;
355
- detect(contentSample, lines, firstLine, fileExtension) {
356
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
357
- let confidence = 0;
358
- if (fileExtension && [".md", ".markdown"].includes(fileExtension.toLowerCase())) {
359
- confidence = Math.max(confidence, 0.95);
360
- }
361
- let mdFeatures = 0;
362
- if (_MarkdownDetector.SETEXT_HEADER.test(text)) mdFeatures += 2;
363
- for (const line of lines.slice(0, 20)) {
364
- if (_MarkdownDetector.MD_PATTERNS.some((p) => p.test(line))) {
365
- mdFeatures++;
366
- }
367
- }
368
- const hasCodeFence = text.includes("```");
369
- if (hasCodeFence) mdFeatures++;
370
- if (mdFeatures > 1 && hasCodeFence) confidence = Math.max(confidence, 0.85);
371
- if (mdFeatures > 3 && hasCodeFence) confidence = Math.max(confidence, 0.95);
372
- else if (mdFeatures > 1) confidence = Math.max(confidence, 0.6);
373
- else if (mdFeatures > 3) confidence = Math.max(confidence, 0.8);
374
- else if (mdFeatures > 5) confidence = Math.max(confidence, 0.9);
375
- const stripped = text.trim();
376
- if (stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]")) {
377
- try {
378
- JSON.parse(text);
379
- if (confidence > 0.3) confidence -= 0.4;
380
- } catch {
381
- }
382
- }
383
- if (stripped.startsWith("<") && text.includes("<?xml")) {
384
- if (confidence > 0.3) confidence -= 0.4;
385
- }
386
- return Math.min(Math.max(confidence, 0), 1);
387
- }
388
- getMimeType(contentSample, lines, firstLine, fileExtension) {
389
- return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/markdown" : "text/plain";
390
- }
391
- };
392
- var PlainTextDetector = class _PlainTextDetector {
393
- contentTypeName = "text";
394
- static IMAGE_EXTS = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg", ".webp"];
395
- detect(contentSample, lines, firstLine, fileExtension) {
396
- if (!contentSample && lines.length === 0) return 0.1;
397
- if (fileExtension) {
398
- const ext = fileExtension.toLowerCase();
399
- if (_PlainTextDetector.IMAGE_EXTS.includes(ext) || ext === ".pdf") return 0;
400
- }
401
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
402
- if (text.includes(",") && lines.length < 5) {
403
- const commaLines = lines.filter((l) => l.includes(",")).length;
404
- if (commaLines > 0 && commaLines === lines.length) {
405
- return 0.8;
406
- }
407
- }
408
- return 0.15;
409
- }
410
- getMimeType(contentSample, lines, firstLine, fileExtension) {
411
- return "text/plain";
412
- }
413
- };
414
-
415
- // src/model/detectors/DataFormatDetectors.ts
416
- var SQLDetector = class _SQLDetector {
417
- contentTypeName = "sql";
418
- // Keywords (case insensitive checking handled in method)
419
- static KEYWORDS = [
420
- "SELECT ",
421
- "INSERT ",
422
- "UPDATE ",
423
- "DELETE ",
424
- "CREATE ",
425
- "DROP ",
426
- "ALTER ",
427
- "FROM ",
428
- "WHERE ",
429
- "JOIN ",
430
- "TABLE ",
431
- "INTO ",
432
- "VALUES ",
433
- "SET ",
434
- "PRIMARY KEY"
435
- ];
436
- detect(contentSample, lines, firstLine, fileExtension) {
437
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
438
- let confidence = 0;
439
- if (fileExtension && fileExtension.toLowerCase() === ".sql") {
440
- confidence = Math.max(confidence, 0.95);
441
- }
442
- let hits = 0;
443
- const upperText = text.toUpperCase();
444
- for (const line of lines.slice(0, 10)) {
445
- const upperLine = line.toUpperCase();
446
- for (const kw of _SQLDetector.KEYWORDS) {
447
- if (upperLine.includes(kw)) {
448
- hits++;
449
- }
450
- }
451
- }
452
- if (hits >= 2) confidence = Math.max(confidence, 0.85);
453
- else if (hits === 1) confidence = Math.max(confidence, 0.6);
454
- return Math.min(confidence, 1);
455
- }
456
- getMimeType(contentSample, lines, firstLine, fileExtension) {
457
- return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/x-sql" : "text/plain";
458
- }
459
- };
460
- var JSONDetector = class {
461
- contentTypeName = "json";
462
- detect(contentSample, lines, firstLine, fileExtension) {
463
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
464
- if (fileExtension && fileExtension.toLowerCase() === ".json") {
465
- return this.verifyJsonStructure(text) ? 0.95 : 0.6;
466
- }
467
- const stripped = text.trim();
468
- if (!(stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]"))) {
469
- return 0;
470
- }
471
- for (const line of lines.slice(0, 5)) {
472
- const l = line.trim();
473
- if (l.startsWith("//") || l.startsWith("/*")) return 0;
474
- }
475
- try {
476
- JSON.parse(text);
477
- return 0.9;
478
- } catch (e) {
479
- return 0;
480
- }
481
- }
482
- getMimeType(contentSample, lines, firstLine, fileExtension) {
483
- return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "application/json" : "text/plain";
484
- }
485
- verifyJsonStructure(text) {
486
- try {
487
- JSON.parse(text);
488
- return true;
489
- } catch {
490
- return false;
491
- }
492
- }
493
- };
494
- var YAMLDetector = class _YAMLDetector {
495
- contentTypeName = "yaml";
496
- static YAML_START_PATTERNS = [/^---\s*$/, /^%YAML/];
497
- static KEY_VALUE_PATTERN = /^\s*[\w.-]+:\s+(?![=\{\[])/;
498
- static LIST_ITEM_PATTERN = /^\s*-\s+[\w\'\"]/;
499
- detect(contentSample, lines, firstLine, fileExtension) {
500
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
501
- let confidence = 0;
502
- if (fileExtension && [".yaml", ".yml"].includes(fileExtension.toLowerCase())) {
503
- confidence = Math.max(confidence, 0.95);
504
- }
505
- if (_YAMLDetector.YAML_START_PATTERNS.some((p) => p.test(firstLine))) {
506
- confidence = Math.max(confidence, 0.9);
507
- }
508
- let yamlFeatures = 0;
509
- if (_YAMLDetector.YAML_START_PATTERNS.some((p) => new RegExp(p.source, "m").test(text))) {
510
- yamlFeatures += 2;
511
- }
512
- for (const line of lines.slice(0, 20)) {
513
- const stripped = line.trim();
514
- if (_YAMLDetector.KEY_VALUE_PATTERN.test(stripped)) yamlFeatures++;
515
- else if (_YAMLDetector.LIST_ITEM_PATTERN.test(stripped)) yamlFeatures++;
516
- }
517
- const firstNonEmpty = lines.find((l) => l.trim().length > 0) || "";
518
- if (firstNonEmpty.trim() === "---") {
519
- if (yamlFeatures > 1) confidence = Math.max(confidence, 0.5);
520
- if (yamlFeatures > 3) confidence = Math.max(confidence, 0.75);
521
- if (yamlFeatures > 5) confidence = Math.max(confidence, 0.9);
522
- } else {
523
- if (fileExtension && [".yaml", ".yml"].includes(fileExtension.toLowerCase())) {
524
- }
525
- }
526
- return Math.min(Math.max(confidence, 0), 1);
527
- }
528
- getMimeType(contentSample, lines, firstLine, fileExtension) {
529
- const conf = this.detect(contentSample, lines, firstLine, fileExtension);
530
- return conf > 0.5 ? "application/x-yaml" : "text/plain";
531
- }
532
- };
533
- var CSVDetector = class {
534
- contentTypeName = "csv";
535
- detect(contentSample, lines, firstLine, fileExtension) {
536
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
537
- if (fileExtension && fileExtension.toLowerCase() === ".csv") {
538
- return this.verifyCsvStructure(lines) ? 0.95 : 0.6;
539
- }
540
- const hasComma = lines.some((l) => l.includes(","));
541
- if (hasComma) {
542
- if (lines.length < 3) {
543
- const commaLines = lines.filter((l) => l.includes(",")).length;
544
- if (commaLines > 0 && commaLines === lines.length) {
545
- const delimCounts = lines.filter((l) => l.trim()).map((l) => (l.match(/,/g) || []).length);
546
- if (delimCounts.length > 0 && delimCounts.every((c) => c <= 2)) {
547
- return 0;
548
- }
549
- }
550
- }
551
- }
552
- return this.analyzeCsvContent(lines);
553
- }
554
- getMimeType(contentSample, lines, firstLine, fileExtension) {
555
- return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/csv" : "text/plain";
556
- }
557
- verifyCsvStructure(lines) {
558
- const sampleLines = lines.slice(0, 10).filter((l) => l.trim().length > 0);
559
- if (sampleLines.length === 0) return false;
560
- if (!sampleLines.every((l) => l.includes(","))) return false;
561
- const counts = sampleLines.map((l) => (l.match(/,/g) || []).length);
562
- const uniqueCounts = [...new Set(counts)];
563
- if (uniqueCounts.length === 1 && uniqueCounts[0] > 0) return true;
564
- if (sampleLines.length > 1) {
565
- const dataCounts = counts.slice(1);
566
- const uniqueData = [...new Set(dataCounts)];
567
- if (uniqueData.length === 1 && uniqueData[0] > 0) return true;
568
- }
569
- return false;
570
- }
571
- analyzeCsvContent(lines) {
572
- if (!lines || lines.length === 0) return 0;
573
- const sampleLines = lines.slice(0, 10).filter((l) => l.trim().length > 0);
574
- if (sampleLines.length === 0 || !sampleLines.every((l) => l.includes(","))) return 0;
575
- const counts = sampleLines.map((l) => (l.match(/,/g) || []).length);
576
- const uniqueCounts = [...new Set(counts)];
577
- if (uniqueCounts.length === 1 && uniqueCounts[0] > 0) return 0.9;
578
- if (sampleLines.length > 1) {
579
- const dataCounts = counts.slice(1);
580
- const uniqueData = [...new Set(dataCounts)];
581
- if (uniqueData.length === 1 && uniqueData[0] > 0) return 0.8;
582
- }
583
- if (counts.every((c) => c > 0)) return 0.5;
584
- return 0;
585
- }
586
- };
587
-
588
- // src/model/detectors/OBJDetector.ts
589
- var OBJDetector = class _OBJDetector {
590
- contentTypeName = "obj";
591
- // Check for 'v ' (vertex), 'f ' (face), 'vn ', 'vt '
592
- static COMMANDS = ["v ", "vt ", "vn ", "f ", "g ", "o ", "s ", "mtllib ", "usemtl "];
593
- detect(contentSample, lines, firstLine, fileExtension) {
594
- const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
595
- let confidence = 0;
596
- if (fileExtension && fileExtension.toLowerCase() === ".obj") {
597
- confidence = Math.max(confidence, 0.95);
598
- }
599
- const validLines = lines.filter((l) => l.trim().length > 0 && !l.trim().startsWith("#"));
600
- let commandCount = 0;
601
- for (const line of validLines.slice(0, 20)) {
602
- const trimmed = line.trim();
603
- for (const cmd of _OBJDetector.COMMANDS) {
604
- if (trimmed.startsWith(cmd)) {
605
- commandCount++;
606
- break;
607
- }
608
- }
609
- }
610
- if (commandCount >= 2) {
611
- if (commandCount > 10) confidence = Math.max(confidence, 0.9);
612
- else if (commandCount > 5) confidence = Math.max(confidence, 0.8);
613
- else confidence = Math.max(confidence, 0.7);
614
- }
615
- const codeKeywords = ["def ", "class ", "import ", "function ", "var ", "let ", "const "];
616
- if (codeKeywords.some((k) => text.includes(k))) {
617
- return 0;
618
- }
619
- return Math.min(confidence, 1);
620
- }
621
- getMimeType(contentSample, lines, firstLine, fileExtension) {
622
- return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "application/3d-obj" : "text/plain";
623
- }
624
- };
625
-
626
- // src/model/detectors/registry.ts
627
- var DetectorRegistry = class {
628
- detectors;
629
- constructor() {
630
- this.detectors = [
631
- new BinarySignatureDetector(),
632
- // Programming languages
633
- new ProgrammingLanguageDetector(),
634
- // Structured data
635
- new XMLDetector(),
636
- new JSONDetector(),
637
- new OBJDetector(),
638
- // Markup
639
- new MarkdownDetector(),
640
- // Data formats (lower priority)
641
- new SQLDetector(),
642
- new CSVDetector(),
643
- new YAMLDetector(),
644
- // Fallback
645
- new PlainTextDetector()
646
- ];
647
- }
648
- /**
649
- * Get the active detectors.
650
- */
651
- getDetectors() {
652
- return this.detectors;
653
- }
654
- };
655
- var registry = new DetectorRegistry();
656
-
657
- // ../mime_extensions.json
658
- var mime_extensions_default = {
659
- textMimeTypes: [
660
- "text/plain",
661
- "text/html",
662
- "text/xml",
663
- "text/csv",
664
- "text/css",
665
- "text/javascript",
666
- "text/markdown",
667
- "text/x-python",
668
- "text/x-java",
669
- "text/x-c",
670
- "text/x-c++",
671
- "text/x-sql",
672
- "text/jsx",
673
- "text/typescript",
674
- "application/json",
675
- "application/xml",
676
- "application/x-yaml",
677
- "application/javascript",
678
- "application/x-httpd-php",
679
- "application/x-sh",
680
- "application/x-tex",
681
- "application/3d-obj",
682
- "text/vnd.graphviz",
683
- "text/x-mermaid",
684
- "text/x-plantuml",
685
- "application/x-properties",
686
- "application/toml"
687
- ],
688
- mimeToExtension: {
689
- "image/png": "png",
690
- "image/jpeg": "jpg",
691
- "image/gif": "gif",
692
- "image/bmp": "bmp",
693
- "image/x-icon": "ico",
694
- "image/svg+xml": "svg",
695
- "image/djvu": "djvu",
696
- "image/vnd.djvu": "djv",
697
- "image/webp": "webp",
698
- "audio/wav": "wav",
699
- "audio/x-wav": "wav",
700
- "video/mp4": "mp4",
701
- "video/quicktime": "mov",
702
- "application/pdf": "pdf",
703
- "application/msword": "doc",
704
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
705
- "application/vnd.ms-excel": "xls",
706
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
707
- "application/vnd.ms-powerpoint": "ppt",
708
- "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
709
- "application/zip": "zip",
710
- "application/gzip": "gz",
711
- "application/x-rar-compressed": "rar",
712
- "application/x-7z-compressed": "7z",
713
- "application/x-sqlite3": "db",
714
- "application/x-parquet": "parquet",
715
- "text/plain": "txt",
716
- "text/html": "html",
717
- "text/xml": "xml",
718
- "text/csv": "csv",
719
- "text/css": "css",
720
- "text/javascript": "js",
721
- "text/markdown": "md",
722
- "text/x-python": "py",
723
- "text/x-java": "java",
724
- "text/x-c": "c",
725
- "text/x-sql": "sql",
726
- "text/jsx": "js",
727
- "application/json": "json",
728
- "application/xml": "xml",
729
- "application/x-yaml": "yaml",
730
- "application/javascript": "js",
731
- "application/x-httpd-php": "php",
732
- "application/x-sh": "sh",
733
- "application/x-tex": "tex",
734
- "text/vnd.graphviz": "dot",
735
- "text/x-mermaid": "mmd",
736
- "text/x-plantuml": "puml",
737
- "application/3d-obj": "obj",
738
- "application/x-properties": "properties",
739
- "application/toml": "toml"
740
- }
741
- };
742
-
743
- // src/config/constants.ts
744
- var DEFAULT_PAGE_SIZE = 10;
745
- var DETECTION_SAMPLE_CAP = 8192;
746
- var MAX_FILE_SIZE = 50 * 1024 * 1024;
747
- var KNOWN_TYPE_SIZE_LIMIT = 1024 * 1024;
748
- var BINARY_CHECK_SAMPLE_SIZE = 32 * 1024;
749
- var CONTENT_DETECTION_SAMPLE_SIZE = 1024 * 1024;
750
- var DEFAULT_MAX_PROBLEM_BYTES = 2 * 1024 * 1024;
751
- var INDEXEDDB_DEFAULT_DB_NAME = "mcard-db";
752
- var INDEXEDDB_DEFAULT_DB_VERSION = 1;
753
- var SQLITE_BUSY_TIMEOUT_MS = 5e3;
754
- var DEFAULT_SQLJS_WASM_URL = "https://sql.js.org/dist/";
755
-
756
- // src/model/strategies/DetectionStrategy.ts
757
- function loadSharedMimeData() {
758
- return {
759
- textMimeTypes: new Set(mime_extensions_default.textMimeTypes || []),
760
- mimeToExtension: mime_extensions_default.mimeToExtension || {}
761
- };
762
- }
763
- var _sharedData = loadSharedMimeData();
764
- function withDot(ext) {
765
- return ext.startsWith(".") ? ext : `.${ext}`;
766
- }
767
- var DefaultDetectionStrategy = class _DefaultDetectionStrategy {
768
- constructor(customRegistry) {
769
- this.customRegistry = customRegistry;
770
- }
771
- // Loaded from the shared JSON
772
- static extensionsRegistry = Object.fromEntries(
773
- Object.entries(_sharedData.mimeToExtension).map(([k, v]) => [k, withDot(v)])
774
- );
775
- static textMimeTypes = _sharedData.textMimeTypes;
776
- static registerExtension(mimeType, extension) {
777
- this.extensionsRegistry[mimeType] = extension;
778
- }
779
- static loadExtensions(mapping) {
780
- for (const [mime, ext] of Object.entries(mapping)) {
781
- this.extensionsRegistry[mime] = ext;
782
- }
783
- }
784
- static getExtension(mimeType) {
785
- return this.extensionsRegistry[mimeType] || "";
786
- }
787
- detect(content, fileExtension) {
788
- const contentSample = typeof content === "string" ? content.slice(0, DETECTION_SAMPLE_CAP) : content.slice(0, DETECTION_SAMPLE_CAP);
789
- const textSample = this.getTextSample(contentSample);
790
- const lines = textSample.split("\n").slice(0, 20);
791
- const firstLine = lines[0] || "";
792
- const detectors = this.customRegistry ? this.customRegistry.getDetectors() : registry.getDetectors();
793
- let bestConfidence = 0;
794
- let mimeType = "text/plain";
795
- for (const detector of detectors) {
796
- const confidence = detector.detect(contentSample, lines, firstLine, fileExtension);
797
- if (confidence > bestConfidence) {
798
- const detectedMime = detector.getMimeType(contentSample, lines, firstLine, fileExtension);
799
- if (detectedMime) {
800
- bestConfidence = confidence;
801
- mimeType = detectedMime;
802
- if (confidence >= 0.99) break;
803
- }
804
- }
805
- }
806
- let extension = this.getExtension(mimeType);
807
- if (fileExtension && extension) {
808
- if (fileExtension.toLowerCase() === extension || fileExtension.toLowerCase() === `.${extension}`) {
809
- extension = fileExtension;
810
- }
811
- }
812
- if (!extension && fileExtension) {
813
- extension = fileExtension;
814
- }
815
- if (!extension) {
816
- extension = ".txt";
817
- }
818
- return { mimeType, extension };
819
- }
820
- getTextSample(content) {
821
- if (typeof content === "string") {
822
- return content.slice(0, DETECTION_SAMPLE_CAP);
823
- }
824
- return new TextDecoder("utf-8", { fatal: false }).decode(content.slice(0, DETECTION_SAMPLE_CAP));
825
- }
826
- getExtension(mimeType) {
827
- return _DefaultDetectionStrategy.getExtension(mimeType);
828
- }
829
- };
830
-
831
- // src/model/utils/ContentAnalyzer.ts
832
- var ContentAnalyzer = class {
833
- /**
834
- * Check if content should be treated as binary.
835
- */
836
- static isBinaryContent(content, mimeType) {
837
- if (mimeType) {
838
- if (mimeType.startsWith("text/") || mimeType.includes("json") || mimeType.includes("xml") || mimeType.includes("javascript") || mimeType.includes("ecmascript")) {
839
- return false;
840
- }
841
- return true;
842
- }
843
- if (typeof content === "string") return false;
844
- if (content.indexOf(0) !== -1) {
845
- return true;
846
- }
847
- try {
848
- const decoder = new TextDecoder("utf-8", { fatal: true });
849
- const decoded = decoder.decode(content);
850
- const sample = content.slice(0, 4096);
851
- if (sample.length === 0) return false;
852
- let nonTextChars = 0;
853
- for (let i = 0; i < sample.length; i++) {
854
- const b = sample[i];
855
- if (b < 9 || b > 13 && b < 32 || b > 126) {
856
- nonTextChars++;
857
- }
858
- }
859
- const textRatio = 1 - nonTextChars / sample.length;
860
- return textRatio < 0.7;
861
- } catch (e) {
862
- return true;
863
- }
864
- }
865
- static isKnownLongLineExtension(extension) {
866
- if (!extension) return false;
867
- const ext = extension.toLowerCase();
868
- return [".min.js", ".min.css", ".map", ".svg", ".json", ".geojson"].some((e) => ext.endsWith(e));
869
- }
870
- static isUnstructuredBinary(sample) {
871
- if (sample.length < 512) return false;
872
- let nullCount = 0;
873
- let controlCount = 0;
874
- const len = Math.min(sample.length, 32 * 1024);
875
- for (let i = 0; i < len; i++) {
876
- const byte = sample[i];
877
- if (byte === 0) {
878
- nullCount++;
879
- }
880
- if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) {
881
- controlCount++;
882
- }
883
- }
884
- const nullRatio = nullCount / len;
885
- const controlRatio = controlCount / len;
886
- return nullRatio > 0.1 || controlRatio > 0.2;
887
- }
888
- static hasPathologicalLines(sample, isKnownType) {
889
- if (isKnownType || sample.length < 32768) return false;
890
- for (let i = 0; i < sample.length; i++) {
891
- if (sample[i] === 10 || sample[i] === 13) return false;
892
- }
893
- return true;
894
- }
895
- };
896
-
897
- // src/model/ContentTypeInterpreter.ts
898
- var ContentTypeInterpreter = class {
899
- static strategy = new DefaultDetectionStrategy();
900
- /**
901
- * Convenience method to detect MIME type only.
902
- * Matches the API expected by MCard/PCard/VCard.
903
- */
904
- static detect(content) {
905
- return this.detectContentType(content).mimeType;
906
- }
907
- /**
908
- * Detect content type and suggest extension.
909
- *
910
- * @param content Content string or binary buffer
911
- * @param fileExtension Optional file extension hint
912
- * @returns Object containing detected mimeType and suggested extension
913
- */
914
- static detectContentType(content, fileExtension) {
915
- return this.strategy.detect(content, fileExtension);
916
- }
917
- static registerExtension(mimeType, extension) {
918
- DefaultDetectionStrategy.registerExtension(mimeType, extension);
919
- }
920
- static registerExtensions(mapping) {
921
- DefaultDetectionStrategy.loadExtensions(mapping);
922
- }
923
- static getExtension(mimeType) {
924
- return DefaultDetectionStrategy.getExtension(mimeType);
925
- }
926
- /**
927
- * Check if content should be treated as binary.
928
- */
929
- static isBinaryContent(content, mimeType) {
930
- return ContentAnalyzer.isBinaryContent(content, mimeType);
931
- }
932
- static isKnownLongLineExtension(extension) {
933
- return ContentAnalyzer.isKnownLongLineExtension(extension);
934
- }
935
- static isUnstructuredBinary(sample) {
936
- return ContentAnalyzer.isUnstructuredBinary(sample);
937
- }
938
- static hasPathologicalLines(sample, isKnownType) {
939
- return ContentAnalyzer.hasPathologicalLines(sample, isKnownType);
940
- }
941
- };
942
-
943
- // src/types/dots.ts
944
- function createMCardDOTSMetadata(tightRefs = [], looseRefs = []) {
945
- return {
946
- role: "Carrier" /* CARRIER */,
947
- eosRole: "InvariantContent" /* INVARIANT_CONTENT */,
948
- plane: "Data" /* DATA */,
949
- tightRefs,
950
- looseRefs
951
- };
952
- }
953
- function createPCardDOTSMetadata(isLens, tightRefs = [], looseRefs = []) {
954
- return {
955
- role: isLens ? "Lens" /* LENS */ : "Chart" /* CHART */,
956
- eosRole: "GenerativeLens" /* GENERATIVE_LENS */,
957
- plane: "Control" /* CONTROL */,
958
- tightRefs,
959
- looseRefs
960
- };
961
- }
962
- function createVCardDOTSMetadata() {
963
- return {
964
- role: "Arena" /* ARENA */,
965
- eosRole: "SovereignDecision" /* SOVEREIGN_DECISION */,
966
- plane: "Application" /* APPLICATION */
967
- };
968
- }
969
-
970
- // src/model/MCard.ts
971
- var MCard = class _MCard {
972
- content;
973
- hash;
974
- g_time;
975
- contentType;
976
- // Defaulting to specific string or null
977
- hashFunction;
978
- constructor(content, hash, g_time, contentType, hashFunction) {
979
- this.content = content;
980
- this.hash = hash;
981
- this.g_time = g_time;
982
- this.contentType = contentType;
983
- this.hashFunction = hashFunction;
984
- }
985
- /**
986
- * Create a new MCard from content
987
- */
988
- static async create(content, hashAlgorithm = "sha256") {
989
- if (content === null || content === void 0) {
990
- throw new Error("Content cannot be null or undefined");
991
- }
992
- const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content;
993
- if (bytes.length === 0) {
994
- throw new Error("Content cannot be empty");
995
- }
996
- const hash = await HashValidator.computeHash(bytes, hashAlgorithm);
997
- const g_time = GTime.stampNow(hashAlgorithm);
998
- const contentType = ContentTypeInterpreter.detect(bytes);
999
- return new _MCard(bytes, hash, g_time, contentType, hashAlgorithm);
1000
- }
1001
- /**
1002
- * Create an MCard from existing data (e.g., from database)
1003
- */
1004
- static fromData(content, hash, g_time) {
1005
- const alg = GTime.getHashAlgorithm(g_time);
1006
- const contentType = ContentTypeInterpreter.detect(content);
1007
- return new _MCard(content, hash, g_time, contentType, alg);
1008
- }
1009
- /**
1010
- * Get content as text (UTF-8 decoded)
1011
- */
1012
- getContentAsText() {
1013
- return new TextDecoder().decode(this.content);
1014
- }
1015
- /**
1016
- * Get content as raw bytes
1017
- */
1018
- getContent() {
1019
- return this.content;
1020
- }
1021
- /**
1022
- * Convert to plain object
1023
- */
1024
- toObject() {
1025
- return {
1026
- hash: this.hash,
1027
- content: this.getContentAsText(),
1028
- g_time: this.g_time,
1029
- contentType: this.contentType,
1030
- hashFunction: this.hashFunction
1031
- };
1032
- }
1033
- /**
1034
- * Get DOTS vocabulary metadata for this MCard
1035
- *
1036
- * Returns the DOTS role information that positions this MCard
1037
- * in the Double Operadic Theory of Systems framework.
1038
- *
1039
- * MCard is always a CARRIER object in the Data Plane.
1040
- *
1041
- * @param tightRefs - Optional array of prerequisite MCard hashes (vertical composition)
1042
- * @param looseRefs - Optional array of alternative MCard hashes (horizontal composition)
1043
- * @returns DOTSMetadata describing this card's role in the compositional system
1044
- *
1045
- * @example
1046
- * ```typescript
1047
- * const card = await MCard.create('Hello World');
1048
- * const meta = card.getDOTSMetadata();
1049
- * console.log(meta.role); // 'Carrier'
1050
- * console.log(meta.plane); // 'Data'
1051
- * ```
1052
- */
1053
- getDOTSMetadata(tightRefs = [], looseRefs = []) {
1054
- return createMCardDOTSMetadata(tightRefs, looseRefs);
1055
- }
1056
- };
1057
-
1058
- export {
1059
- DEFAULT_PAGE_SIZE,
1060
- INDEXEDDB_DEFAULT_DB_NAME,
1061
- INDEXEDDB_DEFAULT_DB_VERSION,
1062
- SQLITE_BUSY_TIMEOUT_MS,
1063
- DEFAULT_SQLJS_WASM_URL,
1064
- ContentTypeInterpreter,
1065
- createPCardDOTSMetadata,
1066
- createVCardDOTSMetadata,
1067
- MCard
1068
- };