solve-engine 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -17
- package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
- package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
- package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
- package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
- package/dist/{EngineError-CNA_rHY-.d.cts → EngineError-Ce1lPkjZ.d.cts} +2 -0
- package/dist/{EngineError-CNA_rHY-.d.ts → EngineError-Ce1lPkjZ.d.ts} +2 -0
- package/dist/{PackageCompatibility-B6NX9IaN.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
- package/dist/{PackageCompatibility-Ceg5XdAp.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
- package/dist/{PackageRegistry-DrCPQNyy.d.ts → PackageRegistry-DzeiWcv4.d.ts} +93 -172
- package/dist/{PackageRegistry-DnJYVw9G.d.cts → PackageRegistry-dpdurBVO.d.cts} +93 -172
- package/dist/{Parselet-Bhf7d0_W.d.ts → Parselet-B-zoPrTa.d.ts} +8 -5
- package/dist/{Parselet-Cv7S7KRt.d.cts → Parselet-C4Wu055_.d.cts} +8 -5
- package/dist/{ScopeManager-Bzq87GfA.d.ts → ScopeManager-C2LDOrDx.d.ts} +7 -16
- package/dist/{ScopeManager-DRDBVfan.d.cts → ScopeManager-D7uMXbhS.d.cts} +7 -16
- package/dist/{VMCheckpoints-C6c17Hbo.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
- package/dist/{VMCheckpoints-dZxSMGHG.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
- package/dist/{Value-DZNQ_PU7.d.cts → Value-CCi_Eecs.d.cts} +40 -0
- package/dist/{Value-DZNQ_PU7.d.ts → Value-CCi_Eecs.d.ts} +40 -0
- package/dist/{WorkerError-Djd7GGGa.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
- package/dist/{WorkerError-B7t7R2-m.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
- package/dist/chunk-2JMFUQZH.js +2 -0
- package/dist/chunk-2JMFUQZH.js.map +1 -0
- package/dist/chunk-2RWAXT6O.js +0 -1
- package/dist/chunk-4BZIYU7S.cjs +3 -0
- package/dist/chunk-4BZIYU7S.cjs.map +1 -0
- package/dist/chunk-4J7XZSZJ.cjs +5 -0
- package/dist/chunk-4J7XZSZJ.cjs.map +1 -0
- package/dist/chunk-4QVBSG6B.cjs +2 -0
- package/dist/chunk-4QVBSG6B.cjs.map +1 -0
- package/dist/chunk-5IJD5L3O.cjs +2 -0
- package/dist/chunk-5IJD5L3O.cjs.map +1 -0
- package/dist/chunk-62LMTO4F.js +2 -0
- package/dist/chunk-62LMTO4F.js.map +1 -0
- package/dist/chunk-6CY44ZPG.js +2 -0
- package/dist/chunk-6CY44ZPG.js.map +1 -0
- package/dist/chunk-6G3PMEPA.js +2 -0
- package/dist/chunk-6G3PMEPA.js.map +1 -0
- package/dist/chunk-6INX773F.cjs +2 -0
- package/dist/chunk-6INX773F.cjs.map +1 -0
- package/dist/chunk-6KFVG6UY.cjs +2 -0
- package/dist/{chunk-YJHY7CMN.cjs.map → chunk-6KFVG6UY.cjs.map} +1 -1
- package/dist/chunk-76F3LCIL.js +4 -0
- package/dist/chunk-76F3LCIL.js.map +1 -0
- package/dist/chunk-7GK3XEZF.js +2 -0
- package/dist/chunk-7GK3XEZF.js.map +1 -0
- package/dist/chunk-APN442VD.cjs +2 -0
- package/dist/chunk-APN442VD.cjs.map +1 -0
- package/dist/chunk-AXMQG5TS.cjs +2 -0
- package/dist/chunk-AXMQG5TS.cjs.map +1 -0
- package/dist/chunk-CIQOK7Q4.cjs +2 -0
- package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
- package/dist/chunk-E6Z4NQAS.js +2 -0
- package/dist/chunk-E6Z4NQAS.js.map +1 -0
- package/dist/chunk-EFJCC6FJ.cjs +2 -0
- package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
- package/dist/chunk-ESUN2THE.cjs +2 -0
- package/dist/chunk-ESUN2THE.cjs.map +1 -0
- package/dist/chunk-EVAOPEO4.js +2 -0
- package/dist/chunk-EVAOPEO4.js.map +1 -0
- package/dist/chunk-EYRBENHC.js +3 -0
- package/dist/chunk-EYRBENHC.js.map +1 -0
- package/dist/chunk-FDE5HWDI.cjs +2 -0
- package/dist/chunk-FDE5HWDI.cjs.map +1 -0
- package/dist/chunk-FWW3M36J.cjs +2 -0
- package/dist/chunk-FWW3M36J.cjs.map +1 -0
- package/dist/chunk-GOIQYUWV.js +2 -0
- package/dist/chunk-GOIQYUWV.js.map +1 -0
- package/dist/chunk-HFKDWQUL.js +2 -0
- package/dist/chunk-HFKDWQUL.js.map +1 -0
- package/dist/chunk-HLBYHXQD.cjs +3 -0
- package/dist/chunk-HLBYHXQD.cjs.map +1 -0
- package/dist/chunk-IANAMBJQ.cjs +2 -0
- package/dist/chunk-IANAMBJQ.cjs.map +1 -0
- package/dist/chunk-IJMNVBIS.js +2 -0
- package/dist/chunk-IJMNVBIS.js.map +1 -0
- package/dist/chunk-J4LZD4ZY.js +3 -0
- package/dist/chunk-J4LZD4ZY.js.map +1 -0
- package/dist/chunk-JAK3RAFA.cjs +2 -0
- package/dist/chunk-JAK3RAFA.cjs.map +1 -0
- package/dist/chunk-JFAJN3C2.cjs +2 -0
- package/dist/chunk-JFAJN3C2.cjs.map +1 -0
- package/dist/chunk-JPFCXLJV.js +2 -0
- package/dist/chunk-JPFCXLJV.js.map +1 -0
- package/dist/chunk-JSPKKNPQ.js +3 -0
- package/dist/chunk-JSPKKNPQ.js.map +1 -0
- package/dist/chunk-L3FPQSGN.js +2 -0
- package/dist/chunk-L3FPQSGN.js.map +1 -0
- package/dist/chunk-LR4E4A4W.cjs +2 -0
- package/dist/chunk-LR4E4A4W.cjs.map +1 -0
- package/dist/chunk-MIQBJGGR.js +2 -0
- package/dist/chunk-MIQBJGGR.js.map +1 -0
- package/dist/chunk-MPB7KUN5.js +3 -0
- package/dist/chunk-MPB7KUN5.js.map +1 -0
- package/dist/chunk-MSYX32PF.cjs +2 -0
- package/dist/chunk-MSYX32PF.cjs.map +1 -0
- package/dist/chunk-MVZUTETT.js +2 -0
- package/dist/chunk-MVZUTETT.js.map +1 -0
- package/dist/chunk-N7N7MPMK.cjs +2 -0
- package/dist/chunk-N7N7MPMK.cjs.map +1 -0
- package/dist/chunk-NGBBNL4K.cjs +1 -3
- package/dist/chunk-P6WPEUAJ.cjs +2 -0
- package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
- package/dist/chunk-PS272DZJ.cjs +2 -0
- package/dist/chunk-PS272DZJ.cjs.map +1 -0
- package/dist/chunk-QXQE7X4S.js +2 -0
- package/dist/chunk-QXQE7X4S.js.map +1 -0
- package/dist/chunk-R2ENWQ76.js +2 -0
- package/dist/chunk-R2ENWQ76.js.map +1 -0
- package/dist/chunk-R2SZFJTT.cjs +2 -0
- package/dist/chunk-R2SZFJTT.cjs.map +1 -0
- package/dist/chunk-RAF57WYO.js +2 -0
- package/dist/chunk-RAF57WYO.js.map +1 -0
- package/dist/chunk-RSF25YSJ.js +2 -0
- package/dist/chunk-RSF25YSJ.js.map +1 -0
- package/dist/chunk-SOMGSIO4.cjs +3 -0
- package/dist/chunk-SOMGSIO4.cjs.map +1 -0
- package/dist/chunk-SUXRZWH2.cjs +3 -0
- package/dist/chunk-SUXRZWH2.cjs.map +1 -0
- package/dist/chunk-SYYE3QAX.cjs +2 -0
- package/dist/chunk-SYYE3QAX.cjs.map +1 -0
- package/dist/chunk-SZGK6RIP.cjs +2 -0
- package/dist/chunk-SZGK6RIP.cjs.map +1 -0
- package/dist/chunk-TCZSPH4A.js +2 -0
- package/dist/chunk-TCZSPH4A.js.map +1 -0
- package/dist/chunk-TLG7VZRX.cjs +2 -0
- package/dist/chunk-TLG7VZRX.cjs.map +1 -0
- package/dist/chunk-TRBXW6HW.js +2 -0
- package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
- package/dist/chunk-TTFO4YDP.cjs +2 -0
- package/dist/chunk-TTFO4YDP.cjs.map +1 -0
- package/dist/chunk-TWC7K3ZX.js +2 -0
- package/dist/chunk-TWC7K3ZX.js.map +1 -0
- package/dist/chunk-UDQ57ZRX.cjs +2 -0
- package/dist/chunk-UDQ57ZRX.cjs.map +1 -0
- package/dist/chunk-UI6IFGBT.js +2 -0
- package/dist/chunk-UI6IFGBT.js.map +1 -0
- package/dist/chunk-UURM7P3P.cjs +4 -0
- package/dist/chunk-UURM7P3P.cjs.map +1 -0
- package/dist/chunk-W2JAR233.js +2 -0
- package/dist/chunk-W2JAR233.js.map +1 -0
- package/dist/chunk-WGZ3FNHI.js +2 -0
- package/dist/chunk-WGZ3FNHI.js.map +1 -0
- package/dist/chunk-WN5CMP4T.cjs +3 -0
- package/dist/chunk-WN5CMP4T.cjs.map +1 -0
- package/dist/chunk-XEIDV5JP.js +2 -0
- package/dist/chunk-XEIDV5JP.js.map +1 -0
- package/dist/chunk-XNIWQHXY.js +2 -0
- package/dist/chunk-XNIWQHXY.js.map +1 -0
- package/dist/chunk-XR7HEC7B.js +5 -0
- package/dist/chunk-XR7HEC7B.js.map +1 -0
- package/dist/chunk-Y7O4D3BJ.cjs +2 -0
- package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
- package/dist/chunk-YAYBVVG2.js +3 -0
- package/dist/chunk-YAYBVVG2.js.map +1 -0
- package/dist/chunk-YJ2OPULK.js +2 -0
- package/dist/chunk-YJ2OPULK.js.map +1 -0
- package/dist/chunk-YVKHEAFT.js +2 -0
- package/dist/chunk-YVKHEAFT.js.map +1 -0
- package/dist/chunk-ZCNBT44X.cjs +2 -0
- package/dist/chunk-ZCNBT44X.cjs.map +1 -0
- package/dist/chunk-ZLRJ7TDP.cjs +2 -0
- package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
- package/dist/constants.cjs +1 -21
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -4
- package/dist/engine.cjs +1 -94
- package/dist/engine.d.cts +10 -11
- package/dist/engine.d.ts +10 -11
- package/dist/engine.js +1 -37
- package/dist/errors.cjs +1 -105
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +1 -4
- package/dist/format.cjs +1 -26
- package/dist/format.d.cts +2 -2
- package/dist/format.d.ts +2 -2
- package/dist/format.js +1 -9
- package/dist/index.cjs +1 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -20
- package/dist/index.d.ts +52 -20
- package/dist/index.js +1 -278
- package/dist/index.js.map +1 -1
- package/dist/language.cjs +1 -369
- package/dist/language.cjs.map +1 -1
- package/dist/language.d.cts +9 -10
- package/dist/language.d.ts +9 -10
- package/dist/language.js +1 -348
- package/dist/language.js.map +1 -1
- package/dist/lexer.cjs +1 -63
- package/dist/lexer.js +1 -10
- package/dist/normalizer.cjs +1 -39
- package/dist/normalizer.js +1 -10
- package/dist/packages.cjs +1 -132
- package/dist/packages.d.cts +8 -9
- package/dist/packages.d.ts +8 -9
- package/dist/packages.js +1 -23
- package/dist/parser.cjs +1 -54
- package/dist/parser.d.cts +8 -8
- package/dist/parser.d.ts +8 -8
- package/dist/parser.js +1 -9
- package/dist/{pipeline-D-PS9gVw.d.ts → pipeline-72QmQlGx.d.ts} +1 -1
- package/dist/{pipeline-DtSBJ8TS.d.cts → pipeline-DCQicwWX.d.cts} +1 -1
- package/dist/resolvers.cjs +1 -12
- package/dist/resolvers.d.cts +2 -2
- package/dist/resolvers.d.ts +2 -2
- package/dist/resolvers.js +1 -3
- package/dist/services.cjs +1 -20
- package/dist/services.js +1 -3
- package/dist/testing.cjs +3 -477
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +9 -10
- package/dist/testing.d.ts +9 -10
- package/dist/testing.js +3 -469
- package/dist/testing.js.map +1 -1
- package/dist/uom.cjs +1 -55
- package/dist/uom.d.cts +2 -2
- package/dist/uom.d.ts +2 -2
- package/dist/uom.js +1 -10
- package/dist/utilities.cjs +1 -36
- package/dist/utilities.js +1 -7
- package/dist/vm.cjs +1 -295
- package/dist/vm.cjs.map +1 -1
- package/dist/vm.d.cts +22 -10
- package/dist/vm.d.ts +22 -10
- package/dist/vm.js +1 -193
- package/dist/vm.js.map +1 -1
- package/dist/worker.cjs +2 -492
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +16 -17
- package/dist/worker.d.ts +16 -17
- package/dist/worker.js +2 -483
- package/dist/worker.js.map +1 -1
- package/package.json +1 -13
- package/dist/chunk-3BOK2LDK.js +0 -17
- package/dist/chunk-3BOK2LDK.js.map +0 -1
- package/dist/chunk-3VGDNEE3.js +0 -84
- package/dist/chunk-3VGDNEE3.js.map +0 -1
- package/dist/chunk-4K5W7EH2.cjs +0 -112
- package/dist/chunk-4K5W7EH2.cjs.map +0 -1
- package/dist/chunk-5EFKSKMA.js +0 -413
- package/dist/chunk-5EFKSKMA.js.map +0 -1
- package/dist/chunk-5HRB36DK.js +0 -405
- package/dist/chunk-5HRB36DK.js.map +0 -1
- package/dist/chunk-5ON7PUAZ.js +0 -12
- package/dist/chunk-5ON7PUAZ.js.map +0 -1
- package/dist/chunk-7AXJNQMF.cjs +0 -297
- package/dist/chunk-7AXJNQMF.cjs.map +0 -1
- package/dist/chunk-7JM3F4KL.js +0 -1795
- package/dist/chunk-7JM3F4KL.js.map +0 -1
- package/dist/chunk-7USV76HV.cjs +0 -341
- package/dist/chunk-7USV76HV.cjs.map +0 -1
- package/dist/chunk-A2DZ5BEJ.cjs +0 -1930
- package/dist/chunk-A2DZ5BEJ.cjs.map +0 -1
- package/dist/chunk-ADBA3XBE.cjs +0 -20
- package/dist/chunk-ADBA3XBE.cjs.map +0 -1
- package/dist/chunk-AKNGX4TZ.cjs +0 -236
- package/dist/chunk-AKNGX4TZ.cjs.map +0 -1
- package/dist/chunk-ALYRJ72W.cjs +0 -434
- package/dist/chunk-ALYRJ72W.cjs.map +0 -1
- package/dist/chunk-AMOJYLG2.cjs +0 -1692
- package/dist/chunk-AMOJYLG2.cjs.map +0 -1
- package/dist/chunk-AOH6UR2L.js +0 -825
- package/dist/chunk-AOH6UR2L.js.map +0 -1
- package/dist/chunk-AQNHHJMJ.cjs +0 -261
- package/dist/chunk-B7LXJ6LC.cjs +0 -36
- package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
- package/dist/chunk-BESTLPRK.cjs +0 -6919
- package/dist/chunk-BESTLPRK.cjs.map +0 -1
- package/dist/chunk-BLI4NIQY.js +0 -98
- package/dist/chunk-BLI4NIQY.js.map +0 -1
- package/dist/chunk-BSPXMGIS.js +0 -455
- package/dist/chunk-BSPXMGIS.js.map +0 -1
- package/dist/chunk-C2OMO3WN.cjs +0 -2806
- package/dist/chunk-C2OMO3WN.cjs.map +0 -1
- package/dist/chunk-CSDQMDU2.js +0 -204
- package/dist/chunk-CSDQMDU2.js.map +0 -1
- package/dist/chunk-EJ3ILXX6.cjs +0 -223
- package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
- package/dist/chunk-ENRIK36Q.cjs +0 -94
- package/dist/chunk-ENRIK36Q.cjs.map +0 -1
- package/dist/chunk-F4UB4XIL.js +0 -109
- package/dist/chunk-F4UB4XIL.js.map +0 -1
- package/dist/chunk-FD5ZZHEU.js +0 -92
- package/dist/chunk-FD5ZZHEU.js.map +0 -1
- package/dist/chunk-FE4RC37D.js +0 -2801
- package/dist/chunk-FE4RC37D.js.map +0 -1
- package/dist/chunk-FEAIOR7N.cjs +0 -91
- package/dist/chunk-FEAIOR7N.cjs.map +0 -1
- package/dist/chunk-FR7RNOPT.cjs +0 -3303
- package/dist/chunk-FR7RNOPT.cjs.map +0 -1
- package/dist/chunk-G2YPPLGX.cjs +0 -484
- package/dist/chunk-G2YPPLGX.cjs.map +0 -1
- package/dist/chunk-GCM5JHMX.js +0 -88
- package/dist/chunk-GCM5JHMX.js.map +0 -1
- package/dist/chunk-GDEU72RG.cjs +0 -829
- package/dist/chunk-GDEU72RG.cjs.map +0 -1
- package/dist/chunk-HKTQCQ4Z.cjs +0 -8383
- package/dist/chunk-HKTQCQ4Z.cjs.map +0 -1
- package/dist/chunk-HWHU642X.cjs +0 -316
- package/dist/chunk-HWHU642X.cjs.map +0 -1
- package/dist/chunk-ICEKS6YC.cjs +0 -507
- package/dist/chunk-ICEKS6YC.cjs.map +0 -1
- package/dist/chunk-IJGOFP2J.js +0 -6904
- package/dist/chunk-IJGOFP2J.js.map +0 -1
- package/dist/chunk-IQJGDZOP.js +0 -333
- package/dist/chunk-IQJGDZOP.js.map +0 -1
- package/dist/chunk-IT74O4BE.cjs +0 -456
- package/dist/chunk-IT74O4BE.cjs.map +0 -1
- package/dist/chunk-KXDQKVNX.cjs +0 -459
- package/dist/chunk-KXDQKVNX.cjs.map +0 -1
- package/dist/chunk-L2TE7PMO.cjs +0 -14
- package/dist/chunk-L2TE7PMO.cjs.map +0 -1
- package/dist/chunk-L5YHV6BQ.js +0 -499
- package/dist/chunk-L5YHV6BQ.js.map +0 -1
- package/dist/chunk-LO7HU5WB.cjs +0 -209
- package/dist/chunk-LO7HU5WB.cjs.map +0 -1
- package/dist/chunk-LSALB3IN.js +0 -292
- package/dist/chunk-LSALB3IN.js.map +0 -1
- package/dist/chunk-MI7OTUHL.cjs +0 -339
- package/dist/chunk-MI7OTUHL.cjs.map +0 -1
- package/dist/chunk-MIGXCBXT.cjs +0 -381
- package/dist/chunk-MIGXCBXT.cjs.map +0 -1
- package/dist/chunk-MVTOCRV2.js +0 -213
- package/dist/chunk-MVTOCRV2.js.map +0 -1
- package/dist/chunk-N7FNVFXW.cjs +0 -32
- package/dist/chunk-N7FNVFXW.cjs.map +0 -1
- package/dist/chunk-N7OA4WPJ.js +0 -362
- package/dist/chunk-N7OA4WPJ.js.map +0 -1
- package/dist/chunk-NAWZATKT.js +0 -478
- package/dist/chunk-NAWZATKT.js.map +0 -1
- package/dist/chunk-NLNDMWZC.js +0 -31
- package/dist/chunk-NLNDMWZC.js.map +0 -1
- package/dist/chunk-ORM7CHYZ.js +0 -1531
- package/dist/chunk-ORM7CHYZ.js.map +0 -1
- package/dist/chunk-OUHT5Z36.cjs +0 -393
- package/dist/chunk-OUHT5Z36.cjs.map +0 -1
- package/dist/chunk-PCZVMMWU.cjs +0 -74
- package/dist/chunk-PCZVMMWU.cjs.map +0 -1
- package/dist/chunk-RNKDIXDV.js +0 -336
- package/dist/chunk-RNKDIXDV.js.map +0 -1
- package/dist/chunk-SBUFNJVE.js +0 -258
- package/dist/chunk-SBUFNJVE.js.map +0 -1
- package/dist/chunk-TC6BTUSU.cjs +0 -1799
- package/dist/chunk-TC6BTUSU.cjs.map +0 -1
- package/dist/chunk-TPOK3UNI.js +0 -8355
- package/dist/chunk-TPOK3UNI.js.map +0 -1
- package/dist/chunk-UF6JG5SG.js +0 -312
- package/dist/chunk-UF6JG5SG.js.map +0 -1
- package/dist/chunk-UKQHXPGW.js +0 -30
- package/dist/chunk-UKQHXPGW.js.map +0 -1
- package/dist/chunk-V4XG5QF6.js +0 -1685
- package/dist/chunk-V4XG5QF6.js.map +0 -1
- package/dist/chunk-VEKIWQ3F.cjs +0 -39
- package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
- package/dist/chunk-WMQRJTAO.js +0 -3266
- package/dist/chunk-WMQRJTAO.js.map +0 -1
- package/dist/chunk-X6K3HUOY.cjs +0 -86
- package/dist/chunk-X6K3HUOY.cjs.map +0 -1
- package/dist/chunk-XBTEO4OB.js +0 -391
- package/dist/chunk-XBTEO4OB.js.map +0 -1
- package/dist/chunk-XIYYHA65.cjs +0 -101
- package/dist/chunk-XIYYHA65.cjs.map +0 -1
- package/dist/chunk-YJHY7CMN.cjs +0 -1534
- package/dist/chunk-YLJ4XMA6.js +0 -33
- package/dist/chunk-YLJ4XMA6.js.map +0 -1
- package/dist/chunk-YNIWOYW6.js +0 -232
- package/dist/chunk-YNIWOYW6.js.map +0 -1
- package/dist/chunk-Z2XP767T.cjs +0 -35
- package/dist/chunk-Z2XP767T.cjs.map +0 -1
- package/dist/chunk-Z4X2RWOF.js +0 -37
- package/dist/chunk-Z4X2RWOF.js.map +0 -1
- package/dist/chunk-ZN6YYPIW.js +0 -67
- package/dist/chunk-ZN6YYPIW.js.map +0 -1
- package/dist/chunk-ZNFFTYWH.js +0 -1854
- package/dist/chunk-ZNFFTYWH.js.map +0 -1
- package/dist/variables.cjs +0 -17
- package/dist/variables.cjs.map +0 -1
- package/dist/variables.d.cts +0 -87
- package/dist/variables.d.ts +0 -87
- package/dist/variables.js +0 -4
- package/dist/variables.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/constants/version.ts","../src/constants/Configuration.ts"],"names":["version","ENGINE_VERSION","DEFAULT_CONFIG","mergeEngineConfig","base","override","ConfigManager","config","path","keys","current","key","ErrorFactory","value","section","property","sectionConfig","errors"],"mappings":"2CAEE,IAAAA,EAAW,OAAA,CCcN,IAAMC,CAAAA,CAAyBD,MC0SzBE,CAAAA,CAA+B,CACzC,IAAA,CAAM,CAIJ,eAAgB,GAAA,CAChB,cAAA,CAAgB,KAChB,aAAA,CAAe,YACjB,EACA,WAAA,CAAa,CAIX,gBAAA,CAAkB,GAAA,CAalB,iBAAkB,GACpB,CAAA,CACC,WAAY,CACV,mBAAA,CAAqB,IACrB,aAAA,CAAe,GAAA,CACf,eAAA,CAAiB,EAAA,CACjB,kBAAmB,KACrB,CAAA,CACA,GAAI,CACF,aAAA,CAAe,IACf,eAAA,CAAiB,GAAA,CAKjB,iBAAA,CAAmB,GAAA,CAInB,qBAAsB,GAAA,CAMtB,gBAAA,CAAkB,GAAA,CAMlB,qBAAA,CAAuB,GACzB,CAAA,CACA,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AI,IAAA,CAAK,MAAA,CAAO,WAAA,CAAY,iBAAmB,GAAA,EAC7CA,CAAAA,CAAO,KAAK,wCAAwC,CAAA,CAIlD,KAAK,MAAA,CAAO,IAAA,CAAK,cAAA,CAAiB,GAAA,EACpCA,EAAO,IAAA,CAAK,mCAAmC,EAG1C,CACL,KAAA,CAAOA,EAAO,MAAA,GAAW,CAAA,CACzB,KAAA,CAAOA,CAAAA,CAAO,KAAK,IAAI,CAAA,CACvB,SAAU,EACZ,CACF,CACF","file":"chunk-L3FPQSGN.js","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.0.0\",\n \"description\": \"An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.\",\n \"keywords\": [\n \"expression-evaluator\",\n \"calculator\",\n \"bytecode-vm\",\n \"parser\",\n \"lexer\",\n \"dsl\",\n \"markdown\",\n \"obsidian\"\n ],\n \"license\": \"MIT\",\n \"author\": \"Liam Riddell\",\n \"homepage\": \"https://liamriddell.github.io/solve-engine/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/LiamRiddell/solve-engine.git\",\n \"directory\": \"packages/engine\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/LiamRiddell/solve-engine/issues\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./engine\": {\n \"import\": {\n \"types\": \"./dist/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.d.cts\",\n \"default\": \"./dist/engine.cjs\"\n }\n },\n \"./vm\": {\n \"import\": {\n \"types\": \"./dist/vm.d.ts\",\n \"default\": \"./dist/vm.js\"\n },\n \"require\": {\n \"types\": \"./dist/vm.d.cts\",\n \"default\": \"./dist/vm.cjs\"\n }\n },\n \"./format\": {\n \"import\": {\n \"types\": \"./dist/format.d.ts\",\n \"default\": \"./dist/format.js\"\n },\n \"require\": {\n \"types\": \"./dist/format.d.cts\",\n \"default\": \"./dist/format.cjs\"\n }\n },\n \"./language\": {\n \"import\": {\n \"types\": \"./dist/language.d.ts\",\n \"default\": \"./dist/language.js\"\n },\n \"require\": {\n \"types\": \"./dist/language.d.cts\",\n \"default\": \"./dist/language.cjs\"\n }\n },\n \"./packages\": {\n \"import\": {\n \"types\": \"./dist/packages.d.ts\",\n \"default\": \"./dist/packages.js\"\n },\n \"require\": {\n \"types\": \"./dist/packages.d.cts\",\n \"default\": \"./dist/packages.cjs\"\n }\n },\n \"./constants\": {\n \"import\": {\n \"types\": \"./dist/constants.d.ts\",\n \"default\": \"./dist/constants.js\"\n },\n \"require\": {\n \"types\": \"./dist/constants.d.cts\",\n \"default\": \"./dist/constants.cjs\"\n }\n },\n \"./lexer\": {\n \"import\": {\n \"types\": \"./dist/lexer.d.ts\",\n \"default\": \"./dist/lexer.js\"\n },\n \"require\": {\n \"types\": \"./dist/lexer.d.cts\",\n \"default\": \"./dist/lexer.cjs\"\n }\n },\n \"./parser\": {\n \"import\": {\n \"types\": \"./dist/parser.d.ts\",\n \"default\": \"./dist/parser.js\"\n },\n \"require\": {\n \"types\": \"./dist/parser.d.cts\",\n \"default\": \"./dist/parser.cjs\"\n }\n },\n \"./normalizer\": {\n \"import\": {\n \"types\": \"./dist/normalizer.d.ts\",\n \"default\": \"./dist/normalizer.js\"\n },\n \"require\": {\n \"types\": \"./dist/normalizer.d.cts\",\n \"default\": \"./dist/normalizer.cjs\"\n }\n },\n \"./resolvers\": {\n \"import\": {\n \"types\": \"./dist/resolvers.d.ts\",\n \"default\": \"./dist/resolvers.js\"\n },\n \"require\": {\n \"types\": \"./dist/resolvers.d.cts\",\n \"default\": \"./dist/resolvers.cjs\"\n }\n },\n \"./errors\": {\n \"import\": {\n \"types\": \"./dist/errors.d.ts\",\n \"default\": \"./dist/errors.js\"\n },\n \"require\": {\n \"types\": \"./dist/errors.d.cts\",\n \"default\": \"./dist/errors.cjs\"\n }\n },\n \"./utilities\": {\n \"import\": {\n \"types\": \"./dist/utilities.d.ts\",\n \"default\": \"./dist/utilities.js\"\n },\n \"require\": {\n \"types\": \"./dist/utilities.d.cts\",\n \"default\": \"./dist/utilities.cjs\"\n }\n },\n \"./uom\": {\n \"import\": {\n \"types\": \"./dist/uom.d.ts\",\n \"default\": \"./dist/uom.js\"\n },\n \"require\": {\n \"types\": \"./dist/uom.d.cts\",\n \"default\": \"./dist/uom.cjs\"\n }\n },\n \"./services\": {\n \"import\": {\n \"types\": \"./dist/services.d.ts\",\n \"default\": \"./dist/services.js\"\n },\n \"require\": {\n \"types\": \"./dist/services.d.cts\",\n \"default\": \"./dist/services.cjs\"\n }\n },\n \"./worker\": {\n \"import\": {\n \"types\": \"./dist/worker.d.ts\",\n \"default\": \"./dist/worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/worker.d.cts\",\n \"default\": \"./dist/worker.cjs\"\n }\n },\n \"./testing\": {\n \"import\": {\n \"types\": \"./dist/testing.d.ts\",\n \"default\": \"./dist/testing.js\"\n },\n \"require\": {\n \"types\": \"./dist/testing.d.cts\",\n \"default\": \"./dist/testing.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepublishOnly\": \"npm run build && node ../../scripts/assert-publishable.mjs .\",\n \"dev\": \"tsup --watch\",\n \"test\": \"jest --config jest.config.cjs --no-coverage\",\n \"typecheck\": \"tsgo --noEmit --skipLibCheck\",\n \"typecheck:tsc\": \"tsc --noEmit --skipLibCheck\"\n },\n \"dependencies\": {\n \"@tanstack/query-core\": \"^5.100.10\"\n },\n \"devDependencies\": {\n \"@jest/globals\": \"^30.4.1\",\n \"@types/node\": \"^26.2.0\",\n \"convert\": \"^7.0.0\",\n \"jest\": \"^30.4.2\",\n \"ts-jest\": \"^29.4.12\",\n \"tsup\": \"8.5.1\",\n \"typescript\": \"5.9.3\"\n },\n \"//sideEffects\": \"Load-bearing claim, not boilerplate. tsup's splitting emits bare chunk imports at the top of dist/index.js, and this field tells Rollup, webpack and Vite they may delete them, which esbuild reports as [ignored-bare-import] once per import during `npm run size`. The engine does have module-level work to lose: registerAllTokenTypes(), _PrecedenceParser.BP_TABLE and its cached token ids, and several process-wide registries. It is safe because every chunk doing that work is also imported for its bindings somewhere, so no bundler can drop it. That is a property of how tsup currently splits the code rather than a design guarantee, so `npm run smoke:bundled` (scripts/check-tree-shaking.mjs) proves it on every run of `npm run verify` instead of assuming it, and its header explains the two fixes if it ever stops holding.\",\n \"sideEffects\": false\n}\n","/**\n * The running engine's own semver version, sourced directly from this\n * package's package.json so it can never drift from what's actually\n * published. Exists so IEnginePackage.engineVersion range checks\n * (api/EngineVersionCompatibility.ts) have something real to check\n * against.\n */\nimport { version } from \"../../package.json\";\n\n/**\n * The running engine's version, taken from package.json.\n *\n * What a package's `engineVersion` range is checked against at registration.\n * A prerelease is compared by its coerced release version, so a 1.0.0 beta\n * satisfies `^1.0.0`. See `api/EngineVersionCompatibility.ts`.\n */\nexport const ENGINE_VERSION: string = version;\n","/**\n * Configuration Module for solve-js Engine\n * \n * This module provides the **single source of truth** for all engine configuration.\n * Every configurable aspect of the engine, from safety limits and performance\n * budgets to VM constraints and worker pool sizing, is defined here.\n * \n * ### Design principles\n * \n * 1. **Engine owns its config.** The engine defines its own config shape and defaults.\n * Consumers (e.g., the Obsidian plugin) pass partial overrides; all unspecified\n * fields fall back to `DEFAULT_CONFIG`.\n * \n * 2. **Self-documenting.** Every interface and field has descriptive JSDoc so the\n * config is understandable at a glance, whether you're using the engine as an\n * npm package or reading the source.\n * \n * 3. **Minimal consumer knowledge.** Consumers only need to pass `Partial<EngineConfig>`.\n * They don't need to replicate the full config shape, just the fields they\n * want to override.\n * \n * @module Configuration\n */\n\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * A host's test for whether a calendar date is a public holiday, given the\n * `Date` for that day at local midnight. Return `true` to exclude it from\n * working-day arithmetic.\n */\nexport type HolidayPredicate = (date: Date) => boolean;\n\n/**\n * The host-supplied public-holiday calendar, in the same \"bring your own data\"\n * shape the stocks and weather packages already use for a host callback (see\n * `packages/stocks/StocksPackage.ts`): weekends are decidable from the date\n * alone, holidays are not, so they come from the host or not at all.\n *\n * Either a {@link HolidayPredicate}, for a host that computes holidays itself\n * (an existing library, a region rule), or an iterable of specific dates as\n * `YYYY-MM-DD` strings, epoch-millisecond numbers or `Date` objects, for a host\n * that just has a list. Resolved to one internal predicate by\n * `vm/HolidayCalendar.ts`'s `resolveHolidayPredicate()`.\n *\n * Left unset, working-day arithmetic skips weekends only, which is the honest\n * default: the engine excludes exactly the days it can prove are non-working.\n */\nexport type HolidayCalendar = HolidayPredicate | Iterable<string | number | Date>;\n\n/**\n * Date-related configuration.\n * Controls the bounds and formatting for date/time expression evaluation\n * (e.g., `today + 20 days`, `last monday`).\n */\nexport interface DateConfig {\n /**\n * How far forward a date offset whose COST grows with the offset may reach,\n * in years. Enforced by `vm/VM.ts`'s `addBusinessDays()`.\n *\n * Bounds the walk, not the calendar. Every other date offset in the engine\n * is arithmetic on a Date field, so `today + 100000 days` costs exactly what\n * one day costs and needs no ceiling; workdays are the one offset that has\n * to step day by day, because which days are skipped depends on where each\n * step lands. `today + 100000000 workdays` therefore froze the host for\n * thirteen seconds inside a single ADD opcode (where `vm.maxInstructions`\n * cannot see it) and then answered \"Invalid Date\", and a trillion never\n * returned at all.\n *\n * Release hardening: this field was declared, documented as a \"safety\n * limit\", and read nowhere, so it bounded nothing. A limit a host can\n * configure and the engine ignores is worse than no limit, because it reads\n * as protection that is not there.\n */\n readonly maxOffsetYears: number;\n /** How far BACK the same walk may reach, in years, as a negative number. See {@link maxOffsetYears}. */\n readonly minOffsetYears: number;\n /** Default date string format for display (moment.js format string) */\n readonly defaultFormat: string;\n /**\n * Public-holiday calendar for working-day arithmetic (`N working days after\n * <date>`, `working days between <date> and <date>`, `<date> + N workdays`).\n * See {@link HolidayCalendar}.\n *\n * Optional and unset by default: with no calendar, working-day arithmetic\n * skips weekends only. A host that wants holidays excluded too supplies one\n * here (`new ExpressionEngine({ config: { date: { holidays } } })`), the\n * same way stocks and weather take a host data source. Threaded into the VM\n * by `engine/ExpressionEngine.ts` exactly as {@link maxOffsetYears} is,\n * because working-day math is a VM operation several grammar forms share, so\n * the calendar has to be one source the VM owns rather than per-package state\n * the VM cannot see.\n */\n readonly holidays?: HolidayCalendar;\n}\n\n/**\n * Performance-related configuration.\n * Controls caching, timeouts, and processing limits to prevent runaway\n * resource consumption on large documents.\n */\nexport interface PerformanceConfig {\n /**\n * Maximum number of entries in {@link ExpressionEngine}'s bytecode cache\n * (per-instance, keyed by expression text) before the oldest entry is\n * evicted. Raise this for documents with many distinct expressions if\n * repeated re-evaluation (e.g. scrolling) is re-parsing instead of\n * hitting cache, bug fix (release hardening pass): this field used to\n * be read nowhere; the cache size was a hardcoded, unconfigurable\n * constant. Note this does NOT bound {@link LineCache}, which has no\n * size limit of its own.\n */\n readonly defaultCacheSize: number;\n /**\n * Maximum lines a document may have for the engine to process it in one\n * pass. Enforced by `ExpressionEngine.parseDocument()` and by\n * `engine/DocumentModel.ts`'s `setDocument()`, the two entry points that\n * take a whole document.\n *\n * A document costs memory per line whatever each line says: a parsed line\n * record, a cache entry, a dependency-graph node. Two hundred thousand\n * lines of `1 + 1` therefore exhausted the heap and aborted the process\n * before any per-line limit had anything to object to, which is the same\n * shape of hole as an unbounded expression and needs the same kind of\n * ceiling. Refusing the document names the limit; a host that genuinely has\n * a larger one raises this field.\n *\n * Release hardening: declared and read nowhere until now.\n */\n readonly maxDocumentLines: number;\n}\n\n/**\n * Validation / safety-limit configuration.\n * Protects against runaway expressions that could cause excessive memory use\n * or stack overflow. These limits are checked during lexing and parsing.\n */\n/** Bounds on untrusted input: expression length and nesting depth. */\nexport interface ValidationConfig {\n /** Maximum expression length in characters. Prevents excessively long strings from entering the pipeline. */\n readonly maxExpressionLength: number;\n /** Maximum expression complexity score (`tokens + functionCalls×5 + nestingDepth×10`). Protects against deeply nested or combinatorially complex expressions. */\n readonly maxComplexity: number;\n /** Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser. */\n readonly maxNestingDepth: number;\n /**\n * Auto-balance unmatched parentheses by appending missing closing parens\n * or prepending missing opening parens. When disabled, unbalanced expressions\n * cause parse errors instead of being silently corrected.\n *\n * Disabled by default for strict parsing. Enable for forgiving user input\n * (e.g., chat-style calculators where users often omit closing parens).\n * Has zero overhead when disabled, the O(n) paren-count scan is skipped.\n */\n readonly autoBalanceParens: boolean;\n}\n\n/**\n * Worker pool configuration.\n * Controls the parallel execution workers used for batch evaluation.\n */\nexport interface WorkerConfig {\n /** Maximum number of concurrent Web Workers allowed */\n readonly maxConcurrentWorkers: number;\n /** Time (ms) a worker stays alive while idle before being terminated */\n readonly idleTimeoutMs: number;\n /** Maximum retry attempts for a failed worker operation */\n readonly maxRetries: number;\n /** Base backoff delay (ms) between retries (exponential backoff applied on top) */\n readonly baseBackoffMs: number;\n} /**\n * Diagnostic / telemetry configuration.\n * Controls the diagnostic event pipeline for profiling and debugging.\n * All diagnostics are disabled by default for maximum production performance.\n */\n export interface DiagnosticConfig {\n /** Master switch: enable the diagnostic pipeline (collectors receive events for all pipeline stages) */\n readonly enabled: boolean;\n /** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */\n readonly vmTraceEnabled: boolean;\n }\n\n /**\n * Virtual Machine configuration.\n * Controls the internal bytecode VM that executes compiled expressions.\n */\n export interface VMConfig {\n /** Maximum stack depth (value slots) for VM execution, prevents stack overflow in recursive/pratt-parser generated bytecode */\n readonly maxStackDepth: number;\n /** Maximum opcodes executed per expression, halts runaway infinite loops */\n readonly maxInstructions: number;\n /**\n * Maximum elements a collection may be expanded to before `map`/`reduce`/\n * `sum`/`prod` will iterate it.\n *\n * A Range is stored as its two bounds and costs nothing until something\n * materializes it, at which point it becomes one Value per element. Twenty\n * characters (`sum(x, 1:100000000)`) therefore asked for a hundred million\n * of them, and neither `maxInstructions` nor `maxStackDepth` could see it:\n * the expansion happens inside a single opcode, so the instruction counter\n * is never consulted while it runs, and the elements never reach the value\n * stack. V8 aborted the whole process with \"Reached heap limit\", which a\n * host embedding the engine cannot catch.\n */\n readonly maxCollectionSize: number;\n /**\n * Maximum elements (collection Values, matrix cells) one evaluation may\n * materialize in total.\n *\n * `maxCollectionSize` above bounds a single collection. This bounds the sum\n * of everything an expression asks for, which is a different question and\n * the one that actually protects the host: two collections that are\n * individually legal are legal together, and an operation whose result is\n * the PRODUCT of two legal operands is bounded by neither of them. A matrix\n * multiply is exactly that shape, so three lines within every other limit\n * (`:a = map(1*x, 0:20000)`, `:b = transpose(a)`, `b * a`) asked for four\n * hundred million cells and aborted the process.\n *\n * Counted in elements rather than bytes, because a count is what a call\n * site has before it allocates. An element is 8 bytes as a numeric matrix\n * cell and closer to a hundred as a full Value, so the default is worth\n * roughly 16 MB of matrix or 200 MB of expanded collection: far past any\n * document and far short of what an editor cannot survive.\n */\n readonly maxAllocatedElements: number;\n /**\n * Maximum user-defined-function calls one evaluation may make in TOTAL,\n * however deeply or widely they nest.\n *\n * `maxFunctionRecursionDepth` bounds how DEEP calls nest and cannot see\n * how MANY there are, and those are different numbers. Twenty-two lines of\n * `f(n)(v) = f(n-1)(v) + f(n-1)(v)` reach a depth of only 22 against a\n * limit of 50, and make 2,097,152 calls doing it: a fatal heap abort in\n * under a second. `maxInstructions` cannot bound it either, because\n * `executeBytecode()` re-enters itself per call and each reentrant call\n * gets its OWN instruction count, so recursion refreshes its allowance on\n * the way in. This is the tally that does not refresh; see\n * `vm/AllocationBudget.ts`, which holds it for the same reason it holds\n * the element tally.\n *\n * Counted in calls rather than in the instructions they run, because the\n * call is the thing that multiplies: every call allocates a frame, its\n * arguments and its result whatever its body says.\n */\n readonly maxFunctionCalls: number;\n /**\n * Hard ceiling on how many bisection steps goal seek (`solve line N for\n * <var> = <target>`, see `packages/goalseek/`) may take before it gives up\n * with a structured error rather than continuing.\n *\n * Goal seek re-evaluates the target line's expression once per step while\n * narrowing an interval, and an untrusted document must never be able to\n * make that loop spin. `maxInstructions` bounds each individual\n * re-evaluation, but not how many of them the search performs, so this is\n * the tally that bounds the search itself, the same reason `maxFunctionCalls`\n * exists alongside `maxInstructions`. Bisection halves the interval every\n * step, so a hundred steps resolves an input to roughly one part in 2^100:\n * far past any precision a document needs, and a definite stop either way.\n */\n readonly maxGoalSeekIterations: number;\n }\n\n/**\n * Complete engine configuration.\n *\n * Every field has a default in `DEFAULT_CONFIG`. To customize, pass a\n * `Partial<EngineConfig>` when constructing `ExpressionEngine`. Only the\n * sections/fields you supply are overridden; all others use their defaults.\n *\n * @example\n * ```typescript\n * import { ExpressionEngine } from \"solve-js\";\n *\n * const engine = new ExpressionEngine({ config: {\n * validation: {\n * maxExpressionLength: 1000,\n * maxComplexity: 200,\n * },\n * // date, performance, vm, worker, diagnostic all use defaults\n * } });\n * ```\n */\nexport interface EngineConfig {\n /** Date/time expression evaluation bounds and formatting */\n readonly date: DateConfig;\n /** Performance budgets and cache sizing */\n readonly performance: PerformanceConfig;\n /** Safety limits for expression complexity */\n readonly validation: ValidationConfig;\n /** Internal bytecode VM configuration */\n readonly vm: VMConfig;\n /** Parallel worker pool configuration */\n readonly worker: WorkerConfig;\n /** Diagnostic pipeline configuration */\n readonly diagnostic: DiagnosticConfig;\n }\n\n/**\n * A partial {@link EngineConfig} override, one section at a time.\n *\n * Overrides are merged per section over {@link DEFAULT_CONFIG}, so you can set a\n * single field of one section (`{ validation: { maxExpressionLength: 1000 } }`)\n * and keep every other default in that section. A plain `Partial<EngineConfig>`\n * cannot express that, it demands a whole section object, which is why the\n * documented overrides never typechecked against it. This is the type the\n * constructor and {@link createEngine} accept.\n */\nexport type EngineConfigOverride = {\n readonly [K in keyof EngineConfig]?: Partial<EngineConfig[K]>;\n};\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: EngineConfig = {\n date: {\n // A century of workdays is about 26,000 steps, which is microseconds,\n // and past any offset a person means. The walk is what these bound; see\n // DateConfig above for why no other date offset needs a ceiling.\n maxOffsetYears: 100,\n minOffsetYears: -100,\n defaultFormat: 'YYYY-MM-DD'\n },\n performance: {\n // Preserves the effective cache size the hardcoded (now-removed)\n // BYTECODE_CACHE_MAX_ENTRIES constant had, so wiring this field up\n // doesn't silently shrink the default cache for existing consumers.\n defaultCacheSize: 2000,\n // Raised from the 10,000 this field was declared with, which was never\n // enforced and turned out to be under what this engine already supports:\n // its paging design is tested against a 20,000-line document\n // (`engine/PageManager.ts` and its spec) and its throughput benchmark\n // parses a 50,000-line one. Twice the largest of those, and the same\n // number `ConfigManager.validate()` already refuses to go above.\n //\n // Measured under a 256MB heap: setting a 100,000-line document costs\n // 64MB, evaluating every line of a 20,000-line one costs 106MB, and\n // 200,000 lines aborts the process before a single expression is looked\n // at. A host with a small heap should lower this; the ceiling is here to\n // stop the size that cannot work anywhere.\n maxDocumentLines: 100000,\n },\n validation: {\n maxExpressionLength: 2000,\n maxComplexity: 500,\n maxNestingDepth: 50,\n autoBalanceParens: false,\n },\n vm: {\n maxStackDepth: 200,\n maxInstructions: 50000,\n // Two orders of magnitude above anything a person types by hand (the\n // longest range in the test suite is 1000 elements) and small enough\n // that expanding it is measured in milliseconds rather than in whether\n // the host survives.\n maxCollectionSize: 100000,\n // Twenty times the single-collection ceiling above, so an expression may\n // legitimately handle a number of large collections, and two hundred\n // times below the allocation that took the process down.\n maxAllocatedElements: 2000000,\n // Six hundred times the largest call count any test or example makes\n // (five levels of composition is sixteen calls), and small enough that\n // the calls it does allow cost single-digit megabytes rather than the\n // heap. A document that needs more than ten thousand calls on one line\n // is doing something a calculator was not built for.\n maxFunctionCalls: 10000,\n // A hundred bisection steps resolve an input to one part in 2^100, far\n // finer than any document needs and a firm stop for an untrusted one. A\n // continuous, monotonic relationship converges in tens of steps, well\n // under this; hitting it means the target is unreachable or the\n // relationship is not the smooth one goal seek assumes.\n maxGoalSeekIterations: 100,\n },\n worker: {\n maxConcurrentWorkers: 4,\n idleTimeoutMs: 30000,\n maxRetries: 3,\n baseBackoffMs: 1000,\n },\n diagnostic: {\n enabled: false,\n vmTraceEnabled: false,\n },\n };\n\n/**\n * Merge a partial config override onto a base `EngineConfig`, section by\n * section, `{ ...base.section, ...override.section }` for each of the 7\n * top-level sections, not a single top-level spread.\n *\n * A shallow `{ ...base, ...override }` at the TOP level replaces an entire\n * section wholesale the moment a caller overrides even one field in it\n * (e.g. `{ performance: { defaultCacheSize: 500 } }` would silently drop\n * every other `performance.*` field back to `undefined`, not to its\n * default). This function exists specifically so every config consumer\n * shares one correct merge instead of each hand-rolling (and risking) its\n * own. `ConfigManager` and `ExpressionEngine` both call this rather than\n * either duplicating the section list or instantiating a whole\n * `ConfigManager` just to reuse its private merge logic.\n */\nexport function mergeEngineConfig(\n base: EngineConfig,\n override: EngineConfigOverride\n): EngineConfig {\n return {\n date: { ...base.date, ...override.date },\n performance: { ...base.performance, ...override.performance },\n validation: { ...base.validation, ...override.validation },\n vm: { ...base.vm, ...override.vm },\n worker: { ...base.worker, ...override.worker },\n diagnostic: { ...base.diagnostic, ...override.diagnostic },\n };\n}\n\n/**\n * Configuration manager for engine settings\n *\n * @example\n * ```typescript\n * const configManager = new ConfigManager();\n * configManager.set('performance.defaultCacheSize', 2000);\n * const cacheSize = configManager.get('performance.defaultCacheSize');\n * ```\n */\nexport class ConfigManager {\n private config: EngineConfig;\n\n constructor(config: Partial<EngineConfig> = {}) {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, config);\n }\n\n /**\n * Get configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @returns Configuration value\n */\n get<T>(path: string): T {\n const keys = path.split('.');\n let current: unknown = this.config;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PATH_NOT_FOUND\",\n `Configuration path not found: ${path}`,\n { path }\n );\n }\n }\n\n return current as T;\n }\n\n /**\n * Set configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @param value - New value\n */\n set<T>(path: string, value: T): void {\n const keys = path.split('.');\n if (keys.length < 2) {\n throw ErrorFactory.config(\n \"INVALID_CONFIG_PATH\",\n `Invalid path: ${path}. Must be in format 'section.property'`,\n { path }\n );\n }\n \n const section = keys[0];\n const property = keys[1];\n \n if (!(section in this.config)) {\n throw ErrorFactory.config(\n \"CONFIG_SECTION_NOT_FOUND\",\n `Configuration section not found: ${section}`,\n { section, path }\n );\n }\n \n const sectionConfig = this.config[section as keyof EngineConfig];\n if (sectionConfig && typeof sectionConfig === 'object') {\n (sectionConfig as unknown as Record<string, unknown>)[property] = value;\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PROPERTY_NOT_FOUND\",\n `Configuration property not found: ${path}`,\n { path }\n );\n }\n }\n\n /**\n * Get complete configuration.\n *\n * A detached copy, section objects included. A top-level spread would hand\n * the caller this manager's own section objects, so `getConfig().vm.x = 1`\n * would be an undeclared back door into {@link set}, bypassing its path\n * validation and reaching every later {@link get}.\n */\n getConfig(): EngineConfig {\n return mergeEngineConfig(this.config, {});\n }\n\n /**\n * Update multiple configuration values\n */\n update(config: Partial<EngineConfig>): void {\n this.config = mergeEngineConfig(this.config, config);\n }\n\n /**\n * Reset to default configuration.\n *\n * Goes through {@link mergeEngineConfig} for the same reason the constructor\n * does. A top-level `{ ...DEFAULT_CONFIG }` copies the six section\n * references, not the sections, so after a reset this manager's\n * `performance` object WAS `DEFAULT_CONFIG.performance` and the next\n * `set('performance.x', ...)` wrote into the module constant. That constant\n * is what every `ExpressionEngine` is built from, so one manager's reset\n * could change the cache size, instruction ceiling or allocation budget of\n * every engine constructed later in the process.\n */\n reset(): void {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, {});\n }\n\n /**\n * Validate configuration values\n */\n validate(): ValidationResult {\n const errors: string[] = [];\n\n // Validate performance config\n if (this.config.performance.maxDocumentLines > 100000) {\n errors.push('maxDocumentLines cannot exceed 100,000');\n }\n\n // Validate date config\n if (this.config.date.maxOffsetYears > 1000) {\n errors.push('maxOffsetYears cannot exceed 1000');\n }\n\n return {\n valid: errors.length === 0,\n error: errors.join('; '),\n warnings: []\n };\n }\n}\n\n/**\n * Result type for {@link ConfigManager.validate}.\n */\nexport interface ValidationResult {\n valid: boolean;\n error?: string;\n warnings?: string[];\n}\n\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkY7O4D3BJ_cjs=require('./chunk-Y7O4D3BJ.cjs'),chunk6KFVG6UY_cjs=require('./chunk-6KFVG6UY.cjs'),chunkMSYX32PF_cjs=require('./chunk-MSYX32PF.cjs'),chunkFWW3M36J_cjs=require('./chunk-FWW3M36J.cjs');var u=(s=>(s.Main="main",s.Inline="inline",s.String="string",s))(u||{});var l=class{constructor(e="en",t){this.currentState="main";this.hasPeeked=false;this.tokens=[];this.tokenIdx=0;this.expressionLexer=new chunk6KFVG6UY_cjs.b(e,t);}reset(e,t){let s=t??"main";if(this.currentState=s,this.hasPeeked=false,this.peekedToken=void 0,s==="main"){if(this.expressionLexer.classifyLine(e).skip){this.tokens=[],this.tokenIdx=0;return}this.expressionLexer.reset(e),this.tokens=this.expressionLexer.tokenizeAll(),this.tokenIdx=0;}else this.expressionLexer.reset(e),this.tokens=this.expressionLexer.tokenizeAll(),this.tokenIdx=0;}classifyLine(e){return this.expressionLexer.classifyLine(e)}findInlineSolves(e){return this.expressionLexer.findInlineSolves(e)}getKeywords(){return this.expressionLexer.getKeywords()}next(){if(this.hasPeeked)return this.hasPeeked=false,this.peekedToken;if(this.tokenIdx<this.tokens.length)return this.tokens[this.tokenIdx++]}peek(){return this.hasPeeked?this.peekedToken:(this.peekedToken=this.next(),this.hasPeeked=true,this.peekedToken)}[Symbol.iterator](){return this.tokens[Symbol.iterator]()}registerVocabulary(e){this.expressionLexer.registerVocabulary(e);}unregisterVocabulary(e){this.expressionLexer.unregisterVocabulary(e);}resetExpression(e){this.currentState="main",this.hasPeeked=false,this.peekedToken=void 0,this.expressionLexer.reset(e),this.tokens=this.expressionLexer.tokenizeAll(),this.tokenIdx=0;}scanDocument(e){return this.expressionLexer.scanDocument(e)}getState(){return this.currentState}setState(e){this.currentState=e;}getHighlightTokens(e){let t=this.expressionLexer.classifyLine(e);return t.skip&&e.startsWith("> ")?this.collectHighlightTokens(e.slice(2)):t.skip?[]:this.collectHighlightTokens(e)}getHighlightTokenObjects(e){let t=this.expressionLexer.classifyLine(e);return t.skip&&e.startsWith("> ")?this.collectTokenObjects(e.slice(2)):t.skip?[]:this.collectTokenObjects(e)}collectTokenObjects(e){this.resetExpression(e);let t=[];for(let s of this)s.type==="WS"||s.type==="NEWLINE"||s.type.startsWith("MD_")||s.type==="INLINE_SOLVE_START"||s.type==="BACKTICK_CLOSE"||t.push(s);return t}collectHighlightTokens(e){return this.collectTokenObjects(e).map(t=>({type:t.type,value:t.value,offset:t.offset,col:t.col,length:t.text.length,category:chunkY7O4D3BJ_cjs.d(t.type)}))}},T=new l("en",void 0);var n=class{constructor(){this.classes=[];this.localeKeywordMap=null;this.localePhraseMap=null;this.unitNames=null;}register(e){this.classes.push(e);}unregister(e){this.classes=this.classes.filter(t=>t.tokenType!==e);}setLocale(e,t){this.localeKeywordMap=e,this.localePhraseMap=t??null;}setUnits(e){this.unitNames=e;}build(){let e=new Map;if(this.localeKeywordMap)for(let[r,i]of Object.entries(this.localeKeywordMap))e.set(r.toLowerCase(),i);let t=[...this.classes].sort((r,i)=>(r.priority??0)-(i.priority??0));for(let r of t)for(let i of Object.keys(r.keywords))e.set(i.toLowerCase(),r.tokenType);let s=this.buildPhraseTrie(),o=this.buildPhraseStartWords();return {keywordToType:e,phraseTrie:s,phraseStartWords:o,unitNames:this.unitNames??new Set}}buildPhraseTrie(){let e={children:new Map};if(this.localePhraseMap)for(let[t,s]of Object.entries(this.localePhraseMap))this.insertPhrase(e,t.toLowerCase(),s);for(let t of this.classes)if(t.phrases)for(let s of Object.keys(t.phrases))this.insertPhrase(e,s.toLowerCase(),t.tokenType);return e.children.size>0?e:null}insertPhrase(e,t,s){let o=t.split(" "),r=e;for(let i of o)r.children.has(i)||r.children.set(i,{children:new Map}),r=r.children.get(i);r.type||(r.type=s);}buildPhraseStartWords(){let e=new Set;if(this.localePhraseMap)for(let t of Object.keys(this.localePhraseMap)){let s=t.split(" ")[0].toLowerCase();e.add(s);}for(let t of this.classes)if(t.phrases)for(let s of Object.keys(t.phrases)){let o=s.split(" ")[0].toLowerCase();e.add(o);}return e}};var k={"to the power of":"CARET","power of":"CARET","increase by":"INCREASE_BY","decrease by":"DECREASE_BY","times by":"TIMES_BY","multiply by":"MULTIPLY_BY","multiplied by":"MULTIPLY_BY","divide by":"DIVIDE_BY"};function P(a="en"){let e=chunkMSYX32PF_cjs.a(a),t=new n;return t.setLocale(e.keywordMap,k),t.setUnits(chunkFWW3M36J_cjs.a),t.build()}exports.a=u;exports.b=l;exports.c=T;exports.d=P;//# sourceMappingURL=chunk-LR4E4A4W.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-LR4E4A4W.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lexer/LexerState.ts","../src/lexer/Lexer.ts","../src/lexer/TokenClassRegistry.ts","../src/lexer/tokenRegistration.ts"],"names":["LexerState","Lexer","localeCode","tokenLookup","ExpressionLexer","input","state","newState","lineText","plugin","text","classification","result","token","getTokenCategory","sharedLexer","TokenClassRegistry","tokenClass","tokenType","c","keywordMap","phraseMap","unitNames","keywordToType","keyword","sorted","a","b","tc","phraseTrie","phraseStartWords","root","phrase","words","node","word","startWords","first","BUILTIN_PHRASES","buildTokenLookup","loc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"chunk-LR4E4A4W.cjs","sourcesContent":["/**\n * Lexer state machine modes.\n * - Main: document-level scanning with markdown classification\n * - Inline: expression embedded in markdown inline solve (`s\\`...\\``)\n * - String: inside a double-quoted string literal\n */\nexport enum LexerState {\n\tMain = \"main\",\n\tInline = \"inline\",\n\tString = \"string\",\n}\n","import { ExpressionLexer, LineClassification, LexerVocabulary, type ScanLineResult } from \"./ExpressionLexer\";\nimport { Token } from \"@solve-js/lexer/Token\";\nimport { LexerState } from \"@solve-js/lexer/LexerState\";\nimport { getTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport type { TokenLookup } from \"@solve-js/lexer/TokenClassRegistry\";\n\n/**\n * Public tokenizer wrapper around {@link ExpressionLexer}.\n *\n * `ExpressionLexer` does the actual character-by-character scanning;\n * `Lexer` adds a materialized-token-array streaming interface\n * (`next()`/`peek()`) plus line-classification state (`reset()`) so\n * callers can iterate a line's tokens without re-scanning on each peek.\n *\n * Each `ExpressionEngine` instance owns its own `Lexer`, and packages\n * extend it via {@link registerVocabulary} (keywords, operators, units)\n * see `IEnginePackage.lexerVocabulary`.\n */\nexport class Lexer {\n /** Expression-mode lexer (Phase A: V8-optimized, replaces moo) */\n private expressionLexer: ExpressionLexer;\n private currentState: LexerState = LexerState.Main;\n private peekedToken: Token | undefined;\n private hasPeeked = false;\n\n // Materialized token array from the last reset() call, used for\n // next()/peek() streaming access.\n private tokens: Token[] = [];\n private tokenIdx: number = 0;\n\n /**\n * @param localeCode - Locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @param tokenLookup - Optional TokenLookup from TokenClassRegistry.\n * When provided, configures ExpressionLexer to use registry-built\n * keyword/unit/phrase lookups instead of internal instance maps.\n */\n constructor(localeCode = \"en\", tokenLookup?: TokenLookup) {\n // Pass the lookup directly to ExpressionLexer's constructor, it's an\n // instance field now, not a static. Each Lexer instance gets its own\n // isolated lookup, preventing cross-instance corruption.\n this.expressionLexer = new ExpressionLexer(localeCode, tokenLookup);\n }\n\n reset(input: string, state?: LexerState): void {\n const newState = state ?? LexerState.Main;\n this.currentState = newState;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n\n // Phase B: Main state classifies the line with the markdown scanner.\n // Skip lines (headings, fences, HRs, etc.) produce empty token arrays.\n // Expression lines and lines with inline solves are tokenized normally.\n if (newState === LexerState.Main) {\n const classification = this.expressionLexer.classifyLine(input);\n if (classification.skip) {\n this.tokens = [];\n this.tokenIdx = 0;\n return;\n }\n // Expression line or markdown line with inline solves, tokenize.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n } else {\n // Non-main states (Inline, String), expression tokenization.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n }\n\n /**\n * Classify a single line of markdown text (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n classifyLine(lineText: string): LineClassification {\n return this.expressionLexer.classifyLine(lineText);\n }\n\n /**\n * Find all inline solve markers in a line (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n findInlineSolves(lineText: string) {\n return this.expressionLexer.findInlineSolves(lineText);\n }\n\n /**\n * Every keyword this lexer currently recognizes (locale + plugin-contributed),\n * mapped to the token type it lexes to. Delegates to the ExpressionLexer.\n */\n getKeywords(): Record<string, string> {\n return this.expressionLexer.getKeywords();\n }\n\n next(): Token | undefined {\n if (this.hasPeeked) {\n this.hasPeeked = false;\n return this.peekedToken;\n }\n // Materialized token array (ExpressionLexer path).\n if (this.tokenIdx < this.tokens.length) {\n return this.tokens[this.tokenIdx++];\n }\n return undefined;\n }\n\n peek(): Token | undefined {\n if (this.hasPeeked) return this.peekedToken;\n this.peekedToken = this.next();\n this.hasPeeked = true;\n return this.peekedToken;\n }\n\n [Symbol.iterator](): Iterator<Token> {\n return this.tokens[Symbol.iterator]();\n }\n\n /**\n * Register a plugin to extend the lexer with custom tokens.\n * Delegates to the underlying ExpressionLexer.\n *\n * @see LexerVocabulary for the supported extension points.\n */\n registerVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.registerVocabulary(plugin);\n }\n\n /**\n * Unregister a plugin, removing its custom tokens from the lexer.\n * Delegates to the underlying ExpressionLexer.\n */\n unregisterVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.unregisterVocabulary(plugin);\n }\n\n /**\n * Reset the lexer for expression-only text, skips the classifyLine()\n * overhead in reset() for callers that already know the input is an\n * evaluable expression (e.g., after isEmptyLine() confirmed non-skip).\n */\n resetExpression(input: string): void {\n this.currentState = LexerState.Main;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n\n /**\n * Scan a full document in one pass, classifying each line and\n * tokenizing non-skipped lines. Delegates to ExpressionLexer.\n *\n * @returns ScanLineResult[], one per line, with classification + tokens.\n */\n scanDocument(text: string): ScanLineResult[] {\n return this.expressionLexer.scanDocument(text);\n }\n\n getState(): LexerState {\n return this.currentState;\n }\n\n setState(state: LexerState): void {\n this.currentState = state;\n }\n\n getHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n\n // For blockquote lines, strip the \"> \" prefix and tokenize the expression content.\n // This lets expressions inside blockquotes (e.g., \"> 1 + 2\") get syntax highlighted\n // while pure structural lines (headings, code fences) remain unhighlighted.\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectHighlightTokens(lineText.slice(2));\n }\n\n if (classification.skip) {\n return [];\n }\n\n return this.collectHighlightTokens(lineText);\n }\n\n /**\n * The same tokens {@link getHighlightTokens} reduces, before reduction.\n *\n * Exists because normalization operates on tokens, not on the flattened\n * shape, and a consumer that wants phrase-fused highlighting has to run the\n * normalizer between the two. See `LanguageService.getSemanticTokens`.\n *\n * @param lineText - One line of source.\n * @returns Every token on the line that is worth painting, unreduced.\n */\n getHighlightTokenObjects(lineText: string): Token[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectTokenObjects(lineText.slice(2));\n }\n if (classification.skip) return [];\n return this.collectTokenObjects(lineText);\n }\n\n private collectTokenObjects(lineText: string): Token[] {\n this.resetExpression(lineText);\n const result: Token[] = [];\n for (const token of this) {\n if (token.type === \"WS\" || token.type === \"NEWLINE\") continue;\n if (token.type.startsWith(\"MD_\")) continue;\n if (token.type === \"INLINE_SOLVE_START\" || token.type === \"BACKTICK_CLOSE\") continue;\n result.push(token);\n }\n return result;\n }\n\n private collectHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n return this.collectTokenObjects(lineText).map(token => ({\n type: token.type,\n value: token.value,\n offset: token.offset,\n col: token.col,\n // `text`, not `value`: this is a span into the source, and the two\n // differ for a string literal, whose value is the payload while its\n // text still carries the quote characters the reader typed.\n length: token.text.length,\n category: getTokenCategory(token.type),\n }));\n }\n}\n\n/**\n * A lexer for operations that do not depend on registered vocabulary.\n *\n * Line classification and inline-solve detection read characters looking for\n * headings, comment markers, fences and backtick spans, and never consult the\n * keyword, unit or operator tables. Every lexer therefore returns the same\n * answer, so the callers that have no engine to ask can use this one. Checked\n * by `__tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts`.\n *\n * Do not tokenize with this. An engine's own lexer carries the vocabulary its\n * packages registered; this one carries none.\n */\nexport const sharedLexer = new Lexer(\"en\", undefined);","/**\n * TokenClass, Plugin-extensible keyword registration for the Lexer.\n *\n * Providers call `registry.register(tokenClass)` to teach the lexer about\n * their keywords. The registry merges locale keywords, provider keywords,\n * phrase mappings, and unit names into an optimized TokenLookup structure\n * consumed by the Lexer.\n *\n * @example\n * registry.register({\n * tokenType: 'CARET',\n * keywords: {},\n * phrases: { 'to the power of': true, 'power of': true },\n * priority: 10,\n * description: 'Exponentiation operators (x^y)',\n * });\n */\nexport interface TokenClass {\n /** The token type string produced by the lexer (e.g., \"FUNC\", \"PI\", \"CARET\").\n * Must match a token type that a ParseletRegistry has a parselet for. */\n tokenType: string;\n\n /** Single-word keywords (case-insensitive). The lexer lowercases input\n * before lookup, so these should be lowercase. Example:\n * { sqrt: true, abs: true, sin: true, cos: true } for tokenType \"FUNC\" */\n keywords: Record<string, boolean>;\n\n /** Multi-word phrases (case-insensitive). Matched by the built-in PhraseMatcher\n * via the phrase trie. Example:\n * { \"to the power of\": true, \"power of\": true } for tokenType \"CARET\" */\n phrases?: Record<string, boolean>;\n\n /** Priority for conflict resolution. When two TokenClasses register\n * the same keyword, the higher-priority class wins. Locale keywords\n * have priority 0 (set via setLocale). Providers should use\n * priority >= 10 to override locale defaults. Default: 0 */\n priority?: number;\n\n /** Human-readable description for debugging and introspection */\n description?: string;\n}\n\n// ── Phrase Trie ──────────────────────────────────────────────────────────────\n\n/** Trie node for multi-word phrase matching. */\nexport interface PhraseNode {\n /** Complete phrase token type (null = intermediate node) */\n type?: string;\n children: Map<string, PhraseNode>;\n}\n\n// ── TokenLookup, Optimized lookup structure for the Lexer ──────────────────\n\n/**\n * The optimized lookup structure built by TokenClassRegistry.build().\n * Consumed by the Lexer for O(1) keyword → token type lookups and\n * O(word-count) phrase matching.\n */\nexport interface TokenLookup {\n /** Lowercase keyword → token type. O(1) Map lookup. */\n keywordToType: Map<string, string>;\n\n /** Phrase trie for multi-word matching. Root node with children maps.\n * Null if no phrases registered. */\n phraseTrie: PhraseNode | null;\n\n /** Set of lowercase first-words of all registered phrases.\n * Used by the lexer to emit IDENT (not a phrase keyword) for words\n * that start multi-word phrases, deferring to the PhraseMatcher.\n *\n * Example: \"to\" is in phraseStartWords because \"to the power of\" is a phrase.\n * When the lexer sees \"to\", it emits IDENT and lets the phrase matcher\n * combine \"to the power of\" into a single CARET token.\n *\n * This prevents plugins from accidentally overriding phrase-start words.\n */\n phraseStartWords: Set<string>;\n\n /** Case-sensitive unit names for UNIT fallback after keyword lookup fails. */\n unitNames: ReadonlySet<string>;\n}\n\n// ── TokenClassRegistry ───────────────────────────────────────────────────────\n\n/**\n * Central registry for keyword→token-type mappings.\n *\n * Providers register TokenClasses; locales provide keyword maps;\n * units provide a name set. `build()` merges all sources into an\n * optimized TokenLookup consumed by the Lexer.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider keywords (sorted by priority ascending, higher priority wins)\n *\n * Unit names are stored separately (checked AFTER keyword lookup fails).\n * Phrases are stored in a trie for O(phrase-length) matching.\n */\nexport class TokenClassRegistry {\n private classes: TokenClass[] = [];\n private localeKeywordMap: Record<string, string> | null = null;\n private localePhraseMap: Record<string, string> | null = null;\n private unitNames: ReadonlySet<string> | null = null;\n\n /**\n * Register a provider's TokenClass. Must be called BEFORE build().\n * Can be called multiple times to add more entries.\n *\n * Built-in token types CANNOT be overridden, throws a EngineError\n * if the TokenClass attempts to register a keyword that conflicts\n * with an already-registered token type.\n */\n register(tokenClass: TokenClass): void {\n this.classes.push(tokenClass);\n }\n\n /**\n * Unregister all TokenClasses for a given token type.\n * Useful for plugin unload. Requires rebuild() to take effect.\n */\n unregister(tokenType: string): void {\n this.classes = this.classes.filter(c => c.tokenType !== tokenType);\n }\n\n /**\n * Set the locale's keyword→type map and optional phrase map.\n * Called on locale change. Priority 0 (cannot override providers with higher priority).\n */\n setLocale(keywordMap: Record<string, string>, phraseMap?: Record<string, string>): void {\n this.localeKeywordMap = keywordMap;\n this.localePhraseMap = phraseMap ?? null;\n }\n\n /**\n * Set the unit name set. Called when unit list changes.\n * Units are stored separately (checked AFTER keyword lookup fails).\n *\n * Takes a ReadonlySet because the caller's set is derived from the\n * conversion tables and must not be mutated; this class only ever reads it.\n */\n setUnits(unitNames: ReadonlySet<string>): void {\n this.unitNames = unitNames;\n }\n\n /**\n * Build the optimized TokenLookup from all registered sources.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider classes (sorted by priority ascending)\n *\n * Returns a frozen TokenLookup that the Lexer consumes.\n * Call build() again after register()/setLocale()/setUnits() changes.\n */\n build(): TokenLookup {\n const keywordToType = new Map<string, string>();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n if (this.localeKeywordMap) {\n for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {\n keywordToType.set(keyword.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider keywords (sorted by priority ascending, higher wins)\n const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n for (const tc of sorted) {\n for (const keyword of Object.keys(tc.keywords)) {\n keywordToType.set(keyword.toLowerCase(), tc.tokenType);\n }\n }\n\n // Build phrase trie from locale + provider phrases\n const phraseTrie = this.buildPhraseTrie();\n\n // Build phraseStartWords set (first word of every phrase)\n const phraseStartWords = this.buildPhraseStartWords();\n\n return {\n keywordToType,\n phraseTrie,\n phraseStartWords,\n unitNames: this.unitNames ?? new Set(),\n };\n }\n\n // ── Private helpers ─────────────────────────────────────────────────────\n\n private buildPhraseTrie(): PhraseNode | null {\n const root: PhraseNode = { children: new Map() };\n\n // Layer 1: Locale phrases\n if (this.localePhraseMap) {\n for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {\n this.insertPhrase(root, phrase.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider phrases\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);\n }\n }\n\n return root.children.size > 0 ? root : null;\n }\n\n private insertPhrase(root: PhraseNode, phrase: string, tokenType: string): void {\n const words = phrase.split(' ');\n let node = root;\n for (const word of words) {\n if (!node.children.has(word)) {\n node.children.set(word, { children: new Map() });\n }\n node = node.children.get(word)!;\n }\n // Only set type if not already set, first-registered (locale) wins\n if (!node.type) {\n node.type = tokenType;\n }\n }\n\n private buildPhraseStartWords(): Set<string> {\n const startWords = new Set<string>();\n\n // Locale phrase first words\n if (this.localePhraseMap) {\n for (const phrase of Object.keys(this.localePhraseMap)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n // Provider phrase first words\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n return startWords;\n }\n}","/**\n * tokenRegistration.ts, Bootstrap for building TokenLookup from locale, units, and phrases.\n *\n * This module centralizes the assembly of the TokenLookup consumed by ExpressionLexer.\n * It merges:\n * 1. Locale keywords (from ILocale.keywordMap)\n * 2. Built-in phrase patterns (to the power of, increase by, etc.)\n * 3. Known unit names (from units.ts)\n *\n * The resulting TokenLookup is frozen and passed to ExpressionLexer.configuredLookup\n * at construction time, enabling data-driven keyword/unit/phrase resolution.\n */\nimport { TokenClassRegistry } from '@solve-js/lexer/TokenClassRegistry';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { knownUnits } from '@solve-js/lexer/units';\n\n// ── Built-in phrase map ───────────────────────────────────────────────────\n// These are the multi-word expressions handled as compound tokens.\n// Matched by the PhraseMatcher (trie-based) in ExpressionLexer.tryMatchPhrase().\nconst BUILTIN_PHRASES: Record<string, string> = {\n 'to the power of': 'CARET',\n 'power of': 'CARET',\n 'increase by': 'INCREASE_BY',\n 'decrease by': 'DECREASE_BY',\n 'times by': 'TIMES_BY',\n 'multiply by': 'MULTIPLY_BY',\n 'multiplied by': 'MULTIPLY_BY',\n 'divide by': 'DIVIDE_BY',\n};\n\n/**\n * Build a TokenLookup from locale keywords, known units, and built-in phrases.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0, lowest, can be overridden by providers)\n * 2. Built-in phrases (via locale phraseMap)\n * 3. Known units (checked AFTER keyword lookup fails, via unitNames set)\n *\n * The resulting TokenLookup replaces the internal keyword map, unit set,\n * phrase trie, and phraseStartWords in ExpressionLexer when set via\n * ExpressionLexer.configuredLookup.\n *\n * @param localeCode - The locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @returns A frozen TokenLookup ready for consumption by the lexer.\n */\nexport function buildTokenLookup(localeCode = 'en'): TokenLookup {\n const locale: ILocale = getLocale(localeCode);\n const registry = new TokenClassRegistry();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);\n\n // Layer 2: Known units (checked after keyword lookup)\n registry.setUnits(knownUnits);\n\n // Build and return the lookup\n return registry.build();\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=typeof process<"u"&&process.env.DEBUG_ABORTCTRL==="true",t={get enabled(){return r},keystrokeCreated(){r&&console.debug("[AbortCtrl] KEYSTROKE CREATED");},keystrokeAborted(e){r&&console.debug(`[AbortCtrl] KEYSTROKE ABORTED: ${e}`);},localControllerCreated(e){r&&console.debug(`[AbortCtrl] LOCAL CREATED (${e})`);},signalLinked(e){r&&console.debug(`[AbortCtrl] LOCAL LINKED (${e}) \u2192 keystroke`);},signalUnlinked(e){r&&console.debug(`[AbortCtrl] LOCAL UNLINKED (${e})`);},keystrokeSignalSet(e){r&&console.debug(`[AbortCtrl] KEYSTROKE_SIGNAL \u2192 engine (aborted=${e})`);},keystrokeSignalCleared(){r&&console.debug("[AbortCtrl] KEYSTROKE_SIGNAL cleared (null)");},staleDataDiscarded(e,o){r&&console.debug(`[AbortCtrl] STALE DISCARD: ${e} (${o})`);}};export{t as a};//# sourceMappingURL=chunk-MIQBJGGR.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-MIQBJGGR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utilities/AbortControllerLogger.ts"],"names":["isDebugEnabled","abortLogger","reason","source","isAborted","queryKey","context"],"mappings":"AA4BA,IAAMA,CAAAA,CAAiB,OAAO,OAAA,CAAY,GAAA,EAAe,QAAQ,GAAA,CAAI,eAAA,GAAoB,MAAA,CAQ5EC,CAAAA,CAAc,CAE1B,IAAI,SAAmB,CACtB,OAAOD,CACR,CAAA,CAQA,gBAAA,EAAyB,CACnBA,CAAAA,EACL,OAAA,CAAQ,KAAA,CAAM,+BAA+B,EAC9C,CAAA,CAOA,iBAAiBE,CAAAA,CAAsB,CACjCF,GACL,OAAA,CAAQ,KAAA,CAAM,kCAAkCE,CAAM,CAAA,CAAE,EACzD,CAAA,CAUA,sBAAA,CAAuBC,CAAAA,CAAsB,CACvCH,CAAAA,EACL,OAAA,CAAQ,MAAM,CAAA,2BAAA,EAA8BG,CAAM,GAAG,EACtD,CAAA,CAQA,YAAA,CAAaA,CAAAA,CAAsB,CAC7BH,CAAAA,EACL,QAAQ,KAAA,CAAM,CAAA,0BAAA,EAA6BG,CAAM,CAAA,kBAAA,CAAe,EACjE,EAOA,cAAA,CAAeA,CAAAA,CAAsB,CAC/BH,CAAAA,EACL,OAAA,CAAQ,KAAA,CAAM,+BAA+BG,CAAM,CAAA,CAAA,CAAG,EACvD,CAAA,CAQA,kBAAA,CAAmBC,EAA0B,CACvCJ,CAAAA,EACL,OAAA,CAAQ,KAAA,CACP,CAAA,oDAAA,EAAkDI,CAAS,GAC5D,EACD,CAAA,CAMA,wBAA+B,CACzBJ,CAAAA,EACL,QAAQ,KAAA,CAAM,6CAA6C,EAC5D,CAAA,CAUA,kBAAA,CAAmBK,CAAAA,CAAkBC,EAAuB,CACtDN,CAAAA,EACL,QAAQ,KAAA,CACP,CAAA,2BAAA,EAA8BK,CAAQ,CAAA,EAAA,EAAKC,CAAO,CAAA,CAAA,CACnD,EACD,CACD","file":"chunk-MIQBJGGR.js","sourcesContent":["/**\n * Debug logging for the AbortController lifecycle in the \"One AbortController\n * Per Keystroke\" pattern.\n *\n * Enabled when `process.env.DEBUG_ABORTCTRL === \"true\"`.\n *\n * This is **opt-in only**, even in development mode you must explicitly\n * set the flag to avoid log noise from large documents.\n *\n * Logs controller creation, abortion, signal linking, keystroke signal\n * propagation, and stale-data discard guards. All messages are output via\n * `console.debug` with an `[AbortCtrl]` prefix so they can be filtered\n * in the DevTools console.\n *\n * ── Usage ─────────────────────────────────────────────────────────────\n * import { abortLogger } from \"@solve-js/utilities/AbortControllerLogger\";\n *\n * // Enable explicitly (before the plugin boots):\n * // process.env.DEBUG_ABORTCTRL = \"true\";\n *\n * abortLogger.keystrokeCreated();\n * abortLogger.localControllerCreated(\"executeAndStore\");\n * abortLogger.signalLinked(\"executeAndStore\", \"keystroke\");\n * abortLogger.keystrokeAborted(\"New keystroke\");\n * abortLogger.staleDataDiscarded(\"USD:GBP\", \"signal aborted\");\n * abortLogger.keystrokeSignalSet(true); // signal set, not aborted\n * abortLogger.keystrokeSignalCleared();\n */\nconst isDebugEnabled = typeof process !== \"undefined\" && process.env.DEBUG_ABORTCTRL === \"true\";\n\n/**\n * Records abort-signal lifecycle for debugging cancellation.\n *\n * Keystroke cancellation is hard to reason about after the fact, because the\n * evidence is gone by the time anything looks wrong. This keeps it.\n */\nexport const abortLogger = {\n\t/** Whether debug logging is currently active. */\n\tget enabled(): boolean {\n\t\treturn isDebugEnabled;\n\t},\n\n\t// ── Keystroke-level controller (MarkdownEditorViewPlugin) ──────\n\n\t/**\n\t * Log creation of the keystroke-level AbortController.\n\t * Called in the plugin constructor and on each new keystroke.\n\t */\n\tkeystrokeCreated(): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(\"[AbortCtrl] KEYSTROKE CREATED\");\n\t},\n\n\t/**\n\t * Log abortion of the keystroke-level AbortController.\n\t * @param reason Why the keystroke was aborted (e.g. \"New keystroke\",\n\t * \"Document switch\", \"Plugin destroyed\").\n\t */\n\tkeystrokeAborted(reason: string): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(`[AbortCtrl] KEYSTROKE ABORTED: ${reason}`);\n\t},\n\n\t// ── Local per-evaluation controllers (ExpressionEngine) ─────────\n\n\t/**\n\t * Log creation of a local AbortController that is linked to the\n\t * keystroke signal.\n\t * @param source Which code path created the controller\n\t * (e.g. \"executeAndStore\", \"executeRaw\", \"preflight\", \"vm\").\n\t */\n\tlocalControllerCreated(source: string): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(`[AbortCtrl] LOCAL CREATED (${source})`);\n\t},\n\n\t/**\n\t * Log that a local AbortController was linked to the keystroke signal.\n\t * When the keystroke signal is aborted, this local controller will\n\t * be aborted automatically.\n\t * @param source The code path that created the controller.\n\t */\n\tsignalLinked(source: string): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(`[AbortCtrl] LOCAL LINKED (${source}) → keystroke`);\n\t},\n\n\t/**\n\t * Log that a local AbortController's listener was removed from the\n\t * keystroke signal (cleanup).\n\t * @param source The code path.\n\t */\n\tsignalUnlinked(source: string): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(`[AbortCtrl] LOCAL UNLINKED (${source})`);\n\t},\n\n\t// ── Keystroke signal propagation (ThreeTierEvaluator → ExpressionEngine) ──\n\n\t/**\n\t * Log that the keystroke signal was propagated INTO the engine.\n\t * @param isAborted Whether the signal was already aborted when set.\n\t */\n\tkeystrokeSignalSet(isAborted: boolean): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(\n\t\t\t`[AbortCtrl] KEYSTROKE_SIGNAL → engine (aborted=${isAborted})`,\n\t\t);\n\t},\n\n\t/**\n\t * Log that the keystroke signal was CLEARED from the engine\n\t * (typically in the evaluator's finally block).\n\t */\n\tkeystrokeSignalCleared(): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(\"[AbortCtrl] KEYSTROKE_SIGNAL cleared (null)\");\n\t},\n\n\t// ── Stale-data discard guards (resolveAsync) ────────────────────\n\n\t/**\n\t * Log that a stale async result was discarded because its signal\n\t * was aborted.\n\t * @param queryKey The cache key for the discarded result.\n\t * @param context Additional context (e.g. \"after await\", \"after error\").\n\t */\n\tstaleDataDiscarded(queryKey: string, context: string): void {\n\t\tif (!isDebugEnabled) return;\n\t\tconsole.debug(\n\t\t\t`[AbortCtrl] STALE DISCARD: ${queryKey} (${context})`,\n\t\t);\n\t},\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var o=(e=>(e.PARSING="PARSING",e.EXECUTION="EXECUTION",e.VALIDATION="VALIDATION",e.EXTERNAL="EXTERNAL",e.INTERNAL="INTERNAL",e.CONFIG="CONFIG",e))(o||{}),N=class E extends Error{constructor(r,_){super(_.message),this.name="EngineError",this.category=r,this.code=_.code,this.expected=_.expected,this.found=_.found,this.suggestion=_.suggestion,this.recoverable=_.recoverable??true,this.span=_.span,this.context=_.context,this.cause=_.cause,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,E);}isFatal(){return !this.recoverable}causeChain(){let r=[this],_=this.cause;for(;_!=null;)r.push(_),_=_ instanceof Error?_.cause:void 0;return r}format(){let r=[`error[${this.code}]: ${this.message}`];return this.expected&&r.push(` expected: ${this.expected}`),this.found&&r.push(` found: ${this.found}`),this.suggestion&&r.push(` suggestion: ${this.suggestion}`),r.join(`
|
|
2
|
+
`)}toJSON(){return {name:this.name,category:this.category,code:this.code,message:this.message,expected:this.expected,found:this.found,suggestion:this.suggestion,recoverable:this.recoverable,span:this.span,context:this.context,timestamp:this.timestamp.toISOString()}}},I=class E{static build(r,_,n,R,A){let e=typeof n=="string"?{code:n,message:R,context:A}:n;return new N(r,{recoverable:_,...e})}static validation(r,_,n){return E.build("VALIDATION",true,r,_,n)}static parsing(r,_,n){return E.build("PARSING",true,r,_,n)}static execution(r,_,n){return E.build("EXECUTION",true,r,_,n)}static external(r,_,n){return E.build("EXTERNAL",true,r,_,n)}static internal(r,_,n){return E.build("INTERNAL",true,r,_,n)}static config(r,_,n){return E.build("CONFIG",false,r,_,n)}};function t(E){return E instanceof N?E:E instanceof Error?I.internal({code:"UNEXPECTED_ERROR",message:E.message,context:{originalErrorName:E.name},cause:E,recoverable:true}):I.internal({code:"UNKNOWN_ERROR",message:"An unknown error occurred",context:{error:String(E)},recoverable:true})}function O(E){return {ok:true,value:E}}function T(E){return {ok:false,error:E}}function i(E){return E.ok}function s(E){return !E.ok}function S(E,r){return E.ok?O(r(E.value)):E}function C(E,r){return E.ok?E:T(r(E.error))}function D(E,r){return E.ok?r(E.value):E}function L(E,r){return E.ok?E.value:r}function U(E,r){return E.ok?r.ok(E.value):r.err(E.error)}function u(E){let r=[];for(let _ of E){if(!_.ok)return _;r.push(_.value);}return O(r)}function a(E){if(E.ok)return E.value;throw E.error}function c(E,r=t){try{return O(E())}catch(_){return T(r(_))}}async function M(E,r=t){try{return O(await E())}catch(_){return T(r(_))}}var P={INVALID_NUMBER_LITERAL:"INVALID_NUMBER_LITERAL",UNTERMINATED_STRING:"UNTERMINATED_STRING",NO_PREFIX_PARSELET:"NO_PREFIX_PARSELET",UNEXPECTED_END_OF_INPUT:"UNEXPECTED_END_OF_INPUT",UNEXPECTED_TOKEN_TYPE:"UNEXPECTED_TOKEN_TYPE",NESTING_DEPTH_EXCEEDED:"NESTING_DEPTH_EXCEEDED",UNEXPECTED_END:"UNEXPECTED_END",UNEXPECTED_TRAILING_TOKEN:"UNEXPECTED_TRAILING_TOKEN",PARSE_ERROR:"PARSE_ERROR",TOO_MANY_NUMERIC_CONSTANTS:"TOO_MANY_NUMERIC_CONSTANTS",TOO_MANY_STRING_CONSTANTS:"TOO_MANY_STRING_CONSTANTS",NO_MATCHING_PHRASE_ALTERNATIVE:"NO_MATCHING_PHRASE_ALTERNATIVE",INVALID_PHRASE_PATTERN:"INVALID_PHRASE_PATTERN",PHRASE_KEYWORD_MISMATCH:"PHRASE_KEYWORD_MISMATCH",USER_FUNCTION_INVALID_PARAM_NAME:"USER_FUNCTION_INVALID_PARAM_NAME",USER_FUNCTION_NO_PARAMS:"USER_FUNCTION_NO_PARAMS",FUNCTION_BODY_MUST_BE_SYNCHRONOUS:"FUNCTION_BODY_MUST_BE_SYNCHRONOUS",TOO_MANY_FUNCTION_DEFINITIONS:"TOO_MANY_FUNCTION_DEFINITIONS",TOO_MANY_ANONYMOUS_BODIES:"TOO_MANY_ANONYMOUS_BODIES",UNKNOWN_PLUGIN_FUNCTION:"UNKNOWN_PLUGIN_FUNCTION",EVALUATION_ERROR:"EVALUATION_ERROR",INSTRUCTION_LIMIT_EXCEEDED:"INSTRUCTION_LIMIT_EXCEEDED",STACK_LIMIT_EXCEEDED:"STACK_LIMIT_EXCEEDED",ALLOCATION_LIMIT_EXCEEDED:"ALLOCATION_LIMIT_EXCEEDED",STACK_UNDERFLOW:"STACK_UNDERFLOW",UNDEFINED_VARIABLE:"UNDEFINED_VARIABLE",GLOBAL_VARIABLE_NOT_RESOLVED:"GLOBAL_VARIABLE_NOT_RESOLVED",UNKNOWN_FUNCTION:"UNKNOWN_FUNCTION",UNEXPECTED_PENDING_RESULT:"UNEXPECTED_PENDING_RESULT",UNDEFINED_FUNCTION:"UNDEFINED_FUNCTION",FUNCTION_ARITY_MISMATCH:"FUNCTION_ARITY_MISMATCH",BUILTIN_ARITY_MISMATCH:"BUILTIN_ARITY_MISMATCH",USER_FUNCTION_ASYNC_UNSUPPORTED:"USER_FUNCTION_ASYNC_UNSUPPORTED",MAP_REDUCE_ASYNC_UNSUPPORTED:"MAP_REDUCE_ASYNC_UNSUPPORTED",SYMBOLIC_ASYNC_UNSUPPORTED:"SYMBOLIC_ASYNC_UNSUPPORTED",EXPLAIN_ASYNC_UNSUPPORTED:"EXPLAIN_ASYNC_UNSUPPORTED",FUNCTION_RECURSION_LIMIT_EXCEEDED:"FUNCTION_RECURSION_LIMIT_EXCEEDED",FUNCTION_CALL_LIMIT_EXCEEDED:"FUNCTION_CALL_LIMIT_EXCEEDED",DATE_OFFSET_LIMIT_EXCEEDED:"DATE_OFFSET_LIMIT_EXCEEDED",WORKDAY_OFFSET_EXPECTED_DATE:"WORKDAY_OFFSET_EXPECTED_DATE",WORKDAYS_BETWEEN_EXPECTED_DATES:"WORKDAYS_BETWEEN_EXPECTED_DATES",WORKDAYS_BETWEEN_RANGE_TOO_LARGE:"WORKDAYS_BETWEEN_RANGE_TOO_LARGE",BIGINT_SHIFT_LIMIT_EXCEEDED:"BIGINT_SHIFT_LIMIT_EXCEEDED",BIGINT_POW_LIMIT_EXCEEDED:"BIGINT_POW_LIMIT_EXCEEDED",BIGINT_INEXACT_OPERAND:"BIGINT_INEXACT_OPERAND",BIGINT_DIVISION_BY_ZERO:"BIGINT_DIVISION_BY_ZERO",INTERNAL_MISSING_FUNCTION_BODY:"INTERNAL_MISSING_FUNCTION_BODY",INTERNAL_MISSING_ANONYMOUS_BODY:"INTERNAL_MISSING_ANONYMOUS_BODY",MALFORMED_BYTECODE_TRUNCATED:"MALFORMED_BYTECODE_TRUNCATED",MALFORMED_BYTECODE_CONSTANT_INDEX:"MALFORMED_BYTECODE_CONSTANT_INDEX",MALFORMED_BYTECODE_OPERAND_TYPE:"MALFORMED_BYTECODE_OPERAND_TYPE",MALFORMED_BYTECODE_BODY_KIND:"MALFORMED_BYTECODE_BODY_KIND",MALFORMED_BYTECODE_BIGINT_LITERAL:"MALFORMED_BYTECODE_BIGINT_LITERAL",MALFORMED_BYTECODE_PROGRAM:"MALFORMED_BYTECODE_PROGRAM",SYMBOLIC_RATIONAL_OVERFLOW:"SYMBOLIC_RATIONAL_OVERFLOW",SYMBOLIC_NONFINITE_OPERAND:"SYMBOLIC_NONFINITE_OPERAND",SYMBOLIC_DIVISION_BY_ZERO:"SYMBOLIC_DIVISION_BY_ZERO",SYMBOLIC_NODE_LIMIT_EXCEEDED:"SYMBOLIC_NODE_LIMIT_EXCEEDED",SYMBOLIC_UNSUPPORTED_FUNCTION:"SYMBOLIC_UNSUPPORTED_FUNCTION",SYMBOLIC_FACTOR_LIMIT_EXCEEDED:"SYMBOLIC_FACTOR_LIMIT_EXCEEDED",SYMBOLIC_SOLVE_UNSUPPORTED:"SYMBOLIC_SOLVE_UNSUPPORTED",SYMBOLIC_SOLVE_INCOMPLETE:"SYMBOLIC_SOLVE_INCOMPLETE",SOLVE_REQUIRES_VARIABLE_NAME:"SOLVE_REQUIRES_VARIABLE_NAME",SYMBOLIC_DERIVATIVE_ORDER_LIMIT:"SYMBOLIC_DERIVATIVE_ORDER_LIMIT",SYMBOLIC_INTEGRAL_UNSUPPORTED:"SYMBOLIC_INTEGRAL_UNSUPPORTED",SYMBOLIC_TAYLOR_DEGREE_LIMIT:"SYMBOLIC_TAYLOR_DEGREE_LIMIT",SYMBOLIC_TAYLOR_INEXACT:"SYMBOLIC_TAYLOR_INEXACT",SYMBOLIC_REQUIRES_VARIABLE_NAME:"SYMBOLIC_REQUIRES_VARIABLE_NAME",SYMBOLIC_JACOBIAN_NO_VARIABLES:"SYMBOLIC_JACOBIAN_NO_VARIABLES",INTERNAL_RATIONAL_PARSE:"INTERNAL_RATIONAL_PARSE",EXPRESSION_TOO_LONG:"EXPRESSION_TOO_LONG",EXPRESSION_TOO_COMPLEX:"EXPRESSION_TOO_COMPLEX",DOCUMENT_TOO_LARGE:"DOCUMENT_TOO_LARGE",NORMALIZED_TOKEN_LIMIT_EXCEEDED:"NORMALIZED_TOKEN_LIMIT_EXCEEDED",THEREFORE_REQUIRES_EXPRESSION:"THEREFORE_REQUIRES_EXPRESSION",THEREFORE_ASYNC_UNSUPPORTED:"THEREFORE_ASYNC_UNSUPPORTED",COMPOUND_ASSIGN_REQUIRES_EXPRESSION:"COMPOUND_ASSIGN_REQUIRES_EXPRESSION",COMPOUND_ASSIGN_ASYNC_UNSUPPORTED:"COMPOUND_ASSIGN_ASYNC_UNSUPPORTED",UNKNOWN_SAVINGS_PERIOD:"UNKNOWN_SAVINGS_PERIOD",INVALID_TIME_LITERAL:"INVALID_TIME_LITERAL",SNAPSHOT_VERSION_MISMATCH:"SNAPSHOT_VERSION_MISMATCH",SNAPSHOT_MALFORMED:"SNAPSHOT_MALFORMED",SNAPSHOT_UNSUPPORTED_VALUE:"SNAPSHOT_UNSUPPORTED_VALUE",CONFIG_PATH_NOT_FOUND:"CONFIG_PATH_NOT_FOUND",INVALID_CONFIG_PATH:"INVALID_CONFIG_PATH",CONFIG_SECTION_NOT_FOUND:"CONFIG_SECTION_NOT_FOUND",CONFIG_PROPERTY_NOT_FOUND:"CONFIG_PROPERTY_NOT_FOUND",PLUGIN_OPERATOR_COLLISION:"PLUGIN_OPERATOR_COLLISION",PLUGIN_KEYWORD_COLLISION:"PLUGIN_KEYWORD_COLLISION",PLUGIN_UNIT_COLLISION:"PLUGIN_UNIT_COLLISION",PACKAGE_ENGINE_VERSION_MISMATCH:"PACKAGE_ENGINE_VERSION_MISMATCH",PACKAGE_ENGINE_VERSION_INVALID_RANGE:"PACKAGE_ENGINE_VERSION_INVALID_RANGE",OPCODE_POOL_EXHAUSTED:"OPCODE_POOL_EXHAUSTED",PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED:"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",INVALID_RATE_UNIT:"INVALID_RATE_UNIT",INVALID_TIMECODE_UNIT:"INVALID_TIMECODE_UNIT",UNEXPECTED_ERROR:"UNEXPECTED_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};export{o as a,N as b,I as c,t as d,O as e,T as f,i as g,s as h,S as i,C as j,D as k,L as l,U as m,u as n,a as o,c as p,M as q,P as r};//# sourceMappingURL=chunk-MPB7KUN5.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-MPB7KUN5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/EngineError.ts","../src/errors/Result.ts","../src/errors/ErrorCode.ts"],"names":["ErrorCategory","EngineError","_EngineError","category","init","chain","current","lines","ErrorFactory","_ErrorFactory","defaultRecoverable","codeOrInit","message","context","normalizeUnknownError","error","ok","value","err","isOk","r","isErr","map","fn","mapErr","andThen","unwrapOr","fallback","match","arms","combine","results","values","throwIfErr","tryCatch","normalize","e","tryCatchAsync","CoreErrorCodes"],"mappings":"AA6BO,IAAKA,OAEVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CAE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CAA2B,2BAAA,CAE3B,6BAA8B,8BAAA,CAE9B,6BAAA,CAA+B,+BAAA,CAE/B,8BAAA,CAAgC,iCAEhC,0BAAA,CAA4B,4BAAA,CAE5B,yBAAA,CAA2B,2BAAA,CAE3B,6BAA8B,8BAAA,CAE9B,+BAAA,CAAiC,iCAAA,CAEjC,6BAAA,CAA+B,gCAE/B,4BAAA,CAA8B,8BAAA,CAE9B,uBAAA,CAAyB,yBAAA,CAEzB,gCAAiC,iCAAA,CAEjC,8BAAA,CAAgC,gCAAA,CAEhC,uBAAA,CAAyB,0BAGzB,mBAAA,CAAqB,qBAAA,CACrB,sBAAA,CAAwB,wBAAA,CAExB,mBAAoB,oBAAA,CACpB,+BAAA,CAAiC,iCAAA,CAEjC,6BAAA,CAA+B,gCAE/B,2BAAA,CAA6B,6BAAA,CAE7B,mCAAA,CAAqC,qCAAA,CAErC,kCAAmC,mCAAA,CAEnC,sBAAA,CAAwB,wBAAA,CAExB,oBAAA,CAAsB,uBAItB,yBAAA,CAA2B,2BAAA,CAE3B,kBAAA,CAAoB,oBAAA,CAEpB,2BAA4B,4BAAA,CAG5B,qBAAA,CAAuB,uBAAA,CACvB,mBAAA,CAAqB,sBACrB,wBAAA,CAA0B,0BAAA,CAC1B,yBAAA,CAA2B,2BAAA,CAG3B,0BAA2B,2BAAA,CAC3B,wBAAA,CAA0B,0BAAA,CAC1B,qBAAA,CAAuB,wBAEvB,+BAAA,CAAiC,iCAAA,CAEjC,oCAAA,CAAsC,sCAAA,CAEtC,sBAAuB,uBAAA,CAEvB,oCAAA,CAAsC,sCAAA,CAGtC,iBAAA,CAAmB,oBACnB,qBAAA,CAAuB,uBAAA,CAGvB,gBAAA,CAAkB,kBAAA,CAClB,cAAe,eACjB","file":"chunk-MPB7KUN5.js","sourcesContent":["/**\n * The engine's structured error type, the \"Rust/Go-style, verbose, easy to\n * tell the issue\" half of the error-handling redesign (the other half is\n * `Result.ts`).\n *\n * Historical note: an earlier version of this class (`UnifiedErrorFramework.ts`,\n * still the import path most of the codebase uses. See that file, now a\n * pure re-export barrel) had a much larger field set (`severity`,\n * `recovery`, a 5-value enum, `ErrorRecoveryManager`) that was almost\n * entirely dead: nothing downstream ever read `.severity`/`.recovery`,\n * only `.message` reliably survived to a caller. This version is smaller\n * and deliberately keeps only fields something actually consumes.\n */\n\nimport type { ErrorCode } from \"@solve-js/errors/ErrorCode\";\n\n/** A character-offset (and optional line/col) span into the original expression text, for a future \"underline the offending token\" UI, not yet wired to one. */\nexport interface SourceSpan {\n start: number;\n end: number;\n line?: number;\n col?: number;\n}\n\n/**\n * Error classification, kept from the original framework, now actually\n * consulted: it's the `format()` header and lets host code group errors\n * by pipeline stage without string-matching `.code`.\n */\nexport enum ErrorCategory {\n /** Errors during expression parsing. */\n PARSING = \"PARSING\",\n /** Errors during bytecode execution. */\n EXECUTION = \"EXECUTION\",\n /** Errors from input validation (safety limits, config). */\n VALIDATION = \"VALIDATION\",\n /** Errors from external services/APIs (currency rates, weather, stocks). */\n EXTERNAL = \"EXTERNAL\",\n /** Internal engine invariant violations. See `recoverable`'s doc comment. */\n INTERNAL = \"INTERNAL\",\n /** Configuration errors. */\n CONFIG = \"CONFIG\",\n}\n\n/** Fields accepted when constructing an {@link EngineError}. */\nexport interface EngineErrorInit {\n /** Catalog code. See `errors/ErrorCode.ts`. Not a free string: every code used by a BUILT-IN package should be registered there so `ErrorCodeCatalog.spec.ts` can catch collisions/typos. Third-party packages may still use any string here, `EngineError.code`'s runtime type is `string`. */\n code: ErrorCode | (string & {});\n /** Short, single-line, `Error.message`-compatible. Existing `.toThrow(/pattern/)`/`.message` assertions keep working against this field, richer detail goes in `expected`/`found`/`suggestion`, not crammed into this string. */\n message: string;\n /** What the parser/validator/VM expected to see, in plain words, e.g. \"a city name\", \"a 4-digit year\", \"end of expression\". */\n expected?: string;\n /** What was actually found instead, e.g. \"end of expression\", `NUMBER \"5\"`, the offending token's literal text. */\n found?: string;\n /** An actionable, worked-example fix, e.g. `e.g. \"weather in London\"`. Mirrors this codebase's best existing messages (`WEATHER_EXPECTED_CITY`, `AS_CONVERTER_EXPECTED_NAME`). */\n suggestion?: string;\n /**\n * Whether this engine instance is still usable. `true` for everything that\n * went wrong on ONE line, whether the line's fault (bad syntax, an unknown\n * variable, a safety limit exceeded), the environment's (an external API\n * down), or the engine's own (corrupted bytecode, a stack underflow from a\n * buggy plugin). `false` is for the far rarer case where there is no working\n * engine to go on with: a configuration or package-registration failure,\n * which is what `ErrorFactory.config()` is for and the only factory method\n * that still defaults to it.\n *\n * The category answers a different question, and the two used to be answered\n * as one. Category INTERNAL says whose fault this is, the engine's, worth\n * reporting as a bug. `recoverable` says whether the host may carry on, and\n * after an internal slip on one line it may:\n * `__tests__/hardening/RobustnessEngineLifecycle.spec.ts` alternates a\n * throwing line with a good one five hundred times and every answer stays\n * correct. Reporting that as `isFatal()` told a host the opposite, and a host\n * that honours the name would tear a document down over one bad line.\n *\n * This has never gated \"does evaluation of the rest of the document\n * continue\"; with this engine's per-line containment it always does, even for\n * a `recoverable: false` error (see `ARCHITECTURE.md`'s async-batcher/Tier-2\n * hardening notes). It gates what a host is TOLD. See\n * {@link EngineError.isFatal}.\n */\n recoverable?: boolean;\n /** Character-offset span into the source expression, when available. Not yet threaded through every call site, populate opportunistically, don't block on retrofitting every existing throw site. */\n span?: SourceSpan;\n /** Free-form structured context. The one field the pre-existing framework's real consumer (`ThreeTierEvaluator.ts`'s DAG-preservation-on-compile-error path) actually reads, kept name- and shape-compatible on purpose. */\n context?: Record<string, unknown>;\n /** The underlying error this one wraps, if any, passed straight through to native `Error.cause` (ES2022), so Node's default printer, most loggers, and `instanceof Error` tooling understand the chain for free. */\n cause?: unknown;\n}\n\n/**\n * The engine's structured error type. Still a real `Error` subclass (so\n * `throw`/`catch`/`instanceof Error` all keep working exactly as before),\n * but now every field except the removed `severity`/`recovery` pair is\n * something real code reads.\n */\nexport class EngineError extends Error {\n readonly category: ErrorCategory;\n readonly code: string;\n readonly expected?: string;\n readonly found?: string;\n readonly suggestion?: string;\n readonly recoverable: boolean;\n readonly span?: SourceSpan;\n readonly context?: Record<string, unknown>;\n readonly timestamp: Date;\n /**\n * Set explicitly (not via `super(message, {cause})`). This repo's\n * `tsconfig.json` targets ES6/ES5-ES7 lib, which predates TypeScript's\n * ES2022 `Error` constructor `cause`-option overload. `Error.prototype.cause`\n * is still a real runtime feature in every target this engine actually\n * runs in (Node 16.9+, all evergreen browsers, Electron/Obsidian's\n * bundled Chromium) regardless of the TS lib target used to type-check\n * against it, assigning it directly gets the same Node-printer/logger\n * interop with no build-config change needed.\n */\n readonly cause?: unknown;\n\n constructor(category: ErrorCategory, init: EngineErrorInit) {\n super(init.message);\n this.name = \"EngineError\";\n this.category = category;\n this.code = init.code;\n this.expected = init.expected;\n this.found = init.found;\n this.suggestion = init.suggestion;\n this.recoverable = init.recoverable ?? true;\n this.span = init.span;\n this.context = init.context;\n this.cause = init.cause;\n this.timestamp = new Date();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, EngineError);\n }\n }\n\n /** `!recoverable`. See `EngineErrorInit.recoverable`'s doc comment for what this actually gates (message framing/telemetry, not whether evaluation continues). */\n isFatal(): boolean {\n return !this.recoverable;\n }\n\n /** Walk `.cause` repeatedly, collecting the full chain (this error first). */\n causeChain(): unknown[] {\n const chain: unknown[] = [this];\n let current: unknown = this.cause;\n while (current !== undefined && current !== null) {\n chain.push(current);\n current = current instanceof Error ? (current as Error & { cause?: unknown }).cause : undefined;\n }\n return chain;\n }\n\n /**\n * Rust/Go-style multi-line renderer, the NEW thing a host/CLI/test\n * reaches for when it wants the full, verbose picture, as distinct from\n * `.message` (kept short and stable for existing assertions). Example:\n *\n * ```\n * error[WEATHER_EXPECTED_CITY]: Expected a city name after \"weather in\"\n * expected: a city name\n * found: end of expression\n * suggestion: e.g. \"weather in London\"\n * ```\n */\n format(): string {\n const lines = [`error[${this.code}]: ${this.message}`];\n if (this.expected) lines.push(` expected: ${this.expected}`);\n if (this.found) lines.push(` found: ${this.found}`);\n if (this.suggestion) lines.push(` suggestion: ${this.suggestion}`);\n return lines.join(\"\\n\");\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n category: this.category,\n code: this.code,\n message: this.message,\n expected: this.expected,\n found: this.found,\n suggestion: this.suggestion,\n recoverable: this.recoverable,\n span: this.span,\n context: this.context,\n timestamp: this.timestamp.toISOString(),\n };\n }\n}\n\n/**\n * Factory for creating classified `EngineError`s. Every method accepts\n * EITHER the original, minimal 3-arg shape (`code, message, context?`\n * every existing call site across the codebase keeps compiling unchanged)\n * OR the richer `EngineErrorInit` object (for `expected`/`found`/\n * `suggestion`/`recoverable`/`span`/`cause`), upgrade a call site to the\n * richer form only when you're already touching it, no separate churn\n * pass required.\n */\nexport class ErrorFactory {\n private static build(\n category: ErrorCategory,\n defaultRecoverable: boolean,\n codeOrInit: string | EngineErrorInit,\n message?: string,\n context?: Record<string, unknown>,\n ): EngineError {\n const init: EngineErrorInit =\n typeof codeOrInit === \"string\"\n ? { code: codeOrInit, message: message!, context }\n : codeOrInit;\n return new EngineError(category, { recoverable: defaultRecoverable, ...init });\n }\n\n static validation(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static validation(init: EngineErrorInit): EngineError;\n static validation(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.VALIDATION, true, codeOrInit, message, context);\n }\n\n static parsing(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static parsing(init: EngineErrorInit): EngineError;\n static parsing(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.PARSING, true, codeOrInit, message, context);\n }\n\n static execution(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static execution(init: EngineErrorInit): EngineError;\n static execution(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXECUTION, true, codeOrInit, message, context);\n }\n\n static external(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static external(init: EngineErrorInit): EngineError;\n static external(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXTERNAL, true, codeOrInit, message, context);\n }\n\n /**\n * Reserve for genuine engine-internal invariant violations (corrupted\n * bytecode, a stack underflow from a buggy plugin, an \"impossible\" state),\n * not for user-input errors: the category is a bug report.\n *\n * Defaults `recoverable: true` all the same, because every one of these sites\n * is an invariant that failed on ONE line and none of them leaves the engine\n * unusable. This used to default to `false`, which conflated \"the engine's\n * fault\" with \"the engine is finished\" and told a host to tear a document\n * down over a line it could simply have shown an error against. A site that\n * has looked at its own case and concluded the instance really is gone can\n * still pass `recoverable: false` explicitly. See {@link\n * EngineErrorInit.recoverable}.\n */\n static internal(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static internal(init: EngineErrorInit): EngineError;\n static internal(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.INTERNAL, true, codeOrInit, message, context);\n }\n\n /** Defaults `recoverable: false`, and is now the only method that does: a configuration or package-registration failure is the one class that leaves no working engine to carry on with, rather than one bad line in a document. */\n static config(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static config(init: EngineErrorInit): EngineError;\n static config(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.CONFIG, false, codeOrInit, message, context);\n }\n}\n\n/**\n * Normalize any thrown value into an `EngineError`, an `EngineError`\n * passes through as-is; a plain `Error` gets wrapped (message preserved,\n * original attached via `cause`); anything else becomes a generic\n * \"unknown error\" wrapping the stringified value. Used at every\n * throw-space/Result-space boundary (`Result.tryCatch`'s default\n * `normalize`, the VM's outer execution try/catch, `AsyncResolutionBatcher`'s\n * per-line containment) so a raw `TypeError` from a genuine engine bug\n * still surfaces as a structured, catalogued error instead of an opaque\n * uncaught exception.\n *\n * Both branches state RECOVERABLE explicitly, while keeping the INTERNAL\n * category. The two fields answer different questions and were previously\n * answering the same one:\n *\n * category INTERNAL whose fault is this? The engine's. Worth reporting.\n * recoverable is this engine instance still usable? Yes.\n *\n * Everything reaching here is by definition something the engine did not\n * anticipate on ONE line, and per-line containment means the next line\n * evaluates normally, which `__tests__/hardening/RobustnessEngineLifecycle`\n * demonstrates over hundreds of alternating failure/success pairs. Reporting\n * that as `isFatal()` told a host the opposite, and a host that honours the\n * name would tear a document down over a single bad line. The \"this is an\n * engine bug rather than your syntax\" signal a caller wants for telemetry is\n * the CATEGORY, which is unchanged.\n *\n * The flag is written out here rather than inherited from\n * `ErrorFactory.internal()`, which now defaults the same way, so that this\n * function's contract survives a future change to that default.\n */\nexport function normalizeUnknownError(error: unknown): EngineError {\n if (error instanceof EngineError) return error;\n if (error instanceof Error) {\n return ErrorFactory.internal({\n code: \"UNEXPECTED_ERROR\",\n message: error.message,\n context: { originalErrorName: error.name },\n cause: error,\n recoverable: true,\n });\n }\n return ErrorFactory.internal({\n code: \"UNKNOWN_ERROR\",\n message: \"An unknown error occurred\",\n context: { error: String(error) },\n recoverable: true,\n });\n}\n","import { type EngineError, normalizeUnknownError } from \"@solve-js/errors/EngineError\";\n\n/**\n * A Rust-style `Result<T, E>`, the value half of this engine's error-handling\n * redesign. `E` defaults to `EngineError` (this engine's structured error\n * type) but every combinator here is generic over `E`, so `Result` works\n * equally well for a domain that isn't `EngineError`-shaped.\n *\n * This exact shape used to live in `errors/UnifiedErrorFramework.ts` (kept\n * there as a barrel re-export for backward compatibility), moved here as\n * its own module because it's genuinely generic (no dependency on\n * `EngineError` beyond the default type parameter) and because the engine\n * is migrating callers to it incrementally: parsing/VM/package code that\n * expects \"a failure is a possibility, not an exception\" returns\n * `Result<T, EngineError>` instead of throwing; two explicit adapters\n * {@link throwIfErr} and {@link tryCatch}, are the sanctioned way to cross\n * the boundary between Result-based code and still-throw-based code during\n * the migration (and permanently, at the public API boundary. See\n * `ExpressionEngine.evaluateExpression()`'s documented throw contract).\n */\nexport type Result<T, E = EngineError> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/** Wrap a successful value. */\nexport function ok<T>(value: T): Result<T, never> {\n return { ok: true, value };\n}\n\n/** Wrap a failure. */\nexport function err<E>(error: E): Result<never, E> {\n return { ok: false, error };\n}\n\n/**\n * Narrow a {@link Result} to its success arm.\n *\n * @param r - The result to test.\n * @returns True when it succeeded, narrowing `r` so `r.value` is reachable.\n */\nexport function isOk<T, E>(r: Result<T, E>): r is { ok: true; value: T } {\n return r.ok;\n}\n\n/**\n * Narrow a {@link Result} to its failure arm.\n *\n * @param r - The result to test.\n * @returns True when it failed, narrowing `r` so `r.error` is reachable.\n */\nexport function isErr<T, E>(r: Result<T, E>): r is { ok: false; error: E } {\n return !r.ok;\n}\n\n/** Transform the success value; a failure passes through untouched. */\nexport function map<T, U, E>(r: Result<T, E>, fn: (value: T) => U): Result<U, E> {\n return r.ok ? ok(fn(r.value)) : r;\n}\n\n/** Transform the error; a success passes through untouched. */\nexport function mapErr<T, E, F>(r: Result<T, E>, fn: (error: E) => F): Result<T, F> {\n return r.ok ? r : err(fn(r.error));\n}\n\n/** Chain a Result-returning operation onto a success (a.k.a. flatMap/bind). */\nexport function andThen<T, U, E>(r: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E> {\n return r.ok ? fn(r.value) : r;\n}\n\n/** Unwrap a success, or return `fallback` for a failure. Never throws. */\nexport function unwrapOr<T, E>(r: Result<T, E>, fallback: T): T {\n return r.ok ? r.value : fallback;\n}\n\n/** Exhaustive pattern-match, the `match`/`switch` a Rust enum gets for free. */\nexport function match<T, E, R>(r: Result<T, E>, arms: { ok: (value: T) => R; err: (error: E) => R }): R {\n return r.ok ? arms.ok(r.value) : arms.err(r.error);\n}\n\n/**\n * Combine several Results into one, succeeds with a tuple of all values\n * iff every input succeeded; otherwise fails with the FIRST error\n * encountered (left-to-right), matching this codebase's existing\n * fail-fast convention elsewhere (e.g. `BytecodeBuilder`'s constant-pool\n * limit checks).\n */\nexport function combine<T extends readonly unknown[], E>(\n results: { [K in keyof T]: Result<T[K], E> },\n): Result<T, E> {\n const values: unknown[] = [];\n for (const r of results as readonly Result<unknown, E>[]) {\n if (!r.ok) return r;\n values.push(r.value);\n }\n return ok(values as unknown as T);\n}\n\n/**\n * Cross from Result-space back to throw-space, the sanctioned boundary\n * adapter for callers (public API surface, older not-yet-migrated code,\n * tests) that still want exception-based control flow. Throws `r.error`\n * as-is (an `EngineError` is already a real `Error` subclass, so this\n * needs no wrapping).\n */\nexport function throwIfErr<T, E>(r: Result<T, E>): T {\n if (r.ok) return r.value;\n throw r.error;\n}\n\n/**\n * Cross from throw-space into Result-space, runs `fn`, converting any\n * thrown value into a Result via `normalize` (defaults to\n * {@link normalizeUnknownError}). The inverse of {@link throwIfErr}; the\n * pairing that lets Result-based and throw-based code interoperate during\n * an incremental migration instead of requiring a single flag-day rewrite.\n */\nexport function tryCatch<T>(\n fn: () => T,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Result<T, EngineError> {\n try {\n return ok(fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n\n/** Async sibling of {@link tryCatch}. */\nexport async function tryCatchAsync<T>(\n fn: () => Promise<T>,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Promise<Result<T, EngineError>> {\n try {\n return ok(await fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n","/**\n * The built-in error-code catalog, one typed const object per domain\n * unioned together here for autocomplete/exhaustiveness in core engine\n * code. Deliberately NOT one central enum: `IEnginePackage` is documented\n * public SDK surface for third-party packages (see `api/PackageRegistry.ts`),\n * and a closed enum would block an external package author from defining\n * their own codes without editing this file. `EngineError.code`'s runtime\n * type stays `string` for exactly that reason. This catalog is for the\n * codes THIS repo owns and wants collision/typo checking on (see\n * `__tests__/errors/ErrorCodeCatalog.spec.ts`), not a hard runtime\n * whitelist.\n *\n * As each package migrates to `Result<void, EngineError>` (see this\n * session's error-handling-refactor plan, Phase 5), it should export its\n * own small `XxxErrorCodes` const object co-located with its parselets\n * exactly like `CoreErrorCodes` below, just scoped to one domain, and get\n * unioned into `ErrorCode` here. Until a package migrates, its existing\n * free-string codes keep working (ErrorFactory accepts any string); they\n * just aren't caught by the catalog's uniqueness/orphan checks yet.\n */\n\n/**\n * Codes used directly by the parser/VM/engine/errors layers themselves\n * confirmed against the current source, not aspirational. Grouped by\n * pipeline stage via the comments, not a naming prefix (these predate any\n * naming convention and renaming them is out of scope for introducing the\n * catalog, only NEW codes need to follow a scoped/prefixed style, see\n * `STACK_UNDERFLOW` etc. below).\n */\nexport const CoreErrorCodes = {\n // ── Parser (parser/PrecedenceParser.ts, parser/BytecodeBuilder.ts, parser/PhrasePattern.ts) ──\n INVALID_NUMBER_LITERAL: \"INVALID_NUMBER_LITERAL\",\n /** A `\"` that never meets its closing partner (`lexer/ExpressionLexer.ts`'s `tokenizeString()`). Previously the tokenizer ran off the end of the input and returned what it had, so `\"abc` lexed to an ordinary String and an unterminated literal was indistinguishable from a terminated one. */\n UNTERMINATED_STRING: \"UNTERMINATED_STRING\",\n NO_PREFIX_PARSELET: \"NO_PREFIX_PARSELET\",\n UNEXPECTED_END_OF_INPUT: \"UNEXPECTED_END_OF_INPUT\",\n UNEXPECTED_TOKEN_TYPE: \"UNEXPECTED_TOKEN_TYPE\",\n NESTING_DEPTH_EXCEEDED: \"NESTING_DEPTH_EXCEEDED\",\n UNEXPECTED_END: \"UNEXPECTED_END\",\n UNEXPECTED_TRAILING_TOKEN: \"UNEXPECTED_TRAILING_TOKEN\",\n PARSE_ERROR: \"PARSE_ERROR\",\n TOO_MANY_NUMERIC_CONSTANTS: \"TOO_MANY_NUMERIC_CONSTANTS\",\n TOO_MANY_STRING_CONSTANTS: \"TOO_MANY_STRING_CONSTANTS\",\n NO_MATCHING_PHRASE_ALTERNATIVE: \"NO_MATCHING_PHRASE_ALTERNATIVE\",\n INVALID_PHRASE_PATTERN: \"INVALID_PHRASE_PATTERN\",\n PHRASE_KEYWORD_MISMATCH: \"PHRASE_KEYWORD_MISMATCH\",\n /** User-defined-function definition parsing (`f(x, y) = ...`), an invalid token where a parameter name was expected. */\n USER_FUNCTION_INVALID_PARAM_NAME: \"USER_FUNCTION_INVALID_PARAM_NAME\",\n /** `f() = ...` with zero parameters, indistinguishable from a plain no-arg function call, so rejected at definition time. */\n USER_FUNCTION_NO_PARAMS: \"USER_FUNCTION_NO_PARAMS\",\n /** A user-defined function body calling an async plugin (weather/stocks/currency/...), rejected at definition time; v1 scope excludes async function bodies. */\n FUNCTION_BODY_MUST_BE_SYNCHRONOUS: \"FUNCTION_BODY_MUST_BE_SYNCHRONOUS\",\n /** `BytecodeBuilder`'s `userFunctionBodies` side-table exceeding its capacity. Same class as `TOO_MANY_NUMERIC_CONSTANTS`/`TOO_MANY_STRING_CONSTANTS` below. */\n TOO_MANY_FUNCTION_DEFINITIONS: \"TOO_MANY_FUNCTION_DEFINITIONS\",\n /** `BytecodeBuilder`'s `anonymousBodies` side-table (map/reduce inline transform bodies) exceeding its capacity. Same class as `TOO_MANY_FUNCTION_DEFINITIONS` above. */\n TOO_MANY_ANONYMOUS_BODIES: \"TOO_MANY_ANONYMOUS_BODIES\",\n /** New with the 2.0 descriptor redesign: a parselet emits a plugin call by NAME (`BytecodeBuilder.emitPluginCall(name, argCount)`) and the engine resolves that name to the index it assigned at registration. This fires when the name is absent from the builder's name->index map: the package used a `pluginFunctions` name it never declared, or the expression was parsed before that package registered. Not a user-input error; a package-authoring/registration fault. See `parser/BytecodeBuilder.ts`'s `emitPluginCall()`. */\n UNKNOWN_PLUGIN_FUNCTION: \"UNKNOWN_PLUGIN_FUNCTION\",\n\n // ── VM (vm/VM.ts, vm/OpRegistry.ts, vm/VMBuiltins.ts) ──\n EVALUATION_ERROR: \"EVALUATION_ERROR\",\n INSTRUCTION_LIMIT_EXCEEDED: \"INSTRUCTION_LIMIT_EXCEEDED\",\n STACK_LIMIT_EXCEEDED: \"STACK_LIMIT_EXCEEDED\",\n /** One evaluation asking for more elements (collection Values, matrix cells) than `vm.maxAllocatedElements` allows. The counter the two limits above cannot be: both are checked between opcodes, so neither can see what a single opcode allocates inside a loop of its own. See `vm/AllocationBudget.ts`. Recoverable, since it describes this expression rather than the engine. */\n ALLOCATION_LIMIT_EXCEEDED: \"ALLOCATION_LIMIT_EXCEEDED\",\n /** New this phase. See `VM.ts`'s `safePop()`: a stack-underflow (corrupted bytecode, a buggy plugin) is now a controlled EngineError instead of a raw TypeError. Category INTERNAL, since it is an engine or plugin fault rather than a typed line, but recoverable: it happened on one line and the engine is still usable. */\n STACK_UNDERFLOW: \"STACK_UNDERFLOW\",\n UNDEFINED_VARIABLE: \"UNDEFINED_VARIABLE\",\n /** New this phase, the Tier-2/`LOAD_GLOBAL_VAR` hardening: a global variable read before its async preflight resolved, surfaced as a controlled error instead of pushing `undefined`. */\n GLOBAL_VARIABLE_NOT_RESOLVED: \"GLOBAL_VARIABLE_NOT_RESOLVED\",\n UNKNOWN_FUNCTION: \"UNKNOWN_FUNCTION\",\n /** `unwrapEvalResult()`'s pending-when-expecting-value case, a caller-contract violation, not user-input. */\n UNEXPECTED_PENDING_RESULT: \"UNEXPECTED_PENDING_RESULT\",\n /** User-defined-function call/definition errors (`CALL_USER_FUNCTION`/`DEFINE_USER_FUNCTION` opcodes), calling a name with no matching definition, calling with the wrong argument count, and the deliberate v1 restriction that a function body can't itself contain async work. */\n UNDEFINED_FUNCTION: \"UNDEFINED_FUNCTION\",\n FUNCTION_ARITY_MISMATCH: \"FUNCTION_ARITY_MISMATCH\",\n /** The same mistake against a BUILT-IN rather than a user-defined function (`sqrt()`, `atan2(1)`, `sqrt(1,2,3)`). Separate from `FUNCTION_ARITY_MISMATCH` above because the two are raised by different opcodes and a host may want to word them differently. Checked at the `CALL_BUILTIN` dispatch against `vm/VMBuiltinArity.ts`; recoverable, since it is a typo in the line, not an engine fault. */\n BUILTIN_ARITY_MISMATCH: \"BUILTIN_ARITY_MISMATCH\",\n USER_FUNCTION_ASYNC_UNSUPPORTED: \"USER_FUNCTION_ASYNC_UNSUPPORTED\",\n /** A map/reduce transform body (inline expression or user-defined function) calling an async plugin. Same v1 scope restriction as `USER_FUNCTION_ASYNC_UNSUPPORTED` above, enforced both at parse time (`MAP_REDUCE_TRANSFORM_MUST_BE_SYNCHRONOUS`, packages/mapreduce/) and as a defense-in-depth runtime backstop here. */\n MAP_REDUCE_ASYNC_UNSUPPORTED: \"MAP_REDUCE_ASYNC_UNSUPPORTED\",\n /** An algebra verb's expression argument (`BIND_UNKNOWN`'s body) calling an async plugin. Same v1 scope restriction as the two above, and likewise refused at parse time first (`SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS`, packages/symbolic/). */\n SYMBOLIC_ASYNC_UNSUPPORTED: \"SYMBOLIC_ASYNC_UNSUPPORTED\",\n /** `explainLine()` asked to derive a line that resolves data asynchronously (a live-data or async-plugin line). A derivation is a sequence of settled intermediate values, which a pending result has none of, so the line is refused rather than explained with a hole in it. */\n EXPLAIN_ASYNC_UNSUPPORTED: \"EXPLAIN_ASYNC_UNSUPPORTED\",\n /** `pushCallFrame()`'s recursion guard, a nested `CALL_USER_FUNCTION` re-enters `executeBytecode()`, so `maxInstructions` alone can't catch e.g. `f(x) = f(x)`; this is the dedicated backstop. `recoverable: true` (the default for `.execution()`), ordinary user-written infinite recursion, not an engine bug; the guard exists precisely so it surfaces as a clear error instead of overflowing the native call stack uncatchably. */\n FUNCTION_RECURSION_LIMIT_EXCEEDED: \"FUNCTION_RECURSION_LIMIT_EXCEEDED\",\n /** The companion to the code above, and the half it could never see: how MANY user-defined-function calls one evaluation makes, rather than how deeply they nest. A twenty-two-line doubling chain nests twenty-two deep (legal) and makes two million calls (a fatal heap abort). Counted in `vm/AllocationBudget.ts`, because the tally has to survive `executeBytecode()` re-entering itself. Recoverable. */\n FUNCTION_CALL_LIMIT_EXCEEDED: \"FUNCTION_CALL_LIMIT_EXCEEDED\",\n /** A `<date> + N workdays` offset outside `date.maxOffsetYears`/`minOffsetYears`. Workdays are the one date offset that walks the calendar a day at a time, so the one whose cost is the offset; every other one moves a Date field once. Recoverable. */\n DATE_OFFSET_LIMIT_EXCEEDED: \"DATE_OFFSET_LIMIT_EXCEEDED\",\n /** The anchor of `N working days after/before/from <expr>` was not a date (e.g. `5 working days after 3`). The grammar guarantees the count is a number, so this only fires on the anchor. Emitted as a recoverable Error value, not thrown, matching the datetime package's other type guards. See `vm/VM.ts`'s `DATE_WORKDAY_OFFSET` case. */\n WORKDAY_OFFSET_EXPECTED_DATE: \"WORKDAY_OFFSET_EXPECTED_DATE\",\n /** An endpoint of `working days between <expr> and <expr>` was not a date. Recoverable Error value. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_EXPECTED_DATES: \"WORKDAYS_BETWEEN_EXPECTED_DATES\",\n /** The two endpoints of `working days between <expr> and <expr>` are further apart than `date.maxOffsetYears`/`minOffsetYears` allow the count's calendar walk to run. Recoverable Error value, the between-count's equivalent of `DATE_OFFSET_LIMIT_EXCEEDED`. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_RANGE_TOO_LARGE: \"WORKDAYS_BETWEEN_RANGE_TOO_LARGE\",\n /** A `<<`/`>>` with a bigint operand whose exact result would pass `MAX_EXACT_SHIFT_BITS`, whichever operand is the bigint. Both spellings refuse as of 1.0.0: a bigint on the left used to fall through to `x * 2^n` in doubles and report a 19,870-digit integer as Infinity. See `vm/VM.ts`'s `bigIntShift()`. Recoverable. */\n BIGINT_SHIFT_LIMIT_EXCEEDED: \"BIGINT_SHIFT_LIMIT_EXCEEDED\",\n /** The same ceiling for `^`, the operator it was written for: `2n ^ 100000` asks for the same 100,001-bit integer `1n << 100000` does, so the two spellings answer the same way. Also new in 1.0.0, and for the same reason: this used to fall through to the double path and answer Infinity. A fractional or negative exponent (`4n ^ 0.5`, `2n ^ -1`) has no exact answer to bound and still uses the double path. See `vm/VM.ts`'s `MAX_EXACT_POW_BITS`. Recoverable. */\n BIGINT_POW_LIMIT_EXCEEDED: \"BIGINT_POW_LIMIT_EXCEEDED\",\n /** An operand with no whole-number form (a fraction, an infinity, a NaN) meeting a bigint: `1n + 0.5`, `1n & 1.5`, `5n/pi`. `BigInt()` answers those with a raw RangeError, which the VM relabelled UNEXPECTED_ERROR, so a typo in the line was reported as an engine fault. Recoverable; see `vm/VMConversion.ts`'s `toBigIntOperand()`. */\n BIGINT_INEXACT_OPERAND: \"BIGINT_INEXACT_OPERAND\",\n /** `10n / 0n` and `10n mod 0n`. Deliberately NOT what `1 / 0` does, which is Infinity: a bigint division is exact integer division (`7n / 2n` is 3n), and integer division by zero has no answer, exactly as it has none in C, Java, Python or JavaScript's own BigInt. Previously V8's own RangeError, relabelled UNEXPECTED_ERROR. Recoverable; see `vm/VMConversion.ts`'s `bigIntDivisionByZero()`. */\n BIGINT_DIVISION_BY_ZERO: \"BIGINT_DIVISION_BY_ZERO\",\n /** `DEFINE_USER_FUNCTION`'s body-index lookup failing, a compiler/VM invariant violation (the opcode stream referenced a `userFunctionBodies` slot that doesn't exist), never a user-input error. */\n INTERNAL_MISSING_FUNCTION_BODY: \"INTERNAL_MISSING_FUNCTION_BODY\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE`'s anonymous-body-index lookup failing. Same class as `INTERNAL_MISSING_FUNCTION_BODY` above, for the `anonymousBodies` side-table instead of `userFunctionBodies`. */\n INTERNAL_MISSING_ANONYMOUS_BODY: \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n\n // ── Malformed bytecode on the public `./vm` surface (vm/VM.ts) ──\n //\n // `executeBytecode` is exported, so a bytecode program is caller input in\n // the same sense an expression string is, and these five say so. They are\n // VALIDATION rather than INTERNAL for exactly that reason: before they\n // existed, every one of these cases reached a raw TypeError (`BigInt(undefined)`,\n // `code.toUpperCase()` on a boolean, destructuring a program that was not\n // there), which normalised to UNEXPECTED_ERROR and told the caller the\n // engine was broken when their eleven bytes were. Reachable from ordinary\n // source only through a compiler bug, which is why the messages name the\n // opcode and the operand rather than the user's line.\n /** An operand byte read past the end of the stream: the program ends in the middle of an instruction. */\n MALFORMED_BYTECODE_TRUNCATED: \"MALFORMED_BYTECODE_TRUNCATED\",\n /** A constant-pool operand indexing a `numbers`/`strings` entry that does not exist, or that is not of the pool's type. */\n MALFORMED_BYTECODE_CONSTANT_INDEX: \"MALFORMED_BYTECODE_CONSTANT_INDEX\",\n /** A unit or converter name read off the value stack that is not a string. Distinct from the pool case above: the operand is a Value another opcode pushed, not a pool entry. */\n MALFORMED_BYTECODE_OPERAND_TYPE: \"MALFORMED_BYTECODE_OPERAND_TYPE\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE` carrying a body kind other than 0/1/2. Used to fall through every arm with no body and recurse into `executeBytecode(undefined)`. */\n MALFORMED_BYTECODE_BODY_KIND: \"MALFORMED_BYTECODE_BODY_KIND\",\n /** A `PUSH_BIGINT` pool entry that is not a whole number, e.g. `\"1.000\"`. `BigInt()` answers that with a raw SyntaxError. */\n MALFORMED_BYTECODE_BIGINT_LITERAL: \"MALFORMED_BYTECODE_BIGINT_LITERAL\",\n /** `executeBytecode()` called with something that is not a runnable program at all. Checked before the destructure that used to throw outside the function's own try/catch. */\n MALFORMED_BYTECODE_PROGRAM: \"MALFORMED_BYTECODE_PROGRAM\",\n\n // ── Symbolic algebra (symbolic/, vm/SymbolicOps.ts) ──\n /** A coefficient grew past `RATIONAL_MAX_BITS`, e.g. repeated exact elimination multiplying denominators together. */\n SYMBOLIC_RATIONAL_OVERFLOW: \"SYMBOLIC_RATIONAL_OVERFLOW\",\n /** `NaN` or `±Infinity` reaching a symbolic expression, neither of which has an exact rational value. */\n SYMBOLIC_NONFINITE_OPERAND: \"SYMBOLIC_NONFINITE_OPERAND\",\n /** Division by an exactly-zero rational. Exact, unlike the double comparison it replaced, which could not distinguish a true zero from `5.551e-17`. */\n SYMBOLIC_DIVISION_BY_ZERO: \"SYMBOLIC_DIVISION_BY_ZERO\",\n /** A tree exceeding `SYMBOLIC_MAX_NODES` entering the simplifier. */\n SYMBOLIC_NODE_LIMIT_EXCEEDED: \"SYMBOLIC_NODE_LIMIT_EXCEEDED\",\n /** A builtin with no symbolic reading (`min`, `random`, the finance block, ...) applied to an expression still containing an unknown. Returned rather than computing against `toNumber()`'s placeholder zero. */\n SYMBOLIC_UNSUPPORTED_FUNCTION: \"SYMBOLIC_UNSUPPORTED_FUNCTION\",\n /** The rational-root search exceeding `FACTOR_MAX_ROOT_CANDIDATES`. The candidate set is the product of two divisor sets, so a highly-composite coefficient escapes quickly. */\n SYMBOLIC_FACTOR_LIMIT_EXCEEDED: \"SYMBOLIC_FACTOR_LIMIT_EXCEEDED\",\n /** An equation outside what the solver attempts: not a polynomial, above the degree ceiling, or non-linear in the unknown while another unknown is present. */\n SYMBOLIC_SOLVE_UNSUPPORTED: \"SYMBOLIC_SOLVE_UNSUPPORTED\",\n /** Some but not all of an equation's roots were found. Reported rather than returned, because a partial list of roots looks exactly like a complete one. */\n SYMBOLIC_SOLVE_INCOMPLETE: \"SYMBOLIC_SOLVE_INCOMPLETE\",\n /** `solve`'s second argument not being a bare name. */\n SOLVE_REQUIRES_VARIABLE_NAME: \"SOLVE_REQUIRES_VARIABLE_NAME\",\n /** A derivative order outside 0..`DERIVATIVE_MAX_ORDER`. */\n SYMBOLIC_DERIVATIVE_ORDER_LIMIT: \"SYMBOLIC_DERIVATIVE_ORDER_LIMIT\",\n /** An expression with no known elementary antiderivative. Reported rather than approximated, since a wrong integral is indistinguishable from a right one at the point of use. */\n SYMBOLIC_INTEGRAL_UNSUPPORTED: \"SYMBOLIC_INTEGRAL_UNSUPPORTED\",\n /** A Taylor degree outside 0..`TAYLOR_MAX_DEGREE`. */\n SYMBOLIC_TAYLOR_DEGREE_LIMIT: \"SYMBOLIC_TAYLOR_DEGREE_LIMIT\",\n /** A Taylor coefficient that does not reduce to an exact number at the expansion point. */\n SYMBOLIC_TAYLOR_INEXACT: \"SYMBOLIC_TAYLOR_INEXACT\",\n /** An algebra verb's variable-name argument not being a bare name. */\n SYMBOLIC_REQUIRES_VARIABLE_NAME: \"SYMBOLIC_REQUIRES_VARIABLE_NAME\",\n /** `jacobian` called with expressions containing no unknown to differentiate against. */\n SYMBOLIC_JACOBIAN_NO_VARIABLES: \"SYMBOLIC_JACOBIAN_NO_VARIABLES\",\n /** A finite number whose decimal form could not be read back, which the regex covering every `Number.prototype.toString` output should make unreachable. */\n INTERNAL_RATIONAL_PARSE: \"INTERNAL_RATIONAL_PARSE\",\n\n // ── Engine (engine/ExpressionEngine.ts, engine/ExpressionEngineSafety.ts, engine/AsyncResolutionBatcher.ts) ──\n EXPRESSION_TOO_LONG: \"EXPRESSION_TOO_LONG\",\n EXPRESSION_TOO_COMPLEX: \"EXPRESSION_TOO_COMPLEX\",\n /** A document with more lines than `performance.maxDocumentLines`. The per-line limits above bound what one line may ask for and say nothing about how many lines there are; two hundred thousand of `1 + 1` exhausted the heap on the line records alone. Recoverable. */\n DOCUMENT_TOO_LARGE: \"DOCUMENT_TOO_LARGE\",\n NORMALIZED_TOKEN_LIMIT_EXCEEDED: \"NORMALIZED_TOKEN_LIMIT_EXCEEDED\",\n /** `\"=>\"` with nothing before it, needs an expression or variable name to solve/simplify. */\n THEREFORE_REQUIRES_EXPRESSION: \"THEREFORE_REQUIRES_EXPRESSION\",\n /** A `\"=>\"`-triggered expression called an async plugin (weather/stocks/currency). Same v1 scope restriction as user-function/map-reduce bodies. */\n THEREFORE_ASYNC_UNSUPPORTED: \"THEREFORE_ASYNC_UNSUPPORTED\",\n /** A compound assignment (`name += expr` / `name -= expr`) with nothing on the right, a line half-typed on the way to `total += 5`. */\n COMPOUND_ASSIGN_REQUIRES_EXPRESSION: \"COMPOUND_ASSIGN_REQUIRES_EXPRESSION\",\n /** A running total (`+= / -=`) whose right-hand side calls an async plugin (weather/stocks/currency). The same v1 scope restriction as the `\"=>\"` and user-function bodies. */\n COMPOUND_ASSIGN_ASYNC_UNSUPPORTED: \"COMPOUND_ASSIGN_ASYNC_UNSUPPORTED\",\n /** A savings-goal contribution period that is not one of daily/weekly/monthly/yearly (`how long to save $X at $Y <period>`). Names the accepted set. */\n UNKNOWN_SAVINGS_PERIOD: \"UNKNOWN_SAVINGS_PERIOD\",\n /** Colon-separated numbers that are not a time any clock can show (\"24:00\", \"9:60\", \"100:5\"). Raised by the labeled-line fallback, which used to answer them with whatever stood after the colon. */\n INVALID_TIME_LITERAL: \"INVALID_TIME_LITERAL\",\n\n // ── Snapshot / restore (engine/EngineSnapshot.ts, engine/ExpressionEngine.ts) ──\n /** `fromJSON()` handed an object that is not a snapshot at all, or whose serialised-shape version does not match this engine's reader. The versioning gate that refuses an incompatible snapshot clearly rather than restoring it wrongly. See `engine/EngineSnapshot.ts`'s `assertRestorable()`. */\n SNAPSHOT_VERSION_MISMATCH: \"SNAPSHOT_VERSION_MISMATCH\",\n /** A snapshot with the right envelope but internally inconsistent contents (an unrecognised number sentinel, an unknown value tag). Distinct from a version mismatch: the format is right, the payload is not. */\n SNAPSHOT_MALFORMED: \"SNAPSHOT_MALFORMED\",\n /** A value the v1 snapshot format cannot yet represent (a symbolic/algebra value, a symbolic matrix cell). Deferred to a follow-up; refused by name rather than dropped silently. */\n SNAPSHOT_UNSUPPORTED_VALUE: \"SNAPSHOT_UNSUPPORTED_VALUE\",\n\n // ── Config (constants/Configuration.ts) ──\n CONFIG_PATH_NOT_FOUND: \"CONFIG_PATH_NOT_FOUND\",\n INVALID_CONFIG_PATH: \"INVALID_CONFIG_PATH\",\n CONFIG_SECTION_NOT_FOUND: \"CONFIG_SECTION_NOT_FOUND\",\n CONFIG_PROPERTY_NOT_FOUND: \"CONFIG_PROPERTY_NOT_FOUND\",\n\n // ── Package/lexer registration-time collisions (lexer/ExpressionLexer.ts) ──\n PLUGIN_OPERATOR_COLLISION: \"PLUGIN_OPERATOR_COLLISION\",\n PLUGIN_KEYWORD_COLLISION: \"PLUGIN_KEYWORD_COLLISION\",\n PLUGIN_UNIT_COLLISION: \"PLUGIN_UNIT_COLLISION\",\n /** A package's declared `IEnginePackage.engineVersion` semver range doesn't satisfy the running engine's ENGINE_VERSION. See api/EngineVersionCompatibility.ts. */\n PACKAGE_ENGINE_VERSION_MISMATCH: \"PACKAGE_ENGINE_VERSION_MISMATCH\",\n /** A package's declared `IEnginePackage.engineVersion` isn't a parseable semver range at all (a typo in the package's own descriptor). */\n PACKAGE_ENGINE_VERSION_INVALID_RANGE: \"PACKAGE_ENGINE_VERSION_INVALID_RANGE\",\n /** `OpRegistry.allocateOpcode()`'s dynamic opcode pool (started at 201) exhausted, too many packages calling it. */\n OPCODE_POOL_EXHAUSTED: \"OPCODE_POOL_EXHAUSTED\",\n /** `VMBuiltins.allocatePluginFunctionIndex()`'s 0-255 index pool (a single opcode-stream byte) exhausted. */\n PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED: \"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED\",\n\n // ── vm/Value.ts caller-contract violations (check isRateUnit()/isTimecodeUnit() first) ──\n INVALID_RATE_UNIT: \"INVALID_RATE_UNIT\",\n INVALID_TIMECODE_UNIT: \"INVALID_TIMECODE_UNIT\",\n\n // ── errors/EngineError.ts's own fallback normalization ──\n UNEXPECTED_ERROR: \"UNEXPECTED_ERROR\",\n UNKNOWN_ERROR: \"UNKNOWN_ERROR\",\n} as const;\n\n/** Every error code the engine's own layers can produce, from {@link CoreErrorCodes}. */\nexport type CoreErrorCode = (typeof CoreErrorCodes)[keyof typeof CoreErrorCodes];\n\n/**\n * The aggregated catalog type. Currently just `CoreErrorCode`, union in\n * each package's own code-object type here as Phase 5 converts it, e.g.\n * `CoreErrorCode | WeatherErrorCode | StocksErrorCode | ...`.\n */\nexport type ErrorCode = CoreErrorCode;\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var e={code:"en",label:"English",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",and:"AND_CONJ",with:"PLUS",minus:"MINUS",subtract:"MINUS",remove:"MINUS",take:"MINUS",without:"MINUS",times:"STAR",multiply:"STAR",mul:"STAR",divide:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",prime:"CARET",xor:"BIT_XOR",of:"OF",now:"NOW",today:"TODAY",tomorrow:"TOMORROW",yesterday:"YESTERDAY",roll:"ROLL",sqrt:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",ceil:"FUNC",floor:"FUNC",round:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",arcsin:"FUNC",arccos:"FUNC",arctan:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",cbrt:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",root:"FUNC",fact:"FUNC",factorial:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",sind:"FUNC",cosd:"FUNC",tand:"FUNC",asind:"FUNC",acosd:"FUNC",atand:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",random:"FUNC",sign:"FUNC",trunc:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",gcd:"FUNC",lcm:"FUNC",permutation:"FUNC",combination:"FUNC",hex:"FUNC",bin:"FUNC",int:"FUNC",compoundinterest:"FUNC",interestearned:"FUNC",compoundinterestrate:"FUNC",compoundinterestyears:"FUNC",loanrepayment:"FUNC",loaninterest:"FUNC",monthlypayment:"FUNC",taxadd:"FUNC",taxremove:"FUNC",inflationadjust:"FUNC",transpose:"FUNC",det:"FUNC",inv:"FUNC",dot:"FUNC",clamp:"CLAMP",convert:"CONVERT",to:"TO",best:"BEST",in:"IN",into:"IN",next:"NEXT",last:"LAST",until:"UNTIL",since:"SINCE",sunday:"SUNDAY",monday:"MONDAY",tuesday:"TUESDAY",wednesday:"WEDNESDAY",thursday:"THURSDAY",friday:"FRIDAY",saturday:"SATURDAY",between:"BETWEEN",from:"FROM",increase:"INCREASE",decrease:"DECREASE",over:"OVER",at:"RATE_AT",rounded:"ROUNDED",is:"IS",after:"AFTER",for:"FOR_DURATION",compounding:"COMPOUNDING",invested:"INVESTED",returned:"RETURNED",by:"BY",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",float:"FLOAT",global:"GLOBAL",or:"OR",true:"TRUE",false:"FALSE",if:"IF",then:"THEN",else:"ELSE",as:"AS",percent:"CONVERTER_NAME",percentage:"CONVERTER_NAME",decimal:"CONVERTER_NAME",dec:"CONVERTER_NAME",number:"CONVERTER_NAME",fraction:"CONVERTER_NAME",multiplier:"CONVERTER_NAME",sci:"CONVERTER_NAME",scientific:"CONVERTER_NAME",binary:"CONVERTER_NAME",octal:"CONVERTER_NAME",oct:"CONVERTER_NAME"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:".",thousandsSeparator:",",vectorFormat:"[{values}]",percentageSuffix:"%"}};var a={code:"de",label:"Deutsch",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",und:"AND_CONJ",minus:"MINUS",subtract:"MINUS",entfernen:"MINUS",nehmen:"MINUS",mal:"STAR",multiplizieren:"STAR",teilen:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",potenz:"CARET",von:"OF",jetzt:"NOW",heute:"TODAY",morgen:"TOMORROW",gestern:"YESTERDAY",rollen:"ROLL",wurzel:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",aufrunden:"FUNC",abrunden:"FUNC",runden:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",kubikwurzel:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",zufall:"FUNC",zeichen:"FUNC",ganzzahl:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",konvertieren:"CONVERT",in:"TO",amBesten:"BEST",naechste:"NEXT",letzte:"LAST",bis:"UNTIL",seit:"SINCE",sonntag:"SUNDAY",montag:"MONDAY",dienstag:"TUESDAY",mittwoch:"WEDNESDAY",donnerstag:"THURSDAY",freitag:"FRIDAY",samstag:"SATURDAY",zwischen:"BETWEEN",von_ab:"FROM",erhoehen:"INCREASE",verringern:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:".",vectorFormat:"[{values}]",percentageSuffix:"%"}};var t={code:"fr",label:"Fran\xE7ais",keywordMap:{pi:"PI",e:"E",plus:"PLUS",ajouter:"PLUS",et:"AND_CONJ",moins:"MINUS",soustraire:"MINUS",enlever:"MINUS",fois:"STAR",multiplier:"STAR",diviser:"SLASH",modulo:"MOD",mod:"MOD",exposant:"CARET",puissance:"CARET",xor:"BIT_XOR",maintenant:"NOW",aujourdhui:"TODAY",demain:"TOMORROW",hier:"YESTERDAY",lancer:"ROLL",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",min:"FUNC",max:"FUNC",convertir:"CONVERT",prochain:"NEXT",dernier:"LAST",dimanche:"SUNDAY",lundi:"MONDAY",mardi:"TUESDAY",mercredi:"WEDNESDAY",jeudi:"THURSDAY",vendredi:"FRIDAY",samedi:"SATURDAY",entre:"BETWEEN",augmenter:"INCREASE",diminuer:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",vrai:"TRUE",faux:"FALSE",si:"IF",alors:"THEN",sinon:"ELSE"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:" ",vectorFormat:"[{values}]",percentageSuffix:"%"}};var o={en:e,de:a,fr:t};function s(N){return o[N]||e}exports.a=s;//# sourceMappingURL=chunk-MSYX32PF.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-MSYX32PF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/locales/en.ts","../src/constants/locales/de.ts","../src/constants/locales/fr.ts","../src/constants/locales/index.ts"],"names":["enLocale","deLocale","frLocale","locales","getLocale","code"],"mappings":"aAgBO,IAAMA,EAAoB,CAC/B,IAAA,CAAM,IAAA,CACN,KAAA,CAAO,UACP,UAAA,CAAY,CACV,EAAA,CAAI,IAAA,CAAM,EAAG,GAAA,CACb,IAAA,CAAM,MAAA,CAAQ,GAAA,CAAK,OAAQ,GAAA,CAAK,UAAA,CAAY,IAAA,CAAM,MAAA,CAClD,MAAO,OAAA,CAAS,QAAA,CAAU,OAAA,CAAS,MAAA,CAAQ,QAAS,IAAA,CAAM,OAAA,CAC1D,OAAA,CAAS,OAAA,CACT,MAAO,MAAA,CAAQ,QAAA,CAAU,OAAQ,GAAA,CAAK,MAAA,CACtC,OAAQ,OAAA,CACR,MAAA,CAAQ,KAAA,CAAO,GAAA,CAAK,MACpB,QAAA,CAAU,OAAA,CAAS,KAAA,CAAO,OAAA,CAC1B,IAAK,SAAA,CACL,EAAA,CAAI,IAAA,CACJ,GAAA,CAAK,MAAO,KAAA,CAAO,OAAA,CAAS,QAAA,CAAU,UAAA,CAAY,UAAW,WAAA,CAC7D,IAAA,CAAM,MAAA,CACN,IAAA,CAAM,OAAQ,GAAA,CAAK,MAAA,CAAQ,GAAA,CAAK,MAAA,CAAQ,IAAK,MAAA,CAAQ,GAAA,CAAK,MAAA,CAC1D,GAAA,CAAK,OAAQ,IAAA,CAAM,MAAA,CAAQ,MAAO,MAAA,CAAQ,KAAA,CAAO,OAAQ,GAAA,CAAK,MAAA,CAAQ,GAAA,CAAK,MAAA,CAC3E,KAAM,MAAA,CAAQ,IAAA,CAAM,MAAA,CAAQ,IAAA,CAAM,OAAQ,KAAA,CAAO,MAAA,CAGjD,MAAA,CAAQ,MAAA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plies: keywords, units, and number formatting conventions. */\nexport interface ILocale {\n code: string;\n label: string;\n keywordMap: Record<string, string>;\n display: {\n resultPrefix: string;\n dateFormat: string;\n decimalSeparator: string;\n thousandsSeparator: string;\n vectorFormat: string;\n percentageSuffix: string;\n };\n}\n\n/** English keywords, units and number formatting. The default and the fallback. */\nexport const enLocale: ILocale = {\n code: \"en\",\n label: \"English\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", and: \"AND_CONJ\", with: \"PLUS\",\n minus: \"MINUS\", subtract: \"MINUS\", remove: \"MINUS\", take: \"MINUS\",\n without: \"MINUS\",\n times: \"STAR\", multiply: \"STAR\", mul: \"STAR\",\n divide: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", prime: \"CARET\",\n xor: \"BIT_XOR\",\n of: \"OF\",\n now: \"NOW\", today: \"TODAY\", tomorrow: \"TOMORROW\", yesterday: \"YESTERDAY\",\n roll: \"ROLL\",\n sqrt: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", ceil: \"FUNC\", floor: \"FUNC\", round: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n // Long-form aliases for asin/acos/atan (Numi/older-calculator naming\n // convention). Same FunctionCallParselet indices, not new behavior.\n arcsin: \"FUNC\", arccos: \"FUNC\", arctan: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n cbrt: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n // root(n, x) -- n-th root; fact/factorial(n) -- factorial. Bare FUNC\n // keywords, matching gcd/lcm/cbrt's precedent above (technical,\n // call-syntax-only names, not plausible :variableName choices).\n root: \"FUNC\", fact: \"FUNC\", factorial: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n sind: \"FUNC\", cosd: \"FUNC\", tand: \"FUNC\",\n asind: \"FUNC\", acosd: \"FUNC\", atand: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", random: \"FUNC\", sign: \"FUNC\", trunc: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n gcd: \"FUNC\", lcm: \"FUNC\", permutation: \"FUNC\", combination: \"FUNC\",\n // hex/bin double as CONVERTER_NAME below (\"255 as hex\") AND as FUNC\n // call-syntax (\"hex(255)\"), a word can only have one lexer token\n // type, so these win FUNC (removed from the CONVERTER_NAME list\n // below) and AsConverterParselet.ts's \"as <name>\" check was widened\n // to also accept a FUNC-typed token, preserving \"as hex\"/\"as bin\"\n // unchanged. See AsConverterParselet.ts's class doc for the full\n // reasoning.\n hex: \"FUNC\", bin: \"FUNC\", int: \"FUNC\",\n // Finance (packages/finance/) function-call forms. Bare keywords, not\n // phrase-fused, these are camelCase call-only names (e.g.\n // \"compoundInterest(...)\"), not natural-language words a user would\n // plausibly choose as a variable name, so the bare-keyword collision\n // risk that blocks \"interest\"/\"tax\"/\"principal\" etc. doesn't apply here\n // (matches \"gcd\"/\"lcm\"/... above, not \"clamp\" below).\n compoundinterest: \"FUNC\", interestearned: \"FUNC\",\n compoundinterestrate: \"FUNC\", compoundinterestyears: \"FUNC\",\n loanrepayment: \"FUNC\", loaninterest: \"FUNC\", monthlypayment: \"FUNC\",\n taxadd: \"FUNC\", taxremove: \"FUNC\",\n // Inflation-adjusted value function-call form (packages/finance/).\n inflationadjust: \"FUNC\",\n // Matrix (packages/matrix/) function-call forms -- also reachable via\n // `^T`/`^-1` operator syntax and `|a|` (see FunctionCallParselet.ts's\n // builtinNameToIndex comment for indices 63-66).\n transpose: \"FUNC\", det: \"FUNC\", inv: \"FUNC\", dot: \"FUNC\",\n // map/reduce/sum/prod (packages/mapreduce/) are NOT bare keywordMap\n // entries. See packages/mapreduce/normalizer/MapReduceCallNormalizerRule.ts\n // which fuses them ONLY when immediately followed by \"(\" (same\n // \"conditional-on-LPAREN\" pattern as packages/lines/'s own\n // sum(/total(/average( fusion), so `:map = [...]`/`:sum = 100`/etc.\n // keep working as ordinary variable names.\n clamp: \"CLAMP\",\n // `into` is a third spelling of the conversion operator, alongside `to` and\n // `in`. It reads better before a unit than either (\"300 cm into m\"), and\n // costs nothing: it is not a plausible variable name and has no other\n // meaning in the grammar.\n convert: \"CONVERT\", to: \"TO\", best: \"BEST\", in: \"IN\", into: \"IN\",\n next: \"NEXT\", last: \"LAST\", until: \"UNTIL\", since: \"SINCE\",\n sunday: \"SUNDAY\", monday: \"MONDAY\", tuesday: \"TUESDAY\", wednesday: \"WEDNESDAY\",\n thursday: \"THURSDAY\", friday: \"FRIDAY\", saturday: \"SATURDAY\",\n between: \"BETWEEN\", from: \"FROM\",\n increase: \"INCREASE\", decrease: \"DECREASE\",\n // Finance (packages/finance/) phrase-grammar connectors. Bare\n // prepositions, same accepted-risk category as \"between\"/\"from\" above\n // see Token.ts's OVER/RATE_AT doc comment.\n over: \"OVER\", at: \"RATE_AT\",\n // Only \"rounded\". Bare \"round\" is already the round(x) function above.\n rounded: \"ROUNDED\",\n is: \"IS\",\n // The investment grammar (packages/finance/). See Token.ts.\n after: \"AFTER\", for: \"FOR_DURATION\", compounding: \"COMPOUNDING\",\n invested: \"INVESTED\", returned: \"RETURNED\",\n by: \"BY\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n float: \"FLOAT\",\n global: \"GLOBAL\",\n or: \"OR\",\n true: \"TRUE\", false: \"FALSE\",\n if: \"IF\", then: \"THEN\", else: \"ELSE\",\n as: \"AS\",\n percent: \"CONVERTER_NAME\", percentage: \"CONVERTER_NAME\",\n decimal: \"CONVERTER_NAME\", dec: \"CONVERTER_NAME\", number: \"CONVERTER_NAME\",\n fraction: \"CONVERTER_NAME\",\n multiplier: \"CONVERTER_NAME\",\n sci: \"CONVERTER_NAME\", scientific: \"CONVERTER_NAME\",\n // hex/bin are FUNC (see above), not CONVERTER_NAME, \"as hex\"/\"as bin\"\n // still work via AsConverterParselet.ts's widened token-type check.\n binary: \"CONVERTER_NAME\",\n octal: \"CONVERTER_NAME\", oct: \"CONVERTER_NAME\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \".\",\n thousandsSeparator: \",\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { ILocale } from \"./en\";\n\n/** German keywords, units and number formatting. */\nexport const deLocale: ILocale = {\n code: \"de\",\n label: \"Deutsch\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", und: \"AND_CONJ\",\n minus: \"MINUS\", subtract: \"MINUS\", entfernen: \"MINUS\", nehmen: \"MINUS\",\n mal: \"STAR\", multiplizieren: \"STAR\",\n teilen: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", potenz: \"CARET\",\n von: \"OF\",\n jetzt: \"NOW\", heute: \"TODAY\", morgen: \"TOMORROW\", gestern: \"YESTERDAY\",\n rollen: \"ROLL\",\n wurzel: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", aufrunden: \"FUNC\", abrunden: \"FUNC\", runden: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n kubikwurzel: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", zufall: \"FUNC\", zeichen: \"FUNC\", ganzzahl: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n konvertieren: \"CONVERT\", in: \"TO\", amBesten: \"BEST\",\n naechste: \"NEXT\", letzte: \"LAST\", bis: \"UNTIL\", seit: \"SINCE\",\n sonntag: \"SUNDAY\", montag: \"MONDAY\", dienstag: \"TUESDAY\", mittwoch: \"WEDNESDAY\",\n donnerstag: \"THURSDAY\", freitag: \"FRIDAY\", samstag: \"SATURDAY\",\n zwischen: \"BETWEEN\",\n von_ab: \"FROM\",\n erhoehen: \"INCREASE\", verringern: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \".\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};","import { ILocale } from \"./en\";\n\n/**\n * French locale. See GitHub issue #77 (\"Please allow for localized day\n * of the week\"). Matches `de.ts`'s scope, not `en.ts`'s full coverage: a\n * confident, reviewed core set (arithmetic words, date keywords, weekday\n * names, a handful of common functions), not a guess at every FUNC/phrase\n * keyword across every package. Widening this is a good first issue for\n * a native French speaker, PRs welcome, same as this project's existing\n * convention for locale gaps.\n *\n * \"aujourd'hui\" (today) is deliberately spelled without its apostrophe\n * here (`aujourdhui`), `ExpressionLexer`'s identifier reader only\n * accepts `[a-zA-Z_][a-zA-Z0-9_]*` plus Unicode, so the standard spelling\n * can't lex as a single IDENT token at all. This is a real, disclosed\n * limitation, not a translation choice, anyone typing the standard\n * apostrophed spelling won't get a match today.\n */\nexport const frLocale: ILocale = {\n code: \"fr\",\n label: \"Français\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", ajouter: \"PLUS\", et: \"AND_CONJ\",\n moins: \"MINUS\", soustraire: \"MINUS\", enlever: \"MINUS\",\n fois: \"STAR\", multiplier: \"STAR\",\n diviser: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exposant: \"CARET\", puissance: \"CARET\",\n xor: \"BIT_XOR\",\n maintenant: \"NOW\",\n // \"aujourd'hui\". See this file's own doc comment for why the\n // apostrophe is dropped here.\n aujourdhui: \"TODAY\",\n demain: \"TOMORROW\", hier: \"YESTERDAY\",\n lancer: \"ROLL\",\n // Same spellings as English on purpose, not a translation gap: the\n // FUNC token's NAME is looked up in a separate, locale-independent\n // dispatch table (FunctionCallParselet.ts's builtinNameToIndex) that\n // only knows English names, \"racine\" (root) would lex fine as a\n // FUNC token via this keywordMap but then fail at call time with\n // \"Unknown function\", so it's deliberately left out rather than\n // shipped half-working. Widening that dispatch table to be\n // locale-aware is a separate, larger change (it would need the same\n // fix for German too, \"wurzel\" has this identical problem today).\n abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n convertir: \"CONVERT\",\n prochain: \"NEXT\", dernier: \"LAST\",\n dimanche: \"SUNDAY\", lundi: \"MONDAY\", mardi: \"TUESDAY\", mercredi: \"WEDNESDAY\",\n jeudi: \"THURSDAY\", vendredi: \"FRIDAY\", samedi: \"SATURDAY\",\n entre: \"BETWEEN\",\n augmenter: \"INCREASE\", diminuer: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n vrai: \"TRUE\", faux: \"FALSE\",\n si: \"IF\", alors: \"THEN\", sinon: \"ELSE\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \" \",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { enLocale, type ILocale } from \"./en\";\nimport { deLocale } from \"./de\";\nimport { frLocale } from \"./fr\";\n\nconst locales: Record<string, ILocale> = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\n/**\n * Look up a locale by code.\n *\n * @param code - Locale code, for example `\"en\"` or `\"de\"`.\n * @returns The locale, or English when the code is unknown. Falling back\n * rather than throwing means an unrecognised code degrades to a working engine\n * instead of a dead one.\n */\nexport function getLocale(code: string): ILocale {\n return locales[code] || enLocale;\n}\n\n/**\n * Add a locale, or replace one already registered under the same code.\n *\n * @param code - Locale code to register under.\n * @param locale - Keywords, units and formatting for that locale.\n */\nexport function registerLocale(code: string, locale: ILocale): void {\n locales[code] = locale;\n}\n\nexport { enLocale, deLocale, frLocale, type ILocale };"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1,b,c as c$1}from'./chunk-MPB7KUN5.js';var o={WORKER_CANCELLED:"WORKER_CANCELLED",WORKER_TERMINATED:"WORKER_TERMINATED",WORKER_TRANSPORT_FAILED:"WORKER_TRANSPORT_FAILED",WORKER_UNKNOWN_METHOD:"WORKER_UNKNOWN_METHOD",WORKER_NOT_INITIALISED:"WORKER_NOT_INITIALISED",WORKER_UNKNOWN_PACKAGE:"WORKER_UNKNOWN_PACKAGE"};function t(r){let e={name:r.name,category:r.category,code:r.code,message:r.message,recoverable:r.recoverable};return r.expected!==void 0&&(e.expected=r.expected),r.found!==void 0&&(e.found=r.found),r.suggestion!==void 0&&(e.suggestion=r.suggestion),r.span!==void 0&&(e.span=r.span),e}function a(r){let e=Object.values(a$1).includes(r.category)?r.category:"INTERNAL";return new b(e,{code:r.code,message:r.message,expected:r.expected,found:r.found,suggestion:r.suggestion,recoverable:r.recoverable,span:r.span})}function s(r){return c$1.execution(o.WORKER_CANCELLED,r?`The worker request "${r}" was cancelled`:"The worker request was cancelled",r?{method:r}:void 0)}function c(){return c$1.execution(o.WORKER_TERMINATED,"The worker engine was terminated before this request completed")}function g(r){return c$1.external(o.WORKER_TRANSPORT_FAILED,`The worker transport failed: ${r}`,{detail:r})}export{o as a,t as b,a as c,s as d,c as e,g as f};//# sourceMappingURL=chunk-MVZUTETT.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-MVZUTETT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/WorkerError.ts"],"names":["WorkerErrorCodes","serializeEngineError","error","dto","deserializeEngineError","category","ErrorCategory","EngineError","workerCancelledError","method","ErrorFactory","workerTerminatedError","workerTransportError","detail"],"mappings":"sDAoBO,IAAMA,EAAmB,CAE/B,gBAAA,CAAkB,kBAAA,CAElB,iBAAA,CAAmB,oBAEnB,uBAAA,CAAyB,yBAAA,CAEzB,qBAAA,CAAuB,uBAAA,CAEvB,uBAAwB,wBAAA,CAExB,sBAAA,CAAwB,wBACzB,EAyBO,SAASC,CAAAA,CAAqBC,CAAAA,CAA2C,CAC/E,IAAMC,EAA6B,CAClC,IAAA,CAAMD,CAAAA,CAAM,IAAA,CACZ,SAAUA,CAAAA,CAAM,QAAA,CAChB,IAAA,CAAMA,CAAAA,CAAM,KACZ,OAAA,CAASA,CAAAA,CAAM,QACf,WAAA,CAAaA,CAAAA,CAAM,WACpB,CAAA,CAIA,OAAIA,CAAAA,CAAM,QAAA,GAAa,SAAWC,CAAAA,CAAI,QAAA,CAAWD,CAAAA,CAAM,QAAA,CAAA,CACnDA,EAAM,KAAA,GAAU,MAAA,GAAWC,CAAAA,CAAI,KAAA,CAAQD,EAAM,KAAA,CAAA,CAC7CA,CAAAA,CAAM,aAAe,MAAA,GAAWC,CAAAA,CAAI,WAAaD,CAAAA,CAAM,UAAA,CAAA,CAGvDA,CAAAA,CAAM,IAAA,GAAS,SAAWC,CAAAA,CAAI,IAAA,CAAOD,CAAAA,CAAM,IAAA,CAAA,CACxCC,CACR,CAWO,SAASC,CAAAA,CAAuBD,CAAAA,CAAyC,CAC/E,IAAME,CAAAA,CAAW,OAAO,MAAA,CAAOC,GAAa,EAAE,QAAA,CAASH,CAAAA,CAAI,QAAQ,CAAA,CAChEA,EAAI,QAAA,CAAA,UAAA,CAEP,OAAO,IAAII,CAAAA,CAAYF,EAAU,CAChC,IAAA,CAAMF,CAAAA,CAAI,IAAA,CACV,QAASA,CAAAA,CAAI,OAAA,CACb,SAAUA,CAAAA,CAAI,QAAA,CACd,MAAOA,CAAAA,CAAI,KAAA,CACX,UAAA,CAAYA,CAAAA,CAAI,WAChB,WAAA,CAAaA,CAAAA,CAAI,WAAA,CACjB,IAAA,CAAMA,EAAI,IACX,CAAC,CACF,CAGO,SAASK,CAAAA,CAAqBC,CAAAA,CAA8B,CAClE,OAAOC,GAAAA,CAAa,UACnBV,CAAAA,CAAiB,gBAAA,CACjBS,CAAAA,CACG,CAAA,oBAAA,EAAuBA,CAAM,CAAA,eAAA,CAAA,CAC7B,kCAAA,CACHA,CAAAA,CAAS,CAAE,OAAAA,CAAO,CAAA,CAAI,MACvB,CACD,CAGO,SAASE,CAAAA,EAAqC,CACpD,OAAOD,GAAAA,CAAa,UACnBV,CAAAA,CAAiB,iBAAA,CACjB,gEACD,CACD,CAGO,SAASY,CAAAA,CAAqBC,CAAAA,CAA6B,CACjE,OAAOH,GAAAA,CAAa,QAAA,CACnBV,CAAAA,CAAiB,uBAAA,CACjB,gCAAgCa,CAAM,CAAA,CAAA,CACtC,CAAE,MAAA,CAAAA,CAAO,CACV,CACD","file":"chunk-MVZUTETT.js","sourcesContent":["/**\n * Structured errors for the off-main-thread worker harness, and the pair of\n * functions that carry an {@link EngineError} across a `postMessage` boundary.\n *\n * A worker runs in another thread, so a failure there cannot be `throw`n back\n * into the caller's stack. It has to be encoded, posted, and rebuilt on the\n * main side, and it must arrive as a real structured error rather than a lost\n * promise or an opaque string. {@link serializeEngineError} projects an\n * `EngineError` onto a plain, clone-safe object; {@link deserializeEngineError}\n * rebuilds one from that object so the main-side `catch` sees the same\n * `code`/`category`/`message` it would have seen in-process.\n */\n\nimport { EngineError, ErrorCategory, ErrorFactory, type SourceSpan } from \"./EngineError\";\n\n/**\n * Codes the worker harness owns, co-located here rather than unioned into the\n * core catalog, matching the convention `errors/ErrorCode.ts` documents for a\n * domain that keeps its own small code object.\n */\nexport const WorkerErrorCodes = {\n\t/** The caller aborted the request through its `AbortSignal`. */\n\tWORKER_CANCELLED: \"WORKER_CANCELLED\",\n\t/** The worker engine was torn down while a request was still in flight. */\n\tWORKER_TERMINATED: \"WORKER_TERMINATED\",\n\t/** The transport failed or the worker exited before answering. */\n\tWORKER_TRANSPORT_FAILED: \"WORKER_TRANSPORT_FAILED\",\n\t/** A request named a method the runtime does not expose. */\n\tWORKER_UNKNOWN_METHOD: \"WORKER_UNKNOWN_METHOD\",\n\t/** A request arrived before the runtime finished building its engine. */\n\tWORKER_NOT_INITIALISED: \"WORKER_NOT_INITIALISED\",\n\t/** An init named a package the runtime could not resolve. */\n\tWORKER_UNKNOWN_PACKAGE: \"WORKER_UNKNOWN_PACKAGE\",\n} as const;\n\n/**\n * A structured error flattened for transport.\n *\n * Every field is a string, a boolean, or an object of numbers, so the whole\n * thing survives both `structuredClone` (what `postMessage` uses) and\n * `JSON.stringify` (what a host may log). `context`, `cause` and `timestamp`\n * are deliberately dropped rather than posted: a context can hold a value that\n * is not clone-safe, and none of the three is part of what a main-side handler\n * branches on.\n */\nexport interface SerializedEngineError {\n\tname: string;\n\tcategory: ErrorCategory;\n\tcode: string;\n\tmessage: string;\n\texpected?: string;\n\tfound?: string;\n\tsuggestion?: string;\n\trecoverable: boolean;\n\tspan?: SourceSpan;\n}\n\n/** Flatten an {@link EngineError} into a clone-safe {@link SerializedEngineError}. */\nexport function serializeEngineError(error: EngineError): SerializedEngineError {\n\tconst dto: SerializedEngineError = {\n\t\tname: error.name,\n\t\tcategory: error.category,\n\t\tcode: error.code,\n\t\tmessage: error.message,\n\t\trecoverable: error.recoverable,\n\t};\n\t// Only the optional string fields that were actually set cross the wire, so\n\t// a rebuilt error has `undefined` exactly where the original did rather than\n\t// an explicit `undefined` property a deep-equal would trip on.\n\tif (error.expected !== undefined) dto.expected = error.expected;\n\tif (error.found !== undefined) dto.found = error.found;\n\tif (error.suggestion !== undefined) dto.suggestion = error.suggestion;\n\t// A span is character offsets (plain numbers), so it is safe to carry and\n\t// useful for a host that highlights the failing range.\n\tif (error.span !== undefined) dto.span = error.span;\n\treturn dto;\n}\n\n/**\n * Rebuild an {@link EngineError} from its transported form.\n *\n * The category string round-trips straight back into the `ErrorCategory` enum\n * (its members ARE their own string values), so a main-side `catch` reads the\n * same category the worker raised. A malformed category (a message that was not\n * produced by {@link serializeEngineError}) falls back to `INTERNAL` rather than\n * constructing an error with an invalid category.\n */\nexport function deserializeEngineError(dto: SerializedEngineError): EngineError {\n\tconst category = Object.values(ErrorCategory).includes(dto.category)\n\t\t? dto.category\n\t\t: ErrorCategory.INTERNAL;\n\treturn new EngineError(category, {\n\t\tcode: dto.code,\n\t\tmessage: dto.message,\n\t\texpected: dto.expected,\n\t\tfound: dto.found,\n\t\tsuggestion: dto.suggestion,\n\t\trecoverable: dto.recoverable,\n\t\tspan: dto.span,\n\t});\n}\n\n/** The error a request rejects with when its caller aborts through an `AbortSignal`. */\nexport function workerCancelledError(method?: string): EngineError {\n\treturn ErrorFactory.execution(\n\t\tWorkerErrorCodes.WORKER_CANCELLED,\n\t\tmethod\n\t\t\t? `The worker request \"${method}\" was cancelled`\n\t\t\t: \"The worker request was cancelled\",\n\t\tmethod ? { method } : undefined,\n\t);\n}\n\n/** The error every pending request rejects with when the worker engine is terminated. */\nexport function workerTerminatedError(): EngineError {\n\treturn ErrorFactory.execution(\n\t\tWorkerErrorCodes.WORKER_TERMINATED,\n\t\t\"The worker engine was terminated before this request completed\",\n\t);\n}\n\n/** The error a request rejects with when the transport fails or the worker exits early. */\nexport function workerTransportError(detail: string): EngineError {\n\treturn ErrorFactory.external(\n\t\tWorkerErrorCodes.WORKER_TRANSPORT_FAILED,\n\t\t`The worker transport failed: ${detail}`,\n\t\t{ detail },\n\t);\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkPS272DZJ_cjs=require('./chunk-PS272DZJ.cjs'),chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');var p={n:0n,d:1n},y={n:1n,d:1n},Z={n:-1n,d:1n},ln=4096,Gn=1n<<BigInt(ln);function V(n,t){let e=1n,r=n,o=t;for(;o>0n;)o%2n===1n&&(e*=r),r*=r,o/=2n;return e}function Rt(n,t){let e=n<0n?-n:n,r=t<0n?-t:t;for(;r!==0n;){let o=e%r;e=r,r=o;}return e}function ht(n,t){if((n<0n?-n:n)>=Gn||t>=Gn)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_RATIONAL_OVERFLOW",`This calculation produced a fraction too large to represent exactly (over ${ln} bits).`,{limitBits:ln})}function $(n,t){if(t===0n)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DIVISION_BY_ZERO","Division by zero in a symbolic expression.");if(n===0n)return p;let e=t<0n?-n:n,r=t<0n?-t:t,o=Rt(e,r);return e/=o,r/=o,ht(e,r),{n:e,d:r}}function Sn(n,t=1n){return $(n,t)}var St=/^(-?)(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;function In(n){if(!Number.isFinite(n))throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_NONFINITE_OPERAND",`"${String(n)}" has no exact value, so it cannot appear in a symbolic expression.`,{value:String(n)});if(Number.isInteger(n))return $(BigInt(n),1n);let t=St.exec(String(n));if(t===null)throw chunkSOMGSIO4_cjs.c.internal("INTERNAL_RATIONAL_PARSE",`Internal error: could not read "${String(n)}" as a decimal number.`,{value:String(n)});let[,e,r,o="",i]=t,l=BigInt(r+o),a=V(10n,BigInt(o.length)),c=i===void 0?0:Number(i);return c>0?l*=V(10n,BigInt(c)):c<0&&(a*=V(10n,BigInt(-c))),$(e==="-"?-l:l,a)}function z(n){if(n.d===1n)return Number(n.n);let t=Number(n.n)/Number(n.d);return Number.isNaN(t)?Number((n.n<<64n)/n.d)/2**64:t}function b(n,t){return $(n.n*t.d+t.n*n.d,n.d*t.d)}function C(n,t){return $(n.n*t.d-t.n*n.d,n.d*t.d)}function d(n,t){return $(n.n*t.n,n.d*t.d)}function S(n,t){if(t.n===0n)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DIVISION_BY_ZERO","Division by zero in a symbolic expression.");return $(n.n*t.d,n.d*t.n)}function I(n){return n.n===0n?p:{n:-n.n,d:n.d}}function vn(n,t){if(t===0n)return y;if(t<0n){if(n.n===0n)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DIVISION_BY_ZERO","Zero raised to a negative power is undefined.");let e=-t;return $(V(n.d,e),V(n.n,e))}return $(V(n.n,t),V(n.d,t))}function It(n,t){let e=n.n*t.d,r=t.n*n.d;return e<r?-1:e>r?1:0}function u(n){return n.n===0n}function N(n){return n.n===1n&&n.d===1n}function nn(n){return n.n===-1n&&n.d===1n}function P(n){return n.d===1n}var vt=10,Wn=1000000n;function D(n){if(n.d===1n)return String(n.n);let t=n.d,e=0,r=0;for(;t%2n===0n;)t/=2n,e++;for(;t%5n===0n;)t/=5n,r++;let o=t===1n,i=Math.max(e,r);if(!o||i>vt)return (n.n<0n?-n.n:n.n)<=Wn&&n.d<=Wn?`${n.n}/${n.d}`:String(Math.round(z(n)*1e10)/1e10);let l=(n.n<0n?-n.n:n.n)*V(10n,BigInt(i))/n.d,a=String(l).padStart(i+1,"0"),c=a.slice(0,a.length-i),f=a.slice(a.length-i).replace(/0+$/,""),m=n.n<0n?"-":"";return f.length===0?`${m}${c}`:`${m}${c}.${f}`}var Jn={re:p,im:p},an={re:y,im:p},kn={re:p,im:y};function cn(n,t=p){return {re:n,im:t}}function K(n){return u(n.re)&&u(n.im)}function Dn(n,t){return {re:b(n.re,t.re),im:b(n.im,t.im)}}function En(n,t){return {re:C(n.re,t.re),im:C(n.im,t.im)}}function tn(n,t){return {re:C(d(n.re,t.re),d(n.im,t.im)),im:b(d(n.re,t.im),d(n.im,t.re))}}function sn(n,t){if(K(t))throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DIVISION_BY_ZERO","Division by zero in a complex expression.");let e=b(d(t.re,t.re),d(t.im,t.im));return {re:S(b(d(n.re,t.re),d(n.im,t.im)),e),im:S(C(d(n.im,t.re),d(n.re,t.im)),e)}}function Cn(n){return {re:I(n.re),im:I(n.im)}}function An(n){return {re:n.re,im:I(n.im)}}function un(n){return b(d(n.re,n.re),d(n.im,n.im))}function fn(n,t){if(t===0n)return an;if(t<0n){if(K(n))throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DIVISION_BY_ZERO","Zero raised to a negative power is undefined.");return sn(an,fn(n,-t))}let e=an,r=n,o=t;for(;o>0n;)o%2n===1n&&(e=tn(e,r)),r=tn(r,r),o/=2n;return e}function wn(n,t){return n.re.n===t.re.n&&n.re.d===t.re.d&&n.im.n===t.im.n&&n.im.d===t.im.d}function mn(n){if(u(n.im))return D(n.re);let t=n.im.n<0n?I(n.im):n.im,e=N(t)?"i":`${D(t)}i`;return u(n.re)?n.im.n<0n?`-${e}`:e:n.im.n<0n?`${D(n.re)}-${e}`:`${D(n.re)}+${e}`}function dn(n){if(K(n))return Jn;let t=Mn(un(n));if(t===null)return null;let e={n:2n,d:1n},r=Mn(S(b(t,n.re),e));if(r===null)return null;if(u(r)){let i=Mn(S(C(t,n.re),e));return i===null?null:{re:p,im:i}}let o=S(n.im,d(e,r));return {re:r,im:o}}function Mn(n){if(n.n<0n)return null;let t=Qn(n.n),e=Qn(n.d);return t===null||e===null?null:{n:t,d:e}}function Qn(n){if(n<0n)return null;if(n<2n)return n;let t=n,e=(n+1n)/2n;for(;e<t;)t=e,e=(t+n/t)/2n;return t*t===n?t:null}var j=1e4;function s(n){return {kind:"const",value:typeof n=="number"?In(n):n}}function U(n){return {kind:"var",name:n}}function _n(n,t){return {kind:"pow",base:n,exponent:t}}function Mt(n,t){return {kind:"call",name:n,args:t}}function v(n){switch(n.kind){case "const":return `${n.value.n}/${n.value.d}`;case "complex":return `C(${n.value.re.n}/${n.value.re.d},${n.value.im.n}/${n.value.im.d})`;case "var":return `v:${n.name}`;case "neg":return `-(${v(n.operand)})`;case "pow":return `^(${v(n.base)},${v(n.exponent)})`;case "call":return `${n.name}(${n.args.map(v).join(",")})`;case "add":return `+(${v(n.left)},${v(n.right)})`;case "sub":return `-(${v(n.left)},${v(n.right)})`;case "mul":return `*(${v(n.left)},${v(n.right)})`;case "div":return `/(${v(n.left)},${v(n.right)})`}}function E(n,t){if(n.kind!==t.kind)return false;switch(n.kind){case "const":{let e=t;return n.value.n===e.value.n&&n.value.d===e.value.d}case "complex":return wn(n.value,t.value);case "var":return n.name===t.name;case "neg":return E(n.operand,t.operand);case "pow":{let e=t;return E(n.base,e.base)&&E(n.exponent,e.exponent)}case "call":{let e=t;return n.name!==e.name||n.args.length!==e.args.length?false:n.args.every((r,o)=>E(r,e.args[o]))}case "add":case "sub":case "mul":case "div":{let e=t;return E(n.left,e.left)&&E(n.right,e.right)}}}function On(n,t=Number.POSITIVE_INFINITY){let e=[n],r=0;for(;e.length>0;){let o=e.pop();if(r++,r>t)return r;switch(o.kind){case "const":case "complex":case "var":break;case "neg":e.push(o.operand);break;case "pow":e.push(o.base,o.exponent);break;case "call":for(let i of o.args)e.push(i);break;case "add":case "sub":case "mul":case "div":e.push(o.left,o.right);break}}return r}function kt(n){let t=new Set;return Y(n,t),t}function Y(n,t){switch(n.kind){case "const":case "complex":return;case "var":t.add(n.name);return;case "neg":Y(n.operand,t);return;case "pow":Y(n.base,t),Y(n.exponent,t);return;case "call":for(let e of n.args)Y(e,t);return;case "add":case "sub":case "mul":case "div":Y(n.left,t),Y(n.right,t);}}function q(n,t,e){switch(n.kind){case "const":case "complex":return n;case "var":return n.name===t?e:n;case "neg":return {kind:"neg",operand:q(n.operand,t,e)};case "pow":return {kind:"pow",base:q(n.base,t,e),exponent:q(n.exponent,t,e)};case "call":return {kind:"call",name:n.name,args:n.args.map(r=>q(r,t,e))};case "add":case "sub":case "mul":case "div":return {kind:n.kind,left:q(n.left,t,e),right:q(n.right,t,e)}}}function A(n){return n.im.n===0n?{kind:"const",value:n.re}:{kind:"complex",value:n}}var Dt=32,zn=2e3,Et=64;function Ct(n){return [...n.keys()].sort().map(e=>n.get(e)===1?e:`${e}^${n.get(e)}`).join("*")}function T(n){let t=new Map;if(n==="")return t;for(let e of n.split("*")){let r=e.indexOf("^");r===-1?t.set(e,1):t.set(e.slice(0,r),Number(e.slice(r+1)));}return t}function pn(n){let t=0;for(let e of T(n).values())t+=e;return t}function nt(n){let t=new Map,e=new Set;for(let[r,o]of n)if(!u(o)){if(pn(r)>Et)return null;t.set(r,o);for(let i of T(r).keys())e.add(i);}return t.size>zn?null:{terms:t,vars:[...e].sort()}}function tt(n){return u(n)?{terms:new Map,vars:[]}:{terms:new Map([["",n]]),vars:[]}}function et(n,t){let e=new Map(n.terms);for(let[r,o]of t.terms){let i=e.get(r);e.set(r,i===void 0?o:b(i,o));}return nt(e)}function At(n,t){return et(n,Pn(t,Z))}function rt(n,t){if(n.terms.size*t.terms.size>zn)return null;let e=new Map;for(let[r,o]of n.terms){let i=T(r);for(let[l,a]of t.terms){let c=new Map(i);for(let[L,Rn]of T(l))c.set(L,(c.get(L)??0)+Rn);let f=Ct(c),m=d(o,a),x=e.get(f);e.set(f,x===void 0?m:b(x,m));}}return nt(e)}function wt(n,t){if(t<0||!Number.isInteger(t)||t>Dt)return null;let e=tt(y);for(let r=0;r<t;r++){let o=rt(e,n);if(o===null)return null;e=o;}return e}function Pn(n,t){if(u(t))return {terms:new Map,vars:[]};let e=new Map;for(let[r,o]of n.terms)e.set(r,d(o,t));return {terms:e,vars:n.vars}}function gn(n,t){let e=0;for(let r of n.terms.keys()){let o=t===void 0?pn(r):T(r).get(t)??0;o>e&&(e=o);}return e}function ot(n){return n.vars.length===1?n.vars[0]:null}function H(n,t){let e=gn(n,t),r=new Array(e+1).fill(p);for(let[o,i]of n.terms)r[T(o).get(t)??0]=i;return r}function h(n,t=true){switch(n.kind){case "const":return tt(n.value);case "var":return {terms:new Map([[n.name,y]]),vars:[n.name]};case "neg":{let e=h(n.operand,t);return e===null?null:Pn(e,Z)}case "add":{let e=h(n.left,t),r=e===null?null:h(n.right,t);return e===null||r===null?null:et(e,r)}case "sub":{let e=h(n.left,t),r=e===null?null:h(n.right,t);return e===null||r===null?null:At(e,r)}case "mul":{let e=h(n.left,t),r=e===null?null:h(n.right,t);return e===null||r===null||!t&&(e.terms.size>1||r.terms.size>1)?null:rt(e,r)}case "div":{let e=h(n.right,t);if(e===null||e.vars.length>0)return null;let r=e.terms.get("")??p;if(u(r))return null;let o=h(n.left,t);return o===null?null:Pn(o,S(y,r))}case "pow":{if(n.exponent.kind!=="const"||!P(n.exponent.value))return null;let e=Number(n.exponent.value.n),r=h(n.base,t);return r===null||!t&&r.terms.size>1?null:wt(r,e)}case "complex":return null;case "call":return null}}function _t(n,t,e){let r=pn(t)-pn(n);if(r!==0)return r;let o=T(n),i=T(t);for(let l of e){let a=(i.get(l)??0)-(o.get(l)??0);if(a!==0)return a}return 0}function Ot(n){let t=T(n),e=[...t.keys()].sort(),r=null;for(let o of e){let i=t.get(o),l=i===1?U(o):_n(U(o),s({n:BigInt(i),d:1n}));r=r===null?l:{kind:"mul",left:r,right:l};}return r??s(y)}function $n(n,t){if(n==="")return s(t);let e=t.n<0n?I(t):t,r=Ot(n),o=N(e)?r:{kind:"mul",left:s(e),right:r};return t.n<0n?{kind:"neg",operand:o}:o}function X(n){let t=[...n.terms.keys()].sort((r,o)=>_t(r,o,n.vars));if(t.length===0)return s(p);if(n.terms.get(t[0]).n<0n){let r=t.findIndex(o=>n.terms.get(o).n>0n);r>0&&t.unshift(...t.splice(r,1));}let e=$n(t[0],n.terms.get(t[0]));for(let r=1;r<t.length;r++){let o=n.terms.get(t[r]);o.n<0n?e={kind:"sub",left:e,right:$n(t[r],I(o))}:e={kind:"add",left:e,right:$n(t[r],o)};}return e}function ke(n){let t=h(n);return t===null?n:X(t)}function F(n){let t=n.length-1;for(;t>=0&&u(n[t]);)t--;return n.slice(0,t+1)}function Ae(n){return n.every(u)}function yn(n,t){let e=F([...n]),r=F([...t]);if(r.length===0)throw new Error("polynomialDivide: division by the zero polynomial");let o=r.length-1,i=r[o],l=[...e],a=new Array(Math.max(0,e.length-o)).fill(p);for(let c=l.length-1;c>=o;c--){if(u(l[c]))continue;let f=S(l[c],i),m=c-o;a[m]=f;for(let x=0;x<=o;x++)l[m+x]=C(l[m+x],d(f,r[x]));}return {quotient:F(a),remainder:F(l)}}function xn(n){let t=F(n);if(t.length===0)return t;let e=t[t.length-1];return N(e)?t:t.map(r=>S(r,e))}function it(n,t){let e=F([...n]),r=F([...t]);for(;r.length>0;){let{remainder:o}=yn(e,r);e=r,r=o;}return xn(e)}function $t(n,t){let e=Pt(n,t);if(e===void 0)return null;if(e===null)return h({kind:"const",value:y});let r=it(H(n,e),H(t,e));return Tn(r,e)}function Pt(n,t){let e=new Set([...n.vars,...t.vars]);if(e.size===0)return null;if(!(e.size>1))return [...e][0]}function Tn(n,t){let e=new Map;return n.forEach((r,o)=>{u(r)||e.set(o===0?"":o===1?t:`${t}^${o}`,r);}),{terms:e,vars:e.size>0&&n.length>1?[t]:[]}}function Tt(n,t){let e=$t(n,t);if(e===null||gn(e)===0)return null;let r=ot(e);if(r===null)return null;let o=H(e,r),i=yn(H(n,r),o),l=yn(H(t,r),o);return {numerator:Tn(i.quotient,r),denominator:Tn(l.quotient,r)}}function lt(n){if(n.kind!=="div")return n;let t=h(n.left),e=h(n.right);if(t===null||e===null)return n;let r=Tt(t,e);return r===null?n:Lt(r.numerator,r.denominator,n)}function Lt(n,t,e){if(gn(t)===0){let r=t.terms.get("")??y;if(u(r))return e;let o=new Map;for(let[i,l]of n.terms)o.set(i,S(l,r));return X({terms:o,vars:n.vars})}return {kind:"div",left:X(n),right:X(t)}}function we(n){let t=F([...n]);if(t.length<=1)return xn(t);let e=[];for(let o=1;o<t.length;o++)e.push(d(t[o],{n:BigInt(o),d:1n}));let r=it(t,e);return r.length<=1?xn(t):xn(yn(t,r).quotient)}function en(n){if(n<0n)return null;if(n<2n)return n;let t=n,e=(n+1n)/2n;for(;e<t;)t=e,e=(t+n/t)/2n;return t*t===n?t:null}function Ln(n){let t=n<0n,e=t?-n:n;if(e<2n)return t?-e:e;let r=1n,o=e;for(;r<=o;){let i=(r+o)/2n,l=i*i*i;if(l===e)return t?-i:i;l<e?r=i+1n:o=i-1n;}return null}function Pe(n){let t=en(n.n),e=en(n.d);return t===null||e===null?null:{n:t,d:e}}function Bt(n){let t=n.n*n.d,e=1n,r=t;for(let l=2n;l*l<=r;l++){let a=l*l;for(;r%a===0n;)r/=a,e*=l;}let o=Sn(e,n.d);if(r===1n)return s(o);let i={kind:"call",name:"sqrt",args:[s({n:r,d:1n})]};return o.n===1n&&o.d===1n?i:{kind:"mul",left:s(o),right:i}}function Te(n){return n.n>=0n?Bt(n):{kind:"call",name:"sqrt",args:[s(n)]}}function G(n,t,e,r=0){if(r>=ct)return false;switch(n.kind){case "add":return G(n.left,t,e,r+1)&&G(n.right,t,e,r+1);case "sub":return G(n.left,t,e,r+1)&&G(n.right,!t,e,r+1);case "neg":return G(n.operand,!t,e,r+1);case "const":return e.push({coeff:t?I(n.value):n.value,name:null}),true;case "var":return e.push({coeff:t?Z:y,name:n.name}),true;default:return false}}function Vt(n){let t=[];if(!G(n,false,t))return n;let e=[],r=new Map,o=p;for(let a of t){if(a.name===null){o=b(o,a.coeff);continue}let c=r.get(a.name);c===void 0?(e.push(a.name),r.set(a.name,a.coeff)):r.set(a.name,b(c,a.coeff));}let i=[];for(let a of e){let c=r.get(a);u(c)||(N(c)?i.push(U(a)):nn(c)?i.push({kind:"neg",operand:U(a)}):i.push({kind:"mul",left:s(c),right:U(a)}));}if(i.length===0)return s(o);let l=i[0];for(let a=1;a<i.length;a++)l={kind:"add",left:l,right:i[a]};return u(o)||(l={kind:"add",left:l,right:s(o)}),l}function at(n){let t=h(n,false);return t!==null?X(t):Vt(n)}function Bn(n){let t=n.n/n.d;return n.n<0n&&t*n.d!==n.n?t-1n:t}var Ut=500n;function Ft(n,t){let e=t[0];switch(n){case "abs":return t.length===1?e.n<0n?I(e):e:null;case "sign":return t.length!==1?null:e.n===0n?p:{n:e.n<0n?-1n:1n,d:1n};case "floor":return t.length===1?{n:Bn(e),d:1n}:null;case "ceil":return t.length===1?{n:-Bn(I(e)),d:1n}:null;case "trunc":return t.length===1?{n:e.n/e.d,d:1n}:null;case "round":return t.length===1?{n:Bn(b(e,{n:1n,d:2n})),d:1n}:null;case "sqrt":{if(t.length!==1||e.n<0n)return null;let r=en(e.n),o=en(e.d);return r===null||o===null?null:{n:r,d:o}}case "cbrt":{if(t.length!==1)return null;let r=Ln(e.n),o=Ln(e.d);return r===null||o===null?null:{n:r,d:o}}case "sin":case "tan":case "asin":case "atan":case "sinh":case "tanh":return t.length===1&&u(e)?p:null;case "cos":case "exp":case "cosh":return t.length===1&&u(e)?y:null;case "log":return t.length===1&&N(e)?p:null;case "acos":return t.length===1&&N(e)?p:null;case "fact":{if(t.length!==1||!P(e)||e.n<0n||e.n>Ut)return null;let r=1n;for(let o=2n;o<=e.n;o++)r*=o;return {n:r,d:1n}}default:return null}}function M(n){if(On(n,j)>j)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_NODE_LIMIT_EXCEEDED",`This symbolic expression is too large to simplify (over ${j} terms).`,{limit:j});let t=rn;try{return g(n)}finally{rn=t;}}var ct=900,rn=0;function g(n){if(rn>=ct)return n;rn++;let t=qt(n);return rn--,t}function Vn(n){return n.kind==="complex"?n.value:n.kind==="const"?cn(n.value):null}function bn(n,t,e){if(t.kind!=="complex"&&e.kind!=="complex")return null;let r=Vn(t),o=Vn(e);if(r===null||o===null)return null;switch(n){case "add":return A(Dn(r,o));case "sub":return A(En(r,o));case "mul":return A(tn(r,o));case "div":return K(o)?null:A(sn(r,o))}}function Yt(n,t){if(t.length!==1)return null;let e=Vn(t[0]);if(e===null)return null;switch(n){case "sqrt":{let r=dn(e);return r!==null?A(r):u(e.im)&&e.re.n<0n?{kind:"mul",left:{kind:"call",name:"sqrt",args:[s(I(e.re))]},right:A(kn)}:null}case "conj":return A(An(e));case "re":return s(e.re);case "im":return s(e.im);case "abs":{if(u(e.im))return null;let r=dn(cn(un(e)));return r===null||!u(r.im)?null:s(r.re)}default:return null}}function qt(n){switch(n.kind){case "const":case "complex":case "var":return n;case "neg":{let t=g(n.operand);return t.kind==="const"?s(I(t.value)):t.kind==="complex"?A(Cn(t.value)):t.kind==="neg"?t.operand:{kind:"neg",operand:t}}case "add":{let t=g(n.left),e=g(n.right);if(t.kind==="const"&&e.kind==="const")return s(b(t.value,e.value));let r=bn("add",t,e);return r!==null?r:t.kind==="const"&&u(t.value)?e:e.kind==="const"&&u(e.value)?t:at({kind:"add",left:t,right:e})}case "sub":{let t=g(n.left),e=g(n.right);if(t.kind==="const"&&e.kind==="const")return s(C(t.value,e.value));let r=bn("sub",t,e);return r!==null?r:e.kind==="const"&&u(e.value)?t:t.kind==="const"&&u(t.value)?g({kind:"neg",operand:e}):at({kind:"sub",left:t,right:e})}case "mul":{let t=g(n.left),e=g(n.right);if(t.kind==="const"&&e.kind==="const")return s(d(t.value,e.value));let r=bn("mul",t,e);return r!==null?r:t.kind==="const"&&u(t.value)||e.kind==="const"&&u(e.value)?s(p):t.kind==="const"&&N(t.value)?e:e.kind==="const"&&N(e.value)?t:t.kind==="const"&&nn(t.value)?g({kind:"neg",operand:e}):e.kind==="const"&&nn(e.value)?g({kind:"neg",operand:t}):t.kind==="const"&&e.kind==="mul"&&e.left.kind==="const"?g({kind:"mul",left:s(d(t.value,e.left.value)),right:e.right}):e.kind==="const"&&t.kind==="mul"&&t.left.kind==="const"?g({kind:"mul",left:s(d(e.value,t.left.value)),right:t.right}):t.kind==="div"&&t.left.kind==="const"&&N(t.left.value)?g({kind:"div",left:e,right:t.right}):e.kind==="div"&&e.left.kind==="const"&&N(e.left.value)?g({kind:"div",left:t,right:e.right}):{kind:"mul",left:t,right:e}}case "div":{let t=g(n.left),e=g(n.right);if(t.kind==="const"&&e.kind==="const"&&!u(e.value))return s(S(t.value,e.value));let r=bn("div",t,e);if(r!==null)return r;if(e.kind==="const"&&N(e.value))return t;if(t.kind==="const"&&u(t.value))return s(p);if(t.kind==="mul"){if(E(t.left,e))return t.right;if(E(t.right,e))return t.left}let o=lt({kind:"div",left:t,right:e});if(o.kind!=="div"||o.left!==t||o.right!==e)return g(o);if(t.kind==="neg"&&t.operand.kind==="mul"){let i=t.operand;if(E(i.left,e))return g({kind:"neg",operand:i.right});if(E(i.right,e))return g({kind:"neg",operand:i.left})}return {kind:"div",left:t,right:e}}case "pow":{let t=g(n.base),e=g(n.exponent);if(e.kind==="const"){if(u(e.value))return s(y);if(N(e.value))return t;if(t.kind==="const"&&P(e.value))return s(vn(t.value,e.value.n));if(t.kind==="complex"&&P(e.value))return A(fn(t.value,e.value.n))}return t.kind==="const"&&N(t.value)?s(y):t.kind==="const"&&u(t.value)&&e.kind==="const"&&e.value.n>0n?s(p):t.kind==="pow"&&t.exponent.kind==="const"&&e.kind==="const"&&P(t.exponent.value)&&P(e.value)?g({kind:"pow",base:t.base,exponent:s(d(t.exponent.value,e.value))}):{kind:"pow",base:t,exponent:e}}case "call":{let t=n.args.map(g);if(t.every(r=>r.kind==="const")){let r=Ft(n.name,t.map(o=>o.value));if(r!==null)return s(r)}let e=Yt(n.name,t);return e!==null?e:{kind:"call",name:n.name,args:t}}}}function Xt(n){return n.left.kind==="const"&&n.right.kind==="var"?{coeff:n.left.value,name:n.right.name}:n.right.kind==="const"&&n.left.kind==="var"?{coeff:n.right.value,name:n.left.name}:null}function Zt(n){return n.left.kind==="const"&&n.right.kind==="pow"?{coeff:n.left.value,power:n.right}:n.right.kind==="const"&&n.left.kind==="pow"?{coeff:n.right.value,power:n.left}:null}function st(n){return n.kind==="var"||n.kind==="call"?true:n.kind==="const"&&n.value.n>=0n}function Un(n,t){return n.n===1n&&n.d===1n?t:n.n===-1n&&n.d===1n?`-${t}`:`${D(n)}${t}`}var ut=600,Fn="...";function w(n,t){if(t>=ut)return Fn;switch(n.kind){case "const":return D(n.value);case "complex":return n.value.re.n!==0n&&n.value.im.n!==0n?`(${mn(n.value)})`:mn(n.value);case "var":return n.name;case "add":case "sub":return `(${on(n,t)})`;case "neg":return `-${w(n.operand,t+1)}`;case "call":return `${n.name}(${n.args.map(e=>on(e,t+1)).join(", ")})`;case "pow":{let e=st(n.base)?w(n.base,t+1):`(${on(n.base,t+1)})`,r=st(n.exponent)?w(n.exponent,t+1):`(${on(n.exponent,t+1)})`;return `${e}^${r}`}case "mul":{let e=Xt(n);if(e)return Un(e.coeff,e.name);let r=Zt(n);if(r)return Un(r.coeff,w(r.power,t+1));if(n.left.kind==="const"&&n.right.kind==="mul"){let o=w(n.right,t+1);if(!/^[\d.]/.test(o))return Un(n.left.value,o)}return `${w(n.left,t+1)}*${w(n.right,t+1)}`}case "div":{let e=w(n.right,t+1),r=n.right.kind==="mul"||n.right.kind==="div";return `${w(n.left,t+1)}/${r?`(${e})`:e}`}}}function W(n,t,e,r){if(r>=ut){e.push({negated:t,text:Fn});return}switch(n.kind){case "add":W(n.left,t,e,r+1),W(n.right,t,e,r+1);return;case "sub":W(n.left,t,e,r+1),W(n.right,!t,e,r+1);return;case "neg":W(n.operand,!t,e,r+1);return;case "const":{if(n.value.n===0n)return;let o=n.value.n<0n,i=o?{n:-n.value.n,d:n.value.d}:n.value;e.push({negated:o!==t,text:D(i)});return}case "complex":{let{re:o,im:i}=n.value;if(o.n!==0n){let l=o.n<0n;e.push({negated:l!==t,text:D(l?{n:-o.n,d:o.d}:o)});}if(i.n!==0n){let l=i.n<0n,a=l?{n:-i.n,d:i.d}:i,c=a.n===1n&&a.d===1n?"i":`${D(a)}i`;e.push({negated:l!==t,text:c});}return}default:{let o=w(n,r);(n.kind==="mul"||n.kind==="div")&&o.startsWith("-")?e.push({negated:!t,text:o.slice(1)}):e.push({negated:t,text:o});}}}function Kt(n){try{return on(n,0)}catch(t){if(t instanceof RangeError)return Fn;throw t}}function on(n,t){let e=[];if(W(n,false,e,t),e.length===0)return "0";let r="";return e.forEach((o,i)=>{i===0?r+=o.negated?`-${o.text}`:o.text:r+=o.negated?`-${o.text}`:`+${o.text}`;}),r}function ar(n,t){return n.data[t]}function _(n,t,e){return n.data[t+e*n.rows]}function cr(n,t,e){return t>=0&&t<n.rows&&e>=0&&e<n.cols}function jt(n,t){return n.rows===t.rows&&n.cols===t.cols}function Xn(n){return n.rows===n.cols}function Q(n){return typeof n=="object"&&n!==null?n:typeof n=="boolean"?s(n?1:0):s(n)}function qn(n){let t=M(n);return t.kind==="const"?z(t.value):t}function Ht(n){return typeof n=="boolean"?chunkPS272DZJ_cjs.J(n):typeof n=="object"&&n!==null?chunkPS272DZJ_cjs.I(n):chunkPS272DZJ_cjs.n(n)}function sr(n,t,e){let r=new Array(n*t);for(let o=0;o<n;o++)for(let i=0;i<t;i++)r[o+i*n]=e[o*t+i];return r}function ur(n){let t=new Array(n.rows*n.cols);for(let e=0;e<n.rows;e++)for(let r=0;r<n.cols;r++)t[e*n.cols+r]=_(n,e,r);return t}function ft(n,t){let e=n.rows===1&&n.cols===1,r=t.rows===1&&t.cols===1,o=n.hasSymbolic||t.hasSymbolic;if(e||r){let[c,f]=e?[n,t]:[t,n];if(o){let L=Q(c.data[0]),Rn=f.data.map(Nt=>qn(M({kind:"mul",left:Q(Nt),right:L})));return chunkPS272DZJ_cjs.C(f.rows,f.cols,Rn)}let m=c.data[0],x=f.data.map(L=>L*m);return chunkPS272DZJ_cjs.C(f.rows,f.cols,x)}if(n.cols!==t.rows)return chunkPS272DZJ_cjs.N("DIMENSION_MISMATCH",`Cannot multiply a ${n.rows}x${n.cols} matrix by a ${t.rows}x${t.cols} matrix \u2014 inner dimensions must match (${n.cols} !== ${t.rows}).`);let i=n.rows,l=t.cols,a=chunkPS272DZJ_cjs.e(i*l,"matrix cells");for(let c=0;c<i;c++)for(let f=0;f<l;f++)if(o){let m=s(0);for(let x=0;x<n.cols;x++){let L={kind:"mul",left:Q(_(n,c,x)),right:Q(_(t,x,f))};m=M({kind:"add",left:m,right:L});}a[c+f*i]=qn(m);}else {let m=0;for(let x=0;x<n.cols;x++)m+=_(n,c,x)*_(t,x,f);a[c+f*i]=m;}return chunkPS272DZJ_cjs.C(i,l,a)}function fr(n,t){if(!Xn(n))return chunkPS272DZJ_cjs.N("MATRIX_POWER_REQUIRES_SQUARE_MATRIX",`^: only a square matrix can be raised to a power (got ${n.rows}x${n.cols}).`);if(!Number.isInteger(t)||t<0)return chunkPS272DZJ_cjs.N("MATRIX_POWER_REQUIRES_WHOLE_EXPONENT",`^: a matrix can only be raised to a whole number of 0 or more (got ${t}); "^-1" means the inverse and "^T" the transpose.`);let e=n.rows,r=new Array(e*e).fill(0);for(let a=0;a<e;a++)r[a+a*e]=1;let o={rows:e,cols:e,data:r,hasSymbolic:false},i=n,l=t;for(;l>0;){if(l%2===1){let a=ft(o,i);if(a.type===13)return a;o=a.value;}if(l=Math.floor(l/2),l>0){let a=ft(i,i);if(a.type===13)return a;i=a.value;}}return chunkPS272DZJ_cjs.C(o.rows,o.cols,o.data)}function mr(n,t,e){if(!jt(n,t))return chunkPS272DZJ_cjs.N("DIMENSION_MISMATCH",`Cannot compare matrices of different shapes: ${n.rows}x${n.cols} and ${t.rows}x${t.cols}`);let r=new Array(n.data.length);for(let o=0;o<n.data.length;o++)r[o]=e(n.data[o],t.data[o]);return chunkPS272DZJ_cjs.C(n.rows,n.cols,r)}function dr(n){let t=new Array(n.rows*n.cols);for(let e=0;e<n.cols;e++)for(let r=0;r<n.rows;r++)t[e+r*n.cols]=_(n,r,e);return chunkPS272DZJ_cjs.C(n.cols,n.rows,t)}function dt(n){let t=[];for(let e=0;e<n.rows;e++){let r=[];for(let o=0;o<n.cols;o++)r.push(_(n,e,o));t.push(r);}return t}var Gt=12;function Wt(n){if(n.rows>Gt)return null;let t=[];for(let e=0;e<n.rows;e++){let r=[];for(let o=0;o<n.cols;o++){let i=_(n,e,o);if(typeof i!="number"||!Number.isSafeInteger(i))return null;r.push(BigInt(i));}t.push(r);}return t}function Qt(n){let t=n.length,e=1n,r=1n;for(let o=0;o<t-1;o++){if(n[o][o]===0n){let i=-1;for(let a=o+1;a<t;a++)if(n[a][o]!==0n){i=a;break}if(i===-1)return 0n;let l=n[o];n[o]=n[i],n[i]=l,r=-r;}for(let i=o+1;i<t;i++)for(let l=o+1;l<t;l++)n[i][l]=(n[i][l]*n[o][o]-n[i][o]*n[o][l])/e;e=n[o][o];}return r*n[t-1][t-1]}function Jt(n){let t=Wt(n);if(t!==null)return chunkPS272DZJ_cjs.n(Number(Qt(t)));let e=n.rows,r=dt(n),o=1;for(let i=0;i<e;i++){let l=i,a=Math.abs(r[i][i]);for(let c=i+1;c<e;c++)Math.abs(r[c][i])>a&&(a=Math.abs(r[c][i]),l=c);if(a===0)return chunkPS272DZJ_cjs.n(0);if(l!==i){let c=r[i];r[i]=r[l],r[l]=c,o=-o;}o*=r[i][i];for(let c=i+1;c<e;c++){let f=r[c][i]/r[i][i];if(f!==0)for(let m=i;m<e;m++)r[c][m]-=f*r[i][m];}}return chunkPS272DZJ_cjs.n(o)}function zt(n){let t=n.rows,e=[];for(let o=0;o<t;o++){let i=[];for(let l=0;l<t;l++)i.push(Q(_(n,o,l)));e.push(i);}let r=s(1);for(let o=0;o<t;o++){let i=M(e[o][o]);if(i.kind==="const"&&u(i.value))return chunkPS272DZJ_cjs.n(0);r=M({kind:"mul",left:r,right:i});for(let l=o+1;l<t;l++){let a=M({kind:"div",left:e[l][o],right:i});for(let c=o;c<t;c++)e[l][c]=M({kind:"sub",left:e[l][c],right:{kind:"mul",left:a,right:e[o][c]}});}}return r.kind==="const"?chunkPS272DZJ_cjs.n(z(r.value)):chunkPS272DZJ_cjs.I(r)}function pr(n){return Xn(n)?n.hasSymbolic?zt(n):Jt(n):chunkPS272DZJ_cjs.N("DETERMINANT_REQUIRES_SQUARE_MATRIX",`det: matrix must be square (got ${n.rows}x${n.cols}).`)}function ne(n){let t=n.rows,e=dt(n);for(let o=0;o<t;o++)for(let i=0;i<t;i++)e[o].push(i===o?1:0);for(let o=0;o<t;o++){let i=o,l=Math.abs(e[o][o]);for(let c=o+1;c<t;c++)Math.abs(e[c][o])>l&&(l=Math.abs(e[c][o]),i=c);if(l<1e-10)return chunkPS272DZJ_cjs.N("SINGULAR_MATRIX",`inv: a ${t}x${t} matrix with a zero (or near-zero) pivot column is not invertible.`);if(i!==o){let c=e[o];e[o]=e[i],e[i]=c;}let a=e[o][o];for(let c=0;c<2*t;c++)e[o][c]/=a;for(let c=0;c<t;c++){if(c===o)continue;let f=e[c][o];if(f!==0)for(let m=0;m<2*t;m++)e[c][m]-=f*e[o][m];}}let r=new Array(t*t);for(let o=0;o<t;o++)for(let i=0;i<t;i++)r[o+i*t]=e[o][t+i];return chunkPS272DZJ_cjs.C(t,t,r)}var Yn=9;function te(n){let t=n.rows;if(t>=Yn)return chunkPS272DZJ_cjs.N("SYMBOLIC_INVERSE_DIMENSION_LIMIT",`Symbolic matrix inversion is limited to matrices smaller than ${Yn}x${Yn} (got ${t}x${t}).`);let e=[];for(let o=0;o<t;o++){let i=[];for(let l=0;l<t;l++)i.push(Q(_(n,o,l)));for(let l=0;l<t;l++)i.push(s(l===o?1:0));e.push(i);}for(let o=0;o<t;o++){let i=M(e[o][o]);if(i.kind==="const"&&u(i.value))return chunkPS272DZJ_cjs.N("SYMBOLIC_SINGULAR_OR_UNSUPPORTED_PIVOT",`Symbolic inverse: the pivot at row/col ${o} is exactly zero \u2014 this matrix's structure isn't invertible via this engine's diagonal-first symbolic elimination (no row-swapping); try reordering rows manually.`);for(let l=0;l<t;l++){if(l===o)continue;let a=M({kind:"div",left:e[l][o],right:i});if(!(a.kind==="const"&&u(a.value)))for(let c=0;c<2*t;c++)e[l][c]=M({kind:"sub",left:e[l][c],right:{kind:"mul",left:a,right:e[o][c]}});}for(let l=0;l<2*t;l++)e[o][l]=M({kind:"div",left:e[o][l],right:i});}let r=new Array(t*t);for(let o=0;o<t;o++)for(let i=0;i<t;i++)r[o+i*t]=qn(e[o][t+i]);return chunkPS272DZJ_cjs.C(t,t,r)}function gr(n){return Xn(n)?n.hasSymbolic?te(n):ne(n):chunkPS272DZJ_cjs.N("INVERSE_REQUIRES_SQUARE_MATRIX",`inv: matrix must be square (got ${n.rows}x${n.cols}).`)}function mt(n,t){return chunkPS272DZJ_cjs.N("COLLECTION_TOO_LARGE",`This collection has ${n} elements, past the limit of ${t} (see the engine's vm.maxCollectionSize setting).`)}function xr(n,t=Number.POSITIVE_INFINITY){let e=chunkPS272DZJ_cjs.O(n);if(e)return e;if(n.type===7){let r=n.value;return r.data.length>t?mt(r.data.length,t):r.data.map(Ht)}if(n.type===8){let r=n.value,o=r.max-r.min+1;if(o>t)return mt(o,t);let i=new Array(o);for(let l=0;l<o;l++)i[l]=chunkPS272DZJ_cjs.n(r.min+l);return i}return chunkPS272DZJ_cjs.N("MAP_REDUCE_REQUIRES_COLLECTION",'map/reduce requires a Matrix or Range collection (e.g. "[1,2,3]" or "0:3").')}var pt=20,Nn=[1n];function J(n){if(n<0)throw chunkSOMGSIO4_cjs.c.internal("DECIMAL_NEGATIVE_POWER",`pow10 needs a non-negative exponent, got ${n}`,{exponent:n});for(let t=Nn.length;t<=n;t++)Nn[t]=Nn[t-1]*10n;return Nn[n]}function ee(n,t){if(!Number.isInteger(t)||t<0)throw chunkSOMGSIO4_cjs.c.internal("DECIMAL_INVALID_SCALE",`A decimal scale must be a non-negative integer, got ${t}`,{scale:t});return {coef:n,scale:t}}function gt(n){return {coef:typeof n=="bigint"?n:BigInt(n),scale:0}}function re(n){return !Number.isFinite(n)||!Number.isInteger(n)?null:gt(BigInt(n))}function oe(n){let t=n,e=false;t.startsWith("-")?(e=true,t=t.slice(1)):t.startsWith("+")&&(t=t.slice(1));let r=t.indexOf("."),o=r<0?t:t.slice(0,r),i=r<0?"":t.slice(r+1),l=o+i||"0";if(!/^[0-9]+$/.test(l))throw chunkSOMGSIO4_cjs.c.parsing("INVALID_DECIMAL_LITERAL",`Not a decimal literal: "${n}"`,{raw:n});let a=BigInt(l);return e&&(a=-a),{coef:a,scale:i.length}}function Zn(n,t){return n.scale===t.scale?{ca:n.coef,cb:t.coef,scale:n.scale}:n.scale>t.scale?{ca:n.coef,cb:t.coef*J(n.scale-t.scale),scale:n.scale}:{ca:n.coef*J(t.scale-n.scale),cb:t.coef,scale:t.scale}}function ie(n,t){let{ca:e,cb:r,scale:o}=Zn(n,t);return {coef:e+r,scale:o}}function le(n,t){let{ca:e,cb:r,scale:o}=Zn(n,t);return {coef:e-r,scale:o}}function ae(n,t){return {coef:n.coef*t.coef,scale:n.scale+t.scale}}function ce(n){return {coef:-n.coef,scale:n.scale}}function xt(n){return n.coef===0n}function se(n,t,e){if(e>=t)return n*J(e-t);let r=J(t-e),o=n<0n,i=o?-n:n,l=i/r;return i%r*2n>=r&&(l+=1n),o?-l:l}function yt(n,t){return {coef:se(n.coef,n.scale,t),scale:t}}function ue(n,t,e=pt){if(xt(t))throw chunkSOMGSIO4_cjs.c.internal("DECIMAL_DIVISION_BY_ZERO","decimalDivide was called with a zero divisor",{});let r=e,o=n.coef*J(r+t.scale),i=t.coef*J(n.scale),l=o<0n!=i<0n,a=o<0n?-o:o,c=i<0n?-i:i,f=a/c;return a%c*2n>=c&&(f+=1n),{coef:l?-f:f,scale:r}}function fe(n,t){let{ca:e,cb:r}=Zn(n,t);return e<r?-1:e>r?1:0}function bt(n){let t=n.coef<0n,e=(t?-n.coef:n.coef).toString();if(n.scale===0)return t?`-${e}`:e;e.length<=n.scale&&(e=e.padStart(n.scale+1,"0"));let r=e.length-n.scale,o=e.slice(0,r),i=e.slice(r);return `${t?"-":""}${o}.${i}`}function me(n){return Number(bt(n))}function de(n,t){let e=yt(n,t),r=e.coef<0n&&e.coef!==0n,o=(e.coef<0n?-e.coef:e.coef).toString();if(t===0)return r?`-${o}`:o;o.length<=t&&(o=o.padStart(t+1,"0"));let i=o.length-t,l=o.slice(0,i),a=o.slice(i);return `${r?"-":""}${l}.${a}`}var pe={$:"USD","\xA3":"GBP","\u20AC":"EUR","\xA5":"JPY","\u20BD":"RUB","\u20A9":"KRW","\u20B9":"INR","\u20BA":"TRY","\u20B4":"UAH","\u20AA":"ILS","\u20AB":"VND","\u20A6":"NGN","\u20B1":"PHP"},ge={dollar:"USD",dollars:"USD",euro:"EUR",euros:"EUR",yen:"JPY",ruble:"RUB",rubles:"RUB",rouble:"RUB",roubles:"RUB",won:"KRW",rupee:"INR",rupees:"INR",yuan:"CNY",renminbi:"CNY",franc:"CHF",francs:"CHF",rand:"ZAR",krona:"SEK",kronor:"SEK",krone:"NOK",kroner:"NOK",real:"BRL",reais:"BRL",peso:"MXN",pesos:"MXN",shekel:"ILS",shekels:"ILS",lira:"TRY",hryvnia:"UAH",hryvnias:"UAH",zloty:"PLN",zlotys:"PLN",forint:"HUF",koruna:"CZK",dirham:"AED",dirhams:"AED",riyal:"SAR",riyals:"SAR",rial:"SAR",rials:"SAR",ringgit:"MYR",rupiah:"IDR",baht:"THB",dong:"VND",naira:"NGN"};function Sr(n){return pe[n]??ge[n.toLowerCase()]}var Ir={USD:{symbol:"$",position:"prefix",spaced:false},AUD:{symbol:"$",position:"prefix",spaced:false},CAD:{symbol:"$",position:"prefix",spaced:false},NZD:{symbol:"$",position:"prefix",spaced:false},HKD:{symbol:"$",position:"prefix",spaced:false},SGD:{symbol:"$",position:"prefix",spaced:false},MXN:{symbol:"$",position:"prefix",spaced:false},GBP:{symbol:"\xA3",position:"prefix",spaced:false},EUR:{symbol:"\u20AC",position:"prefix",spaced:false},JPY:{symbol:"\xA5",position:"prefix",spaced:false},CNY:{symbol:"\xA5",position:"prefix",spaced:false},KRW:{symbol:"\u20A9",position:"prefix",spaced:false},INR:{symbol:"\u20B9",position:"prefix",spaced:false},RUB:{symbol:"\u20BD",position:"suffix",spaced:true},TRY:{symbol:"\u20BA",position:"prefix",spaced:false},UAH:{symbol:"\u20B4",position:"suffix",spaced:true},ILS:{symbol:"\u20AA",position:"prefix",spaced:false},VND:{symbol:"\u20AB",position:"suffix",spaced:false},NGN:{symbol:"\u20A6",position:"prefix",spaced:false},PHP:{symbol:"\u20B1",position:"prefix",spaced:false},BRL:{symbol:"R$",position:"prefix",spaced:false},ZAR:{symbol:"R",position:"prefix",spaced:false},SEK:{symbol:"kr",position:"suffix",spaced:true},NOK:{symbol:"kr",position:"suffix",spaced:true},DKK:{symbol:"kr",position:"suffix",spaced:true},PLN:{symbol:"z\u0142",position:"suffix",spaced:true},CHF:{symbol:"Fr",position:"suffix",spaced:true},HUF:{symbol:"Ft",position:"suffix",spaced:true},CZK:{symbol:"K\u010D",position:"suffix",spaced:true}};exports.$=fr;exports.A=ot;exports.B=H;exports.C=h;exports.D=_t;exports.E=X;exports.F=ke;exports.G=Ae;exports.H=yn;exports.I=it;exports.J=lt;exports.K=we;exports.L=en;exports.M=Ln;exports.N=Pe;exports.O=Bt;exports.P=Te;exports.Q=M;exports.R=Kt;exports.S=ar;exports.T=_;exports.U=cr;exports.V=jt;exports.W=qn;exports.X=Ht;exports.Y=sr;exports.Z=ur;exports._=ft;exports.a=p;exports.aa=mr;exports.b=y;exports.ba=dr;exports.c=Sn;exports.ca=pr;exports.d=In;exports.da=gr;exports.e=z;exports.ea=xr;exports.f=b;exports.fa=ee;exports.g=C;exports.ga=gt;exports.h=d;exports.ha=re;exports.i=S;exports.ia=oe;exports.j=I;exports.ja=ie;exports.k=It;exports.ka=le;exports.l=u;exports.la=ae;exports.m=N;exports.ma=ce;exports.n=kn;exports.na=xt;exports.o=cn;exports.oa=yt;exports.p=s;exports.pa=ue;exports.q=U;exports.qa=fe;exports.r=_n;exports.ra=me;exports.s=Mt;exports.sa=de;exports.t=v;exports.ta=Sr;exports.u=kt;exports.ua=Ir;exports.v=q;exports.w=A;exports.x=Ct;exports.y=T;exports.z=gn;//# sourceMappingURL=chunk-N7N7MPMK.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-N7N7MPMK.cjs.map
|