@magmacomputing/tempo-plugin-geo 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3262 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __esm = (fn, res, err) => function __init() {
6
+ if (err) throw err[0];
7
+ try {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ } catch (e) {
10
+ throw err = [e], e;
11
+ }
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
+
27
+ // ../../library/dist/common/primitives/symbol.library.js
28
+ var $Target, $Discover, $Extensible, $Inspect, $LogConfig, $Registry, $Register, $SerializerRegistry, $Mutable, $Identity, $Unwrapped, sym;
29
+ var init_symbol_library = __esm({
30
+ "../../library/dist/common/primitives/symbol.library.js"() {
31
+ "use strict";
32
+ $Target = /* @__PURE__ */ Symbol.for("$LibraryTarget");
33
+ $Discover = /* @__PURE__ */ Symbol.for("$LibraryDiscover");
34
+ $Extensible = /* @__PURE__ */ Symbol.for("$LibraryExtensible");
35
+ $Inspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
36
+ $LogConfig = /* @__PURE__ */ Symbol.for("$LibraryLogConfig");
37
+ $Registry = /* @__PURE__ */ Symbol.for("$LibraryRegistry");
38
+ $Register = /* @__PURE__ */ Symbol.for("$LibraryRegister");
39
+ $SerializerRegistry = /* @__PURE__ */ Symbol.for("$LibrarySerializerRegistry");
40
+ $Mutable = /* @__PURE__ */ Symbol.for("$LibraryMutable");
41
+ $Identity = /* @__PURE__ */ Symbol.for("$LibraryIdentity");
42
+ $Unwrapped = /* @__PURE__ */ Symbol.for("$LibraryUnwrapped");
43
+ sym = {
44
+ $Target,
45
+ $Discover,
46
+ $Extensible,
47
+ $Inspect,
48
+ $LogConfig,
49
+ $Registry,
50
+ $Register,
51
+ $SerializerRegistry,
52
+ $Identity,
53
+ $Mutable,
54
+ $Unwrapped
55
+ };
56
+ }
57
+ });
58
+
59
+ // ../../library/dist/common/primitives/primitive.library.js
60
+ function unwrap(obj) {
61
+ let curr = obj;
62
+ let depth = 0;
63
+ const maxDepth = 50;
64
+ while (curr) {
65
+ const next = curr[sym.$Target];
66
+ if (!next || depth >= maxDepth)
67
+ break;
68
+ curr = next;
69
+ depth++;
70
+ }
71
+ return curr;
72
+ }
73
+ function ownEntries(json, all = false) {
74
+ if (!json || typeof json !== "object")
75
+ return [];
76
+ const tgt = unwrap(json);
77
+ if (!all) {
78
+ const keys = Reflect.ownKeys(tgt);
79
+ const entries2 = [];
80
+ for (const k of keys) {
81
+ const desc = Object.getOwnPropertyDescriptor(tgt, k);
82
+ if (desc && desc.enumerable)
83
+ entries2.push([k, tgt[k]]);
84
+ }
85
+ return entries2;
86
+ }
87
+ const levels = [];
88
+ const limit = 50;
89
+ let depth = 0;
90
+ let curr = tgt;
91
+ while (curr && curr !== Object.prototype && depth++ < limit) {
92
+ levels.push(unwrap(curr));
93
+ curr = Object.getPrototypeOf(curr);
94
+ }
95
+ const entries = [];
96
+ const seen = /* @__PURE__ */ new Set();
97
+ for (const level of levels.reverse()) {
98
+ const keys = Reflect.ownKeys(level);
99
+ for (const k of keys) {
100
+ if (seen.has(k))
101
+ continue;
102
+ const desc = Object.getOwnPropertyDescriptor(level, k);
103
+ if (!desc || !desc.enumerable)
104
+ continue;
105
+ seen.add(k);
106
+ entries.push([k, tgt[k]]);
107
+ }
108
+ }
109
+ return entries;
110
+ }
111
+ function ownKeys(json, all = false) {
112
+ return ownEntries(json, all).map(([key]) => key);
113
+ }
114
+ function ownValues(json, all = false) {
115
+ return ownEntries(json, all).map(([_, value2]) => value2);
116
+ }
117
+ function distinct(arr, mapfn, thisArg) {
118
+ return mapfn ? distinct(arr.map(mapfn, thisArg)) : Array.from(new Set(arr));
119
+ }
120
+ var init_primitive_library = __esm({
121
+ "../../library/dist/common/primitives/primitive.library.js"() {
122
+ "use strict";
123
+ init_symbol_library();
124
+ }
125
+ });
126
+
127
+ // ../../library/dist/common/primitives/type.library.js
128
+ var registry, protoType, getSafeTag, getType, asType, classRegex, isClassConstructor, registerType;
129
+ var init_type_library = __esm({
130
+ "../../library/dist/common/primitives/type.library.js"() {
131
+ "use strict";
132
+ init_symbol_library();
133
+ init_primitive_library();
134
+ registry = [];
135
+ protoType = (obj) => {
136
+ if (obj === null)
137
+ return "Null";
138
+ if (obj === void 0)
139
+ return "Undefined";
140
+ const t = typeof obj;
141
+ if (t === "string")
142
+ return "String";
143
+ if (t === "number")
144
+ return "Number";
145
+ if (t === "boolean")
146
+ return "Boolean";
147
+ if (t === "bigint")
148
+ return "BigInt";
149
+ if (t === "symbol")
150
+ return "Symbol";
151
+ try {
152
+ const raw = t === "object" ? unwrap(obj) : obj;
153
+ return Object.prototype.toString.call(raw).slice(8, -1);
154
+ } catch {
155
+ return t === "function" ? "Function" : "Object";
156
+ }
157
+ };
158
+ getSafeTag = (obj) => {
159
+ try {
160
+ const tag2 = obj?.[Symbol.toStringTag] ?? obj?.prototype?.[Symbol.toStringTag];
161
+ if (typeof tag2 === "string")
162
+ return tag2;
163
+ } catch {
164
+ }
165
+ return void 0;
166
+ };
167
+ getType = (obj, ...instances) => {
168
+ let raw = obj;
169
+ try {
170
+ raw = obj?.[sym.$Target] ?? obj;
171
+ } catch {
172
+ raw = obj;
173
+ }
174
+ const type = protoType(raw);
175
+ switch (type) {
176
+ case "Function":
177
+ try {
178
+ return isClassConstructor(raw) ? "Class" : "Function";
179
+ } catch {
180
+ return "Function";
181
+ }
182
+ case "Object": {
183
+ try {
184
+ if ("length" in raw && Object.keys(raw).every((key) => key === "length" || Number.isFinite(Number(key))))
185
+ return "ArrayLike";
186
+ for (const inst of instances) {
187
+ const instRaw = inst.class?.[sym.$Target] ?? inst.class;
188
+ if (raw === instRaw || instRaw && raw instanceof instRaw)
189
+ return inst.type;
190
+ }
191
+ const globalRegistry = globalThis[sym.$Registry] ?? [];
192
+ for (const inst of [...registry, ...globalRegistry]) {
193
+ const instRaw = inst.class?.[sym.$Target] ?? inst.class;
194
+ if (raw === instRaw || instRaw && raw instanceof instRaw)
195
+ return inst.type;
196
+ }
197
+ } catch {
198
+ return "Object";
199
+ }
200
+ return "Object";
201
+ }
202
+ default:
203
+ return type;
204
+ }
205
+ };
206
+ asType = (value2, ...instances) => ({ type: getType(value2, ...instances), value: value2 });
207
+ classRegex = /^\s*(class\s|\[native code\])/;
208
+ isClassConstructor = (obj) => {
209
+ if (typeof obj !== "function")
210
+ return false;
211
+ const raw = obj?.[sym.$Target] ?? obj;
212
+ if (!("prototype" in raw))
213
+ return false;
214
+ const name = raw?.name;
215
+ const tag2 = getSafeTag(raw);
216
+ if (raw?.[sym.$Identity] || raw?.prototype?.[sym.$Identity]) {
217
+ return true;
218
+ }
219
+ if (typeof tag2 === "string" && tag2.startsWith("Temporal.")) {
220
+ return true;
221
+ }
222
+ if (typeof tag2 === "string" && tag2.endsWith("Function"))
223
+ return false;
224
+ const globalRegistry = globalThis[sym.$Registry] ?? [];
225
+ if (globalRegistry.some((inst) => (inst.class?.[sym.$Target] ?? inst.class) === raw || name && inst.type === name || tag2 && inst.type === tag2)) {
226
+ return true;
227
+ }
228
+ try {
229
+ const str = Function.prototype.toString.call(raw);
230
+ if (classRegex.test(str)) {
231
+ return true;
232
+ }
233
+ const descriptor = Object.getOwnPropertyDescriptor(raw, "prototype");
234
+ if (descriptor && descriptor.writable === false && !Object.isFrozen(raw)) {
235
+ return true;
236
+ }
237
+ const proto = raw.prototype;
238
+ if (proto && Object.getOwnPropertyNames(proto).length > 2) {
239
+ return true;
240
+ }
241
+ } catch {
242
+ return false;
243
+ }
244
+ return false;
245
+ };
246
+ registerType = (cls, type) => {
247
+ if (typeof cls !== "function")
248
+ return;
249
+ const tag2 = getSafeTag(cls);
250
+ const name = type ?? tag2 ?? cls.name;
251
+ if (name && !["Object", "Function", ""].includes(name)) {
252
+ if (!registry.some((inst) => inst.class === cls))
253
+ registry.push({ class: cls, type: name });
254
+ }
255
+ };
256
+ }
257
+ });
258
+
259
+ // ../../library/dist/common/primitives/assertion.library.js
260
+ function isNumeric(str) {
261
+ const type = typeof str;
262
+ switch (type) {
263
+ case "number":
264
+ return Number.isFinite(str);
265
+ case "bigint":
266
+ return true;
267
+ case "string": {
268
+ const val = str.trim();
269
+ if (val.length === 0)
270
+ return false;
271
+ return RE_BIGINT_LITERAL.test(val) || isNumber(Number(val));
272
+ }
273
+ default:
274
+ return false;
275
+ }
276
+ }
277
+ var isType, isPrimitive, isReference, isIterable, isString, isText, isNumber, RE_BIGINT_LITERAL, isInteger, isArray, isArrayLike, isObject, isDate, isRegExp, isSymbol, isSymbolFor, isSafeKey, isNullish, isUndefined, isDefined, isFunction, isCallable, isMap, isSet, isError, isLocale, isEmpty;
278
+ var init_assertion_library = __esm({
279
+ "../../library/dist/common/primitives/assertion.library.js"() {
280
+ "use strict";
281
+ init_symbol_library();
282
+ init_type_library();
283
+ isType = (obj, ...types) => types.includes(getType(obj));
284
+ isPrimitive = (obj) => obj === null || typeof obj !== "object" && typeof obj !== "function";
285
+ isReference = (obj) => !isPrimitive(obj);
286
+ isIterable = (obj) => Symbol.iterator in Object(obj) && !isString(obj);
287
+ isString = (obj) => typeof obj === "string";
288
+ isText = (obj) => typeof obj === "string" && obj.trim().length > 0;
289
+ isNumber = (obj) => Number.isFinite(obj);
290
+ RE_BIGINT_LITERAL = /^[+-]?[0-9]+n$/;
291
+ isInteger = (obj) => typeof obj === "bigint";
292
+ isArray = (obj) => Array.isArray(obj);
293
+ isArrayLike = (obj) => protoType(obj) === "Object" && "length" in obj && Object.keys(obj).every((key) => key === "length" || isNumber(Number(key)));
294
+ isObject = (obj) => isType(obj, "Object");
295
+ isDate = (obj) => isType(obj, "Date");
296
+ isRegExp = (obj) => isType(obj, "RegExp");
297
+ isSymbol = (obj) => typeof obj === "symbol";
298
+ isSymbolFor = (obj) => typeof obj === "symbol" && Symbol.keyFor(obj) !== void 0;
299
+ isSafeKey = (key) => key !== "__proto__" && key !== "constructor" && key !== "prototype";
300
+ isNullish = (obj) => obj === null || obj === void 0 || isType(obj, "Void", "Empty");
301
+ isUndefined = (obj) => obj === void 0 || isType(obj, "Void", "Empty");
302
+ isDefined = (obj) => obj !== null && obj !== void 0 && !isNullish(obj);
303
+ isFunction = (obj) => isType(obj, "Function", "AsyncFunction", "GeneratorFunction", "AsyncGeneratorFunction");
304
+ isCallable = (obj) => typeof obj === "function";
305
+ isMap = (obj) => isType(obj, "Map");
306
+ isSet = (obj) => isType(obj, "Set");
307
+ isError = (err, constructor) => isType(err, "Error") && (constructor ? err instanceof constructor : true);
308
+ isLocale = (obj) => typeof Intl !== "undefined" && typeof Intl.Locale === "function" && obj instanceof Intl.Locale;
309
+ isEmpty = (obj) => isNullish(obj) || isObject(obj) && Reflect.ownKeys(obj).length === 0 || isString(obj) && obj.trim().length === 0 || typeof obj === "number" && Number.isNaN(obj) || isArray(obj) && obj.length === 0 || isSet(obj) && obj.size === 0 || isMap(obj) && obj.size === 0 || ArrayBuffer.isView(obj) && obj.byteLength === 0 || isDate(obj) && Number.isNaN(obj.getTime());
310
+ }
311
+ });
312
+
313
+ // ../../library/dist/common/runtime/utility.library.js
314
+ function deepFreeze(obj, options, seen = /* @__PURE__ */ new WeakSet()) {
315
+ const skip = options instanceof WeakSet ? options : options?.skip ?? EMPTY_SKIP;
316
+ if (isPrimitive(obj) || seen.has(obj) || skip.has(obj))
317
+ return obj;
318
+ if (obj instanceof Date || obj instanceof RegExp || obj instanceof Error || obj instanceof Map || obj instanceof Set || obj instanceof Promise)
319
+ return obj;
320
+ if (obj?.[Symbol.toStringTag] === "Enumify")
321
+ return obj;
322
+ if (obj[sym.$Extensible])
323
+ return obj;
324
+ seen.add(obj);
325
+ ownEntries(obj).forEach(([key, val]) => {
326
+ if (isSafeKey(key))
327
+ deepFreeze(val, { skip }, seen);
328
+ });
329
+ return Object.freeze(obj);
330
+ }
331
+ var CONTEXT, getContext, EMPTY_SKIP;
332
+ var init_utility_library = __esm({
333
+ "../../library/dist/common/runtime/utility.library.js"() {
334
+ "use strict";
335
+ init_primitive_library();
336
+ init_assertion_library();
337
+ init_symbol_library();
338
+ CONTEXT = {
339
+ "Unknown": "unknown",
340
+ "Browser": "browser",
341
+ "WebWorker": "web-worker",
342
+ "NodeJS": "nodejs",
343
+ "Deno": "deno",
344
+ "GoogleAppsScript": "google-apps-script"
345
+ };
346
+ getContext = () => {
347
+ const global = globalThis;
348
+ try {
349
+ if (isDefined(global.SpreadsheetApp))
350
+ return { global, type: CONTEXT.GoogleAppsScript };
351
+ if (isDefined(global.window?.document))
352
+ return { global, type: CONTEXT.Browser };
353
+ if (isFunction(global.importScripts) || isDefined(global.WorkerGlobalScope) && global instanceof global.WorkerGlobalScope)
354
+ return { global, type: CONTEXT.WebWorker };
355
+ if (isDefined(global.Deno))
356
+ return { global, type: CONTEXT.Deno };
357
+ if (isDefined(global.process?.versions?.node) && global.process?.release?.name === "node")
358
+ return { global, type: CONTEXT.NodeJS };
359
+ } catch {
360
+ }
361
+ return { global, type: CONTEXT.Unknown };
362
+ };
363
+ EMPTY_SKIP = /* @__PURE__ */ new WeakSet();
364
+ }
365
+ });
366
+
367
+ // ../../library/dist/common/runtime/reflection.library.js
368
+ function allObject(json) {
369
+ return Object.fromEntries(ownEntries(json, true));
370
+ }
371
+ var init_reflection_library = __esm({
372
+ "../../library/dist/common/runtime/reflection.library.js"() {
373
+ "use strict";
374
+ init_primitive_library();
375
+ init_type_library();
376
+ init_assertion_library();
377
+ }
378
+ });
379
+
380
+ // ../../library/dist/common/runtime/proxy.library.js
381
+ function factory(target, options = {}, isRevocable = false) {
382
+ const { frozen, lock, appendOnly, onGet, keys, bind, skip } = options;
383
+ const pending = /* @__PURE__ */ new Set();
384
+ let cachedJSON;
385
+ let result;
386
+ const tgt = unwrap(target);
387
+ if (lock)
388
+ deepFreeze(tgt, skip ? { skip } : void 0);
389
+ registerType(tgt);
390
+ const handler = {
391
+ isExtensible: (t) => Reflect.isExtensible(t),
392
+ getPrototypeOf: (t) => Reflect.getPrototypeOf(t),
393
+ setPrototypeOf: (t, proto) => {
394
+ if (frozen)
395
+ throw new TypeError("Security: Prototype mutation attempt on protected object");
396
+ return Reflect.setPrototypeOf(t, proto);
397
+ },
398
+ getOwnPropertyDescriptor: (t, k) => {
399
+ if (keys && !keys.includes(k))
400
+ return void 0;
401
+ if (keys) {
402
+ if (onGet && !isSymbol(k) && !pending.has(k)) {
403
+ pending.add(k);
404
+ try {
405
+ const value2 = onGet(k, t);
406
+ if (isDefined(value2))
407
+ return { enumerable: true, configurable: true, value: value2 };
408
+ } finally {
409
+ pending.delete(k);
410
+ }
411
+ }
412
+ return { enumerable: true, configurable: true };
413
+ }
414
+ return Reflect.getOwnPropertyDescriptor(t, k);
415
+ },
416
+ ownKeys: (t) => {
417
+ if (keys)
418
+ return keys;
419
+ if (onGet && !pending.has(sym.$Discover)) {
420
+ pending.add(sym.$Discover);
421
+ try {
422
+ onGet(sym.$Discover, t);
423
+ } finally {
424
+ pending.delete(sym.$Discover);
425
+ }
426
+ }
427
+ return Reflect.ownKeys(t);
428
+ },
429
+ has: (t, k) => keys ? keys.includes(k) : Reflect.has(t, k),
430
+ deleteProperty: (t, k) => {
431
+ if (frozen)
432
+ throw new TypeError(`Cannot delete property '${String(k)}' from a protected object.`);
433
+ if (appendOnly && Reflect.has(t, k))
434
+ throw new Error(`Security: Deletion attempt on protected key '${String(k)}'`);
435
+ return Reflect.deleteProperty(t, k);
436
+ },
437
+ defineProperty: (t, k, d) => {
438
+ if (frozen && !Object.isFrozen(t))
439
+ throw new TypeError(`Cannot define property '${String(k)}' on a frozen object.`);
440
+ if (appendOnly && Reflect.has(t, k))
441
+ throw new Error(`Security: Mutation attempt on protected key '${String(k)}'`);
442
+ return Reflect.defineProperty(t, k, d);
443
+ },
444
+ set: (t, k, v, r) => {
445
+ if (frozen && r === result)
446
+ throw new TypeError(`Cannot set property '${String(k)}' on a frozen object.`);
447
+ if (appendOnly) {
448
+ const isTruncating = Array.isArray(t) && k === "length" && v < t.length;
449
+ if (isTruncating)
450
+ throw new Error("Security: Truncation attempt on protected array.");
451
+ if (!(Array.isArray(t) && k === "length") && Reflect.has(t, k))
452
+ throw new Error(`Security: Mutation attempt on protected key '${String(k)}'`);
453
+ }
454
+ return Reflect.set(t, k, v, r);
455
+ },
456
+ get: (t, k, r) => {
457
+ if (k === sym.$Target)
458
+ return r === result ? t : void 0;
459
+ if (frozen && (k === sym.$Inspect || k === "toJSON")) {
460
+ const own = Object.getOwnPropertyDescriptor(t, k);
461
+ if (own && isFunction(own.value))
462
+ return own.value;
463
+ if (!cachedJSON)
464
+ cachedJSON = () => allObject(t);
465
+ return cachedJSON;
466
+ }
467
+ if (keys && !keys.includes(k))
468
+ return void 0;
469
+ if (onGet && !isSymbol(k) && !Reflect.has(t, k) && !pending.has(k)) {
470
+ pending.add(k);
471
+ try {
472
+ const val2 = onGet(k, t);
473
+ if (isDefined(val2))
474
+ return val2;
475
+ } finally {
476
+ pending.delete(k);
477
+ }
478
+ }
479
+ const val = Reflect.get(t, k, r);
480
+ if (bind && k !== "constructor" && isFunction(val)) {
481
+ const desc = Object.getOwnPropertyDescriptor(t, k);
482
+ if (desc && !desc.configurable && !desc.writable)
483
+ return val;
484
+ let perTargetCache = boundMethodCache.get(val);
485
+ if (!perTargetCache) {
486
+ perTargetCache = /* @__PURE__ */ new WeakMap();
487
+ boundMethodCache.set(val, perTargetCache);
488
+ }
489
+ const cachedBound = perTargetCache.get(t);
490
+ if (cachedBound)
491
+ return cachedBound;
492
+ const bound = val.bind(t);
493
+ perTargetCache.set(t, bound);
494
+ return bound;
495
+ }
496
+ return val;
497
+ }
498
+ };
499
+ if (isRevocable) {
500
+ const revocableResult = Proxy.revocable(tgt, handler);
501
+ result = revocableResult.proxy;
502
+ return { proxy: revocableResult.proxy, revoke: revocableResult.revoke };
503
+ }
504
+ result = new Proxy(tgt, handler);
505
+ return result;
506
+ }
507
+ function proxify(target, frozen = true, lock = frozen, skip = /* @__PURE__ */ new WeakSet()) {
508
+ return factory(target, { frozen, lock, skip, bind: frozen });
509
+ }
510
+ function secure(obj, skip = /* @__PURE__ */ new WeakSet()) {
511
+ return factory(obj, { frozen: true, lock: true, skip, bind: true });
512
+ }
513
+ var boundMethodCache;
514
+ var init_proxy_library = __esm({
515
+ "../../library/dist/common/runtime/proxy.library.js"() {
516
+ "use strict";
517
+ init_symbol_library();
518
+ init_reflection_library();
519
+ init_utility_library();
520
+ init_primitive_library();
521
+ init_assertion_library();
522
+ init_type_library();
523
+ boundMethodCache = /* @__PURE__ */ new WeakMap();
524
+ }
525
+ });
526
+
527
+ // ../../library/dist/common/runtime/function.library.js
528
+ function serialize(val, seen = /* @__PURE__ */ new WeakSet()) {
529
+ return JSON.stringify(val, function(key, value2) {
530
+ if (value2 === void 0)
531
+ return "\0__undefined__\0";
532
+ if (isInteger(value2))
533
+ return `\0__bigint:${value2}__\0`;
534
+ if (isFunction(value2))
535
+ return `function:${value2.name || "anonymous"}`;
536
+ if (isReference(value2)) {
537
+ if (seen.has(value2))
538
+ return "<Circular>";
539
+ seen.add(value2);
540
+ if (isLocale(value2))
541
+ return value2.toString();
542
+ if (isMap(value2))
543
+ return `map:[${Array.from(value2.entries()).map((e) => serialize(e, seen)).sort().join(",")}]`;
544
+ if (isSet(value2))
545
+ return `set:[${Array.from(value2).map((v) => serialize(v, seen)).sort().join(",")}]`;
546
+ }
547
+ return value2;
548
+ });
549
+ }
550
+ function curry(fn) {
551
+ return function curried(...args) {
552
+ return args.length >= fn.length ? fn(...args) : (...nextArgs) => curried(...args, ...nextArgs);
553
+ };
554
+ }
555
+ function memoizeFunction(fn) {
556
+ const cache = /* @__PURE__ */ new Map();
557
+ return function(...args) {
558
+ const key = this !== void 0 && this !== globalThis ? serialize([this, ...args]) : serialize(args);
559
+ if (!cache.has(key)) {
560
+ const result = fn.apply(this, args);
561
+ cache.set(key, result);
562
+ }
563
+ return cache.get(key);
564
+ };
565
+ }
566
+ function memoizeMethod(name, fn) {
567
+ return {
568
+ enumerable: false,
569
+ configurable: false,
570
+ writable: false,
571
+ value: function(...args) {
572
+ const key = `${String(name)},${serialize(args)}`;
573
+ let cache = wm.get(this);
574
+ if (!cache) {
575
+ cache = /* @__PURE__ */ new Map();
576
+ wm.set(this, cache);
577
+ }
578
+ if (!cache.has(key)) {
579
+ const result = fn.apply(this, args);
580
+ secure(result);
581
+ cache.set(key, result);
582
+ }
583
+ return cache.get(key);
584
+ }
585
+ };
586
+ }
587
+ var wm;
588
+ var init_function_library = __esm({
589
+ "../../library/dist/common/runtime/function.library.js"() {
590
+ "use strict";
591
+ init_proxy_library();
592
+ init_assertion_library();
593
+ wm = /* @__PURE__ */ new WeakMap();
594
+ }
595
+ });
596
+
597
+ // ../../library/dist/common/runtime/json.library.js
598
+ function cleanify(obj) {
599
+ try {
600
+ return JSON.parse(JSON.stringify(obj));
601
+ } catch (error) {
602
+ console.warn("Could not clean object:", error?.message ?? error);
603
+ throw error;
604
+ }
605
+ }
606
+ var init_json_library = __esm({
607
+ "../../library/dist/common/runtime/json.library.js"() {
608
+ "use strict";
609
+ init_assertion_library();
610
+ }
611
+ });
612
+
613
+ // ../../library/dist/common/primitives/object.library.js
614
+ function looseIndex(arg) {
615
+ if (isDefined(arg))
616
+ return isFunction(arg) ? arg() : arg;
617
+ return (obj) => isFunction(obj) ? obj() : obj;
618
+ }
619
+ var getObjectKeys, asObject;
620
+ var init_object_library = __esm({
621
+ "../../library/dist/common/primitives/object.library.js"() {
622
+ "use strict";
623
+ init_primitive_library();
624
+ init_assertion_library();
625
+ init_type_library();
626
+ getObjectKeys = (obj) => {
627
+ const keys = /* @__PURE__ */ new Set();
628
+ let curr = obj;
629
+ let depth = 0;
630
+ while (curr && curr !== Object.prototype && depth++ < 10) {
631
+ const descs = Object.getOwnPropertyDescriptors(curr);
632
+ for (const [key, desc] of Object.entries(descs)) {
633
+ if (!isSafeKey(key))
634
+ continue;
635
+ if (desc.enumerable || isFunction(desc.get)) {
636
+ keys.add(key);
637
+ }
638
+ }
639
+ curr = Object.getPrototypeOf(curr);
640
+ }
641
+ return Array.from(keys);
642
+ };
643
+ asObject = (obj) => {
644
+ if (isPrimitive(obj) || isFunction(obj))
645
+ return obj;
646
+ if (isArray(obj))
647
+ return obj.map((item) => asObject(item));
648
+ if (isDate(obj) || isRegExp(obj) || isMap(obj) || isSet(obj))
649
+ return obj;
650
+ try {
651
+ if (isFunction(obj.toJSON))
652
+ return asObject(obj.toJSON());
653
+ } catch {
654
+ }
655
+ const temp = {};
656
+ for (const key of getObjectKeys(obj)) {
657
+ try {
658
+ temp[key] = asObject(obj[key]);
659
+ } catch {
660
+ }
661
+ }
662
+ return temp;
663
+ };
664
+ looseIndex.stringSymbol = looseIndex();
665
+ looseIndex.symbolRegExp = looseIndex();
666
+ looseIndex.symbolString = looseIndex();
667
+ looseIndex.stringString = looseIndex();
668
+ }
669
+ });
670
+
671
+ // ../../library/dist/common/runtime/serialize.library.js
672
+ function clone(obj, opts) {
673
+ try {
674
+ return globalThis.structuredClone(obj, opts);
675
+ } catch {
676
+ return cleanify(obj);
677
+ }
678
+ }
679
+ function reviver(_key, val) {
680
+ return decode(val);
681
+ }
682
+ function encode(val) {
683
+ let enc = encodeURI(val);
684
+ if (enc.includes("%"))
685
+ enc = enc.replace(RE_SAFE_URI_CODES, (match) => SAFE_URI_MAP[match.toUpperCase()] ?? decodeURI(match));
686
+ return enc;
687
+ }
688
+ function decode(val) {
689
+ if (isString(val)) {
690
+ try {
691
+ return decodeURI(val);
692
+ } catch (error) {
693
+ }
694
+ }
695
+ return val;
696
+ }
697
+ function isStringable(val) {
698
+ return !isType(val, "Function", "AsyncFunction", "WeakMap", "WeakSet", "WeakRef");
699
+ }
700
+ function oneKey(type, value2) {
701
+ return `{"$${type}":${value2}}`;
702
+ }
703
+ function fromSymbol(key) {
704
+ return stringize(isSymbol(key) ? `${isSymbolFor(key) ? "@" : ""}@(${key.description ?? ""})` : key);
705
+ }
706
+ function toSymbol(value2) {
707
+ const [pat, keyFor, desc] = value2.toString().match(symKey) || [null, void 0, void 0];
708
+ switch (true) {
709
+ case isSymbol(value2):
710
+ // already a Symbol
711
+ case isNullish(pat):
712
+ // incorrectly encoded Symbol
713
+ case (isDefined(keyFor) && isUndefined(desc)):
714
+ return value2;
715
+ case isDefined(keyFor):
716
+ return Symbol.for(desc);
717
+ case isUndefined(keyFor):
718
+ // local Symbol
719
+ default:
720
+ return Symbol(desc);
721
+ }
722
+ }
723
+ function stringify(obj, options) {
724
+ const prevCompact = activeCompact;
725
+ activeCompact = options?.compact !== false;
726
+ try {
727
+ const str = stringize(obj, false);
728
+ if (options?.signed) {
729
+ if (!isString(options.secret) || !options.secret)
730
+ throw new TypeError("stringify: signed serialization requires an explicit secret string");
731
+ return `$sig:${fastDigest(str, options.secret)}:${str}`;
732
+ }
733
+ return str;
734
+ } finally {
735
+ activeCompact = prevCompact;
736
+ }
737
+ }
738
+ function stringize(obj, recurse = true) {
739
+ const arg = asType(obj);
740
+ const one = curry(oneKey)(arg.type);
741
+ switch (arg.type) {
742
+ case "String": {
743
+ let strVal = arg.value;
744
+ if (strVal.startsWith("~"))
745
+ strVal = `~${strVal}`;
746
+ if (!recurse) {
747
+ recurse = strVal === "true" || strVal === "false" || strVal === "null" || parseFloat(strVal).toString() === strVal || strVal.startsWith("~");
748
+ }
749
+ return recurse ? JSON.stringify(encode(strVal)) : encode(strVal);
750
+ }
751
+ case "Boolean":
752
+ case "Null":
753
+ case "Number":
754
+ return JSON.stringify(arg.value);
755
+ // JSON.stringify will correctly handle these
756
+ case "Void":
757
+ case "Undefined":
758
+ return activeCompact ? JSON.stringify("~u") : one(JSON.stringify("void"));
759
+ // preserve 'undefined' values
760
+ case "BigInt":
761
+ return activeCompact ? JSON.stringify(`~n${arg.value.toString()}`) : one(arg.value.toString());
762
+ // even though BigInt has a toString method, it is not supported in JSON.stringify
763
+ case "Date":
764
+ return activeCompact ? JSON.stringify(`~t${arg.value.getTime()}`) : one(stringize(arg.value.toJSON()));
765
+ case "Object": {
766
+ const obj2 = ownEntries(arg.value).filter(([, val]) => isStringable(val)).map(([key, val]) => `${fromSymbol(key)}: ${stringize(val)}`).join(",");
767
+ return `{${obj2}}`;
768
+ }
769
+ case "Array": {
770
+ const arr = arg.value.filter((val) => isStringable(val)).map((val) => stringize(val)).join(",");
771
+ return `[${arr}]`;
772
+ }
773
+ case "Map": {
774
+ const map = Array.from(arg.value.entries()).filter(([, val]) => isStringable(val)).map(([key, val]) => `[${stringize(key)}, ${stringize(val)}]`).join(",");
775
+ return one(`[${map}]`);
776
+ }
777
+ case "Set": {
778
+ const set = Array.from(arg.value.values()).filter((val) => isStringable(val)).map((val) => stringize(val)).join(",");
779
+ return one(`[${set}]`);
780
+ }
781
+ case "Symbol": {
782
+ const symStr = `${isSymbolFor(arg.value) ? "@" : ""}@(${arg.value.description ?? ""})`;
783
+ return activeCompact ? JSON.stringify(`~y${symStr}`) : one(JSON.stringify(symStr));
784
+ }
785
+ case "RegExp":
786
+ return one(stringize({ source: arg.value.source, flags: arg.value.flags }));
787
+ case "Class":
788
+ default: {
789
+ const value2 = arg.value;
790
+ switch (true) {
791
+ case !isStringable(value2):
792
+ return void 0;
793
+ case isFunction(value2.toJSON):
794
+ return one(stringize(value2.toJSON()));
795
+ case (isFunction(value2.toString) && value2.toString !== Object.prototype.toString): {
796
+ const str = value2.toString();
797
+ return one(str.includes('"') ? str : JSON.stringify(str));
798
+ }
799
+ case (isFunction(value2.valueOf) && value2.valueOf !== Object.prototype.valueOf):
800
+ return one(JSON.stringify(value2.valueOf()));
801
+ default: {
802
+ const plain = asObject(value2);
803
+ return isReference(plain) && Object.keys(plain).length > 0 ? stringize(plain) : one(JSON.stringify(value2, (key, o) => isEmpty(key) ? o : stringize(o)));
804
+ }
805
+ }
806
+ }
807
+ }
808
+ }
809
+ function objectify(str, optionsOrSentinel) {
810
+ if (!isString(str))
811
+ return str;
812
+ const options = isFunction(optionsOrSentinel) ? { sentinel: optionsOrSentinel } : optionsOrSentinel ?? {};
813
+ if (str.startsWith("$sig:")) {
814
+ const secondColon = str.indexOf(":", 5);
815
+ if (secondColon !== -1) {
816
+ const sig = str.substring(5, secondColon);
817
+ const payload = str.substring(secondColon + 1);
818
+ if (!isString(options.secret) || !options.secret) {
819
+ console.warn("objectify: signature verification requires an explicit secret string");
820
+ if (options.throwOnError)
821
+ throw new TypeError("objectify: signature verification requires an explicit secret string");
822
+ return str;
823
+ }
824
+ const expectedSig = fastDigest(payload, options.secret);
825
+ if (!constantTimeEqual(sig, expectedSig)) {
826
+ console.warn("objectify: signature verification failed");
827
+ if (options.throwOnError)
828
+ throw new Error("objectify: signature verification failed");
829
+ return str;
830
+ }
831
+ str = payload;
832
+ } else if (options.requireSigned) {
833
+ console.warn("objectify: malformed signed payload");
834
+ if (options.throwOnError)
835
+ throw new Error("objectify: malformed signed payload");
836
+ return str;
837
+ }
838
+ } else if (options.requireSigned) {
839
+ console.warn("objectify: unsigned string rejected by requireSigned policy");
840
+ if (options.throwOnError)
841
+ throw new Error("objectify: unsigned string rejected by requireSigned policy");
842
+ return str;
843
+ }
844
+ let parse;
845
+ try {
846
+ parse = JSON.parse(str, reviver);
847
+ } catch (error) {
848
+ if (str.startsWith('"') && str.endsWith('"')) {
849
+ console.warn(`objectify.parse: -> ${str}, ${error.message}`);
850
+ return str;
851
+ } else
852
+ return objectify(`"${str}"`, options.requireSigned ? { ...options, requireSigned: false } : options);
853
+ }
854
+ switch (true) {
855
+ case (str.startsWith("{") && str.endsWith("}")):
856
+ // looks like Object
857
+ case (str.startsWith("[") && str.endsWith("]")):
858
+ return traverse(parse, options, 0);
859
+ // recurse into object
860
+ default:
861
+ return typeify(parse, options);
862
+ }
863
+ }
864
+ function traverse(obj, options, depth = 0) {
865
+ const maxDepth = options.maxDepth ?? MAX_TRAVERSE_DEPTH;
866
+ if (depth >= maxDepth)
867
+ return obj;
868
+ if (isObject(obj)) {
869
+ return typeify(ownEntries(obj).filter(([key]) => isSafeKey(key)).reduce((acc, [key, val]) => Object.assign(acc, { [toSymbol(key)]: typeify(traverse(val, options, depth + 1), options) }), {}), options);
870
+ }
871
+ if (isArray(obj)) {
872
+ return ownValues(obj).map((val) => typeify(traverse(val, options, depth + 1), options));
873
+ }
874
+ return typeify(obj, options);
875
+ }
876
+ function typeify(json, options) {
877
+ if (isString(json) && json.startsWith("~")) {
878
+ try {
879
+ if (json.startsWith("~~"))
880
+ return json.substring(1);
881
+ if (json.startsWith("~n"))
882
+ return BigInt(json.substring(2));
883
+ if (json.startsWith("~t")) {
884
+ const timeVal = json.substring(2);
885
+ const d = new Date(isNumeric(timeVal) ? Number(timeVal) : timeVal);
886
+ return isNaN(d.getTime()) ? json : d;
887
+ }
888
+ if (json === "~u")
889
+ return options.sentinel?.();
890
+ if (json.startsWith("~y"))
891
+ return toSymbol(json.substring(2));
892
+ } catch {
893
+ return json;
894
+ }
895
+ }
896
+ if (!isObject(json) || ownKeys(json).length !== 1)
897
+ return json;
898
+ const [$type, value2] = ownEntries(json)[0];
899
+ if (!String($type).startsWith("$"))
900
+ return json;
901
+ const type = $type.substring(1);
902
+ try {
903
+ switch (type) {
904
+ case "String":
905
+ case "Boolean":
906
+ case "Object":
907
+ case "Array":
908
+ return value2;
909
+ // these types are already handled by traverse()
910
+ case "Number":
911
+ return Number(value2);
912
+ case "BigInt":
913
+ return BigInt(value2);
914
+ case "Null":
915
+ return null;
916
+ case "Undefined":
917
+ case "Empty":
918
+ case "Void":
919
+ return options.sentinel?.();
920
+ // run Sentinel function to handle undefined values
921
+ case "Date":
922
+ return new Date(value2);
923
+ case "RegExp":
924
+ if (options.allowRegExp === false)
925
+ return json;
926
+ if (!isObject(value2) || !isString(value2.source) || value2.source.length > MAX_REGEXP_SOURCE_LENGTH)
927
+ return json;
928
+ return new RegExp(value2.source, value2.flags);
929
+ case "Symbol":
930
+ return toSymbol(value2);
931
+ case "Map":
932
+ if (!isArray(value2))
933
+ return json;
934
+ return new Map(value2);
935
+ case "Set":
936
+ if (!isArray(value2))
937
+ return json;
938
+ return new Set(value2);
939
+ default: {
940
+ if (options.allowClasses === false)
941
+ return json;
942
+ if (options.allowedClasses) {
943
+ const allowed = options.allowedClasses instanceof Set ? options.allowedClasses.has($type) || options.allowedClasses.has(type) : options.allowedClasses.includes($type) || options.allowedClasses.includes(type);
944
+ if (!allowed)
945
+ return json;
946
+ }
947
+ const cls = Registry.get($type);
948
+ if (!cls) {
949
+ console.warn(`objectify: dont know how to deserialize '${type}'`);
950
+ return json;
951
+ }
952
+ return Reflect.construct(cls, [value2]);
953
+ }
954
+ }
955
+ } catch {
956
+ return json;
957
+ }
958
+ }
959
+ var Registry, getSafeTag2, registerSerializable, SAFE_URI_MAP, RE_SAFE_URI_CODES, symKey, RUNTIME_SALT, fastDigest, constantTimeEqual, activeCompact, MAX_TRAVERSE_DEPTH, MAX_REGEXP_SOURCE_LENGTH;
960
+ var init_serialize_library = __esm({
961
+ "../../library/dist/common/runtime/serialize.library.js"() {
962
+ "use strict";
963
+ init_function_library();
964
+ init_primitive_library();
965
+ init_json_library();
966
+ init_object_library();
967
+ init_type_library();
968
+ init_assertion_library();
969
+ init_symbol_library();
970
+ Registry = globalThis[sym.$SerializerRegistry] ??= /* @__PURE__ */ new Map();
971
+ getSafeTag2 = (c) => {
972
+ try {
973
+ const tag2 = c?.prototype?.[Symbol.toStringTag] ?? c?.[Symbol.toStringTag];
974
+ return isString(tag2) ? tag2 : void 0;
975
+ } catch {
976
+ return void 0;
977
+ }
978
+ };
979
+ registerSerializable = (name, cls) => {
980
+ const key = name.startsWith("$") ? name : `$${name}`;
981
+ if (Registry.has(key)) {
982
+ const existingCls = Registry.get(key);
983
+ const existingTag = getSafeTag2(existingCls);
984
+ const clsTag = getSafeTag2(cls);
985
+ const existingName = existingCls.name || existingTag;
986
+ const currentName = cls.name || clsTag || (name.startsWith("$") ? name.slice(1) : name);
987
+ const isSameConstructor = existingCls === cls || existingCls.toString() === cls.toString() || Boolean(cls[sym.$Identity]) && existingCls[sym.$Identity] === cls[sym.$Identity] || Boolean(cls[sym.$Target]) && existingCls[sym.$Target] === cls[sym.$Target] || Boolean(existingName) && Boolean(currentName) && existingName === currentName;
988
+ if (isSameConstructor)
989
+ return;
990
+ throw new Error(`[registerSerializable] Collision: '${key}' is already registered with ${existingCls.name || "anonymous constructor"}`);
991
+ }
992
+ Registry.set(key, cls);
993
+ };
994
+ SAFE_URI_MAP = {
995
+ "%20": " ",
996
+ "%22": '"',
997
+ "%3B": ";",
998
+ "%3C": "<",
999
+ "%3E": ">",
1000
+ "%5B": "[",
1001
+ "%5D": "]",
1002
+ "%5E": "^",
1003
+ "%7B": "{",
1004
+ "%7C": "|",
1005
+ "%7D": "}"
1006
+ };
1007
+ RE_SAFE_URI_CODES = new RegExp(Object.keys(SAFE_URI_MAP).join("|"), "gi");
1008
+ symKey = /^@(@)?\(([^\)]*)\)$/;
1009
+ RUNTIME_SALT = globalThis.crypto?.randomUUID ? globalThis.crypto.randomUUID().split("-")[0] : Math.random().toString(36).slice(2, 10);
1010
+ fastDigest = (str, secret = RUNTIME_SALT) => {
1011
+ let h1 = 2166136261;
1012
+ let h2 = 2654435769;
1013
+ const input = `${secret}:${str}`;
1014
+ for (let i = 0; i < input.length; i++) {
1015
+ const c = input.charCodeAt(i);
1016
+ h1 = Math.imul(h1 ^ c, 16777619);
1017
+ h2 = Math.imul(h2 ^ c, 2246822507);
1018
+ }
1019
+ return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
1020
+ };
1021
+ constantTimeEqual = (a, b) => {
1022
+ if (!isString(a) || !isString(b))
1023
+ return false;
1024
+ if (a.length !== b.length)
1025
+ return false;
1026
+ let result = 0;
1027
+ for (let i = 0; i < a.length; i++)
1028
+ result |= a.charCodeAt(i) ^ b.charCodeAt(i);
1029
+ return result === 0;
1030
+ };
1031
+ activeCompact = true;
1032
+ MAX_TRAVERSE_DEPTH = 64;
1033
+ MAX_REGEXP_SOURCE_LENGTH = 512;
1034
+ }
1035
+ });
1036
+
1037
+ // ../../../node_modules/tslib/tslib.es6.mjs
1038
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
1039
+ function accept(f) {
1040
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
1041
+ return f;
1042
+ }
1043
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
1044
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
1045
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
1046
+ var _, done = false;
1047
+ for (var i = decorators.length - 1; i >= 0; i--) {
1048
+ var context3 = {};
1049
+ for (var p in contextIn) context3[p] = p === "access" ? {} : contextIn[p];
1050
+ for (var p in contextIn.access) context3.access[p] = contextIn.access[p];
1051
+ context3.addInitializer = function(f) {
1052
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
1053
+ extraInitializers.push(accept(f || null));
1054
+ };
1055
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context3);
1056
+ if (kind === "accessor") {
1057
+ if (result === void 0) continue;
1058
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
1059
+ if (_ = accept(result.get)) descriptor.get = _;
1060
+ if (_ = accept(result.set)) descriptor.set = _;
1061
+ if (_ = accept(result.init)) initializers.unshift(_);
1062
+ } else if (_ = accept(result)) {
1063
+ if (kind === "field") initializers.unshift(_);
1064
+ else descriptor[key] = _;
1065
+ }
1066
+ }
1067
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
1068
+ done = true;
1069
+ }
1070
+ function __runInitializers(thisArg, initializers, value2) {
1071
+ var useValue = arguments.length > 2;
1072
+ for (var i = 0; i < initializers.length; i++) {
1073
+ value2 = useValue ? initializers[i].call(thisArg, value2) : initializers[i].call(thisArg);
1074
+ }
1075
+ return useValue ? value2 : void 0;
1076
+ }
1077
+ var init_tslib_es6 = __esm({
1078
+ "../../../node_modules/tslib/tslib.es6.mjs"() {
1079
+ "use strict";
1080
+ }
1081
+ });
1082
+
1083
+ // ../../library/dist/common/runtime/decorator.library.js
1084
+ function getClassName(value2, contextName) {
1085
+ return getSafeTag(value2) ?? (isUndefined(contextName) ? value2.name || void 0 : String(contextName));
1086
+ }
1087
+ function Serializable(value2, { kind, name, addInitializer }) {
1088
+ const finalName = getClassName(value2, name);
1089
+ if (finalName)
1090
+ registerType(value2, finalName);
1091
+ switch (kind) {
1092
+ case "class":
1093
+ if (finalName)
1094
+ addInitializer(() => registerSerializable(finalName, value2));
1095
+ return value2;
1096
+ default:
1097
+ throw new Error(`@Serializable decorating unknown 'kind': ${kind} (${name})`);
1098
+ }
1099
+ }
1100
+ function StringTag(tagOrValue, context3) {
1101
+ const applyTag = (value2, customTag, contextName) => {
1102
+ const proto = value2.prototype;
1103
+ const tagName = customTag ?? getClassName(value2, contextName);
1104
+ if (tagName) {
1105
+ if (proto && !Object.hasOwn(proto, Symbol.toStringTag)) {
1106
+ Object.defineProperty(proto, Symbol.toStringTag, {
1107
+ value: tagName,
1108
+ configurable: true,
1109
+ writable: false,
1110
+ enumerable: false
1111
+ });
1112
+ }
1113
+ if (!value2.name || value2.name !== tagName) {
1114
+ try {
1115
+ Object.defineProperty(value2, "name", {
1116
+ value: tagName,
1117
+ configurable: true,
1118
+ writable: false,
1119
+ enumerable: false
1120
+ });
1121
+ } catch {
1122
+ }
1123
+ }
1124
+ }
1125
+ return value2;
1126
+ };
1127
+ if (isCallable(tagOrValue) && context3?.kind === "class")
1128
+ return applyTag(tagOrValue, void 0, context3.name);
1129
+ return (value2, ctx) => {
1130
+ return applyTag(value2, isString(tagOrValue) ? tagOrValue : void 0, ctx?.name);
1131
+ };
1132
+ }
1133
+ var init_decorator_library = __esm({
1134
+ "../../library/dist/common/runtime/decorator.library.js"() {
1135
+ "use strict";
1136
+ init_symbol_library();
1137
+ init_proxy_library();
1138
+ init_assertion_library();
1139
+ init_serialize_library();
1140
+ init_type_library();
1141
+ }
1142
+ });
1143
+
1144
+ // ../../library/dist/common/runtime/cache.class.js
1145
+ var BoundedCache;
1146
+ var init_cache_class = __esm({
1147
+ "../../library/dist/common/runtime/cache.class.js"() {
1148
+ "use strict";
1149
+ init_tslib_es6();
1150
+ init_assertion_library();
1151
+ init_decorator_library();
1152
+ BoundedCache = (() => {
1153
+ let _classDecorators = [StringTag("BoundedCache")];
1154
+ let _classDescriptor;
1155
+ let _classExtraInitializers = [];
1156
+ let _classThis;
1157
+ let _classSuper = Map;
1158
+ var BoundedCache2 = class extends _classSuper {
1159
+ static {
1160
+ _classThis = this;
1161
+ }
1162
+ static {
1163
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1164
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1165
+ BoundedCache2 = _classThis = _classDescriptor.value;
1166
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1167
+ __runInitializers(_classThis, _classExtraInitializers);
1168
+ }
1169
+ #expires = /* @__PURE__ */ new Map();
1170
+ #staticKeys = /* @__PURE__ */ new Set();
1171
+ #ttls = /* @__PURE__ */ new Map();
1172
+ maxSize;
1173
+ ttl;
1174
+ /**
1175
+ * Creates a bounded cache with configurable capacity and entry lifetime.
1176
+ *
1177
+ * @param maxSize - Maximum number of non-static entries retained
1178
+ * @param ttl - Default time-to-live for entries in milliseconds
1179
+ */
1180
+ constructor(maxSize = 1e3, ttl = 24 * 60 * 60 * 1e3) {
1181
+ super();
1182
+ this.maxSize = maxSize;
1183
+ this.ttl = ttl;
1184
+ }
1185
+ /**
1186
+ * Returns true to identify this instance as a BoundedCache.
1187
+ */
1188
+ get isBoundedCache() {
1189
+ return true;
1190
+ }
1191
+ /**
1192
+ * Determines whether a cache entry has passed its expiration deadline.
1193
+ *
1194
+ * @param key - Cache key to inspect
1195
+ * @returns True when the entry has expired, otherwise false
1196
+ */
1197
+ #isExpired(key) {
1198
+ const deadline = this.#expires.get(key);
1199
+ if (deadline === void 0)
1200
+ return false;
1201
+ return Date.now() > deadline;
1202
+ }
1203
+ /**
1204
+ * Purges TTL-expired entries.
1205
+ */
1206
+ evictExpired() {
1207
+ if (this.#expires.size === 0)
1208
+ return;
1209
+ const now = Date.now();
1210
+ for (const [key, deadline] of this.#expires.entries()) {
1211
+ if (now > deadline) {
1212
+ this.delete(key);
1213
+ }
1214
+ }
1215
+ }
1216
+ /**
1217
+ * Register an immortal static key (e.g. business glossary term).
1218
+ * Static keys bypass TTL expiration and LRU capacity eviction.
1219
+ */
1220
+ setStatic(key, value2) {
1221
+ if (super.has(key))
1222
+ super.delete(key);
1223
+ super.set(key, value2);
1224
+ this.#staticKeys.add(key);
1225
+ this.#expires.delete(key);
1226
+ this.#ttls.delete(key);
1227
+ return this;
1228
+ }
1229
+ /**
1230
+ * Check if a key is a static key.
1231
+ */
1232
+ isStatic(key) {
1233
+ return this.#staticKeys.has(key);
1234
+ }
1235
+ /**
1236
+ * Retrieves a value from the cache by key. Evaluates TTL expiration via `#expires`
1237
+ * specifically for the requested key, and updates LRU ordering by deleting and re-inserting
1238
+ * the key in the underlying Map. Leaves the expiration deadline unchanged.
1239
+ *
1240
+ * @param key - The cache key to retrieve
1241
+ * @returns The cached value, or undefined if not found or expired
1242
+ */
1243
+ get(key) {
1244
+ if (this.#isExpired(key)) {
1245
+ this.delete(key);
1246
+ return void 0;
1247
+ }
1248
+ if (!super.has(key))
1249
+ return void 0;
1250
+ const val = super.get(key);
1251
+ super.delete(key);
1252
+ super.set(key, val);
1253
+ return val;
1254
+ }
1255
+ /**
1256
+ * Checks if a key exists in the cache and is not expired.
1257
+ * Automatically evicts expired entries on access.
1258
+ *
1259
+ * @param key - The cache key to check
1260
+ * @returns True if the key exists and is not expired, false otherwise
1261
+ */
1262
+ has(key) {
1263
+ if (this.#isExpired(key)) {
1264
+ this.delete(key);
1265
+ return false;
1266
+ }
1267
+ return super.has(key);
1268
+ }
1269
+ /**
1270
+ * Returns the number of entries in the cache after evicting expired entries.
1271
+ */
1272
+ get size() {
1273
+ this.evictExpired();
1274
+ return super.size;
1275
+ }
1276
+ /**
1277
+ * Executes a callback for each cache entry after evicting expired entries.
1278
+ *
1279
+ * @param callbackfn - Function to execute for each entry
1280
+ * @param thisArg - Optional value to use as `this` when executing the callback
1281
+ */
1282
+ forEach(callbackfn, thisArg) {
1283
+ this.evictExpired();
1284
+ super.forEach(callbackfn, thisArg);
1285
+ }
1286
+ /**
1287
+ * Sets a key-value pair in the cache, enforcing LRU eviction.
1288
+ * If finite-TTL is configured, entries retain their original absolute expiration deadline
1289
+ * unless an explicit `ttl` override is passed.
1290
+ * If the cache exceeds maxSize, the oldest non-static entry is removed.
1291
+ *
1292
+ * @param key - The cache key to set
1293
+ * @param value - The value to store
1294
+ * @param ttl - Optional custom time-to-live in milliseconds for this specific entry
1295
+ * @returns This cache instance for chaining
1296
+ */
1297
+ set(key, value2, ttl) {
1298
+ this.evictExpired();
1299
+ const existingDeadline = this.#expires.get(key);
1300
+ if (super.has(key))
1301
+ super.delete(key);
1302
+ super.set(key, value2);
1303
+ this.#staticKeys.delete(key);
1304
+ if (isDefined(ttl)) {
1305
+ if (ttl !== Infinity) {
1306
+ this.#expires.set(key, Date.now() + ttl);
1307
+ this.#ttls.set(key, ttl);
1308
+ } else {
1309
+ this.#expires.delete(key);
1310
+ this.#ttls.delete(key);
1311
+ }
1312
+ } else if (existingDeadline !== void 0) {
1313
+ this.#expires.set(key, existingDeadline);
1314
+ } else if (this.ttl !== Infinity) {
1315
+ this.#expires.set(key, Date.now() + this.ttl);
1316
+ this.#ttls.delete(key);
1317
+ } else {
1318
+ this.#expires.delete(key);
1319
+ this.#ttls.delete(key);
1320
+ }
1321
+ while (this.size - this.#staticKeys.size > this.maxSize) {
1322
+ let evicted = false;
1323
+ const keysIter = super.keys();
1324
+ let res = keysIter.next();
1325
+ while (!res.done) {
1326
+ const k = res.value;
1327
+ if (!this.#staticKeys.has(k)) {
1328
+ this.delete(k);
1329
+ evicted = true;
1330
+ break;
1331
+ }
1332
+ res = keysIter.next();
1333
+ }
1334
+ if (!evicted)
1335
+ break;
1336
+ }
1337
+ return this;
1338
+ }
1339
+ /**
1340
+ * Deletes a key from the cache, removing its expiration and static key markers.
1341
+ *
1342
+ * @param key - The cache key to delete
1343
+ * @returns True if the key was deleted, false if it did not exist
1344
+ */
1345
+ delete(key) {
1346
+ this.#staticKeys.delete(key);
1347
+ this.#expires.delete(key);
1348
+ this.#ttls.delete(key);
1349
+ return super.delete(key);
1350
+ }
1351
+ /**
1352
+ * Deletes all cache entries whose keys start with the specified prefix.
1353
+ * The prefix comparison is case-insensitive.
1354
+ *
1355
+ * @param prefix - The prefix string to match against cache keys
1356
+ * @returns The number of entries deleted
1357
+ */
1358
+ deletePrefix(prefix) {
1359
+ const normalizedPrefix = String(prefix).trim().toLowerCase();
1360
+ if (isEmpty(normalizedPrefix))
1361
+ return 0;
1362
+ const toDelete = [];
1363
+ for (const key of super.keys()) {
1364
+ if (isString(key) && key.toLowerCase().startsWith(normalizedPrefix))
1365
+ toDelete.push(key);
1366
+ }
1367
+ for (const k of toDelete)
1368
+ this.delete(k);
1369
+ return toDelete.length;
1370
+ }
1371
+ /**
1372
+ * Purges cache entries.
1373
+ * If `count` is specified, evicts up to `count` oldest non-static entries.
1374
+ * If omitted, clears all entries, including static entries.
1375
+ *
1376
+ * @param count - Optional number of entries to evict. If omitted, clears all entries.
1377
+ */
1378
+ clear(count) {
1379
+ if (count === void 0) {
1380
+ this.#staticKeys.clear();
1381
+ this.#expires.clear();
1382
+ this.#ttls.clear();
1383
+ super.clear();
1384
+ return;
1385
+ }
1386
+ let evicted = 0;
1387
+ for (const key of super.keys()) {
1388
+ if (evicted >= count)
1389
+ break;
1390
+ if (!this.#staticKeys.has(key)) {
1391
+ this.delete(key);
1392
+ evicted++;
1393
+ }
1394
+ }
1395
+ }
1396
+ /**
1397
+ * Returns an iterator of cache keys after evicting expired entries.
1398
+ *
1399
+ * @returns Iterator of cache keys
1400
+ */
1401
+ keys() {
1402
+ this.evictExpired();
1403
+ return super.keys();
1404
+ }
1405
+ /**
1406
+ * Returns an iterator of cache values after evicting expired entries.
1407
+ *
1408
+ * @returns Iterator of cache values
1409
+ */
1410
+ values() {
1411
+ this.evictExpired();
1412
+ return super.values();
1413
+ }
1414
+ /**
1415
+ * Returns an iterator of cache entries after evicting expired entries.
1416
+ *
1417
+ * @returns Iterator of [key, value] pairs
1418
+ */
1419
+ entries() {
1420
+ this.evictExpired();
1421
+ return super.entries();
1422
+ }
1423
+ /**
1424
+ * Returns an iterator of cache entries after evicting expired entries, making the cache iterable.
1425
+ *
1426
+ * @returns Iterator of [key, value] pairs
1427
+ */
1428
+ [Symbol.iterator]() {
1429
+ this.evictExpired();
1430
+ return super[Symbol.iterator]();
1431
+ }
1432
+ /**
1433
+ * Returns a plain key-value object of all active non-expired cache entries.
1434
+ * Filters out non-string keys to prevent lossy key conversions or collisions (e.g. numeric 1 vs string "1").
1435
+ */
1436
+ toJSON() {
1437
+ this.evictExpired();
1438
+ const stringEntries = [];
1439
+ for (const [k, v] of super.entries()) {
1440
+ if (isString(k))
1441
+ stringEntries.push([k, v]);
1442
+ }
1443
+ return Object.fromEntries(stringEntries);
1444
+ }
1445
+ /**
1446
+ * Creates a BoundedCache from an iterable of key-value pairs.
1447
+ *
1448
+ * @param entries - Iterable of [key, value] pairs to populate the cache
1449
+ * @param maxSize - Maximum number of entries (default: 1000)
1450
+ * @param ttl - Time-to-live in milliseconds (default: 24 hours)
1451
+ * @returns A new BoundedCache instance
1452
+ */
1453
+ static fromEntries(entries, maxSize = 1e3, ttl = 24 * 60 * 60 * 1e3) {
1454
+ const cache = new BoundedCache2(maxSize, ttl);
1455
+ for (const [k, v] of entries) {
1456
+ cache.set(k, v);
1457
+ }
1458
+ return cache;
1459
+ }
1460
+ };
1461
+ return BoundedCache2 = _classThis;
1462
+ })();
1463
+ }
1464
+ });
1465
+
1466
+ // ../../library/dist/common/runtime/storage.library.js
1467
+ function getStorage(key, dflt) {
1468
+ let store;
1469
+ if (isUndefined(key))
1470
+ return dflt ?? {};
1471
+ switch (context.type) {
1472
+ case CONTEXT.Browser:
1473
+ store = storage.getItem(key);
1474
+ break;
1475
+ case CONTEXT.NodeJS:
1476
+ store = nodeStorage.has(key) ? nodeStorage.get(key) : getEnvVar(key);
1477
+ break;
1478
+ case CONTEXT.Deno:
1479
+ store = context.global.Deno.env.get(key);
1480
+ break;
1481
+ case CONTEXT.GoogleAppsScript:
1482
+ store = context.global.PropertiesService?.getUserProperties().getProperty(key);
1483
+ break;
1484
+ case CONTEXT.WebWorker:
1485
+ case CONTEXT.Unknown:
1486
+ store = void 0;
1487
+ break;
1488
+ default:
1489
+ throw new Error(`Cannot determine Javascript context: ${context.type}`);
1490
+ }
1491
+ return isString(store) ? objectify(store) : dflt;
1492
+ }
1493
+ function setStorage(key, val, options) {
1494
+ const stash = isDefined(val) ? stringify(val) : void 0;
1495
+ const set = isDefined(stash);
1496
+ switch (context.type) {
1497
+ case CONTEXT.Browser:
1498
+ try {
1499
+ set ? storage.setItem(key, stash) : storage.removeItem(key);
1500
+ } catch (e) {
1501
+ console.warn(`[Storage] Failed to ${set ? "setItem" : "removeItem"} for key '${key}':`, e);
1502
+ }
1503
+ break;
1504
+ case CONTEXT.NodeJS:
1505
+ if (!set) {
1506
+ nodeStorage.set(key, void 0, options?.ttl);
1507
+ } else if (options?.static) {
1508
+ nodeStorage.setStatic(key, stash);
1509
+ } else {
1510
+ nodeStorage.set(key, stash, options?.ttl);
1511
+ }
1512
+ break;
1513
+ case CONTEXT.Deno:
1514
+ set ? context.global.Deno.env.set(key, stash) : context.global.Deno.env.delete(key);
1515
+ break;
1516
+ case CONTEXT.GoogleAppsScript:
1517
+ set ? context.global.PropertiesService?.getUserProperties().setProperty(key, stash) : context.global.PropertiesService?.getUserProperties().deleteProperty(key);
1518
+ break;
1519
+ case CONTEXT.WebWorker:
1520
+ case CONTEXT.Unknown:
1521
+ break;
1522
+ default:
1523
+ throw new Error(`Cannot determine Javascript context: ${context.type}`);
1524
+ }
1525
+ }
1526
+ var context, createMemoryStorage, memoryStores, getMemoryStorage, getSafeStorage, storage, nodeStorage, getEnvVar;
1527
+ var init_storage_library = __esm({
1528
+ "../../library/dist/common/runtime/storage.library.js"() {
1529
+ "use strict";
1530
+ init_serialize_library();
1531
+ init_utility_library();
1532
+ init_assertion_library();
1533
+ init_cache_class();
1534
+ context = getContext();
1535
+ createMemoryStorage = (maxSize = 1e3, ttl = Infinity) => {
1536
+ const map = new BoundedCache(maxSize, ttl);
1537
+ return {
1538
+ get length() {
1539
+ return map.size;
1540
+ },
1541
+ clear: () => map.clear(),
1542
+ getItem: (key) => map.get(key) ?? null,
1543
+ key: (index) => Array.from(map.keys())[index] ?? null,
1544
+ removeItem: (key) => {
1545
+ map.delete(key);
1546
+ },
1547
+ setItem: (key, value2) => {
1548
+ map.set(key, String(value2));
1549
+ }
1550
+ };
1551
+ };
1552
+ memoryStores = /* @__PURE__ */ new Map();
1553
+ getMemoryStorage = (name) => {
1554
+ let store = memoryStores.get(name);
1555
+ if (!store) {
1556
+ store = createMemoryStorage();
1557
+ memoryStores.set(name, store);
1558
+ }
1559
+ return store;
1560
+ };
1561
+ getSafeStorage = (name = "localStorage") => {
1562
+ try {
1563
+ const target = globalThis?.[name];
1564
+ if (target && isCallable(target.getItem) && isCallable(target.setItem) && isCallable(target.removeItem) && isCallable(target.clear) && isCallable(target.key) && isNumber(target.length))
1565
+ return target;
1566
+ } catch {
1567
+ }
1568
+ return getMemoryStorage(name);
1569
+ };
1570
+ storage = context.type === CONTEXT.Browser ? getSafeStorage() : createMemoryStorage();
1571
+ nodeStorage = new BoundedCache(1e3, Infinity);
1572
+ getEnvVar = (key) => {
1573
+ try {
1574
+ const proc = Reflect.get(context.global, "process");
1575
+ if (!proc || typeof proc !== "object")
1576
+ return void 0;
1577
+ const env = Reflect.get(proc, "env");
1578
+ if (!env || typeof env !== "object")
1579
+ return void 0;
1580
+ return Reflect.get(env, key);
1581
+ } catch {
1582
+ return void 0;
1583
+ }
1584
+ };
1585
+ }
1586
+ });
1587
+
1588
+ // ../../library/dist/common/primitives/string.library.js
1589
+ var init_string_library = __esm({
1590
+ "../../library/dist/common/primitives/string.library.js"() {
1591
+ "use strict";
1592
+ init_serialize_library();
1593
+ init_assertion_library();
1594
+ }
1595
+ });
1596
+
1597
+ // ../../library/dist/common/primitives/coercion.library.js
1598
+ function asArray(arr = [], fill) {
1599
+ const mapFn = (val) => isUndefined(fill) || isDefined(val) ? val : clone(fill);
1600
+ return isArrayLike(arr) || isIterable(arr) && !isString(arr) ? Array.from(arr, mapFn) : [arr];
1601
+ }
1602
+ function asError(err) {
1603
+ if (isError(err))
1604
+ return err;
1605
+ const error = new Error(isObject(err) && isString(err.message) ? err.message : String(err));
1606
+ if (isObject(err)) {
1607
+ error.name = isString(err.name) ? err.name : "Error";
1608
+ if ("code" in err && (isString(err.code) || isNumber(err.code)))
1609
+ error.code = err.code;
1610
+ if ("stack" in err && isString(err.stack))
1611
+ error.stack = err.stack;
1612
+ }
1613
+ return error;
1614
+ }
1615
+ var MAX_SAFE_INTEGER_BIGINT, MIN_SAFE_INTEGER_BIGINT;
1616
+ var init_coercion_library = __esm({
1617
+ "../../library/dist/common/primitives/coercion.library.js"() {
1618
+ "use strict";
1619
+ init_serialize_library();
1620
+ init_type_library();
1621
+ init_assertion_library();
1622
+ init_string_library();
1623
+ MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
1624
+ MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);
1625
+ }
1626
+ });
1627
+
1628
+ // ../../library/dist/common/temporal/temporal.polyfill.js
1629
+ var init_temporal_polyfill = __esm({
1630
+ "../../library/dist/common/temporal/temporal.polyfill.js"() {
1631
+ "use strict";
1632
+ init_coercion_library();
1633
+ if (typeof globalThis.Temporal === "undefined") {
1634
+ throw new Error("Temporal API is not available. Node 20+ with a polyfill (e.g. @js-temporal/polyfill) is highly recommended. Native Temporal is fully reliable only on Node 26+ (while Node 22 may have instabilities).");
1635
+ }
1636
+ try {
1637
+ if (typeof Temporal.Now.zonedDateTimeISO === "function") {
1638
+ const zdt = Temporal.Now.zonedDateTimeISO();
1639
+ if (typeof zdt.add !== "function")
1640
+ throw new Error("Incomplete Temporal implementation");
1641
+ }
1642
+ } catch (err) {
1643
+ const error = asError(err);
1644
+ console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.", error);
1645
+ if (error.message !== "Incomplete Temporal implementation")
1646
+ throw error;
1647
+ }
1648
+ }
1649
+ });
1650
+
1651
+ // ../../library/dist/common/temporal/temporal.library.js
1652
+ function instant() {
1653
+ return Temporal.Now.instant();
1654
+ }
1655
+ function getOffsets(timeZone, year = 2024) {
1656
+ const jan = Temporal.ZonedDateTime.from({ year, month: 1, day: 1, hour: 0, minute: 0, second: 0, timeZone }).offsetNanoseconds;
1657
+ const jul = Temporal.ZonedDateTime.from({ year, month: 7, day: 1, hour: 0, minute: 0, second: 0, timeZone }).offsetNanoseconds;
1658
+ return { jan, jul };
1659
+ }
1660
+ var init_temporal_library = __esm({
1661
+ "../../library/dist/common/temporal/temporal.library.js"() {
1662
+ "use strict";
1663
+ init_temporal_polyfill();
1664
+ init_assertion_library();
1665
+ }
1666
+ });
1667
+
1668
+ // ../../library/dist/common/runtime/international.library.js
1669
+ function getPropOrCall(obj, method, fallbackProp) {
1670
+ if (!obj)
1671
+ return void 0;
1672
+ if (isCallable(obj[method]))
1673
+ return obj[method]();
1674
+ if (fallbackProp && fallbackProp in obj)
1675
+ return obj[fallbackProp];
1676
+ return void 0;
1677
+ }
1678
+ function getFallbackFirstDay(region) {
1679
+ if (!region)
1680
+ return 1;
1681
+ if (FRIDAY_START_REGIONS.has(region))
1682
+ return 5;
1683
+ if (SATURDAY_START_REGIONS.has(region))
1684
+ return 6;
1685
+ if (SUNDAY_START_REGIONS.has(region))
1686
+ return 7;
1687
+ return 1;
1688
+ }
1689
+ function getFallbackWeekend(region) {
1690
+ if (!region)
1691
+ return WEEKEND_SAT_SUN;
1692
+ if (region === "IR")
1693
+ return WEEKEND_FRI;
1694
+ if (region === "AF")
1695
+ return WEEKEND_THU_FRI;
1696
+ if (FRI_SAT_WEEKEND_REGIONS.has(region))
1697
+ return WEEKEND_FRI_SAT;
1698
+ return WEEKEND_SAT_SUN;
1699
+ }
1700
+ function getFallbackDirection(loc, language) {
1701
+ const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
1702
+ return script && RTL_SCRIPTS.has(script) || language && RTL_LANGUAGES.has(language) ? "rtl" : "ltr";
1703
+ }
1704
+ var RE_UNDERSCORE, RE_LOCALE_CLEANSE, hasIntl, cleanLocaleTag, getRTF, getLF, getDTF, getPR, getNF, getDF, SUNDAY_START_REGIONS, SATURDAY_START_REGIONS, FRIDAY_START_REGIONS, FRI_SAT_WEEKEND_REGIONS, RTL_LANGUAGES, RTL_SCRIPTS, WEEKEND_SAT_SUN, WEEKEND_FRI_SAT, WEEKEND_FRI, WEEKEND_THU_FRI, getLC, getLI, getDigitsMap, FALLBACK_DTF_OPTIONS, getDateTimeFormat, canonicalLocale, canonicalLocales, getHemisphere, probeMDY;
1705
+ var init_international_library = __esm({
1706
+ "../../library/dist/common/runtime/international.library.js"() {
1707
+ "use strict";
1708
+ init_temporal_library();
1709
+ init_function_library();
1710
+ init_assertion_library();
1711
+ init_coercion_library();
1712
+ RE_UNDERSCORE = /_/g;
1713
+ RE_LOCALE_CLEANSE = /[.@]/;
1714
+ hasIntl = (feature) => typeof Intl !== "undefined" && (!feature || Object.hasOwn(Intl, feature) && isCallable(Intl[feature]));
1715
+ cleanLocaleTag = (tag2) => {
1716
+ if (isLocale(tag2))
1717
+ tag2 = tag2.toString();
1718
+ if (!isString(tag2))
1719
+ return void 0;
1720
+ const trimmed = tag2.trim();
1721
+ if (isEmpty(trimmed))
1722
+ return void 0;
1723
+ const stripped = trimmed.split(RE_LOCALE_CLEANSE)[0];
1724
+ if (isEmpty(stripped))
1725
+ return void 0;
1726
+ return stripped.replace(RE_UNDERSCORE, "-");
1727
+ };
1728
+ getRTF = memoizeFunction((locale, options) => {
1729
+ return new Intl.RelativeTimeFormat(cleanLocaleTag(locale), options);
1730
+ });
1731
+ getLF = memoizeFunction((locale, options) => {
1732
+ return new Intl.ListFormat(cleanLocaleTag(locale), options);
1733
+ });
1734
+ getDTF = memoizeFunction((locale, options) => {
1735
+ return new Intl.DateTimeFormat(cleanLocaleTag(locale), options);
1736
+ });
1737
+ getPR = memoizeFunction((locale, options) => {
1738
+ try {
1739
+ return new Intl.PluralRules(cleanLocaleTag(locale), options);
1740
+ } catch (e) {
1741
+ return { select: () => "other" };
1742
+ }
1743
+ });
1744
+ getNF = memoizeFunction((locale, options) => {
1745
+ return new Intl.NumberFormat(cleanLocaleTag(locale), options);
1746
+ });
1747
+ getDF = memoizeFunction((locale, options) => {
1748
+ try {
1749
+ const df = new Intl.DurationFormat(cleanLocaleTag(locale), options);
1750
+ if (isFunction(df.format))
1751
+ return df;
1752
+ throw new Error("No format method");
1753
+ } catch (e) {
1754
+ return { format: (duration) => String(duration) };
1755
+ }
1756
+ });
1757
+ SUNDAY_START_REGIONS = /* @__PURE__ */ new Set(["US", "CA", "MX", "BR", "IL", "JP", "TW", "HK", "MO", "PH", "SG", "TH", "IN", "KR", "CO", "PE", "VE", "ZA"]);
1758
+ SATURDAY_START_REGIONS = /* @__PURE__ */ new Set(["SA", "AF", "BH", "DJ", "DZ", "EG", "IQ", "IR", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
1759
+ FRIDAY_START_REGIONS = /* @__PURE__ */ new Set(["MV"]);
1760
+ FRI_SAT_WEEKEND_REGIONS = /* @__PURE__ */ new Set(["SA", "BH", "DJ", "DZ", "EG", "IQ", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
1761
+ RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "yi", "ps", "sd", "ug", "ckb"]);
1762
+ RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Mand", "Samr", "Nkoo"]);
1763
+ WEEKEND_SAT_SUN = Object.freeze([6, 7]);
1764
+ WEEKEND_FRI_SAT = Object.freeze([5, 6]);
1765
+ WEEKEND_FRI = Object.freeze([5]);
1766
+ WEEKEND_THU_FRI = Object.freeze([4, 5]);
1767
+ getLC = memoizeFunction((localeTag) => {
1768
+ if (isLocale(localeTag))
1769
+ return localeTag;
1770
+ if (!hasIntl("Locale"))
1771
+ return void 0;
1772
+ try {
1773
+ const cleaned = cleanLocaleTag(localeTag);
1774
+ return new Intl.Locale(cleaned || "en-US");
1775
+ } catch {
1776
+ return void 0;
1777
+ }
1778
+ });
1779
+ getLI = memoizeFunction((localeTag) => {
1780
+ const loc = getLC(localeTag) ?? getLC("en-US");
1781
+ const baseName = loc?.baseName ?? canonicalLocale(localeTag) ?? "en-US";
1782
+ const language = loc?.language ?? baseName.split("-")[0]?.toLowerCase();
1783
+ const regionSubtags = [];
1784
+ for (const sub of baseName.split("-").slice(1)) {
1785
+ if (sub.length === 1)
1786
+ break;
1787
+ regionSubtags.push(sub);
1788
+ }
1789
+ const region = loc?.region ?? (isCallable(loc?.maximize) ? loc.maximize().region : void 0) ?? regionSubtags.find((subtag) => /^[a-zA-Z]{2}$|^\d{3}$/.test(subtag))?.toUpperCase();
1790
+ const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
1791
+ const rawWeek = getPropOrCall(loc, "getWeekInfo", "weekInfo");
1792
+ const firstDay = rawWeek?.firstDay ?? getFallbackFirstDay(region);
1793
+ const weekend = Array.isArray(rawWeek?.weekend) ? Object.freeze([...rawWeek.weekend]) : getFallbackWeekend(region);
1794
+ const rawCycles = getPropOrCall(loc, "getHourCycles", "hourCycles") ?? loc?.hourCycle;
1795
+ const resolvedHc = rawCycles ?? (hasIntl("DateTimeFormat") ? getDTF(baseName, { hour: "numeric" }).resolvedOptions().hourCycle : void 0);
1796
+ const hourCycles = Array.isArray(resolvedHc) && resolvedHc.length > 0 ? Object.freeze([...resolvedHc]) : isString(resolvedHc) ? Object.freeze([resolvedHc]) : Object.freeze(["h23"]);
1797
+ const rawText = getPropOrCall(loc, "getTextInfo", "textInfo");
1798
+ const direction = rawText?.direction === "rtl" || rawText?.direction === "ltr" ? rawText.direction : getFallbackDirection(loc, language);
1799
+ const rawSystems = getPropOrCall(loc, "getNumberingSystems", "numberingSystems") ?? loc?.numberingSystem;
1800
+ const resolvedNs = rawSystems ?? (hasIntl("NumberFormat") ? getNF(baseName).resolvedOptions().numberingSystem : void 0);
1801
+ const numberingSystems = Array.isArray(resolvedNs) && resolvedNs.length > 0 ? Object.freeze([...resolvedNs]) : isString(resolvedNs) ? Object.freeze([resolvedNs]) : Object.freeze(["latn"]);
1802
+ const rawTimeZones = getPropOrCall(loc, "getTimeZones", "timeZones");
1803
+ const timeZones = Array.isArray(rawTimeZones) && rawTimeZones.length > 0 ? Object.freeze([...rawTimeZones]) : Object.freeze([]);
1804
+ const weekInfo = Object.freeze({ firstDay, weekend });
1805
+ return Object.freeze({
1806
+ locale: loc,
1807
+ baseName,
1808
+ language,
1809
+ region,
1810
+ script,
1811
+ weekInfo,
1812
+ firstDay,
1813
+ weekend,
1814
+ hourCycle: hourCycles[0],
1815
+ hourCycles,
1816
+ direction,
1817
+ numberingSystem: numberingSystems[0],
1818
+ numberingSystems,
1819
+ timeZones
1820
+ });
1821
+ });
1822
+ getDigitsMap = memoizeFunction((numberingSystem = "latn") => {
1823
+ if (!numberingSystem || numberingSystem === "latn" || !hasIntl("NumberFormat"))
1824
+ return void 0;
1825
+ try {
1826
+ const nf = new Intl.NumberFormat(`en-u-nu-${numberingSystem}`, { useGrouping: false });
1827
+ const digits = Array.from({ length: 10 }, (_, i) => nf.format(i));
1828
+ if (digits[0] === "0" && digits[9] === "9")
1829
+ return void 0;
1830
+ return Object.freeze(digits);
1831
+ } catch {
1832
+ return void 0;
1833
+ }
1834
+ });
1835
+ FALLBACK_DTF_OPTIONS = Object.freeze({
1836
+ locale: "en-US",
1837
+ calendar: "iso8601",
1838
+ numberingSystem: "latn",
1839
+ timeZone: "UTC"
1840
+ });
1841
+ getDateTimeFormat = memoizeFunction(() => {
1842
+ return hasIntl("DateTimeFormat") ? Object.freeze(getDTF().resolvedOptions()) : FALLBACK_DTF_OPTIONS;
1843
+ });
1844
+ canonicalLocale = memoizeFunction((locale) => {
1845
+ const cleaned = cleanLocaleTag(locale);
1846
+ if (!cleaned)
1847
+ return void 0;
1848
+ if (hasIntl("getCanonicalLocales")) {
1849
+ try {
1850
+ return Intl.getCanonicalLocales(cleaned)[0];
1851
+ } catch {
1852
+ return void 0;
1853
+ }
1854
+ }
1855
+ return getLC(cleaned)?.baseName ?? cleaned;
1856
+ });
1857
+ canonicalLocales = memoizeFunction((locales) => {
1858
+ return Object.freeze(asArray(locales).map((l) => canonicalLocale(l)).filter(Boolean));
1859
+ });
1860
+ getHemisphere = memoizeFunction((timeZone = getDateTimeFormat().timeZone) => {
1861
+ try {
1862
+ const { jan, jul } = getOffsets(timeZone);
1863
+ const southPrefixes = ["Australia", "Antarctica", "Africa/Johannesburg", "America/Argentina/Buenos_Aires", "America/Sao_Paulo"];
1864
+ const isSouthZone = southPrefixes.some((p) => timeZone.startsWith(p));
1865
+ switch (true) {
1866
+ case jul > jan:
1867
+ return "north";
1868
+ case jul < jan:
1869
+ return "south";
1870
+ default:
1871
+ return isSouthZone ? "south" : void 0;
1872
+ }
1873
+ } catch (e) {
1874
+ return void 0;
1875
+ }
1876
+ });
1877
+ probeMDY = memoizeFunction((locale) => {
1878
+ try {
1879
+ const date = new Date(2024, 11, 24);
1880
+ const parts = getDTF(locale).formatToParts(date);
1881
+ return parts[0].type === "month" && parts[0].value === "12";
1882
+ } catch {
1883
+ return false;
1884
+ }
1885
+ });
1886
+ }
1887
+ });
1888
+
1889
+ // ../../library/dist/common/runtime/enumerate.library.js
1890
+ function value(val) {
1891
+ return { enumerable: false, configurable: false, writable: false, value: val };
1892
+ }
1893
+ function enumify(list, frozen = true) {
1894
+ const type = getType(this);
1895
+ const proto = type !== "Module" && isFunction(this?.has) ? this : ENUM;
1896
+ const arg = asType(list);
1897
+ const target = Object.create(proto);
1898
+ switch (arg.type) {
1899
+ case "Enumify":
1900
+ case "Object":
1901
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(arg.value));
1902
+ break;
1903
+ case "Array":
1904
+ arg.value.forEach((key, index) => {
1905
+ if (isNumber(key))
1906
+ throw new Error("Enumify: numeric keys are not supported");
1907
+ target[key] = index;
1908
+ });
1909
+ break;
1910
+ default:
1911
+ throw new Error(`Enumify: invalid argument type: ${arg.type}`);
1912
+ }
1913
+ return proxify(target, true, frozen);
1914
+ }
1915
+ var tag, ENUM, Enumify;
1916
+ var init_enumerate_library = __esm({
1917
+ "../../library/dist/common/runtime/enumerate.library.js"() {
1918
+ "use strict";
1919
+ init_tslib_es6();
1920
+ init_type_library();
1921
+ init_assertion_library();
1922
+ init_primitive_library();
1923
+ init_proxy_library();
1924
+ init_decorator_library();
1925
+ init_function_library();
1926
+ tag = "Enumify";
1927
+ ENUM = secure(Object.create(null, {
1928
+ keys: memoizeMethod("keys", function() {
1929
+ return ownEntries(this, true).map(([key]) => key);
1930
+ }),
1931
+ values: memoizeMethod("values", function() {
1932
+ return ownEntries(this, true).map(([_, val]) => val);
1933
+ }),
1934
+ entries: memoizeMethod("entries", function() {
1935
+ return ownEntries(this, true).map(([key, val]) => Object.freeze([key, val]));
1936
+ }),
1937
+ invert: memoizeMethod("invert", function() {
1938
+ return Object.fromEntries(this.entries().map(([key, val]) => [val, key]));
1939
+ }),
1940
+ has: value(function(key) {
1941
+ return this.keys().includes(key);
1942
+ }),
1943
+ count: value(function() {
1944
+ return this.keys().length;
1945
+ }),
1946
+ includes: value(function(search) {
1947
+ return this.values().includes(search);
1948
+ }),
1949
+ keyOf: value(function(search) {
1950
+ return this.invert()[search];
1951
+ }),
1952
+ extend: value(function(list, frozen) {
1953
+ return enumify.call(this, list, frozen);
1954
+ }),
1955
+ forEach: value(function(fn, thisArg) {
1956
+ this.entries().forEach((entry, index) => fn.call(thisArg, entry, index, this));
1957
+ }),
1958
+ filter: value(function(fn, thisArg) {
1959
+ return enumify(this.entries().reduce((acc, entry, index) => fn.call(thisArg, entry, index, this) ? Object.assign(acc, { [entry[0]]: entry[1] }) : acc, {}));
1960
+ }),
1961
+ map: value(function(fn, thisArg) {
1962
+ return enumify(this.entries().reduce((acc, entry, index) => Object.assign(acc, { [entry[0]]: fn.call(thisArg, entry, index, this) }), {}));
1963
+ }),
1964
+ [Symbol.iterator]: value(function* () {
1965
+ for (const entry of this.entries())
1966
+ yield entry;
1967
+ }),
1968
+ [Symbol.toStringTag]: { enumerable: false, configurable: false, writable: false, value: tag }
1969
+ }));
1970
+ Enumify = (() => {
1971
+ let _classDecorators = [Serializable, StringTag("Enumify")];
1972
+ let _classDescriptor;
1973
+ let _classExtraInitializers = [];
1974
+ let _classThis;
1975
+ var Enumify2 = class {
1976
+ static {
1977
+ _classThis = this;
1978
+ }
1979
+ static {
1980
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
1981
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1982
+ Enumify2 = _classThis = _classDescriptor.value;
1983
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1984
+ __runInitializers(_classThis, _classExtraInitializers);
1985
+ }
1986
+ constructor(list) {
1987
+ return enumify(list);
1988
+ }
1989
+ };
1990
+ return Enumify2 = _classThis;
1991
+ })();
1992
+ }
1993
+ });
1994
+
1995
+ // ../../library/dist/common/runtime/logger.class.js
1996
+ function parseLogLevel(level, fallback = LOG.Info) {
1997
+ if (isNumber(level))
1998
+ return level >= LOG.Off && level <= LOG.Trace ? level : fallback;
1999
+ if (isString(level))
2000
+ return Level[level.toLowerCase()] ?? fallback;
2001
+ return fallback;
2002
+ }
2003
+ var LOG, Method, Level, Logger;
2004
+ var init_logger_class = __esm({
2005
+ "../../library/dist/common/runtime/logger.class.js"() {
2006
+ "use strict";
2007
+ init_tslib_es6();
2008
+ init_assertion_library();
2009
+ init_enumerate_library();
2010
+ init_symbol_library();
2011
+ init_decorator_library();
2012
+ LOG = enumify(["Off", "Error", "Warn", "Info", "Debug", "Trace"]);
2013
+ Method = {
2014
+ Off: "off",
2015
+ Log: "log",
2016
+ Info: "info",
2017
+ Warn: "warn",
2018
+ Debug: "debug",
2019
+ Trace: "trace",
2020
+ Error: "error"
2021
+ };
2022
+ Level = {
2023
+ [Method.Off]: LOG.Off,
2024
+ [Method.Error]: LOG.Error,
2025
+ [Method.Warn]: LOG.Warn,
2026
+ [Method.Info]: LOG.Info,
2027
+ [Method.Log]: LOG.Info,
2028
+ [Method.Debug]: LOG.Debug,
2029
+ [Method.Trace]: LOG.Trace
2030
+ };
2031
+ Logger = (() => {
2032
+ let _classDecorators = [StringTag("Logger")];
2033
+ let _classDescriptor;
2034
+ let _classExtraInitializers = [];
2035
+ let _classThis;
2036
+ var Logger2 = class {
2037
+ static {
2038
+ _classThis = this;
2039
+ }
2040
+ static {
2041
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
2042
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2043
+ Logger2 = _classThis = _classDescriptor.value;
2044
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2045
+ __runInitializers(_classThis, _classExtraInitializers);
2046
+ }
2047
+ #namespace;
2048
+ /** The current verbosity level */
2049
+ level;
2050
+ constructor(namespace, level = LOG.Info) {
2051
+ this.#namespace = namespace.startsWith("[") ? namespace : `[${namespace}]`;
2052
+ this.level = level;
2053
+ }
2054
+ #emit(method, ...msg) {
2055
+ let config;
2056
+ if (msg.length > 0 && isObject(msg[0])) {
2057
+ try {
2058
+ if (msg[0][sym.$LogConfig]) {
2059
+ config = msg.shift();
2060
+ }
2061
+ } catch {
2062
+ }
2063
+ }
2064
+ let activeLevel = this.level;
2065
+ if (config) {
2066
+ if (config.silent === true)
2067
+ return;
2068
+ if (config.debug !== void 0) {
2069
+ activeLevel = parseLogLevel(config.debug, activeLevel);
2070
+ }
2071
+ }
2072
+ if (activeLevel === LOG.Off)
2073
+ return;
2074
+ const methodLevel = Level[method] ?? 0;
2075
+ if (methodLevel > activeLevel)
2076
+ return;
2077
+ const output = msg.map((m) => {
2078
+ if (isError(m))
2079
+ return m.message;
2080
+ if (isObject(m)) {
2081
+ try {
2082
+ const name = m.constructor?.name ?? "Object";
2083
+ if (name === "Object") {
2084
+ const keys = Object.keys(m);
2085
+ const summary = keys.slice(0, 3).join(", ");
2086
+ return `{ ${summary}${keys.length > 3 ? `, ... (+${keys.length - 3} more)` : ""} }`;
2087
+ }
2088
+ return `[${name}]`;
2089
+ } catch {
2090
+ return "[Object]";
2091
+ }
2092
+ }
2093
+ return String(m);
2094
+ }).filter((s) => !isEmpty(s)).join(" ");
2095
+ if (!isEmpty(output)) {
2096
+ const consoleMethod = method;
2097
+ console[consoleMethod](`${this.#namespace} ${output}`);
2098
+ }
2099
+ }
2100
+ /** console.log */
2101
+ log = (...msg) => this.#emit(Method.Log, ...msg);
2102
+ /** console.info */
2103
+ info = (...msg) => this.#emit(Method.Info, ...msg);
2104
+ /** console.warn */
2105
+ warn = (...msg) => this.#emit(Method.Warn, ...msg);
2106
+ /** console.debug */
2107
+ debug = (...msg) => this.#emit(Method.Debug, ...msg);
2108
+ /** console.trace */
2109
+ trace = (...msg) => this.#emit(Method.Trace, ...msg);
2110
+ /** console.error */
2111
+ error = (...msg) => this.#emit(Method.Error, ...msg);
2112
+ };
2113
+ return Logger2 = _classThis;
2114
+ })();
2115
+ }
2116
+ });
2117
+
2118
+ // ../../library/dist/browser/webstore.class.js
2119
+ var webstore_class_exports = {};
2120
+ __export(webstore_class_exports, {
2121
+ WebStore: () => WebStore
2122
+ });
2123
+ var STORAGE, WebStore;
2124
+ var init_webstore_class = __esm({
2125
+ "../../library/dist/browser/webstore.class.js"() {
2126
+ "use strict";
2127
+ init_tslib_es6();
2128
+ init_primitive_library();
2129
+ init_serialize_library();
2130
+ init_type_library();
2131
+ init_assertion_library();
2132
+ init_storage_library();
2133
+ init_decorator_library();
2134
+ STORAGE = {
2135
+ Local: "local",
2136
+ Session: "session"
2137
+ };
2138
+ WebStore = (() => {
2139
+ let _classDecorators = [StringTag("WebStore")];
2140
+ let _classDescriptor;
2141
+ let _classExtraInitializers = [];
2142
+ let _classThis;
2143
+ var WebStore2 = class {
2144
+ static {
2145
+ _classThis = this;
2146
+ }
2147
+ static {
2148
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
2149
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2150
+ WebStore2 = _classThis = _classDescriptor.value;
2151
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2152
+ __runInitializers(_classThis, _classExtraInitializers);
2153
+ }
2154
+ static _localInstance;
2155
+ static _sessionInstance;
2156
+ /**
2157
+ * Lazy getter for the localStorage wrapper instance.
2158
+ *
2159
+ * @returns The WebStore instance for localStorage
2160
+ */
2161
+ static get local() {
2162
+ return WebStore2._localInstance ??= new WebStore2(STORAGE.Local);
2163
+ }
2164
+ /**
2165
+ * Lazy getter for the sessionStorage wrapper instance.
2166
+ *
2167
+ * @returns The WebStore instance for sessionStorage
2168
+ */
2169
+ static get session() {
2170
+ return WebStore2._sessionInstance ??= new WebStore2(STORAGE.Session);
2171
+ }
2172
+ #type;
2173
+ #resolvedStorage;
2174
+ /** Resolved Storage object (resolved safely on access with memory fallback) */
2175
+ get #storage() {
2176
+ if (this.#resolvedStorage)
2177
+ return this.#resolvedStorage;
2178
+ const name = this.#type === STORAGE.Local ? "localStorage" : "sessionStorage";
2179
+ return this.#resolvedStorage = getSafeStorage(name);
2180
+ }
2181
+ #exec(op) {
2182
+ try {
2183
+ return op(this.#storage);
2184
+ } catch (e) {
2185
+ const name = this.#type === STORAGE.Local ? "localStorage" : "sessionStorage";
2186
+ const fallback = getMemoryStorage(name);
2187
+ this.#resolvedStorage = fallback;
2188
+ return op(fallback);
2189
+ }
2190
+ }
2191
+ constructor(storage2 = STORAGE.Local) {
2192
+ this.#type = storage2;
2193
+ }
2194
+ /**
2195
+ * Retrieve a value from storage, optionally providing a default.
2196
+ *
2197
+ * @param key - The property key to retrieve
2198
+ * @param dflt - An optional default value if the key does not exist
2199
+ * @returns The parsed object from storage, or the default/null if not found
2200
+ */
2201
+ get(key, dflt) {
2202
+ const str = this.#exec((storage2) => storage2.getItem(stringify(key)));
2203
+ return isString(str) ? objectify(str) : dflt ?? null;
2204
+ }
2205
+ /**
2206
+ * Store or merge a value into storage for a given key.
2207
+ *
2208
+ * @param key - The property key to set. If nullish, clears the store.
2209
+ * @param obj - The value to store
2210
+ * @param opt - Options (merge behavior)
2211
+ * @returns The WebStore instance for chaining
2212
+ */
2213
+ set(key, obj, opt = { merge: true }) {
2214
+ if (isNullish(key))
2215
+ return this.clear();
2216
+ let prev = this.get(key);
2217
+ const arg = asType(obj);
2218
+ switch (arg.type) {
2219
+ case "Undefined":
2220
+ return this.del(key);
2221
+ // synonym for 'removeItem'
2222
+ case "Object":
2223
+ prev ??= {};
2224
+ return this.#upd(key, opt.merge ? Object.assign(prev, arg.value) : arg.value);
2225
+ case "Array":
2226
+ prev ??= [];
2227
+ return this.#upd(key, opt.merge ? distinct(prev.concat(arg.value)) : obj);
2228
+ case "Map":
2229
+ prev ??= /* @__PURE__ */ new Map();
2230
+ if (opt.merge) {
2231
+ arg.value.forEach((val, key2) => prev.set(key2, val));
2232
+ return this.#upd(key, prev);
2233
+ }
2234
+ return this.#upd(key, arg.value);
2235
+ // else overwrite new Map
2236
+ case "Set":
2237
+ prev ??= /* @__PURE__ */ new Set();
2238
+ if (opt.merge) {
2239
+ arg.value.forEach((itm) => prev.add(itm));
2240
+ return this.#upd(key, prev);
2241
+ }
2242
+ return this.#upd(key, arg.value);
2243
+ // else overwrite new Set
2244
+ default:
2245
+ return this.#upd(key, arg.value);
2246
+ }
2247
+ }
2248
+ /**
2249
+ * Clear all items from this storage instance.
2250
+ *
2251
+ * @returns The WebStore instance for chaining
2252
+ */
2253
+ clear() {
2254
+ try {
2255
+ this.#exec((storage2) => storage2.clear());
2256
+ } catch (e) {
2257
+ console.warn("[WebStore] Failed to clear storage:", e);
2258
+ }
2259
+ return this;
2260
+ }
2261
+ /**
2262
+ * Delete specific keys from storage.
2263
+ *
2264
+ * @param keys - The keys to remove
2265
+ * @returns The WebStore instance for chaining
2266
+ */
2267
+ del(...keys) {
2268
+ keys.forEach((key) => {
2269
+ try {
2270
+ this.#exec((storage2) => storage2.removeItem(stringify(key)));
2271
+ } catch (e) {
2272
+ console.warn(`[WebStore] Failed to removeItem for key '${String(key)}':`, e);
2273
+ }
2274
+ });
2275
+ return this;
2276
+ }
2277
+ /**
2278
+ * Get an array of keys currently in storage. If specific keys are provided, filters by those.
2279
+ *
2280
+ * @param keys - Optional keys to filter by
2281
+ * @returns An array of string/symbol keys
2282
+ */
2283
+ keys(...keys) {
2284
+ return this.entries(...keys).map(([key]) => key);
2285
+ }
2286
+ /**
2287
+ * Get an array of values currently in storage.
2288
+ *
2289
+ * @param keys - Optional keys to retrieve values for
2290
+ * @returns An array of parsed values
2291
+ */
2292
+ values(...keys) {
2293
+ return this.entries(...keys).map(([, val]) => val);
2294
+ }
2295
+ /**
2296
+ * Get an array of [key, value] entries currently in storage.
2297
+ *
2298
+ * @param keys - Optional keys to filter the entries by
2299
+ * @returns An array of key-value tuples
2300
+ */
2301
+ entries(...keys) {
2302
+ const wanted = new Set(keys.map((key) => stringify(key)));
2303
+ const result = [];
2304
+ this.#exec((storage2) => {
2305
+ for (let i = 0; i < storage2.length; i++) {
2306
+ const rawKey = storage2.key(i);
2307
+ if (rawKey === null)
2308
+ continue;
2309
+ if (isEmpty(keys) || wanted.has(rawKey)) {
2310
+ const rawVal = storage2.getItem(rawKey);
2311
+ result.push([objectify(rawKey), objectify(rawVal)]);
2312
+ }
2313
+ }
2314
+ });
2315
+ return result;
2316
+ }
2317
+ /**
2318
+ * Populate the storage from an existing object map.
2319
+ *
2320
+ * @param store - The object/dictionary to populate from
2321
+ * @returns The WebStore instance for chaining
2322
+ */
2323
+ from(store) {
2324
+ ownEntries(store).forEach(([key, val]) => this.set(key, val));
2325
+ return this;
2326
+ }
2327
+ #upd(key, obj) {
2328
+ try {
2329
+ this.#exec((storage2) => storage2.setItem(stringify(key), stringify(obj)));
2330
+ } catch (e) {
2331
+ console.warn(`[WebStore] Failed to setItem for key '${String(key)}':`, e);
2332
+ }
2333
+ return this;
2334
+ }
2335
+ };
2336
+ return WebStore2 = _classThis;
2337
+ })();
2338
+ }
2339
+ });
2340
+
2341
+ // ../../library/dist/browser/mapper.library.js
2342
+ var mapper_library_exports = {};
2343
+ __export(mapper_library_exports, {
2344
+ geoCoords: () => geoCoords,
2345
+ geoLocation: () => geoLocation,
2346
+ mapAddress: () => mapAddress,
2347
+ mapHemisphere: () => mapHemisphere,
2348
+ mapQuery: () => mapQuery
2349
+ });
2350
+ var defaults, context2, mapStore, MAP_KEY, log, storePromise, getStore, geoLocation, geoCoords, mapQuery, mapHemisphere, mapAddress;
2351
+ var init_mapper_library = __esm({
2352
+ "../../library/dist/browser/mapper.library.js"() {
2353
+ "use strict";
2354
+ init_object_library();
2355
+ init_utility_library();
2356
+ init_assertion_library();
2357
+ init_temporal_library();
2358
+ init_international_library();
2359
+ init_logger_class();
2360
+ defaults = { catch: true, debug: 0 };
2361
+ context2 = getContext();
2362
+ mapStore = {};
2363
+ MAP_KEY = "_magma_browser_map_";
2364
+ log = new Logger("[Mapper]");
2365
+ storePromise = null;
2366
+ getStore = () => {
2367
+ if (!storePromise) {
2368
+ storePromise = new Promise((resolve, reject) => {
2369
+ if (context2.type === CONTEXT.Browser) {
2370
+ Promise.resolve().then(() => (init_webstore_class(), webstore_class_exports)).then(({ WebStore: WebStore2 }) => {
2371
+ const local = new WebStore2("local");
2372
+ const stashed = local.get(MAP_KEY, {});
2373
+ if (isReference(stashed)) {
2374
+ if (stashed.geolocation && (!stashed.geolocation.coords || stashed.geolocation.$GeolocationPosition))
2375
+ delete stashed.geolocation;
2376
+ Object.assign(mapStore, stashed);
2377
+ }
2378
+ resolve(local);
2379
+ }).catch(reject);
2380
+ } else {
2381
+ resolve(void 0);
2382
+ }
2383
+ });
2384
+ }
2385
+ return storePromise;
2386
+ };
2387
+ geoLocation = (opts = {}) => getStore().then(() => new Promise((resolve, reject) => {
2388
+ opts = Object.assign({}, defaults, opts);
2389
+ const fulfil = opts.catch ? resolve : reject;
2390
+ if (typeof navigator !== "undefined" && "geolocation" in navigator) {
2391
+ navigator["geolocation"].getCurrentPosition((value2) => {
2392
+ const coords = mapStore.geolocation?.coords;
2393
+ const prevLat = coords?.latitude?.toFixed(3);
2394
+ const prevLng = coords?.longitude?.toFixed(3);
2395
+ const prevTime = mapStore.geolocation?.timestamp ?? 0;
2396
+ const test1 = value2.coords.latitude.toFixed(3) !== prevLat;
2397
+ const test2 = value2.coords.longitude.toFixed(3) !== prevLng;
2398
+ const test3 = prevTime < instant().epochMilliseconds - 36e5;
2399
+ if (test1 || test2 || test3) {
2400
+ Object.assign(mapStore, { georesponse: null });
2401
+ log.info(opts, "GeoLocation: device update");
2402
+ }
2403
+ Object.assign(mapStore, { geolocation: asObject(value2) });
2404
+ resolve(mapStore.geolocation);
2405
+ }, (error) => {
2406
+ Object.assign(mapStore, { geolocation: { error: error.message }, georesponse: null });
2407
+ fulfil(mapStore.geolocation);
2408
+ });
2409
+ } else {
2410
+ Object.assign(mapStore, { geolocation: { error: "Not Supported" }, georesponse: null });
2411
+ fulfil(mapStore.geolocation);
2412
+ }
2413
+ })).finally(() => {
2414
+ const fn = mapStore.geolocation?.error ? log.error : log.info;
2415
+ fn(opts, "geoLocation: ", mapStore.geolocation);
2416
+ getStore().then((store) => store?.set(MAP_KEY, mapStore));
2417
+ });
2418
+ geoCoords = (coords) => new Promise((resolve, reject) => {
2419
+ if (!isNullish(coords))
2420
+ return resolve(coords);
2421
+ geoLocation().then(
2422
+ (geo) => isNullish(geo.error) ? { location: { lat: geo.coords.latitude, lng: geo.coords.longitude } } : null
2423
+ // unsuccessful geolocation
2424
+ ).then((loc) => resolve(loc)).catch((err) => reject(err));
2425
+ });
2426
+ mapQuery = (coords, opts = {}) => getStore().then(() => new Promise((resolve, reject) => {
2427
+ opts = Object.assign({}, defaults, opts);
2428
+ const fulfil = opts.catch ? resolve : reject;
2429
+ geoCoords(coords).then((loc) => {
2430
+ switch (true) {
2431
+ case (context2.type !== CONTEXT.Browser || !window["google"]?.maps):
2432
+ throw new Error("Google Maps API not configured");
2433
+ case isNullish(loc):
2434
+ throw new Error("Cannot determine Coordinates");
2435
+ case isNullish(coords): {
2436
+ const test1 = mapStore.geolocation && mapStore.georesponse;
2437
+ const test2 = isNullish(mapStore.geolocation?.error) && isNullish(mapStore.georesponse?.error);
2438
+ if (test1 && test2) {
2439
+ if (opts.debug)
2440
+ log.debug(opts, "mapQuery: cache");
2441
+ return resolve(mapStore.georesponse);
2442
+ }
2443
+ }
2444
+ // drop through to default:
2445
+ default:
2446
+ new window["google"]["maps"].Geocoder().geocode(loc).then((res) => resolve(mapStore.georesponse = asObject(res)));
2447
+ }
2448
+ }).catch((error) => {
2449
+ Object.assign(mapStore, { georesponse: { error: error.message } });
2450
+ fulfil(mapStore.georesponse);
2451
+ });
2452
+ })).finally(() => {
2453
+ if (opts.debug) {
2454
+ const fn = mapStore.georesponse?.error ? log.error : log.debug;
2455
+ fn(opts, "mapQuery: ", mapStore.georesponse);
2456
+ }
2457
+ getStore().then((store) => store?.set(MAP_KEY, mapStore));
2458
+ });
2459
+ mapHemisphere = (coords, opts = {}) => mapQuery(coords, opts).then((response) => {
2460
+ opts = Object.assign({}, defaults, opts);
2461
+ if (isNullish(response.error)) {
2462
+ if (opts.debug)
2463
+ log.debug(opts, "sphere: ", response);
2464
+ return response.results[0].geometry.location.lat() >= 0 ? "north" : "south";
2465
+ }
2466
+ const sphere = getHemisphere();
2467
+ if (isNullish(sphere) && opts.catch === false)
2468
+ throw new Error("Cannot determine Hemisphere");
2469
+ return sphere;
2470
+ }).catch((error) => {
2471
+ if (opts.debug)
2472
+ log.warn(opts, "mapHemisphere: ", error.message);
2473
+ if (opts.catch === false)
2474
+ throw error;
2475
+ return null;
2476
+ });
2477
+ mapAddress = (coords, opts = {}) => mapQuery(coords, opts).then((response) => {
2478
+ if (!isNullish(response.error))
2479
+ throw new Error(response.error);
2480
+ return response.results[0];
2481
+ }).then(({ formatted_address, address_components }) => address_components.reduce((acc, itm) => {
2482
+ itm.types.filter((type) => type !== "political").forEach((type) => acc[type] = (acc[type] ? acc[type] + "," : "").concat(itm.short_name));
2483
+ return acc;
2484
+ }, { formatted_address })).catch((error) => {
2485
+ opts = Object.assign({}, defaults, opts);
2486
+ if (opts.debug)
2487
+ log.warn(opts, "mapAddress: ", error.message);
2488
+ if (opts.catch === false)
2489
+ throw error;
2490
+ return null;
2491
+ });
2492
+ }
2493
+ });
2494
+
2495
+ // ../../library/dist/common/runtime/request.library.js
2496
+ var request_library_exports = {};
2497
+ __export(request_library_exports, {
2498
+ HTTP: () => HTTP,
2499
+ HttpError: () => HttpError,
2500
+ METHOD: () => METHOD,
2501
+ fetchHead: () => fetchHead,
2502
+ fetchRequest: () => fetchRequest
2503
+ });
2504
+ var TWO_SECONDS, RE_TRAILING_CLOSURE, HTTP, METHOD, HttpError, readBoundedBody, fetchRequest, fetchHead;
2505
+ var init_request_library = __esm({
2506
+ "../../library/dist/common/runtime/request.library.js"() {
2507
+ "use strict";
2508
+ init_assertion_library();
2509
+ TWO_SECONDS = 2e3;
2510
+ RE_TRAILING_CLOSURE = /\);?$/;
2511
+ HTTP = {
2512
+ Ok: 200,
2513
+ PermRedirect: 301,
2514
+ TempRedirect: 302,
2515
+ BadRequest: 400,
2516
+ Unauthorised: 401,
2517
+ Forbidden: 403
2518
+ };
2519
+ METHOD = {
2520
+ Head: "HEAD",
2521
+ Get: "GET",
2522
+ Put: "PUT",
2523
+ Delete: "DELETE",
2524
+ Post: "POST"
2525
+ };
2526
+ HttpError = class extends Error {
2527
+ status;
2528
+ statusText;
2529
+ body;
2530
+ constructor(status, statusText, body) {
2531
+ super(`${status}: ${statusText}`);
2532
+ this.status = status;
2533
+ this.statusText = statusText;
2534
+ this.body = body;
2535
+ this.name = "HttpError";
2536
+ }
2537
+ };
2538
+ readBoundedBody = async (res, maxBytes) => {
2539
+ const contentLength = res.headers?.get?.("Content-Length") || res.headers?.get?.("content-length");
2540
+ if (contentLength) {
2541
+ const bytes = parseInt(contentLength, 10);
2542
+ if (isNumber(bytes) && bytes > maxBytes) {
2543
+ try {
2544
+ await res.body?.cancel();
2545
+ } catch {
2546
+ }
2547
+ throw new HttpError(413, `Content-Length (${bytes}) exceeds limit (${maxBytes} bytes)`, null);
2548
+ }
2549
+ }
2550
+ if (!res.body) {
2551
+ let rawText2;
2552
+ if (isFunction(res.text)) {
2553
+ rawText2 = await res.text();
2554
+ } else if (isFunction(res.json)) {
2555
+ const obj = await res.json();
2556
+ rawText2 = JSON.stringify(obj) ?? "";
2557
+ } else {
2558
+ rawText2 = "";
2559
+ }
2560
+ const byteLength = new TextEncoder().encode(rawText2).byteLength;
2561
+ if (byteLength > maxBytes)
2562
+ throw new HttpError(413, `Payload length (${byteLength}) exceeds limit (${maxBytes} bytes)`, null);
2563
+ return rawText2;
2564
+ }
2565
+ const reader = res.body.getReader();
2566
+ const decoder = new TextDecoder();
2567
+ let totalBytes = 0;
2568
+ let rawText = "";
2569
+ try {
2570
+ while (true) {
2571
+ const { done, value: value2 } = await reader.read();
2572
+ if (done)
2573
+ break;
2574
+ if (value2) {
2575
+ totalBytes += value2.byteLength;
2576
+ if (totalBytes > maxBytes) {
2577
+ try {
2578
+ await reader.cancel();
2579
+ } catch {
2580
+ }
2581
+ throw new HttpError(413, `Streamed payload exceeded limit (${maxBytes} bytes)`, null);
2582
+ }
2583
+ rawText += decoder.decode(value2, { stream: true });
2584
+ }
2585
+ }
2586
+ rawText += decoder.decode();
2587
+ return rawText;
2588
+ } finally {
2589
+ try {
2590
+ reader.releaseLock();
2591
+ } catch {
2592
+ }
2593
+ }
2594
+ };
2595
+ fetchRequest = (url, init = {}, config = {}) => {
2596
+ const signallingInit = {
2597
+ ...init,
2598
+ signal: init.signal ? AbortSignal.any([init.signal, AbortSignal.timeout(config.timeout ?? TWO_SECONDS)]) : AbortSignal.timeout(config.timeout ?? TWO_SECONDS)
2599
+ };
2600
+ return fetch(url, signallingInit).then(async (res) => {
2601
+ if (res.ok) {
2602
+ const contentType = res.headers?.get?.("Content-Type") || res.headers?.get?.("content-type") || "";
2603
+ const isJson = contentType.includes("application/json");
2604
+ if (isDefined(config.maxBytes)) {
2605
+ const rawText = await readBoundedBody(res, config.maxBytes);
2606
+ if (config.rawText)
2607
+ return rawText;
2608
+ if (config.prefix) {
2609
+ const json = rawText.startsWith(config.prefix) ? rawText.substring(config.prefix.length).replace(RE_TRAILING_CLOSURE, "") : rawText;
2610
+ return JSON.parse(json);
2611
+ }
2612
+ if (isJson)
2613
+ return JSON.parse(rawText);
2614
+ try {
2615
+ return JSON.parse(rawText);
2616
+ } catch {
2617
+ return rawText;
2618
+ }
2619
+ }
2620
+ if (config.rawText) {
2621
+ const text = isFunction(res.text) ? await res.text() : "";
2622
+ return text;
2623
+ }
2624
+ if (config.prefix) {
2625
+ const rawPrefixText = await res.text();
2626
+ const json = rawPrefixText.startsWith(config.prefix) ? rawPrefixText.substring(config.prefix.length).replace(RE_TRAILING_CLOSURE, "") : rawPrefixText;
2627
+ return JSON.parse(json);
2628
+ }
2629
+ if (isFunction(res.text)) {
2630
+ const text = await res.text();
2631
+ try {
2632
+ return JSON.parse(text);
2633
+ } catch {
2634
+ return text;
2635
+ }
2636
+ }
2637
+ if (isFunction(res.json))
2638
+ return await res.json();
2639
+ return "";
2640
+ }
2641
+ let errorBody = null;
2642
+ try {
2643
+ const errorText = isDefined(config.maxBytes) ? await readBoundedBody(res, config.maxBytes) : isFunction(res.text) ? await res.text() : "";
2644
+ try {
2645
+ errorBody = JSON.parse(errorText);
2646
+ } catch {
2647
+ errorBody = errorText;
2648
+ }
2649
+ } catch (err) {
2650
+ if (err instanceof HttpError && err.status === 413)
2651
+ throw err;
2652
+ }
2653
+ throw new HttpError(res.status, res.statusText, errorBody);
2654
+ });
2655
+ };
2656
+ fetchHead = (url) => {
2657
+ const signal = AbortSignal.timeout(TWO_SECONDS);
2658
+ const init = { method: METHOD.Head, signal };
2659
+ return fetch(url, init).then(({ ok, status, statusText, headers }) => {
2660
+ if (ok || status === HTTP.Forbidden)
2661
+ return { status, headers };
2662
+ throw new HttpError(status, statusText, null);
2663
+ });
2664
+ };
2665
+ }
2666
+ });
2667
+
2668
+ // ../../library/dist/server/mapper.library.js
2669
+ var mapper_library_exports2 = {};
2670
+ __export(mapper_library_exports2, {
2671
+ serverGeoCoords: () => serverGeoCoords,
2672
+ serverGeoLocation: () => serverGeoLocation,
2673
+ serverMapHemisphere: () => serverMapHemisphere
2674
+ });
2675
+ var log2, DEFAULT_GEO_ENDPOINT, defaults2, requestModulePromise, getRequestModule, serverGeoLocation, serverGeoCoords, serverMapHemisphere;
2676
+ var init_mapper_library2 = __esm({
2677
+ "../../library/dist/server/mapper.library.js"() {
2678
+ "use strict";
2679
+ init_assertion_library();
2680
+ init_international_library();
2681
+ init_logger_class();
2682
+ log2 = new Logger("[ServerMapper]");
2683
+ DEFAULT_GEO_ENDPOINT = "https://ipwho.is";
2684
+ defaults2 = {
2685
+ endpoint: `${DEFAULT_GEO_ENDPOINT}/`,
2686
+ timeout: 3e3,
2687
+ catch: true,
2688
+ debug: 0
2689
+ };
2690
+ requestModulePromise = null;
2691
+ getRequestModule = () => {
2692
+ if (!requestModulePromise)
2693
+ requestModulePromise = Promise.resolve().then(() => (init_request_library(), request_library_exports));
2694
+ return requestModulePromise;
2695
+ };
2696
+ serverGeoLocation = async (opts = {}) => {
2697
+ const options = { ...defaults2, ...opts };
2698
+ const fulfil = options.catch !== false;
2699
+ try {
2700
+ let endpoint = options.endpoint || defaults2.endpoint;
2701
+ if (isString(options.ip)) {
2702
+ const cleanIp = encodeURIComponent(options.ip.trim());
2703
+ const normalized = endpoint.endsWith("/") ? endpoint.slice(0, -1) : endpoint;
2704
+ if (normalized === DEFAULT_GEO_ENDPOINT) {
2705
+ endpoint = `${DEFAULT_GEO_ENDPOINT}/${cleanIp}`;
2706
+ } else if (endpoint.includes("{ip}")) {
2707
+ endpoint = endpoint.replace("{ip}", cleanIp);
2708
+ } else if (cleanIp !== "") {
2709
+ throw new Error(`Custom endpoint must include an '{ip}' placeholder to resolve a specific IP: ${endpoint}`);
2710
+ }
2711
+ }
2712
+ const timeout = options.timeout ?? defaults2.timeout;
2713
+ const { fetchRequest: fetchRequest2 } = await getRequestModule();
2714
+ const data = await fetchRequest2(endpoint, {}, { ...isNumber(timeout) ? { timeout } : {}, maxBytes: 64 * 1024 });
2715
+ if (typeof data !== "object" || isNullish(data))
2716
+ throw new Error("Geolocation lookup failed");
2717
+ if (data.status === "fail" || data.success === false)
2718
+ throw new Error(data.message || data.reason || "Geolocation lookup failed");
2719
+ const lat = isNumber(data.lat) ? data.lat : data.latitude;
2720
+ const lng = isNumber(data.lon) ? data.lon : data.lng ?? data.longitude;
2721
+ if (!isNumber(lat) || !isNumber(lng))
2722
+ throw new Error("Geolocation lookup failed");
2723
+ const tz = isString(data.timezone) ? data.timezone : data.timezone?.id ?? data.timeZone;
2724
+ const result = {
2725
+ lat,
2726
+ lng,
2727
+ latitude: lat,
2728
+ longitude: lng,
2729
+ ...isString(data.country || data.countryName || data.country_name) ? { country: data.country || data.countryName || data.country_name } : {},
2730
+ ...isString(data.city || data.cityName || data.city_name) ? { city: data.city || data.cityName || data.city_name } : {},
2731
+ ...isString(tz) ? { timezone: tz } : {},
2732
+ ...isString(data.query || data.ip || data.ip_address) ? { query: data.query || data.ip || data.ip_address } : {},
2733
+ status: "success"
2734
+ };
2735
+ if (options.debug)
2736
+ log2.info(options, "serverGeoLocation success: ", result);
2737
+ return result;
2738
+ } catch (err) {
2739
+ const errorMsg = err?.message || "Server geolocation error";
2740
+ if (options.debug)
2741
+ log2.error(options, "serverGeoLocation error: ", errorMsg);
2742
+ if (!fulfil)
2743
+ throw err;
2744
+ return { error: errorMsg, status: "fail" };
2745
+ }
2746
+ };
2747
+ serverGeoCoords = async (coords, opts) => {
2748
+ if (!isNullish(coords)) {
2749
+ const lat = coords.latitude ?? coords.lat;
2750
+ const lng = coords.longitude ?? coords.lng ?? coords.lon ?? coords.long;
2751
+ if (isNumber(lat) && isNumber(lng))
2752
+ return { lat, lng };
2753
+ }
2754
+ const geo = await serverGeoLocation(opts);
2755
+ if (isNullish(geo.error) && isNumber(geo.lat) && isNumber(geo.lng))
2756
+ return { lat: geo.lat, lng: geo.lng };
2757
+ return null;
2758
+ };
2759
+ serverMapHemisphere = async (coords, opts) => {
2760
+ const resolved = await serverGeoCoords(coords, opts);
2761
+ if (resolved)
2762
+ return resolved.lat >= 0 ? "north" : "south";
2763
+ return getHemisphere() ?? null;
2764
+ };
2765
+ }
2766
+ });
2767
+
2768
+ // auto-inject-version:@magmacomputing/tempo/plugin/sdk
2769
+ var sdk_exports = {};
2770
+ __export(sdk_exports, {
2771
+ definePlugin: () => definePlugin,
2772
+ defineTerm: () => defineTerm
2773
+ });
2774
+ __reExport(sdk_exports, sdk_star);
2775
+ import * as sdk_star from "@magmacomputing/tempo/plugin/sdk";
2776
+ import { definePlugin as originalPlugin, defineTerm as originalTerm } from "@magmacomputing/tempo/plugin/sdk";
2777
+ var definePlugin = (config) => originalPlugin({ ...config, version: "1.2.0" });
2778
+ var defineTerm = (config) => originalTerm({ ...config, version: "1.2.0" });
2779
+
2780
+ // ../../library/dist/common/runtime/mapper.library.js
2781
+ init_utility_library();
2782
+ init_assertion_library();
2783
+ init_storage_library();
2784
+
2785
+ // ../../library/dist/common/runtime/evaluation.library.js
2786
+ init_assertion_library();
2787
+ function evaluate(...values) {
2788
+ for (const val of values) {
2789
+ const resolved = isFunction(val) ? val() : val;
2790
+ if (resolved !== void 0)
2791
+ return resolved;
2792
+ }
2793
+ return void 0;
2794
+ }
2795
+
2796
+ // ../../library/dist/common/runtime/mapper.library.js
2797
+ var MAP_KEY2 = "_magma_geo_";
2798
+ var DEFAULT_GEO_TTL = 24 * 60 * 60 * 1e3;
2799
+ var GEO_PROPERTIES = [
2800
+ "latitude",
2801
+ "lat",
2802
+ "longitude",
2803
+ "lng",
2804
+ "lon",
2805
+ "long",
2806
+ "elevation",
2807
+ "sphere",
2808
+ "country",
2809
+ "city",
2810
+ "timezone",
2811
+ "tz"
2812
+ ];
2813
+ var normalizeLat = (lat) => isNumber(lat) && lat >= -90 && lat <= 90 ? Math.round(lat * 1e3) / 1e3 : void 0;
2814
+ var normalizeLng = (lng) => isNumber(lng) && lng >= -180 && lng <= 180 ? Math.round(lng * 1e3) / 1e3 : void 0;
2815
+ var normalizeCoords = (lat, lng) => {
2816
+ const nLat = normalizeLat(lat);
2817
+ const nLng = normalizeLng(lng);
2818
+ return nLat !== void 0 && nLng !== void 0 ? { lat: nLat, lng: nLng } : void 0;
2819
+ };
2820
+ var resolveSphere = (sphere, lat) => {
2821
+ if (sphere === "north" || sphere === "south" || sphere === "equator")
2822
+ return sphere;
2823
+ if (isNumber(lat))
2824
+ return lat > 1e-3 ? "north" : lat < -1e-3 ? "south" : "equator";
2825
+ return void 0;
2826
+ };
2827
+ var coerceGeo = (input) => {
2828
+ if (isString(input) && input.includes(",")) {
2829
+ const segments = input.split(",").map((s) => s.trim());
2830
+ const parts = segments.map((s) => s === "" ? NaN : Number(s));
2831
+ if (parts.length >= 2 && !isNaN(parts[0]) && !isNaN(parts[1])) {
2832
+ const coords = normalizeCoords(parts[0], parts[1]);
2833
+ if (coords) {
2834
+ const result2 = { latitude: coords.lat, longitude: coords.lng };
2835
+ const sphere2 = resolveSphere(void 0, coords.lat);
2836
+ if (sphere2)
2837
+ result2.sphere = sphere2;
2838
+ return result2;
2839
+ }
2840
+ }
2841
+ return void 0;
2842
+ }
2843
+ if (isPrimitive(input))
2844
+ return void 0;
2845
+ if (Array.isArray(input) && input.length >= 2) {
2846
+ const coords = normalizeCoords(input[0], input[1]);
2847
+ if (coords) {
2848
+ const result2 = { latitude: coords.lat, longitude: coords.lng };
2849
+ const sphere2 = resolveSphere(void 0, coords.lat);
2850
+ if (sphere2)
2851
+ result2.sphere = sphere2;
2852
+ return result2;
2853
+ }
2854
+ return void 0;
2855
+ }
2856
+ const geo = input.geo ?? input;
2857
+ const cfg = input.config?.geo ?? input.config;
2858
+ const lat = evaluate(geo?.latitude, geo?.lat, input.latitude, input.lat, cfg?.latitude, cfg?.lat);
2859
+ const lng = evaluate(geo?.longitude, geo?.lng, geo?.lon, geo?.long, input.longitude, input.lng, input.lon, input.long, cfg?.longitude, cfg?.lng, cfg?.lon, cfg?.long);
2860
+ const elevation = evaluate(geo?.elevation, input.elevation, cfg?.elevation);
2861
+ const sphere = evaluate(geo?.sphere, input.sphere, cfg?.sphere);
2862
+ const country = evaluate(geo?.country, input.country, cfg?.country);
2863
+ const city = evaluate(geo?.city, input.city, cfg?.city);
2864
+ const timezone = evaluate(geo?.timezone, geo?.tz, input.timezone, input.tz, cfg?.timezone, cfg?.tz);
2865
+ const result = {};
2866
+ const nLat = normalizeLat(lat);
2867
+ const nLng = normalizeLng(lng);
2868
+ if (nLat !== void 0)
2869
+ result.latitude = nLat;
2870
+ if (nLng !== void 0)
2871
+ result.longitude = nLng;
2872
+ if (isNumber(elevation))
2873
+ result.elevation = Math.round(elevation * 1e3) / 1e3;
2874
+ const resolvedSphere = resolveSphere(sphere, result.latitude);
2875
+ if (resolvedSphere)
2876
+ result.sphere = resolvedSphere;
2877
+ if (isString(country))
2878
+ result.country = country;
2879
+ if (isString(city))
2880
+ result.city = city;
2881
+ if (isString(timezone))
2882
+ result.timezone = timezone;
2883
+ const explicitGeo = isReference(input.geo) ? input.geo : isReference(input.config?.geo) ? input.config.geo : void 0;
2884
+ if (isReference(explicitGeo)) {
2885
+ for (const key of Object.keys(explicitGeo)) {
2886
+ if (isSafeKey(key) && !GEO_PROPERTIES.includes(key))
2887
+ result[key] = explicitGeo[key];
2888
+ }
2889
+ }
2890
+ return Object.keys(result).length > 0 ? result : void 0;
2891
+ };
2892
+ var resolveCacheKey = (keyOrOpts) => {
2893
+ if (isString(keyOrOpts) && !isEmpty(keyOrOpts)) {
2894
+ const trimmed = keyOrOpts.trim();
2895
+ return trimmed.startsWith(MAP_KEY2) ? trimmed : `${MAP_KEY2}:${trimmed}`;
2896
+ }
2897
+ if (keyOrOpts && isObject(keyOrOpts)) {
2898
+ const k = keyOrOpts.key ?? keyOrOpts.ip ?? keyOrOpts.query;
2899
+ if (isString(k) && !isEmpty(k))
2900
+ return `${MAP_KEY2}:${k.trim()}`;
2901
+ }
2902
+ return MAP_KEY2;
2903
+ };
2904
+ var getStashedGeo = (keyOrOpts) => {
2905
+ const cacheKey = resolveCacheKey(keyOrOpts);
2906
+ try {
2907
+ const raw = getStorage(cacheKey) ?? (typeof localStorage !== "undefined" ? localStorage.getItem(cacheKey) : void 0);
2908
+ if (!raw)
2909
+ return void 0;
2910
+ const parsed = isString(raw) && (raw.startsWith("{") || raw.startsWith("[")) ? JSON.parse(raw) : raw;
2911
+ if (isObject(parsed)) {
2912
+ if (isNumber(parsed._expires) && Date.now() > parsed._expires) {
2913
+ clearStashedGeo(keyOrOpts);
2914
+ return void 0;
2915
+ }
2916
+ }
2917
+ if (isString(parsed) && parsed.includes(",")) {
2918
+ const parts = parsed.split(",").map((s) => parseFloat(s.trim()));
2919
+ const coords = normalizeCoords(parts[0], parts[1]);
2920
+ if (coords) {
2921
+ return {
2922
+ latitude: coords.lat,
2923
+ longitude: coords.lng,
2924
+ sphere: resolveSphere(void 0, coords.lat)
2925
+ };
2926
+ }
2927
+ }
2928
+ if (isObject(parsed)) {
2929
+ const rawCoords = parsed.geolocation?.coords ?? parsed.coords ?? parsed;
2930
+ const lat = rawCoords?.latitude ?? rawCoords?.lat;
2931
+ const lng = rawCoords?.longitude ?? rawCoords?.lng ?? rawCoords?.lon ?? rawCoords?.long;
2932
+ const coords = normalizeCoords(lat, lng);
2933
+ if (coords) {
2934
+ const result = { latitude: coords.lat, longitude: coords.lng };
2935
+ const elevation = parsed.elevation ?? rawCoords.elevation;
2936
+ if (isNumber(elevation))
2937
+ result.elevation = Math.round(elevation * 1e3) / 1e3;
2938
+ result.sphere = resolveSphere(parsed.sphere, coords.lat);
2939
+ if (isString(parsed.country))
2940
+ result.country = parsed.country;
2941
+ if (isString(parsed.city))
2942
+ result.city = parsed.city;
2943
+ if (isString(parsed.timezone))
2944
+ result.timezone = parsed.timezone;
2945
+ return result;
2946
+ }
2947
+ }
2948
+ } catch {
2949
+ }
2950
+ return void 0;
2951
+ };
2952
+ var stashGeo = (coords, ttl = DEFAULT_GEO_TTL, keyOrOpts) => {
2953
+ const cacheKey = resolveCacheKey(keyOrOpts);
2954
+ const payload = isNumber(ttl) && ttl > 0 ? { ...coords, _expires: Date.now() + ttl } : coords;
2955
+ setStorage(cacheKey, payload, { ttl });
2956
+ };
2957
+ var clearStashedGeo = (keyOrOpts) => {
2958
+ const cacheKey = resolveCacheKey(keyOrOpts);
2959
+ setStorage(cacheKey, void 0);
2960
+ };
2961
+ var geoLookup = async (opts = {}) => {
2962
+ const useCache = opts.refresh !== true;
2963
+ if (useCache) {
2964
+ const stashed = getStashedGeo(opts);
2965
+ if (stashed && isNumber(stashed.latitude) && isNumber(stashed.longitude)) {
2966
+ const { latitude, longitude, ...rest } = stashed;
2967
+ return {
2968
+ ...rest,
2969
+ status: "cached",
2970
+ lat: latitude,
2971
+ lng: longitude,
2972
+ latitude,
2973
+ longitude
2974
+ };
2975
+ }
2976
+ }
2977
+ const { type } = getContext();
2978
+ let res;
2979
+ switch (type) {
2980
+ case CONTEXT.Browser: {
2981
+ const { geoLocation: geoLocation2 } = await Promise.resolve().then(() => (init_mapper_library(), mapper_library_exports));
2982
+ const browserRes = await geoLocation2(opts);
2983
+ if (browserRes.error)
2984
+ return { error: browserRes.error };
2985
+ const lat = browserRes.coords?.latitude;
2986
+ const lng = browserRes.coords?.longitude;
2987
+ res = { ...browserRes, lat, lng, latitude: lat, longitude: lng };
2988
+ break;
2989
+ }
2990
+ case CONTEXT.WebWorker:
2991
+ case CONTEXT.NodeJS:
2992
+ case CONTEXT.Deno:
2993
+ default: {
2994
+ const { serverGeoLocation: serverGeoLocation2 } = await Promise.resolve().then(() => (init_mapper_library2(), mapper_library_exports2));
2995
+ res = await serverGeoLocation2(opts);
2996
+ break;
2997
+ }
2998
+ }
2999
+ const rawLat = res.latitude ?? res.lat;
3000
+ const rawLng = res.longitude ?? res.lng;
3001
+ const coords = normalizeCoords(rawLat, rawLng);
3002
+ if (isNullish(res.error) && coords) {
3003
+ const sphere = resolveSphere(res.sphere, coords.lat);
3004
+ res.lat = coords.lat;
3005
+ res.lng = coords.lng;
3006
+ res.latitude = coords.lat;
3007
+ res.longitude = coords.lng;
3008
+ res.sphere = sphere;
3009
+ const stashPayload = {
3010
+ latitude: coords.lat,
3011
+ longitude: coords.lng,
3012
+ sphere,
3013
+ ...isString(res.city) ? { city: res.city } : {},
3014
+ ...isString(res.country) ? { country: res.country } : {},
3015
+ ...isNumber(res.elevation) ? { elevation: Math.round(res.elevation * 1e3) / 1e3 } : {},
3016
+ ...isString(res.timezone) ? { timezone: res.timezone } : {}
3017
+ };
3018
+ try {
3019
+ const ttl = isNumber(opts.ttl) ? opts.ttl : DEFAULT_GEO_TTL;
3020
+ stashGeo(stashPayload, ttl, opts);
3021
+ } catch {
3022
+ }
3023
+ }
3024
+ return res;
3025
+ };
3026
+ var resolveGeoCoordinates = async (input, opts = {}) => {
3027
+ const coerced = coerceGeo(input);
3028
+ if (coerced && isNumber(coerced.latitude) && isNumber(coerced.longitude))
3029
+ return {
3030
+ ...coerced,
3031
+ lat: coerced.latitude,
3032
+ lng: coerced.longitude
3033
+ };
3034
+ const stashed = opts.refresh === true ? void 0 : getStashedGeo(opts);
3035
+ if (stashed && isNumber(stashed.latitude) && isNumber(stashed.longitude))
3036
+ return {
3037
+ ...stashed,
3038
+ lat: stashed.latitude,
3039
+ lng: stashed.longitude
3040
+ };
3041
+ const lookup = await geoLookup(opts);
3042
+ const coords = normalizeCoords(lookup.lat, lookup.lng);
3043
+ if (isNullish(lookup.error) && coords) {
3044
+ const sphere = resolveSphere(lookup.sphere, coords.lat);
3045
+ return {
3046
+ ...lookup,
3047
+ lat: coords.lat,
3048
+ lng: coords.lng,
3049
+ latitude: coords.lat,
3050
+ longitude: coords.lng,
3051
+ sphere
3052
+ };
3053
+ }
3054
+ return null;
3055
+ };
3056
+ function haversineDistance(from, to, unit = "km") {
3057
+ const c1 = coerceGeo(from);
3058
+ const c2 = coerceGeo(to);
3059
+ if (!c1 || !c2 || !isNumber(c1.latitude) || !isNumber(c1.longitude) || !isNumber(c2.latitude) || !isNumber(c2.longitude)) {
3060
+ return NaN;
3061
+ }
3062
+ const toRad = Math.PI / 180;
3063
+ const lat1 = c1.latitude * toRad;
3064
+ const lng1 = c1.longitude * toRad;
3065
+ const lat2 = c2.latitude * toRad;
3066
+ const lng2 = c2.longitude * toRad;
3067
+ const dLat = lat2 - lat1;
3068
+ const dLng = lng2 - lng1;
3069
+ const a = Math.sin(dLat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLng / 2) ** 2;
3070
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
3071
+ let radius;
3072
+ if (unit === "miles") {
3073
+ radius = 3958.7613;
3074
+ } else if (unit === "m") {
3075
+ radius = 63710088e-1;
3076
+ } else {
3077
+ radius = 6371.0088;
3078
+ }
3079
+ const dist = radius * c;
3080
+ return unit === "m" ? Math.round(dist) : Math.round(dist * 1e3) / 1e3;
3081
+ }
3082
+ var resolveCivilTimezoneOffset = (tz, epochMs) => {
3083
+ try {
3084
+ if (typeof Temporal !== "undefined" && typeof Temporal.Instant?.fromEpochMilliseconds === "function") {
3085
+ const zdt = Temporal.Instant.fromEpochMilliseconds(epochMs).toZonedDateTimeISO(tz);
3086
+ return zdt.offsetNanoseconds / 6e10;
3087
+ }
3088
+ const parts = new Intl.DateTimeFormat("en-US", {
3089
+ timeZone: tz,
3090
+ timeZoneName: "longOffset",
3091
+ year: "numeric"
3092
+ }).formatToParts(new Date(epochMs));
3093
+ const tzPart = parts.find((p) => p.type === "timeZoneName")?.value;
3094
+ if (tzPart) {
3095
+ if (tzPart === "GMT" || tzPart === "UTC")
3096
+ return 0;
3097
+ const match = tzPart.match(/GMT([+-])(\d{2}):(\d{2})/);
3098
+ if (match) {
3099
+ const sign = match[1] === "-" ? -1 : 1;
3100
+ return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3], 10));
3101
+ }
3102
+ }
3103
+ } catch {
3104
+ }
3105
+ return void 0;
3106
+ };
3107
+ function solarOffset(coords, options) {
3108
+ const geo = coerceGeo(coords);
3109
+ if (!geo || !isNumber(geo.latitude) || !isNumber(geo.longitude) || isNaN(geo.latitude) || isNaN(geo.longitude)) {
3110
+ return NaN;
3111
+ }
3112
+ const lng = geo.longitude;
3113
+ const tz = options?.timeZone ?? (isReference(coords) ? coords.timezone ?? coords.tz : void 0) ?? geo.timezone;
3114
+ const dateVal = options?.date ?? (isReference(coords) && isNumber(coords.epoch?.ms) ? coords.epoch.ms : Date.now());
3115
+ const epochMs = typeof dateVal === "number" ? dateVal : isString(dateVal) ? Date.parse(dateVal) : isDate(dateVal) ? dateVal.getTime() : isReference(dateVal) && isNumber(dateVal?.epoch?.ms) ? dateVal.epoch.ms : Date.now();
3116
+ if (!Number.isFinite(epochMs))
3117
+ return NaN;
3118
+ const offsetMinutes = isText(tz) ? resolveCivilTimezoneOffset(tz, epochMs) : void 0;
3119
+ const refMeridian = offsetMinutes !== void 0 ? offsetMinutes / 60 * 15 : Math.round(lng / 15) * 15;
3120
+ const deltaLng = lng - refMeridian;
3121
+ let offsetMin = deltaLng * 4;
3122
+ if (options?.apparent) {
3123
+ const d = new Date(epochMs);
3124
+ const startOfYear = Date.UTC(d.getUTCFullYear(), 0, 1);
3125
+ const dayOfYear = Math.floor((epochMs - startOfYear) / 864e5) + 1;
3126
+ const gamma = 2 * Math.PI / 365 * (dayOfYear - 1);
3127
+ const eqTime = 229.18 * (75e-6 + 1868e-6 * Math.cos(gamma) - 0.032077 * Math.sin(gamma) - 0.014615 * Math.cos(2 * gamma) - 0.040849 * Math.sin(2 * gamma));
3128
+ offsetMin += eqTime;
3129
+ }
3130
+ const unit = options?.unit ?? "minutes";
3131
+ let res;
3132
+ if (unit === "seconds") {
3133
+ res = offsetMin * 60;
3134
+ } else if (unit === "hours") {
3135
+ res = offsetMin / 60;
3136
+ } else {
3137
+ res = offsetMin;
3138
+ }
3139
+ const precision = options?.precision ?? 2;
3140
+ const factor = Math.pow(10, precision);
3141
+ return Math.round(res * factor) / factor;
3142
+ }
3143
+
3144
+ // src/index.ts
3145
+ init_mapper_library2();
3146
+ init_mapper_library();
3147
+ init_assertion_library();
3148
+ var GeoPlugin = definePlugin({
3149
+ name: "geo",
3150
+ install(TempoClass, options) {
3151
+ const installedClass = TempoClass || this;
3152
+ const getEffectiveOptions = (callSiteOpts, instance) => {
3153
+ const classOpts = installedClass.config?.pluginOptions?.geo;
3154
+ const instanceOpts = instance?.config?.pluginOptions?.geo;
3155
+ return {
3156
+ ...isObject(options) ? options : {},
3157
+ ...isObject(classOpts) ? classOpts : {},
3158
+ ...isObject(instanceOpts) ? instanceOpts : {},
3159
+ ...isObject(callSiteOpts) ? callSiteOpts : {}
3160
+ };
3161
+ };
3162
+ if (!Object.hasOwn(installedClass, "geo")) {
3163
+ const geoNamespace = {
3164
+ lookup: (opts) => geoLookup(getEffectiveOptions(opts)),
3165
+ resolve: (target, opts) => resolveGeoCoordinates(target, getEffectiveOptions(opts, target)),
3166
+ coerce: coerceGeo,
3167
+ distance: haversineDistance,
3168
+ solarOffset,
3169
+ stash: stashGeo,
3170
+ clear: clearStashedGeo,
3171
+ get: getStashedGeo,
3172
+ server: serverGeoLocation,
3173
+ browser: geoLocation,
3174
+ get current() {
3175
+ return getStashedGeo() ?? installedClass.config?.geo;
3176
+ }
3177
+ };
3178
+ Object.defineProperty(installedClass, "geo", {
3179
+ value: (0, sdk_exports.deepFreeze)(geoNamespace),
3180
+ writable: false,
3181
+ configurable: false,
3182
+ enumerable: false
3183
+ });
3184
+ }
3185
+ TempoClass.prototype.geoLocate = async function(opts) {
3186
+ const effectiveOpts = getEffectiveOptions(opts, this);
3187
+ const setTimezone = effectiveOpts?.setTimezone !== false;
3188
+ const coords = await resolveGeoCoordinates(this, effectiveOpts);
3189
+ if (coords) {
3190
+ const existingGeo = isObject(this.config.geo) ? this.config.geo : {};
3191
+ const customKeys = {};
3192
+ for (const key of Object.keys(existingGeo)) {
3193
+ if (isSafeKey(key) && !GEO_PROPERTIES.includes(key))
3194
+ customKeys[key] = existingGeo[key];
3195
+ }
3196
+ const callSiteGeo = coerceGeo(opts) ?? {};
3197
+ if (isObject(opts)) {
3198
+ for (const key of Object.keys(opts)) {
3199
+ if (isSafeKey(key) && !["setTimezone", "refresh", "ttl", "endpoint", "timeout", "catch", "debug", "geo"].includes(key)) {
3200
+ if (!GEO_PROPERTIES.includes(key))
3201
+ customKeys[key] = opts[key];
3202
+ }
3203
+ }
3204
+ }
3205
+ const preservedElevation = isNumber(coords?.elevation) ? coords.elevation : isNumber(existingGeo.elevation) ? existingGeo.elevation : void 0;
3206
+ const mergedGeo = {
3207
+ ...customKeys,
3208
+ ...coords,
3209
+ ...isNumber(preservedElevation) ? { elevation: preservedElevation } : {},
3210
+ ...callSiteGeo
3211
+ };
3212
+ if (isNumber(mergedGeo.latitude)) mergedGeo.latitude = Math.round(mergedGeo.latitude * 1e3) / 1e3;
3213
+ if (isNumber(mergedGeo.longitude)) mergedGeo.longitude = Math.round(mergedGeo.longitude * 1e3) / 1e3;
3214
+ if (!mergedGeo.sphere && isNumber(mergedGeo.latitude)) {
3215
+ mergedGeo.sphere = mergedGeo.latitude > 1e-3 ? "north" : mergedGeo.latitude < -1e-3 ? "south" : "equator";
3216
+ }
3217
+ let instance = this;
3218
+ const targetTz = mergedGeo.timezone;
3219
+ if (setTimezone && isString(targetTz) && !isEmpty(targetTz))
3220
+ instance = this.set({ timeZone: targetTz });
3221
+ return new TempoClass(instance, {
3222
+ ...instance.config,
3223
+ geo: (0, sdk_exports.deepFreeze)(mergedGeo),
3224
+ ...mergedGeo.sphere ? { sphere: mergedGeo.sphere } : {}
3225
+ });
3226
+ }
3227
+ return this;
3228
+ };
3229
+ TempoClass.prototype.geoLookup = async function(opts) {
3230
+ return resolveGeoCoordinates(this, getEffectiveOptions(opts, this));
3231
+ };
3232
+ TempoClass.prototype.geoDistance = function(other, unit) {
3233
+ return haversineDistance(this, other, unit);
3234
+ };
3235
+ TempoClass.prototype.geoSolarOffset = function(options2) {
3236
+ return solarOffset(this, options2);
3237
+ };
3238
+ }
3239
+ });
3240
+ var geoPlugin = GeoPlugin;
3241
+ var index_default = GeoPlugin;
3242
+
3243
+ // src/install.ts
3244
+ (0, sdk_exports.autoInstall)(GeoPlugin);
3245
+ export {
3246
+ GEO_PROPERTIES,
3247
+ GeoPlugin,
3248
+ clearStashedGeo,
3249
+ coerceGeo,
3250
+ index_default as default,
3251
+ geoLocation,
3252
+ geoLookup,
3253
+ geoPlugin,
3254
+ getStashedGeo,
3255
+ haversineDistance,
3256
+ resolveGeoCoordinates,
3257
+ serverGeoCoords,
3258
+ serverGeoLocation,
3259
+ serverMapHemisphere,
3260
+ solarOffset,
3261
+ stashGeo
3262
+ };