solve-engine 2.38.18 → 2.38.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PackageCompatibility-CUWuzzGW.d.cts → PackageCompatibility-Bv42nEm2.d.cts} +1 -1
- package/dist/{PackageCompatibility-BRas0tSN.d.ts → PackageCompatibility-ZCZVGHws.d.ts} +1 -1
- package/dist/{PackageRegistry-JqudPxo6.d.cts → PackageRegistry-7dFbaAZp.d.cts} +15 -0
- package/dist/{PackageRegistry-DMcI-_Qz.d.ts → PackageRegistry-B6s8LGCu.d.ts} +15 -0
- package/dist/{chunk-X2UPN2J3.js → chunk-3JSXJSMT.js} +2 -2
- package/dist/{chunk-X2UPN2J3.js.map → chunk-3JSXJSMT.js.map} +1 -1
- package/dist/{chunk-TVT3SOU5.cjs → chunk-6W3JFXPQ.cjs} +2 -2
- package/dist/{chunk-TVT3SOU5.cjs.map → chunk-6W3JFXPQ.cjs.map} +1 -1
- package/dist/{chunk-5QZQIZTS.cjs → chunk-7PUNL5CJ.cjs} +3 -3
- package/dist/{chunk-5QZQIZTS.cjs.map → chunk-7PUNL5CJ.cjs.map} +1 -1
- package/dist/{chunk-NMMYBXTV.js → chunk-BHHTXIUL.js} +2 -2
- package/dist/{chunk-NMMYBXTV.js.map → chunk-BHHTXIUL.js.map} +1 -1
- package/dist/{chunk-WR5HTFDE.cjs → chunk-EPLOL7WC.cjs} +2 -2
- package/dist/{chunk-WR5HTFDE.cjs.map → chunk-EPLOL7WC.cjs.map} +1 -1
- package/dist/{chunk-JUIHUG4M.cjs → chunk-EZ7R3ZHM.cjs} +3 -3
- package/dist/{chunk-JUIHUG4M.cjs.map → chunk-EZ7R3ZHM.cjs.map} +1 -1
- package/dist/{chunk-45J6ALYU.js → chunk-H4G3UXJV.js} +3 -3
- package/dist/{chunk-45J6ALYU.js.map → chunk-H4G3UXJV.js.map} +1 -1
- package/dist/{chunk-5MFUZDYK.cjs → chunk-HNXV35Q2.cjs} +2 -2
- package/dist/{chunk-5MFUZDYK.cjs.map → chunk-HNXV35Q2.cjs.map} +1 -1
- package/dist/{chunk-UP7TB5KO.cjs → chunk-I4PKEUMZ.cjs} +2 -2
- package/dist/{chunk-UP7TB5KO.cjs.map → chunk-I4PKEUMZ.cjs.map} +1 -1
- package/dist/{chunk-4I7XP3KF.js → chunk-JZQRUOO6.js} +2 -2
- package/dist/{chunk-4I7XP3KF.js.map → chunk-JZQRUOO6.js.map} +1 -1
- package/dist/chunk-KZPA4DUF.cjs +3 -0
- package/dist/chunk-KZPA4DUF.cjs.map +1 -0
- package/dist/chunk-MXMMDSX4.js +3 -0
- package/dist/chunk-MXMMDSX4.js.map +1 -0
- package/dist/{chunk-EQMNMV2O.js → chunk-RTEWTZ6I.js} +3 -3
- package/dist/{chunk-EQMNMV2O.js.map → chunk-RTEWTZ6I.js.map} +1 -1
- package/dist/{chunk-XDL542DB.js → chunk-SIUHB77U.js} +2 -2
- package/dist/{chunk-XDL542DB.js.map → chunk-SIUHB77U.js.map} +1 -1
- package/dist/{chunk-SSS3ZMKX.js → chunk-TFZNEEJR.js} +3 -3
- package/dist/{chunk-SSS3ZMKX.js.map → chunk-TFZNEEJR.js.map} +1 -1
- package/dist/{chunk-5E22VW42.cjs → chunk-UOLCBH37.cjs} +4 -4
- package/dist/{chunk-5E22VW42.cjs.map → chunk-UOLCBH37.cjs.map} +1 -1
- package/dist/{chunk-5N4XDULO.cjs → chunk-Z4MIX43O.cjs} +2 -2
- package/dist/chunk-Z4MIX43O.cjs.map +1 -0
- package/dist/{chunk-IHPYXJIY.js → chunk-ZSFOIBIH.js} +2 -2
- package/dist/chunk-ZSFOIBIH.js.map +1 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +2 -2
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +1 -1
- package/dist/engine.worker.cjs +1 -1
- package/dist/engine.worker.js +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/language.d.cts +2 -2
- package/dist/language.d.ts +2 -2
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +1 -1
- package/dist/packages.d.ts +1 -1
- package/dist/packages.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.d.cts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5N4XDULO.cjs.map +0 -1
- package/dist/chunk-IHPYXJIY.js.map +0 -1
- package/dist/chunk-JDMHZHL7.js +0 -3
- package/dist/chunk-JDMHZHL7.js.map +0 -1
- package/dist/chunk-MYGNBES2.cjs +0 -3
- package/dist/chunk-MYGNBES2.cjs.map +0 -1
|
@@ -464,6 +464,21 @@ declare class DocumentModel {
|
|
|
464
464
|
/**
|
|
465
465
|
* Mark a line as clean (re-evaluated successfully).
|
|
466
466
|
*/
|
|
467
|
+
/**
|
|
468
|
+
* Forget what a line answered, without forgetting the line.
|
|
469
|
+
*
|
|
470
|
+
* For a line whose answer was computed about a document that no longer
|
|
471
|
+
* exists. Marking it dirty says it must run again; this says that until it
|
|
472
|
+
* does, it has nothing to tell anyone who asks, which is the state a pass
|
|
473
|
+
* over the text from scratch would be in.
|
|
474
|
+
*
|
|
475
|
+
* The bytecode is left alone. It is compiled from the line's own text, which
|
|
476
|
+
* a structural edit does not change, and dropping it would recompile the
|
|
477
|
+
* document for nothing.
|
|
478
|
+
*
|
|
479
|
+
* @param lineId - Persistent line identifier.
|
|
480
|
+
*/
|
|
481
|
+
forgetResult(lineId: number): void;
|
|
467
482
|
markClean(lineId: number): void;
|
|
468
483
|
/**
|
|
469
484
|
* Mark a line as dirty (needs re-evaluation) by its 1-based position.
|
|
@@ -464,6 +464,21 @@ declare class DocumentModel {
|
|
|
464
464
|
/**
|
|
465
465
|
* Mark a line as clean (re-evaluated successfully).
|
|
466
466
|
*/
|
|
467
|
+
/**
|
|
468
|
+
* Forget what a line answered, without forgetting the line.
|
|
469
|
+
*
|
|
470
|
+
* For a line whose answer was computed about a document that no longer
|
|
471
|
+
* exists. Marking it dirty says it must run again; this says that until it
|
|
472
|
+
* does, it has nothing to tell anyone who asks, which is the state a pass
|
|
473
|
+
* over the text from scratch would be in.
|
|
474
|
+
*
|
|
475
|
+
* The bytecode is left alone. It is compiled from the line's own text, which
|
|
476
|
+
* a structural edit does not change, and dropping it would recompile the
|
|
477
|
+
* document for nothing.
|
|
478
|
+
*
|
|
479
|
+
* @param lineId - Persistent line identifier.
|
|
480
|
+
*/
|
|
481
|
+
forgetResult(lineId: number): void;
|
|
467
482
|
markClean(lineId: number): void;
|
|
468
483
|
/**
|
|
469
484
|
* Mark a line as dirty (needs re-evaluation) by its 1-based position.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,d}from'./chunk-U5MESNRT.js';import {a as a$2}from'./chunk-4I7XP3KF.js';import {b as b$1}from'./chunk-EOO6M65F.js';import {f,b as b$2}from'./chunk-J4K72CQN.js';import {a as a$1}from'./chunk-APYRNAU2.js';import {c}from'./chunk-FAO6DQ74.js';import {c as c$1}from'./chunk-6G2NES2I.js';var M=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(67),t.emitIndex(1);}};var S=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(68),t.emitIndex(1);}};function B(r,e){let o=r.peek();if(!o||o.type!=="IDENT"&&o.type!=="UNIT")throw c$1.parsing("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${e} needs the name of an unknown here, as in ${e}(x^2, x).`,{found:o?.type??"end of input"});return r.consume(),o.value}function A(r,e){r.emitOpcode(13),r.emitString(e);}function T(r,e,o){let t=new d(e.pluginIndexMap);r.parseExpression(a.Lowest,t),r.setBuilder(e);let n=t.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 _(r,e,o){let t=r.emitAnonymousBody([o],e);r.emitOpcode(159),r.emitIndex(t);}var k=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"solve"),i=e.match("EQUALS")?T(e,t,"solve"):null;e.consume("COMMA");let a=e.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"});e.consume(),_(t,n,a.value),i?_(t,i,a.value):(t.emitOpcode(10),t.emitNumber(0)),A(t,a.value),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(69),t.emitIndex(3);}};var b=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"der");e.consume("COMMA");let i=B(e,"der");_(t,n,i),A(t,i),e.match("COMMA")?e.parseExpression(a.Lowest,t):(t.emitOpcode(10),t.emitNumber(1)),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(70),t.emitIndex(3);}};var F=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"integral");e.consume("COMMA");let i=B(e,"integral");_(t,n,i),A(t,i),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(71),t.emitIndex(2);}};var w=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"taylor");e.consume("COMMA");let i=B(e,"taylor");_(t,n,i),A(t,i),e.consume("EQUALS"),e.parseExpression(a.Lowest,t),e.consume("COMMA"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(72),t.emitIndex(4);}};var Y=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=0;do e.parseExpression(a.Lowest,t),n++;while(e.match("COMMA"));e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(73),t.emitIndex(n);}};var v=class{constructor(){this.category="Symbolic";}parse(e,o,t){t.emitOpcode(10),t.emitNumber(Number(o.value)),t.emitOpcode(51),t.emitIndex(74),t.emitIndex(1);}};var U=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(75),t.emitIndex(1);}};var $=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(76),t.emitIndex(1);}};var z=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(77),t.emitIndex(1);}};var j=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(78),t.emitIndex(1);}};var G=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(79),t.emitIndex(1);}};function ae(r=75){return {name:"symbolic:imaginary-literal",priority:r,shape:[{types:["NUMBER"]},{types:["IDENT"],values:["i"]}],match(e,o){let t=e[o];if(!t||t.type!=="NUMBER")return null;let n=e[o+1];return !n||n.type!=="IDENT"||n.value!=="i"||n.offset!==t.offset+t.value.length||e[o+2]?.type==="LPAREN"?null:{consumed:2,replacement:[new a$1("IMAGINARY",c("IMAGINARY"),t.value,t.value,t.offset,0,t.line,t.col)],ruleName:"symbolic:imaginary-literal"}}}}var se={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 me(r=80){return {name:"symbolic:call",priority:r,shape:[{types:["IDENT"],values:Object.keys(se)},{types:["LPAREN"]}],match(e,o){let t=e[o];if(!t||t.type!=="IDENT")return null;let n=se[t.value.toLowerCase()];return !n||e[o+1]?.type!=="LPAREN"?null:{consumed:1,replacement:[new a$1(n,c(n),t.value,t.value,t.offset,0,t.line,t.col)],ruleName:"symbolic:call"}}}}var le=[{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"}],Ye={name:"solve-symbolic",normalizerRules:[me(),ae()],prefixParselets:{EXPAND_FN:new M,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"}},ve=new Set(le.map(r=>r.tokenType));function Ue(r){return r.some(e=>ve.has(e.type))}var de=r=>a$2("tag",r.toLowerCase());function $e(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ce=/(?:total|sum|average|count)\s+of\s+$/i,ue=64,Z=/(?:^|[^0-9A-Za-z_])#([0-9A-Za-z_-]+)(?![0-9A-Za-z_-])/g;function yr(r,e,o){let t=pe(r);return t.members.length===0&&t.queries.length===0?{reads:e,writes:o}:{reads:t.queries.length===0?e:[...e,...t.queries.map(de)],writes:t.members.length===0?o:[...o,...t.members.map(de)]}}function Nr(r){let e=pe(r).members;for(let o=0;o<e.length;o++)e[o]=e[o].toLowerCase();return e}function pe(r){let e=[],o=[],t=r.search(/\S/);Z.lastIndex=0;for(let n=Z.exec(r);n!==null;n=Z.exec(r)){let i=n.index+n[0].indexOf("#");if(t===i)continue;let a=n[1];if(ce.test(r.slice(Math.max(0,i-ue),i))){o.push(a);continue}e.push(a);}return {members:e,queries:o}}function Ir(r,e){if(e==="")return false;let o=new RegExp(`(?:^|[^0-9A-Za-z_])#${$e(e)}(?![0-9A-Za-z_-])`,"gi"),t=r.search(/\S/);for(let n=o.exec(r);n!==null;n=o.exec(r)){let i=n.index+n[0].indexOf("#");if(t!==i&&!ce.test(r.slice(Math.max(0,i-ue),i)))return true}return false}var ze=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function fe(r,e){let o=r.trim();if(o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),!ze.test(o))return null;let t=e.parseIso8601(o);return Number.isNaN(t)?null:t}var je=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function Tr(r){let e=je.exec(r.trim());if(e===null||e[1]===void 0)return {grain:"date"};let o=e[2];if(o===void 0)return {grain:"datetime"};if(o==="Z")return {grain:"instant",zone:f(0)};let t=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(t*i)}}function _r(r,e){let o=e.fields(r),t=N=>String(N).padStart(2,"0"),n=o.year,i=t(o.month0+1),a=t(o.day),m=t(o.hour),d=t(o.minute),f=t(o.second),l=e.utcOffsetMinutes(r),p=l>=0?"+":"-",y=Math.abs(l),u=t(Math.floor(y/60)),s=t(y%60);return `${n}-${i}-${a}T${m}:${d}:${f}${p}${u}:${s}`}var Ge=1e12;function Er(r){return Math.abs(r)>=Ge?r:r*1e3}var Ve=Date.UTC(2026,3,3),ye,R,K=new Map;function He(){return typeof Intl=="object"&&Intl!==null?Intl.DateTimeFormat:void 0}function Ne(){let r=He();r!==ye&&(ye=r,R=void 0,K.clear());}function Je(){if(Ne(),R!==void 0)return R;try{let r=new Intl.DateTimeFormat("ja-JP").resolvedOptions().locale;R=typeof r=="string"&&r.startsWith("ja");}catch{R=false;}return R}function Ie(){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 xe(r){Ne();let e=K.get(r);if(e!==void 0)return e;let o=We(r);return K.set(r,o),o}function We(r){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function"||!Je())return null;try{if(typeof Intl.DateTimeFormat.supportedLocalesOf=="function"&&Intl.DateTimeFormat.supportedLocalesOf([r]).length===0)return null;let e=new Intl.DateTimeFormat(r,{calendar:"gregory",numberingSystem:"latn",timeZone:"UTC",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(Ve);if(!Array.isArray(e))return null;let o=e.filter(t=>t.type==="year"||t.type==="month"||t.type==="day").map(t=>t.type[0].toUpperCase()).join("");return o==="DMY"||o==="MDY"||o==="YMD"?o:null}catch{return null}}var C={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 Rr(r){let e=r.inputLocale;if(e!==void 0&&!Ze(e))throw c$1.config(C.DATE_INPUT_LOCALE_INVALID,`date.inputLocale "${e}" is not a BCP-47 locale tag. Use a tag Intl accepts, for example "en-US".`,{inputLocale:e});let o=r.onAmbiguous,t=r.inputOrder;if(t==="DMY"||t==="MDY"||t==="YMD")return Object.freeze({order:t,orderSource:"config",onAmbiguous:o});if(t==="locale"){let n=e??Ie();if(n!=null){let i=xe(n);if(i!==null)return Object.freeze({order:i,orderSource:e!==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 Te=["January","February","March","April","May","June","July","August","September","October","November","December"],q=/^\d{1,2}$/,X=/^\d{4}$/;function Ke(r,e,o,t){let n=q.test(r),i=q.test(e),a=q.test(o);return t==="hyphen"&&X.test(r)&&i&&a?"iso":n&&i&&X.test(o)?"year-last-4":t==="slash"&&X.test(r)&&i&&a?"year-first-4":n&&i&&a?"short":"none"}function qe(r){if(r.length===4)return Number(r);if(r.length===2){let e=Number(r);return e<=68?2e3+e:1900+e}return null}function O(r,e,o){return e<1||e>12||r<1?false:r<=b$2(o,e-1)}function _e(r,e,o){return e<1||e>12?`there is no month ${e}`:r<1?`there is no day ${r}`:`${Te[e-1]} ${o} has ${b$2(o,e-1)} days`}function P(r,e,o){return `${r} ${Te[e-1]} ${o}`}function Q(r,e,o){let t=n=>String(n).padStart(2,"0");return `${String(o).padStart(4,"0")}-${t(e)}-${t(r)}`}function V(r,e,o){return r==="DMY"?{day:Number(e),month:Number(o)}:{day:Number(o),month:Number(e)}}function D(r){return r==="DMY"?"day first":r==="MDY"?"month first":"year first"}function Xe(r){return r==="hyphen"?"MDY":"DMY"}function te(r,e,o,t){let[n,i,a]=r.groups,m=Ke(n,i,a,r.separator),d=r.separator!=="dot",f=o==="refuse"||!d;if(m==="none")return {kind:"arithmetic"};if(m==="iso"){let g=Number(n),x=Number(i),I=Number(a);return O(I,x,g)?{kind:"date",day:I,month:x,year:g,order:"ISO",shortYear:false}:f?ee(r.text,I,x,g):{kind:"arithmetic"}}if(m==="year-first-4"){if(e!=="YMD")return {kind:"arithmetic"};let g=Number(n),x=Number(i),I=Number(a);return O(I,x,g)?{kind:"date",day:I,month:x,year:g,order:"YMD",shortYear:false}:{kind:"arithmetic"}}let l=qe(a);if(l===null)return {kind:"arithmetic"};let p=a.length===2;if(e==="YMD")return !f||m==="short"&&d?{kind:"arithmetic"}:Qe(r.text,n,i,l);let y=e==="auto"?Xe(r.separator):e,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:C.DATE_ORDER_MISMATCH,message:`"${r.text}" is not a date read ${D(y)}: ${_e(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)}.`}:ee(r.text,s.day,s.month,l)}function ee(r,e,o,t){return {kind:"refuse",code:C.DATE_NOT_A_CALENDAR_DAY,message:`"${r}" is not a real date: ${_e(e,o,t)}.`}}function Qe(r,e,o,t,n){let i=V("DMY",e,o),a=V("MDY",e,o),m=O(i.day,i.month,t),d=O(a.day,a.month,t);if(!m&&!d)return ee(r,i.day,i.month,t);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:C.DATE_ORDER_MISMATCH,message:`${f} Read day first it is ${P(i.day,i.month,t)} and month first ${P(a.day,a.month,t)}. Write it as ${Q(i.day,i.month,t)}, or set date.inputOrder to "DMY" or "MDY".`};let p=m?i:a,y=m?"DMY":"MDY";return {kind:"refuse",code:C.DATE_ORDER_MISMATCH,message:`${f} Read ${D(y)} it is ${P(p.day,p.month,t)}. Write it as ${Q(p.day,p.month,t)}, or set date.inputOrder to "${y}".`}}function et(r,e){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 ${e} date, because the host locale could not be read`;default:return `${o}, the default for a ${e} date`}}function ge(r){let[e,o,t]=r.split("-").map(Number);return P(t,o,e)}function tt(r,e,o){if(r.iso===null)return o??`"${r.text}" is not a date this engine can read.`;let t=`${r.text} read as ${ge(r.iso)}, ${et(r,e)}.`;if(r.alternative!==void 0&&r.order!==null&&r.order!=="ISO"&&r.order!=="spelled"){let n=r.order==="DMY"?"Month first":"Day first";t+=` ${n} would be ${ge(r.alternative)}.`;}return r.shortYear&&(t+=` The two-digit year ${r.text.slice(-2)} was read as ${r.iso.slice(0,4)}.`),t}function Pr(r,e,o){return {...r,note:tt(r,e,o),needsNote:r.contested||r.shortYear||r.iso===null}}function Dr(r){let e=/^(\d+)([/-])(\d+)\2(\d+)$/.exec(r);if(e!==null)return {text:r,groups:[e[1],e[3],e[4]],separator:e[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 re="DATETIME_LITERAL",Le=c(re),he="DATETIME_LITERAL_UNREADABLE",rt=c(he),H=/^\d+$/,ot=/^\d{1,2}\.\d{1,2}$/,nt=/^\.(\d{2}|\d{4})$/;function it(r){for(let e=0;e<r.length-1;e++){let o=r[e];if((o.sourceEnd??o.offset+o.text.length)!==r[e+1].offset)return false}return true}function Ee(r,e,o,t,n,i){if(e<1||e>12||r<1||r>31)return null;let a=i.localMidnight(o,e-1,r),m=i.fields(a);if(m.year!==o||m.month0!==e-1||m.day!==r)return null;let d=t[0],f=t.map(p=>p.value).join(""),l=new a$1(re,Le,String(a),f,d.offset,0,d.line,d.col);return {consumed:t.length,replacement:[l],ruleName:n}}function at(r){let e="",o=-1;for(let t of r){let n=t.text??t.value;o>=0&&t.offset>o&&(e+=" "),e+=n,o=t.sourceEnd??t.offset+n.length;}return e}function Ae(r,e,o,t){let n=o[0],i=at(o),a=new a$1(he,rt,i,i,n.offset,0,n.line,n.col);return a.fault={code:r,message:e},{consumed:o.length,replacement:[a],ruleName:t}}var st=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?/,mt=new Set(["NUMBER","MINUS","PLUS","COLON","IDENT"]),lt=16;function dt(r,e,o,t){let n=r[e];if(n.sourceEnd!==void 0)return null;let i=n.text,a=n.offset+n.text.length,m=[n];for(let u=e+1;u<r.length&&m.length<lt;u++){let s=r[u];if(s.sourceEnd!==void 0||s.offset!==a||!mt.has(s.type))break;i+=s.text,a=s.offset+s.text.length,m.push(s);}let d=st.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=fe(d[0],t);if(p===null)return null;let y=new a$1(re,Le,String(p),d[0],n.offset,0,n.line,n.col,n.offset+d[0].length);return {consumed:f,replacement:[y],ruleName:o}}function wr(r=()=>"auto",e=()=>b$1,o=()=>"refuse"){return {name:"datetime:date-literal",priority:70,shape:[{types:["NUMBER"]}],match(t,n){let i=t[n];if(i.type!=="NUMBER")return null;let a=e();if(ot.test(i.value)){let s=t[n+1];if(s&&s.type==="NUMBER"&&nt.test(s.value)){let[N,g]=i.value.split("."),x={text:`${i.value}${s.value}`,groups:[N,g,s.value.slice(1)],separator:"dot"},I=te(x,r(),o());if(I.kind==="date")return Ee(I.day,I.month,I.year,[i,s],"datetime:date-literal:dot",a);if(I.kind==="refuse")return Ae(I.code,I.message,[i,s],"datetime:date-literal:dot:unreadable")}return null}if(i.value.length===4&&H.test(i.value)){let s=dt(t,n,"datetime:date-literal:iso-timestamp",a);if(s)return s}if(!H.test(i.value))return null;let m=t[n+1];if(!m||m.type!=="SLASH"&&m.type!=="MINUS")return null;let d=t[n+2],f=t[n+3],l=t[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(!it(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=te(y,r(),o());return u.kind==="arithmetic"?null:u.kind==="refuse"?Ae(u.code,u.message,p,"datetime:date-literal:unreadable"):Ee(u.day,u.month,u.year,p,`datetime:date-literal:${u.order.toLowerCase()}`,a)}}}export{yr as a,Nr as b,Ir as c,Ye as d,Ue as e,fe as f,Tr as g,_r as h,Er as i,C as j,Rr as k,Ke as l,_e as m,Q as n,te as o,Pr as p,Dr as q,re as r,he as s,Ee as t,at as u,Ae as v,wr as w};//# sourceMappingURL=chunk-X2UPN2J3.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,d}from'./chunk-U5MESNRT.js';import {a as a$2}from'./chunk-JZQRUOO6.js';import {b as b$1}from'./chunk-EOO6M65F.js';import {f,b as b$2}from'./chunk-J4K72CQN.js';import {a as a$1}from'./chunk-APYRNAU2.js';import {c}from'./chunk-FAO6DQ74.js';import {c as c$1}from'./chunk-6G2NES2I.js';var M=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(67),t.emitIndex(1);}};var S=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(68),t.emitIndex(1);}};function B(r,e){let o=r.peek();if(!o||o.type!=="IDENT"&&o.type!=="UNIT")throw c$1.parsing("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${e} needs the name of an unknown here, as in ${e}(x^2, x).`,{found:o?.type??"end of input"});return r.consume(),o.value}function A(r,e){r.emitOpcode(13),r.emitString(e);}function T(r,e,o){let t=new d(e.pluginIndexMap);r.parseExpression(a.Lowest,t),r.setBuilder(e);let n=t.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 _(r,e,o){let t=r.emitAnonymousBody([o],e);r.emitOpcode(159),r.emitIndex(t);}var k=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"solve"),i=e.match("EQUALS")?T(e,t,"solve"):null;e.consume("COMMA");let a=e.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"});e.consume(),_(t,n,a.value),i?_(t,i,a.value):(t.emitOpcode(10),t.emitNumber(0)),A(t,a.value),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(69),t.emitIndex(3);}};var b=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"der");e.consume("COMMA");let i=B(e,"der");_(t,n,i),A(t,i),e.match("COMMA")?e.parseExpression(a.Lowest,t):(t.emitOpcode(10),t.emitNumber(1)),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(70),t.emitIndex(3);}};var F=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"integral");e.consume("COMMA");let i=B(e,"integral");_(t,n,i),A(t,i),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(71),t.emitIndex(2);}};var w=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=T(e,t,"taylor");e.consume("COMMA");let i=B(e,"taylor");_(t,n,i),A(t,i),e.consume("EQUALS"),e.parseExpression(a.Lowest,t),e.consume("COMMA"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(72),t.emitIndex(4);}};var Y=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN");let n=0;do e.parseExpression(a.Lowest,t),n++;while(e.match("COMMA"));e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(73),t.emitIndex(n);}};var v=class{constructor(){this.category="Symbolic";}parse(e,o,t){t.emitOpcode(10),t.emitNumber(Number(o.value)),t.emitOpcode(51),t.emitIndex(74),t.emitIndex(1);}};var U=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(75),t.emitIndex(1);}};var $=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(76),t.emitIndex(1);}};var z=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(77),t.emitIndex(1);}};var j=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(78),t.emitIndex(1);}};var G=class{constructor(){this.category="Symbolic";}parse(e,o,t){e.consume("LPAREN"),e.parseExpression(a.Lowest,t),e.consume("RPAREN"),t.emitOpcode(51),t.emitIndex(79),t.emitIndex(1);}};function ae(r=75){return {name:"symbolic:imaginary-literal",priority:r,shape:[{types:["NUMBER"]},{types:["IDENT"],values:["i"]}],match(e,o){let t=e[o];if(!t||t.type!=="NUMBER")return null;let n=e[o+1];return !n||n.type!=="IDENT"||n.value!=="i"||n.offset!==t.offset+t.value.length||e[o+2]?.type==="LPAREN"?null:{consumed:2,replacement:[new a$1("IMAGINARY",c("IMAGINARY"),t.value,t.value,t.offset,0,t.line,t.col)],ruleName:"symbolic:imaginary-literal"}}}}var se={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 me(r=80){return {name:"symbolic:call",priority:r,shape:[{types:["IDENT"],values:Object.keys(se)},{types:["LPAREN"]}],match(e,o){let t=e[o];if(!t||t.type!=="IDENT")return null;let n=se[t.value.toLowerCase()];return !n||e[o+1]?.type!=="LPAREN"?null:{consumed:1,replacement:[new a$1(n,c(n),t.value,t.value,t.offset,0,t.line,t.col)],ruleName:"symbolic:call"}}}}var le=[{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"}],Ye={name:"solve-symbolic",normalizerRules:[me(),ae()],prefixParselets:{EXPAND_FN:new M,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"}},ve=new Set(le.map(r=>r.tokenType));function Ue(r){return r.some(e=>ve.has(e.type))}var de=r=>a$2("tag",r.toLowerCase());function $e(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ce=/(?:total|sum|average|count)\s+of\s+$/i,ue=64,Z=/(?:^|[^0-9A-Za-z_])#([0-9A-Za-z_-]+)(?![0-9A-Za-z_-])/g;function yr(r,e,o){let t=pe(r);return t.members.length===0&&t.queries.length===0?{reads:e,writes:o}:{reads:t.queries.length===0?e:[...e,...t.queries.map(de)],writes:t.members.length===0?o:[...o,...t.members.map(de)]}}function Nr(r){let e=pe(r).members;for(let o=0;o<e.length;o++)e[o]=e[o].toLowerCase();return e}function pe(r){let e=[],o=[],t=r.search(/\S/);Z.lastIndex=0;for(let n=Z.exec(r);n!==null;n=Z.exec(r)){let i=n.index+n[0].indexOf("#");if(t===i)continue;let a=n[1];if(ce.test(r.slice(Math.max(0,i-ue),i))){o.push(a);continue}e.push(a);}return {members:e,queries:o}}function Ir(r,e){if(e==="")return false;let o=new RegExp(`(?:^|[^0-9A-Za-z_])#${$e(e)}(?![0-9A-Za-z_-])`,"gi"),t=r.search(/\S/);for(let n=o.exec(r);n!==null;n=o.exec(r)){let i=n.index+n[0].indexOf("#");if(t!==i&&!ce.test(r.slice(Math.max(0,i-ue),i)))return true}return false}var ze=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function fe(r,e){let o=r.trim();if(o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),!ze.test(o))return null;let t=e.parseIso8601(o);return Number.isNaN(t)?null:t}var je=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function Tr(r){let e=je.exec(r.trim());if(e===null||e[1]===void 0)return {grain:"date"};let o=e[2];if(o===void 0)return {grain:"datetime"};if(o==="Z")return {grain:"instant",zone:f(0)};let t=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(t*i)}}function _r(r,e){let o=e.fields(r),t=N=>String(N).padStart(2,"0"),n=o.year,i=t(o.month0+1),a=t(o.day),m=t(o.hour),d=t(o.minute),f=t(o.second),l=e.utcOffsetMinutes(r),p=l>=0?"+":"-",y=Math.abs(l),u=t(Math.floor(y/60)),s=t(y%60);return `${n}-${i}-${a}T${m}:${d}:${f}${p}${u}:${s}`}var Ge=1e12;function Er(r){return Math.abs(r)>=Ge?r:r*1e3}var Ve=Date.UTC(2026,3,3),ye,R,K=new Map;function He(){return typeof Intl=="object"&&Intl!==null?Intl.DateTimeFormat:void 0}function Ne(){let r=He();r!==ye&&(ye=r,R=void 0,K.clear());}function Je(){if(Ne(),R!==void 0)return R;try{let r=new Intl.DateTimeFormat("ja-JP").resolvedOptions().locale;R=typeof r=="string"&&r.startsWith("ja");}catch{R=false;}return R}function Ie(){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 xe(r){Ne();let e=K.get(r);if(e!==void 0)return e;let o=We(r);return K.set(r,o),o}function We(r){if(typeof Intl!="object"||Intl===null||typeof Intl.DateTimeFormat!="function"||!Je())return null;try{if(typeof Intl.DateTimeFormat.supportedLocalesOf=="function"&&Intl.DateTimeFormat.supportedLocalesOf([r]).length===0)return null;let e=new Intl.DateTimeFormat(r,{calendar:"gregory",numberingSystem:"latn",timeZone:"UTC",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(Ve);if(!Array.isArray(e))return null;let o=e.filter(t=>t.type==="year"||t.type==="month"||t.type==="day").map(t=>t.type[0].toUpperCase()).join("");return o==="DMY"||o==="MDY"||o==="YMD"?o:null}catch{return null}}var C={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 Rr(r){let e=r.inputLocale;if(e!==void 0&&!Ze(e))throw c$1.config(C.DATE_INPUT_LOCALE_INVALID,`date.inputLocale "${e}" is not a BCP-47 locale tag. Use a tag Intl accepts, for example "en-US".`,{inputLocale:e});let o=r.onAmbiguous,t=r.inputOrder;if(t==="DMY"||t==="MDY"||t==="YMD")return Object.freeze({order:t,orderSource:"config",onAmbiguous:o});if(t==="locale"){let n=e??Ie();if(n!=null){let i=xe(n);if(i!==null)return Object.freeze({order:i,orderSource:e!==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 Te=["January","February","March","April","May","June","July","August","September","October","November","December"],q=/^\d{1,2}$/,X=/^\d{4}$/;function Ke(r,e,o,t){let n=q.test(r),i=q.test(e),a=q.test(o);return t==="hyphen"&&X.test(r)&&i&&a?"iso":n&&i&&X.test(o)?"year-last-4":t==="slash"&&X.test(r)&&i&&a?"year-first-4":n&&i&&a?"short":"none"}function qe(r){if(r.length===4)return Number(r);if(r.length===2){let e=Number(r);return e<=68?2e3+e:1900+e}return null}function O(r,e,o){return e<1||e>12||r<1?false:r<=b$2(o,e-1)}function _e(r,e,o){return e<1||e>12?`there is no month ${e}`:r<1?`there is no day ${r}`:`${Te[e-1]} ${o} has ${b$2(o,e-1)} days`}function P(r,e,o){return `${r} ${Te[e-1]} ${o}`}function Q(r,e,o){let t=n=>String(n).padStart(2,"0");return `${String(o).padStart(4,"0")}-${t(e)}-${t(r)}`}function V(r,e,o){return r==="DMY"?{day:Number(e),month:Number(o)}:{day:Number(o),month:Number(e)}}function D(r){return r==="DMY"?"day first":r==="MDY"?"month first":"year first"}function Xe(r){return r==="hyphen"?"MDY":"DMY"}function te(r,e,o,t){let[n,i,a]=r.groups,m=Ke(n,i,a,r.separator),d=r.separator!=="dot",f=o==="refuse"||!d;if(m==="none")return {kind:"arithmetic"};if(m==="iso"){let g=Number(n),x=Number(i),I=Number(a);return O(I,x,g)?{kind:"date",day:I,month:x,year:g,order:"ISO",shortYear:false}:f?ee(r.text,I,x,g):{kind:"arithmetic"}}if(m==="year-first-4"){if(e!=="YMD")return {kind:"arithmetic"};let g=Number(n),x=Number(i),I=Number(a);return O(I,x,g)?{kind:"date",day:I,month:x,year:g,order:"YMD",shortYear:false}:{kind:"arithmetic"}}let l=qe(a);if(l===null)return {kind:"arithmetic"};let p=a.length===2;if(e==="YMD")return !f||m==="short"&&d?{kind:"arithmetic"}:Qe(r.text,n,i,l);let y=e==="auto"?Xe(r.separator):e,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:C.DATE_ORDER_MISMATCH,message:`"${r.text}" is not a date read ${D(y)}: ${_e(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)}.`}:ee(r.text,s.day,s.month,l)}function ee(r,e,o,t){return {kind:"refuse",code:C.DATE_NOT_A_CALENDAR_DAY,message:`"${r}" is not a real date: ${_e(e,o,t)}.`}}function Qe(r,e,o,t,n){let i=V("DMY",e,o),a=V("MDY",e,o),m=O(i.day,i.month,t),d=O(a.day,a.month,t);if(!m&&!d)return ee(r,i.day,i.month,t);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:C.DATE_ORDER_MISMATCH,message:`${f} Read day first it is ${P(i.day,i.month,t)} and month first ${P(a.day,a.month,t)}. Write it as ${Q(i.day,i.month,t)}, or set date.inputOrder to "DMY" or "MDY".`};let p=m?i:a,y=m?"DMY":"MDY";return {kind:"refuse",code:C.DATE_ORDER_MISMATCH,message:`${f} Read ${D(y)} it is ${P(p.day,p.month,t)}. Write it as ${Q(p.day,p.month,t)}, or set date.inputOrder to "${y}".`}}function et(r,e){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 ${e} date, because the host locale could not be read`;default:return `${o}, the default for a ${e} date`}}function ge(r){let[e,o,t]=r.split("-").map(Number);return P(t,o,e)}function tt(r,e,o){if(r.iso===null)return o??`"${r.text}" is not a date this engine can read.`;let t=`${r.text} read as ${ge(r.iso)}, ${et(r,e)}.`;if(r.alternative!==void 0&&r.order!==null&&r.order!=="ISO"&&r.order!=="spelled"){let n=r.order==="DMY"?"Month first":"Day first";t+=` ${n} would be ${ge(r.alternative)}.`;}return r.shortYear&&(t+=` The two-digit year ${r.text.slice(-2)} was read as ${r.iso.slice(0,4)}.`),t}function Pr(r,e,o){return {...r,note:tt(r,e,o),needsNote:r.contested||r.shortYear||r.iso===null}}function Dr(r){let e=/^(\d+)([/-])(\d+)\2(\d+)$/.exec(r);if(e!==null)return {text:r,groups:[e[1],e[3],e[4]],separator:e[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 re="DATETIME_LITERAL",Le=c(re),he="DATETIME_LITERAL_UNREADABLE",rt=c(he),H=/^\d+$/,ot=/^\d{1,2}\.\d{1,2}$/,nt=/^\.(\d{2}|\d{4})$/;function it(r){for(let e=0;e<r.length-1;e++){let o=r[e];if((o.sourceEnd??o.offset+o.text.length)!==r[e+1].offset)return false}return true}function Ee(r,e,o,t,n,i){if(e<1||e>12||r<1||r>31)return null;let a=i.localMidnight(o,e-1,r),m=i.fields(a);if(m.year!==o||m.month0!==e-1||m.day!==r)return null;let d=t[0],f=t.map(p=>p.value).join(""),l=new a$1(re,Le,String(a),f,d.offset,0,d.line,d.col);return {consumed:t.length,replacement:[l],ruleName:n}}function at(r){let e="",o=-1;for(let t of r){let n=t.text??t.value;o>=0&&t.offset>o&&(e+=" "),e+=n,o=t.sourceEnd??t.offset+n.length;}return e}function Ae(r,e,o,t){let n=o[0],i=at(o),a=new a$1(he,rt,i,i,n.offset,0,n.line,n.col);return a.fault={code:r,message:e},{consumed:o.length,replacement:[a],ruleName:t}}var st=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?/,mt=new Set(["NUMBER","MINUS","PLUS","COLON","IDENT"]),lt=16;function dt(r,e,o,t){let n=r[e];if(n.sourceEnd!==void 0)return null;let i=n.text,a=n.offset+n.text.length,m=[n];for(let u=e+1;u<r.length&&m.length<lt;u++){let s=r[u];if(s.sourceEnd!==void 0||s.offset!==a||!mt.has(s.type))break;i+=s.text,a=s.offset+s.text.length,m.push(s);}let d=st.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=fe(d[0],t);if(p===null)return null;let y=new a$1(re,Le,String(p),d[0],n.offset,0,n.line,n.col,n.offset+d[0].length);return {consumed:f,replacement:[y],ruleName:o}}function wr(r=()=>"auto",e=()=>b$1,o=()=>"refuse"){return {name:"datetime:date-literal",priority:70,shape:[{types:["NUMBER"]}],match(t,n){let i=t[n];if(i.type!=="NUMBER")return null;let a=e();if(ot.test(i.value)){let s=t[n+1];if(s&&s.type==="NUMBER"&&nt.test(s.value)){let[N,g]=i.value.split("."),x={text:`${i.value}${s.value}`,groups:[N,g,s.value.slice(1)],separator:"dot"},I=te(x,r(),o());if(I.kind==="date")return Ee(I.day,I.month,I.year,[i,s],"datetime:date-literal:dot",a);if(I.kind==="refuse")return Ae(I.code,I.message,[i,s],"datetime:date-literal:dot:unreadable")}return null}if(i.value.length===4&&H.test(i.value)){let s=dt(t,n,"datetime:date-literal:iso-timestamp",a);if(s)return s}if(!H.test(i.value))return null;let m=t[n+1];if(!m||m.type!=="SLASH"&&m.type!=="MINUS")return null;let d=t[n+2],f=t[n+3],l=t[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(!it(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=te(y,r(),o());return u.kind==="arithmetic"?null:u.kind==="refuse"?Ae(u.code,u.message,p,"datetime:date-literal:unreadable"):Ee(u.day,u.month,u.year,p,`datetime:date-literal:${u.order.toLowerCase()}`,a)}}}export{yr as a,Nr as b,Ir as c,Ye as d,Ue as e,fe as f,Tr as g,_r as h,Er as i,C as j,Rr as k,Ke as l,_e as m,Q as n,te as o,Pr as p,Dr as q,re as r,he as s,Ee as t,at as u,Ae as v,wr as w};//# sourceMappingURL=chunk-3JSXJSMT.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-3JSXJSMT.js.map
|