@magmacomputing/tempo-plugin-geo 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `@magmacomputing/tempo-plugin-geo` project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-09-07
9
+
10
+ ### Added
11
+ - **Stable Community Release**:
12
+ - Official 1.0.0 release of `@magmacomputing/tempo-plugin-geo`.
13
+ - Configured npm Trusted Publisher automation for CI/CD publishing.
14
+
15
+ ## [0.1.0] - 2026-09-07
16
+
17
+ ### Added
18
+ - **Initial Community Release (Bootstrap)**:
19
+ - Decoupled IP geolocation lookup and browser hardware location services from core `@magmacomputing/tempo`.
20
+ - Exported functional utilities: `geoLookup()`, `resolveGeoCoordinates()`, `serverGeoLocation()`, `serverGeoCoords()`, `serverMapHemisphere()`, `geoLocation()`, `coerceGeo()`, `getStashedGeo()`.
21
+ - Exported `GeoPlugin` installing `geoLocate()` and `geoLookup()` on Tempo instances alongside static helpers on `Tempo`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Magma Computing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ ![Tempo Plugin](https://raw.githubusercontent.com/magmacomputing/magma/main/packages/tempo/public/plugin-logo.svg)
2
+
3
+ # @magmacomputing/tempo-plugin-geo
4
+
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-geo"><img src="https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-geo?style=flat-square" alt="npm version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo"><img src="https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-geo/peer/@magmacomputing/tempo?style=flat-square" alt="npm peer dependency version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-geo"><img src="https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-geo?style=flat-square" alt="License" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-blue?logo=typescript&style=flat-square" alt="TypeScript Ready" style="display: inline-block; margin: 0 4px;"></a> <a href="https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html"><img src="https://img.shields.io/badge/Docs-VitePress-brightgreen?logo=vitepress&style=flat-square" alt="Documentation" style="display: inline-block; margin: 0 4px;"></a>
7
+ </p>
8
+
9
+ A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides IP geolocation lookup, browser hardware location services, and coordinate resolution.
10
+
11
+ 👉 **[View the full documentation on our GitHub Pages](https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html)**
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @magmacomputing/tempo-plugin-geo
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Functional Paradigm (Tree-Shakeable)
22
+
23
+ ```typescript
24
+ import { Tempo } from '@magmacomputing/tempo';
25
+ import { geoLookup, resolveGeoCoordinates } from '@magmacomputing/tempo-plugin-geo';
26
+
27
+ // Automatically resolves coordinates via browser hardware GPS or server IP lookup
28
+ const geo = await geoLookup();
29
+ const t = new Tempo({ geo });
30
+
31
+ console.log(t.geo?.latitude, t.geo?.longitude);
32
+ ```
33
+
34
+ ### Fluent OOP Paradigm
35
+
36
+ ```typescript
37
+ import { Tempo } from '@magmacomputing/tempo';
38
+ import { GeoPlugin } from '@magmacomputing/tempo-plugin-geo';
39
+
40
+ Tempo.use(GeoPlugin);
41
+
42
+ const t = new Tempo();
43
+
44
+ // Resolve coordinates asynchronously and return a new enriched Tempo instance
45
+ const localTime = await t.geoLocate();
46
+ console.log(localTime.geo?.latitude, localTime.geo?.longitude);
47
+ ```
48
+
49
+ ## Documentation
50
+
51
+ For full API reference and configuration options, please visit the official **[Geo Plugin Documentation ↗](https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html)**.
52
+
53
+ ## Licensing
54
+
55
+ This is a **Community** plugin. It is completely free and open-source for personal and commercial use under the MIT license.
@@ -0,0 +1,37 @@
1
+ import { type TempoPlugin } from '@magmacomputing/tempo/plugin/sdk';
2
+ import { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, type GeoLookupResult, type GeoConfig, type CoordinateInput } from '@magmacomputing/library/runtime/mapper.library.js';
3
+ import { serverGeoLocation, serverGeoCoords, serverMapHemisphere, type ServerMapOpts, type ServerGeolocationResult } from '@magmacomputing/library/server/mapper.library.js';
4
+ import { geoLocation } from '@magmacomputing/library/browser/mapper.library.js';
5
+ export { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, serverGeoLocation, serverGeoCoords, serverMapHemisphere, geoLocation, };
6
+ export type { GeoLookupResult, GeoConfig, CoordinateInput, ServerMapOpts, ServerGeolocationResult, };
7
+ type GeoLookupFn = typeof geoLookup;
8
+ type ResolveGeoCoordinatesFn = typeof resolveGeoCoordinates;
9
+ type ServerGeoLocationFn = typeof serverGeoLocation;
10
+ type GeoLocationFn = typeof geoLocation;
11
+ /**
12
+ * GeoPlugin installs geolocation lookup and coordinate resolution helpers onto Tempo.
13
+ */
14
+ export declare const GeoPlugin: TempoPlugin;
15
+ export declare const geoPlugin: TempoPlugin;
16
+ export default GeoPlugin;
17
+ declare module '@magmacomputing/tempo' {
18
+ interface Tempo {
19
+ /**
20
+ * Asynchronously resolves coordinates for this instance and returns a new Tempo instance with geo set.
21
+ */
22
+ geoLocate(opts?: Record<string, any>): Promise<Tempo>;
23
+ /**
24
+ * Resolves coordinates for this instance via explicit coordinates or automatic IP/hardware lookup.
25
+ */
26
+ geoLookup(opts?: Record<string, any>): Promise<{
27
+ lat: number;
28
+ lng: number;
29
+ } | null>;
30
+ }
31
+ namespace Tempo {
32
+ let geoLookup: GeoLookupFn;
33
+ let resolveGeoCoordinates: ResolveGeoCoordinatesFn;
34
+ let serverGeoLocation: ServerGeoLocationFn;
35
+ let geoLocation: GeoLocationFn;
36
+ }
37
+ }
@@ -0,0 +1 @@
1
+ "use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var cr=Object.create;var xe=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var lr=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,pr=Object.prototype.hasOwnProperty;var b=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var mr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Q=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lr(t))!pr.call(e,i)&&i!==r&&xe(e,i,{get:()=>t[i],enumerable:!(n=ur(t,i))||n.enumerable});return e},ue=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),yt=(e,t,r)=>(r=e!=null?cr(fr(e)):{},Se(t||!e||!e.__esModule?xe(r,"default",{value:e,enumerable:!0}):r,e)),gr=e=>Se(xe({},"__esModule",{value:!0}),e);var Ze=mr((Qr,ht)=>{"use strict";ht.exports=window.Magma.pluginSdk});var yr,hr,wr,br,Sr,xr,Tr,Or,wt,Er,bt,d,M=b(()=>{"use strict";yr=Symbol.for("$LibraryTarget"),hr=Symbol.for("$LibraryDiscover"),wr=Symbol.for("$LibraryExtensible"),br=Symbol.for("nodejs.util.inspect.custom"),Sr=Symbol.for("$LibraryLogConfig"),xr=Symbol.for("$LibraryRegistry"),Tr=Symbol.for("$LibraryRegister"),Or=Symbol.for("$LibrarySerializerRegistry"),wt=Symbol.for("$LibraryMutable"),Er=Symbol.for("$LibraryIdentity"),bt=Symbol.for("$LibraryUnwrapped"),d={$Target:yr,$Discover:hr,$Extensible:wr,$Inspect:br,$LogConfig:Sr,$Registry:xr,$Register:Tr,$SerializerRegistry:Or,$Identity:Er,$Mutable:wt,$Unwrapped:bt}});function ee(e){let t=e,r=0,n=50;for(;t;){let i=t[d.$Target];if(!i||r>=n)break;t=i,r++}return t}function E(e,t=!1){if(!e||typeof e!="object")return[];let r=ee(e);if(!t){let l=Reflect.ownKeys(r),p=[];for(let m of l){let O=Object.getOwnPropertyDescriptor(r,m);O&&O.enumerable&&p.push([m,r[m]])}return p}let n=[],i=50,o=0,s=r;for(;s&&s!==Object.prototype&&o++<i;)n.push(ee(s)),s=Object.getPrototypeOf(s);let a=[],c=new Set;for(let l of n.reverse()){let p=Reflect.ownKeys(l);for(let m of p){if(c.has(m))continue;let O=Object.getOwnPropertyDescriptor(l,m);!O||!O.enumerable||(c.add(m),a.push([m,r[m]]))}}return a}function le(e,t=!1){return E(e,t).map(([r])=>r)}function St(e,t=!1){return E(e,t).map(([r,n])=>n)}function Oe(e,t,r){return t?Oe(e.map(t,r)):Array.from(new Set(e))}var F=b(()=>{"use strict";M()});var je,xt,Ee,H,z,_r,Pr,_e,A=b(()=>{"use strict";M();F();je=[],xt=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"?ee(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Ee=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},H=(e,...t)=>{let r=e;try{r=e?.[d.$Target]??e}catch{r=e}let n=xt(r);switch(n){case"Function":try{return Pr(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(o=>o==="length"||Number.isFinite(Number(o))))return"ArrayLike";for(let o of t){let s=o.class?.[d.$Target]??o.class;if(r===s||s&&r instanceof s)return o.type}let i=globalThis[d.$Registry]??[];for(let o of[...je,...i]){let s=o.class?.[d.$Target]??o.class;if(r===s||s&&r instanceof s)return o.type}}catch{return"Object"}return"Object"}default:return n}},z=(e,...t)=>({type:H(e,...t),value:e}),_r=/^\s*(class\s|\[native code\])/,Pr=e=>{if(typeof e!="function")return!1;let t=e?.[d.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Ee(t);if(t?.[d.$Identity]||t?.prototype?.[d.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[d.$Registry]??[]).some(o=>(o.class?.[d.$Target]??o.class)===t||r&&o.type===r||n&&o.type===n))return!0;try{let o=Function.prototype.toString.call(t);if(_r.test(o))return!0;let s=Object.getOwnPropertyDescriptor(t,"prototype");if(s&&s.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},_e=(e,t)=>{if(typeof e!="function")return;let r=Ee(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(je.some(i=>i.class===e)||je.push({class:e,type:n}))}});var N,Pe,Ne,y,g,He,V,I,Nr,U,Tt,te,h,Y,x,w,Ie,De,$e,Z,T=b(()=>{"use strict";M();A();N=(e,...t)=>t.includes(H(e)),Pe=e=>N(e,"String","Number","BigInt","Boolean","Symbol","Undefined","Void","Null","Empty"),Ne=e=>!Pe(e),y=e=>N(e,"String"),g=e=>Number.isFinite(e),He=e=>N(e,"BigInt"),V=e=>N(e,"Array"),I=e=>N(e,"Object"),Nr=e=>N(e,"Date"),U=e=>N(e,"Symbol"),Tt=e=>N(e,"Symbol")&&Symbol.keyFor(e)!==void 0,te=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",h=e=>N(e,"Null","Undefined","Void","Empty"),Y=e=>N(e,"Undefined","Void","Empty"),x=e=>!h(e),w=e=>N(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),Ie=e=>N(e,"Map"),De=e=>N(e,"Set"),$e=(e,t)=>N(e,"Error")&&(t?e instanceof t:!0),Z=e=>h(e)||I(e)&&Reflect.ownKeys(e).length===0||y(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||V(e)&&e.length===0||De(e)&&e.size===0||Ie(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||Nr(e)&&Number.isNaN(e.getTime())});function Ve(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??Ir;return Pe(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[d.$Extensible]?e:(r.add(e),E(e).forEach(([i,o])=>{te(i)&&Ve(o,{skip:n},r)}),Object.freeze(e))}var _,q,Ir,fe=b(()=>{"use strict";F();T();M();_={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},q=()=>{let e=globalThis;try{if(x(e.SpreadsheetApp))return{global:e,type:_.GoogleAppsScript};if(x(e.window?.document))return{global:e,type:_.Browser};if(w(e.importScripts)||x(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:_.WebWorker};if(x(e.Deno))return{global:e,type:_.Deno};if(x(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:_.NodeJS}}catch{}return{global:e,type:_.Unknown}},Ir=new WeakSet});function K(e){return x(e)?w(e)?e():e:t=>w(t)?t():t}var Re,Ot=b(()=>{"use strict";F();T();A();Re=e=>{if(h(e)||!I(e))return e;let t=V(e)?[]:{};return le(e).forEach(r=>{te(r)&&(t[r]=Re(e[r]))}),t};K.stringSymbol=K();K.symbolRegExp=K();K.symbolString=K();K.stringString=K()});function Et(e){return Object.fromEntries(E(e,!0))}var _t=b(()=>{"use strict";F();A();T()});function Nt(e,t={},r=!1){let{frozen:n,lock:i,appendOnly:o,onGet:s,keys:a,bind:c,skip:l}=t,p=new Set,m,O,$=ee(e);i&&Ve($,l?{skip:l}:void 0),_e($);let J={isExtensible:f=>Reflect.isExtensible(f),getPrototypeOf:f=>Reflect.getPrototypeOf(f),setPrototypeOf:(f,u)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(f,u)},getOwnPropertyDescriptor:(f,u)=>{if(!(a&&!a.includes(u))){if(a){if(s&&!U(u)&&!p.has(u)){p.add(u);try{let P=s(u,f);if(x(P))return{enumerable:!0,configurable:!0,value:P}}finally{p.delete(u)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(f,u)}},ownKeys:f=>{if(a)return a;if(s&&!p.has(d.$Discover)){p.add(d.$Discover);try{s(d.$Discover,f)}finally{p.delete(d.$Discover)}}return Reflect.ownKeys(f)},has:(f,u)=>a?a.includes(u):Reflect.has(f,u),deleteProperty:(f,u)=>{if(n)throw new TypeError(`Cannot delete property '${String(u)}' from a protected object.`);if(o&&Reflect.has(f,u))throw new Error(`Security: Deletion attempt on protected key '${String(u)}'`);return Reflect.deleteProperty(f,u)},defineProperty:(f,u,P)=>{if(n&&!Object.isFrozen(f))throw new TypeError(`Cannot define property '${String(u)}' on a frozen object.`);if(o&&Reflect.has(f,u))throw new Error(`Security: Mutation attempt on protected key '${String(u)}'`);return Reflect.defineProperty(f,u,P)},set:(f,u,P,L)=>{if(n&&L===O)throw new TypeError(`Cannot set property '${String(u)}' on a frozen object.`);if(o){if(Array.isArray(f)&&u==="length"&&P<f.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(f)&&u==="length")&&Reflect.has(f,u))throw new Error(`Security: Mutation attempt on protected key '${String(u)}'`)}return Reflect.set(f,u,P,L)},get:(f,u,P)=>{if(u===d.$Target)return P===O?f:void 0;if(n&&(u===d.$Inspect||u==="toJSON")){let v=Object.getOwnPropertyDescriptor(f,u);return v&&w(v.value)?v.value:(m||(m=()=>Et(f)),m)}if(a&&!a.includes(u))return;if(s&&!U(u)&&!Reflect.has(f,u)&&!p.has(u)){p.add(u);try{let v=s(u,f);if(x(v))return v}finally{p.delete(u)}}let L=Reflect.get(f,u,P);if(c&&u!=="constructor"&&w(L)){let v=Object.getOwnPropertyDescriptor(f,u);if(v&&!v.configurable&&!v.writable)return L;let ce=Pt.get(L);ce||(ce=new WeakMap,Pt.set(L,ce));let gt=ce.get(f);if(gt)return gt;let dt=L.bind(f);return ce.set(f,dt),dt}return L}};if(r){let f=Proxy.revocable($,J);return O=f.proxy,{proxy:f.proxy,revoke:f.revoke}}return O=new Proxy($,J),O}function It(e,t=!0,r=t,n=new WeakSet){return Nt(e,{frozen:t,lock:r,skip:n,bind:t})}function pe(e,t=new WeakSet){return Nt(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var Pt,ve=b(()=>{"use strict";M();_t();fe();F();T();A();Pt=new WeakMap});function me(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(He(n))return`\0__bigint:${n}__\0`;if(w(n))return`function:${n.name||"anonymous"}`;if(Ne(n)){if(t.has(n))return"<Circular>";if(t.add(n),Ie(n))return`map:[${Array.from(n.entries()).map(i=>me(i,t)).sort().join(",")}]`;if(De(n))return`set:[${Array.from(n).map(i=>me(i,t)).sort().join(",")}]`}return n})}function $t(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function X(e){let t=new Map;return function(...r){let n=me(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let i=e.apply(this,r);t.set(n,i)}return t.get(n)}}function ge(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${me(r)}`,i=Dt.get(this);if(i||(i=new Map,Dt.set(this,i)),!i.has(n)){let o=t.apply(this,r);pe(o),i.set(n,o)}return i.get(n)}}}var Dt,Ae=b(()=>{"use strict";ve();T();Dt=new WeakMap});var Rt=b(()=>{"use strict"});function Dr(e,t){return Z(e)?t:C(t)}function $r(e,t){return vr(t)}function At(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(Rr,r=>Mt[r.toUpperCase()]??decodeURI(r))),t}function vr(e){if(y(e))try{return decodeURI(e)}catch{}return e}function de(e){return!N(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function Ar(e,t){return`{"$${e}":${t}}`}function Ct(e){return C(U(e)?`${Tt(e)?"@":""}@(${e.description??""})`:e)}function Ft(e){let[t,r,n]=e.toString().match(Cr)||[null,void 0,void 0];switch(!0){case U(e):case h(t):case(x(r)&&Y(n)):return e;case x(r):return Symbol.for(n);case Y(r):default:return Symbol(n)}}function k(e){return C(e,!1)}function C(e,t=!0){let r=z(e),n=$t(Ar)(r.type);switch(r.type){case"String":return t||(t=r.value==="true"||r.value==="false"||r.value==="null"||parseFloat(r.value).toString()===r.value),t?JSON.stringify(At(r.value)):At(r.value);case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return n(JSON.stringify("void"));case"BigInt":return n(r.value.toString());case"Object":return`{${E(r.value).filter(([,o])=>de(o)).map(([o,s])=>`${Ct(o)}: ${C(s)}`).join(",")}}`;case"Array":return`[${r.value.filter(o=>de(o)).map(o=>C(o)).join(",")}]`;case"Map":{let i=Array.from(r.value.entries()).filter(([,o])=>de(o)).map(([o,s])=>`[${C(o)}, ${C(s)}]`).join(",");return n(`[${i}]`)}case"Set":{let i=Array.from(r.value.values()).filter(o=>de(o)).map(o=>C(o)).join(",");return n(`[${i}]`)}case"Symbol":return n(Ct(r.value));case"RegExp":return n(C({source:r.value.source,flags:r.value.flags}));default:{let i=r.value;switch(!0){case!de(i):return;case w(i.toJSON):return n(C(i.toJSON()));case w(i.toString):{let o=i.toString();return n(o.includes('"')?o:JSON.stringify(o))}case w(i.valueOf):return n(JSON.stringify(i.valueOf()));default:return n(JSON.stringify(i,Dr))}}}}function re(e,t){if(!y(e))return e;let r;try{r=JSON.parse(e,$r)}catch(n){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${n.message}`),e):re(`"${e}"`,t)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return qe(r,t);default:return r}}function qe(e,t){return I(e)?Ye(E(e).reduce((r,[n,i])=>Object.assign(r,{[Ft(n)]:Ye(qe(i,t))}),{}),t):V(e)?St(e).map(r=>Ye(qe(r,t))):e}function Ye(e,t){if(!I(e)||le(e).length!==1)return e;let[r,n]=E(e)[0];if(!String(r).startsWith("$"))return e;let i=r.substring(1);try{switch(i){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?.();case"Date":return new Date(n);case"RegExp":return!I(n)||!y(n.source)?e:new RegExp(n.source,n.flags);case"Symbol":return Ft(n);case"Map":return V(n)?new Map(n):e;case"Set":return V(n)?new Set(n):e;default:let o=Ce.get(r);return o?Reflect.construct(o,[n]):(console.warn(`objectify: dont know how to deserialize '${i}'`),e)}}catch{return e}}var Ce,vt,Lt,Mt,Rr,Cr,ne=b(()=>{"use strict";Ae();F();Rt();A();T();M();Ce=globalThis[d.$SerializerRegistry]??=new Map,vt=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return y(t)?t:void 0}catch{return}},Lt=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(Ce.has(r)){let n=Ce.get(r),i=vt(n),o=vt(t),s=n.name||i,a=t.name||o||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[d.$Identity]&&n[d.$Identity]===t[d.$Identity]||!!t[d.$Target]&&n[d.$Target]===t[d.$Target]||!!s&&!!a&&s===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}Ce.set(r,t)};Mt={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},Rr=new RegExp(Object.keys(Mt).join("|"),"gi");Cr=/^@(@)?\(([^\)]*)\)$/});var kt=b(()=>{"use strict";ne();T()});function Gt(e){if($e(e))return e;let t=new Error(I(e)&&y(e.message)?e.message:String(e));return I(e)&&(t.name=y(e.name)?e.name:"Error","code"in e&&(y(e.code)||g(e.code))&&(t.code=e.code),"stack"in e&&y(e.stack)&&(t.stack=e.stack)),t}var ro,no,Wt=b(()=>{"use strict";ne();A();T();kt();ro=BigInt(Number.MAX_SAFE_INTEGER),no=BigInt(Number.MIN_SAFE_INTEGER)});var Bt=b(()=>{"use strict";Wt();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=Gt(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",t),t.message!=="Incomplete Temporal implementation")throw t}});function Jt(){return Temporal.Now.instant()}function zt(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 Xe=b(()=>{"use strict";Bt();T()});function Fr(){return Mr().resolvedOptions()}function Le(e=Fr().timeZone){try{let{jan:t,jul:r}=zt(e),i=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(o=>e.startsWith(o));switch(!0){case r>t:return"north";case r<t:return"south";default:return i?"south":void 0}}catch{return}}var mo,go,Mr,yo,ho,wo,Qe=b(()=>{"use strict";Xe();Ae();T();mo=X((e,t="narrow",r="always")=>new Intl.RelativeTimeFormat(e,{style:t,numeric:r})),go=X((e,t="conjunction",r="long")=>new Intl.ListFormat(e,{type:t,style:r})),Mr=X((e,t)=>new Intl.DateTimeFormat(e,t)),yo=X((e,t)=>{try{return new Intl.PluralRules(e,t)}catch{return{select:()=>"other"}}}),ho=X((e,t)=>new Intl.NumberFormat(e,t)),wo=X((e,t)=>{try{let r=new Intl.DurationFormat(e,t);if(w(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}})});function oe(e,t,r,n,i,o){function s(P){if(P!==void 0&&typeof P!="function")throw new TypeError("Function expected");return P}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&e?n.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),m,O=!1,$=r.length-1;$>=0;$--){var J={};for(var f in n)J[f]=f==="access"?{}:n[f];for(var f in n.access)J.access[f]=n.access[f];J.addInitializer=function(P){if(O)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(P||null))};var u=(0,r[$])(a==="accessor"?{get:p.get,set:p.set}:p[c],J);if(a==="accessor"){if(u===void 0)continue;if(u===null||typeof u!="object")throw new TypeError("Object expected");(m=s(u.get))&&(p.get=m),(m=s(u.set))&&(p.set=m),(m=s(u.init))&&i.unshift(m)}else(m=s(u))&&(a==="field"?i.unshift(m):p[c]=m)}l&&Object.defineProperty(l,n.name,p),O=!0}function ie(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}var Me=b(()=>{"use strict"});function Ut(e,t){return Ee(e)??(Y(t)?e.name||void 0:String(t))}function Zt(e,{kind:t,name:r,addInitializer:n}){let i=Ut(e,r);if(i&&_e(e,i),t==="class")return i&&n(()=>Lt(i,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function se(e,t){let r=(n,i,o)=>{let s=n.prototype,a=i??Ut(n,o);if(a&&(s&&!Object.hasOwn(s,Symbol.toStringTag)&&Object.defineProperty(s,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 typeof e=="function"&&t?.kind==="class"?r(e,void 0,t.name):(n,i)=>r(n,y(e)?e:void 0,i?.name)}var Fe=b(()=>{"use strict";M();ve();T();ne();A()});function G(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function ae(e,t=!0){let n=H(this)!=="Module"&&w(this?.has)?this:Gr,i=z(e),o=Object.create(n);switch(i.type){case"Enumify":case"Object":Object.defineProperties(o,Object.getOwnPropertyDescriptors(i.value));break;case"Array":i.value.forEach((s,a)=>{if(g(s))throw new Error("Enumify: numeric keys are not supported");o[s]=a});break;default:throw new Error(`Enumify: invalid argument type: ${i.type}`)}return It(o,!0,t)}var kr,Gr,Co,Kt=b(()=>{"use strict";Me();A();T();F();ve();Fe();Ae();kr="Enumify",Gr=pe(Object.create(null,{keys:ge("keys",function(){return E(this,!0).map(([e])=>e)}),values:ge("values",function(){return E(this,!0).map(([e,t])=>t)}),entries:ge("entries",function(){return E(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:ge("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:G(function(e){return this.keys().includes(e)}),count:G(function(){return this.keys().length}),includes:G(function(e){return this.values().includes(e)}),keyOf:G(function(e){return this.invert()[e]}),extend:G(function(e,t){return ae.call(this,e,t)}),forEach:G(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:G(function(e,t){return ae(this.entries().reduce((r,n,i)=>e.call(t,n,i,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:G(function(e,t){return ae(this.entries().reduce((r,n,i)=>Object.assign(r,{[n[0]]:e.call(t,n,i,this)}),{}))}),[Symbol.iterator]:G(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:kr}}));Co=(()=>{let e=[Zt,se("Enumify")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}constructor(o){return ae(o)}};return i=n})()});function Wr(e,t=R.Info){return g(e)?e>=R.Off&&e<=R.Trace?e:t:y(e)?jt[e.toLowerCase()]??t:t}var R,D,jt,ke,et=b(()=>{"use strict";Me();T();Kt();M();Fe();R=ae(["Off","Error","Warn","Info","Debug","Trace"]),D={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},jt={[D.Off]:R.Off,[D.Error]:R.Error,[D.Warn]:R.Warn,[D.Info]:R.Info,[D.Log]:R.Info,[D.Debug]:R.Debug,[D.Trace]:R.Trace};ke=(()=>{let e=[se("Logger")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}#r;level;constructor(o,s=R.Info){this.#r=o.startsWith("[")?o:`[${o}]`,this.level=s}#e(o,...s){let a;if(s.length>0&&I(s[0]))try{s[0][d.$LogConfig]&&(a=s.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=Wr(a.debug,c))}if(c===R.Off||(jt[o]??0)>c)return;let p=s.map(m=>{if($e(m))return m.message;if(I(m))try{let O=m.constructor?.name??"Object";if(O==="Object"){let $=Object.keys(m);return`{ ${$.slice(0,3).join(", ")}${$.length>3?`, ... (+${$.length-3} more)`:""} }`}return`[${O}]`}catch{return"[Object]"}return String(m)}).filter(m=>!Z(m)).join(" ");Z(p)||console[o](`${this.#r} ${p}`)}log=(...o)=>this.#e(D.Log,...o);info=(...o)=>this.#e(D.Info,...o);warn=(...o)=>this.#e(D.Warn,...o);debug=(...o)=>this.#e(D.Debug,...o);trace=(...o)=>this.#e(D.Trace,...o);error=(...o)=>this.#e(D.Error,...o)};return i=n})()});var Br,Vt,Ht,tt,rt,jo,Yt=b(()=>{"use strict";ne();fe();T();Br=q(),Vt=()=>{let e=new Map;return{get length(){return e.size},clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>Array.from(e.keys())[t]??null,removeItem:t=>{e.delete(t)},setItem:(t,r)=>{e.set(t,String(r))}}},Ht=new Map,tt=e=>{let t=Ht.get(e);return t||(t=Vt(),Ht.set(e,t)),t},rt=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&typeof t.getItem=="function"&&typeof t.setItem=="function"&&typeof t.removeItem=="function"&&typeof t.clear=="function"&&typeof t.key=="function"&&typeof t.length=="number")return t}catch{}return tt(e)},jo=Br.type===_.Browser?rt():Vt()});var qt={};Q(qt,{WebStore:()=>Jr});var ye,Jr,Xt=b(()=>{"use strict";Me();F();ne();A();T();Yt();Fe();ye={Local:"local",Session:"session"},Jr=(()=>{let e=[se("WebStore")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}static _localInstance;static _sessionInstance;static get local(){return i._localInstance??=new i(ye.Local)}static get session(){return i._sessionInstance??=new i(ye.Session)}#r;#e;get#o(){if(this.#e)return this.#e;let o=this.#r===ye.Local?"localStorage":"sessionStorage";return this.#e=rt(o)}#n(o){try{return o(this.#o)}catch{let a=this.#r===ye.Local?"localStorage":"sessionStorage",c=tt(a);return this.#e=c,o(c)}}constructor(o=ye.Local){this.#r=o}get(o,s){let a=this.#n(c=>c.getItem(k(o)));return y(a)?re(a):s??null}set(o,s,a={merge:!0}){if(h(o))return this.clear();let c=this.get(o),l=z(s);switch(l.type){case"Undefined":return this.del(o);case"Object":return c??={},this.#t(o,a.merge?Object.assign(c,l.value):l.value);case"Array":return c??=[],this.#t(o,a.merge?Oe(c.concat(l.value)):s);case"Map":return c??=new Map,a.merge?(l.value.forEach((p,m)=>c.set(m,p)),this.#t(o,c)):this.#t(o,l.value);case"Set":return c??=new Set,a.merge?(l.value.forEach(p=>c.add(p)),this.#t(o,c)):this.#t(o,l.value);default:return this.#t(o,l.value)}}clear(){try{this.#n(o=>o.clear())}catch(o){console.warn("[WebStore] Failed to clear storage:",o)}return this}del(...o){return o.forEach(s=>{try{this.#n(a=>a.removeItem(k(s)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(s)}':`,a)}}),this}keys(...o){return this.entries(...o).map(([s])=>s)}values(...o){return this.entries(...o).map(([,s])=>s)}entries(...o){let s=new Set(o.map(c=>k(c))),a=[];return this.#n(c=>{for(let l=0;l<c.length;l++){let p=c.key(l);if(p!==null&&(Z(o)||s.has(p))){let m=c.getItem(p);a.push([re(p),re(m)])}}}),a}from(o){return E(o).forEach(([s,a])=>this.set(s,a)),this}#t(o,s){try{this.#n(a=>a.setItem(k(o),k(s)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(o)}':`,a)}return this}};return i=n})()});var er={};Q(er,{geoCoords:()=>Qt,geoLocation:()=>he,mapAddress:()=>Zr,mapHemisphere:()=>Ur,mapQuery:()=>it});var We,zr,S,ot,W,nt,Ge,he,Qt,it,Ur,Zr,st=b(()=>{"use strict";Ot();fe();T();Xe();Qe();et();We={catch:!0,debug:0},zr=q(),S={},ot="_map_",W=new ke("[Mapper]"),nt=null,Ge=()=>(nt||(nt=new Promise((e,t)=>{zr.type===_.Browser?Promise.resolve().then(()=>(Xt(),qt)).then(({WebStore:r})=>{let n=new r("local");Object.assign(S,n.get(ot,{})),e(n)}).catch(t):e(void 0)})),nt),he=(e={})=>Ge().then(()=>new Promise((t,r)=>{e=Object.assign({},We,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(i=>{let o=S.geolocation?.coords,s=o?.latitude?.toFixed(3),a=o?.longitude?.toFixed(3),c=S.geolocation?.timestamp??0,l=i.coords.latitude.toFixed(3)!==s,p=i.coords.longitude.toFixed(3)!==a,m=c<Jt().epochMilliseconds-36e5;(l||p||m)&&(Object.assign(S,{georesponse:null}),W.info(e,"GeoLocation: device update")),Object.assign(S,{geolocation:Re(i)}),t(S.geolocation)},i=>{Object.assign(S,{geolocation:{error:i.message},georesponse:null}),n(S.geolocation)}):(Object.assign(S,{geolocation:{error:"Not Supported"},georesponse:null}),n(S.geolocation))})).finally(()=>{(S.geolocation?.error?W.error:W.info)(e,"geoLocation: ",S.geolocation),Ge().then(r=>r?.set(ot,S))}),Qt=e=>new Promise((t,r)=>{if(!h(e))return t(e);he().then(n=>h(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),it=(e,t={})=>Ge().then(()=>new Promise((r,n)=>{t=Object.assign({},We,t);let i=t.catch?r:n;Qt(e).then(o=>{switch(!0){case!(typeof window<"u"&&"google"in window&&"maps"in window.google):throw new Error("Google Maps API not configured");case h(o):throw new Error("Cannot determine Coordinates");case h(e):{let s=S.geolocation&&S.georesponse,a=h(S.geolocation?.error)&&h(S.georesponse?.error);if(s&&a)return t.debug&&W.debug(t,"mapQuery: cache"),r(S.georesponse)}default:new window.google.maps.Geocoder().geocode(o).then(s=>r(S.georesponse=Re(s)))}}).catch(o=>{Object.assign(S,{georesponse:{error:o.message}}),i(S.georesponse)})})).finally(()=>{t.debug&&(S.georesponse?.error?W.error:W.debug)(t,"mapQuery: ",S.georesponse),Ge().then(r=>r?.set(ot,S))}),Ur=(e,t={})=>it(e,t).then(r=>{if(t=Object.assign({},We,t),h(r.error))return t.debug&&W.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=Le();if(h(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&W.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),Zr=(e,t={})=>it(e,t).then(r=>{if(!h(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((i,o)=>(o.types.filter(s=>s!=="political").forEach(s=>i[s]=(i[s]?i[s]+",":"").concat(o.short_name)),i),{formatted_address:r})).catch(r=>{if(t=Object.assign({},We,t),t.debug&&W.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var ir={};Q(ir,{HTTP:()=>nr,HttpError:()=>B,METHOD:()=>or,fetchHead:()=>jr,fetchRequest:()=>Kr});var at,tr,nr,or,B,rr,Kr,jr,sr=b(()=>{"use strict";T();at=2e3,tr=/\);?$/,nr={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},or={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},B=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"}},rr=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 B(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(w(e.text))a=await e.text();else if(w(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 B(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),i=new TextDecoder,o=0,s="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(o+=c.byteLength,o>t){try{await n.cancel()}catch{}throw new B(413,`Streamed payload exceeded limit (${t} bytes)`,null)}s+=i.decode(c,{stream:!0})}}return s+=i.decode(),s}finally{try{n.releaseLock()}catch{}}},Kr=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??at)]):AbortSignal.timeout(r.timeout??at)};return fetch(e,n).then(async i=>{if(i.ok){let a=(i.headers?.get?.("Content-Type")||i.headers?.get?.("content-type")||"").includes("application/json");if(x(r.maxBytes)){let c=await rr(i,r.maxBytes);if(r.rawText)return c;if(r.prefix){let l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tr,""):c;return JSON.parse(l)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return w(i.text)?await i.text():"";if(r.prefix){let c=await i.text(),l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tr,""):c;return JSON.parse(l)}if(w(i.text)){let c=await i.text();try{return JSON.parse(c)}catch{return c}}return w(i.json)?await i.json():""}let o=null;try{let s=x(r.maxBytes)?await rr(i,r.maxBytes):w(i.text)?await i.text():"";try{o=JSON.parse(s)}catch{o=s}}catch(s){if(s instanceof B&&s.status===413)throw s}throw new B(i.status,i.statusText,o)})},jr=e=>{let t=AbortSignal.timeout(at),r={method:or.Head,signal:t};return fetch(e,r).then(({ok:n,status:i,statusText:o,headers:s})=>{if(n||i===nr.Forbidden)return{status:i,headers:s};throw new B(i,o,null)})}});var ft={};Q(ft,{serverGeoCoords:()=>Be,serverGeoLocation:()=>we,serverMapHemisphere:()=>lt});var ar,ct,ut,Hr,we,Be,lt,Je=b(()=>{"use strict";T();Qe();et();ar=new ke("[ServerMapper]"),ct={endpoint:"https://ipwho.is/",timeout:3e3,catch:!0,debug:0},ut=null,Hr=()=>(ut||(ut=Promise.resolve().then(()=>(sr(),ir))),ut),we=async(e={})=>{let t={...ct,...e},r=t.catch!==!1;try{let n=t.endpoint||ct.endpoint,i=t.timeout??ct.timeout,{fetchRequest:o}=await Hr(),s=await o(n,{},{...g(i)?{timeout:i}:{},maxBytes:64*1024});if(typeof s!="object"||h(s))throw new Error("Geolocation lookup failed");if(s.status==="fail"||s.success===!1)throw new Error(s.message||s.reason||"Geolocation lookup failed");let a=g(s.lat)?s.lat:s.latitude,c=g(s.lon)?s.lon:s.lng??s.longitude;if(!g(a)||!g(c))throw new Error("Geolocation lookup failed");let l=y(s.timezone)?s.timezone:s.timezone?.id??s.timeZone,p={lat:a,lng:c,latitude:a,longitude:c,...y(s.country||s.countryName||s.country_name)?{country:s.country||s.countryName||s.country_name}:{},...y(s.city||s.cityName||s.city_name)?{city:s.city||s.cityName||s.city_name}:{},...y(l)?{timezone:l}:{},...y(s.query||s.ip||s.ip_address)?{query:s.query||s.ip||s.ip_address}:{},status:"success"};return t.debug&&ar.info(t,"serverGeoLocation success: ",p),p}catch(n){let i=n?.message||"Server geolocation error";if(t.debug&&ar.error(t,"serverGeoLocation error: ",i),!r)throw n;return{error:i,status:"fail"}}},Be=async(e,t)=>{if(!h(e)){let n=e.latitude??e.lat,i=e.longitude??e.lng??e.lon??e.long;if(g(n)&&g(i))return{lat:n,lng:i}}let r=await we(t);return h(r.error)&&g(r.lat)&&g(r.lng)?{lat:r.lat,lng:r.lng}:null},lt=async(e,t)=>{let r=await Be(e,t);return r?r.lat>=0?"north":"south":Le()??null}});var qr={};Q(qr,{GeoPlugin:()=>mt,coerceGeo:()=>pt,default:()=>Yr,geoLocation:()=>he,geoLookup:()=>Ue,geoPlugin:()=>Vr,getStashedGeo:()=>ze,resolveGeoCoordinates:()=>be,serverGeoCoords:()=>Be,serverGeoLocation:()=>we,serverMapHemisphere:()=>lt});var j={};Q(j,{definePlugin:()=>Ke,defineTerm:()=>dr});ue(j,yt(Ze()));var Te=yt(Ze()),Ke=e=>(0,Te.definePlugin)({...e,version:"0.1.0"}),dr=e=>(0,Te.defineTerm)({...e,version:"0.1.0"});fe();T();var pt=e=>{if(h(e)||typeof e!="object")return;let t=e.geo??e,r=e.config?.geo??e.config,n=t?.latitude??t?.lat??e.latitude??e.lat??r?.latitude??r?.lat,i=t?.longitude??t?.lng??t?.lon??t?.long??e.longitude??e.lng??e.lon??e.long??r?.longitude??r?.lng??r?.lon??r?.long,o=t?.elevation??e.elevation??r?.elevation,s=t?.sphere??e.sphere??r?.sphere,a=t?.country??e.country??r?.country,c=t?.city??e.city??r?.city,l={};if(g(n)&&(l.latitude=n),g(i)&&(l.longitude=i),g(o)&&(l.elevation=o),(s==="north"||s==="south")&&(l.sphere=s),y(a)&&(l.country=a),y(c)&&(l.city=c),t&&typeof t=="object")for(let p of Object.keys(t))te(p)&&!["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city"].includes(p)&&(l[p]=t[p]);return Object.keys(l).length>0?l:void 0},ze=()=>{let{type:e}=q();if(e===_.Browser||e===_.WebWorker)try{if(typeof localStorage<"u"){let t=localStorage.getItem("_map_");if(t){let n=JSON.parse(t)?.geolocation?.coords;if(g(n?.latitude)&&g(n?.longitude))return{latitude:n.latitude,longitude:n.longitude}}}}catch{}},Ue=async(e={})=>{let{type:t}=q();switch(t){case _.Browser:{let{geoLocation:r}=await Promise.resolve().then(()=>(st(),er)),n=await r(e);if(n.error)return{error:n.error};let i=n.coords?.latitude,o=n.coords?.longitude;return{lat:i,lng:o,latitude:i,longitude:o,...n}}case _.WebWorker:{let r=ze();if(r&&g(r.latitude)&&g(r.longitude))return{lat:r.latitude,lng:r.longitude,latitude:r.latitude,longitude:r.longitude};let{serverGeoLocation:n}=await Promise.resolve().then(()=>(Je(),ft));return n(e)}case _.NodeJS:case _.Deno:default:{let{serverGeoLocation:r}=await Promise.resolve().then(()=>(Je(),ft));return r(e)}}},be=async(e,t={})=>{let r=pt(e);if(r&&g(r.latitude)&&g(r.longitude))return{lat:r.latitude,lng:r.longitude};let n=ze();if(n&&g(n.latitude)&&g(n.longitude))return{lat:n.latitude,lng:n.longitude};let i=await Ue(t);return h(i.error)&&g(i.lat)&&g(i.lng)?{lat:i.lat,lng:i.lng}:null};Je();st();var mt=Ke({name:"geo",install(e){e.geoLookup=Ue,e.resolveGeoCoordinates=be,e.serverGeoLocation=we,e.geoLocation=he,e.prototype.geoLocate=async function(t){let r=await be(this,t);if(r){let n=typeof this.config.geo=="object"&&this.config.geo!==null?this.config.geo:{};return new e(this,{...this.config,geo:{...n,latitude:r.lat,longitude:r.lng}})}return this},e.prototype.geoLookup=async function(t){return be(this,t)}}}),Vr=mt,Yr=mt;return gr(qr);})();