solve-engine 2.28.0 → 2.30.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 (152) hide show
  1. package/dist/{EngineError-CA2tiVaI.d.cts → EngineError-CqGtaT_v.d.cts} +4 -0
  2. package/dist/{EngineError-CA2tiVaI.d.ts → EngineError-CqGtaT_v.d.ts} +4 -0
  3. package/dist/{Lexer-B62Hn9I-.d.ts → Lexer-CqFjYoRA.d.ts} +1 -1
  4. package/dist/{Lexer-DOXatsjO.d.cts → Lexer-sCI05tqO.d.cts} +1 -1
  5. package/dist/{PackageCompatibility-DW18LqED.d.cts → PackageCompatibility-Bn-T_xKW.d.cts} +1 -1
  6. package/dist/{PackageCompatibility-DT1IPlQx.d.ts → PackageCompatibility-phvSFP4f.d.ts} +1 -1
  7. package/dist/{PackageRegistry-CevYUzRn.d.cts → PackageRegistry-B-C1duZw.d.cts} +3 -3
  8. package/dist/{PackageRegistry-Dl9kNP14.d.ts → PackageRegistry-C78jVkI9.d.ts} +3 -3
  9. package/dist/{VMBuiltins-AIivGl0a.d.cts → VMBuiltins-BkKzhj6C.d.cts} +1 -1
  10. package/dist/{VMBuiltins-CbuFfIgQ.d.ts → VMBuiltins-Du9y8sEo.d.ts} +1 -1
  11. package/dist/{VMCheckpoints-BVrJwfZY.d.cts → VMCheckpoints-WdUQrdc9.d.cts} +1 -1
  12. package/dist/{VMCheckpoints-DFCl63K5.d.ts → VMCheckpoints-gvy_yxYh.d.ts} +1 -1
  13. package/dist/{WorkerError-DDtwl4oH.d.cts → WorkerError-CRoM8Ju1.d.cts} +1 -1
  14. package/dist/{WorkerError-BuO9MrRr.d.ts → WorkerError-DTrl3Jag.d.ts} +1 -1
  15. package/dist/{chunk-IEBWLNI5.js → chunk-2PGGPFF3.js} +2 -2
  16. package/dist/{chunk-IEBWLNI5.js.map → chunk-2PGGPFF3.js.map} +1 -1
  17. package/dist/{chunk-I6WGOM3C.js → chunk-3ZGFAE3Q.js} +2 -2
  18. package/dist/{chunk-I6WGOM3C.js.map → chunk-3ZGFAE3Q.js.map} +1 -1
  19. package/dist/{chunk-UMW5PO42.cjs → chunk-4DR5RBHQ.cjs} +2 -2
  20. package/dist/{chunk-UMW5PO42.cjs.map → chunk-4DR5RBHQ.cjs.map} +1 -1
  21. package/dist/{chunk-WXOJ3DS3.cjs → chunk-5AKT36UK.cjs} +2 -2
  22. package/dist/{chunk-WXOJ3DS3.cjs.map → chunk-5AKT36UK.cjs.map} +1 -1
  23. package/dist/{chunk-MKBB7IVN.cjs → chunk-7DJYS5PO.cjs} +2 -2
  24. package/dist/{chunk-MKBB7IVN.cjs.map → chunk-7DJYS5PO.cjs.map} +1 -1
  25. package/dist/{chunk-KYE5BWPN.cjs → chunk-A755LVPT.cjs} +2 -2
  26. package/dist/{chunk-KYE5BWPN.cjs.map → chunk-A755LVPT.cjs.map} +1 -1
  27. package/dist/{chunk-5J2XDCSV.cjs → chunk-A764BY7L.cjs} +2 -2
  28. package/dist/{chunk-5J2XDCSV.cjs.map → chunk-A764BY7L.cjs.map} +1 -1
  29. package/dist/{chunk-TTHCH7V2.cjs → chunk-AGCNMEP2.cjs} +2 -2
  30. package/dist/{chunk-TTHCH7V2.cjs.map → chunk-AGCNMEP2.cjs.map} +1 -1
  31. package/dist/{chunk-MONPHAHO.js → chunk-B2NL65FI.js} +2 -2
  32. package/dist/{chunk-MONPHAHO.js.map → chunk-B2NL65FI.js.map} +1 -1
  33. package/dist/{chunk-RRJ77SF6.js → chunk-CB3EXUM2.js} +2 -2
  34. package/dist/{chunk-RRJ77SF6.js.map → chunk-CB3EXUM2.js.map} +1 -1
  35. package/dist/{chunk-OKSAUK5C.js → chunk-CDE2ZUGG.js} +2 -2
  36. package/dist/{chunk-OKSAUK5C.js.map → chunk-CDE2ZUGG.js.map} +1 -1
  37. package/dist/{chunk-POIHAKBX.js → chunk-CIC2YO2M.js} +2 -2
  38. package/dist/{chunk-POIHAKBX.js.map → chunk-CIC2YO2M.js.map} +1 -1
  39. package/dist/{chunk-YLTNXYA7.cjs → chunk-CM2WM5CM.cjs} +2 -2
  40. package/dist/{chunk-YLTNXYA7.cjs.map → chunk-CM2WM5CM.cjs.map} +1 -1
  41. package/dist/{chunk-2YNRIT2L.cjs → chunk-DUFEONVN.cjs} +3 -3
  42. package/dist/{chunk-2YNRIT2L.cjs.map → chunk-DUFEONVN.cjs.map} +1 -1
  43. package/dist/{chunk-JHHSQ2YR.js → chunk-FNSQ6O4Y.js} +3 -3
  44. package/dist/{chunk-JHHSQ2YR.js.map → chunk-FNSQ6O4Y.js.map} +1 -1
  45. package/dist/{chunk-7ASISMXA.js → chunk-FXB5GCBT.js} +2 -2
  46. package/dist/{chunk-7ASISMXA.js.map → chunk-FXB5GCBT.js.map} +1 -1
  47. package/dist/{chunk-2RLNVS6G.js → chunk-G3POUURF.js} +2 -2
  48. package/dist/{chunk-2RLNVS6G.js.map → chunk-G3POUURF.js.map} +1 -1
  49. package/dist/{chunk-2G3AW6OQ.cjs → chunk-GWV273KZ.cjs} +2 -2
  50. package/dist/{chunk-2G3AW6OQ.cjs.map → chunk-GWV273KZ.cjs.map} +1 -1
  51. package/dist/{chunk-N22D5ZD4.js → chunk-IQVSCL2R.js} +3 -3
  52. package/dist/{chunk-N22D5ZD4.js.map → chunk-IQVSCL2R.js.map} +1 -1
  53. package/dist/{chunk-6T5HPIZX.js → chunk-KH4QXKLT.js} +2 -2
  54. package/dist/{chunk-6T5HPIZX.js.map → chunk-KH4QXKLT.js.map} +1 -1
  55. package/dist/{chunk-OLATJABN.js → chunk-LP3JYC3A.js} +2 -2
  56. package/dist/{chunk-OLATJABN.js.map → chunk-LP3JYC3A.js.map} +1 -1
  57. package/dist/{chunk-FSNBYRNA.cjs → chunk-NNRTDLGC.cjs} +3 -3
  58. package/dist/{chunk-FSNBYRNA.cjs.map → chunk-NNRTDLGC.cjs.map} +1 -1
  59. package/dist/{chunk-APU5LON7.js → chunk-NOZKHMML.js} +3 -3
  60. package/dist/{chunk-APU5LON7.js.map → chunk-NOZKHMML.js.map} +1 -1
  61. package/dist/{chunk-A7RRWNLE.js → chunk-NQFCXLEF.js} +2 -2
  62. package/dist/{chunk-A7RRWNLE.js.map → chunk-NQFCXLEF.js.map} +1 -1
  63. package/dist/{chunk-O5ZLOZPH.cjs → chunk-OM7NOHJF.cjs} +2 -2
  64. package/dist/{chunk-O5ZLOZPH.cjs.map → chunk-OM7NOHJF.cjs.map} +1 -1
  65. package/dist/{chunk-QXGKONTZ.cjs → chunk-P43SV4NJ.cjs} +3 -3
  66. package/dist/{chunk-QXGKONTZ.cjs.map → chunk-P43SV4NJ.cjs.map} +1 -1
  67. package/dist/{chunk-IIBR4LVH.cjs → chunk-PNHTC3FM.cjs} +4 -4
  68. package/dist/{chunk-IIBR4LVH.cjs.map → chunk-PNHTC3FM.cjs.map} +1 -1
  69. package/dist/{chunk-DDVDRWCK.js → chunk-PTXUWGRR.js} +3 -3
  70. package/dist/{chunk-DDVDRWCK.js.map → chunk-PTXUWGRR.js.map} +1 -1
  71. package/dist/{chunk-GWEINEJG.cjs → chunk-Q7TBBV62.cjs} +2 -2
  72. package/dist/{chunk-GWEINEJG.cjs.map → chunk-Q7TBBV62.cjs.map} +1 -1
  73. package/dist/chunk-RAFOQ4T5.cjs +2 -0
  74. package/dist/{chunk-5NQE5JMU.cjs.map → chunk-RAFOQ4T5.cjs.map} +1 -1
  75. package/dist/{chunk-Z5DA5UXY.js → chunk-RELMEWY6.js} +2 -2
  76. package/dist/chunk-RELMEWY6.js.map +1 -0
  77. package/dist/{chunk-RVNW627Y.cjs → chunk-RHRAONDK.cjs} +2 -2
  78. package/dist/{chunk-RVNW627Y.cjs.map → chunk-RHRAONDK.cjs.map} +1 -1
  79. package/dist/{chunk-Z5VBXZ4A.js → chunk-SFM4XFGJ.js} +2 -2
  80. package/dist/{chunk-Z5VBXZ4A.js.map → chunk-SFM4XFGJ.js.map} +1 -1
  81. package/dist/{chunk-HTAT4MGN.cjs → chunk-SUAGBRQ7.cjs} +2 -2
  82. package/dist/chunk-SUAGBRQ7.cjs.map +1 -0
  83. package/dist/chunk-V7LXOTCU.js +3 -0
  84. package/dist/chunk-V7LXOTCU.js.map +1 -0
  85. package/dist/{chunk-7ZYYWSLT.js → chunk-VLX7ZVK4.js} +2 -2
  86. package/dist/{chunk-7ZYYWSLT.js.map → chunk-VLX7ZVK4.js.map} +1 -1
  87. package/dist/chunk-W7NN77PH.cjs +3 -0
  88. package/dist/chunk-W7NN77PH.cjs.map +1 -0
  89. package/dist/{chunk-W5BBKLNS.cjs → chunk-WQGHJAW2.cjs} +2 -2
  90. package/dist/{chunk-W5BBKLNS.cjs.map → chunk-WQGHJAW2.cjs.map} +1 -1
  91. package/dist/{chunk-U7CNADCJ.cjs → chunk-WU7SBKVU.cjs} +2 -2
  92. package/dist/{chunk-U7CNADCJ.cjs.map → chunk-WU7SBKVU.cjs.map} +1 -1
  93. package/dist/{chunk-LV7PJ2MU.js → chunk-X5K72MBV.js} +2 -2
  94. package/dist/{chunk-LV7PJ2MU.js.map → chunk-X5K72MBV.js.map} +1 -1
  95. package/dist/{chunk-IAL64FCP.js → chunk-YN5H54GM.js} +2 -2
  96. package/dist/{chunk-IAL64FCP.js.map → chunk-YN5H54GM.js.map} +1 -1
  97. package/dist/{chunk-UBKWHRFL.cjs → chunk-YWF6C2IO.cjs} +2 -2
  98. package/dist/{chunk-UBKWHRFL.cjs.map → chunk-YWF6C2IO.cjs.map} +1 -1
  99. package/dist/constants.cjs +1 -1
  100. package/dist/constants.js +1 -1
  101. package/dist/engine.cjs +1 -1
  102. package/dist/engine.d.cts +6 -6
  103. package/dist/engine.d.ts +6 -6
  104. package/dist/engine.js +1 -1
  105. package/dist/errors.cjs +1 -1
  106. package/dist/errors.d.cts +3 -3
  107. package/dist/errors.d.ts +3 -3
  108. package/dist/errors.js +1 -1
  109. package/dist/format.cjs +1 -1
  110. package/dist/format.js +1 -1
  111. package/dist/index.cjs +1 -1
  112. package/dist/index.d.cts +6 -6
  113. package/dist/index.d.ts +6 -6
  114. package/dist/index.js +1 -1
  115. package/dist/language.d.cts +5 -5
  116. package/dist/language.d.ts +5 -5
  117. package/dist/lexer.cjs +1 -1
  118. package/dist/lexer.d.cts +3 -3
  119. package/dist/lexer.d.ts +3 -3
  120. package/dist/lexer.js +1 -1
  121. package/dist/normalizer.cjs +1 -1
  122. package/dist/normalizer.js +1 -1
  123. package/dist/packages.cjs +1 -1
  124. package/dist/packages.d.cts +4 -4
  125. package/dist/packages.d.ts +4 -4
  126. package/dist/packages.js +1 -1
  127. package/dist/parser.cjs +1 -1
  128. package/dist/parser.js +1 -1
  129. package/dist/temporal.cjs +1 -1
  130. package/dist/temporal.js +1 -1
  131. package/dist/testing.cjs +2 -2
  132. package/dist/testing.d.cts +5 -5
  133. package/dist/testing.d.ts +5 -5
  134. package/dist/testing.js +1 -1
  135. package/dist/uom.cjs +1 -1
  136. package/dist/uom.js +1 -1
  137. package/dist/vm.cjs +1 -1
  138. package/dist/vm.d.cts +3 -3
  139. package/dist/vm.d.ts +3 -3
  140. package/dist/vm.js +1 -1
  141. package/dist/worker.cjs +2 -2
  142. package/dist/worker.d.cts +5 -5
  143. package/dist/worker.d.ts +5 -5
  144. package/dist/worker.js +1 -1
  145. package/package.json +1 -1
  146. package/dist/chunk-3LWK33TJ.js +0 -3
  147. package/dist/chunk-3LWK33TJ.js.map +0 -1
  148. package/dist/chunk-5NQE5JMU.cjs +0 -2
  149. package/dist/chunk-HTAT4MGN.cjs.map +0 -1
  150. package/dist/chunk-YIXCPLCN.cjs +0 -3
  151. package/dist/chunk-YIXCPLCN.cjs.map +0 -1
  152. package/dist/chunk-Z5DA5UXY.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import {a,d}from'./chunk-7ZYYWSLT.js';import {b as b$1}from'./chunk-A7RRWNLE.js';import {f,b as b$2}from'./chunk-J4K72CQN.js';import {a as a$1}from'./chunk-OLATJABN.js';import {c}from'./chunk-FAO6DQ74.js';import {c as c$1}from'./chunk-Z5DA5UXY.js';var C=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(67),e.emitIndex(1);}};var S=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(68),e.emitIndex(1);}};function R(r,t){let o=r.peek();if(!o||o.type!=="IDENT"&&o.type!=="UNIT")throw c$1.parsing("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown here, as in ${t}(x^2, x).`,{found:o?.type??"end of input"});return r.consume(),o.value}function A(r,t){r.emitOpcode(13),r.emitString(t);}function _(r,t,o){let e=new d(t.pluginIndexMap);r.parseExpression(a.Lowest,e),r.setBuilder(t);let n=e.build();if(n.hasAsync)throw c$1.parsing("SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS",`${o}'s expression must be synchronous (no weather/stocks/currency calls).`);return n}function g(r,t,o){let e=r.emitAnonymousBody([o],t);r.emitOpcode(159),r.emitIndex(e);}var k=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"solve"),i=t.match("EQUALS")?_(t,e,"solve"):null;t.consume("COMMA");let a=t.peek();if(!a||a.type!=="IDENT"&&a.type!=="UNIT")throw c$1.parsing("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown to solve for, as in solve(x^2-4=0, x).",{found:a?.type??"end of input"});t.consume(),g(e,n,a.value),i?g(e,i,a.value):(e.emitOpcode(10),e.emitNumber(0)),A(e,a.value),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(69),e.emitIndex(3);}};var b=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"der");t.consume("COMMA");let i=R(t,"der");g(e,n,i),A(e,i),t.match("COMMA")?t.parseExpression(a.Lowest,e):(e.emitOpcode(10),e.emitNumber(1)),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(70),e.emitIndex(3);}};var F=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"integral");t.consume("COMMA");let i=R(t,"integral");g(e,n,i),A(e,i),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(71),e.emitIndex(2);}};var w=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"taylor");t.consume("COMMA");let i=R(t,"taylor");g(e,n,i),A(e,i),t.consume("EQUALS"),t.parseExpression(a.Lowest,e),t.consume("COMMA"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(72),e.emitIndex(4);}};var Y=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=0;do t.parseExpression(a.Lowest,e),n++;while(t.match("COMMA"));t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(73),e.emitIndex(n);}};var v=class{constructor(){this.category="Symbolic";}parse(t,o,e){e.emitOpcode(10),e.emitNumber(Number(o.value)),e.emitOpcode(51),e.emitIndex(74),e.emitIndex(1);}};var U=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(75),e.emitIndex(1);}};var $=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(76),e.emitIndex(1);}};var z=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(77),e.emitIndex(1);}};var j=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(78),e.emitIndex(1);}};var G=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(79),e.emitIndex(1);}};function ne(r=75){return {name:"symbolic:imaginary-literal",priority:r,shape:[{types:["NUMBER"]},{types:["IDENT"],values:["i"]}],match(t,o){let e=t[o];if(!e||e.type!=="NUMBER")return null;let n=t[o+1];return !n||n.type!=="IDENT"||n.value!=="i"||n.offset!==e.offset+e.value.length||t[o+2]?.type==="LPAREN"?null:{consumed:2,replacement:[new a$1("IMAGINARY",c("IMAGINARY"),e.value,e.value,e.offset,0,e.line,e.col)],ruleName:"symbolic:imaginary-literal"}}}}var ie={expand:"EXPAND_FN",factor:"FACTOR_FN",solve:"SOLVE_FN",der:"DER_FN",derivative:"DER_FN",integral:"INTEGRAL_FN",taylor:"TAYLOR_FN",jacobian:"JACOBIAN_FN",conj:"CONJ_FN",re:"RE_FN",im:"IM_FN",cancel:"CANCEL_FN",apart:"APART_FN"};function ae(r=80){return {name:"symbolic:call",priority:r,shape:[{types:["IDENT"],values:Object.keys(ie)},{types:["LPAREN"]}],match(t,o){let e=t[o];if(!e||e.type!=="IDENT")return null;let n=ie[e.value.toLowerCase()];return !n||t[o+1]?.type!=="LPAREN"?null:{consumed:1,replacement:[new a$1(n,c(n),e.value,e.value,e.offset,0,e.line,e.col)],ruleName:"symbolic:call"}}}}var se=[{word:"expand",tokenType:"EXPAND_FN",builtinIndex:67,example:"expand((x+1)*(x+2))",expected:"x^2+3x+2",docPage:"expanding.md"},{word:"factor",tokenType:"FACTOR_FN",builtinIndex:68,example:"factor(x^2-4)",expected:"(x-2)*(x+2)",docPage:"factoring.md"},{word:"solve",tokenType:"SOLVE_FN",builtinIndex:69,example:"solve(x^2-4=0, x)",expected:"= [-2, 2]",docPage:"solving-equations.md"},{word:"der",tokenType:"DER_FN",builtinIndex:70,example:"der(x^3, x)",expected:"3x^2",docPage:"calculus.md"},{word:"integral",tokenType:"INTEGRAL_FN",builtinIndex:71,example:"integral(x^2, x)",expected:"1/3x^3",docPage:"calculus.md"},{word:"taylor",tokenType:"TAYLOR_FN",builtinIndex:72,example:"taylor(exp(x), x=0, 3)",expected:"1/6x^3+0.5x^2+x+1",docPage:"calculus.md"},{word:"jacobian",tokenType:"JACOBIAN_FN",builtinIndex:73,example:"jacobian(x*y, x+y)",expected:"= [y, x; 1, 1]",docPage:"calculus.md"},{word:"conj",tokenType:"CONJ_FN",builtinIndex:75,example:"conj(2+3i)",expected:"2-3i",docPage:"complex.md"},{word:"re",tokenType:"RE_FN",builtinIndex:76,example:"re(2+3i)",expected:"= 2",docPage:"complex.md"},{word:"im",tokenType:"IM_FN",builtinIndex:77,example:"im(2+3i)",expected:"= 3",docPage:"complex.md"},{word:"cancel",tokenType:"CANCEL_FN",builtinIndex:78,example:"cancel((x^2-1)/(x-1))",expected:"x+1",docPage:"cancelling-fractions.md"},{word:"apart",tokenType:"APART_FN",builtinIndex:79,example:"apart((3x+5)/(x^2-1))",expected:"4/(x-1)-1/(x+1)",docPage:"splitting-fractions.md"}],Ce={name:"solve-symbolic",normalizerRules:[ae(),ne()],prefixParselets:{EXPAND_FN:new C,FACTOR_FN:new S,SOLVE_FN:new k,DER_FN:new b,INTEGRAL_FN:new F,TAYLOR_FN:new w,JACOBIAN_FN:new Y,IMAGINARY:new v,CONJ_FN:new U,RE_FN:new $,IM_FN:new z,CANCEL_FN:new j,APART_FN:new G},tokenCategories:{EXPAND_FN:"keyword",FACTOR_FN:"keyword",SOLVE_FN:"keyword",DER_FN:"keyword",INTEGRAL_FN:"keyword",TAYLOR_FN:"keyword",JACOBIAN_FN:"keyword",IMAGINARY:"number",CONJ_FN:"keyword",RE_FN:"keyword",IM_FN:"keyword",CANCEL_FN:"keyword",APART_FN:"keyword"}},Se=new Set(se.map(r=>r.tokenType));function ke(r){return r.some(t=>Se.has(t.type))}var be=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function me(r,t){let o=r.trim();if(o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),!be.test(o))return null;let e=t.parseIso8601(o);return Number.isNaN(e)?null:e}var Fe=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function mr(r){let t=Fe.exec(r.trim());if(t===null||t[1]===void 0)return {grain:"date"};let o=t[2];if(o===void 0)return {grain:"datetime"};if(o==="Z")return {grain:"instant",zone:f(0)};let e=o[0]==="-"?-1:1,n=o.slice(1).replace(":",""),i=Number(n.slice(0,2))*60+Number(n.slice(2));return {grain:"instant",zone:f(e*i)}}function lr(r,t){let o=t.fields(r),e=N=>String(N).padStart(2,"0"),n=o.year,i=e(o.month0+1),a=e(o.day),m=e(o.hour),d=e(o.minute),f=e(o.second),l=t.utcOffsetMinutes(r),p=l>=0?"+":"-",y=Math.abs(l),u=e(Math.floor(y/60)),s=e(y%60);return `${n}-${i}-${a}T${m}:${d}:${f}${p}${u}:${s}`}var we=1e12;function dr(r){return Math.abs(r)>=we?r:r*1e3}var Ye=Date.UTC(2026,3,3),le,h,K=new Map;function ve(){return typeof Intl=="object"&&Intl!==null?Intl.DateTimeFormat:void 0}function de(){let r=ve();r!==le&&(le=r,h=void 0,K.clear());}function Ue(){if(de(),h!==void 0)return h;try{let r=new Intl.DateTimeFormat("ja-JP").resolvedOptions().locale;h=typeof r=="string"&&r.startsWith("ja");}catch{h=false;}return h}function ce(){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function")return null;try{let r=new Intl.DateTimeFormat().resolvedOptions().locale;return typeof r=="string"&&r.length>0?r:null}catch{return null}}function ue(r){de();let t=K.get(r);if(t!==void 0)return t;let o=$e(r);return K.set(r,o),o}function $e(r){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function"||!Ue())return null;try{if(typeof Intl.DateTimeFormat.supportedLocalesOf=="function"&&Intl.DateTimeFormat.supportedLocalesOf([r]).length===0)return null;let t=new Intl.DateTimeFormat(r,{calendar:"gregory",numberingSystem:"latn",timeZone:"UTC",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(Ye);if(!Array.isArray(t))return null;let o=t.filter(e=>e.type==="year"||e.type==="month"||e.type==="day").map(e=>e.type[0].toUpperCase()).join("");return o==="DMY"||o==="MDY"||o==="YMD"?o:null}catch{return null}}var M={DATE_INPUT_LOCALE_INVALID:"DATE_INPUT_LOCALE_INVALID",DATE_ORDER_MISMATCH:"DATE_ORDER_MISMATCH",DATE_NOT_A_CALENDAR_DAY:"DATE_NOT_A_CALENDAR_DAY"};function ze(r){if(typeof Intl!="object"||Intl===null||typeof Intl.getCanonicalLocales!="function")return true;try{return Intl.getCanonicalLocales(r),!0}catch{return false}}function Nr(r){let t=r.inputLocale;if(t!==void 0&&!ze(t))throw c$1.config(M.DATE_INPUT_LOCALE_INVALID,`date.inputLocale "${t}" is not a BCP-47 locale tag. Use a tag Intl accepts, for example "en-US".`,{inputLocale:t});let o=r.onAmbiguous,e=r.inputOrder;if(e==="DMY"||e==="MDY"||e==="YMD")return Object.freeze({order:e,orderSource:"config",onAmbiguous:o});if(e==="locale"){let n=t??ce();if(n!=null){let i=ue(n);if(i!==null)return Object.freeze({order:i,orderSource:t!==void 0?"locale":"host-locale",locale:n,onAmbiguous:o})}return Object.freeze({order:"auto",orderSource:"fallback",onAmbiguous:o})}return Object.freeze({order:"auto",orderSource:"separator",onAmbiguous:o})}var fe=["January","February","March","April","May","June","July","August","September","October","November","December"],X=/^\d{1,2}$/,Z=/^\d{4}$/;function je(r,t,o,e){let n=X.test(r),i=X.test(t),a=X.test(o);return e==="hyphen"&&Z.test(r)&&i&&a?"iso":n&&i&&Z.test(o)?"year-last-4":e==="slash"&&Z.test(r)&&i&&a?"year-first-4":n&&i&&a?"short":"none"}function Ge(r){if(r.length===4)return Number(r);if(r.length===2){let t=Number(r);return t<=68?2e3+t:1900+t}return null}function O(r,t,o){return t<1||t>12||r<1?false:r<=b$2(o,t-1)}function ye(r,t,o){return t<1||t>12?`there is no month ${t}`:r<1?`there is no day ${r}`:`${fe[t-1]} ${o} has ${b$2(o,t-1)} days`}function P(r,t,o){return `${r} ${fe[t-1]} ${o}`}function Q(r,t,o){let e=n=>String(n).padStart(2,"0");return `${String(o).padStart(4,"0")}-${e(t)}-${e(r)}`}function V(r,t,o){return r==="DMY"?{day:Number(t),month:Number(o)}:{day:Number(o),month:Number(t)}}function D(r){return r==="DMY"?"day first":r==="MDY"?"month first":"year first"}function Ve(r){return r==="hyphen"?"MDY":"DMY"}function ee(r,t,o,e){let[n,i,a]=r.groups,m=je(n,i,a,r.separator),d=r.separator!=="dot",f=o==="refuse"||!d;if(m==="none")return {kind:"arithmetic"};if(m==="iso"){let T=Number(n),x=Number(i),I=Number(a);return O(I,x,T)?{kind:"date",day:I,month:x,year:T,order:"ISO",shortYear:false}:f?q(r.text,I,x,T):{kind:"arithmetic"}}if(m==="year-first-4"){if(t!=="YMD")return {kind:"arithmetic"};let T=Number(n),x=Number(i),I=Number(a);return O(I,x,T)?{kind:"date",day:I,month:x,year:T,order:"YMD",shortYear:false}:{kind:"arithmetic"}}let l=Ge(a);if(l===null)return {kind:"arithmetic"};let p=a.length===2;if(t==="YMD")return !f||m==="short"&&d?{kind:"arithmetic"}:He(r.text,n,i,l);let y=t==="auto"?Ve(r.separator):t,u=y==="DMY"?"MDY":"DMY",s=V(y,n,i),N=V(u,n,i);if(O(s.day,s.month,l)){let x=(N.day!==s.day||N.month!==s.month)&&O(N.day,N.month,l)?Q(N.day,N.month,l):void 0;return {kind:"date",day:s.day,month:s.month,year:l,order:y,shortYear:p,alternative:x}}return !f||m==="short"&&d?{kind:"arithmetic"}:O(N.day,N.month,l)?{kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`"${r.text}" is not a date read ${D(y)}: ${ye(s.day,s.month,l)}. Read ${D(u)} it is ${P(N.day,N.month,l)}. Set date.inputOrder to "${u}" to read numeric dates ${D(u)}.`}:q(r.text,s.day,s.month,l)}function q(r,t,o,e){return {kind:"refuse",code:M.DATE_NOT_A_CALENDAR_DAY,message:`"${r}" is not a real date: ${ye(t,o,e)}.`}}function He(r,t,o,e,n){let i=V("DMY",t,o),a=V("MDY",t,o),m=O(i.day,i.month,e),d=O(a.day,a.month,e);if(!m&&!d)return q(r,i.day,i.month,e);let f=`"${r}" is not a date read year first.`,l=i.day===a.day&&i.month===a.month;if(m&&d&&!l)return {kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`${f} Read day first it is ${P(i.day,i.month,e)} and month first ${P(a.day,a.month,e)}. Write it as ${Q(i.day,i.month,e)}, or set date.inputOrder to "DMY" or "MDY".`};let p=m?i:a,y=m?"DMY":"MDY";return {kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`${f} Read ${D(y)} it is ${P(p.day,p.month,e)}. Write it as ${Q(p.day,p.month,e)}, or set date.inputOrder to "${y}".`}}function Je(r,t){if(r.orderSource==="iso")return "ISO";if(r.orderSource==="spelled")return "with the month spelled out";let o=r.order===null||r.order==="ISO"||r.order==="spelled"?"as written":D(r.order);switch(r.orderSource){case "config":return `${o}, from date.inputOrder`;case "locale":return `${o}, from the locale ${r.locale}`;case "host-locale":return `${o}, from the host locale ${r.locale}`;case "fallback":return `${o}, the default for a ${t} date, because the host locale could not be read`;default:return `${o}, the default for a ${t} date`}}function pe(r){let[t,o,e]=r.split("-").map(Number);return P(e,o,t)}function We(r,t,o){if(r.iso===null)return o??`"${r.text}" is not a date this engine can read.`;let e=`${r.text} read as ${pe(r.iso)}, ${Je(r,t)}.`;if(r.alternative!==void 0&&r.order!==null&&r.order!=="ISO"&&r.order!=="spelled"){let n=r.order==="DMY"?"Month first":"Day first";e+=` ${n} would be ${pe(r.alternative)}.`;}return r.shortYear&&(e+=` The two-digit year ${r.text.slice(-2)} was read as ${r.iso.slice(0,4)}.`),e}function Ir(r,t,o){return {...r,note:We(r,t,o),needsNote:r.contested||r.shortYear||r.iso===null}}function xr(r){let t=/^(\d+)([/-])(\d+)\2(\d+)$/.exec(r);if(t!==null)return {text:r,groups:[t[1],t[3],t[4]],separator:t[2]==="-"?"hyphen":"slash"};let o=/^(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4})$/.exec(r);return o!==null?{text:r,groups:[o[1],o[2],o[3]],separator:"dot"}:null}var te="DATETIME_LITERAL",xe=c(te),Te="DATETIME_LITERAL_UNREADABLE",Ke=c(Te),H=/^\d+$/,Xe=/^\d{1,2}\.\d{1,2}$/,Ze=/^\.(\d{2}|\d{4})$/;function Qe(r){for(let t=0;t<r.length-1;t++){let o=r[t];if((o.sourceEnd??o.offset+o.text.length)!==r[t+1].offset)return false}return true}function Ne(r,t,o,e,n,i){if(t<1||t>12||r<1||r>31)return null;let a=i.localMidnight(o,t-1,r),m=i.fields(a);if(m.year!==o||m.month0!==t-1||m.day!==r)return null;let d=e[0],f=e.map(p=>p.value).join(""),l=new a$1(te,xe,String(a),f,d.offset,0,d.line,d.col);return {consumed:e.length,replacement:[l],ruleName:n}}function qe(r){let t="",o=-1;for(let e of r){let n=e.text??e.value;o>=0&&e.offset>o&&(t+=" "),t+=n,o=e.sourceEnd??e.offset+n.length;}return t}function Ie(r,t,o,e){let n=o[0],i=qe(o),a=new a$1(Te,Ke,i,i,n.offset,0,n.line,n.col);return a.fault={code:r,message:t},{consumed:o.length,replacement:[a],ruleName:e}}var et=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?/,tt=new Set(["NUMBER","MINUS","PLUS","COLON","IDENT"]),rt=16;function ot(r,t,o,e){let n=r[t];if(n.sourceEnd!==void 0)return null;let i=n.text,a=n.offset+n.text.length,m=[n];for(let u=t+1;u<r.length&&m.length<rt;u++){let s=r[u];if(s.sourceEnd!==void 0||s.offset!==a||!tt.has(s.type))break;i+=s.text,a=s.offset+s.text.length,m.push(s);}let d=et.exec(i);if(d===null)return null;let f=0,l=0;for(let u of m)if(l+=u.text.length,f++,l>=d[0].length)break;if(l!==d[0].length)return null;let p=me(d[0],e);if(p===null)return null;let y=new a$1(te,xe,String(p),d[0],n.offset,0,n.line,n.col,n.offset+d[0].length);return {consumed:f,replacement:[y],ruleName:o}}function Br(r=()=>"auto",t=()=>b$1,o=()=>"refuse"){return {name:"datetime:date-literal",priority:70,shape:[{types:["NUMBER"]}],match(e,n){let i=e[n];if(i.type!=="NUMBER")return null;let a=t();if(Xe.test(i.value)){let s=e[n+1];if(s&&s.type==="NUMBER"&&Ze.test(s.value)){let[N,T]=i.value.split("."),x={text:`${i.value}${s.value}`,groups:[N,T,s.value.slice(1)],separator:"dot"},I=ee(x,r(),o());if(I.kind==="date")return Ne(I.day,I.month,I.year,[i,s],"datetime:date-literal:dot",a);if(I.kind==="refuse")return Ie(I.code,I.message,[i,s],"datetime:date-literal:dot:unreadable")}return null}if(i.value.length===4&&H.test(i.value)){let s=ot(e,n,"datetime:date-literal:iso-timestamp",a);if(s)return s}if(!H.test(i.value))return null;let m=e[n+1];if(!m||m.type!=="SLASH"&&m.type!=="MINUS")return null;let d=e[n+2],f=e[n+3],l=e[n+4];if(!d||d.type!=="NUMBER"||!H.test(d.value)||!f||f.type!==m.type||!l||l.type!=="NUMBER"||!H.test(l.value))return null;let p=[i,m,d,f,l];if(!Qe(p))return null;let y={text:p.map(s=>s.value).join(""),groups:[i.value,d.value,l.value],separator:m.type==="MINUS"?"hyphen":"slash"},u=ee(y,r(),o());return u.kind==="arithmetic"?null:u.kind==="refuse"?Ie(u.code,u.message,p,"datetime:date-literal:unreadable"):Ne(u.day,u.month,u.year,p,`datetime:date-literal:${u.order.toLowerCase()}`,a)}}}export{Ce as a,ke as b,me as c,mr as d,lr as e,dr as f,M as g,Nr as h,je as i,ye as j,Q as k,ee as l,Ir as m,xr as n,te as o,Te as p,Ne as q,qe as r,Ie as s,Br as t};//# sourceMappingURL=chunk-7ASISMXA.js.map
2
- //# sourceMappingURL=chunk-7ASISMXA.js.map
1
+ import {a,d}from'./chunk-VLX7ZVK4.js';import {b as b$1}from'./chunk-NQFCXLEF.js';import {f,b as b$2}from'./chunk-J4K72CQN.js';import {a as a$1}from'./chunk-LP3JYC3A.js';import {c}from'./chunk-FAO6DQ74.js';import {c as c$1}from'./chunk-RELMEWY6.js';var C=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(67),e.emitIndex(1);}};var S=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(68),e.emitIndex(1);}};function R(r,t){let o=r.peek();if(!o||o.type!=="IDENT"&&o.type!=="UNIT")throw c$1.parsing("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown here, as in ${t}(x^2, x).`,{found:o?.type??"end of input"});return r.consume(),o.value}function A(r,t){r.emitOpcode(13),r.emitString(t);}function _(r,t,o){let e=new d(t.pluginIndexMap);r.parseExpression(a.Lowest,e),r.setBuilder(t);let n=e.build();if(n.hasAsync)throw c$1.parsing("SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS",`${o}'s expression must be synchronous (no weather/stocks/currency calls).`);return n}function g(r,t,o){let e=r.emitAnonymousBody([o],t);r.emitOpcode(159),r.emitIndex(e);}var k=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"solve"),i=t.match("EQUALS")?_(t,e,"solve"):null;t.consume("COMMA");let a=t.peek();if(!a||a.type!=="IDENT"&&a.type!=="UNIT")throw c$1.parsing("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown to solve for, as in solve(x^2-4=0, x).",{found:a?.type??"end of input"});t.consume(),g(e,n,a.value),i?g(e,i,a.value):(e.emitOpcode(10),e.emitNumber(0)),A(e,a.value),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(69),e.emitIndex(3);}};var b=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"der");t.consume("COMMA");let i=R(t,"der");g(e,n,i),A(e,i),t.match("COMMA")?t.parseExpression(a.Lowest,e):(e.emitOpcode(10),e.emitNumber(1)),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(70),e.emitIndex(3);}};var F=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"integral");t.consume("COMMA");let i=R(t,"integral");g(e,n,i),A(e,i),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(71),e.emitIndex(2);}};var w=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=_(t,e,"taylor");t.consume("COMMA");let i=R(t,"taylor");g(e,n,i),A(e,i),t.consume("EQUALS"),t.parseExpression(a.Lowest,e),t.consume("COMMA"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(72),e.emitIndex(4);}};var Y=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN");let n=0;do t.parseExpression(a.Lowest,e),n++;while(t.match("COMMA"));t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(73),e.emitIndex(n);}};var v=class{constructor(){this.category="Symbolic";}parse(t,o,e){e.emitOpcode(10),e.emitNumber(Number(o.value)),e.emitOpcode(51),e.emitIndex(74),e.emitIndex(1);}};var U=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(75),e.emitIndex(1);}};var $=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(76),e.emitIndex(1);}};var z=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(77),e.emitIndex(1);}};var j=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(78),e.emitIndex(1);}};var G=class{constructor(){this.category="Symbolic";}parse(t,o,e){t.consume("LPAREN"),t.parseExpression(a.Lowest,e),t.consume("RPAREN"),e.emitOpcode(51),e.emitIndex(79),e.emitIndex(1);}};function ne(r=75){return {name:"symbolic:imaginary-literal",priority:r,shape:[{types:["NUMBER"]},{types:["IDENT"],values:["i"]}],match(t,o){let e=t[o];if(!e||e.type!=="NUMBER")return null;let n=t[o+1];return !n||n.type!=="IDENT"||n.value!=="i"||n.offset!==e.offset+e.value.length||t[o+2]?.type==="LPAREN"?null:{consumed:2,replacement:[new a$1("IMAGINARY",c("IMAGINARY"),e.value,e.value,e.offset,0,e.line,e.col)],ruleName:"symbolic:imaginary-literal"}}}}var ie={expand:"EXPAND_FN",factor:"FACTOR_FN",solve:"SOLVE_FN",der:"DER_FN",derivative:"DER_FN",integral:"INTEGRAL_FN",taylor:"TAYLOR_FN",jacobian:"JACOBIAN_FN",conj:"CONJ_FN",re:"RE_FN",im:"IM_FN",cancel:"CANCEL_FN",apart:"APART_FN"};function ae(r=80){return {name:"symbolic:call",priority:r,shape:[{types:["IDENT"],values:Object.keys(ie)},{types:["LPAREN"]}],match(t,o){let e=t[o];if(!e||e.type!=="IDENT")return null;let n=ie[e.value.toLowerCase()];return !n||t[o+1]?.type!=="LPAREN"?null:{consumed:1,replacement:[new a$1(n,c(n),e.value,e.value,e.offset,0,e.line,e.col)],ruleName:"symbolic:call"}}}}var se=[{word:"expand",tokenType:"EXPAND_FN",builtinIndex:67,example:"expand((x+1)*(x+2))",expected:"x^2+3x+2",docPage:"expanding.md"},{word:"factor",tokenType:"FACTOR_FN",builtinIndex:68,example:"factor(x^2-4)",expected:"(x-2)*(x+2)",docPage:"factoring.md"},{word:"solve",tokenType:"SOLVE_FN",builtinIndex:69,example:"solve(x^2-4=0, x)",expected:"= [-2, 2]",docPage:"solving-equations.md"},{word:"der",tokenType:"DER_FN",builtinIndex:70,example:"der(x^3, x)",expected:"3x^2",docPage:"calculus.md"},{word:"integral",tokenType:"INTEGRAL_FN",builtinIndex:71,example:"integral(x^2, x)",expected:"1/3x^3",docPage:"calculus.md"},{word:"taylor",tokenType:"TAYLOR_FN",builtinIndex:72,example:"taylor(exp(x), x=0, 3)",expected:"1/6x^3+0.5x^2+x+1",docPage:"calculus.md"},{word:"jacobian",tokenType:"JACOBIAN_FN",builtinIndex:73,example:"jacobian(x*y, x+y)",expected:"= [y, x; 1, 1]",docPage:"calculus.md"},{word:"conj",tokenType:"CONJ_FN",builtinIndex:75,example:"conj(2+3i)",expected:"2-3i",docPage:"complex.md"},{word:"re",tokenType:"RE_FN",builtinIndex:76,example:"re(2+3i)",expected:"= 2",docPage:"complex.md"},{word:"im",tokenType:"IM_FN",builtinIndex:77,example:"im(2+3i)",expected:"= 3",docPage:"complex.md"},{word:"cancel",tokenType:"CANCEL_FN",builtinIndex:78,example:"cancel((x^2-1)/(x-1))",expected:"x+1",docPage:"cancelling-fractions.md"},{word:"apart",tokenType:"APART_FN",builtinIndex:79,example:"apart((3x+5)/(x^2-1))",expected:"4/(x-1)-1/(x+1)",docPage:"splitting-fractions.md"}],Ce={name:"solve-symbolic",normalizerRules:[ae(),ne()],prefixParselets:{EXPAND_FN:new C,FACTOR_FN:new S,SOLVE_FN:new k,DER_FN:new b,INTEGRAL_FN:new F,TAYLOR_FN:new w,JACOBIAN_FN:new Y,IMAGINARY:new v,CONJ_FN:new U,RE_FN:new $,IM_FN:new z,CANCEL_FN:new j,APART_FN:new G},tokenCategories:{EXPAND_FN:"keyword",FACTOR_FN:"keyword",SOLVE_FN:"keyword",DER_FN:"keyword",INTEGRAL_FN:"keyword",TAYLOR_FN:"keyword",JACOBIAN_FN:"keyword",IMAGINARY:"number",CONJ_FN:"keyword",RE_FN:"keyword",IM_FN:"keyword",CANCEL_FN:"keyword",APART_FN:"keyword"}},Se=new Set(se.map(r=>r.tokenType));function ke(r){return r.some(t=>Se.has(t.type))}var be=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function me(r,t){let o=r.trim();if(o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),!be.test(o))return null;let e=t.parseIso8601(o);return Number.isNaN(e)?null:e}var Fe=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function mr(r){let t=Fe.exec(r.trim());if(t===null||t[1]===void 0)return {grain:"date"};let o=t[2];if(o===void 0)return {grain:"datetime"};if(o==="Z")return {grain:"instant",zone:f(0)};let e=o[0]==="-"?-1:1,n=o.slice(1).replace(":",""),i=Number(n.slice(0,2))*60+Number(n.slice(2));return {grain:"instant",zone:f(e*i)}}function lr(r,t){let o=t.fields(r),e=N=>String(N).padStart(2,"0"),n=o.year,i=e(o.month0+1),a=e(o.day),m=e(o.hour),d=e(o.minute),f=e(o.second),l=t.utcOffsetMinutes(r),p=l>=0?"+":"-",y=Math.abs(l),u=e(Math.floor(y/60)),s=e(y%60);return `${n}-${i}-${a}T${m}:${d}:${f}${p}${u}:${s}`}var we=1e12;function dr(r){return Math.abs(r)>=we?r:r*1e3}var Ye=Date.UTC(2026,3,3),le,h,K=new Map;function ve(){return typeof Intl=="object"&&Intl!==null?Intl.DateTimeFormat:void 0}function de(){let r=ve();r!==le&&(le=r,h=void 0,K.clear());}function Ue(){if(de(),h!==void 0)return h;try{let r=new Intl.DateTimeFormat("ja-JP").resolvedOptions().locale;h=typeof r=="string"&&r.startsWith("ja");}catch{h=false;}return h}function ce(){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function")return null;try{let r=new Intl.DateTimeFormat().resolvedOptions().locale;return typeof r=="string"&&r.length>0?r:null}catch{return null}}function ue(r){de();let t=K.get(r);if(t!==void 0)return t;let o=$e(r);return K.set(r,o),o}function $e(r){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function"||!Ue())return null;try{if(typeof Intl.DateTimeFormat.supportedLocalesOf=="function"&&Intl.DateTimeFormat.supportedLocalesOf([r]).length===0)return null;let t=new Intl.DateTimeFormat(r,{calendar:"gregory",numberingSystem:"latn",timeZone:"UTC",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(Ye);if(!Array.isArray(t))return null;let o=t.filter(e=>e.type==="year"||e.type==="month"||e.type==="day").map(e=>e.type[0].toUpperCase()).join("");return o==="DMY"||o==="MDY"||o==="YMD"?o:null}catch{return null}}var M={DATE_INPUT_LOCALE_INVALID:"DATE_INPUT_LOCALE_INVALID",DATE_ORDER_MISMATCH:"DATE_ORDER_MISMATCH",DATE_NOT_A_CALENDAR_DAY:"DATE_NOT_A_CALENDAR_DAY"};function ze(r){if(typeof Intl!="object"||Intl===null||typeof Intl.getCanonicalLocales!="function")return true;try{return Intl.getCanonicalLocales(r),!0}catch{return false}}function Nr(r){let t=r.inputLocale;if(t!==void 0&&!ze(t))throw c$1.config(M.DATE_INPUT_LOCALE_INVALID,`date.inputLocale "${t}" is not a BCP-47 locale tag. Use a tag Intl accepts, for example "en-US".`,{inputLocale:t});let o=r.onAmbiguous,e=r.inputOrder;if(e==="DMY"||e==="MDY"||e==="YMD")return Object.freeze({order:e,orderSource:"config",onAmbiguous:o});if(e==="locale"){let n=t??ce();if(n!=null){let i=ue(n);if(i!==null)return Object.freeze({order:i,orderSource:t!==void 0?"locale":"host-locale",locale:n,onAmbiguous:o})}return Object.freeze({order:"auto",orderSource:"fallback",onAmbiguous:o})}return Object.freeze({order:"auto",orderSource:"separator",onAmbiguous:o})}var fe=["January","February","March","April","May","June","July","August","September","October","November","December"],X=/^\d{1,2}$/,Z=/^\d{4}$/;function je(r,t,o,e){let n=X.test(r),i=X.test(t),a=X.test(o);return e==="hyphen"&&Z.test(r)&&i&&a?"iso":n&&i&&Z.test(o)?"year-last-4":e==="slash"&&Z.test(r)&&i&&a?"year-first-4":n&&i&&a?"short":"none"}function Ge(r){if(r.length===4)return Number(r);if(r.length===2){let t=Number(r);return t<=68?2e3+t:1900+t}return null}function O(r,t,o){return t<1||t>12||r<1?false:r<=b$2(o,t-1)}function ye(r,t,o){return t<1||t>12?`there is no month ${t}`:r<1?`there is no day ${r}`:`${fe[t-1]} ${o} has ${b$2(o,t-1)} days`}function P(r,t,o){return `${r} ${fe[t-1]} ${o}`}function Q(r,t,o){let e=n=>String(n).padStart(2,"0");return `${String(o).padStart(4,"0")}-${e(t)}-${e(r)}`}function V(r,t,o){return r==="DMY"?{day:Number(t),month:Number(o)}:{day:Number(o),month:Number(t)}}function D(r){return r==="DMY"?"day first":r==="MDY"?"month first":"year first"}function Ve(r){return r==="hyphen"?"MDY":"DMY"}function ee(r,t,o,e){let[n,i,a]=r.groups,m=je(n,i,a,r.separator),d=r.separator!=="dot",f=o==="refuse"||!d;if(m==="none")return {kind:"arithmetic"};if(m==="iso"){let T=Number(n),x=Number(i),I=Number(a);return O(I,x,T)?{kind:"date",day:I,month:x,year:T,order:"ISO",shortYear:false}:f?q(r.text,I,x,T):{kind:"arithmetic"}}if(m==="year-first-4"){if(t!=="YMD")return {kind:"arithmetic"};let T=Number(n),x=Number(i),I=Number(a);return O(I,x,T)?{kind:"date",day:I,month:x,year:T,order:"YMD",shortYear:false}:{kind:"arithmetic"}}let l=Ge(a);if(l===null)return {kind:"arithmetic"};let p=a.length===2;if(t==="YMD")return !f||m==="short"&&d?{kind:"arithmetic"}:He(r.text,n,i,l);let y=t==="auto"?Ve(r.separator):t,u=y==="DMY"?"MDY":"DMY",s=V(y,n,i),N=V(u,n,i);if(O(s.day,s.month,l)){let x=(N.day!==s.day||N.month!==s.month)&&O(N.day,N.month,l)?Q(N.day,N.month,l):void 0;return {kind:"date",day:s.day,month:s.month,year:l,order:y,shortYear:p,alternative:x}}return !f||m==="short"&&d?{kind:"arithmetic"}:O(N.day,N.month,l)?{kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`"${r.text}" is not a date read ${D(y)}: ${ye(s.day,s.month,l)}. Read ${D(u)} it is ${P(N.day,N.month,l)}. Set date.inputOrder to "${u}" to read numeric dates ${D(u)}.`}:q(r.text,s.day,s.month,l)}function q(r,t,o,e){return {kind:"refuse",code:M.DATE_NOT_A_CALENDAR_DAY,message:`"${r}" is not a real date: ${ye(t,o,e)}.`}}function He(r,t,o,e,n){let i=V("DMY",t,o),a=V("MDY",t,o),m=O(i.day,i.month,e),d=O(a.day,a.month,e);if(!m&&!d)return q(r,i.day,i.month,e);let f=`"${r}" is not a date read year first.`,l=i.day===a.day&&i.month===a.month;if(m&&d&&!l)return {kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`${f} Read day first it is ${P(i.day,i.month,e)} and month first ${P(a.day,a.month,e)}. Write it as ${Q(i.day,i.month,e)}, or set date.inputOrder to "DMY" or "MDY".`};let p=m?i:a,y=m?"DMY":"MDY";return {kind:"refuse",code:M.DATE_ORDER_MISMATCH,message:`${f} Read ${D(y)} it is ${P(p.day,p.month,e)}. Write it as ${Q(p.day,p.month,e)}, or set date.inputOrder to "${y}".`}}function Je(r,t){if(r.orderSource==="iso")return "ISO";if(r.orderSource==="spelled")return "with the month spelled out";let o=r.order===null||r.order==="ISO"||r.order==="spelled"?"as written":D(r.order);switch(r.orderSource){case "config":return `${o}, from date.inputOrder`;case "locale":return `${o}, from the locale ${r.locale}`;case "host-locale":return `${o}, from the host locale ${r.locale}`;case "fallback":return `${o}, the default for a ${t} date, because the host locale could not be read`;default:return `${o}, the default for a ${t} date`}}function pe(r){let[t,o,e]=r.split("-").map(Number);return P(e,o,t)}function We(r,t,o){if(r.iso===null)return o??`"${r.text}" is not a date this engine can read.`;let e=`${r.text} read as ${pe(r.iso)}, ${Je(r,t)}.`;if(r.alternative!==void 0&&r.order!==null&&r.order!=="ISO"&&r.order!=="spelled"){let n=r.order==="DMY"?"Month first":"Day first";e+=` ${n} would be ${pe(r.alternative)}.`;}return r.shortYear&&(e+=` The two-digit year ${r.text.slice(-2)} was read as ${r.iso.slice(0,4)}.`),e}function Ir(r,t,o){return {...r,note:We(r,t,o),needsNote:r.contested||r.shortYear||r.iso===null}}function xr(r){let t=/^(\d+)([/-])(\d+)\2(\d+)$/.exec(r);if(t!==null)return {text:r,groups:[t[1],t[3],t[4]],separator:t[2]==="-"?"hyphen":"slash"};let o=/^(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4})$/.exec(r);return o!==null?{text:r,groups:[o[1],o[2],o[3]],separator:"dot"}:null}var te="DATETIME_LITERAL",xe=c(te),Te="DATETIME_LITERAL_UNREADABLE",Ke=c(Te),H=/^\d+$/,Xe=/^\d{1,2}\.\d{1,2}$/,Ze=/^\.(\d{2}|\d{4})$/;function Qe(r){for(let t=0;t<r.length-1;t++){let o=r[t];if((o.sourceEnd??o.offset+o.text.length)!==r[t+1].offset)return false}return true}function Ne(r,t,o,e,n,i){if(t<1||t>12||r<1||r>31)return null;let a=i.localMidnight(o,t-1,r),m=i.fields(a);if(m.year!==o||m.month0!==t-1||m.day!==r)return null;let d=e[0],f=e.map(p=>p.value).join(""),l=new a$1(te,xe,String(a),f,d.offset,0,d.line,d.col);return {consumed:e.length,replacement:[l],ruleName:n}}function qe(r){let t="",o=-1;for(let e of r){let n=e.text??e.value;o>=0&&e.offset>o&&(t+=" "),t+=n,o=e.sourceEnd??e.offset+n.length;}return t}function Ie(r,t,o,e){let n=o[0],i=qe(o),a=new a$1(Te,Ke,i,i,n.offset,0,n.line,n.col);return a.fault={code:r,message:t},{consumed:o.length,replacement:[a],ruleName:e}}var et=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?/,tt=new Set(["NUMBER","MINUS","PLUS","COLON","IDENT"]),rt=16;function ot(r,t,o,e){let n=r[t];if(n.sourceEnd!==void 0)return null;let i=n.text,a=n.offset+n.text.length,m=[n];for(let u=t+1;u<r.length&&m.length<rt;u++){let s=r[u];if(s.sourceEnd!==void 0||s.offset!==a||!tt.has(s.type))break;i+=s.text,a=s.offset+s.text.length,m.push(s);}let d=et.exec(i);if(d===null)return null;let f=0,l=0;for(let u of m)if(l+=u.text.length,f++,l>=d[0].length)break;if(l!==d[0].length)return null;let p=me(d[0],e);if(p===null)return null;let y=new a$1(te,xe,String(p),d[0],n.offset,0,n.line,n.col,n.offset+d[0].length);return {consumed:f,replacement:[y],ruleName:o}}function Br(r=()=>"auto",t=()=>b$1,o=()=>"refuse"){return {name:"datetime:date-literal",priority:70,shape:[{types:["NUMBER"]}],match(e,n){let i=e[n];if(i.type!=="NUMBER")return null;let a=t();if(Xe.test(i.value)){let s=e[n+1];if(s&&s.type==="NUMBER"&&Ze.test(s.value)){let[N,T]=i.value.split("."),x={text:`${i.value}${s.value}`,groups:[N,T,s.value.slice(1)],separator:"dot"},I=ee(x,r(),o());if(I.kind==="date")return Ne(I.day,I.month,I.year,[i,s],"datetime:date-literal:dot",a);if(I.kind==="refuse")return Ie(I.code,I.message,[i,s],"datetime:date-literal:dot:unreadable")}return null}if(i.value.length===4&&H.test(i.value)){let s=ot(e,n,"datetime:date-literal:iso-timestamp",a);if(s)return s}if(!H.test(i.value))return null;let m=e[n+1];if(!m||m.type!=="SLASH"&&m.type!=="MINUS")return null;let d=e[n+2],f=e[n+3],l=e[n+4];if(!d||d.type!=="NUMBER"||!H.test(d.value)||!f||f.type!==m.type||!l||l.type!=="NUMBER"||!H.test(l.value))return null;let p=[i,m,d,f,l];if(!Qe(p))return null;let y={text:p.map(s=>s.value).join(""),groups:[i.value,d.value,l.value],separator:m.type==="MINUS"?"hyphen":"slash"},u=ee(y,r(),o());return u.kind==="arithmetic"?null:u.kind==="refuse"?Ie(u.code,u.message,p,"datetime:date-literal:unreadable"):Ne(u.day,u.month,u.year,p,`datetime:date-literal:${u.order.toLowerCase()}`,a)}}}export{Ce as a,ke as b,me as c,mr as d,lr as e,dr as f,M as g,Nr as h,je as i,ye as j,Q as k,ee as l,Ir as m,xr as n,te as o,Te as p,Ne as q,qe as r,Ie as s,Br as t};//# sourceMappingURL=chunk-FXB5GCBT.js.map
2
+ //# sourceMappingURL=chunk-FXB5GCBT.js.map