solve-engine 2.38.21 → 2.38.23

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 (94) hide show
  1. package/dist/{PackageCompatibility-ZCZVGHws.d.ts → PackageCompatibility-C7ILySsH.d.ts} +1 -1
  2. package/dist/{PackageCompatibility-Bv42nEm2.d.cts → PackageCompatibility-CzDzOIg9.d.cts} +1 -1
  3. package/dist/{PackageRegistry-7dFbaAZp.d.cts → PackageRegistry-Bd8ErpwZ.d.cts} +78 -1
  4. package/dist/{PackageRegistry-B6s8LGCu.d.ts → PackageRegistry-D7_B0mxv.d.ts} +78 -1
  5. package/dist/{VMBuiltins-0C4z3yDS.d.cts → VMBuiltins-Baa90D2v.d.cts} +232 -1
  6. package/dist/{VMBuiltins-Bu6qaKi0.d.ts → VMBuiltins-BqkoJtHt.d.ts} +232 -1
  7. package/dist/chunk-54QMY2VL.cjs +2 -0
  8. package/dist/chunk-54QMY2VL.cjs.map +1 -0
  9. package/dist/{chunk-7PUNL5CJ.cjs → chunk-6FBXJYWO.cjs} +3 -3
  10. package/dist/{chunk-H4G3UXJV.js.map → chunk-6FBXJYWO.cjs.map} +1 -1
  11. package/dist/chunk-AEGR3GFA.js +3 -0
  12. package/dist/chunk-AEGR3GFA.js.map +1 -0
  13. package/dist/chunk-CR7IHPA2.cjs +2 -0
  14. package/dist/chunk-CR7IHPA2.cjs.map +1 -0
  15. package/dist/{chunk-NFASELLK.js → chunk-FBXQUQCY.js} +2 -2
  16. package/dist/{chunk-NFASELLK.js.map → chunk-FBXQUQCY.js.map} +1 -1
  17. package/dist/chunk-GITRBCSD.cjs +5 -0
  18. package/dist/chunk-GITRBCSD.cjs.map +1 -0
  19. package/dist/chunk-JVHRND2N.js +5 -0
  20. package/dist/chunk-JVHRND2N.js.map +1 -0
  21. package/dist/{chunk-H4G3UXJV.js → chunk-KSOB5FCI.js} +3 -3
  22. package/dist/chunk-KSOB5FCI.js.map +1 -0
  23. package/dist/chunk-OBQC7KDY.cjs +2 -0
  24. package/dist/chunk-OBQC7KDY.cjs.map +1 -0
  25. package/dist/{chunk-VLFP6IAY.cjs → chunk-OGBLSNQE.cjs} +2 -2
  26. package/dist/{chunk-VLFP6IAY.cjs.map → chunk-OGBLSNQE.cjs.map} +1 -1
  27. package/dist/chunk-QP4VIEXZ.js +2 -0
  28. package/dist/chunk-QP4VIEXZ.js.map +1 -0
  29. package/dist/chunk-RMBUP4XA.js +2 -0
  30. package/dist/chunk-RMBUP4XA.js.map +1 -0
  31. package/dist/chunk-UITBYTCD.cjs +3 -0
  32. package/dist/chunk-UITBYTCD.cjs.map +1 -0
  33. package/dist/chunk-X2QJE3SV.js +2 -0
  34. package/dist/chunk-X2QJE3SV.js.map +1 -0
  35. package/dist/chunk-Y5ZY6DPX.cjs +2 -0
  36. package/dist/chunk-Y5ZY6DPX.cjs.map +1 -0
  37. package/dist/chunk-ZISAN7NW.js +2 -0
  38. package/dist/chunk-ZISAN7NW.js.map +1 -0
  39. package/dist/constants.cjs +1 -1
  40. package/dist/constants.js +1 -1
  41. package/dist/engine.cjs +1 -1
  42. package/dist/engine.d.cts +128 -5
  43. package/dist/engine.d.ts +128 -5
  44. package/dist/engine.js +1 -1
  45. package/dist/engine.worker.cjs +1 -1
  46. package/dist/engine.worker.js +1 -1
  47. package/dist/index.cjs +1 -1
  48. package/dist/index.d.cts +4 -4
  49. package/dist/index.d.ts +4 -4
  50. package/dist/index.js +1 -1
  51. package/dist/language.d.cts +3 -3
  52. package/dist/language.d.ts +3 -3
  53. package/dist/packages.cjs +1 -1
  54. package/dist/packages.d.cts +2 -2
  55. package/dist/packages.d.ts +2 -2
  56. package/dist/packages.js +1 -1
  57. package/dist/testing.cjs +2 -2
  58. package/dist/testing.d.cts +3 -3
  59. package/dist/testing.d.ts +3 -3
  60. package/dist/testing.js +1 -1
  61. package/dist/vm.cjs +1 -1
  62. package/dist/vm.d.cts +1 -1
  63. package/dist/vm.d.ts +1 -1
  64. package/dist/vm.js +1 -1
  65. package/dist/worker.cjs +2 -2
  66. package/dist/worker.d.cts +2 -2
  67. package/dist/worker.d.ts +2 -2
  68. package/dist/worker.js +1 -1
  69. package/package.json +1 -1
  70. package/dist/chunk-2YHOWQ43.js +0 -2
  71. package/dist/chunk-2YHOWQ43.js.map +0 -1
  72. package/dist/chunk-3JSXJSMT.js +0 -2
  73. package/dist/chunk-3JSXJSMT.js.map +0 -1
  74. package/dist/chunk-432HHLSB.cjs +0 -5
  75. package/dist/chunk-432HHLSB.cjs.map +0 -1
  76. package/dist/chunk-5QA3BI4V.js +0 -3
  77. package/dist/chunk-5QA3BI4V.js.map +0 -1
  78. package/dist/chunk-6W3JFXPQ.cjs +0 -2
  79. package/dist/chunk-6W3JFXPQ.cjs.map +0 -1
  80. package/dist/chunk-7PUNL5CJ.cjs.map +0 -1
  81. package/dist/chunk-EPLOL7WC.cjs +0 -2
  82. package/dist/chunk-EPLOL7WC.cjs.map +0 -1
  83. package/dist/chunk-HNXV35Q2.cjs +0 -2
  84. package/dist/chunk-HNXV35Q2.cjs.map +0 -1
  85. package/dist/chunk-JM7BIFF4.js +0 -5
  86. package/dist/chunk-JM7BIFF4.js.map +0 -1
  87. package/dist/chunk-JZQRUOO6.js +0 -2
  88. package/dist/chunk-JZQRUOO6.js.map +0 -1
  89. package/dist/chunk-K2OUNZZG.cjs +0 -2
  90. package/dist/chunk-K2OUNZZG.cjs.map +0 -1
  91. package/dist/chunk-LJIR7MLG.cjs +0 -3
  92. package/dist/chunk-LJIR7MLG.cjs.map +0 -1
  93. package/dist/chunk-SIUHB77U.js +0 -2
  94. package/dist/chunk-SIUHB77U.js.map +0 -1
@@ -81,6 +81,21 @@ interface Bytecode {
81
81
  interface LineExecutionContext {
82
82
  /** 1-based current line number, or -1 when there is no real document (see class doc above). */
83
83
  lineIndex: number;
84
+ /**
85
+ * How many lines the document has now; absent when there is no document.
86
+ *
87
+ * A form that declares a span before reading it (see `noteLineRead`) needs
88
+ * to know where the document ends: a range written as `line 1 : line
89
+ * 3000000` has no line to read past the last one, and declaring three
90
+ * million positions that exist nowhere cost the heap for nothing. The
91
+ * walk that reads the span already stops at the first line it cannot use.
92
+ *
93
+ * Asked for rather than copied, because one context serves a document for
94
+ * as long as it is open: a count taken when the context was built was the
95
+ * count before the last insert, and a range declared under it stopped a
96
+ * line short.
97
+ */
98
+ getLineCount?: () => number;
84
99
  /**
85
100
  * Whether this engine may fetch live data (`network.enabled`). A plugin
86
101
  * function that reads a resolver's cache uses it to say "live data is
@@ -98,6 +113,19 @@ interface LineExecutionContext {
98
113
  calendar?: CalendarBackend;
99
114
  /** Look up another line's cached result by 1-based line number. `undefined` = not evaluated yet (or out of range), distinct from a line that evaluated to an actual `undefined`-like Value, which can't happen (every Value type has a concrete representation). */
100
115
  getLineResult?: (lineNumber: number) => Value | undefined;
116
+ /**
117
+ * Say that this line is about to read `lineNumber`, before reading it.
118
+ *
119
+ * A form that reads several lines stops at the first it cannot use, so the
120
+ * lines after that one are never read and, if reading were the only way
121
+ * the dependency graph learned of a read, never recorded. A cycle that
122
+ * closes through one of those lines was then invisible from scratch and
123
+ * visible from a history that had once read the whole span, and the two
124
+ * paths disagreed about whether the line was on a cycle at all. A form
125
+ * declares its whole span through this first, so what the graph knows does
126
+ * not depend on how far the form got. Absent where there is no document.
127
+ */
128
+ noteLineRead?: (lineNumber: number) => void;
101
129
  /**
102
130
  * The 1-based positions of the lines carrying `#tag`, ascending, or
103
131
  * `undefined` when this path keeps no index and the caller should walk the
@@ -519,6 +547,8 @@ interface VM {
519
547
  defineUserFunction(name: string, params: string[], program: BytecodeProgram): void;
520
548
  getUserFunction(name: string): UserFunctionDef | undefined;
521
549
  hasUserFunction(name: string): boolean;
550
+ /** Unbind a user function, for a definition edited away, deleted, or failed. */
551
+ deleteUserFunction(name: string): void;
522
552
  /**
523
553
  * Every session-scoped variable currently defined, as `[name, value]` pairs,
524
554
  * for snapshotting the VM's state (see `engine/EngineSnapshot.ts`). The
@@ -662,6 +692,46 @@ declare class DependencyGraph {
662
692
  */
663
693
  private lastPositionReader;
664
694
  private lastPositionReads;
695
+ /**
696
+ * Readers that recorded a position they had not been recorded reading,
697
+ * since the evaluator last took the list.
698
+ *
699
+ * A positional edge can close a cycle, and the moment it is recorded is the
700
+ * one moment that is knowable: the reader has just run its current text,
701
+ * so the edge is real, and every other edge in the graph describes the
702
+ * last run of the line that holds it. The evaluator takes the list at the
703
+ * end of each pass and looks for a cycle through each reader on it; see
704
+ * `ThreeTierEvaluator.settleCycles`. A line that only
705
+ * re-recorded edges it already had is not on it, which is every line of
706
+ * every pass once a document has settled.
707
+ */
708
+ private readersThatGainedAPosition;
709
+ /**
710
+ * How many recorded positional edges point downwards, from a reader to a
711
+ * line below it.
712
+ *
713
+ * A cycle needs one. Every edge in a document of `prev` and `above` points
714
+ * upwards, positions fall strictly along any path, and no path can come
715
+ * back to where it started. So the evaluator asks this before walking
716
+ * anything, and a document with no forward reference never pays for the
717
+ * walk at all, which is nearly every document and every pass after the one
718
+ * that closed a cycle.
719
+ */
720
+ private downwardPositionReads;
721
+ /**
722
+ * Lines that registered a different edge set since the evaluator last
723
+ * asked, and the keys whose producer set changed.
724
+ *
725
+ * The roots of the end-of-pass cycle walk. A cycle is closed, or a name that
726
+ * pinned one is withdrawn, by a change in the graph; nothing else creates
727
+ * one. A line that re-registers the edges it had is not on the list, which
728
+ * is every line of a settled pass, and it is also a line that is dirty
729
+ * because it threw, which stays dirty and re-runs every pass: rooting the
730
+ * walk on "ran" rather than "changed" made such a line reset its cycle on
731
+ * alternate passes for ever. Taken and cleared by {@link takeEdgeChanges}.
732
+ */
733
+ private edgesChangedThisPass;
734
+ private producersChangedThisPass;
665
735
  /**
666
736
  * Whether this line already carries exactly these edges.
667
737
  *
@@ -729,6 +799,90 @@ declare class DependencyGraph {
729
799
  * @param dependsOnLine - 1-based line whose result it read
730
800
  */
731
801
  registerLinePositionDependency(lineNumber: number, dependsOnLine: number): void;
802
+ /**
803
+ * Cut a line's recorded positions back to the ones its last run read.
804
+ *
805
+ * For the evaluator to call once a line has executed. A positional read is
806
+ * discovered while the line runs, and a position the line has stopped
807
+ * reading cannot be discovered that way, so without this the recorded set
808
+ * only ever grew: `prev + 1` edited to `7` went on reading line 1 in the
809
+ * graph for the rest of the session, and `total above` kept its edges to
810
+ * the lines above a heading that had cut its block short. Anything asking
811
+ * the graph what a line reads was told what it used to read, and a cycle
812
+ * that the heading had broken was still a cycle to the graph, while a cycle
813
+ * that its removal re-closed was not new to it and so was never noticed.
814
+ *
815
+ * A run that read no position at all leaves the line with none. A line
816
+ * that did not execute (compiled only, or skipped) must not be reconciled,
817
+ * since it read nothing for a reason that says nothing about its text.
818
+ *
819
+ * @param lineNumber - 1-based line that has just executed
820
+ */
821
+ reconcilePositionReads(lineNumber: number): void;
822
+ /**
823
+ * Forget every position this line was recorded reading.
824
+ *
825
+ * For a line whose text has just changed, before it runs: whatever the old
826
+ * text read is not evidence about the new one, and a rule consulting the
827
+ * graph between the edit and the run would otherwise be told the old
828
+ * edges. The next run records what the new text reads. Only the `line:`
829
+ * keys go; a data-source pin is discovered the same way but is not about
830
+ * the text, and stays until the line is removed.
831
+ *
832
+ * @param lineNumber - 1-based line whose positions are to go
833
+ */
834
+ forgetPositionReads(lineNumber: number): void;
835
+ /**
836
+ * The positions a line has been recorded reading, as line numbers.
837
+ *
838
+ * The forward direction of {@link getAffectedLinesByPosition}: that answers
839
+ * "who reads this position", this answers "which positions does this line
840
+ * read". Both directions are what finding a cycle takes.
841
+ *
842
+ * @param lineNumber - 1-based line doing the reading
843
+ * @returns The positions it has read, in no particular order; empty if none
844
+ */
845
+ positionsReadBy(lineNumber: number): number[];
846
+ /**
847
+ * The readers that recorded a new position since this was last called, and
848
+ * an empty list until one does.
849
+ *
850
+ * Taking the list clears it. See {@link readersThatGainedAPosition}.
851
+ *
852
+ * @returns The 1-based readers, in the order they recorded
853
+ */
854
+ /**
855
+ * What changed in the graph since this was last called: the lines whose
856
+ * edge set changed, and the keys whose producer set changed. Taking it
857
+ * clears it. See {@link edgesChangedThisPass}.
858
+ *
859
+ * @returns The changed lines and keys, each possibly empty.
860
+ */
861
+ takeEdgeChanges(): {
862
+ lines: readonly number[];
863
+ keys: readonly string[];
864
+ };
865
+ takeReadersThatGainedAPosition(): readonly number[];
866
+ /**
867
+ * Whether any recorded positional edge points from a reader to a line
868
+ * below it.
869
+ *
870
+ * The precondition for a positional cycle, and so for the walk that looks
871
+ * for one; see {@link downwardPositionReads}.
872
+ *
873
+ * @returns True while at least one such edge is recorded
874
+ */
875
+ hasDownwardPositionRead(): boolean;
876
+ /** The positions an entry records, in the recorded half; the same walk {@link positionsReadBy} makes. */
877
+ private positionsReadFrom;
878
+ /**
879
+ * Drop one positional edge from every index that holds it.
880
+ *
881
+ * The consumer index is what says whether the edge exists, so a position the
882
+ * entry lists twice (in the set, and later inside the span that grew over
883
+ * it) is dropped once and counted once.
884
+ */
885
+ private dropPositionRead;
732
886
  /**
733
887
  * Every line that read some position's result, whichever position it was.
734
888
  *
@@ -796,6 +950,20 @@ declare class DependencyGraph {
796
950
  * @param key - The key, from {@link edgeKey}
797
951
  * @returns Set of line numbers that write this key, or empty set if none
798
952
  */
953
+ /**
954
+ * The lines that read `key`, one edge away.
955
+ *
956
+ * The consumer index, which {@link registerLine} keeps clear of the line
957
+ * that writes the key: a definition's read of its own name is a convention
958
+ * for the graph's benefit, not a dependency, and `x += 1` reads its total
959
+ * to step it, not to depend on another line. That is what makes this index
960
+ * the right one for finding a cycle, where the raw reads would make every
961
+ * definition a self-loop and every twice-defined name a two-cycle.
962
+ *
963
+ * @param key - An edge key.
964
+ * @returns The 1-based readers, or an empty set.
965
+ */
966
+ directConsumersOf(key: string): ReadonlySet<number>;
799
967
  getProducers(key: string): ReadonlySet<number>;
800
968
  /**
801
969
  * The keys a line that WRITES something reads.
@@ -1010,9 +1178,13 @@ declare class VMCheckpointer {
1010
1178
  * @param lineNumber 1-based line position.
1011
1179
  * @param lineId Persistent line ID from DocumentModel.
1012
1180
  * @param variableNames Names of variables that were written at this line.
1181
+ * @param functionNames Which of those names the line defined as functions,
1182
+ * from the bytecode it ran. Without it the VM is asked, which cannot tell
1183
+ * a line that defined `f` from one that set the variable `f` under a
1184
+ * function of that name defined above.
1013
1185
  * @returns The new checkpoint, or null if no variable names provided.
1014
1186
  */
1015
- snapshot(lineNumber: number, lineId: number, variableNames: string[]): VMCheckpoint | null;
1187
+ snapshot(lineNumber: number, lineId: number, variableNames: string[], functionNames?: ReadonlySet<string>): VMCheckpoint | null;
1016
1188
  /**
1017
1189
  * Restore the VM to the state at or just after the given line number.
1018
1190
  *
@@ -1087,6 +1259,33 @@ declare class VMCheckpointer {
1087
1259
  *
1088
1260
  * @param names - The names no line defines any more.
1089
1261
  */
1262
+ /**
1263
+ * Drop the entry a line holds, because the line no longer writes anything.
1264
+ *
1265
+ * A line's entry is replaced when the line writes again and left alone
1266
+ * otherwise, so a definition edited into an expression with no definition in
1267
+ * it (`:v3 = 44` edited to `7 + 7`) kept saying `v3 = 44` in the chain. The
1268
+ * lines below it that asked what the prefix holds were told 44, where a pass
1269
+ * from scratch has nothing there. The entry after it is re-parented to the
1270
+ * one before, the same way {@link snapshot} keeps the links straight.
1271
+ *
1272
+ * @param lineNumber - 1-based line whose entry, if any, goes.
1273
+ */
1274
+ dropCheckpointAt(lineNumber: number): void;
1275
+ /**
1276
+ * Follow every line to its new position after a structural edit.
1277
+ *
1278
+ * An insert or a delete moves every line below it, and the chain is read
1279
+ * by position. It used to be cleared instead and rebuilt as lines ran, but
1280
+ * a clean line above the viewport never runs, so its entry was gone for
1281
+ * good and a line below asking what the prefix held was told nothing:
1282
+ * `:a = 5` above the viewport was reported as undefined by `:b = a + c`
1283
+ * under it. Each entry follows its line by id, the entry of a deleted
1284
+ * line goes, and the parents are linked again in the new order.
1285
+ *
1286
+ * @param positionOf - The 1-based position a line id has now, or -1 for a line that is gone.
1287
+ */
1288
+ renumber(positionOf: (lineId: number) => number): void;
1090
1289
  forget(names: readonly string[]): void;
1091
1290
  /**
1092
1291
  * Find the nearest checkpoint at or before the given line number.
@@ -1122,6 +1321,38 @@ declare class VMCheckpointer {
1122
1321
  *
1123
1322
  * @returns The Value, or undefined if the variable was never set.
1124
1323
  */
1324
+ /**
1325
+ * The value a name held at the end of the line before `lineNumber`, or
1326
+ * undefined if no line above it had set one.
1327
+ *
1328
+ * What a definition that failed leaves behind. A pass from scratch skips
1329
+ * the store when the right-hand side errors, so the name keeps whatever the
1330
+ * lines above it had put there: `:x = 1` then `:x = zz` leaves `x` at 1,
1331
+ * and `:x = zz` on its own leaves it undefined. The incremental path holds
1332
+ * the value from the previous pass instead, which for the line that failed
1333
+ * is its own old answer, so the evaluator asks here what the prefix holds
1334
+ * and puts that back. The chain records what each line wrote, in document
1335
+ * order, so the entry nearest before the line, followed through its
1336
+ * parents, is exactly the prefix.
1337
+ *
1338
+ * @param name - The variable.
1339
+ * @param lineNumber - The 1-based line whose own entry is to be excluded.
1340
+ * @returns The value the lines above set, or undefined.
1341
+ */
1342
+ /**
1343
+ * The function a name was bound to at the end of the line before
1344
+ * `lineNumber`, or undefined if no line above it had defined one.
1345
+ *
1346
+ * {@link lookupVariableBefore}, for the functions bag: a function
1347
+ * definition is a definition, and one edited away or failed leaves the name
1348
+ * as the lines above left it just as a variable does.
1349
+ *
1350
+ * @param name - The function name.
1351
+ * @param lineNumber - The 1-based line whose own entry is to be excluded.
1352
+ * @returns The definition the lines above made, or undefined.
1353
+ */
1354
+ lookupFunctionBefore(name: string, lineNumber: number): UserFunctionDef | undefined;
1355
+ lookupVariableBefore(name: string, lineNumber: number): Value | undefined;
1125
1356
  lookupVariable(name: string): Value | undefined;
1126
1357
  /**
1127
1358
  * Clear all checkpoints. The underlying VM is NOT reset, call
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkOBZJKZ2F_cjs=require('./chunk-OBZJKZ2F.cjs'),chunkSF5QVUEI_cjs=require('./chunk-SF5QVUEI.cjs'),chunkZ4MIX43O_cjs=require('./chunk-Z4MIX43O.cjs'),chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs'),chunkNH74IT7B_cjs=require('./chunk-NH74IT7B.cjs'),chunkPHWIO4P3_cjs=require('./chunk-PHWIO4P3.cjs'),chunkEZKR44MA_cjs=require('./chunk-EZKR44MA.cjs'),chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var Rt={variable:"",global:"global:",tag:"#",datasource:"ds:",line:"line:"};function At(e,t){return Rt[e]+t}function xr(e,t){if(e.runLo===-1)e.runLo=t,e.runHi=t;else {if(t>=e.runLo&&t<=e.runHi)return;t===e.runHi+1?(e.runHi=t,e.runSparse!==null&&e.runSparse.delete(t)):t===e.runLo-1?(e.runLo=t,e.runSparse!==null&&e.runSparse.delete(t)):e.runSparse===null?e.runSparse=new Set([t]):e.runSparse.add(t);}}function vr(e,t){return t>=e.runLo&&t<=e.runHi?true:e.runSparse!==null&&e.runSparse.has(t)}function Mr(e,t){if(e===null||e.size===0)return t===null||t.size===0;if(t===null||e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function gt(e){return At("line",String(e))}function Ii(e){for(let t in Rt){let n=Rt[t];if(n!==""&&e.startsWith(n))return true}return false}function Nn(e,t){return At("datasource",`${e}:${JSON.stringify(t)}`)}var Ie=new Set,Nt=new Set,Xe=[],Er=[],Rn=class{constructor(){this.consumers=new Map;this.producers=new Map;this.dependencies=new Map;this.writes=new Map;this.lineReads=new Map;this.pinnedReads=new Map;this.positionReads=new Map;this.lastPositionReader=-1;this.lastPositionReads=null;this.readersThatGainedAPosition=[];this.downwardPositionReads=0;this.edgesChangedThisPass=[];this.producersChangedThisPass=null;}hasSameEdges(t,n,r,o,i){if(t===void 0||t.size!==r.length+(i?.size??0))return false;if(o.length===0){if(n!==void 0)return false}else if(n===void 0||n.size!==o.length)return false;for(let a of r)if(!t.has(a))return false;if(n!==void 0){for(let a of o)if(!n.has(a))return false}return true}registerLine(t,n,r){let o=this.pinnedReads.size!==0?this.pinnedReads.get(t):void 0,i=this.lineReads.get(t),a=this.writes.get(t);if(this.hasSameEdges(i,a,n,r,o))return Xe;if(this.edgesChangedThisPass.push(t),i)for(let l of i){if(o?.has(l))continue;let m=this.consumers.get(l);m&&m.delete(t);}let s=null;if(a)for(let l of a){let m=this.producers.get(l);m!==void 0&&(m.delete(t),r.includes(l)||(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(l),m.size===0&&!r.includes(l)&&(this.producers.delete(l),(s??(s=[])).push(l)));}let u=new Set(n);if(o)for(let l of o)u.add(l);this.lineReads.set(t,u);for(let l of n){let m=this.consumers.get(l);m!==void 0?m.add(t):this.consumers.set(l,new Set([t]));}for(let l of r){(a===void 0||!a.has(l))&&(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(l);let m=this.producers.get(l);m!==void 0?m.add(t):this.producers.set(l,new Set([t]));}if(r.length>0){this.dependencies.set(t,o===void 0?u:new Set(n)),this.writes.set(t,new Set(r));for(let l of r){let m=this.consumers.get(l);m&&m.delete(t);}}else this.writes.delete(t),this.dependencies.delete(t);return s??Xe}registerLineDataSourceDependency(t,n,r){let o=Nn(n,r),i=this.pinnedReads.get(t);i!==void 0?i.add(o):this.pinnedReads.set(t,new Set([o]));let a=this.lineReads.get(t);a===void 0?this.lineReads.set(t,new Set([o])):(a===this.dependencies.get(t)&&this.dependencies.set(t,new Set(a)),a.add(o));let s=this.consumers.get(o);s!==void 0?s.add(t):this.consumers.set(o,new Set([t]));}getAffectedLines(t){let n=new Set,r=this.consumers.get(t);if(r===void 0)return n;let o=new Set([t]),i=[r];for(let a=0;a<i.length;a++)for(let s of i[a]){if(n.has(s))continue;n.add(s);let u=this.writes.get(s);if(u!==void 0)for(let l of u){if(o.has(l))continue;o.add(l);let m=this.consumers.get(l);m!==void 0&&i.push(m);}}return n}getAffectedLinesInOrder(t){let n=this.getAffectedLines(t);if(n.size===0)return [];let r=n.size,o=new Array(r),i=new Array(r),a=new Array(r);{let h=0;for(let A of n)o[h]=A,i[h]=this.writes.get(A),a[h]=this.lineReads.get(A),h++;}let s=new Set;for(let h=0;h<r;h++){let A=i[h];if(A!==void 0)for(let j of A)s.add(j);}let u=new Map,l=[],m=[];for(let h=0;h<r;h++){let A=a[h];if(A===void 0)continue;let j=i[h];for(let Y of A){if(!s.has(Y)||j!==void 0&&j.has(Y))continue;let ee=u.get(Y);ee===void 0&&(ee=r+u.size,u.set(Y,ee)),l.push(ee),m.push(h);}}let y=r+u.size;if(u.size===0)return o;let g=[],E=[];for(let h=0;h<r;h++){let A=i[h];if(A!==void 0)for(let j of A){let Y=u.get(j);Y!==void 0&&(g.push(h),E.push(Y));}}let q=g.length,ut=l.length,Le=new Int32Array(y),Fe=new Int32Array(y);for(let h=0;h<q;h++)Le[g[h]]++,Fe[E[h]]++;for(let h=0;h<ut;h++)Le[l[h]]++,Fe[m[h]]++;let ue=new Int32Array(y+1);for(let h=0;h<y;h++)ue[h+1]=ue[h]+Le[h];let lt=new Int32Array(ue[y]),ct=Le;ct.set(ue.subarray(0,y));for(let h=0;h<q;h++)lt[ct[g[h]]++]=E[h];for(let h=0;h<ut;h++)lt[ct[l[h]]++]=m[h];let Ue=new Int32Array(y),ge=new Uint8Array(y),Ne=0;for(let h=0;h<y;h++)Fe[h]===0&&(Ue[Ne++]=h,ge[h]=1);if(Ne===0){let h=0;for(let A=1;A<r;A++)o[A]<o[h]&&(h=A);Ue[Ne++]=h,ge[h]=1;}let $e=[];for(let h=0;h<Ne;h++){let A=Ue[h];A<r&&$e.push(o[A]);let j=ue[A+1];for(let Y=ue[A];Y<j;Y++){let ee=lt[Y];--Fe[ee]===0&&ge[ee]===0&&(Ue[Ne++]=ee,ge[ee]=1);}}if($e.length<r){let h=[];for(let A=0;A<r;A++)ge[A]===0&&h.push(o[A]);h.sort((A,j)=>A-j);for(let A=0;A<h.length;A++)$e.push(h[A]);}return $e}registerLinePositionDependency(t,n){if(t===n)return;let r;if(this.lastPositionReader===t?r=this.lastPositionReads??void 0:(r=this.positionReads.get(t),this.lastPositionReader=t,this.lastPositionReads=r??null),r===void 0)r={lo:n,hi:n,sparse:null,runLo:n,runHi:n,runSparse:null},this.positionReads.set(t,r),this.lastPositionReads=r;else {if(xr(r,n),n>=r.lo&&n<=r.hi)return;if(n===r.hi+1)r.hi=n,r.sparse!==null&&r.sparse.delete(n);else if(n===r.lo-1)r.lo=n,r.sparse!==null&&r.sparse.delete(n);else if(r.sparse===null)r.sparse=new Set([n]);else {if(r.sparse.has(n))return;r.sparse.add(n);}}let o=gt(n),i=this.pinnedReads.get(t);i!==void 0?i.add(o):this.pinnedReads.set(t,new Set([o]));let a=this.lineReads.get(t);a===void 0?this.lineReads.set(t,new Set([o])):(a===this.dependencies.get(t)&&this.dependencies.set(t,new Set(a)),a.add(o));let s=this.consumers.get(o);if(s!==void 0){if(s.has(t))return;s.add(t);}else this.consumers.set(o,new Set([t]));n>t&&this.downwardPositionReads++;let u=this.readersThatGainedAPosition;(u.length===0||u[u.length-1]!==t)&&u.push(t);}reconcilePositionReads(t){let n=this.positionReads.get(t);if(n===void 0)return;if(n.runLo===-1){this.forgetPositionReads(t);return}if(!(n.lo===n.runLo&&n.hi===n.runHi&&Mr(n.sparse,n.runSparse))){for(let o of this.positionsReadFrom(n))vr(n,o)||this.dropPositionRead(t,o);n.lo=n.runLo,n.hi=n.runHi,n.sparse=n.runSparse;}n.runLo=-1,n.runHi=-1,n.runSparse=null;}forgetPositionReads(t){let n=this.positionReads.get(t);if(n!==void 0){this.positionReads.delete(t),this.lastPositionReader===t&&(this.lastPositionReader=-1,this.lastPositionReads=null);for(let r of this.positionsReadFrom(n))this.dropPositionRead(t,r);}}positionsReadBy(t){let n=this.positionReads.get(t);return n===void 0?[]:this.positionsReadFrom(n)}takeEdgeChanges(){let t=this.edgesChangedThisPass,n=this.producersChangedThisPass===null?Xe:[...this.producersChangedThisPass];return t.length!==0&&(this.edgesChangedThisPass=[]),this.producersChangedThisPass=null,{lines:t,keys:n}}takeReadersThatGainedAPosition(){if(this.readersThatGainedAPosition.length===0)return Er;let t=this.readersThatGainedAPosition;return this.readersThatGainedAPosition=[],t}hasDownwardPositionRead(){return this.downwardPositionReads>0}positionsReadFrom(t){let n=[];if(t.lo!==-1)for(let r=t.lo;r<=t.hi;r++)n.push(r);if(t.sparse!==null)for(let r of t.sparse)n.push(r);return n}dropPositionRead(t,n){let r=gt(n),o=this.consumers.get(r);if(o===void 0||!o.delete(t))return;o.size===0&&this.consumers.delete(r);let i=this.pinnedReads.get(t);i!==void 0&&(i.delete(r),i.size===0&&this.pinnedReads.delete(t)),this.lineReads.get(t)?.delete(r),n>t&&this.downwardPositionReads--;let a=this.edgesChangedThisPass;(a.length===0||a[a.length-1]!==t)&&a.push(t);}linesReadingAPosition(){return this.positionReads.keys()}getAffectedLinesByPosition(t){return this.consumers.get(gt(t))??Ie}getAffectedLinesByDataSource(t,n){return this.consumers.get(Nn(t,n))??Ie}removeLine(t){this.forgetPositionReads(t);for(let i of this.writes.get(t)??[])(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(i);let n=this.lineReads.get(t);if(n){for(let i of n){let a=this.consumers.get(i);a&&a.delete(t);}this.lineReads.delete(t);}let r=null,o=this.writes.get(t);if(o)for(let i of o){let a=this.producers.get(i);a!==void 0&&(a.delete(t),a.size===0&&(this.producers.delete(i),(r??(r=[])).push(i)));}return o!==void 0&&(this.dependencies.delete(t),this.writes.delete(t)),this.pinnedReads.size!==0&&this.pinnedReads.delete(t),r??Xe}getConsumers(t){return this.consumers.get(t)??Ie}directConsumersOf(t){return this.consumers.get(t)??Ie}getProducers(t){return this.producers.get(t)??Ie}getDependencies(t){return this.dependencies.get(t)??Nt}getReads(t){return this.lineReads.get(t)??Nt}getWrites(t){return this.writes.get(t)??Nt}getSnapshot(){let t={};for(let[u,l]of this.consumers)t[u]=Array.from(l);let n={};for(let[u,l]of this.writes)n[u]=Array.from(l);let r={};for(let[u,l]of this.lineReads)r[u]=Array.from(l);let o={};for(let[u,l]of this.producers)o[u]=Array.from(l);let i=At("datasource",""),a={};for(let[u,l]of this.lineReads){let m=Array.from(l).filter(y=>y.startsWith(i));m.length>0&&(a[u]=m.map(y=>y.slice(i.length)));}let s={};for(let[u,l]of this.consumers)u.startsWith(i)&&(s[u.slice(i.length)]=Array.from(l));return {consumers:t,producers:o,writes:n,reads:r,dataSourceDeps:a,dataSourceConsumers:s}}clear(){this.consumers.clear(),this.producers.clear(),this.dependencies.clear(),this.writes.clear(),this.lineReads.clear(),this.pinnedReads.clear(),this.positionReads.clear(),this.lastPositionReader=-1,this.lastPositionReads=null,this.readersThatGainedAPosition=[],this.downwardPositionReads=0,this.edgesChangedThisPass=[],this.producersChangedThisPass=null;}};function An(e,t){let n=t===2?chunkZ4MIX43O_cjs.L:chunkZ4MIX43O_cjs.M,r=n(e.n),o=n(e.d);return r===null||o===null?null:{n:r,d:o}}function Sn(e,t){let n=chunkZ4MIX43O_cjs.y(e),r=new Map;for(let[o,i]of n){if(i%t!==0)return null;r.set(o,i/t);}return chunkZ4MIX43O_cjs.x(r)}function Ir(e,t){let n=chunkZ4MIX43O_cjs.y(e);for(let[r,o]of chunkZ4MIX43O_cjs.y(t))n.set(r,(n.get(r)??0)+o);return chunkZ4MIX43O_cjs.x(n)}function xn(e,t){let n=chunkZ4MIX43O_cjs.y(e);for(let[r,o]of chunkZ4MIX43O_cjs.y(t)){let i=(n.get(r)??0)-o;i<=0?n.delete(r):n.set(r,i);}return chunkZ4MIX43O_cjs.x(n)}function kr(e,t){let n=chunkZ4MIX43O_cjs.y(e),r=new Map;for(let[o,i]of chunkZ4MIX43O_cjs.y(t)){let a=n.get(o);a!==void 0&&r.set(o,Math.min(a,i));}return chunkZ4MIX43O_cjs.x(r)}function wr(e){let t=new Set;for(let n of e)for(let r of chunkZ4MIX43O_cjs.y(n).keys())t.add(r);return [...t].sort()}function oe(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return chunkZ4MIX43O_cjs.E({terms:t,vars:wr(e.map(n=>n.key))})}function St(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Tr(e){return [...e.terms].map(([n,r])=>({key:n,coefficient:r})).sort((n,r)=>chunkZ4MIX43O_cjs.D(n.key,r.key,e.vars))}function En(e){if(e.vars.length<2)return null;let t=Tr(e);return t.length===2?_r(t[0],t[1]):t.length===3?Cr(t):t.length===4?Pr(t):null}function _r(e,t){let n=e.coefficient.n>0n,r=t.coefficient.n>0n;if(!n)return null;let o=xt(e,t,2);if(o!==null&&!r)return St([oe([o.a,Ze(o.b)]),oe([o.a,o.b])]);let i=xt(e,t,3);if(i===null)return null;let a=oe(r?[i.a,i.b]:[i.a,Ze(i.b)]),s=r?Ze(ze(i.a,i.b)):ze(i.a,i.b);return St([a,oe([vn(i.a),s,vn(i.b)])])}function xt(e,t,n){let r=t.coefficient.n<0n?chunkZ4MIX43O_cjs.j(t.coefficient):t.coefficient,o=An(e.coefficient,n),i=An(r,n);if(o===null||i===null)return null;let a=Sn(e.key,n),s=Sn(t.key,n);return a===null||s===null?null:{a:{key:a,coefficient:o},b:{key:s,coefficient:i}}}function Ze(e){return {key:e.key,coefficient:chunkZ4MIX43O_cjs.j(e.coefficient)}}function ze(e,t){return {key:Ir(e.key,t.key),coefficient:chunkZ4MIX43O_cjs.h(e.coefficient,t.coefficient)}}function vn(e){return ze(e,e)}function Cr(e){let[t,n,r]=e;if(t.coefficient.n<0n||r.coefficient.n<0n)return null;let o=xt(t,r,2);if(o===null)return null;let i=ze(o.a,o.b);if(i.key!==n.key)return null;let a=chunkZ4MIX43O_cjs.h(i.coefficient,{n:2n,d:1n}),s=n.coefficient.n<0n,u=s?chunkZ4MIX43O_cjs.j(n.coefficient):n.coefficient;return chunkZ4MIX43O_cjs.m(chunkZ4MIX43O_cjs.i(u,a))?{kind:"pow",base:oe([o.a,s?Ze(o.b):o.b]),exponent:chunkZ4MIX43O_cjs.p(2)}:null}function Pr(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let r=Mn(e[n[0][0]],e[n[0][1]]),o=Mn(e[n[1][0]],e[n[1][1]]);if(!(r===null||o===null)&&Vr(r.cofactor,o.cofactor))return St([oe([r.common,o.common]),oe(r.cofactor)])}return null}function Mn(e,t){let n=kr(e.key,t.key),r={key:n,coefficient:e.coefficient},o=[{key:xn(e.key,n),coefficient:{n:1n,d:1n}},{key:xn(t.key,n),coefficient:chunkZ4MIX43O_cjs.i(t.coefficient,e.coefficient)}];return o[0].key===o[1].key?null:{common:r,cofactor:o}}function Vr(e,t){return e.length!==t.length?false:e.every((n,r)=>n.key===t[r].key&&n.coefficient.n===t[r].coefficient.n&&n.coefficient.d===t[r].coefficient.d)}var Or=12,We=4096,Dr=100000n;function Qe(e,t){let n=e<0n?-e:e,r=t<0n?-t:t;for(;r!==0n;){let o=n%r;n=r,r=o;}return n}function kn(e,t){return e===0n||t===0n?0n:e/Qe(e,t)*t}function In(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let r=1n;r*r<=t;r++){if(r>Dr)return null;if(t%r!==0n)continue;n.push(r);let o=t/r;if(o!==r&&n.push(o),n.length>We)return null}return n}function wn(e,t){let n=chunkZ4MIX43O_cjs.a;for(let r of e)n=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.h(n,t),r);return n}function Lr(e,t){let n=[e[0]];for(let r=1;r<e.length-1;r++)n.push(chunkZ4MIX43O_cjs.f(e[r],chunkZ4MIX43O_cjs.h(n[r-1],t)));return n}function he(e){if(e.length<2)return [];if(e.length===2){let[l,m]=e;return chunkZ4MIX43O_cjs.l(l)?[]:[chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.a,m),l)]}let t=1n;for(let l of e)t=kn(t,l.d);let n=e.map(l=>l.n*t/l.d),r=n[0],o=n[n.length-1];if(o===0n)return [];let i=In(o),a=In(r);if(i===null||a===null)throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:We});if(i.length*a.length>We)throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:We});let s=[],u=new Set;for(let l of i)for(let m of a)for(let y of [1n,-1n]){let g={n:y*l/Qe(l,m),d:m/Qe(l,m)},E=`${g.n}/${g.d}`;u.has(E)||(u.add(E),chunkZ4MIX43O_cjs.l(wn(e,g))&&s.push(g));}return s}function Fr(e,t){return chunkZ4MIX43O_cjs.l(t)?chunkZ4MIX43O_cjs.q(e):t.n>0n?{kind:"sub",left:chunkZ4MIX43O_cjs.q(e),right:chunkZ4MIX43O_cjs.p(t)}:{kind:"add",left:chunkZ4MIX43O_cjs.q(e),right:chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.j(t))}}function Ur(e,t){let n=e.length-1,r=new Map;return e.forEach((o,i)=>{if(chunkZ4MIX43O_cjs.l(o))return;let a=n-i;r.set(a===0?"":a===1?t:`${t}^${a}`,o);}),chunkZ4MIX43O_cjs.E({terms:r,vars:r.size>0?[t]:[]})}function Mt(e,t){let n=[],r=[...e],o=he(r);for(;o.length>0&&r.length>2;){for(let a of o){let s=0;for(;r.length>1&&chunkZ4MIX43O_cjs.l(wn(r,a));)r=Lr(r,a),s++;s>0&&n.push({base:Fr(t,a),power:s});}o=r.length>2?he(r):[];}return r.length-1>=1?(n.push({base:Ur(r,t),power:1}),{content:chunkZ4MIX43O_cjs.b,factors:n}):{content:r.length===1?r[0]:chunkZ4MIX43O_cjs.b,factors:n}}function $r(e){let t=[];chunkZ4MIX43O_cjs.m(e.content)||t.push(chunkZ4MIX43O_cjs.p(e.content));for(let r of e.factors)t.push(r.power===1?r.base:chunkZ4MIX43O_cjs.r(r.base,chunkZ4MIX43O_cjs.p({n:BigInt(r.power),d:1n})));if(t.length===0)return chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.b);let n=t[0];for(let r=1;r<t.length;r++)n={kind:"mul",left:n,right:t[r]};return n}function Br(e){let t=0n,n=1n;for(let r of e.terms.values())t=Qe(t,r.n),n=kn(n,r.d);return t===0n?chunkZ4MIX43O_cjs.b:{n:t,d:n}}function qr(e){let t=new Map;for(let o of e.vars){let i=1/0;for(let a of e.terms.keys()){let s=Yr(a,o);s<i&&(i=s);}i>0&&i!==1/0&&t.set(o,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[o,i]of e.terms){let a=vt(o);for(let[s,u]of t)a.set(s,(a.get(s)??0)-u);n.set(Kr(a),i);}let r=new Set;for(let o of n.keys())for(let i of vt(o).keys())r.add(i);return {monomial:t,reduced:{terms:n,vars:[...r].sort()}}}function Yr(e,t){return vt(e).get(t)??0}function vt(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let r=n.indexOf("^");r===-1?t.set(n,1):t.set(n.slice(0,r),Number(n.slice(r+1)));}return t}function Kr(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function Gr(e){let t=[...e.keys()].sort(),n=null;for(let r of t){let o=e.get(r),i=o===1?chunkZ4MIX43O_cjs.q(r):chunkZ4MIX43O_cjs.r(chunkZ4MIX43O_cjs.q(r),chunkZ4MIX43O_cjs.p({n:BigInt(o),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function Tn(e){let t=chunkZ4MIX43O_cjs.C(e);if(t===null||t.terms.size===0||chunkZ4MIX43O_cjs.z(t)>Or||t.vars.length===0)return e;let n=Br(t),r=chunkZ4MIX43O_cjs.m(n)?t:jr(t,chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.b,n)),{monomial:o,reduced:i}=qr(r),a=Gr(o),s=chunkZ4MIX43O_cjs.A(i);if(s===null){let q=En(i);return q!==null?Hr(n,a,q):Xr(n,a,i)??e}let u=[...chunkZ4MIX43O_cjs.B(i,s)].reverse(),l=Mt(u,s),m=chunkZ4MIX43O_cjs.h(n,l.content);if(l.factors.length<=1&&(l.factors[0]?.power??1)===1&&a===null&&chunkZ4MIX43O_cjs.m(m))return e;let g=[];chunkZ4MIX43O_cjs.m(m)||g.push(chunkZ4MIX43O_cjs.p(m)),a!==null&&g.push(a),g.push($r({content:chunkZ4MIX43O_cjs.b,factors:l.factors}));let E=g[0];for(let q=1;q<g.length;q++)E={kind:"mul",left:E,right:g[q]};return E}function jr(e,t){let n=new Map;for(let[r,o]of e.terms)n.set(r,chunkZ4MIX43O_cjs.h(o,t));return {terms:n,vars:e.vars}}function Hr(e,t,n){let r=[];chunkZ4MIX43O_cjs.m(e)||r.push(chunkZ4MIX43O_cjs.p(e)),t!==null&&r.push(t),r.push(n);let o=r[0];for(let i=1;i<r.length;i++)o={kind:"mul",left:o,right:r[i]};return o}function Xr(e,t,n){if(t===null&&chunkZ4MIX43O_cjs.m(e))return null;let r=[];chunkZ4MIX43O_cjs.m(e)||r.push(chunkZ4MIX43O_cjs.p(e)),t!==null&&r.push(t),r.push(chunkZ4MIX43O_cjs.E(n));let o=r[0];for(let i=1;i<r.length;i++)o={kind:"mul",left:o,right:r[i]};return o}var C={n:2n,d:1n},G={n:3n,d:1n},ke={n:4n,d:1n};function Zr(e,t,n,r){let o=chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.i(t,chunkZ4MIX43O_cjs.h(G,e))),i=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.h(G,chunkZ4MIX43O_cjs.h(e,n)),chunkZ4MIX43O_cjs.h(t,t)),chunkZ4MIX43O_cjs.h(G,chunkZ4MIX43O_cjs.h(e,e))),a=chunkZ4MIX43O_cjs.h(C,chunkZ4MIX43O_cjs.h(t,chunkZ4MIX43O_cjs.h(t,t))),s=chunkZ4MIX43O_cjs.h({n:9n,d:1n},chunkZ4MIX43O_cjs.h(e,chunkZ4MIX43O_cjs.h(t,n))),u=chunkZ4MIX43O_cjs.h({n:27n,d:1n},chunkZ4MIX43O_cjs.h(chunkZ4MIX43O_cjs.h(e,e),r)),l=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.g(a,s),u),chunkZ4MIX43O_cjs.h({n:27n,d:1n},chunkZ4MIX43O_cjs.h(e,chunkZ4MIX43O_cjs.h(e,e))));return {p:i,q:l,shift:o}}function Cn(e,t,n,r){let{p:o,q:i,shift:a}=Zr(e,t,n,r),s=chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.h(ke,chunkZ4MIX43O_cjs.h(o,chunkZ4MIX43O_cjs.h(o,o))),chunkZ4MIX43O_cjs.h({n:27n,d:1n},chunkZ4MIX43O_cjs.h(i,i))));return chunkZ4MIX43O_cjs.k(s,chunkZ4MIX43O_cjs.a)>0?{exact:[],approximate:Qr(o,i,a)}:chunkZ4MIX43O_cjs.l(s)?{exact:zr(o,i,a),approximate:[]}:{exact:Wr(o,i,a),approximate:[]}}function zr(e,t,n){if(chunkZ4MIX43O_cjs.l(e))return [chunkZ4MIX43O_cjs.p(n)];let r=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(G,t),e),n),o=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(G,t),chunkZ4MIX43O_cjs.h(C,e))),n);return [r,o].sort(chunkZ4MIX43O_cjs.k).map(chunkZ4MIX43O_cjs.p)}function Wr(e,t,n){let r=chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.i(t,C)),o=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.h(chunkZ4MIX43O_cjs.i(t,C),chunkZ4MIX43O_cjs.i(t,C)),chunkZ4MIX43O_cjs.h(chunkZ4MIX43O_cjs.i(e,G),chunkZ4MIX43O_cjs.h(chunkZ4MIX43O_cjs.i(e,G),chunkZ4MIX43O_cjs.i(e,G)))),i=chunkZ4MIX43O_cjs.O(o),a={kind:"call",name:"cbrt",args:[{kind:"add",left:chunkZ4MIX43O_cjs.p(r),right:i}]},s={kind:"call",name:"cbrt",args:[{kind:"sub",left:chunkZ4MIX43O_cjs.p(r),right:i}]},u={kind:"add",left:a,right:s},l={kind:"sub",left:a,right:s},m={kind:"add",left:chunkZ4MIX43O_cjs.p(n),right:{kind:"div",left:{kind:"neg",operand:u},right:chunkZ4MIX43O_cjs.p(C)}},y={kind:"mul",left:{kind:"div",left:{kind:"mul",left:l,right:chunkZ4MIX43O_cjs.O(G)},right:chunkZ4MIX43O_cjs.p(C)},right:chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.n)};return [{kind:"add",left:chunkZ4MIX43O_cjs.p(n),right:u},{kind:"sub",left:m,right:y},{kind:"add",left:m,right:y}]}function Qr(e,t,n){let r=chunkZ4MIX43O_cjs.e(e),o=chunkZ4MIX43O_cjs.e(t),i=chunkZ4MIX43O_cjs.e(n),a=2*Math.sqrt(-r/3),s=3*o/(2*r)*Math.sqrt(-3/r),u=Math.acos(Math.min(1,Math.max(-1,s)))/3;return [0,1,2].map(l=>a*Math.cos(u-2*Math.PI*l/3)+i).sort((l,m)=>l-m)}function Jr(e,t,n,r){let o=chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.i(e,ke)),i=chunkZ4MIX43O_cjs.h(e,e),a=chunkZ4MIX43O_cjs.g(t,chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(G,i),{n:8n,d:1n})),s=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.g(n,chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(e,t),C)),chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(i,e),{n:8n,d:1n})),u=chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.g(r,chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(e,n),ke)),chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(i,t),{n:16n,d:1n})),chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.h(G,chunkZ4MIX43O_cjs.h(i,i)),{n:256n,d:1n}));return {p:a,q:s,r:u,shift:o}}function Pn(e,t,n,r,o,i){let a=E=>chunkZ4MIX43O_cjs.i(E,e),{p:s,q:u,r:l,shift:m}=Jr(a(t),a(n),a(r),a(o)),y=chunkZ4MIX43O_cjs.l(u)?to(s,l):io(s,u,l,i);if(y===null)return null;let g=chunkZ4MIX43O_cjs.l(m)?y:y.map(E=>({kind:"add",left:chunkZ4MIX43O_cjs.p(m),right:E}));return {exact:eo(g),approximate:[]}}function eo(e){let t=new Set,n=[];for(let r of e){let o=chunkZ4MIX43O_cjs.t(chunkZ4MIX43O_cjs.Q(r));t.has(o)||(t.add(o),n.push(r));}return n}function to(e,t){let n=chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.h(e,e),chunkZ4MIX43O_cjs.h(ke,t));if(chunkZ4MIX43O_cjs.k(n,chunkZ4MIX43O_cjs.a)<0)return oo(e,t);let r=chunkZ4MIX43O_cjs.N(n);return r!==null?no(chunkZ4MIX43O_cjs.j(e),r,chunkZ4MIX43O_cjs.l(n)):ro(e,t,n)}function no(e,t,n){let r=n?[chunkZ4MIX43O_cjs.i(e,C)]:[chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.f(e,t),C),chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(e,t),C)],o=[];for(let i of r){if(chunkZ4MIX43O_cjs.l(i)){o.push(chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.a));continue}let a=chunkZ4MIX43O_cjs.P(i);o.push({kind:"neg",operand:a},a);}return o}function ro(e,t,n){let r=chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.j(e)),o=chunkZ4MIX43O_cjs.O(n),i=chunkZ4MIX43O_cjs.k(e,chunkZ4MIX43O_cjs.a)<=0,a=[{node:Et({kind:"add",left:r,right:o}),positive:i||chunkZ4MIX43O_cjs.k(t,chunkZ4MIX43O_cjs.a)<=0},{node:Et({kind:"sub",left:r,right:o}),positive:i&&chunkZ4MIX43O_cjs.k(t,chunkZ4MIX43O_cjs.a)>=0}],s=[];for(let{node:u,positive:l}of a){let y={kind:"call",name:"sqrt",args:[l?u:{kind:"neg",operand:u}]},g=l?y:{kind:"mul",left:y,right:chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.n)};s.push({kind:"neg",operand:g},g);}return s}function Et(e){return {kind:"div",left:e,right:chunkZ4MIX43O_cjs.p(C)}}function oo(e,t){let n=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.j(e),C),r=chunkZ4MIX43O_cjs.N(t),o=r===null?_n(chunkZ4MIX43O_cjs.O(t),n):chunkZ4MIX43O_cjs.O(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.f(r,n),C)),a={kind:"mul",left:r===null?_n(chunkZ4MIX43O_cjs.O(t),chunkZ4MIX43O_cjs.j(n)):chunkZ4MIX43O_cjs.O(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(r,n),C)),right:chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.n)},s={kind:"add",left:o,right:a},u={kind:"sub",left:o,right:a};return [{kind:"neg",operand:s},{kind:"neg",operand:u},u,s]}function _n(e,t){let n=t.n>=0n?{kind:"add",left:e,right:chunkZ4MIX43O_cjs.p(t)}:{kind:"sub",left:e,right:chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.j(t))};return {kind:"call",name:"sqrt",args:[Et(n)]}}function io(e,t,n,r){let o=[{n:1n,d:1n},chunkZ4MIX43O_cjs.h(C,e),chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.h(e,e),chunkZ4MIX43O_cjs.h(ke,n)),chunkZ4MIX43O_cjs.j(chunkZ4MIX43O_cjs.h(t,t))];for(let i of he(o)){if(chunkZ4MIX43O_cjs.k(i,chunkZ4MIX43O_cjs.a)<=0)continue;let a=chunkZ4MIX43O_cjs.N(i);if(a===null)continue;let s=chunkZ4MIX43O_cjs.f(e,i),u=chunkZ4MIX43O_cjs.i(t,a),l=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(s,u),C),m=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.f(s,u),C),y={n:1n,d:1n};return [...r(y,a,l),...r(y,chunkZ4MIX43O_cjs.j(a),m)]}return null}var ao=200,so=1e-14,uo=1e-10,lo=1e-10,Vn=1e-9,co=1e-8,mo=4;function we(e,t){return {re:e.re-t.re,im:e.im-t.im}}function fo(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function Dn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let o=t.im/t.re,i=t.re+t.im*o;return {re:(e.re+e.im*o)/i,im:(e.im-e.re*o)/i}}let n=t.re/t.im,r=t.re*n+t.im;return {re:(e.re*n+e.im)/r,im:(e.im*n-e.re)/r}}function W(e){return Math.hypot(e.re,e.im)}function Je(e,t){let n=0,r=0;for(let o of e){let i=n*t.re-r*t.im+o;r=n*t.im+r*t.re,n=i;}return {re:n,im:r}}function po(e,t){let n=W(t),r=0;for(let o of e)r=r*n+Math.abs(o);return r}function ho(e){let t=e.length-1,n=[];for(let r=0;r<t;r++)n.push(e[r]*(t-r));return n}function bo(e){let t=[...e].reverse(),r=[...chunkZ4MIX43O_cjs.K(t)].reverse().map(chunkZ4MIX43O_cjs.e);return r.some(o=>!Number.isFinite(o))?null:r}function yo(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let r=1+n,o=-e[1]/t,i=[];for(let a=0;a<t;a++){let s=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:o+r*Math.cos(s),im:r*Math.sin(s)});}return i}function go(e){let t=e.length-1,n=yo(e);for(let r=0;r<ao;r++){let o=0,i=1;for(let a=0;a<t;a++){let s={re:1,im:0};for(let l=0;l<t;l++)a!==l&&(s=fo(s,we(n[a],n[l])));if(s.re===0&&s.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let u=Dn(Je(e,n[a]),s);if(!Number.isFinite(u.re)||!Number.isFinite(u.im))return null;n[a]=we(n[a],u),o=Math.max(o,W(u)),i=Math.max(i,W(n[a]));}if(o<=so*i)return n}return null}function On(e,t,n){let r=n;for(let o=0;o<mo;o++){let i=Je(t,r);if(i.re===0&&i.im===0)break;let a=we(r,Dn(Je(e,r),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;r=a;}return r}function No(e,t,n){let r=Math.max(1,W(n));if(n.im!==0&&Math.abs(n.im)<=Vn*r){let o=On(e,t,{re:n.re,im:0});if(It(e,o))return {re:o.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=Vn*r){let o=On(e,t,{re:0,im:n.im});if(It(e,o))return {re:0,im:o.im}}return n}function It(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:W(Je(e,t))<=uo*po(e,t)}function Ro(e){let t=[...e],n=t.map(r=>r.im===0);for(let r=0;r<t.length;r++){if(n[r])continue;let o={re:t[r].re,im:-t[r].im},i=-1,a=Number.POSITIVE_INFINITY;for(let m=r+1;m<t.length;m++){if(n[m])continue;let y=W(we(t[m],o));y<a&&(a=y,i=m);}if(i===-1||a>co*Math.max(1,W(t[r])))continue;let s=(t[r].re+t[i].re)/2,u=(Math.abs(t[r].im)+Math.abs(t[i].im))/2,l=t[r].im<0?-1:1;t[r]={re:s,im:l*u},t[i]={re:s,im:-l*u},n[r]=true,n[i]=true;}return t}function Ao(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let r=Math.max(1,W(e[t]),W(e[n]));if(W(we(e[t],e[n]))<=lo*r)return false}return true}function Ln(e){let t=bo(e);if(t===null)return null;if(t.length<2)return [];let n=go(t);if(n===null)return null;let r=ho(t),o=Ro(n).map(i=>No(t,r,i));for(let i of o)if(!It(t,i))return null;return Ao(o)?[...o].sort((i,a)=>i.re-a.re||i.im-a.im):null}var Fn=8;function So(e,t){let n=chunkZ4MIX43O_cjs.a;for(let r of e)n=chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.h(n,t),r);return n}function xo(e,t){let n=[e[0]];for(let r=1;r<e.length-1;r++)n.push(chunkZ4MIX43O_cjs.f(e[r],chunkZ4MIX43O_cjs.h(n[r-1],t)));return n}function Un(e,t,n){let r=chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.h(t,t),chunkZ4MIX43O_cjs.h(Eo(),chunkZ4MIX43O_cjs.h(e,n))),o=chunkZ4MIX43O_cjs.h(Mo(),e);if(chunkZ4MIX43O_cjs.k(r,chunkZ4MIX43O_cjs.a)<0)return vo(chunkZ4MIX43O_cjs.j(t),r,o);if(chunkZ4MIX43O_cjs.l(r))return [chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.j(t),o))];let i=chunkZ4MIX43O_cjs.L(r.n),a=chunkZ4MIX43O_cjs.L(r.d);if(i!==null&&a!==null){let y={n:i,d:a},g=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.f(chunkZ4MIX43O_cjs.j(t),y),o),E=chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.g(chunkZ4MIX43O_cjs.j(t),y),o);return chunkZ4MIX43O_cjs.k(E,g)<=0?[chunkZ4MIX43O_cjs.p(E),chunkZ4MIX43O_cjs.p(g)]:[chunkZ4MIX43O_cjs.p(g),chunkZ4MIX43O_cjs.p(E)]}let s=chunkZ4MIX43O_cjs.O(r),u=chunkZ4MIX43O_cjs.k(o,chunkZ4MIX43O_cjs.a)>0,l={kind:"div",left:{kind:"sub",left:chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.j(t)),right:s},right:chunkZ4MIX43O_cjs.p(o)},m={kind:"div",left:{kind:"add",left:chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.j(t)),right:s},right:chunkZ4MIX43O_cjs.p(o)};return u?[l,m]:[m,l]}function vo(e,t,n){let r=chunkZ4MIX43O_cjs.j(t),o=chunkZ4MIX43O_cjs.L(r.n),i=chunkZ4MIX43O_cjs.L(r.d);if(o!==null&&i!==null){let l=chunkZ4MIX43O_cjs.i({n:o,d:i},n),m=chunkZ4MIX43O_cjs.i(e,n);return [chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.o(m,chunkZ4MIX43O_cjs.j(l))),chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.o(m,l))]}let a=chunkZ4MIX43O_cjs.i(e,n),s=chunkZ4MIX43O_cjs.i(r,chunkZ4MIX43O_cjs.h(n,n)),u={kind:"mul",left:chunkZ4MIX43O_cjs.O(s),right:chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.n)};return chunkZ4MIX43O_cjs.l(a)?[{kind:"neg",operand:u},u]:[{kind:"sub",left:chunkZ4MIX43O_cjs.p(a),right:u},{kind:"add",left:chunkZ4MIX43O_cjs.p(a),right:u}]}function Mo(){return {n:2n,d:1n}}function Eo(){return {n:4n,d:1n}}function Io(e){return {re:e,im:0}}function $n(e,t,n){let r=chunkZ4MIX43O_cjs.C({kind:"sub",left:e,right:t});if(r===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let o=r.vars.filter(s=>s!==n),i=chunkZ4MIX43O_cjs.z(r,n);if(o.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${o.join(", ")}) are present`}:ko(r,n);if(i===0)return r.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>Fn)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${Fn}`};let a=[...chunkZ4MIX43O_cjs.B(r,n)].reverse();return _o(a)}function ko(e,t){let n=new Map,r=new Map;for(let[s,u]of e.terms){let l=s.split("*").filter(y=>y.length>0),m=l.indexOf(t);m===-1?r.set(s,u):(l.splice(m,1),n.set(l.join("*"),u));}let o=s=>{let u=new Set;for(let l of s.keys())for(let m of l.split("*"))m.length>0&&u.add(m.split("^")[0]);return [...u].sort()},i=chunkZ4MIX43O_cjs.E({terms:n,vars:o(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:chunkZ4MIX43O_cjs.E({terms:r,vars:o(r)})},right:i}],approximate:[]}}function wo(e){return e.length===4?Cn(e[0],e[1],e[2],e[3]):e.length===5?Pn(e[0],e[1],e[2],e[3],e[4],Un):null}function To(e){let t=[],n=[...e],r=0;for(;n.length>1&&chunkZ4MIX43O_cjs.l(n[n.length-1]);)n=n.slice(0,-1),r++;for(r>0&&t.push(chunkZ4MIX43O_cjs.a);n.length>1;){let o=he(n);if(o.length===0)break;for(let i of o){let a=0;for(;n.length>1&&chunkZ4MIX43O_cjs.l(So(n,i));)n=xo(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(chunkZ4MIX43O_cjs.k),remaining:n}}function _o(e){let{roots:t,remaining:n}=To(e),r=t.map(chunkZ4MIX43O_cjs.p),o=[],i=n.length-1,a=e.length-n.length;if(i<=0)return be(r,o,a,0,"");if(i===1)return r.push(chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.i(chunkZ4MIX43O_cjs.j(n[1]),n[0]))),be(r,o,a+1,0,"");if(i===2)return r.push(...Un(n[0],n[1],n[2])),be(r,o,a+2,0,"");let s=wo(n);if(s!==null)return r.push(...s.exact),o.push(...s.approximate.map(Io)),be(r,o,a+i,0,"");let u=Ln(n);return u!==null?(o.push(...u),be(r,o,a+i,0,"")):be(r,o,a,i,`a degree-${i} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function be(e,t,n,r,o){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return r>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+r-i):r,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+r} equation, which does not add up`:o}:{kind:"roots",exact:e,approximate:t}}var Bn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},Co=31,la=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function P(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.d(t)):null}function V(e){let t=chunkZ4MIX43O_cjs.Q(e);return t.kind==="const"?chunkNH74IT7B_cjs.n(chunkZ4MIX43O_cjs.e(t.value)):chunkNH74IT7B_cjs.K(t)}function et(e){return chunkNH74IT7B_cjs.P("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function ca(e,t){let n=P(e),r=P(t);return n===null||r===null?et("^"):V(chunkZ4MIX43O_cjs.r(n,r))}function ma(e){let t=P(e);return t===null?et("-"):V({kind:"neg",operand:t})}function da(e,t){let n=[];for(let o of t){let i=chunkNH74IT7B_cjs.Q(o);if(i)return i;let a=P(o);if(a===null)return et(Bn[e]??`builtin ${e}`);n.push(a);}if(e===Co&&n.length===2)return V(chunkZ4MIX43O_cjs.r(n[0],n[1]));let r=Bn[e];return r===void 0?et(`builtin ${e}`):V(chunkZ4MIX43O_cjs.s(r,n))}function Po(e){let t=V(e);return t.type===0&&!Number.isInteger(t.toNumber())?chunkNH74IT7B_cjs.K(e):t}function Vo(e){return e.im===0?chunkNH74IT7B_cjs.n(e.re):chunkNH74IT7B_cjs.K(chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.o(chunkZ4MIX43O_cjs.d(e.re),chunkZ4MIX43O_cjs.d(e.im))))}function Oo(e){switch(e.kind){case "identity":return chunkNH74IT7B_cjs.t("true for every value");case "contradiction":return chunkNH74IT7B_cjs.t("no solution");case "unsupported":return chunkNH74IT7B_cjs.P("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return chunkNH74IT7B_cjs.P("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t=e.exact.map(Po);for(let n of e.approximate)t.push(Vo(n));return t.length===0?chunkNH74IT7B_cjs.t("no solution"):t.length===1?t[0]:chunkNH74IT7B_cjs.C(1,t.length,t.map(n=>n.type===9?n.value:n.toNumber()))}}}function Yn(e,t,n){let r=P(e),o=P(t);return r===null||o===null?chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):Oo($n(r,o,n))}function ye(e,t){if(e.type===6&&t.type===6){if(e.unit===t.unit)return {lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true};let n=chunkPHWIO4P3_cjs.c(e.unit),r=chunkPHWIO4P3_cjs.c(t.unit),o=chunkSF5QVUEI_cjs.c.isCurrency(e.unit)&&chunkSF5QVUEI_cjs.c.isCurrency(t.unit);if(n&&n===r){let i=chunkPHWIO4P3_cjs.e(t.toNumber(),t.unit,e.unit);return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}if(o){let i=chunkSF5QVUEI_cjs.c.convertSync(t.toNumber(),t.unit,e.unit);if(i!==null)return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}return {lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true}:t.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}function Te(e,t){let n=new Array(e.length),r;for(let o=0;o<e.length;o++){let i=e[o];if(i.type!==6||i.unit===void 0){n[o]=i.toNumber();continue}if(r===void 0){r=i,n[o]=i.toNumber();continue}let{rv:a,sameMeasure:s}=ye(r,i);if(!s){let u=_e(r.unit,i.unit,t);return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",u??`Cannot combine incompatible units: ${r.unit??"?"} and ${i.unit??"?"}`)}n[o]=a;}return {magnitudes:n,unit:r?.unit}}var Do=1e-12;function Lo(e,t,n){let r=0;return Number.isFinite(e)&&Math.abs(e)>r&&(r=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>r&&(r=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>r&&(r=Math.abs(n)),r}function xa(e,t){let{lv:n,rv:r,sameMeasure:o}=ye(e,t);if(!o)return {lv:n,rv:r,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&chunkSF5QVUEI_cjs.c.isCurrency(e.unit))return {lv:n,rv:r,equal:chunkZ4MIX43O_cjs.qa(e.exact,t.exact)===0,sameMeasure:true};if(n===r)return {lv:n,rv:r,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(r))return {lv:n,rv:r,equal:false,sameMeasure:true};let i=Lo(n,r,t.toNumber());return {lv:n,rv:r,equal:Math.abs(n-r)<=i*Do,sameMeasure:true}}var Fo={time:"duration",luminousIntensity:"luminous intensity"},Uo=new Set(["money","data"]),$o={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function tt(e){if(chunkSF5QVUEI_cjs.c.isCurrency(e))return "money";let t=chunkPHWIO4P3_cjs.c(e);if(t!==void 0)return Fo[t]??t}function Kn(e){return Uo.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function _e(e,t,n){let r=e===void 0?void 0:tt(e),o=t===void 0?void 0:tt(t);if(r!==void 0&&o!==void 0&&r!==o)return `${r} and ${o} cannot be ${n}`}function Bo(e){return e!==void 0?$o[e]??"combined":"combined"}function va(e,t){let n=tt(e),r=tt(t);if(n!==void 0&&r!==void 0&&n!==r)return `${Kn(n)} cannot be converted to ${Kn(r)}`}function Ma(e,t){let n=e.type===6?e.unit:void 0,r=t.type===6?t.unit:void 0,o=_e(n,r,"compared");return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",o??`Cannot compare incompatible units: ${n??"?"} and ${r??"?"}`)}function Gn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw chunk6SYU4MH7_cjs.c.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function Ea(){return chunk6SYU4MH7_cjs.c.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function Ia(e,t){let n=jn(e),r=jn(t);return n===null||r===null?null:n<r?-1:n>r?1:0}function jn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function kt(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function Hn(e){return e.exact!==void 0?e.exact:chunkZ4MIX43O_cjs.ha(e.toNumber())}function qo(e,t,n){let r=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&chunkSF5QVUEI_cjs.c.isCurrency(e.unit),o=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&chunkSF5QVUEI_cjs.c.isCurrency(t.unit);if(!r&&!o)return null;let i,a,s;if(r&&o){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,s=e.unit;}else if(r&&t.type!==6)i=e.exact,s=e.unit,a=Hn(t);else if(o&&e.type!==6)a=t.exact,s=t.unit,i=Hn(e);else return null;if(i===null||a===null)return null;let u;switch(n){case "add":u=chunkZ4MIX43O_cjs.ja(i,a);break;case "sub":u=chunkZ4MIX43O_cjs.ka(i,a);break;case "mul":u=chunkZ4MIX43O_cjs.la(i,a);break;case "div":if(chunkZ4MIX43O_cjs.na(a))return null;u=chunkZ4MIX43O_cjs.pa(i,a);break}return chunkNH74IT7B_cjs.v(chunkZ4MIX43O_cjs.ra(u),s,u)}function nt(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?chunkZ4MIX43O_cjs.c(BigInt(e.value)):null}function ka(e,t,n){let r=nt(e);if(r===null)return null;let o=nt(t);if(o===null||n==="div"&&chunkZ4MIX43O_cjs.l(o))return null;let i;try{switch(n){case "add":i=chunkZ4MIX43O_cjs.f(r,o);break;case "sub":i=chunkZ4MIX43O_cjs.g(r,o);break;case "mul":i=chunkZ4MIX43O_cjs.h(r,o);break;case "div":i=chunkZ4MIX43O_cjs.i(r,o);break}}catch{return null}return chunkNH74IT7B_cjs.p(chunkZ4MIX43O_cjs.e(i),i)}function wa(e,t,n){if(e.type!==0||t.type!==0)return null;let r=e.value,o=t.value,i=e.uncertainty??0,a=t.uncertainty??0,s,u;switch(n){case "add":s=r+o,u=Math.hypot(i,a);break;case "sub":s=r-o,u=Math.hypot(i,a);break;case "mul":s=r*o,u=Math.hypot(o*i,r*a);break;case "div":s=r/o,u=Math.hypot(i/o,r*a/(o*o));break}return chunkNH74IT7B_cjs.q(s,u)}function Ta(e,t){let n=nt(e);if(n===null)return null;let r=nt(t);return r===null?null:chunkZ4MIX43O_cjs.k(n,r)}function _a(e,t,n,r,o){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(o&&(e.type===9||t.type===9)){let i=P(e),a=P(t);return i===null||a===null?chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):chunkNH74IT7B_cjs.K(chunkZ4MIX43O_cjs.Q({kind:o,left:i,right:a}))}if(e.type===0&&t.type===0)return chunkNH74IT7B_cjs.n(n(e.value,t.value));if(e.type===2||t.type===2){let i=Gn(e),a=Gn(t);return r?chunkNH74IT7B_cjs.s(r(i,a)):chunkNH74IT7B_cjs.s(i+a)}if(e.type===6||t.type===6){if(o){let g=qo(e,t,o);if(g)return g}let{lv:i,rv:a,unit:s,sameMeasure:u}=ye(e,t);if(!u){let g=e.type===6?e.unit:void 0,E=t.type===6?t.unit:void 0,q=_e(g,E,Bo(o));return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",q??`Cannot combine incompatible units: ${g??"?"} and ${E??"?"}`)}let l=chunkNH74IT7B_cjs.u(n(i,a),s),m=e.datetimeSpan===true&&t.datetimeSpan===true,y=e.datetimeSpan===true&&t.type===0||t.datetimeSpan===true&&e.type===0;return (m||y)&&(l.datetimeSpan=true),l}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!chunkZ4MIX43O_cjs.V(i,a))return chunkNH74IT7B_cjs.P("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let s=new Array(i.data.length);for(let u=0;u<i.data.length;u++)s[u]=n(i.data[u],a.data[u]);return chunkNH74IT7B_cjs.C(i.rows,i.cols,s)}if(e.type===7){let i=e.value,a=t.toNumber(),s=i.data.map(u=>n(u,a));return chunkNH74IT7B_cjs.C(i.rows,i.cols,s)}if(t.type===7){let i=t.value,a=e.toNumber(),s=i.data.map(u=>n(a,u));return chunkNH74IT7B_cjs.C(i.rows,i.cols,s)}return chunkNH74IT7B_cjs.n(n(e.toNumber(),t.toNumber()))}var Xn=254,Zn=200,Ce=class{constructor(){this.handlers=new Map;this.nextOpcode=Zn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>Xn)throw chunk6SYU4MH7_cjs.c.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${Xn-Zn} allocations).`);return this.nextOpcode++}},Va=new Ce;var Wn=chunkZ4MIX43O_cjs.ga(1);function Pe(e,t){return chunkSF5QVUEI_cjs.c.isCurrency(t)?e.exact??chunkZ4MIX43O_cjs.ha(e.toNumber()):null}function wt(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return chunkZ4MIX43O_cjs.ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?chunkZ4MIX43O_cjs.ia(t):null}function Qn(e,t,n){let r=Pe(e,n),o=wt(t);if(r!==null&&o!==null){let i=chunkZ4MIX43O_cjs.la(r,o);return chunkNH74IT7B_cjs.v(chunkZ4MIX43O_cjs.ra(i),n,i)}return chunkNH74IT7B_cjs.u(e.toNumber()*t,n)}function Jn(e,t,n,r){let o=Pe(e,t),i=wt(n);if(o!==null&&i!==null){let a=chunkZ4MIX43O_cjs.ja(Wn,r===1?i:chunkZ4MIX43O_cjs.ma(i)),s=chunkZ4MIX43O_cjs.la(o,a);return chunkNH74IT7B_cjs.v(chunkZ4MIX43O_cjs.ra(s),t,s)}return chunkNH74IT7B_cjs.u(e.toNumber()*(1+r*n),t)}function er(e){let t=wt(e);return t===null?null:chunkZ4MIX43O_cjs.ja(Wn,t)}function tr(e,t,n){let r=Pe(e,t),o=er(n);if(r===null||o===null||chunkZ4MIX43O_cjs.na(o))return null;let i=chunkZ4MIX43O_cjs.pa(r,o);return chunkNH74IT7B_cjs.v(chunkZ4MIX43O_cjs.ra(i),t,i)}function nr(e,t,n){let r=Pe(e,t),o=er(n);if(r===null||o===null||chunkZ4MIX43O_cjs.na(o))return null;let i=chunkZ4MIX43O_cjs.ka(r,chunkZ4MIX43O_cjs.pa(r,o));return chunkNH74IT7B_cjs.v(chunkZ4MIX43O_cjs.ra(i),t,i)}function rr(e,t){let n=e.unit,r=n!==void 0&&chunkSF5QVUEI_cjs.c.isCurrency(n)?Yo(e,n):null;if(r===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let o=BigInt(t),i=r/o,a=r-i*o,s=Number(a<0n?-a:a),u=r<0n?-1n:1n,l=zn(i,t-s);return s===0?{unit:n,shares:[l]}:{unit:n,shares:[l,zn(i+u,s)]}}function zn(e,t){let n=chunkZ4MIX43O_cjs.fa(e,2);return {value:chunkZ4MIX43O_cjs.ra(n),exact:n,count:t}}function Yo(e,t){let n=Pe(e,t);return n===null?null:chunkZ4MIX43O_cjs.oa(n,2).coef}var Ko=12;function or(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(chunkZ4MIX43O_cjs.a);return e.forEach((r,o)=>{t.forEach((i,a)=>{n[o+a]=chunkZ4MIX43O_cjs.f(n[o+a],chunkZ4MIX43O_cjs.h(r,i));});}),n}function Go(e,t){let n=[chunkZ4MIX43O_cjs.b];for(let r=0;r<t;r++)n=or(n,e);return n}function Tt(e,t){return e.map(n=>chunkZ4MIX43O_cjs.i(n,t))}function jo(e,t){let n=[],r=0;for(;r<e.length&&chunkZ4MIX43O_cjs.l(e[r]);)r++;r>0&&n.push({base:[chunkZ4MIX43O_cjs.a,chunkZ4MIX43O_cjs.b],power:r});let o=e.slice(r);if(o.length>1){let i=Mt([...o].reverse(),t);for(let a of i.factors){let s=chunkZ4MIX43O_cjs.C(a.base);if(s===null)return null;n.push({base:[...chunkZ4MIX43O_cjs.B(s,t)],power:a.power});}}return n.length>0?n:null}function Ho(e){let t=[];return e.forEach((n,r)=>{let o=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<o;a++)t.push({factor:r,power:i,degree:a});}),t}function Xo(e,t,n){let r=Go(t[e.factor].base,e.power),{quotient:o,remainder:i}=chunkZ4MIX43O_cjs.H(n,r);if(!chunkZ4MIX43O_cjs.G(i))return null;let a=new Array(e.degree).fill(chunkZ4MIX43O_cjs.a);return a.push(chunkZ4MIX43O_cjs.b),or(o,a)}function Zo(e,t){let n=t.length;for(let r=0;r<n;r++){let o=-1;for(let i=r;i<n;i++)if(!chunkZ4MIX43O_cjs.l(e[i][r])){o=i;break}if(o===-1)return null;[e[r],e[o]]=[e[o],e[r]],[t[r],t[o]]=[t[o],t[r]];for(let i=0;i<n;i++){if(i===r||chunkZ4MIX43O_cjs.l(e[i][r]))continue;let a=chunkZ4MIX43O_cjs.i(e[i][r],e[r][r]);for(let s=r;s<n;s++)e[i][s]=chunkZ4MIX43O_cjs.g(e[i][s],chunkZ4MIX43O_cjs.h(a,e[r][s]));t[i]=chunkZ4MIX43O_cjs.g(t[i],chunkZ4MIX43O_cjs.h(a,t[r]));}}return t.map((r,o)=>chunkZ4MIX43O_cjs.i(r,e[o][o]))}function _t(e,t,n){if(t.length<2||t.length-1>Ko)return null;let r=chunkZ4MIX43O_cjs.I(e,t),o=r.length>1?chunkZ4MIX43O_cjs.H(e,r).quotient:[...e],i=r.length>1?chunkZ4MIX43O_cjs.H(t,r).quotient:[...t];if(i.length===1)return {polynomial:Tt(o,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],s=Tt(i,a),u=Tt(o,a),{quotient:l,remainder:m}=chunkZ4MIX43O_cjs.H(u,s);if(chunkZ4MIX43O_cjs.G(m))return {polynomial:l,terms:[]};let y=jo(s,n);if(y===null)return null;let g=zo(y,s,m);return g===null?null:{polynomial:l,terms:g}}function zo(e,t,n){let r=Ho(e),o=t.length-1;if(r.length!==o)return null;let i=[];for(let l of r){let m=Xo(l,e,t);if(m===null)return null;i.push(m);}let a=[];for(let l=0;l<o;l++)a.push(i.map(m=>m[l]??chunkZ4MIX43O_cjs.a));let s=[];for(let l=0;l<o;l++)s.push(n[l]??chunkZ4MIX43O_cjs.a);let u=Zo(a,s);return u===null?null:Wo(r,u,e)}function Wo(e,t,n){let r=new Map;e.forEach((i,a)=>{let s=`${i.factor}:${i.power}`,u=r.get(s)??[];u[i.degree]=t[a],r.set(s,u);});let o=[];for(let[i,a]of r){let[s,u]=i.split(":").map(Number),l=[...a].map(m=>m??chunkZ4MIX43O_cjs.a);l.every(chunkZ4MIX43O_cjs.l)||o.push({numerator:l,base:n[s].base,power:u});}return o}function Ve(e,t){let n=new Map;return e.forEach((r,o)=>{chunkZ4MIX43O_cjs.l(r)||n.set(o===0?"":o===1?t:`${t}^${o}`,r);}),n.size===0?chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.a):chunkZ4MIX43O_cjs.E({terms:n,vars:e.length>1?[t]:[]})}function ir(e){let t=Ct(e);if(t===null)return e;let n=_t(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let r=n.polynomial.length>0?Ve(n.polynomial,t.variable):null;for(let o of n.terms){let i=Ve(o.base,t.variable),a=o.power===1?i:chunkZ4MIX43O_cjs.r(i,chunkZ4MIX43O_cjs.p({n:BigInt(o.power),d:1n})),s=Qo(o.numerator),u=s?o.numerator.map(m=>chunkZ4MIX43O_cjs.j(m)):o.numerator,l={kind:"div",left:Ve(u,t.variable),right:a};r===null?r=s?{kind:"neg",operand:l}:l:r={kind:s?"sub":"add",left:r,right:l};}return r===null?e:chunkZ4MIX43O_cjs.Q(r)}function Qo(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function Ct(e){if(e.kind!=="div")return null;let t=chunkZ4MIX43O_cjs.C(e.left),n=chunkZ4MIX43O_cjs.C(e.right);if(t===null||n===null)return null;let r=chunkZ4MIX43O_cjs.A(n);return r===null||t.vars.some(o=>o!==r)?null:{numerator:chunkZ4MIX43O_cjs.B(t,r),denominator:chunkZ4MIX43O_cjs.B(n,r),variable:r}}var Pt=16;function ar(){return chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.a)}function Q(){return chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.b)}function Jo(e,t){switch(e){case "sin":return chunkZ4MIX43O_cjs.s("cos",[t]);case "cos":return {kind:"neg",operand:chunkZ4MIX43O_cjs.s("sin",[t])};case "tan":return {kind:"div",left:Q(),right:chunkZ4MIX43O_cjs.r(chunkZ4MIX43O_cjs.s("cos",[t]),chunkZ4MIX43O_cjs.p(2))};case "exp":return chunkZ4MIX43O_cjs.s("exp",[t]);case "log":return {kind:"div",left:Q(),right:t};case "sqrt":return {kind:"div",left:Q(),right:{kind:"mul",left:chunkZ4MIX43O_cjs.p(2),right:chunkZ4MIX43O_cjs.s("sqrt",[t])}};case "asin":return {kind:"div",left:Q(),right:chunkZ4MIX43O_cjs.s("sqrt",[sr(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:Q(),right:chunkZ4MIX43O_cjs.s("sqrt",[sr(t)])}};case "atan":return {kind:"div",left:Q(),right:ei(t)};case "sinh":return chunkZ4MIX43O_cjs.s("cosh",[t]);case "cosh":return chunkZ4MIX43O_cjs.s("sinh",[t]);case "tanh":return {kind:"div",left:Q(),right:chunkZ4MIX43O_cjs.r(chunkZ4MIX43O_cjs.s("cosh",[t]),chunkZ4MIX43O_cjs.p(2))};case "abs":return chunkZ4MIX43O_cjs.s("sign",[t]);default:return null}}function sr(e){return {kind:"sub",left:Q(),right:chunkZ4MIX43O_cjs.r(e,chunkZ4MIX43O_cjs.p(2))}}function ei(e){return {kind:"add",left:Q(),right:chunkZ4MIX43O_cjs.r(e,chunkZ4MIX43O_cjs.p(2))}}function Oe(e,t,n=1){if(n<0||!Number.isInteger(n))throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>Pt)throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${Pt} is not supported.`,{limit:Pt});let r=chunkZ4MIX43O_cjs.Q(e);for(let o=0;o<n;o++)r=chunkZ4MIX43O_cjs.Q(F(r,t));return r}function F(e,t){switch(e.kind){case "const":case "complex":return ar();case "var":return e.name===t?Q():ar();case "add":return {kind:"add",left:F(e.left,t),right:F(e.right,t)};case "sub":return {kind:"sub",left:F(e.left,t),right:F(e.right,t)};case "neg":return {kind:"neg",operand:F(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:F(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:F(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:F(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:F(e.right,t)}},right:chunkZ4MIX43O_cjs.r(e.right,chunkZ4MIX43O_cjs.p(2))};case "pow":return ti(e,t);case "call":{if(e.args.length!==1)return Vt(e,t);let n=Jo(e.name,e.args[0]);return n===null?Vt(e,t):{kind:"mul",left:n,right:F(e.args[0],t)}}}}function ti(e,t){if(e.exponent.kind==="const"){let n=chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.g(e.exponent.value,chunkZ4MIX43O_cjs.b));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:chunkZ4MIX43O_cjs.r(e.base,n)},right:F(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:chunkZ4MIX43O_cjs.s("log",[e.base])},right:F(e.exponent,t)}:Vt(e,t)}function Vt(e,t){return chunkZ4MIX43O_cjs.s("der",[e,chunkZ4MIX43O_cjs.q(t)])}function ur(e,t){let n=chunkZ4MIX43O_cjs.C(e);if(n===null||n.vars.filter(s=>s!==t).length>0||chunkZ4MIX43O_cjs.z(n,t)>1)return null;let o=chunkZ4MIX43O_cjs.B(n,t),i=o[0]??{n:0n,d:1n},a=o[1]??{n:0n,d:1n};return chunkZ4MIX43O_cjs.l(a)?null:{slope:a,intercept:i}}function ni(e,t){let n=chunkZ4MIX43O_cjs.C(e);if(n===null)return null;let r=n.vars.filter(a=>a!==t);if(r.length>0)return {ok:false,reason:`it involves more than one unknown (${r.join(", ")})`};let o=chunkZ4MIX43O_cjs.B(n,t),i=chunkZ4MIX43O_cjs.p(0);return o.forEach((a,s)=>{if(chunkZ4MIX43O_cjs.l(a))return;let u=s+1,l=chunkZ4MIX43O_cjs.i(a,{n:BigInt(u),d:1n}),m={kind:"mul",left:chunkZ4MIX43O_cjs.p(l),right:u===1?chunkZ4MIX43O_cjs.q(t):chunkZ4MIX43O_cjs.r(chunkZ4MIX43O_cjs.q(t),chunkZ4MIX43O_cjs.p(u))};i={kind:"add",left:i,right:m};}),{ok:true,value:chunkZ4MIX43O_cjs.Q(i)}}function ri(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=ur(e.args[0],t);if(n===null)return null;let r=e.args[0],o=i=>chunkZ4MIX43O_cjs.Q({kind:"div",left:i,right:chunkZ4MIX43O_cjs.p(n.slope)});switch(e.name){case "exp":return {ok:true,value:o(chunkZ4MIX43O_cjs.s("exp",[r]))};case "sin":return {ok:true,value:o({kind:"neg",operand:chunkZ4MIX43O_cjs.s("cos",[r])})};case "cos":return {ok:true,value:o(chunkZ4MIX43O_cjs.s("sin",[r]))};case "log":return {ok:true,value:o({kind:"sub",left:{kind:"mul",left:r,right:chunkZ4MIX43O_cjs.s("log",[r])},right:r})};default:return null}}function oi(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!Ot(e.left.value))return null;let n=ur(e.right,t);if(n!==null)return {ok:true,value:chunkZ4MIX43O_cjs.Q({kind:"div",left:chunkZ4MIX43O_cjs.s("log",[e.right]),right:chunkZ4MIX43O_cjs.p(n.slope)})};let r=chunkZ4MIX43O_cjs.C(e.right);if(r!==null&&r.vars.length===1&&r.vars[0]===t){let o=chunkZ4MIX43O_cjs.B(r,t);if(o.length===3&&Ot(o[0])&&chunkZ4MIX43O_cjs.l(o[1])&&Ot(o[2]))return {ok:true,value:chunkZ4MIX43O_cjs.s("atan",[chunkZ4MIX43O_cjs.q(t)])}}return null}function Ot(e){return e.n===1n&&e.d===1n}function ii(e,t){let n=Ct(e);if(n===null||n.variable!==t)return null;let r=_t(n.numerator,n.denominator,t);if(r===null)return null;let o=r.polynomial.length>0?ui(r.polynomial,t):chunkZ4MIX43O_cjs.p(0);for(let i of r.terms){let a=ai(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};o={kind:"add",left:o,right:a};}return {ok:true,value:chunkZ4MIX43O_cjs.Q(o)}}function ai(e,t){let n=e.base.length-1,r=Ve(e.base,t);if(n===1){let o=e.numerator[0]??chunkZ4MIX43O_cjs.a;if(e.power===1)return {kind:"mul",left:chunkZ4MIX43O_cjs.p(o),right:chunkZ4MIX43O_cjs.s("log",[r])};let i=e.power-1,a=chunkZ4MIX43O_cjs.i(o,{n:BigInt(-i),d:1n});return {kind:"div",left:chunkZ4MIX43O_cjs.p(a),right:chunkZ4MIX43O_cjs.r(r,chunkZ4MIX43O_cjs.p({n:BigInt(i),d:1n}))}}return n!==2||e.power!==1?null:si(e,t,r)}function si(e,t,n){let r=e.numerator[0]??chunkZ4MIX43O_cjs.a,o=e.numerator[1]??chunkZ4MIX43O_cjs.a,[i,a]=e.base,s={n:1n,d:2n},u=chunkZ4MIX43O_cjs.h(a,s),l={kind:"mul",left:chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.h(o,s)),right:chunkZ4MIX43O_cjs.s("log",[n])},m=chunkZ4MIX43O_cjs.g(r,chunkZ4MIX43O_cjs.h(o,u));if(chunkZ4MIX43O_cjs.l(m))return l;let y=chunkZ4MIX43O_cjs.O(chunkZ4MIX43O_cjs.g(i,chunkZ4MIX43O_cjs.h(u,u))),g={kind:"add",left:chunkZ4MIX43O_cjs.q(t),right:chunkZ4MIX43O_cjs.p(u)},E={kind:"mul",left:{kind:"div",left:chunkZ4MIX43O_cjs.p(m),right:y},right:chunkZ4MIX43O_cjs.s("atan",[{kind:"div",left:g,right:y}])};return chunkZ4MIX43O_cjs.l(o)?E:{kind:"add",left:l,right:E}}function ui(e,t){let n=chunkZ4MIX43O_cjs.p(0);return e.forEach((r,o)=>{if(chunkZ4MIX43O_cjs.l(r))return;let i=o+1,a=chunkZ4MIX43O_cjs.i(r,{n:BigInt(i),d:1n}),s={kind:"mul",left:chunkZ4MIX43O_cjs.p(a),right:i===1?chunkZ4MIX43O_cjs.q(t):chunkZ4MIX43O_cjs.r(chunkZ4MIX43O_cjs.q(t),chunkZ4MIX43O_cjs.p(i))};n={kind:"add",left:n,right:s};}),n}function De(e,t){let n=chunkZ4MIX43O_cjs.Q(e);if(!chunkZ4MIX43O_cjs.u(n).has(t))return {ok:true,value:chunkZ4MIX43O_cjs.Q({kind:"mul",left:n,right:chunkZ4MIX43O_cjs.q(t)})};let r=ni(n,t);if(r!==null)return r;let o=ri(n,t);if(o!==null)return o;let i=oi(n,t);if(i!==null)return i;let a=ii(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let s=De(n.left,t);if(!s.ok)return s;let u=De(n.right,t);return u.ok?{ok:true,value:chunkZ4MIX43O_cjs.Q({kind:n.kind,left:s.value,right:u.value})}:u}if(n.kind==="mul"&&n.left.kind==="const"){let s=De(n.right,t);return s.ok?{ok:true,value:chunkZ4MIX43O_cjs.Q({kind:"mul",left:n.left,right:s.value})}:s}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var Dt=16;function lr(e,t,n,r){if(r<0||!Number.isInteger(r)||r>Dt)throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${Dt}.`,{limit:Dt});let o=chunkZ4MIX43O_cjs.p(n),i=1n,a=chunkZ4MIX43O_cjs.p(chunkZ4MIX43O_cjs.a);for(let s=0;s<=r;s++){s>0&&(i*=BigInt(s));let u=Oe(e,t,s),l=chunkZ4MIX43O_cjs.Q(chunkZ4MIX43O_cjs.v(u,t,o));if(l.kind!=="const")throw chunk6SYU4MH7_cjs.c.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${s} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:s});let m=chunkZ4MIX43O_cjs.i(l.value,{n:i,d:1n});if(chunkZ4MIX43O_cjs.l(m))continue;let y=chunkZ4MIX43O_cjs.l(n)?chunkZ4MIX43O_cjs.q(t):{kind:"sub",left:chunkZ4MIX43O_cjs.q(t),right:o},g=s===0?chunkZ4MIX43O_cjs.p(1):s===1?y:chunkZ4MIX43O_cjs.r(y,chunkZ4MIX43O_cjs.p(s));a={kind:"add",left:a,right:{kind:"mul",left:chunkZ4MIX43O_cjs.p(m),right:g}};}return chunkZ4MIX43O_cjs.Q(a)}function cr(e,t){return e.map(n=>t.map(r=>Oe(n,r)))}function li(){let e=globalThis.Temporal;return e??void 0}function mr(e){if(e!==void 0&&typeof e!="string")return e;if(e==="date")return chunkEQNKDTMX_cjs.b;let t=li();if(e==="temporal"){if(t===void 0)throw chunk6SYU4MH7_cjs.c.config("CALENDAR_TEMPORAL_UNAVAILABLE",'calendar: "temporal" was asked for, but this runtime has no Temporal. Node ships it from 26 (24 behind --harmony-temporal), and Chrome, Edge, Firefox and Opera ship it; Safari does not. Pass a polyfill-backed backend from "solve-engine/temporal", or use calendar: "auto" to compute on Date where Temporal is absent.');return chunkOBZJKZ2F_cjs.b(t)}return t===void 0?chunkEQNKDTMX_cjs.b:chunkOBZJKZ2F_cjs.b(t)}function ci(e={}){return {pluginFunctions:{},opRegistry:new Ce,pluginFunctionOwners:{},networkEnabled:e.networkEnabled??true,calendar:mr(e.calendar)}}var dr=ci();var mi={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},pr=1970,hr=2026;function fr(e){return mi[Math.trunc(e)]}function Lt(e,t){let n=fr(e),r=fr(t);if(!(n===void 0||r===void 0||n===0))return r/n}function Ns(e,t,n){let r=Lt(t,n);if(r!==void 0)return e*r}function di(e){let t=Math.abs(e);return t<60?chunkNH74IT7B_cjs.u(e,"s"):t<3600?chunkNH74IT7B_cjs.u(e/60,"min"):t<86400?chunkNH74IT7B_cjs.u(e/3600,"h"):chunkNH74IT7B_cjs.u(e/86400,"d")}var fi=0;function Ft(e){if(e.type===6&&e.unit!==void 0){let t=chunkEZKR44MA_cjs.a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===fi)return e.toNumber()*t[1]}return e.toNumber()}function pi(e,t){if(t===1)return e;let n=`${e}s`;return chunkEZKR44MA_cjs.a[n.toLowerCase()]===void 0?e:n}function br(e,t){let n,r=false;for(let o of e){if(Number.isNaN(o.toNumber())){r=true;continue}if(n===void 0){n=o;continue}let{lv:i,rv:a,sameMeasure:s}=ye(n,o);if(!s){let u=n.type===6?n.unit:void 0,l=o.type===6?o.unit:void 0,m=_e(u,l,"compared");return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",m??`Cannot compare incompatible units: ${u??"?"} and ${l??"?"}`)}(t?a>i:a<i)&&(n=o);}return r?chunkNH74IT7B_cjs.n(NaN):n===void 0?chunkNH74IT7B_cjs.n(t?-1/0:1/0):n.type===6?n:chunkNH74IT7B_cjs.n(n.toNumber())}function rt(e,t){return t===void 0?chunkNH74IT7B_cjs.n(e):chunkNH74IT7B_cjs.u(e,t)}function ot(e,t){return e.type===6&&e.unit!==void 0?chunkNH74IT7B_cjs.u(t,e.unit):chunkNH74IT7B_cjs.n(t)}function yr(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=chunkZ4MIX43O_cjs.oa(e.exact,n);return it(e,chunkZ4MIX43O_cjs.ra(a),n,a)}let r=e.toNumber();if(!Number.isFinite(r))return it(e,r,n);let o=Math.pow(10,n),i=r*o;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?it(e,r,n):it(e,Math.round(i)/o,n)}function it(e,t,n,r){let o=e.type===6&&e.unit!==void 0?chunkNH74IT7B_cjs.u(t,e.unit):chunkNH74IT7B_cjs.n(t);return o.decimalPlaces=n,r!==void 0&&(o.exact=r),o}function gr(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let r=Number.isFinite(e)?t:e;return chunkNH74IT7B_cjs.P("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(r)?"one of them has no value":"one of them is infinite"}`)}function Nr(e,t){let n=e,r=t;for(;r!==0;){let o=r;r=n%r,n=o;}return n}function hi(e){let t=e.length;if(t===0)return 0;let n=e.reduce((r,o)=>r+o,0)/t;return e.reduce((r,o)=>r+(o-n)*(o-n),0)}function at(e,t){let n=e.length;if(n===0)return 0;let r=t?n-1:n;return r<=0?0:hi(e)/r}var bi=12,yi=new Set(["month","months","mo","mos","mth","mths"]);function J(e){return e.type!==6||e.unit===void 0?e.toNumber():chunkPHWIO4P3_cjs.c(e.unit)!=="time"?chunkNH74IT7B_cjs.P("INVALID_TERM",`a term is a length of time, and "${e.unit}" is not: write it as days, months or years`):yi.has(e.unit)?e.toNumber()/bi:chunkPHWIO4P3_cjs.e(e.toNumber(),e.unit,"year")}var Bs={0:e=>{let t=e[0].toNumber();return t>=0?chunkNH74IT7B_cjs.n(Math.sqrt(t)):V(chunkZ4MIX43O_cjs.s("sqrt",[chunkZ4MIX43O_cjs.p(t)]))},1:e=>e[0].type===7?chunkZ4MIX43O_cjs.ca(e[0].value):ot(e[0],Math.abs(e[0].toNumber())),2:e=>chunkNH74IT7B_cjs.n(Math.sin(Ft(e[0]))),3:e=>chunkNH74IT7B_cjs.n(Math.cos(Ft(e[0]))),4:e=>chunkNH74IT7B_cjs.n(Math.tan(Ft(e[0]))),5:e=>chunkNH74IT7B_cjs.n(Math.log(e[0].toNumber())),6:e=>ot(e[0],Math.ceil(e[0].toNumber())),7:e=>ot(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?yr(e[0],e[1].toNumber()):ot(e[0],Math.round(e[0].toNumber())),9:e=>br(e,false),10:e=>br(e,true),11:e=>chunkNH74IT7B_cjs.n(Math.asin(e[0].toNumber())),12:e=>chunkNH74IT7B_cjs.n(Math.acos(e[0].toNumber())),13:e=>chunkNH74IT7B_cjs.n(Math.atan(e[0].toNumber())),14:e=>chunkNH74IT7B_cjs.n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>chunkNH74IT7B_cjs.n(Math.sinh(e[0].toNumber())),16:e=>chunkNH74IT7B_cjs.n(Math.cosh(e[0].toNumber())),17:e=>chunkNH74IT7B_cjs.n(Math.tanh(e[0].toNumber())),18:e=>chunkNH74IT7B_cjs.n(Math.asinh(e[0].toNumber())),19:e=>chunkNH74IT7B_cjs.n(Math.acosh(e[0].toNumber())),20:e=>chunkNH74IT7B_cjs.n(Math.atanh(e[0].toNumber())),21:e=>chunkNH74IT7B_cjs.n(Math.cbrt(e[0].toNumber())),22:e=>chunkNH74IT7B_cjs.n(Math.clz32(e[0].toNumber())),23:e=>chunkNH74IT7B_cjs.n(Math.expm1(e[0].toNumber())),24:e=>chunkNH74IT7B_cjs.n(Math.exp(e[0].toNumber())),25:e=>chunkNH74IT7B_cjs.n(Math.fround(e[0].toNumber())),26:e=>chunkNH74IT7B_cjs.n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>chunkNH74IT7B_cjs.n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>chunkNH74IT7B_cjs.n(Math.log10(e[0].toNumber())),29:e=>chunkNH74IT7B_cjs.n(Math.log1p(e[0].toNumber())),30:e=>chunkNH74IT7B_cjs.n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?chunkNH74IT7B_cjs.P("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):chunkZ4MIX43O_cjs.$(e[0].value,e[1].value):e[1].type===7?chunkNH74IT7B_cjs.P("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):chunkNH74IT7B_cjs.n(kt(e[0].toNumber(),e[1].toNumber())),32:()=>chunkNH74IT7B_cjs.n(Math.random()),33:e=>chunkNH74IT7B_cjs.n(Math.sign(e[0].toNumber())),34:e=>chunkNH74IT7B_cjs.n(Math.trunc(e[0].toNumber())),35:e=>chunkNH74IT7B_cjs.n(e[0].toNumber()*Math.PI/180),36:e=>chunkNH74IT7B_cjs.n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t>n?chunkNH74IT7B_cjs.P("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n}`):chunkNH74IT7B_cjs.n(Math.floor(Math.random()*(n-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),r=gr(t,n,"gcd");return r||chunkNH74IT7B_cjs.n(Nr(t,n))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),r=gr(t,n,"lcm");return r||(t===0||n===0?chunkNH74IT7B_cjs.n(0):chunkNH74IT7B_cjs.n(t/Nr(t,n)*n))},40:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunkNH74IT7B_cjs.P("INVALID_RANGE",`permutation: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let r=1;for(let o=0;o<n;o++)if(r*=t-o,!Number.isFinite(r))return chunkNH74IT7B_cjs.P("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n}) exceeds the maximum representable double (it passed it after ${o+1} of ${n} factors)`);return chunkNH74IT7B_cjs.n(r)},41:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunkNH74IT7B_cjs.P("INVALID_RANGE",`combination: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let r=Math.min(n,t-n),o=1;for(let i=0;i<r;i++)if(o=o*(t-i)/(i+1),!Number.isFinite(o))return chunkNH74IT7B_cjs.P("COMBINATION_OVERFLOW",`combination: C(${t}, ${n}) exceeds the maximum representable double (it passed it after ${i+1} of ${r} steps)`);return chunkNH74IT7B_cjs.n(Math.round(o))},42:e=>{if(e.length===0)return chunkNH74IT7B_cjs.n(0);let t=Te(e,"averaged");if(t instanceof chunkNH74IT7B_cjs.m)return t;let n=t.magnitudes.reduce((r,o)=>r+o,0);return rt(n/t.magnitudes.length,t.unit)},43:e=>{if(e.length===0)return chunkNH74IT7B_cjs.n(0);let t=Te(e,"ordered");if(t instanceof chunkNH74IT7B_cjs.m)return t;let n=t.magnitudes.slice().sort((o,i)=>o-i),r=Math.floor(n.length/2);return rt(n.length%2===0?(n[r-1]+n[r])/2:n[r],t.unit)},44:e=>{let t=Te(e,"added");return t instanceof chunkNH74IT7B_cjs.m?t:rt(t.magnitudes.reduce((n,r)=>n+r,0),t.unit)},45:e=>chunkNH74IT7B_cjs.n(e.length),46:e=>{let[t,n,r]=e,{lv:o,rv:i}=ye(t,n);if(o===0)return chunkNH74IT7B_cjs.P("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=r.toNumber()*(i/o);return r.type===6?chunkNH74IT7B_cjs.u(a,r.unit):chunkNH74IT7B_cjs.n(a)},47:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=e[2].toNumber();return n>r?chunkNH74IT7B_cjs.P("INVALID_RANGE",`clamp: invalid range, ${n} is greater than ${r}`):chunkNH74IT7B_cjs.n(Math.min(Math.max(t,n),r))},48:e=>chunkNH74IT7B_cjs.r(e[0].toNumber()),49:e=>chunkNH74IT7B_cjs.r(e[0].toNumber(),"bin"),50:e=>chunkNH74IT7B_cjs.n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`compoundInterest: rate ${n} makes (1 + rate) non-positive`);let o=t*Math.pow(1+n,r);return e[0].type===6?chunkNH74IT7B_cjs.u(o,e[0].unit):chunkNH74IT7B_cjs.n(o)},52:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`interestEarned: rate ${n} makes (1 + rate) non-positive`);let o=t*(Math.pow(1+n,r)-1);return e[0].type===6?chunkNH74IT7B_cjs.u(o,e[0].unit):chunkNH74IT7B_cjs.n(o)},53:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);return typeof r!="number"?r:t<=0||n<=0?chunkNH74IT7B_cjs.P("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):r<=0?chunkNH74IT7B_cjs.P("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):chunkNH74IT7B_cjs.n(Math.pow(n/t,1/r)-1)},54:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=e[2].toNumber();return t<=0||n<=0?chunkNH74IT7B_cjs.P("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+r<=0||r===0?chunkNH74IT7B_cjs.P("INVALID_RATE",`compoundInterestYears: rate ${r} is not usable (must be > -1 and not 0)`):chunkNH74IT7B_cjs.n(Math.log(n/t)/Math.log(1+r))},55:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(t<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanRepayment: principal must be positive");if(r<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanRepayment: years must be positive");if(n<0)return chunkNH74IT7B_cjs.P("INVALID_RATE","loanRepayment: rate must not be negative");if(o<0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=Bt(t,n,r),a=o===0?i:i/(r*o);return e[0].type===6?chunkNH74IT7B_cjs.u(a,e[0].unit):chunkNH74IT7B_cjs.n(a)},56:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(t<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanInterest: principal must be positive");if(r<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanInterest: years must be positive");if(n<0)return chunkNH74IT7B_cjs.P("INVALID_RATE","loanInterest: rate must not be negative");if(o<0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=Bt(t,n,r),a=o===0?i:i/(r*o);return e[0].type===6?chunkNH74IT7B_cjs.u(a,e[0].unit):chunkNH74IT7B_cjs.n(a)},57:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(t<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","monthlyPayment: principal must be positive");if(r<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","monthlyPayment: years must be positive");if(n<0)return chunkNH74IT7B_cjs.P("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:o}=Bt(t,n,r);return e[0].type===6?chunkNH74IT7B_cjs.u(o,e[0].unit):chunkNH74IT7B_cjs.n(o)},58:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?Jn(e[0],e[0].unit,n,1):chunkNH74IT7B_cjs.n(t*(1+n))},59:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return 1+n<=0?chunkNH74IT7B_cjs.P("INVALID_RATE",`taxRemove: rate ${n} makes (1 + rate) non-positive`):e[0].type===6?tr(e[0],e[0].unit,n)??chunkNH74IT7B_cjs.u(t/(1+n),e[0].unit):chunkNH74IT7B_cjs.n(t/(1+n))},60:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=e[2].toNumber(),o=Lt(n,r);if(o===void 0)return chunkNH74IT7B_cjs.P("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n} or toYear ${r} is outside the bundled CPI table's range (${pr}-${hr})`);let i=t*o;return e[0].type===6?chunkNH74IT7B_cjs.u(i,e[0].unit):chunkNH74IT7B_cjs.n(i)},61:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return chunkNH74IT7B_cjs.n(kt(n,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return chunkNH74IT7B_cjs.P("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return chunkNH74IT7B_cjs.P("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n=1;for(let r=2;r<=t;r++)n*=r;return chunkNH74IT7B_cjs.n(n)},63:e=>e[0].type===7?chunkZ4MIX43O_cjs.ba(e[0].value):e[0],64:e=>e[0].type===7?chunkZ4MIX43O_cjs.ca(e[0].value):chunkNH74IT7B_cjs.n(e[0].toNumber()),65:e=>e[0].type===7?chunkZ4MIX43O_cjs.da(e[0].value):chunkNH74IT7B_cjs.n(1/e[0].toNumber()),66:e=>{let[t,n]=e;if(t.type===0&&n.type===0)return chunkNH74IT7B_cjs.n(t.toNumber()*n.toNumber());let r=o=>o.type===7?o.value:{rows:1,cols:1,data:[o.toNumber()],hasSymbolic:false};return chunkZ4MIX43O_cjs._(r(t),r(n))},67:e=>{let[t]=e;return t.type!==9?t:V(chunkZ4MIX43O_cjs.F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:V(Tn(t.value))},69:e=>{let[t,n,r]=e;return r?.type!==3?chunkNH74IT7B_cjs.P("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):Yn(t,n,r.value)},70:e=>{let[t,n,r]=e,o=$t(n,"der");if(typeof o!="string")return o;let i=P(t);return i===null?chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):V(Oe(i,o,r?.toNumber()??1))},71:e=>{let[t,n]=e,r=$t(n,"integral");if(typeof r!="string")return r;let o=P(t);if(o===null)return chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=De(o,r);return i.ok?V(i.value):chunkNH74IT7B_cjs.P("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,r,o]=e,i=$t(n,"taylor");if(typeof i!="string")return i;let a=P(t),s=P(r);return a===null||s===null||s.kind!=="const"?chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):V(lr(a,i,s.value,o.toNumber()))},73:e=>{let t=[];for(let a of e){let s=P(a);if(s===null)return chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(s);}let n=new Set;for(let a of t)for(let s of chunkZ4MIX43O_cjs.u(a))n.add(s);let r=[...n].sort();if(r.length===0)return chunkNH74IT7B_cjs.P("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let o=cr(t,r),i=[];for(let a of o)for(let s of a)i.push(chunkZ4MIX43O_cjs.W(s));return chunkNH74IT7B_cjs.C(o.length,r.length,chunkZ4MIX43O_cjs.Y(o.length,r.length,i))},74:e=>V(chunkZ4MIX43O_cjs.w(chunkZ4MIX43O_cjs.o(chunkZ4MIX43O_cjs.a,chunkZ4MIX43O_cjs.d(e[0].toNumber())))),75:e=>Ut("conj",e[0]),76:e=>Ut("re",e[0]),77:e=>Ut("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:V(chunkZ4MIX43O_cjs.J(t.value))},79:e=>{let t=e[0];return t.type!==9?t:V(ir(t.value))},85:e=>{let t=e[0].toNumber(),n=e[1].toNumber();if(1+n<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`taxIn: rate ${n} makes (1 + rate) non-positive`);let r=t-t/(1+n);return e[0].type===6?nr(e[0],e[0].unit,n)??chunkNH74IT7B_cjs.u(r,e[0].unit):chunkNH74IT7B_cjs.n(r)},86:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?Qn(e[0],n,e[0].unit):chunkNH74IT7B_cjs.n(t*n)},87:e=>chunkNH74IT7B_cjs.n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>chunkNH74IT7B_cjs.n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>chunkNH74IT7B_cjs.n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>chunkNH74IT7B_cjs.n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>chunkNH74IT7B_cjs.n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>chunkNH74IT7B_cjs.n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>chunkNH74IT7B_cjs.u(e[0].toNumber(),"days"),94:e=>{let t=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t===void 0||n===void 0)return chunkNH74IT7B_cjs.P("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let r=chunkEZKR44MA_cjs.a[t.toLowerCase()],o=chunkEZKR44MA_cjs.a[n.toLowerCase()];if(r===void 0||o===void 0)return chunkNH74IT7B_cjs.P("UNKNOWN_UNIT",`${t} and ${n}: one of these is not a unit`);if(r[0]!==o[0])return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",`${t} and ${n} measure different things`);if(o[1]>=r[1])return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",`${t} and ${n}: name the larger unit first`);let i=e[0],a=i.type===6&&i.unit!==void 0?chunkEZKR44MA_cjs.a[i.unit.toLowerCase()]:void 0,s=i.toNumber()*(a?.[1]??r[1]),u=Math.floor(s/r[1]),l=Math.round((s-u*r[1])/o[1]*1e3)/1e3;return chunkNH74IT7B_cjs.t(`${u} ${t} ${l} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),r=t.type===6&&t.unit!==void 0?t.unit:"";return r.includes("/")?chunkNH74IT7B_cjs.P("INVALID_RATE_UNIT",`${r}/${n}: that is already a rate`):chunkNH74IT7B_cjs.u(t.toNumber(),`${r}/${n}`)},96:e=>{let t=e[0],n=e[1];if(n.type===6&&t.type===6&&chunkPHWIO4P3_cjs.i(n.unit)){let l=chunkPHWIO4P3_cjs.j(t.toNumber(),t.unit,n.toNumber(),n.unit);if(l!==null)return di(l)}if(n.type!==6||n.unit===void 0||!n.unit.includes("/"))return chunkNH74IT7B_cjs.P("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let r=n.unit.indexOf("/"),o=n.unit.slice(0,r),i=n.unit.slice(r+1),a=t.type===6?t.unit:void 0,s=chunkEZKR44MA_cjs.a[i.toLowerCase()],u=a===void 0?void 0:chunkEZKR44MA_cjs.a[a.toLowerCase()];if(u!==void 0&&s!==void 0&&u[0]===s[0]){let m=t.toNumber()*u[1]/s[1]*n.toNumber();return o===""?chunkNH74IT7B_cjs.n(m):chunkNH74IT7B_cjs.u(m,o)}if(a!==void 0&&a===o){let l=t.toNumber()/n.toNumber();return chunkNH74IT7B_cjs.u(l,pi(i,l))}if(a===void 0){let l=t.toNumber()*n.toNumber();return o===""?chunkNH74IT7B_cjs.n(l):chunkNH74IT7B_cjs.u(l,o)}return chunkNH74IT7B_cjs.P("INCOMPATIBLE_UNITS",`at: ${a} matches neither side of ${n.unit}`)},80:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(o<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`compounding: ${o} periods per year is not a period`);if(1+n/o<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`compounding: rate ${n} makes each period non-positive`);let i=t*Math.pow(1+n/o,o*r);return e[0].type===6?chunkNH74IT7B_cjs.u(i,e[0].unit):chunkNH74IT7B_cjs.n(i)},81:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(o<=0||1+n/o<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`compounding: rate ${n} over ${o} periods per year is not usable`);let i=t*(Math.pow(1+n/o,o*r)-1);return e[0].type===6?chunkNH74IT7B_cjs.u(i,e[0].unit):chunkNH74IT7B_cjs.n(i)},82:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n<=0)return chunkNH74IT7B_cjs.P("INVALID_RATE",`presentValue: rate ${n} makes (1 + rate) non-positive`);let o=t/Math.pow(1+n,r);return e[0].type===6?chunkNH74IT7B_cjs.u(o,e[0].unit):chunkNH74IT7B_cjs.n(o)},83:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t===0?chunkNH74IT7B_cjs.P("INVALID_RATE","roi: nothing was invested, so there is no return on it"):chunkNH74IT7B_cjs.n((n-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);return typeof r!="number"?r:t<=0?chunkNH74IT7B_cjs.P("INVALID_RATE","annual return: the amount invested must be positive"):r<=0?chunkNH74IT7B_cjs.P("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?chunkNH74IT7B_cjs.P("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):chunkNH74IT7B_cjs.N(Math.pow(n/t,1/r)-1)},97:e=>yr(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?chunkNH74IT7B_cjs.P("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):chunkNH74IT7B_cjs.H(rr(e[0],t))},99:e=>{let t=e[0].toNumber(),n=gi(e[1]),r=e[2].toNumber();if(n===null)return chunkNH74IT7B_cjs.P("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","savings goal: the duration must be positive.");if(r<0)return chunkNH74IT7B_cjs.P("INVALID_RATE","savings goal: the rate must not be negative.");let o=Ni(t,r/12,n);return e[0].type===6?chunkNH74IT7B_cjs.u(o,e[0].unit):chunkNH74IT7B_cjs.n(o)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=e[2].toNumber(),o=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunkNH74IT7B_cjs.P("INVALID_RANGE","savings goal: the contribution must be positive.");if(o<0)return chunkNH74IT7B_cjs.P("INVALID_RATE","savings goal: the rate must not be negative.");let a=Ri(t,n,o/r);return chunkNH74IT7B_cjs.u(a,i)},101:e=>chunkNH74IT7B_cjs.n(Math.sqrt(at(e.map(t=>t.toNumber()),false))),102:e=>chunkNH74IT7B_cjs.n(Math.sqrt(at(e.map(t=>t.toNumber()),true))),103:e=>chunkNH74IT7B_cjs.n(at(e.map(t=>t.toNumber()),false)),104:e=>chunkNH74IT7B_cjs.n(at(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return chunkNH74IT7B_cjs.n(0);let t=Te(e,"compared");if(t instanceof chunkNH74IT7B_cjs.m)return t;let n=t.magnitudes;return rt(Math.max(...n)-Math.min(...n),t.unit)},106:e=>{if(e.length===0)return chunkNH74IT7B_cjs.n(0);let t=new Map,n=e[0].toNumber(),r=0;for(let o of e){let i=o.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>r&&(r=a,n=i);}return chunkNH74IT7B_cjs.n(n)},107:e=>{let t=0,n=0;for(let r=0;r+1<e.length;r+=2){let o=e[r].toNumber(),i=e[r+1].toNumber();t+=o*i,n+=i;}return n===0?chunkNH74IT7B_cjs.P("WEIGHTED_AVERAGE_ZERO_WEIGHT","weighted average: the weights sum to zero, so there is nothing to divide by"):chunkNH74IT7B_cjs.n(t/n)}};function gi(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function Ni(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function Ri(e,t,n){let r=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(r-1e-9)}function Ut(e,t){let n=P(t);return n===null?chunkNH74IT7B_cjs.P("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):V(chunkZ4MIX43O_cjs.s(e,[n]))}function $t(e,t){return e?.type!==3?chunkNH74IT7B_cjs.P("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function Bt(e,t,n){let r=n*12,o=t/12,i=o===0?e/r:e*o/(1-Math.pow(1+o,-r)),a=i*r,s=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:s}}var qs=dr.pluginFunctions,Rr=65535,Ar=0;function Ai(){if(Ar>Rr)throw chunk6SYU4MH7_cjs.c.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${Rr+1} allocations).`);return Ar++}var Sr=new Map;function Ys(e){let t=Sr.get(e);return t===void 0&&(t=Ai(),Sr.set(e,t)),t}var qt=new Map;function Ks(e,t){let n=e.toLowerCase(),r=qt.get(n);r&&r!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),qt.set(n,t);}function Gs(e){qt.delete(e.toLowerCase());}var st=class st{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let r=this.values.get(t);this.values.set(t,n),!(r!==void 0&&Si(r,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=st.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let r of this.listeners)r(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};st.MAX_NOTIFY_DEPTH=64;var Yt=st;function Si(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,r=t.value;if(Array.isArray(n)||Array.isArray(r)){if(!Array.isArray(n)||!Array.isArray(r)||n.length!==r.length)return false;for(let o=0;o<n.length;o++)if(!Object.is(n[o],r[o]))return false;return true}return Object.is(n,r)}var Hs=new Yt;function Xs(e){return `global:${e}`}var xi={sydney:"Australia/Sydney",melbourne:"Australia/Melbourne",brisbane:"Australia/Brisbane",perth:"Australia/Perth",adelaide:"Australia/Adelaide",canberra:"Australia/Sydney",auckland:"Pacific/Auckland",wellington:"Pacific/Auckland",fiji:"Pacific/Fiji",chicago:"America/Chicago",seattle:"America/Los_Angeles",denver:"America/Denver",phoenix:"America/Phoenix",toronto:"America/Toronto",montreal:"America/Toronto",vancouver:"America/Vancouver",ottawa:"America/Toronto",honolulu:"Pacific/Honolulu",anchorage:"America/Anchorage",miami:"America/New_York",boston:"America/New_York",atlanta:"America/New_York",dallas:"America/Chicago",houston:"America/Chicago",lima:"America/Lima",bogota:"America/Bogota",caracas:"America/Caracas",santiago:"America/Santiago",montevideo:"America/Montevideo",quito:"America/Guayaquil",london:"Europe/London",paris:"Europe/Paris",berlin:"Europe/Berlin",madrid:"Europe/Madrid",rome:"Europe/Rome",amsterdam:"Europe/Amsterdam",dublin:"Europe/Dublin",lisbon:"Europe/Lisbon",vienna:"Europe/Vienna",zurich:"Europe/Zurich",geneva:"Europe/Zurich",moscow:"Europe/Moscow",istanbul:"Europe/Istanbul",athens:"Europe/Athens",stockholm:"Europe/Stockholm",oslo:"Europe/Oslo",helsinki:"Europe/Helsinki",warsaw:"Europe/Warsaw",prague:"Europe/Prague",budapest:"Europe/Budapest",brussels:"Europe/Brussels",copenhagen:"Europe/Copenhagen",reykjavik:"Atlantic/Reykjavik",kiev:"Europe/Kyiv",kyiv:"Europe/Kyiv",tokyo:"Asia/Tokyo",osaka:"Asia/Tokyo",beijing:"Asia/Shanghai",shanghai:"Asia/Shanghai",seoul:"Asia/Seoul",singapore:"Asia/Singapore",bangkok:"Asia/Bangkok",jakarta:"Asia/Jakarta",manila:"Asia/Manila",mumbai:"Asia/Kolkata",delhi:"Asia/Kolkata",bangalore:"Asia/Kolkata",dubai:"Asia/Dubai",abudhabi:"Asia/Dubai",karachi:"Asia/Karachi",dhaka:"Asia/Dhaka",hanoi:"Asia/Ho_Chi_Minh",taipei:"Asia/Taipei",islamabad:"Asia/Karachi",riyadh:"Asia/Riyadh",telaviv:"Asia/Jerusalem",jerusalem:"Asia/Jerusalem",cairo:"Africa/Cairo",lagos:"Africa/Lagos",nairobi:"Africa/Nairobi",johannesburg:"Africa/Johannesburg",casablanca:"Africa/Casablanca",accra:"Africa/Accra",tunis:"Africa/Tunis",addisababa:"Africa/Addis_Ababa",france:"Europe/Paris",germany:"Europe/Berlin",spain:"Europe/Madrid",italy:"Europe/Rome",japan:"Asia/Tokyo",china:"Asia/Shanghai",india:"Asia/Kolkata",brazil:"America/Sao_Paulo",russia:"Europe/Moscow",australia:"Australia/Sydney",canada:"America/Toronto",mexico:"America/Mexico_City",uk:"Europe/London",usa:"America/New_York",ireland:"Europe/Dublin",netherlands:"Europe/Amsterdam",sweden:"Europe/Stockholm",norway:"Europe/Oslo",poland:"Europe/Warsaw",turkey:"Europe/Istanbul",egypt:"Africa/Cairo",nigeria:"Africa/Lagos"},vi={"new york":"America/New_York","los angeles":"America/Los_Angeles","san francisco":"America/Los_Angeles","las vegas":"America/Los_Angeles","mexico city":"America/Mexico_City","hong kong":"Asia/Hong_Kong","kuala lumpur":"Asia/Kuala_Lumpur","sao paulo":"America/Sao_Paulo","buenos aires":"America/Argentina/Buenos_Aires","rio de janeiro":"America/Sao_Paulo","cape town":"Africa/Johannesburg","new delhi":"Asia/Kolkata","united kingdom":"Europe/London","united states":"America/New_York","south africa":"Africa/Johannesburg"},Mi={pst:"America/Los_Angeles",pdt:"America/Los_Angeles",est:"America/New_York",edt:"America/New_York",cst:"America/Chicago",cdt:"America/Chicago",mst:"America/Denver",mdt:"America/Denver",hst:"Pacific/Honolulu",bst:"Europe/London",cet:"Europe/Paris",cest:"Europe/Paris",jst:"Asia/Tokyo",ist:"Asia/Kolkata",aest:"Australia/Sydney",aedt:"Australia/Sydney"},Ei={...xi,...vi,...Mi};function zs(e){let t=e.trim().toLowerCase();return t==="utc"||t==="gmt"?"UTC":Ei[t]??null}exports.A=Va;exports.B=ci;exports.C=dr;exports.D=pr;exports.E=hr;exports.F=Ns;exports.G=Bs;exports.H=qs;exports.I=Ai;exports.J=Ys;exports.K=qt;exports.L=Ks;exports.M=Gs;exports.N=Hs;exports.O=Xs;exports.P=vi;exports.Q=Ei;exports.R=zs;exports.a=At;exports.b=Ii;exports.c=Rn;exports.d=Pe;exports.e=Qn;exports.f=Jn;exports.g=$n;exports.h=la;exports.i=ca;exports.j=ma;exports.k=da;exports.l=Yn;exports.m=ye;exports.n=Te;exports.o=xa;exports.p=va;exports.q=Ma;exports.r=Gn;exports.s=Ea;exports.t=Ia;exports.u=kt;exports.v=ka;exports.w=wa;exports.x=Ta;exports.y=_a;exports.z=Ce;//# sourceMappingURL=chunk-54QMY2VL.cjs.map
2
+ //# sourceMappingURL=chunk-54QMY2VL.cjs.map