@magmacomputing/tempo-plugin-geo 1.1.0 → 1.3.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.
- package/CHANGELOG.md +31 -0
- package/README.md +10 -0
- package/dist/index.d.ts +25 -4
- package/dist/index.global.min.js +1 -1
- package/dist/index.js +466 -60
- package/dist/install.d.ts +2 -0
- package/dist/install.global.min.js +1 -0
- package/dist/install.js +3668 -0
- package/package.json +17 -11
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ All notable changes to the `@magmacomputing/tempo-plugin-geo` project will be do
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0] - 2026-09-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Pluggable Geocoding Provider Gateway (`GeoProvider`)**:
|
|
12
|
+
- `GeoProvider` interface: Standardized adapter interface for custom geocoding and geolocation providers (`lookup`, `reverseGeocode`, `forwardGeocode`).
|
|
13
|
+
- `Tempo.geo.setProvider(provider)` & `Tempo.geo.getProvider()`: Global registration of custom geolocation providers on the static namespace.
|
|
14
|
+
- `Tempo.geo.reverse(coords, options?)`: Reverse geocodes coordinates to address/locality metadata.
|
|
15
|
+
- `Tempo.geo.forward(query, options?)`: Forward geocodes place query strings to resolved coordinates.
|
|
16
|
+
- Call-site provider override: `t.geoLocate({ provider })` to dynamically override provider per operation.
|
|
17
|
+
- Automatic 24-hour BoundedCache integration and graceful failover to default environment lookup.
|
|
18
|
+
- **Navigation & Transit Analytics (`Tempo.geo` Static Namespace)**:
|
|
19
|
+
- `Tempo.geo.velocity(from, to, options?)`: Calculates travel speed between two timestamped geographic instances or coordinate objects in `km/h`, `mph`, or `m/s`.
|
|
20
|
+
- `Tempo.geo.isImpossibleTravel(from, to, options?)`: Evaluates physical travel feasibility against commercial aviation thresholds (default: 900 km/h) for cybersecurity anomaly detection and impossible travel prevention.
|
|
21
|
+
- `Tempo.geo.bearing(from, to, options?)`: Computes Great-Circle forward azimuth compass bearing in degrees (0° to 360°).
|
|
22
|
+
- `Tempo.geo.midpoint(from, to)`: Computes Great-Circle geographic midpoint with automatic hemisphere inference (`{ latitude, longitude, sphere }`).
|
|
23
|
+
- **Spatial Boundaries & Geofencing (`Tempo.geo` Static Namespace)**:
|
|
24
|
+
- `Tempo.geo.isWithin(from, to, maxDistance, unit?)`: Radial proximity query evaluating whether coordinates are within a specified distance (`'km'`, `'miles'`, `'m'`).
|
|
25
|
+
- `Tempo.geo.inBoundingBox(coords, bbox)`: Spatial containment test evaluating if coordinates fall within rectangular bounding box, including antimeridian crossing (180° longitude wrap).
|
|
26
|
+
- **Automated Cultural Sync (`t.geoLocate({ setLocale })`)**:
|
|
27
|
+
- `LocaleSyncMode`: Synchronizes BCP 47 locale during `.geoLocate()` with default regional adaptation (`true` / `'regional'`), preserving source language while adapting the cultural calendar (e.g. `en-US` ➜ `en-SA` for Saturday-start weeks and Friday/Saturday weekends).
|
|
28
|
+
- Supports `'native'` (e.g. `ar-SA`), custom BCP 47 tags (`'es-SA'`, `'fr-CH'`), and opt-out (`false` / `'none'`).
|
|
29
|
+
- **Exported Standalone Functional Utilities**:
|
|
30
|
+
- Direct named exports: `calculateBearing`, `calculateMidpoint`, `calculateVelocity`, `isImpossibleTravel`, `isWithin`, `inBoundingBox`, `resolveCulturalLocale`, and types `BearingOptions`, `VelocityOptions`, `ImpossibleTravelOptions`, `BoundingBox`, `LocaleSyncMode`, `TimeUnit`.
|
|
31
|
+
|
|
32
|
+
## [1.2.0] - 2026-09-18
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- **`/install` Subpath Side-Effect Entry Point**:
|
|
36
|
+
- Added dedicated `@magmacomputing/tempo-plugin-geo/install` subpath for one-line side-effect installation (`import '@magmacomputing/tempo-plugin-geo/install'`).
|
|
37
|
+
- Automatically mounts `Tempo.geo` on `globalThis.Tempo` or imported `Tempo` while preserving 100% tree-shakeability for the main package entry point.
|
|
38
|
+
|
|
8
39
|
## [1.1.0] - 2026-09-16
|
|
9
40
|
|
|
10
41
|
### Added
|
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ const localTime = await t.geoLocate();
|
|
|
50
50
|
console.log(localTime.geo?.latitude, localTime.geo?.longitude);
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
> ⚡ **[Try this live in the interactive Tempo Sandbox ↗](https://magmacomputing.github.io/magma/repl/index.html?plugin=geo)**
|
|
54
|
+
|
|
53
55
|
### 2. Functional Tree-Shakeable APIs
|
|
54
56
|
|
|
55
57
|
All underlying utilities can be imported as standalone tree-shakeable functions without augmenting `Tempo`:
|
|
@@ -78,6 +80,14 @@ const t = new Tempo('2026-06-21', { geo: coords });
|
|
|
78
80
|
| `Tempo.geo.lookup(opts?)` | Universal geolocation lookup (browser hardware GPS or server IP lookup) cached for 24h. Supports `{ refresh: true }`. |
|
|
79
81
|
| `Tempo.geo.resolve(input, opts?)` | Asynchronously resolves coordinates from an instance, configuration, or ambient storage cache. |
|
|
80
82
|
| `Tempo.geo.coerce(input)` | Pure function normalizing various coordinate formats (`lat/lng`, `latitude/longitude`, etc.) into a canonical `GeoConfig`. |
|
|
83
|
+
| `Tempo.geo.distance(from, to, unit?)` | Calculates Great-Circle distance using Haversine formula (`'km'`, `'miles'`, `'m'`). |
|
|
84
|
+
| `Tempo.geo.isWithin(from, to, maxDist, unit?)` | Radial proximity query testing if distance between coordinates is $\le$ `maxDist`. |
|
|
85
|
+
| `Tempo.geo.inBoundingBox(coords, bbox)` | Spatial containment check inside rectangular bounding box (supports antimeridian crossing). |
|
|
86
|
+
| `Tempo.geo.bearing(from, to, opts?)` | Calculates Great-Circle forward azimuth compass bearing in degrees ($0^\circ$ to $360^\circ$). |
|
|
87
|
+
| `Tempo.geo.midpoint(from, to)` | Computes Great-Circle geographic midpoint with automatic hemisphere inference (`{ latitude, longitude, sphere }`). |
|
|
88
|
+
| `Tempo.geo.velocity(from, to, opts?)` | Computes travel speed/velocity between two timestamped geographic instances in `km/h`, `mph`, or `m/s`. |
|
|
89
|
+
| `Tempo.geo.isImpossibleTravel(from, to, opts?)` | Detects impossible travel anomalies (e.g. concurrent logins exceeding commercial flight speeds of 900 km/h). |
|
|
90
|
+
| `Tempo.geo.solarOffset(coords, opts?)` | Calculates natural solar time offset between civil clock time and solar noon based on meridian drift. |
|
|
81
91
|
| `Tempo.geo.stash(coords, ttl?, keyOrOpts?)` | Stashes coordinates in storage with an optional custom TTL (default: 24h) and multi-tenant partitioning. |
|
|
82
92
|
| `Tempo.geo.clear(keyOrOpts?)` | Purges stashed coordinates from storage. |
|
|
83
93
|
| `Tempo.geo.get(keyOrOpts?)` | Reads stashed coordinates for the specified tenant/IP or ambient default. |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type TempoPlugin } from '@magmacomputing/tempo/plugin/sdk';
|
|
2
|
-
import { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, GEO_PROPERTIES, haversineDistance, solarOffset, type GeoLookupResult, type ResolvedCoordinates, type GeoConfig, type CoordinateInput, type DistanceUnit, type SolarOffsetOptions, type SolarOffsetUnit } from '@magmacomputing/library/runtime/mapper.library.js';
|
|
2
|
+
import { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, setGeoProvider, getGeoProvider, reverseGeocode, forwardGeocode, GEO_PROPERTIES, haversineDistance, solarOffset, calculateBearing, calculateMidpoint, calculateVelocity, isImpossibleTravel, isWithin, inBoundingBox, resolveCulturalLocale, type GeoLookupResult, type ResolvedCoordinates, type GeoConfig, type CoordinateInput, type GeoProvider, type DistanceUnit, type TimeUnit, type BearingOptions, type VelocityOptions, type ImpossibleTravelOptions, type BoundingBox, type LocaleSyncMode, type SolarOffsetOptions, type SolarOffsetUnit } from '@magmacomputing/library/runtime/mapper.library.js';
|
|
3
3
|
import { serverGeoLocation, serverGeoCoords, serverMapHemisphere, type ServerMapOpts, type ServerGeolocationResult } from '@magmacomputing/library/server/mapper.library.js';
|
|
4
4
|
import { geoLocation } from '@magmacomputing/library/browser/mapper.library.js';
|
|
5
|
-
export { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, GEO_PROPERTIES, haversineDistance, solarOffset, serverGeoLocation, serverGeoCoords, serverMapHemisphere, geoLocation, };
|
|
6
|
-
export type { GeoLookupResult, ResolvedCoordinates, GeoConfig, CoordinateInput, DistanceUnit, SolarOffsetOptions, SolarOffsetUnit, ServerMapOpts, ServerGeolocationResult, };
|
|
5
|
+
export { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, setGeoProvider, getGeoProvider, reverseGeocode, forwardGeocode, GEO_PROPERTIES, haversineDistance, solarOffset, calculateBearing, calculateMidpoint, calculateVelocity, isImpossibleTravel, isWithin, inBoundingBox, resolveCulturalLocale, serverGeoLocation, serverGeoCoords, serverMapHemisphere, geoLocation, };
|
|
6
|
+
export type { GeoLookupResult, ResolvedCoordinates, GeoConfig, CoordinateInput, GeoProvider, DistanceUnit, TimeUnit, BearingOptions, VelocityOptions, ImpossibleTravelOptions, BoundingBox, LocaleSyncMode, SolarOffsetOptions, SolarOffsetUnit, ServerMapOpts, ServerGeolocationResult, };
|
|
7
7
|
/**
|
|
8
8
|
* Cohesive static namespace for geolocation operations on Tempo.
|
|
9
9
|
*/
|
|
10
10
|
export interface TempoGeoNamespace {
|
|
11
|
-
/** Asynchronous universal geolocation lookup (browser hardware or
|
|
11
|
+
/** Asynchronous universal geolocation lookup (browser hardware, server IP, or custom provider) with 24h caching */
|
|
12
12
|
readonly lookup: typeof geoLookup;
|
|
13
13
|
/** Asynchronously resolves coordinates from an instance, config, or ambient storage */
|
|
14
14
|
readonly resolve: typeof resolveGeoCoordinates;
|
|
@@ -16,6 +16,18 @@ export interface TempoGeoNamespace {
|
|
|
16
16
|
readonly coerce: typeof coerceGeo;
|
|
17
17
|
/** Calculates Great-Circle distance between two coordinates using Haversine formula */
|
|
18
18
|
readonly distance: typeof haversineDistance;
|
|
19
|
+
/** Calculates initial forward azimuth compass bearing (0° to 360°) between two coordinates */
|
|
20
|
+
readonly bearing: typeof calculateBearing;
|
|
21
|
+
/** Calculates geographic midpoint along Great-Circle path between two coordinates */
|
|
22
|
+
readonly midpoint: typeof calculateMidpoint;
|
|
23
|
+
/** Calculates velocity / travel speed between two timestamped geographic instances */
|
|
24
|
+
readonly velocity: typeof calculateVelocity;
|
|
25
|
+
/** Checks if travel speed between two timestamped instances represents an impossible travel anomaly */
|
|
26
|
+
readonly isImpossibleTravel: typeof isImpossibleTravel;
|
|
27
|
+
/** Checks whether Great-Circle distance between two coordinates is within a specified radius */
|
|
28
|
+
readonly isWithin: typeof isWithin;
|
|
29
|
+
/** Checks whether coordinates fall inside a rectangular bounding box (with antimeridian wrapping support) */
|
|
30
|
+
readonly inBoundingBox: typeof inBoundingBox;
|
|
19
31
|
/** Calculates Natural Solar Time Offset between civil clock time and actual solar noon */
|
|
20
32
|
readonly solarOffset: typeof solarOffset;
|
|
21
33
|
/** Explicitly stashes coordinates into storage with optional TTL (default 24h) and multi-tenant partitioning */
|
|
@@ -24,6 +36,14 @@ export interface TempoGeoNamespace {
|
|
|
24
36
|
readonly clear: typeof clearStashedGeo;
|
|
25
37
|
/** Retrieves stashed coordinates from storage */
|
|
26
38
|
readonly get: typeof getStashedGeo;
|
|
39
|
+
/** Sets the active custom geolocation provider gateway */
|
|
40
|
+
readonly setProvider: typeof setGeoProvider;
|
|
41
|
+
/** Gets the currently registered custom geolocation provider */
|
|
42
|
+
readonly getProvider: typeof getGeoProvider;
|
|
43
|
+
/** Reverse geocodes coordinates to address or location metadata using the active provider */
|
|
44
|
+
readonly reverse: typeof reverseGeocode;
|
|
45
|
+
/** Forward geocodes an address or place query string into coordinates using the active provider */
|
|
46
|
+
readonly forward: typeof forwardGeocode;
|
|
27
47
|
/** Low-level server-side IP geolocation handler */
|
|
28
48
|
readonly server: typeof serverGeoLocation;
|
|
29
49
|
/** Low-level browser geolocation API handler */
|
|
@@ -37,6 +57,7 @@ export interface TempoGeoNamespace {
|
|
|
37
57
|
export type GeoPluginOptions = Partial<GeoConfig> & {
|
|
38
58
|
timeout?: number;
|
|
39
59
|
highAccuracy?: boolean;
|
|
60
|
+
provider?: GeoProvider;
|
|
40
61
|
[key: string]: any;
|
|
41
62
|
};
|
|
42
63
|
/**
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var qr=Object.create;var Be=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Xr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var E=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var en=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ge=(e,t)=>{for(var r in t)Be(e,r,{get:t[r],enumerable:!0})},Je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vr(t))!Qr.call(e,o)&&o!==r&&Be(e,o,{get:()=>t[o],enumerable:!(n=Hr(t,o))||n.enumerable});return e},Oe=(e,t,r)=>(Je(e,t,"default"),r&&Je(r,t,"default")),jt=(e,t,r)=>(r=e!=null?qr(Xr(e)):{},Je(t||!e||!e.__esModule?Be(r,"default",{value:e,enumerable:!0}):r,e)),tn=e=>Je(Be({},"__esModule",{value:!0}),e);var pt=en((ao,Yt)=>{"use strict";Yt.exports=window.Magma.pluginSdk});var nn,on,sn,an,cn,ln,un,fn,qt,pn,Ht,w,Z=E(()=>{"use strict";nn=Symbol.for("$LibraryTarget"),on=Symbol.for("$LibraryDiscover"),sn=Symbol.for("$LibraryExtensible"),an=Symbol.for("nodejs.util.inspect.custom"),cn=Symbol.for("$LibraryLogConfig"),ln=Symbol.for("$LibraryRegistry"),un=Symbol.for("$LibraryRegister"),fn=Symbol.for("$LibrarySerializerRegistry"),qt=Symbol.for("$LibraryMutable"),pn=Symbol.for("$LibraryIdentity"),Ht=Symbol.for("$LibraryUnwrapped"),w={$Target:nn,$Discover:on,$Extensible:sn,$Inspect:an,$LogConfig:cn,$Registry:ln,$Register:un,$SerializerRegistry:fn,$Identity:pn,$Mutable:qt,$Unwrapped:Ht}});function he(e){let t=e,r=0,n=50;for(;t;){let o=t[w.$Target];if(!o||r>=n)break;t=o,r++}return t}function C(e,t=!1){if(!e||typeof e!="object")return[];let r=he(e);if(!t){let u=Reflect.ownKeys(r),f=[];for(let d of u){let h=Object.getOwnPropertyDescriptor(r,d);h&&h.enumerable&&f.push([d,r[d]])}return f}let n=[],o=50,s=0,i=r;for(;i&&i!==Object.prototype&&s++<o;)n.push(he(i)),i=Object.getPrototypeOf(i);let a=[],c=new Set;for(let u of n.reverse()){let f=Reflect.ownKeys(u);for(let d of f){if(c.has(d))continue;let h=Object.getOwnPropertyDescriptor(u,d);!h||!h.enumerable||(c.add(d),a.push([d,r[d]]))}}return a}function Ke(e,t=!1){return C(e,t).map(([r])=>r)}function Vt(e,t=!1){return C(e,t).map(([r,n])=>n)}function je(e,t,r){return t?je(e.map(t,r)):Array.from(new Set(e))}var K=E(()=>{"use strict";Z()});var mt,gt,Ye,ue,V,dn,mn,qe,J=E(()=>{"use strict";Z();K();mt=[],gt=e=>{if(e===null)return"Null";if(e===void 0)return"Undefined";let t=typeof e;if(t==="string")return"String";if(t==="number")return"Number";if(t==="boolean")return"Boolean";if(t==="bigint")return"BigInt";if(t==="symbol")return"Symbol";try{let r=t==="object"?he(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Ye=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},ue=(e,...t)=>{let r=e;try{r=e?.[w.$Target]??e}catch{r=e}let n=gt(r);switch(n){case"Function":try{return mn(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(s=>s==="length"||Number.isFinite(Number(s))))return"ArrayLike";for(let s of t){let i=s.class?.[w.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}let o=globalThis[w.$Registry]??[];for(let s of[...mt,...o]){let i=s.class?.[w.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}}catch{return"Object"}return"Object"}default:return n}},V=(e,...t)=>({type:ue(e,...t),value:e}),dn=/^\s*(class\s|\[native code\])/,mn=e=>{if(typeof e!="function")return!1;let t=e?.[w.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Ye(t);if(t?.[w.$Identity]||t?.prototype?.[w.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[w.$Registry]??[]).some(s=>(s.class?.[w.$Target]??s.class)===t||r&&s.type===r||n&&s.type===n))return!0;try{let s=Function.prototype.toString.call(t);if(dn.test(s))return!0;let i=Object.getOwnPropertyDescriptor(t,"prototype");if(i&&i.writable===!1&&!Object.isFrozen(t))return!0;let a=t.prototype;if(a&&Object.getOwnPropertyNames(a).length>2)return!0}catch{return!1}return!1},qe=(e,t)=>{if(typeof e!="function")return;let r=Ye(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(mt.some(o=>o.class===e)||mt.push({class:e,type:n}))}});function He(e){switch(typeof e){case"number":return Number.isFinite(e);case"bigint":return!0;case"string":{let r=e.trim();return r.length===0?!1:gn.test(r)||g(Number(r))}default:return!1}}var W,X,$,Xt,m,Qt,g,gn,ht,fe,er,T,Ee,tr,Q,yt,k,_,j,N,S,A,_e,Ne,Ve,Pe,R,P=E(()=>{"use strict";Z();J();W=(e,...t)=>t.includes(ue(e)),X=e=>e===null||typeof e!="object"&&typeof e!="function",$=e=>!X(e),Xt=e=>Symbol.iterator in Object(e)&&!m(e),m=e=>typeof e=="string",Qt=e=>typeof e=="string"&&e.trim().length>0,g=e=>Number.isFinite(e),gn=/^[+-]?[0-9]+n$/;ht=e=>typeof e=="bigint",fe=e=>Array.isArray(e),er=e=>gt(e)==="Object"&&"length"in e&&Object.keys(e).every(t=>t==="length"||g(Number(t))),T=e=>W(e,"Object"),Ee=e=>W(e,"Date"),tr=e=>W(e,"RegExp"),Q=e=>typeof e=="symbol",yt=e=>typeof e=="symbol"&&Symbol.keyFor(e)!==void 0,k=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",_=e=>e==null||W(e,"Void","Empty"),j=e=>e===void 0||W(e,"Void","Empty"),N=e=>e!=null&&!_(e),S=e=>W(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),A=e=>typeof e=="function",_e=e=>W(e,"Map"),Ne=e=>W(e,"Set"),Ve=(e,t)=>W(e,"Error")&&(t?e instanceof t:!0),Pe=e=>typeof Intl<"u"&&typeof Intl.Locale=="function"&&e instanceof Intl.Locale,R=e=>_(e)||T(e)&&Reflect.ownKeys(e).length===0||m(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||fe(e)&&e.length===0||Ne(e)&&e.size===0||_e(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||Ee(e)&&Number.isNaN(e.getTime())});function wt(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??hn;return X(e)||r.has(e)||n.has(e)||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof Promise||e?.[Symbol.toStringTag]==="Enumify"||e[w.$Extensible]?e:(r.add(e),C(e).forEach(([o,s])=>{k(o)&&wt(s,{skip:n},r)}),Object.freeze(e))}var x,ye,hn,De=E(()=>{"use strict";K();P();Z();x={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},ye=()=>{let e=globalThis;try{if(N(e.SpreadsheetApp))return{global:e,type:x.GoogleAppsScript};if(N(e.window?.document))return{global:e,type:x.Browser};if(S(e.importScripts)||N(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:x.WebWorker};if(N(e.Deno))return{global:e,type:x.Deno};if(N(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:x.NodeJS}}catch{}return{global:e,type:x.Unknown}},hn=new WeakSet});function rr(e){return Object.fromEntries(C(e,!0))}var nr=E(()=>{"use strict";K();J();P()});function ir(e,t={},r=!1){let{frozen:n,lock:o,appendOnly:s,onGet:i,keys:a,bind:c,skip:u}=t,f=new Set,d,h,b=he(e);o&&wt(b,u?{skip:u}:void 0),qe(b);let O={isExtensible:l=>Reflect.isExtensible(l),getPrototypeOf:l=>Reflect.getPrototypeOf(l),setPrototypeOf:(l,p)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(l,p)},getOwnPropertyDescriptor:(l,p)=>{if(!(a&&!a.includes(p))){if(a){if(i&&!Q(p)&&!f.has(p)){f.add(p);try{let y=i(p,l);if(N(y))return{enumerable:!0,configurable:!0,value:y}}finally{f.delete(p)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(l,p)}},ownKeys:l=>{if(a)return a;if(i&&!f.has(w.$Discover)){f.add(w.$Discover);try{i(w.$Discover,l)}finally{f.delete(w.$Discover)}}return Reflect.ownKeys(l)},has:(l,p)=>a?a.includes(p):Reflect.has(l,p),deleteProperty:(l,p)=>{if(n)throw new TypeError(`Cannot delete property '${String(p)}' from a protected object.`);if(s&&Reflect.has(l,p))throw new Error(`Security: Deletion attempt on protected key '${String(p)}'`);return Reflect.deleteProperty(l,p)},defineProperty:(l,p,y)=>{if(n&&!Object.isFrozen(l))throw new TypeError(`Cannot define property '${String(p)}' on a frozen object.`);if(s&&Reflect.has(l,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`);return Reflect.defineProperty(l,p,y)},set:(l,p,y,I)=>{if(n&&I===h)throw new TypeError(`Cannot set property '${String(p)}' on a frozen object.`);if(s){if(Array.isArray(l)&&p==="length"&&y<l.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(l)&&p==="length")&&Reflect.has(l,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`)}return Reflect.set(l,p,y,I)},get:(l,p,y)=>{if(p===w.$Target)return y===h?l:void 0;if(n&&(p===w.$Inspect||p==="toJSON")){let v=Object.getOwnPropertyDescriptor(l,p);return v&&S(v.value)?v.value:(d||(d=()=>rr(l)),d)}if(a&&!a.includes(p))return;if(i&&!Q(p)&&!Reflect.has(l,p)&&!f.has(p)){f.add(p);try{let v=i(p,l);if(N(v))return v}finally{f.delete(p)}}let I=Reflect.get(l,p,y);if(c&&p!=="constructor"&&S(I)){let v=Object.getOwnPropertyDescriptor(l,p);if(v&&!v.configurable&&!v.writable)return I;let ce=or.get(I);ce||(ce=new WeakMap,or.set(I,ce));let le=ce.get(l);if(le)return le;let Kt=I.bind(l);return ce.set(l,Kt),Kt}return I}};if(r){let l=Proxy.revocable(b,O);return h=l.proxy,{proxy:l.proxy,revoke:l.revoke}}return h=new Proxy(b,O),h}function sr(e,t=!0,r=t,n=new WeakSet){return ir(e,{frozen:t,lock:r,skip:n,bind:t})}function Ie(e,t=new WeakSet){return ir(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var or,Xe=E(()=>{"use strict";Z();nr();De();K();P();J();or=new WeakMap});function ve(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(ht(n))return`\0__bigint:${n}__\0`;if(S(n))return`function:${n.name||"anonymous"}`;if($(n)){if(t.has(n))return"<Circular>";if(t.add(n),Pe(n))return n.toString();if(_e(n))return`map:[${Array.from(n.entries()).map(o=>ve(o,t)).sort().join(",")}]`;if(Ne(n))return`set:[${Array.from(n).map(o=>ve(o,t)).sort().join(",")}]`}return n})}function cr(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function M(e){let t=new Map;return function(...r){let n=ve(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let o=e.apply(this,r);t.set(n,o)}return t.get(n)}}function Re(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${ve(r)}`,o=ar.get(this);if(o||(o=new Map,ar.set(this,o)),!o.has(n)){let s=t.apply(this,r);Ie(s),o.set(n,s)}return o.get(n)}}}var ar,Qe=E(()=>{"use strict";Xe();P();ar=new WeakMap});function lr(e){try{return JSON.parse(JSON.stringify(e))}catch(t){throw console.warn("Could not clean object:",t?.message??t),t}}var ur=E(()=>{"use strict";P()});function te(e){return N(e)?S(e)?e():e:t=>S(t)?t():t}var wn,ee,St=E(()=>{"use strict";K();P();J();wn=e=>{let t=new Set,r=e,n=0;for(;r&&r!==Object.prototype&&n++<10;){let o=Object.getOwnPropertyDescriptors(r);for(let[s,i]of Object.entries(o))k(s)&&(i.enumerable||S(i.get))&&t.add(s);r=Object.getPrototypeOf(r)}return Array.from(t)},ee=e=>{if(X(e)||S(e))return e;if(fe(e))return e.map(r=>ee(r));if(Ee(e)||tr(e)||_e(e)||Ne(e))return e;try{if(S(e.toJSON))return ee(e.toJSON())}catch{}let t={};for(let r of wn(e))try{t[r]=ee(e[r])}catch{}return t};te.stringSymbol=te();te.symbolRegExp=te();te.symbolString=te();te.stringString=te()});function mr(e,t){try{return globalThis.structuredClone(e,t)}catch{return lr(e)}}function Sn(e,t){return xn(t)}function pr(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(bn,r=>gr[r.toUpperCase()]??decodeURI(r))),t}function xn(e){if(m(e))try{return decodeURI(e)}catch{}return e}function Ce(e){return!W(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function Tn(e,t){return`{"$${e}":${t}}`}function On(e){return F(Q(e)?`${yt(e)?"@":""}@(${e.description??""})`:e)}function bt(e){let[t,r,n]=e.toString().match(En)||[null,void 0,void 0];switch(!0){case Q(e):case _(t):case(N(r)&&j(n)):return e;case N(r):return Symbol.for(n);case j(r):default:return Symbol(n)}}function B(e,t){let r=pe;pe=t?.compact!==!1;try{let n=F(e,!1);if(t?.signed){if(!m(t.secret)||!t.secret)throw new TypeError("stringify: signed serialization requires an explicit secret string");return`$sig:${hr(n,t.secret)}:${n}`}return n}finally{pe=r}}function F(e,t=!0){let r=V(e),n=cr(Tn)(r.type);switch(r.type){case"String":{let o=r.value;return o.startsWith("~")&&(o=`~${o}`),t||(t=o==="true"||o==="false"||o==="null"||parseFloat(o).toString()===o||o.startsWith("~")),t?JSON.stringify(pr(o)):pr(o)}case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return pe?JSON.stringify("~u"):n(JSON.stringify("void"));case"BigInt":return pe?JSON.stringify(`~n${r.value.toString()}`):n(r.value.toString());case"Date":return pe?JSON.stringify(`~t${r.value.getTime()}`):n(F(r.value.toJSON()));case"Object":return`{${C(r.value).filter(([,s])=>Ce(s)).map(([s,i])=>`${On(s)}: ${F(i)}`).join(",")}}`;case"Array":return`[${r.value.filter(s=>Ce(s)).map(s=>F(s)).join(",")}]`;case"Map":{let o=Array.from(r.value.entries()).filter(([,s])=>Ce(s)).map(([s,i])=>`[${F(s)}, ${F(i)}]`).join(",");return n(`[${o}]`)}case"Set":{let o=Array.from(r.value.values()).filter(s=>Ce(s)).map(s=>F(s)).join(",");return n(`[${o}]`)}case"Symbol":{let o=`${yt(r.value)?"@":""}@(${r.value.description??""})`;return pe?JSON.stringify(`~y${o}`):n(JSON.stringify(o))}case"RegExp":return n(F({source:r.value.source,flags:r.value.flags}));default:{let o=r.value;switch(!0){case!Ce(o):return;case S(o.toJSON):return n(F(o.toJSON()));case(S(o.toString)&&o.toString!==Object.prototype.toString):{let s=o.toString();return n(s.includes('"')?s:JSON.stringify(s))}case(S(o.valueOf)&&o.valueOf!==Object.prototype.valueOf):return n(JSON.stringify(o.valueOf()));default:{let s=ee(o);return $(s)&&Object.keys(s).length>0?F(s):n(JSON.stringify(o,(i,a)=>R(i)?a:F(a)))}}}}}function de(e,t){if(!m(e))return e;let r=S(t)?{sentinel:t}:t??{};if(e.startsWith("$sig:")){let o=e.indexOf(":",5);if(o!==-1){let s=e.substring(5,o),i=e.substring(o+1);if(!m(r.secret)||!r.secret){if(console.warn("objectify: signature verification requires an explicit secret string"),r.throwOnError)throw new TypeError("objectify: signature verification requires an explicit secret string");return e}let a=hr(i,r.secret);if(!Nn(s,a)){if(console.warn("objectify: signature verification failed"),r.throwOnError)throw new Error("objectify: signature verification failed");return e}e=i}else if(r.requireSigned){if(console.warn("objectify: malformed signed payload"),r.throwOnError)throw new Error("objectify: malformed signed payload");return e}}else if(r.requireSigned){if(console.warn("objectify: unsigned string rejected by requireSigned policy"),r.throwOnError)throw new Error("objectify: unsigned string rejected by requireSigned policy");return e}let n;try{n=JSON.parse(e,Sn)}catch(o){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${o.message}`),e):de(`"${e}"`,r.requireSigned?{...r,requireSigned:!1}:r)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return xt(n,r,0);default:return Ae(n,r)}}function xt(e,t,r=0){let n=t.maxDepth??Pn;return r>=n?e:T(e)?Ae(C(e).filter(([o])=>k(o)).reduce((o,[s,i])=>Object.assign(o,{[bt(s)]:Ae(xt(i,t,r+1),t)}),{}),t):fe(e)?Vt(e).map(o=>Ae(xt(o,t,r+1),t)):Ae(e,t)}function Ae(e,t){if(m(e)&&e.startsWith("~"))try{if(e.startsWith("~~"))return e.substring(1);if(e.startsWith("~n"))return BigInt(e.substring(2));if(e.startsWith("~t")){let s=e.substring(2),i=new Date(He(s)?Number(s):s);return isNaN(i.getTime())?e:i}if(e==="~u")return t.sentinel?.();if(e.startsWith("~y"))return bt(e.substring(2))}catch{return e}if(!T(e)||Ke(e).length!==1)return e;let[r,n]=C(e)[0];if(!String(r).startsWith("$"))return e;let o=r.substring(1);try{switch(o){case"String":case"Boolean":case"Object":case"Array":return n;case"Number":return Number(n);case"BigInt":return BigInt(n);case"Null":return null;case"Undefined":case"Empty":case"Void":return t.sentinel?.();case"Date":return new Date(n);case"RegExp":return t.allowRegExp===!1||!T(n)||!m(n.source)||n.source.length>Dn?e:new RegExp(n.source,n.flags);case"Symbol":return bt(n);case"Map":return fe(n)?new Map(n):e;case"Set":return fe(n)?new Set(n):e;default:{if(t.allowClasses===!1||t.allowedClasses&&!(t.allowedClasses instanceof Set?t.allowedClasses.has(r)||t.allowedClasses.has(o):t.allowedClasses.includes(r)||t.allowedClasses.includes(o)))return e;let s=et.get(r);return s?Reflect.construct(s,[n]):(console.warn(`objectify: dont know how to deserialize '${o}'`),e)}}}catch{return e}}var et,fr,dr,gr,bn,En,_n,hr,Nn,pe,Pn,Dn,we=E(()=>{"use strict";Qe();K();ur();St();J();P();Z();et=globalThis[w.$SerializerRegistry]??=new Map,fr=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return m(t)?t:void 0}catch{return}},dr=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(et.has(r)){let n=et.get(r),o=fr(n),s=fr(t),i=n.name||o,a=t.name||s||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[w.$Identity]&&n[w.$Identity]===t[w.$Identity]||!!t[w.$Target]&&n[w.$Target]===t[w.$Target]||!!i&&!!a&&i===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}et.set(r,t)};gr={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},bn=new RegExp(Object.keys(gr).join("|"),"gi");En=/^@(@)?\(([^\)]*)\)$/;_n=globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID().split("-")[0]:Math.random().toString(36).slice(2,10),hr=(e,t=_n)=>{let r=2166136261,n=2654435769,o=`${t}:${e}`;for(let s=0;s<o.length;s++){let i=o.charCodeAt(s);r=Math.imul(r^i,16777619),n=Math.imul(n^i,2246822507)}return(r>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")},Nn=(e,t)=>{if(!m(e)||!m(t)||e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e.charCodeAt(n)^t.charCodeAt(n);return r===0},pe=!0;Pn=64,Dn=512});function re(e,t,r,n,o,s){function i(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",u=!t&&e?n.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d,h=!1,b=r.length-1;b>=0;b--){var O={};for(var l in n)O[l]=l==="access"?{}:n[l];for(var l in n.access)O.access[l]=n.access[l];O.addInitializer=function(y){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(y||null))};var p=(0,r[b])(a==="accessor"?{get:f.get,set:f.set}:f[c],O);if(a==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(d=i(p.get))&&(f.get=d),(d=i(p.set))&&(f.set=d),(d=i(p.init))&&o.unshift(d)}else(d=i(p))&&(a==="field"?o.unshift(d):f[c]=d)}u&&Object.defineProperty(u,n.name,f),h=!0}function ne(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}var $e=E(()=>{"use strict"});function yr(e,t){return Ye(e)??(j(t)?e.name||void 0:String(t))}function wr(e,{kind:t,name:r,addInitializer:n}){let o=yr(e,r);if(o&&qe(e,o),t==="class")return o&&n(()=>dr(o,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function oe(e,t){let r=(n,o,s)=>{let i=n.prototype,a=o??yr(n,s);if(a&&(i&&!Object.hasOwn(i,Symbol.toStringTag)&&Object.defineProperty(i,Symbol.toStringTag,{value:a,configurable:!0,writable:!1,enumerable:!1}),!n.name||n.name!==a))try{Object.defineProperty(n,"name",{value:a,configurable:!0,writable:!1,enumerable:!1})}catch{}return n};return A(e)&&t?.kind==="class"?r(e,void 0,t.name):(n,o)=>r(n,m(e)?e:void 0,o?.name)}var Me=E(()=>{"use strict";Z();Xe();P();we();J()});var Tt,Sr=E(()=>{"use strict";$e();P();Me();Tt=(()=>{let e=[oe("BoundedCache")],t,r=[],n,o=Map;var s=class extends o{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:i},null,r),s=n=t.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),ne(n,r)}#t=new Map;#e=new Set;#r=new Map;maxSize;ttl;constructor(i=1e3,a=1440*60*1e3){super(),this.maxSize=i,this.ttl=a}get isBoundedCache(){return!0}#n(i){let a=this.#t.get(i);return a===void 0?!1:Date.now()>a}evictExpired(){if(this.#t.size===0)return;let i=Date.now();for(let[a,c]of this.#t.entries())i>c&&this.delete(a)}setStatic(i,a){return super.has(i)&&super.delete(i),super.set(i,a),this.#e.add(i),this.#t.delete(i),this.#r.delete(i),this}isStatic(i){return this.#e.has(i)}get(i){if(this.#n(i)){this.delete(i);return}if(!super.has(i))return;let a=super.get(i);return super.delete(i),super.set(i,a),a}has(i){return this.#n(i)?(this.delete(i),!1):super.has(i)}get size(){return this.evictExpired(),super.size}forEach(i,a){this.evictExpired(),super.forEach(i,a)}set(i,a,c){this.evictExpired();let u=this.#t.get(i);for(super.has(i)&&super.delete(i),super.set(i,a),this.#e.delete(i),N(c)?c!==1/0?(this.#t.set(i,Date.now()+c),this.#r.set(i,c)):(this.#t.delete(i),this.#r.delete(i)):u!==void 0?this.#t.set(i,u):this.ttl!==1/0?(this.#t.set(i,Date.now()+this.ttl),this.#r.delete(i)):(this.#t.delete(i),this.#r.delete(i));this.size-this.#e.size>this.maxSize;){let f=!1,d=super.keys(),h=d.next();for(;!h.done;){let b=h.value;if(!this.#e.has(b)){this.delete(b),f=!0;break}h=d.next()}if(!f)break}return this}delete(i){return this.#e.delete(i),this.#t.delete(i),this.#r.delete(i),super.delete(i)}deletePrefix(i){let a=String(i).trim().toLowerCase();if(R(a))return 0;let c=[];for(let u of super.keys())m(u)&&u.toLowerCase().startsWith(a)&&c.push(u);for(let u of c)this.delete(u);return c.length}clear(i){if(i===void 0){this.#e.clear(),this.#t.clear(),this.#r.clear(),super.clear();return}let a=0;for(let c of super.keys()){if(a>=i)break;this.#e.has(c)||(this.delete(c),a++)}}keys(){return this.evictExpired(),super.keys()}values(){return this.evictExpired(),super.values()}entries(){return this.evictExpired(),super.entries()}[Symbol.iterator](){return this.evictExpired(),super[Symbol.iterator]()}toJSON(){this.evictExpired();let i=[];for(let[a,c]of super.entries())m(a)&&i.push([a,c]);return Object.fromEntries(i)}static fromEntries(i,a=1e3,c=1440*60*1e3){let u=new s(a,c);for(let[f,d]of i)u.set(f,d);return u}};return s=n})()});function Tr(e,t){let r;if(j(e))return t??{};switch(z.type){case x.Browser:r=Ot.getItem(e);break;case x.NodeJS:r=Le.has(e)?Le.get(e):In(e);break;case x.Deno:r=z.global.Deno.env.get(e);break;case x.GoogleAppsScript:r=z.global.PropertiesService?.getUserProperties().getProperty(e);break;case x.WebWorker:case x.Unknown:r=void 0;break;default:throw new Error(`Cannot determine Javascript context: ${z.type}`)}return m(r)?de(r):t}function Nt(e,t,r){let n=N(t)?B(t):void 0,o=N(n);switch(z.type){case x.Browser:try{o?Ot.setItem(e,n):Ot.removeItem(e)}catch(s){console.warn(`[Storage] Failed to ${o?"setItem":"removeItem"} for key '${e}':`,s)}break;case x.NodeJS:o?r?.static?Le.setStatic(e,n):Le.set(e,n,r?.ttl):Le.set(e,void 0,r?.ttl);break;case x.Deno:o?z.global.Deno.env.set(e,n):z.global.Deno.env.delete(e);break;case x.GoogleAppsScript:o?z.global.PropertiesService?.getUserProperties().setProperty(e,n):z.global.PropertiesService?.getUserProperties().deleteProperty(e);break;case x.WebWorker:case x.Unknown:break;default:throw new Error(`Cannot determine Javascript context: ${z.type}`)}}var z,xr,br,Et,_t,Ot,Le,In,Pt=E(()=>{"use strict";we();De();P();Sr();z=ye(),xr=(e=1e3,t=1/0)=>{let r=new Tt(e,t);return{get length(){return r.size},clear:()=>r.clear(),getItem:n=>r.get(n)??null,key:n=>Array.from(r.keys())[n]??null,removeItem:n=>{r.delete(n)},setItem:(n,o)=>{r.set(n,String(o))}}},br=new Map,Et=e=>{let t=br.get(e);return t||(t=xr(),br.set(e,t)),t},_t=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&A(t.getItem)&&A(t.setItem)&&A(t.removeItem)&&A(t.clear)&&A(t.key)&&g(t.length))return t}catch{}return Et(e)},Ot=z.type===x.Browser?_t():xr(),Le=new Tt(1e3,1/0),In=e=>{try{let t=Reflect.get(z.global,"process");if(!t||typeof t!="object")return;let r=Reflect.get(t,"env");return!r||typeof r!="object"?void 0:Reflect.get(r,e)}catch{return}}});var Or=E(()=>{"use strict";we();P()});function Er(e=[],t){let r=n=>j(t)||N(n)?n:mr(t);return er(e)||Xt(e)&&!m(e)?Array.from(e,r):[e]}function _r(e){if(Ve(e))return e;let t=new Error(T(e)&&m(e.message)?e.message:String(e));return T(e)&&(t.name=m(e.name)?e.name:"Error","code"in e&&(m(e.code)||g(e.code))&&(t.code=e.code),"stack"in e&&m(e.stack)&&(t.stack=e.stack)),t}var Pi,Di,Dt=E(()=>{"use strict";we();J();P();Or();Pi=BigInt(Number.MAX_SAFE_INTEGER),Di=BigInt(Number.MIN_SAFE_INTEGER)});var Nr=E(()=>{"use strict";Dt();if(typeof globalThis.Temporal>"u")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).");try{if(typeof Temporal.Now.zonedDateTimeISO=="function"&&typeof Temporal.Now.zonedDateTimeISO().add!="function")throw new Error("Incomplete Temporal implementation")}catch(e){let t=_r(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",t),t.message!=="Incomplete Temporal implementation")throw t}});function Pr(){return Temporal.Now.instant()}function Dr(e,t=2024){let r=Temporal.ZonedDateTime.from({year:t,month:1,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds,n=Temporal.ZonedDateTime.from({year:t,month:7,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds;return{jan:r,jul:n}}var It=E(()=>{"use strict";Nr();P()});function Fe(e,t,r){if(e){if(A(e[t]))return e[t]();if(r&&r in e)return e[r]}}function Un(e){return e?Mn.has(e)?5:$n.has(e)?6:An.has(e)?7:1:1}function Jn(e){return e?e==="IR"?Wn:e==="AF"?kn:Ln.has(e)?Gn:Ir:Ir}function Bn(e,t){let r=e?.script??(A(e?.maximize)?e.maximize().script:void 0);return r&&zn.has(r)||t&&Fn.has(t)?"rtl":"ltr"}var vn,Rn,Se,se,Gi,Wi,Rt,ki,Cn,Ui,An,$n,Mn,Ln,Fn,zn,Ir,Gn,Wn,kn,vt,Ji,Bi,Zn,Kn,vr,Zi,tt,Ki,Ct=E(()=>{"use strict";It();Qe();P();Dt();vn=/_/g,Rn=/[.@]/,Se=e=>typeof Intl<"u"&&(!e||Object.hasOwn(Intl,e)&&A(Intl[e])),se=e=>{if(Pe(e)&&(e=e.toString()),!m(e))return;let t=e.trim();if(R(t))return;let r=t.split(Rn)[0];if(!R(r))return r.replace(vn,"-")},Gi=M((e,t)=>new Intl.RelativeTimeFormat(se(e),t)),Wi=M((e,t)=>new Intl.ListFormat(se(e),t)),Rt=M((e,t)=>new Intl.DateTimeFormat(se(e),t)),ki=M((e,t)=>{try{return new Intl.PluralRules(se(e),t)}catch{return{select:()=>"other"}}}),Cn=M((e,t)=>new Intl.NumberFormat(se(e),t)),Ui=M((e,t)=>{try{let r=new Intl.DurationFormat(se(e),t);if(S(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}});An=new Set(["US","CA","MX","BR","IL","JP","TW","HK","MO","PH","SG","TH","IN","KR","CO","PE","VE","ZA"]),$n=new Set(["SA","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY","YE"]),Mn=new Set(["MV"]),Ln=new Set(["SA","BH","DJ","DZ","EG","IQ","JO","KW","LY","OM","QA","SD","SY","YE"]),Fn=new Set(["ar","he","fa","ur","yi","ps","sd","ug","ckb"]),zn=new Set(["Arab","Hebr","Thaa","Syrc","Mand","Samr","Nkoo"]),Ir=Object.freeze([6,7]),Gn=Object.freeze([5,6]),Wn=Object.freeze([5]),kn=Object.freeze([4,5]);vt=M(e=>{if(Pe(e))return e;if(Se("Locale"))try{let t=se(e);return new Intl.Locale(t||"en-US")}catch{return}}),Ji=M(e=>{let t=vt(e)??vt("en-US"),r=t?.baseName??vr(e)??"en-US",n=t?.language??r.split("-")[0]?.toLowerCase(),o=[];for(let le of r.split("-").slice(1)){if(le.length===1)break;o.push(le)}let s=t?.region??(A(t?.maximize)?t.maximize().region:void 0)??o.find(le=>/^[a-zA-Z]{2}$|^\d{3}$/.test(le))?.toUpperCase(),i=t?.script??(A(t?.maximize)?t.maximize().script:void 0),a=Fe(t,"getWeekInfo","weekInfo"),c=a?.firstDay??Un(s),u=Array.isArray(a?.weekend)?Object.freeze([...a.weekend]):Jn(s),d=Fe(t,"getHourCycles","hourCycles")??t?.hourCycle??(Se("DateTimeFormat")?Rt(r,{hour:"numeric"}).resolvedOptions().hourCycle:void 0),h=Array.isArray(d)&&d.length>0?Object.freeze([...d]):m(d)?Object.freeze([d]):Object.freeze(["h23"]),b=Fe(t,"getTextInfo","textInfo"),O=b?.direction==="rtl"||b?.direction==="ltr"?b.direction:Bn(t,n),p=Fe(t,"getNumberingSystems","numberingSystems")??t?.numberingSystem??(Se("NumberFormat")?Cn(r).resolvedOptions().numberingSystem:void 0),y=Array.isArray(p)&&p.length>0?Object.freeze([...p]):m(p)?Object.freeze([p]):Object.freeze(["latn"]),I=Fe(t,"getTimeZones","timeZones"),v=Array.isArray(I)&&I.length>0?Object.freeze([...I]):Object.freeze([]),ce=Object.freeze({firstDay:c,weekend:u});return Object.freeze({locale:t,baseName:r,language:n,region:s,script:i,weekInfo:ce,firstDay:c,weekend:u,hourCycle:h[0],hourCycles:h,direction:O,numberingSystem:y[0],numberingSystems:y,timeZones:v})}),Bi=M((e="latn")=>{if(!(!e||e==="latn"||!Se("NumberFormat")))try{let t=new Intl.NumberFormat(`en-u-nu-${e}`,{useGrouping:!1}),r=Array.from({length:10},(n,o)=>t.format(o));return r[0]==="0"&&r[9]==="9"?void 0:Object.freeze(r)}catch{return}}),Zn=Object.freeze({locale:"en-US",calendar:"iso8601",numberingSystem:"latn",timeZone:"UTC"}),Kn=M(()=>Se("DateTimeFormat")?Object.freeze(Rt().resolvedOptions()):Zn),vr=M(e=>{let t=se(e);if(t){if(Se("getCanonicalLocales"))try{return Intl.getCanonicalLocales(t)[0]}catch{return}return vt(t)?.baseName??t}}),Zi=M(e=>Object.freeze(Er(e).map(t=>vr(t)).filter(Boolean))),tt=M((e=Kn().timeZone)=>{try{let{jan:t,jul:r}=Dr(e),o=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(s=>e.startsWith(s));switch(!0){case r>t:return"north";case r<t:return"south";default:return o?"south":void 0}}catch{return}}),Ki=M(e=>{try{let t=new Date(2024,11,24),r=Rt(e).formatToParts(t);return r[0].type==="month"&&r[0].value==="12"}catch{return!1}})});function Y(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function be(e,t=!0){let n=ue(this)!=="Module"&&S(this?.has)?this:Yn,o=V(e),s=Object.create(n);switch(o.type){case"Enumify":case"Object":Object.defineProperties(s,Object.getOwnPropertyDescriptors(o.value));break;case"Array":o.value.forEach((i,a)=>{if(g(i))throw new Error("Enumify: numeric keys are not supported");s[i]=a});break;default:throw new Error(`Enumify: invalid argument type: ${o.type}`)}return sr(s,!0,t)}var jn,Yn,ts,Rr=E(()=>{"use strict";$e();J();P();K();Xe();Me();Qe();jn="Enumify",Yn=Ie(Object.create(null,{keys:Re("keys",function(){return C(this,!0).map(([e])=>e)}),values:Re("values",function(){return C(this,!0).map(([e,t])=>t)}),entries:Re("entries",function(){return C(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:Re("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:Y(function(e){return this.keys().includes(e)}),count:Y(function(){return this.keys().length}),includes:Y(function(e){return this.values().includes(e)}),keyOf:Y(function(e){return this.invert()[e]}),extend:Y(function(e,t){return be.call(this,e,t)}),forEach:Y(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:Y(function(e,t){return be(this.entries().reduce((r,n,o)=>e.call(t,n,o,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:Y(function(e,t){return be(this.entries().reduce((r,n,o)=>Object.assign(r,{[n[0]]:e.call(t,n,o,this)}),{}))}),[Symbol.iterator]:Y(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:jn}}));ts=(()=>{let e=[wr,oe("Enumify")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}constructor(s){return be(s)}};return o=n})()});function qn(e,t=G.Info){return g(e)?e>=G.Off&&e<=G.Trace?e:t:m(e)?Cr[e.toLowerCase()]??t:t}var G,L,Cr,rt,At=E(()=>{"use strict";$e();P();Rr();Z();Me();G=be(["Off","Error","Warn","Info","Debug","Trace"]),L={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},Cr={[L.Off]:G.Off,[L.Error]:G.Error,[L.Warn]:G.Warn,[L.Info]:G.Info,[L.Log]:G.Info,[L.Debug]:G.Debug,[L.Trace]:G.Trace};rt=(()=>{let e=[oe("Logger")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}#t;level;constructor(s,i=G.Info){this.#t=s.startsWith("[")?s:`[${s}]`,this.level=i}#e(s,...i){let a;if(i.length>0&&T(i[0]))try{i[0][w.$LogConfig]&&(a=i.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=qn(a.debug,c))}if(c===G.Off||(Cr[s]??0)>c)return;let f=i.map(d=>{if(Ve(d))return d.message;if(T(d))try{let h=d.constructor?.name??"Object";if(h==="Object"){let b=Object.keys(d);return`{ ${b.slice(0,3).join(", ")}${b.length>3?`, ... (+${b.length-3} more)`:""} }`}return`[${h}]`}catch{return"[Object]"}return String(d)}).filter(d=>!R(d)).join(" ");R(f)||console[s](`${this.#t} ${f}`)}log=(...s)=>this.#e(L.Log,...s);info=(...s)=>this.#e(L.Info,...s);warn=(...s)=>this.#e(L.Warn,...s);debug=(...s)=>this.#e(L.Debug,...s);trace=(...s)=>this.#e(L.Trace,...s);error=(...s)=>this.#e(L.Error,...s)};return o=n})()});var Ar={};ge(Ar,{WebStore:()=>Hn});var ze,Hn,$r=E(()=>{"use strict";$e();K();we();J();P();Pt();Me();ze={Local:"local",Session:"session"},Hn=(()=>{let e=[oe("WebStore")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}static _localInstance;static _sessionInstance;static get local(){return o._localInstance??=new o(ze.Local)}static get session(){return o._sessionInstance??=new o(ze.Session)}#t;#e;get#r(){if(this.#e)return this.#e;let s=this.#t===ze.Local?"localStorage":"sessionStorage";return this.#e=_t(s)}#n(s){try{return s(this.#r)}catch{let a=this.#t===ze.Local?"localStorage":"sessionStorage",c=Et(a);return this.#e=c,s(c)}}constructor(s=ze.Local){this.#t=s}get(s,i){let a=this.#n(c=>c.getItem(B(s)));return m(a)?de(a):i??null}set(s,i,a={merge:!0}){if(_(s))return this.clear();let c=this.get(s),u=V(i);switch(u.type){case"Undefined":return this.del(s);case"Object":return c??={},this.#o(s,a.merge?Object.assign(c,u.value):u.value);case"Array":return c??=[],this.#o(s,a.merge?je(c.concat(u.value)):i);case"Map":return c??=new Map,a.merge?(u.value.forEach((f,d)=>c.set(d,f)),this.#o(s,c)):this.#o(s,u.value);case"Set":return c??=new Set,a.merge?(u.value.forEach(f=>c.add(f)),this.#o(s,c)):this.#o(s,u.value);default:return this.#o(s,u.value)}}clear(){try{this.#n(s=>s.clear())}catch(s){console.warn("[WebStore] Failed to clear storage:",s)}return this}del(...s){return s.forEach(i=>{try{this.#n(a=>a.removeItem(B(i)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(i)}':`,a)}}),this}keys(...s){return this.entries(...s).map(([i])=>i)}values(...s){return this.entries(...s).map(([,i])=>i)}entries(...s){let i=new Set(s.map(c=>B(c))),a=[];return this.#n(c=>{for(let u=0;u<c.length;u++){let f=c.key(u);if(f!==null&&(R(s)||i.has(f))){let d=c.getItem(f);a.push([de(f),de(d)])}}}),a}from(s){return C(s).forEach(([i,a])=>this.set(i,a)),this}#o(s,i){try{this.#n(a=>a.setItem(B(s),B(i)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(s)}':`,a)}return this}};return o=n})()});var Fr={};ge(Fr,{geoCoords:()=>Lr,geoLocation:()=>Ge,mapAddress:()=>Xn,mapHemisphere:()=>Vn,mapQuery:()=>Lt});var ot,Mr,D,Mt,q,$t,nt,Ge,Lr,Lt,Vn,Xn,Ft=E(()=>{"use strict";St();De();P();It();Ct();At();ot={catch:!0,debug:0},Mr=ye(),D={},Mt="_magma_browser_map_",q=new rt("[Mapper]"),$t=null,nt=()=>($t||($t=new Promise((e,t)=>{Mr.type===x.Browser?Promise.resolve().then(()=>($r(),Ar)).then(({WebStore:r})=>{let n=new r("local"),o=n.get(Mt,{});$(o)&&(o.geolocation&&(!o.geolocation.coords||o.geolocation.$GeolocationPosition)&&delete o.geolocation,Object.assign(D,o)),e(n)}).catch(t):e(void 0)})),$t),Ge=(e={})=>nt().then(()=>new Promise((t,r)=>{e=Object.assign({},ot,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(o=>{let s=D.geolocation?.coords,i=s?.latitude?.toFixed(3),a=s?.longitude?.toFixed(3),c=D.geolocation?.timestamp??0,u=o.coords.latitude.toFixed(3)!==i,f=o.coords.longitude.toFixed(3)!==a,d=c<Pr().epochMilliseconds-36e5;(u||f||d)&&(Object.assign(D,{georesponse:null}),q.info(e,"GeoLocation: device update")),Object.assign(D,{geolocation:ee(o)}),t(D.geolocation)},o=>{Object.assign(D,{geolocation:{error:o.message},georesponse:null}),n(D.geolocation)}):(Object.assign(D,{geolocation:{error:"Not Supported"},georesponse:null}),n(D.geolocation))})).finally(()=>{(D.geolocation?.error?q.error:q.info)(e,"geoLocation: ",D.geolocation),nt().then(r=>r?.set(Mt,D))}),Lr=e=>new Promise((t,r)=>{if(!_(e))return t(e);Ge().then(n=>_(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),Lt=(e,t={})=>nt().then(()=>new Promise((r,n)=>{t=Object.assign({},ot,t);let o=t.catch?r:n;Lr(e).then(s=>{switch(!0){case(Mr.type!==x.Browser||!window.google?.maps):throw new Error("Google Maps API not configured");case _(s):throw new Error("Cannot determine Coordinates");case _(e):{let i=D.geolocation&&D.georesponse,a=_(D.geolocation?.error)&&_(D.georesponse?.error);if(i&&a)return t.debug&&q.debug(t,"mapQuery: cache"),r(D.georesponse)}default:new window.google.maps.Geocoder().geocode(s).then(i=>r(D.georesponse=ee(i)))}}).catch(s=>{Object.assign(D,{georesponse:{error:s.message}}),o(D.georesponse)})})).finally(()=>{t.debug&&(D.georesponse?.error?q.error:q.debug)(t,"mapQuery: ",D.georesponse),nt().then(r=>r?.set(Mt,D))}),Vn=(e,t={})=>Lt(e,t).then(r=>{if(t=Object.assign({},ot,t),_(r.error))return t.debug&&q.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=tt();if(_(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&q.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),Xn=(e,t={})=>Lt(e,t).then(r=>{if(!_(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((o,s)=>(s.types.filter(i=>i!=="political").forEach(i=>o[i]=(o[i]?o[i]+",":"").concat(s.short_name)),o),{formatted_address:r})).catch(r=>{if(t=Object.assign({},ot,t),t.debug&&q.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var Ur={};ge(Ur,{HTTP:()=>Wr,HttpError:()=>H,METHOD:()=>kr,fetchHead:()=>eo,fetchRequest:()=>Qn});var zt,zr,Wr,kr,H,Gr,Qn,eo,Jr=E(()=>{"use strict";P();zt=2e3,zr=/\);?$/,Wr={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},kr={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},H=class extends Error{status;statusText;body;constructor(t,r,n){super(`${t}: ${r}`),this.status=t,this.statusText=r,this.body=n,this.name="HttpError"}},Gr=async(e,t)=>{let r=e.headers?.get?.("Content-Length")||e.headers?.get?.("content-length");if(r){let a=parseInt(r,10);if(g(a)&&a>t){try{await e.body?.cancel()}catch{}throw new H(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(S(e.text))a=await e.text();else if(S(e.json)){let u=await e.json();a=JSON.stringify(u)??""}else a="";let c=new TextEncoder().encode(a).byteLength;if(c>t)throw new H(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),o=new TextDecoder,s=0,i="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(s+=c.byteLength,s>t){try{await n.cancel()}catch{}throw new H(413,`Streamed payload exceeded limit (${t} bytes)`,null)}i+=o.decode(c,{stream:!0})}}return i+=o.decode(),i}finally{try{n.releaseLock()}catch{}}},Qn=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??zt)]):AbortSignal.timeout(r.timeout??zt)};return fetch(e,n).then(async o=>{if(o.ok){let a=(o.headers?.get?.("Content-Type")||o.headers?.get?.("content-type")||"").includes("application/json");if(N(r.maxBytes)){let c=await Gr(o,r.maxBytes);if(r.rawText)return c;if(r.prefix){let u=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(zr,""):c;return JSON.parse(u)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return S(o.text)?await o.text():"";if(r.prefix){let c=await o.text(),u=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(zr,""):c;return JSON.parse(u)}if(S(o.text)){let c=await o.text();try{return JSON.parse(c)}catch{return c}}return S(o.json)?await o.json():""}let s=null;try{let i=N(r.maxBytes)?await Gr(o,r.maxBytes):S(o.text)?await o.text():"";try{s=JSON.parse(i)}catch{s=i}}catch(i){if(i instanceof H&&i.status===413)throw i}throw new H(o.status,o.statusText,s)})},eo=e=>{let t=AbortSignal.timeout(zt),r={method:kr.Head,signal:t};return fetch(e,r).then(({ok:n,status:o,statusText:s,headers:i})=>{if(n||o===Wr.Forbidden)return{status:o,headers:i};throw new H(o,s,null)})}});var Zr={};ge(Zr,{serverGeoCoords:()=>it,serverGeoLocation:()=>We,serverMapHemisphere:()=>Ut});var Br,kt,Gt,Wt,to,We,it,Ut,Jt=E(()=>{"use strict";P();Ct();At();Br=new rt("[ServerMapper]"),kt="https://ipwho.is",Gt={endpoint:`${kt}/`,timeout:3e3,catch:!0,debug:0},Wt=null,to=()=>(Wt||(Wt=Promise.resolve().then(()=>(Jr(),Ur))),Wt),We=async(e={})=>{let t={...Gt,...e},r=t.catch!==!1;try{let n=t.endpoint||Gt.endpoint;if(m(t.ip)){let d=encodeURIComponent(t.ip.trim());if((n.endsWith("/")?n.slice(0,-1):n)===kt)n=`${kt}/${d}`;else if(n.includes("{ip}"))n=n.replace("{ip}",d);else if(d!=="")throw new Error(`Custom endpoint must include an '{ip}' placeholder to resolve a specific IP: ${n}`)}let o=t.timeout??Gt.timeout,{fetchRequest:s}=await to(),i=await s(n,{},{...g(o)?{timeout:o}:{},maxBytes:64*1024});if(typeof i!="object"||_(i))throw new Error("Geolocation lookup failed");if(i.status==="fail"||i.success===!1)throw new Error(i.message||i.reason||"Geolocation lookup failed");let a=g(i.lat)?i.lat:i.latitude,c=g(i.lon)?i.lon:i.lng??i.longitude;if(!g(a)||!g(c))throw new Error("Geolocation lookup failed");let u=m(i.timezone)?i.timezone:i.timezone?.id??i.timeZone,f={lat:a,lng:c,latitude:a,longitude:c,...m(i.country||i.countryName||i.country_name)?{country:i.country||i.countryName||i.country_name}:{},...m(i.city||i.cityName||i.city_name)?{city:i.city||i.cityName||i.city_name}:{},...m(u)?{timezone:u}:{},...m(i.query||i.ip||i.ip_address)?{query:i.query||i.ip||i.ip_address}:{},status:"success"};return t.debug&&Br.info(t,"serverGeoLocation success: ",f),f}catch(n){let o=n?.message||"Server geolocation error";if(t.debug&&Br.error(t,"serverGeoLocation error: ",o),!r)throw n;return{error:o,status:"fail"}}},it=async(e,t)=>{if(!_(e)){let n=e.latitude??e.lat,o=e.longitude??e.lng??e.lon??e.long;if(g(n)&&g(o))return{lat:n,lng:o}}let r=await We(t);return _(r.error)&&g(r.lat)&&g(r.lng)?{lat:r.lat,lng:r.lng}:null},Ut=async(e,t)=>{let r=await it(e,t);return r?r.lat>=0?"north":"south":tt()??null}});var io={};ge(io,{GEO_PROPERTIES:()=>ke,GeoPlugin:()=>Zt,clearStashedGeo:()=>ct,coerceGeo:()=>ae,default:()=>oo,geoLocation:()=>Ge,geoLookup:()=>lt,geoPlugin:()=>no,getStashedGeo:()=>Te,haversineDistance:()=>ut,resolveGeoCoordinates:()=>Ue,serverGeoCoords:()=>it,serverGeoLocation:()=>We,serverMapHemisphere:()=>Ut,solarOffset:()=>ft,stashGeo:()=>at});var U={};ge(U,{definePlugin:()=>dt,defineTerm:()=>rn});Oe(U,jt(pt()));var Ze=jt(pt()),dt=e=>(0,Ze.definePlugin)({...e,version:"1.1.0"}),rn=e=>(0,Ze.defineTerm)({...e,version:"1.1.0"});De();P();Pt();P();function ie(...e){for(let t of e){let r=S(t)?t():t;if(r!==void 0)return r}}var st="_magma_geo_",Kr=1440*60*1e3,ke=["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city","timezone","tz"],jr=e=>g(e)&&e>=-90&&e<=90?Math.round(e*1e3)/1e3:void 0,Yr=e=>g(e)&&e>=-180&&e<=180?Math.round(e*1e3)/1e3:void 0,xe=(e,t)=>{let r=jr(e),n=Yr(t);return r!==void 0&&n!==void 0?{lat:r,lng:n}:void 0},me=(e,t)=>{if(e==="north"||e==="south"||e==="equator")return e;if(g(t))return t>.001?"north":t<-.001?"south":"equator"},ae=e=>{if(m(e)&&e.includes(",")){let p=e.split(",").map(y=>y.trim()).map(y=>y===""?NaN:Number(y));if(p.length>=2&&!isNaN(p[0])&&!isNaN(p[1])){let y=xe(p[0],p[1]);if(y){let I={latitude:y.lat,longitude:y.lng},v=me(void 0,y.lat);return v&&(I.sphere=v),I}}return}if(X(e))return;if(Array.isArray(e)&&e.length>=2){let l=xe(e[0],e[1]);if(l){let p={latitude:l.lat,longitude:l.lng},y=me(void 0,l.lat);return y&&(p.sphere=y),p}return}let t=e.geo??e,r=e.config?.geo??e.config,n=ie(t?.latitude,t?.lat,e.latitude,e.lat,r?.latitude,r?.lat),o=ie(t?.longitude,t?.lng,t?.lon,t?.long,e.longitude,e.lng,e.lon,e.long,r?.longitude,r?.lng,r?.lon,r?.long),s=ie(t?.elevation,e.elevation,r?.elevation),i=ie(t?.sphere,e.sphere,r?.sphere),a=ie(t?.country,e.country,r?.country),c=ie(t?.city,e.city,r?.city),u=ie(t?.timezone,t?.tz,e.timezone,e.tz,r?.timezone,r?.tz),f={},d=jr(n),h=Yr(o);d!==void 0&&(f.latitude=d),h!==void 0&&(f.longitude=h),g(s)&&(f.elevation=Math.round(s*1e3)/1e3);let b=me(i,f.latitude);b&&(f.sphere=b),m(a)&&(f.country=a),m(c)&&(f.city=c),m(u)&&(f.timezone=u);let O=$(e.geo)?e.geo:$(e.config?.geo)?e.config.geo:void 0;if($(O))for(let l of Object.keys(O))k(l)&&!ke.includes(l)&&(f[l]=O[l]);return Object.keys(f).length>0?f:void 0},Bt=e=>{if(m(e)&&!R(e)){let t=e.trim();return t.startsWith(st)?t:`${st}:${t}`}if(e&&T(e)){let t=e.key??e.ip??e.query;if(m(t)&&!R(t))return`${st}:${t.trim()}`}return st},Te=e=>{let t=Bt(e);try{let r=Tr(t)??(typeof localStorage<"u"?localStorage.getItem(t):void 0);if(!r)return;let n=m(r)&&(r.startsWith("{")||r.startsWith("["))?JSON.parse(r):r;if(T(n)&&g(n._expires)&&Date.now()>n._expires){ct(e);return}if(m(n)&&n.includes(",")){let o=n.split(",").map(i=>parseFloat(i.trim())),s=xe(o[0],o[1]);if(s)return{latitude:s.lat,longitude:s.lng,sphere:me(void 0,s.lat)}}if(T(n)){let o=n.geolocation?.coords??n.coords??n,s=o?.latitude??o?.lat,i=o?.longitude??o?.lng??o?.lon??o?.long,a=xe(s,i);if(a){let c={latitude:a.lat,longitude:a.lng},u=n.elevation??o.elevation;return g(u)&&(c.elevation=Math.round(u*1e3)/1e3),c.sphere=me(n.sphere,a.lat),m(n.country)&&(c.country=n.country),m(n.city)&&(c.city=n.city),m(n.timezone)&&(c.timezone=n.timezone),c}}}catch{}},at=(e,t=Kr,r)=>{let n=Bt(r),o=g(t)&&t>0?{...e,_expires:Date.now()+t}:e;Nt(n,o,{ttl:t})},ct=e=>{let t=Bt(e);Nt(t,void 0)},lt=async(e={})=>{if(e.refresh!==!0){let a=Te(e);if(a&&g(a.latitude)&&g(a.longitude)){let{latitude:c,longitude:u,...f}=a;return{...f,status:"cached",lat:c,lng:u,latitude:c,longitude:u}}}let{type:r}=ye(),n;switch(r){case x.Browser:{let{geoLocation:a}=await Promise.resolve().then(()=>(Ft(),Fr)),c=await a(e);if(c.error)return{error:c.error};let u=c.coords?.latitude,f=c.coords?.longitude;n={...c,lat:u,lng:f,latitude:u,longitude:f};break}case x.WebWorker:case x.NodeJS:case x.Deno:default:{let{serverGeoLocation:a}=await Promise.resolve().then(()=>(Jt(),Zr));n=await a(e);break}}let o=n.latitude??n.lat,s=n.longitude??n.lng,i=xe(o,s);if(_(n.error)&&i){let a=me(n.sphere,i.lat);n.lat=i.lat,n.lng=i.lng,n.latitude=i.lat,n.longitude=i.lng,n.sphere=a;let c={latitude:i.lat,longitude:i.lng,sphere:a,...m(n.city)?{city:n.city}:{},...m(n.country)?{country:n.country}:{},...g(n.elevation)?{elevation:Math.round(n.elevation*1e3)/1e3}:{},...m(n.timezone)?{timezone:n.timezone}:{}};try{let u=g(e.ttl)?e.ttl:Kr;at(c,u,e)}catch{}}return n},Ue=async(e,t={})=>{let r=ae(e);if(r&&g(r.latitude)&&g(r.longitude))return{...r,lat:r.latitude,lng:r.longitude};let n=t.refresh===!0?void 0:Te(t);if(n&&g(n.latitude)&&g(n.longitude))return{...n,lat:n.latitude,lng:n.longitude};let o=await lt(t),s=xe(o.lat,o.lng);if(_(o.error)&&s){let i=me(o.sphere,s.lat);return{...o,lat:s.lat,lng:s.lng,latitude:s.lat,longitude:s.lng,sphere:i}}return null};function ut(e,t,r="km"){let n=ae(e),o=ae(t);if(!n||!o||!g(n.latitude)||!g(n.longitude)||!g(o.latitude)||!g(o.longitude))return NaN;let s=Math.PI/180,i=n.latitude*s,a=n.longitude*s,c=o.latitude*s,u=o.longitude*s,f=c-i,d=u-a,h=Math.sin(f/2)**2+Math.cos(i)*Math.cos(c)*Math.sin(d/2)**2,b=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),O;r==="miles"?O=3958.7613:r==="m"?O=63710088e-1:O=6371.0088;let l=O*b;return r==="m"?Math.round(l):Math.round(l*1e3)/1e3}var ro=(e,t)=>{try{if(typeof Temporal<"u"&&typeof Temporal.Instant?.fromEpochMilliseconds=="function")return Temporal.Instant.fromEpochMilliseconds(t).toZonedDateTimeISO(e).offsetNanoseconds/6e10;let n=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset",year:"numeric"}).formatToParts(new Date(t)).find(o=>o.type==="timeZoneName")?.value;if(n){if(n==="GMT"||n==="UTC")return 0;let o=n.match(/GMT([+-])(\d{2}):(\d{2})/);if(o)return(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+parseInt(o[3],10))}}catch{}};function ft(e,t){let r=ae(e);if(!r||!g(r.latitude)||!g(r.longitude)||isNaN(r.latitude)||isNaN(r.longitude))return NaN;let n=r.longitude,o=t?.timeZone??($(e)?e.timezone??e.tz:void 0)??r.timezone,s=t?.date??($(e)&&g(e.epoch?.ms)?e.epoch.ms:Date.now()),i=typeof s=="number"?s:m(s)?Date.parse(s):Ee(s)?s.getTime():$(s)&&g(s?.epoch?.ms)?s.epoch.ms:Date.now();if(!Number.isFinite(i))return NaN;let a=Qt(o)?ro(o,i):void 0,c=a!==void 0?a/60*15:Math.round(n/15)*15,f=(n-c)*4;if(t?.apparent){let l=new Date(i),p=Date.UTC(l.getUTCFullYear(),0,1),y=Math.floor((i-p)/864e5)+1,I=2*Math.PI/365*(y-1),v=229.18*(75e-6+.001868*Math.cos(I)-.032077*Math.sin(I)-.014615*Math.cos(2*I)-.040849*Math.sin(2*I));f+=v}let d=t?.unit??"minutes",h;d==="seconds"?h=f*60:d==="hours"?h=f/60:h=f;let b=t?.precision??2,O=Math.pow(10,b);return Math.round(h*O)/O}Jt();Ft();P();var Zt=dt({name:"geo",install(e,t){let r=e||this,n=(o,s)=>{let i=r.config?.pluginOptions?.geo,a=s?.config?.pluginOptions?.geo;return{...T(t)?t:{},...T(i)?i:{},...T(a)?a:{},...T(o)?o:{}}};Object.hasOwn(r,"geo")||Object.defineProperty(r,"geo",{value:(0,U.deepFreeze)({lookup:s=>lt(n(s)),resolve:(s,i)=>Ue(s,n(i,s)),coerce:ae,distance:ut,solarOffset:ft,stash:at,clear:ct,get:Te,server:We,browser:Ge,get current(){return Te()??r.config?.geo}}),writable:!1,configurable:!1,enumerable:!1}),e.prototype.geoLocate=async function(o){let s=n(o,this),i=s?.setTimezone!==!1,a=await Ue(this,s);if(a){let c=T(this.config.geo)?this.config.geo:{},u={};for(let l of Object.keys(c))k(l)&&!ke.includes(l)&&(u[l]=c[l]);let f=ae(o)??{};if(T(o))for(let l of Object.keys(o))k(l)&&!["setTimezone","refresh","ttl","endpoint","timeout","catch","debug","geo"].includes(l)&&(ke.includes(l)||(u[l]=o[l]));let d=g(a?.elevation)?a.elevation:g(c.elevation)?c.elevation:void 0,h={...u,...a,...g(d)?{elevation:d}:{},...f};g(h.latitude)&&(h.latitude=Math.round(h.latitude*1e3)/1e3),g(h.longitude)&&(h.longitude=Math.round(h.longitude*1e3)/1e3),!h.sphere&&g(h.latitude)&&(h.sphere=h.latitude>.001?"north":h.latitude<-.001?"south":"equator");let b=this,O=h.timezone;return i&&m(O)&&!R(O)&&(b=this.set({timeZone:O})),new e(b,{...b.config,geo:(0,U.deepFreeze)(h),...h.sphere?{sphere:h.sphere}:{}})}return this},e.prototype.geoLookup=async function(o){return Ue(this,n(o,this))},e.prototype.geoDistance=function(o,s){return ut(this,o,s)},e.prototype.geoSolarOffset=function(o){return ft(this,o)}}}),no=Zt,oo=Zt;return tn(io);})();
|
|
1
|
+
"use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var gn=Object.create;var Ye=Object.defineProperty;var hn=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var wn=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var E=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var ur=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},be=(e,t)=>{for(var r in t)Ye(e,r,{get:t[r],enumerable:!0})},He=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of yn(t))!bn.call(e,o)&&o!==r&&Ye(e,o,{get:()=>t[o],enumerable:!(n=hn(t,o))||n.enumerable});return e},Pe=(e,t,r)=>(He(e,t,"default"),r&&He(r,t,"default")),bt=(e,t,r)=>(r=e!=null?gn(wn(e)):{},He(t||!e||!e.__esModule?Ye(r,"default",{value:e,enumerable:!0}):r,e)),Sn=e=>He(Ye({},"__esModule",{value:!0}),e);var St=ur((Po,fr)=>{"use strict";fr.exports=window.Magma.pluginSdk});var Tn,On,En,_n,Nn,vn,Pn,In,pr,Dn,dr,S,H=E(()=>{"use strict";Tn=Symbol.for("$LibraryTarget"),On=Symbol.for("$LibraryDiscover"),En=Symbol.for("$LibraryExtensible"),_n=Symbol.for("nodejs.util.inspect.custom"),Nn=Symbol.for("$LibraryLogConfig"),vn=Symbol.for("$LibraryRegistry"),Pn=Symbol.for("$LibraryRegister"),In=Symbol.for("$LibrarySerializerRegistry"),pr=Symbol.for("$LibraryMutable"),Dn=Symbol.for("$LibraryIdentity"),dr=Symbol.for("$LibraryUnwrapped"),S={$Target:Tn,$Discover:On,$Extensible:En,$Inspect:_n,$LogConfig:Nn,$Registry:vn,$Register:Pn,$SerializerRegistry:In,$Identity:Dn,$Mutable:pr,$Unwrapped:dr}});function Se(e){let t=e,r=0,n=50;for(;t;){let o=t[S.$Target];if(!o||r>=n)break;t=o,r++}return t}function C(e,t=!1){if(!e||typeof e!="object")return[];let r=Se(e);if(!t){let l=Reflect.ownKeys(r),u=[];for(let f of l){let w=Object.getOwnPropertyDescriptor(r,f);w&&w.enumerable&&u.push([f,r[f]])}return u}let n=[],o=50,s=0,i=r;for(;i&&i!==Object.prototype&&s++<o;)n.push(Se(i)),i=Object.getPrototypeOf(i);let a=[],c=new Set;for(let l of n.reverse()){let u=Reflect.ownKeys(l);for(let f of u){if(c.has(f))continue;let w=Object.getOwnPropertyDescriptor(l,f);!w||!w.enumerable||(c.add(f),a.push([f,r[f]]))}}return a}function Ve(e,t=!1){return C(e,t).map(([r])=>r)}function mr(e,t=!1){return C(e,t).map(([r,n])=>n)}function Xe(e,t,r){return t?Xe(e.map(t,r)):Array.from(new Set(e))}var Y=E(()=>{"use strict";H()});var Tt,Ot,Qe,de,te,Rn,Mn,et,J=E(()=>{"use strict";H();Y();Tt=[],Ot=e=>{if(e===null)return"Null";if(e===void 0)return"Undefined";let t=typeof e;if(t==="string")return"String";if(t==="number")return"Number";if(t==="boolean")return"Boolean";if(t==="bigint")return"BigInt";if(t==="symbol")return"Symbol";try{let r=t==="object"?Se(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Qe=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},de=(e,...t)=>{let r=e;try{r=e?.[S.$Target]??e}catch{r=e}let n=Ot(r);switch(n){case"Function":try{return Mn(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(s=>s==="length"||Number.isFinite(Number(s))))return"ArrayLike";for(let s of t){let i=s.class?.[S.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}let o=globalThis[S.$Registry]??[];for(let s of[...Tt,...o]){let i=s.class?.[S.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}}catch{return"Object"}return"Object"}default:return n}},te=(e,...t)=>({type:de(e,...t),value:e}),Rn=/^\s*(class\s|\[native code\])/,Mn=e=>{if(typeof e!="function")return!1;let t=e?.[S.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Qe(t);if(t?.[S.$Identity]||t?.prototype?.[S.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[S.$Registry]??[]).some(s=>(s.class?.[S.$Target]??s.class)===t||r&&s.type===r||n&&s.type===n))return!0;try{let s=Function.prototype.toString.call(t);if(Rn.test(s))return!0;let i=Object.getOwnPropertyDescriptor(t,"prototype");if(i&&i.writable===!1&&!Object.isFrozen(t))return!0;let a=t.prototype;if(a&&Object.getOwnPropertyNames(a).length>2)return!0}catch{return!1}return!1},et=(e,t)=>{if(typeof e!="function")return;let r=Qe(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(Tt.some(o=>o.class===e)||Tt.push({class:e,type:n}))}});function tt(e){switch(typeof e){case"number":return Number.isFinite(e);case"bigint":return!0;case"string":{let r=e.trim();return r.length===0?!1:An.test(r)||d(Number(r))}default:return!1}}var W,re,$,gr,m,hr,d,An,Et,me,yr,D,xe,wr,ne,_t,oe,x,q,T,b,M,Ie,De,rt,Re,A,v=E(()=>{"use strict";H();J();W=(e,...t)=>t.includes(de(e)),re=e=>e===null||typeof e!="object"&&typeof e!="function",$=e=>!re(e),gr=e=>Symbol.iterator in Object(e)&&!m(e),m=e=>typeof e=="string",hr=e=>typeof e=="string"&&e.trim().length>0,d=e=>Number.isFinite(e),An=/^[+-]?[0-9]+n$/;Et=e=>typeof e=="bigint",me=e=>Array.isArray(e),yr=e=>Ot(e)==="Object"&&"length"in e&&Object.keys(e).every(t=>t==="length"||d(Number(t))),D=e=>W(e,"Object"),xe=e=>W(e,"Date"),wr=e=>W(e,"RegExp"),ne=e=>typeof e=="symbol",_t=e=>typeof e=="symbol"&&Symbol.keyFor(e)!==void 0,oe=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",x=e=>e==null||W(e,"Void","Empty"),q=e=>e===void 0||W(e,"Void","Empty"),T=e=>e!=null&&!x(e),b=e=>W(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),M=e=>typeof e=="function",Ie=e=>W(e,"Map"),De=e=>W(e,"Set"),rt=(e,t)=>W(e,"Error")&&(t?e instanceof t:!0),Re=e=>typeof Intl<"u"&&typeof Intl.Locale=="function"&&e instanceof Intl.Locale,A=e=>x(e)||D(e)&&Reflect.ownKeys(e).length===0||m(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||me(e)&&e.length===0||De(e)&&e.size===0||Ie(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||xe(e)&&Number.isNaN(e.getTime())});function Nt(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??Cn;return re(e)||r.has(e)||n.has(e)||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof Promise||e?.[Symbol.toStringTag]==="Enumify"||e[S.$Extensible]?e:(r.add(e),C(e).forEach(([o,s])=>{oe(o)&&Nt(s,{skip:n},r)}),Object.freeze(e))}var O,Te,Cn,Me=E(()=>{"use strict";Y();v();H();O={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},Te=()=>{let e=globalThis;try{if(T(e.SpreadsheetApp))return{global:e,type:O.GoogleAppsScript};if(T(e.window?.document))return{global:e,type:O.Browser};if(b(e.importScripts)||T(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:O.WebWorker};if(T(e.Deno))return{global:e,type:O.Deno};if(T(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:O.NodeJS}}catch{}return{global:e,type:O.Unknown}},Cn=new WeakSet});function br(e){return Object.fromEntries(C(e,!0))}var Sr=E(()=>{"use strict";Y();J();v()});function Tr(e,t={},r=!1){let{frozen:n,lock:o,appendOnly:s,onGet:i,keys:a,bind:c,skip:l}=t,u=new Set,f,w,h=Se(e);o&&Nt(h,l?{skip:l}:void 0),et(h);let N={isExtensible:g=>Reflect.isExtensible(g),getPrototypeOf:g=>Reflect.getPrototypeOf(g),setPrototypeOf:(g,p)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(g,p)},getOwnPropertyDescriptor:(g,p)=>{if(!(a&&!a.includes(p))){if(a){if(i&&!ne(p)&&!u.has(p)){u.add(p);try{let y=i(p,g);if(T(y))return{enumerable:!0,configurable:!0,value:y}}finally{u.delete(p)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(g,p)}},ownKeys:g=>{if(a)return a;if(i&&!u.has(S.$Discover)){u.add(S.$Discover);try{i(S.$Discover,g)}finally{u.delete(S.$Discover)}}return Reflect.ownKeys(g)},has:(g,p)=>a?a.includes(p):Reflect.has(g,p),deleteProperty:(g,p)=>{if(n)throw new TypeError(`Cannot delete property '${String(p)}' from a protected object.`);if(s&&Reflect.has(g,p))throw new Error(`Security: Deletion attempt on protected key '${String(p)}'`);return Reflect.deleteProperty(g,p)},defineProperty:(g,p,y)=>{if(n&&!Object.isFrozen(g))throw new TypeError(`Cannot define property '${String(p)}' on a frozen object.`);if(s&&Reflect.has(g,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`);return Reflect.defineProperty(g,p,y)},set:(g,p,y,I)=>{if(n&&I===w)throw new TypeError(`Cannot set property '${String(p)}' on a frozen object.`);if(s){if(Array.isArray(g)&&p==="length"&&y<g.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(g)&&p==="length")&&Reflect.has(g,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`)}return Reflect.set(g,p,y,I)},get:(g,p,y)=>{if(p===S.$Target)return y===w?g:void 0;if(n&&(p===S.$Inspect||p==="toJSON")){let R=Object.getOwnPropertyDescriptor(g,p);return R&&b(R.value)?R.value:(f||(f=()=>br(g)),f)}if(a&&!a.includes(p))return;if(i&&!ne(p)&&!Reflect.has(g,p)&&!u.has(p)){u.add(p);try{let R=i(p,g);if(T(R))return R}finally{u.delete(p)}}let I=Reflect.get(g,p,y);if(c&&p!=="constructor"&&b(I)){let R=Object.getOwnPropertyDescriptor(g,p);if(R&&!R.configurable&&!R.writable)return I;let fe=xr.get(I);fe||(fe=new WeakMap,xr.set(I,fe));let pe=fe.get(g);if(pe)return pe;let lr=I.bind(g);return fe.set(g,lr),lr}return I}};if(r){let g=Proxy.revocable(h,N);return w=g.proxy,{proxy:g.proxy,revoke:g.revoke}}return w=new Proxy(h,N),w}function Or(e,t=!0,r=t,n=new WeakSet){return Tr(e,{frozen:t,lock:r,skip:n,bind:t})}function Ae(e,t=new WeakSet){return Tr(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var xr,nt=E(()=>{"use strict";H();Sr();Me();Y();v();J();xr=new WeakMap});function Ce(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(Et(n))return`\0__bigint:${n}__\0`;if(b(n))return`function:${n.name||"anonymous"}`;if($(n)){if(t.has(n))return"<Circular>";if(t.add(n),Re(n))return n.toString();if(Ie(n))return`map:[${Array.from(n.entries()).map(o=>Ce(o,t)).sort().join(",")}]`;if(De(n))return`set:[${Array.from(n).map(o=>Ce(o,t)).sort().join(",")}]`}return n})}function _r(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function L(e){let t=new Map;return function(...r){let n=Ce(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let o=e.apply(this,r);t.set(n,o)}return t.get(n)}}function $e(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${Ce(r)}`,o=Er.get(this);if(o||(o=new Map,Er.set(this,o)),!o.has(n)){let s=t.apply(this,r);Ae(s),o.set(n,s)}return o.get(n)}}}var Er,ot=E(()=>{"use strict";nt();v();Er=new WeakMap});function Nr(e){try{return JSON.parse(JSON.stringify(e))}catch(t){throw console.warn("Could not clean object:",t?.message??t),t}}var vr=E(()=>{"use strict";v()});function se(e){return T(e)?b(e)?e():e:t=>b(t)?t():t}var Ln,ie,vt=E(()=>{"use strict";Y();v();J();Ln=e=>{let t=new Set,r=e,n=0;for(;r&&r!==Object.prototype&&n++<10;){let o=Object.getOwnPropertyDescriptors(r);for(let[s,i]of Object.entries(o))oe(s)&&(i.enumerable||b(i.get))&&t.add(s);r=Object.getPrototypeOf(r)}return Array.from(t)},ie=e=>{if(re(e)||b(e))return e;if(me(e))return e.map(r=>ie(r));if(xe(e)||wr(e)||Ie(e)||De(e))return e;try{if(b(e.toJSON))return ie(e.toJSON())}catch{}let t={};for(let r of Ln(e))try{t[r]=ie(e[r])}catch{}return t};se.stringSymbol=se();se.symbolRegExp=se();se.symbolString=se();se.stringString=se()});function Rr(e,t){try{return globalThis.structuredClone(e,t)}catch{return Nr(e)}}function Fn(e,t){return Gn(t)}function Ir(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(zn,r=>Mr[r.toUpperCase()]??decodeURI(r))),t}function Gn(e){if(m(e))try{return decodeURI(e)}catch{}return e}function Le(e){return!W(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function kn(e,t){return`{"$${e}":${t}}`}function Wn(e){return z(ne(e)?`${_t(e)?"@":""}@(${e.description??""})`:e)}function Pt(e){let[t,r,n]=e.toString().match(Un)||[null,void 0,void 0];switch(!0){case ne(e):case x(t):case(T(r)&&q(n)):return e;case T(r):return Symbol.for(n);case q(r):default:return Symbol(n)}}function Z(e,t){let r=ge;ge=t?.compact!==!1;try{let n=z(e,!1);if(t?.signed){if(!m(t.secret)||!t.secret)throw new TypeError("stringify: signed serialization requires an explicit secret string");return`$sig:${Ar(n,t.secret)}:${n}`}return n}finally{ge=r}}function z(e,t=!0){let r=te(e),n=_r(kn)(r.type);switch(r.type){case"String":{let o=r.value;return o.startsWith("~")&&(o=`~${o}`),t||(t=o==="true"||o==="false"||o==="null"||parseFloat(o).toString()===o||o.startsWith("~")),t?JSON.stringify(Ir(o)):Ir(o)}case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return ge?JSON.stringify("~u"):n(JSON.stringify("void"));case"BigInt":return ge?JSON.stringify(`~n${r.value.toString()}`):n(r.value.toString());case"Date":return ge?JSON.stringify(`~t${r.value.getTime()}`):n(z(r.value.toJSON()));case"Object":return`{${C(r.value).filter(([,s])=>Le(s)).map(([s,i])=>`${Wn(s)}: ${z(i)}`).join(",")}}`;case"Array":return`[${r.value.filter(s=>Le(s)).map(s=>z(s)).join(",")}]`;case"Map":{let o=Array.from(r.value.entries()).filter(([,s])=>Le(s)).map(([s,i])=>`[${z(s)}, ${z(i)}]`).join(",");return n(`[${o}]`)}case"Set":{let o=Array.from(r.value.values()).filter(s=>Le(s)).map(s=>z(s)).join(",");return n(`[${o}]`)}case"Symbol":{let o=`${_t(r.value)?"@":""}@(${r.value.description??""})`;return ge?JSON.stringify(`~y${o}`):n(JSON.stringify(o))}case"RegExp":return n(z({source:r.value.source,flags:r.value.flags}));default:{let o=r.value;switch(!0){case!Le(o):return;case b(o.toJSON):return n(z(o.toJSON()));case(b(o.toString)&&o.toString!==Object.prototype.toString):{let s=o.toString();return n(s.includes('"')?s:JSON.stringify(s))}case(b(o.valueOf)&&o.valueOf!==Object.prototype.valueOf):return n(JSON.stringify(o.valueOf()));default:{let s=ie(o);return $(s)&&Object.keys(s).length>0?z(s):n(JSON.stringify(o,(i,a)=>A(i)?a:z(a)))}}}}}function he(e,t){if(!m(e))return e;let r=b(t)?{sentinel:t}:t??{};if(e.startsWith("$sig:")){let o=e.indexOf(":",5);if(o!==-1){let s=e.substring(5,o),i=e.substring(o+1);if(!m(r.secret)||!r.secret){if(console.warn("objectify: signature verification requires an explicit secret string"),r.throwOnError)throw new TypeError("objectify: signature verification requires an explicit secret string");return e}let a=Ar(i,r.secret);if(!Jn(s,a)){if(console.warn("objectify: signature verification failed"),r.throwOnError)throw new Error("objectify: signature verification failed");return e}e=i}else if(r.requireSigned){if(console.warn("objectify: malformed signed payload"),r.throwOnError)throw new Error("objectify: malformed signed payload");return e}}else if(r.requireSigned){if(console.warn("objectify: unsigned string rejected by requireSigned policy"),r.throwOnError)throw new Error("objectify: unsigned string rejected by requireSigned policy");return e}let n;try{n=JSON.parse(e,Fn)}catch(o){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${o.message}`),e):he(`"${e}"`,r.requireSigned?{...r,requireSigned:!1}:r)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return It(n,r,0);default:return Fe(n,r)}}function It(e,t,r=0){let n=t.maxDepth??Zn;return r>=n?e:D(e)?Fe(C(e).filter(([o])=>oe(o)).reduce((o,[s,i])=>Object.assign(o,{[Pt(s)]:Fe(It(i,t,r+1),t)}),{}),t):me(e)?mr(e).map(o=>Fe(It(o,t,r+1),t)):Fe(e,t)}function Fe(e,t){if(m(e)&&e.startsWith("~"))try{if(e.startsWith("~~"))return e.substring(1);if(e.startsWith("~n"))return BigInt(e.substring(2));if(e.startsWith("~t")){let s=e.substring(2),i=new Date(tt(s)?Number(s):s);return isNaN(i.getTime())?e:i}if(e==="~u")return t.sentinel?.();if(e.startsWith("~y"))return Pt(e.substring(2))}catch{return e}if(!D(e)||Ve(e).length!==1)return e;let[r,n]=C(e)[0];if(!String(r).startsWith("$"))return e;let o=r.substring(1);try{switch(o){case"String":case"Boolean":case"Object":case"Array":return n;case"Number":return Number(n);case"BigInt":return BigInt(n);case"Null":return null;case"Undefined":case"Empty":case"Void":return t.sentinel?.();case"Date":return new Date(n);case"RegExp":return t.allowRegExp===!1||!D(n)||!m(n.source)||n.source.length>Kn?e:new RegExp(n.source,n.flags);case"Symbol":return Pt(n);case"Map":return me(n)?new Map(n):e;case"Set":return me(n)?new Set(n):e;default:{if(t.allowClasses===!1||t.allowedClasses&&!(t.allowedClasses instanceof Set?t.allowedClasses.has(r)||t.allowedClasses.has(o):t.allowedClasses.includes(r)||t.allowedClasses.includes(o)))return e;let s=it.get(r);return s?Reflect.construct(s,[n]):(console.warn(`objectify: dont know how to deserialize '${o}'`),e)}}}catch{return e}}var it,Pr,Dr,Mr,zn,Un,Bn,Ar,Jn,ge,Zn,Kn,Oe=E(()=>{"use strict";ot();Y();vr();vt();J();v();H();it=globalThis[S.$SerializerRegistry]??=new Map,Pr=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return m(t)?t:void 0}catch{return}},Dr=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(it.has(r)){let n=it.get(r),o=Pr(n),s=Pr(t),i=n.name||o,a=t.name||s||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[S.$Identity]&&n[S.$Identity]===t[S.$Identity]||!!t[S.$Target]&&n[S.$Target]===t[S.$Target]||!!i&&!!a&&i===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}it.set(r,t)};Mr={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},zn=new RegExp(Object.keys(Mr).join("|"),"gi");Un=/^@(@)?\(([^\)]*)\)$/;Bn=globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID().split("-")[0]:Math.random().toString(36).slice(2,10),Ar=(e,t=Bn)=>{let r=2166136261,n=2654435769,o=`${t}:${e}`;for(let s=0;s<o.length;s++){let i=o.charCodeAt(s);r=Math.imul(r^i,16777619),n=Math.imul(n^i,2246822507)}return(r>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")},Jn=(e,t)=>{if(!m(e)||!m(t)||e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e.charCodeAt(n)^t.charCodeAt(n);return r===0},ge=!0;Zn=64,Kn=512});function ae(e,t,r,n,o,s){function i(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&e?n.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f,w=!1,h=r.length-1;h>=0;h--){var N={};for(var g in n)N[g]=g==="access"?{}:n[g];for(var g in n.access)N.access[g]=n.access[g];N.addInitializer=function(y){if(w)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(y||null))};var p=(0,r[h])(a==="accessor"?{get:u.get,set:u.set}:u[c],N);if(a==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(f=i(p.get))&&(u.get=f),(f=i(p.set))&&(u.set=f),(f=i(p.init))&&o.unshift(f)}else(f=i(p))&&(a==="field"?o.unshift(f):u[c]=f)}l&&Object.defineProperty(l,n.name,u),w=!0}function ce(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}var ze=E(()=>{"use strict"});function Cr(e,t){return Qe(e)??(q(t)?e.name||void 0:String(t))}function $r(e,{kind:t,name:r,addInitializer:n}){let o=Cr(e,r);if(o&&et(e,o),t==="class")return o&&n(()=>Dr(o,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function le(e,t){let r=(n,o,s)=>{let i=n.prototype,a=o??Cr(n,s);if(a&&(i&&!Object.hasOwn(i,Symbol.toStringTag)&&Object.defineProperty(i,Symbol.toStringTag,{value:a,configurable:!0,writable:!1,enumerable:!1}),!n.name||n.name!==a))try{Object.defineProperty(n,"name",{value:a,configurable:!0,writable:!1,enumerable:!1})}catch{}return n};return M(e)&&t?.kind==="class"?r(e,void 0,t.name):(n,o)=>r(n,m(e)?e:void 0,o?.name)}var Ge=E(()=>{"use strict";H();nt();v();Oe();J()});var Dt,Lr=E(()=>{"use strict";ze();v();Ge();Dt=(()=>{let e=[le("BoundedCache")],t,r=[],n,o=Map;var s=class extends o{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;ae(null,t={value:n},e,{kind:"class",name:n.name,metadata:i},null,r),s=n=t.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),ce(n,r)}#t=new Map;#e=new Set;#r=new Map;maxSize;ttl;constructor(i=1e3,a=1440*60*1e3){super(),this.maxSize=i,this.ttl=a}get isBoundedCache(){return!0}#n(i){let a=this.#t.get(i);return a===void 0?!1:Date.now()>a}evictExpired(){if(this.#t.size===0)return;let i=Date.now();for(let[a,c]of this.#t.entries())i>c&&this.delete(a)}setStatic(i,a){return super.has(i)&&super.delete(i),super.set(i,a),this.#e.add(i),this.#t.delete(i),this.#r.delete(i),this}isStatic(i){return this.#e.has(i)}get(i){if(this.#n(i)){this.delete(i);return}if(!super.has(i))return;let a=super.get(i);return super.delete(i),super.set(i,a),a}has(i){return this.#n(i)?(this.delete(i),!1):super.has(i)}get size(){return this.evictExpired(),super.size}forEach(i,a){this.evictExpired(),super.forEach(i,a)}set(i,a,c){this.evictExpired();let l=this.#t.get(i);for(super.has(i)&&super.delete(i),super.set(i,a),this.#e.delete(i),T(c)?c!==1/0?(this.#t.set(i,Date.now()+c),this.#r.set(i,c)):(this.#t.delete(i),this.#r.delete(i)):l!==void 0?this.#t.set(i,l):this.ttl!==1/0?(this.#t.set(i,Date.now()+this.ttl),this.#r.delete(i)):(this.#t.delete(i),this.#r.delete(i));this.size-this.#e.size>this.maxSize;){let u=!1,f=super.keys(),w=f.next();for(;!w.done;){let h=w.value;if(!this.#e.has(h)){this.delete(h),u=!0;break}w=f.next()}if(!u)break}return this}delete(i){return this.#e.delete(i),this.#t.delete(i),this.#r.delete(i),super.delete(i)}deletePrefix(i){let a=String(i).trim().toLowerCase();if(A(a))return 0;let c=[];for(let l of super.keys())m(l)&&l.toLowerCase().startsWith(a)&&c.push(l);for(let l of c)this.delete(l);return c.length}clear(i){if(i===void 0){this.#e.clear(),this.#t.clear(),this.#r.clear(),super.clear();return}let a=0;for(let c of super.keys()){if(a>=i)break;this.#e.has(c)||(this.delete(c),a++)}}keys(){return this.evictExpired(),super.keys()}values(){return this.evictExpired(),super.values()}entries(){return this.evictExpired(),super.entries()}[Symbol.iterator](){return this.evictExpired(),super[Symbol.iterator]()}toJSON(){this.evictExpired();let i=[];for(let[a,c]of super.entries())m(a)&&i.push([a,c]);return Object.fromEntries(i)}static fromEntries(i,a=1e3,c=1440*60*1e3){let l=new s(a,c);for(let[u,f]of i)l.set(u,f);return l}};return s=n})()});function Gr(e,t){let r;if(q(e))return t??{};switch(G.type){case O.Browser:r=Rt.getItem(e);break;case O.NodeJS:r=ke.has(e)?ke.get(e):jn(e);break;case O.Deno:r=G.global.Deno.env.get(e);break;case O.GoogleAppsScript:r=G.global.PropertiesService?.getUserProperties().getProperty(e);break;case O.WebWorker:case O.Unknown:r=void 0;break;default:throw new Error(`Cannot determine Javascript context: ${G.type}`)}return m(r)?he(r):t}function Ct(e,t,r){let n=T(t)?Z(t):void 0,o=T(n);switch(G.type){case O.Browser:try{o?Rt.setItem(e,n):Rt.removeItem(e)}catch(s){console.warn(`[Storage] Failed to ${o?"setItem":"removeItem"} for key '${e}':`,s)}break;case O.NodeJS:o?r?.static?ke.setStatic(e,n):ke.set(e,n,r?.ttl):ke.set(e,void 0,r?.ttl);break;case O.Deno:o?G.global.Deno.env.set(e,n):G.global.Deno.env.delete(e);break;case O.GoogleAppsScript:o?G.global.PropertiesService?.getUserProperties().setProperty(e,n):G.global.PropertiesService?.getUserProperties().deleteProperty(e);break;case O.WebWorker:case O.Unknown:break;default:throw new Error(`Cannot determine Javascript context: ${G.type}`)}}var G,zr,Fr,Mt,At,Rt,ke,jn,$t=E(()=>{"use strict";Oe();Me();v();Lr();G=Te(),zr=(e=1e3,t=1/0)=>{let r=new Dt(e,t);return{get length(){return r.size},clear:()=>r.clear(),getItem:n=>r.get(n)??null,key:n=>Array.from(r.keys())[n]??null,removeItem:n=>{r.delete(n)},setItem:(n,o)=>{r.set(n,String(o))}}},Fr=new Map,Mt=e=>{let t=Fr.get(e);return t||(t=zr(),Fr.set(e,t)),t},At=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&M(t.getItem)&&M(t.setItem)&&M(t.removeItem)&&M(t.clear)&&M(t.key)&&d(t.length))return t}catch{}return Mt(e)},Rt=G.type===O.Browser?At():zr(),ke=new Dt(1e3,1/0),jn=e=>{try{let t=Reflect.get(G.global,"process");if(!t||typeof t!="object")return;let r=Reflect.get(t,"env");return!r||typeof r!="object"?void 0:Reflect.get(r,e)}catch{return}}});var kr=E(()=>{"use strict";Oe();v()});function Wr(e=[],t){let r=n=>q(t)||T(n)?n:Rr(t);return yr(e)||gr(e)&&!m(e)?Array.from(e,r):[e]}function Ur(e){if(rt(e))return e;let t=new Error(D(e)&&m(e.message)?e.message:String(e));return D(e)&&(t.name=m(e.name)?e.name:"Error","code"in e&&(m(e.code)||d(e.code))&&(t.code=e.code),"stack"in e&&m(e.stack)&&(t.stack=e.stack)),t}var ji,Hi,Lt=E(()=>{"use strict";Oe();J();v();kr();ji=BigInt(Number.MAX_SAFE_INTEGER),Hi=BigInt(Number.MIN_SAFE_INTEGER)});var Br=E(()=>{"use strict";Lt();if(typeof globalThis.Temporal>"u")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).");try{if(typeof Temporal.Now.zonedDateTimeISO=="function"&&typeof Temporal.Now.zonedDateTimeISO().add!="function")throw new Error("Incomplete Temporal implementation")}catch(e){let t=Ur(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",t),t.message!=="Incomplete Temporal implementation")throw t}});function Jr(){return Temporal.Now.instant()}function Zr(e,t=2024){let r=Temporal.ZonedDateTime.from({year:t,month:1,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds,n=Temporal.ZonedDateTime.from({year:t,month:7,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds;return{jan:r,jul:n}}var Ft=E(()=>{"use strict";Br();v()});function We(e,t,r){if(e){if(M(e[t]))return e[t]();if(r&&r in e)return e[r]}}function so(e){return e?Qn.has(e)?5:Xn.has(e)?6:Vn.has(e)?7:1:1}function ao(e){return e?e==="IR"?oo:e==="AF"?io:eo.has(e)?no:Kr:Kr}function co(e,t){let r=e?.script??(M(e?.maximize)?e.maximize().script:void 0);return r&&ro.has(r)||t&&to.has(t)?"rtl":"ltr"}var Hn,Yn,Ee,U,is,ss,zt,as,qn,cs,Vn,Xn,Qn,eo,to,ro,Kr,no,oo,io,ue,ls,us,lo,uo,jr,fs,st,ps,at=E(()=>{"use strict";Ft();ot();v();Lt();Hn=/_/g,Yn=/[.@]/,Ee=e=>typeof Intl<"u"&&(!e||Object.hasOwn(Intl,e)&&M(Intl[e])),U=e=>{if(Re(e)&&(e=e.toString()),!m(e))return;let t=e.trim();if(A(t))return;let r=t.split(Yn)[0];if(!A(r))return r.replace(Hn,"-")},is=L((e,t)=>new Intl.RelativeTimeFormat(U(e),t)),ss=L((e,t)=>new Intl.ListFormat(U(e),t)),zt=L((e,t)=>new Intl.DateTimeFormat(U(e),t)),as=L((e,t)=>{try{return new Intl.PluralRules(U(e),t)}catch{return{select:()=>"other"}}}),qn=L((e,t)=>new Intl.NumberFormat(U(e),t)),cs=L((e,t)=>{try{let r=new Intl.DurationFormat(U(e),t);if(b(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}});Vn=new Set(["US","CA","MX","BR","IL","JP","TW","HK","MO","PH","SG","TH","IN","KR","CO","PE","VE","ZA"]),Xn=new Set(["SA","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY","YE"]),Qn=new Set(["MV"]),eo=new Set(["SA","BH","DJ","DZ","EG","IQ","JO","KW","LY","OM","QA","SD","SY","YE"]),to=new Set(["ar","he","fa","ur","yi","ps","sd","ug","ckb"]),ro=new Set(["Arab","Hebr","Thaa","Syrc","Mand","Samr","Nkoo"]),Kr=Object.freeze([6,7]),no=Object.freeze([5,6]),oo=Object.freeze([5]),io=Object.freeze([4,5]);ue=L(e=>{if(Re(e))return e;if(Ee("Locale"))try{let t=U(e);return new Intl.Locale(t||"en-US")}catch{return}}),ls=L(e=>{let t=ue(e)??ue("en-US"),r=t?.baseName??jr(e)??"en-US",n=t?.language??r.split("-")[0]?.toLowerCase(),o=[];for(let pe of r.split("-").slice(1)){if(pe.length===1)break;o.push(pe)}let s=t?.region??(M(t?.maximize)?t.maximize().region:void 0)??o.find(pe=>/^[a-zA-Z]{2}$|^\d{3}$/.test(pe))?.toUpperCase(),i=t?.script??(M(t?.maximize)?t.maximize().script:void 0),a=We(t,"getWeekInfo","weekInfo"),c=a?.firstDay??so(s),l=Array.isArray(a?.weekend)?Object.freeze([...a.weekend]):ao(s),f=We(t,"getHourCycles","hourCycles")??t?.hourCycle??(Ee("DateTimeFormat")?zt(r,{hour:"numeric"}).resolvedOptions().hourCycle:void 0),w=Array.isArray(f)&&f.length>0?Object.freeze([...f]):m(f)?Object.freeze([f]):Object.freeze(["h23"]),h=We(t,"getTextInfo","textInfo"),N=h?.direction==="rtl"||h?.direction==="ltr"?h.direction:co(t,n),p=We(t,"getNumberingSystems","numberingSystems")??t?.numberingSystem??(Ee("NumberFormat")?qn(r).resolvedOptions().numberingSystem:void 0),y=Array.isArray(p)&&p.length>0?Object.freeze([...p]):m(p)?Object.freeze([p]):Object.freeze(["latn"]),I=We(t,"getTimeZones","timeZones"),R=Array.isArray(I)&&I.length>0?Object.freeze([...I]):Object.freeze([]),fe=Object.freeze({firstDay:c,weekend:l});return Object.freeze({locale:t,baseName:r,language:n,region:s,script:i,weekInfo:fe,firstDay:c,weekend:l,hourCycle:w[0],hourCycles:w,direction:N,numberingSystem:y[0],numberingSystems:y,timeZones:R})}),us=L((e="latn")=>{if(!(!e||e==="latn"||!Ee("NumberFormat")))try{let t=new Intl.NumberFormat(`en-u-nu-${e}`,{useGrouping:!1}),r=Array.from({length:10},(n,o)=>t.format(o));return r[0]==="0"&&r[9]==="9"?void 0:Object.freeze(r)}catch{return}}),lo=Object.freeze({locale:"en-US",calendar:"iso8601",numberingSystem:"latn",timeZone:"UTC"}),uo=L(()=>Ee("DateTimeFormat")?Object.freeze(zt().resolvedOptions()):lo),jr=L(e=>{let t=U(e);if(t){if(Ee("getCanonicalLocales"))try{return Intl.getCanonicalLocales(t)[0]}catch{return}return ue(t)?.baseName??t}}),fs=L(e=>Object.freeze(Wr(e).map(t=>jr(t)).filter(Boolean))),st=L((e=uo().timeZone)=>{try{let{jan:t,jul:r}=Zr(e),o=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(s=>e.startsWith(s));switch(!0){case r>t:return"north";case r<t:return"south";default:return o?"south":void 0}}catch{return}}),ps=L(e=>{try{let t=new Date(2024,11,24),r=zt(e).formatToParts(t);return r[0].type==="month"&&r[0].value==="12"}catch{return!1}})});function V(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function _e(e,t=!0){let n=de(this)!=="Module"&&b(this?.has)?this:po,o=te(e),s=Object.create(n);switch(o.type){case"Enumify":case"Object":Object.defineProperties(s,Object.getOwnPropertyDescriptors(o.value));break;case"Array":o.value.forEach((i,a)=>{if(d(i))throw new Error("Enumify: numeric keys are not supported");s[i]=a});break;default:throw new Error(`Enumify: invalid argument type: ${o.type}`)}return Or(s,!0,t)}var fo,po,xs,Hr=E(()=>{"use strict";ze();J();v();Y();nt();Ge();ot();fo="Enumify",po=Ae(Object.create(null,{keys:$e("keys",function(){return C(this,!0).map(([e])=>e)}),values:$e("values",function(){return C(this,!0).map(([e,t])=>t)}),entries:$e("entries",function(){return C(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:$e("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:V(function(e){return this.keys().includes(e)}),count:V(function(){return this.keys().length}),includes:V(function(e){return this.values().includes(e)}),keyOf:V(function(e){return this.invert()[e]}),extend:V(function(e,t){return _e.call(this,e,t)}),forEach:V(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:V(function(e,t){return _e(this.entries().reduce((r,n,o)=>e.call(t,n,o,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:V(function(e,t){return _e(this.entries().reduce((r,n,o)=>Object.assign(r,{[n[0]]:e.call(t,n,o,this)}),{}))}),[Symbol.iterator]:V(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:fo}}));xs=(()=>{let e=[$r,le("Enumify")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;ae(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ce(n,r)}constructor(s){return _e(s)}};return o=n})()});function mo(e,t=k.Info){return d(e)?e>=k.Off&&e<=k.Trace?e:t:m(e)?Yr[e.toLowerCase()]??t:t}var k,F,Yr,ct,Gt=E(()=>{"use strict";ze();v();Hr();H();Ge();k=_e(["Off","Error","Warn","Info","Debug","Trace"]),F={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},Yr={[F.Off]:k.Off,[F.Error]:k.Error,[F.Warn]:k.Warn,[F.Info]:k.Info,[F.Log]:k.Info,[F.Debug]:k.Debug,[F.Trace]:k.Trace};ct=(()=>{let e=[le("Logger")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;ae(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ce(n,r)}#t;level;constructor(s,i=k.Info){this.#t=s.startsWith("[")?s:`[${s}]`,this.level=i}#e(s,...i){let a;if(i.length>0&&D(i[0]))try{i[0][S.$LogConfig]&&(a=i.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=mo(a.debug,c))}if(c===k.Off||(Yr[s]??0)>c)return;let u=i.map(f=>{if(rt(f))return f.message;if(D(f))try{let w=f.constructor?.name??"Object";if(w==="Object"){let h=Object.keys(f);return`{ ${h.slice(0,3).join(", ")}${h.length>3?`, ... (+${h.length-3} more)`:""} }`}return`[${w}]`}catch{return"[Object]"}return String(f)}).filter(f=>!A(f)).join(" ");A(u)||console[s](`${this.#t} ${u}`)}log=(...s)=>this.#e(F.Log,...s);info=(...s)=>this.#e(F.Info,...s);warn=(...s)=>this.#e(F.Warn,...s);debug=(...s)=>this.#e(F.Debug,...s);trace=(...s)=>this.#e(F.Trace,...s);error=(...s)=>this.#e(F.Error,...s)};return o=n})()});var qr={};be(qr,{WebStore:()=>go});var Ue,go,Vr=E(()=>{"use strict";ze();Y();Oe();J();v();$t();Ge();Ue={Local:"local",Session:"session"},go=(()=>{let e=[le("WebStore")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;ae(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ce(n,r)}static _localInstance;static _sessionInstance;static get local(){return o._localInstance??=new o(Ue.Local)}static get session(){return o._sessionInstance??=new o(Ue.Session)}#t;#e;get#r(){if(this.#e)return this.#e;let s=this.#t===Ue.Local?"localStorage":"sessionStorage";return this.#e=At(s)}#n(s){try{return s(this.#r)}catch{let a=this.#t===Ue.Local?"localStorage":"sessionStorage",c=Mt(a);return this.#e=c,s(c)}}constructor(s=Ue.Local){this.#t=s}get(s,i){let a=this.#n(c=>c.getItem(Z(s)));return m(a)?he(a):i??null}set(s,i,a={merge:!0}){if(x(s))return this.clear();let c=this.get(s),l=te(i);switch(l.type){case"Undefined":return this.del(s);case"Object":return c??={},this.#o(s,a.merge?Object.assign(c,l.value):l.value);case"Array":return c??=[],this.#o(s,a.merge?Xe(c.concat(l.value)):i);case"Map":return c??=new Map,a.merge?(l.value.forEach((u,f)=>c.set(f,u)),this.#o(s,c)):this.#o(s,l.value);case"Set":return c??=new Set,a.merge?(l.value.forEach(u=>c.add(u)),this.#o(s,c)):this.#o(s,l.value);default:return this.#o(s,l.value)}}clear(){try{this.#n(s=>s.clear())}catch(s){console.warn("[WebStore] Failed to clear storage:",s)}return this}del(...s){return s.forEach(i=>{try{this.#n(a=>a.removeItem(Z(i)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(i)}':`,a)}}),this}keys(...s){return this.entries(...s).map(([i])=>i)}values(...s){return this.entries(...s).map(([,i])=>i)}entries(...s){let i=new Set(s.map(c=>Z(c))),a=[];return this.#n(c=>{for(let l=0;l<c.length;l++){let u=c.key(l);if(u!==null&&(A(s)||i.has(u))){let f=c.getItem(u);a.push([he(u),he(f)])}}}),a}from(s){return C(s).forEach(([i,a])=>this.set(i,a)),this}#o(s,i){try{this.#n(a=>a.setItem(Z(s),Z(i)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(s)}':`,a)}return this}};return o=n})()});var en={};be(en,{geoCoords:()=>Qr,geoLocation:()=>Be,mapAddress:()=>yo,mapHemisphere:()=>ho,mapQuery:()=>Ut});var ut,Xr,_,Wt,X,kt,lt,Be,Qr,Ut,ho,yo,Bt=E(()=>{"use strict";vt();Me();v();Ft();at();Gt();ut={catch:!0,debug:0},Xr=Te(),_={},Wt="_magma_browser_map_",X=new ct("[Mapper]"),kt=null,lt=()=>(kt||(kt=new Promise((e,t)=>{Xr.type===O.Browser?Promise.resolve().then(()=>(Vr(),qr)).then(({WebStore:r})=>{let n=new r("local"),o=n.get(Wt,{});$(o)&&(o.geolocation&&(!o.geolocation.coords||o.geolocation.$GeolocationPosition)&&delete o.geolocation,Object.assign(_,o)),e(n)}).catch(t):e(void 0)})),kt),Be=(e={})=>lt().then(()=>new Promise((t,r)=>{e=Object.assign({},ut,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(o=>{let s=_.geolocation?.coords,i=s?.latitude?.toFixed(3),a=s?.longitude?.toFixed(3),c=_.geolocation?.timestamp??0,l=o.coords.latitude.toFixed(3)!==i,u=o.coords.longitude.toFixed(3)!==a,f=c<Jr().epochMilliseconds-36e5;(l||u||f)&&(Object.assign(_,{georesponse:null}),X.info(e,"GeoLocation: device update")),Object.assign(_,{geolocation:ie(o)}),t(_.geolocation)},o=>{Object.assign(_,{geolocation:{error:o.message},georesponse:null}),n(_.geolocation)}):(Object.assign(_,{geolocation:{error:"Not Supported"},georesponse:null}),n(_.geolocation))})).finally(()=>{(_.geolocation?.error?X.error:X.info)(e,"geoLocation: ",_.geolocation),lt().then(r=>r?.set(Wt,_))}),Qr=e=>new Promise((t,r)=>{if(!x(e))return t(e);Be().then(n=>x(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),Ut=(e,t={})=>lt().then(()=>new Promise((r,n)=>{t=Object.assign({},ut,t);let o=t.catch?r:n;Qr(e).then(s=>{switch(!0){case(Xr.type!==O.Browser||!window.google?.maps):throw new Error("Google Maps API not configured");case x(s):throw new Error("Cannot determine Coordinates");case x(e):{let i=_.geolocation&&_.georesponse,a=x(_.geolocation?.error)&&x(_.georesponse?.error);if(i&&a)return t.debug&&X.debug(t,"mapQuery: cache"),r(_.georesponse)}default:new window.google.maps.Geocoder().geocode(s).then(i=>r(_.georesponse=ie(i)))}}).catch(s=>{Object.assign(_,{georesponse:{error:s.message}}),o(_.georesponse)})})).finally(()=>{t.debug&&(_.georesponse?.error?X.error:X.debug)(t,"mapQuery: ",_.georesponse),lt().then(r=>r?.set(Wt,_))}),ho=(e,t={})=>Ut(e,t).then(r=>{if(t=Object.assign({},ut,t),x(r.error))return t.debug&&X.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=st();if(x(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&X.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),yo=(e,t={})=>Ut(e,t).then(r=>{if(!x(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((o,s)=>(s.types.filter(i=>i!=="political").forEach(i=>o[i]=(o[i]?o[i]+",":"").concat(s.short_name)),o),{formatted_address:r})).catch(r=>{if(t=Object.assign({},ut,t),t.debug&&X.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var sn={};be(sn,{HTTP:()=>nn,HttpError:()=>Q,METHOD:()=>on,fetchHead:()=>bo,fetchRequest:()=>wo});var Jt,tn,nn,on,Q,rn,wo,bo,an=E(()=>{"use strict";v();Jt=2e3,tn=/\);?$/,nn={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},on={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},Q=class extends Error{status;statusText;body;constructor(t,r,n){super(`${t}: ${r}`),this.status=t,this.statusText=r,this.body=n,this.name="HttpError"}},rn=async(e,t)=>{let r=e.headers?.get?.("Content-Length")||e.headers?.get?.("content-length");if(r){let a=parseInt(r,10);if(d(a)&&a>t){try{await e.body?.cancel()}catch{}throw new Q(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(b(e.text))a=await e.text();else if(b(e.json)){let l=await e.json();a=JSON.stringify(l)??""}else a="";let c=new TextEncoder().encode(a).byteLength;if(c>t)throw new Q(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),o=new TextDecoder,s=0,i="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(s+=c.byteLength,s>t){try{await n.cancel()}catch{}throw new Q(413,`Streamed payload exceeded limit (${t} bytes)`,null)}i+=o.decode(c,{stream:!0})}}return i+=o.decode(),i}finally{try{n.releaseLock()}catch{}}},wo=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??Jt)]):AbortSignal.timeout(r.timeout??Jt)};return fetch(e,n).then(async o=>{if(o.ok){let a=(o.headers?.get?.("Content-Type")||o.headers?.get?.("content-type")||"").includes("application/json");if(T(r.maxBytes)){let c=await rn(o,r.maxBytes);if(r.rawText)return c;if(r.prefix){let l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tn,""):c;return JSON.parse(l)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return b(o.text)?await o.text():"";if(r.prefix){let c=await o.text(),l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tn,""):c;return JSON.parse(l)}if(b(o.text)){let c=await o.text();try{return JSON.parse(c)}catch{return c}}return b(o.json)?await o.json():""}let s=null;try{let i=T(r.maxBytes)?await rn(o,r.maxBytes):b(o.text)?await o.text():"";try{s=JSON.parse(i)}catch{s=i}}catch(i){if(i instanceof Q&&i.status===413)throw i}throw new Q(o.status,o.statusText,s)})},bo=e=>{let t=AbortSignal.timeout(Jt),r={method:on.Head,signal:t};return fetch(e,r).then(({ok:n,status:o,statusText:s,headers:i})=>{if(n||o===nn.Forbidden)return{status:o,headers:i};throw new Q(o,s,null)})}});var ln={};be(ln,{serverGeoCoords:()=>ft,serverGeoLocation:()=>Je,serverMapHemisphere:()=>Ht});var cn,jt,Zt,Kt,So,Je,ft,Ht,Yt=E(()=>{"use strict";v();at();Gt();cn=new ct("[ServerMapper]"),jt="https://ipwho.is",Zt={endpoint:`${jt}/`,timeout:3e3,catch:!0,debug:0},Kt=null,So=()=>(Kt||(Kt=Promise.resolve().then(()=>(an(),sn))),Kt),Je=async(e={})=>{let t={...Zt,...e},r=t.catch!==!1;try{let n=t.endpoint||Zt.endpoint;if(m(t.ip)){let f=encodeURIComponent(t.ip.trim());if((n.endsWith("/")?n.slice(0,-1):n)===jt)n=`${jt}/${f}`;else if(n.includes("{ip}"))n=n.replace("{ip}",f);else if(f!=="")throw new Error(`Custom endpoint must include an '{ip}' placeholder to resolve a specific IP: ${n}`)}let o=t.timeout??Zt.timeout,{fetchRequest:s}=await So(),i=await s(n,{},{...d(o)?{timeout:o}:{},maxBytes:64*1024});if(typeof i!="object"||x(i))throw new Error("Geolocation lookup failed");if(i.status==="fail"||i.success===!1)throw new Error(i.message||i.reason||"Geolocation lookup failed");let a=d(i.lat)?i.lat:i.latitude,c=d(i.lon)?i.lon:i.lng??i.longitude;if(!d(a)||!d(c))throw new Error("Geolocation lookup failed");let l=m(i.timezone)?i.timezone:i.timezone?.id??i.timeZone,u={lat:a,lng:c,latitude:a,longitude:c,...m(i.country||i.countryName||i.country_name)?{country:i.country||i.countryName||i.country_name}:{},...m(i.city||i.cityName||i.city_name)?{city:i.city||i.cityName||i.city_name}:{},...m(l)?{timezone:l}:{},...m(i.query||i.ip||i.ip_address)?{query:i.query||i.ip||i.ip_address}:{},status:"success"};return t.debug&&cn.info(t,"serverGeoLocation success: ",u),u}catch(n){let o=n?.message||"Server geolocation error";if(t.debug&&cn.error(t,"serverGeoLocation error: ",o),!r)throw n;return{error:o,status:"fail"}}},ft=async(e,t)=>{if(!x(e)){let n=e.latitude??e.lat,o=e.longitude??e.lng??e.lon??e.long;if(d(n)&&d(o))return{lat:n,lng:o}}let r=await Je(t);return x(r.error)&&d(r.lat)&&d(r.lng)?{lat:r.lat,lng:r.lng}:null},Ht=async(e,t)=>{let r=await ft(e,t);return r?r.lat>=0?"north":"south":st()??null}});var mn=ur((ta,dn)=>{"use strict";dn.exports=window.undefined});var No={};be(No,{GEO_PROPERTIES:()=>Ze,GeoPlugin:()=>cr,calculateBearing:()=>rr,calculateMidpoint:()=>nr,calculateVelocity:()=>wt,clearStashedGeo:()=>mt,coerceGeo:()=>ee,default:()=>_o,forwardGeocode:()=>er,geoLocation:()=>Be,geoLookup:()=>ht,geoPlugin:()=>Eo,getGeoProvider:()=>Xt,getStashedGeo:()=>ve,haversineDistance:()=>je,inBoundingBox:()=>sr,isImpossibleTravel:()=>or,isWithin:()=>ir,resolveCulturalLocale:()=>ar,resolveGeoCoordinates:()=>Ke,reverseGeocode:()=>Qt,serverGeoCoords:()=>ft,serverGeoLocation:()=>Je,serverMapHemisphere:()=>Ht,setGeoProvider:()=>gt,solarOffset:()=>yt,stashGeo:()=>dt});var B={};be(B,{definePlugin:()=>xt,defineTerm:()=>xn});Pe(B,bt(St()));var qe=bt(St()),xt=e=>(0,qe.definePlugin)({...e,version:"1.3.0"}),xn=e=>(0,qe.defineTerm)({...e,version:"1.3.0"});Me();v();$t();v();function K(...e){for(let t of e){let r=b(t)?t():t;if(r!==void 0)return r}}at();var ye="_magma_geo_",un=1440*60*1e3,Ze=["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city","timezone","tz"],fn=e=>d(e)&&e>=-90&&e<=90?Math.round(e*1e3)/1e3:void 0,pn=e=>d(e)&&e>=-180&&e<=180?Math.round(e*1e3)/1e3:void 0,Ne=(e,t)=>{let r=fn(e),n=pn(t);return r!==void 0&&n!==void 0?{lat:r,lng:n}:void 0},we=(e,t)=>{if(e==="north"||e==="south"||e==="equator")return e;if(d(t))return t>.001?"north":t<-.001?"south":"equator"},ee=e=>{if(m(e)&&e.includes(",")){let p=e.split(",").map(y=>y.trim()).map(y=>y===""?NaN:Number(y));if(p.length>=2&&!isNaN(p[0])&&!isNaN(p[1])){let y=Ne(p[0],p[1]);if(y){let I={latitude:y.lat,longitude:y.lng},R=we(void 0,y.lat);return R&&(I.sphere=R),I}}return}if(re(e))return;if(Array.isArray(e)&&e.length>=2){let g=Ne(e[0],e[1]);if(g){let p={latitude:g.lat,longitude:g.lng},y=we(void 0,g.lat);return y&&(p.sphere=y),p}return}let t=e.geo??e,r=e.config?.geo??e.config,n=K(t?.latitude,t?.lat,e.latitude,e.lat,r?.latitude,r?.lat),o=K(t?.longitude,t?.lng,t?.lon,t?.long,e.longitude,e.lng,e.lon,e.long,r?.longitude,r?.lng,r?.lon,r?.long),s=K(t?.elevation,e.elevation,r?.elevation),i=K(t?.sphere,e.sphere,r?.sphere),a=K(t?.country,e.country,r?.country),c=K(t?.city,e.city,r?.city),l=K(t?.timezone,t?.tz,e.timezone,e.tz,r?.timezone,r?.tz),u={},f=fn(n),w=pn(o);f!==void 0&&(u.latitude=f),w!==void 0&&(u.longitude=w),d(s)&&(u.elevation=Math.round(s*1e3)/1e3);let h=we(i,u.latitude);h&&(u.sphere=h),m(a)&&(u.country=a),m(c)&&(u.city=c),m(l)&&(u.timezone=l);let N=$(e.geo)?e.geo:$(e.config?.geo)?e.config.geo:void 0;if($(N))for(let g of Object.keys(N))oe(g)&&!Ze.includes(g)&&(u[g]=N[g]);return Object.keys(u).length>0?u:void 0},Vt=e=>{if(m(e)&&!A(e)){let t=e.trim();return t.startsWith(ye)?t:`${ye}:${t}`}if(e&&D(e)){let t=e.provider??j,r=t&&m(t.name)&&!A(t.name)?`provider:${t.name}`:void 0,n=e.key??e.ip??e.query;if(m(n)&&!A(n)){let o=n.trim();return r?`${ye}:${r}:${o}`:`${ye}:${o}`}if(r)return`${ye}:${r}`}else if(j&&m(j.name)&&!A(j.name))return`${ye}:provider:${j.name}`;return ye},ve=e=>{let t=Vt(e);try{let r=Gr(t)??(M(globalThis.localStorage?.getItem)?globalThis.localStorage.getItem(t):void 0);if(!r)return;let n=m(r)&&(r.startsWith("{")||r.startsWith("["))?JSON.parse(r):r;if(D(n)&&d(n._expires)&&Date.now()>n._expires){mt(e);return}if(m(n)&&n.includes(",")){let o=n.split(",").map(i=>parseFloat(i.trim())),s=Ne(o[0],o[1]);if(s)return{latitude:s.lat,longitude:s.lng,sphere:we(void 0,s.lat)}}if(D(n)){let o=n.geolocation?.coords??n.coords??n,s=o?.latitude??o?.lat,i=o?.longitude??o?.lng??o?.lon??o?.long,a=Ne(s,i);if(a){let c={latitude:a.lat,longitude:a.lng},l=n.elevation??o.elevation;return d(l)&&(c.elevation=Math.round(l*1e3)/1e3),c.sphere=we(n.sphere,a.lat),m(n.country)&&(c.country=n.country),m(n.city)&&(c.city=n.city),m(n.timezone)&&(c.timezone=n.timezone),c}}}catch{}},dt=(e,t=un,r)=>{let n=Vt(r),o=d(t)&&t>0?{...e,_expires:Date.now()+t}:e;Ct(n,o,{ttl:t})},mt=e=>{let t=Vt(e);Ct(t,void 0)},j;function gt(e){j=e}function Xt(){return j}var ht=async(e={})=>{let t=e.provider??j;if(e.refresh!==!0){let a=ve(e);if(a&&d(a.latitude)&&d(a.longitude)){let{latitude:c,longitude:l,...u}=a;return{...u,status:"cached",lat:c,lng:l,latitude:c,longitude:l}}}let n;if(t&&b(t.lookup))try{let a=await t.lookup(e);if(a){if(n=a,a.error&&e.fallback===!1)return a}else if(e.fallback===!1)return{error:"Provider returned null and fallback is disabled"}}catch(a){if(e.fallback===!1)return{error:a?.message??"Provider lookup failed"}}if(!n||n.error){if(e.fallback===!1&&(t||n?.error))return n&&n.error?n:{error:"Geolocation resolution failed and fallback is disabled"};let{type:a}=Te();switch(a){case O.Browser:{let{geoLocation:c}=await Promise.resolve().then(()=>(Bt(),en)),l=await c(e);if(l.error)return{error:l.error};let u=l.coords?.latitude,f=l.coords?.longitude;n={...l,lat:u,lng:f,latitude:u,longitude:f};break}case O.WebWorker:case O.NodeJS:case O.Deno:default:{let{serverGeoLocation:c}=await Promise.resolve().then(()=>(Yt(),ln));n=await c(e);break}}}let o=n.latitude??n.lat,s=n.longitude??n.lng,i=Ne(o,s);if(x(n.error)&&i){let a=we(n.sphere,i.lat);n.lat=i.lat,n.lng=i.lng,n.latitude=i.lat,n.longitude=i.lng,n.sphere=a;let c={latitude:i.lat,longitude:i.lng,sphere:a,...m(n.city)?{city:n.city}:{},...m(n.country)?{country:n.country}:{},...d(n.elevation)?{elevation:Math.round(n.elevation*1e3)/1e3}:{},...m(n.timezone)?{timezone:n.timezone}:{}};try{let l=d(e.ttl)?e.ttl:un;dt(c,l,e)}catch{}}return n};async function Qt(e,t){let r=t?.provider??j;return r&&b(r.reverseGeocode)?r.reverseGeocode(e,t):ee(e)??null}async function er(e,t){let r=t?.provider??j;return r&&b(r.forwardGeocode)?r.forwardGeocode(e,t):null}var Ke=async(e,t={})=>{let r=ee(e);if(r&&d(r.latitude)&&d(r.longitude))return{...r,lat:r.latitude,lng:r.longitude};let n=t.refresh===!0?void 0:ve(t);if(n&&d(n.latitude)&&d(n.longitude))return{...n,lat:n.latitude,lng:n.longitude};let o=await ht(t),s=Ne(o.lat,o.lng);if(x(o.error)&&s){let i=we(o.sphere,s.lat);return{...o,lat:s.lat,lng:s.lng,latitude:s.lat,longitude:s.lng,sphere:i}}return null},qt=e=>{if(!x(e)){if(m(e)&&e.includes(",")){let t=e.split(",").map(r=>r.trim());if(t.length>=2&&t[0]!==""&&t[1]!==""){let r=Number(t[0]),n=Number(t[1]);if(d(r)&&d(n)&&r>=-90&&r<=90&&n>=-180&&n<=180)return{lat:r,lng:n}}return}if(Array.isArray(e)&&e.length>=2){let t=e[0],r=e[1];if(t!==null&&r!==null&&t!==""&&r!==""&&typeof t!="boolean"&&typeof r!="boolean"){let n=typeof t=="string"&&t.trim()===""?NaN:Number(t),o=typeof r=="string"&&r.trim()===""?NaN:Number(r);if(d(n)&&d(o)&&n>=-90&&n<=90&&o>=-180&&o<=180)return{lat:n,lng:o}}return}if($(e)){let t=e.geo??e.config?.geo??e,r=e.config?.geo??e.config,n=K(t?.latitude,t?.lat,e.latitude,e.lat,r?.latitude,r?.lat),o=K(t?.longitude,t?.lng,t?.lon,t?.long,e.longitude,e.lng,e.lon,e.long,r?.longitude,r?.lng,r?.lon,r?.long);if(n!==null&&o!==null&&n!==""&&o!==""&&typeof n!="boolean"&&typeof o!="boolean"){let s=typeof n=="string"&&n.trim()===""?NaN:Number(n),i=typeof o=="string"&&o.trim()===""?NaN:Number(o);if(d(s)&&d(i)&&s>=-90&&s<=90&&i>=-180&&i<=180)return{lat:s,lng:i}}}}},tr=(e,t)=>{let r=ee(e),n=ee(t);if(!r||!n||!d(r.latitude)||!d(r.longitude)||!d(n.latitude)||!d(n.longitude))return;let o=Math.PI/180,s=r.latitude*o,i=r.longitude*o,a=n.latitude*o,c=n.longitude*o;return{lat1:s,lat2:a,lng1:i,lng2:c,dLat:a-s,dLng:c-i}};function je(e,t,r="km"){let n=tr(e,t);if(!n)return NaN;let{lat1:o,lat2:s,dLat:i,dLng:a}=n,c=Math.sin(i/2)**2+Math.cos(o)*Math.cos(s)*Math.sin(a/2)**2,l=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),f=(r==="miles"?3958.7613:r==="m"?63710088e-1:6371.0088)*l;return r==="m"?Math.round(f):Math.round(f*1e3)/1e3}var xo=(e,t)=>{try{if(T(globalThis.Temporal)&&b(globalThis.Temporal.Instant?.fromEpochMilliseconds))return Temporal.Instant.fromEpochMilliseconds(t).toZonedDateTimeISO(e).offsetNanoseconds/6e10;let n=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset",year:"numeric"}).formatToParts(new Date(t)).find(o=>o.type==="timeZoneName")?.value;if(n){if(n==="GMT"||n==="UTC")return 0;let o=n.match(/GMT([+-])(\d{2}):(\d{2})/);if(o)return(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+parseInt(o[3],10))}}catch{}};function yt(e,t){let r=ee(e);if(!r||!d(r.latitude)||!d(r.longitude))return NaN;let n=r.longitude,o=t?.timeZone??($(e)?e.timezone??e.tz:void 0)??r.timezone,s=t?.date??($(e)?pt(e):void 0),i=T(s)?pt(s):Date.now();if(!d(i))return NaN;let a=hr(o)?xo(o,i):void 0,c=a!==void 0?a/60*15:Math.round(n/15)*15,u=(n-c)*4;if(t?.apparent){let g=new Date(i),p=Date.UTC(g.getUTCFullYear(),0,1),y=Math.floor((i-p)/864e5)+1,I=2*Math.PI/365*(y-1),R=229.18*(75e-6+.001868*Math.cos(I)-.032077*Math.sin(I)-.014615*Math.cos(2*I)-.040849*Math.sin(2*I));u+=R}let f=t?.unit??"mi",w;f==="ss"||f==="seconds"?w=u*60:f==="hh"||f==="hours"?w=u/60:w=u;let h=t?.precision??2,N=Math.pow(10,h);return Math.round(w*N)/N}function pt(e){if(!x(e)){if(d(e))return e;if(xe(e))return e.getTime();if($(e)){if(d(e.epoch?.ms))return e.epoch.ms;if(d(e.epochMilliseconds))return e.epochMilliseconds;if(d(e.timestamp))return e.timestamp;if(xe(e.date))return e.date.getTime();if(b(e.toInstant))try{return e.toInstant().epochMilliseconds}catch{}if(b(e.getTime))try{return e.getTime()}catch{}}if(m(e)){let t=Date.parse(e);if(d(t))return t}}}function rr(e,t,r){let n=tr(e,t);if(!n)return NaN;let{lat1:o,lat2:s,dLng:i}=n,a=Math.sin(i)*Math.cos(s),c=Math.cos(o)*Math.sin(s)-Math.sin(o)*Math.cos(s)*Math.cos(i),l=(Math.atan2(a,c)*180/Math.PI+360)%360,u=r?.precision??1,f=Math.pow(10,u);return Math.round(l*f)/f}function nr(e,t){let r=tr(e,t);if(!r)return;let{lat1:n,lat2:o,lng1:s,dLng:i}=r,a=Math.cos(o)*Math.cos(i),c=Math.cos(o)*Math.sin(i),l=Math.atan2(Math.sin(n)+Math.sin(o),Math.sqrt((Math.cos(n)+a)**2+c**2)),u=s+Math.atan2(c,Math.cos(n)+a),f=Math.round(l*180/Math.PI*1e3)/1e3,w=Math.round(((u*180/Math.PI+540)%360-180)*1e3)/1e3,h=f>.001?"north":f<-.001?"south":"equator";return{latitude:f,longitude:w,sphere:h}}function wt(e,t,r){let n=m(r)?{unit:r}:r??{},o=n.unit??"km",s=n.timeUnit??"hh",i=je(e,t,o);if(isNaN(i))return NaN;let a=pt(e),c=pt(t);if(!d(a)||!d(c))return NaN;let l=Math.abs(c-a);if(l===0)return i===0?0:1/0;let u;s==="ss"||s==="s"||s==="seconds"||s==="second"?u=l/1e3:s==="mi"||s==="m"||s==="minutes"||s==="minute"?u=l/6e4:u=l/36e5;let f=i/u,w=n.precision??2,h=Math.pow(10,w);return Math.round(f*h)/h}function or(e,t,r){let n=r?.unit??"km",o=n==="miles"?560:n==="m"?250:900,s=r?.maxSpeed??r?.maxCommercialSpeedKmH??o;return wt(e,t,{unit:n,timeUnit:n==="m"?"ss":"hh"})>s}function ir(e,t,r,n="km"){if(!d(r)||r<0)return!1;let o=qt(e),s=qt(t);if(!o||!s||!d(o.lat)||!d(o.lng)||!d(s.lat)||!d(s.lng))return!1;let i=Math.PI/180,a=o.lat*i,c=o.lng*i,l=s.lat*i,u=s.lng*i,f=l-a,w=u-c,h=Math.sin(f/2)*Math.sin(f/2)+Math.cos(a)*Math.cos(l)*Math.sin(w/2)*Math.sin(w/2),N=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h));return(n==="miles"?3958.7613:n==="m"?63710088e-1:6371.0088)*N<=r}function sr(e,t){let r=qt(e);if(!r||!d(r.lat)||!d(r.lng)||x(t))return!1;let n,o,s,i;if(Array.isArray(t)&&t.length>=4)n=t[0],s=t[1],o=t[2],i=t[3];else if($(t)){let l=t;n=l.minLat??l.minLatitude,o=l.maxLat??l.maxLatitude,s=l.minLng??l.minLongitude,i=l.maxLng??l.maxLongitude}if(!d(n)||!d(o)||!d(s)||!d(i))return!1;let a=r.lat,c=r.lng;return a<n||a>o?!1:s<=i?c>=s&&c<=i:c>=s||c<=i}var To={australia:"AU","united states":"US","united kingdom":"GB","great britain":"GB",france:"FR",germany:"DE",italy:"IT",spain:"ES",japan:"JP",china:"CN",canada:"CA",brazil:"BR",egypt:"EG","saudi arabia":"SA",russia:"RU",india:"IN",mexico:"MX","new zealand":"NZ",netherlands:"NL",switzerland:"CH",austria:"AT",belgium:"BE",sweden:"SE",norway:"NO",denmark:"DK",finland:"FI",poland:"PL",turkey:"TR",greece:"GR",israel:"IL",thailand:"TH",vietnam:"VN",indonesia:"ID",malaysia:"MY",philippines:"PH","south africa":"ZA","south korea":"KR",korea:"KR",ireland:"IE",portugal:"PT",argentina:"AR"},Oo={AU:"en-AU",US:"en-US",GB:"en-GB",CA:"en-CA",NZ:"en-NZ",IE:"en-IE",SA:"ar-SA",AE:"ar-AE",EG:"ar-EG",JP:"ja-JP",CN:"zh-CN",TW:"zh-TW",HK:"zh-HK",KR:"ko-KR",FR:"fr-FR",DE:"de-DE",IT:"it-IT",ES:"es-ES",MX:"es-MX",AR:"es-AR",BR:"pt-BR",PT:"pt-PT",RU:"ru-RU",IN:"hi-IN",NL:"nl-NL",SE:"sv-SE",NO:"nb-NO",DK:"da-DK",FI:"fi-FI",PL:"pl-PL",TR:"tr-TR",GR:"el-GR",IL:"he-IL",TH:"th-TH",VN:"vi-VN",ID:"id-ID",MY:"ms-MY",PH:"fil-PH",ZA:"en-ZA",CH:"de-CH",AT:"de-AT",BE:"nl-BE"};function ar(e,t,r=!0){if(r===!1||r==="none"||r==="off")return;let n=l=>{let u=l.trim();return u.length===2?u.toUpperCase():To[u.toLowerCase()]},o;if(Array.isArray(t)){for(let l of t)if(m(l)){let u=n(l);if(u){o=u;break}}}else m(t)&&(o=n(t));if(m(r)&&r!=="regional"&&r!=="region"&&r!=="native"&&r!=="full")return ue(r)?.baseName??U(r);if(!o)return;if(r==="native"||r==="full"){let l=Oo[o]??`en-${o}`;return ue(l)?.baseName??l}let s="en",i;if(m(e)&&e.length>0){let l=ue(e);s=l?.language??U(e)?.split("-")[0]??"en",l?.script&&(i=l.script)}let a=i?`${s}-${i}-${o}`:`${s}-${o}`;return ue(a)?.baseName??a}Yt();Bt();var P=bt(mn(),1);var cr=xt({name:"geo",install(e,t){let r=e||this;t?.provider&>(t.provider);let n=(o,s)=>{let i=r.config?.pluginOptions?.geo,a=s?.config?.pluginOptions?.geo;return{...(0,P.isObject)(t)?t:{},...(0,P.isObject)(i)?i:{},...(0,P.isObject)(a)?a:{},...(0,P.isObject)(o)?o:{}}};Object.hasOwn(r,"geo")||Object.defineProperty(r,"geo",{value:(0,B.deepFreeze)({lookup:s=>ht(n(s)),resolve:(s,i)=>Ke(s,n(i,s)),coerce:ee,distance:je,bearing:rr,midpoint:nr,velocity:wt,isImpossibleTravel:or,isWithin:ir,inBoundingBox:sr,solarOffset:yt,stash:dt,clear:mt,get:ve,setProvider:gt,getProvider:Xt,reverse:(s,i)=>Qt(s,n(i)),forward:(s,i)=>er(s,n(i)),server:Je,browser:Be,get current(){return ve()??r.config?.geo}}),writable:!1,configurable:!1,enumerable:!1}),e.prototype.geoLocate=async function(o){let s=n(o,this),i=s?.setTimezone!==!1,a=s?.setLocale??!0,c=await Ke(this,s);if(c){let l=(0,P.isObject)(this.config.geo)?this.config.geo:{},u={};for(let y of Object.keys(l))(0,P.isSafeKey)(y)&&!Ze.includes(y)&&(u[y]=l[y]);let f=ee(o)??{};if((0,P.isObject)(o))for(let y of Object.keys(o))(0,P.isSafeKey)(y)&&!["setTimezone","setLocale","refresh","ttl","endpoint","timeout","catch","debug","geo","provider","fallback"].includes(y)&&(Ze.includes(y)||(u[y]=o[y]));let w=(0,P.isNumber)(c?.elevation)?c.elevation:(0,P.isNumber)(l.elevation)?l.elevation:void 0,h={...u,...c,...(0,P.isNumber)(w)?{elevation:w}:{},...f};(0,P.isNumber)(h.latitude)&&(h.latitude=Math.round(h.latitude*1e3)/1e3),(0,P.isNumber)(h.longitude)&&(h.longitude=Math.round(h.longitude*1e3)/1e3),!h.sphere&&(0,P.isNumber)(h.latitude)&&(h.sphere=h.latitude>.001?"north":h.latitude<-.001?"south":"equator");let N=this,g=h.timezone;i&&(0,P.isString)(g)&&!(0,P.isEmpty)(g)&&(N=this.set({timeZone:g}));let p=h.country||(0,P.isString)(a)?ar(this.locale??this.config.locale,h.country,a):void 0;return new e(N,{...N.config,...p?{locale:p}:{},geo:(0,B.deepFreeze)(h),...h.sphere?{sphere:h.sphere}:{}})}return this},e.prototype.geoLookup=async function(o){return Ke(this,n(o,this))},e.prototype.geoDistance=function(o,s){return je(this,o,s)},e.prototype.geoSolarOffset=function(o){return yt(this,o)}}}),Eo=cr,_o=cr;return Sn(No);})();
|