solve-engine 2.38.26 → 2.38.28

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 (126) hide show
  1. package/dist/{PackageCompatibility-C7ILySsH.d.ts → PackageCompatibility-BfRpqwmD.d.ts} +1 -1
  2. package/dist/{PackageCompatibility-CzDzOIg9.d.cts → PackageCompatibility-CcfNMlWN.d.cts} +1 -1
  3. package/dist/{PackageRegistry-D7_B0mxv.d.ts → PackageRegistry-ClAKDDOP.d.ts} +25 -4
  4. package/dist/{PackageRegistry-Bd8ErpwZ.d.cts → PackageRegistry-DLLVZW0S.d.cts} +25 -4
  5. package/dist/{Parselet-DmMY2s9Y.d.cts → Parselet-ClR3Blwp.d.cts} +1 -1
  6. package/dist/{Parselet-Br1tHash.d.ts → Parselet-DkAFnfU2.d.ts} +1 -1
  7. package/dist/{VMBuiltins-BqkoJtHt.d.ts → VMBuiltins-Bk8TQNF1.d.ts} +2 -2
  8. package/dist/{VMBuiltins-Baa90D2v.d.cts → VMBuiltins-ClXnXk9K.d.cts} +2 -2
  9. package/dist/{Value-B55Hvn3e.d.cts → Value-wMuCzPn0.d.cts} +18 -2
  10. package/dist/{Value-B55Hvn3e.d.ts → Value-wMuCzPn0.d.ts} +18 -2
  11. package/dist/{chunk-L2JQQ5EO.js → chunk-34RTVUU3.js} +3 -3
  12. package/dist/{chunk-L2JQQ5EO.js.map → chunk-34RTVUU3.js.map} +1 -1
  13. package/dist/{chunk-QP4VIEXZ.js → chunk-36JGHDZR.js} +2 -2
  14. package/dist/chunk-36JGHDZR.js.map +1 -0
  15. package/dist/chunk-3ZFJLH4W.cjs +2 -0
  16. package/dist/chunk-3ZFJLH4W.cjs.map +1 -0
  17. package/dist/{chunk-EZ7R3ZHM.cjs → chunk-4AX7GIZY.cjs} +3 -3
  18. package/dist/{chunk-EZ7R3ZHM.cjs.map → chunk-4AX7GIZY.cjs.map} +1 -1
  19. package/dist/chunk-4H27GUVY.js +2 -0
  20. package/dist/chunk-4H27GUVY.js.map +1 -0
  21. package/dist/{chunk-ZWDLC4MR.cjs → chunk-5BRJQREI.cjs} +4 -4
  22. package/dist/{chunk-ZWDLC4MR.cjs.map → chunk-5BRJQREI.cjs.map} +1 -1
  23. package/dist/{chunk-AWGSR2GZ.js → chunk-BNVE6I22.js} +2 -2
  24. package/dist/{chunk-AWGSR2GZ.js.map → chunk-BNVE6I22.js.map} +1 -1
  25. package/dist/chunk-CAJKB4WQ.js +2 -0
  26. package/dist/chunk-CAJKB4WQ.js.map +1 -0
  27. package/dist/{chunk-ZSFOIBIH.js → chunk-CUH3FEWI.js} +2 -2
  28. package/dist/chunk-CUH3FEWI.js.map +1 -0
  29. package/dist/{chunk-NMZRAJLJ.cjs → chunk-FZTGWNVU.cjs} +2 -2
  30. package/dist/{chunk-NMZRAJLJ.cjs.map → chunk-FZTGWNVU.cjs.map} +1 -1
  31. package/dist/{chunk-RMBUP4XA.js → chunk-GMHYWVOG.js} +2 -2
  32. package/dist/{chunk-RMBUP4XA.js.map → chunk-GMHYWVOG.js.map} +1 -1
  33. package/dist/chunk-HPJ5SQEL.js +3 -0
  34. package/dist/chunk-HPJ5SQEL.js.map +1 -0
  35. package/dist/chunk-HTB3D3FU.cjs +3 -0
  36. package/dist/chunk-HTB3D3FU.cjs.map +1 -0
  37. package/dist/chunk-KVHLLR67.cjs +3 -0
  38. package/dist/chunk-KVHLLR67.cjs.map +1 -0
  39. package/dist/{chunk-Z4MIX43O.cjs → chunk-NIDVZMKV.cjs} +2 -2
  40. package/dist/chunk-NIDVZMKV.cjs.map +1 -0
  41. package/dist/chunk-NW5MM3Q6.js +3 -0
  42. package/dist/chunk-NW5MM3Q6.js.map +1 -0
  43. package/dist/{chunk-TCDB45AW.js → chunk-QXZVDT54.js} +2 -2
  44. package/dist/{chunk-TCDB45AW.js.map → chunk-QXZVDT54.js.map} +1 -1
  45. package/dist/chunk-SXLHFK7M.cjs +2 -0
  46. package/dist/{chunk-NH74IT7B.cjs.map → chunk-SXLHFK7M.cjs.map} +1 -1
  47. package/dist/{chunk-OBQC7KDY.cjs → chunk-TIWNKFSD.cjs} +2 -2
  48. package/dist/{chunk-OBQC7KDY.cjs.map → chunk-TIWNKFSD.cjs.map} +1 -1
  49. package/dist/chunk-TSVKHY5E.js +2 -0
  50. package/dist/{chunk-A34R65WT.js.map → chunk-TSVKHY5E.js.map} +1 -1
  51. package/dist/chunk-U5PPRJ3B.cjs +2 -0
  52. package/dist/chunk-U5PPRJ3B.cjs.map +1 -0
  53. package/dist/chunk-VOWMVLVV.cjs +2 -0
  54. package/dist/chunk-VOWMVLVV.cjs.map +1 -0
  55. package/dist/{chunk-R6NGKIBC.cjs → chunk-VZ4FEVWA.cjs} +2 -2
  56. package/dist/{chunk-R6NGKIBC.cjs.map → chunk-VZ4FEVWA.cjs.map} +1 -1
  57. package/dist/{chunk-TFZNEEJR.js → chunk-XAKFFIMQ.js} +3 -3
  58. package/dist/{chunk-TFZNEEJR.js.map → chunk-XAKFFIMQ.js.map} +1 -1
  59. package/dist/constants.cjs +1 -1
  60. package/dist/constants.js +1 -1
  61. package/dist/engine.cjs +1 -1
  62. package/dist/engine.d.cts +7 -7
  63. package/dist/engine.d.ts +7 -7
  64. package/dist/engine.js +1 -1
  65. package/dist/engine.worker.cjs +1 -1
  66. package/dist/engine.worker.js +1 -1
  67. package/dist/format.cjs +1 -1
  68. package/dist/format.d.cts +1 -1
  69. package/dist/format.d.ts +1 -1
  70. package/dist/format.js +1 -1
  71. package/dist/index.cjs +1 -1
  72. package/dist/index.d.cts +7 -7
  73. package/dist/index.d.ts +7 -7
  74. package/dist/index.js +1 -1
  75. package/dist/language.d.cts +6 -6
  76. package/dist/language.d.ts +6 -6
  77. package/dist/packages.cjs +1 -1
  78. package/dist/packages.d.cts +5 -5
  79. package/dist/packages.d.ts +5 -5
  80. package/dist/packages.js +1 -1
  81. package/dist/parser.d.cts +3 -3
  82. package/dist/parser.d.ts +3 -3
  83. package/dist/{pipeline-CADMN2D1.d.ts → pipeline-CLegjVrf.d.ts} +1 -1
  84. package/dist/{pipeline-C1-CJnFJ.d.cts → pipeline-DKNPr6s8.d.cts} +1 -1
  85. package/dist/resolvers.d.cts +1 -1
  86. package/dist/resolvers.d.ts +1 -1
  87. package/dist/testing.cjs +2 -2
  88. package/dist/testing.d.cts +6 -6
  89. package/dist/testing.d.ts +6 -6
  90. package/dist/testing.js +1 -1
  91. package/dist/uom.cjs +1 -1
  92. package/dist/uom.d.cts +1 -1
  93. package/dist/uom.d.ts +1 -1
  94. package/dist/uom.js +1 -1
  95. package/dist/vm.cjs +1 -1
  96. package/dist/vm.d.cts +4 -4
  97. package/dist/vm.d.ts +4 -4
  98. package/dist/vm.js +1 -1
  99. package/dist/worker.cjs +2 -2
  100. package/dist/worker.d.cts +5 -5
  101. package/dist/worker.d.ts +5 -5
  102. package/dist/worker.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/chunk-44E7U4O5.js +0 -3
  105. package/dist/chunk-44E7U4O5.js.map +0 -1
  106. package/dist/chunk-54QMY2VL.cjs +0 -2
  107. package/dist/chunk-54QMY2VL.cjs.map +0 -1
  108. package/dist/chunk-5TCSFTZD.js +0 -2
  109. package/dist/chunk-5TCSFTZD.js.map +0 -1
  110. package/dist/chunk-5TVI2UPZ.cjs +0 -2
  111. package/dist/chunk-5TVI2UPZ.cjs.map +0 -1
  112. package/dist/chunk-6FBXJYWO.cjs +0 -3
  113. package/dist/chunk-6FBXJYWO.cjs.map +0 -1
  114. package/dist/chunk-A34R65WT.js +0 -2
  115. package/dist/chunk-KSOB5FCI.js +0 -3
  116. package/dist/chunk-KSOB5FCI.js.map +0 -1
  117. package/dist/chunk-NH74IT7B.cjs +0 -2
  118. package/dist/chunk-QP4VIEXZ.js.map +0 -1
  119. package/dist/chunk-QT4IQADG.cjs +0 -3
  120. package/dist/chunk-QT4IQADG.cjs.map +0 -1
  121. package/dist/chunk-Y5ZY6DPX.cjs +0 -2
  122. package/dist/chunk-Y5ZY6DPX.cjs.map +0 -1
  123. package/dist/chunk-Z4MIX43O.cjs.map +0 -1
  124. package/dist/chunk-ZISAN7NW.js +0 -2
  125. package/dist/chunk-ZISAN7NW.js.map +0 -1
  126. package/dist/chunk-ZSFOIBIH.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ 'use strict';var d={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function s(r){return Math.min(255,Math.max(0,Math.round(r)))}function b(r){return Math.min(1,Math.max(0,r))}function f(r){return s(r).toString(16).padStart(2,"0")}function v(r){return String(Number(r.toFixed(3)))}function R(r){let e=r.startsWith("#")?r.slice(1):r;if(!/^[0-9a-fA-F]+$/.test(e))return null;let n=o=>parseInt(o+o,16),t=o=>parseInt(o,16);switch(e.length){case 3:return {r:n(e[0]),g:n(e[1]),b:n(e[2]),a:1,format:"hex"};case 4:return {r:n(e[0]),g:n(e[1]),b:n(e[2]),a:n(e[3])/255,format:"hex"};case 6:return {r:t(e.slice(0,2)),g:t(e.slice(2,4)),b:t(e.slice(4,6)),a:1,format:"hex"};case 8:return {r:t(e.slice(0,2)),g:t(e.slice(2,4)),b:t(e.slice(4,6)),a:t(e.slice(6,8))/255,format:"hex"};default:return null}}function F(r){let e=r.trim().toLowerCase();if(e==="transparent")return {r:0,g:0,b:0,a:0,format:"named",name:"transparent"};let n=Object.prototype.hasOwnProperty.call(d,e)?d[e]:void 0;return n?{r:n[0],g:n[1],b:n[2],a:1,format:"named",name:e}:null}function W(r){let e=r.trim();if(e.startsWith("#")||/^[0-9a-fA-F]{3,8}$/.test(e)){let n=R(e);if(n)return n}return F(e)}function C(r,e,n){let t=r/255,o=e/255,a=n/255,l=Math.max(t,o,a),u=Math.min(t,o,a),i=(l+u)/2;if(l===u)return {h:0,s:0,l:i};let m=l-u,q=i>.5?m/(2-l-u):m/(l+u),c;return l===t?c=(o-a)/m+(o<a?6:0):l===o?c=(a-t)/m+2:c=(t-o)/m+4,{h:c*60,s:q,l:i}}function M(r,e,n){if(e===0){let u=s(n*255);return {r:u,g:u,b:u}}let t=n<.5?n*(1+e):n+e-n*e,o=2*n-t,a=(r%360+360)%360/360,l=u=>{let i=u;return i<0&&(i+=1),i>1&&(i-=1),i<1/6?o+(t-o)*6*i:i<1/2?t:i<2/3?o+(t-o)*(2/3-i)*6:o};return {r:s(l(a+1/3)*255),g:s(l(a)*255),b:s(l(a-1/3)*255)}}function A(r){let e=`#${f(r.r)}${f(r.g)}${f(r.b)}`;return r.a<1?`${e}${f(r.a*255)}`:e}function _(r){switch(r.format){case "rgb":return `rgb(${r.r}, ${r.g}, ${r.b})`;case "rgba":return `rgba(${r.r}, ${r.g}, ${r.b}, ${v(r.a)})`;case "hsl":{let{h:e,s:n,l:t}=C(r.r,r.g,r.b);return `hsl(${Math.round(e)}, ${Math.round(n*100)}%, ${Math.round(t*100)}%)`}case "hsla":{let{h:e,s:n,l:t}=C(r.r,r.g,r.b);return `hsla(${Math.round(e)}, ${Math.round(n*100)}%, ${Math.round(t*100)}%, ${v(r.a)})`}case "named":return r.name??A(r);default:return A(r)}}function h(r){let e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function $(r){return .2126*h(r.r)+.7152*h(r.g)+.0722*h(r.b)}function x(r,e){let n=$(r)+.05,t=$(e)+.05;return n>t?n/t:t/n}function D(r,e){let n=r.format==="named"?"hex":r.format;return {r:e.r??r.r,g:e.g??r.g,b:e.b??r.b,a:e.a??r.a,format:n}}function g(r,e){let n=C(r.r,r.g,r.b);e(n);let{r:t,g:o,b:a}=M(n.h,n.s,n.l);return D(r,{r:t,g:o,b:a})}function j(r,e){return g(r,n=>n.l=b(n.l+e))}function E(r,e){return g(r,n=>n.l=b(n.l-e))}function B(r,e){return g(r,n=>n.s=b(n.s+e))}function P(r,e){return g(r,n=>n.s=b(n.s-e))}function H(r,e){return g(r,n=>n.h=((n.h+e)%360+360)%360)}function G(r){return H(r,180)}function U(r){let e=s(.299*r.r+.587*r.g+.114*r.b);return D(r,{r:e,g:e,b:e})}function z(r,e=1){let n=b(e);return D(r,{r:s(r.r+(255-2*r.r)*n),g:s(r.g+(255-2*r.g)*n),b:s(r.b+(255-2*r.b)*n)})}function y(r,e,n=.5){let t=b(n),o=(l,u)=>l*(1-t)+u*t,a=r.format==="named"?"hex":r.format;return {r:s(o(r.r,e.r)),g:s(o(r.g,e.g)),b:s(o(r.b,e.b)),a:b(o(r.a,e.a)),format:a}}function K(r,e){let n=b(e),t=r.format;return n<1&&(t==="rgb"?t="rgba":t==="hsl"?t="hsla":t==="named"&&(t="hex")),{r:r.r,g:r.g,b:r.b,a:n,format:t}}var k={r:255,g:255,b:255,a:1,format:"hex"},w={r:0,g:0,b:0,a:1,format:"hex"},I={r:128,g:128,b:128,a:1};function V(r,e,n){let t=(r%360+360)%360/60,o=n*e,a=o*(1-Math.abs(t%2-1)),l=n-o,u=0,i=0,m=0;return t<1?[u,i,m]=[o,a,0]:t<2?[u,i,m]=[a,o,0]:t<3?[u,i,m]=[0,o,a]:t<4?[u,i,m]=[0,a,o]:t<5?[u,i,m]=[a,0,o]:[u,i,m]=[o,0,a],{r:s((u+l)*255),g:s((i+l)*255),b:s((m+l)*255)}}function Y(r,e,n){let t=b(e),o=b(n);if(t+o>=1){let u=s(t/(t+o)*255);return {r:u,g:u,b:u}}let a=M(r,1,.5),l=u=>s(u*(1-t-o)+t*255);return {r:l(a.r),g:l(a.g),b:l(a.b)}}function J(r,e){return y(r,k,e)}function Q(r,e){return y(r,w,e)}function X(r,e){return y(r,I,e)}function N(r){return x(r,k)>=x(r,w)}function Z(r){return N(r)?k:w}var p={aa:4.5,aaa:7,aaLarge:3,aaaLarge:4.5};function rr(r,e){let n=x(r,e);return n>=p.aaa?"AAA":n>=p.aa?"AA":n>=p.aaLarge?"AA Large":"Fail"}function nr(r){let e=/^\/(\d{1,2})$/.exec(r);if(e){let l=Number(e[1]);return l<=32?{prefix:l}:null}let n=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})(?:\/(\d{1,2}))?$/.exec(r);if(!n)return null;let t=[Number(n[1]),Number(n[2]),Number(n[3]),Number(n[4])];if(t.some(l=>l>255))return null;let o=(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;if(n[5]===void 0)return {addr:o};let a=Number(n[5]);return a>32?null:{addr:o,prefix:a}}function tr(r){return [r>>>24&255,r>>>16&255,r>>>8&255,r&255].join(".")}function S(r){return r===0?0:4294967295<<32-r>>>0}function or(r){return r>=31?r===32?1:2:Math.pow(2,32-r)-2}function L(r,e){return (r&S(e))>>>0}function ar(r,e){return (r|~S(e)>>>0)>>>0}function ur(r,e,n){return L(r,n)===L(e,n)}exports.A=p;exports.B=rr;exports.C=nr;exports.D=tr;exports.E=S;exports.F=or;exports.G=ar;exports.H=ur;exports.a=s;exports.b=b;exports.c=W;exports.d=C;exports.e=M;exports.f=A;exports.g=_;exports.h=$;exports.i=x;exports.j=j;exports.k=E;exports.l=B;exports.m=P;exports.n=H;exports.o=G;exports.p=U;exports.q=z;exports.r=y;exports.s=K;exports.t=V;exports.u=Y;exports.v=J;exports.w=Q;exports.x=X;exports.y=N;exports.z=Z;//# sourceMappingURL=chunk-3ZFJLH4W.cjs.map
2
+ //# sourceMappingURL=chunk-3ZFJLH4W.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/packages/colour/CssNamedColours.ts","../src/packages/colour/ColourMath.ts","../src/packages/ip/IpMath.ts"],"names":["CSS_NAMED_COLOURS","clamp255","x","clamp01","hexByte","n","formatAlpha","a","parseHex","input","s","dbl","h","pair","namedColour","name","key","rgb","parseColour","trimmed","hex","rgbToHsl","g","b","rn","gn","bn","max","min","l","d","hslToRgb","v","q","p","hn","hue","t","tt","toHexString","c","base","formatColour","linearise","channel8","cs","relativeLuminance","contrastRatio","la","lb","derive","next","format","adjustHsl","fn","hsl","r","lighten","amount","darken","saturate","desaturate","rotateHue","degrees","complement","grayscale","y","invert","mix","weight","lerp","withAlpha","alpha","WHITE","BLACK","MID_GREY","hsvToRgb","hh","m","hwbToRgb","w","wh","bl","grey","channel","ch","tint","shade","tone","isDark","readableColour","background","WCAG_THRESHOLDS","wcagLevel","ratio","parseIpCidr","text","bareprefix","prefix","match","octets","o","addr","formatIp","netmask","usableHosts","networkAddress","broadcastAddress","addressInBlock","blockAddr"],"mappings":"aASO,IAAMA,EAAiF,CAC7F,SAAA,CAAW,CAAC,GAAA,CAAK,IAAK,GAAG,CAAA,CACzB,YAAA,CAAc,CAAC,IAAK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(0-255). These are the same values every browser resolves\n * a keyword to, so `color(\"rebeccapurple\")` matches what the page would render.\n *\n * `transparent` is handled by the caller (it is `rgba(0, 0, 0, 0)`, an alpha the\n * triples here cannot express) and `currentColor` is deliberately absent: it is\n * context-dependent, not a fixed colour.\n */\nexport const CSS_NAMED_COLOURS: Readonly<Record<string, readonly [number, number, number]>> = {\n\taliceblue: [240, 248, 255],\n\tantiquewhite: [250, 235, 215],\n\taqua: [0, 255, 255],\n\taquamarine: [127, 255, 212],\n\tazure: [240, 255, 255],\n\tbeige: [245, 245, 220],\n\tbisque: [255, 228, 196],\n\tblack: [0, 0, 0],\n\tblanchedalmond: [255, 235, 205],\n\tblue: [0, 0, 255],\n\tblueviolet: [138, 43, 226],\n\tbrown: [165, 42, 42],\n\tburlywood: [222, 184, 135],\n\tcadetblue: [95, 158, 160],\n\tchartreuse: [127, 255, 0],\n\tchocolate: [210, 105, 30],\n\tcoral: [255, 127, 80],\n\tcornflowerblue: [100, 149, 237],\n\tcornsilk: [255, 248, 220],\n\tcrimson: [220, 20, 60],\n\tcyan: [0, 255, 255],\n\tdarkblue: [0, 0, 139],\n\tdarkcyan: [0, 139, 139],\n\tdarkgoldenrod: [184, 134, 11],\n\tdarkgray: [169, 169, 169],\n\tdarkgreen: [0, 100, 0],\n\tdarkgrey: [169, 169, 169],\n\tdarkkhaki: [189, 183, 107],\n\tdarkmagenta: [139, 0, 139],\n\tdarkolivegreen: [85, 107, 47],\n\tdarkorange: [255, 140, 0],\n\tdarkorchid: [153, 50, 204],\n\tdarkred: [139, 0, 0],\n\tdarksalmon: [233, 150, 122],\n\tdarkseagreen: [143, 188, 143],\n\tdarkslateblue: [72, 61, 139],\n\tdarkslategray: [47, 79, 79],\n\tdarkslategrey: [47, 79, 79],\n\tdarkturquoise: [0, 206, 209],\n\tdarkviolet: [148, 0, 211],\n\tdeeppink: [255, 20, 147],\n\tdeepskyblue: [0, 191, 255],\n\tdimgray: [105, 105, 105],\n\tdimgrey: [105, 105, 105],\n\tdodgerblue: [30, 144, 255],\n\tfirebrick: [178, 34, 34],\n\tfloralwhite: [255, 250, 240],\n\tforestgreen: [34, 139, 34],\n\tfuchsia: [255, 0, 255],\n\tgainsboro: [220, 220, 220],\n\tghostwhite: [248, 248, 255],\n\tgold: [255, 215, 0],\n\tgoldenrod: [218, 165, 32],\n\tgray: [128, 128, 128],\n\tgreen: [0, 128, 0],\n\tgreenyellow: [173, 255, 47],\n\tgrey: [128, 128, 128],\n\thoneydew: [240, 255, 240],\n\thotpink: [255, 105, 180],\n\tindianred: [205, 92, 92],\n\tindigo: [75, 0, 130],\n\tivory: [255, 255, 240],\n\tkhaki: [240, 230, 140],\n\tlavender: [230, 230, 250],\n\tlavenderblush: [255, 240, 245],\n\tlawngreen: [124, 252, 0],\n\tlemonchiffon: [255, 250, 205],\n\tlightblue: [173, 216, 230],\n\tlightcoral: [240, 128, 128],\n\tlightcyan: [224, 255, 255],\n\tlightgoldenrodyellow: [250, 250, 210],\n\tlightgray: [211, 211, 211],\n\tlightgreen: [144, 238, 144],\n\tlightgrey: [211, 211, 211],\n\tlightpink: [255, 182, 193],\n\tlightsalmon: [255, 160, 122],\n\tlightseagreen: [32, 178, 170],\n\tlightskyblue: [135, 206, 250],\n\tlightslategray: [119, 136, 153],\n\tlightslategrey: [119, 136, 153],\n\tlightsteelblue: [176, 196, 222],\n\tlightyellow: [255, 255, 224],\n\tlime: [0, 255, 0],\n\tlimegreen: [50, 205, 50],\n\tlinen: [250, 240, 230],\n\tmagenta: [255, 0, 255],\n\tmaroon: [128, 0, 0],\n\tmediumaquamarine: [102, 205, 170],\n\tmediumblue: [0, 0, 205],\n\tmediumorchid: [186, 85, 211],\n\tmediumpurple: [147, 112, 219],\n\tmediumseagreen: [60, 179, 113],\n\tmediumslateblue: [123, 104, 238],\n\tmediumspringgreen: [0, 250, 154],\n\tmediumturquoise: [72, 209, 204],\n\tmediumvioletred: [199, 21, 133],\n\tmidnightblue: [25, 25, 112],\n\tmintcream: [245, 255, 250],\n\tmistyrose: [255, 228, 225],\n\tmoccasin: [255, 228, 181],\n\tnavajowhite: [255, 222, 173],\n\tnavy: [0, 0, 128],\n\toldlace: [253, 245, 230],\n\tolive: [128, 128, 0],\n\tolivedrab: [107, 142, 35],\n\torange: [255, 165, 0],\n\torangered: [255, 69, 0],\n\torchid: [218, 112, 214],\n\tpalegoldenrod: [238, 232, 170],\n\tpalegreen: [152, 251, 152],\n\tpaleturquoise: [175, 238, 238],\n\tpalevioletred: [219, 112, 147],\n\tpapayawhip: [255, 239, 213],\n\tpeachpuff: [255, 218, 185],\n\tperu: [205, 133, 63],\n\tpink: [255, 192, 203],\n\tplum: [221, 160, 221],\n\tpowderblue: [176, 224, 230],\n\tpurple: [128, 0, 128],\n\trebeccapurple: [102, 51, 153],\n\tred: [255, 0, 0],\n\trosybrown: [188, 143, 143],\n\troyalblue: [65, 105, 225],\n\tsaddlebrown: [139, 69, 19],\n\tsalmon: [250, 128, 114],\n\tsandybrown: [244, 164, 96],\n\tseagreen: [46, 139, 87],\n\tseashell: [255, 245, 238],\n\tsienna: [160, 82, 45],\n\tsilver: [192, 192, 192],\n\tskyblue: [135, 206, 235],\n\tslateblue: [106, 90, 205],\n\tslategray: [112, 128, 144],\n\tslategrey: [112, 128, 144],\n\tsnow: [255, 250, 250],\n\tspringgreen: [0, 255, 127],\n\tsteelblue: [70, 130, 180],\n\ttan: [210, 180, 140],\n\tteal: [0, 128, 128],\n\tthistle: [216, 191, 216],\n\ttomato: [255, 99, 71],\n\tturquoise: [64, 224, 208],\n\tviolet: [238, 130, 238],\n\twheat: [245, 222, 179],\n\twhite: [255, 255, 255],\n\twhitesmoke: [245, 245, 245],\n\tyellow: [255, 255, 0],\n\tyellowgreen: [154, 205, 50],\n};\n","/**\n * Pure colour maths for the colour package. Everything here is a plain function\n * over numbers and {@link ColourData} with no engine imports and no side effects,\n * so it is trivially unit-testable and can be reused by a host renderer (the docs\n * notepad reads these to draw a swatch). Canonical storage is sRGB: `r`,`g`,`b`\n * are integers 0-255 and `a` is 0-1. HSL is derived on demand and re-quantised,\n * never stored, so equal-and-opposite operations return to a stable colour.\n */\nimport type { ColourData, ColourFormat } from \"@solve-js/vm/Value\";\nimport { CSS_NAMED_COLOURS } from \"./CssNamedColours\";\n\n/** Round and clamp a value to a valid 0-255 sRGB channel. */\nexport function clamp255(x: number): number {\n\treturn Math.min(255, Math.max(0, Math.round(x)));\n}\n\n/** Clamp a value to the 0-1 range used for alpha and normalised HSL. */\nexport function clamp01(x: number): number {\n\treturn Math.min(1, Math.max(0, x));\n}\n\nfunction hexByte(n: number): string {\n\treturn clamp255(n).toString(16).padStart(2, \"0\");\n}\n\n/**\n * Render the alpha channel the way CSS does: a plain decimal with no trailing\n * zeros (`1`, `0.5`, `0.333`), so `rgba(255, 0, 0, 0.5)` reads back cleanly.\n */\nfunction formatAlpha(a: number): string {\n\treturn String(Number(a.toFixed(3)));\n}\n\n// ── Parsing ─────────────────────────────────────────────────────────────\n\n/**\n * Parse a CSS hex colour: `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA`,\n * case-insensitive, leading `#` optional. Three and four digit forms expand each\n * nibble (`f` becomes `ff`), matching a browser. Any other length or a non-hex\n * character returns null so the caller can raise a clear error.\n */\nexport function parseHex(input: string): ColourData | null {\n\tconst s = input.startsWith(\"#\") ? input.slice(1) : input;\n\tif (!/^[0-9a-fA-F]+$/.test(s)) return null;\n\tconst dbl = (h: string): number => parseInt(h + h, 16);\n\tconst pair = (h: string): number => parseInt(h, 16);\n\tswitch (s.length) {\n\t\tcase 3:\n\t\t\treturn { r: dbl(s[0]), g: dbl(s[1]), b: dbl(s[2]), a: 1, format: \"hex\" };\n\t\tcase 4:\n\t\t\treturn { r: dbl(s[0]), g: dbl(s[1]), b: dbl(s[2]), a: dbl(s[3]) / 255, format: \"hex\" };\n\t\tcase 6:\n\t\t\treturn { r: pair(s.slice(0, 2)), g: pair(s.slice(2, 4)), b: pair(s.slice(4, 6)), a: 1, format: \"hex\" };\n\t\tcase 8:\n\t\t\treturn {\n\t\t\t\tr: pair(s.slice(0, 2)),\n\t\t\t\tg: pair(s.slice(2, 4)),\n\t\t\t\tb: pair(s.slice(4, 6)),\n\t\t\t\ta: pair(s.slice(6, 8)) / 255,\n\t\t\t\tformat: \"hex\",\n\t\t\t};\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\n/**\n * Resolve a CSS named colour (case-insensitive), including `transparent`. Returns\n * null for an unknown keyword so the caller can raise an error.\n */\nexport function namedColour(name: string): ColourData | null {\n\tconst key = name.trim().toLowerCase();\n\tif (key === \"transparent\") return { r: 0, g: 0, b: 0, a: 0, format: \"named\", name: \"transparent\" };\n\tconst rgb = Object.prototype.hasOwnProperty.call(CSS_NAMED_COLOURS, key) ? CSS_NAMED_COLOURS[key] : undefined;\n\tif (!rgb) return null;\n\treturn { r: rgb[0], g: rgb[1], b: rgb[2], a: 1, format: \"named\", name: key };\n}\n\n/** Parse either a hex string or a named colour; null if neither. */\nexport function parseColour(input: string): ColourData | null {\n\tconst trimmed = input.trim();\n\tif (trimmed.startsWith(\"#\") || /^[0-9a-fA-F]{3,8}$/.test(trimmed)) {\n\t\tconst hex = parseHex(trimmed);\n\t\tif (hex) return hex;\n\t}\n\treturn namedColour(trimmed);\n}\n\n// ── RGB <-> HSL ─────────────────────────────────────────────────────────\n\n/** Convert sRGB (0-255) to HSL with h in [0, 360), s and l in [0, 1]. */\nexport function rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number } {\n\tconst rn = r / 255;\n\tconst gn = g / 255;\n\tconst bn = b / 255;\n\tconst max = Math.max(rn, gn, bn);\n\tconst min = Math.min(rn, gn, bn);\n\tconst l = (max + min) / 2;\n\tif (max === min) return { h: 0, s: 0, l };\n\tconst d = max - min;\n\tconst s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\tlet h: number;\n\tif (max === rn) h = (gn - bn) / d + (gn < bn ? 6 : 0);\n\telse if (max === gn) h = (bn - rn) / d + 2;\n\telse h = (rn - gn) / d + 4;\n\treturn { h: h * 60, s, l };\n}\n\n/** Convert HSL (h in degrees, s and l in [0, 1]) to sRGB (0-255 integers). */\nexport function hslToRgb(h: number, s: number, l: number): { r: number; g: number; b: number } {\n\tif (s === 0) {\n\t\tconst v = clamp255(l * 255);\n\t\treturn { r: v, g: v, b: v };\n\t}\n\tconst q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\tconst p = 2 * l - q;\n\tconst hn = (((h % 360) + 360) % 360) / 360;\n\tconst hue = (t: number): number => {\n\t\tlet tt = t;\n\t\tif (tt < 0) tt += 1;\n\t\tif (tt > 1) tt -= 1;\n\t\tif (tt < 1 / 6) return p + (q - p) * 6 * tt;\n\t\tif (tt < 1 / 2) return q;\n\t\tif (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;\n\t\treturn p;\n\t};\n\treturn {\n\t\tr: clamp255(hue(hn + 1 / 3) * 255),\n\t\tg: clamp255(hue(hn) * 255),\n\t\tb: clamp255(hue(hn - 1 / 3) * 255),\n\t};\n}\n\n// ── Display ─────────────────────────────────────────────────────────────\n\n/** Canonical hex string, `#rrggbb`, extended to `#rrggbbaa` only when a < 1. */\nexport function toHexString(c: ColourData): string {\n\tconst base = `#${hexByte(c.r)}${hexByte(c.g)}${hexByte(c.b)}`;\n\treturn c.a < 1 ? `${base}${hexByte(c.a * 255)}` : base;\n}\n\n/**\n * Render a colour as the CSS string matching its authored `format`. Always valid\n * CSS, so a host can drop it straight into a `background` (this is both the\n * displayed answer text and the DTO `css` field).\n */\nexport function formatColour(c: ColourData): string {\n\tswitch (c.format) {\n\t\tcase \"rgb\":\n\t\t\treturn `rgb(${c.r}, ${c.g}, ${c.b})`;\n\t\tcase \"rgba\":\n\t\t\treturn `rgba(${c.r}, ${c.g}, ${c.b}, ${formatAlpha(c.a)})`;\n\t\tcase \"hsl\": {\n\t\t\tconst { h, s, l } = rgbToHsl(c.r, c.g, c.b);\n\t\t\treturn `hsl(${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`;\n\t\t}\n\t\tcase \"hsla\": {\n\t\t\tconst { h, s, l } = rgbToHsl(c.r, c.g, c.b);\n\t\t\treturn `hsla(${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%, ${formatAlpha(c.a)})`;\n\t\t}\n\t\tcase \"named\":\n\t\t\treturn c.name ?? toHexString(c);\n\t\tcase \"hex\":\n\t\tdefault:\n\t\t\treturn toHexString(c);\n\t}\n}\n\n// ── WCAG luminance and contrast ─────────────────────────────────────────\n\nfunction linearise(channel8: number): number {\n\tconst cs = channel8 / 255;\n\treturn cs <= 0.03928 ? cs / 12.92 : Math.pow((cs + 0.055) / 1.055, 2.4);\n}\n\n/** WCAG relative luminance, 0 (black) to 1 (white). Alpha is ignored, per WCAG. */\nexport function relativeLuminance(c: ColourData): number {\n\treturn 0.2126 * linearise(c.r) + 0.7152 * linearise(c.g) + 0.0722 * linearise(c.b);\n}\n\n/** WCAG contrast ratio between two colours, 1 (identical) to 21 (black on white). */\nexport function contrastRatio(a: ColourData, b: ColourData): number {\n\tconst la = relativeLuminance(a) + 0.05;\n\tconst lb = relativeLuminance(b) + 0.05;\n\treturn la > lb ? la / lb : lb / la;\n}\n\n// ── Operations ──────────────────────────────────────────────────────────\n\n/**\n * Rebuild a colour from new channels, preserving the display format and alpha\n * unless overridden. A `named` colour whose channels change is no longer that\n * keyword, so it falls back to hex display.\n */\nfunction derive(c: ColourData, next: { r?: number; g?: number; b?: number; a?: number }): ColourData {\n\tconst format: ColourFormat = c.format === \"named\" ? \"hex\" : c.format;\n\treturn {\n\t\tr: next.r ?? c.r,\n\t\tg: next.g ?? c.g,\n\t\tb: next.b ?? c.b,\n\t\ta: next.a ?? c.a,\n\t\tformat,\n\t};\n}\n\nfunction adjustHsl(c: ColourData, fn: (hsl: { h: number; s: number; l: number }) => void): ColourData {\n\tconst hsl = rgbToHsl(c.r, c.g, c.b);\n\tfn(hsl);\n\tconst { r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l);\n\treturn derive(c, { r, g, b });\n}\n\n/** Increase lightness by `amount` (a fraction 0-1). */\nexport function lighten(c: ColourData, amount: number): ColourData {\n\treturn adjustHsl(c, (hsl) => (hsl.l = clamp01(hsl.l + amount)));\n}\n\n/** Decrease lightness by `amount`. */\nexport function darken(c: ColourData, amount: number): ColourData {\n\treturn adjustHsl(c, (hsl) => (hsl.l = clamp01(hsl.l - amount)));\n}\n\n/** Increase saturation by `amount`. */\nexport function saturate(c: ColourData, amount: number): ColourData {\n\treturn adjustHsl(c, (hsl) => (hsl.s = clamp01(hsl.s + amount)));\n}\n\n/** Decrease saturation by `amount`. */\nexport function desaturate(c: ColourData, amount: number): ColourData {\n\treturn adjustHsl(c, (hsl) => (hsl.s = clamp01(hsl.s - amount)));\n}\n\n/** Rotate the hue by `degrees` (wraps at 360). */\nexport function rotateHue(c: ColourData, degrees: number): ColourData {\n\treturn adjustHsl(c, (hsl) => (hsl.h = ((hsl.h + degrees) % 360 + 360) % 360));\n}\n\n/** The colour on the opposite side of the wheel (hue + 180). */\nexport function complement(c: ColourData): ColourData {\n\treturn rotateHue(c, 180);\n}\n\n/** Convert to grey using Rec.601 luma, preserving alpha. */\nexport function grayscale(c: ColourData): ColourData {\n\tconst y = clamp255(0.299 * c.r + 0.587 * c.g + 0.114 * c.b);\n\treturn derive(c, { r: y, g: y, b: y });\n}\n\n/** Invert each channel by `amount` (1 = full inversion), preserving alpha. */\nexport function invert(c: ColourData, amount = 1): ColourData {\n\tconst t = clamp01(amount);\n\treturn derive(c, {\n\t\tr: clamp255(c.r + (255 - 2 * c.r) * t),\n\t\tg: clamp255(c.g + (255 - 2 * c.g) * t),\n\t\tb: clamp255(c.b + (255 - 2 * c.b) * t),\n\t});\n}\n\n/**\n * Blend two colours by linear sRGB interpolation, `weight` toward `b` (0.5 is the\n * midpoint). This matches Sass `mix()` and DevTools blending; it is not\n * perceptually uniform (that would be Oklab), a deliberate zero-dependency choice.\n */\nexport function mix(a: ColourData, b: ColourData, weight = 0.5): ColourData {\n\tconst t = clamp01(weight);\n\tconst lerp = (x: number, y: number): number => x * (1 - t) + y * t;\n\tconst format: ColourFormat = a.format === \"named\" ? \"hex\" : a.format;\n\treturn {\n\t\tr: clamp255(lerp(a.r, b.r)),\n\t\tg: clamp255(lerp(a.g, b.g)),\n\t\tb: clamp255(lerp(a.b, b.b)),\n\t\ta: clamp01(lerp(a.a, b.a)),\n\t\tformat,\n\t};\n}\n\n/** Set the alpha channel, upgrading the display format so the alpha shows. */\nexport function withAlpha(c: ColourData, alpha: number): ColourData {\n\tconst a = clamp01(alpha);\n\tlet format: ColourFormat = c.format;\n\tif (a < 1) {\n\t\tif (format === \"rgb\") format = \"rgba\";\n\t\telse if (format === \"hsl\") format = \"hsla\";\n\t\telse if (format === \"named\") format = \"hex\";\n\t}\n\treturn { r: c.r, g: c.g, b: c.b, a, format };\n}\n\n// ── Additional colour spaces and helpers ────────────────────────────────\n\n/** Opaque white and black, reused by the luminance-based helpers below. */\nconst WHITE: ColourData = { r: 255, g: 255, b: 255, a: 1, format: \"hex\" };\nconst BLACK: ColourData = { r: 0, g: 0, b: 0, a: 1, format: \"hex\" };\nconst MID_GREY: ColourData = { r: 128, g: 128, b: 128, a: 1, format: \"hex\" };\n\n/**\n * Convert HSV/HSB (hue in degrees, saturation and value in 0-1) to sRGB. HSV is\n * the wheel most colour pickers present (DevTools included), distinct from HSL:\n * `value` is how bright the colour is, where HSL's `lightness` is how close to\n * white or black.\n */\nexport function hsvToRgb(h: number, s: number, v: number): { r: number; g: number; b: number } {\n\tconst hh = ((((h % 360) + 360) % 360)) / 60;\n\tconst c = v * s;\n\tconst x = c * (1 - Math.abs((hh % 2) - 1));\n\tconst m = v - c;\n\tlet r = 0;\n\tlet g = 0;\n\tlet b = 0;\n\tif (hh < 1) [r, g, b] = [c, x, 0];\n\telse if (hh < 2) [r, g, b] = [x, c, 0];\n\telse if (hh < 3) [r, g, b] = [0, c, x];\n\telse if (hh < 4) [r, g, b] = [0, x, c];\n\telse if (hh < 5) [r, g, b] = [x, 0, c];\n\telse [r, g, b] = [c, 0, x];\n\treturn { r: clamp255((r + m) * 255), g: clamp255((g + m) * 255), b: clamp255((b + m) * 255) };\n}\n\n/**\n * Convert HWB (hue in degrees, whiteness and blackness in 0-1) to sRGB, the CSS\n * Color 4 model: start from the pure hue and mix in white and black. When\n * whiteness and blackness sum to 1 or more the hue washes out to grey.\n */\nexport function hwbToRgb(h: number, w: number, b: number): { r: number; g: number; b: number } {\n\tconst wh = clamp01(w);\n\tconst bl = clamp01(b);\n\tif (wh + bl >= 1) {\n\t\tconst grey = clamp255((wh / (wh + bl)) * 255);\n\t\treturn { r: grey, g: grey, b: grey };\n\t}\n\tconst base = hslToRgb(h, 1, 0.5);\n\tconst channel = (ch: number): number => clamp255(ch * (1 - wh - bl) + wh * 255);\n\treturn { r: channel(base.r), g: channel(base.g), b: channel(base.b) };\n}\n\n/** Mix toward white by `amount` (a tint). */\nexport function tint(c: ColourData, amount: number): ColourData {\n\treturn mix(c, WHITE, amount);\n}\n\n/** Mix toward black by `amount` (a shade). */\nexport function shade(c: ColourData, amount: number): ColourData {\n\treturn mix(c, BLACK, amount);\n}\n\n/** Mix toward mid-grey by `amount` (a tone). */\nexport function tone(c: ColourData, amount: number): ColourData {\n\treturn mix(c, MID_GREY, amount);\n}\n\n/**\n * Whether a colour reads as dark, meaning white text on it has at least as much\n * WCAG contrast as black text does. Backs {@link readableColour} and the\n * `isdark`/`islight` predicates.\n */\nexport function isDark(c: ColourData): boolean {\n\treturn contrastRatio(c, WHITE) >= contrastRatio(c, BLACK);\n}\n\n/** Black or white, whichever has the higher WCAG contrast against `background`. */\nexport function readableColour(background: ColourData): ColourData {\n\treturn isDark(background) ? WHITE : BLACK;\n}\n\n/**\n * WCAG 2.x minimum contrast ratios. Normal text needs 4.5 (AA) or 7 (AAA); large\n * text (>= 18pt, or >= 14pt bold) and UI components need 3 (AA) or 4.5 (AAA).\n */\nexport const WCAG_THRESHOLDS = { aa: 4.5, aaa: 7, aaLarge: 3, aaaLarge: 4.5 } as const;\n\n/** The four WCAG ratings this package reports, best first. */\nexport type WcagLevel = \"AAA\" | \"AA\" | \"AA Large\" | \"Fail\";\n\n/**\n * The best WCAG 2.x rating two colours pass for normal-size text: `AAA` (ratio\n * >= 7), `AA` (>= 4.5), `AA Large` (>= 3, which meets AA only for large text or\n * UI), or `Fail` (< 3). This is the badge a contrast checker shows.\n */\nexport function wcagLevel(a: ColourData, b: ColourData): WcagLevel {\n\tconst ratio = contrastRatio(a, b);\n\tif (ratio >= WCAG_THRESHOLDS.aaa) return \"AAA\";\n\tif (ratio >= WCAG_THRESHOLDS.aa) return \"AA\";\n\tif (ratio >= WCAG_THRESHOLDS.aaLarge) return \"AA Large\";\n\treturn \"Fail\";\n}\n","/**\n * IPv4 subnet arithmetic, as pure functions (issue #189). An IPv4 address is a\n * 32-bit number written as four 0-255 parts (`192.168.1.10`); a CIDR block is\n * such an address with a prefix length (`192.168.1.0/24`), where the prefix says\n * how many leading bits name the network and the rest name hosts within it. The\n * netmask is those network bits set to 1; the broadcast address is every host\n * bit set to 1. Everything here is plain 32-bit maths, so it carries no engine\n * import and is easy to test.\n *\n * All addresses are held as unsigned 32-bit integers; `>>> 0` keeps JavaScript's\n * signed bitwise operators in the unsigned range.\n */\n\n/** A parsed address and/or prefix. A bare address has no prefix; a bare `/24` has no address. */\nexport interface ParsedIp {\n\treadonly addr?: number;\n\treadonly prefix?: number;\n}\n\n/**\n * Parses `a.b.c.d`, `a.b.c.d/n` or `/n`, or null when it is not one of those (a\n * part over 255, a prefix over 32, the wrong shape). This is what a normalizer\n * uses to decide whether a run of digits and dots is really an address.\n */\nexport function parseIpCidr(text: string): ParsedIp | null {\n\tconst bareprefix = /^\\/(\\d{1,2})$/.exec(text);\n\tif (bareprefix) {\n\t\tconst prefix = Number(bareprefix[1]);\n\t\treturn prefix <= 32 ? { prefix } : null;\n\t}\n\tconst match = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})(?:\\/(\\d{1,2}))?$/.exec(text);\n\tif (!match) return null;\n\tconst octets = [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4])];\n\tif (octets.some((o) => o > 255)) return null;\n\tconst addr = ((octets[0] << 24) | (octets[1] << 16) | (octets[2] << 8) | octets[3]) >>> 0;\n\tif (match[5] === undefined) return { addr };\n\tconst prefix = Number(match[5]);\n\tif (prefix > 32) return null;\n\treturn { addr, prefix };\n}\n\n/** A 32-bit address as its four dotted parts, e.g. `3232235786` becomes `192.168.1.10`. */\nexport function formatIp(addr: number): string {\n\treturn [(addr >>> 24) & 255, (addr >>> 16) & 255, (addr >>> 8) & 255, addr & 255].join(\".\");\n}\n\n/** The netmask for a prefix, as a 32-bit address (`/24` gives `255.255.255.0`). */\nexport function netmask(prefix: number): number {\n\treturn prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0;\n}\n\n/** The number of usable host addresses in a prefix (`/24` gives 254: 256 minus the network and broadcast). */\nexport function usableHosts(prefix: number): number {\n\tif (prefix >= 31) return prefix === 32 ? 1 : 2; // RFC 3021: a /31 is a two-host point-to-point link\n\treturn Math.pow(2, 32 - prefix) - 2;\n}\n\n/** The network address of a block: the address with its host bits cleared. */\nexport function networkAddress(addr: number, prefix: number): number {\n\treturn (addr & netmask(prefix)) >>> 0;\n}\n\n/** The broadcast address of a block: the address with its host bits all set. */\nexport function broadcastAddress(addr: number, prefix: number): number {\n\treturn (addr | (~netmask(prefix) >>> 0)) >>> 0;\n}\n\n/** Whether an address falls inside a block, i.e. shares its network. */\nexport function addressInBlock(addr: number, blockAddr: number, prefix: number): boolean {\n\treturn networkAddress(addr, prefix) === networkAddress(blockAddr, prefix);\n}\n"]}
@@ -1,3 +1,3 @@
1
- 'use strict';var chunkW4XLVZ6R_cjs=require('./chunk-W4XLVZ6R.cjs'),chunk5TVI2UPZ_cjs=require('./chunk-5TVI2UPZ.cjs'),chunkZ4MIX43O_cjs=require('./chunk-Z4MIX43O.cjs'),chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs'),chunkE4HAKNBQ_cjs=require('./chunk-E4HAKNBQ.cjs'),chunkNH74IT7B_cjs=require('./chunk-NH74IT7B.cjs'),chunkPHWIO4P3_cjs=require('./chunk-PHWIO4P3.cjs'),chunkS3DFU33X_cjs=require('./chunk-S3DFU33X.cjs');var F={floatResult:{decimalPlaces:2,enableSeperator:true},numberResult:{decimalSeparatorLocale:"en-US"},hexResult:{enablePadding:false,paddingZeros:0},unitOfMeasurementResult:{decimalPlaces:2},percentageResult:{decimalPlaces:2},dateResult:{format:"long"}};function A(t,e,r,o){let n=r.floatResult.enableSeperator,s=r.numberResult.decimalSeparatorLocale;if(o!==void 0&&Number.isFinite(t)){let m=t.toLocaleString(s||"en-US",{minimumFractionDigits:o,maximumFractionDigits:o,useGrouping:n});return `${e.display.resultPrefix}${m}`}let a=r.floatResult.decimalPlaces,c=chunkW4XLVZ6R_cjs.a(t,a,s||"en-US")??chunkW4XLVZ6R_cjs.b(t,a,n,s);return `${e.display.resultPrefix}${c}`}function k(t,e,r,o){let n=o.floatResult.decimalPlaces,s=o.floatResult.enableSeperator,a=o.numberResult.decimalSeparatorLocale||"en-US",i=Math.max(n,1),c=t.toLocaleString(a,{useGrouping:s,minimumFractionDigits:0,maximumFractionDigits:n}),m=Math.abs(e).toLocaleString(a,{useGrouping:s,minimumFractionDigits:1,maximumFractionDigits:i});return `${r.display.resultPrefix}${c} \xB1 ${m}`}function j(t,e,r){if(typeof t=="number"&&!Number.isFinite(t))return `= ${t}`;let o=typeof t=="bigint"?t<0n:t<0,n=o?"-":"",s=c=>typeof t=="bigint"?(o?-t:t).toString(c):Math.abs(Math.trunc(t)).toString(c);if(r==="bin")return `= ${n}0b${s(2)}`;if(r==="oct")return `= ${n}0o${s(8)}`;let a=e.hexResult.enablePadding?e.hexResult.paddingZeros:0,i=s(16).toUpperCase().padStart(a,"0");return `= ${n}0x${i}`}var B=2e4;function G(t){let e=t<0n?-t:t;if(Number.isFinite(Number(e)))return `= ${t}`;let r=e.toString(16).length*4;if(r*Math.LN2/Math.LN10<=B)return `= ${t}`;let o=r*Math.LN2/Math.LN10,n=Math.floor(o),s=Math.pow(10,o-n);return `= ${t<0n?"-":""}~${s.toFixed(3)}e+${n} (an exact integer of about ${(n+1).toLocaleString("en-US")} digits, too large to print)`}function Z(t){return `= ${t}`}function V(t){return `= ${t}`}function W(t,e,r,o){let n=r.calendar??chunkEQNKDTMX_cjs.b,s=r.dateResult?.format??"long",a=o!==void 0&&!chunkE4HAKNBQ_cjs.g(o),i=a?n.fieldsInZone(o,t):n.fields(t),c=a?0:n.fields(t).millisecond,m=i.hour===0&&i.minute===0&&i.second===0&&c===0;if(s==="long"){let f=a?chunkE4HAKNBQ_cjs.o(o,t,e.code):n.formatLongDate(t,e.code);if(m)return `= ${f}`;let $=a?chunkE4HAKNBQ_cjs.p(o,t,e.code):n.formatTimeOfDay(t,e.code);return `= ${f}, ${$}`}let u=f=>String(f).padStart(2,"0"),d=i.year,p=u(i.month0+1),g=u(i.day),l;if(s==="iso"?l=`${d}-${p}-${g}`:s==="dmy"?l=`${g}/${p}/${d}`:l=`${p}/${g}/${d}`,m)return `= ${l}`;let b=`${u(i.hour)}:${u(i.minute)}:${u(i.second)}`;return s==="iso"?`= ${l}T${b}`:`= ${l} ${b}`}function Y(t){let e=t<0?"-":"",r=Math.round(Math.abs(t)/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),s=r%60,a=String(n).padStart(2,"0");if(s===0)return `${e}${o}:${a}`;let i=String(s).padStart(2,"0");return `${e}${o}:${a}:${i}`}var H={s:1,sec:1,secs:1,second:1,seconds:1,min:60,mins:60,minute:60,minutes:60,h:3600,hr:3600,hrs:3600,hour:3600,hours:3600},K=60;function X(t,e){let r=e.indexOf("/");if(r<=0)return;let o=H[e.slice(0,r).toLowerCase()];if(o===void 0)return;let n=e.slice(r+1);if(chunkPHWIO4P3_cjs.c(n)!=="length")return;let s=t*o;if(!Number.isFinite(s)||Math.abs(s)<K)return;let a=s<0?"-":"",i=Math.round(Math.abs(s)),c=Math.floor(i/3600),m=String(Math.floor(i%3600/60)).padStart(2,"0"),u=String(i%60).padStart(2,"0"),d=c===0?`${Math.floor(i/60)}:${u}`:`${c}:${m}:${u}`;return `${a}${d} /${n}`}var O=new Map;function q(t){let e=O.get(t);return e===void 0&&(e=new Intl.NumberFormat(t).formatToParts(1.1).find(r=>r.type==="decimal")?.value??".",O.set(t,e)),e}function S(t,e,r){let o=/^(-?)(\d+)(?:\.(\d+))?$/.exec(t);if(!o)return t;let[,n,s,a]=o,i=r?BigInt(s).toLocaleString(e,{useGrouping:true}):s;return a===void 0?`${n}${i}`:`${n}${i}${q(e)}${a}`}function J(t,e,r,o,n,s,a){if(e!==void 0&&a===void 0){let f=X(t,e);if(f!==void 0)return `= ${f}`}if(e==="ms"&&s)return `= ${Y(t)}`;e==="l100km"&&(e="l/100km"),e==="mps2"&&(e="m/s\xB2");let i=a??o.unitOfMeasurementResult.decimalPlaces,c=o.floatResult.enableSeperator,m=o.numberResult.decimalSeparatorLocale||"en-US",d=e&&["days","weeks","months","years","hours","minutes","seconds","day","week","month","year","hour","minute","second"].includes(e),p=a===void 0?chunkW4XLVZ6R_cjs.a(t,i,m):void 0,g;p!==void 0?g=p:d&&t===Math.floor(t)?g=S(t.toString(),m,c):g=S(t.toFixed(i),m,c);let l=e?chunkZ4MIX43O_cjs.ua[e.toUpperCase()]:void 0;if(l){let f=n?S(chunkZ4MIX43O_cjs.sa(n,i),m,c):g,$=l.spaced?" ":"";return `= ${l.position==="prefix"?`${l.symbol}${$}${f}`:`${f}${$}${l.symbol}`}`}return `= ${n?S(chunkZ4MIX43O_cjs.sa(n,i),m,c):g} ${e||""}`.trim()}function _(t,e){if(typeof t=="boolean")return t?"true":"false";if(typeof t=="object"&&t!==null)return chunkZ4MIX43O_cjs.R(t);let r=e.floatResult.decimalPlaces,o=e.floatResult.enableSeperator,n=e.numberResult.decimalSeparatorLocale;return chunkW4XLVZ6R_cjs.b(t,r,o,n)}function Q(t,e,r){let o=chunkZ4MIX43O_cjs.Z(t),n=[];for(let s=0;s<t.rows;s++){let a=[];for(let i=0;i<t.cols;i++)a.push(_(o[s*t.cols+i],r));n.push(a.join(", "));}return `${e.display.resultPrefix}[${n.join("; ")}]`}function yt(t,e){let r=e||F,o=chunkZ4MIX43O_cjs.Z(t),n=[];for(let a=0;a<t.rows;a++){let i=[];for(let c=0;c<t.cols;c++)i.push(_(o[a*t.cols+c],r));n.push(i);}let s=[];for(let a=0;a<t.cols;a++){let i=0;for(let c=0;c<t.rows;c++)i=Math.max(i,n[c][a].length);s.push(i);}return n.map(a=>`[ ${a.map((i,c)=>i.padStart(s[c])).join(" ")} ]`).join(`
2
- `)}function z(t,e,r){return `${r.display.resultPrefix}${t}:${e}`}function v(t,e,r){let o=r.percentageResult.decimalPlaces;return `= ${(t*100).toFixed(o)}${e.display.percentageSuffix}`}function tt(t,e){return `= ${t} ${e||""}`.trim()}function et(t){if(t.addr===void 0)return `/${t.prefix}`;let e=chunk5TVI2UPZ_cjs.D(t.addr);return t.prefix===void 0?e:`${e}/${t.prefix}`}function nt(t,e,r){let o=e.display.resultPrefix,n=m=>{let u=t.unit!==void 0?new chunkNH74IT7B_cjs.m(6,m.value,t.unit):new chunkNH74IT7B_cjs.m(0,m.value);u.exact=m.exact;let d=rt(u,r);return d.startsWith(o)?d.slice(o.length):d},[s,a]=t.shares,i=`${n(s)} each`;if(a===void 0)return `${o}${i}`;let c=a.count===1?"share":"shares";return `${o}${i}, with ${a.count} ${c} paying ${n(a)}`}function rt(t,e){let r=e||F,o=r.numberResult.decimalSeparatorLocale||"en",n=chunkS3DFU33X_cjs.a(o);switch(t.type){case 0:return t.uncertainty!==void 0?k(t.value,t.uncertainty,n,r):A(t.value,n,r,t.decimalPlaces);case 1:return j(t.value,r,t.unit);case 2:return G(t.value);case 3:return Z(t.value);case 10:return V(t.value);case 4:return W(t.value,n,r,t.zone);case 6:return J(t.value,t.unit,n,r,t.exact,t.datetimeSpan,t.decimalPlaces);case 7:return Q(t.value,n,r);case 8:{let s=t.value;return z(s.min,s.max,n)}case 14:return `${n.display.resultPrefix}${chunk5TVI2UPZ_cjs.g(t.value)}`;case 15:return nt(t.value,n,r);case 16:return `${n.display.resultPrefix}${t.value.label}`;case 17:return `${n.display.resultPrefix}${et(t.value)}`;case 9:return chunkZ4MIX43O_cjs.R(t.value);case 5:return v(t.value,n,r);case 11:return tt(t.value,t.unit);case 13:return t.unit??String(t.value);default:return `= ${String(t.value)}`}}exports.a=F;exports.b=yt;exports.c=rt;//# sourceMappingURL=chunk-EZ7R3ZHM.cjs.map
3
- //# sourceMappingURL=chunk-EZ7R3ZHM.cjs.map
1
+ 'use strict';var chunkW4XLVZ6R_cjs=require('./chunk-W4XLVZ6R.cjs'),chunk3ZFJLH4W_cjs=require('./chunk-3ZFJLH4W.cjs'),chunkNIDVZMKV_cjs=require('./chunk-NIDVZMKV.cjs'),chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs'),chunkE4HAKNBQ_cjs=require('./chunk-E4HAKNBQ.cjs'),chunkSXLHFK7M_cjs=require('./chunk-SXLHFK7M.cjs'),chunkPHWIO4P3_cjs=require('./chunk-PHWIO4P3.cjs'),chunkS3DFU33X_cjs=require('./chunk-S3DFU33X.cjs');var F={floatResult:{decimalPlaces:2,enableSeperator:true},numberResult:{decimalSeparatorLocale:"en-US"},hexResult:{enablePadding:false,paddingZeros:0},unitOfMeasurementResult:{decimalPlaces:2},percentageResult:{decimalPlaces:2},dateResult:{format:"long"}};function A(t,e,r,o){let n=r.floatResult.enableSeperator,s=r.numberResult.decimalSeparatorLocale;if(o!==void 0&&Number.isFinite(t)){let m=t.toLocaleString(s||"en-US",{minimumFractionDigits:o,maximumFractionDigits:o,useGrouping:n});return `${e.display.resultPrefix}${m}`}let a=r.floatResult.decimalPlaces,c=chunkW4XLVZ6R_cjs.a(t,a,s||"en-US")??chunkW4XLVZ6R_cjs.b(t,a,n,s);return `${e.display.resultPrefix}${c}`}function k(t,e,r,o){let n=o.floatResult.decimalPlaces,s=o.floatResult.enableSeperator,a=o.numberResult.decimalSeparatorLocale||"en-US",i=Math.max(n,1),c=t.toLocaleString(a,{useGrouping:s,minimumFractionDigits:0,maximumFractionDigits:n}),m=Math.abs(e).toLocaleString(a,{useGrouping:s,minimumFractionDigits:1,maximumFractionDigits:i});return `${r.display.resultPrefix}${c} \xB1 ${m}`}function j(t,e,r){if(typeof t=="number"&&!Number.isFinite(t))return `= ${t}`;let o=typeof t=="bigint"?t<0n:t<0,n=o?"-":"",s=c=>typeof t=="bigint"?(o?-t:t).toString(c):Math.abs(Math.trunc(t)).toString(c);if(r==="bin")return `= ${n}0b${s(2)}`;if(r==="oct")return `= ${n}0o${s(8)}`;let a=e.hexResult.enablePadding?e.hexResult.paddingZeros:0,i=s(16).toUpperCase().padStart(a,"0");return `= ${n}0x${i}`}var B=2e4;function G(t){let e=t<0n?-t:t;if(Number.isFinite(Number(e)))return `= ${t}`;let r=e.toString(16).length*4;if(r*Math.LN2/Math.LN10<=B)return `= ${t}`;let o=r*Math.LN2/Math.LN10,n=Math.floor(o),s=Math.pow(10,o-n);return `= ${t<0n?"-":""}~${s.toFixed(3)}e+${n} (an exact integer of about ${(n+1).toLocaleString("en-US")} digits, too large to print)`}function Z(t){return `= ${t}`}function V(t){return `= ${t}`}function W(t,e,r,o){let n=r.calendar??chunkEQNKDTMX_cjs.b,s=r.dateResult?.format??"long",a=o!==void 0&&!chunkE4HAKNBQ_cjs.g(o),i=a?n.fieldsInZone(o,t):n.fields(t),c=a?0:n.fields(t).millisecond,m=i.hour===0&&i.minute===0&&i.second===0&&c===0;if(s==="long"){let f=a?chunkE4HAKNBQ_cjs.o(o,t,e.code):n.formatLongDate(t,e.code);if(m)return `= ${f}`;let $=a?chunkE4HAKNBQ_cjs.p(o,t,e.code):n.formatTimeOfDay(t,e.code);return `= ${f}, ${$}`}let u=f=>String(f).padStart(2,"0"),d=i.year,p=u(i.month0+1),g=u(i.day),l;if(s==="iso"?l=`${d}-${p}-${g}`:s==="dmy"?l=`${g}/${p}/${d}`:l=`${p}/${g}/${d}`,m)return `= ${l}`;let b=`${u(i.hour)}:${u(i.minute)}:${u(i.second)}`;return s==="iso"?`= ${l}T${b}`:`= ${l} ${b}`}function Y(t){let e=t<0?"-":"",r=Math.round(Math.abs(t)/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),s=r%60,a=String(n).padStart(2,"0");if(s===0)return `${e}${o}:${a}`;let i=String(s).padStart(2,"0");return `${e}${o}:${a}:${i}`}var H={s:1,sec:1,secs:1,second:1,seconds:1,min:60,mins:60,minute:60,minutes:60,h:3600,hr:3600,hrs:3600,hour:3600,hours:3600},K=60;function X(t,e){let r=e.indexOf("/");if(r<=0)return;let o=H[e.slice(0,r).toLowerCase()];if(o===void 0)return;let n=e.slice(r+1);if(chunkPHWIO4P3_cjs.c(n)!=="length")return;let s=t*o;if(!Number.isFinite(s)||Math.abs(s)<K)return;let a=s<0?"-":"",i=Math.round(Math.abs(s)),c=Math.floor(i/3600),m=String(Math.floor(i%3600/60)).padStart(2,"0"),u=String(i%60).padStart(2,"0"),d=c===0?`${Math.floor(i/60)}:${u}`:`${c}:${m}:${u}`;return `${a}${d} /${n}`}var O=new Map;function q(t){let e=O.get(t);return e===void 0&&(e=new Intl.NumberFormat(t).formatToParts(1.1).find(r=>r.type==="decimal")?.value??".",O.set(t,e)),e}function S(t,e,r){let o=/^(-?)(\d+)(?:\.(\d+))?$/.exec(t);if(!o)return t;let[,n,s,a]=o,i=r?BigInt(s).toLocaleString(e,{useGrouping:true}):s;return a===void 0?`${n}${i}`:`${n}${i}${q(e)}${a}`}function J(t,e,r,o,n,s,a){if(e!==void 0&&a===void 0){let f=X(t,e);if(f!==void 0)return `= ${f}`}if(e==="ms"&&s)return `= ${Y(t)}`;e==="l100km"&&(e="l/100km"),e==="mps2"&&(e="m/s\xB2");let i=a??o.unitOfMeasurementResult.decimalPlaces,c=o.floatResult.enableSeperator,m=o.numberResult.decimalSeparatorLocale||"en-US",d=e&&["days","weeks","months","years","hours","minutes","seconds","day","week","month","year","hour","minute","second"].includes(e),p=a===void 0?chunkW4XLVZ6R_cjs.a(t,i,m):void 0,g;p!==void 0?g=p:d&&t===Math.floor(t)?g=S(t.toString(),m,c):g=S(t.toFixed(i),m,c);let l=e?chunkNIDVZMKV_cjs.ua[e.toUpperCase()]:void 0;if(l){let f=n?S(chunkNIDVZMKV_cjs.sa(n,i),m,c):g,$=l.spaced?" ":"";return `= ${l.position==="prefix"?`${l.symbol}${$}${f}`:`${f}${$}${l.symbol}`}`}return `= ${n?S(chunkNIDVZMKV_cjs.sa(n,i),m,c):g} ${e||""}`.trim()}function _(t,e){if(typeof t=="boolean")return t?"true":"false";if(typeof t=="object"&&t!==null)return chunkNIDVZMKV_cjs.R(t);let r=e.floatResult.decimalPlaces,o=e.floatResult.enableSeperator,n=e.numberResult.decimalSeparatorLocale;return chunkW4XLVZ6R_cjs.b(t,r,o,n)}function Q(t,e,r){let o=chunkNIDVZMKV_cjs.Z(t),n=[];for(let s=0;s<t.rows;s++){let a=[];for(let i=0;i<t.cols;i++)a.push(_(o[s*t.cols+i],r));n.push(a.join(", "));}return `${e.display.resultPrefix}[${n.join("; ")}]`}function yt(t,e){let r=e||F,o=chunkNIDVZMKV_cjs.Z(t),n=[];for(let a=0;a<t.rows;a++){let i=[];for(let c=0;c<t.cols;c++)i.push(_(o[a*t.cols+c],r));n.push(i);}let s=[];for(let a=0;a<t.cols;a++){let i=0;for(let c=0;c<t.rows;c++)i=Math.max(i,n[c][a].length);s.push(i);}return n.map(a=>`[ ${a.map((i,c)=>i.padStart(s[c])).join(" ")} ]`).join(`
2
+ `)}function z(t,e,r){return `${r.display.resultPrefix}${t}:${e}`}function v(t,e,r){let o=r.percentageResult.decimalPlaces;return `= ${(t*100).toFixed(o)}${e.display.percentageSuffix}`}function tt(t,e){return `= ${t} ${e||""}`.trim()}function et(t){if(t.addr===void 0)return `/${t.prefix}`;let e=chunk3ZFJLH4W_cjs.D(t.addr);return t.prefix===void 0?e:`${e}/${t.prefix}`}function nt(t,e,r){let o=e.display.resultPrefix,n=m=>{let u=t.unit!==void 0?new chunkSXLHFK7M_cjs.m(6,m.value,t.unit):new chunkSXLHFK7M_cjs.m(0,m.value);u.exact=m.exact;let d=rt(u,r);return d.startsWith(o)?d.slice(o.length):d},[s,a]=t.shares,i=`${n(s)} each`;if(a===void 0)return `${o}${i}`;let c=a.count===1?"share":"shares";return `${o}${i}, with ${a.count} ${c} paying ${n(a)}`}function rt(t,e){let r=e||F,o=r.numberResult.decimalSeparatorLocale||"en",n=chunkS3DFU33X_cjs.a(o);switch(t.type){case 0:return t.uncertainty!==void 0?k(t.value,t.uncertainty,n,r):A(t.value,n,r,t.decimalPlaces);case 1:return j(t.value,r,t.unit);case 2:return G(t.value);case 3:return Z(t.value);case 10:return V(t.value);case 4:return W(t.value,n,r,t.zone);case 6:return J(t.value,t.unit,n,r,t.exact,t.datetimeSpan,t.decimalPlaces);case 7:return Q(t.value,n,r);case 8:{let s=t.value;return z(s.min,s.max,n)}case 14:return `${n.display.resultPrefix}${chunk3ZFJLH4W_cjs.g(t.value)}`;case 15:return nt(t.value,n,r);case 16:return `${n.display.resultPrefix}${t.value.label}`;case 17:return `${n.display.resultPrefix}${et(t.value)}`;case 9:return chunkNIDVZMKV_cjs.R(t.value);case 5:return v(t.value,n,r);case 11:return tt(t.value,t.unit);case 13:return t.unit??String(t.value);default:return `= ${String(t.value)}`}}exports.a=F;exports.b=yt;exports.c=rt;//# sourceMappingURL=chunk-4AX7GIZY.cjs.map
3
+ //# sourceMappingURL=chunk-4AX7GIZY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/format/FormattingSettings.ts","../src/format/FormatEngine.ts"],"names":["DEFAULT_FORMATTING_SETTINGS","formatNumber","value","locale","settings","decimalPlaces","sep","loc","formatted","dp","tooSmallToPrintText","autoFormatIntegerOrFloat","formatUncertain","center","uncertainty","useGrouping","spreadMax","centerText","spreadText","formatHex","base","negative","sign","digits","radix","padding","hex","MAX_DISPLAYED_BIGINT_DIGITS","formatBigInt","magnitude","bits","log10","exponent","mantissa","formatString","formatBoolean","formatDatetime","zone","calendar","DATE_CALENDAR","format","named","isFixedOffset","d","millisecond","isMidnight","dateStr","longDateInZone","timeStr","timeOfDayInZone","p2","n","year","month","day","datePart","time","formatMsDuration","ms","totalSeconds","hours","minutes","seconds","mm","ss","PACE_TIME_UNITS","PACE_CLOCK_FLOOR_SECONDS","formatPace","unit","slash","perSecond","distance","getMeasure","whole","clock","decimalMarkByLocale","decimalMark","mark","part","localiseFixedDecimal","fixed","match","integer","fraction","integerText","formatUom","exact","isDatetimeSpan","explicitPlaces","pace","isTimeSpan","tooSmall","currencyDisplay","CURRENCY_DISPLAY","moneyText","decimalToFixed","formatMatrixEntry","entry","formatSymbolic","formatMatrix","m","rowMajor","columnMajorToRowMajor","rows","r","cells","c","formatMatrixAligned","us","row","colWidth","width","cell","formatRange","min","max","formatPercentage","formatUnit","formatIpCidr","data","dotted","formatIp","formatSplit","prefix","render","share","v","Value","text","formatValue","high","each","shareWord","localeCode","getLocale","formatColour"],"mappings":"iaA2DO,IAAMA,EAAkD,CAC7D,WAAA,CAAa,CACX,aAAA,CAAe,EACf,eAAA,CAAiB,IACnB,CAAA,CACA,YAAA,CAAc,CACZ,sBAAA,CAAwB,OAC1B,CAAA,CACA,SAAA,CAAW,CACT,aAAA,CAAe,KAAA,CACf,YAAA,CAAc,CAChB,EACA,uBAAA,CAAyB,CACvB,aAAA,CAAe,CACjB,EACA,gBAAA,CAAkB,CAChB,aAAA,CAAe,CACjB,EACA,UAAA,CAAY,CACV,OAAQ,MACV,CACF,EClEA,SAASC,CAAAA,CAAaC,CAAAA,CAAeC,CAAAA,CAAiBC,EAA8BC,CAAAA,CAAgC,CAClH,IAAMC,CAAAA,CAAMF,EAAS,W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EAAM,KAAA,CAAiBC,CAAAA,CAAQyG,CAAE,CAAA,CAC3D,KAAA,EAAA,CACE,OAAOS,EAAAA,CAAWnH,CAAAA,CAAM,MAAiBA,CAAAA,CAAM,IAAI,EACrD,KAAA,EAAA,CAKE,OAAOA,EAAM,IAAA,EAAQ,MAAA,CAAOA,EAAM,KAAK,CAAA,CACzC,QACE,OAAO,CAAA,EAAA,EAAK,OAAOA,CAAAA,CAAM,KAAK,CAAC,CAAA,CACnC,CACF","file":"chunk-EZ7R3ZHM.cjs","sourcesContent":["import type { CalendarBackend } from \"@solve-js/calendar/CalendarBackend\";\n/**\n * How a Datetime value is rendered.\n *\n * - `'long'`: the spelled-out form, \"Tuesday, March 10, 2026\" (the default).\n * - `'iso'`: \"2026-03-10\" (ISO 8601, with a `T`-separated time when present).\n * - `'dmy'`: \"10/03/2026\" (day first).\n * - `'mdy'`: \"03/10/2026\" (month first).\n *\n * The weekday and long month name in `'long'` are localised through the same\n * locale the number separators come from; the numeric forms are locale-neutral.\n */\nexport type DateOutputFormat = \"long\" | \"iso\" | \"dmy\" | \"mdy\";\n\n/**\n * Minimal formatting settings interface for the engine\n * This allows the engine to format values without depending on app-specific settings\n */\nexport interface FormattingSettings {\n /**\n * The calendar backend a date is written out through: which local day and\n * wall-clock time an instant shows as. Pass the same backend the engine\n * was given as its `calendar` option, so a date displays in the zone it\n * was computed in. Absent means the built-in `Date` backend, the process's\n * own zone, which is what every engine computes with by default.\n *\n * A backend is an object of functions, so it cannot cross a `postMessage`\n * boundary: a worker runtime takes its backend from `WorkerRuntimeOptions`\n * and applies it to the formatting it receives.\n */\n calendar?: CalendarBackend;\n floatResult: {\n decimalPlaces: number;\n enableSeperator: boolean;\n };\n numberResult: {\n decimalSeparatorLocale: string;\n };\n hexResult: {\n enablePadding: boolean;\n paddingZeros: number;\n };\n unitOfMeasurementResult: {\n decimalPlaces: number;\n };\n percentageResult: {\n decimalPlaces: number;\n };\n /**\n * Optional so a host that built a `FormattingSettings` before this field\n * existed still compiles; a missing `dateResult` reads as `'long'`, the\n * historic output.\n */\n dateResult?: {\n format: DateOutputFormat;\n };\n}\n\n/** Formatting used when a host supplies none. */\nexport const DEFAULT_FORMATTING_SETTINGS: FormattingSettings = {\n floatResult: {\n decimalPlaces: 2,\n enableSeperator: true,\n },\n numberResult: {\n decimalSeparatorLocale: \"en-US\",\n },\n hexResult: {\n enablePadding: false,\n paddingZeros: 0,\n },\n unitOfMeasurementResult: {\n decimalPlaces: 2,\n },\n percentageResult: {\n decimalPlaces: 2,\n },\n dateResult: {\n format: \"long\",\n },\n};\n","import { Value, ValueType, type MatrixData, type MatrixEntry, type RangeData, type ColourData, type SplitData, type SplitShare, type ChartData, type IpCidrData } from \"@solve-js/vm/Value\";\nimport { formatColour } from \"@solve-js/packages/colour/ColourMath\";\nimport { formatIp } from \"@solve-js/packages/ip/IpMath\";\nimport { decimalToFixed, type DecimalData } from \"@solve-js/decimal\";\nimport { getLocale, type ILocale } from \"@solve-js/constants/locales\";\nimport { autoFormatIntegerOrFloat, tooSmallToPrintText } from \"@solve-js/utilities/Number\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\nimport { FormattingSettings, DEFAULT_FORMATTING_SETTINGS } from \"./FormattingSettings\";\nimport { CURRENCY_DISPLAY } from \"@solve-js/uom/CurrencyAliases\";\nimport { columnMajorToRowMajor } from \"@solve-js/vm/MatrixOps\";\nimport { formatSymbolic, type SymbolicNode } from \"@solve-js/symbolic\";\nimport { DATE_CALENDAR } from \"@solve-js/calendar/DateCalendar\";\nimport { isFixedOffset, longDateInZone, timeOfDayInZone } from \"@solve-js/calendar/IntlZone\";\n\nfunction formatNumber(value: number, locale: ILocale, settings: FormattingSettings, decimalPlaces?: number): string {\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n // An explicit precision (`3.14159 to 4 dp`, `round(1.5, 2)`) shows EXACTLY that\n // many places with trailing zeros kept, where the default trims them and shows\n // an integer with none. The value was already rounded to this precision when\n // it was set (see VMBuiltins' roundToPlaces, exact where an exact decimal was\n // there), so rendering it to the same place count reproduces that rounding.\n if (decimalPlaces !== undefined && Number.isFinite(value)) {\n const formatted = value.toLocaleString(loc || \"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n useGrouping: sep,\n });\n return `${locale.display.resultPrefix}${formatted}`;\n }\n const dp = settings.floatResult.decimalPlaces;\n // A value below the decimal budget is shown to three significant digits\n // rather than as a zero it cannot be told apart from. Only when the budget is\n // the default one: an explicit `to N dp` above asked for those places and is\n // given them, zeros included.\n const tooSmall = tooSmallToPrintText(value, dp, loc || \"en-US\");\n const formatted = tooSmall ?? autoFormatIntegerOrFloat(value, dp, sep, loc);\n return `${locale.display.resultPrefix}${formatted}`;\n}\n\n/**\n * Renders a measurement that carries a one-sigma uncertainty as\n * `center ± spread`, e.g. `49.2 ± 2.0`.\n *\n * The center is shown the way any number is, whole numbers as integers and\n * trailing zeros trimmed, so a tolerance-free-looking center still reads\n * cleanly (\"30 ± 2.24\", not \"30.00 ± 2.24\"). The spread is shown to the same\n * decimal-place budget but always keeps at least one fractional digit, which is\n * what distinguishes it as a tolerance and gives \"± 2.0\" rather than \"± 2\".\n * Both use `Intl` with `maximumFractionDigits`, so the trailing-zero trimming is\n * locale-correct (a comma-decimal locale is not string-sliced on \".\").\n *\n * The symbol is always the `±` glyph on output, even when the input was the\n * ASCII `+/-`, since the glyph is the conventional notation and unambiguous to\n * read back.\n */\nfunction formatUncertain(center: number, uncertainty: number, locale: ILocale, settings: FormattingSettings): string {\n const dp = settings.floatResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n // The spread needs room for at least one fractional digit, so a zero-decimal\n // budget cannot leave minimumFractionDigits above maximumFractionDigits.\n const spreadMax = Math.max(dp, 1);\n const centerText = center.toLocaleString(loc, { useGrouping, minimumFractionDigits: 0, maximumFractionDigits: dp });\n const spreadText = Math.abs(uncertainty).toLocaleString(loc, { useGrouping, minimumFractionDigits: 1, maximumFractionDigits: spreadMax });\n return `${locale.display.resultPrefix}${centerText} ± ${spreadText}`;\n}\n\n/**\n * Renders a number in whichever base it is tagged with.\n *\n * The zero padding is a hexadecimal setting and stays one. Applying it to a\n * binary rendering would pad `0b101` out to the same digit count as a hex\n * value, which is a different quantity of zeros and not what the setting asks\n * for.\n */\nfunction formatHex(value: number | bigint, settings: FormattingSettings, base?: string): string {\n // An infinity or a NaN has no digits in any base, and asking for them\n // produced `0xINFINITY`, a literal that reads back as nothing at all. Render\n // the value itself, which is what every other non-finite result shows.\n if (typeof value === \"number\" && !Number.isFinite(value)) return `= ${value}`;\n\n // Truncate and take the sign off before converting. `Number.toString(radix)`\n // does neither: it renders -255 as \"-ff\", which lands the minus inside the\n // literal as `0x-FF`, and it renders 255.7 as \"ff.b3333333333\", inventing\n // fractional hex digits for a notation that has no use for them. Both were\n // visible on `as hex` until the builtins started sharing this path.\n //\n // A bigint needs neither truncation nor a Math call, and must not be routed\n // through one: passing it to Math.trunc() throws, and converting it to a\n // double first is exactly the precision loss it is carried as a bigint to\n // avoid.\n const negative = typeof value === \"bigint\" ? value < 0n : value < 0;\n const sign = negative ? \"-\" : \"\";\n const digits = (radix: number): string =>\n typeof value === \"bigint\"\n ? (negative ? -value : value).toString(radix)\n : Math.abs(Math.trunc(value)).toString(radix);\n\n if (base === \"bin\") return `= ${sign}0b${digits(2)}`;\n if (base === \"oct\") return `= ${sign}0o${digits(8)}`;\n const padding = settings.hexResult.enablePadding ? settings.hexResult.paddingZeros : 0;\n const hex = digits(16).toUpperCase().padStart(padding, \"0\");\n return `= ${sign}0x${hex}`;\n}\n\n/**\n * How many decimal digits of an exact integer this will render in full.\n *\n * A little above the ~19,729 digits of the largest bigint the VM will build\n * (`vm/VM.ts`'s MAX_EXACT_POW_BITS / MAX_EXACT_SHIFT_BITS, 65,536 bits), so\n * every value the engine can produce through `^` or `<<` still prints exactly\n * and this ceiling only ever meets a value that came from somewhere else.\n */\nconst MAX_DISPLAYED_BIGINT_DIGITS = 20000;\n\n/**\n * Renders an exact integer, or describes it when writing it out is itself the\n * expensive operation.\n *\n * This used to be a bare `= ${value}` template, which renders whatever it is\n * handed: `1n << 100000000` took 8.5 seconds here turning a 12.5MB integer\n * into a thirty-million-character string, and a host has no way to opt out,\n * since displaying the answer is what it asked the engine for. The VM's own\n * ceiling on `<<` and `^` now stops that value existing, so this is the\n * backstop for every other way a large bigint can arrive (repeated `x * x`,\n * a Value a host built itself), and it costs one comparison for every value\n * that is not absurd.\n *\n * The digit count is estimated from the bit length rather than measured, since\n * measuring means doing the conversion this exists to avoid. Bit length comes\n * off the hexadecimal form, which is linear in the size of the value where the\n * decimal form is not.\n */\nfunction formatBigInt(value: bigint): string {\n const magnitude = value < 0n ? -value : value;\n // Every bigint a person actually reads takes this line and nothing else:\n // anything a double can hold is at most 309 digits, so it is printable\n // without measuring it at all.\n if (Number.isFinite(Number(magnitude))) return `= ${value}`;\n const bits = magnitude.toString(16).length * 4;\n if (bits * Math.LN2 / Math.LN10 <= MAX_DISPLAYED_BIGINT_DIGITS) return `= ${value}`;\n const log10 = bits * Math.LN2 / Math.LN10;\n const exponent = Math.floor(log10);\n const mantissa = Math.pow(10, log10 - exponent);\n const sign = value < 0n ? \"-\" : \"\";\n return `= ${sign}~${mantissa.toFixed(3)}e+${exponent} (an exact integer of about ${(exponent + 1).toLocaleString(\"en-US\")} digits, too large to print)`;\n}\n\nfunction formatString(value: string): string {\n return `= ${value}`;\n}\n\nfunction formatBoolean(value: boolean): string {\n return `= ${value}`;\n}\n\n/**\n * Renders a Datetime value locale-aware, the previous implementation\n * called `d.toLocaleString()` with no arguments, which always uses the JS\n * runtime's own default locale and never actually consulted `locale.code`\n * despite receiving it as a parameter (both branches of its old\n * `dateFormat === \"default\"` check were byte-for-byte identical, dead\n * groundwork for a distinction that was never implemented). Concretely,\n * this meant every configured locale (including the shipped German one)\n * always displayed weekday/month names in English. See GitHub issue #77.\n *\n * Uses `weekday`/`month`: \"long\" for a spelled-out date (\"Monday,\n * November 17, 2025\" / \"lundi 17 novembre 2025\") since that's what a\n * literal weekday name is for; a bare numeric date doesn't need\n * localizing beyond the decimal/thousands separators `formatNumber()`\n * already handles. The time-of-day portion is only appended when it's\n * not exactly local midnight, bare date literals (\"today\", \"17/11/2025\")\n * always anchor to local midnight, and showing \"00:00:00\" on every one of\n * those would be noise, not information.\n *\n * Reads the calendar backend on the settings, or the built-in `Date` one\n * when the settings name none: `formatValue` is a free function a host calls\n * with a value and settings, with no engine in hand, so the host passes the\n * backend its engine computes with (`FormattingSettings.calendar`) and a\n * date shows the day it was computed on, in that backend's zone.\n */\nfunction formatDatetime(value: number, locale: ILocale, settings: FormattingSettings, zone?: string): string {\n const calendar = settings.calendar ?? DATE_CALENDAR;\n const format = settings.dateResult?.format ?? \"long\";\n\n // A date that names a zone is read in it. `3 April 2026 in Tokyo` is Tokyo's\n // 3 April, and rendering the instant behind it in the reader's own zone\n // showed them 2 April: the right moment, answering a question nobody asked.\n //\n // Only a named zone, deliberately. An ISO literal carrying `Z` or an offset\n // records the synthetic fixed-offset form, and how those display is a\n // separate question this does not answer: they keep reading in the zone the\n // engine computes in, as they always have.\n const named = zone !== undefined && !isFixedOffset(zone);\n const d = named ? calendar.fieldsInZone(zone, value) : calendar.fields(value);\n const millisecond = named ? 0 : calendar.fields(value).millisecond;\n const isMidnight = d.hour === 0 && d.minute === 0 && d.second === 0 && millisecond === 0;\n\n // The spelled-out default, localised through the locale's own names.\n if (format === \"long\") {\n const dateStr = named ? longDateInZone(zone, value, locale.code) : calendar.formatLongDate(value, locale.code);\n if (isMidnight) return `= ${dateStr}`;\n const timeStr = named ? timeOfDayInZone(zone, value, locale.code) : calendar.formatTimeOfDay(value, locale.code);\n return `= ${dateStr}, ${timeStr}`;\n }\n\n // The numeric forms, built from the local calendar fields so they read the\n // same regardless of the JS runtime's own default locale.\n const p2 = (n: number) => String(n).padStart(2, \"0\");\n const year = d.year;\n const month = p2(d.month0 + 1);\n const day = p2(d.day);\n let datePart: string;\n if (format === \"iso\") datePart = `${year}-${month}-${day}`;\n else if (format === \"dmy\") datePart = `${day}/${month}/${year}`;\n else datePart = `${month}/${day}/${year}`; // mdy\n\n if (isMidnight) return `= ${datePart}`;\n const time = `${p2(d.hour)}:${p2(d.minute)}:${p2(d.second)}`;\n // ISO joins date and time with `T`; the slash forms with a space.\n return format === \"iso\" ? `= ${datePart}T${time}` : `= ${datePart} ${time}`;\n}\n\n/**\n * Renders a millisecond duration as clock-style `H:MM` (or `H:MM:SS` when\n * there's a non-zero seconds component). `ms` is never a user-typeable\n * unit (confirmed: it appears nowhere in `lexer/units.ts`), it's only\n * ever produced by subtracting two clock times/datetimes (`9:30 - 8:30`,\n * `VM.ts`'s Datetime SUB case), so this is a safe, narrow special case,\n * not a general change to how durations display.\n */\nfunction formatMsDuration(ms: number): string {\n const sign = ms < 0 ? \"-\" : \"\";\n const totalSeconds = Math.round(Math.abs(ms) / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const mm = String(minutes).padStart(2, \"0\");\n if (seconds === 0) return `${sign}${hours}:${mm}`;\n const ss = String(seconds).padStart(2, \"0\");\n return `${sign}${hours}:${mm}:${ss}`;\n}\n\n/**\n * The time units a pace can be written in, and what one of each is in seconds.\n *\n * A short list rather than a measure lookup, because a pace is minutes and\n * seconds by convention and nobody writes a pace in weeks.\n */\nconst PACE_TIME_UNITS: Readonly<Record<string, number>> = {\n\ts: 1, sec: 1, secs: 1, second: 1, seconds: 1,\n\tmin: 60, mins: 60, minute: 60, minutes: 60,\n\th: 3600, hr: 3600, hrs: 3600, hour: 3600, hours: 3600,\n};\n\n/**\n * Below this many seconds per unit, a pace keeps its ordinary rendering.\n *\n * A clock shows whole seconds, and rounding to one is immaterial at a runner's\n * pace and a real loss below a minute: `0.90 seconds/m` would read `0:01 /m`,\n * which is a different number. A minute per unit is where the rounding stops\n * mattering.\n */\nconst PACE_CLOCK_FLOOR_SECONDS = 60;\n\n/**\n * A time over a distance, written the way a runner writes it.\n *\n * `4:30/km` is four and a half minutes to cover a kilometre, and `270.00\n * seconds/km` is the same number in a spelling nobody uses. So a quantity whose\n * unit is a time over a length is shown on a clock, matching what the `pace`\n * function has always printed.\n *\n * Returns undefined for everything else, which is every other unit the engine\n * carries: a speed (`90 km/h`) is a length over a time and reads as a number, a\n * rate of pay is money over a time, and a pace faster than a minute per unit\n * keeps its digits. Callers keep the rendering they had.\n */\nfunction formatPace(value: number, unit: string): string | undefined {\n\tconst slash = unit.indexOf(\"/\");\n\tif (slash <= 0) return undefined;\n\tconst perSecond = PACE_TIME_UNITS[unit.slice(0, slash).toLowerCase()];\n\tif (perSecond === undefined) return undefined;\n\tconst distance = unit.slice(slash + 1);\n\tif (getMeasure(distance) !== \"length\") return undefined;\n\n\tconst seconds = value * perSecond;\n\tif (!Number.isFinite(seconds) || Math.abs(seconds) < PACE_CLOCK_FLOOR_SECONDS) return undefined;\n\t// The same shape `formatMsDuration` writes, so a pace and a stretch of time\n\t// read alike, with the hours dropped when there are none.\n\tconst sign = seconds < 0 ? \"-\" : \"\";\n\tconst whole = Math.round(Math.abs(seconds));\n\tconst hours = Math.floor(whole / 3600);\n\tconst mm = String(Math.floor((whole % 3600) / 60)).padStart(2, \"0\");\n\tconst ss = String(whole % 60).padStart(2, \"0\");\n\tconst clock = hours === 0 ? `${Math.floor(whole / 60)}:${ss}` : `${hours}:${mm}:${ss}`;\n\treturn `${sign}${clock} /${distance}`;\n}\n\n/** The decimal mark each locale writes, looked up once per locale rather than on every value. */\nconst decimalMarkByLocale = new Map<string, string>();\n\nfunction decimalMark(loc: string): string {\n let mark = decimalMarkByLocale.get(loc);\n if (mark === undefined) {\n mark = new Intl.NumberFormat(loc).formatToParts(1.1).find((part) => part.type === \"decimal\")?.value ?? \".\";\n decimalMarkByLocale.set(loc, mark);\n }\n return mark;\n}\n\n/**\n * Write a fixed-decimal string (`\"1234567.50\"`) the way `loc` writes numbers:\n * its decimal mark, and its digit grouping when `useGrouping` is on.\n *\n * Every quantity and every money amount used to be rendered with a bare\n * `toFixed`, so a plain `52000` showed as `52,000` while `£52000` showed as\n * `£52000.00`, and the `enableSeperator` setting had no effect on the one\n * value type people most want grouped. The digits are taken from the string\n * rather than re-rendered from the double, because an exact money amount has\n * already been rounded from its decimal (see {@link formatUom}) and\n * re-rendering would undo that. `BigInt` carries the integer part through\n * `Intl` so grouping follows the locale's own rule (Indian lakhs included)\n * rather than a hand-written every-three-digits. Anything that is not plain\n * digits, an `Infinity` or an exponent form, is returned as it came.\n */\nfunction localiseFixedDecimal(fixed: string, loc: string, useGrouping: boolean): string {\n const match = /^(-?)(\\d+)(?:\\.(\\d+))?$/.exec(fixed);\n if (!match) return fixed;\n const [, sign, integer, fraction] = match;\n const integerText = useGrouping ? BigInt(integer).toLocaleString(loc, { useGrouping: true }) : integer;\n if (fraction === undefined) return `${sign}${integerText}`;\n return `${sign}${integerText}${decimalMark(loc)}${fraction}`;\n}\n\nfunction formatUom(value: number, unit: string | undefined, locale: ILocale, settings: FormattingSettings, exact?: DecimalData, isDatetimeSpan?: boolean, explicitPlaces?: number): string {\n // A time over a distance is a pace, and a runner reads a pace on a clock.\n // Not when the line named its own place count, which asked for digits.\n if (unit !== undefined && explicitPlaces === undefined) {\n const pace = formatPace(value, unit);\n if (pace !== undefined) return `= ${pace}`;\n }\n // A clock only for the gap between two datetimes, which is marked as such.\n // A quantity in milliseconds is a quantity: `40ms + 120ms` is 190 ms, not\n // 0:00, and every neighbouring spelling already agreed (`40 milliseconds`).\n if (unit === \"ms\" && isDatetimeSpan) return `= ${formatMsDuration(value)}`;\n // A fuel-consumption unit is stored slash-free (so it is not read as a rate)\n // but shown the way it is written.\n if (unit === \"l100km\") unit = \"l/100km\";\n if (unit === \"mps2\") unit = \"m/s²\";\n\n // `1.23456 km to 4 dp` asked for four places and used to be given the\n // setting's two, because a quantity's own place count was never read here the\n // way a plain number's already was.\n const dp = explicitPlaces ?? settings.unitOfMeasurementResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n\n // For TimeSpan values (days, weeks, hours, etc.), format as integer if the value is a whole number\n const timeSpanUnits = [\"days\", \"weeks\", \"months\", \"years\", \"hours\", \"minutes\", \"seconds\", \"day\", \"week\", \"month\", \"year\", \"hour\", \"minute\", \"second\"];\n const isTimeSpan = unit && timeSpanUnits.includes(unit);\n\n // A conversion can land far below the decimal budget, and `1 Hz in MHz`\n // printing `0.00 MHz` is indistinguishable from a real zero. Three\n // significant digits instead, in exponent form once the zeros stop being\n // countable. Not for an explicit `to N dp`, which asked for those places, and\n // not for money below: a currency zero is a real answer, and `$0.001` is\n // `$0.00` because a tenth of a penny is not a payable amount.\n const tooSmall = explicitPlaces === undefined ? tooSmallToPrintText(value, dp, loc) : undefined;\n\n let formatted: string;\n if (tooSmall !== undefined) {\n formatted = tooSmall;\n } else if (isTimeSpan && value === Math.floor(value)) {\n // For whole number TimeSpan values, format as integer\n formatted = localiseFixedDecimal(value.toString(), loc, useGrouping);\n } else {\n // For other values, use the configured decimal places\n formatted = localiseFixedDecimal(value.toFixed(dp), loc, useGrouping);\n }\n\n // Currency display: symbol + culturally-conventional placement (e.g.\n // \"$100.00\" prefix vs \"100.00 kr\" suffix) instead of the generic\n // \"amount CODE\" fallback below. See uom/CurrencyAliases.ts's\n // CURRENCY_DISPLAY table for the exact set covered and the reasoning\n // behind each placement choice. Any currency code NOT in that table\n // (most of the ~150 `CurrencyExchange.isCurrency()` recognizes) falls\n // through to the unchanged \"amount CODE\" format below.\n const currencyDisplay = unit ? CURRENCY_DISPLAY[unit.toUpperCase()] : undefined;\n if (currencyDisplay) {\n // An exact money amount rounds from its decimal, not from the double: a\n // half-cent like \"$1.005\" reads as \"$1.01\" here, where \"(1.005).toFixed(2)\"\n // answers \"1.00\" because the double it is handed already sits below the\n // value the user typed. Amounts with no exact decimal (a currency\n // conversion, whose rate is a double) keep the toFixed rendering above.\n const moneyText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n const sep = currencyDisplay.spaced ? \" \" : \"\";\n const withSymbol = currencyDisplay.position === \"prefix\"\n ? `${currencyDisplay.symbol}${sep}${moneyText}`\n : `${moneyText}${sep}${currencyDisplay.symbol}`;\n return `= ${withSymbol}`;\n }\n\n // The unit is written as the symbol the value carries. There used to be a\n // `unitOfMeasurementResult.unitNames` setting here whose two branches were\n // the same expression, so it never changed anything, and it was removed\n // rather than implemented: the engine has no unit-name data to render from.\n // The generated unit table maps a spelling to [measure, ratio] only, and\n // names cannot be recovered from it, because units that differ by an OFFSET\n // share a ratio, so \"20 C\" would come back as \"20 kelvins\". A real\n // implementation needs a hand-authored name per unit plus pluralization and\n // per-locale spelling (metre against meter), which is a feature rather than\n // the repair of a dead ternary.\n //\n // An exact currency with no symbol in the display table above (one of the\n // less common ISO codes) still rounds from its decimal here, so \"1.005 UYW\"\n // reads the same way \"$1.005\" does. Non-currency Uoms never carry an exact,\n // so this leaves \"1.50 kg\" exactly as it was.\n const genericText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n return `= ${genericText} ${unit || \"\"}`.trim();\n}\n\nfunction formatMatrixEntry(entry: MatrixEntry, settings: FormattingSettings): string {\n if (typeof entry === \"boolean\") return entry ? \"true\" : \"false\";\n if (typeof entry === \"object\" && entry !== null) return formatSymbolic(entry);\n const dp = settings.floatResult.decimalPlaces;\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n return autoFormatIntegerOrFloat(entry, dp, sep, loc);\n}\n\n/**\n * Renders a Matrix matching its own literal syntax: a single row (1xN,\n * including plain vectors) as `[a, b, c]`, a single column (Nx1) as\n * `[a; b; c]`, and a general shape as `[r0c0, r0c1; r1c0, r1c1]`, row-major\n * textual output read back out of the column-major storage\n * (`columnMajorToRowMajor()`), matching how `[1,2;3,4]` is written.\n */\nfunction formatMatrix(m: MatrixData, locale: ILocale, settings: FormattingSettings): string {\n const rowMajor = columnMajorToRowMajor(m);\n const rows: string[] = [];\n for (let r = 0; r < m.rows; r++) {\n const cells: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n cells.push(formatMatrixEntry(rowMajor[r * m.cols + c], settings));\n }\n rows.push(cells.join(\", \"));\n }\n return `${locale.display.resultPrefix}[${rows.join(\"; \")}]`;\n}\n\n/**\n * Render a matrix as a multi-line, column-aligned block: one row per line (the\n * newline is where {@link formatValue}'s compact form writes `;`), each column\n * right-padded to its widest cell, and every row wrapped in `[ ... ]`. For\n * display where a grid reads better than a line, e.g. a docs notepad or a REPL:\n *\n * ```text\n * [ 1 2 ]\n * [ 30 4 ]\n * ```\n *\n * This is deliberately separate from {@link formatValue}, whose single-line\n * matrix form stays the stable, assertable text the API and the worker DTO use.\n * A 1xN row vector is one line; an Nx1 column vector is N lines.\n */\nexport function formatMatrixAligned(m: MatrixData, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const rowMajor = columnMajorToRowMajor(m);\n const cells: string[][] = [];\n for (let r = 0; r < m.rows; r++) {\n const row: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n row.push(formatMatrixEntry(rowMajor[r * m.cols + c], us));\n }\n cells.push(row);\n }\n const colWidth: number[] = [];\n for (let c = 0; c < m.cols; c++) {\n let width = 0;\n for (let r = 0; r < m.rows; r++) width = Math.max(width, cells[r][c].length);\n colWidth.push(width);\n }\n return cells\n .map((row) => `[ ${row.map((cell, c) => cell.padStart(colWidth[c])).join(\" \")} ]`)\n .join(\"\\n\");\n}\n\nfunction formatRange(min: number, max: number, locale: ILocale): string {\n return `${locale.display.resultPrefix}${min}:${max}`;\n}\n\nfunction formatPercentage(value: number, locale: ILocale, settings: FormattingSettings): string {\n // ValueType.Percentage stores a fraction (0.25 for 25%). See Value.ts's\n // documented contract and the sole producer, VM.ts's TO_PERCENTAGE opcode\n // (`right/left - 1`, e.g. 0.25 for \"800 to 1000\"). Multiply by 100 before\n // formatting; without this every percentage-change result displayed as\n // e.g. \"0.25%\" instead of \"25.00%\".\n const dp = settings.percentageResult.decimalPlaces;\n const formatted = (value * 100).toFixed(dp);\n return `= ${formatted}${locale.display.percentageSuffix}`;\n}\n\nfunction formatUnit(value: number, unit: string | undefined): string {\n return `= ${value} ${unit || \"\"}`.trim();\n}\n\n/**\n * Renders a per-person bill split: \"= $45.00 each\", or, when the division is\n * uneven, \"= $33.33 each, with 1 share paying $33.34\". Each share's amount is\n * rendered through the ordinary value formatter (a throwaway {@link Value}), so\n * a currency share honours the same symbol placement, decimal places and locale\n * as any other money and a bare share trims trailing zeros the way a plain\n * number does; the \"= \" prefix is added once, around the whole sentence, not\n * per share.\n */\n/**\n * An IP/CIDR as text: the dotted quad, plus `/prefix` when present, or a bare\n * `/prefix` when there is no address (`netmask of /24` before it resolves).\n */\nfunction formatIpCidr(data: IpCidrData): string {\n\tif (data.addr === undefined) return `/${data.prefix}`;\n\tconst dotted = formatIp(data.addr);\n\treturn data.prefix === undefined ? dotted : `${dotted}/${data.prefix}`;\n}\n\nfunction formatSplit(data: SplitData, locale: ILocale, settings: FormattingSettings): string {\n const prefix = locale.display.resultPrefix;\n const render = (share: SplitShare): string => {\n const v = data.unit !== undefined\n ? new Value(ValueType.Uom, share.value, data.unit)\n : new Value(ValueType.Number, share.value);\n v.exact = share.exact;\n const text = formatValue(v, settings);\n return text.startsWith(prefix) ? text.slice(prefix.length) : text;\n };\n\n const [base, high] = data.shares;\n const each = `${render(base)} each`;\n if (high === undefined) return `${prefix}${each}`;\n const shareWord = high.count === 1 ? \"share\" : \"shares\";\n return `${prefix}${each}, with ${high.count} ${shareWord} paying ${render(high)}`;\n}\n\n/**\n * Render an evaluated {@link Value} as a display string, dispatching on\n * `value.type` to the type-specific formatter (number, hex, datetime, unit\n * of measurement, matrix, range, percentage, ...).\n *\n * Most branches produce a `\"= \"`-prefixed result string (matching the\n * plugin's inline-result convention); `ValueType.Error` is the one\n * exception, it returns the human-readable error message directly\n * (stored in `value.unit`), not an `\"= \"`-prefixed string.\n *\n * @param value - The evaluated value to format.\n * @param settings - Locale/precision/separator options; defaults to\n * {@link DEFAULT_FORMATTING_SETTINGS} when omitted.\n * @example\n * ```typescript\n * const value = engine.evaluateExpression(\"10 USD to GBP\");\n * formatValue(value); // \"= £7.85\" (exact output depends on live exchange rates)\n * ```\n */\nexport function formatValue(value: Value, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const localeCode = us.numberResult.decimalSeparatorLocale || \"en\";\n const locale = getLocale(localeCode);\n\n switch (value.type) {\n case ValueType.Number:\n // A measurement with a tolerance renders as \"center ± spread\"; every\n // other number is unchanged, so a plain value is byte-for-byte what it was.\n if (value.uncertainty !== undefined) {\n return formatUncertain(value.value as number, value.uncertainty, locale, us);\n }\n return formatNumber(value.value as number, locale, us, value.decimalPlaces);\n case ValueType.Hex:\n return formatHex(value.value as number | bigint, us, value.unit);\n case ValueType.BigInt:\n return formatBigInt(value.value as bigint);\n case ValueType.String:\n return formatString(value.value as string);\n case ValueType.Boolean:\n return formatBoolean(value.value as boolean);\n case ValueType.Datetime:\n return formatDatetime(value.value as number, locale, us, value.zone);\n case ValueType.Uom:\n return formatUom(value.value as number, value.unit, locale, us, value.exact, value.datetimeSpan, value.decimalPlaces);\n case ValueType.Matrix:\n return formatMatrix(value.value as MatrixData, locale, us);\n case ValueType.Range: {\n const r = value.value as RangeData;\n return formatRange(r.min, r.max, locale);\n }\n case ValueType.Colour:\n return `${locale.display.resultPrefix}${formatColour(value.value as ColourData)}`;\n case ValueType.Split:\n return formatSplit(value.value as SplitData, locale, us);\n case ValueType.Chart:\n // A chart is drawn from its data by the host; the text answer is its label\n // (`sin(x) over [0, 6.28]`, or the series a sparkline came from).\n return `${locale.display.resultPrefix}${(value.value as ChartData).label}`;\n case ValueType.IpCidr:\n return `${locale.display.resultPrefix}${formatIpCidr(value.value as IpCidrData)}`;\n case ValueType.Symbolic:\n return formatSymbolic(value.value as SymbolicNode);\n case ValueType.Percentage:\n return formatPercentage(value.value as number, locale, us);\n case ValueType.Unit:\n return formatUnit(value.value as number, value.unit);\n case ValueType.Error:\n // errorValue(code, message) stores the human-readable message in\n // `.unit` (code goes in `.value`), falling through to the default\n // case here previously displayed the raw code (e.g.\n // \"CURRENCY_RATE_UNAVAILABLE\") instead of the actual message.\n return value.unit ?? String(value.value);\n default:\n return `= ${String(value.value)}`;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/format/FormattingSettings.ts","../src/format/FormatEngine.ts"],"names":["DEFAULT_FORMATTING_SETTINGS","formatNumber","value","locale","settings","decimalPlaces","sep","loc","formatted","dp","tooSmallToPrintText","autoFormatIntegerOrFloat","formatUncertain","center","uncertainty","useGrouping","spreadMax","centerText","spreadText","formatHex","base","negative","sign","digits","radix","padding","hex","MAX_DISPLAYED_BIGINT_DIGITS","formatBigInt","magnitude","bits","log10","exponent","mantissa","formatString","formatBoolean","formatDatetime","zone","calendar","DATE_CALENDAR","format","named","isFixedOffset","d","millisecond","isMidnight","dateStr","longDateInZone","timeStr","timeOfDayInZone","p2","n","year","month","day","datePart","time","formatMsDuration","ms","totalSeconds","hours","minutes","seconds","mm","ss","PACE_TIME_UNITS","PACE_CLOCK_FLOOR_SECONDS","formatPace","unit","slash","perSecond","distance","getMeasure","whole","clock","decimalMarkByLocale","decimalMark","mark","part","localiseFixedDecimal","fixed","match","integer","fraction","integerText","formatUom","exact","isDatetimeSpan","explicitPlaces","pace","isTimeSpan","tooSmall","currencyDisplay","CURRENCY_DISPLAY","moneyText","decimalToFixed","formatMatrixEntry","entry","formatSymbolic","formatMatrix","m","rowMajor","columnMajorToRowMajor","rows","r","cells","c","formatMatrixAligned","us","row","colWidth","width","cell","formatRange","min","max","formatPercentage","formatUnit","formatIpCidr","data","dotted","formatIp","formatSplit","prefix","render","share","v","Value","text","formatVal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oI,mBAAAA,CAAarI,CAAAA,CAAM,KAAmB,CAAC,CAAA,CAAA,CACjF,QACE,OAAOwH,EAAAA,CAAYxH,EAAM,KAAA,CAAoBC,CAAAA,CAAQyG,CAAE,CAAA,CACzD,KAAA,EAAA,CAGE,OAAO,CAAA,EAAGzG,CAAAA,CAAO,QAAQ,YAAY,CAAA,EAAID,EAAM,KAAA,CAAoB,KAAK,CAAA,CAAA,CAC1E,KAAA,EAAA,CACE,OAAO,CAAA,EAAGC,EAAO,OAAA,CAAQ,YAAY,GAAGmH,EAAAA,CAAapH,CAAAA,CAAM,KAAmB,CAAC,CAAA,CAAA,CACjF,OACE,OAAOgG,mBAAAA,CAAehG,EAAM,KAAqB,CAAA,CACnD,OACE,OAAOkH,CAAAA,CAAiBlH,EAAM,KAAA,CAAiBC,CAAAA,CAAQyG,CAAE,CAAA,CAC3D,KAAA,EAAA,CACE,OAAOS,EAAAA,CAAWnH,CAAAA,CAAM,MAAiBA,CAAAA,CAAM,IAAI,EACrD,KAAA,EAAA,CAKE,OAAOA,EAAM,IAAA,EAAQ,MAAA,CAAOA,EAAM,KAAK,CAAA,CACzC,QACE,OAAO,CAAA,EAAA,EAAK,OAAOA,CAAAA,CAAM,KAAK,CAAC,CAAA,CACnC,CACF","file":"chunk-4AX7GIZY.cjs","sourcesContent":["import type { CalendarBackend } from \"@solve-js/calendar/CalendarBackend\";\n/**\n * How a Datetime value is rendered.\n *\n * - `'long'`: the spelled-out form, \"Tuesday, March 10, 2026\" (the default).\n * - `'iso'`: \"2026-03-10\" (ISO 8601, with a `T`-separated time when present).\n * - `'dmy'`: \"10/03/2026\" (day first).\n * - `'mdy'`: \"03/10/2026\" (month first).\n *\n * The weekday and long month name in `'long'` are localised through the same\n * locale the number separators come from; the numeric forms are locale-neutral.\n */\nexport type DateOutputFormat = \"long\" | \"iso\" | \"dmy\" | \"mdy\";\n\n/**\n * Minimal formatting settings interface for the engine\n * This allows the engine to format values without depending on app-specific settings\n */\nexport interface FormattingSettings {\n /**\n * The calendar backend a date is written out through: which local day and\n * wall-clock time an instant shows as. Pass the same backend the engine\n * was given as its `calendar` option, so a date displays in the zone it\n * was computed in. Absent means the built-in `Date` backend, the process's\n * own zone, which is what every engine computes with by default.\n *\n * A backend is an object of functions, so it cannot cross a `postMessage`\n * boundary: a worker runtime takes its backend from `WorkerRuntimeOptions`\n * and applies it to the formatting it receives.\n */\n calendar?: CalendarBackend;\n floatResult: {\n decimalPlaces: number;\n enableSeperator: boolean;\n };\n numberResult: {\n decimalSeparatorLocale: string;\n };\n hexResult: {\n enablePadding: boolean;\n paddingZeros: number;\n };\n unitOfMeasurementResult: {\n decimalPlaces: number;\n };\n percentageResult: {\n decimalPlaces: number;\n };\n /**\n * Optional so a host that built a `FormattingSettings` before this field\n * existed still compiles; a missing `dateResult` reads as `'long'`, the\n * historic output.\n */\n dateResult?: {\n format: DateOutputFormat;\n };\n}\n\n/** Formatting used when a host supplies none. */\nexport const DEFAULT_FORMATTING_SETTINGS: FormattingSettings = {\n floatResult: {\n decimalPlaces: 2,\n enableSeperator: true,\n },\n numberResult: {\n decimalSeparatorLocale: \"en-US\",\n },\n hexResult: {\n enablePadding: false,\n paddingZeros: 0,\n },\n unitOfMeasurementResult: {\n decimalPlaces: 2,\n },\n percentageResult: {\n decimalPlaces: 2,\n },\n dateResult: {\n format: \"long\",\n },\n};\n","import { Value, ValueType, type MatrixData, type MatrixEntry, type RangeData, type ColourData, type SplitData, type SplitShare, type ChartData, type IpCidrData } from \"@solve-js/vm/Value\";\nimport { formatColour } from \"@solve-js/packages/colour/ColourMath\";\nimport { formatIp } from \"@solve-js/packages/ip/IpMath\";\nimport { decimalToFixed, type DecimalData } from \"@solve-js/decimal\";\nimport { getLocale, type ILocale } from \"@solve-js/constants/locales\";\nimport { autoFormatIntegerOrFloat, tooSmallToPrintText } from \"@solve-js/utilities/Number\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\nimport { FormattingSettings, DEFAULT_FORMATTING_SETTINGS } from \"./FormattingSettings\";\nimport { CURRENCY_DISPLAY } from \"@solve-js/uom/CurrencyAliases\";\nimport { columnMajorToRowMajor } from \"@solve-js/vm/MatrixOps\";\nimport { formatSymbolic, type SymbolicNode } from \"@solve-js/symbolic\";\nimport { DATE_CALENDAR } from \"@solve-js/calendar/DateCalendar\";\nimport { isFixedOffset, longDateInZone, timeOfDayInZone } from \"@solve-js/calendar/IntlZone\";\n\nfunction formatNumber(value: number, locale: ILocale, settings: FormattingSettings, decimalPlaces?: number): string {\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n // An explicit precision (`3.14159 to 4 dp`, `round(1.5, 2)`) shows EXACTLY that\n // many places with trailing zeros kept, where the default trims them and shows\n // an integer with none. The value was already rounded to this precision when\n // it was set (see VMBuiltins' roundToPlaces, exact where an exact decimal was\n // there), so rendering it to the same place count reproduces that rounding.\n if (decimalPlaces !== undefined && Number.isFinite(value)) {\n const formatted = value.toLocaleString(loc || \"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n useGrouping: sep,\n });\n return `${locale.display.resultPrefix}${formatted}`;\n }\n const dp = settings.floatResult.decimalPlaces;\n // A value below the decimal budget is shown to three significant digits\n // rather than as a zero it cannot be told apart from. Only when the budget is\n // the default one: an explicit `to N dp` above asked for those places and is\n // given them, zeros included.\n const tooSmall = tooSmallToPrintText(value, dp, loc || \"en-US\");\n const formatted = tooSmall ?? autoFormatIntegerOrFloat(value, dp, sep, loc);\n return `${locale.display.resultPrefix}${formatted}`;\n}\n\n/**\n * Renders a measurement that carries a one-sigma uncertainty as\n * `center ± spread`, e.g. `49.2 ± 2.0`.\n *\n * The center is shown the way any number is, whole numbers as integers and\n * trailing zeros trimmed, so a tolerance-free-looking center still reads\n * cleanly (\"30 ± 2.24\", not \"30.00 ± 2.24\"). The spread is shown to the same\n * decimal-place budget but always keeps at least one fractional digit, which is\n * what distinguishes it as a tolerance and gives \"± 2.0\" rather than \"± 2\".\n * Both use `Intl` with `maximumFractionDigits`, so the trailing-zero trimming is\n * locale-correct (a comma-decimal locale is not string-sliced on \".\").\n *\n * The symbol is always the `±` glyph on output, even when the input was the\n * ASCII `+/-`, since the glyph is the conventional notation and unambiguous to\n * read back.\n */\nfunction formatUncertain(center: number, uncertainty: number, locale: ILocale, settings: FormattingSettings): string {\n const dp = settings.floatResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n // The spread needs room for at least one fractional digit, so a zero-decimal\n // budget cannot leave minimumFractionDigits above maximumFractionDigits.\n const spreadMax = Math.max(dp, 1);\n const centerText = center.toLocaleString(loc, { useGrouping, minimumFractionDigits: 0, maximumFractionDigits: dp });\n const spreadText = Math.abs(uncertainty).toLocaleString(loc, { useGrouping, minimumFractionDigits: 1, maximumFractionDigits: spreadMax });\n return `${locale.display.resultPrefix}${centerText} ± ${spreadText}`;\n}\n\n/**\n * Renders a number in whichever base it is tagged with.\n *\n * The zero padding is a hexadecimal setting and stays one. Applying it to a\n * binary rendering would pad `0b101` out to the same digit count as a hex\n * value, which is a different quantity of zeros and not what the setting asks\n * for.\n */\nfunction formatHex(value: number | bigint, settings: FormattingSettings, base?: string): string {\n // An infinity or a NaN has no digits in any base, and asking for them\n // produced `0xINFINITY`, a literal that reads back as nothing at all. Render\n // the value itself, which is what every other non-finite result shows.\n if (typeof value === \"number\" && !Number.isFinite(value)) return `= ${value}`;\n\n // Truncate and take the sign off before converting. `Number.toString(radix)`\n // does neither: it renders -255 as \"-ff\", which lands the minus inside the\n // literal as `0x-FF`, and it renders 255.7 as \"ff.b3333333333\", inventing\n // fractional hex digits for a notation that has no use for them. Both were\n // visible on `as hex` until the builtins started sharing this path.\n //\n // A bigint needs neither truncation nor a Math call, and must not be routed\n // through one: passing it to Math.trunc() throws, and converting it to a\n // double first is exactly the precision loss it is carried as a bigint to\n // avoid.\n const negative = typeof value === \"bigint\" ? value < 0n : value < 0;\n const sign = negative ? \"-\" : \"\";\n const digits = (radix: number): string =>\n typeof value === \"bigint\"\n ? (negative ? -value : value).toString(radix)\n : Math.abs(Math.trunc(value)).toString(radix);\n\n if (base === \"bin\") return `= ${sign}0b${digits(2)}`;\n if (base === \"oct\") return `= ${sign}0o${digits(8)}`;\n const padding = settings.hexResult.enablePadding ? settings.hexResult.paddingZeros : 0;\n const hex = digits(16).toUpperCase().padStart(padding, \"0\");\n return `= ${sign}0x${hex}`;\n}\n\n/**\n * How many decimal digits of an exact integer this will render in full.\n *\n * A little above the ~19,729 digits of the largest bigint the VM will build\n * (`vm/VM.ts`'s MAX_EXACT_POW_BITS / MAX_EXACT_SHIFT_BITS, 65,536 bits), so\n * every value the engine can produce through `^` or `<<` still prints exactly\n * and this ceiling only ever meets a value that came from somewhere else.\n */\nconst MAX_DISPLAYED_BIGINT_DIGITS = 20000;\n\n/**\n * Renders an exact integer, or describes it when writing it out is itself the\n * expensive operation.\n *\n * This used to be a bare `= ${value}` template, which renders whatever it is\n * handed: `1n << 100000000` took 8.5 seconds here turning a 12.5MB integer\n * into a thirty-million-character string, and a host has no way to opt out,\n * since displaying the answer is what it asked the engine for. The VM's own\n * ceiling on `<<` and `^` now stops that value existing, so this is the\n * backstop for every other way a large bigint can arrive (repeated `x * x`,\n * a Value a host built itself), and it costs one comparison for every value\n * that is not absurd.\n *\n * The digit count is estimated from the bit length rather than measured, since\n * measuring means doing the conversion this exists to avoid. Bit length comes\n * off the hexadecimal form, which is linear in the size of the value where the\n * decimal form is not.\n */\nfunction formatBigInt(value: bigint): string {\n const magnitude = value < 0n ? -value : value;\n // Every bigint a person actually reads takes this line and nothing else:\n // anything a double can hold is at most 309 digits, so it is printable\n // without measuring it at all.\n if (Number.isFinite(Number(magnitude))) return `= ${value}`;\n const bits = magnitude.toString(16).length * 4;\n if (bits * Math.LN2 / Math.LN10 <= MAX_DISPLAYED_BIGINT_DIGITS) return `= ${value}`;\n const log10 = bits * Math.LN2 / Math.LN10;\n const exponent = Math.floor(log10);\n const mantissa = Math.pow(10, log10 - exponent);\n const sign = value < 0n ? \"-\" : \"\";\n return `= ${sign}~${mantissa.toFixed(3)}e+${exponent} (an exact integer of about ${(exponent + 1).toLocaleString(\"en-US\")} digits, too large to print)`;\n}\n\nfunction formatString(value: string): string {\n return `= ${value}`;\n}\n\nfunction formatBoolean(value: boolean): string {\n return `= ${value}`;\n}\n\n/**\n * Renders a Datetime value locale-aware, the previous implementation\n * called `d.toLocaleString()` with no arguments, which always uses the JS\n * runtime's own default locale and never actually consulted `locale.code`\n * despite receiving it as a parameter (both branches of its old\n * `dateFormat === \"default\"` check were byte-for-byte identical, dead\n * groundwork for a distinction that was never implemented). Concretely,\n * this meant every configured locale (including the shipped German one)\n * always displayed weekday/month names in English. See GitHub issue #77.\n *\n * Uses `weekday`/`month`: \"long\" for a spelled-out date (\"Monday,\n * November 17, 2025\" / \"lundi 17 novembre 2025\") since that's what a\n * literal weekday name is for; a bare numeric date doesn't need\n * localizing beyond the decimal/thousands separators `formatNumber()`\n * already handles. The time-of-day portion is only appended when it's\n * not exactly local midnight, bare date literals (\"today\", \"17/11/2025\")\n * always anchor to local midnight, and showing \"00:00:00\" on every one of\n * those would be noise, not information.\n *\n * Reads the calendar backend on the settings, or the built-in `Date` one\n * when the settings name none: `formatValue` is a free function a host calls\n * with a value and settings, with no engine in hand, so the host passes the\n * backend its engine computes with (`FormattingSettings.calendar`) and a\n * date shows the day it was computed on, in that backend's zone.\n */\nfunction formatDatetime(value: number, locale: ILocale, settings: FormattingSettings, zone?: string): string {\n const calendar = settings.calendar ?? DATE_CALENDAR;\n const format = settings.dateResult?.format ?? \"long\";\n\n // A date that names a zone is read in it. `3 April 2026 in Tokyo` is Tokyo's\n // 3 April, and rendering the instant behind it in the reader's own zone\n // showed them 2 April: the right moment, answering a question nobody asked.\n //\n // Only a named zone, deliberately. An ISO literal carrying `Z` or an offset\n // records the synthetic fixed-offset form, and how those display is a\n // separate question this does not answer: they keep reading in the zone the\n // engine computes in, as they always have.\n const named = zone !== undefined && !isFixedOffset(zone);\n const d = named ? calendar.fieldsInZone(zone, value) : calendar.fields(value);\n const millisecond = named ? 0 : calendar.fields(value).millisecond;\n const isMidnight = d.hour === 0 && d.minute === 0 && d.second === 0 && millisecond === 0;\n\n // The spelled-out default, localised through the locale's own names.\n if (format === \"long\") {\n const dateStr = named ? longDateInZone(zone, value, locale.code) : calendar.formatLongDate(value, locale.code);\n if (isMidnight) return `= ${dateStr}`;\n const timeStr = named ? timeOfDayInZone(zone, value, locale.code) : calendar.formatTimeOfDay(value, locale.code);\n return `= ${dateStr}, ${timeStr}`;\n }\n\n // The numeric forms, built from the local calendar fields so they read the\n // same regardless of the JS runtime's own default locale.\n const p2 = (n: number) => String(n).padStart(2, \"0\");\n const year = d.year;\n const month = p2(d.month0 + 1);\n const day = p2(d.day);\n let datePart: string;\n if (format === \"iso\") datePart = `${year}-${month}-${day}`;\n else if (format === \"dmy\") datePart = `${day}/${month}/${year}`;\n else datePart = `${month}/${day}/${year}`; // mdy\n\n if (isMidnight) return `= ${datePart}`;\n const time = `${p2(d.hour)}:${p2(d.minute)}:${p2(d.second)}`;\n // ISO joins date and time with `T`; the slash forms with a space.\n return format === \"iso\" ? `= ${datePart}T${time}` : `= ${datePart} ${time}`;\n}\n\n/**\n * Renders a millisecond duration as clock-style `H:MM` (or `H:MM:SS` when\n * there's a non-zero seconds component). `ms` is never a user-typeable\n * unit (confirmed: it appears nowhere in `lexer/units.ts`), it's only\n * ever produced by subtracting two clock times/datetimes (`9:30 - 8:30`,\n * `VM.ts`'s Datetime SUB case), so this is a safe, narrow special case,\n * not a general change to how durations display.\n */\nfunction formatMsDuration(ms: number): string {\n const sign = ms < 0 ? \"-\" : \"\";\n const totalSeconds = Math.round(Math.abs(ms) / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const mm = String(minutes).padStart(2, \"0\");\n if (seconds === 0) return `${sign}${hours}:${mm}`;\n const ss = String(seconds).padStart(2, \"0\");\n return `${sign}${hours}:${mm}:${ss}`;\n}\n\n/**\n * The time units a pace can be written in, and what one of each is in seconds.\n *\n * A short list rather than a measure lookup, because a pace is minutes and\n * seconds by convention and nobody writes a pace in weeks.\n */\nconst PACE_TIME_UNITS: Readonly<Record<string, number>> = {\n\ts: 1, sec: 1, secs: 1, second: 1, seconds: 1,\n\tmin: 60, mins: 60, minute: 60, minutes: 60,\n\th: 3600, hr: 3600, hrs: 3600, hour: 3600, hours: 3600,\n};\n\n/**\n * Below this many seconds per unit, a pace keeps its ordinary rendering.\n *\n * A clock shows whole seconds, and rounding to one is immaterial at a runner's\n * pace and a real loss below a minute: `0.90 seconds/m` would read `0:01 /m`,\n * which is a different number. A minute per unit is where the rounding stops\n * mattering.\n */\nconst PACE_CLOCK_FLOOR_SECONDS = 60;\n\n/**\n * A time over a distance, written the way a runner writes it.\n *\n * `4:30/km` is four and a half minutes to cover a kilometre, and `270.00\n * seconds/km` is the same number in a spelling nobody uses. So a quantity whose\n * unit is a time over a length is shown on a clock, matching what the `pace`\n * function has always printed.\n *\n * Returns undefined for everything else, which is every other unit the engine\n * carries: a speed (`90 km/h`) is a length over a time and reads as a number, a\n * rate of pay is money over a time, and a pace faster than a minute per unit\n * keeps its digits. Callers keep the rendering they had.\n */\nfunction formatPace(value: number, unit: string): string | undefined {\n\tconst slash = unit.indexOf(\"/\");\n\tif (slash <= 0) return undefined;\n\tconst perSecond = PACE_TIME_UNITS[unit.slice(0, slash).toLowerCase()];\n\tif (perSecond === undefined) return undefined;\n\tconst distance = unit.slice(slash + 1);\n\tif (getMeasure(distance) !== \"length\") return undefined;\n\n\tconst seconds = value * perSecond;\n\tif (!Number.isFinite(seconds) || Math.abs(seconds) < PACE_CLOCK_FLOOR_SECONDS) return undefined;\n\t// The same shape `formatMsDuration` writes, so a pace and a stretch of time\n\t// read alike, with the hours dropped when there are none.\n\tconst sign = seconds < 0 ? \"-\" : \"\";\n\tconst whole = Math.round(Math.abs(seconds));\n\tconst hours = Math.floor(whole / 3600);\n\tconst mm = String(Math.floor((whole % 3600) / 60)).padStart(2, \"0\");\n\tconst ss = String(whole % 60).padStart(2, \"0\");\n\tconst clock = hours === 0 ? `${Math.floor(whole / 60)}:${ss}` : `${hours}:${mm}:${ss}`;\n\treturn `${sign}${clock} /${distance}`;\n}\n\n/** The decimal mark each locale writes, looked up once per locale rather than on every value. */\nconst decimalMarkByLocale = new Map<string, string>();\n\nfunction decimalMark(loc: string): string {\n let mark = decimalMarkByLocale.get(loc);\n if (mark === undefined) {\n mark = new Intl.NumberFormat(loc).formatToParts(1.1).find((part) => part.type === \"decimal\")?.value ?? \".\";\n decimalMarkByLocale.set(loc, mark);\n }\n return mark;\n}\n\n/**\n * Write a fixed-decimal string (`\"1234567.50\"`) the way `loc` writes numbers:\n * its decimal mark, and its digit grouping when `useGrouping` is on.\n *\n * Every quantity and every money amount used to be rendered with a bare\n * `toFixed`, so a plain `52000` showed as `52,000` while `£52000` showed as\n * `£52000.00`, and the `enableSeperator` setting had no effect on the one\n * value type people most want grouped. The digits are taken from the string\n * rather than re-rendered from the double, because an exact money amount has\n * already been rounded from its decimal (see {@link formatUom}) and\n * re-rendering would undo that. `BigInt` carries the integer part through\n * `Intl` so grouping follows the locale's own rule (Indian lakhs included)\n * rather than a hand-written every-three-digits. Anything that is not plain\n * digits, an `Infinity` or an exponent form, is returned as it came.\n */\nfunction localiseFixedDecimal(fixed: string, loc: string, useGrouping: boolean): string {\n const match = /^(-?)(\\d+)(?:\\.(\\d+))?$/.exec(fixed);\n if (!match) return fixed;\n const [, sign, integer, fraction] = match;\n const integerText = useGrouping ? BigInt(integer).toLocaleString(loc, { useGrouping: true }) : integer;\n if (fraction === undefined) return `${sign}${integerText}`;\n return `${sign}${integerText}${decimalMark(loc)}${fraction}`;\n}\n\nfunction formatUom(value: number, unit: string | undefined, locale: ILocale, settings: FormattingSettings, exact?: DecimalData, isDatetimeSpan?: boolean, explicitPlaces?: number): string {\n // A time over a distance is a pace, and a runner reads a pace on a clock.\n // Not when the line named its own place count, which asked for digits.\n if (unit !== undefined && explicitPlaces === undefined) {\n const pace = formatPace(value, unit);\n if (pace !== undefined) return `= ${pace}`;\n }\n // A clock only for the gap between two datetimes, which is marked as such.\n // A quantity in milliseconds is a quantity: `40ms + 120ms` is 190 ms, not\n // 0:00, and every neighbouring spelling already agreed (`40 milliseconds`).\n if (unit === \"ms\" && isDatetimeSpan) return `= ${formatMsDuration(value)}`;\n // A fuel-consumption unit is stored slash-free (so it is not read as a rate)\n // but shown the way it is written.\n if (unit === \"l100km\") unit = \"l/100km\";\n if (unit === \"mps2\") unit = \"m/s²\";\n\n // `1.23456 km to 4 dp` asked for four places and used to be given the\n // setting's two, because a quantity's own place count was never read here the\n // way a plain number's already was.\n const dp = explicitPlaces ?? settings.unitOfMeasurementResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n\n // For TimeSpan values (days, weeks, hours, etc.), format as integer if the value is a whole number\n const timeSpanUnits = [\"days\", \"weeks\", \"months\", \"years\", \"hours\", \"minutes\", \"seconds\", \"day\", \"week\", \"month\", \"year\", \"hour\", \"minute\", \"second\"];\n const isTimeSpan = unit && timeSpanUnits.includes(unit);\n\n // A conversion can land far below the decimal budget, and `1 Hz in MHz`\n // printing `0.00 MHz` is indistinguishable from a real zero. Three\n // significant digits instead, in exponent form once the zeros stop being\n // countable. Not for an explicit `to N dp`, which asked for those places, and\n // not for money below: a currency zero is a real answer, and `$0.001` is\n // `$0.00` because a tenth of a penny is not a payable amount.\n const tooSmall = explicitPlaces === undefined ? tooSmallToPrintText(value, dp, loc) : undefined;\n\n let formatted: string;\n if (tooSmall !== undefined) {\n formatted = tooSmall;\n } else if (isTimeSpan && value === Math.floor(value)) {\n // For whole number TimeSpan values, format as integer\n formatted = localiseFixedDecimal(value.toString(), loc, useGrouping);\n } else {\n // For other values, use the configured decimal places\n formatted = localiseFixedDecimal(value.toFixed(dp), loc, useGrouping);\n }\n\n // Currency display: symbol + culturally-conventional placement (e.g.\n // \"$100.00\" prefix vs \"100.00 kr\" suffix) instead of the generic\n // \"amount CODE\" fallback below. See uom/CurrencyAliases.ts's\n // CURRENCY_DISPLAY table for the exact set covered and the reasoning\n // behind each placement choice. Any currency code NOT in that table\n // (most of the ~150 `CurrencyExchange.isCurrency()` recognizes) falls\n // through to the unchanged \"amount CODE\" format below.\n const currencyDisplay = unit ? CURRENCY_DISPLAY[unit.toUpperCase()] : undefined;\n if (currencyDisplay) {\n // An exact money amount rounds from its decimal, not from the double: a\n // half-cent like \"$1.005\" reads as \"$1.01\" here, where \"(1.005).toFixed(2)\"\n // answers \"1.00\" because the double it is handed already sits below the\n // value the user typed. Amounts with no exact decimal (a currency\n // conversion, whose rate is a double) keep the toFixed rendering above.\n const moneyText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n const sep = currencyDisplay.spaced ? \" \" : \"\";\n const withSymbol = currencyDisplay.position === \"prefix\"\n ? `${currencyDisplay.symbol}${sep}${moneyText}`\n : `${moneyText}${sep}${currencyDisplay.symbol}`;\n return `= ${withSymbol}`;\n }\n\n // The unit is written as the symbol the value carries. There used to be a\n // `unitOfMeasurementResult.unitNames` setting here whose two branches were\n // the same expression, so it never changed anything, and it was removed\n // rather than implemented: the engine has no unit-name data to render from.\n // The generated unit table maps a spelling to [measure, ratio] only, and\n // names cannot be recovered from it, because units that differ by an OFFSET\n // share a ratio, so \"20 C\" would come back as \"20 kelvins\". A real\n // implementation needs a hand-authored name per unit plus pluralization and\n // per-locale spelling (metre against meter), which is a feature rather than\n // the repair of a dead ternary.\n //\n // An exact currency with no symbol in the display table above (one of the\n // less common ISO codes) still rounds from its decimal here, so \"1.005 UYW\"\n // reads the same way \"$1.005\" does. Non-currency Uoms never carry an exact,\n // so this leaves \"1.50 kg\" exactly as it was.\n const genericText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n return `= ${genericText} ${unit || \"\"}`.trim();\n}\n\nfunction formatMatrixEntry(entry: MatrixEntry, settings: FormattingSettings): string {\n if (typeof entry === \"boolean\") return entry ? \"true\" : \"false\";\n if (typeof entry === \"object\" && entry !== null) return formatSymbolic(entry);\n const dp = settings.floatResult.decimalPlaces;\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n return autoFormatIntegerOrFloat(entry, dp, sep, loc);\n}\n\n/**\n * Renders a Matrix matching its own literal syntax: a single row (1xN,\n * including plain vectors) as `[a, b, c]`, a single column (Nx1) as\n * `[a; b; c]`, and a general shape as `[r0c0, r0c1; r1c0, r1c1]`, row-major\n * textual output read back out of the column-major storage\n * (`columnMajorToRowMajor()`), matching how `[1,2;3,4]` is written.\n */\nfunction formatMatrix(m: MatrixData, locale: ILocale, settings: FormattingSettings): string {\n const rowMajor = columnMajorToRowMajor(m);\n const rows: string[] = [];\n for (let r = 0; r < m.rows; r++) {\n const cells: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n cells.push(formatMatrixEntry(rowMajor[r * m.cols + c], settings));\n }\n rows.push(cells.join(\", \"));\n }\n return `${locale.display.resultPrefix}[${rows.join(\"; \")}]`;\n}\n\n/**\n * Render a matrix as a multi-line, column-aligned block: one row per line (the\n * newline is where {@link formatValue}'s compact form writes `;`), each column\n * right-padded to its widest cell, and every row wrapped in `[ ... ]`. For\n * display where a grid reads better than a line, e.g. a docs notepad or a REPL:\n *\n * ```text\n * [ 1 2 ]\n * [ 30 4 ]\n * ```\n *\n * This is deliberately separate from {@link formatValue}, whose single-line\n * matrix form stays the stable, assertable text the API and the worker DTO use.\n * A 1xN row vector is one line; an Nx1 column vector is N lines.\n */\nexport function formatMatrixAligned(m: MatrixData, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const rowMajor = columnMajorToRowMajor(m);\n const cells: string[][] = [];\n for (let r = 0; r < m.rows; r++) {\n const row: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n row.push(formatMatrixEntry(rowMajor[r * m.cols + c], us));\n }\n cells.push(row);\n }\n const colWidth: number[] = [];\n for (let c = 0; c < m.cols; c++) {\n let width = 0;\n for (let r = 0; r < m.rows; r++) width = Math.max(width, cells[r][c].length);\n colWidth.push(width);\n }\n return cells\n .map((row) => `[ ${row.map((cell, c) => cell.padStart(colWidth[c])).join(\" \")} ]`)\n .join(\"\\n\");\n}\n\nfunction formatRange(min: number, max: number, locale: ILocale): string {\n return `${locale.display.resultPrefix}${min}:${max}`;\n}\n\nfunction formatPercentage(value: number, locale: ILocale, settings: FormattingSettings): string {\n // ValueType.Percentage stores a fraction (0.25 for 25%). See Value.ts's\n // documented contract and the sole producer, VM.ts's TO_PERCENTAGE opcode\n // (`right/left - 1`, e.g. 0.25 for \"800 to 1000\"). Multiply by 100 before\n // formatting; without this every percentage-change result displayed as\n // e.g. \"0.25%\" instead of \"25.00%\".\n const dp = settings.percentageResult.decimalPlaces;\n const formatted = (value * 100).toFixed(dp);\n return `= ${formatted}${locale.display.percentageSuffix}`;\n}\n\nfunction formatUnit(value: number, unit: string | undefined): string {\n return `= ${value} ${unit || \"\"}`.trim();\n}\n\n/**\n * Renders a per-person bill split: \"= $45.00 each\", or, when the division is\n * uneven, \"= $33.33 each, with 1 share paying $33.34\". Each share's amount is\n * rendered through the ordinary value formatter (a throwaway {@link Value}), so\n * a currency share honours the same symbol placement, decimal places and locale\n * as any other money and a bare share trims trailing zeros the way a plain\n * number does; the \"= \" prefix is added once, around the whole sentence, not\n * per share.\n */\n/**\n * An IP/CIDR as text: the dotted quad, plus `/prefix` when present, or a bare\n * `/prefix` when there is no address (`netmask of /24` before it resolves).\n */\nfunction formatIpCidr(data: IpCidrData): string {\n\tif (data.addr === undefined) return `/${data.prefix}`;\n\tconst dotted = formatIp(data.addr);\n\treturn data.prefix === undefined ? dotted : `${dotted}/${data.prefix}`;\n}\n\nfunction formatSplit(data: SplitData, locale: ILocale, settings: FormattingSettings): string {\n const prefix = locale.display.resultPrefix;\n const render = (share: SplitShare): string => {\n const v = data.unit !== undefined\n ? new Value(ValueType.Uom, share.value, data.unit)\n : new Value(ValueType.Number, share.value);\n v.exact = share.exact;\n const text = formatValue(v, settings);\n return text.startsWith(prefix) ? text.slice(prefix.length) : text;\n };\n\n const [base, high] = data.shares;\n const each = `${render(base)} each`;\n if (high === undefined) return `${prefix}${each}`;\n const shareWord = high.count === 1 ? \"share\" : \"shares\";\n return `${prefix}${each}, with ${high.count} ${shareWord} paying ${render(high)}`;\n}\n\n/**\n * Render an evaluated {@link Value} as a display string, dispatching on\n * `value.type` to the type-specific formatter (number, hex, datetime, unit\n * of measurement, matrix, range, percentage, ...).\n *\n * Most branches produce a `\"= \"`-prefixed result string (matching the\n * plugin's inline-result convention); `ValueType.Error` is the one\n * exception, it returns the human-readable error message directly\n * (stored in `value.unit`), not an `\"= \"`-prefixed string.\n *\n * @param value - The evaluated value to format.\n * @param settings - Locale/precision/separator options; defaults to\n * {@link DEFAULT_FORMATTING_SETTINGS} when omitted.\n * @example\n * ```typescript\n * const value = engine.evaluateExpression(\"10 USD to GBP\");\n * formatValue(value); // \"= £7.85\" (exact output depends on live exchange rates)\n * ```\n */\nexport function formatValue(value: Value, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const localeCode = us.numberResult.decimalSeparatorLocale || \"en\";\n const locale = getLocale(localeCode);\n\n switch (value.type) {\n case ValueType.Number:\n // A measurement with a tolerance renders as \"center ± spread\"; every\n // other number is unchanged, so a plain value is byte-for-byte what it was.\n if (value.uncertainty !== undefined) {\n return formatUncertain(value.value as number, value.uncertainty, locale, us);\n }\n return formatNumber(value.value as number, locale, us, value.decimalPlaces);\n case ValueType.Hex:\n return formatHex(value.value as number | bigint, us, value.unit);\n case ValueType.BigInt:\n return formatBigInt(value.value as bigint);\n case ValueType.String:\n return formatString(value.value as string);\n case ValueType.Boolean:\n return formatBoolean(value.value as boolean);\n case ValueType.Datetime:\n return formatDatetime(value.value as number, locale, us, value.zone);\n case ValueType.Uom:\n return formatUom(value.value as number, value.unit, locale, us, value.exact, value.datetimeSpan, value.decimalPlaces);\n case ValueType.Matrix:\n return formatMatrix(value.value as MatrixData, locale, us);\n case ValueType.Range: {\n const r = value.value as RangeData;\n return formatRange(r.min, r.max, locale);\n }\n case ValueType.Colour:\n return `${locale.display.resultPrefix}${formatColour(value.value as ColourData)}`;\n case ValueType.Split:\n return formatSplit(value.value as SplitData, locale, us);\n case ValueType.Chart:\n // A chart is drawn from its data by the host; the text answer is its label\n // (`sin(x) over [0, 6.28]`, or the series a sparkline came from).\n return `${locale.display.resultPrefix}${(value.value as ChartData).label}`;\n case ValueType.IpCidr:\n return `${locale.display.resultPrefix}${formatIpCidr(value.value as IpCidrData)}`;\n case ValueType.Symbolic:\n return formatSymbolic(value.value as SymbolicNode);\n case ValueType.Percentage:\n return formatPercentage(value.value as number, locale, us);\n case ValueType.Unit:\n return formatUnit(value.value as number, value.unit);\n case ValueType.Error:\n // errorValue(code, message) stores the human-readable message in\n // `.unit` (code goes in `.value`), falling through to the default\n // case here previously displayed the raw code (e.g.\n // \"CURRENCY_RATE_UNAVAILABLE\") instead of the actual message.\n return value.unit ?? String(value.value);\n default:\n return `= ${String(value.value)}`;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {a,d}from'./chunk-U5MESNRT.js';import {a as a$2}from'./chunk-36JGHDZR.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 v=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 Y=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 se(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 Z={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(Z)},{types:["LPAREN"]}],match(e,o){let t=e[o];if(!t||t.type!=="IDENT")return null;let n=Object.prototype.hasOwnProperty.call(Z,t.value.toLowerCase())?Z[t.value.toLowerCase()]:void 0;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"}],ve={name:"solve-symbolic",normalizerRules:[me(),se()],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 v,IMAGINARY:new Y,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"}},Ye=new Set(le.map(r=>r.tokenType));function Ue(r){return r.some(e=>Ye.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,K=/(?:^|[^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=[];if(r.indexOf("#")===-1)return {members:e,queries:o};let t=r.search(/\S/);K.lastIndex=0;for(let n=K.exec(r);n!==null;n=K.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,q=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,q.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=q.get(r);if(e!==void 0)return e;let o=We(r);return q.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"],X=/^\d{1,2}$/,Q=/^\d{4}$/;function Ke(r,e,o,t){let n=X.test(r),i=X.test(e),a=X.test(o);return t==="hyphen"&&Q.test(r)&&i&&a?"iso":n&&i&&Q.test(o)?"year-last-4":t==="slash"&&Q.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 h(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 ee(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 re(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 h(I,x,g)?{kind:"date",day:I,month:x,year:g,order:"ISO",shortYear:false}:f?te(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 h(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(h(s.day,s.month,l)){let x=(N.day!==s.day||N.month!==s.month)&&h(N.day,N.month,l)?ee(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"}:h(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)}.`}:te(r.text,s.day,s.month,l)}function te(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=h(i.day,i.month,t),d=h(a.day,a.month,t);if(!m&&!d)return te(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 ${ee(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 ${ee(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 oe="DATETIME_LITERAL",Le=c(oe),Oe="DATETIME_LITERAL_UNREADABLE",rt=c(Oe),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(oe,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(Oe,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(oe,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=re(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=re(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,ve 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,ee as n,re as o,Pr as p,Dr as q,oe as r,Oe as s,Ee as t,at as u,Ae as v,wr as w};//# sourceMappingURL=chunk-4H27GUVY.js.map
2
+ //# sourceMappingURL=chunk-4H27GUVY.js.map