solve-engine 2.6.0 → 2.8.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.
Files changed (177) hide show
  1. package/dist/{PackageCompatibility-CCdud__Q.d.cts → PackageCompatibility-BG0iur4I.d.cts} +1 -1
  2. package/dist/{PackageCompatibility-4QtIErfx.d.ts → PackageCompatibility-BlIcQg5v.d.ts} +1 -1
  3. package/dist/{PackageRegistry-B7wkfSrY.d.ts → PackageRegistry-BJ0QQd3k.d.ts} +4 -4
  4. package/dist/{PackageRegistry-Hx85XD01.d.cts → PackageRegistry-DeGDZkNt.d.cts} +4 -4
  5. package/dist/{Parselet-CTNpfuEB.d.cts → Parselet-BSndkWEY.d.cts} +1 -1
  6. package/dist/{Parselet-DONNUpur.d.ts → Parselet-Blq8B0Gj.d.ts} +1 -1
  7. package/dist/{ScopeManager-BkbDXK_R.d.ts → ScopeManager-CF3cZUqW.d.ts} +2 -2
  8. package/dist/{ScopeManager-Cvgypcu4.d.cts → ScopeManager-D8nLv--u.d.cts} +2 -2
  9. package/dist/{VMCheckpoints-9zBQnTsN.d.ts → VMCheckpoints-BsR5_auF.d.ts} +2 -2
  10. package/dist/{VMCheckpoints-CBMGiSqw.d.cts → VMCheckpoints-Dy39SVHa.d.cts} +2 -2
  11. package/dist/{Value-D1XlMwe2.d.cts → Value-DCTqTSeP.d.cts} +22 -5
  12. package/dist/{Value-D1XlMwe2.d.ts → Value-DCTqTSeP.d.ts} +22 -5
  13. package/dist/{chunk-T52Y5G24.js → chunk-2V44X7GH.js} +4 -4
  14. package/dist/{chunk-T52Y5G24.js.map → chunk-2V44X7GH.js.map} +1 -1
  15. package/dist/{chunk-5FO4PDIG.js → chunk-3GAWAMT4.js} +2 -2
  16. package/dist/{chunk-5FO4PDIG.js.map → chunk-3GAWAMT4.js.map} +1 -1
  17. package/dist/{chunk-32GC2FHC.cjs → chunk-3HYO3QYW.cjs} +2 -2
  18. package/dist/{chunk-32GC2FHC.cjs.map → chunk-3HYO3QYW.cjs.map} +1 -1
  19. package/dist/{chunk-2JMFUQZH.js → chunk-44EOEWGP.js} +2 -2
  20. package/dist/chunk-44EOEWGP.js.map +1 -0
  21. package/dist/chunk-5TCSFTZD.js +2 -0
  22. package/dist/chunk-5TCSFTZD.js.map +1 -0
  23. package/dist/chunk-5TVI2UPZ.cjs +2 -0
  24. package/dist/chunk-5TVI2UPZ.cjs.map +1 -0
  25. package/dist/{chunk-CIQOK7Q4.cjs → chunk-6QRHN3I6.cjs} +2 -2
  26. package/dist/chunk-6QRHN3I6.cjs.map +1 -0
  27. package/dist/chunk-6TPXH6Y5.cjs +3 -0
  28. package/dist/chunk-6TPXH6Y5.cjs.map +1 -0
  29. package/dist/{chunk-ZOOVGXMK.cjs → chunk-75XDS65A.cjs} +2 -2
  30. package/dist/{chunk-ZOOVGXMK.cjs.map → chunk-75XDS65A.cjs.map} +1 -1
  31. package/dist/chunk-A33K7NY4.js +2 -0
  32. package/dist/chunk-A33K7NY4.js.map +1 -0
  33. package/dist/chunk-BKSKZA4W.cjs +2 -0
  34. package/dist/chunk-BKSKZA4W.cjs.map +1 -0
  35. package/dist/{chunk-VAGS5JS7.cjs → chunk-C65UDMWH.cjs} +2 -2
  36. package/dist/{chunk-VAGS5JS7.cjs.map → chunk-C65UDMWH.cjs.map} +1 -1
  37. package/dist/{chunk-OVQ3V4CG.cjs → chunk-CIENDLKV.cjs} +2 -2
  38. package/dist/{chunk-OVQ3V4CG.cjs.map → chunk-CIENDLKV.cjs.map} +1 -1
  39. package/dist/chunk-DLAKPF5T.js +2 -0
  40. package/dist/chunk-DLAKPF5T.js.map +1 -0
  41. package/dist/chunk-EOMHELRL.js +2 -0
  42. package/dist/chunk-EOMHELRL.js.map +1 -0
  43. package/dist/chunk-EURCQMZK.cjs +2 -0
  44. package/dist/{chunk-Z5KBBQOJ.cjs.map → chunk-EURCQMZK.cjs.map} +1 -1
  45. package/dist/{chunk-HOQU47MF.cjs → chunk-FNNIAJNY.cjs} +2 -2
  46. package/dist/{chunk-HOQU47MF.cjs.map → chunk-FNNIAJNY.cjs.map} +1 -1
  47. package/dist/{chunk-3AVWA5IZ.cjs → chunk-FUDVKPB7.cjs} +2 -2
  48. package/dist/{chunk-3AVWA5IZ.cjs.map → chunk-FUDVKPB7.cjs.map} +1 -1
  49. package/dist/{chunk-4XTD4B77.js → chunk-GAAXTO4K.js} +3 -3
  50. package/dist/{chunk-4XTD4B77.js.map → chunk-GAAXTO4K.js.map} +1 -1
  51. package/dist/{chunk-G7TBEQRQ.js → chunk-GMSBBLUQ.js} +2 -2
  52. package/dist/{chunk-G7TBEQRQ.js.map → chunk-GMSBBLUQ.js.map} +1 -1
  53. package/dist/chunk-HDVZZ7JN.js +3 -0
  54. package/dist/chunk-HDVZZ7JN.js.map +1 -0
  55. package/dist/{chunk-SWKYVSMP.js → chunk-JEFMG6CV.js} +2 -2
  56. package/dist/{chunk-SWKYVSMP.js.map → chunk-JEFMG6CV.js.map} +1 -1
  57. package/dist/{chunk-P6BLASAA.js → chunk-JQBG3LX4.js} +2 -2
  58. package/dist/{chunk-P6BLASAA.js.map → chunk-JQBG3LX4.js.map} +1 -1
  59. package/dist/{chunk-GHW2X7PS.js → chunk-KHCNMNZZ.js} +2 -2
  60. package/dist/{chunk-GHW2X7PS.js.map → chunk-KHCNMNZZ.js.map} +1 -1
  61. package/dist/chunk-LH7URJZT.js +3 -0
  62. package/dist/chunk-LH7URJZT.js.map +1 -0
  63. package/dist/{chunk-R7T3NGUE.cjs → chunk-MVP2YD4X.cjs} +2 -2
  64. package/dist/{chunk-R7T3NGUE.cjs.map → chunk-MVP2YD4X.cjs.map} +1 -1
  65. package/dist/{chunk-KSDTVFXA.cjs → chunk-OZ6SKIPD.cjs} +4 -4
  66. package/dist/{chunk-KSDTVFXA.cjs.map → chunk-OZ6SKIPD.cjs.map} +1 -1
  67. package/dist/chunk-PNDQRCRQ.cjs +2 -0
  68. package/dist/chunk-PNDQRCRQ.cjs.map +1 -0
  69. package/dist/{chunk-YAHGSBMC.js → chunk-QYO7IEPR.js} +2 -2
  70. package/dist/{chunk-YAHGSBMC.js.map → chunk-QYO7IEPR.js.map} +1 -1
  71. package/dist/{chunk-2LFLR3VZ.cjs → chunk-SNVPM27Q.cjs} +2 -2
  72. package/dist/{chunk-2LFLR3VZ.cjs.map → chunk-SNVPM27Q.cjs.map} +1 -1
  73. package/dist/{chunk-AR7L5OJ2.js → chunk-T3FBAFRR.js} +2 -2
  74. package/dist/{chunk-AR7L5OJ2.js.map → chunk-T3FBAFRR.js.map} +1 -1
  75. package/dist/chunk-TUBLMUTZ.cjs +2 -0
  76. package/dist/chunk-TUBLMUTZ.cjs.map +1 -0
  77. package/dist/chunk-U47GA63S.cjs +3 -0
  78. package/dist/chunk-U47GA63S.cjs.map +1 -0
  79. package/dist/{chunk-HMEZJXLX.js → chunk-UKDUFMT5.js} +2 -2
  80. package/dist/{chunk-HMEZJXLX.js.map → chunk-UKDUFMT5.js.map} +1 -1
  81. package/dist/chunk-UWAXJX5G.js +2 -0
  82. package/dist/chunk-UWAXJX5G.js.map +1 -0
  83. package/dist/chunk-WEAKI5V5.cjs +2 -0
  84. package/dist/chunk-WEAKI5V5.cjs.map +1 -0
  85. package/dist/{chunk-VYWGUMFW.js → chunk-WTEXBPBR.js} +2 -2
  86. package/dist/{chunk-VYWGUMFW.js.map → chunk-WTEXBPBR.js.map} +1 -1
  87. package/dist/{chunk-NXIMGB4S.cjs → chunk-WYIOXAFW.cjs} +2 -2
  88. package/dist/{chunk-NXIMGB4S.cjs.map → chunk-WYIOXAFW.cjs.map} +1 -1
  89. package/dist/{chunk-B4P4M4ZW.cjs → chunk-YORX7723.cjs} +3 -3
  90. package/dist/{chunk-B4P4M4ZW.cjs.map → chunk-YORX7723.cjs.map} +1 -1
  91. package/dist/chunk-YTCTUBR2.js +2 -0
  92. package/dist/{chunk-XTM4HTRB.js.map → chunk-YTCTUBR2.js.map} +1 -1
  93. package/dist/constants.cjs +1 -1
  94. package/dist/constants.js +1 -1
  95. package/dist/engine.cjs +1 -1
  96. package/dist/engine.d.cts +7 -7
  97. package/dist/engine.d.ts +7 -7
  98. package/dist/engine.js +1 -1
  99. package/dist/format.cjs +1 -1
  100. package/dist/format.d.cts +1 -1
  101. package/dist/format.d.ts +1 -1
  102. package/dist/format.js +1 -1
  103. package/dist/index.cjs +1 -1
  104. package/dist/index.d.cts +7 -7
  105. package/dist/index.d.ts +7 -7
  106. package/dist/index.js +1 -1
  107. package/dist/language.cjs +1 -1
  108. package/dist/language.d.cts +6 -6
  109. package/dist/language.d.ts +6 -6
  110. package/dist/language.js +1 -1
  111. package/dist/lexer.cjs +1 -1
  112. package/dist/lexer.js +1 -1
  113. package/dist/normalizer.cjs +1 -1
  114. package/dist/normalizer.js +1 -1
  115. package/dist/packages.cjs +1 -1
  116. package/dist/packages.d.cts +6 -6
  117. package/dist/packages.d.ts +6 -6
  118. package/dist/packages.js +1 -1
  119. package/dist/parser.cjs +1 -1
  120. package/dist/parser.d.cts +3 -3
  121. package/dist/parser.d.ts +3 -3
  122. package/dist/parser.js +1 -1
  123. package/dist/{pipeline-DY0rhgQG.d.cts → pipeline-BM8xc0CZ.d.cts} +3 -3
  124. package/dist/{pipeline-BH7BFOTJ.d.ts → pipeline-J2ehIm7t.d.ts} +3 -3
  125. package/dist/resolvers.d.cts +1 -1
  126. package/dist/resolvers.d.ts +1 -1
  127. package/dist/testing.cjs +2 -2
  128. package/dist/testing.d.cts +6 -6
  129. package/dist/testing.d.ts +6 -6
  130. package/dist/testing.js +1 -1
  131. package/dist/uom.cjs +1 -1
  132. package/dist/uom.d.cts +1 -1
  133. package/dist/uom.d.ts +1 -1
  134. package/dist/uom.js +1 -1
  135. package/dist/vm.cjs +1 -1
  136. package/dist/vm.d.cts +6 -6
  137. package/dist/vm.d.ts +6 -6
  138. package/dist/vm.js +1 -1
  139. package/dist/worker.cjs +2 -2
  140. package/dist/worker.cjs.map +1 -1
  141. package/dist/worker.d.cts +15 -5
  142. package/dist/worker.d.ts +15 -5
  143. package/dist/worker.js +2 -2
  144. package/dist/worker.js.map +1 -1
  145. package/package.json +1 -1
  146. package/dist/chunk-2JMFUQZH.js.map +0 -1
  147. package/dist/chunk-3DD2RVBI.cjs +0 -3
  148. package/dist/chunk-3DD2RVBI.cjs.map +0 -1
  149. package/dist/chunk-5FGOIDLS.cjs +0 -2
  150. package/dist/chunk-5FGOIDLS.cjs.map +0 -1
  151. package/dist/chunk-5OIXCVB2.js +0 -3
  152. package/dist/chunk-5OIXCVB2.js.map +0 -1
  153. package/dist/chunk-CIQOK7Q4.cjs.map +0 -1
  154. package/dist/chunk-ESUN2THE.cjs +0 -2
  155. package/dist/chunk-ESUN2THE.cjs.map +0 -1
  156. package/dist/chunk-FWW3M36J.cjs +0 -2
  157. package/dist/chunk-FWW3M36J.cjs.map +0 -1
  158. package/dist/chunk-GKDZ7TSX.cjs +0 -2
  159. package/dist/chunk-GKDZ7TSX.cjs.map +0 -1
  160. package/dist/chunk-IANAMBJQ.cjs +0 -2
  161. package/dist/chunk-IANAMBJQ.cjs.map +0 -1
  162. package/dist/chunk-IO374J6Z.js +0 -2
  163. package/dist/chunk-IO374J6Z.js.map +0 -1
  164. package/dist/chunk-R2ENWQ76.js +0 -2
  165. package/dist/chunk-R2ENWQ76.js.map +0 -1
  166. package/dist/chunk-SOSUS2SK.cjs +0 -3
  167. package/dist/chunk-SOSUS2SK.cjs.map +0 -1
  168. package/dist/chunk-T4Y5XOT2.js +0 -3
  169. package/dist/chunk-T4Y5XOT2.js.map +0 -1
  170. package/dist/chunk-TRBXW6HW.js +0 -2
  171. package/dist/chunk-TRBXW6HW.js.map +0 -1
  172. package/dist/chunk-WGZ3FNHI.js +0 -2
  173. package/dist/chunk-WGZ3FNHI.js.map +0 -1
  174. package/dist/chunk-XTM4HTRB.js +0 -2
  175. package/dist/chunk-Z5KBBQOJ.cjs +0 -2
  176. package/dist/chunk-ZJPAPBP3.js +0 -2
  177. package/dist/chunk-ZJPAPBP3.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { QueryClient } from '@tanstack/query-core';
2
2
  import { T as Token } from './Token-CbP_OutD.cjs';
3
3
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.cjs';
4
- import { V as Value } from './Value-D1XlMwe2.cjs';
4
+ import { V as Value } from './Value-DCTqTSeP.cjs';
5
5
 
6
6
  /**
7
7
  * Result from a resolver's preflight() check.
@@ -1,7 +1,7 @@
1
1
  import { QueryClient } from '@tanstack/query-core';
2
2
  import { T as Token } from './Token-CbP_OutD.js';
3
3
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.js';
4
- import { V as Value } from './Value-D1XlMwe2.js';
4
+ import { V as Value } from './Value-DCTqTSeP.js';
5
5
 
6
6
  /**
7
7
  * Result from a resolver's preflight() check.
package/dist/testing.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkKSDTVFXA_cjs=require('./chunk-KSDTVFXA.cjs');require('./chunk-HOQU47MF.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-GKDZ7TSX.cjs'),require('./chunk-R7T3NGUE.cjs'),require('./chunk-3DD2RVBI.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkSOSUS2SK_cjs=require('./chunk-SOSUS2SK.cjs');require('./chunk-3AVWA5IZ.cjs'),require('./chunk-NXIMGB4S.cjs'),require('./chunk-4QVBSG6B.cjs'),require('./chunk-VAGS5JS7.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-Z5KBBQOJ.cjs'),require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-ESUN2THE.cjs'),require('./chunk-ZOOVGXMK.cjs');var chunk5FGOIDLS_cjs=require('./chunk-5FGOIDLS.cjs');require('./chunk-IANAMBJQ.cjs');var chunkOVQ3V4CG_cjs=require('./chunk-OVQ3V4CG.cjs');require('./chunk-32GC2FHC.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-2LFLR3VZ.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-FWW3M36J.cjs'),require('./chunk-CIQOK7Q4.cjs');var chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new chunkKSDTVFXA_cjs.n({locale:e,packages:r?chunkSOSUS2SK_cjs.y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof chunkSOMGSIO4_cjs.b)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new chunk5FGOIDLS_cjs.m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=chunkKSDTVFXA_cjs.a(this.pkg,t),s=$.indexOf(e),a=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a.length>0){let u=a.map(g=>`[${g.severity}] ${g.detail}`).join(`
1
+ 'use strict';var chunkOZ6SKIPD_cjs=require('./chunk-OZ6SKIPD.cjs');require('./chunk-FNNIAJNY.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-TUBLMUTZ.cjs'),require('./chunk-MVP2YD4X.cjs'),require('./chunk-6TPXH6Y5.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkU47GA63S_cjs=require('./chunk-U47GA63S.cjs');require('./chunk-FUDVKPB7.cjs'),require('./chunk-WYIOXAFW.cjs'),require('./chunk-4QVBSG6B.cjs'),require('./chunk-C65UDMWH.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-EURCQMZK.cjs'),require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-75XDS65A.cjs');var chunkPNDQRCRQ_cjs=require('./chunk-PNDQRCRQ.cjs');require('./chunk-BKSKZA4W.cjs');var chunkCIENDLKV_cjs=require('./chunk-CIENDLKV.cjs');require('./chunk-3HYO3QYW.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-SNVPM27Q.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-WEAKI5V5.cjs'),require('./chunk-6QRHN3I6.cjs');var chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new chunkOZ6SKIPD_cjs.n({locale:e,packages:r?chunkU47GA63S_cjs.y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof chunkSOMGSIO4_cjs.b)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new chunkPNDQRCRQ_cjs.m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=chunkOZ6SKIPD_cjs.a(this.pkg,t),s=$.indexOf(e),a=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a.length>0){let u=a.map(g=>`[${g.severity}] ${g.detail}`).join(`
2
2
  `);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
3
- ${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=chunkOVQ3V4CG_cjs.a){let e=chunkKSDTVFXA_cjs.b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}exports.COMMON_PROSE_WORDS=O;exports.ExpectationError=i;exports.ExpressionAssertion=d;exports.PackageAssertion=p;exports.createTestEngine=V;exports.expectExpression=D;exports.expectPackage=L;//# sourceMappingURL=testing.cjs.map
3
+ ${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=chunkCIENDLKV_cjs.a){let e=chunkOZ6SKIPD_cjs.b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}exports.COMMON_PROSE_WORDS=O;exports.ExpectationError=i;exports.ExpressionAssertion=d;exports.PackageAssertion=p;exports.createTestEngine=V;exports.expectExpression=D;exports.expectPackage=L;//# sourceMappingURL=testing.cjs.map
4
4
  //# sourceMappingURL=testing.cjs.map
@@ -1,16 +1,16 @@
1
- import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-Hx85XD01.cjs';
2
- import { V as Value } from './Value-D1XlMwe2.cjs';
1
+ import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-DeGDZkNt.cjs';
2
+ import { V as Value } from './Value-DCTqTSeP.cjs';
3
3
  import { E as EngineError } from './EngineError-Ce1lPkjZ.cjs';
4
- import { C as CompatibilityReport } from './PackageCompatibility-CCdud__Q.cjs';
5
- import './Parselet-CTNpfuEB.cjs';
4
+ import { C as CompatibilityReport } from './PackageCompatibility-BG0iur4I.cjs';
5
+ import './Parselet-BSndkWEY.cjs';
6
6
  import './BytecodeBuilder-BGq9ZiO3.cjs';
7
7
  import './Token-CbP_OutD.cjs';
8
- import './pipeline-DY0rhgQG.cjs';
8
+ import './pipeline-BM8xc0CZ.cjs';
9
9
  import './Lexer-B4C1qHXu.cjs';
10
10
  import './resolvers.cjs';
11
11
  import '@tanstack/query-core';
12
12
  import './TokenNormalizer-DnlL7_8c.cjs';
13
- import './ScopeManager-Cvgypcu4.cjs';
13
+ import './ScopeManager-D8nLv--u.cjs';
14
14
  import './Configuration-BGQn-cJ8.cjs';
15
15
 
16
16
  /**
package/dist/testing.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-B7wkfSrY.js';
2
- import { V as Value } from './Value-D1XlMwe2.js';
1
+ import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-BJ0QQd3k.js';
2
+ import { V as Value } from './Value-DCTqTSeP.js';
3
3
  import { E as EngineError } from './EngineError-Ce1lPkjZ.js';
4
- import { C as CompatibilityReport } from './PackageCompatibility-4QtIErfx.js';
5
- import './Parselet-DONNUpur.js';
4
+ import { C as CompatibilityReport } from './PackageCompatibility-BlIcQg5v.js';
5
+ import './Parselet-Blq8B0Gj.js';
6
6
  import './BytecodeBuilder-BGq9ZiO3.js';
7
7
  import './Token-CbP_OutD.js';
8
- import './pipeline-BH7BFOTJ.js';
8
+ import './pipeline-J2ehIm7t.js';
9
9
  import './Lexer-DKMlj7Sy.js';
10
10
  import './resolvers.js';
11
11
  import '@tanstack/query-core';
12
12
  import './TokenNormalizer-DCWdZjGz.js';
13
- import './ScopeManager-BkbDXK_R.js';
13
+ import './ScopeManager-CF3cZUqW.js';
14
14
  import './Configuration-BGQn-cJ8.js';
15
15
 
16
16
  /**
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import {n as n$1,a,b}from'./chunk-T52Y5G24.js';import'./chunk-P6BLASAA.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-ZJPAPBP3.js';import'./chunk-GHW2X7PS.js';import'./chunk-5OIXCVB2.js';import'./chunk-XEIDV5JP.js';import {y}from'./chunk-T4Y5XOT2.js';import'./chunk-SWKYVSMP.js';import'./chunk-AR7L5OJ2.js';import'./chunk-YVKHEAFT.js';import'./chunk-5FO4PDIG.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-XTM4HTRB.js';import'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-R2ENWQ76.js';import'./chunk-VYWGUMFW.js';import {m}from'./chunk-IO374J6Z.js';import'./chunk-WGZ3FNHI.js';import {a as a$1}from'./chunk-HMEZJXLX.js';import'./chunk-YAHGSBMC.js';import'./chunk-JPFCXLJV.js';import'./chunk-G7TBEQRQ.js';import'./chunk-IJMNVBIS.js';import'./chunk-62LMTO4F.js';import'./chunk-TRBXW6HW.js';import'./chunk-2JMFUQZH.js';import {b as b$1}from'./chunk-MPB7KUN5.js';var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new n$1({locale:e,packages:r?y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof b$1)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=a(this.pkg,t),s=$.indexOf(e),a$1=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a$1.length>0){let u=a$1.map(g=>`[${g.severity}] ${g.detail}`).join(`
1
+ import {n as n$1,a,b}from'./chunk-2V44X7GH.js';import'./chunk-JQBG3LX4.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-EOMHELRL.js';import'./chunk-KHCNMNZZ.js';import'./chunk-LH7URJZT.js';import'./chunk-XEIDV5JP.js';import {y}from'./chunk-HDVZZ7JN.js';import'./chunk-JEFMG6CV.js';import'./chunk-T3FBAFRR.js';import'./chunk-YVKHEAFT.js';import'./chunk-3GAWAMT4.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-YTCTUBR2.js';import'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-WTEXBPBR.js';import {m}from'./chunk-A33K7NY4.js';import'./chunk-DLAKPF5T.js';import {a as a$1}from'./chunk-UKDUFMT5.js';import'./chunk-QYO7IEPR.js';import'./chunk-JPFCXLJV.js';import'./chunk-GMSBBLUQ.js';import'./chunk-IJMNVBIS.js';import'./chunk-62LMTO4F.js';import'./chunk-UWAXJX5G.js';import'./chunk-44EOEWGP.js';import {b as b$1}from'./chunk-MPB7KUN5.js';var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new n$1({locale:e,packages:r?y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof b$1)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=a(this.pkg,t),s=$.indexOf(e),a$1=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a$1.length>0){let u=a$1.map(g=>`[${g.severity}] ${g.detail}`).join(`
2
2
  `);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
3
3
  ${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a$1.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=a$1){let e=b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}export{O as COMMON_PROSE_WORDS,i as ExpectationError,d as ExpressionAssertion,p as PackageAssertion,V as createTestEngine,D as expectExpression,L as expectPackage};//# sourceMappingURL=testing.js.map
4
4
  //# sourceMappingURL=testing.js.map
package/dist/uom.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk3AVWA5IZ_cjs=require('./chunk-3AVWA5IZ.cjs'),chunk4BZIYU7S_cjs=require('./chunk-4BZIYU7S.cjs');require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5FGOIDLS.cjs');var chunkIANAMBJQ_cjs=require('./chunk-IANAMBJQ.cjs');require('./chunk-CIQOK7Q4.cjs'),require('./chunk-SOMGSIO4.cjs');Object.defineProperty(exports,"CurrencyAsyncResolver",{enumerable:true,get:function(){return chunk3AVWA5IZ_cjs.b}});Object.defineProperty(exports,"CurrencyExchangeService",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.a}});Object.defineProperty(exports,"currencyExchangeService",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.b}});Object.defineProperty(exports,"sharedCurrencyExchange",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.c}});Object.defineProperty(exports,"canConvert",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.d}});Object.defineProperty(exports,"convertUnit",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.e}});Object.defineProperty(exports,"getBestUnit",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.h}});Object.defineProperty(exports,"getMeasure",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.c}});Object.defineProperty(exports,"isConvertibleUnit",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.g}});Object.defineProperty(exports,"resolveUnit",{enumerable:true,get:function(){return chunkIANAMBJQ_cjs.b}});//# sourceMappingURL=uom.cjs.map
1
+ 'use strict';var chunkFUDVKPB7_cjs=require('./chunk-FUDVKPB7.cjs'),chunk4BZIYU7S_cjs=require('./chunk-4BZIYU7S.cjs');require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-PNDQRCRQ.cjs');var chunkBKSKZA4W_cjs=require('./chunk-BKSKZA4W.cjs');require('./chunk-6QRHN3I6.cjs'),require('./chunk-SOMGSIO4.cjs');Object.defineProperty(exports,"CurrencyAsyncResolver",{enumerable:true,get:function(){return chunkFUDVKPB7_cjs.b}});Object.defineProperty(exports,"CurrencyExchangeService",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.a}});Object.defineProperty(exports,"currencyExchangeService",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.b}});Object.defineProperty(exports,"sharedCurrencyExchange",{enumerable:true,get:function(){return chunk4BZIYU7S_cjs.c}});Object.defineProperty(exports,"canConvert",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.d}});Object.defineProperty(exports,"convertUnit",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.e}});Object.defineProperty(exports,"getBestUnit",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.h}});Object.defineProperty(exports,"getMeasure",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.c}});Object.defineProperty(exports,"isConvertibleUnit",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.g}});Object.defineProperty(exports,"resolveUnit",{enumerable:true,get:function(){return chunkBKSKZA4W_cjs.b}});//# sourceMappingURL=uom.cjs.map
2
2
  //# sourceMappingURL=uom.cjs.map
package/dist/uom.d.cts CHANGED
@@ -2,7 +2,7 @@ import { QueryClient } from '@tanstack/query-core';
2
2
  import { T as Token } from './Token-CbP_OutD.cjs';
3
3
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.cjs';
4
4
  import { IAsyncResolver, AsyncCheckResult } from './resolvers.cjs';
5
- import './Value-D1XlMwe2.cjs';
5
+ import './Value-DCTqTSeP.cjs';
6
6
 
7
7
  /**
8
8
  * Caches exchange rates fetched from an external source.
package/dist/uom.d.ts CHANGED
@@ -2,7 +2,7 @@ import { QueryClient } from '@tanstack/query-core';
2
2
  import { T as Token } from './Token-CbP_OutD.js';
3
3
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.js';
4
4
  import { IAsyncResolver, AsyncCheckResult } from './resolvers.js';
5
- import './Value-D1XlMwe2.js';
5
+ import './Value-DCTqTSeP.js';
6
6
 
7
7
  /**
8
8
  * Caches exchange rates fetched from an external source.
package/dist/uom.js CHANGED
@@ -1,2 +1,2 @@
1
- export{b as CurrencyAsyncResolver}from'./chunk-SWKYVSMP.js';export{a as CurrencyExchangeService,b as currencyExchangeService,c as sharedCurrencyExchange}from'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-IO374J6Z.js';export{d as canConvert,e as convertUnit,h as getBestUnit,c as getMeasure,g as isConvertibleUnit,b as resolveUnit}from'./chunk-WGZ3FNHI.js';import'./chunk-2JMFUQZH.js';import'./chunk-MPB7KUN5.js';//# sourceMappingURL=uom.js.map
1
+ export{b as CurrencyAsyncResolver}from'./chunk-JEFMG6CV.js';export{a as CurrencyExchangeService,b as currencyExchangeService,c as sharedCurrencyExchange}from'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-A33K7NY4.js';export{d as canConvert,e as convertUnit,h as getBestUnit,c as getMeasure,g as isConvertibleUnit,b as resolveUnit}from'./chunk-DLAKPF5T.js';import'./chunk-44EOEWGP.js';import'./chunk-MPB7KUN5.js';//# sourceMappingURL=uom.js.map
2
2
  //# sourceMappingURL=uom.js.map
package/dist/vm.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkGKDZ7TSX_cjs=require('./chunk-GKDZ7TSX.cjs');require('./chunk-R7T3NGUE.cjs');var chunkZ5KBBQOJ_cjs=require('./chunk-Z5KBBQOJ.cjs');require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-ZOOVGXMK.cjs');var chunk5FGOIDLS_cjs=require('./chunk-5FGOIDLS.cjs');require('./chunk-IANAMBJQ.cjs'),require('./chunk-CIQOK7Q4.cjs'),require('./chunk-SOMGSIO4.cjs');var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};Object.defineProperty(exports,"DependencyGraph",{enumerable:true,get:function(){return chunkGKDZ7TSX_cjs.a}});Object.defineProperty(exports,"ScopeManager",{enumerable:true,get:function(){return chunkGKDZ7TSX_cjs.b}});Object.defineProperty(exports,"createVM",{enumerable:true,get:function(){return chunkGKDZ7TSX_cjs.c}});Object.defineProperty(exports,"executeBytecode",{enumerable:true,get:function(){return chunkGKDZ7TSX_cjs.d}});Object.defineProperty(exports,"OpRegistry",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.v}});Object.defineProperty(exports,"allocatePluginFunctionIndex",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.E}});Object.defineProperty(exports,"binaryOp",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.u}});Object.defineProperty(exports,"builtinFunctions",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.C}});Object.defineProperty(exports,"pluginFunctionIndexFor",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.F}});Object.defineProperty(exports,"pluginFunctionRegistry",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.D}});Object.defineProperty(exports,"sharedOpRegistry",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.w}});Object.defineProperty(exports,"unifyUom",{enumerable:true,get:function(){return chunkZ5KBBQOJ_cjs.j}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.g}});Object.defineProperty(exports,"bigIntValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.s}});Object.defineProperty(exports,"chargeAllocation",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.c}});Object.defineProperty(exports,"checkAllocation",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.d}});Object.defineProperty(exports,"checkedArray",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.e}});Object.defineProperty(exports,"colVectorValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.E}});Object.defineProperty(exports,"hexValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.r}});Object.defineProperty(exports,"matrixValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.C}});Object.defineProperty(exports,"numberValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.n}});Object.defineProperty(exports,"rangeValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.F}});Object.defineProperty(exports,"rowVectorValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.D}});Object.defineProperty(exports,"stringValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.t}});Object.defineProperty(exports,"uomValue",{enumerable:true,get:function(){return chunk5FGOIDLS_cjs.u}});exports.VMCheckpointer=l;//# sourceMappingURL=vm.cjs.map
1
+ 'use strict';var chunkTUBLMUTZ_cjs=require('./chunk-TUBLMUTZ.cjs');require('./chunk-MVP2YD4X.cjs');var chunkEURCQMZK_cjs=require('./chunk-EURCQMZK.cjs');require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-75XDS65A.cjs');var chunkPNDQRCRQ_cjs=require('./chunk-PNDQRCRQ.cjs');require('./chunk-BKSKZA4W.cjs'),require('./chunk-6QRHN3I6.cjs'),require('./chunk-SOMGSIO4.cjs');var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};Object.defineProperty(exports,"DependencyGraph",{enumerable:true,get:function(){return chunkTUBLMUTZ_cjs.a}});Object.defineProperty(exports,"ScopeManager",{enumerable:true,get:function(){return chunkTUBLMUTZ_cjs.b}});Object.defineProperty(exports,"createVM",{enumerable:true,get:function(){return chunkTUBLMUTZ_cjs.c}});Object.defineProperty(exports,"executeBytecode",{enumerable:true,get:function(){return chunkTUBLMUTZ_cjs.d}});Object.defineProperty(exports,"OpRegistry",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.v}});Object.defineProperty(exports,"allocatePluginFunctionIndex",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.E}});Object.defineProperty(exports,"binaryOp",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.u}});Object.defineProperty(exports,"builtinFunctions",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.C}});Object.defineProperty(exports,"pluginFunctionIndexFor",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.F}});Object.defineProperty(exports,"pluginFunctionRegistry",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.D}});Object.defineProperty(exports,"sharedOpRegistry",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.w}});Object.defineProperty(exports,"unifyUom",{enumerable:true,get:function(){return chunkEURCQMZK_cjs.j}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.g}});Object.defineProperty(exports,"bigIntValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.s}});Object.defineProperty(exports,"chargeAllocation",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.c}});Object.defineProperty(exports,"checkAllocation",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.d}});Object.defineProperty(exports,"checkedArray",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.e}});Object.defineProperty(exports,"colVectorValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.E}});Object.defineProperty(exports,"hexValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.r}});Object.defineProperty(exports,"matrixValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.C}});Object.defineProperty(exports,"numberValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.n}});Object.defineProperty(exports,"rangeValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.F}});Object.defineProperty(exports,"rowVectorValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.D}});Object.defineProperty(exports,"stringValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.t}});Object.defineProperty(exports,"uomValue",{enumerable:true,get:function(){return chunkPNDQRCRQ_cjs.u}});exports.VMCheckpointer=l;//# sourceMappingURL=vm.cjs.map
2
2
  //# sourceMappingURL=vm.cjs.map
package/dist/vm.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { P as PluginFunctionHandler } from './ScopeManager-Cvgypcu4.cjs';
2
- export { B as Bytecode, D as DependencyGraph, E as ExpressionRecord, O as OpRegistry, S as ScopeManager, V as VM, c as createVM, e as executeBytecode, s as sharedOpRegistry } from './ScopeManager-Cvgypcu4.cjs';
3
- import { V as Value } from './Value-D1XlMwe2.cjs';
4
- export { M as MatrixData, a as MatrixEntry, R as RangeData, b as ValueType, c as bigIntValue, d as colVectorValue, h as hexValue, m as matrixValue, n as numberValue, r as rangeValue, e as rowVectorValue, s as stringValue, u as uomValue } from './Value-D1XlMwe2.cjs';
5
- export { V as VMCheckpoint, a as VMCheckpointer } from './VMCheckpoints-CBMGiSqw.cjs';
1
+ import { P as PluginFunctionHandler } from './ScopeManager-D8nLv--u.cjs';
2
+ export { B as Bytecode, D as DependencyGraph, E as ExpressionRecord, O as OpRegistry, S as ScopeManager, V as VM, c as createVM, e as executeBytecode, s as sharedOpRegistry } from './ScopeManager-D8nLv--u.cjs';
3
+ import { V as Value } from './Value-DCTqTSeP.cjs';
4
+ export { M as MatrixData, a as MatrixEntry, R as RangeData, b as ValueType, c as bigIntValue, d as colVectorValue, h as hexValue, m as matrixValue, n as numberValue, r as rangeValue, e as rowVectorValue, s as stringValue, u as uomValue } from './Value-DCTqTSeP.cjs';
5
+ export { V as VMCheckpoint, a as VMCheckpointer } from './VMCheckpoints-Dy39SVHa.cjs';
6
6
  import './BytecodeBuilder-BGq9ZiO3.cjs';
7
7
  import './EngineError-Ce1lPkjZ.cjs';
8
- import './pipeline-DY0rhgQG.cjs';
8
+ import './pipeline-BM8xc0CZ.cjs';
9
9
 
10
10
  /**
11
11
  * The ceiling on how much memory one evaluation is allowed to ask for.
package/dist/vm.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { P as PluginFunctionHandler } from './ScopeManager-BkbDXK_R.js';
2
- export { B as Bytecode, D as DependencyGraph, E as ExpressionRecord, O as OpRegistry, S as ScopeManager, V as VM, c as createVM, e as executeBytecode, s as sharedOpRegistry } from './ScopeManager-BkbDXK_R.js';
3
- import { V as Value } from './Value-D1XlMwe2.js';
4
- export { M as MatrixData, a as MatrixEntry, R as RangeData, b as ValueType, c as bigIntValue, d as colVectorValue, h as hexValue, m as matrixValue, n as numberValue, r as rangeValue, e as rowVectorValue, s as stringValue, u as uomValue } from './Value-D1XlMwe2.js';
5
- export { V as VMCheckpoint, a as VMCheckpointer } from './VMCheckpoints-9zBQnTsN.js';
1
+ import { P as PluginFunctionHandler } from './ScopeManager-CF3cZUqW.js';
2
+ export { B as Bytecode, D as DependencyGraph, E as ExpressionRecord, O as OpRegistry, S as ScopeManager, V as VM, c as createVM, e as executeBytecode, s as sharedOpRegistry } from './ScopeManager-CF3cZUqW.js';
3
+ import { V as Value } from './Value-DCTqTSeP.js';
4
+ export { M as MatrixData, a as MatrixEntry, R as RangeData, b as ValueType, c as bigIntValue, d as colVectorValue, h as hexValue, m as matrixValue, n as numberValue, r as rangeValue, e as rowVectorValue, s as stringValue, u as uomValue } from './Value-DCTqTSeP.js';
5
+ export { V as VMCheckpoint, a as VMCheckpointer } from './VMCheckpoints-BsR5_auF.js';
6
6
  import './BytecodeBuilder-BGq9ZiO3.js';
7
7
  import './EngineError-Ce1lPkjZ.js';
8
- import './pipeline-BH7BFOTJ.js';
8
+ import './pipeline-J2ehIm7t.js';
9
9
 
10
10
  /**
11
11
  * The ceiling on how much memory one evaluation is allowed to ask for.
package/dist/vm.js CHANGED
@@ -1,2 +1,2 @@
1
- export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-ZJPAPBP3.js';import'./chunk-GHW2X7PS.js';export{v as OpRegistry,E as allocatePluginFunctionIndex,u as binaryOp,C as builtinFunctions,F as pluginFunctionIndexFor,D as pluginFunctionRegistry,w as sharedOpRegistry,j as unifyUom}from'./chunk-XTM4HTRB.js';import'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-VYWGUMFW.js';export{m as Value,g as ValueType,s as bigIntValue,c as chargeAllocation,d as checkAllocation,e as checkedArray,E as colVectorValue,r as hexValue,C as matrixValue,n as numberValue,F as rangeValue,D as rowVectorValue,t as stringValue,u as uomValue}from'./chunk-IO374J6Z.js';import'./chunk-WGZ3FNHI.js';import'./chunk-2JMFUQZH.js';import'./chunk-MPB7KUN5.js';var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};export{l as VMCheckpointer};//# sourceMappingURL=vm.js.map
1
+ export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-EOMHELRL.js';import'./chunk-KHCNMNZZ.js';export{v as OpRegistry,E as allocatePluginFunctionIndex,u as binaryOp,C as builtinFunctions,F as pluginFunctionIndexFor,D as pluginFunctionRegistry,w as sharedOpRegistry,j as unifyUom}from'./chunk-YTCTUBR2.js';import'./chunk-YAYBVVG2.js';import'./chunk-YNMMRH44.js';import'./chunk-HFKDWQUL.js';import'./chunk-WTEXBPBR.js';export{m as Value,g as ValueType,s as bigIntValue,c as chargeAllocation,d as checkAllocation,e as checkedArray,E as colVectorValue,r as hexValue,C as matrixValue,n as numberValue,F as rangeValue,D as rowVectorValue,t as stringValue,u as uomValue}from'./chunk-A33K7NY4.js';import'./chunk-DLAKPF5T.js';import'./chunk-44EOEWGP.js';import'./chunk-MPB7KUN5.js';var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};export{l as VMCheckpointer};//# sourceMappingURL=vm.js.map
2
2
  //# sourceMappingURL=vm.js.map
package/dist/worker.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var chunkP6WPEUAJ_cjs=require('./chunk-P6WPEUAJ.cjs'),chunkKSDTVFXA_cjs=require('./chunk-KSDTVFXA.cjs');require('./chunk-HOQU47MF.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-GKDZ7TSX.cjs'),require('./chunk-R7T3NGUE.cjs');var chunk3DD2RVBI_cjs=require('./chunk-3DD2RVBI.cjs');require('./chunk-R2SZFJTT.cjs');var chunkSOSUS2SK_cjs=require('./chunk-SOSUS2SK.cjs');require('./chunk-3AVWA5IZ.cjs'),require('./chunk-NXIMGB4S.cjs'),require('./chunk-4QVBSG6B.cjs'),require('./chunk-VAGS5JS7.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-Z5KBBQOJ.cjs'),require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs');var chunkESUN2THE_cjs=require('./chunk-ESUN2THE.cjs'),chunkZOOVGXMK_cjs=require('./chunk-ZOOVGXMK.cjs');require('./chunk-5FGOIDLS.cjs'),require('./chunk-IANAMBJQ.cjs'),require('./chunk-OVQ3V4CG.cjs'),require('./chunk-32GC2FHC.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-2LFLR3VZ.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-FWW3M36J.cjs'),require('./chunk-CIQOK7Q4.cjs');var chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');var x=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:r.config,packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},o=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,o],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=chunkP6WPEUAJ_cjs.e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(chunkP6WPEUAJ_cjs.e());if(t?.aborted)return Promise.reject(chunkP6WPEUAJ_cjs.d(r));let s=this.nextId++;return new Promise((o,l)=>{let c={resolve:o,reject:l};if(t){let p=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(chunkP6WPEUAJ_cjs.d(r)));};c.signal=t,c.onAbort=p,t.addEventListener("abort",p,{once:true});}this.pending.set(s,c),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(chunkP6WPEUAJ_cjs.c(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:chunkP6WPEUAJ_cjs.c(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function K(e){let r=new x(e.transport);return await r.init(e),r}function O(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function U(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?chunkZOOVGXMK_cjs.R(n):typeof n=="number"&&!Number.isFinite(n)?O(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:chunk3DD2RVBI_cjs.c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=O(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=U(s);else if(e.type===8){let o=s;t.range={min:o.min,max:o.max};}else if(e.type===14){let o=s;t.colour={hex:chunkESUN2THE_cjs.f(o),r:o.r,g:o.g,b:o.b,a:o.a,format:o.format,css:chunkESUN2THE_cjs.g(o)};}else if(e.type===16){let o=s;t.chart={kind:o.kind,points:o.points.map(l=>[l[0],l[1]]),label:o.label,domain:[o.domain[0],o.domain[1]],range:[o.range[0],o.range[1]],...o.expr!==void 0?{expr:o.expr}:{}};}return t}function C(e,r){return e?m(e,r):null}function _(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:C(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>_(n,r)),expression:e.expression,result:C(e.result,r),error:e.error}}function W(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function H(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let o=n.get(s);if(!o)throw chunkSOMGSIO4_cjs.c.config(chunkP6WPEUAJ_cjs.a.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(o);}return t}function B(e,r={}){let n=r.packages??chunkSOSUS2SK_cjs.y,t=null,s,o=new Map,l=new Map,c=null,p=null,g=i=>e.postMessage(i),h=(i,a)=>{g({kind:"error",id:i,error:chunkP6WPEUAJ_cjs.b(chunkSOMGSIO4_cjs.d(a))});},N=i=>{let a=new Map;return i.method==="parseDocument"?i.args[0].split(`
2
- `).forEach((u,d)=>a.set(d+1,u)):i.method==="evaluateLines"?i.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,i.args[0]),a},q=(i,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunkP6WPEUAJ_cjs.b(chunkSOMGSIO4_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let R=i.evaluateLine(d,f);R&&u.push({lineNumber:d,value:m(R,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},F=i=>{p?.();let a=i.getEventStream().getReader();p=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;q(i,d);}}catch{}})();},V=i=>{try{let a=H(n,i.packages);t=new chunkKSDTVFXA_cjs.n({locale:i.localeCode??"en",diagnostics:i.diagnostics??!1,config:i.config,packages:a}),s=i.formatting,F(t),g({kind:"ready",id:i.id});}catch(a){h(i.id,a);}},D=(i,a)=>{let{method:u,args:d}=a;switch(u){case "parseDocument":return W(i.parseDocument(d[0],d[1]),s);case "evaluateLines":return i.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(i.evaluateExpression(d[0]),s);default:throw chunkSOMGSIO4_cjs.c.execution(chunkP6WPEUAJ_cjs.a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},j=i=>{let a=t;if(!a){h(i.id,chunkSOMGSIO4_cjs.c.execution(chunkP6WPEUAJ_cjs.a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}c?.abort();let u=new AbortController;c=u,l=N(i),o.set(i.id,u),a.setKeystrokeSignal(u.signal);try{let d=D(a,i);g({kind:"result",id:i.id,value:d});}catch(d){h(i.id,d);}finally{o.delete(i.id),a.setKeystrokeSignal(null);}};return e.onMessage(i=>{let a=i;switch(a.kind){case "init":V(a);break;case "request":j(a);break;case "cancel":o.get(a.id)?.abort();break}}),()=>{p?.(),p=null,c?.abort(),c=null,l=new Map;for(let i of o.values())i.abort();o.clear(),t?.clear(),t=null,e.terminate();}}function G(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function J(){let e=null,r=null,n=true,t=(l,c)=>{let p=G(c);queueMicrotask(()=>{n&&l()?.(p);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function $(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function Q(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}exports.createLinkedTransports=J;exports.createWorkerEngine=K;exports.eventTargetTransport=$;exports.messagePortTransport=Q;exports.serializeParsedLine=y;exports.serializeParsingResult=W;exports.serializeValue=m;exports.startWorkerRuntime=B;//# sourceMappingURL=worker.cjs.map
1
+ 'use strict';var chunkP6WPEUAJ_cjs=require('./chunk-P6WPEUAJ.cjs'),chunkOZ6SKIPD_cjs=require('./chunk-OZ6SKIPD.cjs');require('./chunk-FNNIAJNY.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-TUBLMUTZ.cjs'),require('./chunk-MVP2YD4X.cjs');var chunk6TPXH6Y5_cjs=require('./chunk-6TPXH6Y5.cjs');require('./chunk-R2SZFJTT.cjs');var chunkU47GA63S_cjs=require('./chunk-U47GA63S.cjs');require('./chunk-FUDVKPB7.cjs'),require('./chunk-WYIOXAFW.cjs'),require('./chunk-4QVBSG6B.cjs'),require('./chunk-C65UDMWH.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-EURCQMZK.cjs'),require('./chunk-4BZIYU7S.cjs'),require('./chunk-VBSMA7WJ.cjs'),require('./chunk-TLG7VZRX.cjs');var chunk5TVI2UPZ_cjs=require('./chunk-5TVI2UPZ.cjs'),chunk75XDS65A_cjs=require('./chunk-75XDS65A.cjs');require('./chunk-PNDQRCRQ.cjs'),require('./chunk-BKSKZA4W.cjs'),require('./chunk-CIENDLKV.cjs'),require('./chunk-3HYO3QYW.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-SNVPM27Q.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-WEAKI5V5.cjs'),require('./chunk-6QRHN3I6.cjs');var chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');var W=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:r.config,packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},i=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,i],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=chunkP6WPEUAJ_cjs.e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(chunkP6WPEUAJ_cjs.e());if(t?.aborted)return Promise.reject(chunkP6WPEUAJ_cjs.d(r));let s=this.nextId++;return new Promise((i,l)=>{let p={resolve:i,reject:l};if(t){let c=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(chunkP6WPEUAJ_cjs.d(r)));};p.signal=t,p.onAbort=c,t.addEventListener("abort",c,{once:true});}this.pending.set(s,p),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(chunkP6WPEUAJ_cjs.c(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:chunkP6WPEUAJ_cjs.c(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function K(e){let r=new W(e.transport);return await r.init(e),r}function C(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function U(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?chunk75XDS65A_cjs.R(n):typeof n=="number"&&!Number.isFinite(n)?C(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:chunk6TPXH6Y5_cjs.c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=C(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=U(s);else if(e.type===8){let i=s;t.range={min:i.min,max:i.max};}else if(e.type===14){let i=s;t.colour={hex:chunk5TVI2UPZ_cjs.f(i),r:i.r,g:i.g,b:i.b,a:i.a,format:i.format,css:chunk5TVI2UPZ_cjs.g(i)};}else if(e.type===16){let i=s;t.chart={kind:i.kind,points:i.points.map(l=>[l[0],l[1]]),label:i.label,domain:[i.domain[0],i.domain[1]],range:[i.range[0],i.range[1]],...i.expr!==void 0?{expr:i.expr}:{}};}else if(e.type===17){let i=s;t.ipCidr={...i.addr!==void 0?{addr:i.addr}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},text:chunk6TPXH6Y5_cjs.c(e).replace(/^=\s*/,"")};}return t}function O(e,r){return e?m(e,r):null}function _(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:O(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>_(n,r)),expression:e.expression,result:O(e.result,r),error:e.error}}function R(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function H(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let i=n.get(s);if(!i)throw chunkSOMGSIO4_cjs.c.config(chunkP6WPEUAJ_cjs.a.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(i);}return t}function B(e,r={}){let n=r.packages??chunkU47GA63S_cjs.y,t=null,s,i=new Map,l=new Map,p=null,c=null,g=o=>e.postMessage(o),h=(o,a)=>{g({kind:"error",id:o,error:chunkP6WPEUAJ_cjs.b(chunkSOMGSIO4_cjs.d(a))});},N=o=>{let a=new Map;return o.method==="parseDocument"?o.args[0].split(`
2
+ `).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},q=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunkP6WPEUAJ_cjs.b(chunkSOMGSIO4_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let L=o.evaluateLine(d,f);L&&u.push({lineNumber:d,value:m(L,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},F=o=>{c?.();let a=o.getEventStream().getReader();c=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;q(o,d);}}catch{}})();},D=o=>{try{let a=H(n,o.packages);t=new chunkOZ6SKIPD_cjs.n({locale:o.localeCode??"en",diagnostics:o.diagnostics??!1,config:o.config,packages:a}),s=o.formatting,F(t),g({kind:"ready",id:o.id});}catch(a){h(o.id,a);}},V=(o,a)=>{let{method:u,args:d}=a;switch(u){case "parseDocument":return R(o.parseDocument(d[0],d[1]),s);case "evaluateLines":return o.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(o.evaluateExpression(d[0]),s);default:throw chunkSOMGSIO4_cjs.c.execution(chunkP6WPEUAJ_cjs.a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},j=o=>{let a=t;if(!a){h(o.id,chunkSOMGSIO4_cjs.c.execution(chunkP6WPEUAJ_cjs.a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}p?.abort();let u=new AbortController;p=u,l=N(o),i.set(o.id,u),a.setKeystrokeSignal(u.signal);try{let d=V(a,o);g({kind:"result",id:o.id,value:d});}catch(d){h(o.id,d);}finally{i.delete(o.id),a.setKeystrokeSignal(null);}};return e.onMessage(o=>{let a=o;switch(a.kind){case "init":D(a);break;case "request":j(a);break;case "cancel":i.get(a.id)?.abort();break}}),()=>{c?.(),c=null,p?.abort(),p=null,l=new Map;for(let o of i.values())o.abort();i.clear(),t?.clear(),t=null,e.terminate();}}function G(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function J(){let e=null,r=null,n=true,t=(l,p)=>{let c=G(p);queueMicrotask(()=>{n&&l()?.(c);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function $(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function Q(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}exports.createLinkedTransports=J;exports.createWorkerEngine=K;exports.eventTargetTransport=$;exports.messagePortTransport=Q;exports.serializeParsedLine=y;exports.serializeParsingResult=R;exports.serializeValue=m;exports.startWorkerRuntime=B;//# sourceMappingURL=worker.cjs.map
3
3
  //# sourceMappingURL=worker.cjs.map