diff --git a/package.json b/package.json index a34fded..ff67054 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "marco", - "version": "1.11.3", + "version": "1.11.4", "private": true, "description": "Unhosted maps app", "repository": { diff --git a/release/assets/main-DD9l9xzQ.js b/release/assets/main-ji2SNMnp.js similarity index 79% rename from release/assets/main-DD9l9xzQ.js rename to release/assets/main-ji2SNMnp.js index 318c99f..e360425 100644 --- a/release/assets/main-DD9l9xzQ.js +++ b/release/assets/main-ji2SNMnp.js @@ -1,2 +1,2 @@ -const t=Object.freeze(Object.defineProperty({__proto__:null,get default(){return sV}},Symbol.toStringTag,{value:"Module"}));!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver(t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)}).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const e="object"==typeof self&&null!==self&&self.Object===Object&&"undefined"!=typeof Window&&self.constructor===Window&&"object"==typeof document&&null!==document&&self.document===document&&"object"==typeof location&&null!==location&&self.location===location&&"object"==typeof history&&null!==history&&self.history===history&&"object"==typeof navigator&&null!==navigator&&self.navigator===navigator&&"string"==typeof navigator.userAgent,n=e?self:null,i=e?self.location:null,r=e?self.history:null,s=e?self.navigator.userAgent:"Lynx (textmode)",o=!(!e||"object"!=typeof chrome||"object"==typeof opera),a=!!e&&/Firefox|FxiOS/.test(s),l=Object.freeze(Object.defineProperty({__proto__:null,hasDOM:e,history:r,isChrome:o,isFirefox:a,location:i,userAgent:s,window:n},Symbol.toStringTag,{value:"Module"}));function c(t){return t&&t.Object===Object?t:void 0}const u=c((h="object"==typeof global&&global)&&void 0===h.nodeType?h:void 0)||c("object"==typeof self&&self)||c("object"==typeof window&&window)||"undefined"!=typeof mainContext&&mainContext||new Function("return this")();var h;const d=function(t,e){return void 0===e?{imports:t,exports:t,lookup:t}:{imports:e.imports||t,exports:e.exports||t,lookup:e.lookup||t}}(u,u.Ember);function p(){return d.lookup}function f(t){d.lookup=t}const g={ENABLE_OPTIONAL_FEATURES:!1,EXTEND_PROTOTYPES:{Array:!1},LOG_STACKTRACE_ON_DEPRECATION:!0,LOG_VERSION:!0,RAISE_ON_DEPRECATION:!1,STRUCTURED_PROFILE:!1,_DEBUG_RENDER_TREE:!1,_ALL_DEPRECATIONS_ENABLED:!1,_OVERRIDE_DEPRECATION_VERSION:null,_DEFAULT_ASYNC_OBSERVERS:!1,_RERENDER_LOOP_LIMIT:1e3,EMBER_LOAD_HOOKS:{},FEATURES:{}};function m(){return g}(t=>{if("object"!=typeof t||null===t)return;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||"EXTEND_PROTOTYPES"===i||"EMBER_LOAD_HOOKS"===i)continue;let e=g[i];g[i]=!0===e?!1!==t[i]:!1===e?!0===t[i]:t[i]}let{EMBER_LOAD_HOOKS:e}=t;if("object"==typeof e&&null!==e)for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let t=e[i];Array.isArray(t)&&(g.EMBER_LOAD_HOOKS[i]=t.filter(t=>"function"==typeof t))}let{FEATURES:n}=t;if("object"==typeof n&&null!==n)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(g.FEATURES[i]=!0===n[i])})(u.EmberENV);let y=()=>{},_=()=>{},v=!1;function b(){return v}function w(t){v=Boolean(t)}let x=()=>{};const{toString:S}=Object.prototype,{toString:C}=Function.prototype,{isArray:k}=Array,{keys:E}=Object,{stringify:T}=JSON,R=100,P=/^[\w$]+$/;function M(t){return"number"==typeof t&&2===arguments.length?this:I(t,0)}function I(t,e,n){let i=!1;switch(typeof t){case"undefined":return"undefined";case"object":if(null===t)return"null";if(k(t)){i=!0;break}if(t.toString===S||void 0===t.toString)break;return t.toString();case"function":return t.toString===C?t.name?`[Function:${t.name}]`:"[Function]":t.toString();case"string":return T(t);default:return t.toString()}if(void 0===n)n=new WeakSet;else if(n.has(t))return"[Circular]";return n.add(t),i?function(t,e,n){if(e>4)return"[Array]";let i="[";for(let r=0;r=R){i+=`... ${t.length-R} more items`;break}i+=I(t[r],e,n)}return i+=" ]",i}(t,e+1,n):function(t,e,n){if(e>4)return"[Object]";let i="{",r=E(t);for(let s=0;s=R){i+=`... ${r.length-R} more keys`;break}let o=r[s];i+=`${O(String(o))}: ${I(t[o],e,n)}`}return i+=" }",i}(t,e+1,n)}function O(t){return P.test(t)?t:T(t)}function A(t){let e=t.lookup("renderer:-dom");if(!e)throw new Error("BUG: owner is missing renderer");return e.debugRenderTree.capture()}const F=()=>{};let L=F,z=F,D=F,j=F,N=F,U=F,B=F,q=F,V=function(){return arguments[arguments.length-1]};function $(){}const G=Object.freeze(Object.defineProperty({__proto__:null,_warnIfUsingStrippedFeatureFlags:void 0,assert:y,captureRenderTree:A,debug:D,debugFreeze:N,debugSeal:j,deprecate:$,deprecateFunc:V,getDebugFunction:q,info:L,inspect:M,isTesting:b,registerDeprecationHandler:_,registerWarnHandler:x,runInDebug:U,setDebugFunction:B,setTesting:w,warn:z},Symbol.toStringTag,{value:"Module"}));function W(t){let e=Object.create(null);e[t]=1;for(let n in e)if(n===t)return n;return t}function H(t){return null!==t&&("object"==typeof t||"function"==typeof t)}let K=0;function X(){return++K}const Y="ember",Z=new WeakMap,J=new Map,Q=W(`__ember${Date.now()}`);function tt(t,e=Y){let n=e+X().toString();return H(t)&&Z.set(t,n),n}function et(t){let e;if(H(t))e=Z.get(t),void 0===e&&(e=`${Y}${X()}`,Z.set(t,e));else if(e=J.get(t),void 0===e){let n=typeof t;e="string"===n?`st${X()}`:"number"===n?`nu${X()}`:"symbol"===n?`sy${X()}`:`(${t})`,J.set(t,e)}return e}const nt=void 0,it=/\.(_super|call\(this|apply\(this)/,rt=Function.prototype.toString,st=rt.call(function(){return this}).indexOf("return this")>-1?function(t){return it.test(rt.call(t))}:function(){return!0},ot=new WeakMap,at=Object.freeze(function(){});function lt(t){let e=ot.get(t);return void 0===e&&(e=st(t),ot.set(t,e)),e}ot.set(at,!1);class ct{listeners=void 0;observers=void 0}const ut=new WeakMap;function ht(t){let e=ut.get(t);return void 0===e&&(e=new ct,ut.set(t,e)),e}function dt(t){return ut.get(t)}function pt(t,e){ht(t).observers=e}function ft(t,e){ht(t).listeners=e}const gt=new WeakSet;function mt(t,e){return lt(t)?!gt.has(e)&<(e)?yt(t,yt(e,at)):yt(t,e):t}function yt(t,e){function n(){let n=this._super;this._super=e;let i=t.apply(this,arguments);return this._super=n,i}gt.add(n);let i=ut.get(t);return void 0!==i&&ut.set(n,i),n}function _t(t,e){let n=t;do{let t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return t;n=Object.getPrototypeOf(n)}while(null!==n);return null}let vt,bt,wt;const xt=[];function St(t){return-1!==xt.indexOf(t)}function Ct(t){return W(`__${t}${Q+Math.floor(Math.random()*Date.now()).toString()}__`)}const kt=Symbol,Et=Object.prototype.toString;function Tt(t){return null==t}function Rt(t){if("string"==typeof t)return t;if(null===t)return"null";if(void 0===t)return"undefined";if(Array.isArray(t)){let e="";for(let n=0;n0&&(e+=","),Tt(t[n])||(e+=Rt(t[n]));return e}return"function"==typeof t.toString?t.toString():Et.call(t)}let Pt,Mt,It,Ot,At,Ft,Lt,zt,Dt,jt,Nt=()=>{},Ut=new WeakMap;function Bt(t,e){return null===t?e:Array.isArray(t)?(t.push(e),t):[t,e]}function qt(t,e){Array.isArray(t)?t.forEach(e):null!==t&&e(t)}function Vt(t,e){if(Array.isArray(t)&&t.length>1){let n=t.indexOf(e);return t.splice(n,1),t}return null}function $t(t){let e=Ut.get(t);return void 0===e&&(e={parents:null,children:null,eagerDestructors:null,destructors:null,state:0},Ut.set(t,e)),e}function Gt(t,e){let n=$t(t),i=$t(e);return n.children=Bt(n.children,e),i.parents=Bt(i.parents,t),e}function Wt(t,e,n=!1){let i=$t(t),r=n?"eagerDestructors":"destructors";return i[r]=Bt(i[r],e),e}function Ht(t){let e=$t(t);if(e.state>=1)return;let{parents:n,children:i,eagerDestructors:r,destructors:s}=e;e.state=1,qt(i,Ht),qt(r,e=>{e(t)}),qt(s,e=>{Pt(t,e)}),Mt(()=>{qt(n,e=>{!function(t,e){let n=$t(e);0===n.state&&(n.children=Vt(n.children,t))}(t,e)}),e.state=2})}function Kt(t){let e=Ut.get(t);return void 0!==e&&null!==e.children}function Xt(t){let e=Ut.get(t);return void 0!==e&&e.state>=1}function Yt(t){let e=Ut.get(t);return void 0!==e&&e.state>=2}const Zt=Object.prototype;let Jt;const Qt=kt("undefined");var te=function(t){return t[t.ADD=0]="ADD",t[t.ONCE=1]="ONCE",t[t.REMOVE=2]="REMOVE",t}(te||{});let ee=1;class ne{_descriptors;_mixins;_isInit;_lazyChains;_values;_revisions;source;proto;_parent;_listeners;_listenersVersion=1;_inheritedEnd=-1;_flattenedVersion=0;constructor(t){this._parent=void 0,this._descriptors=void 0,this._mixins=void 0,this._lazyChains=void 0,this._values=void 0,this._revisions=void 0,this._isInit=!1,this.source=t,this.proto=void 0===t.constructor?void 0:t.constructor.prototype,this._listeners=void 0}get parent(){let t=this._parent;if(void 0===t){let e=ie(this.source);this._parent=t=null===e||e===Zt?null:ae(e)}return t}setInitializing(){this._isInit=!0}unsetInitializing(){this._isInit=!1}isInitializing(){return this._isInit}isPrototypeMeta(t){return this.proto===this.source&&this.source===t}_getOrCreateOwnMap(t){return this[t]||(this[t]=Object.create(null))}_getOrCreateOwnSet(t){return this[t]||(this[t]=new Set)}_findInheritedMap(t,e){let n=this;for(;null!==n;){let i=n[t];if(void 0!==i){let t=i.get(e);if(void 0!==t)return t}n=n.parent}}_hasInInheritedSet(t,e){let n=this;for(;null!==n;){let i=n[t];if(void 0!==i&&i.has(e))return!0;n=n.parent}return!1}valueFor(t){let e=this._values;return void 0!==e?e[t]:void 0}setValueFor(t,e){this._getOrCreateOwnMap("_values")[t]=e}revisionFor(t){let e=this._revisions;return void 0!==e?e[t]:void 0}setRevisionFor(t,e){this._getOrCreateOwnMap("_revisions")[t]=e}writableLazyChainsFor(t){let e=this._getOrCreateOwnMap("_lazyChains"),n=e[t];return void 0===n&&(n=e[t]=[]),n}readableLazyChainsFor(t){let e=this._lazyChains;if(void 0!==e)return e[t]}addMixin(t){this._getOrCreateOwnSet("_mixins").add(t)}hasMixin(t){return this._hasInInheritedSet("_mixins",t)}forEachMixins(t){let e,n=this;for(;null!==n;){let i=n._mixins;void 0!==i&&(e=void 0===e?new Set:e,i.forEach(n=>{e.has(n)||(e.add(n),t(n))})),n=n.parent}}writeDescriptors(t,e){(this._descriptors||(this._descriptors=new Map)).set(t,e)}peekDescriptors(t){let e=this._findInheritedMap("_descriptors",t);return e===Qt?void 0:e}removeDescriptors(t){this.writeDescriptors(t,Qt)}forEachDescriptors(t){let e,n=this;for(;null!==n;){let i=n._descriptors;void 0!==i&&(e=void 0===e?new Set:e,i.forEach((n,i)=>{e.has(i)||(e.add(i),n!==Qt&&t(i,n))})),n=n.parent}}addToListeners(t,e,n,i,r){this.pushListener(t,e,n,i?te.ONCE:te.ADD,r)}removeFromListeners(t,e,n){this.pushListener(t,e,n,te.REMOVE)}pushListener(t,e,n,i,r=!1){let s=this.writableListeners(),o=le(s,t,e,n);if(-1!==o&&o0&&(t.splice(0,this._inheritedEnd),this._inheritedEnd=0);for(let n of e)-1===le(t,n.event,n.target,n.method)&&(t.unshift(n),this._inheritedEnd++)}}this._flattenedVersion=ee}return this._listeners}matchingListeners(t){let e,n=this.flattenedListeners();if(void 0!==n)for(let i of n)i.event!==t||i.kind!==te.ADD&&i.kind!==te.ONCE||(void 0===e&&(e=[]),e.push(i.target,i.method,i.kind===te.ONCE));return e}observerEvents(){let t,e=this.flattenedListeners();if(void 0!==e)for(let n of e)n.kind!==te.ADD&&n.kind!==te.ONCE||-1===n.event.indexOf(":change")||(void 0===t&&(t=[]),t.push(n));return t}}const ie=Object.getPrototypeOf,re=new WeakMap;function se(t,e){re.set(t,e)}function oe(t){let e=re.get(t);if(void 0!==e)return e;let n=ie(t);for(;null!==n;){if(e=re.get(n),void 0!==e)return e.proto!==n&&(e.proto=n),e;n=ie(n)}return null}const ae=function(t){let e=oe(t);if(null!==e&&e.source===t)return e;let n=new ne(t);return se(t,n),n};function le(t,e,n,i){for(let r=t.length-1;r>=0;r--){let s=t[r];if(s.event===e&&s.target===n&&s.method===i)return r}return-1}let ce=1;const ue=Symbol("TAG_COMPUTE");function he(t){return t[ue]()}function de(t,e){return e>=t[ue]()}Reflect.set(globalThis,"COMPUTE_SYMBOL",ue);const pe=Symbol("TAG_TYPE");class fe{static combine(t){switch(t.length){case 0:return ve;case 1:return t[0];default:{let e=new fe(2);return e.subtag=t,e}}}constructor(t){this.revision=1,this.lastChecked=1,this.lastValue=1,this.isUpdating=!1,this.subtag=null,this.subtagBufferCache=null,this[pe]=t}[ue](){let{lastChecked:t}=this;if(this.isUpdating)this.lastChecked=++ce;else if(t!==ce){this.isUpdating=!0,this.lastChecked=ce;try{let{subtag:t,revision:e}=this;if(null!==t)if(Array.isArray(t))for(const n of t){let t=n[ue]();e=Math.max(t,e)}else{let n=t[ue]();n===this.subtagBufferCache?e=Math.max(e,this.lastValue):(this.subtagBufferCache=null,e=Math.max(e,n))}this.lastValue=e}finally{this.isUpdating=!1}}return this.lastValue}static updateTag(t,e){let n=t,i=e;i===ve?n.subtag=null:(n.subtagBufferCache=i[ue](),n.subtag=i)}static dirtyTag(t,e){t.revision=++ce,Nt()}}const ge=fe.dirtyTag,me=fe.updateTag;function ye(){return new fe(0)}function _e(){return new fe(1)}const ve=new fe(3);function be(t){return t===ve}class we{[ue](){return NaN}constructor(){this[pe]=100}}const xe=new we;class Se{[ue](){return ce}constructor(){this[pe]=101}}const Ce=new Se,ke=fe.combine;let Ee=_e(),Te=_e(),Re=_e();he(Ee),ge(Ee),he(Ee),me(Ee,ke([Te,Re])),he(Ee),ge(Te),he(Ee),ge(Re),he(Ee),me(Ee,Re),he(Ee),ge(Re),he(Ee);class Pe{add(t){t!==ve&&(this.tags.add(t),this.last=t)}combine(){let{tags:t}=this;return 0===t.size?ve:1===t.size?this.last:ke(Array.from(this.tags))}constructor(){this.tags=new Set,this.last=null}}let Me=null;const Ie=[];function Oe(){Ie.push(Me),Me=new Pe}function Ae(){let t=Me;return Me=Ie.pop()||null,function(t){if(null==t)throw new Error("Expected value to be present");return t}(t).combine()}function Fe(){Ie.push(Me),Me=null}function Le(){Me=Ie.pop()||null}function ze(){return null!==Me}function De(t){null!==Me&&Me.add(t)}const je=Symbol("FN"),Ne=Symbol("LAST_VALUE"),Ue=Symbol("TAG"),Be=Symbol("SNAPSHOT");function qe(t){return{[je]:t,[Ne]:void 0,[Ue]:void 0,[Be]:-1}}function Ve(t){let e=t[je],n=t[Ue],i=t[Be];if(void 0!==n&&de(n,i))De(n);else{Oe();try{t[Ne]=e()}finally{n=Ae(),t[Ue]=n,t[Be]=he(n),De(n)}}return t[Ne]}function $e(t){return be(t[Ue])}function Ge(t){let e;Oe();try{t()}finally{e=Ae()}return e}function We(t){Fe();try{return t()}finally{Le()}}const He=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),Ke=new Set(["fill","push","unshift"]);function Xe(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}class Ye{#t;constructor(t,e){this.#e=_e(),this.#n=new Map,this.#t=e;const n=t.slice(),i=this,r=new Map;let s=!1;return new Proxy(n,{get(t,e){const n=Xe(e);if(null!==n)return i.#i(n),De(i.#e),t[n];if("length"===e)return s?s=!1:De(i.#e),t[e];if(Ke.has(e)&&(s=!0),He.has(e)){let n=r.get(e);return void 0===n&&(n=(...n)=>(De(i.#e),t[e](...n)),r.set(e,n)),n}return t[e]},set(t,e,n){if(i.#t.equals(t[e],n))return!0;t[e]=n;const r=Xe(e);return null!==r?(i.#r(r),i.#s()):"length"===e&&i.#s(),!0},getPrototypeOf:()=>Ye.prototype})}#e;#n;#i(t){let e=this.#n.get(t);void 0===e&&(e=_e(),this.#n.set(t,e)),De(e)}#r(t){const e=this.#n.get(t);e&&ge(e)}#s(){ge(this.#e),this.#n.clear()}}Object.setPrototypeOf(Ye.prototype,Array.prototype);class Ze{#t;#e;#n;#o;#a(t){const e=this.#n;let n=e.get(t);return void 0===n&&(n=_e(),e.set(t,n)),n}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#e=_e(),this.#n=new Map,this.#o=t instanceof Map?new Map(t.entries()):new Map(t),this.#t=e}get(t){return De(this.#a(t)),this.#o.get(t)}has(t){return De(this.#a(t)),this.#o.has(t)}entries(){return De(this.#e),this.#o.entries()}keys(){return De(this.#e),this.#o.keys()}values(){return De(this.#e),this.#o.values()}forEach(t){De(this.#e),this.#o.forEach(t)}get size(){return De(this.#e),this.#o.size}[Symbol.iterator](){let t=this.keys(),e=this;return{next(){let n=t.next(),i=n.value;return n.done?{value:[void 0,void 0],done:!0}:{value:[i,e.get(i)],done:!1}}}}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}set(t,e){let n=this.#o.get(t);return n&&this.#t.equals(n,e)||(this.#r(t),n||ge(this.#e),this.#o.set(t,e)),this}delete(t){return!this.#o.has(t)||(this.#r(t),ge(this.#e),this.#n.delete(t),this.#o.delete(t))}clear(){0!==this.#o.size&&(this.#n.forEach(t=>ge(t)),this.#n.clear(),ge(this.#e),this.#o.clear())}}Object.setPrototypeOf(Ze.prototype,Map.prototype);class Je{#t;#n;#e;#i(t){let e=this.#n.get(t);void 0===e&&(e=_e(),this.#n.set(t,e)),De(e)}#r(t){const e=this.#n.get(t);e&&ge(e)}#s(){ge(this.#e)}constructor(t,e){this.#n=new Map,this.#e=_e(),this.#t=e;const n=Object.getPrototypeOf(t),i=Object.getOwnPropertyDescriptors(t),r=Object.create(n);for(const o in i)Object.defineProperty(r,o,i[o]);const s=this;return new Proxy(r,{get:(t,e)=>(s.#i(e),t[e]),has:(t,e)=>(s.#i(e),e in t),ownKeys:t=>(De(s.#e),Reflect.ownKeys(t)),set:(t,e,n)=>(s.#t.equals(t[e],n)||(t[e]=n,s.#r(e),s.#s()),!0),deleteProperty:(t,e)=>(e in t&&(delete t[e],s.#r(e),s.#n.delete(e),s.#s()),!0),getPrototypeOf:()=>Je.prototype})}}class Qe{#t;#e;#n;#o;#a(t){const e=this.#n;let n=e.get(t);return void 0===n&&(n=_e(),e.set(t,n)),n}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#e=_e(),this.#n=new Map,this.#o=new Set(t),this.#t=e}has(t){return De(this.#a(t)),this.#o.has(t)}entries(){return De(this.#e),this.#o.entries()}keys(){return De(this.#e),this.#o.keys()}values(){return De(this.#e),this.#o.values()}union(t){return De(this.#e),this.#o.union(t)}intersection(t){return De(this.#e),this.#o.intersection(t)}difference(t){return De(this.#e),this.#o.difference(t)}symmetricDifference(t){return De(this.#e),this.#o.symmetricDifference(t)}isSubsetOf(t){return De(this.#e),this.#o.isSubsetOf(t)}isSupersetOf(t){return De(this.#e),this.#o.isSupersetOf(t)}isDisjointFrom(t){return De(this.#e),this.#o.isDisjointFrom(t)}forEach(t){De(this.#e),this.#o.forEach(t)}get size(){return De(this.#e),this.#o.size}[Symbol.iterator](){return De(this.#e),this.#o[Symbol.iterator]()}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}add(t){if(this.#o.has(t)){if(this.#t.equals(t,t))return this}else ge(this.#e);return this.#r(t),this.#o.add(t),this}delete(t){return!this.#o.has(t)||(this.#r(t),ge(this.#e),this.#n.delete(t),this.#o.delete(t))}clear(){0!==this.#o.size&&(this.#n.forEach(t=>ge(t)),ge(this.#e),this.#n.clear(),this.#o.clear())}}Object.setPrototypeOf(Qe.prototype,Set.prototype);class tn{#t;#n;#o;#a(t){let e=this.#n.get(t);return void 0===e&&(e=_e(),this.#n.set(t,e)),e}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#n=new WeakMap,this.#o=t instanceof WeakMap?t:new WeakMap(t),this.#t=e}get(t){return De(this.#a(t)),this.#o.get(t)}has(t){return De(this.#a(t)),this.#o.has(t)}set(t,e){let n=this.#o.get(t);return n&&this.#t.equals(n,e)||(this.#r(t),this.#o.set(t,e)),this}delete(t){return!this.#o.has(t)||(this.#r(t),this.#n.delete(t),this.#o.delete(t))}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}}Object.setPrototypeOf(tn.prototype,WeakMap.prototype);class en{#t;#n;#o;#a(t){let e=this.#n.get(t);return void 0===e&&(e=_e(),this.#n.set(t,e)),e}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#n=new WeakMap,this.#t=e,this.#o=new WeakSet(t)}has(t){return De(this.#a(t)),this.#o.has(t)}add(t){return this.#o.has(t)&&this.#t.equals(t,t)||(this.#o.add(t),this.#r(t)),this}delete(t){return!this.#o.has(t)||(this.#r(t),this.#n.delete(t),this.#o.delete(t))}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}}Object.setPrototypeOf(en.prototype,WeakSet.prototype);const nn=new WeakMap;function rn(t,e,n){let i=void 0===n?nn.get(t):n;if(void 0===i)return;let r=i.get(e);void 0!==r&&ge(r,!0)}function sn(t){let e=nn.get(t);return void 0===e&&(e=new Map,nn.set(t,e)),e}function on(t,e,n){let i=void 0===n?sn(t):n,r=i.get(e);return void 0===r&&(r=_e(),i.set(e,r)),r}function an(t,e){let n=new WeakMap,i="function"==typeof e;return{getter:function(r){let s;return De(on(r,t)),i&&!n.has(r)?(s=e.call(r),n.set(r,s)):s=n.get(r),s},setter:function(e,i){rn(e,t),n.set(e,i)}}}const ln=Symbol("GLIMMER_VALIDATOR_REGISTRATION");if(Reflect.has(globalThis,ln))throw new Error("The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.");Reflect.set(globalThis,ln,!0);const cn=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_CYCLES:void 0,COMPUTE:ue,CONSTANT:0,CONSTANT_TAG:ve,CURRENT_TAG:Ce,CurrentTag:Se,INITIAL:1,VOLATILE:NaN,VOLATILE_TAG:xe,VolatileTag:we,beginTrackFrame:Oe,beginUntrackFrame:Fe,bump:function(){ce++},combine:ke,consumeTag:De,createCache:qe,createTag:ye,createUpdatableTag:_e,debug:{},dirtyTag:ge,dirtyTagFor:rn,endTrackFrame:Ae,endUntrackFrame:Le,getValue:Ve,isConst:$e,isConstTag:be,isTracking:ze,resetTracking:function(){for(;Ie.length>0;)Ie.pop();Me=null},tagFor:on,tagMetaFor:sn,track:Ge,trackedArray:function(t,e){return new Ye(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedData:an,trackedMap:function(t,e){return new Ze(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedObject:function(t,e){return new Je(t??{},{equals:e?.equals??Object.is,description:e?.description})},trackedSet:function(t,e){return new Qe(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedWeakMap:function(t,e){return new tn(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedWeakSet:function(t,e){return new en(t??[],{equals:e?.equals??Object.is,description:e?.description})},untrack:We,updateTag:me,validateTag:de,valueForTag:he},Symbol.toStringTag,{value:"Module"})),un=Object.freeze([]);function hn(){return un}const dn=hn(),pn=hn();function*fn(t){for(let e=t.length-1;e>=0;e--)yield t[e]}function*gn(t){let e=0;for(const n of t)yield[e++,n]}function mn(t){return!!t&&t.length>0}function yn(t){return 0===t.length?void 0:t[t.length-1]}function _n(){return Object.create(null)}function vn(t){return null!=t}function bn(t){return"function"==typeof t||"object"==typeof t&&null!==t}class wn{constructor(t=[]){this.current=null,this.stack=t}get size(){return this.stack.length}push(t){this.current=t,this.stack.push(t)}pop(){let t=this.stack.pop();return this.current=yn(this.stack)??null,void 0===t?null:t}nth(t){let e=this.stack.length;return eqn(t),null,t.debugLabel):t}function jn(t){return 3===t[Tn]}function Nn(t){const e=zn(()=>qn(t),e=>Vn(t,e));return e.debugLabel=t.debugLabel,e[Tn]=3,e}function Un(t){return t.tag===ve}function Bn(t){return null!==t.update}function qn(t){const e=t;let{tag:n}=e;if(n===ve)return e.lastValue;const{lastRevision:i}=e;let r;if(null!==n&&de(n,i))r=e.lastValue;else{const{compute:t}=e,i=Ge(()=>{r=e.lastValue=t()});n=e.tag=i,e.lastRevision=he(i)}return De(n),r}function Vn(t,e){(0,t.update)(e)}function $n(t,e){const n=t,i=n[Tn];let r,s=n.children;if(null===s)s=n.children=new Map;else{const t=s.get(e);if(t)return t}if(2===i){const t=qn(n);r=vn(t)?Ln(t[e]):Mn}else r=zn(()=>{const t=qn(n);if(vn(t))return At(t,e)},t=>{const i=qn(n);if(vn(i))return Ft(i,e,t)});return s.set(e,r),r}function Gn(t,e){let n=t;for(const i of e)n=$n(n,i);return n}const Wn={},Hn=(t,e)=>e,Kn=(t,e)=>String(e),Xn=t=>null===t?Wn:t;class Yn{get weakMap(){return void 0===this._weakMap&&(this._weakMap=new WeakMap),this._weakMap}get primitiveMap(){return void 0===this._primitiveMap&&(this._primitiveMap=new Map),this._primitiveMap}set(t,e){bn(t)?this.weakMap.set(t,e):this.primitiveMap.set(t,e)}get(t){return bn(t)?this.weakMap.get(t):this.primitiveMap.get(t)}}const Zn=new Yn;function Jn(t){let e=new Yn;return(n,i)=>{let r=t(n,i),s=e.get(r)||0;return e.set(r,s+1),0===s?r:function(t,e){let n=Zn.get(t);void 0===n&&(n=[],Zn.set(t,n));let i=n[e];return void 0===i&&(i={value:t,count:e},n[e]=i),i}(r,s)}}function Qn(t,e){return zn(()=>{let n=qn(t),i=function(t){switch(t){case"@key":return Jn(Hn);case"@index":return Jn(Kn);case"@identity":return Jn(Xn);default:return e=t,Jn(t=>Lt(t,e))}var e}(e);if(Array.isArray(n))return new ni(n,i);let r=It(n);return null===r?new ni(un,()=>null):new ei(r,i)})}function ti(t){let e=t,n=ye();return zn(()=>(De(n),e),t=>{e!==t&&(e=t,ge(n))})}class ei{constructor(t,e){this.inner=t,this.keyFor=e}isEmpty(){return this.inner.isEmpty()}next(){let t=this.inner.next();return null!==t&&(t.key=this.keyFor(t.value,t.memo)),t}}let ni=class{constructor(t,e){this.iterator=t,this.keyFor=e,this.pos=0,0===t.length?this.current={kind:"empty"}:this.current={kind:"first",value:t[this.pos]}}isEmpty(){return"empty"===this.current.kind}next(){let t,e=this.current;if("first"===e.kind)this.current={kind:"progress"},t=e.value;else{if(this.pos>=this.iterator.length-1)return null;t=this.iterator[++this.pos]}let{keyFor:n}=this;return{key:n(t,this.pos),value:t,memo:this.pos}}};const ii=Object.freeze(Object.defineProperty({__proto__:null,FALSE_REFERENCE:An,NULL_REFERENCE:In,REFERENCE:Tn,TRUE_REFERENCE:On,UNDEFINED_REFERENCE:Mn,childRefFor:$n,childRefFromParts:Gn,createComputeRef:zn,createConstRef:Fn,createDebugAliasRef:void 0,createInvokableRef:Nn,createIteratorItemRef:ti,createIteratorRef:Qn,createPrimitiveRef:Pn,createReadOnlyRef:Dn,createUnboundRef:Ln,isConstRef:Un,isInvokableRef:jn,isUpdatableRef:Bn,updateRef:Vn,valueForRef:qn},Symbol.toStringTag,{value:"Module"})),ri={Empty:0,dynamicLayout:1,dynamicTag:2,prepareArgs:4,createArgs:8,attributeHook:16,elementHook:32,dynamicScope:64,createCaller:128,updateHook:256,createInstance:512,wrapped:1024,willDestroy:2048,hasSubOwner:4096},si=1024,oi=new WeakMap;function ai(t){return oi.get(t)}function li(t,e){oi.set(t,e)}function ci(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}class ui{constructor(t){this.named=t}get(t,e){const n=this.named[e];if(void 0!==n)return qn(n)}has(t,e){return e in this.named}ownKeys(){return Object.keys(this.named)}isExtensible(){return!1}getOwnPropertyDescriptor(t,e){return{enumerable:!0,configurable:!0}}}class hi{constructor(t){this.positional=t}get(t,e){let{positional:n}=this;if("length"===e)return n.length;const i=ci(e);return null!==i&&i{const{named:e,positional:n}=t,i=new ui(e),r=new hi(n),s=Object.create(null),o=new Proxy(s,i),a=new Proxy([],r);return li(o,(t,n)=>function(t,e){return Ge(()=>{e in t&&qn(t[e])})}(e,n)),li(a,(t,e)=>function(t,e){return Ge(()=>{"[]"===e&&t.forEach(qn);const n=ci(e);null!==n&&n{let i=this.getDelegateFor(n);const r=di(e),s=i.createHelper(t,r);if(vi(i)){let t=zn(()=>i.getValue(s),null);return bi(i)&&Gt(t,i.getDestroyable(s)),t}if(bi(i)){let t=Fn(void 0);return Gt(t,i.getDestroyable(s)),t}return Mn}}}class xi{createHelper(t,e){return{fn:t,args:e}}getValue({fn:t,args:e}){return Object.keys(e.named).length>0?t(...e.positional,e.named):t(...e.positional)}getDebugName(t){return t.name?`(helper function ${t.name})`:"(anonymous helper function)"}constructor(){this.capabilities={hasValue:!0,hasDestroyable:!1,hasScheduledEffect:!1}}}const Si=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ei=Object.getPrototypeOf;function Ti(t,e,n){return t.set(n,e),n}function Ri(t,e){let n=e;for(;null!==n;){const e=t.get(n);if(void 0!==e)return e;n=Ei(n)}}function Pi(t,e){return Ti(Ci,t,e)}function Mi(t){const e=Ri(Ci,t);return void 0===e?null:e}function Ii(t,e){return Ti(ki,t,e)}const Oi=new wi(()=>new xi);function Ai(t){let e=Ri(ki,t);return void 0===e&&"function"==typeof t&&(e=Oi),e||null}function Fi(t,e){return Ti(Si,t,e)}function Li(t){const e=Ri(Si,t);return void 0===e?null:e}function zi(t){return void 0!==Ri(Si,t)}function Di(t){return function(t){return"function"==typeof t}(t)||void 0!==Ri(ki,t)}const ji={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1};function Ni(t,e={}){let n=Boolean(e.updateHook);return{asyncLifeCycleCallbacks:Boolean(e.asyncLifecycleCallbacks),destructor:Boolean(e.destructor),updateHook:n}}function Ui(t){return t.capabilities.asyncLifeCycleCallbacks}function Bi(t){return t.capabilities.updateHook}class qi{constructor(t){this.factory=t,this.componentManagerDelegates=new WeakMap}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:i}=this;n=i(t),e.set(t,n)}return n}create(t,e,n){let i=this.getDelegateFor(t),r=di(n.capture()),s=i.createComponent(e,r);return new Vi(s,i,r)}getDebugName(t){return"function"==typeof t?t.name:t.toString()}update(t){let{delegate:e}=t;if(Bi(e)){let{component:n,args:i}=t;e.updateComponent(n,i)}}didCreate({component:t,delegate:e}){Ui(e)&&e.didCreateComponent(t)}didUpdate({component:t,delegate:e}){(function(t){return Ui(t)&&Bi(t)})(e)&&e.didUpdateComponent(t)}didRenderLayout(){}didUpdateLayout(){}getSelf({component:t,delegate:e}){return Fn(e.getContext(t))}getDestroyable(t){const{delegate:e}=t;if(function(t){return t.capabilities.destructor}(e)){const{component:n}=t;return Wt(t,()=>e.destroyComponent(n)),t}return null}getCapabilities(){return ji}}class Vi{constructor(t,e,n){this.component=t,this.delegate=e,this.args=n}}function $i(t,e={}){return{disableAutoTracking:Boolean(e.disableAutoTracking)}}class Gi{constructor(t){this.factory=t,this.componentManagerDelegates=new WeakMap}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:i}=this;n=i(t),e.set(t,n)}return n}create(t,e,n,i){let r,s=this.getDelegateFor(t),o=di(i),a=s.createModifier(n,o);return r={tag:_e(),element:e,delegate:s,args:o,modifier:a},Wt(r,()=>s.destroyModifier(a,o)),r}getDebugName(t){return"function"==typeof t?t.name||t.toString():""}getDebugInstance({modifier:t}){return t}getTag({tag:t}){return t}install({element:t,args:e,modifier:n,delegate:i}){let{capabilities:r}=i;r.disableAutoTracking?We(()=>i.installModifier(n,t,e)):i.installModifier(n,t,e)}update({args:t,modifier:e,delegate:n}){let{capabilities:i}=n;i.disableAutoTracking?We(()=>n.updateModifier(e,t)):n.updateModifier(e,t)}getDestroyable(t){return t}}function Wi(t,e){return Fi(new qi(t),e)}function Hi(t,e){return Pi(new Gi(t),e)}function Ki(t,e){return Ii(new wi(t),e)}const Xi=new WeakMap,Yi=Reflect.getPrototypeOf;function Zi(t,e){return Xi.set(e,t),e}function Ji(t){let e=t;for(;null!==e;){let t=Xi.get(e);if(void 0!==t)return t;e=Yi(e)}}const Qi=Object.freeze(Object.defineProperty({__proto__:null,CustomComponentManager:qi,CustomHelperManager:wi,CustomModifierManager:Gi,capabilityFlagsFrom:fi,componentCapabilities:Ni,getComponentTemplate:Ji,getCustomTagFor:ai,getInternalComponentManager:Li,getInternalHelperManager:Ai,getInternalModifierManager:Mi,hasCapability:yi,hasDestroyable:bi,hasInternalComponentManager:zi,hasInternalHelperManager:Di,hasInternalModifierManager:function(t){return void 0!==Ri(Ci,t)},hasValue:vi,helperCapabilities:_i,managerHasCapability:mi,modifierCapabilities:$i,setComponentManager:Wi,setComponentTemplate:Zi,setCustomTagFor:li,setHelperManager:Ki,setInternalComponentManager:Fi,setInternalHelperManager:Ii,setInternalModifierManager:Pi,setModifierManager:Hi},Symbol.toStringTag,{value:"Module"})),tr=new WeakSet;function er(t){return!!H(t)&&tr.has(t)}function nr(t){H(t)&&tr.add(t)}const ir=new WeakSet;function rr(t){return ir.has(t)}let sr=class{size=0;misses=0;hits=0;constructor(t,e,n=new Map){this.limit=t,this.func=e,this.store=n}get(t){return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,this.set(t,this.func(t)))}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}};const or="6.11.0-beta.1",ar=Object.freeze(Object.defineProperty({__proto__:null,default:or},Symbol.toStringTag,{value:"Module"})),lr=Symbol("OWNER");function cr(t){return t[lr]}function ur(t){return cr(t)}function hr(t,e){!function(t,e){t[lr]=e}(t,e)}function dr(t,e){return Array.isArray(t)?t[e]:t.objectAt(e)}const pr=kt("SELF_TAG");function fr(t,e,n=!1,i){let r=ai(t);return void 0!==r?r(t,e,n):on(t,e,i)}function gr(t){return H(t)?on(t,pr):ve}function mr(t,e){rn(t,e),rn(t,pr)}const yr=new WeakSet;function _r(t,e,n){let i=t.readableLazyChainsFor(e);if(void 0!==i){if(H(n))for(let[t,e]of i)me(t,br(n,e,sn(n),oe(n)));i.length=0}}function vr(t,e,n,i){let r=[];for(let s of e)wr(r,t,s,n,i);return ke(r)}function br(t,e,n,i){return ke(wr([],t,e,n,i))}function wr(t,e,n,i,r){let s,o,a=e,l=i,c=r,u=n.length,h=-1;for(;;){let e=h+1;if(h=n.indexOf(".",e),-1===h&&(h=u),s=n.slice(e,h),"@each"===s&&h!==u){e=h+1,h=n.indexOf(".",e);let i=a.length;if("number"!=typeof i||!Array.isArray(a)&&!("objectAt"in a))break;if(0===i){t.push(fr(a,"[]"));break}s=-1===h?n.slice(e):n.slice(e,h);for(let e=0;e=0;s-=3){let r=i[s],o=i[s+1],a=i[s+2];if(!o)continue;a&&Nr(t,e,r,o),r||(r=t);let l=typeof o;"string"!==l&&"symbol"!==l||(o=r[o]),o.apply(r,n)}return!0}function Br(t,e){let n=oe(t);if(null===n)return!1;let i=n.matchingListeners(e);return void 0!==i&&i.length>0}function qr(...t){let e=t.pop();return ft(e,t),e}const Vr=!g._DEFAULT_ASYNC_OBSERVERS,$r=new Map,Gr=new Map;function Wr(t,e,n,i,r=Vr){let s=Dr(e);jr(t,s,n,i,!1,r);let o=oe(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||Kr(t,s,r)}function Hr(t,e,n,i,r=Vr){let s=Dr(e),o=oe(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||Zr(t,s,r),Nr(t,s,n,i)}function Kr(t,e,n=!1){let i=function(t,e){let n=!0===e?$r:Gr;return n.has(t)||(n.set(t,new Map),Wt(t,()=>function(t){$r.size>0&&$r.delete(t),Gr.size>0&&Gr.delete(t)}(t),!0)),n.get(t)}(t,n);if(i.has(e))i.get(e).count++;else{let n=e.substring(0,e.lastIndexOf(":")),r=br(t,n,sn(t),oe(t));i.set(e,{count:1,path:n,tag:r,lastRevision:he(r),suspended:!1})}}let Xr=!1,Yr=[];function Zr(t,e,n=!1){if(!0===Xr)return void Yr.push([t,e,n]);let i=!0===n?$r:Gr,r=i.get(t);if(void 0!==r){let n=r.get(e);n.count--,0===n.count&&(r.delete(e),0===r.size&&i.delete(t))}}function Jr(t){Gr.has(t)&&Gr.get(t).forEach(e=>{e.tag=br(t,e.path,sn(t),oe(t)),e.lastRevision=he(e.tag)}),$r.has(t)&&$r.get(t).forEach(e=>{e.tag=br(t,e.path,sn(t),oe(t)),e.lastRevision=he(e.tag)})}let Qr=0;function ts(t){let e=he(Ce);Qr!==e&&(Qr=e,Gr.forEach((e,n)=>{let i=oe(n);e.forEach((e,r)=>{if(!de(e.tag,e.lastRevision)){let s=()=>{try{Ur(n,r,[n,e.path],void 0,i)}finally{e.tag=br(n,e.path,sn(n),oe(n)),e.lastRevision=he(e.tag)}};t?t("actions",s):s()}})}))}function es(){$r.forEach((t,e)=>{let n=oe(e);t.forEach((t,i)=>{if(!t.suspended&&!de(t.tag,t.lastRevision))try{t.suspended=!0,Ur(e,i,[e,t.path],void 0,n)}finally{t.tag=br(e,t.path,sn(e),oe(e)),t.lastRevision=he(t.tag),t.suspended=!1}})})}function ns(t,e,n){let i=$r.get(t);if(!i)return;let r=i.get(Dr(e));r&&(r.suspended=n)}const is=Symbol("PROPERTY_DID_CHANGE");let rs=0;function ss(t,e,n,i){let r=void 0===n?oe(t):n;null!==r&&(r.isInitializing()||r.isPrototypeMeta(t))||(mr(t,e),rs<=0&&es(),is in t&&(4===arguments.length?t[is](e,i):t[is](e)))}function os(){rs++,Xr=!0}function as(){rs--,rs<=0&&(es(),function(){Xr=!1;for(let[t,e,n]of Yr)Zr(t,e,n);Yr=[]}())}function ls(t){os();try{t()}finally{as()}}function cs(){}class us extends Cr{_readOnly=!1;_hasConfig=!1;_getter=void 0;_setter=void 0;constructor(t){super();let e=t[t.length-1];if("function"==typeof e||null!==e&&"object"==typeof e){this._hasConfig=!0;let e=t.pop();if("function"==typeof e)this._getter=e;else{const t=e;this._getter=t.get||cs,this._setter=t.set}}t.length>0&&this._property(...t)}setup(t,e,n,i){if(super.setup(t,e,n,i),!1===this._hasConfig){let{get:t,set:e}=n;void 0!==t&&(this._getter=t),void 0!==e&&(this._setter=function(n,i){let r=e.call(this,i);return void 0!==t&&void 0===r?t.call(this):r})}}_property(...t){let e=[];function n(t){e.push(t)}for(let i of t)Lr(i,n);this._dependentKeys=e}get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r),o=i.revisionFor(e);if(void 0!==o&&de(s,o))n=i.valueFor(e);else{let{_getter:o,_dependentKeys:a}=this;We(()=>{n=o.call(t,e)}),void 0!==a&&me(s,vr(t,a,r,i)),i.setValueFor(e,n),i.setRevisionFor(e,he(s)),_r(i,e,n)}return De(s),Array.isArray(n)&&De(on(n,"[]")),n}set(t,e,n){this._readOnly&&this._throwReadOnlyError(t,e);let i,r=ae(t);r.isInitializing()&&void 0!==this._dependentKeys&&this._dependentKeys.length>0&&"function"==typeof t[is]&&t.isComponent&&Wr(t,e,()=>{t[is](e)},void 0,!0);try{os(),i=this._set(t,e,n,r),_r(r,e,i);let s=sn(t),o=on(t,e,s),{_dependentKeys:a}=this;void 0!==a&&me(o,vr(t,a,s,r)),r.setRevisionFor(e,he(o))}finally{as()}return i}_throwReadOnlyError(t,e){throw new Error(`Cannot set read-only property "${e}" on object: ${M(t)}`)}_set(t,e,n,i){let r,s=void 0!==i.revisionFor(e),o=i.valueFor(e),{_setter:a}=this;ns(t,e,!0);try{r=a.call(t,e,n,o)}finally{ns(t,e,!1)}return s&&o===r||(i.setValueFor(e,r),ss(t,e,i,n)),r}teardown(t,e,n){void 0!==n.revisionFor(e)&&(n.setRevisionFor(e,void 0),n.setValueFor(e,void 0)),super.teardown(t,e,n)}}class hs extends us{get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r),o=i.revisionFor(e);if(void 0!==o&&de(s,o))n=i.valueFor(e);else{let{_getter:r}=this,o=Ge(()=>{n=r.call(t,e)});me(s,o),i.setValueFor(e,n),i.setRevisionFor(e,he(s)),_r(i,e,n)}return De(s),Array.isArray(n)&&De(on(n,"[]",r)),n}}class ds extends Function{readOnly(){return Ir(this)._readOnly=!0,this}meta(t){let e=Ir(this);return 0===arguments.length?e._meta||{}:(e._meta=t,this)}get _getter(){return Ir(this)._getter}set enumerable(t){Ir(this).enumerable=t}}function ps(...t){return xr(t)?Rr(new us([]),ds)(t[0],t[1],t[2]):Rr(new us(t),ds)}function fs(...t){return Rr(new hs(t),ds)}function gs(t,e){return Boolean(Mr(t,e))}function ms(t,e,n,i,r){let s=void 0===r?ae(t):r,o=Mr(t,e,s),a=void 0!==o;a&&o.teardown(t,e,s),Or(n)?ys(t,e,n,s):null==n?_s(t,e,i,a,!0):Object.defineProperty(t,e,n),s.isPrototypeMeta(t)||Jr(t)}function ys(t,e,n,i){let r;return r=n(t,e,void 0,i),Object.defineProperty(t,e,r),n}function _s(t,e,n,i,r=!0){return!0===i||!1===r?Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n}):t[e]=n,n}const vs=new sr(1e3,t=>t.indexOf("."));function bs(t){return"string"==typeof t&&-1!==vs.get(t)}const ws=kt("PROXY_CONTENT");function xs(t){return"object"==typeof t&&null!==t&&"function"==typeof t.unknownProperty}function Ss(t,e){return bs(e)?ks(t,e):Cs(t,e)}function Cs(t,e){if(null==t)return;let n;return"object"==typeof t||"function"==typeof t?(n=t[e],void 0===n&&"object"==typeof t&&!(e in t)&&xs(t)&&(n=t.unknownProperty(e)),ze()&&(De(on(t,e)),(Array.isArray(n)||rr(n))&&De(on(n,"[]")))):n=t[e],n}function ks(t,e,n){let i="string"==typeof e?e.split("."):e;for(let r of i){if(null==t||t.isDestroyed)return;if(n&&("__proto__"===r||"constructor"===r))return;t=Cs(t,r)}return t}Cs("foo","a"),Cs("foo",1),Cs({},"a"),Cs({},1),Cs({unknownProperty(){}},"a"),Cs({unknownProperty(){}},1),Ss({},"foo"),Ss({},"foo.bar");let Es={};nr(Es),Ge(()=>Cs({},"a")),Ge(()=>Cs({},1)),Ge(()=>Cs({a:[]},"a")),Ge(()=>Cs({a:Es},"a"));class Ts{_registry;_coreLibIndex;constructor(){this._registry=[],this._coreLibIndex=0}_getLibraryByName(t){let e=this._registry;for(let n of e)if(n.name===t)return n}register(t,e,n){let i=this._registry.length;this._getLibraryByName(t)||(n&&(i=this._coreLibIndex++),this._registry.splice(i,0,{name:t,version:e}))}registerCoreLibrary(t,e){this.register(t,e,!0)}deRegister(t){let e,n=this._getLibraryByName(t);n&&(e=this._registry.indexOf(n),this._registry.splice(e,1))}}const Rs=new Ts;let Ps;function Ms(t,...e){let n,i;xr(e)?n=e:"string"==typeof e[0]&&(i=e[0]);let r=ps({get:function(e){return(ur(this)||this.container).lookup(`${t}:${i||e}`)},set(t,e){ms(this,t,null,e)}});return n?r(n[0],n[1],n[2]):r}function Is(...t){if(!xr(t)){let e=t[0],n=e?e.initializer:void 0,i=e?e.value:void 0,r=function(t,e){return Os([t,e,{initializer:n||(()=>i)}])};return Ar(r),r}return Os(t)}function Os([t,e,n]){let{getter:i,setter:r}=an(e,n?n.initializer:void 0);function s(){let t=i(this);return(Array.isArray(t)||rr(t))&&De(on(t,"[]")),t}function o(t){r(this,t),rn(this,pr)}let a={enumerable:!0,configurable:!0,isTracked:!0,get:s,set:o};return Tr.add(o),ae(t).writeDescriptors(e,new As(s,o)),a}Rs.registerCoreLibrary("Ember",or);class As{constructor(t,e){this._get=t,this._set=e,yr.add(this)}get(t){return this._get.call(t)}set(t,e,n){this._set.call(t,n)}}function Fs(t,e){let n=oe(t);return n?n.valueFor(e):void 0}function Ls(t,e,n,i){return t.isDestroyed?n:bs(e)?function(t,e,n,i){let r=e.split("."),s=r.pop(),o=ks(t,r,!0);if(null!=o)return Ls(o,s,n);if(!i)throw new Error(`Property set failed: object in path "${r.join(".")}" could not be found.`)}(t,e,n,i):zs(t,e,n)}function zs(t,e,n){let i,r=_t(t,e);return null!==r&&Tr.has(r.set)?(t[e]=n,n):(i=t[e],void 0!==i||"object"!=typeof t||e in t||"function"!=typeof t.setUnknownProperty?(t[e]=n,i!==n&&ss(t,e)):t.setUnknownProperty(e,n),n)}function Ds(t,e,n){return Ls(t,e,n,!0)}function js(t){return Rr(new Us(t),Ns)}class Ns extends Function{readOnly(){return Ir(this).readOnly(),this}oneWay(){return Ir(this).oneWay(),this}meta(t){let e=Ir(this);if(0===arguments.length)return e._meta||{};e._meta=t}}class Us extends Cr{altKey;constructor(t){super(),this.altKey=t}setup(t,e,n,i){super.setup(t,e,n,i),yr.add(this)}get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r);We(()=>{n=Ss(t,this.altKey)});let o=i.revisionFor(e);return void 0!==o&&de(s,o)||(me(s,br(t,this.altKey,r,i)),i.setRevisionFor(e,he(s)),_r(i,e,n)),De(s),n}set(t,e,n){return Ls(t,this.altKey,n)}readOnly(){this.set=Bs}oneWay(){this.set=qs}}function Bs(t,e){throw new Error(`Cannot set read-only property '${e}' on object: ${M(t)}`)}function qs(t,e,n){return ms(t,e,null),Ls(t,e,n)}function Vs(t,e,n,i){return void 0===e?(e=0,n=i=-1):(void 0===n&&(n=-1),void 0===i&&(i=-1)),Ur(t,"@array:before",[t,e,n,i]),t}function $s(t,e,n,i,r=!0){void 0===e?(e=0,n=i=-1):(void 0===n&&(n=-1),void 0===i&&(i=-1));let s=oe(t);if(r&&((i<0||n<0||i-n!==0)&&ss(t,"length",s),ss(t,"[]",s)),Ur(t,"@array:change",[t,e,n,i]),null!==s){let r=-1===n?0:n,o=t.length-((-1===i?0:i)-r),a=e<0?o+e:e;void 0!==s.revisionFor("firstObject")&&0===a&&ss(t,"firstObject",s),void 0!==s.revisionFor("lastObject")&&o-1{let n=Object.keys(e);for(let i of n)Ls(t,i,e[i])}),e}const to=new WeakMap;function eo(t,e){H(t)&&to.set(t,e)}function no(t){return to.get(t)}const io=Object.prototype.hasOwnProperty;let ro=!1;const so={_set:0,_unprocessedNamespaces:!1,get unprocessedNamespaces(){return this._unprocessedNamespaces},set unprocessedNamespaces(t){this._set++,this._unprocessedNamespaces=t}};let oo=!1;const ao=[],lo=Object.create(null);function co(t){so.unprocessedNamespaces=!0,ao.push(t)}function uo(t){let e=no(t);delete lo[e],ao.splice(ao.indexOf(t),1),e in d.lookup&&t===d.lookup[e]&&(d.lookup[e]=void 0)}function ho(){if(!so.unprocessedNamespaces)return;let t=d.lookup,e=Object.keys(t);for(let n of e){if(!wo(n.charCodeAt(0)))continue;let e=xo(t,n);e&&eo(e,n)}}function po(t){return ro||go(),lo[t]}function fo(t){vo([t.toString()],t,new Set)}function go(){let t=so.unprocessedNamespaces;if(t&&(ho(),so.unprocessedNamespaces=!1),t||oo){let t=ao;for(let e of t)fo(e);oo=!1}}function mo(){return ro}function yo(t){ro=Boolean(t)}function _o(){oo=!0}function vo(t,e,n){let i=t.length,r=t.join(".");lo[r]=e,eo(e,r);for(let s in e){if(!io.call(e,s))continue;let r=e[s];if(t[i]=s,r&&void 0===no(r))eo(r,t.join("."));else if(r&&bo(r)){if(n.has(r))continue;n.add(r),vo(t,r,n)}}t.length=i}function bo(t){return null!=t&&"object"==typeof t&&t.isNamespace}function wo(t){return t>=65&&t<=90}function xo(t,e){try{let n=t[e];return(null!==n&&"object"==typeof n||"function"==typeof n)&&n.isNamespace&&n}catch(n){}}let So;const Co={get onerror(){return So}},ko=setTimeout,Eo=()=>{};function To(t){if("function"==typeof Promise){const e=Promise.resolve();return()=>e.then(t)}if("function"==typeof MutationObserver){let e=0,n=new MutationObserver(t),i=document.createTextNode("");return n.observe(i,{characterData:!0}),()=>(e=++e%2,i.data=""+e,e)}return()=>ko(t,0)}function Ro(t){let e=Eo;return{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),now:()=>Date.now(),next:To(t),clearNext:e}}const Po=/\d+/;function Mo(t){let e=typeof t;return"number"===e&&t==t||"string"===e&&Po.test(t)}function Io(t){return t.onError||t.onErrorTarget&&t.onErrorTarget[t.onErrorMethod]}function Oo(t,e,n){let i=-1;for(let r=0,s=n.length;r=e[n]?r=n+6:s=n;return t>=e[r]?r+6:r}class zo{constructor(t,e={},n={}){this._queueBeingFlushed=[],this.targetQueues=new Map,this.index=0,this._queue=[],this.name=t,this.options=e,this.globalOptions=n}stackFor(t){if(t0){let t=Io(this.globalOptions);s=t?this.invokeWithOnError:this.invoke;for(let o=this.index;o0&&this.flush(!0)}hasWork(){return this._queueBeingFlushed.length>0||this._queue.length>0}cancel({target:t,method:e}){let n=this._queue,i=this.targetQueues.get(t);void 0!==i&&i.delete(e);let r=Oo(t,e,n);return r>-1?(n[r+1]=null,!0):(n=this._queueBeingFlushed,r=Oo(t,e,n),r>-1&&(n[r+1]=null,!0))}push(t,e,n,i){return this._queue.push(t,e,n,i),{queue:this,target:t,method:e}}pushUnique(t,e,n,i){let r=this.targetQueues.get(t);void 0===r&&(r=new Map,this.targetQueues.set(t,r));let s=r.get(e);if(void 0===s){let s=this._queue.push(t,e,n,i)-4;r.set(e,s)}else{let t=this._queue;t[s+2]=n,t[s+3]=i}return{queue:this,target:t,method:e}}_getDebugInfo(t){if(t)return Fo(this._queue,4)}invoke(t,e,n){void 0===n?e.call(t):e.apply(t,n)}invokeWithOnError(t,e,n,i,r){try{void 0===n?e.call(t):e.apply(t,n)}catch(Fj){i(Fj,r)}}}class Do{constructor(t=[],e){this.queues={},this.queueNameIndex=0,this.queueNames=t,t.reduce(function(t,n){return t[n]=new zo(n,e[n],e),t},this.queues)}schedule(t,e,n,i,r,s){let o=this.queues[t];if(void 0===o)throw new Error(`You attempted to schedule an action in a queue (${t}) that doesn't exist`);if(null==n)throw new Error(`You attempted to schedule an action in a queue (${t}) for a method that doesn't exist`);return this.queueNameIndex=0,r?o.pushUnique(e,n,i,s):o.push(e,n,i,s)}flush(t=!1){let e,n,i=this.queueNames.length;for(;this.queueNameIndexr){let e=i-r;t=new Array(e);for(let n=0;n{aa++,!1!==this._autorun&&(this._autorun=!1,this._autorunStack=null,this._end(!0))};let n=this.options._buildPlatform||Ro;this._platform=n(this._boundAutorunEnd)}get counters(){return{begin:$o,end:Go,events:{begin:Wo,end:0},autoruns:{created:oa,completed:aa},run:Ho,join:Ko,defer:Xo,schedule:Yo,scheduleIterable:Zo,deferOnce:Jo,scheduleOnce:Qo,setTimeout:ta,later:ea,throttle:na,debounce:ia,cancelTimers:ra,cancel:sa,loops:{total:la,nested:ca}}}get defaultQueue(){return this._defaultQueue}begin(){$o++;let t,e=this.options,n=this.currentInstance;return!1!==this._autorun?(t=n,this._cancelAutorun()):(null!==n&&(ca++,this.instanceStack.push(n)),la++,t=this.currentInstance=new Do(this.queueNames,e),Wo++,this._trigger("begin",t,n)),this._onBegin(t,n),t}end(){Go++,this._end(!1)}on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=this._eventCallbacks[t];if(void 0===n)throw new TypeError(`Cannot on() event ${t} because it does not exist`);n.push(e)}off(t,e){let n=this._eventCallbacks[t];if(!t||void 0===n)throw new TypeError(`Cannot off() event ${t} because it does not exist`);let i=!1;if(e)for(let r=0;r0&&Mo(n[r-1])&&(i=parseInt(n.pop(),10)),[t,e,n,i]}(...arguments);return this._later(t,e,n,i)}throttle(){na++;let t,[e,n,i,r,s=!0]=qo(...arguments),o=Ao(e,n,this._timers);if(-1===o)t=this._later(e,n,s?Uo:i,r),s&&this._join(e,n,i);else{t=this._timers[o+1];let e=o+4;this._timers[e]!==Uo&&(this._timers[e]=i)}return t}debounce(){ia++;let t,[e,n,i,r,s=!1]=qo(...arguments),o=this._timers,a=Ao(e,n,o);if(-1===a)t=this._later(e,n,s?Uo:i,r),s&&this._join(e,n,i);else{let s=this._platform.now()+r,l=a+4;o[l]===Uo&&(i=Uo),t=o[a+1];let c=Lo(s,o);if(a+6===c)o[a]=s,o[l]=i;else{let r=this._timers[a+5];this._timers.splice(c,0,s,t,e,n,i,r),this._timers.splice(a,6)}0===a&&this._reinstallTimerTimeout()}return t}cancelTimers(){ra++,this._clearTimerTimeout(),this._timers=[],this._cancelAutorun()}hasTimers(){return this._timers.length>0||this._autorun}cancel(t){if(sa++,null==t)return!1;let e=typeof t;return"number"===e?this._cancelLaterTimer(t):!("object"!==e||!t.queue||!t.method)&&t.queue.cancel(t)}ensureInstance(){this._ensureInstance()}getDebugInfo(){if(this.DEBUG)return{autorun:this._autorunStack,counters:this.counters,timers:Fo(this._timers,6,2),instanceStack:[this.currentInstance,...this.instanceStack].map(t=>t&&t._getDebugInfo(this.DEBUG))}}_end(t){let e=this.currentInstance,n=null;if(null===e)throw new Error("end called without begin");let i,r=!1;try{i=e.flush(t)}finally{if(!r)if(r=!0,1===i){const t=this.queueNames[e.queueNameIndex];this._scheduleAutorun(t)}else this.currentInstance=null,this.instanceStack.length>0&&(n=this.instanceStack.pop(),this.currentInstance=n),this._trigger("end",e,n),this._onEnd(e,n)}}_join(t,e,n){return null===this.currentInstance?this._run(t,e,n):void 0===t&&void 0===n?e():e.apply(t,n)}_run(t,e,n){let i=Io(this.options);if(this.begin(),i)try{return e.apply(t,n)}catch(Fj){i(Fj)}finally{this.end()}else try{return e.apply(t,n)}finally{this.end()}}_cancelAutorun(){this._autorun&&(this._platform.clearNext(),this._autorun=!1,this._autorunStack=null)}_later(t,e,n,i){let r=this.DEBUG?new Error:void 0,s=this._platform.now()+i,o=Vo++;if(0===this._timers.length)this._timers.push(s,o,t,e,n,r),this._installTimerTimeout();else{let i=Lo(s,this._timers);this._timers.splice(i,0,s,o,t,e,n,r),this._reinstallTimerTimeout()}return o}_cancelLaterTimer(t){for(let e=1;e0&&(this.begin(),this._scheduleExpiredTimers(),this.end())}_scheduleExpiredTimers(){let t=this._timers,e=0,n=t.length,i=this._defaultQueue,r=this._platform.now();for(;er);e+=6){let n=t[e+4];if(n!==Uo){let r=t[e+2],s=t[e+3],o=t[e+5];this.currentInstance.schedule(i,r,s,n,!1,o)}}t.splice(0,e),this._installTimerTimeout()}_reinstallTimerTimeout(){this._clearTimerTimeout(),this._installTimerTimeout()}_clearTimerTimeout(){null!==this._timerTimeoutId&&(this._platform.clearTimeout(this._timerTimeoutId),this._timerTimeoutId=null)}_installTimerTimeout(){if(0===this._timers.length)return;let t=this._timers[0],e=this._platform.now(),n=Math.max(0,t-e);this._timerTimeoutId=this._platform.setTimeout(this._boundRunExpiredTimers,n)}_ensureInstance(){let t=this.currentInstance;return null===t&&(this._autorunStack=this.DEBUG?new Error:void 0,t=this.begin(),this._scheduleAutorun(this.queueNames[0])),t}_scheduleAutorun(t){oa++;const e=this._platform.next,n=this.options.flush;n?n(t,e):e(),this._autorun=!0}}ua.Queue=zo,ua.buildPlatform=Ro,ua.buildNext=To;let ha=null;function da(){return ha}const pa=`${Math.random()}${Date.now()}`.replace(".",""),fa=["actions","routerTransitions","render","afterRender","destroy",pa],ga=new ua(fa,{defaultQueue:"actions",onBegin:function(t){ha=t},onEnd:function(t,e){ha=e,ts(va)},onErrorTarget:Co,onErrorMethod:"onerror",flush:function(t,e){"render"!==t&&t!==pa||ts(va),e()}});function ma(...t){return ga.run(...t)}function ya(t,e,...n){return ga.join(t,e,...n)}function _a(...t){return(...e)=>ya(...t.concat(e))}function va(...t){return ga.schedule(...t)}function ba(...t){return ga.scheduleOnce("actions",...t)}function wa(...t){return ga.scheduleOnce(...t)}function xa(...t){return ga.later(...t,1)}function Sa(t){return ga.cancel(t)}function Ca(...t){return ga.debounce(...t)}const ka=Object.freeze(Object.defineProperty({__proto__:null,_backburner:ga,_cancelTimers:function(){ga.cancelTimers()},_getCurrentRunLoop:da,_hasScheduledTimers:function(){return ga.hasTimers()},_queues:fa,_rsvpErrorQueue:pa,begin:function(){ga.begin()},bind:_a,cancel:Sa,debounce:Ca,end:function(){ga.end()},join:ya,later:function(...t){return ga.later(...t)},next:xa,once:ba,run:ma,schedule:va,scheduleOnce:wa,throttle:function(...t){return ga.throttle(...t)}},Symbol.toStringTag,{value:"Module"})),Ea="@warp-drive/core",Ta=globalThis;Ta.__warpDrive_universalCache=Ta.__warpDrive_universalCache??{},Ta[Ea]=Ta[Ea]??{__version:"5.8.1"};const Ra=Ta[Ea],Pa=Ra.__warpDrive_ModuleScopedCaches??{};if(Ra.__warpDrive_hasOtherCopy)throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");function Ma(t,e){return e}function Ia(t){return Pa[`(transient) ${t}`]??null}Ra.__warpDrive_hasOtherCopy=!0;const Oa=new WeakMap;function Aa(t,e){Oa.set(t,e)}const Fa=Ma(0,Symbol("#[]"));function La(t,e){return Ia("signalHooks").createSignal(t,e)}const za={};function Da(t){return"object"==typeof t&&null!==t&&Object.getPrototypeOf(t)===za}const ja=Ma(0,Symbol("Signals"));function Na(t){return t[ja]||function(t){t[ja]=new Map}(t),t[ja]}function Ua(t,e,n,i){const r={key:n,context:e,signal:La(e,n),value:Da(i)?i.value.call(e):i,isStale:!1};return t.set(n,r),r}function Ba(t,e){return t?.get(e)}function qa(t,e){return{enumerable:!0,configurable:!1,get(){const n=function(t,e,n,i){let r=Ba(t,n);return r||(r=Ua(t,e,n,i)),s=r.signal,Ia("signalHooks").consumeSignal(s),r;var s}(Na(this),this,t,e);return n.isStale=!1,n.value},set(n){const i=function(t,e,n,i){let r=Ba(t,n);return r||(r=Ua(t,e,n,i)),r}(Na(this),this,t,e);var r;i.value!==n&&(i.value=n,(r=i)&&(r.isStale=!0,function(t){Ia("signalHooks").notifySignal(t)}(r.signal)))}}}function Va(t,e,n){Object.defineProperty(t,e,qa(e,n))}function $a(t,e,n){const i=qa(e,n);i.enumerable=!1,Object.defineProperty(t,e,i)}function Ga(t,e,n){const i=n.get;return n.get=function(){const t=Na(this);let n=t.get(e);return n||(n=function(t,e,n,i){{const r=function(t,e,n){return Ia("signalHooks").createMemo(t,e,n)}(e,n,i);return t.set(n,r),r}}(t,this,e,i.bind(this))),n()},n}const Wa=new WeakMap;function Ha(t){return t instanceof DOMException&&"AbortError"===t.name}class Ka{_stream=null;_future;_triggered=!1;_trigger(){if(this._triggered)return;this._triggered=!0;const t=this._future.getStream();t.sizeHint&&(this._sizeHint=t.sizeHint),this.promise=t.then(t=>t?async function(t,e){const n=e,i=t.getReader();let r=0,s=null!==n._stream&&n._stream.readable.locked,o=s,a=n._stream?.writable.getWriter();const l=[];for(n._isPending=!1,n._isStarted=!0,n._startTime=performance.now();;){const{value:t,done:e}=await i.read();if(e)break;if(r+=t.byteLength,n._bytesLoaded=r,n._lastPacketTime=performance.now(),s=s||null!==n._stream&&n._stream.readable.locked,s){if(!o){o=!0,a=n._stream.writable.getWriter();for(const t of l)await a.ready,await a.write(t);l.length=0}await a.ready,await a.write(t)}else l.push(t)}o?(await a.ready,await a.close()):n._stream&&(await n._stream.readable.cancel("The Stream Has Already Ended"),n._stream=null);const c=performance.now();n._endTime=c,n._isComplete=!0,n._isStarted=!1}(t,this):(this._isPending=!1,void(this._isComplete=!0)),t=>{this._isPending=!1,this._isStarted=!1,Ha(t)&&(this._isCancelled=!0,this._isComplete=!0),this._isErrored=!0,this._error=t})}promise=null;get isPending(){return this._trigger(),this._isPending}get sizeHint(){return this._trigger(),this._sizeHint}get stream(){if(this._trigger(),!this._stream){if(this._isComplete||this._isCancelled||this._isErrored)return null;this._stream=new TransformStream}return this._stream.readable}get isStarted(){return this._trigger(),this._isStarted}get bytesLoaded(){return this._trigger(),this._bytesLoaded}get startTime(){return this._trigger(),this._startTime}get endTime(){return this._trigger(),this._endTime}get lastPacketTime(){return this._trigger(),this._lastPacketTime}get isComplete(){return this._trigger(),this._isComplete}get isCancelled(){return this._trigger(),this._isCancelled}get isErrored(){return this._trigger(),this._isErrored}get error(){return this._trigger(),this._error}get elapsedTime(){return(this.endTime||this.lastPacketTime)-this.startTime}get completedRatio(){return this.sizeHint?this.bytesLoaded/this.sizeHint:0}get remainingRatio(){return 1-this.completedRatio}get duration(){return this.endTime-this.startTime}get speed(){return this.bytesLoaded/(this.elapsedTime/1e3)}constructor(t){this._future=t}abort=()=>{this._future.abort()}}$a(Ka.prototype,"_isPending",!0),$a(Ka.prototype,"_isStarted",!1),$a(Ka.prototype,"_isComplete",!1),$a(Ka.prototype,"_isCancelled",!1),$a(Ka.prototype,"_isErrored",!1),$a(Ka.prototype,"_error",null),$a(Ka.prototype,"_sizeHint",0),$a(Ka.prototype,"_bytesLoaded",0),$a(Ka.prototype,"_startTime",0),$a(Ka.prototype,"_endTime",0),$a(Ka.prototype,"_lastPacketTime",0);const Xa={};function Ya(t,e,n){const i=Object.assign({},e),r=Object.assign({},i.cacheOptions);return n?r.reload=!0:!1===n?(delete r.reload,r.backgroundReload=!0):(delete r.backgroundReload,delete r.reload),i.cacheOptions=r,t.request(i)}function Za(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}Va(Xa,"reason",null),Va(Xa,"value",null),Va(Xa,"result",null),Va(Xa,"error",null),Va(Xa,"status","pending"),Va(Xa,"isPending",!0),Va(Xa,"isLoading",!0),Va(Xa,"isSuccess",!1),Va(Xa,"isError",!1),Va(Xa,"request",null),Va(Xa,"response",null),Object.defineProperty(Xa,"isCancelled",{get(){return this.isError&&Ha(this.reason)}}),Object.defineProperty(Xa,"loadingState",{get(){return this._loadingState||(this._loadingState=new Ka(this._request)),this._loadingState}});const Ja=Symbol.dispose||Symbol.for("dispose");class Qa{_requester;constructor(t,e){this._args=e,this.store=t,this._subscribedTo=null,this._subscription=null,this._intervalStart=null,this._invalidated=!1,this._nextInterval=null,this._requester=null,this.isDestroyed=!1,this[Ja]=el,this._installListeners(),this._beginPolling()}async _beginPolling(){try{this.isIdle||await this.request}catch{}finally{this.isDestroyed||this._scheduleInterval()}}get isIdle(){const{request:t,query:e}=this._args;return Boolean(!t&&!e)}static{Za(this.prototype,"isIdle",[Ga])}get autorefreshTypes(){const{autorefresh:t}=this._args;let e;return e=!0===t?["online","invalid"]:"string"==typeof t?t.split(","):[],new Set(e)}static{Za(this.prototype,"autorefreshTypes",[Ga])}async _scheduleInterval(){const{autorefreshThreshold:t}=this._args;if("undefined"!=typeof window&&"number"==typeof t&&t>0&&this.autorefreshTypes.has("interval")&&null===this._intervalStart){if(this._latestRequest){try{await this._latestRequest}catch{}if(this.isDestroyed)return}this._intervalStart=Date.now(),this._nextInterval=setTimeout(()=>{this._maybeUpdate()},t)}}_clearInterval(){this._nextInterval&&(clearTimeout(this._nextInterval),this._intervalStart=null)}_updateSubscriptions(){if(this.isIdle)return;const t=this._request.lid;if(this._subscribedTo===t)return;this._removeSubscriptions();const e=this._getRequester();this._requester=e,t&&tl(e)&&(this._subscribedTo=t,this._subscription=e.notifications.subscribe(t,(n,i)=>{if(!this._isUpdating)switch(i){case"invalidated":this.autorefreshTypes.has("invalid")&&(this._invalidated=!0,this._maybeUpdate());break;case"state":{const n=e.requestManager._deduped.get(t),i=n?.priority,r=this.reqState;i?i.blocking&&!r.isLoading?(this.isRefreshing=!1,this._maybeUpdate("policy",!0)):this.isRefreshing=!0:this.isRefreshing=!1}}}))}_removeSubscriptions(){const t=this._requester;this._subscription&&t&&tl(t)&&(t.notifications.unsubscribe(this._subscription),this._subscribedTo=null,this._subscription=null,this._requester=null)}_installListeners(){"undefined"!=typeof window&&(this.isOnline=window.navigator.onLine,this._unavailableStart=this.isOnline?null:Date.now(),this.isHidden="hidden"===document.visibilityState,this._onlineChanged=t=>{this.isOnline="online"===t.type,"offline"===t.type&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},this._backgroundChanged=()=>{const t="hidden"===document.visibilityState;this.isHidden=t,t&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},window.addEventListener("online",this._onlineChanged,{passive:!0,capture:!0}),window.addEventListener("offline",this._onlineChanged,{passive:!0,capture:!0}),document.addEventListener("visibilitychange",this._backgroundChanged,{passive:!0,capture:!0}))}_maybeUpdate(t,e){if(this.isIdle)return;const{reqState:n}=this;if(n.isPending)return;if(!Boolean(this.isOnline&&!this.isHidden&&(t||this.autorefreshTypes.size))){if(!e&&t&&"_invalidated"!==t)throw new Error("Reload not available: the network is not online or the tab is hidden");return}const{autorefreshTypes:i}=this;let r=this._invalidated||Boolean(t);if(!r&&i.has("online")){const{_unavailableStart:t}=this,{autorefreshThreshold:e}=this._args,n="number"==typeof e?e:3e4;r=Boolean(t&&Date.now()-t>n)}if(!r&&i.has("interval")){const{_intervalStart:t}=this,{autorefreshThreshold:e}=this._args;t&&"number"==typeof e&&e>0&&(r=Boolean(Date.now()-t>=e))}if(this._unavailableStart=null,this._invalidated=!1,r){this._clearInterval(),this._isUpdating=!0;const e=("_invalidated"===t?null:t)??this._args.autorefreshBehavior??"policy",i=this._getRequester();switch(n._request.requester||(n._request.requester=i),e){case"reload":this._latestRequest=n.reload();break;case"refresh":this._latestRequest=n.refresh();break;case"policy":this._latestRequest=n.refresh(!0)}"refresh"!==e&&(this._localRequest=this._latestRequest),this._scheduleInterval(),this._latestRequest.finally(()=>{this._isUpdating=!1})}}_getRequester(){return this._args.request?.requester?this._args.request.requester:this.store}retry=async()=>{this._maybeUpdate("reload"),await this._localRequest};refresh=async()=>{this._maybeUpdate("refresh"),await this._latestRequest};get errorFeatures(){return{isHidden:this.isHidden,isOnline:this.isOnline,retry:this.retry}}static{Za(this.prototype,"errorFeatures",[Ga])}get contentFeatures(){const t={isHidden:this.isHidden,isOnline:this.isOnline,reload:this.retry,refresh:this.refresh,isRefreshing:this.isRefreshing,latestRequest:this._latestRequest};return t.isRefreshing&&(t.abort=()=>{this._latestRequest?.abort()}),t}static{Za(this.prototype,"contentFeatures",[Ga])}get _request(){const{request:t,query:e}=this._args,{_localRequest:n,_originalRequest:i,_originalQuery:r}=this;return n&&t===i&&e===r?n:(this._originalQuery=e,this._originalRequest=t,t||this.store.request(e))}static{Za(this.prototype,"_request",[Ga])}get request(){{const t=this._request;return this._updateSubscriptions(),t}}static{Za(this.prototype,"request",[Ga])}get reqState(){return function(t){let e=Wa.get(t);return e||(e=function(t){const e=(n=t,Oa.get(n));var n;const i=Object.create(Xa);return i._request=t,i.reload=()=>Ya(t.requester,i.request,!0),i.refresh=(e=!1)=>Ya(t.requester,i.request,!0===e&&null),e?e.isError?(i.error=e.result,i.reason=e.result,i.status="rejected",i.isError=!0,i.isPending=!1,i.isLoading=!1,i.request=e.result.request,i.response=e.result.response):(i.result=e.result.content,i.value=e.result.content,i.status="fulfilled",i.isSuccess=!0,i.isPending=!1,i.isLoading=!1,i.request=e.result.request,i.response=e.result.response):t.then(e=>{Aa(t,{isError:!1,result:e}),i.result=e.content,i.value=e.content,i.status="fulfilled",i.isSuccess=!0,i.isPending=!1,i.isLoading=!1,i.request=e.request,i.response=e.response},e=>{Aa(t,{isError:!0,result:e}),i.error=e,i.reason=e,i.status="rejected",i.isError=!0,i.isPending=!1,i.isLoading=!1,i.request=e.request,i.response=e.response}),i}(t),Wa.set(t,e)),e}(this.request)}get result(){return this.reqState.result}}function tl(t){return"requestManager"in t}function el(){const t=this;t.isDestroyed=!0,t._removeSubscriptions(),"undefined"!=typeof window&&(t._clearInterval(),window.removeEventListener("online",t._onlineChanged,{passive:!0,capture:!0}),window.removeEventListener("offline",t._onlineChanged,{passive:!0,capture:!0}),document.removeEventListener("visibilitychange",t._backgroundChanged,{passive:!0,capture:!0}))}Va(Qa.prototype,"isOnline",!0),Va(Qa.prototype,"isHidden",!1),Va(Qa.prototype,"isRefreshing",!1),Va(Qa.prototype,"_localRequest",void 0),Va(Qa.prototype,"_latestRequest",void 0);const nl={};Va(nl,"reason",null),Va(nl,"value",null),Va(nl,"result",null),Va(nl,"error",null),Va(nl,"status","pending"),Va(nl,"isPending",!0),Va(nl,"isLoading",!0),Va(nl,"isSuccess",!1),Va(nl,"isError",!1);const il=ge;var rl;rl=function(t){const e=t.wellknown.Array;return{createSignal:(t,n)=>n===e?[fr(t,n),fr(t,"length"),fr(t,"[]")]:fr(t,n),consumeSignal(t){if(Array.isArray(t))return De(t[0]),De(t[1]),void De(t[2]);De(t)},notifySignal(t){if(Array.isArray(t))return il(t[0]),il(t[1]),void il(t[2]);il(t)},createMemo:(t,e,n)=>{{const i=fr(t,e),r=qe(n);let s;const o=()=>{s=Ve(r)};return()=>{const t=Ge(o);return me(i,t),De(t),s}}},willSyncFlushWatchers:()=>!!ga.currentInstance&&!0!==ga._autorun,waitFor:async t=>t}},function(t,e){Pa["(transient) signalHooks"]=e}(0,rl({wellknown:{Array:Fa}}));const sl=ur,ol=Object.freeze(Object.defineProperty({__proto__:null,getOwner:sl,setOwner:hr},Symbol.toStringTag,{value:"Module"}));function al(t){let e=Object.create(t);return e._dict=null,delete e._dict,e}const ll=g.EMBER_LOAD_HOOKS||{},cl={};let ul=cl;function hl(t,e){let n=cl[t];(ll[t]??=[]).push(e),n&&e(n)}function dl(t,e){if(cl[t]=e,n&&"function"==typeof CustomEvent){let i=new CustomEvent(t,{detail:e});n.dispatchEvent(i)}ll[t]?.forEach(t=>t(e))}class pl{static _leakTracking;owner;registry;cache;factoryManagerCache;validationCache;isDestroyed;isDestroying;constructor(t,e={}){this.registry=t,this.owner=e.owner||null,this.cache=al(e.cache||null),this.factoryManagerCache=al(e.factoryManagerCache||null),this.isDestroyed=!1,this.isDestroying=!1}lookup(t,e){if(this.isDestroyed)throw new Error(`Cannot call \`.lookup('${t}')\` after the owner has been destroyed`);return function(t,e,n={}){let i=e;if(!0===n.singleton||void 0===n.singleton&&fl(t,e)){let e=t.cache[i];if(void 0!==e)return e}return function(t,e,n,i){let r=ml(t,e,n);if(void 0!==r){if(function(t,e,{instantiate:n,singleton:i}){return!1!==i&&!1!==n&&(!0===i||fl(t,e))&&gl(t,e)}(t,n,i)){let n=t.cache[e]=r.create();return t.isDestroying&&"function"==typeof n.destroy&&n.destroy(),n}if(function(t,e,{instantiate:n,singleton:i}){return!1!==n&&(!1===i||!fl(t,e))&&gl(t,e)}(t,n,i))return r.create();if(function(t,e,{instantiate:n,singleton:i}){return!1!==i&&!n&&fl(t,e)&&!gl(t,e)}(t,n,i)||function(t,e,{instantiate:n,singleton:i}){return!(!1!==n||!1!==i&&fl(t,e)||gl(t,e))}(t,n,i))return r.class;throw new Error("Could not create factory")}}(t,i,e,n)}(this,this.registry.normalize(t),e)}destroy(){this.isDestroying=!0,yl(this)}finalizeDestroy(){_l(this),this.isDestroyed=!0}reset(t){this.isDestroyed||(void 0===t?(yl(this),_l(this)):function(t,e){let n=t.cache[e];delete t.factoryManagerCache[e],n&&(delete t.cache[e],n.destroy&&n.destroy())}(this,this.registry.normalize(t)))}ownerInjection(){let t={};return hr(t,this.owner),t}factoryFor(t){if(this.isDestroyed)throw new Error(`Cannot call \`.factoryFor('${t}')\` after the owner has been destroyed`);return ml(this,this.registry.normalize(t),t)}}function fl(t,e){return!1!==t.registry.getOption(e,"singleton")}function gl(t,e){return!1!==t.registry.getOption(e,"instantiate")}function ml(t,e,n){let i=t.factoryManagerCache[e];if(void 0!==i)return i;let r=t.registry.resolve(e);if(void 0===r)return;let s=new xl(t,r,n,e);return t.factoryManagerCache[e]=s,s}function yl(t){let e=t.cache,n=Object.keys(e);for(let i of n){let t=e[i];t.destroy&&t.destroy()}}function _l(t){t.cache=al(null),t.factoryManagerCache=al(null)}const vl=Symbol("INIT_FACTORY");function bl(t){return t[vl]}function wl(t,e){t[vl]=e}class xl{container;owner;class;fullName;normalizedName;madeToString;injections;constructor(t,e,n,i){this.container=t,this.owner=t.owner,this.class=e,this.fullName=n,this.normalizedName=i,this.madeToString=void 0,this.injections=void 0}toString(){return void 0===this.madeToString&&(this.madeToString=this.container.registry.makeToString(this.class,this.fullName)),this.madeToString}create(t){let{container:e}=this;if(e.isDestroyed)throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);let n=t?{...t}:{};return hr(n,e.owner),wl(n,this),this.class.create(n)}}const Sl=/^[^:]+:[^:]+$/;class Cl{_failSet;resolver;fallback;registrations;_normalizeCache;_options;_resolveCache;_typeOptions;constructor(t={}){this.fallback=t.fallback||null,this.resolver=t.resolver||null,this.registrations=al(t.registrations||null),this._normalizeCache=al(null),this._resolveCache=al(null),this._failSet=new Set,this._options=al(null),this._typeOptions=al(null)}container(t){return new pl(this,t)}register(t,e,n={}){let i=this.normalize(t);this._failSet.delete(i),this.registrations[i]=e,this._options[i]=n}unregister(t){let e=this.normalize(t);delete this.registrations[e],delete this._resolveCache[e],delete this._options[e],this._failSet.delete(e)}resolve(t){let e=function(t,e){let n,i=e,r=t._resolveCache[i];return void 0!==r?r:t._failSet.has(i)?void 0:(t.resolver&&(n=t.resolver.resolve(i)),void 0===n&&(n=t.registrations[i]),void 0===n?t._failSet.add(i):t._resolveCache[i]=n,n)}(this,this.normalize(t));return void 0===e&&null!==this.fallback&&(e=this.fallback.resolve(t)),e}describe(t){return null!==this.resolver&&this.resolver.lookupDescription?this.resolver.lookupDescription(t):null!==this.fallback?this.fallback.describe(t):t}normalizeFullName(t){return null!==this.resolver&&this.resolver.normalize?this.resolver.normalize(t):null!==this.fallback?this.fallback.normalizeFullName(t):t}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this.normalizeFullName(t))}makeToString(t,e){return null!==this.resolver&&this.resolver.makeToString?this.resolver.makeToString(t,e):null!==this.fallback?this.fallback.makeToString(t,e):"string"==typeof t?t:t.name??"(unknown class)"}has(t){return!!this.isValidFullName(t)&&function(t,e){return void 0!==t.resolve(e)}(this,this.normalize(t))}optionsForType(t,e){this._typeOptions[t]=e}getOptionsForType(t){let e=this._typeOptions[t];return void 0===e&&null!==this.fallback&&(e=this.fallback.getOptionsForType(t)),e}options(t,e){let n=this.normalize(t);this._options[n]=e}getOptions(t){let e=this.normalize(t),n=this._options[e];return void 0===n&&null!==this.fallback&&(n=this.fallback.getOptions(t)),n}getOption(t,e){let n=this._options[t];if(void 0!==n&&void 0!==n[e])return n[e];let i=t.split(":")[0];return n=this._typeOptions[i],n&&void 0!==n[e]?n[e]:null!==this.fallback?this.fallback.getOption(t,e):void 0}knownForType(t){let e,n,i=al(null),r=Object.keys(this.registrations);for(let s of r)s.split(":")[0]===t&&(i[s]=!0);return null!==this.fallback&&(e=this.fallback.knownForType(t)),null!==this.resolver&&this.resolver.knownForType&&(n=this.resolver.knownForType(t)),Object.assign({},e,i,n)}isValidFullName(t){return Sl.test(t)}}const kl=al(null),El=`${Math.random()}${Date.now()}`.replace(".","");function Tl([t]){let e=kl[t];if(e)return e;let[n,i]=t.split(":");return kl[t]=W(`${n}:${i}-${El}`)}const Rl=Array.prototype.concat;function Pl(t,e,n,i){let r=n[t]||i[t];return e[t]&&(r=r?Rl.call(r,e[t]):e[t]),r}function Ml(t,e,n,i){if(!0===n)return e;let r=n._getter;if(void 0===r)return e;let s=i[t],o="function"==typeof s?Ir(s):s;if(void 0===o||!0===o)return e;let a=o._getter;if(void 0===a)return e;let l,c=mt(r,a),u=n._setter,h=o._setter;if(l=void 0!==h?void 0!==u?mt(u,h):h:u,c!==r||l!==u){let t=n._dependentKeys||[],e=new us([...t,{get:c,set:l}]);return e._readOnly=n._readOnly,e._meta=n._meta,e.enumerable=n.enumerable,Rr(e,us)}return e}function Il(t,e,n,i){if(void 0!==i[t])return e;let r=n[t];return"function"==typeof r?mt(e,r):e}function Ol(t){return t?Array.isArray(t)?t:[t]:[]}function Al(t,e,n){return Ol(n[t]).concat(Ol(e))}function Fl(t,e,n){let i=n[t];if(!i)return e;let r=Object.assign({},i),s=!1,o=Object.keys(e);for(let a of o){let t=e[a];"function"==typeof t?(s=!0,r[a]=Il(a,t,i,{})):r[a]=t}return s&&(r._super=at),r}function Ll(t,e,n,i,r,s,o){let a;for(let l=0;l{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}))}else zl(e,a,n,i,r,s,o)}function zl(t,e,n,i,r,s,o){let a=Pl("concatenatedProperties",e,i,r),l=Pl("mergedProperties",e,i,r),c=Object.keys(e);for(let u of c){let c=e[u];if(void 0===c)continue;if(-1===s.indexOf(u)){s.push(u);let e=t.peekDescriptors(u);if(void 0===e){if(!Or(c)){let t=i[u]=r[u];"function"==typeof t&&Dl(r,u,t,!1)}}else n[u]=e,o.push(u),e.teardown(r,u,t)}let h="function"==typeof c;if(h){let t=Ir(c);if(void 0!==t){n[u]=Ml(u,c,t,n),i[u]=void 0;continue}}a&&a.indexOf(u)>=0||"concatenatedProperties"===u||"mergedProperties"===u?c=Al(u,c,i):l&&l.indexOf(u)>-1?c=Fl(u,c,i):h&&(c=Il(u,c,i,n)),i[u]=c,n[u]=void 0}}function Dl(t,e,n,i){let r=dt(n);if(void 0===r)return;let{observers:s,listeners:o}=r;if(void 0!==s){let n=i?Wr:Hr;for(let i of s.paths)n(t,i,null,e,s.sync)}if(void 0!==o){let n=i?jr:Nr;for(let i of o)n(t,i,null,e)}}function jl(t,e,n=!1){let i=Object.create(null),r=Object.create(null),s=ae(t),o=[],a=[];t._super=at,Ll(e,s,i,r,t,o,a);for(let l of o){let e=r[l],o=i[l];void 0!==e?("function"==typeof e&&Dl(t,l,e,!0),_s(t,l,e,-1!==a.indexOf(l),!n)):void 0!==o&&ys(t,l,o,s)}return s.isPrototypeMeta(t)||Jr(t),t}function Nl(t,...e){return jl(t,e),t}const Ul=new WeakSet;class Bl{mixins;properties;ownerConstructor;_without;constructor(t,e){Ul.add(this),this.properties=function(t){if(void 0!==t)for(let e of Object.keys(t)){let n=Object.getOwnPropertyDescriptor(t,e);void 0===n.get&&void 0===n.set||Object.defineProperty(t,e,{value:Sr(n)})}return t}(e),this.mixins=ql(t),this.ownerConstructor=void 0,this._without=void 0}static create(...t){return _o(),new this(t,void 0)}static mixins(t){let e=oe(t),n=[];return null===e||e.forEachMixins(t=>{t.properties||n.push(t)}),n}reopen(...t){if(0===t.length)return this;if(this.properties){let t=new Bl(void 0,this.properties);this.properties=void 0,this.mixins=[t]}else this.mixins||(this.mixins=[]);return this.mixins=this.mixins.concat(ql(t)),this}apply(t,e=!1){return jl(t,[this],e)}applyPartial(t){return jl(t,[this])}detect(t){if("object"!=typeof t||null===t)return!1;if(Ul.has(t))return Vl(t,this);let e=oe(t);return null!==e&&e.hasMixin(this)}without(...t){let e=new Bl([this]);return e._without=t,e}keys(){return $l(this)}toString(){return"(unknown mixin)"}}function ql(t){let e,n=t&&t.length||0;if(n>0){e=new Array(n);for(let i=0;iVl(t,e,n))}function $l(t,e=new Set,n=new Set){if(!n.has(t)){if(n.add(t),t.properties){let n=Object.keys(t.properties);for(let t of n)e.add(t)}else t.mixins&&t.mixins.forEach(t=>$l(t,e,n));return e}}const Gl=Bl.create({__registry__:null,resolveRegistration(t){return this.__registry__.resolve(t)},register:Wl("register"),unregister:Wl("unregister"),hasRegistration:Wl("has"),registeredOption:Wl("getOption"),registerOptions:Wl("options"),registeredOptions:Wl("getOptions"),registerOptionsForType:Wl("optionsForType"),registeredOptionsForType:Wl("getOptionsForType")});function Wl(t){return function(...e){return this.__registry__[t](...e)}}const Hl=Bl.create({__container__:null,ownerInjection(){return this.__container__.ownerInjection()},lookup(t,e){return this.__container__.lookup(t,e)},destroy(){let t=this.__container__;t&&ya(()=>{t.destroy(),va("destroy",t,"finalizeDestroy")}),this._super()},factoryFor(t){return this.__container__.factoryFor(t)}}),Kl=Bl.create({compare:null}),Xl=Bl.create({mergedProperties:["actions"],send(t,...e){if(this.actions&&this.actions[t]&&!0!==this.actions[t].apply(this,e))return;let n=Ss(this,"target");n&&n.send(...arguments)}});function Yl(t){let e=Ss(t,"content");return me(gr(t),gr(e)),e}function Zl(t,e,n){let i=sn(t),r=on(t,e,i);if(e in t)return r;{let s=[r,on(t,"content",i)],o=Yl(t);return H(o)&&s.push(fr(o,e,n)),ke(s)}}const Jl=Bl.create({content:null,init(){this._super(...arguments),nr(this),gr(this),li(this,Zl)},willDestroy(){this.set("content",null),this._super(...arguments)},isTruthy:ps("content",function(){return Boolean(Ss(this,"content"))}),unknownProperty(t){let e=Yl(this);return e?Ss(e,t):void 0},setUnknownProperty(t,e){let n=ae(this);return n.isInitializing()||n.isPrototypeMeta(this)?(ms(this,t,null,e),e):Ls(Yl(this),t,e)}}),Ql=Bl.create(),tc=Bl.create(Ql),ec=Object.freeze(Object.defineProperty({__proto__:null,default:tc},Symbol.toStringTag,{value:"Module"})),nc=Bl.create({target:null,action:null,actionContext:null,actionContextObject:ps("actionContext",function(){let t=Ss(this,"actionContext");if("string"==typeof t){let e=Ss(this,t);return void 0===e&&(e=Ss(d.lookup,t)),e}return t}),triggerAction(t={}){let{action:e,target:n,actionContext:i}=t;e=e||Ss(this,"action"),n=n||function(t){let e=Ss(t,"target");if(e){if("string"==typeof e){let n=Ss(t,e);return void 0===n&&(n=Ss(d.lookup,e)),n}return e}return t._target?t._target:null}(this),void 0===i&&(i=Ss(this,"actionContextObject")||this);let r=Array.isArray(i)?i:[i];if(n&&e){let t;if(t=null!=(s=n)&&"object"==typeof s&&"function"==typeof s.send?n.send(e,...r):n[e](...r),!1!==t)return!0}var s;return!1}});function ic(t){let e=t._promiseCallbacks;return e||(e=t._promiseCallbacks={}),e}const rc={mixin(t){return t.on=this.on,t.off=this.off,t.trigger=this.trigger,t._promiseCallbacks=void 0,t},on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=ic(this),i=n[t];i||(i=n[t]=[]),-1===i.indexOf(e)&&i.push(e)},off(t,e){let n=ic(this);if(!e)return void(n[t]=[]);let i=n[t],r=i.indexOf(e);-1!==r&&i.splice(r,1)},trigger(t,e,n){let i=ic(this)[t];if(i){let t;for(let r=0;r{for(let t=0;t{e===n?yc(t,n):gc(t,n)},e=>_c(t,e))}(t,e):"function"==typeof n?function(t,e,n){sc.async(t=>{let i=!1,r=function(n,r){try{n.call(r,n=>{i||(i=!0,e===n?yc(t,n):gc(t,n))},e=>{i||(i=!0,_c(t,e))})}catch(s){return s}}(n,e,t._label);!i&&r&&(i=!0,_c(t,r))},t)}(t,e,n):yc(t,e)}function gc(t,e){if(t===e)yc(t,e);else if(function(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}(e)){let n;try{n=e.then}catch(Fj){return void _c(t,Fj)}fc(t,e,n)}else yc(t,e)}function mc(t){t._onError&&t._onError(t._result),bc(t)}function yc(t,e){t._state===hc&&(t._result=e,t._state=dc,0===t._subscribers.length?sc.instrument&&lc("fulfilled",t):sc.async(bc,t))}function _c(t,e){t._state===hc&&(t._state=pc,t._result=e,sc.async(mc,t))}function vc(t,e,n,i){let r=t._subscribers,s=r.length;t._onError=null,r[s]=e,r[s+dc]=n,r[s+pc]=i,0===s&&t._state&&sc.async(bc,t)}function bc(t){let e=t._subscribers,n=t._state;if(sc.instrument&&lc(n===dc?"fulfilled":"rejected",t),0===e.length)return;let i,r,s=t._result;for(let o=0;owc(r,s,n,o))}return s}class Sc{constructor(t,e,n,i){this._instanceConstructor=t,this.promise=new t(uc,i),this._abortOnReject=n,this._isUsingOwnPromise=t===Tc,this._isUsingOwnResolve=t.resolve===cc,this._init(...arguments)}_init(t,e){let n=e.length||0;this.length=n,this._remaining=n,this._result=new Array(n),this._enumerate(e)}_enumerate(t){let e=this.length,n=this.promise;for(let i=0;n._state===hc&&ie(t)),e,n)}else this._willSettleAt(i.resolve(t),e,n)}_eachEntry(t,e,n){null!==t&&"object"==typeof t?this._settleMaybeThenable(t,e,n):this._setResultAt(dc,e,t,n)}_settledAt(t,e,n,i){let r=this.promise;r._state===hc&&(this._abortOnReject&&t===pc?_c(r,n):(this._setResultAt(t,e,n,i),this._checkFullfillment()))}_setResultAt(t,e,n,i){this._remaining--,this._result[e]=n}_willSettleAt(t,e,n){vc(t,void 0,t=>this._settledAt(dc,e,t,n),t=>this._settledAt(pc,e,t,n))}}function Cc(t,e,n){this._remaining--,this._result[e]=t===dc?{state:"fulfilled",value:n}:{state:"rejected",reason:n}}const kc="rsvp_"+Date.now()+"-";let Ec=0,Tc=class t{constructor(e,n){this._id=Ec++,this._label=n,this._state=void 0,this._result=void 0,this._subscribers=[],sc.instrument&&lc("created",this),uc!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){let n=!1;try{e(e=>{n||(n=!0,gc(t,e))},e=>{n||(n=!0,_c(t,e))})}catch(i){_c(t,i)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}_onError(t){sc.after(()=>{this._onError&&sc.trigger("error",t,this._label)})}catch(t,e){return this.then(void 0,t,e)}finally(t,e){let n=this,i=n.constructor;return"function"==typeof t?n.then(e=>i.resolve(t()).then(()=>e),e=>i.resolve(t()).then(()=>{throw e})):n.then(t,t)}};function Rc(t,e){return{then:(n,i)=>t.call(e,n,i)}}function Pc(t,e){let n=function(){let n=arguments.length,i=new Array(n+1),r=!1;for(let t=0;tMc(t,e,n,i))}(s,i,t,this):Mc(s,i,t,this)};return n.__proto__=t,n}function Mc(t,e,n,i){try{n.apply(i,e)}catch(Fj){_c(t,Fj)}return t}function Ic(t,e){return Tc.all(t,e)}Tc.cast=cc,Tc.all=function(t,e){return Array.isArray(t)?new Sc(this,t,!0,e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)},Tc.race=function(t,e){let n=this,i=new n(uc,e);if(!Array.isArray(t))return _c(i,new TypeError("Promise.race must be called with an array")),i;for(let r=0;i._state===hc&&rgc(i,t),t=>_c(i,t));return i},Tc.resolve=cc,Tc.reject=function(t,e){let n=new this(uc,e);return _c(n,t),n},Tc.prototype._guidKey=kc,Tc.prototype.then=xc;class Oc extends Sc{constructor(t,e,n){super(t,e,!1,n)}}function Ac(t,e){return Array.isArray(t)?new Oc(Tc,t,e).promise:Tc.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function Fc(t,e){return Tc.race(t,e)}Oc.prototype._setResultAt=Cc;class Lc extends Sc{constructor(t,e,n=!0,i){super(t,e,n,i)}_init(t,e){this._result={},this._enumerate(e)}_enumerate(t){let e,n,i=Object.keys(t),r=i.length,s=this.promise;this._remaining=r;for(let o=0;s._state===hc&&o{throw t}),t}function Uc(t){let e={resolve:void 0,reject:void 0};return e.promise=new Tc((t,n)=>{e.resolve=t,e.reject=n},t),e}Dc.prototype._setResultAt=Cc;class Bc extends Sc{constructor(t,e,n,i){super(t,e,!0,i,n)}_init(t,e,n,i,r){let s=e.length||0;this.length=s,this._remaining=s,this._result=new Array(s),this._mapFn=r,this._enumerate(e)}_setResultAt(t,e,n,i){if(i)try{this._eachEntry(this._mapFn(n,e),e,!1)}catch(Fj){this._settledAt(pc,e,Fj,!1)}else this._remaining--,this._result[e]=n}}function qc(t,e,n){return"function"!=typeof e?Tc.reject(new TypeError("map expects a function as a second argument"),n):Tc.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("map must be called with an array");return new Bc(Tc,t,e,n).promise})}function Vc(t,e){return Tc.resolve(t,e)}function $c(t,e){return Tc.reject(t,e)}const Gc={};class Wc extends Bc{_checkFullfillment(){if(0===this._remaining&&null!==this._result){let t=this._result.filter(t=>t!==Gc);yc(this.promise,t),this._result=null}}_setResultAt(t,e,n,i){if(i){this._result[e]=n;let t,i=!0;try{t=this._mapFn(n,e)}catch(Fj){i=!1,this._settledAt(pc,e,Fj,!1)}i&&this._eachEntry(t,e,!1)}else this._remaining--,n||(this._result[e]=Gc)}}function Hc(t,e,n){return"function"!=typeof e?Tc.reject(new TypeError("filter expects function as a second argument"),n):Tc.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("filter must be called with an array");return new Wc(Tc,t,e,n).promise})}let Kc,Xc=0;function Yc(t,e){iu[Xc]=t,iu[Xc+1]=e,Xc+=2,2===Xc&&su()}const Zc="undefined"!=typeof window?window:void 0,Jc=Zc||{},Qc=Jc.MutationObserver||Jc.WebKitMutationObserver,tu="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),eu="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function nu(){return()=>setTimeout(ru,1)}const iu=new Array(1e3);function ru(){for(let t=0;tt(ru)}():Qc?function(){let t=0,e=new Qc(ru),n=document.createTextNode("");return e.observe(n,{characterData:!0}),()=>n.data=t=++t%2}():eu?function(){let t=new MessageChannel;return t.port1.onmessage=ru,()=>t.port2.postMessage(0)}():void 0===Zc&&"function"==typeof window.require?function(){try{const t=Function("return this")().require("vertx");return Kc=t.runOnLoop||t.runOnContext,void 0!==Kc?function(){Kc(ru)}:nu()}catch(t){return nu()}}():nu(),sc.async=Yc,sc.after=t=>setTimeout(t,0);const ou=Vc,au=(t,e)=>sc.async(t,e);function lu(){sc.on(...arguments)}function cu(){sc.off(...arguments)}if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){let t=window.__PROMISE_INSTRUMENTATION__;oc("instrument",!0);for(let e in t)t.hasOwnProperty(e)&&lu(e,t[e])}const uu={asap:Yc,cast:ou,Promise:Tc,EventTarget:rc,all:Ic,allSettled:Ac,race:Fc,hash:zc,hashSettled:jc,rethrow:Nc,defer:Uc,denodeify:Pc,configure:oc,on:lu,off:cu,resolve:Vc,reject:$c,map:qc,async:au,filter:Hc},hu=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:rc,Promise:Tc,all:Ic,allSettled:Ac,asap:Yc,async:au,cast:ou,configure:oc,default:uu,defer:Uc,denodeify:Pc,filter:Hc,hash:zc,hashSettled:jc,map:qc,off:cu,on:lu,race:Fc,reject:$c,resolve:Vc,rethrow:Nc},Symbol.toStringTag,{value:"Module"}));function du(t){let e=function(t){if(!t)return;let e=t;return e.errorThrown?function(t){let e=t.errorThrown;return"string"==typeof e&&(e=new Error(e)),Object.defineProperty(e,"__reason_with_error_thrown__",{value:t,enumerable:!1}),e}(e):"UnrecognizedURLError"!==t.name&&"TransitionAborted"!==t.name?t:void 0}(t);if(e)throw e}oc("async",(t,e)=>{ga.schedule("actions",null,t,e)}),oc("after",t=>{ga.schedule(pa,null,t)}),lu("error",du);const{isArray:pu}=Array;function fu(t){return null==t?[]:pu(t)?t:[t]}function gu(t){return"object"==typeof t&&null!==t&&"function"==typeof t.setUnknownProperty}const mu=Bl.prototype.reopen,yu=new WeakSet,_u=new WeakMap,vu=new Set;function bu(t){vu.has(t)||t.destroy()}function wu(t,e){let n=ae(t);if(void 0!==e){let i=t.concatenatedProperties,r=t.mergedProperties,s=Object.keys(e);for(let o of s){let s=e[o],a=Mr(t,o,n),l=void 0!==a;if(!l){if(void 0!==i&&i.length>0&&i.includes(o)){let e=t[o];s=e?fu(e).concat(s):fu(s)}if(void 0!==r&&r.length>0&&r.includes(o)){let e=t[o];s=Object.assign({},e,s)}}l?a.set(t,o,s):gu(t)&&!(o in t)?t.setUnknownProperty(o,s):t[o]=s}}t.init(e),n.unsetInitializing();let i=n.observerEvents();if(void 0!==i)for(let r=0;rn.willDestroy()),ae(e).setInitializing()}reopen(...t){return jl(this,t),this}init(t){}get isDestroyed(){return Yt(this)}set isDestroyed(t){}get isDestroying(){return Xt(this)}set isDestroying(t){}destroy(){vu.add(this);try{Ht(this)}finally{vu.delete(this)}return this}willDestroy(){}toString(){let t="object"==typeof this&&null!==this&&"function"==typeof this.toStringExtension?`:${this.toStringExtension()}`:"";return`<${bl(this)||"(unknown)"}:${et(this)}${t}>`}static extend(...t){let e=class extends(this){};return mu.apply(e.PrototypeMixin,t),e}static create(...t){let e,n=t[0];return void 0!==n?(e=new this(ur(n)),wl(e,bl(n))):e=new this,t.length<=1?wu(e,n):wu(e,Su.apply(this,t)),e}static reopen(...t){return this.willReopen(),mu.apply(this.PrototypeMixin,t),this}static willReopen(){let t=this.prototype;yu.has(t)&&(yu.delete(t),_u.has(this)&&_u.set(this,Bl.create(this.PrototypeMixin)))}static reopenClass(...t){return jl(this,t),this}static detect(t){if("function"!=typeof t)return!1;for(;t;){if(t===this)return!0;t=t.superclass}return!1}static detectInstance(t){return t instanceof this}static metaForProperty(t){return Mr(this.proto(),t)._meta||{}}static eachComputedProperty(t,e=this){this.proto();let n={};ae(this.prototype).forEachDescriptors((i,r)=>{if(r.enumerable){let s=r._meta||n;t.call(e,i,s)}})}static get PrototypeMixin(){let t=_u.get(this);return void 0===t&&(t=Bl.create(),t.ownerConstructor=this,_u.set(this,t)),t}static get superclass(){let t=Object.getPrototypeOf(this);return t!==Function.prototype?t:void 0}static proto(){let t=this.prototype;if(!yu.has(t)){yu.add(t);let e=this.superclass;e&&e.proto(),_u.has(this)&&this.PrototypeMixin.apply(t)}return t}static toString(){return`<${bl(this)||"(unknown)"}:constructor>`}static isClass=!0;static isMethod=!1;static _onLookup;static _lazyInjections}function Su(...t){let e={};for(let n of t){let t=Object.keys(n);for(let i=0,r=t.length;is.push(t));return pt(e,{paths:s,sync:i}),e}Ar(Mu);const Ou=Object.freeze(Object.defineProperty({__proto__:null,action:Mu,computed:ps,default:Tu,defineProperty:ms,get:Ss,getProperties:Js,notifyPropertyChange:ss,observer:Iu,set:Ls,setProperties:Qs,trySet:Ds},Symbol.toStringTag,{value:"Module"}));function Au(t){if(!(t instanceof MouseEvent))return!1;let e=t.shiftKey||t.metaKey||t.altKey||t.ctrlKey,n=t.which>1;return!e&&!n}function Fu(t){return'Binding style attributes may introduce cross-site scripting vulnerabilities; please ensure that values being bound are properly escaped. For more information, including how to disable this warning, see https://deprecations.emberjs.com/v1.x/#toc_binding-style-attributes. Style affected: "'+t+'"'}function Lu(t){let e=t.lookup("-view-registry:main"),n=[];return Object.keys(e).forEach(t=>{let i=e[t];null===i.parentView&&n.push(i)}),n}function zu(t){return""!==t.tagName&&t.elementId?t.elementId:et(t)}const Du=new WeakMap,ju=new WeakMap;function Nu(t){return Du.get(t)||null}function Uu(t){return ju.get(t)||null}function Bu(t,e){Du.set(t,e)}function qu(t,e){ju.set(t,e)}function Vu(t){Du.delete(t)}function $u(t){ju.delete(t)}const Gu=new WeakMap;function Wu(t){return function(t,e){let n=[],i=Gu.get(t);return void 0!==i&&i.forEach(t=>{let i=e[t];!i||i.isDestroying||i.isDestroyed||n.push(i)}),n}(t,ur(t).lookup("-view-registry:main"))}function Hu(t,e){let n=Gu.get(t);void 0===n&&(n=function(t){let e=new Set;return Gu.set(t,e),e}(t)),n.add(zu(e))}function Ku(t){return t.renderer.getBounds(t)}function Xu(t){let e=Ku(t),n=document.createRange();return n.setStartBefore(e.firstNode),n.setEndAfter(e.lastNode),n}function Yu(t){return Xu(t).getClientRects()}function Zu(t){return Xu(t).getBoundingClientRect()}const Ju="ember-application";class Qu extends Tu{events={touchstart:"touchStart",touchmove:"touchMove",touchend:"touchEnd",touchcancel:"touchCancel",keydown:"keyDown",keyup:"keyUp",keypress:"keyPress",mousedown:"mouseDown",mouseup:"mouseUp",contextmenu:"contextMenu",click:"click",dblclick:"doubleClick",focusin:"focusIn",focusout:"focusOut",submit:"submit",input:"input",change:"change",dragstart:"dragStart",drag:"drag",dragenter:"dragEnter",dragleave:"dragLeave",dragover:"dragOver",drop:"drop",dragend:"dragEnd"};rootElement="body";_eventHandlers=Object.create(null);_didSetup=!1;finalEventNameMapping=null;_sanitizedRootElement=null;lazyEvents=new Map;_reverseEventNameMapping=null;setup(t,e){let n=this.finalEventNameMapping={...Ss(this,"events"),...t};this._reverseEventNameMapping=Object.keys(n).reduce((t,e)=>{let i=n[e];return i?{...t,[i]:e}:t},{});let i=this.lazyEvents;null!=e&&Ls(this,"rootElement",e);let r=Ss(this,"rootElement"),s="string"!=typeof r?r:document.querySelector(r);s.classList.add(Ju),this._sanitizedRootElement=s;for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.set(o,n[o]??null);this._didSetup=!0}setupHandlerForBrowserEvent(t){this.setupHandler(this._sanitizedRootElement,t,this.finalEventNameMapping[t]??null)}setupHandlerForEmberEvent(t){let e=this._reverseEventNameMapping?.[t];e&&this.setupHandler(this._sanitizedRootElement,e,t)}setupHandler(t,e,n){if(null===n||!this.lazyEvents.has(e))return;let i=(t,e)=>{let i=Nu(t),r=!0;return i&&(r=i.handleEvent(n,e)),r},r=this._eventHandlers[e]=t=>{let e=t.target;do{if(Nu(e)){if(!1===i(e,t)){t.preventDefault(),t.stopPropagation();break}if(!0===t.cancelBubble)break}e=e.parentNode}while(e instanceof Element)};t.addEventListener(e,r),this.lazyEvents.delete(e)}destroy(){if(!1===this._didSetup)return;let t=this._sanitizedRootElement;if(t){for(let e in this._eventHandlers)t.removeEventListener(e,this._eventHandlers[e]);return t.classList.remove(Ju),this._super(...arguments)}}toString(){return"(EventDispatcher)"}}const th=Bl.create({on(t,e,n){return jr(this,t,e,n),this},one(t,e,n){return jr(this,t,e,n,!0),this},trigger(t,...e){Ur(this,t,e)},off(t,e,n){return Nr(this,t,e,n),this},has(t){return Br(this,t)}}),eh=Object.freeze(Object.defineProperty({__proto__:null,default:th,on:qr},Symbol.toStringTag,{value:"Module"}));let nh=class extends Tu{},ih=[],rh={};const sh=(()=>{let t="undefined"!=typeof window&&window.performance||{},e=t.now||t.mozNow||t.webkitNow||t.msNow||t.oNow;return e?e.bind(t):Date.now})();function oh(t,e,n,i){let r,s,o;if(arguments.length<=3&&function(t){return"function"==typeof t}(e)?(s=e,o=n):(r=e,s=n,o=i),0===ih.length)return s.call(o);let a=r||{},l=ch(t,()=>a);return l===lh?s.call(o):function(t,e,n,i){try{return t.call(i)}catch(r){throw n.exception=r,r}finally{e()}}(s,l,a,o)}function ah(t,e,n){return n()}function lh(){}function ch(t,e,n){if(0===ih.length)return lh;let i=rh[t];if(i||(i=function(t){let e=[];for(let n of ih)n.regex.test(t)&&e.push(n.object);return rh[t]=e,e}(t)),0===i.length)return lh;let r,s=e(n),o=g.STRUCTURED_PROFILE;o&&(r=`${t}: ${s.object}`,console.time(r));let a=[],l=sh();for(let u of i)a.push(u.before(t,l,s));const c=i;return function(){let e=sh();for(let n=0;n!0,rerender(){},destroy(){}}),gh=Object.freeze({...fh}),mh=Object.freeze({...fh,rerender(t){t.renderer.rerender()},destroy(t){t.renderer.remove(t)},handleEvent:(t,e,n)=>!t.has(e)||ah(0,0,()=>ya(t,t.trigger,e,n))}),yh=Object.freeze({...mh,enter(t){t.renderer.register(t)}}),_h=Object.freeze({...fh,appendChild(){throw new Error("You can't call appendChild on a view being destroyed")},rerender(){throw new Error("You can't call rerender on a view being destroyed")}}),vh=Object.freeze({preRender:gh,inDOM:yh,hasElement:mh,destroying:_h});var bh=Object.defineProperty;((t,e)=>{for(var n in e)bh(t,n,{get:e[n],enumerable:!0})})({},{c:()=>Th,f:()=>xh,g:()=>Sh,i:()=>Eh,m:()=>Ch,n:()=>kh,p:()=>Rh});var wh=new WeakMap;function xh(t,e,n,i){return Sh(t.prototype,e,n,i)}function Sh(t,e,n,i){let r={configurable:!0,enumerable:!0,writable:!0,initializer:null};i&&(r.initializer=i);for(let s of n)r=s(t,e,r)||r;void 0===r.initializer?Object.defineProperty(t,e,r):function(t,e,n){let i=wh.get(t);i||(i=new Map,wh.set(t,i)),i.set(e,n)}(t,e,r)}function Ch({prototype:t},e,n){return kh(t,e,n)}function kh(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}function Eh(t,e){let n=function(t,e){let n=t.prototype;for(;n;){let t=wh.get(n)?.get(e);if(t)return t;n=n.prototype}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}function Th(t,e){return e.reduce((t,e)=>e(t)||t,t)}function Rh(t,e){for(let[n,i,r]of e)"field"===n?Ph(t,i,r):kh(t,i,r);return t}function Ph(t,e,n){let i={configurable:!0,enumerable:!0,writable:!0,initializer:()=>Object.getOwnPropertyDescriptor(t,e)?.value};for(let r of n)i=r(t,e,i)||i;i.initializer&&(i.value=i.initializer.call(t),delete i.initializer),Object.defineProperty(t,e,i)}class Mh extends(nh.extend(th,Xl)){isView=!0;_superTrigger;_superHas;init(t){super.init(t),this._superTrigger=this.trigger,this.trigger=this._trigger,this._superHas=this.has,this.has=this._has,this.parentView??=null,this._state="preRender",this._currentState=this._states.preRender}static{Sh(this.prototype,"renderer",[Ms("renderer","-dom")])}#l=void Eh(this,"renderer");instrumentDetails(t){return t.object=this.toString(),t.containerKey=this._debugContainerKey,t.view=this,t}_trigger(t,...e){this._superTrigger(t,...e);let n=this[t];if("function"==typeof n)return n.apply(this,e)}_has(t){return"function"==typeof this[t]||this._superHas(t)}static isViewFactory=!0}Mh.prototype._states=vh;const Ih=Bl.create({send(t,...e){let n=this.actions&&this.actions[t];if(n&&!0!==n.apply(this,e))return;let i=Ss(this,"target");i&&i.send(...arguments)}}),Oh={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object","[object FileList]":"filelist"},{toString:Ah}=Object.prototype;function Fh(t){if(null===t)return"null";if(void 0===t)return"undefined";let e=Oh[Ah.call(t)]||"object";return"function"===e?xu.detect(t)&&(e="class"):"object"===e&&(t instanceof Error?e="error":t instanceof xu?e="instance":t instanceof Date&&(e="date")),e}const Lh={undefined:0,null:1,boolean:2,number:3,string:4,array:5,object:6,instance:7,function:8,class:9,date:10,regexp:11,filelist:12,error:13};function zh(t,e){return Math.sign(t-e)}function Dh(t,e){if(t===e)return 0;let n=Fh(t),i=Fh(e);if("instance"===n&&jh(t)&&t.constructor.compare)return t.constructor.compare(t,e);if("instance"===i&&jh(e)&&e.constructor.compare)return-1*e.constructor.compare(e,t);let r=zh(Lh[n],Lh[i]);if(0!==r)return r;switch(n){case"boolean":return zh(Number(t),Number(e));case"number":return zh(t,e);case"string":return zh(t.localeCompare(e),0);case"array":{let n=t.length,i=e.length,r=Math.min(n,i);for(let s=0;st;function Bh(t,e=Uh){let n=id(),i=new Set,r="function"==typeof e?e:t=>Ss(t,e);return t.forEach(t=>{let e=r(t);i.has(e)||(i.add(e),n.push(t))}),n}function qh(...t){let e=2===t.length,[n,i]=t;return e?t=>i===Ss(t,n):t=>Boolean(Ss(t,n))}function Vh(t,e,n){let i=t.length;for(let r=n;r!i(t,e,n),0)}function Hh(t,e,n=0,i){let r=t.length;return n<0&&(n+=r),Vh(t,i&&e!=e?t=>t!=t:t=>t===e,n)}function Kh(t,e,n){return Ws(t,e,n??1,Nh),t}function Xh(t,e,n){return Ws(t,e,0,[n]),n}function Yh(t){if(!t||t.setInterval)return!1;if(Array.isArray(t)||Qh.detect(t))return!0;let e=Fh(t);if("array"===e)return!0;let n=t.length;return"number"==typeof n&&n==n&&"object"===e}function Zh(t){let e=ps(t);return e.enumerable=!1,e}function Jh(t){return this.map(e=>Ss(e,t))}const Qh=Bl.create(Ql,{init(){this._super(...arguments),ir.add(this)},objectsAt(t){return t.map(t=>dr(this,t))},"[]":Zh({get(){return this},set(t,e){return this.replace(0,this.length,e),this}}),firstObject:Zh(function(){return dr(this,0)}).readOnly(),lastObject:Zh(function(){return dr(this,this.length-1)}).readOnly(),slice(t=0,e){let n,i=id(),r=this.length;for(t<0&&(t=r+t),n=void 0===e||e>r?r:e<0?r+e:e;t=n)&&(e=n-1),e<0&&(e+=n);for(let i=e;i>=0;i--)if(dr(this,i)===t)return i;return-1},forEach(t,e=null){let n=this.length;for(let i=0;iLs(n,t,e))},map(t,e=null){let n=id();return this.forEach((i,r,s)=>n[r]=t.call(e,i,r,s)),n},mapBy:Jh,filter(t,e=null){let n=id();return this.forEach((i,r,s)=>{t.call(e,i,r,s)&&n.push(i)}),n},reject(t,e=null){return this.filter(function(){return!t.apply(e,arguments)})},filterBy(){return this.filter(qh(...arguments))},rejectBy(){return this.reject(qh(...arguments))},find(t,e=null){return $h(this,t,e)},findBy(){return $h(this,qh(...arguments))},every(t,e=null){return Wh(this,t,e)},isEvery(){return Wh(this,qh(...arguments))},any(t,e=null){return Gh(this,t,e)},isAny(){return Gh(this,qh(...arguments))},reduce(t,e){let n=e;return this.forEach(function(e,i){n=t(n,e,i,this)},this),n},invoke(t,...e){let n=id();return this.forEach(i=>n.push(i[t]?.(...e))),n},toArray(){return this.map(t=>t)},compact(){return this.filter(t=>null!=t)},includes(t,e){return-1!==Hh(this,t,e,!0)},sortBy(){let t=arguments;return this.toArray().sort((e,n)=>{for(let i=0;ie!==t:t=>t==t;return this.filter(e)}}),td=Bl.create(Qh,tc,{clear(){let t=this.length;return 0===t||this.replace(0,t,Nh),this},insertAt(t,e){return Xh(this,t,e),this},removeAt(t,e){return Kh(this,t,e)},pushObject(t){return Xh(this,this.length,t)},pushObjects(t){return this.replace(this.length,0,t),this},popObject(){let t=this.length;if(0===t)return null;let e=dr(this,t-1);return this.removeAt(t-1,1),e},shiftObject(){if(0===this.length)return null;let t=dr(this,0);return this.removeAt(0),t},unshiftObject(t){return Xh(this,0,t)},unshiftObjects(t){return this.replace(0,0,t),this},reverseObjects(){let t=this.length;if(0===t)return this;let e=this.toArray().reverse();return this.replace(0,t,e),this},setObjects(t){if(0===t.length)return this.clear();let e=this.length;return this.replace(0,e,t),this},removeObject(t){let e=this.length||0;for(;--e>=0;)dr(this,e)===t&&this.removeAt(e);return this},removeObjects(t){os();for(let e=t.length-1;e>=0;e--)this.removeObject(t[e]);return as(),this},addObject(t){return this.includes(t)||this.pushObject(t),this},addObjects(t){return os(),t.forEach(t=>this.addObject(t)),as(),this}});let ed=Bl.create(td,ku,{objectAt(t){return this[t]},replace(t,e,n=Nh){return Ks(this,t,e,n),this}});const nd=["length"];let id;ed.keys().forEach(t=>{Array.prototype[t]&&nd.push(t)}),ed=ed.without(...nd),id=function(t){return rr(t)?t:ed.apply(t??[])};const rd=Object.freeze(Object.defineProperty({__proto__:null,get A(){return id},MutableArray:td,get NativeArray(){return ed},default:Qh,isArray:Yh,makeArray:fu,removeAt:Kh,uniqBy:Bh},Symbol.toStringTag,{value:"Module"})),sd=kt("MODEL"),od=Bl.create(Xl,{isController:!0,concatenatedProperties:["queryParams"],target:null,store:null,init(){this._super(...arguments);let t=ur(this);t&&(this.namespace=t.lookup("application:main"),this.target=t.lookup("router:main"))},model:ps({get(){return this[sd]},set(t,e){return this[sd]=e}}),queryParams:null,_qpDelegate:null,_qpChanged(t,e){let n=e.indexOf(".[]"),i=-1===n?e:e.slice(0,n);(0,t._qpDelegate)(i,Ss(t,i))}});class ad extends(nh.extend(od)){}function ld(...t){return Ms("controller",...t)}const cd=Object.freeze(Object.defineProperty({__proto__:null,ControllerMixin:od,default:ad,inject:ld},Symbol.toStringTag,{value:"Module"})),ud=Symbol("ENGINE_PARENT");function hd(t){return t[ud]}class dd extends(Tu.extend(Gl,Hl)){static setupRegistry(t,e){}[ud];_booted=!1;init(t){super.init(t),et(this),this.base??=this.application;let e=this.__registry__=new Cl({fallback:this.base.__registry__});this.__container__=e.container({owner:this}),this._booted=!1}_bootPromise=null;boot(t){return this._bootPromise||(this._bootPromise=new hu.Promise(e=>{e(this._bootSync(t))})),this._bootPromise}_bootSync(t){return this._booted||(this.cloneParentDependencies(),this.setupRegistry(t),this.base.runInstanceInitializers(this),this._booted=!0),this}setupRegistry(t=this.__container__.lookup("-environment:main")){this.constructor.setupRegistry(this.__registry__,t)}unregister(t){this.__container__.reset(t),this.__registry__.unregister(t)}buildChildEngineInstance(t,e={}){let n=this.lookup(`engine:${t}`);if(!n)throw new Error(`You attempted to mount the engine '${t}', but it is not registered with its parent.`);let i=n.buildInstance(e);return i[ud]=this,i}cloneParentDependencies(){const t=hd(this);["route:basic","service:-routing"].forEach(e=>{let n=t.resolveRegistration(e);this.register(e,n)});let e=t.lookup("-environment:main");this.register("-environment:main",e,{instantiate:!1});let n=["router:main",Tl`-bucket-cache:main`,"-view-registry:main","renderer:-dom","service:-document"];e.isInteractive&&n.push("event_dispatcher:main"),n.forEach(e=>{let n=t.lookup(e);this.register(e,n,{instantiate:!1})})}}let pd=function(t,e,n){let{get:i}=n;return void 0!==i&&(n.get=function(){let t,n=on(this,e),r=Ge(()=>{t=i.call(this)});return me(n,r),De(r),t}),n};function fd(...t){if(xr(t)){let[e,n,i]=t;return pd(0,n,i)}{const e=t[0];let n=function(t,n){return pd(0,n,e)};return Ar(n),n}}Ar(fd);var gd=Object.create;function md(){var t=gd(null);return t.__=void 0,delete t.__,t}var yd=function(t,e,n){this.path=t,this.matcher=e,this.delegate=n};yd.prototype.to=function(t,e){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),e){if(0===e.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,e,this.delegate)}};var _d=function(t){this.routes=md(),this.children=md(),this.target=t};function vd(t,e,n){return function(i,r){var s=t+i;if(!r)return new yd(s,e,n);r(vd(s,e,n))}}function bd(t,e,n){for(var i=0,r=0;r0&&47===e.charCodeAt(0)&&(e=e.substr(1));for(var i=e.split("/"),r=void 0,s=void 0,o=0;o2&&"[]"===s.slice(o-2)&&(a=!0,n[s=s.slice(0,o-2)]||(n[s]=[])),l=r[1]?qd(r[1]):""),a?n[s].push(l):n[s]=l}return n},Vd.prototype.recognize=function(t){var e,n=[this.rootState],i={},r=!1,s=t.indexOf("#");-1!==s&&(t=t.substr(0,s));var o=t.indexOf("?");if(-1!==o){var a=t.substr(o+1,t.length);t=t.substr(0,o),i=this.parseQueryString(a)}"/"!==t.charAt(0)&&(t="/"+t);var l=t;Vd.ENCODE_AND_DECODE_PATH_SEGMENTS?t=xd(t):(t=decodeURI(t),l=decodeURI(l));var c=t.length;c>1&&"/"===t.charAt(c-1)&&(t=t.substr(0,c-1),l=l.substr(0,l.length-1),r=!0);for(var u=0;u0){let r=t[i-1];if(function(t){if(t&&"object"==typeof t){let e=t;return"queryParams"in e&&Object.keys(e.queryParams).every(t=>"string"==typeof t)}return!1}(r))return n=r.queryParams,e=Wd.call(t,0,i-1),[e,n]}return[t,null]}function Yd(t){for(let e in t){let n=t[e];if("number"==typeof n)t[e]=""+n;else if(Array.isArray(n))for(let t=0,e=n.length;t{throw this.router.transitionDidError(t,this)},np("Handle Abort"))}else this.promise=Tc.resolve(this[ip]),this[rp]={}}then(t,e,n){return this.promise.then(t,e,n)}catch(t,e){return this.promise.catch(t,e)}finally(t,e){return this.promise.finally(t,e)}abort(){this.rollback();let t=new ap(this.router,void 0,void 0,void 0);return t.to=this.from,t.from=this.from,t.isAborted=!0,this.router.routeWillChange(t),this.router.routeDidChange(t),this}rollback(){this.isAborted||(Zd(this.router,this.sequence,this.targetName+": transition was aborted"),void 0!==this.intent&&null!==this.intent&&(this.intent.preTransitionState=this.router.state),this.isAborted=!0,this.isActive=!1,this.router.activeTransition=void 0)}redirect(t){this[op]=t,this.rollback(),this.router.routeWillChange(t)}retry(){this.abort();let t=this.router.transitionByIntent(this.intent,!1);return null!==this.urlMethod&&t.method(this.urlMethod),t}method(t){return this.urlMethod=t,this}send(t=!1,e,n,i,r){this.trigger(t,e,n,i,r)}trigger(t=!1,e,...n){"string"==typeof t&&(e=t,t=!1),this.router.triggerEvent(this[ip].routeInfos.slice(0,this.resolveIndex+1),t,e,n)}followRedirects(){return this.promise.catch(t=>this[op]?this[op].followRedirects():Tc.reject(t))}toString(){return"Transition (sequence "+this.sequence+")"}log(t){Zd(this.router,this.sequence,t)}}function lp(t){return Zd(t.router,t.sequence,"detected abort."),$d()}function cp(t){return"object"==typeof t&&t instanceof ap&&t.isTransition}const up=function(){function t(e){let n=Error.call(this,e);this.name="UnrecognizedURLError",this.message=e||"UnrecognizedURL",Error.captureStackTrace?Error.captureStackTrace(this,t):this.stack=n.stack}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}();function hp(t,e){let n=t.factoryFor("controller:basic").class;n=class extends n{toString(){return`(generated ${e} controller)`}};let i=`controller:${e}`;return t.register(i,n),t.factoryFor(i)}function dp(t,e){hp(t,e);let n=`controller:${e}`;return t.lookup(n)}const pp=/\./g;function fp(t){let e,n,i=(t=t.slice())[t.length-1];return function(t){if(t&&"object"==typeof t){let e=t.queryParams;if(e&&"object"==typeof e)return Object.keys(e).every(t=>"string"==typeof t)}return!1}(i)?(t.pop(),e=i.queryParams):e={},"string"==typeof t[0]&&(n=t.shift()),{routeName:n,models:t,queryParams:e}}function gp(t,e){if(e._namesStashed)return;let n,i=e[e.length-1].name,r=t._routerMicrolib.recognizer.handlersFor(i);for(let s=0;s(t[e]=n,t),s)}serializeQueryParamKey(t){return t}serializeQueryParam(t,e,n){return this._router._serializeQueryParam(t,n)}deserializeQueryParam(t,e,n){return this._router._deserializeQueryParam(t,n)}_optionsForQueryParam(t){const e=Ss(this,"queryParams");return Ss(e,t.urlKey)||Ss(e,t.prop)||e[t.urlKey]||e[t.prop]||{}}resetController(t,e,n){return this}exit(t){this.deactivate(t),this.trigger("deactivate",t),this.teardownViews()}_internalReset(t,e){let n=this.controller;n._qpDelegate=Ss(this,"_qp").states.inactive,this.resetController(n,t,e)}enter(t){this[xp]=void 0,this.activate(t),this.trigger("activate",t)}deactivate(t){}activate(t){}intermediateTransitionTo(...t){let[e,...n]=function(t,e){let n,i=ur(t),r=i.mountPoint;if(i.routable&&"string"==typeof e[0]){if(n=e[0],vp(n))throw new Error("Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.");n=`${r}.${n}`,e[0]=n}return e}(this,t);this._router.intermediateTransitionTo(e,...n)}refresh(){return this._router._routerMicrolib.refresh(this)}setup(t,e){let n=this.controllerName||this.routeName,i=this.controllerFor(n,!0)??this.generateController(n),r=Ss(this,"_qp");if(!this.controller){let t=r.propertyNames;!function(t,e){e.forEach(e=>{if(void 0===Mr(t,e)){let n=_t(t,e);null===n||"function"!=typeof n.get&&"function"!=typeof n.set||ms(t,e,fd({get:n.get,set:n.set}))}Wr(t,`${e}.[]`,t,t._qpChanged,!1)})}(i,t),this.controller=i}let s=r.states;if(i._qpDelegate=s.allowOverrides,e){gp(this._router,e[ip].routeInfos);let t=this._bucketCache,n=e[rp];r.propertyNames.forEach(e=>{let s=r.map[e];s.values=n;let o=yp(s.route.fullRouteName,s.parts,s.values),a=t.lookup(o,e,s.undecoratedDefaultValue);Ls(i,e,a)});let s=Ep(this,e[ip]);Qs(i,s)}this.setupController(i,t,e),this._environment.options.shouldRender&&this[wp](),ts(!1)}_qpChanged(t,e,n){if(!n)return;let i=this._bucketCache,r=yp(n.route.fullRouteName,n.parts,n.values);i.stash(r,t,e)}beforeModel(t){}afterModel(t,e){}redirect(t,e){}contextDidChange(){this.currentModel=this.context}model(t,e){let n,i,r=Ss(this,"_qp").map;for(let s in t){if("queryParams"===s||r&&s in r)continue;let t=s.match(/^(.*)_id$/);null!==t&&(n=t[1]),i=!0}if(!n){if(i)return Object.assign({},t);if(e.resolveIndex<1)return;return e[ip].routeInfos[e.resolveIndex-1].context}}deserialize(t,e){return this.model(this._paramsFor(this.routeName,t),e)}setupController(t,e,n){t&&void 0!==e&&Ls(t,"model",e)}controllerFor(t,e=!1){let n=ur(this),i=n.lookup(`route:${t}`);return i&&i.controllerName&&(t=i.controllerName),n.lookup(`controller:${t}`)}generateController(t){return dp(ur(this),t)}modelFor(t){let e,n=ur(this),i=this._router&&this._router._routerMicrolib?this._router._routerMicrolib.activeTransition:void 0;e=n.routable&&void 0!==i?Rp(n,t):t;let r=n.lookup(`route:${e}`);if(null!=i){let t=r&&r.routeName||e;if(Object.prototype.hasOwnProperty.call(i.resolvedModels,t))return i.resolvedModels[t]}return r?.currentModel}[xp]=void 0;[wp](){this[xp]=function(t){let e,n=ur(t),i=t.routeName,r=n.lookup(`controller:${t.controllerName||i}`),s=t.currentModel,o=n.lookup(`template:${t.templateName||i}`);return e=o?zi(o)?o:o(n):t._topLevelViewTemplate(n),{owner:n,name:i,controller:r,model:s,template:e}}(this),ba(this._router,"_setOutlets")}willDestroy(){this.teardownViews()}teardownViews(){this[xp]&&(this[xp]=void 0,ba(this._router,"_setOutlets"))}buildRouteInfoMetadata(){}_paramsFor(t,e){return void 0!==this._router._routerMicrolib.activeTransition?this.paramsFor(t):e}get _store(){const t=ur(this);return this.routeName,{find(e,n){let i=t.factoryFor(`model:${e}`);if(i)return i=i.class,i.find(n)}}}static{kh(this.prototype,"_store",[ps])}get _qp(){let t={},e=this.controllerName||this.routeName,n=ur(this),i=n.lookup(`controller:${e}`),r=Ss(this,"queryParams"),s=Object.keys(r).length>0;i?t=function(t,e){let n={},i={defaultValue:!0,type:!0,scope:!0,as:!0};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]={...t[r],...e[r]},i[r]=!0);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&!i[r]&&(n[r]={...e[r],...t[r]});return n}(function(t){let e={};for(let n of t)_p(n,e);return e}(Ss(i,"queryParams")||[]),r):s&&(i=dp(n,e),t=r);let o=[],a={},l=[];for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;if("unknownProperty"===c||"_super"===c)continue;let n,r=t[c],s=r.scope||"model";"controller"===s&&(n=[]);let u=r.as||this.serializeQueryParamKey(c),h=Ss(i,c);h=Tp(h);let d=r.type||Fh(h),p=this.serializeQueryParam(h,u,d),f=`${e}:${c}`,g={undecoratedDefaultValue:Ss(i,c),defaultValue:h,serializedDefaultValue:p,serializedValue:p,type:d,urlKey:u,prop:c,scopedPropertyName:f,controllerName:e,route:this,parts:n,values:null,scope:s};a[c]=a[u]=a[f]=g,o.push(g),l.push(c)}return{qps:o,map:a,propertyNames:l,states:{inactive:(t,e)=>{let n=a[t];this._qpChanged(t,e,n)},active:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._activeQPChanged(n,e)},allowOverrides:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._updatingQPChanged(n)}}}}static{kh(this.prototype,"_qp",[ps])}}function Cp(t){return t[xp]}function kp(t,e){if(e.fullQueryParams)return e.fullQueryParams;let n=e.routeInfos.every(t=>t.route),i={...e.queryParams};return t._deserializeQueryParams(e.routeInfos,i),n&&(e.fullQueryParams=i),i}function Ep(t,e){e.queryParamsFor=e.queryParamsFor||{};let n=t.fullRouteName,i=e.queryParamsFor[n];if(i)return i;let r=kp(t._router,e),s=e.queryParamsFor[n]={},o=Ss(t,"_qp").qps;for(let a of o){let t=a.prop in r;s[a.prop]=t?r[a.prop]:Tp(a.defaultValue)}return s}function Tp(t){return Array.isArray(t)?id(t.slice()):t}function Rp(t,e){if(t.routable){let n=t.mountPoint;return"application"===e?n:`${n}.${e}`}return e}const Pp=Sp.prototype.serialize;Sp.reopen({mergedProperties:["queryParams"],queryParams:{},templateName:null,controllerName:null,send(...t){if(this._router&&this._router._routerMicrolib||!b())this._router.send(...t);else{let e=t.shift(),n=this.actions[e];if(n)return n.apply(this,t)}},actions:{queryParamsDidChange(t,e,n){let i=Ss(this,"_qp").map,r=Object.keys(t).concat(Object.keys(n));for(let s of r){let t=i[s];if(t&&Ss(this._optionsForQueryParam(t),"refreshModel")&&this._router.currentState){this.refresh();break}}return!0},finalizeQueryParamChange(t,e,n){if("application"!==this.fullRouteName)return!0;if(!n)return;let i,r=n[ip].routeInfos,s=this._router,o=s._queryParamsFor(r),a=s._qpUpdates,l=!1;gp(s,r);for(let c of o.qps){let r,s,o=c.route,u=o.controller,h=c.urlKey in t&&c.urlKey;if(a.has(c.urlKey)?(r=Ss(u,c.prop),s=o.serializeQueryParam(r,c.urlKey,c.type)):h?(s=t[h],void 0!==s&&(r=o.deserializeQueryParam(s,c.urlKey,c.type))):(s=c.serializedDefaultValue,r=Tp(c.defaultValue)),u._qpDelegate=Ss(o,"_qp").states.inactive,s!==c.serializedValue){if(n.queryParamsOnly&&!1!==i){let t=Ss(o._optionsForQueryParam(c),"replace");t?i=!0:!1===t&&(i=!1)}Ls(u,c.prop,r),l=!0}c.serializedValue=s,c.serializedDefaultValue===s||e.push({value:s,visible:!0,key:h||c.urlKey})}!0===l&&ts(!1),i&&n.method("replace"),o.qps.forEach(t=>{let e=Ss(t.route,"_qp");t.route.controller._qpDelegate=Ss(e,"states.active")}),s._qpUpdates.clear()}}});class Mp{cache;constructor(){this.cache=new Map}has(t){return this.cache.has(t)}stash(t,e,n){let i=this.cache.get(t);void 0===i&&(i=new Map,this.cache.set(t,i)),i.set(e,n)}lookup(t,e,n){if(!this.has(t))return n;let i=this.cache.get(t);return i.has(e)?i.get(e):n}}let Ip=0;function Op(t){return"function"==typeof t}class Ap{parent;matches;enableLoadingSubstates;explicitIndex=!1;options;constructor(t=null,e){this.parent=t,this.enableLoadingSubstates=Boolean(e&&e.enableLoadingSubstates),this.matches=[],this.options=e}route(t,e,n){let i,r=null,s=`/_unused_dummy_error_path_route_${t}/:error`;if(Op(e)?(i={},r=e):Op(n)?(i=e,r=n):i=e||{},this.enableLoadingSubstates&&(Lp(this,`${t}_loading`,{resetNamespace:i.resetNamespace}),Lp(this,`${t}_error`,{resetNamespace:i.resetNamespace,path:s})),r){let e=Fp(this,t,i.resetNamespace),n=new Ap(e,this.options);Lp(n,"loading"),Lp(n,"error",{path:s}),r.call(n),Lp(this,t,i,n.generate())}else Lp(this,t,i)}push(t,e,n,i){let r=e.split(".");if(this.options.engineInfo){let t=e.slice(this.options.engineInfo.fullName.length+1),n=Object.assign({localFullName:t},this.options.engineInfo);i&&(n.serializeMethod=i),this.options.addRouteForEngine(e,n)}else if(i)throw new Error(`Defining a route serializer on route '${e}' outside an Engine is not allowed.`);""!==t&&"/"!==t&&"index"!==r[r.length-1]||(this.explicitIndex=!0),this.matches.push(t,e,n)}generate(){let t=this.matches;return this.explicitIndex||this.route("index",{path:"/"}),e=>{for(let n=0;n0){let r=Object.assign({},n);return this.emberRouter._prepareQueryParams(t,e,r),bp(r,i.queryParams)}return!0}}let Dp=new WeakMap;function jp(t,e={},n={includeAttributes:!1,localizeMapUpdates:!1}){const i=new WeakMap;return t.map((r,s)=>{let{name:o,params:a,paramNames:l,context:c,route:u}=r,h=r;if(Dp.has(h)&&n.includeAttributes){let t=Dp.get(h);t=function(t,e){let n={get metadata(){return Up(t)}};return!Object.isExtensible(e)||e.hasOwnProperty("metadata")?Object.freeze(Object.assign({},e,n)):Object.assign(e,n)}(u,t);let e=Np(t,c);return i.set(h,t),n.localizeMapUpdates||Dp.set(h,e),e}const d=n.localizeMapUpdates?i:Dp;let p={find(e,n){let i,r=[];3===e.length&&(r=t.map(t=>d.get(t)));for(let s=0;t.length>s;s++)if(i=d.get(t[s]),e.call(n,i,s,r))return i},get name(){return o},get paramNames(){return l},get metadata(){return Up(r.route)},get parent(){let e=t[s-1];return void 0===e?null:d.get(e)},get child(){let e=t[s+1];return void 0===e?null:d.get(e)},get localName(){let t=this.name.split(".");return t[t.length-1]},get params(){return a},get queryParams(){return e}};return n.includeAttributes&&(p=Np(p,c)),i.set(r,p),n.localizeMapUpdates||Dp.set(r,p),p})}function Np(t,e){let n={get attributes(){return e}};return!Object.isExtensible(t)||t.hasOwnProperty("attributes")?Object.freeze(Object.assign({},t,n)):Object.assign(t,n)}function Up(t){return null!=t&&void 0!==t.buildRouteInfoMetadata?t.buildRouteInfoMetadata():null}class Bp{constructor(t,e,n,i){this._routePromise=void 0,this._route=null,this.params={},this.isResolved=!1,this.name=e,this.paramNames=n,this.router=t,i&&this._processRoute(i)}getModel(t){return Tc.resolve(this.context)}serialize(t){return this.params||{}}resolve(t){return Tc.resolve(this.routePromise).then(e=>(Gd(t),e)).then(()=>this.runBeforeModelHook(t)).then(()=>Gd(t)).then(()=>this.getModel(t)).then(e=>(Gd(t),e)).then(e=>this.runAfterModelHook(t,e)).then(e=>this.becomeResolved(t,e))}becomeResolved(t,e){let n,i=this.serialize(e);t&&(this.stashResolvedModel(t,e),t[rp]=t[rp]||{},t[rp][this.name]=i);let r=e===this.context;!("context"in this)&&r||(n=e);let s=Dp.get(this),o=new qp(this.router,this.name,this.paramNames,i,this.route,n);return void 0!==s&&Dp.set(o,s),o}shouldSupersede(t){if(!t)return!0;let e=t.context===this.context;return t.name!==this.name||"context"in this&&!e||this.hasOwnProperty("params")&&!function(t,e){if(t===e)return!0;if(!t||!e)return!1;for(let n in t)if(t.hasOwnProperty(n)&&t[n]!==e[n])return!1;return!0}(this.params,t.params)}get route(){return null!==this._route?this._route:this.fetchRoute()}set route(t){this._route=t}get routePromise(){return this._routePromise||this.fetchRoute(),this._routePromise}set routePromise(t){this._routePromise=t}log(t,e){t.log&&t.log(this.name+": "+e)}updateRoute(t){return t._internalName=this.name,this.route=t}runBeforeModelHook(t){let e;return t.trigger&&t.trigger(!0,"willResolveModel",t,this.route),this.route&&void 0!==this.route.beforeModel&&(e=this.route.beforeModel(t)),cp(e)&&(e=null),Tc.resolve(e)}runAfterModelHook(t,e){let n,i=this.name;var r;return this.stashResolvedModel(t,e),void 0!==this.route&&void 0!==this.route.afterModel&&(n=this.route.afterModel(e,t)),n=cp(r=n)?null:r,Tc.resolve(n).then(()=>t.resolvedModels[i])}stashResolvedModel(t,e){t.resolvedModels=t.resolvedModels||{},t.resolvedModels[this.name]=e}fetchRoute(){let t=this.router.getRoute(this.name);return this._processRoute(t)}_processRoute(t){return this.routePromise=Tc.resolve(t),null!==(e=t)&&"object"==typeof e&&"function"==typeof e.then?(this.routePromise=this.routePromise.then(t=>this.updateRoute(t)),this.route=void 0):t?this.updateRoute(t):void 0;var e}}class qp extends Bp{constructor(t,e,n,i,r,s){super(t,e,n,r),this.params=i,this.isResolved=!0,this.context=s}resolve(t){return t&&t.resolvedModels&&(t.resolvedModels[this.name]=this.context),Tc.resolve(this)}}class Vp extends Bp{constructor(t,e,n,i,r){super(t,e,n,r),this.params={},i&&(this.params=i)}getModel(t){let e=this.params;t&&t[sp]&&(e={},Kd(e,this.params),e.queryParams=t[sp]);let n,i=this.route;return i.deserialize?n=i.deserialize(e,t):i.model&&(n=i.model(e,t)),n&&cp(n)&&(n=void 0),Tc.resolve(n)}}class $p extends Bp{constructor(t,e,n,i){super(t,e,n),this.context=i,this.serializer=this.router.getSerializer(e)}getModel(t){return void 0!==this.router.log&&this.router.log(this.name+": resolving provided model"),super.getModel(t)}serialize(t){let{paramNames:e,context:n}=this;t||(t=n);let i={};if(Jd(t))return i[e[0]]=t,i;if(this.serializer)return this.serializer.call(null,t,e);if(void 0!==this.route&&this.route.serialize)return this.route.serialize(t,e);if(1!==e.length)return;let r=e[0];return/_id$/.test(r)?i[r]=t.id:i[r]=t,i}}class Gp{constructor(t,e={}){this.router=t,this.data=e}}function Wp(t,e,n){let i=t.routeInfos,r=e.resolveIndex>=i.length?i.length-1:e.resolveIndex,s=e.isAborted;throw new Yp(n,t.routeInfos[r].route,s,t)}function Hp(t,e){if(e.resolveIndex===t.routeInfos.length)return;let n=t.routeInfos[e.resolveIndex],i=Kp.bind(null,t,e);return n.resolve(e).then(i,null,t.promiseLabel("Proceed"))}function Kp(t,e,n){let i=t.routeInfos[e.resolveIndex].isResolved;if(t.routeInfos[e.resolveIndex++]=n,!i){let{route:t}=n;void 0!==t&&t.redirect&&t.redirect(n.context,e)}return Gd(e),Hp(t,e)}class Xp{constructor(){this.routeInfos=[],this.queryParams={},this.params={}}promiseLabel(t){let e="";return Qd(this.routeInfos,function(t){return""!==e&&(e+="."),e+=t.name,!0}),np("'"+e+"': "+t)}resolve(t){let e=this.params;Qd(this.routeInfos,t=>(e[t.name]=t.params||{},!0)),t.resolveIndex=0;let n=Hp.bind(null,this,t),i=Wp.bind(null,this,t);return Tc.resolve(null,this.promiseLabel("Start transition")).then(n,null,this.promiseLabel("Resolve route")).catch(i,this.promiseLabel("Handle error")).then(()=>this)}}class Yp{constructor(t,e,n,i){this.error=t,this.route=e,this.wasAborted=n,this.state=i}}class Zp extends Gp{constructor(t,e,n,i=[],r={},s){super(t,s),this.preTransitionState=void 0,this.name=e,this.pivotHandler=n,this.contexts=i,this.queryParams=r}applyToState(t,e){let n=this.router.recognizer.handlersFor(this.name),i=n[n.length-1].handler;return this.applyToHandlers(t,n,i,e,!1)}applyToHandlers(t,e,n,i,r){let s,o,a=new Xp,l=this.contexts.slice(0),c=e.length;if(this.pivotHandler)for(s=0,o=e.length;s=0;--s){let o=e[s],u=o.handler,h=t.routeInfos[s],d=null;if(d=o.names.length>0?s>=c?this.createParamHandlerInfo(u,o.names,l,h):this.getHandlerInfoForDynamicSegment(u,o.names,l,h,n,s):this.createParamHandlerInfo(u,o.names,l,h),r){d=d.becomeResolved(null,d.context);let t=h&&h.context;o.names.length>0&&void 0!==h.context&&d.context===t&&(d.params=h&&h.params),d.context=t}let p=h;(s>=c||d.shouldSupersede(h))&&(c=Math.min(s,c),p=d),i&&!r&&(p=p.becomeResolved(null,p.context)),a.routeInfos.unshift(p)}if(l.length>0)throw new Error("More context objects were passed than there are dynamic segments for the route: "+n);return i||this.invalidateChildren(a.routeInfos,c),Kd(a.queryParams,this.queryParams||{}),i&&t.queryParams&&Kd(a.queryParams,t.queryParams),a}invalidateChildren(t,e){for(let n=e,i=t.length;n0){if(o=n[n.length-1],Jd(o))return this.createParamHandlerInfo(t,e,n,i);n.pop()}else{if(i&&i.name===t)return i;if(!this.preTransitionState)return i;{let t=this.preTransitionState.routeInfos[s];o=null==t?void 0:t.context}}return new $p(this.router,t,e,o)}createParamHandlerInfo(t,e,n,i){let r={},s=e.length,o=[];for(;s--;){let a=i&&t===i.name&&i.params||{},l=n[n.length-1],c=e[s];Jd(l)?r[c]=""+n.pop():a.hasOwnProperty(c)?r[c]=a[c]:o.push(c)}if(o.length>0)throw new Error(`You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route ${t}. Missing params: ${o}`);return new Vp(this.router,t,e,r)}}class Jp extends Gp{constructor(t,e,n){super(t,n),this.url=e,this.preTransitionState=void 0}applyToState(t){let e,n,i=new Xp,r=this.router.recognizer.recognize(this.url);if(!r)throw new up(this.url);let s=!1,o=this.url;function a(t){if(t&&t.inaccessibleByURL)throw new up(o);return t}for(e=0,n=r.length;e=0&&i;--n){let r=e[n],s=r.handler;t.add(e,{as:s}),i="/"===r.path||""===r.path||".index"===s.slice(-6)}})}hasRoute(t){return this.recognizer.hasRoute(t)}queryParamsTransition(t,e,n,i){if(this.fireQueryParamDidChange(i,t),!e&&this.activeTransition)return this.activeTransition;{let t=new ap(this,void 0,void 0);return t.queryParamsOnly=!0,n.queryParams=this.finalizeQueryParamChange(i.routeInfos,i.queryParams,t),t[sp]=i.queryParams,this.toReadOnlyInfos(t,i),this.routeWillChange(t),t.promise=t.promise.then(e=>(t.isAborted||(this._updateURL(t,n),this.didTransition(this.currentRouteInfos),this.toInfos(t,i.routeInfos,!0),this.routeDidChange(t)),e),null,np("Transition complete")),t}}transitionByIntent(t,e){try{return this.getTransitionByIntent(t,e)}catch(n){return new ap(this,t,void 0,n,void 0)}}recognize(t){let e=new Jp(this,t),n=this.generateNewState(e);if(null===n)return n;let i=jp(n.routeInfos,n.queryParams,{includeAttributes:!1,localizeMapUpdates:!0});return i[i.length-1]}recognizeAndLoad(t){let e=new Jp(this,t),n=this.generateNewState(e);if(null===n)return Tc.reject(`URL ${t} was not recognized`);let i=new ap(this,e,n,void 0);return i.then(()=>{let t=jp(n.routeInfos,i[sp],{includeAttributes:!0,localizeMapUpdates:!1});return t[t.length-1]})}generateNewState(t){try{return t.applyToState(this.state,!1)}catch(e){return null}}getTransitionByIntent(t,e){let n,i=!!this.activeTransition,r=i?this.activeTransition[ip]:this.state,s=t.applyToState(r,e),o=tp(r.queryParams,s.queryParams);if(tf(s.routeInfos,r.routeInfos)){if(o){let t=this.queryParamsTransition(o,i,r,s);return t.queryParamsOnly=!0,t}return this.activeTransition||new ap(this,void 0,void 0)}if(e){let t=new ap(this,void 0,s);return t.isIntermediate=!0,this.toReadOnlyInfos(t,s),this.setupContexts(s,t),this.routeWillChange(t),this.activeTransition}return n=new ap(this,t,s,void 0,this.activeTransition),function(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;nthis.finalizeTransition(n,t),null,np("Settle transition promise when transition is finalized")),i||this.notifyExistingHandlers(s,n),this.fireQueryParamDidChange(s,o),n}doTransition(t,e=[],n=!1){let i,r=e[e.length-1],s={};if(r&&Object.prototype.hasOwnProperty.call(r,"queryParams")&&(s=e.pop().queryParams),void 0===t){Zd(this,"Updating query params");let{routeInfos:t}=this.state;i=new Zp(this,t[t.length-1].name,void 0,[],s)}else"/"===t.charAt(0)?(Zd(this,"Attempting URL transition to "+t),i=new Jp(this,t)):(Zd(this,"Attempting transition to "+t),i=new Zp(this,t,void 0,e,s));return this.transitionByIntent(i,n)}finalizeTransition(t,e){try{Zd(t.router,t.sequence,"Resolved all models on destination route; finalizing transition.");let n=e.routeInfos;return this.setupContexts(e,t),t.isAborted?(this.state.routeInfos=this.currentRouteInfos,Tc.reject(lp(t))):(this._updateURL(t,e),t.isActive=!1,this.activeTransition=void 0,this.triggerEvent(this.currentRouteInfos,!0,"didTransition",[]),this.didTransition(this.currentRouteInfos),this.toInfos(t,e.routeInfos,!0),this.routeDidChange(t),Zd(this,t.sequence,"TRANSITION COMPLETE."),n[n.length-1].route)}catch(i){if("object"!=typeof(n=i)||null===n||"TRANSITION_ABORTED"!==n.code){let e=t[ip].routeInfos;t.trigger(!0,"error",i,t,e[e.length-1].route),t.abort()}throw i}var n}setupContexts(t,e){let n,i,r,s=this.partitionRoutes(this.state,t);for(n=0,i=s.exited.length;n=0;--o){let t=i[o];Kd(s,t.params),t.route.inaccessibleByURL&&(n=null)}if(n){s.queryParams=t._visibleQueryParams||e.queryParams;let i=this.recognizer.generate(r,s),o=t.isCausedByInitialTransition,a="replace"===n&&!t.isCausedByAbortingTransition,l=t.queryParamsOnly&&"replace"===n,c="replace"===n&&t.isCausedByAbortingReplaceTransition;o||a||l||c?this.replaceURL(i):this.updateURL(i)}}finalizeQueryParamChange(t,e,n){for(let s in e)e.hasOwnProperty(s)&&null===e[s]&&delete e[s];let i=[];this.triggerEvent(t,!0,"finalizeQueryParamChange",[e,i,n]),n&&(n._visibleQueryParams={});let r={};for(let s=0,o=i.length;s0){let n=jp(e,Object.assign({},this._lastQueryParams),{includeAttributes:!0,localizeMapUpdates:!1});t.from=n[n.length-1]||null}}toInfos(t,e,n=!1){if(void 0!==t&&e.length>0){let i=jp(e,Object.assign({},t[sp]),{includeAttributes:n,localizeMapUpdates:!1});t.to=i[i.length-1]||null}}notifyExistingHandlers(t,e){let n,i,r,s,o=this.state.routeInfos;for(i=o.length,n=0;n{t.setURL(n),Ls(e,"currentURL",n)})}didTransition(t){e.didTransition(t)}willTransition(t,n){e.willTransition(t,n)}triggerEvent(t,n,i,r){return hf.bind(e)(t,n,i,r)}routeWillChange(t){e.trigger("routeWillChange",t),e._routerService.trigger("routeWillChange",t),t.isIntermediate&&e.set("currentRoute",t.to)}routeDidChange(t){e.set("currentRoute",t.to),ba(()=>{e.trigger("routeDidChange",t),e._routerService.trigger("routeDidChange",t)})}transitionDidError(t,n){return t.wasAborted||n.isAborted?lp(n):(n.trigger(!1,"error",t.error,n,t.route),e._isErrorHandled(t.error)?(n.rollback(),this.routeDidChange(n),t.error):(n.abort(),t.error))}replaceURL(n){t.replaceURL?ba(()=>{t.replaceURL(n),Ls(e,"currentURL",n)}):this.updateURL(n)}},s=this.constructor.dslCallbacks||[nf],o=this._buildDSL();o.route("application",{path:"/",resetNamespace:!0,overrideNameAssertion:!0},function(){for(let t=0;tn.factoryFor(`route-map:${t}`),addRouteForEngine(t,n){e._engineInfoByRoute[t]||(e._engineInfoByRoute[t]=n)}};return new Ap(null,i)}_resetQueuedQueryParameterChanges(){this._queuedQPChanges={}}_hasModuleBasedResolver(){let t=Ss(sl(this),"application.__registry__.resolver.moduleBasedResolver");return Boolean(t)}startRouting(){if(this.setupRouter()){let t=Ss(this,"initialURL");void 0===t&&(t=Ss(this,"location").getURL());let e=this.handleURL(t);if(e&&e.error)throw e.error}}setupRouter(){if(this._didSetupRouter)return!1;this._didSetupRouter=!0,this._setupLocation();let t=Ss(this,"location");return!Ss(t,"cancelRouterSetup")&&(this._initRouterJs(),t.onUpdateURL(t=>{this.handleURL(t)}),!0)}_setOutlets(){if(this.isDestroying||this.isDestroyed)return;let t=this._routerMicrolib.currentRouteInfos;if(!t)return;let e=null,n=null;for(let i of t){let t=Cp(i.route);if(!t)break;{let i={render:t,outlets:{main:void 0}};n?n.outlets.main=i:e=i,n=i}}if(null!==e)if(this._toplevelView)this._toplevelView.setOutletState(e);else{let t=sl(this),n=t.factoryFor("view:-outlet"),i=t.lookup("application:main"),r=t.lookup("-environment:main"),s=t.lookup("template:-outlet");this._toplevelView=n.create({environment:r,template:s,application:i}),this._toplevelView.setOutletState(e);let o=t.lookup("-application-instance:main");o&&o.didCreateRootView(this._toplevelView)}}handleURL(t){let e=t.split(/#(.+)?/)[0];return this._doURLTransition("handleURL",e)}_doURLTransition(t,e){this._initialTransitionStarted=!0;let n=this._routerMicrolib[t](e||"/");return ff(n,this),n}transitionTo(...t){if(vp(t[0]))return this._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:i}=fp(t);return this._doTransition(e,n,i)}intermediateTransitionTo(t,...e){this._routerMicrolib.intermediateTransitionTo(t,...e),pf(this)}replaceWith(...t){return this.transitionTo(...t).method("replace")}generate(t,...e){let n=this._routerMicrolib.generate(t,...e);return this.location.formatURL(n)}isActive(t){return this._routerMicrolib.isActive(t)}isActiveIntent(t,e,n){return this.currentState.isActiveIntent(t,e,n)}send(t,...e){this._routerMicrolib.trigger(t,...e)}hasRoute(t){return this._routerMicrolib.hasRoute(t)}reset(){this._didSetupRouter=!1,this._initialTransitionStarted=!1,this._routerMicrolib&&this._routerMicrolib.reset()}willDestroy(){this._toplevelView&&(this._toplevelView.destroy(),this._toplevelView=null),super.willDestroy(),this.reset();let t=this._engineInstances;for(let e in t){let n=t[e];for(let t in n)ma(n[t],"destroy")}}_activeQPChanged(t,e){this._queuedQPChanges[t]=e,ba(this,this._fireQueryParamTransition)}_updatingQPChanged(t){this._qpUpdates.add(t)}_fireQueryParamTransition(){this.transitionTo({queryParams:this._queuedQPChanges}),this._resetQueuedQueryParameterChanges()}_setupLocation(){let t=this.location,e=this.rootURL,n=sl(this);"string"==typeof t&&(t=Ls(this,"location",n.lookup(`location:${t}`))),null!==t&&"object"==typeof t&&(e&&Ls(t,"rootURL",e),"function"==typeof t.initState&&t.initState())}_serializeQueryParams(t,e){gf(this,t,e,(t,n,i)=>{if(i)delete e[t],e[i.urlKey]=i.route.serializeQueryParam(n,i.urlKey,i.type);else{if(void 0===n)return;e[t]=this._serializeQueryParam(n,Fh(n))}})}_serializeQueryParam(t,e){return null==t?t:"array"===e?JSON.stringify(t):`${t}`}_deserializeQueryParams(t,e){gf(this,t,e,(t,n,i)=>{i&&(delete e[t],e[i.prop]=i.route.deserializeQueryParam(n,i.urlKey,i.type))})}_deserializeQueryParam(t,e){return null==t?t:"boolean"===e?"true"===t:"number"===e?Number(t).valueOf():"array"===e?id(JSON.parse(t)):t}_pruneDefaultQueryParamValues(t,e){let n=this._queryParamsFor(t);for(let i in e){let t=n.map[i];t&&t.serializedDefaultValue===e[i]&&delete e[i]}}_doTransition(t,e,n,i){let r=t||function(t){let e=t.activeTransition?t.activeTransition[ip].routeInfos:t.state.routeInfos;return e[e.length-1].name}(this._routerMicrolib);this._initialTransitionStarted=!0;let s={};this._processActiveTransitionQueryParams(r,e,s,n),Object.assign(s,n),this._prepareQueryParams(r,e,s,Boolean(i));let o=this._routerMicrolib.transitionTo(r,...e,{queryParams:s});return ff(o,this),o}_processActiveTransitionQueryParams(t,e,n,i){if(!this._routerMicrolib.activeTransition)return;let r={},s=this._qpUpdates,o=kp(this,this._routerMicrolib.activeTransition[ip]);for(let a in o)s.has(a)||(r[a]=o[a]);this._fullyScopeQueryParams(t,e,i),this._fullyScopeQueryParams(t,e,r),Object.assign(n,r)}_prepareQueryParams(t,e,n,i){let r=df(this,t,e);this._hydrateUnsuppliedQueryParams(r,n,Boolean(i)),this._serializeQueryParams(r.routeInfos,n),i||this._pruneDefaultQueryParamValues(r.routeInfos,n)}_getQPMeta(t){let e=t.route;return e&&Ss(e,"_qp")}_queryParamsFor(t){let e=t[t.length-1].name,n=this._qpCache[e];if(void 0!==n)return n;let i,r=!0,s={},o=[];for(let l of t)if(i=this._getQPMeta(l),i){for(let t of i.qps)o.push(t);Object.assign(s,i.map)}else r=!1;let a={qps:o,map:s};return r&&(this._qpCache[e]=a),a}_fullyScopeQueryParams(t,e,n){let i,r=df(this,t,e).routeInfos;for(let s of r)if(i=this._getQPMeta(s),i)for(let t of i.qps){let e=t.prop in n&&t.prop||t.scopedPropertyName in n&&t.scopedPropertyName||t.urlKey in n&&t.urlKey;e&&e!==t.scopedPropertyName&&(n[t.scopedPropertyName]=n[e],delete n[e])}}_hydrateUnsuppliedQueryParams(t,e,n){let i,r,s,o=t.routeInfos,a=this._bucketCache;for(let l of o)if(i=this._getQPMeta(l),i)for(let n=0,o=i.qps.length;n=0;--n){let i=t[n],r=i.route;if(void 0!==r&&!0!==e(r,i))return}}let af={willResolveModel(t,e,n){this._scheduleLoadingEvent(e,n)},error(t,e,n){let i=this,r=t[t.length-1];of(t,(t,n)=>{if(n!==r){let n=cf(t,"error");if(n)return i._markErrorAsHandled(e),i.intermediateTransitionTo(n,e),!1}let s=lf(t,"error");return!s||(i._markErrorAsHandled(e),i.intermediateTransitionTo(s,e),!1)}),function(t,e){let n,i=[];n=t&&"object"==typeof t&&"object"==typeof t.errorThrown?t.errorThrown:t,e&&i.push(e),n&&(n.message&&i.push(n.message),n.stack&&i.push(n.stack),"string"==typeof n&&i.push(n)),console.error(...i)}(e,`Error while processing route: ${n.targetName}`)},loading(t,e){let n=this,i=t[t.length-1];of(t,(t,r)=>{if(r!==i){let e=cf(t,"loading");if(e)return n.intermediateTransitionTo(e),!1}let s=lf(t,"loading");return s?(n.intermediateTransitionTo(s),!1):e.pivotHandler!==t})}};function lf(t,e){let n=sl(t),{routeName:i,fullRouteName:r,_router:s}=t,o=`${r}_${e}`;return uf(n,s,`${i}_${e}`,o)?o:""}function cf(t,e){let n=sl(t),{routeName:i,fullRouteName:r,_router:s}=t,o="application"===r?e:`${r}.${e}`;return uf(n,s,"application"===i?e:`${i}.${e}`,o)?o:""}function uf(t,e,n,i){let r=e.hasRoute(i),s=t.factoryFor(`template:${n}`)||t.factoryFor(`route:${n}`);return r&&s}function hf(t,e,n,i){if(!t){if(e)return;throw new Error(`Can't trigger action '${n}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`)}let r,s,o,a=!1;for(let c=t.length-1;c>=0;c--)if(r=t[c],s=r.route,o=s&&s.actions&&s.actions[n],o){if(!0!==o.apply(s,i))return void("error"===n&&s._router._markErrorAsHandled(i[0]));a=!0}let l=af[n];if(l)l.call(this,t,...i);else if(!a&&!e)throw new Error(`Nothing handled the action '${n}'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.`)}function df(t,e,n){let i=t._routerMicrolib.applyIntent(e,n),{routeInfos:r,params:s}=i;for(let o of r)o.isResolved?s[o.name]=o.params:s[o.name]=o.serialize(o.context);return i}function pf(t){let e=t._routerMicrolib.currentRouteInfos;if(0===e.length)return;let n=sf._routePath(e),i=e[e.length-1].name,r=t.location.getURL();Ls(t,"currentPath",n),Ls(t,"currentRouteName",i),Ls(t,"currentURL",r)}function ff(t,e){let n=new zp(e,e._routerMicrolib,t[ip]);e.currentState||e.set("currentState",n),e.set("targetState",n),t.promise=t.catch(t=>{if(!e._isErrorHandled(t))throw t;e._clearHandledError(t)},"Transition Error")}function gf(t,e,n,i){let r=t._queryParamsFor(e);for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i(s,n[s],r.map[s])}function mf(t){return void 0!==t.hash?t.hash.substring(0):""}sf.reopen({didTransition:function(){pf(this),this._cancelSlowTransitionTimer(),this.notifyPropertyChange("url"),this.set("currentState",this.targetState)},willTransition:function(){},rootURL:"/",location:"hash",url:ps(function(){let t=Ss(this,"location");if("string"!=typeof t)return t.getURL()})});class yf extends Tu{_hashchangeHandler;_location;init(){this.location=this._location??window.location,this._hashchangeHandler=void 0}getHash(){return mf(this.location)}getURL(){let t=this.getHash().substring(1),e=t;return"/"!==e[0]&&(e="/",t&&(e+=`#${t}`)),e}setURL(t){this.location.hash=t,this.lastSetURL=t}replaceURL(t){this.location.replace(`#${t}`),this.lastSetURL=t}lastSetURL=null;onUpdateURL(t){this._removeEventListener(),this._hashchangeHandler=_a(this,function(){let e=this.getURL();this.lastSetURL!==e&&(this.lastSetURL=null,t(e))}),window.addEventListener("hashchange",this._hashchangeHandler)}formatURL(t){return`#${t}`}willDestroy(){this._removeEventListener()}_removeEventListener(){this._hashchangeHandler&&window.removeEventListener("hashchange",this._hashchangeHandler)}}let _f=!1;function vf(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e,n;return e=16*Math.random()|0,n="x"===t?e:3&e|8,n.toString(16)})}class bf extends Tu{history;_previousURL;_popstateHandler;rootURL="/";getHash(){return mf(this.location)}init(){this._super(...arguments);let t=document.querySelector("base"),e="";null!==t&&t.hasAttribute("href")&&(e=t.getAttribute("href")??""),this.baseURL=e,this.location=this.location??window.location,this._popstateHandler=void 0}initState(){let t=this.history??window.history;this.history=t;let{state:e}=t,n=this.formatURL(this.getURL());e&&e.path===n?this._previousURL=this.getURL():this.replaceState(n)}getURL(){let{location:t,rootURL:e,baseURL:n}=this,i=t.pathname;e=e.replace(/\/$/,""),n=n.replace(/\/$/,"");let r=i.replace(new RegExp(`^${n}(?=/|$)`),"").replace(new RegExp(`^${e}(?=/|$)`),"").replace(/\/\//g,"/");return r+=(t.search||"")+this.getHash(),r}setURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.pushState(t)}replaceURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.replaceState(t)}pushState(t){let e={path:t,uuid:vf()};this.history.pushState(e,"",t),this._previousURL=this.getURL()}replaceState(t){let e={path:t,uuid:vf()};this.history.replaceState(e,"",t),this._previousURL=this.getURL()}onUpdateURL(t){this._removeEventListener(),this._popstateHandler=()=>{(_f||(_f=!0,this.getURL()!==this._previousURL))&&t(this.getURL())},window.addEventListener("popstate",this._popstateHandler)}formatURL(t){let{rootURL:e,baseURL:n}=this;return""!==t?(e=e.replace(/\/$/,""),n=n.replace(/\/$/,"")):"/"===n[0]&&"/"===e[0]&&(n=n.replace(/\/$/,"")),n+e+t}willDestroy(){this._removeEventListener()}_removeEventListener(){this._popstateHandler&&window.removeEventListener("popstate",this._popstateHandler)}}class wf extends Tu{updateCallback;initState(){this._super(...arguments);let{rootURL:t}=this}getURL(){let{path:t,rootURL:e}=this;return e=e.replace(/\/$/,""),t.replace(new RegExp(`^${e}(?=/|$)`),"")}setURL(t){this.path=t}onUpdateURL(t){this.updateCallback=t}handleURL(t){this.path=t,this.updateCallback&&this.updateCallback(t)}formatURL(t){let{rootURL:e}=this;return""!==t&&(e=e.replace(/\/$/,"")),e+t}}function xf(t){return null==t}function Sf(t){if(null==t)return!0;if(!xs(t)&&"number"==typeof t.size)return!t.size;if("object"==typeof t){let e=Ss(t,"size");if("number"==typeof e)return!e;let n=Ss(t,"length");if("number"==typeof n)return!n}return"number"==typeof t.length&&"function"!=typeof t&&!t.length}function Cf(t){return js(t).readOnly()}wf.reopen({path:"",rootURL:"/"});const kf=/[ _]/g,Ef=new sr(1e3,t=>{return(e=t,Of.get(e)).replace(kf,"-");var e}),Tf=/^(-|_)+(.)?/,Rf=/(.)(-|_|\.|\s)+(.)?/g,Pf=/(^|\/|\.)([a-z])/g,Mf=new sr(1e3,t=>{let e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,i)=>e+(i?i.toUpperCase():""),i=t.split("/");for(let r=0;rt.toUpperCase())}),If=/([a-z\d])([A-Z])/g,Of=new sr(1e3,t=>t.replace(If,"$1_$2").toLowerCase());function Af(t){return Ef.get(t)}function Ff(t){return Object.hasOwnProperty.call(t.since,"enabled")||g._ALL_DEPRECATIONS_ENABLED}let Lf=parseFloat(g._OVERRIDE_DEPRECATION_VERSION??or);function zf(t){return function(t,e=Lf){let n=t.replace(/(\.0+)/g,"");return e>=parseFloat(n)}(t.until)}function Df(t){return{options:t,test:!Ff(t),isEnabled:Ff(t)||zf(t),isRemoved:zf(t)}}const jf={DEPRECATE_IMPORT_EMBER:t=>Df({id:`deprecate-import-${Af(t).toLowerCase()}-from-ember`,for:"ember-source",since:{available:"5.10.0",enabled:"6.5.0"},until:"7.0.0",url:`https://deprecations.emberjs.com/id/import-${Af(t).toLowerCase()}-from-ember`}),DEPRECATE_IMPORT_INJECT:Df({for:"ember-source",id:"importing-inject-from-ember-service",since:{available:"6.2.0",enabled:"6.3.0"},until:"7.0.0",url:"https://deprecations.emberjs.com/id/importing-inject-from-ember-service"}),DEPRECATE_AMD_BUNDLES:Df({for:"ember-source",id:"using-amd-bundles",since:{available:"6.10.0",enabled:"6.10.0"},until:"7.0.0",url:"https://deprecations.emberjs.com/id/using-amd-bundles"})};function Nf(t,e){const{options:n}=e;if(e.isRemoved)throw new Error(`The API deprecated by ${n.id} was removed in ember-source ${n.until}. The message was: ${t}. Please see ${n.url} for more details.`)}function Uf(...t){return Ms("service",...t)}class Bf extends nh{static isServiceFactory=!0}const qf=Object.freeze(Object.defineProperty({__proto__:null,default:Bf,inject:function(...t){return Nf("Importing `inject` from `@ember/service` is deprecated. Please import `service` instead.",jf.DEPRECATE_IMPORT_INJECT),Ms("service",...t)},service:Uf},Symbol.toStringTag,{value:"Module"})),Vf=Symbol("ROUTER");function $f(t,e){return"/"===e?t:t.substring(e.length)}class Gf extends(Bf.extend(th)){[Vf];get _router(){let t=this[Vf];if(void 0!==t)return t;let e=ur(this).lookup("router:main");return this[Vf]=e}willDestroy(){super.willDestroy(),this[Vf]=void 0}transitionTo(...t){if(vp(t[0]))return this._router._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:i}=fp(t);return this._router._doTransition(e,n,i,!0)}replaceWith(...t){return this.transitionTo(...t).method("replace")}urlFor(t,...e){return this._router.setupRouter(),this._router.generate(t,...e)}isActive(...t){let{routeName:e,models:n,queryParams:i}=fp(t);this._router.setupRouter();let r=this._router._routerMicrolib;if(De(on(this._router,"currentURL")),!r.isActiveIntent(e,n))return!1;if(Object.keys(i).length>0){let t=e;i=Object.assign({},i),this._router._prepareQueryParams(t,n,i,!0);let s=Object.assign({},r.state.queryParams);return this._router._prepareQueryParams(t,n,s,!0),bp(i,s)}return!0}recognize(t){this._router.setupRouter();let e=$f(t,this.rootURL);return this._router._routerMicrolib.recognize(e)}recognizeAndLoad(t){this._router.setupRouter();let e=$f(t,this.rootURL);return this._router._routerMicrolib.recognizeAndLoad(e)}refresh(t){if(!t)return this._router._routerMicrolib.refresh();let e=ur(this).lookup(`route:${t}`);return this._router._routerMicrolib.refresh(e)}static{Sh(this.prototype,"currentRouteName",[Cf("_router.currentRouteName")])}#c=void Eh(this,"currentRouteName");static{Sh(this.prototype,"currentURL",[Cf("_router.currentURL")])}#u=void Eh(this,"currentURL");static{Sh(this.prototype,"location",[Cf("_router.location")])}#h=void Eh(this,"location");static{Sh(this.prototype,"rootURL",[Cf("_router.rootURL")])}#d=void Eh(this,"rootURL");static{Sh(this.prototype,"currentRoute",[Cf("_router.currentRoute")])}#p=void Eh(this,"currentRoute")}class Wf extends Bf{[Vf];get router(){let t=this[Vf];if(void 0!==t)return t;let e=ur(this).lookup("router:main");return e.setupRouter(),this[Vf]=e}hasRoute(t){return this.router.hasRoute(t)}transitionTo(t,e,n,i){let r=this.router._doTransition(t,e,n);return i&&r.method("replace"),r}normalizeQueryParams(t,e,n){this.router._prepareQueryParams(t,e,n)}_generateURL(t,e,n){let i={};return n&&(Object.assign(i,n),this.normalizeQueryParams(t,e,i)),this.router.generate(t,...e,{queryParams:i})}generateURL(t,e,n){if(this.router._initialTransitionStarted)return this._generateURL(t,e,n);try{return this._generateURL(t,e,n)}catch(i){return}}isActiveForRoute(t,e,n,i){let r=this.router._routerMicrolib.recognizer.handlersFor(n),s=r[r.length-1].handler,o=function(t,e){let n=0;for(let i=0;io&&(n=s),i.isActiveIntent(n,t,e)}}Wf.reopen({targetState:Cf("router.targetState"),currentState:Cf("router.currentState"),currentRouteName:Cf("router.currentRouteName"),currentPath:Cf("router.currentPath")});class Hf{constructor(t){this.buffer=t,this.size=0}encode(t,e,...n){if(t>255)throw new Error(`Opcode type over 8-bits. Got ${t}.`);let i=t|e|arguments.length-2<<8;this.buffer.push(i);for(const r of n)this.buffer.push(r);this.size=this.buffer.length}patch(t,e){if(-1!==this.buffer[t+1])throw new Error("Trying to patch operand in populated slot instead of a reserved slot.");this.buffer[t+1]=e}}const Kf=32,Xf=31;function Yf(t){return(t|=0)<0?function(t){return-536870913&t}(t):function(t){return~t}(t)}function Zf(t){return e=>{if(!function(t){return Array.isArray(t)&&2===t.length}(e))return!1;let n=e[0];return n===Xf||n===Kf||n===t}}[1,-1].forEach(t=>{return e=Yf(t),(e|=0)>-536870913?function(t){return~t}(e):function(t){return 536870912|t}(e);var e});const Jf=Zf(39),Qf=Zf(38),tg=Zf(37),eg=Zf(35);function ng(t,e,n,i){let{symbols:{upvars:r}}=n,s=r[t[1]],o=e?.lookupBuiltInHelper?.(s)??null;return i.helper(o,s)}function ig(t){return{type:1,value:t}}function rg(t){return{type:5,value:t}}function sg(t){return{type:7,value:t}}function og(t){return{type:8,value:t}}class ag{label(t,e){this.labels[t]=e}target(t,e){this.targets.push({at:t,target:e})}patch(t){let{targets:e,labels:n}=this;for(const{at:i,target:r}of e){let e=n[r]-i;t.getbyaddr(i),t.setbyaddr(i,e)}}constructor(){this.labels=_n(),this.targets=[]}}function lg(t,e,n,i){let{program:{constants:r},resolver:s}=e;if(function(t){return t<1e3}(i[0])){let[e,...n]=i;t.push(r,e,...n)}else switch(i[0]){case 1e3:return t.label(i[1]);case 1001:return t.startLabels();case 1002:return t.stopLabels();case 1004:return function(t,e,n,[,i,r]){if(Jf(i),i[0]===Kf){let{scopeValues:t,owner:s,symbols:{lexical:o}}=n,a=t[i[1]];r(e.component(a,s,!1,o?.at(i[1])))}else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupComponent?.(a,o)??null;r(e.resolvedComponent(l,a))}}(s,r,n,i);case 1003:return function(t,e,n,[,i,r]){Qf(i);let s=i[0];if(s===Kf){let{scopeValues:t,symbols:{lexical:s}}=n,o=t[i[1]];r(e.modifier(o,s?.at(i[1])??void 0))}else if(s===Xf){let{symbols:{upvars:s}}=n,o=s[i[1]],a=t?.lookupBuiltInModifier?.(o)??null;r(e.modifier(a,o))}else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupModifier?.(a,o)??null;r(e.modifier(l))}}(s,r,n,i);case 1005:return function(t,e,n,[,i,r]){tg(i);let s=i[0];if(s===Kf){let{scopeValues:t}=n,s=t[i[1]];r(e.helper(s))}else if(s===Xf)r(ng(i,t,n,e));else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupHelper?.(a,o)??null;r(e.helper(l,a))}}(s,r,n,i);case 1007:return function(t,e,n,[,i,{ifComponent:r,ifHelper:s}]){eg(i);let o=i[0];if(o===Kf){let{scopeValues:t,owner:o,symbols:{lexical:a}}=n,l=t[i[1]],c=e.component(l,o,!0,a?.at(i[1]));if(null!==c)return void r(c);s(e.helper(l,null,!0))}else if(o===Xf)s(ng(i,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[i[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)r(e.resolvedComponent(c,l));else{let n=t?.lookupHelper?.(l,a)??null;s(e.helper(n,l))}}}(s,r,n,i);case 1008:return function(t,e,n,[,i,{ifComponent:r,ifHelper:s,ifValue:o}]){eg(i);let a=i[0];if(a===Kf){let{scopeValues:t,owner:a,symbols:{lexical:l}}=n,c=t[i[1]];if("function"!=typeof c&&("object"!=typeof c||null===c))return void o(e.value(c));let u=e.component(c,a,!0,l?.at(i[1]));if(null!==u)return void r(u);let h=e.helper(c,null,!0);if(null!==h)return void s(h);o(e.value(c))}else if(a===Xf)s(ng(i,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[i[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)return void r(e.resolvedComponent(c,l));let u=t?.lookupHelper?.(l,a)??null;null!==u&&s(e.helper(u,l))}}(s,r,n,i);case 1010:{let[,t,e]=i;e(n.symbols.upvars[t],n.moduleName);break}case 1011:{let[,t,e]=i,s=n.scopeValues[t];e(r.value(s));break}default:throw new Error(`Unexpected high level opcode ${i[0]}`)}}class cg{constructor(t,e,n){this.heap=t,this.meta=e,this.stdlib=n,this.labelsStack=new wn,this.encoder=new Hf([]),this.errors=[],this.handle=t.malloc()}error(t){this.encoder.encode(30,0),this.errors.push(t)}commit(t){let e=this.handle;return this.heap.pushMachine(5),this.heap.finishMalloc(e,t),(n=this.errors)&&n.length>0?{errors:this.errors,handle:e}:e;var n}push(t,e,...n){let{heap:i}=this;var r;let s=e|((r=e)>=0&&r<=15?si:0)|n.length<<8;i.pushRaw(s);for(let o=0;o=-536870912?Yf(n):function(t){return{type:6,value:t}}(n)),t(30,n)}function yg(t,e,n,i){t(0),kg(t,n,i,!1),t(16,e),t(1),t(36,8)}function _g(t,e,n,i){t(0),kg(t,e,n,!1),t(33,2,1),t(107),i?(t(36,8),i(),t(1),t(34,1)):(t(1),t(34,1),t(36,8))}function vg(t,e,n,i,r){t(0),kg(t,i,r,!1),t(86),fg(t,n),t(77,e,{type:2,value:void 0}),t(1),t(36,8)}function bg(t,e,n){kg(t,n,null,!0),t(23,e),t(24),t(61),t(64),t(40),t(1)}function wg(t,e){!function(t,e){null!==e?t(63,sg({parameters:e})):mg(t,null)}(t,e&&e[1]),t(62),Cg(t,e)}function xg(t,e){t(0),Cg(t,e),t(61),t(2),t(1)}function Sg(t,e,n){let i=e[1],r=i.length,s=Math.min(n,r);if(0!==s){if(t(0),s){t(39);for(let e=0;e{for(let n of e)fg(t,n);t(27,e.length)}),dg.add(28,(t,[,e,n,i])=>{tg(e)?t(1005,e,e=>{yg(t,e,n,i)}):(fg(t,e),_g(t,n,i))}),dg.add(50,(t,[,e,n,i,r])=>{vg(t,n,e,i,r)}),dg.add(30,(t,[,e,n])=>{t(21,e),pg(t,n)}),dg.add(Kf,(t,[,e,n])=>{t(1011,e,e=>{t(29,e),pg(t,n)})}),dg.add(Xf,(t,e)=>{t(1010,e[1],()=>{t(1005,e,e=>{yg(t,e,null,null)})})}),dg.add(37,(t,e)=>{t(1010,e[1],()=>{t(1005,e,e=>{yg(t,e,null,null)})})}),dg.add(27,t=>gg(t,void 0)),dg.add(48,(t,[,e])=>{fg(t,e),t(25)}),dg.add(49,(t,[,e])=>{fg(t,e),t(24),t(61),t(26)}),dg.add(52,(t,[,e,n,i])=>{fg(t,i),fg(t,n),fg(t,e),t(109)}),dg.add(51,(t,[,e])=>{fg(t,e),t(110)}),dg.add(53,(t,[,e])=>{fg(t,e),t(111)}),dg.add(54,(t,[,e])=>{t(0),kg(t,e,null,!1),t(112),t(1),t(36,8)});class Rg{constructor(t){this.blocks=t,this.names=t?Object.keys(t):[]}get(t){return this.blocks&&this.blocks[t]||null}has(t){let{blocks:e}=this;return null!==e&&t in e}with(t,e){let{blocks:n}=this;return new Rg(n?Sn({},n,{[t]:e}):{[t]:e})}get hasAny(){return null!==this.blocks}}const Pg=new Rg(null);function Mg(t){if(null===t)return Pg;let e=_n(),[n,i]=t;for(const[r,s]of gn(n))e[s]=i[r];return new Rg(e)}function Ig(t,e,n){let i=[],r=0;n(function(t,e){i.push({match:t,callback:e,label:"CLAUSE"+r++})}),t(69,1),e(),t(1001);for(let s of i.slice(0,-1))t(67,ig(s.label),s.match);for(let s=i.length-1;s>=0;s--){let e=i[s];t(1e3,e.label),t(34,1),e.callback(),0!==s&&t(4,ig("END"))}t(1e3,"END"),t(1002),t(70)}function Og(t,e,n){t(1001),t(0),t(6,ig("ENDINITIAL")),t(69,e()),n(),t(1e3,"FINALLY"),t(70),t(5),t(1e3,"ENDINITIAL"),t(1),t(1002)}function Ag(t,e,n,i){return Og(t,e,()=>{t(66,ig("ELSE")),n(),t(4,ig("FINALLY")),t(1e3,"ELSE"),void 0!==i&&i()})}function Fg(t,e,n,i,r,s){let{compilable:o,capabilities:a,handle:l}=e,c=n?[n,[]]:null,u=Mg(s);o?(t(78,l),function(t,{capabilities:e,layout:n,elementBlock:i,positional:r,named:s,blocks:o}){let{symbolTable:a}=n;if(yi(e,ri.prepareArgs))return void zg(t,{capabilities:e,elementBlock:i,positional:r,named:s,atNames:!0,blocks:o,layout:n});t(36,4),t(33,3,1),t(35,4),t(0);let{symbols:l}=a,c=[],u=[],h=[],d=o.names;if(null!==i){let e=l.indexOf("&attrs");-1!==e&&(wg(t,i),c.push(e))}for(const p of d){let e=l.indexOf(`&${p}`);-1!==e&&(wg(t,o.get(p)),c.push(e))}if(yi(e,ri.createArgs)){let e=Eg(t,r)<<4;e|=8;let n=dn;if(null!==s){n=s[0];let e=s[1];for(let i=0;i0?1:0),t(19,0);for(const p of fn(u))-1===p?t(34,1):t(19,p+1);null!==r&&t(34,r.length);for(const p of fn(c))t(20,p+1);t(28,og(n)),t(61),t(2),t(100,4),t(1),t(40),yi(e,ri.dynamicScope)&&t(60),t(98),t(35,4)}(t,{capabilities:a,layout:o,elementBlock:c,positional:i,named:r,blocks:u})):(t(78,l),zg(t,{capabilities:a,elementBlock:c,positional:i,named:r,atNames:!0,blocks:u}))}function Lg(t,e,n,i,r,s,o,a){let l=n?[n,[]]:null,c=Mg(s);Og(t,()=>(fg(t,e),t(33,3,0),2),()=>{t(66,ig("ELSE")),a?t(81):t(80,{type:2,value:void 0}),t(79),zg(t,{capabilities:!0,elementBlock:l,positional:i,named:r,atNames:o,blocks:c}),t(1e3,"ELSE")})}function zg(t,{capabilities:e,elementBlock:n,positional:i,named:r,atNames:s,blocks:o,layout:a}){let l=!!o,c=!0===e||yi(e,ri.prepareArgs)||!(!r||0===r[0].length),u=o.with("attrs",n);t(36,4),t(33,3,1),t(35,4),t(0),function(t,e,n,i,r){let s=i.names;for(const l of s)wg(t,i.get(l));let o=Eg(t,e)<<4;r&&(o|=8),i.hasAny&&(o|=7);let a=un;if(n){a=n[0];let e=n[1];for(let n=0;n{a?(t(63,sg(a.symbolTable)),t(28,og(a)),t(61)):t(92,4),t(95,4)}),t(35,4)}function Dg(t,e,n,i,r=null){t(97,4),t(59),t(87,0|e),r&&r(),t(88,4),t(90,4),t(38,4),t(19,0),i&&t(17,4),n&&t(18,4),t(34,1),t(96,4),t(100,4),t(1),t(40),t(60),t(98)}const jg=new hg,Ng=["class","id","value","name","type","style","href"],Ug=["div","span","p","a"];function Bg(t){return"string"==typeof t?t:Ug[t]}function qg(t){return"string"==typeof t?t:Ng[t]}function Vg(t){return null===t?null:[t[0].map(t=>`@${t}`),t[1]]}jg.add(3,(t,e)=>t(42,e[1])),jg.add(13,t=>t(55)),jg.add(12,t=>t(54)),jg.add(4,(t,[,e,n,i])=>{Qf(e)?t(1003,e,e=>{t(0),kg(t,n,i,!1),t(57,e),t(1)}):(fg(t,e),t(0),kg(t,n,i,!1),t(33,2,1),t(108),t(1))}),jg.add(14,(t,[,e,n,i])=>{t(51,qg(e),n,i??null)}),jg.add(24,(t,[,e,n,i])=>{t(105,qg(e),n,i??null)}),jg.add(15,(t,[,e,n,i])=>{fg(t,n),t(52,qg(e),!1,i??null)}),jg.add(22,(t,[,e,n,i])=>{fg(t,n),t(52,qg(e),!0,i??null)}),jg.add(16,(t,[,e,n,i])=>{fg(t,n),t(53,qg(e),!1,i??null)}),jg.add(23,(t,[,e,n,i])=>{fg(t,n),t(53,qg(e),!0,i??null)}),jg.add(10,(t,[,e])=>{t(48,Bg(e))}),jg.add(11,(t,[,e])=>{t(89),t(48,Bg(e))}),jg.add(8,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,n,null,i,r)}):Lg(t,e,n,null,i,r,!0,!0)}),jg.add(18,(t,[,e,n])=>bg(t,e,n)),jg.add(17,(t,[,e])=>bg(t,e,null)),jg.add(26,(t,[,e,n,i])=>{t(103,function(t,e,n){return{type:3,value:{locals:t,upvars:e,lexical:n}}}(e,n,i))}),jg.add(1,(t,[,e])=>{if(Array.isArray(e))if(eg(e))t(1008,e,{ifComponent(e){Fg(t,e,null,null,null,null)},ifHelper(e){t(0),yg(t,e,null,null),t(3,rg("cautious-non-dynamic-append")),t(1)},ifValue(e){t(0),t(29,e),t(3,rg("cautious-non-dynamic-append")),t(1)}});else if(28===e[0]){let[,n,i,r]=e;eg(n)?t(1007,n,{ifComponent(e){Fg(t,e,null,i,Vg(r),null)},ifHelper(e){t(0),yg(t,e,i,r),t(3,rg("cautious-non-dynamic-append")),t(1)}}):Ig(t,()=>{fg(t,n),t(106)},e=>{e(0,()=>{t(81),t(79),zg(t,{capabilities:!0,elementBlock:null,positional:i,named:r,atNames:!1,blocks:Mg(null)})}),e(1,()=>{_g(t,i,r,()=>{t(3,rg("cautious-non-dynamic-append"))})})})}else t(0),fg(t,e),t(3,rg("cautious-append")),t(1);else t(41,null==e?"":String(e))}),jg.add(2,(t,[,e])=>{Array.isArray(e)?(t(0),fg(t,e),t(3,rg("trusting-append")),t(1)):t(41,null==e?"":String(e))}),jg.add(6,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,null,n,Vg(i),r)}):Lg(t,e,null,n,i,r,!1,!1)}),jg.add(40,(t,[,e,n,i,r])=>{Ag(t,()=>(fg(t,n),void 0===r?gg(t,void 0):fg(t,r),fg(t,i),t(33,3,0),4),()=>{t(50),xg(t,e),t(56)})}),jg.add(41,(t,[,e,n,i])=>Ag(t,()=>(fg(t,e),t(71),1),()=>{xg(t,n)},i?()=>{xg(t,i)}:void 0)),jg.add(42,(t,[,e,n,i,r])=>Og(t,()=>(n?fg(t,n):gg(t,null),fg(t,e),2),()=>{t(72,ig("BODY"),ig("ELSE")),t(0),t(33,2,1),t(6,ig("ITER")),t(1e3,"ITER"),t(74,ig("BREAK")),t(1e3,"BODY"),Sg(t,i,2),t(34,2),t(4,ig("FINALLY")),t(1e3,"BREAK"),t(1),t(73),t(4,ig("FINALLY")),t(1e3,"ELSE"),r&&xg(t,r)})),jg.add(44,(t,[,e,n])=>{Sg(t,n,Eg(t,e))}),jg.add(45,(t,[,e,n])=>{if(e){let[i,r]=e;Eg(t,r),function(t,e,n){t(59),t(58,e),n(),t(60)}(t,i,()=>{xg(t,n)})}else xg(t,n)}),jg.add(46,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,null,n,Vg(i),r)}):Lg(t,e,null,n,i,r,!1,!1)});class $g{constructor(t,e,n,i="plain block"){this.statements=t,this.meta=e,this.symbolTable=n,this.moduleName=i,this.compiled=null}compile(t){return function(t,e){if(null!==t.compiled)return t.compiled;t.compiled=-1;let{statements:n,meta:i}=t,r=function(t,e,n){let i=jg,r=ug(n,e),{encoder:s,evaluation:o}=r;function a(...t){lg(s,o,e,t)}for(const l of t)i.compile(a,l);return r.encoder.commit(e.size)}(n,i,e);return t.compiled=r,r}(this,t)}}class Gg{constructor(t,e,n,i,r){this.main=t,this.trustingGuardedAppend=e,this.cautiousGuardedAppend=n,this.trustingNonDynamicAppend=i,this.cautiousNonDynamicAppend=r}get"trusting-append"(){return this.trustingGuardedAppend}get"cautious-append"(){return this.cautiousGuardedAppend}get"trusting-non-dynamic-append"(){return this.trustingNonDynamicAppend}get"cautious-non-dynamic-append"(){return this.cautiousNonDynamicAppend}getAppend(t){return t?this.trustingGuardedAppend:this.cautiousGuardedAppend}}function Wg(t,e,n){Ig(t,()=>t(76),i=>{i(2,()=>{e?(t(68),t(43)):t(47)}),"number"==typeof n?(i(0,()=>{t(81),t(79),function(t){t(36,4),t(33,3,1),t(35,4),t(0),t(83),t(85,4),Dg(t,!1,!1,!0,()=>{t(92,4),t(95,4)}),t(35,4)}(t)}),i(1,()=>{_g(t,null,null,()=>{t(3,n)})})):(i(0,()=>{t(47)}),i(1,()=>{t(47)})),i(4,()=>{t(68),t(44)}),i(5,()=>{t(68),t(45)}),i(6,()=>{t(68),t(46)})})}const Hg={symbols:{locals:null,upvars:null},moduleName:"stdlib",scopeValues:null,isStrictMode:!0,owner:null,size:0};function Kg(t,e){let n=new cg(t.program.heap,Hg);e(function(...e){lg(n,t,Hg,e)});let i=n.commit(0);if("number"!=typeof i)throw new Error("Unexpected errors compiling std");return i}class Xg{constructor({constants:t,heap:e},n,i){this.constants=t,this.heap=e,this.resolver=i.resolver,this.createOp=n,this.env=i.env,this.program=i.program,this.stdlib=function(t){let e=Kg(t,t=>function(t){t(75,4),Dg(t,!1,!1,!0)}(t)),n=Kg(t,t=>Wg(t,!0,null)),i=Kg(t,t=>Wg(t,!1,null)),r=Kg(t,t=>Wg(t,!0,n)),s=Kg(t,t=>Wg(t,!1,i));return new Gg(e,r,s,n,i)}(this)}}class Yg{constructor(t,e){this.layout=t,this.moduleName=e,this.compiled=null;let{block:n}=t,[,i]=n;i=i.slice();let r=i.indexOf("&attrs");this.attrsBlockNumber=-1===r?i.push("&attrs"):r+1,this.symbolTable={symbols:i},this.meta=Tg(t)}compile(t){if(null!==this.compiled)return this.compiled;let e=Tg(this.layout),n=ug(t,e),{encoder:i,evaluation:r}=n;var s,o,a;s=function(...t){lg(i,r,e,t)},o=this.layout,a=this.attrsBlockNumber,s(1001),function(t,e,n){t(36,5),n(),t(35,5)}(s,0,()=>{s(91,4),s(31),s(33,3,0)}),s(66,ig("BODY")),s(36,5),s(89),s(49),s(99,4),bg(s,a,null),s(54),s(1e3,"BODY"),xg(s,[o.block[0],[]]),s(36,5),s(66,ig("END")),s(55),s(1e3,"END"),s(35,5),s(1002);let l=n.encoder.commit(e.size);return"number"!=typeof l||(this.compiled=l),l}}let Zg=0,Jg={cacheHit:0,cacheMiss:0};function Qg({id:t,moduleName:e,block:n,scope:i,isStrictMode:r}){let s,o=t||"client-"+Zg++,a=null,l=new WeakMap,c=t=>{if(void 0===s&&(s=JSON.parse(n)),void 0===t)return null===a?(Jg.cacheMiss++,a=new tm({id:o,block:s,moduleName:e,owner:null,scope:i,isStrictMode:r})):Jg.cacheHit++,a;let c=l.get(t);return void 0===c?(Jg.cacheMiss++,c=new tm({id:o,block:s,moduleName:e,owner:t,scope:i,isStrictMode:r}),l.set(t,c)):Jg.cacheHit++,c};return c.__id=o,c.__meta={moduleName:e},c}class tm{constructor(t){this.parsedLayout=t,this.result="ok",this.layout=null,this.wrappedLayout=null}get moduleName(){return this.parsedLayout.moduleName}get id(){return this.parsedLayout.id}get referrer(){return{moduleName:this.parsedLayout.moduleName,owner:this.parsedLayout.owner}}asLayout(){return this.layout?this.layout:this.layout=function(t,e){let[n,i]=t.block;return new $g(n,Tg(t),{symbols:i},e)}(Sn({},this.parsedLayout),this.moduleName)}asWrappedLayout(){return this.wrappedLayout?this.wrappedLayout:this.wrappedLayout=new Yg(Sn({},this.parsedLayout),this.moduleName)}}function em(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}const nm={id:"1b32f5c2-7623-43d6-a0ad-9672898920a1",moduleName:"__default__.hbs",block:JSON.stringify([[[18,1,null]],["&default"],[]]),scope:null,isStrictMode:!0},im=Object.freeze([]),rm=[!1,!0,null,void 0,im],sm=rm.indexOf(im);class om{value(t){let e=this.indexMap,n=e.get(t);return void 0===n&&(n=this.values.push(t)-1,e.set(t,n)),n}array(t){if(0===t.length)return sm;let e=new Array(t.length);for(let n=0;nt}helper(t,e=null,n){let i=this.helperDefinitionCache.get(t);if(void 0===i){let e=Ai(t);if(null===e)return this.helperDefinitionCache.set(t,null),null;let n="function"==typeof e?e:e.getHelper(t);i=this.value(n),this.helperDefinitionCache.set(t,i),this.helperDefinitionCount++}return i}modifier(t,e=null,n){let i=this.modifierDefinitionCache.get(t);if(void 0===i){let n=Mi(t);if(null===n)return this.modifierDefinitionCache.set(t,null),null;let r={resolvedName:e,manager:n,state:t};i=this.value(r),this.modifierDefinitionCache.set(t,i),this.modifierDefinitionCount++}return i}component(t,e,n,i){let r=this.componentDefinitionCache.get(t);if(void 0===r){let n=Li(t);if(null===n)return this.componentDefinitionCache.set(t,null),null;let s,o=fi(n.getCapabilities(t)),a=Ji(t),l=null;s=mi(0,o,ri.dynamicLayout)?a?.(e):a?.(e)??this.defaultTemplate,void 0!==s&&(s=em(s),l=mi(0,o,ri.wrapped)?s.asWrappedLayout():s.asLayout()),r={resolvedName:null,handle:-1,manager:n,capabilities:o,state:t,compilable:l},r.handle=this.value(r),i&&(r.debugName=i),this.componentDefinitionCache.set(t,r),this.componentDefinitionCount++}return r}resolvedComponent(t,e){let n=this.componentDefinitionCache.get(t);if(void 0===n){let{manager:i,state:r,template:s}=t,o=fi(i.getCapabilities(t)),a=null;mi(0,o,ri.dynamicLayout)||(s=s??this.defaultTemplate),null!==s&&(s=em(s),a=mi(0,o,ri.wrapped)?s.asWrappedLayout():s.asLayout()),n={resolvedName:e,handle:-1,manager:i,capabilities:o,state:r,compilable:a},n.handle=this.value(n),this.componentDefinitionCache.set(t,n),this.componentDefinitionCount++}return n}getValue(t){return this.values[t]}getArray(t){let e=this.reifiedArrs,n=e[t];if(void 0===n){let i=this.getValue(t);n=new Array(i.length);for(const[t,e]of gn(i))n[t]=this.getValue(e);e[t]=n}return n}constructor(){this.reifiedArrs={[sm]:im},this.defaultTemplate=Qg(nm)(),this.helperDefinitionCount=0,this.modifierDefinitionCount=0,this.componentDefinitionCount=0,this.values=rm.slice(),this.indexMap=new Map(this.values.map((t,e)=>[t,e])),this.helperDefinitionCache=new WeakMap,this.modifierDefinitionCache=new WeakMap,this.componentDefinitionCache=new WeakMap}}class am{constructor(t){this.heap=t,this.offset=0}get size(){return 1+((768&this.heap.getbyaddr(this.offset))>>8)}get isMachine(){return this.heap.getbyaddr(this.offset)&si?1:0}get type(){return 255&this.heap.getbyaddr(this.offset)}get op1(){return this.heap.getbyaddr(this.offset+1)}get op2(){return this.heap.getbyaddr(this.offset+2)}get op3(){return this.heap.getbyaddr(this.offset+3)}}class lm{constructor(){this.offset=0,this.handle=0,this.heap=new Int32Array(1048576),this.handleTable=[],this.handleState=[]}entries(){return this.offset}pushRaw(t){this.sizeCheck(),this.heap[this.offset++]=t}pushOp(t){this.pushRaw(t)}pushMachine(t){this.pushRaw(t|si)}sizeCheck(){let{heap:t}=this;if(this.offset===this.heap.length){let e=new Int32Array(t.length+1048576);e.set(t,0),this.heap=e}}getbyaddr(t){return this.heap[t]}setbyaddr(t,e){this.heap[t]=e}malloc(){return this.handleTable.push(this.offset),this.handleTable.length-1}finishMalloc(t){}size(){return this.offset}getaddr(t){return this.handleTable[t]}sizeof(t){return this.handleTable,-1}free(t){this.handleState[t]=1}compact(){let t=0,{handleTable:e,handleState:n,heap:i}=this;for(let r=0;r-536870913?function(t){return~t}(t):function(t){return 536870912|t}(t)}[1,-1].forEach(t=>{return gm((e=t,(e|=0)<0?function(t){return-536870913&t}(e):function(t){return~t}(e)));var e});const mm=new class{constructor(){this.evaluateOpcode=new Array(113).fill(null)}add(t,e,n="syscall"){this.evaluateOpcode[t]={syscall:"machine"!==n,evaluate:e}}evaluate(t,e,n){let i=this.evaluateOpcode[n];i.syscall?(e.isMachine,i.syscall,e.isMachine,e.type,i.evaluate(t,e)):(e.isMachine,i.syscall,e.isMachine,e.type,i.evaluate(t.lowlevel,e))}},ym=Symbol("TYPE"),_m=Symbol("INNER"),vm=Symbol("OWNER"),bm=Symbol("ARGS"),wm=Symbol("RESOLVED"),xm=new WeakSet;function Sm(t){return xm.has(t)}function Cm(t,e){return Sm(t)&&t[ym]===e}class km{constructor(t,e,n,i,r=!1){xm.add(this),this[ym]=t,this[_m]=e,this[vm]=n,this[bm]=i,this[wm]=r}}function Em(t){let e,n,i,r,s,o=t;for(;;){let{[bm]:t,[_m]:a}=o;if(null!==t){let{named:i,positional:r}=t;r.length>0&&(e=void 0===e?r:r.concat(e)),void 0===n&&(n=[]),n.unshift(i)}if(!Sm(a)){i=a,r=o[vm],s=o[wm];break}o=a}return{definition:i,owner:r,resolved:s,positional:e,named:n}}function Tm(t,e,n,i,r=!1){return new km(t,e,n,i,r)}class Rm{constructor(t){this.bucket=t?Sn({},t):{}}get(t){return this.bucket[t]}set(t,e){return this.bucket[t]=e}child(){return new Rm(this.bucket)}}class Pm{static root(t,{self:e,size:n=0}){let i=new Array(n+1).fill(Mn);return new Pm(t,i,null).init({self:e})}static sized(t,e=0){let n=new Array(e+1).fill(Mn);return new Pm(t,n,null)}constructor(t,e,n){this.owner=t,this.slots=e,this.callerScope=n}init({self:t}){return this.slots[0]=t,this}snapshot(){return this.slots.slice()}getSelf(){return this.get(0)}getSymbol(t){return this.get(t)}getBlock(t){let e=this.get(t);return e===Mn?null:e}bind(t,e){this.set(t,e)}bindSelf(t){this.set(0,t)}bindSymbol(t,e){this.set(t,e)}bindBlock(t,e){this.set(t,e)}bindCallerScope(t){this.callerScope=t}getCallerScope(){return this.callerScope}child(){return new Pm(this.owner,this.slots.slice(),this.callerScope)}get(t){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);return this.slots[t]}set(t,e){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);this.slots[t]=e}}class Mm{constructor(t,e){this.element=t,this.nextSibling=e}}class Im{constructor(t,e,n){this.parentNode=t,this.first=e,this.last=n}parentElement(){return this.parentNode}firstNode(){return this.first}lastNode(){return this.last}}function Om(t,e){let n=t.parentElement(),i=t.firstNode(),r=t.lastNode(),s=i;for(;;){let t=s.nextSibling;if(n.insertBefore(s,e),s===r)return t;s=t}}function Am(t){let e=t.parentElement(),n=t.firstNode(),i=t.lastNode(),r=n;for(;;){let t=r.nextSibling;if(e.removeChild(r),r===i)return t;r=t}}function Fm(t){return"getDebugCustomRenderTree"in t}let Lm=0;class zm{constructor(t){this.id=Lm++,this.value=t}get(){return this.value}release(){this.value=null}toString(){let t=`Ref ${this.id}`;if(null===this.value)return`${t} (released)`;try{return`${t}: ${this.value}`}catch{return t}}}class Dm{begin(){this.reset()}create(t,e){let n=Sn({},e,{bounds:null,refs:new Set});this.nodes.set(t,n),this.appendChild(n,t),this.enter(t)}update(t){this.enter(t)}didRender(t,e){this.nodeFor(t).bounds=e,this.exit()}willDestroy(t){this.refs.get(t).release()}commit(){this.reset()}capture(){return this.captureRefs(this.roots)}reset(){if(0!==this.stack.size){let t=this.stack.toArray()[0],e=this.refs.get(t);for(void 0!==e&&this.roots.delete(e);!this.stack.isEmpty();)this.stack.pop()}}enter(t){this.stack.push(t)}exit(){this.stack.pop()}nodeFor(t){return this.nodes.get(t)}appendChild(t,e){let n=this.stack.current,i=new zm(e);if(this.refs.set(e,i),n){let e=this.nodeFor(n);e.refs.add(i),t.parent=e}else this.roots.add(i)}captureRefs(t){let e=[];return t.forEach(n=>{let i=n.get();i?e.push(this.captureNode(`render-node:${n.id}`,i)):t.delete(n)}),e}captureNode(t,e){let n=this.nodeFor(e),{type:i,name:r,args:s,instance:o,refs:a}=n,l=this.captureTemplate(n),c=this.captureBounds(n),u=this.captureRefs(a);return{id:t,type:i,name:r,args:vy(s),instance:o,template:l,bounds:c,children:u}}captureTemplate({template:t}){return t||null}captureBounds(t){let e=t.bounds;return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}constructor(){this.stack=new wn,this.refs=new WeakMap,this.roots=new Set,this.nodes=new WeakMap}}function jm(t){return Nm(t)?"":String(t)}function Nm(t){return null==t||"function"!=typeof t.toString}function Um(t){return null!==t&&"object"==typeof t}function Bm(t){return Um(t)&&"function"==typeof t.toHTML}function qm(t){return"string"==typeof t}mm.add(39,t=>t.pushChildScope()),mm.add(40,t=>t.popScope()),mm.add(59,t=>t.pushDynamicScope()),mm.add(60,t=>t.popDynamicScope()),mm.add(28,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),mm.add(29,(t,{op1:e})=>{t.stack.push(Fn(t.constants.getValue(e)))}),mm.add(30,(t,{op1:e})=>{let n=t.stack;if(e>=0){let i=t.constants.getValue(e);n.push(i)}else n.push(gm(e))}),mm.add(31,t=>{let e,n=t.stack,i=n.pop();e=void 0===i?Mn:null===i?In:!0===i?On:!1===i?An:Pn(i),n.push(e)}),mm.add(33,(t,{op1:e,op2:n})=>{let i=t.fetchValue(e)-n;t.stack.dup(i)}),mm.add(34,(t,{op1:e})=>{t.stack.pop(e)}),mm.add(35,(t,{op1:e})=>{t.load(e)}),mm.add(36,(t,{op1:e})=>{t.fetch(e)}),mm.add(58,(t,{op1:e})=>{let n=t.constants.getArray(e);t.bindDynamicScope(n)}),mm.add(69,(t,{op1:e})=>{t.enter(e)}),mm.add(70,t=>{t.exit()}),mm.add(63,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),mm.add(62,t=>{t.stack.push(t.scope())}),mm.add(61,t=>{let e=t.stack,n=e.pop();n?e.push(t.compile(n)):e.push(null)}),mm.add(64,t=>{let{stack:e}=t,n=e.pop(),i=e.pop(),r=e.pop(),s=e.pop();if(null===r||null===n)return t.lowlevel.pushFrame(),void t.pushScope(i??t.scope());let o=i;{let t=r.parameters,e=t.length;if(e>0){o=o.child();for(let n=0;n{let n=t.stack.pop(),i=Boolean(qn(n));Un(n)?i&&t.lowlevel.goto(e):(i&&t.lowlevel.goto(e),t.updateWith(new Vm(n)))}),mm.add(66,(t,{op1:e})=>{let n=t.stack.pop(),i=Boolean(qn(n));Un(n)?i||t.lowlevel.goto(e):(i||t.lowlevel.goto(e),t.updateWith(new Vm(n)))}),mm.add(67,(t,{op1:e,op2:n})=>{t.stack.peek()===n&&t.lowlevel.goto(e)}),mm.add(68,t=>{let e=t.stack.peek();Un(e)||t.updateWith(new Vm(e))}),mm.add(71,t=>{let{stack:e}=t,n=e.pop();e.push(zn(()=>Ot(qn(n))))});class Vm{constructor(t){this.ref=t,this.last=qn(t)}evaluate(t){let{last:e,ref:n}=this;e!==qn(n)&&t.throw()}}class $m{constructor(t,e){this.ref=t,this.filter=e,this.last=e(qn(t))}evaluate(t){let{last:e,ref:n,filter:i}=this;e!==i(qn(n))&&t.throw()}}class Gm{finalize(t,e){this.target=e,this.didModify(t)}evaluate(t){let{tag:e,target:n,lastRevision:i}=this;!t.alwaysRevalidate&&de(e,i)&&(De(e),t.goto(n))}didModify(t){this.tag=t,this.lastRevision=he(this.tag),De(t)}constructor(){this.tag=ve,this.lastRevision=1}}class Wm{constructor(t){this.debugLabel=t}evaluate(){Oe(this.debugLabel)}}class Hm{constructor(t){this.target=t}evaluate(){let t=Ae();this.target.didModify(t)}}mm.add(41,(t,{op1:e})=>{t.tree().appendText(t.constants.getValue(e))}),mm.add(42,(t,{op1:e})=>{t.tree().appendComment(t.constants.getValue(e))}),mm.add(48,(t,{op1:e})=>{t.tree().openElement(t.constants.getValue(e))}),mm.add(49,t=>{let e=qn(t.stack.pop());t.tree().openElement(e)}),mm.add(50,t=>{let e=t.stack.pop(),n=t.stack.pop(),i=t.stack.pop(),r=qn(e),s=qn(n),o=qn(i);Un(e)||t.updateWith(new Vm(e)),void 0===s||Un(n)||t.updateWith(new Vm(n));let a=t.tree().pushRemoteElement(r,o,s);if(t.associateDestroyable(a),void 0!==t.env.debugRenderTree){let i=py(void 0===s?{}:{insertBefore:n},[e]);t.env.debugRenderTree.create(a,{type:"keyword",name:"in-element",args:i,instance:null}),Wt(a,()=>{t.env.debugRenderTree?.willDestroy(a)})}}),mm.add(56,t=>{let e=t.tree().popRemoteElement();void 0!==t.env.debugRenderTree&&t.env.debugRenderTree.didRender(e,e)}),mm.add(54,t=>{let e=t.fetchValue(6),n=null;e&&(n=e.flush(t),t.loadValue(6,null)),t.tree().flushElement(n)}),mm.add(55,t=>{let e=t.tree().closeElement();null!==e&&e.forEach(e=>{t.env.scheduleInstallModifier(e);const n=e.manager.getDestroyable(e.state);null!==n&&t.associateDestroyable(n)})}),mm.add(57,(t,{op1:e})=>{if(!t.env.isInteractive)return;let n=t.getOwner(),i=t.stack.pop(),r=t.constants.getValue(e),{manager:s}=r,{constructing:o}=t.tree(),a=i.capture(),l=s.create(n,o,r.state,a),c={manager:s,state:l,definition:r};t.fetchValue(6).addModifier(t,c,a);let u=s.getTag(l);return null!==u?(De(u),t.updateWith(new Km(u,c))):void 0}),mm.add(108,t=>{if(!t.env.isInteractive)return;let{stack:e}=t,n=e.pop(),i=e.pop().capture(),{positional:r,named:s}=i,{constructing:o}=t.tree(),a=t.getOwner(),l=zn(()=>{let t,e,l=qn(n);if(!bn(l))return;if(Cm(l,2)){let{definition:n,owner:o,positional:a,named:c}=Em(l);e=n,t=o,void 0!==a&&(i.positional=a.concat(r)),void 0!==c&&(i.named=Object.assign({},...c,s))}else e=l,t=a;let c=Mi(e);if(null===c)throw new Error("BUG: modifier manager expected");let u={resolvedName:null,manager:c,state:e},h=c.create(t,o,u.state,i);return{manager:c,state:h,definition:u}}),c=qn(l),u=null;return void 0!==c&&(t.fetchValue(6).addModifier(t,c,i),u=c.manager.getTag(c.state),null!==u&&De(u)),!Un(n)||u?t.updateWith(new Xm(u,c,l)):void 0});class Km{constructor(t,e){this.tag=t,this.modifier=e,this.lastUpdated=he(t)}evaluate(t){let{modifier:e,tag:n,lastUpdated:i}=this;De(n),de(n,i)||(t.env.scheduleUpdateModifier(e),this.lastUpdated=he(n))}}class Xm{constructor(t,e,n){this.tag=t,this.instance=e,this.instanceRef=n,this.lastUpdated=he(t??Ce)}evaluate(t){let{tag:e,lastUpdated:n,instance:i,instanceRef:r}=this,s=qn(r);if(s!==i){if(void 0!==i){let t=i.manager.getDestroyable(i.state);null!==t&&Ht(t)}if(void 0!==s){let{manager:n,state:i}=s,r=n.getDestroyable(i);null!==r&&Gt(this,r),e=n.getTag(i),null!==e&&(this.lastUpdated=he(e)),this.tag=e,t.env.scheduleInstallModifier(s)}this.instance=s}else null===e||de(e,n)||(t.env.scheduleUpdateModifier(i),this.lastUpdated=he(e));null!==e&&De(e)}}mm.add(51,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=i?t.constants.getValue(i):null;t.tree().setStaticAttribute(r,s,o)}),mm.add(52,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=t.stack.pop(),a=qn(o),l=i?t.constants.getValue(i):null,c=t.tree().setDynamicAttribute(r,a,s,l);Un(o)||t.updateWith(new Ym(o,c,t.env))});class Ym{constructor(t,e,n){let i=!1;this.updateRef=zn(()=>{let r=qn(t);i?e.update(r,n):i=!0}),qn(this.updateRef)}evaluate(){qn(this.updateRef)}}mm.add(78,(t,{op1:e})=>{let n=t.constants.getValue(e),{manager:i,capabilities:r}=n,s={definition:n,manager:i,capabilities:r,state:null,handle:null,table:null,lookup:null};t.stack.push(s)}),mm.add(80,(t,{op1:e})=>{let n,i=t.stack,r=qn(i.pop()),s=t.constants,o=t.getOwner();if(s.getValue(e),t.loadValue(7,null),"string"==typeof r){let e=function(t,e,n,i){let r=t?.lookupComponent?.(n,i)??null;return e.resolvedComponent(r,n)}(t.context.resolver,s,r,o);n=e}else n=Sm(r)?r:s.component(r,o);i.push(n)}),mm.add(81,t=>{let e,n=t.stack,i=qn(n.pop()),r=t.constants;e=Sm(i)?i:r.component(i,t.getOwner(),!0),n.push(e)}),mm.add(79,t=>{let e,n,{stack:i}=t,r=i.pop();Sm(r)?n=e=null:(n=r.manager,e=r.capabilities),i.push({definition:r,capabilities:e,manager:n,state:null,handle:null,table:null})}),mm.add(82,(t,{op1:e,op2:n,op3:i})=>{let r=t.stack,s=t.constants.getArray(e),o=i>>4,a=8&i,l=7&i?t.constants.getArray(n):dn;t.args.setup(r,s,l,o,!!a),r.push(t.args)}),mm.add(83,t=>{let{stack:e}=t;e.push(t.args.empty(e))}),mm.add(86,t=>{let e=t.stack,n=e.pop().capture();e.push(n)}),mm.add(85,(t,{op1:e})=>{let n=t.stack,i=t.fetchValue(e),r=n.pop(),{definition:s}=i;if(Cm(s,0)){s.manager;let e=t.constants,{definition:n,owner:o,resolved:a,positional:l,named:c}=Em(s);if(a)s=n;else if("string"==typeof n){let i=t.context.resolver?.lookupComponent?.(n,o)??null;s=e.resolvedComponent(i,n)}else s=e.component(n,o);void 0!==c&&r.named.merge(Sn({},...c)),void 0!==l&&(r.realloc(l.length),r.positional.prepend(l));let{manager:u}=s;i.definition=s,i.manager=u,i.capabilities=s.capabilities,t.loadValue(7,o)}let{manager:o,state:a}=s;if(!mi(0,i.capabilities,ri.prepareArgs))return void n.push(r);let l=r.blocks.values,c=r.blocks.names,u=o.prepareArgs(a,r);if(u){r.clear();for(let r=0;r{let n=t.fetchValue(4),{definition:i,manager:r,capabilities:s}=n;if(!mi(0,s,ri.createInstance))return;let o=null;mi(0,s,ri.dynamicScope)&&(o=t.dynamicScope());let a=1&e,l=null;mi(0,s,ri.createArgs)&&(l=t.stack.peek());let c=null;mi(0,s,ri.createCaller)&&(c=t.getSelf());let u=r.create(t.getOwner(),i.state,l,t.env,o,c,!!a);n.state=u,mi(0,s,ri.updateHook)&&t.updateWith(new ey(u,r,o))}),mm.add(88,(t,{op1:e})=>{let{manager:n,state:i,capabilities:r}=t.fetchValue(e),s=n.getDestroyable(i);s&&t.associateDestroyable(s)}),mm.add(97,(t,{op1:e})=>{t.beginCacheGroup(void 0),t.tree().pushAppendingBlock()}),mm.add(89,t=>{t.loadValue(6,new Zm)}),mm.add(53,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=t.stack.pop(),a=i?t.constants.getValue(i):null;t.fetchValue(6).setAttribute(r,o,s,a)}),mm.add(105,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=i?t.constants.getValue(i):null;t.fetchValue(6).setStaticAttribute(r,s,o)});class Zm{setAttribute(t,e,n,i){let r={value:e,namespace:i,trusting:n};"class"===t&&this.classes.push(e),this.attributes[t]=r}setStaticAttribute(t,e,n){let i={value:e,namespace:n};"class"===t&&this.classes.push(e),this.attributes[t]=i}addModifier(t,e,n){if(this.modifiers.push(e),void 0!==t.env.debugRenderTree){const{manager:i,definition:r,state:s}=e;if(null===s||"object"!=typeof s&&"function"!=typeof s)return;let{element:o,constructing:a}=t.tree(),l=r.resolvedName??i.getDebugName(r.state),c=i.getDebugInstance(s),u=new Im(o,a,a);t.env.debugRenderTree.create(s,{type:"modifier",name:l,args:n,instance:c}),t.env.debugRenderTree.didRender(s,u),t.associateDestroyable(s),t.updateWith(new iy(s)),t.updateWith(new ry(s,u)),Wt(s,()=>{t.env.debugRenderTree?.willDestroy(s)})}}flush(t){let e,n=this.attributes;for(let i in this.attributes){if("type"===i){e=n[i];continue}let r=this.attributes[i];"class"===i?Qm(t,"class",Jm(this.classes),r.namespace,r.trusting):Qm(t,i,r.value,r.namespace,r.trusting)}return void 0!==e&&Qm(t,"type",e.value,e.namespace,e.trusting),this.modifiers}constructor(){this.attributes=_n(),this.classes=[],this.modifiers=[]}}function Jm(t){return 0===t.length?"":1===t.length?t[0]:function(t){return t.every(t=>"string"==typeof t)}(t)?t.join(" "):(e=t,zn(()=>{let t=[];for(const n of e){let e=jm("string"==typeof n?n:qn(n));e&&t.push(e)}return 0===t.length?null:t.join(" ")}));var e}function Qm(t,e,n,i,r=!1){if("string"==typeof n)t.tree().setStaticAttribute(e,n,i);else{let s=t.tree().setDynamicAttribute(e,qn(n),r,i);Un(n)||t.updateWith(new Ym(n,s,t.env))}}function ty(t,e,n,i,r){let s=n.table.symbols.indexOf(t),o=i.get(e);-1!==s&&r.scope().bindBlock(s+1,o),n.lookup&&(n.lookup[t]=o)}mm.add(99,(t,{op1:e})=>{let{definition:n,state:i}=t.fetchValue(e),{manager:r}=n,s=t.fetchValue(6);r.didCreateElement(i,t.tree().constructing,s)}),mm.add(90,(t,{op1:e,op2:n})=>{let i=t.fetchValue(e),{definition:r,state:s}=i,{manager:o}=r,a=o.getSelf(s);if(void 0!==t.env.debugRenderTree){let i,r,o=t.fetchValue(e),{definition:l,manager:c}=o;if(t.stack.peek()===t.args)i=t.args.capture();else{let e=t.constants.getArray(n);t.args.setup(t.stack,e,[],0,!0),i=t.args.capture()}let u=l.compilable;if(null===u){mi(0,o.capabilities,ri.dynamicLayout);let e=t.context.resolver;u=null===e?null:c.getDynamicLayout(s,e),r=null!==u?u.moduleName:"__default__.hbs"}else r=u.moduleName;if(t.associateDestroyable(o),Fm(c))c.getDebugCustomRenderTree(o.definition.state,o.state,i,r).forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.create(n,e),Wt(o,()=>{t.env.debugRenderTree?.willDestroy(n)}),t.updateWith(new iy(n))});else{let e=function(t,e=t.manager){return t.resolvedName??t.debugName??e.getDebugName(t.state)}(l,c);t.env.debugRenderTree.create(o,{type:"component",name:e,args:i,template:r,instance:qn(a)}),Wt(o,()=>{t.env.debugRenderTree?.willDestroy(o)}),t.updateWith(new iy(o))}}t.stack.push(a)}),mm.add(91,(t,{op1:e})=>{let{definition:n,state:i}=t.fetchValue(e),{manager:r}=n,s=r.getTagName(i);t.stack.push(s)}),mm.add(92,(t,{op1:e})=>{let n=t.fetchValue(e),{manager:i,definition:r}=n,{stack:s}=t,{compilable:o}=r;if(null===o){let{capabilities:e}=n,r=t.context.resolver;o=null===r?null:i.getDynamicLayout(n.state,r),null===o&&(o=mi(0,e,ri.wrapped)?fm(t.constants.defaultTemplate).asWrappedLayout():fm(t.constants.defaultTemplate).asLayout())}let a=o.compile(t.context);s.push(o.symbolTable),s.push(a)}),mm.add(75,(t,{op1:e})=>{let n=t.stack.pop(),i=t.stack.pop(),{manager:r,capabilities:s}=n,o={definition:n,manager:r,capabilities:s,state:null,handle:i.handle,table:i.symbolTable,lookup:null};t.loadValue(e,o)}),mm.add(95,(t,{op1:e})=>{let{stack:n}=t,i=n.pop(),r=n.pop(),s=t.fetchValue(e);s.handle=i,s.table=r}),mm.add(38,(t,{op1:e})=>{let n,{table:i,manager:r,capabilities:s,state:o}=t.fetchValue(e);mi(0,s,ri.hasSubOwner)?(n=r.getOwner(o),t.loadValue(7,null)):(n=t.fetchValue(7),null===n?n=t.getOwner():t.loadValue(7,null)),t.pushRootScope(i.symbols.length+1,n)}),mm.add(17,(t,{op1:e})=>{let n=t.fetchValue(e),i=t.scope(),r=t.stack.peek(),s=r.named.atNames;for(let o=s.length-1;o>=0;o--){let t=s[o],e=n.table.symbols.indexOf(t),a=r.named.get(t,!0);-1!==e&&i.bindSymbol(e+1,a),n.lookup&&(n.lookup[t]=a)}}),mm.add(18,(t,{op1:e})=>{let n=t.fetchValue(e),{blocks:i}=t.stack.peek();for(const[r]of gn(i.names))ty(i.symbolNames[r],i.names[r],n,i,t)}),mm.add(96,(t,{op1:e})=>{let n=t.fetchValue(e);t.call(n.handle)}),mm.add(100,(t,{op1:e})=>{let n=t.fetchValue(e),{manager:i,state:r,capabilities:s}=n,o=t.tree().popBlock();void 0!==t.env.debugRenderTree&&(Fm(i)?i.getDebugCustomRenderTree(n.definition.state,r,xy).reverse().forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.didRender(n,o),t.updateWith(new ry(n,o))}):(t.env.debugRenderTree.didRender(n,o),t.updateWith(new ry(n,o)))),mi(0,s,ri.createInstance)&&(i.didRenderLayout(r,o),t.env.didCreate(n),t.updateWith(new ny(n,o)))}),mm.add(98,t=>{t.commitCacheGroup()});class ey{constructor(t,e,n){this.component=t,this.manager=e,this.dynamicScope=n}evaluate(t){let{component:e,manager:n,dynamicScope:i}=this;n.update(e,i)}}class ny{constructor(t,e){this.component=t,this.bounds=e}evaluate(t){let{component:e,bounds:n}=this,{manager:i,state:r}=e;i.didUpdateLayout(r,n),t.env.didUpdate(e)}}class iy{constructor(t){this.bucket=t}evaluate(t){t.env.debugRenderTree?.update(this.bucket)}}class ry{constructor(t,e){this.bucket=t,this.bounds=e}evaluate(t){t.env.debugRenderTree?.didRender(this.bucket,this.bounds)}}class sy{constructor(){this.stack=null,this.positional=new ay,this.named=new ly,this.blocks=new hy}empty(t){let e=t.registers[3]+1;return this.named.empty(t,e),this.positional.empty(t,e),this.blocks.empty(t,e),this}setup(t,e,n,i,r){this.stack=t;let s=this.named,o=e.length,a=t.registers[3]-o+1;s.setup(t,a,o,e,r);let l=a-i;this.positional.setup(t,l,i);let c=this.blocks,u=n.length,h=l-3*u;c.setup(t,h,u,n)}get base(){return this.blocks.base}get length(){return this.positional.length+this.named.length+3*this.blocks.length}at(t){return this.positional.at(t)}realloc(t){let{stack:e}=this;if(t>0&&null!==e){let{positional:n,named:i}=this,r=n.base+t;for(let t=n.length+i.length-1;t>=0;t--)e.copy(t+n.base,t+r);n.base+=t,i.base+=t,e.registers[3]+=t}}capture(){let t=0===this.positional.length?wy:this.positional.capture();return{named:0===this.named.length?by:this.named.capture(),positional:t}}clear(){let{stack:t,length:e}=this;e>0&&null!==t&&t.pop(e)}}const oy=hn();class ay{constructor(){this.base=0,this.length=0,this.stack=null,this._references=null}empty(t,e){this.stack=t,this.base=e,this.length=0,this._references=oy}setup(t,e,n){this.stack=t,this.base=e,this.length=n,this._references=0===n?oy:null}at(t){let{base:e,length:n,stack:i}=this;return t<0||t>=n?Mn:i.get(t,e)}capture(){return this.references}prepend(t){let e=t.length;if(e>0){let{base:n,length:i,stack:r}=this;this.base=n-=e,this.length=i+e;for(let s=0;s0){let{names:n,length:i,stack:r}=this,s=n.slice();for(const o of e)-1===s.indexOf(o)&&(i=s.push(o),r.push(t[o]));this.length=i,this._references=null,this._names=s,this._atNames=null}}get references(){let t=this._references;if(!t){let{base:e,length:n,stack:i}=this;t=this._references=i.slice(e,e+n)}return t}toSyntheticName(t){return t.slice(1)}toAtName(t){return`@${t}`}}function cy(t){return`&${t}`}const uy=hn();class hy{constructor(){this.internalValues=null,this._symbolNames=null,this.internalTag=null,this.names=dn,this.length=0,this.base=0}empty(t,e){this.stack=t,this.names=dn,this.base=e,this.length=0,this._symbolNames=null,this.internalTag=ve,this.internalValues=uy}setup(t,e,n,i){this.stack=t,this.names=i,this.base=e,this.length=n,this._symbolNames=null,0===n?(this.internalTag=ve,this.internalValues=uy):(this.internalTag=null,this.internalValues=null)}get values(){let t=this.internalValues;if(!t){let{base:e,length:n,stack:i}=this;t=this.internalValues=i.slice(e,e+3*n)}return t}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);if(-1===e)return null;let{base:n,stack:i}=this,r=i.get(3*e,n),s=i.get(3*e+1,n),o=i.get(3*e+2,n);return null===o?null:[o,s,r]}capture(){return new dy(this.names,this.values)}get symbolNames(){let t=this._symbolNames;return null===t&&(t=this._symbolNames=this.names.map(cy)),t}}class dy{constructor(t,e){this.names=t,this.values=e,this.length=t.length}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);return-1===e?null:[this.values[3*e+2],this.values[3*e+1],this.values[3*e]]}}function py(t,e){return{named:t,positional:e}}function fy(t){let e=_n();for(const[n,i]of Object.entries(t))e[n]=qn(i);return e}function gy(t){return t.map(qn)}const my=Symbol("ARGUMENT_ERROR");function yy(t){return null!==t&&"object"==typeof t&&t[my]}function _y(t){return{[my]:!0,error:t}}function vy(t){return{named:function(t){let e=_n();for(const[i,r]of Object.entries(t))try{e[i]=qn(r)}catch(n){e[i]=_y(n)}return e}(t.named),positional:(e=t.positional,e.map(t=>{try{return qn(t)}catch(e){return _y(e)}}))};var e}const by=Object.freeze(Object.create(null)),wy=oy,xy=py(by,wy);function Sy(t){return"string"==typeof t?t:"function"!=typeof t.toString?"":String(t)}function Cy(t){let e,n=Ai(t);return e=null===n?null:"function"==typeof n?n:n.getHelper(t),e}function ky(t){return t===Mn}mm.add(77,(t,{op1:e,op2:n})=>{let i=t.stack,r=i.pop(),s=i.pop(),o=t.getOwner();t.context.resolver,t.loadValue(8,function(t,e,n,i){let r,s;return zn(()=>{let o=qn(e);return o===r||(s=Cm(o,t)?i?Tm(t,o,n,i):i:0===t&&"string"==typeof o&&o||bn(o)?Tm(t,o,n,i):null,r=o),s})}(e,r,o,s))}),mm.add(107,t=>{let e,n=t.stack,i=n.pop(),r=n.pop().capture(),s=t.getOwner(),o=zn(()=>{void 0!==e&&Ht(e);let t=qn(i);if(Cm(t,1)){let{definition:n,owner:i,positional:s,named:a}=Em(t),l=Cy(n);void 0!==a&&(r.named=Sn({},...a,r.named)),void 0!==s&&(r.positional=s.concat(r.positional)),e=l(r,i),Gt(o,e)}else if(bn(t)){let n=Cy(t);e=n(r,s),Kt(e)&&Gt(o,e)}else e=Mn}),a=zn(()=>(qn(o),qn(e)));t.associateDestroyable(o),t.loadValue(8,a)}),mm.add(16,(t,{op1:e})=>{let n=t.stack,i=t.constants.getValue(e)(n.pop().capture(),t.getOwner(),t.dynamicScope());Kt(i)&&t.associateDestroyable(i),t.loadValue(8,i)}),mm.add(21,(t,{op1:e})=>{let n=t.referenceForSymbol(e);t.stack.push(n)}),mm.add(19,(t,{op1:e})=>{let n=t.stack.pop();t.scope().bindSymbol(e,n)}),mm.add(20,(t,{op1:e})=>{let n=t.stack.pop(),i=t.stack.pop(),r=t.stack.pop();t.scope().bindBlock(e,[n,i,r])}),mm.add(37,(t,{op1:e})=>{t.pushRootScope(e,t.getOwner())}),mm.add(22,(t,{op1:e})=>{let n=t.constants.getValue(e),i=t.stack.pop();t.stack.push($n(i,n))}),mm.add(23,(t,{op1:e})=>{let{stack:n}=t,i=t.scope().getBlock(e);n.push(i)}),mm.add(24,t=>{let{stack:e}=t,n=e.pop();if(n&&!ky(n)){let[t,i,r]=n;e.push(r),e.push(i),e.push(t)}else e.push(null),e.push(null),e.push(null)}),mm.add(25,t=>{let{stack:e}=t,n=e.pop();n&&!ky(n)?e.push(On):e.push(An)}),mm.add(26,t=>{t.stack.pop(),t.stack.pop();let e=t.stack.pop(),n=e&&e.parameters.length;t.stack.push(n?On:An)}),mm.add(27,(t,{op1:e})=>{let n=new Array(e);for(let r=e;r>0;r--)n[r-1]=t.stack.pop();var i;t.stack.push((i=n,zn(()=>{const t=[];for(const e of i){const n=qn(e);null!=n&&t.push(Sy(n))}return t.length>0?t.join(""):null})))}),mm.add(109,t=>{let e=t.stack.pop(),n=t.stack.pop(),i=t.stack.pop();t.stack.push(zn(()=>Ot(qn(e))?qn(n):qn(i)))}),mm.add(110,t=>{let e=t.stack.pop();t.stack.push(zn(()=>!Ot(qn(e))))}),mm.add(111,t=>{let e=t.dynamicScope(),n=t.stack,i=n.pop();n.push(zn(()=>{let t=String(qn(i));return qn(e.get(t))}))}),mm.add(112,t=>{let{positional:e}=t.stack.pop().capture();t.loadValue(8,zn(()=>{console.log(...gy(e))}))});class Ey{constructor(t,e,n){this.node=t,this.reference=e,this.lastValue=n}evaluate(){let t,e=qn(this.reference),{lastValue:n}=this;e!==n&&(t=Nm(e)?"":qm(e)?e:String(e),t!==n)&&(this.node.nodeValue=this.lastValue=t)}}function Ty(t){return function(t){return qm(t)||Nm(t)||"boolean"==typeof t||"number"==typeof t}(t)?2:Cm(t,0)||zi(t)?0:Cm(t,1)||Di(t)?1:Bm(t)?4:function(t){return Um(t)&&11===t.nodeType}(t)?5:function(t){return Um(t)&&"number"==typeof t.nodeType}(t)?6:2}function Ry(t){return bn(t)?Cm(t,0)||zi(t)?0:1:2}function Py(t,e){console.info("Use `context`, and `get()` to debug this template."),e("this")}mm.add(76,t=>{let e=t.stack.peek();t.stack.push(Ty(qn(e))),Un(e)||t.updateWith(new $m(e,Ty))}),mm.add(106,t=>{let e=t.stack.peek();t.stack.push(Ry(qn(e))),Un(e)||t.updateWith(new $m(e,Ry))}),mm.add(43,t=>{let e=qn(t.stack.pop()),n=Nm(e)?"":String(e);t.tree().appendDynamicHTML(n)}),mm.add(44,t=>{let e=qn(t.stack.pop()).toHTML(),n=Nm(e)?"":e;t.tree().appendDynamicHTML(n)}),mm.add(47,t=>{let e=t.stack.pop(),n=qn(e),i=Nm(n)?"":String(n),r=t.tree().appendDynamicText(i);Un(e)||t.updateWith(new Ey(r,e,i))}),mm.add(45,t=>{let e=qn(t.stack.pop());t.tree().appendDynamicFragment(e)}),mm.add(46,t=>{let e=qn(t.stack.pop());t.tree().appendDynamicNode(e)});let My=Py;class Iy{#f;constructor(t,e){this.scope=t,this.#f=e}get(t){let e,{scope:n}=this,i=this.#f,r=t.split("."),[s,...o]=t.split(".");return"this"===s?e=n.getSelf():i.locals[s]?e=n.getSymbol(i.locals[s]):(e=this.scope.getSelf(),o=r),o.reduce((t,e)=>$n(t,e),e)}}mm.add(103,(t,{op1:e})=>{let n=t.constants.getValue(e),i=new Iy(t.scope(),n);My(qn(t.getSelf()),t=>qn(i.get(t)))}),mm.add(72,(t,{op1:e,op2:n})=>{let i=t.stack,r=i.pop(),s=qn(i.pop()),o=Qn(r,null===s?"@identity":String(s)),a=qn(o);t.updateWith(new $m(o,t=>t.isEmpty())),a.isEmpty()?t.lowlevel.goto(n+1):(t.enterList(o,e),t.stack.push(a))}),mm.add(73,t=>{t.exitList()}),mm.add(74,(t,{op1:e})=>{let n=t.stack.peek().next();null!==n?t.registerItem(t.enterItem(n)):t.lowlevel.goto(e)});const Oy={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!1,wrapped:!1,willDestroy:!1,hasSubOwner:!1};class Ay{getCapabilities(){return Oy}getDebugName({name:t}){return t}getSelf(){return In}getDestroyable(){return null}}const Fy=new Ay;class Ly{constructor(t="@glimmer/component/template-only",e="(unknown template-only component)"){this.moduleName=t,this.name=e}toString(){return this.moduleName}}function zy(t,e){return new Ly(t,e)}Fi(Fy,Ly.prototype);const Dy={foreignObject:1,desc:1,title:1},jy=Object.create(null);class Ny{constructor(t){this.document=t,this.setupUselessElement()}setupUselessElement(){this.uselessElement=this.document.createElement("div")}createElement(t,e){let n,i,r,s;if(e?(n=e.namespaceURI===hm||"svg"===t,r=e.namespaceURI===um||"math"===t,i=!!Dy[e.tagName]):(n="svg"===t,r="math"===t,i=!1),!r&&!n||i)return this.document.createElement(t);if(jy[t])throw new Error(`Cannot create a ${t} inside an SVG context`);return s=r?um:hm,this.document.createElementNS(s,t)}insertBefore(t,e,n){t.insertBefore(e,n)}insertHTMLBefore(t,e,n){if(""===n){const n=this.createComment("");return t.insertBefore(n,e),new Im(t,n,n)}const i=e?e.previousSibling:t.lastChild;let r;if(null===e)t.insertAdjacentHTML("beforeend",n),r=t.lastChild;else if(e instanceof HTMLElement)e.insertAdjacentHTML("beforebegin",n),r=e.previousSibling;else{const{uselessElement:i}=this;t.insertBefore(i,e),i.insertAdjacentHTML("beforebegin",n),r=i.previousSibling,t.removeChild(i)}const s=i?i.nextSibling:t.firstChild;return new Im(t,s,r)}createTextNode(t){return this.document.createTextNode(t)}createComment(t){return this.document.createComment(t)}}function Uy(t,e,n){if(!t)return e;if(!function(t,e){const n=t.createElementNS(e,"svg");try{n.insertAdjacentHTML("beforeend","")}catch{}finally{return 1!==n.childNodes.length||n.firstChild.namespaceURI!==hm}}(t,n))return e;const i=t.createElement("div");return class extends e{insertHTMLBefore(t,e,r){return""===r||t.namespaceURI!==n?super.insertHTMLBefore(t,e,r):function(t,e,n,i){let r;if("FOREIGNOBJECT"===t.tagName.toUpperCase()){const t=""+n+"";xn(e),e.insertAdjacentHTML("afterbegin",t),r=e.firstChild.firstChild}else{const t=""+n+"";xn(e),e.insertAdjacentHTML("afterbegin",t),r=e.firstChild}return function(t,e,n){const i=t.firstChild;let r=i,s=i;for(;s;){const t=s.nextSibling;e.insertBefore(s,n),r=s,s=t}return new Im(e,i,r)}(r,t,i)}(t,i,r,e)}}}function By(t,e){return t&&function(t){const e=t.createElement("div");return e.appendChild(t.createTextNode("first")),e.insertAdjacentHTML("beforeend","second"),2!==e.childNodes.length}(t)?class extends e{constructor(t){super(t),this.uselessComment=t.createComment("")}insertHTMLBefore(t,e,n){if(""===n)return super.insertHTMLBefore(t,e,n);let i=!1;const r=e?e.previousSibling:t.lastChild;r&&r instanceof Text&&(i=!0,t.insertBefore(this.uselessComment,e));const s=super.insertHTMLBefore(t,e,n);return i&&t.removeChild(this.uselessComment),s}}:e}const qy="undefined"==typeof document?null:dm(document);let Vy=class extends Ny{createElementNS(t,e){return this.document.createElementNS(t,e)}setAttribute(t,e,n,i=null){i?t.setAttributeNS(i,e,n):t.setAttribute(e,n)}};Vy=By(qy,Vy),Vy=Uy(qy,Vy,hm);const $y=Vy;["b","big","blockquote","body","br","center","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","head","hr","i","img","li","listing","main","meta","nobr","ol","p","pre","ruby","s","small","span","strong","strike","sub","sup","table","tt","u","ul","var"].forEach(t=>jy[t]=1);const Gy=/[\t\n\v\f\r \xa0\u{1680}\u{180e}\u{2000}-\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}\u{feff}]/u,Wy="undefined"==typeof document?null:dm(document);class Hy extends Ny{constructor(t){super(t),this.document=t,this.namespace=null}setAttribute(t,e,n){t.setAttribute(e,n)}removeAttribute(t,e){t.removeAttribute(e)}insertAfter(t,e,n){this.insertBefore(t,e,n.nextSibling)}}let Ky=Hy;Ky=By(Wy,Ky),Ky=Uy(Wy,Ky,hm);const Xy=Ky;function Yy(t,e){let n,i;if(e in t)i=e,n="prop";else{let r=e.toLowerCase();r in t?(n="prop",i=r):(n="attr",i=e)}return"prop"!==n||"style"!==i.toLowerCase()&&!function(t,e){let n=Zy[t.toUpperCase()];return!(!n||!n[e.toLowerCase()])}(t.tagName,i)||(n="attr"),{normalized:i,type:n}}const Zy={INPUT:{form:!0,autocorrect:!0,list:!0},SELECT:{form:!0},OPTION:{form:!0},TEXTAREA:{form:!0},LABEL:{form:!0},FIELDSET:{form:!0},LEGEND:{form:!0},OBJECT:{form:!0},OUTPUT:{form:!0},BUTTON:{form:!0}},Jy=Symbol("TRANSACTION");class Qy{didCreate(t){this.createdComponents.push(t)}didUpdate(t){this.updatedComponents.push(t)}scheduleInstallModifier(t){this.scheduledInstallModifiers.push(t)}scheduleUpdateModifier(t){this.scheduledUpdateModifiers.push(t)}commit(){let{createdComponents:t,updatedComponents:e}=this;for(const{manager:r,state:s}of t)r.didCreate(s);for(const{manager:r,state:s}of e)r.didUpdate(s);let{scheduledInstallModifiers:n,scheduledUpdateModifiers:i}=this;for(const{manager:r,state:s,definition:o}of n){let t=r.getTag(s);if(null!==t){let e=Ge(()=>r.install(s));me(t,e)}else r.install(s)}for(const{manager:r,state:s,definition:o}of i){let t=r.getTag(s);if(null!==t){let e=Ge(()=>r.update(s));me(t,e)}else r.update(s)}}constructor(){this.scheduledInstallModifiers=[],this.scheduledUpdateModifiers=[],this.createdComponents=[],this.updatedComponents=[]}}class t_{static{i_=Jy}constructor(t,e){this.delegate=e,this[i_]=null,this.isInteractive=e.isInteractive,this.debugRenderTree=this.delegate.enableDebugTooling?new Dm:void 0,this.isArgumentCaptureError=this.delegate.enableDebugTooling?yy:void 0,t.appendOperations?(this.appendOperations=t.appendOperations,this.updateOperations=t.updateOperations):t.document&&(this.appendOperations=new $y(t.document),this.updateOperations=new Hy(t.document))}getAppendOperations(){return this.appendOperations}getDOM(){return this.updateOperations}begin(){this[Jy],this.debugRenderTree?.begin(),this[Jy]=new Qy}get transaction(){return this[Jy]}didCreate(t){this.transaction.didCreate(t)}didUpdate(t){this.transaction.didUpdate(t)}scheduleInstallModifier(t){this.isInteractive&&this.transaction.scheduleInstallModifier(t)}scheduleUpdateModifier(t){this.isInteractive&&this.transaction.scheduleUpdateModifier(t)}commit(){let t=this.transaction;this[Jy]=null,t.commit(),this.debugRenderTree?.commit(),this.delegate.onTransactionCommit()}}function e_(t,e,n,i){return{env:new t_(t,e),program:new cm(n.constants,n.heap),resolver:i}}function n_(t,e){if(t[Jy])e();else{t.begin();try{e()}finally{t.commit()}}}var i_;function r_(t){return Ii(t,{})}const s_=r_(({positional:t})=>zn(()=>gy(t),null)),o_=t=>(t=>null==t||"function"!=typeof t.toString)(t)?"":String(t),a_=r_(({positional:t})=>zn(()=>gy(t).map(o_).join(""),null)),l_=r_(({positional:t})=>{let e=t[0];return zn(()=>(...n)=>{let[i,...r]=gy(t);if(!jn(e))return i.call(null,...r,...n);{let t=r.length>0?r[0]:n[0];Vn(e,t)}},null)}),c_=r_(({positional:t})=>{let e=t[0]??Mn,n=t[1]??Mn;return zn(()=>{let t=qn(e);if(vn(t))return Lt(t,String(qn(n)))},t=>{let i=qn(e);if(vn(i))return zt(i,String(qn(n)),t)})}),u_=r_(({named:t})=>{let e=zn(()=>fy(t),null),n=new Map;for(let i in t)n.set(i,t[i]);return e.children=n,e});function h_(t){return Ve(t.argsCache)}class d_{constructor(t,e=()=>xy){let n=qe(()=>e(t));this.argsCache=n}get named(){return h_(this).named||by}get positional(){return h_(this).positional||wy}}function p_(t,e,n){const i=cr(t),r=Ai(e).getDelegateFor(i);let s,o=new d_(t,n),a=r.createHelper(e,o);if(!vi(r))throw new Error("TODO: unreachable, to be implemented with hasScheduledEffect");return s=qe(()=>r.getValue(a)),Gt(t,s),bi(r)&&Gt(s,r.getDestroyable(a)),s}class f_{constructor(t,e){this.tag=_e(),this.listener=null,this.element=t,this.args=e,Wt(this,()=>{let{element:t,listener:e}=this;if(e){let{eventName:n,callback:i,options:r}=e;y_(t,n,i,r)}})}updateListener(){let{element:t,args:e,listener:n}=this;e.positional[0];let i=qn(e.positional[0]);e.positional[1];let r,s,o,a=qn(e.positional[1]);{let{once:t,passive:n,capture:i}=e.named;t&&(r=qn(t)),n&&(s=qn(n)),i&&(o=qn(i))}let l,c=!1;if(c=null===n||i!==n.eventName||a!==n.userProvidedCallback||r!==n.once||s!==n.passive||o!==n.capture,c&&(void 0===r&&void 0===s&&void 0===o||(l={once:r,passive:s,capture:o})),c){let e=a;this.listener={eventName:i,callback:e,userProvidedCallback:a,once:r,passive:s,capture:o,options:l},n&&y_(t,n.eventName,n.callback,n.options),function(t,e,n,i){g_++,t.addEventListener(e,n,i)}(t,i,e,l)}}}let g_=0,m_=0;function y_(t,e,n,i){m_++,t.removeEventListener(e,n,i)}const __=Pi(new class{getDebugName(){return"on"}getDebugInstance(){return null}get counters(){return{adds:g_,removes:m_}}create(t,e,n,i){return new f_(e,i)}getTag({tag:t}){return t}install(t){t.updateListener()}update(t){t.updateListener()}getDestroyable(t){return t}},{});class v_{constructor(t,e,n,i){this.stack=t,this.externs=n,this.currentOpSize=0,this.context=e,this.registers=i}fetchRegister(t){return this.registers[t]}loadRegister(t,e){this.registers[t]=e}setPc(t){this.registers[0]=t}pushFrame(){this.stack.push(this.registers[1]),this.stack.push(this.registers[2]),this.registers[2]=this.registers[3]-1}popFrame(){this.registers[3]=this.registers[2]-1,this.registers[1]=this.stack.get(0),this.registers[2]=this.stack.get(1)}pushSmallFrame(){this.stack.push(this.registers[1])}popSmallFrame(){this.registers[1]=this.stack.pop()}goto(t){this.setPc(this.target(t))}target(t){return this.registers[0]+t-this.currentOpSize}call(t){this.registers[1]=this.registers[0],this.setPc(this.context.program.heap.getaddr(t))}returnTo(t){this.registers[1]=this.target(t)}return(){this.setPc(this.registers[1])}nextStatement(){let{registers:t,context:e}=this,n=t[0];if(-1===n)return null;let i=e.program.opcode(n),r=this.currentOpSize=i.size;return this.registers[0]+=r,i}evaluateOuter(t,e){this.evaluateInner(t,e)}evaluateInner(t,e){t.isMachine?this.evaluateMachine(t,e):this.evaluateSyscall(t,e)}evaluateMachine(t,e){switch(t.type){case 0:return void this.pushFrame();case 1:return void this.popFrame();case 3:return void this.call(t.op1);case 2:return void e.call(this.stack.pop());case 4:return void this.goto(t.op1);case 5:return void e.return();case 6:return void this.returnTo(t.op1)}}evaluateSyscall(t,e){mm.evaluate(e,t,t.type)}}const b_=["javascript:","vbscript:"],w_=["A","BODY","LINK","IMG","IFRAME","BASE","FORM"],x_=["EMBED"],S_=["href","src","background","action"],C_=["src"];function k_(t,e){return-1!==t.indexOf(e)}function E_(t,e){return(null===t||k_(w_,t))&&k_(S_,e)}function T_(t,e){return null!==t&&k_(x_,t)&&k_(C_,e)}function R_(t,e){return E_(t,e)||T_(t,e)}let P_;function M_(t,e,n){if(null==n)return n;if(Bm(n))return n.toHTML();const i=t.tagName.toUpperCase();let r=jm(n);if(E_(i,e)){let t=(s=r,P_||(P_=function(){const t=URL;if("object"==typeof t&&null!==t&&"function"==typeof t.parse){let e=t;return t=>{let n=null;return"string"==typeof t&&(n=e.parse(t).protocol),null===n?":":n}}if("function"==typeof t)return e=>{try{return new t(e).protocol}catch{return":"}};throw new Error('@glimmer/runtime needs a valid "globalThis.URL"')}()),P_(s));if(k_(b_,t))return`unsafe:${r}`}var s;return T_(i,e)?`unsafe:${r}`:r}function I_(t,e,n){const{tagName:i,namespaceURI:r}=t,s={element:t,name:e,namespace:n};if(r===hm)return O_(i,e,s);const{type:o,normalized:a}=Yy(t,e);return"attr"===o?O_(i,a,s):function(t,e,n){return R_(t,e)?new z_(e,n):function(t,e){return("INPUT"===t||"TEXTAREA"===t)&&"value"===e}(t,e)?new j_(e,n):function(t,e){return"OPTION"===t&&"selected"===e}(t,e)?new N_(e,n):new L_(e,n)}(i,a,s)}function O_(t,e,n){return R_(t,e)?new D_(n):new F_(n)}class A_{constructor(t){this.attribute=t}}class F_ extends A_{set(t,e,n){const i=U_(e);if(null!==i){const{name:e,namespace:n}=this.attribute;t.__setAttribute(e,i,n)}}update(t,e){const n=U_(t),{element:i,name:r}=this.attribute;null===n?i.removeAttribute(r):i.setAttribute(r,n)}}class L_ extends A_{constructor(t,e){super(e),this.normalizedName=t}set(t,e,n){null!=e&&(this.value=e,t.__setProperty(this.normalizedName,e))}update(t,e){const{element:n}=this.attribute;this.value!==t&&(n[this.normalizedName]=this.value=t,null==t&&this.removeAttribute())}removeAttribute(){const{element:t,namespace:e}=this.attribute;e?t.removeAttributeNS(e,this.normalizedName):t.removeAttribute(this.normalizedName)}}class z_ extends L_{set(t,e,n){const{element:i,name:r}=this.attribute,s=M_(i,r,e);super.set(t,s,n)}update(t,e){const{element:n,name:i}=this.attribute,r=M_(n,i,t);super.update(r,e)}}class D_ extends F_{set(t,e,n){const{element:i,name:r}=this.attribute,s=M_(i,r,e);super.set(t,s,n)}update(t,e){const{element:n,name:i}=this.attribute,r=M_(n,i,t);super.update(r,e)}}class j_ extends L_{set(t,e){t.__setProperty("value",jm(e))}update(t){const e=this.attribute.element,n=e.value,i=jm(t);n!==i&&(e.value=i)}}class N_ extends L_{set(t,e){null!=e&&!1!==e&&t.__setProperty("selected",!0)}update(t){this.attribute.element.selected=!!t}}function U_(t){return!1===t||null==t||void 0===t.toString?null:!0===t?"":"function"==typeof t?null:String(t)}class B_{constructor(t){this.node=t}firstNode(){return this.node}}class q_{constructor(t){this.node=t}lastNode(){return this.node}}class V_{static forInitialRender(t,e){return new this(t,e.element,e.nextSibling).initialize()}static resume(t,e){let n=new this(t,e.parentElement(),e.reset(t)).initialize();return n.pushBlock(e),n}constructor(t,e,n){this.constructing=null,this.operations=null,this.cursors=new wn,this.modifierStack=new wn,this.blockStack=new wn,this.pushElement(e,n),this.env=t,this.dom=t.getAppendOperations(),this.updateOperations=t.getDOM()}initialize(){return this.pushAppendingBlock(),this}debugBlocks(){return this.blockStack.toArray()}get element(){return this.cursors.current.element}get nextSibling(){return this.cursors.current.nextSibling}get hasBlocks(){return this.blockStack.size>0}block(){return this.blockStack.current}popElement(){this.cursors.pop(),this.cursors.current}pushAppendingBlock(){return this.pushBlock(new $_(this.element))}pushResettableBlock(){return this.pushBlock(new W_(this.element))}pushBlockList(t){return this.pushBlock(new H_(this.element,t))}pushBlock(t,e=!1){let n=this.blockStack.current;return null!==n&&(e||n.didAppendBounds(t)),this.__openBlock(),this.blockStack.push(t),t}popBlock(){return this.block().finalize(this),this.__closeBlock(),this.blockStack.pop()}__openBlock(){}__closeBlock(){}openElement(t){let e=this.__openElement(t);return this.constructing=e,e}__openElement(t){return this.dom.createElement(t,this.element)}flushElement(t){let e=this.element,n=this.constructing;this.__flushElement(e,n),this.constructing=null,this.operations=null,this.pushModifiers(t),this.pushElement(n,null),this.didOpenElement(n)}__flushElement(t,e){this.dom.insertBefore(t,e,this.nextSibling)}closeElement(){return this.willCloseElement(),this.popElement(),this.popModifiers()}pushRemoteElement(t,e,n){return this.__pushRemoteElement(t,e,n)}__pushRemoteElement(t,e,n){if(this.pushElement(t,n),void 0===n)for(;t.lastChild;)t.removeChild(t.lastChild);let i=new G_(t);return this.pushBlock(i,!0)}popRemoteElement(){const t=this.popBlock();return this.popElement(),t}pushElement(t,e=null){this.cursors.push(new Mm(t,e))}pushModifiers(t){this.modifierStack.push(t)}popModifiers(){return this.modifierStack.pop()}didAppendBounds(t){return this.block().didAppendBounds(t),t}didAppendNode(t){return this.block().didAppendNode(t),t}didOpenElement(t){return this.block().openElement(t),t}willCloseElement(){this.block().closeElement()}appendText(t){return this.didAppendNode(this.__appendText(t))}__appendText(t){let{dom:e,element:n,nextSibling:i}=this,r=e.createTextNode(t);return e.insertBefore(n,r,i),r}__appendNode(t){return this.dom.insertBefore(this.element,t,this.nextSibling),t}__appendFragment(t){let e=t.firstChild;if(e){let n=new Im(this.element,e,t.lastChild);return this.dom.insertBefore(this.element,t,this.nextSibling),n}{const t=this.__appendComment("");return new Im(this.element,t,t)}}__appendHTML(t){return this.dom.insertHTMLBefore(this.element,this.nextSibling,t)}appendDynamicHTML(t){let e=this.trustedContent(t);this.didAppendBounds(e)}appendDynamicText(t){let e=this.untrustedContent(t);return this.didAppendNode(e),e}appendDynamicFragment(t){let e=this.__appendFragment(t);this.didAppendBounds(e)}appendDynamicNode(t){let e=this.__appendNode(t),n=new Im(this.element,e,e);this.didAppendBounds(n)}trustedContent(t){return this.__appendHTML(t)}untrustedContent(t){return this.__appendText(t)}appendComment(t){return this.didAppendNode(this.__appendComment(t))}__appendComment(t){let{dom:e,element:n,nextSibling:i}=this,r=e.createComment(t);return e.insertBefore(n,r,i),r}__setAttribute(t,e,n){this.dom.setAttribute(this.constructing,t,e,n)}__setProperty(t,e){this.constructing[t]=e}setStaticAttribute(t,e,n){this.__setAttribute(t,e,n)}setDynamicAttribute(t,e,n,i){let r=I_(this.constructing,t,i);return r.set(this,e,this.env),r}}class $_{constructor(t){this.parent=t,this.first=null,this.last=null,this.nesting=0}parentElement(){return this.parent}firstNode(){return this.first.firstNode()}lastNode(){return this.last.lastNode()}openElement(t){this.didAppendNode(t),this.nesting++}closeElement(){this.nesting--}didAppendNode(t){0===this.nesting&&(this.first||(this.first=new B_(t)),this.last=new q_(t))}didAppendBounds(t){0===this.nesting&&(this.first||(this.first=t),this.last=t)}finalize(t){null===this.first&&t.appendComment("")}}class G_ extends $_{constructor(t){super(t),Wt(this,()=>{this.parentElement()===this.firstNode().parentNode&&Am(this)})}}class W_ extends $_{constructor(t){super(t)}reset(){Ht(this);let t=Am(this);return this.first=null,this.last=null,this.nesting=0,t}}class H_{constructor(t,e){this.parent=t,this.boundList=e,this.parent=t,this.boundList=e}parentElement(){return this.parent}firstNode(){return this.boundList[0].firstNode()}lastNode(){let t=this.boundList;return t[t.length-1].lastNode()}openElement(t){}closeElement(){}didAppendNode(t){}didAppendBounds(t){}finalize(t){this.boundList.length}}function K_(t,e){return V_.forInitialRender(t,e)}class X_{constructor(t,{alwaysRevalidate:e=!1}){this.frameStack=new wn,this.env=t,this.dom=t.getDOM(),this.alwaysRevalidate=e}execute(t,e){this._execute(t,e)}_execute(t,e){let{frameStack:n}=this;for(this.try(t,e);!n.isEmpty();){let t=this.frame.nextStatement();void 0!==t?t.evaluate(this):n.pop()}}get frame(){return this.frameStack.current}goto(t){this.frame.goto(t)}try(t,e){this.frameStack.push(new tv(t,e))}throw(){this.frame.handleException(),this.frameStack.pop()}}class Y_{constructor(t,e,n,i){this.state=t,this.context=e,this.children=i,this.bounds=n}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}evaluate(t){t.try(this.children,null)}}class Z_ extends Y_{evaluate(t){t.try(this.children,this)}handleException(){let{state:t,bounds:e,context:{env:n}}=this;!function(t){let{children:e}=$t(t);qt(e,Ht)}(this);let i=V_.resume(n,e),r=t.evaluate(i),s=this.children=[],o=r.execute(t=>{t.updateWith(this),t.pushUpdating(s)});Gt(this,o.drop)}constructor(...t){super(...t),this.type="try"}}class J_ extends Z_{constructor(t,e,n,i,r,s){super(t,e,n,[]),this.key=i,this.memo=r,this.value=s,this.retained=!1,this.index=-1}shouldRemove(){return!this.retained}reset(){this.retained=!1}}class Q_ extends Y_{constructor(t,e,n,i,r){super(t,e,n,i),this.iterableRef=r,this.type="list-block",this.opcodeMap=new Map,this.marker=null,this.lastIterator=qn(r)}initializeChild(t){t.index=this.children.length-1,this.opcodeMap.set(t.key,t)}evaluate(t){let e=qn(this.iterableRef);if(this.lastIterator!==e){let{bounds:n}=this,{dom:i}=t,r=this.marker=i.createComment("");i.insertAfter(n.parentElement(),r,n.lastNode()),this.sync(e),this.parentElement().removeChild(r),this.marker=null,this.lastIterator=e}super.evaluate(t)}sync(t){let{opcodeMap:e,children:n}=this,i=0,r=0;for(this.children=this.bounds.boundList=[];;){let s=t.next();if(null===s)break;let o=n[i],{key:a}=s;for(;void 0!==o&&o.retained;)o=n[++i];if(void 0!==o&&o.key===a)this.retainItem(o,s),i++;else if(e.has(a)){let t=e.get(a);if(t.index{let i=e.enterItem(t);i.index=s.length,s.push(i),n.set(a,i),Gt(this,i)})}moveItem(t,e,n){let i,r,{children:s}=this;Vn(t.memo,e.memo),Vn(t.value,e.value),t.retained=!0,void 0===n?Om(t,this.marker):(i=t.lastNode().nextSibling,r=n.firstNode(),i!==r&&Om(t,r)),t.index=s.length,s.push(t)}deleteItem(t){Ht(t),Am(t),this.opcodeMap.delete(t.key)}}class tv{constructor(t,e){this.ops=t,this.exceptionHandler=e,this.current=0}goto(t){this.current=t}nextStatement(){return this.ops[this.current++]}handleException(){this.exceptionHandler&&this.exceptionHandler.handleException()}}class ev{constructor(t,e,n,i){this.env=t,this.updating=e,this.bounds=n,this.drop=i,Gt(this,i),Wt(this,()=>Am(this.bounds))}rerender({alwaysRevalidate:t=!1}={alwaysRevalidate:!1}){let{env:e,updating:n}=this;new X_(e,{alwaysRevalidate:t}).execute(n,this)}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}handleException(){}}class nv{static restore(t,e){const n=new this(t.slice(),[0,-1,t.length-1,0]);return n.registers[0]=e,n.registers[3]=t.length-1,n.registers[2]=-1,n}constructor(t=[],e){this.stack=t,this.registers=e}push(t){this.stack[++this.registers[3]]=t}dup(t=this.registers[3]){this.stack[++this.registers[3]]=this.stack[t]}copy(t,e){this.stack[e]=this.stack[t]}pop(t=1){let e=this.stack[this.registers[3]];return this.registers[3]-=t,e}peek(t=0){return this.stack[this.registers[3]-t]}get(t,e=this.registers[2]){return this.stack[e+t]}set(t,e,n=this.registers[2]){this.stack[n+e]=t}slice(t,e){return this.stack.slice(t,e)}capture(t){let e=this.registers[3]+1,n=e-t;return this.stack.slice(n,e)}reset(){this.stack.length=0}}class iv{constructor(t,e){this.drop={},this.scope=new wn,this.dynamicScope=new wn,this.updating=new wn,this.cache=new wn,this.list=new wn,this.destroyable=new wn,this.scope.push(t),this.dynamicScope.push(e),this.destroyable.push(this.drop)}}class rv{#g;get stack(){return this.lowlevel.stack}get pc(){return this.lowlevel.fetchRegister(0)}#m;fetch(t){let e=this.fetchValue(t);this.stack.push(e)}load(t){let e=this.stack.pop();this.loadValue(t,e)}loadValue(t,e){this.#m[t]=e}fetchValue(t){return function(t){return t<=3}(t)?this.lowlevel.fetchRegister(t):this.#m[t]}call(t){null!==t&&this.lowlevel.call(t)}return(){this.lowlevel.return()}#y;constructor({scope:t,dynamicScope:e,stack:n,pc:i},r,s){this.#m=[null,null,null,null,null,null,null,null,null];let o=nv.restore(n,i);this.#y=s,this.context=r,this.#g=new iv(t,e),this.args=new sy,this.lowlevel=new v_(o,r,void 0,o.registers),this.pushUpdating()}static initial(t,e){let n=Pm.root(e.owner,e.scope??{self:Mn,size:0});const i=function(t,e,n){return{pc:t,scope:e,dynamicScope:n,stack:[]}}(t.program.heap.getaddr(e.handle),n,e.dynamicScope);return new rv(i,t,e.tree)}compile(t){return pm(t.compile(this.context))}get constants(){return this.context.program.constants}get program(){return this.context.program}get env(){return this.context.env}captureClosure(t,e=this.lowlevel.fetchRegister(0)){return{pc:e,scope:this.scope(),dynamicScope:this.dynamicScope(),stack:this.stack.capture(t)}}capture(t,e=this.lowlevel.fetchRegister(0)){return new sv(this.captureClosure(t,e),this.context)}beginCacheGroup(t){let e=this.updating(),n=new Gm;e.push(n),e.push(new Wm(t)),this.#g.cache.push(n),Oe()}commitCacheGroup(){let t=this.updating(),e=this.#g.cache.pop(),n=Ae();t.push(new Hm(e)),e.finalize(n,t.length)}enter(t){let e=this.capture(t),n=this.tree().pushResettableBlock(),i=new Z_(e,this.context,n,[]);this.didEnter(i)}enterItem({key:t,value:e,memo:n}){let{stack:i}=this,r=ti(e),s=ti(n);i.push(r),i.push(s);let o=this.capture(2),a=this.tree().pushResettableBlock(),l=new J_(o,this.context,a,t,s,r);return this.didEnter(l),l}registerItem(t){this.listBlock().initializeChild(t)}enterList(t,e){let n=[],i=this.lowlevel.target(e),r=this.capture(0,i),s=this.tree().pushBlockList(n),o=new Q_(r,this.context,s,n,t);this.#g.list.push(o),this.didEnter(o)}didEnter(t){this.associateDestroyable(t),this.#g.destroyable.push(t),this.updateWith(t),this.pushUpdating(t.children)}exit(){this.#g.destroyable.pop(),this.#y.popBlock(),this.popUpdating()}exitList(){this.exit(),this.#g.list.pop()}pushRootScope(t,e){let n=Pm.sized(e,t);return this.#g.scope.push(n),n}pushChildScope(){this.#g.scope.push(this.scope().child())}pushScope(t){this.#g.scope.push(t)}popScope(){this.#g.scope.pop()}pushDynamicScope(){let t=this.dynamicScope().child();return this.#g.dynamicScope.push(t),t}bindDynamicScope(t){let e=this.dynamicScope();for(const n of fn(t))e.set(n,this.stack.pop())}pushUpdating(t=[]){this.#g.updating.push(t)}popUpdating(){return this.#g.updating.pop()}updateWith(t){this.updating().push(t)}listBlock(){return this.#g.list.current}associateDestroyable(t){Gt(this.#g.destroyable.current,t)}updating(){return this.#g.updating.current}tree(){return this.#y}scope(){return this.#g.scope.current}dynamicScope(){return this.#g.dynamicScope.current}popDynamicScope(){this.#g.dynamicScope.pop()}getOwner(){return this.scope().owner}getSelf(){return this.scope().getSelf()}referenceForSymbol(t){return this.scope().getSymbol(t)}execute(t){return this._execute(t)}_execute(t){let e;t&&t(this);do{e=this.next()}while(!e.done);return e.value}next(){let t,{env:e}=this,n=this.lowlevel.nextStatement();return null!==n?(this.lowlevel.evaluateOuter(n,this),t={done:!1,value:null}):(this.stack.reset(),t={done:!0,value:new ev(e,this.popUpdating(),this.#y.popBlock(),this.#g.drop)}),t}}class sv{constructor(t,e){this.state=t,this.context=e}evaluate(t){return new rv(this.state,this.context,t)}}class ov{constructor(t){this.vm=t}next(){return this.vm.next()}sync(){return this.vm.execute()}}function av(t,e,n,i,r,s=new Rm){let o=pm(r.compile(t)),a=r.symbolTable.symbols.length,l=rv.initial(t,{scope:{self:n,size:a},dynamicScope:s,tree:i,handle:o,owner:e});return new ov(l)}function lv(t,e,n,i,r={},s=new Rm){return function(t,e,n,i,r){const s=Object.keys(r).map(t=>[t,r[t]]),o=["main","else","attrs"],a=s.map(([t])=>`@${t}`);let l=t.constants.component(i,n,void 0,"{ROOT}");t.lowlevel.pushFrame();for(let h=0;h<3*o.length;h++)t.stack.push(null);t.stack.push(null),s.forEach(([,e])=>{t.stack.push(e)}),t.args.setup(t.stack,a,o,0,!0);const c=l.compilable,u={handle:pm(c.compile(e)),symbolTable:c.symbolTable};return t.stack.push(t.args),t.stack.push(u),t.stack.push(l),new ov(t)}(rv.initial(t,{tree:e,handle:t.stdlib.main,dynamicScope:s,owner:n}),t,n,i,function(t){const e=Fn(t);return Object.keys(t).reduce((t,n)=>(t[n]=$n(e,n),t),{})}(r))}function cv(t){return"%+b:0%"===t.nodeValue}class uv extends Mm{constructor(t,e,n){super(t,e),this.startingBlockDepth=n,this.candidate=null,this.injectedOmittedNode=!1,this.openBlockDepth=n-1}}class hv extends V_{constructor(t,e,n){if(super(t,e,n),this.unmatchedAttributes=null,this.blockDepth=0,n)throw new Error("Rehydration with nextSibling not supported");let i=this.currentCursor.element.firstChild;for(;null!==i&&!dv(i);)i=i.nextSibling;this.candidate=i;const r=fv(i);if(0!==r){const t=r-1,e=this.dom.createComment(`%+b:${t}%`);i.parentNode.insertBefore(e,this.candidate);let n=i.nextSibling;for(;null!==n&&(!pv(n)||fv(n)!==r);)n=n.nextSibling;const s=this.dom.createComment(`%-b:${t}%`);i.parentNode.insertBefore(s,n.nextSibling),this.candidate=e,this.startingBlockOffset=t}else this.startingBlockOffset=0}get currentCursor(){return this.cursors.current}get candidate(){return this.currentCursor?this.currentCursor.candidate:null}set candidate(t){this.currentCursor.candidate=t}disableRehydration(t){const e=this.currentCursor;e.candidate=null,e.nextSibling=t}enableRehydration(t){const e=this.currentCursor;e.candidate=t,e.nextSibling=null}pushElement(t,e=null){const n=new uv(t,e,this.blockDepth||0);null!==this.candidate&&(n.candidate=t.firstChild,this.candidate=t.nextSibling),this.cursors.push(n)}clearMismatch(t){let e=t;const n=this.currentCursor;if(null!==n){const t=n.openBlockDepth;if(t>=n.startingBlockDepth)for(;e&&!(pv(e)&&t>=gv(e,this.startingBlockOffset));)e=this.remove(e);else for(;null!==e;)e=this.remove(e);this.disableRehydration(e)}}__openBlock(){const{currentCursor:t}=this;if(null===t)return;const e=this.blockDepth;this.blockDepth++;const{candidate:n}=t;if(null===n)return;const{tagName:i}=t.element;dv(n)&&gv(n,this.startingBlockOffset)===e?(this.candidate=this.remove(n),t.openBlockDepth=e):"TITLE"!==i&&"SCRIPT"!==i&&"STYLE"!==i&&this.clearMismatch(n)}__closeBlock(){const{currentCursor:t}=this;if(null===t)return;const e=t.openBlockDepth;this.blockDepth--;const{candidate:n}=t;let i=!1;if(null!==n)if(i=!0,pv(n)&&gv(n,this.startingBlockOffset)===e){const e=this.remove(n);this.candidate=e,t.openBlockDepth--}else this.clearMismatch(n),i=!1;if(!i){const e=t.nextSibling;if(null!==e&&pv(e)&&gv(e,this.startingBlockOffset)===this.blockDepth){const n=this.remove(e);this.enableRehydration(n),t.openBlockDepth--}}}__appendNode(t){const{candidate:e}=this;return e||super.__appendNode(t)}__appendHTML(t){const e=this.markerBounds();if(e){const t=e.firstNode(),n=e.lastNode(),i=new Im(this.element,t.nextSibling,n.previousSibling),r=this.remove(t);return this.remove(n),null!==r&&_v(r)&&(this.candidate=this.remove(r),null!==this.candidate&&this.clearMismatch(this.candidate)),i}return super.__appendHTML(t)}remove(t){const e=t.parentNode,n=t.nextSibling;return e.removeChild(t),n}markerBounds(){const t=this.candidate;if(t&&yv(t)){const e=t;let n=e.nextSibling;for(;!yv(n);)n=n.nextSibling;return new Im(this.element,e,n)}return null}__appendText(t){const{candidate:e}=this;return e?3===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):8===(n=e).nodeType&&"%|%"===n.nodeValue||_v(e)&&""===t?(this.candidate=this.remove(e),this.__appendText(t)):(this.clearMismatch(e),super.__appendText(t)):super.__appendText(t);var n}__appendComment(t){const e=this.candidate;return e&&8===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):(e&&this.clearMismatch(e),super.__appendComment(t))}__openElement(t){const e=this.candidate;if(e&&mv(e)&&function(t,e){return t.namespaceURI===hm?t.tagName===e:t.tagName===e.toUpperCase()}(e,t))return this.unmatchedAttributes=[].slice.call(e.attributes),e;if(e){if(mv(e)&&"TBODY"===e.tagName)return this.pushElement(e,null),this.currentCursor.injectedOmittedNode=!0,this.__openElement(t);this.clearMismatch(e)}return super.__openElement(t)}__setAttribute(t,e,n){const i=this.unmatchedAttributes;if(i){const n=vv(i,t);if(n)return n.value!==e&&(n.value=e),void i.splice(i.indexOf(n),1)}return super.__setAttribute(t,e,n)}__setProperty(t,e){const n=this.unmatchedAttributes;if(n){const i=vv(n,t);if(i)return i.value!==e&&(i.value=e),void n.splice(n.indexOf(i),1)}return super.__setProperty(t,e)}__flushElement(t,e){const{unmatchedAttributes:n}=this;if(n){for(const t of n)this.constructing.removeAttribute(t.name);this.unmatchedAttributes=null}else super.__flushElement(t,e)}willCloseElement(){const{candidate:t,currentCursor:e}=this;null!==t&&this.clearMismatch(t),e&&e.injectedOmittedNode&&this.popElement(),super.willCloseElement()}getMarker(t,e){const n=t.querySelector(`script[glmr="${e}"]`);return n?dm(n):null}__pushRemoteElement(t,e,n){const i=this.getMarker(t,e);if(!i||i.parentNode,void 0===n){for(;null!==t.firstChild&&t.firstChild!==i;)this.remove(t.firstChild);n=null}const r=new uv(t,null,this.blockDepth);this.cursors.push(r),null===i?this.disableRehydration(n):this.candidate=this.remove(i);const s=new G_(t);return this.pushBlock(s,!0)}didAppendBounds(t){if(super.didAppendBounds(t),this.candidate){const e=t.lastNode();this.candidate=e.nextSibling}return t}}function dv(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%+b:",0)}function pv(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%-b:",0)}function fv(t){return parseInt(t.nodeValue.slice(4),10)}function gv(t,e){return fv(t)-e}function mv(t){return 1===t.nodeType}function yv(t){return 8===t.nodeType&&"%glmr%"===t.nodeValue}function _v(t){return 8===t.nodeType&&"% %"===t.nodeValue}function vv(t,e){for(const n of t)if(n.name===e)return n}function bv(t,e){return hv.forInitialRender(t,e)}const wv=Object.freeze(Object.defineProperty({__proto__:null,ConcreteBounds:Im,CurriedValue:km,CursorImpl:Mm,DOMChanges:Xy,DOMTreeConstruction:$y,DynamicAttribute:A_,DynamicScopeImpl:Rm,EMPTY_ARGS:xy,EMPTY_NAMED:by,EMPTY_POSITIONAL:wy,EnvironmentImpl:t_,IDOMChanges:Hy,LowLevelVM:v_,NewTreeBuilder:V_,RehydrateTree:hv,RemoteBlock:G_,ResettableBlockImpl:W_,SERIALIZATION_FIRST_NODE_STRING:"%+b:0%",ScopeImpl:Pm,SimpleDynamicAttribute:F_,TEMPLATE_ONLY_COMPONENT_MANAGER:Fy,TemplateOnlyComponent:Ly,TemplateOnlyComponentManager:Ay,UpdatingVM:X_,array:s_,clear:Am,clientBuilder:K_,concat:a_,createCapturedArgs:py,curry:Tm,destroy:Ht,dynamicAttribute:I_,fn:l_,get:c_,hash:u_,inTransaction:n_,invokeHelper:p_,isDestroyed:Yt,isDestroying:Xt,isSerializationFirstNode:cv,isWhitespace:function(t){return Gy.test(t)},normalizeProperty:Yy,on:__,registerDestructor:Wt,rehydrationBuilder:bv,reifyArgs:function(t){return{named:fy(t.named),positional:gy(t.positional)}},reifyNamed:fy,reifyPositional:gy,renderComponent:lv,renderMain:av,renderSync:function(t,e){let n;return n_(t,()=>n=e.sync()),n},resetDebuggerCallback:function(){My=Py},runtimeOptions:e_,setDebuggerCallback:function(t){My=t},templateOnlyComponent:zy},Symbol.toStringTag,{value:"Module"})),xv=__,Sv=Symbol("MUTABLE_CELL"),Cv=Qg({id:"yTlmws8O",block:'[[[46,[30,0],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/root.hbs",isStrictMode:!0}),kv=Qg({id:"Cc/BCoQJ",block:'[[[11,"input"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,4,[30,0,["type"]]],[16,"checked",[30,0,["checked"]]],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/input.hbs",scope:()=>[xv],isStrictMode:!0});function Ev(){}class Tv{static toString(){return"internal component"}constructor(t,e,n){this.owner=t,this.args=e,this.caller=n,hr(this,t)}get id(){return et(this)}get class(){return"ember-view"}validateArguments(){for(let t of Object.keys(this.args.named))this.isSupportedArgument(t)||this.onUnsupportedArgument(t)}named(t){let e=this.args.named[t];return e?qn(e):void 0}positional(t){let e=this.args.positional[t];return e?qn(e):void 0}listenerFor(t){return this.named(t)||Ev}isSupportedArgument(t){return!1}onUnsupportedArgument(t){}toString(){return`<${this.constructor}:${et(this)}>`}}const Rv=new WeakMap;function Pv(t,e){let n={create(){throw void 0},toString:()=>t.toString()};return Rv.set(n,t),Fi(Iv,n),Zi(e,n),n}const Mv={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Iv=new class{getCapabilities(){return Mv}create(t,e,n,i,r,s){var o;let a=new(o=e,Rv.get(o))(t,n.capture(),qn(s));return We(a.validateArguments.bind(a)),a}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}getDebugName(t){return t.toString()}getSelf(t){return Fn(t)}getDestroyable(t){return t}},Ov=Object.freeze({});function Av(t){return function(t){return t.target}(t).value}function Fv(t){return void 0===t?new Lv(void 0):Un(t)?new Lv(qn(t)):Bn(t)?new zv(t):new Dv(t)}class Lv{static{Sh(this.prototype,"value",[Is])}#_=void Eh(this,"value");constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}}class zv{constructor(t){this.reference=t}get(){return qn(this.reference)}set(t){Vn(this.reference,t)}}class Dv{local;upstream;lastUpstreamValue=Ov;constructor(t){this.upstream=new zv(t)}get(){let t=this.upstream.get();return t!==this.lastUpstreamValue&&(this.lastUpstreamValue=t,this.local=new Lv(t)),this.local.get()}set(t){this.local.set(t)}}class jv extends Tv{validateArguments(){super.validateArguments()}_value=Fv(this.args.named.value);get value(){return this._value.get()}set value(t){this._value.set(t)}valueDidChange(t){this.value=Av(t)}static{kh(this.prototype,"valueDidChange",[Mu])}change(t){this.valueDidChange(t)}input(t){this.valueDidChange(t)}keyUp(t){switch(t.key){case"Enter":this.listenerFor("enter")(t),this.listenerFor("insert-newline")(t);break;case"Escape":this.listenerFor("escape-press")(t)}}static{kh(this.prototype,"keyUp",[Mu])}listenerFor(t){let e=super.listenerFor(t);return this.isVirtualEventListener(t,e)?function(t){return e=>t(Av(e),e)}(e):e}isVirtualEventListener(t,e){return-1!==["enter","insert-newline","escape-press"].indexOf(t)}}let Nv;if(e){const t=Object.create(null),e=document.createElement("input");t[""]=!1,t.text=!0,t.checkbox=!0,Nv=n=>{let i=t[n];if(void 0===i){try{e.type=n,i=e.type===n}catch(r){i=!1}finally{e.type="text"}t[n]=i}return i}}else Nv=t=>""!==t;class Uv extends jv{static toString(){return"Input"}get class(){return this.isCheckbox?"ember-checkbox ember-view":"ember-text-field ember-view"}get type(){let t=this.named("type");return null==t?"text":Nv(t)?t:"text"}get isCheckbox(){return"checkbox"===this.named("type")}_checked=Fv(this.args.named.checked);get checked(){return this.isCheckbox?this._checked.get():void 0}set checked(t){this._checked.set(t)}change(t){this.isCheckbox?this.checkedDidChange(t):super.change(t)}static{kh(this.prototype,"change",[Mu])}input(t){this.isCheckbox||super.input(t)}static{kh(this.prototype,"input",[Mu])}checkedDidChange(t){let e=t.target;this.checked=e.checked}static{kh(this.prototype,"checkedDidChange",[Mu])}isSupportedArgument(t){return-1!==["type","value","checked","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}}const Bv=Pv(Uv,kv),qv=Qg({id:"7Z3LFeO/",block:'[[[11,3],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[16,"role",[30,0,["role"]]],[16,"title",[30,0,["title"]]],[16,"rel",[30,0,["rel"]]],[16,"tabindex",[30,0,["tabindex"]]],[16,"target",[30,0,["target"]]],[17,1],[16,6,[30,0,["href"]]],[4,[32,0],["click",[30,0,["click"]]],null],[12],[18,2,null],[13]],["&attrs","&default"],["yield"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/link-to.hbs",scope:()=>[xv],isStrictMode:!0}),Vv=[],$v={};function Gv(t){return null==t}function Wv(t){return"object"==typeof t&&null!==t&&!0===t.isQueryParams}class Hv extends Tv{static toString(){return"LinkTo"}static{Sh(this.prototype,"routing",[Uf("-routing")])}#v=void Eh(this,"routing");validateArguments(){super.validateArguments()}get class(){let t="ember-view";return this.isActive?(t+=this.classFor("active"),!1===this.willBeActive&&(t+=" ember-transitioning-out")):this.willBeActive&&(t+=" ember-transitioning-in"),this.isLoading&&(t+=this.classFor("loading")),this.isDisabled&&(t+=this.classFor("disabled")),t}get href(){if(this.isLoading)return"#";let{routing:t,route:e,models:n,query:i}=this;return De(on(t,"currentState")),t.generateURL(e,n,i)}click(t){if(!Au(t))return;let e=t.currentTarget;if(""!==e.target&&"_self"!==e.target)return;if(this.preventDefault(t),this.isDisabled)return;if(this.isLoading)return;let{routing:n,route:i,models:r,query:s,replace:o}=this,a={transition:void 0};ah(0,0,()=>{a.transition=n.transitionTo(i,r,s,o)})}static{kh(this.prototype,"click",[Mu])}get route(){if("route"in this.args.named){let t=this.named("route");return t&&this.namespaceRoute(t)}return this.currentRoute}currentRouteCache=qe(()=>(De(on(this.routing,"currentState")),We(()=>this.routing.currentRouteName)));get currentRoute(){return Ve(this.currentRouteCache)}get models(){return"models"in this.args.named?this.named("models"):"model"in this.args.named?[this.named("model")]:Vv}get query(){return"query"in this.args.named?{...this.named("query")}:$v}get replace(){return!0===this.named("replace")}get isActive(){return this.isActiveForState(this.routing.currentState)}get willBeActive(){let t=this.routing.currentState,e=this.routing.targetState;return t===e?null:this.isActiveForState(e)}get isLoading(){return Gv(this.route)||this.models.some(t=>Gv(t))}get isDisabled(){return Boolean(this.named("disabled"))}get isEngine(){return void 0!==hd(this.owner)}get engineMountPoint(){return this.owner.mountPoint}classFor(t){let e=this.named(`${t}Class`);return!0===e||Gv(e)?` ${t}`:e?` ${e}`:""}namespaceRoute(t){let{engineMountPoint:e}=this;return void 0===e?t:"application"===t?e:`${e}.${t}`}isActiveForState(t){if(!function(t){return!Gv(t)}(t))return!1;if(this.isLoading)return!1;let e=this.named("current-when");if("boolean"==typeof e)return e;if("string"==typeof e){let{models:n,routing:i}=this;return e.split(" ").some(e=>i.isActiveForRoute(n,void 0,this.namespaceRoute(e),t))}{let{route:e,models:n,query:i,routing:r}=this;return r.isActiveForRoute(n,i,e,t)}}preventDefault(t){t.preventDefault()}isSupportedArgument(t){return-1!==["route","model","models","query","replace","disabled","current-when","activeClass","loadingClass","disabledClass"].indexOf(t)||super.isSupportedArgument(t)}}let{prototype:Kv}=Hv,Xv=(t,e)=>t?Object.getOwnPropertyDescriptor(t,e)||Xv(Object.getPrototypeOf(t),e):null;{let t=Kv.onUnsupportedArgument;Object.defineProperty(Kv,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"href"===e||t.call(this,e)}})}{let t=Xv(Kv,"models").get;Object.defineProperty(Kv,"models",{configurable:!0,enumerable:!1,get:function(){let e=t.call(this);return e.length>0&&!("query"in this.args.named)&&Wv(e[e.length-1])&&(e=e.slice(0,-1)),e}});let e=Xv(Kv,"query").get;Object.defineProperty(Kv,"query",{configurable:!0,enumerable:!1,get:function(){if("query"in this.args.named){let t=e.call(this);return Wv(t)?t.values??$v:t}{let e=t.call(this);if(e.length>0){let t=e[e.length-1];if(Wv(t)&&null!==t.values)return t.values}return $v}}})}{let t=Kv.onUnsupportedArgument;Object.defineProperty(Kv,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"params"!==e&&t.call(this,e)}})}const Yv=Pv(Hv,qv),Zv=Qg({id:"KVdeMchh",block:'[[[11,"textarea"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/textarea.hbs",scope:()=>[xv],isStrictMode:!0});class Jv extends jv{static toString(){return"Textarea"}get class(){return"ember-text-area ember-view"}change(t){super.change(t)}static{kh(this.prototype,"change",[Mu])}input(t){super.input(t)}static{kh(this.prototype,"input",[Mu])}isSupportedArgument(t){return-1!==["type","value","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}}const Qv=Pv(Jv,Zv);function tb(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}function eb(t,e){return"attrs"===e[0]&&(e.shift(),1===e.length)?$n(t,e[0]):Gn(t,e)}function nb(t){let e=t.indexOf(":");return-1===e?[t,t,!0]:[t.substring(0,e),t.substring(e+1),!1]}function ib(t,e,n,i){let[r,s,o]=n;if("id"===s){let e=Ss(t,r);null==e&&(e=t.elementId);let n=Pn(e);return void i.setAttribute("id",n,!0,null)}let a=r.indexOf(".")>-1?eb(e,r.split(".")):$n(e,r);i.setAttribute(s,a,!1,null)}function rb(t,e){let n;return zn(()=>{let i=qn(t);return!0===i?n||(n=Af(e)):i||0===i?String(i):null})}function sb(){}class ob{classRef=null;rootRef;argsRevision;constructor(t,e,n,i,r,s){this.component=t,this.args=e,this.argsTag=n,this.finalizer=i,this.hasWrappedElement=r,this.isInteractive=s,this.classRef=null,this.argsRevision=null===e?0:he(n),this.rootRef=Fn(t),Wt(this,()=>this.willDestroy(),!0),Wt(this,()=>this.component.destroy())}willDestroy(){let{component:t,isInteractive:e}=this;if(e){Fe(),t.trigger("willDestroyElement"),t.trigger("willClearRender"),Le();let e=Uu(t);e&&(Vu(e),$u(t))}t.renderer.unregister(t)}finalize(){let{finalizer:t}=this;t(),this.finalizer=sb}}function ab(t){let e=Object.create(null),n=Object.create(null);for(let i in t){let r=t[i],s=qn(r);Bn(r)?e[i]=new cb(r,s):e[i]=s,n[i]=s}return n.attrs=e,n}const lb=Symbol("REF");class cb{value;[Sv];[lb];constructor(t,e){this[Sv]=!0,this[lb]=t,this.value=e}update(t){Vn(this[lb],t)}}const ub=Ct("ARGS"),hb=Ct("HAS_BLOCK"),db=Symbol("DIRTY_TAG"),pb=Symbol("IS_DISPATCHING_ATTRS"),fb=Symbol("BOUNDS"),gb=Pn("ember-view");class mb{templateFor(t){let e,{layout:n,layoutName:i}=t,r=ur(t);if(void 0===n){if(void 0===i)return null;e=r.lookup(`template:${i}`)}else{if("function"!=typeof n)return null;e=n}return tb(e(r)).asWrappedLayout()}getDynamicLayout(t){return this.templateFor(t.component)}getTagName(t){let{component:e,hasWrappedElement:n}=t;return n?e&&e.tagName||"div":null}getCapabilities(){return vb}prepareArgs(t,e){if(e.named.has("__ARGS__")){let{__ARGS__:t,...n}=e.named.capture(),i=qn(t);return{positional:i.positional,named:{...n,...i.named}}}const{positionalParams:n}=t.class??t;if(null==n||0===e.positional.length)return null;let i;if("string"==typeof n){let t=e.positional.capture();i={[n]:zn(()=>gy(t))},Object.assign(i,e.named.capture())}else{if(!(Array.isArray(n)&&n.length>0))return null;{const t=Math.min(n.length,e.positional.length);i={},Object.assign(i,e.named.capture());for(let r=0;r{s.setAttribute("class",Pn(t),!1,null)}),l&&l.length&&l.forEach(t=>{!function(t,e,n){let i=e.split(":"),[r,s,o]=i;if(""===r)n.setAttribute("class",Pn(s),!0,null);else{let e,i=r.indexOf(".")>-1,a=i?r.split("."):[],l=i?eb(t,a):$n(t,r);e=void 0===s?rb(l,i?a[a.length-1]:r):function(t,e,n){return zn(()=>qn(t)?e:n)}(l,s,o),n.setAttribute("class",e,!1,null)}}(i,t,s)}),s.setAttribute("class",gb,!1,null),"ariaRole"in t&&s.setAttribute("role",$n(i,"ariaRole"),!1,null),t._transitionTo("hasElement"),n&&(Fe(),t.trigger("willInsertElement"),Le())}didRenderLayout(t,e){t.component[fb]=e,t.finalize()}didCreate({component:t,isInteractive:e}){e&&(t._transitionTo("inDOM"),t.trigger("didInsertElement"),t.trigger("didRender"))}update(t){let{component:e,args:n,argsTag:i,argsRevision:r,isInteractive:s}=t;if(t.finalizer=ch("render.component",_b,e),Fe(),null!==n&&!de(i,r)){Oe();let r=ab(n);i=t.argsTag=Ae(),t.argsRevision=he(i),e[pb]=!0,e.setProperties(r),e[pb]=!1,e.trigger("didUpdateAttrs"),e.trigger("didReceiveAttrs")}s&&(e.trigger("willUpdate"),e.trigger("willRender")),Le(),De(i),De(e[db])}didUpdateLayout(t){t.finalize()}didUpdate({component:t,isInteractive:e}){e&&(t.trigger("didUpdate"),t.trigger("didRender"))}getDestroyable(t){return t}}function yb(t){return t.instrumentDetails({initialRender:!0})}function _b(t){return t.instrumentDetails({initialRender:!1})}const vb={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!0,createArgs:!0,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!0,hasSubOwner:!1},bb=new mb;function wb(t){return t===bb}let xb=new WeakMap;const Sb=Object.freeze([]);class Cb extends(Mh.extend(nc,Ih,{didReceiveAttrs(){},didRender(){},didUpdate(){},didUpdateAttrs(){},willRender(){},willUpdate(){}},{concatenatedProperties:["attributeBindings","classNames","classNameBindings"],classNames:Sb,classNameBindings:Sb})){isComponent=!0;init(t){super.init(t),this._superRerender=this.rerender,this.rerender=this._rerender,this[pb]=!1,this[db]=ye(),this[fb]=null;const e=this._dispatcher;if(e){let t=xb.get(e);t||(t=new WeakSet,xb.set(e,t));let n=Object.getPrototypeOf(this);t.has(n)||(e.lazyEvents.forEach((t,n)=>{null!==t&&"function"==typeof this[t]&&e.setupHandlerForBrowserEvent(n)}),t.add(n))}this.elementId||""===this.tagName||(this.elementId=et(this))}__dispatcher;get _dispatcher(){if(void 0===this.__dispatcher){let t=ur(this);if(t.lookup("-environment:main").isInteractive){let e=t.lookup("event_dispatcher:main");this.__dispatcher=e}else this.__dispatcher=null}return this.__dispatcher}on(t,e,n){return this._dispatcher?.setupHandlerForEmberEvent(t),super.on(t,e,n)}_rerender(){ge(this[db]),this._superRerender()}[is](t,e){if(this[pb])return;let n=this[ub],i=void 0!==n?n[t]:void 0;void 0!==i&&Bn(i)&&Vn(i,2===arguments.length?e:Ss(this,t))}getAttr(t){return this.get(t)}readDOMAttr(t){let e=Uu(this),n="http://www.w3.org/2000/svg"===e.namespaceURI,{type:i,normalized:r}=Yy(e,t);return n||"attr"===i?e.getAttribute(r):e[r]}get childViews(){return Wu(this)}static{kh(this.prototype,"childViews",[Sr({configurable:!1,enumerable:!1})])}appendChild(t){Hu(this,t)}_transitionTo(t){let e=this._currentState,n=this._currentState=this._states[t];this._state=t,e&&e.exit&&e.exit(this),n.enter&&n.enter(this)}nearestOfType(t){let e=this.parentView;for(;e;){if(t.detect(e.constructor))return e;e=e.parentView}}nearestWithProperty(t){let e=this.parentView;for(;e;){if(t in e)return e;e=e.parentView}}rerender(){return this._currentState.rerender(this)}get element(){return this.renderer.getElement(this)}static{kh(this.prototype,"element",[Sr({configurable:!1,enumerable:!1})])}appendTo(t){let n;return n=e&&"string"==typeof t?document.querySelector(t):t,this.renderer.appendTo(this,n),this}append(){return this.appendTo(document.body)}willInsertElement(){return this}didInsertElement(){return this}willClearRender(){return this}destroy(){return super.destroy(),this._currentState.destroy(this),this}willDestroyElement(){return this}didDestroyElement(){return this}parentViewDidChange(){return this}handleEvent(t,e){return this._currentState.handleEvent(this,t,e)}static isComponentFactory=!0;static toString(){return"@ember/component"}}Cb.reopenClass({positionalParams:[]}),Fi(bb,Cb);const kb=Symbol("RECOMPUTE_TAG"),Eb=Symbol("IS_CLASSIC_HELPER");class Tb extends nh{static isHelperFactory=!0;static[Eb]=!0;static helper=Ob;init(t){super.init(t),this[kb]=ye()}recompute(){ya(()=>ge(this[kb]))}}class Rb{capabilities=_i(0,{hasValue:!0,hasDestroyable:!0});ownerInjection;constructor(t){let e={};hr(e,t),this.ownerInjection=e}createHelper(t,e){var n;return{instance:null!=(n=t)&&"class"in n?t.create():t.create(this.ownerInjection),args:e}}getDestroyable({instance:t}){return t}getValue({instance:t,args:e}){let{positional:n,named:i}=e,r=t.compute(n,i);return De(t[kb]),r}getDebugName(t){return nt((t.class||t).prototype)}}Ki(t=>new Rb(t),Tb);const Pb=Ai(Tb);class Mb{isHelperFactory=!0;constructor(t){this.compute=t}create(){return{compute:this.compute}}}const Ib=new class{capabilities=_i(0,{hasValue:!0});createHelper(t,e){return()=>t.compute.call(null,e.positional,e.named)}getValue(t){return t()}getDebugName(t){return nt(t.compute)}};function Ob(t){return new Mb(t)}Ki(()=>Ib,Mb.prototype);class Ab{__string;constructor(t){this.__string=t}toString(){return`${this.__string}`}toHTML(){return this.toString()}}const Fb=function(t){return null==t?t="":"string"!=typeof t&&(t=String(t)),new Ab(t)};function Lb(t){return{object:`${t.name}:main`}}const zb={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Db=fi(zb),jb=new class{create(t,e,n,i,r){let s=r.get("outletState"),o=e.ref;r.set("outletState",o);let a={finalize:ch("render.outlet",Lb,e)};if(void 0!==i.debugRenderTree){let t=qn(s),e=t?.render?.owner,n=qn(o),i=n?.render?.owner;if(e&&e!==i){let{mountPoint:t}=i;t&&(a.engine={mountPoint:t,instance:i})}}return a}getDebugName({name:t}){return`{{outlet}} for ${t}`}getDebugCustomRenderTree(t,e){let n=[];return n.push({bucket:e,type:"outlet",name:"main",args:xy,instance:void 0,template:void 0}),e.engine&&n.push({bucket:e.engine,type:"engine",name:e.engine.mountPoint,args:xy,instance:e.engine.instance,template:void 0}),n}getCapabilities(){return zb}getSelf(){return Mn}didCreate(){}didUpdate(){}didRenderLayout(t){t.finalize()}didUpdateLayout(){}getDestroyable(){return null}},Nb=Qg({id:"Hacwyo/Q",block:'[[[8,[30,1],null,[["@controller","@model"],[[30,2],[30,3]]],null]],["@Component","@controller","@model"],[]]',moduleName:"/home/runner/work/ember.js/ember.js/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts",isStrictMode:!0});class Ub{handle=-1;resolvedName=null;manager=jb;capabilities=Db;compilable;constructor(t,e){this.state=e,this.compilable=tb(Nb(t)).asLayout()}}class Bb extends mb{component;constructor(t){super(),this.component=t}create(t,e,n,{isInteractive:i},r){let s=this.component,o=ch("render.component",yb,s);r.view=s;let a=""!==s.tagName;a||(i&&s.trigger("willRender"),s._transitionTo("hasElement"),i&&s.trigger("willInsertElement"));let l=new ob(s,null,ve,o,a,i);return De(s[db]),l}}const qb={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!1,createArgs:!1,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!1,hasSubOwner:!1};class Vb{handle=-1;resolvedName="-top-level";state;manager;capabilities=fi(qb);compilable=null;constructor(t){this.manager=new Bb(t);let e=bl(t);this.state=e}}function $b(t){return Ii(t,{})}class Gb{constructor(t){this.inner=t}}const Wb=$b(({positional:t})=>{const e=t[0];return zn(()=>{let t=qn(e);return De(gr(t)),er(t)&&(t=Yl(t)),new Gb(t)})});class Hb{position=0;constructor(t){this.length=t}isEmpty(){return!1}memoFor(t){return t}next(){let{length:t,position:e}=this;if(e>=t)return null;let n=this.valueFor(e),i=this.memoFor(e);return this.position++,{value:n,memo:i}}}class Kb extends Hb{static from(t){return t.length>0?new this(t):null}static fromForEachable(t){let e=[];return t.forEach(t=>e.push(t)),this.from(e)}constructor(t){super(t.length),this.array=t}valueFor(t){return this.array[t]}}class Xb extends Hb{static from(t){return t.length>0?new this(t):null}constructor(t){super(t.length),this.array=t}valueFor(t){return dr(this.array,t)}}class Yb extends Hb{static fromIndexable(t){let e=Object.keys(t);if(0===e.length)return null;{let n=[];for(let i of e){let e;e=t[i],ze()&&(De(on(t,i)),Array.isArray(e)&&De(on(e,"[]"))),n.push(e)}return new this(e,n)}}static fromForEachable(t){let e=[],n=[],i=0,r=!1;return t.forEach(function(t,s){r=r||arguments.length>=2,r&&e.push(s),n.push(t),i++}),0===i?null:r?new this(e,n):new Kb(n)}constructor(t,e){super(e.length),this.keys=t,this.values=e}valueFor(t){return this.values[t]}memoFor(t){return this.keys[t]}}class Zb{static from(t){let e=t[Symbol.iterator](),n=e.next(),{done:i}=n;return i?null:new this(e,n)}position=0;constructor(t,e){this.iterable=t,this.result=e}isEmpty(){return!1}next(){let{iterable:t,result:e,position:n}=this;if(e.done)return null;let i=this.valueFor(e,n),r=this.memoFor(e,n);return this.position++,this.result=t.next(),{value:i,memo:r}}}class Jb extends Zb{valueFor(t){return t.value}memoFor(t,e){return e}}class Qb extends Zb{valueFor(t){return t.value[1]}memoFor(t){return t.value[0]}}function tw(t){return null!=t&&"function"==typeof t.forEach}function ew(t){return null!=t&&"function"==typeof t[Symbol.iterator]}var nw;nw={scheduleRevalidate(){ga.ensureInstance()},toBool:function(t){return er(t)?(De(fr(t,"content")),Boolean(Ss(t,"isTruthy"))):Yh(t)?(De(fr(t,"[]")),0!==t.length):null!==(e=t)&&"object"==typeof e&&"function"==typeof e.toHTML?Boolean(t.toString()):Boolean(t);var e},toIterator:function(t){return t instanceof Gb?function(t){return function(t){return null!==t&&("object"==typeof t||"function"==typeof t)}(t)?Array.isArray(t)||rr(t)?Yb.fromIndexable(t):ew(t)?Qb.from(t):tw(t)?Yb.fromForEachable(t):Yb.fromIndexable(t):null}(t.inner):function(t){return H(t)?Array.isArray(t)?Kb.from(t):rr(t)?Xb.from(t):ew(t)?Jb.from(t):tw(t)?Kb.fromForEachable(t):null:null}(t)},getProp:Cs,setProp:zs,getPath:Ss,setPath:Ls,scheduleDestroy(t,e){va("actions",null,e,t)},scheduleDestroyed(t){va("destroy",null,t)}},Nt=nw.scheduleRevalidate,Pt=nw.scheduleDestroy,Mt=nw.scheduleDestroyed,It=nw.toIterator,Ot=nw.toBool,At=nw.getProp,Ft=nw.setProp,Lt=nw.getPath,zt=nw.setPath;class iw{enableDebugTooling=g._DEBUG_RENDER_TREE;constructor(t,e){this.owner=t,this.isInteractive=e}onTransactionCommit(){}}const rw=$b(({positional:t,named:e})=>{const n=t[0];let i=e.type,r=e.loc,s=e.original;return qn(i),qn(r),qn(s),zn(()=>qn(n))});let sw;sw=t=>t.positional[0];const ow=$b(sw),aw=$b(({positional:t})=>zn(()=>{let e=t[0],n=t[1],i=qn(e).split("."),r=i[i.length-1],s=qn(n);return!0===s?Af(r):s||0===s?String(s):""})),lw=$b(({positional:t},e)=>{let n=qn(t[0]);return Fn(e.factoryFor(n)?.class)}),cw=$b(({positional:t})=>{const e=t[0];return zn(()=>{let t=qn(e);return H(t)&&De(fr(t,"[]")),t})}),uw=$b(({positional:t})=>Nn(t[0])),hw=$b(({positional:t})=>Dn(t[0])),dw=$b(({positional:t,named:e})=>Ln(qn(t[0]))),pw=$b(()=>Fn(([3e7]+-1e3+-4e3+-2e3+-1e11).replace(/[0-3]/g,t=>(4*t^16*Math.random()>>(2&t)).toString(16)))),fw={dynamicLayout:!0,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!0},gw=new class{getDynamicLayout(t){return tb(t.engine.lookup("template:application")(t.engine)).asLayout()}getCapabilities(){return fw}getOwner(t){return t.engine}create(t,{name:e},n,i){let r=t.buildChildEngineInstance(e);r.boot();let s,o,a,l,c=r.factoryFor("controller:application")||hp(r,"application");if(n.named.has("model")&&(l=n.named.get("model")),void 0===l)s=c.create(),o=Fn(s),a={engine:r,controller:s,self:o,modelRef:l};else{let t=qn(l);s=c.create({model:t}),o=Fn(s),a={engine:r,controller:s,self:o,modelRef:l}}return i.debugRenderTree&&Gt(r,s),a}getDebugName({name:t}){return t}getDebugCustomRenderTree(t,e,n,i){return[{bucket:e.engine,instance:e.engine,type:"engine",name:t.name,args:n},{bucket:e.controller,instance:e.controller,type:"route-template",name:"application",args:n,template:i}]}getSelf({self:t}){return t}getDestroyable(t){return t.engine}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}update(t){let{controller:e,modelRef:n}=t;void 0!==n&&e.set("model",qn(n))}};class mw{handle=-1;state;manager=gw;compilable=null;capabilities=fi(fw);constructor(t){this.resolvedName=t,this.state={name:t}}}const yw=$b((t,e)=>{let n,i,r,s=t.positional[0];return n=py(t.named,wy),zn(()=>{let t=qn(s);return"string"==typeof t?(i===t||(i=t,r=Tm(0,new mw(t),e,n,!0)),r):(r=null,i=null,null)})}),_w={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},vw=fi(_w),bw=new class{create(t,e,n){let i=n.named.get("controller");return{self:i,controller:qn(i)}}getSelf({self:t}){return t}getDebugName({name:t}){return`route-template (${t})`}getDebugCustomRenderTree({name:t,templateName:e},n,i){return[{bucket:n,type:"route-template",name:t,args:i,instance:n.controller,template:e}]}getCapabilities(){return _w}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}getDestroyable(){return null}};class ww{handle=-1;resolvedName;state;manager=bw;capabilities=vw;compilable;constructor(t,e){let n=tb(e);this.resolvedName=t,this.state={name:t,templateName:n.moduleName},this.compilable=n.asLayout()}}function xw(t,e,n){return Tm(0,new ww(e,n),t,null,!0)}const Sw=$b((t,e,n)=>{let i=zn(()=>{let t=qn(n.get("outletState"));return t?.outlets?.main}),r=null,s=null;return zn(()=>{let t=qn(i),n=function(t,e){if(void 0===e)return null;let n=e.render;if(void 0===n)return null;let i=n.template;return null==i?null:{ref:t,name:n.name,template:i,controller:n.controller}}(i,t);if(!function(t,e){return null!==t&&null!==e&&t.template===e.template&&t.controller===e.controller}(n,r))if(r=n,null!==n){let o,a=t?.render?.owner??e,l=_n(),c=n.template;o=zi(c)?c:xw(a,n.name,c),l.Component=Fn(o),l.controller=Fn(n.controller);let u=Gn(i,["render","model"]),h=qn(u);l.model=zn(()=>(r===n&&(h=qn(u)),h));let d=py(l,wy);s=Tm(0,new Ub(e,n),a,d,!0)}else s=null;return s})});function Cw(t){return{object:`component:${t}`}}const kw={mut:uw,readonly:hw,unbound:dw,"-hash":u_,"-each-in":Wb,"-normalize-class":aw,"-resolve":lw,"-track-array":cw,"-mount":yw,"-outlet":Sw,"-in-el-null":ow},Ew={...kw,array:s_,concat:a_,fn:l_,get:c_,hash:u_,"unique-id":pw};Ew["-disallow-dynamic-resolution"]=rw;const Tw={},Rw={...Tw,on:__};class Pw{componentDefinitionCache=new Map;lookupPartial(){return null}lookupHelper(t,e){let n=Ew[t];if(void 0!==n)return n;let i=e.factoryFor(`helper:${t}`);if(void 0===i)return null;let r=i.class;return void 0===r?null:"function"==typeof r&&!0===r[Eb]?(Ii(Pb,i),i):r}lookupBuiltInHelper(t){return kw[t]??null}lookupModifier(t,e){let n=Rw[t];if(void 0!==n)return n;let i=e.factoryFor(`modifier:${t}`);return void 0===i?null:i.class||null}lookupBuiltInModifier(t){return Tw[t]??null}lookupComponent(t,e){let n=function(t,e){let n=function(t,e){let n=`component:${t}`;return e.factoryFor(n)||null}(e,t);if(null!=(i=n)&&"function"==typeof i.create&&n.class){let t=Ji(n.class);if(void 0!==t)return{component:n,layout:t}}var i;return null===n?null:{component:n,layout:null}}(e,t);if(null===n)return null;let i,r=null;i=null===n.component?r=n.layout(e):n.component;let s=this.componentDefinitionCache.get(i);if(void 0!==s)return s;null===r&&null!==n.layout&&(r=n.layout(e));let o=ch("render.getComponentDefinition",Cw,t),a=null;if(null===n.component)a={state:zy(void 0,t),manager:Fy,template:r};else{let t=n.component,e=t.class,i=Li(e);a={state:wb(i)?t:e,manager:i,template:r}}return o(),this.componentDefinitionCache.set(i,a),a}}const Mw="-top-level";class Iw{static extend(t){return class extends Iw{static create(e){return e?super.create(Object.assign({},t,e)):super.create(t)}}}static reopenClass(t){Object.assign(this,t)}static create(t){let{environment:e,application:n,template:i}=t,r=ur(t),s=i(r);return new Iw(e,r,s,n)}ref;state;constructor(t,e,n,i){this._environment=t,this.owner=e,this.template=n,this.namespace=i;let r=ye(),s={outlets:{main:void 0},render:{owner:e,name:Mw,controller:void 0,model:void 0,template:n}},o=this.ref=zn(()=>(De(r),s),t=>{ge(r),s.outlets.main=t});this.state={ref:o,name:Mw,template:n,controller:void 0}}appendTo(t){let e;e=this._environment.hasDOM&&"string"==typeof t?document.querySelector(t):t,va("render",this.owner.lookup("renderer:-dom"),"appendOutletView",this,e)}rerender(){}setOutletState(t){Vn(this.ref,t)}destroy(){}}class Ow{constructor(t,e){this.view=t,this.outletState=e}child(){return new Ow(this.view,this.outletState)}get(t){return this.outletState}set(t,e){return this.outletState=e,e}}const Aw=()=>{};class Fw{type="component";#b;#w;constructor(t,e,n){this.#w=()=>{let i=lv(t.context,t.builder(t.env,n.into),t.owner,e,n?.args),r=this.#b=i.sync();Gt(this,this.#b),this.#w=()=>{if(!Xt(r)&&!Yt(r))return r.rerender({alwaysRevalidate:!1})}}}isFor(t){return!1}render(){this.#w()}destroy(){Ht(this)}get destroyed(){return Yt(this)}get result(){return this.#b}}class Lw{type="classic";id;result;destroyed;render;env;constructor(t,e,n,i,r,s,o,a){this.root=t,this.id=t instanceof Iw?et(t):zu(t),this.result=void 0,this.destroyed=!1,this.env=e.env,this.render=()=>{let t=tb(i).asLayout(),l=av(e,n,r,a(e.env,{element:s,nextSibling:null}),t,o),c=this.result=l.sync();Gt(n,c),this.render=()=>{if(!Xt(c)&&!Yt(c))return c.rerender({alwaysRevalidate:!1})}}}isFor(t){return this.root===t}destroy(){let{result:t,env:e}=this;this.destroyed=!0,this.root=null,this.result=void 0,this.render=void 0,void 0!==t&&n_(e,()=>Ht(t))}}const zw=[];function Dw(t){let e=zw.indexOf(t);zw.splice(e,1)}let jw=null,Nw=0;ga.on("begin",function(){for(let t of zw)t.rerender()}),ga.on("end",function(){for(let t of zw)if(!t.isValid()){if(Nw>g._RERENDER_LOOP_LIMIT)throw Nw=0,t.destroy(),new Error("infinite rendering invalidation detected");return Nw++,ga.join(null,Aw)}Nw=0,function(){if(null!==jw){let t=jw.resolve;jw=null,ga.join(null,t)}}()});class Uw{static create(t,e){const n=new Uw(t,e);return Gt(e,n),n}#x;#S=-1;#C=!1;#k=!1;#E=[];#T=[];constructor(t,e){this.#x=t,Wt(this,()=>{this.clearAllRoots(e)})}get debug(){return{roots:this.#E,inRenderTransaction:this.#C,isInteractive:this.isInteractive}}get roots(){return this.#E}get owner(){return this.#x.owner}get builder(){return this.#x.builder}get context(){return this.#x.context}get env(){return this.context.env}get isInteractive(){return this.#x.context.env.isInteractive}renderRoot(t,e){let n=this.#E;return n.push(t),Gt(this,t),1===n.length&&function(t){zw.push(t)}(e),this.#R(e),t}#R(t){if(this.#C)return;this.#C=!0;let e=!1;try{this.renderRoots(t),e=!0}finally{e||(this.#S=he(Ce)),this.#C=!1}}renderRoots(t){let e,n=this.#E,i=this.#T;do{e=n.length,n_(this.context.env,()=>{for(let t=0;t=e||r.render()}this.#S=he(Ce)})}while(n.length>e);for(;i.length;){let t=i.pop(),e=n.indexOf(t);n.splice(e,1)}0===this.#E.length&&Dw(t)}scheduleRevalidate(t){ga.scheduleOnce("render",this,this.revalidate,t)}isValid(){return this.#k||0===this.#E.length||de(Ce,this.#S)}revalidate(t){this.isValid()||this.#R(t)}clearAllRoots(t){let e=this.#E;for(let n of e)Ht(n);this.#T.length=0,this.#E=[],e.length&&Dw(t)}}class Bw{static strict(t,n,i){return new Bw(t,{hasDOM:e,...i},n,new Pw,K_)}state;constructor(t,e,n,i,r){let s={constants:new om,heap:new lm},o=e_({document:n},new iw(t,e.isInteractive),s,i),a=new Xg(s,t=>new am(t),o);this.state=Uw.create({owner:t,context:a,builder:r},this)}get debugRenderTree(){let{debugRenderTree:t}=this.state.env;return t}isValid(){return this.state.isValid()}destroy(){Ht(this)}render(t,e){const n=new Fw(this.state,t,{args:e.args,into:(i=e.into,"element"in i?i:{element:i,nextSibling:null})});var i;return this.state.renderRoot(n,this)}rerender(){this.state.scheduleRevalidate(this)}}class qw extends Bw{static strict(t,n,i){return new Bw(t,{hasDOM:e,...i},n,new Pw,K_)}_rootTemplate;_viewRegistry;static create(t){let{_viewRegistry:e}=t,n=ur(t),i=n.lookup("service:-document"),r=n.lookup("-environment:main"),s=n.lookup(Tl`template:-root`),o=n.lookup("service:-dom-builder");return new this(n,i,r,s,e,o)}constructor(t,e,n,i,r,s=K_,o=new Pw){super(t,n,e,o,s),this._rootTemplate=i(t),this._viewRegistry=r||t.lookup("-view-registry:main")}appendOutletView(t,e){let n=new Ub((i=t).owner,i.state);var i;let{name:r,template:s}=t.state,o=_n();o.Component=Fn(xw(t.owner,r,s)),o.controller=Mn,o.model=Mn;let a=py(o,wy);this._appendDefinition(t,Tm(0,n,t.owner,a,!0),e)}appendTo(t,e){let n=new Vb(t);this._appendDefinition(t,Tm(0,n,this.state.owner,null,!0),e)}_appendDefinition(t,e,n){let i=Fn(e),r=new Ow(null,Mn),s=new Lw(t,this.state.context,this.state.owner,this._rootTemplate,i,n,r,this.state.builder);this.state.renderRoot(s,this)}cleanupRootFor(t){if(Yt(this))return;let e=this.state.roots,n=e.length;for(;n--;){let i=e[n];"classic"===i.type&&i.isFor(t)&&(i.destroy(),e.splice(n,1))}}remove(t){t._transitionTo("destroying"),this.cleanupRootFor(t),this.state.isInteractive&&t.trigger("didDestroyElement")}get _roots(){return this.state.debug.roots}get _inRenderTransaction(){return this.state.debug.inRenderTransaction}get _isInteractive(){return this.state.debug.isInteractive}get _context(){return this.state.context}register(t){let e=zu(t);this._viewRegistry[e]=t}unregister(t){delete this._viewRegistry[zu(t)]}getElement(t){if(this._isInteractive)return Uu(t);throw new Error("Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).")}getBounds(t){let e=t[fb];return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}}const Vw=Qg({id:"tiXbzL5t",block:'[[[46,[28,[32,0],null,null],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/outlet.hbs",scope:()=>[Sw],isStrictMode:!0});class $w extends dd{rootElement=null;init(t){super.init(t),this.application._watchInstance(this),this.register("-application-instance:main",this,{instantiate:!1})}_bootSync(t){return this._booted||(t=new Gw(t),this.setupRegistry(t),t.rootElement?this.rootElement=t.rootElement:this.rootElement=this.application.rootElement,t.location&&Ls(this.router,"location",t.location),this.application.runInstanceInitializers(this),t.isInteractive&&this.setupEventDispatcher(),this._booted=!0),this}setupRegistry(t){this.constructor.setupRegistry(this.__registry__,t)}_router;get router(){if(!this._router){let t=this.lookup("router:main");this._router=t}return this._router}didCreateRootView(t){t.appendTo(this.rootElement)}startRouting(){this.router.startRouting()}setupRouter(){this.router.setupRouter()}handleURL(t){return this.setupRouter(),this.router.handleURL(t)}setupEventDispatcher(){let t=this.lookup("event_dispatcher:main"),e=Ss(this.application,"customEvents"),n=Ss(this,"customEvents"),i=Object.assign({},e,n);return t.setup(i,this.rootElement),t}getURL(){return this.router.url}visit(t){this.setupRouter();let e=this.__container__.lookup("-environment:main"),n=this.router,i=()=>e.options.shouldRender?(null===jw&&(jw=uu.defer(),da()||ga.schedule("actions",null,Aw)),jw.promise).then(()=>this):this,r=t=>{if(t.error&&t.error instanceof Error)throw t.error;if("TransitionAborted"===t.name&&n._routerMicrolib.activeTransition)return n._routerMicrolib.activeTransition.then(i,r);throw"TransitionAborted"===t.name?new Error(t.message):t},s=Ss(n,"location");return s.setURL(t),n.handleURL(s.getURL()).then(i,r)}willDestroy(){super.willDestroy(),this.application._unwatchInstance(this)}static setupRegistry(t,e={}){let n=e instanceof Gw?e:new Gw(e);t.register("-environment:main",n.toEnvironment(),{instantiate:!1}),t.register("service:-document",n.document,{instantiate:!1}),super.setupRegistry(t,n)}}class Gw{isInteractive;_renderMode;isBrowser;location=null;shouldRender;document;rootElement;constructor(t={}){this.isInteractive=Boolean(e),this._renderMode=t._renderMode,void 0!==t.isBrowser?this.isBrowser=Boolean(t.isBrowser):this.isBrowser=Boolean(e),this.isBrowser||(this.isInteractive=!1,this.location="none"),void 0!==t.shouldRender?this.shouldRender=Boolean(t.shouldRender):this.shouldRender=!0,this.shouldRender||(this.isInteractive=!1),t.document?this.document=t.document:this.document="undefined"!=typeof document?document:null,t.rootElement&&(this.rootElement=t.rootElement),void 0!==t.location&&(this.location=t.location),void 0!==t.isInteractive&&(this.isInteractive=Boolean(t.isInteractive))}toEnvironment(){return{...l,hasDOM:this.isBrowser,isInteractive:this.isInteractive,_renderMode:this._renderMode,options:this}}}function Ww(t,e){return null!=t&&"function"==typeof t[e]}class Hw extends Tu{static NAMESPACES=ao;static NAMESPACES_BY_ID=lo;static processAll=go;static byName=po;init(t){super.init(t),co(this)}toString(){let t=Ss(this,"name")||Ss(this,"modulePrefix");if(t)return t;ho();let e=no(this);return void 0===e&&(e=et(this),eo(this,e)),e}nameClasses(){fo(this)}destroy(){return uo(this),super.destroy()}}Hw.prototype.isNamespace=!0;const Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Hw},Symbol.toStringTag,{value:"Module"}));var Xw=function(){function t(){this._vertices=new Yw}return t.prototype.add=function(t,e,n,i){if(!t)throw new Error("argument `key` is required");var r=this._vertices,s=r.add(t);if(s.val=e,n)if("string"==typeof n)r.addEdge(s,r.add(n));else for(var o=0;o0){var i="cycle detected: "+e;throw this.each(this.path,function(t){i+=" <- "+t}),new Error(i)}}},t.prototype.reset=function(){this.stack.length=0,this.path.length=0,this.result.length=0;for(var t=0,e=this.length;t=0){var a=this[o];if(a.flag)continue;if(a.flag=!0,r.push(o),e===a.key)break;i.push(~o),this.pushIncoming(a)}else r.pop(),s.push(~o)}},t.prototype.pushIncoming=function(t){for(var e=this.stack,n=t.length-1;n>=0;n--){var i=t[n];this[i].flag||e.push(i)}},t.prototype.each=function(t,e){for(var n=0,i=t.length;n{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.test(e)&&"class"===Fh(t[e])&&n.push(Af(e.replace(i,"")))}),n}}class Qw extends Tu{componentFor(t,e){let n=`component:${t}`;return e.factoryFor(n)}layoutFor(t,e,n){let i=`template:components/${t}`;return e.lookup(i,n)}}const tx=new WeakMap;class ex extends V_{__openBlock(){let{tagName:t}=this.element;if("TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=this.serializeBlockDepth++;this.__appendComment(`%+b:${t}%`)}super.__openBlock()}__closeBlock(){let{tagName:t}=this.element;if(super.__closeBlock(),"TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=--this.serializeBlockDepth;this.__appendComment(`%-b:${t}%`)}}__appendHTML(t){let{tagName:e}=this.element;if("TITLE"===e||"SCRIPT"===e||"STYLE"===e)return super.__appendHTML(t);let n=this.__appendComment("%glmr%");if("TABLE"===e){let e=t.indexOf("<");e>-1&&"tr"===t.slice(e+1,e+3)&&(t=`${t}`)}""===t?this.__appendComment("% %"):super.__appendHTML(t);let i=this.__appendComment("%glmr%");return new Im(this.element,n,i)}__appendText(t){let{tagName:e}=this.element,n=function(t){let{element:e,nextSibling:n}=t;return null===n?e.lastChild:n.previousSibling}(this);return"TITLE"===e||"SCRIPT"===e||"STYLE"===e?super.__appendText(t):""===t?this.__appendComment("% %"):(n&&3===n.nodeType&&this.__appendComment("%|%"),super.__appendText(t))}closeElement(){return tx.has(this.element)&&(tx.delete(this.element),super.closeElement()),super.closeElement()}openElement(t){return"tr"===t&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),tx.set(this.constructing,!0),this.flushElement(null)),super.openElement(t)}pushRemoteElement(t,e,n=null){let{dom:i}=this,r=i.createElement("script");return r.setAttribute("glmr",e),i.insertBefore(t,r,n),super.pushRemoteElement(t,e,n)}constructor(...t){super(...t),this.serializeBlockDepth=0}}function nx(t,e){return ex.forInitialRender(t,e)}function ix(t){t.register("service:-dom-builder",{create(t){switch(ur(t).lookup("-environment:main")._renderMode){case"serialize":return nx.bind(null);case"rehydrate":return bv.bind(null);default:return K_.bind(null)}}}),t.register(Tl`template:-root`,Cv),t.register("renderer:-dom",qw)}class rx extends(Hw.extend(Gl)){static initializers=Object.create(null);static instanceInitializers=Object.create(null);static initializer=ox("initializers");static instanceInitializer=ox("instanceInitializers");static buildRegistry(t){let e=new Cl({resolver:sx(t)});return e.set=Ls,e.register("application:main",t,{instantiate:!1}),function(t){t.optionsForType("component",{singleton:!1}),t.optionsForType("view",{singleton:!1}),t.register("controller:basic",ad,{instantiate:!1}),t.register("service:-routing",Wf),t.register("resolver-for-debugging:main",t.resolver,{instantiate:!1}),t.register("container-debug-adapter:main",Jw),t.register("component-lookup:main",Qw)}(e),function(t){t.optionsForType("template",{instantiate:!1}),t.register("view:-outlet",Iw),t.register("template:-outlet",Vw),t.optionsForType("helper",{instantiate:!1}),t.register("component:input",Bv),t.register("component:link-to",Yv),t.register("component:textarea",Qv)}(e),e}init(t){super.init(t),this.buildRegistry()}_initializersRan=!1;ensureInitializers(){this._initializersRan||(this.runInitializers(),this._initializersRan=!0)}buildInstance(t={}){return this.ensureInitializers(),dd.create({...t,base:this})}buildRegistry(){return this.__registry__=this.constructor.buildRegistry(this)}initializer(t){this.constructor.initializer(t)}instanceInitializer(t){this.constructor.instanceInitializer(t)}runInitializers(){this._runInitializer("initializers",(t,e)=>{e.initialize(this)})}runInstanceInitializers(t){this._runInitializer("instanceInitializers",(e,n)=>{n.initialize(t)})}_runInitializer(t,e){let n,i=Ss(this.constructor,t),r=function(t){let e=[];for(let n in t)e.push(n);return e}(i),s=new Xw;for(let o of r)n=i[o],s.add(n.name,n,n.before,n.after);s.topsort(e)}}function sx(t){let e={namespace:t};return t.Resolver.create(e)}function ox(t){return function(e){let n=this.superclass;if(void 0!==n[t]&&n[t]===this[t]){let e={[t]:Object.create(this[t])};this.reopenClass(e)}this[t][e.name]=e}}const ax=sl,lx=hr;class cx extends rx{static buildRegistry(t){let e=super.buildRegistry(t);return function(t){t.register("router:main",sf),t.register("-view-registry:main",{create:()=>al(null)}),t.register("route:basic",Sp),t.register("event_dispatcher:main",Qu),t.register("location:hash",yf),t.register("location:history",bf),t.register("location:none",wf),t.register(Tl`-bucket-cache:main`,{create:()=>new Mp}),t.register("service:router",Gf)}(e),ix(e),e}static initializer=ox("initializers");static instanceInitializer=ox("instanceInitializers");init(t){super.init(t),this.rootElement??="body",this._document??=null,this.eventDispatcher??=null,this.customEvents??=null,this.autoboot??=!0,this._document??=e?window.document:null,this._globalsMode??=!0,this._readinessDeferrals=1,this._booted=!1,this._applicationInstances=new Set,this.autoboot=this._globalsMode=Boolean(this.autoboot),this._globalsMode&&this._prepareForGlobalsMode(),this.autoboot&&this.waitForDOMReady()}buildInstance(t={}){return $w.create({...t,base:this,application:this})}_watchInstance(t){this._applicationInstances.add(t)}_unwatchInstance(t){return this._applicationInstances.delete(t)}Router;_prepareForGlobalsMode(){this.Router=(this.Router||sf).extend(),this._buildDeprecatedInstance()}__deprecatedInstance__;__container__;_buildDeprecatedInstance(){let t=this.buildInstance();this.__deprecatedInstance__=t,this.__container__=t.__container__}waitForDOMReady(){const t=this._document;if(null===t||"loading"!==t.readyState)va("actions",this,this.domReady);else{let e=()=>{t.removeEventListener("DOMContentLoaded",e),ma(this,this.domReady)};t.addEventListener("DOMContentLoaded",e)}}domReady(){this.isDestroying||this.isDestroyed||this._bootSync()}deferReadiness(){this._readinessDeferrals++}advanceReadiness(){this._readinessDeferrals--,0===this._readinessDeferrals&&ba(this,this.didBecomeReady)}_bootPromise=null;boot(){if(this._bootPromise)return this._bootPromise;try{this._bootSync()}catch(t){}return this._bootPromise}_bootResolver=null;_bootSync(){if(this._booted||this.isDestroying||this.isDestroyed)return;let t=this._bootResolver=hu.defer();this._bootPromise=t.promise;try{this.runInitializers(),dl("application",this),this.advanceReadiness()}catch(Fj){throw t.reject(Fj),Fj}}reset(){let t=this.__deprecatedInstance__;this._readinessDeferrals=1,this._bootPromise=null,this._bootResolver=null,this._booted=!1,ya(this,function(){ma(t,"destroy"),this._buildDeprecatedInstance(),va("actions",this,"_bootSync")})}didBecomeReady(){if(!this.isDestroying&&!this.isDestroyed)try{if(this.autoboot){let t;t=this._globalsMode?this.__deprecatedInstance__:this.buildInstance(),t._bootSync(),this.ready(),t.startRouting()}this._bootResolver.resolve(this),this._booted=!0}catch(Fj){throw this._bootResolver.reject(Fj),Fj}}ready(){return this}willDestroy(){super.willDestroy(),ul.application===this&&(ul.application=void 0),this._applicationInstances.size&&(this._applicationInstances.forEach(t=>t.destroy()),this._applicationInstances.clear())}visit(t,e){return this.boot().then(()=>{let n=this.buildInstance();return n.boot(e).then(()=>n.visit(t)).catch(t=>{throw ma(n,"destroy"),t})})}}const ux=Object.freeze(Object.defineProperty({__proto__:null,_loaded:ul,default:cx,getOwner:ax,onLoad:hl,runLoadHooks:dl,setOwner:lx},Symbol.toStringTag,{value:"Module"})),hx=Object.assign({},{});function dx(){return px.global}const px={packages:{},global:{}};let fx="undefined"!=typeof window?window._embroider_macros_runtime_config:void 0;if(fx){let t={config:function(t){return px.packages[t]},getGlobalConfig:dx,setConfig(t,e){px.packages[t]=e},setGlobalConfig(t,e){px.global[t]=e}};for(let e of fx)e(t)}const gx={modulePrefix:"marco",environment:"production",rootURL:"/",locationType:"history",EmberENV:{},APP:{}},mx=Object.freeze(Object.defineProperty({__proto__:null,default:gx,enterTestMode:function(){gx.locationType="none",gx.APP.rootElement="#ember-testing",gx.APP.autoboot=!1;const t=dx()["@embroider/macros"];t&&(t.isTesting=!0)}},Symbol.toStringTag,{value:"Module"}));var yx;yx={throwOnUnhandled:!1,workflow:[]},self.deprecationWorkflow=self.deprecationWorkflow||{},self.deprecationWorkflow.deprecationLog={messages:new Set},self.deprecationWorkflow.flushDeprecations=t=>function({handler:t="silence",config:e={}}={}){let n=self.deprecationWorkflow.deprecationLog.messages,i=e.workflow??[],r=n.values().filter(t=>!i.some(e=>e.matchId===t)).map(e=>({handler:t,matchId:e})),s={...e,workflow:[...i,...r]};return`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';\n\nsetupDeprecationWorkflow(${JSON.stringify(s,void 0,2)});`}({config:yx,...t});const _x=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function vx(t,e){return Wt(t,e)}function bx(t,e){return function(t,e,n=!1){let i=$t(t),r=n?"eagerDestructors":"destructors";i[r]=Vt(i[r],e)}(t,e)}!function(){const t="TEST_WAITERS",e="undefined"!=typeof Symbol?Symbol.for(t):t,n=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;throw new Error("unable to locate global object")}();let i=n[e];void 0===i&&(i=n[e]=new Map)}();const wx=Object.freeze(Object.defineProperty({__proto__:null,assertDestroyablesDestroyed:jt,associateDestroyableChild:Gt,destroy:Ht,enableDestroyableTracking:Dt,isDestroyed:Yt,isDestroying:Xt,registerDestructor:vx,unregisterDestructor:bx},Symbol.toStringTag,{value:"Module"}));let xx;xx=sf;var Sx=xx;class Cx extends Sx{location=gx.locationType;rootURL=gx.rootURL}Cx.map(function(){this.route("place",{path:"/place/:place_id"}),this.route("place.new",{path:"/place/new"}),this.route("search")});const kx=Object.freeze(Object.defineProperty({__proto__:null,default:Cx},Symbol.toStringTag,{value:"Module"})),Ex=new WeakMap;function Tx(t,e,n,i){let r={configurable:!0,enumerable:!0,writable:!0,initializer:null};i&&(r.initializer=i);for(let s of n)r=s(t,e,r)||r;void 0===r.initializer?Object.defineProperty(t,e,r):function(t,e,n){let i=Ex.get(t);i||(i=new Map,Ex.set(t,i)),i.set(e,n)}(t,e,r)}function Rx(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}function Px(t,e){let n=function(t,e){var n;let i=t.prototype;for(;i;){let t=null==(n=Ex.get(i))?void 0:n.get(e);if(t)return t;i=i.prototype}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}class Mx extends Bf{static{Tx(this.prototype,"selectedPlace",[Is],function(){return null})}#P=void Px(this,"selectedPlace");static{Tx(this.prototype,"isSearching",[Is],function(){return!1})}#M=void Px(this,"isSearching");static{Tx(this.prototype,"isCreating",[Is],function(){return!1})}#I=void Px(this,"isCreating");static{Tx(this.prototype,"creationCoordinates",[Is],function(){return null})}#O=void Px(this,"creationCoordinates");static{Tx(this.prototype,"returnToSearch",[Is],function(){return!1})}#A=void Px(this,"returnToSearch");selectPlace(t){this.selectedPlace=t}clearSelection(){this.selectedPlace=null}startSearch(){this.isSearching=!0,this.isCreating=!1}stopSearch(){this.isSearching=!1}startCreating(){this.isCreating=!0,this.isSearching=!1}stopCreating(){this.isCreating=!1,this.creationCoordinates=null}updateCreationCoordinates(t,e){this.creationCoordinates={lat:t,lon:e}}}const Ix=Object.freeze(Object.defineProperty({__proto__:null,default:Mx},Symbol.toStringTag,{value:"Module"}));class Ox extends Bf{static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");controller=null;cachedResults=null;lastQueryKey=null;async getNearbyPois(t,e,n=50){const i=`${t},${e},${n}`;if(this.lastQueryKey===i&&this.cachedResults)return console.debug("Returning cached Overpass results for:",i),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const r=this.controller.signal,s=`\n[out:json][timeout:25];\n(\n nw["amenity"](around:${n},${t},${e});\n nw["shop"](around:${n},${t},${e});\n nw["tourism"](around:${n},${t},${e});\n nw["leisure"](around:${n},${t},${e});\n nw["historic"](around:${n},${t},${e});\n);\nout center;\n `.trim(),o=`${this.settings.overpassApi}?data=${encodeURIComponent(s)}`;try{const t=await this.fetchWithRetry(o,{signal:r});if(!t.ok)throw new Error("Overpass request failed");const e=(await t.json()).elements.map(this.normalizePoi);return this.lastQueryKey=i,this.cachedResults=e,e}catch(a){if("AbortError"===a.name)return console.debug("Overpass request aborted"),[];throw a}}normalizePoi(t){return{title:t.tags?.name||t.tags?.["name:en"]||"Untitled Place",lat:t.lat||t.center?.lat,lon:t.lon||t.center?.lon,url:t.tags?.website,osmId:String(t.id),osmType:t.type,osmTags:t.tags||{},description:t.tags?.description}}async fetchWithRetry(t,e={},n=3){try{const i=await fetch(t,e);return!i.ok&&n>0&&[502,503,504,429].includes(i.status)?(console.warn(`Overpass request failed with ${i.status}. Retrying... (${n} left)`),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1)):i}catch(i){if(n>0&&"AbortError"!==i.name)return console.debug(`Retrying Overpass request... (${n} left)`),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1);throw i}}async getPoiById(t,e=null){let n;n="node"===e?`[out:json][timeout:25];node(${t});out center;`:"way"===e?`[out:json][timeout:25];way(${t});out center;`:`\n[out:json][timeout:25];\n(\n node(${t});\n way(${t});\n);\nout center;\n `.trim();const i=`${this.settings.overpassApi}?data=${encodeURIComponent(n)}`,r=await this.fetchWithRetry(i);if(!r.ok)throw new Error("Overpass request failed");const s=await r.json();return s.elements[0]?this.normalizePoi(s.elements[0]):null}}const Ax=Object.freeze(Object.defineProperty({__proto__:null,default:Ox},Symbol.toStringTag,{value:"Module"}));class Fx extends Bf{static{Tx(this.prototype,"overpassApi",[Is],function(){return"https://overpass.bke.ro/api/interpreter"})}#L=void Px(this,"overpassApi");static{Tx(this.prototype,"mapKinetic",[Is],function(){return!0})}#z=void Px(this,"mapKinetic");overpassApis=[{name:"bke.ro",url:"https://overpass.bke.ro/api/interpreter"},{name:"overpass-api.de",url:"https://overpass-api.de/api/interpreter"},{name:"private.coffee",url:"https://overpass.private.coffee/api/interpreter"}];constructor(){super(...arguments),this.loadSettings()}loadSettings(){const t=localStorage.getItem("marco:overpass-api");t&&(this.overpassApi=t);const e=localStorage.getItem("marco:map-kinetic");null!==e&&(this.mapKinetic="true"===e)}updateOverpassApi(t){this.overpassApi=t,localStorage.setItem("marco:overpass-api",t)}updateMapKinetic(t){this.mapKinetic=t,localStorage.setItem("marco:map-kinetic",String(t))}}const Lx=Object.freeze(Object.defineProperty({__proto__:null,default:Fx},Symbol.toStringTag,{value:"Module"}));function zx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dx,jx={exports:{}},Nx=(Dx||(Dx=1,jx.exports=function(){var t={548:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Access=void 0;class n{constructor(){this.reset()}get scopes(){return Object.keys(this.scopeModeMap).map(t=>({name:t,mode:this.scopeModeMap[t]}))}get scopeParameter(){return this.scopes.map(t=>`${this._scopeNameForParameter(t)}:${t.mode}`).join(" ")}claim(t,e){if("string"!=typeof t||-1!==t.indexOf("/")||0===t.length)throw new Error("Scope should be a non-empty string without forward slashes");if("string"!=typeof e||!e.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(t),this.scopeModeMap[t]=e}get(t){return this.scopeModeMap[t]}remove(t){const e={};for(const n in this.scopeModeMap)e[n]=this.scopeModeMap[n];this.reset(),delete e[t];for(const n in e)this.claim(n,e[n])}checkPermission(t,e){const n=this.get(t);return n&&("r"===e||"rw"===n)}checkPathPermission(t,e){if(this.checkPermission("*",e))return!0;const n=this._getModuleName(t);return!!this.checkPermission(n,e)}reset(){this.rootPaths=[],this.scopeModeMap={}}_getModuleName(t){if("/"!==t[0])throw new Error("Path should start with a slash");const e=t.replace(/^\/public/,"").match(/^\/([^/]*)\//);return e?e[1]:"*"}_adjustRootPaths(t){"*"in this.scopeModeMap||"*"===t?this.rootPaths=["/"]:t in this.scopeModeMap||(this.rootPaths.push("/"+t+"/"),this.rootPaths.push("/public/"+t+"/"))}_scopeNameForParameter(t){if("*"===t.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return t.name}setStorageType(t){this.storageType=t}static _rs_init(){}}e.Access=n,e.default=n},275:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Authorize=void 0;const s=r(n(334)),o=n(746),a=r(n(503)),l=n(368);let c;function u(t){const e=t||h.getLocation().href,n={};for(const[s,o]of new URL(e).searchParams)n[s]=o;const i=e.indexOf("#");if(-1===i)return n;const r=e.substring(i+1);return r.includes("=")?r.split("&").reduce(function(t,e){const n=e.split("=");if("state"===n[0]&&n[1].match(/rsDiscovery/)){let e=decodeURIComponent(n[1]);const i=e.substr(e.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];t.rsDiscovery=JSON.parse(atob(i)),e=e.replace(new RegExp("&?rsDiscovery="+i),""),e.length>0&&(t.state=e)}else t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]);return t},n):n}class h{static authorize(t,e){if((0,s.default)("[Authorize] authURL = ",e.authURL,"scope = ",e.scope,"redirectUri = ",e.redirectUri,"clientId = ",e.clientId,"response_type =",e.response_type),!e.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if(!(0,o.localStorageAvailable)()&&"remotestorage"===t.backend){e.redirectUri+=e.redirectUri.indexOf("#")>0?"&":"#";const n={userAddress:t.remote.userAddress,href:t.remote.href,storageApi:t.remote.storageApi,properties:t.remote.properties};e.redirectUri+="rsDiscovery="+(0,o.toBase64)(JSON.stringify(n))}const n=function(t){const e=new URL(t.redirectUri);t.state||(t.state=e.hash?e.hash.substring(1):""),t.response_type||(t.response_type="token");const n=new URL(t.authURL);n.searchParams.set("redirect_uri",t.redirectUri.replace(/#.*$/,"")),n.searchParams.set("scope",t.scope),n.searchParams.set("client_id",t.clientId);for(const i of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const e=t[i];e&&n.searchParams.set(i,e)}return n.href}(e);o.globalContext.cordova?h.openWindow(n,e.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then(e=>{t.remote.configure({token:e.access_token})}):h.setLocation(n)}static refreshAccessToken(t,e,n){return i(this,void 0,void 0,function*(){var t,i,r;yield e.configure({token:null,tokenType:null});const o=new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:n}),c=yield(0,l.requestWithTimeout)("POST",e.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString(),responseType:"json"});if(200!==(null==c?void 0:c.status))throw yield e.configure({refreshToken:null}),new a.default("refresh token rejected:"+JSON.stringify(c.response));{(0,s.default)(`[Authorize] access token good for ${null===(t=null==c?void 0:c.response)||void 0===t?void 0:t.expires_in} seconds`);const n={token:null===(i=null==c?void 0:c.response)||void 0===i?void 0:i.access_token,tokenType:null===(r=null==c?void 0:c.response)||void 0===r?void 0:r.token_type};if(!n.token)throw new Error(`no access_token in "successful" refresh: ${c.response}`);yield e.configure(n)}})}static setLocation(t){if("string"==typeof t)document.location.href=t;else{if("object"!=typeof t)throw"Invalid location "+t;document.location=t}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(t){t.removeEventListener("features-loaded",c)}}e.Authorize=h,h.IMPLIED_FAKE_TOKEN=!1,h.getLocation=function(){return document.location},h.openWindow=function(t,e,n){return new Promise((i,r)=>{const s=open(t,"_blank",n);function o(){r("Authorization was canceled")}s&&!s.closed?(s.addEventListener("loadstart",function(t){if(0!==t.url.indexOf(e))return;s.removeEventListener("exit",o),s.close();const n=u(t.url);n?i(n):r("Authorization error")}),s.addEventListener("exit",o)):r("Authorization popup was blocked")})},h._rs_init=function(t){const e=u();let n;e&&(n=h.getLocation(),n.hash=""),c=function(){let r=!1;if(e){if(e.error)throw"access_denied"===e.error?new a.default("Authorization failed: access denied",{code:"access_denied"}):new a.default(`Authorization failed: ${e.error}`);e.rsDiscovery&&t.remote.configure(e.rsDiscovery),e.access_token&&(t.remote.configure({token:e.access_token}),r=!0),e.remotestorage&&(t.connect(e.remotestorage),r=!0),e.state&&(n=h.getLocation(),h.setLocation(n.href.split("#")[0]+"#"+e.state)),e.code&&(function(e){i(this,void 0,void 0,function*(){var i,r,o,a;const c=sessionStorage.getItem("remotestorage:codeVerifier");if(!c)return void(0,s.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");n=h.getLocation();let u=n.origin;"/"!==n.pathname&&(u+=n.pathname);const d=new URLSearchParams({code:e,grant_type:"authorization_code",client_id:t.remote.clientId,redirect_uri:u,code_verifier:c}),p=yield(0,l.requestWithTimeout)("POST",t.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:d.toString(),responseType:"json"});if(200===p.status){(0,s.default)(`[Authorize] access token good for ${null===(i=null==p?void 0:p.response)||void 0===i?void 0:i.expires_in} seconds`);const e={token:null===(r=null==p?void 0:p.response)||void 0===r?void 0:r.access_token,refreshToken:null===(o=null==p?void 0:p.response)||void 0===o?void 0:o.refresh_token,tokenType:null===(a=null==p?void 0:p.response)||void 0===a?void 0:a.token_type};e.token?t.remote.configure(e):t._emit("error",new Error(`no access_token in "successful" response: ${p.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier")}else t._emit("error",new Error(`${p.statusText}: ${p.response}`))})}(e.code),r=!0),r||t.remote.stopWaitingForToken()}else t.remote.stopWaitingForToken()},t.on("features-loaded",c)},e.default=h},424:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseClient=void 0;const s=r(n(439)),o=r(n(613)),a=r(n(491)),l=r(n(93)),c=r(n(28)),u=n(746);class h{constructor(t,e){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==e[e.length-1])throw"Not a folder: "+e;"/"===e&&(this.makePath=t=>("/"===t[0]?"":"/")+t),this.storage=t,this.base=e,this.moduleName=function(t){const e=t.split("/");return t.length>2?e[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),t.onChange(this.base,this._fireChange.bind(this))}scope(t){return new h(this.storage,this.makePath(t))}getListing(t,e){return i(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).then(t=>404===t.statusCode?{}:t.body)})}getAll(t,e){return i(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).then(n=>{if(404===n.statusCode)return{};if("object"==typeof n.body){const i=Object.keys(n.body);if(0===i.length)return{};const r=i.map(i=>this.storage.get(this.makePath(t+i),e).then(t=>{if("string"==typeof t.body)try{t.body=JSON.parse(t.body)}catch(t){}"object"==typeof t.body&&(n.body[i]=t.body)}));return Promise.all(r).then(()=>n.body)}})})}getFile(t,e){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(t),e).then(t=>({data:t.body,contentType:t.contentType,revision:t.revision}))})}storeFile(t,e,n){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'contentType' of baseClient.storeFile must be a string"):"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof n&&"object"!=typeof n?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(e),n,t).then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode)))})}getObject(t,e){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(t),e).then(e=>{if("object"==typeof e.body)return e.body;if("string"==typeof e.body)try{return JSON.parse(e.body)}catch(e){throw new Error("Not valid JSON: "+this.makePath(t))}else if(void 0!==e.body&&200===e.statusCode)return Promise.reject("Not an object: "+this.makePath(t))})})}storeObject(t,e,n){return i(this,void 0,void 0,function*(){if("string"!=typeof t)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof e)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof n)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(n,t);try{const t=this.validate(n);if(!t.valid)return Promise.reject(t)}catch(t){return Promise.reject(t)}return this.storage.put(this.makePath(e),JSON.stringify(n),"application/json; charset=UTF-8").then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode))})}remove(t){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(t),this.storage.connected))})}getItemURL(t){if("string"!=typeof t)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(t=(0,u.cleanPath)(this.makePath(t)),this.storage.remote.href+t):void 0}cache(t,e="ALL"){if("string"!=typeof t)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof e)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==e&&"SEEN"!==e&&"ALL"!==e)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(t),e),this}declareType(t,e,n){let i;if(n&&"string"==typeof e)i=e;else if(n||"string"==typeof e){if(!n&&"string"==typeof e)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else n=e,i=this._defaultTypeURI(t);h.Types.declare(this.moduleName,t,i,n)}validate(t){const e=h.Types.getSchema(t["@context"]);if(e)return s.default.validateResult(t,e);throw new a.default(t["@context"])}_defaultTypeURI(t){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(t)}_attachType(t,e){t["@context"]=h.Types.resolveAlias(this.moduleName+"/"+e)||this._defaultTypeURI(e)}makePath(t){return this.base+(t||"")}_fireChange(t){c.default.changeEvents[t.origin]&&(["new","old","lastCommon"].forEach(function(e){if((!t[e+"ContentType"]||/^application\/(.*)json(.*)/.exec(t[e+"ContentType"]))&&"string"==typeof t[e+"Value"])try{t[e+"Value"]=JSON.parse(t[e+"Value"])}catch(t){}}),this._emit("change",t))}static _rs_init(){}}e.BaseClient=h,h.Types=o.default,(0,u.applyMixins)(h,[l.default]),e.default=h},285:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Caching=void 0;const r=n(746),s=i(n(334));class o{constructor(t){this.pendingActivations=[],this._access=t.access,this.reset()}set(t,e){if("string"!=typeof t)throw new Error("path should be a string");if(!(0,r.isFolder)(t))throw new Error("path should be a folder");if(!this._access.checkPathPermission(t,"r"))throw new Error('No access to path "'+t+'". You must claim access to it first.');if(void 0===e||!e.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[t]=e,"ALL"===e&&(this.activateHandler?this.activateHandler(t):this.pendingActivations.push(t))}enable(t){this.set(t,"ALL")}disable(t){this.set(t,"FLUSH")}onActivate(t){(0,s.default)("[Caching] Setting activate handler",t,this.pendingActivations),this.activateHandler=t;for(let e=0;e{this.emitChange(t.data)})}get(t,e,n){return i(this,void 0,void 0,function*(){return"number"==typeof e?this.getNodes((0,c.pathsFromRoot)(t)).then(i=>{const r=u(i[t]);return h(i,e)?n(t):r?{statusCode:200,body:r.body||r.itemsMap,contentType:r.contentType}:{statusCode:404}}):this.getNodes([t]).then(e=>{const n=u(e[t]);if(n){if((0,c.isFolder)(t))for(const t in n.itemsMap)n.itemsMap.hasOwnProperty(t)&&!1===n.itemsMap[t]&&delete n.itemsMap[t];return{statusCode:200,body:n.body||n.itemsMap,contentType:n.contentType}}return{statusCode:404}})})}put(t,e,n){return i(this,void 0,void 0,function*(){const i=(0,c.pathsFromRoot)(t);return this._updateNodes(i,function(t,i){try{for(let r=0,s=t.length;r0)break}else console.error("Cannot delete non-existing node "+r)}return n})})}flush(t){return this._getAllDescendentPaths(t).then(t=>this.getNodes(t)).then(t=>{for(const e in t){const n=t[e];n&&n.common&&n.local&&this.emitChange({path:n.path,origin:"local",oldValue:!1===n.local.body?void 0:n.local.body,newValue:!1===n.common.body?void 0:n.common.body}),t[e]=void 0}return this.setNodes(t)})}emitChange(t){a.default.changeEvents[t.origin]&&this._emit("change",t)}fireInitial(){a.default.changeEvents.local&&this.forAllNodes(t=>{if((0,c.isDocument)(t.path)){const e=u(t);e&&this.emitChange({path:t.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:e.body,newContentType:e.contentType})}}).then(()=>{this._emit("local-events-done")})}onDiff(t){this.diffHandler=t}_updateNodes(t,e){return new Promise((n,i)=>{this._doUpdateNodes(t,e,{resolve:n,reject:i})})}_doUpdateNodes(t,e,n){return i(this,void 0,void 0,function*(){if(this._updateNodesRunning)return void this._updateNodesQueued.push({paths:t,cb:e,promise:n});this._updateNodesRunning=!0;try{let i=yield this.getNodes(t);const r=(0,c.deepClone)(i),s=[];i=e(t,i);for(const t in i){const e=i[t];(0,c.equal)(e,r[t])?delete i[t]:(0,c.isDocument)(t)&&((0,c.equal)(e.local.body,e.local.previousBody)&&e.local.contentType===e.local.previousContentType||s.push({path:t,origin:"window",oldValue:e.local.previousBody,newValue:!1===e.local.body?void 0:e.local.body,oldContentType:e.local.previousContentType,newContentType:e.local.contentType}),void 0===e.local.body?i[t]=void 0:(delete e.local.previousBody,delete e.local.previousContentType))}yield this.setNodes(i),this._emitChangeEvents(s),n.resolve({statusCode:200})}catch(t){n.reject(t)}this._updateNodesRunning=!1;const i=this._updateNodesQueued.shift();i&&(yield this._doUpdateNodes(i.paths,i.cb,i.promise))})}_emitChangeEvents(t){for(let e=0,n=t.length;e{const n=[t],i=u(e[t]),r=Object.keys(i.itemsMap).map(e=>this._getAllDescendentPaths(t+e).then(t=>{for(let e=0,i=t.length;en)}):Promise.resolve([t])}_getInternals(){return{getLatest:u,makeNode:d,isOutdated:h}}}(0,c.applyMixins)(f,[o.default]),t.exports=f},28:function(t){t.exports={cache:!0,changeEvents:{local:!0,window:!1,remote:!0,conflict:!0},cordovaRedirectUri:void 0,logging:!1,modules:[],backgroundSyncInterval:6e4,disableFeatures:[],discoveryTimeout:5e3,isBackground:!1,requestTimeout:3e4,syncInterval:1e4}},373:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(199)),s=i(n(28)),o=i(n(334)),a=n(746);let l;const c="remotestorage:discover";let u={};const h=function(t){return new Promise((e,n)=>{if(t in u)return e(u[t]);const i=new r.default({tls_only:!1,uri_fallback:!0,request_timeout:s.default.discoveryTimeout});return setTimeout(()=>n(new Error("timed out")),s.default.discoveryTimeout),i.lookup(t,function(i,r){if(i)return n(i);if("object"!=typeof r.idx.links.remotestorage||"number"!=typeof r.idx.links.remotestorage.length||r.idx.links.remotestorage.length<=0)return(0,o.default)("[Discover] WebFinger record for "+t+" does not have remotestorage defined in the links section ",JSON.stringify(r.json)),n("WebFinger record for "+t+" does not have remotestorage defined in the links section.");const s=r.idx.links.remotestorage[0],a=s.properties["http://tools.ietf.org/html/rfc6749#section-4.2"]||s.properties["auth-endpoint"],h=s.properties["http://remotestorage.io/spec/version"]||s.type;return u[t]={href:s.href,storageApi:h,authURL:a,properties:s.properties},l&&localStorage.setItem(c,JSON.stringify({cache:u})),e(u[t])})})};(h.DiscoveryError=function(t){this.name="DiscoveryError",this.message=t,this.stack=(new Error).stack}).prototype=Object.create(Error.prototype),h.DiscoveryError.prototype.constructor=h.DiscoveryError,h._rs_init=function(){if(l=(0,a.localStorageAvailable)(),l){const t=JSON.parse(localStorage.getItem(c));t&&(u=t.cache)}},h._rs_supported=function(){return Object.prototype.hasOwnProperty.call(a.globalContext,"fetch")||Object.prototype.hasOwnProperty.call(a.globalContext,"XMLHttpRequest")},h._rs_cleanup=function(){l&&localStorage.removeItem(c)},t.exports=h},706:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(93)),o=r(n(424)),a=r(n(941)),l=r(n(982)),c=r(n(503)),u=n(746),h=n(368),d=n(684),p=r(n(275));let f;const g="remotestorage:dropbox",m="https://api.dropboxapi.com/2/files/list_folder",y="https://api.dropboxapi.com/2/files/list_folder/continue",_="/remotestorage";function v(t){return(_+"/"+t).replace(/\/+$/,"").replace(/\/+/g,"/")}const b=/[\u007f-\uffff]/g;function w(t){return JSON.stringify(t).replace(b,function(t){return"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4)})}function x(t,e){return new RegExp("^"+e.join("\\/")+"(\\/|$)").test(t.error_summary)}function S(t){return t instanceof ArrayBuffer||(0,h.isArrayBufferView)(t)}class C extends d.RemoteBase{constructor(t){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=t.apiKeys.dropbox.appKey,this.TOKEN_URL="https://api.dropboxapi.com/oauth2/token",this._revCache=new a.default("rev"),this._fetchDeltaCursor=null,this._fetchDeltaPromise=null,this._itemRefs={},f=(0,u.localStorageAvailable)(),f){const t=(0,u.getJSONFromLocalStorage)(g);t&&this.configure(t),this._itemRefs=(0,u.getJSONFromLocalStorage)(`${g}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return i(this,void 0,void 0,function*(){try{if(this.rs.setBackend("dropbox"),this.token)T(this.rs);else{const{codeVerifier:t,codeChallenge:e,state:n}=yield(0,u.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",t),sessionStorage.setItem("remotestorage:state",n),this.rs.authorize({authURL:"https://www.dropbox.com/oauth2/authorize",scope:"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write",clientId:this.clientId,response_type:"code",state:n,code_challenge:e,code_challenge_method:"S256",token_access_type:"offline"})}}catch(t){throw this.rs._emit("error",t),this.rs.setBackend(void 0),t}})}configure(t){return i(this,void 0,void 0,function*(){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token),void 0!==t.refreshToken&&(this.refreshToken=t.refreshToken),void 0!==t.tokenType&&(this.tokenType=t.tokenType);const e=()=>{f&&localStorage.setItem(g,JSON.stringify({userAddress:this.userAddress,token:this.token,refreshToken:this.refreshToken,tokenType:this.tokenType}))};if(this.refreshToken||this.token)if(this.connected=!0,this.userAddress)this._emit("connected"),e();else try{const t=yield this.info();this.userAddress=t.email,this._emit("connected"),e()}catch(t){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),e.apply(this)}else(()=>{this.connected=!1,f&&localStorage.removeItem(g),this.rs.setBackend(void 0)})()})}_getFolder(t){const e=this._revCache,n=n=>{let r;if(200!==n.status&&409!==n.status)return Promise.reject("Unexpected response status: "+n.status);try{r=JSON.parse(n.responseText)}catch(t){return Promise.reject(t)}if(409===n.status)return x(r,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+r.error_summary));const s=r.entries.reduce((n,i)=>{try{const r="folder"===i[".tag"],s=i.path_display.split("/").slice(-1)[0]+(r?"/":"");if(r)n[s]={ETag:e.get(t+s)};else{const e=new Date(i.server_modified);n[s]={ETag:i.rev,"Content-Length":i.size,"Last-Modified":e.toUTCString()},this._revCache.set(t+s,i.rev)}}catch(e){console.error(`[Dropbox] folder “${t}” has entry ${JSON.stringify(i)}:`,e)}return n},{});return r.has_more?i(r.cursor).then(function(t){return Object.assign(s,t)}):Promise.resolve(s)},i=t=>{const e={body:{cursor:t}};return this._request("POST",y,e).then(n)};return this._request("POST",m,{body:{path:v(t)}}).then(n).then(function(n){return Promise.resolve({statusCode:200,body:n,contentType:"application/json; charset=UTF-8",revision:e.get(t)})})}get(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n=this._revCache.get(t);if(null===n)return Promise.resolve({statusCode:404});if(e&&e.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then(()=>this.get(t,e));if(n&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===t.slice(-1))return this._getFolder(t);const i={headers:{"Dropbox-API-Arg":w({path:v(t)})},responseType:"arraybuffer"};return e&&e.ifNoneMatch&&(i.headers["If-None-Match"]=e.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",i).then(e=>{const n=e.status;let i,r,s,o;return 200!==n&&409!==n?Promise.resolve({statusCode:n}):(i=e.getResponseHeader("Dropbox-API-Result"),(0,u.getTextFromArrayBuffer)(e.response,"UTF-8").then(a=>{r=a,409===n&&(i=r);try{i=JSON.parse(i)}catch(t){return Promise.reject(t)}if(409===n)return x(i,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+t+'"): '+i.error_summary));if(s=e.getResponseHeader("Content-Type"),o=i.rev,this._revCache.set(t,o),this._shareIfNeeded(t),(0,u.shouldBeTreatedAsBinary)(a,s))r=e.response;else try{r=JSON.parse(r),s="application/json; charset=UTF-8"}catch(t){}return{statusCode:n,body:r,contentType:s,revision:o}}))})}put(t,e,n){return i(this,arguments,void 0,function*(t,e,n,i={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const r=this._revCache.get(t);if(i&&i.ifMatch&&r&&r!==i.ifMatch)return{statusCode:412,revision:r};if(i&&"*"===i.ifNoneMatch&&r&&"rev"!==r)return{statusCode:412,revision:r};if(!n.match(/charset=/)&&S(e)&&(n+="; charset=binary"),e.length>157286400)throw new Error("Cannot upload file larger than 150MB");const s={body:e,contentType:n,path:t};if(i&&(i.ifMatch||"*"===i.ifNoneMatch)){const e=yield this._getMetadata(t);if(i&&"*"===i.ifNoneMatch&&e)return{statusCode:412,revision:e.rev};if(i&&i.ifMatch&&e&&e.rev!==i.ifMatch)return{statusCode:412,revision:e.rev}}const o=yield this._uploadSimple(s);return this._shareIfNeeded(t),o})}delete(t){return i(this,arguments,void 0,function*(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const n=this._revCache.get(t);if((null==e?void 0:e.ifMatch)&&n&&e.ifMatch!==n)return{statusCode:412,revision:n};if(null==e?void 0:e.ifMatch){const n=yield this._getMetadata(t);if((null==e?void 0:e.ifMatch)&&n&&n.rev!==e.ifMatch)return{statusCode:412,revision:n.rev}}return this._deleteSimple(t)})}_shareIfNeeded(t){if(t.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[t])return this.share(t)}share(t){const e={body:{path:v(t)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",e).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?x(n,["shared_link_already_exists"])?this._getSharedLink(t):Promise.reject(new Error("API error: "+n.error_summary)):Promise.resolve(n.url)}).then(e=>(this._itemRefs[t]=e,f&&localStorage.setItem(g+":shares",JSON.stringify(this._itemRefs)),Promise.resolve(e)),e=>(e.message='Sharing Dropbox file or folder ("'+t+'") failed: '+e.message,Promise.reject(e)))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then(function(t){let e;try{const n=JSON.parse(t.responseText);e=null==n?void 0:n.email}catch(e){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+t.responseText))}return Promise.resolve({email:e})})}_request(t,e,n){return i(this,arguments,void 0,function*(t,e,n,i=1){if(this.isForbiddenRequestMethod(t,e))throw`Don't use ${t} on directories!`;if(!this.token)throw new c.default("No access token");n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,"object"!=typeof n.body||S(n.body)||(n.body=JSON.stringify(n.body),n.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:t,isFolder:(0,u.isFolder)(e)});try{const r=yield(0,h.requestWithTimeout)(t,e,n);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!0}),401===(null==r?void 0:r.status)&&this.refreshToken?i>=3?(console.error(`Abandoned after ${i} attempts: ${t} ${e}`),r):(this.rs._emit("wire-busy",{method:t,isFolder:(0,u.isFolder)(e)}),yield p.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!0}),this._request(t,e,n,i+1)):[503,429].includes(null==r?void 0:r.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),i>=3?(console.warn(`Abandoned after ${i} attempts: ${t} ${e}`),r):(yield new Promise(t=>setTimeout(t,(0,h.retryAfterMs)(r))),this._request(t,e,n,i+1))):r}catch(n){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!1}),n}})}fetchDelta(...t){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const e=t=>i(this,void 0,void 0,function*(){let n,i;"string"==typeof t?(n=y,i={cursor:t}):(n=m,i={path:_,recursive:!0,include_deleted:!0});try{const r=yield this._request("POST",n,{body:i});if(401===r.status)throw new c.default;if(200!==r.status&&409!==r.status)throw new Error("Invalid response status: "+r.status);let s;try{s=JSON.parse(r.responseText)}catch(t){throw new Error("Invalid response body: "+r.responseText)}if(409===r.status){if(!x(s,["path","not_found"]))throw new Error("API returned an error: "+s.error_summary);s={cursor:null,entries:[],has_more:!1}}if(t||this._revCache.deactivatePropagation(),s.entries.forEach(t=>{const e=t.path_display.slice(14);"deleted"===t[".tag"]?(this._revCache.delete(e),this._revCache.delete(e+"/")):"file"===t[".tag"]&&this._revCache.set(e,t.rev)}),this._fetchDeltaCursor=s.cursor,s.has_more)return e(s.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(t){if("timeout"===t)return;throw t}});return this._fetchDeltaPromise=e(this._fetchDeltaCursor).catch(t=>("object"==typeof t&&"message"in t?t.message="Dropbox: fetchDelta: "+t.message:t=`Dropbox: fetchDelta: ${t}`,this.rs._emit("error",t),this._fetchDeltaPromise=null,Promise.reject(t))).then(()=>(this._fetchDeltaPromise=null,Promise.resolve(t))),this._fetchDeltaPromise}_getMetadata(t){const e={path:v(t)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?x(e,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+e.error_summary)):Promise.resolve(e)}).then(void 0,e=>(e.message='Could not load metadata for file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_uploadSimple(t){const e={path:v(t.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return t.ifMatch&&(e.mode={".tag":"update",update:t.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:t.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":w(e)}}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid API result: "+e.responseText))}return 409===e.status?x(n,["path","conflict"])?this._getMetadata(t.path).then(function(t){return Promise.resolve({statusCode:412,revision:t.rev})}):(this.rs._emit("error",new Error(n.error_summary)),Promise.resolve({statusCode:e.status})):(this._revCache.set(t.path,n.rev),Promise.resolve({statusCode:e.status,revision:n.rev}))})}_deleteSimple(t){const e={path:v(t)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}if(409===t.status){if(x(e,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(e.error_summary))}return Promise.resolve({statusCode:t.status})}).then(e=>(200!==e.statusCode&&404!==e.statusCode||(this._revCache.delete(t),delete this._itemRefs[t]),Promise.resolve(e)),e=>(e.message='Could not delete Dropbox file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_getSharedLink(t){return i(this,void 0,void 0,function*(){const e={body:{path:v(t),direct_only:!0}};return this._request("POST","https://api.dropbox.com/2/sharing/list_shared_links",e).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status: "+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?Promise.reject(new Error("API error: "+(null==e?void 0:e.error_summary)||0)):e.links.length?Promise.resolve(e.links[0].url):Promise.reject(new Error("No links returned"))},e=>(e.message='Could not get link to a shared file or folder ("'+t+'"): '+e.message,Promise.reject(e)))})}static _rs_init(t){f=(0,u.localStorageAvailable)(),t.apiKeys.dropbox&&(t.dropbox=new C(t)),"dropbox"===t.backend&&T(t)}static _rs_supported(){return!0}static _rs_cleanup(t){!function(t){(function(t){t._origRemote&&(t.remote=t._origRemote,delete t._origRemote)})(t),function(t){t._dropboxOrigSync&&(t.sync.sync=t._dropboxOrigSync,delete t._dropboxOrigSync)}(t),function(t){t._origBaseClientGetItemURL&&(o.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}(t),E(t)}(t),f&&localStorage.removeItem(g),t.setBackend(void 0)}}function k(t,...e){t._dropboxOrigSync||(t._dropboxOrigSync=t.sync.sync.bind(t.sync),t.sync.sync=function(){return this.dropbox.fetchDelta(t,...e).then(t._dropboxOrigSync,function(e){t._emit("error",new l.default(e)),t._emit("sync-done")})}.bind(t))}function E(t){t._dropboxOrigSyncCycle&&(t.syncCycle=t._dropboxOrigSyncCycle,delete t._dropboxOrigSyncCycle)}function T(t){!function(t){t._origRemote||(t._origRemote=t.remote,t.remote=t.dropbox)}(t),t.sync?k(t):function(t,...e){t._dropboxOrigSyncCycle||(t._dropboxOrigSyncCycle=t.syncCycle,t.syncCycle=()=>{if(!t.sync)throw new Error("expected sync to be initialized by now");k(t),t._dropboxOrigSyncCycle(t,...e),E(t)})}(t),function(t){t._origBaseClientGetItemURL||(t._origBaseClientGetItemURL=o.default.prototype.getItemURL,o.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Dropbox yet")})}(t)}(0,u.applyMixins)(C,[s.default]),t.exports=C},451:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(93)),s=n(746),o=i(n(334));class a{constructor(){this.addEvents(["background","foreground"]),this.mode="undefined"!=typeof window?"browser":"node","browser"===this.mode&&(this.setBrowserPrefixedNames(),document.addEventListener(this.visibilityChangeEvent,this.setVisibility.bind(this),!1),this.setVisibility())}setBrowserPrefixedNames(){"browser"===this.mode&&(void 0!==document.hidden?(this.hiddenProperty="hidden",this.visibilityChangeEvent="visibilitychange"):void 0!==document.mozHidden?(this.hiddenProperty="mozHidden",this.visibilityChangeEvent="mozvisibilitychange"):void 0!==document.msHidden?(this.hiddenProperty="msHidden",this.visibilityChangeEvent="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hiddenProperty="webkitHidden",this.visibilityChangeEvent="webkitvisibilitychange"))}setVisibility(){document[this.hiddenProperty]?((0,o.default)("[Env] Going into background mode"),this.goBackground()):((0,o.default)("[Env] Going into foreground mode"),this.goForeground())}isBrowser(){return"browser"===this.mode}isNode(){return"node"===this.mode}goBackground(){this._emit("background")}goForeground(){this._emit("foreground")}static _rs_init(){}static _rs_cleanup(){}}(0,s.applyMixins)(a,[r.default]),t.exports=a},93:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EventHandling=void 0;const r=i(n(334));class s{addEvents(t){t.forEach(t=>this._addEvent(t))}addEventListener(t,e){if("string"!=typeof t)throw new Error("Argument eventName should be a string");if("function"!=typeof e)throw new Error("Argument handler should be a function");(0,r.default)("[EventHandling] Adding event listener",t),this._validateEvent(t),this._handlers[t].push(e)}on(t,e){return this.addEventListener(t,e)}removeEventListener(t,e){this._validateEvent(t);const n=this._handlers[t].length;for(let i=0;i{t(...e)})}_validateEvent(t){if(!(t in this._handlers))throw new Error("Unknown event: "+t)}_delegateEvent(t,e){e.on(t,e=>{this._emit(t,e)})}_addEvent(t){void 0===this._handlers&&(this._handlers={}),this._handlers[t]=[]}}e.EventHandling=s,e.default=s},545:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(28)),s=i(n(451)),o=i(n(334)),a=n(746),l=i(n(370)),c=i(n(548)),u=i(n(275)),h=i(n(373)),d=i(n(424)),p=i(n(801)),f=i(n(706)),g=i(n(600)),m=i(n(313)),y=i(n(285)),_=i(n(567)),v=i(n(794)),b=i(n(365)),w={features:[],featuresDone:0,readyFired:!1,loadFeatures(){this.features=[],this.featuresDone=0,this.readyFired=!1,this.featureModules={WireClient:g.default,Dropbox:f.default,GoogleDrive:p.default,Access:c.default,Discover:h.default,Authorize:u.default,BaseClient:d.default,Env:s.default},r.default.cache&&(0,a.extend)(this.featureModules,{Caching:y.default,IndexedDB:_.default,LocalStorage:v.default,InMemoryStorage:b.default,Sync:m.default}),r.default.disableFeatures.forEach(t=>{this.featureModules[t]&&delete this.featureModules[t]}),this._allLoaded=!1;for(const t in this.featureModules)this.loadFeature(t)},hasFeature(t){for(let e=this.features.length-1;e>=0;e--)if(this.features[e].name===t)return this.features[e].supported;return!1},loadFeature(t){const e=this.featureModules[t],n=!e._rs_supported||e._rs_supported();(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initializing ...`),"object"==typeof n?n.then(()=>{this.featureSupported(t,!0),this.initFeature(t)},()=>{this.featureSupported(t,!1)}):"boolean"==typeof n?(this.featureSupported(t,n),n&&this.initFeature(t)):this.featureSupported(t,!1)},initFeature(t){const e=this.featureModules[t];let n;try{n=e._rs_init(this)}catch(e){return void this.featureFailed(t,e)}"object"==typeof n&&"function"==typeof n.then?n.then(()=>{this.featureInitialized(t)},e=>{this.featureFailed(t,e)}):this.featureInitialized(t)},featureFailed(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialization failed (${e})`),this.featureDone()},featureSupported(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}]${e?"":"not "} supported`),e||this.featureDone()},featureInitialized(t){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialized`),this.features.push({name:t,init:this.featureModules[t]._rs_init,supported:!0,cleanup:this.featureModules[t]._rs_cleanup}),this.featureDone()},featureDone(){this.featuresDone++,this.featuresDone===Object.keys(this.featureModules).length&&setTimeout(this.featuresLoaded.bind(this),0)},_setCachingModule(){["IndexedDB","LocalStorage","InMemoryStorage"].some(t=>{if(this.features.some(e=>e.name===t))return this.features.local=this.featureModules[t],!0})},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(t){console.error("'ready' failed: ",t,t.stack),this._emit("error",t)}},featuresLoaded(){(0,o.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=r.default.cache&&this.features.local&&new this.features.local,this.local&&this.remote?(this._setGPD(l.default,this),this._bindChange(this.local)):this.remote&&this._setGPD(this.remote,this.remote),this.remote&&(this.remote.on("connected",()=>{this._fireReady(),this._emit("connected")}),this.remote.on("not-connected",()=>{this._fireReady(),this._emit("not-connected")}),this.remote.connected&&(this._fireReady(),this._emit("connected")),this.hasFeature("Authorize")||this.remote.stopWaitingForToken()),this._collectCleanupFunctions();try{this._allLoaded=!0,this._emit("features-loaded")}catch(t){(0,a.logError)(t),this._emit("error",t)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let t=0;t=n-this.maxAge?e.v:void 0}set(t,e){this._items[t]={v:e,t:(new Date).getTime()}}}class _ extends l.RemoteBase{constructor(t,e){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=e,this._fileIdCache=new y(300),d=(0,o.localStorageAvailable)(),d){const t=(0,o.getJSONFromLocalStorage)(u);t&&this.configure(t)}}configure(t){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token);const e=function(){d&&localStorage.setItem(u,JSON.stringify({userAddress:this.userAddress,token:this.token}))},n=function(){this.connected=!1,delete this.token,d&&localStorage.removeItem(u)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),e.apply(this)):this.info().then(t=>{this.userAddress=t.user.emailAddress,this._emit("connected"),e.apply(this)}).catch(()=>{n.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))})):n.apply(this)}connect(){this.rs.setBackend("googledrive"),this.rs.authorize({authURL:"https://accounts.google.com/o/oauth2/auth",scope:"https://www.googleapis.com/auth/drive",clientId:this.clientId})}get(t,e={}){return(0,o.isFolder)(t)?this._getFolder(m(t)):this._getFile(m(t),e)}put(t,e,n,i={}){const r=m(t);function s(t){if(t.status>=200&&t.status<300){const e=JSON.parse(t.responseText),n=this.stripQuotes(e.etag);return Promise.resolve({statusCode:200,contentType:e.mimeType,revision:n})}return 412===t.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+t.status+" ("+t.responseText+")")}return this._getFileId(r).then(t=>t?i&&"*"===i.ifNoneMatch?s({status:412}):this._updateFile(t,r,e,n,i).then(s):this._createFile(r,e,n).then(s))}delete(t,e={}){const n=m(t);return this._getFileId(n).then(t=>t?this._getMeta(t).then(n=>{let i;return"object"==typeof n&&"string"==typeof n.etag&&(i=this.stripQuotes(n.etag)),e&&e.ifMatch&&e.ifMatch!==i?{statusCode:412,revision:i}:this._request("DELETE",c+"/drive/v2/files/"+t,{}).then(t=>200===t.status||204===t.status?{statusCode:200}:Promise.reject("Delete failed: "+t.status+" ("+t.responseText+")"))}):Promise.resolve({statusCode:200}))}info(){const t=c+"/drive/v2/about?fields=user";return this._request("GET",t,{}).then(function(t){try{const e=JSON.parse(t.responseText);return Promise.resolve(e)}catch(t){return Promise.reject(t)}})}_updateFile(t,e,n,i,r){const s={mimeType:i},o={"Content-Type":"application/json; charset=UTF-8"};return r&&r.ifMatch&&(o["If-Match"]=this.addQuotes(r.ifMatch)),this._request("PUT",c+"/upload/drive/v2/files/"+t+"?uploadType=resumable",{body:JSON.stringify(s),headers:o}).then(t=>412===t.status?t:this._request("PUT",t.getResponseHeader("Location"),{body:i.match(/^application\/json/)?JSON.stringify(n):n}))}_createFile(t,e,n){return this._getParentId(t).then(i=>{const r={title:p(g(t)),mimeType:n,parents:[{kind:"drive#fileLink",id:i}]};return this._request("POST",c+"/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(r),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(t=>this._request("POST",t.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(e):e}))})}_getFile(t,e){return this._getFileId(t).then(t=>this._getMeta(t).then(t=>{let n;if("object"==typeof t&&"string"==typeof t.etag&&(n=this.stripQuotes(t.etag)),e&&e.ifNoneMatch&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304});if(!t.downloadUrl){if(!t.exportLinks||!t.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:t.mimeType,revision:n});t.mimeType+=";export=text/html",t.downloadUrl=t.exportLinks["text/html"]}return this._request("GET",t.downloadUrl,{responseType:"arraybuffer"}).then(e=>(0,o.getTextFromArrayBuffer)(e.response,"UTF-8").then(function(i){let r=i;if(t.mimeType.match(/^application\/json/))try{r=JSON.parse(r)}catch(t){}else(0,o.shouldBeTreatedAsBinary)(i,t.mimeType)&&(r=e.response);return{statusCode:200,body:r,contentType:t.mimeType,revision:n}}))}))}_getFolder(t){return this._getFileId(t).then(e=>{let n,i,r;if(!e)return Promise.resolve({statusCode:404});const s="'"+e+"' in parents";return this._request("GET",c+"/drive/v2/files?q="+encodeURIComponent(s)+"&fields="+encodeURIComponent("items(downloadUrl,etag,fileSize,id,mimeType,title,labels)")+"&maxResults=1000&trashed=false",{}).then(e=>{var s;if(200!==e.status)return Promise.reject("request failed or something: "+e.status);try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject("non-JSON response from GoogleDrive")}r={};for(const a of n.items)(null===(s=a.labels)||void 0===s?void 0:s.trashed)||(i=this.stripQuotes(a.etag),a.mimeType===h?(this._fileIdCache.set(t+(0,o.cleanPath)(a.title)+"/",a.id),r[a.title+"/"]={ETag:i}):(this._fileIdCache.set(t+(0,o.cleanPath)(a.title),a.id),r[a.title]={ETag:i,"Content-Type":a.mimeType,"Content-Length":a.fileSize}));return Promise.resolve({statusCode:200,body:r,contentType:"application/json; charset=UTF-8",revision:void 0})})})}_getParentId(t){const e=f(t);return this._getFileId(e).then(t=>t?Promise.resolve(t):this._createFolder(e))}_createFolder(t){return this._getParentId(t).then(e=>this._request("POST",c+"/drive/v2/files",{body:JSON.stringify({title:p(g(t)),mimeType:h,parents:[{id:e}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(t=>{const e=JSON.parse(t.responseText);return Promise.resolve(e.id)}))}_getFileId(t){let e;return"/"===t?Promise.resolve("root"):(e=this._fileIdCache.get(t))?Promise.resolve(e):this._getFolder(f(t)).then(()=>(e=this._fileIdCache.get(t),e?Promise.resolve(e):"/"===t.substr(-1)?this._createFolder(t).then(()=>this._getFileId(t)):Promise.resolve()))}_getMeta(t){return this._request("GET",c+"/drive/v2/files/"+t,{}).then(function(e){return 200===e.status?Promise.resolve(JSON.parse(e.responseText)):Promise.reject("request (getting metadata for "+t+") failed with status: "+e.status)})}_request(t,e,n){return this.isForbiddenRequestMethod(t,e)?Promise.reject(`Don't use ${t} on directories!`):(n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:t,isFolder:(0,o.isFolder)(e)}),(0,a.requestWithTimeout)(t,e,n).then(n=>n&&401===n.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,o.isFolder)(e),success:!0}),Promise.resolve(n)),n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,o.isFolder)(e),success:!1}),Promise.reject(n))))}static _rs_init(t){const e=t.apiKeys.googledrive;var n;e&&(t.googledrive=new _(t,e.clientId),"googledrive"===t.backend&&(t._origRemote=t.remote,t.remote=t.googledrive,(n=t)._origBaseClientGetItemURL||(n._origBaseClientGetItemURL=r.default.prototype.getItemURL,r.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Google Drive yet")})))}static _rs_supported(){return!0}static _rs_cleanup(t){var e;t.setBackend(void 0),t._origRemote&&(t.remote=t._origRemote,delete t._origRemote),(e=t)._origBaseClientGetItemURL&&(r.default.prototype.getItemURL=e._origBaseClientGetItemURL,delete e._origBaseClientGetItemURL)}}(0,o.applyMixins)(_,[s.default]),t.exports=_},567:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(93)),o=r(n(496)),a=r(n(334)),l=n(746),c="remotestorage";let u;class h extends o.default{constructor(t){super(),this.addEvents(["change","local-events-done"]),this.db=t||u,this.db?(this.getsRunning=0,this.putsRunning=0,this.changesQueued={},this.changesRunning={},this.commitSlownessWarning=null):(0,a.default)("[IndexedDB] Failed to open DB")}getNodes(t){return i(this,void 0,void 0,function*(){const e=[],n={};for(let i=0,r=t.length;i0?this.getNodesFromDb(e).then(function(t){for(const e in n)t[e]=n[e];return t}):n})}setNodes(t){return i(this,void 0,void 0,function*(){for(const e in t)this.changesQueued[e]=t[e]||!1;this.maybeFlush()})}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=n.g.setInterval(function(){console.warn("WARNING: waited more than 10 seconds for previous commit to finish")},1e4))}flushChangesQueued(){this.commitSlownessWarning&&(clearInterval(this.commitSlownessWarning),this.commitSlownessWarning=null),Object.keys(this.changesQueued).length>0&&(this.changesRunning=this.changesQueued,this.changesQueued={},this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)))}getNodesFromDb(t){return new Promise((e,n)=>{const i=this.db.transaction(["nodes"],"readonly"),r=i.objectStore("nodes"),s={};this.getsRunning++,t.map(t=>{r.get(t).onsuccess=e=>{s[t]=e.target.result}}),i.oncomplete=()=>{e(s),this.getsRunning--},i.onerror=i.onabort=()=>{n("get transaction error/abort"),this.getsRunning--}})}setNodesInDb(t){return i(this,void 0,void 0,function*(){return new Promise((e,n)=>{const i=this.db.transaction(["nodes"],"readwrite"),r=i.objectStore("nodes"),s=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting puts",t,this.putsRunning);for(const o in t){const e=t[o];if("object"==typeof e)try{r.put(e)}catch(t){throw(0,a.default)("[IndexedDB] Error while putting",e,t),t}else try{r.delete(o)}catch(t){throw(0,a.default)("[IndexedDB] Error while removing",r,e,t),t}}i.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished puts",t,this.putsRunning,(new Date).getTime()-s+"ms"),e()},i.onerror=()=>{this.putsRunning--,n("transaction error")},i.onabort=()=>{n("transaction abort"),this.putsRunning--}})})}reset(t){const e=this.db.name;this.db.close(),h.clean(e,()=>{h.open(e,(n,i)=>{n?(0,a.default)(`[IndexedDB] Error while resetting database ${e}:`,n):this.db=i,"function"==typeof t&&t(self)})})}forAllNodes(t){return i(this,void 0,void 0,function*(){return new Promise(e=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=n=>{const i=n.target.result;i?(t(i.value),i.continue()):e()}})})}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(t,e){const n=setTimeout(function(){e("timeout trying to open db")},1e4);try{const i=indexedDB.open(t,2);i.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",i),clearTimeout(n),e(i.error)},i.onupgradeneeded=function(t){const e=i.result;(0,a.default)("[IndexedDB] Upgrade: from ",t.oldVersion," to ",t.newVersion),1!==t.oldVersion&&((0,a.default)("[IndexedDB] Creating object store: nodes"),e.createObjectStore("nodes",{keyPath:"path"})),(0,a.default)("[IndexedDB] Creating object store: changes"),e.createObjectStore("changes",{keyPath:"path"})},i.onsuccess=function(){clearTimeout(n);const r=i.result;if(!r.objectStoreNames.contains("nodes")||!r.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),void h.clean(t,function(){h.open(t,e)});e(null,i.result)}}catch(i){(0,a.default)("[IndexedDB] Failed to open database: "+i),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(n),h.clean(t,function(){h.open(t,e)})}}static clean(t,e){const n=indexedDB.deleteDatabase(t);n.onsuccess=function(){(0,a.default)(`[IndexedDB] Deleted database "${t}"`),e()},n.onerror=n.onabort=function(e){console.error('Failed to remove database "'+t+'"',e)}}static _rs_init(t){return new Promise((e,n)=>{h.open(c,function(i,r){i?n(i):(u=r,r.onerror=()=>{t._emit("error",i)},e())})})}static _rs_supported(){return new Promise((t,e)=>{const n=(0,l.getGlobalContext)();let i=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(i=!0)),"indexedDB"in n&&!i)try{const n=indexedDB.open("rs-check");n.onerror=function(){e()},n.onsuccess=function(){n.result.close(),indexedDB.deleteDatabase("rs-check"),t()}}catch(t){e()}else e()})}static _rs_cleanup(t){return new Promise(e=>{t.local instanceof h&&t.local.closeDB(),h.clean(c,e)})}diffHandler(){}}(0,l.applyMixins)(h,[s.default]),t.exports=h},365:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(93)),s=i(n(496)),o=n(746);class a extends s.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(t){const e={};for(let n=0,i=t.length;n=2e3&&t<=36e5}var E;!function(t){t.GOOGLE="googledrive",t.DROPBOX="dropbox"}(E||(E={}));class T{constructor(t){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=b.default.loadFeatures,this.features=b.default.features,this.loadFeature=b.default.loadFeature,this.featureSupported=b.default.featureSupported,this.featureDone=b.default.featureDone,this.featuresDone=b.default.featuresDone,this.featuresLoaded=b.default.featuresLoaded,this.featureInitialized=b.default.featureInitialized,this.featureFailed=b.default.featureFailed,this.hasFeature=b.default.hasFeature,this._setCachingModule=b.default._setCachingModule,this._collectCleanupFunctions=b.default._collectCleanupFunctions,this._fireReady=b.default._fireReady,this.initFeature=b.default.initFeature,"object"==typeof t&&(0,c.extend)(a.default,t),this.addEvents(["ready","authing","connecting","connected","disconnected","not-connected","conflict","error","features-loaded","sync-interval-change","sync-started","sync-req-done","sync-done","wire-busy","wire-done","network-offline","network-online"]),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")}),S=(0,c.localStorageAvailable)(),S){this.apiKeys=(0,c.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const t=localStorage.getItem("remotestorage:backend");"dropbox"===t||"googledrive"===t?this.setBackend(t):this.setBackend("remotestorage")}const e=this.on;this.on=function(t,n){if(this._allLoaded)switch(t){case"features-loaded":setTimeout(n,0);break;case"ready":this.remote&&setTimeout(n,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(n,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(n,0)}return e.call(this,t,n)},this._init(),this.fireInitial=function(){this.local&&setTimeout(this.local.fireInitial.bind(this.local),0)}.bind(this),this.on("ready",this.fireInitial.bind(this)),this.loadModules()}get connected(){return this.remote.connected}loadModules(){a.default.modules.forEach(this.addModule.bind(this))}authorize(t){if(this.access.setStorageType(this.remote.storageApi),void 0===t.scope&&(t.scope=this.access.scopeParameter),x.cordova)t.redirectUri=a.default.cordovaRedirectUri;else{const e=h.default.getLocation();let n=e.origin;"/"!==e.pathname&&(n+=e.pathname),t.redirectUri=n}void 0===t.clientId&&(t.clientId=t.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),h.default.authorize(this,t)}impliedauth(t,e){t=t||this.remote.storageApi,e=e||String(document.location),(0,l.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+t+" redirectUri = "+e),this.remote.configure({token:h.default.IMPLIED_FAKE_TOKEN}),document.location.href=e}connect(t,e){if(this.setBackend("remotestorage"),t.indexOf("@")<0&&!t.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new T.DiscoveryError("Not a valid user address or URL."));else{if(t.indexOf("@")<0&&!t.match(/^https?:\/\//)&&(t=`https://${t}`),x.cordova){if("string"!=typeof a.default.cordovaRedirectUri)return void this._emit("error",new T.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!x.cordova.InAppBrowser)return void this._emit("error",new T.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:t}),this._emit("connecting"),(0,y.default)(t).then(n=>{if(this._emit("authing"),n.userAddress=t,this.remote.configure(n),!this.remote.connected)if(n.authURL)if(void 0===e)this.authorize({authURL:n.authURL});else{if("string"!=typeof e)throw new Error("Supplied bearer token must be a string");(0,l.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:e})}else this.impliedauth()},()=>{this._emit("error",new T.DiscoveryError("No storage information found for this user address."))})}}reconnect(){this.remote.configure({token:null}),"remotestorage"===this.backend?this.connect(this.remote.userAddress):this.remote.connect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,properties:null}),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const t=this._cleanups.length;let e=0;const n=()=>{e++,e>=t&&(this._init(),(0,l.default)('Cleanups done, emitting "disconnected" event'),this._emit("disconnected"))};t>0?this._cleanups.forEach(t=>{const e=t(this);"object"==typeof e&&"function"==typeof e.then?e.then(n):n()}):n()}setBackend(t){this.backend=t,S&&(void 0!==t?localStorage.setItem("remotestorage:backend",t):localStorage.removeItem("remotestorage:backend"))}onChange(t,e){this._pathHandlers.change[t]||(this._pathHandlers.change[t]=[]),this._pathHandlers.change[t].push(e)}enableLog(){a.default.logging=!0}disableLog(){a.default.logging=!1}log(...t){l.default.apply(T,t)}setApiKeys(t){const e=[E.GOOGLE,E.DROPBOX];if("object"!=typeof t||!Object.keys(t).every(t=>e.includes(t)))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(t).forEach(e=>{const n=t[e];if(n){switch(e){case E.DROPBOX:this.apiKeys[E.DROPBOX]={appKey:n},void 0!==this.dropbox&&this.dropbox.clientId===n||m.default._rs_init(this);break;case E.GOOGLE:this.apiKeys[E.GOOGLE]={clientId:n},void 0!==this.googledrive&&this.googledrive.clientId===n||g.default._rs_init(this)}return!0}delete this.apiKeys[e]}),S&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(t){if("string"!=typeof t||!t.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");a.default.cordovaRedirectUri=t}_setGPD(t,e){function n(t){return function(...n){return t.apply(e,n).then(C.bind(this))}}this.get=n(t.get),this.put=n(t.put),this.delete=n(t.delete)}_pendingGPD(t){return(...e)=>{const n=Array.prototype.slice.call(e);return new Promise((e,i)=>{this._pending.push({method:t,args:n,promise:{resolve:e,reject:i}})})}}_processPending(){this._pending.forEach(t=>{try{this[t.method](...t.args).then(t.promise.resolve,t.promise.reject)}catch(e){t.promise.reject(e)}}),this._pending=[]}_bindChange(t){t.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(t,e){Object.keys(this._pathHandlers[t]).forEach(n=>{const i=n.length;e.path.substr(0,i)===n&&this._pathHandlers[t][n].forEach(t=>{const i={};for(const n in e)i[n]=e[n];i.relativePath=e.path.replace(new RegExp("^"+n),"");try{t(i)}catch(t){console.error("'change' handler failed: ",t,t.stack),this._emit("error",t)}})})}scope(t){if("string"!=typeof t)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(t,"r")||console.warn("WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestorage.io/rs.js/docs/api/access/classes/Access.html#claim"),new d.default(this,t)}getSyncInterval(){return a.default.syncInterval}setSyncInterval(t){if(!k(t))throw t+" is not a valid sync interval";const e=a.default.syncInterval;a.default.syncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getBackgroundSyncInterval(){return a.default.backgroundSyncInterval}setBackgroundSyncInterval(t){if(!k(t))throw t+" is not a valid sync interval";const e=a.default.backgroundSyncInterval;a.default.backgroundSyncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getCurrentSyncInterval(){return a.default.isBackground?a.default.backgroundSyncInterval:a.default.syncInterval}getRequestTimeout(){return a.default.requestTimeout}setRequestTimeout(t){if("number"!=typeof t)throw t+" is not a valid request timeout";a.default.requestTimeout=t}setupSyncCycle(){this.sync&&!this.sync.stopped&&((0,l.default)("[Sync] Setting up sync cycle"),this.on("sync-done",()=>{(0,l.default)("[Sync] Sync done. Setting timer to",this.getCurrentSyncInterval()),this.sync&&!this.sync.stopped&&(this._syncTimer&&clearTimeout(this._syncTimer),this._syncTimer=setTimeout(this.sync.sync.bind(this.sync),this.getCurrentSyncInterval()))}),this.sync.sync())}startSync(){return a.default.cache?(this.sync.stopped=!1,this.syncStopped=!1,this.sync.sync()):(console.warn("Nothing to sync, because caching is disabled."),Promise.resolve())}stopSync(){clearTimeout(this._syncTimer),this._syncTimer=void 0,this.sync?((0,l.default)("[Sync] Stopping sync"),this.sync.stopped=!0):((0,l.default)("[Sync] Will instantiate sync stopped"),this.syncStopped=!0)}addModule(t){const e=t.name,n=t.builder;if(Object.defineProperty(this,e,{configurable:!0,get:function(){const t=this._loadModule(e,n);return Object.defineProperty(this,e,{value:t}),t}}),-1!==e.indexOf("-")){const t=e.replace(/\-[a-z]/g,function(t){return t[1].toUpperCase()});Object.defineProperty(this,t,{get:function(){return this[e]}})}}_loadModule(t,e){if(e)return e(new d.default(this,"/"+t+"/"),new d.default(this,"/public/"+t+"/")).exports;throw"Unknown module: "+t}}e.RemoteStorage=T,T.SyncError=_.default,T.Unauthorized=v.default,T.DiscoveryError=y.default.DiscoveryError,T.util=w,Object.defineProperty(T.prototype,"access",{configurable:!0,get:function(){const t=new u.default;return Object.defineProperty(this,"access",{value:t}),t}}),Object.defineProperty(T.prototype,"caching",{configurable:!0,get:function(){const t=new p.default(this);return Object.defineProperty(this,"caching",{value:t}),t}}),(0,c.applyMixins)(T,[f.EventHandling]),e.default=T},368:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.isArrayBufferView=void 0,e.retryAfterMs=function(t){const e=1e3*parseInt(t.getResponseHeader("Retry-After"));return e>=1e3?e:Math.max(1500,Math.min(6e4,Math.round(o.default.syncInterval/(2.9+.2*Math.random()))))},e.requestWithTimeout=function(t,n,r){return i(this,void 0,void 0,function*(){return"function"==typeof fetch?function(t,e,n){return i(this,void 0,void 0,function*(){const i="function"==typeof AbortController?new AbortController:null;let r;const a=new Promise((t,e)=>{r=setTimeout(()=>{i&&i.abort(),e("timeout")},o.default.requestTimeout)});let l;const c={},u=fetch(e,{method:t,headers:n.headers,body:n.body,signal:i?i.signal:void 0}).then(t=>{switch((0,s.default)("[requests fetch]",t),t.headers.forEach((t,e)=>{c[e.toUpperCase()]=t}),l={readyState:4,status:t.status,statusText:t.statusText,response:void 0,getResponseHeader:t=>c[t.toUpperCase()]||null,responseType:n.responseType,responseURL:e},n.responseType){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json();case void 0:case"":case"text":return t.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}}).then(t=>(l.response=t,n.responseType&&"text"!==n.responseType||(l.responseText=t),l)).finally(()=>{clearTimeout(r)});return Promise.race([u,a])})}(t,n,r):"function"==typeof XMLHttpRequest?function(t,n,r){return i(this,void 0,void 0,function*(){return new Promise((i,a)=>{(0,s.default)("[requests XHR]",t,n);let l=!1;const c=setTimeout(()=>{l=!0,a("timeout")},o.default.requestTimeout),u=new XMLHttpRequest;if(u.open(t,n,!0),r.responseType&&(u.responseType=r.responseType),r.headers)for(const t in r.headers)u.setRequestHeader(t,r.headers[t]);u.onload=()=>{l||(clearTimeout(c),i(u))},u.onerror=t=>{l||(clearTimeout(c),a(t))};let h=r.body;"object"==typeof h&&!(0,e.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)})})}(t,n,r):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")})};const s=r(n(334)),o=r(n(28));if("function"==typeof(n.g||window).ArrayBufferView)e.isArrayBufferView=function(t){return t&&t instanceof(n.g||window).ArrayBufferView};else{const t=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];e.isArrayBufferView=function(e){for(let n=0;n<8;n++)if(e instanceof t[n])return!0;return!1}}},941:function(t){t.exports=class{constructor(t){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=t,this.activatePropagation()}get(t){t=t.toLowerCase();let e=this._storage[t];return void 0===e&&(e=this.defaultValue,this._storage[t]=e),e}set(t,e){return t=t.toLowerCase(),this._storage[t]===e||(this._storage[t]=e,e||delete this._itemsRev[t],this._updateParentFolderItemRev(t,e),this._canPropagate&&this._propagate(t)),e}delete(t){return this.set(t,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n0&&(n=this._generateHash(t))}return this.set(t,n),n}}},491:function(t){class e extends Error{constructor(t){super();const e=new Error("Schema not found: "+t);return e.name="SchemaNotFound",e}}t.exports=e},982:function(t){class e extends Error{constructor(t){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof t?this.message+=t:(this.message+=t.message,this.stack=t.stack,this.originalError=t)}}t.exports=e},313:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Sync=void 0;const s=r(n(28)),o=r(n(451)),a=r(n(93)),l=r(n(334)),c=r(n(275)),u=r(n(982)),h=r(n(503)),d=n(746);let p,f;function g(t,e,n){return{action:t,path:e,promise:n}}function m(t,e){return t.common.revision!==e&&(!t.remote||t.remote.revision!==e)}function y(t){return!!t.common&&!!t.common.revision}class _{constructor(t){this.numThreads=10,this._tasks={},this._running={},this._timeStarted={},this._finishedTasks=[],this.rs=t,this.rs.local.onDiff(t=>{this.addTask(t),this.doTasks()}),this.rs.caching.onActivate(t=>{this.addTask(t),this.doTasks()}),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(t){return i(this,void 0,void 0,function*(){return new Promise((e,n)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(t,function(){this.rs.local.get(t).then(t=>e(t))}.bind(this)),this.doTasks()):n("cannot fulfill maxAge requirement - remote is not online"):n("cannot fulfill maxAge requirement - remote is not connected")})})}corruptServerItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t){const n=t[e];if("object"!=typeof n)return!0;if("string"!=typeof n.ETag)return!0;if((0,d.isFolder)(e)){if(-1!==e.substring(0,e.length-1).indexOf("/"))return!0}else if(-1!==e.indexOf("/"))return!0}return!1}corruptItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t)if("boolean"!=typeof t[e])return!0;return!1}corruptRevision(t){return"object"!=typeof t||Array.isArray(t)||t.revision&&"string"!=typeof t.revision||t.body&&"string"!=typeof t.body&&"object"!=typeof t.body||t.contentType&&"string"!=typeof t.contentType||t.contentLength&&"number"!=typeof t.contentLength||t.timestamp&&"number"!=typeof t.timestamp||t.itemsMap&&this.corruptItemsMap(t.itemsMap)}isCorrupt(t){return"object"!=typeof t||Array.isArray(t)||"string"!=typeof t.path||this.corruptRevision(t.common)||t.local&&this.corruptRevision(t.local)||t.remote&&this.corruptRevision(t.remote)||t.push&&this.corruptRevision(t.push)}hasTasks(){return Object.keys(this._tasks).length>0}collectDiffTasks(){return i(this,void 0,void 0,function*(){let t=0;return this.rs.local.forAllNodes(e=>{t>100||(this.isCorrupt(e)?((0,l.default)("[Sync] WARNING: corrupt node in local cache",e),"object"==typeof e&&e.path&&(this.addTask(e.path),t++)):(this.needsFetch(e)&&this.rs.access.checkPathPermission(e.path,"r")||(0,d.isDocument)(e.path)&&this.needsPush(e)&&this.rs.access.checkPathPermission(e.path,"rw"))&&(this.addTask(e.path),t++))}).then(()=>t)})}inConflict(t){return!(!t.local||!t.remote||void 0===t.remote.body&&!t.remote.itemsMap)}needsRefresh(t){return!!t.common&&(!t.common.timestamp||this.now()-t.common.timestamp>s.default.syncInterval)}needsFetch(t){return!!this.inConflict(t)||!(!t.common||void 0!==t.common.itemsMap||void 0!==t.common.body)||!(!t.remote||void 0!==t.remote.itemsMap||void 0!==t.remote.body)}needsPush(t){return!this.inConflict(t)&&(!(!t.local||t.push)||void 0)}needsRemotePut(t){return t.local&&"string"==typeof t.local.body}needsRemoteDelete(t){return t.local&&!1===t.local.body}getParentPath(t){const e=t.match(/^(.*\/)([^\/]+\/?)$/);if(e)return e[1];throw new Error('Not a valid path: "'+t+'"')}deleteChildPathsFromTasks(){for(const t in this._tasks){const e=(0,d.pathsFromRoot)(t);for(let n=1;n{let e;if(this.needsRefresh(t)){try{e=this.getParentPath(t.path)}catch(t){}e&&this.rs.access.checkPathPermission(e,"r")?this.addTask(e):this.rs.access.checkPathPermission(t.path,"r")&&this.addTask(t.path)}}),this.deleteChildPathsFromTasks()})}flush(t){for(const e in t)"FLUSH"===this.rs.caching.checkPath(e)&&t[e]&&!t[e].local&&((0,l.default)("[Sync] Flushing",e),t[e]=void 0);return t}doTask(t){return i(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(e=>{const n=e[t];return void 0===n||function(t){return!(!t.remote||!t.remote.revision||t.remote.itemsMap||t.remote.body)}(n)?g("get",t,this.rs.remote.get(t)):this.needsRemotePut(n)?(n.push=(0,d.deepClone)(n.local),n.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(e)).then(()=>{let e;return e=y(n)?{ifMatch:n.common.revision}:{ifNoneMatch:"*"},g("put",t,this.rs.remote.put(t,n.push.body,n.push.contentType,e))})):this.needsRemoteDelete(n)?(n.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(e)).then(()=>y(n)?g("delete",t,this.rs.remote.delete(t,{ifMatch:n.common.revision})):g("get",t,this.rs.remote.get(t)))):y(n)?g("get",t,this.rs.remote.get(t,{ifNoneMatch:n.common.revision})):g("get",t,this.rs.remote.get(t))})})}autoMergeFolder(t){if(t.remote.itemsMap&&(t.common=t.remote,delete t.remote,t.common.itemsMap)){for(const e in t.common.itemsMap)t.local.itemsMap[e]||(t.local.itemsMap[e]=!1);for(const e in t.local.itemsMap)t.common.itemsMap[e]||this.addTask(t.path+e);(0,d.equal)(t.local.itemsMap,t.common.itemsMap)&&delete t.local}return t}autoMergeDocument(t){var e;return function(t){return(!t.remote||!t.remote.revision||t.remote.revision===t.common.revision)&&(void 0===t.common.body&&!1===t.remote.body||t.remote.body===t.common.body&&t.remote.contentType===t.common.contentType)}(t)?delete(t=function(t){return t.remote&&!1===t.remote.body&&t.local&&!1===t.local.body&&delete t.local,t}(t)).remote:void 0!==t.remote.body&&(!1===t.remote.body&&!1===(null===(e=t.local)||void 0===e?void 0:e.body)||((0,l.default)("[Sync] Emitting conflict event"),setTimeout(this.rs.local.emitChange.bind(this.rs.local),10,{origin:"conflict",path:t.path,oldValue:t.local.body,newValue:t.remote.body,lastCommonValue:t.common.body,oldContentType:t.local.contentType,newContentType:t.remote.contentType,lastCommonContentType:t.common.contentType})),!1===t.remote.body?t.common={}:t.common=t.remote,delete t.remote,delete t.local),t}autoMerge(t){if(t.remote){if(t.local)return(0,d.isFolder)(t.path)?this.autoMergeFolder(t):this.autoMergeDocument(t);if((0,d.isFolder)(t.path))void 0!==t.remote.itemsMap&&(t.common=t.remote,delete t.remote);else if(void 0!==t.remote.body){const e={origin:"remote",path:t.path,oldValue:!1===t.common.body?void 0:t.common.body,newValue:!1===t.remote.body?void 0:t.remote.body,oldContentType:t.common.contentType,newContentType:t.remote.contentType};if(void 0===e.oldValue&&void 0===e.newValue||this.rs.local.emitChange(e),!1===t.remote.body)return;t.common=t.remote,delete t.remote}return t}t.common.body&&this.rs.local.emitChange({origin:"remote",path:t.path,oldValue:t.common.body,newValue:void 0,oldContentType:t.common.contentType,newContentType:void 0})}updateCommonTimestamp(t,e){return i(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(n=>(n[t]&&n[t].common&&n[t].common.revision===e&&(n[t].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(n))))})}markChildren(t,e,n,r){return i(this,void 0,void 0,function*(){const i=[],s={},o={};for(const n in e)i.push(t+n),s[t+n]=e[n];for(const e in r)i.push(t+e);const a=yield this.rs.local.getNodes(i);let l,c;for(const e in a)if(c=a[e],s[e])c&&c.common?m(c,s[e].ETag)&&(n[e]=(0,d.deepClone)(c),n[e].remote={revision:s[e].ETag,timestamp:this.now()},n[e]=this.autoMerge(n[e])):(l=this.rs.caching.checkPath(e),"ALL"===l&&(n[e]={path:e,common:{timestamp:this.now()},remote:{revision:s[e].ETag,timestamp:this.now()}})),n[e]&&s[e]["Content-Type"]&&(n[e].remote.contentType=s[e]["Content-Type"]),n[e]&&s[e]["Content-Length"]&&(n[e].remote.contentLength=s[e]["Content-Length"]);else if(r[e.substring(t.length)]&&c&&c.common){if(c.common.itemsMap)for(const t in c.common.itemsMap)o[e+t]=!0;if(c.local&&c.local.itemsMap)for(const t in c.local.itemsMap)o[e+t]=!0;if(c.remote||(0,d.isFolder)(e))n[e]=void 0;else if(n[e]=this.autoMerge(c),void 0===n[e]){const i=this.getParentPath(e),r=n[i],s=e.substring(t.length);r&&r.local&&(delete r.local.itemsMap[s],(0,d.equal)(r.local.itemsMap,r.common.itemsMap)&&delete r.local)}}const u=yield this.markRemoteDeletions(Object.keys(o),n);u&&(yield this.rs.local.setNodes(this.flush(u)))})}markRemoteDeletions(t,e){return i(this,void 0,void 0,function*(){if(0===t.length)return e;const n=yield this.rs.local.getNodes(t),i={};function r(t,e){if(t&&t.itemsMap)for(const n in t.itemsMap)i[e+n]=!0}for(const t in n){const i=n[t];i&&((0,d.isFolder)(t)?(r(i.common,t),r(i.local,t)):i.common&&void 0!==i.common.body&&(e[t]=(0,d.deepClone)(i),e[t].remote={body:!1,timestamp:this.now()},e[t]=this.autoMerge(e[t])))}const s=yield this.markRemoteDeletions(Object.keys(i),e);s&&(yield this.rs.local.setNodes(this.flush(s)))})}completeFetch(t,e,n,r){return i(this,void 0,void 0,function*(){let i,s;const o=(0,d.pathsFromRoot)(t);(0,d.isFolder)(t)?i=[t]:(s=o[1],i=[t,s]);const a=yield this.rs.local.getNodes(i),l=a[s],c={};let u,h=a[t];function p(t){if(t&&t.itemsMap)for(u in t.itemsMap)e[u]||(c[u]=!0)}if("object"==typeof h&&h.path===t&&"object"==typeof h.common||(h={path:t,common:{}},a[t]=h),h.remote={revision:r,timestamp:this.now()},(0,d.isFolder)(t))for(u in p(h.common),p(h.remote),h.remote.itemsMap={},e)h.remote.itemsMap[u]=!0;else h.remote.body=e,h.remote.contentType=n,l&&l.local&&l.local.itemsMap&&(u=t.substring(s.length),!1!==e?l.local.itemsMap[u]=!0:l.local.itemsMap[u]&&delete l.local.itemsMap[u],(0,d.equal)(l.local.itemsMap,l.common.itemsMap)&&delete l.local);return a[t]=this.autoMerge(h),{toBeSaved:a,missingChildren:c}})}completePush(t,e,n,r){return i(this,void 0,void 0,function*(){const i=yield this.rs.local.getNodes([t]),s=i[t];if(!s.push)throw this.stopped=!0,new Error("completePush called but no push version!");n?((0,l.default)("[Sync] We have a conflict"),s.remote&&s.remote.revision===r||(s.remote={revision:r||"conflict",timestamp:this.now()},delete s.push),i[t]=this.autoMerge(s)):(s.common={revision:r,timestamp:this.now()},"put"===e?(s.common.body=s.push.body,s.common.contentType=s.push.contentType,(0,d.equal)(s.local.body,s.push.body)&&s.local.contentType===s.push.contentType&&delete s.local,delete s.push):"delete"===e&&(!1===s.local.body?i[t]=void 0:delete s.push)),yield this.rs.local.setNodes(this.flush(i))})}dealWithFailure(t){return i(this,void 0,void 0,function*(){const e=yield this.rs.local.getNodes([t]);if(e[t])return delete e[t].push,this.rs.local.setNodes(this.flush(e))})}interpretStatus(t){const e={statusCode:t,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};if("string"==typeof t&&("offline"===t||"timeout"===t))return e.successful=!1,e.networkProblems=!0,e;if("number"==typeof t){const n=Math.floor(t/100);return e.successful=2===n||304===t||412===t||404===t,e.conflict=412===t,e.unAuth=401===t&&this.rs.remote.token!==c.default.IMPLIED_FAKE_TOKEN||402===t||403===t,e.notFound=404===t,e.changed=304!==t,e}}handleGetResponse(t,e,n,r,s){return i(this,void 0,void 0,function*(){if(e.notFound&&(n=!!(0,d.isFolder)(t)&&{}),e.changed){const e=yield this.completeFetch(t,n,r,s);if((0,d.isFolder)(t)){if(this.corruptServerItemsMap(n))return(0,l.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+t),!1;yield this.markChildren(t,n,e.toBeSaved,e.missingChildren)}else yield this.rs.local.setNodes(this.flush(e.toBeSaved))}else yield this.updateCommonTimestamp(t,s);return!0})}handleResponse(t,e,n){return i(this,void 0,void 0,function*(){const i=this.interpretStatus(n.statusCode);if(i.successful){if("get"===e)return this.handleGetResponse(t,i,n.body,n.contentType,n.revision);if("put"===e||"delete"===e)return this.completePush(t,e,i.conflict,n.revision).then(function(){return!0});throw new Error(`cannot handle response for unknown action ${e}`)}{let e;return e=i.unAuth?new h.default:i.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+i.statusCode+" received."),this.dealWithFailure(t).then(()=>{throw this.rs._emit("error",e),e})}})}finishTask(t){return i(this,arguments,void 0,function*(t,e=!0){if(void 0===t.action)return void delete this._running[t.path];if(e&&((0,l.default)("[Sync] queue finished task:",t.path),this._finishedTasks.push(t),this._finishedTasks.length>1))return void(0,l.default)("[Sync] delaying finished task:",t.path);let n;(0,l.default)("[Sync] run task:",t.path);try{n=yield t.promise}catch(e){(0,l.default)("[Sync] wire client rejects its promise",t.path,t.action,e),n={statusCode:"offline"}}try{const e=yield this.handleResponse(t.path,t.action,n);this.finishSuccessfulTask(t,e)}catch(e){this.finishUnsuccessfulTask(t,e)}})}finishSuccessfulTask(t,e){return i(this,void 0,void 0,function*(){if(this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.path],e&&this._tasks[t.path]){for(let e=0;e0?yield this.finishTask(this._finishedTasks[0],!1):yield this.collectTasks(!1).then(()=>{!this.hasTasks()||this.stopped?(this.done||(this.done=!0),this.rs._emit("sync-done",{completed:!0})):setTimeout(()=>{this.doTasks()},10)})})}finishUnsuccessfulTask(t,e){return i(this,void 0,void 0,function*(){(0,l.default)("[Sync]",e.message),this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.path],this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?yield this.finishTask(this._finishedTasks[0],!1):this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!1}))})}tasksWanted(){return this.rs.remote.connected?this.rs.remote.online?this.numThreads:1:0}doTasks(){const t=this.tasksWanted()-Object.keys(this._running).length;if(t<=0)return!0;this.hasTasks()&&!this.done&&this.rs._emit("sync-started");let e,n=0;for(e in this._tasks)if(!this._running[e]&&(this._timeStarted[e]=this.now(),this._running[e]=this.doTask(e).then(this.finishTask.bind(this)),n++,n>=t))break;return n>=t}collectTasks(){return i(this,arguments,void 0,function*(t=!0){if(!this.hasTasks()&&!this.stopped)return(yield this.collectDiffTasks())>0?void 0:t?this.collectRefreshTasks():void 0})}addTask(t,e){this._tasks[t]||(this._tasks[t]=[]),"function"==typeof e&&this._tasks[t].push(e)}sync(){return i(this,void 0,void 0,function*(){if(this.done=!1,!this.doTasks()){try{yield this.collectTasks()}catch(t){throw(0,l.default)("[Sync] Sync error",t),new Error("Local cache unavailable")}this.doTasks()}})}static _rs_init(t){p=function(){const e=new o.default;e.isBrowser()&&function(t,e){function n(t){const n=e.getCurrentSyncInterval();s.default.isBackground=!t;const i=e.getCurrentSyncInterval();e._emit("sync-interval-change",{oldValue:n,newValue:i})}t.on("background",()=>n(!1)),t.on("foreground",()=>n(!0))}(e,t),t.sync||(t.sync=new _(t),t.syncStopped&&((0,l.default)("[Sync] Initializing with sync stopped"),t.sync.stopped=!0,delete t.syncStopped)),t.setupSyncCycle()},f=function(){t.removeEventListener("connected",f),t.startSync()},t.on("ready",p),t.on("connected",f)}static _rs_cleanup(t){t.stopSync(),t.removeEventListener("ready",p),t.removeEventListener("connected",f),t.sync=void 0,delete t.sync}}e.Sync=_,(0,d.applyMixins)(_,[a.default]),e.default=_},370:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const r=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(n(334));function s(t){return"dropbox"===this.backend&&!!t.match(/^\/public\/.*[^\/]$/)}const o={get:function(t,e){if(this.local){if(void 0===e)e="object"==typeof(n=this).remote&&n.remote.connected&&n.remote.online?2*n.getSyncInterval():((0,r.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof e&&!1!==e)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(t,e,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(t);var n},put:function(t,e,n){return s.bind(this)(t)?o._wrapBusyDone.call(this,this.remote.put(t,e,n)):this.local?this.local.put(t,e,n):o._wrapBusyDone.call(this,this.remote.put(t,e,n))},delete:function(t,e){return this.local?this.local.delete(t,e):o._wrapBusyDone.call(this,this.remote.delete(t,e))},_wrapBusyDone:function(t){return i(this,void 0,void 0,function*(){return this._emit("wire-busy"),t.then(t=>(this._emit("wire-done",{success:!0}),Promise.resolve(t)),t=>(this._emit("wire-done",{success:!1}),Promise.reject(t)))})}};t.exports=o},613:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseClientTypes=void 0;class n{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(t,e,n,i){const r=t+"/"+e;if(i.extends){const e=i.extends.split("/"),n=1===e.length?t+"/"+e.shift():e.join("/"),s=this.uris[n];if(!s)throw"Type '"+r+"' tries to extend unknown schema '"+n+"'";i.extends=this.schemas[s]}this.uris[r]=n,this.aliases[n]=r,this.schemas[n]=i}resolveAlias(t){return this.uris[t]}getSchema(t){return this.schemas[t]}inScope(t){const e=t.length,n={};for(const i in this.uris)if(i.substr(0,e+1)===t+"/"){const t=this.uris[i];n[t]=this.schemas[t]}return n}}e.BaseClientTypes=n;const i=new n;e.default=i},503:function(t){class e extends Error{constructor(t,e={}){super(),this.name="Unauthorized",this.message=void 0===t?"App authorization expired or revoked.":t,void 0!==e.code&&(this.code=e.code),this.stack=(new Error).stack}}t.exports=e},746:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};function r(t,e){if("object"==typeof t&&!Array.isArray(t)&&null!==t)for(const n in t)if("object"==typeof t[n]&&null!==t[n])if("[object ArrayBuffer]"===t[n].toString()){e[n]=new ArrayBuffer(t[n].byteLength);const i=new Int8Array(t[n]);new Int8Array(e[n]).set(i)}else r(t[n],e[n])}Object.defineProperty(e,"__esModule",{value:!0}),e.toBase64=e.getTextFromArrayBuffer=e.shouldBeTreatedAsBinary=e.getJSONFromLocalStorage=e.localStorageAvailable=e.pathsFromRoot=e.deepClone=e.equal=e.bindAll=e.cleanPath=e.baseName=e.isDocument=e.isFolder=e.containingFolder=e.extend=e.getGlobalContext=e.globalContext=e.logError=void 0,e.generateCodeVerifier=function(){return i(this,arguments,void 0,function*(t=128){const e=new Uint8Array(t);crypto.getRandomValues(e);const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=Array.from(e).map(t=>n[t%66]),r=i.join(""),s=Uint8Array.from(i.map(t=>t.charCodeAt(0))),o=(a=yield crypto.subtle.digest("SHA-256",s),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(e),{codeVerifier:r,codeChallenge:o,state:Array.from(e).map(t=>n[t%66]).join("")}})},e.applyMixins=function(t,e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})},e.logError=t=>{"string"==typeof t?console.error(t):console.error(t.message,t.stack)},e.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.extend=(...t)=>{const e=t[0];return Array.prototype.slice.call(t,1).forEach(function(t){for(const n in t)e[n]=t[n]}),e},e.containingFolder=t=>{if(""===t)return"/";if(!t)throw"Path not given!";return t.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},e.isFolder=t=>"/"===t.slice(-1),e.isDocument=t=>!(0,e.isFolder)(t),e.baseName=t=>{const n=t.split("/");return(0,e.isFolder)(t)?n[n.length-2]+"/":n[n.length-1]},e.cleanPath=t=>t.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),e.bindAll=t=>{for(const e in this)"function"==typeof t[e]&&(t[e]=t[e].bind(t))},e.equal=(t,n,i=[])=>{let r;if(typeof t!=typeof n)return!1;if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return t===n;if("function"==typeof t)return t.toString()===n.toString();if(t instanceof ArrayBuffer&&n instanceof ArrayBuffer&&(t=new Uint8Array(t),n=new Uint8Array(n)),t instanceof Array){if(t.length!==n.length)return!1;for(let r=0,s=t.length;r=0)continue;s=i.slice(),s.push(n[r])}if(!(0,e.equal)(t[r],n[r],s))return!1}}return!0},e.deepClone=t=>{if(void 0!==t){const e=JSON.parse(JSON.stringify(t));return r(t,e),e}},e.pathsFromRoot=t=>{const e=[t],n=t.replace(/\/$/,"").split("/");for(;n.length>1;)n.pop(),e.push(n.join("/")+"/");return e},e.localStorageAvailable=()=>{const t=(0,e.getGlobalContext)();if(!("localStorage"in t))return!1;try{return t.localStorage.setItem("rs-check","1"),t.localStorage.removeItem("rs-check"),!0}catch(t){return!1}},e.getJSONFromLocalStorage=t=>{const n=(0,e.getGlobalContext)();try{return JSON.parse(n.localStorage.getItem(t))}catch(t){}},e.shouldBeTreatedAsBinary=(t,e)=>!!(e&&e.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(t)),e.getTextFromArrayBuffer=(t,n)=>new Promise(i=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader){const e=Buffer.from(t);i(e.toString(n))}else{let r;const s=e.globalContext;if(s.BlobBuilder=s.BlobBuilder||s.WebKitBlobBuilder,void 0!==s.BlobBuilder){const e=new s.BlobBuilder;e.append(t),r=e.getBlob()}else r=new Blob([t]);const o=new FileReader;"function"==typeof o.addEventListener?o.addEventListener("loadend",function(t){i(t.target.result)}):o.onloadend=function(t){i(t.target.result)},o.readAsText(r,n)}}),e.toBase64=t=>{const n=(0,e.getGlobalContext)();return"btoa"in n?n.btoa(t):Buffer.from(t).toString("base64")}},600:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(275)),o=r(n(93)),a=r(n(503)),l=r(n(334)),c=n(746),u=n(368),h=n(684);let d;const p="remotestorage:wireclient",f={"draft-dejong-remotestorage-00":2,"draft-dejong-remotestorage-01":3,"draft-dejong-remotestorage-02":4,"https://www.w3.org/community/rww/wiki/read-write-web-00#simple":1};class g extends h.RemoteBase{constructor(t){if(super(t),this._revisionCache={},d=(0,c.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const t=function(){const t=(0,c.getJSONFromLocalStorage)(p)||{},{userAddress:e,href:n,storageApi:i,token:r,properties:s}=t;return{userAddress:e,href:n,storageApi:i,token:r,properties:s}}();t&&setTimeout(()=>{this.configure(t)},0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}get storageType(){if(this.storageApi){const t=this.storageApi.match(/draft-dejong-(remotestorage-\d\d)/);return t?t[1]:"2012.04"}}_request(t,e,n,r,o,h,d){return i(this,void 0,void 0,function*(){if(this.isForbiddenRequestMethod(t,e))return Promise.reject(`Don't use ${t} on directories!`);let i;return n!==s.default.IMPLIED_FAKE_TOKEN&&(r.Authorization="Bearer "+n),this.rs._emit("wire-busy",{method:t,isFolder:(0,c.isFolder)(e)}),(0,u.requestWithTimeout)(t,e,{body:o,headers:r,responseType:"arraybuffer"}).then(n=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!0}),r=n.status,[401,403,404,412].indexOf(r)>=0)return(0,l.default)("[WireClient] Error response status",n.status),i=h?this.stripQuotes(n.getResponseHeader("ETag")):void 0,401===n.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:n.status,revision:i});if(function(t){return[201,204,304].indexOf(t)>=0}(n.status)||200===n.status&&"GET"!==t)return i=this.stripQuotes(n.getResponseHeader("ETag")),(0,l.default)("[WireClient] Successful request",i),Promise.resolve({statusCode:n.status,revision:i});{const t=n.getResponseHeader("Content-Type");i=h?this.stripQuotes(n.getResponseHeader("ETag")):200===n.status?d:void 0;const e=function(t){let e,n="utf-8";return t&&(e=t.match(/charset=(.+)$/),e&&(n=e[1])),n}(t);return(0,c.shouldBeTreatedAsBinary)(n.response,t)?((0,l.default)("[WireClient] Successful request with unknown or binary mime-type",i),Promise.resolve({statusCode:n.status,body:n.response,contentType:t,revision:i})):(0,c.getTextFromArrayBuffer)(n.response,e).then(e=>((0,l.default)("[WireClient] Successful request",i),Promise.resolve({statusCode:n.status,body:e,contentType:t,revision:i})))}var r},n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!1}),Promise.reject(n)))})}configure(t){if("object"!=typeof t)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.href&&(this.href=t.href),void 0!==t.storageApi&&(this.storageApi=t.storageApi),void 0!==t.token&&(this.token=t.token),void 0!==t.properties&&(this.properties=t.properties),"string"==typeof this.storageApi){const t=f[this.storageApi]||5;this.supportsRevs=t>=2}this.href&&this.token?(this.connected=!0,this.online=!0,this._emit("connected")):this.connected=!1,d&&localStorage.setItem(p,JSON.stringify({userAddress:this.userAddress,href:this.href,storageApi:this.storageApi,token:this.token,properties:this.properties}))}get(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n={};return this.supportsRevs&&e.ifNoneMatch&&(n["If-None-Match"]=this.addQuotes(e.ifNoneMatch)),this._request("GET",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs,this._revisionCache[t]).then(e=>{if(!(0,c.isFolder)(t))return Promise.resolve(e);let n={};if(void 0!==e.body)try{e.body=JSON.parse(e.body)}catch(e){return Promise.reject("Folder description at "+this.href+(0,c.cleanPath)(t)+" is not JSON")}if(200===e.statusCode&&"object"==typeof e.body){if(0===Object.keys(e.body).length)e.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(i=e.body)["@context"]&&"object"==typeof i.items){for(const n in e.body.items)this._revisionCache[t+n]=e.body.items[n].ETag;n=e.body.items}else Object.keys(e.body).forEach(i=>{this._revisionCache[t+i]=e.body[i],n[i]={ETag:e.body[i]}});return e.body=n,Promise.resolve(e)}return Promise.resolve(e);var i})}put(t,e,n,i={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");!n.match(/charset=/)&&(e instanceof ArrayBuffer||(0,u.isArrayBufferView)(e))&&(n+="; charset=binary");const r={"Content-Type":n};return this.supportsRevs&&(i.ifMatch&&(r["If-Match"]=this.addQuotes(i.ifMatch)),i.ifNoneMatch&&(r["If-None-Match"]=this.addQuotes(i.ifNoneMatch))),this._request("PUT",this.href+(0,c.cleanPath)(t),this.token,r,e,this.supportsRevs)}delete(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");e||(e={});const n={};return this.supportsRevs&&e.ifMatch&&(n["If-Match"]=this.addQuotes(e.ifMatch)),this._request("DELETE",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs)}static _rs_init(t){t.remote=new g(t),t.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){d&&delete localStorage[p]}}(0,c.applyMixins)(g,[o.default]),t.exports=g},439:function(t,e){var n,i;n=function(){var t,e,n,i;Object.keys||(Object.keys=(t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(r){if("object"!=typeof r&&"function"!=typeof r||null===r)throw new TypeError("Object.keys called on non-object");var s=[];for(var o in r)t.call(r,o)&&s.push(o);if(e)for(var a=0;a>>0;if(0===n)return-1;var i=0;if(arguments.length>1&&((i=Number(arguments[1]))!=i?i=0:0!==i&&i!==1/0&&i!==-1/0&&(i=(i>0||-1)*Math.floor(Math.abs(i)))),i>=n)return-1;for(var r=i>=0?i:Math.max(n-Math.abs(i),0);r0&&(e+=u.suffices["*"]&&n||",",u.suffices["*"]&&l&&(e+=u.name+"=")),e+=a?encodeURIComponent(h[p]).replace(/!/g,"%21"):o(h[p])}else if("object"==typeof h){l&&!u.suffices["*"]&&(e+=u.name+"=");var f=!0;for(var g in h)f||(e+=u.suffices["*"]&&n||","),f=!1,e+=a?encodeURIComponent(g).replace(/!/g,"%21"):o(g),e+=u.suffices["*"]?"=":",",e+=a?encodeURIComponent(h[g]).replace(/!/g,"%21"):o(h[g])}else l&&(e+=u.name,c&&""===h||(e+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),e+=a?encodeURIComponent(h).replace(/!/g,"%21"):o(h)}return e};return b.varNames=u,{prefix:i,substitution:b}}function l(t){if(!(this instanceof l))return new l(t);for(var e=t.split("{"),n=[e.shift()],i=[],r=[],s=[];e.length>0;){var o=e.shift(),c=o.split("}")[0],u=o.substring(c.length+1),h=a(c);r.push(h.substitution),i.push(h.prefix),n.push(u),s=s.concat(h.substitution.varNames)}this.fill=function(t){for(var e=n[0],i=0;i0&&"/"===e.charAt(t.length-1)||"#"===n.charAt(0)||"?"===n.charAt(0))return!0}return!1}(e,t.id)&&void 0===this.schemas[t.id]&&(this.schemas[t.id]=t),t)if("enum"!==i)if("object"==typeof t[i])this.searchSchemas(t[i],e);else if("$ref"===i){var r=g(t[i]);r&&void 0===this.schemas[r]&&void 0===this.missingMap[r]&&(this.missingMap[r]=r)}},c.prototype.addSchema=function(t,e){if("string"!=typeof t||void 0===e){if("object"!=typeof t||"string"!=typeof t.id)return;t=(e=t).id}t===g(t)+"#"&&(t=g(t)),this.schemas[t]=e,delete this.missingMap[t],m(e,t),this.searchSchemas(e,t)},c.prototype.getSchemaMap=function(){var t={};for(var e in this.schemas)t[e]=this.schemas[e];return t},c.prototype.getSchemaUris=function(t){var e=[];for(var n in this.schemas)t&&!t.test(n)||e.push(n);return e},c.prototype.getMissingUris=function(t){var e=[];for(var n in this.missingMap)t&&!t.test(n)||e.push(n);return e},c.prototype.dropSchemas=function(){this.schemas={},this.reset()},c.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},c.prototype.validateAll=function(t,e,n,i,r){var s;if(!(e=this.resolveRefs(e)))return null;if(e instanceof x)return this.errors.push(e),e;var o,a=this.errors.length,l=null,c=null;if(this.checkRecursive&&t&&"object"==typeof t){if(s=!this.scanned.length,t[this.validatedSchemasKey]){var u=t[this.validatedSchemasKey].indexOf(e);if(-1!==u)return this.errors=this.errors.concat(t[this.validationErrorsKey][u]),null}if(Object.isFrozen(t)&&-1!==(o=this.scannedFrozen.indexOf(t))){var h=this.scannedFrozenSchemas[o].indexOf(e);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[o][h]),null}if(this.scanned.push(t),Object.isFrozen(t))-1===o&&(o=this.scannedFrozen.length,this.scannedFrozen.push(t),this.scannedFrozenSchemas.push([])),l=this.scannedFrozenSchemas[o].length,this.scannedFrozenSchemas[o][l]=e,this.scannedFrozenValidationErrors[o][l]=[];else{if(!t[this.validatedSchemasKey])try{Object.defineProperty(t,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(t,this.validationErrorsKey,{value:[],configurable:!0})}catch(e){t[this.validatedSchemasKey]=[],t[this.validationErrorsKey]=[]}c=t[this.validatedSchemasKey].length,t[this.validatedSchemasKey][c]=e,t[this.validationErrorsKey][c]=[]}}var d=this.errors.length,p=this.validateBasic(t,e,r)||this.validateNumeric(t,e,r)||this.validateString(t,e,r)||this.validateArray(t,e,r)||this.validateObject(t,e,r)||this.validateCombinations(t,e,r)||this.validateHypermedia(t,e,r)||this.validateFormat(t,e,r)||this.validateDefinedKeywords(t,e,r)||null;if(s){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||d!==this.errors.length)for(;n&&n.length||i&&i.length;){var f=n&&n.length?""+n.pop():null,g=i&&i.length?""+i.pop():null;p&&(p=p.prefixWith(f,g)),this.prefixErrors(d,f,g)}return null!==l?this.scannedFrozenValidationErrors[o][l]=this.errors.slice(a):null!==c&&(t[this.validationErrorsKey][c]=this.errors.slice(a)),this.handleError(p)},c.prototype.validateFormat=function(t,e){if("string"!=typeof e.format||!this.formatValidators[e.format])return null;var n=this.formatValidators[e.format].call(null,t,e);return"string"==typeof n||"number"==typeof n?this.createError(_.FORMAT_CUSTOM,{message:n},"","/format",null,t,e):n&&"object"==typeof n?this.createError(_.FORMAT_CUSTOM,{message:n.message||"?"},n.dataPath||"",n.schemaPath||"/format",null,t,e):null},c.prototype.validateDefinedKeywords=function(t,e,n){for(var i in this.definedKeywords)if(void 0!==e[i])for(var r=this.definedKeywords[i],s=0;s=h&&ie.maximum)return this.createError(_.NUMBER_MAXIMUM,{value:t,maximum:e.maximum},"","/maximum",null,t,e);if(e.exclusiveMaximum&&t===e.maximum)return this.createError(_.NUMBER_MAXIMUM_EXCLUSIVE,{value:t,maximum:e.maximum},"","/exclusiveMaximum",null,t,e)}return null},c.prototype.validateNaN=function(t,e){return"number"!=typeof t?null:!0===isNaN(t)||t===1/0||t===-1/0?this.createError(_.NUMBER_NOT_A_NUMBER,{value:t},"","/type",null,t,e):null},c.prototype.validateString=function(t,e,n){return this.validateStringLength(t,e,n)||this.validateStringPattern(t,e,n)||null},c.prototype.validateStringLength=function(t,e){return"string"!=typeof t?null:void 0!==e.minLength&&t.lengthe.maxLength?this.createError(_.STRING_LENGTH_LONG,{length:t.length,maximum:e.maxLength},"","/maxLength",null,t,e):null},c.prototype.validateStringPattern=function(t,e){if("string"!=typeof t||"string"!=typeof e.pattern&&!(e.pattern instanceof RegExp))return null;var n;if(e.pattern instanceof RegExp)n=e.pattern;else{var i,r="",s=e.pattern.match(/^\/(.+)\/([img]*)$/);s?(i=s[1],r=s[2]):i=e.pattern,n=new RegExp(i,r)}return n.test(t)?null:this.createError(_.STRING_PATTERN,{pattern:e.pattern},"","/pattern",null,t,e)},c.prototype.validateArray=function(t,e,n){return Array.isArray(t)&&(this.validateArrayLength(t,e,n)||this.validateArrayUniqueItems(t,e,n)||this.validateArrayItems(t,e,n))||null},c.prototype.validateArrayLength=function(t,e){var n;return void 0!==e.minItems&&t.lengthe.maxItems&&(n=this.createError(_.ARRAY_LENGTH_LONG,{length:t.length,maximum:e.maxItems},"","/maxItems",null,t,e),this.handleError(n))?n:null},c.prototype.validateArrayUniqueItems=function(t,e){if(e.uniqueItems)for(var n=0;ne.maxProperties&&(n=this.createError(_.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:i.length,maximum:e.maxProperties},"","/maxProperties",null,t,e),this.handleError(n))?n:null},c.prototype.validateObjectRequiredProperties=function(t,e){if(void 0!==e.required)for(var n=0;n 10000");if(void 0!==_[t])throw new Error("Error already defined: "+t+" as "+_[t]);if(void 0!==v[e])throw new Error("Error code already used: "+v[e]+" as "+e);for(var i in _[t]=e,v[e]=t,w[t]=w[e]=n,S){var r=S[i];r[t]&&(r[e]=r[e]||r[t])}},reset:function(){i.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:m,resolveUrl:f,getDocumentUri:g,errorCodes:_};return r.language("en"),r}();return C.addLanguage("en-gb",w),C.tv4=C,C},void 0===(i=n.apply(e,[]))||(t.exports=i)},199:function(t,e,n){var i;"function"!=typeof fetch&&"function"!=typeof XMLHttpRequest&&(XMLHttpRequest=n(317)),function(){var n={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},r={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},s=["webfinger","host-meta","host-meta.json"];function o(t){return t.toString=function(){return this.message},t}function a(t){"object"!=typeof t&&(t={}),this.config={tls_only:void 0===t.tls_only||t.tls_only,webfist_fallback:void 0!==t.webfist_fallback&&t.webfist_fallback,uri_fallback:void 0!==t.uri_fallback&&t.uri_fallback,request_timeout:void 0!==t.request_timeout?t.request_timeout:1e4}}a.prototype.__fetchJRD=function(t,e,n){if("function"==typeof fetch)return this.__fetchJRD_fetch(t,e,n);if("function"==typeof XMLHttpRequest)return this.__fetchJRD_XHR(t,e,n);throw new Error("add a polyfill for fetch or XMLHttpRequest")},a.prototype.__fetchJRD_fetch=function(t,e,n){var i,r=this;"function"==typeof AbortController&&(i=new AbortController);var s=fetch(t,{headers:{Accept:"application/jrd+json, application/json"},signal:i?i.signal:void 0}).then(function(e){if(e.ok)return e.text();throw 404===e.status?o({message:"resource not found",url:t,status:e.status}):o({message:"error during request",url:t,status:e.status})},function(e){throw o({message:"error during request",url:t,status:void 0,err:e})}).then(function(e){if(r.__isValidJSON(e))return e;throw o({message:"invalid json",url:t,status:void 0})}),a=new Promise(function(e,n){setTimeout(function(){n(o({message:"request timed out",url:t,status:void 0})),i&&i.abort()},r.config.request_timeout)});Promise.race([s,a]).then(function(t){n(t)}).catch(function(t){e(t)})},a.prototype.__fetchJRD_XHR=function(t,e,n){var i=this,r=!1,s=new XMLHttpRequest;function a(){if(!r)return r=!0,200===s.status?i.__isValidJSON(s.responseText)?n(s.responseText):e(o({message:"invalid json",url:t,status:s.status})):404===s.status?e(o({message:"resource not found",url:t,status:s.status})):s.status>=301&&s.status<=302?function(t){return"string"==typeof t&&"https"===t.split("://")[0]}(s.getResponseHeader("Location"))?l():e(o({message:"no redirect URL found",url:t,status:s.status})):e(o({message:"error during request",url:t,status:s.status}))}function l(){s.onreadystatechange=function(){4===s.readyState&&a()},s.onload=function(){a()},s.ontimeout=function(){return e(o({message:"request timed out",url:t,status:s.status}))},s.open("GET",t,!0),s.timeout=i.config.request_timeout,s.setRequestHeader("Accept","application/jrd+json, application/json"),s.send()}return l()},a.prototype.__isValidJSON=function(t){try{JSON.parse(t)}catch(t){return!1}return!0},a.prototype.__isLocalhost=function(t){return/^localhost(\.localdomain)?(\:[0-9]+)?$/.test(t)},a.prototype.__processJRD=function(t,e,i,s){var a=JSON.parse(e);if("object"!=typeof a||"object"!=typeof a.links)return void 0!==a.error?i(o({message:a.error,request:t})):i(o({message:"unknown response from server",request:t}));var l=a.links;Array.isArray(l)||(l=[]);var c={object:a,json:e,idx:{}};c.idx.properties={name:void 0},c.idx.links=JSON.parse(JSON.stringify(r)),l.map(function(t){if(n.hasOwnProperty(t.rel)&&c.idx.links[n[t.rel]]){var e={};Object.keys(t).map(function(n){e[n]=t[n]}),c.idx.links[n[t.rel]].push(e)}});var u=JSON.parse(e).properties;for(var h in u)u.hasOwnProperty(h)&&"http://packetizer.com/ns/name"===h&&(c.idx.properties.name=u[h]);return s(c)},a.prototype.lookup=function(t,e){if("string"!=typeof t)throw new Error("first parameter must be a user address");if("function"!=typeof e)throw new Error("second parameter must be a callback");var n=this,i="";i=t.indexOf("://")>-1?t.replace(/ /g,"").split("/")[2]:t.replace(/ /g,"").split("@")[1];var r=0,o="https";function a(){var e="";return t.split("://")[1]||(e="acct:"),o+"://"+i+"/.well-known/"+s[r]+"?resource="+e+t}function l(t){if(n.config.uri_fallback&&"webfist.org"!==i&&r!==s.length-1)return r+=1,c();if(!n.config.tls_only&&"https"===o)return r=0,o="http",c();if(!n.config.webfist_fallback||"webfist.org"===i)return e(t);r=0,o="http",i="webfist.org";var l=a();n.__fetchJRD(l,e,function(t){n.__processJRD(l,t,e,function(t){"object"==typeof t.idx.links.webfist&&"string"==typeof t.idx.links.webfist[0].href&&n.__fetchJRD(t.idx.links.webfist[0].href,e,function(t){n.__processJRD(l,t,e,function(){return e(null,e)})})})})}function c(){var t=a();n.__fetchJRD(t,l,function(i){n.__processJRD(t,i,e,function(t){e(null,t)})})}return n.__isLocalhost(i)&&(o="http"),setTimeout(c,0)},a.prototype.lookupLink=function(t,e,n){if(!r.hasOwnProperty(e))return n("unsupported rel "+e);this.lookup(t,function(t,i){var r=i.idx.links[e];return t?n(t):0===r.length?n('no links found with rel="'+e+'"'):n(null,r[0])})},void 0===(i=function(){return a}.apply(e,[]))||(t.exports=i)}()},317:function(t){t.exports=XMLHttpRequest}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n(423).default}()),jx.exports); -/*! For license information please see remotestorage.js.LICENSE.txt */const Ux=zx(Nx),Bx="0123456789bcdefghjkmnpqrstuvwxyz";class qx{static encode(t,e,n){if(void 0===n){for(let n=1;n<=12;n++){const i=qx.encode(t,e,n),r=qx.decode(i);if(r.lat==t&&r.lon==e)return i}n=12}if(t=Number(t),e=Number(e),n=Number(n),isNaN(t)||isNaN(e)||isNaN(n))throw new Error("Invalid geohash");let i=0,r=0,s=!0,o="",a=-90,l=90,c=-180,u=180;for(;o.length=t?(i=2*i+1,c=t):(i*=2,u=t)}else{const e=(a+l)/2;t>=e?(i=2*i+1,a=e):(i*=2,l=e)}s=!s,5==++r&&(o+=Bx.charAt(i),r=0,i=0)}return o}static decode(t){const e=qx.bounds(t),n=e.sw.lat,i=e.sw.lon,r=e.ne.lat,s=e.ne.lon;let o=(n+r)/2,a=(i+s)/2;return o=o.toFixed(Math.floor(2-Math.log(r-n)/Math.LN10)),a=a.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),{lat:Number(o),lon:Number(a)}}static bounds(t){if(0==t.length)throw new Error("Invalid geohash");t=t.toLowerCase();let e=!0,n=-90,i=90,r=-180,s=180;for(let o=0;o=0;t--){const o=l>>t&1;if(e){const t=(r+s)/2;1==o?r=t:s=t}else{const t=(n+i)/2;1==o?n=t:i=t}e=!e}}return{sw:{lat:n,lon:r},ne:{lat:i,lon:s}}}static adjacent(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0==t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(e))throw new Error("Invalid direction");const n=t.slice(-1);let i=t.slice(0,-1);const r=t.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[e][r].indexOf(n)&&""!=i&&(i=qx.adjacent(i,e)),i+Bx.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[e][r].indexOf(n))}static neighbours(t){return{n:qx.adjacent(t,"n"),ne:qx.adjacent(qx.adjacent(t,"n"),"e"),e:qx.adjacent(t,"e"),se:qx.adjacent(qx.adjacent(t,"s"),"e"),s:qx.adjacent(t,"s"),sw:qx.adjacent(qx.adjacent(t,"s"),"w"),w:qx.adjacent(t,"w"),nw:qx.adjacent(qx.adjacent(t,"n"),"w")}}}const Vx="0123456789ABCDEFGHJKMNPQRSTVWXYZ",$x=0xffffffffffff;var Gx;!function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"}(Gx||(Gx={}));class Wx extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function Hx(t){const e=Math.floor(32*t())%32;return Vx.charAt(e)}const Kx={type:"object",properties:{id:{type:"string"},title:{type:"string"},lat:{type:"number"},lon:{type:"number"},geohash:{type:"string"},zoom:{type:"number"},url:{type:"string"},osmId:{type:"string"},osmType:{type:"string"},osmTags:{type:"object",additionalProperties:{type:"string"}},description:{type:"string"},tags:{type:"array",items:{type:"string"},default:[]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","title","lat","lon","geohash","createdAt"]},Xx={name:"places",builder:function(t){function e(t,e){return`${t.substring(0,2)}/${t.substring(2,4)}/${e}`}t.declareType("place",Kx);const n={store:async function(n){const i=function(t){const e=(new Date).toISOString(),n=t.id||function(){const t=function(){const t="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null,e=t&&(t.crypto||t.msCrypto)||null;if("function"==typeof e?.getRandomValues)return()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]/256};if("function"==typeof e?.randomBytes)return()=>e.randomBytes(1).readUInt8()/256;throw new Wx(Gx.PRNGDetectFailure,"Failed to find a reliable PRNG")}();return function(t,e=10){if(isNaN(t))throw new Wx(Gx.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>$x)throw new Wx(Gx.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${$x}: ${t}`);if(t<0)throw new Wx(Gx.EncodeTimeNegative,`Time must be positive: ${t}`);if(!1===Number.isInteger(t))throw new Wx(Gx.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,i="";for(let r=e;r>0;r--)n=t%32,i=Vx.charAt(n)+i,t=(t-n)/32;return i}(Date.now(),10)+function(t,e){let n="";for(;t>0;t--)n=Hx(e)+n;return n}(16,t)}(),i="number"==typeof t.lat?t.lat:0,r="number"==typeof t.lon?t.lon:0,s=t.title||"Untitled Place",o=t.geohash||qx.encode(i,r,10),a={...t,id:n,lat:i,lon:r,geohash:o,title:s,tags:t.tags||[],createdAt:t.createdAt||e,updatedAt:t.id?e:void 0};return Object.keys(a).forEach(t=>{void 0===a[t]&&delete a[t]}),a}(n),r=e(i.geohash,i.id);return await t.storeObject("place",r,i),i},remove:async function(n,i){if(!n||!i)throw new Error("Both id and geohash are required to remove a place");const r=e(i,n);return t.remove(r)},get:async function(n,i){if(!n||!i)throw new Error("Both id and geohash are required to get a place");const r=e(i,n);return t.getObject(r)},listByPrefix:async function(e){let n="";return e.length>=2&&(n+=e.substring(0,2)+"/"),e.length>=4&&(n+=e.substring(2,4)+"/"),t.getAll(n)},getPlaces:async function(e){const n=[],i=async e=>{const i=await t.getAll(e,!1);i&&Object.values(i).forEach(t=>{t&&"object"==typeof t&&!t.toString().endsWith("/")&&n.push(t)})};if(e&&e.length>0){const t=e.map(async t=>{if(t.length<4)return;const e=t.substring(0,2),n=t.substring(2,4);await i(`${e}/${n}/`)});await Promise.all(t)}else{const e=t=>{if(!t||"object"!=typeof t)return[];let e=t;return t.items&&"object"==typeof t.items&&(e=t.items),Object.keys(e).filter(t=>t.endsWith("/")&&!t.startsWith("@"))},n=await t.getListing("",!1),r=e(n);await Promise.all(r.map(async n=>{const r=await t.getListing(n,!1),s=e(r);await Promise.all(s.map(async t=>{await i(n+t)}))}))}return n}};return{exports:n}}};var Yx,Zx={exports:{}};const Jx=zx((Yx||(Yx=1,self,Zx.exports=(()=>{var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>i});var n=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rs=e,this.leaveOpen=!!n.leaveOpen&&n.leaveOpen,this.autoCloseAfter=n.autoCloseAfter?n.autoCloseAfter:1500,this.skipInitial=!!n.skipInitial&&n.skipInitial,this.logging=!!n.logging&&n.logging,this.parentContainerEl=null,n.hasOwnProperty("modalBackdrop")){if("boolean"!=typeof n.modalBackdrop&&"onlySmallScreens"!==n.modalBackdrop)throw'options.modalBackdrop has to be true/false or "onlySmallScreens"';this.modalBackdrop=n.modalBackdrop}else this.modalBackdrop="onlySmallScreens";this.active=!1,this.online=!1,this.closed=!1,this.lastSynced=null,this.lastSyncedUpdateLoop=null}var e,n;return e=t,n=[{key:"log",value:function(){if(this.logging){for(var t,e=arguments.length,n=new Array(e),i=0;i

Connect your storage

To sync data with your account
';var e=document.createElement("style");return e.innerHTML='#remotestorage-widget {\n z-index: 21000000;\n}\n\n.rs-widget {\n box-sizing: border-box;\n overflow: hidden;\n max-width: 350px;\n padding: 10px;\n margin: 10px;\n border-radius: 3px;\n background-color: #fff;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n font-family: arial, sans-serif;\n font-size: 16px;\n color: #333;\n will-change: max-height, height, width, opacity, max-width, background, box-shadow;\n transition-property: width, height, opacity, max-width, max-height, background, box-shadow;\n transition-duration: 300ms;\n}\n\n.rs-widget * {\n box-sizing: border-box;\n}\n\n.rs-widget .rs-hidden {\n display: none;\n}\n\n.rs-box {\n overflow: hidden;\n will-change: height;\n transition-property: height, width, max-height;\n transition-duration: 300ms;\n transition-timing-function: ease-in;\n opacity: 0;\n max-height: 0px;\n}\n\n.rs-box.rs-selected:not([aria-hidden=true]) {\n opacity: 1;\n max-height: 420px;\n}\n\n/* Main logo */\n.rs-main-logo {\n float: left;\n height: 36px;\n width: 36px;\n margin-top: 1px;\n margin-right: 0.625em;\n transition: margin-left 300ms ease-out, transform 300ms ease-out;\n cursor: pointer;\n}\n.rs-widget .rs-backend-remotestorage svg#rs-main-logo-remotestorage {\n display: block;\n}\n.rs-widget[class*="rs-backend-"]:not(.rs-backend-remotestorage) svg#rs-main-logo-remotestorage {\n display: none;\n}\n.rs-widget.rs-backend-dropbox svg#rs-main-logo-dropbox {\n display: block;\n}\n.rs-widget:not(.rs-backend-dropbox) svg#rs-main-logo-dropbox {\n display: none;\n}\n.rs-widget.rs-backend-googledrive svg#rs-main-logo-googledrive {\n display: block;\n}\n.rs-widget:not(.rs-backend-googledrive) svg#rs-main-logo-googledrive {\n display: none;\n}\n\npolygon.rs-logo-shape {\n fill: #FF4B03;\n}\n\npolygon.rs-logo-shape,\n#rs-main-logo-dropbox path,\n#rs-main-logo-googledrive path {\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n.rs-offline polygon.rs-logo-shape,\n.rs-offline #rs-main-logo-dropbox path,\n.rs-offline #rs-main-logo-googledrive path {\n fill: #888;\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n/* Hide everything except logo when connected and clicked outside of box */\n.rs-closed {\n max-width: 56px;\n background-color: transparent;\n box-shadow: none;\n opacity: 0.5;\n\n transition: max-height 100ms ease-out 0ms, max-width 300ms ease-out 300ms, background 300ms ease-in 200ms, opacity 300ms ease 200ms;\n}\n\n.rs-closed:hover {\n cursor: pointer;\n opacity: 1;\n}\n\n.rs-box-initial {\n transition-duration: 0ms;\n}\n\n.rs-box-initial:hover {\n cursor: pointer;\n}\n\n.rs-widget a {\n color: #0093cc;\n}\n\n/* HEADLINE */\n.rs-small-headline {\n font-size: 1em;\n font-weight: bold;\n margin: 0;\n margin-bottom: 2px;\n height: 1.2em;\n word-break: break-all;\n overflow: hidden;\n line-height: 1em;\n}\n\n.rs-sub-headline {\n word-break: break-all;\n overflow: hidden;\n color: #666;\n font-size: 0.92em;\n height: 1.2em;\n}\n.rs-big-headline {\n font-size: 1.625em;\n font-weight: normal;\n text-align: center;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n/* BUTTONS */\n.rs-button {\n font: inherit;\n color: inherit;\n background-color: transparent;\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n cursor: pointer;\n}\n.rs-button-small {\n padding: 0.6em 0.7em;\n margin-left: 0.2em;\n transition: border-color 300ms ease-out;\n}\n.rs-button-small svg {\n vertical-align: top;\n}\n.rs-button-wrap {\n margin-top: 10px;\n}\n\n.rs-button-wrap img,\n.rs-button-wrap svg {\n float: left;\n margin-right: 0.6em;\n width: 40px;\n height: 40px;\n}\n\n.rs-button-big {\n padding: 15px 10px;\n margin-bottom: 10px;\n display: block;\n width: 100%;\n text-align: left;\n transition: box-shadow 200ms;\n}\n.rs-button-big > div {\n font-size: 1.125em;\n padding: 10px 0;\n}\n.rs-button-big:hover {\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:active {\n background-color: #eee;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:last-child {\n margin-bottom: 0;\n}\n\n.rs-content {\n padding: 0 10px 10px 10px;\n}\n\n\n.rs-state-choose .rs-main-logo,\n.rs-state-sign-in .rs-main-logo {\n margin-left: 45%;\n float: none;\n}\n\n.rs-sign-in-form input[type=text] {\n padding: 15px 10px;\n display: block;\n width: 100%;\n font: inherit;\n height: 52px;\n border: 1px solid #aaa;\n border-radius: 0;\n box-shadow: none;\n}\n.rs-sign-in-form button.rs-connect {\n padding: 15px 10px;\n margin-top: 20px;\n margin-bottom: 15px;\n display: block;\n width: 100%;\n border: none;\n border-radius: 3px;\n background-color: #3fb34f;\n font: inherit;\n color: #fff;\n transition: box-shadow 200ms, background-color 200ms;\n}\n\n.rs-sign-in-form button.rs-connect:hover {\n cursor: pointer;\n background-color: #4BCB5D;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n\n.rs-sign-in-form button.rs-connect:active {\n background-color: #3fb34f;\n}\n\n.rs-sign-in-form button.rs-connect:disabled,\n.rs-sign-in-form button.rs-connect:disabled:hover {\n background-color: #aaa;\n}\n\n.rs-sign-in-form button.rs-connecting svg {\n height: 1em;\n width: auto;\n vertical-align: middle;\n margin-left: 0.5em;\n animation: rs-spin 1s linear infinite;\n}\n\n.rs-sign-in-error.rs-hidden,\n.rs-box-error.rs-hidden {\n height: 0;\n}\n\n.rs-sign-in-error.rs-visible,\n.rs-box-error.rs-visible {\n height: auto;\n border-radius: 3px;\n padding: 0.5em 0.5em;\n margin-top: 0.5em;\n text-align: center;\n background-color: rgba(255,0,0,0.1);\n color: darkred;\n}\n\n.rs-box-error {\n display: flex;\n flex-direction: row;\n}\n\n.rs-box-error .rs-error-message {\n flex: auto;\n}\n\n /*Choose provider box */\n.rs-box-choose {\n text-align: center;\n overflow: hidden;\n}\n\n.rs-box-choose p {\n margin-top: 0;\n margin-bottom: 20px;\n line-height: 1.4em;\n}\n\n/*Connected box */\n.rs-box-connected {\n display: flex;\n flex-direction: row;\n height: 40px;\n transition: height 0s;\n}\n.rs-connected-text {\n flex: auto;\n min-width: 0;\n}\n.rs-box-connected .rs-user {\n font-weight: bold;\n text-overflow: ellipsis;\n overflow: hidden;\n word-break: keep-all;\n}\n.rs-connected-buttons, .rs-error-buttons {\n flex: none;\n}\n.rs-disconnect:hover {\n border-color: #FF2D2D;\n}\n.rs-disconnect:hover .rs-icon{\n fill: #FF2D2D;\n}\n.rs-sync:hover {\n border-color: #FFBB0C;\n}\n.rs-sync:hover .rs-icon {\n fill: #FFBB0C;\n}\n.rs-sync.rs-rotate {\n border-color: #FFBB0C;\n}\n.rs-sync.rs-rotate .rs-icon {\n fill: #FFBB0C;\n animation: rs-spin 1s linear infinite;\n}\n\n/* Floating widget styles (top right corner) */\n.rs-floating {\n position: fixed;\n top: 0;\n right: 0;\n}\n\n@keyframes rs-spin {\n 100% {\n transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n/* Small/mobile screens */\n@media screen and (max-width: 420px) {\n .rs-widget {\n font-size: 100%;\n transition: all 300ms ease-out;\n max-width: 400px;\n }\n .rs-floating {\n position: relative;\n top: auto;\n right: auto\n }\n .rs-closed {\n max-width: 56px;\n }\n .rs-state-choose,\n .rs-state-sign-in {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n max-width: 100%;\n }\n}\n\n/* remove dotted outline border on Firefox */\n.rs-widget a:focus,\n.rs-widget a:active,\n.rs-widget button:focus,\n.rs-widget input:focus {\n outline:none;\n}\n.rs-widget button::-moz-focus-inner,\n.rs-widget input[type="button"]::-moz-focus-inner {\n border:0;\n}\n\n/* prevent rounded buttons on mobile Safari */\n.rs-widget button,\n.rs-widget input[type="button"] {\n -webkit-appearance: none;\n}\n\n.remotestorage-widget-modal-backdrop {\n display: none;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: opacity 0.3s linear;\n}\n\n.remotestorage-widget-modal-backdrop.visible {\n opacity: 1;\n transition: opacity 0.3s linear;\n}\n',t.appendChild(e),t}},{key:"setModalClass",value:function(){if(this.modalBackdrop){if("onlySmallScreens"===this.modalBackdrop&&!this.isSmallScreen())return;this.rsWidget.classList.add("rs-modal")}}},{key:"setupElements",value:function(){if(!this.parentContainerEl)throw new Error("Parent container element not found");this.rsWidget=this.parentContainerEl.querySelector(".rs-widget"),this.rsBackdrop=this.parentContainerEl.querySelector(".remotestorage-widget-modal-backdrop"),this.rsInitial=this.parentContainerEl.querySelector(".rs-box-initial"),this.rsChoose=this.parentContainerEl.querySelector(".rs-box-choose"),this.rsConnected=this.parentContainerEl.querySelector(".rs-box-connected"),this.rsSignIn=this.parentContainerEl.querySelector(".rs-box-sign-in"),this.rsConnectedLabel=this.parentContainerEl.querySelector(".rs-box-connected .rs-sub-headline"),this.rsChooseRemoteStorageButton=this.parentContainerEl.querySelector("button.rs-choose-rs"),this.rsChooseDropboxButton=this.parentContainerEl.querySelector("button.rs-choose-dropbox"),this.rsChooseGoogleDriveButton=this.parentContainerEl.querySelector("button.rs-choose-googledrive"),this.rsErrorBox=this.parentContainerEl.querySelector(".rs-box-error .rs-error-message"),this.rs.apiKeys.hasOwnProperty("googledrive")||this.rsChooseGoogleDriveButton.parentNode.removeChild(this.rsChooseGoogleDriveButton),this.rs.apiKeys.hasOwnProperty("dropbox")||this.rsChooseDropboxButton.parentNode.removeChild(this.rsChooseDropboxButton),this.rsSignInForm=this.parentContainerEl.querySelector(".rs-sign-in-form"),this.rsAddressInput=this.rsSignInForm.querySelector("input[name=rs-user-address]"),this.rsConnectButton=this.parentContainerEl.querySelector(".rs-connect"),this.rsDisconnectButton=this.parentContainerEl.querySelector(".rs-disconnect"),this.rsSyncButton=this.parentContainerEl.querySelector(".rs-sync"),this.rsLogo=this.parentContainerEl.querySelector(".rs-widget-icon"),this.rsErrorReconnectLink=this.parentContainerEl.querySelector(".rs-box-error a.rs-reconnect"),this.rsErrorDisconnectButton=this.parentContainerEl.querySelector(".rs-box-error button.rs-disconnect"),this.rsConnectedUser=this.parentContainerEl.querySelector(".rs-connected-text h1.rs-user")}},{key:"setupHandlers",value:function(){var t=this;this.rs.on("connected",function(){return t.eventHandler("connected")}),this.rs.on("ready",function(){return t.eventHandler("ready")}),this.rs.on("disconnected",function(){return t.eventHandler("disconnected")}),this.rs.on("network-online",function(){return t.eventHandler("network-online")}),this.rs.on("network-offline",function(){return t.eventHandler("network-offline")}),this.rs.on("error",function(e){return t.eventHandler("error",e)}),this.setEventListeners(),this.setClickHandlers()}},{key:"attach",value:function(t){var e=this.createHtmlTemplate(t);if(this.parentContainerEl,t instanceof HTMLElement)this.parentContainerEl=t;else if("string"==typeof t){if(this.parentContainerEl=document.getElementById(t),!this.parentContainerEl)throw new Error('Failed to find target DOM element with id="'+t+'"')}else{if(t)throw new Error("Unknown element type. Expected instance of HTMLElement or type of string.");this.parentContainerEl=document.body}this.parentContainerEl.appendChild(e),this.setupElements(),this.setupHandlers(),this.setInitialState(),this.setModalClass()}},{key:"setEventListeners",value:function(){var t=this;this.rsSignInForm.addEventListener("submit",function(e){e.preventDefault();var n=t.parentContainerEl.querySelector("input[name=rs-user-address]").value;t.disableConnectButton(),t.rs.connect(n)})}},{key:"showChooseOrSignIn",value:function(){this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.style.display="block",this.rsBackdrop.classList.add("visible")),this.rs.apiKeys&&Object.keys(this.rs.apiKeys).length>0?this.setState("choose"):this.setState("sign-in")}},{key:"setClickHandlers",value:function(){var t=this;this.rsInitial.addEventListener("click",function(){return t.showChooseOrSignIn()}),this.rsChooseRemoteStorageButton.addEventListener("click",function(){t.setState("sign-in"),t.rsAddressInput.focus()}),this.rsChooseDropboxButton.addEventListener("click",function(){return t.rs.dropbox.connect()}),this.rsChooseGoogleDriveButton.addEventListener("click",function(){return t.rs.googledrive.connect()}),this.rsDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rsErrorReconnectLink.addEventListener("click",function(){return t.rs.reconnect()}),this.rsErrorDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rs.hasFeature("Sync")&&this.rsSyncButton.addEventListener("click",function(){t.rsSyncButton.classList.contains("rs-rotate")?(t.rs.stopSync(),t.rsSyncButton.classList.remove("rs-rotate")):(t.rsConnectedLabel.textContent="Synchronizing",t.rs.startSync(),t.rsSyncButton.classList.add("rs-rotate"))}),document.addEventListener("click",function(){return t.close()}),this.rsWidget.addEventListener("click",function(t){return t.stopPropagation()}),this.rsLogo.addEventListener("click",function(){return t.toggle()})}},{key:"toggle",value:function(){this.closed?this.open():"initial"===this.state?this.showChooseOrSignIn():this.close()}},{key:"open",value:function(){this.closed=!1,this.rsWidget.classList.remove("rs-closed"),this.shouldCloseWhenSyncDone=!1;var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&t.setAttribute("aria-hidden","false")}},{key:"close",value:function(){var t=this;if("error"!==this.state){if(!this.leaveOpen&&this.active){this.closed=!0,this.rsWidget.classList.add("rs-closed");var e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&e.setAttribute("aria-hidden","true")}else this.active?this.setState("connected"):this.setInitialState();this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.classList.remove("visible"),setTimeout(function(){t.rsBackdrop.style.display="none"},300))}}},{key:"disableConnectButton",value:function(){this.rsConnectButton.disabled=!0,this.rsConnectButton.classList.add("rs-connecting"),this.rsConnectButton.innerHTML="Connecting ".concat('\n \n \n \n \n \n \n\n')}},{key:"enableConnectButton",value:function(){this.rsConnectButton.disabled=!1,this.rsConnectButton.textContent="Connect",this.rsConnectButton.classList.remove("rs-connecting")}},{key:"setOffline",value:function(){this.online&&(this.rsWidget.classList.add("rs-offline"),this.rsConnectedLabel.textContent="Offline",this.online=!1)}},{key:"setOnline",value:function(){this.online||(this.rsWidget.classList.remove("rs-offline"),this.active&&(this.rsConnectedLabel.textContent="Connected")),this.online=!0}},{key:"setBackendClass",value:function(t){this.rsWidget.classList.remove("rs-backend-remotestorage"),this.rsWidget.classList.remove("rs-backend-dropbox"),this.rsWidget.classList.remove("rs-backend-googledrive"),t&&this.rsWidget.classList.add("rs-backend-".concat(t))}},{key:"showErrorBox",value:function(t){this.rsErrorBox.innerHTML=t,this.setState("error")}},{key:"hideErrorBox",value:function(){this.rsErrorBox.innerHTML="",this.close()}},{key:"handleSyncStarted",value:function(){var t=this;this.syncInProgress=!0,this.rsSyncButton.classList.add("rs-rotate"),setTimeout(function(){t.syncInProgress&&(t.rsConnectedLabel.textContent="Synchronizing")},1e3)}},{key:"handleDiscoveryError",value:function(t){var e=this.parentContainerEl.querySelector(".rs-sign-in-error");e.innerHTML=t.message,e.classList.remove("rs-hidden"),e.classList.add("rs-visible"),this.enableConnectButton()}},{key:"handleSyncError",value:function(){this.setOffline()}},{key:"handleUnauthorized",value:function(t){t.code&&"access_denied"===t.code?this.rs.disconnect():(this.open(),this.showErrorBox(t.message+" "),this.rsErrorBox.appendChild(this.rsErrorReconnectLink),this.rsErrorReconnectLink.classList.remove("rs-hidden"))}},{key:"updateLastSyncedStatus",value:function(){var t=new Date;this.online?(this.lastSynced=t,this.rsConnectedLabel.textContent="Synced"):this.rsWidget.classList.contains("rs-state-unauthorized")||(this.rsConnectedLabel.textContent="Offline")}},{key:"isSmallScreen",value:function(){return window.innerWidth<421}}],n&&function(t,e){for(var n=0;n20||Math.abs(r-n)>20)return console.warn("BBox too large for 4-char geohash scanning, aborting fine scan."),[];for(let a=e;a<=i+.1;a+=.1)for(let t=n;t<=r+.1;t+=.1){const e=Math.min(a,i),n=Math.min(t,r);try{const t=qx.encode(e,n,4);s.add(t)}catch(o){}}try{s.add(qx.encode(e,n,4))}catch(o){}try{s.add(qx.encode(i,r,4))}catch(o){}try{s.add(qx.encode(e,r,4))}catch(o){}try{s.add(qx.encode(i,n,4))}catch(o){}return Array.from(s)}const tS=Object.freeze(Object.defineProperty({__proto__:null,getGeohashPrefixesInBbox:Qx},Symbol.toStringTag,{value:"Module"})),eS=Object.assign({},g.FEATURES);function nS(t){let e=eS[t];return!0===e||!1===e?e:!!g.ENABLE_OPTIONAL_FEATURES}function iS(t){return Sf(t)||"string"==typeof t&&!1===/\S/.test(t)}function rS(t){return!iS(t)}function sS(t,e){return t&&"function"==typeof t.isEqual?t.isEqual(e):t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():t===e}let oS={};function aS(t){oS=t}function lS(){return oS}function cS(t,e){return Wi(t,e)}function uS(t,e){if(Symbol.iterator in t)for(let n of t)e(n);else t.forEach,t.forEach(e)}class hS{recordCaches=new Map;added=[];updated=[];removed=[];getCacheForItem(t){let e=this.recordCaches.get(t);if(!e){let n=!1;e=qe(()=>{n?this.updated.push(this.wrapRecord(t)):(this.added.push(this.wrapRecord(t)),n=!0)}),this.recordCaches.set(t,e)}return e}constructor(t,e,n,i,r,s){this.wrapRecord=r,this.release=s,this.recordArrayCache=qe(()=>{let s=new Set;De(on(t,"[]")),uS(t,t=>{Ve(this.getCacheForItem(t)),s.add(t)}),We(()=>{this.recordCaches.forEach((t,e)=>{s.has(e)||(this.removed.push(r(e)),this.recordCaches.delete(e))})}),this.added.length>0&&(e(this.added),this.added=[]),this.updated.length>0&&(n(this.updated),this.updated=[]),this.removed.length>0&&(i(this.removed),this.removed=[])})}revalidate(){Ve(this.recordArrayCache)}}class dS{constructor(t,e,n){this.release=n;let i=!1;this.cache=qe(()=>{uS(t,()=>{}),De(on(t,"[]")),!0===i?xa(e):i=!0}),this.release=n}revalidate(){Ve(this.cache)}}class pS extends Tu{releaseMethods=id();recordsWatchers=new Map;typeWatchers=new Map;flushWatchers=null;constructor(t){super(t),this.containerDebugAdapter=ur(this).lookup("container-debug-adapter:main")}attributeLimit=3;acceptsModelName=!0;getFilters(){return id()}watchModelTypes(t,e){let n,i=this.getModelTypes(),r=id();n=i.map(t=>{let n=t.klass,i=this.wrapModelType(n,t.name);return r.push(this.observeModelType(t.name,e)),i}),t(n);let s=()=>{r.forEach(t=>t()),this.releaseMethods.removeObject(s)};return this.releaseMethods.pushObject(s),s}_nameToClass(t){if("string"==typeof t){let e=ur(this).factoryFor(`model:${t}`);t=e&&e.class}return t}watchRecords(t,e,n,i){let r=this._nameToClass(t),s=this.getRecords(r,t),{recordsWatchers:o}=this,a=o.get(s);return a||(a=new hS(s,e,n,i,t=>this.wrapRecord(t),()=>{o.delete(s),this.updateFlushWatchers()}),o.set(s,a),this.updateFlushWatchers(),a.revalidate()),a.release}updateFlushWatchers(){null===this.flushWatchers?(this.typeWatchers.size>0||this.recordsWatchers.size>0)&&(this.flushWatchers=()=>{this.typeWatchers.forEach(t=>t.revalidate()),this.recordsWatchers.forEach(t=>t.revalidate())},ga.on("end",this.flushWatchers)):0===this.typeWatchers.size&&0===this.recordsWatchers.size&&(ga.off("end",this.flushWatchers),this.flushWatchers=null)}willDestroy(){this._super(...arguments),this.typeWatchers.forEach(t=>t.release()),this.recordsWatchers.forEach(t=>t.release()),this.releaseMethods.forEach(t=>t()),this.flushWatchers&&ga.off("end",this.flushWatchers)}detect(t){return!1}columnsForType(t){return id()}observeModelType(t,e){let n=this._nameToClass(t),i=this.getRecords(n,t),{typeWatchers:r}=this,s=r.get(i);return s||(s=new dS(i,()=>{e([this.wrapModelType(n,t)])},()=>{r.delete(i),this.updateFlushWatchers()}),r.set(i,s),this.updateFlushWatchers(),s.revalidate()),s.release}wrapModelType(t,e){return{name:e,count:Ss(this.getRecords(t,e),"length"),columns:this.columnsForType(t),object:t}}getModelTypes(){let t=this.containerDebugAdapter,e=(t.canCatalogEntriesByType("model")?t.catalogEntriesByType("model"):this._getObjectsOnNamespaces()).map(t=>({klass:this._nameToClass(t),name:t}));return e.filter(t=>this.detect(t.klass))}_getObjectsOnNamespaces(){let t=Hw.NAMESPACES,e=[];return t.forEach(t=>{for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!this.detect(t[n]))continue;let i=Af(n);e.push(i)}}),e}getRecords(t,e){return id()}wrapRecord(t){return{object:t,columnValues:this.getRecordColumnValues(t),searchKeywords:this.getRecordKeywords(t),filterValues:this.getRecordFilterValues(t),color:this.getRecordColor(t)}}getRecordColumnValues(t){return{}}getRecordKeywords(t){return id()}getRecordFilterValues(t){return{}}getRecordColor(t){return null}}const fS={willChange:"_arrangedContentArrayWillChange",didChange:"_arrangedContentArrayDidChange"};function gS(t,e){return"[]"===e?(t._revalidate(),t._arrTag):"length"===e?(t._revalidate(),t._lengthTag):on(t,e)}class mS extends Tu{_objectsDirtyIndex=0;_objects=null;_lengthDirty=!0;_length=0;_arrangedContent=null;_arrangedContentIsUpdating=!1;_arrangedContentTag=null;_arrangedContentRevision=null;_lengthTag=null;_arrTag=null;init(t){super.init(t),li(this,gS)}[is](){this._revalidate()}willDestroy(){this._removeArrangedContentArrayObserver()}objectAtContent(t){return dr(Ss(this,"arrangedContent"),t)}replace(t,e,n){this.replaceContent(t,e,n)}replaceContent(t,e,n){Ws(Ss(this,"content"),t,e,n)}objectAt(t){if(this._revalidate(),null===this._objects&&(this._objects=[]),-1!==this._objectsDirtyIndex&&t>=this._objectsDirtyIndex){let t=Ss(this,"arrangedContent");if(t){let e=this._objects.length=Ss(t,"length");for(let t=this._objectsDirtyIndex;tr)&&(this._objectsDirtyIndex=r),this._lengthDirty=!0,$s(this,e,n,i,!1)}_invalidate(){this._objectsDirtyIndex=0,this._lengthDirty=!0}_revalidate(){if(!0!==this._arrangedContentIsUpdating&&(null===this._arrangedContentTag||!de(this._arrangedContentTag,this._arrangedContentRevision))){let t=this.get("arrangedContent");null===this._arrangedContentTag?this._addArrangedContentArrayObserver(t):(this._arrangedContentIsUpdating=!0,this._updateArrangedContentArray(t),this._arrangedContentIsUpdating=!1);let e=this._arrangedContentTag=on(this,"arrangedContent");this._arrangedContentRevision=he(this._arrangedContentTag),H(t)?(this._lengthTag=ke([e,fr(t,"length")]),this._arrTag=ke([e,fr(t,"[]")])):this._lengthTag=this._arrTag=e}}}mS.reopen(td,{arrangedContent:js("content")});const yS=Object.freeze(Object.defineProperty({__proto__:null,default:mS},Symbol.toStringTag,{value:"Module"}));class _S extends nh{}_S.PrototypeMixin.reopen(Jl);const vS=Object.freeze(Object.defineProperty({__proto__:null,default:_S},Symbol.toStringTag,{value:"Module"})),bS=Bl.create({reason:null,isPending:ps("isSettled",function(){return!Ss(this,"isSettled")}).readOnly(),isSettled:ps("isRejected","isFulfilled",function(){return Ss(this,"isRejected")||Ss(this,"isFulfilled")}).readOnly(),isRejected:!1,isFulfilled:!1,promise:ps({get(){throw new Error("PromiseProxy's promise must be set")},set(t,e){return function(t,e){return Qs(t,{isFulfilled:!1,isRejected:!1}),e.then(e=>(t.isDestroyed||t.isDestroying||Qs(t,{content:e,isFulfilled:!0}),e),e=>{throw t.isDestroyed||t.isDestroying||Qs(t,{reason:e,isRejected:!0}),e},"Ember: PromiseProxy")}(this,e)}}),then:wS("then"),catch:wS("catch"),finally:wS("finally")});function wS(t){return function(...e){return Ss(this,"promise")[t](...e)}}const xS=Object.freeze(Object.defineProperty({__proto__:null,default:bS},Symbol.toStringTag,{value:"Module"}));function SS(t,e,n){return t.lookup(`controller:${e}`,n)}let CS;!function(t){function e(){}t.isNamespace=!0,t.toString=function(){return"Ember"},t.Container=pl,t.Registry=Cl,t._setComponentManager=cS,t._componentManagerCapabilities=Ni,t._modifierManagerCapabilities=$i,t.meta=ae,t._createCache=qe,t._cacheGetValue=Ve,t._cacheIsConst=$e,t._descriptor=Sr,t._getPath=ks,t._setClassicDecorator=Ar,t._tracked=Is,t.beginPropertyChanges=os,t.changeProperties=ls,t.endPropertyChanges=as,t.hasListeners=Br,t.libraries=Rs,t._ContainerProxyMixin=Hl,t._ProxyMixin=Jl,t._RegistryProxyMixin=Gl,t.ActionHandler=Xl,t.Comparable=Kl,t.ComponentLookup=Qw,t.EventDispatcher=Qu,t._Cache=sr,t.GUID_KEY=Q,t.canInvoke=Ww,t.generateGuid=tt,t.guidFor=et,t.uuid=X,t.wrap=mt,t.getOwner=ax,t.onLoad=hl,t.runLoadHooks=dl,t.setOwner=lx,t.Application=cx,t.ApplicationInstance=$w,t.Namespace=Hw,t.A=id,t.Array=Qh,t.NativeArray=ed,t.isArray=Yh,t.makeArray=fu,t.MutableArray=td,t.ArrayProxy=mS,t.FEATURES={isEnabled:nS,...eS},t._Input=Bv,t.Component=Cb,t.Helper=Tb,t.Controller=ad,t.ControllerMixin=od,t._captureRenderTree=A,t.assert=y,t.warn=z,t.debug=D,t.deprecate=$,t.deprecateFunc=V,t.runInDebug=U,t.inspect=M,t.Debug={registerDeprecationHandler:_,registerWarnHandler:x,isComputed:gs},t.ContainerDebugAdapter=Jw,t.DataAdapter=pS,t._assertDestroyablesDestroyed=jt,t._associateDestroyableChild=Gt,t._enableDestroyableTracking=Dt,t._isDestroying=Xt,t._isDestroyed=Yt,t._registerDestructor=vx,t._unregisterDestructor=bx,t.destroy=Ht,t.Engine=rx,t.EngineInstance=dd,t.Enumerable=Ql,t.MutableEnumerable=tc,t.instrument=oh,t.subscribe=uh,t.Instrumentation={instrument:oh,subscribe:uh,unsubscribe:hh,reset:dh},t.Object=Tu,t._action=Mu,t.computed=ps,t.defineProperty=ms,t.get=Ss,t.getProperties=Js,t.notifyPropertyChange=ss,t.observer=Iu,t.set=Ls,t.trySet=Ds,t.setProperties=Qs,t.cacheFor=Fs,t._dependentKeyCompat=fd,t.ComputedProperty=us,t.expandProperties=Lr,t.CoreObject=xu,t.Evented=th,t.on=qr,t.addListener=jr,t.removeListener=Nr,t.sendEvent=Ur,t.Mixin=Bl,t.mixin=Nl,t.Observable=ku,t.addObserver=Wr,t.removeObserver=Hr,t.PromiseProxyMixin=bS,t.ObjectProxy=_S,t.RouterDSL=Ap,t.controllerFor=SS,t.generateController=dp,t.generateControllerFactory=hp,t.HashLocation=yf,t.HistoryLocation=bf,t.NoneLocation=wf,t.Route=Sp,t.Router=sf,t.run=ma,t.Service=Bf,t.compare=Dh,t.isBlank=iS,t.isEmpty=Sf,t.isEqual=sS,t.isNone=xf,t.isPresent=rS,t.typeOf=Fh,t.VERSION=or,t.ViewUtils={getChildViews:Wu,getElementView:Nu,getRootViews:Lu,getViewBounds:Ku,getViewBoundingClientRect:Zu,getViewClientRects:Yu,getViewElement:Uu,isSimpleClick:Au,isSerializationFirstNode:cv},t._getComponentTemplate=Ji,t._helperManagerCapabilities=_i,t._setComponentTemplate=Zi,t._setHelperManager=Ki,t._setModifierManager=Hi,t._templateOnlyComponent=zy,t._invokeHelper=p_,t._hash=u_,t._array=s_,t._concat=a_,t._get=c_,t._on=__,t._fn=l_,t._Backburner=ua,t.inject=e,e.controller=ld,e.service=Uf,t.__loader={get require(){return globalThis.require},get define(){return globalThis.define},get registry(){let t=globalThis;return t.requirejs?.entries??t.require.entries}}}(CS||(CS={})),Reflect.set(CS,"RSVP",hu),Object.defineProperty(CS,"ENV",{get:m,enumerable:!1}),Object.defineProperty(CS,"lookup",{get:p,set:f,enumerable:!1}),Object.defineProperty(CS,"onerror",{get:function(){return So},set:function(t){So=t},enumerable:!1}),Object.defineProperty(CS,"testing",{get:b,set:w,enumerable:!1}),Object.defineProperty(CS,"BOOTED",{configurable:!1,enumerable:!1,get:mo,set:yo}),Object.defineProperty(CS,"TEMPLATES",{get:lS,set:aS,configurable:!1,enumerable:!1}),Object.defineProperty(CS,"TEMPLATES",{get:lS,set:aS,configurable:!1,enumerable:!1}),Object.defineProperty(CS,"testing",{get:b,set:w,enumerable:!1}),dl("Ember.Application",cx);let kS={template:Qg,Utils:{}},ES={template:Qg};function TS(t){Object.defineProperty(CS,t,{configurable:!0,enumerable:!0,get:()=>"Handlebars"===t?kS:ES})}function RS(t){Object.defineProperty(CS,t,{configurable:!0,enumerable:!0,get(){}})}TS("HTMLBars"),TS("Handlebars"),RS("Test"),RS("setupForTesting"),dl("Ember"),new Proxy(CS,{get:(t,e,n)=>("string"==typeof e&&Nf(`importing ${e} from the 'ember' barrel file is deprecated.`,jf.DEPRECATE_IMPORT_EMBER(e)),Reflect.get(t,e,n)),getOwnPropertyDescriptor:(t,e)=>("string"==typeof e&&Nf(`importing ${e} from the 'ember' barrel file is deprecated.`,jf.DEPRECATE_IMPORT_EMBER(e)),Object.getOwnPropertyDescriptor(t,e))});const PS=new WeakMap;function MS(t,e,...n){if(t[e],t.isDestroying)return;"boolean"==typeof n[n.length-1]&&n[n.length-2];let i=PS.get(t);var r;let s;i||(i=new Map,PS.set(t,i),vx(t,(r=i,function(){0!==r.size&&r.forEach(t=>Sa(t.cancelId))}))),s=i.has(e)?i.get(e).debouncedTask:(...n)=>{i.delete(e),t[e](...n)};let o=Ca(t,s,...n);i.set(e,{debouncedTask:s,cancelId:o})}class IS extends Bf{rs;widget;static{Tx(this.prototype,"placesInView",[Is],function(){return[]})}#D=void Px(this,"placesInView");static{Tx(this.prototype,"savedPlaces",[Is],function(){return[]})}#j=void Px(this,"savedPlaces");static{Tx(this.prototype,"loadedPrefixes",[Is],function(){return[]})}#N=void Px(this,"loadedPrefixes");static{Tx(this.prototype,"currentBbox",[Is],function(){return null})}#U=void Px(this,"currentBbox");static{Tx(this.prototype,"version",[Is],function(){return 0})}#B=void Px(this,"version");static{Tx(this.prototype,"initialSyncDone",[Is],function(){return!1})}#q=void Px(this,"initialSyncDone");static{Tx(this.prototype,"connected",[Is],function(){return!1})}#V=void Px(this,"connected");static{Tx(this.prototype,"userAddress",[Is],function(){return null})}#$=void Px(this,"userAddress");static{Tx(this.prototype,"isWidgetOpen",[Is],function(){return!1})}#G=void Px(this,"isWidgetOpen");constructor(){super(...arguments),this.rs=new Ux({modules:[Xx]}),this.rs.access.claim("places","rw"),this.rs.caching.enable("/places/"),window.remoteStorage=this.rs,this.widget=new Jx(this.rs,{leaveOpen:!0,skipInitial:!0}),this.rs.on("ready",()=>{}),this.rs.on("connected",()=>{this.connected=!0,this.userAddress=this.rs.remote.userAddress}),this.rs.on("disconnected",()=>{this.connected=!1,this.userAddress=null,this.placesInView=[],this.savedPlaces=[],this.loadedPrefixes=[],this.initialSyncDone=!1}),this.rs.on("sync-done",()=>{this.initialSyncDone||(this.initialSyncDone=!0)}),this.rs.scope("/places/").on("change",t=>{this.handlePlaceChange(t),MS(this,"reloadCurrentView",200)})}handlePlaceChange(t){const{newValue:e,relativePath:n}=t,i=n.split("/"),r=i[i.length-1];if(e){const t={...e,id:r},n=this.savedPlaces.findIndex(t=>t.id===r);if(-1!==n){const e=[...this.savedPlaces];e[n]=t,this.savedPlaces=e}else this.savedPlaces=[...this.savedPlaces,t]}else this.savedPlaces=this.savedPlaces.filter(t=>t.id!==r)}get places(){return this.rs.places}notifyChange(){this.version++,MS(this,"reloadCurrentView",200)}reloadCurrentView(){if(!this.currentBbox)return;const t=Qx(this.currentBbox);console.debug("Reloading view due to changes, prefixes:",t),this.loadAllPlaces(t)}async loadPlacesInBounds(t){const e=Qx(t).filter(t=>!this.loadedPrefixes.includes(t));0!==e.length&&(console.debug("Loading new prefixes:",e),await this.loadAllPlaces(e),this.loadedPrefixes=[...this.loadedPrefixes,...e],this.currentBbox=t)}async loadAllPlaces(t=null){try{const e=await this.places.getPlaces(t);if(e&&Array.isArray(e))if(t){const n=new Set(t),i=this.placesInView.filter(t=>{if(!t.lat||!t.lon)return!1;try{const e=qx.encode(t.lat,t.lon,4);return!n.has(e)}catch{return!0}});this.placesInView=[...i,...e]}else this.placesInView=e;else t||(this.placesInView=[]);console.debug("Loaded saved places:",this.placesInView.length)}catch(e){console.error("Failed to load places:",e)}}findPlaceById(t){if(!t)return;const e=String(t);let n=this.savedPlaces.find(t=>t.id&&String(t.id)===e);return n||(n=this.savedPlaces.find(t=>t.osmId&&String(t.osmId)===e),n)}async storePlace(t){const e=await this.places.store(t);return this.savedPlaces.some(t=>t.id===e.id)?this.savedPlaces=this.savedPlaces.map(t=>t.id===e.id?e:t):this.savedPlaces=[...this.savedPlaces,e],this.placesInView.some(t=>t.id===e.id)?this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t):this.placesInView=[...this.placesInView,e],e}async updatePlace(t){const e=await this.places.store(t),n=this.savedPlaces.findIndex(t=>t.id===e.id);if(-1!==n){const t=[...this.savedPlaces];t[n]=e,this.savedPlaces=t}return this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t),e}async removePlace(t){await this.places.remove(t.id,t.geohash),this.savedPlaces=this.savedPlaces.filter(e=>e.id!==t.id),this.placesInView.length>0&&(this.placesInView=this.placesInView.filter(e=>e.id!==t.id))}connect(){this.isWidgetOpen=!0,document.querySelector(".rs-widget")||this.widget.attach("rs-widget-container")}static{Rx(this.prototype,"connect",[Mu])}closeWidget(){this.isWidgetOpen=!1}static{Rx(this.prototype,"closeWidget",[Mu])}disconnect(){this.rs.disconnect(),this.isWidgetOpen=!1}static{Rx(this.prototype,"disconnect",[Mu])}}const OS=Object.freeze(Object.defineProperty({__proto__:null,default:IS},Symbol.toStringTag,{value:"Module"}));function AS(t){return"string"==typeof t&&t?t.replace(/[_-]/g," ").replace(/\w\S*/g,t=>t.replace(/^\w/,t=>t.toUpperCase())):""}const FS=Object.freeze(Object.defineProperty({__proto__:null,humanizeOsmTag:AS},Symbol.toStringTag,{value:"Module"}));function LS(t,e,n,i){const r=t*Math.PI/180,s=n*Math.PI/180,o=(n-t)*Math.PI/180,a=(i-e)*Math.PI/180,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(s)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}const zS=Object.freeze(Object.defineProperty({__proto__:null,getDistance:LS},Symbol.toStringTag,{value:"Module"}));function DS(t,e,n){return(e="symbol"==typeof(i=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:String(i))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t;var i}function jS(t,e,n,i){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function NS(t,e,n,i){var r={};return Object.keys(i).forEach(function(t){r[t]=i[t]}),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),void 0===(r=n.slice().reverse().reduce(function(n,i){return i(t,e,n)||n},r)).initializer&&(Object.defineProperty(t,e,r),r=null),r}var US,BS,qS,VS,$S;const GS="undefined"!=typeof FastBoot,WS="routeDidChange",HS=["separator","prepend","replace"];let KS=(US=Uf("router"),BS=Uf("-document"),qS=class extends Bf{constructor(t){if(super(t),jS(this,"router",VS,this),jS(this,"document",$S,this),DS(this,"tokens",[]),DS(this,"_defaultConfig",{separator:" | ",prepend:!0,replace:null}),DS(this,"scheduleTitleUpdate",()=>{wa("afterRender",this,this._updateTitle)}),this._validateExistingTitleElement(),function(t){return"resolveRegistration"in t}(t)){const n=t.resolveRegistration("config:environment");"object"==typeof(e=n)&&null!==e&&"pageTitle"in e&&HS.forEach(t=>{if(!Sf(n.pageTitle[t])){const e=n.pageTitle[t];this._defaultConfig[t]=e}})}var e;this.router.on(WS,this.scheduleTitleUpdate)}applyTokenDefaults(t){const e=this._defaultConfig.separator,n=this._defaultConfig.prepend,i=this._defaultConfig.replace;t.previous??=null,t.next??=null,null==t.separator&&(t.separator=e),null==t.prepend&&null!=n&&(t.prepend=n),null==t.replace&&null!=i&&(t.replace=i)}inheritFromPrevious(t){const e=t.previous;e&&(null==t.separator&&(t.separator=e.separator),null==t.prepend&&(t.prepend=e.prepend))}push(t){const e=this._findTokenById(t.id);if(e){const n=this.tokens.indexOf(e),i=[...this.tokens],r=e.previous;return t.previous=r,t.next=e.next,this.inheritFromPrevious(t),this.applyTokenDefaults(t),i.splice(n,1,t),void(this.tokens=i)}const n=this.tokens.slice(-1)[0];n&&(t.previous=n??null,n.next=t,this.inheritFromPrevious(t)),this.applyTokenDefaults(t),this.tokens=[...this.tokens,t]}remove(t){const e=this._findTokenById(t);if(!e)return;const{next:n,previous:i}=e;n&&(n.previous=i),i&&(i.next=n),e.previous=e.next=null;const r=[...this.tokens];r.splice(r.indexOf(e),1),this.tokens=r}get visibleTokens(){const t=this.tokens;let e=t?t.length:0;const n=[];for(;e--;){const i=t[e];if(i){if(i.replace){n.unshift(i);break}n.unshift(i)}}return n}get sortedTokens(){const t=this.visibleTokens;if(!t)return[];let e=!0,n=[];const i=[n],r=[];return t.forEach(t=>{t.front?r.unshift(t):t.prepend?(e&&(e=!1,n=[],i.push(n)),n.unshift(t)):(e||(e=!0,n=[],i.push(n)),n.push(t))}),r.concat(i.reduce((t,e)=>t.concat(e),[]))}toString(){const t=this.sortedTokens,e=[];for(let n=0,i=t.length;ne.id===t)}updateFastbootTitle(t){if(!GS)return;const e=this.document.head,n=e.childNodes;for(let s=0;snew nC(t),iC);const rC=Object.freeze(Object.defineProperty({__proto__:null,default:iC},Symbol.toStringTag,{value:"Module"}));var sC,oC,aC;let lC=(sC=Uf("page-title"),aC=NS((oC=class extends Tb{constructor(t){super(t),jS(this,"tokens",aC,this),DS(this,"tokenId",et(this)),this.tokens.push({id:this.tokenId})}compute(t,e){const n={...e,id:this.tokenId,title:t.join("")};return this.tokens.push(n),this.tokens.scheduleTitleUpdate(),""}willDestroy(){super.willDestroy(),this.tokens.remove(this.tokenId),this.tokens.scheduleTitleUpdate()}}).prototype,"tokens",[sC],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),oC);const cC=Hi;class uC{capabilities=$i();constructor(t){this.owner=t}createModifier(t,e){return{instance:new t(this.owner,e),element:null}}installModifier(t,e,n){const i=function(t,e){const n=t;return n.element=e,n}(t,e);i.instance.modify(e,n.positional,n.named)}updateModifier(t,e){t.instance.modify(t.element,e.positional,e.named)}destroyModifier({instance:t}){Ht(t)}}cC(t=>new uC(t),class{constructor(t,e){lx(this,t)}modify(t,e,n){}});const hC=new class{capabilities=$i();createModifier(t){return{element:null,instance:t}}installModifier(t,e,n){const i=function(t,e){const n=t;return n.element=e,n}(t,e),{positional:r,named:s}=n,o=t.instance(e,r,s);"function"==typeof o&&(i.teardown=o)}updateModifier(t,e){"function"==typeof t.teardown&&t.teardown();const n=t.instance(t.element,e.positional,e.named);"function"==typeof n&&(t.teardown=n)}destroyModifier(t){"function"==typeof t.teardown&&t.teardown()}getDebugName(t){return t.instance.toString()}getDebugInstance(t){return t}};function dC(t){return t.toString=()=>t.name,cC(()=>hC,t)}const pC="add",fC="remove",gC="propertychange",mC="change",yC="contextmenu",_C="click",vC="keydown",bC="keypress",wC="touchmove",xC="wheel";class SC{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function CC(t,e){return t>e?1:te?-1:0}function EC(t,e,n){if(t[0]<=e)return 0;const i=t.length;if(e<=t[i-1])return i-1;if("function"==typeof n){for(let r=1;r0?r-1:r}return i-1}if(n>0){for(let n=1;n0)}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const i=n.indexOf(e);-1!==i&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[i]=OC,++this.pendingRemovals_[t]):(n.splice(i,1),0===n.length&&delete this.listeners_[t]))}}function NC(t,e,n,i,r){if(r){const r=n;n=function(s){return t.removeEventListener(e,n),r.call(i??this,s)}}else i&&i!==t&&(n=n.bind(i));const s={target:t,type:e,listener:n};return t.addEventListener(e,n),s}function UC(t,e,n,i){return NC(t,e,n,i,!0)}function BC(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),LC(t))}class qC extends jC{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(mC)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,i=new Array(n);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,n=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new XC(pC,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let n=0,i=e.length;n=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new XC(fC,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new XC(fC,n,t)),this.dispatchEvent(new XC(pC,e,t))}updateLength_(){this.set(KC,this.array_.length)}assertUnique_(t,e){const n=this.array_;for(let i=0,r=n.length;i{this.clickTimeoutId_=void 0;const e=new JC(QC.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==QC.POINTERUP||e.type==QC.POINTERCANCEL){delete this.trackedTouches_[n];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=QC.POINTERDOWN&&e.type!=QC.POINTERMOVE||(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new JC(QC.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(BC),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new JC(QC.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(NC(t,QC.POINTERMOVE,this.handlePointerMove_,this),NC(t,QC.POINTERUP,this.handlePointerUp_,this),NC(this.element_,QC.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(NC(this.element_.getRootNode(),QC.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new JC(QC.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new JC(QC.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(BC(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(wC,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(BC(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(BC),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const uk="postrender",hk="loadstart",dk="loadend",pk="layergroup",fk="size",gk="target",mk="view";function yk(t,e){if(!t)throw new Error(e)}const _k=1/0;class vk{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,LC(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const i=this.keyFunction_(n);return delete this.queuedElements_[i],n}enqueue(t){yk(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=_k&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,i=e.length,r=e[t],s=n[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(i[t]>s))break;n[e]=n[t],i[e]=i[t],e=t}n[e]=r,i[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let i=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(mC,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(2===n||3===n||4===n){3!==n&&e.removeEventListener(mC,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++n,t.load())}}}const wk={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function xk(t,e,n){return Math.min(Math.max(t,e),n)}function Sk(t,e,n,i,r,s){const o=r-n,a=s-i;if(0!==o||0!==a){const l=((t-n)*o+(e-i)*a)/(o*o+a*a);l>1?(n=r,i=s):l>0&&(n+=o*l,i+=a*l)}return Ck(t,e,n,i)}function Ck(t,e,n,i){const r=n-t,s=i-e;return r*r+s*s}function kk(t){return 180*t/Math.PI}function Ek(t){return t*Math.PI/180}function Tk(t,e){const n=t%e;return n*e<0?n+e:n}function Rk(t,e,n){return t+n*(e-t)}function Pk(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}function Mk(t,e){return Math.floor(Pk(t,e))}function Ik(t,e){return Math.ceil(Pk(t,e))}function Ok(t,e,n){if(t>=e&&tp&&(d=(p+d)/2,p=d),f>g&&(f=(g+f)/2,g=f);let m=xk(i[0],d,p),y=xk(i[1],f,g);if(o&&n&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-i[0])/t)+t*Math.log(1+Math.max(0,i[0]-p)/t),y+=-t*Math.log(1+Math.max(0,f-i[1])/t)+t*Math.log(1+Math.max(0,i[1]-g)/t)}return[m,y]}}function Fk(t){return t}function Lk(t){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,i=t.length;nr&&(l|=4),as&&(l|=2),0===l&&(l=1),l}function Vk(t,e,n,i,r){return r?(r[0]=t,r[1]=e,r[2]=n,r[3]=i,r):[t,e,n,i]}function $k(t){return Vk(1/0,1/0,-1/0,-1/0,t)}function Gk(t,e){const n=t[0],i=t[1];return Vk(n,i,n,i,e)}function Wk(t,e,n,i,r){return Yk($k(r),t,e,n,i)}function Hk(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Kk(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Xk(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Yk(t,e,n,i,r){for(;ne[0]?i[0]=t[0]:i[0]=e[0],t[1]>e[1]?i[1]=t[1]:i[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function dE(t){return t[2]1){const e=t[2]-t[0],n=t[3]-t[1];for(let s=0;s=n[2])){const e=uE(n),r=Math.floor((i[0]-n[0])/e)*e;t[0]-=r,t[2]-=r}return t}function gE(t,e,n){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];fE(t,e);const r=uE(i);if(uE(t)>r&&!n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-r,t[3]]]}return[t]}function mE(t,e){let n=!0;for(let i=t.length-1;i>=0;--i)if(t[i]!=e[i]){n=!1;break}return n}function yE(t,e){const n=Math.cos(e),i=Math.sin(e),r=t[0]*n-t[1]*i,s=t[1]*n+t[0]*i;return t[0]=r,t[1]=s,t}function _E(t,e){if(e.canWrapX()){const n=uE(e.getExtent()),i=function(t,e,n){const i=e.getExtent();let r=0;return e.canWrapX()&&(t[0]i[2])&&(n=n||uE(i),r=Math.floor((t[0]-i[0])/n)),r}(t,e,n);i&&(t[0]-=i*n)}return t}function vE(t){return Math.pow(t,3)}function bE(t){return 1-vE(1-t)}function wE(t){return 3*t*t-2*t*t*t}function xE(t){return t}const SE=6371008.8;function CE(t,e,n){n=n||SE;const i=Ek(t[1]),r=Ek(e[1]),s=(r-i)/2,o=Ek(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*n*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function kE(t,e,n,i){i=i||SE;const r=Ek(t[1]),s=Ek(t[0]),o=e/i,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(n));return[kk(s+Math.atan2(Math.sin(n)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a))),kk(a)]}function EE(...t){console.warn(...t)}const TE={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class RE{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||TE[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const PE=6378137,ME=Math.PI*PE,IE=[-ME,-ME,ME,ME],OE=[-180,-85,180,85],AE=PE*Math.log(Math.tan(Math.PI/2));class FE extends RE{constructor(t){super({code:t,units:"m",extent:IE,global:!0,worldExtent:OE,getPointResolution:function(t,e){return t/Math.cosh(e[1]/PE)}})}}const LE=[new FE("EPSG:3857"),new FE("EPSG:102100"),new FE("EPSG:102113"),new FE("EPSG:900913"),new FE("http://www.opengis.net/def/crs/EPSG/0/3857"),new FE("http://www.opengis.net/gml/srs/epsg.xml#3857")],zE=[-180,-90,180,90],DE=6378137*Math.PI/180;class jE extends RE{constructor(t,e){super({code:t,units:"degrees",extent:zE,axisOrientation:e,global:!0,metersPerUnit:DE,worldExtent:zE})}}const NE=[new jE("CRS:84"),new jE("EPSG:4326","neu"),new jE("urn:ogc:def:crs:OGC:1.3:CRS84"),new jE("urn:ogc:def:crs:OGC:2:84"),new jE("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new jE("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new jE("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let UE={},BE={};function qE(t,e,n){const i=t.getCode(),r=e.getCode();i in BE||(BE[i]={}),BE[i][r]=n}function VE(t,e){return t in BE&&e in BE[t]?BE[t][e]:null}const $E=.9996,GE=.00669438,WE=GE*GE,HE=WE*GE,KE=GE/(1-GE),XE=Math.sqrt(1-GE),YE=(1-XE)/(1+XE),ZE=YE*YE,JE=ZE*YE,QE=JE*YE,tT=QE*YE,eT=.9983242984503243,nT=15*WE/256+45*HE/1024,iT=35*HE/3072,rT=1.5*YE-27/32*JE+269/512*tT,sT=21/16*ZE-55/32*QE,oT=151/96*JE-417/128*tT,aT=1097/512*QE,lT=6378137;function cT(t,e,n){const i=t-5e5,r=(n.north?e:e-1e7)/$E/(lT*eT),s=r+rT*Math.sin(2*r)+sT*Math.sin(4*r)+oT*Math.sin(6*r)+aT*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),c=o/l,u=c*c,h=u*u,d=1-GE*a,p=Math.sqrt(1-GE*a),f=KE*l**2,g=f*f,m=i/(lT/p*$E),y=m*m,_=y*m,v=_*m,b=v*m,w=s-c/((1-GE)/d)*(y/2-v/24*(5+3*u+10*f-4*g-9*KE))+b*m/720*(61+90*u+298*f+45*h-252*KE-3*g);let x=(m-_/6*(1+2*u+f)+b/120*(5-2*f+28*u-3*g+8*KE+24*h))/l;return x=Ok(x+Ek(hT(n.number)),-Math.PI,Math.PI),[kk(x),kk(w)]}function uT(t,e,n){t=Ok(t,-180,180),e<-80?e=-80:e>84&&(e=84);const i=Ek(e),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,c=Ek(t),u=Ek(hT(n.number)),h=lT/Math.sqrt(1-GE*r**2),d=KE*s**2,p=s*Ok(c-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,y=m*p,_=y*p,v=lT*(eT*i-.002514607064228144*Math.sin(2*i)+nT*Math.sin(4*i)-iT*Math.sin(6*i)),b=$E*h*(p+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*KE))+5e5;let w=$E*(v+h*o*(f/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*KE)));return n.north||(w+=1e7),[b,w]}function hT(t){return 6*(t-1)-180+3}const dT=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pT(t){let e=0;for(const r of dT){const n=t.match(r);if(n){e=parseInt(n[1]);break}}if(!e)return null;let n=0,i=!1;return e>32700&&e<32761?n=e-32700:e>32600&&e<32661&&(i=!0,n=e-32600),n?{number:n,north:i}:null}function fT(t,e){return function(n,i,r,s){const o=n.length;r=r>1?r:2,s=s??r,i||(i=r>2?n.slice():new Array(o));for(let a=0;a180)&&(e[0]=Tk(n+180,360)-180),e}function RT(t,e){if(t===e)return!0;const n=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||PT(t,e)===vT)&&n}function PT(t,e){const n=t.getCode(),i=e.getCode();let r=VE(n,i);if(r)return r;let s=null,o=null;for(const l of gT)s||(s=l(t)),o||(o=l(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=MT(s.inverse,o.forward);else{const t=VE(n,a);t&&(r=MT(t,o.forward))}else{const t=VE(a,i);t&&(r=MT(s.inverse,t))}return r&&(wT(t),wT(e),qE(t,e,r)),r}function MT(t,e){return function(n,i,r,s){return i=t(n,i,r,s),e(i,i,r,s)}}function IT(t,e){return PT(xT(t),xT(e))}function OT(t,e,n){const i=IT(e,n);if(!i){const t=xT(e).getCode(),i=xT(n).getCode();throw new Error(`No transform available between ${t} and ${i}`)}return i(t,void 0,t.length)}function AT(t,e,n,i){return pE(t,IT(e,n),void 0,i)}function FT(t){return t}function LT(t){return yT&&!mE(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(yT=!1,EE("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function zT(t){return t}var DT,jT,NT;CT(LE),CT(NE),DT=LE,jT=function(t,e,n,i){const r=t.length;n=n>1?n:2,i=i??n,void 0===e&&(e=n>2?t.slice():new Array(r));for(let s=0;sAE?n=AE:n<-AE&&(n=-AE),e[s+1]=n}return e},NT=function(t,e,n,i){const r=t.length;n=n>1?n:2,i=i??n,void 0===e&&(e=n>2?t.slice():new Array(r));for(let s=0;s{if(!n)return this.getSimplifiedGeometry(e);const i=this.clone();return i.applyTransform(n),i.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return VC()}closestPointXY(t,e,n,i){return VC()}containsXY(t,e){return 0===this.closestPointXY(t,e,QT,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return VC()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&$k(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){VC()}scale(t,e,n){VC()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return VC()}getType(){return VC()}applyTransform(t){VC()}intersectsExtent(t){return VC()}translate(t,e){VC()}transform(t,e){const n=xT(t),i="tile-pixels"==n.getUnits()?function(t,i,r){const s=n.getExtent(),o=n.getWorldExtent(),a=oE(o)/oE(s);WT(JT,o[0],o[3],a,-a,0,0,0);const l=YT(t,0,t.length,r,JT,i),c=IT(n,e);return c?c(l,l,r):l}:IT(n,e);return this.applyTransform(i),this}}class eR extends tR{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Wk(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return VC()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)h=n;else{if(d>0){for(let r=0;rr&&(r=a),s=n,o=i}return r}function lR(t,e,n,i,r){for(let s=0,o=n.length;s0;){const n=c.pop(),s=c.pop();let o=0;const a=t[s],h=t[s+1],d=t[n],p=t[n+1];for(let e=s+i;eo&&(u=e,o=n)}o>r&&(l[(u-e)/i]=1,s+i0&&f>d)&&(p<0&&g0&&g>p)?(a=n,l=h):(s[o++]=a,s[o++]=l,c=a,u=l,a=n,l=h)}return s[o++]=a,s[o++]=l,o}function wR(t,e,n,i,r,s,o,a){for(let l=0,c=n.length;ls&&(n-a)*(s-l)-(r-a)*(i-l)>0&&o++:i<=s&&(n-a)*(s-l)-(r-a)*(i-l)<0&&o--,a=n,l=i}return 0!==o}function ER(t,e,n,i,r,s){if(0===n.length)return!1;if(!kR(t,e,n[0],i,r,s))return!1;for(let o=1,a=n.length;oy&&(c=(u+h)/2,ER(t,e,n,i,c,f)&&(m=c,y=r)),u=h}return isNaN(m)&&(m=r[s]),o?(o.push(m,f,y),o):[m,f,y]}function RR(t,e,n,i,r){let s=[];for(let o=0,a=n.length;o=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||PR(t,e,n,i,function(t,e){return function(t,e,n){let i=!1;const r=qk(t,e),s=qk(t,n);if(1===r||1===s)i=!0;else{const o=t[0],a=t[1],l=t[2],c=t[3],u=e[0],h=e[1],d=n[0],p=n[1],f=(p-h)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(p-c)/f,i=g>=o&&g<=l),i||!(4&s)||4&r||(m=p-(d-l)*f,i=m>=a&&m<=c),i||!(8&s)||8&r||(g=d-(p-a)/f,i=g>=o&&g<=l),i||!(16&s)||16&r||(m=p-(d-o)*f,i=m>=a&&m<=c)}return i}(r,t,e)}))}function IR(t,e,n,i,r){return!!(MR(t,e,n,i,r)||kR(t,e,n,i,r[0],r[1])||kR(t,e,n,i,r[0],r[3])||kR(t,e,n,i,r[2],r[1])||kR(t,e,n,i,r[2],r[3]))}function OR(t,e,n,i,r){if(!IR(t,e,n[0],i,r))return!1;if(1===n.length)return!0;for(let s=1,o=n.length;s0}function LR(t,e,n,i,r){r=void 0!==r&&r;for(let s=0,o=n.length;su&&d1&&"function"==typeof arguments[n-1]&&(e=arguments[n-1],--n);let i=0;for(;i0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,n=this.animations_.length;e=0;--n){const i=this.animations_[n];let r=!0;for(let n=0,s=i.length;n0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],n=s.targetCenter[0],i=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(n-t),o=e+l*(i-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(n,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Tk(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[n]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=i[0].callback;t&&KR(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const i=this.getCenterInternal();var r,s;return void 0!==i&&(n=[i[0]-e[0],i[1]-e[1]],yE(n,t-this.getRotation()),s=e,(r=n)[0]+=+s[0],r[1]+=+s[1]),n}calculateCenterZoom(t,e){let n;const i=this.getCenterInternal(),r=this.getResolution();return void 0!==i&&void 0!==r&&(n=[e[0]-t*(e[0]-i[0])/r,e[1]-t*(e[1]-i[1])/r]),n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],i=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(i*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(i*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?FT(t,this.getProjection()):t}getCenterInternal(){return this.get(wk.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return e=this.calculateExtentInternal(t),this.getProjection(),e;var e}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();yk(e,"The view center is not defined");const n=this.getResolution();yk(void 0!==n,"The view resolution is not defined");const i=this.getRotation();return yk(void 0!==i,"The view rotation is not defined"),rE(e,n,i,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(wk.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(zT(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=uE(t)/e[0],i=oE(t)/e[1];return Math.max(n,i)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(e/n)/Math.log(t);return function(n){return e/Math.pow(t,n*i)}}getRotation(){return this.get(wk.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(n/i)/e;return function(t){return Math.log(n/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let i=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();i=YR(i,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,n)}return{center:i.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,n,i=this.minZoom_||0;if(this.resolutions_){const r=EC(this.resolutions_,t,1);i=r,e=this.resolutions_[r],n=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,n=this.zoomFactor_;return i+Math.log(e/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=xk(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,xk(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(yk(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))yk(!dE(t),"Cannot fit empty extent provided as `geometry`"),n=BR(zT(t,this.getProjection()));else if("Circle"===t.getType()){const e=zT(t.getExtent(),this.getProjection());n=BR(e),n.rotate(this.getRotation(),nE(e))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),i=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,c=-1/0;for(let u=0,h=r.length;ut.trim().replace(/^['"]|['"]$/g,"")),n};function sP(t,e,n,i){let r;return r=n&&n.length?n.shift():rk?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",i)}let oP;function aP(){return oP||(oP=sP(1,1)),oP}function lP(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function cP(t){let e=t.offsetWidth;const n=getComputedStyle(t);return e+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),e}function uP(t){let e=t.offsetHeight;const n=getComputedStyle(t);return e+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),e}function hP(t,e){const n=e.parentNode;n&&n.replaceChild(t,e)}function dP(t){for(;t.lastChild;)t.lastChild.remove()}function pP(){const t=new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const n=this.childNodes.indexOf(e);if(-1===n)throw new Error("Reference node not found");return this.childNodes.splice(n,0,t),t},style:{}},{get:(t,e,n)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,n)});return t}function fP(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class gP extends HC{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,n=this.listenerKeys.length;ee.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>n.add(t)):n.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(n)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>FC(()=>t))),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!PC(e,this.renderedAttributions_)){dP(this.ulElement_);for(let t=0,n=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:bE}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const t="rotate("+n+"rad)";if(this.autoHide_){const t=this.element.classList.contains(ZR);t||0!==n?t&&0!==n&&this.element.classList.remove(ZR):this.element.classList.add(ZR)}this.label_.style.transform=t}this.rotation_=n}}class _P extends gP{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",n=void 0!==t.delta?t.delta:1,i=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=i,c.setAttribute("type","button"),c.title=a,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(_C,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(_C,this.handleClick_.bind(this,-n),!1);const h=e+" "+JR+" "+QR,d=this.element;d.className=h,d.appendChild(c),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const n=e.getZoom();if(void 0!==n){const i=e.getConstrainedZoom(n+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:i,duration:this.duration_,easing:bE})):e.setZoom(i)}}}function vP(t){t=t||{};const e=new YC;return(void 0===t.zoom||t.zoom)&&e.push(new _P(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new yP(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new mP(t.attributionOptions)),e}class bP{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[n+2]>t;)n-=3;const i=this.points_[e+2]-this.points_[n+2];if(i<1e3/60)return!1;const r=this.points_[e]-this.points_[n],s=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/i,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const wP="active";class xP extends HC{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(wP)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(wP,t)}setMap(t){this.map_=t}}function SP(t,e,n,i){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:n,duration:void 0!==i?i:250,easing:bE})}class CP extends xP{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==QC.DBLCLICK){const n=t.originalEvent,i=t.map,r=t.coordinate,s=n.shiftKey?-this.delta_:this.delta_;SP(i.getView(),s,r,this.duration_),n.preventDefault(),e=!0}return!e}}function kP(t){const e=arguments;return function(t){let n=!0;for(let i=0,r=e.length;i0}}else if(t.type==QC.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==QC.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function zP(t){const e=t.length;let n=0,i=0;for(let r=0;r0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class jP extends LP{constructor(t){t=t||{},super({stopDown:IC}),this.condition_=t.condition?t.condition:EP,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!AP(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===GR)return;const i=e.getSize(),r=t.pixel,s=Math.atan2(i[1]/2-r[1],r[0]-i[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;n.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!AP(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!(!AP(t)||!PP(t)||!this.condition_(t)||(t.map.getView().beginInteraction(),this.lastAngle_=void 0,0))}}class NP extends SC{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",i=this.element_.style;i.left=Math.min(t[0],e[0])+n,i.top=Math.min(t[1],e[1])+n,i.width=Math.abs(e[0]-t[0])+n,i.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new UR([n])}getGeometry(){return this.geometry_}}const UP="boxcancel";class BP extends DC{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class qP extends LP{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new NP(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??PP,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const i=n[0]-e[0],r=n[1]-e[1];return i*i+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new BP("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new BP(e?"boxend":UP,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new BP("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new BP(UP,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new BP(UP,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class VP extends qP{constructor(t){super({condition:(t=t||{}).condition?t.condition:IP,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let n=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(n),i=e.getResolutionForExtentInternal(t),r=e.getResolution()/i;n=n.clone(),n.scale(r*r)}e.fitInternal(n,{duration:this.duration_,easing:bE})}}const $P="ArrowLeft",GP="ArrowRight",WP="ArrowDown";class HP extends xP{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return MP(t)&&OP(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==vC){const n=t.originalEvent,i=n.key;if(this.condition_(t)&&(i==WP||i==$P||i==GP||"ArrowUp"==i)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;i==WP?a=-s:i==$P?o=-s:i==GP?o=s:a=s;const l=[o,a];yE(l,r.getRotation()),function(t,e,n){const i=t.getCenterInternal();if(i){const r=[i[0]+e[0],i[1]+e[1]];t.animateInternal({duration:void 0!==n?n:250,easing:xE,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class KP extends xP{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return nk?e.metaKey:e.ctrlKey}(t)&&OP(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==vC||t.type==bC){const n=t.originalEvent,i=n.key;if(this.condition_(t)&&("+"===i||"-"===i)){const r=t.map,s="+"===i?this.delta_:-this.delta_;SP(r.getView(),s,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}class XP extends xP{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:RP;this.condition_=t.onFocusOnly?kP(TP,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==xC)return!0;const e=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=40;break;case WheelEvent.DOM_DELTA_PAGE:i*=300}if(0===i)return!1;this.lastDelta_=i;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=i;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-xk(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),SP(e,n,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class YP extends LP{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=IC),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],i=this.targetPointers[1],r=Math.atan2(i.clientY-n.clientY,i.clientX-n.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==GR&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(zP(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2&&(t.map.getView().endInteraction(this.duration_),1))}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class ZP extends LP{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=IC),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],i=this.targetPointers[1],r=n.clientX-i.clientX,s=n.clientY-i.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(zP(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function JP(t){t=t||{};const e=new YC,n=new bP(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new jP),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new CP({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new DP({onFocusOnly:t.onFocusOnly,kinetic:n})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new YP),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new ZP({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new HP),e.push(new KP({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new XP({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new VP({duration:t.zoomDuration})),e}const QP="opacity",tM="visible",eM="extent",nM="zIndex",iM="maxResolution",rM="minResolution",sM="maxZoom",oM="minZoom",aM="source";class lM extends HC{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[QP]=void 0!==t.opacity?t.opacity:1,yk("number"==typeof e[QP],"Layer opacity must be a number"),e[tM]=void 0===t.visible||t.visible,e[nM]=t.zIndex,e[iM]=void 0!==t.maxResolution?t.maxResolution:1/0,e[rM]=void 0!==t.minResolution?t.minResolution:0,e[oM]=void 0!==t.minZoom?t.minZoom:-1/0,e[sM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},n=this.getZIndex();return e.opacity=xk(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==n||e.managed?n:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return VC()}getLayerStatesArray(t){return VC()}getExtent(){return this.get(eM)}getMaxResolution(){return this.get(iM)}getMinResolution(){return this.get(rM)}getMinZoom(){return this.get(oM)}getMaxZoom(){return this.get(sM)}getOpacity(){return this.get(QP)}getSourceState(){return VC()}getVisible(){return this.get(tM)}getZIndex(){return this.get(nM)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(eM,t)}setMaxResolution(t){this.set(iM,t)}setMinResolution(t){this.set(rM,t)}setMaxZoom(t){this.set(sM,t)}setMinZoom(t){this.set(oM,t)}setOpacity(t){yk("number"==typeof t,"Layer opacity must be a number"),this.set(QP,t)}setVisible(t){this.set(tM,t)}setZIndex(t){this.set(nM,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const cM="addlayer",uM="removelayer";class hM extends DC{constructor(t,e){super(t),this.layer=e}}const dM="layers";class pM extends lM{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(dM,this.handleLayersChanged_),n?Array.isArray(n)?n=new YC(n.slice(),{unique:!0}):yk("function"==typeof n.getArray,"Expected `layers` to be an array or a `Collection`"):n=new YC(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(BC),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(NC(t,pC,this.handleLayersAdd_,this),NC(t,fC,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(BC);LC(this.listenerKeys_);const e=t.getArray();for(let n=0,i=e.length;n{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const n=this.getMapInternal();let i;if(!t&&n&&(t=n.getView()),e=t instanceof HR?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(i=e.layerStatesArray.find(t=>t.layer===this),!i)return!1}else i=this.getLayerState();const r=this.getExtent();return vM(i,e.viewState)&&(!r||hE(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let n=e(t instanceof HR?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(BC(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(BC(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=NC(t,mM,this.handlePrecompose_,this),this.mapRenderKey_=NC(this,mC,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,n=this.getLayerState(!1);yk(!e.some(t=>t.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(n)}setSource(t){this.set(aM,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function vM(t,e){if(!t.visible)return!1;const n=e.resolution;if(n=t.maxResolution)return!1;const i=e.zoom;return i>t.minZoom&&i<=t.maxZoom}function bM(t,e,n=0,i=t.length-1,r=xM){for(;i>n;){if(i-n>600){const s=i-n+1,o=e-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);bM(t,e,Math.max(n,Math.floor(e-o*l/s+c)),Math.min(i,Math.floor(e+(s-o)*l/s+c)),r)}const s=t[e];let o=n,a=i;for(wM(t,n,e),r(t[i],s)>0&&wM(t,n,i);o0;)a--}0===r(t[n],s)?wM(t,n,a):(a++,wM(t,a,i)),a<=e&&(n=a+1),e<=a&&(i=a-1)}}function wM(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function xM(t,e){return te?1:0}let SM=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!LM(t,e))return n;const i=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(i,r,e)}_split(t,e){const n=t[e],i=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,i);const s=this._chooseSplitIndex(n,r,i),o=zM(n.children.splice(s,n.children.length-s));o.height=n.height,o.leaf=n.leaf,kM(n,this.toBBox),kM(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(n,o)}_splitRoot(t,e){this.data=zM([t,e]),this.data.height=t.height+1,this.data.leaf=!1,kM(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let i,r=1/0,s=1/0;for(let o=e;o<=n-e;o++){const e=EM(t,0,o,this.toBBox),a=EM(t,o,n,this.toBBox),l=AM(e,a),c=MM(e)+MM(a);l=e;l--){const e=t.children[l];TM(o,t.leaf?r(e):e),a+=IM(o)}return a}_adjustParentBBoxes(t,e,n){for(let i=n;i>=0;i--)TM(e[i],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():kM(t[n],this.toBBox)}};function CM(t,e,n){if(!n)return e.indexOf(t);for(let i=0;i=t.minX&&e.maxY>=t.minY}function zM(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function DM(t,e,n,i,r){const s=[e,n];for(;s.length;){if((n=s.pop())-(e=s.pop())<=i)continue;const o=e+Math.ceil((n-e)/i/2)*i;bM(t,o,e,n,r),s.push(e,o,o,n)}}const jM=[NaN,NaN,NaN,0];let NM;const UM=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,BM=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,qM=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,VM=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function $M(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function GM(t){throw new Error('failed to parse "'+t+'" as color')}function WM(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(BM)||t.match(UM)||t.match(qM);if(e){const t=e[4],n=100/255;return[xk($M(e[1],n)+.5|0,0,255),xk($M(e[2],n)+.5|0,0,255),xk($M(e[3],n)+.5|0,0,255),void 0!==t?xk($M(t,100),0,1):1]}GM(t)}if(t.startsWith("#")){if(VM.test(t)){const e=t.substring(1),n=e.length<=4?1:2,i=[0,0,0,255];for(let t=0,r=e.length;t.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function ZM(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function JM(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function QM(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function tI(t){const e=JM(t[0]),n=JM(t[1]),i=JM(t[2]),r=QM(.222488403*e+.716873169*n+.06060791*i),s=500*(QM(.452247074*e+.399439023*n+.148375274*i)-r),o=200*(r-QM(.016863605*e+.117638439*n+.865350722*i)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function eI(t){if("none"===t)return jM;if(HM.hasOwnProperty(t))return HM[t];if(KM>=1024){let t=0;for(const e in HM)3&t++||(delete HM[e],--KM)}const e=WM(t);4!==e.length&&GM(t);for(const n of e)isNaN(n)&&GM(t);return HM[t]=e,++KM,e}function nI(t){return Array.isArray(t)?t:eI(t)}function iI(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let n=t[1];n!=(0|n)&&(n=n+.5|0);let i=t[2];return i!=(0|i)&&(i=i+.5|0),"rgba("+e+","+n+","+i+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function rI(t){return t[0]>0&&t[1]>0}function sI(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let oI=0;const aI=1<e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${i}, got ${r}`)}}function wO(t,e,n){const i=t.length-1,r=new Array(i);for(let s=0;s{for(let e=0;e{for(let r=0;r{const i=t.args;let r=n.properties[e];for(let t=1,e=i.length;tt.variables[e];case gO:return n=>{const i=t.args;if(!(e in n.properties))return!1;let r=n.properties[e];for(let t=1,e=i.length;tt.featureId;case EI:return t=>t.geometryType;case kI:{const e=t.args.map(t=>TO(t));return t=>"".concat(...e.map(e=>e(t).toString()))}case II:return t=>t.resolution;case RI:case PI:case nO:case oO:case"!":return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{for(let e=0;e{for(let e=0;e{const e=i[0](t),n=i[1](t),r=i[2](t);return e>=n&&e<=r};case oO:return t=>{const e=i[0](t);for(let r=1;r!i[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case FI:case LI:case"<":case NI:case">":case DI:return function(t){const e=t.operator,n=TO(t.args[0]),i=TO(t.args[1]);switch(e){case FI:return t=>n(t)===i(t);case LI:return t=>n(t)!==i(t);case"<":return t=>n(t)n(t)<=i(t);case">":return t=>n(t)>i(t);case DI:return t=>n(t)>=i(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case"*":case"/":case"+":case"-":case $I:case"%":case"^":case HI:case KI:case XI:case YI:case ZI:case JI:case QI:case tO:return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{let e=1;for(let r=0;ri[0](t)/i[1](t);case"+":return t=>{let e=0;for(let r=0;ri[0](t)-i[1](t);case $I:return t=>{const e=i[0](t),n=i[1](t);if(er?r:e};case"%":return t=>i[0](t)%i[1](t);case"^":return t=>Math.pow(i[0](t),i[1](t));case HI:return t=>Math.abs(i[0](t));case KI:return t=>Math.floor(i[0](t));case XI:return t=>Math.ceil(i[0](t));case YI:return t=>Math.round(i[0](t));case ZI:return t=>Math.sin(i[0](t));case JI:return t=>Math.cos(i[0](t));case QI:return 2===n?t=>Math.atan2(i[0](t),i[1](t)):t=>Math.atan(i[0](t));case tO:return t=>Math.sqrt(i[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case sO:return function(t){const e=t.args.length,n=new Array(e);for(let i=0;i{for(let i=0;i{const i=n[0](t);for(let r=1;r{const i=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:c?PO(i,r,s,o,e,l):RO(i,r,s,o,e,l);s=e,o=l}return o}}(t);case fO:return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{const n=i[0](e);return t.args[0].type===uI?iI(n):n.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${e}`)}}function RO(t,e,n,i,r,s){const o=r-n;if(0===o)return i;const a=e-n;return i+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-i)}function PO(t,e,n,i,r,s){if(0===r-n)return i;const o=tI(i),a=tI(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,n=t[1],i=t[2]*Math.PI/180,r=ZM(e),s=ZM(e+n/500*Math.cos(i)),o=ZM(e-n/200*Math.sin(i)),a=YM(3.021973625*s-1.617392459*r-.404875592*o),l=YM(-.943766287*s+1.916279586*r+.027607165*o),c=YM(.069407491*s-.22898585*r+1.159737864*o);return[xk(a+.5|0,0,255),xk(l+.5|0,0,255),xk(c+.5|0,0,255),t[3]]}([RO(t,e,n,o[0],r,a[0]),RO(t,e,n,o[1],r,a[1]),o[2]+RO(t,e,n,0,r,l),RO(t,e,n,i[3],r,s[3])])}class MO extends jC{constructor(t,e,n,i){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state="function"==typeof i?0:i,this.image_=null,this.loader="function"==typeof i?i:null}changed(){this.dispatchEvent(mC)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(0==this.state&&this.loader){this.state=1,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;FC(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||ok&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=2}).catch(t=>{this.state=3,console.error(t)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function IO(t,e,n){return e+":"+t+":"+(n?nI(n):"null")}const OO=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const n=this.cache_[e];3&t++||n.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,n){const i=IO(t,e,n);return i in this.cache_?this.cache_[i]:null}getPattern(t,e,n){const i=IO(t,e,n);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,n,i,r){const s=IO(t,e,n),o=s in this.cache_;this.cache_[s]=i,r&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[s]=aP().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=aP().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let AO=null;class FO extends jC{constructor(t,e,n,i,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=r,this.imageState_=void 0===i?0:i,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){AO||(AO=sP(1,1,void 0,{willReadFrequently:!0})),AO.drawImage(this.image_,0,0);try{AO.getImageData(0,0,1,1),this.tainted_=!1}catch{AO=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(mC)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=sP(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&sk?new Promise((e,n)=>t.decode().then(()=>e(t)).catch(i=>t.complete&&t.width?e(t):n(i))):function(t){return new Promise((e,n)=>{function i(){s(),e(t)}function r(){s(),n(new Error("Image load error"))}function s(){t.removeEventListener("load",i),t.removeEventListener("error",r)}t.addEventListener("load",i),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,n=sP(Math.ceil(e.width*t),Math.ceil(e.height*t)),i=n.canvas;var r;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle="string"==typeof(r=this.color_)?r:iI(r),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(mC,e),t())};this.addEventListener(mC,e)}})),this.ready_}}function LO(t,e,n,i,r,s){let o=void 0===e?void 0:OO.get(e,n,r);return o||(o=new FO(t,t&&"src"in t?t.src||void 0:e,n,i,r),OO.set(e,n,r,o,s)),s&&o&&!OO.getPattern(e,n,r)&&OO.set(e,n,r,o,s),o}function zO(t){return t?Array.isArray(t)?iI(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return OO.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,n=OO.getPattern(e,void 0,t.color);if(n)return n;const i=OO.get(t.src,"anonymous",null);if(2!==i.getImageState())return null;const r=sP(t.size[0],t.size[1]);return r.drawImage(i.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),LO(r.canvas,e,void 0,2,t.color,!0),OO.getPattern(e,void 0,t.color)}(t):t:null}const DO="10px sans-serif",jO="#000",NO="round",UO=[],BO="round",qO="#000",VO="center",$O="middle",GO=[0,0,0,0],WO=new HC;let HO,KO=null;const XO={},YO=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function ZO(t,e,n){return`${t} ${e} 16px "${n}"`}const JO=function(){const t=100;let e,n;async function i(t){await n.ready;const e=await n.load(t);if(0===e.length)return!1;const i=rP(t),r=i.families[0].toLowerCase(),s=i.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),n=iP[t.weight]||t.weight;return e===r&&t.style===i.style&&n==s})}async function r(){await n.ready;let s=!0;const o=WO.getProperties(),a=Object.keys(o).filter(e=>o[e]=0;--e){const n=a[e];let r=o[n];rMath.max(e,eA(t,n)),0);return n[e]=i,i}class iA{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=sI(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new iA({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return VC()}getImage(t){return VC()}getHitDetectionImage(){return VC()}getPixelRatio(t){return 1}getImageState(){return VC()}getImageSize(){return VC()}getOrigin(){return VC()}getSize(){return VC()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=sI(t)}listenImageChange(t){VC()}load(){VC()}unlistenImageChange(t){VC()}ready(){return Promise.resolve()}}class rA extends iA{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new rA({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let i=OO.get(n,null,null)?.getImage(1);if(!i){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=sP(r,r);this.draw_(e,s,t),i=s.canvas,OO.set(n,null,null,new FO(i,void 0,null,2,null))}return i}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let i=this.radius,r=void 0===this.radius2_?i:this.radius2_;if(i{this.patternImage_=null}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?GC(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:nI(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function aA(t,e,n,i){return void 0!==n&&void 0!==i?[n/t,i/e]:void 0!==n?n/t:void 0!==i?i/e:1}class lA extends iA{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,i=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:i,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(yk(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||GC(s)),yk(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),yk(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?nI(t.color):null,this.iconImage_=LO(s,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,n;if(t.size)[e,n]=t.size;else{const i=this.getImage(1);if(i.width&&i.height)e=i.width,n=i.height;else if(i instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const n=this.iconImage_.getSize();this.setScale(aA(n[0],n[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(aA(e,n,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new lA({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:n,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=n[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=LO(null,t,this.crossOrigin_,0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(mC,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(mC,t)}ready(){return this.iconImage_.ready()}}class cA{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new cA({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class uA{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=pA,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new uA({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=pA,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let hA=null;function dA(){if(!hA){const t=new oA({color:"rgba(255,255,255,0.4)"}),e=new cA({color:"#3399CC",width:1.25});hA=[new uA({image:new sA({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return hA}function pA(t){return t.getGeometry()}let fA=class t{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=sI(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new oA({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof oA?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=sI(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};function gA(){return!0}function mA(t){const e=wI(),n=function(t,e){const n=t.length,i=new Array(n);for(let r=0;rnull;i=CA(t,e+"fill-color",n)}if(!i)return null;const r=new oA;return function(t){const e=i(t);return e===jM?null:(r.setColor(e),r)}}function bA(t,e,n){const i=wA(t,e+"stroke-width",n),r=CA(t,e+"stroke-color",n);if(!i&&!r)return null;const s=xA(t,e+"stroke-line-cap",n),o=xA(t,e+"stroke-line-join",n),a=kA(t,e+"stroke-line-dash",n),l=wA(t,e+"stroke-line-dash-offset",n),c=wA(t,e+"stroke-miter-limit",n),u=new cA;return function(t){if(r){const e=r(t);if(e===jM)return null;u.setColor(e)}if(i&&u.setWidth(i(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),c&&u.setMiterLimit(c(t)),u}}function wA(t,e,n){if(!(e in t))return;const i=EO(t[e],lI,n);return function(t){return LA(i(t),e)}}function xA(t,e,n){if(!(e in t))return null;const i=EO(t[e],cI,n);return function(t){return FA(i(t),e)}}function SA(t,e,n){if(!(e in t))return null;const i=EO(t[e],aI,n);return function(t){const n=i(t);if("boolean"!=typeof n)throw new Error(`Expected a boolean for ${e}`);return n}}function CA(t,e,n){if(!(e in t))return null;const i=EO(t[e],uI,n);return function(t){return zA(i(t),e)}}function kA(t,e,n){if(!(e in t))return null;const i=EO(t[e],hI,n);return function(t){return AA(i(t),e)}}function EA(t,e,n){if(!(e in t))return null;const i=EO(t[e],hI,n);return function(t){const n=AA(i(t),e);if(2!==n.length)throw new Error(`Expected two numbers for ${e}`);return n}}function TA(t,e,n){if(!(e in t))return null;const i=EO(t[e],hI,n);return function(t){return DA(i(t),e)}}function RA(t,e,n){if(!(e in t))return null;const i=EO(t[e],hI|lI,n);return function(t){return function(t,e){return"number"==typeof t?t:DA(t,e)}(i(t),e)}}function PA(t,e){const n=t[e];if(void 0!==n){if("number"!=typeof n)throw new Error(`Expected a number for ${e}`);return n}}function MA(t,e){const n=t[e];if(void 0!==n){if("bottom-left"!==n&&"bottom-right"!==n&&"top-left"!==n&&"top-right"!==n)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return n}}function IA(t,e){const n=t[e];if(void 0!==n){if("pixels"!==n&&"fraction"!==n)throw new Error(`Expected pixels or fraction for ${e}`);return n}}function OA(t,e){const n=t[e];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${e}`);if("declutter"!==n&&"obstacle"!==n&&"none"!==n)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return n}}function AA(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const n=t.length;for(let i=0;i4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return n}function DA(t,e){const n=AA(t,e);if(2!==n.length)throw new Error(`Expected an array of two numbers for ${e}`);return n}const jA="renderOrder";class NA extends _M{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(jA)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter==0&&(t.declutter[n]=new SM(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(jA,t)}setStyle(t){this.style_=void 0===t?dA:t;const e=function(t){if(void 0===t)return dA;if(!t)return null;if("function"==typeof t)return t;if(t instanceof uA)return t;if(!Array.isArray(t))return yA([t]);if(0===t.length)return[];const e=t.length,n=t[0];if(n instanceof uA){const n=new Array(e);for(let i=0;i=0;--i){const r=f[i],s=r.layer;if(s.hasRenderer()&&vM(r,c)&&o.call(a,s)){const i=s.getRenderer(),o=s.getSource();if(i&&o){const s=o.getWrapX()?d:t,a=u.bind(null,r.managed);y[0]=s[0]+p[v][0],y[1]=s[1]+p[v][1],l=i.forEachFeatureAtCoordinate(y,e,n,a,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,n,i,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,n,i,MC,this,r,s)}getMap(){return this.map_}renderFrame(t){VC()}scheduleExpireIconCache(t){OO.canExpireCache()&&t.postRenderFunctions.push(qA)}}function qA(){OO.expire()}class VA extends BA{constructor(t){super(t),this.fontChangeListenerKey_=NC(WO,gC,t.redrawText,t),this.element_=rk?pP():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=JR+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const i=new UA(t,void 0,e);n.dispatchEvent(i)}}disposeInternal(){BC(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(mM,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof NA&&t.layer.getDeclutter())&&(t.declutter={});const n=t.viewState;this.children_.length=0;const i=[];let r=null;for(let o=0,a=e.length;o0)&&(t.fillStyle=i,t.fillRect(0,0,s.width,s.height)),fP(n)&&n.width>0){const i=e.style.opacity||n.style.opacity;t.globalAlpha=""===i?1:Number(i);const r=n.style.transform;if(r)t.setTransform(...XT(r));else{const e=parseFloat(n.style.width)/n.width,i=parseFloat(n.style.height)/n.height;t.setTransform(e,0,0,i,0,0)}t.drawImage(n,0,0)}}t.globalAlpha=1,t.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let n=e.length-1;n>=0;--n){const i=e[n],r=i.layer;r.getDeclutter()&&r.renderDeclutter(t,i)}e.forEach(e=>e.layer.renderDeferred(t))}}}function $A(t){t instanceof _M?t.setMapInternal(null):t instanceof pM&&t.getLayers().forEach($A)}function GA(t,e){if(t instanceof _M)t.setMapInternal(e);else if(t instanceof pM){const n=t.getLayers().getArray();for(let t=0,i=n.length;tthis.updateSize())),this.controls=e.controls||(rk?new YC:vP()),this.interactions=e.interactions||(rk?new YC:JP({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new bk(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(pk,this.handleLayerGroupChanged_),this.addChangeListener(mk,this.handleViewChanged_),this.addChangeListener(fk,this.handleSizeChanged_),this.addChangeListener(gk,this.handleTargetChanged_),this.setProperties(e.values);const n=this;!t.view||t.view instanceof HR||t.view.then(function(t){n.setView(new HR(t))}),this.controls.addEventListener(pC,t=>{t.element.setMap(this)}),this.controls.addEventListener(fC,t=>{t.element.setMap(null)}),this.interactions.addEventListener(pC,t=>{t.element.setMap(this)}),this.interactions.addEventListener(fC,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(pC,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(fC,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){GA(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const i=this.getCoordinateFromPixelInternal(t),r=void 0!==(n=void 0!==n?n:{}).hitTolerance?n.hitTolerance:0,s=void 0!==n.layerFilter?n.layerFilter:MC,o=!1!==n.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(i,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(t){n.push(t)},e),n}getAllLayers(){const t=[];return function e(n){n.forEach(function(n){n instanceof pM?e(n.getLayers()):t.push(n)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t),i=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:MC,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,s,i,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),n=this.getSize(),i=e.width/n[0],r=e.height/n[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/i,(s.clientY-e.top)/r]}getTarget(){return this.get(gk)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return FT(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?$T(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(pk)}setLayers(t){const e=this.getLayerGroup();if(t instanceof YC)return void e.setLayers(t);const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e=0;n--){const i=e[n];if(i.getMap()===this&&i.getActive()&&this.getTargetElement()&&(!i.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let n=this.maxTilesLoading_,i=n;if(t){const e=t.viewHints;if(e[0]||e[1]){const e=Date.now()-t.time>8;n=e?0:8,i=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new hM("removelayer",e)),this.set(pk,t)}setSize(t){this.set(fk,t)}setTarget(t){this.set(gk,t)}setView(t){if(!t||t instanceof HR)return void this.set(mk,t);this.set(mk,new HR);const e=this;t.then(function(t){e.setView(new HR(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let n,i;if(fP(t))n=t.width,i=t.height;else{const e=getComputedStyle(t);n=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),i=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(n)||isNaN(i)||(e=[Math.max(0,n),Math.max(0,i)],!rI(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&EE("No map visible because the map container's width or height are 0."))}const n=this.getSize();!e||n&&PC(e,n)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const HA="element",KA="map",XA="offset",YA="position",ZA="positioning";class JA extends HC{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(HA,this.handleElementChanged),this.addChangeListener(KA,this.handleMapChanged),this.addChangeListener(XA,this.handleOffsetChanged),this.addChangeListener(YA,this.handlePositionChanged),this.addChangeListener(ZA,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(HA)}getId(){return this.id}getMap(){return this.get(KA)||null}getOffset(){return this.get(XA)}getPosition(){return this.get(YA)}getPositioning(){return this.get(ZA)}handleElementChanged(){dP(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),BC(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=NC(t,uk,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(HA,t)}setMap(t){this.set(KA,t)}setOffset(t){this.set(XA,t)}setPosition(t){this.set(YA,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(YA))return;const n=this.getRect(e.getTargetElement(),e.getSize()),i=this.getElement(),r=this.getRect(i,[cP(i),uP(i)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!Uk(n,r)){const i=r[0]-n[0],o=n[2]-r[2],a=r[1]-n[1],l=n[3]-r[3],c=[0,0];if(i<0?c[0]=i-s:o<0&&(c[0]=Math.abs(o)+s),a<0?c[1]=a-s:l<0&&(c[1]=Math.abs(l)+s),0!==c[0]||0!==c[1]){const n=e.getView().getCenterInternal(),i=e.getPixelFromCoordinateInternal(n);if(!i)return;const r=[i[0]+c[0],i[1]+c[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const n=t.getBoundingClientRect(),i=n.left+window.pageXOffset,r=n.top+window.pageYOffset;return[i,r,i+e[0],r+e[1]]}setPositioning(t){this.set(ZA,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const n=t.getPixelFromCoordinate(e),i=t.getSize();this.updateRenderedPosition(n,i)}updateRenderedPosition(t,e){const n=this.element.style,i=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${o}) translate(${t[0]+i[0]}px, ${t[1]+i[1]}px)`;this.rendered.transform_!=a&&(this.rendered.transform_=a,n.transform=a)}getOptions(){return this.options}}class QA extends HC{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new QA(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(BC(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=NC(t,mC,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(yk("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function tF(t,e,n,i,r,s,o){let a,l;const c=(n-e)/i;if(1===c)a=e;else if(2===c)a=e,l=r;else if(0!==c){let s=t[e],o=t[e+1],c=0;const u=[0];for(let r=e+i;r>1),r=+n(t[i],e),r<0?s=i+1:(o=i,a=!r);return a?s:~s}(u,h);d<0?(l=(h-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*i):a=e+d*i}o=o>1?o:2,s=s||new Array(o);for(let u=0;u>1;ra&&(this.instructions.push([4,a,c,t,n,fR,r]),this.hitDetectionInstructions.push([4,a,c,t,i||n,fR,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),c=this.coordinates.length,this.instructions.push([4,a,c,t,n,void 0,r]),this.hitDetectionInstructions.push([4,a,c,t,i||n,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[0,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const n=t.length;let i,r,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const n=this.state;this.fillStyleToState(t,n),this.strokeStyleToState(e,n)}createFill(t){const e=t.fillStyle,n=[10,e];return"string"!=typeof e&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[cF,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;"string"==typeof n&&t.currentFillStyle==n||(this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,i=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=i||r!=t.currentLineDash&&!PC(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=i,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[7,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Dk(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;zk(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class gF extends fF{constructor(t,e,n,i){super(t,e,n,i)}drawFlatCoordinatess_(t,e,n,i){const r=this.state,s=void 0!==r.fillStyle,o=void 0!==r.strokeStyle,a=n.length;this.instructions.push(dF),this.hitDetectionInstructions.push(dF);for(let l=0;l=t){const e=(t-a+h)/h,d=Rk(n,c,e),p=Rk(i,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function yF(t,e,n,i,r){let s,o,a,l,c,u,h,d,p,f,g=n,m=n,y=0,_=0,v=n;for(o=n;ot&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,h=p,d=f),c=n,u=i}return _+=l,_>y?[v,o]:[g,m]}const _F={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},vF={Circle:gF,Default:fF,Image:class extends fF{constructor(t,e,n,i){super(t,e,n,i),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,n){if(!this.image_||this.maxExtent&&!Nk(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const i=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,r);this.instructions.push([6,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([6,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,n){if(!this.image_)return;this.beginGeometry(t,e,n);const i=t.getFlatCoordinates(),r=[];for(let a=0,l=i.length;a{const i=o[2*(t+n)]===c[n*u]&&o[2*(t+n)+1]===c[n*u+1];return i||--t,i})}this.saveTextStates_();const h=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,n);let p=s.padding;if(p!=GO&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],n=s.padding[2],i=s.padding[3];s.scale[0]<0&&(e=-e,i=-i),s.scale[1]<0&&(t=-t,n=-n),p=[t,e,n,i]}const f=this.pixelRatio;this.instructions.push([6,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==GO?GO:p.map(function(t){return t*f}),h,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const g=1/f,m=h?h.slice(0):null;m&&(m[1]=jO),this.hitDetectionInstructions.push([6,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,p,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?jO:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),this.endGeometry(e)}else{if(!hE(this.maxExtent,t.getExtent()))return;let i;if(c=t.getFlatCoordinates(),"LineString"==l)i=[c.length];else if("MultiLineString"==l)i=t.getEnds();else if("Polygon"==l)i=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else R=w>E;const P=Math.PI,M=[],I=S+i===e;let O;if(y=0,_=C,p=t[e=S],f=t[e+1],I){v(),O=Math.atan2(f-m,p-g),R&&(O+=O>0?-P:P);const t=(E+w)/2,e=(T+x)/2;return M[0]=[t,e,(k-s)/2,O,r],M}for(let A=0,F=(r=r.replace(/\n/g," ")).length;A0?-P:P),void 0!==O){let e=t-O;if(e+=e>P?-2*P:e<-P?2*P:0,Math.abs(e)>o)return null}O=t;const h=A;let d=0;for(;A{if("function"==typeof aP()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,n)=>(this.push_(e,n),!0)})}push_(...t){const e=this.instructions_,n=this.zIndex+this.offset_;e[n]||(e[n]=[]),e[n].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,i=e.length;n0&&t.push("\n",""),t.push(e,""),t}function OF(t,e,n){return n%2==0&&(t+=e),t}class AF{constructor(t,e,n,i,r){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=i.instructions,this.coordinates=i.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=i.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=i.fillStates||{},this.strokeStates=i.strokeStates||{},this.textStates=i.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new xF:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,i){const r=t+e+n+i;if(this.labels_[r])return this.labels_[r];const s=i?this.strokeStates[i]:null,o=n?this.fillStates[n]:null,a=this.textStates[e],l=this.pixelRatio,c=[a.scale[0]*l,a.scale[1]*l],u=a.justify?_F[a.justify]:MF(Array.isArray(t)?t[0]:t,a.textAlign||VO),h=i&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(IF,[]),{width:p,height:f,widths:g,heights:m,lineWidths:y}=function(t,e){const n=[],i=[],r=[];let s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){const h=e[c];if("\n"===h||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[c+1]||t.font,p=eA(d,h);n.push(p),o+=p;const f=QO(d);i.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:n,heights:i,lineWidths:r}}(a,d),_=p+h,v=[],b=(_+2)*c[0],w=(f+h)*c[1],x={width:b<0?Math.floor(b):Math.ceil(b),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==c[0]&&1==c[1]||v.push("scale",c),i&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",h),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),n&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let C=u*_+S*h;const k=[],E=[];let T,R=0,P=0,M=0,I=0;for(let O=0,A=d.length;Ot?t-l:r,v=s+c>e?e-c:s,b=p[3]+_*h[0]+p[1],w=p[0]+v*h[1]+p[2],x=m-p[3],S=y-p[0];let C;return(f||0!==u)&&(CF[0]=x,TF[0]=x,CF[1]=S,kF[1]=S,kF[0]=x+b,EF[0]=kF[0],EF[1]=S+w,TF[1]=EF[1]),0!==u?(C=WT([1,0,0,1,0,0],n,i,1,1,u,-n,-i),$T(C,CF),$T(C,kF),$T(C,EF),$T(C,TF),Vk(Math.min(CF[0],kF[0],EF[0],TF[0]),Math.min(CF[1],kF[1],EF[1],TF[1]),Math.max(CF[0],kF[0],EF[0],TF[0]),Math.max(CF[1],kF[1],EF[1],TF[1]),SF)):Vk(Math.min(x,x+b),Math.min(S,S+w),Math.max(x,x+b),Math.max(S,S+w),SF),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:c,declutterBox:{minX:SF[0],minY:SF[1],maxX:SF[2],maxY:SF[3],value:g},canvasTransform:C,scale:h}}replayImageOrLabel_(t,e,n,i,r,s,o){const a=!(!s&&!o),l=i.declutterBox,c=o?o[2]*i.scale[0]/2:0;return l.minX-c<=e[0]&&l.maxX+c>=0&&l.minY-c<=e[1]&&l.maxY+c>=0&&(a&&this.replayTextBackground_(t,CF,kF,EF,TF,s,o),function(t,e,n,i,r,s,o,a,l,c,u){t.save(),1!==n&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=n:t.globalAlpha*=n),e&&t.transform.apply(t,e),i.contextInstructions?(t.translate(l,c),t.scale(u[0],u[1]),function(t,e){const n=t.contextInstructions;for(let i=0,r=n.length;iF&&(this.fill_(t),R=0),P>F&&(t.stroke(),P=0),R||P||(t.beginPath(),_=NaN,v=NaN),++d;break;case 2:T=n[1];const i=c[T],u=c[T+1],h=c[T+2]-i,p=c[T+3]-u,N=Math.sqrt(h*h+p*p);t.moveTo(i+N,u),t.arc(i,u,N,0,2*Math.PI,!0),++d;break;case 3:t.closePath(),++d;break;case 4:T=n[1],f=n[2];const U=n[3],B=n[4],q=n[5];A.geometry=U,A.feature=L,d in M||(M[d]=[]);const V=M[d];q?q(c,T,f,2,V):(V[0]=c[T],V[1]=c[T+1],V.length=2),l&&(l.zIndex=n[6]),B(V,A),++d;break;case 6:T=n[1],f=n[2],x=n[3],g=n[4],m=n[5];let $=n[6];const G=n[7],W=n[8],H=n[9],K=n[10];let X=n[11];const Y=n[12];let Z=n[13];y=n[14]||"declutter";const J=n[15];if(!x&&n.length>=20){S=n[19],C=n[20],k=n[21],E=n[22];const t=this.drawLabelWithPointPlacement_(S,C,k,E);x=t.label,n[3]=x;const e=n[23];g=(t.anchorX-e)*this.pixelRatio,n[4]=g;const i=n[24];m=(t.anchorY-i)*this.pixelRatio,n[5]=m,$=x.height,n[6]=$,Z=x.width,n[13]=Z}let Q,tt,et,nt;n.length>25&&(Q=n[25]),n.length>17?(tt=n[16],et=n[17],nt=n[18]):(tt=GO,et=null,nt=null),K&&O?X+=I:K||O||(X-=I);let it=0;for(;T!LF.includes(t));class DF{constructor(t,e,n,i,r,s,o){this.maxExtent_=t,this.overlaps_=i,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let i=this.executorsByZIndex_[n];void 0===i&&(i={},this.executorsByZIndex_[n]=i);const r=t[n];for(const t in r){const n=r[t];i[t]=new AF(this.resolution_,this.pixelRatio_,this.overlaps_,n,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let e=0,i=t.length;en)break;let a=i[o];a||(a=[],i[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const r=[];for(let s=0,o=i.length;s0){if(!s||"none"===n||"Image"!==d&&"Text"!==d||s.includes(t)){const n=(h[l]-3)/4,s=i-n%o,a=i-(n/o|0),c=r(t,e,s*s+a*a);if(c)return c}c.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,v;for(f.sort(CC),g=f.length-1;g>=0;--g){const t=f[g].toString();for(y=this.executorsByZIndex_[t],m=FF.length-1;m>=0;--m)if(d=FF[m],_=y[d],void 0!==_&&(v=_.executeHitDetection(c,a,n,p,u),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],i=e[1],r=e[2],s=e[3],o=[n,i,n,s,r,s,r,i];return YT(o,0,8,2,t,o),o}isEmpty(){return zC(this.executorsByZIndex_)}execute(t,e,n,i,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?kC:CC),s=s||FF;const l=FF.length;for(let c=0,u=a.length;cp.execute(t,e,n,i,r,o)):p.execute(h,e,n,i,r,o),d&&h.restore(),s){s.offset();const t=a[c]*l+FF.indexOf(u);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(CC);for(let n=0,i=e.length;n{t.draw(this.renderedContext_),t.clear()}),t[e[n]].length=0}}const jF={};class NF extends lF{constructor(t,e,n,i,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=i,this.transformRotation_=i?Pk(Math.atan2(i[1],i[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,n,i){if(!this.image_)return;const r=YT(t,e,n,i,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let c=0,u=r.length;ct*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:BO,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:zO(t||qO)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const n=t.getPixelRatio(this.pixelRatio_),i=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=i[0]*n,this.imageAnchorY_=i[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/n,s[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:zO(t||jO)}}else this.textFillState_=null;const n=t.getStroke();if(n){const t=n.getColor(),e=n.getLineCap(),i=n.getLineDash(),r=n.getLineDashOffset(),s=n.getLineJoin(),o=n.getWidth(),a=n.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:NO,lineDash:i||UO,lineDashOffset:r||0,lineJoin:void 0!==s?s:BO,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:zO(t||qO)}}else this.textStrokeState_=null;const i=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),h=t.getTextBaseline();this.textState_={font:void 0!==i?i:DO,textAlign:void 0!==u?u:VO,textBaseline:void 0!==h?h:$O},this.text_=void 0!==c?Array.isArray(c)?c.reduce((t,e,n)=>t+(n%2?" ":e),""):c:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const UF=.5;function BF(t,e,n,i,r,s,o,a,l){const c=r,u=sP(t[0]*UF,t[1]*UF);u.imageSmoothingEnabled=!1;const h=u.canvas,d=new NF(u,UF,r,null,o,a,l?PT(null,l):null),p=n.length,f=Math.floor(16777215/p),g={};for(let y=1;y<=p;++y){const t=n[y-1],e=t.getStyleFunction()||i;if(!e)continue;let r=e(t,s);if(!r)continue;Array.isArray(r)||(r=[r]);const o=(y*f).toString(16).padStart(7,"#00000");for(let n=0,i=r.length;n0;return h&&Promise.all(l).then(()=>r(null)),function(t,e,n,i,r,s,o){const a=n.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(i,r);n.getRenderer()?KF(t,l,n,e,o):(0,VF[l.getType()])(t,l,n,e,o,s)}(t,e,n,i,s,o,a),h}function KF(t,e,n,i,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;ethis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return VC()}getData(t){return null}prepareFrame(t){return VC()}renderFrame(t,e){return VC()}forEachFeatureAtCoordinate(t,e,n,i,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(mC,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const YF=[];let ZF=null;class JF extends XF{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,n){let i;ZF||(ZF=sP(1,1,void 0,{willReadFrequently:!0})),ZF.clearRect(0,0,1,1);try{ZF.drawImage(t,e,n,1,1,0,0,1,1),i=ZF.getImageData(0,0,1,1).data}catch{return ZF=null,null}return i}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,n){const i=this.getLayer().getClassName();let r,s;if(t&&t.className===i&&(!n||t&&t.style.backgroundColor&&PC(nI(t.style.backgroundColor),nI(n)))){const e=t.firstElementChild;fP(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const n=XT(t),i=XT(e);for(let r=0;r<6;++r)if(0!==Math.round((n[r]-i[r])*KT[r]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=rk?pP():document.createElement("div"),r.className=i;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=sP();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!n||this.container.style.backgroundColor||(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const i=lE(n),r=cE(n),s=eE(n),o=tE(n);$T(e.coordinateToPixelTransform,i),$T(e.coordinateToPixelTransform,r),$T(e.coordinateToPixelTransform,s),$T(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;$T(a,i),$T(a,r),$T(a,s),$T(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const n=t.extent,i=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(uE(n)/i*s),a=Math.round(oE(n)/i*s);WT(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),HT(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,n){const i=this.getLayer();if(i.hasListener(t)){const r=new UA(t,this.inversePixelTransform,n,e);i.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(fM,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(gM,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new xF),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(fM,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(gM,this.context,t))}getRenderTransform(t,e,n,i,r,s,o){const a=r/2,l=s/2,c=i/e,u=-c,h=-t[0]+o,d=-t[1];return WT(this.tempTransform,a,l,c,u,-n,h,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class QF extends JF{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,n){const i=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,c=a.getExtent(),u=this.getLayer().getSource(),h=this.getLayer().getDeclutter(),d=e.pixelRatio,p=e.viewHints,f=!(p[0]||p[1]),g=this.context,m=Math.round(uE(i)/o*d),y=Math.round(oE(i)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?uE(c):null,b=_?Math.ceil((i[2]-c[2])/v)+1:1;let w=_?Math.floor((i[0]-c[0])/v):0;do{let i=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(i=i.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],i,l,f,void 0===n?FF:n?LF:zF,n?h&&e.declutter[h]:void 0)}while(++w{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,n=this.renderedResolution_,i=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*UF,c=t[1]*UF;a.push(this.getRenderTransform(e,n,i,UF,l,c,0).slice());const u=o.getSource(),h=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Uk(h,s)){let t=s[0];const r=uE(h);let o,u=0;for(;th[2];)++u,o=r*u,a.push(this.getRenderTransform(e,n,i,UF,l,c,o).slice()),t-=r}this.hitDetectionImageData_=BF(t,a,this.renderedFeatures_,o.getStyleFunction(),s,n,i,GF(n,this.renderedPixelRatio_),null)}e(qF(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,i,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,n,function(t,e,n){const s=GC(t),o=l[s];if(o){if(!0!==o&&nt.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const i=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&i||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,c=l.projection,u=l.resolution,h=t.pixelRatio,d=e.getRevision(),p=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=$F);const g=l.center.slice(),m=zk(a,p*u),y=m.slice(),_=[m.slice()],v=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!Uk(v,t.extent)){const t=uE(v),e=Math.max(uE(m)/2,t);m[0]=v[0]-e,m[2]=v[2]+e,_E(g,c);const n=fE(_[0],c);n[0]v[0]&&n[2]>v[2]&&_.push([n[0]-t,n[1],n[2]-t,n[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Uk(this.wrappedRenderedExtent_,m))return PC(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const b=new bF(WF(u,h),m,u,h);for(let R=0,P=_.length;R{let i;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(i=r(t,u)),i){const e=this.renderFeature(t,w,i,b,void 0,this.getLayer().getDeclutter(),n);x=x&&!e}},C=m,k=n.getFeaturesInExtent(C);f&&k.sort(f);for(let R=0,P=k.length;R=200&&a.status<300){const t=e.getType();try{let i;"text"==t||"json"==t?i=a.responseText:"xml"==t?i=a.responseXML||a.responseText:"arraybuffer"==t&&(i=a.response),i?s(e.readFeatures(i,{extent:n,featureProjection:r}),e.readProjection(i)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function nL(t,e){return function(n,i,r,s,o){eL(t,e,n,i,r,t=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}function iL(){return[[-1/0,-1/0,1/0,1/0]]}function rL(t){return[t]}class sL extends tR{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(BC),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,n=t.length;et.clone())}const aL=[1,0,0,1,0,0];class lL{constructor(t,e,n,i,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=r,this.squaredTolerance_,this.stride_=i,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Gk(this.flatCoordinates_):Wk(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=nE(this.getExtent());this.flatInteriorPoints_=TR(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=NR(this.flatCoordinates_,this.ends_),e=oF(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=RR(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=tF(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const n=this.ends_;for(let i=0,r=n.length;i{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const n=this.simplifiedGeometry_.getFlatCoordinates();let i;switch(this.type_){case"LineString":n.length=yR(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),i=[n.length];break;case"MultiLineString":i=[],n.length=_R(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,i);break;case"Polygon":i=[],n.length=wR(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,i)}return i&&(this.simplifiedGeometry_=new lL(this.type_,n,i,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}lL.prototype.getFlatCoordinates=lL.prototype.getOrientedFlatCoordinates;class cL{constructor(t){this.rbush_=new SM(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[GC(e)]=n}load(t,e){const n=new Array(e.length);for(let i=0,r=e.length;it):null}const dL="addfeature",pL="removefeature";class fL extends DC{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class gL extends uL{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=OC,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(yk(this.format_,"`format` must be set when `url` is set"),this.loader_=nL(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:iL;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let n,i;this.featuresRtree_=e?new cL:null,this.loadedExtentsRtree_=new cL,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?i=t.features:t.features&&(n=t.features,i=n.getArray()),e||void 0!==n||(n=new YC(i)),void 0!==i&&this.addFeaturesInternal(i),void 0!==n&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=GC(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const e=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new fL(dL,t))}setupChangeEvents_(t,e){e instanceof lL||(this.featureChangeKeys_[t]=[NC(e,mC,this.handleFeatureChange_,this),NC(e,gC,this.handleFeatureChange_,this)])}addToIndex_(t,e){let n=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof lL){const i=this.idIndex_[t];i instanceof lL?Array.isArray(i)?i.push(e):this.idIndex_[t]=[i,e]:n=!1}else n=!1;else this.idIndex_[t]=e}return n&&(yk(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],i=[];for(let r=0,s=t.length;r{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(fC,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(BC);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new fL("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(n){const i=n.getGeometry();if(i instanceof lL||i.intersectsCoordinate(t))return e(n)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){const i=n.getGeometry();if(i instanceof lL||i.intersectsExtent(t)){const t=e(n);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),zC(this.nullGeometryFeatures_)||RC(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const n=gE(t,e);return[].concat(...n.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],i=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||MC,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof lL?0:e.closestPointXY(n,i,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new fL("featuresloadend",void 0,t))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new fL("featuresloaderror"))}),i.insert(t,{extent:t.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,n=e.forEachInExtent(t,function(e){if(Hk(e.extent,t))return e});n&&e.remove(n)}removeFeatures(t){let e=!1;for(let n=0,i=t.length;n{t in e&&(n[t]=e[t])}),n}function ML(t){t=t.slice();const e=Object.create(null);for(let n=0;n`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const YL=[AL,FL,LL,zL,DL,jL,qL,NL,KL(UL),VL,GL,$L,WL,HL];function ZL(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ZL(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of YL)if(!ZL(t,e))return null}return`Expected ${XL(t)} but found ${XL(e)} instead.`}function JL(t,e){return e.some(e=>e.kind===t.kind)}function QL(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function tz(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const ez=.96422,nz=.82521,iz=4/29,rz=6/29,sz=3*rz*rz,oz=rz*rz*rz,az=Math.PI/180,lz=180/Math.PI;function cz(t){return(t%=360)<0&&(t+=360),t}function uz([t,e,n,i]){let r,s;const o=dz((.2225045*(t=hz(t))+.7168786*(e=hz(e))+.0606169*(n=hz(n)))/1);t===e&&e===n?r=s=o:(r=dz((.4360747*t+.3850649*e+.1430804*n)/ez),s=dz((.0139322*t+.0971045*e+.7141733*n)/nz));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),i]}function hz(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function dz(t){return t>oz?Math.pow(t,1/3):t/sz+iz}function pz([t,e,n,i]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(n)?r:r-n/200;return r=1*gz(r),s=ez*gz(s),o=nz*gz(o),[fz(3.1338561*s-1.6168667*r-.4906146*o),fz(-.9787684*s+1.9161415*r+.033454*o),fz(.0719453*s-.2289914*r+1.4052427*o),i]}function fz(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function gz(t){return t>rz?t*t*t:sz*(t-iz)}const mz=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function yz(t,e){return mz(t,e)?t[e]:void 0}function _z(t){return parseInt(t.padEnd(2,t),16)/255}function vz(t,e){return bz(e?t/100:t,0,1)}function bz(t,e,n){return Math.min(Math.max(e,t),n)}function wz(t){return!t.some(Number.isNaN)}const xz={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Sz(t,e,n){return t+n*(e-t)}function Cz(t,e,n){return t.map((t,i)=>Sz(t,e[i],n))}class kz{constructor(t,e,n,i=1,r=!0){this.r=t,this.g=e,this.b=n,this.a=i,r||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,e,n,i]))}static parse(t){if(t instanceof kz)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=yz(xz,t);if(e){const[t,n,i]=e;return[t/255,n/255,i/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let n=1;return[_z(t.slice(n,n+=e)),_z(t.slice(n,n+=e)),_z(t.slice(n,n+=e)),_z(t.slice(n,n+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=t.match(e);if(n){const[t,e,i,r,s,o,a,l,c,u,h,d]=n,p=[r||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const t=[i,o,c].join(""),n="%%%"===t?100:""===t?255:0;if(n){const t=[bz(+e/n,0,1),bz(+s/n,0,1),bz(+l/n,0,1),h?vz(+h,d):1];if(wz(t))return t}}return}}const n=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[t,e,i,r,s,o,a,l,c]=n,u=[i||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,bz(+r,0,100),bz(+o,0,100),l?vz(+l,c):1];if(wz(t))return function([t,e,n,i]){function r(i){const r=(i+t/30)%12,s=e*Math.min(n,1-n);return n-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=cz(t),e/=100,n/=100,[r(0),r(8),r(4),i]}(t)}}}(t);return e?new kz(...e,!1):void 0}get rgb(){const{r:t,g:e,b:n,a:i}=this,r=i||1/0;return this.overwriteGetter("rgb",[t/r,e/r,n/r,i])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,n,i,r]=uz(t),s=Math.sqrt(n*n+i*i);return[Math.round(1e4*s)?cz(Math.atan2(i,n)*lz):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",uz(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,n,i]=this.rgb;return`rgba(${[t,e,n].map(t=>Math.round(255*t)).join(",")},${i})`}static interpolate(t,e,n,i="rgb"){switch(i){case"rgb":{const[i,r,s,o]=Cz(t.rgb,e.rgb,n);return new kz(i,r,s,o,!1)}case"hcl":{const[i,r,s,o]=t.hcl,[a,l,c,u]=e.hcl;let h,d;if(isNaN(i)||isNaN(a))isNaN(i)?isNaN(a)?h=NaN:(h=a,1!==s&&0!==s||(d=l)):(h=i,1!==c&&0!==c||(d=r));else{let t=a-i;a>i&&t>180?t-=360:a180&&(t+=360),h=i+n*t}const[p,f,g,m]=function([t,e,n,i]){return t=isNaN(t)?0:t*az,pz([n,Math.cos(t)*e,Math.sin(t)*e,i])}([h,null!=d?d:Sz(r,l,n),Sz(s,c,n),Sz(o,u,n)]);return new kz(p,f,g,m,!1)}case"lab":{const[i,r,s,o]=pz(Cz(t.lab,e.lab,n));return new kz(i,r,s,o,!1)}}}}kz.black=new kz(0,0,0,1),kz.white=new kz(1,1,1,1),kz.transparent=new kz(0,0,0,0),kz.red=new kz(1,0,0,1);class Ez{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Tz=["bottom","center","top"];class Rz{constructor(t,e,n,i,r,s){this.text=t,this.image=e,this.scale=n,this.fontStack=i,this.textColor=r,this.verticalAlign=s}}class Pz{constructor(t){this.sections=t}static fromString(t){return new Pz([new Rz(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Pz?t:Pz.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class Mz{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Mz)return t;if("number"==typeof t)return new Mz([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Mz(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new Mz(Cz(t.values,e.values,n))}}class Iz{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Iz)return t;if("number"==typeof t)return new Iz([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new Iz(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new Iz(Cz(t.values,e.values,n))}}class Oz{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Oz)return t;if("string"==typeof t){const e=kz.parse(t);if(!e)return;return new Oz([e])}if(!Array.isArray(t))return;const e=[];for(const n of t){if("string"!=typeof n)return;const t=kz.parse(n);if(!t)return;e.push(t)}return new Oz(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n,i="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,n,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,n,i]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Nz(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Dz||t instanceof kz||t instanceof Ez||t instanceof Pz||t instanceof Mz||t instanceof Iz||t instanceof Oz||t instanceof Lz||t instanceof zz)return!0;if(Array.isArray(t)){for(const e of t)if(!Nz(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Nz(t[e]))return!1;return!0}return!1}function Uz(t){if(null===t)return AL;if("string"==typeof t)return LL;if("boolean"==typeof t)return zL;if("number"==typeof t)return FL;if(t instanceof kz)return DL;if(t instanceof Dz)return jL;if(t instanceof Ez)return BL;if(t instanceof Pz)return qL;if(t instanceof Mz)return VL;if(t instanceof Iz)return GL;if(t instanceof Oz)return $L;if(t instanceof Lz)return HL;if(t instanceof zz)return WL;if(Array.isArray(t)){const e=t.length;let n;for(const i of t){const t=Uz(i);if(n){if(n===t)continue;n=UL;break}n=t}return KL(n||UL,e)}return NL}function Bz(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof kz||t instanceof Dz||t instanceof Pz||t instanceof Mz||t instanceof Iz||t instanceof Oz||t instanceof Lz||t instanceof zz?t.toString():JSON.stringify(t)}class qz{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Nz(t[1]))return e.error("invalid value");const n=t[1];let i=Uz(n);const r=e.expectedType;return"array"!==i.kind||0!==i.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(i=r),new qz(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Vz={string:LL,number:FL,boolean:zL,object:NL};class $z{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n,i=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in Vz)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Vz[n],i++}else r=UL;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],i++}n=KL(r,s)}else{if(!Vz[r])throw new Error(`Types doesn't contain name = ${r}`);n=Vz[r]}const s=[];for(;it.outputDefined())}}const Gz={"to-boolean":zL,"to-color":DL,"to-number":FL,"to-string":LL};class Wz{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[0];if(!Gz[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const i=Gz[n],r=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:jz(e[0],e[1],e[2],e[3]),!n))return new kz(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Az(n||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const n of this.args){e=n.evaluate(t);const i=Mz.parse(e);if(i)return i}throw new Az(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const n of this.args){e=n.evaluate(t);const i=Iz.parse(e);if(i)return i}throw new Az(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const n of this.args){e=n.evaluate(t);const i=Oz.parse(e);if(i)return i}throw new Az(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const n of this.args){e=n.evaluate(t);const i=Lz.parse(e);if(i)return i}throw new Az(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new Az(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Pz.fromString(Bz(this.args[0].evaluate(t)));case"resolvedImage":return zz.fromString(Bz(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Bz(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Hz=["Unknown","Point","LineString","Polygon"];class Kz{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Hz[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=kz.parse(t),this._parseColorCache.set(t,e)),e}}class Xz{constructor(t,e,n=[],i,r=new OL,s=[]){this.registry=t,this.path=n,this.key=n.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=i,this._isConstant=e}parse(t,e,n,i,r={}){return e?this.concat(e,n,i)._parse(t,r):this._parse(t,r)}_parse(t,e){function n(t,e,n){return"assert"===n?new $z(e,[t]):"coerce"===n?new Wz(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[r];if(s){let r=s.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(i.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(i.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(i.kind)||"colorArray"===t.kind&&["value","string","array"].includes(i.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(i.kind))r=n(r,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,i))return null}else r=n(r,t,e.typeAnnotation||"assert")}if(!(r instanceof qz)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new Kz;try{r=new qz(r.type,r.evaluate(t))}catch(i){return this.error(i.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const i="number"==typeof t?this.path.concat(t):this.path,r=n?this.scope.concat(n):this.scope;return new Xz(this.registry,this._isConstant,i,e||null,r,this.errors)}error(t,...e){const n=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new IL(n,t))}checkSubtype(t,e){const n=ZL(t,e);return n&&this.error(n),n}}class Yz{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let r=1;r=n.length)throw new Az(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new Az(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Qz{constructor(t,e){this.type=zL,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,UL),i=e.parse(t[2],2,UL);return n&&i?JL(n.type,[zL,LL,FL,AL,UL])?new Qz(n,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${XL(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!QL(e,["boolean","string","number","null"]))throw new Az(`Expected first argument to be of type boolean, string, number or null, but found ${XL(Uz(e))} instead.`);if(!QL(n,["string","array"]))throw new Az(`Expected second argument to be of type array or string, but found ${XL(Uz(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class tD{constructor(t,e,n){this.type=FL,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,UL),i=e.parse(t[2],2,UL);if(!n||!i)return null;if(!JL(n.type,[zL,LL,FL,AL,UL]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${XL(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,FL);return r?new tD(n,i,r):null}return new tD(n,i)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!QL(e,["boolean","string","number","null"]))throw new Az(`Expected first argument to be of type boolean, string, number or null, but found ${XL(Uz(e))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),QL(n,["string"])){const t=n.indexOf(e,i);return-1===t?-1:[...n.slice(0,t)].length}if(QL(n,["array"]))return n.indexOf(e,i);throw new Az(`Expected second argument to be of type array or string, but found ${XL(Uz(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class eD{constructor(t,e,n,i,r,s){this.inputType=t,this.type=e,this.input=n,this.cases=i,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let n,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r={},s=[];for(let l=2;lNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,Uz(t)))return null}else n=Uz(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,s.push(u)}const o=e.parse(t[1],1,UL);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,i);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(n,o.type)?null:new eD(n,i,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Uz(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class nD{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i=[];for(let s=1;se.outputDefined())&&this.otherwise.outputDefined()}}class iD{constructor(t,e,n,i){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,UL),i=e.parse(t[2],2,FL);if(!n||!i)return null;if(!JL(n.type,[KL(UL),LL,UL]))return e.error(`Expected first argument to be of type array or string, but found ${XL(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,FL);return r?new iD(n.type,n,i,r):null}return new iD(n.type,n,i)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let i;if(this.endIndex&&(i=this.endIndex.evaluate(t)),QL(e,["string"]))return[...e].slice(n,i).join("");if(QL(e,["array"]))return e.slice(n,i);throw new Az(`Expected first argument to be of type array or string, but found ${XL(Uz(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function rD(t,e){const n=t.length-1;let i,r,s=0,o=n,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),i=t[a],r=t[a+1],i<=e){if(a===n||ee))throw new Az("Input is not a number.");o=a-1}return 0}class sD{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[i,r]of n)this.labels.push(i),this.outputs.push(r)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const n=e.parse(t[1],1,FL);if(!n)return null;const i=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let s=1;s=n)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,r);if(!c)return null;r=r||c.type,i.push([n,c])}return new sD(r,n,i)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;return i>=e[r-1]?n[r-1].evaluate(t):n[rD(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function oD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var aD,lD,cD=function(){if(lD)return aD;function t(t,e,n,i){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=n,this.p2y=i}return lD=1,aD=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var n=t,i=0;i<8;i++){var r=this.sampleCurveX(n)-t;if(Math.abs(r)r?o=n:a=n,n=.5*(a-o)+o;return n},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},aD}(),uD=oD(cD);class hD{constructor(t,e,n,i,r){this.type=t,this.operator=e,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(const[s,o]of r)this.labels.push(s),this.outputs.push(o)}static interpolationFactor(t,e,n,i){let r=0;if("exponential"===t.name)r=dD(e,t.base,n,i);else if("linear"===t.name)r=dD(e,1,n,i);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new uD(s[0],s[1],s[2],s[3]).solve(dD(e,1,n,i))}return r}static parse(t,e){let[n,i,r,...s]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,FL),!r)return null;const o=[];let a=null;"interpolate-hcl"!==n&&"interpolate-lab"!==n||e.expectedType==$L?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=DL;for(let l=0;l=t)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=e.parse(n,r,a);if(!c)return null;a=a||c.type,o.push([t,c])}return tz(a,FL)||tz(a,jL)||tz(a,DL)||tz(a,VL)||tz(a,GL)||tz(a,$L)||tz(a,HL)||tz(a,KL(FL))?new hD(a,n,i,r,o):e.error(`Type ${XL(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;if(i>=e[r-1])return n[r-1].evaluate(t);const s=rD(e,i),o=e[s],a=e[s+1],l=hD.interpolationFactor(this.interpolation,i,o,a),c=n[s].evaluate(t),u=n[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Sz(c,u,l);case"color":return kz.interpolate(c,u,l);case"padding":return Mz.interpolate(c,u,l);case"colorArray":return Oz.interpolate(c,u,l);case"numberArray":return Iz.interpolate(c,u,l);case"variableAnchorOffsetCollection":return Lz.interpolate(c,u,l);case"array":return Cz(c,u,l);case"projectionDefinition":return Dz.interpolate(c,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return kz.interpolate(c,u,l,"hcl");case"colorArray":return Oz.interpolate(c,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return kz.interpolate(c,u,l,"lab");case"colorArray":return Oz.interpolate(c,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function dD(t,e,n,i){const r=i-n,s=t-n;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}class pD{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n=null;const i=e.expectedType;i&&"value"!==i.kind&&(n=i);const r=[];for(const o of t.slice(1)){const t=e.parse(o,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n=n||t.type,r.push(t)}if(!n)throw new Error("No output type");const s=i&&r.some(t=>ZL(i,t.type));return new pD(s?UL:n,r)}evaluate(t){let e,n=null,i=0;for(const r of this.args)if(i++,n=r.evaluate(t),n&&n instanceof zz&&!n.available&&(e||(e=n.name),n=null,i===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function fD(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function gD(t,e,n,i){return 0===i.compare(e,n)}function mD(t,e,n){const i="=="!==t&&"!="!==t;return class r{constructor(t,e,n){this.type=zL,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let s=e.parse(t[1],1,UL);if(!s)return null;if(!fD(n,s.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${XL(s.type)}'.`);let o=e.parse(t[2],2,UL);if(!o)return null;if(!fD(n,o.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${XL(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${XL(s.type)}' and '${XL(o.type)}'.`);i&&("value"===s.type.kind&&"value"!==o.type.kind?s=new $z(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new $z(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,BL),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){const e=Uz(s),n=Uz(o);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new Az(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=Uz(s),n=Uz(o);if("string"!==t.kind||"string"!==n.kind)return e(r,s,o)}return this.collator?n(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const yD=mD("==",function(t,e,n){return e===n},gD),_D=mD("!=",function(t,e,n){return e!==n},function(t,e,n,i){return!gD(0,e,n,i)}),vD=mD("<",function(t,e,n){return e",function(t,e,n){return e>n},function(t,e,n,i){return i.compare(e,n)>0}),wD=mD("<=",function(t,e,n){return e<=n},function(t,e,n,i){return i.compare(e,n)<=0}),xD=mD(">=",function(t,e,n){return e>=n},function(t,e,n,i){return i.compare(e,n)>=0});class SD{constructor(t,e,n){this.type=BL,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");const i=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,zL);if(!i)return null;const r=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,zL);if(!r)return null;let s=null;return n.locale&&(s=e.parse(n.locale,1,LL),!s)?null:new SD(i,r,s)}evaluate(t){return new Ez(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class CD{constructor(t,e,n,i,r){this.type=LL,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,FL);if(!n)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let r=null;if(i.locale&&(r=e.parse(i.locale,1,LL),!r))return null;let s=null;if(i.currency&&(s=e.parse(i.currency,1,LL),!s))return null;let o=null;if(i["min-fraction-digits"]&&(o=e.parse(i["min-fraction-digits"],1,FL),!o))return null;let a=null;return i["max-fraction-digits"]&&(a=e.parse(i["max-fraction-digits"],1,FL),!a)?null:new CD(n,r,s,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class kD{constructor(t){this.type=qL,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const i=[];let r=!1;for(let s=1;s<=t.length-1;++s){const n=t[s];if(r&&"object"==typeof n&&!Array.isArray(n)){r=!1;let t=null;if(n["font-scale"]&&(t=e.parse(n["font-scale"],1,FL),!t))return null;let s=null;if(n["text-font"]&&(s=e.parse(n["text-font"],1,KL(LL)),!s))return null;let o=null;if(n["text-color"]&&(o=e.parse(n["text-color"],1,DL),!o))return null;let a=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!Tz.includes(n["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(a=e.parse(n["vertical-align"],1,LL),!a)return null}const l=i[i.length-1];l.scale=t,l.font=s,l.textColor=o,l.verticalAlign=a}else{const n=e.parse(t[s],1,UL);if(!n)return null;const o=n.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,i.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new kD(i)}evaluate(t){return new Pz(this.sections.map(e=>{const n=e.content.evaluate(t);return Uz(n)===WL?new Rz("",n,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Rz(Bz(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class ED{constructor(t){this.type=WL,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,LL);return n?new ED(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=zz.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}}class TD{constructor(t){this.type=FL,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${XL(n.type)} instead.`):new TD(n):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Az(`Expected value to be of type string or array, but found ${XL(Uz(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const RD=8192;function PD(t,e){const n=(180+t[0])/360,i=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(n*s*RD),Math.round(i*s*RD)]}function MD(t,e){const n=Math.pow(2,e.z);return[(r=(t[0]/RD+e.x)/n,360*r-180),(i=(t[1]/RD+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,r}function ID(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function OD(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function AD(t,e,n){return e[1]>t[1]!=n[1]>t[1]&&t[0]<(n[0]-e[0])*(t[1]-e[1])/(n[1]-e[1])+e[0]}function FD(t,e,n){const i=t[0]-e[0],r=t[1]-e[1],s=t[0]-n[0],o=t[1]-n[1];return i*o-s*r===0&&i*s<=0&&r*o<=0}function LD(t,e,n,i){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[i[0]-n[0],i[1]-n[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!BD(t,e,n,i)||!BD(n,i,t,e));var s,o}function zD(t,e,n){for(const i of n)for(let n=0;n0&&h<0||u<0&&h>0}function qD(t,e,n){const i=[];for(let r=0;rn[2]){const e=.5*i;let r=t[0]-n[0]>e?-i:n[0]-t[0]>e?i:0;0===r&&(r=t[0]-n[2]>e?-i:n[2]-t[0]>e?i:0),t[0]+=r}ID(e,t)}function GD(t,e,n,i){const r=Math.pow(2,i.z)*RD,s=[i.x*RD,i.y*RD],o=[];for(const a of t)for(const t of a){const i=[t.x+s[0],t.y+s[1]];$D(i,e,n,r),o.push(i)}return o}function WD(t,e,n,i){const r=Math.pow(2,i.z)*RD,s=[i.x*RD,i.y*RD],o=[];for(const a of t){const t=[];for(const n of a){const i=[n.x+s[0],n.y+s[1]];ID(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const i of t)$D(i,e,n,r)}return o}class HD{constructor(t,e){this.type=zL,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Nz(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const n of e.features){const{type:e,coordinates:i}=n.geometry;"Polygon"===e&&t.push(i),"MultiPolygon"===e&&t.push(...i)}if(t.length)return new HD(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new HD(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new HD(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=qD(e.coordinates,i,r),o=GD(t.geometry(),n,i,r);if(!OD(n,i))return!1;for(const t of o)if(!DD(t,s))return!1}if("MultiPolygon"===e.type){const s=VD(e.coordinates,i,r),o=GD(t.geometry(),n,i,r);if(!OD(n,i))return!1;for(const t of o)if(!jD(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=qD(e.coordinates,i,r),o=WD(t.geometry(),n,i,r);if(!OD(n,i))return!1;for(const t of o)if(!ND(t,s))return!1}if("MultiPolygon"===e.type){const s=VD(e.coordinates,i,r),o=WD(t.geometry(),n,i,r);if(!OD(n,i))return!1;for(const t of o)if(!UD(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class KD{constructor(t=[],e=(t,e)=>te?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,i=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(n(i,s)>=0)break;e[t]=s,t=r}e[t]=i}_down(t){const{data:e,compare:n}=this,i=this.length>>1,r=e[t];for(;t=0)break;e[t]=e[i],t=i}e[t]=r}}function XD(t){let e=0;for(let n,i,r=0,s=t.length,o=s-1;r1?(l=t[a+1][0],c=t[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,h=(e[1]-c)*this.ky;const p=u*u+h*h;p180;)t-=360;return t}}function tj(t,e){return e[0]-t[0]}function ej(t){return t[1]-t[0]+1}function nj(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];const n=ej(t);if(e){if(2===n)return[t,null];const e=Math.floor(n/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===n)return[t,null];const i=Math.floor(n/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function rj(t,e){if(!nj(e,t.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)ID(n,t[i]);return n}function sj(t){const e=[1/0,1/0,-1/0,-1/0];for(const n of t)for(const t of n)ID(e,t);return e}function oj(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function aj(t,e,n){if(!oj(t)||!oj(e))return NaN;let i=0,r=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]=i)return i;if(OD(r,s)){if(fj(t,e))return 0}else if(fj(e,t))return 0;let o=1/0;for(const a of t)for(let t=0,i=a.length,r=i-1;t0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],c=e?50:100;if(ej(l)<=c){if(!nj(l,t.length))return NaN;if(e){const e=pj(t,l,n,i);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=dj(t[e],n,i);if(s=Math.min(s,r),0===s)return 0}}else{const n=ij(l,e);mj(o,s,i,t,a,n[0]),mj(o,s,i,t,a,n[1])}}return s}function vj(t,e,n,i,r,s=1/0){let o=Math.min(s,r.distance(t[0],n[0]));if(0===o)return o;const a=new KD([[0,[0,t.length-1],[0,n.length-1]]],tj);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],c=s[2],u=e?50:100,h=i?50:100;if(ej(l)<=u&&ej(c)<=h){if(!nj(l,t.length)&&nj(c,n.length))return NaN;let s;if(e&&i)s=uj(t,l,n,c,r),o=Math.min(o,s);else if(e&&!i){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(s=lj(n[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&i){const e=n.slice(c[0],c[1]+1);for(let n=l[0];n<=l[1];++n)if(s=lj(t[n],e,r),o=Math.min(o,s),0===o)return o}else s=hj(t,l,n,c,r),o=Math.min(o,s)}else{const s=ij(l,e),u=ij(c,i);yj(a,o,r,t,n,s[0],u[0]),yj(a,o,r,t,n,s[0],u[1]),yj(a,o,r,t,n,s[1],u[0]),yj(a,o,r,t,n,s[1],u[1])}}return o}function bj(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class wj{constructor(t,e){this.type=FL,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Nz(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new wj(e,e.features.map(t=>bj(t.geometry)).flat());if("Feature"===e.type)return new wj(e,bj(e.geometry));if("type"in e&&"coordinates"in e)return new wj(e,bj(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=t.geometry(),i=n.flat().map(e=>MD([e.x,e.y],t.canonical));if(0===n.length)return NaN;const r=new QD(i[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,vj(i,!1,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,vj(i,!1,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,_j(i,!1,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=t.geometry(),i=n.flat().map(e=>MD([e.x,e.y],t.canonical));if(0===n.length)return NaN;const r=new QD(i[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,vj(i,!0,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,vj(i,!0,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,_j(i,!0,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const n=t.geometry();if(0===n.length||0===n[0].length)return NaN;const i=function(t){if(t.length<=1)return[t];const e=[];let n,i;for(const r of t){const t=XD(r);0!==t&&(r.area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(n&&e.push(n),n=[r]):n.push(r))}return n&&e.push(n),e}(n).map(e=>e.map(e=>e.map(e=>MD([e.x,e.y],t.canonical)))),r=new QD(i[0][0][0][1]);let s=1/0;for(const o of e)for(const t of i){switch(o.type){case"Point":s=Math.min(s,_j([o.coordinates],!1,t,r,s));break;case"LineString":s=Math.min(s,_j(o.coordinates,!0,t,r,s));break;case"Polygon":s=Math.min(s,gj(t,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class xj{constructor(t){this.type=UL,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=t[1];return null==n?e.error("Global state property must be defined."):"string"!=typeof n?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new xj(n)}evaluate(t){var e;const n=null===(e=t.globals)||void 0===e?void 0:e.globalState;return n&&0!==Object.keys(n).length?yz(n,this.key):null}eachChild(){}outputDefined(){return!1}}const Sj={"==":yD,"!=":_D,">":bD,"<":vD,">=":xD,"<=":wD,array:$z,at:Jz,boolean:$z,case:nD,coalesce:pD,collator:SD,format:kD,image:ED,in:Qz,"index-of":tD,interpolate:hD,"interpolate-hcl":hD,"interpolate-lab":hD,length:TD,let:Yz,literal:qz,match:eD,number:$z,"number-format":CD,object:$z,slice:iD,step:sD,string:$z,"to-boolean":Wz,"to-color":Wz,"to-number":Wz,"to-string":Wz,var:Zz,within:HD,distance:wj,"global-state":xj};class Cj{constructor(t,e,n,i){this.name=t,this.type=e,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const n=t[0],i=Cj.definitions[n];if(!i)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(i)?i[0]:i.type,s=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[l,c]of o){a=new Xz(e.registry,Pj,e.path,null,e.scope);const i=[];let s=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(XL).join(", ")})`:`(${XL(e.type)}...)`;var e}).join(" | "),i=[];for(let r=1;r{n=e?n&&Pj(t):n&&t instanceof qz}),!!n&&Mj(t)&&Oj(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Mj(t){if(t instanceof Cj){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof HD)return!1;if(t instanceof wj)return!1;let e=!0;return t.eachChild(t=>{e&&!Mj(t)&&(e=!1)}),e}function Ij(t){if(t instanceof Cj&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!Ij(t)&&(e=!1)}),e}function Oj(t,e){if(t instanceof Cj&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild(t=>{n&&!Oj(t,e)&&(n=!1)}),n}function Aj(t){return{result:"success",value:t}}function Fj(t){return{result:"error",value:t}}function Lj(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Uz(t)===NL}Cj.register(Sj,{error:[{kind:"error"},[LL],(t,[e])=>{throw new Az(e.evaluate(t))}],typeof:[LL,[UL],(t,[e])=>XL(Uz(e.evaluate(t)))],"to-rgba":[KL(FL,4),[DL],(t,[e])=>{const[n,i,r,s]=e.evaluate(t).rgb;return[255*n,255*i,255*r,s]}],rgb:[DL,[FL,FL,FL],kj],rgba:[DL,[FL,FL,FL,FL],kj],has:{type:zL,overloads:[[[LL],(t,[e])=>Ej(e.evaluate(t),t.properties())],[[LL,NL],(t,[e,n])=>Ej(e.evaluate(t),n.evaluate(t))]]},get:{type:UL,overloads:[[[LL],(t,[e])=>Tj(e.evaluate(t),t.properties())],[[LL,NL],(t,[e,n])=>Tj(e.evaluate(t),n.evaluate(t))]]},"feature-state":[UL,[LL],(t,[e])=>Tj(e.evaluate(t),t.featureState||{})],properties:[NL,[],t=>t.properties()],"geometry-type":[LL,[],t=>t.geometryType()],id:[UL,[],t=>t.id()],zoom:[FL,[],t=>t.globals.zoom],"heatmap-density":[FL,[],t=>t.globals.heatmapDensity||0],elevation:[FL,[],t=>t.globals.elevation||0],"line-progress":[FL,[],t=>t.globals.lineProgress||0],accumulated:[UL,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[FL,Rj(FL),(t,e)=>{let n=0;for(const i of e)n+=i.evaluate(t);return n}],"*":[FL,Rj(FL),(t,e)=>{let n=1;for(const i of e)n*=i.evaluate(t);return n}],"-":{type:FL,overloads:[[[FL,FL],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[FL],(t,[e])=>-e.evaluate(t)]]},"/":[FL,[FL,FL],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[FL,[FL,FL],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[FL,[],()=>Math.LN2],pi:[FL,[],()=>Math.PI],e:[FL,[],()=>Math.E],"^":[FL,[FL,FL],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[FL,[FL],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[FL,[FL],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[FL,[FL],(t,[e])=>Math.log(e.evaluate(t))],log2:[FL,[FL],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[FL,[FL],(t,[e])=>Math.sin(e.evaluate(t))],cos:[FL,[FL],(t,[e])=>Math.cos(e.evaluate(t))],tan:[FL,[FL],(t,[e])=>Math.tan(e.evaluate(t))],asin:[FL,[FL],(t,[e])=>Math.asin(e.evaluate(t))],acos:[FL,[FL],(t,[e])=>Math.acos(e.evaluate(t))],atan:[FL,[FL],(t,[e])=>Math.atan(e.evaluate(t))],min:[FL,Rj(FL),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[FL,Rj(FL),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[FL,[FL],(t,[e])=>Math.abs(e.evaluate(t))],round:[FL,[FL],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[FL,[FL],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[FL,[FL],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[zL,[LL,UL],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[zL,[UL],(t,[e])=>t.id()===e.value],"filter-type-==":[zL,[LL],(t,[e])=>t.geometryType()===e.value],"filter-<":[zL,[LL,UL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i{const n=t.id(),i=e.value;return typeof n==typeof i&&n":[zL,[LL,UL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>r}],"filter-id->":[zL,[UL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>i}],"filter-<=":[zL,[LL,UL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i<=r}],"filter-id-<=":[zL,[UL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n<=i}],"filter->=":[zL,[LL,UL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>=r}],"filter-id->=":[zL,[UL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>=i}],"filter-has":[zL,[UL],(t,[e])=>e.value in t.properties()],"filter-has-id":[zL,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[zL,[KL(LL)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[zL,[KL(UL)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[zL,[LL,KL(UL)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[zL,[LL,KL(UL)],(t,[e,n])=>function(t,e,n,i){for(;n<=i;){const r=n+i>>1;if(e[r]===t)return!0;e[r]>t?i=r-1:n=r+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:zL,overloads:[[[zL,zL],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[Rj(zL),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:zL,overloads:[[[zL,zL],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[Rj(zL),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[zL,[zL],(t,[e])=>!e.evaluate(t)],"is-supported-script":[zL,[LL],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[LL,[LL],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[LL,[LL],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[LL,Rj(UL),(t,e)=>e.map(e=>Bz(e.evaluate(t))).join("")],"resolved-locale":[LL,[BL],(t,[e])=>e.evaluate(t).resolvedLocale()]});class zj{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Kz,this._defaultValue=e?function(t){if("color"===t.type&&Lj(t.default))return new kz(0,0,0,0);switch(t.type){case"color":return kz.parse(t.default)||null;case"padding":return Mz.parse(t.default)||null;case"numberArray":return Iz.parse(t.default)||null;case"colorArray":return Oz.parse(t.default)||null;case"variableAnchorOffsetCollection":return Lz.parse(t.default)||null;case"projectionDefinition":return Dz.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,i,r,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Az(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,"undefined"!=typeof console&&console.warn(o.message)),this._defaultValue}}}function Dj(t,e){const n=new Xz(Sj,Pj,[],e?function(t){const e={color:DL,string:LL,number:FL,enum:LL,boolean:zL,formatted:qL,padding:VL,numberArray:GL,colorArray:$L,projectionDefinition:jL,resolvedImage:WL,variableAnchorOffsetCollection:HL};return"array"===t.type?KL(e[t.value]||UL,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Aj(new zj(i,e)):Fj(n.errors)}class jj{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ij(e.expression),this.globalStateRefs=qj(e.expression)}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,s)}evaluate(t,e,n,i,r,s){return this._styleExpression.evaluate(t,e,n,i,r,s)}}class Nj{constructor(t,e,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ij(e.expression),this.globalStateRefs=qj(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,s)}evaluate(t,e,n,i,r,s){return this._styleExpression.evaluate(t,e,n,i,r,s)}interpolationFactor(t,e,n){return this.interpolationType?hD.interpolationFactor(this.interpolationType,t,e,n):0}}function Uj(t,e){const n=Dj(t,e);if("error"===n.result)return n;const i=n.value.expression,r=Mj(i);if(!r&&"data-driven"!==(s=e)["property-type"]&&"cross-faded-data-driven"!==s["property-type"])return Fj([new IL("","data expressions not supported")]);var s;const o=Oj(i,["zoom"]);if(!o&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Fj([new IL("","zoom expressions not supported")]);const a=Bj(i);if(!a&&!o)return Fj([new IL("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof IL)return Fj([a]);if(a instanceof hD&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Fj([new IL("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Aj(new jj(r?"constant":"source",n.value));const l=a instanceof hD?a.interpolation:void 0;return Aj(new Nj(r?"camera":"composite",n.value,a.labels,l))}function Bj(t){let e=null;if(t instanceof Yz)e=Bj(t.result);else if(t instanceof pD){for(const n of t.args)if(e=Bj(n),e)break}else(t instanceof sD||t instanceof hD)&&t.input instanceof Cj&&"zoom"===t.input.name&&(e=t);return e instanceof IL||t.eachChild(t=>{const n=Bj(t);n instanceof IL?e=n:!e&&n?e=new IL("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new IL("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function qj(t,e=new Set){return t instanceof xj&&e.add(t.key),t.eachChild(t=>{qj(t,e)}),e}function Vj(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Vj(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const $j={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Gj(t){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Vj(t)||(t=Kj(t));const e=Dj(t,$j);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,n,i)=>e.value.evaluate(t,n,{},i),needGeometry:Hj(t),getGlobalStateRefs:()=>qj(e.value.expression)}}function Wj(t,e){return te?1:0}function Hj(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Xj(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(Kj))):"all"===e?["all"].concat(t.slice(1).map(Kj)):"none"===e?["all"].concat(t.slice(1).map(Kj).map(Jj)):"in"===e?Yj(t[1],t.slice(2)):"!in"===e?Jj(Yj(t[1],t.slice(2))):"has"===e?Zj(t[1]):"!has"!==e||Jj(Zj(t[1]));var n}function Xj(t,e,n){switch(t){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,t,e]}}function Yj(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Wj)]]:["filter-in-small",t,["literal",e]]}}function Zj(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Jj(t){return["!",t]}function Qj(t){return"object"==typeof t?["literal",t]:t}function tN(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function eN(t,e){const n=Qj((i=t.default,r=e.default,void 0!==i?i:void 0!==r?r:void 0));var i,r;return void 0===n&&"resolvedImage"===e.type?"":n}function nN(t,e,n){const i=sN(t,e),r=["get",t.property];if("categorical"===i&&"boolean"==typeof n[0][0]){const i=["case"];for(const t of n)i.push(["==",r,t[0]],t[1]);return i.push(eN(t,e)),i}if("categorical"===i){const i=["match",r];for(const t of n)rN(i,t[0],t[1],!1);return i.push(eN(t,e)),i}if("interval"===i){const e=["step",["number",r]];for(const t of n)rN(e,t[0],t[1],!0);return iN(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Qj(t.default)]}if("exponential"===i){const e=void 0!==t.base?t.base:1,i=[tN(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of n)rN(i,t[0],t[1],!1);return void 0===t.default?i:["case",["==",["typeof",r],"number"],i,Qj(t.default)]}throw new Error(`Unknown property function type ${i}`)}function iN(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function rN(t,e,n,i){t.length>3&&e===t[t.length-2]||(i&&2===t.length||t.push(e),t.push(n))}function sN(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function oN(t){const e=["concat"],n=/{([^{}]+)}/g;let i=0;for(let r=n.exec(t);null!==r;r=n.exec(t)){const s=t.slice(i,n.lastIndex-r[0].length);i=n.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};var lN={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},cN=" ",uN=/(italic|oblique)$/i,hN={};function dN(t,e,n){var i=hN[t];if(!i){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],c=0,u=t.length;c1?h[h.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){o=r?o:lN[p],h.pop(),f&&p.startsWith(f)&&h.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=h.join(cN).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(cN)&&(g='"'+g+'"'),l.push(g)}i=hN[t]=[a,o,l]}return i[0]+cN+i[1]+cN+e+"px"+(n?"/"+n:"")+cN+i[2]}class pN extends MO{constructor(t,e,n,i,r){super(t,e,n,void 0!==r?0:2),this.loader_=void 0!==r?r:null,this.canvas_=i,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=3):this.state=2,this.changed()}load(){0==this.state&&(this.state=1,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}class fN extends jC{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(mC)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){VC()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(n){if(-1===n)return 1}else n=e,this.transitionStarts_[t]=n;const i=e-n+1e3/60;return i>=this.transition_?1:vE(i/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class gN extends fN{constructor(t,e,n,i,r,s){super(t,e,s),this.crossOrigin_=i,this.src_=n,this.key=n,this.image_,rk?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==i&&(this.image_.crossOrigin=i)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=sP(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(rk)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,n){const i=t;let r=!0,s=!1,o=!1;const a=[UC(i,"load",function(){o=!0,s||e()})];return i.src&&sk?(s=!0,i.decode().then(function(){r&&e()}).catch(function(){r&&(o?e():n())})):a.push(UC(i,"error",n)),function(){r=!1,a.forEach(BC)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class mN{constructor(t,e,n,i){this.minX=t,this.maxX=e,this.minY=n,this.maxY=i}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function yN(t,e,n,i,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=n,r.maxY=i,r):new mN(t,e,n,i)}const _N=[];class vN extends fN{constructor(t,e,n,i,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=i.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=sP(1,1,_N)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=GC(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(lP(this.context_),_N.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let bN=class extends fN{constructor(t,e,n,i,r,s){super(t,e,s),this.extent=null,this.format_=i,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};const wN="https://api.mapbox.com";function xN(t){return 0!==t.indexOf("mapbox://")?"":t.slice(9)}function SN(t,e,n){const i=xN(t);if(!i)return decodeURI(new URL(t,n).href);if(0!==i.indexOf("sprites/"))throw new Error(`unexpected sprites url: ${t}`);const r=i.slice(8);return`${wN}/styles/v1/${r}/sprite?access_token=${e}`}function CN(t,e){const n=xN(t);if(!n)return decodeURI(new URL(t,location.href).href);if(0!==n.indexOf("styles/"))throw new Error(`unexpected style url: ${t}`);const i=n.slice(7);return`${wN}/styles/v1/${i}?&access_token=${e}`}const kN=["a","b","c","d"];function EN(t,e,n,i){const r=new URL(t,i||location.href),s=xN(t);if(!s)return e?(r.searchParams.has(n)||r.searchParams.set(n,e),[decodeURI(r.href)]):[decodeURI(r.href)];if("mapbox.satellite"===s){const t=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${t}.webp?access_token=${e}`]}return kN.map(t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const TN=Object.freeze({}),RN={},PN={};let MN=0;function IN(t){return t.id||(t.id=MN++),t.id}function ON(t){let e=RN[t.id];return e||(e={},RN[IN(t)]=e),e}function AN(t){return t*Math.PI/180}const FN=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function LN(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const n=document.createElement("canvas");return n.width=t,n.height=e,n}function zN(t,e){let n=0;const i=e.length;for(;nr).then(t=>t instanceof Response?(i&&(i.url=t.url),o(t)):(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),i&&(i.url=t.url),fetch(t).then(o).catch(s))).catch(s);return jN[e]=[r,a],a}function UN(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return NN("Style",t=CN(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(Fj){return Promise.reject(Fj)}}const BN={};function qN(t,e,n={}){const i=[e,JSON.stringify(t)].toString();let r=BN[i];if(!r||n.transformRequest){let s;n.transformRequest&&(s=(t,e)=>{const i=n.transformRequest&&n.transformRequest(e,"Tiles")||e;if(t instanceof bN)t.setLoader((e,n,r)=>{const s=function(n){n.arrayBuffer().then(n=>{const i=t.getFormat().readFeatures(n,{extent:e,featureProjection:r});t.setFeatures(i)})};FC(()=>i).then(e=>{if(e instanceof Response)return s(e);fetch(e).then(s).catch(()=>t.setState(3))}).catch(()=>t.setState(3))});else{const e=t.getImage();FC(()=>i).then(n=>{if("string"==typeof n)return void(e.src=n);const i=t=>t.blob().then(t=>{const n=URL.createObjectURL(t);e.addEventListener("load",()=>URL.revokeObjectURL(n)),e.addEventListener("error",()=>URL.revokeObjectURL(n)),e.src=n});if(n instanceof Response)return i(n);fetch(n).then(i).catch(()=>t.setState(3))}).catch(()=>t.setState(3))}});const o=t.url;if(o&&!t.tiles){const i=EN(o,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:i}),tileLoadFunction:s});else{const t={};r=NN("Source",i[0],n,t).then(function(e){return e.tiles=e.tiles.map(function(i){return"tms"===e.scheme&&(i=i.replace("{y}","{-y}")),EN(i,n.accessToken,n.accessTokenParam||"access_token",t.url)[0]}),Promise.resolve({tileJson:e,tileLoadFunction:s})})}}else t.tiles?(t=Object.assign({},t,{tiles:t.tiles.map(function(i){return"tms"===t.scheme&&(i=i.replace("{y}","{-y}")),EN(i,n.accessToken,n.accessTokenParam||"access_token",e||location.href)[0]})}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s})):r=Promise.reject(new Error("source has no `tiles` nor `url`"));BN[i]=r}return r}function VN(t,e,n,i){const r=[2*n*e.pixelRatio+e.width,2*n*e.pixelRatio+e.height],s=LN(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,n*e.pixelRatio,n*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*i.r},${255*i.g},${255*i.b},${i.a})`;const l=a.data;for(let c=0,u=a.width;c0&&o.arc(c,t,n*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function $N(t,e,n){const i=Math.max(0,Math.min(1,(n-t)/(e-t)));return i*i*(3-2*i)}function GN(t,e,n){const i=LN(e.width,e.height),r=i.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let a=0,l=s.width;a0?(o[e+0]=Math.round(255*n.r*s),o[e+1]=Math.round(255*n.g*s),o[e+2]=Math.round(255*n.b*s),o[e+3]=Math.round(255*s)):o[e+3]=0}return r.putImageData(s,0,0),i}const WN=Array(256).join(" ");function HN(t,e){if(e>=.05){let n="";const i=t.split("\n"),r=WN.slice(0,Math.round(e/.1));for(let t=0,e=i.length;t0&&(n+="\n"),n+=i[t].split("").join(r);return n}return t}let KN;function XN(){return KN||(KN=LN(1,1).getContext("2d")),KN}function YN(t,e){return XN().measureText(t).width+(t.length-1)*e}const ZN={};function JN(t,e,n,i){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=XN();t.font=e;const r=t.measureText("M").width*n;let a="";const l=[];for(let e=0,n=o.length;e1;++e){const t=l[e];if(YN(t,i)<.35*r){const r=e>0?YN(l[e-1],i):1/0,s=e.7*r&&YN(s,i)<.6*r){const o=t.split(" "),a=o.pop();YN(a,i)<.2*r&&(l[e]=o.join(" "),l[e+1]=a+" "+s),n-=1}}s=l.join("\n")}else s=t;s=HN(s,i),ZN[r]=s}return s}WO.on("propertychange",()=>{for(const t in ZN)delete ZN[t]});const QN=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],tU={},eU={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},nU={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},iU={zoom:0,distanceFromCenter:0};let rU,sU;function oU(t,e,n,i,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[n]){let i=(t[e]||TN)[n];const r=aN[`${e}_${t.type}`][n];void 0===i&&(i=r.default);let s=(l=i,Array.isArray(l)&&l.length>0&&"string"==typeof l[0]&&l[0]in Sj);if(!s&&Lj(i)&&(i=function(t,e){let n=t.stops;if(!n)return function(t,e){const n=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",n]:n;if("enum"===e.type)return["match",n,Object.keys(e.values),n,t.default];{const i=["color"===e.type?"to-color":e.type,n,Qj(t.default)];return"array"===e.type&&i.splice(1,0,e.value,e.length||null),i}}(t,e);const i=n&&"object"==typeof n[0][0],r=i||void 0!==t.property,s=i||!r;return n=n.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],oN(t[1])]:[t[0],Qj(t[1])]),i?function(t,e,n){const i={},r={},s=[];for(let o=0;o`${t.key}: ${t.message}`).join(", "));return n.value}(i,r);a[n]=t.evaluate.bind(t)}else{const t=r.type;"color"!==t&&"colorArray"!==t||(i=kz.parse(i)),a[n]=function(){return i}}}var l;return a[n](iU,i,s)}function aU(t,e,n,i){return oU(t,"layout",`${n}-allow-overlap`,e,i)?oU(t,"layout",`${n}-ignore-placement`,e,i)?"none":"obstacle":"declutter"}function lU(t,e,n,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(t in i))try{i[t]=Gj(e).filter}catch(r){console.warn("Filter will evaluate to false: "+r.message),i[t]=function(){return!1}}return i[t](iU,n)}function cU(t,e){if(t){if(0===t.a||0===e)return;const n=t.a;return e=void 0===e?1:e,0===n?"transparent":"rgba("+Math.round(255*t.r/n)+","+Math.round(255*t.g/n)+","+Math.round(255*t.b/n)+","+n*e+")"}return t}Cj.register(Sj,{...Cj.definitions,pitch:[{kind:"number"},[],()=>iU.pitch||90],"distance-from-center":[{kind:"number"},[],()=>iU.distanceFromCenter||0]});const uU=/\{[^{}}]*\}/g;function hU(t,e){return t.replace(uU,function(t){return e[t.slice(1,-1)]||""})}function dU(t,e){let n=t.split(":")[0];return n===t&&(n="default"),e[n]}const pU={};class fU{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=QA,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let n=e.dataProjection?xT(e.dataProjection):this.readProjection(t);e.extent&&n&&"tile-pixels"===n.getUnits()&&(n=xT(n),n.setWorldExtent(e.extent)),e={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return VC()}readFeature(t,e){return VC()}readFeatures(t,e){return VC()}readGeometry(t,e){return VC()}readProjection(t){return VC()}writeFeature(t,e){return VC()}writeFeatures(t,e){return VC()}writeGeometry(t,e){return VC()}}function gU(t,e,n){const i=n?xT(n.featureProjection):null,r=n?xT(n.dataProjection):null;let s=t;if(i&&r&&!RT(i,r)){e&&(s=t.clone());const n=e?i:r,o=e?r:i;"tile-pixels"===n.getUnits()?s.transform(n,o):s.applyTransform(IT(n,o))}if(e&&n&&void 0!==n.decimals){const e=Math.pow(10,n.decimals),i=function(t){for(let n=0,i=t.length;nyU({...t,geometry:e})).flat();const i="MultiPolygon"===n.type?"Polygon":n.type;if("GeometryCollection"===i||"Circle"===i)throw new Error("Unsupported geometry type: "+i);const r=n.layout.length;return gU(new lL(i,"Polygon"===i?function(t,e,n){return Array.isArray(e[0])?(zR(t,0,e,n)||jR(t=t.slice(),0,e,n),t):(LR(t,0,e,n)||DR(t=t.slice(),0,e,n),t)}(n.flatCoordinates,n.ends,r):n.flatCoordinates,n.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function _U(t,e){if(!t)return null;if(Array.isArray(t)){const n=t.map(t=>_U(t,e));return new sL(n)}return gU(new(0,mU[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class vU extends fU{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(bU(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(bU(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return VC()}readFeaturesFromObject(t,e){return VC()}readGeometry(t,e){return this.readGeometryFromObject(bU(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return VC()}readProjection(t){return this.readProjectionFromObject(bU(t))}readProjectionFromObject(t){return VC()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return VC()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return VC()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return VC()}}function bU(t){return"string"==typeof t?JSON.parse(t)||null:null!==t?t:null}class wU extends vU{constructor(t){t=t||{},super(),this.dataProjection=xT(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=xT(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let n=null;n="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const i=xU(n.geometry);if(this.featureClass===lL)return yU({geometry:i,id:n.id,properties:n.properties},e);const r=new QA;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(_U(i,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){let n=null;if("FeatureCollection"===t.type){n=[];const i=t.features;for(let t=0,r=i.length;t>3,r=this.pos;this.type=7&n,t(i,e,this),this.pos===r&&this.skip(n)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*CU;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*CU;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let n,i;return i=e[this.pos++],n=127&i,i<128?n:(i=e[this.pos++],n|=(127&i)<<7,i<128?n:(i=e[this.pos++],n|=(127&i)<<14,i<128?n:(i=e[this.pos++],n|=(127&i)<<21,i<128?n:(i=e[this.pos],n|=(15&i)<<28,function(t,e,n){const i=n.buf;let r,s;if(s=i[n.pos++],r=(112&s)>>4,s<128)return RU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<3,s<128)return RU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<10,s<128)return RU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<17,s<128)return RU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<24,s<128)return RU(t,r,e);if(s=i[n.pos++],r|=(1&s)<<31,s<128)return RU(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(n,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&EU?EU.decode(this.buf.subarray(e,t)):function(t,e,n){let i="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+c>n)break;1===c?e<128&&(l=e):2===c?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===c?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),r+=c}return i}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(n=~(-t%4294967296),i=~(-t/4294967296),4294967295^n?n=n+1|0:(n=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){const n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,n){for(let i,r,s=0;s55295&&i<57344){if(!r){i>56319||s+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):r=i;continue}if(i<56320){t[n++]=239,t[n++]=191,t[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[n++]=239,t[n++]=191,t[n++]=189,r=null);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return n}(this.buf,t,this.pos);const n=this.pos-e;n>=128&&PU(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let n=0;n=128&&PU(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,n){this.writeTag(t,2),this.writeRawMessage(e,n)}writePackedVarint(t,e){e.length&&this.writeMessage(t,MU,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,IU,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,FU,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,OU,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,AU,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,LU,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,zU,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,DU,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,jU,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function RU(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function PU(t,e,n){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(i);for(let r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function MU(t,e){for(let n=0;n>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&c>u&&(i.push(c),u=c),n.push(a,l),c+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");c>u&&(n.push(n[u],n[u+1]),c+=2)}}c>u&&(i.push(c),u=c)}createFeature_(t,e,n){const i=e.type;if(0===i)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const c=function(t,e){let n;return 1===t?n=1===e?"Point":"MultiPoint":2===t?n=1===e?"LineString":"MultiLineString":3===t&&(n="Polygon"),n}(i,l.length);if(this.featureClass===lL)r=new this.featureClass(c,a,l,2,s,o),r.transform(n.dataProjection);else{let t;if("Polygon"==c){const e=NR(a,l);t=e.length>1?new aF(a,"XY",e):new UR(a,"XY",l)}else t="Point"===c?new SR(a,"XY"):"LineString"===c?new iF(a,"XY"):"MultiPoint"===c?new sF(a,"XY"):"MultiLineString"===c?new rF(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=gU(t,!1,n);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const n=this.layers_,i=xT((e=this.adaptOptions(e)).dataProjection);i.setWorldExtent(e.extent),e.dataProjection=i;const r=new TU(t),s=r.readFields(UU,{}),o=[];for(const a in s){if(n&&!n.includes(a))continue;const t=s[a],l=t?[0,0,t.extent,t.extent]:null;i.setExtent(l);for(let n=0,i=t.length;n>3)?n.readString():2===t?n.readFloat():3===t?n.readDouble():4===t?n.readVarint64():5===t?n.readVarint():6===t?n.readSVarint():7===t?n.readBoolean():null;e.values.push(i)}}function qU(t,e,n){if(1==t)e.id=n.readVarint();else if(2==t){const t=n.readVarint()+n.pos;for(;n.pos=o.width)return null;const c=oE(s),u=Math.floor(o.height*((s[3]-i[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const n=this.image,i=n.getExtent(),r=n.getResolution(),[s,o]=Array.isArray(r)?r:[r,r],a=n.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,h=u.center,d=u.resolution,p=c*s/(d*a),f=c*o/(d*a);this.prepareContainer(t,e);const g=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(t);let _=!1,v=!0;if(l.extent){const e=zT(l.extent,u.projection);v=hE(e,t.extent),_=v&&!Uk(e,t.extent),_&&this.clipUnrotated(y,t,e)}const b=n.getImage(),w=WT(this.tempTransform,g/2,m/2,p,f,0,a*(i[0]-h[0])/s,a*(h[1]-i[3])/o);this.renderedResolution=o*c/a;const x=b.width*w[0],S=b.height*w[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),v&&x>=.5&&S>=.5){const t=w[4],e=w[5],n=l.opacity;1!==n&&(y.save(),y.globalAlpha=n),y.drawImage(b,0,0,+b.width,+b.height,t,e,x,S),1!==n&&y.restore()}return this.postRender(this.context,t),_&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class GU extends _M{constructor(t){super(t=t||{})}}class WU extends GU{constructor(t){super(t)}createRenderer(){return new $U(this)}getData(t){return super.getData(t)}}function HU(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const KU=new Error("disposed"),XU=[256,256];class YU extends fN{constructor(t){super(t.tileCoord,0,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=HU(this.data_);return t?[t.width,t.height]:XU}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(KU),this.controller_=null),super.disposeInternal()}}let ZU;const JU=[];function QU(t,e,n,i,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,n),t.lineTo(i,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,i)+1,Math.max(n,r)),t.restore()}function tB(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function eB(t,e,n,i){const r=OT(n,e,t);let s=ST(e,i,n);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Nk(l,r)){const e=ST(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function nB(t,e,n,i,r,s,o,a,l,c,u,h,d){const p=sP(Math.round(n*t),Math.round(n*e),JU);if(h||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function f(t){return Math.round(t*n)/n}p.scale(n,n),p.globalCompositeOperation="lighter";const g=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t){Kk(g,t.extent)});const y=n/i,_=(h?1:1+Math.pow(2,-24))/y;d&&1===l.length&&0===c||(m=sP(Math.round(uE(g)*y),Math.round(oE(g)*y),JU),h||(m.imageSmoothingEnabled=!1),l.forEach(function(t){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-g[0])*y,n=-(t.clipExtent[3]-g[3])*y,i=uE(t.clipExtent)*y,r=oE(t.clipExtent)*y;m.rect(h?e:Math.round(e),h?n:Math.round(n),h?i:Math.round(e+i)-Math.round(e),h?r:Math.round(n+r)-Math.round(n)),m.clip()}const e=(t.extent[0]-g[0])*y,n=-(t.extent[3]-g[3])*y,i=uE(t.extent)*y,r=oE(t.extent)*y;m.drawImage(t.image,c,c,t.image.width-2*c,t.image.height-2*c,h?e:Math.round(e),h?n:Math.round(n),h?i:Math.round(e+i)-Math.round(e),h?r:Math.round(n+r)-Math.round(n)),t.clipExtent&&m.restore()}}));const v=lE(o);return a.getTriangles().forEach(function(t){const e=t.source,n=t.target;let i=e[0][0],r=e[0][1],o=e[1][0],a=e[1][1],c=e[2][0],u=e[2][1];const d=f((n[0][0]-v[0])/s),y=f(-(n[0][1]-v[1])/s),b=f((n[1][0]-v[0])/s),w=f(-(n[1][1]-v[1])/s),x=f((n[2][0]-v[0])/s),S=f(-(n[2][1]-v[1])/s),C=i,k=r;i=0,r=0,o-=C,a-=k,c-=C,u-=k;const E=function(t){const e=t.length;for(let i=0;ir&&(r=e,n=o)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let o=i+1;o=0;i--){n[i]=t[i][e]/t[i][i];for(let r=i-1;r>=0;r--)t[r][e]-=t[r][i]*n[i]}return n}([[o,a,0,0,b-d],[c,u,0,0,x-d],[0,0,o,a,w-y],[0,0,c,u,S-y]]);if(!E)return;if(p.save(),p.beginPath(),function(){if(void 0===ZU){const t=sP(6,6,JU);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",QU(t,4,5,4,0),QU(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;ZU=tB(e,0)||tB(e,4)||tB(e,8),lP(t),JU.push(t.canvas)}return ZU}()||!h){p.moveTo(b,w);const t=4,e=d-b,n=y-w;for(let i=0;i$T(o,OT(t,this.targetProj_,this.sourceProj_)),function(t,e,n,i){const r=t.length;n=void 0!==n?n:2,i=i??n,e=void 0!==e?e:new Array(r);for(let s=0;s=o?t[s+n]:r[n]}return e}):IT(this.targetProj_,this.sourceProj_);var c;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=i,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!i&&!!this.sourceProj_.getExtent()&&uE(i)>=uE(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?uE(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?uE(this.targetProj_.getExtent()):null;const u=lE(n),h=cE(n),d=eE(n),p=tE(n),f=this.transformInv_(u),g=this.transformInv_(h),m=this.transformInv_(d),y=this.transformInv_(p),_=10+(s?Math.max(0,Math.ceil(Math.log2(Qk(n)/(s*s*256*256)))):0);if(this.addQuad_(u,h,d,p,f,g,m,y,_),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const n=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];n[0][0]-t>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-t>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-t>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);const i=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-i.5&&u<1;let p=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=uE(Lk([t,e,n,i]))/this.targetWorldWidth_>.25||p),!d&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)),!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!hE(c,this.maxSourceExtent_))return;let f=0;if(!(p||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!p){const e=[(t[0]+n[0])/2,(t[1]+n[1])/2],i=this.transformInv_(e);let s;s=d?(Tk(r[0],h)+Tk(o[0],h))/2-Tk(i[0],h):(r[0]+o[0])/2-i[0];const a=(r[1]+o[1])/2-i[1];p=s*s+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const c=[(e[0]+n[0])/2,(e[1]+n[1])/2],u=this.transformInv_(c),h=[(i[0]+t[0])/2,(i[1]+t[1])/2],d=this.transformInv_(h);this.addQuad_(t,e,c,h,r,s,u,d,l-1),this.addQuad_(h,c,n,i,d,u,o,a,l-1)}else{const c=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(c),h=[(n[0]+i[0])/2,(n[1]+i[1])/2],d=this.transformInv_(h);this.addQuad_(t,c,h,i,r,u,d,a,l-1),this.addQuad_(c,e,n,h,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,n,i,r,o,a),14&f||this.addTriangle_(t,n,e,r,o,s),f&&(13&f||this.addTriangle_(e,i,t,s,a,r),7&f||this.addTriangle_(e,i,n,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e){const n=e.source;Xk(t,n[0]),Xk(t,n[1]),Xk(t,n[2])}),t}getTriangles(){return this.triangles_}}class rB extends fN{constructor(t,e,n,i,r,s,o,a,l,c,u,h){super(r,0,h),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=i,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=i.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const g=p?aE(d,p):d;if(0===Qk(g))return void(this.state=4);const m=t.getExtent();m&&(f=f?aE(f,m):m);const y=i.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,n,i){const r=nE(n);let s=eB(t,e,r,i);return(!isFinite(s)||s<=0)&&Jk(n,function(n){return s=eB(t,e,n,i),isFinite(s)&&s>0}),s}(t,n,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==c?c:.5;if(this.triangulation_=new iB(t,n,g,f,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let b=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(b[1]=xk(b[1],f[1],f[3]),b[3]=xk(b[3],f[1],f[3])):b=aE(b,f)),Qk(b)){let n=0,i=0;t.canWrapX()&&(n=uE(m),i=Math.floor((b[0]-m[0])/n)),gE(b.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let e=r.minX;e<=r.maxX;e++)for(let t=r.minY;t<=r.maxY;t++){const r=l(this.sourceZ_,e,t,o);if(r){const t=i*n;this.sourceTiles_.push({tile:r,offset:t})}}++i}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const n=e.tile;if(n&&2==n.getState()){const i=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);i[0]+=e.offset,i[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:i,clipExtent:r,image:n.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),i="number"==typeof n?n:n[0],r="number"==typeof n?n:n[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=nB(i,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(0==n||1==n){t++;const n=NC(e,mC,()=>{const i=e.getState();2!=i&&3!=i&&4!=i||(BC(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t}){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(BC),this.sourcesListenerKeys_=null}release(){this.canvas_&&(lP(this.canvas_.getContext("2d")),JU.push(this.canvas_),this.canvas_=null),super.release()}}class sB{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof SC&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return yk(void 0!==n,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return yk(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){yk(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}function oB(t,e,n,i){return void 0!==i?(i[0]=t,i[1]=e,i[2]=n,i):[t,e,n]}function aB(t,e,n,i,r){return`${GC(t)},${e},${function(t,e,n){return t+"/"+e+"/"+n}(n,i,r)}`}function lB(t,e,n){if(!(n in t))return t[n]=new Set([e]),!0;const i=t[n],r=i.has(e);return r||i.add(e),!r}function cB(t,e,n){const i=t[n];return!!i&&i.delete(e)}function uB(t,e){const n=t.layerStatesArray[t.layerIndex];n.extent&&(e=aE(e,zT(n.extent,t.viewState.projection)));const i=n.layer.getRenderSource();if(!i.getWrapX()){const n=i.getTileGridForProjection(t.viewState.projection).getExtent();n&&(e=aE(e,n))}return e}class hB extends JF{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new mN(0,0,0,0),this.tempTileCoord_=oB(0,0,0);const n=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new sB(n),this.sourceTileCache_=null,this.maxStaleKeys=.5*n}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new sB(512)),this.sourceTileCache_}getOrCreateTile(t,e,n,i){const r=this.tileCache_,s=this.getLayer().getSource(),o=aB(s,s.getKey(),t,e,n);let a;if(r.containsKey(o))a=r.get(o);else{const l=i.viewState.projection,c=s.getProjection();if(a=s.getTile(t,e,n,i.pixelRatio,l,!c||RT(c,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,n,i){return this.getOrCreateTile(t,e,n,i)||null}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),i=$T(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!Nk(r,i))return null;const s=e.viewState,o=n.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let c=a.getZForResolution(s.resolution);c>=a.getMinZoom();--c){const t=a.getTileCoordForCoordAndZ(i,c),n=this.getTile(c,t[1],t[2],e);if(!n||2!==n.getState())continue;const r=a.getOrigin(c),u=sI(a.getTileSize(c)),h=a.getResolution(c);let d;if(n instanceof gN||n instanceof rB)d=n.getImage();else{if(!(n instanceof YU))continue;if(d=HU(n.getData()),!d)continue}const p=Math.floor(l*((i[0]-r[0])/h-t[1]*u[0])),f=Math.floor(l*((r[1]-i[1])/h-t[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const n=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,n,i,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),c=GC(a);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],h=o.getMapInternal(),d=Math.max(n-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),h?h.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,f=p?sE(s.center,s.resolution,p,t.size):void 0;for(let g=n;g>=d;--g){const n=l.getTileRangeForExtentAndZ(e,g,this.tempTileRange_),r=l.getResolution(g);for(let e=n.minX;e<=n.maxX;++e)for(let s=n.minY;s<=n.maxY;++s){if(p&&!l.tileCoordIntersectsViewport([g,e,s],f))continue;const n=this.getTile(g,e,s,t);if(!n)continue;if(!lB(i,n,g))continue;const o=n.getKey();if(u[o]=!0,0===n.getState()&&!t.tileQueue.isKeyQueued(o)){const i=oB(g,e,s,this.tempTileCoord_);t.tileQueue.enqueue([n,c,l.getTileCoordCenter(i),r])}}}}findStaleTile_(t,e){const n=this.tileCache_,i=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let a=0;a0&&setTimeout(()=>{this.enqueueTiles(t,C,h-1,x,S-1)},0),!(h in x))return this.container;const k=GC(this),E=t.time;for(const A of x[h]){const e=A.getState();if(4===e)continue;const n=A.tileCoord;if(2===e&&1===A.getAlpha(k,E)){A.endTransition(k);continue}if(3!==e&&(this.renderComplete=!1),this.findStaleTile_(n,x)){cB(x,A,h),t.animate=!0;continue}if(this.findAltTiles_(u,n,h+1,x))continue;const i=u.getMinZoom();for(let t=h-1;t>=i&&!this.findAltTiles_(u,n,t,x);--t);}const T=d/s*a/g,R=this.getRenderContext(t);WT(this.tempTransform,m/2,y/2,T,T,0,-m/2,-y/2),n.extent&&this.clipUnrotated(R,t,_),c.getInterpolate()||(R.imageSmoothingEnabled=!1),this.preRender(R,t);const P=Object.keys(x).map(Number);let M;P.sort(CC);const I=[],O=[];for(let A=P.length-1;A>=0;--A){const e=P[A],n=c.getTilePixelSize(e,a,r),i=u.getResolution(e)/d,s=n[0]*i*T,o=n[1]*i*T,l=u.getTileCoordForCoordAndZ(lE(w),e),h=u.getTileCoordExtent(l),p=$T(this.tempTransform,[g*(h[0]-w[0])/d,g*(w[3]-h[3])/d]),f=g*c.getGutterForProjection(r);for(const r of x[e]){if(2!==r.getState())continue;const n=r.tileCoord,i=l[1]-n[1],a=Math.round(p[0]-(i-1)*s),u=l[2]-n[2],h=Math.round(p[1]-(u-1)*o),d=Math.round(p[0]-i*s),g=Math.round(p[1]-u*o),m=a-d,y=h-g,_=1===P.length;let v=!1;M=[d,g,d+m,g,d+m,g+y,d,g+y];for(let t=0,r=I.length;t{const n=GC(c),i=e.wantedTiles[n],r=i?Object.keys(i).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,n,i,r,s,o,a){let l;if(t instanceof YU){if(l=HU(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const c=this.getRenderContext(e),u=GC(this),h=e.layerStatesArray[e.layerIndex],d=h.opacity*(a?t.getAlpha(u,e.time):1),p=d!==c.globalAlpha;p&&(c.save(),c.globalAlpha=d),c.drawImage(l,o,o,l.width-2*o,l.height-2*o,n,i,r,s),p&&c.restore(),d!==h.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,n){const i=GC(e);i in t||(t[i]={}),t[i][n.getKey()]=!0}}const dB="preload",pB="useInterimTilesOnError";class fB extends _M{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(dB)}setPreload(t){this.set(dB,t)}getUseInterimTilesOnError(){return this.get(pB)}setUseInterimTilesOnError(t){this.set(pB,t)}getData(t){return super.getData(t)}}class gB extends fB{constructor(t){super(t)}createRenderer(){return new hB(this,{cacheSize:this.getCacheSize()})}}const mB={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},yB={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class _B extends hB{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,n,i,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,n,i,r,s,o,a)}getTile(t,e,n,i){const r=this.getOrCreateTile(t,e,n,i);if(!r)return null;const s=i.viewState,o=s.resolution,a=i.viewHints,l=this.getLayer().getSource(),c=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),h=c.getZForResolution(o,l.zDirection)===t;return u&&h?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=c.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,n){const i=this.getLayer(),r=i.getRevision(),s=i.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(i);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedRenderOrder==s)return;const l=i.getSource(),c=!!i.getDeclutter(),u=l.getTileGrid(),h=l.getTileGridForProjection(n).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,n,t),p=GC(i);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let f=0,g=d.length;ft.value):null;let m;t:for(let y=0,_=d.length;y<_;++y){const e=d[y];if(!hE(l.getTileCoordExtent(e.wrappedTileCoord),c))continue;const i=e.executorGroups[p];for(let r=0,a=i.length;r{const n=this.getLayer(),i=n.getSource(),r=this.renderedProjection,s=r.getExtent(),o=this.renderedResolution,a=i.getTileGridForProjection(r),l=$T(this.renderedPixelToCoordinateTransform_,t.slice()),c=a.getTileCoordForCoordAndResolution(l,o).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);i.getWrapX()&&r.canWrapX()&&!Uk(s,a.getTileCoordExtent(u.tileCoord))&&_E(l,r);const h=GC(n),d=lE(a.getTileCoordExtent(u.wrappedTileCoord)),p=[(l[0]-d[0])/o,(d[1]-l[1])/o],f=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let g=u.hitDetectionImageData[h];if(!g){const t=sI(a.getTileSize(a.getZForResolution(o,i.zDirection))),e=this.renderedRotation_;g=BF(t,[this.getRenderTransform(a.getTileCoordCenter(u.wrappedTileCoord),o,0,UF,t[0]*UF,t[1]*UF,0)],f,n.getStyleFunction(),a.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[h]=g}e(qF(p,f,g))})}getFeaturesInExtent(t){const e=[],n=this.getTileCache();if(0===n.getCount())return e;const i=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=i.getZForResolution(this.renderedResolution),s={};return n.forEach(n=>{if(n.tileCoord[0]!==r||2!==n.getState())return;const o=n.getSourceTiles();for(let r=0,a=o.length;r=0;--i)n[i].execute(this.context,o,this.getTileRenderTransform(e,t),t.viewState.rotation,s,LF,l)}n.globalAlpha=i}renderDeferredInternal(t){const e=this.renderedTiles,n=GC(this.getLayer()),i=e.reduce((t,e,i)=>(e.executorGroups[n].forEach(e=>t.push({executorGroup:e,index:i})),t),[]),r=i.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let o=0,a=i.length;o{r.forEach((e,n)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=i[n],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})})}getTileRenderTransform(t,e){const n=e.pixelRatio,i=e.viewState,r=i.center,s=i.resolution,o=i.rotation,a=e.size,l=Math.round(a[0]*n),c=Math.round(a[1]*n),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),h=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(h,this.tempExtent)[0]-d[0];return qT(GT(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(r,s,o,n,l,c,p))}postRender(t,e){const n=e.viewHints,i=!(n[0]||n[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?yB[s].filter(t=>!LF.includes(t)):yB[s],c=e.viewState,u=c.rotation,h=r.getSource(),d=h.getTileGridForProjection(c.projection).getZForResolution(c.resolution,h.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=GC(r);let _=!0;for(let v=p.length-1;v>=0;--v){const n=p[v];_=_&&!n.getReplayState(r).dirty;const s=n.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===s.length)continue;const o=this.getTileRenderTransform(n,e),c=n.tileCoord[0];let h=!1;const b=s[0].getClipCoords(o);let w,x=t;if(b){w=new xF,x=w.getContext();for(let t=0,e=f.length;t{const t=this.sourceImage_.getState();2!=t&&3!=t||(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){BC(this.sourceListenerKey_),this.sourceListenerKey_=null}}class xB extends DC{constructor(t,e){super(t),this.image=e}}class SB extends uL{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();return e&&(t=e[EC(e,t,0)]),t}getImage(t,e,n,i){const r=this.getProjection();if(!r||!i||RT(r,i))return r&&(i=r),this.getImageInternal(t,e,n,i);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&RT(this.reprojectedImage_.getProjection(),i)&&this.reprojectedImage_.getResolution()==e&&Hk(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new wB(r,i,t,e,n,(t,e,n)=>this.getImageInternal(t,e,n,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,i){if(this.loader){const r=function(t,e,n){const i=e/n,r=nE(t),s=Ik(uE(t)/i,4),o=Ik(oE(t)/i,4);return rE(r,i,0,[s+2*Ik(0*s/2,4),o+2*Ik(0*o/2,4)])}(t,e,n),s=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===i&&(this.wantedExtent_&&Uk(this.wantedExtent_,r)||Uk(this.image.getExtent(),r))&&(this.wantedResolution_&&bB(this.wantedResolution_)===s||bB(this.image.getResolution())===s)))return this.image;this.wantedProjection_=i,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new MO(r,s,n,this.loader),this.image.addEventListener(mC,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case 1:this.loading=!0,n="imageloadstart";break;case 2:this.loading=!1,n="imageloadend";break;case 3:this.loading=!1,n="imageloaderror";break;default:return}this.hasListener(n)&&this.dispatchEvent(new xB(n,e))}}const CB=[0,0,0];class kB{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,yk(function(t){const e=((t,e)=>e-t)||CC;return t.every(function(n,i){if(0===i)return!0;const r=e(t[i-1],n);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let i=0,r=this.resolutions_.length-1;i{const i=new mN(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(n){const t=this.getTileRangeForExtentAndZ(n,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const i=this.getTileRangeForExtentAndZ(t,e);for(let r=i.minX,s=i.maxX;r<=s;++r)for(let t=i.minY,o=i.maxY;t<=o;++t)n([e,r,t])}forEachTileCoordParentTileRange(t,e,n,i){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,i);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=yN(s,s,o,o,n)):r=this.getTileRangeForExtentAndZ(a,l,n),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]this.maxZoom||e0?i:Math.max(s/n[0],r/n[1]);const o=e+1,a=new Array(o);for(let l=0;ln||n>e.getMaxZoom())return!1;const s=e.getFullTileRange(n);return!s||s.containsXY(i,r)}(t,i)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class IB extends DC{constructor(t,e){super(t),this.tile=e}}function OB(t){return function(e){const n=e.buffers,i=e.meta,r=e.imageOps,s=e.width,o=e.height,a=n.length,l=n[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,n=t.inputs[0].height,i=t.inputs.map(function(t){return t.data.buffer}),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:i,meta:t.meta,imageOps:this.imageOps_,width:e,height:n},i);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let a=0;athis.getTileInternal(t,e,n,i,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,n,i,r,s){const o=this.getKey(),a=aB(this,o,t,e,n);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,n,i,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const n=xT(t);if(n){const t=GC(n);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function KB(t,e){if(rk){const n=t.getCrossOrigin();let i="same-origin",r="same-origin";return"anonymous"===n||""===n?(i="cors",r="omit"):"use-credentials"===n&&(i="cors",r="include"),void fetch(e,{mode:i,credentials:r}).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const n=t.getImage();n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0),e.close?.(),n.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}class XB extends HB{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:xT("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)!function(t,e,n){const i=document.createElement("script"),r="olc_"+GC(e);function s(){delete window[r],i.parentNode.removeChild(i)}i.async=!0,i.src=t+(t.includes("?")?"&":"?")+"callback="+r;const o=setTimeout(function(){s(),n&&n()},1e4);window[r]=function(t){clearTimeout(o),s(),e(t)},document.head.appendChild(i)}(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=xT("EPSG:4326"),n=this.getProjection();let i;if(void 0!==t.bounds){const r=PT(e,n);i=pE(t.bounds,r)}const r=PB(n),s=t.minzoom||0,o=TB({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=GB(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==i?i:r;this.setAttributions(function(n){return hE(e,n.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}class YB extends WB{constructor(t){const e=t.projection||"EPSG:3857",n=t.extent||PB(e),i=t.tileGrid||TB({extent:n,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:i,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:ZB,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:bN,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,n){if(0===n.getState()){n.setState(1);const i=n.wrappedTileCoord,r=this.getTileGridForProjection(e);let s=r.getTileCoordExtent(i);const o=i[0],a=r.getResolution(o);zk(s,-a,s);const l=this.projection;e&&this.projection&&!RT(e,l)&&(s=AT(s,e,l));const c=this.tileGrid,u=c.getExtent();u&&aE(s,u,s);let h=a;e&&l&&!RT(e,l)&&(h=a/l.getMetersPerUnit()/e.getMetersPerUnit());const d=c.getZForResolution(h,this.zDirection);c.forEachTileCoord(s,d,i=>{const r=this.tileUrlFunction(i,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(i,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];n.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(n.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const i=s.getState();if(2===i||3===i){const e=s.getKey();e in n.errorTileKeys?2===s.getState()&&delete n.errorTileKeys[e]:n.loadingSourceTiles--,3===i?n.errorTileKeys[e]=!0:s.removeEventListener(mC,t),0===n.loadingSourceTiles&&n.setState(zC(n.errorTileKeys)?2:3)}};s.addEventListener(mC,t),n.loadingSourceTiles++}0===o&&(s.extent=c.getTileCoordExtent(i),s.projection=this.projection,s.resolution=c.getResolution(i[0]),s.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(t=>3===t.getState())?3:2)}return n.sourceTiles}removeSourceTiles(t){const e=t.getKey(),n=t.sourceTiles;for(let i=0,r=n.length;i{u=u&&!this.tileUrlFunction(t,i,l)})}const h=new vN(s,u?4:0,o,this.getSourceTiles.bind(this,i,r),this.removeSourceTiles.bind(this));return h.key=this.getKey(),h}getTileGridForProjection(t){const e=t.getCode();let n=this.tileGrids_[e];if(!n){const i=this.projection;if(null!==i&&!RT(i,t))return EB(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;td?h-A+d:d-A,O=Math.atan(Math.sqrt(M*M+I*I)),q=m*Math.cos(O)+g*Math.sin(O)*Math.cos(f-A),F=Math.cos(O),L=255*q,N=Math.min(Math.max(2*e.sunEl,0),1),U=1.875-1.75*e.opacity,B=.5!==e.opacity?d*((Math.pow(U,O)-1)/(Math.pow(U,d)-1)):O,D={r:(1-F)*v.r*N*255,g:(1-F)*v.g*N*255,b:(1-F)*v.b*N*255,a:(1-F)*v.a*N*255},z=Math.abs(((A+f)/Math.PI+.5)%2-1),j={r:(y.r*(1-z)+_.r*z)*L,g:(y.g*(1-z)+_.g*z)*L,b:(y.b*(1-z)+_.b*z)*L,a:(y.a*(1-z)+_.a*z)*L},T=4*(x*i+w),o[T]=D.r*(1-z)+j.r,o[T+1]=D.g*(1-z)+j.g,o[T+2]=D.b*(1-z)+j.b,o[T+3]=s[T+3]*e.opacity*N*Math.sin(B);return new ImageData(o,i,r)}function QB(t,e){const n=t[0],i=n.width,r=n.height,s=n.data,o=new Uint8ClampedArray(s.length),a=i-1,l=r-1,c=[0,0,0,0];let u,h,d;const p=(f=e.saturation)>0?1-1/(1.001-f):-f;var f;const g=(m=e.contrast)>0?1/(1-m):1+m;var m;const y=function(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}(e.hueRotate),_=y,v=[y[2],y[0],y[1]],b=[y[1],y[2],y[0]],w=e.brightnessLow,x=e.brightnessHigh;for(h=0;h<=l;++h)for(u=0;u<=a;++u){d=4*(h*i+u),c[0]=s[d],c[1]=s[d+1],c[2]=s[d+2],c[3]=s[d+3];const t=c[0],e=c[1],n=c[2],r=(t,e)=>{let n=0;for(let i=0;i{e.accessToken=t,e.accessTokenParam=n})),e}function nq(t,e){let n;return t.some(function(t){if(t.id==e)return n=t.source,!0}),n}function iq(t,e,n){const i=new XB({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=i.getTileJSON(),s=i.getTileGrid(),o=xT(n.projection||"EPSG:3857"),a=function(t,e){const n=t.bounds;if(n){const t=ET([n[0],n[1]],e),i=ET([n[2],n[3]],e);return[t[0],t[1],i[0],i[1]]}return xT(e).getExtent()}(r,o),l=o.getExtent(),c=r.minzoom||0,u=r.maxzoom||22,h={attributions:i.getAttributions(),projection:o,tileGrid:new kB({origin:l?lE(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:tq(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?h.urls=r.tiles:h.url=r.tiles,h}function rq(t,e,n){return new Promise(function(i,r){qN(t,e,n).then(function({tileJson:e,tileLoadFunction:r}){const s=iq(t,e,n);s.tileLoadFunction=r,s.format=new NU({layerName:"mvt:layer"});const o=new YB(s);o.set("mapbox-source",t),i(o)}).catch(r)})}function sq(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function oq(t,e,n){const i=new gB;return function(t,e,n){return new Promise(function(i,r){qN(t,e,n).then(function({tileJson:e,tileLoadFunction:r}){const s=new XB({interpolate:void 0===n.interpolate||n.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=iq(t,e,n).tileGrid,n.projection&&(s.projection=xT(n.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction(function(t,e,n){const i=sq(n);let r=o(t,e,n);if(-1!=r.indexOf(i)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(i,e.toString())}return r}),s.set("mapbox-source",t),i(s)}).catch(function(t){r(t)})})}(t,e,n).then(function(t){i.setSource(t)}).catch(function(){i.setSource(void 0)}),i}function aq(t,e,n){const i=n.projection?new wU({dataProjection:n.projection}):new wU,r=t.data,s={};if("string"==typeof r){const[s]=EN(r,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,n)=>{const i=sq(n);return s.replace(i,`${t.join(",")}`)},r=new gL({attributions:t.attribution,format:i,loader:(t,i,s,o,a)=>{NN("GeoJSON","function"==typeof e?e(t,i,s):e,n).then(t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)}).catch(()=>{r.removeLoadedExtent(t),a()})},strategy:rL});return r.set("mapbox-source",t),r}const o=new gL({attributions:t.attribution,format:i,url:s,loader:(t,e,i,r,a)=>{NN("GeoJSON",s,n).then(t=>{const e=o.getFormat().readFeatures(t,{featureProjection:i});o.addFeatures(e),r(e)}).catch(()=>{o.removeLoadedExtent(t),a()})}});return o}s.features=i.readFeatures(r,{featureProjection:"EPSG:3857"});const o=new gL(Object.assign({attributions:t.attribution,format:i},s));return o.set("mapbox-source",t),o}function lq(t,e,n,i){const r=ON(t),s=t.layers,o=n.type,a=n.source||nq(s,n.ref),l=t.sources[a];let c;if("background"==o)c=function(t,e,n){const i=rk?{style:{}}:document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new _M({source:new uL({}),render(r){const s=function(t,e,n,i){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};let a;r.paint=o,iU.zoom=zN(e,n.resolutions||FN),iU.distanceFromCenter=0;const l=oU(r,"paint","background-color",TN,i);return void 0!==o["background-opacity"]&&(a=oU(r,"paint","background-opacity",TN,i)),"none"==s.visibility?void 0:cU(l,a)}(t,r.viewState.resolution,e,n);return i.style.backgroundColor=s,i}})}(n,i,r);else if("vector"==l.type)c=function(t,e,n){const i=new vB({declutter:!0,visible:!1});return rq(t,e,n).then(function(t){i.setSource(t)}).catch(function(){i.setSource(void 0)}),i}(l,e,i);else if("raster"==l.type){const t=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];Object.keys(n.paint||{}).find(e=>t.includes(e))?(c=function(t,e,n){const i=oq(t,e,n);return new WU({source:new zB({operationType:"image",operation:QB,sources:[i]})})}(l,e,i),c.getSource().on("beforeoperations",function(t){iU.zoom=zN(t.resolution,i.resolutions||FN),iU.distanceFromCenter=0;const e=t.data;e.saturation=oU(n,"paint","raster-saturation",TN,r),e.contrast=oU(n,"paint","raster-contrast",TN,r),e.brightnessHigh=oU(n,"paint","raster-brightness-max",TN,r),e.brightnessLow=oU(n,"paint","raster-brightness-min",TN,r),e.hueRotate=oU(n,"paint","raster-hue-rotate",TN,r)})):c=oq(l,e,i),c.setVisible(!n.layout||"none"!==n.layout.visibility),c.on("prerender",function(t,e,n){let i=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete n[t.id],function(t,e,n,i){iU.zoom=n,iU.distanceFromCenter=0;const r=oU(t,"paint","raster-opacity",TN,i);e.setOpacity(r)}(t,e,i,n))}}(n,c,r))}else if("geojson"==l.type)c=function(t,e,n){return new tL({declutter:!0,source:aq(t,e,n),visible:!1})}(l,e,i);else if("raster-dem"==l.type&&"hillshade"==n.type){const t=function(t,e,n){const i=oq(t,e,n);return new WU({source:new zB({operationType:"image",operation:JB,sources:[i]})})}(l,e,i);c=t,t.getSource().on("beforeoperations",function(t){const e=t.data;e.resolution=ST(i.projection||"EPSG:3857",t.resolution,nE(t.extent),"m"),iU.zoom=zN(t.resolution,i.resolutions||FN),iU.distanceFromCenter=0,e.encoding=l.encoding,e.vert=5*oU(n,"paint","hillshade-exaggeration",TN,r),e.sunAz=oU(n,"paint","hillshade-illumination-direction",TN,r),e.sunEl=35,e.opacity=.3,e.highlightColor=oU(n,"paint","hillshade-highlight-color",TN,r),e.shadowColor=oU(n,"paint","hillshade-shadow-color",TN,r),e.accentColor=oU(n,"paint","hillshade-accent-color",TN,r)}),c.setVisible(!n.layout||"none"!==n.layout.visibility)}const u=a;return c&&c.set("mapbox-source",u),c}function cq(t,e,n,i,r,s={}){let o=24,a=0;const l=n.layers;for(let c=0,u=l.length;c0||n>0)&&t.setMaxResolution(Math.min(DN(Math.max(0,o-1e-12),FN),DN(Math.max(0,n-1e-12),e.getResolutions()))),a<24&&t.setMinResolution(DN(a,FN))}}else o>0&&t.setMaxResolution(DN(Math.max(0,o-1e-12),FN));u instanceof gL||u instanceof YB?function(t,e,n="",i={},r){let s,o,a,l,c=!0;return"string"==typeof n||Array.isArray(n)?l=n:(a=n,l=a.source||a.layers,i=a),"string"==typeof i?(s=i,a={}):(s=i.styleUrl,a=i),!1===a.updateSource&&(c=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:CN(s,a.accessToken),a=eq(s,a)),new Promise(function(n,i){UN(e,a).then(function(e){if(8!=e.version)return i(new Error("glStyle version 8 required."));if(!(t instanceof tL||t instanceof vB))return i(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof vB?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find(function(t){return t.id===l[0]}).source:l:(o=e.layers.find(function(t){return t.source&&e.sources[t.source].type===u}).source,l=o),!o)return i(new Error(`No ${u} source found in the glStyle.`));function h(){if(!c)return Promise.resolve();if(t instanceof vB)return rq(e.sources[o],s,a).then(function(e){const n=t.getSource();n?e!==n&&(n.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof n.setUrls&&"function"==typeof e.getUrls&&n.setUrls(e.getUrls()),n.format_||(n.format_=e.format_),n.getAttributions()||n.setAttributions(e.getAttributions()),n.getTileLoadFunction()===ZB&&n.setTileLoadFunction(e.getTileLoadFunction()),RT(n.getProjection(),e.getProjection())&&(n.tileGrid=e.getTileGrid())):t.setSource(e);const i=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&i.getMinZoom()>0&&t.setMaxResolution(DN(Math.max(0,i.getMinZoom()-1e-12),i.getResolutions()))});const n=e.sources[o];let i=t.getSource();i&&i.get("mapbox-source")===n||(i=aq(n,s,a));const r=t.getSource();return r?i!==r&&(r.getAttributions()||r.setAttributions(i.getAttributions()),r.format_||(r.format_=i.getFormat()),r.url_=i.getUrl()):t.setSource(i),Promise.resolve()}let d,p;const f={},g={};function m(){if(p||e.sprite&&!f)p?(t.setStyle(p),h().then(n).catch(i)):i(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=xT(a.projection).getUnits();"m"!==t&&(r=FN.map(e=>e/TE[t]))}let s;const c=t.getSource();c instanceof YB&&c.format_ instanceof NU&&(s=c.format_.layerName_),p=function(t,e,n,i=FN,r,s,o,a){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");pU[function(t,e){return IN(t)+"."+GC(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const w in s){const e=s[w];FC(()=>e).then(async e=>{let n;if("undefined"!=typeof Image){const i=new Image;if("string"==typeof e)i.crossOrigin="anonymous",i.src=e;else{let t;e instanceof Request?t=await fetch(e):e instanceof Response&&(t=e);const r=await t.blob();n=URL.createObjectURL(r),i.src=n}i.addEventListener("load",function e(){i.removeEventListener("load",e),l[w]={image:i,size:[i.width,i.height]},t.changed(),n&&URL.revokeObjectURL(n)}),i.addEventListener("error",function t(){URL.revokeObjectURL(n),i.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:e}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===e&&(l[w]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const c=ML(e.layers),u={},h=[],d={},p={},f=ON(e),g=function(t){let e=PN[t.id];return e||(e={},PN[IN(t)]=e),e}(e);let m;for(let w=0,x=c.length;w=h.maxzoom)continue;const E=h.filter;if(!E||lU(x,E,T,g)){let i,c,g,b,w,x;const E=u.index;if(3==S&&("fill"==h.type||"fill-extrusion"==h.type))if(c=oU(h,"paint",h.type+"-opacity",T,f,R),h.type+"-pattern"in k){const t=oU(h,"paint",h.type+"-pattern",T,f,R);if(t){const e="string"==typeof t?hU(t,m):t.toString(),n=dU(e,l);if(r&&r[e]&&n){++P,x=v[P],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new uA({fill:new oA}),v[P]=x),g=x.getFill(),x.setZIndex(E);const t=e+"."+c;let i=p[t];if(!i){const s=r[e],o=LN(s.width,s.height),a=o.getContext("2d");a.globalAlpha=c,a.drawImage(n.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),i=a.createPattern(o,"repeat"),p[t]=i}g.setColor(i)}}}else i=cU(oU(h,"paint",h.type+"-color",T,f,R),c),h.type+"-outline-color"in k&&(w=cU(oU(h,"paint",h.type+"-outline-color",T,f,R),c)),w||(w=i),(i||w)&&(++P,x=v[P],(!x||i&&!x.getFill()||!i&&x.getFill()||w&&!x.getStroke()||!w&&x.getStroke()||x.getText())&&(x=new uA({fill:i?new oA:void 0,stroke:w?new cA:void 0}),v[P]=x),i&&(g=x.getFill(),g.setColor(i)),w&&(b=x.getStroke(),b.setColor(w),b.setWidth(.5)),x.setZIndex(E));if(1!=S&&"line"==h.type){i="line-pattern"in k?void 0:cU(oU(h,"paint","line-color",T,f,R),oU(h,"paint","line-opacity",T,f,R));const t=oU(h,"paint","line-width",T,f,R);i&&t>0&&(++P,x=v[P],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new uA({stroke:new cA}),v[P]=x),b=x.getStroke(),b.setLineCap(oU(h,"layout","line-cap",T,f,R)),b.setLineJoin(oU(h,"layout","line-join",T,f,R)),b.setMiterLimit(oU(h,"layout","line-miter-limit",T,f,R)),b.setColor(i),b.setWidth(t),b.setLineDash(k["line-dasharray"]?oU(h,"paint","line-dasharray",T,f,R).map(function(e){return e*t}):null),x.setZIndex(E))}let M,I,O,A,F,L,z,D,j,N=!1,U=null,B=0;if((1==S||2==S)&&"icon-image"in C){const e=oU(h,"layout","icon-image",T,f,R);if(e){let i;M="string"==typeof e?hU(e,m):e.toString();const o=a?a(t,M):void 0,c=dU(M,l);if(r&&r[M]&&c||o){const t=oU(h,"layout","icon-rotation-alignment",T,f,R);if(2==S){const e=n.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const n=e.getExtent();if(Math.sqrt(Math.max(Math.pow((n[2]-n[0])/s,2),Math.pow((n[3]-n[1])/s,2)))>150){const n="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(sU||(rU=[NaN,NaN],sU=new lL("Point",rU,[],2,{},void 0)),i=sU,rU[0]=n[0],rU[1]=n[1],"line"===oU(h,"layout","symbol-placement",T,f,R)&&"map"===t){const t=e.getStride(),i=e.getFlatCoordinates();for(let e=0,r=i.length-t;e=l){B=Math.atan2(s-a,o-r);break}}}}}}if(2!==S||i){const e=oU(h,"layout","icon-size",T,f,R),n=void 0!==k["icon-color"]?oU(h,"paint","icon-color",T,f,R):null;if(!n||0!==n.a){const i=oU(h,"paint","icon-halo-color",T,f,R),s=oU(h,"paint","icon-halo-width",T,f,R);let a=`${M}.${e}.${s}.${i}`;if(null!==n&&(a+=`.${n}`),I=d[a],!I){const l=aU(h,T,"icon",f);let u;"icon-offset"in C&&(u=oU(h,"layout","icon-offset",T,f,R).slice(0),u[0]*=e,u[1]*=-e);let p=n?[255*n.r,255*n.g,255*n.b,n.a]:void 0;if(o){const n={color:p,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?n.src=o:(n.img=o,n.imgSize=[o.width,o.height]),I=new lA(n)}else{const o=r[M];let a,h,d;if(s)o.sdf?(a=VN(GN(c.image,o,n||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,i),p=void 0):a=VN(c.image,o,s,i);else{if(o.sdf&&!c.unSDFed){const t=GN(c.image,{x:0,y:0,width:c.size[0],height:c.size[1]},{r:1,g:1,b:1});c.image=t,c.unSDFed=!0}a=c.image,h=[o.width,o.height],d=[o.x,o.y]}I=new lA({color:p,img:a,imgSize:c.size,size:h,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=I}}I&&(++P,x=v[P],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new uA,v[P]=x),x.setGeometry(i),I.setRotation(B+AN(oU(h,"layout","icon-rotate",T,f,R))),I.setOpacity(oU(h,"paint","icon-opacity",T,f,R)),I.setAnchor(nU[oU(h,"layout","icon-anchor",T,f,R)]),x.setImage(I),U=x.getText(),x.setText(void 0),x.setZIndex(E),N=!0,O=!1)}else O=!0}}}if(1==S&&"circle"===h.type){++P,x=v[P],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new uA,v[P]=x);const t="circle-radius"in k?oU(h,"paint","circle-radius",T,f,R):5,e=cU(oU(h,"paint","circle-stroke-color",T,f,R),oU(h,"paint","circle-stroke-opacity",T,f,R)),n=oU(h,"paint","circle-translate",T,f,R),i=cU(oU(h,"paint","circle-color",T,f,R),oU(h,"paint","circle-opacity",T,f,R)),r=oU(h,"paint","circle-stroke-width",T,f,R),s=t+"."+e+"."+i+"."+r+"."+n[0]+"."+n[1];I=d[s],I||(I=new sA({radius:t,displacement:[n[0],-n[1]],stroke:e&&r>0?new cA({width:r,color:e}):void 0,fill:i?new oA({color:i}):void 0,declutterMode:"none"}),d[s]=I),x.setImage(I),U=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(E),N=!0}if("text-field"in C){z=Math.round(oU(h,"layout","text-size",T,f,R));const t=oU(h,"layout","text-font",T,f,R);L=oU(h,"layout","text-line-height",T,f,R),F=dN(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,z,L),F.includes("sans-serif")||(F+=",sans-serif"),D=oU(h,"layout","text-letter-spacing",T,f,R),j=oU(h,"layout","text-max-width",T,f,R);const n=oU(h,"layout","text-field",T,f,R);A="object"==typeof n&&n.sections?1===n.sections.length?n.toString():n.sections.reduce((e,n)=>{const i=n.fontStack?n.fontStack.split(","):t,r=dN(o?o(i):i,z*(n.scale||1),L);let s=n.text;if("\n"===s)return e.push("\n",""),e;if(2==S)return e.push(HN(s,D),r),e;s=JN(s,r,j,D).split("\n");for(let t=0,o=s.length;t0&&e.push("\n",""),e.push(s[t],r);return e},[]):hU(n,m).trim(),c=oU(h,"paint","text-opacity",T,f,R)}if(A&&c&&!O){N||(++P,x=v[P],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new uA,v[P]=x),x.setImage(void 0),x.setGeometry(void 0));const t=aU(h,T,"text",f);x.getText()||x.setText(U),U=x.getText(),(!U||"getDeclutterMode"in U&&U.getDeclutterMode()!==t)&&(U=new fA({padding:[2,2,2,2],declutterMode:t}),x.setText(U));const e=oU(h,"layout","text-transform",T,f,R);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const n=Array.isArray(A)?A:2==S?HN(A,D):JN(A,F,j,D);if(U.setText(n),U.setFont(F),U.setRotation(AN(oU(h,"layout","text-rotate",T,f,R))),"function"==typeof U.setKeepUpright){const t=oU(h,"layout","text-keep-upright",T,f,R);U.setKeepUpright(t)}const i=oU(h,"layout","text-anchor",T,f,R),r=N||1==S?"point":oU(h,"layout","symbol-placement",T,f,R);let s;if("line-center"===r?(U.setPlacement("line"),s="center"):U.setPlacement(r),"line"===r&&"function"==typeof U.setRepeat){const t=oU(h,"layout","symbol-spacing",T,f,R);U.setRepeat(2*t)}U.setOverflow("point"===r);let o=oU(h,"paint","text-halo-width",T,f,R);const a=oU(h,"layout","text-offset",T,f,R),l=oU(h,"paint","text-translate",T,f,R);let u=0,d=0;if("point"==r){s="center",-1!==i.indexOf("left")?(s="left",d=o):-1!==i.indexOf("right")&&(s="right",d=-o);const t=oU(h,"layout","text-rotation-alignment",T,f,R);U.setRotateWithView("map"==t)}else U.setMaxAngle(AN(oU(h,"layout","text-max-angle",T,f,R))*A.length/n.length),U.setRotateWithView(!1);U.setTextAlign(s);let p="middle";0==i.indexOf("bottom")?(p="bottom",u=-o-.5*(L-1)*z):0==i.indexOf("top")&&(p="top",u=o+.5*(L-1)*z),U.setTextBaseline(p);const g=oU(h,"layout","text-justify",T,f,R);U.setJustify("auto"===g?void 0:g),U.setOffsetX(a[0]*z+d+l[0]),U.setOffsetY(a[1]*z+u+l[1]),_.setColor(cU(oU(h,"paint","text-color",T,f,R),c)),U.setFill(_);const m=cU(oU(h,"paint","text-halo-color",T,f,R),c);if(m&&o>0){y.setColor(m),o*=2;const t=.5*z;y.setWidth(o<=t?o:t),U.setStroke(y)}else U.setStroke(void 0);const b=oU(h,"layout","text-padding",T,f,R),w=U.getPadding();b!==w[0]&&(w[0]=b,w[1]=b,w[2]=b,w[3]=b),x.setZIndex(E)}}}return P>-1?(v.length=P+1,v):void 0};return t.setStyle(b),t.set("mapbox-layers",h),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),b}(t,e,l,r,f,g,(t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(rk)return t;let n;for(let i=0,r=t.length;i{await document.fonts.ready;for(let t=0,i=n.length;tt.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&t.weight==s&&t.style===o)){const t=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",s).replace("{-fontstyle}",o.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",o);if(!document.querySelector('link[href="'+t+'"]')){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}}}})(),t):t}(t,e),a.getImage,s),t.getStyle()?h().then(n).catch(i):i(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=function(t,e,n){if("string"==typeof t)return[{id:"default",url:SN(t,e,n)}];for(const i of t)i.url=SN(i.url,e,n);return t}(e.sprite,a.accessToken,s||location.href);d=rk?1:window.devicePixelRatio>=1.5?.5:1;const n=.5==d?"@2x":"";Promise.all(t.map(function(t){const e=new URL(t.url);let r=e.origin+e.pathname+n+".json"+e.search;return new Promise(function(t,n){NN("Sprite",r,a).then(t).catch(function(){r=e.origin+e.pathname+".json"+e.search,NN("Sprite",r,a).then(t).catch(n)})}).then(function(r){let s;if(void 0===r&&i(new Error("No sprites found.")),s=e.origin+e.pathname+n+".png"+e.search,a.transformRequest){const t=a.transformRequest(s,"SpriteImage")||s;(t instanceof Request||t instanceof Promise)&&(s=t)}g[t.id]=s;for(const e in r){const n="default"==t.id?e:`${t.id}:${e}`;f[n]=r[e]}}).catch(function(t){i(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))})})).then(m).catch(i)}else m()}).catch(i)})}(t,n,e,Object.assign({styleUrl:i},s)).then(function(){!function(t,e){function n(){const n=e.get("mapbox-style");if(!n)return;const i=ML(n.layers),r=t.get("mapbox-layers"),s=i.filter(function(t){return r.includes(t.id)}).some(function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility});t.get("visible")!==s&&t.setVisible(s)}t.on("change",n),n()}(t,r),l()}).catch(c):l()}else c(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const h=r.getLayers();-1===h.getArray().indexOf(t)&&h.push(t),t.getSource()?u():t.once("change:source",u)})}class uq extends iC{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");mapInstance;bookmarkSource;searchOverlay;searchOverlayElement;selectedPinOverlay;selectedPinElement;crosshairElement;crosshairOverlay;setupMap=dC(t=>{if(this.mapInstance)return;const e=new pM;this.bookmarkSource=new gL;const n=new tL({source:this.bookmarkSource,style:[new uA({image:new sA({radius:10,fill:new oA({color:"rgba(0, 0, 0, 0.2)"}),displacement:[0,-2]})}),new uA({image:new sA({radius:9,fill:new oA({color:"#ffcc33"}),stroke:new cA({color:"#fff",width:2})})})],zIndex:10});let i=[14.21683569,27.060114248],r=2.661,s=!1;try{const t=localStorage.getItem("marco:map-view");if(t){const e=JSON.parse(t);e.center&&Array.isArray(e.center)&&2===e.center.length&&"number"==typeof e.zoom&&(i=e.center,r=e.zoom,s=!0)}}catch(w){console.warn("Failed to restore map view:",w)}const o=new HR({center:ET(i),zoom:r,projection:"EPSG:3857"});this.mapInstance=new WA({target:t,layers:[e,n],view:o,controls:vP({zoom:!0,rotate:!0,attribution:!0}),interactions:JP({dragPan:!1})}),function(t,e,n={}){let i,r;if(rk){if(!(t instanceof WA||t instanceof pM))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");r=t}else r="string"==typeof t||t instanceof HTMLElement?new WA({target:t}):t;{const t=e.startsWith("data:")?location.href:CN(e,n.accessToken);n=eq(t,n),i=new Promise(function(i,s){UN(e,n).then(function(e){(function(t,e,n,i){const r=[];let s=null;if(e instanceof WA){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=i.projection?xT(i.projection):s.getProjection();s=new HR(Object.assign(s.getProperties(),{maxResolution:FN[0]/TE[t.getUnits()],projection:i.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter(ET(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(FN[0]/TE[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:n,options:i});const o=t.layers;let a,l,c,u=[];for(let h=0,d=o.length;h';const l=document.createElement("div");l.className="selected-pin-shadow",this.selectedPinElement.appendChild(a),this.selectedPinElement.appendChild(l),this.selectedPinOverlay=new JA({element:this.selectedPinElement,positioning:"bottom-center",stopEvent:!1}),this.mapInstance.addOverlay(this.selectedPinOverlay),this.crosshairElement=document.createElement("div"),this.crosshairElement.className="map-crosshair",this.crosshairElement.innerHTML='\n \n \n \n \n ',t.appendChild(this.crosshairElement),this.locationOverlayElement=document.createElement("div"),this.locationOverlayElement.className="search-pulse blue",this.locationOverlay=new JA({element:this.locationOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.locationOverlay);const c=new TL({trackingOptions:{enableHighAccuracy:!0},projection:o.getProjection()}),u=new QA;u.setStyle(new uA({image:new sA({radius:6,fill:new oA({color:"#3399CC"}),stroke:new cA({color:"#fff",width:2})})}));const h=new gL({features:[u]}),d=new tL({source:h,zIndex:15});c.on("change:position",function(){const t=c.getPosition();u.setGeometry(t?new SR(t):null)});const p=document.createElement("div");p.className="ol-control ol-locate";const f=document.createElement("button");let g,m;f.innerHTML="⊙",f.title="Locate Me",p.appendChild(f);const y=()=>{g&&(clearTimeout(g),g=null);try{m&&(c.un("change:position",_),m=null)}catch{}this.locationOverlayElement&&this.locationOverlayElement.classList.remove("active")},_=()=>{const t=c.getPosition(),e=c.getAccuracyGeometry(),n=c.getAccuracy();if(console.debug("Geolocation change:",{coordinates:t,accuracy:n}),!t)return;const i=this.mapInstance.getSize(),r=this.mapInstance.getView();let s=null;if(this.locationOverlayElement){const e=r.getResolution(),i=2*(n||50)/ST(r.getProjection(),e,t);this.locationOverlayElement.style.width=`${i}px`,this.locationOverlayElement.style.height=`${i}px`,this.locationOverlay.setPosition(t)}if(n&&n<=20&&y(),e){const t=e.getExtent();s=3.162*r.getResolutionForExtent(t,i)}else n&&(s=6.325*n/Math.min(i[0],i[1])/ST(r.getProjection(),1,t));let o={center:t,duration:1e3};if(s){const t=r.getResolutionForZoom(17);o.resolution=Math.max(s,t)}else o.zoom=16;this.mapInstance.getView().animate(o)},v=()=>{console.debug("Getting current geolocation..."),y(),c.setTracking(!0);const t=c.getPosition();this.locationOverlayElement&&this.locationOverlayElement.classList.add("active"),t&&_(),m=c.on("change:position",_),g=setTimeout(()=>{y()},1e4)};f.addEventListener("click",v);const b=new gP({element:p});this.mapInstance.addLayer(d),this.mapInstance.addControl(b),s||"index"!==this.router.currentRouteName||v(),this.mapInstance.on("singleclick",this.handleMapClick),this.mapInstance.on("moveend",this.handleMapMove),this.mapInstance.on("pointermove",t=>{const e=this.mapInstance.getEventPixel(t.originalEvent),n=this.mapInstance.hasFeatureAtPixel(e,{hitTolerance:10});this.mapInstance.getTarget().style.cursor=n?"pointer":""}),this.storage.rs.on("ready",()=>{this.handleMapMove()})});updateInteractions=dC(()=>{if(!this.mapInstance)return;this.mapInstance.getInteractions().getArray().slice().forEach(t=>{t instanceof DP&&this.mapInstance.removeInteraction(t)});const t=!!this.settings.mapKinetic&&new bP(-.005,.05,100);this.settings.mapKinetic&&window.innerWidth<=768&&(t.minVelocity_=.25),this.mapInstance.addInteraction(new DP({kinetic:t}))});updateSelectedPin=dC(()=>{const t=this.mapUi.selectedPlace;if(this.selectedPinOverlay&&this.selectedPinElement)if(t&&t.lat&&t.lon){const e=ET([t.lon,t.lat]);this.selectedPinOverlay.setPosition(e),this.selectedPinElement.classList.remove("active"),this.selectedPinElement.offsetWidth,this.selectedPinElement.classList.add("active"),this.handlePinVisibility(e)}else this.selectedPinElement.classList.remove("active"),this.selectedPinOverlay.setPosition(void 0)});handlePinVisibility(t){if(!this.mapInstance)return;const e=this.mapInstance.getPixelFromCoordinate(t),n=this.mapInstance.getSize();!e||e[0]<0||e[0]>n[0]||e[1]<0||e[1]>n[1]?this.animateToSmartCenter(t):this.panIfObscured(t)}animateToSmartCenter(t){if(!this.mapInstance)return;const e=this.mapInstance.getSize(),n=this.mapInstance.getView(),i=n.getResolution();let r=t;if(e[0]<=768){const n=.25*e[1]*i;r=[t[0],t[1]-n]}n.animate({center:r,duration:1e3,easing:t=>t*(2-t)})}panIfObscured(t){if(!this.mapInstance)return;const e=this.mapInstance.getSize();if(e[0]>768)return;const n=this.mapInstance.getPixelFromCoordinate(t);if(!n)return;const i=e[1],r=i/2;if(n[1]>r){const t=.25*i,e=n[1]-t,r=this.mapInstance.getView(),s=r.getCenter(),o=e*r.getResolution(),a=[s[0],s[1]-o];r.animate({center:a,duration:500,easing:t=>t*(2-t)})}}updateBookmarks=dC(()=>{const t=this.storage.placesInView;this.loadBookmarks(t)});async loadBookmarks(t=[]){try{if(!this.bookmarkSource)return;t&&0!==t.length||(t=this.storage.placesInView),this.bookmarkSource.clear(),t&&Array.isArray(t)&&t.forEach(t=>{if(t.lat&&t.lon){const e=new QA({geometry:new SR(ET([t.lon,t.lat])),name:t.title,id:t.id,isBookmark:!0,originalPlace:t});this.bookmarkSource.addFeature(e)}})}catch(e){console.error("Failed to load bookmarks:",e)}}syncPulse=dC(()=>{this.searchOverlayElement&&(this.mapUi.isSearching?this.searchOverlayElement.classList.add("active"):this.searchOverlayElement.classList.remove("active"))});syncCreationMode=dC(()=>{if(this.crosshairElement&&this.mapInstance)if(this.mapUi.isCreating){this.crosshairElement.classList.add("visible");const t=this.mapUi.creationCoordinates;if(t&&t.lat&&t.lon){const e=ET([t.lon,t.lat]);this.animateToCrosshair(e)}}else this.crosshairElement.classList.remove("visible")});animateToCrosshair(t){if(!this.mapInstance||!this.crosshairElement)return;const e=this.mapInstance.getTargetElement().getBoundingClientRect(),n=this.crosshairElement.getBoundingClientRect(),i=n.left+n.width/2-e.left,r=n.top+n.height/2-e.top,s=this.mapInstance.getSize(),o=i-s[0]/2,a=r-s[1]/2,l=this.mapInstance.getView(),c=l.getResolution(),u=o*c,h=-a*c,d=t[0]-u,p=t[1]-h,f=l.getCenter();Math.sqrt(Math.pow(f[0]-d,2)+Math.pow(f[1]-p,2))>5*c&&l.animate({center:[d,p],duration:800,easing:t=>t*(2-t)})}handleMapMove=async()=>{if(!this.mapInstance)return;if(this.mapUi.isCreating){const t=this.mapInstance.getTargetElement().getBoundingClientRect(),e=this.crosshairElement.getBoundingClientRect(),n=e.left+e.width/2-t.left,i=e.top+e.height/2-t.top,r=TT(this.mapInstance.getCoordinateFromPixel([n,i])),s=parseFloat(r[1].toFixed(6)),o=parseFloat(r[0].toFixed(6));this.mapUi.updateCreationCoordinates(s,o),this.router.replaceWith("place.new",{queryParams:{lat:s,lon:o}})}const t=this.mapInstance.getSize(),e=this.mapInstance.getView().calculateExtent(t),[n,i]=TT([e[0],e[1]]),[r,s]=TT([e[2],e[3]]),o={minLat:i,minLon:n,maxLat:s,maxLon:r};await this.storage.loadPlacesInBounds(o),this.loadBookmarks(this.storage.placesInView);try{const t=this.mapInstance.getView(),e={center:TT(t.getCenter()),zoom:t.getZoom()};localStorage.setItem("marco:map-view",JSON.stringify(e))}catch(a){console.warn("Failed to save map view:",a)}};handleMapClick=async t=>{const e=this.mapInstance.getFeaturesAtPixel(t.pixel,{hitTolerance:10});let n=null,i=null;if(e&&e.length>0){console.debug(`Found ${e.length} features in map layer:`);for(const n of e)console.debug(n);const t=e.find(t=>t.get("isBookmark"));t&&(n=t.get("originalPlace"));const r=e[0].getProperties();r.name&&(i=r.name)}if(this.args.isSidebarOpen)return n?(console.debug("Clicked bookmark while sidebar open (switching):",n),void this.router.transitionTo("place",n)):void(this.args.onOutsideClick&&this.args.onOutsideClick());if(n)return console.debug("Clicked bookmark:",n),void this.router.transitionTo("place",n);if(this.mapInstance.getView().getZoom()<16)return;const r=TT(t.coordinate),[s,o]=r,a=i?30:50;if(this.searchOverlayElement){const e=this.mapInstance.getView(),n=2*a/ST(e.getProjection(),e.getResolution(),t.coordinate);this.searchOverlayElement.style.width=`${n}px`,this.searchOverlayElement.style.height=`${n}px`,this.searchOverlay.setPosition(t.coordinate)}this.mapUi.startSearch();const l={lat:o.toFixed(6),lon:s.toFixed(6)};i&&(l.q=i),this.router.transitionTo("search",{queryParams:l})};static{Zi(Qg({id:null,block:'[[[11,0],[16,0,[29,["map-container ",[52,[30,1],"sidebar-open"]]]],[4,[30,0,["setupMap"]],null,null],[4,[30,0,["updateInteractions"]],null,null],[4,[30,0,["updateBookmarks"]],null,null],[4,[30,0,["updateSelectedPin"]],null,null],[4,[30,0,["syncPulse"]],null,null],[4,[30,0,["syncCreationMode"]],null,null],[12],[13]],["@isSidebarOpen"],["if"]]',moduleName:"/home/basti/src/marco/app/components/map.gjs",isStrictMode:!0}),this)}}const hq={"arrow-left":'',activity:'',bookmark:'',clock:'',edit:'',globe:'',home:'',"log-in":'',"log-out":'',map:'',"map-pin":'',menu:'',navigation:'',phone:'',plus:'',server:'',settings:'',target:'',user:'',x:'',zap:''};class dq extends iC{get svg(){return hq[this.args.name]}get size(){return this.args.size||16}get color(){return this.args.color||"#898989"}get style(){return`width:${this.size}px;height:${this.size}px;color:${this.color}`}get title(){return this.args.title||""}static{Zi(Qg({id:null,block:'[[[41,[30,0,["svg"]],[[[1," "],[10,1],[14,0,"icon"],[15,5,[30,0,["style"]]],[15,"title",[30,0,["title"]]],[12],[1,"\\n "],[1,[28,[32,0],[[30,0,["svg"]]],null]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"/home/basti/src/marco/app/components/icon.gjs",scope:()=>[Fb],isStrictMode:!0}),this)}}class pq extends iC{connectRS(){this.args.onClose(),this.args.storage.connect()}static{Rx(this.prototype,"connectRS",[Mu])}disconnectRS(){this.args.storage.disconnect()}static{Rx(this.prototype,"disconnectRS",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"user-menu-popover"],[12],[1,"\\n "],[10,0],[14,0,"user-status"],[12],[1,"\\n"],[41,[30,1,["connected"]],[[[1," Connected as\\n "],[10,"strong"],[12],[1,[30,1,["userAddress"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n\\n "],[10,"ul"],[14,0,"account-list"],[12],[1,"\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["server",18]],null],[1,"\\n "],[10,1],[12],[1,"RemoteStorage"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,1,["connected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectRS"]]],null],[12],[1,"Disconnect"],[13],[1,"\\n"]],[]],[[[1," "],[11,"button"],[24,0,"btn-text text-primary"],[24,4,"button"],[4,[32,1],["click",[30,0,["connectRS"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item disabled"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["globe",18]],null],[1,"\\n "],[10,1],[12],[1,"OpenStreetMap"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item disabled"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["zap",18]],null],[1,"\\n "],[10,1],[12],[1,"Nostr"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@storage"],["if"]]',moduleName:"/home/basti/src/marco/app/components/user-menu.gjs",scope:()=>[dq,xv],isStrictMode:!0}),this)}}class fq extends iC{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"isUserMenuOpen",[Is],function(){return!1})}#Y=void Px(this,"isUserMenuOpen");toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}static{Rx(this.prototype,"toggleUserMenu",[Mu])}closeUserMenu(){this.isUserMenuOpen=!1}static{Rx(this.prototype,"closeUserMenu",[Mu])}static{Zi(Qg({id:null,block:'[[[10,"header"],[14,0,"app-header"],[12],[1,"\\n "],[10,0],[14,0,"header-left"],[12],[1,"\\n "],[11,"button"],[24,0,"menu-btn btn-press"],[24,"aria-label","Menu"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["menu",24,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"header-right"],[12],[1,"\\n "],[10,0],[14,0,"user-menu-container"],[12],[1,"\\n "],[11,"button"],[24,0,"user-btn btn-press"],[24,"aria-label","User Menu"],[24,4,"button"],[4,[32,0],["click",[30,0,["toggleUserMenu"]]],null],[12],[1,"\\n "],[10,0],[14,0,"user-avatar-placeholder"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["user",20,"white"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["isUserMenuOpen"]],[[[1," "],[8,[32,2],null,[["@storage","@onClose"],[[30,0,["storage"]],[30,0,["closeUserMenu"]]]],null],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,0],["click",[30,0,["closeUserMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleMenu"],["if"]]',moduleName:"/home/basti/src/marco/app/components/app-header.gjs",scope:()=>[xv,dq,pq],isStrictMode:!0}),this)}}function gq(t,e){return t===e}function mq(t){return"object"==typeof t&&t&&"isTruthy"in t&&"boolean"==typeof t.isTruthy?t.isTruthy:Yh(t)?0!==t.length:!!t}function yq(...t){return t.every(t=>!mq(t))}class _q extends iC{static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");updateApi(t){this.settings.updateOverpassApi(t.target.value)}static{Rx(this.prototype,"updateApi",[Mu])}toggleKinetic(t){this.settings.updateMapKinetic("true"===t.target.value)}static{Rx(this.prototype,"toggleKinetic",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar settings-pane"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Marco"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"section"],[14,0,"settings-section"],[12],[1,"\\n "],[10,"h3"],[12],[1,"Settings"],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","map-kinetic"],[12],[1,"Map Inertia (Kinetic Panning)"],[13],[1,"\\n "],[11,"select"],[24,1,"map-kinetic"],[24,0,"form-control"],[4,[32,0],["change",[30,0,["toggleKinetic"]]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","mapKinetic"]],"selected"]],[12],[1,"\\n On\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[28,[32,2],[[30,0,["settings","mapKinetic"]]],null],"selected"]],[12],[1,"\\n Off\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","overpass-api"],[12],[1,"Overpass API Provider"],[13],[1,"\\n "],[11,"select"],[24,1,"overpass-api"],[24,0,"form-control"],[4,[32,0],["change",[30,0,["updateApi"]]],null],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["settings","overpassApis"]]],null]],null],null,[[[1," "],[10,"option"],[15,2,[30,2,["url"]]],[15,"selected",[52,[28,[32,3],[[30,2,["url"]],[30,0,["settings","overpassApi"]]],null],"selected"]],[12],[1,"\\n "],[1,[30,2,["name"]]],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"section"],[14,0,"settings-section"],[12],[1,"\\n "],[10,"h3"],[12],[1,"About"],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Marco"],[13],[1," (as in "],[10,3],[14,6,"https://en.wikipedia.org/wiki/Marco_Polo"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"Marco Polo"],[13],[1,") is an unhosted maps application\\n that respects your privacy and choices.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n Connect your own "],[10,3],[14,6,"https://remotestorage.io/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"remote storage"],[13],[1," to sync place bookmarks across\\n apps and devices.\\n "],[13],[1,"\\n "],[10,"ul"],[14,0,"link-list"],[12],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[10,3],[14,6,"https://gitea.kosmos.org/raucao/marco"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Source Code\\n "],[13],[1," ("],[10,3],[14,6,"https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"AGPL"],[13],[1,")\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[10,3],[14,6,"https://openstreetmap.org/copyright"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Map Data © OpenStreetMap\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onClose","api"],["if","each","-track-array"]]',moduleName:"/home/basti/src/marco/app/components/settings-pane.gjs",scope:()=>[xv,dq,yq,gq],isStrictMode:!0}),this)}}class vq extends Tb{compute(t){for(let e=0,n=t.length;e[lC,fq,xv,uq,vq,_q],isStrictMode:!0}),this)}}const wq=Object.freeze(Object.defineProperty({__proto__:null,default:bq},Symbol.toStringTag,{value:"Module"}));class xq extends Sp{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage")}const Sq=Object.freeze(Object.defineProperty({__proto__:null,default:xq},Symbol.toStringTag,{value:"Module"})),Cq=l_;class kq extends iC{static{Tx(this.prototype,"title",[Is],function(){return""})}#J=void Px(this,"title");static{Tx(this.prototype,"description",[Is],function(){return""})}#Q=void Px(this,"description");constructor(){super(...arguments),this.title=this.args.place?.title||"",this.description=this.args.place?.description||""}get shouldAutofocus(){return"undefined"!=typeof window&&window.innerWidth>768}handleSubmit(t){t.preventDefault(),this.args.onSave&&this.args.onSave({title:this.title,description:this.description})}static{Rx(this.prototype,"handleSubmit",[Mu])}updateTitle(t){this.title=t.target.value}static{Rx(this.prototype,"updateTitle",[Mu])}updateDescription(t){this.description=t.target.value}static{Rx(this.prototype,"updateDescription",[Mu])}static{Zi(Qg({id:null,block:'[[[11,"form"],[24,0,"edit-form"],[4,[32,0],["submit",[30,0,["handleSubmit"]]],null],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-title"],[12],[1,"Title"],[13],[1,"\\n "],[11,"input"],[24,1,"edit-title"],[16,2,[30,0,["title"]]],[24,0,"form-control"],[24,"placeholder","Name of the place"],[16,"autofocus",[30,0,["shouldAutofocus"]]],[24,4,"text"],[4,[32,0],["input",[30,0,["updateTitle"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-desc"],[12],[1,"Description"],[13],[1,"\\n "],[11,"textarea"],[24,1,"edit-desc"],[16,2,[30,0,["description"]]],[24,0,"form-control"],[24,"rows","3"],[24,"placeholder","Add some details..."],[4,[32,0],["input",[30,0,["updateDescription"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[10,"button"],[14,0,"btn btn-blue"],[14,4,"submit"],[12],[1,"Save"],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"Cancel"],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onCancel"],[]]',moduleName:"/home/basti/src/marco/app/components/place-edit-form.gjs",scope:()=>[xv],isStrictMode:!0}),this)}}class Eq extends iC{static{Tx(this.prototype,"isEditing",[Is],function(){return!1})}#tt=void Px(this,"isEditing");get place(){return this.args.place||{}}get tags(){return this.place.osmTags||{}}get name(){return this.place.title||this.tags.name||this.tags["name:en"]||"Unnamed Place"}startEditing(){this.place.createdAt&&(this.isEditing=!0)}static{Rx(this.prototype,"startEditing",[Mu])}cancelEditing(){this.isEditing=!1}static{Rx(this.prototype,"cancelEditing",[Mu])}async saveChanges(t){this.args.onSave&&await this.args.onSave({...this.place,...t}),this.isEditing=!1}static{Rx(this.prototype,"saveChanges",[Mu])}get type(){return AS(this.tags.amenity||this.tags.shop||this.tags.tourism||this.tags.leisure||this.tags.historic||"Point of Interest")}get address(){const t=this.tags,e=[];if(t["addr:street"]){let n=t["addr:street"];t["addr:housenumber"]&&(n+=` ${t["addr:housenumber"]}`),e.push(n)}if(t["addr:city"]){let n=t["addr:city"];t["addr:postcode"]&&(n=`${t["addr:postcode"]} ${n}`),e.push(n)}return 0===e.length?null:e.join(", ")}get phone(){return this.tags.phone||this.tags["contact:phone"]}get website(){return this.place.url||this.tags.website||this.tags["contact:website"]}get websiteDomain(){return new URL(this.website).hostname}get openingHours(){return this.tags.opening_hours}get cuisine(){return this.tags.cuisine?this.tags.cuisine.split(";").map(t=>AS(t)).join(", "):null}get wikipedia(){return this.tags.wikipedia}get geoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`geo:${t},${e}?q=${t},${e}(${encodeURIComponent(this.name)})`:"#"}get visibleGeoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`${t}, ${e}`:""}get osmUrl(){const t=this.place.osmId;return t?`https://www.openstreetmap.org/${this.place.osmType||"node"}/${t}`:null}get gmapsUrl(){return this.place.gmapsId||this.place.osmId?`https://www.google.com/maps/search/?api=1&query=${this.name}&query=${this.place.lat},${this.place.lon}`:null}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"place-details"],[12],[1,"\\n"],[41,[30,0,["isEditing"]],[[[1," "],[8,[32,0],null,[["@place","@onSave","@onCancel"],[[30,0,["place"]],[30,0,["saveChanges"]],[30,0,["cancelEditing"]]]],null],[1,"\\n"]],[]],[[[1," "],[10,"h3"],[12],[1,[30,0,["name"]]],[13],[1,"\\n "],[10,2],[14,0,"place-type"],[12],[1,"\\n "],[1,[30,0,["type"]]],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["place","description"]],[[[1," "],[10,2],[14,0,"place-description"],[12],[1,"\\n "],[1,[30,0,["place","description"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[]]],[1,"\\n "],[10,0],[14,0,"actions"],[12],[1,"\\n "],[11,"button"],[16,0,[52,[30,0,["place","createdAt"]],"btn btn-secondary","btn btn-outline"]],[24,4,"button"],[4,[32,1],["click",[28,[32,2],[[30,1],[30,0,["place"]]],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["bookmark",[52,[30,0,["place","createdAt"]],"currentColor","#007bff"]]],null],[1,"\\n "],[1,[52,[30,0,["place","createdAt"]],"Saved","Save"]],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["place","createdAt"]],[[[1," "],[11,"button"],[24,0,"btn btn-outline"],[24,"title","Edit"],[24,4,"button"],[4,[32,1],["click",[30,0,["startEditing"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["edit","#007bff"]],null],[1,"\\n Edit\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["cuisine"]],[[[1," "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Cuisine:"],[13],[1,"\\n "],[1,[30,0,["cuisine"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["openingHours"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["clock","Opening hours"]],null],[1,"\\n "],[10,1],[12],[1,[30,0,["openingHours"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["phone"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["phone","Phone"]],null],[1,"\\n "],[10,1],[12],[10,3],[15,6,[29,["tel:",[30,0,["phone"]]]]],[12],[1,[30,0,["phone"]]],[13],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["website"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["globe","Website"]],null],[1,"\\n "],[10,1],[12],[10,3],[15,6,[30,0,["website"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,[30,0,["websiteDomain"]]],[13],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["wikipedia"]],[[[1," "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Wikipedia:"],[13],[1,"\\n "],[10,3],[15,6,[29,["https://wikipedia.org/wiki/",[30,0,["wikipedia"]]]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"Article"],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["address"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["home","Address"]],null],[1,"\\n "],[10,1],[12],[1,[30,0,["address"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["map-pin","Geo link"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["geoLink"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["visibleGeoLink"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["osmUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["osmUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n OpenStreetMap\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["gmapsUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["gmapsUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n Google Maps\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleSave"],["if"]]',moduleName:"/home/basti/src/marco/app/components/place-details.gjs",scope:()=>[kq,xv,Cq,dq],isStrictMode:!0}),this)}}const Tq=Ob(function([t]){return AS(t)});class Rq extends iC{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");createNewPlace(){const t=this.router.currentRoute.queryParams,e=t.lat,n=t.lon;e&&n?this.router.transitionTo("place.new",{queryParams:{lat:e,lon:n}}):this.router.transitionTo("place.new",{queryParams:{lat:0,lon:0}})}static{Rx(this.prototype,"createNewPlace",[Mu])}selectPlace(t){this.args.onSelect&&this.args.onSelect(t)}static{Rx(this.prototype,"selectPlace",[Mu])}clearSelection(){this.args.onSelect&&this.args.onSelect(null)}static{Rx(this.prototype,"clearSelection",[Mu])}async toggleSave(t){if(t)if(t.createdAt){if(confirm(`Delete "${t.title}"?`))try{if(await this.storage.removePlace(t),console.debug("Place deleted:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate){const e={...t,id:void 0,geohash:void 0,createdAt:void 0};this.args.onUpdate(e)}this.args.onSelect&&this.args.onSelect(null),this.args.onClose&&this.args.onClose()}catch(e){console.error("Failed to delete:",e),alert("Failed to delete: "+e.message)}}else{const e={title:t.osmTags.name||t.osmTags["name:en"]||"Untitled Place",lat:t.lat,lon:t.lon,tags:[],url:t.osmTags.website,osmId:String(t.osmId||t.id),osmType:t.osmType,osmTags:t.osmTags};try{const t=await this.storage.storePlace(e);console.debug("Place saved:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(t),this.args.onSelect&&this.args.onSelect(t)}catch(Fj){console.error("Failed to save place:",Fj),alert("Failed to save place: "+Fj.message)}}}static{Rx(this.prototype,"toggleSave",[Mu])}async updateBookmark(t){try{const e=await this.storage.updatePlace(t);console.debug("Place updated:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(e)}catch(e){console.error("Failed to update place:",e),alert("Failed to update place: "+e.message)}}static{Rx(this.prototype,"updateBookmark",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n"],[41,[30,1],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["clearSelection"]]],null],[12],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],[[[1," "],[10,"h2"],[12],[8,[32,1],null,[["@name","@size","@color"],["target",20,"#ea4335"]],null],[1," Nearby"],[13],[1,"\\n"]],[]]],[1," "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],null],[12],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n"],[41,[30,1],[[[1," "],[8,[32,2],null,[["@place","@onToggleSave","@onSave"],[[30,1],[30,0,["toggleSave"]],[30,0,["updateBookmark"]]]],null],[1,"\\n"]],[]],[[[41,[30,3],[[[1," "],[10,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,3]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"place-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,3],[[30,0,["selectPlace"]],[30,4]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"place-name"],[12],[1,[28,[32,4],[[30,4,["title"]],[30,4,["osmTags","name"]],[30,4,["osmTags","name:en"]],"Unnamed Place"],null]],[13],[1,"\\n "],[10,0],[14,0,"place-type"],[12],[1,[28,[32,5],[[28,[32,4],[[30,4,["osmTags","amenity"]],[30,4,["osmTags","shop"]],[30,4,["osmTags","tourism"]],[30,4,["osmTags","leisure"]],[30,4,["osmTags","historic"]],"Point of Interest"],null]],null]],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[4]],null],[1," "],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No places found nearby."],[13],[1,"\\n"]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline create-place"],[24,4,"button"],[4,[32,0],["click",[30,0,["createNewPlace"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["plus",18,"#007bff"]],null],[1,"\\n Create new place\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n"],[13]],["@selectedPlace","@onClose","@places","place"],["if","each","-track-array"]]',moduleName:"/home/basti/src/marco/app/components/places-sidebar.gjs",scope:()=>[xv,dq,Eq,Cq,vq,Tq],isStrictMode:!0}),this)}}class Pq extends iC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"localPlace",[Is],function(){return null})}#et=void Px(this,"localPlace");constructor(){super(...arguments),this.localPlace=this.args.model}get place(){const t=this.args.model,e=t.osmId||t.id;return this.storage.findPlaceById(e)||(!this.localPlace||this.localPlace.osmId!==e&&this.localPlace.id!==e?t.createdAt?{...t,id:void 0,createdAt:void 0,geohash:void 0}:t:this.localPlace)}handleUpdate(t){console.debug("Updating local place state:",t),this.localPlace=t,this.storage.notifyChange()}static{Rx(this.prototype,"handleUpdate",[Mu])}refreshMap(){this.storage.notifyChange()}static{Rx(this.prototype,"refreshMap",[Mu])}navigateBack(t){null===t?this.mapUi.returnToSearch?window.history.back():this.router.transitionTo("index"):this.router.transitionTo("place",t)}static{Rx(this.prototype,"navigateBack",[Mu])}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}static{Zi(Qg({id:null,block:'[[[8,[32,0],null,[["@selectedPlace","@onClose","@onSelect","@onBookmarkChange","@onUpdate"],[[30,0,["place"]],[30,0,["close"]],[30,0,["navigateBack"]],[30,0,["refreshMap"]],[30,0,["handleUpdate"]]]],null]],[],[]]',moduleName:"/home/basti/src/marco/app/templates/place.gjs",scope:()=>[Rq],isStrictMode:!0}),this)}}const Mq=Object.freeze(Object.defineProperty({__proto__:null,default:Pq},Symbol.toStringTag,{value:"Module"}));class Iq extends Sp{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");async model(t){const e=t.place_id;if(e.startsWith("osm:node:")||e.startsWith("osm:way:")){const[,t,n]=e.split(":");return console.debug(`Fetching explicit OSM ${t}:`,n),this.loadOsmPlace(n,t)}await this.waitForSync();let n=this.storage.findPlaceById(e);return n?(console.debug("Found in bookmarks:",n.title),n):(console.warn("Not in bookmarks:",e),null)}async waitForSync(){if(this.storage.initialSyncDone)return;console.debug("Waiting for initial storage sync...");const t=Date.now();for(;!this.storage.initialSyncDone;){if(Date.now()-t>5e3){console.warn("Timed out waiting for initial sync");break}await new Promise(t=>setTimeout(t,100))}}afterModel(t){t&&this.mapUi.selectPlace(t),this.mapUi.stopSearch()}deactivate(){this.mapUi.clearSelection(),this.mapUi.returnToSearch=!1}async loadOsmPlace(t,e=null){try{const n=await this.osm.getPoiById(t,e);if(n)return console.debug("Found OSM POI:",n),n}catch(n){console.error("Failed to fetch POI",n)}return null}serialize(t){return t.id?{place_id:t.id}:t.osmId&&t.osmType?{place_id:`osm:${t.osmType}:${t.osmId}`}:{place_id:t.osmId}}}const Oq=Object.freeze(Object.defineProperty({__proto__:null,default:Iq},Symbol.toStringTag,{value:"Module"}));class Aq extends iC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");get initialPlace(){return{title:"",description:""}}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}async savePlace(t){try{const e=this.mapUi.creationCoordinates||{lat:this.args.model.lat,lon:this.args.model.lon},n=parseFloat(e.lat.toFixed(6)),i=parseFloat(e.lon.toFixed(6)),r={title:t.title||"Untitled Place",description:t.description,lat:n,lon:i,tags:[],osmTags:{}},s=await this.storage.storePlace(r);console.debug("Created private place:",s.title),this.router.replaceWith("place",s)}catch(e){console.error("Failed to create place:",e),alert("Failed to create place: "+e.message)}}static{Rx(this.prototype,"savePlace",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[8,[32,0],null,[["@name","@size","@color"],["plus-circle",20,"#ea4335"]],null],[1,"\\n New Place"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,1],["click",[30,0,["close"]]],null],[12],[8,[32,0],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,2],[14,0,"helper-text"],[12],[1,"\\n Drag the map to position the crosshair.\\n "],[13],[1,"\\n\\n "],[8,[32,2],null,[["@place","@onSave","@onCancel"],[[30,0,["initialPlace"]],[30,0,["savePlace"]],[30,0,["close"]]]],null],[1,"\\n "],[13],[1,"\\n"],[13]],[],[]]',moduleName:"/home/basti/src/marco/app/templates/place/new.gjs",scope:()=>[dq,xv,kq],isStrictMode:!0}),this)}}const Fq=Object.freeze(Object.defineProperty({__proto__:null,default:Aq},Symbol.toStringTag,{value:"Module"}));class Lq extends Sp{static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0}};model(t){return{lat:parseFloat(t.lat),lon:parseFloat(t.lon)}}setupController(t,e){super.setupController(t,e),e.lat&&e.lon&&this.mapUi.updateCreationCoordinates(e.lat,e.lon),this.mapUi.startCreating()}deactivate(){this.mapUi.stopCreating()}}const zq=Object.freeze(Object.defineProperty({__proto__:null,default:Lq},Symbol.toStringTag,{value:"Module"}));class Dq extends iC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");selectPlace(t){t&&(this.mapUi.returnToSearch=!0,this.router.transitionTo("place",t))}static{Rx(this.prototype,"selectPlace",[Mu])}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}static{Zi(Qg({id:null,block:'[[[8,[32,0],null,[["@places","@onSelect","@onClose"],[[30,1],[30,0,["selectPlace"]],[30,0,["close"]]]],null]],["@model"],[]]',moduleName:"/home/basti/src/marco/app/templates/search.gjs",scope:()=>[Rq],isStrictMode:!0}),this)}}const jq=Object.freeze(Object.defineProperty({__proto__:null,default:Dq},Symbol.toStringTag,{value:"Module"}));class Nq extends Sp{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0},q:{refreshModel:!0}};async model(t){if(!t.lat||!t.lon)return[];const e=parseFloat(t.lat),n=parseFloat(t.lon),i=t.q?30:50;let r=await this.osm.getNearbyPois(e,n,i);return this.storage.savedPlaces.filter(t=>LS(e,n,t.lat,t.lon)<=i).forEach(t=>{r.find(e=>t.osmId&&e.osmId===t.osmId||e.id&&e.id===t.id)||r.push(t)}),r=r.map(t=>({...t,_distance:LS(e,n,t.lat,t.lon)})).sort((t,e)=>t._distance-e._distance),r=r.map(t=>this.storage.findPlaceById(t.osmId)||t),r}afterModel(t,e){const{q:n}=e.to.queryParams;if(n&&t.length>0){let e=null;if(e=t.find(t=>t.osmTags&&(t.osmTags.name===n||t.osmTags["name:en"]===n)),!e){const n=t[0];n._distance<=10&&(e=n)}if(e)return void this.router.replaceWith("place",e)}this.mapUi.stopSearch()}setupController(t,e){super.setupController(t,e),this.mapUi.stopSearch()}error(){return this.mapUi.stopSearch(),!0}static{Rx(this.prototype,"error",[Mu])}}const Uq=Object.freeze(Object.defineProperty({__proto__:null,default:Nq},Symbol.toStringTag,{value:"Module"})),Bq=Object.assign({},hx,{"marco/app":t,"marco/config/environment":mx,"marco/deprecation-workflow":_x,"marco/router":kx,"marco/services/map-ui":Ix,"marco/services/osm":Ax,"marco/services/settings":Lx,"marco/services/storage":OS,"marco/utils/format-text":FS,"marco/utils/geo":zS,"marco/utils/geohash-coverage":tS,"marco/services/page-title":XS,"marco/templates/application":wq,"marco/routes/application":Sq,"marco/templates/place":Mq,"marco/routes/place":Oq,"marco/templates/place/new":Fq,"marco/routes/place/new":zq,"marco/templates/search":jq,"marco/routes/search":Uq},{});class qq{constructor(t,e,n){this.limit=t,this.func=e,this.store=n,this.size=0,this.misses=0,this.hits=0,this.store=n||new Map}get(t){let e=this.store.get(t);return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,e=this.set(t,this.func(t)),e)}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}}const Vq=/[ _]/g,$q=new qq(1e3,t=>{return(e=t,Qq.get(e)).replace(Vq,"-");var e}),Gq=/^(\-|_)+(.)?/,Wq=/(.)(\-|\_|\.|\s)+(.)?/g,Hq=/(^|\/|\.)([a-z])/g,Kq=new qq(1e3,t=>{const e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,i)=>e+(i?i.toUpperCase():""),i=t.split("/");for(let r=0;rt.toUpperCase())}),Xq=/([a-z\d])([A-Z]+)/g,Yq=/\-|\s+/g,Zq=new qq(1e3,t=>t.replace(Xq,"$1_$2").replace(Yq,"_").toLowerCase()),Jq=/([a-z\d])([A-Z])/g,Qq=new qq(1e3,t=>t.replace(Jq,"$1_$2").toLowerCase());class tV{constructor(t){this._entries=t||globalThis.requirejs.entries}moduleNames(){return Object.keys(this._entries)}has(t){return t in this._entries}get(...t){return globalThis.require(...t)}}class eV{static moduleBasedResolver=!0;moduleBasedResolver=!0;_deprecatedPodModulePrefix=!1;_normalizeCache=Object.create(null);static create(t){return new this(t)}moduleNameLookupPatterns=[this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName,this.nestedColocationComponentModuleName];static withModules(t){return class extends(this){static explicitModules=t}}constructor(t){if(Object.assign(this,t),!this._moduleRegistry){let t=this.constructor.explicitModules;t?this._moduleRegistry={moduleNames:()=>Object.keys(t),has:e=>Boolean(t[e]),get:e=>t[e],addModules(e){t=Object.assign({},t,e)}}:(void 0===globalThis.requirejs.entries&&(globalThis.requirejs.entries=globalThis.requirejs._eak_seen),this._moduleRegistry=new tV)}this.pluralizedTypes=this.pluralizedTypes||Object.create(null),this.pluralizedTypes.config||(this.pluralizedTypes.config="config")}makeToString(t,e){return this.namespace.modulePrefix+"@"+e+":"}shouldWrapInClassFactory(){return!1}parseName(t){if(!0===t.parsedName)return t;let e,n,i,r=t.split("@");if(3===r.length){if(0===r[0].length){e=`@${r[1]}`;let t=r[2].split(":");n=t[0],i=t[1]}else e=`@${r[1]}`,n=r[0].slice(0,-1),i=r[2];"template:components"===n&&(i=`components/${i}`,n="template")}else if(2===r.length){let t=r[0].split(":");if(2===t.length)0===t[1].length?(n=t[0],i=`@${r[1]}`):(e=t[1],n=t[0],i=r[1]);else{let t=r[1].split(":");e=r[0],n=t[0],i=t[1]}"template"===n&&0===e.lastIndexOf("components/",0)&&(i=`components/${i}`,e=e.slice(11))}else r=t.split(":"),n=r[0],i=r[1];let s=i,o=this.namespace;return{parsedName:!0,fullName:t,prefix:e||this.prefix({type:n}),type:n,fullNameWithoutType:s,name:i,root:o,resolveMethodName:"resolve"+(a=n,Kq.get(a))};var a}resolveOther(t){nV("`modulePrefix` must be defined",this.namespace.modulePrefix);let e=this.findModuleName(t);if(e){let i=this._extractDefaultExport(e,t);if(void 0===i)throw new Error(` Expected to find: '${t.fullName}' within '${e}' but got 'undefined'. Did you forget to 'export default' within '${e}'?`);return this.shouldWrapInClassFactory(i,t)&&(n=i,i={create:t=>"function"==typeof n.extend?n.extend(t):n}),i}var n}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this._normalize(t))}resolve(t){if("resolver:current"===t)return{create:()=>this};let e,n=this.parseName(t),i=n.resolveMethodName;return"function"==typeof this[i]&&(e=this[i](n)),null==e&&(e=this.resolveOther(n)),e}addModules(t){if(!this._moduleRegistry.addModules)throw new Error("addModules is only supported when your Resolver has been configured to use static modules via Resolver.withModules()");this._moduleRegistry.addModules(t)}_normalize(t){let e=t.split(":");if(e.length>1){let t=e[0];return"component"===t||"helper"===t||"modifier"===t||"template"===t&&0===e[1].indexOf("components/")?t+":"+e[1].replace(/_/g,"-"):t+":"+(n=e[1].replace(/\./g,"/"),$q.get(n))}return t;var n}pluralize(t){return this.pluralizedTypes[t]||(this.pluralizedTypes[t]=t+"s")}podBasedLookupWithPrefix(t,e){let n=e.fullNameWithoutType;return"template"===e.type&&(n=n.replace(/^components\//,"")),t+"/"+n+"/"+e.type}podBasedModuleName(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(e,t)}podBasedComponentsInSubdir(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;if(e+="/components","component"===t.type||/^components/.test(t.fullNameWithoutType))return this.podBasedLookupWithPrefix(e,t)}resolveEngine(t){let e=t.fullNameWithoutType+"/engine";if(this._moduleRegistry.has(e))return this._extractDefaultExport(e)}resolveRouteMap(t){let e=t.fullNameWithoutType,n=e+"/routes";if(this._moduleRegistry.has(n)){let t=this._extractDefaultExport(n);return nV(`The route map for ${e} should be wrapped by 'buildRoutes' before exporting.`,t.isRouteMap),t}}resolveTemplate(t){return this.resolveOther(t)}mainModuleName(t){if("main"===t.fullNameWithoutType)return t.prefix+"/"+t.type}defaultModuleName(t){return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType}nestedColocationComponentModuleName(t){if("component"===t.type)return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType+"/index"}prefix(t){let e=this.namespace.modulePrefix;return this.namespace[t.type+"Prefix"]&&(e=this.namespace[t.type+"Prefix"]),e}findModuleName(t){let e,n=this.moduleNameLookupPatterns;for(let i=0,r=n.length;ii.length+r.length)return t+":"+e.slice(s+i.length,o);let a=n+"/"+this.pluralize(t)+"/";return 0===e.indexOf(a)&&e.length>a.length?t+":"+e.slice(a.length):void 0}_extractDefaultExport(t){let e=this._moduleRegistry.get(t,null,null,!0);return e&&e.default&&(e=e.default),e}}function nV(t,e){if(!e)throw new Error(t)}const iV={};function rV(t){!function(t){globalThis.emberInspectorApps||(globalThis.emberInspectorApps=[]),globalThis.emberInspectorApps.push({app:t,name:`app-${globalThis.emberInspectorApps.length}`,loadCompatInspector:()=>function(t,e){let n=Promise.resolve();if(e&&e.length>0){document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),r=t?.nonce||t?.getAttribute("nonce");i=e.map(t=>{if((t=function(t){return"/"+t}(t))in iV)return;iV[t]=!0;const e=t.endsWith(".css"),n=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${n}`))return;const i=document.createElement("link");return i.rel=e?"stylesheet":"modulepreload",e||(i.as="script"),i.crossOrigin="",i.href=t,r&&i.setAttribute("nonce",r),document.head.appendChild(i),e?new Promise((e,n)=>{i.addEventListener("load",e),i.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${t}`)))}):void 0}),n=Promise.all(i.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))}var i;function r(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return n.then(t=>{for(const e of t||[])"rejected"===e.status&&r(e.reason);return import("./modules-4-12-DP6ACHNt.js").catch(r)})}(0,[])}),globalThis.dispatchEvent&&globalThis.dispatchEvent(new Event("Ember"))}(t)}class sV extends cx{modulePrefix=gx.modulePrefix;podModulePrefix=gx.podModulePrefix;Resolver=eV.withModules(Bq);inspector=rV(this)}sV.create(gx.APP);export{Sr as $,Gr as A,as as B,Cr as C,Ps as D,Lr as E,po as F,ho as G,ts as H,Fs as I,Js as J,Br as K,Ts as L,xs as M,ao as N,Ms as O,is as P,Or as Q,gs as R,$r as S,As as T,$e as U,xr as V,mo as W,Rs as X,Rr as Y,mr as Z,ks as _,Ss as a,St as a$,ss as a0,dr as a1,qr as a2,go as a3,fo as a4,Zs as a5,Nr as a6,uo as a7,Hr as a8,Ws as a9,ne as aA,Qt as aB,Jt as aC,ae as aD,oe as aE,se as aF,Xl as aG,Kl as aH,Hl as aI,tc as aJ,hu as aK,Gl as aL,nc as aM,Jl as aN,Yl as aO,du as aP,sr as aQ,Q as aR,at as aS,Ww as aT,st as aU,al as aV,Ct as aW,tt as aX,nt as aY,no as aZ,W as a_,Ks as aa,Jr as ab,Ur as ac,Ar as ad,yo as ae,Qs as af,_o as ag,gr as ah,fr as ai,Is as aj,Ds as ak,Bv as al,Qv as am,Ni as an,Cb as ao,Ji as ap,cS as aq,Zi as ar,et as as,td as at,g as au,d as av,m as aw,p as ax,u as ay,f as az,us as b,wx as b$,H as b0,er as b1,_t as b2,dt as b3,ft as b4,eo as b5,pt as b6,nr as b7,wt as b8,vt as b9,rc as bA,Tc as bB,Ic as bC,Ac as bD,Yc as bE,au as bF,ou as bG,oc as bH,uu as bI,Uc as bJ,Pc as bK,Hc as bL,zc as bM,jc as bN,qc as bO,cu as bP,lu as bQ,Fc as bR,$c as bS,Vc as bT,Nc as bU,ux as bV,Kw as bW,rd as bX,yS as bY,cd as bZ,G as b_,kt as ba,bt as bb,Rt as bc,X as bd,mt as be,Ih as bf,Qw as bg,Mh as bh,Qu as bi,Sv as bj,vh as bk,Hu as bl,Vu as bm,$u as bn,Fu as bo,Wu as bp,Nu as bq,Lu as br,Zu as bs,Ku as bt,Yu as bu,Uu as bv,zu as bw,Au as bx,Bu as by,qu as bz,qe as c,Ou as c0,ec as c1,ph as c2,Cu as c3,eh as c4,Eu as c5,xS as c6,vS as c7,ka as c8,qf as c9,ol as ca,ar as cb,rC as cc,Qi as cd,ii as ce,wv as cf,En as cg,cn as ch,lo as d,ws as e,Cs as f,Ve as g,zs as h,Kr as i,Ys as j,jr as k,co as l,Wr as m,js as n,$s as o,Vs as p,fs as q,os as r,Ls as s,ls as t,ps as u,ys as v,ms as w,_s as x,Ir as y,Mr as z}; +const t=Object.freeze(Object.defineProperty({__proto__:null,get default(){return oV}},Symbol.toStringTag,{value:"Module"}));!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver(t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)}).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const e="object"==typeof self&&null!==self&&self.Object===Object&&"undefined"!=typeof Window&&self.constructor===Window&&"object"==typeof document&&null!==document&&self.document===document&&"object"==typeof location&&null!==location&&self.location===location&&"object"==typeof history&&null!==history&&self.history===history&&"object"==typeof navigator&&null!==navigator&&self.navigator===navigator&&"string"==typeof navigator.userAgent,n=e?self:null,i=e?self.location:null,r=e?self.history:null,s=e?self.navigator.userAgent:"Lynx (textmode)",o=!(!e||"object"!=typeof chrome||"object"==typeof opera),a=!!e&&/Firefox|FxiOS/.test(s),l=Object.freeze(Object.defineProperty({__proto__:null,hasDOM:e,history:r,isChrome:o,isFirefox:a,location:i,userAgent:s,window:n},Symbol.toStringTag,{value:"Module"}));function c(t){return t&&t.Object===Object?t:void 0}const u=c((h="object"==typeof global&&global)&&void 0===h.nodeType?h:void 0)||c("object"==typeof self&&self)||c("object"==typeof window&&window)||"undefined"!=typeof mainContext&&mainContext||new Function("return this")();var h;const d=function(t,e){return void 0===e?{imports:t,exports:t,lookup:t}:{imports:e.imports||t,exports:e.exports||t,lookup:e.lookup||t}}(u,u.Ember);function p(){return d.lookup}function f(t){d.lookup=t}const g={ENABLE_OPTIONAL_FEATURES:!1,EXTEND_PROTOTYPES:{Array:!1},LOG_STACKTRACE_ON_DEPRECATION:!0,LOG_VERSION:!0,RAISE_ON_DEPRECATION:!1,STRUCTURED_PROFILE:!1,_DEBUG_RENDER_TREE:!1,_ALL_DEPRECATIONS_ENABLED:!1,_OVERRIDE_DEPRECATION_VERSION:null,_DEFAULT_ASYNC_OBSERVERS:!1,_RERENDER_LOOP_LIMIT:1e3,EMBER_LOAD_HOOKS:{},FEATURES:{}};function m(){return g}(t=>{if("object"!=typeof t||null===t)return;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||"EXTEND_PROTOTYPES"===i||"EMBER_LOAD_HOOKS"===i)continue;let e=g[i];g[i]=!0===e?!1!==t[i]:!1===e?!0===t[i]:t[i]}let{EMBER_LOAD_HOOKS:e}=t;if("object"==typeof e&&null!==e)for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let t=e[i];Array.isArray(t)&&(g.EMBER_LOAD_HOOKS[i]=t.filter(t=>"function"==typeof t))}let{FEATURES:n}=t;if("object"==typeof n&&null!==n)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(g.FEATURES[i]=!0===n[i])})(u.EmberENV);let y=()=>{},_=()=>{},v=!1;function b(){return v}function w(t){v=Boolean(t)}let x=()=>{};const{toString:S}=Object.prototype,{toString:C}=Function.prototype,{isArray:k}=Array,{keys:E}=Object,{stringify:T}=JSON,R=100,P=/^[\w$]+$/;function M(t){return"number"==typeof t&&2===arguments.length?this:I(t,0)}function I(t,e,n){let i=!1;switch(typeof t){case"undefined":return"undefined";case"object":if(null===t)return"null";if(k(t)){i=!0;break}if(t.toString===S||void 0===t.toString)break;return t.toString();case"function":return t.toString===C?t.name?`[Function:${t.name}]`:"[Function]":t.toString();case"string":return T(t);default:return t.toString()}if(void 0===n)n=new WeakSet;else if(n.has(t))return"[Circular]";return n.add(t),i?function(t,e,n){if(e>4)return"[Array]";let i="[";for(let r=0;r=R){i+=`... ${t.length-R} more items`;break}i+=I(t[r],e,n)}return i+=" ]",i}(t,e+1,n):function(t,e,n){if(e>4)return"[Object]";let i="{",r=E(t);for(let s=0;s=R){i+=`... ${r.length-R} more keys`;break}let o=r[s];i+=`${O(String(o))}: ${I(t[o],e,n)}`}return i+=" }",i}(t,e+1,n)}function O(t){return P.test(t)?t:T(t)}function A(t){let e=t.lookup("renderer:-dom");if(!e)throw new Error("BUG: owner is missing renderer");return e.debugRenderTree.capture()}const F=()=>{};let L=F,z=F,D=F,j=F,N=F,U=F,B=F,q=F,V=function(){return arguments[arguments.length-1]};function $(){}const G=Object.freeze(Object.defineProperty({__proto__:null,_warnIfUsingStrippedFeatureFlags:void 0,assert:y,captureRenderTree:A,debug:D,debugFreeze:N,debugSeal:j,deprecate:$,deprecateFunc:V,getDebugFunction:q,info:L,inspect:M,isTesting:b,registerDeprecationHandler:_,registerWarnHandler:x,runInDebug:U,setDebugFunction:B,setTesting:w,warn:z},Symbol.toStringTag,{value:"Module"}));function W(t){let e=Object.create(null);e[t]=1;for(let n in e)if(n===t)return n;return t}function H(t){return null!==t&&("object"==typeof t||"function"==typeof t)}let K=0;function X(){return++K}const Y="ember",Z=new WeakMap,J=new Map,Q=W(`__ember${Date.now()}`);function tt(t,e=Y){let n=e+X().toString();return H(t)&&Z.set(t,n),n}function et(t){let e;if(H(t))e=Z.get(t),void 0===e&&(e=`${Y}${X()}`,Z.set(t,e));else if(e=J.get(t),void 0===e){let n=typeof t;e="string"===n?`st${X()}`:"number"===n?`nu${X()}`:"symbol"===n?`sy${X()}`:`(${t})`,J.set(t,e)}return e}const nt=void 0,it=/\.(_super|call\(this|apply\(this)/,rt=Function.prototype.toString,st=rt.call(function(){return this}).indexOf("return this")>-1?function(t){return it.test(rt.call(t))}:function(){return!0},ot=new WeakMap,at=Object.freeze(function(){});function lt(t){let e=ot.get(t);return void 0===e&&(e=st(t),ot.set(t,e)),e}ot.set(at,!1);class ct{listeners=void 0;observers=void 0}const ut=new WeakMap;function ht(t){let e=ut.get(t);return void 0===e&&(e=new ct,ut.set(t,e)),e}function dt(t){return ut.get(t)}function pt(t,e){ht(t).observers=e}function ft(t,e){ht(t).listeners=e}const gt=new WeakSet;function mt(t,e){return lt(t)?!gt.has(e)&<(e)?yt(t,yt(e,at)):yt(t,e):t}function yt(t,e){function n(){let n=this._super;this._super=e;let i=t.apply(this,arguments);return this._super=n,i}gt.add(n);let i=ut.get(t);return void 0!==i&&ut.set(n,i),n}function _t(t,e){let n=t;do{let t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return t;n=Object.getPrototypeOf(n)}while(null!==n);return null}let vt,bt,wt;const xt=[];function St(t){return-1!==xt.indexOf(t)}function Ct(t){return W(`__${t}${Q+Math.floor(Math.random()*Date.now()).toString()}__`)}const kt=Symbol,Et=Object.prototype.toString;function Tt(t){return null==t}function Rt(t){if("string"==typeof t)return t;if(null===t)return"null";if(void 0===t)return"undefined";if(Array.isArray(t)){let e="";for(let n=0;n0&&(e+=","),Tt(t[n])||(e+=Rt(t[n]));return e}return"function"==typeof t.toString?t.toString():Et.call(t)}let Pt,Mt,It,Ot,At,Ft,Lt,zt,Dt,jt,Nt=()=>{},Ut=new WeakMap;function Bt(t,e){return null===t?e:Array.isArray(t)?(t.push(e),t):[t,e]}function qt(t,e){Array.isArray(t)?t.forEach(e):null!==t&&e(t)}function Vt(t,e){if(Array.isArray(t)&&t.length>1){let n=t.indexOf(e);return t.splice(n,1),t}return null}function $t(t){let e=Ut.get(t);return void 0===e&&(e={parents:null,children:null,eagerDestructors:null,destructors:null,state:0},Ut.set(t,e)),e}function Gt(t,e){let n=$t(t),i=$t(e);return n.children=Bt(n.children,e),i.parents=Bt(i.parents,t),e}function Wt(t,e,n=!1){let i=$t(t),r=n?"eagerDestructors":"destructors";return i[r]=Bt(i[r],e),e}function Ht(t){let e=$t(t);if(e.state>=1)return;let{parents:n,children:i,eagerDestructors:r,destructors:s}=e;e.state=1,qt(i,Ht),qt(r,e=>{e(t)}),qt(s,e=>{Pt(t,e)}),Mt(()=>{qt(n,e=>{!function(t,e){let n=$t(e);0===n.state&&(n.children=Vt(n.children,t))}(t,e)}),e.state=2})}function Kt(t){let e=Ut.get(t);return void 0!==e&&null!==e.children}function Xt(t){let e=Ut.get(t);return void 0!==e&&e.state>=1}function Yt(t){let e=Ut.get(t);return void 0!==e&&e.state>=2}const Zt=Object.prototype;let Jt;const Qt=kt("undefined");var te=function(t){return t[t.ADD=0]="ADD",t[t.ONCE=1]="ONCE",t[t.REMOVE=2]="REMOVE",t}(te||{});let ee=1;class ne{_descriptors;_mixins;_isInit;_lazyChains;_values;_revisions;source;proto;_parent;_listeners;_listenersVersion=1;_inheritedEnd=-1;_flattenedVersion=0;constructor(t){this._parent=void 0,this._descriptors=void 0,this._mixins=void 0,this._lazyChains=void 0,this._values=void 0,this._revisions=void 0,this._isInit=!1,this.source=t,this.proto=void 0===t.constructor?void 0:t.constructor.prototype,this._listeners=void 0}get parent(){let t=this._parent;if(void 0===t){let e=ie(this.source);this._parent=t=null===e||e===Zt?null:ae(e)}return t}setInitializing(){this._isInit=!0}unsetInitializing(){this._isInit=!1}isInitializing(){return this._isInit}isPrototypeMeta(t){return this.proto===this.source&&this.source===t}_getOrCreateOwnMap(t){return this[t]||(this[t]=Object.create(null))}_getOrCreateOwnSet(t){return this[t]||(this[t]=new Set)}_findInheritedMap(t,e){let n=this;for(;null!==n;){let i=n[t];if(void 0!==i){let t=i.get(e);if(void 0!==t)return t}n=n.parent}}_hasInInheritedSet(t,e){let n=this;for(;null!==n;){let i=n[t];if(void 0!==i&&i.has(e))return!0;n=n.parent}return!1}valueFor(t){let e=this._values;return void 0!==e?e[t]:void 0}setValueFor(t,e){this._getOrCreateOwnMap("_values")[t]=e}revisionFor(t){let e=this._revisions;return void 0!==e?e[t]:void 0}setRevisionFor(t,e){this._getOrCreateOwnMap("_revisions")[t]=e}writableLazyChainsFor(t){let e=this._getOrCreateOwnMap("_lazyChains"),n=e[t];return void 0===n&&(n=e[t]=[]),n}readableLazyChainsFor(t){let e=this._lazyChains;if(void 0!==e)return e[t]}addMixin(t){this._getOrCreateOwnSet("_mixins").add(t)}hasMixin(t){return this._hasInInheritedSet("_mixins",t)}forEachMixins(t){let e,n=this;for(;null!==n;){let i=n._mixins;void 0!==i&&(e=void 0===e?new Set:e,i.forEach(n=>{e.has(n)||(e.add(n),t(n))})),n=n.parent}}writeDescriptors(t,e){(this._descriptors||(this._descriptors=new Map)).set(t,e)}peekDescriptors(t){let e=this._findInheritedMap("_descriptors",t);return e===Qt?void 0:e}removeDescriptors(t){this.writeDescriptors(t,Qt)}forEachDescriptors(t){let e,n=this;for(;null!==n;){let i=n._descriptors;void 0!==i&&(e=void 0===e?new Set:e,i.forEach((n,i)=>{e.has(i)||(e.add(i),n!==Qt&&t(i,n))})),n=n.parent}}addToListeners(t,e,n,i,r){this.pushListener(t,e,n,i?te.ONCE:te.ADD,r)}removeFromListeners(t,e,n){this.pushListener(t,e,n,te.REMOVE)}pushListener(t,e,n,i,r=!1){let s=this.writableListeners(),o=le(s,t,e,n);if(-1!==o&&o0&&(t.splice(0,this._inheritedEnd),this._inheritedEnd=0);for(let n of e)-1===le(t,n.event,n.target,n.method)&&(t.unshift(n),this._inheritedEnd++)}}this._flattenedVersion=ee}return this._listeners}matchingListeners(t){let e,n=this.flattenedListeners();if(void 0!==n)for(let i of n)i.event!==t||i.kind!==te.ADD&&i.kind!==te.ONCE||(void 0===e&&(e=[]),e.push(i.target,i.method,i.kind===te.ONCE));return e}observerEvents(){let t,e=this.flattenedListeners();if(void 0!==e)for(let n of e)n.kind!==te.ADD&&n.kind!==te.ONCE||-1===n.event.indexOf(":change")||(void 0===t&&(t=[]),t.push(n));return t}}const ie=Object.getPrototypeOf,re=new WeakMap;function se(t,e){re.set(t,e)}function oe(t){let e=re.get(t);if(void 0!==e)return e;let n=ie(t);for(;null!==n;){if(e=re.get(n),void 0!==e)return e.proto!==n&&(e.proto=n),e;n=ie(n)}return null}const ae=function(t){let e=oe(t);if(null!==e&&e.source===t)return e;let n=new ne(t);return se(t,n),n};function le(t,e,n,i){for(let r=t.length-1;r>=0;r--){let s=t[r];if(s.event===e&&s.target===n&&s.method===i)return r}return-1}let ce=1;const ue=Symbol("TAG_COMPUTE");function he(t){return t[ue]()}function de(t,e){return e>=t[ue]()}Reflect.set(globalThis,"COMPUTE_SYMBOL",ue);const pe=Symbol("TAG_TYPE");class fe{static combine(t){switch(t.length){case 0:return ve;case 1:return t[0];default:{let e=new fe(2);return e.subtag=t,e}}}constructor(t){this.revision=1,this.lastChecked=1,this.lastValue=1,this.isUpdating=!1,this.subtag=null,this.subtagBufferCache=null,this[pe]=t}[ue](){let{lastChecked:t}=this;if(this.isUpdating)this.lastChecked=++ce;else if(t!==ce){this.isUpdating=!0,this.lastChecked=ce;try{let{subtag:t,revision:e}=this;if(null!==t)if(Array.isArray(t))for(const n of t){let t=n[ue]();e=Math.max(t,e)}else{let n=t[ue]();n===this.subtagBufferCache?e=Math.max(e,this.lastValue):(this.subtagBufferCache=null,e=Math.max(e,n))}this.lastValue=e}finally{this.isUpdating=!1}}return this.lastValue}static updateTag(t,e){let n=t,i=e;i===ve?n.subtag=null:(n.subtagBufferCache=i[ue](),n.subtag=i)}static dirtyTag(t,e){t.revision=++ce,Nt()}}const ge=fe.dirtyTag,me=fe.updateTag;function ye(){return new fe(0)}function _e(){return new fe(1)}const ve=new fe(3);function be(t){return t===ve}class we{[ue](){return NaN}constructor(){this[pe]=100}}const xe=new we;class Se{[ue](){return ce}constructor(){this[pe]=101}}const Ce=new Se,ke=fe.combine;let Ee=_e(),Te=_e(),Re=_e();he(Ee),ge(Ee),he(Ee),me(Ee,ke([Te,Re])),he(Ee),ge(Te),he(Ee),ge(Re),he(Ee),me(Ee,Re),he(Ee),ge(Re),he(Ee);class Pe{add(t){t!==ve&&(this.tags.add(t),this.last=t)}combine(){let{tags:t}=this;return 0===t.size?ve:1===t.size?this.last:ke(Array.from(this.tags))}constructor(){this.tags=new Set,this.last=null}}let Me=null;const Ie=[];function Oe(){Ie.push(Me),Me=new Pe}function Ae(){let t=Me;return Me=Ie.pop()||null,function(t){if(null==t)throw new Error("Expected value to be present");return t}(t).combine()}function Fe(){Ie.push(Me),Me=null}function Le(){Me=Ie.pop()||null}function ze(){return null!==Me}function De(t){null!==Me&&Me.add(t)}const je=Symbol("FN"),Ne=Symbol("LAST_VALUE"),Ue=Symbol("TAG"),Be=Symbol("SNAPSHOT");function qe(t){return{[je]:t,[Ne]:void 0,[Ue]:void 0,[Be]:-1}}function Ve(t){let e=t[je],n=t[Ue],i=t[Be];if(void 0!==n&&de(n,i))De(n);else{Oe();try{t[Ne]=e()}finally{n=Ae(),t[Ue]=n,t[Be]=he(n),De(n)}}return t[Ne]}function $e(t){return be(t[Ue])}function Ge(t){let e;Oe();try{t()}finally{e=Ae()}return e}function We(t){Fe();try{return t()}finally{Le()}}const He=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),Ke=new Set(["fill","push","unshift"]);function Xe(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}class Ye{#t;constructor(t,e){this.#e=_e(),this.#n=new Map,this.#t=e;const n=t.slice(),i=this,r=new Map;let s=!1;return new Proxy(n,{get(t,e){const n=Xe(e);if(null!==n)return i.#i(n),De(i.#e),t[n];if("length"===e)return s?s=!1:De(i.#e),t[e];if(Ke.has(e)&&(s=!0),He.has(e)){let n=r.get(e);return void 0===n&&(n=(...n)=>(De(i.#e),t[e](...n)),r.set(e,n)),n}return t[e]},set(t,e,n){if(i.#t.equals(t[e],n))return!0;t[e]=n;const r=Xe(e);return null!==r?(i.#r(r),i.#s()):"length"===e&&i.#s(),!0},getPrototypeOf:()=>Ye.prototype})}#e;#n;#i(t){let e=this.#n.get(t);void 0===e&&(e=_e(),this.#n.set(t,e)),De(e)}#r(t){const e=this.#n.get(t);e&&ge(e)}#s(){ge(this.#e),this.#n.clear()}}Object.setPrototypeOf(Ye.prototype,Array.prototype);class Ze{#t;#e;#n;#o;#a(t){const e=this.#n;let n=e.get(t);return void 0===n&&(n=_e(),e.set(t,n)),n}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#e=_e(),this.#n=new Map,this.#o=t instanceof Map?new Map(t.entries()):new Map(t),this.#t=e}get(t){return De(this.#a(t)),this.#o.get(t)}has(t){return De(this.#a(t)),this.#o.has(t)}entries(){return De(this.#e),this.#o.entries()}keys(){return De(this.#e),this.#o.keys()}values(){return De(this.#e),this.#o.values()}forEach(t){De(this.#e),this.#o.forEach(t)}get size(){return De(this.#e),this.#o.size}[Symbol.iterator](){let t=this.keys(),e=this;return{next(){let n=t.next(),i=n.value;return n.done?{value:[void 0,void 0],done:!0}:{value:[i,e.get(i)],done:!1}}}}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}set(t,e){let n=this.#o.get(t);return n&&this.#t.equals(n,e)||(this.#r(t),n||ge(this.#e),this.#o.set(t,e)),this}delete(t){return!this.#o.has(t)||(this.#r(t),ge(this.#e),this.#n.delete(t),this.#o.delete(t))}clear(){0!==this.#o.size&&(this.#n.forEach(t=>ge(t)),this.#n.clear(),ge(this.#e),this.#o.clear())}}Object.setPrototypeOf(Ze.prototype,Map.prototype);class Je{#t;#n;#e;#i(t){let e=this.#n.get(t);void 0===e&&(e=_e(),this.#n.set(t,e)),De(e)}#r(t){const e=this.#n.get(t);e&&ge(e)}#s(){ge(this.#e)}constructor(t,e){this.#n=new Map,this.#e=_e(),this.#t=e;const n=Object.getPrototypeOf(t),i=Object.getOwnPropertyDescriptors(t),r=Object.create(n);for(const o in i)Object.defineProperty(r,o,i[o]);const s=this;return new Proxy(r,{get:(t,e)=>(s.#i(e),t[e]),has:(t,e)=>(s.#i(e),e in t),ownKeys:t=>(De(s.#e),Reflect.ownKeys(t)),set:(t,e,n)=>(s.#t.equals(t[e],n)||(t[e]=n,s.#r(e),s.#s()),!0),deleteProperty:(t,e)=>(e in t&&(delete t[e],s.#r(e),s.#n.delete(e),s.#s()),!0),getPrototypeOf:()=>Je.prototype})}}class Qe{#t;#e;#n;#o;#a(t){const e=this.#n;let n=e.get(t);return void 0===n&&(n=_e(),e.set(t,n)),n}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#e=_e(),this.#n=new Map,this.#o=new Set(t),this.#t=e}has(t){return De(this.#a(t)),this.#o.has(t)}entries(){return De(this.#e),this.#o.entries()}keys(){return De(this.#e),this.#o.keys()}values(){return De(this.#e),this.#o.values()}union(t){return De(this.#e),this.#o.union(t)}intersection(t){return De(this.#e),this.#o.intersection(t)}difference(t){return De(this.#e),this.#o.difference(t)}symmetricDifference(t){return De(this.#e),this.#o.symmetricDifference(t)}isSubsetOf(t){return De(this.#e),this.#o.isSubsetOf(t)}isSupersetOf(t){return De(this.#e),this.#o.isSupersetOf(t)}isDisjointFrom(t){return De(this.#e),this.#o.isDisjointFrom(t)}forEach(t){De(this.#e),this.#o.forEach(t)}get size(){return De(this.#e),this.#o.size}[Symbol.iterator](){return De(this.#e),this.#o[Symbol.iterator]()}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}add(t){if(this.#o.has(t)){if(this.#t.equals(t,t))return this}else ge(this.#e);return this.#r(t),this.#o.add(t),this}delete(t){return!this.#o.has(t)||(this.#r(t),ge(this.#e),this.#n.delete(t),this.#o.delete(t))}clear(){0!==this.#o.size&&(this.#n.forEach(t=>ge(t)),ge(this.#e),this.#n.clear(),this.#o.clear())}}Object.setPrototypeOf(Qe.prototype,Set.prototype);class tn{#t;#n;#o;#a(t){let e=this.#n.get(t);return void 0===e&&(e=_e(),this.#n.set(t,e)),e}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#n=new WeakMap,this.#o=t instanceof WeakMap?t:new WeakMap(t),this.#t=e}get(t){return De(this.#a(t)),this.#o.get(t)}has(t){return De(this.#a(t)),this.#o.has(t)}set(t,e){let n=this.#o.get(t);return n&&this.#t.equals(n,e)||(this.#r(t),this.#o.set(t,e)),this}delete(t){return!this.#o.has(t)||(this.#r(t),this.#n.delete(t),this.#o.delete(t))}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}}Object.setPrototypeOf(tn.prototype,WeakMap.prototype);class en{#t;#n;#o;#a(t){let e=this.#n.get(t);return void 0===e&&(e=_e(),this.#n.set(t,e)),e}#r(t){const e=this.#n.get(t);e&&ge(e)}constructor(t,e){this.#n=new WeakMap,this.#t=e,this.#o=new WeakSet(t)}has(t){return De(this.#a(t)),this.#o.has(t)}add(t){return this.#o.has(t)&&this.#t.equals(t,t)||(this.#o.add(t),this.#r(t)),this}delete(t){return!this.#o.has(t)||(this.#r(t),this.#n.delete(t),this.#o.delete(t))}get[Symbol.toStringTag](){return this.#o[Symbol.toStringTag]}}Object.setPrototypeOf(en.prototype,WeakSet.prototype);const nn=new WeakMap;function rn(t,e,n){let i=void 0===n?nn.get(t):n;if(void 0===i)return;let r=i.get(e);void 0!==r&&ge(r,!0)}function sn(t){let e=nn.get(t);return void 0===e&&(e=new Map,nn.set(t,e)),e}function on(t,e,n){let i=void 0===n?sn(t):n,r=i.get(e);return void 0===r&&(r=_e(),i.set(e,r)),r}function an(t,e){let n=new WeakMap,i="function"==typeof e;return{getter:function(r){let s;return De(on(r,t)),i&&!n.has(r)?(s=e.call(r),n.set(r,s)):s=n.get(r),s},setter:function(e,i){rn(e,t),n.set(e,i)}}}const ln=Symbol("GLIMMER_VALIDATOR_REGISTRATION");if(Reflect.has(globalThis,ln))throw new Error("The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.");Reflect.set(globalThis,ln,!0);const cn=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_CYCLES:void 0,COMPUTE:ue,CONSTANT:0,CONSTANT_TAG:ve,CURRENT_TAG:Ce,CurrentTag:Se,INITIAL:1,VOLATILE:NaN,VOLATILE_TAG:xe,VolatileTag:we,beginTrackFrame:Oe,beginUntrackFrame:Fe,bump:function(){ce++},combine:ke,consumeTag:De,createCache:qe,createTag:ye,createUpdatableTag:_e,debug:{},dirtyTag:ge,dirtyTagFor:rn,endTrackFrame:Ae,endUntrackFrame:Le,getValue:Ve,isConst:$e,isConstTag:be,isTracking:ze,resetTracking:function(){for(;Ie.length>0;)Ie.pop();Me=null},tagFor:on,tagMetaFor:sn,track:Ge,trackedArray:function(t,e){return new Ye(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedData:an,trackedMap:function(t,e){return new Ze(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedObject:function(t,e){return new Je(t??{},{equals:e?.equals??Object.is,description:e?.description})},trackedSet:function(t,e){return new Qe(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedWeakMap:function(t,e){return new tn(t??[],{equals:e?.equals??Object.is,description:e?.description})},trackedWeakSet:function(t,e){return new en(t??[],{equals:e?.equals??Object.is,description:e?.description})},untrack:We,updateTag:me,validateTag:de,valueForTag:he},Symbol.toStringTag,{value:"Module"})),un=Object.freeze([]);function hn(){return un}const dn=hn(),pn=hn();function*fn(t){for(let e=t.length-1;e>=0;e--)yield t[e]}function*gn(t){let e=0;for(const n of t)yield[e++,n]}function mn(t){return!!t&&t.length>0}function yn(t){return 0===t.length?void 0:t[t.length-1]}function _n(){return Object.create(null)}function vn(t){return null!=t}function bn(t){return"function"==typeof t||"object"==typeof t&&null!==t}class wn{constructor(t=[]){this.current=null,this.stack=t}get size(){return this.stack.length}push(t){this.current=t,this.stack.push(t)}pop(){let t=this.stack.pop();return this.current=yn(this.stack)??null,void 0===t?null:t}nth(t){let e=this.stack.length;return eqn(t),null,t.debugLabel):t}function jn(t){return 3===t[Tn]}function Nn(t){const e=zn(()=>qn(t),e=>Vn(t,e));return e.debugLabel=t.debugLabel,e[Tn]=3,e}function Un(t){return t.tag===ve}function Bn(t){return null!==t.update}function qn(t){const e=t;let{tag:n}=e;if(n===ve)return e.lastValue;const{lastRevision:i}=e;let r;if(null!==n&&de(n,i))r=e.lastValue;else{const{compute:t}=e,i=Ge(()=>{r=e.lastValue=t()});n=e.tag=i,e.lastRevision=he(i)}return De(n),r}function Vn(t,e){(0,t.update)(e)}function $n(t,e){const n=t,i=n[Tn];let r,s=n.children;if(null===s)s=n.children=new Map;else{const t=s.get(e);if(t)return t}if(2===i){const t=qn(n);r=vn(t)?Ln(t[e]):Mn}else r=zn(()=>{const t=qn(n);if(vn(t))return At(t,e)},t=>{const i=qn(n);if(vn(i))return Ft(i,e,t)});return s.set(e,r),r}function Gn(t,e){let n=t;for(const i of e)n=$n(n,i);return n}const Wn={},Hn=(t,e)=>e,Kn=(t,e)=>String(e),Xn=t=>null===t?Wn:t;class Yn{get weakMap(){return void 0===this._weakMap&&(this._weakMap=new WeakMap),this._weakMap}get primitiveMap(){return void 0===this._primitiveMap&&(this._primitiveMap=new Map),this._primitiveMap}set(t,e){bn(t)?this.weakMap.set(t,e):this.primitiveMap.set(t,e)}get(t){return bn(t)?this.weakMap.get(t):this.primitiveMap.get(t)}}const Zn=new Yn;function Jn(t){let e=new Yn;return(n,i)=>{let r=t(n,i),s=e.get(r)||0;return e.set(r,s+1),0===s?r:function(t,e){let n=Zn.get(t);void 0===n&&(n=[],Zn.set(t,n));let i=n[e];return void 0===i&&(i={value:t,count:e},n[e]=i),i}(r,s)}}function Qn(t,e){return zn(()=>{let n=qn(t),i=function(t){switch(t){case"@key":return Jn(Hn);case"@index":return Jn(Kn);case"@identity":return Jn(Xn);default:return e=t,Jn(t=>Lt(t,e))}var e}(e);if(Array.isArray(n))return new ni(n,i);let r=It(n);return null===r?new ni(un,()=>null):new ei(r,i)})}function ti(t){let e=t,n=ye();return zn(()=>(De(n),e),t=>{e!==t&&(e=t,ge(n))})}class ei{constructor(t,e){this.inner=t,this.keyFor=e}isEmpty(){return this.inner.isEmpty()}next(){let t=this.inner.next();return null!==t&&(t.key=this.keyFor(t.value,t.memo)),t}}let ni=class{constructor(t,e){this.iterator=t,this.keyFor=e,this.pos=0,0===t.length?this.current={kind:"empty"}:this.current={kind:"first",value:t[this.pos]}}isEmpty(){return"empty"===this.current.kind}next(){let t,e=this.current;if("first"===e.kind)this.current={kind:"progress"},t=e.value;else{if(this.pos>=this.iterator.length-1)return null;t=this.iterator[++this.pos]}let{keyFor:n}=this;return{key:n(t,this.pos),value:t,memo:this.pos}}};const ii=Object.freeze(Object.defineProperty({__proto__:null,FALSE_REFERENCE:An,NULL_REFERENCE:In,REFERENCE:Tn,TRUE_REFERENCE:On,UNDEFINED_REFERENCE:Mn,childRefFor:$n,childRefFromParts:Gn,createComputeRef:zn,createConstRef:Fn,createDebugAliasRef:void 0,createInvokableRef:Nn,createIteratorItemRef:ti,createIteratorRef:Qn,createPrimitiveRef:Pn,createReadOnlyRef:Dn,createUnboundRef:Ln,isConstRef:Un,isInvokableRef:jn,isUpdatableRef:Bn,updateRef:Vn,valueForRef:qn},Symbol.toStringTag,{value:"Module"})),ri={Empty:0,dynamicLayout:1,dynamicTag:2,prepareArgs:4,createArgs:8,attributeHook:16,elementHook:32,dynamicScope:64,createCaller:128,updateHook:256,createInstance:512,wrapped:1024,willDestroy:2048,hasSubOwner:4096},si=1024,oi=new WeakMap;function ai(t){return oi.get(t)}function li(t,e){oi.set(t,e)}function ci(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}class ui{constructor(t){this.named=t}get(t,e){const n=this.named[e];if(void 0!==n)return qn(n)}has(t,e){return e in this.named}ownKeys(){return Object.keys(this.named)}isExtensible(){return!1}getOwnPropertyDescriptor(t,e){return{enumerable:!0,configurable:!0}}}class hi{constructor(t){this.positional=t}get(t,e){let{positional:n}=this;if("length"===e)return n.length;const i=ci(e);return null!==i&&i{const{named:e,positional:n}=t,i=new ui(e),r=new hi(n),s=Object.create(null),o=new Proxy(s,i),a=new Proxy([],r);return li(o,(t,n)=>function(t,e){return Ge(()=>{e in t&&qn(t[e])})}(e,n)),li(a,(t,e)=>function(t,e){return Ge(()=>{"[]"===e&&t.forEach(qn);const n=ci(e);null!==n&&n{let i=this.getDelegateFor(n);const r=di(e),s=i.createHelper(t,r);if(vi(i)){let t=zn(()=>i.getValue(s),null);return bi(i)&&Gt(t,i.getDestroyable(s)),t}if(bi(i)){let t=Fn(void 0);return Gt(t,i.getDestroyable(s)),t}return Mn}}}class xi{createHelper(t,e){return{fn:t,args:e}}getValue({fn:t,args:e}){return Object.keys(e.named).length>0?t(...e.positional,e.named):t(...e.positional)}getDebugName(t){return t.name?`(helper function ${t.name})`:"(anonymous helper function)"}constructor(){this.capabilities={hasValue:!0,hasDestroyable:!1,hasScheduledEffect:!1}}}const Si=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ei=Object.getPrototypeOf;function Ti(t,e,n){return t.set(n,e),n}function Ri(t,e){let n=e;for(;null!==n;){const e=t.get(n);if(void 0!==e)return e;n=Ei(n)}}function Pi(t,e){return Ti(Ci,t,e)}function Mi(t){const e=Ri(Ci,t);return void 0===e?null:e}function Ii(t,e){return Ti(ki,t,e)}const Oi=new wi(()=>new xi);function Ai(t){let e=Ri(ki,t);return void 0===e&&"function"==typeof t&&(e=Oi),e||null}function Fi(t,e){return Ti(Si,t,e)}function Li(t){const e=Ri(Si,t);return void 0===e?null:e}function zi(t){return void 0!==Ri(Si,t)}function Di(t){return function(t){return"function"==typeof t}(t)||void 0!==Ri(ki,t)}const ji={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1};function Ni(t,e={}){let n=Boolean(e.updateHook);return{asyncLifeCycleCallbacks:Boolean(e.asyncLifecycleCallbacks),destructor:Boolean(e.destructor),updateHook:n}}function Ui(t){return t.capabilities.asyncLifeCycleCallbacks}function Bi(t){return t.capabilities.updateHook}class qi{constructor(t){this.factory=t,this.componentManagerDelegates=new WeakMap}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:i}=this;n=i(t),e.set(t,n)}return n}create(t,e,n){let i=this.getDelegateFor(t),r=di(n.capture()),s=i.createComponent(e,r);return new Vi(s,i,r)}getDebugName(t){return"function"==typeof t?t.name:t.toString()}update(t){let{delegate:e}=t;if(Bi(e)){let{component:n,args:i}=t;e.updateComponent(n,i)}}didCreate({component:t,delegate:e}){Ui(e)&&e.didCreateComponent(t)}didUpdate({component:t,delegate:e}){(function(t){return Ui(t)&&Bi(t)})(e)&&e.didUpdateComponent(t)}didRenderLayout(){}didUpdateLayout(){}getSelf({component:t,delegate:e}){return Fn(e.getContext(t))}getDestroyable(t){const{delegate:e}=t;if(function(t){return t.capabilities.destructor}(e)){const{component:n}=t;return Wt(t,()=>e.destroyComponent(n)),t}return null}getCapabilities(){return ji}}class Vi{constructor(t,e,n){this.component=t,this.delegate=e,this.args=n}}function $i(t,e={}){return{disableAutoTracking:Boolean(e.disableAutoTracking)}}class Gi{constructor(t){this.factory=t,this.componentManagerDelegates=new WeakMap}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:i}=this;n=i(t),e.set(t,n)}return n}create(t,e,n,i){let r,s=this.getDelegateFor(t),o=di(i),a=s.createModifier(n,o);return r={tag:_e(),element:e,delegate:s,args:o,modifier:a},Wt(r,()=>s.destroyModifier(a,o)),r}getDebugName(t){return"function"==typeof t?t.name||t.toString():""}getDebugInstance({modifier:t}){return t}getTag({tag:t}){return t}install({element:t,args:e,modifier:n,delegate:i}){let{capabilities:r}=i;r.disableAutoTracking?We(()=>i.installModifier(n,t,e)):i.installModifier(n,t,e)}update({args:t,modifier:e,delegate:n}){let{capabilities:i}=n;i.disableAutoTracking?We(()=>n.updateModifier(e,t)):n.updateModifier(e,t)}getDestroyable(t){return t}}function Wi(t,e){return Fi(new qi(t),e)}function Hi(t,e){return Pi(new Gi(t),e)}function Ki(t,e){return Ii(new wi(t),e)}const Xi=new WeakMap,Yi=Reflect.getPrototypeOf;function Zi(t,e){return Xi.set(e,t),e}function Ji(t){let e=t;for(;null!==e;){let t=Xi.get(e);if(void 0!==t)return t;e=Yi(e)}}const Qi=Object.freeze(Object.defineProperty({__proto__:null,CustomComponentManager:qi,CustomHelperManager:wi,CustomModifierManager:Gi,capabilityFlagsFrom:fi,componentCapabilities:Ni,getComponentTemplate:Ji,getCustomTagFor:ai,getInternalComponentManager:Li,getInternalHelperManager:Ai,getInternalModifierManager:Mi,hasCapability:yi,hasDestroyable:bi,hasInternalComponentManager:zi,hasInternalHelperManager:Di,hasInternalModifierManager:function(t){return void 0!==Ri(Ci,t)},hasValue:vi,helperCapabilities:_i,managerHasCapability:mi,modifierCapabilities:$i,setComponentManager:Wi,setComponentTemplate:Zi,setCustomTagFor:li,setHelperManager:Ki,setInternalComponentManager:Fi,setInternalHelperManager:Ii,setInternalModifierManager:Pi,setModifierManager:Hi},Symbol.toStringTag,{value:"Module"})),tr=new WeakSet;function er(t){return!!H(t)&&tr.has(t)}function nr(t){H(t)&&tr.add(t)}const ir=new WeakSet;function rr(t){return ir.has(t)}let sr=class{size=0;misses=0;hits=0;constructor(t,e,n=new Map){this.limit=t,this.func=e,this.store=n}get(t){return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,this.set(t,this.func(t)))}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}};const or="6.11.0-beta.1",ar=Object.freeze(Object.defineProperty({__proto__:null,default:or},Symbol.toStringTag,{value:"Module"})),lr=Symbol("OWNER");function cr(t){return t[lr]}function ur(t){return cr(t)}function hr(t,e){!function(t,e){t[lr]=e}(t,e)}function dr(t,e){return Array.isArray(t)?t[e]:t.objectAt(e)}const pr=kt("SELF_TAG");function fr(t,e,n=!1,i){let r=ai(t);return void 0!==r?r(t,e,n):on(t,e,i)}function gr(t){return H(t)?on(t,pr):ve}function mr(t,e){rn(t,e),rn(t,pr)}const yr=new WeakSet;function _r(t,e,n){let i=t.readableLazyChainsFor(e);if(void 0!==i){if(H(n))for(let[t,e]of i)me(t,br(n,e,sn(n),oe(n)));i.length=0}}function vr(t,e,n,i){let r=[];for(let s of e)wr(r,t,s,n,i);return ke(r)}function br(t,e,n,i){return ke(wr([],t,e,n,i))}function wr(t,e,n,i,r){let s,o,a=e,l=i,c=r,u=n.length,h=-1;for(;;){let e=h+1;if(h=n.indexOf(".",e),-1===h&&(h=u),s=n.slice(e,h),"@each"===s&&h!==u){e=h+1,h=n.indexOf(".",e);let i=a.length;if("number"!=typeof i||!Array.isArray(a)&&!("objectAt"in a))break;if(0===i){t.push(fr(a,"[]"));break}s=-1===h?n.slice(e):n.slice(e,h);for(let e=0;e=0;s-=3){let r=i[s],o=i[s+1],a=i[s+2];if(!o)continue;a&&Nr(t,e,r,o),r||(r=t);let l=typeof o;"string"!==l&&"symbol"!==l||(o=r[o]),o.apply(r,n)}return!0}function Br(t,e){let n=oe(t);if(null===n)return!1;let i=n.matchingListeners(e);return void 0!==i&&i.length>0}function qr(...t){let e=t.pop();return ft(e,t),e}const Vr=!g._DEFAULT_ASYNC_OBSERVERS,$r=new Map,Gr=new Map;function Wr(t,e,n,i,r=Vr){let s=Dr(e);jr(t,s,n,i,!1,r);let o=oe(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||Kr(t,s,r)}function Hr(t,e,n,i,r=Vr){let s=Dr(e),o=oe(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||Zr(t,s,r),Nr(t,s,n,i)}function Kr(t,e,n=!1){let i=function(t,e){let n=!0===e?$r:Gr;return n.has(t)||(n.set(t,new Map),Wt(t,()=>function(t){$r.size>0&&$r.delete(t),Gr.size>0&&Gr.delete(t)}(t),!0)),n.get(t)}(t,n);if(i.has(e))i.get(e).count++;else{let n=e.substring(0,e.lastIndexOf(":")),r=br(t,n,sn(t),oe(t));i.set(e,{count:1,path:n,tag:r,lastRevision:he(r),suspended:!1})}}let Xr=!1,Yr=[];function Zr(t,e,n=!1){if(!0===Xr)return void Yr.push([t,e,n]);let i=!0===n?$r:Gr,r=i.get(t);if(void 0!==r){let n=r.get(e);n.count--,0===n.count&&(r.delete(e),0===r.size&&i.delete(t))}}function Jr(t){Gr.has(t)&&Gr.get(t).forEach(e=>{e.tag=br(t,e.path,sn(t),oe(t)),e.lastRevision=he(e.tag)}),$r.has(t)&&$r.get(t).forEach(e=>{e.tag=br(t,e.path,sn(t),oe(t)),e.lastRevision=he(e.tag)})}let Qr=0;function ts(t){let e=he(Ce);Qr!==e&&(Qr=e,Gr.forEach((e,n)=>{let i=oe(n);e.forEach((e,r)=>{if(!de(e.tag,e.lastRevision)){let s=()=>{try{Ur(n,r,[n,e.path],void 0,i)}finally{e.tag=br(n,e.path,sn(n),oe(n)),e.lastRevision=he(e.tag)}};t?t("actions",s):s()}})}))}function es(){$r.forEach((t,e)=>{let n=oe(e);t.forEach((t,i)=>{if(!t.suspended&&!de(t.tag,t.lastRevision))try{t.suspended=!0,Ur(e,i,[e,t.path],void 0,n)}finally{t.tag=br(e,t.path,sn(e),oe(e)),t.lastRevision=he(t.tag),t.suspended=!1}})})}function ns(t,e,n){let i=$r.get(t);if(!i)return;let r=i.get(Dr(e));r&&(r.suspended=n)}const is=Symbol("PROPERTY_DID_CHANGE");let rs=0;function ss(t,e,n,i){let r=void 0===n?oe(t):n;null!==r&&(r.isInitializing()||r.isPrototypeMeta(t))||(mr(t,e),rs<=0&&es(),is in t&&(4===arguments.length?t[is](e,i):t[is](e)))}function os(){rs++,Xr=!0}function as(){rs--,rs<=0&&(es(),function(){Xr=!1;for(let[t,e,n]of Yr)Zr(t,e,n);Yr=[]}())}function ls(t){os();try{t()}finally{as()}}function cs(){}class us extends Cr{_readOnly=!1;_hasConfig=!1;_getter=void 0;_setter=void 0;constructor(t){super();let e=t[t.length-1];if("function"==typeof e||null!==e&&"object"==typeof e){this._hasConfig=!0;let e=t.pop();if("function"==typeof e)this._getter=e;else{const t=e;this._getter=t.get||cs,this._setter=t.set}}t.length>0&&this._property(...t)}setup(t,e,n,i){if(super.setup(t,e,n,i),!1===this._hasConfig){let{get:t,set:e}=n;void 0!==t&&(this._getter=t),void 0!==e&&(this._setter=function(n,i){let r=e.call(this,i);return void 0!==t&&void 0===r?t.call(this):r})}}_property(...t){let e=[];function n(t){e.push(t)}for(let i of t)Lr(i,n);this._dependentKeys=e}get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r),o=i.revisionFor(e);if(void 0!==o&&de(s,o))n=i.valueFor(e);else{let{_getter:o,_dependentKeys:a}=this;We(()=>{n=o.call(t,e)}),void 0!==a&&me(s,vr(t,a,r,i)),i.setValueFor(e,n),i.setRevisionFor(e,he(s)),_r(i,e,n)}return De(s),Array.isArray(n)&&De(on(n,"[]")),n}set(t,e,n){this._readOnly&&this._throwReadOnlyError(t,e);let i,r=ae(t);r.isInitializing()&&void 0!==this._dependentKeys&&this._dependentKeys.length>0&&"function"==typeof t[is]&&t.isComponent&&Wr(t,e,()=>{t[is](e)},void 0,!0);try{os(),i=this._set(t,e,n,r),_r(r,e,i);let s=sn(t),o=on(t,e,s),{_dependentKeys:a}=this;void 0!==a&&me(o,vr(t,a,s,r)),r.setRevisionFor(e,he(o))}finally{as()}return i}_throwReadOnlyError(t,e){throw new Error(`Cannot set read-only property "${e}" on object: ${M(t)}`)}_set(t,e,n,i){let r,s=void 0!==i.revisionFor(e),o=i.valueFor(e),{_setter:a}=this;ns(t,e,!0);try{r=a.call(t,e,n,o)}finally{ns(t,e,!1)}return s&&o===r||(i.setValueFor(e,r),ss(t,e,i,n)),r}teardown(t,e,n){void 0!==n.revisionFor(e)&&(n.setRevisionFor(e,void 0),n.setValueFor(e,void 0)),super.teardown(t,e,n)}}class hs extends us{get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r),o=i.revisionFor(e);if(void 0!==o&&de(s,o))n=i.valueFor(e);else{let{_getter:r}=this,o=Ge(()=>{n=r.call(t,e)});me(s,o),i.setValueFor(e,n),i.setRevisionFor(e,he(s)),_r(i,e,n)}return De(s),Array.isArray(n)&&De(on(n,"[]",r)),n}}class ds extends Function{readOnly(){return Ir(this)._readOnly=!0,this}meta(t){let e=Ir(this);return 0===arguments.length?e._meta||{}:(e._meta=t,this)}get _getter(){return Ir(this)._getter}set enumerable(t){Ir(this).enumerable=t}}function ps(...t){return xr(t)?Rr(new us([]),ds)(t[0],t[1],t[2]):Rr(new us(t),ds)}function fs(...t){return Rr(new hs(t),ds)}function gs(t,e){return Boolean(Mr(t,e))}function ms(t,e,n,i,r){let s=void 0===r?ae(t):r,o=Mr(t,e,s),a=void 0!==o;a&&o.teardown(t,e,s),Or(n)?ys(t,e,n,s):null==n?_s(t,e,i,a,!0):Object.defineProperty(t,e,n),s.isPrototypeMeta(t)||Jr(t)}function ys(t,e,n,i){let r;return r=n(t,e,void 0,i),Object.defineProperty(t,e,r),n}function _s(t,e,n,i,r=!0){return!0===i||!1===r?Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n}):t[e]=n,n}const vs=new sr(1e3,t=>t.indexOf("."));function bs(t){return"string"==typeof t&&-1!==vs.get(t)}const ws=kt("PROXY_CONTENT");function xs(t){return"object"==typeof t&&null!==t&&"function"==typeof t.unknownProperty}function Ss(t,e){return bs(e)?ks(t,e):Cs(t,e)}function Cs(t,e){if(null==t)return;let n;return"object"==typeof t||"function"==typeof t?(n=t[e],void 0===n&&"object"==typeof t&&!(e in t)&&xs(t)&&(n=t.unknownProperty(e)),ze()&&(De(on(t,e)),(Array.isArray(n)||rr(n))&&De(on(n,"[]")))):n=t[e],n}function ks(t,e,n){let i="string"==typeof e?e.split("."):e;for(let r of i){if(null==t||t.isDestroyed)return;if(n&&("__proto__"===r||"constructor"===r))return;t=Cs(t,r)}return t}Cs("foo","a"),Cs("foo",1),Cs({},"a"),Cs({},1),Cs({unknownProperty(){}},"a"),Cs({unknownProperty(){}},1),Ss({},"foo"),Ss({},"foo.bar");let Es={};nr(Es),Ge(()=>Cs({},"a")),Ge(()=>Cs({},1)),Ge(()=>Cs({a:[]},"a")),Ge(()=>Cs({a:Es},"a"));class Ts{_registry;_coreLibIndex;constructor(){this._registry=[],this._coreLibIndex=0}_getLibraryByName(t){let e=this._registry;for(let n of e)if(n.name===t)return n}register(t,e,n){let i=this._registry.length;this._getLibraryByName(t)||(n&&(i=this._coreLibIndex++),this._registry.splice(i,0,{name:t,version:e}))}registerCoreLibrary(t,e){this.register(t,e,!0)}deRegister(t){let e,n=this._getLibraryByName(t);n&&(e=this._registry.indexOf(n),this._registry.splice(e,1))}}const Rs=new Ts;let Ps;function Ms(t,...e){let n,i;xr(e)?n=e:"string"==typeof e[0]&&(i=e[0]);let r=ps({get:function(e){return(ur(this)||this.container).lookup(`${t}:${i||e}`)},set(t,e){ms(this,t,null,e)}});return n?r(n[0],n[1],n[2]):r}function Is(...t){if(!xr(t)){let e=t[0],n=e?e.initializer:void 0,i=e?e.value:void 0,r=function(t,e){return Os([t,e,{initializer:n||(()=>i)}])};return Ar(r),r}return Os(t)}function Os([t,e,n]){let{getter:i,setter:r}=an(e,n?n.initializer:void 0);function s(){let t=i(this);return(Array.isArray(t)||rr(t))&&De(on(t,"[]")),t}function o(t){r(this,t),rn(this,pr)}let a={enumerable:!0,configurable:!0,isTracked:!0,get:s,set:o};return Tr.add(o),ae(t).writeDescriptors(e,new As(s,o)),a}Rs.registerCoreLibrary("Ember",or);class As{constructor(t,e){this._get=t,this._set=e,yr.add(this)}get(t){return this._get.call(t)}set(t,e,n){this._set.call(t,n)}}function Fs(t,e){let n=oe(t);return n?n.valueFor(e):void 0}function Ls(t,e,n,i){return t.isDestroyed?n:bs(e)?function(t,e,n,i){let r=e.split("."),s=r.pop(),o=ks(t,r,!0);if(null!=o)return Ls(o,s,n);if(!i)throw new Error(`Property set failed: object in path "${r.join(".")}" could not be found.`)}(t,e,n,i):zs(t,e,n)}function zs(t,e,n){let i,r=_t(t,e);return null!==r&&Tr.has(r.set)?(t[e]=n,n):(i=t[e],void 0!==i||"object"!=typeof t||e in t||"function"!=typeof t.setUnknownProperty?(t[e]=n,i!==n&&ss(t,e)):t.setUnknownProperty(e,n),n)}function Ds(t,e,n){return Ls(t,e,n,!0)}function js(t){return Rr(new Us(t),Ns)}class Ns extends Function{readOnly(){return Ir(this).readOnly(),this}oneWay(){return Ir(this).oneWay(),this}meta(t){let e=Ir(this);if(0===arguments.length)return e._meta||{};e._meta=t}}class Us extends Cr{altKey;constructor(t){super(),this.altKey=t}setup(t,e,n,i){super.setup(t,e,n,i),yr.add(this)}get(t,e){let n,i=ae(t),r=sn(t),s=on(t,e,r);We(()=>{n=Ss(t,this.altKey)});let o=i.revisionFor(e);return void 0!==o&&de(s,o)||(me(s,br(t,this.altKey,r,i)),i.setRevisionFor(e,he(s)),_r(i,e,n)),De(s),n}set(t,e,n){return Ls(t,this.altKey,n)}readOnly(){this.set=Bs}oneWay(){this.set=qs}}function Bs(t,e){throw new Error(`Cannot set read-only property '${e}' on object: ${M(t)}`)}function qs(t,e,n){return ms(t,e,null),Ls(t,e,n)}function Vs(t,e,n,i){return void 0===e?(e=0,n=i=-1):(void 0===n&&(n=-1),void 0===i&&(i=-1)),Ur(t,"@array:before",[t,e,n,i]),t}function $s(t,e,n,i,r=!0){void 0===e?(e=0,n=i=-1):(void 0===n&&(n=-1),void 0===i&&(i=-1));let s=oe(t);if(r&&((i<0||n<0||i-n!==0)&&ss(t,"length",s),ss(t,"[]",s)),Ur(t,"@array:change",[t,e,n,i]),null!==s){let r=-1===n?0:n,o=t.length-((-1===i?0:i)-r),a=e<0?o+e:e;void 0!==s.revisionFor("firstObject")&&0===a&&ss(t,"firstObject",s),void 0!==s.revisionFor("lastObject")&&o-1{let n=Object.keys(e);for(let i of n)Ls(t,i,e[i])}),e}const to=new WeakMap;function eo(t,e){H(t)&&to.set(t,e)}function no(t){return to.get(t)}const io=Object.prototype.hasOwnProperty;let ro=!1;const so={_set:0,_unprocessedNamespaces:!1,get unprocessedNamespaces(){return this._unprocessedNamespaces},set unprocessedNamespaces(t){this._set++,this._unprocessedNamespaces=t}};let oo=!1;const ao=[],lo=Object.create(null);function co(t){so.unprocessedNamespaces=!0,ao.push(t)}function uo(t){let e=no(t);delete lo[e],ao.splice(ao.indexOf(t),1),e in d.lookup&&t===d.lookup[e]&&(d.lookup[e]=void 0)}function ho(){if(!so.unprocessedNamespaces)return;let t=d.lookup,e=Object.keys(t);for(let n of e){if(!wo(n.charCodeAt(0)))continue;let e=xo(t,n);e&&eo(e,n)}}function po(t){return ro||go(),lo[t]}function fo(t){vo([t.toString()],t,new Set)}function go(){let t=so.unprocessedNamespaces;if(t&&(ho(),so.unprocessedNamespaces=!1),t||oo){let t=ao;for(let e of t)fo(e);oo=!1}}function mo(){return ro}function yo(t){ro=Boolean(t)}function _o(){oo=!0}function vo(t,e,n){let i=t.length,r=t.join(".");lo[r]=e,eo(e,r);for(let s in e){if(!io.call(e,s))continue;let r=e[s];if(t[i]=s,r&&void 0===no(r))eo(r,t.join("."));else if(r&&bo(r)){if(n.has(r))continue;n.add(r),vo(t,r,n)}}t.length=i}function bo(t){return null!=t&&"object"==typeof t&&t.isNamespace}function wo(t){return t>=65&&t<=90}function xo(t,e){try{let n=t[e];return(null!==n&&"object"==typeof n||"function"==typeof n)&&n.isNamespace&&n}catch(n){}}let So;const Co={get onerror(){return So}},ko=setTimeout,Eo=()=>{};function To(t){if("function"==typeof Promise){const e=Promise.resolve();return()=>e.then(t)}if("function"==typeof MutationObserver){let e=0,n=new MutationObserver(t),i=document.createTextNode("");return n.observe(i,{characterData:!0}),()=>(e=++e%2,i.data=""+e,e)}return()=>ko(t,0)}function Ro(t){let e=Eo;return{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),now:()=>Date.now(),next:To(t),clearNext:e}}const Po=/\d+/;function Mo(t){let e=typeof t;return"number"===e&&t==t||"string"===e&&Po.test(t)}function Io(t){return t.onError||t.onErrorTarget&&t.onErrorTarget[t.onErrorMethod]}function Oo(t,e,n){let i=-1;for(let r=0,s=n.length;r=e[n]?r=n+6:s=n;return t>=e[r]?r+6:r}class zo{constructor(t,e={},n={}){this._queueBeingFlushed=[],this.targetQueues=new Map,this.index=0,this._queue=[],this.name=t,this.options=e,this.globalOptions=n}stackFor(t){if(t0){let t=Io(this.globalOptions);s=t?this.invokeWithOnError:this.invoke;for(let o=this.index;o0&&this.flush(!0)}hasWork(){return this._queueBeingFlushed.length>0||this._queue.length>0}cancel({target:t,method:e}){let n=this._queue,i=this.targetQueues.get(t);void 0!==i&&i.delete(e);let r=Oo(t,e,n);return r>-1?(n[r+1]=null,!0):(n=this._queueBeingFlushed,r=Oo(t,e,n),r>-1&&(n[r+1]=null,!0))}push(t,e,n,i){return this._queue.push(t,e,n,i),{queue:this,target:t,method:e}}pushUnique(t,e,n,i){let r=this.targetQueues.get(t);void 0===r&&(r=new Map,this.targetQueues.set(t,r));let s=r.get(e);if(void 0===s){let s=this._queue.push(t,e,n,i)-4;r.set(e,s)}else{let t=this._queue;t[s+2]=n,t[s+3]=i}return{queue:this,target:t,method:e}}_getDebugInfo(t){if(t)return Fo(this._queue,4)}invoke(t,e,n){void 0===n?e.call(t):e.apply(t,n)}invokeWithOnError(t,e,n,i,r){try{void 0===n?e.call(t):e.apply(t,n)}catch(zj){i(zj,r)}}}class Do{constructor(t=[],e){this.queues={},this.queueNameIndex=0,this.queueNames=t,t.reduce(function(t,n){return t[n]=new zo(n,e[n],e),t},this.queues)}schedule(t,e,n,i,r,s){let o=this.queues[t];if(void 0===o)throw new Error(`You attempted to schedule an action in a queue (${t}) that doesn't exist`);if(null==n)throw new Error(`You attempted to schedule an action in a queue (${t}) for a method that doesn't exist`);return this.queueNameIndex=0,r?o.pushUnique(e,n,i,s):o.push(e,n,i,s)}flush(t=!1){let e,n,i=this.queueNames.length;for(;this.queueNameIndexr){let e=i-r;t=new Array(e);for(let n=0;n{aa++,!1!==this._autorun&&(this._autorun=!1,this._autorunStack=null,this._end(!0))};let n=this.options._buildPlatform||Ro;this._platform=n(this._boundAutorunEnd)}get counters(){return{begin:$o,end:Go,events:{begin:Wo,end:0},autoruns:{created:oa,completed:aa},run:Ho,join:Ko,defer:Xo,schedule:Yo,scheduleIterable:Zo,deferOnce:Jo,scheduleOnce:Qo,setTimeout:ta,later:ea,throttle:na,debounce:ia,cancelTimers:ra,cancel:sa,loops:{total:la,nested:ca}}}get defaultQueue(){return this._defaultQueue}begin(){$o++;let t,e=this.options,n=this.currentInstance;return!1!==this._autorun?(t=n,this._cancelAutorun()):(null!==n&&(ca++,this.instanceStack.push(n)),la++,t=this.currentInstance=new Do(this.queueNames,e),Wo++,this._trigger("begin",t,n)),this._onBegin(t,n),t}end(){Go++,this._end(!1)}on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=this._eventCallbacks[t];if(void 0===n)throw new TypeError(`Cannot on() event ${t} because it does not exist`);n.push(e)}off(t,e){let n=this._eventCallbacks[t];if(!t||void 0===n)throw new TypeError(`Cannot off() event ${t} because it does not exist`);let i=!1;if(e)for(let r=0;r0&&Mo(n[r-1])&&(i=parseInt(n.pop(),10)),[t,e,n,i]}(...arguments);return this._later(t,e,n,i)}throttle(){na++;let t,[e,n,i,r,s=!0]=qo(...arguments),o=Ao(e,n,this._timers);if(-1===o)t=this._later(e,n,s?Uo:i,r),s&&this._join(e,n,i);else{t=this._timers[o+1];let e=o+4;this._timers[e]!==Uo&&(this._timers[e]=i)}return t}debounce(){ia++;let t,[e,n,i,r,s=!1]=qo(...arguments),o=this._timers,a=Ao(e,n,o);if(-1===a)t=this._later(e,n,s?Uo:i,r),s&&this._join(e,n,i);else{let s=this._platform.now()+r,l=a+4;o[l]===Uo&&(i=Uo),t=o[a+1];let c=Lo(s,o);if(a+6===c)o[a]=s,o[l]=i;else{let r=this._timers[a+5];this._timers.splice(c,0,s,t,e,n,i,r),this._timers.splice(a,6)}0===a&&this._reinstallTimerTimeout()}return t}cancelTimers(){ra++,this._clearTimerTimeout(),this._timers=[],this._cancelAutorun()}hasTimers(){return this._timers.length>0||this._autorun}cancel(t){if(sa++,null==t)return!1;let e=typeof t;return"number"===e?this._cancelLaterTimer(t):!("object"!==e||!t.queue||!t.method)&&t.queue.cancel(t)}ensureInstance(){this._ensureInstance()}getDebugInfo(){if(this.DEBUG)return{autorun:this._autorunStack,counters:this.counters,timers:Fo(this._timers,6,2),instanceStack:[this.currentInstance,...this.instanceStack].map(t=>t&&t._getDebugInfo(this.DEBUG))}}_end(t){let e=this.currentInstance,n=null;if(null===e)throw new Error("end called without begin");let i,r=!1;try{i=e.flush(t)}finally{if(!r)if(r=!0,1===i){const t=this.queueNames[e.queueNameIndex];this._scheduleAutorun(t)}else this.currentInstance=null,this.instanceStack.length>0&&(n=this.instanceStack.pop(),this.currentInstance=n),this._trigger("end",e,n),this._onEnd(e,n)}}_join(t,e,n){return null===this.currentInstance?this._run(t,e,n):void 0===t&&void 0===n?e():e.apply(t,n)}_run(t,e,n){let i=Io(this.options);if(this.begin(),i)try{return e.apply(t,n)}catch(zj){i(zj)}finally{this.end()}else try{return e.apply(t,n)}finally{this.end()}}_cancelAutorun(){this._autorun&&(this._platform.clearNext(),this._autorun=!1,this._autorunStack=null)}_later(t,e,n,i){let r=this.DEBUG?new Error:void 0,s=this._platform.now()+i,o=Vo++;if(0===this._timers.length)this._timers.push(s,o,t,e,n,r),this._installTimerTimeout();else{let i=Lo(s,this._timers);this._timers.splice(i,0,s,o,t,e,n,r),this._reinstallTimerTimeout()}return o}_cancelLaterTimer(t){for(let e=1;e0&&(this.begin(),this._scheduleExpiredTimers(),this.end())}_scheduleExpiredTimers(){let t=this._timers,e=0,n=t.length,i=this._defaultQueue,r=this._platform.now();for(;er);e+=6){let n=t[e+4];if(n!==Uo){let r=t[e+2],s=t[e+3],o=t[e+5];this.currentInstance.schedule(i,r,s,n,!1,o)}}t.splice(0,e),this._installTimerTimeout()}_reinstallTimerTimeout(){this._clearTimerTimeout(),this._installTimerTimeout()}_clearTimerTimeout(){null!==this._timerTimeoutId&&(this._platform.clearTimeout(this._timerTimeoutId),this._timerTimeoutId=null)}_installTimerTimeout(){if(0===this._timers.length)return;let t=this._timers[0],e=this._platform.now(),n=Math.max(0,t-e);this._timerTimeoutId=this._platform.setTimeout(this._boundRunExpiredTimers,n)}_ensureInstance(){let t=this.currentInstance;return null===t&&(this._autorunStack=this.DEBUG?new Error:void 0,t=this.begin(),this._scheduleAutorun(this.queueNames[0])),t}_scheduleAutorun(t){oa++;const e=this._platform.next,n=this.options.flush;n?n(t,e):e(),this._autorun=!0}}ua.Queue=zo,ua.buildPlatform=Ro,ua.buildNext=To;let ha=null;function da(){return ha}const pa=`${Math.random()}${Date.now()}`.replace(".",""),fa=["actions","routerTransitions","render","afterRender","destroy",pa],ga=new ua(fa,{defaultQueue:"actions",onBegin:function(t){ha=t},onEnd:function(t,e){ha=e,ts(va)},onErrorTarget:Co,onErrorMethod:"onerror",flush:function(t,e){"render"!==t&&t!==pa||ts(va),e()}});function ma(...t){return ga.run(...t)}function ya(t,e,...n){return ga.join(t,e,...n)}function _a(...t){return(...e)=>ya(...t.concat(e))}function va(...t){return ga.schedule(...t)}function ba(...t){return ga.scheduleOnce("actions",...t)}function wa(...t){return ga.scheduleOnce(...t)}function xa(...t){return ga.later(...t,1)}function Sa(t){return ga.cancel(t)}function Ca(...t){return ga.debounce(...t)}const ka=Object.freeze(Object.defineProperty({__proto__:null,_backburner:ga,_cancelTimers:function(){ga.cancelTimers()},_getCurrentRunLoop:da,_hasScheduledTimers:function(){return ga.hasTimers()},_queues:fa,_rsvpErrorQueue:pa,begin:function(){ga.begin()},bind:_a,cancel:Sa,debounce:Ca,end:function(){ga.end()},join:ya,later:function(...t){return ga.later(...t)},next:xa,once:ba,run:ma,schedule:va,scheduleOnce:wa,throttle:function(...t){return ga.throttle(...t)}},Symbol.toStringTag,{value:"Module"})),Ea="@warp-drive/core",Ta=globalThis;Ta.__warpDrive_universalCache=Ta.__warpDrive_universalCache??{},Ta[Ea]=Ta[Ea]??{__version:"5.8.1"};const Ra=Ta[Ea],Pa=Ra.__warpDrive_ModuleScopedCaches??{};if(Ra.__warpDrive_hasOtherCopy)throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");function Ma(t,e){return e}function Ia(t){return Pa[`(transient) ${t}`]??null}Ra.__warpDrive_hasOtherCopy=!0;const Oa=new WeakMap;function Aa(t,e){Oa.set(t,e)}const Fa=Ma(0,Symbol("#[]"));function La(t,e){return Ia("signalHooks").createSignal(t,e)}const za={};function Da(t){return"object"==typeof t&&null!==t&&Object.getPrototypeOf(t)===za}const ja=Ma(0,Symbol("Signals"));function Na(t){return t[ja]||function(t){t[ja]=new Map}(t),t[ja]}function Ua(t,e,n,i){const r={key:n,context:e,signal:La(e,n),value:Da(i)?i.value.call(e):i,isStale:!1};return t.set(n,r),r}function Ba(t,e){return t?.get(e)}function qa(t,e){return{enumerable:!0,configurable:!1,get(){const n=function(t,e,n,i){let r=Ba(t,n);return r||(r=Ua(t,e,n,i)),s=r.signal,Ia("signalHooks").consumeSignal(s),r;var s}(Na(this),this,t,e);return n.isStale=!1,n.value},set(n){const i=function(t,e,n,i){let r=Ba(t,n);return r||(r=Ua(t,e,n,i)),r}(Na(this),this,t,e);var r;i.value!==n&&(i.value=n,(r=i)&&(r.isStale=!0,function(t){Ia("signalHooks").notifySignal(t)}(r.signal)))}}}function Va(t,e,n){Object.defineProperty(t,e,qa(e,n))}function $a(t,e,n){const i=qa(e,n);i.enumerable=!1,Object.defineProperty(t,e,i)}function Ga(t,e,n){const i=n.get;return n.get=function(){const t=Na(this);let n=t.get(e);return n||(n=function(t,e,n,i){{const r=function(t,e,n){return Ia("signalHooks").createMemo(t,e,n)}(e,n,i);return t.set(n,r),r}}(t,this,e,i.bind(this))),n()},n}const Wa=new WeakMap;function Ha(t){return t instanceof DOMException&&"AbortError"===t.name}class Ka{_stream=null;_future;_triggered=!1;_trigger(){if(this._triggered)return;this._triggered=!0;const t=this._future.getStream();t.sizeHint&&(this._sizeHint=t.sizeHint),this.promise=t.then(t=>t?async function(t,e){const n=e,i=t.getReader();let r=0,s=null!==n._stream&&n._stream.readable.locked,o=s,a=n._stream?.writable.getWriter();const l=[];for(n._isPending=!1,n._isStarted=!0,n._startTime=performance.now();;){const{value:t,done:e}=await i.read();if(e)break;if(r+=t.byteLength,n._bytesLoaded=r,n._lastPacketTime=performance.now(),s=s||null!==n._stream&&n._stream.readable.locked,s){if(!o){o=!0,a=n._stream.writable.getWriter();for(const t of l)await a.ready,await a.write(t);l.length=0}await a.ready,await a.write(t)}else l.push(t)}o?(await a.ready,await a.close()):n._stream&&(await n._stream.readable.cancel("The Stream Has Already Ended"),n._stream=null);const c=performance.now();n._endTime=c,n._isComplete=!0,n._isStarted=!1}(t,this):(this._isPending=!1,void(this._isComplete=!0)),t=>{this._isPending=!1,this._isStarted=!1,Ha(t)&&(this._isCancelled=!0,this._isComplete=!0),this._isErrored=!0,this._error=t})}promise=null;get isPending(){return this._trigger(),this._isPending}get sizeHint(){return this._trigger(),this._sizeHint}get stream(){if(this._trigger(),!this._stream){if(this._isComplete||this._isCancelled||this._isErrored)return null;this._stream=new TransformStream}return this._stream.readable}get isStarted(){return this._trigger(),this._isStarted}get bytesLoaded(){return this._trigger(),this._bytesLoaded}get startTime(){return this._trigger(),this._startTime}get endTime(){return this._trigger(),this._endTime}get lastPacketTime(){return this._trigger(),this._lastPacketTime}get isComplete(){return this._trigger(),this._isComplete}get isCancelled(){return this._trigger(),this._isCancelled}get isErrored(){return this._trigger(),this._isErrored}get error(){return this._trigger(),this._error}get elapsedTime(){return(this.endTime||this.lastPacketTime)-this.startTime}get completedRatio(){return this.sizeHint?this.bytesLoaded/this.sizeHint:0}get remainingRatio(){return 1-this.completedRatio}get duration(){return this.endTime-this.startTime}get speed(){return this.bytesLoaded/(this.elapsedTime/1e3)}constructor(t){this._future=t}abort=()=>{this._future.abort()}}$a(Ka.prototype,"_isPending",!0),$a(Ka.prototype,"_isStarted",!1),$a(Ka.prototype,"_isComplete",!1),$a(Ka.prototype,"_isCancelled",!1),$a(Ka.prototype,"_isErrored",!1),$a(Ka.prototype,"_error",null),$a(Ka.prototype,"_sizeHint",0),$a(Ka.prototype,"_bytesLoaded",0),$a(Ka.prototype,"_startTime",0),$a(Ka.prototype,"_endTime",0),$a(Ka.prototype,"_lastPacketTime",0);const Xa={};function Ya(t,e,n){const i=Object.assign({},e),r=Object.assign({},i.cacheOptions);return n?r.reload=!0:!1===n?(delete r.reload,r.backgroundReload=!0):(delete r.backgroundReload,delete r.reload),i.cacheOptions=r,t.request(i)}function Za(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}Va(Xa,"reason",null),Va(Xa,"value",null),Va(Xa,"result",null),Va(Xa,"error",null),Va(Xa,"status","pending"),Va(Xa,"isPending",!0),Va(Xa,"isLoading",!0),Va(Xa,"isSuccess",!1),Va(Xa,"isError",!1),Va(Xa,"request",null),Va(Xa,"response",null),Object.defineProperty(Xa,"isCancelled",{get(){return this.isError&&Ha(this.reason)}}),Object.defineProperty(Xa,"loadingState",{get(){return this._loadingState||(this._loadingState=new Ka(this._request)),this._loadingState}});const Ja=Symbol.dispose||Symbol.for("dispose");class Qa{_requester;constructor(t,e){this._args=e,this.store=t,this._subscribedTo=null,this._subscription=null,this._intervalStart=null,this._invalidated=!1,this._nextInterval=null,this._requester=null,this.isDestroyed=!1,this[Ja]=el,this._installListeners(),this._beginPolling()}async _beginPolling(){try{this.isIdle||await this.request}catch{}finally{this.isDestroyed||this._scheduleInterval()}}get isIdle(){const{request:t,query:e}=this._args;return Boolean(!t&&!e)}static{Za(this.prototype,"isIdle",[Ga])}get autorefreshTypes(){const{autorefresh:t}=this._args;let e;return e=!0===t?["online","invalid"]:"string"==typeof t?t.split(","):[],new Set(e)}static{Za(this.prototype,"autorefreshTypes",[Ga])}async _scheduleInterval(){const{autorefreshThreshold:t}=this._args;if("undefined"!=typeof window&&"number"==typeof t&&t>0&&this.autorefreshTypes.has("interval")&&null===this._intervalStart){if(this._latestRequest){try{await this._latestRequest}catch{}if(this.isDestroyed)return}this._intervalStart=Date.now(),this._nextInterval=setTimeout(()=>{this._maybeUpdate()},t)}}_clearInterval(){this._nextInterval&&(clearTimeout(this._nextInterval),this._intervalStart=null)}_updateSubscriptions(){if(this.isIdle)return;const t=this._request.lid;if(this._subscribedTo===t)return;this._removeSubscriptions();const e=this._getRequester();this._requester=e,t&&tl(e)&&(this._subscribedTo=t,this._subscription=e.notifications.subscribe(t,(n,i)=>{if(!this._isUpdating)switch(i){case"invalidated":this.autorefreshTypes.has("invalid")&&(this._invalidated=!0,this._maybeUpdate());break;case"state":{const n=e.requestManager._deduped.get(t),i=n?.priority,r=this.reqState;i?i.blocking&&!r.isLoading?(this.isRefreshing=!1,this._maybeUpdate("policy",!0)):this.isRefreshing=!0:this.isRefreshing=!1}}}))}_removeSubscriptions(){const t=this._requester;this._subscription&&t&&tl(t)&&(t.notifications.unsubscribe(this._subscription),this._subscribedTo=null,this._subscription=null,this._requester=null)}_installListeners(){"undefined"!=typeof window&&(this.isOnline=window.navigator.onLine,this._unavailableStart=this.isOnline?null:Date.now(),this.isHidden="hidden"===document.visibilityState,this._onlineChanged=t=>{this.isOnline="online"===t.type,"offline"===t.type&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},this._backgroundChanged=()=>{const t="hidden"===document.visibilityState;this.isHidden=t,t&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},window.addEventListener("online",this._onlineChanged,{passive:!0,capture:!0}),window.addEventListener("offline",this._onlineChanged,{passive:!0,capture:!0}),document.addEventListener("visibilitychange",this._backgroundChanged,{passive:!0,capture:!0}))}_maybeUpdate(t,e){if(this.isIdle)return;const{reqState:n}=this;if(n.isPending)return;if(!Boolean(this.isOnline&&!this.isHidden&&(t||this.autorefreshTypes.size))){if(!e&&t&&"_invalidated"!==t)throw new Error("Reload not available: the network is not online or the tab is hidden");return}const{autorefreshTypes:i}=this;let r=this._invalidated||Boolean(t);if(!r&&i.has("online")){const{_unavailableStart:t}=this,{autorefreshThreshold:e}=this._args,n="number"==typeof e?e:3e4;r=Boolean(t&&Date.now()-t>n)}if(!r&&i.has("interval")){const{_intervalStart:t}=this,{autorefreshThreshold:e}=this._args;t&&"number"==typeof e&&e>0&&(r=Boolean(Date.now()-t>=e))}if(this._unavailableStart=null,this._invalidated=!1,r){this._clearInterval(),this._isUpdating=!0;const e=("_invalidated"===t?null:t)??this._args.autorefreshBehavior??"policy",i=this._getRequester();switch(n._request.requester||(n._request.requester=i),e){case"reload":this._latestRequest=n.reload();break;case"refresh":this._latestRequest=n.refresh();break;case"policy":this._latestRequest=n.refresh(!0)}"refresh"!==e&&(this._localRequest=this._latestRequest),this._scheduleInterval(),this._latestRequest.finally(()=>{this._isUpdating=!1})}}_getRequester(){return this._args.request?.requester?this._args.request.requester:this.store}retry=async()=>{this._maybeUpdate("reload"),await this._localRequest};refresh=async()=>{this._maybeUpdate("refresh"),await this._latestRequest};get errorFeatures(){return{isHidden:this.isHidden,isOnline:this.isOnline,retry:this.retry}}static{Za(this.prototype,"errorFeatures",[Ga])}get contentFeatures(){const t={isHidden:this.isHidden,isOnline:this.isOnline,reload:this.retry,refresh:this.refresh,isRefreshing:this.isRefreshing,latestRequest:this._latestRequest};return t.isRefreshing&&(t.abort=()=>{this._latestRequest?.abort()}),t}static{Za(this.prototype,"contentFeatures",[Ga])}get _request(){const{request:t,query:e}=this._args,{_localRequest:n,_originalRequest:i,_originalQuery:r}=this;return n&&t===i&&e===r?n:(this._originalQuery=e,this._originalRequest=t,t||this.store.request(e))}static{Za(this.prototype,"_request",[Ga])}get request(){{const t=this._request;return this._updateSubscriptions(),t}}static{Za(this.prototype,"request",[Ga])}get reqState(){return function(t){let e=Wa.get(t);return e||(e=function(t){const e=(n=t,Oa.get(n));var n;const i=Object.create(Xa);return i._request=t,i.reload=()=>Ya(t.requester,i.request,!0),i.refresh=(e=!1)=>Ya(t.requester,i.request,!0===e&&null),e?e.isError?(i.error=e.result,i.reason=e.result,i.status="rejected",i.isError=!0,i.isPending=!1,i.isLoading=!1,i.request=e.result.request,i.response=e.result.response):(i.result=e.result.content,i.value=e.result.content,i.status="fulfilled",i.isSuccess=!0,i.isPending=!1,i.isLoading=!1,i.request=e.result.request,i.response=e.result.response):t.then(e=>{Aa(t,{isError:!1,result:e}),i.result=e.content,i.value=e.content,i.status="fulfilled",i.isSuccess=!0,i.isPending=!1,i.isLoading=!1,i.request=e.request,i.response=e.response},e=>{Aa(t,{isError:!0,result:e}),i.error=e,i.reason=e,i.status="rejected",i.isError=!0,i.isPending=!1,i.isLoading=!1,i.request=e.request,i.response=e.response}),i}(t),Wa.set(t,e)),e}(this.request)}get result(){return this.reqState.result}}function tl(t){return"requestManager"in t}function el(){const t=this;t.isDestroyed=!0,t._removeSubscriptions(),"undefined"!=typeof window&&(t._clearInterval(),window.removeEventListener("online",t._onlineChanged,{passive:!0,capture:!0}),window.removeEventListener("offline",t._onlineChanged,{passive:!0,capture:!0}),document.removeEventListener("visibilitychange",t._backgroundChanged,{passive:!0,capture:!0}))}Va(Qa.prototype,"isOnline",!0),Va(Qa.prototype,"isHidden",!1),Va(Qa.prototype,"isRefreshing",!1),Va(Qa.prototype,"_localRequest",void 0),Va(Qa.prototype,"_latestRequest",void 0);const nl={};Va(nl,"reason",null),Va(nl,"value",null),Va(nl,"result",null),Va(nl,"error",null),Va(nl,"status","pending"),Va(nl,"isPending",!0),Va(nl,"isLoading",!0),Va(nl,"isSuccess",!1),Va(nl,"isError",!1);const il=ge;var rl;rl=function(t){const e=t.wellknown.Array;return{createSignal:(t,n)=>n===e?[fr(t,n),fr(t,"length"),fr(t,"[]")]:fr(t,n),consumeSignal(t){if(Array.isArray(t))return De(t[0]),De(t[1]),void De(t[2]);De(t)},notifySignal(t){if(Array.isArray(t))return il(t[0]),il(t[1]),void il(t[2]);il(t)},createMemo:(t,e,n)=>{{const i=fr(t,e),r=qe(n);let s;const o=()=>{s=Ve(r)};return()=>{const t=Ge(o);return me(i,t),De(t),s}}},willSyncFlushWatchers:()=>!!ga.currentInstance&&!0!==ga._autorun,waitFor:async t=>t}},function(t,e){Pa["(transient) signalHooks"]=e}(0,rl({wellknown:{Array:Fa}}));const sl=ur,ol=Object.freeze(Object.defineProperty({__proto__:null,getOwner:sl,setOwner:hr},Symbol.toStringTag,{value:"Module"}));function al(t){let e=Object.create(t);return e._dict=null,delete e._dict,e}const ll=g.EMBER_LOAD_HOOKS||{},cl={};let ul=cl;function hl(t,e){let n=cl[t];(ll[t]??=[]).push(e),n&&e(n)}function dl(t,e){if(cl[t]=e,n&&"function"==typeof CustomEvent){let i=new CustomEvent(t,{detail:e});n.dispatchEvent(i)}ll[t]?.forEach(t=>t(e))}class pl{static _leakTracking;owner;registry;cache;factoryManagerCache;validationCache;isDestroyed;isDestroying;constructor(t,e={}){this.registry=t,this.owner=e.owner||null,this.cache=al(e.cache||null),this.factoryManagerCache=al(e.factoryManagerCache||null),this.isDestroyed=!1,this.isDestroying=!1}lookup(t,e){if(this.isDestroyed)throw new Error(`Cannot call \`.lookup('${t}')\` after the owner has been destroyed`);return function(t,e,n={}){let i=e;if(!0===n.singleton||void 0===n.singleton&&fl(t,e)){let e=t.cache[i];if(void 0!==e)return e}return function(t,e,n,i){let r=ml(t,e,n);if(void 0!==r){if(function(t,e,{instantiate:n,singleton:i}){return!1!==i&&!1!==n&&(!0===i||fl(t,e))&&gl(t,e)}(t,n,i)){let n=t.cache[e]=r.create();return t.isDestroying&&"function"==typeof n.destroy&&n.destroy(),n}if(function(t,e,{instantiate:n,singleton:i}){return!1!==n&&(!1===i||!fl(t,e))&&gl(t,e)}(t,n,i))return r.create();if(function(t,e,{instantiate:n,singleton:i}){return!1!==i&&!n&&fl(t,e)&&!gl(t,e)}(t,n,i)||function(t,e,{instantiate:n,singleton:i}){return!(!1!==n||!1!==i&&fl(t,e)||gl(t,e))}(t,n,i))return r.class;throw new Error("Could not create factory")}}(t,i,e,n)}(this,this.registry.normalize(t),e)}destroy(){this.isDestroying=!0,yl(this)}finalizeDestroy(){_l(this),this.isDestroyed=!0}reset(t){this.isDestroyed||(void 0===t?(yl(this),_l(this)):function(t,e){let n=t.cache[e];delete t.factoryManagerCache[e],n&&(delete t.cache[e],n.destroy&&n.destroy())}(this,this.registry.normalize(t)))}ownerInjection(){let t={};return hr(t,this.owner),t}factoryFor(t){if(this.isDestroyed)throw new Error(`Cannot call \`.factoryFor('${t}')\` after the owner has been destroyed`);return ml(this,this.registry.normalize(t),t)}}function fl(t,e){return!1!==t.registry.getOption(e,"singleton")}function gl(t,e){return!1!==t.registry.getOption(e,"instantiate")}function ml(t,e,n){let i=t.factoryManagerCache[e];if(void 0!==i)return i;let r=t.registry.resolve(e);if(void 0===r)return;let s=new xl(t,r,n,e);return t.factoryManagerCache[e]=s,s}function yl(t){let e=t.cache,n=Object.keys(e);for(let i of n){let t=e[i];t.destroy&&t.destroy()}}function _l(t){t.cache=al(null),t.factoryManagerCache=al(null)}const vl=Symbol("INIT_FACTORY");function bl(t){return t[vl]}function wl(t,e){t[vl]=e}class xl{container;owner;class;fullName;normalizedName;madeToString;injections;constructor(t,e,n,i){this.container=t,this.owner=t.owner,this.class=e,this.fullName=n,this.normalizedName=i,this.madeToString=void 0,this.injections=void 0}toString(){return void 0===this.madeToString&&(this.madeToString=this.container.registry.makeToString(this.class,this.fullName)),this.madeToString}create(t){let{container:e}=this;if(e.isDestroyed)throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);let n=t?{...t}:{};return hr(n,e.owner),wl(n,this),this.class.create(n)}}const Sl=/^[^:]+:[^:]+$/;class Cl{_failSet;resolver;fallback;registrations;_normalizeCache;_options;_resolveCache;_typeOptions;constructor(t={}){this.fallback=t.fallback||null,this.resolver=t.resolver||null,this.registrations=al(t.registrations||null),this._normalizeCache=al(null),this._resolveCache=al(null),this._failSet=new Set,this._options=al(null),this._typeOptions=al(null)}container(t){return new pl(this,t)}register(t,e,n={}){let i=this.normalize(t);this._failSet.delete(i),this.registrations[i]=e,this._options[i]=n}unregister(t){let e=this.normalize(t);delete this.registrations[e],delete this._resolveCache[e],delete this._options[e],this._failSet.delete(e)}resolve(t){let e=function(t,e){let n,i=e,r=t._resolveCache[i];return void 0!==r?r:t._failSet.has(i)?void 0:(t.resolver&&(n=t.resolver.resolve(i)),void 0===n&&(n=t.registrations[i]),void 0===n?t._failSet.add(i):t._resolveCache[i]=n,n)}(this,this.normalize(t));return void 0===e&&null!==this.fallback&&(e=this.fallback.resolve(t)),e}describe(t){return null!==this.resolver&&this.resolver.lookupDescription?this.resolver.lookupDescription(t):null!==this.fallback?this.fallback.describe(t):t}normalizeFullName(t){return null!==this.resolver&&this.resolver.normalize?this.resolver.normalize(t):null!==this.fallback?this.fallback.normalizeFullName(t):t}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this.normalizeFullName(t))}makeToString(t,e){return null!==this.resolver&&this.resolver.makeToString?this.resolver.makeToString(t,e):null!==this.fallback?this.fallback.makeToString(t,e):"string"==typeof t?t:t.name??"(unknown class)"}has(t){return!!this.isValidFullName(t)&&function(t,e){return void 0!==t.resolve(e)}(this,this.normalize(t))}optionsForType(t,e){this._typeOptions[t]=e}getOptionsForType(t){let e=this._typeOptions[t];return void 0===e&&null!==this.fallback&&(e=this.fallback.getOptionsForType(t)),e}options(t,e){let n=this.normalize(t);this._options[n]=e}getOptions(t){let e=this.normalize(t),n=this._options[e];return void 0===n&&null!==this.fallback&&(n=this.fallback.getOptions(t)),n}getOption(t,e){let n=this._options[t];if(void 0!==n&&void 0!==n[e])return n[e];let i=t.split(":")[0];return n=this._typeOptions[i],n&&void 0!==n[e]?n[e]:null!==this.fallback?this.fallback.getOption(t,e):void 0}knownForType(t){let e,n,i=al(null),r=Object.keys(this.registrations);for(let s of r)s.split(":")[0]===t&&(i[s]=!0);return null!==this.fallback&&(e=this.fallback.knownForType(t)),null!==this.resolver&&this.resolver.knownForType&&(n=this.resolver.knownForType(t)),Object.assign({},e,i,n)}isValidFullName(t){return Sl.test(t)}}const kl=al(null),El=`${Math.random()}${Date.now()}`.replace(".","");function Tl([t]){let e=kl[t];if(e)return e;let[n,i]=t.split(":");return kl[t]=W(`${n}:${i}-${El}`)}const Rl=Array.prototype.concat;function Pl(t,e,n,i){let r=n[t]||i[t];return e[t]&&(r=r?Rl.call(r,e[t]):e[t]),r}function Ml(t,e,n,i){if(!0===n)return e;let r=n._getter;if(void 0===r)return e;let s=i[t],o="function"==typeof s?Ir(s):s;if(void 0===o||!0===o)return e;let a=o._getter;if(void 0===a)return e;let l,c=mt(r,a),u=n._setter,h=o._setter;if(l=void 0!==h?void 0!==u?mt(u,h):h:u,c!==r||l!==u){let t=n._dependentKeys||[],e=new us([...t,{get:c,set:l}]);return e._readOnly=n._readOnly,e._meta=n._meta,e.enumerable=n.enumerable,Rr(e,us)}return e}function Il(t,e,n,i){if(void 0!==i[t])return e;let r=n[t];return"function"==typeof r?mt(e,r):e}function Ol(t){return t?Array.isArray(t)?t:[t]:[]}function Al(t,e,n){return Ol(n[t]).concat(Ol(e))}function Fl(t,e,n){let i=n[t];if(!i)return e;let r=Object.assign({},i),s=!1,o=Object.keys(e);for(let a of o){let t=e[a];"function"==typeof t?(s=!0,r[a]=Il(a,t,i,{})):r[a]=t}return s&&(r._super=at),r}function Ll(t,e,n,i,r,s,o){let a;for(let l=0;l{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}))}else zl(e,a,n,i,r,s,o)}function zl(t,e,n,i,r,s,o){let a=Pl("concatenatedProperties",e,i,r),l=Pl("mergedProperties",e,i,r),c=Object.keys(e);for(let u of c){let c=e[u];if(void 0===c)continue;if(-1===s.indexOf(u)){s.push(u);let e=t.peekDescriptors(u);if(void 0===e){if(!Or(c)){let t=i[u]=r[u];"function"==typeof t&&Dl(r,u,t,!1)}}else n[u]=e,o.push(u),e.teardown(r,u,t)}let h="function"==typeof c;if(h){let t=Ir(c);if(void 0!==t){n[u]=Ml(u,c,t,n),i[u]=void 0;continue}}a&&a.indexOf(u)>=0||"concatenatedProperties"===u||"mergedProperties"===u?c=Al(u,c,i):l&&l.indexOf(u)>-1?c=Fl(u,c,i):h&&(c=Il(u,c,i,n)),i[u]=c,n[u]=void 0}}function Dl(t,e,n,i){let r=dt(n);if(void 0===r)return;let{observers:s,listeners:o}=r;if(void 0!==s){let n=i?Wr:Hr;for(let i of s.paths)n(t,i,null,e,s.sync)}if(void 0!==o){let n=i?jr:Nr;for(let i of o)n(t,i,null,e)}}function jl(t,e,n=!1){let i=Object.create(null),r=Object.create(null),s=ae(t),o=[],a=[];t._super=at,Ll(e,s,i,r,t,o,a);for(let l of o){let e=r[l],o=i[l];void 0!==e?("function"==typeof e&&Dl(t,l,e,!0),_s(t,l,e,-1!==a.indexOf(l),!n)):void 0!==o&&ys(t,l,o,s)}return s.isPrototypeMeta(t)||Jr(t),t}function Nl(t,...e){return jl(t,e),t}const Ul=new WeakSet;class Bl{mixins;properties;ownerConstructor;_without;constructor(t,e){Ul.add(this),this.properties=function(t){if(void 0!==t)for(let e of Object.keys(t)){let n=Object.getOwnPropertyDescriptor(t,e);void 0===n.get&&void 0===n.set||Object.defineProperty(t,e,{value:Sr(n)})}return t}(e),this.mixins=ql(t),this.ownerConstructor=void 0,this._without=void 0}static create(...t){return _o(),new this(t,void 0)}static mixins(t){let e=oe(t),n=[];return null===e||e.forEachMixins(t=>{t.properties||n.push(t)}),n}reopen(...t){if(0===t.length)return this;if(this.properties){let t=new Bl(void 0,this.properties);this.properties=void 0,this.mixins=[t]}else this.mixins||(this.mixins=[]);return this.mixins=this.mixins.concat(ql(t)),this}apply(t,e=!1){return jl(t,[this],e)}applyPartial(t){return jl(t,[this])}detect(t){if("object"!=typeof t||null===t)return!1;if(Ul.has(t))return Vl(t,this);let e=oe(t);return null!==e&&e.hasMixin(this)}without(...t){let e=new Bl([this]);return e._without=t,e}keys(){return $l(this)}toString(){return"(unknown mixin)"}}function ql(t){let e,n=t&&t.length||0;if(n>0){e=new Array(n);for(let i=0;iVl(t,e,n))}function $l(t,e=new Set,n=new Set){if(!n.has(t)){if(n.add(t),t.properties){let n=Object.keys(t.properties);for(let t of n)e.add(t)}else t.mixins&&t.mixins.forEach(t=>$l(t,e,n));return e}}const Gl=Bl.create({__registry__:null,resolveRegistration(t){return this.__registry__.resolve(t)},register:Wl("register"),unregister:Wl("unregister"),hasRegistration:Wl("has"),registeredOption:Wl("getOption"),registerOptions:Wl("options"),registeredOptions:Wl("getOptions"),registerOptionsForType:Wl("optionsForType"),registeredOptionsForType:Wl("getOptionsForType")});function Wl(t){return function(...e){return this.__registry__[t](...e)}}const Hl=Bl.create({__container__:null,ownerInjection(){return this.__container__.ownerInjection()},lookup(t,e){return this.__container__.lookup(t,e)},destroy(){let t=this.__container__;t&&ya(()=>{t.destroy(),va("destroy",t,"finalizeDestroy")}),this._super()},factoryFor(t){return this.__container__.factoryFor(t)}}),Kl=Bl.create({compare:null}),Xl=Bl.create({mergedProperties:["actions"],send(t,...e){if(this.actions&&this.actions[t]&&!0!==this.actions[t].apply(this,e))return;let n=Ss(this,"target");n&&n.send(...arguments)}});function Yl(t){let e=Ss(t,"content");return me(gr(t),gr(e)),e}function Zl(t,e,n){let i=sn(t),r=on(t,e,i);if(e in t)return r;{let s=[r,on(t,"content",i)],o=Yl(t);return H(o)&&s.push(fr(o,e,n)),ke(s)}}const Jl=Bl.create({content:null,init(){this._super(...arguments),nr(this),gr(this),li(this,Zl)},willDestroy(){this.set("content",null),this._super(...arguments)},isTruthy:ps("content",function(){return Boolean(Ss(this,"content"))}),unknownProperty(t){let e=Yl(this);return e?Ss(e,t):void 0},setUnknownProperty(t,e){let n=ae(this);return n.isInitializing()||n.isPrototypeMeta(this)?(ms(this,t,null,e),e):Ls(Yl(this),t,e)}}),Ql=Bl.create(),tc=Bl.create(Ql),ec=Object.freeze(Object.defineProperty({__proto__:null,default:tc},Symbol.toStringTag,{value:"Module"})),nc=Bl.create({target:null,action:null,actionContext:null,actionContextObject:ps("actionContext",function(){let t=Ss(this,"actionContext");if("string"==typeof t){let e=Ss(this,t);return void 0===e&&(e=Ss(d.lookup,t)),e}return t}),triggerAction(t={}){let{action:e,target:n,actionContext:i}=t;e=e||Ss(this,"action"),n=n||function(t){let e=Ss(t,"target");if(e){if("string"==typeof e){let n=Ss(t,e);return void 0===n&&(n=Ss(d.lookup,e)),n}return e}return t._target?t._target:null}(this),void 0===i&&(i=Ss(this,"actionContextObject")||this);let r=Array.isArray(i)?i:[i];if(n&&e){let t;if(t=null!=(s=n)&&"object"==typeof s&&"function"==typeof s.send?n.send(e,...r):n[e](...r),!1!==t)return!0}var s;return!1}});function ic(t){let e=t._promiseCallbacks;return e||(e=t._promiseCallbacks={}),e}const rc={mixin(t){return t.on=this.on,t.off=this.off,t.trigger=this.trigger,t._promiseCallbacks=void 0,t},on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=ic(this),i=n[t];i||(i=n[t]=[]),-1===i.indexOf(e)&&i.push(e)},off(t,e){let n=ic(this);if(!e)return void(n[t]=[]);let i=n[t],r=i.indexOf(e);-1!==r&&i.splice(r,1)},trigger(t,e,n){let i=ic(this)[t];if(i){let t;for(let r=0;r{for(let t=0;t{e===n?yc(t,n):gc(t,n)},e=>_c(t,e))}(t,e):"function"==typeof n?function(t,e,n){sc.async(t=>{let i=!1,r=function(n,r){try{n.call(r,n=>{i||(i=!0,e===n?yc(t,n):gc(t,n))},e=>{i||(i=!0,_c(t,e))})}catch(s){return s}}(n,e,t._label);!i&&r&&(i=!0,_c(t,r))},t)}(t,e,n):yc(t,e)}function gc(t,e){if(t===e)yc(t,e);else if(function(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}(e)){let n;try{n=e.then}catch(zj){return void _c(t,zj)}fc(t,e,n)}else yc(t,e)}function mc(t){t._onError&&t._onError(t._result),bc(t)}function yc(t,e){t._state===hc&&(t._result=e,t._state=dc,0===t._subscribers.length?sc.instrument&&lc("fulfilled",t):sc.async(bc,t))}function _c(t,e){t._state===hc&&(t._state=pc,t._result=e,sc.async(mc,t))}function vc(t,e,n,i){let r=t._subscribers,s=r.length;t._onError=null,r[s]=e,r[s+dc]=n,r[s+pc]=i,0===s&&t._state&&sc.async(bc,t)}function bc(t){let e=t._subscribers,n=t._state;if(sc.instrument&&lc(n===dc?"fulfilled":"rejected",t),0===e.length)return;let i,r,s=t._result;for(let o=0;owc(r,s,n,o))}return s}class Sc{constructor(t,e,n,i){this._instanceConstructor=t,this.promise=new t(uc,i),this._abortOnReject=n,this._isUsingOwnPromise=t===Tc,this._isUsingOwnResolve=t.resolve===cc,this._init(...arguments)}_init(t,e){let n=e.length||0;this.length=n,this._remaining=n,this._result=new Array(n),this._enumerate(e)}_enumerate(t){let e=this.length,n=this.promise;for(let i=0;n._state===hc&&ie(t)),e,n)}else this._willSettleAt(i.resolve(t),e,n)}_eachEntry(t,e,n){null!==t&&"object"==typeof t?this._settleMaybeThenable(t,e,n):this._setResultAt(dc,e,t,n)}_settledAt(t,e,n,i){let r=this.promise;r._state===hc&&(this._abortOnReject&&t===pc?_c(r,n):(this._setResultAt(t,e,n,i),this._checkFullfillment()))}_setResultAt(t,e,n,i){this._remaining--,this._result[e]=n}_willSettleAt(t,e,n){vc(t,void 0,t=>this._settledAt(dc,e,t,n),t=>this._settledAt(pc,e,t,n))}}function Cc(t,e,n){this._remaining--,this._result[e]=t===dc?{state:"fulfilled",value:n}:{state:"rejected",reason:n}}const kc="rsvp_"+Date.now()+"-";let Ec=0,Tc=class t{constructor(e,n){this._id=Ec++,this._label=n,this._state=void 0,this._result=void 0,this._subscribers=[],sc.instrument&&lc("created",this),uc!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){let n=!1;try{e(e=>{n||(n=!0,gc(t,e))},e=>{n||(n=!0,_c(t,e))})}catch(i){_c(t,i)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}_onError(t){sc.after(()=>{this._onError&&sc.trigger("error",t,this._label)})}catch(t,e){return this.then(void 0,t,e)}finally(t,e){let n=this,i=n.constructor;return"function"==typeof t?n.then(e=>i.resolve(t()).then(()=>e),e=>i.resolve(t()).then(()=>{throw e})):n.then(t,t)}};function Rc(t,e){return{then:(n,i)=>t.call(e,n,i)}}function Pc(t,e){let n=function(){let n=arguments.length,i=new Array(n+1),r=!1;for(let t=0;tMc(t,e,n,i))}(s,i,t,this):Mc(s,i,t,this)};return n.__proto__=t,n}function Mc(t,e,n,i){try{n.apply(i,e)}catch(zj){_c(t,zj)}return t}function Ic(t,e){return Tc.all(t,e)}Tc.cast=cc,Tc.all=function(t,e){return Array.isArray(t)?new Sc(this,t,!0,e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)},Tc.race=function(t,e){let n=this,i=new n(uc,e);if(!Array.isArray(t))return _c(i,new TypeError("Promise.race must be called with an array")),i;for(let r=0;i._state===hc&&rgc(i,t),t=>_c(i,t));return i},Tc.resolve=cc,Tc.reject=function(t,e){let n=new this(uc,e);return _c(n,t),n},Tc.prototype._guidKey=kc,Tc.prototype.then=xc;class Oc extends Sc{constructor(t,e,n){super(t,e,!1,n)}}function Ac(t,e){return Array.isArray(t)?new Oc(Tc,t,e).promise:Tc.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function Fc(t,e){return Tc.race(t,e)}Oc.prototype._setResultAt=Cc;class Lc extends Sc{constructor(t,e,n=!0,i){super(t,e,n,i)}_init(t,e){this._result={},this._enumerate(e)}_enumerate(t){let e,n,i=Object.keys(t),r=i.length,s=this.promise;this._remaining=r;for(let o=0;s._state===hc&&o{throw t}),t}function Uc(t){let e={resolve:void 0,reject:void 0};return e.promise=new Tc((t,n)=>{e.resolve=t,e.reject=n},t),e}Dc.prototype._setResultAt=Cc;class Bc extends Sc{constructor(t,e,n,i){super(t,e,!0,i,n)}_init(t,e,n,i,r){let s=e.length||0;this.length=s,this._remaining=s,this._result=new Array(s),this._mapFn=r,this._enumerate(e)}_setResultAt(t,e,n,i){if(i)try{this._eachEntry(this._mapFn(n,e),e,!1)}catch(zj){this._settledAt(pc,e,zj,!1)}else this._remaining--,this._result[e]=n}}function qc(t,e,n){return"function"!=typeof e?Tc.reject(new TypeError("map expects a function as a second argument"),n):Tc.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("map must be called with an array");return new Bc(Tc,t,e,n).promise})}function Vc(t,e){return Tc.resolve(t,e)}function $c(t,e){return Tc.reject(t,e)}const Gc={};class Wc extends Bc{_checkFullfillment(){if(0===this._remaining&&null!==this._result){let t=this._result.filter(t=>t!==Gc);yc(this.promise,t),this._result=null}}_setResultAt(t,e,n,i){if(i){this._result[e]=n;let t,i=!0;try{t=this._mapFn(n,e)}catch(zj){i=!1,this._settledAt(pc,e,zj,!1)}i&&this._eachEntry(t,e,!1)}else this._remaining--,n||(this._result[e]=Gc)}}function Hc(t,e,n){return"function"!=typeof e?Tc.reject(new TypeError("filter expects function as a second argument"),n):Tc.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("filter must be called with an array");return new Wc(Tc,t,e,n).promise})}let Kc,Xc=0;function Yc(t,e){iu[Xc]=t,iu[Xc+1]=e,Xc+=2,2===Xc&&su()}const Zc="undefined"!=typeof window?window:void 0,Jc=Zc||{},Qc=Jc.MutationObserver||Jc.WebKitMutationObserver,tu="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),eu="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function nu(){return()=>setTimeout(ru,1)}const iu=new Array(1e3);function ru(){for(let t=0;tt(ru)}():Qc?function(){let t=0,e=new Qc(ru),n=document.createTextNode("");return e.observe(n,{characterData:!0}),()=>n.data=t=++t%2}():eu?function(){let t=new MessageChannel;return t.port1.onmessage=ru,()=>t.port2.postMessage(0)}():void 0===Zc&&"function"==typeof window.require?function(){try{const t=Function("return this")().require("vertx");return Kc=t.runOnLoop||t.runOnContext,void 0!==Kc?function(){Kc(ru)}:nu()}catch(t){return nu()}}():nu(),sc.async=Yc,sc.after=t=>setTimeout(t,0);const ou=Vc,au=(t,e)=>sc.async(t,e);function lu(){sc.on(...arguments)}function cu(){sc.off(...arguments)}if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){let t=window.__PROMISE_INSTRUMENTATION__;oc("instrument",!0);for(let e in t)t.hasOwnProperty(e)&&lu(e,t[e])}const uu={asap:Yc,cast:ou,Promise:Tc,EventTarget:rc,all:Ic,allSettled:Ac,race:Fc,hash:zc,hashSettled:jc,rethrow:Nc,defer:Uc,denodeify:Pc,configure:oc,on:lu,off:cu,resolve:Vc,reject:$c,map:qc,async:au,filter:Hc},hu=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:rc,Promise:Tc,all:Ic,allSettled:Ac,asap:Yc,async:au,cast:ou,configure:oc,default:uu,defer:Uc,denodeify:Pc,filter:Hc,hash:zc,hashSettled:jc,map:qc,off:cu,on:lu,race:Fc,reject:$c,resolve:Vc,rethrow:Nc},Symbol.toStringTag,{value:"Module"}));function du(t){let e=function(t){if(!t)return;let e=t;return e.errorThrown?function(t){let e=t.errorThrown;return"string"==typeof e&&(e=new Error(e)),Object.defineProperty(e,"__reason_with_error_thrown__",{value:t,enumerable:!1}),e}(e):"UnrecognizedURLError"!==t.name&&"TransitionAborted"!==t.name?t:void 0}(t);if(e)throw e}oc("async",(t,e)=>{ga.schedule("actions",null,t,e)}),oc("after",t=>{ga.schedule(pa,null,t)}),lu("error",du);const{isArray:pu}=Array;function fu(t){return null==t?[]:pu(t)?t:[t]}function gu(t){return"object"==typeof t&&null!==t&&"function"==typeof t.setUnknownProperty}const mu=Bl.prototype.reopen,yu=new WeakSet,_u=new WeakMap,vu=new Set;function bu(t){vu.has(t)||t.destroy()}function wu(t,e){let n=ae(t);if(void 0!==e){let i=t.concatenatedProperties,r=t.mergedProperties,s=Object.keys(e);for(let o of s){let s=e[o],a=Mr(t,o,n),l=void 0!==a;if(!l){if(void 0!==i&&i.length>0&&i.includes(o)){let e=t[o];s=e?fu(e).concat(s):fu(s)}if(void 0!==r&&r.length>0&&r.includes(o)){let e=t[o];s=Object.assign({},e,s)}}l?a.set(t,o,s):gu(t)&&!(o in t)?t.setUnknownProperty(o,s):t[o]=s}}t.init(e),n.unsetInitializing();let i=n.observerEvents();if(void 0!==i)for(let r=0;rn.willDestroy()),ae(e).setInitializing()}reopen(...t){return jl(this,t),this}init(t){}get isDestroyed(){return Yt(this)}set isDestroyed(t){}get isDestroying(){return Xt(this)}set isDestroying(t){}destroy(){vu.add(this);try{Ht(this)}finally{vu.delete(this)}return this}willDestroy(){}toString(){let t="object"==typeof this&&null!==this&&"function"==typeof this.toStringExtension?`:${this.toStringExtension()}`:"";return`<${bl(this)||"(unknown)"}:${et(this)}${t}>`}static extend(...t){let e=class extends(this){};return mu.apply(e.PrototypeMixin,t),e}static create(...t){let e,n=t[0];return void 0!==n?(e=new this(ur(n)),wl(e,bl(n))):e=new this,t.length<=1?wu(e,n):wu(e,Su.apply(this,t)),e}static reopen(...t){return this.willReopen(),mu.apply(this.PrototypeMixin,t),this}static willReopen(){let t=this.prototype;yu.has(t)&&(yu.delete(t),_u.has(this)&&_u.set(this,Bl.create(this.PrototypeMixin)))}static reopenClass(...t){return jl(this,t),this}static detect(t){if("function"!=typeof t)return!1;for(;t;){if(t===this)return!0;t=t.superclass}return!1}static detectInstance(t){return t instanceof this}static metaForProperty(t){return Mr(this.proto(),t)._meta||{}}static eachComputedProperty(t,e=this){this.proto();let n={};ae(this.prototype).forEachDescriptors((i,r)=>{if(r.enumerable){let s=r._meta||n;t.call(e,i,s)}})}static get PrototypeMixin(){let t=_u.get(this);return void 0===t&&(t=Bl.create(),t.ownerConstructor=this,_u.set(this,t)),t}static get superclass(){let t=Object.getPrototypeOf(this);return t!==Function.prototype?t:void 0}static proto(){let t=this.prototype;if(!yu.has(t)){yu.add(t);let e=this.superclass;e&&e.proto(),_u.has(this)&&this.PrototypeMixin.apply(t)}return t}static toString(){return`<${bl(this)||"(unknown)"}:constructor>`}static isClass=!0;static isMethod=!1;static _onLookup;static _lazyInjections}function Su(...t){let e={};for(let n of t){let t=Object.keys(n);for(let i=0,r=t.length;is.push(t));return pt(e,{paths:s,sync:i}),e}Ar(Mu);const Ou=Object.freeze(Object.defineProperty({__proto__:null,action:Mu,computed:ps,default:Tu,defineProperty:ms,get:Ss,getProperties:Js,notifyPropertyChange:ss,observer:Iu,set:Ls,setProperties:Qs,trySet:Ds},Symbol.toStringTag,{value:"Module"}));function Au(t){if(!(t instanceof MouseEvent))return!1;let e=t.shiftKey||t.metaKey||t.altKey||t.ctrlKey,n=t.which>1;return!e&&!n}function Fu(t){return'Binding style attributes may introduce cross-site scripting vulnerabilities; please ensure that values being bound are properly escaped. For more information, including how to disable this warning, see https://deprecations.emberjs.com/v1.x/#toc_binding-style-attributes. Style affected: "'+t+'"'}function Lu(t){let e=t.lookup("-view-registry:main"),n=[];return Object.keys(e).forEach(t=>{let i=e[t];null===i.parentView&&n.push(i)}),n}function zu(t){return""!==t.tagName&&t.elementId?t.elementId:et(t)}const Du=new WeakMap,ju=new WeakMap;function Nu(t){return Du.get(t)||null}function Uu(t){return ju.get(t)||null}function Bu(t,e){Du.set(t,e)}function qu(t,e){ju.set(t,e)}function Vu(t){Du.delete(t)}function $u(t){ju.delete(t)}const Gu=new WeakMap;function Wu(t){return function(t,e){let n=[],i=Gu.get(t);return void 0!==i&&i.forEach(t=>{let i=e[t];!i||i.isDestroying||i.isDestroyed||n.push(i)}),n}(t,ur(t).lookup("-view-registry:main"))}function Hu(t,e){let n=Gu.get(t);void 0===n&&(n=function(t){let e=new Set;return Gu.set(t,e),e}(t)),n.add(zu(e))}function Ku(t){return t.renderer.getBounds(t)}function Xu(t){let e=Ku(t),n=document.createRange();return n.setStartBefore(e.firstNode),n.setEndAfter(e.lastNode),n}function Yu(t){return Xu(t).getClientRects()}function Zu(t){return Xu(t).getBoundingClientRect()}const Ju="ember-application";class Qu extends Tu{events={touchstart:"touchStart",touchmove:"touchMove",touchend:"touchEnd",touchcancel:"touchCancel",keydown:"keyDown",keyup:"keyUp",keypress:"keyPress",mousedown:"mouseDown",mouseup:"mouseUp",contextmenu:"contextMenu",click:"click",dblclick:"doubleClick",focusin:"focusIn",focusout:"focusOut",submit:"submit",input:"input",change:"change",dragstart:"dragStart",drag:"drag",dragenter:"dragEnter",dragleave:"dragLeave",dragover:"dragOver",drop:"drop",dragend:"dragEnd"};rootElement="body";_eventHandlers=Object.create(null);_didSetup=!1;finalEventNameMapping=null;_sanitizedRootElement=null;lazyEvents=new Map;_reverseEventNameMapping=null;setup(t,e){let n=this.finalEventNameMapping={...Ss(this,"events"),...t};this._reverseEventNameMapping=Object.keys(n).reduce((t,e)=>{let i=n[e];return i?{...t,[i]:e}:t},{});let i=this.lazyEvents;null!=e&&Ls(this,"rootElement",e);let r=Ss(this,"rootElement"),s="string"!=typeof r?r:document.querySelector(r);s.classList.add(Ju),this._sanitizedRootElement=s;for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.set(o,n[o]??null);this._didSetup=!0}setupHandlerForBrowserEvent(t){this.setupHandler(this._sanitizedRootElement,t,this.finalEventNameMapping[t]??null)}setupHandlerForEmberEvent(t){let e=this._reverseEventNameMapping?.[t];e&&this.setupHandler(this._sanitizedRootElement,e,t)}setupHandler(t,e,n){if(null===n||!this.lazyEvents.has(e))return;let i=(t,e)=>{let i=Nu(t),r=!0;return i&&(r=i.handleEvent(n,e)),r},r=this._eventHandlers[e]=t=>{let e=t.target;do{if(Nu(e)){if(!1===i(e,t)){t.preventDefault(),t.stopPropagation();break}if(!0===t.cancelBubble)break}e=e.parentNode}while(e instanceof Element)};t.addEventListener(e,r),this.lazyEvents.delete(e)}destroy(){if(!1===this._didSetup)return;let t=this._sanitizedRootElement;if(t){for(let e in this._eventHandlers)t.removeEventListener(e,this._eventHandlers[e]);return t.classList.remove(Ju),this._super(...arguments)}}toString(){return"(EventDispatcher)"}}const th=Bl.create({on(t,e,n){return jr(this,t,e,n),this},one(t,e,n){return jr(this,t,e,n,!0),this},trigger(t,...e){Ur(this,t,e)},off(t,e,n){return Nr(this,t,e,n),this},has(t){return Br(this,t)}}),eh=Object.freeze(Object.defineProperty({__proto__:null,default:th,on:qr},Symbol.toStringTag,{value:"Module"}));let nh=class extends Tu{},ih=[],rh={};const sh=(()=>{let t="undefined"!=typeof window&&window.performance||{},e=t.now||t.mozNow||t.webkitNow||t.msNow||t.oNow;return e?e.bind(t):Date.now})();function oh(t,e,n,i){let r,s,o;if(arguments.length<=3&&function(t){return"function"==typeof t}(e)?(s=e,o=n):(r=e,s=n,o=i),0===ih.length)return s.call(o);let a=r||{},l=ch(t,()=>a);return l===lh?s.call(o):function(t,e,n,i){try{return t.call(i)}catch(r){throw n.exception=r,r}finally{e()}}(s,l,a,o)}function ah(t,e,n){return n()}function lh(){}function ch(t,e,n){if(0===ih.length)return lh;let i=rh[t];if(i||(i=function(t){let e=[];for(let n of ih)n.regex.test(t)&&e.push(n.object);return rh[t]=e,e}(t)),0===i.length)return lh;let r,s=e(n),o=g.STRUCTURED_PROFILE;o&&(r=`${t}: ${s.object}`,console.time(r));let a=[],l=sh();for(let u of i)a.push(u.before(t,l,s));const c=i;return function(){let e=sh();for(let n=0;n!0,rerender(){},destroy(){}}),gh=Object.freeze({...fh}),mh=Object.freeze({...fh,rerender(t){t.renderer.rerender()},destroy(t){t.renderer.remove(t)},handleEvent:(t,e,n)=>!t.has(e)||ah(0,0,()=>ya(t,t.trigger,e,n))}),yh=Object.freeze({...mh,enter(t){t.renderer.register(t)}}),_h=Object.freeze({...fh,appendChild(){throw new Error("You can't call appendChild on a view being destroyed")},rerender(){throw new Error("You can't call rerender on a view being destroyed")}}),vh=Object.freeze({preRender:gh,inDOM:yh,hasElement:mh,destroying:_h});var bh=Object.defineProperty;((t,e)=>{for(var n in e)bh(t,n,{get:e[n],enumerable:!0})})({},{c:()=>Th,f:()=>xh,g:()=>Sh,i:()=>Eh,m:()=>Ch,n:()=>kh,p:()=>Rh});var wh=new WeakMap;function xh(t,e,n,i){return Sh(t.prototype,e,n,i)}function Sh(t,e,n,i){let r={configurable:!0,enumerable:!0,writable:!0,initializer:null};i&&(r.initializer=i);for(let s of n)r=s(t,e,r)||r;void 0===r.initializer?Object.defineProperty(t,e,r):function(t,e,n){let i=wh.get(t);i||(i=new Map,wh.set(t,i)),i.set(e,n)}(t,e,r)}function Ch({prototype:t},e,n){return kh(t,e,n)}function kh(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}function Eh(t,e){let n=function(t,e){let n=t.prototype;for(;n;){let t=wh.get(n)?.get(e);if(t)return t;n=n.prototype}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}function Th(t,e){return e.reduce((t,e)=>e(t)||t,t)}function Rh(t,e){for(let[n,i,r]of e)"field"===n?Ph(t,i,r):kh(t,i,r);return t}function Ph(t,e,n){let i={configurable:!0,enumerable:!0,writable:!0,initializer:()=>Object.getOwnPropertyDescriptor(t,e)?.value};for(let r of n)i=r(t,e,i)||i;i.initializer&&(i.value=i.initializer.call(t),delete i.initializer),Object.defineProperty(t,e,i)}class Mh extends(nh.extend(th,Xl)){isView=!0;_superTrigger;_superHas;init(t){super.init(t),this._superTrigger=this.trigger,this.trigger=this._trigger,this._superHas=this.has,this.has=this._has,this.parentView??=null,this._state="preRender",this._currentState=this._states.preRender}static{Sh(this.prototype,"renderer",[Ms("renderer","-dom")])}#l=void Eh(this,"renderer");instrumentDetails(t){return t.object=this.toString(),t.containerKey=this._debugContainerKey,t.view=this,t}_trigger(t,...e){this._superTrigger(t,...e);let n=this[t];if("function"==typeof n)return n.apply(this,e)}_has(t){return"function"==typeof this[t]||this._superHas(t)}static isViewFactory=!0}Mh.prototype._states=vh;const Ih=Bl.create({send(t,...e){let n=this.actions&&this.actions[t];if(n&&!0!==n.apply(this,e))return;let i=Ss(this,"target");i&&i.send(...arguments)}}),Oh={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object","[object FileList]":"filelist"},{toString:Ah}=Object.prototype;function Fh(t){if(null===t)return"null";if(void 0===t)return"undefined";let e=Oh[Ah.call(t)]||"object";return"function"===e?xu.detect(t)&&(e="class"):"object"===e&&(t instanceof Error?e="error":t instanceof xu?e="instance":t instanceof Date&&(e="date")),e}const Lh={undefined:0,null:1,boolean:2,number:3,string:4,array:5,object:6,instance:7,function:8,class:9,date:10,regexp:11,filelist:12,error:13};function zh(t,e){return Math.sign(t-e)}function Dh(t,e){if(t===e)return 0;let n=Fh(t),i=Fh(e);if("instance"===n&&jh(t)&&t.constructor.compare)return t.constructor.compare(t,e);if("instance"===i&&jh(e)&&e.constructor.compare)return-1*e.constructor.compare(e,t);let r=zh(Lh[n],Lh[i]);if(0!==r)return r;switch(n){case"boolean":return zh(Number(t),Number(e));case"number":return zh(t,e);case"string":return zh(t.localeCompare(e),0);case"array":{let n=t.length,i=e.length,r=Math.min(n,i);for(let s=0;st;function Bh(t,e=Uh){let n=id(),i=new Set,r="function"==typeof e?e:t=>Ss(t,e);return t.forEach(t=>{let e=r(t);i.has(e)||(i.add(e),n.push(t))}),n}function qh(...t){let e=2===t.length,[n,i]=t;return e?t=>i===Ss(t,n):t=>Boolean(Ss(t,n))}function Vh(t,e,n){let i=t.length;for(let r=n;r!i(t,e,n),0)}function Hh(t,e,n=0,i){let r=t.length;return n<0&&(n+=r),Vh(t,i&&e!=e?t=>t!=t:t=>t===e,n)}function Kh(t,e,n){return Ws(t,e,n??1,Nh),t}function Xh(t,e,n){return Ws(t,e,0,[n]),n}function Yh(t){if(!t||t.setInterval)return!1;if(Array.isArray(t)||Qh.detect(t))return!0;let e=Fh(t);if("array"===e)return!0;let n=t.length;return"number"==typeof n&&n==n&&"object"===e}function Zh(t){let e=ps(t);return e.enumerable=!1,e}function Jh(t){return this.map(e=>Ss(e,t))}const Qh=Bl.create(Ql,{init(){this._super(...arguments),ir.add(this)},objectsAt(t){return t.map(t=>dr(this,t))},"[]":Zh({get(){return this},set(t,e){return this.replace(0,this.length,e),this}}),firstObject:Zh(function(){return dr(this,0)}).readOnly(),lastObject:Zh(function(){return dr(this,this.length-1)}).readOnly(),slice(t=0,e){let n,i=id(),r=this.length;for(t<0&&(t=r+t),n=void 0===e||e>r?r:e<0?r+e:e;t=n)&&(e=n-1),e<0&&(e+=n);for(let i=e;i>=0;i--)if(dr(this,i)===t)return i;return-1},forEach(t,e=null){let n=this.length;for(let i=0;iLs(n,t,e))},map(t,e=null){let n=id();return this.forEach((i,r,s)=>n[r]=t.call(e,i,r,s)),n},mapBy:Jh,filter(t,e=null){let n=id();return this.forEach((i,r,s)=>{t.call(e,i,r,s)&&n.push(i)}),n},reject(t,e=null){return this.filter(function(){return!t.apply(e,arguments)})},filterBy(){return this.filter(qh(...arguments))},rejectBy(){return this.reject(qh(...arguments))},find(t,e=null){return $h(this,t,e)},findBy(){return $h(this,qh(...arguments))},every(t,e=null){return Wh(this,t,e)},isEvery(){return Wh(this,qh(...arguments))},any(t,e=null){return Gh(this,t,e)},isAny(){return Gh(this,qh(...arguments))},reduce(t,e){let n=e;return this.forEach(function(e,i){n=t(n,e,i,this)},this),n},invoke(t,...e){let n=id();return this.forEach(i=>n.push(i[t]?.(...e))),n},toArray(){return this.map(t=>t)},compact(){return this.filter(t=>null!=t)},includes(t,e){return-1!==Hh(this,t,e,!0)},sortBy(){let t=arguments;return this.toArray().sort((e,n)=>{for(let i=0;ie!==t:t=>t==t;return this.filter(e)}}),td=Bl.create(Qh,tc,{clear(){let t=this.length;return 0===t||this.replace(0,t,Nh),this},insertAt(t,e){return Xh(this,t,e),this},removeAt(t,e){return Kh(this,t,e)},pushObject(t){return Xh(this,this.length,t)},pushObjects(t){return this.replace(this.length,0,t),this},popObject(){let t=this.length;if(0===t)return null;let e=dr(this,t-1);return this.removeAt(t-1,1),e},shiftObject(){if(0===this.length)return null;let t=dr(this,0);return this.removeAt(0),t},unshiftObject(t){return Xh(this,0,t)},unshiftObjects(t){return this.replace(0,0,t),this},reverseObjects(){let t=this.length;if(0===t)return this;let e=this.toArray().reverse();return this.replace(0,t,e),this},setObjects(t){if(0===t.length)return this.clear();let e=this.length;return this.replace(0,e,t),this},removeObject(t){let e=this.length||0;for(;--e>=0;)dr(this,e)===t&&this.removeAt(e);return this},removeObjects(t){os();for(let e=t.length-1;e>=0;e--)this.removeObject(t[e]);return as(),this},addObject(t){return this.includes(t)||this.pushObject(t),this},addObjects(t){return os(),t.forEach(t=>this.addObject(t)),as(),this}});let ed=Bl.create(td,ku,{objectAt(t){return this[t]},replace(t,e,n=Nh){return Ks(this,t,e,n),this}});const nd=["length"];let id;ed.keys().forEach(t=>{Array.prototype[t]&&nd.push(t)}),ed=ed.without(...nd),id=function(t){return rr(t)?t:ed.apply(t??[])};const rd=Object.freeze(Object.defineProperty({__proto__:null,get A(){return id},MutableArray:td,get NativeArray(){return ed},default:Qh,isArray:Yh,makeArray:fu,removeAt:Kh,uniqBy:Bh},Symbol.toStringTag,{value:"Module"})),sd=kt("MODEL"),od=Bl.create(Xl,{isController:!0,concatenatedProperties:["queryParams"],target:null,store:null,init(){this._super(...arguments);let t=ur(this);t&&(this.namespace=t.lookup("application:main"),this.target=t.lookup("router:main"))},model:ps({get(){return this[sd]},set(t,e){return this[sd]=e}}),queryParams:null,_qpDelegate:null,_qpChanged(t,e){let n=e.indexOf(".[]"),i=-1===n?e:e.slice(0,n);(0,t._qpDelegate)(i,Ss(t,i))}});class ad extends(nh.extend(od)){}function ld(...t){return Ms("controller",...t)}const cd=Object.freeze(Object.defineProperty({__proto__:null,ControllerMixin:od,default:ad,inject:ld},Symbol.toStringTag,{value:"Module"})),ud=Symbol("ENGINE_PARENT");function hd(t){return t[ud]}class dd extends(Tu.extend(Gl,Hl)){static setupRegistry(t,e){}[ud];_booted=!1;init(t){super.init(t),et(this),this.base??=this.application;let e=this.__registry__=new Cl({fallback:this.base.__registry__});this.__container__=e.container({owner:this}),this._booted=!1}_bootPromise=null;boot(t){return this._bootPromise||(this._bootPromise=new hu.Promise(e=>{e(this._bootSync(t))})),this._bootPromise}_bootSync(t){return this._booted||(this.cloneParentDependencies(),this.setupRegistry(t),this.base.runInstanceInitializers(this),this._booted=!0),this}setupRegistry(t=this.__container__.lookup("-environment:main")){this.constructor.setupRegistry(this.__registry__,t)}unregister(t){this.__container__.reset(t),this.__registry__.unregister(t)}buildChildEngineInstance(t,e={}){let n=this.lookup(`engine:${t}`);if(!n)throw new Error(`You attempted to mount the engine '${t}', but it is not registered with its parent.`);let i=n.buildInstance(e);return i[ud]=this,i}cloneParentDependencies(){const t=hd(this);["route:basic","service:-routing"].forEach(e=>{let n=t.resolveRegistration(e);this.register(e,n)});let e=t.lookup("-environment:main");this.register("-environment:main",e,{instantiate:!1});let n=["router:main",Tl`-bucket-cache:main`,"-view-registry:main","renderer:-dom","service:-document"];e.isInteractive&&n.push("event_dispatcher:main"),n.forEach(e=>{let n=t.lookup(e);this.register(e,n,{instantiate:!1})})}}let pd=function(t,e,n){let{get:i}=n;return void 0!==i&&(n.get=function(){let t,n=on(this,e),r=Ge(()=>{t=i.call(this)});return me(n,r),De(r),t}),n};function fd(...t){if(xr(t)){let[e,n,i]=t;return pd(0,n,i)}{const e=t[0];let n=function(t,n){return pd(0,n,e)};return Ar(n),n}}Ar(fd);var gd=Object.create;function md(){var t=gd(null);return t.__=void 0,delete t.__,t}var yd=function(t,e,n){this.path=t,this.matcher=e,this.delegate=n};yd.prototype.to=function(t,e){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),e){if(0===e.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,e,this.delegate)}};var _d=function(t){this.routes=md(),this.children=md(),this.target=t};function vd(t,e,n){return function(i,r){var s=t+i;if(!r)return new yd(s,e,n);r(vd(s,e,n))}}function bd(t,e,n){for(var i=0,r=0;r0&&47===e.charCodeAt(0)&&(e=e.substr(1));for(var i=e.split("/"),r=void 0,s=void 0,o=0;o2&&"[]"===s.slice(o-2)&&(a=!0,n[s=s.slice(0,o-2)]||(n[s]=[])),l=r[1]?qd(r[1]):""),a?n[s].push(l):n[s]=l}return n},Vd.prototype.recognize=function(t){var e,n=[this.rootState],i={},r=!1,s=t.indexOf("#");-1!==s&&(t=t.substr(0,s));var o=t.indexOf("?");if(-1!==o){var a=t.substr(o+1,t.length);t=t.substr(0,o),i=this.parseQueryString(a)}"/"!==t.charAt(0)&&(t="/"+t);var l=t;Vd.ENCODE_AND_DECODE_PATH_SEGMENTS?t=xd(t):(t=decodeURI(t),l=decodeURI(l));var c=t.length;c>1&&"/"===t.charAt(c-1)&&(t=t.substr(0,c-1),l=l.substr(0,l.length-1),r=!0);for(var u=0;u0){let r=t[i-1];if(function(t){if(t&&"object"==typeof t){let e=t;return"queryParams"in e&&Object.keys(e.queryParams).every(t=>"string"==typeof t)}return!1}(r))return n=r.queryParams,e=Wd.call(t,0,i-1),[e,n]}return[t,null]}function Yd(t){for(let e in t){let n=t[e];if("number"==typeof n)t[e]=""+n;else if(Array.isArray(n))for(let t=0,e=n.length;t{throw this.router.transitionDidError(t,this)},np("Handle Abort"))}else this.promise=Tc.resolve(this[ip]),this[rp]={}}then(t,e,n){return this.promise.then(t,e,n)}catch(t,e){return this.promise.catch(t,e)}finally(t,e){return this.promise.finally(t,e)}abort(){this.rollback();let t=new ap(this.router,void 0,void 0,void 0);return t.to=this.from,t.from=this.from,t.isAborted=!0,this.router.routeWillChange(t),this.router.routeDidChange(t),this}rollback(){this.isAborted||(Zd(this.router,this.sequence,this.targetName+": transition was aborted"),void 0!==this.intent&&null!==this.intent&&(this.intent.preTransitionState=this.router.state),this.isAborted=!0,this.isActive=!1,this.router.activeTransition=void 0)}redirect(t){this[op]=t,this.rollback(),this.router.routeWillChange(t)}retry(){this.abort();let t=this.router.transitionByIntent(this.intent,!1);return null!==this.urlMethod&&t.method(this.urlMethod),t}method(t){return this.urlMethod=t,this}send(t=!1,e,n,i,r){this.trigger(t,e,n,i,r)}trigger(t=!1,e,...n){"string"==typeof t&&(e=t,t=!1),this.router.triggerEvent(this[ip].routeInfos.slice(0,this.resolveIndex+1),t,e,n)}followRedirects(){return this.promise.catch(t=>this[op]?this[op].followRedirects():Tc.reject(t))}toString(){return"Transition (sequence "+this.sequence+")"}log(t){Zd(this.router,this.sequence,t)}}function lp(t){return Zd(t.router,t.sequence,"detected abort."),$d()}function cp(t){return"object"==typeof t&&t instanceof ap&&t.isTransition}const up=function(){function t(e){let n=Error.call(this,e);this.name="UnrecognizedURLError",this.message=e||"UnrecognizedURL",Error.captureStackTrace?Error.captureStackTrace(this,t):this.stack=n.stack}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}();function hp(t,e){let n=t.factoryFor("controller:basic").class;n=class extends n{toString(){return`(generated ${e} controller)`}};let i=`controller:${e}`;return t.register(i,n),t.factoryFor(i)}function dp(t,e){hp(t,e);let n=`controller:${e}`;return t.lookup(n)}const pp=/\./g;function fp(t){let e,n,i=(t=t.slice())[t.length-1];return function(t){if(t&&"object"==typeof t){let e=t.queryParams;if(e&&"object"==typeof e)return Object.keys(e).every(t=>"string"==typeof t)}return!1}(i)?(t.pop(),e=i.queryParams):e={},"string"==typeof t[0]&&(n=t.shift()),{routeName:n,models:t,queryParams:e}}function gp(t,e){if(e._namesStashed)return;let n,i=e[e.length-1].name,r=t._routerMicrolib.recognizer.handlersFor(i);for(let s=0;s(t[e]=n,t),s)}serializeQueryParamKey(t){return t}serializeQueryParam(t,e,n){return this._router._serializeQueryParam(t,n)}deserializeQueryParam(t,e,n){return this._router._deserializeQueryParam(t,n)}_optionsForQueryParam(t){const e=Ss(this,"queryParams");return Ss(e,t.urlKey)||Ss(e,t.prop)||e[t.urlKey]||e[t.prop]||{}}resetController(t,e,n){return this}exit(t){this.deactivate(t),this.trigger("deactivate",t),this.teardownViews()}_internalReset(t,e){let n=this.controller;n._qpDelegate=Ss(this,"_qp").states.inactive,this.resetController(n,t,e)}enter(t){this[xp]=void 0,this.activate(t),this.trigger("activate",t)}deactivate(t){}activate(t){}intermediateTransitionTo(...t){let[e,...n]=function(t,e){let n,i=ur(t),r=i.mountPoint;if(i.routable&&"string"==typeof e[0]){if(n=e[0],vp(n))throw new Error("Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.");n=`${r}.${n}`,e[0]=n}return e}(this,t);this._router.intermediateTransitionTo(e,...n)}refresh(){return this._router._routerMicrolib.refresh(this)}setup(t,e){let n=this.controllerName||this.routeName,i=this.controllerFor(n,!0)??this.generateController(n),r=Ss(this,"_qp");if(!this.controller){let t=r.propertyNames;!function(t,e){e.forEach(e=>{if(void 0===Mr(t,e)){let n=_t(t,e);null===n||"function"!=typeof n.get&&"function"!=typeof n.set||ms(t,e,fd({get:n.get,set:n.set}))}Wr(t,`${e}.[]`,t,t._qpChanged,!1)})}(i,t),this.controller=i}let s=r.states;if(i._qpDelegate=s.allowOverrides,e){gp(this._router,e[ip].routeInfos);let t=this._bucketCache,n=e[rp];r.propertyNames.forEach(e=>{let s=r.map[e];s.values=n;let o=yp(s.route.fullRouteName,s.parts,s.values),a=t.lookup(o,e,s.undecoratedDefaultValue);Ls(i,e,a)});let s=Ep(this,e[ip]);Qs(i,s)}this.setupController(i,t,e),this._environment.options.shouldRender&&this[wp](),ts(!1)}_qpChanged(t,e,n){if(!n)return;let i=this._bucketCache,r=yp(n.route.fullRouteName,n.parts,n.values);i.stash(r,t,e)}beforeModel(t){}afterModel(t,e){}redirect(t,e){}contextDidChange(){this.currentModel=this.context}model(t,e){let n,i,r=Ss(this,"_qp").map;for(let s in t){if("queryParams"===s||r&&s in r)continue;let t=s.match(/^(.*)_id$/);null!==t&&(n=t[1]),i=!0}if(!n){if(i)return Object.assign({},t);if(e.resolveIndex<1)return;return e[ip].routeInfos[e.resolveIndex-1].context}}deserialize(t,e){return this.model(this._paramsFor(this.routeName,t),e)}setupController(t,e,n){t&&void 0!==e&&Ls(t,"model",e)}controllerFor(t,e=!1){let n=ur(this),i=n.lookup(`route:${t}`);return i&&i.controllerName&&(t=i.controllerName),n.lookup(`controller:${t}`)}generateController(t){return dp(ur(this),t)}modelFor(t){let e,n=ur(this),i=this._router&&this._router._routerMicrolib?this._router._routerMicrolib.activeTransition:void 0;e=n.routable&&void 0!==i?Rp(n,t):t;let r=n.lookup(`route:${e}`);if(null!=i){let t=r&&r.routeName||e;if(Object.prototype.hasOwnProperty.call(i.resolvedModels,t))return i.resolvedModels[t]}return r?.currentModel}[xp]=void 0;[wp](){this[xp]=function(t){let e,n=ur(t),i=t.routeName,r=n.lookup(`controller:${t.controllerName||i}`),s=t.currentModel,o=n.lookup(`template:${t.templateName||i}`);return e=o?zi(o)?o:o(n):t._topLevelViewTemplate(n),{owner:n,name:i,controller:r,model:s,template:e}}(this),ba(this._router,"_setOutlets")}willDestroy(){this.teardownViews()}teardownViews(){this[xp]&&(this[xp]=void 0,ba(this._router,"_setOutlets"))}buildRouteInfoMetadata(){}_paramsFor(t,e){return void 0!==this._router._routerMicrolib.activeTransition?this.paramsFor(t):e}get _store(){const t=ur(this);return this.routeName,{find(e,n){let i=t.factoryFor(`model:${e}`);if(i)return i=i.class,i.find(n)}}}static{kh(this.prototype,"_store",[ps])}get _qp(){let t={},e=this.controllerName||this.routeName,n=ur(this),i=n.lookup(`controller:${e}`),r=Ss(this,"queryParams"),s=Object.keys(r).length>0;i?t=function(t,e){let n={},i={defaultValue:!0,type:!0,scope:!0,as:!0};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]={...t[r],...e[r]},i[r]=!0);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&!i[r]&&(n[r]={...e[r],...t[r]});return n}(function(t){let e={};for(let n of t)_p(n,e);return e}(Ss(i,"queryParams")||[]),r):s&&(i=dp(n,e),t=r);let o=[],a={},l=[];for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;if("unknownProperty"===c||"_super"===c)continue;let n,r=t[c],s=r.scope||"model";"controller"===s&&(n=[]);let u=r.as||this.serializeQueryParamKey(c),h=Ss(i,c);h=Tp(h);let d=r.type||Fh(h),p=this.serializeQueryParam(h,u,d),f=`${e}:${c}`,g={undecoratedDefaultValue:Ss(i,c),defaultValue:h,serializedDefaultValue:p,serializedValue:p,type:d,urlKey:u,prop:c,scopedPropertyName:f,controllerName:e,route:this,parts:n,values:null,scope:s};a[c]=a[u]=a[f]=g,o.push(g),l.push(c)}return{qps:o,map:a,propertyNames:l,states:{inactive:(t,e)=>{let n=a[t];this._qpChanged(t,e,n)},active:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._activeQPChanged(n,e)},allowOverrides:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._updatingQPChanged(n)}}}}static{kh(this.prototype,"_qp",[ps])}}function Cp(t){return t[xp]}function kp(t,e){if(e.fullQueryParams)return e.fullQueryParams;let n=e.routeInfos.every(t=>t.route),i={...e.queryParams};return t._deserializeQueryParams(e.routeInfos,i),n&&(e.fullQueryParams=i),i}function Ep(t,e){e.queryParamsFor=e.queryParamsFor||{};let n=t.fullRouteName,i=e.queryParamsFor[n];if(i)return i;let r=kp(t._router,e),s=e.queryParamsFor[n]={},o=Ss(t,"_qp").qps;for(let a of o){let t=a.prop in r;s[a.prop]=t?r[a.prop]:Tp(a.defaultValue)}return s}function Tp(t){return Array.isArray(t)?id(t.slice()):t}function Rp(t,e){if(t.routable){let n=t.mountPoint;return"application"===e?n:`${n}.${e}`}return e}const Pp=Sp.prototype.serialize;Sp.reopen({mergedProperties:["queryParams"],queryParams:{},templateName:null,controllerName:null,send(...t){if(this._router&&this._router._routerMicrolib||!b())this._router.send(...t);else{let e=t.shift(),n=this.actions[e];if(n)return n.apply(this,t)}},actions:{queryParamsDidChange(t,e,n){let i=Ss(this,"_qp").map,r=Object.keys(t).concat(Object.keys(n));for(let s of r){let t=i[s];if(t&&Ss(this._optionsForQueryParam(t),"refreshModel")&&this._router.currentState){this.refresh();break}}return!0},finalizeQueryParamChange(t,e,n){if("application"!==this.fullRouteName)return!0;if(!n)return;let i,r=n[ip].routeInfos,s=this._router,o=s._queryParamsFor(r),a=s._qpUpdates,l=!1;gp(s,r);for(let c of o.qps){let r,s,o=c.route,u=o.controller,h=c.urlKey in t&&c.urlKey;if(a.has(c.urlKey)?(r=Ss(u,c.prop),s=o.serializeQueryParam(r,c.urlKey,c.type)):h?(s=t[h],void 0!==s&&(r=o.deserializeQueryParam(s,c.urlKey,c.type))):(s=c.serializedDefaultValue,r=Tp(c.defaultValue)),u._qpDelegate=Ss(o,"_qp").states.inactive,s!==c.serializedValue){if(n.queryParamsOnly&&!1!==i){let t=Ss(o._optionsForQueryParam(c),"replace");t?i=!0:!1===t&&(i=!1)}Ls(u,c.prop,r),l=!0}c.serializedValue=s,c.serializedDefaultValue===s||e.push({value:s,visible:!0,key:h||c.urlKey})}!0===l&&ts(!1),i&&n.method("replace"),o.qps.forEach(t=>{let e=Ss(t.route,"_qp");t.route.controller._qpDelegate=Ss(e,"states.active")}),s._qpUpdates.clear()}}});class Mp{cache;constructor(){this.cache=new Map}has(t){return this.cache.has(t)}stash(t,e,n){let i=this.cache.get(t);void 0===i&&(i=new Map,this.cache.set(t,i)),i.set(e,n)}lookup(t,e,n){if(!this.has(t))return n;let i=this.cache.get(t);return i.has(e)?i.get(e):n}}let Ip=0;function Op(t){return"function"==typeof t}class Ap{parent;matches;enableLoadingSubstates;explicitIndex=!1;options;constructor(t=null,e){this.parent=t,this.enableLoadingSubstates=Boolean(e&&e.enableLoadingSubstates),this.matches=[],this.options=e}route(t,e,n){let i,r=null,s=`/_unused_dummy_error_path_route_${t}/:error`;if(Op(e)?(i={},r=e):Op(n)?(i=e,r=n):i=e||{},this.enableLoadingSubstates&&(Lp(this,`${t}_loading`,{resetNamespace:i.resetNamespace}),Lp(this,`${t}_error`,{resetNamespace:i.resetNamespace,path:s})),r){let e=Fp(this,t,i.resetNamespace),n=new Ap(e,this.options);Lp(n,"loading"),Lp(n,"error",{path:s}),r.call(n),Lp(this,t,i,n.generate())}else Lp(this,t,i)}push(t,e,n,i){let r=e.split(".");if(this.options.engineInfo){let t=e.slice(this.options.engineInfo.fullName.length+1),n=Object.assign({localFullName:t},this.options.engineInfo);i&&(n.serializeMethod=i),this.options.addRouteForEngine(e,n)}else if(i)throw new Error(`Defining a route serializer on route '${e}' outside an Engine is not allowed.`);""!==t&&"/"!==t&&"index"!==r[r.length-1]||(this.explicitIndex=!0),this.matches.push(t,e,n)}generate(){let t=this.matches;return this.explicitIndex||this.route("index",{path:"/"}),e=>{for(let n=0;n0){let r=Object.assign({},n);return this.emberRouter._prepareQueryParams(t,e,r),bp(r,i.queryParams)}return!0}}let Dp=new WeakMap;function jp(t,e={},n={includeAttributes:!1,localizeMapUpdates:!1}){const i=new WeakMap;return t.map((r,s)=>{let{name:o,params:a,paramNames:l,context:c,route:u}=r,h=r;if(Dp.has(h)&&n.includeAttributes){let t=Dp.get(h);t=function(t,e){let n={get metadata(){return Up(t)}};return!Object.isExtensible(e)||e.hasOwnProperty("metadata")?Object.freeze(Object.assign({},e,n)):Object.assign(e,n)}(u,t);let e=Np(t,c);return i.set(h,t),n.localizeMapUpdates||Dp.set(h,e),e}const d=n.localizeMapUpdates?i:Dp;let p={find(e,n){let i,r=[];3===e.length&&(r=t.map(t=>d.get(t)));for(let s=0;t.length>s;s++)if(i=d.get(t[s]),e.call(n,i,s,r))return i},get name(){return o},get paramNames(){return l},get metadata(){return Up(r.route)},get parent(){let e=t[s-1];return void 0===e?null:d.get(e)},get child(){let e=t[s+1];return void 0===e?null:d.get(e)},get localName(){let t=this.name.split(".");return t[t.length-1]},get params(){return a},get queryParams(){return e}};return n.includeAttributes&&(p=Np(p,c)),i.set(r,p),n.localizeMapUpdates||Dp.set(r,p),p})}function Np(t,e){let n={get attributes(){return e}};return!Object.isExtensible(t)||t.hasOwnProperty("attributes")?Object.freeze(Object.assign({},t,n)):Object.assign(t,n)}function Up(t){return null!=t&&void 0!==t.buildRouteInfoMetadata?t.buildRouteInfoMetadata():null}class Bp{constructor(t,e,n,i){this._routePromise=void 0,this._route=null,this.params={},this.isResolved=!1,this.name=e,this.paramNames=n,this.router=t,i&&this._processRoute(i)}getModel(t){return Tc.resolve(this.context)}serialize(t){return this.params||{}}resolve(t){return Tc.resolve(this.routePromise).then(e=>(Gd(t),e)).then(()=>this.runBeforeModelHook(t)).then(()=>Gd(t)).then(()=>this.getModel(t)).then(e=>(Gd(t),e)).then(e=>this.runAfterModelHook(t,e)).then(e=>this.becomeResolved(t,e))}becomeResolved(t,e){let n,i=this.serialize(e);t&&(this.stashResolvedModel(t,e),t[rp]=t[rp]||{},t[rp][this.name]=i);let r=e===this.context;!("context"in this)&&r||(n=e);let s=Dp.get(this),o=new qp(this.router,this.name,this.paramNames,i,this.route,n);return void 0!==s&&Dp.set(o,s),o}shouldSupersede(t){if(!t)return!0;let e=t.context===this.context;return t.name!==this.name||"context"in this&&!e||this.hasOwnProperty("params")&&!function(t,e){if(t===e)return!0;if(!t||!e)return!1;for(let n in t)if(t.hasOwnProperty(n)&&t[n]!==e[n])return!1;return!0}(this.params,t.params)}get route(){return null!==this._route?this._route:this.fetchRoute()}set route(t){this._route=t}get routePromise(){return this._routePromise||this.fetchRoute(),this._routePromise}set routePromise(t){this._routePromise=t}log(t,e){t.log&&t.log(this.name+": "+e)}updateRoute(t){return t._internalName=this.name,this.route=t}runBeforeModelHook(t){let e;return t.trigger&&t.trigger(!0,"willResolveModel",t,this.route),this.route&&void 0!==this.route.beforeModel&&(e=this.route.beforeModel(t)),cp(e)&&(e=null),Tc.resolve(e)}runAfterModelHook(t,e){let n,i=this.name;var r;return this.stashResolvedModel(t,e),void 0!==this.route&&void 0!==this.route.afterModel&&(n=this.route.afterModel(e,t)),n=cp(r=n)?null:r,Tc.resolve(n).then(()=>t.resolvedModels[i])}stashResolvedModel(t,e){t.resolvedModels=t.resolvedModels||{},t.resolvedModels[this.name]=e}fetchRoute(){let t=this.router.getRoute(this.name);return this._processRoute(t)}_processRoute(t){return this.routePromise=Tc.resolve(t),null!==(e=t)&&"object"==typeof e&&"function"==typeof e.then?(this.routePromise=this.routePromise.then(t=>this.updateRoute(t)),this.route=void 0):t?this.updateRoute(t):void 0;var e}}class qp extends Bp{constructor(t,e,n,i,r,s){super(t,e,n,r),this.params=i,this.isResolved=!0,this.context=s}resolve(t){return t&&t.resolvedModels&&(t.resolvedModels[this.name]=this.context),Tc.resolve(this)}}class Vp extends Bp{constructor(t,e,n,i,r){super(t,e,n,r),this.params={},i&&(this.params=i)}getModel(t){let e=this.params;t&&t[sp]&&(e={},Kd(e,this.params),e.queryParams=t[sp]);let n,i=this.route;return i.deserialize?n=i.deserialize(e,t):i.model&&(n=i.model(e,t)),n&&cp(n)&&(n=void 0),Tc.resolve(n)}}class $p extends Bp{constructor(t,e,n,i){super(t,e,n),this.context=i,this.serializer=this.router.getSerializer(e)}getModel(t){return void 0!==this.router.log&&this.router.log(this.name+": resolving provided model"),super.getModel(t)}serialize(t){let{paramNames:e,context:n}=this;t||(t=n);let i={};if(Jd(t))return i[e[0]]=t,i;if(this.serializer)return this.serializer.call(null,t,e);if(void 0!==this.route&&this.route.serialize)return this.route.serialize(t,e);if(1!==e.length)return;let r=e[0];return/_id$/.test(r)?i[r]=t.id:i[r]=t,i}}class Gp{constructor(t,e={}){this.router=t,this.data=e}}function Wp(t,e,n){let i=t.routeInfos,r=e.resolveIndex>=i.length?i.length-1:e.resolveIndex,s=e.isAborted;throw new Yp(n,t.routeInfos[r].route,s,t)}function Hp(t,e){if(e.resolveIndex===t.routeInfos.length)return;let n=t.routeInfos[e.resolveIndex],i=Kp.bind(null,t,e);return n.resolve(e).then(i,null,t.promiseLabel("Proceed"))}function Kp(t,e,n){let i=t.routeInfos[e.resolveIndex].isResolved;if(t.routeInfos[e.resolveIndex++]=n,!i){let{route:t}=n;void 0!==t&&t.redirect&&t.redirect(n.context,e)}return Gd(e),Hp(t,e)}class Xp{constructor(){this.routeInfos=[],this.queryParams={},this.params={}}promiseLabel(t){let e="";return Qd(this.routeInfos,function(t){return""!==e&&(e+="."),e+=t.name,!0}),np("'"+e+"': "+t)}resolve(t){let e=this.params;Qd(this.routeInfos,t=>(e[t.name]=t.params||{},!0)),t.resolveIndex=0;let n=Hp.bind(null,this,t),i=Wp.bind(null,this,t);return Tc.resolve(null,this.promiseLabel("Start transition")).then(n,null,this.promiseLabel("Resolve route")).catch(i,this.promiseLabel("Handle error")).then(()=>this)}}class Yp{constructor(t,e,n,i){this.error=t,this.route=e,this.wasAborted=n,this.state=i}}class Zp extends Gp{constructor(t,e,n,i=[],r={},s){super(t,s),this.preTransitionState=void 0,this.name=e,this.pivotHandler=n,this.contexts=i,this.queryParams=r}applyToState(t,e){let n=this.router.recognizer.handlersFor(this.name),i=n[n.length-1].handler;return this.applyToHandlers(t,n,i,e,!1)}applyToHandlers(t,e,n,i,r){let s,o,a=new Xp,l=this.contexts.slice(0),c=e.length;if(this.pivotHandler)for(s=0,o=e.length;s=0;--s){let o=e[s],u=o.handler,h=t.routeInfos[s],d=null;if(d=o.names.length>0?s>=c?this.createParamHandlerInfo(u,o.names,l,h):this.getHandlerInfoForDynamicSegment(u,o.names,l,h,n,s):this.createParamHandlerInfo(u,o.names,l,h),r){d=d.becomeResolved(null,d.context);let t=h&&h.context;o.names.length>0&&void 0!==h.context&&d.context===t&&(d.params=h&&h.params),d.context=t}let p=h;(s>=c||d.shouldSupersede(h))&&(c=Math.min(s,c),p=d),i&&!r&&(p=p.becomeResolved(null,p.context)),a.routeInfos.unshift(p)}if(l.length>0)throw new Error("More context objects were passed than there are dynamic segments for the route: "+n);return i||this.invalidateChildren(a.routeInfos,c),Kd(a.queryParams,this.queryParams||{}),i&&t.queryParams&&Kd(a.queryParams,t.queryParams),a}invalidateChildren(t,e){for(let n=e,i=t.length;n0){if(o=n[n.length-1],Jd(o))return this.createParamHandlerInfo(t,e,n,i);n.pop()}else{if(i&&i.name===t)return i;if(!this.preTransitionState)return i;{let t=this.preTransitionState.routeInfos[s];o=null==t?void 0:t.context}}return new $p(this.router,t,e,o)}createParamHandlerInfo(t,e,n,i){let r={},s=e.length,o=[];for(;s--;){let a=i&&t===i.name&&i.params||{},l=n[n.length-1],c=e[s];Jd(l)?r[c]=""+n.pop():a.hasOwnProperty(c)?r[c]=a[c]:o.push(c)}if(o.length>0)throw new Error(`You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route ${t}. Missing params: ${o}`);return new Vp(this.router,t,e,r)}}class Jp extends Gp{constructor(t,e,n){super(t,n),this.url=e,this.preTransitionState=void 0}applyToState(t){let e,n,i=new Xp,r=this.router.recognizer.recognize(this.url);if(!r)throw new up(this.url);let s=!1,o=this.url;function a(t){if(t&&t.inaccessibleByURL)throw new up(o);return t}for(e=0,n=r.length;e=0&&i;--n){let r=e[n],s=r.handler;t.add(e,{as:s}),i="/"===r.path||""===r.path||".index"===s.slice(-6)}})}hasRoute(t){return this.recognizer.hasRoute(t)}queryParamsTransition(t,e,n,i){if(this.fireQueryParamDidChange(i,t),!e&&this.activeTransition)return this.activeTransition;{let t=new ap(this,void 0,void 0);return t.queryParamsOnly=!0,n.queryParams=this.finalizeQueryParamChange(i.routeInfos,i.queryParams,t),t[sp]=i.queryParams,this.toReadOnlyInfos(t,i),this.routeWillChange(t),t.promise=t.promise.then(e=>(t.isAborted||(this._updateURL(t,n),this.didTransition(this.currentRouteInfos),this.toInfos(t,i.routeInfos,!0),this.routeDidChange(t)),e),null,np("Transition complete")),t}}transitionByIntent(t,e){try{return this.getTransitionByIntent(t,e)}catch(n){return new ap(this,t,void 0,n,void 0)}}recognize(t){let e=new Jp(this,t),n=this.generateNewState(e);if(null===n)return n;let i=jp(n.routeInfos,n.queryParams,{includeAttributes:!1,localizeMapUpdates:!0});return i[i.length-1]}recognizeAndLoad(t){let e=new Jp(this,t),n=this.generateNewState(e);if(null===n)return Tc.reject(`URL ${t} was not recognized`);let i=new ap(this,e,n,void 0);return i.then(()=>{let t=jp(n.routeInfos,i[sp],{includeAttributes:!0,localizeMapUpdates:!1});return t[t.length-1]})}generateNewState(t){try{return t.applyToState(this.state,!1)}catch(e){return null}}getTransitionByIntent(t,e){let n,i=!!this.activeTransition,r=i?this.activeTransition[ip]:this.state,s=t.applyToState(r,e),o=tp(r.queryParams,s.queryParams);if(tf(s.routeInfos,r.routeInfos)){if(o){let t=this.queryParamsTransition(o,i,r,s);return t.queryParamsOnly=!0,t}return this.activeTransition||new ap(this,void 0,void 0)}if(e){let t=new ap(this,void 0,s);return t.isIntermediate=!0,this.toReadOnlyInfos(t,s),this.setupContexts(s,t),this.routeWillChange(t),this.activeTransition}return n=new ap(this,t,s,void 0,this.activeTransition),function(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;nthis.finalizeTransition(n,t),null,np("Settle transition promise when transition is finalized")),i||this.notifyExistingHandlers(s,n),this.fireQueryParamDidChange(s,o),n}doTransition(t,e=[],n=!1){let i,r=e[e.length-1],s={};if(r&&Object.prototype.hasOwnProperty.call(r,"queryParams")&&(s=e.pop().queryParams),void 0===t){Zd(this,"Updating query params");let{routeInfos:t}=this.state;i=new Zp(this,t[t.length-1].name,void 0,[],s)}else"/"===t.charAt(0)?(Zd(this,"Attempting URL transition to "+t),i=new Jp(this,t)):(Zd(this,"Attempting transition to "+t),i=new Zp(this,t,void 0,e,s));return this.transitionByIntent(i,n)}finalizeTransition(t,e){try{Zd(t.router,t.sequence,"Resolved all models on destination route; finalizing transition.");let n=e.routeInfos;return this.setupContexts(e,t),t.isAborted?(this.state.routeInfos=this.currentRouteInfos,Tc.reject(lp(t))):(this._updateURL(t,e),t.isActive=!1,this.activeTransition=void 0,this.triggerEvent(this.currentRouteInfos,!0,"didTransition",[]),this.didTransition(this.currentRouteInfos),this.toInfos(t,e.routeInfos,!0),this.routeDidChange(t),Zd(this,t.sequence,"TRANSITION COMPLETE."),n[n.length-1].route)}catch(i){if("object"!=typeof(n=i)||null===n||"TRANSITION_ABORTED"!==n.code){let e=t[ip].routeInfos;t.trigger(!0,"error",i,t,e[e.length-1].route),t.abort()}throw i}var n}setupContexts(t,e){let n,i,r,s=this.partitionRoutes(this.state,t);for(n=0,i=s.exited.length;n=0;--o){let t=i[o];Kd(s,t.params),t.route.inaccessibleByURL&&(n=null)}if(n){s.queryParams=t._visibleQueryParams||e.queryParams;let i=this.recognizer.generate(r,s),o=t.isCausedByInitialTransition,a="replace"===n&&!t.isCausedByAbortingTransition,l=t.queryParamsOnly&&"replace"===n,c="replace"===n&&t.isCausedByAbortingReplaceTransition;o||a||l||c?this.replaceURL(i):this.updateURL(i)}}finalizeQueryParamChange(t,e,n){for(let s in e)e.hasOwnProperty(s)&&null===e[s]&&delete e[s];let i=[];this.triggerEvent(t,!0,"finalizeQueryParamChange",[e,i,n]),n&&(n._visibleQueryParams={});let r={};for(let s=0,o=i.length;s0){let n=jp(e,Object.assign({},this._lastQueryParams),{includeAttributes:!0,localizeMapUpdates:!1});t.from=n[n.length-1]||null}}toInfos(t,e,n=!1){if(void 0!==t&&e.length>0){let i=jp(e,Object.assign({},t[sp]),{includeAttributes:n,localizeMapUpdates:!1});t.to=i[i.length-1]||null}}notifyExistingHandlers(t,e){let n,i,r,s,o=this.state.routeInfos;for(i=o.length,n=0;n{t.setURL(n),Ls(e,"currentURL",n)})}didTransition(t){e.didTransition(t)}willTransition(t,n){e.willTransition(t,n)}triggerEvent(t,n,i,r){return hf.bind(e)(t,n,i,r)}routeWillChange(t){e.trigger("routeWillChange",t),e._routerService.trigger("routeWillChange",t),t.isIntermediate&&e.set("currentRoute",t.to)}routeDidChange(t){e.set("currentRoute",t.to),ba(()=>{e.trigger("routeDidChange",t),e._routerService.trigger("routeDidChange",t)})}transitionDidError(t,n){return t.wasAborted||n.isAborted?lp(n):(n.trigger(!1,"error",t.error,n,t.route),e._isErrorHandled(t.error)?(n.rollback(),this.routeDidChange(n),t.error):(n.abort(),t.error))}replaceURL(n){t.replaceURL?ba(()=>{t.replaceURL(n),Ls(e,"currentURL",n)}):this.updateURL(n)}},s=this.constructor.dslCallbacks||[nf],o=this._buildDSL();o.route("application",{path:"/",resetNamespace:!0,overrideNameAssertion:!0},function(){for(let t=0;tn.factoryFor(`route-map:${t}`),addRouteForEngine(t,n){e._engineInfoByRoute[t]||(e._engineInfoByRoute[t]=n)}};return new Ap(null,i)}_resetQueuedQueryParameterChanges(){this._queuedQPChanges={}}_hasModuleBasedResolver(){let t=Ss(sl(this),"application.__registry__.resolver.moduleBasedResolver");return Boolean(t)}startRouting(){if(this.setupRouter()){let t=Ss(this,"initialURL");void 0===t&&(t=Ss(this,"location").getURL());let e=this.handleURL(t);if(e&&e.error)throw e.error}}setupRouter(){if(this._didSetupRouter)return!1;this._didSetupRouter=!0,this._setupLocation();let t=Ss(this,"location");return!Ss(t,"cancelRouterSetup")&&(this._initRouterJs(),t.onUpdateURL(t=>{this.handleURL(t)}),!0)}_setOutlets(){if(this.isDestroying||this.isDestroyed)return;let t=this._routerMicrolib.currentRouteInfos;if(!t)return;let e=null,n=null;for(let i of t){let t=Cp(i.route);if(!t)break;{let i={render:t,outlets:{main:void 0}};n?n.outlets.main=i:e=i,n=i}}if(null!==e)if(this._toplevelView)this._toplevelView.setOutletState(e);else{let t=sl(this),n=t.factoryFor("view:-outlet"),i=t.lookup("application:main"),r=t.lookup("-environment:main"),s=t.lookup("template:-outlet");this._toplevelView=n.create({environment:r,template:s,application:i}),this._toplevelView.setOutletState(e);let o=t.lookup("-application-instance:main");o&&o.didCreateRootView(this._toplevelView)}}handleURL(t){let e=t.split(/#(.+)?/)[0];return this._doURLTransition("handleURL",e)}_doURLTransition(t,e){this._initialTransitionStarted=!0;let n=this._routerMicrolib[t](e||"/");return ff(n,this),n}transitionTo(...t){if(vp(t[0]))return this._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:i}=fp(t);return this._doTransition(e,n,i)}intermediateTransitionTo(t,...e){this._routerMicrolib.intermediateTransitionTo(t,...e),pf(this)}replaceWith(...t){return this.transitionTo(...t).method("replace")}generate(t,...e){let n=this._routerMicrolib.generate(t,...e);return this.location.formatURL(n)}isActive(t){return this._routerMicrolib.isActive(t)}isActiveIntent(t,e,n){return this.currentState.isActiveIntent(t,e,n)}send(t,...e){this._routerMicrolib.trigger(t,...e)}hasRoute(t){return this._routerMicrolib.hasRoute(t)}reset(){this._didSetupRouter=!1,this._initialTransitionStarted=!1,this._routerMicrolib&&this._routerMicrolib.reset()}willDestroy(){this._toplevelView&&(this._toplevelView.destroy(),this._toplevelView=null),super.willDestroy(),this.reset();let t=this._engineInstances;for(let e in t){let n=t[e];for(let t in n)ma(n[t],"destroy")}}_activeQPChanged(t,e){this._queuedQPChanges[t]=e,ba(this,this._fireQueryParamTransition)}_updatingQPChanged(t){this._qpUpdates.add(t)}_fireQueryParamTransition(){this.transitionTo({queryParams:this._queuedQPChanges}),this._resetQueuedQueryParameterChanges()}_setupLocation(){let t=this.location,e=this.rootURL,n=sl(this);"string"==typeof t&&(t=Ls(this,"location",n.lookup(`location:${t}`))),null!==t&&"object"==typeof t&&(e&&Ls(t,"rootURL",e),"function"==typeof t.initState&&t.initState())}_serializeQueryParams(t,e){gf(this,t,e,(t,n,i)=>{if(i)delete e[t],e[i.urlKey]=i.route.serializeQueryParam(n,i.urlKey,i.type);else{if(void 0===n)return;e[t]=this._serializeQueryParam(n,Fh(n))}})}_serializeQueryParam(t,e){return null==t?t:"array"===e?JSON.stringify(t):`${t}`}_deserializeQueryParams(t,e){gf(this,t,e,(t,n,i)=>{i&&(delete e[t],e[i.prop]=i.route.deserializeQueryParam(n,i.urlKey,i.type))})}_deserializeQueryParam(t,e){return null==t?t:"boolean"===e?"true"===t:"number"===e?Number(t).valueOf():"array"===e?id(JSON.parse(t)):t}_pruneDefaultQueryParamValues(t,e){let n=this._queryParamsFor(t);for(let i in e){let t=n.map[i];t&&t.serializedDefaultValue===e[i]&&delete e[i]}}_doTransition(t,e,n,i){let r=t||function(t){let e=t.activeTransition?t.activeTransition[ip].routeInfos:t.state.routeInfos;return e[e.length-1].name}(this._routerMicrolib);this._initialTransitionStarted=!0;let s={};this._processActiveTransitionQueryParams(r,e,s,n),Object.assign(s,n),this._prepareQueryParams(r,e,s,Boolean(i));let o=this._routerMicrolib.transitionTo(r,...e,{queryParams:s});return ff(o,this),o}_processActiveTransitionQueryParams(t,e,n,i){if(!this._routerMicrolib.activeTransition)return;let r={},s=this._qpUpdates,o=kp(this,this._routerMicrolib.activeTransition[ip]);for(let a in o)s.has(a)||(r[a]=o[a]);this._fullyScopeQueryParams(t,e,i),this._fullyScopeQueryParams(t,e,r),Object.assign(n,r)}_prepareQueryParams(t,e,n,i){let r=df(this,t,e);this._hydrateUnsuppliedQueryParams(r,n,Boolean(i)),this._serializeQueryParams(r.routeInfos,n),i||this._pruneDefaultQueryParamValues(r.routeInfos,n)}_getQPMeta(t){let e=t.route;return e&&Ss(e,"_qp")}_queryParamsFor(t){let e=t[t.length-1].name,n=this._qpCache[e];if(void 0!==n)return n;let i,r=!0,s={},o=[];for(let l of t)if(i=this._getQPMeta(l),i){for(let t of i.qps)o.push(t);Object.assign(s,i.map)}else r=!1;let a={qps:o,map:s};return r&&(this._qpCache[e]=a),a}_fullyScopeQueryParams(t,e,n){let i,r=df(this,t,e).routeInfos;for(let s of r)if(i=this._getQPMeta(s),i)for(let t of i.qps){let e=t.prop in n&&t.prop||t.scopedPropertyName in n&&t.scopedPropertyName||t.urlKey in n&&t.urlKey;e&&e!==t.scopedPropertyName&&(n[t.scopedPropertyName]=n[e],delete n[e])}}_hydrateUnsuppliedQueryParams(t,e,n){let i,r,s,o=t.routeInfos,a=this._bucketCache;for(let l of o)if(i=this._getQPMeta(l),i)for(let n=0,o=i.qps.length;n=0;--n){let i=t[n],r=i.route;if(void 0!==r&&!0!==e(r,i))return}}let af={willResolveModel(t,e,n){this._scheduleLoadingEvent(e,n)},error(t,e,n){let i=this,r=t[t.length-1];of(t,(t,n)=>{if(n!==r){let n=cf(t,"error");if(n)return i._markErrorAsHandled(e),i.intermediateTransitionTo(n,e),!1}let s=lf(t,"error");return!s||(i._markErrorAsHandled(e),i.intermediateTransitionTo(s,e),!1)}),function(t,e){let n,i=[];n=t&&"object"==typeof t&&"object"==typeof t.errorThrown?t.errorThrown:t,e&&i.push(e),n&&(n.message&&i.push(n.message),n.stack&&i.push(n.stack),"string"==typeof n&&i.push(n)),console.error(...i)}(e,`Error while processing route: ${n.targetName}`)},loading(t,e){let n=this,i=t[t.length-1];of(t,(t,r)=>{if(r!==i){let e=cf(t,"loading");if(e)return n.intermediateTransitionTo(e),!1}let s=lf(t,"loading");return s?(n.intermediateTransitionTo(s),!1):e.pivotHandler!==t})}};function lf(t,e){let n=sl(t),{routeName:i,fullRouteName:r,_router:s}=t,o=`${r}_${e}`;return uf(n,s,`${i}_${e}`,o)?o:""}function cf(t,e){let n=sl(t),{routeName:i,fullRouteName:r,_router:s}=t,o="application"===r?e:`${r}.${e}`;return uf(n,s,"application"===i?e:`${i}.${e}`,o)?o:""}function uf(t,e,n,i){let r=e.hasRoute(i),s=t.factoryFor(`template:${n}`)||t.factoryFor(`route:${n}`);return r&&s}function hf(t,e,n,i){if(!t){if(e)return;throw new Error(`Can't trigger action '${n}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`)}let r,s,o,a=!1;for(let c=t.length-1;c>=0;c--)if(r=t[c],s=r.route,o=s&&s.actions&&s.actions[n],o){if(!0!==o.apply(s,i))return void("error"===n&&s._router._markErrorAsHandled(i[0]));a=!0}let l=af[n];if(l)l.call(this,t,...i);else if(!a&&!e)throw new Error(`Nothing handled the action '${n}'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.`)}function df(t,e,n){let i=t._routerMicrolib.applyIntent(e,n),{routeInfos:r,params:s}=i;for(let o of r)o.isResolved?s[o.name]=o.params:s[o.name]=o.serialize(o.context);return i}function pf(t){let e=t._routerMicrolib.currentRouteInfos;if(0===e.length)return;let n=sf._routePath(e),i=e[e.length-1].name,r=t.location.getURL();Ls(t,"currentPath",n),Ls(t,"currentRouteName",i),Ls(t,"currentURL",r)}function ff(t,e){let n=new zp(e,e._routerMicrolib,t[ip]);e.currentState||e.set("currentState",n),e.set("targetState",n),t.promise=t.catch(t=>{if(!e._isErrorHandled(t))throw t;e._clearHandledError(t)},"Transition Error")}function gf(t,e,n,i){let r=t._queryParamsFor(e);for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i(s,n[s],r.map[s])}function mf(t){return void 0!==t.hash?t.hash.substring(0):""}sf.reopen({didTransition:function(){pf(this),this._cancelSlowTransitionTimer(),this.notifyPropertyChange("url"),this.set("currentState",this.targetState)},willTransition:function(){},rootURL:"/",location:"hash",url:ps(function(){let t=Ss(this,"location");if("string"!=typeof t)return t.getURL()})});class yf extends Tu{_hashchangeHandler;_location;init(){this.location=this._location??window.location,this._hashchangeHandler=void 0}getHash(){return mf(this.location)}getURL(){let t=this.getHash().substring(1),e=t;return"/"!==e[0]&&(e="/",t&&(e+=`#${t}`)),e}setURL(t){this.location.hash=t,this.lastSetURL=t}replaceURL(t){this.location.replace(`#${t}`),this.lastSetURL=t}lastSetURL=null;onUpdateURL(t){this._removeEventListener(),this._hashchangeHandler=_a(this,function(){let e=this.getURL();this.lastSetURL!==e&&(this.lastSetURL=null,t(e))}),window.addEventListener("hashchange",this._hashchangeHandler)}formatURL(t){return`#${t}`}willDestroy(){this._removeEventListener()}_removeEventListener(){this._hashchangeHandler&&window.removeEventListener("hashchange",this._hashchangeHandler)}}let _f=!1;function vf(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e,n;return e=16*Math.random()|0,n="x"===t?e:3&e|8,n.toString(16)})}class bf extends Tu{history;_previousURL;_popstateHandler;rootURL="/";getHash(){return mf(this.location)}init(){this._super(...arguments);let t=document.querySelector("base"),e="";null!==t&&t.hasAttribute("href")&&(e=t.getAttribute("href")??""),this.baseURL=e,this.location=this.location??window.location,this._popstateHandler=void 0}initState(){let t=this.history??window.history;this.history=t;let{state:e}=t,n=this.formatURL(this.getURL());e&&e.path===n?this._previousURL=this.getURL():this.replaceState(n)}getURL(){let{location:t,rootURL:e,baseURL:n}=this,i=t.pathname;e=e.replace(/\/$/,""),n=n.replace(/\/$/,"");let r=i.replace(new RegExp(`^${n}(?=/|$)`),"").replace(new RegExp(`^${e}(?=/|$)`),"").replace(/\/\//g,"/");return r+=(t.search||"")+this.getHash(),r}setURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.pushState(t)}replaceURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.replaceState(t)}pushState(t){let e={path:t,uuid:vf()};this.history.pushState(e,"",t),this._previousURL=this.getURL()}replaceState(t){let e={path:t,uuid:vf()};this.history.replaceState(e,"",t),this._previousURL=this.getURL()}onUpdateURL(t){this._removeEventListener(),this._popstateHandler=()=>{(_f||(_f=!0,this.getURL()!==this._previousURL))&&t(this.getURL())},window.addEventListener("popstate",this._popstateHandler)}formatURL(t){let{rootURL:e,baseURL:n}=this;return""!==t?(e=e.replace(/\/$/,""),n=n.replace(/\/$/,"")):"/"===n[0]&&"/"===e[0]&&(n=n.replace(/\/$/,"")),n+e+t}willDestroy(){this._removeEventListener()}_removeEventListener(){this._popstateHandler&&window.removeEventListener("popstate",this._popstateHandler)}}class wf extends Tu{updateCallback;initState(){this._super(...arguments);let{rootURL:t}=this}getURL(){let{path:t,rootURL:e}=this;return e=e.replace(/\/$/,""),t.replace(new RegExp(`^${e}(?=/|$)`),"")}setURL(t){this.path=t}onUpdateURL(t){this.updateCallback=t}handleURL(t){this.path=t,this.updateCallback&&this.updateCallback(t)}formatURL(t){let{rootURL:e}=this;return""!==t&&(e=e.replace(/\/$/,"")),e+t}}function xf(t){return null==t}function Sf(t){if(null==t)return!0;if(!xs(t)&&"number"==typeof t.size)return!t.size;if("object"==typeof t){let e=Ss(t,"size");if("number"==typeof e)return!e;let n=Ss(t,"length");if("number"==typeof n)return!n}return"number"==typeof t.length&&"function"!=typeof t&&!t.length}function Cf(t){return js(t).readOnly()}wf.reopen({path:"",rootURL:"/"});const kf=/[ _]/g,Ef=new sr(1e3,t=>{return(e=t,Of.get(e)).replace(kf,"-");var e}),Tf=/^(-|_)+(.)?/,Rf=/(.)(-|_|\.|\s)+(.)?/g,Pf=/(^|\/|\.)([a-z])/g,Mf=new sr(1e3,t=>{let e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,i)=>e+(i?i.toUpperCase():""),i=t.split("/");for(let r=0;rt.toUpperCase())}),If=/([a-z\d])([A-Z])/g,Of=new sr(1e3,t=>t.replace(If,"$1_$2").toLowerCase());function Af(t){return Ef.get(t)}function Ff(t){return Object.hasOwnProperty.call(t.since,"enabled")||g._ALL_DEPRECATIONS_ENABLED}let Lf=parseFloat(g._OVERRIDE_DEPRECATION_VERSION??or);function zf(t){return function(t,e=Lf){let n=t.replace(/(\.0+)/g,"");return e>=parseFloat(n)}(t.until)}function Df(t){return{options:t,test:!Ff(t),isEnabled:Ff(t)||zf(t),isRemoved:zf(t)}}const jf={DEPRECATE_IMPORT_EMBER:t=>Df({id:`deprecate-import-${Af(t).toLowerCase()}-from-ember`,for:"ember-source",since:{available:"5.10.0",enabled:"6.5.0"},until:"7.0.0",url:`https://deprecations.emberjs.com/id/import-${Af(t).toLowerCase()}-from-ember`}),DEPRECATE_IMPORT_INJECT:Df({for:"ember-source",id:"importing-inject-from-ember-service",since:{available:"6.2.0",enabled:"6.3.0"},until:"7.0.0",url:"https://deprecations.emberjs.com/id/importing-inject-from-ember-service"}),DEPRECATE_AMD_BUNDLES:Df({for:"ember-source",id:"using-amd-bundles",since:{available:"6.10.0",enabled:"6.10.0"},until:"7.0.0",url:"https://deprecations.emberjs.com/id/using-amd-bundles"})};function Nf(t,e){const{options:n}=e;if(e.isRemoved)throw new Error(`The API deprecated by ${n.id} was removed in ember-source ${n.until}. The message was: ${t}. Please see ${n.url} for more details.`)}function Uf(...t){return Ms("service",...t)}class Bf extends nh{static isServiceFactory=!0}const qf=Object.freeze(Object.defineProperty({__proto__:null,default:Bf,inject:function(...t){return Nf("Importing `inject` from `@ember/service` is deprecated. Please import `service` instead.",jf.DEPRECATE_IMPORT_INJECT),Ms("service",...t)},service:Uf},Symbol.toStringTag,{value:"Module"})),Vf=Symbol("ROUTER");function $f(t,e){return"/"===e?t:t.substring(e.length)}class Gf extends(Bf.extend(th)){[Vf];get _router(){let t=this[Vf];if(void 0!==t)return t;let e=ur(this).lookup("router:main");return this[Vf]=e}willDestroy(){super.willDestroy(),this[Vf]=void 0}transitionTo(...t){if(vp(t[0]))return this._router._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:i}=fp(t);return this._router._doTransition(e,n,i,!0)}replaceWith(...t){return this.transitionTo(...t).method("replace")}urlFor(t,...e){return this._router.setupRouter(),this._router.generate(t,...e)}isActive(...t){let{routeName:e,models:n,queryParams:i}=fp(t);this._router.setupRouter();let r=this._router._routerMicrolib;if(De(on(this._router,"currentURL")),!r.isActiveIntent(e,n))return!1;if(Object.keys(i).length>0){let t=e;i=Object.assign({},i),this._router._prepareQueryParams(t,n,i,!0);let s=Object.assign({},r.state.queryParams);return this._router._prepareQueryParams(t,n,s,!0),bp(i,s)}return!0}recognize(t){this._router.setupRouter();let e=$f(t,this.rootURL);return this._router._routerMicrolib.recognize(e)}recognizeAndLoad(t){this._router.setupRouter();let e=$f(t,this.rootURL);return this._router._routerMicrolib.recognizeAndLoad(e)}refresh(t){if(!t)return this._router._routerMicrolib.refresh();let e=ur(this).lookup(`route:${t}`);return this._router._routerMicrolib.refresh(e)}static{Sh(this.prototype,"currentRouteName",[Cf("_router.currentRouteName")])}#c=void Eh(this,"currentRouteName");static{Sh(this.prototype,"currentURL",[Cf("_router.currentURL")])}#u=void Eh(this,"currentURL");static{Sh(this.prototype,"location",[Cf("_router.location")])}#h=void Eh(this,"location");static{Sh(this.prototype,"rootURL",[Cf("_router.rootURL")])}#d=void Eh(this,"rootURL");static{Sh(this.prototype,"currentRoute",[Cf("_router.currentRoute")])}#p=void Eh(this,"currentRoute")}class Wf extends Bf{[Vf];get router(){let t=this[Vf];if(void 0!==t)return t;let e=ur(this).lookup("router:main");return e.setupRouter(),this[Vf]=e}hasRoute(t){return this.router.hasRoute(t)}transitionTo(t,e,n,i){let r=this.router._doTransition(t,e,n);return i&&r.method("replace"),r}normalizeQueryParams(t,e,n){this.router._prepareQueryParams(t,e,n)}_generateURL(t,e,n){let i={};return n&&(Object.assign(i,n),this.normalizeQueryParams(t,e,i)),this.router.generate(t,...e,{queryParams:i})}generateURL(t,e,n){if(this.router._initialTransitionStarted)return this._generateURL(t,e,n);try{return this._generateURL(t,e,n)}catch(i){return}}isActiveForRoute(t,e,n,i){let r=this.router._routerMicrolib.recognizer.handlersFor(n),s=r[r.length-1].handler,o=function(t,e){let n=0;for(let i=0;io&&(n=s),i.isActiveIntent(n,t,e)}}Wf.reopen({targetState:Cf("router.targetState"),currentState:Cf("router.currentState"),currentRouteName:Cf("router.currentRouteName"),currentPath:Cf("router.currentPath")});class Hf{constructor(t){this.buffer=t,this.size=0}encode(t,e,...n){if(t>255)throw new Error(`Opcode type over 8-bits. Got ${t}.`);let i=t|e|arguments.length-2<<8;this.buffer.push(i);for(const r of n)this.buffer.push(r);this.size=this.buffer.length}patch(t,e){if(-1!==this.buffer[t+1])throw new Error("Trying to patch operand in populated slot instead of a reserved slot.");this.buffer[t+1]=e}}const Kf=32,Xf=31;function Yf(t){return(t|=0)<0?function(t){return-536870913&t}(t):function(t){return~t}(t)}function Zf(t){return e=>{if(!function(t){return Array.isArray(t)&&2===t.length}(e))return!1;let n=e[0];return n===Xf||n===Kf||n===t}}[1,-1].forEach(t=>{return e=Yf(t),(e|=0)>-536870913?function(t){return~t}(e):function(t){return 536870912|t}(e);var e});const Jf=Zf(39),Qf=Zf(38),tg=Zf(37),eg=Zf(35);function ng(t,e,n,i){let{symbols:{upvars:r}}=n,s=r[t[1]],o=e?.lookupBuiltInHelper?.(s)??null;return i.helper(o,s)}function ig(t){return{type:1,value:t}}function rg(t){return{type:5,value:t}}function sg(t){return{type:7,value:t}}function og(t){return{type:8,value:t}}class ag{label(t,e){this.labels[t]=e}target(t,e){this.targets.push({at:t,target:e})}patch(t){let{targets:e,labels:n}=this;for(const{at:i,target:r}of e){let e=n[r]-i;t.getbyaddr(i),t.setbyaddr(i,e)}}constructor(){this.labels=_n(),this.targets=[]}}function lg(t,e,n,i){let{program:{constants:r},resolver:s}=e;if(function(t){return t<1e3}(i[0])){let[e,...n]=i;t.push(r,e,...n)}else switch(i[0]){case 1e3:return t.label(i[1]);case 1001:return t.startLabels();case 1002:return t.stopLabels();case 1004:return function(t,e,n,[,i,r]){if(Jf(i),i[0]===Kf){let{scopeValues:t,owner:s,symbols:{lexical:o}}=n,a=t[i[1]];r(e.component(a,s,!1,o?.at(i[1])))}else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupComponent?.(a,o)??null;r(e.resolvedComponent(l,a))}}(s,r,n,i);case 1003:return function(t,e,n,[,i,r]){Qf(i);let s=i[0];if(s===Kf){let{scopeValues:t,symbols:{lexical:s}}=n,o=t[i[1]];r(e.modifier(o,s?.at(i[1])??void 0))}else if(s===Xf){let{symbols:{upvars:s}}=n,o=s[i[1]],a=t?.lookupBuiltInModifier?.(o)??null;r(e.modifier(a,o))}else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupModifier?.(a,o)??null;r(e.modifier(l))}}(s,r,n,i);case 1005:return function(t,e,n,[,i,r]){tg(i);let s=i[0];if(s===Kf){let{scopeValues:t}=n,s=t[i[1]];r(e.helper(s))}else if(s===Xf)r(ng(i,t,n,e));else{let{symbols:{upvars:s},owner:o}=n,a=s[i[1]],l=t?.lookupHelper?.(a,o)??null;r(e.helper(l,a))}}(s,r,n,i);case 1007:return function(t,e,n,[,i,{ifComponent:r,ifHelper:s}]){eg(i);let o=i[0];if(o===Kf){let{scopeValues:t,owner:o,symbols:{lexical:a}}=n,l=t[i[1]],c=e.component(l,o,!0,a?.at(i[1]));if(null!==c)return void r(c);s(e.helper(l,null,!0))}else if(o===Xf)s(ng(i,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[i[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)r(e.resolvedComponent(c,l));else{let n=t?.lookupHelper?.(l,a)??null;s(e.helper(n,l))}}}(s,r,n,i);case 1008:return function(t,e,n,[,i,{ifComponent:r,ifHelper:s,ifValue:o}]){eg(i);let a=i[0];if(a===Kf){let{scopeValues:t,owner:a,symbols:{lexical:l}}=n,c=t[i[1]];if("function"!=typeof c&&("object"!=typeof c||null===c))return void o(e.value(c));let u=e.component(c,a,!0,l?.at(i[1]));if(null!==u)return void r(u);let h=e.helper(c,null,!0);if(null!==h)return void s(h);o(e.value(c))}else if(a===Xf)s(ng(i,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[i[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)return void r(e.resolvedComponent(c,l));let u=t?.lookupHelper?.(l,a)??null;null!==u&&s(e.helper(u,l))}}(s,r,n,i);case 1010:{let[,t,e]=i;e(n.symbols.upvars[t],n.moduleName);break}case 1011:{let[,t,e]=i,s=n.scopeValues[t];e(r.value(s));break}default:throw new Error(`Unexpected high level opcode ${i[0]}`)}}class cg{constructor(t,e,n){this.heap=t,this.meta=e,this.stdlib=n,this.labelsStack=new wn,this.encoder=new Hf([]),this.errors=[],this.handle=t.malloc()}error(t){this.encoder.encode(30,0),this.errors.push(t)}commit(t){let e=this.handle;return this.heap.pushMachine(5),this.heap.finishMalloc(e,t),(n=this.errors)&&n.length>0?{errors:this.errors,handle:e}:e;var n}push(t,e,...n){let{heap:i}=this;var r;let s=e|((r=e)>=0&&r<=15?si:0)|n.length<<8;i.pushRaw(s);for(let o=0;o=-536870912?Yf(n):function(t){return{type:6,value:t}}(n)),t(30,n)}function yg(t,e,n,i){t(0),kg(t,n,i,!1),t(16,e),t(1),t(36,8)}function _g(t,e,n,i){t(0),kg(t,e,n,!1),t(33,2,1),t(107),i?(t(36,8),i(),t(1),t(34,1)):(t(1),t(34,1),t(36,8))}function vg(t,e,n,i,r){t(0),kg(t,i,r,!1),t(86),fg(t,n),t(77,e,{type:2,value:void 0}),t(1),t(36,8)}function bg(t,e,n){kg(t,n,null,!0),t(23,e),t(24),t(61),t(64),t(40),t(1)}function wg(t,e){!function(t,e){null!==e?t(63,sg({parameters:e})):mg(t,null)}(t,e&&e[1]),t(62),Cg(t,e)}function xg(t,e){t(0),Cg(t,e),t(61),t(2),t(1)}function Sg(t,e,n){let i=e[1],r=i.length,s=Math.min(n,r);if(0!==s){if(t(0),s){t(39);for(let e=0;e{for(let n of e)fg(t,n);t(27,e.length)}),dg.add(28,(t,[,e,n,i])=>{tg(e)?t(1005,e,e=>{yg(t,e,n,i)}):(fg(t,e),_g(t,n,i))}),dg.add(50,(t,[,e,n,i,r])=>{vg(t,n,e,i,r)}),dg.add(30,(t,[,e,n])=>{t(21,e),pg(t,n)}),dg.add(Kf,(t,[,e,n])=>{t(1011,e,e=>{t(29,e),pg(t,n)})}),dg.add(Xf,(t,e)=>{t(1010,e[1],()=>{t(1005,e,e=>{yg(t,e,null,null)})})}),dg.add(37,(t,e)=>{t(1010,e[1],()=>{t(1005,e,e=>{yg(t,e,null,null)})})}),dg.add(27,t=>gg(t,void 0)),dg.add(48,(t,[,e])=>{fg(t,e),t(25)}),dg.add(49,(t,[,e])=>{fg(t,e),t(24),t(61),t(26)}),dg.add(52,(t,[,e,n,i])=>{fg(t,i),fg(t,n),fg(t,e),t(109)}),dg.add(51,(t,[,e])=>{fg(t,e),t(110)}),dg.add(53,(t,[,e])=>{fg(t,e),t(111)}),dg.add(54,(t,[,e])=>{t(0),kg(t,e,null,!1),t(112),t(1),t(36,8)});class Rg{constructor(t){this.blocks=t,this.names=t?Object.keys(t):[]}get(t){return this.blocks&&this.blocks[t]||null}has(t){let{blocks:e}=this;return null!==e&&t in e}with(t,e){let{blocks:n}=this;return new Rg(n?Sn({},n,{[t]:e}):{[t]:e})}get hasAny(){return null!==this.blocks}}const Pg=new Rg(null);function Mg(t){if(null===t)return Pg;let e=_n(),[n,i]=t;for(const[r,s]of gn(n))e[s]=i[r];return new Rg(e)}function Ig(t,e,n){let i=[],r=0;n(function(t,e){i.push({match:t,callback:e,label:"CLAUSE"+r++})}),t(69,1),e(),t(1001);for(let s of i.slice(0,-1))t(67,ig(s.label),s.match);for(let s=i.length-1;s>=0;s--){let e=i[s];t(1e3,e.label),t(34,1),e.callback(),0!==s&&t(4,ig("END"))}t(1e3,"END"),t(1002),t(70)}function Og(t,e,n){t(1001),t(0),t(6,ig("ENDINITIAL")),t(69,e()),n(),t(1e3,"FINALLY"),t(70),t(5),t(1e3,"ENDINITIAL"),t(1),t(1002)}function Ag(t,e,n,i){return Og(t,e,()=>{t(66,ig("ELSE")),n(),t(4,ig("FINALLY")),t(1e3,"ELSE"),void 0!==i&&i()})}function Fg(t,e,n,i,r,s){let{compilable:o,capabilities:a,handle:l}=e,c=n?[n,[]]:null,u=Mg(s);o?(t(78,l),function(t,{capabilities:e,layout:n,elementBlock:i,positional:r,named:s,blocks:o}){let{symbolTable:a}=n;if(yi(e,ri.prepareArgs))return void zg(t,{capabilities:e,elementBlock:i,positional:r,named:s,atNames:!0,blocks:o,layout:n});t(36,4),t(33,3,1),t(35,4),t(0);let{symbols:l}=a,c=[],u=[],h=[],d=o.names;if(null!==i){let e=l.indexOf("&attrs");-1!==e&&(wg(t,i),c.push(e))}for(const p of d){let e=l.indexOf(`&${p}`);-1!==e&&(wg(t,o.get(p)),c.push(e))}if(yi(e,ri.createArgs)){let e=Eg(t,r)<<4;e|=8;let n=dn;if(null!==s){n=s[0];let e=s[1];for(let i=0;i0?1:0),t(19,0);for(const p of fn(u))-1===p?t(34,1):t(19,p+1);null!==r&&t(34,r.length);for(const p of fn(c))t(20,p+1);t(28,og(n)),t(61),t(2),t(100,4),t(1),t(40),yi(e,ri.dynamicScope)&&t(60),t(98),t(35,4)}(t,{capabilities:a,layout:o,elementBlock:c,positional:i,named:r,blocks:u})):(t(78,l),zg(t,{capabilities:a,elementBlock:c,positional:i,named:r,atNames:!0,blocks:u}))}function Lg(t,e,n,i,r,s,o,a){let l=n?[n,[]]:null,c=Mg(s);Og(t,()=>(fg(t,e),t(33,3,0),2),()=>{t(66,ig("ELSE")),a?t(81):t(80,{type:2,value:void 0}),t(79),zg(t,{capabilities:!0,elementBlock:l,positional:i,named:r,atNames:o,blocks:c}),t(1e3,"ELSE")})}function zg(t,{capabilities:e,elementBlock:n,positional:i,named:r,atNames:s,blocks:o,layout:a}){let l=!!o,c=!0===e||yi(e,ri.prepareArgs)||!(!r||0===r[0].length),u=o.with("attrs",n);t(36,4),t(33,3,1),t(35,4),t(0),function(t,e,n,i,r){let s=i.names;for(const l of s)wg(t,i.get(l));let o=Eg(t,e)<<4;r&&(o|=8),i.hasAny&&(o|=7);let a=un;if(n){a=n[0];let e=n[1];for(let n=0;n{a?(t(63,sg(a.symbolTable)),t(28,og(a)),t(61)):t(92,4),t(95,4)}),t(35,4)}function Dg(t,e,n,i,r=null){t(97,4),t(59),t(87,0|e),r&&r(),t(88,4),t(90,4),t(38,4),t(19,0),i&&t(17,4),n&&t(18,4),t(34,1),t(96,4),t(100,4),t(1),t(40),t(60),t(98)}const jg=new hg,Ng=["class","id","value","name","type","style","href"],Ug=["div","span","p","a"];function Bg(t){return"string"==typeof t?t:Ug[t]}function qg(t){return"string"==typeof t?t:Ng[t]}function Vg(t){return null===t?null:[t[0].map(t=>`@${t}`),t[1]]}jg.add(3,(t,e)=>t(42,e[1])),jg.add(13,t=>t(55)),jg.add(12,t=>t(54)),jg.add(4,(t,[,e,n,i])=>{Qf(e)?t(1003,e,e=>{t(0),kg(t,n,i,!1),t(57,e),t(1)}):(fg(t,e),t(0),kg(t,n,i,!1),t(33,2,1),t(108),t(1))}),jg.add(14,(t,[,e,n,i])=>{t(51,qg(e),n,i??null)}),jg.add(24,(t,[,e,n,i])=>{t(105,qg(e),n,i??null)}),jg.add(15,(t,[,e,n,i])=>{fg(t,n),t(52,qg(e),!1,i??null)}),jg.add(22,(t,[,e,n,i])=>{fg(t,n),t(52,qg(e),!0,i??null)}),jg.add(16,(t,[,e,n,i])=>{fg(t,n),t(53,qg(e),!1,i??null)}),jg.add(23,(t,[,e,n,i])=>{fg(t,n),t(53,qg(e),!0,i??null)}),jg.add(10,(t,[,e])=>{t(48,Bg(e))}),jg.add(11,(t,[,e])=>{t(89),t(48,Bg(e))}),jg.add(8,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,n,null,i,r)}):Lg(t,e,n,null,i,r,!0,!0)}),jg.add(18,(t,[,e,n])=>bg(t,e,n)),jg.add(17,(t,[,e])=>bg(t,e,null)),jg.add(26,(t,[,e,n,i])=>{t(103,function(t,e,n){return{type:3,value:{locals:t,upvars:e,lexical:n}}}(e,n,i))}),jg.add(1,(t,[,e])=>{if(Array.isArray(e))if(eg(e))t(1008,e,{ifComponent(e){Fg(t,e,null,null,null,null)},ifHelper(e){t(0),yg(t,e,null,null),t(3,rg("cautious-non-dynamic-append")),t(1)},ifValue(e){t(0),t(29,e),t(3,rg("cautious-non-dynamic-append")),t(1)}});else if(28===e[0]){let[,n,i,r]=e;eg(n)?t(1007,n,{ifComponent(e){Fg(t,e,null,i,Vg(r),null)},ifHelper(e){t(0),yg(t,e,i,r),t(3,rg("cautious-non-dynamic-append")),t(1)}}):Ig(t,()=>{fg(t,n),t(106)},e=>{e(0,()=>{t(81),t(79),zg(t,{capabilities:!0,elementBlock:null,positional:i,named:r,atNames:!1,blocks:Mg(null)})}),e(1,()=>{_g(t,i,r,()=>{t(3,rg("cautious-non-dynamic-append"))})})})}else t(0),fg(t,e),t(3,rg("cautious-append")),t(1);else t(41,null==e?"":String(e))}),jg.add(2,(t,[,e])=>{Array.isArray(e)?(t(0),fg(t,e),t(3,rg("trusting-append")),t(1)):t(41,null==e?"":String(e))}),jg.add(6,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,null,n,Vg(i),r)}):Lg(t,e,null,n,i,r,!1,!1)}),jg.add(40,(t,[,e,n,i,r])=>{Ag(t,()=>(fg(t,n),void 0===r?gg(t,void 0):fg(t,r),fg(t,i),t(33,3,0),4),()=>{t(50),xg(t,e),t(56)})}),jg.add(41,(t,[,e,n,i])=>Ag(t,()=>(fg(t,e),t(71),1),()=>{xg(t,n)},i?()=>{xg(t,i)}:void 0)),jg.add(42,(t,[,e,n,i,r])=>Og(t,()=>(n?fg(t,n):gg(t,null),fg(t,e),2),()=>{t(72,ig("BODY"),ig("ELSE")),t(0),t(33,2,1),t(6,ig("ITER")),t(1e3,"ITER"),t(74,ig("BREAK")),t(1e3,"BODY"),Sg(t,i,2),t(34,2),t(4,ig("FINALLY")),t(1e3,"BREAK"),t(1),t(73),t(4,ig("FINALLY")),t(1e3,"ELSE"),r&&xg(t,r)})),jg.add(44,(t,[,e,n])=>{Sg(t,n,Eg(t,e))}),jg.add(45,(t,[,e,n])=>{if(e){let[i,r]=e;Eg(t,r),function(t,e,n){t(59),t(58,e),n(),t(60)}(t,i,()=>{xg(t,n)})}else xg(t,n)}),jg.add(46,(t,[,e,n,i,r])=>{Jf(e)?t(1004,e,e=>{Fg(t,e,null,n,Vg(i),r)}):Lg(t,e,null,n,i,r,!1,!1)});class $g{constructor(t,e,n,i="plain block"){this.statements=t,this.meta=e,this.symbolTable=n,this.moduleName=i,this.compiled=null}compile(t){return function(t,e){if(null!==t.compiled)return t.compiled;t.compiled=-1;let{statements:n,meta:i}=t,r=function(t,e,n){let i=jg,r=ug(n,e),{encoder:s,evaluation:o}=r;function a(...t){lg(s,o,e,t)}for(const l of t)i.compile(a,l);return r.encoder.commit(e.size)}(n,i,e);return t.compiled=r,r}(this,t)}}class Gg{constructor(t,e,n,i,r){this.main=t,this.trustingGuardedAppend=e,this.cautiousGuardedAppend=n,this.trustingNonDynamicAppend=i,this.cautiousNonDynamicAppend=r}get"trusting-append"(){return this.trustingGuardedAppend}get"cautious-append"(){return this.cautiousGuardedAppend}get"trusting-non-dynamic-append"(){return this.trustingNonDynamicAppend}get"cautious-non-dynamic-append"(){return this.cautiousNonDynamicAppend}getAppend(t){return t?this.trustingGuardedAppend:this.cautiousGuardedAppend}}function Wg(t,e,n){Ig(t,()=>t(76),i=>{i(2,()=>{e?(t(68),t(43)):t(47)}),"number"==typeof n?(i(0,()=>{t(81),t(79),function(t){t(36,4),t(33,3,1),t(35,4),t(0),t(83),t(85,4),Dg(t,!1,!1,!0,()=>{t(92,4),t(95,4)}),t(35,4)}(t)}),i(1,()=>{_g(t,null,null,()=>{t(3,n)})})):(i(0,()=>{t(47)}),i(1,()=>{t(47)})),i(4,()=>{t(68),t(44)}),i(5,()=>{t(68),t(45)}),i(6,()=>{t(68),t(46)})})}const Hg={symbols:{locals:null,upvars:null},moduleName:"stdlib",scopeValues:null,isStrictMode:!0,owner:null,size:0};function Kg(t,e){let n=new cg(t.program.heap,Hg);e(function(...e){lg(n,t,Hg,e)});let i=n.commit(0);if("number"!=typeof i)throw new Error("Unexpected errors compiling std");return i}class Xg{constructor({constants:t,heap:e},n,i){this.constants=t,this.heap=e,this.resolver=i.resolver,this.createOp=n,this.env=i.env,this.program=i.program,this.stdlib=function(t){let e=Kg(t,t=>function(t){t(75,4),Dg(t,!1,!1,!0)}(t)),n=Kg(t,t=>Wg(t,!0,null)),i=Kg(t,t=>Wg(t,!1,null)),r=Kg(t,t=>Wg(t,!0,n)),s=Kg(t,t=>Wg(t,!1,i));return new Gg(e,r,s,n,i)}(this)}}class Yg{constructor(t,e){this.layout=t,this.moduleName=e,this.compiled=null;let{block:n}=t,[,i]=n;i=i.slice();let r=i.indexOf("&attrs");this.attrsBlockNumber=-1===r?i.push("&attrs"):r+1,this.symbolTable={symbols:i},this.meta=Tg(t)}compile(t){if(null!==this.compiled)return this.compiled;let e=Tg(this.layout),n=ug(t,e),{encoder:i,evaluation:r}=n;var s,o,a;s=function(...t){lg(i,r,e,t)},o=this.layout,a=this.attrsBlockNumber,s(1001),function(t,e,n){t(36,5),n(),t(35,5)}(s,0,()=>{s(91,4),s(31),s(33,3,0)}),s(66,ig("BODY")),s(36,5),s(89),s(49),s(99,4),bg(s,a,null),s(54),s(1e3,"BODY"),xg(s,[o.block[0],[]]),s(36,5),s(66,ig("END")),s(55),s(1e3,"END"),s(35,5),s(1002);let l=n.encoder.commit(e.size);return"number"!=typeof l||(this.compiled=l),l}}let Zg=0,Jg={cacheHit:0,cacheMiss:0};function Qg({id:t,moduleName:e,block:n,scope:i,isStrictMode:r}){let s,o=t||"client-"+Zg++,a=null,l=new WeakMap,c=t=>{if(void 0===s&&(s=JSON.parse(n)),void 0===t)return null===a?(Jg.cacheMiss++,a=new tm({id:o,block:s,moduleName:e,owner:null,scope:i,isStrictMode:r})):Jg.cacheHit++,a;let c=l.get(t);return void 0===c?(Jg.cacheMiss++,c=new tm({id:o,block:s,moduleName:e,owner:t,scope:i,isStrictMode:r}),l.set(t,c)):Jg.cacheHit++,c};return c.__id=o,c.__meta={moduleName:e},c}class tm{constructor(t){this.parsedLayout=t,this.result="ok",this.layout=null,this.wrappedLayout=null}get moduleName(){return this.parsedLayout.moduleName}get id(){return this.parsedLayout.id}get referrer(){return{moduleName:this.parsedLayout.moduleName,owner:this.parsedLayout.owner}}asLayout(){return this.layout?this.layout:this.layout=function(t,e){let[n,i]=t.block;return new $g(n,Tg(t),{symbols:i},e)}(Sn({},this.parsedLayout),this.moduleName)}asWrappedLayout(){return this.wrappedLayout?this.wrappedLayout:this.wrappedLayout=new Yg(Sn({},this.parsedLayout),this.moduleName)}}function em(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}const nm={id:"1b32f5c2-7623-43d6-a0ad-9672898920a1",moduleName:"__default__.hbs",block:JSON.stringify([[[18,1,null]],["&default"],[]]),scope:null,isStrictMode:!0},im=Object.freeze([]),rm=[!1,!0,null,void 0,im],sm=rm.indexOf(im);class om{value(t){let e=this.indexMap,n=e.get(t);return void 0===n&&(n=this.values.push(t)-1,e.set(t,n)),n}array(t){if(0===t.length)return sm;let e=new Array(t.length);for(let n=0;nt}helper(t,e=null,n){let i=this.helperDefinitionCache.get(t);if(void 0===i){let e=Ai(t);if(null===e)return this.helperDefinitionCache.set(t,null),null;let n="function"==typeof e?e:e.getHelper(t);i=this.value(n),this.helperDefinitionCache.set(t,i),this.helperDefinitionCount++}return i}modifier(t,e=null,n){let i=this.modifierDefinitionCache.get(t);if(void 0===i){let n=Mi(t);if(null===n)return this.modifierDefinitionCache.set(t,null),null;let r={resolvedName:e,manager:n,state:t};i=this.value(r),this.modifierDefinitionCache.set(t,i),this.modifierDefinitionCount++}return i}component(t,e,n,i){let r=this.componentDefinitionCache.get(t);if(void 0===r){let n=Li(t);if(null===n)return this.componentDefinitionCache.set(t,null),null;let s,o=fi(n.getCapabilities(t)),a=Ji(t),l=null;s=mi(0,o,ri.dynamicLayout)?a?.(e):a?.(e)??this.defaultTemplate,void 0!==s&&(s=em(s),l=mi(0,o,ri.wrapped)?s.asWrappedLayout():s.asLayout()),r={resolvedName:null,handle:-1,manager:n,capabilities:o,state:t,compilable:l},r.handle=this.value(r),i&&(r.debugName=i),this.componentDefinitionCache.set(t,r),this.componentDefinitionCount++}return r}resolvedComponent(t,e){let n=this.componentDefinitionCache.get(t);if(void 0===n){let{manager:i,state:r,template:s}=t,o=fi(i.getCapabilities(t)),a=null;mi(0,o,ri.dynamicLayout)||(s=s??this.defaultTemplate),null!==s&&(s=em(s),a=mi(0,o,ri.wrapped)?s.asWrappedLayout():s.asLayout()),n={resolvedName:e,handle:-1,manager:i,capabilities:o,state:r,compilable:a},n.handle=this.value(n),this.componentDefinitionCache.set(t,n),this.componentDefinitionCount++}return n}getValue(t){return this.values[t]}getArray(t){let e=this.reifiedArrs,n=e[t];if(void 0===n){let i=this.getValue(t);n=new Array(i.length);for(const[t,e]of gn(i))n[t]=this.getValue(e);e[t]=n}return n}constructor(){this.reifiedArrs={[sm]:im},this.defaultTemplate=Qg(nm)(),this.helperDefinitionCount=0,this.modifierDefinitionCount=0,this.componentDefinitionCount=0,this.values=rm.slice(),this.indexMap=new Map(this.values.map((t,e)=>[t,e])),this.helperDefinitionCache=new WeakMap,this.modifierDefinitionCache=new WeakMap,this.componentDefinitionCache=new WeakMap}}class am{constructor(t){this.heap=t,this.offset=0}get size(){return 1+((768&this.heap.getbyaddr(this.offset))>>8)}get isMachine(){return this.heap.getbyaddr(this.offset)&si?1:0}get type(){return 255&this.heap.getbyaddr(this.offset)}get op1(){return this.heap.getbyaddr(this.offset+1)}get op2(){return this.heap.getbyaddr(this.offset+2)}get op3(){return this.heap.getbyaddr(this.offset+3)}}class lm{constructor(){this.offset=0,this.handle=0,this.heap=new Int32Array(1048576),this.handleTable=[],this.handleState=[]}entries(){return this.offset}pushRaw(t){this.sizeCheck(),this.heap[this.offset++]=t}pushOp(t){this.pushRaw(t)}pushMachine(t){this.pushRaw(t|si)}sizeCheck(){let{heap:t}=this;if(this.offset===this.heap.length){let e=new Int32Array(t.length+1048576);e.set(t,0),this.heap=e}}getbyaddr(t){return this.heap[t]}setbyaddr(t,e){this.heap[t]=e}malloc(){return this.handleTable.push(this.offset),this.handleTable.length-1}finishMalloc(t){}size(){return this.offset}getaddr(t){return this.handleTable[t]}sizeof(t){return this.handleTable,-1}free(t){this.handleState[t]=1}compact(){let t=0,{handleTable:e,handleState:n,heap:i}=this;for(let r=0;r-536870913?function(t){return~t}(t):function(t){return 536870912|t}(t)}[1,-1].forEach(t=>{return gm((e=t,(e|=0)<0?function(t){return-536870913&t}(e):function(t){return~t}(e)));var e});const mm=new class{constructor(){this.evaluateOpcode=new Array(113).fill(null)}add(t,e,n="syscall"){this.evaluateOpcode[t]={syscall:"machine"!==n,evaluate:e}}evaluate(t,e,n){let i=this.evaluateOpcode[n];i.syscall?(e.isMachine,i.syscall,e.isMachine,e.type,i.evaluate(t,e)):(e.isMachine,i.syscall,e.isMachine,e.type,i.evaluate(t.lowlevel,e))}},ym=Symbol("TYPE"),_m=Symbol("INNER"),vm=Symbol("OWNER"),bm=Symbol("ARGS"),wm=Symbol("RESOLVED"),xm=new WeakSet;function Sm(t){return xm.has(t)}function Cm(t,e){return Sm(t)&&t[ym]===e}class km{constructor(t,e,n,i,r=!1){xm.add(this),this[ym]=t,this[_m]=e,this[vm]=n,this[bm]=i,this[wm]=r}}function Em(t){let e,n,i,r,s,o=t;for(;;){let{[bm]:t,[_m]:a}=o;if(null!==t){let{named:i,positional:r}=t;r.length>0&&(e=void 0===e?r:r.concat(e)),void 0===n&&(n=[]),n.unshift(i)}if(!Sm(a)){i=a,r=o[vm],s=o[wm];break}o=a}return{definition:i,owner:r,resolved:s,positional:e,named:n}}function Tm(t,e,n,i,r=!1){return new km(t,e,n,i,r)}class Rm{constructor(t){this.bucket=t?Sn({},t):{}}get(t){return this.bucket[t]}set(t,e){return this.bucket[t]=e}child(){return new Rm(this.bucket)}}class Pm{static root(t,{self:e,size:n=0}){let i=new Array(n+1).fill(Mn);return new Pm(t,i,null).init({self:e})}static sized(t,e=0){let n=new Array(e+1).fill(Mn);return new Pm(t,n,null)}constructor(t,e,n){this.owner=t,this.slots=e,this.callerScope=n}init({self:t}){return this.slots[0]=t,this}snapshot(){return this.slots.slice()}getSelf(){return this.get(0)}getSymbol(t){return this.get(t)}getBlock(t){let e=this.get(t);return e===Mn?null:e}bind(t,e){this.set(t,e)}bindSelf(t){this.set(0,t)}bindSymbol(t,e){this.set(t,e)}bindBlock(t,e){this.set(t,e)}bindCallerScope(t){this.callerScope=t}getCallerScope(){return this.callerScope}child(){return new Pm(this.owner,this.slots.slice(),this.callerScope)}get(t){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);return this.slots[t]}set(t,e){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);this.slots[t]=e}}class Mm{constructor(t,e){this.element=t,this.nextSibling=e}}class Im{constructor(t,e,n){this.parentNode=t,this.first=e,this.last=n}parentElement(){return this.parentNode}firstNode(){return this.first}lastNode(){return this.last}}function Om(t,e){let n=t.parentElement(),i=t.firstNode(),r=t.lastNode(),s=i;for(;;){let t=s.nextSibling;if(n.insertBefore(s,e),s===r)return t;s=t}}function Am(t){let e=t.parentElement(),n=t.firstNode(),i=t.lastNode(),r=n;for(;;){let t=r.nextSibling;if(e.removeChild(r),r===i)return t;r=t}}function Fm(t){return"getDebugCustomRenderTree"in t}let Lm=0;class zm{constructor(t){this.id=Lm++,this.value=t}get(){return this.value}release(){this.value=null}toString(){let t=`Ref ${this.id}`;if(null===this.value)return`${t} (released)`;try{return`${t}: ${this.value}`}catch{return t}}}class Dm{begin(){this.reset()}create(t,e){let n=Sn({},e,{bounds:null,refs:new Set});this.nodes.set(t,n),this.appendChild(n,t),this.enter(t)}update(t){this.enter(t)}didRender(t,e){this.nodeFor(t).bounds=e,this.exit()}willDestroy(t){this.refs.get(t).release()}commit(){this.reset()}capture(){return this.captureRefs(this.roots)}reset(){if(0!==this.stack.size){let t=this.stack.toArray()[0],e=this.refs.get(t);for(void 0!==e&&this.roots.delete(e);!this.stack.isEmpty();)this.stack.pop()}}enter(t){this.stack.push(t)}exit(){this.stack.pop()}nodeFor(t){return this.nodes.get(t)}appendChild(t,e){let n=this.stack.current,i=new zm(e);if(this.refs.set(e,i),n){let e=this.nodeFor(n);e.refs.add(i),t.parent=e}else this.roots.add(i)}captureRefs(t){let e=[];return t.forEach(n=>{let i=n.get();i?e.push(this.captureNode(`render-node:${n.id}`,i)):t.delete(n)}),e}captureNode(t,e){let n=this.nodeFor(e),{type:i,name:r,args:s,instance:o,refs:a}=n,l=this.captureTemplate(n),c=this.captureBounds(n),u=this.captureRefs(a);return{id:t,type:i,name:r,args:vy(s),instance:o,template:l,bounds:c,children:u}}captureTemplate({template:t}){return t||null}captureBounds(t){let e=t.bounds;return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}constructor(){this.stack=new wn,this.refs=new WeakMap,this.roots=new Set,this.nodes=new WeakMap}}function jm(t){return Nm(t)?"":String(t)}function Nm(t){return null==t||"function"!=typeof t.toString}function Um(t){return null!==t&&"object"==typeof t}function Bm(t){return Um(t)&&"function"==typeof t.toHTML}function qm(t){return"string"==typeof t}mm.add(39,t=>t.pushChildScope()),mm.add(40,t=>t.popScope()),mm.add(59,t=>t.pushDynamicScope()),mm.add(60,t=>t.popDynamicScope()),mm.add(28,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),mm.add(29,(t,{op1:e})=>{t.stack.push(Fn(t.constants.getValue(e)))}),mm.add(30,(t,{op1:e})=>{let n=t.stack;if(e>=0){let i=t.constants.getValue(e);n.push(i)}else n.push(gm(e))}),mm.add(31,t=>{let e,n=t.stack,i=n.pop();e=void 0===i?Mn:null===i?In:!0===i?On:!1===i?An:Pn(i),n.push(e)}),mm.add(33,(t,{op1:e,op2:n})=>{let i=t.fetchValue(e)-n;t.stack.dup(i)}),mm.add(34,(t,{op1:e})=>{t.stack.pop(e)}),mm.add(35,(t,{op1:e})=>{t.load(e)}),mm.add(36,(t,{op1:e})=>{t.fetch(e)}),mm.add(58,(t,{op1:e})=>{let n=t.constants.getArray(e);t.bindDynamicScope(n)}),mm.add(69,(t,{op1:e})=>{t.enter(e)}),mm.add(70,t=>{t.exit()}),mm.add(63,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),mm.add(62,t=>{t.stack.push(t.scope())}),mm.add(61,t=>{let e=t.stack,n=e.pop();n?e.push(t.compile(n)):e.push(null)}),mm.add(64,t=>{let{stack:e}=t,n=e.pop(),i=e.pop(),r=e.pop(),s=e.pop();if(null===r||null===n)return t.lowlevel.pushFrame(),void t.pushScope(i??t.scope());let o=i;{let t=r.parameters,e=t.length;if(e>0){o=o.child();for(let n=0;n{let n=t.stack.pop(),i=Boolean(qn(n));Un(n)?i&&t.lowlevel.goto(e):(i&&t.lowlevel.goto(e),t.updateWith(new Vm(n)))}),mm.add(66,(t,{op1:e})=>{let n=t.stack.pop(),i=Boolean(qn(n));Un(n)?i||t.lowlevel.goto(e):(i||t.lowlevel.goto(e),t.updateWith(new Vm(n)))}),mm.add(67,(t,{op1:e,op2:n})=>{t.stack.peek()===n&&t.lowlevel.goto(e)}),mm.add(68,t=>{let e=t.stack.peek();Un(e)||t.updateWith(new Vm(e))}),mm.add(71,t=>{let{stack:e}=t,n=e.pop();e.push(zn(()=>Ot(qn(n))))});class Vm{constructor(t){this.ref=t,this.last=qn(t)}evaluate(t){let{last:e,ref:n}=this;e!==qn(n)&&t.throw()}}class $m{constructor(t,e){this.ref=t,this.filter=e,this.last=e(qn(t))}evaluate(t){let{last:e,ref:n,filter:i}=this;e!==i(qn(n))&&t.throw()}}class Gm{finalize(t,e){this.target=e,this.didModify(t)}evaluate(t){let{tag:e,target:n,lastRevision:i}=this;!t.alwaysRevalidate&&de(e,i)&&(De(e),t.goto(n))}didModify(t){this.tag=t,this.lastRevision=he(this.tag),De(t)}constructor(){this.tag=ve,this.lastRevision=1}}class Wm{constructor(t){this.debugLabel=t}evaluate(){Oe(this.debugLabel)}}class Hm{constructor(t){this.target=t}evaluate(){let t=Ae();this.target.didModify(t)}}mm.add(41,(t,{op1:e})=>{t.tree().appendText(t.constants.getValue(e))}),mm.add(42,(t,{op1:e})=>{t.tree().appendComment(t.constants.getValue(e))}),mm.add(48,(t,{op1:e})=>{t.tree().openElement(t.constants.getValue(e))}),mm.add(49,t=>{let e=qn(t.stack.pop());t.tree().openElement(e)}),mm.add(50,t=>{let e=t.stack.pop(),n=t.stack.pop(),i=t.stack.pop(),r=qn(e),s=qn(n),o=qn(i);Un(e)||t.updateWith(new Vm(e)),void 0===s||Un(n)||t.updateWith(new Vm(n));let a=t.tree().pushRemoteElement(r,o,s);if(t.associateDestroyable(a),void 0!==t.env.debugRenderTree){let i=py(void 0===s?{}:{insertBefore:n},[e]);t.env.debugRenderTree.create(a,{type:"keyword",name:"in-element",args:i,instance:null}),Wt(a,()=>{t.env.debugRenderTree?.willDestroy(a)})}}),mm.add(56,t=>{let e=t.tree().popRemoteElement();void 0!==t.env.debugRenderTree&&t.env.debugRenderTree.didRender(e,e)}),mm.add(54,t=>{let e=t.fetchValue(6),n=null;e&&(n=e.flush(t),t.loadValue(6,null)),t.tree().flushElement(n)}),mm.add(55,t=>{let e=t.tree().closeElement();null!==e&&e.forEach(e=>{t.env.scheduleInstallModifier(e);const n=e.manager.getDestroyable(e.state);null!==n&&t.associateDestroyable(n)})}),mm.add(57,(t,{op1:e})=>{if(!t.env.isInteractive)return;let n=t.getOwner(),i=t.stack.pop(),r=t.constants.getValue(e),{manager:s}=r,{constructing:o}=t.tree(),a=i.capture(),l=s.create(n,o,r.state,a),c={manager:s,state:l,definition:r};t.fetchValue(6).addModifier(t,c,a);let u=s.getTag(l);return null!==u?(De(u),t.updateWith(new Km(u,c))):void 0}),mm.add(108,t=>{if(!t.env.isInteractive)return;let{stack:e}=t,n=e.pop(),i=e.pop().capture(),{positional:r,named:s}=i,{constructing:o}=t.tree(),a=t.getOwner(),l=zn(()=>{let t,e,l=qn(n);if(!bn(l))return;if(Cm(l,2)){let{definition:n,owner:o,positional:a,named:c}=Em(l);e=n,t=o,void 0!==a&&(i.positional=a.concat(r)),void 0!==c&&(i.named=Object.assign({},...c,s))}else e=l,t=a;let c=Mi(e);if(null===c)throw new Error("BUG: modifier manager expected");let u={resolvedName:null,manager:c,state:e},h=c.create(t,o,u.state,i);return{manager:c,state:h,definition:u}}),c=qn(l),u=null;return void 0!==c&&(t.fetchValue(6).addModifier(t,c,i),u=c.manager.getTag(c.state),null!==u&&De(u)),!Un(n)||u?t.updateWith(new Xm(u,c,l)):void 0});class Km{constructor(t,e){this.tag=t,this.modifier=e,this.lastUpdated=he(t)}evaluate(t){let{modifier:e,tag:n,lastUpdated:i}=this;De(n),de(n,i)||(t.env.scheduleUpdateModifier(e),this.lastUpdated=he(n))}}class Xm{constructor(t,e,n){this.tag=t,this.instance=e,this.instanceRef=n,this.lastUpdated=he(t??Ce)}evaluate(t){let{tag:e,lastUpdated:n,instance:i,instanceRef:r}=this,s=qn(r);if(s!==i){if(void 0!==i){let t=i.manager.getDestroyable(i.state);null!==t&&Ht(t)}if(void 0!==s){let{manager:n,state:i}=s,r=n.getDestroyable(i);null!==r&&Gt(this,r),e=n.getTag(i),null!==e&&(this.lastUpdated=he(e)),this.tag=e,t.env.scheduleInstallModifier(s)}this.instance=s}else null===e||de(e,n)||(t.env.scheduleUpdateModifier(i),this.lastUpdated=he(e));null!==e&&De(e)}}mm.add(51,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=i?t.constants.getValue(i):null;t.tree().setStaticAttribute(r,s,o)}),mm.add(52,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=t.stack.pop(),a=qn(o),l=i?t.constants.getValue(i):null,c=t.tree().setDynamicAttribute(r,a,s,l);Un(o)||t.updateWith(new Ym(o,c,t.env))});class Ym{constructor(t,e,n){let i=!1;this.updateRef=zn(()=>{let r=qn(t);i?e.update(r,n):i=!0}),qn(this.updateRef)}evaluate(){qn(this.updateRef)}}mm.add(78,(t,{op1:e})=>{let n=t.constants.getValue(e),{manager:i,capabilities:r}=n,s={definition:n,manager:i,capabilities:r,state:null,handle:null,table:null,lookup:null};t.stack.push(s)}),mm.add(80,(t,{op1:e})=>{let n,i=t.stack,r=qn(i.pop()),s=t.constants,o=t.getOwner();if(s.getValue(e),t.loadValue(7,null),"string"==typeof r){let e=function(t,e,n,i){let r=t?.lookupComponent?.(n,i)??null;return e.resolvedComponent(r,n)}(t.context.resolver,s,r,o);n=e}else n=Sm(r)?r:s.component(r,o);i.push(n)}),mm.add(81,t=>{let e,n=t.stack,i=qn(n.pop()),r=t.constants;e=Sm(i)?i:r.component(i,t.getOwner(),!0),n.push(e)}),mm.add(79,t=>{let e,n,{stack:i}=t,r=i.pop();Sm(r)?n=e=null:(n=r.manager,e=r.capabilities),i.push({definition:r,capabilities:e,manager:n,state:null,handle:null,table:null})}),mm.add(82,(t,{op1:e,op2:n,op3:i})=>{let r=t.stack,s=t.constants.getArray(e),o=i>>4,a=8&i,l=7&i?t.constants.getArray(n):dn;t.args.setup(r,s,l,o,!!a),r.push(t.args)}),mm.add(83,t=>{let{stack:e}=t;e.push(t.args.empty(e))}),mm.add(86,t=>{let e=t.stack,n=e.pop().capture();e.push(n)}),mm.add(85,(t,{op1:e})=>{let n=t.stack,i=t.fetchValue(e),r=n.pop(),{definition:s}=i;if(Cm(s,0)){s.manager;let e=t.constants,{definition:n,owner:o,resolved:a,positional:l,named:c}=Em(s);if(a)s=n;else if("string"==typeof n){let i=t.context.resolver?.lookupComponent?.(n,o)??null;s=e.resolvedComponent(i,n)}else s=e.component(n,o);void 0!==c&&r.named.merge(Sn({},...c)),void 0!==l&&(r.realloc(l.length),r.positional.prepend(l));let{manager:u}=s;i.definition=s,i.manager=u,i.capabilities=s.capabilities,t.loadValue(7,o)}let{manager:o,state:a}=s;if(!mi(0,i.capabilities,ri.prepareArgs))return void n.push(r);let l=r.blocks.values,c=r.blocks.names,u=o.prepareArgs(a,r);if(u){r.clear();for(let r=0;r{let n=t.fetchValue(4),{definition:i,manager:r,capabilities:s}=n;if(!mi(0,s,ri.createInstance))return;let o=null;mi(0,s,ri.dynamicScope)&&(o=t.dynamicScope());let a=1&e,l=null;mi(0,s,ri.createArgs)&&(l=t.stack.peek());let c=null;mi(0,s,ri.createCaller)&&(c=t.getSelf());let u=r.create(t.getOwner(),i.state,l,t.env,o,c,!!a);n.state=u,mi(0,s,ri.updateHook)&&t.updateWith(new ey(u,r,o))}),mm.add(88,(t,{op1:e})=>{let{manager:n,state:i,capabilities:r}=t.fetchValue(e),s=n.getDestroyable(i);s&&t.associateDestroyable(s)}),mm.add(97,(t,{op1:e})=>{t.beginCacheGroup(void 0),t.tree().pushAppendingBlock()}),mm.add(89,t=>{t.loadValue(6,new Zm)}),mm.add(53,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=t.stack.pop(),a=i?t.constants.getValue(i):null;t.fetchValue(6).setAttribute(r,o,s,a)}),mm.add(105,(t,{op1:e,op2:n,op3:i})=>{let r=t.constants.getValue(e),s=t.constants.getValue(n),o=i?t.constants.getValue(i):null;t.fetchValue(6).setStaticAttribute(r,s,o)});class Zm{setAttribute(t,e,n,i){let r={value:e,namespace:i,trusting:n};"class"===t&&this.classes.push(e),this.attributes[t]=r}setStaticAttribute(t,e,n){let i={value:e,namespace:n};"class"===t&&this.classes.push(e),this.attributes[t]=i}addModifier(t,e,n){if(this.modifiers.push(e),void 0!==t.env.debugRenderTree){const{manager:i,definition:r,state:s}=e;if(null===s||"object"!=typeof s&&"function"!=typeof s)return;let{element:o,constructing:a}=t.tree(),l=r.resolvedName??i.getDebugName(r.state),c=i.getDebugInstance(s),u=new Im(o,a,a);t.env.debugRenderTree.create(s,{type:"modifier",name:l,args:n,instance:c}),t.env.debugRenderTree.didRender(s,u),t.associateDestroyable(s),t.updateWith(new iy(s)),t.updateWith(new ry(s,u)),Wt(s,()=>{t.env.debugRenderTree?.willDestroy(s)})}}flush(t){let e,n=this.attributes;for(let i in this.attributes){if("type"===i){e=n[i];continue}let r=this.attributes[i];"class"===i?Qm(t,"class",Jm(this.classes),r.namespace,r.trusting):Qm(t,i,r.value,r.namespace,r.trusting)}return void 0!==e&&Qm(t,"type",e.value,e.namespace,e.trusting),this.modifiers}constructor(){this.attributes=_n(),this.classes=[],this.modifiers=[]}}function Jm(t){return 0===t.length?"":1===t.length?t[0]:function(t){return t.every(t=>"string"==typeof t)}(t)?t.join(" "):(e=t,zn(()=>{let t=[];for(const n of e){let e=jm("string"==typeof n?n:qn(n));e&&t.push(e)}return 0===t.length?null:t.join(" ")}));var e}function Qm(t,e,n,i,r=!1){if("string"==typeof n)t.tree().setStaticAttribute(e,n,i);else{let s=t.tree().setDynamicAttribute(e,qn(n),r,i);Un(n)||t.updateWith(new Ym(n,s,t.env))}}function ty(t,e,n,i,r){let s=n.table.symbols.indexOf(t),o=i.get(e);-1!==s&&r.scope().bindBlock(s+1,o),n.lookup&&(n.lookup[t]=o)}mm.add(99,(t,{op1:e})=>{let{definition:n,state:i}=t.fetchValue(e),{manager:r}=n,s=t.fetchValue(6);r.didCreateElement(i,t.tree().constructing,s)}),mm.add(90,(t,{op1:e,op2:n})=>{let i=t.fetchValue(e),{definition:r,state:s}=i,{manager:o}=r,a=o.getSelf(s);if(void 0!==t.env.debugRenderTree){let i,r,o=t.fetchValue(e),{definition:l,manager:c}=o;if(t.stack.peek()===t.args)i=t.args.capture();else{let e=t.constants.getArray(n);t.args.setup(t.stack,e,[],0,!0),i=t.args.capture()}let u=l.compilable;if(null===u){mi(0,o.capabilities,ri.dynamicLayout);let e=t.context.resolver;u=null===e?null:c.getDynamicLayout(s,e),r=null!==u?u.moduleName:"__default__.hbs"}else r=u.moduleName;if(t.associateDestroyable(o),Fm(c))c.getDebugCustomRenderTree(o.definition.state,o.state,i,r).forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.create(n,e),Wt(o,()=>{t.env.debugRenderTree?.willDestroy(n)}),t.updateWith(new iy(n))});else{let e=function(t,e=t.manager){return t.resolvedName??t.debugName??e.getDebugName(t.state)}(l,c);t.env.debugRenderTree.create(o,{type:"component",name:e,args:i,template:r,instance:qn(a)}),Wt(o,()=>{t.env.debugRenderTree?.willDestroy(o)}),t.updateWith(new iy(o))}}t.stack.push(a)}),mm.add(91,(t,{op1:e})=>{let{definition:n,state:i}=t.fetchValue(e),{manager:r}=n,s=r.getTagName(i);t.stack.push(s)}),mm.add(92,(t,{op1:e})=>{let n=t.fetchValue(e),{manager:i,definition:r}=n,{stack:s}=t,{compilable:o}=r;if(null===o){let{capabilities:e}=n,r=t.context.resolver;o=null===r?null:i.getDynamicLayout(n.state,r),null===o&&(o=mi(0,e,ri.wrapped)?fm(t.constants.defaultTemplate).asWrappedLayout():fm(t.constants.defaultTemplate).asLayout())}let a=o.compile(t.context);s.push(o.symbolTable),s.push(a)}),mm.add(75,(t,{op1:e})=>{let n=t.stack.pop(),i=t.stack.pop(),{manager:r,capabilities:s}=n,o={definition:n,manager:r,capabilities:s,state:null,handle:i.handle,table:i.symbolTable,lookup:null};t.loadValue(e,o)}),mm.add(95,(t,{op1:e})=>{let{stack:n}=t,i=n.pop(),r=n.pop(),s=t.fetchValue(e);s.handle=i,s.table=r}),mm.add(38,(t,{op1:e})=>{let n,{table:i,manager:r,capabilities:s,state:o}=t.fetchValue(e);mi(0,s,ri.hasSubOwner)?(n=r.getOwner(o),t.loadValue(7,null)):(n=t.fetchValue(7),null===n?n=t.getOwner():t.loadValue(7,null)),t.pushRootScope(i.symbols.length+1,n)}),mm.add(17,(t,{op1:e})=>{let n=t.fetchValue(e),i=t.scope(),r=t.stack.peek(),s=r.named.atNames;for(let o=s.length-1;o>=0;o--){let t=s[o],e=n.table.symbols.indexOf(t),a=r.named.get(t,!0);-1!==e&&i.bindSymbol(e+1,a),n.lookup&&(n.lookup[t]=a)}}),mm.add(18,(t,{op1:e})=>{let n=t.fetchValue(e),{blocks:i}=t.stack.peek();for(const[r]of gn(i.names))ty(i.symbolNames[r],i.names[r],n,i,t)}),mm.add(96,(t,{op1:e})=>{let n=t.fetchValue(e);t.call(n.handle)}),mm.add(100,(t,{op1:e})=>{let n=t.fetchValue(e),{manager:i,state:r,capabilities:s}=n,o=t.tree().popBlock();void 0!==t.env.debugRenderTree&&(Fm(i)?i.getDebugCustomRenderTree(n.definition.state,r,xy).reverse().forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.didRender(n,o),t.updateWith(new ry(n,o))}):(t.env.debugRenderTree.didRender(n,o),t.updateWith(new ry(n,o)))),mi(0,s,ri.createInstance)&&(i.didRenderLayout(r,o),t.env.didCreate(n),t.updateWith(new ny(n,o)))}),mm.add(98,t=>{t.commitCacheGroup()});class ey{constructor(t,e,n){this.component=t,this.manager=e,this.dynamicScope=n}evaluate(t){let{component:e,manager:n,dynamicScope:i}=this;n.update(e,i)}}class ny{constructor(t,e){this.component=t,this.bounds=e}evaluate(t){let{component:e,bounds:n}=this,{manager:i,state:r}=e;i.didUpdateLayout(r,n),t.env.didUpdate(e)}}class iy{constructor(t){this.bucket=t}evaluate(t){t.env.debugRenderTree?.update(this.bucket)}}class ry{constructor(t,e){this.bucket=t,this.bounds=e}evaluate(t){t.env.debugRenderTree?.didRender(this.bucket,this.bounds)}}class sy{constructor(){this.stack=null,this.positional=new ay,this.named=new ly,this.blocks=new hy}empty(t){let e=t.registers[3]+1;return this.named.empty(t,e),this.positional.empty(t,e),this.blocks.empty(t,e),this}setup(t,e,n,i,r){this.stack=t;let s=this.named,o=e.length,a=t.registers[3]-o+1;s.setup(t,a,o,e,r);let l=a-i;this.positional.setup(t,l,i);let c=this.blocks,u=n.length,h=l-3*u;c.setup(t,h,u,n)}get base(){return this.blocks.base}get length(){return this.positional.length+this.named.length+3*this.blocks.length}at(t){return this.positional.at(t)}realloc(t){let{stack:e}=this;if(t>0&&null!==e){let{positional:n,named:i}=this,r=n.base+t;for(let t=n.length+i.length-1;t>=0;t--)e.copy(t+n.base,t+r);n.base+=t,i.base+=t,e.registers[3]+=t}}capture(){let t=0===this.positional.length?wy:this.positional.capture();return{named:0===this.named.length?by:this.named.capture(),positional:t}}clear(){let{stack:t,length:e}=this;e>0&&null!==t&&t.pop(e)}}const oy=hn();class ay{constructor(){this.base=0,this.length=0,this.stack=null,this._references=null}empty(t,e){this.stack=t,this.base=e,this.length=0,this._references=oy}setup(t,e,n){this.stack=t,this.base=e,this.length=n,this._references=0===n?oy:null}at(t){let{base:e,length:n,stack:i}=this;return t<0||t>=n?Mn:i.get(t,e)}capture(){return this.references}prepend(t){let e=t.length;if(e>0){let{base:n,length:i,stack:r}=this;this.base=n-=e,this.length=i+e;for(let s=0;s0){let{names:n,length:i,stack:r}=this,s=n.slice();for(const o of e)-1===s.indexOf(o)&&(i=s.push(o),r.push(t[o]));this.length=i,this._references=null,this._names=s,this._atNames=null}}get references(){let t=this._references;if(!t){let{base:e,length:n,stack:i}=this;t=this._references=i.slice(e,e+n)}return t}toSyntheticName(t){return t.slice(1)}toAtName(t){return`@${t}`}}function cy(t){return`&${t}`}const uy=hn();class hy{constructor(){this.internalValues=null,this._symbolNames=null,this.internalTag=null,this.names=dn,this.length=0,this.base=0}empty(t,e){this.stack=t,this.names=dn,this.base=e,this.length=0,this._symbolNames=null,this.internalTag=ve,this.internalValues=uy}setup(t,e,n,i){this.stack=t,this.names=i,this.base=e,this.length=n,this._symbolNames=null,0===n?(this.internalTag=ve,this.internalValues=uy):(this.internalTag=null,this.internalValues=null)}get values(){let t=this.internalValues;if(!t){let{base:e,length:n,stack:i}=this;t=this.internalValues=i.slice(e,e+3*n)}return t}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);if(-1===e)return null;let{base:n,stack:i}=this,r=i.get(3*e,n),s=i.get(3*e+1,n),o=i.get(3*e+2,n);return null===o?null:[o,s,r]}capture(){return new dy(this.names,this.values)}get symbolNames(){let t=this._symbolNames;return null===t&&(t=this._symbolNames=this.names.map(cy)),t}}class dy{constructor(t,e){this.names=t,this.values=e,this.length=t.length}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);return-1===e?null:[this.values[3*e+2],this.values[3*e+1],this.values[3*e]]}}function py(t,e){return{named:t,positional:e}}function fy(t){let e=_n();for(const[n,i]of Object.entries(t))e[n]=qn(i);return e}function gy(t){return t.map(qn)}const my=Symbol("ARGUMENT_ERROR");function yy(t){return null!==t&&"object"==typeof t&&t[my]}function _y(t){return{[my]:!0,error:t}}function vy(t){return{named:function(t){let e=_n();for(const[i,r]of Object.entries(t))try{e[i]=qn(r)}catch(n){e[i]=_y(n)}return e}(t.named),positional:(e=t.positional,e.map(t=>{try{return qn(t)}catch(e){return _y(e)}}))};var e}const by=Object.freeze(Object.create(null)),wy=oy,xy=py(by,wy);function Sy(t){return"string"==typeof t?t:"function"!=typeof t.toString?"":String(t)}function Cy(t){let e,n=Ai(t);return e=null===n?null:"function"==typeof n?n:n.getHelper(t),e}function ky(t){return t===Mn}mm.add(77,(t,{op1:e,op2:n})=>{let i=t.stack,r=i.pop(),s=i.pop(),o=t.getOwner();t.context.resolver,t.loadValue(8,function(t,e,n,i){let r,s;return zn(()=>{let o=qn(e);return o===r||(s=Cm(o,t)?i?Tm(t,o,n,i):i:0===t&&"string"==typeof o&&o||bn(o)?Tm(t,o,n,i):null,r=o),s})}(e,r,o,s))}),mm.add(107,t=>{let e,n=t.stack,i=n.pop(),r=n.pop().capture(),s=t.getOwner(),o=zn(()=>{void 0!==e&&Ht(e);let t=qn(i);if(Cm(t,1)){let{definition:n,owner:i,positional:s,named:a}=Em(t),l=Cy(n);void 0!==a&&(r.named=Sn({},...a,r.named)),void 0!==s&&(r.positional=s.concat(r.positional)),e=l(r,i),Gt(o,e)}else if(bn(t)){let n=Cy(t);e=n(r,s),Kt(e)&&Gt(o,e)}else e=Mn}),a=zn(()=>(qn(o),qn(e)));t.associateDestroyable(o),t.loadValue(8,a)}),mm.add(16,(t,{op1:e})=>{let n=t.stack,i=t.constants.getValue(e)(n.pop().capture(),t.getOwner(),t.dynamicScope());Kt(i)&&t.associateDestroyable(i),t.loadValue(8,i)}),mm.add(21,(t,{op1:e})=>{let n=t.referenceForSymbol(e);t.stack.push(n)}),mm.add(19,(t,{op1:e})=>{let n=t.stack.pop();t.scope().bindSymbol(e,n)}),mm.add(20,(t,{op1:e})=>{let n=t.stack.pop(),i=t.stack.pop(),r=t.stack.pop();t.scope().bindBlock(e,[n,i,r])}),mm.add(37,(t,{op1:e})=>{t.pushRootScope(e,t.getOwner())}),mm.add(22,(t,{op1:e})=>{let n=t.constants.getValue(e),i=t.stack.pop();t.stack.push($n(i,n))}),mm.add(23,(t,{op1:e})=>{let{stack:n}=t,i=t.scope().getBlock(e);n.push(i)}),mm.add(24,t=>{let{stack:e}=t,n=e.pop();if(n&&!ky(n)){let[t,i,r]=n;e.push(r),e.push(i),e.push(t)}else e.push(null),e.push(null),e.push(null)}),mm.add(25,t=>{let{stack:e}=t,n=e.pop();n&&!ky(n)?e.push(On):e.push(An)}),mm.add(26,t=>{t.stack.pop(),t.stack.pop();let e=t.stack.pop(),n=e&&e.parameters.length;t.stack.push(n?On:An)}),mm.add(27,(t,{op1:e})=>{let n=new Array(e);for(let r=e;r>0;r--)n[r-1]=t.stack.pop();var i;t.stack.push((i=n,zn(()=>{const t=[];for(const e of i){const n=qn(e);null!=n&&t.push(Sy(n))}return t.length>0?t.join(""):null})))}),mm.add(109,t=>{let e=t.stack.pop(),n=t.stack.pop(),i=t.stack.pop();t.stack.push(zn(()=>Ot(qn(e))?qn(n):qn(i)))}),mm.add(110,t=>{let e=t.stack.pop();t.stack.push(zn(()=>!Ot(qn(e))))}),mm.add(111,t=>{let e=t.dynamicScope(),n=t.stack,i=n.pop();n.push(zn(()=>{let t=String(qn(i));return qn(e.get(t))}))}),mm.add(112,t=>{let{positional:e}=t.stack.pop().capture();t.loadValue(8,zn(()=>{console.log(...gy(e))}))});class Ey{constructor(t,e,n){this.node=t,this.reference=e,this.lastValue=n}evaluate(){let t,e=qn(this.reference),{lastValue:n}=this;e!==n&&(t=Nm(e)?"":qm(e)?e:String(e),t!==n)&&(this.node.nodeValue=this.lastValue=t)}}function Ty(t){return function(t){return qm(t)||Nm(t)||"boolean"==typeof t||"number"==typeof t}(t)?2:Cm(t,0)||zi(t)?0:Cm(t,1)||Di(t)?1:Bm(t)?4:function(t){return Um(t)&&11===t.nodeType}(t)?5:function(t){return Um(t)&&"number"==typeof t.nodeType}(t)?6:2}function Ry(t){return bn(t)?Cm(t,0)||zi(t)?0:1:2}function Py(t,e){console.info("Use `context`, and `get()` to debug this template."),e("this")}mm.add(76,t=>{let e=t.stack.peek();t.stack.push(Ty(qn(e))),Un(e)||t.updateWith(new $m(e,Ty))}),mm.add(106,t=>{let e=t.stack.peek();t.stack.push(Ry(qn(e))),Un(e)||t.updateWith(new $m(e,Ry))}),mm.add(43,t=>{let e=qn(t.stack.pop()),n=Nm(e)?"":String(e);t.tree().appendDynamicHTML(n)}),mm.add(44,t=>{let e=qn(t.stack.pop()).toHTML(),n=Nm(e)?"":e;t.tree().appendDynamicHTML(n)}),mm.add(47,t=>{let e=t.stack.pop(),n=qn(e),i=Nm(n)?"":String(n),r=t.tree().appendDynamicText(i);Un(e)||t.updateWith(new Ey(r,e,i))}),mm.add(45,t=>{let e=qn(t.stack.pop());t.tree().appendDynamicFragment(e)}),mm.add(46,t=>{let e=qn(t.stack.pop());t.tree().appendDynamicNode(e)});let My=Py;class Iy{#f;constructor(t,e){this.scope=t,this.#f=e}get(t){let e,{scope:n}=this,i=this.#f,r=t.split("."),[s,...o]=t.split(".");return"this"===s?e=n.getSelf():i.locals[s]?e=n.getSymbol(i.locals[s]):(e=this.scope.getSelf(),o=r),o.reduce((t,e)=>$n(t,e),e)}}mm.add(103,(t,{op1:e})=>{let n=t.constants.getValue(e),i=new Iy(t.scope(),n);My(qn(t.getSelf()),t=>qn(i.get(t)))}),mm.add(72,(t,{op1:e,op2:n})=>{let i=t.stack,r=i.pop(),s=qn(i.pop()),o=Qn(r,null===s?"@identity":String(s)),a=qn(o);t.updateWith(new $m(o,t=>t.isEmpty())),a.isEmpty()?t.lowlevel.goto(n+1):(t.enterList(o,e),t.stack.push(a))}),mm.add(73,t=>{t.exitList()}),mm.add(74,(t,{op1:e})=>{let n=t.stack.peek().next();null!==n?t.registerItem(t.enterItem(n)):t.lowlevel.goto(e)});const Oy={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!1,wrapped:!1,willDestroy:!1,hasSubOwner:!1};class Ay{getCapabilities(){return Oy}getDebugName({name:t}){return t}getSelf(){return In}getDestroyable(){return null}}const Fy=new Ay;class Ly{constructor(t="@glimmer/component/template-only",e="(unknown template-only component)"){this.moduleName=t,this.name=e}toString(){return this.moduleName}}function zy(t,e){return new Ly(t,e)}Fi(Fy,Ly.prototype);const Dy={foreignObject:1,desc:1,title:1},jy=Object.create(null);class Ny{constructor(t){this.document=t,this.setupUselessElement()}setupUselessElement(){this.uselessElement=this.document.createElement("div")}createElement(t,e){let n,i,r,s;if(e?(n=e.namespaceURI===hm||"svg"===t,r=e.namespaceURI===um||"math"===t,i=!!Dy[e.tagName]):(n="svg"===t,r="math"===t,i=!1),!r&&!n||i)return this.document.createElement(t);if(jy[t])throw new Error(`Cannot create a ${t} inside an SVG context`);return s=r?um:hm,this.document.createElementNS(s,t)}insertBefore(t,e,n){t.insertBefore(e,n)}insertHTMLBefore(t,e,n){if(""===n){const n=this.createComment("");return t.insertBefore(n,e),new Im(t,n,n)}const i=e?e.previousSibling:t.lastChild;let r;if(null===e)t.insertAdjacentHTML("beforeend",n),r=t.lastChild;else if(e instanceof HTMLElement)e.insertAdjacentHTML("beforebegin",n),r=e.previousSibling;else{const{uselessElement:i}=this;t.insertBefore(i,e),i.insertAdjacentHTML("beforebegin",n),r=i.previousSibling,t.removeChild(i)}const s=i?i.nextSibling:t.firstChild;return new Im(t,s,r)}createTextNode(t){return this.document.createTextNode(t)}createComment(t){return this.document.createComment(t)}}function Uy(t,e,n){if(!t)return e;if(!function(t,e){const n=t.createElementNS(e,"svg");try{n.insertAdjacentHTML("beforeend","")}catch{}finally{return 1!==n.childNodes.length||n.firstChild.namespaceURI!==hm}}(t,n))return e;const i=t.createElement("div");return class extends e{insertHTMLBefore(t,e,r){return""===r||t.namespaceURI!==n?super.insertHTMLBefore(t,e,r):function(t,e,n,i){let r;if("FOREIGNOBJECT"===t.tagName.toUpperCase()){const t=""+n+"";xn(e),e.insertAdjacentHTML("afterbegin",t),r=e.firstChild.firstChild}else{const t=""+n+"";xn(e),e.insertAdjacentHTML("afterbegin",t),r=e.firstChild}return function(t,e,n){const i=t.firstChild;let r=i,s=i;for(;s;){const t=s.nextSibling;e.insertBefore(s,n),r=s,s=t}return new Im(e,i,r)}(r,t,i)}(t,i,r,e)}}}function By(t,e){return t&&function(t){const e=t.createElement("div");return e.appendChild(t.createTextNode("first")),e.insertAdjacentHTML("beforeend","second"),2!==e.childNodes.length}(t)?class extends e{constructor(t){super(t),this.uselessComment=t.createComment("")}insertHTMLBefore(t,e,n){if(""===n)return super.insertHTMLBefore(t,e,n);let i=!1;const r=e?e.previousSibling:t.lastChild;r&&r instanceof Text&&(i=!0,t.insertBefore(this.uselessComment,e));const s=super.insertHTMLBefore(t,e,n);return i&&t.removeChild(this.uselessComment),s}}:e}const qy="undefined"==typeof document?null:dm(document);let Vy=class extends Ny{createElementNS(t,e){return this.document.createElementNS(t,e)}setAttribute(t,e,n,i=null){i?t.setAttributeNS(i,e,n):t.setAttribute(e,n)}};Vy=By(qy,Vy),Vy=Uy(qy,Vy,hm);const $y=Vy;["b","big","blockquote","body","br","center","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","head","hr","i","img","li","listing","main","meta","nobr","ol","p","pre","ruby","s","small","span","strong","strike","sub","sup","table","tt","u","ul","var"].forEach(t=>jy[t]=1);const Gy=/[\t\n\v\f\r \xa0\u{1680}\u{180e}\u{2000}-\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}\u{feff}]/u,Wy="undefined"==typeof document?null:dm(document);class Hy extends Ny{constructor(t){super(t),this.document=t,this.namespace=null}setAttribute(t,e,n){t.setAttribute(e,n)}removeAttribute(t,e){t.removeAttribute(e)}insertAfter(t,e,n){this.insertBefore(t,e,n.nextSibling)}}let Ky=Hy;Ky=By(Wy,Ky),Ky=Uy(Wy,Ky,hm);const Xy=Ky;function Yy(t,e){let n,i;if(e in t)i=e,n="prop";else{let r=e.toLowerCase();r in t?(n="prop",i=r):(n="attr",i=e)}return"prop"!==n||"style"!==i.toLowerCase()&&!function(t,e){let n=Zy[t.toUpperCase()];return!(!n||!n[e.toLowerCase()])}(t.tagName,i)||(n="attr"),{normalized:i,type:n}}const Zy={INPUT:{form:!0,autocorrect:!0,list:!0},SELECT:{form:!0},OPTION:{form:!0},TEXTAREA:{form:!0},LABEL:{form:!0},FIELDSET:{form:!0},LEGEND:{form:!0},OBJECT:{form:!0},OUTPUT:{form:!0},BUTTON:{form:!0}},Jy=Symbol("TRANSACTION");class Qy{didCreate(t){this.createdComponents.push(t)}didUpdate(t){this.updatedComponents.push(t)}scheduleInstallModifier(t){this.scheduledInstallModifiers.push(t)}scheduleUpdateModifier(t){this.scheduledUpdateModifiers.push(t)}commit(){let{createdComponents:t,updatedComponents:e}=this;for(const{manager:r,state:s}of t)r.didCreate(s);for(const{manager:r,state:s}of e)r.didUpdate(s);let{scheduledInstallModifiers:n,scheduledUpdateModifiers:i}=this;for(const{manager:r,state:s,definition:o}of n){let t=r.getTag(s);if(null!==t){let e=Ge(()=>r.install(s));me(t,e)}else r.install(s)}for(const{manager:r,state:s,definition:o}of i){let t=r.getTag(s);if(null!==t){let e=Ge(()=>r.update(s));me(t,e)}else r.update(s)}}constructor(){this.scheduledInstallModifiers=[],this.scheduledUpdateModifiers=[],this.createdComponents=[],this.updatedComponents=[]}}class t_{static{i_=Jy}constructor(t,e){this.delegate=e,this[i_]=null,this.isInteractive=e.isInteractive,this.debugRenderTree=this.delegate.enableDebugTooling?new Dm:void 0,this.isArgumentCaptureError=this.delegate.enableDebugTooling?yy:void 0,t.appendOperations?(this.appendOperations=t.appendOperations,this.updateOperations=t.updateOperations):t.document&&(this.appendOperations=new $y(t.document),this.updateOperations=new Hy(t.document))}getAppendOperations(){return this.appendOperations}getDOM(){return this.updateOperations}begin(){this[Jy],this.debugRenderTree?.begin(),this[Jy]=new Qy}get transaction(){return this[Jy]}didCreate(t){this.transaction.didCreate(t)}didUpdate(t){this.transaction.didUpdate(t)}scheduleInstallModifier(t){this.isInteractive&&this.transaction.scheduleInstallModifier(t)}scheduleUpdateModifier(t){this.isInteractive&&this.transaction.scheduleUpdateModifier(t)}commit(){let t=this.transaction;this[Jy]=null,t.commit(),this.debugRenderTree?.commit(),this.delegate.onTransactionCommit()}}function e_(t,e,n,i){return{env:new t_(t,e),program:new cm(n.constants,n.heap),resolver:i}}function n_(t,e){if(t[Jy])e();else{t.begin();try{e()}finally{t.commit()}}}var i_;function r_(t){return Ii(t,{})}const s_=r_(({positional:t})=>zn(()=>gy(t),null)),o_=t=>(t=>null==t||"function"!=typeof t.toString)(t)?"":String(t),a_=r_(({positional:t})=>zn(()=>gy(t).map(o_).join(""),null)),l_=r_(({positional:t})=>{let e=t[0];return zn(()=>(...n)=>{let[i,...r]=gy(t);if(!jn(e))return i.call(null,...r,...n);{let t=r.length>0?r[0]:n[0];Vn(e,t)}},null)}),c_=r_(({positional:t})=>{let e=t[0]??Mn,n=t[1]??Mn;return zn(()=>{let t=qn(e);if(vn(t))return Lt(t,String(qn(n)))},t=>{let i=qn(e);if(vn(i))return zt(i,String(qn(n)),t)})}),u_=r_(({named:t})=>{let e=zn(()=>fy(t),null),n=new Map;for(let i in t)n.set(i,t[i]);return e.children=n,e});function h_(t){return Ve(t.argsCache)}class d_{constructor(t,e=()=>xy){let n=qe(()=>e(t));this.argsCache=n}get named(){return h_(this).named||by}get positional(){return h_(this).positional||wy}}function p_(t,e,n){const i=cr(t),r=Ai(e).getDelegateFor(i);let s,o=new d_(t,n),a=r.createHelper(e,o);if(!vi(r))throw new Error("TODO: unreachable, to be implemented with hasScheduledEffect");return s=qe(()=>r.getValue(a)),Gt(t,s),bi(r)&&Gt(s,r.getDestroyable(a)),s}class f_{constructor(t,e){this.tag=_e(),this.listener=null,this.element=t,this.args=e,Wt(this,()=>{let{element:t,listener:e}=this;if(e){let{eventName:n,callback:i,options:r}=e;y_(t,n,i,r)}})}updateListener(){let{element:t,args:e,listener:n}=this;e.positional[0];let i=qn(e.positional[0]);e.positional[1];let r,s,o,a=qn(e.positional[1]);{let{once:t,passive:n,capture:i}=e.named;t&&(r=qn(t)),n&&(s=qn(n)),i&&(o=qn(i))}let l,c=!1;if(c=null===n||i!==n.eventName||a!==n.userProvidedCallback||r!==n.once||s!==n.passive||o!==n.capture,c&&(void 0===r&&void 0===s&&void 0===o||(l={once:r,passive:s,capture:o})),c){let e=a;this.listener={eventName:i,callback:e,userProvidedCallback:a,once:r,passive:s,capture:o,options:l},n&&y_(t,n.eventName,n.callback,n.options),function(t,e,n,i){g_++,t.addEventListener(e,n,i)}(t,i,e,l)}}}let g_=0,m_=0;function y_(t,e,n,i){m_++,t.removeEventListener(e,n,i)}const __=Pi(new class{getDebugName(){return"on"}getDebugInstance(){return null}get counters(){return{adds:g_,removes:m_}}create(t,e,n,i){return new f_(e,i)}getTag({tag:t}){return t}install(t){t.updateListener()}update(t){t.updateListener()}getDestroyable(t){return t}},{});class v_{constructor(t,e,n,i){this.stack=t,this.externs=n,this.currentOpSize=0,this.context=e,this.registers=i}fetchRegister(t){return this.registers[t]}loadRegister(t,e){this.registers[t]=e}setPc(t){this.registers[0]=t}pushFrame(){this.stack.push(this.registers[1]),this.stack.push(this.registers[2]),this.registers[2]=this.registers[3]-1}popFrame(){this.registers[3]=this.registers[2]-1,this.registers[1]=this.stack.get(0),this.registers[2]=this.stack.get(1)}pushSmallFrame(){this.stack.push(this.registers[1])}popSmallFrame(){this.registers[1]=this.stack.pop()}goto(t){this.setPc(this.target(t))}target(t){return this.registers[0]+t-this.currentOpSize}call(t){this.registers[1]=this.registers[0],this.setPc(this.context.program.heap.getaddr(t))}returnTo(t){this.registers[1]=this.target(t)}return(){this.setPc(this.registers[1])}nextStatement(){let{registers:t,context:e}=this,n=t[0];if(-1===n)return null;let i=e.program.opcode(n),r=this.currentOpSize=i.size;return this.registers[0]+=r,i}evaluateOuter(t,e){this.evaluateInner(t,e)}evaluateInner(t,e){t.isMachine?this.evaluateMachine(t,e):this.evaluateSyscall(t,e)}evaluateMachine(t,e){switch(t.type){case 0:return void this.pushFrame();case 1:return void this.popFrame();case 3:return void this.call(t.op1);case 2:return void e.call(this.stack.pop());case 4:return void this.goto(t.op1);case 5:return void e.return();case 6:return void this.returnTo(t.op1)}}evaluateSyscall(t,e){mm.evaluate(e,t,t.type)}}const b_=["javascript:","vbscript:"],w_=["A","BODY","LINK","IMG","IFRAME","BASE","FORM"],x_=["EMBED"],S_=["href","src","background","action"],C_=["src"];function k_(t,e){return-1!==t.indexOf(e)}function E_(t,e){return(null===t||k_(w_,t))&&k_(S_,e)}function T_(t,e){return null!==t&&k_(x_,t)&&k_(C_,e)}function R_(t,e){return E_(t,e)||T_(t,e)}let P_;function M_(t,e,n){if(null==n)return n;if(Bm(n))return n.toHTML();const i=t.tagName.toUpperCase();let r=jm(n);if(E_(i,e)){let t=(s=r,P_||(P_=function(){const t=URL;if("object"==typeof t&&null!==t&&"function"==typeof t.parse){let e=t;return t=>{let n=null;return"string"==typeof t&&(n=e.parse(t).protocol),null===n?":":n}}if("function"==typeof t)return e=>{try{return new t(e).protocol}catch{return":"}};throw new Error('@glimmer/runtime needs a valid "globalThis.URL"')}()),P_(s));if(k_(b_,t))return`unsafe:${r}`}var s;return T_(i,e)?`unsafe:${r}`:r}function I_(t,e,n){const{tagName:i,namespaceURI:r}=t,s={element:t,name:e,namespace:n};if(r===hm)return O_(i,e,s);const{type:o,normalized:a}=Yy(t,e);return"attr"===o?O_(i,a,s):function(t,e,n){return R_(t,e)?new z_(e,n):function(t,e){return("INPUT"===t||"TEXTAREA"===t)&&"value"===e}(t,e)?new j_(e,n):function(t,e){return"OPTION"===t&&"selected"===e}(t,e)?new N_(e,n):new L_(e,n)}(i,a,s)}function O_(t,e,n){return R_(t,e)?new D_(n):new F_(n)}class A_{constructor(t){this.attribute=t}}class F_ extends A_{set(t,e,n){const i=U_(e);if(null!==i){const{name:e,namespace:n}=this.attribute;t.__setAttribute(e,i,n)}}update(t,e){const n=U_(t),{element:i,name:r}=this.attribute;null===n?i.removeAttribute(r):i.setAttribute(r,n)}}class L_ extends A_{constructor(t,e){super(e),this.normalizedName=t}set(t,e,n){null!=e&&(this.value=e,t.__setProperty(this.normalizedName,e))}update(t,e){const{element:n}=this.attribute;this.value!==t&&(n[this.normalizedName]=this.value=t,null==t&&this.removeAttribute())}removeAttribute(){const{element:t,namespace:e}=this.attribute;e?t.removeAttributeNS(e,this.normalizedName):t.removeAttribute(this.normalizedName)}}class z_ extends L_{set(t,e,n){const{element:i,name:r}=this.attribute,s=M_(i,r,e);super.set(t,s,n)}update(t,e){const{element:n,name:i}=this.attribute,r=M_(n,i,t);super.update(r,e)}}class D_ extends F_{set(t,e,n){const{element:i,name:r}=this.attribute,s=M_(i,r,e);super.set(t,s,n)}update(t,e){const{element:n,name:i}=this.attribute,r=M_(n,i,t);super.update(r,e)}}class j_ extends L_{set(t,e){t.__setProperty("value",jm(e))}update(t){const e=this.attribute.element,n=e.value,i=jm(t);n!==i&&(e.value=i)}}class N_ extends L_{set(t,e){null!=e&&!1!==e&&t.__setProperty("selected",!0)}update(t){this.attribute.element.selected=!!t}}function U_(t){return!1===t||null==t||void 0===t.toString?null:!0===t?"":"function"==typeof t?null:String(t)}class B_{constructor(t){this.node=t}firstNode(){return this.node}}class q_{constructor(t){this.node=t}lastNode(){return this.node}}class V_{static forInitialRender(t,e){return new this(t,e.element,e.nextSibling).initialize()}static resume(t,e){let n=new this(t,e.parentElement(),e.reset(t)).initialize();return n.pushBlock(e),n}constructor(t,e,n){this.constructing=null,this.operations=null,this.cursors=new wn,this.modifierStack=new wn,this.blockStack=new wn,this.pushElement(e,n),this.env=t,this.dom=t.getAppendOperations(),this.updateOperations=t.getDOM()}initialize(){return this.pushAppendingBlock(),this}debugBlocks(){return this.blockStack.toArray()}get element(){return this.cursors.current.element}get nextSibling(){return this.cursors.current.nextSibling}get hasBlocks(){return this.blockStack.size>0}block(){return this.blockStack.current}popElement(){this.cursors.pop(),this.cursors.current}pushAppendingBlock(){return this.pushBlock(new $_(this.element))}pushResettableBlock(){return this.pushBlock(new W_(this.element))}pushBlockList(t){return this.pushBlock(new H_(this.element,t))}pushBlock(t,e=!1){let n=this.blockStack.current;return null!==n&&(e||n.didAppendBounds(t)),this.__openBlock(),this.blockStack.push(t),t}popBlock(){return this.block().finalize(this),this.__closeBlock(),this.blockStack.pop()}__openBlock(){}__closeBlock(){}openElement(t){let e=this.__openElement(t);return this.constructing=e,e}__openElement(t){return this.dom.createElement(t,this.element)}flushElement(t){let e=this.element,n=this.constructing;this.__flushElement(e,n),this.constructing=null,this.operations=null,this.pushModifiers(t),this.pushElement(n,null),this.didOpenElement(n)}__flushElement(t,e){this.dom.insertBefore(t,e,this.nextSibling)}closeElement(){return this.willCloseElement(),this.popElement(),this.popModifiers()}pushRemoteElement(t,e,n){return this.__pushRemoteElement(t,e,n)}__pushRemoteElement(t,e,n){if(this.pushElement(t,n),void 0===n)for(;t.lastChild;)t.removeChild(t.lastChild);let i=new G_(t);return this.pushBlock(i,!0)}popRemoteElement(){const t=this.popBlock();return this.popElement(),t}pushElement(t,e=null){this.cursors.push(new Mm(t,e))}pushModifiers(t){this.modifierStack.push(t)}popModifiers(){return this.modifierStack.pop()}didAppendBounds(t){return this.block().didAppendBounds(t),t}didAppendNode(t){return this.block().didAppendNode(t),t}didOpenElement(t){return this.block().openElement(t),t}willCloseElement(){this.block().closeElement()}appendText(t){return this.didAppendNode(this.__appendText(t))}__appendText(t){let{dom:e,element:n,nextSibling:i}=this,r=e.createTextNode(t);return e.insertBefore(n,r,i),r}__appendNode(t){return this.dom.insertBefore(this.element,t,this.nextSibling),t}__appendFragment(t){let e=t.firstChild;if(e){let n=new Im(this.element,e,t.lastChild);return this.dom.insertBefore(this.element,t,this.nextSibling),n}{const t=this.__appendComment("");return new Im(this.element,t,t)}}__appendHTML(t){return this.dom.insertHTMLBefore(this.element,this.nextSibling,t)}appendDynamicHTML(t){let e=this.trustedContent(t);this.didAppendBounds(e)}appendDynamicText(t){let e=this.untrustedContent(t);return this.didAppendNode(e),e}appendDynamicFragment(t){let e=this.__appendFragment(t);this.didAppendBounds(e)}appendDynamicNode(t){let e=this.__appendNode(t),n=new Im(this.element,e,e);this.didAppendBounds(n)}trustedContent(t){return this.__appendHTML(t)}untrustedContent(t){return this.__appendText(t)}appendComment(t){return this.didAppendNode(this.__appendComment(t))}__appendComment(t){let{dom:e,element:n,nextSibling:i}=this,r=e.createComment(t);return e.insertBefore(n,r,i),r}__setAttribute(t,e,n){this.dom.setAttribute(this.constructing,t,e,n)}__setProperty(t,e){this.constructing[t]=e}setStaticAttribute(t,e,n){this.__setAttribute(t,e,n)}setDynamicAttribute(t,e,n,i){let r=I_(this.constructing,t,i);return r.set(this,e,this.env),r}}class $_{constructor(t){this.parent=t,this.first=null,this.last=null,this.nesting=0}parentElement(){return this.parent}firstNode(){return this.first.firstNode()}lastNode(){return this.last.lastNode()}openElement(t){this.didAppendNode(t),this.nesting++}closeElement(){this.nesting--}didAppendNode(t){0===this.nesting&&(this.first||(this.first=new B_(t)),this.last=new q_(t))}didAppendBounds(t){0===this.nesting&&(this.first||(this.first=t),this.last=t)}finalize(t){null===this.first&&t.appendComment("")}}class G_ extends $_{constructor(t){super(t),Wt(this,()=>{this.parentElement()===this.firstNode().parentNode&&Am(this)})}}class W_ extends $_{constructor(t){super(t)}reset(){Ht(this);let t=Am(this);return this.first=null,this.last=null,this.nesting=0,t}}class H_{constructor(t,e){this.parent=t,this.boundList=e,this.parent=t,this.boundList=e}parentElement(){return this.parent}firstNode(){return this.boundList[0].firstNode()}lastNode(){let t=this.boundList;return t[t.length-1].lastNode()}openElement(t){}closeElement(){}didAppendNode(t){}didAppendBounds(t){}finalize(t){this.boundList.length}}function K_(t,e){return V_.forInitialRender(t,e)}class X_{constructor(t,{alwaysRevalidate:e=!1}){this.frameStack=new wn,this.env=t,this.dom=t.getDOM(),this.alwaysRevalidate=e}execute(t,e){this._execute(t,e)}_execute(t,e){let{frameStack:n}=this;for(this.try(t,e);!n.isEmpty();){let t=this.frame.nextStatement();void 0!==t?t.evaluate(this):n.pop()}}get frame(){return this.frameStack.current}goto(t){this.frame.goto(t)}try(t,e){this.frameStack.push(new tv(t,e))}throw(){this.frame.handleException(),this.frameStack.pop()}}class Y_{constructor(t,e,n,i){this.state=t,this.context=e,this.children=i,this.bounds=n}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}evaluate(t){t.try(this.children,null)}}class Z_ extends Y_{evaluate(t){t.try(this.children,this)}handleException(){let{state:t,bounds:e,context:{env:n}}=this;!function(t){let{children:e}=$t(t);qt(e,Ht)}(this);let i=V_.resume(n,e),r=t.evaluate(i),s=this.children=[],o=r.execute(t=>{t.updateWith(this),t.pushUpdating(s)});Gt(this,o.drop)}constructor(...t){super(...t),this.type="try"}}class J_ extends Z_{constructor(t,e,n,i,r,s){super(t,e,n,[]),this.key=i,this.memo=r,this.value=s,this.retained=!1,this.index=-1}shouldRemove(){return!this.retained}reset(){this.retained=!1}}class Q_ extends Y_{constructor(t,e,n,i,r){super(t,e,n,i),this.iterableRef=r,this.type="list-block",this.opcodeMap=new Map,this.marker=null,this.lastIterator=qn(r)}initializeChild(t){t.index=this.children.length-1,this.opcodeMap.set(t.key,t)}evaluate(t){let e=qn(this.iterableRef);if(this.lastIterator!==e){let{bounds:n}=this,{dom:i}=t,r=this.marker=i.createComment("");i.insertAfter(n.parentElement(),r,n.lastNode()),this.sync(e),this.parentElement().removeChild(r),this.marker=null,this.lastIterator=e}super.evaluate(t)}sync(t){let{opcodeMap:e,children:n}=this,i=0,r=0;for(this.children=this.bounds.boundList=[];;){let s=t.next();if(null===s)break;let o=n[i],{key:a}=s;for(;void 0!==o&&o.retained;)o=n[++i];if(void 0!==o&&o.key===a)this.retainItem(o,s),i++;else if(e.has(a)){let t=e.get(a);if(t.index{let i=e.enterItem(t);i.index=s.length,s.push(i),n.set(a,i),Gt(this,i)})}moveItem(t,e,n){let i,r,{children:s}=this;Vn(t.memo,e.memo),Vn(t.value,e.value),t.retained=!0,void 0===n?Om(t,this.marker):(i=t.lastNode().nextSibling,r=n.firstNode(),i!==r&&Om(t,r)),t.index=s.length,s.push(t)}deleteItem(t){Ht(t),Am(t),this.opcodeMap.delete(t.key)}}class tv{constructor(t,e){this.ops=t,this.exceptionHandler=e,this.current=0}goto(t){this.current=t}nextStatement(){return this.ops[this.current++]}handleException(){this.exceptionHandler&&this.exceptionHandler.handleException()}}class ev{constructor(t,e,n,i){this.env=t,this.updating=e,this.bounds=n,this.drop=i,Gt(this,i),Wt(this,()=>Am(this.bounds))}rerender({alwaysRevalidate:t=!1}={alwaysRevalidate:!1}){let{env:e,updating:n}=this;new X_(e,{alwaysRevalidate:t}).execute(n,this)}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}handleException(){}}class nv{static restore(t,e){const n=new this(t.slice(),[0,-1,t.length-1,0]);return n.registers[0]=e,n.registers[3]=t.length-1,n.registers[2]=-1,n}constructor(t=[],e){this.stack=t,this.registers=e}push(t){this.stack[++this.registers[3]]=t}dup(t=this.registers[3]){this.stack[++this.registers[3]]=this.stack[t]}copy(t,e){this.stack[e]=this.stack[t]}pop(t=1){let e=this.stack[this.registers[3]];return this.registers[3]-=t,e}peek(t=0){return this.stack[this.registers[3]-t]}get(t,e=this.registers[2]){return this.stack[e+t]}set(t,e,n=this.registers[2]){this.stack[n+e]=t}slice(t,e){return this.stack.slice(t,e)}capture(t){let e=this.registers[3]+1,n=e-t;return this.stack.slice(n,e)}reset(){this.stack.length=0}}class iv{constructor(t,e){this.drop={},this.scope=new wn,this.dynamicScope=new wn,this.updating=new wn,this.cache=new wn,this.list=new wn,this.destroyable=new wn,this.scope.push(t),this.dynamicScope.push(e),this.destroyable.push(this.drop)}}class rv{#g;get stack(){return this.lowlevel.stack}get pc(){return this.lowlevel.fetchRegister(0)}#m;fetch(t){let e=this.fetchValue(t);this.stack.push(e)}load(t){let e=this.stack.pop();this.loadValue(t,e)}loadValue(t,e){this.#m[t]=e}fetchValue(t){return function(t){return t<=3}(t)?this.lowlevel.fetchRegister(t):this.#m[t]}call(t){null!==t&&this.lowlevel.call(t)}return(){this.lowlevel.return()}#y;constructor({scope:t,dynamicScope:e,stack:n,pc:i},r,s){this.#m=[null,null,null,null,null,null,null,null,null];let o=nv.restore(n,i);this.#y=s,this.context=r,this.#g=new iv(t,e),this.args=new sy,this.lowlevel=new v_(o,r,void 0,o.registers),this.pushUpdating()}static initial(t,e){let n=Pm.root(e.owner,e.scope??{self:Mn,size:0});const i=function(t,e,n){return{pc:t,scope:e,dynamicScope:n,stack:[]}}(t.program.heap.getaddr(e.handle),n,e.dynamicScope);return new rv(i,t,e.tree)}compile(t){return pm(t.compile(this.context))}get constants(){return this.context.program.constants}get program(){return this.context.program}get env(){return this.context.env}captureClosure(t,e=this.lowlevel.fetchRegister(0)){return{pc:e,scope:this.scope(),dynamicScope:this.dynamicScope(),stack:this.stack.capture(t)}}capture(t,e=this.lowlevel.fetchRegister(0)){return new sv(this.captureClosure(t,e),this.context)}beginCacheGroup(t){let e=this.updating(),n=new Gm;e.push(n),e.push(new Wm(t)),this.#g.cache.push(n),Oe()}commitCacheGroup(){let t=this.updating(),e=this.#g.cache.pop(),n=Ae();t.push(new Hm(e)),e.finalize(n,t.length)}enter(t){let e=this.capture(t),n=this.tree().pushResettableBlock(),i=new Z_(e,this.context,n,[]);this.didEnter(i)}enterItem({key:t,value:e,memo:n}){let{stack:i}=this,r=ti(e),s=ti(n);i.push(r),i.push(s);let o=this.capture(2),a=this.tree().pushResettableBlock(),l=new J_(o,this.context,a,t,s,r);return this.didEnter(l),l}registerItem(t){this.listBlock().initializeChild(t)}enterList(t,e){let n=[],i=this.lowlevel.target(e),r=this.capture(0,i),s=this.tree().pushBlockList(n),o=new Q_(r,this.context,s,n,t);this.#g.list.push(o),this.didEnter(o)}didEnter(t){this.associateDestroyable(t),this.#g.destroyable.push(t),this.updateWith(t),this.pushUpdating(t.children)}exit(){this.#g.destroyable.pop(),this.#y.popBlock(),this.popUpdating()}exitList(){this.exit(),this.#g.list.pop()}pushRootScope(t,e){let n=Pm.sized(e,t);return this.#g.scope.push(n),n}pushChildScope(){this.#g.scope.push(this.scope().child())}pushScope(t){this.#g.scope.push(t)}popScope(){this.#g.scope.pop()}pushDynamicScope(){let t=this.dynamicScope().child();return this.#g.dynamicScope.push(t),t}bindDynamicScope(t){let e=this.dynamicScope();for(const n of fn(t))e.set(n,this.stack.pop())}pushUpdating(t=[]){this.#g.updating.push(t)}popUpdating(){return this.#g.updating.pop()}updateWith(t){this.updating().push(t)}listBlock(){return this.#g.list.current}associateDestroyable(t){Gt(this.#g.destroyable.current,t)}updating(){return this.#g.updating.current}tree(){return this.#y}scope(){return this.#g.scope.current}dynamicScope(){return this.#g.dynamicScope.current}popDynamicScope(){this.#g.dynamicScope.pop()}getOwner(){return this.scope().owner}getSelf(){return this.scope().getSelf()}referenceForSymbol(t){return this.scope().getSymbol(t)}execute(t){return this._execute(t)}_execute(t){let e;t&&t(this);do{e=this.next()}while(!e.done);return e.value}next(){let t,{env:e}=this,n=this.lowlevel.nextStatement();return null!==n?(this.lowlevel.evaluateOuter(n,this),t={done:!1,value:null}):(this.stack.reset(),t={done:!0,value:new ev(e,this.popUpdating(),this.#y.popBlock(),this.#g.drop)}),t}}class sv{constructor(t,e){this.state=t,this.context=e}evaluate(t){return new rv(this.state,this.context,t)}}class ov{constructor(t){this.vm=t}next(){return this.vm.next()}sync(){return this.vm.execute()}}function av(t,e,n,i,r,s=new Rm){let o=pm(r.compile(t)),a=r.symbolTable.symbols.length,l=rv.initial(t,{scope:{self:n,size:a},dynamicScope:s,tree:i,handle:o,owner:e});return new ov(l)}function lv(t,e,n,i,r={},s=new Rm){return function(t,e,n,i,r){const s=Object.keys(r).map(t=>[t,r[t]]),o=["main","else","attrs"],a=s.map(([t])=>`@${t}`);let l=t.constants.component(i,n,void 0,"{ROOT}");t.lowlevel.pushFrame();for(let h=0;h<3*o.length;h++)t.stack.push(null);t.stack.push(null),s.forEach(([,e])=>{t.stack.push(e)}),t.args.setup(t.stack,a,o,0,!0);const c=l.compilable,u={handle:pm(c.compile(e)),symbolTable:c.symbolTable};return t.stack.push(t.args),t.stack.push(u),t.stack.push(l),new ov(t)}(rv.initial(t,{tree:e,handle:t.stdlib.main,dynamicScope:s,owner:n}),t,n,i,function(t){const e=Fn(t);return Object.keys(t).reduce((t,n)=>(t[n]=$n(e,n),t),{})}(r))}function cv(t){return"%+b:0%"===t.nodeValue}class uv extends Mm{constructor(t,e,n){super(t,e),this.startingBlockDepth=n,this.candidate=null,this.injectedOmittedNode=!1,this.openBlockDepth=n-1}}class hv extends V_{constructor(t,e,n){if(super(t,e,n),this.unmatchedAttributes=null,this.blockDepth=0,n)throw new Error("Rehydration with nextSibling not supported");let i=this.currentCursor.element.firstChild;for(;null!==i&&!dv(i);)i=i.nextSibling;this.candidate=i;const r=fv(i);if(0!==r){const t=r-1,e=this.dom.createComment(`%+b:${t}%`);i.parentNode.insertBefore(e,this.candidate);let n=i.nextSibling;for(;null!==n&&(!pv(n)||fv(n)!==r);)n=n.nextSibling;const s=this.dom.createComment(`%-b:${t}%`);i.parentNode.insertBefore(s,n.nextSibling),this.candidate=e,this.startingBlockOffset=t}else this.startingBlockOffset=0}get currentCursor(){return this.cursors.current}get candidate(){return this.currentCursor?this.currentCursor.candidate:null}set candidate(t){this.currentCursor.candidate=t}disableRehydration(t){const e=this.currentCursor;e.candidate=null,e.nextSibling=t}enableRehydration(t){const e=this.currentCursor;e.candidate=t,e.nextSibling=null}pushElement(t,e=null){const n=new uv(t,e,this.blockDepth||0);null!==this.candidate&&(n.candidate=t.firstChild,this.candidate=t.nextSibling),this.cursors.push(n)}clearMismatch(t){let e=t;const n=this.currentCursor;if(null!==n){const t=n.openBlockDepth;if(t>=n.startingBlockDepth)for(;e&&!(pv(e)&&t>=gv(e,this.startingBlockOffset));)e=this.remove(e);else for(;null!==e;)e=this.remove(e);this.disableRehydration(e)}}__openBlock(){const{currentCursor:t}=this;if(null===t)return;const e=this.blockDepth;this.blockDepth++;const{candidate:n}=t;if(null===n)return;const{tagName:i}=t.element;dv(n)&&gv(n,this.startingBlockOffset)===e?(this.candidate=this.remove(n),t.openBlockDepth=e):"TITLE"!==i&&"SCRIPT"!==i&&"STYLE"!==i&&this.clearMismatch(n)}__closeBlock(){const{currentCursor:t}=this;if(null===t)return;const e=t.openBlockDepth;this.blockDepth--;const{candidate:n}=t;let i=!1;if(null!==n)if(i=!0,pv(n)&&gv(n,this.startingBlockOffset)===e){const e=this.remove(n);this.candidate=e,t.openBlockDepth--}else this.clearMismatch(n),i=!1;if(!i){const e=t.nextSibling;if(null!==e&&pv(e)&&gv(e,this.startingBlockOffset)===this.blockDepth){const n=this.remove(e);this.enableRehydration(n),t.openBlockDepth--}}}__appendNode(t){const{candidate:e}=this;return e||super.__appendNode(t)}__appendHTML(t){const e=this.markerBounds();if(e){const t=e.firstNode(),n=e.lastNode(),i=new Im(this.element,t.nextSibling,n.previousSibling),r=this.remove(t);return this.remove(n),null!==r&&_v(r)&&(this.candidate=this.remove(r),null!==this.candidate&&this.clearMismatch(this.candidate)),i}return super.__appendHTML(t)}remove(t){const e=t.parentNode,n=t.nextSibling;return e.removeChild(t),n}markerBounds(){const t=this.candidate;if(t&&yv(t)){const e=t;let n=e.nextSibling;for(;!yv(n);)n=n.nextSibling;return new Im(this.element,e,n)}return null}__appendText(t){const{candidate:e}=this;return e?3===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):8===(n=e).nodeType&&"%|%"===n.nodeValue||_v(e)&&""===t?(this.candidate=this.remove(e),this.__appendText(t)):(this.clearMismatch(e),super.__appendText(t)):super.__appendText(t);var n}__appendComment(t){const e=this.candidate;return e&&8===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):(e&&this.clearMismatch(e),super.__appendComment(t))}__openElement(t){const e=this.candidate;if(e&&mv(e)&&function(t,e){return t.namespaceURI===hm?t.tagName===e:t.tagName===e.toUpperCase()}(e,t))return this.unmatchedAttributes=[].slice.call(e.attributes),e;if(e){if(mv(e)&&"TBODY"===e.tagName)return this.pushElement(e,null),this.currentCursor.injectedOmittedNode=!0,this.__openElement(t);this.clearMismatch(e)}return super.__openElement(t)}__setAttribute(t,e,n){const i=this.unmatchedAttributes;if(i){const n=vv(i,t);if(n)return n.value!==e&&(n.value=e),void i.splice(i.indexOf(n),1)}return super.__setAttribute(t,e,n)}__setProperty(t,e){const n=this.unmatchedAttributes;if(n){const i=vv(n,t);if(i)return i.value!==e&&(i.value=e),void n.splice(n.indexOf(i),1)}return super.__setProperty(t,e)}__flushElement(t,e){const{unmatchedAttributes:n}=this;if(n){for(const t of n)this.constructing.removeAttribute(t.name);this.unmatchedAttributes=null}else super.__flushElement(t,e)}willCloseElement(){const{candidate:t,currentCursor:e}=this;null!==t&&this.clearMismatch(t),e&&e.injectedOmittedNode&&this.popElement(),super.willCloseElement()}getMarker(t,e){const n=t.querySelector(`script[glmr="${e}"]`);return n?dm(n):null}__pushRemoteElement(t,e,n){const i=this.getMarker(t,e);if(!i||i.parentNode,void 0===n){for(;null!==t.firstChild&&t.firstChild!==i;)this.remove(t.firstChild);n=null}const r=new uv(t,null,this.blockDepth);this.cursors.push(r),null===i?this.disableRehydration(n):this.candidate=this.remove(i);const s=new G_(t);return this.pushBlock(s,!0)}didAppendBounds(t){if(super.didAppendBounds(t),this.candidate){const e=t.lastNode();this.candidate=e.nextSibling}return t}}function dv(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%+b:",0)}function pv(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%-b:",0)}function fv(t){return parseInt(t.nodeValue.slice(4),10)}function gv(t,e){return fv(t)-e}function mv(t){return 1===t.nodeType}function yv(t){return 8===t.nodeType&&"%glmr%"===t.nodeValue}function _v(t){return 8===t.nodeType&&"% %"===t.nodeValue}function vv(t,e){for(const n of t)if(n.name===e)return n}function bv(t,e){return hv.forInitialRender(t,e)}const wv=Object.freeze(Object.defineProperty({__proto__:null,ConcreteBounds:Im,CurriedValue:km,CursorImpl:Mm,DOMChanges:Xy,DOMTreeConstruction:$y,DynamicAttribute:A_,DynamicScopeImpl:Rm,EMPTY_ARGS:xy,EMPTY_NAMED:by,EMPTY_POSITIONAL:wy,EnvironmentImpl:t_,IDOMChanges:Hy,LowLevelVM:v_,NewTreeBuilder:V_,RehydrateTree:hv,RemoteBlock:G_,ResettableBlockImpl:W_,SERIALIZATION_FIRST_NODE_STRING:"%+b:0%",ScopeImpl:Pm,SimpleDynamicAttribute:F_,TEMPLATE_ONLY_COMPONENT_MANAGER:Fy,TemplateOnlyComponent:Ly,TemplateOnlyComponentManager:Ay,UpdatingVM:X_,array:s_,clear:Am,clientBuilder:K_,concat:a_,createCapturedArgs:py,curry:Tm,destroy:Ht,dynamicAttribute:I_,fn:l_,get:c_,hash:u_,inTransaction:n_,invokeHelper:p_,isDestroyed:Yt,isDestroying:Xt,isSerializationFirstNode:cv,isWhitespace:function(t){return Gy.test(t)},normalizeProperty:Yy,on:__,registerDestructor:Wt,rehydrationBuilder:bv,reifyArgs:function(t){return{named:fy(t.named),positional:gy(t.positional)}},reifyNamed:fy,reifyPositional:gy,renderComponent:lv,renderMain:av,renderSync:function(t,e){let n;return n_(t,()=>n=e.sync()),n},resetDebuggerCallback:function(){My=Py},runtimeOptions:e_,setDebuggerCallback:function(t){My=t},templateOnlyComponent:zy},Symbol.toStringTag,{value:"Module"})),xv=__,Sv=Symbol("MUTABLE_CELL"),Cv=Qg({id:"yTlmws8O",block:'[[[46,[30,0],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/root.hbs",isStrictMode:!0}),kv=Qg({id:"Cc/BCoQJ",block:'[[[11,"input"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,4,[30,0,["type"]]],[16,"checked",[30,0,["checked"]]],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/input.hbs",scope:()=>[xv],isStrictMode:!0});function Ev(){}class Tv{static toString(){return"internal component"}constructor(t,e,n){this.owner=t,this.args=e,this.caller=n,hr(this,t)}get id(){return et(this)}get class(){return"ember-view"}validateArguments(){for(let t of Object.keys(this.args.named))this.isSupportedArgument(t)||this.onUnsupportedArgument(t)}named(t){let e=this.args.named[t];return e?qn(e):void 0}positional(t){let e=this.args.positional[t];return e?qn(e):void 0}listenerFor(t){return this.named(t)||Ev}isSupportedArgument(t){return!1}onUnsupportedArgument(t){}toString(){return`<${this.constructor}:${et(this)}>`}}const Rv=new WeakMap;function Pv(t,e){let n={create(){throw void 0},toString:()=>t.toString()};return Rv.set(n,t),Fi(Iv,n),Zi(e,n),n}const Mv={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Iv=new class{getCapabilities(){return Mv}create(t,e,n,i,r,s){var o;let a=new(o=e,Rv.get(o))(t,n.capture(),qn(s));return We(a.validateArguments.bind(a)),a}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}getDebugName(t){return t.toString()}getSelf(t){return Fn(t)}getDestroyable(t){return t}},Ov=Object.freeze({});function Av(t){return function(t){return t.target}(t).value}function Fv(t){return void 0===t?new Lv(void 0):Un(t)?new Lv(qn(t)):Bn(t)?new zv(t):new Dv(t)}class Lv{static{Sh(this.prototype,"value",[Is])}#_=void Eh(this,"value");constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}}class zv{constructor(t){this.reference=t}get(){return qn(this.reference)}set(t){Vn(this.reference,t)}}class Dv{local;upstream;lastUpstreamValue=Ov;constructor(t){this.upstream=new zv(t)}get(){let t=this.upstream.get();return t!==this.lastUpstreamValue&&(this.lastUpstreamValue=t,this.local=new Lv(t)),this.local.get()}set(t){this.local.set(t)}}class jv extends Tv{validateArguments(){super.validateArguments()}_value=Fv(this.args.named.value);get value(){return this._value.get()}set value(t){this._value.set(t)}valueDidChange(t){this.value=Av(t)}static{kh(this.prototype,"valueDidChange",[Mu])}change(t){this.valueDidChange(t)}input(t){this.valueDidChange(t)}keyUp(t){switch(t.key){case"Enter":this.listenerFor("enter")(t),this.listenerFor("insert-newline")(t);break;case"Escape":this.listenerFor("escape-press")(t)}}static{kh(this.prototype,"keyUp",[Mu])}listenerFor(t){let e=super.listenerFor(t);return this.isVirtualEventListener(t,e)?function(t){return e=>t(Av(e),e)}(e):e}isVirtualEventListener(t,e){return-1!==["enter","insert-newline","escape-press"].indexOf(t)}}let Nv;if(e){const t=Object.create(null),e=document.createElement("input");t[""]=!1,t.text=!0,t.checkbox=!0,Nv=n=>{let i=t[n];if(void 0===i){try{e.type=n,i=e.type===n}catch(r){i=!1}finally{e.type="text"}t[n]=i}return i}}else Nv=t=>""!==t;class Uv extends jv{static toString(){return"Input"}get class(){return this.isCheckbox?"ember-checkbox ember-view":"ember-text-field ember-view"}get type(){let t=this.named("type");return null==t?"text":Nv(t)?t:"text"}get isCheckbox(){return"checkbox"===this.named("type")}_checked=Fv(this.args.named.checked);get checked(){return this.isCheckbox?this._checked.get():void 0}set checked(t){this._checked.set(t)}change(t){this.isCheckbox?this.checkedDidChange(t):super.change(t)}static{kh(this.prototype,"change",[Mu])}input(t){this.isCheckbox||super.input(t)}static{kh(this.prototype,"input",[Mu])}checkedDidChange(t){let e=t.target;this.checked=e.checked}static{kh(this.prototype,"checkedDidChange",[Mu])}isSupportedArgument(t){return-1!==["type","value","checked","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}}const Bv=Pv(Uv,kv),qv=Qg({id:"7Z3LFeO/",block:'[[[11,3],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[16,"role",[30,0,["role"]]],[16,"title",[30,0,["title"]]],[16,"rel",[30,0,["rel"]]],[16,"tabindex",[30,0,["tabindex"]]],[16,"target",[30,0,["target"]]],[17,1],[16,6,[30,0,["href"]]],[4,[32,0],["click",[30,0,["click"]]],null],[12],[18,2,null],[13]],["&attrs","&default"],["yield"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/link-to.hbs",scope:()=>[xv],isStrictMode:!0}),Vv=[],$v={};function Gv(t){return null==t}function Wv(t){return"object"==typeof t&&null!==t&&!0===t.isQueryParams}class Hv extends Tv{static toString(){return"LinkTo"}static{Sh(this.prototype,"routing",[Uf("-routing")])}#v=void Eh(this,"routing");validateArguments(){super.validateArguments()}get class(){let t="ember-view";return this.isActive?(t+=this.classFor("active"),!1===this.willBeActive&&(t+=" ember-transitioning-out")):this.willBeActive&&(t+=" ember-transitioning-in"),this.isLoading&&(t+=this.classFor("loading")),this.isDisabled&&(t+=this.classFor("disabled")),t}get href(){if(this.isLoading)return"#";let{routing:t,route:e,models:n,query:i}=this;return De(on(t,"currentState")),t.generateURL(e,n,i)}click(t){if(!Au(t))return;let e=t.currentTarget;if(""!==e.target&&"_self"!==e.target)return;if(this.preventDefault(t),this.isDisabled)return;if(this.isLoading)return;let{routing:n,route:i,models:r,query:s,replace:o}=this,a={transition:void 0};ah(0,0,()=>{a.transition=n.transitionTo(i,r,s,o)})}static{kh(this.prototype,"click",[Mu])}get route(){if("route"in this.args.named){let t=this.named("route");return t&&this.namespaceRoute(t)}return this.currentRoute}currentRouteCache=qe(()=>(De(on(this.routing,"currentState")),We(()=>this.routing.currentRouteName)));get currentRoute(){return Ve(this.currentRouteCache)}get models(){return"models"in this.args.named?this.named("models"):"model"in this.args.named?[this.named("model")]:Vv}get query(){return"query"in this.args.named?{...this.named("query")}:$v}get replace(){return!0===this.named("replace")}get isActive(){return this.isActiveForState(this.routing.currentState)}get willBeActive(){let t=this.routing.currentState,e=this.routing.targetState;return t===e?null:this.isActiveForState(e)}get isLoading(){return Gv(this.route)||this.models.some(t=>Gv(t))}get isDisabled(){return Boolean(this.named("disabled"))}get isEngine(){return void 0!==hd(this.owner)}get engineMountPoint(){return this.owner.mountPoint}classFor(t){let e=this.named(`${t}Class`);return!0===e||Gv(e)?` ${t}`:e?` ${e}`:""}namespaceRoute(t){let{engineMountPoint:e}=this;return void 0===e?t:"application"===t?e:`${e}.${t}`}isActiveForState(t){if(!function(t){return!Gv(t)}(t))return!1;if(this.isLoading)return!1;let e=this.named("current-when");if("boolean"==typeof e)return e;if("string"==typeof e){let{models:n,routing:i}=this;return e.split(" ").some(e=>i.isActiveForRoute(n,void 0,this.namespaceRoute(e),t))}{let{route:e,models:n,query:i,routing:r}=this;return r.isActiveForRoute(n,i,e,t)}}preventDefault(t){t.preventDefault()}isSupportedArgument(t){return-1!==["route","model","models","query","replace","disabled","current-when","activeClass","loadingClass","disabledClass"].indexOf(t)||super.isSupportedArgument(t)}}let{prototype:Kv}=Hv,Xv=(t,e)=>t?Object.getOwnPropertyDescriptor(t,e)||Xv(Object.getPrototypeOf(t),e):null;{let t=Kv.onUnsupportedArgument;Object.defineProperty(Kv,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"href"===e||t.call(this,e)}})}{let t=Xv(Kv,"models").get;Object.defineProperty(Kv,"models",{configurable:!0,enumerable:!1,get:function(){let e=t.call(this);return e.length>0&&!("query"in this.args.named)&&Wv(e[e.length-1])&&(e=e.slice(0,-1)),e}});let e=Xv(Kv,"query").get;Object.defineProperty(Kv,"query",{configurable:!0,enumerable:!1,get:function(){if("query"in this.args.named){let t=e.call(this);return Wv(t)?t.values??$v:t}{let e=t.call(this);if(e.length>0){let t=e[e.length-1];if(Wv(t)&&null!==t.values)return t.values}return $v}}})}{let t=Kv.onUnsupportedArgument;Object.defineProperty(Kv,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"params"!==e&&t.call(this,e)}})}const Yv=Pv(Hv,qv),Zv=Qg({id:"KVdeMchh",block:'[[[11,"textarea"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/textarea.hbs",scope:()=>[xv],isStrictMode:!0});class Jv extends jv{static toString(){return"Textarea"}get class(){return"ember-text-area ember-view"}change(t){super.change(t)}static{kh(this.prototype,"change",[Mu])}input(t){super.input(t)}static{kh(this.prototype,"input",[Mu])}isSupportedArgument(t){return-1!==["type","value","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}}const Qv=Pv(Jv,Zv);function tb(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}function eb(t,e){return"attrs"===e[0]&&(e.shift(),1===e.length)?$n(t,e[0]):Gn(t,e)}function nb(t){let e=t.indexOf(":");return-1===e?[t,t,!0]:[t.substring(0,e),t.substring(e+1),!1]}function ib(t,e,n,i){let[r,s,o]=n;if("id"===s){let e=Ss(t,r);null==e&&(e=t.elementId);let n=Pn(e);return void i.setAttribute("id",n,!0,null)}let a=r.indexOf(".")>-1?eb(e,r.split(".")):$n(e,r);i.setAttribute(s,a,!1,null)}function rb(t,e){let n;return zn(()=>{let i=qn(t);return!0===i?n||(n=Af(e)):i||0===i?String(i):null})}function sb(){}class ob{classRef=null;rootRef;argsRevision;constructor(t,e,n,i,r,s){this.component=t,this.args=e,this.argsTag=n,this.finalizer=i,this.hasWrappedElement=r,this.isInteractive=s,this.classRef=null,this.argsRevision=null===e?0:he(n),this.rootRef=Fn(t),Wt(this,()=>this.willDestroy(),!0),Wt(this,()=>this.component.destroy())}willDestroy(){let{component:t,isInteractive:e}=this;if(e){Fe(),t.trigger("willDestroyElement"),t.trigger("willClearRender"),Le();let e=Uu(t);e&&(Vu(e),$u(t))}t.renderer.unregister(t)}finalize(){let{finalizer:t}=this;t(),this.finalizer=sb}}function ab(t){let e=Object.create(null),n=Object.create(null);for(let i in t){let r=t[i],s=qn(r);Bn(r)?e[i]=new cb(r,s):e[i]=s,n[i]=s}return n.attrs=e,n}const lb=Symbol("REF");class cb{value;[Sv];[lb];constructor(t,e){this[Sv]=!0,this[lb]=t,this.value=e}update(t){Vn(this[lb],t)}}const ub=Ct("ARGS"),hb=Ct("HAS_BLOCK"),db=Symbol("DIRTY_TAG"),pb=Symbol("IS_DISPATCHING_ATTRS"),fb=Symbol("BOUNDS"),gb=Pn("ember-view");class mb{templateFor(t){let e,{layout:n,layoutName:i}=t,r=ur(t);if(void 0===n){if(void 0===i)return null;e=r.lookup(`template:${i}`)}else{if("function"!=typeof n)return null;e=n}return tb(e(r)).asWrappedLayout()}getDynamicLayout(t){return this.templateFor(t.component)}getTagName(t){let{component:e,hasWrappedElement:n}=t;return n?e&&e.tagName||"div":null}getCapabilities(){return vb}prepareArgs(t,e){if(e.named.has("__ARGS__")){let{__ARGS__:t,...n}=e.named.capture(),i=qn(t);return{positional:i.positional,named:{...n,...i.named}}}const{positionalParams:n}=t.class??t;if(null==n||0===e.positional.length)return null;let i;if("string"==typeof n){let t=e.positional.capture();i={[n]:zn(()=>gy(t))},Object.assign(i,e.named.capture())}else{if(!(Array.isArray(n)&&n.length>0))return null;{const t=Math.min(n.length,e.positional.length);i={},Object.assign(i,e.named.capture());for(let r=0;r{s.setAttribute("class",Pn(t),!1,null)}),l&&l.length&&l.forEach(t=>{!function(t,e,n){let i=e.split(":"),[r,s,o]=i;if(""===r)n.setAttribute("class",Pn(s),!0,null);else{let e,i=r.indexOf(".")>-1,a=i?r.split("."):[],l=i?eb(t,a):$n(t,r);e=void 0===s?rb(l,i?a[a.length-1]:r):function(t,e,n){return zn(()=>qn(t)?e:n)}(l,s,o),n.setAttribute("class",e,!1,null)}}(i,t,s)}),s.setAttribute("class",gb,!1,null),"ariaRole"in t&&s.setAttribute("role",$n(i,"ariaRole"),!1,null),t._transitionTo("hasElement"),n&&(Fe(),t.trigger("willInsertElement"),Le())}didRenderLayout(t,e){t.component[fb]=e,t.finalize()}didCreate({component:t,isInteractive:e}){e&&(t._transitionTo("inDOM"),t.trigger("didInsertElement"),t.trigger("didRender"))}update(t){let{component:e,args:n,argsTag:i,argsRevision:r,isInteractive:s}=t;if(t.finalizer=ch("render.component",_b,e),Fe(),null!==n&&!de(i,r)){Oe();let r=ab(n);i=t.argsTag=Ae(),t.argsRevision=he(i),e[pb]=!0,e.setProperties(r),e[pb]=!1,e.trigger("didUpdateAttrs"),e.trigger("didReceiveAttrs")}s&&(e.trigger("willUpdate"),e.trigger("willRender")),Le(),De(i),De(e[db])}didUpdateLayout(t){t.finalize()}didUpdate({component:t,isInteractive:e}){e&&(t.trigger("didUpdate"),t.trigger("didRender"))}getDestroyable(t){return t}}function yb(t){return t.instrumentDetails({initialRender:!0})}function _b(t){return t.instrumentDetails({initialRender:!1})}const vb={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!0,createArgs:!0,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!0,hasSubOwner:!1},bb=new mb;function wb(t){return t===bb}let xb=new WeakMap;const Sb=Object.freeze([]);class Cb extends(Mh.extend(nc,Ih,{didReceiveAttrs(){},didRender(){},didUpdate(){},didUpdateAttrs(){},willRender(){},willUpdate(){}},{concatenatedProperties:["attributeBindings","classNames","classNameBindings"],classNames:Sb,classNameBindings:Sb})){isComponent=!0;init(t){super.init(t),this._superRerender=this.rerender,this.rerender=this._rerender,this[pb]=!1,this[db]=ye(),this[fb]=null;const e=this._dispatcher;if(e){let t=xb.get(e);t||(t=new WeakSet,xb.set(e,t));let n=Object.getPrototypeOf(this);t.has(n)||(e.lazyEvents.forEach((t,n)=>{null!==t&&"function"==typeof this[t]&&e.setupHandlerForBrowserEvent(n)}),t.add(n))}this.elementId||""===this.tagName||(this.elementId=et(this))}__dispatcher;get _dispatcher(){if(void 0===this.__dispatcher){let t=ur(this);if(t.lookup("-environment:main").isInteractive){let e=t.lookup("event_dispatcher:main");this.__dispatcher=e}else this.__dispatcher=null}return this.__dispatcher}on(t,e,n){return this._dispatcher?.setupHandlerForEmberEvent(t),super.on(t,e,n)}_rerender(){ge(this[db]),this._superRerender()}[is](t,e){if(this[pb])return;let n=this[ub],i=void 0!==n?n[t]:void 0;void 0!==i&&Bn(i)&&Vn(i,2===arguments.length?e:Ss(this,t))}getAttr(t){return this.get(t)}readDOMAttr(t){let e=Uu(this),n="http://www.w3.org/2000/svg"===e.namespaceURI,{type:i,normalized:r}=Yy(e,t);return n||"attr"===i?e.getAttribute(r):e[r]}get childViews(){return Wu(this)}static{kh(this.prototype,"childViews",[Sr({configurable:!1,enumerable:!1})])}appendChild(t){Hu(this,t)}_transitionTo(t){let e=this._currentState,n=this._currentState=this._states[t];this._state=t,e&&e.exit&&e.exit(this),n.enter&&n.enter(this)}nearestOfType(t){let e=this.parentView;for(;e;){if(t.detect(e.constructor))return e;e=e.parentView}}nearestWithProperty(t){let e=this.parentView;for(;e;){if(t in e)return e;e=e.parentView}}rerender(){return this._currentState.rerender(this)}get element(){return this.renderer.getElement(this)}static{kh(this.prototype,"element",[Sr({configurable:!1,enumerable:!1})])}appendTo(t){let n;return n=e&&"string"==typeof t?document.querySelector(t):t,this.renderer.appendTo(this,n),this}append(){return this.appendTo(document.body)}willInsertElement(){return this}didInsertElement(){return this}willClearRender(){return this}destroy(){return super.destroy(),this._currentState.destroy(this),this}willDestroyElement(){return this}didDestroyElement(){return this}parentViewDidChange(){return this}handleEvent(t,e){return this._currentState.handleEvent(this,t,e)}static isComponentFactory=!0;static toString(){return"@ember/component"}}Cb.reopenClass({positionalParams:[]}),Fi(bb,Cb);const kb=Symbol("RECOMPUTE_TAG"),Eb=Symbol("IS_CLASSIC_HELPER");class Tb extends nh{static isHelperFactory=!0;static[Eb]=!0;static helper=Ob;init(t){super.init(t),this[kb]=ye()}recompute(){ya(()=>ge(this[kb]))}}class Rb{capabilities=_i(0,{hasValue:!0,hasDestroyable:!0});ownerInjection;constructor(t){let e={};hr(e,t),this.ownerInjection=e}createHelper(t,e){var n;return{instance:null!=(n=t)&&"class"in n?t.create():t.create(this.ownerInjection),args:e}}getDestroyable({instance:t}){return t}getValue({instance:t,args:e}){let{positional:n,named:i}=e,r=t.compute(n,i);return De(t[kb]),r}getDebugName(t){return nt((t.class||t).prototype)}}Ki(t=>new Rb(t),Tb);const Pb=Ai(Tb);class Mb{isHelperFactory=!0;constructor(t){this.compute=t}create(){return{compute:this.compute}}}const Ib=new class{capabilities=_i(0,{hasValue:!0});createHelper(t,e){return()=>t.compute.call(null,e.positional,e.named)}getValue(t){return t()}getDebugName(t){return nt(t.compute)}};function Ob(t){return new Mb(t)}Ki(()=>Ib,Mb.prototype);class Ab{__string;constructor(t){this.__string=t}toString(){return`${this.__string}`}toHTML(){return this.toString()}}const Fb=function(t){return null==t?t="":"string"!=typeof t&&(t=String(t)),new Ab(t)};function Lb(t){return{object:`${t.name}:main`}}const zb={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Db=fi(zb),jb=new class{create(t,e,n,i,r){let s=r.get("outletState"),o=e.ref;r.set("outletState",o);let a={finalize:ch("render.outlet",Lb,e)};if(void 0!==i.debugRenderTree){let t=qn(s),e=t?.render?.owner,n=qn(o),i=n?.render?.owner;if(e&&e!==i){let{mountPoint:t}=i;t&&(a.engine={mountPoint:t,instance:i})}}return a}getDebugName({name:t}){return`{{outlet}} for ${t}`}getDebugCustomRenderTree(t,e){let n=[];return n.push({bucket:e,type:"outlet",name:"main",args:xy,instance:void 0,template:void 0}),e.engine&&n.push({bucket:e.engine,type:"engine",name:e.engine.mountPoint,args:xy,instance:e.engine.instance,template:void 0}),n}getCapabilities(){return zb}getSelf(){return Mn}didCreate(){}didUpdate(){}didRenderLayout(t){t.finalize()}didUpdateLayout(){}getDestroyable(){return null}},Nb=Qg({id:"Hacwyo/Q",block:'[[[8,[30,1],null,[["@controller","@model"],[[30,2],[30,3]]],null]],["@Component","@controller","@model"],[]]',moduleName:"/home/runner/work/ember.js/ember.js/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts",isStrictMode:!0});class Ub{handle=-1;resolvedName=null;manager=jb;capabilities=Db;compilable;constructor(t,e){this.state=e,this.compilable=tb(Nb(t)).asLayout()}}class Bb extends mb{component;constructor(t){super(),this.component=t}create(t,e,n,{isInteractive:i},r){let s=this.component,o=ch("render.component",yb,s);r.view=s;let a=""!==s.tagName;a||(i&&s.trigger("willRender"),s._transitionTo("hasElement"),i&&s.trigger("willInsertElement"));let l=new ob(s,null,ve,o,a,i);return De(s[db]),l}}const qb={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!1,createArgs:!1,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!1,hasSubOwner:!1};class Vb{handle=-1;resolvedName="-top-level";state;manager;capabilities=fi(qb);compilable=null;constructor(t){this.manager=new Bb(t);let e=bl(t);this.state=e}}function $b(t){return Ii(t,{})}class Gb{constructor(t){this.inner=t}}const Wb=$b(({positional:t})=>{const e=t[0];return zn(()=>{let t=qn(e);return De(gr(t)),er(t)&&(t=Yl(t)),new Gb(t)})});class Hb{position=0;constructor(t){this.length=t}isEmpty(){return!1}memoFor(t){return t}next(){let{length:t,position:e}=this;if(e>=t)return null;let n=this.valueFor(e),i=this.memoFor(e);return this.position++,{value:n,memo:i}}}class Kb extends Hb{static from(t){return t.length>0?new this(t):null}static fromForEachable(t){let e=[];return t.forEach(t=>e.push(t)),this.from(e)}constructor(t){super(t.length),this.array=t}valueFor(t){return this.array[t]}}class Xb extends Hb{static from(t){return t.length>0?new this(t):null}constructor(t){super(t.length),this.array=t}valueFor(t){return dr(this.array,t)}}class Yb extends Hb{static fromIndexable(t){let e=Object.keys(t);if(0===e.length)return null;{let n=[];for(let i of e){let e;e=t[i],ze()&&(De(on(t,i)),Array.isArray(e)&&De(on(e,"[]"))),n.push(e)}return new this(e,n)}}static fromForEachable(t){let e=[],n=[],i=0,r=!1;return t.forEach(function(t,s){r=r||arguments.length>=2,r&&e.push(s),n.push(t),i++}),0===i?null:r?new this(e,n):new Kb(n)}constructor(t,e){super(e.length),this.keys=t,this.values=e}valueFor(t){return this.values[t]}memoFor(t){return this.keys[t]}}class Zb{static from(t){let e=t[Symbol.iterator](),n=e.next(),{done:i}=n;return i?null:new this(e,n)}position=0;constructor(t,e){this.iterable=t,this.result=e}isEmpty(){return!1}next(){let{iterable:t,result:e,position:n}=this;if(e.done)return null;let i=this.valueFor(e,n),r=this.memoFor(e,n);return this.position++,this.result=t.next(),{value:i,memo:r}}}class Jb extends Zb{valueFor(t){return t.value}memoFor(t,e){return e}}class Qb extends Zb{valueFor(t){return t.value[1]}memoFor(t){return t.value[0]}}function tw(t){return null!=t&&"function"==typeof t.forEach}function ew(t){return null!=t&&"function"==typeof t[Symbol.iterator]}var nw;nw={scheduleRevalidate(){ga.ensureInstance()},toBool:function(t){return er(t)?(De(fr(t,"content")),Boolean(Ss(t,"isTruthy"))):Yh(t)?(De(fr(t,"[]")),0!==t.length):null!==(e=t)&&"object"==typeof e&&"function"==typeof e.toHTML?Boolean(t.toString()):Boolean(t);var e},toIterator:function(t){return t instanceof Gb?function(t){return function(t){return null!==t&&("object"==typeof t||"function"==typeof t)}(t)?Array.isArray(t)||rr(t)?Yb.fromIndexable(t):ew(t)?Qb.from(t):tw(t)?Yb.fromForEachable(t):Yb.fromIndexable(t):null}(t.inner):function(t){return H(t)?Array.isArray(t)?Kb.from(t):rr(t)?Xb.from(t):ew(t)?Jb.from(t):tw(t)?Kb.fromForEachable(t):null:null}(t)},getProp:Cs,setProp:zs,getPath:Ss,setPath:Ls,scheduleDestroy(t,e){va("actions",null,e,t)},scheduleDestroyed(t){va("destroy",null,t)}},Nt=nw.scheduleRevalidate,Pt=nw.scheduleDestroy,Mt=nw.scheduleDestroyed,It=nw.toIterator,Ot=nw.toBool,At=nw.getProp,Ft=nw.setProp,Lt=nw.getPath,zt=nw.setPath;class iw{enableDebugTooling=g._DEBUG_RENDER_TREE;constructor(t,e){this.owner=t,this.isInteractive=e}onTransactionCommit(){}}const rw=$b(({positional:t,named:e})=>{const n=t[0];let i=e.type,r=e.loc,s=e.original;return qn(i),qn(r),qn(s),zn(()=>qn(n))});let sw;sw=t=>t.positional[0];const ow=$b(sw),aw=$b(({positional:t})=>zn(()=>{let e=t[0],n=t[1],i=qn(e).split("."),r=i[i.length-1],s=qn(n);return!0===s?Af(r):s||0===s?String(s):""})),lw=$b(({positional:t},e)=>{let n=qn(t[0]);return Fn(e.factoryFor(n)?.class)}),cw=$b(({positional:t})=>{const e=t[0];return zn(()=>{let t=qn(e);return H(t)&&De(fr(t,"[]")),t})}),uw=$b(({positional:t})=>Nn(t[0])),hw=$b(({positional:t})=>Dn(t[0])),dw=$b(({positional:t,named:e})=>Ln(qn(t[0]))),pw=$b(()=>Fn(([3e7]+-1e3+-4e3+-2e3+-1e11).replace(/[0-3]/g,t=>(4*t^16*Math.random()>>(2&t)).toString(16)))),fw={dynamicLayout:!0,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!0},gw=new class{getDynamicLayout(t){return tb(t.engine.lookup("template:application")(t.engine)).asLayout()}getCapabilities(){return fw}getOwner(t){return t.engine}create(t,{name:e},n,i){let r=t.buildChildEngineInstance(e);r.boot();let s,o,a,l,c=r.factoryFor("controller:application")||hp(r,"application");if(n.named.has("model")&&(l=n.named.get("model")),void 0===l)s=c.create(),o=Fn(s),a={engine:r,controller:s,self:o,modelRef:l};else{let t=qn(l);s=c.create({model:t}),o=Fn(s),a={engine:r,controller:s,self:o,modelRef:l}}return i.debugRenderTree&&Gt(r,s),a}getDebugName({name:t}){return t}getDebugCustomRenderTree(t,e,n,i){return[{bucket:e.engine,instance:e.engine,type:"engine",name:t.name,args:n},{bucket:e.controller,instance:e.controller,type:"route-template",name:"application",args:n,template:i}]}getSelf({self:t}){return t}getDestroyable(t){return t.engine}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}update(t){let{controller:e,modelRef:n}=t;void 0!==n&&e.set("model",qn(n))}};class mw{handle=-1;state;manager=gw;compilable=null;capabilities=fi(fw);constructor(t){this.resolvedName=t,this.state={name:t}}}const yw=$b((t,e)=>{let n,i,r,s=t.positional[0];return n=py(t.named,wy),zn(()=>{let t=qn(s);return"string"==typeof t?(i===t||(i=t,r=Tm(0,new mw(t),e,n,!0)),r):(r=null,i=null,null)})}),_w={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},vw=fi(_w),bw=new class{create(t,e,n){let i=n.named.get("controller");return{self:i,controller:qn(i)}}getSelf({self:t}){return t}getDebugName({name:t}){return`route-template (${t})`}getDebugCustomRenderTree({name:t,templateName:e},n,i){return[{bucket:n,type:"route-template",name:t,args:i,instance:n.controller,template:e}]}getCapabilities(){return _w}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}getDestroyable(){return null}};class ww{handle=-1;resolvedName;state;manager=bw;capabilities=vw;compilable;constructor(t,e){let n=tb(e);this.resolvedName=t,this.state={name:t,templateName:n.moduleName},this.compilable=n.asLayout()}}function xw(t,e,n){return Tm(0,new ww(e,n),t,null,!0)}const Sw=$b((t,e,n)=>{let i=zn(()=>{let t=qn(n.get("outletState"));return t?.outlets?.main}),r=null,s=null;return zn(()=>{let t=qn(i),n=function(t,e){if(void 0===e)return null;let n=e.render;if(void 0===n)return null;let i=n.template;return null==i?null:{ref:t,name:n.name,template:i,controller:n.controller}}(i,t);if(!function(t,e){return null!==t&&null!==e&&t.template===e.template&&t.controller===e.controller}(n,r))if(r=n,null!==n){let o,a=t?.render?.owner??e,l=_n(),c=n.template;o=zi(c)?c:xw(a,n.name,c),l.Component=Fn(o),l.controller=Fn(n.controller);let u=Gn(i,["render","model"]),h=qn(u);l.model=zn(()=>(r===n&&(h=qn(u)),h));let d=py(l,wy);s=Tm(0,new Ub(e,n),a,d,!0)}else s=null;return s})});function Cw(t){return{object:`component:${t}`}}const kw={mut:uw,readonly:hw,unbound:dw,"-hash":u_,"-each-in":Wb,"-normalize-class":aw,"-resolve":lw,"-track-array":cw,"-mount":yw,"-outlet":Sw,"-in-el-null":ow},Ew={...kw,array:s_,concat:a_,fn:l_,get:c_,hash:u_,"unique-id":pw};Ew["-disallow-dynamic-resolution"]=rw;const Tw={},Rw={...Tw,on:__};class Pw{componentDefinitionCache=new Map;lookupPartial(){return null}lookupHelper(t,e){let n=Ew[t];if(void 0!==n)return n;let i=e.factoryFor(`helper:${t}`);if(void 0===i)return null;let r=i.class;return void 0===r?null:"function"==typeof r&&!0===r[Eb]?(Ii(Pb,i),i):r}lookupBuiltInHelper(t){return kw[t]??null}lookupModifier(t,e){let n=Rw[t];if(void 0!==n)return n;let i=e.factoryFor(`modifier:${t}`);return void 0===i?null:i.class||null}lookupBuiltInModifier(t){return Tw[t]??null}lookupComponent(t,e){let n=function(t,e){let n=function(t,e){let n=`component:${t}`;return e.factoryFor(n)||null}(e,t);if(null!=(i=n)&&"function"==typeof i.create&&n.class){let t=Ji(n.class);if(void 0!==t)return{component:n,layout:t}}var i;return null===n?null:{component:n,layout:null}}(e,t);if(null===n)return null;let i,r=null;i=null===n.component?r=n.layout(e):n.component;let s=this.componentDefinitionCache.get(i);if(void 0!==s)return s;null===r&&null!==n.layout&&(r=n.layout(e));let o=ch("render.getComponentDefinition",Cw,t),a=null;if(null===n.component)a={state:zy(void 0,t),manager:Fy,template:r};else{let t=n.component,e=t.class,i=Li(e);a={state:wb(i)?t:e,manager:i,template:r}}return o(),this.componentDefinitionCache.set(i,a),a}}const Mw="-top-level";class Iw{static extend(t){return class extends Iw{static create(e){return e?super.create(Object.assign({},t,e)):super.create(t)}}}static reopenClass(t){Object.assign(this,t)}static create(t){let{environment:e,application:n,template:i}=t,r=ur(t),s=i(r);return new Iw(e,r,s,n)}ref;state;constructor(t,e,n,i){this._environment=t,this.owner=e,this.template=n,this.namespace=i;let r=ye(),s={outlets:{main:void 0},render:{owner:e,name:Mw,controller:void 0,model:void 0,template:n}},o=this.ref=zn(()=>(De(r),s),t=>{ge(r),s.outlets.main=t});this.state={ref:o,name:Mw,template:n,controller:void 0}}appendTo(t){let e;e=this._environment.hasDOM&&"string"==typeof t?document.querySelector(t):t,va("render",this.owner.lookup("renderer:-dom"),"appendOutletView",this,e)}rerender(){}setOutletState(t){Vn(this.ref,t)}destroy(){}}class Ow{constructor(t,e){this.view=t,this.outletState=e}child(){return new Ow(this.view,this.outletState)}get(t){return this.outletState}set(t,e){return this.outletState=e,e}}const Aw=()=>{};class Fw{type="component";#b;#w;constructor(t,e,n){this.#w=()=>{let i=lv(t.context,t.builder(t.env,n.into),t.owner,e,n?.args),r=this.#b=i.sync();Gt(this,this.#b),this.#w=()=>{if(!Xt(r)&&!Yt(r))return r.rerender({alwaysRevalidate:!1})}}}isFor(t){return!1}render(){this.#w()}destroy(){Ht(this)}get destroyed(){return Yt(this)}get result(){return this.#b}}class Lw{type="classic";id;result;destroyed;render;env;constructor(t,e,n,i,r,s,o,a){this.root=t,this.id=t instanceof Iw?et(t):zu(t),this.result=void 0,this.destroyed=!1,this.env=e.env,this.render=()=>{let t=tb(i).asLayout(),l=av(e,n,r,a(e.env,{element:s,nextSibling:null}),t,o),c=this.result=l.sync();Gt(n,c),this.render=()=>{if(!Xt(c)&&!Yt(c))return c.rerender({alwaysRevalidate:!1})}}}isFor(t){return this.root===t}destroy(){let{result:t,env:e}=this;this.destroyed=!0,this.root=null,this.result=void 0,this.render=void 0,void 0!==t&&n_(e,()=>Ht(t))}}const zw=[];function Dw(t){let e=zw.indexOf(t);zw.splice(e,1)}let jw=null,Nw=0;ga.on("begin",function(){for(let t of zw)t.rerender()}),ga.on("end",function(){for(let t of zw)if(!t.isValid()){if(Nw>g._RERENDER_LOOP_LIMIT)throw Nw=0,t.destroy(),new Error("infinite rendering invalidation detected");return Nw++,ga.join(null,Aw)}Nw=0,function(){if(null!==jw){let t=jw.resolve;jw=null,ga.join(null,t)}}()});class Uw{static create(t,e){const n=new Uw(t,e);return Gt(e,n),n}#x;#S=-1;#C=!1;#k=!1;#E=[];#T=[];constructor(t,e){this.#x=t,Wt(this,()=>{this.clearAllRoots(e)})}get debug(){return{roots:this.#E,inRenderTransaction:this.#C,isInteractive:this.isInteractive}}get roots(){return this.#E}get owner(){return this.#x.owner}get builder(){return this.#x.builder}get context(){return this.#x.context}get env(){return this.context.env}get isInteractive(){return this.#x.context.env.isInteractive}renderRoot(t,e){let n=this.#E;return n.push(t),Gt(this,t),1===n.length&&function(t){zw.push(t)}(e),this.#R(e),t}#R(t){if(this.#C)return;this.#C=!0;let e=!1;try{this.renderRoots(t),e=!0}finally{e||(this.#S=he(Ce)),this.#C=!1}}renderRoots(t){let e,n=this.#E,i=this.#T;do{e=n.length,n_(this.context.env,()=>{for(let t=0;t=e||r.render()}this.#S=he(Ce)})}while(n.length>e);for(;i.length;){let t=i.pop(),e=n.indexOf(t);n.splice(e,1)}0===this.#E.length&&Dw(t)}scheduleRevalidate(t){ga.scheduleOnce("render",this,this.revalidate,t)}isValid(){return this.#k||0===this.#E.length||de(Ce,this.#S)}revalidate(t){this.isValid()||this.#R(t)}clearAllRoots(t){let e=this.#E;for(let n of e)Ht(n);this.#T.length=0,this.#E=[],e.length&&Dw(t)}}class Bw{static strict(t,n,i){return new Bw(t,{hasDOM:e,...i},n,new Pw,K_)}state;constructor(t,e,n,i,r){let s={constants:new om,heap:new lm},o=e_({document:n},new iw(t,e.isInteractive),s,i),a=new Xg(s,t=>new am(t),o);this.state=Uw.create({owner:t,context:a,builder:r},this)}get debugRenderTree(){let{debugRenderTree:t}=this.state.env;return t}isValid(){return this.state.isValid()}destroy(){Ht(this)}render(t,e){const n=new Fw(this.state,t,{args:e.args,into:(i=e.into,"element"in i?i:{element:i,nextSibling:null})});var i;return this.state.renderRoot(n,this)}rerender(){this.state.scheduleRevalidate(this)}}class qw extends Bw{static strict(t,n,i){return new Bw(t,{hasDOM:e,...i},n,new Pw,K_)}_rootTemplate;_viewRegistry;static create(t){let{_viewRegistry:e}=t,n=ur(t),i=n.lookup("service:-document"),r=n.lookup("-environment:main"),s=n.lookup(Tl`template:-root`),o=n.lookup("service:-dom-builder");return new this(n,i,r,s,e,o)}constructor(t,e,n,i,r,s=K_,o=new Pw){super(t,n,e,o,s),this._rootTemplate=i(t),this._viewRegistry=r||t.lookup("-view-registry:main")}appendOutletView(t,e){let n=new Ub((i=t).owner,i.state);var i;let{name:r,template:s}=t.state,o=_n();o.Component=Fn(xw(t.owner,r,s)),o.controller=Mn,o.model=Mn;let a=py(o,wy);this._appendDefinition(t,Tm(0,n,t.owner,a,!0),e)}appendTo(t,e){let n=new Vb(t);this._appendDefinition(t,Tm(0,n,this.state.owner,null,!0),e)}_appendDefinition(t,e,n){let i=Fn(e),r=new Ow(null,Mn),s=new Lw(t,this.state.context,this.state.owner,this._rootTemplate,i,n,r,this.state.builder);this.state.renderRoot(s,this)}cleanupRootFor(t){if(Yt(this))return;let e=this.state.roots,n=e.length;for(;n--;){let i=e[n];"classic"===i.type&&i.isFor(t)&&(i.destroy(),e.splice(n,1))}}remove(t){t._transitionTo("destroying"),this.cleanupRootFor(t),this.state.isInteractive&&t.trigger("didDestroyElement")}get _roots(){return this.state.debug.roots}get _inRenderTransaction(){return this.state.debug.inRenderTransaction}get _isInteractive(){return this.state.debug.isInteractive}get _context(){return this.state.context}register(t){let e=zu(t);this._viewRegistry[e]=t}unregister(t){delete this._viewRegistry[zu(t)]}getElement(t){if(this._isInteractive)return Uu(t);throw new Error("Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).")}getBounds(t){let e=t[fb];return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}}const Vw=Qg({id:"tiXbzL5t",block:'[[[46,[28,[32,0],null,null],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/outlet.hbs",scope:()=>[Sw],isStrictMode:!0});class $w extends dd{rootElement=null;init(t){super.init(t),this.application._watchInstance(this),this.register("-application-instance:main",this,{instantiate:!1})}_bootSync(t){return this._booted||(t=new Gw(t),this.setupRegistry(t),t.rootElement?this.rootElement=t.rootElement:this.rootElement=this.application.rootElement,t.location&&Ls(this.router,"location",t.location),this.application.runInstanceInitializers(this),t.isInteractive&&this.setupEventDispatcher(),this._booted=!0),this}setupRegistry(t){this.constructor.setupRegistry(this.__registry__,t)}_router;get router(){if(!this._router){let t=this.lookup("router:main");this._router=t}return this._router}didCreateRootView(t){t.appendTo(this.rootElement)}startRouting(){this.router.startRouting()}setupRouter(){this.router.setupRouter()}handleURL(t){return this.setupRouter(),this.router.handleURL(t)}setupEventDispatcher(){let t=this.lookup("event_dispatcher:main"),e=Ss(this.application,"customEvents"),n=Ss(this,"customEvents"),i=Object.assign({},e,n);return t.setup(i,this.rootElement),t}getURL(){return this.router.url}visit(t){this.setupRouter();let e=this.__container__.lookup("-environment:main"),n=this.router,i=()=>e.options.shouldRender?(null===jw&&(jw=uu.defer(),da()||ga.schedule("actions",null,Aw)),jw.promise).then(()=>this):this,r=t=>{if(t.error&&t.error instanceof Error)throw t.error;if("TransitionAborted"===t.name&&n._routerMicrolib.activeTransition)return n._routerMicrolib.activeTransition.then(i,r);throw"TransitionAborted"===t.name?new Error(t.message):t},s=Ss(n,"location");return s.setURL(t),n.handleURL(s.getURL()).then(i,r)}willDestroy(){super.willDestroy(),this.application._unwatchInstance(this)}static setupRegistry(t,e={}){let n=e instanceof Gw?e:new Gw(e);t.register("-environment:main",n.toEnvironment(),{instantiate:!1}),t.register("service:-document",n.document,{instantiate:!1}),super.setupRegistry(t,n)}}class Gw{isInteractive;_renderMode;isBrowser;location=null;shouldRender;document;rootElement;constructor(t={}){this.isInteractive=Boolean(e),this._renderMode=t._renderMode,void 0!==t.isBrowser?this.isBrowser=Boolean(t.isBrowser):this.isBrowser=Boolean(e),this.isBrowser||(this.isInteractive=!1,this.location="none"),void 0!==t.shouldRender?this.shouldRender=Boolean(t.shouldRender):this.shouldRender=!0,this.shouldRender||(this.isInteractive=!1),t.document?this.document=t.document:this.document="undefined"!=typeof document?document:null,t.rootElement&&(this.rootElement=t.rootElement),void 0!==t.location&&(this.location=t.location),void 0!==t.isInteractive&&(this.isInteractive=Boolean(t.isInteractive))}toEnvironment(){return{...l,hasDOM:this.isBrowser,isInteractive:this.isInteractive,_renderMode:this._renderMode,options:this}}}function Ww(t,e){return null!=t&&"function"==typeof t[e]}class Hw extends Tu{static NAMESPACES=ao;static NAMESPACES_BY_ID=lo;static processAll=go;static byName=po;init(t){super.init(t),co(this)}toString(){let t=Ss(this,"name")||Ss(this,"modulePrefix");if(t)return t;ho();let e=no(this);return void 0===e&&(e=et(this),eo(this,e)),e}nameClasses(){fo(this)}destroy(){return uo(this),super.destroy()}}Hw.prototype.isNamespace=!0;const Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Hw},Symbol.toStringTag,{value:"Module"}));var Xw=function(){function t(){this._vertices=new Yw}return t.prototype.add=function(t,e,n,i){if(!t)throw new Error("argument `key` is required");var r=this._vertices,s=r.add(t);if(s.val=e,n)if("string"==typeof n)r.addEdge(s,r.add(n));else for(var o=0;o0){var i="cycle detected: "+e;throw this.each(this.path,function(t){i+=" <- "+t}),new Error(i)}}},t.prototype.reset=function(){this.stack.length=0,this.path.length=0,this.result.length=0;for(var t=0,e=this.length;t=0){var a=this[o];if(a.flag)continue;if(a.flag=!0,r.push(o),e===a.key)break;i.push(~o),this.pushIncoming(a)}else r.pop(),s.push(~o)}},t.prototype.pushIncoming=function(t){for(var e=this.stack,n=t.length-1;n>=0;n--){var i=t[n];this[i].flag||e.push(i)}},t.prototype.each=function(t,e){for(var n=0,i=t.length;n{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.test(e)&&"class"===Fh(t[e])&&n.push(Af(e.replace(i,"")))}),n}}class Qw extends Tu{componentFor(t,e){let n=`component:${t}`;return e.factoryFor(n)}layoutFor(t,e,n){let i=`template:components/${t}`;return e.lookup(i,n)}}const tx=new WeakMap;class ex extends V_{__openBlock(){let{tagName:t}=this.element;if("TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=this.serializeBlockDepth++;this.__appendComment(`%+b:${t}%`)}super.__openBlock()}__closeBlock(){let{tagName:t}=this.element;if(super.__closeBlock(),"TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=--this.serializeBlockDepth;this.__appendComment(`%-b:${t}%`)}}__appendHTML(t){let{tagName:e}=this.element;if("TITLE"===e||"SCRIPT"===e||"STYLE"===e)return super.__appendHTML(t);let n=this.__appendComment("%glmr%");if("TABLE"===e){let e=t.indexOf("<");e>-1&&"tr"===t.slice(e+1,e+3)&&(t=`${t}`)}""===t?this.__appendComment("% %"):super.__appendHTML(t);let i=this.__appendComment("%glmr%");return new Im(this.element,n,i)}__appendText(t){let{tagName:e}=this.element,n=function(t){let{element:e,nextSibling:n}=t;return null===n?e.lastChild:n.previousSibling}(this);return"TITLE"===e||"SCRIPT"===e||"STYLE"===e?super.__appendText(t):""===t?this.__appendComment("% %"):(n&&3===n.nodeType&&this.__appendComment("%|%"),super.__appendText(t))}closeElement(){return tx.has(this.element)&&(tx.delete(this.element),super.closeElement()),super.closeElement()}openElement(t){return"tr"===t&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),tx.set(this.constructing,!0),this.flushElement(null)),super.openElement(t)}pushRemoteElement(t,e,n=null){let{dom:i}=this,r=i.createElement("script");return r.setAttribute("glmr",e),i.insertBefore(t,r,n),super.pushRemoteElement(t,e,n)}constructor(...t){super(...t),this.serializeBlockDepth=0}}function nx(t,e){return ex.forInitialRender(t,e)}function ix(t){t.register("service:-dom-builder",{create(t){switch(ur(t).lookup("-environment:main")._renderMode){case"serialize":return nx.bind(null);case"rehydrate":return bv.bind(null);default:return K_.bind(null)}}}),t.register(Tl`template:-root`,Cv),t.register("renderer:-dom",qw)}class rx extends(Hw.extend(Gl)){static initializers=Object.create(null);static instanceInitializers=Object.create(null);static initializer=ox("initializers");static instanceInitializer=ox("instanceInitializers");static buildRegistry(t){let e=new Cl({resolver:sx(t)});return e.set=Ls,e.register("application:main",t,{instantiate:!1}),function(t){t.optionsForType("component",{singleton:!1}),t.optionsForType("view",{singleton:!1}),t.register("controller:basic",ad,{instantiate:!1}),t.register("service:-routing",Wf),t.register("resolver-for-debugging:main",t.resolver,{instantiate:!1}),t.register("container-debug-adapter:main",Jw),t.register("component-lookup:main",Qw)}(e),function(t){t.optionsForType("template",{instantiate:!1}),t.register("view:-outlet",Iw),t.register("template:-outlet",Vw),t.optionsForType("helper",{instantiate:!1}),t.register("component:input",Bv),t.register("component:link-to",Yv),t.register("component:textarea",Qv)}(e),e}init(t){super.init(t),this.buildRegistry()}_initializersRan=!1;ensureInitializers(){this._initializersRan||(this.runInitializers(),this._initializersRan=!0)}buildInstance(t={}){return this.ensureInitializers(),dd.create({...t,base:this})}buildRegistry(){return this.__registry__=this.constructor.buildRegistry(this)}initializer(t){this.constructor.initializer(t)}instanceInitializer(t){this.constructor.instanceInitializer(t)}runInitializers(){this._runInitializer("initializers",(t,e)=>{e.initialize(this)})}runInstanceInitializers(t){this._runInitializer("instanceInitializers",(e,n)=>{n.initialize(t)})}_runInitializer(t,e){let n,i=Ss(this.constructor,t),r=function(t){let e=[];for(let n in t)e.push(n);return e}(i),s=new Xw;for(let o of r)n=i[o],s.add(n.name,n,n.before,n.after);s.topsort(e)}}function sx(t){let e={namespace:t};return t.Resolver.create(e)}function ox(t){return function(e){let n=this.superclass;if(void 0!==n[t]&&n[t]===this[t]){let e={[t]:Object.create(this[t])};this.reopenClass(e)}this[t][e.name]=e}}const ax=sl,lx=hr;class cx extends rx{static buildRegistry(t){let e=super.buildRegistry(t);return function(t){t.register("router:main",sf),t.register("-view-registry:main",{create:()=>al(null)}),t.register("route:basic",Sp),t.register("event_dispatcher:main",Qu),t.register("location:hash",yf),t.register("location:history",bf),t.register("location:none",wf),t.register(Tl`-bucket-cache:main`,{create:()=>new Mp}),t.register("service:router",Gf)}(e),ix(e),e}static initializer=ox("initializers");static instanceInitializer=ox("instanceInitializers");init(t){super.init(t),this.rootElement??="body",this._document??=null,this.eventDispatcher??=null,this.customEvents??=null,this.autoboot??=!0,this._document??=e?window.document:null,this._globalsMode??=!0,this._readinessDeferrals=1,this._booted=!1,this._applicationInstances=new Set,this.autoboot=this._globalsMode=Boolean(this.autoboot),this._globalsMode&&this._prepareForGlobalsMode(),this.autoboot&&this.waitForDOMReady()}buildInstance(t={}){return $w.create({...t,base:this,application:this})}_watchInstance(t){this._applicationInstances.add(t)}_unwatchInstance(t){return this._applicationInstances.delete(t)}Router;_prepareForGlobalsMode(){this.Router=(this.Router||sf).extend(),this._buildDeprecatedInstance()}__deprecatedInstance__;__container__;_buildDeprecatedInstance(){let t=this.buildInstance();this.__deprecatedInstance__=t,this.__container__=t.__container__}waitForDOMReady(){const t=this._document;if(null===t||"loading"!==t.readyState)va("actions",this,this.domReady);else{let e=()=>{t.removeEventListener("DOMContentLoaded",e),ma(this,this.domReady)};t.addEventListener("DOMContentLoaded",e)}}domReady(){this.isDestroying||this.isDestroyed||this._bootSync()}deferReadiness(){this._readinessDeferrals++}advanceReadiness(){this._readinessDeferrals--,0===this._readinessDeferrals&&ba(this,this.didBecomeReady)}_bootPromise=null;boot(){if(this._bootPromise)return this._bootPromise;try{this._bootSync()}catch(t){}return this._bootPromise}_bootResolver=null;_bootSync(){if(this._booted||this.isDestroying||this.isDestroyed)return;let t=this._bootResolver=hu.defer();this._bootPromise=t.promise;try{this.runInitializers(),dl("application",this),this.advanceReadiness()}catch(zj){throw t.reject(zj),zj}}reset(){let t=this.__deprecatedInstance__;this._readinessDeferrals=1,this._bootPromise=null,this._bootResolver=null,this._booted=!1,ya(this,function(){ma(t,"destroy"),this._buildDeprecatedInstance(),va("actions",this,"_bootSync")})}didBecomeReady(){if(!this.isDestroying&&!this.isDestroyed)try{if(this.autoboot){let t;t=this._globalsMode?this.__deprecatedInstance__:this.buildInstance(),t._bootSync(),this.ready(),t.startRouting()}this._bootResolver.resolve(this),this._booted=!0}catch(zj){throw this._bootResolver.reject(zj),zj}}ready(){return this}willDestroy(){super.willDestroy(),ul.application===this&&(ul.application=void 0),this._applicationInstances.size&&(this._applicationInstances.forEach(t=>t.destroy()),this._applicationInstances.clear())}visit(t,e){return this.boot().then(()=>{let n=this.buildInstance();return n.boot(e).then(()=>n.visit(t)).catch(t=>{throw ma(n,"destroy"),t})})}}const ux=Object.freeze(Object.defineProperty({__proto__:null,_loaded:ul,default:cx,getOwner:ax,onLoad:hl,runLoadHooks:dl,setOwner:lx},Symbol.toStringTag,{value:"Module"})),hx=Object.assign({},{});function dx(){return px.global}const px={packages:{},global:{}};let fx="undefined"!=typeof window?window._embroider_macros_runtime_config:void 0;if(fx){let t={config:function(t){return px.packages[t]},getGlobalConfig:dx,setConfig(t,e){px.packages[t]=e},setGlobalConfig(t,e){px.global[t]=e}};for(let e of fx)e(t)}const gx={modulePrefix:"marco",environment:"production",rootURL:"/",locationType:"history",EmberENV:{},APP:{}},mx=Object.freeze(Object.defineProperty({__proto__:null,default:gx,enterTestMode:function(){gx.locationType="none",gx.APP.rootElement="#ember-testing",gx.APP.autoboot=!1;const t=dx()["@embroider/macros"];t&&(t.isTesting=!0)}},Symbol.toStringTag,{value:"Module"}));var yx;yx={throwOnUnhandled:!1,workflow:[]},self.deprecationWorkflow=self.deprecationWorkflow||{},self.deprecationWorkflow.deprecationLog={messages:new Set},self.deprecationWorkflow.flushDeprecations=t=>function({handler:t="silence",config:e={}}={}){let n=self.deprecationWorkflow.deprecationLog.messages,i=e.workflow??[],r=n.values().filter(t=>!i.some(e=>e.matchId===t)).map(e=>({handler:t,matchId:e})),s={...e,workflow:[...i,...r]};return`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';\n\nsetupDeprecationWorkflow(${JSON.stringify(s,void 0,2)});`}({config:yx,...t});const _x=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function vx(t,e){return Wt(t,e)}function bx(t,e){return function(t,e,n=!1){let i=$t(t),r=n?"eagerDestructors":"destructors";i[r]=Vt(i[r],e)}(t,e)}!function(){const t="TEST_WAITERS",e="undefined"!=typeof Symbol?Symbol.for(t):t,n=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;throw new Error("unable to locate global object")}();let i=n[e];void 0===i&&(i=n[e]=new Map)}();const wx=Object.freeze(Object.defineProperty({__proto__:null,assertDestroyablesDestroyed:jt,associateDestroyableChild:Gt,destroy:Ht,enableDestroyableTracking:Dt,isDestroyed:Yt,isDestroying:Xt,registerDestructor:vx,unregisterDestructor:bx},Symbol.toStringTag,{value:"Module"}));let xx;xx=sf;var Sx=xx;class Cx extends Sx{location=gx.locationType;rootURL=gx.rootURL}Cx.map(function(){this.route("place",{path:"/place/:place_id"}),this.route("place.new",{path:"/place/new"}),this.route("search")});const kx=Object.freeze(Object.defineProperty({__proto__:null,default:Cx},Symbol.toStringTag,{value:"Module"})),Ex=new WeakMap;function Tx(t,e,n,i){let r={configurable:!0,enumerable:!0,writable:!0,initializer:null};i&&(r.initializer=i);for(let s of n)r=s(t,e,r)||r;void 0===r.initializer?Object.defineProperty(t,e,r):function(t,e,n){let i=Ex.get(t);i||(i=new Map,Ex.set(t,i)),i.set(e,n)}(t,e,r)}function Rx(t,e,n){let i={...Object.getOwnPropertyDescriptor(t,e)};for(let r of n)i=r(t,e,i)||i;void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(t):void 0,i.initializer=void 0),Object.defineProperty(t,e,i)}function Px(t,e){let n=function(t,e){var n;let i=t.prototype;for(;i;){let t=null==(n=Ex.get(i))?void 0:n.get(e);if(t)return t;i=i.prototype}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}class Mx extends Bf{static{Tx(this.prototype,"selectedPlace",[Is],function(){return null})}#P=void Px(this,"selectedPlace");static{Tx(this.prototype,"isSearching",[Is],function(){return!1})}#M=void Px(this,"isSearching");static{Tx(this.prototype,"isCreating",[Is],function(){return!1})}#I=void Px(this,"isCreating");static{Tx(this.prototype,"creationCoordinates",[Is],function(){return null})}#O=void Px(this,"creationCoordinates");static{Tx(this.prototype,"returnToSearch",[Is],function(){return!1})}#A=void Px(this,"returnToSearch");selectPlace(t){this.selectedPlace=t}clearSelection(){this.selectedPlace=null}startSearch(){this.isSearching=!0,this.isCreating=!1}stopSearch(){this.isSearching=!1}startCreating(){this.isCreating=!0,this.isSearching=!1}stopCreating(){this.isCreating=!1,this.creationCoordinates=null}updateCreationCoordinates(t,e){this.creationCoordinates={lat:t,lon:e}}}const Ix=Object.freeze(Object.defineProperty({__proto__:null,default:Mx},Symbol.toStringTag,{value:"Module"}));function Ox(t,e="Untitled Place"){if(!t)return e;const n=navigator.languages||[navigator.language||"en"];for(const i of n){if(!i)continue;const e=`name:${i.split("-")[0]}`;if(t[e])return t[e]}return t.name?t.name:t["name:en"]?t["name:en"]:e}const Ax=Object.freeze(Object.defineProperty({__proto__:null,getLocalizedName:Ox},Symbol.toStringTag,{value:"Module"}));class Fx extends Bf{static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");controller=null;cachedResults=null;lastQueryKey=null;async getNearbyPois(t,e,n=50){const i=`${t},${e},${n}`;if(this.lastQueryKey===i&&this.cachedResults)return console.debug("Returning cached Overpass results for:",i),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const r=this.controller.signal,s=`\n[out:json][timeout:25];\n(\n nw["amenity"](around:${n},${t},${e});\n nw["shop"](around:${n},${t},${e});\n nw["tourism"](around:${n},${t},${e});\n nw["leisure"](around:${n},${t},${e});\n nw["historic"](around:${n},${t},${e});\n);\nout center;\n `.trim(),o=`${this.settings.overpassApi}?data=${encodeURIComponent(s)}`;try{const t=await this.fetchWithRetry(o,{signal:r});if(!t.ok)throw new Error("Overpass request failed");const e=(await t.json()).elements.map(this.normalizePoi);return this.lastQueryKey=i,this.cachedResults=e,e}catch(a){if("AbortError"===a.name)return console.debug("Overpass request aborted"),[];throw a}}normalizePoi(t){return{title:Ox(t.tags),lat:t.lat||t.center?.lat,lon:t.lon||t.center?.lon,url:t.tags?.website,osmId:String(t.id),osmType:t.type,osmTags:t.tags||{},description:t.tags?.description}}async fetchWithRetry(t,e={},n=3){try{const i=await fetch(t,e);return!i.ok&&n>0&&[502,503,504,429].includes(i.status)?(console.warn(`Overpass request failed with ${i.status}. Retrying... (${n} left)`),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1)):i}catch(i){if(n>0&&"AbortError"!==i.name)return console.debug(`Retrying Overpass request... (${n} left)`),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1);throw i}}async getPoiById(t,e=null){let n;n="node"===e?`[out:json][timeout:25];node(${t});out center;`:"way"===e?`[out:json][timeout:25];way(${t});out center;`:`\n[out:json][timeout:25];\n(\n node(${t});\n way(${t});\n);\nout center;\n `.trim();const i=`${this.settings.overpassApi}?data=${encodeURIComponent(n)}`,r=await this.fetchWithRetry(i);if(!r.ok)throw new Error("Overpass request failed");const s=await r.json();return s.elements[0]?this.normalizePoi(s.elements[0]):null}}const Lx=Object.freeze(Object.defineProperty({__proto__:null,default:Fx},Symbol.toStringTag,{value:"Module"}));class zx extends Bf{static{Tx(this.prototype,"overpassApi",[Is],function(){return"https://overpass.bke.ro/api/interpreter"})}#L=void Px(this,"overpassApi");static{Tx(this.prototype,"mapKinetic",[Is],function(){return!0})}#z=void Px(this,"mapKinetic");overpassApis=[{name:"bke.ro",url:"https://overpass.bke.ro/api/interpreter"},{name:"overpass-api.de",url:"https://overpass-api.de/api/interpreter"},{name:"private.coffee",url:"https://overpass.private.coffee/api/interpreter"}];constructor(){super(...arguments),this.loadSettings()}loadSettings(){const t=localStorage.getItem("marco:overpass-api");t&&(this.overpassApi=t);const e=localStorage.getItem("marco:map-kinetic");null!==e&&(this.mapKinetic="true"===e)}updateOverpassApi(t){this.overpassApi=t,localStorage.setItem("marco:overpass-api",t)}updateMapKinetic(t){this.mapKinetic=t,localStorage.setItem("marco:map-kinetic",String(t))}}const Dx=Object.freeze(Object.defineProperty({__proto__:null,default:zx},Symbol.toStringTag,{value:"Module"}));function jx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nx,Ux={exports:{}},Bx=(Nx||(Nx=1,Ux.exports=function(){var t={548:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Access=void 0;class n{constructor(){this.reset()}get scopes(){return Object.keys(this.scopeModeMap).map(t=>({name:t,mode:this.scopeModeMap[t]}))}get scopeParameter(){return this.scopes.map(t=>`${this._scopeNameForParameter(t)}:${t.mode}`).join(" ")}claim(t,e){if("string"!=typeof t||-1!==t.indexOf("/")||0===t.length)throw new Error("Scope should be a non-empty string without forward slashes");if("string"!=typeof e||!e.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(t),this.scopeModeMap[t]=e}get(t){return this.scopeModeMap[t]}remove(t){const e={};for(const n in this.scopeModeMap)e[n]=this.scopeModeMap[n];this.reset(),delete e[t];for(const n in e)this.claim(n,e[n])}checkPermission(t,e){const n=this.get(t);return n&&("r"===e||"rw"===n)}checkPathPermission(t,e){if(this.checkPermission("*",e))return!0;const n=this._getModuleName(t);return!!this.checkPermission(n,e)}reset(){this.rootPaths=[],this.scopeModeMap={}}_getModuleName(t){if("/"!==t[0])throw new Error("Path should start with a slash");const e=t.replace(/^\/public/,"").match(/^\/([^/]*)\//);return e?e[1]:"*"}_adjustRootPaths(t){"*"in this.scopeModeMap||"*"===t?this.rootPaths=["/"]:t in this.scopeModeMap||(this.rootPaths.push("/"+t+"/"),this.rootPaths.push("/public/"+t+"/"))}_scopeNameForParameter(t){if("*"===t.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return t.name}setStorageType(t){this.storageType=t}static _rs_init(){}}e.Access=n,e.default=n},275:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Authorize=void 0;const s=r(n(334)),o=n(746),a=r(n(503)),l=n(368);let c;function u(t){const e=t||h.getLocation().href,n={};for(const[s,o]of new URL(e).searchParams)n[s]=o;const i=e.indexOf("#");if(-1===i)return n;const r=e.substring(i+1);return r.includes("=")?r.split("&").reduce(function(t,e){const n=e.split("=");if("state"===n[0]&&n[1].match(/rsDiscovery/)){let e=decodeURIComponent(n[1]);const i=e.substr(e.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];t.rsDiscovery=JSON.parse(atob(i)),e=e.replace(new RegExp("&?rsDiscovery="+i),""),e.length>0&&(t.state=e)}else t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]);return t},n):n}class h{static authorize(t,e){if((0,s.default)("[Authorize] authURL = ",e.authURL,"scope = ",e.scope,"redirectUri = ",e.redirectUri,"clientId = ",e.clientId,"response_type =",e.response_type),!e.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if(!(0,o.localStorageAvailable)()&&"remotestorage"===t.backend){e.redirectUri+=e.redirectUri.indexOf("#")>0?"&":"#";const n={userAddress:t.remote.userAddress,href:t.remote.href,storageApi:t.remote.storageApi,properties:t.remote.properties};e.redirectUri+="rsDiscovery="+(0,o.toBase64)(JSON.stringify(n))}const n=function(t){const e=new URL(t.redirectUri);t.state||(t.state=e.hash?e.hash.substring(1):""),t.response_type||(t.response_type="token");const n=new URL(t.authURL);n.searchParams.set("redirect_uri",t.redirectUri.replace(/#.*$/,"")),n.searchParams.set("scope",t.scope),n.searchParams.set("client_id",t.clientId);for(const i of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const e=t[i];e&&n.searchParams.set(i,e)}return n.href}(e);o.globalContext.cordova?h.openWindow(n,e.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then(e=>{t.remote.configure({token:e.access_token})}):h.setLocation(n)}static refreshAccessToken(t,e,n){return i(this,void 0,void 0,function*(){var t,i,r;yield e.configure({token:null,tokenType:null});const o=new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:n}),c=yield(0,l.requestWithTimeout)("POST",e.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString(),responseType:"json"});if(200!==(null==c?void 0:c.status))throw yield e.configure({refreshToken:null}),new a.default("refresh token rejected:"+JSON.stringify(c.response));{(0,s.default)(`[Authorize] access token good for ${null===(t=null==c?void 0:c.response)||void 0===t?void 0:t.expires_in} seconds`);const n={token:null===(i=null==c?void 0:c.response)||void 0===i?void 0:i.access_token,tokenType:null===(r=null==c?void 0:c.response)||void 0===r?void 0:r.token_type};if(!n.token)throw new Error(`no access_token in "successful" refresh: ${c.response}`);yield e.configure(n)}})}static setLocation(t){if("string"==typeof t)document.location.href=t;else{if("object"!=typeof t)throw"Invalid location "+t;document.location=t}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(t){t.removeEventListener("features-loaded",c)}}e.Authorize=h,h.IMPLIED_FAKE_TOKEN=!1,h.getLocation=function(){return document.location},h.openWindow=function(t,e,n){return new Promise((i,r)=>{const s=open(t,"_blank",n);function o(){r("Authorization was canceled")}s&&!s.closed?(s.addEventListener("loadstart",function(t){if(0!==t.url.indexOf(e))return;s.removeEventListener("exit",o),s.close();const n=u(t.url);n?i(n):r("Authorization error")}),s.addEventListener("exit",o)):r("Authorization popup was blocked")})},h._rs_init=function(t){const e=u();let n;e&&(n=h.getLocation(),n.hash=""),c=function(){let r=!1;if(e){if(e.error)throw"access_denied"===e.error?new a.default("Authorization failed: access denied",{code:"access_denied"}):new a.default(`Authorization failed: ${e.error}`);e.rsDiscovery&&t.remote.configure(e.rsDiscovery),e.access_token&&(t.remote.configure({token:e.access_token}),r=!0),e.remotestorage&&(t.connect(e.remotestorage),r=!0),e.state&&(n=h.getLocation(),h.setLocation(n.href.split("#")[0]+"#"+e.state)),e.code&&(function(e){i(this,void 0,void 0,function*(){var i,r,o,a;const c=sessionStorage.getItem("remotestorage:codeVerifier");if(!c)return void(0,s.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");n=h.getLocation();let u=n.origin;"/"!==n.pathname&&(u+=n.pathname);const d=new URLSearchParams({code:e,grant_type:"authorization_code",client_id:t.remote.clientId,redirect_uri:u,code_verifier:c}),p=yield(0,l.requestWithTimeout)("POST",t.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:d.toString(),responseType:"json"});if(200===p.status){(0,s.default)(`[Authorize] access token good for ${null===(i=null==p?void 0:p.response)||void 0===i?void 0:i.expires_in} seconds`);const e={token:null===(r=null==p?void 0:p.response)||void 0===r?void 0:r.access_token,refreshToken:null===(o=null==p?void 0:p.response)||void 0===o?void 0:o.refresh_token,tokenType:null===(a=null==p?void 0:p.response)||void 0===a?void 0:a.token_type};e.token?t.remote.configure(e):t._emit("error",new Error(`no access_token in "successful" response: ${p.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier")}else t._emit("error",new Error(`${p.statusText}: ${p.response}`))})}(e.code),r=!0),r||t.remote.stopWaitingForToken()}else t.remote.stopWaitingForToken()},t.on("features-loaded",c)},e.default=h},424:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseClient=void 0;const s=r(n(439)),o=r(n(613)),a=r(n(491)),l=r(n(93)),c=r(n(28)),u=n(746);class h{constructor(t,e){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==e[e.length-1])throw"Not a folder: "+e;"/"===e&&(this.makePath=t=>("/"===t[0]?"":"/")+t),this.storage=t,this.base=e,this.moduleName=function(t){const e=t.split("/");return t.length>2?e[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),t.onChange(this.base,this._fireChange.bind(this))}scope(t){return new h(this.storage,this.makePath(t))}getListing(t,e){return i(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).then(t=>404===t.statusCode?{}:t.body)})}getAll(t,e){return i(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).then(n=>{if(404===n.statusCode)return{};if("object"==typeof n.body){const i=Object.keys(n.body);if(0===i.length)return{};const r=i.map(i=>this.storage.get(this.makePath(t+i),e).then(t=>{if("string"==typeof t.body)try{t.body=JSON.parse(t.body)}catch(t){}"object"==typeof t.body&&(n.body[i]=t.body)}));return Promise.all(r).then(()=>n.body)}})})}getFile(t,e){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(t),e).then(t=>({data:t.body,contentType:t.contentType,revision:t.revision}))})}storeFile(t,e,n){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'contentType' of baseClient.storeFile must be a string"):"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof n&&"object"!=typeof n?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(e),n,t).then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode)))})}getObject(t,e){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(t),e).then(e=>{if("object"==typeof e.body)return e.body;if("string"==typeof e.body)try{return JSON.parse(e.body)}catch(e){throw new Error("Not valid JSON: "+this.makePath(t))}else if(void 0!==e.body&&200===e.statusCode)return Promise.reject("Not an object: "+this.makePath(t))})})}storeObject(t,e,n){return i(this,void 0,void 0,function*(){if("string"!=typeof t)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof e)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof n)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(n,t);try{const t=this.validate(n);if(!t.valid)return Promise.reject(t)}catch(t){return Promise.reject(t)}return this.storage.put(this.makePath(e),JSON.stringify(n),"application/json; charset=UTF-8").then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode))})}remove(t){return i(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(t),this.storage.connected))})}getItemURL(t){if("string"!=typeof t)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(t=(0,u.cleanPath)(this.makePath(t)),this.storage.remote.href+t):void 0}cache(t,e="ALL"){if("string"!=typeof t)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof e)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==e&&"SEEN"!==e&&"ALL"!==e)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(t),e),this}declareType(t,e,n){let i;if(n&&"string"==typeof e)i=e;else if(n||"string"==typeof e){if(!n&&"string"==typeof e)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else n=e,i=this._defaultTypeURI(t);h.Types.declare(this.moduleName,t,i,n)}validate(t){const e=h.Types.getSchema(t["@context"]);if(e)return s.default.validateResult(t,e);throw new a.default(t["@context"])}_defaultTypeURI(t){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(t)}_attachType(t,e){t["@context"]=h.Types.resolveAlias(this.moduleName+"/"+e)||this._defaultTypeURI(e)}makePath(t){return this.base+(t||"")}_fireChange(t){c.default.changeEvents[t.origin]&&(["new","old","lastCommon"].forEach(function(e){if((!t[e+"ContentType"]||/^application\/(.*)json(.*)/.exec(t[e+"ContentType"]))&&"string"==typeof t[e+"Value"])try{t[e+"Value"]=JSON.parse(t[e+"Value"])}catch(t){}}),this._emit("change",t))}static _rs_init(){}}e.BaseClient=h,h.Types=o.default,(0,u.applyMixins)(h,[l.default]),e.default=h},285:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Caching=void 0;const r=n(746),s=i(n(334));class o{constructor(t){this.pendingActivations=[],this._access=t.access,this.reset()}set(t,e){if("string"!=typeof t)throw new Error("path should be a string");if(!(0,r.isFolder)(t))throw new Error("path should be a folder");if(!this._access.checkPathPermission(t,"r"))throw new Error('No access to path "'+t+'". You must claim access to it first.');if(void 0===e||!e.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[t]=e,"ALL"===e&&(this.activateHandler?this.activateHandler(t):this.pendingActivations.push(t))}enable(t){this.set(t,"ALL")}disable(t){this.set(t,"FLUSH")}onActivate(t){(0,s.default)("[Caching] Setting activate handler",t,this.pendingActivations),this.activateHandler=t;for(let e=0;e{this.emitChange(t.data)})}get(t,e,n){return i(this,void 0,void 0,function*(){return"number"==typeof e?this.getNodes((0,c.pathsFromRoot)(t)).then(i=>{const r=u(i[t]);return h(i,e)?n(t):r?{statusCode:200,body:r.body||r.itemsMap,contentType:r.contentType}:{statusCode:404}}):this.getNodes([t]).then(e=>{const n=u(e[t]);if(n){if((0,c.isFolder)(t))for(const t in n.itemsMap)n.itemsMap.hasOwnProperty(t)&&!1===n.itemsMap[t]&&delete n.itemsMap[t];return{statusCode:200,body:n.body||n.itemsMap,contentType:n.contentType}}return{statusCode:404}})})}put(t,e,n){return i(this,void 0,void 0,function*(){const i=(0,c.pathsFromRoot)(t);return this._updateNodes(i,function(t,i){try{for(let r=0,s=t.length;r0)break}else console.error("Cannot delete non-existing node "+r)}return n})})}flush(t){return this._getAllDescendentPaths(t).then(t=>this.getNodes(t)).then(t=>{for(const e in t){const n=t[e];n&&n.common&&n.local&&this.emitChange({path:n.path,origin:"local",oldValue:!1===n.local.body?void 0:n.local.body,newValue:!1===n.common.body?void 0:n.common.body}),t[e]=void 0}return this.setNodes(t)})}emitChange(t){a.default.changeEvents[t.origin]&&this._emit("change",t)}fireInitial(){a.default.changeEvents.local&&this.forAllNodes(t=>{if((0,c.isDocument)(t.path)){const e=u(t);e&&this.emitChange({path:t.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:e.body,newContentType:e.contentType})}}).then(()=>{this._emit("local-events-done")})}onDiff(t){this.diffHandler=t}_updateNodes(t,e){return new Promise((n,i)=>{this._doUpdateNodes(t,e,{resolve:n,reject:i})})}_doUpdateNodes(t,e,n){return i(this,void 0,void 0,function*(){if(this._updateNodesRunning)return void this._updateNodesQueued.push({paths:t,cb:e,promise:n});this._updateNodesRunning=!0;try{let i=yield this.getNodes(t);const r=(0,c.deepClone)(i),s=[];i=e(t,i);for(const t in i){const e=i[t];(0,c.equal)(e,r[t])?delete i[t]:(0,c.isDocument)(t)&&((0,c.equal)(e.local.body,e.local.previousBody)&&e.local.contentType===e.local.previousContentType||s.push({path:t,origin:"window",oldValue:e.local.previousBody,newValue:!1===e.local.body?void 0:e.local.body,oldContentType:e.local.previousContentType,newContentType:e.local.contentType}),void 0===e.local.body?i[t]=void 0:(delete e.local.previousBody,delete e.local.previousContentType))}yield this.setNodes(i),this._emitChangeEvents(s),n.resolve({statusCode:200})}catch(t){n.reject(t)}this._updateNodesRunning=!1;const i=this._updateNodesQueued.shift();i&&(yield this._doUpdateNodes(i.paths,i.cb,i.promise))})}_emitChangeEvents(t){for(let e=0,n=t.length;e{const n=[t],i=u(e[t]),r=Object.keys(i.itemsMap).map(e=>this._getAllDescendentPaths(t+e).then(t=>{for(let e=0,i=t.length;en)}):Promise.resolve([t])}_getInternals(){return{getLatest:u,makeNode:d,isOutdated:h}}}(0,c.applyMixins)(f,[o.default]),t.exports=f},28:function(t){t.exports={cache:!0,changeEvents:{local:!0,window:!1,remote:!0,conflict:!0},cordovaRedirectUri:void 0,logging:!1,modules:[],backgroundSyncInterval:6e4,disableFeatures:[],discoveryTimeout:5e3,isBackground:!1,requestTimeout:3e4,syncInterval:1e4}},373:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(199)),s=i(n(28)),o=i(n(334)),a=n(746);let l;const c="remotestorage:discover";let u={};const h=function(t){return new Promise((e,n)=>{if(t in u)return e(u[t]);const i=new r.default({tls_only:!1,uri_fallback:!0,request_timeout:s.default.discoveryTimeout});return setTimeout(()=>n(new Error("timed out")),s.default.discoveryTimeout),i.lookup(t,function(i,r){if(i)return n(i);if("object"!=typeof r.idx.links.remotestorage||"number"!=typeof r.idx.links.remotestorage.length||r.idx.links.remotestorage.length<=0)return(0,o.default)("[Discover] WebFinger record for "+t+" does not have remotestorage defined in the links section ",JSON.stringify(r.json)),n("WebFinger record for "+t+" does not have remotestorage defined in the links section.");const s=r.idx.links.remotestorage[0],a=s.properties["http://tools.ietf.org/html/rfc6749#section-4.2"]||s.properties["auth-endpoint"],h=s.properties["http://remotestorage.io/spec/version"]||s.type;return u[t]={href:s.href,storageApi:h,authURL:a,properties:s.properties},l&&localStorage.setItem(c,JSON.stringify({cache:u})),e(u[t])})})};(h.DiscoveryError=function(t){this.name="DiscoveryError",this.message=t,this.stack=(new Error).stack}).prototype=Object.create(Error.prototype),h.DiscoveryError.prototype.constructor=h.DiscoveryError,h._rs_init=function(){if(l=(0,a.localStorageAvailable)(),l){const t=JSON.parse(localStorage.getItem(c));t&&(u=t.cache)}},h._rs_supported=function(){return Object.prototype.hasOwnProperty.call(a.globalContext,"fetch")||Object.prototype.hasOwnProperty.call(a.globalContext,"XMLHttpRequest")},h._rs_cleanup=function(){l&&localStorage.removeItem(c)},t.exports=h},706:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(93)),o=r(n(424)),a=r(n(941)),l=r(n(982)),c=r(n(503)),u=n(746),h=n(368),d=n(684),p=r(n(275));let f;const g="remotestorage:dropbox",m="https://api.dropboxapi.com/2/files/list_folder",y="https://api.dropboxapi.com/2/files/list_folder/continue",_="/remotestorage";function v(t){return(_+"/"+t).replace(/\/+$/,"").replace(/\/+/g,"/")}const b=/[\u007f-\uffff]/g;function w(t){return JSON.stringify(t).replace(b,function(t){return"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4)})}function x(t,e){return new RegExp("^"+e.join("\\/")+"(\\/|$)").test(t.error_summary)}function S(t){return t instanceof ArrayBuffer||(0,h.isArrayBufferView)(t)}class C extends d.RemoteBase{constructor(t){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=t.apiKeys.dropbox.appKey,this.TOKEN_URL="https://api.dropboxapi.com/oauth2/token",this._revCache=new a.default("rev"),this._fetchDeltaCursor=null,this._fetchDeltaPromise=null,this._itemRefs={},f=(0,u.localStorageAvailable)(),f){const t=(0,u.getJSONFromLocalStorage)(g);t&&this.configure(t),this._itemRefs=(0,u.getJSONFromLocalStorage)(`${g}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return i(this,void 0,void 0,function*(){try{if(this.rs.setBackend("dropbox"),this.token)T(this.rs);else{const{codeVerifier:t,codeChallenge:e,state:n}=yield(0,u.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",t),sessionStorage.setItem("remotestorage:state",n),this.rs.authorize({authURL:"https://www.dropbox.com/oauth2/authorize",scope:"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write",clientId:this.clientId,response_type:"code",state:n,code_challenge:e,code_challenge_method:"S256",token_access_type:"offline"})}}catch(t){throw this.rs._emit("error",t),this.rs.setBackend(void 0),t}})}configure(t){return i(this,void 0,void 0,function*(){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token),void 0!==t.refreshToken&&(this.refreshToken=t.refreshToken),void 0!==t.tokenType&&(this.tokenType=t.tokenType);const e=()=>{f&&localStorage.setItem(g,JSON.stringify({userAddress:this.userAddress,token:this.token,refreshToken:this.refreshToken,tokenType:this.tokenType}))};if(this.refreshToken||this.token)if(this.connected=!0,this.userAddress)this._emit("connected"),e();else try{const t=yield this.info();this.userAddress=t.email,this._emit("connected"),e()}catch(t){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),e.apply(this)}else(()=>{this.connected=!1,f&&localStorage.removeItem(g),this.rs.setBackend(void 0)})()})}_getFolder(t){const e=this._revCache,n=n=>{let r;if(200!==n.status&&409!==n.status)return Promise.reject("Unexpected response status: "+n.status);try{r=JSON.parse(n.responseText)}catch(t){return Promise.reject(t)}if(409===n.status)return x(r,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+r.error_summary));const s=r.entries.reduce((n,i)=>{try{const r="folder"===i[".tag"],s=i.path_display.split("/").slice(-1)[0]+(r?"/":"");if(r)n[s]={ETag:e.get(t+s)};else{const e=new Date(i.server_modified);n[s]={ETag:i.rev,"Content-Length":i.size,"Last-Modified":e.toUTCString()},this._revCache.set(t+s,i.rev)}}catch(e){console.error(`[Dropbox] folder “${t}” has entry ${JSON.stringify(i)}:`,e)}return n},{});return r.has_more?i(r.cursor).then(function(t){return Object.assign(s,t)}):Promise.resolve(s)},i=t=>{const e={body:{cursor:t}};return this._request("POST",y,e).then(n)};return this._request("POST",m,{body:{path:v(t)}}).then(n).then(function(n){return Promise.resolve({statusCode:200,body:n,contentType:"application/json; charset=UTF-8",revision:e.get(t)})})}get(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n=this._revCache.get(t);if(null===n)return Promise.resolve({statusCode:404});if(e&&e.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then(()=>this.get(t,e));if(n&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===t.slice(-1))return this._getFolder(t);const i={headers:{"Dropbox-API-Arg":w({path:v(t)})},responseType:"arraybuffer"};return e&&e.ifNoneMatch&&(i.headers["If-None-Match"]=e.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",i).then(e=>{const n=e.status;let i,r,s,o;return 200!==n&&409!==n?Promise.resolve({statusCode:n}):(i=e.getResponseHeader("Dropbox-API-Result"),(0,u.getTextFromArrayBuffer)(e.response,"UTF-8").then(a=>{r=a,409===n&&(i=r);try{i=JSON.parse(i)}catch(t){return Promise.reject(t)}if(409===n)return x(i,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+t+'"): '+i.error_summary));if(s=e.getResponseHeader("Content-Type"),o=i.rev,this._revCache.set(t,o),this._shareIfNeeded(t),(0,u.shouldBeTreatedAsBinary)(a,s))r=e.response;else try{r=JSON.parse(r),s="application/json; charset=UTF-8"}catch(t){}return{statusCode:n,body:r,contentType:s,revision:o}}))})}put(t,e,n){return i(this,arguments,void 0,function*(t,e,n,i={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const r=this._revCache.get(t);if(i&&i.ifMatch&&r&&r!==i.ifMatch)return{statusCode:412,revision:r};if(i&&"*"===i.ifNoneMatch&&r&&"rev"!==r)return{statusCode:412,revision:r};if(!n.match(/charset=/)&&S(e)&&(n+="; charset=binary"),e.length>157286400)throw new Error("Cannot upload file larger than 150MB");const s={body:e,contentType:n,path:t};if(i&&(i.ifMatch||"*"===i.ifNoneMatch)){const e=yield this._getMetadata(t);if(i&&"*"===i.ifNoneMatch&&e)return{statusCode:412,revision:e.rev};if(i&&i.ifMatch&&e&&e.rev!==i.ifMatch)return{statusCode:412,revision:e.rev}}const o=yield this._uploadSimple(s);return this._shareIfNeeded(t),o})}delete(t){return i(this,arguments,void 0,function*(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const n=this._revCache.get(t);if((null==e?void 0:e.ifMatch)&&n&&e.ifMatch!==n)return{statusCode:412,revision:n};if(null==e?void 0:e.ifMatch){const n=yield this._getMetadata(t);if((null==e?void 0:e.ifMatch)&&n&&n.rev!==e.ifMatch)return{statusCode:412,revision:n.rev}}return this._deleteSimple(t)})}_shareIfNeeded(t){if(t.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[t])return this.share(t)}share(t){const e={body:{path:v(t)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",e).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?x(n,["shared_link_already_exists"])?this._getSharedLink(t):Promise.reject(new Error("API error: "+n.error_summary)):Promise.resolve(n.url)}).then(e=>(this._itemRefs[t]=e,f&&localStorage.setItem(g+":shares",JSON.stringify(this._itemRefs)),Promise.resolve(e)),e=>(e.message='Sharing Dropbox file or folder ("'+t+'") failed: '+e.message,Promise.reject(e)))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then(function(t){let e;try{const n=JSON.parse(t.responseText);e=null==n?void 0:n.email}catch(e){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+t.responseText))}return Promise.resolve({email:e})})}_request(t,e,n){return i(this,arguments,void 0,function*(t,e,n,i=1){if(this.isForbiddenRequestMethod(t,e))throw`Don't use ${t} on directories!`;if(!this.token)throw new c.default("No access token");n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,"object"!=typeof n.body||S(n.body)||(n.body=JSON.stringify(n.body),n.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:t,isFolder:(0,u.isFolder)(e)});try{const r=yield(0,h.requestWithTimeout)(t,e,n);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!0}),401===(null==r?void 0:r.status)&&this.refreshToken?i>=3?(console.error(`Abandoned after ${i} attempts: ${t} ${e}`),r):(this.rs._emit("wire-busy",{method:t,isFolder:(0,u.isFolder)(e)}),yield p.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!0}),this._request(t,e,n,i+1)):[503,429].includes(null==r?void 0:r.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),i>=3?(console.warn(`Abandoned after ${i} attempts: ${t} ${e}`),r):(yield new Promise(t=>setTimeout(t,(0,h.retryAfterMs)(r))),this._request(t,e,n,i+1))):r}catch(n){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,u.isFolder)(e),success:!1}),n}})}fetchDelta(...t){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const e=t=>i(this,void 0,void 0,function*(){let n,i;"string"==typeof t?(n=y,i={cursor:t}):(n=m,i={path:_,recursive:!0,include_deleted:!0});try{const r=yield this._request("POST",n,{body:i});if(401===r.status)throw new c.default;if(200!==r.status&&409!==r.status)throw new Error("Invalid response status: "+r.status);let s;try{s=JSON.parse(r.responseText)}catch(t){throw new Error("Invalid response body: "+r.responseText)}if(409===r.status){if(!x(s,["path","not_found"]))throw new Error("API returned an error: "+s.error_summary);s={cursor:null,entries:[],has_more:!1}}if(t||this._revCache.deactivatePropagation(),s.entries.forEach(t=>{const e=t.path_display.slice(14);"deleted"===t[".tag"]?(this._revCache.delete(e),this._revCache.delete(e+"/")):"file"===t[".tag"]&&this._revCache.set(e,t.rev)}),this._fetchDeltaCursor=s.cursor,s.has_more)return e(s.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(t){if("timeout"===t)return;throw t}});return this._fetchDeltaPromise=e(this._fetchDeltaCursor).catch(t=>("object"==typeof t&&"message"in t?t.message="Dropbox: fetchDelta: "+t.message:t=`Dropbox: fetchDelta: ${t}`,this.rs._emit("error",t),this._fetchDeltaPromise=null,Promise.reject(t))).then(()=>(this._fetchDeltaPromise=null,Promise.resolve(t))),this._fetchDeltaPromise}_getMetadata(t){const e={path:v(t)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?x(e,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+e.error_summary)):Promise.resolve(e)}).then(void 0,e=>(e.message='Could not load metadata for file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_uploadSimple(t){const e={path:v(t.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return t.ifMatch&&(e.mode={".tag":"update",update:t.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:t.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":w(e)}}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid API result: "+e.responseText))}return 409===e.status?x(n,["path","conflict"])?this._getMetadata(t.path).then(function(t){return Promise.resolve({statusCode:412,revision:t.rev})}):(this.rs._emit("error",new Error(n.error_summary)),Promise.resolve({statusCode:e.status})):(this._revCache.set(t.path,n.rev),Promise.resolve({statusCode:e.status,revision:n.rev}))})}_deleteSimple(t){const e={path:v(t)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}if(409===t.status){if(x(e,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(e.error_summary))}return Promise.resolve({statusCode:t.status})}).then(e=>(200!==e.statusCode&&404!==e.statusCode||(this._revCache.delete(t),delete this._itemRefs[t]),Promise.resolve(e)),e=>(e.message='Could not delete Dropbox file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_getSharedLink(t){return i(this,void 0,void 0,function*(){const e={body:{path:v(t),direct_only:!0}};return this._request("POST","https://api.dropbox.com/2/sharing/list_shared_links",e).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status: "+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?Promise.reject(new Error("API error: "+(null==e?void 0:e.error_summary)||0)):e.links.length?Promise.resolve(e.links[0].url):Promise.reject(new Error("No links returned"))},e=>(e.message='Could not get link to a shared file or folder ("'+t+'"): '+e.message,Promise.reject(e)))})}static _rs_init(t){f=(0,u.localStorageAvailable)(),t.apiKeys.dropbox&&(t.dropbox=new C(t)),"dropbox"===t.backend&&T(t)}static _rs_supported(){return!0}static _rs_cleanup(t){!function(t){(function(t){t._origRemote&&(t.remote=t._origRemote,delete t._origRemote)})(t),function(t){t._dropboxOrigSync&&(t.sync.sync=t._dropboxOrigSync,delete t._dropboxOrigSync)}(t),function(t){t._origBaseClientGetItemURL&&(o.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}(t),E(t)}(t),f&&localStorage.removeItem(g),t.setBackend(void 0)}}function k(t,...e){t._dropboxOrigSync||(t._dropboxOrigSync=t.sync.sync.bind(t.sync),t.sync.sync=function(){return this.dropbox.fetchDelta(t,...e).then(t._dropboxOrigSync,function(e){t._emit("error",new l.default(e)),t._emit("sync-done")})}.bind(t))}function E(t){t._dropboxOrigSyncCycle&&(t.syncCycle=t._dropboxOrigSyncCycle,delete t._dropboxOrigSyncCycle)}function T(t){!function(t){t._origRemote||(t._origRemote=t.remote,t.remote=t.dropbox)}(t),t.sync?k(t):function(t,...e){t._dropboxOrigSyncCycle||(t._dropboxOrigSyncCycle=t.syncCycle,t.syncCycle=()=>{if(!t.sync)throw new Error("expected sync to be initialized by now");k(t),t._dropboxOrigSyncCycle(t,...e),E(t)})}(t),function(t){t._origBaseClientGetItemURL||(t._origBaseClientGetItemURL=o.default.prototype.getItemURL,o.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Dropbox yet")})}(t)}(0,u.applyMixins)(C,[s.default]),t.exports=C},451:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(93)),s=n(746),o=i(n(334));class a{constructor(){this.addEvents(["background","foreground"]),this.mode="undefined"!=typeof window?"browser":"node","browser"===this.mode&&(this.setBrowserPrefixedNames(),document.addEventListener(this.visibilityChangeEvent,this.setVisibility.bind(this),!1),this.setVisibility())}setBrowserPrefixedNames(){"browser"===this.mode&&(void 0!==document.hidden?(this.hiddenProperty="hidden",this.visibilityChangeEvent="visibilitychange"):void 0!==document.mozHidden?(this.hiddenProperty="mozHidden",this.visibilityChangeEvent="mozvisibilitychange"):void 0!==document.msHidden?(this.hiddenProperty="msHidden",this.visibilityChangeEvent="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hiddenProperty="webkitHidden",this.visibilityChangeEvent="webkitvisibilitychange"))}setVisibility(){document[this.hiddenProperty]?((0,o.default)("[Env] Going into background mode"),this.goBackground()):((0,o.default)("[Env] Going into foreground mode"),this.goForeground())}isBrowser(){return"browser"===this.mode}isNode(){return"node"===this.mode}goBackground(){this._emit("background")}goForeground(){this._emit("foreground")}static _rs_init(){}static _rs_cleanup(){}}(0,s.applyMixins)(a,[r.default]),t.exports=a},93:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EventHandling=void 0;const r=i(n(334));class s{addEvents(t){t.forEach(t=>this._addEvent(t))}addEventListener(t,e){if("string"!=typeof t)throw new Error("Argument eventName should be a string");if("function"!=typeof e)throw new Error("Argument handler should be a function");(0,r.default)("[EventHandling] Adding event listener",t),this._validateEvent(t),this._handlers[t].push(e)}on(t,e){return this.addEventListener(t,e)}removeEventListener(t,e){this._validateEvent(t);const n=this._handlers[t].length;for(let i=0;i{t(...e)})}_validateEvent(t){if(!(t in this._handlers))throw new Error("Unknown event: "+t)}_delegateEvent(t,e){e.on(t,e=>{this._emit(t,e)})}_addEvent(t){void 0===this._handlers&&(this._handlers={}),this._handlers[t]=[]}}e.EventHandling=s,e.default=s},545:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(28)),s=i(n(451)),o=i(n(334)),a=n(746),l=i(n(370)),c=i(n(548)),u=i(n(275)),h=i(n(373)),d=i(n(424)),p=i(n(801)),f=i(n(706)),g=i(n(600)),m=i(n(313)),y=i(n(285)),_=i(n(567)),v=i(n(794)),b=i(n(365)),w={features:[],featuresDone:0,readyFired:!1,loadFeatures(){this.features=[],this.featuresDone=0,this.readyFired=!1,this.featureModules={WireClient:g.default,Dropbox:f.default,GoogleDrive:p.default,Access:c.default,Discover:h.default,Authorize:u.default,BaseClient:d.default,Env:s.default},r.default.cache&&(0,a.extend)(this.featureModules,{Caching:y.default,IndexedDB:_.default,LocalStorage:v.default,InMemoryStorage:b.default,Sync:m.default}),r.default.disableFeatures.forEach(t=>{this.featureModules[t]&&delete this.featureModules[t]}),this._allLoaded=!1;for(const t in this.featureModules)this.loadFeature(t)},hasFeature(t){for(let e=this.features.length-1;e>=0;e--)if(this.features[e].name===t)return this.features[e].supported;return!1},loadFeature(t){const e=this.featureModules[t],n=!e._rs_supported||e._rs_supported();(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initializing ...`),"object"==typeof n?n.then(()=>{this.featureSupported(t,!0),this.initFeature(t)},()=>{this.featureSupported(t,!1)}):"boolean"==typeof n?(this.featureSupported(t,n),n&&this.initFeature(t)):this.featureSupported(t,!1)},initFeature(t){const e=this.featureModules[t];let n;try{n=e._rs_init(this)}catch(e){return void this.featureFailed(t,e)}"object"==typeof n&&"function"==typeof n.then?n.then(()=>{this.featureInitialized(t)},e=>{this.featureFailed(t,e)}):this.featureInitialized(t)},featureFailed(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialization failed (${e})`),this.featureDone()},featureSupported(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}]${e?"":"not "} supported`),e||this.featureDone()},featureInitialized(t){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialized`),this.features.push({name:t,init:this.featureModules[t]._rs_init,supported:!0,cleanup:this.featureModules[t]._rs_cleanup}),this.featureDone()},featureDone(){this.featuresDone++,this.featuresDone===Object.keys(this.featureModules).length&&setTimeout(this.featuresLoaded.bind(this),0)},_setCachingModule(){["IndexedDB","LocalStorage","InMemoryStorage"].some(t=>{if(this.features.some(e=>e.name===t))return this.features.local=this.featureModules[t],!0})},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(t){console.error("'ready' failed: ",t,t.stack),this._emit("error",t)}},featuresLoaded(){(0,o.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=r.default.cache&&this.features.local&&new this.features.local,this.local&&this.remote?(this._setGPD(l.default,this),this._bindChange(this.local)):this.remote&&this._setGPD(this.remote,this.remote),this.remote&&(this.remote.on("connected",()=>{this._fireReady(),this._emit("connected")}),this.remote.on("not-connected",()=>{this._fireReady(),this._emit("not-connected")}),this.remote.connected&&(this._fireReady(),this._emit("connected")),this.hasFeature("Authorize")||this.remote.stopWaitingForToken()),this._collectCleanupFunctions();try{this._allLoaded=!0,this._emit("features-loaded")}catch(t){(0,a.logError)(t),this._emit("error",t)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let t=0;t=n-this.maxAge?e.v:void 0}set(t,e){this._items[t]={v:e,t:(new Date).getTime()}}}class _ extends l.RemoteBase{constructor(t,e){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=e,this._fileIdCache=new y(300),d=(0,o.localStorageAvailable)(),d){const t=(0,o.getJSONFromLocalStorage)(u);t&&this.configure(t)}}configure(t){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token);const e=function(){d&&localStorage.setItem(u,JSON.stringify({userAddress:this.userAddress,token:this.token}))},n=function(){this.connected=!1,delete this.token,d&&localStorage.removeItem(u)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),e.apply(this)):this.info().then(t=>{this.userAddress=t.user.emailAddress,this._emit("connected"),e.apply(this)}).catch(()=>{n.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))})):n.apply(this)}connect(){this.rs.setBackend("googledrive"),this.rs.authorize({authURL:"https://accounts.google.com/o/oauth2/auth",scope:"https://www.googleapis.com/auth/drive",clientId:this.clientId})}get(t,e={}){return(0,o.isFolder)(t)?this._getFolder(m(t)):this._getFile(m(t),e)}put(t,e,n,i={}){const r=m(t);function s(t){if(t.status>=200&&t.status<300){const e=JSON.parse(t.responseText),n=this.stripQuotes(e.etag);return Promise.resolve({statusCode:200,contentType:e.mimeType,revision:n})}return 412===t.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+t.status+" ("+t.responseText+")")}return this._getFileId(r).then(t=>t?i&&"*"===i.ifNoneMatch?s({status:412}):this._updateFile(t,r,e,n,i).then(s):this._createFile(r,e,n).then(s))}delete(t,e={}){const n=m(t);return this._getFileId(n).then(t=>t?this._getMeta(t).then(n=>{let i;return"object"==typeof n&&"string"==typeof n.etag&&(i=this.stripQuotes(n.etag)),e&&e.ifMatch&&e.ifMatch!==i?{statusCode:412,revision:i}:this._request("DELETE",c+"/drive/v2/files/"+t,{}).then(t=>200===t.status||204===t.status?{statusCode:200}:Promise.reject("Delete failed: "+t.status+" ("+t.responseText+")"))}):Promise.resolve({statusCode:200}))}info(){const t=c+"/drive/v2/about?fields=user";return this._request("GET",t,{}).then(function(t){try{const e=JSON.parse(t.responseText);return Promise.resolve(e)}catch(t){return Promise.reject(t)}})}_updateFile(t,e,n,i,r){const s={mimeType:i},o={"Content-Type":"application/json; charset=UTF-8"};return r&&r.ifMatch&&(o["If-Match"]=this.addQuotes(r.ifMatch)),this._request("PUT",c+"/upload/drive/v2/files/"+t+"?uploadType=resumable",{body:JSON.stringify(s),headers:o}).then(t=>412===t.status?t:this._request("PUT",t.getResponseHeader("Location"),{body:i.match(/^application\/json/)?JSON.stringify(n):n}))}_createFile(t,e,n){return this._getParentId(t).then(i=>{const r={title:p(g(t)),mimeType:n,parents:[{kind:"drive#fileLink",id:i}]};return this._request("POST",c+"/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(r),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(t=>this._request("POST",t.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(e):e}))})}_getFile(t,e){return this._getFileId(t).then(t=>this._getMeta(t).then(t=>{let n;if("object"==typeof t&&"string"==typeof t.etag&&(n=this.stripQuotes(t.etag)),e&&e.ifNoneMatch&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304});if(!t.downloadUrl){if(!t.exportLinks||!t.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:t.mimeType,revision:n});t.mimeType+=";export=text/html",t.downloadUrl=t.exportLinks["text/html"]}return this._request("GET",t.downloadUrl,{responseType:"arraybuffer"}).then(e=>(0,o.getTextFromArrayBuffer)(e.response,"UTF-8").then(function(i){let r=i;if(t.mimeType.match(/^application\/json/))try{r=JSON.parse(r)}catch(t){}else(0,o.shouldBeTreatedAsBinary)(i,t.mimeType)&&(r=e.response);return{statusCode:200,body:r,contentType:t.mimeType,revision:n}}))}))}_getFolder(t){return this._getFileId(t).then(e=>{let n,i,r;if(!e)return Promise.resolve({statusCode:404});const s="'"+e+"' in parents";return this._request("GET",c+"/drive/v2/files?q="+encodeURIComponent(s)+"&fields="+encodeURIComponent("items(downloadUrl,etag,fileSize,id,mimeType,title,labels)")+"&maxResults=1000&trashed=false",{}).then(e=>{var s;if(200!==e.status)return Promise.reject("request failed or something: "+e.status);try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject("non-JSON response from GoogleDrive")}r={};for(const a of n.items)(null===(s=a.labels)||void 0===s?void 0:s.trashed)||(i=this.stripQuotes(a.etag),a.mimeType===h?(this._fileIdCache.set(t+(0,o.cleanPath)(a.title)+"/",a.id),r[a.title+"/"]={ETag:i}):(this._fileIdCache.set(t+(0,o.cleanPath)(a.title),a.id),r[a.title]={ETag:i,"Content-Type":a.mimeType,"Content-Length":a.fileSize}));return Promise.resolve({statusCode:200,body:r,contentType:"application/json; charset=UTF-8",revision:void 0})})})}_getParentId(t){const e=f(t);return this._getFileId(e).then(t=>t?Promise.resolve(t):this._createFolder(e))}_createFolder(t){return this._getParentId(t).then(e=>this._request("POST",c+"/drive/v2/files",{body:JSON.stringify({title:p(g(t)),mimeType:h,parents:[{id:e}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(t=>{const e=JSON.parse(t.responseText);return Promise.resolve(e.id)}))}_getFileId(t){let e;return"/"===t?Promise.resolve("root"):(e=this._fileIdCache.get(t))?Promise.resolve(e):this._getFolder(f(t)).then(()=>(e=this._fileIdCache.get(t),e?Promise.resolve(e):"/"===t.substr(-1)?this._createFolder(t).then(()=>this._getFileId(t)):Promise.resolve()))}_getMeta(t){return this._request("GET",c+"/drive/v2/files/"+t,{}).then(function(e){return 200===e.status?Promise.resolve(JSON.parse(e.responseText)):Promise.reject("request (getting metadata for "+t+") failed with status: "+e.status)})}_request(t,e,n){return this.isForbiddenRequestMethod(t,e)?Promise.reject(`Don't use ${t} on directories!`):(n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:t,isFolder:(0,o.isFolder)(e)}),(0,a.requestWithTimeout)(t,e,n).then(n=>n&&401===n.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,o.isFolder)(e),success:!0}),Promise.resolve(n)),n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,o.isFolder)(e),success:!1}),Promise.reject(n))))}static _rs_init(t){const e=t.apiKeys.googledrive;var n;e&&(t.googledrive=new _(t,e.clientId),"googledrive"===t.backend&&(t._origRemote=t.remote,t.remote=t.googledrive,(n=t)._origBaseClientGetItemURL||(n._origBaseClientGetItemURL=r.default.prototype.getItemURL,r.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Google Drive yet")})))}static _rs_supported(){return!0}static _rs_cleanup(t){var e;t.setBackend(void 0),t._origRemote&&(t.remote=t._origRemote,delete t._origRemote),(e=t)._origBaseClientGetItemURL&&(r.default.prototype.getItemURL=e._origBaseClientGetItemURL,delete e._origBaseClientGetItemURL)}}(0,o.applyMixins)(_,[s.default]),t.exports=_},567:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(93)),o=r(n(496)),a=r(n(334)),l=n(746),c="remotestorage";let u;class h extends o.default{constructor(t){super(),this.addEvents(["change","local-events-done"]),this.db=t||u,this.db?(this.getsRunning=0,this.putsRunning=0,this.changesQueued={},this.changesRunning={},this.commitSlownessWarning=null):(0,a.default)("[IndexedDB] Failed to open DB")}getNodes(t){return i(this,void 0,void 0,function*(){const e=[],n={};for(let i=0,r=t.length;i0?this.getNodesFromDb(e).then(function(t){for(const e in n)t[e]=n[e];return t}):n})}setNodes(t){return i(this,void 0,void 0,function*(){for(const e in t)this.changesQueued[e]=t[e]||!1;this.maybeFlush()})}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=n.g.setInterval(function(){console.warn("WARNING: waited more than 10 seconds for previous commit to finish")},1e4))}flushChangesQueued(){this.commitSlownessWarning&&(clearInterval(this.commitSlownessWarning),this.commitSlownessWarning=null),Object.keys(this.changesQueued).length>0&&(this.changesRunning=this.changesQueued,this.changesQueued={},this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)))}getNodesFromDb(t){return new Promise((e,n)=>{const i=this.db.transaction(["nodes"],"readonly"),r=i.objectStore("nodes"),s={};this.getsRunning++,t.map(t=>{r.get(t).onsuccess=e=>{s[t]=e.target.result}}),i.oncomplete=()=>{e(s),this.getsRunning--},i.onerror=i.onabort=()=>{n("get transaction error/abort"),this.getsRunning--}})}setNodesInDb(t){return i(this,void 0,void 0,function*(){return new Promise((e,n)=>{const i=this.db.transaction(["nodes"],"readwrite"),r=i.objectStore("nodes"),s=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting puts",t,this.putsRunning);for(const o in t){const e=t[o];if("object"==typeof e)try{r.put(e)}catch(t){throw(0,a.default)("[IndexedDB] Error while putting",e,t),t}else try{r.delete(o)}catch(t){throw(0,a.default)("[IndexedDB] Error while removing",r,e,t),t}}i.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished puts",t,this.putsRunning,(new Date).getTime()-s+"ms"),e()},i.onerror=()=>{this.putsRunning--,n("transaction error")},i.onabort=()=>{n("transaction abort"),this.putsRunning--}})})}reset(t){const e=this.db.name;this.db.close(),h.clean(e,()=>{h.open(e,(n,i)=>{n?(0,a.default)(`[IndexedDB] Error while resetting database ${e}:`,n):this.db=i,"function"==typeof t&&t(self)})})}forAllNodes(t){return i(this,void 0,void 0,function*(){return new Promise(e=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=n=>{const i=n.target.result;i?(t(i.value),i.continue()):e()}})})}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(t,e){const n=setTimeout(function(){e("timeout trying to open db")},1e4);try{const i=indexedDB.open(t,2);i.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",i),clearTimeout(n),e(i.error)},i.onupgradeneeded=function(t){const e=i.result;(0,a.default)("[IndexedDB] Upgrade: from ",t.oldVersion," to ",t.newVersion),1!==t.oldVersion&&((0,a.default)("[IndexedDB] Creating object store: nodes"),e.createObjectStore("nodes",{keyPath:"path"})),(0,a.default)("[IndexedDB] Creating object store: changes"),e.createObjectStore("changes",{keyPath:"path"})},i.onsuccess=function(){clearTimeout(n);const r=i.result;if(!r.objectStoreNames.contains("nodes")||!r.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),void h.clean(t,function(){h.open(t,e)});e(null,i.result)}}catch(i){(0,a.default)("[IndexedDB] Failed to open database: "+i),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(n),h.clean(t,function(){h.open(t,e)})}}static clean(t,e){const n=indexedDB.deleteDatabase(t);n.onsuccess=function(){(0,a.default)(`[IndexedDB] Deleted database "${t}"`),e()},n.onerror=n.onabort=function(e){console.error('Failed to remove database "'+t+'"',e)}}static _rs_init(t){return new Promise((e,n)=>{h.open(c,function(i,r){i?n(i):(u=r,r.onerror=()=>{t._emit("error",i)},e())})})}static _rs_supported(){return new Promise((t,e)=>{const n=(0,l.getGlobalContext)();let i=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(i=!0)),"indexedDB"in n&&!i)try{const n=indexedDB.open("rs-check");n.onerror=function(){e()},n.onsuccess=function(){n.result.close(),indexedDB.deleteDatabase("rs-check"),t()}}catch(t){e()}else e()})}static _rs_cleanup(t){return new Promise(e=>{t.local instanceof h&&t.local.closeDB(),h.clean(c,e)})}diffHandler(){}}(0,l.applyMixins)(h,[s.default]),t.exports=h},365:function(t,e,n){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const r=i(n(93)),s=i(n(496)),o=n(746);class a extends s.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(t){const e={};for(let n=0,i=t.length;n=2e3&&t<=36e5}var E;!function(t){t.GOOGLE="googledrive",t.DROPBOX="dropbox"}(E||(E={}));class T{constructor(t){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=b.default.loadFeatures,this.features=b.default.features,this.loadFeature=b.default.loadFeature,this.featureSupported=b.default.featureSupported,this.featureDone=b.default.featureDone,this.featuresDone=b.default.featuresDone,this.featuresLoaded=b.default.featuresLoaded,this.featureInitialized=b.default.featureInitialized,this.featureFailed=b.default.featureFailed,this.hasFeature=b.default.hasFeature,this._setCachingModule=b.default._setCachingModule,this._collectCleanupFunctions=b.default._collectCleanupFunctions,this._fireReady=b.default._fireReady,this.initFeature=b.default.initFeature,"object"==typeof t&&(0,c.extend)(a.default,t),this.addEvents(["ready","authing","connecting","connected","disconnected","not-connected","conflict","error","features-loaded","sync-interval-change","sync-started","sync-req-done","sync-done","wire-busy","wire-done","network-offline","network-online"]),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")}),S=(0,c.localStorageAvailable)(),S){this.apiKeys=(0,c.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const t=localStorage.getItem("remotestorage:backend");"dropbox"===t||"googledrive"===t?this.setBackend(t):this.setBackend("remotestorage")}const e=this.on;this.on=function(t,n){if(this._allLoaded)switch(t){case"features-loaded":setTimeout(n,0);break;case"ready":this.remote&&setTimeout(n,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(n,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(n,0)}return e.call(this,t,n)},this._init(),this.fireInitial=function(){this.local&&setTimeout(this.local.fireInitial.bind(this.local),0)}.bind(this),this.on("ready",this.fireInitial.bind(this)),this.loadModules()}get connected(){return this.remote.connected}loadModules(){a.default.modules.forEach(this.addModule.bind(this))}authorize(t){if(this.access.setStorageType(this.remote.storageApi),void 0===t.scope&&(t.scope=this.access.scopeParameter),x.cordova)t.redirectUri=a.default.cordovaRedirectUri;else{const e=h.default.getLocation();let n=e.origin;"/"!==e.pathname&&(n+=e.pathname),t.redirectUri=n}void 0===t.clientId&&(t.clientId=t.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),h.default.authorize(this,t)}impliedauth(t,e){t=t||this.remote.storageApi,e=e||String(document.location),(0,l.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+t+" redirectUri = "+e),this.remote.configure({token:h.default.IMPLIED_FAKE_TOKEN}),document.location.href=e}connect(t,e){if(this.setBackend("remotestorage"),t.indexOf("@")<0&&!t.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new T.DiscoveryError("Not a valid user address or URL."));else{if(t.indexOf("@")<0&&!t.match(/^https?:\/\//)&&(t=`https://${t}`),x.cordova){if("string"!=typeof a.default.cordovaRedirectUri)return void this._emit("error",new T.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!x.cordova.InAppBrowser)return void this._emit("error",new T.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:t}),this._emit("connecting"),(0,y.default)(t).then(n=>{if(this._emit("authing"),n.userAddress=t,this.remote.configure(n),!this.remote.connected)if(n.authURL)if(void 0===e)this.authorize({authURL:n.authURL});else{if("string"!=typeof e)throw new Error("Supplied bearer token must be a string");(0,l.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:e})}else this.impliedauth()},()=>{this._emit("error",new T.DiscoveryError("No storage information found for this user address."))})}}reconnect(){this.remote.configure({token:null}),"remotestorage"===this.backend?this.connect(this.remote.userAddress):this.remote.connect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,properties:null}),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const t=this._cleanups.length;let e=0;const n=()=>{e++,e>=t&&(this._init(),(0,l.default)('Cleanups done, emitting "disconnected" event'),this._emit("disconnected"))};t>0?this._cleanups.forEach(t=>{const e=t(this);"object"==typeof e&&"function"==typeof e.then?e.then(n):n()}):n()}setBackend(t){this.backend=t,S&&(void 0!==t?localStorage.setItem("remotestorage:backend",t):localStorage.removeItem("remotestorage:backend"))}onChange(t,e){this._pathHandlers.change[t]||(this._pathHandlers.change[t]=[]),this._pathHandlers.change[t].push(e)}enableLog(){a.default.logging=!0}disableLog(){a.default.logging=!1}log(...t){l.default.apply(T,t)}setApiKeys(t){const e=[E.GOOGLE,E.DROPBOX];if("object"!=typeof t||!Object.keys(t).every(t=>e.includes(t)))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(t).forEach(e=>{const n=t[e];if(n){switch(e){case E.DROPBOX:this.apiKeys[E.DROPBOX]={appKey:n},void 0!==this.dropbox&&this.dropbox.clientId===n||m.default._rs_init(this);break;case E.GOOGLE:this.apiKeys[E.GOOGLE]={clientId:n},void 0!==this.googledrive&&this.googledrive.clientId===n||g.default._rs_init(this)}return!0}delete this.apiKeys[e]}),S&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(t){if("string"!=typeof t||!t.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");a.default.cordovaRedirectUri=t}_setGPD(t,e){function n(t){return function(...n){return t.apply(e,n).then(C.bind(this))}}this.get=n(t.get),this.put=n(t.put),this.delete=n(t.delete)}_pendingGPD(t){return(...e)=>{const n=Array.prototype.slice.call(e);return new Promise((e,i)=>{this._pending.push({method:t,args:n,promise:{resolve:e,reject:i}})})}}_processPending(){this._pending.forEach(t=>{try{this[t.method](...t.args).then(t.promise.resolve,t.promise.reject)}catch(e){t.promise.reject(e)}}),this._pending=[]}_bindChange(t){t.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(t,e){Object.keys(this._pathHandlers[t]).forEach(n=>{const i=n.length;e.path.substr(0,i)===n&&this._pathHandlers[t][n].forEach(t=>{const i={};for(const n in e)i[n]=e[n];i.relativePath=e.path.replace(new RegExp("^"+n),"");try{t(i)}catch(t){console.error("'change' handler failed: ",t,t.stack),this._emit("error",t)}})})}scope(t){if("string"!=typeof t)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(t,"r")||console.warn("WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestorage.io/rs.js/docs/api/access/classes/Access.html#claim"),new d.default(this,t)}getSyncInterval(){return a.default.syncInterval}setSyncInterval(t){if(!k(t))throw t+" is not a valid sync interval";const e=a.default.syncInterval;a.default.syncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getBackgroundSyncInterval(){return a.default.backgroundSyncInterval}setBackgroundSyncInterval(t){if(!k(t))throw t+" is not a valid sync interval";const e=a.default.backgroundSyncInterval;a.default.backgroundSyncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getCurrentSyncInterval(){return a.default.isBackground?a.default.backgroundSyncInterval:a.default.syncInterval}getRequestTimeout(){return a.default.requestTimeout}setRequestTimeout(t){if("number"!=typeof t)throw t+" is not a valid request timeout";a.default.requestTimeout=t}setupSyncCycle(){this.sync&&!this.sync.stopped&&((0,l.default)("[Sync] Setting up sync cycle"),this.on("sync-done",()=>{(0,l.default)("[Sync] Sync done. Setting timer to",this.getCurrentSyncInterval()),this.sync&&!this.sync.stopped&&(this._syncTimer&&clearTimeout(this._syncTimer),this._syncTimer=setTimeout(this.sync.sync.bind(this.sync),this.getCurrentSyncInterval()))}),this.sync.sync())}startSync(){return a.default.cache?(this.sync.stopped=!1,this.syncStopped=!1,this.sync.sync()):(console.warn("Nothing to sync, because caching is disabled."),Promise.resolve())}stopSync(){clearTimeout(this._syncTimer),this._syncTimer=void 0,this.sync?((0,l.default)("[Sync] Stopping sync"),this.sync.stopped=!0):((0,l.default)("[Sync] Will instantiate sync stopped"),this.syncStopped=!0)}addModule(t){const e=t.name,n=t.builder;if(Object.defineProperty(this,e,{configurable:!0,get:function(){const t=this._loadModule(e,n);return Object.defineProperty(this,e,{value:t}),t}}),-1!==e.indexOf("-")){const t=e.replace(/\-[a-z]/g,function(t){return t[1].toUpperCase()});Object.defineProperty(this,t,{get:function(){return this[e]}})}}_loadModule(t,e){if(e)return e(new d.default(this,"/"+t+"/"),new d.default(this,"/public/"+t+"/")).exports;throw"Unknown module: "+t}}e.RemoteStorage=T,T.SyncError=_.default,T.Unauthorized=v.default,T.DiscoveryError=y.default.DiscoveryError,T.util=w,Object.defineProperty(T.prototype,"access",{configurable:!0,get:function(){const t=new u.default;return Object.defineProperty(this,"access",{value:t}),t}}),Object.defineProperty(T.prototype,"caching",{configurable:!0,get:function(){const t=new p.default(this);return Object.defineProperty(this,"caching",{value:t}),t}}),(0,c.applyMixins)(T,[f.EventHandling]),e.default=T},368:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.isArrayBufferView=void 0,e.retryAfterMs=function(t){const e=1e3*parseInt(t.getResponseHeader("Retry-After"));return e>=1e3?e:Math.max(1500,Math.min(6e4,Math.round(o.default.syncInterval/(2.9+.2*Math.random()))))},e.requestWithTimeout=function(t,n,r){return i(this,void 0,void 0,function*(){return"function"==typeof fetch?function(t,e,n){return i(this,void 0,void 0,function*(){const i="function"==typeof AbortController?new AbortController:null;let r;const a=new Promise((t,e)=>{r=setTimeout(()=>{i&&i.abort(),e("timeout")},o.default.requestTimeout)});let l;const c={},u=fetch(e,{method:t,headers:n.headers,body:n.body,signal:i?i.signal:void 0}).then(t=>{switch((0,s.default)("[requests fetch]",t),t.headers.forEach((t,e)=>{c[e.toUpperCase()]=t}),l={readyState:4,status:t.status,statusText:t.statusText,response:void 0,getResponseHeader:t=>c[t.toUpperCase()]||null,responseType:n.responseType,responseURL:e},n.responseType){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json();case void 0:case"":case"text":return t.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}}).then(t=>(l.response=t,n.responseType&&"text"!==n.responseType||(l.responseText=t),l)).finally(()=>{clearTimeout(r)});return Promise.race([u,a])})}(t,n,r):"function"==typeof XMLHttpRequest?function(t,n,r){return i(this,void 0,void 0,function*(){return new Promise((i,a)=>{(0,s.default)("[requests XHR]",t,n);let l=!1;const c=setTimeout(()=>{l=!0,a("timeout")},o.default.requestTimeout),u=new XMLHttpRequest;if(u.open(t,n,!0),r.responseType&&(u.responseType=r.responseType),r.headers)for(const t in r.headers)u.setRequestHeader(t,r.headers[t]);u.onload=()=>{l||(clearTimeout(c),i(u))},u.onerror=t=>{l||(clearTimeout(c),a(t))};let h=r.body;"object"==typeof h&&!(0,e.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)})})}(t,n,r):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")})};const s=r(n(334)),o=r(n(28));if("function"==typeof(n.g||window).ArrayBufferView)e.isArrayBufferView=function(t){return t&&t instanceof(n.g||window).ArrayBufferView};else{const t=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];e.isArrayBufferView=function(e){for(let n=0;n<8;n++)if(e instanceof t[n])return!0;return!1}}},941:function(t){t.exports=class{constructor(t){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=t,this.activatePropagation()}get(t){t=t.toLowerCase();let e=this._storage[t];return void 0===e&&(e=this.defaultValue,this._storage[t]=e),e}set(t,e){return t=t.toLowerCase(),this._storage[t]===e||(this._storage[t]=e,e||delete this._itemsRev[t],this._updateParentFolderItemRev(t,e),this._canPropagate&&this._propagate(t)),e}delete(t){return this.set(t,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n0&&(n=this._generateHash(t))}return this.set(t,n),n}}},491:function(t){class e extends Error{constructor(t){super();const e=new Error("Schema not found: "+t);return e.name="SchemaNotFound",e}}t.exports=e},982:function(t){class e extends Error{constructor(t){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof t?this.message+=t:(this.message+=t.message,this.stack=t.stack,this.originalError=t)}}t.exports=e},313:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Sync=void 0;const s=r(n(28)),o=r(n(451)),a=r(n(93)),l=r(n(334)),c=r(n(275)),u=r(n(982)),h=r(n(503)),d=n(746);let p,f;function g(t,e,n){return{action:t,path:e,promise:n}}function m(t,e){return t.common.revision!==e&&(!t.remote||t.remote.revision!==e)}function y(t){return!!t.common&&!!t.common.revision}class _{constructor(t){this.numThreads=10,this._tasks={},this._running={},this._timeStarted={},this._finishedTasks=[],this.rs=t,this.rs.local.onDiff(t=>{this.addTask(t),this.doTasks()}),this.rs.caching.onActivate(t=>{this.addTask(t),this.doTasks()}),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(t){return i(this,void 0,void 0,function*(){return new Promise((e,n)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(t,function(){this.rs.local.get(t).then(t=>e(t))}.bind(this)),this.doTasks()):n("cannot fulfill maxAge requirement - remote is not online"):n("cannot fulfill maxAge requirement - remote is not connected")})})}corruptServerItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t){const n=t[e];if("object"!=typeof n)return!0;if("string"!=typeof n.ETag)return!0;if((0,d.isFolder)(e)){if(-1!==e.substring(0,e.length-1).indexOf("/"))return!0}else if(-1!==e.indexOf("/"))return!0}return!1}corruptItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t)if("boolean"!=typeof t[e])return!0;return!1}corruptRevision(t){return"object"!=typeof t||Array.isArray(t)||t.revision&&"string"!=typeof t.revision||t.body&&"string"!=typeof t.body&&"object"!=typeof t.body||t.contentType&&"string"!=typeof t.contentType||t.contentLength&&"number"!=typeof t.contentLength||t.timestamp&&"number"!=typeof t.timestamp||t.itemsMap&&this.corruptItemsMap(t.itemsMap)}isCorrupt(t){return"object"!=typeof t||Array.isArray(t)||"string"!=typeof t.path||this.corruptRevision(t.common)||t.local&&this.corruptRevision(t.local)||t.remote&&this.corruptRevision(t.remote)||t.push&&this.corruptRevision(t.push)}hasTasks(){return Object.keys(this._tasks).length>0}collectDiffTasks(){return i(this,void 0,void 0,function*(){let t=0;return this.rs.local.forAllNodes(e=>{t>100||(this.isCorrupt(e)?((0,l.default)("[Sync] WARNING: corrupt node in local cache",e),"object"==typeof e&&e.path&&(this.addTask(e.path),t++)):(this.needsFetch(e)&&this.rs.access.checkPathPermission(e.path,"r")||(0,d.isDocument)(e.path)&&this.needsPush(e)&&this.rs.access.checkPathPermission(e.path,"rw"))&&(this.addTask(e.path),t++))}).then(()=>t)})}inConflict(t){return!(!t.local||!t.remote||void 0===t.remote.body&&!t.remote.itemsMap)}needsRefresh(t){return!!t.common&&(!t.common.timestamp||this.now()-t.common.timestamp>s.default.syncInterval)}needsFetch(t){return!!this.inConflict(t)||!(!t.common||void 0!==t.common.itemsMap||void 0!==t.common.body)||!(!t.remote||void 0!==t.remote.itemsMap||void 0!==t.remote.body)}needsPush(t){return!this.inConflict(t)&&(!(!t.local||t.push)||void 0)}needsRemotePut(t){return t.local&&"string"==typeof t.local.body}needsRemoteDelete(t){return t.local&&!1===t.local.body}getParentPath(t){const e=t.match(/^(.*\/)([^\/]+\/?)$/);if(e)return e[1];throw new Error('Not a valid path: "'+t+'"')}deleteChildPathsFromTasks(){for(const t in this._tasks){const e=(0,d.pathsFromRoot)(t);for(let n=1;n{let e;if(this.needsRefresh(t)){try{e=this.getParentPath(t.path)}catch(t){}e&&this.rs.access.checkPathPermission(e,"r")?this.addTask(e):this.rs.access.checkPathPermission(t.path,"r")&&this.addTask(t.path)}}),this.deleteChildPathsFromTasks()})}flush(t){for(const e in t)"FLUSH"===this.rs.caching.checkPath(e)&&t[e]&&!t[e].local&&((0,l.default)("[Sync] Flushing",e),t[e]=void 0);return t}doTask(t){return i(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(e=>{const n=e[t];return void 0===n||function(t){return!(!t.remote||!t.remote.revision||t.remote.itemsMap||t.remote.body)}(n)?g("get",t,this.rs.remote.get(t)):this.needsRemotePut(n)?(n.push=(0,d.deepClone)(n.local),n.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(e)).then(()=>{let e;return e=y(n)?{ifMatch:n.common.revision}:{ifNoneMatch:"*"},g("put",t,this.rs.remote.put(t,n.push.body,n.push.contentType,e))})):this.needsRemoteDelete(n)?(n.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(e)).then(()=>y(n)?g("delete",t,this.rs.remote.delete(t,{ifMatch:n.common.revision})):g("get",t,this.rs.remote.get(t)))):y(n)?g("get",t,this.rs.remote.get(t,{ifNoneMatch:n.common.revision})):g("get",t,this.rs.remote.get(t))})})}autoMergeFolder(t){if(t.remote.itemsMap&&(t.common=t.remote,delete t.remote,t.common.itemsMap)){for(const e in t.common.itemsMap)t.local.itemsMap[e]||(t.local.itemsMap[e]=!1);for(const e in t.local.itemsMap)t.common.itemsMap[e]||this.addTask(t.path+e);(0,d.equal)(t.local.itemsMap,t.common.itemsMap)&&delete t.local}return t}autoMergeDocument(t){var e;return function(t){return(!t.remote||!t.remote.revision||t.remote.revision===t.common.revision)&&(void 0===t.common.body&&!1===t.remote.body||t.remote.body===t.common.body&&t.remote.contentType===t.common.contentType)}(t)?delete(t=function(t){return t.remote&&!1===t.remote.body&&t.local&&!1===t.local.body&&delete t.local,t}(t)).remote:void 0!==t.remote.body&&(!1===t.remote.body&&!1===(null===(e=t.local)||void 0===e?void 0:e.body)||((0,l.default)("[Sync] Emitting conflict event"),setTimeout(this.rs.local.emitChange.bind(this.rs.local),10,{origin:"conflict",path:t.path,oldValue:t.local.body,newValue:t.remote.body,lastCommonValue:t.common.body,oldContentType:t.local.contentType,newContentType:t.remote.contentType,lastCommonContentType:t.common.contentType})),!1===t.remote.body?t.common={}:t.common=t.remote,delete t.remote,delete t.local),t}autoMerge(t){if(t.remote){if(t.local)return(0,d.isFolder)(t.path)?this.autoMergeFolder(t):this.autoMergeDocument(t);if((0,d.isFolder)(t.path))void 0!==t.remote.itemsMap&&(t.common=t.remote,delete t.remote);else if(void 0!==t.remote.body){const e={origin:"remote",path:t.path,oldValue:!1===t.common.body?void 0:t.common.body,newValue:!1===t.remote.body?void 0:t.remote.body,oldContentType:t.common.contentType,newContentType:t.remote.contentType};if(void 0===e.oldValue&&void 0===e.newValue||this.rs.local.emitChange(e),!1===t.remote.body)return;t.common=t.remote,delete t.remote}return t}t.common.body&&this.rs.local.emitChange({origin:"remote",path:t.path,oldValue:t.common.body,newValue:void 0,oldContentType:t.common.contentType,newContentType:void 0})}updateCommonTimestamp(t,e){return i(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(n=>(n[t]&&n[t].common&&n[t].common.revision===e&&(n[t].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(n))))})}markChildren(t,e,n,r){return i(this,void 0,void 0,function*(){const i=[],s={},o={};for(const n in e)i.push(t+n),s[t+n]=e[n];for(const e in r)i.push(t+e);const a=yield this.rs.local.getNodes(i);let l,c;for(const e in a)if(c=a[e],s[e])c&&c.common?m(c,s[e].ETag)&&(n[e]=(0,d.deepClone)(c),n[e].remote={revision:s[e].ETag,timestamp:this.now()},n[e]=this.autoMerge(n[e])):(l=this.rs.caching.checkPath(e),"ALL"===l&&(n[e]={path:e,common:{timestamp:this.now()},remote:{revision:s[e].ETag,timestamp:this.now()}})),n[e]&&s[e]["Content-Type"]&&(n[e].remote.contentType=s[e]["Content-Type"]),n[e]&&s[e]["Content-Length"]&&(n[e].remote.contentLength=s[e]["Content-Length"]);else if(r[e.substring(t.length)]&&c&&c.common){if(c.common.itemsMap)for(const t in c.common.itemsMap)o[e+t]=!0;if(c.local&&c.local.itemsMap)for(const t in c.local.itemsMap)o[e+t]=!0;if(c.remote||(0,d.isFolder)(e))n[e]=void 0;else if(n[e]=this.autoMerge(c),void 0===n[e]){const i=this.getParentPath(e),r=n[i],s=e.substring(t.length);r&&r.local&&(delete r.local.itemsMap[s],(0,d.equal)(r.local.itemsMap,r.common.itemsMap)&&delete r.local)}}const u=yield this.markRemoteDeletions(Object.keys(o),n);u&&(yield this.rs.local.setNodes(this.flush(u)))})}markRemoteDeletions(t,e){return i(this,void 0,void 0,function*(){if(0===t.length)return e;const n=yield this.rs.local.getNodes(t),i={};function r(t,e){if(t&&t.itemsMap)for(const n in t.itemsMap)i[e+n]=!0}for(const t in n){const i=n[t];i&&((0,d.isFolder)(t)?(r(i.common,t),r(i.local,t)):i.common&&void 0!==i.common.body&&(e[t]=(0,d.deepClone)(i),e[t].remote={body:!1,timestamp:this.now()},e[t]=this.autoMerge(e[t])))}const s=yield this.markRemoteDeletions(Object.keys(i),e);s&&(yield this.rs.local.setNodes(this.flush(s)))})}completeFetch(t,e,n,r){return i(this,void 0,void 0,function*(){let i,s;const o=(0,d.pathsFromRoot)(t);(0,d.isFolder)(t)?i=[t]:(s=o[1],i=[t,s]);const a=yield this.rs.local.getNodes(i),l=a[s],c={};let u,h=a[t];function p(t){if(t&&t.itemsMap)for(u in t.itemsMap)e[u]||(c[u]=!0)}if("object"==typeof h&&h.path===t&&"object"==typeof h.common||(h={path:t,common:{}},a[t]=h),h.remote={revision:r,timestamp:this.now()},(0,d.isFolder)(t))for(u in p(h.common),p(h.remote),h.remote.itemsMap={},e)h.remote.itemsMap[u]=!0;else h.remote.body=e,h.remote.contentType=n,l&&l.local&&l.local.itemsMap&&(u=t.substring(s.length),!1!==e?l.local.itemsMap[u]=!0:l.local.itemsMap[u]&&delete l.local.itemsMap[u],(0,d.equal)(l.local.itemsMap,l.common.itemsMap)&&delete l.local);return a[t]=this.autoMerge(h),{toBeSaved:a,missingChildren:c}})}completePush(t,e,n,r){return i(this,void 0,void 0,function*(){const i=yield this.rs.local.getNodes([t]),s=i[t];if(!s.push)throw this.stopped=!0,new Error("completePush called but no push version!");n?((0,l.default)("[Sync] We have a conflict"),s.remote&&s.remote.revision===r||(s.remote={revision:r||"conflict",timestamp:this.now()},delete s.push),i[t]=this.autoMerge(s)):(s.common={revision:r,timestamp:this.now()},"put"===e?(s.common.body=s.push.body,s.common.contentType=s.push.contentType,(0,d.equal)(s.local.body,s.push.body)&&s.local.contentType===s.push.contentType&&delete s.local,delete s.push):"delete"===e&&(!1===s.local.body?i[t]=void 0:delete s.push)),yield this.rs.local.setNodes(this.flush(i))})}dealWithFailure(t){return i(this,void 0,void 0,function*(){const e=yield this.rs.local.getNodes([t]);if(e[t])return delete e[t].push,this.rs.local.setNodes(this.flush(e))})}interpretStatus(t){const e={statusCode:t,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};if("string"==typeof t&&("offline"===t||"timeout"===t))return e.successful=!1,e.networkProblems=!0,e;if("number"==typeof t){const n=Math.floor(t/100);return e.successful=2===n||304===t||412===t||404===t,e.conflict=412===t,e.unAuth=401===t&&this.rs.remote.token!==c.default.IMPLIED_FAKE_TOKEN||402===t||403===t,e.notFound=404===t,e.changed=304!==t,e}}handleGetResponse(t,e,n,r,s){return i(this,void 0,void 0,function*(){if(e.notFound&&(n=!!(0,d.isFolder)(t)&&{}),e.changed){const e=yield this.completeFetch(t,n,r,s);if((0,d.isFolder)(t)){if(this.corruptServerItemsMap(n))return(0,l.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+t),!1;yield this.markChildren(t,n,e.toBeSaved,e.missingChildren)}else yield this.rs.local.setNodes(this.flush(e.toBeSaved))}else yield this.updateCommonTimestamp(t,s);return!0})}handleResponse(t,e,n){return i(this,void 0,void 0,function*(){const i=this.interpretStatus(n.statusCode);if(i.successful){if("get"===e)return this.handleGetResponse(t,i,n.body,n.contentType,n.revision);if("put"===e||"delete"===e)return this.completePush(t,e,i.conflict,n.revision).then(function(){return!0});throw new Error(`cannot handle response for unknown action ${e}`)}{let e;return e=i.unAuth?new h.default:i.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+i.statusCode+" received."),this.dealWithFailure(t).then(()=>{throw this.rs._emit("error",e),e})}})}finishTask(t){return i(this,arguments,void 0,function*(t,e=!0){if(void 0===t.action)return void delete this._running[t.path];if(e&&((0,l.default)("[Sync] queue finished task:",t.path),this._finishedTasks.push(t),this._finishedTasks.length>1))return void(0,l.default)("[Sync] delaying finished task:",t.path);let n;(0,l.default)("[Sync] run task:",t.path);try{n=yield t.promise}catch(e){(0,l.default)("[Sync] wire client rejects its promise",t.path,t.action,e),n={statusCode:"offline"}}try{const e=yield this.handleResponse(t.path,t.action,n);this.finishSuccessfulTask(t,e)}catch(e){this.finishUnsuccessfulTask(t,e)}})}finishSuccessfulTask(t,e){return i(this,void 0,void 0,function*(){if(this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.path],e&&this._tasks[t.path]){for(let e=0;e0?yield this.finishTask(this._finishedTasks[0],!1):yield this.collectTasks(!1).then(()=>{!this.hasTasks()||this.stopped?(this.done||(this.done=!0),this.rs._emit("sync-done",{completed:!0})):setTimeout(()=>{this.doTasks()},10)})})}finishUnsuccessfulTask(t,e){return i(this,void 0,void 0,function*(){(0,l.default)("[Sync]",e.message),this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.path],this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?yield this.finishTask(this._finishedTasks[0],!1):this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!1}))})}tasksWanted(){return this.rs.remote.connected?this.rs.remote.online?this.numThreads:1:0}doTasks(){const t=this.tasksWanted()-Object.keys(this._running).length;if(t<=0)return!0;this.hasTasks()&&!this.done&&this.rs._emit("sync-started");let e,n=0;for(e in this._tasks)if(!this._running[e]&&(this._timeStarted[e]=this.now(),this._running[e]=this.doTask(e).then(this.finishTask.bind(this)),n++,n>=t))break;return n>=t}collectTasks(){return i(this,arguments,void 0,function*(t=!0){if(!this.hasTasks()&&!this.stopped)return(yield this.collectDiffTasks())>0?void 0:t?this.collectRefreshTasks():void 0})}addTask(t,e){this._tasks[t]||(this._tasks[t]=[]),"function"==typeof e&&this._tasks[t].push(e)}sync(){return i(this,void 0,void 0,function*(){if(this.done=!1,!this.doTasks()){try{yield this.collectTasks()}catch(t){throw(0,l.default)("[Sync] Sync error",t),new Error("Local cache unavailable")}this.doTasks()}})}static _rs_init(t){p=function(){const e=new o.default;e.isBrowser()&&function(t,e){function n(t){const n=e.getCurrentSyncInterval();s.default.isBackground=!t;const i=e.getCurrentSyncInterval();e._emit("sync-interval-change",{oldValue:n,newValue:i})}t.on("background",()=>n(!1)),t.on("foreground",()=>n(!0))}(e,t),t.sync||(t.sync=new _(t),t.syncStopped&&((0,l.default)("[Sync] Initializing with sync stopped"),t.sync.stopped=!0,delete t.syncStopped)),t.setupSyncCycle()},f=function(){t.removeEventListener("connected",f),t.startSync()},t.on("ready",p),t.on("connected",f)}static _rs_cleanup(t){t.stopSync(),t.removeEventListener("ready",p),t.removeEventListener("connected",f),t.sync=void 0,delete t.sync}}e.Sync=_,(0,d.applyMixins)(_,[a.default]),e.default=_},370:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const r=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(n(334));function s(t){return"dropbox"===this.backend&&!!t.match(/^\/public\/.*[^\/]$/)}const o={get:function(t,e){if(this.local){if(void 0===e)e="object"==typeof(n=this).remote&&n.remote.connected&&n.remote.online?2*n.getSyncInterval():((0,r.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof e&&!1!==e)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(t,e,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(t);var n},put:function(t,e,n){return s.bind(this)(t)?o._wrapBusyDone.call(this,this.remote.put(t,e,n)):this.local?this.local.put(t,e,n):o._wrapBusyDone.call(this,this.remote.put(t,e,n))},delete:function(t,e){return this.local?this.local.delete(t,e):o._wrapBusyDone.call(this,this.remote.delete(t,e))},_wrapBusyDone:function(t){return i(this,void 0,void 0,function*(){return this._emit("wire-busy"),t.then(t=>(this._emit("wire-done",{success:!0}),Promise.resolve(t)),t=>(this._emit("wire-done",{success:!1}),Promise.reject(t)))})}};t.exports=o},613:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseClientTypes=void 0;class n{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(t,e,n,i){const r=t+"/"+e;if(i.extends){const e=i.extends.split("/"),n=1===e.length?t+"/"+e.shift():e.join("/"),s=this.uris[n];if(!s)throw"Type '"+r+"' tries to extend unknown schema '"+n+"'";i.extends=this.schemas[s]}this.uris[r]=n,this.aliases[n]=r,this.schemas[n]=i}resolveAlias(t){return this.uris[t]}getSchema(t){return this.schemas[t]}inScope(t){const e=t.length,n={};for(const i in this.uris)if(i.substr(0,e+1)===t+"/"){const t=this.uris[i];n[t]=this.schemas[t]}return n}}e.BaseClientTypes=n;const i=new n;e.default=i},503:function(t){class e extends Error{constructor(t,e={}){super(),this.name="Unauthorized",this.message=void 0===t?"App authorization expired or revoked.":t,void 0!==e.code&&(this.code=e.code),this.stack=(new Error).stack}}t.exports=e},746:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};function r(t,e){if("object"==typeof t&&!Array.isArray(t)&&null!==t)for(const n in t)if("object"==typeof t[n]&&null!==t[n])if("[object ArrayBuffer]"===t[n].toString()){e[n]=new ArrayBuffer(t[n].byteLength);const i=new Int8Array(t[n]);new Int8Array(e[n]).set(i)}else r(t[n],e[n])}Object.defineProperty(e,"__esModule",{value:!0}),e.toBase64=e.getTextFromArrayBuffer=e.shouldBeTreatedAsBinary=e.getJSONFromLocalStorage=e.localStorageAvailable=e.pathsFromRoot=e.deepClone=e.equal=e.bindAll=e.cleanPath=e.baseName=e.isDocument=e.isFolder=e.containingFolder=e.extend=e.getGlobalContext=e.globalContext=e.logError=void 0,e.generateCodeVerifier=function(){return i(this,arguments,void 0,function*(t=128){const e=new Uint8Array(t);crypto.getRandomValues(e);const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=Array.from(e).map(t=>n[t%66]),r=i.join(""),s=Uint8Array.from(i.map(t=>t.charCodeAt(0))),o=(a=yield crypto.subtle.digest("SHA-256",s),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(e),{codeVerifier:r,codeChallenge:o,state:Array.from(e).map(t=>n[t%66]).join("")}})},e.applyMixins=function(t,e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})},e.logError=t=>{"string"==typeof t?console.error(t):console.error(t.message,t.stack)},e.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.extend=(...t)=>{const e=t[0];return Array.prototype.slice.call(t,1).forEach(function(t){for(const n in t)e[n]=t[n]}),e},e.containingFolder=t=>{if(""===t)return"/";if(!t)throw"Path not given!";return t.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},e.isFolder=t=>"/"===t.slice(-1),e.isDocument=t=>!(0,e.isFolder)(t),e.baseName=t=>{const n=t.split("/");return(0,e.isFolder)(t)?n[n.length-2]+"/":n[n.length-1]},e.cleanPath=t=>t.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),e.bindAll=t=>{for(const e in this)"function"==typeof t[e]&&(t[e]=t[e].bind(t))},e.equal=(t,n,i=[])=>{let r;if(typeof t!=typeof n)return!1;if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return t===n;if("function"==typeof t)return t.toString()===n.toString();if(t instanceof ArrayBuffer&&n instanceof ArrayBuffer&&(t=new Uint8Array(t),n=new Uint8Array(n)),t instanceof Array){if(t.length!==n.length)return!1;for(let r=0,s=t.length;r=0)continue;s=i.slice(),s.push(n[r])}if(!(0,e.equal)(t[r],n[r],s))return!1}}return!0},e.deepClone=t=>{if(void 0!==t){const e=JSON.parse(JSON.stringify(t));return r(t,e),e}},e.pathsFromRoot=t=>{const e=[t],n=t.replace(/\/$/,"").split("/");for(;n.length>1;)n.pop(),e.push(n.join("/")+"/");return e},e.localStorageAvailable=()=>{const t=(0,e.getGlobalContext)();if(!("localStorage"in t))return!1;try{return t.localStorage.setItem("rs-check","1"),t.localStorage.removeItem("rs-check"),!0}catch(t){return!1}},e.getJSONFromLocalStorage=t=>{const n=(0,e.getGlobalContext)();try{return JSON.parse(n.localStorage.getItem(t))}catch(t){}},e.shouldBeTreatedAsBinary=(t,e)=>!!(e&&e.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(t)),e.getTextFromArrayBuffer=(t,n)=>new Promise(i=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader){const e=Buffer.from(t);i(e.toString(n))}else{let r;const s=e.globalContext;if(s.BlobBuilder=s.BlobBuilder||s.WebKitBlobBuilder,void 0!==s.BlobBuilder){const e=new s.BlobBuilder;e.append(t),r=e.getBlob()}else r=new Blob([t]);const o=new FileReader;"function"==typeof o.addEventListener?o.addEventListener("loadend",function(t){i(t.target.result)}):o.onloadend=function(t){i(t.target.result)},o.readAsText(r,n)}}),e.toBase64=t=>{const n=(0,e.getGlobalContext)();return"btoa"in n?n.btoa(t):Buffer.from(t).toString("base64")}},600:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=r(n(275)),o=r(n(93)),a=r(n(503)),l=r(n(334)),c=n(746),u=n(368),h=n(684);let d;const p="remotestorage:wireclient",f={"draft-dejong-remotestorage-00":2,"draft-dejong-remotestorage-01":3,"draft-dejong-remotestorage-02":4,"https://www.w3.org/community/rww/wiki/read-write-web-00#simple":1};class g extends h.RemoteBase{constructor(t){if(super(t),this._revisionCache={},d=(0,c.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const t=function(){const t=(0,c.getJSONFromLocalStorage)(p)||{},{userAddress:e,href:n,storageApi:i,token:r,properties:s}=t;return{userAddress:e,href:n,storageApi:i,token:r,properties:s}}();t&&setTimeout(()=>{this.configure(t)},0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}get storageType(){if(this.storageApi){const t=this.storageApi.match(/draft-dejong-(remotestorage-\d\d)/);return t?t[1]:"2012.04"}}_request(t,e,n,r,o,h,d){return i(this,void 0,void 0,function*(){if(this.isForbiddenRequestMethod(t,e))return Promise.reject(`Don't use ${t} on directories!`);let i;return n!==s.default.IMPLIED_FAKE_TOKEN&&(r.Authorization="Bearer "+n),this.rs._emit("wire-busy",{method:t,isFolder:(0,c.isFolder)(e)}),(0,u.requestWithTimeout)(t,e,{body:o,headers:r,responseType:"arraybuffer"}).then(n=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!0}),r=n.status,[401,403,404,412].indexOf(r)>=0)return(0,l.default)("[WireClient] Error response status",n.status),i=h?this.stripQuotes(n.getResponseHeader("ETag")):void 0,401===n.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:n.status,revision:i});if(function(t){return[201,204,304].indexOf(t)>=0}(n.status)||200===n.status&&"GET"!==t)return i=this.stripQuotes(n.getResponseHeader("ETag")),(0,l.default)("[WireClient] Successful request",i),Promise.resolve({statusCode:n.status,revision:i});{const t=n.getResponseHeader("Content-Type");i=h?this.stripQuotes(n.getResponseHeader("ETag")):200===n.status?d:void 0;const e=function(t){let e,n="utf-8";return t&&(e=t.match(/charset=(.+)$/),e&&(n=e[1])),n}(t);return(0,c.shouldBeTreatedAsBinary)(n.response,t)?((0,l.default)("[WireClient] Successful request with unknown or binary mime-type",i),Promise.resolve({statusCode:n.status,body:n.response,contentType:t,revision:i})):(0,c.getTextFromArrayBuffer)(n.response,e).then(e=>((0,l.default)("[WireClient] Successful request",i),Promise.resolve({statusCode:n.status,body:e,contentType:t,revision:i})))}var r},n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!1}),Promise.reject(n)))})}configure(t){if("object"!=typeof t)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.href&&(this.href=t.href),void 0!==t.storageApi&&(this.storageApi=t.storageApi),void 0!==t.token&&(this.token=t.token),void 0!==t.properties&&(this.properties=t.properties),"string"==typeof this.storageApi){const t=f[this.storageApi]||5;this.supportsRevs=t>=2}this.href&&this.token?(this.connected=!0,this.online=!0,this._emit("connected")):this.connected=!1,d&&localStorage.setItem(p,JSON.stringify({userAddress:this.userAddress,href:this.href,storageApi:this.storageApi,token:this.token,properties:this.properties}))}get(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n={};return this.supportsRevs&&e.ifNoneMatch&&(n["If-None-Match"]=this.addQuotes(e.ifNoneMatch)),this._request("GET",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs,this._revisionCache[t]).then(e=>{if(!(0,c.isFolder)(t))return Promise.resolve(e);let n={};if(void 0!==e.body)try{e.body=JSON.parse(e.body)}catch(e){return Promise.reject("Folder description at "+this.href+(0,c.cleanPath)(t)+" is not JSON")}if(200===e.statusCode&&"object"==typeof e.body){if(0===Object.keys(e.body).length)e.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(i=e.body)["@context"]&&"object"==typeof i.items){for(const n in e.body.items)this._revisionCache[t+n]=e.body.items[n].ETag;n=e.body.items}else Object.keys(e.body).forEach(i=>{this._revisionCache[t+i]=e.body[i],n[i]={ETag:e.body[i]}});return e.body=n,Promise.resolve(e)}return Promise.resolve(e);var i})}put(t,e,n,i={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");!n.match(/charset=/)&&(e instanceof ArrayBuffer||(0,u.isArrayBufferView)(e))&&(n+="; charset=binary");const r={"Content-Type":n};return this.supportsRevs&&(i.ifMatch&&(r["If-Match"]=this.addQuotes(i.ifMatch)),i.ifNoneMatch&&(r["If-None-Match"]=this.addQuotes(i.ifNoneMatch))),this._request("PUT",this.href+(0,c.cleanPath)(t),this.token,r,e,this.supportsRevs)}delete(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");e||(e={});const n={};return this.supportsRevs&&e.ifMatch&&(n["If-Match"]=this.addQuotes(e.ifMatch)),this._request("DELETE",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs)}static _rs_init(t){t.remote=new g(t),t.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){d&&delete localStorage[p]}}(0,c.applyMixins)(g,[o.default]),t.exports=g},439:function(t,e){var n,i;n=function(){var t,e,n,i;Object.keys||(Object.keys=(t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(r){if("object"!=typeof r&&"function"!=typeof r||null===r)throw new TypeError("Object.keys called on non-object");var s=[];for(var o in r)t.call(r,o)&&s.push(o);if(e)for(var a=0;a>>0;if(0===n)return-1;var i=0;if(arguments.length>1&&((i=Number(arguments[1]))!=i?i=0:0!==i&&i!==1/0&&i!==-1/0&&(i=(i>0||-1)*Math.floor(Math.abs(i)))),i>=n)return-1;for(var r=i>=0?i:Math.max(n-Math.abs(i),0);r0&&(e+=u.suffices["*"]&&n||",",u.suffices["*"]&&l&&(e+=u.name+"=")),e+=a?encodeURIComponent(h[p]).replace(/!/g,"%21"):o(h[p])}else if("object"==typeof h){l&&!u.suffices["*"]&&(e+=u.name+"=");var f=!0;for(var g in h)f||(e+=u.suffices["*"]&&n||","),f=!1,e+=a?encodeURIComponent(g).replace(/!/g,"%21"):o(g),e+=u.suffices["*"]?"=":",",e+=a?encodeURIComponent(h[g]).replace(/!/g,"%21"):o(h[g])}else l&&(e+=u.name,c&&""===h||(e+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),e+=a?encodeURIComponent(h).replace(/!/g,"%21"):o(h)}return e};return b.varNames=u,{prefix:i,substitution:b}}function l(t){if(!(this instanceof l))return new l(t);for(var e=t.split("{"),n=[e.shift()],i=[],r=[],s=[];e.length>0;){var o=e.shift(),c=o.split("}")[0],u=o.substring(c.length+1),h=a(c);r.push(h.substitution),i.push(h.prefix),n.push(u),s=s.concat(h.substitution.varNames)}this.fill=function(t){for(var e=n[0],i=0;i0&&"/"===e.charAt(t.length-1)||"#"===n.charAt(0)||"?"===n.charAt(0))return!0}return!1}(e,t.id)&&void 0===this.schemas[t.id]&&(this.schemas[t.id]=t),t)if("enum"!==i)if("object"==typeof t[i])this.searchSchemas(t[i],e);else if("$ref"===i){var r=g(t[i]);r&&void 0===this.schemas[r]&&void 0===this.missingMap[r]&&(this.missingMap[r]=r)}},c.prototype.addSchema=function(t,e){if("string"!=typeof t||void 0===e){if("object"!=typeof t||"string"!=typeof t.id)return;t=(e=t).id}t===g(t)+"#"&&(t=g(t)),this.schemas[t]=e,delete this.missingMap[t],m(e,t),this.searchSchemas(e,t)},c.prototype.getSchemaMap=function(){var t={};for(var e in this.schemas)t[e]=this.schemas[e];return t},c.prototype.getSchemaUris=function(t){var e=[];for(var n in this.schemas)t&&!t.test(n)||e.push(n);return e},c.prototype.getMissingUris=function(t){var e=[];for(var n in this.missingMap)t&&!t.test(n)||e.push(n);return e},c.prototype.dropSchemas=function(){this.schemas={},this.reset()},c.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},c.prototype.validateAll=function(t,e,n,i,r){var s;if(!(e=this.resolveRefs(e)))return null;if(e instanceof x)return this.errors.push(e),e;var o,a=this.errors.length,l=null,c=null;if(this.checkRecursive&&t&&"object"==typeof t){if(s=!this.scanned.length,t[this.validatedSchemasKey]){var u=t[this.validatedSchemasKey].indexOf(e);if(-1!==u)return this.errors=this.errors.concat(t[this.validationErrorsKey][u]),null}if(Object.isFrozen(t)&&-1!==(o=this.scannedFrozen.indexOf(t))){var h=this.scannedFrozenSchemas[o].indexOf(e);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[o][h]),null}if(this.scanned.push(t),Object.isFrozen(t))-1===o&&(o=this.scannedFrozen.length,this.scannedFrozen.push(t),this.scannedFrozenSchemas.push([])),l=this.scannedFrozenSchemas[o].length,this.scannedFrozenSchemas[o][l]=e,this.scannedFrozenValidationErrors[o][l]=[];else{if(!t[this.validatedSchemasKey])try{Object.defineProperty(t,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(t,this.validationErrorsKey,{value:[],configurable:!0})}catch(e){t[this.validatedSchemasKey]=[],t[this.validationErrorsKey]=[]}c=t[this.validatedSchemasKey].length,t[this.validatedSchemasKey][c]=e,t[this.validationErrorsKey][c]=[]}}var d=this.errors.length,p=this.validateBasic(t,e,r)||this.validateNumeric(t,e,r)||this.validateString(t,e,r)||this.validateArray(t,e,r)||this.validateObject(t,e,r)||this.validateCombinations(t,e,r)||this.validateHypermedia(t,e,r)||this.validateFormat(t,e,r)||this.validateDefinedKeywords(t,e,r)||null;if(s){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||d!==this.errors.length)for(;n&&n.length||i&&i.length;){var f=n&&n.length?""+n.pop():null,g=i&&i.length?""+i.pop():null;p&&(p=p.prefixWith(f,g)),this.prefixErrors(d,f,g)}return null!==l?this.scannedFrozenValidationErrors[o][l]=this.errors.slice(a):null!==c&&(t[this.validationErrorsKey][c]=this.errors.slice(a)),this.handleError(p)},c.prototype.validateFormat=function(t,e){if("string"!=typeof e.format||!this.formatValidators[e.format])return null;var n=this.formatValidators[e.format].call(null,t,e);return"string"==typeof n||"number"==typeof n?this.createError(_.FORMAT_CUSTOM,{message:n},"","/format",null,t,e):n&&"object"==typeof n?this.createError(_.FORMAT_CUSTOM,{message:n.message||"?"},n.dataPath||"",n.schemaPath||"/format",null,t,e):null},c.prototype.validateDefinedKeywords=function(t,e,n){for(var i in this.definedKeywords)if(void 0!==e[i])for(var r=this.definedKeywords[i],s=0;s=h&&ie.maximum)return this.createError(_.NUMBER_MAXIMUM,{value:t,maximum:e.maximum},"","/maximum",null,t,e);if(e.exclusiveMaximum&&t===e.maximum)return this.createError(_.NUMBER_MAXIMUM_EXCLUSIVE,{value:t,maximum:e.maximum},"","/exclusiveMaximum",null,t,e)}return null},c.prototype.validateNaN=function(t,e){return"number"!=typeof t?null:!0===isNaN(t)||t===1/0||t===-1/0?this.createError(_.NUMBER_NOT_A_NUMBER,{value:t},"","/type",null,t,e):null},c.prototype.validateString=function(t,e,n){return this.validateStringLength(t,e,n)||this.validateStringPattern(t,e,n)||null},c.prototype.validateStringLength=function(t,e){return"string"!=typeof t?null:void 0!==e.minLength&&t.lengthe.maxLength?this.createError(_.STRING_LENGTH_LONG,{length:t.length,maximum:e.maxLength},"","/maxLength",null,t,e):null},c.prototype.validateStringPattern=function(t,e){if("string"!=typeof t||"string"!=typeof e.pattern&&!(e.pattern instanceof RegExp))return null;var n;if(e.pattern instanceof RegExp)n=e.pattern;else{var i,r="",s=e.pattern.match(/^\/(.+)\/([img]*)$/);s?(i=s[1],r=s[2]):i=e.pattern,n=new RegExp(i,r)}return n.test(t)?null:this.createError(_.STRING_PATTERN,{pattern:e.pattern},"","/pattern",null,t,e)},c.prototype.validateArray=function(t,e,n){return Array.isArray(t)&&(this.validateArrayLength(t,e,n)||this.validateArrayUniqueItems(t,e,n)||this.validateArrayItems(t,e,n))||null},c.prototype.validateArrayLength=function(t,e){var n;return void 0!==e.minItems&&t.lengthe.maxItems&&(n=this.createError(_.ARRAY_LENGTH_LONG,{length:t.length,maximum:e.maxItems},"","/maxItems",null,t,e),this.handleError(n))?n:null},c.prototype.validateArrayUniqueItems=function(t,e){if(e.uniqueItems)for(var n=0;ne.maxProperties&&(n=this.createError(_.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:i.length,maximum:e.maxProperties},"","/maxProperties",null,t,e),this.handleError(n))?n:null},c.prototype.validateObjectRequiredProperties=function(t,e){if(void 0!==e.required)for(var n=0;n 10000");if(void 0!==_[t])throw new Error("Error already defined: "+t+" as "+_[t]);if(void 0!==v[e])throw new Error("Error code already used: "+v[e]+" as "+e);for(var i in _[t]=e,v[e]=t,w[t]=w[e]=n,S){var r=S[i];r[t]&&(r[e]=r[e]||r[t])}},reset:function(){i.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:m,resolveUrl:f,getDocumentUri:g,errorCodes:_};return r.language("en"),r}();return C.addLanguage("en-gb",w),C.tv4=C,C},void 0===(i=n.apply(e,[]))||(t.exports=i)},199:function(t,e,n){var i;"function"!=typeof fetch&&"function"!=typeof XMLHttpRequest&&(XMLHttpRequest=n(317)),function(){var n={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},r={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},s=["webfinger","host-meta","host-meta.json"];function o(t){return t.toString=function(){return this.message},t}function a(t){"object"!=typeof t&&(t={}),this.config={tls_only:void 0===t.tls_only||t.tls_only,webfist_fallback:void 0!==t.webfist_fallback&&t.webfist_fallback,uri_fallback:void 0!==t.uri_fallback&&t.uri_fallback,request_timeout:void 0!==t.request_timeout?t.request_timeout:1e4}}a.prototype.__fetchJRD=function(t,e,n){if("function"==typeof fetch)return this.__fetchJRD_fetch(t,e,n);if("function"==typeof XMLHttpRequest)return this.__fetchJRD_XHR(t,e,n);throw new Error("add a polyfill for fetch or XMLHttpRequest")},a.prototype.__fetchJRD_fetch=function(t,e,n){var i,r=this;"function"==typeof AbortController&&(i=new AbortController);var s=fetch(t,{headers:{Accept:"application/jrd+json, application/json"},signal:i?i.signal:void 0}).then(function(e){if(e.ok)return e.text();throw 404===e.status?o({message:"resource not found",url:t,status:e.status}):o({message:"error during request",url:t,status:e.status})},function(e){throw o({message:"error during request",url:t,status:void 0,err:e})}).then(function(e){if(r.__isValidJSON(e))return e;throw o({message:"invalid json",url:t,status:void 0})}),a=new Promise(function(e,n){setTimeout(function(){n(o({message:"request timed out",url:t,status:void 0})),i&&i.abort()},r.config.request_timeout)});Promise.race([s,a]).then(function(t){n(t)}).catch(function(t){e(t)})},a.prototype.__fetchJRD_XHR=function(t,e,n){var i=this,r=!1,s=new XMLHttpRequest;function a(){if(!r)return r=!0,200===s.status?i.__isValidJSON(s.responseText)?n(s.responseText):e(o({message:"invalid json",url:t,status:s.status})):404===s.status?e(o({message:"resource not found",url:t,status:s.status})):s.status>=301&&s.status<=302?function(t){return"string"==typeof t&&"https"===t.split("://")[0]}(s.getResponseHeader("Location"))?l():e(o({message:"no redirect URL found",url:t,status:s.status})):e(o({message:"error during request",url:t,status:s.status}))}function l(){s.onreadystatechange=function(){4===s.readyState&&a()},s.onload=function(){a()},s.ontimeout=function(){return e(o({message:"request timed out",url:t,status:s.status}))},s.open("GET",t,!0),s.timeout=i.config.request_timeout,s.setRequestHeader("Accept","application/jrd+json, application/json"),s.send()}return l()},a.prototype.__isValidJSON=function(t){try{JSON.parse(t)}catch(t){return!1}return!0},a.prototype.__isLocalhost=function(t){return/^localhost(\.localdomain)?(\:[0-9]+)?$/.test(t)},a.prototype.__processJRD=function(t,e,i,s){var a=JSON.parse(e);if("object"!=typeof a||"object"!=typeof a.links)return void 0!==a.error?i(o({message:a.error,request:t})):i(o({message:"unknown response from server",request:t}));var l=a.links;Array.isArray(l)||(l=[]);var c={object:a,json:e,idx:{}};c.idx.properties={name:void 0},c.idx.links=JSON.parse(JSON.stringify(r)),l.map(function(t){if(n.hasOwnProperty(t.rel)&&c.idx.links[n[t.rel]]){var e={};Object.keys(t).map(function(n){e[n]=t[n]}),c.idx.links[n[t.rel]].push(e)}});var u=JSON.parse(e).properties;for(var h in u)u.hasOwnProperty(h)&&"http://packetizer.com/ns/name"===h&&(c.idx.properties.name=u[h]);return s(c)},a.prototype.lookup=function(t,e){if("string"!=typeof t)throw new Error("first parameter must be a user address");if("function"!=typeof e)throw new Error("second parameter must be a callback");var n=this,i="";i=t.indexOf("://")>-1?t.replace(/ /g,"").split("/")[2]:t.replace(/ /g,"").split("@")[1];var r=0,o="https";function a(){var e="";return t.split("://")[1]||(e="acct:"),o+"://"+i+"/.well-known/"+s[r]+"?resource="+e+t}function l(t){if(n.config.uri_fallback&&"webfist.org"!==i&&r!==s.length-1)return r+=1,c();if(!n.config.tls_only&&"https"===o)return r=0,o="http",c();if(!n.config.webfist_fallback||"webfist.org"===i)return e(t);r=0,o="http",i="webfist.org";var l=a();n.__fetchJRD(l,e,function(t){n.__processJRD(l,t,e,function(t){"object"==typeof t.idx.links.webfist&&"string"==typeof t.idx.links.webfist[0].href&&n.__fetchJRD(t.idx.links.webfist[0].href,e,function(t){n.__processJRD(l,t,e,function(){return e(null,e)})})})})}function c(){var t=a();n.__fetchJRD(t,l,function(i){n.__processJRD(t,i,e,function(t){e(null,t)})})}return n.__isLocalhost(i)&&(o="http"),setTimeout(c,0)},a.prototype.lookupLink=function(t,e,n){if(!r.hasOwnProperty(e))return n("unsupported rel "+e);this.lookup(t,function(t,i){var r=i.idx.links[e];return t?n(t):0===r.length?n('no links found with rel="'+e+'"'):n(null,r[0])})},void 0===(i=function(){return a}.apply(e,[]))||(t.exports=i)}()},317:function(t){t.exports=XMLHttpRequest}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n(423).default}()),Ux.exports); +/*! For license information please see remotestorage.js.LICENSE.txt */const qx=jx(Bx),Vx="0123456789bcdefghjkmnpqrstuvwxyz";class $x{static encode(t,e,n){if(void 0===n){for(let n=1;n<=12;n++){const i=$x.encode(t,e,n),r=$x.decode(i);if(r.lat==t&&r.lon==e)return i}n=12}if(t=Number(t),e=Number(e),n=Number(n),isNaN(t)||isNaN(e)||isNaN(n))throw new Error("Invalid geohash");let i=0,r=0,s=!0,o="",a=-90,l=90,c=-180,u=180;for(;o.length=t?(i=2*i+1,c=t):(i*=2,u=t)}else{const e=(a+l)/2;t>=e?(i=2*i+1,a=e):(i*=2,l=e)}s=!s,5==++r&&(o+=Vx.charAt(i),r=0,i=0)}return o}static decode(t){const e=$x.bounds(t),n=e.sw.lat,i=e.sw.lon,r=e.ne.lat,s=e.ne.lon;let o=(n+r)/2,a=(i+s)/2;return o=o.toFixed(Math.floor(2-Math.log(r-n)/Math.LN10)),a=a.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),{lat:Number(o),lon:Number(a)}}static bounds(t){if(0==t.length)throw new Error("Invalid geohash");t=t.toLowerCase();let e=!0,n=-90,i=90,r=-180,s=180;for(let o=0;o=0;t--){const o=l>>t&1;if(e){const t=(r+s)/2;1==o?r=t:s=t}else{const t=(n+i)/2;1==o?n=t:i=t}e=!e}}return{sw:{lat:n,lon:r},ne:{lat:i,lon:s}}}static adjacent(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0==t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(e))throw new Error("Invalid direction");const n=t.slice(-1);let i=t.slice(0,-1);const r=t.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[e][r].indexOf(n)&&""!=i&&(i=$x.adjacent(i,e)),i+Vx.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[e][r].indexOf(n))}static neighbours(t){return{n:$x.adjacent(t,"n"),ne:$x.adjacent($x.adjacent(t,"n"),"e"),e:$x.adjacent(t,"e"),se:$x.adjacent($x.adjacent(t,"s"),"e"),s:$x.adjacent(t,"s"),sw:$x.adjacent($x.adjacent(t,"s"),"w"),w:$x.adjacent(t,"w"),nw:$x.adjacent($x.adjacent(t,"n"),"w")}}}const Gx="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Wx=0xffffffffffff;var Hx;!function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"}(Hx||(Hx={}));class Kx extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function Xx(t){const e=Math.floor(32*t())%32;return Gx.charAt(e)}const Yx={type:"object",properties:{id:{type:"string"},title:{type:"string"},lat:{type:"number"},lon:{type:"number"},geohash:{type:"string"},zoom:{type:"number"},url:{type:"string"},osmId:{type:"string"},osmType:{type:"string"},osmTags:{type:"object",additionalProperties:{type:"string"}},description:{type:"string"},tags:{type:"array",items:{type:"string"},default:[]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","title","lat","lon","geohash","createdAt"]},Zx={name:"places",builder:function(t){function e(t,e){return`${t.substring(0,2)}/${t.substring(2,4)}/${e}`}t.declareType("place",Yx);const n={store:async function(n){const i=function(t){const e=(new Date).toISOString(),n=t.id||function(){const t=function(){const t="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null,e=t&&(t.crypto||t.msCrypto)||null;if("function"==typeof e?.getRandomValues)return()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]/256};if("function"==typeof e?.randomBytes)return()=>e.randomBytes(1).readUInt8()/256;throw new Kx(Hx.PRNGDetectFailure,"Failed to find a reliable PRNG")}();return function(t,e=10){if(isNaN(t))throw new Kx(Hx.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>Wx)throw new Kx(Hx.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Wx}: ${t}`);if(t<0)throw new Kx(Hx.EncodeTimeNegative,`Time must be positive: ${t}`);if(!1===Number.isInteger(t))throw new Kx(Hx.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,i="";for(let r=e;r>0;r--)n=t%32,i=Gx.charAt(n)+i,t=(t-n)/32;return i}(Date.now(),10)+function(t,e){let n="";for(;t>0;t--)n=Xx(e)+n;return n}(16,t)}(),i="number"==typeof t.lat?t.lat:0,r="number"==typeof t.lon?t.lon:0,s=t.title||"Untitled Place",o=t.geohash||$x.encode(i,r,10),a={...t,id:n,lat:i,lon:r,geohash:o,title:s,tags:t.tags||[],createdAt:t.createdAt||e,updatedAt:t.id?e:void 0};return Object.keys(a).forEach(t=>{void 0===a[t]&&delete a[t]}),a}(n),r=e(i.geohash,i.id);return await t.storeObject("place",r,i),i},remove:async function(n,i){if(!n||!i)throw new Error("Both id and geohash are required to remove a place");const r=e(i,n);return t.remove(r)},get:async function(n,i){if(!n||!i)throw new Error("Both id and geohash are required to get a place");const r=e(i,n);return t.getObject(r)},listByPrefix:async function(e){let n="";return e.length>=2&&(n+=e.substring(0,2)+"/"),e.length>=4&&(n+=e.substring(2,4)+"/"),t.getAll(n)},getPlaces:async function(e){const n=[],i=async e=>{const i=await t.getAll(e,!1);i&&Object.values(i).forEach(t=>{t&&"object"==typeof t&&!t.toString().endsWith("/")&&n.push(t)})};if(e&&e.length>0){const t=e.map(async t=>{if(t.length<4)return;const e=t.substring(0,2),n=t.substring(2,4);await i(`${e}/${n}/`)});await Promise.all(t)}else{const e=t=>{if(!t||"object"!=typeof t)return[];let e=t;return t.items&&"object"==typeof t.items&&(e=t.items),Object.keys(e).filter(t=>t.endsWith("/")&&!t.startsWith("@"))},n=await t.getListing("",!1),r=e(n);await Promise.all(r.map(async n=>{const r=await t.getListing(n,!1),s=e(r);await Promise.all(s.map(async t=>{await i(n+t)}))}))}return n}};return{exports:n}}};var Jx,Qx={exports:{}};const tS=jx((Jx||(Jx=1,self,Qx.exports=(()=>{var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>i});var n=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rs=e,this.leaveOpen=!!n.leaveOpen&&n.leaveOpen,this.autoCloseAfter=n.autoCloseAfter?n.autoCloseAfter:1500,this.skipInitial=!!n.skipInitial&&n.skipInitial,this.logging=!!n.logging&&n.logging,this.parentContainerEl=null,n.hasOwnProperty("modalBackdrop")){if("boolean"!=typeof n.modalBackdrop&&"onlySmallScreens"!==n.modalBackdrop)throw'options.modalBackdrop has to be true/false or "onlySmallScreens"';this.modalBackdrop=n.modalBackdrop}else this.modalBackdrop="onlySmallScreens";this.active=!1,this.online=!1,this.closed=!1,this.lastSynced=null,this.lastSyncedUpdateLoop=null}var e,n;return e=t,n=[{key:"log",value:function(){if(this.logging){for(var t,e=arguments.length,n=new Array(e),i=0;i

Connect your storage

To sync data with your account
';var e=document.createElement("style");return e.innerHTML='#remotestorage-widget {\n z-index: 21000000;\n}\n\n.rs-widget {\n box-sizing: border-box;\n overflow: hidden;\n max-width: 350px;\n padding: 10px;\n margin: 10px;\n border-radius: 3px;\n background-color: #fff;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n font-family: arial, sans-serif;\n font-size: 16px;\n color: #333;\n will-change: max-height, height, width, opacity, max-width, background, box-shadow;\n transition-property: width, height, opacity, max-width, max-height, background, box-shadow;\n transition-duration: 300ms;\n}\n\n.rs-widget * {\n box-sizing: border-box;\n}\n\n.rs-widget .rs-hidden {\n display: none;\n}\n\n.rs-box {\n overflow: hidden;\n will-change: height;\n transition-property: height, width, max-height;\n transition-duration: 300ms;\n transition-timing-function: ease-in;\n opacity: 0;\n max-height: 0px;\n}\n\n.rs-box.rs-selected:not([aria-hidden=true]) {\n opacity: 1;\n max-height: 420px;\n}\n\n/* Main logo */\n.rs-main-logo {\n float: left;\n height: 36px;\n width: 36px;\n margin-top: 1px;\n margin-right: 0.625em;\n transition: margin-left 300ms ease-out, transform 300ms ease-out;\n cursor: pointer;\n}\n.rs-widget .rs-backend-remotestorage svg#rs-main-logo-remotestorage {\n display: block;\n}\n.rs-widget[class*="rs-backend-"]:not(.rs-backend-remotestorage) svg#rs-main-logo-remotestorage {\n display: none;\n}\n.rs-widget.rs-backend-dropbox svg#rs-main-logo-dropbox {\n display: block;\n}\n.rs-widget:not(.rs-backend-dropbox) svg#rs-main-logo-dropbox {\n display: none;\n}\n.rs-widget.rs-backend-googledrive svg#rs-main-logo-googledrive {\n display: block;\n}\n.rs-widget:not(.rs-backend-googledrive) svg#rs-main-logo-googledrive {\n display: none;\n}\n\npolygon.rs-logo-shape {\n fill: #FF4B03;\n}\n\npolygon.rs-logo-shape,\n#rs-main-logo-dropbox path,\n#rs-main-logo-googledrive path {\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n.rs-offline polygon.rs-logo-shape,\n.rs-offline #rs-main-logo-dropbox path,\n.rs-offline #rs-main-logo-googledrive path {\n fill: #888;\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n/* Hide everything except logo when connected and clicked outside of box */\n.rs-closed {\n max-width: 56px;\n background-color: transparent;\n box-shadow: none;\n opacity: 0.5;\n\n transition: max-height 100ms ease-out 0ms, max-width 300ms ease-out 300ms, background 300ms ease-in 200ms, opacity 300ms ease 200ms;\n}\n\n.rs-closed:hover {\n cursor: pointer;\n opacity: 1;\n}\n\n.rs-box-initial {\n transition-duration: 0ms;\n}\n\n.rs-box-initial:hover {\n cursor: pointer;\n}\n\n.rs-widget a {\n color: #0093cc;\n}\n\n/* HEADLINE */\n.rs-small-headline {\n font-size: 1em;\n font-weight: bold;\n margin: 0;\n margin-bottom: 2px;\n height: 1.2em;\n word-break: break-all;\n overflow: hidden;\n line-height: 1em;\n}\n\n.rs-sub-headline {\n word-break: break-all;\n overflow: hidden;\n color: #666;\n font-size: 0.92em;\n height: 1.2em;\n}\n.rs-big-headline {\n font-size: 1.625em;\n font-weight: normal;\n text-align: center;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n/* BUTTONS */\n.rs-button {\n font: inherit;\n color: inherit;\n background-color: transparent;\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n cursor: pointer;\n}\n.rs-button-small {\n padding: 0.6em 0.7em;\n margin-left: 0.2em;\n transition: border-color 300ms ease-out;\n}\n.rs-button-small svg {\n vertical-align: top;\n}\n.rs-button-wrap {\n margin-top: 10px;\n}\n\n.rs-button-wrap img,\n.rs-button-wrap svg {\n float: left;\n margin-right: 0.6em;\n width: 40px;\n height: 40px;\n}\n\n.rs-button-big {\n padding: 15px 10px;\n margin-bottom: 10px;\n display: block;\n width: 100%;\n text-align: left;\n transition: box-shadow 200ms;\n}\n.rs-button-big > div {\n font-size: 1.125em;\n padding: 10px 0;\n}\n.rs-button-big:hover {\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:active {\n background-color: #eee;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:last-child {\n margin-bottom: 0;\n}\n\n.rs-content {\n padding: 0 10px 10px 10px;\n}\n\n\n.rs-state-choose .rs-main-logo,\n.rs-state-sign-in .rs-main-logo {\n margin-left: 45%;\n float: none;\n}\n\n.rs-sign-in-form input[type=text] {\n padding: 15px 10px;\n display: block;\n width: 100%;\n font: inherit;\n height: 52px;\n border: 1px solid #aaa;\n border-radius: 0;\n box-shadow: none;\n}\n.rs-sign-in-form button.rs-connect {\n padding: 15px 10px;\n margin-top: 20px;\n margin-bottom: 15px;\n display: block;\n width: 100%;\n border: none;\n border-radius: 3px;\n background-color: #3fb34f;\n font: inherit;\n color: #fff;\n transition: box-shadow 200ms, background-color 200ms;\n}\n\n.rs-sign-in-form button.rs-connect:hover {\n cursor: pointer;\n background-color: #4BCB5D;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n\n.rs-sign-in-form button.rs-connect:active {\n background-color: #3fb34f;\n}\n\n.rs-sign-in-form button.rs-connect:disabled,\n.rs-sign-in-form button.rs-connect:disabled:hover {\n background-color: #aaa;\n}\n\n.rs-sign-in-form button.rs-connecting svg {\n height: 1em;\n width: auto;\n vertical-align: middle;\n margin-left: 0.5em;\n animation: rs-spin 1s linear infinite;\n}\n\n.rs-sign-in-error.rs-hidden,\n.rs-box-error.rs-hidden {\n height: 0;\n}\n\n.rs-sign-in-error.rs-visible,\n.rs-box-error.rs-visible {\n height: auto;\n border-radius: 3px;\n padding: 0.5em 0.5em;\n margin-top: 0.5em;\n text-align: center;\n background-color: rgba(255,0,0,0.1);\n color: darkred;\n}\n\n.rs-box-error {\n display: flex;\n flex-direction: row;\n}\n\n.rs-box-error .rs-error-message {\n flex: auto;\n}\n\n /*Choose provider box */\n.rs-box-choose {\n text-align: center;\n overflow: hidden;\n}\n\n.rs-box-choose p {\n margin-top: 0;\n margin-bottom: 20px;\n line-height: 1.4em;\n}\n\n/*Connected box */\n.rs-box-connected {\n display: flex;\n flex-direction: row;\n height: 40px;\n transition: height 0s;\n}\n.rs-connected-text {\n flex: auto;\n min-width: 0;\n}\n.rs-box-connected .rs-user {\n font-weight: bold;\n text-overflow: ellipsis;\n overflow: hidden;\n word-break: keep-all;\n}\n.rs-connected-buttons, .rs-error-buttons {\n flex: none;\n}\n.rs-disconnect:hover {\n border-color: #FF2D2D;\n}\n.rs-disconnect:hover .rs-icon{\n fill: #FF2D2D;\n}\n.rs-sync:hover {\n border-color: #FFBB0C;\n}\n.rs-sync:hover .rs-icon {\n fill: #FFBB0C;\n}\n.rs-sync.rs-rotate {\n border-color: #FFBB0C;\n}\n.rs-sync.rs-rotate .rs-icon {\n fill: #FFBB0C;\n animation: rs-spin 1s linear infinite;\n}\n\n/* Floating widget styles (top right corner) */\n.rs-floating {\n position: fixed;\n top: 0;\n right: 0;\n}\n\n@keyframes rs-spin {\n 100% {\n transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n/* Small/mobile screens */\n@media screen and (max-width: 420px) {\n .rs-widget {\n font-size: 100%;\n transition: all 300ms ease-out;\n max-width: 400px;\n }\n .rs-floating {\n position: relative;\n top: auto;\n right: auto\n }\n .rs-closed {\n max-width: 56px;\n }\n .rs-state-choose,\n .rs-state-sign-in {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n max-width: 100%;\n }\n}\n\n/* remove dotted outline border on Firefox */\n.rs-widget a:focus,\n.rs-widget a:active,\n.rs-widget button:focus,\n.rs-widget input:focus {\n outline:none;\n}\n.rs-widget button::-moz-focus-inner,\n.rs-widget input[type="button"]::-moz-focus-inner {\n border:0;\n}\n\n/* prevent rounded buttons on mobile Safari */\n.rs-widget button,\n.rs-widget input[type="button"] {\n -webkit-appearance: none;\n}\n\n.remotestorage-widget-modal-backdrop {\n display: none;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: opacity 0.3s linear;\n}\n\n.remotestorage-widget-modal-backdrop.visible {\n opacity: 1;\n transition: opacity 0.3s linear;\n}\n',t.appendChild(e),t}},{key:"setModalClass",value:function(){if(this.modalBackdrop){if("onlySmallScreens"===this.modalBackdrop&&!this.isSmallScreen())return;this.rsWidget.classList.add("rs-modal")}}},{key:"setupElements",value:function(){if(!this.parentContainerEl)throw new Error("Parent container element not found");this.rsWidget=this.parentContainerEl.querySelector(".rs-widget"),this.rsBackdrop=this.parentContainerEl.querySelector(".remotestorage-widget-modal-backdrop"),this.rsInitial=this.parentContainerEl.querySelector(".rs-box-initial"),this.rsChoose=this.parentContainerEl.querySelector(".rs-box-choose"),this.rsConnected=this.parentContainerEl.querySelector(".rs-box-connected"),this.rsSignIn=this.parentContainerEl.querySelector(".rs-box-sign-in"),this.rsConnectedLabel=this.parentContainerEl.querySelector(".rs-box-connected .rs-sub-headline"),this.rsChooseRemoteStorageButton=this.parentContainerEl.querySelector("button.rs-choose-rs"),this.rsChooseDropboxButton=this.parentContainerEl.querySelector("button.rs-choose-dropbox"),this.rsChooseGoogleDriveButton=this.parentContainerEl.querySelector("button.rs-choose-googledrive"),this.rsErrorBox=this.parentContainerEl.querySelector(".rs-box-error .rs-error-message"),this.rs.apiKeys.hasOwnProperty("googledrive")||this.rsChooseGoogleDriveButton.parentNode.removeChild(this.rsChooseGoogleDriveButton),this.rs.apiKeys.hasOwnProperty("dropbox")||this.rsChooseDropboxButton.parentNode.removeChild(this.rsChooseDropboxButton),this.rsSignInForm=this.parentContainerEl.querySelector(".rs-sign-in-form"),this.rsAddressInput=this.rsSignInForm.querySelector("input[name=rs-user-address]"),this.rsConnectButton=this.parentContainerEl.querySelector(".rs-connect"),this.rsDisconnectButton=this.parentContainerEl.querySelector(".rs-disconnect"),this.rsSyncButton=this.parentContainerEl.querySelector(".rs-sync"),this.rsLogo=this.parentContainerEl.querySelector(".rs-widget-icon"),this.rsErrorReconnectLink=this.parentContainerEl.querySelector(".rs-box-error a.rs-reconnect"),this.rsErrorDisconnectButton=this.parentContainerEl.querySelector(".rs-box-error button.rs-disconnect"),this.rsConnectedUser=this.parentContainerEl.querySelector(".rs-connected-text h1.rs-user")}},{key:"setupHandlers",value:function(){var t=this;this.rs.on("connected",function(){return t.eventHandler("connected")}),this.rs.on("ready",function(){return t.eventHandler("ready")}),this.rs.on("disconnected",function(){return t.eventHandler("disconnected")}),this.rs.on("network-online",function(){return t.eventHandler("network-online")}),this.rs.on("network-offline",function(){return t.eventHandler("network-offline")}),this.rs.on("error",function(e){return t.eventHandler("error",e)}),this.setEventListeners(),this.setClickHandlers()}},{key:"attach",value:function(t){var e=this.createHtmlTemplate(t);if(this.parentContainerEl,t instanceof HTMLElement)this.parentContainerEl=t;else if("string"==typeof t){if(this.parentContainerEl=document.getElementById(t),!this.parentContainerEl)throw new Error('Failed to find target DOM element with id="'+t+'"')}else{if(t)throw new Error("Unknown element type. Expected instance of HTMLElement or type of string.");this.parentContainerEl=document.body}this.parentContainerEl.appendChild(e),this.setupElements(),this.setupHandlers(),this.setInitialState(),this.setModalClass()}},{key:"setEventListeners",value:function(){var t=this;this.rsSignInForm.addEventListener("submit",function(e){e.preventDefault();var n=t.parentContainerEl.querySelector("input[name=rs-user-address]").value;t.disableConnectButton(),t.rs.connect(n)})}},{key:"showChooseOrSignIn",value:function(){this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.style.display="block",this.rsBackdrop.classList.add("visible")),this.rs.apiKeys&&Object.keys(this.rs.apiKeys).length>0?this.setState("choose"):this.setState("sign-in")}},{key:"setClickHandlers",value:function(){var t=this;this.rsInitial.addEventListener("click",function(){return t.showChooseOrSignIn()}),this.rsChooseRemoteStorageButton.addEventListener("click",function(){t.setState("sign-in"),t.rsAddressInput.focus()}),this.rsChooseDropboxButton.addEventListener("click",function(){return t.rs.dropbox.connect()}),this.rsChooseGoogleDriveButton.addEventListener("click",function(){return t.rs.googledrive.connect()}),this.rsDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rsErrorReconnectLink.addEventListener("click",function(){return t.rs.reconnect()}),this.rsErrorDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rs.hasFeature("Sync")&&this.rsSyncButton.addEventListener("click",function(){t.rsSyncButton.classList.contains("rs-rotate")?(t.rs.stopSync(),t.rsSyncButton.classList.remove("rs-rotate")):(t.rsConnectedLabel.textContent="Synchronizing",t.rs.startSync(),t.rsSyncButton.classList.add("rs-rotate"))}),document.addEventListener("click",function(){return t.close()}),this.rsWidget.addEventListener("click",function(t){return t.stopPropagation()}),this.rsLogo.addEventListener("click",function(){return t.toggle()})}},{key:"toggle",value:function(){this.closed?this.open():"initial"===this.state?this.showChooseOrSignIn():this.close()}},{key:"open",value:function(){this.closed=!1,this.rsWidget.classList.remove("rs-closed"),this.shouldCloseWhenSyncDone=!1;var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&t.setAttribute("aria-hidden","false")}},{key:"close",value:function(){var t=this;if("error"!==this.state){if(!this.leaveOpen&&this.active){this.closed=!0,this.rsWidget.classList.add("rs-closed");var e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&e.setAttribute("aria-hidden","true")}else this.active?this.setState("connected"):this.setInitialState();this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.classList.remove("visible"),setTimeout(function(){t.rsBackdrop.style.display="none"},300))}}},{key:"disableConnectButton",value:function(){this.rsConnectButton.disabled=!0,this.rsConnectButton.classList.add("rs-connecting"),this.rsConnectButton.innerHTML="Connecting ".concat('\n \n \n \n \n \n \n\n')}},{key:"enableConnectButton",value:function(){this.rsConnectButton.disabled=!1,this.rsConnectButton.textContent="Connect",this.rsConnectButton.classList.remove("rs-connecting")}},{key:"setOffline",value:function(){this.online&&(this.rsWidget.classList.add("rs-offline"),this.rsConnectedLabel.textContent="Offline",this.online=!1)}},{key:"setOnline",value:function(){this.online||(this.rsWidget.classList.remove("rs-offline"),this.active&&(this.rsConnectedLabel.textContent="Connected")),this.online=!0}},{key:"setBackendClass",value:function(t){this.rsWidget.classList.remove("rs-backend-remotestorage"),this.rsWidget.classList.remove("rs-backend-dropbox"),this.rsWidget.classList.remove("rs-backend-googledrive"),t&&this.rsWidget.classList.add("rs-backend-".concat(t))}},{key:"showErrorBox",value:function(t){this.rsErrorBox.innerHTML=t,this.setState("error")}},{key:"hideErrorBox",value:function(){this.rsErrorBox.innerHTML="",this.close()}},{key:"handleSyncStarted",value:function(){var t=this;this.syncInProgress=!0,this.rsSyncButton.classList.add("rs-rotate"),setTimeout(function(){t.syncInProgress&&(t.rsConnectedLabel.textContent="Synchronizing")},1e3)}},{key:"handleDiscoveryError",value:function(t){var e=this.parentContainerEl.querySelector(".rs-sign-in-error");e.innerHTML=t.message,e.classList.remove("rs-hidden"),e.classList.add("rs-visible"),this.enableConnectButton()}},{key:"handleSyncError",value:function(){this.setOffline()}},{key:"handleUnauthorized",value:function(t){t.code&&"access_denied"===t.code?this.rs.disconnect():(this.open(),this.showErrorBox(t.message+" "),this.rsErrorBox.appendChild(this.rsErrorReconnectLink),this.rsErrorReconnectLink.classList.remove("rs-hidden"))}},{key:"updateLastSyncedStatus",value:function(){var t=new Date;this.online?(this.lastSynced=t,this.rsConnectedLabel.textContent="Synced"):this.rsWidget.classList.contains("rs-state-unauthorized")||(this.rsConnectedLabel.textContent="Offline")}},{key:"isSmallScreen",value:function(){return window.innerWidth<421}}],n&&function(t,e){for(var n=0;n20||Math.abs(r-n)>20)return console.warn("BBox too large for 4-char geohash scanning, aborting fine scan."),[];for(let a=e;a<=i+.1;a+=.1)for(let t=n;t<=r+.1;t+=.1){const e=Math.min(a,i),n=Math.min(t,r);try{const t=$x.encode(e,n,4);s.add(t)}catch(o){}}try{s.add($x.encode(e,n,4))}catch(o){}try{s.add($x.encode(i,r,4))}catch(o){}try{s.add($x.encode(e,r,4))}catch(o){}try{s.add($x.encode(i,n,4))}catch(o){}return Array.from(s)}const nS=Object.freeze(Object.defineProperty({__proto__:null,getGeohashPrefixesInBbox:eS},Symbol.toStringTag,{value:"Module"})),iS=Object.assign({},g.FEATURES);function rS(t){let e=iS[t];return!0===e||!1===e?e:!!g.ENABLE_OPTIONAL_FEATURES}function sS(t){return Sf(t)||"string"==typeof t&&!1===/\S/.test(t)}function oS(t){return!sS(t)}function aS(t,e){return t&&"function"==typeof t.isEqual?t.isEqual(e):t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():t===e}let lS={};function cS(t){lS=t}function uS(){return lS}function hS(t,e){return Wi(t,e)}function dS(t,e){if(Symbol.iterator in t)for(let n of t)e(n);else t.forEach,t.forEach(e)}class pS{recordCaches=new Map;added=[];updated=[];removed=[];getCacheForItem(t){let e=this.recordCaches.get(t);if(!e){let n=!1;e=qe(()=>{n?this.updated.push(this.wrapRecord(t)):(this.added.push(this.wrapRecord(t)),n=!0)}),this.recordCaches.set(t,e)}return e}constructor(t,e,n,i,r,s){this.wrapRecord=r,this.release=s,this.recordArrayCache=qe(()=>{let s=new Set;De(on(t,"[]")),dS(t,t=>{Ve(this.getCacheForItem(t)),s.add(t)}),We(()=>{this.recordCaches.forEach((t,e)=>{s.has(e)||(this.removed.push(r(e)),this.recordCaches.delete(e))})}),this.added.length>0&&(e(this.added),this.added=[]),this.updated.length>0&&(n(this.updated),this.updated=[]),this.removed.length>0&&(i(this.removed),this.removed=[])})}revalidate(){Ve(this.recordArrayCache)}}class fS{constructor(t,e,n){this.release=n;let i=!1;this.cache=qe(()=>{dS(t,()=>{}),De(on(t,"[]")),!0===i?xa(e):i=!0}),this.release=n}revalidate(){Ve(this.cache)}}class gS extends Tu{releaseMethods=id();recordsWatchers=new Map;typeWatchers=new Map;flushWatchers=null;constructor(t){super(t),this.containerDebugAdapter=ur(this).lookup("container-debug-adapter:main")}attributeLimit=3;acceptsModelName=!0;getFilters(){return id()}watchModelTypes(t,e){let n,i=this.getModelTypes(),r=id();n=i.map(t=>{let n=t.klass,i=this.wrapModelType(n,t.name);return r.push(this.observeModelType(t.name,e)),i}),t(n);let s=()=>{r.forEach(t=>t()),this.releaseMethods.removeObject(s)};return this.releaseMethods.pushObject(s),s}_nameToClass(t){if("string"==typeof t){let e=ur(this).factoryFor(`model:${t}`);t=e&&e.class}return t}watchRecords(t,e,n,i){let r=this._nameToClass(t),s=this.getRecords(r,t),{recordsWatchers:o}=this,a=o.get(s);return a||(a=new pS(s,e,n,i,t=>this.wrapRecord(t),()=>{o.delete(s),this.updateFlushWatchers()}),o.set(s,a),this.updateFlushWatchers(),a.revalidate()),a.release}updateFlushWatchers(){null===this.flushWatchers?(this.typeWatchers.size>0||this.recordsWatchers.size>0)&&(this.flushWatchers=()=>{this.typeWatchers.forEach(t=>t.revalidate()),this.recordsWatchers.forEach(t=>t.revalidate())},ga.on("end",this.flushWatchers)):0===this.typeWatchers.size&&0===this.recordsWatchers.size&&(ga.off("end",this.flushWatchers),this.flushWatchers=null)}willDestroy(){this._super(...arguments),this.typeWatchers.forEach(t=>t.release()),this.recordsWatchers.forEach(t=>t.release()),this.releaseMethods.forEach(t=>t()),this.flushWatchers&&ga.off("end",this.flushWatchers)}detect(t){return!1}columnsForType(t){return id()}observeModelType(t,e){let n=this._nameToClass(t),i=this.getRecords(n,t),{typeWatchers:r}=this,s=r.get(i);return s||(s=new fS(i,()=>{e([this.wrapModelType(n,t)])},()=>{r.delete(i),this.updateFlushWatchers()}),r.set(i,s),this.updateFlushWatchers(),s.revalidate()),s.release}wrapModelType(t,e){return{name:e,count:Ss(this.getRecords(t,e),"length"),columns:this.columnsForType(t),object:t}}getModelTypes(){let t=this.containerDebugAdapter,e=(t.canCatalogEntriesByType("model")?t.catalogEntriesByType("model"):this._getObjectsOnNamespaces()).map(t=>({klass:this._nameToClass(t),name:t}));return e.filter(t=>this.detect(t.klass))}_getObjectsOnNamespaces(){let t=Hw.NAMESPACES,e=[];return t.forEach(t=>{for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!this.detect(t[n]))continue;let i=Af(n);e.push(i)}}),e}getRecords(t,e){return id()}wrapRecord(t){return{object:t,columnValues:this.getRecordColumnValues(t),searchKeywords:this.getRecordKeywords(t),filterValues:this.getRecordFilterValues(t),color:this.getRecordColor(t)}}getRecordColumnValues(t){return{}}getRecordKeywords(t){return id()}getRecordFilterValues(t){return{}}getRecordColor(t){return null}}const mS={willChange:"_arrangedContentArrayWillChange",didChange:"_arrangedContentArrayDidChange"};function yS(t,e){return"[]"===e?(t._revalidate(),t._arrTag):"length"===e?(t._revalidate(),t._lengthTag):on(t,e)}class _S extends Tu{_objectsDirtyIndex=0;_objects=null;_lengthDirty=!0;_length=0;_arrangedContent=null;_arrangedContentIsUpdating=!1;_arrangedContentTag=null;_arrangedContentRevision=null;_lengthTag=null;_arrTag=null;init(t){super.init(t),li(this,yS)}[is](){this._revalidate()}willDestroy(){this._removeArrangedContentArrayObserver()}objectAtContent(t){return dr(Ss(this,"arrangedContent"),t)}replace(t,e,n){this.replaceContent(t,e,n)}replaceContent(t,e,n){Ws(Ss(this,"content"),t,e,n)}objectAt(t){if(this._revalidate(),null===this._objects&&(this._objects=[]),-1!==this._objectsDirtyIndex&&t>=this._objectsDirtyIndex){let t=Ss(this,"arrangedContent");if(t){let e=this._objects.length=Ss(t,"length");for(let t=this._objectsDirtyIndex;tr)&&(this._objectsDirtyIndex=r),this._lengthDirty=!0,$s(this,e,n,i,!1)}_invalidate(){this._objectsDirtyIndex=0,this._lengthDirty=!0}_revalidate(){if(!0!==this._arrangedContentIsUpdating&&(null===this._arrangedContentTag||!de(this._arrangedContentTag,this._arrangedContentRevision))){let t=this.get("arrangedContent");null===this._arrangedContentTag?this._addArrangedContentArrayObserver(t):(this._arrangedContentIsUpdating=!0,this._updateArrangedContentArray(t),this._arrangedContentIsUpdating=!1);let e=this._arrangedContentTag=on(this,"arrangedContent");this._arrangedContentRevision=he(this._arrangedContentTag),H(t)?(this._lengthTag=ke([e,fr(t,"length")]),this._arrTag=ke([e,fr(t,"[]")])):this._lengthTag=this._arrTag=e}}}_S.reopen(td,{arrangedContent:js("content")});const vS=Object.freeze(Object.defineProperty({__proto__:null,default:_S},Symbol.toStringTag,{value:"Module"}));class bS extends nh{}bS.PrototypeMixin.reopen(Jl);const wS=Object.freeze(Object.defineProperty({__proto__:null,default:bS},Symbol.toStringTag,{value:"Module"})),xS=Bl.create({reason:null,isPending:ps("isSettled",function(){return!Ss(this,"isSettled")}).readOnly(),isSettled:ps("isRejected","isFulfilled",function(){return Ss(this,"isRejected")||Ss(this,"isFulfilled")}).readOnly(),isRejected:!1,isFulfilled:!1,promise:ps({get(){throw new Error("PromiseProxy's promise must be set")},set(t,e){return function(t,e){return Qs(t,{isFulfilled:!1,isRejected:!1}),e.then(e=>(t.isDestroyed||t.isDestroying||Qs(t,{content:e,isFulfilled:!0}),e),e=>{throw t.isDestroyed||t.isDestroying||Qs(t,{reason:e,isRejected:!0}),e},"Ember: PromiseProxy")}(this,e)}}),then:SS("then"),catch:SS("catch"),finally:SS("finally")});function SS(t){return function(...e){return Ss(this,"promise")[t](...e)}}const CS=Object.freeze(Object.defineProperty({__proto__:null,default:xS},Symbol.toStringTag,{value:"Module"}));function kS(t,e,n){return t.lookup(`controller:${e}`,n)}let ES;!function(t){function e(){}t.isNamespace=!0,t.toString=function(){return"Ember"},t.Container=pl,t.Registry=Cl,t._setComponentManager=hS,t._componentManagerCapabilities=Ni,t._modifierManagerCapabilities=$i,t.meta=ae,t._createCache=qe,t._cacheGetValue=Ve,t._cacheIsConst=$e,t._descriptor=Sr,t._getPath=ks,t._setClassicDecorator=Ar,t._tracked=Is,t.beginPropertyChanges=os,t.changeProperties=ls,t.endPropertyChanges=as,t.hasListeners=Br,t.libraries=Rs,t._ContainerProxyMixin=Hl,t._ProxyMixin=Jl,t._RegistryProxyMixin=Gl,t.ActionHandler=Xl,t.Comparable=Kl,t.ComponentLookup=Qw,t.EventDispatcher=Qu,t._Cache=sr,t.GUID_KEY=Q,t.canInvoke=Ww,t.generateGuid=tt,t.guidFor=et,t.uuid=X,t.wrap=mt,t.getOwner=ax,t.onLoad=hl,t.runLoadHooks=dl,t.setOwner=lx,t.Application=cx,t.ApplicationInstance=$w,t.Namespace=Hw,t.A=id,t.Array=Qh,t.NativeArray=ed,t.isArray=Yh,t.makeArray=fu,t.MutableArray=td,t.ArrayProxy=_S,t.FEATURES={isEnabled:rS,...iS},t._Input=Bv,t.Component=Cb,t.Helper=Tb,t.Controller=ad,t.ControllerMixin=od,t._captureRenderTree=A,t.assert=y,t.warn=z,t.debug=D,t.deprecate=$,t.deprecateFunc=V,t.runInDebug=U,t.inspect=M,t.Debug={registerDeprecationHandler:_,registerWarnHandler:x,isComputed:gs},t.ContainerDebugAdapter=Jw,t.DataAdapter=gS,t._assertDestroyablesDestroyed=jt,t._associateDestroyableChild=Gt,t._enableDestroyableTracking=Dt,t._isDestroying=Xt,t._isDestroyed=Yt,t._registerDestructor=vx,t._unregisterDestructor=bx,t.destroy=Ht,t.Engine=rx,t.EngineInstance=dd,t.Enumerable=Ql,t.MutableEnumerable=tc,t.instrument=oh,t.subscribe=uh,t.Instrumentation={instrument:oh,subscribe:uh,unsubscribe:hh,reset:dh},t.Object=Tu,t._action=Mu,t.computed=ps,t.defineProperty=ms,t.get=Ss,t.getProperties=Js,t.notifyPropertyChange=ss,t.observer=Iu,t.set=Ls,t.trySet=Ds,t.setProperties=Qs,t.cacheFor=Fs,t._dependentKeyCompat=fd,t.ComputedProperty=us,t.expandProperties=Lr,t.CoreObject=xu,t.Evented=th,t.on=qr,t.addListener=jr,t.removeListener=Nr,t.sendEvent=Ur,t.Mixin=Bl,t.mixin=Nl,t.Observable=ku,t.addObserver=Wr,t.removeObserver=Hr,t.PromiseProxyMixin=xS,t.ObjectProxy=bS,t.RouterDSL=Ap,t.controllerFor=kS,t.generateController=dp,t.generateControllerFactory=hp,t.HashLocation=yf,t.HistoryLocation=bf,t.NoneLocation=wf,t.Route=Sp,t.Router=sf,t.run=ma,t.Service=Bf,t.compare=Dh,t.isBlank=sS,t.isEmpty=Sf,t.isEqual=aS,t.isNone=xf,t.isPresent=oS,t.typeOf=Fh,t.VERSION=or,t.ViewUtils={getChildViews:Wu,getElementView:Nu,getRootViews:Lu,getViewBounds:Ku,getViewBoundingClientRect:Zu,getViewClientRects:Yu,getViewElement:Uu,isSimpleClick:Au,isSerializationFirstNode:cv},t._getComponentTemplate=Ji,t._helperManagerCapabilities=_i,t._setComponentTemplate=Zi,t._setHelperManager=Ki,t._setModifierManager=Hi,t._templateOnlyComponent=zy,t._invokeHelper=p_,t._hash=u_,t._array=s_,t._concat=a_,t._get=c_,t._on=__,t._fn=l_,t._Backburner=ua,t.inject=e,e.controller=ld,e.service=Uf,t.__loader={get require(){return globalThis.require},get define(){return globalThis.define},get registry(){let t=globalThis;return t.requirejs?.entries??t.require.entries}}}(ES||(ES={})),Reflect.set(ES,"RSVP",hu),Object.defineProperty(ES,"ENV",{get:m,enumerable:!1}),Object.defineProperty(ES,"lookup",{get:p,set:f,enumerable:!1}),Object.defineProperty(ES,"onerror",{get:function(){return So},set:function(t){So=t},enumerable:!1}),Object.defineProperty(ES,"testing",{get:b,set:w,enumerable:!1}),Object.defineProperty(ES,"BOOTED",{configurable:!1,enumerable:!1,get:mo,set:yo}),Object.defineProperty(ES,"TEMPLATES",{get:uS,set:cS,configurable:!1,enumerable:!1}),Object.defineProperty(ES,"TEMPLATES",{get:uS,set:cS,configurable:!1,enumerable:!1}),Object.defineProperty(ES,"testing",{get:b,set:w,enumerable:!1}),dl("Ember.Application",cx);let TS={template:Qg,Utils:{}},RS={template:Qg};function PS(t){Object.defineProperty(ES,t,{configurable:!0,enumerable:!0,get:()=>"Handlebars"===t?TS:RS})}function MS(t){Object.defineProperty(ES,t,{configurable:!0,enumerable:!0,get(){}})}PS("HTMLBars"),PS("Handlebars"),MS("Test"),MS("setupForTesting"),dl("Ember"),new Proxy(ES,{get:(t,e,n)=>("string"==typeof e&&Nf(`importing ${e} from the 'ember' barrel file is deprecated.`,jf.DEPRECATE_IMPORT_EMBER(e)),Reflect.get(t,e,n)),getOwnPropertyDescriptor:(t,e)=>("string"==typeof e&&Nf(`importing ${e} from the 'ember' barrel file is deprecated.`,jf.DEPRECATE_IMPORT_EMBER(e)),Object.getOwnPropertyDescriptor(t,e))});const IS=new WeakMap;function OS(t,e,...n){if(t[e],t.isDestroying)return;"boolean"==typeof n[n.length-1]&&n[n.length-2];let i=IS.get(t);var r;let s;i||(i=new Map,IS.set(t,i),vx(t,(r=i,function(){0!==r.size&&r.forEach(t=>Sa(t.cancelId))}))),s=i.has(e)?i.get(e).debouncedTask:(...n)=>{i.delete(e),t[e](...n)};let o=Ca(t,s,...n);i.set(e,{debouncedTask:s,cancelId:o})}class AS extends Bf{rs;widget;static{Tx(this.prototype,"placesInView",[Is],function(){return[]})}#D=void Px(this,"placesInView");static{Tx(this.prototype,"savedPlaces",[Is],function(){return[]})}#j=void Px(this,"savedPlaces");static{Tx(this.prototype,"loadedPrefixes",[Is],function(){return[]})}#N=void Px(this,"loadedPrefixes");static{Tx(this.prototype,"currentBbox",[Is],function(){return null})}#U=void Px(this,"currentBbox");static{Tx(this.prototype,"version",[Is],function(){return 0})}#B=void Px(this,"version");static{Tx(this.prototype,"initialSyncDone",[Is],function(){return!1})}#q=void Px(this,"initialSyncDone");static{Tx(this.prototype,"connected",[Is],function(){return!1})}#V=void Px(this,"connected");static{Tx(this.prototype,"userAddress",[Is],function(){return null})}#$=void Px(this,"userAddress");static{Tx(this.prototype,"isWidgetOpen",[Is],function(){return!1})}#G=void Px(this,"isWidgetOpen");constructor(){super(...arguments),this.rs=new qx({modules:[Zx]}),this.rs.access.claim("places","rw"),this.rs.caching.enable("/places/"),window.remoteStorage=this.rs,this.widget=new tS(this.rs,{leaveOpen:!0,skipInitial:!0}),this.rs.on("ready",()=>{}),this.rs.on("connected",()=>{this.connected=!0,this.userAddress=this.rs.remote.userAddress}),this.rs.on("disconnected",()=>{this.connected=!1,this.userAddress=null,this.placesInView=[],this.savedPlaces=[],this.loadedPrefixes=[],this.initialSyncDone=!1}),this.rs.on("sync-done",()=>{this.initialSyncDone||(this.initialSyncDone=!0)}),this.rs.scope("/places/").on("change",t=>{this.handlePlaceChange(t),OS(this,"reloadCurrentView",200)})}handlePlaceChange(t){const{newValue:e,relativePath:n}=t,i=n.split("/"),r=i[i.length-1];if(e){const t={...e,id:r},n=this.savedPlaces.findIndex(t=>t.id===r);if(-1!==n){const e=[...this.savedPlaces];e[n]=t,this.savedPlaces=e}else this.savedPlaces=[...this.savedPlaces,t]}else this.savedPlaces=this.savedPlaces.filter(t=>t.id!==r)}get places(){return this.rs.places}notifyChange(){this.version++,OS(this,"reloadCurrentView",200)}reloadCurrentView(){if(!this.currentBbox)return;const t=eS(this.currentBbox);console.debug("Reloading view due to changes, prefixes:",t),this.loadAllPlaces(t)}async loadPlacesInBounds(t){const e=eS(t).filter(t=>!this.loadedPrefixes.includes(t));0!==e.length&&(console.debug("Loading new prefixes:",e),await this.loadAllPlaces(e),this.loadedPrefixes=[...this.loadedPrefixes,...e],this.currentBbox=t)}async loadAllPlaces(t=null){try{const e=await this.places.getPlaces(t);if(e&&Array.isArray(e))if(t){const n=new Set(t),i=this.placesInView.filter(t=>{if(!t.lat||!t.lon)return!1;try{const e=$x.encode(t.lat,t.lon,4);return!n.has(e)}catch{return!0}});this.placesInView=[...i,...e]}else this.placesInView=e;else t||(this.placesInView=[]);console.debug("Loaded saved places:",this.placesInView.length)}catch(e){console.error("Failed to load places:",e)}}findPlaceById(t){if(!t)return;const e=String(t);let n=this.savedPlaces.find(t=>t.id&&String(t.id)===e);return n||(n=this.savedPlaces.find(t=>t.osmId&&String(t.osmId)===e),n)}async storePlace(t){const e=await this.places.store(t);return this.savedPlaces.some(t=>t.id===e.id)?this.savedPlaces=this.savedPlaces.map(t=>t.id===e.id?e:t):this.savedPlaces=[...this.savedPlaces,e],this.placesInView.some(t=>t.id===e.id)?this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t):this.placesInView=[...this.placesInView,e],e}async updatePlace(t){const e=await this.places.store(t),n=this.savedPlaces.findIndex(t=>t.id===e.id);if(-1!==n){const t=[...this.savedPlaces];t[n]=e,this.savedPlaces=t}return this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t),e}async removePlace(t){await this.places.remove(t.id,t.geohash),this.savedPlaces=this.savedPlaces.filter(e=>e.id!==t.id),this.placesInView.length>0&&(this.placesInView=this.placesInView.filter(e=>e.id!==t.id))}connect(){this.isWidgetOpen=!0,document.querySelector(".rs-widget")||this.widget.attach("rs-widget-container")}static{Rx(this.prototype,"connect",[Mu])}closeWidget(){this.isWidgetOpen=!1}static{Rx(this.prototype,"closeWidget",[Mu])}disconnect(){this.rs.disconnect(),this.isWidgetOpen=!1}static{Rx(this.prototype,"disconnect",[Mu])}}const FS=Object.freeze(Object.defineProperty({__proto__:null,default:AS},Symbol.toStringTag,{value:"Module"}));function LS(t){return"string"==typeof t&&t?t.replace(/[_-]/g," ").replace(/\w\S*/g,t=>t.replace(/^\w/,t=>t.toUpperCase())):""}const zS=Object.freeze(Object.defineProperty({__proto__:null,humanizeOsmTag:LS},Symbol.toStringTag,{value:"Module"}));function DS(t,e,n,i){const r=t*Math.PI/180,s=n*Math.PI/180,o=(n-t)*Math.PI/180,a=(i-e)*Math.PI/180,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(s)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}const jS=Object.freeze(Object.defineProperty({__proto__:null,getDistance:DS},Symbol.toStringTag,{value:"Module"}));function NS(t,e,n){return(e="symbol"==typeof(i=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:String(i))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t;var i}function US(t,e,n,i){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function BS(t,e,n,i){var r={};return Object.keys(i).forEach(function(t){r[t]=i[t]}),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),void 0===(r=n.slice().reverse().reduce(function(n,i){return i(t,e,n)||n},r)).initializer&&(Object.defineProperty(t,e,r),r=null),r}var qS,VS,$S,GS,WS;const HS="undefined"!=typeof FastBoot,KS="routeDidChange",XS=["separator","prepend","replace"];let YS=(qS=Uf("router"),VS=Uf("-document"),$S=class extends Bf{constructor(t){if(super(t),US(this,"router",GS,this),US(this,"document",WS,this),NS(this,"tokens",[]),NS(this,"_defaultConfig",{separator:" | ",prepend:!0,replace:null}),NS(this,"scheduleTitleUpdate",()=>{wa("afterRender",this,this._updateTitle)}),this._validateExistingTitleElement(),function(t){return"resolveRegistration"in t}(t)){const n=t.resolveRegistration("config:environment");"object"==typeof(e=n)&&null!==e&&"pageTitle"in e&&XS.forEach(t=>{if(!Sf(n.pageTitle[t])){const e=n.pageTitle[t];this._defaultConfig[t]=e}})}var e;this.router.on(KS,this.scheduleTitleUpdate)}applyTokenDefaults(t){const e=this._defaultConfig.separator,n=this._defaultConfig.prepend,i=this._defaultConfig.replace;t.previous??=null,t.next??=null,null==t.separator&&(t.separator=e),null==t.prepend&&null!=n&&(t.prepend=n),null==t.replace&&null!=i&&(t.replace=i)}inheritFromPrevious(t){const e=t.previous;e&&(null==t.separator&&(t.separator=e.separator),null==t.prepend&&(t.prepend=e.prepend))}push(t){const e=this._findTokenById(t.id);if(e){const n=this.tokens.indexOf(e),i=[...this.tokens],r=e.previous;return t.previous=r,t.next=e.next,this.inheritFromPrevious(t),this.applyTokenDefaults(t),i.splice(n,1,t),void(this.tokens=i)}const n=this.tokens.slice(-1)[0];n&&(t.previous=n??null,n.next=t,this.inheritFromPrevious(t)),this.applyTokenDefaults(t),this.tokens=[...this.tokens,t]}remove(t){const e=this._findTokenById(t);if(!e)return;const{next:n,previous:i}=e;n&&(n.previous=i),i&&(i.next=n),e.previous=e.next=null;const r=[...this.tokens];r.splice(r.indexOf(e),1),this.tokens=r}get visibleTokens(){const t=this.tokens;let e=t?t.length:0;const n=[];for(;e--;){const i=t[e];if(i){if(i.replace){n.unshift(i);break}n.unshift(i)}}return n}get sortedTokens(){const t=this.visibleTokens;if(!t)return[];let e=!0,n=[];const i=[n],r=[];return t.forEach(t=>{t.front?r.unshift(t):t.prepend?(e&&(e=!1,n=[],i.push(n)),n.unshift(t)):(e||(e=!0,n=[],i.push(n)),n.push(t))}),r.concat(i.reduce((t,e)=>t.concat(e),[]))}toString(){const t=this.sortedTokens,e=[];for(let n=0,i=t.length;ne.id===t)}updateFastbootTitle(t){if(!HS)return;const e=this.document.head,n=e.childNodes;for(let s=0;snew rC(t),sC);const oC=Object.freeze(Object.defineProperty({__proto__:null,default:sC},Symbol.toStringTag,{value:"Module"}));var aC,lC,cC;let uC=(aC=Uf("page-title"),cC=BS((lC=class extends Tb{constructor(t){super(t),US(this,"tokens",cC,this),NS(this,"tokenId",et(this)),this.tokens.push({id:this.tokenId})}compute(t,e){const n={...e,id:this.tokenId,title:t.join("")};return this.tokens.push(n),this.tokens.scheduleTitleUpdate(),""}willDestroy(){super.willDestroy(),this.tokens.remove(this.tokenId),this.tokens.scheduleTitleUpdate()}}).prototype,"tokens",[aC],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),lC);const hC=Hi;class dC{capabilities=$i();constructor(t){this.owner=t}createModifier(t,e){return{instance:new t(this.owner,e),element:null}}installModifier(t,e,n){const i=function(t,e){const n=t;return n.element=e,n}(t,e);i.instance.modify(e,n.positional,n.named)}updateModifier(t,e){t.instance.modify(t.element,e.positional,e.named)}destroyModifier({instance:t}){Ht(t)}}hC(t=>new dC(t),class{constructor(t,e){lx(this,t)}modify(t,e,n){}});const pC=new class{capabilities=$i();createModifier(t){return{element:null,instance:t}}installModifier(t,e,n){const i=function(t,e){const n=t;return n.element=e,n}(t,e),{positional:r,named:s}=n,o=t.instance(e,r,s);"function"==typeof o&&(i.teardown=o)}updateModifier(t,e){"function"==typeof t.teardown&&t.teardown();const n=t.instance(t.element,e.positional,e.named);"function"==typeof n&&(t.teardown=n)}destroyModifier(t){"function"==typeof t.teardown&&t.teardown()}getDebugName(t){return t.instance.toString()}getDebugInstance(t){return t}};function fC(t){return t.toString=()=>t.name,hC(()=>pC,t)}const gC="add",mC="remove",yC="propertychange",_C="change",vC="contextmenu",bC="click",wC="keydown",xC="keypress",SC="touchmove",CC="wheel";class kC{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function EC(t,e){return t>e?1:te?-1:0}function RC(t,e,n){if(t[0]<=e)return 0;const i=t.length;if(e<=t[i-1])return i-1;if("function"==typeof n){for(let r=1;r0?r-1:r}return i-1}if(n>0){for(let n=1;n0)}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const i=n.indexOf(e);-1!==i&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[i]=FC,++this.pendingRemovals_[t]):(n.splice(i,1),0===n.length&&delete this.listeners_[t]))}}function BC(t,e,n,i,r){if(r){const r=n;n=function(s){return t.removeEventListener(e,n),r.call(i??this,s)}}else i&&i!==t&&(n=n.bind(i));const s={target:t,type:e,listener:n};return t.addEventListener(e,n),s}function qC(t,e,n,i){return BC(t,e,n,i,!0)}function VC(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),DC(t))}class $C extends UC{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(_C)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,i=new Array(n);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,n=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new ZC(gC,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let n=0,i=e.length;n=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new ZC(mC,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new ZC(mC,n,t)),this.dispatchEvent(new ZC(gC,e,t))}updateLength_(){this.set(YC,this.array_.length)}assertUnique_(t,e){const n=this.array_;for(let i=0,r=n.length;i{this.clickTimeoutId_=void 0;const e=new tk(ek.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==ek.POINTERUP||e.type==ek.POINTERCANCEL){delete this.trackedTouches_[n];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=ek.POINTERDOWN&&e.type!=ek.POINTERMOVE||(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new tk(ek.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(VC),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new tk(ek.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(BC(t,ek.POINTERMOVE,this.handlePointerMove_,this),BC(t,ek.POINTERUP,this.handlePointerUp_,this),BC(this.element_,ek.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(BC(this.element_.getRootNode(),ek.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new tk(ek.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new tk(ek.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(VC(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(SC,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(VC(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(VC),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const dk="postrender",pk="loadstart",fk="loadend",gk="layergroup",mk="size",yk="target",_k="view";function vk(t,e){if(!t)throw new Error(e)}const bk=1/0;class wk{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,DC(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const i=this.keyFunction_(n);return delete this.queuedElements_[i],n}enqueue(t){vk(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=bk&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,i=e.length,r=e[t],s=n[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(i[t]>s))break;n[e]=n[t],i[e]=i[t],e=t}n[e]=r,i[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let i=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(_C,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(2===n||3===n||4===n){3!==n&&e.removeEventListener(_C,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++n,t.load())}}}const Sk={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ck(t,e,n){return Math.min(Math.max(t,e),n)}function kk(t,e,n,i,r,s){const o=r-n,a=s-i;if(0!==o||0!==a){const l=((t-n)*o+(e-i)*a)/(o*o+a*a);l>1?(n=r,i=s):l>0&&(n+=o*l,i+=a*l)}return Ek(t,e,n,i)}function Ek(t,e,n,i){const r=n-t,s=i-e;return r*r+s*s}function Tk(t){return 180*t/Math.PI}function Rk(t){return t*Math.PI/180}function Pk(t,e){const n=t%e;return n*e<0?n+e:n}function Mk(t,e,n){return t+n*(e-t)}function Ik(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}function Ok(t,e){return Math.floor(Ik(t,e))}function Ak(t,e){return Math.ceil(Ik(t,e))}function Fk(t,e,n){if(t>=e&&tp&&(d=(p+d)/2,p=d),f>g&&(f=(g+f)/2,g=f);let m=Ck(i[0],d,p),y=Ck(i[1],f,g);if(o&&n&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-i[0])/t)+t*Math.log(1+Math.max(0,i[0]-p)/t),y+=-t*Math.log(1+Math.max(0,f-i[1])/t)+t*Math.log(1+Math.max(0,i[1]-g)/t)}return[m,y]}}function zk(t){return t}function Dk(t){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,i=t.length;nr&&(l|=4),as&&(l|=2),0===l&&(l=1),l}function Gk(t,e,n,i,r){return r?(r[0]=t,r[1]=e,r[2]=n,r[3]=i,r):[t,e,n,i]}function Wk(t){return Gk(1/0,1/0,-1/0,-1/0,t)}function Hk(t,e){const n=t[0],i=t[1];return Gk(n,i,n,i,e)}function Kk(t,e,n,i,r){return Jk(Wk(r),t,e,n,i)}function Xk(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Yk(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Zk(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Jk(t,e,n,i,r){for(;ne[0]?i[0]=t[0]:i[0]=e[0],t[1]>e[1]?i[1]=t[1]:i[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function fE(t){return t[2]1){const e=t[2]-t[0],n=t[3]-t[1];for(let s=0;s=n[2])){const e=dE(n),r=Math.floor((i[0]-n[0])/e)*e;t[0]-=r,t[2]-=r}return t}function yE(t,e,n){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];mE(t,e);const r=dE(i);if(dE(t)>r&&!n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-r,t[3]]]}return[t]}function _E(t,e){let n=!0;for(let i=t.length-1;i>=0;--i)if(t[i]!=e[i]){n=!1;break}return n}function vE(t,e){const n=Math.cos(e),i=Math.sin(e),r=t[0]*n-t[1]*i,s=t[1]*n+t[0]*i;return t[0]=r,t[1]=s,t}function bE(t,e){if(e.canWrapX()){const n=dE(e.getExtent()),i=function(t,e,n){const i=e.getExtent();let r=0;return e.canWrapX()&&(t[0]i[2])&&(n=n||dE(i),r=Math.floor((t[0]-i[0])/n)),r}(t,e,n);i&&(t[0]-=i*n)}return t}function wE(t){return Math.pow(t,3)}function xE(t){return 1-wE(1-t)}function SE(t){return 3*t*t-2*t*t*t}function CE(t){return t}const kE=6371008.8;function EE(t,e,n){n=n||kE;const i=Rk(t[1]),r=Rk(e[1]),s=(r-i)/2,o=Rk(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*n*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function TE(t,e,n,i){i=i||kE;const r=Rk(t[1]),s=Rk(t[0]),o=e/i,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(n));return[Tk(s+Math.atan2(Math.sin(n)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a))),Tk(a)]}function RE(...t){console.warn(...t)}const PE={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ME{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||PE[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const IE=6378137,OE=Math.PI*IE,AE=[-OE,-OE,OE,OE],FE=[-180,-85,180,85],LE=IE*Math.log(Math.tan(Math.PI/2));class zE extends ME{constructor(t){super({code:t,units:"m",extent:AE,global:!0,worldExtent:FE,getPointResolution:function(t,e){return t/Math.cosh(e[1]/IE)}})}}const DE=[new zE("EPSG:3857"),new zE("EPSG:102100"),new zE("EPSG:102113"),new zE("EPSG:900913"),new zE("http://www.opengis.net/def/crs/EPSG/0/3857"),new zE("http://www.opengis.net/gml/srs/epsg.xml#3857")],jE=[-180,-90,180,90],NE=6378137*Math.PI/180;class UE extends ME{constructor(t,e){super({code:t,units:"degrees",extent:jE,axisOrientation:e,global:!0,metersPerUnit:NE,worldExtent:jE})}}const BE=[new UE("CRS:84"),new UE("EPSG:4326","neu"),new UE("urn:ogc:def:crs:OGC:1.3:CRS84"),new UE("urn:ogc:def:crs:OGC:2:84"),new UE("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new UE("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new UE("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let qE={},VE={};function $E(t,e,n){const i=t.getCode(),r=e.getCode();i in VE||(VE[i]={}),VE[i][r]=n}function GE(t,e){return t in VE&&e in VE[t]?VE[t][e]:null}const WE=.9996,HE=.00669438,KE=HE*HE,XE=KE*HE,YE=HE/(1-HE),ZE=Math.sqrt(1-HE),JE=(1-ZE)/(1+ZE),QE=JE*JE,tT=QE*JE,eT=tT*JE,nT=eT*JE,iT=.9983242984503243,rT=15*KE/256+45*XE/1024,sT=35*XE/3072,oT=1.5*JE-27/32*tT+269/512*nT,aT=21/16*QE-55/32*eT,lT=151/96*tT-417/128*nT,cT=1097/512*eT,uT=6378137;function hT(t,e,n){const i=t-5e5,r=(n.north?e:e-1e7)/WE/(uT*iT),s=r+oT*Math.sin(2*r)+aT*Math.sin(4*r)+lT*Math.sin(6*r)+cT*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),c=o/l,u=c*c,h=u*u,d=1-HE*a,p=Math.sqrt(1-HE*a),f=YE*l**2,g=f*f,m=i/(uT/p*WE),y=m*m,_=y*m,v=_*m,b=v*m,w=s-c/((1-HE)/d)*(y/2-v/24*(5+3*u+10*f-4*g-9*YE))+b*m/720*(61+90*u+298*f+45*h-252*YE-3*g);let x=(m-_/6*(1+2*u+f)+b/120*(5-2*f+28*u-3*g+8*YE+24*h))/l;return x=Fk(x+Rk(pT(n.number)),-Math.PI,Math.PI),[Tk(x),Tk(w)]}function dT(t,e,n){t=Fk(t,-180,180),e<-80?e=-80:e>84&&(e=84);const i=Rk(e),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,c=Rk(t),u=Rk(pT(n.number)),h=uT/Math.sqrt(1-HE*r**2),d=YE*s**2,p=s*Fk(c-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,y=m*p,_=y*p,v=uT*(iT*i-.002514607064228144*Math.sin(2*i)+rT*Math.sin(4*i)-sT*Math.sin(6*i)),b=WE*h*(p+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*YE))+5e5;let w=WE*(v+h*o*(f/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*YE)));return n.north||(w+=1e7),[b,w]}function pT(t){return 6*(t-1)-180+3}const fT=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function gT(t){let e=0;for(const r of fT){const n=t.match(r);if(n){e=parseInt(n[1]);break}}if(!e)return null;let n=0,i=!1;return e>32700&&e<32761?n=e-32700:e>32600&&e<32661&&(i=!0,n=e-32600),n?{number:n,north:i}:null}function mT(t,e){return function(n,i,r,s){const o=n.length;r=r>1?r:2,s=s??r,i||(i=r>2?n.slice():new Array(o));for(let a=0;a180)&&(e[0]=Pk(n+180,360)-180),e}function MT(t,e){if(t===e)return!0;const n=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||IT(t,e)===wT)&&n}function IT(t,e){const n=t.getCode(),i=e.getCode();let r=GE(n,i);if(r)return r;let s=null,o=null;for(const l of yT)s||(s=l(t)),o||(o=l(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=OT(s.inverse,o.forward);else{const t=GE(n,a);t&&(r=OT(t,o.forward))}else{const t=GE(a,i);t&&(r=OT(s.inverse,t))}return r&&(ST(t),ST(e),$E(t,e,r)),r}function OT(t,e){return function(n,i,r,s){return i=t(n,i,r,s),e(i,i,r,s)}}function AT(t,e){return IT(CT(t),CT(e))}function FT(t,e,n){const i=AT(e,n);if(!i){const t=CT(e).getCode(),i=CT(n).getCode();throw new Error(`No transform available between ${t} and ${i}`)}return i(t,void 0,t.length)}function LT(t,e,n,i){return gE(t,AT(e,n),void 0,i)}function zT(t){return t}function DT(t){return vT&&!_E(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(vT=!1,RE("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function jT(t){return t}var NT,UT,BT;ET(DE),ET(BE),NT=DE,UT=function(t,e,n,i){const r=t.length;n=n>1?n:2,i=i??n,void 0===e&&(e=n>2?t.slice():new Array(r));for(let s=0;sLE?n=LE:n<-LE&&(n=-LE),e[s+1]=n}return e},BT=function(t,e,n,i){const r=t.length;n=n>1?n:2,i=i??n,void 0===e&&(e=n>2?t.slice():new Array(r));for(let s=0;s{if(!n)return this.getSimplifiedGeometry(e);const i=this.clone();return i.applyTransform(n),i.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return GC()}closestPointXY(t,e,n,i){return GC()}containsXY(t,e){return 0===this.closestPointXY(t,e,eR,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return GC()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Wk(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){GC()}scale(t,e,n){GC()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return GC()}getType(){return GC()}applyTransform(t){GC()}intersectsExtent(t){return GC()}translate(t,e){GC()}transform(t,e){const n=CT(t),i="tile-pixels"==n.getUnits()?function(t,i,r){const s=n.getExtent(),o=n.getWorldExtent(),a=lE(o)/lE(s);KT(tR,o[0],o[3],a,-a,0,0,0);const l=JT(t,0,t.length,r,tR,i),c=AT(n,e);return c?c(l,l,r):l}:AT(n,e);return this.applyTransform(i),this}}class iR extends nR{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Kk(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return GC()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)h=n;else{if(d>0){for(let r=0;rr&&(r=a),s=n,o=i}return r}function uR(t,e,n,i,r){for(let s=0,o=n.length;s0;){const n=c.pop(),s=c.pop();let o=0;const a=t[s],h=t[s+1],d=t[n],p=t[n+1];for(let e=s+i;eo&&(u=e,o=n)}o>r&&(l[(u-e)/i]=1,s+i0&&f>d)&&(p<0&&g0&&g>p)?(a=n,l=h):(s[o++]=a,s[o++]=l,c=a,u=l,a=n,l=h)}return s[o++]=a,s[o++]=l,o}function SR(t,e,n,i,r,s,o,a){for(let l=0,c=n.length;ls&&(n-a)*(s-l)-(r-a)*(i-l)>0&&o++:i<=s&&(n-a)*(s-l)-(r-a)*(i-l)<0&&o--,a=n,l=i}return 0!==o}function RR(t,e,n,i,r,s){if(0===n.length)return!1;if(!TR(t,e,n[0],i,r,s))return!1;for(let o=1,a=n.length;oy&&(c=(u+h)/2,RR(t,e,n,i,c,f)&&(m=c,y=r)),u=h}return isNaN(m)&&(m=r[s]),o?(o.push(m,f,y),o):[m,f,y]}function MR(t,e,n,i,r){let s=[];for(let o=0,a=n.length;o=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||IR(t,e,n,i,function(t,e){return function(t,e,n){let i=!1;const r=$k(t,e),s=$k(t,n);if(1===r||1===s)i=!0;else{const o=t[0],a=t[1],l=t[2],c=t[3],u=e[0],h=e[1],d=n[0],p=n[1],f=(p-h)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(p-c)/f,i=g>=o&&g<=l),i||!(4&s)||4&r||(m=p-(d-l)*f,i=m>=a&&m<=c),i||!(8&s)||8&r||(g=d-(p-a)/f,i=g>=o&&g<=l),i||!(16&s)||16&r||(m=p-(d-o)*f,i=m>=a&&m<=c)}return i}(r,t,e)}))}function AR(t,e,n,i,r){return!!(OR(t,e,n,i,r)||TR(t,e,n,i,r[0],r[1])||TR(t,e,n,i,r[0],r[3])||TR(t,e,n,i,r[2],r[1])||TR(t,e,n,i,r[2],r[3]))}function FR(t,e,n,i,r){if(!AR(t,e,n[0],i,r))return!1;if(1===n.length)return!0;for(let s=1,o=n.length;s0}function DR(t,e,n,i,r){r=void 0!==r&&r;for(let s=0,o=n.length;su&&d1&&"function"==typeof arguments[n-1]&&(e=arguments[n-1],--n);let i=0;for(;i0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,n=this.animations_.length;e=0;--n){const i=this.animations_[n];let r=!0;for(let n=0,s=i.length;n0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],n=s.targetCenter[0],i=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(n-t),o=e+l*(i-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(n,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Pk(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[n]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=i[0].callback;t&&YR(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const i=this.getCenterInternal();var r,s;return void 0!==i&&(n=[i[0]-e[0],i[1]-e[1]],vE(n,t-this.getRotation()),s=e,(r=n)[0]+=+s[0],r[1]+=+s[1]),n}calculateCenterZoom(t,e){let n;const i=this.getCenterInternal(),r=this.getResolution();return void 0!==i&&void 0!==r&&(n=[e[0]-t*(e[0]-i[0])/r,e[1]-t*(e[1]-i[1])/r]),n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],i=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(i*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(i*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?zT(t,this.getProjection()):t}getCenterInternal(){return this.get(Sk.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return e=this.calculateExtentInternal(t),this.getProjection(),e;var e}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();vk(e,"The view center is not defined");const n=this.getResolution();vk(void 0!==n,"The view resolution is not defined");const i=this.getRotation();return vk(void 0!==i,"The view rotation is not defined"),oE(e,n,i,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Sk.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(jT(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=dE(t)/e[0],i=lE(t)/e[1];return Math.max(n,i)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(e/n)/Math.log(t);return function(n){return e/Math.pow(t,n*i)}}getRotation(){return this.get(Sk.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(n/i)/e;return function(t){return Math.log(n/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let i=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();i=JR(i,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,n)}return{center:i.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,n,i=this.minZoom_||0;if(this.resolutions_){const r=RC(this.resolutions_,t,1);i=r,e=this.resolutions_[r],n=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,n=this.zoomFactor_;return i+Math.log(e/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Ck(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,Ck(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(vk(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))vk(!fE(t),"Cannot fit empty extent provided as `geometry`"),n=VR(jT(t,this.getProjection()));else if("Circle"===t.getType()){const e=jT(t.getExtent(),this.getProjection());n=VR(e),n.rotate(this.getRotation(),rE(e))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),i=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,c=-1/0;for(let u=0,h=r.length;ut.trim().replace(/^['"]|['"]$/g,"")),n};function aP(t,e,n,i){let r;return r=n&&n.length?n.shift():ok?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",i)}let lP;function cP(){return lP||(lP=aP(1,1)),lP}function uP(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function hP(t){let e=t.offsetWidth;const n=getComputedStyle(t);return e+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),e}function dP(t){let e=t.offsetHeight;const n=getComputedStyle(t);return e+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),e}function pP(t,e){const n=e.parentNode;n&&n.replaceChild(t,e)}function fP(t){for(;t.lastChild;)t.lastChild.remove()}function gP(){const t=new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const n=this.childNodes.indexOf(e);if(-1===n)throw new Error("Reference node not found");return this.childNodes.splice(n,0,t),t},style:{}},{get:(t,e,n)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,n)});return t}function mP(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class yP extends XC{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,n=this.listenerKeys.length;ee.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>n.add(t)):n.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(n)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>zC(()=>t))),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!IC(e,this.renderedAttributions_)){fP(this.ulElement_);for(let t=0,n=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:xE}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const t="rotate("+n+"rad)";if(this.autoHide_){const t=this.element.classList.contains(QR);t||0!==n?t&&0!==n&&this.element.classList.remove(QR):this.element.classList.add(QR)}this.label_.style.transform=t}this.rotation_=n}}class bP extends yP{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",n=void 0!==t.delta?t.delta:1,i=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=i,c.setAttribute("type","button"),c.title=a,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(bC,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(bC,this.handleClick_.bind(this,-n),!1);const h=e+" "+tP+" "+eP,d=this.element;d.className=h,d.appendChild(c),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const n=e.getZoom();if(void 0!==n){const i=e.getConstrainedZoom(n+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:i,duration:this.duration_,easing:xE})):e.setZoom(i)}}}function wP(t){t=t||{};const e=new JC;return(void 0===t.zoom||t.zoom)&&e.push(new bP(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vP(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new _P(t.attributionOptions)),e}class xP{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[n+2]>t;)n-=3;const i=this.points_[e+2]-this.points_[n+2];if(i<1e3/60)return!1;const r=this.points_[e]-this.points_[n],s=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/i,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const SP="active";class CP extends XC{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(SP)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(SP,t)}setMap(t){this.map_=t}}function kP(t,e,n,i){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:n,duration:void 0!==i?i:250,easing:xE})}class EP extends CP{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==ek.DBLCLICK){const n=t.originalEvent,i=t.map,r=t.coordinate,s=n.shiftKey?-this.delta_:this.delta_;kP(i.getView(),s,r,this.duration_),n.preventDefault(),e=!0}return!e}}function TP(t){const e=arguments;return function(t){let n=!0;for(let i=0,r=e.length;i0}}else if(t.type==ek.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==ek.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function jP(t){const e=t.length;let n=0,i=0;for(let r=0;r0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class UP extends DP{constructor(t){t=t||{},super({stopDown:AC}),this.condition_=t.condition?t.condition:RP,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!LP(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===HR)return;const i=e.getSize(),r=t.pixel,s=Math.atan2(i[1]/2-r[1],r[0]-i[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;n.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!LP(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!(!LP(t)||!IP(t)||!this.condition_(t)||(t.map.getView().beginInteraction(),this.lastAngle_=void 0,0))}}class BP extends kC{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",i=this.element_.style;i.left=Math.min(t[0],e[0])+n,i.top=Math.min(t[1],e[1])+n,i.width=Math.abs(e[0]-t[0])+n,i.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new qR([n])}getGeometry(){return this.geometry_}}const qP="boxcancel";class VP extends NC{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class $P extends DP{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new BP(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??IP,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const i=n[0]-e[0],r=n[1]-e[1];return i*i+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new VP("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new VP(e?"boxend":qP,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new VP("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new VP(qP,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new VP(qP,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class GP extends $P{constructor(t){super({condition:(t=t||{}).condition?t.condition:AP,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let n=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(n),i=e.getResolutionForExtentInternal(t),r=e.getResolution()/i;n=n.clone(),n.scale(r*r)}e.fitInternal(n,{duration:this.duration_,easing:xE})}}const WP="ArrowLeft",HP="ArrowRight",KP="ArrowDown";class XP extends CP{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return OP(t)&&FP(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==wC){const n=t.originalEvent,i=n.key;if(this.condition_(t)&&(i==KP||i==WP||i==HP||"ArrowUp"==i)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;i==KP?a=-s:i==WP?o=-s:i==HP?o=s:a=s;const l=[o,a];vE(l,r.getRotation()),function(t,e,n){const i=t.getCenterInternal();if(i){const r=[i[0]+e[0],i[1]+e[1]];t.animateInternal({duration:void 0!==n?n:250,easing:CE,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class YP extends CP{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return rk?e.metaKey:e.ctrlKey}(t)&&FP(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==wC||t.type==xC){const n=t.originalEvent,i=n.key;if(this.condition_(t)&&("+"===i||"-"===i)){const r=t.map,s="+"===i?this.delta_:-this.delta_;kP(r.getView(),s,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}class ZP extends CP{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:MP;this.condition_=t.onFocusOnly?TP(PP,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==CC)return!0;const e=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=40;break;case WheelEvent.DOM_DELTA_PAGE:i*=300}if(0===i)return!1;this.lastDelta_=i;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=i;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-Ck(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),kP(e,n,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class JP extends DP{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=AC),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],i=this.targetPointers[1],r=Math.atan2(i.clientY-n.clientY,i.clientX-n.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==HR&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(jP(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2&&(t.map.getView().endInteraction(this.duration_),1))}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class QP extends DP{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=AC),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],i=this.targetPointers[1],r=n.clientX-i.clientX,s=n.clientY-i.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(jP(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function tM(t){t=t||{};const e=new JC,n=new xP(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new UP),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new EP({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new NP({onFocusOnly:t.onFocusOnly,kinetic:n})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new JP),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new QP({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new XP),e.push(new YP({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new ZP({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new GP({duration:t.zoomDuration})),e}const eM="opacity",nM="visible",iM="extent",rM="zIndex",sM="maxResolution",oM="minResolution",aM="maxZoom",lM="minZoom",cM="source";class uM extends XC{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[eM]=void 0!==t.opacity?t.opacity:1,vk("number"==typeof e[eM],"Layer opacity must be a number"),e[nM]=void 0===t.visible||t.visible,e[rM]=t.zIndex,e[sM]=void 0!==t.maxResolution?t.maxResolution:1/0,e[oM]=void 0!==t.minResolution?t.minResolution:0,e[lM]=void 0!==t.minZoom?t.minZoom:-1/0,e[aM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},n=this.getZIndex();return e.opacity=Ck(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==n||e.managed?n:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return GC()}getLayerStatesArray(t){return GC()}getExtent(){return this.get(iM)}getMaxResolution(){return this.get(sM)}getMinResolution(){return this.get(oM)}getMinZoom(){return this.get(lM)}getMaxZoom(){return this.get(aM)}getOpacity(){return this.get(eM)}getSourceState(){return GC()}getVisible(){return this.get(nM)}getZIndex(){return this.get(rM)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(iM,t)}setMaxResolution(t){this.set(sM,t)}setMinResolution(t){this.set(oM,t)}setMaxZoom(t){this.set(aM,t)}setMinZoom(t){this.set(lM,t)}setOpacity(t){vk("number"==typeof t,"Layer opacity must be a number"),this.set(eM,t)}setVisible(t){this.set(nM,t)}setZIndex(t){this.set(rM,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const hM="addlayer",dM="removelayer";class pM extends NC{constructor(t,e){super(t),this.layer=e}}const fM="layers";class gM extends uM{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(fM,this.handleLayersChanged_),n?Array.isArray(n)?n=new JC(n.slice(),{unique:!0}):vk("function"==typeof n.getArray,"Expected `layers` to be an array or a `Collection`"):n=new JC(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(VC),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(BC(t,gC,this.handleLayersAdd_,this),BC(t,mC,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(VC);DC(this.listenerKeys_);const e=t.getArray();for(let n=0,i=e.length;n{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const n=this.getMapInternal();let i;if(!t&&n&&(t=n.getView()),e=t instanceof XR?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(i=e.layerStatesArray.find(t=>t.layer===this),!i)return!1}else i=this.getLayerState();const r=this.getExtent();return wM(i,e.viewState)&&(!r||pE(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let n=e(t instanceof XR?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(VC(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(VC(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=BC(t,_M,this.handlePrecompose_,this),this.mapRenderKey_=BC(this,_C,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,n=this.getLayerState(!1);vk(!e.some(t=>t.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(n)}setSource(t){this.set(cM,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function wM(t,e){if(!t.visible)return!1;const n=e.resolution;if(n=t.maxResolution)return!1;const i=e.zoom;return i>t.minZoom&&i<=t.maxZoom}function xM(t,e,n=0,i=t.length-1,r=CM){for(;i>n;){if(i-n>600){const s=i-n+1,o=e-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);xM(t,e,Math.max(n,Math.floor(e-o*l/s+c)),Math.min(i,Math.floor(e+(s-o)*l/s+c)),r)}const s=t[e];let o=n,a=i;for(SM(t,n,e),r(t[i],s)>0&&SM(t,n,i);o0;)a--}0===r(t[n],s)?SM(t,n,a):(a++,SM(t,a,i)),a<=e&&(n=a+1),e<=a&&(i=a-1)}}function SM(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function CM(t,e){return te?1:0}let kM=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!DM(t,e))return n;const i=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(i,r,e)}_split(t,e){const n=t[e],i=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,i);const s=this._chooseSplitIndex(n,r,i),o=jM(n.children.splice(s,n.children.length-s));o.height=n.height,o.leaf=n.leaf,TM(n,this.toBBox),TM(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(n,o)}_splitRoot(t,e){this.data=jM([t,e]),this.data.height=t.height+1,this.data.leaf=!1,TM(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let i,r=1/0,s=1/0;for(let o=e;o<=n-e;o++){const e=RM(t,0,o,this.toBBox),a=RM(t,o,n,this.toBBox),l=LM(e,a),c=OM(e)+OM(a);l=e;l--){const e=t.children[l];PM(o,t.leaf?r(e):e),a+=AM(o)}return a}_adjustParentBBoxes(t,e,n){for(let i=n;i>=0;i--)PM(e[i],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():TM(t[n],this.toBBox)}};function EM(t,e,n){if(!n)return e.indexOf(t);for(let i=0;i=t.minX&&e.maxY>=t.minY}function jM(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function NM(t,e,n,i,r){const s=[e,n];for(;s.length;){if((n=s.pop())-(e=s.pop())<=i)continue;const o=e+Math.ceil((n-e)/i/2)*i;xM(t,o,e,n,r),s.push(e,o,o,n)}}const UM=[NaN,NaN,NaN,0];let BM;const qM=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,VM=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$M=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,GM=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function WM(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function HM(t){throw new Error('failed to parse "'+t+'" as color')}function KM(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(VM)||t.match(qM)||t.match($M);if(e){const t=e[4],n=100/255;return[Ck(WM(e[1],n)+.5|0,0,255),Ck(WM(e[2],n)+.5|0,0,255),Ck(WM(e[3],n)+.5|0,0,255),void 0!==t?Ck(WM(t,100),0,1):1]}HM(t)}if(t.startsWith("#")){if(GM.test(t)){const e=t.substring(1),n=e.length<=4?1:2,i=[0,0,0,255];for(let t=0,r=e.length;t.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function QM(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function tI(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function eI(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function nI(t){const e=tI(t[0]),n=tI(t[1]),i=tI(t[2]),r=eI(.222488403*e+.716873169*n+.06060791*i),s=500*(eI(.452247074*e+.399439023*n+.148375274*i)-r),o=200*(r-eI(.016863605*e+.117638439*n+.865350722*i)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function iI(t){if("none"===t)return UM;if(XM.hasOwnProperty(t))return XM[t];if(YM>=1024){let t=0;for(const e in XM)3&t++||(delete XM[e],--YM)}const e=KM(t);4!==e.length&&HM(t);for(const n of e)isNaN(n)&&HM(t);return XM[t]=e,++YM,e}function rI(t){return Array.isArray(t)?t:iI(t)}function sI(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let n=t[1];n!=(0|n)&&(n=n+.5|0);let i=t[2];return i!=(0|i)&&(i=i+.5|0),"rgba("+e+","+n+","+i+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function oI(t){return t[0]>0&&t[1]>0}function aI(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let lI=0;const cI=1<e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${i}, got ${r}`)}}function SO(t,e,n){const i=t.length-1,r=new Array(i);for(let s=0;s{for(let e=0;e{for(let r=0;r{const i=t.args;let r=n.properties[e];for(let t=1,e=i.length;tt.variables[e];case yO:return n=>{const i=t.args;if(!(e in n.properties))return!1;let r=n.properties[e];for(let t=1,e=i.length;tt.featureId;case RI:return t=>t.geometryType;case TI:{const e=t.args.map(t=>PO(t));return t=>"".concat(...e.map(e=>e(t).toString()))}case AI:return t=>t.resolution;case MI:case II:case rO:case lO:case"!":return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{for(let e=0;e{for(let e=0;e{const e=i[0](t),n=i[1](t),r=i[2](t);return e>=n&&e<=r};case lO:return t=>{const e=i[0](t);for(let r=1;r!i[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case zI:case DI:case"<":case BI:case">":case NI:return function(t){const e=t.operator,n=PO(t.args[0]),i=PO(t.args[1]);switch(e){case zI:return t=>n(t)===i(t);case DI:return t=>n(t)!==i(t);case"<":return t=>n(t)n(t)<=i(t);case">":return t=>n(t)>i(t);case NI:return t=>n(t)>=i(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case"*":case"/":case"+":case"-":case WI:case"%":case"^":case XI:case YI:case ZI:case JI:case QI:case tO:case eO:case nO:return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{let e=1;for(let r=0;ri[0](t)/i[1](t);case"+":return t=>{let e=0;for(let r=0;ri[0](t)-i[1](t);case WI:return t=>{const e=i[0](t),n=i[1](t);if(er?r:e};case"%":return t=>i[0](t)%i[1](t);case"^":return t=>Math.pow(i[0](t),i[1](t));case XI:return t=>Math.abs(i[0](t));case YI:return t=>Math.floor(i[0](t));case ZI:return t=>Math.ceil(i[0](t));case JI:return t=>Math.round(i[0](t));case QI:return t=>Math.sin(i[0](t));case tO:return t=>Math.cos(i[0](t));case eO:return 2===n?t=>Math.atan2(i[0](t),i[1](t)):t=>Math.atan(i[0](t));case nO:return t=>Math.sqrt(i[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case aO:return function(t){const e=t.args.length,n=new Array(e);for(let i=0;i{for(let i=0;i{const i=n[0](t);for(let r=1;r{const i=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:c?IO(i,r,s,o,e,l):MO(i,r,s,o,e,l);s=e,o=l}return o}}(t);case mO:return function(t){const e=t.operator,n=t.args.length,i=new Array(n);for(let r=0;r{const n=i[0](e);return t.args[0].type===dI?sI(n):n.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${e}`)}}function MO(t,e,n,i,r,s){const o=r-n;if(0===o)return i;const a=e-n;return i+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-i)}function IO(t,e,n,i,r,s){if(0===r-n)return i;const o=nI(i),a=nI(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,n=t[1],i=t[2]*Math.PI/180,r=QM(e),s=QM(e+n/500*Math.cos(i)),o=QM(e-n/200*Math.sin(i)),a=JM(3.021973625*s-1.617392459*r-.404875592*o),l=JM(-.943766287*s+1.916279586*r+.027607165*o),c=JM(.069407491*s-.22898585*r+1.159737864*o);return[Ck(a+.5|0,0,255),Ck(l+.5|0,0,255),Ck(c+.5|0,0,255),t[3]]}([MO(t,e,n,o[0],r,a[0]),MO(t,e,n,o[1],r,a[1]),o[2]+MO(t,e,n,0,r,l),MO(t,e,n,i[3],r,s[3])])}class OO extends UC{constructor(t,e,n,i){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state="function"==typeof i?0:i,this.image_=null,this.loader="function"==typeof i?i:null}changed(){this.dispatchEvent(_C)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(0==this.state&&this.loader){this.state=1,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;zC(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||lk&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=2}).catch(t=>{this.state=3,console.error(t)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function AO(t,e,n){return e+":"+t+":"+(n?rI(n):"null")}const FO=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const n=this.cache_[e];3&t++||n.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,n){const i=AO(t,e,n);return i in this.cache_?this.cache_[i]:null}getPattern(t,e,n){const i=AO(t,e,n);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,n,i,r){const s=AO(t,e,n),o=s in this.cache_;this.cache_[s]=i,r&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[s]=cP().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=cP().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let LO=null;class zO extends UC{constructor(t,e,n,i,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=r,this.imageState_=void 0===i?0:i,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){LO||(LO=aP(1,1,void 0,{willReadFrequently:!0})),LO.drawImage(this.image_,0,0);try{LO.getImageData(0,0,1,1),this.tainted_=!1}catch{LO=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(_C)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=aP(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&ak?new Promise((e,n)=>t.decode().then(()=>e(t)).catch(i=>t.complete&&t.width?e(t):n(i))):function(t){return new Promise((e,n)=>{function i(){s(),e(t)}function r(){s(),n(new Error("Image load error"))}function s(){t.removeEventListener("load",i),t.removeEventListener("error",r)}t.addEventListener("load",i),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,n=aP(Math.ceil(e.width*t),Math.ceil(e.height*t)),i=n.canvas;var r;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle="string"==typeof(r=this.color_)?r:sI(r),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(_C,e),t())};this.addEventListener(_C,e)}})),this.ready_}}function DO(t,e,n,i,r,s){let o=void 0===e?void 0:FO.get(e,n,r);return o||(o=new zO(t,t&&"src"in t?t.src||void 0:e,n,i,r),FO.set(e,n,r,o,s)),s&&o&&!FO.getPattern(e,n,r)&&FO.set(e,n,r,o,s),o}function jO(t){return t?Array.isArray(t)?sI(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return FO.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,n=FO.getPattern(e,void 0,t.color);if(n)return n;const i=FO.get(t.src,"anonymous",null);if(2!==i.getImageState())return null;const r=aP(t.size[0],t.size[1]);return r.drawImage(i.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),DO(r.canvas,e,void 0,2,t.color,!0),FO.getPattern(e,void 0,t.color)}(t):t:null}const NO="10px sans-serif",UO="#000",BO="round",qO=[],VO="round",$O="#000",GO="center",WO="middle",HO=[0,0,0,0],KO=new XC;let XO,YO=null;const ZO={},JO=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function QO(t,e,n){return`${t} ${e} 16px "${n}"`}const tA=function(){const t=100;let e,n;async function i(t){await n.ready;const e=await n.load(t);if(0===e.length)return!1;const i=oP(t),r=i.families[0].toLowerCase(),s=i.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),n=sP[t.weight]||t.weight;return e===r&&t.style===i.style&&n==s})}async function r(){await n.ready;let s=!0;const o=KO.getProperties(),a=Object.keys(o).filter(e=>o[e]=0;--e){const n=a[e];let r=o[n];rMath.max(e,iA(t,n)),0);return n[e]=i,i}class sA{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=aI(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new sA({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return GC()}getImage(t){return GC()}getHitDetectionImage(){return GC()}getPixelRatio(t){return 1}getImageState(){return GC()}getImageSize(){return GC()}getOrigin(){return GC()}getSize(){return GC()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=aI(t)}listenImageChange(t){GC()}load(){GC()}unlistenImageChange(t){GC()}ready(){return Promise.resolve()}}class oA extends sA{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new oA({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let i=FO.get(n,null,null)?.getImage(1);if(!i){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=aP(r,r);this.draw_(e,s,t),i=s.canvas,FO.set(n,null,null,new zO(i,void 0,null,2,null))}return i}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let i=this.radius,r=void 0===this.radius2_?i:this.radius2_;if(i{this.patternImage_=null}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?HC(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:rI(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function cA(t,e,n,i){return void 0!==n&&void 0!==i?[n/t,i/e]:void 0!==n?n/t:void 0!==i?i/e:1}class uA extends sA{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,i=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:i,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(vk(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||HC(s)),vk(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),vk(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?rI(t.color):null,this.iconImage_=DO(s,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,n;if(t.size)[e,n]=t.size;else{const i=this.getImage(1);if(i.width&&i.height)e=i.width,n=i.height;else if(i instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const n=this.iconImage_.getSize();this.setScale(cA(n[0],n[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(cA(e,n,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new uA({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:n,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=n[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=DO(null,t,this.crossOrigin_,0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(_C,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(_C,t)}ready(){return this.iconImage_.ready()}}class hA{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new hA({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class dA{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=gA,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new dA({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=gA,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let pA=null;function fA(){if(!pA){const t=new lA({color:"rgba(255,255,255,0.4)"}),e=new hA({color:"#3399CC",width:1.25});pA=[new dA({image:new aA({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return pA}function gA(t){return t.getGeometry()}let mA=class t{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=aI(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new lA({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof lA?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=aI(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};function yA(){return!0}function _A(t){const e=SI(),n=function(t,e){const n=t.length,i=new Array(n);for(let r=0;rnull;i=EA(t,e+"fill-color",n)}if(!i)return null;const r=new lA;return function(t){const e=i(t);return e===UM?null:(r.setColor(e),r)}}function xA(t,e,n){const i=SA(t,e+"stroke-width",n),r=EA(t,e+"stroke-color",n);if(!i&&!r)return null;const s=CA(t,e+"stroke-line-cap",n),o=CA(t,e+"stroke-line-join",n),a=TA(t,e+"stroke-line-dash",n),l=SA(t,e+"stroke-line-dash-offset",n),c=SA(t,e+"stroke-miter-limit",n),u=new hA;return function(t){if(r){const e=r(t);if(e===UM)return null;u.setColor(e)}if(i&&u.setWidth(i(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),c&&u.setMiterLimit(c(t)),u}}function SA(t,e,n){if(!(e in t))return;const i=RO(t[e],uI,n);return function(t){return DA(i(t),e)}}function CA(t,e,n){if(!(e in t))return null;const i=RO(t[e],hI,n);return function(t){return zA(i(t),e)}}function kA(t,e,n){if(!(e in t))return null;const i=RO(t[e],cI,n);return function(t){const n=i(t);if("boolean"!=typeof n)throw new Error(`Expected a boolean for ${e}`);return n}}function EA(t,e,n){if(!(e in t))return null;const i=RO(t[e],dI,n);return function(t){return jA(i(t),e)}}function TA(t,e,n){if(!(e in t))return null;const i=RO(t[e],pI,n);return function(t){return LA(i(t),e)}}function RA(t,e,n){if(!(e in t))return null;const i=RO(t[e],pI,n);return function(t){const n=LA(i(t),e);if(2!==n.length)throw new Error(`Expected two numbers for ${e}`);return n}}function PA(t,e,n){if(!(e in t))return null;const i=RO(t[e],pI,n);return function(t){return NA(i(t),e)}}function MA(t,e,n){if(!(e in t))return null;const i=RO(t[e],pI|uI,n);return function(t){return function(t,e){return"number"==typeof t?t:NA(t,e)}(i(t),e)}}function IA(t,e){const n=t[e];if(void 0!==n){if("number"!=typeof n)throw new Error(`Expected a number for ${e}`);return n}}function OA(t,e){const n=t[e];if(void 0!==n){if("bottom-left"!==n&&"bottom-right"!==n&&"top-left"!==n&&"top-right"!==n)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return n}}function AA(t,e){const n=t[e];if(void 0!==n){if("pixels"!==n&&"fraction"!==n)throw new Error(`Expected pixels or fraction for ${e}`);return n}}function FA(t,e){const n=t[e];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${e}`);if("declutter"!==n&&"obstacle"!==n&&"none"!==n)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return n}}function LA(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const n=t.length;for(let i=0;i4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return n}function NA(t,e){const n=LA(t,e);if(2!==n.length)throw new Error(`Expected an array of two numbers for ${e}`);return n}const UA="renderOrder";class BA extends bM{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(UA)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter==0&&(t.declutter[n]=new kM(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(UA,t)}setStyle(t){this.style_=void 0===t?fA:t;const e=function(t){if(void 0===t)return fA;if(!t)return null;if("function"==typeof t)return t;if(t instanceof dA)return t;if(!Array.isArray(t))return vA([t]);if(0===t.length)return[];const e=t.length,n=t[0];if(n instanceof dA){const n=new Array(e);for(let i=0;i=0;--i){const r=f[i],s=r.layer;if(s.hasRenderer()&&wM(r,c)&&o.call(a,s)){const i=s.getRenderer(),o=s.getSource();if(i&&o){const s=o.getWrapX()?d:t,a=u.bind(null,r.managed);y[0]=s[0]+p[v][0],y[1]=s[1]+p[v][1],l=i.forEachFeatureAtCoordinate(y,e,n,a,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,n,i,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,n,i,OC,this,r,s)}getMap(){return this.map_}renderFrame(t){GC()}scheduleExpireIconCache(t){FO.canExpireCache()&&t.postRenderFunctions.push($A)}}function $A(){FO.expire()}class GA extends VA{constructor(t){super(t),this.fontChangeListenerKey_=BC(KO,yC,t.redrawText,t),this.element_=ok?gP():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=tP+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const i=new qA(t,void 0,e);n.dispatchEvent(i)}}disposeInternal(){VC(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(_M,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof BA&&t.layer.getDeclutter())&&(t.declutter={});const n=t.viewState;this.children_.length=0;const i=[];let r=null;for(let o=0,a=e.length;o0)&&(t.fillStyle=i,t.fillRect(0,0,s.width,s.height)),mP(n)&&n.width>0){const i=e.style.opacity||n.style.opacity;t.globalAlpha=""===i?1:Number(i);const r=n.style.transform;if(r)t.setTransform(...ZT(r));else{const e=parseFloat(n.style.width)/n.width,i=parseFloat(n.style.height)/n.height;t.setTransform(e,0,0,i,0,0)}t.drawImage(n,0,0)}}t.globalAlpha=1,t.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let n=e.length-1;n>=0;--n){const i=e[n],r=i.layer;r.getDeclutter()&&r.renderDeclutter(t,i)}e.forEach(e=>e.layer.renderDeferred(t))}}}function WA(t){t instanceof bM?t.setMapInternal(null):t instanceof gM&&t.getLayers().forEach(WA)}function HA(t,e){if(t instanceof bM)t.setMapInternal(e);else if(t instanceof gM){const n=t.getLayers().getArray();for(let t=0,i=n.length;tthis.updateSize())),this.controls=e.controls||(ok?new JC:wP()),this.interactions=e.interactions||(ok?new JC:tM({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new xk(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(gk,this.handleLayerGroupChanged_),this.addChangeListener(_k,this.handleViewChanged_),this.addChangeListener(mk,this.handleSizeChanged_),this.addChangeListener(yk,this.handleTargetChanged_),this.setProperties(e.values);const n=this;!t.view||t.view instanceof XR||t.view.then(function(t){n.setView(new XR(t))}),this.controls.addEventListener(gC,t=>{t.element.setMap(this)}),this.controls.addEventListener(mC,t=>{t.element.setMap(null)}),this.interactions.addEventListener(gC,t=>{t.element.setMap(this)}),this.interactions.addEventListener(mC,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(gC,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(mC,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){HA(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const i=this.getCoordinateFromPixelInternal(t),r=void 0!==(n=void 0!==n?n:{}).hitTolerance?n.hitTolerance:0,s=void 0!==n.layerFilter?n.layerFilter:OC,o=!1!==n.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(i,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(t){n.push(t)},e),n}getAllLayers(){const t=[];return function e(n){n.forEach(function(n){n instanceof gM?e(n.getLayers()):t.push(n)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t),i=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:OC,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,s,i,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),n=this.getSize(),i=e.width/n[0],r=e.height/n[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/i,(s.clientY-e.top)/r]}getTarget(){return this.get(yk)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return zT(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?WT(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(gk)}setLayers(t){const e=this.getLayerGroup();if(t instanceof JC)return void e.setLayers(t);const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e=0;n--){const i=e[n];if(i.getMap()===this&&i.getActive()&&this.getTargetElement()&&(!i.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let n=this.maxTilesLoading_,i=n;if(t){const e=t.viewHints;if(e[0]||e[1]){const e=Date.now()-t.time>8;n=e?0:8,i=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new pM("removelayer",e)),this.set(gk,t)}setSize(t){this.set(mk,t)}setTarget(t){this.set(yk,t)}setView(t){if(!t||t instanceof XR)return void this.set(_k,t);this.set(_k,new XR);const e=this;t.then(function(t){e.setView(new XR(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let n,i;if(mP(t))n=t.width,i=t.height;else{const e=getComputedStyle(t);n=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),i=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(n)||isNaN(i)||(e=[Math.max(0,n),Math.max(0,i)],!oI(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&RE("No map visible because the map container's width or height are 0."))}const n=this.getSize();!e||n&&IC(e,n)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const XA="element",YA="map",ZA="offset",JA="position",QA="positioning";class tF extends XC{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(XA,this.handleElementChanged),this.addChangeListener(YA,this.handleMapChanged),this.addChangeListener(ZA,this.handleOffsetChanged),this.addChangeListener(JA,this.handlePositionChanged),this.addChangeListener(QA,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(XA)}getId(){return this.id}getMap(){return this.get(YA)||null}getOffset(){return this.get(ZA)}getPosition(){return this.get(JA)}getPositioning(){return this.get(QA)}handleElementChanged(){fP(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),VC(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=BC(t,dk,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(XA,t)}setMap(t){this.set(YA,t)}setOffset(t){this.set(ZA,t)}setPosition(t){this.set(JA,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(JA))return;const n=this.getRect(e.getTargetElement(),e.getSize()),i=this.getElement(),r=this.getRect(i,[hP(i),dP(i)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!qk(n,r)){const i=r[0]-n[0],o=n[2]-r[2],a=r[1]-n[1],l=n[3]-r[3],c=[0,0];if(i<0?c[0]=i-s:o<0&&(c[0]=Math.abs(o)+s),a<0?c[1]=a-s:l<0&&(c[1]=Math.abs(l)+s),0!==c[0]||0!==c[1]){const n=e.getView().getCenterInternal(),i=e.getPixelFromCoordinateInternal(n);if(!i)return;const r=[i[0]+c[0],i[1]+c[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const n=t.getBoundingClientRect(),i=n.left+window.pageXOffset,r=n.top+window.pageYOffset;return[i,r,i+e[0],r+e[1]]}setPositioning(t){this.set(QA,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const n=t.getPixelFromCoordinate(e),i=t.getSize();this.updateRenderedPosition(n,i)}updateRenderedPosition(t,e){const n=this.element.style,i=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${o}) translate(${t[0]+i[0]}px, ${t[1]+i[1]}px)`;this.rendered.transform_!=a&&(this.rendered.transform_=a,n.transform=a)}getOptions(){return this.options}}class eF extends XC{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new eF(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(VC(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=BC(t,_C,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(vk("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function nF(t,e,n,i,r,s,o){let a,l;const c=(n-e)/i;if(1===c)a=e;else if(2===c)a=e,l=r;else if(0!==c){let s=t[e],o=t[e+1],c=0;const u=[0];for(let r=e+i;r>1),r=+n(t[i],e),r<0?s=i+1:(o=i,a=!r);return a?s:~s}(u,h);d<0?(l=(h-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*i):a=e+d*i}o=o>1?o:2,s=s||new Array(o);for(let u=0;u>1;ra&&(this.instructions.push([4,a,c,t,n,mR,r]),this.hitDetectionInstructions.push([4,a,c,t,i||n,mR,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),c=this.coordinates.length,this.instructions.push([4,a,c,t,n,void 0,r]),this.hitDetectionInstructions.push([4,a,c,t,i||n,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[0,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const n=t.length;let i,r,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const n=this.state;this.fillStyleToState(t,n),this.strokeStyleToState(e,n)}createFill(t){const e=t.fillStyle,n=[10,e];return"string"!=typeof e&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[hF,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;"string"==typeof n&&t.currentFillStyle==n||(this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,i=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=i||r!=t.currentLineDash&&!IC(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=i,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[7,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Nk(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;jk(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class yF extends mF{constructor(t,e,n,i){super(t,e,n,i)}drawFlatCoordinatess_(t,e,n,i){const r=this.state,s=void 0!==r.fillStyle,o=void 0!==r.strokeStyle,a=n.length;this.instructions.push(fF),this.hitDetectionInstructions.push(fF);for(let l=0;l=t){const e=(t-a+h)/h,d=Mk(n,c,e),p=Mk(i,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function vF(t,e,n,i,r){let s,o,a,l,c,u,h,d,p,f,g=n,m=n,y=0,_=0,v=n;for(o=n;ot&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,h=p,d=f),c=n,u=i}return _+=l,_>y?[v,o]:[g,m]}const bF={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},wF={Circle:yF,Default:mF,Image:class extends mF{constructor(t,e,n,i){super(t,e,n,i),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,n){if(!this.image_||this.maxExtent&&!Bk(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const i=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,r);this.instructions.push([6,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([6,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,n){if(!this.image_)return;this.beginGeometry(t,e,n);const i=t.getFlatCoordinates(),r=[];for(let a=0,l=i.length;a{const i=o[2*(t+n)]===c[n*u]&&o[2*(t+n)+1]===c[n*u+1];return i||--t,i})}this.saveTextStates_();const h=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,n);let p=s.padding;if(p!=HO&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],n=s.padding[2],i=s.padding[3];s.scale[0]<0&&(e=-e,i=-i),s.scale[1]<0&&(t=-t,n=-n),p=[t,e,n,i]}const f=this.pixelRatio;this.instructions.push([6,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==HO?HO:p.map(function(t){return t*f}),h,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const g=1/f,m=h?h.slice(0):null;m&&(m[1]=UO),this.hitDetectionInstructions.push([6,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,p,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?UO:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),this.endGeometry(e)}else{if(!pE(this.maxExtent,t.getExtent()))return;let i;if(c=t.getFlatCoordinates(),"LineString"==l)i=[c.length];else if("MultiLineString"==l)i=t.getEnds();else if("Polygon"==l)i=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else R=w>E;const P=Math.PI,M=[],I=S+i===e;let O;if(y=0,_=C,p=t[e=S],f=t[e+1],I){v(),O=Math.atan2(f-m,p-g),R&&(O+=O>0?-P:P);const t=(E+w)/2,e=(T+x)/2;return M[0]=[t,e,(k-s)/2,O,r],M}for(let A=0,F=(r=r.replace(/\n/g," ")).length;A0?-P:P),void 0!==O){let e=t-O;if(e+=e>P?-2*P:e<-P?2*P:0,Math.abs(e)>o)return null}O=t;const h=A;let d=0;for(;A{if("function"==typeof cP()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,n)=>(this.push_(e,n),!0)})}push_(...t){const e=this.instructions_,n=this.zIndex+this.offset_;e[n]||(e[n]=[]),e[n].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,i=e.length;n0&&t.push("\n",""),t.push(e,""),t}function FF(t,e,n){return n%2==0&&(t+=e),t}class LF{constructor(t,e,n,i,r){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=i.instructions,this.coordinates=i.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=i.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=i.fillStates||{},this.strokeStates=i.strokeStates||{},this.textStates=i.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new CF:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,i){const r=t+e+n+i;if(this.labels_[r])return this.labels_[r];const s=i?this.strokeStates[i]:null,o=n?this.fillStates[n]:null,a=this.textStates[e],l=this.pixelRatio,c=[a.scale[0]*l,a.scale[1]*l],u=a.justify?bF[a.justify]:OF(Array.isArray(t)?t[0]:t,a.textAlign||GO),h=i&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(AF,[]),{width:p,height:f,widths:g,heights:m,lineWidths:y}=function(t,e){const n=[],i=[],r=[];let s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){const h=e[c];if("\n"===h||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[c+1]||t.font,p=iA(d,h);n.push(p),o+=p;const f=eA(d);i.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:n,heights:i,lineWidths:r}}(a,d),_=p+h,v=[],b=(_+2)*c[0],w=(f+h)*c[1],x={width:b<0?Math.floor(b):Math.ceil(b),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==c[0]&&1==c[1]||v.push("scale",c),i&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",h),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),n&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let C=u*_+S*h;const k=[],E=[];let T,R=0,P=0,M=0,I=0;for(let O=0,A=d.length;Ot?t-l:r,v=s+c>e?e-c:s,b=p[3]+_*h[0]+p[1],w=p[0]+v*h[1]+p[2],x=m-p[3],S=y-p[0];let C;return(f||0!==u)&&(EF[0]=x,PF[0]=x,EF[1]=S,TF[1]=S,TF[0]=x+b,RF[0]=TF[0],RF[1]=S+w,PF[1]=RF[1]),0!==u?(C=KT([1,0,0,1,0,0],n,i,1,1,u,-n,-i),WT(C,EF),WT(C,TF),WT(C,RF),WT(C,PF),Gk(Math.min(EF[0],TF[0],RF[0],PF[0]),Math.min(EF[1],TF[1],RF[1],PF[1]),Math.max(EF[0],TF[0],RF[0],PF[0]),Math.max(EF[1],TF[1],RF[1],PF[1]),kF)):Gk(Math.min(x,x+b),Math.min(S,S+w),Math.max(x,x+b),Math.max(S,S+w),kF),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:c,declutterBox:{minX:kF[0],minY:kF[1],maxX:kF[2],maxY:kF[3],value:g},canvasTransform:C,scale:h}}replayImageOrLabel_(t,e,n,i,r,s,o){const a=!(!s&&!o),l=i.declutterBox,c=o?o[2]*i.scale[0]/2:0;return l.minX-c<=e[0]&&l.maxX+c>=0&&l.minY-c<=e[1]&&l.maxY+c>=0&&(a&&this.replayTextBackground_(t,EF,TF,RF,PF,s,o),function(t,e,n,i,r,s,o,a,l,c,u){t.save(),1!==n&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=n:t.globalAlpha*=n),e&&t.transform.apply(t,e),i.contextInstructions?(t.translate(l,c),t.scale(u[0],u[1]),function(t,e){const n=t.contextInstructions;for(let i=0,r=n.length;iF&&(this.fill_(t),R=0),P>F&&(t.stroke(),P=0),R||P||(t.beginPath(),_=NaN,v=NaN),++d;break;case 2:T=n[1];const i=c[T],u=c[T+1],h=c[T+2]-i,p=c[T+3]-u,N=Math.sqrt(h*h+p*p);t.moveTo(i+N,u),t.arc(i,u,N,0,2*Math.PI,!0),++d;break;case 3:t.closePath(),++d;break;case 4:T=n[1],f=n[2];const U=n[3],B=n[4],q=n[5];A.geometry=U,A.feature=L,d in M||(M[d]=[]);const V=M[d];q?q(c,T,f,2,V):(V[0]=c[T],V[1]=c[T+1],V.length=2),l&&(l.zIndex=n[6]),B(V,A),++d;break;case 6:T=n[1],f=n[2],x=n[3],g=n[4],m=n[5];let $=n[6];const G=n[7],W=n[8],H=n[9],K=n[10];let X=n[11];const Y=n[12];let Z=n[13];y=n[14]||"declutter";const J=n[15];if(!x&&n.length>=20){S=n[19],C=n[20],k=n[21],E=n[22];const t=this.drawLabelWithPointPlacement_(S,C,k,E);x=t.label,n[3]=x;const e=n[23];g=(t.anchorX-e)*this.pixelRatio,n[4]=g;const i=n[24];m=(t.anchorY-i)*this.pixelRatio,n[5]=m,$=x.height,n[6]=$,Z=x.width,n[13]=Z}let Q,tt,et,nt;n.length>25&&(Q=n[25]),n.length>17?(tt=n[16],et=n[17],nt=n[18]):(tt=HO,et=null,nt=null),K&&O?X+=I:K||O||(X-=I);let it=0;for(;T!DF.includes(t));class NF{constructor(t,e,n,i,r,s,o){this.maxExtent_=t,this.overlaps_=i,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let i=this.executorsByZIndex_[n];void 0===i&&(i={},this.executorsByZIndex_[n]=i);const r=t[n];for(const t in r){const n=r[t];i[t]=new LF(this.resolution_,this.pixelRatio_,this.overlaps_,n,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let e=0,i=t.length;en)break;let a=i[o];a||(a=[],i[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const r=[];for(let s=0,o=i.length;s0){if(!s||"none"===n||"Image"!==d&&"Text"!==d||s.includes(t)){const n=(h[l]-3)/4,s=i-n%o,a=i-(n/o|0),c=r(t,e,s*s+a*a);if(c)return c}c.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,v;for(f.sort(EC),g=f.length-1;g>=0;--g){const t=f[g].toString();for(y=this.executorsByZIndex_[t],m=zF.length-1;m>=0;--m)if(d=zF[m],_=y[d],void 0!==_&&(v=_.executeHitDetection(c,a,n,p,u),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],i=e[1],r=e[2],s=e[3],o=[n,i,n,s,r,s,r,i];return JT(o,0,8,2,t,o),o}isEmpty(){return jC(this.executorsByZIndex_)}execute(t,e,n,i,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?TC:EC),s=s||zF;const l=zF.length;for(let c=0,u=a.length;cp.execute(t,e,n,i,r,o)):p.execute(h,e,n,i,r,o),d&&h.restore(),s){s.offset();const t=a[c]*l+zF.indexOf(u);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(EC);for(let n=0,i=e.length;n{t.draw(this.renderedContext_),t.clear()}),t[e[n]].length=0}}const UF={};class BF extends uF{constructor(t,e,n,i,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=i,this.transformRotation_=i?Ik(Math.atan2(i[1],i[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,n,i){if(!this.image_)return;const r=JT(t,e,n,i,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let c=0,u=r.length;ct*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:VO,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:jO(t||$O)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const n=t.getPixelRatio(this.pixelRatio_),i=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=i[0]*n,this.imageAnchorY_=i[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/n,s[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:jO(t||UO)}}else this.textFillState_=null;const n=t.getStroke();if(n){const t=n.getColor(),e=n.getLineCap(),i=n.getLineDash(),r=n.getLineDashOffset(),s=n.getLineJoin(),o=n.getWidth(),a=n.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:BO,lineDash:i||qO,lineDashOffset:r||0,lineJoin:void 0!==s?s:VO,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:jO(t||$O)}}else this.textStrokeState_=null;const i=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),h=t.getTextBaseline();this.textState_={font:void 0!==i?i:NO,textAlign:void 0!==u?u:GO,textBaseline:void 0!==h?h:WO},this.text_=void 0!==c?Array.isArray(c)?c.reduce((t,e,n)=>t+(n%2?" ":e),""):c:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const qF=.5;function VF(t,e,n,i,r,s,o,a,l){const c=r,u=aP(t[0]*qF,t[1]*qF);u.imageSmoothingEnabled=!1;const h=u.canvas,d=new BF(u,qF,r,null,o,a,l?IT(null,l):null),p=n.length,f=Math.floor(16777215/p),g={};for(let y=1;y<=p;++y){const t=n[y-1],e=t.getStyleFunction()||i;if(!e)continue;let r=e(t,s);if(!r)continue;Array.isArray(r)||(r=[r]);const o=(y*f).toString(16).padStart(7,"#00000");for(let n=0,i=r.length;n0;return h&&Promise.all(l).then(()=>r(null)),function(t,e,n,i,r,s,o){const a=n.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(i,r);n.getRenderer()?YF(t,l,n,e,o):(0,GF[l.getType()])(t,l,n,e,o,s)}(t,e,n,i,s,o,a),h}function YF(t,e,n,i,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;ethis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return GC()}getData(t){return null}prepareFrame(t){return GC()}renderFrame(t,e){return GC()}forEachFeatureAtCoordinate(t,e,n,i,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(_C,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const JF=[];let QF=null;class tL extends ZF{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,n){let i;QF||(QF=aP(1,1,void 0,{willReadFrequently:!0})),QF.clearRect(0,0,1,1);try{QF.drawImage(t,e,n,1,1,0,0,1,1),i=QF.getImageData(0,0,1,1).data}catch{return QF=null,null}return i}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,n){const i=this.getLayer().getClassName();let r,s;if(t&&t.className===i&&(!n||t&&t.style.backgroundColor&&IC(rI(t.style.backgroundColor),rI(n)))){const e=t.firstElementChild;mP(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const n=ZT(t),i=ZT(e);for(let r=0;r<6;++r)if(0!==Math.round((n[r]-i[r])*YT[r]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=ok?gP():document.createElement("div"),r.className=i;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=aP();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!n||this.container.style.backgroundColor||(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const i=uE(n),r=hE(n),s=iE(n),o=nE(n);WT(e.coordinateToPixelTransform,i),WT(e.coordinateToPixelTransform,r),WT(e.coordinateToPixelTransform,s),WT(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;WT(a,i),WT(a,r),WT(a,s),WT(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const n=t.extent,i=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(dE(n)/i*s),a=Math.round(lE(n)/i*s);KT(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),XT(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,n){const i=this.getLayer();if(i.hasListener(t)){const r=new qA(t,this.inversePixelTransform,n,e);i.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(mM,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(yM,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new CF),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(mM,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(yM,this.context,t))}getRenderTransform(t,e,n,i,r,s,o){const a=r/2,l=s/2,c=i/e,u=-c,h=-t[0]+o,d=-t[1];return KT(this.tempTransform,a,l,c,u,-n,h,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class eL extends tL{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,n){const i=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,c=a.getExtent(),u=this.getLayer().getSource(),h=this.getLayer().getDeclutter(),d=e.pixelRatio,p=e.viewHints,f=!(p[0]||p[1]),g=this.context,m=Math.round(dE(i)/o*d),y=Math.round(lE(i)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?dE(c):null,b=_?Math.ceil((i[2]-c[2])/v)+1:1;let w=_?Math.floor((i[0]-c[0])/v):0;do{let i=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(i=i.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],i,l,f,void 0===n?zF:n?DF:jF,n?h&&e.declutter[h]:void 0)}while(++w{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,n=this.renderedResolution_,i=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*qF,c=t[1]*qF;a.push(this.getRenderTransform(e,n,i,qF,l,c,0).slice());const u=o.getSource(),h=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!qk(h,s)){let t=s[0];const r=dE(h);let o,u=0;for(;th[2];)++u,o=r*u,a.push(this.getRenderTransform(e,n,i,qF,l,c,o).slice()),t-=r}this.hitDetectionImageData_=VF(t,a,this.renderedFeatures_,o.getStyleFunction(),s,n,i,HF(n,this.renderedPixelRatio_),null)}e($F(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,i,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,n,function(t,e,n){const s=HC(t),o=l[s];if(o){if(!0!==o&&nt.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const i=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&i||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,c=l.projection,u=l.resolution,h=t.pixelRatio,d=e.getRevision(),p=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=WF);const g=l.center.slice(),m=jk(a,p*u),y=m.slice(),_=[m.slice()],v=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!qk(v,t.extent)){const t=dE(v),e=Math.max(dE(m)/2,t);m[0]=v[0]-e,m[2]=v[2]+e,bE(g,c);const n=mE(_[0],c);n[0]v[0]&&n[2]>v[2]&&_.push([n[0]-t,n[1],n[2]-t,n[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&qk(this.wrappedRenderedExtent_,m))return IC(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const b=new xF(KF(u,h),m,u,h);for(let R=0,P=_.length;R{let i;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(i=r(t,u)),i){const e=this.renderFeature(t,w,i,b,void 0,this.getLayer().getDeclutter(),n);x=x&&!e}},C=m,k=n.getFeaturesInExtent(C);f&&k.sort(f);for(let R=0,P=k.length;R=200&&a.status<300){const t=e.getType();try{let i;"text"==t||"json"==t?i=a.responseText:"xml"==t?i=a.responseXML||a.responseText:"arraybuffer"==t&&(i=a.response),i?s(e.readFeatures(i,{extent:n,featureProjection:r}),e.readProjection(i)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function rL(t,e){return function(n,i,r,s,o){iL(t,e,n,i,r,t=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}function sL(){return[[-1/0,-1/0,1/0,1/0]]}function oL(t){return[t]}class aL extends nR{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(VC),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,n=t.length;et.clone())}const cL=[1,0,0,1,0,0];class uL{constructor(t,e,n,i,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=r,this.squaredTolerance_,this.stride_=i,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Hk(this.flatCoordinates_):Kk(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=rE(this.getExtent());this.flatInteriorPoints_=PR(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=BR(this.flatCoordinates_,this.ends_),e=lF(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=MR(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=nF(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const n=this.ends_;for(let i=0,r=n.length;i{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const n=this.simplifiedGeometry_.getFlatCoordinates();let i;switch(this.type_){case"LineString":n.length=vR(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),i=[n.length];break;case"MultiLineString":i=[],n.length=bR(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,i);break;case"Polygon":i=[],n.length=SR(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,i)}return i&&(this.simplifiedGeometry_=new uL(this.type_,n,i,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}uL.prototype.getFlatCoordinates=uL.prototype.getOrientedFlatCoordinates;class hL{constructor(t){this.rbush_=new kM(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[HC(e)]=n}load(t,e){const n=new Array(e.length);for(let i=0,r=e.length;it):null}const fL="addfeature",gL="removefeature";class mL extends NC{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class yL extends dL{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=FC,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(vk(this.format_,"`format` must be set when `url` is set"),this.loader_=rL(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:sL;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let n,i;this.featuresRtree_=e?new hL:null,this.loadedExtentsRtree_=new hL,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?i=t.features:t.features&&(n=t.features,i=n.getArray()),e||void 0!==n||(n=new JC(i)),void 0!==i&&this.addFeaturesInternal(i),void 0!==n&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=HC(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const e=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new mL(fL,t))}setupChangeEvents_(t,e){e instanceof uL||(this.featureChangeKeys_[t]=[BC(e,_C,this.handleFeatureChange_,this),BC(e,yC,this.handleFeatureChange_,this)])}addToIndex_(t,e){let n=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof uL){const i=this.idIndex_[t];i instanceof uL?Array.isArray(i)?i.push(e):this.idIndex_[t]=[i,e]:n=!1}else n=!1;else this.idIndex_[t]=e}return n&&(vk(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],i=[];for(let r=0,s=t.length;r{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(mC,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(VC);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new mL("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(n){const i=n.getGeometry();if(i instanceof uL||i.intersectsCoordinate(t))return e(n)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){const i=n.getGeometry();if(i instanceof uL||i.intersectsExtent(t)){const t=e(n);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),jC(this.nullGeometryFeatures_)||MC(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const n=yE(t,e);return[].concat(...n.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],i=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||OC,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof uL?0:e.closestPointXY(n,i,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new mL("featuresloadend",void 0,t))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new mL("featuresloaderror"))}),i.insert(t,{extent:t.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,n=e.forEachInExtent(t,function(e){if(Xk(e.extent,t))return e});n&&e.remove(n)}removeFeatures(t){let e=!1;for(let n=0,i=t.length;n{t in e&&(n[t]=e[t])}),n}function OL(t){t=t.slice();const e=Object.create(null);for(let n=0;n`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const JL=[LL,zL,DL,jL,NL,UL,$L,BL,YL(qL),GL,HL,WL,KL,XL];function QL(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!QL(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of JL)if(!QL(t,e))return null}return`Expected ${ZL(t)} but found ${ZL(e)} instead.`}function tz(t,e){return e.some(e=>e.kind===t.kind)}function ez(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function nz(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const iz=.96422,rz=.82521,sz=4/29,oz=6/29,az=3*oz*oz,lz=oz*oz*oz,cz=Math.PI/180,uz=180/Math.PI;function hz(t){return(t%=360)<0&&(t+=360),t}function dz([t,e,n,i]){let r,s;const o=fz((.2225045*(t=pz(t))+.7168786*(e=pz(e))+.0606169*(n=pz(n)))/1);t===e&&e===n?r=s=o:(r=fz((.4360747*t+.3850649*e+.1430804*n)/iz),s=fz((.0139322*t+.0971045*e+.7141733*n)/rz));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),i]}function pz(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fz(t){return t>lz?Math.pow(t,1/3):t/az+sz}function gz([t,e,n,i]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(n)?r:r-n/200;return r=1*yz(r),s=iz*yz(s),o=rz*yz(o),[mz(3.1338561*s-1.6168667*r-.4906146*o),mz(-.9787684*s+1.9161415*r+.033454*o),mz(.0719453*s-.2289914*r+1.4052427*o),i]}function mz(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function yz(t){return t>oz?t*t*t:az*(t-sz)}const _z=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function vz(t,e){return _z(t,e)?t[e]:void 0}function bz(t){return parseInt(t.padEnd(2,t),16)/255}function wz(t,e){return xz(e?t/100:t,0,1)}function xz(t,e,n){return Math.min(Math.max(e,t),n)}function Sz(t){return!t.some(Number.isNaN)}const Cz={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function kz(t,e,n){return t+n*(e-t)}function Ez(t,e,n){return t.map((t,i)=>kz(t,e[i],n))}class Tz{constructor(t,e,n,i=1,r=!0){this.r=t,this.g=e,this.b=n,this.a=i,r||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,e,n,i]))}static parse(t){if(t instanceof Tz)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=vz(Cz,t);if(e){const[t,n,i]=e;return[t/255,n/255,i/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let n=1;return[bz(t.slice(n,n+=e)),bz(t.slice(n,n+=e)),bz(t.slice(n,n+=e)),bz(t.slice(n,n+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=t.match(e);if(n){const[t,e,i,r,s,o,a,l,c,u,h,d]=n,p=[r||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const t=[i,o,c].join(""),n="%%%"===t?100:""===t?255:0;if(n){const t=[xz(+e/n,0,1),xz(+s/n,0,1),xz(+l/n,0,1),h?wz(+h,d):1];if(Sz(t))return t}}return}}const n=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[t,e,i,r,s,o,a,l,c]=n,u=[i||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,xz(+r,0,100),xz(+o,0,100),l?wz(+l,c):1];if(Sz(t))return function([t,e,n,i]){function r(i){const r=(i+t/30)%12,s=e*Math.min(n,1-n);return n-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=hz(t),e/=100,n/=100,[r(0),r(8),r(4),i]}(t)}}}(t);return e?new Tz(...e,!1):void 0}get rgb(){const{r:t,g:e,b:n,a:i}=this,r=i||1/0;return this.overwriteGetter("rgb",[t/r,e/r,n/r,i])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,n,i,r]=dz(t),s=Math.sqrt(n*n+i*i);return[Math.round(1e4*s)?hz(Math.atan2(i,n)*uz):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",dz(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,n,i]=this.rgb;return`rgba(${[t,e,n].map(t=>Math.round(255*t)).join(",")},${i})`}static interpolate(t,e,n,i="rgb"){switch(i){case"rgb":{const[i,r,s,o]=Ez(t.rgb,e.rgb,n);return new Tz(i,r,s,o,!1)}case"hcl":{const[i,r,s,o]=t.hcl,[a,l,c,u]=e.hcl;let h,d;if(isNaN(i)||isNaN(a))isNaN(i)?isNaN(a)?h=NaN:(h=a,1!==s&&0!==s||(d=l)):(h=i,1!==c&&0!==c||(d=r));else{let t=a-i;a>i&&t>180?t-=360:a180&&(t+=360),h=i+n*t}const[p,f,g,m]=function([t,e,n,i]){return t=isNaN(t)?0:t*cz,gz([n,Math.cos(t)*e,Math.sin(t)*e,i])}([h,null!=d?d:kz(r,l,n),kz(s,c,n),kz(o,u,n)]);return new Tz(p,f,g,m,!1)}case"lab":{const[i,r,s,o]=gz(Ez(t.lab,e.lab,n));return new Tz(i,r,s,o,!1)}}}}Tz.black=new Tz(0,0,0,1),Tz.white=new Tz(1,1,1,1),Tz.transparent=new Tz(0,0,0,0),Tz.red=new Tz(1,0,0,1);class Rz{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Pz=["bottom","center","top"];class Mz{constructor(t,e,n,i,r,s){this.text=t,this.image=e,this.scale=n,this.fontStack=i,this.textColor=r,this.verticalAlign=s}}class Iz{constructor(t){this.sections=t}static fromString(t){return new Iz([new Mz(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Iz?t:Iz.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class Oz{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Oz)return t;if("number"==typeof t)return new Oz([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Oz(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new Oz(Ez(t.values,e.values,n))}}class Az{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Az)return t;if("number"==typeof t)return new Az([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new Az(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new Az(Ez(t.values,e.values,n))}}class Fz{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Fz)return t;if("string"==typeof t){const e=Tz.parse(t);if(!e)return;return new Fz([e])}if(!Array.isArray(t))return;const e=[];for(const n of t){if("string"!=typeof n)return;const t=Tz.parse(n);if(!t)return;e.push(t)}return new Fz(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n,i="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,n,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,n,i]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Bz(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Nz||t instanceof Tz||t instanceof Rz||t instanceof Iz||t instanceof Oz||t instanceof Az||t instanceof Fz||t instanceof Dz||t instanceof jz)return!0;if(Array.isArray(t)){for(const e of t)if(!Bz(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Bz(t[e]))return!1;return!0}return!1}function qz(t){if(null===t)return LL;if("string"==typeof t)return DL;if("boolean"==typeof t)return jL;if("number"==typeof t)return zL;if(t instanceof Tz)return NL;if(t instanceof Nz)return UL;if(t instanceof Rz)return VL;if(t instanceof Iz)return $L;if(t instanceof Oz)return GL;if(t instanceof Az)return HL;if(t instanceof Fz)return WL;if(t instanceof Dz)return XL;if(t instanceof jz)return KL;if(Array.isArray(t)){const e=t.length;let n;for(const i of t){const t=qz(i);if(n){if(n===t)continue;n=qL;break}n=t}return YL(n||qL,e)}return BL}function Vz(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Tz||t instanceof Nz||t instanceof Iz||t instanceof Oz||t instanceof Az||t instanceof Fz||t instanceof Dz||t instanceof jz?t.toString():JSON.stringify(t)}class $z{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Bz(t[1]))return e.error("invalid value");const n=t[1];let i=qz(n);const r=e.expectedType;return"array"!==i.kind||0!==i.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(i=r),new $z(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Gz={string:DL,number:zL,boolean:jL,object:BL};class Wz{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n,i=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in Gz)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Gz[n],i++}else r=qL;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],i++}n=YL(r,s)}else{if(!Gz[r])throw new Error(`Types doesn't contain name = ${r}`);n=Gz[r]}const s=[];for(;it.outputDefined())}}const Hz={"to-boolean":jL,"to-color":NL,"to-number":zL,"to-string":DL};class Kz{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[0];if(!Hz[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const i=Hz[n],r=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Uz(e[0],e[1],e[2],e[3]),!n))return new Tz(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Lz(n||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const n of this.args){e=n.evaluate(t);const i=Oz.parse(e);if(i)return i}throw new Lz(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const n of this.args){e=n.evaluate(t);const i=Az.parse(e);if(i)return i}throw new Lz(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const n of this.args){e=n.evaluate(t);const i=Fz.parse(e);if(i)return i}throw new Lz(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const n of this.args){e=n.evaluate(t);const i=Dz.parse(e);if(i)return i}throw new Lz(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new Lz(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Iz.fromString(Vz(this.args[0].evaluate(t)));case"resolvedImage":return jz.fromString(Vz(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Vz(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Xz=["Unknown","Point","LineString","Polygon"];class Yz{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Xz[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=Tz.parse(t),this._parseColorCache.set(t,e)),e}}class Zz{constructor(t,e,n=[],i,r=new FL,s=[]){this.registry=t,this.path=n,this.key=n.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=i,this._isConstant=e}parse(t,e,n,i,r={}){return e?this.concat(e,n,i)._parse(t,r):this._parse(t,r)}_parse(t,e){function n(t,e,n){return"assert"===n?new Wz(e,[t]):"coerce"===n?new Kz(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[r];if(s){let r=s.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(i.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(i.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(i.kind)||"colorArray"===t.kind&&["value","string","array"].includes(i.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(i.kind))r=n(r,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,i))return null}else r=n(r,t,e.typeAnnotation||"assert")}if(!(r instanceof $z)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new Yz;try{r=new $z(r.type,r.evaluate(t))}catch(i){return this.error(i.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const i="number"==typeof t?this.path.concat(t):this.path,r=n?this.scope.concat(n):this.scope;return new Zz(this.registry,this._isConstant,i,e||null,r,this.errors)}error(t,...e){const n=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new AL(n,t))}checkSubtype(t,e){const n=QL(t,e);return n&&this.error(n),n}}class Jz{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let r=1;r=n.length)throw new Lz(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new Lz(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class eD{constructor(t,e){this.type=jL,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,qL),i=e.parse(t[2],2,qL);return n&&i?tz(n.type,[jL,DL,zL,LL,qL])?new eD(n,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ZL(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!ez(e,["boolean","string","number","null"]))throw new Lz(`Expected first argument to be of type boolean, string, number or null, but found ${ZL(qz(e))} instead.`);if(!ez(n,["string","array"]))throw new Lz(`Expected second argument to be of type array or string, but found ${ZL(qz(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class nD{constructor(t,e,n){this.type=zL,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,qL),i=e.parse(t[2],2,qL);if(!n||!i)return null;if(!tz(n.type,[jL,DL,zL,LL,qL]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ZL(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,zL);return r?new nD(n,i,r):null}return new nD(n,i)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!ez(e,["boolean","string","number","null"]))throw new Lz(`Expected first argument to be of type boolean, string, number or null, but found ${ZL(qz(e))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),ez(n,["string"])){const t=n.indexOf(e,i);return-1===t?-1:[...n.slice(0,t)].length}if(ez(n,["array"]))return n.indexOf(e,i);throw new Lz(`Expected second argument to be of type array or string, but found ${ZL(qz(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class iD{constructor(t,e,n,i,r,s){this.inputType=t,this.type=e,this.input=n,this.cases=i,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let n,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r={},s=[];for(let l=2;lNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,qz(t)))return null}else n=qz(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,s.push(u)}const o=e.parse(t[1],1,qL);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,i);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(n,o.type)?null:new iD(n,i,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(qz(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class rD{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i=[];for(let s=1;se.outputDefined())&&this.otherwise.outputDefined()}}class sD{constructor(t,e,n,i){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,qL),i=e.parse(t[2],2,zL);if(!n||!i)return null;if(!tz(n.type,[YL(qL),DL,qL]))return e.error(`Expected first argument to be of type array or string, but found ${ZL(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,zL);return r?new sD(n.type,n,i,r):null}return new sD(n.type,n,i)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let i;if(this.endIndex&&(i=this.endIndex.evaluate(t)),ez(e,["string"]))return[...e].slice(n,i).join("");if(ez(e,["array"]))return e.slice(n,i);throw new Lz(`Expected first argument to be of type array or string, but found ${ZL(qz(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function oD(t,e){const n=t.length-1;let i,r,s=0,o=n,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),i=t[a],r=t[a+1],i<=e){if(a===n||ee))throw new Lz("Input is not a number.");o=a-1}return 0}class aD{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[i,r]of n)this.labels.push(i),this.outputs.push(r)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const n=e.parse(t[1],1,zL);if(!n)return null;const i=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let s=1;s=n)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,r);if(!c)return null;r=r||c.type,i.push([n,c])}return new aD(r,n,i)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;return i>=e[r-1]?n[r-1].evaluate(t):n[oD(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function lD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cD,uD,hD=function(){if(uD)return cD;function t(t,e,n,i){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=n,this.p2y=i}return uD=1,cD=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var n=t,i=0;i<8;i++){var r=this.sampleCurveX(n)-t;if(Math.abs(r)r?o=n:a=n,n=.5*(a-o)+o;return n},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},cD}(),dD=lD(hD);class pD{constructor(t,e,n,i,r){this.type=t,this.operator=e,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(const[s,o]of r)this.labels.push(s),this.outputs.push(o)}static interpolationFactor(t,e,n,i){let r=0;if("exponential"===t.name)r=fD(e,t.base,n,i);else if("linear"===t.name)r=fD(e,1,n,i);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new dD(s[0],s[1],s[2],s[3]).solve(fD(e,1,n,i))}return r}static parse(t,e){let[n,i,r,...s]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,zL),!r)return null;const o=[];let a=null;"interpolate-hcl"!==n&&"interpolate-lab"!==n||e.expectedType==WL?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=NL;for(let l=0;l=t)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=e.parse(n,r,a);if(!c)return null;a=a||c.type,o.push([t,c])}return nz(a,zL)||nz(a,UL)||nz(a,NL)||nz(a,GL)||nz(a,HL)||nz(a,WL)||nz(a,XL)||nz(a,YL(zL))?new pD(a,n,i,r,o):e.error(`Type ${ZL(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;if(i>=e[r-1])return n[r-1].evaluate(t);const s=oD(e,i),o=e[s],a=e[s+1],l=pD.interpolationFactor(this.interpolation,i,o,a),c=n[s].evaluate(t),u=n[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return kz(c,u,l);case"color":return Tz.interpolate(c,u,l);case"padding":return Oz.interpolate(c,u,l);case"colorArray":return Fz.interpolate(c,u,l);case"numberArray":return Az.interpolate(c,u,l);case"variableAnchorOffsetCollection":return Dz.interpolate(c,u,l);case"array":return Ez(c,u,l);case"projectionDefinition":return Nz.interpolate(c,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return Tz.interpolate(c,u,l,"hcl");case"colorArray":return Fz.interpolate(c,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Tz.interpolate(c,u,l,"lab");case"colorArray":return Fz.interpolate(c,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function fD(t,e,n,i){const r=i-n,s=t-n;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}class gD{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n=null;const i=e.expectedType;i&&"value"!==i.kind&&(n=i);const r=[];for(const o of t.slice(1)){const t=e.parse(o,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n=n||t.type,r.push(t)}if(!n)throw new Error("No output type");const s=i&&r.some(t=>QL(i,t.type));return new gD(s?qL:n,r)}evaluate(t){let e,n=null,i=0;for(const r of this.args)if(i++,n=r.evaluate(t),n&&n instanceof jz&&!n.available&&(e||(e=n.name),n=null,i===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function mD(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function yD(t,e,n,i){return 0===i.compare(e,n)}function _D(t,e,n){const i="=="!==t&&"!="!==t;return class r{constructor(t,e,n){this.type=jL,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let s=e.parse(t[1],1,qL);if(!s)return null;if(!mD(n,s.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${ZL(s.type)}'.`);let o=e.parse(t[2],2,qL);if(!o)return null;if(!mD(n,o.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${ZL(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${ZL(s.type)}' and '${ZL(o.type)}'.`);i&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Wz(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Wz(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,VL),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){const e=qz(s),n=qz(o);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new Lz(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=qz(s),n=qz(o);if("string"!==t.kind||"string"!==n.kind)return e(r,s,o)}return this.collator?n(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const vD=_D("==",function(t,e,n){return e===n},yD),bD=_D("!=",function(t,e,n){return e!==n},function(t,e,n,i){return!yD(0,e,n,i)}),wD=_D("<",function(t,e,n){return e",function(t,e,n){return e>n},function(t,e,n,i){return i.compare(e,n)>0}),SD=_D("<=",function(t,e,n){return e<=n},function(t,e,n,i){return i.compare(e,n)<=0}),CD=_D(">=",function(t,e,n){return e>=n},function(t,e,n,i){return i.compare(e,n)>=0});class kD{constructor(t,e,n){this.type=VL,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");const i=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,jL);if(!i)return null;const r=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,jL);if(!r)return null;let s=null;return n.locale&&(s=e.parse(n.locale,1,DL),!s)?null:new kD(i,r,s)}evaluate(t){return new Rz(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class ED{constructor(t,e,n,i,r){this.type=DL,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,zL);if(!n)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let r=null;if(i.locale&&(r=e.parse(i.locale,1,DL),!r))return null;let s=null;if(i.currency&&(s=e.parse(i.currency,1,DL),!s))return null;let o=null;if(i["min-fraction-digits"]&&(o=e.parse(i["min-fraction-digits"],1,zL),!o))return null;let a=null;return i["max-fraction-digits"]&&(a=e.parse(i["max-fraction-digits"],1,zL),!a)?null:new ED(n,r,s,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class TD{constructor(t){this.type=$L,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const i=[];let r=!1;for(let s=1;s<=t.length-1;++s){const n=t[s];if(r&&"object"==typeof n&&!Array.isArray(n)){r=!1;let t=null;if(n["font-scale"]&&(t=e.parse(n["font-scale"],1,zL),!t))return null;let s=null;if(n["text-font"]&&(s=e.parse(n["text-font"],1,YL(DL)),!s))return null;let o=null;if(n["text-color"]&&(o=e.parse(n["text-color"],1,NL),!o))return null;let a=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!Pz.includes(n["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(a=e.parse(n["vertical-align"],1,DL),!a)return null}const l=i[i.length-1];l.scale=t,l.font=s,l.textColor=o,l.verticalAlign=a}else{const n=e.parse(t[s],1,qL);if(!n)return null;const o=n.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,i.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new TD(i)}evaluate(t){return new Iz(this.sections.map(e=>{const n=e.content.evaluate(t);return qz(n)===KL?new Mz("",n,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Mz(Vz(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class RD{constructor(t){this.type=KL,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,DL);return n?new RD(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=jz.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}}class PD{constructor(t){this.type=zL,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${ZL(n.type)} instead.`):new PD(n):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Lz(`Expected value to be of type string or array, but found ${ZL(qz(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const MD=8192;function ID(t,e){const n=(180+t[0])/360,i=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(n*s*MD),Math.round(i*s*MD)]}function OD(t,e){const n=Math.pow(2,e.z);return[(r=(t[0]/MD+e.x)/n,360*r-180),(i=(t[1]/MD+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,r}function AD(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function FD(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function LD(t,e,n){return e[1]>t[1]!=n[1]>t[1]&&t[0]<(n[0]-e[0])*(t[1]-e[1])/(n[1]-e[1])+e[0]}function zD(t,e,n){const i=t[0]-e[0],r=t[1]-e[1],s=t[0]-n[0],o=t[1]-n[1];return i*o-s*r===0&&i*s<=0&&r*o<=0}function DD(t,e,n,i){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[i[0]-n[0],i[1]-n[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!VD(t,e,n,i)||!VD(n,i,t,e));var s,o}function jD(t,e,n){for(const i of n)for(let n=0;n0&&h<0||u<0&&h>0}function $D(t,e,n){const i=[];for(let r=0;rn[2]){const e=.5*i;let r=t[0]-n[0]>e?-i:n[0]-t[0]>e?i:0;0===r&&(r=t[0]-n[2]>e?-i:n[2]-t[0]>e?i:0),t[0]+=r}AD(e,t)}function HD(t,e,n,i){const r=Math.pow(2,i.z)*MD,s=[i.x*MD,i.y*MD],o=[];for(const a of t)for(const t of a){const i=[t.x+s[0],t.y+s[1]];WD(i,e,n,r),o.push(i)}return o}function KD(t,e,n,i){const r=Math.pow(2,i.z)*MD,s=[i.x*MD,i.y*MD],o=[];for(const a of t){const t=[];for(const n of a){const i=[n.x+s[0],n.y+s[1]];AD(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const i of t)WD(i,e,n,r)}return o}class XD{constructor(t,e){this.type=jL,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Bz(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const n of e.features){const{type:e,coordinates:i}=n.geometry;"Polygon"===e&&t.push(i),"MultiPolygon"===e&&t.push(...i)}if(t.length)return new XD(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new XD(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new XD(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=$D(e.coordinates,i,r),o=HD(t.geometry(),n,i,r);if(!FD(n,i))return!1;for(const t of o)if(!ND(t,s))return!1}if("MultiPolygon"===e.type){const s=GD(e.coordinates,i,r),o=HD(t.geometry(),n,i,r);if(!FD(n,i))return!1;for(const t of o)if(!UD(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=$D(e.coordinates,i,r),o=KD(t.geometry(),n,i,r);if(!FD(n,i))return!1;for(const t of o)if(!BD(t,s))return!1}if("MultiPolygon"===e.type){const s=GD(e.coordinates,i,r),o=KD(t.geometry(),n,i,r);if(!FD(n,i))return!1;for(const t of o)if(!qD(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class YD{constructor(t=[],e=(t,e)=>te?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,i=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(n(i,s)>=0)break;e[t]=s,t=r}e[t]=i}_down(t){const{data:e,compare:n}=this,i=this.length>>1,r=e[t];for(;t=0)break;e[t]=e[i],t=i}e[t]=r}}function ZD(t){let e=0;for(let n,i,r=0,s=t.length,o=s-1;r1?(l=t[a+1][0],c=t[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,h=(e[1]-c)*this.ky;const p=u*u+h*h;p180;)t-=360;return t}}function nj(t,e){return e[0]-t[0]}function ij(t){return t[1]-t[0]+1}function rj(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];const n=ij(t);if(e){if(2===n)return[t,null];const e=Math.floor(n/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===n)return[t,null];const i=Math.floor(n/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function oj(t,e){if(!rj(e,t.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)AD(n,t[i]);return n}function aj(t){const e=[1/0,1/0,-1/0,-1/0];for(const n of t)for(const t of n)AD(e,t);return e}function lj(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function cj(t,e,n){if(!lj(t)||!lj(e))return NaN;let i=0,r=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]=i)return i;if(FD(r,s)){if(mj(t,e))return 0}else if(mj(e,t))return 0;let o=1/0;for(const a of t)for(let t=0,i=a.length,r=i-1;t0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],c=e?50:100;if(ij(l)<=c){if(!rj(l,t.length))return NaN;if(e){const e=gj(t,l,n,i);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=fj(t[e],n,i);if(s=Math.min(s,r),0===s)return 0}}else{const n=sj(l,e);_j(o,s,i,t,a,n[0]),_j(o,s,i,t,a,n[1])}}return s}function wj(t,e,n,i,r,s=1/0){let o=Math.min(s,r.distance(t[0],n[0]));if(0===o)return o;const a=new YD([[0,[0,t.length-1],[0,n.length-1]]],nj);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],c=s[2],u=e?50:100,h=i?50:100;if(ij(l)<=u&&ij(c)<=h){if(!rj(l,t.length)&&rj(c,n.length))return NaN;let s;if(e&&i)s=dj(t,l,n,c,r),o=Math.min(o,s);else if(e&&!i){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(s=uj(n[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&i){const e=n.slice(c[0],c[1]+1);for(let n=l[0];n<=l[1];++n)if(s=uj(t[n],e,r),o=Math.min(o,s),0===o)return o}else s=pj(t,l,n,c,r),o=Math.min(o,s)}else{const s=sj(l,e),u=sj(c,i);vj(a,o,r,t,n,s[0],u[0]),vj(a,o,r,t,n,s[0],u[1]),vj(a,o,r,t,n,s[1],u[0]),vj(a,o,r,t,n,s[1],u[1])}}return o}function xj(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class Sj{constructor(t,e){this.type=zL,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Bz(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Sj(e,e.features.map(t=>xj(t.geometry)).flat());if("Feature"===e.type)return new Sj(e,xj(e.geometry));if("type"in e&&"coordinates"in e)return new Sj(e,xj(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=t.geometry(),i=n.flat().map(e=>OD([e.x,e.y],t.canonical));if(0===n.length)return NaN;const r=new ej(i[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,wj(i,!1,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,wj(i,!1,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,bj(i,!1,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=t.geometry(),i=n.flat().map(e=>OD([e.x,e.y],t.canonical));if(0===n.length)return NaN;const r=new ej(i[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,wj(i,!0,[o.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,wj(i,!0,o.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,bj(i,!0,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const n=t.geometry();if(0===n.length||0===n[0].length)return NaN;const i=function(t){if(t.length<=1)return[t];const e=[];let n,i;for(const r of t){const t=ZD(r);0!==t&&(r.area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(n&&e.push(n),n=[r]):n.push(r))}return n&&e.push(n),e}(n).map(e=>e.map(e=>e.map(e=>OD([e.x,e.y],t.canonical)))),r=new ej(i[0][0][0][1]);let s=1/0;for(const o of e)for(const t of i){switch(o.type){case"Point":s=Math.min(s,bj([o.coordinates],!1,t,r,s));break;case"LineString":s=Math.min(s,bj(o.coordinates,!0,t,r,s));break;case"Polygon":s=Math.min(s,yj(t,o.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Cj{constructor(t){this.type=qL,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=t[1];return null==n?e.error("Global state property must be defined."):"string"!=typeof n?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Cj(n)}evaluate(t){var e;const n=null===(e=t.globals)||void 0===e?void 0:e.globalState;return n&&0!==Object.keys(n).length?vz(n,this.key):null}eachChild(){}outputDefined(){return!1}}const kj={"==":vD,"!=":bD,">":xD,"<":wD,">=":CD,"<=":SD,array:Wz,at:tD,boolean:Wz,case:rD,coalesce:gD,collator:kD,format:TD,image:RD,in:eD,"index-of":nD,interpolate:pD,"interpolate-hcl":pD,"interpolate-lab":pD,length:PD,let:Jz,literal:$z,match:iD,number:Wz,"number-format":ED,object:Wz,slice:sD,step:aD,string:Wz,"to-boolean":Kz,"to-color":Kz,"to-number":Kz,"to-string":Kz,var:Qz,within:XD,distance:Sj,"global-state":Cj};class Ej{constructor(t,e,n,i){this.name=t,this.type=e,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const n=t[0],i=Ej.definitions[n];if(!i)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(i)?i[0]:i.type,s=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[l,c]of o){a=new Zz(e.registry,Ij,e.path,null,e.scope);const i=[];let s=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(ZL).join(", ")})`:`(${ZL(e.type)}...)`;var e}).join(" | "),i=[];for(let r=1;r{n=e?n&&Ij(t):n&&t instanceof $z}),!!n&&Oj(t)&&Fj(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Oj(t){if(t instanceof Ej){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof XD)return!1;if(t instanceof Sj)return!1;let e=!0;return t.eachChild(t=>{e&&!Oj(t)&&(e=!1)}),e}function Aj(t){if(t instanceof Ej&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!Aj(t)&&(e=!1)}),e}function Fj(t,e){if(t instanceof Ej&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild(t=>{n&&!Fj(t,e)&&(n=!1)}),n}function Lj(t){return{result:"success",value:t}}function zj(t){return{result:"error",value:t}}function Dj(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&qz(t)===BL}Ej.register(kj,{error:[{kind:"error"},[DL],(t,[e])=>{throw new Lz(e.evaluate(t))}],typeof:[DL,[qL],(t,[e])=>ZL(qz(e.evaluate(t)))],"to-rgba":[YL(zL,4),[NL],(t,[e])=>{const[n,i,r,s]=e.evaluate(t).rgb;return[255*n,255*i,255*r,s]}],rgb:[NL,[zL,zL,zL],Tj],rgba:[NL,[zL,zL,zL,zL],Tj],has:{type:jL,overloads:[[[DL],(t,[e])=>Rj(e.evaluate(t),t.properties())],[[DL,BL],(t,[e,n])=>Rj(e.evaluate(t),n.evaluate(t))]]},get:{type:qL,overloads:[[[DL],(t,[e])=>Pj(e.evaluate(t),t.properties())],[[DL,BL],(t,[e,n])=>Pj(e.evaluate(t),n.evaluate(t))]]},"feature-state":[qL,[DL],(t,[e])=>Pj(e.evaluate(t),t.featureState||{})],properties:[BL,[],t=>t.properties()],"geometry-type":[DL,[],t=>t.geometryType()],id:[qL,[],t=>t.id()],zoom:[zL,[],t=>t.globals.zoom],"heatmap-density":[zL,[],t=>t.globals.heatmapDensity||0],elevation:[zL,[],t=>t.globals.elevation||0],"line-progress":[zL,[],t=>t.globals.lineProgress||0],accumulated:[qL,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[zL,Mj(zL),(t,e)=>{let n=0;for(const i of e)n+=i.evaluate(t);return n}],"*":[zL,Mj(zL),(t,e)=>{let n=1;for(const i of e)n*=i.evaluate(t);return n}],"-":{type:zL,overloads:[[[zL,zL],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[zL],(t,[e])=>-e.evaluate(t)]]},"/":[zL,[zL,zL],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[zL,[zL,zL],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[zL,[],()=>Math.LN2],pi:[zL,[],()=>Math.PI],e:[zL,[],()=>Math.E],"^":[zL,[zL,zL],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[zL,[zL],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[zL,[zL],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[zL,[zL],(t,[e])=>Math.log(e.evaluate(t))],log2:[zL,[zL],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[zL,[zL],(t,[e])=>Math.sin(e.evaluate(t))],cos:[zL,[zL],(t,[e])=>Math.cos(e.evaluate(t))],tan:[zL,[zL],(t,[e])=>Math.tan(e.evaluate(t))],asin:[zL,[zL],(t,[e])=>Math.asin(e.evaluate(t))],acos:[zL,[zL],(t,[e])=>Math.acos(e.evaluate(t))],atan:[zL,[zL],(t,[e])=>Math.atan(e.evaluate(t))],min:[zL,Mj(zL),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[zL,Mj(zL),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[zL,[zL],(t,[e])=>Math.abs(e.evaluate(t))],round:[zL,[zL],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[zL,[zL],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[zL,[zL],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[jL,[DL,qL],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[jL,[qL],(t,[e])=>t.id()===e.value],"filter-type-==":[jL,[DL],(t,[e])=>t.geometryType()===e.value],"filter-<":[jL,[DL,qL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i{const n=t.id(),i=e.value;return typeof n==typeof i&&n":[jL,[DL,qL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>r}],"filter-id->":[jL,[qL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>i}],"filter-<=":[jL,[DL,qL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i<=r}],"filter-id-<=":[jL,[qL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n<=i}],"filter->=":[jL,[DL,qL],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>=r}],"filter-id->=":[jL,[qL],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>=i}],"filter-has":[jL,[qL],(t,[e])=>e.value in t.properties()],"filter-has-id":[jL,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[jL,[YL(DL)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[jL,[YL(qL)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[jL,[DL,YL(qL)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[jL,[DL,YL(qL)],(t,[e,n])=>function(t,e,n,i){for(;n<=i;){const r=n+i>>1;if(e[r]===t)return!0;e[r]>t?i=r-1:n=r+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:jL,overloads:[[[jL,jL],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[Mj(jL),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:jL,overloads:[[[jL,jL],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[Mj(jL),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[jL,[jL],(t,[e])=>!e.evaluate(t)],"is-supported-script":[jL,[DL],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[DL,[DL],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[DL,[DL],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[DL,Mj(qL),(t,e)=>e.map(e=>Vz(e.evaluate(t))).join("")],"resolved-locale":[DL,[VL],(t,[e])=>e.evaluate(t).resolvedLocale()]});class jj{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Yz,this._defaultValue=e?function(t){if("color"===t.type&&Dj(t.default))return new Tz(0,0,0,0);switch(t.type){case"color":return Tz.parse(t.default)||null;case"padding":return Oz.parse(t.default)||null;case"numberArray":return Az.parse(t.default)||null;case"colorArray":return Fz.parse(t.default)||null;case"variableAnchorOffsetCollection":return Dz.parse(t.default)||null;case"projectionDefinition":return Nz.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,i,r,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Lz(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,"undefined"!=typeof console&&console.warn(o.message)),this._defaultValue}}}function Nj(t,e){const n=new Zz(kj,Ij,[],e?function(t){const e={color:NL,string:DL,number:zL,enum:DL,boolean:jL,formatted:$L,padding:GL,numberArray:HL,colorArray:WL,projectionDefinition:UL,resolvedImage:KL,variableAnchorOffsetCollection:XL};return"array"===t.type?YL(e[t.value]||qL,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Lj(new jj(i,e)):zj(n.errors)}class Uj{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Aj(e.expression),this.globalStateRefs=$j(e.expression)}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,s)}evaluate(t,e,n,i,r,s){return this._styleExpression.evaluate(t,e,n,i,r,s)}}class Bj{constructor(t,e,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Aj(e.expression),this.globalStateRefs=$j(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,n,i,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,s)}evaluate(t,e,n,i,r,s){return this._styleExpression.evaluate(t,e,n,i,r,s)}interpolationFactor(t,e,n){return this.interpolationType?pD.interpolationFactor(this.interpolationType,t,e,n):0}}function qj(t,e){const n=Nj(t,e);if("error"===n.result)return n;const i=n.value.expression,r=Oj(i);if(!r&&"data-driven"!==(s=e)["property-type"]&&"cross-faded-data-driven"!==s["property-type"])return zj([new AL("","data expressions not supported")]);var s;const o=Fj(i,["zoom"]);if(!o&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return zj([new AL("","zoom expressions not supported")]);const a=Vj(i);if(!a&&!o)return zj([new AL("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof AL)return zj([a]);if(a instanceof pD&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return zj([new AL("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Lj(new Uj(r?"constant":"source",n.value));const l=a instanceof pD?a.interpolation:void 0;return Lj(new Bj(r?"camera":"composite",n.value,a.labels,l))}function Vj(t){let e=null;if(t instanceof Jz)e=Vj(t.result);else if(t instanceof gD){for(const n of t.args)if(e=Vj(n),e)break}else(t instanceof aD||t instanceof pD)&&t.input instanceof Ej&&"zoom"===t.input.name&&(e=t);return e instanceof AL||t.eachChild(t=>{const n=Vj(t);n instanceof AL?e=n:!e&&n?e=new AL("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new AL("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function $j(t,e=new Set){return t instanceof Cj&&e.add(t.key),t.eachChild(t=>{$j(t,e)}),e}function Gj(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Gj(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Wj={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Hj(t){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Gj(t)||(t=Yj(t));const e=Nj(t,Wj);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,n,i)=>e.value.evaluate(t,n,{},i),needGeometry:Xj(t),getGlobalStateRefs:()=>$j(e.value.expression)}}function Kj(t,e){return te?1:0}function Xj(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Zj(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(Yj))):"all"===e?["all"].concat(t.slice(1).map(Yj)):"none"===e?["all"].concat(t.slice(1).map(Yj).map(tN)):"in"===e?Jj(t[1],t.slice(2)):"!in"===e?tN(Jj(t[1],t.slice(2))):"has"===e?Qj(t[1]):"!has"!==e||tN(Qj(t[1]));var n}function Zj(t,e,n){switch(t){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,t,e]}}function Jj(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Kj)]]:["filter-in-small",t,["literal",e]]}}function Qj(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function tN(t){return["!",t]}function eN(t){return"object"==typeof t?["literal",t]:t}function nN(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function iN(t,e){const n=eN((i=t.default,r=e.default,void 0!==i?i:void 0!==r?r:void 0));var i,r;return void 0===n&&"resolvedImage"===e.type?"":n}function rN(t,e,n){const i=aN(t,e),r=["get",t.property];if("categorical"===i&&"boolean"==typeof n[0][0]){const i=["case"];for(const t of n)i.push(["==",r,t[0]],t[1]);return i.push(iN(t,e)),i}if("categorical"===i){const i=["match",r];for(const t of n)oN(i,t[0],t[1],!1);return i.push(iN(t,e)),i}if("interval"===i){const e=["step",["number",r]];for(const t of n)oN(e,t[0],t[1],!0);return sN(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,eN(t.default)]}if("exponential"===i){const e=void 0!==t.base?t.base:1,i=[nN(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of n)oN(i,t[0],t[1],!1);return void 0===t.default?i:["case",["==",["typeof",r],"number"],i,eN(t.default)]}throw new Error(`Unknown property function type ${i}`)}function sN(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function oN(t,e,n,i){t.length>3&&e===t[t.length-2]||(i&&2===t.length||t.push(e),t.push(n))}function aN(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function lN(t){const e=["concat"],n=/{([^{}]+)}/g;let i=0;for(let r=n.exec(t);null!==r;r=n.exec(t)){const s=t.slice(i,n.lastIndex-r[0].length);i=n.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};var uN={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},hN=" ",dN=/(italic|oblique)$/i,pN={};function fN(t,e,n){var i=pN[t];if(!i){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],c=0,u=t.length;c1?h[h.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){o=r?o:uN[p],h.pop(),f&&p.startsWith(f)&&h.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=h.join(hN).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(hN)&&(g='"'+g+'"'),l.push(g)}i=pN[t]=[a,o,l]}return i[0]+hN+i[1]+hN+e+"px"+(n?"/"+n:"")+hN+i[2]}class gN extends OO{constructor(t,e,n,i,r){super(t,e,n,void 0!==r?0:2),this.loader_=void 0!==r?r:null,this.canvas_=i,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=3):this.state=2,this.changed()}load(){0==this.state&&(this.state=1,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}class mN extends UC{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(_C)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){GC()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(n){if(-1===n)return 1}else n=e,this.transitionStarts_[t]=n;const i=e-n+1e3/60;return i>=this.transition_?1:wE(i/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class yN extends mN{constructor(t,e,n,i,r,s){super(t,e,s),this.crossOrigin_=i,this.src_=n,this.key=n,this.image_,ok?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==i&&(this.image_.crossOrigin=i)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=aP(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(ok)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,n){const i=t;let r=!0,s=!1,o=!1;const a=[qC(i,"load",function(){o=!0,s||e()})];return i.src&&ak?(s=!0,i.decode().then(function(){r&&e()}).catch(function(){r&&(o?e():n())})):a.push(qC(i,"error",n)),function(){r=!1,a.forEach(VC)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class _N{constructor(t,e,n,i){this.minX=t,this.maxX=e,this.minY=n,this.maxY=i}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function vN(t,e,n,i,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=n,r.maxY=i,r):new _N(t,e,n,i)}const bN=[];class wN extends mN{constructor(t,e,n,i,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=i.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=aP(1,1,bN)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=HC(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(uP(this.context_),bN.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let xN=class extends mN{constructor(t,e,n,i,r,s){super(t,e,s),this.extent=null,this.format_=i,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};const SN="https://api.mapbox.com";function CN(t){return 0!==t.indexOf("mapbox://")?"":t.slice(9)}function kN(t,e,n){const i=CN(t);if(!i)return decodeURI(new URL(t,n).href);if(0!==i.indexOf("sprites/"))throw new Error(`unexpected sprites url: ${t}`);const r=i.slice(8);return`${SN}/styles/v1/${r}/sprite?access_token=${e}`}function EN(t,e){const n=CN(t);if(!n)return decodeURI(new URL(t,location.href).href);if(0!==n.indexOf("styles/"))throw new Error(`unexpected style url: ${t}`);const i=n.slice(7);return`${SN}/styles/v1/${i}?&access_token=${e}`}const TN=["a","b","c","d"];function RN(t,e,n,i){const r=new URL(t,i||location.href),s=CN(t);if(!s)return e?(r.searchParams.has(n)||r.searchParams.set(n,e),[decodeURI(r.href)]):[decodeURI(r.href)];if("mapbox.satellite"===s){const t=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${t}.webp?access_token=${e}`]}return TN.map(t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const PN=Object.freeze({}),MN={},IN={};let ON=0;function AN(t){return t.id||(t.id=ON++),t.id}function FN(t){let e=MN[t.id];return e||(e={},MN[AN(t)]=e),e}function LN(t){return t*Math.PI/180}const zN=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function DN(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const n=document.createElement("canvas");return n.width=t,n.height=e,n}function jN(t,e){let n=0;const i=e.length;for(;nr).then(t=>t instanceof Response?(i&&(i.url=t.url),o(t)):(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),i&&(i.url=t.url),fetch(t).then(o).catch(s))).catch(s);return UN[e]=[r,a],a}function qN(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return BN("Style",t=EN(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(zj){return Promise.reject(zj)}}const VN={};function $N(t,e,n={}){const i=[e,JSON.stringify(t)].toString();let r=VN[i];if(!r||n.transformRequest){let s;n.transformRequest&&(s=(t,e)=>{const i=n.transformRequest&&n.transformRequest(e,"Tiles")||e;if(t instanceof xN)t.setLoader((e,n,r)=>{const s=function(n){n.arrayBuffer().then(n=>{const i=t.getFormat().readFeatures(n,{extent:e,featureProjection:r});t.setFeatures(i)})};zC(()=>i).then(e=>{if(e instanceof Response)return s(e);fetch(e).then(s).catch(()=>t.setState(3))}).catch(()=>t.setState(3))});else{const e=t.getImage();zC(()=>i).then(n=>{if("string"==typeof n)return void(e.src=n);const i=t=>t.blob().then(t=>{const n=URL.createObjectURL(t);e.addEventListener("load",()=>URL.revokeObjectURL(n)),e.addEventListener("error",()=>URL.revokeObjectURL(n)),e.src=n});if(n instanceof Response)return i(n);fetch(n).then(i).catch(()=>t.setState(3))}).catch(()=>t.setState(3))}});const o=t.url;if(o&&!t.tiles){const i=RN(o,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:i}),tileLoadFunction:s});else{const t={};r=BN("Source",i[0],n,t).then(function(e){return e.tiles=e.tiles.map(function(i){return"tms"===e.scheme&&(i=i.replace("{y}","{-y}")),RN(i,n.accessToken,n.accessTokenParam||"access_token",t.url)[0]}),Promise.resolve({tileJson:e,tileLoadFunction:s})})}}else t.tiles?(t=Object.assign({},t,{tiles:t.tiles.map(function(i){return"tms"===t.scheme&&(i=i.replace("{y}","{-y}")),RN(i,n.accessToken,n.accessTokenParam||"access_token",e||location.href)[0]})}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s})):r=Promise.reject(new Error("source has no `tiles` nor `url`"));VN[i]=r}return r}function GN(t,e,n,i){const r=[2*n*e.pixelRatio+e.width,2*n*e.pixelRatio+e.height],s=DN(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,n*e.pixelRatio,n*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*i.r},${255*i.g},${255*i.b},${i.a})`;const l=a.data;for(let c=0,u=a.width;c0&&o.arc(c,t,n*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function WN(t,e,n){const i=Math.max(0,Math.min(1,(n-t)/(e-t)));return i*i*(3-2*i)}function HN(t,e,n){const i=DN(e.width,e.height),r=i.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let a=0,l=s.width;a0?(o[e+0]=Math.round(255*n.r*s),o[e+1]=Math.round(255*n.g*s),o[e+2]=Math.round(255*n.b*s),o[e+3]=Math.round(255*s)):o[e+3]=0}return r.putImageData(s,0,0),i}const KN=Array(256).join(" ");function XN(t,e){if(e>=.05){let n="";const i=t.split("\n"),r=KN.slice(0,Math.round(e/.1));for(let t=0,e=i.length;t0&&(n+="\n"),n+=i[t].split("").join(r);return n}return t}let YN;function ZN(){return YN||(YN=DN(1,1).getContext("2d")),YN}function JN(t,e){return ZN().measureText(t).width+(t.length-1)*e}const QN={};function tU(t,e,n,i){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=ZN();t.font=e;const r=t.measureText("M").width*n;let a="";const l=[];for(let e=0,n=o.length;e1;++e){const t=l[e];if(JN(t,i)<.35*r){const r=e>0?JN(l[e-1],i):1/0,s=e.7*r&&JN(s,i)<.6*r){const o=t.split(" "),a=o.pop();JN(a,i)<.2*r&&(l[e]=o.join(" "),l[e+1]=a+" "+s),n-=1}}s=l.join("\n")}else s=t;s=XN(s,i),QN[r]=s}return s}KO.on("propertychange",()=>{for(const t in QN)delete QN[t]});const eU=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],nU={},iU={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},rU={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},sU={zoom:0,distanceFromCenter:0};let oU,aU;function lU(t,e,n,i,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[n]){let i=(t[e]||PN)[n];const r=cN[`${e}_${t.type}`][n];void 0===i&&(i=r.default);let s=(l=i,Array.isArray(l)&&l.length>0&&"string"==typeof l[0]&&l[0]in kj);if(!s&&Dj(i)&&(i=function(t,e){let n=t.stops;if(!n)return function(t,e){const n=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",n]:n;if("enum"===e.type)return["match",n,Object.keys(e.values),n,t.default];{const i=["color"===e.type?"to-color":e.type,n,eN(t.default)];return"array"===e.type&&i.splice(1,0,e.value,e.length||null),i}}(t,e);const i=n&&"object"==typeof n[0][0],r=i||void 0!==t.property,s=i||!r;return n=n.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],lN(t[1])]:[t[0],eN(t[1])]),i?function(t,e,n){const i={},r={},s=[];for(let o=0;o`${t.key}: ${t.message}`).join(", "));return n.value}(i,r);a[n]=t.evaluate.bind(t)}else{const t=r.type;"color"!==t&&"colorArray"!==t||(i=Tz.parse(i)),a[n]=function(){return i}}}var l;return a[n](sU,i,s)}function cU(t,e,n,i){return lU(t,"layout",`${n}-allow-overlap`,e,i)?lU(t,"layout",`${n}-ignore-placement`,e,i)?"none":"obstacle":"declutter"}function uU(t,e,n,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(t in i))try{i[t]=Hj(e).filter}catch(r){console.warn("Filter will evaluate to false: "+r.message),i[t]=function(){return!1}}return i[t](sU,n)}function hU(t,e){if(t){if(0===t.a||0===e)return;const n=t.a;return e=void 0===e?1:e,0===n?"transparent":"rgba("+Math.round(255*t.r/n)+","+Math.round(255*t.g/n)+","+Math.round(255*t.b/n)+","+n*e+")"}return t}Ej.register(kj,{...Ej.definitions,pitch:[{kind:"number"},[],()=>sU.pitch||90],"distance-from-center":[{kind:"number"},[],()=>sU.distanceFromCenter||0]});const dU=/\{[^{}}]*\}/g;function pU(t,e){return t.replace(dU,function(t){return e[t.slice(1,-1)]||""})}function fU(t,e){let n=t.split(":")[0];return n===t&&(n="default"),e[n]}const gU={};class mU{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=eF,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let n=e.dataProjection?CT(e.dataProjection):this.readProjection(t);e.extent&&n&&"tile-pixels"===n.getUnits()&&(n=CT(n),n.setWorldExtent(e.extent)),e={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return GC()}readFeature(t,e){return GC()}readFeatures(t,e){return GC()}readGeometry(t,e){return GC()}readProjection(t){return GC()}writeFeature(t,e){return GC()}writeFeatures(t,e){return GC()}writeGeometry(t,e){return GC()}}function yU(t,e,n){const i=n?CT(n.featureProjection):null,r=n?CT(n.dataProjection):null;let s=t;if(i&&r&&!MT(i,r)){e&&(s=t.clone());const n=e?i:r,o=e?r:i;"tile-pixels"===n.getUnits()?s.transform(n,o):s.applyTransform(AT(n,o))}if(e&&n&&void 0!==n.decimals){const e=Math.pow(10,n.decimals),i=function(t){for(let n=0,i=t.length;nvU({...t,geometry:e})).flat();const i="MultiPolygon"===n.type?"Polygon":n.type;if("GeometryCollection"===i||"Circle"===i)throw new Error("Unsupported geometry type: "+i);const r=n.layout.length;return yU(new uL(i,"Polygon"===i?function(t,e,n){return Array.isArray(e[0])?(jR(t,0,e,n)||UR(t=t.slice(),0,e,n),t):(DR(t,0,e,n)||NR(t=t.slice(),0,e,n),t)}(n.flatCoordinates,n.ends,r):n.flatCoordinates,n.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function bU(t,e){if(!t)return null;if(Array.isArray(t)){const n=t.map(t=>bU(t,e));return new aL(n)}return yU(new(0,_U[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class wU extends mU{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(xU(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(xU(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return GC()}readFeaturesFromObject(t,e){return GC()}readGeometry(t,e){return this.readGeometryFromObject(xU(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return GC()}readProjection(t){return this.readProjectionFromObject(xU(t))}readProjectionFromObject(t){return GC()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return GC()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return GC()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return GC()}}function xU(t){return"string"==typeof t?JSON.parse(t)||null:null!==t?t:null}class SU extends wU{constructor(t){t=t||{},super(),this.dataProjection=CT(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=CT(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let n=null;n="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const i=CU(n.geometry);if(this.featureClass===uL)return vU({geometry:i,id:n.id,properties:n.properties},e);const r=new eF;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(bU(i,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){let n=null;if("FeatureCollection"===t.type){n=[];const i=t.features;for(let t=0,r=i.length;t>3,r=this.pos;this.type=7&n,t(i,e,this),this.pos===r&&this.skip(n)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*EU;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*EU;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let n,i;return i=e[this.pos++],n=127&i,i<128?n:(i=e[this.pos++],n|=(127&i)<<7,i<128?n:(i=e[this.pos++],n|=(127&i)<<14,i<128?n:(i=e[this.pos++],n|=(127&i)<<21,i<128?n:(i=e[this.pos],n|=(15&i)<<28,function(t,e,n){const i=n.buf;let r,s;if(s=i[n.pos++],r=(112&s)>>4,s<128)return MU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<3,s<128)return MU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<10,s<128)return MU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<17,s<128)return MU(t,r,e);if(s=i[n.pos++],r|=(127&s)<<24,s<128)return MU(t,r,e);if(s=i[n.pos++],r|=(1&s)<<31,s<128)return MU(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(n,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&RU?RU.decode(this.buf.subarray(e,t)):function(t,e,n){let i="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+c>n)break;1===c?e<128&&(l=e):2===c?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===c?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),r+=c}return i}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(n=~(-t%4294967296),i=~(-t/4294967296),4294967295^n?n=n+1|0:(n=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){const n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,n){for(let i,r,s=0;s55295&&i<57344){if(!r){i>56319||s+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):r=i;continue}if(i<56320){t[n++]=239,t[n++]=191,t[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[n++]=239,t[n++]=191,t[n++]=189,r=null);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return n}(this.buf,t,this.pos);const n=this.pos-e;n>=128&&IU(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let n=0;n=128&&IU(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,n){this.writeTag(t,2),this.writeRawMessage(e,n)}writePackedVarint(t,e){e.length&&this.writeMessage(t,OU,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,AU,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,zU,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,FU,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,LU,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,DU,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,jU,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,NU,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,UU,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function MU(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function IU(t,e,n){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(i);for(let r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function OU(t,e){for(let n=0;n>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&c>u&&(i.push(c),u=c),n.push(a,l),c+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");c>u&&(n.push(n[u],n[u+1]),c+=2)}}c>u&&(i.push(c),u=c)}createFeature_(t,e,n){const i=e.type;if(0===i)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const c=function(t,e){let n;return 1===t?n=1===e?"Point":"MultiPoint":2===t?n=1===e?"LineString":"MultiLineString":3===t&&(n="Polygon"),n}(i,l.length);if(this.featureClass===uL)r=new this.featureClass(c,a,l,2,s,o),r.transform(n.dataProjection);else{let t;if("Polygon"==c){const e=BR(a,l);t=e.length>1?new cF(a,"XY",e):new qR(a,"XY",l)}else t="Point"===c?new kR(a,"XY"):"LineString"===c?new sF(a,"XY"):"MultiPoint"===c?new aF(a,"XY"):"MultiLineString"===c?new oF(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=yU(t,!1,n);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const n=this.layers_,i=CT((e=this.adaptOptions(e)).dataProjection);i.setWorldExtent(e.extent),e.dataProjection=i;const r=new PU(t),s=r.readFields(qU,{}),o=[];for(const a in s){if(n&&!n.includes(a))continue;const t=s[a],l=t?[0,0,t.extent,t.extent]:null;i.setExtent(l);for(let n=0,i=t.length;n>3)?n.readString():2===t?n.readFloat():3===t?n.readDouble():4===t?n.readVarint64():5===t?n.readVarint():6===t?n.readSVarint():7===t?n.readBoolean():null;e.values.push(i)}}function $U(t,e,n){if(1==t)e.id=n.readVarint();else if(2==t){const t=n.readVarint()+n.pos;for(;n.pos=o.width)return null;const c=lE(s),u=Math.floor(o.height*((s[3]-i[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const n=this.image,i=n.getExtent(),r=n.getResolution(),[s,o]=Array.isArray(r)?r:[r,r],a=n.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,h=u.center,d=u.resolution,p=c*s/(d*a),f=c*o/(d*a);this.prepareContainer(t,e);const g=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(t);let _=!1,v=!0;if(l.extent){const e=jT(l.extent,u.projection);v=pE(e,t.extent),_=v&&!qk(e,t.extent),_&&this.clipUnrotated(y,t,e)}const b=n.getImage(),w=KT(this.tempTransform,g/2,m/2,p,f,0,a*(i[0]-h[0])/s,a*(h[1]-i[3])/o);this.renderedResolution=o*c/a;const x=b.width*w[0],S=b.height*w[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),v&&x>=.5&&S>=.5){const t=w[4],e=w[5],n=l.opacity;1!==n&&(y.save(),y.globalAlpha=n),y.drawImage(b,0,0,+b.width,+b.height,t,e,x,S),1!==n&&y.restore()}return this.postRender(this.context,t),_&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class HU extends bM{constructor(t){super(t=t||{})}}class KU extends HU{constructor(t){super(t)}createRenderer(){return new WU(this)}getData(t){return super.getData(t)}}function XU(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const YU=new Error("disposed"),ZU=[256,256];class JU extends mN{constructor(t){super(t.tileCoord,0,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=XU(this.data_);return t?[t.width,t.height]:ZU}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(YU),this.controller_=null),super.disposeInternal()}}let QU;const tB=[];function eB(t,e,n,i,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,n),t.lineTo(i,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,i)+1,Math.max(n,r)),t.restore()}function nB(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function iB(t,e,n,i){const r=FT(n,e,t);let s=kT(e,i,n);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Bk(l,r)){const e=kT(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function rB(t,e,n,i,r,s,o,a,l,c,u,h,d){const p=aP(Math.round(n*t),Math.round(n*e),tB);if(h||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function f(t){return Math.round(t*n)/n}p.scale(n,n),p.globalCompositeOperation="lighter";const g=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t){Yk(g,t.extent)});const y=n/i,_=(h?1:1+Math.pow(2,-24))/y;d&&1===l.length&&0===c||(m=aP(Math.round(dE(g)*y),Math.round(lE(g)*y),tB),h||(m.imageSmoothingEnabled=!1),l.forEach(function(t){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-g[0])*y,n=-(t.clipExtent[3]-g[3])*y,i=dE(t.clipExtent)*y,r=lE(t.clipExtent)*y;m.rect(h?e:Math.round(e),h?n:Math.round(n),h?i:Math.round(e+i)-Math.round(e),h?r:Math.round(n+r)-Math.round(n)),m.clip()}const e=(t.extent[0]-g[0])*y,n=-(t.extent[3]-g[3])*y,i=dE(t.extent)*y,r=lE(t.extent)*y;m.drawImage(t.image,c,c,t.image.width-2*c,t.image.height-2*c,h?e:Math.round(e),h?n:Math.round(n),h?i:Math.round(e+i)-Math.round(e),h?r:Math.round(n+r)-Math.round(n)),t.clipExtent&&m.restore()}}));const v=uE(o);return a.getTriangles().forEach(function(t){const e=t.source,n=t.target;let i=e[0][0],r=e[0][1],o=e[1][0],a=e[1][1],c=e[2][0],u=e[2][1];const d=f((n[0][0]-v[0])/s),y=f(-(n[0][1]-v[1])/s),b=f((n[1][0]-v[0])/s),w=f(-(n[1][1]-v[1])/s),x=f((n[2][0]-v[0])/s),S=f(-(n[2][1]-v[1])/s),C=i,k=r;i=0,r=0,o-=C,a-=k,c-=C,u-=k;const E=function(t){const e=t.length;for(let i=0;ir&&(r=e,n=o)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let o=i+1;o=0;i--){n[i]=t[i][e]/t[i][i];for(let r=i-1;r>=0;r--)t[r][e]-=t[r][i]*n[i]}return n}([[o,a,0,0,b-d],[c,u,0,0,x-d],[0,0,o,a,w-y],[0,0,c,u,S-y]]);if(!E)return;if(p.save(),p.beginPath(),function(){if(void 0===QU){const t=aP(6,6,tB);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",eB(t,4,5,4,0),eB(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;QU=nB(e,0)||nB(e,4)||nB(e,8),uP(t),tB.push(t.canvas)}return QU}()||!h){p.moveTo(b,w);const t=4,e=d-b,n=y-w;for(let i=0;iWT(o,FT(t,this.targetProj_,this.sourceProj_)),function(t,e,n,i){const r=t.length;n=void 0!==n?n:2,i=i??n,e=void 0!==e?e:new Array(r);for(let s=0;s=o?t[s+n]:r[n]}return e}):AT(this.targetProj_,this.sourceProj_);var c;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=i,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!i&&!!this.sourceProj_.getExtent()&&dE(i)>=dE(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?dE(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?dE(this.targetProj_.getExtent()):null;const u=uE(n),h=hE(n),d=iE(n),p=nE(n),f=this.transformInv_(u),g=this.transformInv_(h),m=this.transformInv_(d),y=this.transformInv_(p),_=10+(s?Math.max(0,Math.ceil(Math.log2(eE(n)/(s*s*256*256)))):0);if(this.addQuad_(u,h,d,p,f,g,m,y,_),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const n=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];n[0][0]-t>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-t>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-t>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);const i=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-i.5&&u<1;let p=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=dE(Dk([t,e,n,i]))/this.targetWorldWidth_>.25||p),!d&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)),!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!pE(c,this.maxSourceExtent_))return;let f=0;if(!(p||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!p){const e=[(t[0]+n[0])/2,(t[1]+n[1])/2],i=this.transformInv_(e);let s;s=d?(Pk(r[0],h)+Pk(o[0],h))/2-Pk(i[0],h):(r[0]+o[0])/2-i[0];const a=(r[1]+o[1])/2-i[1];p=s*s+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const c=[(e[0]+n[0])/2,(e[1]+n[1])/2],u=this.transformInv_(c),h=[(i[0]+t[0])/2,(i[1]+t[1])/2],d=this.transformInv_(h);this.addQuad_(t,e,c,h,r,s,u,d,l-1),this.addQuad_(h,c,n,i,d,u,o,a,l-1)}else{const c=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(c),h=[(n[0]+i[0])/2,(n[1]+i[1])/2],d=this.transformInv_(h);this.addQuad_(t,c,h,i,r,u,d,a,l-1),this.addQuad_(c,e,n,h,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,n,i,r,o,a),14&f||this.addTriangle_(t,n,e,r,o,s),f&&(13&f||this.addTriangle_(e,i,t,s,a,r),7&f||this.addTriangle_(e,i,n,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e){const n=e.source;Zk(t,n[0]),Zk(t,n[1]),Zk(t,n[2])}),t}getTriangles(){return this.triangles_}}class oB extends mN{constructor(t,e,n,i,r,s,o,a,l,c,u,h){super(r,0,h),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=i,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=i.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const g=p?cE(d,p):d;if(0===eE(g))return void(this.state=4);const m=t.getExtent();m&&(f=f?cE(f,m):m);const y=i.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,n,i){const r=rE(n);let s=iB(t,e,r,i);return(!isFinite(s)||s<=0)&&tE(n,function(n){return s=iB(t,e,n,i),isFinite(s)&&s>0}),s}(t,n,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==c?c:.5;if(this.triangulation_=new sB(t,n,g,f,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let b=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(b[1]=Ck(b[1],f[1],f[3]),b[3]=Ck(b[3],f[1],f[3])):b=cE(b,f)),eE(b)){let n=0,i=0;t.canWrapX()&&(n=dE(m),i=Math.floor((b[0]-m[0])/n)),yE(b.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let e=r.minX;e<=r.maxX;e++)for(let t=r.minY;t<=r.maxY;t++){const r=l(this.sourceZ_,e,t,o);if(r){const t=i*n;this.sourceTiles_.push({tile:r,offset:t})}}++i}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const n=e.tile;if(n&&2==n.getState()){const i=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);i[0]+=e.offset,i[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:i,clipExtent:r,image:n.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),i="number"==typeof n?n:n[0],r="number"==typeof n?n:n[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=rB(i,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(0==n||1==n){t++;const n=BC(e,_C,()=>{const i=e.getState();2!=i&&3!=i&&4!=i||(VC(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t}){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(VC),this.sourcesListenerKeys_=null}release(){this.canvas_&&(uP(this.canvas_.getContext("2d")),tB.push(this.canvas_),this.canvas_=null),super.release()}}class aB{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof kC&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return vk(void 0!==n,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return vk(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){vk(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}function lB(t,e,n,i){return void 0!==i?(i[0]=t,i[1]=e,i[2]=n,i):[t,e,n]}function cB(t,e,n,i,r){return`${HC(t)},${e},${function(t,e,n){return t+"/"+e+"/"+n}(n,i,r)}`}function uB(t,e,n){if(!(n in t))return t[n]=new Set([e]),!0;const i=t[n],r=i.has(e);return r||i.add(e),!r}function hB(t,e,n){const i=t[n];return!!i&&i.delete(e)}function dB(t,e){const n=t.layerStatesArray[t.layerIndex];n.extent&&(e=cE(e,jT(n.extent,t.viewState.projection)));const i=n.layer.getRenderSource();if(!i.getWrapX()){const n=i.getTileGridForProjection(t.viewState.projection).getExtent();n&&(e=cE(e,n))}return e}class pB extends tL{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new _N(0,0,0,0),this.tempTileCoord_=lB(0,0,0);const n=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new aB(n),this.sourceTileCache_=null,this.maxStaleKeys=.5*n}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new aB(512)),this.sourceTileCache_}getOrCreateTile(t,e,n,i){const r=this.tileCache_,s=this.getLayer().getSource(),o=cB(s,s.getKey(),t,e,n);let a;if(r.containsKey(o))a=r.get(o);else{const l=i.viewState.projection,c=s.getProjection();if(a=s.getTile(t,e,n,i.pixelRatio,l,!c||MT(c,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,n,i){return this.getOrCreateTile(t,e,n,i)||null}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),i=WT(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!Bk(r,i))return null;const s=e.viewState,o=n.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let c=a.getZForResolution(s.resolution);c>=a.getMinZoom();--c){const t=a.getTileCoordForCoordAndZ(i,c),n=this.getTile(c,t[1],t[2],e);if(!n||2!==n.getState())continue;const r=a.getOrigin(c),u=aI(a.getTileSize(c)),h=a.getResolution(c);let d;if(n instanceof yN||n instanceof oB)d=n.getImage();else{if(!(n instanceof JU))continue;if(d=XU(n.getData()),!d)continue}const p=Math.floor(l*((i[0]-r[0])/h-t[1]*u[0])),f=Math.floor(l*((r[1]-i[1])/h-t[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const n=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,n,i,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),c=HC(a);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],h=o.getMapInternal(),d=Math.max(n-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),h?h.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,f=p?aE(s.center,s.resolution,p,t.size):void 0;for(let g=n;g>=d;--g){const n=l.getTileRangeForExtentAndZ(e,g,this.tempTileRange_),r=l.getResolution(g);for(let e=n.minX;e<=n.maxX;++e)for(let s=n.minY;s<=n.maxY;++s){if(p&&!l.tileCoordIntersectsViewport([g,e,s],f))continue;const n=this.getTile(g,e,s,t);if(!n)continue;if(!uB(i,n,g))continue;const o=n.getKey();if(u[o]=!0,0===n.getState()&&!t.tileQueue.isKeyQueued(o)){const i=lB(g,e,s,this.tempTileCoord_);t.tileQueue.enqueue([n,c,l.getTileCoordCenter(i),r])}}}}findStaleTile_(t,e){const n=this.tileCache_,i=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let a=0;a0&&setTimeout(()=>{this.enqueueTiles(t,C,h-1,x,S-1)},0),!(h in x))return this.container;const k=HC(this),E=t.time;for(const A of x[h]){const e=A.getState();if(4===e)continue;const n=A.tileCoord;if(2===e&&1===A.getAlpha(k,E)){A.endTransition(k);continue}if(3!==e&&(this.renderComplete=!1),this.findStaleTile_(n,x)){hB(x,A,h),t.animate=!0;continue}if(this.findAltTiles_(u,n,h+1,x))continue;const i=u.getMinZoom();for(let t=h-1;t>=i&&!this.findAltTiles_(u,n,t,x);--t);}const T=d/s*a/g,R=this.getRenderContext(t);KT(this.tempTransform,m/2,y/2,T,T,0,-m/2,-y/2),n.extent&&this.clipUnrotated(R,t,_),c.getInterpolate()||(R.imageSmoothingEnabled=!1),this.preRender(R,t);const P=Object.keys(x).map(Number);let M;P.sort(EC);const I=[],O=[];for(let A=P.length-1;A>=0;--A){const e=P[A],n=c.getTilePixelSize(e,a,r),i=u.getResolution(e)/d,s=n[0]*i*T,o=n[1]*i*T,l=u.getTileCoordForCoordAndZ(uE(w),e),h=u.getTileCoordExtent(l),p=WT(this.tempTransform,[g*(h[0]-w[0])/d,g*(w[3]-h[3])/d]),f=g*c.getGutterForProjection(r);for(const r of x[e]){if(2!==r.getState())continue;const n=r.tileCoord,i=l[1]-n[1],a=Math.round(p[0]-(i-1)*s),u=l[2]-n[2],h=Math.round(p[1]-(u-1)*o),d=Math.round(p[0]-i*s),g=Math.round(p[1]-u*o),m=a-d,y=h-g,_=1===P.length;let v=!1;M=[d,g,d+m,g,d+m,g+y,d,g+y];for(let t=0,r=I.length;t{const n=HC(c),i=e.wantedTiles[n],r=i?Object.keys(i).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,n,i,r,s,o,a){let l;if(t instanceof JU){if(l=XU(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const c=this.getRenderContext(e),u=HC(this),h=e.layerStatesArray[e.layerIndex],d=h.opacity*(a?t.getAlpha(u,e.time):1),p=d!==c.globalAlpha;p&&(c.save(),c.globalAlpha=d),c.drawImage(l,o,o,l.width-2*o,l.height-2*o,n,i,r,s),p&&c.restore(),d!==h.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,n){const i=HC(e);i in t||(t[i]={}),t[i][n.getKey()]=!0}}const fB="preload",gB="useInterimTilesOnError";class mB extends bM{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(fB)}setPreload(t){this.set(fB,t)}getUseInterimTilesOnError(){return this.get(gB)}setUseInterimTilesOnError(t){this.set(gB,t)}getData(t){return super.getData(t)}}class yB extends mB{constructor(t){super(t)}createRenderer(){return new pB(this,{cacheSize:this.getCacheSize()})}}const _B={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},vB={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class bB extends pB{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,n,i,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,n,i,r,s,o,a)}getTile(t,e,n,i){const r=this.getOrCreateTile(t,e,n,i);if(!r)return null;const s=i.viewState,o=s.resolution,a=i.viewHints,l=this.getLayer().getSource(),c=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),h=c.getZForResolution(o,l.zDirection)===t;return u&&h?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=c.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,n){const i=this.getLayer(),r=i.getRevision(),s=i.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(i);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedRenderOrder==s)return;const l=i.getSource(),c=!!i.getDeclutter(),u=l.getTileGrid(),h=l.getTileGridForProjection(n).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,n,t),p=HC(i);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let f=0,g=d.length;ft.value):null;let m;t:for(let y=0,_=d.length;y<_;++y){const e=d[y];if(!pE(l.getTileCoordExtent(e.wrappedTileCoord),c))continue;const i=e.executorGroups[p];for(let r=0,a=i.length;r{const n=this.getLayer(),i=n.getSource(),r=this.renderedProjection,s=r.getExtent(),o=this.renderedResolution,a=i.getTileGridForProjection(r),l=WT(this.renderedPixelToCoordinateTransform_,t.slice()),c=a.getTileCoordForCoordAndResolution(l,o).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);i.getWrapX()&&r.canWrapX()&&!qk(s,a.getTileCoordExtent(u.tileCoord))&&bE(l,r);const h=HC(n),d=uE(a.getTileCoordExtent(u.wrappedTileCoord)),p=[(l[0]-d[0])/o,(d[1]-l[1])/o],f=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let g=u.hitDetectionImageData[h];if(!g){const t=aI(a.getTileSize(a.getZForResolution(o,i.zDirection))),e=this.renderedRotation_;g=VF(t,[this.getRenderTransform(a.getTileCoordCenter(u.wrappedTileCoord),o,0,qF,t[0]*qF,t[1]*qF,0)],f,n.getStyleFunction(),a.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[h]=g}e($F(p,f,g))})}getFeaturesInExtent(t){const e=[],n=this.getTileCache();if(0===n.getCount())return e;const i=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=i.getZForResolution(this.renderedResolution),s={};return n.forEach(n=>{if(n.tileCoord[0]!==r||2!==n.getState())return;const o=n.getSourceTiles();for(let r=0,a=o.length;r=0;--i)n[i].execute(this.context,o,this.getTileRenderTransform(e,t),t.viewState.rotation,s,DF,l)}n.globalAlpha=i}renderDeferredInternal(t){const e=this.renderedTiles,n=HC(this.getLayer()),i=e.reduce((t,e,i)=>(e.executorGroups[n].forEach(e=>t.push({executorGroup:e,index:i})),t),[]),r=i.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let o=0,a=i.length;o{r.forEach((e,n)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=i[n],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})})}getTileRenderTransform(t,e){const n=e.pixelRatio,i=e.viewState,r=i.center,s=i.resolution,o=i.rotation,a=e.size,l=Math.round(a[0]*n),c=Math.round(a[1]*n),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),h=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(h,this.tempExtent)[0]-d[0];return $T(HT(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(r,s,o,n,l,c,p))}postRender(t,e){const n=e.viewHints,i=!(n[0]||n[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?vB[s].filter(t=>!DF.includes(t)):vB[s],c=e.viewState,u=c.rotation,h=r.getSource(),d=h.getTileGridForProjection(c.projection).getZForResolution(c.resolution,h.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=HC(r);let _=!0;for(let v=p.length-1;v>=0;--v){const n=p[v];_=_&&!n.getReplayState(r).dirty;const s=n.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===s.length)continue;const o=this.getTileRenderTransform(n,e),c=n.tileCoord[0];let h=!1;const b=s[0].getClipCoords(o);let w,x=t;if(b){w=new CF,x=w.getContext();for(let t=0,e=f.length;t{const t=this.sourceImage_.getState();2!=t&&3!=t||(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){VC(this.sourceListenerKey_),this.sourceListenerKey_=null}}class CB extends NC{constructor(t,e){super(t),this.image=e}}class kB extends dL{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();return e&&(t=e[RC(e,t,0)]),t}getImage(t,e,n,i){const r=this.getProjection();if(!r||!i||MT(r,i))return r&&(i=r),this.getImageInternal(t,e,n,i);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&MT(this.reprojectedImage_.getProjection(),i)&&this.reprojectedImage_.getResolution()==e&&Xk(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new SB(r,i,t,e,n,(t,e,n)=>this.getImageInternal(t,e,n,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,i){if(this.loader){const r=function(t,e,n){const i=e/n,r=rE(t),s=Ak(dE(t)/i,4),o=Ak(lE(t)/i,4);return oE(r,i,0,[s+2*Ak(0*s/2,4),o+2*Ak(0*o/2,4)])}(t,e,n),s=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===i&&(this.wantedExtent_&&qk(this.wantedExtent_,r)||qk(this.image.getExtent(),r))&&(this.wantedResolution_&&xB(this.wantedResolution_)===s||xB(this.image.getResolution())===s)))return this.image;this.wantedProjection_=i,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new OO(r,s,n,this.loader),this.image.addEventListener(_C,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case 1:this.loading=!0,n="imageloadstart";break;case 2:this.loading=!1,n="imageloadend";break;case 3:this.loading=!1,n="imageloaderror";break;default:return}this.hasListener(n)&&this.dispatchEvent(new CB(n,e))}}const EB=[0,0,0];class TB{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,vk(function(t){const e=((t,e)=>e-t)||EC;return t.every(function(n,i){if(0===i)return!0;const r=e(t[i-1],n);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let i=0,r=this.resolutions_.length-1;i{const i=new _N(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(n){const t=this.getTileRangeForExtentAndZ(n,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const i=this.getTileRangeForExtentAndZ(t,e);for(let r=i.minX,s=i.maxX;r<=s;++r)for(let t=i.minY,o=i.maxY;t<=o;++t)n([e,r,t])}forEachTileCoordParentTileRange(t,e,n,i){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,i);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=vN(s,s,o,o,n)):r=this.getTileRangeForExtentAndZ(a,l,n),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]this.maxZoom||e0?i:Math.max(s/n[0],r/n[1]);const o=e+1,a=new Array(o);for(let l=0;ln||n>e.getMaxZoom())return!1;const s=e.getFullTileRange(n);return!s||s.containsXY(i,r)}(t,i)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class AB extends NC{constructor(t,e){super(t),this.tile=e}}function FB(t){return function(e){const n=e.buffers,i=e.meta,r=e.imageOps,s=e.width,o=e.height,a=n.length,l=n[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,n=t.inputs[0].height,i=t.inputs.map(function(t){return t.data.buffer}),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:i,meta:t.meta,imageOps:this.imageOps_,width:e,height:n},i);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let a=0;athis.getTileInternal(t,e,n,i,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,n,i,r,s){const o=this.getKey(),a=cB(this,o,t,e,n);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,n,i,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const n=CT(t);if(n){const t=HC(n);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function YB(t,e){if(ok){const n=t.getCrossOrigin();let i="same-origin",r="same-origin";return"anonymous"===n||""===n?(i="cors",r="omit"):"use-credentials"===n&&(i="cors",r="include"),void fetch(e,{mode:i,credentials:r}).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const n=t.getImage();n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0),e.close?.(),n.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}class ZB extends XB{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:CT("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)!function(t,e,n){const i=document.createElement("script"),r="olc_"+HC(e);function s(){delete window[r],i.parentNode.removeChild(i)}i.async=!0,i.src=t+(t.includes("?")?"&":"?")+"callback="+r;const o=setTimeout(function(){s(),n&&n()},1e4);window[r]=function(t){clearTimeout(o),s(),e(t)},document.head.appendChild(i)}(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=CT("EPSG:4326"),n=this.getProjection();let i;if(void 0!==t.bounds){const r=IT(e,n);i=gE(t.bounds,r)}const r=IB(n),s=t.minzoom||0,o=PB({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=HB(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==i?i:r;this.setAttributions(function(n){return pE(e,n.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}class JB extends KB{constructor(t){const e=t.projection||"EPSG:3857",n=t.extent||IB(e),i=t.tileGrid||PB({extent:n,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:i,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:QB,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:xN,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,n){if(0===n.getState()){n.setState(1);const i=n.wrappedTileCoord,r=this.getTileGridForProjection(e);let s=r.getTileCoordExtent(i);const o=i[0],a=r.getResolution(o);jk(s,-a,s);const l=this.projection;e&&this.projection&&!MT(e,l)&&(s=LT(s,e,l));const c=this.tileGrid,u=c.getExtent();u&&cE(s,u,s);let h=a;e&&l&&!MT(e,l)&&(h=a/l.getMetersPerUnit()/e.getMetersPerUnit());const d=c.getZForResolution(h,this.zDirection);c.forEachTileCoord(s,d,i=>{const r=this.tileUrlFunction(i,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(i,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];n.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(n.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const i=s.getState();if(2===i||3===i){const e=s.getKey();e in n.errorTileKeys?2===s.getState()&&delete n.errorTileKeys[e]:n.loadingSourceTiles--,3===i?n.errorTileKeys[e]=!0:s.removeEventListener(_C,t),0===n.loadingSourceTiles&&n.setState(jC(n.errorTileKeys)?2:3)}};s.addEventListener(_C,t),n.loadingSourceTiles++}0===o&&(s.extent=c.getTileCoordExtent(i),s.projection=this.projection,s.resolution=c.getResolution(i[0]),s.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(t=>3===t.getState())?3:2)}return n.sourceTiles}removeSourceTiles(t){const e=t.getKey(),n=t.sourceTiles;for(let i=0,r=n.length;i{u=u&&!this.tileUrlFunction(t,i,l)})}const h=new wN(s,u?4:0,o,this.getSourceTiles.bind(this,i,r),this.removeSourceTiles.bind(this));return h.key=this.getKey(),h}getTileGridForProjection(t){const e=t.getCode();let n=this.tileGrids_[e];if(!n){const i=this.projection;if(null!==i&&!MT(i,t))return RB(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;td?h-A+d:d-A,O=Math.atan(Math.sqrt(M*M+I*I)),q=m*Math.cos(O)+g*Math.sin(O)*Math.cos(f-A),F=Math.cos(O),L=255*q,N=Math.min(Math.max(2*e.sunEl,0),1),U=1.875-1.75*e.opacity,B=.5!==e.opacity?d*((Math.pow(U,O)-1)/(Math.pow(U,d)-1)):O,D={r:(1-F)*v.r*N*255,g:(1-F)*v.g*N*255,b:(1-F)*v.b*N*255,a:(1-F)*v.a*N*255},z=Math.abs(((A+f)/Math.PI+.5)%2-1),j={r:(y.r*(1-z)+_.r*z)*L,g:(y.g*(1-z)+_.g*z)*L,b:(y.b*(1-z)+_.b*z)*L,a:(y.a*(1-z)+_.a*z)*L},T=4*(x*i+w),o[T]=D.r*(1-z)+j.r,o[T+1]=D.g*(1-z)+j.g,o[T+2]=D.b*(1-z)+j.b,o[T+3]=s[T+3]*e.opacity*N*Math.sin(B);return new ImageData(o,i,r)}function eq(t,e){const n=t[0],i=n.width,r=n.height,s=n.data,o=new Uint8ClampedArray(s.length),a=i-1,l=r-1,c=[0,0,0,0];let u,h,d;const p=(f=e.saturation)>0?1-1/(1.001-f):-f;var f;const g=(m=e.contrast)>0?1/(1-m):1+m;var m;const y=function(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}(e.hueRotate),_=y,v=[y[2],y[0],y[1]],b=[y[1],y[2],y[0]],w=e.brightnessLow,x=e.brightnessHigh;for(h=0;h<=l;++h)for(u=0;u<=a;++u){d=4*(h*i+u),c[0]=s[d],c[1]=s[d+1],c[2]=s[d+2],c[3]=s[d+3];const t=c[0],e=c[1],n=c[2],r=(t,e)=>{let n=0;for(let i=0;i{e.accessToken=t,e.accessTokenParam=n})),e}function rq(t,e){let n;return t.some(function(t){if(t.id==e)return n=t.source,!0}),n}function sq(t,e,n){const i=new ZB({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=i.getTileJSON(),s=i.getTileGrid(),o=CT(n.projection||"EPSG:3857"),a=function(t,e){const n=t.bounds;if(n){const t=RT([n[0],n[1]],e),i=RT([n[2],n[3]],e);return[t[0],t[1],i[0],i[1]]}return CT(e).getExtent()}(r,o),l=o.getExtent(),c=r.minzoom||0,u=r.maxzoom||22,h={attributions:i.getAttributions(),projection:o,tileGrid:new TB({origin:l?uE(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:nq(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?h.urls=r.tiles:h.url=r.tiles,h}function oq(t,e,n){return new Promise(function(i,r){$N(t,e,n).then(function({tileJson:e,tileLoadFunction:r}){const s=sq(t,e,n);s.tileLoadFunction=r,s.format=new BU({layerName:"mvt:layer"});const o=new JB(s);o.set("mapbox-source",t),i(o)}).catch(r)})}function aq(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function lq(t,e,n){const i=new yB;return function(t,e,n){return new Promise(function(i,r){$N(t,e,n).then(function({tileJson:e,tileLoadFunction:r}){const s=new ZB({interpolate:void 0===n.interpolate||n.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=sq(t,e,n).tileGrid,n.projection&&(s.projection=CT(n.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction(function(t,e,n){const i=aq(n);let r=o(t,e,n);if(-1!=r.indexOf(i)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(i,e.toString())}return r}),s.set("mapbox-source",t),i(s)}).catch(function(t){r(t)})})}(t,e,n).then(function(t){i.setSource(t)}).catch(function(){i.setSource(void 0)}),i}function cq(t,e,n){const i=n.projection?new SU({dataProjection:n.projection}):new SU,r=t.data,s={};if("string"==typeof r){const[s]=RN(r,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,n)=>{const i=aq(n);return s.replace(i,`${t.join(",")}`)},r=new yL({attributions:t.attribution,format:i,loader:(t,i,s,o,a)=>{BN("GeoJSON","function"==typeof e?e(t,i,s):e,n).then(t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)}).catch(()=>{r.removeLoadedExtent(t),a()})},strategy:oL});return r.set("mapbox-source",t),r}const o=new yL({attributions:t.attribution,format:i,url:s,loader:(t,e,i,r,a)=>{BN("GeoJSON",s,n).then(t=>{const e=o.getFormat().readFeatures(t,{featureProjection:i});o.addFeatures(e),r(e)}).catch(()=>{o.removeLoadedExtent(t),a()})}});return o}s.features=i.readFeatures(r,{featureProjection:"EPSG:3857"});const o=new yL(Object.assign({attributions:t.attribution,format:i},s));return o.set("mapbox-source",t),o}function uq(t,e,n,i){const r=FN(t),s=t.layers,o=n.type,a=n.source||rq(s,n.ref),l=t.sources[a];let c;if("background"==o)c=function(t,e,n){const i=ok?{style:{}}:document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new bM({source:new dL({}),render(r){const s=function(t,e,n,i){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};let a;r.paint=o,sU.zoom=jN(e,n.resolutions||zN),sU.distanceFromCenter=0;const l=lU(r,"paint","background-color",PN,i);return void 0!==o["background-opacity"]&&(a=lU(r,"paint","background-opacity",PN,i)),"none"==s.visibility?void 0:hU(l,a)}(t,r.viewState.resolution,e,n);return i.style.backgroundColor=s,i}})}(n,i,r);else if("vector"==l.type)c=function(t,e,n){const i=new wB({declutter:!0,visible:!1});return oq(t,e,n).then(function(t){i.setSource(t)}).catch(function(){i.setSource(void 0)}),i}(l,e,i);else if("raster"==l.type){const t=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];Object.keys(n.paint||{}).find(e=>t.includes(e))?(c=function(t,e,n){const i=lq(t,e,n);return new KU({source:new jB({operationType:"image",operation:eq,sources:[i]})})}(l,e,i),c.getSource().on("beforeoperations",function(t){sU.zoom=jN(t.resolution,i.resolutions||zN),sU.distanceFromCenter=0;const e=t.data;e.saturation=lU(n,"paint","raster-saturation",PN,r),e.contrast=lU(n,"paint","raster-contrast",PN,r),e.brightnessHigh=lU(n,"paint","raster-brightness-max",PN,r),e.brightnessLow=lU(n,"paint","raster-brightness-min",PN,r),e.hueRotate=lU(n,"paint","raster-hue-rotate",PN,r)})):c=lq(l,e,i),c.setVisible(!n.layout||"none"!==n.layout.visibility),c.on("prerender",function(t,e,n){let i=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete n[t.id],function(t,e,n,i){sU.zoom=n,sU.distanceFromCenter=0;const r=lU(t,"paint","raster-opacity",PN,i);e.setOpacity(r)}(t,e,i,n))}}(n,c,r))}else if("geojson"==l.type)c=function(t,e,n){return new nL({declutter:!0,source:cq(t,e,n),visible:!1})}(l,e,i);else if("raster-dem"==l.type&&"hillshade"==n.type){const t=function(t,e,n){const i=lq(t,e,n);return new KU({source:new jB({operationType:"image",operation:tq,sources:[i]})})}(l,e,i);c=t,t.getSource().on("beforeoperations",function(t){const e=t.data;e.resolution=kT(i.projection||"EPSG:3857",t.resolution,rE(t.extent),"m"),sU.zoom=jN(t.resolution,i.resolutions||zN),sU.distanceFromCenter=0,e.encoding=l.encoding,e.vert=5*lU(n,"paint","hillshade-exaggeration",PN,r),e.sunAz=lU(n,"paint","hillshade-illumination-direction",PN,r),e.sunEl=35,e.opacity=.3,e.highlightColor=lU(n,"paint","hillshade-highlight-color",PN,r),e.shadowColor=lU(n,"paint","hillshade-shadow-color",PN,r),e.accentColor=lU(n,"paint","hillshade-accent-color",PN,r)}),c.setVisible(!n.layout||"none"!==n.layout.visibility)}const u=a;return c&&c.set("mapbox-source",u),c}function hq(t,e,n,i,r,s={}){let o=24,a=0;const l=n.layers;for(let c=0,u=l.length;c0||n>0)&&t.setMaxResolution(Math.min(NN(Math.max(0,o-1e-12),zN),NN(Math.max(0,n-1e-12),e.getResolutions()))),a<24&&t.setMinResolution(NN(a,zN))}}else o>0&&t.setMaxResolution(NN(Math.max(0,o-1e-12),zN));u instanceof yL||u instanceof JB?function(t,e,n="",i={},r){let s,o,a,l,c=!0;return"string"==typeof n||Array.isArray(n)?l=n:(a=n,l=a.source||a.layers,i=a),"string"==typeof i?(s=i,a={}):(s=i.styleUrl,a=i),!1===a.updateSource&&(c=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:EN(s,a.accessToken),a=iq(s,a)),new Promise(function(n,i){qN(e,a).then(function(e){if(8!=e.version)return i(new Error("glStyle version 8 required."));if(!(t instanceof nL||t instanceof wB))return i(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof wB?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find(function(t){return t.id===l[0]}).source:l:(o=e.layers.find(function(t){return t.source&&e.sources[t.source].type===u}).source,l=o),!o)return i(new Error(`No ${u} source found in the glStyle.`));function h(){if(!c)return Promise.resolve();if(t instanceof wB)return oq(e.sources[o],s,a).then(function(e){const n=t.getSource();n?e!==n&&(n.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof n.setUrls&&"function"==typeof e.getUrls&&n.setUrls(e.getUrls()),n.format_||(n.format_=e.format_),n.getAttributions()||n.setAttributions(e.getAttributions()),n.getTileLoadFunction()===QB&&n.setTileLoadFunction(e.getTileLoadFunction()),MT(n.getProjection(),e.getProjection())&&(n.tileGrid=e.getTileGrid())):t.setSource(e);const i=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&i.getMinZoom()>0&&t.setMaxResolution(NN(Math.max(0,i.getMinZoom()-1e-12),i.getResolutions()))});const n=e.sources[o];let i=t.getSource();i&&i.get("mapbox-source")===n||(i=cq(n,s,a));const r=t.getSource();return r?i!==r&&(r.getAttributions()||r.setAttributions(i.getAttributions()),r.format_||(r.format_=i.getFormat()),r.url_=i.getUrl()):t.setSource(i),Promise.resolve()}let d,p;const f={},g={};function m(){if(p||e.sprite&&!f)p?(t.setStyle(p),h().then(n).catch(i)):i(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=CT(a.projection).getUnits();"m"!==t&&(r=zN.map(e=>e/PE[t]))}let s;const c=t.getSource();c instanceof JB&&c.format_ instanceof BU&&(s=c.format_.layerName_),p=function(t,e,n,i=zN,r,s,o,a){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");gU[function(t,e){return AN(t)+"."+HC(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const w in s){const e=s[w];zC(()=>e).then(async e=>{let n;if("undefined"!=typeof Image){const i=new Image;if("string"==typeof e)i.crossOrigin="anonymous",i.src=e;else{let t;e instanceof Request?t=await fetch(e):e instanceof Response&&(t=e);const r=await t.blob();n=URL.createObjectURL(r),i.src=n}i.addEventListener("load",function e(){i.removeEventListener("load",e),l[w]={image:i,size:[i.width,i.height]},t.changed(),n&&URL.revokeObjectURL(n)}),i.addEventListener("error",function t(){URL.revokeObjectURL(n),i.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:e}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===e&&(l[w]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const c=OL(e.layers),u={},h=[],d={},p={},f=FN(e),g=function(t){let e=IN[t.id];return e||(e={},IN[AN(t)]=e),e}(e);let m;for(let w=0,x=c.length;w=h.maxzoom)continue;const E=h.filter;if(!E||uU(x,E,T,g)){let i,c,g,b,w,x;const E=u.index;if(3==S&&("fill"==h.type||"fill-extrusion"==h.type))if(c=lU(h,"paint",h.type+"-opacity",T,f,R),h.type+"-pattern"in k){const t=lU(h,"paint",h.type+"-pattern",T,f,R);if(t){const e="string"==typeof t?pU(t,m):t.toString(),n=fU(e,l);if(r&&r[e]&&n){++P,x=v[P],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new dA({fill:new lA}),v[P]=x),g=x.getFill(),x.setZIndex(E);const t=e+"."+c;let i=p[t];if(!i){const s=r[e],o=DN(s.width,s.height),a=o.getContext("2d");a.globalAlpha=c,a.drawImage(n.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),i=a.createPattern(o,"repeat"),p[t]=i}g.setColor(i)}}}else i=hU(lU(h,"paint",h.type+"-color",T,f,R),c),h.type+"-outline-color"in k&&(w=hU(lU(h,"paint",h.type+"-outline-color",T,f,R),c)),w||(w=i),(i||w)&&(++P,x=v[P],(!x||i&&!x.getFill()||!i&&x.getFill()||w&&!x.getStroke()||!w&&x.getStroke()||x.getText())&&(x=new dA({fill:i?new lA:void 0,stroke:w?new hA:void 0}),v[P]=x),i&&(g=x.getFill(),g.setColor(i)),w&&(b=x.getStroke(),b.setColor(w),b.setWidth(.5)),x.setZIndex(E));if(1!=S&&"line"==h.type){i="line-pattern"in k?void 0:hU(lU(h,"paint","line-color",T,f,R),lU(h,"paint","line-opacity",T,f,R));const t=lU(h,"paint","line-width",T,f,R);i&&t>0&&(++P,x=v[P],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new dA({stroke:new hA}),v[P]=x),b=x.getStroke(),b.setLineCap(lU(h,"layout","line-cap",T,f,R)),b.setLineJoin(lU(h,"layout","line-join",T,f,R)),b.setMiterLimit(lU(h,"layout","line-miter-limit",T,f,R)),b.setColor(i),b.setWidth(t),b.setLineDash(k["line-dasharray"]?lU(h,"paint","line-dasharray",T,f,R).map(function(e){return e*t}):null),x.setZIndex(E))}let M,I,O,A,F,L,z,D,j,N=!1,U=null,B=0;if((1==S||2==S)&&"icon-image"in C){const e=lU(h,"layout","icon-image",T,f,R);if(e){let i;M="string"==typeof e?pU(e,m):e.toString();const o=a?a(t,M):void 0,c=fU(M,l);if(r&&r[M]&&c||o){const t=lU(h,"layout","icon-rotation-alignment",T,f,R);if(2==S){const e=n.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const n=e.getExtent();if(Math.sqrt(Math.max(Math.pow((n[2]-n[0])/s,2),Math.pow((n[3]-n[1])/s,2)))>150){const n="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(aU||(oU=[NaN,NaN],aU=new uL("Point",oU,[],2,{},void 0)),i=aU,oU[0]=n[0],oU[1]=n[1],"line"===lU(h,"layout","symbol-placement",T,f,R)&&"map"===t){const t=e.getStride(),i=e.getFlatCoordinates();for(let e=0,r=i.length-t;e=l){B=Math.atan2(s-a,o-r);break}}}}}}if(2!==S||i){const e=lU(h,"layout","icon-size",T,f,R),n=void 0!==k["icon-color"]?lU(h,"paint","icon-color",T,f,R):null;if(!n||0!==n.a){const i=lU(h,"paint","icon-halo-color",T,f,R),s=lU(h,"paint","icon-halo-width",T,f,R);let a=`${M}.${e}.${s}.${i}`;if(null!==n&&(a+=`.${n}`),I=d[a],!I){const l=cU(h,T,"icon",f);let u;"icon-offset"in C&&(u=lU(h,"layout","icon-offset",T,f,R).slice(0),u[0]*=e,u[1]*=-e);let p=n?[255*n.r,255*n.g,255*n.b,n.a]:void 0;if(o){const n={color:p,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?n.src=o:(n.img=o,n.imgSize=[o.width,o.height]),I=new uA(n)}else{const o=r[M];let a,h,d;if(s)o.sdf?(a=GN(HN(c.image,o,n||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,i),p=void 0):a=GN(c.image,o,s,i);else{if(o.sdf&&!c.unSDFed){const t=HN(c.image,{x:0,y:0,width:c.size[0],height:c.size[1]},{r:1,g:1,b:1});c.image=t,c.unSDFed=!0}a=c.image,h=[o.width,o.height],d=[o.x,o.y]}I=new uA({color:p,img:a,imgSize:c.size,size:h,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=I}}I&&(++P,x=v[P],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new dA,v[P]=x),x.setGeometry(i),I.setRotation(B+LN(lU(h,"layout","icon-rotate",T,f,R))),I.setOpacity(lU(h,"paint","icon-opacity",T,f,R)),I.setAnchor(rU[lU(h,"layout","icon-anchor",T,f,R)]),x.setImage(I),U=x.getText(),x.setText(void 0),x.setZIndex(E),N=!0,O=!1)}else O=!0}}}if(1==S&&"circle"===h.type){++P,x=v[P],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new dA,v[P]=x);const t="circle-radius"in k?lU(h,"paint","circle-radius",T,f,R):5,e=hU(lU(h,"paint","circle-stroke-color",T,f,R),lU(h,"paint","circle-stroke-opacity",T,f,R)),n=lU(h,"paint","circle-translate",T,f,R),i=hU(lU(h,"paint","circle-color",T,f,R),lU(h,"paint","circle-opacity",T,f,R)),r=lU(h,"paint","circle-stroke-width",T,f,R),s=t+"."+e+"."+i+"."+r+"."+n[0]+"."+n[1];I=d[s],I||(I=new aA({radius:t,displacement:[n[0],-n[1]],stroke:e&&r>0?new hA({width:r,color:e}):void 0,fill:i?new lA({color:i}):void 0,declutterMode:"none"}),d[s]=I),x.setImage(I),U=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(E),N=!0}if("text-field"in C){z=Math.round(lU(h,"layout","text-size",T,f,R));const t=lU(h,"layout","text-font",T,f,R);L=lU(h,"layout","text-line-height",T,f,R),F=fN(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,z,L),F.includes("sans-serif")||(F+=",sans-serif"),D=lU(h,"layout","text-letter-spacing",T,f,R),j=lU(h,"layout","text-max-width",T,f,R);const n=lU(h,"layout","text-field",T,f,R);A="object"==typeof n&&n.sections?1===n.sections.length?n.toString():n.sections.reduce((e,n)=>{const i=n.fontStack?n.fontStack.split(","):t,r=fN(o?o(i):i,z*(n.scale||1),L);let s=n.text;if("\n"===s)return e.push("\n",""),e;if(2==S)return e.push(XN(s,D),r),e;s=tU(s,r,j,D).split("\n");for(let t=0,o=s.length;t0&&e.push("\n",""),e.push(s[t],r);return e},[]):pU(n,m).trim(),c=lU(h,"paint","text-opacity",T,f,R)}if(A&&c&&!O){N||(++P,x=v[P],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new dA,v[P]=x),x.setImage(void 0),x.setGeometry(void 0));const t=cU(h,T,"text",f);x.getText()||x.setText(U),U=x.getText(),(!U||"getDeclutterMode"in U&&U.getDeclutterMode()!==t)&&(U=new mA({padding:[2,2,2,2],declutterMode:t}),x.setText(U));const e=lU(h,"layout","text-transform",T,f,R);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const n=Array.isArray(A)?A:2==S?XN(A,D):tU(A,F,j,D);if(U.setText(n),U.setFont(F),U.setRotation(LN(lU(h,"layout","text-rotate",T,f,R))),"function"==typeof U.setKeepUpright){const t=lU(h,"layout","text-keep-upright",T,f,R);U.setKeepUpright(t)}const i=lU(h,"layout","text-anchor",T,f,R),r=N||1==S?"point":lU(h,"layout","symbol-placement",T,f,R);let s;if("line-center"===r?(U.setPlacement("line"),s="center"):U.setPlacement(r),"line"===r&&"function"==typeof U.setRepeat){const t=lU(h,"layout","symbol-spacing",T,f,R);U.setRepeat(2*t)}U.setOverflow("point"===r);let o=lU(h,"paint","text-halo-width",T,f,R);const a=lU(h,"layout","text-offset",T,f,R),l=lU(h,"paint","text-translate",T,f,R);let u=0,d=0;if("point"==r){s="center",-1!==i.indexOf("left")?(s="left",d=o):-1!==i.indexOf("right")&&(s="right",d=-o);const t=lU(h,"layout","text-rotation-alignment",T,f,R);U.setRotateWithView("map"==t)}else U.setMaxAngle(LN(lU(h,"layout","text-max-angle",T,f,R))*A.length/n.length),U.setRotateWithView(!1);U.setTextAlign(s);let p="middle";0==i.indexOf("bottom")?(p="bottom",u=-o-.5*(L-1)*z):0==i.indexOf("top")&&(p="top",u=o+.5*(L-1)*z),U.setTextBaseline(p);const g=lU(h,"layout","text-justify",T,f,R);U.setJustify("auto"===g?void 0:g),U.setOffsetX(a[0]*z+d+l[0]),U.setOffsetY(a[1]*z+u+l[1]),_.setColor(hU(lU(h,"paint","text-color",T,f,R),c)),U.setFill(_);const m=hU(lU(h,"paint","text-halo-color",T,f,R),c);if(m&&o>0){y.setColor(m),o*=2;const t=.5*z;y.setWidth(o<=t?o:t),U.setStroke(y)}else U.setStroke(void 0);const b=lU(h,"layout","text-padding",T,f,R),w=U.getPadding();b!==w[0]&&(w[0]=b,w[1]=b,w[2]=b,w[3]=b),x.setZIndex(E)}}}return P>-1?(v.length=P+1,v):void 0};return t.setStyle(b),t.set("mapbox-layers",h),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),b}(t,e,l,r,f,g,(t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(ok)return t;let n;for(let i=0,r=t.length;i{await document.fonts.ready;for(let t=0,i=n.length;tt.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&t.weight==s&&t.style===o)){const t=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",s).replace("{-fontstyle}",o.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",o);if(!document.querySelector('link[href="'+t+'"]')){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}}}})(),t):t}(t,e),a.getImage,s),t.getStyle()?h().then(n).catch(i):i(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=function(t,e,n){if("string"==typeof t)return[{id:"default",url:kN(t,e,n)}];for(const i of t)i.url=kN(i.url,e,n);return t}(e.sprite,a.accessToken,s||location.href);d=ok?1:window.devicePixelRatio>=1.5?.5:1;const n=.5==d?"@2x":"";Promise.all(t.map(function(t){const e=new URL(t.url);let r=e.origin+e.pathname+n+".json"+e.search;return new Promise(function(t,n){BN("Sprite",r,a).then(t).catch(function(){r=e.origin+e.pathname+".json"+e.search,BN("Sprite",r,a).then(t).catch(n)})}).then(function(r){let s;if(void 0===r&&i(new Error("No sprites found.")),s=e.origin+e.pathname+n+".png"+e.search,a.transformRequest){const t=a.transformRequest(s,"SpriteImage")||s;(t instanceof Request||t instanceof Promise)&&(s=t)}g[t.id]=s;for(const e in r){const n="default"==t.id?e:`${t.id}:${e}`;f[n]=r[e]}}).catch(function(t){i(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))})})).then(m).catch(i)}else m()}).catch(i)})}(t,n,e,Object.assign({styleUrl:i},s)).then(function(){!function(t,e){function n(){const n=e.get("mapbox-style");if(!n)return;const i=OL(n.layers),r=t.get("mapbox-layers"),s=i.filter(function(t){return r.includes(t.id)}).some(function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility});t.get("visible")!==s&&t.setVisible(s)}t.on("change",n),n()}(t,r),l()}).catch(c):l()}else c(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const h=r.getLayers();-1===h.getArray().indexOf(t)&&h.push(t),t.getSource()?u():t.once("change:source",u)})}class dq extends sC{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");mapInstance;bookmarkSource;searchOverlay;searchOverlayElement;selectedPinOverlay;selectedPinElement;crosshairElement;crosshairOverlay;setupMap=fC(t=>{if(this.mapInstance)return;const e=new gM;this.bookmarkSource=new yL;const n=new nL({source:this.bookmarkSource,style:[new dA({image:new aA({radius:10,fill:new lA({color:"rgba(0, 0, 0, 0.2)"}),displacement:[0,-2]})}),new dA({image:new aA({radius:9,fill:new lA({color:"#ffcc33"}),stroke:new hA({color:"#fff",width:2})})})],zIndex:10});let i=[14.21683569,27.060114248],r=2.661,s=!1;try{const t=localStorage.getItem("marco:map-view");if(t){const e=JSON.parse(t);e.center&&Array.isArray(e.center)&&2===e.center.length&&"number"==typeof e.zoom&&(i=e.center,r=e.zoom,s=!0)}}catch(w){console.warn("Failed to restore map view:",w)}const o=new XR({center:RT(i),zoom:r,projection:"EPSG:3857"});this.mapInstance=new KA({target:t,layers:[e,n],view:o,controls:wP({zoom:!0,rotate:!0,attribution:!0}),interactions:tM({dragPan:!1})}),function(t,e,n={}){let i,r;if(ok){if(!(t instanceof KA||t instanceof gM))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");r=t}else r="string"==typeof t||t instanceof HTMLElement?new KA({target:t}):t;{const t=e.startsWith("data:")?location.href:EN(e,n.accessToken);n=iq(t,n),i=new Promise(function(i,s){qN(e,n).then(function(e){(function(t,e,n,i){const r=[];let s=null;if(e instanceof KA){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=i.projection?CT(i.projection):s.getProjection();s=new XR(Object.assign(s.getProperties(),{maxResolution:zN[0]/PE[t.getUnits()],projection:i.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter(RT(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(zN[0]/PE[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:n,options:i});const o=t.layers;let a,l,c,u=[];for(let h=0,d=o.length;h';const l=document.createElement("div");l.className="selected-pin-shadow",this.selectedPinElement.appendChild(a),this.selectedPinElement.appendChild(l),this.selectedPinOverlay=new tF({element:this.selectedPinElement,positioning:"bottom-center",stopEvent:!1}),this.mapInstance.addOverlay(this.selectedPinOverlay),this.crosshairElement=document.createElement("div"),this.crosshairElement.className="map-crosshair",this.crosshairElement.innerHTML='\n \n \n \n \n ',t.appendChild(this.crosshairElement),this.locationOverlayElement=document.createElement("div"),this.locationOverlayElement.className="search-pulse blue",this.locationOverlay=new tF({element:this.locationOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.locationOverlay);const c=new PL({trackingOptions:{enableHighAccuracy:!0},projection:o.getProjection()}),u=new eF;u.setStyle(new dA({image:new aA({radius:6,fill:new lA({color:"#3399CC"}),stroke:new hA({color:"#fff",width:2})})}));const h=new yL({features:[u]}),d=new nL({source:h,zIndex:15});c.on("change:position",function(){const t=c.getPosition();u.setGeometry(t?new kR(t):null)});const p=document.createElement("div");p.className="ol-control ol-locate";const f=document.createElement("button");let g,m;f.innerHTML="⊙",f.title="Locate Me",p.appendChild(f);const y=()=>{g&&(clearTimeout(g),g=null);try{m&&(c.un("change:position",_),m=null)}catch{}this.locationOverlayElement&&this.locationOverlayElement.classList.remove("active")},_=()=>{const t=c.getPosition(),e=c.getAccuracyGeometry(),n=c.getAccuracy();if(console.debug("Geolocation change:",{coordinates:t,accuracy:n}),!t)return;const i=this.mapInstance.getSize(),r=this.mapInstance.getView();let s=null;if(this.locationOverlayElement){const e=r.getResolution(),i=2*(n||50)/kT(r.getProjection(),e,t);this.locationOverlayElement.style.width=`${i}px`,this.locationOverlayElement.style.height=`${i}px`,this.locationOverlay.setPosition(t)}if(n&&n<=20&&y(),e){const t=e.getExtent();s=3.162*r.getResolutionForExtent(t,i)}else n&&(s=6.325*n/Math.min(i[0],i[1])/kT(r.getProjection(),1,t));let o={center:t,duration:1e3};if(s){const t=r.getResolutionForZoom(17);o.resolution=Math.max(s,t)}else o.zoom=16;this.mapInstance.getView().animate(o)},v=()=>{console.debug("Getting current geolocation..."),y(),c.setTracking(!0);const t=c.getPosition();this.locationOverlayElement&&this.locationOverlayElement.classList.add("active"),t&&_(),m=c.on("change:position",_),g=setTimeout(()=>{y()},1e4)};f.addEventListener("click",v);const b=new yP({element:p});this.mapInstance.addLayer(d),this.mapInstance.addControl(b),s||"index"!==this.router.currentRouteName||v(),this.mapInstance.on("singleclick",this.handleMapClick),this.mapInstance.on("moveend",this.handleMapMove),this.mapInstance.on("pointermove",t=>{const e=this.mapInstance.getEventPixel(t.originalEvent),n=this.mapInstance.hasFeatureAtPixel(e,{hitTolerance:10});this.mapInstance.getTarget().style.cursor=n?"pointer":""}),this.storage.rs.on("ready",()=>{this.handleMapMove()})});updateInteractions=fC(()=>{if(!this.mapInstance)return;this.mapInstance.getInteractions().getArray().slice().forEach(t=>{t instanceof NP&&this.mapInstance.removeInteraction(t)});const t=!!this.settings.mapKinetic&&new xP(-.005,.05,100);this.settings.mapKinetic&&window.innerWidth<=768&&(t.minVelocity_=.25),this.mapInstance.addInteraction(new NP({kinetic:t}))});updateSelectedPin=fC(()=>{const t=this.mapUi.selectedPlace;if(this.selectedPinOverlay&&this.selectedPinElement)if(t&&t.lat&&t.lon){const e=RT([t.lon,t.lat]);this.selectedPinOverlay.setPosition(e),this.selectedPinElement.classList.remove("active"),this.selectedPinElement.offsetWidth,this.selectedPinElement.classList.add("active"),this.handlePinVisibility(e)}else this.selectedPinElement.classList.remove("active"),this.selectedPinOverlay.setPosition(void 0)});handlePinVisibility(t){if(!this.mapInstance)return;const e=this.mapInstance.getPixelFromCoordinate(t),n=this.mapInstance.getSize();!e||e[0]<0||e[0]>n[0]||e[1]<0||e[1]>n[1]?this.animateToSmartCenter(t):this.panIfObscured(t)}animateToSmartCenter(t){if(!this.mapInstance)return;const e=this.mapInstance.getSize(),n=this.mapInstance.getView(),i=n.getResolution();let r=t;if(e[0]<=768){const n=.25*e[1]*i;r=[t[0],t[1]-n]}n.animate({center:r,duration:1e3,easing:t=>t*(2-t)})}panIfObscured(t){if(!this.mapInstance)return;const e=this.mapInstance.getSize();if(e[0]>768)return;const n=this.mapInstance.getPixelFromCoordinate(t);if(!n)return;const i=e[1],r=i/2;if(n[1]>r){const t=.25*i,e=n[1]-t,r=this.mapInstance.getView(),s=r.getCenter(),o=e*r.getResolution(),a=[s[0],s[1]-o];r.animate({center:a,duration:500,easing:t=>t*(2-t)})}}updateBookmarks=fC(()=>{const t=this.storage.placesInView;this.loadBookmarks(t)});async loadBookmarks(t=[]){try{if(!this.bookmarkSource)return;t&&0!==t.length||(t=this.storage.placesInView),this.bookmarkSource.clear(),t&&Array.isArray(t)&&t.forEach(t=>{if(t.lat&&t.lon){const e=new eF({geometry:new kR(RT([t.lon,t.lat])),name:t.title,id:t.id,isBookmark:!0,originalPlace:t});this.bookmarkSource.addFeature(e)}})}catch(e){console.error("Failed to load bookmarks:",e)}}syncPulse=fC(()=>{this.searchOverlayElement&&(this.mapUi.isSearching?this.searchOverlayElement.classList.add("active"):this.searchOverlayElement.classList.remove("active"))});syncCreationMode=fC(()=>{if(this.crosshairElement&&this.mapInstance)if(this.mapUi.isCreating){this.crosshairElement.classList.add("visible");const t=this.mapUi.creationCoordinates;if(t&&t.lat&&t.lon){const e=RT([t.lon,t.lat]);this.animateToCrosshair(e)}}else this.crosshairElement.classList.remove("visible")});animateToCrosshair(t){if(!this.mapInstance||!this.crosshairElement)return;const e=this.mapInstance.getTargetElement().getBoundingClientRect(),n=this.crosshairElement.getBoundingClientRect(),i=n.left+n.width/2-e.left,r=n.top+n.height/2-e.top,s=this.mapInstance.getSize(),o=i-s[0]/2,a=r-s[1]/2,l=this.mapInstance.getView(),c=l.getResolution(),u=o*c,h=-a*c,d=t[0]-u,p=t[1]-h,f=l.getCenter();Math.sqrt(Math.pow(f[0]-d,2)+Math.pow(f[1]-p,2))>5*c&&l.animate({center:[d,p],duration:800,easing:t=>t*(2-t)})}handleMapMove=async()=>{if(!this.mapInstance)return;if(this.mapUi.isCreating){const t=this.mapInstance.getTargetElement().getBoundingClientRect(),e=this.crosshairElement.getBoundingClientRect(),n=e.left+e.width/2-t.left,i=e.top+e.height/2-t.top,r=PT(this.mapInstance.getCoordinateFromPixel([n,i])),s=parseFloat(r[1].toFixed(6)),o=parseFloat(r[0].toFixed(6));this.mapUi.updateCreationCoordinates(s,o),this.router.replaceWith("place.new",{queryParams:{lat:s,lon:o}})}const t=this.mapInstance.getSize(),e=this.mapInstance.getView().calculateExtent(t),[n,i]=PT([e[0],e[1]]),[r,s]=PT([e[2],e[3]]),o={minLat:i,minLon:n,maxLat:s,maxLon:r};await this.storage.loadPlacesInBounds(o),this.loadBookmarks(this.storage.placesInView);try{const t=this.mapInstance.getView(),e={center:PT(t.getCenter()),zoom:t.getZoom()};localStorage.setItem("marco:map-view",JSON.stringify(e))}catch(a){console.warn("Failed to save map view:",a)}};handleMapClick=async t=>{const e=this.mapInstance.getFeaturesAtPixel(t.pixel,{hitTolerance:10});let n=null,i=null;if(e&&e.length>0){console.debug(`Found ${e.length} features in map layer:`);for(const n of e)console.debug(n);const t=e.find(t=>t.get("isBookmark"));t&&(n=t.get("originalPlace"));const r=e[0].getProperties();r.name&&(i=r.name)}if(this.args.isSidebarOpen)return n?(console.debug("Clicked bookmark while sidebar open (switching):",n),void this.router.transitionTo("place",n)):void(this.args.onOutsideClick&&this.args.onOutsideClick());if(n)return console.debug("Clicked bookmark:",n),void this.router.transitionTo("place",n);if(this.mapInstance.getView().getZoom()<16)return;const r=PT(t.coordinate),[s,o]=r,a=i?30:50;if(this.searchOverlayElement){const e=this.mapInstance.getView(),n=2*a/kT(e.getProjection(),e.getResolution(),t.coordinate);this.searchOverlayElement.style.width=`${n}px`,this.searchOverlayElement.style.height=`${n}px`,this.searchOverlay.setPosition(t.coordinate)}this.mapUi.startSearch();const l={lat:o.toFixed(6),lon:s.toFixed(6)};i&&(l.q=i),this.router.transitionTo("search",{queryParams:l})};static{Zi(Qg({id:null,block:'[[[11,0],[16,0,[29,["map-container ",[52,[30,1],"sidebar-open"]]]],[4,[30,0,["setupMap"]],null,null],[4,[30,0,["updateInteractions"]],null,null],[4,[30,0,["updateBookmarks"]],null,null],[4,[30,0,["updateSelectedPin"]],null,null],[4,[30,0,["syncPulse"]],null,null],[4,[30,0,["syncCreationMode"]],null,null],[12],[13]],["@isSidebarOpen"],["if"]]',moduleName:"/home/basti/src/marco/app/components/map.gjs",isStrictMode:!0}),this)}}const pq={"arrow-left":'',activity:'',bookmark:'',clock:'',edit:'',globe:'',home:'',"log-in":'',"log-out":'',map:'',"map-pin":'',menu:'',navigation:'',phone:'',plus:'',server:'',settings:'',target:'',user:'',x:'',zap:''};class fq extends sC{get svg(){return pq[this.args.name]}get size(){return this.args.size||16}get color(){return this.args.color||"#898989"}get style(){return`width:${this.size}px;height:${this.size}px;color:${this.color}`}get title(){return this.args.title||""}static{Zi(Qg({id:null,block:'[[[41,[30,0,["svg"]],[[[1," "],[10,1],[14,0,"icon"],[15,5,[30,0,["style"]]],[15,"title",[30,0,["title"]]],[12],[1,"\\n "],[1,[28,[32,0],[[30,0,["svg"]]],null]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"/home/basti/src/marco/app/components/icon.gjs",scope:()=>[Fb],isStrictMode:!0}),this)}}class gq extends sC{connectRS(){this.args.onClose(),this.args.storage.connect()}static{Rx(this.prototype,"connectRS",[Mu])}disconnectRS(){this.args.storage.disconnect()}static{Rx(this.prototype,"disconnectRS",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"user-menu-popover"],[12],[1,"\\n "],[10,0],[14,0,"user-status"],[12],[1,"\\n"],[41,[30,1,["connected"]],[[[1," Connected as\\n "],[10,"strong"],[12],[1,[30,1,["userAddress"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n\\n "],[10,"ul"],[14,0,"account-list"],[12],[1,"\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["server",18]],null],[1,"\\n "],[10,1],[12],[1,"RemoteStorage"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,1,["connected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectRS"]]],null],[12],[1,"Disconnect"],[13],[1,"\\n"]],[]],[[[1," "],[11,"button"],[24,0,"btn-text text-primary"],[24,4,"button"],[4,[32,1],["click",[30,0,["connectRS"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item disabled"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["globe",18]],null],[1,"\\n "],[10,1],[12],[1,"OpenStreetMap"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item disabled"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["zap",18]],null],[1,"\\n "],[10,1],[12],[1,"Nostr"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@storage"],["if"]]',moduleName:"/home/basti/src/marco/app/components/user-menu.gjs",scope:()=>[fq,xv],isStrictMode:!0}),this)}}class mq extends sC{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"isUserMenuOpen",[Is],function(){return!1})}#Y=void Px(this,"isUserMenuOpen");toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}static{Rx(this.prototype,"toggleUserMenu",[Mu])}closeUserMenu(){this.isUserMenuOpen=!1}static{Rx(this.prototype,"closeUserMenu",[Mu])}static{Zi(Qg({id:null,block:'[[[10,"header"],[14,0,"app-header"],[12],[1,"\\n "],[10,0],[14,0,"header-left"],[12],[1,"\\n "],[11,"button"],[24,0,"menu-btn btn-press"],[24,"aria-label","Menu"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["menu",24,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"header-right"],[12],[1,"\\n "],[10,0],[14,0,"user-menu-container"],[12],[1,"\\n "],[11,"button"],[24,0,"user-btn btn-press"],[24,"aria-label","User Menu"],[24,4,"button"],[4,[32,0],["click",[30,0,["toggleUserMenu"]]],null],[12],[1,"\\n "],[10,0],[14,0,"user-avatar-placeholder"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["user",20,"white"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["isUserMenuOpen"]],[[[1," "],[8,[32,2],null,[["@storage","@onClose"],[[30,0,["storage"]],[30,0,["closeUserMenu"]]]],null],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,0],["click",[30,0,["closeUserMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleMenu"],["if"]]',moduleName:"/home/basti/src/marco/app/components/app-header.gjs",scope:()=>[xv,fq,gq],isStrictMode:!0}),this)}}function yq(t,e){return t===e}function _q(t){return"object"==typeof t&&t&&"isTruthy"in t&&"boolean"==typeof t.isTruthy?t.isTruthy:Yh(t)?0!==t.length:!!t}class vq extends sC{static{Tx(this.prototype,"settings",[Uf])}#F=void Px(this,"settings");updateApi(t){this.settings.updateOverpassApi(t.target.value)}static{Rx(this.prototype,"updateApi",[Mu])}toggleKinetic(t){this.settings.updateMapKinetic("true"===t.target.value)}static{Rx(this.prototype,"toggleKinetic",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar settings-pane"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Marco"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"section"],[14,0,"settings-section"],[12],[1,"\\n "],[10,"h3"],[12],[1,"Settings"],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","map-kinetic"],[12],[1,"Map Inertia (Kinetic Panning)"],[13],[1,"\\n "],[11,"select"],[24,1,"map-kinetic"],[24,0,"form-control"],[4,[32,0],["change",[30,0,["toggleKinetic"]]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","mapKinetic"]],"selected"]],[12],[1,"\\n On\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","mapKinetic"]]],"selected"]],[12],[1,"\\n Off\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","overpass-api"],[12],[1,"Overpass API Provider"],[13],[1,"\\n "],[11,"select"],[24,1,"overpass-api"],[24,0,"form-control"],[4,[32,0],["change",[30,0,["updateApi"]]],null],[12],[1,"\\n"],[42,[28,[31,3],[[28,[31,3],[[30,0,["settings","overpassApis"]]],null]],null],null,[[[1," "],[10,"option"],[15,2,[30,2,["url"]]],[15,"selected",[52,[28,[32,2],[[30,2,["url"]],[30,0,["settings","overpassApi"]]],null],"selected"]],[12],[1,"\\n "],[1,[30,2,["name"]]],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"section"],[14,0,"settings-section"],[12],[1,"\\n "],[10,"h3"],[12],[1,"About"],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Marco"],[13],[1," (as in "],[10,3],[14,6,"https://en.wikipedia.org/wiki/Marco_Polo"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"Marco Polo"],[13],[1,") is an unhosted maps application\\n that respects your privacy and choices.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n Connect your own "],[10,3],[14,6,"https://remotestorage.io/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"remote storage"],[13],[1," to sync place bookmarks across\\n apps and devices.\\n "],[13],[1,"\\n "],[10,"ul"],[14,0,"link-list"],[12],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[10,3],[14,6,"https://gitea.kosmos.org/raucao/marco"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Source Code\\n "],[13],[1," ("],[10,3],[14,6,"https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"AGPL"],[13],[1,")\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[10,3],[14,6,"https://openstreetmap.org/copyright"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Map Data © OpenStreetMap\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onClose","api"],["if","unless","each","-track-array"]]',moduleName:"/home/basti/src/marco/app/components/settings-pane.gjs",scope:()=>[xv,fq,yq],isStrictMode:!0}),this)}}class bq extends Tb{compute(t){for(let e=0,n=t.length;e[uC,mq,xv,dq,bq,vq],isStrictMode:!0}),this)}}const xq=Object.freeze(Object.defineProperty({__proto__:null,default:wq},Symbol.toStringTag,{value:"Module"}));class Sq extends Sp{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage")}const Cq=Object.freeze(Object.defineProperty({__proto__:null,default:Sq},Symbol.toStringTag,{value:"Module"})),kq=l_;class Eq extends sC{static{Tx(this.prototype,"title",[Is],function(){return""})}#J=void Px(this,"title");static{Tx(this.prototype,"description",[Is],function(){return""})}#Q=void Px(this,"description");constructor(){super(...arguments),this.title=this.args.place?.title||"",this.description=this.args.place?.description||""}get shouldAutofocus(){return"undefined"!=typeof window&&window.innerWidth>768}handleSubmit(t){t.preventDefault(),this.args.onSave&&this.args.onSave({title:this.title,description:this.description})}static{Rx(this.prototype,"handleSubmit",[Mu])}updateTitle(t){this.title=t.target.value}static{Rx(this.prototype,"updateTitle",[Mu])}updateDescription(t){this.description=t.target.value}static{Rx(this.prototype,"updateDescription",[Mu])}static{Zi(Qg({id:null,block:'[[[11,"form"],[24,0,"edit-form"],[4,[32,0],["submit",[30,0,["handleSubmit"]]],null],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-title"],[12],[1,"Title"],[13],[1,"\\n "],[11,"input"],[24,1,"edit-title"],[16,2,[30,0,["title"]]],[24,0,"form-control"],[24,"placeholder","Name of the place"],[16,"autofocus",[30,0,["shouldAutofocus"]]],[24,4,"text"],[4,[32,0],["input",[30,0,["updateTitle"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-desc"],[12],[1,"Description"],[13],[1,"\\n "],[11,"textarea"],[24,1,"edit-desc"],[16,2,[30,0,["description"]]],[24,0,"form-control"],[24,"rows","3"],[24,"placeholder","Add some details..."],[4,[32,0],["input",[30,0,["updateDescription"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[10,"button"],[14,0,"btn btn-blue"],[14,4,"submit"],[12],[1,"Save"],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"Cancel"],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onCancel"],[]]',moduleName:"/home/basti/src/marco/app/components/place-edit-form.gjs",scope:()=>[xv],isStrictMode:!0}),this)}}class Tq extends sC{static{Tx(this.prototype,"isEditing",[Is],function(){return!1})}#tt=void Px(this,"isEditing");get place(){return this.args.place||{}}get tags(){return this.place.osmTags||{}}get name(){return this.place.title||Ox(this.tags)||"Unnamed Place"}startEditing(){this.place.createdAt&&(this.isEditing=!0)}static{Rx(this.prototype,"startEditing",[Mu])}cancelEditing(){this.isEditing=!1}static{Rx(this.prototype,"cancelEditing",[Mu])}async saveChanges(t){this.args.onSave&&await this.args.onSave({...this.place,...t}),this.isEditing=!1}static{Rx(this.prototype,"saveChanges",[Mu])}get type(){return LS(this.tags.amenity||this.tags.shop||this.tags.tourism||this.tags.leisure||this.tags.historic||"Point of Interest")}get address(){const t=this.tags,e=[];if(t["addr:street"]){let n=t["addr:street"];t["addr:housenumber"]&&(n+=` ${t["addr:housenumber"]}`),e.push(n)}if(t["addr:city"]){let n=t["addr:city"];t["addr:postcode"]&&(n=`${t["addr:postcode"]} ${n}`),e.push(n)}return 0===e.length?null:e.join(", ")}get phone(){return this.tags.phone||this.tags["contact:phone"]}get website(){return this.place.url||this.tags.website||this.tags["contact:website"]}get websiteDomain(){return new URL(this.website).hostname}get openingHours(){return this.tags.opening_hours}get cuisine(){return this.tags.cuisine?this.tags.cuisine.split(";").map(t=>LS(t)).join(", "):null}get wikipedia(){return this.tags.wikipedia}get geoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`geo:${t},${e}?q=${t},${e}(${encodeURIComponent(this.name)})`:"#"}get visibleGeoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`${t}, ${e}`:""}get osmUrl(){const t=this.place.osmId;return t?`https://www.openstreetmap.org/${this.place.osmType||"node"}/${t}`:null}get gmapsUrl(){return this.place.gmapsId||this.place.osmId?`https://www.google.com/maps/search/?api=1&query=${this.name}&query=${this.place.lat},${this.place.lon}`:null}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"place-details"],[12],[1,"\\n"],[41,[30,0,["isEditing"]],[[[1," "],[8,[32,0],null,[["@place","@onSave","@onCancel"],[[30,0,["place"]],[30,0,["saveChanges"]],[30,0,["cancelEditing"]]]],null],[1,"\\n"]],[]],[[[1," "],[10,"h3"],[12],[1,[30,0,["name"]]],[13],[1,"\\n "],[10,2],[14,0,"place-type"],[12],[1,"\\n "],[1,[30,0,["type"]]],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["place","description"]],[[[1," "],[10,2],[14,0,"place-description"],[12],[1,"\\n "],[1,[30,0,["place","description"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[]]],[1,"\\n "],[10,0],[14,0,"actions"],[12],[1,"\\n "],[11,"button"],[16,0,[52,[30,0,["place","createdAt"]],"btn btn-secondary","btn btn-outline"]],[24,4,"button"],[4,[32,1],["click",[28,[32,2],[[30,1],[30,0,["place"]]],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["bookmark",[52,[30,0,["place","createdAt"]],"currentColor","#007bff"]]],null],[1,"\\n "],[1,[52,[30,0,["place","createdAt"]],"Saved","Save"]],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["place","createdAt"]],[[[1," "],[11,"button"],[24,0,"btn btn-outline"],[24,"title","Edit"],[24,4,"button"],[4,[32,1],["click",[30,0,["startEditing"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["edit","#007bff"]],null],[1,"\\n Edit\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["cuisine"]],[[[1," "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Cuisine:"],[13],[1,"\\n "],[1,[30,0,["cuisine"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["openingHours"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["clock","Opening hours"]],null],[1,"\\n "],[10,1],[12],[1,[30,0,["openingHours"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["phone"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["phone","Phone"]],null],[1,"\\n "],[10,1],[12],[10,3],[15,6,[29,["tel:",[30,0,["phone"]]]]],[12],[1,[30,0,["phone"]]],[13],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["website"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["globe","Website"]],null],[1,"\\n "],[10,1],[12],[10,3],[15,6,[30,0,["website"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,[30,0,["websiteDomain"]]],[13],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["wikipedia"]],[[[1," "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Wikipedia:"],[13],[1,"\\n "],[10,3],[15,6,[29,["https://wikipedia.org/wiki/",[30,0,["wikipedia"]]]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"Article"],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["address"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["home","Address"]],null],[1,"\\n "],[10,1],[12],[1,[30,0,["address"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["map-pin","Geo link"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["geoLink"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["visibleGeoLink"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["osmUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["osmUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n OpenStreetMap\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["gmapsUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["gmapsUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n Google Maps\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleSave"],["if"]]',moduleName:"/home/basti/src/marco/app/components/place-details.gjs",scope:()=>[Eq,xv,kq,fq],isStrictMode:!0}),this)}}const Rq=Ob(function([t]){return LS(t)});class Pq extends sC{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");createNewPlace(){const t=this.router.currentRoute.queryParams,e=t.lat,n=t.lon;e&&n?this.router.transitionTo("place.new",{queryParams:{lat:e,lon:n}}):this.router.transitionTo("place.new",{queryParams:{lat:0,lon:0}})}static{Rx(this.prototype,"createNewPlace",[Mu])}selectPlace(t){this.args.onSelect&&this.args.onSelect(t)}static{Rx(this.prototype,"selectPlace",[Mu])}clearSelection(){this.args.onSelect&&this.args.onSelect(null)}static{Rx(this.prototype,"clearSelection",[Mu])}async toggleSave(t){if(t)if(t.createdAt){if(confirm(`Delete "${t.title}"?`))try{if(await this.storage.removePlace(t),console.debug("Place deleted:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate){const e={...t,id:void 0,geohash:void 0,createdAt:void 0};this.args.onUpdate(e)}this.args.onSelect&&this.args.onSelect(null),this.args.onClose&&this.args.onClose()}catch(e){console.error("Failed to delete:",e),alert("Failed to delete: "+e.message)}}else{const e={title:Ox(t.osmTags,"Untitled Place"),lat:t.lat,lon:t.lon,tags:[],url:t.osmTags.website,osmId:String(t.osmId||t.id),osmType:t.osmType,osmTags:t.osmTags};try{const t=await this.storage.storePlace(e);console.debug("Place saved:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(t),this.args.onSelect&&this.args.onSelect(t)}catch(zj){console.error("Failed to save place:",zj),alert("Failed to save place: "+zj.message)}}}static{Rx(this.prototype,"toggleSave",[Mu])}async updateBookmark(t){try{const e=await this.storage.updatePlace(t);console.debug("Place updated:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(e)}catch(e){console.error("Failed to update place:",e),alert("Failed to update place: "+e.message)}}static{Rx(this.prototype,"updateBookmark",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n"],[41,[30,1],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["clearSelection"]]],null],[12],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],[[[1," "],[10,"h2"],[12],[8,[32,1],null,[["@name","@size","@color"],["target",20,"#ea4335"]],null],[1," Nearby"],[13],[1,"\\n"]],[]]],[1," "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],null],[12],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n"],[41,[30,1],[[[1," "],[8,[32,2],null,[["@place","@onToggleSave","@onSave"],[[30,1],[30,0,["toggleSave"]],[30,0,["updateBookmark"]]]],null],[1,"\\n"]],[]],[[[41,[30,3],[[[1," "],[10,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,3]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"place-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,3],[[30,0,["selectPlace"]],[30,4]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"place-name"],[12],[1,[28,[32,4],[[30,4,["title"]],[30,4,["osmTags","name"]],[30,4,["osmTags","name:en"]],"Unnamed Place"],null]],[13],[1,"\\n "],[10,0],[14,0,"place-type"],[12],[1,[28,[32,5],[[28,[32,4],[[30,4,["osmTags","amenity"]],[30,4,["osmTags","shop"]],[30,4,["osmTags","tourism"]],[30,4,["osmTags","leisure"]],[30,4,["osmTags","historic"]],"Point of Interest"],null]],null]],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[4]],null],[1," "],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No places found nearby."],[13],[1,"\\n"]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline create-place"],[24,4,"button"],[4,[32,0],["click",[30,0,["createNewPlace"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["plus",18,"#007bff"]],null],[1,"\\n Create new place\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n"],[13]],["@selectedPlace","@onClose","@places","place"],["if","each","-track-array"]]',moduleName:"/home/basti/src/marco/app/components/places-sidebar.gjs",scope:()=>[xv,fq,Tq,kq,bq,Rq],isStrictMode:!0}),this)}}class Mq extends sC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"localPlace",[Is],function(){return null})}#et=void Px(this,"localPlace");constructor(){super(...arguments),this.localPlace=this.args.model}get place(){const t=this.args.model,e=t.osmId||t.id;return this.storage.findPlaceById(e)||(!this.localPlace||this.localPlace.osmId!==e&&this.localPlace.id!==e?t.createdAt?{...t,id:void 0,createdAt:void 0,geohash:void 0}:t:this.localPlace)}handleUpdate(t){console.debug("Updating local place state:",t),this.localPlace=t,this.storage.notifyChange()}static{Rx(this.prototype,"handleUpdate",[Mu])}refreshMap(){this.storage.notifyChange()}static{Rx(this.prototype,"refreshMap",[Mu])}navigateBack(t){null===t?this.mapUi.returnToSearch?window.history.back():this.router.transitionTo("index"):this.router.transitionTo("place",t)}static{Rx(this.prototype,"navigateBack",[Mu])}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}static{Zi(Qg({id:null,block:'[[[8,[32,0],null,[["@selectedPlace","@onClose","@onSelect","@onBookmarkChange","@onUpdate"],[[30,0,["place"]],[30,0,["close"]],[30,0,["navigateBack"]],[30,0,["refreshMap"]],[30,0,["handleUpdate"]]]],null]],[],[]]',moduleName:"/home/basti/src/marco/app/templates/place.gjs",scope:()=>[Pq],isStrictMode:!0}),this)}}const Iq=Object.freeze(Object.defineProperty({__proto__:null,default:Mq},Symbol.toStringTag,{value:"Module"}));class Oq extends Sp{static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");async model(t){const e=t.place_id;if(e.startsWith("osm:node:")||e.startsWith("osm:way:")){const[,t,n]=e.split(":");return console.debug(`Fetching explicit OSM ${t}:`,n),this.loadOsmPlace(n,t)}await this.waitForSync();let n=this.storage.findPlaceById(e);return n?(console.debug("Found in bookmarks:",n.title),n):(console.warn("Not in bookmarks:",e),null)}async waitForSync(){if(this.storage.initialSyncDone)return;console.debug("Waiting for initial storage sync...");const t=Date.now();for(;!this.storage.initialSyncDone;){if(Date.now()-t>5e3){console.warn("Timed out waiting for initial sync");break}await new Promise(t=>setTimeout(t,100))}}afterModel(t){t&&this.mapUi.selectPlace(t),this.mapUi.stopSearch()}deactivate(){this.mapUi.clearSelection(),this.mapUi.returnToSearch=!1}async loadOsmPlace(t,e=null){try{const n=await this.osm.getPoiById(t,e);if(n)return console.debug("Found OSM POI:",n),n}catch(n){console.error("Failed to fetch POI",n)}return null}serialize(t){return t.id?{place_id:t.id}:t.osmId&&t.osmType?{place_id:`osm:${t.osmType}:${t.osmId}`}:{place_id:t.osmId}}}const Aq=Object.freeze(Object.defineProperty({__proto__:null,default:Oq},Symbol.toStringTag,{value:"Module"}));class Fq extends sC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");get initialPlace(){return{title:"",description:""}}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}async savePlace(t){try{const e=this.mapUi.creationCoordinates||{lat:this.args.model.lat,lon:this.args.model.lon},n=parseFloat(e.lat.toFixed(6)),i=parseFloat(e.lon.toFixed(6)),r={title:t.title||"Untitled Place",description:t.description,lat:n,lon:i,tags:[],osmTags:{}},s=await this.storage.storePlace(r);console.debug("Created private place:",s.title),this.router.replaceWith("place",s)}catch(e){console.error("Failed to create place:",e),alert("Failed to create place: "+e.message)}}static{Rx(this.prototype,"savePlace",[Mu])}static{Zi(Qg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[8,[32,0],null,[["@name","@size","@color"],["plus-circle",20,"#ea4335"]],null],[1,"\\n New Place"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,1],["click",[30,0,["close"]]],null],[12],[8,[32,0],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,2],[14,0,"helper-text"],[12],[1,"\\n Drag the map to position the crosshair.\\n "],[13],[1,"\\n\\n "],[8,[32,2],null,[["@place","@onSave","@onCancel"],[[30,0,["initialPlace"]],[30,0,["savePlace"]],[30,0,["close"]]]],null],[1,"\\n "],[13],[1,"\\n"],[13]],[],[]]',moduleName:"/home/basti/src/marco/app/templates/place/new.gjs",scope:()=>[fq,xv,Eq],isStrictMode:!0}),this)}}const Lq=Object.freeze(Object.defineProperty({__proto__:null,default:Fq},Symbol.toStringTag,{value:"Module"}));class zq extends Sp{static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0}};model(t){return{lat:parseFloat(t.lat),lon:parseFloat(t.lon)}}setupController(t,e){super.setupController(t,e),e.lat&&e.lon&&this.mapUi.updateCreationCoordinates(e.lat,e.lon),this.mapUi.startCreating()}deactivate(){this.mapUi.stopCreating()}}const Dq=Object.freeze(Object.defineProperty({__proto__:null,default:zq},Symbol.toStringTag,{value:"Module"}));class jq extends sC{static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");selectPlace(t){t&&(this.mapUi.returnToSearch=!0,this.router.transitionTo("place",t))}static{Rx(this.prototype,"selectPlace",[Mu])}close(){this.router.transitionTo("index")}static{Rx(this.prototype,"close",[Mu])}static{Zi(Qg({id:null,block:'[[[8,[32,0],null,[["@places","@onSelect","@onClose"],[[30,1],[30,0,["selectPlace"]],[30,0,["close"]]]],null]],["@model"],[]]',moduleName:"/home/basti/src/marco/app/templates/search.gjs",scope:()=>[Pq],isStrictMode:!0}),this)}}const Nq=Object.freeze(Object.defineProperty({__proto__:null,default:jq},Symbol.toStringTag,{value:"Module"}));class Uq extends Sp{static{Tx(this.prototype,"osm",[Uf])}#W=void Px(this,"osm");static{Tx(this.prototype,"mapUi",[Uf])}#K=void Px(this,"mapUi");static{Tx(this.prototype,"storage",[Uf])}#H=void Px(this,"storage");static{Tx(this.prototype,"router",[Uf])}#X=void Px(this,"router");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0},q:{refreshModel:!0}};async model(t){if(!t.lat||!t.lon)return[];const e=parseFloat(t.lat),n=parseFloat(t.lon),i=t.q?30:50;let r=await this.osm.getNearbyPois(e,n,i);return this.storage.savedPlaces.filter(t=>DS(e,n,t.lat,t.lon)<=i).forEach(t=>{r.find(e=>t.osmId&&e.osmId===t.osmId||e.id&&e.id===t.id)||r.push(t)}),r=r.map(t=>({...t,_distance:DS(e,n,t.lat,t.lon)})).sort((t,e)=>t._distance-e._distance),r=r.map(t=>this.storage.findPlaceById(t.osmId)||t),r}afterModel(t,e){const{q:n}=e.to.queryParams;if(n&&t.length>0){let e=null;if(e=t.find(t=>t.osmTags&&(t.osmTags.name===n||t.osmTags["name:en"]===n)),!e){const n=t[0];n._distance<=10&&(e=n)}if(e)return void this.router.replaceWith("place",e)}this.mapUi.stopSearch()}setupController(t,e){super.setupController(t,e),this.mapUi.stopSearch()}error(){return this.mapUi.stopSearch(),!0}static{Rx(this.prototype,"error",[Mu])}}const Bq=Object.freeze(Object.defineProperty({__proto__:null,default:Uq},Symbol.toStringTag,{value:"Module"})),qq=Object.assign({},hx,{"marco/app":t,"marco/config/environment":mx,"marco/deprecation-workflow":_x,"marco/router":kx,"marco/services/map-ui":Ix,"marco/services/osm":Lx,"marco/services/settings":Dx,"marco/services/storage":FS,"marco/utils/format-text":zS,"marco/utils/geo":jS,"marco/utils/geohash-coverage":nS,"marco/utils/osm":Ax,"marco/services/page-title":ZS,"marco/templates/application":xq,"marco/routes/application":Cq,"marco/templates/place":Iq,"marco/routes/place":Aq,"marco/templates/place/new":Lq,"marco/routes/place/new":Dq,"marco/templates/search":Nq,"marco/routes/search":Bq},{});class Vq{constructor(t,e,n){this.limit=t,this.func=e,this.store=n,this.size=0,this.misses=0,this.hits=0,this.store=n||new Map}get(t){let e=this.store.get(t);return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,e=this.set(t,this.func(t)),e)}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}}const $q=/[ _]/g,Gq=new Vq(1e3,t=>{return(e=t,tV.get(e)).replace($q,"-");var e}),Wq=/^(\-|_)+(.)?/,Hq=/(.)(\-|\_|\.|\s)+(.)?/g,Kq=/(^|\/|\.)([a-z])/g,Xq=new Vq(1e3,t=>{const e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,i)=>e+(i?i.toUpperCase():""),i=t.split("/");for(let r=0;rt.toUpperCase())}),Yq=/([a-z\d])([A-Z]+)/g,Zq=/\-|\s+/g,Jq=new Vq(1e3,t=>t.replace(Yq,"$1_$2").replace(Zq,"_").toLowerCase()),Qq=/([a-z\d])([A-Z])/g,tV=new Vq(1e3,t=>t.replace(Qq,"$1_$2").toLowerCase());class eV{constructor(t){this._entries=t||globalThis.requirejs.entries}moduleNames(){return Object.keys(this._entries)}has(t){return t in this._entries}get(...t){return globalThis.require(...t)}}class nV{static moduleBasedResolver=!0;moduleBasedResolver=!0;_deprecatedPodModulePrefix=!1;_normalizeCache=Object.create(null);static create(t){return new this(t)}moduleNameLookupPatterns=[this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName,this.nestedColocationComponentModuleName];static withModules(t){return class extends(this){static explicitModules=t}}constructor(t){if(Object.assign(this,t),!this._moduleRegistry){let t=this.constructor.explicitModules;t?this._moduleRegistry={moduleNames:()=>Object.keys(t),has:e=>Boolean(t[e]),get:e=>t[e],addModules(e){t=Object.assign({},t,e)}}:(void 0===globalThis.requirejs.entries&&(globalThis.requirejs.entries=globalThis.requirejs._eak_seen),this._moduleRegistry=new eV)}this.pluralizedTypes=this.pluralizedTypes||Object.create(null),this.pluralizedTypes.config||(this.pluralizedTypes.config="config")}makeToString(t,e){return this.namespace.modulePrefix+"@"+e+":"}shouldWrapInClassFactory(){return!1}parseName(t){if(!0===t.parsedName)return t;let e,n,i,r=t.split("@");if(3===r.length){if(0===r[0].length){e=`@${r[1]}`;let t=r[2].split(":");n=t[0],i=t[1]}else e=`@${r[1]}`,n=r[0].slice(0,-1),i=r[2];"template:components"===n&&(i=`components/${i}`,n="template")}else if(2===r.length){let t=r[0].split(":");if(2===t.length)0===t[1].length?(n=t[0],i=`@${r[1]}`):(e=t[1],n=t[0],i=r[1]);else{let t=r[1].split(":");e=r[0],n=t[0],i=t[1]}"template"===n&&0===e.lastIndexOf("components/",0)&&(i=`components/${i}`,e=e.slice(11))}else r=t.split(":"),n=r[0],i=r[1];let s=i,o=this.namespace;return{parsedName:!0,fullName:t,prefix:e||this.prefix({type:n}),type:n,fullNameWithoutType:s,name:i,root:o,resolveMethodName:"resolve"+(a=n,Xq.get(a))};var a}resolveOther(t){iV("`modulePrefix` must be defined",this.namespace.modulePrefix);let e=this.findModuleName(t);if(e){let i=this._extractDefaultExport(e,t);if(void 0===i)throw new Error(` Expected to find: '${t.fullName}' within '${e}' but got 'undefined'. Did you forget to 'export default' within '${e}'?`);return this.shouldWrapInClassFactory(i,t)&&(n=i,i={create:t=>"function"==typeof n.extend?n.extend(t):n}),i}var n}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this._normalize(t))}resolve(t){if("resolver:current"===t)return{create:()=>this};let e,n=this.parseName(t),i=n.resolveMethodName;return"function"==typeof this[i]&&(e=this[i](n)),null==e&&(e=this.resolveOther(n)),e}addModules(t){if(!this._moduleRegistry.addModules)throw new Error("addModules is only supported when your Resolver has been configured to use static modules via Resolver.withModules()");this._moduleRegistry.addModules(t)}_normalize(t){let e=t.split(":");if(e.length>1){let t=e[0];return"component"===t||"helper"===t||"modifier"===t||"template"===t&&0===e[1].indexOf("components/")?t+":"+e[1].replace(/_/g,"-"):t+":"+(n=e[1].replace(/\./g,"/"),Gq.get(n))}return t;var n}pluralize(t){return this.pluralizedTypes[t]||(this.pluralizedTypes[t]=t+"s")}podBasedLookupWithPrefix(t,e){let n=e.fullNameWithoutType;return"template"===e.type&&(n=n.replace(/^components\//,"")),t+"/"+n+"/"+e.type}podBasedModuleName(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(e,t)}podBasedComponentsInSubdir(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;if(e+="/components","component"===t.type||/^components/.test(t.fullNameWithoutType))return this.podBasedLookupWithPrefix(e,t)}resolveEngine(t){let e=t.fullNameWithoutType+"/engine";if(this._moduleRegistry.has(e))return this._extractDefaultExport(e)}resolveRouteMap(t){let e=t.fullNameWithoutType,n=e+"/routes";if(this._moduleRegistry.has(n)){let t=this._extractDefaultExport(n);return iV(`The route map for ${e} should be wrapped by 'buildRoutes' before exporting.`,t.isRouteMap),t}}resolveTemplate(t){return this.resolveOther(t)}mainModuleName(t){if("main"===t.fullNameWithoutType)return t.prefix+"/"+t.type}defaultModuleName(t){return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType}nestedColocationComponentModuleName(t){if("component"===t.type)return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType+"/index"}prefix(t){let e=this.namespace.modulePrefix;return this.namespace[t.type+"Prefix"]&&(e=this.namespace[t.type+"Prefix"]),e}findModuleName(t){let e,n=this.moduleNameLookupPatterns;for(let i=0,r=n.length;ii.length+r.length)return t+":"+e.slice(s+i.length,o);let a=n+"/"+this.pluralize(t)+"/";return 0===e.indexOf(a)&&e.length>a.length?t+":"+e.slice(a.length):void 0}_extractDefaultExport(t){let e=this._moduleRegistry.get(t,null,null,!0);return e&&e.default&&(e=e.default),e}}function iV(t,e){if(!e)throw new Error(t)}const rV={};function sV(t){!function(t){globalThis.emberInspectorApps||(globalThis.emberInspectorApps=[]),globalThis.emberInspectorApps.push({app:t,name:`app-${globalThis.emberInspectorApps.length}`,loadCompatInspector:()=>function(t,e){let n=Promise.resolve();if(e&&e.length>0){document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),r=t?.nonce||t?.getAttribute("nonce");i=e.map(t=>{if((t=function(t){return"/"+t}(t))in rV)return;rV[t]=!0;const e=t.endsWith(".css"),n=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${n}`))return;const i=document.createElement("link");return i.rel=e?"stylesheet":"modulepreload",e||(i.as="script"),i.crossOrigin="",i.href=t,r&&i.setAttribute("nonce",r),document.head.appendChild(i),e?new Promise((e,n)=>{i.addEventListener("load",e),i.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${t}`)))}):void 0}),n=Promise.all(i.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))}var i;function r(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return n.then(t=>{for(const e of t||[])"rejected"===e.status&&r(e.reason);return import("./modules-4-12-BU9FhOG9.js").catch(r)})}(0,[])}),globalThis.dispatchEvent&&globalThis.dispatchEvent(new Event("Ember"))}(t)}class oV extends cx{modulePrefix=gx.modulePrefix;podModulePrefix=gx.podModulePrefix;Resolver=nV.withModules(qq);inspector=sV(this)}oV.create(gx.APP);export{Sr as $,Gr as A,as as B,Cr as C,Ps as D,Lr as E,po as F,ho as G,ts as H,Fs as I,Js as J,Br as K,Ts as L,xs as M,ao as N,Ms as O,is as P,Or as Q,gs as R,$r as S,As as T,$e as U,xr as V,mo as W,Rs as X,Rr as Y,mr as Z,ks as _,Ss as a,St as a$,ss as a0,dr as a1,qr as a2,go as a3,fo as a4,Zs as a5,Nr as a6,uo as a7,Hr as a8,Ws as a9,ne as aA,Qt as aB,Jt as aC,ae as aD,oe as aE,se as aF,Xl as aG,Kl as aH,Hl as aI,tc as aJ,hu as aK,Gl as aL,nc as aM,Jl as aN,Yl as aO,du as aP,sr as aQ,Q as aR,at as aS,Ww as aT,st as aU,al as aV,Ct as aW,tt as aX,nt as aY,no as aZ,W as a_,Ks as aa,Jr as ab,Ur as ac,Ar as ad,yo as ae,Qs as af,_o as ag,gr as ah,fr as ai,Is as aj,Ds as ak,Bv as al,Qv as am,Ni as an,Cb as ao,Ji as ap,hS as aq,Zi as ar,et as as,td as at,g as au,d as av,m as aw,p as ax,u as ay,f as az,us as b,wx as b$,H as b0,er as b1,_t as b2,dt as b3,ft as b4,eo as b5,pt as b6,nr as b7,wt as b8,vt as b9,rc as bA,Tc as bB,Ic as bC,Ac as bD,Yc as bE,au as bF,ou as bG,oc as bH,uu as bI,Uc as bJ,Pc as bK,Hc as bL,zc as bM,jc as bN,qc as bO,cu as bP,lu as bQ,Fc as bR,$c as bS,Vc as bT,Nc as bU,ux as bV,Kw as bW,rd as bX,vS as bY,cd as bZ,G as b_,kt as ba,bt as bb,Rt as bc,X as bd,mt as be,Ih as bf,Qw as bg,Mh as bh,Qu as bi,Sv as bj,vh as bk,Hu as bl,Vu as bm,$u as bn,Fu as bo,Wu as bp,Nu as bq,Lu as br,Zu as bs,Ku as bt,Yu as bu,Uu as bv,zu as bw,Au as bx,Bu as by,qu as bz,qe as c,Ou as c0,ec as c1,ph as c2,Cu as c3,eh as c4,Eu as c5,CS as c6,wS as c7,ka as c8,qf as c9,ol as ca,ar as cb,oC as cc,Qi as cd,ii as ce,wv as cf,En as cg,cn as ch,lo as d,ws as e,Cs as f,Ve as g,zs as h,Kr as i,Ys as j,jr as k,co as l,Wr as m,js as n,$s as o,Vs as p,fs as q,os as r,Ls as s,ls as t,ps as u,ys as v,ms as w,_s as x,Ir as y,Mr as z}; diff --git a/release/assets/modules-4-12-DP6ACHNt.js b/release/assets/modules-4-12-BU9FhOG9.js similarity index 98% rename from release/assets/modules-4-12-DP6ACHNt.js rename to release/assets/modules-4-12-BU9FhOG9.js index 42fd70c..8021cd2 100644 --- a/release/assets/modules-4-12-DP6ACHNt.js +++ b/release/assets/modules-4-12-BU9FhOG9.js @@ -1 +1 @@ -import{c as e,g as a,a as s,s as t,A as r,C as o,b as n,D as i,L as l,N as b,d as c,P as p,e as d,S as m,T as u,_ as g,f as y,h as _,i as O,j as S,k as f,l as C,m as P,n as h,o as v,p as j,q as E,r as M,t as D,u as N,v as V,w as A,x as w,y as T,z as I,B as x,E as R,F as k,G as F,H as L,I as z,J as G,K as U,M as B,O as W,Q as Y,R as H,U as J,V as K,W as X,X as q,Y as Q,Z,$,a0 as ee,a1 as ae,a2 as se,a3 as te,a4 as re,a5 as oe,a6 as ne,a7 as ie,a8 as le,a9 as be,aa as pe,ab as de,ac as me,ad as ue,ae as ge,af as ye,ag as _e,ah as Oe,ai as Se,aj as fe,ak as Ce,al as Pe,am as he,an as ve,ao as je,ap as Ee,aq as Me,ar as De,as as Ne,at as Ve,au as Ae,av as we,aw as Te,ax as Ie,ay as xe,az as Re,aA as ke,aB as Fe,aC as Le,aD as ze,aE as Ge,aF as Ue,aG as Be,aH as We,aI as Ye,aJ as He,aK as Je,aL as Ke,aM as Xe,aN as qe,aO as Qe,aP as Ze,aQ as $e,aR as ea,aS as aa,aT as sa,aU as ta,aV as ra,aW as oa,aX as na,aY as ia,aZ as la,a_ as ba,a$ as pa,b0 as da,b1 as ma,b2 as ua,b3 as ga,b4 as ya,b5 as _a,b6 as Oa,b7 as Sa,b8 as fa,b9 as Ca,ba as Pa,bb as ha,bc as va,bd as ja,be as Ea,bf as Ma,bg as Da,bh as Na,bi as Va,bj as Aa,bk as wa,bl as Ta,bm as Ia,bn as xa,bo as Ra,bp as ka,bq as Fa,br as La,bs as za,bt as Ga,bu as Ua,bv as Ba,bw as Wa,bx as Ya,by as Ha,bz as Ja,bA as Ka,bB as Xa,bC as qa,bD as Qa,bE as Za,bF as $a,bG as es,bH as as,bI as ss,bJ as ts,bK as rs,bL as os,bM as ns,bN as is,bO as ls,bP as bs,bQ as cs,bR as ps,bS as ds,bT as ms,bU as us}from"./main-DD9l9xzQ.js";export{bV as Application,bW as ApplicationNamespace,bX as Array,bY as ArrayProxy,bZ as Controller,b_ as Debug,b$ as EmberDestroyable,c0 as EmberObject,c1 as EnumerableMutable,cc as GlimmerComponent,cd as GlimmerManager,ce as GlimmerReference,cf as GlimmerRuntime,cg as GlimmerUtil,ch as GlimmerValidator,c2 as Instrumentation,c0 as Object,c3 as ObjectCore,c4 as ObjectEvented,c5 as ObjectObservable,c6 as ObjectPromiseProxyMixin,c7 as ObjectProxy,ca as Owner,c8 as Runloop,c9 as Service,cb as VERSION}from"./main-DD9l9xzQ.js";const gs=new WeakMap,ys=Object.freeze(Object.defineProperty({__proto__:null,ASYNC_OBSERVERS:r,ComputedDescriptor:o,ComputedProperty:n,DEBUG_INJECTION_FUNCTIONS:i,Libraries:l,NAMESPACES:b,NAMESPACES_BY_ID:c,PROPERTY_DID_CHANGE:p,PROXY_CONTENT:d,SYNC_OBSERVERS:m,TrackedDescriptor:u,_getPath:g,_getProp:y,_setProp:_,activateObserver:O,addArrayObserver:S,addListener:f,addNamespace:C,addObserver:P,alias:h,arrayContentDidChange:v,arrayContentWillChange:j,autoComputed:E,beginPropertyChanges:M,cached:(...s)=>{const[t,r,o]=s,n=new WeakMap,i=o.get;o.get=function(){return n.has(this)||n.set(this,e(i.bind(this))),a(n.get(this))}},changeProperties:D,computed:N,createCache:e,defineDecorator:V,defineProperty:A,defineValue:w,deprecateProperty:function(e,a,r){Object.defineProperty(e,a,{configurable:!0,enumerable:!1,set(e){t(this,r,e)},get(){return s(this,r)}})},descriptorForDecorator:T,descriptorForProperty:I,eachProxyArrayDidChange:function(e,a,s,t){let r=gs.get(e);void 0!==r&&r.arrayDidChange(e,a,s,t)},eachProxyArrayWillChange:function(e,a,s,t){let r=gs.get(e);void 0!==r&&r.arrayWillChange(e,a,s,t)},endPropertyChanges:x,expandProperties:R,findNamespace:k,findNamespaces:F,flushAsyncObservers:L,get:s,getCachedValueFor:z,getProperties:G,getValue:a,hasListeners:U,hasUnknownProperty:B,inject:W,isClassicDecorator:Y,isComputed:H,isConst:J,isElementDescriptor:K,isNamespaceSearchDisabled:X,libraries:q,makeComputedDecorator:Q,markObjectAsDirty:Z,nativeDescDecorator:$,notifyPropertyChange:ee,objectAt:ae,on:se,processAllNamespaces:te,processNamespace:re,removeArrayObserver:oe,removeListener:ne,removeNamespace:ie,removeObserver:le,replace:be,replaceInNativeArray:pe,revalidateObservers:de,sendEvent:me,set:t,setClassicDecorator:ue,setNamespaceSearchDisabled:ge,setProperties:ye,setUnprocessedMixins:_e,tagForObject:Oe,tagForProperty:Se,tracked:fe,trySet:Ce},Symbol.toStringTag,{value:"Module"})),_s=Object.freeze(Object.defineProperty({__proto__:null,Input:Pe,Textarea:he,capabilities:ve,default:je,getComponentTemplate:Ee,setComponentManager:Me,setComponentTemplate:De},Symbol.toStringTag,{value:"Module"})),Os=Object.freeze(Object.defineProperty({__proto__:null,cacheFor:z,guidFor:Ne},Symbol.toStringTag,{value:"Module"})),Ss=Object.freeze(Object.defineProperty({__proto__:null,default:Ve},Symbol.toStringTag,{value:"Module"})),fs=Object.freeze(Object.defineProperty({__proto__:null,ENV:Ae,context:we,getENV:Te,getLookup:Ie,global:xe,setLookup:Re},Symbol.toStringTag,{value:"Module"})),Cs=Object.freeze(Object.defineProperty({__proto__:null,Meta:ke,UNDEFINED:Fe,counters:Le,meta:ze,peekMeta:Ge,setMeta:Ue},Symbol.toStringTag,{value:"Module"})),Ps=Object.freeze(Object.defineProperty({__proto__:null,ActionHandler:Be,Comparable:We,ContainerProxyMixin:Ye,MutableEnumerable:He,RSVP:Je,RegistryProxyMixin:Ke,TargetActionSupport:Xe,_ProxyMixin:qe,_contentFor:Qe,onerrorDefault:Ze},Symbol.toStringTag,{value:"Module"})),hs=Object.freeze(Object.defineProperty({__proto__:null,Cache:$e,GUID_KEY:ea,ROOT:aa,canInvoke:sa,checkHasSuper:ta,dictionary:ra,enumerableSymbol:oa,generateGuid:na,getDebugName:ia,getName:la,guidFor:Ne,intern:ba,isInternalSymbol:pa,isObject:da,isProxy:ma,lookupDescriptor:ua,observerListenerMetaFor:ga,setListeners:ya,setName:_a,setObservers:Oa,setProxy:Sa,setWithMandatorySetter:fa,setupMandatorySetter:Ca,symbol:Pa,teardownMandatorySetter:ha,toString:va,uuid:ja,wrap:Ea},Symbol.toStringTag,{value:"Module"})),vs=Object.freeze(Object.defineProperty({__proto__:null,ActionSupport:Ma,ComponentLookup:Da,CoreView:Na,EventDispatcher:Va,MUTABLE_CELL:Aa,ViewStates:wa,addChildView:Ta,clearElementView:Ia,clearViewElement:xa,constructStyleDeprecationMessage:Ra,getChildViews:ka,getElementView:Fa,getRootViews:La,getViewBoundingClientRect:za,getViewBounds:Ga,getViewClientRects:Ua,getViewElement:Ba,getViewId:Wa,isSimpleClick:Ya,setElementView:Ha,setViewElement:Ja},Symbol.toStringTag,{value:"Module"})),js=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:Ka,Promise:Xa,all:qa,allSettled:Qa,asap:Za,async:$a,cast:es,configure:as,default:ss,defer:ts,denodeify:rs,filter:os,hash:ns,hashSettled:is,map:ls,off:bs,on:cs,race:ps,reject:ds,resolve:ms,rethrow:us},Symbol.toStringTag,{value:"Module"}));export{Ss as ArrayMutable,_s as Component,fs as InternalsEnvironment,Cs as InternalsMeta,ys as InternalsMetal,Ps as InternalsRuntime,hs as InternalsUtils,vs as InternalsViews,Os as ObjectInternals,js as RSVP}; +import{c as e,g as a,a as s,s as t,A as r,C as o,b as n,D as i,L as l,N as b,d as c,P as p,e as d,S as m,T as u,_ as g,f as y,h as _,i as O,j as S,k as f,l as C,m as P,n as h,o as v,p as j,q as E,r as M,t as D,u as N,v as V,w as A,x as w,y as T,z as I,B as x,E as R,F as k,G as F,H as L,I as z,J as G,K as U,M as B,O as W,Q as Y,R as H,U as J,V as K,W as X,X as q,Y as Q,Z,$,a0 as ee,a1 as ae,a2 as se,a3 as te,a4 as re,a5 as oe,a6 as ne,a7 as ie,a8 as le,a9 as be,aa as pe,ab as de,ac as me,ad as ue,ae as ge,af as ye,ag as _e,ah as Oe,ai as Se,aj as fe,ak as Ce,al as Pe,am as he,an as ve,ao as je,ap as Ee,aq as Me,ar as De,as as Ne,at as Ve,au as Ae,av as we,aw as Te,ax as Ie,ay as xe,az as Re,aA as ke,aB as Fe,aC as Le,aD as ze,aE as Ge,aF as Ue,aG as Be,aH as We,aI as Ye,aJ as He,aK as Je,aL as Ke,aM as Xe,aN as qe,aO as Qe,aP as Ze,aQ as $e,aR as ea,aS as aa,aT as sa,aU as ta,aV as ra,aW as oa,aX as na,aY as ia,aZ as la,a_ as ba,a$ as pa,b0 as da,b1 as ma,b2 as ua,b3 as ga,b4 as ya,b5 as _a,b6 as Oa,b7 as Sa,b8 as fa,b9 as Ca,ba as Pa,bb as ha,bc as va,bd as ja,be as Ea,bf as Ma,bg as Da,bh as Na,bi as Va,bj as Aa,bk as wa,bl as Ta,bm as Ia,bn as xa,bo as Ra,bp as ka,bq as Fa,br as La,bs as za,bt as Ga,bu as Ua,bv as Ba,bw as Wa,bx as Ya,by as Ha,bz as Ja,bA as Ka,bB as Xa,bC as qa,bD as Qa,bE as Za,bF as $a,bG as es,bH as as,bI as ss,bJ as ts,bK as rs,bL as os,bM as ns,bN as is,bO as ls,bP as bs,bQ as cs,bR as ps,bS as ds,bT as ms,bU as us}from"./main-ji2SNMnp.js";export{bV as Application,bW as ApplicationNamespace,bX as Array,bY as ArrayProxy,bZ as Controller,b_ as Debug,b$ as EmberDestroyable,c0 as EmberObject,c1 as EnumerableMutable,cc as GlimmerComponent,cd as GlimmerManager,ce as GlimmerReference,cf as GlimmerRuntime,cg as GlimmerUtil,ch as GlimmerValidator,c2 as Instrumentation,c0 as Object,c3 as ObjectCore,c4 as ObjectEvented,c5 as ObjectObservable,c6 as ObjectPromiseProxyMixin,c7 as ObjectProxy,ca as Owner,c8 as Runloop,c9 as Service,cb as VERSION}from"./main-ji2SNMnp.js";const gs=new WeakMap,ys=Object.freeze(Object.defineProperty({__proto__:null,ASYNC_OBSERVERS:r,ComputedDescriptor:o,ComputedProperty:n,DEBUG_INJECTION_FUNCTIONS:i,Libraries:l,NAMESPACES:b,NAMESPACES_BY_ID:c,PROPERTY_DID_CHANGE:p,PROXY_CONTENT:d,SYNC_OBSERVERS:m,TrackedDescriptor:u,_getPath:g,_getProp:y,_setProp:_,activateObserver:O,addArrayObserver:S,addListener:f,addNamespace:C,addObserver:P,alias:h,arrayContentDidChange:v,arrayContentWillChange:j,autoComputed:E,beginPropertyChanges:M,cached:(...s)=>{const[t,r,o]=s,n=new WeakMap,i=o.get;o.get=function(){return n.has(this)||n.set(this,e(i.bind(this))),a(n.get(this))}},changeProperties:D,computed:N,createCache:e,defineDecorator:V,defineProperty:A,defineValue:w,deprecateProperty:function(e,a,r){Object.defineProperty(e,a,{configurable:!0,enumerable:!1,set(e){t(this,r,e)},get(){return s(this,r)}})},descriptorForDecorator:T,descriptorForProperty:I,eachProxyArrayDidChange:function(e,a,s,t){let r=gs.get(e);void 0!==r&&r.arrayDidChange(e,a,s,t)},eachProxyArrayWillChange:function(e,a,s,t){let r=gs.get(e);void 0!==r&&r.arrayWillChange(e,a,s,t)},endPropertyChanges:x,expandProperties:R,findNamespace:k,findNamespaces:F,flushAsyncObservers:L,get:s,getCachedValueFor:z,getProperties:G,getValue:a,hasListeners:U,hasUnknownProperty:B,inject:W,isClassicDecorator:Y,isComputed:H,isConst:J,isElementDescriptor:K,isNamespaceSearchDisabled:X,libraries:q,makeComputedDecorator:Q,markObjectAsDirty:Z,nativeDescDecorator:$,notifyPropertyChange:ee,objectAt:ae,on:se,processAllNamespaces:te,processNamespace:re,removeArrayObserver:oe,removeListener:ne,removeNamespace:ie,removeObserver:le,replace:be,replaceInNativeArray:pe,revalidateObservers:de,sendEvent:me,set:t,setClassicDecorator:ue,setNamespaceSearchDisabled:ge,setProperties:ye,setUnprocessedMixins:_e,tagForObject:Oe,tagForProperty:Se,tracked:fe,trySet:Ce},Symbol.toStringTag,{value:"Module"})),_s=Object.freeze(Object.defineProperty({__proto__:null,Input:Pe,Textarea:he,capabilities:ve,default:je,getComponentTemplate:Ee,setComponentManager:Me,setComponentTemplate:De},Symbol.toStringTag,{value:"Module"})),Os=Object.freeze(Object.defineProperty({__proto__:null,cacheFor:z,guidFor:Ne},Symbol.toStringTag,{value:"Module"})),Ss=Object.freeze(Object.defineProperty({__proto__:null,default:Ve},Symbol.toStringTag,{value:"Module"})),fs=Object.freeze(Object.defineProperty({__proto__:null,ENV:Ae,context:we,getENV:Te,getLookup:Ie,global:xe,setLookup:Re},Symbol.toStringTag,{value:"Module"})),Cs=Object.freeze(Object.defineProperty({__proto__:null,Meta:ke,UNDEFINED:Fe,counters:Le,meta:ze,peekMeta:Ge,setMeta:Ue},Symbol.toStringTag,{value:"Module"})),Ps=Object.freeze(Object.defineProperty({__proto__:null,ActionHandler:Be,Comparable:We,ContainerProxyMixin:Ye,MutableEnumerable:He,RSVP:Je,RegistryProxyMixin:Ke,TargetActionSupport:Xe,_ProxyMixin:qe,_contentFor:Qe,onerrorDefault:Ze},Symbol.toStringTag,{value:"Module"})),hs=Object.freeze(Object.defineProperty({__proto__:null,Cache:$e,GUID_KEY:ea,ROOT:aa,canInvoke:sa,checkHasSuper:ta,dictionary:ra,enumerableSymbol:oa,generateGuid:na,getDebugName:ia,getName:la,guidFor:Ne,intern:ba,isInternalSymbol:pa,isObject:da,isProxy:ma,lookupDescriptor:ua,observerListenerMetaFor:ga,setListeners:ya,setName:_a,setObservers:Oa,setProxy:Sa,setWithMandatorySetter:fa,setupMandatorySetter:Ca,symbol:Pa,teardownMandatorySetter:ha,toString:va,uuid:ja,wrap:Ea},Symbol.toStringTag,{value:"Module"})),vs=Object.freeze(Object.defineProperty({__proto__:null,ActionSupport:Ma,ComponentLookup:Da,CoreView:Na,EventDispatcher:Va,MUTABLE_CELL:Aa,ViewStates:wa,addChildView:Ta,clearElementView:Ia,clearViewElement:xa,constructStyleDeprecationMessage:Ra,getChildViews:ka,getElementView:Fa,getRootViews:La,getViewBoundingClientRect:za,getViewBounds:Ga,getViewClientRects:Ua,getViewElement:Ba,getViewId:Wa,isSimpleClick:Ya,setElementView:Ha,setViewElement:Ja},Symbol.toStringTag,{value:"Module"})),js=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:Ka,Promise:Xa,all:qa,allSettled:Qa,asap:Za,async:$a,cast:es,configure:as,default:ss,defer:ts,denodeify:rs,filter:os,hash:ns,hashSettled:is,map:ls,off:bs,on:cs,race:ps,reject:ds,resolve:ms,rethrow:us},Symbol.toStringTag,{value:"Module"}));export{Ss as ArrayMutable,_s as Component,fs as InternalsEnvironment,Cs as InternalsMeta,ys as InternalsMetal,Ps as InternalsRuntime,hs as InternalsUtils,vs as InternalsViews,Os as ObjectInternals,js as RSVP}; diff --git a/release/index.html b/release/index.html index f1bd3d8..d02c697 100644 --- a/release/index.html +++ b/release/index.html @@ -26,7 +26,7 @@ - +