solve-engine 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/{PackageCompatibility-CCdud__Q.d.cts → PackageCompatibility-BG0iur4I.d.cts} +1 -1
  2. package/dist/{PackageCompatibility-4QtIErfx.d.ts → PackageCompatibility-BlIcQg5v.d.ts} +1 -1
  3. package/dist/{PackageRegistry-B7wkfSrY.d.ts → PackageRegistry-BJ0QQd3k.d.ts} +4 -4
  4. package/dist/{PackageRegistry-Hx85XD01.d.cts → PackageRegistry-DeGDZkNt.d.cts} +4 -4
  5. package/dist/{Parselet-CTNpfuEB.d.cts → Parselet-BSndkWEY.d.cts} +1 -1
  6. package/dist/{Parselet-DONNUpur.d.ts → Parselet-Blq8B0Gj.d.ts} +1 -1
  7. package/dist/{ScopeManager-BkbDXK_R.d.ts → ScopeManager-CF3cZUqW.d.ts} +2 -2
  8. package/dist/{ScopeManager-Cvgypcu4.d.cts → ScopeManager-D8nLv--u.d.cts} +2 -2
  9. package/dist/{VMCheckpoints-9zBQnTsN.d.ts → VMCheckpoints-BsR5_auF.d.ts} +2 -2
  10. package/dist/{VMCheckpoints-CBMGiSqw.d.cts → VMCheckpoints-Dy39SVHa.d.cts} +2 -2
  11. package/dist/{Value-D1XlMwe2.d.cts → Value-DCTqTSeP.d.cts} +22 -5
  12. package/dist/{Value-D1XlMwe2.d.ts → Value-DCTqTSeP.d.ts} +22 -5
  13. package/dist/chunk-5AMJNF7J.js +3 -0
  14. package/dist/chunk-5AMJNF7J.js.map +1 -0
  15. package/dist/chunk-5TCSFTZD.js +2 -0
  16. package/dist/chunk-5TCSFTZD.js.map +1 -0
  17. package/dist/chunk-5TVI2UPZ.cjs +2 -0
  18. package/dist/chunk-5TVI2UPZ.cjs.map +1 -0
  19. package/dist/{chunk-ZOOVGXMK.cjs → chunk-75XDS65A.cjs} +2 -2
  20. package/dist/{chunk-ZOOVGXMK.cjs.map → chunk-75XDS65A.cjs.map} +1 -1
  21. package/dist/chunk-A33K7NY4.js +2 -0
  22. package/dist/chunk-A33K7NY4.js.map +1 -0
  23. package/dist/chunk-AQWNEO7M.cjs +2 -0
  24. package/dist/{chunk-Z5KBBQOJ.cjs.map → chunk-AQWNEO7M.cjs.map} +1 -1
  25. package/dist/{chunk-OVQ3V4CG.cjs → chunk-B7J24Q5T.cjs} +2 -2
  26. package/dist/{chunk-OVQ3V4CG.cjs.map → chunk-B7J24Q5T.cjs.map} +1 -1
  27. package/dist/{chunk-HMEZJXLX.js → chunk-CVY2A3TP.js} +2 -2
  28. package/dist/{chunk-HMEZJXLX.js.map → chunk-CVY2A3TP.js.map} +1 -1
  29. package/dist/{chunk-HOQU47MF.cjs → chunk-FNNIAJNY.cjs} +2 -2
  30. package/dist/{chunk-HOQU47MF.cjs.map → chunk-FNNIAJNY.cjs.map} +1 -1
  31. package/dist/{chunk-3AVWA5IZ.cjs → chunk-FUDVKPB7.cjs} +2 -2
  32. package/dist/{chunk-3AVWA5IZ.cjs.map → chunk-FUDVKPB7.cjs.map} +1 -1
  33. package/dist/chunk-GYX6S6OS.cjs +3 -0
  34. package/dist/chunk-GYX6S6OS.cjs.map +1 -0
  35. package/dist/{chunk-GKDZ7TSX.cjs → chunk-HAEOMJE3.cjs} +2 -2
  36. package/dist/{chunk-GKDZ7TSX.cjs.map → chunk-HAEOMJE3.cjs.map} +1 -1
  37. package/dist/{chunk-T52Y5G24.js → chunk-HF4H7LYA.js} +4 -4
  38. package/dist/{chunk-T52Y5G24.js.map → chunk-HF4H7LYA.js.map} +1 -1
  39. package/dist/chunk-HTJPV42D.js +2 -0
  40. package/dist/{chunk-XTM4HTRB.js.map → chunk-HTJPV42D.js.map} +1 -1
  41. package/dist/chunk-IHZBKT7L.cjs +3 -0
  42. package/dist/chunk-IHZBKT7L.cjs.map +1 -0
  43. package/dist/{chunk-SWKYVSMP.js → chunk-JEFMG6CV.js} +2 -2
  44. package/dist/{chunk-SWKYVSMP.js.map → chunk-JEFMG6CV.js.map} +1 -1
  45. package/dist/{chunk-P6BLASAA.js → chunk-JQBG3LX4.js} +2 -2
  46. package/dist/{chunk-P6BLASAA.js.map → chunk-JQBG3LX4.js.map} +1 -1
  47. package/dist/{chunk-GHW2X7PS.js → chunk-KHCNMNZZ.js} +2 -2
  48. package/dist/{chunk-GHW2X7PS.js.map → chunk-KHCNMNZZ.js.map} +1 -1
  49. package/dist/{chunk-4XTD4B77.js → chunk-KXM7EY27.js} +3 -3
  50. package/dist/{chunk-4XTD4B77.js.map → chunk-KXM7EY27.js.map} +1 -1
  51. package/dist/{chunk-R7T3NGUE.cjs → chunk-MVP2YD4X.cjs} +2 -2
  52. package/dist/{chunk-R7T3NGUE.cjs.map → chunk-MVP2YD4X.cjs.map} +1 -1
  53. package/dist/chunk-N4HJTHZR.js +2 -0
  54. package/dist/{chunk-ZJPAPBP3.js.map → chunk-N4HJTHZR.js.map} +1 -1
  55. package/dist/chunk-P5EMTVMJ.js +3 -0
  56. package/dist/chunk-P5EMTVMJ.js.map +1 -0
  57. package/dist/chunk-PNDQRCRQ.cjs +2 -0
  58. package/dist/chunk-PNDQRCRQ.cjs.map +1 -0
  59. package/dist/{chunk-B4P4M4ZW.cjs → chunk-W7VOTR2J.cjs} +3 -3
  60. package/dist/{chunk-B4P4M4ZW.cjs.map → chunk-W7VOTR2J.cjs.map} +1 -1
  61. package/dist/{chunk-VYWGUMFW.js → chunk-WTEXBPBR.js} +2 -2
  62. package/dist/{chunk-VYWGUMFW.js.map → chunk-WTEXBPBR.js.map} +1 -1
  63. package/dist/{chunk-KSDTVFXA.cjs → chunk-ZRFUD2LX.cjs} +4 -4
  64. package/dist/{chunk-KSDTVFXA.cjs.map → chunk-ZRFUD2LX.cjs.map} +1 -1
  65. package/dist/constants.cjs +1 -1
  66. package/dist/constants.js +1 -1
  67. package/dist/engine.cjs +1 -1
  68. package/dist/engine.d.cts +7 -7
  69. package/dist/engine.d.ts +7 -7
  70. package/dist/engine.js +1 -1
  71. package/dist/format.cjs +1 -1
  72. package/dist/format.d.cts +1 -1
  73. package/dist/format.d.ts +1 -1
  74. package/dist/format.js +1 -1
  75. package/dist/index.cjs +1 -1
  76. package/dist/index.d.cts +7 -7
  77. package/dist/index.d.ts +7 -7
  78. package/dist/index.js +1 -1
  79. package/dist/language.d.cts +6 -6
  80. package/dist/language.d.ts +6 -6
  81. package/dist/packages.cjs +1 -1
  82. package/dist/packages.d.cts +6 -6
  83. package/dist/packages.d.ts +6 -6
  84. package/dist/packages.js +1 -1
  85. package/dist/parser.cjs +1 -1
  86. package/dist/parser.d.cts +3 -3
  87. package/dist/parser.d.ts +3 -3
  88. package/dist/parser.js +1 -1
  89. package/dist/{pipeline-DY0rhgQG.d.cts → pipeline-BM8xc0CZ.d.cts} +3 -3
  90. package/dist/{pipeline-BH7BFOTJ.d.ts → pipeline-J2ehIm7t.d.ts} +3 -3
  91. package/dist/resolvers.d.cts +1 -1
  92. package/dist/resolvers.d.ts +1 -1
  93. package/dist/testing.cjs +2 -2
  94. package/dist/testing.d.cts +6 -6
  95. package/dist/testing.d.ts +6 -6
  96. package/dist/testing.js +1 -1
  97. package/dist/uom.cjs +1 -1
  98. package/dist/uom.d.cts +1 -1
  99. package/dist/uom.d.ts +1 -1
  100. package/dist/uom.js +1 -1
  101. package/dist/vm.cjs +1 -1
  102. package/dist/vm.d.cts +6 -6
  103. package/dist/vm.d.ts +6 -6
  104. package/dist/vm.js +1 -1
  105. package/dist/worker.cjs +2 -2
  106. package/dist/worker.cjs.map +1 -1
  107. package/dist/worker.d.cts +15 -5
  108. package/dist/worker.d.ts +15 -5
  109. package/dist/worker.js +2 -2
  110. package/dist/worker.js.map +1 -1
  111. package/package.json +1 -1
  112. package/dist/chunk-3DD2RVBI.cjs +0 -3
  113. package/dist/chunk-3DD2RVBI.cjs.map +0 -1
  114. package/dist/chunk-5FGOIDLS.cjs +0 -2
  115. package/dist/chunk-5FGOIDLS.cjs.map +0 -1
  116. package/dist/chunk-5OIXCVB2.js +0 -3
  117. package/dist/chunk-5OIXCVB2.js.map +0 -1
  118. package/dist/chunk-ESUN2THE.cjs +0 -2
  119. package/dist/chunk-ESUN2THE.cjs.map +0 -1
  120. package/dist/chunk-IO374J6Z.js +0 -2
  121. package/dist/chunk-IO374J6Z.js.map +0 -1
  122. package/dist/chunk-R2ENWQ76.js +0 -2
  123. package/dist/chunk-R2ENWQ76.js.map +0 -1
  124. package/dist/chunk-SOSUS2SK.cjs +0 -3
  125. package/dist/chunk-SOSUS2SK.cjs.map +0 -1
  126. package/dist/chunk-T4Y5XOT2.js +0 -3
  127. package/dist/chunk-T4Y5XOT2.js.map +0 -1
  128. package/dist/chunk-XTM4HTRB.js +0 -2
  129. package/dist/chunk-Z5KBBQOJ.cjs +0 -2
  130. package/dist/chunk-ZJPAPBP3.js +0 -2
@@ -1,4 +1,4 @@
1
- import { I as IEnginePackage } from './PackageRegistry-Hx85XD01.cjs';
1
+ import { I as IEnginePackage } from './PackageRegistry-DeGDZkNt.cjs';
2
2
 
3
3
  /**
4
4
  * Package load-time compatibility checking, the "detect overlapping
@@ -1,4 +1,4 @@
1
- import { I as IEnginePackage } from './PackageRegistry-B7wkfSrY.js';
1
+ import { I as IEnginePackage } from './PackageRegistry-BJ0QQd3k.js';
2
2
 
3
3
  /**
4
4
  * Package load-time compatibility checking, the "detect overlapping
@@ -1,13 +1,13 @@
1
- import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-DONNUpur.js';
2
- import { V as Value, b as ValueType } from './Value-D1XlMwe2.js';
1
+ import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-Blq8B0Gj.js';
2
+ import { V as Value, b as ValueType } from './Value-DCTqTSeP.js';
3
3
  import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-DKMlj7Sy.js';
4
4
  import { IAsyncResolver } from './resolvers.js';
5
5
  import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DCWdZjGz.js';
6
- import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-BkbDXK_R.js';
6
+ import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-CF3cZUqW.js';
7
7
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.js';
8
8
  import { QueryClient } from '@tanstack/query-core';
9
9
  import { E as EngineError } from './EngineError-Ce1lPkjZ.js';
10
- import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-BH7BFOTJ.js';
10
+ import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-J2ehIm7t.js';
11
11
  import { T as Token } from './Token-CbP_OutD.js';
12
12
  import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-BGQn-cJ8.js';
13
13
 
@@ -1,13 +1,13 @@
1
- import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-CTNpfuEB.cjs';
2
- import { V as Value, b as ValueType } from './Value-D1XlMwe2.cjs';
1
+ import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-BSndkWEY.cjs';
2
+ import { V as Value, b as ValueType } from './Value-DCTqTSeP.cjs';
3
3
  import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-B4C1qHXu.cjs';
4
4
  import { IAsyncResolver } from './resolvers.cjs';
5
5
  import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DnlL7_8c.cjs';
6
- import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-Cvgypcu4.cjs';
6
+ import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-D8nLv--u.cjs';
7
7
  import { a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.cjs';
8
8
  import { QueryClient } from '@tanstack/query-core';
9
9
  import { E as EngineError } from './EngineError-Ce1lPkjZ.cjs';
10
- import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DY0rhgQG.cjs';
10
+ import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-BM8xc0CZ.cjs';
11
11
  import { T as Token } from './Token-CbP_OutD.cjs';
12
12
  import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-BGQn-cJ8.cjs';
13
13
 
@@ -1,6 +1,6 @@
1
1
  import { B as BytecodeBuilder } from './BytecodeBuilder-BGq9ZiO3.cjs';
2
2
  import { T as Token } from './Token-CbP_OutD.cjs';
3
- import { D as DiagnosticPipeline } from './pipeline-DY0rhgQG.cjs';
3
+ import { D as DiagnosticPipeline } from './pipeline-BM8xc0CZ.cjs';
4
4
 
5
5
  /**
6
6
  * Dual-keyed ParseletRegistry, accepts both string token types and
@@ -1,6 +1,6 @@
1
1
  import { B as BytecodeBuilder } from './BytecodeBuilder-BGq9ZiO3.js';
2
2
  import { T as Token } from './Token-CbP_OutD.js';
3
- import { D as DiagnosticPipeline } from './pipeline-BH7BFOTJ.js';
3
+ import { D as DiagnosticPipeline } from './pipeline-J2ehIm7t.js';
4
4
 
5
5
  /**
6
6
  * Dual-keyed ParseletRegistry, accepts both string token types and
@@ -1,7 +1,7 @@
1
- import { V as Value } from './Value-D1XlMwe2.js';
1
+ import { V as Value } from './Value-DCTqTSeP.js';
2
2
  import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.js';
3
3
  import { E as EngineError } from './EngineError-Ce1lPkjZ.js';
4
- import { D as DiagnosticPipeline } from './pipeline-BH7BFOTJ.js';
4
+ import { D as DiagnosticPipeline } from './pipeline-J2ehIm7t.js';
5
5
 
6
6
  /**
7
7
  * Create a new VM instance with the given opcode registry and configurable limits.
@@ -1,7 +1,7 @@
1
- import { V as Value } from './Value-D1XlMwe2.cjs';
1
+ import { V as Value } from './Value-DCTqTSeP.cjs';
2
2
  import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-BGq9ZiO3.cjs';
3
3
  import { E as EngineError } from './EngineError-Ce1lPkjZ.cjs';
4
- import { D as DiagnosticPipeline } from './pipeline-DY0rhgQG.cjs';
4
+ import { D as DiagnosticPipeline } from './pipeline-BM8xc0CZ.cjs';
5
5
 
6
6
  /**
7
7
  * Create a new VM instance with the given opcode registry and configurable limits.
@@ -1,5 +1,5 @@
1
- import { V as Value } from './Value-D1XlMwe2.js';
2
- import { V as VM } from './ScopeManager-BkbDXK_R.js';
1
+ import { V as Value } from './Value-DCTqTSeP.js';
2
+ import { V as VM } from './ScopeManager-CF3cZUqW.js';
3
3
  import { U as UserFunctionDef } from './BytecodeBuilder-BGq9ZiO3.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { V as Value } from './Value-D1XlMwe2.cjs';
2
- import { V as VM } from './ScopeManager-Cvgypcu4.cjs';
1
+ import { V as Value } from './Value-DCTqTSeP.cjs';
2
+ import { V as VM } from './ScopeManager-D8nLv--u.cjs';
3
3
  import { U as UserFunctionDef } from './BytecodeBuilder-BGq9ZiO3.cjs';
4
4
 
5
5
  /**
@@ -273,6 +273,18 @@ interface ChartData {
273
273
  /** The source expression, for a plot; absent for a sparkline. */
274
274
  readonly expr?: string;
275
275
  }
276
+ /**
277
+ * An IPv4 address and/or subnet prefix (issue #189). `addr` is the 32-bit
278
+ * address (`192.168.1.10` held as one number); `prefix` is the CIDR prefix
279
+ * length in `/24`. A bare address has no `prefix`, a bare `/24` has no `addr`,
280
+ * and a full block (`192.168.1.0/24`) has both. Lives in a {@link Value}'s
281
+ * `value` slot as the other struct payloads do; the formatter renders it as the
282
+ * dotted quad (plus `/prefix` when present).
283
+ */
284
+ interface IpCidrData {
285
+ readonly addr?: number;
286
+ readonly prefix?: number;
287
+ }
276
288
  /**
277
289
  * Discriminated union tag for {@link Value} objects.
278
290
  *
@@ -308,7 +320,9 @@ declare enum ValueType {
308
320
  /** A per-person bill split (`split $180 between 4`). Value is {@link SplitData}. */
309
321
  Split = 15,
310
322
  /** A chart to draw (`[1,2,3] as sparkline`, `plot sin(x) from 0 to 2pi`). Value is {@link ChartData}. */
311
- Chart = 16
323
+ Chart = 16,
324
+ /** An IPv4 address or subnet (`192.168.1.0/24`). Value is {@link IpCidrData}. */
325
+ IpCidr = 17
312
326
  }
313
327
  /**
314
328
  * Universal runtime value for the solve-js VM.
@@ -324,7 +338,7 @@ declare enum ValueType {
324
338
  declare class Value {
325
339
  private _cachedNumber;
326
340
  type: ValueType;
327
- value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode;
341
+ value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode;
328
342
  unit?: string;
329
343
  /** Set by async resolvers when a fetch timed out, the result is a fallback (typically 0). */
330
344
  timedOut?: boolean;
@@ -393,12 +407,12 @@ declare class Value {
393
407
  * by {@link recycle} alongside the other sidecars.
394
408
  */
395
409
  decimalPlaces?: number;
396
- constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode, unit?: string);
410
+ constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string);
397
411
  /**
398
412
  * Phase 5.3: Reset all fields for arena reuse.
399
413
  * Called by ValueArena.acquire(), zero allocation, just field assignment.
400
414
  */
401
- recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode, unit?: string): void;
415
+ recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string): void;
402
416
  isNumber(): this is Value & {
403
417
  value: number;
404
418
  };
@@ -425,6 +439,9 @@ declare class Value {
425
439
  isChart(): this is Value & {
426
440
  value: ChartData;
427
441
  };
442
+ isIpCidr(): this is Value & {
443
+ value: IpCidrData;
444
+ };
428
445
  isSymbolic(): this is Value & {
429
446
  value: SymbolicNode;
430
447
  };
@@ -516,4 +533,4 @@ declare function colVectorValue(data: readonly number[]): Value;
516
533
  /** Create a Range value, a first-class integer range `min:max`, both bounds inclusive. */
517
534
  declare function rangeValue(min: number, max: number): Value;
518
535
 
519
- export { type ColourData as C, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type ChartData as f, type SymbolicNode as g, hexValue as h, type ColourFormat as i, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
536
+ export { type ColourData as C, type IpCidrData as I, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type ChartData as f, type SymbolicNode as g, hexValue as h, type ColourFormat as i, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
@@ -273,6 +273,18 @@ interface ChartData {
273
273
  /** The source expression, for a plot; absent for a sparkline. */
274
274
  readonly expr?: string;
275
275
  }
276
+ /**
277
+ * An IPv4 address and/or subnet prefix (issue #189). `addr` is the 32-bit
278
+ * address (`192.168.1.10` held as one number); `prefix` is the CIDR prefix
279
+ * length in `/24`. A bare address has no `prefix`, a bare `/24` has no `addr`,
280
+ * and a full block (`192.168.1.0/24`) has both. Lives in a {@link Value}'s
281
+ * `value` slot as the other struct payloads do; the formatter renders it as the
282
+ * dotted quad (plus `/prefix` when present).
283
+ */
284
+ interface IpCidrData {
285
+ readonly addr?: number;
286
+ readonly prefix?: number;
287
+ }
276
288
  /**
277
289
  * Discriminated union tag for {@link Value} objects.
278
290
  *
@@ -308,7 +320,9 @@ declare enum ValueType {
308
320
  /** A per-person bill split (`split $180 between 4`). Value is {@link SplitData}. */
309
321
  Split = 15,
310
322
  /** A chart to draw (`[1,2,3] as sparkline`, `plot sin(x) from 0 to 2pi`). Value is {@link ChartData}. */
311
- Chart = 16
323
+ Chart = 16,
324
+ /** An IPv4 address or subnet (`192.168.1.0/24`). Value is {@link IpCidrData}. */
325
+ IpCidr = 17
312
326
  }
313
327
  /**
314
328
  * Universal runtime value for the solve-js VM.
@@ -324,7 +338,7 @@ declare enum ValueType {
324
338
  declare class Value {
325
339
  private _cachedNumber;
326
340
  type: ValueType;
327
- value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode;
341
+ value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode;
328
342
  unit?: string;
329
343
  /** Set by async resolvers when a fetch timed out, the result is a fallback (typically 0). */
330
344
  timedOut?: boolean;
@@ -393,12 +407,12 @@ declare class Value {
393
407
  * by {@link recycle} alongside the other sidecars.
394
408
  */
395
409
  decimalPlaces?: number;
396
- constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode, unit?: string);
410
+ constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string);
397
411
  /**
398
412
  * Phase 5.3: Reset all fields for arena reuse.
399
413
  * Called by ValueArena.acquire(), zero allocation, just field assignment.
400
414
  */
401
- recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | SymbolicNode, unit?: string): void;
415
+ recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string): void;
402
416
  isNumber(): this is Value & {
403
417
  value: number;
404
418
  };
@@ -425,6 +439,9 @@ declare class Value {
425
439
  isChart(): this is Value & {
426
440
  value: ChartData;
427
441
  };
442
+ isIpCidr(): this is Value & {
443
+ value: IpCidrData;
444
+ };
428
445
  isSymbolic(): this is Value & {
429
446
  value: SymbolicNode;
430
447
  };
@@ -516,4 +533,4 @@ declare function colVectorValue(data: readonly number[]): Value;
516
533
  /** Create a Range value, a first-class integer range `min:max`, both bounds inclusive. */
517
534
  declare function rangeValue(min: number, max: number): Value;
518
535
 
519
- export { type ColourData as C, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type ChartData as f, type SymbolicNode as g, hexValue as h, type ColourFormat as i, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
536
+ export { type ColourData as C, type IpCidrData as I, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type ChartData as f, type SymbolicNode as g, hexValue as h, type ColourFormat as i, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
@@ -0,0 +1,3 @@
1
+ import {a as a$1}from'./chunk-XEIDV5JP.js';import {g,D as D$1}from'./chunk-5TCSFTZD.js';import {Z,R as R$1,ua,sa}from'./chunk-WTEXBPBR.js';import {m}from'./chunk-A33K7NY4.js';import {a}from'./chunk-62LMTO4F.js';var b={floatResult:{decimalPlaces:2,enableSeperator:true},numberResult:{decimalSeparatorLocale:"en-US"},hexResult:{enablePadding:false,paddingZeros:0},unitOfMeasurementResult:{decimalPlaces:2},percentageResult:{decimalPlaces:2},dateResult:{format:"long"}};function F(t,r,o,n){let e=o.floatResult.enableSeperator,a=o.numberResult.decimalSeparatorLocale;if(n!==void 0&&Number.isFinite(t)){let c=t.toLocaleString(a||"en-US",{minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:e});return `${r.display.resultPrefix}${c}`}let i=o.floatResult.decimalPlaces,s=a$1(t,i,e,a);return `${r.display.resultPrefix}${s}`}function R(t,r,o,n){let e=n.floatResult.decimalPlaces,a=n.floatResult.enableSeperator,i=n.numberResult.decimalSeparatorLocale||"en-US",s=Math.max(e,1),c=t.toLocaleString(i,{useGrouping:a,minimumFractionDigits:0,maximumFractionDigits:e}),u=Math.abs(r).toLocaleString(i,{useGrouping:a,minimumFractionDigits:1,maximumFractionDigits:s});return `${o.display.resultPrefix}${c} \xB1 ${u}`}function L(t,r,o){if(typeof t=="number"&&!Number.isFinite(t))return `= ${t}`;let n=typeof t=="bigint"?t<0n:t<0,e=n?"-":"",a=c=>typeof t=="bigint"?(n?-t:t).toString(c):Math.abs(Math.trunc(t)).toString(c);if(o==="bin")return `= ${e}0b${a(2)}`;if(o==="oct")return `= ${e}0o${a(8)}`;let i=r.hexResult.enablePadding?r.hexResult.paddingZeros:0,s=a(16).toUpperCase().padStart(i,"0");return `= ${e}0x${s}`}var I=2e4;function P(t){let r=t<0n?-t:t;if(Number.isFinite(Number(r)))return `= ${t}`;let o=r.toString(16).length*4;if(o*Math.LN2/Math.LN10<=I)return `= ${t}`;let n=o*Math.LN2/Math.LN10,e=Math.floor(n),a=Math.pow(10,n-e);return `= ${t<0n?"-":""}~${a.toFixed(3)}e+${e} (an exact integer of about ${(e+1).toLocaleString("en-US")} digits, too large to print)`}function T(t){return `= ${t}`}function w(t){return `= ${t}`}function N(t,r,o){let n=new Date(t),e=o.dateResult?.format??"long",a=n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0&&n.getMilliseconds()===0;if(e==="long"){let g=n.toLocaleDateString(r.code,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return a?`= ${g}`:`= ${g}, ${n.toLocaleTimeString(r.code)}`}let i=g=>String(g).padStart(2,"0"),s=n.getFullYear(),c=i(n.getMonth()+1),u=i(n.getDate()),m;if(e==="iso"?m=`${s}-${c}-${u}`:e==="dmy"?m=`${u}/${c}/${s}`:m=`${c}/${u}/${s}`,a)return `= ${m}`;let l=`${i(n.getHours())}:${i(n.getMinutes())}:${i(n.getSeconds())}`;return e==="iso"?`= ${m}T${l}`:`= ${m} ${l}`}function C(t){let r=t<0?"-":"",o=Math.round(Math.abs(t)/1e3),n=Math.floor(o/3600),e=Math.floor(o%3600/60),a=o%60,i=String(e).padStart(2,"0");if(a===0)return `${r}${n}:${i}`;let s=String(a).padStart(2,"0");return `${r}${n}:${i}:${s}`}function U(t,r,o,n,e){if(r==="ms")return `= ${C(t)}`;let a=n.unitOfMeasurementResult.decimalPlaces,s=r&&["days","weeks","months","years","hours","minutes","seconds","day","week","month","year","hour","minute","second"].includes(r),c;s&&t===Math.floor(t)?c=t.toString():c=t.toFixed(a);let u=r?ua[r.toUpperCase()]:void 0;if(u){let l=e?sa(e,a):c,g=u.spaced?" ":"";return `= ${u.position==="prefix"?`${u.symbol}${g}${l}`:`${l}${g}${u.symbol}`}`}return `= ${e?sa(e,a):c} ${r||""}`.trim()}function D(t,r){if(typeof t=="boolean")return t?"true":"false";if(typeof t=="object"&&t!==null)return R$1(t);let o=r.floatResult.decimalPlaces,n=r.floatResult.enableSeperator,e=r.numberResult.decimalSeparatorLocale;return a$1(t,o,n,e)}function E(t,r,o){let n=Z(t),e=[];for(let a=0;a<t.rows;a++){let i=[];for(let s=0;s<t.cols;s++)i.push(D(n[a*t.cols+s],o));e.push(i.join(", "));}return `${r.display.resultPrefix}[${e.join("; ")}]`}function et(t,r){let o=r||b,n=Z(t),e=[];for(let i=0;i<t.rows;i++){let s=[];for(let c=0;c<t.cols;c++)s.push(D(n[i*t.cols+c],o));e.push(s);}let a=[];for(let i=0;i<t.cols;i++){let s=0;for(let c=0;c<t.rows;c++)s=Math.max(s,e[c][i].length);a.push(s);}return e.map(i=>`[ ${i.map((s,c)=>s.padStart(a[c])).join(" ")} ]`).join(`
2
+ `)}function j(t,r,o){return `${o.display.resultPrefix}${t}:${r}`}function A(t,r,o){let n=o.percentageResult.decimalPlaces;return `= ${(t*100).toFixed(n)}${r.display.percentageSuffix}`}function G(t,r){return `= ${t} ${r||""}`.trim()}function O(t){if(t.addr===void 0)return `/${t.prefix}`;let r=D$1(t.addr);return t.prefix===void 0?r:`${r}/${t.prefix}`}function _(t,r,o){let n=r.display.resultPrefix,e=u=>{let m$1=t.unit!==void 0?new m(6,u.value,t.unit):new m(0,u.value);m$1.exact=u.exact;let l=B(m$1,o);return l.startsWith(n)?l.slice(n.length):l},[a,i]=t.shares,s=`${e(a)} each`;if(i===void 0)return `${n}${s}`;let c=i.count===1?"share":"shares";return `${n}${s}, with ${i.count} ${c} paying ${e(i)}`}function B(t,r){let o=r||b,n=o.numberResult.decimalSeparatorLocale||"en",e=a(n);switch(t.type){case 0:return t.uncertainty!==void 0?R(t.value,t.uncertainty,e,o):F(t.value,e,o,t.decimalPlaces);case 1:return L(t.value,o,t.unit);case 2:return P(t.value);case 3:return T(t.value);case 10:return w(t.value);case 4:return N(t.value,e,o);case 6:return U(t.value,t.unit,e,o,t.exact);case 7:return E(t.value,e,o);case 8:{let a=t.value;return j(a.min,a.max,e)}case 14:return `${e.display.resultPrefix}${g(t.value)}`;case 15:return _(t.value,e,o);case 16:return `${e.display.resultPrefix}${t.value.label}`;case 17:return `${e.display.resultPrefix}${O(t.value)}`;case 9:return R$1(t.value);case 5:return A(t.value,e,o);case 11:return G(t.value,t.unit);case 13:return t.unit??String(t.value);default:return `= ${String(t.value)}`}}export{b as a,et as b,B as c};//# sourceMappingURL=chunk-5AMJNF7J.js.map
3
+ //# sourceMappingURL=chunk-5AMJNF7J.js.map
@@ -0,0 +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","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","d","format","isMidnight","dateStr","p2","n","year","month","day","datePart","time","formatMsDuration","ms","totalSeconds","hours","minutes","seconds","mm","ss","formatUom","unit","exact","isTimeSpan","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":"mNA8CO,IAAMA,CAAAA,CAAkD,CAC7D,WAAA,CAAa,CACX,aAAA,CAAe,CAAA,CACf,eAAA,CAAiB,IACnB,CAAA,CACA,YAAA,CAAc,CACZ,sBAAA,CAAwB,OAC1B,EACA,SAAA,CAAW,CACT,aAAA,CAAe,KAAA,CACf,YAAA,CAAc,CAChB,CAAA,CACA,uBAAA,CAAyB,CACvB,aAAA,CAAe,CACjB,CAAA,CACA,gBAAA,CAAkB,CAChB,cAAe,CACjB,CAAA,CACA,UAAA,CAAY,CACV,MAAA,CAAQ,MACV,CACF,ECxDA,SAASC,CAAAA,CAAaC,CAAAA,CAAeC,CAAAA,CAAiBC,CAAAA,CAA8BC,CAAAA,CAAgC,CAClH,IAAMC,CAAAA,CAAMF,CAAAA,CAAS,WAAA,CAAY,eAAA,CAC3BG,CAAAA,CAAMH,CAAAA,CAAS,YAAA,CAAa,sBAAA,CAMlC,GAAIC,CAAAA,GAAkB,MAAA,EAAa,MAAA,CAAO,QAAA,CAASH,CAAK,CAAA,CAAG,CACzD,IAAMM,CAAAA,CAAYN,CAAAA,CAAM,cAAA,CAAeK,CAAAA,EAAO,OAAA,CAAS,CACrD,qBAAA,CAAuBF,CAAAA,CACvB,qBAAA,CAAuBA,CAAAA,CACvB,WAAA,CAAaC,CACf,CAAC,CAAA,CACD,OAAO,CAAA,EAAGH,CAAAA,CAAO,OAAA,CAAQ,YAAY,CAAA,EAAGK,CAAS,CAAA,CACnD,CACA,IAAMC,CAAAA,CAAKL,CAAAA,CAAS,YAAY,aAAA,CAC1BI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D,KAAA,EAAA,CACE,OAAOS,EAAWlF,CAAAA,CAAM,KAAA,CAAiBA,EAAM,IAAI,CAAA,CACrD,QAKE,OAAOA,CAAAA,CAAM,MAAQ,MAAA,CAAOA,CAAAA,CAAM,KAAK,CAAA,CACzC,QACE,OAAO,CAAA,EAAA,EAAK,MAAA,CAAOA,EAAM,KAAK,CAAC,EACnC,CACF","file":"chunk-5AMJNF7J.js","sourcesContent":["/**\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 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 } from \"@solve-js/utilities/Number\";\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\";\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 const formatted = 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 */\nfunction formatDatetime(value: number, locale: ILocale, settings: FormattingSettings): string {\n const d = new Date(value);\n const format = settings.dateResult?.format ?? \"long\";\n const isMidnight = d.getHours() === 0 && d.getMinutes() === 0 && d.getSeconds() === 0 && d.getMilliseconds() === 0;\n\n // The spelled-out default, localised through the locale's own names.\n if (format === \"long\") {\n const dateStr = d.toLocaleDateString(locale.code, { weekday: \"long\", year: \"numeric\", month: \"long\", day: \"numeric\" });\n if (isMidnight) return `= ${dateStr}`;\n return `= ${dateStr}, ${d.toLocaleTimeString(locale.code)}`;\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.getFullYear();\n const month = p2(d.getMonth() + 1);\n const day = p2(d.getDate());\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.getHours())}:${p2(d.getMinutes())}:${p2(d.getSeconds())}`;\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\nfunction formatUom(value: number, unit: string | undefined, locale: ILocale, settings: FormattingSettings, exact?: DecimalData): string {\n if (unit === \"ms\") return `= ${formatMsDuration(value)}`;\n\n const dp = settings.unitOfMeasurementResult.decimalPlaces;\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 let formatted: string;\n if (isTimeSpan && value === Math.floor(value)) {\n // For whole number TimeSpan values, format as integer\n formatted = value.toString();\n } else {\n // For other values, use the configured decimal places\n formatted = value.toFixed(dp);\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 ? decimalToFixed(exact, dp) : 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 ? decimalToFixed(exact, dp) : 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);\n case ValueType.Uom:\n return formatUom(value.value as number, value.unit, locale, us, value.exact);\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
+ var w={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=w[e];return n?{r:n[0],g:n[1],b:n[2],a:1,format:"named",name:e}:null}function _(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 p(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 E(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}=p(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}=p(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 d(r){let e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function $(r){return .2126*d(r.r)+.7152*d(r.g)+.0722*d(r.b)}function C(r,e){let n=$(r)+.05,t=$(e)+.05;return n>t?n/t:t/n}function x(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=p(r.r,r.g,r.b);e(n);let{r:t,g:o,b:a}=M(n.h,n.s,n.l);return x(r,{r:t,g:o,b:a})}function O(r,e){return g(r,n=>n.l=b(n.l+e))}function j(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 G(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 P(r){return H(r,180)}function U(r){let e=s(.299*r.r+.587*r.g+.114*r.b);return x(r,{r:e,g:e,b:e})}function z(r,e=1){let n=b(e);return x(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 D(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 y={r:255,g:255,b:255,a:1,format:"hex"},k={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 D(r,y,e)}function Q(r,e){return D(r,k,e)}function X(r,e){return D(r,I,e)}function N(r){return C(r,y)>=C(r,k)}function Z(r){return N(r)?y:k}var h={aa:4.5,aaa:7,aaLarge:3,aaaLarge:4.5};function rr(r,e){let n=C(r,e);return n>=h.aaa?"AAA":n>=h.aa?"AA":n>=h.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)}export{h as A,rr as B,nr as C,tr as D,S as E,or as F,ar as G,ur as H,s as a,b,_ as c,p as d,M as e,A as f,E as g,$ as h,C as i,O as j,j as k,B as l,G as m,H as n,P as o,U as p,z as q,D as r,K as s,V as t,Y as u,J as v,Q as w,X as x,N as y,Z as z};//# sourceMappingURL=chunk-5TCSFTZD.js.map
2
+ //# sourceMappingURL=chunk-5TCSFTZD.js.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,GAAA,CAAK,GAAG,CAAA,CAC5B,IAAA,CAAM,CAAC,CAAA,CAAG,GAAA,CAAK,GAAG,CAAA,CAClB,WAAY,CAAC,GAAA,CAAK,GAAA,CAAK,GAAG,EAC1B,KAAA,CAAO,CAAC,GAAA,CAAK,GAAA,CAAK,GAAG,CAAA,CACrB,KAAA,CAAO,CAAC,GAAA,CAAK,IAAK,GAAG,CAAA,CACrB,MAAA,CAAQ,CAAC,IAAK,GAAA,CAAK,GAAG,CAAA,CACtB,KAAA,CAAO,CAAC,CAAA,CAAG,CAAA,CAAG,CAAC,CAAA,CACf,eAAgB,CAAC,GAAA,CAAK,GAAA,CAAK,GAAG,EAC9B,IAAA,CAAM,CAAC,CAAA,CAAG,CAAA,CAAG,GAAG,CAAA,CAChB,UAAA,CAAY,CAAC,GAAA,CAAK,GAAI,GAAG,CAAA,CACzB,KAAA,CAAO,CAAC,IAAK,EAAA,CAAI,EAAE,EACnB,SAAA,CAAW,CAAC,IAAK,GAAA,CAAK,GAAG,CAAA,CACzB,SAAA,CAAW,CAAC,EAAA,CAAI,GAAA,CAAK,GAAG,CAAA,CACxB,WAAY,CAAC,GAAA,CAAK,GAAA,CAAK,CAAC,EACxB,SAA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AO,CACrC,CAGO,SAASS,GAAiBL,CAAAA,CAAcJ,CAAAA,CAAwB,CACtE,OAAA,CAAQI,EAAQ,CAACE,CAAAA,CAAQN,CAAM,CAAA,GAAM,KAAQ,CAC9C,CAGO,SAASU,EAAAA,CAAeN,EAAcO,CAAAA,CAAmBX,CAAAA,CAAyB,CACxF,OAAOQ,EAAeJ,CAAAA,CAAMJ,CAAM,IAAMQ,CAAAA,CAAeG,CAAAA,CAAWX,CAAM,CACzE","file":"chunk-5TCSFTZD.js","sourcesContent":["/**\n * The complete CSS Color Module Level 4 named-colour set, as canonical sRGB\n * `[r, g, b]` triples (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 = CSS_NAMED_COLOURS[key];\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"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';var w={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=w[e];return n?{r:n[0],g:n[1],b:n[2],a:1,format:"named",name:e}:null}function _(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 p(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 E(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}=p(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}=p(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 d(r){let e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function $(r){return .2126*d(r.r)+.7152*d(r.g)+.0722*d(r.b)}function C(r,e){let n=$(r)+.05,t=$(e)+.05;return n>t?n/t:t/n}function x(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=p(r.r,r.g,r.b);e(n);let{r:t,g:o,b:a}=M(n.h,n.s,n.l);return x(r,{r:t,g:o,b:a})}function O(r,e){return g(r,n=>n.l=b(n.l+e))}function j(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 G(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 P(r){return H(r,180)}function U(r){let e=s(.299*r.r+.587*r.g+.114*r.b);return x(r,{r:e,g:e,b:e})}function z(r,e=1){let n=b(e);return x(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 D(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 y={r:255,g:255,b:255,a:1,format:"hex"},k={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 D(r,y,e)}function Q(r,e){return D(r,k,e)}function X(r,e){return D(r,I,e)}function N(r){return C(r,y)>=C(r,k)}function Z(r){return N(r)?y:k}var h={aa:4.5,aaa:7,aaLarge:3,aaaLarge:4.5};function rr(r,e){let n=C(r,e);return n>=h.aaa?"AAA":n>=h.aa?"AA":n>=h.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=h;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=_;exports.d=p;exports.e=M;exports.f=A;exports.g=E;exports.h=$;exports.i=C;exports.j=O;exports.k=j;exports.l=B;exports.m=G;exports.n=H;exports.o=P;exports.p=U;exports.q=z;exports.r=D;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-5TVI2UPZ.cjs.map
2
+ //# sourceMappingURL=chunk-5TVI2UPZ.cjs.map