@pie-players/pie-calculator-cortex 0.3.68

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.
@@ -0,0 +1,389 @@
1
+ var g = class extends Error {
2
+ code;
3
+ recoverable;
4
+ constructor(e, r, n = {}) {
5
+ super(r, n.cause === void 0 ? void 0 : { cause: n.cause }), this.name = "CortexCalculatorError", this.code = e, this.recoverable = n.recoverable ?? !0;
6
+ }
7
+ };
8
+ function N(e, r, n) {
9
+ return e instanceof g ? e : new g(r, n, {
10
+ cause: e,
11
+ recoverable: r !== "worker-unavailable"
12
+ });
13
+ }
14
+ var h = {
15
+ basicCalculator: "Basic calculator",
16
+ scientificCalculator: "Scientific calculator",
17
+ graphingCalculator: "Graphing calculator",
18
+ expressionLabel: "{calculator} expression",
19
+ angleMode: "Angle mode",
20
+ degrees: "Degrees",
21
+ radians: "Radians",
22
+ calculate: "Calculate",
23
+ calculating: "Calculating",
24
+ backspace: "Backspace",
25
+ clear: "Clear",
26
+ result: "Result: {result}",
27
+ calculationHistory: "Calculation history",
28
+ clearHistory: "Clear history",
29
+ virtualKeyboardBasic: "Basic",
30
+ virtualKeyboardScientific: "Scientific",
31
+ virtualKeyboardGraphing: "Graphing",
32
+ keypad: "Keypad",
33
+ keypadLayer: "Keypad layer",
34
+ angleModeDegreesShort: "DEG",
35
+ angleModeRadiansShort: "RAD",
36
+ angleModeChanged: "Angle mode {mode}. Previous result cleared.",
37
+ inserted: "{key}",
38
+ keySine: "sin, sine",
39
+ keyCosine: "cos, cosine",
40
+ keyTangent: "tan, tangent",
41
+ keyInverseSine: "sin, inverse sine",
42
+ keyInverseCosine: "cos, inverse cosine",
43
+ keyInverseTangent: "tan, inverse tangent",
44
+ keyNaturalLog: "ln, natural logarithm",
45
+ keyCommonLog: "log, common logarithm",
46
+ keyLogBaseN: "Logarithm with a chosen base",
47
+ keyFraction: "Fraction",
48
+ keySquareRoot: "Square root",
49
+ keyNthRoot: "Nth root",
50
+ keyPower: "To the power of",
51
+ keySquared: "Squared",
52
+ keyCubed: "Cubed",
53
+ keyExponential: "e to the power of",
54
+ keyAbsoluteValue: "Absolute value",
55
+ keyFactorial: "Factorial",
56
+ keyPi: "Pi",
57
+ keyEuler: "e, Euler's number",
58
+ keyPercent: "Percent",
59
+ keyOpenParenthesis: "Open parenthesis",
60
+ keyCloseParenthesis: "Close parenthesis",
61
+ keyDecimalSeparator: "Decimal separator",
62
+ keyDigit: "{digit}",
63
+ keyAdd: "Plus",
64
+ keySubtract: "Minus",
65
+ keyMultiply: "Times",
66
+ keyDivide: "Divided by",
67
+ keyVariableX: "x, variable x",
68
+ graphExpressions: "Graph expressions",
69
+ graphExpressionLabel: "Graph expression {index}, {lineStyle} line",
70
+ seriesDescription: "Series {index}: {lineStyle} line",
71
+ showExpression: "Show expression {index}",
72
+ hideExpression: "Hide expression {index}",
73
+ show: "Show",
74
+ hide: "Hide",
75
+ removeExpression: "Remove expression {index}",
76
+ remove: "Remove",
77
+ addExpression: "Add expression",
78
+ graph: "Graph",
79
+ viewportControls: "Graph view",
80
+ zoomIn: "Zoom in",
81
+ zoomOut: "Zoom out",
82
+ panLeft: "Pan left",
83
+ panRight: "Pan right",
84
+ panUp: "Pan up",
85
+ panDown: "Pan down",
86
+ resetView: "Reset view",
87
+ updatingGraph: "Updating graph",
88
+ graphSummary: "Graph summary",
89
+ viewportSummary: "Viewport x from {xMin} to {xMax}, y from {yMin} to {yMax}.",
90
+ seriesSummary: "Series {index}, {lineStyle}: {expression}",
91
+ keyboardGraphTrace: "Keyboard graph trace",
92
+ keyboardTrace: "Keyboard trace",
93
+ series: "Series",
94
+ seriesOption: "Series {index}",
95
+ previousPoint: "Previous point",
96
+ nextPoint: "Next point",
97
+ tracePoint: "x {x}, y {y}",
98
+ noSampledPoint: "No sampled graph point is available.",
99
+ lineStyleSolid: "solid",
100
+ lineStyleDashed: "dashed",
101
+ lineStyleDotted: "dotted",
102
+ errorInvalidExpression: "Check the expression and try again.",
103
+ errorUnsupportedExpression: "This expression is not available in this calculator.",
104
+ errorExpressionTooComplex: "Simplify the expression and try again.",
105
+ errorEvaluationTimeout: "The calculation took too long and was stopped.",
106
+ errorInvalidState: "The saved calculator state could not be restored.",
107
+ errorWorkerUnavailable: "The calculator is temporarily unavailable."
108
+ }, m = {
109
+ basicCalculator: "Eenvoudige rekenmachine",
110
+ scientificCalculator: "Wetenschappelijke rekenmachine",
111
+ graphingCalculator: "Grafische rekenmachine",
112
+ expressionLabel: "Uitdrukking voor {calculator}",
113
+ angleMode: "Hoekeenheid",
114
+ degrees: "Graden",
115
+ radians: "Radialen",
116
+ calculate: "Bereken",
117
+ calculating: "Bezig met berekenen",
118
+ backspace: "Wis teken",
119
+ clear: "Wissen",
120
+ result: "Resultaat: {result}",
121
+ calculationHistory: "Berekeningsgeschiedenis",
122
+ clearHistory: "Geschiedenis wissen",
123
+ virtualKeyboardBasic: "Eenvoudig",
124
+ virtualKeyboardScientific: "Wetenschappelijk",
125
+ virtualKeyboardGraphing: "Grafisch",
126
+ keypad: "Toetsenblok",
127
+ keypadLayer: "Laag van het toetsenblok",
128
+ angleModeDegreesShort: "GR",
129
+ angleModeRadiansShort: "RAD",
130
+ angleModeChanged: "Hoekeenheid {mode}. Vorig resultaat gewist.",
131
+ inserted: "{key}",
132
+ keySine: "sin, sinus",
133
+ keyCosine: "cos, cosinus",
134
+ keyTangent: "tan, tangens",
135
+ keyInverseSine: "sin, arcsinus",
136
+ keyInverseCosine: "cos, arccosinus",
137
+ keyInverseTangent: "tan, arctangens",
138
+ keyNaturalLog: "ln, natuurlijke logaritme",
139
+ keyCommonLog: "log, logaritme met grondtal tien",
140
+ keyLogBaseN: "Logaritme met gekozen grondtal",
141
+ keyFraction: "Breuk",
142
+ keySquareRoot: "Vierkantswortel",
143
+ keyNthRoot: "N-de wortel",
144
+ keyPower: "Tot de macht",
145
+ keySquared: "Kwadraat",
146
+ keyCubed: "Derde macht",
147
+ keyExponential: "e tot de macht",
148
+ keyAbsoluteValue: "Absolute waarde",
149
+ keyFactorial: "Faculteit",
150
+ keyPi: "Pi",
151
+ keyEuler: "e, getal van Euler",
152
+ keyPercent: "Procent",
153
+ keyOpenParenthesis: "Haakje openen",
154
+ keyCloseParenthesis: "Haakje sluiten",
155
+ keyDecimalSeparator: "Decimaalteken",
156
+ keyDigit: "{digit}",
157
+ keyAdd: "Plus",
158
+ keySubtract: "Min",
159
+ keyMultiply: "Maal",
160
+ keyDivide: "Gedeeld door",
161
+ keyVariableX: "x, variabele x",
162
+ graphExpressions: "Grafiekuitdrukkingen",
163
+ graphExpressionLabel: "Grafiekuitdrukking {index}, {lineStyle} lijn",
164
+ seriesDescription: "Reeks {index}: {lineStyle} lijn",
165
+ showExpression: "Uitdrukking {index} tonen",
166
+ hideExpression: "Uitdrukking {index} verbergen",
167
+ show: "Tonen",
168
+ hide: "Verbergen",
169
+ removeExpression: "Uitdrukking {index} verwijderen",
170
+ remove: "Verwijderen",
171
+ addExpression: "Uitdrukking toevoegen",
172
+ graph: "Grafiek",
173
+ viewportControls: "Grafiekweergave",
174
+ zoomIn: "Inzoomen",
175
+ zoomOut: "Uitzoomen",
176
+ panLeft: "Naar links verschuiven",
177
+ panRight: "Naar rechts verschuiven",
178
+ panUp: "Naar boven verschuiven",
179
+ panDown: "Naar beneden verschuiven",
180
+ resetView: "Weergave herstellen",
181
+ updatingGraph: "Grafiek wordt bijgewerkt",
182
+ graphSummary: "Samenvatting van de grafiek",
183
+ viewportSummary: "Weergave x van {xMin} tot {xMax}, y van {yMin} tot {yMax}.",
184
+ seriesSummary: "Reeks {index}, {lineStyle}: {expression}",
185
+ keyboardGraphTrace: "Grafiek volgen met het toetsenbord",
186
+ keyboardTrace: "Volgen met het toetsenbord",
187
+ series: "Reeks",
188
+ seriesOption: "Reeks {index}",
189
+ previousPoint: "Vorig punt",
190
+ nextPoint: "Volgend punt",
191
+ tracePoint: "x {x}, y {y}",
192
+ noSampledPoint: "Er is geen bemonsterd grafiekpunt beschikbaar.",
193
+ lineStyleSolid: "ononderbroken",
194
+ lineStyleDashed: "gestreepte",
195
+ lineStyleDotted: "gestippelde",
196
+ errorInvalidExpression: "Controleer de uitdrukking en probeer het opnieuw.",
197
+ errorUnsupportedExpression: "Deze uitdrukking is niet beschikbaar in deze rekenmachine.",
198
+ errorExpressionTooComplex: "Vereenvoudig de uitdrukking en probeer het opnieuw.",
199
+ errorEvaluationTimeout: "De berekening duurde te lang en is gestopt.",
200
+ errorInvalidState: "De opgeslagen rekenmachinestatus kon niet worden hersteld.",
201
+ errorWorkerUnavailable: "De rekenmachine is tijdelijk niet beschikbaar."
202
+ }, v = {
203
+ "invalid-expression": "errorInvalidExpression",
204
+ "unsupported-expression": "errorUnsupportedExpression",
205
+ "expression-too-complex": "errorExpressionTooComplex",
206
+ "evaluation-timeout": "errorEvaluationTimeout",
207
+ "invalid-state": "errorInvalidState",
208
+ "worker-unavailable": "errorWorkerUnavailable"
209
+ }, x = {
210
+ solid: "lineStyleSolid",
211
+ dashed: "lineStyleDashed",
212
+ dotted: "lineStyleDotted"
213
+ }, f = /* @__PURE__ */ new Set([
214
+ "ar",
215
+ "ckb",
216
+ "dv",
217
+ "fa",
218
+ "he",
219
+ "iw",
220
+ "ks",
221
+ "ku",
222
+ "nqo",
223
+ "ps",
224
+ "sd",
225
+ "syr",
226
+ "ug",
227
+ "ur",
228
+ "yi"
229
+ ]);
230
+ function b(e) {
231
+ try {
232
+ return new Intl.Locale(e.replaceAll("_", "-")).language.toLowerCase();
233
+ } catch {
234
+ return e.replaceAll("_", "-").split("-")[0]?.toLowerCase() ?? "en";
235
+ }
236
+ }
237
+ function S(e) {
238
+ try {
239
+ return new Intl.NumberFormat(e).format(1.1).includes(",") ? "," : ".";
240
+ } catch {
241
+ return ".";
242
+ }
243
+ }
244
+ function w(e) {
245
+ try {
246
+ const r = new Intl.Locale(e.replaceAll("_", "-")).textInfo;
247
+ if (r?.direction === "rtl" || r?.direction === "ltr") return r.direction;
248
+ } catch {
249
+ }
250
+ return f.has(b(e)) ? "rtl" : "ltr";
251
+ }
252
+ function E(e) {
253
+ return b(e) === "nl" ? m : h;
254
+ }
255
+ function M(e, r) {
256
+ return e.replace(/\{([a-zA-Z][a-zA-Z0-9]*)\}/g, (n, t) => Object.hasOwn(r, t) ? String(r[t]) : n);
257
+ }
258
+ function C(e, r = {}, n = "auto") {
259
+ const t = Object.freeze({
260
+ ...E(e),
261
+ ...r
262
+ }), o = n === "auto" ? w(e) : n, s = S(e);
263
+ let u = null, c = 0;
264
+ const l = (i, d = {}) => M(t[i], d);
265
+ return Object.freeze({
266
+ locale: e,
267
+ direction: o,
268
+ messages: t,
269
+ t: l,
270
+ formatNumber(i, d = 6) {
271
+ try {
272
+ return (!u || c !== d) && (c = d, u = new Intl.NumberFormat(e, {
273
+ maximumSignificantDigits: d,
274
+ useGrouping: !1
275
+ })), u.format(i);
276
+ } catch {
277
+ return i.toPrecision(d);
278
+ }
279
+ },
280
+ formatResult(i) {
281
+ return s === "." ? i : i.replace(".", s);
282
+ },
283
+ errorMessage(i) {
284
+ return l(v[i]);
285
+ },
286
+ lineStyle(i) {
287
+ return l(x[i]);
288
+ }
289
+ });
290
+ }
291
+ var G = h, A = m, R = 1024, P = {
292
+ xMin: -10,
293
+ xMax: 10,
294
+ yMin: -10,
295
+ yMax: 10
296
+ }, L = ["square-root"], k = [
297
+ "square-root",
298
+ "power",
299
+ "root",
300
+ "exponential",
301
+ "natural-log",
302
+ "common-log",
303
+ "log-base-n",
304
+ "sine",
305
+ "cosine",
306
+ "tangent",
307
+ "inverse-sine",
308
+ "inverse-cosine",
309
+ "inverse-tangent",
310
+ "absolute-value",
311
+ "factorial"
312
+ ];
313
+ function a(e) {
314
+ throw new g("invalid-state", e);
315
+ }
316
+ function p(e, r, n, t, o) {
317
+ return e === void 0 ? r : ((!Number.isInteger(e) || e < n || e > t) && a(`${o} must be an integer from ${n} to ${t}.`), e);
318
+ }
319
+ function T(e) {
320
+ if (e === void 0) return { ...P };
321
+ (!e || typeof e != "object") && a("Graph viewport must be an object.");
322
+ const r = e;
323
+ return [
324
+ r.xMin,
325
+ r.xMax,
326
+ r.yMin,
327
+ r.yMax
328
+ ].every((n) => typeof n == "number" && Number.isFinite(n)) || a("Graph viewport bounds must be finite numbers."), (r.xMin >= r.xMax || r.yMin >= r.yMax) && a("Graph viewport minimums must be less than maximums."), r;
329
+ }
330
+ function D(e, r) {
331
+ const n = e === "basic" ? L : k;
332
+ if (r === void 0) return new Set(n);
333
+ (!Array.isArray(r) || !r.every((s) => typeof s == "string")) && a("allowedFunctions must be an array of function identifiers.");
334
+ const t = new Set(k);
335
+ for (const s of r) t.has(s) || a(`Unknown calculator function: ${s}.`);
336
+ const o = new Set(r);
337
+ return new Set(n.filter((s) => o.has(s)));
338
+ }
339
+ function y(e, r, n) {
340
+ return e === void 0 ? r : (typeof e != "boolean" && a(`${n} must be a boolean.`), e);
341
+ }
342
+ function I(e) {
343
+ if (e === void 0) return {};
344
+ (!e || typeof e != "object" || Array.isArray(e)) && a("messages must be an object.");
345
+ const r = {};
346
+ for (const [n, t] of Object.entries(e))
347
+ Object.hasOwn(G, n) && (typeof t != "string" && a(`messages.${n} must be a string.`), r[n] = t);
348
+ return r;
349
+ }
350
+ function j(e, r = {}) {
351
+ const n = r.settings ?? {}, t = n.angleMode ?? "degree";
352
+ t !== "degree" && t !== "radian" && a('angleMode must be "degree" or "radian".');
353
+ const o = n.graph;
354
+ o !== void 0 && (!o || typeof o != "object") && a("graph settings must be an object.");
355
+ const s = r.restrictedMode === !0, u = typeof r.locale == "string" && r.locale.trim() ? r.locale.trim() : "en-US", c = r.theme ?? "auto";
356
+ c !== "light" && c !== "dark" && c !== "auto" && a('theme must be "light", "dark", or "auto".');
357
+ const l = n.direction ?? "auto";
358
+ l !== "ltr" && l !== "rtl" && l !== "auto" && a('direction must be "ltr", "rtl", or "auto".');
359
+ const i = C(u, I(n.messages), l);
360
+ return Object.freeze({
361
+ type: e,
362
+ angleMode: t,
363
+ calculationPrecision: p(n.calculationPrecision, 15, 1, 21, "calculationPrecision"),
364
+ displayPrecision: p(n.displayPrecision, 10, 1, 12, "displayPrecision"),
365
+ historyLimit: p(n.historyLimit, 20, 0, 50, "historyLimit"),
366
+ evaluationTimeLimitMs: p(n.evaluationTimeLimitMs, 1e3, 100, 2e3, "evaluationTimeLimitMs"),
367
+ allowedFunctions: D(e, n.allowedFunctions),
368
+ allowClipboard: !s && y(n.allowClipboard, !0, "allowClipboard"),
369
+ restrictedMode: s,
370
+ locale: u,
371
+ theme: c,
372
+ localization: i,
373
+ graph: Object.freeze({
374
+ viewport: T(o?.viewport),
375
+ showAxes: y(o?.showAxes, !0, "graph.showAxes"),
376
+ showGrid: y(o?.showGrid, !0, "graph.showGrid")
377
+ })
378
+ });
379
+ }
380
+ export {
381
+ S as a,
382
+ N as c,
383
+ G as i,
384
+ j as n,
385
+ w as o,
386
+ A as r,
387
+ g as s,
388
+ R as t
389
+ };